@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,194 @@
1
+ import { getRenderingRef, forceUpdate } from '@stencil/core/internal/client';
2
+
3
+ const appendToMap = (map, propName, value) => {
4
+ const items = map.get(propName);
5
+ if (!items) {
6
+ map.set(propName, [value]);
7
+ }
8
+ else if (!items.includes(value)) {
9
+ items.push(value);
10
+ }
11
+ };
12
+ const debounce = (fn, ms) => {
13
+ let timeoutId;
14
+ return (...args) => {
15
+ if (timeoutId) {
16
+ clearTimeout(timeoutId);
17
+ }
18
+ timeoutId = setTimeout(() => {
19
+ timeoutId = 0;
20
+ fn(...args);
21
+ }, ms);
22
+ };
23
+ };
24
+
25
+ /**
26
+ * Check if a possible element isConnected.
27
+ * The property might not be there, so we check for it.
28
+ *
29
+ * We want it to return true if isConnected is not a property,
30
+ * otherwise we would remove these elements and would not update.
31
+ *
32
+ * Better leak in Edge than to be useless.
33
+ */
34
+ const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
35
+ const cleanupElements = debounce((map) => {
36
+ for (let key of map.keys()) {
37
+ map.set(key, map.get(key).filter(isConnected));
38
+ }
39
+ }, 2000);
40
+ const stencilSubscription = () => {
41
+ if (typeof getRenderingRef !== 'function') {
42
+ // If we are not in a stencil project, we do nothing.
43
+ // This function is not really exported by @stencil/core.
44
+ return {};
45
+ }
46
+ const elmsToUpdate = new Map();
47
+ return {
48
+ dispose: () => elmsToUpdate.clear(),
49
+ get: (propName) => {
50
+ const elm = getRenderingRef();
51
+ if (elm) {
52
+ appendToMap(elmsToUpdate, propName, elm);
53
+ }
54
+ },
55
+ set: (propName) => {
56
+ const elements = elmsToUpdate.get(propName);
57
+ if (elements) {
58
+ elmsToUpdate.set(propName, elements.filter(forceUpdate));
59
+ }
60
+ cleanupElements(elmsToUpdate);
61
+ },
62
+ reset: () => {
63
+ elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
64
+ cleanupElements(elmsToUpdate);
65
+ },
66
+ };
67
+ };
68
+
69
+ const unwrap = (val) => (typeof val === 'function' ? val() : val);
70
+ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
71
+ const unwrappedState = unwrap(defaultState);
72
+ let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
73
+ const handlers = {
74
+ dispose: [],
75
+ get: [],
76
+ set: [],
77
+ reset: [],
78
+ };
79
+ const reset = () => {
80
+ var _a;
81
+ // When resetting the state, the default state may be a function - unwrap it to invoke it.
82
+ // otherwise, the state won't be properly reset
83
+ states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
84
+ handlers.reset.forEach((cb) => cb());
85
+ };
86
+ const dispose = () => {
87
+ // Call first dispose as resetting the state would
88
+ // cause less updates ;)
89
+ handlers.dispose.forEach((cb) => cb());
90
+ reset();
91
+ };
92
+ const get = (propName) => {
93
+ handlers.get.forEach((cb) => cb(propName));
94
+ return states.get(propName);
95
+ };
96
+ const set = (propName, value) => {
97
+ const oldValue = states.get(propName);
98
+ if (shouldUpdate(value, oldValue, propName)) {
99
+ states.set(propName, value);
100
+ handlers.set.forEach((cb) => cb(propName, value, oldValue));
101
+ }
102
+ };
103
+ const state = (typeof Proxy === 'undefined'
104
+ ? {}
105
+ : new Proxy(unwrappedState, {
106
+ get(_, propName) {
107
+ return get(propName);
108
+ },
109
+ ownKeys(_) {
110
+ return Array.from(states.keys());
111
+ },
112
+ getOwnPropertyDescriptor() {
113
+ return {
114
+ enumerable: true,
115
+ configurable: true,
116
+ };
117
+ },
118
+ has(_, propName) {
119
+ return states.has(propName);
120
+ },
121
+ set(_, propName, value) {
122
+ set(propName, value);
123
+ return true;
124
+ },
125
+ }));
126
+ const on = (eventName, callback) => {
127
+ handlers[eventName].push(callback);
128
+ return () => {
129
+ removeFromArray(handlers[eventName], callback);
130
+ };
131
+ };
132
+ const onChange = (propName, cb) => {
133
+ const unSet = on('set', (key, newValue) => {
134
+ if (key === propName) {
135
+ cb(newValue);
136
+ }
137
+ });
138
+ // We need to unwrap the defaultState because it might be a function.
139
+ // Otherwise we might not be sending the right reset value.
140
+ const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
141
+ return () => {
142
+ unSet();
143
+ unReset();
144
+ };
145
+ };
146
+ const use = (...subscriptions) => {
147
+ const unsubs = subscriptions.reduce((unsubs, subscription) => {
148
+ if (subscription.set) {
149
+ unsubs.push(on('set', subscription.set));
150
+ }
151
+ if (subscription.get) {
152
+ unsubs.push(on('get', subscription.get));
153
+ }
154
+ if (subscription.reset) {
155
+ unsubs.push(on('reset', subscription.reset));
156
+ }
157
+ if (subscription.dispose) {
158
+ unsubs.push(on('dispose', subscription.dispose));
159
+ }
160
+ return unsubs;
161
+ }, []);
162
+ return () => unsubs.forEach((unsub) => unsub());
163
+ };
164
+ const forceUpdate = (key) => {
165
+ const oldValue = states.get(key);
166
+ handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
167
+ };
168
+ return {
169
+ state,
170
+ get,
171
+ set,
172
+ on,
173
+ onChange,
174
+ use,
175
+ dispose,
176
+ reset,
177
+ forceUpdate,
178
+ };
179
+ };
180
+ const removeFromArray = (array, item) => {
181
+ const index = array.indexOf(item);
182
+ if (index >= 0) {
183
+ array[index] = array[array.length - 1];
184
+ array.length--;
185
+ }
186
+ };
187
+
188
+ const createStore = (defaultState, shouldUpdate) => {
189
+ const map = createObservableMap(defaultState, shouldUpdate);
190
+ map.use(stencilSubscription());
191
+ return map;
192
+ };
193
+
194
+ export { createStore as c };
@@ -1,6 +1,8 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { d as decodeAccessTokenBody } from './Types.js';
3
+ import { i as isOrgAvailable } from './Organizations.js';
3
4
  import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
5
+ import { c as createBusinessAccount } from './Profiles.js';
4
6
  import { V as VerdocsToast } from './Toast.js';
5
7
  import { S as SDKError } from './errors.js';
6
8
  import { d as defineCustomElement$6 } from './verdocs-button2.js';
@@ -9,21 +11,6 @@ import { d as defineCustomElement$4 } from './verdocs-select-input2.js';
9
11
  import { d as defineCustomElement$3 } from './verdocs-spinner2.js';
10
12
  import { d as defineCustomElement$2 } from './verdocs-text-input2.js';
11
13
 
12
- /**
13
- * An Organization is the top level object for ownership for Members, Documents, and Templates.
14
- *
15
- * @module
16
- */
17
- /**
18
- * Check if an organization name is available. Typically used during the sign-up process. This endpoint is rate-limited
19
- * to prevent abuse. Developers experiencing problems with testing new applications should contact support.
20
- */
21
- var isOrgAvailable = function (endpoint, name) {
22
- return endpoint.api //
23
- .post('/organizations/check-availability', { name: name }, { baseURL: endpoint.getBaseURLv2() })
24
- .then(function (r) { return r.data; });
25
- };
26
-
27
14
  /**
28
15
  * Authenticate to Verdocs via user/password authentication
29
16
  *
@@ -76,33 +63,6 @@ var resendVerification = function (endpoint, accessToken) {
76
63
  .then(function (r) { return r.data; });
77
64
  };
78
65
 
79
- /**
80
- * Get the user's available profiles. The current profile will be marked with `current: true`.
81
- *
82
- * ```typescript
83
- * import {Profiles} from '@verdocs/js-sdk/Users';
84
- *
85
- * const profiles = await Profiles.getProfiles()
86
- * ```
87
- */
88
- /**
89
- * Create a user account and parent organization. This endpoint is for creating a new organization. Users joining an
90
- * existing organization should be invited, and follow their invitation links/instructions to create their accounts.
91
- *
92
- * ```typescript
93
- * import {Profiles} from '@verdocs/js-sdk/Users';
94
- *
95
- * const newAccount = await Profiles.createBusinessAccount({
96
- * orgName: 'ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
97
- * });
98
- * ```
99
- */
100
- var createBusinessAccount = function (endpoint, params) {
101
- return endpoint.api //
102
- .post('/user/business', params)
103
- .then(function (r) { return r.data; });
104
- };
105
-
106
66
  const verdocsAuthCss = "verdocs-auth{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .form{background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth h4 verdocs-button button.normal .button-label{padding:0}verdocs-auth .buttons{gap:20px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth .status-result{display:none}verdocs-auth .status-result.debug{white-space:pre-wrap;font-size:14px;background:#fff;padding:10px;display:block;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth form{width:100%}verdocs-auth verdocs-text-input{margin-bottom:10px}verdocs-auth .account-option{gap:8px;margin:20px 0 8px 0;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-auth p+p{margin-top:0}verdocs-auth verdocs-help-icon{margin-top:18px;display:-ms-flexbox;display:flex;width:32px;height:32px;-ms-flex:0 0 32px;flex:0 0 32px}";
107
67
 
108
68
  const RECHECK_INTERVAL = 5000;
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface VerdocsSettingsOrganization extends Components.VerdocsSettingsOrganization, HTMLElement {}
4
+ export const VerdocsSettingsOrganization: {
5
+ prototype: VerdocsSettingsOrganization;
6
+ new (): VerdocsSettingsOrganization;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { V as VerdocsSettingsOrganization$1, d as defineCustomElement$1 } from './verdocs-settings-organization2.js';
2
+
3
+ const VerdocsSettingsOrganization = VerdocsSettingsOrganization$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { VerdocsSettingsOrganization, defineCustomElement };
@@ -0,0 +1,331 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { z } from './index3.js';
3
+ import './Types.js';
4
+ import { g as getOrganization, u as updateOrganization } from './Organizations.js';
5
+ import { V as VerdocsEndpoint } from './VerdocsEndpoint.js';
6
+ import { d as convertToE164 } from './utils.js';
7
+ import { V as VerdocsToast } from './Toast.js';
8
+ import { d as defineCustomElement$4 } from './verdocs-button2.js';
9
+ import { d as defineCustomElement$3 } from './verdocs-help-icon2.js';
10
+ import { d as defineCustomElement$2 } from './verdocs-select-input2.js';
11
+ import { d as defineCustomElement$1 } from './verdocs-text-input2.js';
12
+
13
+ const TimeZones = [
14
+ ['International Date Line West', 'GMT-11:00', '(GMT-11:00) International Date Line West'],
15
+ ['Midway Island', 'GMT-11:00', '(GMT-11:00) Midway Island'],
16
+ ['Samoa', 'GMT-11:00', '(GMT-11:00) Samoa'],
17
+ ['Hawaii', 'GMT-10:00', '(GMT-10:00) Hawaii'],
18
+ ['Alaska', 'GMT-09:00', '(GMT-09:00) Alaska'],
19
+ ['Pacific Time (US & Canada)', 'GMT-08:00', '(GMT-08:00) Pacific Time (US & Canada)'],
20
+ ['Tijuana', 'GMT-08:00', '(GMT-08:00) Tijuana'],
21
+ ['Arizona', 'GMT-07:00', '(GMT-07:00) Arizona'],
22
+ ['Chihuahua', 'GMT-07:00', '(GMT-07:00) Chihuahua'],
23
+ ['Mazatlan', 'GMT-07:00', '(GMT-07:00) Mazatlan'],
24
+ ['Mountain Time (US & Canada)', 'GMT-07:00', '(GMT-07:00) Mountain Time (US & Canada)'],
25
+ ['Central America', 'GMT-06:00', '(GMT-06:00) Central America'],
26
+ ['Central Time (US & Canada)', 'GMT-06:00', '(GMT-06:00) Central Time (US & Canada)'],
27
+ ['Guadalajara', 'GMT-06:00', '(GMT-06:00) Guadalajara'],
28
+ ['Mexico City', 'GMT-06:00', '(GMT-06:00) Mexico City'],
29
+ ['Monterrey', 'GMT-06:00', '(GMT-06:00) Monterrey'],
30
+ ['Saskatchewan', 'GMT-06:00', '(GMT-06:00) Saskatchewan'],
31
+ ['Bogota', 'GMT-05:00', '(GMT-05:00) Bogota'],
32
+ ['Eastern Time (US & Canada)', 'GMT-05:00', '(GMT-05:00) Eastern Time (US & Canada)'],
33
+ ['Indiana (East)', 'GMT-05:00', '(GMT-05:00) Indiana (East)'],
34
+ ['Lima', 'GMT-05:00', '(GMT-05:00) Lima'],
35
+ ['Quito', 'GMT-05:00', '(GMT-05:00) Quito'],
36
+ ['Caracas', 'GMT-04:30', '(GMT-04:30) Caracas'],
37
+ ['Atlantic Time (Canada)', 'GMT-04:00', '(GMT-04:00) Atlantic Time (Canada)'],
38
+ ['Georgetown', 'GMT-04:00', '(GMT-04:00) Georgetown'],
39
+ ['La Paz', 'GMT-04:00', '(GMT-04:00) La Paz'],
40
+ ['Santiago', 'GMT-04:00', '(GMT-04:00) Santiago'],
41
+ ['Newfoundland', 'GMT-03:30', '(GMT-03:30) Newfoundland'],
42
+ ['Brasilia', 'GMT-03:00', '(GMT-03:00) Brasilia'],
43
+ ['Buenos Aires', 'GMT-03:00', '(GMT-03:00) Buenos Aires'],
44
+ ['Greenland', 'GMT-03:00', '(GMT-03:00) Greenland'],
45
+ ['Mid-Atlantic', 'GMT-02:00', '(GMT-02:00) Mid-Atlantic'],
46
+ ['Azores', 'GMT-01:00', '(GMT-01:00) Azores'],
47
+ ['Cape Verde Is.', 'GMT-01:00', '(GMT-01:00) Cape Verde Is.'],
48
+ ['Casablanca', 'GMT+00:00', '(GMT+00:00) Casablanca'],
49
+ ['Dublin', 'GMT+00:00', '(GMT+00:00) Dublin'],
50
+ ['Edinburgh', 'GMT+00:00', '(GMT+00:00) Edinburgh'],
51
+ ['Lisbon', 'GMT+00:00', '(GMT+00:00) Lisbon'],
52
+ ['London', 'GMT+00:00', '(GMT+00:00) London'],
53
+ ['Monrovia', 'GMT+00:00', '(GMT+00:00) Monrovia'],
54
+ ['UTC', 'GMT+00:00', '(GMT+00:00) UTC'],
55
+ ['Amsterdam', 'GMT+01:00', '(GMT+01:00) Amsterdam'],
56
+ ['Belgrade', 'GMT+01:00', '(GMT+01:00) Belgrade'],
57
+ ['Berlin', 'GMT+01:00', '(GMT+01:00) Berlin'],
58
+ ['Bern', 'GMT+01:00', '(GMT+01:00) Bern'],
59
+ ['Bratislava', 'GMT+01:00', '(GMT+01:00) Bratislava'],
60
+ ['Brussels', 'GMT+01:00', '(GMT+01:00) Brussels'],
61
+ ['Budapest', 'GMT+01:00', '(GMT+01:00) Budapest'],
62
+ ['Copenhagen', 'GMT+01:00', '(GMT+01:00) Copenhagen'],
63
+ ['Ljubljana', 'GMT+01:00', '(GMT+01:00) Ljubljana'],
64
+ ['Madrid', 'GMT+01:00', '(GMT+01:00) Madrid'],
65
+ ['Paris', 'GMT+01:00', '(GMT+01:00) Paris'],
66
+ ['Prague', 'GMT+01:00', '(GMT+01:00) Prague'],
67
+ ['Rome', 'GMT+01:00', '(GMT+01:00) Rome'],
68
+ ['Sarajevo', 'GMT+01:00', '(GMT+01:00) Sarajevo'],
69
+ ['Skopje', 'GMT+01:00', '(GMT+01:00) Skopje'],
70
+ ['Stockholm', 'GMT+01:00', '(GMT+01:00) Stockholm'],
71
+ ['Vienna', 'GMT+01:00', '(GMT+01:00) Vienna'],
72
+ ['Warsaw', 'GMT+01:00', '(GMT+01:00) Warsaw'],
73
+ ['West Central Africa', '(GMT+01:00', '(GMT+01:00) West Central Africa'],
74
+ ['Zagreb', 'GMT+01:00', '(GMT+01:00) Zagreb'],
75
+ ['Athens', 'GMT+02:00', '(GMT+02:00) Athens'],
76
+ ['Bucharest', 'GMT+02:00', '(GMT+02:00) Bucharest'],
77
+ ['Cairo', 'GMT+02:00', '(GMT+02:00) Cairo'],
78
+ ['Harare', 'GMT+02:00', '(GMT+02:00) Harare'],
79
+ ['Helsinki', 'GMT+02:00', '(GMT+02:00) Helsinki'],
80
+ ['Istanbul', 'GMT+02:00', '(GMT+02:00) Istanbul'],
81
+ ['Jerusalem', 'GMT+02:00', '(GMT+02:00) Jerusalem'],
82
+ ['Kyiv', 'GMT+02:00', '(GMT+02:00) Kyiv'],
83
+ ['Minsk', 'GMT+02:00', '(GMT+02:00) Minsk'],
84
+ ['Pretoria', 'GMT+02:00', '(GMT+02:00) Pretoria'],
85
+ ['Riga', 'GMT+02:00', '(GMT+02:00) Riga'],
86
+ ['Sofia', 'GMT+02:00', '(GMT+02:00) Sofia'],
87
+ ['Tallinn', 'GMT+02:00', '(GMT+02:00) Tallinn'],
88
+ ['Vilnius', 'GMT+02:00', '(GMT+02:00) Vilnius'],
89
+ ['Baghdad', 'GMT+03:00', '(GMT+03:00) Baghdad'],
90
+ ['Kuwait', 'GMT+03:00', '(GMT+03:00) Kuwait'],
91
+ ['Moscow', 'GMT+03:00', '(GMT+03:00) Moscow'],
92
+ ['Nairobi', 'GMT+03:00', '(GMT+03:00) Nairobi'],
93
+ ['Riyadh', 'GMT+03:00', '(GMT+03:00) Riyadh'],
94
+ ['St. Petersburg', 'GMT+03:00', '(GMT+03:00) St. Petersburg'],
95
+ ['Volgograd', 'GMT+03:00', '(GMT+03:00) Volgograd'],
96
+ ['Tehran', 'GMT+03:30', '(GMT+03:30) Tehran'],
97
+ ['Abu Dhabi', 'GMT+04:00', '(GMT+04:00) Abu Dhabi'],
98
+ ['Baku', 'GMT+04:00', '(GMT+04:00) Baku'],
99
+ ['Muscat', 'GMT+04:00', '(GMT+04:00) Muscat'],
100
+ ['Tbilisi', 'GMT+04:00', '(GMT+04:00) Tbilisi'],
101
+ ['Yerevan', 'GMT+04:00', '(GMT+04:00) Yerevan'],
102
+ ['Kabul', 'GMT+04:30', '(GMT+04:30) Kabul'],
103
+ ['Ekaterinburg', 'GMT+05:00', '(GMT+05:00) Ekaterinburg'],
104
+ ['Islamabad', 'GMT+05:00', '(GMT+05:00) Islamabad'],
105
+ ['Karachi', 'GMT+05:00', '(GMT+05:00) Karachi'],
106
+ ['Tashkent', 'GMT+05:00', '(GMT+05:00) Tashkent'],
107
+ ['Chennai', 'GMT+05:30', '(GMT+05:30) Chennai'],
108
+ ['Kolkata', 'GMT+05:30', '(GMT+05:30) Kolkata'],
109
+ ['Mumbai', 'GMT+05:30', '(GMT+05:30) Mumbai'],
110
+ ['New Delhi', 'GMT+05:30', '(GMT+05:30) New Delhi'],
111
+ ['Sri Jayawardenepura', 'GMT+05:30', '(GMT+05:30) Sri Jayawardenepura'],
112
+ ['Kathmandu', 'GMT+05:45', '(GMT+05:45) Kathmandu'],
113
+ ['Almaty', 'GMT+06:00', '(GMT+06:00) Almaty'],
114
+ ['Astana', 'GMT+06:00', '(GMT+06:00) Astana'],
115
+ ['Dhaka', 'GMT+06:00', '(GMT+06:00) Dhaka'],
116
+ ['Novosibirsk', 'GMT+06:00', '(GMT+06:00) Novosibirsk'],
117
+ ['Rangoon', 'GMT+06:30', '(GMT+06:30) Rangoon'],
118
+ ['Bangkok', 'GMT+07:00', '(GMT+07:00) Bangkok'],
119
+ ['Hanoi', 'GMT+07:00', '(GMT+07:00) Hanoi'],
120
+ ['Jakarta', 'GMT+07:00', '(GMT+07:00) Jakarta'],
121
+ ['Krasnoyarsk', 'GMT+07:00', '(GMT+07:00) Krasnoyarsk'],
122
+ ['Beijing', 'GMT+08:00', '(GMT+08:00) Beijing'],
123
+ ['Chongqing', 'GMT+08:00', '(GMT+08:00) Chongqing'],
124
+ ['Hong Kong', 'GMT+08:00', '(GMT+08:00) Hong Kong'],
125
+ ['Irkutsk', 'GMT+08:00', '(GMT+08:00) Irkutsk'],
126
+ ['Kuala Lumpur', 'GMT+08:00', '(GMT+08:00) Kuala Lumpur'],
127
+ ['Perth', 'GMT+08:00', '(GMT+08:00) Perth'],
128
+ ['Singapore', 'GMT+08:00', '(GMT+08:00) Singapore'],
129
+ ['Taipei', 'GMT+08:00', '(GMT+08:00) Taipei'],
130
+ ['Ulaan Bataar', 'GMT+08:00', '(GMT+08:00) Ulaan Bataar'],
131
+ ['Urumqi', 'GMT+08:00', '(GMT+08:00) Urumqi'],
132
+ ['Osaka', 'GMT+09:00', '(GMT+09:00) Osaka'],
133
+ ['Sapporo', 'GMT+09:00', '(GMT+09:00) Sapporo'],
134
+ ['Seoul', 'GMT+09:00', '(GMT+09:00) Seoul'],
135
+ ['Tokyo', 'GMT+09:00', '(GMT+09:00) Tokyo'],
136
+ ['Yakutsk', 'GMT+09:00', '(GMT+09:00) Yakutsk'],
137
+ ['Adelaide', 'GMT+09:30', '(GMT+09:30) Adelaide'],
138
+ ['Darwin', 'GMT+09:30', '(GMT+09:30) Darwin'],
139
+ ['Brisbane', 'GMT+10:00', '(GMT+10:00) Brisbane'],
140
+ ['Canberra', 'GMT+10:00', '(GMT+10:00) Canberra'],
141
+ ['Guam', 'GMT+10:00', '(GMT+10:00) Guam'],
142
+ ['Hobart', 'GMT+10:00', '(GMT+10:00) Hobart'],
143
+ ['Melbourne', 'GMT+10:00', '(GMT+10:00) Melbourne'],
144
+ ['Port Moresby', 'GMT+10:00', '(GMT+10:00) Port Moresby'],
145
+ ['Sydney', 'GMT+10:00', '(GMT+10:00) Sydney'],
146
+ ['Vladivostok', 'GMT+10:00', '(GMT+10:00) Vladivostok'],
147
+ ['Kamchatka', 'GMT+11:00', '(GMT+11:00) Kamchatka'],
148
+ ['Magadan', 'GMT+11:00', '(GMT+11:00) Magadan'],
149
+ ['New Caledonia', 'GMT+11:00', '(GMT+11:00) New Caledonia'],
150
+ ['Solomon Is.', 'GMT+11:00', '(GMT+11:00) Solomon Is.'],
151
+ ['Auckland', 'GMT+12:00', '(GMT+12:00) Auckland'],
152
+ ['Fiji', 'GMT+12:00', '(GMT+12:00) Fiji'],
153
+ ['Marshall Is.', 'GMT+12:00', '(GMT+12:00) Marshall Is.'],
154
+ ['Wellington', 'GMT+12:00', '(GMT+12:00) Wellington'],
155
+ ["Nuku'alofa", 'GMT+13:00', "(GMT+13:00) Nuku'alofa"],
156
+ ];
157
+
158
+ const verdocsSettingsOrganizationCss = "verdocs-settings-organization{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-organization .columns{gap:20px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-settings-organization .column{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-settings-organization verdocs-text-input{margin:10px 0}verdocs-settings-organization verdocs-text-input input{height:32px}@media screen and (max-width: 600px){verdocs-settings-organization .columns{gap:0;-ms-flex-direction:column;flex-direction:column}}";
159
+
160
+ const timeZoneOptions = TimeZones.map(tz => ({ value: tz[2], label: tz[2] }));
161
+ const schema = z.object({
162
+ name: z.string().trim().min(1, 'Name is required').max(30),
163
+ business_name: z.string().trim().max(30).optional(),
164
+ contact_email: z.string().trim().email('Invalid email').optional().or(z.literal('')),
165
+ phone: z.preprocess(val => convertToE164(String(val).trim()), z.string().optional()),
166
+ address: z.string().trim().max(30).optional(),
167
+ address2: z.string().trim().max(30).optional(),
168
+ timezone: z.string().trim().optional(),
169
+ url: z.string().trim().optional(),
170
+ });
171
+ const VerdocsSettingsOrganization = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
172
+ constructor() {
173
+ super();
174
+ this.__registerHost();
175
+ this.sdkError = createEvent(this, "sdkError", 7);
176
+ this.organizationUpdated = createEvent(this, "organizationUpdated", 7);
177
+ this.endpoint = VerdocsEndpoint.getDefault();
178
+ this.valid = false;
179
+ this.dirty = false;
180
+ this.submitting = false;
181
+ this.name = '';
182
+ this.business_name = '';
183
+ this.contact_email = '';
184
+ this.phone = '';
185
+ this.address = '';
186
+ this.address2 = '';
187
+ this.timezone = '';
188
+ this.url = '';
189
+ }
190
+ componentWillLoad() {
191
+ this.endpoint.loadSession();
192
+ if (!this.endpoint.session) {
193
+ console.log('[SETTINGS] Must be authenticated');
194
+ return;
195
+ }
196
+ }
197
+ async componentDidLoad() {
198
+ const organization = await getOrganization(this.endpoint, this.endpoint.session.organization_id);
199
+ console.log('[SETTINGS] Loaded organization', organization);
200
+ this.resetForm(organization);
201
+ }
202
+ resetForm(organization) {
203
+ this.name = organization.name;
204
+ this.business_name = organization.business_name;
205
+ this.contact_email = organization.contact_email;
206
+ this.phone = organization.phone;
207
+ this.address = organization.address;
208
+ this.address2 = organization.address2;
209
+ this.timezone = organization.timezone;
210
+ this.url = organization.url;
211
+ this.dirty = false;
212
+ this.valid = true;
213
+ }
214
+ handleSubmit(e) {
215
+ e.preventDefault();
216
+ e.stopPropagation();
217
+ updateOrganization(VerdocsEndpoint.getDefault(), this.endpoint.session.organization_id, {
218
+ name: this.name,
219
+ business_name: this.business_name,
220
+ contact_email: this.contact_email,
221
+ phone: this.phone,
222
+ address: this.address,
223
+ address2: this.address2,
224
+ timezone: this.timezone,
225
+ url: this.url,
226
+ })
227
+ .then(newOrganization => {
228
+ var _a;
229
+ console.log('[SETTINGS] Update result', newOrganization);
230
+ (_a = this.organizationUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, organization: newOrganization });
231
+ this.resetForm(newOrganization);
232
+ })
233
+ .catch(e => VerdocsToast(`Error updating organization: ${e.message}`, { style: 'error' }));
234
+ }
235
+ processFields() {
236
+ const validation = schema.safeParse({
237
+ name: this.name,
238
+ business_name: this.business_name,
239
+ contact_email: this.contact_email,
240
+ phone: this.phone,
241
+ address: this.address,
242
+ address2: this.address2,
243
+ timezone: this.timezone,
244
+ url: this.url,
245
+ });
246
+ console.log('[SETTINGS] Validation result', validation);
247
+ this.valid = validation.success;
248
+ this.dirty = true;
249
+ }
250
+ render() {
251
+ if (!this.endpoint.session) {
252
+ console.log('[SETTINGS] Must be authenticated');
253
+ return h(Host, { class: "authentication-required" }, "Must be authenticated");
254
+ }
255
+ 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) => {
256
+ this.name = e.target.value.trim();
257
+ this.processFields();
258
+ } }), 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) => {
259
+ this.business_name = e.target.value.trim();
260
+ this.processFields();
261
+ } }), 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) => {
262
+ this.url = e.target.value.trim();
263
+ this.processFields();
264
+ } }), 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) => {
265
+ this.phone = e.target.value.trim();
266
+ this.processFields();
267
+ } })), 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) => {
268
+ this.address = e.target.value.trim();
269
+ this.processFields();
270
+ } }), 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) => {
271
+ this.address2 = e.target.value.trim();
272
+ this.processFields();
273
+ } }), 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) => {
274
+ this.address2 = e.target.value.trim();
275
+ this.processFields();
276
+ } }), 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) => {
277
+ this.contact_email = e.target.value.trim();
278
+ this.processFields();
279
+ } }), 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 }))));
280
+ }
281
+ static get style() { return verdocsSettingsOrganizationCss; }
282
+ }, [0, "verdocs-settings-organization", {
283
+ "endpoint": [16],
284
+ "valid": [32],
285
+ "dirty": [32],
286
+ "submitting": [32],
287
+ "name": [32],
288
+ "business_name": [32],
289
+ "contact_email": [32],
290
+ "phone": [32],
291
+ "address": [32],
292
+ "address2": [32],
293
+ "timezone": [32],
294
+ "url": [32]
295
+ }]);
296
+ function defineCustomElement() {
297
+ if (typeof customElements === "undefined") {
298
+ return;
299
+ }
300
+ const components = ["verdocs-settings-organization", "verdocs-button", "verdocs-help-icon", "verdocs-select-input", "verdocs-text-input"];
301
+ components.forEach(tagName => { switch (tagName) {
302
+ case "verdocs-settings-organization":
303
+ if (!customElements.get(tagName)) {
304
+ customElements.define(tagName, VerdocsSettingsOrganization);
305
+ }
306
+ break;
307
+ case "verdocs-button":
308
+ if (!customElements.get(tagName)) {
309
+ defineCustomElement$4();
310
+ }
311
+ break;
312
+ case "verdocs-help-icon":
313
+ if (!customElements.get(tagName)) {
314
+ defineCustomElement$3();
315
+ }
316
+ break;
317
+ case "verdocs-select-input":
318
+ if (!customElements.get(tagName)) {
319
+ defineCustomElement$2();
320
+ }
321
+ break;
322
+ case "verdocs-text-input":
323
+ if (!customElements.get(tagName)) {
324
+ defineCustomElement$1();
325
+ }
326
+ break;
327
+ } });
328
+ }
329
+ defineCustomElement();
330
+
331
+ export { VerdocsSettingsOrganization as V, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface VerdocsSettingsProfile extends Components.VerdocsSettingsProfile, HTMLElement {}
4
+ export const VerdocsSettingsProfile: {
5
+ prototype: VerdocsSettingsProfile;
6
+ new (): VerdocsSettingsProfile;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { V as VerdocsSettingsProfile$1, d as defineCustomElement$1 } from './verdocs-settings-profile2.js';
2
+
3
+ const VerdocsSettingsProfile = VerdocsSettingsProfile$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { VerdocsSettingsProfile, defineCustomElement };