@verdocs/web-sdk 4.1.14 → 4.1.16
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.
- package/dist/cjs/{EnvelopeStore-db4f3f17.js → EnvelopeStore-4aeb54e1.js} +1 -1
- package/dist/cjs/{TemplateStore-037833e5.js → TemplateStore-7c7f1c50.js} +1 -1
- package/dist/cjs/{index-a5472099.js → index-2a189d85.js} +0 -517
- package/dist/cjs/index-cfdfab36.js +12 -24
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js +2 -2
- package/dist/cjs/{verdocs-button-panel.cjs.entry.js → verdocs-button-panel_2.cjs.entry.js} +21 -0
- package/dist/cjs/{verdocs-checkbox_3.cjs.entry.js → verdocs-checkbox_4.cjs.entry.js} +17 -2
- package/dist/cjs/{verdocs-dialog_2.cjs.entry.js → verdocs-dialog.cjs.entry.js} +0 -22
- package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +3 -4
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +10 -11
- package/dist/cjs/verdocs-preview_10.cjs.entry.js +15 -13
- package/dist/cjs/verdocs-radio-button_3.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-table.cjs.entry.js +28 -0
- package/dist/cjs/verdocs-templates-list.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-view.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +0 -5
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +13 -11
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +1 -1
- package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.js +1 -2
- package/dist/collection/components/envelopes/verdocs-envelopes-list/verdocs-envelopes-list.js +10 -11
- package/dist/collection/components/templates/verdocs-templates-list/verdocs-templates-list.js +2 -2
- package/dist/components/EnvelopeStore.js +2 -2
- package/dist/components/TemplateFieldStore.js +1 -1
- package/dist/components/TemplateRoleStore.js +1 -1
- package/dist/components/TemplateStore.js +2 -2
- package/dist/components/index.js +0 -10
- package/dist/components/index3.js +166 -4207
- package/dist/components/index4.js +3692 -167
- package/dist/components/verdocs-dialog.js +37 -1
- package/dist/components/verdocs-envelope-sidebar.js +1 -2
- package/dist/components/verdocs-envelopes-list.js +10 -11
- package/dist/components/verdocs-send2.js +13 -11
- package/dist/components/verdocs-table.js +39 -1
- package/dist/components/verdocs-templates-list.js +2 -2
- package/dist/components/verdocs-view2.js +1 -1
- package/dist/custom-elements.json +2086 -0
- package/dist/esm/{EnvelopeStore-9df042b5.js → EnvelopeStore-1ed5dc8f.js} +1 -1
- package/dist/esm/{TemplateStore-78ad24d7.js → TemplateStore-7d41d941.js} +1 -1
- package/dist/esm/{index-7456b04f.js → index-7588a071.js} +1 -517
- package/dist/esm/index-b89cf6a4.js +12 -24
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-build.entry.js +2 -2
- package/dist/esm/{verdocs-button-panel.entry.js → verdocs-button-panel_2.entry.js} +22 -2
- package/dist/esm/{verdocs-checkbox_3.entry.js → verdocs-checkbox_4.entry.js} +17 -3
- package/dist/{components/verdocs-dialog2.js → esm/verdocs-dialog.entry.js} +7 -21
- package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +2 -2
- package/dist/esm/verdocs-envelope-sidebar.entry.js +3 -4
- package/dist/esm/verdocs-envelopes-list.entry.js +10 -11
- package/dist/esm/verdocs-preview_10.entry.js +15 -13
- package/dist/esm/verdocs-radio-button_3.entry.js +2 -2
- package/dist/{components/verdocs-table2.js → esm/verdocs-table.entry.js} +7 -24
- package/dist/esm/verdocs-templates-list.entry.js +2 -2
- package/dist/esm/verdocs-view.entry.js +1 -1
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/{EnvelopeStore-9df042b5.js → EnvelopeStore-1ed5dc8f.js} +1 -1
- package/dist/esm-es5/{TemplateStore-78ad24d7.js → TemplateStore-7d41d941.js} +1 -1
- package/dist/esm-es5/index-7588a071.js +1 -0
- package/dist/esm-es5/index-b89cf6a4.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-button-panel_2.entry.js +1 -0
- package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -0
- package/dist/esm-es5/{verdocs-dialog_2.entry.js → verdocs-dialog.entry.js} +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_10.entry.js +1 -1
- package/dist/esm-es5/verdocs-radio-button_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-table.entry.js +1 -0
- package/dist/esm-es5/verdocs-templates-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-view.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components.d.ts +2 -322
- package/dist/verdocs-web-sdk/{p-5961ce51.entry.js → p-0d54abe5.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-1f771dad.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-95e90092.system.entry.js → p-2be9ba53.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-30513f94.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-322fa613.system.js +1 -1
- package/dist/verdocs-web-sdk/p-3f4b3548.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-5309a156.system.entry.js → p-413ab8a1.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-16850eac.system.entry.js → p-48fce604.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-61257cb2.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-225418c7.entry.js → p-687c07ad.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-73f45012.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-7fe48d2e.entry.js → p-78908c67.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5e3e9c4a.system.js → p-889cc411.system.js} +1 -1
- package/dist/verdocs-web-sdk/p-9440752e.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-f05a3654.system.entry.js → p-977a5a4b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-540d9467.entry.js → p-9d36d2ad.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-a706bac9.js +1 -0
- package/dist/verdocs-web-sdk/p-b3017cd6.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-316b550f.entry.js → p-b61842bd.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-03aedbe9.system.entry.js → p-b6b6f12a.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-0e022e75.system.entry.js → p-b7397955.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-ba6570b4.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-afbbdc2f.system.js → p-c8de3052.system.js} +1 -1
- package/dist/verdocs-web-sdk/p-cf7f4475.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-8a820b88.system.entry.js → p-d2feac5b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-e7578fac.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-c28c4e43.js → p-f02e08da.js} +1 -1
- package/dist/verdocs-web-sdk/p-f5064e0c.system.js +1 -0
- package/dist/verdocs-web-sdk/{p-5df130eb.entry.js → p-f632ffac.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-9ec464df.js → p-fc2ae858.js} +1 -1
- package/dist/verdocs-web-sdk/p-fc5e568d.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +2 -3
- package/dist/cjs/verdocs-component-error.cjs.entry.js +0 -21
- package/dist/cjs/verdocs-settings-api-keys_4.cjs.entry.js +0 -542
- package/dist/cjs/verdocs-settings.cjs.entry.js +0 -42
- package/dist/cjs/verdocs-tabs.cjs.entry.js +0 -27
- package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.css +0 -40
- package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.js +0 -104
- package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.css +0 -64
- package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.js +0 -292
- package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.css +0 -80
- package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.js +0 -349
- package/dist/collection/components/settings/verdocs-settings-organization/TimeZones.js +0 -144
- package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.css +0 -44
- package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.js +0 -192
- package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.css +0 -44
- package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.js +0 -190
- package/dist/components/verdocs-settings-api-keys.d.ts +0 -11
- package/dist/components/verdocs-settings-api-keys.js +0 -6
- package/dist/components/verdocs-settings-api-keys2.js +0 -209
- package/dist/components/verdocs-settings-members.d.ts +0 -11
- package/dist/components/verdocs-settings-members.js +0 -6
- package/dist/components/verdocs-settings-members2.js +0 -273
- package/dist/components/verdocs-settings-organization.d.ts +0 -11
- package/dist/components/verdocs-settings-organization.js +0 -6
- package/dist/components/verdocs-settings-organization2.js +0 -142
- package/dist/components/verdocs-settings-profile.d.ts +0 -11
- package/dist/components/verdocs-settings-profile.js +0 -6
- package/dist/components/verdocs-settings-profile2.js +0 -140
- package/dist/components/verdocs-settings.d.ts +0 -11
- package/dist/components/verdocs-settings.js +0 -130
- package/dist/esm/verdocs-component-error.entry.js +0 -17
- package/dist/esm/verdocs-dialog_2.entry.js +0 -46
- package/dist/esm/verdocs-settings-api-keys_4.entry.js +0 -535
- package/dist/esm/verdocs-settings.entry.js +0 -38
- package/dist/esm/verdocs-tabs.entry.js +0 -23
- package/dist/esm-es5/index-7456b04f.js +0 -1
- package/dist/esm-es5/verdocs-button-panel.entry.js +0 -1
- package/dist/esm-es5/verdocs-checkbox_3.entry.js +0 -1
- package/dist/esm-es5/verdocs-component-error.entry.js +0 -1
- package/dist/esm-es5/verdocs-settings-api-keys_4.entry.js +0 -1
- package/dist/esm-es5/verdocs-settings.entry.js +0 -1
- package/dist/esm-es5/verdocs-tabs.entry.js +0 -1
- package/dist/types/components/embeds/verdocs-settings/verdocs-settings.d.ts +0 -26
- package/dist/types/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.d.ts +0 -54
- package/dist/types/components/settings/verdocs-settings-members/verdocs-settings-members.d.ts +0 -58
- package/dist/types/components/settings/verdocs-settings-organization/TimeZones.d.ts +0 -1
- package/dist/types/components/settings/verdocs-settings-organization/verdocs-settings-organization.d.ts +0 -37
- package/dist/types/components/settings/verdocs-settings-profile/verdocs-settings-profile.d.ts +0 -37
- package/dist/verdocs-web-sdk/p-03f8d33f.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-12c26b19.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-141a992e.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-3ecaea8a.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-45cf0ab5.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-4df630c2.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-515ee177.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-6fa08e21.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-708b5430.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-753d0e16.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-952b88fb.system.js +0 -1
- package/dist/verdocs-web-sdk/p-971ab2d1.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e42587b7.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-efc547dc.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-f3b47dfc.js +0 -1
- package/dist/verdocs-web-sdk/p-f44b9bd0.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-f73b68fb.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-fbfdfcd4.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-fe0c473d.entry.js +0 -1
@@ -1,192 +0,0 @@
|
|
1
|
-
import { z } from "zod";
|
2
|
-
import { getOrganization, updateOrganization, VerdocsEndpoint } from "@verdocs/js-sdk";
|
3
|
-
import { h, Host } from "@stencil/core";
|
4
|
-
import { convertToE164 } from "../../../utils/utils";
|
5
|
-
import { VerdocsToast } from "../../../utils/Toast";
|
6
|
-
const schema = z.object({
|
7
|
-
// name: z.string().trim().min(1, 'Name is required').max(30),
|
8
|
-
business_name: z.string().trim().max(30).optional(),
|
9
|
-
contact_email: z.string().trim().email('Invalid email').optional().or(z.literal('')),
|
10
|
-
phone: z.preprocess(val => convertToE164(String(val).trim()), z.string().optional()),
|
11
|
-
url: z.string().trim().optional(),
|
12
|
-
});
|
13
|
-
/**
|
14
|
-
* Displays a settings form that allows the user to manage their Verdocs profile.
|
15
|
-
*/
|
16
|
-
export class VerdocsSettingsOrganization {
|
17
|
-
constructor() {
|
18
|
-
this.endpoint = VerdocsEndpoint.getDefault();
|
19
|
-
this.valid = false;
|
20
|
-
this.dirty = false;
|
21
|
-
this.submitting = false;
|
22
|
-
this.name = '';
|
23
|
-
this.contact_email = '';
|
24
|
-
this.phone = '';
|
25
|
-
this.url = '';
|
26
|
-
}
|
27
|
-
componentWillLoad() {
|
28
|
-
this.endpoint.loadSession();
|
29
|
-
if (!this.endpoint.session) {
|
30
|
-
console.log('[SETTINGS] Must be authenticated');
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
async componentDidLoad() {
|
35
|
-
const organization = await getOrganization(this.endpoint, this.endpoint.session.organization_id);
|
36
|
-
console.log('[SETTINGS] Loaded organization', organization);
|
37
|
-
this.resetForm(organization);
|
38
|
-
}
|
39
|
-
resetForm(organization) {
|
40
|
-
this.name = organization.name;
|
41
|
-
this.contact_email = organization.contact_email;
|
42
|
-
this.phone = organization.phone;
|
43
|
-
this.url = organization.url;
|
44
|
-
this.dirty = false;
|
45
|
-
this.valid = true;
|
46
|
-
}
|
47
|
-
handleSubmit(e) {
|
48
|
-
e.preventDefault();
|
49
|
-
e.stopPropagation();
|
50
|
-
updateOrganization(VerdocsEndpoint.getDefault(), this.endpoint.session.organization_id, {
|
51
|
-
name: this.name,
|
52
|
-
contact_email: this.contact_email,
|
53
|
-
phone: this.phone,
|
54
|
-
url: this.url,
|
55
|
-
})
|
56
|
-
.then(newOrganization => {
|
57
|
-
var _a;
|
58
|
-
console.log('[SETTINGS] Update result', newOrganization);
|
59
|
-
(_a = this.organizationUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, organization: newOrganization });
|
60
|
-
this.resetForm(newOrganization);
|
61
|
-
})
|
62
|
-
.catch(e => VerdocsToast(`Error updating organization: ${e.message}`, { style: 'error' }));
|
63
|
-
}
|
64
|
-
processFields() {
|
65
|
-
const validation = schema.safeParse({
|
66
|
-
name: this.name,
|
67
|
-
contact_email: this.contact_email,
|
68
|
-
phone: this.phone,
|
69
|
-
url: this.url,
|
70
|
-
});
|
71
|
-
console.log('[SETTINGS] Validation result', validation);
|
72
|
-
this.valid = validation.success;
|
73
|
-
this.dirty = true;
|
74
|
-
}
|
75
|
-
render() {
|
76
|
-
if (!this.endpoint.session) {
|
77
|
-
console.log('[SETTINGS] Must be authenticated');
|
78
|
-
return h(Host, { class: "authentication-required" }, "Must be authenticated");
|
79
|
-
}
|
80
|
-
return (h(Host, null, h("h1", null, "Organization Profile"), h("form", { onSubmit: e => this.handleSubmit(e) }, h("div", { class: "columns" }, h("div", { class: "column" }, h("verdocs-text-input", { id: "verdocs-organization-name", value: this.name, autocomplete: "off", label: "Name", required: false, disabled: false, placeholder: "Enter your organization's name...", onInput: (e) => (this.name = e.target.value), onFocusout: (e) => {
|
81
|
-
this.name = e.target.value.trim();
|
82
|
-
this.processFields();
|
83
|
-
} }), h("verdocs-text-input", { id: "verdocs-organization-url", value: this.url, autocomplete: "off", label: "Web URL", placeholder: "Enter your Web URL...", onInput: (e) => (this.url = e.target.value), onFocusout: (e) => {
|
84
|
-
this.url = e.target.value.trim();
|
85
|
-
this.processFields();
|
86
|
-
} }), h("verdocs-text-input", { id: "verdocs-organization-phone", value: this.phone, autocomplete: "off", label: "Phone Number", placeholder: "Enter your phone number...", onInput: (e) => (this.phone = e.target.value), onFocusout: (e) => {
|
87
|
-
this.phone = e.target.value.trim();
|
88
|
-
this.processFields();
|
89
|
-
} })), h("div", { class: "column" }, h("verdocs-text-input", { id: "verdocs-organization-email", value: this.contact_email, clearable: true, autocomplete: "off", label: "Contact Email", placeholder: "Enter your contact email address...", onInput: (e) => (this.contact_email = e.target.value), onFocusout: (e) => {
|
90
|
-
this.contact_email = e.target.value.trim();
|
91
|
-
this.processFields();
|
92
|
-
} }))), h("verdocs-button", { type: "submit", label: "Save", size: "normal", disabled: this.submitting || !this.dirty }))));
|
93
|
-
}
|
94
|
-
static get is() { return "verdocs-settings-organization"; }
|
95
|
-
static get originalStyleUrls() {
|
96
|
-
return {
|
97
|
-
"$": ["verdocs-settings-organization.scss"]
|
98
|
-
};
|
99
|
-
}
|
100
|
-
static get styleUrls() {
|
101
|
-
return {
|
102
|
-
"$": ["verdocs-settings-organization.css"]
|
103
|
-
};
|
104
|
-
}
|
105
|
-
static get properties() {
|
106
|
-
return {
|
107
|
-
"endpoint": {
|
108
|
-
"type": "unknown",
|
109
|
-
"mutable": false,
|
110
|
-
"complexType": {
|
111
|
-
"original": "VerdocsEndpoint",
|
112
|
-
"resolved": "VerdocsEndpoint",
|
113
|
-
"references": {
|
114
|
-
"VerdocsEndpoint": {
|
115
|
-
"location": "import",
|
116
|
-
"path": "@verdocs/js-sdk",
|
117
|
-
"id": ""
|
118
|
-
}
|
119
|
-
}
|
120
|
-
},
|
121
|
-
"required": false,
|
122
|
-
"optional": false,
|
123
|
-
"docs": {
|
124
|
-
"tags": [],
|
125
|
-
"text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
|
126
|
-
},
|
127
|
-
"defaultValue": "VerdocsEndpoint.getDefault()"
|
128
|
-
}
|
129
|
-
};
|
130
|
-
}
|
131
|
-
static get states() {
|
132
|
-
return {
|
133
|
-
"valid": {},
|
134
|
-
"dirty": {},
|
135
|
-
"submitting": {},
|
136
|
-
"name": {},
|
137
|
-
"contact_email": {},
|
138
|
-
"phone": {},
|
139
|
-
"url": {}
|
140
|
-
};
|
141
|
-
}
|
142
|
-
static get events() {
|
143
|
-
return [{
|
144
|
-
"method": "sdkError",
|
145
|
-
"name": "sdkError",
|
146
|
-
"bubbles": true,
|
147
|
-
"cancelable": true,
|
148
|
-
"composed": true,
|
149
|
-
"docs": {
|
150
|
-
"tags": [],
|
151
|
-
"text": "Event fired if an error occurs. The event details will contain information about the error. Most errors will\nterminate the process, and the calling application should correct the condition and re-render the component."
|
152
|
-
},
|
153
|
-
"complexType": {
|
154
|
-
"original": "SDKError",
|
155
|
-
"resolved": "SDKError",
|
156
|
-
"references": {
|
157
|
-
"SDKError": {
|
158
|
-
"location": "import",
|
159
|
-
"path": "../../../utils/errors",
|
160
|
-
"id": "src/utils/errors.ts::SDKError"
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}
|
164
|
-
}, {
|
165
|
-
"method": "organizationUpdated",
|
166
|
-
"name": "organizationUpdated",
|
167
|
-
"bubbles": true,
|
168
|
-
"cancelable": true,
|
169
|
-
"composed": true,
|
170
|
-
"docs": {
|
171
|
-
"tags": [],
|
172
|
-
"text": "Event fired when the user chooses the Edit option from the dropdown menu."
|
173
|
-
},
|
174
|
-
"complexType": {
|
175
|
-
"original": "{endpoint: VerdocsEndpoint; organization: IOrganization}",
|
176
|
-
"resolved": "{ endpoint: VerdocsEndpoint; organization: IOrganization; }",
|
177
|
-
"references": {
|
178
|
-
"VerdocsEndpoint": {
|
179
|
-
"location": "import",
|
180
|
-
"path": "@verdocs/js-sdk",
|
181
|
-
"id": ""
|
182
|
-
},
|
183
|
-
"IOrganization": {
|
184
|
-
"location": "import",
|
185
|
-
"path": "@verdocs/js-sdk",
|
186
|
-
"id": ""
|
187
|
-
}
|
188
|
-
}
|
189
|
-
}
|
190
|
-
}];
|
191
|
-
}
|
192
|
-
}
|
package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.css
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
@keyframes verdocs-field-pulse {
|
2
|
-
0% {
|
3
|
-
background-color: rgba(0, 0, 0, 0.35);
|
4
|
-
}
|
5
|
-
50% {
|
6
|
-
background-color: rgba(0, 0, 0, 0);
|
7
|
-
}
|
8
|
-
100% {
|
9
|
-
background-color: rgba(0, 0, 0, 0.35);
|
10
|
-
}
|
11
|
-
}
|
12
|
-
verdocs-settings-profile {
|
13
|
-
display: flex;
|
14
|
-
padding: 10px;
|
15
|
-
font-size: 18px;
|
16
|
-
flex-wrap: nowrap;
|
17
|
-
border-radius: 6px;
|
18
|
-
color: #33364b;
|
19
|
-
flex-direction: column;
|
20
|
-
font-family: "Inter", "Barlow", sans-serif;
|
21
|
-
}
|
22
|
-
verdocs-settings-profile .columns {
|
23
|
-
gap: 20px;
|
24
|
-
display: flex;
|
25
|
-
flex-wrap: wrap;
|
26
|
-
flex-direction: row;
|
27
|
-
}
|
28
|
-
verdocs-settings-profile .column {
|
29
|
-
flex: 1;
|
30
|
-
display: flex;
|
31
|
-
flex-direction: column;
|
32
|
-
}
|
33
|
-
verdocs-settings-profile verdocs-text-input {
|
34
|
-
margin: 10px 0;
|
35
|
-
}
|
36
|
-
verdocs-settings-profile verdocs-text-input input {
|
37
|
-
height: 32px;
|
38
|
-
}
|
39
|
-
@media screen and (max-width: 600px) {
|
40
|
-
verdocs-settings-profile .columns {
|
41
|
-
gap: 0;
|
42
|
-
flex-direction: column;
|
43
|
-
}
|
44
|
-
}
|
package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.js
DELETED
@@ -1,190 +0,0 @@
|
|
1
|
-
import { z } from "zod";
|
2
|
-
import { getCurrentProfile, updateProfile, VerdocsEndpoint } from "@verdocs/js-sdk";
|
3
|
-
import { h, Host } from "@stencil/core";
|
4
|
-
import { convertToE164 } from "../../../utils/utils";
|
5
|
-
import { VerdocsToast } from "../../../utils/Toast";
|
6
|
-
const schema = z.object({
|
7
|
-
first_name: z.string().trim().min(1, 'First name is required').max(30),
|
8
|
-
last_name: z.string().trim().min(1, 'Last name is required').max(30),
|
9
|
-
email: z.string().trim().email('Invalid email').min(1, 'Email is required'),
|
10
|
-
phone: z.preprocess(val => convertToE164(String(val).trim()), z.string()),
|
11
|
-
});
|
12
|
-
/**
|
13
|
-
* Displays a settings form that allows the user to manage their Verdocs profile.
|
14
|
-
*/
|
15
|
-
export class VerdocsSettingsProfile {
|
16
|
-
constructor() {
|
17
|
-
this.endpoint = VerdocsEndpoint.getDefault();
|
18
|
-
this.valid = false;
|
19
|
-
this.dirty = false;
|
20
|
-
this.submitting = false;
|
21
|
-
this.first_name = '';
|
22
|
-
this.last_name = '';
|
23
|
-
this.email = '';
|
24
|
-
this.phone = '';
|
25
|
-
}
|
26
|
-
componentWillLoad() {
|
27
|
-
this.endpoint.loadSession();
|
28
|
-
if (!this.endpoint.session) {
|
29
|
-
console.log('[SETTINGS] Must be authenticated');
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
async componentDidLoad() {
|
34
|
-
const profile = await getCurrentProfile(this.endpoint);
|
35
|
-
console.log('[SETTINGS] Loaded profile', profile);
|
36
|
-
this.resetForm(profile);
|
37
|
-
}
|
38
|
-
resetForm(profile) {
|
39
|
-
this.first_name = profile.first_name;
|
40
|
-
this.last_name = profile.last_name;
|
41
|
-
this.email = profile.email;
|
42
|
-
this.phone = profile.phone;
|
43
|
-
this.dirty = false;
|
44
|
-
this.valid = true;
|
45
|
-
}
|
46
|
-
handleSubmit(e) {
|
47
|
-
e.preventDefault();
|
48
|
-
e.stopPropagation();
|
49
|
-
updateProfile(VerdocsEndpoint.getDefault(), this.endpoint.session.profile_id, {
|
50
|
-
first_name: this.first_name,
|
51
|
-
last_name: this.last_name,
|
52
|
-
phone: this.phone,
|
53
|
-
})
|
54
|
-
.then(newProfile => {
|
55
|
-
var _a;
|
56
|
-
console.log('[SETTINGS] Update result', newProfile);
|
57
|
-
(_a = this.profileUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, profile: newProfile });
|
58
|
-
this.resetForm(newProfile);
|
59
|
-
})
|
60
|
-
.catch(e => VerdocsToast(`Error updating profile: ${e.message}`, { style: 'error' }));
|
61
|
-
}
|
62
|
-
processFields() {
|
63
|
-
const validation = schema.safeParse({
|
64
|
-
first_name: this.first_name,
|
65
|
-
last_name: this.last_name,
|
66
|
-
email: this.email,
|
67
|
-
phone: this.phone,
|
68
|
-
});
|
69
|
-
console.log('[SETTINGS] Validation result', validation);
|
70
|
-
this.valid = validation.success;
|
71
|
-
this.dirty = true;
|
72
|
-
}
|
73
|
-
render() {
|
74
|
-
if (!this.endpoint.session) {
|
75
|
-
console.log('[SETTINGS] Must be authenticated');
|
76
|
-
return h(Host, { class: "authentication-required" }, "Must be authenticated");
|
77
|
-
}
|
78
|
-
return (h(Host, null, h("h1", null, "My Profile"), h("form", { onSubmit: e => this.handleSubmit(e) }, h("div", { class: "columns" }, h("div", { class: "column" }, h("verdocs-text-input", { id: "verdocs-profile-first-name", value: this.first_name, autocomplete: "off", label: "First Name", required: true, placeholder: "Enter your first name...", onInput: (e) => (this.first_name = e.target.value), onFocusout: (e) => {
|
79
|
-
this.first_name = e.target.value.trim();
|
80
|
-
this.processFields();
|
81
|
-
} }), h("verdocs-text-input", { id: "verdocs-profile-last-name", value: this.last_name, autocomplete: "off", label: "Last Name", required: true, placeholder: "Enter your last name...", onInput: (e) => (this.last_name = e.target.value), onFocusout: (e) => {
|
82
|
-
this.last_name = e.target.value.trim();
|
83
|
-
this.processFields();
|
84
|
-
} })), h("div", { class: "column" }, h("verdocs-text-input", { id: "verdocs-profile-email", value: this.email, autocomplete: "off", label: "Email Address", required: true, disabled: true, placeholder: "Enter your email address...", onInput: (e) => (this.email = e.target.value), onFocusout: (e) => {
|
85
|
-
this.email = e.target.value.trim();
|
86
|
-
this.processFields();
|
87
|
-
} }), h("verdocs-text-input", { id: "verdocs-profile-phone", value: this.phone, clearable: true, autocomplete: "off", label: "Phone Number", placeholder: "Enter your phone number...", onInput: (e) => (this.phone = e.target.value), onFocusout: (e) => {
|
88
|
-
this.phone = e.target.value.trim();
|
89
|
-
this.processFields();
|
90
|
-
} }))), h("verdocs-button", { type: "submit", label: "Save", size: "normal", disabled: this.submitting || !this.dirty }))));
|
91
|
-
}
|
92
|
-
static get is() { return "verdocs-settings-profile"; }
|
93
|
-
static get originalStyleUrls() {
|
94
|
-
return {
|
95
|
-
"$": ["verdocs-settings-profile.scss"]
|
96
|
-
};
|
97
|
-
}
|
98
|
-
static get styleUrls() {
|
99
|
-
return {
|
100
|
-
"$": ["verdocs-settings-profile.css"]
|
101
|
-
};
|
102
|
-
}
|
103
|
-
static get properties() {
|
104
|
-
return {
|
105
|
-
"endpoint": {
|
106
|
-
"type": "unknown",
|
107
|
-
"mutable": false,
|
108
|
-
"complexType": {
|
109
|
-
"original": "VerdocsEndpoint",
|
110
|
-
"resolved": "VerdocsEndpoint",
|
111
|
-
"references": {
|
112
|
-
"VerdocsEndpoint": {
|
113
|
-
"location": "import",
|
114
|
-
"path": "@verdocs/js-sdk",
|
115
|
-
"id": ""
|
116
|
-
}
|
117
|
-
}
|
118
|
-
},
|
119
|
-
"required": false,
|
120
|
-
"optional": false,
|
121
|
-
"docs": {
|
122
|
-
"tags": [],
|
123
|
-
"text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
|
124
|
-
},
|
125
|
-
"defaultValue": "VerdocsEndpoint.getDefault()"
|
126
|
-
}
|
127
|
-
};
|
128
|
-
}
|
129
|
-
static get states() {
|
130
|
-
return {
|
131
|
-
"valid": {},
|
132
|
-
"dirty": {},
|
133
|
-
"submitting": {},
|
134
|
-
"first_name": {},
|
135
|
-
"last_name": {},
|
136
|
-
"email": {},
|
137
|
-
"phone": {}
|
138
|
-
};
|
139
|
-
}
|
140
|
-
static get events() {
|
141
|
-
return [{
|
142
|
-
"method": "sdkError",
|
143
|
-
"name": "sdkError",
|
144
|
-
"bubbles": true,
|
145
|
-
"cancelable": true,
|
146
|
-
"composed": true,
|
147
|
-
"docs": {
|
148
|
-
"tags": [],
|
149
|
-
"text": "Event fired if an error occurs. The event details will contain information about the error. Most errors will\nterminate the process, and the calling application should correct the condition and re-render the component."
|
150
|
-
},
|
151
|
-
"complexType": {
|
152
|
-
"original": "SDKError",
|
153
|
-
"resolved": "SDKError",
|
154
|
-
"references": {
|
155
|
-
"SDKError": {
|
156
|
-
"location": "import",
|
157
|
-
"path": "../../../utils/errors",
|
158
|
-
"id": "src/utils/errors.ts::SDKError"
|
159
|
-
}
|
160
|
-
}
|
161
|
-
}
|
162
|
-
}, {
|
163
|
-
"method": "profileUpdated",
|
164
|
-
"name": "profileUpdated",
|
165
|
-
"bubbles": true,
|
166
|
-
"cancelable": true,
|
167
|
-
"composed": true,
|
168
|
-
"docs": {
|
169
|
-
"tags": [],
|
170
|
-
"text": "Event fired when the user chooses the Edit option from the dropdown menu."
|
171
|
-
},
|
172
|
-
"complexType": {
|
173
|
-
"original": "{endpoint: VerdocsEndpoint; profile: IProfile}",
|
174
|
-
"resolved": "{ endpoint: VerdocsEndpoint; profile: IProfile; }",
|
175
|
-
"references": {
|
176
|
-
"VerdocsEndpoint": {
|
177
|
-
"location": "import",
|
178
|
-
"path": "@verdocs/js-sdk",
|
179
|
-
"id": ""
|
180
|
-
},
|
181
|
-
"IProfile": {
|
182
|
-
"location": "import",
|
183
|
-
"path": "@verdocs/js-sdk",
|
184
|
-
"id": ""
|
185
|
-
}
|
186
|
-
}
|
187
|
-
}
|
188
|
-
}];
|
189
|
-
}
|
190
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
2
|
-
|
3
|
-
interface VerdocsSettingsApiKeys extends Components.VerdocsSettingsApiKeys, HTMLElement {}
|
4
|
-
export const VerdocsSettingsApiKeys: {
|
5
|
-
prototype: VerdocsSettingsApiKeys;
|
6
|
-
new (): VerdocsSettingsApiKeys;
|
7
|
-
};
|
8
|
-
/**
|
9
|
-
* Used to define this component and all nested components recursively.
|
10
|
-
*/
|
11
|
-
export const defineCustomElement: () => void;
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { V as VerdocsSettingsApiKeys$1, d as defineCustomElement$1 } from './verdocs-settings-api-keys2.js';
|
2
|
-
|
3
|
-
const VerdocsSettingsApiKeys = VerdocsSettingsApiKeys$1;
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
5
|
-
|
6
|
-
export { VerdocsSettingsApiKeys, defineCustomElement };
|
@@ -1,209 +0,0 @@
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
-
import { VerdocsEndpoint, getOrganizationMembers, getApiKeys, deleteApiKey, rotateApiKey, createApiKey, formatFullName } from '@verdocs/js-sdk';
|
3
|
-
import { V as VerdocsToast } from './Toast.js';
|
4
|
-
import { S as SDKError } from './errors.js';
|
5
|
-
import { d as defineCustomElement$6 } from './verdocs-button2.js';
|
6
|
-
import { d as defineCustomElement$5 } from './verdocs-dialog2.js';
|
7
|
-
import { d as defineCustomElement$4 } from './verdocs-help-icon2.js';
|
8
|
-
import { d as defineCustomElement$3 } from './verdocs-select-input2.js';
|
9
|
-
import { d as defineCustomElement$2 } from './verdocs-table2.js';
|
10
|
-
import { d as defineCustomElement$1 } from './verdocs-text-input2.js';
|
11
|
-
|
12
|
-
const verdocsSettingsApiKeysCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-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}@media all and (max-width: 450px){verdocs-settings-api-keys .col-client_id,verdocs-settings-api-keys .col-actions{display:none}}";
|
13
|
-
const VerdocsSettingsApiKeysStyle0 = verdocsSettingsApiKeysCss;
|
14
|
-
|
15
|
-
// 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>`;
|
16
|
-
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>`;
|
17
|
-
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>`;
|
18
|
-
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>`;
|
19
|
-
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>`;
|
20
|
-
const VerdocsSettingsApiKeys = /*@__PURE__*/ proxyCustomElement(class VerdocsSettingsApiKeys extends HTMLElement {
|
21
|
-
constructor() {
|
22
|
-
super();
|
23
|
-
this.__registerHost();
|
24
|
-
this.sdkError = createEvent(this, "sdkError", 7);
|
25
|
-
this.memberInvited = createEvent(this, "memberInvited", 7);
|
26
|
-
this.memberUpdated = createEvent(this, "memberUpdated", 7);
|
27
|
-
this.memberRemoved = createEvent(this, "memberRemoved", 7);
|
28
|
-
this.endpoint = VerdocsEndpoint.getDefault();
|
29
|
-
this.keys = [];
|
30
|
-
this.creatingKey = false;
|
31
|
-
this.createdKey = null;
|
32
|
-
this.deletingKey = null;
|
33
|
-
this.rotatingKey = null;
|
34
|
-
this.newApiKeyName = '';
|
35
|
-
this.newApiKeyProfileId = '';
|
36
|
-
this.members = [];
|
37
|
-
}
|
38
|
-
componentWillLoad() {
|
39
|
-
this.endpoint.loadSession();
|
40
|
-
if (!this.endpoint.session) {
|
41
|
-
console.log('[SETTINGS] Must be authenticated');
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
async componentDidLoad() {
|
46
|
-
this.newApiKeyProfileId = this.endpoint.session.profile_id;
|
47
|
-
getOrganizationMembers(this.endpoint)
|
48
|
-
.then(mem => {
|
49
|
-
this.members = mem;
|
50
|
-
})
|
51
|
-
.catch((e) => {
|
52
|
-
var _a, _b, _c;
|
53
|
-
console.log('[SETTINGS] Error loading organization members', e);
|
54
|
-
(_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));
|
55
|
-
VerdocsToast('Unable to load API keys. Please try again later', { style: 'error' });
|
56
|
-
});
|
57
|
-
this.loadKeys();
|
58
|
-
}
|
59
|
-
loadKeys() {
|
60
|
-
getApiKeys(this.endpoint)
|
61
|
-
.then(r => {
|
62
|
-
this.keys = r;
|
63
|
-
})
|
64
|
-
.catch(e => {
|
65
|
-
var _a, _b, _c;
|
66
|
-
console.log('[SETTINGS] Unable to load API keys', e);
|
67
|
-
(_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));
|
68
|
-
VerdocsToast('Unable to load API keys. Please try again later', { style: 'error' });
|
69
|
-
});
|
70
|
-
}
|
71
|
-
async handleDeleteKey() {
|
72
|
-
deleteApiKey(this.endpoint, this.deletingKey.client_id)
|
73
|
-
.then(() => {
|
74
|
-
this.deletingKey = null;
|
75
|
-
VerdocsToast('API key deleted', { style: 'success' });
|
76
|
-
this.loadKeys();
|
77
|
-
})
|
78
|
-
.catch(e => {
|
79
|
-
var _a, _b, _c;
|
80
|
-
this.deletingKey = null;
|
81
|
-
console.log('[SETTINGS] Unable to delete API key', e);
|
82
|
-
(_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));
|
83
|
-
VerdocsToast('Unable to delete API key. Please try again later', { style: 'error' });
|
84
|
-
});
|
85
|
-
}
|
86
|
-
async handleRotateKey() {
|
87
|
-
rotateApiKey(this.endpoint, this.rotatingKey.client_id)
|
88
|
-
.then(r => {
|
89
|
-
this.rotatingKey = null;
|
90
|
-
VerdocsToast('API key rotated', { style: 'success' });
|
91
|
-
this.loadKeys();
|
92
|
-
this.createdKey = r;
|
93
|
-
})
|
94
|
-
.catch(e => {
|
95
|
-
var _a, _b, _c;
|
96
|
-
this.rotatingKey = null;
|
97
|
-
console.log('[SETTINGS] Unable to rotate API key', e);
|
98
|
-
(_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));
|
99
|
-
VerdocsToast('Unable to rotate API key. Please try again later', { style: 'error' });
|
100
|
-
});
|
101
|
-
}
|
102
|
-
async handleCreateKey() {
|
103
|
-
// TODO: Add permission dropdown
|
104
|
-
createApiKey(this.endpoint, { permission: 'personal', name: this.newApiKeyName, profile_id: this.newApiKeyProfileId })
|
105
|
-
.then(r => {
|
106
|
-
this.creatingKey = false;
|
107
|
-
this.createdKey = r;
|
108
|
-
VerdocsToast('API key created', { style: 'success' });
|
109
|
-
this.loadKeys();
|
110
|
-
})
|
111
|
-
.catch(e => {
|
112
|
-
var _a, _b, _c;
|
113
|
-
this.creatingKey = false;
|
114
|
-
console.log('[SETTINGS] Unable to create API key', e);
|
115
|
-
(_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));
|
116
|
-
VerdocsToast('Unable to create API key. Please try again later', { style: 'error' });
|
117
|
-
});
|
118
|
-
}
|
119
|
-
render() {
|
120
|
-
var _a, _b, _c, _d;
|
121
|
-
const profileOptions = this.members.map(member => ({ label: formatFullName(member), value: member.id }));
|
122
|
-
if (!this.endpoint.session) {
|
123
|
-
console.log('[SETTINGS] Must be authenticated');
|
124
|
-
return h(Host, { class: "authentication-required" }, "Must be authenticated");
|
125
|
-
}
|
126
|
-
return (h(Host, null, h("verdocs-table", { data: this.keys, columns: [
|
127
|
-
{
|
128
|
-
id: 'name',
|
129
|
-
header: 'Name',
|
130
|
-
renderCell: (_, row) => (h("div", null, h("div", null, row.name))),
|
131
|
-
},
|
132
|
-
{
|
133
|
-
id: 'client_id',
|
134
|
-
header: 'Client ID',
|
135
|
-
renderCell: (_, row) => (h("div", null, h("div", { innerHTML: TagIcon }), h("div", null, row.client_id))),
|
136
|
-
},
|
137
|
-
{
|
138
|
-
id: 'profile_id',
|
139
|
-
header: 'Acts as',
|
140
|
-
renderCell: (_, row) => (h("div", null, h("div", { innerHTML: UserIcon }), h("div", null, formatFullName(row.profile)))),
|
141
|
-
},
|
142
|
-
{
|
143
|
-
id: 'actions',
|
144
|
-
header: 'Actions',
|
145
|
-
renderCell: (_, row) => (h("div", null, h("div", { innerHTML: TrashIcon, onClick: () => (this.deletingKey = row) }), h("div", { innerHTML: ArrowPathIcon, onClick: () => (this.rotatingKey = row) }))),
|
146
|
-
},
|
147
|
-
] }), 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) => {
|
148
|
-
this.newApiKeyName = e.target.value.trim();
|
149
|
-
} }), 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) => {
|
150
|
-
this.newApiKeyProfileId = e.target.value;
|
151
|
-
} }), 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) })))))));
|
152
|
-
}
|
153
|
-
static get style() { return VerdocsSettingsApiKeysStyle0; }
|
154
|
-
}, [0, "verdocs-settings-api-keys", {
|
155
|
-
"endpoint": [16],
|
156
|
-
"keys": [32],
|
157
|
-
"creatingKey": [32],
|
158
|
-
"createdKey": [32],
|
159
|
-
"deletingKey": [32],
|
160
|
-
"rotatingKey": [32],
|
161
|
-
"newApiKeyName": [32],
|
162
|
-
"newApiKeyProfileId": [32],
|
163
|
-
"members": [32]
|
164
|
-
}]);
|
165
|
-
function defineCustomElement() {
|
166
|
-
if (typeof customElements === "undefined") {
|
167
|
-
return;
|
168
|
-
}
|
169
|
-
const components = ["verdocs-settings-api-keys", "verdocs-button", "verdocs-dialog", "verdocs-help-icon", "verdocs-select-input", "verdocs-table", "verdocs-text-input"];
|
170
|
-
components.forEach(tagName => { switch (tagName) {
|
171
|
-
case "verdocs-settings-api-keys":
|
172
|
-
if (!customElements.get(tagName)) {
|
173
|
-
customElements.define(tagName, VerdocsSettingsApiKeys);
|
174
|
-
}
|
175
|
-
break;
|
176
|
-
case "verdocs-button":
|
177
|
-
if (!customElements.get(tagName)) {
|
178
|
-
defineCustomElement$6();
|
179
|
-
}
|
180
|
-
break;
|
181
|
-
case "verdocs-dialog":
|
182
|
-
if (!customElements.get(tagName)) {
|
183
|
-
defineCustomElement$5();
|
184
|
-
}
|
185
|
-
break;
|
186
|
-
case "verdocs-help-icon":
|
187
|
-
if (!customElements.get(tagName)) {
|
188
|
-
defineCustomElement$4();
|
189
|
-
}
|
190
|
-
break;
|
191
|
-
case "verdocs-select-input":
|
192
|
-
if (!customElements.get(tagName)) {
|
193
|
-
defineCustomElement$3();
|
194
|
-
}
|
195
|
-
break;
|
196
|
-
case "verdocs-table":
|
197
|
-
if (!customElements.get(tagName)) {
|
198
|
-
defineCustomElement$2();
|
199
|
-
}
|
200
|
-
break;
|
201
|
-
case "verdocs-text-input":
|
202
|
-
if (!customElements.get(tagName)) {
|
203
|
-
defineCustomElement$1();
|
204
|
-
}
|
205
|
-
break;
|
206
|
-
} });
|
207
|
-
}
|
208
|
-
|
209
|
-
export { VerdocsSettingsApiKeys as V, defineCustomElement as d };
|