@verdocs/web-sdk 2.2.37 → 2.2.39

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 (35) hide show
  1. package/dist/cjs/verdocs-auth.cjs.entry.js +3 -3
  2. package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
  3. package/dist/cjs/verdocs-preview_8.cjs.entry.js +7 -0
  4. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +3 -3
  5. package/dist/collection/components/embeds/verdocs-build/verdocs-build.stories.js +1 -1
  6. package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.stories.js +1 -1
  7. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +7 -0
  8. package/dist/collection/components/embeds/verdocs-send/verdocs-send.stories.js +1 -1
  9. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +3 -3
  10. package/dist/collection/components/embeds/verdocs-view/verdocs-view.stories.js +1 -1
  11. package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.js +1 -1
  12. package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.stories.js +1 -1
  13. package/dist/components/verdocs-auth.js +3 -3
  14. package/dist/components/verdocs-envelope-sidebar.js +1 -1
  15. package/dist/components/verdocs-send2.js +7 -0
  16. package/dist/docs.json +1 -1
  17. package/dist/esm/verdocs-auth.entry.js +3 -3
  18. package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
  19. package/dist/esm/verdocs-preview_8.entry.js +7 -0
  20. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  21. package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
  22. package/dist/esm-es5/verdocs-preview_8.entry.js +1 -1
  23. package/dist/verdocs-web-sdk/{p-0fbdfb5b.entry.js → p-95d6d5bc.entry.js} +1 -1
  24. package/dist/verdocs-web-sdk/p-c186e449.entry.js +1 -0
  25. package/dist/verdocs-web-sdk/p-d44a159b.system.entry.js +1 -0
  26. package/dist/verdocs-web-sdk/{p-9b02abc9.system.entry.js → p-dd788332.system.entry.js} +1 -1
  27. package/dist/verdocs-web-sdk/{p-f888ff6c.system.entry.js → p-e33e9dd5.system.entry.js} +1 -1
  28. package/dist/verdocs-web-sdk/p-ed31ff0d.entry.js +1 -0
  29. package/dist/verdocs-web-sdk/p-f04bf956.system.js +1 -1
  30. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  31. package/package.json +1 -1
  32. package/dist/custom-elements.json +0 -2059
  33. package/dist/verdocs-web-sdk/p-0a78188f.system.entry.js +0 -1
  34. package/dist/verdocs-web-sdk/p-8db70951.entry.js +0 -1
  35. package/dist/verdocs-web-sdk/p-d6588808.entry.js +0 -1
@@ -310,14 +310,14 @@ const VerdocsAuth = class {
310
310
  }
311
311
  if (this.displayMode === 'signup') {
312
312
  const step1Invalid = this.submitting || !this.first || !this.last || !this.username || !this.password || !this.orgname || this.orgAvailable !== 'AVAILABLE';
313
- return (index.h("div", { class: "form" }, index.h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), index.h("h3", null, "Sign up for a trial account"), index.h("h4", null, "Already have an account?", index.h("verdocs-button", { label: "Log In", variant: "text", onClick: () => (this.displayMode = 'login'), disabled: this.submitting })), this.signupStep === 1 && (index.h("form", { onSubmit: () => this.handleSignup() }, index.h("div", { style: { display: 'flex', flexDirection: 'row', columnGap: '20px' } }, index.h("verdocs-text-input", { label: "First Name", autocomplete: "first", required: true, value: this.first, onInput: (e) => (this.first = e.target.value), disabled: this.submitting }), index.h("verdocs-text-input", { label: "Last Name", autocomplete: "last", required: true, value: this.last, onInput: (e) => (this.last = e.target.value), disabled: this.submitting })), index.h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), index.h("verdocs-text-input", { label: "Phone #", autocomplete: "phone", value: this.phone, onInput: (e) => (this.phone = e.target.value), disabled: this.submitting }), index.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 }), index.h("div", { style: { display: 'flex', flexDirection: 'row', gap: '10px', alignItems: 'center' } }, index.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: () => {
313
+ return (index.h("div", { class: "form" }, index.h("a", { href: "https://verdocs.com/en/" }, index.h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), index.h("h3", null, "Sign up for a trial account"), index.h("h4", null, "Already have an account?", index.h("verdocs-button", { label: "Log In", variant: "text", onClick: () => (this.displayMode = 'login'), disabled: this.submitting })), this.signupStep === 1 && (index.h("form", { onSubmit: () => this.handleSignup() }, index.h("div", { style: { display: 'flex', flexDirection: 'row', columnGap: '20px' } }, index.h("verdocs-text-input", { label: "First Name", autocomplete: "first", required: true, value: this.first, onInput: (e) => (this.first = e.target.value), disabled: this.submitting }), index.h("verdocs-text-input", { label: "Last Name", autocomplete: "last", required: true, value: this.last, onInput: (e) => (this.last = e.target.value), disabled: this.submitting })), index.h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), index.h("verdocs-text-input", { label: "Phone #", autocomplete: "phone", value: this.phone, onInput: (e) => (this.phone = e.target.value), disabled: this.submitting }), index.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 }), index.h("div", { style: { display: 'flex', flexDirection: 'row', gap: '10px', alignItems: 'center' } }, index.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: () => {
314
314
  console.log('blur');
315
315
  } }), !this.checkingOrg && this.orgAvailable === 'AVAILABLE' && index.h("verdocs-help-icon", { icon: OkIcon, text: "Organization name is available." }), !this.checkingOrg && this.orgAvailable === 'TAKEN' && index.h("verdocs-help-icon", { icon: TakenIcon, text: "Organization already registered." }), !this.checkingOrg && this.orgAvailable === 'UNKNOWN' && index.h("verdocs-help-icon", { icon: InfoIcon, text: "Organization name must be unique." }), this.checkingOrg && index.h("verdocs-spinner", { mode: "dark", size: 24 })), index.h("div", { style: { marginTop: '30px' } }), index.h("verdocs-button", { label: "Next", disabled: step1Invalid, onClick: () => (this.signupStep = 2), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }))), this.signupStep === 2 && (index.h("form", { onSubmit: () => this.handleSignup() }, index.h("verdocs-text-input", { label: "How did you hear about Verdocs?", value: this.howHear, onInput: (e) => (this.howHear = e.target.value), disabled: this.submitting }), index.h("verdocs-select-input", { label: "Your Industry", options: Industries, value: this.industry, onInput: (e) => (this.industry = e.target.value), disabled: this.submitting }), index.h("verdocs-select-input", { label: "Company Size", options: CompanySizes, value: this.companySize, onInput: (e) => (this.companySize = e.target.value), disabled: this.submitting }), index.h("verdocs-select-input", { label: "Purpose", options: Reasons, value: this.reason, onInput: (e) => (this.reason = e.target.value), disabled: this.submitting }), index.h("div", { style: { marginTop: '30px' } }), index.h("verdocs-button", { label: "Create Account", disabled: this.submitting, onClick: () => this.handleSignup(), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }))), this.signupStep === 3 && (index.h("form", { onSubmit: () => this.handleSignup() }, index.h("p", null, "Please check your e-mail inbox for a verification code and follow the instructions provided."), index.h("p", null, index.h("em", null, "Verification messages may take up to 1 hour to arrive. If you do not receive the invitation, ", index.h("a", { href: "#" }, "Click Here"), " to resend it. Be sure to check your spam folder.")), index.h("div", { style: { display: 'flex', flexDirection: 'row', gap: '20px' } }, index.h("verdocs-button", { label: "Back", disabled: this.submitting, onClick: () => {
316
316
  this.signupStep = 2;
317
317
  }, style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }), index.h("verdocs-button", { label: "Go to Dashboard", disabled: true, onClick: () => this.handleSignup(), style: { display: 'flex', justifyContent: 'center', margin: '30px auto 0' } }))))));
318
318
  }
319
319
  if (this.displayMode === 'forgot') {
320
- return (index.h("div", { class: "form" }, index.h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), index.h("h3", null, "Forgot your password?"), index.h("p", null, "Enter your e-mail address below, and reset instructions will be sent to your Inbox."), index.h("p", null, index.h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), index.h("form", { onSubmit: () => this.handleSignup() }, index.h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), index.h("div", { style: { marginTop: '30px' } }), index.h("div", { class: "buttons" }, index.h("verdocs-button", { label: "Cancel", variant: "outline", disabled: this.submitting, onClick: () => (this.displayMode = 'login') }), index.h("verdocs-button", { label: "Reset", disabled: this.submitting, onClick: () => this.handleReset() })))));
320
+ return (index.h("div", { class: "form" }, index.h("a", { href: "https://verdocs.com/en/" }, index.h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), index.h("h3", null, "Forgot your password?"), index.h("p", null, "Enter your e-mail address below, and reset instructions will be sent to your Inbox."), index.h("p", null, index.h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), index.h("form", { onSubmit: () => this.handleSignup() }, index.h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), index.h("div", { style: { marginTop: '30px' } }), index.h("div", { class: "buttons" }, index.h("verdocs-button", { label: "Cancel", variant: "outline", disabled: this.submitting, onClick: () => (this.displayMode = 'login') }), index.h("verdocs-button", { label: "Reset", disabled: this.submitting, onClick: () => this.handleReset() })))));
321
321
  }
322
322
  if (this.displayMode === 'verify') {
323
323
  return (index.h("div", { class: "form" }, index.h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), index.h("h3", null, "Please Verify your Email Address"), index.h("p", null, "Check your e-mail inbox for a verification email, and follow the instructions provided."), index.h("p", null, index.h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), index.h("div", { class: "buttons" }, index.h("verdocs-button", { label: "Sign Out", variant: "outline", disabled: this.submitting, onClick: () => {
@@ -327,7 +327,7 @@ const VerdocsAuth = class {
327
327
  this.displayMode = 'login';
328
328
  } }), index.h("verdocs-button", { label: "Resend Email", disabled: this.resendDisabled, onClick: () => this.handleResend() }))));
329
329
  }
330
- return (index.h("div", { class: "form" }, index.h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), index.h("h3", null, "Log in to your account"), index.h("h4", null, "Don't have an account?", index.h("verdocs-button", { label: "Sign Up", variant: "text", onClick: () => {
330
+ return (index.h("div", { class: "form" }, index.h("a", { href: "https://verdocs.com/en/" }, index.h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), index.h("h3", null, "Log in to your account"), index.h("h4", null, "Don't have an account?", index.h("verdocs-button", { label: "Sign Up", variant: "text", onClick: () => {
331
331
  this.displayMode = 'signup';
332
332
  this.signupStep = 1;
333
333
  }, disabled: this.submitting })), index.h("form", { onSubmit: () => this.loginAndCheckVerification() }, index.h("verdocs-text-input", { label: "Email", autocomplete: "username", value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), index.h("verdocs-text-input", { label: "Password", type: "password", autocomplete: "current-password", value: this.password, onInput: (e) => (this.password = e.target.value), disabled: this.submitting }), index.h("verdocs-button", { label: "Forgot Your Password?", variant: "text", onClick: () => (this.displayMode = 'forgot'), disabled: this.submitting, style: { display: 'flex', justifyContent: 'center', margin: '10px auto 20px' } }), index.h("verdocs-button", { label: "Login", disabled: this.submitting, onClick: () => this.loginAndCheckVerification(), style: { display: 'flex', justifyContent: 'center', margin: '10px auto 0' } }))));
@@ -284,7 +284,7 @@ const VerdocsEnvelopeSidebar = class {
284
284
  // TODO: Details dialog
285
285
  // {id:'details',label: 'View Details'},
286
286
  ] }))), index.h("dic", { class: "recipient-content" }, index.h("div", { class: "recipient-name" }, recipient.full_name), index.h("div", { class: "recipient-name" }, recipient.email), index.h("div", { class: "recipient-name" }, recipient.phone))));
287
- }), isEnvelopeOwner && (index.h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Turn On Reminders", onClick: () => (this.showManageDialog = !functionsDisabled), disabled: functionsDisabled })), isEnvelopeOwner && (index.h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (index.h("div", { class: "content" }, index.h("div", { class: "title" }, "History"), historyEntries.map(entry => (index.h("div", { class: "history-entry" }, index.h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), index.h("div", { class: "activity-details" }, index.h("div", { class: "activity-text" }, entry.message), index.h("div", { class: "activity-date" }, index$1.format(entry.date, Types.FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (index.h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (index.h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
287
+ }), isEnvelopeOwner && (index.h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (index.h("div", { class: "content" }, index.h("div", { class: "title" }, "History"), historyEntries.map(entry => (index.h("div", { class: "history-entry" }, index.h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), index.h("div", { class: "activity-details" }, index.h("div", { class: "activity-text" }, entry.message), index.h("div", { class: "activity-date" }, index$1.format(entry.date, Types.FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (index.h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (index.h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
288
288
  var _a;
289
289
  this.showManageDialog = false;
290
290
  (_a = this.another) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
@@ -154,6 +154,9 @@ const VerdocsSend = class {
154
154
  rolesAtLevel[level] || (rolesAtLevel[level] = []);
155
155
  const id = `r-${level}-${rolesAtLevel[level].length}`;
156
156
  rolesAtLevel[level].push({ ...role, id });
157
+ if (role.full_name && (role.email || role.phone)) {
158
+ this.rolesCompleted[id] = { ...role, id };
159
+ }
157
160
  });
158
161
  this.rolesAtLevel = rolesAtLevel;
159
162
  this.levels = Object.keys(rolesAtLevel).map(levelStr => +levelStr);
@@ -195,6 +198,10 @@ const VerdocsSend = class {
195
198
  }
196
199
  handleSend(e) {
197
200
  var _a, _b;
201
+ if (this.sending) {
202
+ console.log('Skipping duplicate send', e);
203
+ return;
204
+ }
198
205
  console.log('Sending', e);
199
206
  e.preventDefault();
200
207
  e.stopPropagation();
@@ -278,14 +278,14 @@ export class VerdocsAuth {
278
278
  }
279
279
  if (this.displayMode === 'signup') {
280
280
  const step1Invalid = this.submitting || !this.first || !this.last || !this.username || !this.password || !this.orgname || this.orgAvailable !== 'AVAILABLE';
281
- 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: () => {
281
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, 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: () => {
282
282
  console.log('blur');
283
283
  } }), !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: () => {
284
284
  this.signupStep = 2;
285
285
  }, 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' } }))))));
286
286
  }
287
287
  if (this.displayMode === 'forgot') {
288
- return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Forgot your password?"), h("p", null, "Enter your e-mail address below, and reset instructions will be sent to your Inbox."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("form", { onSubmit: () => this.handleSignup() }, h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("div", { style: { marginTop: '30px' } }), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", variant: "outline", disabled: this.submitting, onClick: () => (this.displayMode = 'login') }), h("verdocs-button", { label: "Reset", disabled: this.submitting, onClick: () => this.handleReset() })))));
288
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), h("h3", null, "Forgot your password?"), h("p", null, "Enter your e-mail address below, and reset instructions will be sent to your Inbox."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("form", { onSubmit: () => this.handleSignup() }, h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("div", { style: { marginTop: '30px' } }), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", variant: "outline", disabled: this.submitting, onClick: () => (this.displayMode = 'login') }), h("verdocs-button", { label: "Reset", disabled: this.submitting, onClick: () => this.handleReset() })))));
289
289
  }
290
290
  if (this.displayMode === 'verify') {
291
291
  return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Please Verify your Email Address"), h("p", null, "Check your e-mail inbox for a verification email, and follow the instructions provided."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("div", { class: "buttons" }, h("verdocs-button", { label: "Sign Out", variant: "outline", disabled: this.submitting, onClick: () => {
@@ -295,7 +295,7 @@ export class VerdocsAuth {
295
295
  this.displayMode = 'login';
296
296
  } }), h("verdocs-button", { label: "Resend Email", disabled: this.resendDisabled, onClick: () => this.handleResend() }))));
297
297
  }
298
- return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Log in to your account"), h("h4", null, "Don't have an account?", h("verdocs-button", { label: "Sign Up", variant: "text", onClick: () => {
298
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), h("h3", null, "Log in to your account"), h("h4", null, "Don't have an account?", h("verdocs-button", { label: "Sign Up", variant: "text", onClick: () => {
299
299
  this.displayMode = 'signup';
300
300
  this.signupStep = 1;
301
301
  }, disabled: this.submitting })), h("form", { onSubmit: () => this.loginAndCheckVerification() }, h("verdocs-text-input", { label: "Email", autocomplete: "username", value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Password", type: "password", autocomplete: "current-password", value: this.password, onInput: (e) => (this.password = e.target.value), disabled: this.submitting }), h("verdocs-button", { label: "Forgot Your Password?", variant: "text", onClick: () => (this.displayMode = 'forgot'), disabled: this.submitting, style: { display: 'flex', justifyContent: 'center', margin: '10px auto 20px' } }), h("verdocs-button", { label: "Login", disabled: this.submitting, onClick: () => this.loginAndCheckVerification(), style: { display: 'flex', justifyContent: 'center', margin: '10px auto 0' } }))));
@@ -3,7 +3,7 @@ export default {
3
3
  title: 'Embeds/Build',
4
4
  component: 'verdocs-build',
5
5
  args: {
6
- templateId: '',
6
+ templateId: 'd2338742-f3a1-465b-8592-806587413cc1',
7
7
  step: 'preview',
8
8
  },
9
9
  parameters: {
@@ -3,7 +3,7 @@ export default {
3
3
  title: 'Embeds/Preview',
4
4
  component: 'verdocs-preview',
5
5
  args: {
6
- templateId: '',
6
+ templateId: 'd2338742-f3a1-465b-8592-806587413cc1',
7
7
  },
8
8
  parameters: {
9
9
  layout: 'fullscreen',
@@ -60,6 +60,9 @@ export class VerdocsSend {
60
60
  rolesAtLevel[level] || (rolesAtLevel[level] = []);
61
61
  const id = `r-${level}-${rolesAtLevel[level].length}`;
62
62
  rolesAtLevel[level].push({ ...role, id });
63
+ if (role.full_name && (role.email || role.phone)) {
64
+ this.rolesCompleted[id] = { ...role, id };
65
+ }
63
66
  });
64
67
  this.rolesAtLevel = rolesAtLevel;
65
68
  this.levels = Object.keys(rolesAtLevel).map(levelStr => +levelStr);
@@ -102,6 +105,10 @@ export class VerdocsSend {
102
105
  }
103
106
  handleSend(e) {
104
107
  var _a, _b;
108
+ if (this.sending) {
109
+ console.log('Skipping duplicate send', e);
110
+ return;
111
+ }
105
112
  console.log('Sending', e);
106
113
  e.preventDefault();
107
114
  e.stopPropagation();
@@ -3,7 +3,7 @@ export default {
3
3
  title: 'Embeds/Send',
4
4
  component: 'verdocs-send',
5
5
  args: {
6
- templateId: '',
6
+ templateId: 'd2338742-f3a1-465b-8592-806587413cc1',
7
7
  },
8
8
  argTypes: {
9
9
  onSend: { action: 'send' },
@@ -3,9 +3,9 @@ export default {
3
3
  title: 'Embeds/Sign',
4
4
  component: 'verdocs-sign',
5
5
  args: {
6
- envelopeId: '',
7
- roleId: '',
8
- inviteCode: '',
6
+ envelopeId: '9653e0bc-40f9-4be7-82e4-b4dee0df6100',
7
+ roleId: 'Seller',
8
+ inviteCode: '71d0ba2c315cac1f8c7282c2f707791e',
9
9
  },
10
10
  argTypes: {
11
11
  envelopeId: {
@@ -3,7 +3,7 @@ export default {
3
3
  title: 'Embeds/View',
4
4
  component: 'verdocs-view',
5
5
  args: {
6
- envelopeId: '',
6
+ envelopeId: '9653e0bc-40f9-4be7-82e4-b4dee0df6100',
7
7
  },
8
8
  argTypes: {
9
9
  envelopeId: {
@@ -274,7 +274,7 @@ export class VerdocsEnvelopeSidebar {
274
274
  // TODO: Details dialog
275
275
  // {id:'details',label: 'View Details'},
276
276
  ] }))), h("dic", { class: "recipient-content" }, h("div", { class: "recipient-name" }, recipient.full_name), h("div", { class: "recipient-name" }, recipient.email), h("div", { class: "recipient-name" }, recipient.phone))));
277
- }), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Turn On Reminders", onClick: () => (this.showManageDialog = !functionsDisabled), disabled: functionsDisabled })), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (h("div", { class: "content" }, h("div", { class: "title" }, "History"), historyEntries.map(entry => (h("div", { class: "history-entry" }, h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), h("div", { class: "activity-details" }, h("div", { class: "activity-text" }, entry.message), h("div", { class: "activity-date" }, format(entry.date, FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
277
+ }), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (h("div", { class: "content" }, h("div", { class: "title" }, "History"), historyEntries.map(entry => (h("div", { class: "history-entry" }, h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), h("div", { class: "activity-details" }, h("div", { class: "activity-text" }, entry.message), h("div", { class: "activity-date" }, format(entry.date, FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
278
278
  var _a;
279
279
  this.showManageDialog = false;
280
280
  (_a = this.another) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
@@ -3,7 +3,7 @@ export default {
3
3
  title: 'Envelopes/Envelope Sidebar',
4
4
  component: 'verdocs-envelope-sidebar',
5
5
  args: {
6
- envelopeId: '',
6
+ envelopeId: '9653e0bc-40f9-4be7-82e4-b4dee0df6100',
7
7
  },
8
8
  argTypes: {
9
9
  envelopeId: { name: 'envelopeId' },
@@ -313,14 +313,14 @@ const VerdocsAuth$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
313
313
  }
314
314
  if (this.displayMode === 'signup') {
315
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: () => {
316
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, 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
317
  console.log('blur');
318
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: () => {
319
319
  this.signupStep = 2;
320
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' } }))))));
321
321
  }
322
322
  if (this.displayMode === 'forgot') {
323
- return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Forgot your password?"), h("p", null, "Enter your e-mail address below, and reset instructions will be sent to your Inbox."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("form", { onSubmit: () => this.handleSignup() }, h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("div", { style: { marginTop: '30px' } }), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", variant: "outline", disabled: this.submitting, onClick: () => (this.displayMode = 'login') }), h("verdocs-button", { label: "Reset", disabled: this.submitting, onClick: () => this.handleReset() })))));
323
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), h("h3", null, "Forgot your password?"), h("p", null, "Enter your e-mail address below, and reset instructions will be sent to your Inbox."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("form", { onSubmit: () => this.handleSignup() }, h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("div", { style: { marginTop: '30px' } }), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", variant: "outline", disabled: this.submitting, onClick: () => (this.displayMode = 'login') }), h("verdocs-button", { label: "Reset", disabled: this.submitting, onClick: () => this.handleReset() })))));
324
324
  }
325
325
  if (this.displayMode === 'verify') {
326
326
  return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Please Verify your Email Address"), h("p", null, "Check your e-mail inbox for a verification email, and follow the instructions provided."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("div", { class: "buttons" }, h("verdocs-button", { label: "Sign Out", variant: "outline", disabled: this.submitting, onClick: () => {
@@ -330,7 +330,7 @@ const VerdocsAuth$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
330
330
  this.displayMode = 'login';
331
331
  } }), h("verdocs-button", { label: "Resend Email", disabled: this.resendDisabled, onClick: () => this.handleResend() }))));
332
332
  }
333
- return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Log in to your account"), h("h4", null, "Don't have an account?", h("verdocs-button", { label: "Sign Up", variant: "text", onClick: () => {
333
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), h("h3", null, "Log in to your account"), h("h4", null, "Don't have an account?", h("verdocs-button", { label: "Sign Up", variant: "text", onClick: () => {
334
334
  this.displayMode = 'signup';
335
335
  this.signupStep = 1;
336
336
  }, disabled: this.submitting })), h("form", { onSubmit: () => this.loginAndCheckVerification() }, h("verdocs-text-input", { label: "Email", autocomplete: "username", value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Password", type: "password", autocomplete: "current-password", value: this.password, onInput: (e) => (this.password = e.target.value), disabled: this.submitting }), h("verdocs-button", { label: "Forgot Your Password?", variant: "text", onClick: () => (this.displayMode = 'forgot'), disabled: this.submitting, style: { display: 'flex', justifyContent: 'center', margin: '10px auto 20px' } }), h("verdocs-button", { label: "Login", disabled: this.submitting, onClick: () => this.loginAndCheckVerification(), style: { display: 'flex', justifyContent: 'center', margin: '10px auto 0' } }))));
@@ -285,7 +285,7 @@ const VerdocsEnvelopeSidebar$1 = /*@__PURE__*/ proxyCustomElement(class extends
285
285
  // TODO: Details dialog
286
286
  // {id:'details',label: 'View Details'},
287
287
  ] }))), h("dic", { class: "recipient-content" }, h("div", { class: "recipient-name" }, recipient.full_name), h("div", { class: "recipient-name" }, recipient.email), h("div", { class: "recipient-name" }, recipient.phone))));
288
- }), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Turn On Reminders", onClick: () => (this.showManageDialog = !functionsDisabled), disabled: functionsDisabled })), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (h("div", { class: "content" }, h("div", { class: "title" }, "History"), historyEntries.map(entry => (h("div", { class: "history-entry" }, h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), h("div", { class: "activity-details" }, h("div", { class: "activity-text" }, entry.message), h("div", { class: "activity-date" }, format(entry.date, FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
288
+ }), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (h("div", { class: "content" }, h("div", { class: "title" }, "History"), historyEntries.map(entry => (h("div", { class: "history-entry" }, h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), h("div", { class: "activity-details" }, h("div", { class: "activity-text" }, entry.message), h("div", { class: "activity-date" }, format(entry.date, FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
289
289
  var _a;
290
290
  this.showManageDialog = false;
291
291
  (_a = this.another) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
@@ -65,6 +65,9 @@ const VerdocsSend = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
65
65
  rolesAtLevel[level] || (rolesAtLevel[level] = []);
66
66
  const id = `r-${level}-${rolesAtLevel[level].length}`;
67
67
  rolesAtLevel[level].push({ ...role, id });
68
+ if (role.full_name && (role.email || role.phone)) {
69
+ this.rolesCompleted[id] = { ...role, id };
70
+ }
68
71
  });
69
72
  this.rolesAtLevel = rolesAtLevel;
70
73
  this.levels = Object.keys(rolesAtLevel).map(levelStr => +levelStr);
@@ -106,6 +109,10 @@ const VerdocsSend = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
106
109
  }
107
110
  handleSend(e) {
108
111
  var _a, _b;
112
+ if (this.sending) {
113
+ console.log('Skipping duplicate send', e);
114
+ return;
115
+ }
109
116
  console.log('Sending', e);
110
117
  e.preventDefault();
111
118
  e.stopPropagation();
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-10-23T13:50:12",
2
+ "timestamp": "2023-11-17T17:18:13",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "2.20.0",
@@ -306,14 +306,14 @@ const VerdocsAuth = class {
306
306
  }
307
307
  if (this.displayMode === 'signup') {
308
308
  const step1Invalid = this.submitting || !this.first || !this.last || !this.username || !this.password || !this.orgname || this.orgAvailable !== 'AVAILABLE';
309
- 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: () => {
309
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, 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: () => {
310
310
  console.log('blur');
311
311
  } }), !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: () => {
312
312
  this.signupStep = 2;
313
313
  }, 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' } }))))));
314
314
  }
315
315
  if (this.displayMode === 'forgot') {
316
- return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Forgot your password?"), h("p", null, "Enter your e-mail address below, and reset instructions will be sent to your Inbox."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("form", { onSubmit: () => this.handleSignup() }, h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("div", { style: { marginTop: '30px' } }), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", variant: "outline", disabled: this.submitting, onClick: () => (this.displayMode = 'login') }), h("verdocs-button", { label: "Reset", disabled: this.submitting, onClick: () => this.handleReset() })))));
316
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), h("h3", null, "Forgot your password?"), h("p", null, "Enter your e-mail address below, and reset instructions will be sent to your Inbox."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("form", { onSubmit: () => this.handleSignup() }, h("verdocs-text-input", { label: "Email", autocomplete: "email", required: true, value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("div", { style: { marginTop: '30px' } }), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", variant: "outline", disabled: this.submitting, onClick: () => (this.displayMode = 'login') }), h("verdocs-button", { label: "Reset", disabled: this.submitting, onClick: () => this.handleReset() })))));
317
317
  }
318
318
  if (this.displayMode === 'verify') {
319
319
  return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Please Verify your Email Address"), h("p", null, "Check your e-mail inbox for a verification email, and follow the instructions provided."), h("p", null, h("em", null, "Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")), h("div", { class: "buttons" }, h("verdocs-button", { label: "Sign Out", variant: "outline", disabled: this.submitting, onClick: () => {
@@ -323,7 +323,7 @@ const VerdocsAuth = class {
323
323
  this.displayMode = 'login';
324
324
  } }), h("verdocs-button", { label: "Resend Email", disabled: this.resendDisabled, onClick: () => this.handleResend() }))));
325
325
  }
326
- return (h("div", { class: "form" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" }), h("h3", null, "Log in to your account"), h("h4", null, "Don't have an account?", h("verdocs-button", { label: "Sign Up", variant: "text", onClick: () => {
326
+ return (h("div", { class: "form" }, h("a", { href: "https://verdocs.com/en/" }, h("img", { src: this.logo, alt: "Verdocs Logo", class: "logo" })), h("h3", null, "Log in to your account"), h("h4", null, "Don't have an account?", h("verdocs-button", { label: "Sign Up", variant: "text", onClick: () => {
327
327
  this.displayMode = 'signup';
328
328
  this.signupStep = 1;
329
329
  }, disabled: this.submitting })), h("form", { onSubmit: () => this.loginAndCheckVerification() }, h("verdocs-text-input", { label: "Email", autocomplete: "username", value: this.username, onInput: (e) => (this.username = e.target.value), disabled: this.submitting }), h("verdocs-text-input", { label: "Password", type: "password", autocomplete: "current-password", value: this.password, onInput: (e) => (this.password = e.target.value), disabled: this.submitting }), h("verdocs-button", { label: "Forgot Your Password?", variant: "text", onClick: () => (this.displayMode = 'forgot'), disabled: this.submitting, style: { display: 'flex', justifyContent: 'center', margin: '10px auto 20px' } }), h("verdocs-button", { label: "Login", disabled: this.submitting, onClick: () => this.loginAndCheckVerification(), style: { display: 'flex', justifyContent: 'center', margin: '10px auto 0' } }))));
@@ -280,7 +280,7 @@ const VerdocsEnvelopeSidebar = class {
280
280
  // TODO: Details dialog
281
281
  // {id:'details',label: 'View Details'},
282
282
  ] }))), h("dic", { class: "recipient-content" }, h("div", { class: "recipient-name" }, recipient.full_name), h("div", { class: "recipient-name" }, recipient.email), h("div", { class: "recipient-name" }, recipient.phone))));
283
- }), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Turn On Reminders", onClick: () => (this.showManageDialog = !functionsDisabled), disabled: functionsDisabled })), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (h("div", { class: "content" }, h("div", { class: "title" }, "History"), historyEntries.map(entry => (h("div", { class: "history-entry" }, h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), h("div", { class: "activity-details" }, h("div", { class: "activity-text" }, entry.message), h("div", { class: "activity-date" }, format(entry.date, FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
283
+ }), isEnvelopeOwner && (h("verdocs-button", { class: "manage-recipients-button", variant: "standard", label: "Cancel Verdoc", onClick: () => (this.showCancelDialog = !functionsDisabled), disabled: functionsDisabled })))), this.activeTab === 3 && (h("div", { class: "content" }, h("div", { class: "title" }, "History"), historyEntries.map(entry => (h("div", { class: "history-entry" }, h("div", { class: "activity-icon", innerHTML: ActivityIcons[entry.icon] || entry.icon }), h("div", { class: "activity-details" }, h("div", { class: "activity-text" }, entry.message), h("div", { class: "activity-date" }, format(entry.date, FORMAT_TIMESTAMP)))))))), this.showRecipientDialog && (h("verdocs-envelope-recipient-link", { envelopeId: this.envelopeId, roleName: this.showRecipientDialog, onNext: () => (this.showRecipientDialog = '') })), this.showManageDialog && (h("verdocs-envelope-recipient-summary", { envelopeId: this.envelopeId, canView: false, onAnother: () => {
284
284
  var _a;
285
285
  this.showManageDialog = false;
286
286
  (_a = this.another) === null || _a === void 0 ? void 0 : _a.emit({ envelope: this.store.state });
@@ -150,6 +150,9 @@ const VerdocsSend = class {
150
150
  rolesAtLevel[level] || (rolesAtLevel[level] = []);
151
151
  const id = `r-${level}-${rolesAtLevel[level].length}`;
152
152
  rolesAtLevel[level].push({ ...role, id });
153
+ if (role.full_name && (role.email || role.phone)) {
154
+ this.rolesCompleted[id] = { ...role, id };
155
+ }
153
156
  });
154
157
  this.rolesAtLevel = rolesAtLevel;
155
158
  this.levels = Object.keys(rolesAtLevel).map(levelStr => +levelStr);
@@ -191,6 +194,10 @@ const VerdocsSend = class {
191
194
  }
192
195
  handleSend(e) {
193
196
  var _a, _b;
197
+ if (this.sending) {
198
+ console.log('Skipping duplicate send', e);
199
+ return;
200
+ }
194
201
  console.log('Sending', e);
195
202
  e.preventDefault();
196
203
  e.stopPropagation();
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,n){function s(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n["throw"](e))}catch(e){o(e)}}function l(e){e.done?i(e.value):s(e.value).then(a,r)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,a;return a={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function r(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,s&&(o=a[0]&2?s["return"]:a[0]?s["throw"]||((o=s["return"])&&o.call(s),0):s.next)&&!(o=o.call(s,a[1])).done)return o;if(s=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];s=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h}from"./index-172625c5.js";import{d as decodeAccessTokenBody}from"./Types-5f31149e.js";import{c as createBusinessAccount,i as isOrgAvailable}from"./Profiles-4cc942ef.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-750b24e4.js";import{V as VerdocsToast}from"./Toast-f3b8fd46.js";import{S as SDKError}from"./errors-9b5498c8.js";var authenticateUser=function(e,t){return e.api.post("/authentication/login",t).then((function(e){return e.data}))};var resetPassword=function(e,t){return e.api.post("/user/reset_password",t).then((function(e){return e.data}))};var resendVerification=function(e,t){return e.api.post("/user/email_verification",{},t?{headers:{Authorization:"Bearer ".concat(t)}}:{}).then((function(e){return e.data}))};var 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}';var RECHECK_INTERVAL=5e3;var 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>';var 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>';var 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>';var Industries=[{value:"",label:""},{value:"Accounting & Tax",label:"Accounting & Tax"},{value:"Business Services / Consulting",label:"Business Services / Consulting"},{value:"Construction",label:"Construction"},{value:"Education",label:"Education"},{value:"Financial Services",label:"Financial Services"},{value:"Government",label:"Government"},{value:"Healthcare - Health Plans & Payers",label:"Healthcare - Health Plans & Payers"},{value:"Healthcare - Providers",label:"Healthcare - Providers"},{value:"Insurance",label:"Insurance"},{value:"Legal",label:"Legal"},{value:"Life Sciences",label:"Life Sciences"},{value:"Manufacturing",label:"Manufacturing"},{value:"Mortgage",label:"Mortgage"},{value:"Not For Profit",label:"Not For Profit"},{value:"Real Estate - Commercial",label:"Real Estate - Commercial"},{value:"Real Estate - Residential",label:"Real Estate - Residential"},{value:"Retail",label:"Retail"},{value:"Technology",label:"Technology"},{value:"Other",label:"Other"}];var Reasons=[{value:"",label:""},{value:"I want to send a document for signature.",label:"I want to send a document for signature."},{value:"I just need to sign a document today.",label:"I just need to sign a document today."},{value:"I'm evaluating it for my business.",label:"I'm evaluating it for my business."},{value:"I'm evaluating it for my personal use.",label:"I'm evaluating it for my personal use."},{value:"I'm a developer building an integration.",label:"I'm a developer building an integration."}];var CompanySizes=[{value:"",label:""},{value:"Solo",label:"Solo"},{value:"2-10",label:"2-10"},{value:"11-50",label:"11-50"},{value:"51-200",label:"51-200"},{value:"201-500",label:"201-500"},{value:"501-1000",label:"501-1000"},{value:"1000+",label:"1000+"}];var VerdocsAuth=function(){function e(e){registerInstance(this,e);this.authenticated=createEvent(this,"authenticated",7);this.sdkError=createEvent(this,"sdkError",7);this.recheckTimer=null;this.resendDisabledTimer=null;this.accessTokenForVerification=null;this.endpoint=VerdocsEndpoint.getDefault();this.visible=true;this.logo="https://app.verdocs.com/assets/blue-logo.svg";this.isAuthenticated=false;this.displayMode="login";this.orgname="";this.orgAvailable="UNKNOWN";this.first="";this.last="";this.username="";this.phone="";this.password="";this.submitting=false;this.activeSession=null;this.accountType="org";this.howHear="";this.industry="";this.companySize="";this.reason="";this.signupStep=1;this.resendDisabled=false;this.checkingOrg=false}e.prototype.componentWillLoad=function(){var e,t;this.endpoint.loadSession();if(this.endpoint.session){console.log("[AUTH] Authenticated");this.isAuthenticated=true;this.activeSession=this.endpoint.session;(e=this.authenticated)===null||e===void 0?void 0:e.emit({authenticated:true,session:this.endpoint.session})}else{console.log("[AUTH] Anonymous");(t=this.authenticated)===null||t===void 0?void 0:t.emit({authenticated:false,session:null})}};e.prototype.disconnectedCallback=function(){this.cancelRecheckTimer()};e.prototype.cancelRecheckTimer=function(){if(this.recheckTimer){try{clearTimeout(this.recheckTimer)}catch(e){}this.recheckTimer=null}if(this.resendDisabledTimer){try{clearTimeout(this.resendDisabledTimer)}catch(e){}this.resendDisabledTimer=null}};e.prototype.handleSignup=function(){var e=this;this.submitting=true;this.accessTokenForVerification=null;createBusinessAccount(this.endpoint,{email:this.username,password:this.password,firstName:this.first,lastName:this.last,orgName:this.orgname,industry:this.industry,size:this.companySize,reason:this.reason,hearabout:this.howHear}).then((function(t){console.log("Result",t);console.log("[AUTH] Created profile",t.profile);console.log("[AUTH] Created organization",t.organization);e.loginAndCheckVerification()})).catch((function(t){var i,n,s,o,a;console.log("[AUTH] Signup error",t.response,JSON.stringify(t));e.submitting=false;e.activeSession=null;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:false,session:null});(n=e.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(t.message,(s=t.response)===null||s===void 0?void 0:s.status,(o=t.response)===null||o===void 0?void 0:o.data));VerdocsToast("Signup failed: "+((a=t.response)===null||a===void 0?void 0:a.data),{style:"error"})}))};e.prototype.loginAndCheckVerification=function(){var e=this;this.submitting=true;this.accessTokenForVerification=null;authenticateUser(this.endpoint,{username:this.username,password:this.password}).then((function(t){var i;e.cancelRecheckTimer();e.submitting=false;var n=decodeAccessTokenBody(t.accessToken);console.log("[AUTH] Got access token body",n);if(n===null||n===void 0?void 0:n.email_verified){console.log("[AUTH] Email address is verified, completing login");e.displayMode="login";e.accessTokenForVerification=null;e.endpoint.setToken(t.accessToken);e.activeSession=e.endpoint.session;e.isAuthenticated=true;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:true,session:e.endpoint.session})}else{console.log("[AUTH] Logged in, pending email address verification");e.displayMode="verify";e.accessTokenForVerification=t.accessToken;e.recheckTimer=setTimeout((function(){return e.loginAndCheckVerification()}),RECHECK_INTERVAL)}})).catch((function(t){var i,n,s,o;e.cancelRecheckTimer();console.log("[AUTH] Authentication error",t.response,JSON.stringify(t));e.displayMode="login";e.submitting=false;e.activeSession=null;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:false,session:null});(n=e.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(t.message,(s=t.response)===null||s===void 0?void 0:s.status,(o=t.response)===null||o===void 0?void 0:o.data));VerdocsToast("Login failed. Please check your username and password and try again.",{style:"error"})}))};e.prototype.handleLogout=function(){var e;this.endpoint.clearSession();this.isAuthenticated=false;this.accessTokenForVerification=null;(e=this.authenticated)===null||e===void 0?void 0:e.emit({authenticated:false,session:null})};e.prototype.handleResend=function(){var e=this;this.resendDisabled=true;this.resendDisabledTimer=setTimeout((function(){e.resendDisabled=false;e.resendDisabledTimer=null}),3e4);resendVerification(this.endpoint,this.accessTokenForVerification).then((function(e){console.log("[AUTH] Verification request resent",e);VerdocsToast("Please check your email for a message with verification instructions.",{style:"info"})})).catch((function(e){console.log("[AUTH] Unable to resend verification",e)}))};e.prototype.handleReset=function(){var e=this;this.submitting=true;resetPassword(this.endpoint,{email:this.username}).then((function(t){console.log("[AUTH] Reset sent",t);e.submitting=false;e.displayMode="login";VerdocsToast("If your email address is registered, you will receive instructions on resetting your password shortly.",{style:"info"})})).catch((function(t){console.log("[AUTH] Unable to reset password",t);e.submitting=false}))};e.prototype.checkAvailability=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(n){switch(n.label){case 0:this.checkingOrg=true;n.label=1;case 1:n.trys.push([1,3,,4]);this.orgname=e;return[4,isOrgAvailable(this.endpoint,e)];case 2:t=n.sent();this.orgAvailable=t.result;console.log("response",this.orgAvailable);return[3,4];case 3:i=n.sent();this.orgAvailable="UNKNOWN";return[3,4];case 4:this.checkingOrg=false;return[2]}}))}))};e.prototype.render=function(){var e=this;if(!this.visible){return h("div",{style:{display:"none"}},"Authenticated")}if(this.isAuthenticated){return h("verdocs-button",{label:"Sign Out",disabled:this.submitting,onClick:function(){return e.handleLogout()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})}if(this.displayMode==="signup"){var t=this.submitting||!this.first||!this.last||!this.username||!this.password||!this.orgname||this.orgAvailable!=="AVAILABLE";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:function(){return e.displayMode="login"},disabled:this.submitting})),this.signupStep===1&&h("form",{onSubmit:function(){return e.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:function(t){return e.first=t.target.value},disabled:this.submitting}),h("verdocs-text-input",{label:"Last Name",autocomplete:"last",required:true,value:this.last,onInput:function(t){return e.last=t.target.value},disabled:this.submitting})),h("verdocs-text-input",{label:"Email",autocomplete:"email",required:true,value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),h("verdocs-text-input",{label:"Phone #",autocomplete:"phone",value:this.phone,onInput:function(t){return e.phone=t.target.value},disabled:this.submitting}),h("verdocs-text-input",{label:"Password",type:"password",required:true,autocomplete:"current-password",value:this.password,onInput:function(t){return e.password=t.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:function(t){return e.checkAvailability(t.target.value)},disabled:this.submitting,style:{flex:"1"},onBlur:function(){console.log("blur")}}),!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:t,onClick:function(){return e.signupStep=2},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})),this.signupStep===2&&h("form",{onSubmit:function(){return e.handleSignup()}},h("verdocs-text-input",{label:"How did you hear about Verdocs?",value:this.howHear,onInput:function(t){return e.howHear=t.target.value},disabled:this.submitting}),h("verdocs-select-input",{label:"Your Industry",options:Industries,value:this.industry,onInput:function(t){return e.industry=t.target.value},disabled:this.submitting}),h("verdocs-select-input",{label:"Company Size",options:CompanySizes,value:this.companySize,onInput:function(t){return e.companySize=t.target.value},disabled:this.submitting}),h("verdocs-select-input",{label:"Purpose",options:Reasons,value:this.reason,onInput:function(t){return e.reason=t.target.value},disabled:this.submitting}),h("div",{style:{marginTop:"30px"}}),h("verdocs-button",{label:"Create Account",disabled:this.submitting,onClick:function(){return e.handleSignup()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})),this.signupStep===3&&h("form",{onSubmit:function(){return e.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:function(){e.signupStep=2},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}}),h("verdocs-button",{label:"Go to Dashboard",disabled:true,onClick:function(){return e.handleSignup()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}}))))}if(this.displayMode==="forgot"){return h("div",{class:"form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Forgot your password?"),h("p",null,"Enter your e-mail address below, and reset instructions will be sent to your Inbox."),h("p",null,h("em",null,"Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")),h("form",{onSubmit:function(){return e.handleSignup()}},h("verdocs-text-input",{label:"Email",autocomplete:"email",required:true,value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),h("div",{style:{marginTop:"30px"}}),h("div",{class:"buttons"},h("verdocs-button",{label:"Cancel",variant:"outline",disabled:this.submitting,onClick:function(){return e.displayMode="login"}}),h("verdocs-button",{label:"Reset",disabled:this.submitting,onClick:function(){return e.handleReset()}}))))}if(this.displayMode==="verify"){return h("div",{class:"form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Please Verify your Email Address"),h("p",null,"Check your e-mail inbox for a verification email, and follow the instructions provided."),h("p",null,h("em",null,"Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")),h("div",{class:"buttons"},h("verdocs-button",{label:"Sign Out",variant:"outline",disabled:this.submitting,onClick:function(){e.username="";e.password="";e.cancelRecheckTimer();e.displayMode="login"}}),h("verdocs-button",{label:"Resend Email",disabled:this.resendDisabled,onClick:function(){return e.handleResend()}})))}return h("div",{class:"form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Log in to your account"),h("h4",null,"Don't have an account?",h("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){e.displayMode="signup";e.signupStep=1},disabled:this.submitting})),h("form",{onSubmit:function(){return e.loginAndCheckVerification()}},h("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),h("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onInput:function(t){return e.password=t.target.value},disabled:this.submitting}),h("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:function(){return e.displayMode="forgot"},disabled:this.submitting,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),h("verdocs-button",{label:"Login",disabled:this.submitting,onClick:function(){return e.loginAndCheckVerification()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})))};return e}();VerdocsAuth.style=verdocsAuthCss;export{VerdocsAuth as verdocs_auth};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,i,n){function s(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function r(e){try{l(n["throw"](e))}catch(e){o(e)}}function l(e){e.done?i(e.value):s(e.value).then(a,r)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,a;return a={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function r(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,s&&(o=a[0]&2?s["return"]:a[0]?s["throw"]||((o=s["return"])&&o.call(s),0):s.next)&&!(o=o.call(s,a[1])).done)return o;if(s=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];s=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h}from"./index-172625c5.js";import{d as decodeAccessTokenBody}from"./Types-5f31149e.js";import{c as createBusinessAccount,i as isOrgAvailable}from"./Profiles-4cc942ef.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-750b24e4.js";import{V as VerdocsToast}from"./Toast-f3b8fd46.js";import{S as SDKError}from"./errors-9b5498c8.js";var authenticateUser=function(e,t){return e.api.post("/authentication/login",t).then((function(e){return e.data}))};var resetPassword=function(e,t){return e.api.post("/user/reset_password",t).then((function(e){return e.data}))};var resendVerification=function(e,t){return e.api.post("/user/email_verification",{},t?{headers:{Authorization:"Bearer ".concat(t)}}:{}).then((function(e){return e.data}))};var 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}';var RECHECK_INTERVAL=5e3;var 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>';var 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>';var 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>';var Industries=[{value:"",label:""},{value:"Accounting & Tax",label:"Accounting & Tax"},{value:"Business Services / Consulting",label:"Business Services / Consulting"},{value:"Construction",label:"Construction"},{value:"Education",label:"Education"},{value:"Financial Services",label:"Financial Services"},{value:"Government",label:"Government"},{value:"Healthcare - Health Plans & Payers",label:"Healthcare - Health Plans & Payers"},{value:"Healthcare - Providers",label:"Healthcare - Providers"},{value:"Insurance",label:"Insurance"},{value:"Legal",label:"Legal"},{value:"Life Sciences",label:"Life Sciences"},{value:"Manufacturing",label:"Manufacturing"},{value:"Mortgage",label:"Mortgage"},{value:"Not For Profit",label:"Not For Profit"},{value:"Real Estate - Commercial",label:"Real Estate - Commercial"},{value:"Real Estate - Residential",label:"Real Estate - Residential"},{value:"Retail",label:"Retail"},{value:"Technology",label:"Technology"},{value:"Other",label:"Other"}];var Reasons=[{value:"",label:""},{value:"I want to send a document for signature.",label:"I want to send a document for signature."},{value:"I just need to sign a document today.",label:"I just need to sign a document today."},{value:"I'm evaluating it for my business.",label:"I'm evaluating it for my business."},{value:"I'm evaluating it for my personal use.",label:"I'm evaluating it for my personal use."},{value:"I'm a developer building an integration.",label:"I'm a developer building an integration."}];var CompanySizes=[{value:"",label:""},{value:"Solo",label:"Solo"},{value:"2-10",label:"2-10"},{value:"11-50",label:"11-50"},{value:"51-200",label:"51-200"},{value:"201-500",label:"201-500"},{value:"501-1000",label:"501-1000"},{value:"1000+",label:"1000+"}];var VerdocsAuth=function(){function e(e){registerInstance(this,e);this.authenticated=createEvent(this,"authenticated",7);this.sdkError=createEvent(this,"sdkError",7);this.recheckTimer=null;this.resendDisabledTimer=null;this.accessTokenForVerification=null;this.endpoint=VerdocsEndpoint.getDefault();this.visible=true;this.logo="https://app.verdocs.com/assets/blue-logo.svg";this.isAuthenticated=false;this.displayMode="login";this.orgname="";this.orgAvailable="UNKNOWN";this.first="";this.last="";this.username="";this.phone="";this.password="";this.submitting=false;this.activeSession=null;this.accountType="org";this.howHear="";this.industry="";this.companySize="";this.reason="";this.signupStep=1;this.resendDisabled=false;this.checkingOrg=false}e.prototype.componentWillLoad=function(){var e,t;this.endpoint.loadSession();if(this.endpoint.session){console.log("[AUTH] Authenticated");this.isAuthenticated=true;this.activeSession=this.endpoint.session;(e=this.authenticated)===null||e===void 0?void 0:e.emit({authenticated:true,session:this.endpoint.session})}else{console.log("[AUTH] Anonymous");(t=this.authenticated)===null||t===void 0?void 0:t.emit({authenticated:false,session:null})}};e.prototype.disconnectedCallback=function(){this.cancelRecheckTimer()};e.prototype.cancelRecheckTimer=function(){if(this.recheckTimer){try{clearTimeout(this.recheckTimer)}catch(e){}this.recheckTimer=null}if(this.resendDisabledTimer){try{clearTimeout(this.resendDisabledTimer)}catch(e){}this.resendDisabledTimer=null}};e.prototype.handleSignup=function(){var e=this;this.submitting=true;this.accessTokenForVerification=null;createBusinessAccount(this.endpoint,{email:this.username,password:this.password,firstName:this.first,lastName:this.last,orgName:this.orgname,industry:this.industry,size:this.companySize,reason:this.reason,hearabout:this.howHear}).then((function(t){console.log("Result",t);console.log("[AUTH] Created profile",t.profile);console.log("[AUTH] Created organization",t.organization);e.loginAndCheckVerification()})).catch((function(t){var i,n,s,o,a;console.log("[AUTH] Signup error",t.response,JSON.stringify(t));e.submitting=false;e.activeSession=null;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:false,session:null});(n=e.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(t.message,(s=t.response)===null||s===void 0?void 0:s.status,(o=t.response)===null||o===void 0?void 0:o.data));VerdocsToast("Signup failed: "+((a=t.response)===null||a===void 0?void 0:a.data),{style:"error"})}))};e.prototype.loginAndCheckVerification=function(){var e=this;this.submitting=true;this.accessTokenForVerification=null;authenticateUser(this.endpoint,{username:this.username,password:this.password}).then((function(t){var i;e.cancelRecheckTimer();e.submitting=false;var n=decodeAccessTokenBody(t.accessToken);console.log("[AUTH] Got access token body",n);if(n===null||n===void 0?void 0:n.email_verified){console.log("[AUTH] Email address is verified, completing login");e.displayMode="login";e.accessTokenForVerification=null;e.endpoint.setToken(t.accessToken);e.activeSession=e.endpoint.session;e.isAuthenticated=true;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:true,session:e.endpoint.session})}else{console.log("[AUTH] Logged in, pending email address verification");e.displayMode="verify";e.accessTokenForVerification=t.accessToken;e.recheckTimer=setTimeout((function(){return e.loginAndCheckVerification()}),RECHECK_INTERVAL)}})).catch((function(t){var i,n,s,o;e.cancelRecheckTimer();console.log("[AUTH] Authentication error",t.response,JSON.stringify(t));e.displayMode="login";e.submitting=false;e.activeSession=null;(i=e.authenticated)===null||i===void 0?void 0:i.emit({authenticated:false,session:null});(n=e.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(t.message,(s=t.response)===null||s===void 0?void 0:s.status,(o=t.response)===null||o===void 0?void 0:o.data));VerdocsToast("Login failed. Please check your username and password and try again.",{style:"error"})}))};e.prototype.handleLogout=function(){var e;this.endpoint.clearSession();this.isAuthenticated=false;this.accessTokenForVerification=null;(e=this.authenticated)===null||e===void 0?void 0:e.emit({authenticated:false,session:null})};e.prototype.handleResend=function(){var e=this;this.resendDisabled=true;this.resendDisabledTimer=setTimeout((function(){e.resendDisabled=false;e.resendDisabledTimer=null}),3e4);resendVerification(this.endpoint,this.accessTokenForVerification).then((function(e){console.log("[AUTH] Verification request resent",e);VerdocsToast("Please check your email for a message with verification instructions.",{style:"info"})})).catch((function(e){console.log("[AUTH] Unable to resend verification",e)}))};e.prototype.handleReset=function(){var e=this;this.submitting=true;resetPassword(this.endpoint,{email:this.username}).then((function(t){console.log("[AUTH] Reset sent",t);e.submitting=false;e.displayMode="login";VerdocsToast("If your email address is registered, you will receive instructions on resetting your password shortly.",{style:"info"})})).catch((function(t){console.log("[AUTH] Unable to reset password",t);e.submitting=false}))};e.prototype.checkAvailability=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(n){switch(n.label){case 0:this.checkingOrg=true;n.label=1;case 1:n.trys.push([1,3,,4]);this.orgname=e;return[4,isOrgAvailable(this.endpoint,e)];case 2:t=n.sent();this.orgAvailable=t.result;console.log("response",this.orgAvailable);return[3,4];case 3:i=n.sent();this.orgAvailable="UNKNOWN";return[3,4];case 4:this.checkingOrg=false;return[2]}}))}))};e.prototype.render=function(){var e=this;if(!this.visible){return h("div",{style:{display:"none"}},"Authenticated")}if(this.isAuthenticated){return h("verdocs-button",{label:"Sign Out",disabled:this.submitting,onClick:function(){return e.handleLogout()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})}if(this.displayMode==="signup"){var t=this.submitting||!this.first||!this.last||!this.username||!this.password||!this.orgname||this.orgAvailable!=="AVAILABLE";return h("div",{class:"form"},h("a",{href:"https://verdocs.com/en/"},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:function(){return e.displayMode="login"},disabled:this.submitting})),this.signupStep===1&&h("form",{onSubmit:function(){return e.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:function(t){return e.first=t.target.value},disabled:this.submitting}),h("verdocs-text-input",{label:"Last Name",autocomplete:"last",required:true,value:this.last,onInput:function(t){return e.last=t.target.value},disabled:this.submitting})),h("verdocs-text-input",{label:"Email",autocomplete:"email",required:true,value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),h("verdocs-text-input",{label:"Phone #",autocomplete:"phone",value:this.phone,onInput:function(t){return e.phone=t.target.value},disabled:this.submitting}),h("verdocs-text-input",{label:"Password",type:"password",required:true,autocomplete:"current-password",value:this.password,onInput:function(t){return e.password=t.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:function(t){return e.checkAvailability(t.target.value)},disabled:this.submitting,style:{flex:"1"},onBlur:function(){console.log("blur")}}),!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:t,onClick:function(){return e.signupStep=2},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})),this.signupStep===2&&h("form",{onSubmit:function(){return e.handleSignup()}},h("verdocs-text-input",{label:"How did you hear about Verdocs?",value:this.howHear,onInput:function(t){return e.howHear=t.target.value},disabled:this.submitting}),h("verdocs-select-input",{label:"Your Industry",options:Industries,value:this.industry,onInput:function(t){return e.industry=t.target.value},disabled:this.submitting}),h("verdocs-select-input",{label:"Company Size",options:CompanySizes,value:this.companySize,onInput:function(t){return e.companySize=t.target.value},disabled:this.submitting}),h("verdocs-select-input",{label:"Purpose",options:Reasons,value:this.reason,onInput:function(t){return e.reason=t.target.value},disabled:this.submitting}),h("div",{style:{marginTop:"30px"}}),h("verdocs-button",{label:"Create Account",disabled:this.submitting,onClick:function(){return e.handleSignup()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})),this.signupStep===3&&h("form",{onSubmit:function(){return e.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:function(){e.signupStep=2},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}}),h("verdocs-button",{label:"Go to Dashboard",disabled:true,onClick:function(){return e.handleSignup()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}}))))}if(this.displayMode==="forgot"){return h("div",{class:"form"},h("a",{href:"https://verdocs.com/en/"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),h("h3",null,"Forgot your password?"),h("p",null,"Enter your e-mail address below, and reset instructions will be sent to your Inbox."),h("p",null,h("em",null,"Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")),h("form",{onSubmit:function(){return e.handleSignup()}},h("verdocs-text-input",{label:"Email",autocomplete:"email",required:true,value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),h("div",{style:{marginTop:"30px"}}),h("div",{class:"buttons"},h("verdocs-button",{label:"Cancel",variant:"outline",disabled:this.submitting,onClick:function(){return e.displayMode="login"}}),h("verdocs-button",{label:"Reset",disabled:this.submitting,onClick:function(){return e.handleReset()}}))))}if(this.displayMode==="verify"){return h("div",{class:"form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Please Verify your Email Address"),h("p",null,"Check your e-mail inbox for a verification email, and follow the instructions provided."),h("p",null,h("em",null,"Please allow up to 24 hours for delivery, and check your spam folder if you do not receive the message. ")),h("div",{class:"buttons"},h("verdocs-button",{label:"Sign Out",variant:"outline",disabled:this.submitting,onClick:function(){e.username="";e.password="";e.cancelRecheckTimer();e.displayMode="login"}}),h("verdocs-button",{label:"Resend Email",disabled:this.resendDisabled,onClick:function(){return e.handleResend()}})))}return h("div",{class:"form"},h("a",{href:"https://verdocs.com/en/"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"})),h("h3",null,"Log in to your account"),h("h4",null,"Don't have an account?",h("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){e.displayMode="signup";e.signupStep=1},disabled:this.submitting})),h("form",{onSubmit:function(){return e.loginAndCheckVerification()}},h("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onInput:function(t){return e.username=t.target.value},disabled:this.submitting}),h("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onInput:function(t){return e.password=t.target.value},disabled:this.submitting}),h("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:function(){return e.displayMode="forgot"},disabled:this.submitting,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),h("verdocs-button",{label:"Login",disabled:this.submitting,onClick:function(){return e.loginAndCheckVerification()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})))};return e}();VerdocsAuth.style=verdocsAuthCss;export{VerdocsAuth as verdocs_auth};