@verdocs/web-sdk 2.2.21 → 2.2.22

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 (176) hide show
  1. package/dist/cjs/{TemplateStore-66577b50.js → TemplateStore-a5fa2b0c.js} +1 -1
  2. package/dist/cjs/{VerdocsEndpoint-a2dc85ad.js → VerdocsEndpoint-45deeb6a.js} +2 -2
  3. package/dist/cjs/ipc-test.cjs.entry.js +2 -2
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/verdocs-activity-box.cjs.entry.js +1 -1
  6. package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
  7. package/dist/cjs/verdocs-build.cjs.entry.js +24 -77
  8. package/dist/cjs/verdocs-button-panel_2.cjs.entry.js +2 -2
  9. package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +1 -1
  10. package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +1 -1
  11. package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +1 -1
  12. package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
  13. package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +1 -1
  14. package/dist/cjs/verdocs-field-textarea.cjs.entry.js +1 -1
  15. package/dist/cjs/verdocs-field-textbox.cjs.entry.js +1 -1
  16. package/dist/cjs/verdocs-file-chooser_2.cjs.entry.js +1 -1
  17. package/dist/cjs/{verdocs-preview_7.cjs.entry.js → verdocs-preview_8.cjs.entry.js} +96 -2
  18. package/dist/cjs/verdocs-quick-functions_3.cjs.entry.js +1 -1
  19. package/dist/cjs/verdocs-search.cjs.entry.js +1 -1
  20. package/dist/cjs/verdocs-settings-api-keys_4.cjs.entry.js +1 -1
  21. package/dist/cjs/verdocs-settings.cjs.entry.js +1 -1
  22. package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
  23. package/dist/cjs/verdocs-tabs.cjs.entry.js +0 -8
  24. package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +1 -1
  25. package/dist/cjs/verdocs-template-fields_4.cjs.entry.js +11 -5
  26. package/dist/cjs/verdocs-template-star.cjs.entry.js +1 -1
  27. package/dist/cjs/verdocs-templates-list.cjs.entry.js +1 -1
  28. package/dist/cjs/verdocs-view.cjs.entry.js +1 -1
  29. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  30. package/dist/collection/collection-manifest.json +1 -0
  31. package/dist/collection/components/controls/verdocs-tabs/verdocs-tabs.js +5 -17
  32. package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +25 -38
  33. package/dist/collection/components/templates/verdocs-template-build-tabs/verdocs-template-build-tabs.css +25 -0
  34. package/dist/collection/components/templates/verdocs-template-build-tabs/verdocs-template-build-tabs.js +219 -0
  35. package/dist/collection/components/templates/verdocs-template-build-tabs/verdocs-template-build-tabs.stories.js +16 -0
  36. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +9 -3
  37. package/dist/components/VerdocsEndpoint.js +1 -1
  38. package/dist/components/index.d.ts +1 -0
  39. package/dist/components/index.js +1 -0
  40. package/dist/components/verdocs-build.js +61 -109
  41. package/dist/components/verdocs-tabs2.js +1 -10
  42. package/dist/components/verdocs-template-build-tabs.d.ts +11 -0
  43. package/dist/components/verdocs-template-build-tabs.js +6 -0
  44. package/dist/components/verdocs-template-build-tabs2.js +132 -0
  45. package/dist/components/verdocs-template-roles2.js +9 -3
  46. package/dist/docs.json +137 -11
  47. package/dist/esm/{TemplateStore-3c138524.js → TemplateStore-e8cf5a15.js} +1 -1
  48. package/dist/esm/{VerdocsEndpoint-6fe4258b.js → VerdocsEndpoint-d58d5544.js} +1 -1
  49. package/dist/esm/ipc-test.entry.js +2 -2
  50. package/dist/esm/loader.js +1 -1
  51. package/dist/esm/verdocs-activity-box.entry.js +1 -1
  52. package/dist/esm/verdocs-auth.entry.js +1 -1
  53. package/dist/esm/verdocs-build.entry.js +25 -78
  54. package/dist/esm/verdocs-button-panel_2.entry.js +2 -2
  55. package/dist/esm/verdocs-contact-picker_2.entry.js +1 -1
  56. package/dist/esm/verdocs-envelope-document-page.entry.js +1 -1
  57. package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +1 -1
  58. package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
  59. package/dist/esm/verdocs-envelopes-list.entry.js +1 -1
  60. package/dist/esm/verdocs-field-textarea.entry.js +1 -1
  61. package/dist/esm/verdocs-field-textbox.entry.js +1 -1
  62. package/dist/esm/verdocs-file-chooser_2.entry.js +1 -1
  63. package/dist/esm/{verdocs-preview_7.entry.js → verdocs-preview_8.entry.js} +96 -3
  64. package/dist/esm/verdocs-quick-functions_3.entry.js +1 -1
  65. package/dist/esm/verdocs-search.entry.js +1 -1
  66. package/dist/esm/verdocs-settings-api-keys_4.entry.js +1 -1
  67. package/dist/esm/verdocs-settings.entry.js +1 -1
  68. package/dist/esm/verdocs-sign.entry.js +1 -1
  69. package/dist/esm/verdocs-tabs.entry.js +0 -8
  70. package/dist/esm/verdocs-template-document-page_2.entry.js +1 -1
  71. package/dist/esm/verdocs-template-fields_4.entry.js +11 -5
  72. package/dist/esm/verdocs-template-star.entry.js +1 -1
  73. package/dist/esm/verdocs-templates-list.entry.js +1 -1
  74. package/dist/esm/verdocs-view.entry.js +1 -1
  75. package/dist/esm/verdocs-web-sdk.js +1 -1
  76. package/dist/esm-es5/{TemplateStore-3c138524.js → TemplateStore-e8cf5a15.js} +1 -1
  77. package/dist/esm-es5/{VerdocsEndpoint-6fe4258b.js → VerdocsEndpoint-d58d5544.js} +1 -1
  78. package/dist/esm-es5/ipc-test.entry.js +1 -1
  79. package/dist/esm-es5/loader.js +1 -1
  80. package/dist/esm-es5/verdocs-activity-box.entry.js +1 -1
  81. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  82. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  83. package/dist/esm-es5/verdocs-button-panel_2.entry.js +1 -1
  84. package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
  85. package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
  86. package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
  87. package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
  88. package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
  89. package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
  90. package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
  91. package/dist/esm-es5/verdocs-file-chooser_2.entry.js +1 -1
  92. package/dist/esm-es5/verdocs-preview_8.entry.js +1 -0
  93. package/dist/esm-es5/verdocs-quick-functions_3.entry.js +1 -1
  94. package/dist/esm-es5/verdocs-search.entry.js +1 -1
  95. package/dist/esm-es5/verdocs-settings-api-keys_4.entry.js +1 -1
  96. package/dist/esm-es5/verdocs-settings.entry.js +1 -1
  97. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  98. package/dist/esm-es5/verdocs-tabs.entry.js +1 -1
  99. package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
  100. package/dist/esm-es5/verdocs-template-fields_4.entry.js +1 -1
  101. package/dist/esm-es5/verdocs-template-star.entry.js +1 -1
  102. package/dist/esm-es5/verdocs-templates-list.entry.js +1 -1
  103. package/dist/esm-es5/verdocs-view.entry.js +1 -1
  104. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  105. package/dist/types/components/controls/verdocs-tabs/verdocs-tabs.d.ts +3 -5
  106. package/dist/types/components/embeds/verdocs-build/verdocs-build.d.ts +5 -4
  107. package/dist/types/components/templates/verdocs-template-build-tabs/verdocs-template-build-tabs.d.ts +39 -0
  108. package/dist/types/components/templates/verdocs-template-build-tabs/verdocs-template-build-tabs.stories.d.ts +8 -0
  109. package/dist/types/components/templates/verdocs-template-roles/verdocs-template-roles.d.ts +1 -0
  110. package/dist/types/components.d.ts +56 -6
  111. package/dist/verdocs-web-sdk/{p-963f6e05.system.entry.js → p-07696831.system.entry.js} +1 -1
  112. package/dist/verdocs-web-sdk/{p-8eb640c4.system.entry.js → p-07b5f356.system.entry.js} +1 -1
  113. package/dist/verdocs-web-sdk/{p-957e1e4e.entry.js → p-0b2102df.entry.js} +1 -1
  114. package/dist/verdocs-web-sdk/{p-ec9f11dc.system.entry.js → p-0df9e6e1.system.entry.js} +1 -1
  115. package/dist/verdocs-web-sdk/p-15df3998.system.entry.js +1 -0
  116. package/dist/verdocs-web-sdk/{p-724d4efa.system.js → p-1753f57b.system.js} +1 -1
  117. package/dist/verdocs-web-sdk/p-1dda2d09.entry.js +1 -0
  118. package/dist/verdocs-web-sdk/{p-7fb8387d.system.entry.js → p-21e137f0.system.entry.js} +1 -1
  119. package/dist/verdocs-web-sdk/{p-1ab8f7f6.system.entry.js → p-2284d430.system.entry.js} +1 -1
  120. package/dist/verdocs-web-sdk/{p-49777798.system.entry.js → p-2549a794.system.entry.js} +1 -1
  121. package/dist/verdocs-web-sdk/{p-53fb6c8c.entry.js → p-2b6e4f2a.entry.js} +1 -1
  122. package/dist/verdocs-web-sdk/{p-a06f6e8e.entry.js → p-3a90098d.entry.js} +1 -1
  123. package/dist/verdocs-web-sdk/{p-4a3f9e45.entry.js → p-3da4fed1.entry.js} +1 -1
  124. package/dist/verdocs-web-sdk/{p-3a5d8085.system.entry.js → p-4017b53a.system.entry.js} +1 -1
  125. package/dist/verdocs-web-sdk/{p-f867f61b.entry.js → p-428de4a5.entry.js} +1 -1
  126. package/dist/verdocs-web-sdk/{p-6c4de84c.entry.js → p-42f27e8c.entry.js} +1 -1
  127. package/dist/verdocs-web-sdk/p-4422958b.system.js +1 -0
  128. package/dist/verdocs-web-sdk/{p-71d6e1c3.system.entry.js → p-45bee3f6.system.entry.js} +1 -1
  129. package/dist/verdocs-web-sdk/{p-92e3d974.system.entry.js → p-45d5e035.system.entry.js} +1 -1
  130. package/dist/verdocs-web-sdk/{p-0fa99a06.system.entry.js → p-48c62137.system.entry.js} +1 -1
  131. package/dist/verdocs-web-sdk/{p-79c09ffc.system.entry.js → p-506754d5.system.entry.js} +1 -1
  132. package/dist/verdocs-web-sdk/{p-79410da3.entry.js → p-51979353.entry.js} +1 -1
  133. package/dist/verdocs-web-sdk/{p-2cb422a2.entry.js → p-5ab837bf.entry.js} +1 -1
  134. package/dist/verdocs-web-sdk/p-65c99d51.system.entry.js +1 -0
  135. package/dist/verdocs-web-sdk/{p-96fb90bd.system.entry.js → p-66cec042.system.entry.js} +1 -1
  136. package/dist/verdocs-web-sdk/{p-f732abf1.entry.js → p-6ccb86b6.entry.js} +1 -1
  137. package/dist/verdocs-web-sdk/p-6f1e794d.system.entry.js +1 -0
  138. package/dist/verdocs-web-sdk/p-70685224.entry.js +1 -0
  139. package/dist/verdocs-web-sdk/{p-58c8584e.entry.js → p-77ecee31.entry.js} +1 -1
  140. package/dist/verdocs-web-sdk/{p-b3b370b5.entry.js → p-78e4f430.entry.js} +1 -1
  141. package/dist/verdocs-web-sdk/{p-6734b77c.entry.js → p-79b0c643.entry.js} +1 -1
  142. package/dist/verdocs-web-sdk/{p-c26d3d7b.system.entry.js → p-7bd5db75.system.entry.js} +1 -1
  143. package/dist/verdocs-web-sdk/{p-5ed21587.entry.js → p-84efd562.entry.js} +1 -1
  144. package/dist/verdocs-web-sdk/{p-b3706eb2.system.entry.js → p-883d60e1.system.entry.js} +1 -1
  145. package/dist/verdocs-web-sdk/p-8d14ace0.entry.js +1 -0
  146. package/dist/verdocs-web-sdk/{p-87c527e4.entry.js → p-9009e136.entry.js} +1 -1
  147. package/dist/verdocs-web-sdk/{p-a41a8742.entry.js → p-965b66a8.entry.js} +1 -1
  148. package/dist/verdocs-web-sdk/{p-99c8acfa.system.entry.js → p-a0ad315e.system.entry.js} +1 -1
  149. package/dist/verdocs-web-sdk/{p-d56ac75b.entry.js → p-a1e82d5a.entry.js} +1 -1
  150. package/dist/verdocs-web-sdk/{p-a8aefe57.system.entry.js → p-a894761f.system.entry.js} +1 -1
  151. package/dist/verdocs-web-sdk/{p-ab7df219.system.entry.js → p-aba05f25.system.entry.js} +1 -1
  152. package/dist/verdocs-web-sdk/{p-c488219f.entry.js → p-ad273610.entry.js} +1 -1
  153. package/dist/verdocs-web-sdk/{p-1e48cc2c.system.entry.js → p-ae971bb4.system.entry.js} +1 -1
  154. package/dist/verdocs-web-sdk/{p-53276c5b.js → p-af048fad.js} +1 -1
  155. package/dist/verdocs-web-sdk/{p-ec06b3d1.entry.js → p-ba04698a.entry.js} +1 -1
  156. package/dist/verdocs-web-sdk/{p-55f66c83.entry.js → p-bbd400a5.entry.js} +1 -1
  157. package/dist/verdocs-web-sdk/{p-38031118.system.entry.js → p-cd64b223.system.entry.js} +1 -1
  158. package/dist/verdocs-web-sdk/{p-e36c7481.entry.js → p-d4aec860.entry.js} +1 -1
  159. package/dist/verdocs-web-sdk/{p-2c5e2d73.js → p-d4d8858f.js} +1 -1
  160. package/dist/verdocs-web-sdk/{p-a6d93251.entry.js → p-e40dd4d1.entry.js} +1 -1
  161. package/dist/verdocs-web-sdk/{p-f8210aa7.system.entry.js → p-edabba6b.system.entry.js} +1 -1
  162. package/dist/verdocs-web-sdk/p-f04bf956.system.js +1 -1
  163. package/dist/verdocs-web-sdk/{p-994623c4.entry.js → p-f2deae25.entry.js} +1 -1
  164. package/dist/verdocs-web-sdk/{p-3e20d28c.system.entry.js → p-f9e89b56.system.entry.js} +1 -1
  165. package/dist/verdocs-web-sdk/{p-75435256.system.entry.js → p-fab73ec8.system.entry.js} +1 -1
  166. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  167. package/package.json +1 -1
  168. package/dist/custom-elements.json +0 -2021
  169. package/dist/esm-es5/verdocs-preview_7.entry.js +0 -1
  170. package/dist/verdocs-web-sdk/p-08571348.entry.js +0 -1
  171. package/dist/verdocs-web-sdk/p-3d25b680.entry.js +0 -1
  172. package/dist/verdocs-web-sdk/p-473f6990.system.entry.js +0 -1
  173. package/dist/verdocs-web-sdk/p-65e1ab33.system.entry.js +0 -1
  174. package/dist/verdocs-web-sdk/p-9e15bdda.system.js +0 -1
  175. package/dist/verdocs-web-sdk/p-b860a7fe.entry.js +0 -1
  176. package/dist/verdocs-web-sdk/p-d07dcf76.system.entry.js +0 -1
@@ -1,51 +1,11 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
1
+ import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, a as getElement } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { P as Permissions, V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
4
- import { g as getTemplateStore } from './TemplateStore-3c138524.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
+ import { g as getTemplateStore } from './TemplateStore-e8cf5a15.js';
5
5
  import { S as SDKError } from './errors-9b5498c8.js';
6
6
  import './index-4439b0d1.js';
7
7
  import './Templates-f90883f7.js';
8
8
 
9
- /**
10
- * Confirm whether the user has all of the specified permissions.
11
- */
12
- var userHasPermissions = function (session, permissions) {
13
- return permissions.every(function (perm) { return ((session === null || session === void 0 ? void 0 : session.permissions) || []).includes(perm); });
14
- };
15
-
16
- /**
17
- * Various helpers to identify available operations for a template by a user.
18
- *
19
- * @module
20
- */
21
- /**
22
- * Check to see if the user created the template.
23
- */
24
- var userIsTemplateCreator = function (session, template) {
25
- return session && template && session.profile_id === template.profile_id;
26
- };
27
- /**
28
- * Check to see if a template is "shared" with the user.
29
- */
30
- var userHasSharedTemplate = function (session, template) {
31
- return session && template && !template.is_personal && session.organization_id === template.organization_id;
32
- };
33
- /**
34
- * Check to see if the user can update a tempate.
35
- */
36
- var userCanUpdateTemplate = function (session, template) {
37
- return userIsTemplateCreator(session, template) ||
38
- (userHasSharedTemplate(session, template) &&
39
- userHasPermissions(session, [Permissions.TEMPLATE_MEMBER_READ, Permissions.TEMPLATE_MEMBER_WRITE]));
40
- };
41
- /**
42
- * Check to see if the user can "build" the template (use the field builder). The user must have write access to the
43
- * template, and the template must have at least one signer role.
44
- */
45
- var userCanBuildTemplate = function (session, template) {
46
- return userCanUpdateTemplate(session, template) && (template.roles || []).filter(function (role) { return role.type === 'signer'; }).length > 0;
47
- };
48
-
49
9
  const verdocsBuildCss = "verdocs-build{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-build .content{-ms-flex:1;flex:1;gap:20px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column}verdocs-build verdocs-template-attachments,verdocs-build verdocs-template-roles{margin:20px}verdocs-build verdocs-template-fields{border-top:1px solid #777777}verdocs-build verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-build verdocs-template-fields{width:100%}verdocs-build verdocs-preview{-ms-flex:1;flex:1}";
50
10
 
51
11
  const VerdocsBuild = class {
@@ -60,11 +20,14 @@ const VerdocsBuild = class {
60
20
  this.templateId = null;
61
21
  this.step = 'preview';
62
22
  this.store = null;
63
- this.tabsUpdateKey = 1;
64
23
  }
65
- onTemplateIdChanged() {
66
- console.log('Template ID changed', this.templateId);
67
- this.loadTemplate().catch((e) => console.log('Unknown Error', e));
24
+ onTemplateIdChanged(newTemplateId) {
25
+ console.log('Template ID changed', newTemplateId);
26
+ this.loadTemplate(newTemplateId).catch((e) => console.log('Unknown Error', e));
27
+ }
28
+ onStepChanged(newStep) {
29
+ console.log('Step changed', newStep);
30
+ this.loadTemplate(this.templateId).catch((e) => console.log('Unknown Error', e));
68
31
  }
69
32
  async componentWillLoad() {
70
33
  var _a, _b, _c;
@@ -79,16 +42,18 @@ const VerdocsBuild = class {
79
42
  console.log('[BUILD] Unable to start builder session, must be authenticated');
80
43
  return;
81
44
  }
82
- this.loadTemplate().catch(e => console.log('[BUILD] Unable to load template', e));
45
+ this.loadTemplate(this.templateId).catch(e => console.log('[BUILD] Unable to load template', e));
83
46
  }
84
47
  catch (e) {
85
48
  console.log('[BUILD] Error loading template', e);
86
49
  (_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));
87
50
  }
88
51
  }
89
- async loadTemplate() {
90
- if (this.templateId) {
91
- this.store = await getTemplateStore(this.endpoint, this.templateId, true);
52
+ async loadTemplate(templateId) {
53
+ if (templateId) {
54
+ console.log('Loading store', templateId);
55
+ this.store = await getTemplateStore(this.endpoint, templateId, true);
56
+ forceUpdate(this.el);
92
57
  }
93
58
  }
94
59
  handleCancel(e) {
@@ -97,8 +62,8 @@ const VerdocsBuild = class {
97
62
  }
98
63
  async handleTemplateCreated(templateId) {
99
64
  var _a;
65
+ await this.loadTemplate(templateId);
100
66
  this.templateId = templateId;
101
- await this.loadTemplate();
102
67
  this.step = 'roles';
103
68
  (_a = this.stepChanged) === null || _a === void 0 ? void 0 : _a.emit('roles');
104
69
  }
@@ -106,7 +71,6 @@ const VerdocsBuild = class {
106
71
  var _a;
107
72
  console.log('tup');
108
73
  (_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
109
- this.tabsUpdateKey++;
110
74
  }
111
75
  handleAttachmentsNext() {
112
76
  var _a;
@@ -118,44 +82,27 @@ const VerdocsBuild = class {
118
82
  this.step = 'fields';
119
83
  (_a = this.stepChanged) === null || _a === void 0 ? void 0 : _a.emit('fields');
120
84
  }
121
- setStep(e, step) {
85
+ handleStepChanged(step) {
122
86
  var _a;
123
- e.stopPropagation();
124
- e.preventDefault();
87
+ console.log('osc', step);
125
88
  this.step = step;
126
89
  (_a = this.stepChanged) === null || _a === void 0 ? void 0 : _a.emit(step);
127
90
  }
128
91
  render() {
129
- var _a, _b, _c;
130
92
  if (!this.endpoint.session) {
131
93
  return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
132
94
  }
133
- if (!this.templateId || !this.store) {
95
+ if (!this.store) {
134
96
  console.log('[BUILD] No template ID, rendering created view');
135
- return (h(Host, null, h("div", { class: "content" }, h("verdocs-tabs", { key: this.tabsUpdateKey, onSelectTab: () => { }, tabs: [
136
- { id: 'attachments', disabled: false, label: 'Upload Attachment(s)' },
137
- { id: 'roles', disabled: true, label: 'Roles' },
138
- { id: 'settings', disabled: true, label: 'Settings' },
139
- { id: 'fields', disabled: true, label: 'Fields' },
140
- { id: 'preview', disabled: true, label: 'Preview/Send' },
141
- ] }), h("verdocs-template-create", { endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleAttachmentsNext(), onTemplateCreated: e => this.handleTemplateCreated(e.detail.templateId) }))));
97
+ return (h(Host, null, h("div", { class: "content" }, h("verdocs-template-build-tabs", { endpoint: this.endpoint, templateId: this.templateId, step: "attachments", onSdkError: e => { var _a; return (_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(e.detail); }, onStepChanged: e => this.handleStepChanged(e.detail) }), h("verdocs-template-create", { endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleAttachmentsNext(), onTemplateCreated: e => this.handleTemplateCreated(e.detail.templateId) }))));
142
98
  }
143
99
  console.log('[BUILD] Rendering build view', this.step, ['attachments', 'roles', 'settings', 'fields', 'preview'].indexOf(this.step));
144
- // const canPreview = this.store && userCanPreviewTemplate(this.endpoint.session, this.store?.state);
145
- // TODO: Had to disable this for now to research why reactivity isn't re-rendering the tabs
146
- const canPreview = this.store && userCanBuildTemplate(this.endpoint.session, (_a = this.store) === null || _a === void 0 ? void 0 : _a.state);
147
- const canEditFields = this.store && userCanBuildTemplate(this.endpoint.session, (_b = this.store) === null || _b === void 0 ? void 0 : _b.state);
148
- const canEditRoles = this.store && userCanUpdateTemplate(this.endpoint.session, (_c = this.store) === null || _c === void 0 ? void 0 : _c.state);
149
- return (h(Host, null, h("div", { class: "content" }, h("verdocs-tabs", { key: this.tabsUpdateKey, onSelectTab: e => this.setStep(e, e.detail.tab.id), defaultTab: ['attachments', 'roles', 'settings', 'fields', 'preview'].indexOf(this.step), tabs: [
150
- { id: 'attachments', disabled: false, label: 'Attachment(s)' },
151
- { id: 'roles', disabled: !canEditRoles, label: 'Roles' },
152
- { id: 'settings', disabled: !canEditFields, label: 'Settings' },
153
- { id: 'fields', disabled: !canEditFields, label: 'Fields' },
154
- { id: 'preview', disabled: !canPreview, label: 'Preview/Send' },
155
- ] }), this.step === 'attachments' && (h("verdocs-template-attachments", { templateId: this.templateId, endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleAttachmentsNext(), onTemplateUpdated: e => this.handleTemplateUpdated(e) })), this.step === 'roles' && (h("verdocs-template-roles", { templateId: this.templateId, endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleRolesNext(), onTemplateUpdated: e => this.handleTemplateUpdated(e) })), this.step === 'settings' && (h("div", { style: { flexDirection: 'column', gap: '20px', display: 'flex', maxWidth: '400px', margin: '20px' } }, h("verdocs-template-name", { templateId: this.templateId, endpoint: this.endpoint, style: { backgroundColor: '#ffffff', padding: '20px' }, onTemplateUpdated: e => this.handleTemplateUpdated(e) }), h("verdocs-template-reminders", { templateId: this.templateId, endpoint: this.endpoint, style: { backgroundColor: '#ffffff', padding: '20px' }, onTemplateUpdated: e => this.handleTemplateUpdated(e) }), h("verdocs-template-visibility", { templateId: this.templateId, endpoint: this.endpoint, style: { backgroundColor: '#ffffff', padding: '20px' }, onTemplateUpdated: e => this.handleTemplateUpdated(e) }))), this.step === 'fields' && h("verdocs-template-fields", { templateId: this.templateId, endpoint: this.endpoint, onTemplateUpdated: e => this.handleTemplateUpdated(e) }), this.step === 'preview' && (h("div", { style: { flexDirection: 'row', display: 'flex', width: '100%', backgroundColor: '#eeeeee', maxHeight: '100%' } }, h("div", { style: { display: 'flex', flex: '0 0 300px', backgroundColor: '#ffffff', boxShadow: '1px 1px 6px -2px #0000007f' } }, h("verdocs-send", { templateId: this.templateId, endpoint: this.endpoint, onSend: e => { var _a; return (_a = this.send) === null || _a === void 0 ? void 0 : _a.emit(e.detail); }, style: { width: '100%' } })), h("div", { style: { display: 'flex', flex: '1', justifyContent: 'center', overflowY: 'scroll' } }, h("verdocs-preview", { templateId: this.templateId, endpoint: this.endpoint, style: { display: 'flex', flex: '1', maxWidth: '1000px' } })))))));
100
+ return (h(Host, null, h("div", { class: "content" }, h("verdocs-template-build-tabs", { endpoint: this.endpoint, templateId: this.templateId, step: this.step, onSdkError: e => { var _a; return (_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(e.detail); }, onStepChanged: e => this.handleStepChanged(e.detail) }), this.step === 'attachments' && (h("verdocs-template-attachments", { templateId: this.templateId, endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleAttachmentsNext(), onTemplateUpdated: e => this.handleTemplateUpdated(e) })), this.step === 'roles' && (h("verdocs-template-roles", { templateId: this.templateId, endpoint: this.endpoint, onExit: e => this.handleCancel(e), onNext: () => this.handleRolesNext(), onTemplateUpdated: e => this.handleTemplateUpdated(e) })), this.step === 'settings' && (h("div", { style: { flexDirection: 'column', gap: '20px', display: 'flex', maxWidth: '400px', margin: '20px' } }, h("verdocs-template-name", { templateId: this.templateId, endpoint: this.endpoint, style: { backgroundColor: '#ffffff', padding: '20px' }, onTemplateUpdated: e => this.handleTemplateUpdated(e) }), h("verdocs-template-reminders", { templateId: this.templateId, endpoint: this.endpoint, style: { backgroundColor: '#ffffff', padding: '20px' }, onTemplateUpdated: e => this.handleTemplateUpdated(e) }), h("verdocs-template-visibility", { templateId: this.templateId, endpoint: this.endpoint, style: { backgroundColor: '#ffffff', padding: '20px' }, onTemplateUpdated: e => this.handleTemplateUpdated(e) }))), this.step === 'fields' && h("verdocs-template-fields", { templateId: this.templateId, endpoint: this.endpoint, onTemplateUpdated: e => this.handleTemplateUpdated(e) }), this.step === 'preview' && (h("div", { style: { flexDirection: 'row', display: 'flex', width: '100%', backgroundColor: '#eeeeee', maxHeight: '100%' } }, h("div", { style: { display: 'flex', flex: '0 0 300px', backgroundColor: '#ffffff', boxShadow: '1px 1px 6px -2px #0000007f' } }, h("verdocs-send", { templateId: this.templateId, endpoint: this.endpoint, onSend: e => { var _a; return (_a = this.send) === null || _a === void 0 ? void 0 : _a.emit(e.detail); }, style: { width: '100%' } })), h("div", { style: { display: 'flex', flex: '1', justifyContent: 'center', overflowY: 'scroll' } }, h("verdocs-preview", { templateId: this.templateId, endpoint: this.endpoint, style: { display: 'flex', flex: '1', maxWidth: '1000px' } })))))));
156
101
  }
102
+ get el() { return getElement(this); }
157
103
  static get watchers() { return {
158
- "templateId": ["onTemplateIdChanged"]
104
+ "templateId": ["onTemplateIdChanged"],
105
+ "step": ["onStepChanged"]
159
106
  }; }
160
107
  };
161
108
  VerdocsBuild.style = verdocsBuildCss;
@@ -2,9 +2,9 @@ import { r as registerInstance, h, H as Host, c as createEvent, a as getElement
2
2
  import { c as createPopper } from './popper-15e448b4.js';
3
3
  import { a as commonjsGlobal } from './_commonjsHelpers-5ec8f9b7.js';
4
4
  import './Types-5f31149e.js';
5
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
5
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
6
6
  import { u as updateField, d as deleteField } from './Fields-c82e6df3.js';
7
- import { g as getTemplateStore } from './TemplateStore-3c138524.js';
7
+ import { g as getTemplateStore } from './TemplateStore-e8cf5a15.js';
8
8
  import { S as SDKError } from './errors-9b5498c8.js';
9
9
  import './index-4439b0d1.js';
10
10
  import './Templates-f90883f7.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
4
  import { d as convertToE164 } from './utils-c0cd0b91.js';
5
5
  import './_commonjsHelpers-5ec8f9b7.js';
6
6
  import './Envelopes-5e32159f.js';
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-172625c5.js';
2
2
  import { j as getEnvelopeDocumentPageDisplayUri } from './Envelopes-5e32159f.js';
3
3
  import './Types-5f31149e.js';
4
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
4
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
5
5
  import { t as throttle } from './utils-c0cd0b91.js';
6
6
  import './_commonjsHelpers-5ec8f9b7.js';
7
7
  import './Files-70a192df.js';
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
3
  import { g as getInPersonLink } from './Recipients-4ec2138c.js';
4
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
4
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
5
5
  import { g as getEnvelopeStore } from './EnvelopeStore-7f484014.js';
6
6
  import { V as VerdocsToast } from './Toast-f3b8fd46.js';
7
7
  import { S as SDKError } from './errors-9b5498c8.js';
@@ -3,7 +3,7 @@ import { c as cancelEnvelope } from './Envelopes-5e32159f.js';
3
3
  import { u as userIsEnvelopeOwner } from './Permissions-f2eb0421.js';
4
4
  import { r as resendInvitation } from './Recipients-4ec2138c.js';
5
5
  import './Types-5f31149e.js';
6
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
6
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
7
7
  import { g as getEnvelopeStore } from './EnvelopeStore-7f484014.js';
8
8
  import { F as FORMAT_TIMESTAMP } from './Types-de18e225.js';
9
9
  import { V as VerdocsToast } from './Toast-f3b8fd46.js';
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host } from './index-1
2
2
  import { l as listEnvelopes, c as cancelEnvelope } from './Envelopes-5e32159f.js';
3
3
  import { g as getRecipientsWithActions, a as userCanAct, b as userCanCancelEnvelope } from './Permissions-f2eb0421.js';
4
4
  import './Types-5f31149e.js';
5
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
5
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
6
6
  import { i as integerSequence } from './Primitives-8fe93caf.js';
7
7
  import { s as saveEnvelopesAsZip } from './utils-c0cd0b91.js';
8
8
  import { V as VerdocsToast } from './Toast-f3b8fd46.js';
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-172625c5.js';
2
2
  import { i as interact } from './interact.min-cf83fa88.js';
3
3
  import './Types-5f31149e.js';
4
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
4
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
5
5
  import { u as updateField } from './Fields-c82e6df3.js';
6
6
  import { g as getRGBA } from './Colors-1b298092.js';
7
7
  import { g as getFieldSettings } from './utils-c0cd0b91.js';
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-172625c5.js';
2
2
  import { i as interact } from './interact.min-cf83fa88.js';
3
3
  import './Types-5f31149e.js';
4
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
4
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
5
5
  import { u as updateField } from './Fields-c82e6df3.js';
6
6
  import { g as getRGBA } from './Colors-1b298092.js';
7
7
  import { g as getFieldSettings } from './utils-c0cd0b91.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
4
  import { u as unicodeNBSP } from './Icons-c29eb0fa.js';
5
5
 
6
6
  const verdocsFileChooserCss = "verdocs-file-chooser{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-file-chooser .upload-box{text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;padding:40px 15px;color:rgba(0, 0, 0, 0.54)}verdocs-file-chooser .upload-box svg{width:64px;height:64px;fill:#5c6575}verdocs-file-chooser .selected-filename{font-size:20px;font-weight:bold;overflow-wrap:anywhere}verdocs-file-chooser .or-prefer{height:20px;margin:20px 0;font-size:16px}";
@@ -1,8 +1,8 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
4
  import { r as renderDocumentField, b as getRoleIndex } from './utils-c0cd0b91.js';
5
- import { g as getTemplateStore, a as getRoleNames } from './TemplateStore-3c138524.js';
5
+ import { g as getTemplateStore, a as getRoleNames } from './TemplateStore-e8cf5a15.js';
6
6
  import { S as SDKError } from './errors-9b5498c8.js';
7
7
  import { a as isValidEmail, i as isValidPhone } from './Validators-16a2a43b.js';
8
8
  import { g as getRGBA } from './Colors-1b298092.js';
@@ -345,6 +345,99 @@ const VerdocsTemplateAttachments = class {
345
345
  };
346
346
  VerdocsTemplateAttachments.style = verdocsTemplateAttachmentsCss;
347
347
 
348
+ const verdocsTemplateBuildTabsCss = "verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:20px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}";
349
+
350
+ const STEPS = ['attachments', 'roles', 'settings', 'fields', 'preview'];
351
+ const VerdocsTemplateBuildTabs = class {
352
+ constructor(hostRef) {
353
+ registerInstance(this, hostRef);
354
+ this.sdkError = createEvent(this, "sdkError", 7);
355
+ this.stepChanged = createEvent(this, "stepChanged", 7);
356
+ this.endpoint = VerdocsEndpoint.getDefault();
357
+ this.templateId = null;
358
+ this.step = 'preview';
359
+ this.store = null;
360
+ }
361
+ onStepChanged() {
362
+ console.log('Step changed', this.step, this.templateId);
363
+ this.loadTemplate().catch((e) => console.log('Unknown Error', e));
364
+ }
365
+ async componentWillLoad() {
366
+ var _a, _b, _c;
367
+ try {
368
+ this.endpoint.loadSession();
369
+ if (!this.endpoint.session) {
370
+ console.log('[BUILD_TABS] Unable to start builder session, must be authenticated');
371
+ return;
372
+ }
373
+ if (!this.templateId) {
374
+ this.step = 'preview';
375
+ return;
376
+ }
377
+ this.loadTemplate().catch(e => console.log('[BUILD_TABS] Unable to load template', e));
378
+ }
379
+ catch (e) {
380
+ console.log('[BUILD_TABS] Error loading template', e);
381
+ (_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));
382
+ }
383
+ }
384
+ async loadTemplate() {
385
+ if (this.templateId) {
386
+ this.store = await getTemplateStore(this.endpoint, this.templateId, false);
387
+ }
388
+ }
389
+ setStep(e) {
390
+ var _a;
391
+ console.log('Selected step', e.detail.tab.id);
392
+ e.stopPropagation();
393
+ e.preventDefault();
394
+ this.step = e.detail.tab.id;
395
+ (_a = this.stepChanged) === null || _a === void 0 ? void 0 : _a.emit(e.detail.tab.id);
396
+ }
397
+ render() {
398
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
399
+ if (!this.endpoint.session) {
400
+ return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
401
+ }
402
+ let canPreview = false;
403
+ let canEditFields = false;
404
+ let canEditRoles = false;
405
+ if (this.templateId && this.store) {
406
+ console.log('lengths', (_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.template_documents.length, (_d = (_c = this.store) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.roles.length, (_f = (_e = this.store) === null || _e === void 0 ? void 0 : _e.state) === null || _f === void 0 ? void 0 : _f.fields.length);
407
+ canEditRoles = ((_h = (_g = this.store) === null || _g === void 0 ? void 0 : _g.state) === null || _h === void 0 ? void 0 : _h.template_documents.length) > 0;
408
+ canEditFields = canEditRoles && ((_k = (_j = this.store) === null || _j === void 0 ? void 0 : _j.state) === null || _k === void 0 ? void 0 : _k.roles.length) > 0;
409
+ canPreview = canEditFields && ((_m = (_l = this.store) === null || _l === void 0 ? void 0 : _l.state) === null || _m === void 0 ? void 0 : _m.fields.length) > 0;
410
+ // TODO
411
+ // canPreview = this.store && userCanPreviewTemplate(this.endpoint.session, this.store?.state);
412
+ // canEditFields = this.store && userCanBuildTemplate(this.endpoint.session, this.store?.state);
413
+ // canEditRoles = this.store && userCanUpdateTemplate(this.endpoint.session, this.store?.state);
414
+ }
415
+ let selectedStepIndex = Math.max(STEPS.indexOf(this.step), 0);
416
+ if (!canPreview && selectedStepIndex >= 4) {
417
+ selectedStepIndex = 3;
418
+ }
419
+ if (!canEditFields && selectedStepIndex >= 3) {
420
+ selectedStepIndex = 1;
421
+ }
422
+ if (!canEditRoles && selectedStepIndex >= 1) {
423
+ selectedStepIndex = 0;
424
+ }
425
+ console.log({ selectedStepIndex, canPreview, canEditFields, canEditRoles });
426
+ console.log('[BUILD_TABS] Rendering', this.step, selectedStepIndex);
427
+ return (h(Host, null, h("verdocs-tabs", { onSelectTab: e => this.setStep(e), selectedTab: selectedStepIndex, tabs: [
428
+ { id: 'attachments', disabled: false, label: this.templateId && this.store ? 'Attachment(s)' : 'Upload Attachment(s)' },
429
+ { id: 'roles', disabled: !canEditRoles, label: 'Roles' },
430
+ { id: 'settings', disabled: !canEditFields, label: 'Settings' },
431
+ { id: 'fields', disabled: !canEditFields, label: 'Fields' },
432
+ { id: 'preview', disabled: !canPreview, label: 'Preview/Send' },
433
+ ] })));
434
+ }
435
+ static get watchers() { return {
436
+ "step": ["onStepChanged"]
437
+ }; }
438
+ };
439
+ VerdocsTemplateBuildTabs.style = verdocsTemplateBuildTabsCss;
440
+
348
441
  const verdocsTemplateCreateCss = "verdocs-template-create{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-create form .upload-box{-webkit-box-sizing:border-box;box-sizing:border-box;width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box.drag-over{border:2px solid #4c56cb}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .progress-wrapper{padding:20px}verdocs-template-create .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}";
349
442
 
350
443
  const unicodeNBSP = ' ';
@@ -688,4 +781,4 @@ const VerdocsTemplateVisibility = class {
688
781
  };
689
782
  VerdocsTemplateVisibility.style = verdocsTemplateVisibilityCss;
690
783
 
691
- export { VerdocsPreview as verdocs_preview, VerdocsSend as verdocs_send, VerdocsTemplateAttachments as verdocs_template_attachments, VerdocsTemplateCreate as verdocs_template_create, VerdocsTemplateName as verdocs_template_name, VerdocsTemplateReminders as verdocs_template_reminders, VerdocsTemplateVisibility as verdocs_template_visibility };
784
+ export { VerdocsPreview as verdocs_preview, VerdocsSend as verdocs_send, VerdocsTemplateAttachments as verdocs_template_attachments, VerdocsTemplateBuildTabs as verdocs_template_build_tabs, VerdocsTemplateCreate as verdocs_template_create, VerdocsTemplateName as verdocs_template_name, VerdocsTemplateReminders as verdocs_template_reminders, VerdocsTemplateVisibility as verdocs_template_visibility };
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
4
  import { a as getTemplates } from './Templates-f90883f7.js';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
4
 
5
5
  const verdocsSearchCss = "verdocs-search{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:-ms-flexbox;display:flex;background-color:#1e2031}verdocs-search search-box{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:20px 10px}verdocs-search .boxes{-ms-flex-wrap:wrap;flex-wrap:wrap;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;margin:20px 0}verdocs-search search-recent,verdocs-search search-saved,verdocs-search search-quick-functions,verdocs-search search-starred{display:-ms-flexbox;display:flex;margin:0 20px 20px 0}";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
4
  import { a as formatFullName, c as capitalize, b as formatInitials } from './Primitives-8fe93caf.js';
5
5
  import { V as VerdocsToast } from './Toast-f3b8fd46.js';
6
6
  import { S as SDKError } from './errors-9b5498c8.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
4
  import { S as SDKError } from './errors-9b5498c8.js';
5
5
 
6
6
  const verdocsSettingsCss = "verdocs-settings{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-settings .tabs{gap:4px;width:100%;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;border-bottom:1px solid #654dcb}verdocs-settings .tabs .tab{cursor:pointer;padding:5px 10px;color:#ffffff;background-color:#777777}verdocs-settings .tabs .tab.active{color:#ffffff;background-color:#654dcb}";
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, F as Fragment }
2
2
  import { e as getSigningSession, t as throttledGetEnvelope, u as updateEnvelopeField, f as updateEnvelopeFieldSignature, h as updateEnvelopeFieldInitials, i as uploadEnvelopeFieldAttachment } from './Envelopes-5e32159f.js';
3
3
  import { R as RecipientStates } from './Types-5f31149e.js';
4
4
  import { e as envelopeRecipientAgree, a as envelopeRecipientDecline, b as envelopeRecipientSubmit } from './Recipients-4ec2138c.js';
5
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
5
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
6
6
  import { i as isValidPhone, a as isValidEmail } from './Validators-16a2a43b.js';
7
7
  import { f as fullNameToInitials, i as integerSequence } from './Primitives-8fe93caf.js';
8
8
  import { a as saveAttachment, u as updateDocumentFieldValue, b as getRoleIndex, r as renderDocumentField, c as getFieldId } from './utils-c0cd0b91.js';
@@ -7,18 +7,10 @@ const VerdocsTabs = class {
7
7
  registerInstance(this, hostRef);
8
8
  this.selectTab = createEvent(this, "selectTab", 7);
9
9
  this.tabs = [];
10
- this.defaultTab = 0;
11
10
  this.selectedTab = 0;
12
11
  }
13
- componentDidLoad() {
14
- this.selectedTab = this.defaultTab || 0;
15
- }
16
- componentDidUpdate() {
17
- this.selectedTab = this.defaultTab || 0;
18
- }
19
12
  handleSelectTab(index) {
20
13
  var _a;
21
- this.selectedTab = index;
22
14
  (_a = this.selectTab) === null || _a === void 0 ? void 0 : _a.emit({ tab: this.tabs[index], index });
23
15
  }
24
16
  render() {
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
4
4
  import { g as getTemplateDocumentPageDisplayUri } from './TemplateDocuments-6fd2f4e2.js';
5
5
  import { t as throttle } from './utils-c0cd0b91.js';
6
6
  import { c as createPopper } from './popper-15e448b4.js';
@@ -1,11 +1,11 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, F as Fragment, a as getElement } from './index-172625c5.js';
2
2
  import { i as interact } from './interact.min-cf83fa88.js';
3
3
  import './Types-5f31149e.js';
4
- import { V as VerdocsEndpoint, T as TemplateSenderTypes } from './VerdocsEndpoint-6fe4258b.js';
4
+ import { V as VerdocsEndpoint, T as TemplateSenderTypes } from './VerdocsEndpoint-d58d5544.js';
5
5
  import { u as updateField, c as createField } from './Fields-c82e6df3.js';
6
6
  import { i as integerSequence } from './Primitives-8fe93caf.js';
7
7
  import { b as getRoleIndex, r as renderDocumentField, h as updateCssTransform, i as defaultWidth, j as defaultHeight } from './utils-c0cd0b91.js';
8
- import { g as getTemplateStore, a as getRoleNames } from './TemplateStore-3c138524.js';
8
+ import { g as getTemplateStore, a as getRoleNames } from './TemplateStore-e8cf5a15.js';
9
9
  import { S as SDKError } from './errors-9b5498c8.js';
10
10
  import { g as getRGBA } from './Colors-1b298092.js';
11
11
  import { u as updateTemplate } from './Templates-f90883f7.js';
@@ -604,15 +604,18 @@ const VerdocsTemplateRoles = class {
604
604
  console.log('[ROLES] Unable to start builder session, must be authenticated');
605
605
  return;
606
606
  }
607
- this.store = await getTemplateStore(this.endpoint, this.templateId, true);
608
- this.sortTemplateRoles();
609
- this.renumberTemplateRoles();
607
+ await this.reloadStore();
610
608
  }
611
609
  catch (e) {
612
610
  console.log('[FIELDS] Error with preview session', e);
613
611
  (_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));
614
612
  }
615
613
  }
614
+ async reloadStore() {
615
+ this.store = await getTemplateStore(this.endpoint, this.templateId, true);
616
+ this.sortTemplateRoles();
617
+ this.renumberTemplateRoles();
618
+ }
616
619
  componentDidRender() {
617
620
  interact.dynamicDrop(true);
618
621
  interact('.recipient').draggable({
@@ -677,6 +680,7 @@ const VerdocsTemplateRoles = class {
677
680
  var _a, _b;
678
681
  console.log('[ROLES] Updated roles');
679
682
  (_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated-role', endpoint: this.endpoint, template: (_b = this.store) === null || _b === void 0 ? void 0 : _b.state });
683
+ this.reloadStore().catch(e => console.log('Unknown error', e));
680
684
  })
681
685
  .catch(e => console.log('[ROLES] Role updates failed', e));
682
686
  }
@@ -771,6 +775,7 @@ const VerdocsTemplateRoles = class {
771
775
  // this.store.state.roles = [...this.store?.state.roles, r];
772
776
  // this.renumberTemplateRoles();
773
777
  (_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'created-role', endpoint: this.endpoint, template: (_b = this.store) === null || _b === void 0 ? void 0 : _b.state });
778
+ this.reloadStore().catch(e => console.log('Unknown error', e));
774
779
  })
775
780
  .catch(e => {
776
781
  console.log('[ROLES] Error creating role', e);
@@ -817,6 +822,7 @@ const VerdocsTemplateRoles = class {
817
822
  this.showingRoleDialog = null;
818
823
  // this.forceRerender++;
819
824
  (_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'deleted-role', endpoint: this.endpoint, template: (_b = this.store) === null || _b === void 0 ? void 0 : _b.state });
825
+ this.reloadStore().catch(e => console.log('Unknown error', e));
820
826
  } })), this.showingSenderDialog && h("verdocs-template-sender", { endpoint: this.endpoint, templateId: this.templateId, onClose: () => (this.showingSenderDialog = false) })));
821
827
  }
822
828
  get el() { return getElement(this); }
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
2
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
2
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
3
3
  import './Types-5f31149e.js';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host } from './index-172625c5.js';
2
2
  import './Types-5f31149e.js';
3
- import { V as VerdocsEndpoint, a as TemplateActions } from './VerdocsEndpoint-6fe4258b.js';
3
+ import { V as VerdocsEndpoint, a as TemplateActions } from './VerdocsEndpoint-d58d5544.js';
4
4
  import { l as listTemplates, d as deleteTemplate } from './Templates-f90883f7.js';
5
5
  import { i as integerSequence } from './Primitives-8fe93caf.js';
6
6
  import { S as SDKError } from './errors-9b5498c8.js';
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, F as Fragment, a
2
2
  import { t as throttledGetEnvelope, c as cancelEnvelope } from './Envelopes-5e32159f.js';
3
3
  import { b as userCanCancelEnvelope } from './Permissions-f2eb0421.js';
4
4
  import './Types-5f31149e.js';
5
- import { V as VerdocsEndpoint } from './VerdocsEndpoint-6fe4258b.js';
5
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint-d58d5544.js';
6
6
  import { i as integerSequence } from './Primitives-8fe93caf.js';
7
7
  import { s as saveEnvelopesAsZip, e as saveCertificate, a as saveAttachment } from './utils-c0cd0b91.js';
8
8
  import { S as SDKError } from './errors-9b5498c8.js';