@verdocs/web-sdk 2.1.4 → 2.2.1
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/Profiles-244e8254.js +95 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-auth.cjs.entry.js +3 -44
- package/dist/cjs/{verdocs-checkbox_5.cjs.entry.js → verdocs-checkbox_4.cjs.entry.js} +0 -39
- package/dist/cjs/verdocs-help-icon.cjs.entry.js +45 -0
- package/dist/cjs/verdocs-settings-api-keys_4.cjs.entry.js +4546 -0
- package/dist/cjs/verdocs-settings.cjs.entry.js +42 -0
- package/dist/cjs/verdocs-table.cjs.entry.js +27 -0
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/controls/verdocs-table/verdocs-table.css +25 -0
- package/dist/collection/components/controls/verdocs-table/verdocs-table.js +71 -0
- package/dist/collection/components/controls/verdocs-table/verdocs-table.stories.js +25 -0
- package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.css +29 -0
- package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.js +98 -0
- package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.stories.js +10 -0
- package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.css +38 -0
- package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.js +179 -0
- package/dist/collection/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.stories.js +11 -0
- package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.css +38 -0
- package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.js +210 -0
- package/dist/collection/components/settings/verdocs-settings-members/verdocs-settings-members.stories.js +17 -0
- package/dist/collection/components/settings/verdocs-settings-organization/TimeZones.js +144 -0
- package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.css +33 -0
- package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.js +226 -0
- package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.stories.js +13 -0
- package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.css +33 -0
- package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.js +187 -0
- package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.stories.js +13 -0
- package/dist/components/EnvelopeStore.js +1 -1
- package/dist/components/Organizations.js +32 -0
- package/dist/components/Profiles.js +57 -0
- package/dist/components/Strings.js +6 -0
- package/dist/components/TemplateStore.js +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +6 -0
- package/dist/components/index3.js +3979 -168
- package/dist/components/index4.js +194 -0
- package/dist/components/verdocs-auth.js +2 -42
- package/dist/components/verdocs-settings-api-keys.d.ts +11 -0
- package/dist/components/verdocs-settings-api-keys.js +6 -0
- package/dist/components/verdocs-settings-api-keys2.js +108 -0
- package/dist/components/verdocs-settings-members.d.ts +11 -0
- package/dist/components/verdocs-settings-members.js +6 -0
- package/dist/components/verdocs-settings-members2.js +123 -0
- package/dist/components/verdocs-settings-organization.d.ts +11 -0
- package/dist/components/verdocs-settings-organization.js +6 -0
- package/dist/components/verdocs-settings-organization2.js +331 -0
- package/dist/components/verdocs-settings-profile.d.ts +11 -0
- package/dist/components/verdocs-settings-profile.js +6 -0
- package/dist/components/verdocs-settings-profile2.js +142 -0
- package/dist/components/verdocs-settings.d.ts +11 -0
- package/dist/components/verdocs-settings.js +119 -0
- package/dist/components/verdocs-table.d.ts +11 -0
- package/dist/components/verdocs-table.js +6 -0
- package/dist/components/verdocs-table2.js +41 -0
- package/dist/custom-elements.json +1999 -0
- package/dist/docs.json +485 -1
- package/dist/esm/Profiles-7645e6f1.js +88 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-auth.entry.js +1 -42
- package/dist/esm/{verdocs-checkbox_5.entry.js → verdocs-checkbox_4.entry.js} +1 -39
- package/dist/esm/verdocs-help-icon.entry.js +41 -0
- package/dist/esm/verdocs-settings-api-keys_4.entry.js +4539 -0
- package/dist/esm/verdocs-settings.entry.js +38 -0
- package/dist/esm/verdocs-table.entry.js +23 -0
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/Profiles-7645e6f1.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-auth.entry.js +1 -1
- package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -0
- package/dist/esm-es5/verdocs-help-icon.entry.js +1 -0
- package/dist/esm-es5/verdocs-settings-api-keys_4.entry.js +1 -0
- package/dist/esm-es5/verdocs-settings.entry.js +1 -0
- package/dist/esm-es5/verdocs-table.entry.js +1 -0
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/controls/verdocs-table/verdocs-table.d.ts +21 -0
- package/dist/types/components/controls/verdocs-table/verdocs-table.stories.d.ts +7 -0
- package/dist/types/components/embeds/verdocs-settings/verdocs-settings.d.ts +22 -0
- package/dist/types/components/embeds/verdocs-settings/verdocs-settings.stories.d.ts +4 -0
- package/dist/types/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.d.ts +44 -0
- package/dist/types/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys.stories.d.ts +4 -0
- package/dist/types/components/settings/verdocs-settings-members/verdocs-settings-members.d.ts +43 -0
- package/dist/types/components/settings/verdocs-settings-members/verdocs-settings-members.stories.d.ts +8 -0
- package/dist/types/components/settings/verdocs-settings-organization/TimeZones.d.ts +1 -0
- package/dist/types/components/settings/verdocs-settings-organization/verdocs-settings-organization.d.ts +42 -0
- package/dist/types/components/settings/verdocs-settings-organization/verdocs-settings-organization.stories.d.ts +6 -0
- package/dist/types/components/settings/verdocs-settings-profile/verdocs-settings-profile.d.ts +38 -0
- package/dist/types/components/settings/verdocs-settings-profile/verdocs-settings-profile.stories.d.ts +6 -0
- package/dist/types/components.d.ts +208 -0
- package/dist/verdocs-web-sdk/p-075dc36d.js +1 -0
- package/dist/verdocs-web-sdk/p-144d4ed1.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-268a29a9.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-40361f22.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-647cdb84.system.js +1 -1
- package/dist/verdocs-web-sdk/p-7213a107.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-84f9fe5d.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-ab26744f.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-cbebc039.system.js +1 -0
- package/dist/verdocs-web-sdk/p-d309ef6f.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-db4cfbfe.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-df90b36d.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-e248947e.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-e9d2b68a.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-febebe69.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +3 -2
- package/dist/esm-es5/verdocs-checkbox_5.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-25916fc3.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-300a240d.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-5e5eb075.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-b75d3b7f.system.entry.js +0 -1
@@ -0,0 +1,226 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { VerdocsEndpoint } from '@verdocs/js-sdk';
|
3
|
+
import { Organizations } from '@verdocs/js-sdk/Organizations';
|
4
|
+
import { h, Host } from '@stencil/core';
|
5
|
+
import { convertToE164 } from '../../../utils/utils';
|
6
|
+
import { VerdocsToast } from '../../../utils/Toast';
|
7
|
+
import { TimeZones } from './TimeZones';
|
8
|
+
const timeZoneOptions = TimeZones.map(tz => ({ value: tz[2], label: tz[2] }));
|
9
|
+
const schema = z.object({
|
10
|
+
name: z.string().trim().min(1, 'Name is required').max(30),
|
11
|
+
business_name: z.string().trim().max(30).optional(),
|
12
|
+
contact_email: z.string().trim().email('Invalid email').optional().or(z.literal('')),
|
13
|
+
phone: z.preprocess(val => convertToE164(String(val).trim()), z.string().optional()),
|
14
|
+
address: z.string().trim().max(30).optional(),
|
15
|
+
address2: z.string().trim().max(30).optional(),
|
16
|
+
timezone: z.string().trim().optional(),
|
17
|
+
url: z.string().trim().optional(),
|
18
|
+
});
|
19
|
+
/**
|
20
|
+
* Displays a settings form that allows the user to manage their Verdocs profile.
|
21
|
+
*/
|
22
|
+
export class VerdocsSettingsOrganization {
|
23
|
+
constructor() {
|
24
|
+
this.endpoint = VerdocsEndpoint.getDefault();
|
25
|
+
this.valid = false;
|
26
|
+
this.dirty = false;
|
27
|
+
this.submitting = false;
|
28
|
+
this.name = '';
|
29
|
+
this.business_name = '';
|
30
|
+
this.contact_email = '';
|
31
|
+
this.phone = '';
|
32
|
+
this.address = '';
|
33
|
+
this.address2 = '';
|
34
|
+
this.timezone = '';
|
35
|
+
this.url = '';
|
36
|
+
}
|
37
|
+
componentWillLoad() {
|
38
|
+
this.endpoint.loadSession();
|
39
|
+
if (!this.endpoint.session) {
|
40
|
+
console.log('[SETTINGS] Must be authenticated');
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
async componentDidLoad() {
|
45
|
+
const organization = await Organizations.getOrganization(this.endpoint, this.endpoint.session.organization_id);
|
46
|
+
console.log('[SETTINGS] Loaded organization', organization);
|
47
|
+
this.resetForm(organization);
|
48
|
+
}
|
49
|
+
resetForm(organization) {
|
50
|
+
this.name = organization.name;
|
51
|
+
this.business_name = organization.business_name;
|
52
|
+
this.contact_email = organization.contact_email;
|
53
|
+
this.phone = organization.phone;
|
54
|
+
this.address = organization.address;
|
55
|
+
this.address2 = organization.address2;
|
56
|
+
this.timezone = organization.timezone;
|
57
|
+
this.url = organization.url;
|
58
|
+
this.dirty = false;
|
59
|
+
this.valid = true;
|
60
|
+
}
|
61
|
+
handleSubmit(e) {
|
62
|
+
e.preventDefault();
|
63
|
+
e.stopPropagation();
|
64
|
+
Organizations.updateOrganization(VerdocsEndpoint.getDefault(), this.endpoint.session.organization_id, {
|
65
|
+
name: this.name,
|
66
|
+
business_name: this.business_name,
|
67
|
+
contact_email: this.contact_email,
|
68
|
+
phone: this.phone,
|
69
|
+
address: this.address,
|
70
|
+
address2: this.address2,
|
71
|
+
timezone: this.timezone,
|
72
|
+
url: this.url,
|
73
|
+
})
|
74
|
+
.then(newOrganization => {
|
75
|
+
var _a;
|
76
|
+
console.log('[SETTINGS] Update result', newOrganization);
|
77
|
+
(_a = this.organizationUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, organization: newOrganization });
|
78
|
+
this.resetForm(newOrganization);
|
79
|
+
})
|
80
|
+
.catch(e => VerdocsToast(`Error updating organization: ${e.message}`, { style: 'error' }));
|
81
|
+
}
|
82
|
+
processFields() {
|
83
|
+
const validation = schema.safeParse({
|
84
|
+
name: this.name,
|
85
|
+
business_name: this.business_name,
|
86
|
+
contact_email: this.contact_email,
|
87
|
+
phone: this.phone,
|
88
|
+
address: this.address,
|
89
|
+
address2: this.address2,
|
90
|
+
timezone: this.timezone,
|
91
|
+
url: this.url,
|
92
|
+
});
|
93
|
+
console.log('[SETTINGS] Validation result', validation);
|
94
|
+
this.valid = validation.success;
|
95
|
+
this.dirty = true;
|
96
|
+
}
|
97
|
+
render() {
|
98
|
+
if (!this.endpoint.session) {
|
99
|
+
console.log('[SETTINGS] Must be authenticated');
|
100
|
+
return h(Host, { class: "authentication-required" }, "Must be authenticated");
|
101
|
+
}
|
102
|
+
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: true, placeholder: "Enter your organization's name...", onInput: (e) => (this.name = e.target.value), onFocusout: (e) => {
|
103
|
+
this.name = e.target.value.trim();
|
104
|
+
this.processFields();
|
105
|
+
} }), h("verdocs-text-input", { id: "verdocs-organization-business-name", value: this.business_name, autocomplete: "off", label: "d/b/a", placeholder: "Enter your d/b/a, if any...", onInput: (e) => (this.business_name = e.target.value), onFocusout: (e) => {
|
106
|
+
this.business_name = e.target.value.trim();
|
107
|
+
this.processFields();
|
108
|
+
} }), 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) => {
|
109
|
+
this.url = e.target.value.trim();
|
110
|
+
this.processFields();
|
111
|
+
} }), 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) => {
|
112
|
+
this.phone = e.target.value.trim();
|
113
|
+
this.processFields();
|
114
|
+
} })), h("div", { class: "column" }, h("verdocs-text-input", { id: "verdocs-organization-address", value: this.address, autocomplete: "off", label: "Address", required: true, placeholder: "Enter your address...", onInput: (e) => (this.address = e.target.value), onFocusout: (e) => {
|
115
|
+
this.address = e.target.value.trim();
|
116
|
+
this.processFields();
|
117
|
+
} }), h("verdocs-text-input", { id: "verdocs-organization-address", value: this.address2, autocomplete: "off", label: "Address 2", required: true, placeholder: "Address line 2...", onInput: (e) => (this.address2 = e.target.value), onFocusout: (e) => {
|
118
|
+
this.address2 = e.target.value.trim();
|
119
|
+
this.processFields();
|
120
|
+
} }), h("verdocs-text-input", { id: "verdocs-organization-address2", value: this.address2, clearable: true, autocomplete: "off", label: "Address 2", placeholder: "Enter your address...", onInput: (e) => (this.address2 = e.target.value), onFocusout: (e) => {
|
121
|
+
this.address2 = e.target.value.trim();
|
122
|
+
this.processFields();
|
123
|
+
} }), 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) => {
|
124
|
+
this.contact_email = e.target.value.trim();
|
125
|
+
this.processFields();
|
126
|
+
} }), h("verdocs-select-input", { options: timeZoneOptions, value: this.timezone, label: "Time Zone" }))), h("verdocs-button", { type: "submit", label: "Save", size: "normal", disabled: this.submitting || !this.dirty }))));
|
127
|
+
}
|
128
|
+
static get is() { return "verdocs-settings-organization"; }
|
129
|
+
static get originalStyleUrls() {
|
130
|
+
return {
|
131
|
+
"$": ["verdocs-settings-organization.scss"]
|
132
|
+
};
|
133
|
+
}
|
134
|
+
static get styleUrls() {
|
135
|
+
return {
|
136
|
+
"$": ["verdocs-settings-organization.css"]
|
137
|
+
};
|
138
|
+
}
|
139
|
+
static get properties() {
|
140
|
+
return {
|
141
|
+
"endpoint": {
|
142
|
+
"type": "unknown",
|
143
|
+
"mutable": false,
|
144
|
+
"complexType": {
|
145
|
+
"original": "VerdocsEndpoint",
|
146
|
+
"resolved": "VerdocsEndpoint",
|
147
|
+
"references": {
|
148
|
+
"VerdocsEndpoint": {
|
149
|
+
"location": "import",
|
150
|
+
"path": "@verdocs/js-sdk"
|
151
|
+
}
|
152
|
+
}
|
153
|
+
},
|
154
|
+
"required": false,
|
155
|
+
"optional": false,
|
156
|
+
"docs": {
|
157
|
+
"tags": [],
|
158
|
+
"text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
|
159
|
+
},
|
160
|
+
"defaultValue": "VerdocsEndpoint.getDefault()"
|
161
|
+
}
|
162
|
+
};
|
163
|
+
}
|
164
|
+
static get states() {
|
165
|
+
return {
|
166
|
+
"valid": {},
|
167
|
+
"dirty": {},
|
168
|
+
"submitting": {},
|
169
|
+
"name": {},
|
170
|
+
"business_name": {},
|
171
|
+
"contact_email": {},
|
172
|
+
"phone": {},
|
173
|
+
"address": {},
|
174
|
+
"address2": {},
|
175
|
+
"timezone": {},
|
176
|
+
"url": {}
|
177
|
+
};
|
178
|
+
}
|
179
|
+
static get events() {
|
180
|
+
return [{
|
181
|
+
"method": "sdkError",
|
182
|
+
"name": "sdkError",
|
183
|
+
"bubbles": true,
|
184
|
+
"cancelable": true,
|
185
|
+
"composed": true,
|
186
|
+
"docs": {
|
187
|
+
"tags": [],
|
188
|
+
"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."
|
189
|
+
},
|
190
|
+
"complexType": {
|
191
|
+
"original": "SDKError",
|
192
|
+
"resolved": "SDKError",
|
193
|
+
"references": {
|
194
|
+
"SDKError": {
|
195
|
+
"location": "import",
|
196
|
+
"path": "../../../utils/errors"
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}, {
|
201
|
+
"method": "organizationUpdated",
|
202
|
+
"name": "organizationUpdated",
|
203
|
+
"bubbles": true,
|
204
|
+
"cancelable": true,
|
205
|
+
"composed": true,
|
206
|
+
"docs": {
|
207
|
+
"tags": [],
|
208
|
+
"text": "Event fired when the user chooses the Edit option from the dropdown menu."
|
209
|
+
},
|
210
|
+
"complexType": {
|
211
|
+
"original": "{endpoint: VerdocsEndpoint; organization: IOrganization}",
|
212
|
+
"resolved": "{ endpoint: VerdocsEndpoint; organization: IOrganization; }",
|
213
|
+
"references": {
|
214
|
+
"VerdocsEndpoint": {
|
215
|
+
"location": "import",
|
216
|
+
"path": "@verdocs/js-sdk"
|
217
|
+
},
|
218
|
+
"IOrganization": {
|
219
|
+
"location": "import",
|
220
|
+
"path": "@verdocs/js-sdk/Organizations/Types"
|
221
|
+
}
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}];
|
225
|
+
}
|
226
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { html } from 'lit-html';
|
2
|
+
export default {
|
3
|
+
title: 'Settings/Organization',
|
4
|
+
component: 'verdocs-settings-organization',
|
5
|
+
args: {},
|
6
|
+
argTypes: {
|
7
|
+
onOrganizationUpdated: { action: 'organizationUpdated' },
|
8
|
+
},
|
9
|
+
parameters: {
|
10
|
+
layout: 'fullscreen',
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const Organization = ({ onOrganizationUpdated }) => html ` <verdocs-settings-organization @organizationUpdated=${onOrganizationUpdated} /> `;
|
package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.css
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
verdocs-settings-profile {
|
2
|
+
display: flex;
|
3
|
+
padding: 10px;
|
4
|
+
font-size: 18px;
|
5
|
+
flex-wrap: nowrap;
|
6
|
+
border-radius: 6px;
|
7
|
+
color: #33364b;
|
8
|
+
flex-direction: column;
|
9
|
+
font-family: "Inter", "Barlow", sans-serif;
|
10
|
+
}
|
11
|
+
verdocs-settings-profile .columns {
|
12
|
+
gap: 20px;
|
13
|
+
display: flex;
|
14
|
+
flex-wrap: wrap;
|
15
|
+
flex-direction: row;
|
16
|
+
}
|
17
|
+
verdocs-settings-profile .column {
|
18
|
+
flex: 1;
|
19
|
+
display: flex;
|
20
|
+
flex-direction: column;
|
21
|
+
}
|
22
|
+
verdocs-settings-profile verdocs-text-input {
|
23
|
+
margin: 10px 0;
|
24
|
+
}
|
25
|
+
verdocs-settings-profile verdocs-text-input input {
|
26
|
+
height: 32px;
|
27
|
+
}
|
28
|
+
@media screen and (max-width: 600px) {
|
29
|
+
verdocs-settings-profile .columns {
|
30
|
+
gap: 0;
|
31
|
+
flex-direction: column;
|
32
|
+
}
|
33
|
+
}
|
package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.js
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { Profiles } from '@verdocs/js-sdk/Users';
|
3
|
+
import { VerdocsEndpoint } from '@verdocs/js-sdk';
|
4
|
+
import { h, Host } from '@stencil/core';
|
5
|
+
import { convertToE164 } from '../../../utils/utils';
|
6
|
+
import { VerdocsToast } from '../../../utils/Toast';
|
7
|
+
const schema = z.object({
|
8
|
+
first_name: z.string().trim().min(1, 'First name is required').max(30),
|
9
|
+
last_name: z.string().trim().min(1, 'Last name is required').max(30),
|
10
|
+
email: z.string().trim().email('Invalid email').min(1, 'Email is required'),
|
11
|
+
phone: z.preprocess(val => convertToE164(String(val).trim()), z.string()),
|
12
|
+
});
|
13
|
+
/**
|
14
|
+
* Displays a settings form that allows the user to manage their Verdocs profile.
|
15
|
+
*/
|
16
|
+
export class VerdocsSettingsProfile {
|
17
|
+
constructor() {
|
18
|
+
this.endpoint = VerdocsEndpoint.getDefault();
|
19
|
+
this.valid = false;
|
20
|
+
this.dirty = false;
|
21
|
+
this.submitting = false;
|
22
|
+
this.first_name = '';
|
23
|
+
this.last_name = '';
|
24
|
+
this.email = '';
|
25
|
+
this.phone = '';
|
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 profile = await Profiles.getCurrentProfile(this.endpoint);
|
36
|
+
console.log('[SETTINGS] Loaded profile', profile);
|
37
|
+
this.resetForm(profile);
|
38
|
+
}
|
39
|
+
resetForm(profile) {
|
40
|
+
this.first_name = profile.first_name;
|
41
|
+
this.last_name = profile.last_name;
|
42
|
+
this.email = profile.email;
|
43
|
+
this.phone = profile.phone;
|
44
|
+
this.dirty = false;
|
45
|
+
this.valid = true;
|
46
|
+
}
|
47
|
+
handleSubmit(e) {
|
48
|
+
e.preventDefault();
|
49
|
+
e.stopPropagation();
|
50
|
+
Profiles.updateProfile(VerdocsEndpoint.getDefault(), this.endpoint.session.profile_id, {
|
51
|
+
first_name: this.first_name,
|
52
|
+
last_name: this.last_name,
|
53
|
+
phone: this.phone,
|
54
|
+
})
|
55
|
+
.then(newProfile => {
|
56
|
+
var _a;
|
57
|
+
console.log('[SETTINGS] Update result', newProfile);
|
58
|
+
(_a = this.profileUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, profile: newProfile });
|
59
|
+
this.resetForm(newProfile);
|
60
|
+
})
|
61
|
+
.catch(e => VerdocsToast(`Error updating profile: ${e.message}`, { style: 'error' }));
|
62
|
+
}
|
63
|
+
processFields() {
|
64
|
+
const validation = schema.safeParse({
|
65
|
+
first_name: this.first_name,
|
66
|
+
last_name: this.last_name,
|
67
|
+
email: this.email,
|
68
|
+
phone: this.phone,
|
69
|
+
});
|
70
|
+
console.log('[SETTINGS] Validation result', validation);
|
71
|
+
this.valid = validation.success;
|
72
|
+
this.dirty = true;
|
73
|
+
}
|
74
|
+
render() {
|
75
|
+
if (!this.endpoint.session) {
|
76
|
+
console.log('[SETTINGS] Must be authenticated');
|
77
|
+
return h(Host, { class: "authentication-required" }, "Must be authenticated");
|
78
|
+
}
|
79
|
+
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) => {
|
80
|
+
this.first_name = e.target.value.trim();
|
81
|
+
this.processFields();
|
82
|
+
} }), 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) => {
|
83
|
+
this.last_name = e.target.value.trim();
|
84
|
+
this.processFields();
|
85
|
+
} })), 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) => {
|
86
|
+
this.email = e.target.value.trim();
|
87
|
+
this.processFields();
|
88
|
+
} }), 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) => {
|
89
|
+
this.phone = e.target.value.trim();
|
90
|
+
this.processFields();
|
91
|
+
} }))), h("verdocs-button", { type: "submit", label: "Save", size: "normal", disabled: this.submitting || !this.dirty }))));
|
92
|
+
}
|
93
|
+
static get is() { return "verdocs-settings-profile"; }
|
94
|
+
static get originalStyleUrls() {
|
95
|
+
return {
|
96
|
+
"$": ["verdocs-settings-profile.scss"]
|
97
|
+
};
|
98
|
+
}
|
99
|
+
static get styleUrls() {
|
100
|
+
return {
|
101
|
+
"$": ["verdocs-settings-profile.css"]
|
102
|
+
};
|
103
|
+
}
|
104
|
+
static get properties() {
|
105
|
+
return {
|
106
|
+
"endpoint": {
|
107
|
+
"type": "unknown",
|
108
|
+
"mutable": false,
|
109
|
+
"complexType": {
|
110
|
+
"original": "VerdocsEndpoint",
|
111
|
+
"resolved": "VerdocsEndpoint",
|
112
|
+
"references": {
|
113
|
+
"VerdocsEndpoint": {
|
114
|
+
"location": "import",
|
115
|
+
"path": "@verdocs/js-sdk"
|
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
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}, {
|
162
|
+
"method": "profileUpdated",
|
163
|
+
"name": "profileUpdated",
|
164
|
+
"bubbles": true,
|
165
|
+
"cancelable": true,
|
166
|
+
"composed": true,
|
167
|
+
"docs": {
|
168
|
+
"tags": [],
|
169
|
+
"text": "Event fired when the user chooses the Edit option from the dropdown menu."
|
170
|
+
},
|
171
|
+
"complexType": {
|
172
|
+
"original": "{endpoint: VerdocsEndpoint; profile: IProfile}",
|
173
|
+
"resolved": "{ endpoint: VerdocsEndpoint; profile: IProfile; }",
|
174
|
+
"references": {
|
175
|
+
"VerdocsEndpoint": {
|
176
|
+
"location": "import",
|
177
|
+
"path": "@verdocs/js-sdk"
|
178
|
+
},
|
179
|
+
"IProfile": {
|
180
|
+
"location": "import",
|
181
|
+
"path": "@verdocs/js-sdk/Users/Types"
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}];
|
186
|
+
}
|
187
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { html } from 'lit-html';
|
2
|
+
export default {
|
3
|
+
title: 'Settings/Profile',
|
4
|
+
component: 'verdocs-settings-profile',
|
5
|
+
args: {},
|
6
|
+
argTypes: {
|
7
|
+
onProfileUpdated: { action: 'profileUpdated' },
|
8
|
+
},
|
9
|
+
parameters: {
|
10
|
+
layout: 'fullscreen',
|
11
|
+
},
|
12
|
+
};
|
13
|
+
export const Profile = ({ onProfileUpdated }) => html ` <verdocs-settings-profile @profileUpdated=${onProfileUpdated} /> `;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
* An Organization is the top level object for ownership for Members, Documents, and Templates.
|
3
|
+
*
|
4
|
+
* @module
|
5
|
+
*/
|
6
|
+
/**
|
7
|
+
* Get an organization by ID.
|
8
|
+
*/
|
9
|
+
var getOrganization = function (endpoint, organizationId) {
|
10
|
+
return endpoint.api //
|
11
|
+
.get("/organizations/".concat(organizationId))
|
12
|
+
.then(function (r) { return r.data; });
|
13
|
+
};
|
14
|
+
/**
|
15
|
+
* Update an organization.
|
16
|
+
*/
|
17
|
+
var updateOrganization = function (endpoint, organizationId, params) {
|
18
|
+
return endpoint.api //
|
19
|
+
.patch("/organizations/".concat(organizationId), params)
|
20
|
+
.then(function (r) { return r.data; });
|
21
|
+
};
|
22
|
+
/**
|
23
|
+
* Check if an organization name is available. Typically used during the sign-up process. This endpoint is rate-limited
|
24
|
+
* to prevent abuse. Developers experiencing problems with testing new applications should contact support.
|
25
|
+
*/
|
26
|
+
var isOrgAvailable = function (endpoint, name) {
|
27
|
+
return endpoint.api //
|
28
|
+
.post('/organizations/check-availability', { name: name }, { baseURL: endpoint.getBaseURLv2() })
|
29
|
+
.then(function (r) { return r.data; });
|
30
|
+
};
|
31
|
+
|
32
|
+
export { getOrganization as g, isOrgAvailable as i, updateOrganization as u };
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/**
|
2
|
+
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
3
|
+
*
|
4
|
+
* ```typescript
|
5
|
+
* import {Profiles} from '@verdocs/js-sdk/Users';
|
6
|
+
*
|
7
|
+
* const profiles = await Profiles.getProfiles()
|
8
|
+
* ```
|
9
|
+
*/
|
10
|
+
/**
|
11
|
+
* Get the user's available profiles. The current profile will be marked with `current: true`.
|
12
|
+
*
|
13
|
+
* ```typescript
|
14
|
+
* import {Profiles} from '@verdocs/js-sdk/Users';
|
15
|
+
*
|
16
|
+
* const profiles = await Profiles.getCurrentProfile()
|
17
|
+
* ```
|
18
|
+
*/
|
19
|
+
var getCurrentProfile = function (endpoint) {
|
20
|
+
return endpoint.api //
|
21
|
+
.get('/profiles')
|
22
|
+
.then(function (r) { return (r.data || []).find(function (profile) { return profile.current; }); });
|
23
|
+
};
|
24
|
+
/**
|
25
|
+
* Update a profile. For future expansion, the profile ID to update is required, but currently this must also be the
|
26
|
+
* "current" profile for the caller.
|
27
|
+
*
|
28
|
+
* ```typescript
|
29
|
+
* import {Profiles} from '@verdocs/js-sdk/Users';
|
30
|
+
*
|
31
|
+
* const newProfile = await Profiles.updateProfile('PROFILEID');
|
32
|
+
* ```
|
33
|
+
*/
|
34
|
+
var updateProfile = function (endpoint, profileId, params) {
|
35
|
+
return endpoint.api //
|
36
|
+
.put("/profiles/".concat(profileId), params)
|
37
|
+
.then(function (r) { return r.data; });
|
38
|
+
};
|
39
|
+
/**
|
40
|
+
* Create a user account and parent organization. This endpoint is for creating a new organization. Users joining an
|
41
|
+
* existing organization should be invited, and follow their invitation links/instructions to create their accounts.
|
42
|
+
*
|
43
|
+
* ```typescript
|
44
|
+
* import {Profiles} from '@verdocs/js-sdk/Users';
|
45
|
+
*
|
46
|
+
* const newAccount = await Profiles.createBusinessAccount({
|
47
|
+
* orgName: 'ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
|
48
|
+
* });
|
49
|
+
* ```
|
50
|
+
*/
|
51
|
+
var createBusinessAccount = function (endpoint, params) {
|
52
|
+
return endpoint.api //
|
53
|
+
.post('/user/business', params)
|
54
|
+
.then(function (r) { return r.data; });
|
55
|
+
};
|
56
|
+
|
57
|
+
export { createBusinessAccount as c, getCurrentProfile as g, updateProfile as u };
|
@@ -45,10 +45,16 @@ export { VerdocsSearchBox as VerdocsSearchBox } from '../types/components/elemen
|
|
45
45
|
export { VerdocsSearchTabs as VerdocsSearchTabs } from '../types/components/elements/verdocs-search-tabs/verdocs-search-tabs';
|
46
46
|
export { VerdocsSelectInput as VerdocsSelectInput } from '../types/components/controls/verdocs-select-input/verdocs-select-input';
|
47
47
|
export { VerdocsSend as VerdocsSend } from '../types/components/embeds/verdocs-send/verdocs-send';
|
48
|
+
export { VerdocsSettings as VerdocsSettings } from '../types/components/embeds/verdocs-settings/verdocs-settings';
|
49
|
+
export { VerdocsSettingsApiKeys as VerdocsSettingsApiKeys } from '../types/components/settings/verdocs-settings-api-keys/verdocs-settings-api-keys';
|
50
|
+
export { VerdocsSettingsMembers as VerdocsSettingsMembers } from '../types/components/settings/verdocs-settings-members/verdocs-settings-members';
|
51
|
+
export { VerdocsSettingsOrganization as VerdocsSettingsOrganization } from '../types/components/settings/verdocs-settings-organization/verdocs-settings-organization';
|
52
|
+
export { VerdocsSettingsProfile as VerdocsSettingsProfile } from '../types/components/settings/verdocs-settings-profile/verdocs-settings-profile';
|
48
53
|
export { VerdocsSign as VerdocsSign } from '../types/components/embeds/verdocs-sign/verdocs-sign';
|
49
54
|
export { VerdocsSignatureDialog as VerdocsSignatureDialog } from '../types/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog';
|
50
55
|
export { VerdocsQuickFilter as VerdocsSpinner } from '../types/components/controls/verdocs-spinner/verdocs-spinner';
|
51
56
|
export { VerdocsStatusIndicator as VerdocsStatusIndicator } from '../types/components/envelopes/verdocs-status-indicator/verdocs-status-indicator';
|
57
|
+
export { VerdocsTable as VerdocsTable } from '../types/components/controls/verdocs-table/verdocs-table';
|
52
58
|
export { VerdocsTemplateAttachments as VerdocsTemplateAttachments } from '../types/components/templates/verdocs-template-attachments/verdocs-template-attachments';
|
53
59
|
export { VerdocsTemplateCard as VerdocsTemplateCard } from '../types/components/templates/verdocs-template-card/verdocs-template-card';
|
54
60
|
export { VerdocsTemplateCreate as VerdocsTemplateCreate } from '../types/components/templates/verdocs-template-create/verdocs-template-create';
|
package/dist/components/index.js
CHANGED
@@ -45,10 +45,16 @@ export { VerdocsSearchBox, defineCustomElement as defineCustomElementVerdocsSear
|
|
45
45
|
export { VerdocsSearchTabs, defineCustomElement as defineCustomElementVerdocsSearchTabs } from './verdocs-search-tabs.js';
|
46
46
|
export { VerdocsSelectInput, defineCustomElement as defineCustomElementVerdocsSelectInput } from './verdocs-select-input.js';
|
47
47
|
export { VerdocsSend, defineCustomElement as defineCustomElementVerdocsSend } from './verdocs-send.js';
|
48
|
+
export { VerdocsSettings, defineCustomElement as defineCustomElementVerdocsSettings } from './verdocs-settings.js';
|
49
|
+
export { VerdocsSettingsApiKeys, defineCustomElement as defineCustomElementVerdocsSettingsApiKeys } from './verdocs-settings-api-keys.js';
|
50
|
+
export { VerdocsSettingsMembers, defineCustomElement as defineCustomElementVerdocsSettingsMembers } from './verdocs-settings-members.js';
|
51
|
+
export { VerdocsSettingsOrganization, defineCustomElement as defineCustomElementVerdocsSettingsOrganization } from './verdocs-settings-organization.js';
|
52
|
+
export { VerdocsSettingsProfile, defineCustomElement as defineCustomElementVerdocsSettingsProfile } from './verdocs-settings-profile.js';
|
48
53
|
export { VerdocsSign, defineCustomElement as defineCustomElementVerdocsSign } from './verdocs-sign.js';
|
49
54
|
export { VerdocsSignatureDialog, defineCustomElement as defineCustomElementVerdocsSignatureDialog } from './verdocs-signature-dialog.js';
|
50
55
|
export { VerdocsSpinner, defineCustomElement as defineCustomElementVerdocsSpinner } from './verdocs-spinner.js';
|
51
56
|
export { VerdocsStatusIndicator, defineCustomElement as defineCustomElementVerdocsStatusIndicator } from './verdocs-status-indicator.js';
|
57
|
+
export { VerdocsTable, defineCustomElement as defineCustomElementVerdocsTable } from './verdocs-table.js';
|
52
58
|
export { VerdocsTemplateAttachments, defineCustomElement as defineCustomElementVerdocsTemplateAttachments } from './verdocs-template-attachments.js';
|
53
59
|
export { VerdocsTemplateCard, defineCustomElement as defineCustomElementVerdocsTemplateCard } from './verdocs-template-card.js';
|
54
60
|
export { VerdocsTemplateCreate, defineCustomElement as defineCustomElementVerdocsTemplateCreate } from './verdocs-template-create.js';
|