@verdocs/web-sdk 2.1.2 → 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 (95) 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 +27 -54
  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 -38
  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/controls/verdocs-help-icon/verdocs-help-icon.css +0 -3
  11. package/dist/collection/components/controls/verdocs-help-icon/verdocs-help-icon.js +24 -5
  12. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.css +7 -0
  13. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +26 -11
  14. package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.css +29 -0
  15. package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.js +98 -0
  16. package/dist/collection/components/embeds/verdocs-settings/verdocs-settings.stories.js +10 -0
  17. package/dist/collection/components/settings/verdocs-settings-organization/TimeZones.js +144 -0
  18. package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.css +33 -0
  19. package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.js +226 -0
  20. package/dist/collection/components/settings/verdocs-settings-organization/verdocs-settings-organization.stories.js +13 -0
  21. package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.css +33 -0
  22. package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.js +187 -0
  23. package/dist/collection/components/settings/verdocs-settings-profile/verdocs-settings-profile.stories.js +13 -0
  24. package/dist/components/EnvelopeStore.js +1 -1
  25. package/dist/components/Organizations.js +32 -0
  26. package/dist/components/Profiles.js +57 -0
  27. package/dist/components/TemplateStore.js +1 -1
  28. package/dist/components/index.d.ts +3 -0
  29. package/dist/components/index.js +3 -0
  30. package/dist/components/index3.js +3979 -168
  31. package/dist/components/index4.js +194 -0
  32. package/dist/components/verdocs-auth.js +41 -60
  33. package/dist/components/verdocs-help-icon2.js +8 -6
  34. package/dist/components/verdocs-settings-organization.d.ts +11 -0
  35. package/dist/components/verdocs-settings-organization.js +6 -0
  36. package/dist/components/verdocs-settings-organization2.js +331 -0
  37. package/dist/components/verdocs-settings-profile.d.ts +11 -0
  38. package/dist/components/verdocs-settings-profile.js +6 -0
  39. package/dist/components/verdocs-settings-profile2.js +142 -0
  40. package/dist/components/verdocs-settings.d.ts +11 -0
  41. package/dist/components/verdocs-settings.js +101 -0
  42. package/dist/custom-elements.json +1975 -0
  43. package/dist/docs.json +263 -1
  44. package/dist/esm/Profiles-7645e6f1.js +88 -0
  45. package/dist/esm/loader.js +1 -1
  46. package/dist/esm/verdocs-auth.entry.js +26 -53
  47. package/dist/esm/verdocs-button_2.entry.js +60 -0
  48. package/dist/esm/{verdocs-checkbox_5.entry.js → verdocs-checkbox_4.entry.js} +1 -38
  49. package/dist/esm/verdocs-settings-organization_2.entry.js +4378 -0
  50. package/dist/esm/verdocs-settings.entry.js +38 -0
  51. package/dist/esm/verdocs-web-sdk.js +1 -1
  52. package/dist/esm-es5/Profiles-7645e6f1.js +1 -0
  53. package/dist/esm-es5/loader.js +1 -1
  54. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  55. package/dist/esm-es5/verdocs-button_2.entry.js +1 -0
  56. package/dist/esm-es5/verdocs-checkbox_4.entry.js +1 -0
  57. package/dist/esm-es5/verdocs-settings-organization_2.entry.js +1 -0
  58. package/dist/esm-es5/verdocs-settings.entry.js +1 -0
  59. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  60. package/dist/types/components/controls/verdocs-help-icon/verdocs-help-icon.d.ts +6 -2
  61. package/dist/types/components/embeds/verdocs-auth/verdocs-auth.d.ts +2 -1
  62. package/dist/types/components/embeds/verdocs-settings/verdocs-settings.d.ts +22 -0
  63. package/dist/types/components/embeds/verdocs-settings/verdocs-settings.stories.d.ts +4 -0
  64. package/dist/types/components/settings/verdocs-settings-organization/TimeZones.d.ts +1 -0
  65. package/dist/types/components/settings/verdocs-settings-organization/verdocs-settings-organization.d.ts +42 -0
  66. package/dist/types/components/settings/verdocs-settings-organization/verdocs-settings-organization.stories.d.ts +6 -0
  67. package/dist/types/components/settings/verdocs-settings-profile/verdocs-settings-profile.d.ts +38 -0
  68. package/dist/types/components/settings/verdocs-settings-profile/verdocs-settings-profile.stories.d.ts +6 -0
  69. package/dist/types/components.d.ts +104 -0
  70. package/dist/types/utils/utils.d.ts +1 -1
  71. package/dist/verdocs-web-sdk/p-075dc36d.js +1 -0
  72. package/dist/verdocs-web-sdk/p-0fecb805.entry.js +1 -0
  73. package/dist/verdocs-web-sdk/p-144d4ed1.system.entry.js +1 -0
  74. package/dist/verdocs-web-sdk/p-229a6849.entry.js +1 -0
  75. package/dist/verdocs-web-sdk/p-40361f22.entry.js +1 -0
  76. package/dist/verdocs-web-sdk/p-4821f318.system.entry.js +1 -0
  77. package/dist/verdocs-web-sdk/p-647cdb84.system.js +1 -1
  78. package/dist/verdocs-web-sdk/p-888adbc2.system.entry.js +1 -0
  79. package/dist/verdocs-web-sdk/p-cbebc039.system.js +1 -0
  80. package/dist/verdocs-web-sdk/p-ce22913a.entry.js +1 -0
  81. package/dist/verdocs-web-sdk/p-de192808.system.entry.js +1 -0
  82. package/dist/verdocs-web-sdk/p-e9d2b68a.entry.js +1 -0
  83. package/dist/verdocs-web-sdk/p-febebe69.system.entry.js +1 -0
  84. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  85. package/package.json +4 -3
  86. package/dist/cjs/verdocs-button.cjs.entry.js +0 -26
  87. package/dist/esm/verdocs-button.entry.js +0 -22
  88. package/dist/esm-es5/verdocs-button.entry.js +0 -1
  89. package/dist/esm-es5/verdocs-checkbox_5.entry.js +0 -1
  90. package/dist/verdocs-web-sdk/p-28b22c54.system.entry.js +0 -1
  91. package/dist/verdocs-web-sdk/p-450d6648.system.entry.js +0 -1
  92. package/dist/verdocs-web-sdk/p-606e0405.entry.js +0 -1
  93. package/dist/verdocs-web-sdk/p-9964cc5e.entry.js +0 -1
  94. package/dist/verdocs-web-sdk/p-c391fa41.entry.js +0 -1
  95. package/dist/verdocs-web-sdk/p-fbabbcea.system.entry.js +0 -1
@@ -0,0 +1,144 @@
1
+ export const TimeZones = [
2
+ ['International Date Line West', 'GMT-11:00', '(GMT-11:00) International Date Line West'],
3
+ ['Midway Island', 'GMT-11:00', '(GMT-11:00) Midway Island'],
4
+ ['Samoa', 'GMT-11:00', '(GMT-11:00) Samoa'],
5
+ ['Hawaii', 'GMT-10:00', '(GMT-10:00) Hawaii'],
6
+ ['Alaska', 'GMT-09:00', '(GMT-09:00) Alaska'],
7
+ ['Pacific Time (US & Canada)', 'GMT-08:00', '(GMT-08:00) Pacific Time (US & Canada)'],
8
+ ['Tijuana', 'GMT-08:00', '(GMT-08:00) Tijuana'],
9
+ ['Arizona', 'GMT-07:00', '(GMT-07:00) Arizona'],
10
+ ['Chihuahua', 'GMT-07:00', '(GMT-07:00) Chihuahua'],
11
+ ['Mazatlan', 'GMT-07:00', '(GMT-07:00) Mazatlan'],
12
+ ['Mountain Time (US & Canada)', 'GMT-07:00', '(GMT-07:00) Mountain Time (US & Canada)'],
13
+ ['Central America', 'GMT-06:00', '(GMT-06:00) Central America'],
14
+ ['Central Time (US & Canada)', 'GMT-06:00', '(GMT-06:00) Central Time (US & Canada)'],
15
+ ['Guadalajara', 'GMT-06:00', '(GMT-06:00) Guadalajara'],
16
+ ['Mexico City', 'GMT-06:00', '(GMT-06:00) Mexico City'],
17
+ ['Monterrey', 'GMT-06:00', '(GMT-06:00) Monterrey'],
18
+ ['Saskatchewan', 'GMT-06:00', '(GMT-06:00) Saskatchewan'],
19
+ ['Bogota', 'GMT-05:00', '(GMT-05:00) Bogota'],
20
+ ['Eastern Time (US & Canada)', 'GMT-05:00', '(GMT-05:00) Eastern Time (US & Canada)'],
21
+ ['Indiana (East)', 'GMT-05:00', '(GMT-05:00) Indiana (East)'],
22
+ ['Lima', 'GMT-05:00', '(GMT-05:00) Lima'],
23
+ ['Quito', 'GMT-05:00', '(GMT-05:00) Quito'],
24
+ ['Caracas', 'GMT-04:30', '(GMT-04:30) Caracas'],
25
+ ['Atlantic Time (Canada)', 'GMT-04:00', '(GMT-04:00) Atlantic Time (Canada)'],
26
+ ['Georgetown', 'GMT-04:00', '(GMT-04:00) Georgetown'],
27
+ ['La Paz', 'GMT-04:00', '(GMT-04:00) La Paz'],
28
+ ['Santiago', 'GMT-04:00', '(GMT-04:00) Santiago'],
29
+ ['Newfoundland', 'GMT-03:30', '(GMT-03:30) Newfoundland'],
30
+ ['Brasilia', 'GMT-03:00', '(GMT-03:00) Brasilia'],
31
+ ['Buenos Aires', 'GMT-03:00', '(GMT-03:00) Buenos Aires'],
32
+ ['Greenland', 'GMT-03:00', '(GMT-03:00) Greenland'],
33
+ ['Mid-Atlantic', 'GMT-02:00', '(GMT-02:00) Mid-Atlantic'],
34
+ ['Azores', 'GMT-01:00', '(GMT-01:00) Azores'],
35
+ ['Cape Verde Is.', 'GMT-01:00', '(GMT-01:00) Cape Verde Is.'],
36
+ ['Casablanca', 'GMT+00:00', '(GMT+00:00) Casablanca'],
37
+ ['Dublin', 'GMT+00:00', '(GMT+00:00) Dublin'],
38
+ ['Edinburgh', 'GMT+00:00', '(GMT+00:00) Edinburgh'],
39
+ ['Lisbon', 'GMT+00:00', '(GMT+00:00) Lisbon'],
40
+ ['London', 'GMT+00:00', '(GMT+00:00) London'],
41
+ ['Monrovia', 'GMT+00:00', '(GMT+00:00) Monrovia'],
42
+ ['UTC', 'GMT+00:00', '(GMT+00:00) UTC'],
43
+ ['Amsterdam', 'GMT+01:00', '(GMT+01:00) Amsterdam'],
44
+ ['Belgrade', 'GMT+01:00', '(GMT+01:00) Belgrade'],
45
+ ['Berlin', 'GMT+01:00', '(GMT+01:00) Berlin'],
46
+ ['Bern', 'GMT+01:00', '(GMT+01:00) Bern'],
47
+ ['Bratislava', 'GMT+01:00', '(GMT+01:00) Bratislava'],
48
+ ['Brussels', 'GMT+01:00', '(GMT+01:00) Brussels'],
49
+ ['Budapest', 'GMT+01:00', '(GMT+01:00) Budapest'],
50
+ ['Copenhagen', 'GMT+01:00', '(GMT+01:00) Copenhagen'],
51
+ ['Ljubljana', 'GMT+01:00', '(GMT+01:00) Ljubljana'],
52
+ ['Madrid', 'GMT+01:00', '(GMT+01:00) Madrid'],
53
+ ['Paris', 'GMT+01:00', '(GMT+01:00) Paris'],
54
+ ['Prague', 'GMT+01:00', '(GMT+01:00) Prague'],
55
+ ['Rome', 'GMT+01:00', '(GMT+01:00) Rome'],
56
+ ['Sarajevo', 'GMT+01:00', '(GMT+01:00) Sarajevo'],
57
+ ['Skopje', 'GMT+01:00', '(GMT+01:00) Skopje'],
58
+ ['Stockholm', 'GMT+01:00', '(GMT+01:00) Stockholm'],
59
+ ['Vienna', 'GMT+01:00', '(GMT+01:00) Vienna'],
60
+ ['Warsaw', 'GMT+01:00', '(GMT+01:00) Warsaw'],
61
+ ['West Central Africa', '(GMT+01:00', '(GMT+01:00) West Central Africa'],
62
+ ['Zagreb', 'GMT+01:00', '(GMT+01:00) Zagreb'],
63
+ ['Athens', 'GMT+02:00', '(GMT+02:00) Athens'],
64
+ ['Bucharest', 'GMT+02:00', '(GMT+02:00) Bucharest'],
65
+ ['Cairo', 'GMT+02:00', '(GMT+02:00) Cairo'],
66
+ ['Harare', 'GMT+02:00', '(GMT+02:00) Harare'],
67
+ ['Helsinki', 'GMT+02:00', '(GMT+02:00) Helsinki'],
68
+ ['Istanbul', 'GMT+02:00', '(GMT+02:00) Istanbul'],
69
+ ['Jerusalem', 'GMT+02:00', '(GMT+02:00) Jerusalem'],
70
+ ['Kyiv', 'GMT+02:00', '(GMT+02:00) Kyiv'],
71
+ ['Minsk', 'GMT+02:00', '(GMT+02:00) Minsk'],
72
+ ['Pretoria', 'GMT+02:00', '(GMT+02:00) Pretoria'],
73
+ ['Riga', 'GMT+02:00', '(GMT+02:00) Riga'],
74
+ ['Sofia', 'GMT+02:00', '(GMT+02:00) Sofia'],
75
+ ['Tallinn', 'GMT+02:00', '(GMT+02:00) Tallinn'],
76
+ ['Vilnius', 'GMT+02:00', '(GMT+02:00) Vilnius'],
77
+ ['Baghdad', 'GMT+03:00', '(GMT+03:00) Baghdad'],
78
+ ['Kuwait', 'GMT+03:00', '(GMT+03:00) Kuwait'],
79
+ ['Moscow', 'GMT+03:00', '(GMT+03:00) Moscow'],
80
+ ['Nairobi', 'GMT+03:00', '(GMT+03:00) Nairobi'],
81
+ ['Riyadh', 'GMT+03:00', '(GMT+03:00) Riyadh'],
82
+ ['St. Petersburg', 'GMT+03:00', '(GMT+03:00) St. Petersburg'],
83
+ ['Volgograd', 'GMT+03:00', '(GMT+03:00) Volgograd'],
84
+ ['Tehran', 'GMT+03:30', '(GMT+03:30) Tehran'],
85
+ ['Abu Dhabi', 'GMT+04:00', '(GMT+04:00) Abu Dhabi'],
86
+ ['Baku', 'GMT+04:00', '(GMT+04:00) Baku'],
87
+ ['Muscat', 'GMT+04:00', '(GMT+04:00) Muscat'],
88
+ ['Tbilisi', 'GMT+04:00', '(GMT+04:00) Tbilisi'],
89
+ ['Yerevan', 'GMT+04:00', '(GMT+04:00) Yerevan'],
90
+ ['Kabul', 'GMT+04:30', '(GMT+04:30) Kabul'],
91
+ ['Ekaterinburg', 'GMT+05:00', '(GMT+05:00) Ekaterinburg'],
92
+ ['Islamabad', 'GMT+05:00', '(GMT+05:00) Islamabad'],
93
+ ['Karachi', 'GMT+05:00', '(GMT+05:00) Karachi'],
94
+ ['Tashkent', 'GMT+05:00', '(GMT+05:00) Tashkent'],
95
+ ['Chennai', 'GMT+05:30', '(GMT+05:30) Chennai'],
96
+ ['Kolkata', 'GMT+05:30', '(GMT+05:30) Kolkata'],
97
+ ['Mumbai', 'GMT+05:30', '(GMT+05:30) Mumbai'],
98
+ ['New Delhi', 'GMT+05:30', '(GMT+05:30) New Delhi'],
99
+ ['Sri Jayawardenepura', 'GMT+05:30', '(GMT+05:30) Sri Jayawardenepura'],
100
+ ['Kathmandu', 'GMT+05:45', '(GMT+05:45) Kathmandu'],
101
+ ['Almaty', 'GMT+06:00', '(GMT+06:00) Almaty'],
102
+ ['Astana', 'GMT+06:00', '(GMT+06:00) Astana'],
103
+ ['Dhaka', 'GMT+06:00', '(GMT+06:00) Dhaka'],
104
+ ['Novosibirsk', 'GMT+06:00', '(GMT+06:00) Novosibirsk'],
105
+ ['Rangoon', 'GMT+06:30', '(GMT+06:30) Rangoon'],
106
+ ['Bangkok', 'GMT+07:00', '(GMT+07:00) Bangkok'],
107
+ ['Hanoi', 'GMT+07:00', '(GMT+07:00) Hanoi'],
108
+ ['Jakarta', 'GMT+07:00', '(GMT+07:00) Jakarta'],
109
+ ['Krasnoyarsk', 'GMT+07:00', '(GMT+07:00) Krasnoyarsk'],
110
+ ['Beijing', 'GMT+08:00', '(GMT+08:00) Beijing'],
111
+ ['Chongqing', 'GMT+08:00', '(GMT+08:00) Chongqing'],
112
+ ['Hong Kong', 'GMT+08:00', '(GMT+08:00) Hong Kong'],
113
+ ['Irkutsk', 'GMT+08:00', '(GMT+08:00) Irkutsk'],
114
+ ['Kuala Lumpur', 'GMT+08:00', '(GMT+08:00) Kuala Lumpur'],
115
+ ['Perth', 'GMT+08:00', '(GMT+08:00) Perth'],
116
+ ['Singapore', 'GMT+08:00', '(GMT+08:00) Singapore'],
117
+ ['Taipei', 'GMT+08:00', '(GMT+08:00) Taipei'],
118
+ ['Ulaan Bataar', 'GMT+08:00', '(GMT+08:00) Ulaan Bataar'],
119
+ ['Urumqi', 'GMT+08:00', '(GMT+08:00) Urumqi'],
120
+ ['Osaka', 'GMT+09:00', '(GMT+09:00) Osaka'],
121
+ ['Sapporo', 'GMT+09:00', '(GMT+09:00) Sapporo'],
122
+ ['Seoul', 'GMT+09:00', '(GMT+09:00) Seoul'],
123
+ ['Tokyo', 'GMT+09:00', '(GMT+09:00) Tokyo'],
124
+ ['Yakutsk', 'GMT+09:00', '(GMT+09:00) Yakutsk'],
125
+ ['Adelaide', 'GMT+09:30', '(GMT+09:30) Adelaide'],
126
+ ['Darwin', 'GMT+09:30', '(GMT+09:30) Darwin'],
127
+ ['Brisbane', 'GMT+10:00', '(GMT+10:00) Brisbane'],
128
+ ['Canberra', 'GMT+10:00', '(GMT+10:00) Canberra'],
129
+ ['Guam', 'GMT+10:00', '(GMT+10:00) Guam'],
130
+ ['Hobart', 'GMT+10:00', '(GMT+10:00) Hobart'],
131
+ ['Melbourne', 'GMT+10:00', '(GMT+10:00) Melbourne'],
132
+ ['Port Moresby', 'GMT+10:00', '(GMT+10:00) Port Moresby'],
133
+ ['Sydney', 'GMT+10:00', '(GMT+10:00) Sydney'],
134
+ ['Vladivostok', 'GMT+10:00', '(GMT+10:00) Vladivostok'],
135
+ ['Kamchatka', 'GMT+11:00', '(GMT+11:00) Kamchatka'],
136
+ ['Magadan', 'GMT+11:00', '(GMT+11:00) Magadan'],
137
+ ['New Caledonia', 'GMT+11:00', '(GMT+11:00) New Caledonia'],
138
+ ['Solomon Is.', 'GMT+11:00', '(GMT+11:00) Solomon Is.'],
139
+ ['Auckland', 'GMT+12:00', '(GMT+12:00) Auckland'],
140
+ ['Fiji', 'GMT+12:00', '(GMT+12:00) Fiji'],
141
+ ['Marshall Is.', 'GMT+12:00', '(GMT+12:00) Marshall Is.'],
142
+ ['Wellington', 'GMT+12:00', '(GMT+12:00) Wellington'],
143
+ ["Nuku'alofa", 'GMT+13:00', "(GMT+13:00) Nuku'alofa"],
144
+ ];
@@ -0,0 +1,33 @@
1
+ verdocs-settings-organization {
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-organization .columns {
12
+ gap: 20px;
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ flex-direction: row;
16
+ }
17
+ verdocs-settings-organization .column {
18
+ flex: 1;
19
+ display: flex;
20
+ flex-direction: column;
21
+ }
22
+ verdocs-settings-organization verdocs-text-input {
23
+ margin: 10px 0;
24
+ }
25
+ verdocs-settings-organization verdocs-text-input input {
26
+ height: 32px;
27
+ }
28
+ @media screen and (max-width: 600px) {
29
+ verdocs-settings-organization .columns {
30
+ gap: 0;
31
+ flex-direction: column;
32
+ }
33
+ }
@@ -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} /> `;
@@ -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
+ }
@@ -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} /> `;
@@ -1,4 +1,4 @@
1
- import { c as createStore } from './index3.js';
1
+ import { c as createStore } from './index4.js';
2
2
  import { j as getEnvelope } from './Envelopes.js';
3
3
 
4
4
  const createEnvelopeStore = (envelopeId) => {