@verdocs/web-sdk 2.2.5 → 2.2.7

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 (152) hide show
  1. package/dist/cjs/{Primitives-be5088cb.js → Primitives-a59870a2.js} +20 -0
  2. package/dist/cjs/{Profiles-244e8254.js → Profiles-54271244.js} +15 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/verdocs-activity-box.cjs.entry.js +1 -1
  5. package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
  6. package/dist/cjs/verdocs-button_3.cjs.entry.js +113 -0
  7. package/dist/cjs/{verdocs-checkbox_4.cjs.entry.js → verdocs-checkbox_3.cjs.entry.js} +0 -38
  8. package/dist/cjs/verdocs-dialog_3.cjs.entry.js +74 -0
  9. package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +1 -1
  10. package/dist/cjs/verdocs-pagination_3.cjs.entry.js +1 -1
  11. package/dist/cjs/verdocs-settings-api-keys_4.cjs.entry.js +304 -28
  12. package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
  13. package/dist/cjs/verdocs-template-fields_4.cjs.entry.js +1 -1
  14. package/dist/cjs/verdocs-templates-list.cjs.entry.js +1 -1
  15. package/dist/cjs/verdocs-view.cjs.entry.js +10 -3
  16. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  17. package/dist/collection/collection-manifest.json +1 -0
  18. package/dist/collection/components/controls/verdocs-table/verdocs-table.css +13 -8
  19. package/dist/collection/components/controls/verdocs-tabs/verdocs-tabs.css +33 -0
  20. package/dist/collection/components/controls/verdocs-tabs/verdocs-tabs.js +102 -0
  21. package/dist/collection/components/controls/verdocs-tabs/verdocs-tabs.stories.js +25 -0
  22. package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.css +15 -0
  23. package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.js +30 -2
  24. package/dist/collection/components/dialogs/verdocs-dialog/verdocs-dialog.css +21 -5
  25. package/dist/collection/components/dialogs/verdocs-dialog/verdocs-dialog.js +3 -2
  26. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +9 -2
  27. package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.css +27 -18
  28. package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.js +120 -15
  29. package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.css +31 -7
  30. package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.js +137 -10
  31. package/dist/components/Members.js +17 -0
  32. package/dist/components/Primitives.js +18 -1
  33. package/dist/components/Profiles.js +15 -1
  34. package/dist/components/index.d.ts +1 -0
  35. package/dist/components/index.js +1 -0
  36. package/dist/components/verdocs-dialog.js +1 -36
  37. package/dist/components/verdocs-dialog2.js +39 -0
  38. package/dist/components/verdocs-settings-api-keys2.js +191 -19
  39. package/dist/components/verdocs-settings-members2.js +189 -22
  40. package/dist/components/verdocs-settings-profile2.js +1 -1
  41. package/dist/components/verdocs-settings.js +30 -18
  42. package/dist/components/verdocs-table2.js +1 -1
  43. package/dist/components/verdocs-tabs.d.ts +11 -0
  44. package/dist/components/verdocs-tabs.js +6 -0
  45. package/dist/components/verdocs-tabs2.js +46 -0
  46. package/dist/components/verdocs-text-input2.js +14 -3
  47. package/dist/components/verdocs-view2.js +9 -2
  48. package/dist/docs.json +147 -9
  49. package/dist/esm/Primitives-8fe93caf.js +37 -0
  50. package/dist/esm/{Profiles-7645e6f1.js → Profiles-4cc942ef.js} +15 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/verdocs-activity-box.entry.js +1 -1
  53. package/dist/esm/verdocs-auth.entry.js +1 -1
  54. package/dist/esm/verdocs-button_3.entry.js +107 -0
  55. package/dist/esm/verdocs-checkbox_3.entry.js +50 -0
  56. package/dist/esm/verdocs-dialog_3.entry.js +68 -0
  57. package/dist/esm/verdocs-envelopes-list.entry.js +1 -1
  58. package/dist/esm/verdocs-pagination_3.entry.js +1 -1
  59. package/dist/esm/verdocs-settings-api-keys_4.entry.js +304 -28
  60. package/dist/esm/verdocs-sign.entry.js +1 -1
  61. package/dist/esm/verdocs-template-fields_4.entry.js +1 -1
  62. package/dist/esm/verdocs-templates-list.entry.js +1 -1
  63. package/dist/esm/verdocs-view.entry.js +10 -3
  64. package/dist/esm/verdocs-web-sdk.js +1 -1
  65. package/dist/esm-es5/Primitives-8fe93caf.js +1 -0
  66. package/dist/esm-es5/Profiles-4cc942ef.js +1 -0
  67. package/dist/esm-es5/loader.js +1 -1
  68. package/dist/esm-es5/verdocs-activity-box.entry.js +1 -1
  69. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  70. package/dist/esm-es5/verdocs-button_3.entry.js +1 -0
  71. package/dist/esm-es5/verdocs-checkbox_3.entry.js +1 -0
  72. package/dist/esm-es5/verdocs-dialog_3.entry.js +1 -0
  73. package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
  74. package/dist/esm-es5/verdocs-pagination_3.entry.js +1 -1
  75. package/dist/esm-es5/verdocs-settings-api-keys_4.entry.js +1 -1
  76. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  77. package/dist/esm-es5/verdocs-template-fields_4.entry.js +1 -1
  78. package/dist/esm-es5/verdocs-templates-list.entry.js +1 -1
  79. package/dist/esm-es5/verdocs-view.entry.js +1 -1
  80. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  81. package/dist/types/components/controls/verdocs-tabs/verdocs-tabs.d.ts +31 -0
  82. package/dist/types/components/controls/verdocs-tabs/verdocs-tabs.stories.d.ts +7 -0
  83. package/dist/types/components/controls/verdocs-text-input/verdocs-text-input.d.ts +7 -0
  84. package/dist/types/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.d.ts +12 -1
  85. package/dist/types/components/settings/verdocs-settings-members/verdocs-settings-members.d.ts +17 -1
  86. package/dist/types/components.d.ts +46 -0
  87. package/dist/verdocs-web-sdk/{p-68487ce7.system.entry.js → p-02bbfba3.system.entry.js} +1 -1
  88. package/dist/verdocs-web-sdk/p-0578c85b.system.entry.js +1 -0
  89. package/dist/verdocs-web-sdk/{p-4c9d9cd6.entry.js → p-0899dd63.entry.js} +1 -1
  90. package/dist/verdocs-web-sdk/p-19a0fdf2.entry.js +1 -0
  91. package/dist/verdocs-web-sdk/{p-690a485e.system.entry.js → p-1b10240a.system.entry.js} +1 -1
  92. package/dist/verdocs-web-sdk/p-3a0c5966.system.entry.js +1 -0
  93. package/dist/verdocs-web-sdk/p-3bcd86ea.system.js +1 -0
  94. package/dist/verdocs-web-sdk/{p-4f0c253e.system.entry.js → p-3cf4bd84.system.entry.js} +1 -1
  95. package/dist/verdocs-web-sdk/p-4f8dbb97.entry.js +1 -0
  96. package/dist/verdocs-web-sdk/p-5e808a0b.js +1 -0
  97. package/dist/verdocs-web-sdk/p-647cdb84.system.js +1 -1
  98. package/dist/verdocs-web-sdk/p-6572cc71.system.entry.js +1 -0
  99. package/dist/verdocs-web-sdk/{p-0d590026.entry.js → p-7967b361.entry.js} +1 -1
  100. package/dist/verdocs-web-sdk/p-803924f3.entry.js +1 -0
  101. package/dist/verdocs-web-sdk/p-937cd171.system.entry.js +1 -0
  102. package/dist/verdocs-web-sdk/p-96ca789b.system.entry.js +1 -0
  103. package/dist/verdocs-web-sdk/{p-075dc36d.js → p-983da2f6.js} +1 -1
  104. package/dist/verdocs-web-sdk/{p-e9d2b68a.entry.js → p-a2b83969.entry.js} +1 -1
  105. package/dist/verdocs-web-sdk/{p-043eab3f.system.entry.js → p-c556a377.system.entry.js} +1 -1
  106. package/dist/verdocs-web-sdk/p-cb9985fe.entry.js +1 -0
  107. package/dist/verdocs-web-sdk/p-cfead4df.entry.js +1 -0
  108. package/dist/verdocs-web-sdk/{p-dd5460ea.entry.js → p-d277233c.entry.js} +1 -1
  109. package/dist/verdocs-web-sdk/{p-b3e0db4b.system.entry.js → p-e0a212a1.system.entry.js} +1 -1
  110. package/dist/verdocs-web-sdk/{p-b4ac7a21.entry.js → p-ed38d3d2.entry.js} +1 -1
  111. package/dist/verdocs-web-sdk/p-f65a1b9e.system.js +1 -0
  112. package/dist/verdocs-web-sdk/{p-986f78e3.entry.js → p-f7fecffd.entry.js} +1 -1
  113. package/dist/verdocs-web-sdk/{p-1d7846c9.entry.js → p-fb609f37.entry.js} +1 -1
  114. package/dist/verdocs-web-sdk/{p-bf8bded0.system.entry.js → p-fb71f28a.system.entry.js} +1 -1
  115. package/dist/verdocs-web-sdk/{p-febebe69.system.entry.js → p-ff850808.system.entry.js} +1 -1
  116. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  117. package/package.json +2 -2
  118. package/dist/cjs/verdocs-button.cjs.entry.js +0 -26
  119. package/dist/cjs/verdocs-dialog.cjs.entry.js +0 -27
  120. package/dist/cjs/verdocs-help-icon.cjs.entry.js +0 -45
  121. package/dist/cjs/verdocs-table.cjs.entry.js +0 -27
  122. package/dist/components/Strings.js +0 -6
  123. package/dist/esm/Primitives-054bc6e5.js +0 -20
  124. package/dist/esm/verdocs-button.entry.js +0 -22
  125. package/dist/esm/verdocs-checkbox_4.entry.js +0 -87
  126. package/dist/esm/verdocs-dialog.entry.js +0 -23
  127. package/dist/esm/verdocs-help-icon.entry.js +0 -41
  128. package/dist/esm/verdocs-table.entry.js +0 -23
  129. package/dist/esm-es5/Primitives-054bc6e5.js +0 -1
  130. package/dist/esm-es5/Profiles-7645e6f1.js +0 -1
  131. package/dist/esm-es5/verdocs-button.entry.js +0 -1
  132. package/dist/esm-es5/verdocs-checkbox_4.entry.js +0 -1
  133. package/dist/esm-es5/verdocs-dialog.entry.js +0 -1
  134. package/dist/esm-es5/verdocs-help-icon.entry.js +0 -1
  135. package/dist/esm-es5/verdocs-table.entry.js +0 -1
  136. package/dist/verdocs-web-sdk/p-144d4ed1.system.entry.js +0 -1
  137. package/dist/verdocs-web-sdk/p-268a29a9.system.entry.js +0 -1
  138. package/dist/verdocs-web-sdk/p-40361f22.entry.js +0 -1
  139. package/dist/verdocs-web-sdk/p-606e0405.entry.js +0 -1
  140. package/dist/verdocs-web-sdk/p-7213a107.system.entry.js +0 -1
  141. package/dist/verdocs-web-sdk/p-7291906c.js +0 -1
  142. package/dist/verdocs-web-sdk/p-84f9fe5d.entry.js +0 -1
  143. package/dist/verdocs-web-sdk/p-a69359d3.entry.js +0 -1
  144. package/dist/verdocs-web-sdk/p-ab26744f.system.entry.js +0 -1
  145. package/dist/verdocs-web-sdk/p-c69b5a99.system.entry.js +0 -1
  146. package/dist/verdocs-web-sdk/p-cbebc039.system.js +0 -1
  147. package/dist/verdocs-web-sdk/p-d309ef6f.entry.js +0 -1
  148. package/dist/verdocs-web-sdk/p-d50523fd.system.js +0 -1
  149. package/dist/verdocs-web-sdk/p-d734ced3.system.entry.js +0 -1
  150. package/dist/verdocs-web-sdk/p-db4cfbfe.entry.js +0 -1
  151. package/dist/verdocs-web-sdk/p-f8a2988e.entry.js +0 -1
  152. package/dist/verdocs-web-sdk/p-fbabbcea.system.entry.js +0 -1
@@ -1,11 +1,16 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import './Types.js';
3
+ import { g as getMembers } from './Members.js';
3
4
  import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
4
- import { c as capitalize } from './Strings.js';
5
+ import { a as formatFullName } from './Primitives.js';
5
6
  import { V as VerdocsToast } from './Toast.js';
6
7
  import { S as SDKError } from './errors.js';
7
- import { d as defineCustomElement$2 } from './verdocs-button2.js';
8
- import { d as defineCustomElement$1 } from './verdocs-table2.js';
8
+ import { d as defineCustomElement$6 } from './verdocs-button2.js';
9
+ import { d as defineCustomElement$5 } from './verdocs-dialog2.js';
10
+ import { d as defineCustomElement$4 } from './verdocs-help-icon2.js';
11
+ import { d as defineCustomElement$3 } from './verdocs-select-input2.js';
12
+ import { d as defineCustomElement$2 } from './verdocs-table2.js';
13
+ import { d as defineCustomElement$1 } from './verdocs-text-input2.js';
9
14
 
10
15
  /**
11
16
  * API keys are used to authenticate server-to-server calls. (API keys should **never** be used for client-to-server operations!)
@@ -33,9 +38,56 @@ var getKeys = function (endpoint, organizationId) {
33
38
  .get("/organizations/".concat(organizationId, "/api_key"))
34
39
  .then(function (r) { return r.data; });
35
40
  };
41
+ /**
42
+ * Create an API key.
43
+ *
44
+ * ```typescript
45
+ * import {ApiKeys} from '@verdocs/js-sdk/Organizations';
46
+ *
47
+ * await ApiKeys.createKey(ORGID, {name: NEWNAME});
48
+ * ```
49
+ */
50
+ var createKey = function (endpoint, organizationId, params) {
51
+ return endpoint.api //
52
+ .post("/organizations/".concat(organizationId, "/api_key"), params)
53
+ .then(function (r) { return r.data; });
54
+ };
55
+ /**
56
+ * Rotate the secret for an API key. The caller must have admin access to the organization.
57
+ *
58
+ * ```typescript
59
+ * import {ApiKeys} from '@verdocs/js-sdk/Organizations';
60
+ *
61
+ * const {client_secret: newSecret} = await ApiKeys.rotateKey(ORGID, CLIENTID);
62
+ * ```
63
+ */
64
+ var rotateKey = function (endpoint, organizationId, clientId) {
65
+ return endpoint.api //
66
+ .put("/organizations/".concat(organizationId, "/api_key/").concat(clientId, "/rotate"))
67
+ .then(function (r) { return r.data; });
68
+ };
69
+ /**
70
+ * Delete an API key.
71
+ *
72
+ * ```typescript
73
+ * import {ApiKeys} from '@verdocs/js-sdk/Organizations';
74
+ *
75
+ * await ApiKeys.deleteKey(ORGID, CLIENTID);
76
+ * ```
77
+ */
78
+ var deleteKey = function (endpoint, organizationId, clientId) {
79
+ return endpoint.api //
80
+ .delete("/organizations/".concat(organizationId, "/api_key/").concat(clientId))
81
+ .then(function (r) { return r.data; });
82
+ };
36
83
 
37
- const verdocsSettingsApiKeysCss = "verdocs-settings-api-keys{display:-ms-flexbox;display:flex;padding:10px;font-size:18px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:6px;color:#33364b;-ms-flex-direction:column;flex-direction:column;font-family:\"Inter\", \"Barlow\", sans-serif}verdocs-settings-api-keys .table{margin:12px 0}verdocs-settings-api-keys .role{font-size:12px;width:32px;height:32px;border-radius:32px;background:#777777;color:#ffffff;font-weight:700;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-settings-api-keys .col.col-actions{-ms-flex-align:center;align-items:center;text-align:center}verdocs-settings-api-keys .col.col-actions svg{cursor:pointer;width:24px;height:24px;fill:#777777}verdocs-settings-api-keys .col.col-actions svg:hover{fill:red}";
84
+ const verdocsSettingsApiKeysCss = "verdocs-settings-api-keys{display:-ms-flexbox;display:flex;padding:10px;font-size:18px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:6px;color:#33364b;-ms-flex-direction:column;flex-direction:column;font-family:\"Inter\", \"Barlow\", sans-serif}verdocs-settings-api-keys .table{margin:12px 0}verdocs-settings-api-keys .data-col div{gap:12px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-settings-api-keys .data-col svg{width:24px;height:24px}verdocs-settings-api-keys .col-name svg,verdocs-settings-api-keys .col-client_id svg,verdocs-settings-api-keys .col-profile_id svg{fill:#a1a1aa}verdocs-settings-api-keys .col-actions svg{fill:#ffffff;stroke:#a1a1aa}verdocs-settings-api-keys .col-actions svg:hover{cursor:pointer;stroke:red}verdocs-settings-api-keys .col-actions>div{-ms-flex-pack:center;justify-content:center}verdocs-settings-api-keys .header-col.col-actions{text-align:center}verdocs-settings-api-keys verdocs-dialog p{font-size:16px;line-height:18px;margin:0 0 1em 0}";
38
85
 
86
+ // const ClockIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zM12.75 6a.75.75 0 00-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 000-1.5h-3.75V6z" clip-rule="evenodd" /></svg>`;
87
+ const TagIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M5.5 3A2.5 2.5 0 003 5.5v2.879a2.5 2.5 0 00.732 1.767l6.5 6.5a2.5 2.5 0 003.536 0l2.878-2.878a2.5 2.5 0 000-3.536l-6.5-6.5A2.5 2.5 0 008.38 3H5.5zM6 7a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" /></svg>`;
88
+ const UserIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-5.5-2.5a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zM10 12a5.99 5.99 0 00-4.793 2.39A6.483 6.483 0 0010 16.5a6.483 6.483 0 004.793-2.11A5.99 5.99 0 0010 12z" clip-rule="evenodd" /></svg>`;
89
+ const TrashIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>`;
90
+ const ArrowPathIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99" /></svg>`;
39
91
  const VerdocsSettingsApiKeys = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
40
92
  constructor() {
41
93
  super();
@@ -46,6 +98,13 @@ const VerdocsSettingsApiKeys = /*@__PURE__*/ proxyCustomElement(class extends HT
46
98
  this.memberRemoved = createEvent(this, "memberRemoved", 7);
47
99
  this.endpoint = VerdocsEndpoint.getDefault();
48
100
  this.keys = [];
101
+ this.creatingKey = false;
102
+ this.createdKey = null;
103
+ this.deletingKey = null;
104
+ this.rotatingKey = null;
105
+ this.newApiKeyName = '';
106
+ this.newApiKeyProfileId = '';
107
+ this.members = [];
49
108
  }
50
109
  componentWillLoad() {
51
110
  this.endpoint.loadSession();
@@ -55,36 +114,129 @@ const VerdocsSettingsApiKeys = /*@__PURE__*/ proxyCustomElement(class extends HT
55
114
  }
56
115
  }
57
116
  async componentDidLoad() {
58
- var _a, _b, _c;
59
- try {
60
- this.keys = await getKeys(this.endpoint, this.endpoint.session.organization_id);
61
- }
62
- catch (e) {
117
+ this.newApiKeyProfileId = this.endpoint.session.profile_id;
118
+ getMembers(this.endpoint, this.endpoint.session.organization_id)
119
+ .then(mem => {
120
+ this.members = mem;
121
+ })
122
+ .catch((e) => {
123
+ var _a, _b, _c;
124
+ console.log('[SETTINGS] Error loading organization members', e);
63
125
  (_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));
64
- VerdocsToast('Unable to load members. Please try again later');
65
- }
126
+ VerdocsToast('Unable to load API keys. Please try again later', { style: 'error' });
127
+ });
128
+ this.loadKeys();
129
+ }
130
+ loadKeys() {
131
+ getKeys(this.endpoint, this.endpoint.session.organization_id)
132
+ .then(r => {
133
+ this.keys = r;
134
+ })
135
+ .catch(e => {
136
+ var _a, _b, _c;
137
+ console.log('[SETTINGS] Unable to load API keys', e);
138
+ (_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));
139
+ VerdocsToast('Unable to load API keys. Please try again later', { style: 'error' });
140
+ });
141
+ }
142
+ async handleDeleteKey() {
143
+ deleteKey(this.endpoint, this.deletingKey.organization_id, this.deletingKey.client_id)
144
+ .then(() => {
145
+ this.deletingKey = null;
146
+ VerdocsToast('API key deleted', { style: 'success' });
147
+ this.loadKeys();
148
+ })
149
+ .catch(e => {
150
+ var _a, _b, _c;
151
+ this.deletingKey = null;
152
+ console.log('[SETTINGS] Unable to delete API key', e);
153
+ (_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));
154
+ VerdocsToast('Unable to delete API key. Please try again later', { style: 'error' });
155
+ });
156
+ }
157
+ async handleRotateKey() {
158
+ rotateKey(this.endpoint, this.rotatingKey.organization_id, this.rotatingKey.client_id)
159
+ .then(r => {
160
+ this.rotatingKey = null;
161
+ VerdocsToast('API key rotated', { style: 'success' });
162
+ this.loadKeys();
163
+ this.createdKey = r;
164
+ })
165
+ .catch(e => {
166
+ var _a, _b, _c;
167
+ this.rotatingKey = null;
168
+ console.log('[SETTINGS] Unable to rotate API key', e);
169
+ (_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));
170
+ VerdocsToast('Unable to rotate API key. Please try again later', { style: 'error' });
171
+ });
172
+ }
173
+ async handleCreateKey() {
174
+ createKey(this.endpoint, this.endpoint.session.organization_id, { name: this.newApiKeyName, profile_id: this.newApiKeyProfileId })
175
+ .then(r => {
176
+ this.creatingKey = false;
177
+ this.createdKey = r;
178
+ VerdocsToast('API key created', { style: 'success' });
179
+ this.loadKeys();
180
+ })
181
+ .catch(e => {
182
+ var _a, _b, _c;
183
+ this.creatingKey = false;
184
+ console.log('[SETTINGS] Unable to create API key', e);
185
+ (_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));
186
+ VerdocsToast('Unable to create API key. Please try again later', { style: 'error' });
187
+ });
66
188
  }
67
189
  render() {
190
+ var _a, _b, _c, _d;
191
+ const profileOptions = this.members.map(member => ({ label: formatFullName(member), value: member.id }));
68
192
  if (!this.endpoint.session) {
69
193
  console.log('[SETTINGS] Must be authenticated');
70
194
  return h(Host, { class: "authentication-required" }, "Must be authenticated");
71
195
  }
72
- return (h(Host, null, h("h1", null, "API Keys"), h("verdocs-table", { data: this.keys, columns: [
73
- { id: 'name', header: 'Name' },
74
- { id: 'client_id', header: 'Client ID' },
75
- { id: 'profile_id', header: 'Acts as', renderCell: (_, row) => { var _a, _b; return `${capitalize((_a = row.profile) === null || _a === void 0 ? void 0 : _a.first_name)} ${capitalize((_b = row.profile) === null || _b === void 0 ? void 0 : _b.last_name)}`; } },
76
- ] }), h("verdocs-button", { label: "Add API Key", size: "normal", disabled: true })));
196
+ return (h(Host, null, h("verdocs-table", { data: this.keys, columns: [
197
+ {
198
+ id: 'name',
199
+ header: 'Name',
200
+ renderCell: (_, row) => (h("div", null, h("div", null, row.name))),
201
+ },
202
+ {
203
+ id: 'client_id',
204
+ header: 'Client ID',
205
+ renderCell: (_, row) => (h("div", null, h("div", { innerHTML: TagIcon }), h("div", null, row.client_id))),
206
+ },
207
+ {
208
+ id: 'profile_id',
209
+ header: 'Acts as',
210
+ renderCell: (_, row) => (h("div", null, h("div", { innerHTML: UserIcon }), h("div", null, formatFullName(row.profile)))),
211
+ },
212
+ {
213
+ id: 'actions',
214
+ header: 'Actions',
215
+ renderCell: (_, row) => (h("div", null, h("div", { innerHTML: TrashIcon, onClick: () => (this.deletingKey = row) }), h("div", { innerHTML: ArrowPathIcon, onClick: () => (this.rotatingKey = row) }))),
216
+ },
217
+ ] }), h("verdocs-button", { label: "Add API Key", size: "normal", onClick: () => (this.creatingKey = true) }), this.deletingKey && (h("verdocs-dialog", { onExit: () => (this.deletingKey = null) }, h("div", { slot: "title", class: "heading" }, "Delete API key \"", this.deletingKey.name, "\"?"), h("div", { class: "content" }, h("p", null, "Are you sure you want to delete this key? This action cannot be undone."), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", size: "small", label: "Cancel", onClick: () => (this.deletingKey = null) }), h("verdocs-button", { size: "small", label: "OK", onClick: () => this.handleDeleteKey() }))))), this.rotatingKey && (h("verdocs-dialog", { onExit: () => (this.rotatingKey = null) }, h("div", { slot: "title", class: "heading" }, "Rotate API key \"", this.rotatingKey.name, "\"?"), h("div", { class: "content" }, h("p", null, "Are you sure you want to rotate this key? A new client secret will be generated, and the old value will become unusable. This action cannot be undone."), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", size: "small", label: "Cancel", onClick: () => (this.rotatingKey = null) }), h("verdocs-button", { size: "small", label: "OK", onClick: () => this.handleRotateKey() }))))), this.creatingKey && (h("verdocs-dialog", { onExit: () => (this.creatingKey = false) }, h("div", { slot: "title", class: "heading" }, "Create API Key"), h("div", { class: "content" }, h("verdocs-text-input", { label: "Name", placeholder: "API key name...", id: "verdocs-api-key-name", value: this.newApiKeyName, autocomplete: "off", required: true, onInput: (e) => (this.newApiKeyName = e.target.value), onFocusout: (e) => {
218
+ this.newApiKeyName = e.target.value.trim();
219
+ } }), h("p", null, "API keys must be associated with a profile. Actions performed via API calls using this key will \"act as\" this profile."), h("verdocs-select-input", { options: profileOptions, label: "Act as Profile", onInput: (e) => {
220
+ this.newApiKeyProfileId = e.target.value;
221
+ } }), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", size: "small", label: "Cancel", onClick: () => (this.creatingKey = false) }), h("verdocs-button", { size: "small", label: "OK", onClick: () => this.handleCreateKey() }))))), this.createdKey && (h("verdocs-dialog", { onExit: () => (this.createdKey = null) }, h("div", { slot: "title", class: "heading" }, "API Key Details"), h("div", { class: "content" }, h("verdocs-text-input", { label: "Name", disabled: true, value: (_a = this.createdKey) === null || _a === void 0 ? void 0 : _a.name }), h("verdocs-text-input", { label: "Profile", disabled: true, value: formatFullName((_b = this.createdKey) === null || _b === void 0 ? void 0 : _b.profile) }), h("p", null, "Please save the Client ID and Secret below. Be sure to never expose your secret key in insecure (Web or mobile environments)!"), h("verdocs-text-input", { label: "Client ID", disabled: true, value: (_c = this.createdKey) === null || _c === void 0 ? void 0 : _c.client_id, copyable: true }), h("verdocs-text-input", { label: "Secret Key", disabled: true, value: (_d = this.createdKey) === null || _d === void 0 ? void 0 : _d.client_secret, copyable: true }), h("div", { class: "buttons" }, h("verdocs-button", { size: "small", label: "Done", onClick: () => (this.createdKey = null) })))))));
77
222
  }
78
223
  static get style() { return verdocsSettingsApiKeysCss; }
79
224
  }, [0, "verdocs-settings-api-keys", {
80
225
  "endpoint": [16],
81
- "keys": [32]
226
+ "keys": [32],
227
+ "creatingKey": [32],
228
+ "createdKey": [32],
229
+ "deletingKey": [32],
230
+ "rotatingKey": [32],
231
+ "newApiKeyName": [32],
232
+ "newApiKeyProfileId": [32],
233
+ "members": [32]
82
234
  }]);
83
235
  function defineCustomElement() {
84
236
  if (typeof customElements === "undefined") {
85
237
  return;
86
238
  }
87
- const components = ["verdocs-settings-api-keys", "verdocs-button", "verdocs-table"];
239
+ const components = ["verdocs-settings-api-keys", "verdocs-button", "verdocs-dialog", "verdocs-help-icon", "verdocs-select-input", "verdocs-table", "verdocs-text-input"];
88
240
  components.forEach(tagName => { switch (tagName) {
89
241
  case "verdocs-settings-api-keys":
90
242
  if (!customElements.get(tagName)) {
@@ -93,10 +245,30 @@ function defineCustomElement() {
93
245
  break;
94
246
  case "verdocs-button":
95
247
  if (!customElements.get(tagName)) {
96
- defineCustomElement$2();
248
+ defineCustomElement$6();
249
+ }
250
+ break;
251
+ case "verdocs-dialog":
252
+ if (!customElements.get(tagName)) {
253
+ defineCustomElement$5();
254
+ }
255
+ break;
256
+ case "verdocs-help-icon":
257
+ if (!customElements.get(tagName)) {
258
+ defineCustomElement$4();
259
+ }
260
+ break;
261
+ case "verdocs-select-input":
262
+ if (!customElements.get(tagName)) {
263
+ defineCustomElement$3();
97
264
  }
98
265
  break;
99
266
  case "verdocs-table":
267
+ if (!customElements.get(tagName)) {
268
+ defineCustomElement$2();
269
+ }
270
+ break;
271
+ case "verdocs-text-input":
100
272
  if (!customElements.get(tagName)) {
101
273
  defineCustomElement$1();
102
274
  }
@@ -1,26 +1,45 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import './Types.js';
2
+ import { g as getRoles } from './Profiles.js';
3
3
  import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
4
- import { c as capitalize } from './Strings.js';
4
+ import './Types.js';
5
+ import { g as getMembers, d as deleteMember } from './Members.js';
6
+ import { b as formatInitials, a as formatFullName, c as capitalize } from './Primitives.js';
5
7
  import { V as VerdocsToast } from './Toast.js';
6
8
  import { S as SDKError } from './errors.js';
7
- import { d as defineCustomElement$2 } from './verdocs-button2.js';
8
- import { d as defineCustomElement$1 } from './verdocs-table2.js';
9
+ import { d as defineCustomElement$7 } from './verdocs-button2.js';
10
+ import { d as defineCustomElement$6 } from './verdocs-dialog2.js';
11
+ import { d as defineCustomElement$5 } from './verdocs-help-icon2.js';
12
+ import { d as defineCustomElement$4 } from './verdocs-select-input2.js';
13
+ import { d as defineCustomElement$3 } from './verdocs-table2.js';
14
+ import { d as defineCustomElement$2 } from './verdocs-tabs2.js';
15
+ import { d as defineCustomElement$1 } from './verdocs-text-input2.js';
16
+ import { f as format } from './index2.js';
9
17
 
10
- /**
11
- * An Organization Member (aka Profile) is an individual user with access to an organization.
12
- *
13
- * @module
14
- */
15
- var getMembers = function (endpoint, organizationId) {
18
+ var getInvitations = function (endpoint, organizationId) {
19
+ return endpoint.api //
20
+ .get("/organizations/".concat(organizationId, "/invitation"))
21
+ .then(function (r) { return r.data; });
22
+ };
23
+ var createInvitation = function (endpoint, organizationId, params) {
16
24
  return endpoint.api //
17
- .get("/organizations/".concat(organizationId, "/profiles"))
25
+ .post("/organizations/".concat(organizationId, "/invitation"), params)
26
+ .then(function (r) { return r.data; });
27
+ };
28
+ var deleteInvitation = function (endpoint, organizationId, email) {
29
+ return endpoint.api //
30
+ .delete("/organizations/".concat(organizationId, "/invitation/").concat(email))
31
+ .then(function (r) { return r.data; });
32
+ };
33
+ var resendInvitation = function (endpoint, organizationId, email) {
34
+ return endpoint.api //
35
+ .post("/organizations/".concat(organizationId, "/invitation/").concat(email, "/resend"))
18
36
  .then(function (r) { return r.data; });
19
37
  };
20
38
 
21
- const verdocsSettingsMembersCss = "verdocs-settings-members{display:-ms-flexbox;display:flex;padding:10px;font-size:18px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:6px;color:#33364b;-ms-flex-direction:column;flex-direction:column;font-family:\"Inter\", \"Barlow\", sans-serif}verdocs-settings-members .table{margin:12px 0}verdocs-settings-members .role{font-size:12px;width:32px;height:32px;border-radius:32px;background:#777777;color:#ffffff;font-weight:700;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-settings-members .col.col-actions{-ms-flex-align:center;align-items:center;text-align:center}verdocs-settings-members .col.col-actions svg{cursor:pointer;width:24px;height:24px;fill:#777777}verdocs-settings-members .col.col-actions svg:hover{fill:red}";
39
+ const verdocsSettingsMembersCss = "verdocs-settings-members{display:-ms-flexbox;display:flex;padding:10px;font-size:18px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:6px;color:#33364b;-ms-flex-direction:column;flex-direction:column;font-family:\"Inter\", \"Barlow\", sans-serif}verdocs-settings-members .table{margin:12px 0}verdocs-settings-members .role{font-size:12px;width:32px;height:32px;border-radius:32px;background:#777777;color:#ffffff;font-weight:700;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-settings-members .table{margin:12px 0}verdocs-settings-members .data-col div{gap:12px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-settings-members .data-col svg{width:24px;height:24px}verdocs-settings-members .col-name svg,verdocs-settings-members .col-client_id svg,verdocs-settings-members .col-profile_id svg{fill:#a1a1aa}verdocs-settings-members .col-actions svg{fill:#ffffff;stroke:#a1a1aa}verdocs-settings-members .col-actions svg:hover{cursor:pointer;stroke:red}verdocs-settings-members .col-actions>div{-ms-flex-pack:center;justify-content:center}verdocs-settings-members .header-col.col-actions{text-align:center}verdocs-settings-members verdocs-dialog p{font-size:16px;line-height:18px;margin:0 0 1em 0}";
22
40
 
23
41
  const TrashIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>`;
42
+ const ArrowPathIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99" /></svg>`;
24
43
  const getRoleLabel = (roles) => {
25
44
  if (roles.find(role => role.name === 'owner') !== undefined)
26
45
  return 'Owner';
@@ -55,6 +74,16 @@ const VerdocsSettingsMembers = /*@__PURE__*/ proxyCustomElement(class extends HT
55
74
  this.memberRemoved = createEvent(this, "memberRemoved", 7);
56
75
  this.endpoint = VerdocsEndpoint.getDefault();
57
76
  this.members = [];
77
+ this.invited = [];
78
+ this.roles = [];
79
+ this.selectedTab = 0;
80
+ this.invitingMember = false;
81
+ this.newEmailAddress = '';
82
+ this.newRoleId = '';
83
+ this.submitting = false;
84
+ this.deletingInvitation = null;
85
+ this.resendingInvitation = null;
86
+ this.deletingMember = null;
58
87
  }
59
88
  componentWillLoad() {
60
89
  this.endpoint.loadSession();
@@ -64,42 +93,155 @@ const VerdocsSettingsMembers = /*@__PURE__*/ proxyCustomElement(class extends HT
64
93
  }
65
94
  }
66
95
  async componentDidLoad() {
67
- var _a, _b, _c;
96
+ this.loadMembers().catch((e) => console.log('Unknown Error', e));
97
+ }
98
+ async loadMembers() {
99
+ var _a, _b, _c, _d;
68
100
  try {
69
- this.members = await getMembers(this.endpoint, this.endpoint.session.organization_id);
101
+ const [roles, members, invites] = await Promise.all([
102
+ getRoles(this.endpoint),
103
+ getMembers(this.endpoint, this.endpoint.session.organization_id),
104
+ getInvitations(this.endpoint, this.endpoint.session.organization_id),
105
+ ]);
106
+ this.roles = roles;
107
+ this.members = members;
108
+ this.invited = invites;
109
+ this.newRoleId = ((_a = roles.find(role => role.name === 'member')) === null || _a === void 0 ? void 0 : _a.id) || '';
70
110
  }
71
111
  catch (e) {
72
- (_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));
112
+ (_b = this.sdkError) === null || _b === void 0 ? void 0 : _b.emit(new SDKError(e.message, (_c = e.response) === null || _c === void 0 ? void 0 : _c.status, (_d = e.response) === null || _d === void 0 ? void 0 : _d.data));
73
113
  VerdocsToast('Unable to load members. Please try again later');
74
114
  }
75
115
  }
116
+ async handleInviteMember() {
117
+ this.submitting = true;
118
+ createInvitation(VerdocsEndpoint.getDefault(), this.endpoint.session.organization_id, {
119
+ email: this.newEmailAddress,
120
+ role_id: this.newRoleId,
121
+ organization_id: this.endpoint.session.organization_id,
122
+ })
123
+ .then(r => {
124
+ console.log('[SETTINGS] Invited member', r);
125
+ this.invitingMember = false;
126
+ this.submitting = false;
127
+ this.newRoleId = '';
128
+ this.newEmailAddress = '';
129
+ VerdocsToast('Invitation sent!', { style: 'success' });
130
+ this.loadMembers();
131
+ })
132
+ .catch(e => {
133
+ console.log('[SETTINGS] Unable to invite member', e);
134
+ this.invitingMember = false;
135
+ this.submitting = false;
136
+ this.newRoleId = '';
137
+ this.newEmailAddress = '';
138
+ VerdocsToast('Unable to invite member. Please try again later', { style: 'error' });
139
+ });
140
+ }
141
+ async handleDeleteMember() {
142
+ this.submitting = true;
143
+ deleteMember(VerdocsEndpoint.getDefault(), this.deletingMember.organization_id, this.deletingMember.email)
144
+ .then(() => {
145
+ this.submitting = false;
146
+ this.deletingMember = null;
147
+ VerdocsToast('The member has been deleted.', { style: 'success' });
148
+ this.loadMembers();
149
+ })
150
+ .catch(e => {
151
+ this.submitting = false;
152
+ this.deletingMember = null;
153
+ console.log('Delete error', e);
154
+ VerdocsToast('Unable to cancel invitation. Please try again later', { style: 'error' });
155
+ });
156
+ }
157
+ async handleDeleteInvitation() {
158
+ this.submitting = true;
159
+ deleteInvitation(VerdocsEndpoint.getDefault(), this.deletingInvitation.organization_id, this.deletingInvitation.email)
160
+ .then(() => {
161
+ this.submitting = false;
162
+ this.deletingInvitation = null;
163
+ VerdocsToast('The invitation has been cancelled.', { style: 'success' });
164
+ this.loadMembers();
165
+ })
166
+ .catch(e => {
167
+ this.submitting = false;
168
+ this.deletingInvitation = null;
169
+ console.log('Delete error', e);
170
+ VerdocsToast('Unable to cancel invitation. Please try again later', { style: 'error' });
171
+ });
172
+ }
173
+ async handleResendInvitation() {
174
+ this.submitting = true;
175
+ resendInvitation(VerdocsEndpoint.getDefault(), this.resendingInvitation.organization_id, this.resendingInvitation.email)
176
+ .then(() => {
177
+ this.submitting = false;
178
+ this.resendingInvitation = null;
179
+ VerdocsToast('The invitation has been resent.', { style: 'success' });
180
+ this.loadMembers();
181
+ })
182
+ .catch(e => {
183
+ this.submitting = false;
184
+ this.resendingInvitation = null;
185
+ console.log('REsend error', e);
186
+ VerdocsToast('Unable to resend invitation. Please try again later', { style: 'error' });
187
+ });
188
+ }
76
189
  render() {
77
190
  if (!this.endpoint.session) {
78
191
  console.log('[SETTINGS] Must be authenticated');
79
192
  return h(Host, { class: "authentication-required" }, "Must be authenticated");
80
193
  }
81
- return (h(Host, null, h("h1", null, "Members"), h("verdocs-table", { data: this.members, columns: [
194
+ const roleOptions = this.roles.map(role => ({ label: getRoleLabel([{ name: role.name }]), value: role.id }));
195
+ return (h(Host, null, h("verdocs-tabs", { tabs: [{ label: `Members (${this.members.length})` }, { label: `Pending Invitations (${this.invited.length})` }], onSelectTab: e => (this.selectedTab = e.detail.index) }), this.selectedTab === 0 && (h("verdocs-table", { data: this.members, columns: [
82
196
  {
83
197
  id: 'name',
84
198
  renderHeader: () => 'Member',
85
- renderCell: (_, row) => (h("div", { style: { display: 'flex', flexDirection: 'row', gap: '10px', alignItems: 'center' } }, h("div", { class: "role", style: { backgroundColor: getRoleColor(row.roles) } }, row.first_name.charAt(0), " ", row.last_name.charAt(0)), h("span", null, capitalize(row.first_name), " ", capitalize(row.last_name)))),
199
+ renderCell: (_, row) => (h("div", { style: { display: 'flex', flexDirection: 'row', gap: '10px', alignItems: 'center' } }, h("div", { class: "role", style: { backgroundColor: getRoleColor(row.roles) } }, formatInitials(row)), h("span", null, formatFullName(row)))),
86
200
  },
87
201
  { id: 'email', header: 'E-mail Address' },
88
202
  { id: 'phone', header: 'Phone Number' },
89
203
  { id: 'roles', header: 'Role', renderCell: (_, row) => `${getRoleLabel(row.roles)}` },
90
- { id: 'actions', header: 'Actions', renderCell: () => h("span", { innerHTML: TrashIcon, onClick: () => { } }) },
91
- ] }), h("verdocs-button", { label: "Invite New Member", size: "normal", disabled: true })));
204
+ {
205
+ id: 'actions',
206
+ header: 'Actions',
207
+ renderCell: (_, row) => h("div", null, row.id !== this.endpoint.session.profile_id && h("div", { innerHTML: TrashIcon, onClick: () => (this.deletingMember = row) })),
208
+ },
209
+ ] })), this.selectedTab === 1 && (h("verdocs-table", { data: this.invited, columns: [
210
+ { id: 'email', header: 'E-mail Address' },
211
+ { id: 'generated_at', header: 'Invited', renderCell: (_, row) => h("div", null, format(new Date(row.generated_at), 'MMM d, Y')) },
212
+ { id: 'role_id', header: 'Role', renderCell: (_, row) => { var _a; return h("div", null, getRoleLabel([{ name: (_a = this.roles.find(r => r.id === row.role_id)) === null || _a === void 0 ? void 0 : _a.name }])); } },
213
+ { id: 'status', header: 'Status', renderCell: (_, row) => h("div", null, capitalize(row.status)) },
214
+ {
215
+ id: 'actions',
216
+ header: 'Actions',
217
+ renderCell: (_, row) => (h("div", null, h("div", { innerHTML: TrashIcon, onClick: () => (this.deletingInvitation = row) }), h("div", { innerHTML: ArrowPathIcon, onClick: () => (this.resendingInvitation = row) }))),
218
+ },
219
+ ] })), h("verdocs-button", { label: "Invite New Member", size: "normal", disabled: this.submitting, onClick: () => (this.invitingMember = true) }), this.invitingMember && (h("verdocs-dialog", { onExit: () => (this.invitingMember = false) }, h("div", { slot: "title", class: "heading" }, "Invite New Member"), h("div", { class: "content" }, h("verdocs-text-input", { label: "E-mail Address", placeholder: "Enter the user's email address...", id: "verdocs-invite-email", value: this.newEmailAddress, autocomplete: "off", required: true, onInput: (e) => (this.newEmailAddress = e.target.value), onFocusout: (e) => {
220
+ this.newEmailAddress = e.target.value.trim();
221
+ } }), h("div", { style: { marginBottom: '20px' } }), h("verdocs-select-input", { options: roleOptions, label: "Role", onInput: (e) => {
222
+ this.newRoleId = e.target.value;
223
+ } }), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", size: "small", label: "Cancel", disabled: this.submitting, onClick: () => (this.invitingMember = false) }), h("verdocs-button", { size: "small", label: "OK", disabled: this.submitting || !this.newEmailAddress || !this.newRoleId, onClick: () => this.handleInviteMember() }))))), this.deletingMember && (h("verdocs-dialog", { onExit: () => (this.deletingMember = null) }, h("div", { slot: "title", class: "heading" }, "Delete Member?"), h("div", { class: "content" }, h("p", null, "Are you sure you want to delete this member? This action cannot be undone."), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", size: "small", disabled: this.submitting, label: "Cancel", onClick: () => (this.deletingMember = null) }), h("verdocs-button", { size: "small", label: "OK", disabled: this.submitting, onClick: () => this.handleDeleteMember() }))))), this.deletingInvitation && (h("verdocs-dialog", { onExit: () => (this.deletingInvitation = null) }, h("div", { slot: "title", class: "heading" }, "Cancel Invitation?"), h("div", { class: "content" }, h("p", null, "Are you sure you want to cancel this invitation? This action cannot be undone."), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", size: "small", disabled: this.submitting, label: "Cancel", onClick: () => (this.deletingInvitation = null) }), h("verdocs-button", { size: "small", label: "OK", disabled: this.submitting, onClick: () => this.handleDeleteInvitation() }))))), this.resendingInvitation && (h("verdocs-dialog", { onExit: () => (this.resendingInvitation = null) }, h("div", { slot: "title", class: "heading" }, "Resend Invitation?"), h("div", { class: "content" }, h("p", null, "The user will receive an email reminder to join your organization."), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", size: "small", disabled: this.submitting, label: "Cancel", onClick: () => (this.resendingInvitation = null) }), h("verdocs-button", { size: "small", label: "OK", disabled: this.submitting, onClick: () => this.handleResendInvitation() })))))));
92
224
  }
93
225
  static get style() { return verdocsSettingsMembersCss; }
94
226
  }, [0, "verdocs-settings-members", {
95
227
  "endpoint": [16],
96
- "members": [32]
228
+ "members": [32],
229
+ "invited": [32],
230
+ "roles": [32],
231
+ "selectedTab": [32],
232
+ "invitingMember": [32],
233
+ "newEmailAddress": [32],
234
+ "newRoleId": [32],
235
+ "submitting": [32],
236
+ "deletingInvitation": [32],
237
+ "resendingInvitation": [32],
238
+ "deletingMember": [32]
97
239
  }]);
98
240
  function defineCustomElement() {
99
241
  if (typeof customElements === "undefined") {
100
242
  return;
101
243
  }
102
- const components = ["verdocs-settings-members", "verdocs-button", "verdocs-table"];
244
+ const components = ["verdocs-settings-members", "verdocs-button", "verdocs-dialog", "verdocs-help-icon", "verdocs-select-input", "verdocs-table", "verdocs-tabs", "verdocs-text-input"];
103
245
  components.forEach(tagName => { switch (tagName) {
104
246
  case "verdocs-settings-members":
105
247
  if (!customElements.get(tagName)) {
@@ -108,10 +250,35 @@ function defineCustomElement() {
108
250
  break;
109
251
  case "verdocs-button":
110
252
  if (!customElements.get(tagName)) {
111
- defineCustomElement$2();
253
+ defineCustomElement$7();
254
+ }
255
+ break;
256
+ case "verdocs-dialog":
257
+ if (!customElements.get(tagName)) {
258
+ defineCustomElement$6();
259
+ }
260
+ break;
261
+ case "verdocs-help-icon":
262
+ if (!customElements.get(tagName)) {
263
+ defineCustomElement$5();
264
+ }
265
+ break;
266
+ case "verdocs-select-input":
267
+ if (!customElements.get(tagName)) {
268
+ defineCustomElement$4();
112
269
  }
113
270
  break;
114
271
  case "verdocs-table":
272
+ if (!customElements.get(tagName)) {
273
+ defineCustomElement$3();
274
+ }
275
+ break;
276
+ case "verdocs-tabs":
277
+ if (!customElements.get(tagName)) {
278
+ defineCustomElement$2();
279
+ }
280
+ break;
281
+ case "verdocs-text-input":
115
282
  if (!customElements.get(tagName)) {
116
283
  defineCustomElement$1();
117
284
  }
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { z } from './index3.js';
3
- import { g as getCurrentProfile, u as updateProfile } from './Profiles.js';
3
+ import { a as getCurrentProfile, u as updateProfile } from './Profiles.js';
4
4
  import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
5
5
  import './Types.js';
6
6
  import { d as convertToE164 } from './utils.js';