@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,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,28 +1,16 @@
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
- import { d as defineCustomElement$5 } from './verdocs-button2.js';
7
- import { d as defineCustomElement$4 } from './verdocs-help-icon2.js';
8
- import { d as defineCustomElement$3 } from './verdocs-select-input2.js';
8
+ import { d as defineCustomElement$6 } from './verdocs-button2.js';
9
+ import { d as defineCustomElement$5 } from './verdocs-help-icon2.js';
10
+ import { d as defineCustomElement$4 } from './verdocs-select-input2.js';
11
+ import { d as defineCustomElement$3 } from './verdocs-spinner2.js';
9
12
  import { d as defineCustomElement$2 } from './verdocs-text-input2.js';
10
13
 
11
- /**
12
- * An Organization is the top level object for ownership for Members, Documents, and Templates.
13
- *
14
- * @module
15
- */
16
- /**
17
- * Check if an organization name is available. Typically used during the sign-up process. This endpoint is rate-limited
18
- * to prevent abuse. Developers experiencing problems with testing new applications should contact support.
19
- */
20
- var isOrgAvailable = function (endpoint, name) {
21
- return endpoint.api //
22
- .post('/organizations/check-availability', { name: name }, { baseURL: endpoint.getBaseURLv2() })
23
- .then(function (r) { return r.data; });
24
- };
25
-
26
14
  /**
27
15
  * Authenticate to Verdocs via user/password authentication
28
16
  *
@@ -75,36 +63,12 @@ var resendVerification = function (endpoint, accessToken) {
75
63
  .then(function (r) { return r.data; });
76
64
  };
77
65
 
78
- /**
79
- * Get the user's available profiles. The current profile will be marked with `current: true`.
80
- *
81
- * ```typescript
82
- * import {Profiles} from '@verdocs/js-sdk/Users';
83
- *
84
- * const profiles = await Profiles.getProfiles()
85
- * ```
86
- */
87
- /**
88
- * Create a user account and parent organization. This endpoint is for creating a new organization. Users joining an
89
- * existing organization should be invited, and follow their invitation links/instructions to create their accounts.
90
- *
91
- * ```typescript
92
- * import {Profiles} from '@verdocs/js-sdk/Users';
93
- *
94
- * const newAccount = await Profiles.createBusinessAccount({
95
- * orgName: 'ORG', email: 'a@b.com', password: '12345678', firstName: 'FIRST', lastName: 'LAST'
96
- * });
97
- * ```
98
- */
99
- var createBusinessAccount = function (endpoint, params) {
100
- return endpoint.api //
101
- .post('/user/business', params)
102
- .then(function (r) { return r.data; });
103
- };
104
-
105
- 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}";
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}";
106
67
 
107
68
  const RECHECK_INTERVAL = 5000;
69
+ const OkIcon = `<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="green"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>`;
70
+ const TakenIcon = `<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="red"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z" clip-rule="evenodd" /></svg>`;
71
+ const InfoIcon = `<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="#4a4a4a"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm11.378-3.917c-.89-.777-2.366-.777-3.255 0a.75.75 0 01-.988-1.129c1.454-1.272 3.776-1.272 5.23 0 1.513 1.324 1.513 3.518 0 4.842a3.75 3.75 0 01-.837.552c-.676.328-1.028.774-1.028 1.152v.75a.75.75 0 01-1.5 0v-.75c0-1.279 1.06-2.107 1.875-2.502.182-.088.351-.199.503-.331.83-.727.83-1.857 0-2.584zM12 18a.75.75 0 100-1.5.75.75 0 000 1.5z" clip-rule="evenodd" /></svg>`;
108
72
  const Industries = [
109
73
  { value: '', label: '' },
110
74
  { value: 'Accounting & Tax', label: 'Accounting & Tax' },
@@ -160,7 +124,7 @@ const VerdocsAuth$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
160
124
  this.isAuthenticated = false;
161
125
  this.displayMode = 'login';
162
126
  this.orgname = '';
163
- this.orgAvailable = '';
127
+ this.orgAvailable = 'UNKNOWN';
164
128
  this.first = '';
165
129
  this.last = '';
166
130
  this.username = '';
@@ -175,6 +139,7 @@ const VerdocsAuth$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
175
139
  this.reason = '';
176
140
  this.signupStep = 1;
177
141
  this.resendDisabled = false;
142
+ this.checkingOrg = false;
178
143
  }
179
144
  componentWillLoad() {
180
145
  var _a, _b;
@@ -323,12 +288,21 @@ const VerdocsAuth$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
323
288
  });
324
289
  }
325
290
  async checkAvailability(name) {
326
- this.orgname = name;
327
- this.orgAvailable = '';
328
- this.orgAvailable = await isOrgAvailable(this.endpoint, name);
329
- console.log('response', this.orgAvailable);
330
- // Stage: POST - https://2r8pilqa44.execute-api.us-east-1.amazonaws.com/organizations/check-availability
331
- // Prod: POST - https://lb1is9fxoc.execute-api.us-east-1.amazonaws.com/organizations/check-availability
291
+ this.checkingOrg = true;
292
+ try {
293
+ this.orgname = name;
294
+ const r = await isOrgAvailable(this.endpoint, name);
295
+ this.orgAvailable = r.result;
296
+ console.log('response', this.orgAvailable);
297
+ // Stage: POST - https://2r8pilqa44.execute-api.us-east-1.amazonaws.com/organizations/check-availability
298
+ // Prod: POST - https://lb1is9fxoc.execute-api.us-east-1.amazonaws.com/organizations/check-availability
299
+ }
300
+ catch (e) {
301
+ // NOP
302
+ // We need to trap this error because we get a 400 if the org name is invalid.
303
+ this.orgAvailable = 'UNKNOWN';
304
+ }
305
+ this.checkingOrg = false;
332
306
  }
333
307
  render() {
334
308
  if (!this.visible) {
@@ -338,9 +312,10 @@ const VerdocsAuth$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
338
312
  return (h("verdocs-button", { label: "Sign Out", disabled: this.submitting, onClick: () => this.handleLogout(), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }));
339
313
  }
340
314
  if (this.displayMode === 'signup') {
341
- const step1Invalid = this.submitting || !this.first || !this.last || !this.username || !this.password || !this.orgname || this.orgAvailable !== 'OK';
342
- console.log({ step1Invalid }, this.orgAvailable);
343
- return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Sign up for a trial account"), h("h4", null, "Already have an account?", h("verdocs-button", { label: "Log In", variant: "text", onClick: () => (this.displayMode = 'login'), disabled: this.submitting })), this.signupStep === 1 && (h("form", { onSubmit: () => this.handleSignup() }, h("div", { style: { display: 'flex', flexDirection: 'row', columnGap: '20px' } }, h("verdocs-text-input", { label: "First Name", autocomplete: "first", required: true, value: this.first, onInput: (e) => (this.first = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Last Name", autocomplete: "last", required: true, value: this.last, onInput: (e) => (this.last = e.target.value), disabled: this.submitting })), h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Phone #", autocomplete: "phone", value: this.phone, onInput: (e) => (this.phone = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Password", type: "password", required: true, autocomplete: "current-password", value: this.password, onInput: (e) => (this.password = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Organization Name", autocomplete: "org", required: true, value: this.orgname, onInput: (e) => this.checkAvailability(e.target.value), disabled: this.submitting }), this.orgAvailable === 'TAKEN' && h("p", { style: { color: 'red' } }, "This organization name is already taken."), h("div", { style: { marginTop: '30px' } }), h("verdocs-button", { label: "Next", disabled: step1Invalid, onClick: () => (this.signupStep = 2), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }))), this.signupStep === 2 && (h("form", { onSubmit: () => this.handleSignup() }, h("verdocs-text-input", { label: "How did you hear about Verdocs?", value: this.howHear, onInput: (e) => (this.howHear = e.target.value), disabled: this.submitting }), h("verdocs-select-input", { label: "Your Industry", options: Industries, value: this.industry, onInput: (e) => (this.industry = e.target.value), disabled: this.submitting }), h("verdocs-select-input", { label: "Company Size", options: CompanySizes, value: this.companySize, onInput: (e) => (this.companySize = e.target.value), disabled: this.submitting }), h("verdocs-select-input", { label: "Purpose", options: Reasons, value: this.reason, onInput: (e) => (this.reason = e.target.value), disabled: this.submitting }), h("div", { style: { marginTop: '30px' } }), h("verdocs-button", { label: "Create Account", disabled: this.submitting, onClick: () => this.handleSignup(), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }))), this.signupStep === 3 && (h("form", { onSubmit: () => this.handleSignup() }, h("p", null, "Please check your e-mail inbox for a verification code and follow the instructions provided."), h("p", null, h("em", null, "Verification messages may take up to 1 hour to arrive. If you do not receive the invitation, ", h("a", { href: "#" }, "Click Here"), " to resend it. Be sure to check your spam folder.")), h("div", { style: { display: 'flex', flexDirection: 'row', gap: '20px' } }, h("verdocs-button", { label: "Back", disabled: this.submitting, onClick: () => {
315
+ const step1Invalid = this.submitting || !this.first || !this.last || !this.username || !this.password || !this.orgname || this.orgAvailable !== 'AVAILABLE';
316
+ return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Sign up for a trial account"), h("h4", null, "Already have an account?", h("verdocs-button", { label: "Log In", variant: "text", onClick: () => (this.displayMode = 'login'), disabled: this.submitting })), this.signupStep === 1 && (h("form", { onSubmit: () => this.handleSignup() }, h("div", { style: { display: 'flex', flexDirection: 'row', columnGap: '20px' } }, h("verdocs-text-input", { label: "First Name", autocomplete: "first", required: true, value: this.first, onInput: (e) => (this.first = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Last Name", autocomplete: "last", required: true, value: this.last, onInput: (e) => (this.last = e.target.value), disabled: this.submitting })), h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Phone #", autocomplete: "phone", value: this.phone, onInput: (e) => (this.phone = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Password", type: "password", required: true, autocomplete: "current-password", value: this.password, onInput: (e) => (this.password = e.target.value), disabled: this.submitting }), h("div", { style: { display: 'flex', flexDirection: 'row', gap: '10px', alignItems: 'center' } }, h("verdocs-text-input", { label: "Organization Name", autocomplete: "org", required: true, value: this.orgname, onInput: (e) => this.checkAvailability(e.target.value), disabled: this.submitting, style: { flex: '1' }, onBlur: () => {
317
+ console.log('blur');
318
+ } }), !this.checkingOrg && this.orgAvailable === 'AVAILABLE' && h("verdocs-help-icon", { icon: OkIcon, text: "Organization name is available." }), !this.checkingOrg && this.orgAvailable === 'TAKEN' && h("verdocs-help-icon", { icon: TakenIcon, text: "Organization already registered." }), !this.checkingOrg && this.orgAvailable === 'UNKNOWN' && h("verdocs-help-icon", { icon: InfoIcon, text: "Organization name must be unique." }), this.checkingOrg && h("verdocs-spinner", { mode: "dark", size: 24 })), h("div", { style: { marginTop: '30px' } }), h("verdocs-button", { label: "Next", disabled: step1Invalid, onClick: () => (this.signupStep = 2), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }))), this.signupStep === 2 && (h("form", { onSubmit: () => this.handleSignup() }, h("verdocs-text-input", { label: "How did you hear about Verdocs?", value: this.howHear, onInput: (e) => (this.howHear = e.target.value), disabled: this.submitting }), h("verdocs-select-input", { label: "Your Industry", options: Industries, value: this.industry, onInput: (e) => (this.industry = e.target.value), disabled: this.submitting }), h("verdocs-select-input", { label: "Company Size", options: CompanySizes, value: this.companySize, onInput: (e) => (this.companySize = e.target.value), disabled: this.submitting }), h("verdocs-select-input", { label: "Purpose", options: Reasons, value: this.reason, onInput: (e) => (this.reason = e.target.value), disabled: this.submitting }), h("div", { style: { marginTop: '30px' } }), h("verdocs-button", { label: "Create Account", disabled: this.submitting, onClick: () => this.handleSignup(), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }))), this.signupStep === 3 && (h("form", { onSubmit: () => this.handleSignup() }, h("p", null, "Please check your e-mail inbox for a verification code and follow the instructions provided."), h("p", null, h("em", null, "Verification messages may take up to 1 hour to arrive. If you do not receive the invitation, ", h("a", { href: "#" }, "Click Here"), " to resend it. Be sure to check your spam folder.")), h("div", { style: { display: 'flex', flexDirection: 'row', gap: '20px' } }, h("verdocs-button", { label: "Back", disabled: this.submitting, onClick: () => {
344
319
  this.signupStep = 2;
345
320
  }, style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }), h("verdocs-button", { label: "Go to Dashboard", disabled: true, onClick: () => this.handleSignup(), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }))))));
346
321
  }
@@ -382,13 +357,14 @@ const VerdocsAuth$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
382
357
  "companySize": [32],
383
358
  "reason": [32],
384
359
  "signupStep": [32],
385
- "resendDisabled": [32]
360
+ "resendDisabled": [32],
361
+ "checkingOrg": [32]
386
362
  }]);
387
363
  function defineCustomElement$1() {
388
364
  if (typeof customElements === "undefined") {
389
365
  return;
390
366
  }
391
- const components = ["verdocs-auth", "verdocs-button", "verdocs-help-icon", "verdocs-select-input", "verdocs-text-input"];
367
+ const components = ["verdocs-auth", "verdocs-button", "verdocs-help-icon", "verdocs-select-input", "verdocs-spinner", "verdocs-text-input"];
392
368
  components.forEach(tagName => { switch (tagName) {
393
369
  case "verdocs-auth":
394
370
  if (!customElements.get(tagName)) {
@@ -397,15 +373,20 @@ function defineCustomElement$1() {
397
373
  break;
398
374
  case "verdocs-button":
399
375
  if (!customElements.get(tagName)) {
400
- defineCustomElement$5();
376
+ defineCustomElement$6();
401
377
  }
402
378
  break;
403
379
  case "verdocs-help-icon":
404
380
  if (!customElements.get(tagName)) {
405
- defineCustomElement$4();
381
+ defineCustomElement$5();
406
382
  }
407
383
  break;
408
384
  case "verdocs-select-input":
385
+ if (!customElements.get(tagName)) {
386
+ defineCustomElement$4();
387
+ }
388
+ break;
389
+ case "verdocs-spinner":
409
390
  if (!customElements.get(tagName)) {
410
391
  defineCustomElement$3();
411
392
  }
@@ -1,18 +1,19 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { c as createPopper } from './popper.js';
3
3
 
4
- const verdocsHelpIconCss = "verdocs-help-icon{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:inline-block;opacity:0.3;position:relative}verdocs-help-icon:hover{opacity:1}verdocs-help-icon .icon{display:inline-block}verdocs-help-icon .icon svg{fill:#5c6575}verdocs-help-icon .tooltip{display:none;min-width:200px;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;background:#ffffff;color:#33364b;max-width:240px;font-weight:bold;position:absolute;padding:5px 10px;font-size:13px;border-radius:4px;z-index:10000}verdocs-help-icon .tooltip .arrow,verdocs-help-icon .tooltip .arrow::before{position:absolute;width:8px;height:8px;background:inherit}verdocs-help-icon .tooltip .arrow{visibility:hidden;top:-4px}verdocs-help-icon .tooltip .arrow::before{visibility:visible;content:\"\";-webkit-transform:rotate(45deg);transform:rotate(45deg)}verdocs-help-icon .tooltip[data-show]{display:block}verdocs-help-icon .tooltip[data-popper-placement^=top]>.arrow{bottom:-4px}verdocs-help-icon .tooltip[data-popper-placement^=bottom]>.arrow{top:-4px}verdocs-help-icon .tooltip[data-popper-placement^=left]>.arrow{right:-4px}verdocs-help-icon .tooltip[data-popper-placement^=right]>.arrow{left:-4px}";
4
+ const verdocsHelpIconCss = "verdocs-help-icon{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;display:inline-block;opacity:0.3;position:relative}verdocs-help-icon:hover{opacity:1}verdocs-help-icon .icon{display:inline-block}verdocs-help-icon .tooltip{display:none;min-width:200px;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;background:#ffffff;color:#33364b;max-width:240px;font-weight:bold;position:absolute;padding:5px 10px;font-size:13px;border-radius:4px;z-index:10000}verdocs-help-icon .tooltip .arrow,verdocs-help-icon .tooltip .arrow::before{position:absolute;width:8px;height:8px;background:inherit}verdocs-help-icon .tooltip .arrow{visibility:hidden;top:-4px}verdocs-help-icon .tooltip .arrow::before{visibility:visible;content:\"\";-webkit-transform:rotate(45deg);transform:rotate(45deg)}verdocs-help-icon .tooltip[data-show]{display:block}verdocs-help-icon .tooltip[data-popper-placement^=top]>.arrow{bottom:-4px}verdocs-help-icon .tooltip[data-popper-placement^=bottom]>.arrow{top:-4px}verdocs-help-icon .tooltip[data-popper-placement^=left]>.arrow{right:-4px}verdocs-help-icon .tooltip[data-popper-placement^=right]>.arrow{left:-4px}";
5
5
 
6
- const helpIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';
6
+ const helpIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';
7
7
  const VerdocsHelpIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
8
  constructor() {
9
9
  super();
10
10
  this.__registerHost();
11
11
  this.text = '';
12
+ this.icon = helpIcon;
12
13
  this.containerId = `verdocs-help-icon-${Math.random().toString(36).substring(2, 11)}`;
13
14
  }
14
15
  componentDidLoad() {
15
- this.popperInstance = createPopper(this.icon, this.tooltip, {
16
+ this.popperInstance = createPopper(this.iconEl, this.tooltipEl, {
16
17
  // placement: 'top-end',
17
18
  // modifiers: [{name: 'offset', options: {offset: [0, 10]}}],
18
19
  });
@@ -25,19 +26,20 @@ const VerdocsHelpIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
25
26
  }
26
27
  show() {
27
28
  var _a, _b;
28
- (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.setAttribute('data-show', '');
29
+ (_a = this.tooltipEl) === null || _a === void 0 ? void 0 : _a.setAttribute('data-show', '');
29
30
  (_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.update().catch(() => { });
30
31
  }
31
32
  hide() {
32
33
  var _a;
33
- (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.removeAttribute('data-show');
34
+ (_a = this.tooltipEl) === null || _a === void 0 ? void 0 : _a.removeAttribute('data-show');
34
35
  }
35
36
  render() {
36
- return (h(Host, { class: {} }, h("div", { "aria-describedby": this.containerId, class: "icon", innerHTML: helpIcon, onMouseEnter: () => this.show(), onFocus: () => this.show(), onMouseLeave: () => this.hide(), onBlur: () => this.hide(), ref: el => (this.icon = el) }), h("div", { id: this.containerId, role: "tooltip", class: "tooltip", "data-popper-placement": "bottom", ref: el => (this.tooltip = el) }, h("span", { innerHTML: this.text }), h("div", { "data-popper-arrow": "true", class: "arrow" }))));
37
+ return (h(Host, { class: {} }, h("div", { "aria-describedby": this.containerId, class: "icon", innerHTML: this.icon, onMouseEnter: () => this.show(), onFocus: () => this.show(), onMouseLeave: () => this.hide(), onBlur: () => this.hide(), ref: el => (this.iconEl = el) }), h("div", { id: this.containerId, role: "tooltip", class: "tooltip", "data-popper-placement": "bottom", ref: el => (this.tooltipEl = el) }, h("span", { innerHTML: this.text }), h("div", { "data-popper-arrow": "true", class: "arrow" }))));
37
38
  }
38
39
  static get style() { return verdocsHelpIconCss; }
39
40
  }, [0, "verdocs-help-icon", {
40
41
  "text": [1],
42
+ "icon": [1],
41
43
  "containerId": [32]
42
44
  }]);
43
45
  function defineCustomElement() {
@@ -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 };