@verdocs/web-sdk 2.1.4 → 2.2.0

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 (87) hide show
  1. package/dist/cjs/Profiles-244e8254.js +95 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/verdocs-auth.cjs.entry.js +3 -44
  4. package/dist/cjs/verdocs-button_2.cjs.entry.js +65 -0
  5. package/dist/cjs/{verdocs-checkbox_5.cjs.entry.js → verdocs-checkbox_4.cjs.entry.js} +0 -39
  6. package/dist/cjs/verdocs-settings-organization_2.cjs.entry.js +4383 -0
  7. package/dist/cjs/verdocs-settings.cjs.entry.js +42 -0
  8. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  9. package/dist/collection/collection-manifest.json +3 -0
  10. package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.css +29 -0
  11. package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.js +98 -0
  12. package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.stories.js +10 -0
  13. package/dist/collection/components/settings/verdocs-settings-organization/TimeZones.js +144 -0
  14. package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.css +33 -0
  15. package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.js +226 -0
  16. package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.stories.js +13 -0
  17. package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.css +33 -0
  18. package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.js +187 -0
  19. package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.stories.js +13 -0
  20. package/dist/components/EnvelopeStore.js +1 -1
  21. package/dist/components/Organizations.js +32 -0
  22. package/dist/components/Profiles.js +57 -0
  23. package/dist/components/TemplateStore.js +1 -1
  24. package/dist/components/index.d.ts +3 -0
  25. package/dist/components/index.js +3 -0
  26. package/dist/components/index3.js +3979 -168
  27. package/dist/components/index4.js +194 -0
  28. package/dist/components/verdocs-auth.js +2 -42
  29. package/dist/components/verdocs-settings-organization.d.ts +11 -0
  30. package/dist/components/verdocs-settings-organization.js +6 -0
  31. package/dist/components/verdocs-settings-organization2.js +331 -0
  32. package/dist/components/verdocs-settings-profile.d.ts +11 -0
  33. package/dist/components/verdocs-settings-profile.js +6 -0
  34. package/dist/components/verdocs-settings-profile2.js +142 -0
  35. package/dist/components/verdocs-settings.d.ts +11 -0
  36. package/dist/components/verdocs-settings.js +101 -0
  37. package/dist/custom-elements.json +1975 -0
  38. package/dist/docs.json +234 -1
  39. package/dist/esm/Profiles-7645e6f1.js +88 -0
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/verdocs-auth.entry.js +1 -42
  42. package/dist/esm/verdocs-button_2.entry.js +60 -0
  43. package/dist/esm/{verdocs-checkbox_5.entry.js → verdocs-checkbox_4.entry.js} +1 -39
  44. package/dist/esm/verdocs-settings-organization_2.entry.js +4378 -0
  45. package/dist/esm/verdocs-settings.entry.js +38 -0
  46. package/dist/esm/verdocs-web-sdk.js +1 -1
  47. package/dist/esm-es5/Profiles-7645e6f1.js +1 -0
  48. package/dist/esm-es5/loader.js +1 -1
  49. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  50. package/dist/esm-es5/verdocs-button_2.entry.js +1 -0
  51. package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -0
  52. package/dist/esm-es5/verdocs-settings-organization_2.entry.js +1 -0
  53. package/dist/esm-es5/verdocs-settings.entry.js +1 -0
  54. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  55. package/dist/types/components/embeds/verdocs-settings/verdocs-settings.d.ts +22 -0
  56. package/dist/types/components/embeds/verdocs-settings/verdocs-settings.stories.d.ts +4 -0
  57. package/dist/types/components/settings/verdocs-settings-organization/TimeZones.d.ts +1 -0
  58. package/dist/types/components/settings/verdocs-settings-organization/verdocs-settings-organization.d.ts +42 -0
  59. package/dist/types/components/settings/verdocs-settings-organization/verdocs-settings-organization.stories.d.ts +6 -0
  60. package/dist/types/components/settings/verdocs-settings-profile/verdocs-settings-profile.d.ts +38 -0
  61. package/dist/types/components/settings/verdocs-settings-profile/verdocs-settings-profile.stories.d.ts +6 -0
  62. package/dist/types/components.d.ts +96 -0
  63. package/dist/verdocs-web-sdk/p-075dc36d.js +1 -0
  64. package/dist/verdocs-web-sdk/p-0fecb805.entry.js +1 -0
  65. package/dist/verdocs-web-sdk/p-144d4ed1.system.entry.js +1 -0
  66. package/dist/verdocs-web-sdk/p-229a6849.entry.js +1 -0
  67. package/dist/verdocs-web-sdk/p-40361f22.entry.js +1 -0
  68. package/dist/verdocs-web-sdk/p-4821f318.system.entry.js +1 -0
  69. package/dist/verdocs-web-sdk/p-647cdb84.system.js +1 -1
  70. package/dist/verdocs-web-sdk/p-888adbc2.system.entry.js +1 -0
  71. package/dist/verdocs-web-sdk/p-cbebc039.system.js +1 -0
  72. package/dist/verdocs-web-sdk/p-ce22913a.entry.js +1 -0
  73. package/dist/verdocs-web-sdk/p-de192808.system.entry.js +1 -0
  74. package/dist/verdocs-web-sdk/p-e9d2b68a.entry.js +1 -0
  75. package/dist/verdocs-web-sdk/p-febebe69.system.entry.js +1 -0
  76. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  77. package/package.json +3 -2
  78. package/dist/cjs/verdocs-button.cjs.entry.js +0 -26
  79. package/dist/esm/verdocs-button.entry.js +0 -22
  80. package/dist/esm-es5/verdocs-button.entry.js +0 -1
  81. package/dist/esm-es5/verdocs-checkbox_5.entry.js +0 -1
  82. package/dist/verdocs-web-sdk/p-25916fc3.entry.js +0 -1
  83. package/dist/verdocs-web-sdk/p-300a240d.entry.js +0 -1
  84. package/dist/verdocs-web-sdk/p-5e5eb075.system.entry.js +0 -1
  85. package/dist/verdocs-web-sdk/p-606e0405.entry.js +0 -1
  86. package/dist/verdocs-web-sdk/p-b75d3b7f.system.entry.js +0 -1
  87. package/dist/verdocs-web-sdk/p-fbabbcea.system.entry.js +0 -1
@@ -0,0 +1,142 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { z } from './index3.js';
3
+ import { g as getCurrentProfile, u as updateProfile } from './Profiles.js';
4
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
5
+ import './Types.js';
6
+ import { d as convertToE164 } from './utils.js';
7
+ import { V as VerdocsToast } from './Toast.js';
8
+ import { d as defineCustomElement$3 } from './verdocs-button2.js';
9
+ import { d as defineCustomElement$2 } from './verdocs-help-icon2.js';
10
+ import { d as defineCustomElement$1 } from './verdocs-text-input2.js';
11
+
12
+ const verdocsSettingsProfileCss = "verdocs-settings-profile{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-profile .columns{gap:20px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-settings-profile .column{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-settings-profile verdocs-text-input{margin:10px 0}verdocs-settings-profile verdocs-text-input input{height:32px}@media screen and (max-width: 600px){verdocs-settings-profile .columns{gap:0;-ms-flex-direction:column;flex-direction:column}}";
13
+
14
+ const schema = z.object({
15
+ first_name: z.string().trim().min(1, 'First name is required').max(30),
16
+ last_name: z.string().trim().min(1, 'Last name is required').max(30),
17
+ email: z.string().trim().email('Invalid email').min(1, 'Email is required'),
18
+ phone: z.preprocess(val => convertToE164(String(val).trim()), z.string()),
19
+ });
20
+ const VerdocsSettingsProfile = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
21
+ constructor() {
22
+ super();
23
+ this.__registerHost();
24
+ this.sdkError = createEvent(this, "sdkError", 7);
25
+ this.profileUpdated = createEvent(this, "profileUpdated", 7);
26
+ this.endpoint = VerdocsEndpoint.getDefault();
27
+ this.valid = false;
28
+ this.dirty = false;
29
+ this.submitting = false;
30
+ this.first_name = '';
31
+ this.last_name = '';
32
+ this.email = '';
33
+ this.phone = '';
34
+ }
35
+ componentWillLoad() {
36
+ this.endpoint.loadSession();
37
+ if (!this.endpoint.session) {
38
+ console.log('[SETTINGS] Must be authenticated');
39
+ return;
40
+ }
41
+ }
42
+ async componentDidLoad() {
43
+ const profile = await getCurrentProfile(this.endpoint);
44
+ console.log('[SETTINGS] Loaded profile', profile);
45
+ this.resetForm(profile);
46
+ }
47
+ resetForm(profile) {
48
+ this.first_name = profile.first_name;
49
+ this.last_name = profile.last_name;
50
+ this.email = profile.email;
51
+ this.phone = profile.phone;
52
+ this.dirty = false;
53
+ this.valid = true;
54
+ }
55
+ handleSubmit(e) {
56
+ e.preventDefault();
57
+ e.stopPropagation();
58
+ updateProfile(VerdocsEndpoint.getDefault(), this.endpoint.session.profile_id, {
59
+ first_name: this.first_name,
60
+ last_name: this.last_name,
61
+ phone: this.phone,
62
+ })
63
+ .then(newProfile => {
64
+ var _a;
65
+ console.log('[SETTINGS] Update result', newProfile);
66
+ (_a = this.profileUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, profile: newProfile });
67
+ this.resetForm(newProfile);
68
+ })
69
+ .catch(e => VerdocsToast(`Error updating profile: ${e.message}`, { style: 'error' }));
70
+ }
71
+ processFields() {
72
+ const validation = schema.safeParse({
73
+ first_name: this.first_name,
74
+ last_name: this.last_name,
75
+ email: this.email,
76
+ phone: this.phone,
77
+ });
78
+ console.log('[SETTINGS] Validation result', validation);
79
+ this.valid = validation.success;
80
+ this.dirty = true;
81
+ }
82
+ render() {
83
+ if (!this.endpoint.session) {
84
+ console.log('[SETTINGS] Must be authenticated');
85
+ return h(Host, { class: "authentication-required" }, "Must be authenticated");
86
+ }
87
+ 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) => {
88
+ this.first_name = e.target.value.trim();
89
+ this.processFields();
90
+ } }), 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) => {
91
+ this.last_name = e.target.value.trim();
92
+ this.processFields();
93
+ } })), 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) => {
94
+ this.email = e.target.value.trim();
95
+ this.processFields();
96
+ } }), 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) => {
97
+ this.phone = e.target.value.trim();
98
+ this.processFields();
99
+ } }))), h("verdocs-button", { type: "submit", label: "Save", size: "normal", disabled: this.submitting || !this.dirty }))));
100
+ }
101
+ static get style() { return verdocsSettingsProfileCss; }
102
+ }, [0, "verdocs-settings-profile", {
103
+ "endpoint": [16],
104
+ "valid": [32],
105
+ "dirty": [32],
106
+ "submitting": [32],
107
+ "first_name": [32],
108
+ "last_name": [32],
109
+ "email": [32],
110
+ "phone": [32]
111
+ }]);
112
+ function defineCustomElement() {
113
+ if (typeof customElements === "undefined") {
114
+ return;
115
+ }
116
+ const components = ["verdocs-settings-profile", "verdocs-button", "verdocs-help-icon", "verdocs-text-input"];
117
+ components.forEach(tagName => { switch (tagName) {
118
+ case "verdocs-settings-profile":
119
+ if (!customElements.get(tagName)) {
120
+ customElements.define(tagName, VerdocsSettingsProfile);
121
+ }
122
+ break;
123
+ case "verdocs-button":
124
+ if (!customElements.get(tagName)) {
125
+ defineCustomElement$3();
126
+ }
127
+ break;
128
+ case "verdocs-help-icon":
129
+ if (!customElements.get(tagName)) {
130
+ defineCustomElement$2();
131
+ }
132
+ break;
133
+ case "verdocs-text-input":
134
+ if (!customElements.get(tagName)) {
135
+ defineCustomElement$1();
136
+ }
137
+ break;
138
+ } });
139
+ }
140
+ defineCustomElement();
141
+
142
+ export { VerdocsSettingsProfile as V, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface VerdocsSettings extends Components.VerdocsSettings, HTMLElement {}
4
+ export const VerdocsSettings: {
5
+ prototype: VerdocsSettings;
6
+ new (): VerdocsSettings;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,101 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import './Types.js';
3
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
4
+ import { S as SDKError } from './errors.js';
5
+ import { d as defineCustomElement$8 } from './verdocs-button2.js';
6
+ import { d as defineCustomElement$7 } from './verdocs-help-icon2.js';
7
+ import { d as defineCustomElement$6 } from './verdocs-loader2.js';
8
+ import { d as defineCustomElement$5 } from './verdocs-select-input2.js';
9
+ import { d as defineCustomElement$4 } from './verdocs-settings-organization2.js';
10
+ import { d as defineCustomElement$3 } from './verdocs-settings-profile2.js';
11
+ import { d as defineCustomElement$2 } from './verdocs-text-input2.js';
12
+
13
+ const verdocsSettingsCss = "verdocs-settings{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-settings .tabs{gap:4px;width:100%;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;border-bottom:1px solid #654dcb}verdocs-settings .tabs .tab{cursor:pointer;padding:5px 10px;color:#ffffff;background-color:#777777}verdocs-settings .tabs .tab.active{color:#ffffff;background-color:#654dcb}";
14
+
15
+ const VerdocsSettings$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
16
+ constructor() {
17
+ super();
18
+ this.__registerHost();
19
+ this.sdkError = createEvent(this, "sdkError", 7);
20
+ this.endpoint = VerdocsEndpoint.getDefault();
21
+ this.tab = 'profile';
22
+ }
23
+ async componentWillLoad() {
24
+ var _a, _b, _c;
25
+ try {
26
+ this.endpoint.loadSession();
27
+ if (!this.endpoint.session) {
28
+ console.log('[SETTINGS] Unable to start session, must be authenticated');
29
+ return;
30
+ }
31
+ }
32
+ catch (e) {
33
+ console.log('[SETTINGS] Error with session', e);
34
+ (_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));
35
+ }
36
+ }
37
+ render() {
38
+ if (!this.endpoint.session) {
39
+ return (h(Host, null, h("verdocs-loader", null)));
40
+ }
41
+ return (h(Host, null, h("div", { class: "tabs" }, h("div", { class: `tab ${this.tab === 'profile' ? 'active' : ''}`, onClick: () => (this.tab = 'profile') }, "Profile"), h("div", { class: `tab ${this.tab === 'organization' ? 'active' : ''}`, onClick: () => (this.tab = 'organization') }, "Organization")), this.tab === 'profile' && h("verdocs-settings-profile", { endpoint: this.endpoint }), this.tab === 'organization' && h("verdocs-settings-organization", { endpoint: this.endpoint })));
42
+ }
43
+ static get style() { return verdocsSettingsCss; }
44
+ }, [0, "verdocs-settings", {
45
+ "endpoint": [16],
46
+ "tab": [32]
47
+ }]);
48
+ function defineCustomElement$1() {
49
+ if (typeof customElements === "undefined") {
50
+ return;
51
+ }
52
+ const components = ["verdocs-settings", "verdocs-button", "verdocs-help-icon", "verdocs-loader", "verdocs-select-input", "verdocs-settings-organization", "verdocs-settings-profile", "verdocs-text-input"];
53
+ components.forEach(tagName => { switch (tagName) {
54
+ case "verdocs-settings":
55
+ if (!customElements.get(tagName)) {
56
+ customElements.define(tagName, VerdocsSettings$1);
57
+ }
58
+ break;
59
+ case "verdocs-button":
60
+ if (!customElements.get(tagName)) {
61
+ defineCustomElement$8();
62
+ }
63
+ break;
64
+ case "verdocs-help-icon":
65
+ if (!customElements.get(tagName)) {
66
+ defineCustomElement$7();
67
+ }
68
+ break;
69
+ case "verdocs-loader":
70
+ if (!customElements.get(tagName)) {
71
+ defineCustomElement$6();
72
+ }
73
+ break;
74
+ case "verdocs-select-input":
75
+ if (!customElements.get(tagName)) {
76
+ defineCustomElement$5();
77
+ }
78
+ break;
79
+ case "verdocs-settings-organization":
80
+ if (!customElements.get(tagName)) {
81
+ defineCustomElement$4();
82
+ }
83
+ break;
84
+ case "verdocs-settings-profile":
85
+ if (!customElements.get(tagName)) {
86
+ defineCustomElement$3();
87
+ }
88
+ break;
89
+ case "verdocs-text-input":
90
+ if (!customElements.get(tagName)) {
91
+ defineCustomElement$2();
92
+ }
93
+ break;
94
+ } });
95
+ }
96
+ defineCustomElement$1();
97
+
98
+ const VerdocsSettings = VerdocsSettings$1;
99
+ const defineCustomElement = defineCustomElement$1;
100
+
101
+ export { VerdocsSettings, defineCustomElement };