@verdocs/web-sdk 5.0.21 → 5.0.23
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-auth.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +1 -2
- package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.css +3 -0
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.css +2 -0
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +0 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/components/verdocs-auth.js +1 -1
- package/dist/components/verdocs-auth.js.map +1 -1
- package/dist/components/verdocs-sign.js +1 -2
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/esm/verdocs-auth.entry.js +1 -1
- package/dist/esm/verdocs-auth.entry.js.map +1 -1
- package/dist/esm/verdocs-sign.entry.js +1 -2
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-auth.entry.js +1 -1
- package/dist/esm-es5/verdocs-auth.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
- package/dist/verdocs-web-sdk/p-23d6f064.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-23d6f064.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-c4a10e58.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-c4a10e58.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-ccdc9c5b.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-ccdc9c5b.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
- package/dist/verdocs-web-sdk/p-fe4c5a36.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-fe4c5a36.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/verdocs-web-sdk/p-0bfebc86.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-0bfebc86.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-376c3d9d.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-376c3d9d.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-4e9e154f.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-4e9e154f.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-53ed63e9.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-53ed63e9.entry.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["verdocsAuthCss","VerdocsAuthStyle0","VerdocsAuth","this","resendDisabledTimer","tempAuthEndpoint","VerdocsEndpoint","baseURL","getDefault","getBaseURL","persist","class_1","prototype","componentWillLoad","_this","endpoint","loadSession","onSessionChanged","_endpoint","session","profile","_a","authenticated","emit","_b","isPasswordComplex","password","isUppercase","ch","test","isLowercase","isSpecialChar","countOfUpperCase","countOfLowerCase","countOfSpecialChar","i","length","charAt","handleSignup","VerdocsToast","style","confirmpass","submitting","clearSession","createProfile","email","first_name","last_name","org_name","then","r","console","log","setToken","access_token","displayMode","catch","e","response","sdkError","SDKError","message","_c","status","_d","data","_f","_e","error","handleVerification","verifyEmail","token","verificationCode","verificationResult","_g","sent","completeLogin","e_1","result","clearForms","loginAndCheckVerification","authenticate","username","grant_type","authResult","getMyUser","user","email_verified","e_2","resendDisabled","newPassword","handleLogout","handleResendVerification","setTimeout","resendVerification","handleResendReset","resetPassword","handleResetGetCode","e_3","handleResetPassword","code","new_password","resetResult","e_4","handleReset","e_5","render","visible","h","display","label","disabled","onClick","justifyContent","margin","invalid","class","href","src","logo","alt","variant","onSubmit","flexDirection","columnGap","autocomplete","required","value","onInput","target","type","flex","marginTop","size"],"sources":["src/components/embeds/verdocs-auth/verdocs-auth.scss?tag=verdocs-auth","src/components/embeds/verdocs-auth/verdocs-auth.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-auth {\n font-family: $verdocs-primary-font;\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n\n .form {\n width: 320px;\n display: flex;\n padding: 20px;\n max-width: 90%;\n align-items: center;\n flex-direction: column;\n box-sizing: border-box;\n justify-content: center;\n background: $verdocs-grey-4;\n }\n\n .logo {\n width: 128px;\n max-width: 100%;\n margin: 20px 0 30px;\n }\n\n h3 {\n text-align: center;\n font-weight: 400;\n font-size: 18px;\n line-height: 1.75;\n margin: 0;\n }\n\n em {\n font-size: 14px;\n margin: 15px 0;\n }\n\n .buttons {\n gap: 20px;\n margin: 20px 0 0 0;\n display: flex;\n flex-direction: row;\n justify-content: center;\n }\n\n .status-result {\n display: none;\n\n &.debug {\n white-space: pre-wrap;\n font-size: 14px;\n background: #fff;\n padding: 10px;\n display: block;\n flex-direction: row;\n justify-content: center;\n }\n }\n\n form {\n width: 100%;\n }\n\n verdocs-text-input {\n margin-bottom: 10px;\n }\n\n .account-option {\n gap: 8px;\n margin: 20px 0 8px 0;\n display: flex;\n flex-direction: row;\n }\n\n p {\n margin: 1em 0;\n font-size: 14px;\n }\n\n // Our <p>s are in a flex layout which prevents margins from collapsing because each item creates its own row\n p + p {\n margin-top: 0;\n }\n\n verdocs-help-icon {\n margin-top: 18px;\n display: flex;\n width: 32px;\n height: 32px;\n flex: 0 0 32px;\n }\n\n .already-have {\n margin: 0.5em 0;\n font-size: 14px;\n }\n}\n","import {TSession, VerdocsEndpoint, createProfile, authenticate, resendVerification, resetPassword, verifyEmail, IAuthenticateResponse, getMyUser, IProfile} from '@verdocs/js-sdk';\nimport {Component, Prop, State, h, Event, EventEmitter} from '@stencil/core';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\n\nexport interface IAuthStatus {\n authenticated: boolean;\n session: TSession;\n profile: IProfile | null;\n}\n\n/**\n * Display an authentication dialog that allows the user to login or sign up. If the user is\n * already authenticated with a valid session, this component will hide itself and fire the\n * success callback immediately. It is up to the host application to render the next appropriate\n * view for the application.\n *\n * To simplify UI development, a visibility flag can force this component to never display. This\n * allows you to subscribe to notifications from client apps without calling the lower-level JS SDK.\n *\n * This embed is responsive / mobile-friendly, but the calling application should provide at\n * least a 300px wide container to allow sufficient space for the required forms.\n *\n * ```ts\n * interface IAuthStatus {\n * authenticated: boolean;\n * session: TSession;\n * profile: IProfile | null;\n * }\n *\n * <verdocs-auth\n * onAuthenticated={({ detail }: { detail: IAuthStatus }) => console.log('Authentication state:', detail) }\n * onSdkError={({ detail }) => { console.log('SDK error', detail) }\n * />\n * ```\n */\n@Component({\n tag: 'verdocs-auth',\n styleUrl: 'verdocs-auth.scss',\n shadow: false,\n})\nexport class VerdocsAuth {\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * Normally, if the user has a valid session, this embed will be invisible, otherwise it will display\n * login / signup forms. If this is set to false, this embed will be invisible in both cases. Apps may\n * use this to verify if a user has a valid session without needing a separate call to Verdocs JS SDK.\n */\n @Prop() visible: boolean = true;\n\n /**\n * By default, a Verdocs logo will be displayed above the login/signup forms. This may be used to\n * override its source. (Alternatively, you may simply hide it via CSS overrides.) Logos should be\n * in SVG format for best results.\n */\n @Prop() logo: string = 'https://app.verdocs.com/assets/blue-logo.svg';\n\n /**\n * The display mode to start in.\n */\n @Prop({mutable: true}) displayMode: 'login' | 'forgot' | 'reset' | 'signup' | 'verify' = 'login';\n\n /**\n * Event fired when session authentication process has completed. Check the event\n * contents for completion status. This event will always be called at least once,\n * when the component is first rendered.\n */\n @Event({composed: true}) authenticated: EventEmitter<IAuthStatus>;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n @State() org_name: string = '';\n @State() first_name: string = '';\n @State() last_name: string = '';\n @State() email: string = '';\n @State() verificationCode: string = '';\n @State() newPassword: string = '';\n @State() password: string = '';\n @State() confirmpass: string = '';\n @State() submitting: boolean = false;\n @State() resendDisabled = false;\n @State() session: TSession = null;\n @State() profile: IProfile | null = null;\n\n resendDisabledTimer = null;\n\n // We can't instantly log in on the default endpoint because other listeners might see\n // its events and incorrectly trigger before we're done. So we manage our own temp\n // endpoint and pass the final tokens to the default once we're ready.\n tempAuthEndpoint = new VerdocsEndpoint({\n baseURL: VerdocsEndpoint.getDefault().getBaseURL(),\n persist: false,\n });\n\n componentWillLoad() {\n this.endpoint.loadSession();\n VerdocsEndpoint.getDefault().onSessionChanged((_endpoint, session, profile) => {\n this.session = session;\n this.profile = profile;\n if (session) {\n this.authenticated?.emit({authenticated: true, session, profile});\n } else {\n this.authenticated?.emit({authenticated: false, session, profile});\n }\n });\n }\n\n isPasswordComplex(password: string) {\n const isUppercase = (ch: string) => /[A-Z]/.test(ch);\n const isLowercase = (ch: string) => /[a-z]/.test(ch);\n const isSpecialChar = (ch: string) => /[`!@#$%^&*()_\\-+=\\[\\]{};':\"\\\\|,.<>\\/?~ ]/.test(ch);\n let countOfUpperCase = 0,\n countOfLowerCase = 0,\n countOfSpecialChar = 0;\n for (let i = 0; i < password.length; i++) {\n let ch = password.charAt(i);\n if (isUppercase(ch)) countOfUpperCase++;\n else if (isLowercase(ch)) countOfLowerCase++;\n else if (isSpecialChar(ch)) countOfSpecialChar++;\n }\n return password.length >= 8 && countOfLowerCase > 0 && countOfUpperCase > 0 && countOfSpecialChar > 0;\n }\n\n handleSignup() {\n if (!this.isPasswordComplex(this.password)) {\n VerdocsToast('Password must be at least 8 characters long and contain at least one uppercase, one lowercase, and one special character.', {style: 'error'});\n return;\n }\n\n if (this.password !== this.confirmpass) {\n VerdocsToast('Passwords do not match.', {style: 'error'});\n return;\n }\n\n this.submitting = true;\n this.tempAuthEndpoint.clearSession();\n createProfile(this.tempAuthEndpoint, {\n email: this.email,\n password: this.password,\n first_name: this.first_name,\n last_name: this.last_name,\n org_name: this.org_name,\n })\n .then(r => {\n console.log('[AUTH] Profile creation result', r);\n this.tempAuthEndpoint.setToken(r.access_token);\n // We can't clearForms because we need email to stick around\n this.password = '';\n this.first_name = '';\n this.last_name = '';\n this.org_name = '';\n this.displayMode = 'verify';\n this.submitting = false;\n })\n .catch(e => {\n console.log('[AUTH] Signup error', e.response);\n this.submitting = false;\n this.authenticated?.emit({authenticated: false, profile: null, session: null});\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n\n VerdocsToast('Signup failed: ' + e.response?.data?.error || 'Unknown Error', {style: 'error'});\n });\n }\n\n async handleVerification() {\n this.submitting = true;\n\n try {\n this.submitting = false;\n const verificationResult = await verifyEmail(this.tempAuthEndpoint, {email: this.email, token: this.verificationCode});\n VerdocsToast('Thank you for verifying your email address.', {style: 'success'});\n this.completeLogin(verificationResult);\n } catch (e) {\n this.submitting = false;\n console.log('Verification error', e);\n VerdocsToast('Verification error, please check the code and try again.');\n }\n }\n\n completeLogin(result: IAuthenticateResponse) {\n this.clearForms();\n this.tempAuthEndpoint.clearSession();\n this.endpoint.setToken(result.access_token);\n }\n\n async loginAndCheckVerification() {\n if (this.submitting) {\n return;\n }\n\n this.submitting = true;\n this.tempAuthEndpoint.clearSession();\n\n try {\n this.submitting = false;\n const authResult = await authenticate(this.tempAuthEndpoint, {username: this.email, password: this.password, grant_type: 'password'});\n console.log('[AUTH] Authenticated, checking email verification');\n this.tempAuthEndpoint.setToken(authResult.access_token);\n\n const user = await getMyUser(this.tempAuthEndpoint);\n console.log('Got user', user);\n\n if (!user.email_verified) {\n console.log('[AUTH] Logged in, pending email address verification');\n this.displayMode = 'verify';\n } else {\n console.log('[AUTH] Email address is verified, completing login');\n this.completeLogin(authResult);\n }\n } catch (e) {\n this.submitting = false;\n console.log('[AUTH] Auth failure', e.response?.data || e);\n VerdocsToast('Login failed. Please check your credentials and try again.', {style: 'error'});\n }\n }\n\n clearForms() {\n this.submitting = false;\n this.resendDisabled = false;\n this.email = '';\n this.password = '';\n this.newPassword = '';\n this.confirmpass = '';\n this.verificationCode = '';\n this.first_name = '';\n this.last_name = '';\n this.org_name = '';\n }\n\n handleLogout() {\n console.log('logging out');\n this.endpoint.clearSession();\n this.tempAuthEndpoint.clearSession();\n this.clearForms();\n this.displayMode = 'login';\n }\n\n handleResendVerification() {\n // Avoid the user just click-spamming this pathway. The server rate-limits this anyway so it's not a\n // security issue but it's a poor user experience to allow it.\n this.resendDisabled = true;\n this.resendDisabledTimer = setTimeout(() => {\n this.resendDisabled = false;\n this.resendDisabledTimer = null;\n }, 30000);\n\n resendVerification(this.tempAuthEndpoint)\n .then(r => {\n console.log('[AUTH] Verification request resent', r);\n VerdocsToast('Please check your email for a verification code.', {style: 'info'});\n })\n .catch((e: any) => {\n console.log('[AUTH] Unable to resend verification', e);\n VerdocsToast('Unable to resend code. Please try again later.', {style: 'error'});\n });\n }\n\n handleResendReset() {\n // Avoid the user just click-spamming this pathway. The server rate-limits this anyway so it's not a\n // security issue but it's a poor user experience to allow it.\n this.resendDisabled = true;\n this.resendDisabledTimer = setTimeout(() => {\n this.resendDisabled = false;\n this.resendDisabledTimer = null;\n }, 30000);\n\n resetPassword(this.tempAuthEndpoint, {email: this.email})\n .then(r => {\n console.log('[AUTH] Resend-code request resent', r);\n VerdocsToast('Please check your email again for a verification code.', {style: 'info'});\n })\n .catch((e: any) => {\n console.log('[AUTH] Unable to resend reset request', e);\n VerdocsToast('Unable to resend code. Please try again later.', {style: 'error'});\n });\n }\n\n async handleResetGetCode() {\n this.submitting = true;\n this.confirmpass = '';\n this.newPassword = '';\n\n try {\n this.submitting = false;\n const result = await resetPassword(this.endpoint, {email: this.email});\n console.log('[AUTH] Reset result', result);\n VerdocsToast('Please check your email inbox for a password reset code.', {style: 'success'});\n this.verificationCode = '';\n this.confirmpass = '';\n this.newPassword = '';\n this.displayMode = 'reset';\n } catch (e) {\n this.submitting = false;\n console.log('Reset request error', e);\n VerdocsToast('Request failed. Please check your email address and try again.');\n }\n }\n\n async handleResetPassword() {\n if (!this.isPasswordComplex(this.newPassword)) {\n VerdocsToast('Password must be at least 8 characters long and contain at least one uppercase, one lowercase, and one special character.', {style: 'error'});\n return;\n }\n\n if (this.newPassword !== this.confirmpass) {\n VerdocsToast('Passwords do not match.', {style: 'error'});\n return;\n }\n\n this.submitting = true;\n try {\n this.submitting = false;\n const resetResult = await resetPassword(this.endpoint, {email: this.email, code: this.verificationCode, new_password: this.newPassword});\n console.log('reset result', resetResult);\n VerdocsToast('Your password has been reset. You may now use your new password to login.', {style: 'success'});\n this.verificationCode = '';\n this.confirmpass = '';\n this.newPassword = '';\n this.password = '';\n this.displayMode = 'login';\n } catch (e) {\n this.submitting = false;\n console.log('Verification error', e);\n VerdocsToast('Verification error, please check the code and try again.');\n }\n }\n\n async handleReset() {\n this.submitting = true;\n\n try {\n const result = await resetPassword(this.endpoint, {email: this.email});\n console.log('[AUTH] Reset sent', result);\n this.submitting = false;\n this.displayMode = 'login';\n VerdocsToast('If your email address is registered, you will receive instructions on resetting your password shortly.', {style: 'info'});\n } catch (e) {\n console.log('[AUTH] Unable to reset password', e);\n this.submitting = false;\n VerdocsToast('Unable to reset password. Please check your email address and try again.', {style: 'error'});\n }\n }\n\n render() {\n if (!this.visible) {\n return <div style={{display: 'none'}}>Authenticated</div>;\n }\n\n if (this.session) {\n return (\n <verdocs-button\n label=\"Sign Out\"\n disabled={this.submitting}\n onClick={() => this.handleLogout()}\n style={{display: 'flex', justifyContent: 'center', margin: '30px auto 0'}}\n />\n );\n }\n\n if (this.displayMode === 'signup') {\n const invalid = this.submitting || !this.first_name || !this.last_name || !this.email || !this.password || !this.confirmpass || !this.org_name;\n\n return (\n <div class=\"form\">\n <a href=\"https://verdocs.com/en/\">\n <img src={this.logo} alt=\"Verdocs Logo\" class=\"logo\" />\n </a>\n\n <h3>Sign up for a free account</h3>\n <div class=\"already-have\">\n Already have an account?\n <verdocs-button label=\"Log In\" variant=\"text\" onClick={() => (this.displayMode = 'login')} disabled={this.submitting} />\n </div>\n\n <form onSubmit={() => this.handleSignup()}>\n <div style={{display: 'flex', flexDirection: 'row', columnGap: '20px'}}>\n <verdocs-text-input\n label=\"First Name\"\n autocomplete=\"first\"\n required={true}\n value={this.first_name}\n onInput={(e: any) => (this.first_name = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Last Name\"\n autocomplete=\"last\"\n required={true}\n value={this.last_name}\n onInput={(e: any) => (this.last_name = e.target.value)}\n disabled={this.submitting}\n />\n </div>\n <verdocs-text-input\n label=\"Email Address\"\n autocomplete=\"email\"\n required={true}\n value={this.email}\n onInput={(e: any) => (this.email = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Password\"\n type=\"password\"\n required={true}\n autocomplete=\"new-password\"\n value={this.password}\n onInput={(e: any) => (this.password = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Confirm Password\"\n type=\"password\"\n required={true}\n autocomplete=\"off\"\n value={this.confirmpass}\n onInput={(e: any) => (this.confirmpass = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Organization Name\"\n autocomplete=\"org\"\n required={true}\n value={this.org_name}\n onInput={(e: any) => (this.org_name = e.target.value)}\n disabled={this.submitting}\n style={{flex: '1'}}\n />\n\n <div style={{marginTop: '30px'}} />\n\n <verdocs-button\n label=\"Next\"\n disabled={invalid}\n onClick={invalid ? () => {} : () => this.handleSignup()}\n style={{display: 'flex', justifyContent: 'center', margin: '30px auto 0'}}\n />\n </form>\n </div>\n );\n }\n\n if (this.displayMode === 'verify') {\n return (\n <div class=\"form\">\n <form onSubmit={() => this.handleVerification()}>\n <p>Please check your e-mail inbox for a verification code and enter it below.</p>\n\n <verdocs-text-input\n label=\"Verification Code\"\n required={true}\n value={this.verificationCode}\n onInput={(e: any) => (this.verificationCode = e.target.value)}\n disabled={this.submitting}\n />\n\n <div class=\"buttons\">\n <verdocs-button label=\"Sign Out\" variant=\"outline\" disabled={this.submitting} onClick={() => this.handleLogout()} />\n <verdocs-button label=\"Verify\" disabled={this.submitting || !this.verificationCode || this.verificationCode.length !== 6} onClick={() => this.handleVerification()} />\n </div>\n <div class=\"buttons\">\n <verdocs-button variant=\"text\" label=\"Resend Code\" disabled={this.resendDisabled || this.submitting} onClick={() => this.handleResendVerification()} />\n </div>\n </form>\n </div>\n );\n }\n\n if (this.displayMode === 'forgot') {\n return (\n <div class=\"form\">\n <a href=\"https://verdocs.com/en/\">\n <img src={this.logo} alt=\"Verdocs Logo\" class=\"logo\" />\n </a>\n\n <h3>Forgot your password?</h3>\n\n <p>\n Enter your e-mail address below. If the e-mail address is valid, a password reset code will be sent to your inbox. Please allow up to 15 minutes to arrive, and check\n your spam folder if you do not receive the message.\n </p>\n\n <form onSubmit={() => this.handleResetGetCode()}>\n <verdocs-text-input\n label=\"Email Address\"\n autocomplete=\"email\"\n required={true}\n value={this.email}\n onInput={(e: any) => (this.email = e.target.value)}\n disabled={this.submitting}\n />\n\n <div style={{marginTop: '30px'}} />\n\n <div class=\"buttons\">\n <verdocs-button size=\"small\" label=\"Cancel\" variant=\"outline\" disabled={this.submitting} onClick={() => (this.displayMode = 'login')} />\n <verdocs-button size=\"small\" label=\"Request Code\" disabled={this.submitting} onClick={() => this.handleResetGetCode()} />\n </div>\n </form>\n </div>\n );\n }\n\n if (this.displayMode === 'reset') {\n return (\n <div class=\"form\">\n <a href=\"https://verdocs.com/en/\">\n <img src={this.logo} alt=\"Verdocs Logo\" class=\"logo\" />\n </a>\n\n <h3>Forgot your password?</h3>\n\n <p>\n Enter your e-mail address below, and reset instructions will be sent to your Inbox. Please allow up to 15 minutes to arrive. Check your spam folder if you do not\n receive the message.\n </p>\n\n <form onSubmit={() => this.handleResetPassword()}>\n <verdocs-text-input\n label=\"Verification Code\"\n required={true}\n value={this.verificationCode}\n onInput={(e: any) => (this.verificationCode = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Password\"\n type=\"password\"\n required={true}\n autocomplete=\"off\"\n value={this.newPassword}\n onInput={(e: any) => (this.newPassword = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Confirm Password\"\n type=\"password\"\n required={true}\n autocomplete=\"off\"\n value={this.confirmpass}\n onInput={(e: any) => (this.confirmpass = e.target.value)}\n disabled={this.submitting}\n />\n\n <div style={{marginTop: '30px'}} />\n\n <div class=\"buttons\">\n <verdocs-button label=\"Cancel\" variant=\"outline\" disabled={this.submitting} onClick={() => (this.displayMode = 'login')} />\n <verdocs-button label=\"Reset\" disabled={this.submitting} onClick={() => this.handleResetPassword()} />\n </div>\n\n <div class=\"buttons\">\n <verdocs-button variant=\"text\" label=\"Resend Code\" disabled={this.resendDisabled || this.submitting} onClick={() => this.handleResendReset()} />\n </div>\n </form>\n </div>\n );\n }\n\n return (\n <div class=\"form\">\n <a href=\"https://verdocs.com/en/\">\n <img src={this.logo} alt=\"Verdocs Logo\" class=\"logo\" />\n </a>\n\n <h3>Log in to your account</h3>\n <div class=\"already-have\">\n Don't have an account?\n <verdocs-button label=\"Sign Up\" variant=\"text\" onClick={() => (this.displayMode = 'signup')} disabled={this.submitting} />\n </div>\n\n <form onSubmit={() => this.loginAndCheckVerification()}>\n <verdocs-text-input label=\"Email\" autocomplete=\"username\" value={this.email} onInput={(e: any) => (this.email = e.target.value)} disabled={this.submitting} />\n <verdocs-text-input\n label=\"Password\"\n type=\"password\"\n autocomplete=\"current-password\"\n value={this.password}\n onInput={(e: any) => (this.password = e.target.value)}\n disabled={this.submitting}\n />\n\n <verdocs-button\n label=\"Forgot Your Password?\"\n variant=\"text\"\n onClick={() => (this.displayMode = 'forgot')}\n disabled={this.submitting}\n style={{display: 'flex', justifyContent: 'center', margin: '10px auto 20px'}}\n />\n\n <verdocs-button\n label=\"Login\"\n disabled={this.submitting}\n onClick={() => this.loginAndCheckVerification()}\n style={{display: 'flex', justif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DisabledTimer","tempAuthEndpoint","VerdocsEndpoint","baseURL","getDefault","getBaseURL","persist","class_1","prototype","componentWillLoad","_this","endpoint","loadSession","onSessionChanged","_endpoint","session","profile","_a","authenticated","emit","_b","isPasswordComplex","password","isUppercase","ch","test","isLowercase","isSpecialChar","countOfUpperCase","countOfLowerCase","countOfSpecialChar","i","length","charAt","handleSignup","VerdocsToast","style","confirmpass","submitting","clearSession","createProfile","email","first_name","last_name","org_name","then","r","console","log","setToken","access_token","displayMode","catch","e","response","sdkError","SDKError","message","_c","status","_d","data","_f","_e","error","handleVerification","verifyEmail","token","verificationCode","verificationResult","_g","sent","completeLogin","e_1","result","clearForms","loginAndCheckVerification","authenticate","username","grant_type","authResult","getMyUser","user","email_verified","e_2","resendDisabled","newPassword","handleLogout","handleResendVerification","setTimeout","resendVerification","handleResendReset","resetPassword","handleResetGetCode","e_3","handleResetPassword","code","new_password","resetResult","e_4","handleReset","e_5","render","visible","h","display","label","disabled","onClick","justifyContent","margin","invalid","class","href","src","logo","alt","variant","onSubmit","flexDirection","columnGap","autocomplete","required","value","onInput","target","type","flex","marginTop","size"],"sources":["src/components/embeds/verdocs-auth/verdocs-auth.scss?tag=verdocs-auth","src/components/embeds/verdocs-auth/verdocs-auth.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-auth {\n font-family: $verdocs-primary-font;\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n\n .form {\n width: 320px;\n display: flex;\n padding: 20px;\n max-width: 90%;\n align-items: center;\n flex-direction: column;\n box-sizing: border-box;\n justify-content: center;\n background: $verdocs-grey-4;\n }\n\n .logo {\n width: 128px;\n max-width: 100%;\n margin: 20px 0 30px;\n }\n\n h3 {\n color: $verdocs-grey-0;\n text-align: center;\n font-weight: 400;\n font-size: 18px;\n line-height: 1.75;\n margin: 0;\n }\n\n em {\n font-size: 14px;\n margin: 15px 0;\n }\n\n .buttons {\n gap: 20px;\n margin: 20px 0 0 0;\n display: flex;\n flex-direction: row;\n justify-content: center;\n }\n\n .status-result {\n display: none;\n\n &.debug {\n white-space: pre-wrap;\n font-size: 14px;\n background: #fff;\n padding: 10px;\n display: block;\n flex-direction: row;\n justify-content: center;\n }\n }\n\n form {\n width: 100%;\n }\n\n verdocs-text-input {\n margin-bottom: 10px;\n }\n\n .account-option {\n gap: 8px;\n margin: 20px 0 8px 0;\n display: flex;\n flex-direction: row;\n }\n\n p {\n color: $verdocs-grey-0;\n margin: 1em 0;\n font-size: 14px;\n }\n\n // Our <p>s are in a flex layout which prevents margins from collapsing because each item creates its own row\n p + p {\n margin-top: 0;\n }\n\n verdocs-help-icon {\n margin-top: 18px;\n display: flex;\n width: 32px;\n height: 32px;\n flex: 0 0 32px;\n }\n\n .already-have {\n color: $verdocs-grey-0;\n margin: 0.5em 0;\n font-size: 14px;\n }\n}\n","import {TSession, VerdocsEndpoint, createProfile, authenticate, resendVerification, resetPassword, verifyEmail, IAuthenticateResponse, getMyUser, IProfile} from '@verdocs/js-sdk';\nimport {Component, Prop, State, h, Event, EventEmitter} from '@stencil/core';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\n\nexport interface IAuthStatus {\n authenticated: boolean;\n session: TSession;\n profile: IProfile | null;\n}\n\n/**\n * Display an authentication dialog that allows the user to login or sign up. If the user is\n * already authenticated with a valid session, this component will hide itself and fire the\n * success callback immediately. It is up to the host application to render the next appropriate\n * view for the application.\n *\n * To simplify UI development, a visibility flag can force this component to never display. This\n * allows you to subscribe to notifications from client apps without calling the lower-level JS SDK.\n *\n * This embed is responsive / mobile-friendly, but the calling application should provide at\n * least a 300px wide container to allow sufficient space for the required forms.\n *\n * ```ts\n * interface IAuthStatus {\n * authenticated: boolean;\n * session: TSession;\n * profile: IProfile | null;\n * }\n *\n * <verdocs-auth\n * onAuthenticated={({ detail }: { detail: IAuthStatus }) => console.log('Authentication state:', detail) }\n * onSdkError={({ detail }) => { console.log('SDK error', detail) }\n * />\n * ```\n */\n@Component({\n tag: 'verdocs-auth',\n styleUrl: 'verdocs-auth.scss',\n shadow: false,\n})\nexport class VerdocsAuth {\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * Normally, if the user has a valid session, this embed will be invisible, otherwise it will display\n * login / signup forms. If this is set to false, this embed will be invisible in both cases. Apps may\n * use this to verify if a user has a valid session without needing a separate call to Verdocs JS SDK.\n */\n @Prop() visible: boolean = true;\n\n /**\n * By default, a Verdocs logo will be displayed above the login/signup forms. This may be used to\n * override its source. (Alternatively, you may simply hide it via CSS overrides.) Logos should be\n * in SVG format for best results.\n */\n @Prop() logo: string = 'https://app.verdocs.com/assets/blue-logo.svg';\n\n /**\n * The display mode to start in.\n */\n @Prop({mutable: true}) displayMode: 'login' | 'forgot' | 'reset' | 'signup' | 'verify' = 'login';\n\n /**\n * Event fired when session authentication process has completed. Check the event\n * contents for completion status. This event will always be called at least once,\n * when the component is first rendered.\n */\n @Event({composed: true}) authenticated: EventEmitter<IAuthStatus>;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n @State() org_name: string = '';\n @State() first_name: string = '';\n @State() last_name: string = '';\n @State() email: string = '';\n @State() verificationCode: string = '';\n @State() newPassword: string = '';\n @State() password: string = '';\n @State() confirmpass: string = '';\n @State() submitting: boolean = false;\n @State() resendDisabled = false;\n @State() session: TSession = null;\n @State() profile: IProfile | null = null;\n\n resendDisabledTimer = null;\n\n // We can't instantly log in on the default endpoint because other listeners might see\n // its events and incorrectly trigger before we're done. So we manage our own temp\n // endpoint and pass the final tokens to the default once we're ready.\n tempAuthEndpoint = new VerdocsEndpoint({\n baseURL: VerdocsEndpoint.getDefault().getBaseURL(),\n persist: false,\n });\n\n componentWillLoad() {\n this.endpoint.loadSession();\n VerdocsEndpoint.getDefault().onSessionChanged((_endpoint, session, profile) => {\n this.session = session;\n this.profile = profile;\n if (session) {\n this.authenticated?.emit({authenticated: true, session, profile});\n } else {\n this.authenticated?.emit({authenticated: false, session, profile});\n }\n });\n }\n\n isPasswordComplex(password: string) {\n const isUppercase = (ch: string) => /[A-Z]/.test(ch);\n const isLowercase = (ch: string) => /[a-z]/.test(ch);\n const isSpecialChar = (ch: string) => /[`!@#$%^&*()_\\-+=\\[\\]{};':\"\\\\|,.<>\\/?~ ]/.test(ch);\n let countOfUpperCase = 0,\n countOfLowerCase = 0,\n countOfSpecialChar = 0;\n for (let i = 0; i < password.length; i++) {\n let ch = password.charAt(i);\n if (isUppercase(ch)) countOfUpperCase++;\n else if (isLowercase(ch)) countOfLowerCase++;\n else if (isSpecialChar(ch)) countOfSpecialChar++;\n }\n return password.length >= 8 && countOfLowerCase > 0 && countOfUpperCase > 0 && countOfSpecialChar > 0;\n }\n\n handleSignup() {\n if (!this.isPasswordComplex(this.password)) {\n VerdocsToast('Password must be at least 8 characters long and contain at least one uppercase, one lowercase, and one special character.', {style: 'error'});\n return;\n }\n\n if (this.password !== this.confirmpass) {\n VerdocsToast('Passwords do not match.', {style: 'error'});\n return;\n }\n\n this.submitting = true;\n this.tempAuthEndpoint.clearSession();\n createProfile(this.tempAuthEndpoint, {\n email: this.email,\n password: this.password,\n first_name: this.first_name,\n last_name: this.last_name,\n org_name: this.org_name,\n })\n .then(r => {\n console.log('[AUTH] Profile creation result', r);\n this.tempAuthEndpoint.setToken(r.access_token);\n // We can't clearForms because we need email to stick around\n this.password = '';\n this.first_name = '';\n this.last_name = '';\n this.org_name = '';\n this.displayMode = 'verify';\n this.submitting = false;\n })\n .catch(e => {\n console.log('[AUTH] Signup error', e.response);\n this.submitting = false;\n this.authenticated?.emit({authenticated: false, profile: null, session: null});\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n\n VerdocsToast('Signup failed: ' + e.response?.data?.error || 'Unknown Error', {style: 'error'});\n });\n }\n\n async handleVerification() {\n this.submitting = true;\n\n try {\n this.submitting = false;\n const verificationResult = await verifyEmail(this.tempAuthEndpoint, {email: this.email, token: this.verificationCode});\n VerdocsToast('Thank you for verifying your email address.', {style: 'success'});\n this.completeLogin(verificationResult);\n } catch (e) {\n this.submitting = false;\n console.log('Verification error', e);\n VerdocsToast('Verification error, please check the code and try again.');\n }\n }\n\n completeLogin(result: IAuthenticateResponse) {\n this.clearForms();\n this.tempAuthEndpoint.clearSession();\n this.endpoint.setToken(result.access_token);\n }\n\n async loginAndCheckVerification() {\n if (this.submitting) {\n return;\n }\n\n this.submitting = true;\n this.tempAuthEndpoint.clearSession();\n\n try {\n this.submitting = false;\n const authResult = await authenticate(this.tempAuthEndpoint, {username: this.email, password: this.password, grant_type: 'password'});\n console.log('[AUTH] Authenticated, checking email verification');\n this.tempAuthEndpoint.setToken(authResult.access_token);\n\n const user = await getMyUser(this.tempAuthEndpoint);\n console.log('Got user', user);\n\n if (!user.email_verified) {\n console.log('[AUTH] Logged in, pending email address verification');\n this.displayMode = 'verify';\n } else {\n console.log('[AUTH] Email address is verified, completing login');\n this.completeLogin(authResult);\n }\n } catch (e) {\n this.submitting = false;\n console.log('[AUTH] Auth failure', e.response?.data || e);\n VerdocsToast('Login failed. Please check your credentials and try again.', {style: 'error'});\n }\n }\n\n clearForms() {\n this.submitting = false;\n this.resendDisabled = false;\n this.email = '';\n this.password = '';\n this.newPassword = '';\n this.confirmpass = '';\n this.verificationCode = '';\n this.first_name = '';\n this.last_name = '';\n this.org_name = '';\n }\n\n handleLogout() {\n console.log('logging out');\n this.endpoint.clearSession();\n this.tempAuthEndpoint.clearSession();\n this.clearForms();\n this.displayMode = 'login';\n }\n\n handleResendVerification() {\n // Avoid the user just click-spamming this pathway. The server rate-limits this anyway so it's not a\n // security issue but it's a poor user experience to allow it.\n this.resendDisabled = true;\n this.resendDisabledTimer = setTimeout(() => {\n this.resendDisabled = false;\n this.resendDisabledTimer = null;\n }, 30000);\n\n resendVerification(this.tempAuthEndpoint)\n .then(r => {\n console.log('[AUTH] Verification request resent', r);\n VerdocsToast('Please check your email for a verification code.', {style: 'info'});\n })\n .catch((e: any) => {\n console.log('[AUTH] Unable to resend verification', e);\n VerdocsToast('Unable to resend code. Please try again later.', {style: 'error'});\n });\n }\n\n handleResendReset() {\n // Avoid the user just click-spamming this pathway. The server rate-limits this anyway so it's not a\n // security issue but it's a poor user experience to allow it.\n this.resendDisabled = true;\n this.resendDisabledTimer = setTimeout(() => {\n this.resendDisabled = false;\n this.resendDisabledTimer = null;\n }, 30000);\n\n resetPassword(this.tempAuthEndpoint, {email: this.email})\n .then(r => {\n console.log('[AUTH] Resend-code request resent', r);\n VerdocsToast('Please check your email again for a verification code.', {style: 'info'});\n })\n .catch((e: any) => {\n console.log('[AUTH] Unable to resend reset request', e);\n VerdocsToast('Unable to resend code. Please try again later.', {style: 'error'});\n });\n }\n\n async handleResetGetCode() {\n this.submitting = true;\n this.confirmpass = '';\n this.newPassword = '';\n\n try {\n this.submitting = false;\n const result = await resetPassword(this.endpoint, {email: this.email});\n console.log('[AUTH] Reset result', result);\n VerdocsToast('Please check your email inbox for a password reset code.', {style: 'success'});\n this.verificationCode = '';\n this.confirmpass = '';\n this.newPassword = '';\n this.displayMode = 'reset';\n } catch (e) {\n this.submitting = false;\n console.log('Reset request error', e);\n VerdocsToast('Request failed. Please check your email address and try again.');\n }\n }\n\n async handleResetPassword() {\n if (!this.isPasswordComplex(this.newPassword)) {\n VerdocsToast('Password must be at least 8 characters long and contain at least one uppercase, one lowercase, and one special character.', {style: 'error'});\n return;\n }\n\n if (this.newPassword !== this.confirmpass) {\n VerdocsToast('Passwords do not match.', {style: 'error'});\n return;\n }\n\n this.submitting = true;\n try {\n this.submitting = false;\n const resetResult = await resetPassword(this.endpoint, {email: this.email, code: this.verificationCode, new_password: this.newPassword});\n console.log('reset result', resetResult);\n VerdocsToast('Your password has been reset. You may now use your new password to login.', {style: 'success'});\n this.verificationCode = '';\n this.confirmpass = '';\n this.newPassword = '';\n this.password = '';\n this.displayMode = 'login';\n } catch (e) {\n this.submitting = false;\n console.log('Verification error', e);\n VerdocsToast('Verification error, please check the code and try again.');\n }\n }\n\n async handleReset() {\n this.submitting = true;\n\n try {\n const result = await resetPassword(this.endpoint, {email: this.email});\n console.log('[AUTH] Reset sent', result);\n this.submitting = false;\n this.displayMode = 'login';\n VerdocsToast('If your email address is registered, you will receive instructions on resetting your password shortly.', {style: 'info'});\n } catch (e) {\n console.log('[AUTH] Unable to reset password', e);\n this.submitting = false;\n VerdocsToast('Unable to reset password. Please check your email address and try again.', {style: 'error'});\n }\n }\n\n render() {\n if (!this.visible) {\n return <div style={{display: 'none'}}>Authenticated</div>;\n }\n\n if (this.session) {\n return (\n <verdocs-button\n label=\"Sign Out\"\n disabled={this.submitting}\n onClick={() => this.handleLogout()}\n style={{display: 'flex', justifyContent: 'center', margin: '30px auto 0'}}\n />\n );\n }\n\n if (this.displayMode === 'signup') {\n const invalid = this.submitting || !this.first_name || !this.last_name || !this.email || !this.password || !this.confirmpass || !this.org_name;\n\n return (\n <div class=\"form\">\n <a href=\"https://verdocs.com/en/\">\n <img src={this.logo} alt=\"Verdocs Logo\" class=\"logo\" />\n </a>\n\n <h3>Sign up for a free account</h3>\n <div class=\"already-have\">\n Already have an account?\n <verdocs-button label=\"Log In\" variant=\"text\" onClick={() => (this.displayMode = 'login')} disabled={this.submitting} />\n </div>\n\n <form onSubmit={() => this.handleSignup()}>\n <div style={{display: 'flex', flexDirection: 'row', columnGap: '20px'}}>\n <verdocs-text-input\n label=\"First Name\"\n autocomplete=\"first\"\n required={true}\n value={this.first_name}\n onInput={(e: any) => (this.first_name = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Last Name\"\n autocomplete=\"last\"\n required={true}\n value={this.last_name}\n onInput={(e: any) => (this.last_name = e.target.value)}\n disabled={this.submitting}\n />\n </div>\n <verdocs-text-input\n label=\"Email Address\"\n autocomplete=\"email\"\n required={true}\n value={this.email}\n onInput={(e: any) => (this.email = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Password\"\n type=\"password\"\n required={true}\n autocomplete=\"new-password\"\n value={this.password}\n onInput={(e: any) => (this.password = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Confirm Password\"\n type=\"password\"\n required={true}\n autocomplete=\"off\"\n value={this.confirmpass}\n onInput={(e: any) => (this.confirmpass = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Organization Name\"\n autocomplete=\"org\"\n required={true}\n value={this.org_name}\n onInput={(e: any) => (this.org_name = e.target.value)}\n disabled={this.submitting}\n style={{flex: '1'}}\n />\n\n <div style={{marginTop: '30px'}} />\n\n <verdocs-button\n label=\"Next\"\n disabled={invalid}\n onClick={invalid ? () => {} : () => this.handleSignup()}\n style={{display: 'flex', justifyContent: 'center', margin: '30px auto 0'}}\n />\n </form>\n </div>\n );\n }\n\n if (this.displayMode === 'verify') {\n return (\n <div class=\"form\">\n <form onSubmit={() => this.handleVerification()}>\n <p>Please check your e-mail inbox for a verification code and enter it below.</p>\n\n <verdocs-text-input\n label=\"Verification Code\"\n required={true}\n value={this.verificationCode}\n onInput={(e: any) => (this.verificationCode = e.target.value)}\n disabled={this.submitting}\n />\n\n <div class=\"buttons\">\n <verdocs-button label=\"Sign Out\" variant=\"outline\" disabled={this.submitting} onClick={() => this.handleLogout()} />\n <verdocs-button label=\"Verify\" disabled={this.submitting || !this.verificationCode || this.verificationCode.length !== 6} onClick={() => this.handleVerification()} />\n </div>\n <div class=\"buttons\">\n <verdocs-button variant=\"text\" label=\"Resend Code\" disabled={this.resendDisabled || this.submitting} onClick={() => this.handleResendVerification()} />\n </div>\n </form>\n </div>\n );\n }\n\n if (this.displayMode === 'forgot') {\n return (\n <div class=\"form\">\n <a href=\"https://verdocs.com/en/\">\n <img src={this.logo} alt=\"Verdocs Logo\" class=\"logo\" />\n </a>\n\n <h3>Forgot your password?</h3>\n\n <p>\n Enter your e-mail address below. If the e-mail address is valid, a password reset code will be sent to your inbox. Please allow up to 15 minutes to arrive, and check\n your spam folder if you do not receive the message.\n </p>\n\n <form onSubmit={() => this.handleResetGetCode()}>\n <verdocs-text-input\n label=\"Email Address\"\n autocomplete=\"email\"\n required={true}\n value={this.email}\n onInput={(e: any) => (this.email = e.target.value)}\n disabled={this.submitting}\n />\n\n <div style={{marginTop: '30px'}} />\n\n <div class=\"buttons\">\n <verdocs-button size=\"small\" label=\"Cancel\" variant=\"outline\" disabled={this.submitting} onClick={() => (this.displayMode = 'login')} />\n <verdocs-button size=\"small\" label=\"Request Code\" disabled={this.submitting} onClick={() => this.handleResetGetCode()} />\n </div>\n </form>\n </div>\n );\n }\n\n if (this.displayMode === 'reset') {\n return (\n <div class=\"form\">\n <a href=\"https://verdocs.com/en/\">\n <img src={this.logo} alt=\"Verdocs Logo\" class=\"logo\" />\n </a>\n\n <h3>Forgot your password?</h3>\n\n <p>\n Enter your e-mail address below, and reset instructions will be sent to your Inbox. Please allow up to 15 minutes to arrive. Check your spam folder if you do not\n receive the message.\n </p>\n\n <form onSubmit={() => this.handleResetPassword()}>\n <verdocs-text-input\n label=\"Verification Code\"\n required={true}\n value={this.verificationCode}\n onInput={(e: any) => (this.verificationCode = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Password\"\n type=\"password\"\n required={true}\n autocomplete=\"off\"\n value={this.newPassword}\n onInput={(e: any) => (this.newPassword = e.target.value)}\n disabled={this.submitting}\n />\n <verdocs-text-input\n label=\"Confirm Password\"\n type=\"password\"\n required={true}\n autocomplete=\"off\"\n value={this.confirmpass}\n onInput={(e: any) => (this.confirmpass = e.target.value)}\n disabled={this.submitting}\n />\n\n <div style={{marginTop: '30px'}} />\n\n <div class=\"buttons\">\n <verdocs-button label=\"Cancel\" variant=\"outline\" disabled={this.submitting} onClick={() => (this.displayMode = 'login')} />\n <verdocs-button label=\"Reset\" disabled={this.submitting} onClick={() => this.handleResetPassword()} />\n </div>\n\n <div class=\"buttons\">\n <verdocs-button variant=\"text\" label=\"Resend Code\" disabled={this.resendDisabled || this.submitting} onClick={() => this.handleResendReset()} />\n </div>\n </form>\n </div>\n );\n }\n\n return (\n <div class=\"form\">\n <a href=\"https://verdocs.com/en/\">\n <img src={this.logo} alt=\"Verdocs Logo\" class=\"logo\" />\n </a>\n\n <h3>Log in to your account</h3>\n <div class=\"already-have\">\n Don't have an account?\n <verdocs-button label=\"Sign Up\" variant=\"text\" onClick={() => (this.displayMode = 'signup')} disabled={this.submitting} />\n </div>\n\n <form onSubmit={() => this.loginAndCheckVerification()}>\n <verdocs-text-input label=\"Email\" autocomplete=\"username\" value={this.email} onInput={(e: any) => (this.email = e.target.value)} disabled={this.submitting} />\n <verdocs-text-input\n label=\"Password\"\n type=\"password\"\n autocomplete=\"current-password\"\n value={this.password}\n onInput={(e: any) => (this.password = e.target.value)}\n disabled={this.submitting}\n />\n\n <verdocs-button\n label=\"Forgot Your Password?\"\n variant=\"text\"\n onClick={() => (this.displayMode = 'forgot')}\n disabled={this.submitting}\n style={{display: 'flex', justifyContent: 'center', margin: '10px auto 20px'}}\n />\n\n <verdocs-button\n label=\"Login\"\n disabled={this.submitting}\n onClick={() => this.loginAndCheckVerification()}\n style={{display: 'flex', justifyContent: 'center', margin: '10px auto 0'}}\n />\n </form>\n </div>\n );\n }\n}\n"],"mappings":"0vDAAA,IAAMA,eAAiB,o9DACvB,IAAAC,kBAAeD,e,ICwCFE,YAAW,W,2IAmDtBC,KAAAC,oBAAsB,KAKtBD,KAAAE,iBAAmB,IAAIC,gBAAgB,CACrCC,QAASD,gBAAgBE,aAAaC,aACtCC,QAAS,Q,cAtDyBJ,gBAAgBE,a,aAOzB,K,UAOJ,+C,iBAKkE,Q,cAe7D,G,gBACE,G,eACD,G,WACJ,G,sBACW,G,iBACL,G,cACH,G,iBACG,G,gBACA,M,oBACL,M,aACG,K,aACO,I,CAYpCG,EAAAC,UAAAC,kBAAA,eAAAC,EAAA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,QAAMc,SAAU,WAAM,OAAA5G,EAAKkE,2BAAL,GACpB4B,EAAA,sBAAoBE,MAAM,QAAQe,aAAa,WAAWE,MAAO5H,KAAK0C,MAAOmF,QAAS,SAACvE,GAAM,OAAM3C,EAAK+B,MAAQY,EAAEwE,OAAOF,KAA5B,EAAoChB,SAAU5G,KAAKuC,aAChJkE,EAAA,sBACEE,MAAM,WACNoB,KAAK,WACLL,aAAa,mBACbE,MAAO5H,KAAKuB,SACZsG,QAAS,SAACvE,GAAM,OAAM3C,EAAKY,SAAW+B,EAAEwE,OAAOF,KAA/B,EAChBhB,SAAU5G,KAAKuC,aAGjBkE,EAAA,kBACEE,MAAM,wBACNW,QAAQ,OACRT,QAAS,kBAAOlG,EAAKyC,YAAc,QAA1B,EACTwD,SAAU5G,KAAKuC,WACfF,MAAO,CAACqE,QAAS,OAAQI,eAAgB,SAAUC,OAAQ,oBAG7DN,EAAA,kBACEE,MAAM,QACNC,SAAU5G,KAAKuC,WACfsE,QAAS,WAAM,OAAAlG,EAAKkE,2BAAL,EACfxC,MAAO,CAACqE,QAAS,OAAQI,eAAgB,SAAUC,OAAQ,kB,WAjjB/C,G","ignoreList":[]}
|
@@ -1,2 +1,2 @@
|
|
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,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n["throw"](e))}catch(e){r(e)}}function l(e){e.done?i(e.value):s(e.value).then(o,a)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=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(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];s=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++){if(r||!(n in t)){if(!r)r=Array.prototype.slice.call(t,0,n);r[n]=t[n]}}return e.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment}from"./index-272d51a4.js";import{VerdocsEndpoint,startSigningSession,getKbaStep,envelopeRecipientAgree,envelopeRecipientDecline,updateEnvelopeField,createSignature,updateEnvelopeFieldSignature,createInitials,updateEnvelopeFieldInitials,isValidPhone,isValidEmail,sortFields,envelopeRecipientSubmit,getEnvelope,uploadEnvelopeFieldAttachment,deleteEnvelopeFieldAttachment,formatFullName,fullNameToInitials,submitKbaPin,submitKbaIdentity,submitKbaChallengeResponse,integerSequence}from"@verdocs/js-sdk";import{a as saveAttachment,u as updateDocumentFieldValue,r as renderDocumentField,g as getFieldId}from"./utils-bd656c37.js";import{V as VerdocsToast}from"./Toast-c4843828.js";import{S as SDKError}from"./errors-887f1e88.js";import{S as Store}from"./Datastore-3f924d94.js";import"./_commonjsHelpers-bdec4bbd.js";import"./Types-95d86a44.js";import"./format-b8602175.js";var verdocsSignCss='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign .agree{-ms-flex:0;flex:0;width:600px;display:-ms-flexbox;display:flex;max-width:90%;padding:30px 15px;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree li{margin:0.5em 0}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);margin-top:15px}verdocs-sign .fatal-error .message{width:50%;font-size:16px;background:white;border-radius:5px;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#654dcb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 46px;flex:0 0 46px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 12px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}.spinner-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background:rgba(0, 0, 0, 0.4980392157);-ms-flex-pack:center;justify-content:center}';var VerdocsSignStyle0=verdocsSignCss;var inProgressMenuOptions=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var doneMenuOptions=[{id:"print",label:"Print"},{id:"download",label:"Download"}];var VerdocsSign=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.envelopeLoaded=createEvent(this,"envelopeLoaded",7);this.envelopeUpdated=createEvent(this,"envelopeUpdated",7);this.recipientIndex=-1;this.endpoint=null;this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.roleNames=[];this.sortedRecipients=[];this.recipient=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.fatalErrorHeader="";this.fatalErrorMessage="";this.focusedField="";this.submitting=false;this.submitted=false;this.isDone=false;this.showDone=false;this.showLoadError=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.documentsSingularPlural="document";this.kbaStep="";this.kbaQuestions=[];this.showSpinner=false;this.kbaChoices=[];this.loading=true;this.envelope=null}e.prototype.componentWillLoad=function(){if(!this.endpoint){console.log("[SIGN] Creating signing endpoint");this.endpoint=new VerdocsEndpoint({sessionType:"signing"})}};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,s,r,o,a,l,c,d;var h=this;return __generator(this,(function(u){switch(u.label){case 0:if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError("[SIGN] Missing required envelopId",500,""));return[2]}if(!this.roleId){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new SDKError("[SIGN] Missing required roleId",500,""));return[2]}if(!this.inviteCode){(i=this.sdkError)===null||i===void 0?void 0:i.emit(new SDKError("[SIGN] Missing required inviteCode",500,""));return[2]}u.label=1;case 1:u.trys.push([1,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.envelopeId," / ").concat(this.roleId));return[4,startSigningSession(this.endpoint,this.envelopeId,this.roleId,this.inviteCode)];case 2:a=u.sent(),l=a.envelope,c=a.recipient;console.log("[SIGN] Loaded signing session",l,c);this.recipient=c;this.envelope=l;Store.updateEnvelope(this.envelopeId,l);this.sortedRecipients=__spreadArray([],this.envelope.recipients,true);this.sortedRecipients.sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}));this.roleNames=this.sortedRecipients.map((function(e){return e.role_name}));if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.recipientIndex=this.roleNames.findIndex((function(e){return e==h.roleId}));if(this.recipientIndex>-1){this.recipient=this.sortedRecipients[this.recipientIndex];this.agreed=this.recipient.agreed}else{console.warn("[SIGN] Could not find our recipient record",this.roleId,this.sortedRecipients)}this.submitted=this.recipient.status==="submitted";this.isDone=this.submitted;this.showDone=this.submitted;if(this.envelope.status==="canceled"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="This envelope has been canceled. Please contact its sender for more information."}else if(this.recipient.status==="declined"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="You have declined to sign this envelope."}else if(this.agreed){this.nextButtonLabel="Next"}this.checkRecipientFields();(n=this.envelopeLoaded)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope});if(!this.isDone){getKbaStep(this.endpoint,this.envelopeId,this.roleId).then((function(e){var t;console.log("[SIGN] KBA Step",e);h.kbaStep=e.kba_step;if(h.kbaStep==="failed"){h.fatalErrorHeader="Identity Verification Failed";h.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.";h.isDone=true}else{h.kbaQuestions=((t=e.questions)===null||t===void 0?void 0:t.question)||[];h.kbaChoices=[]}})).catch((function(e){return console.log("Error getting KBA step",e)}))}return[3,4];case 3:d=u.sent();console.log("[SIGN] Error with signing session",d);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(d.message,(r=d.response)===null||r===void 0?void 0:r.status,(o=d.response)===null||o===void 0?void 0:o.data));this.showLoadError=true;return[3,4];case 4:return[2]}}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var t=document.getElementById("verdocs-sign-header");if(e&&t){console.log("[SIGN] Moving header");t.remove();e.append(t)}};e.prototype.handleClickAgree=function(){var e=this;this.submitting=true;envelopeRecipientAgree(this.endpoint,this.envelopeId,this.roleId,true).then((function(){var t;e.nextButtonLabel="Next";e.recipient.agreed=true;e.submitting=false;e.agreed=true;(t=e.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:e.endpoint,envelope:e.envelope,event:"agreed"})})).catch((function(t){var i,n,s;console.log("[SIGN] Update failure",t);e.submitting=false;(i=e.sdkError)===null||i===void 0?void 0:i.emit(new SDKError(t.message,(n=t.response)===null||n===void 0?void 0:n.status,(s=t.response)===null||s===void 0?void 0:s.data))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,s,r,o,a,l;return __generator(this,(function(c){switch(c.label){case 0:o=e.detail.id;switch(o){case"later":return[3,1];case"claim":return[3,2];case"decline":return[3,3];case"print":return[3,5];case"download":return[3,6]}return[3,7];case 1:this.finishLater=true;this.showFinishLater=true;(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});return[3,7];case 2:VerdocsToast("This feature will be available in an upcoming release.");(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});return[3,7];case 3:this.submitting=true;return[4,envelopeRecipientDecline(this.endpoint,this.envelopeId,this.roleId)];case 4:a=c.sent();console.log("[SIGN] Decline result",a);(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"});this.submitting=false;this.fatalErrorHeader="Declined";this.fatalErrorMessage="You have declined to sign this envelope.";return[3,7];case 5:window.print();(s=this.envelopeUpdated)===null||s===void 0?void 0:s.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,7];case 6:{l=this.envelope.documents.find((function(e){return e.type==="attachment"}));if(l){saveAttachment(this.endpoint,this.envelope,l.id).catch((function(e){console.log("[SIGN] Error downloading PDF",e)}));(r=this.envelopeUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})}}return[3,7];case 7:return[2]}}))}))};e.prototype.updateRecipientFieldValue=function(e,t){var i=this;console.log("[SIGN] updateRecipientFieldValue",e,t);this.getRecipientFields().forEach((function(n){if(n.name===e){n.value=t.value;n.settings=t.settings;updateDocumentFieldValue(n);i.checkRecipientFields()}}))};e.prototype.saveFieldChange=function(e,t){var i=this;console.log("[SIGN] saveFieldChange",e,t);updateEnvelopeField(this.endpoint,this.envelopeId,e,t).then((function(t){return i.updateRecipientFieldValue(e,t)})).catch((function(e){var t,n,s,r,o,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((s=(n=e.response)===null||n===void 0?void 0:n.data)===null||s===void 0?void 0:s.error)==="jwt expired"){console.log("[SIGN] Signing session expired");i.fatalErrorHeader="Signing Session Expired";i.fatalErrorMessage="Please reload your browser to continue."}else{console.log("[SIGN] Server error",e)}(r=i.sdkError)===null||r===void 0?void 0:r.emit(new SDKError(e.message,(o=e.response)===null||o===void 0?void 0:o.status,(a=e.response)===null||a===void 0?void 0:a.data))}))};e.prototype.handleFieldChange=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,s,r,o,a,l;var c=this;return __generator(this,(function(d){switch(d.label){case 0:i=t.target,n=i.value,s=i.checked;r=e.type;switch(r){case"textarea":return[3,1];case"textbox":return[3,1];case"checkbox":return[3,2];case"radio":return[3,3];case"dropdown":return[3,4];case"initial":return[3,5];case"signature":return[3,8];case"date":return[3,11];case"timestamp":return[3,12]}return[3,13];case 1:return[2,this.saveFieldChange(e.name,{prepared:false,value:n})];case 2:{return[2,this.saveFieldChange(e.name,{prepared:false,value:String(t.target.checked)})]}d.label=3;case 3:{return[2,this.saveFieldChange(e.name,{prepared:false,value:String(t.target.checked)})]}d.label=4;case 4:console.log("Saving dropdown",e.name,t.detail);return[2,this.saveFieldChange(e.name,{prepared:false,value:t.detail})];case 5:if(!t.detail){return[2]}this.showSpinner=true;return[4,fetch(t.detail)];case 6:return[4,d.sent().blob()];case 7:o=d.sent();return[2,createInitials(this.endpoint,"initial",o).then((function(t){return __awaiter(c,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:return[4,updateEnvelopeFieldInitials(this.endpoint,this.envelopeId,e.name,t.id)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.log("Error updating initials",e);c.showSpinner=false}))];case 8:if(!t.detail){return[2]}this.showSpinner=true;return[4,fetch(t.detail)];case 9:return[4,d.sent().blob()];case 10:a=d.sent();return[2,createSignature(this.endpoint,"signature",a).then((function(t){return __awaiter(c,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:console.log("Signature update result",t);return[4,updateEnvelopeFieldSignature(this.endpoint,this.envelopeId,e.name,t.id)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.warn("[SIGN] Error updating signature",e);c.showSpinner=false}))];case 11:l=t.detail.formattedDate;if(l){return[2,this.saveFieldChange(e.name,{prepared:false,value:l})]}return[3,14];case 12:console.log("[SIGN] Updating timestamp",{value:n,ts:t.target.getAttribute("timestamp")});return[3,14];case 13:console.log("[SIGN] Unhandled field update",{value:n,checked:s},e);return[3,14];case 14:return[2]}}))}))};e.prototype.isFieldFilled=function(e){var t=e.value,i=t===void 0?"":t;switch(e.type){case"textarea":case"textbox":switch(e.validator||""){case"email":return isValidEmail(i);case"phone":return isValidPhone(i);default:return(i||"").trim()!==""}case"signature":return i==="signed";case"initial":return i==="initialed";case"timestamp":return true;case"date":return!!i;case"attachment":return i==="attached";case"dropdown":return i!=="";case"checkbox":return i==="true";case"radio":if(!!e.group){return this.getRecipientFields().filter((function(t){return t.group===e.group})).some((function(e){return e.value==="true"}))}return e.value==="true";default:return false}};e.prototype.isFieldValid=function(e){return!e.required||this.isFieldFilled(e)};e.prototype.getSortedFillableFields=function(){var e=this.getRecipientFields().filter((function(e){return e.type!=="timestamp"}));sortFields(e);return e};e.prototype.handleNext=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,s,r,o,a,l,c;var d=this;return __generator(this,(function(h){switch(h.label){case 0:if(!this.nextSubmits)return[3,5];h.label=1;case 1:h.trys.push([1,3,,4]);(e=document.getElementById("air-datepicker-global-container"))===null||e===void 0?void 0:e.remove();this.submitting=true;return[4,envelopeRecipientSubmit(this.endpoint,this.envelopeId,this.roleId)];case 2:t=h.sent();console.log("[SIGN] Submitted successfully",t);this.recipient.status="submitted";this.showDone=true;console.log("[SIGN] Reloading envelope");getEnvelope(this.endpoint,this.envelopeId).then((function(e){d.envelope=e;d.submitting=false})).catch((function(e){console.log("[SIGN] Error reloading envelope",e);d.submitting=false}));return[3,4];case 3:i=h.sent();console.log("[SIGN] Error submitting",i);return[3,4];case 4:return[2];case 5:n=this.getSortedFillableFields().filter((function(e){return e.required&&!d.isFieldFilled(e)}));sortFields(n);s=n.findIndex((function(e){return e.name===d.focusedField}));r=s+1;if(r>=n.length){r=0}o=n[r];a=0;if(a<n.length&&["signature","initial"].includes(o.type)&&["initialed","signed"].includes(o.value)){a++;r++;if(r>=n.length){r=0}o=n[r]}if(a>=n.length){o=null}if(o){l=getFieldId(o);c=document.getElementById(l);c===null||c===void 0?void 0:c.scrollIntoView({behavior:"smooth"});c===null||c===void 0?void 0:c.focusField();this.focusedField=o.name}return[2]}}))}))};e.prototype.getRecipientFields=function(){var e=this;return this.envelope.fields.filter((function(t){return t.role_name===e.recipient.role_name}))};e.prototype.checkRecipientFields=function(){var e=this;var t=this.getRecipientFields().filter((function(t){return!e.isFieldValid(t)}));if(t.length<1){this.nextButtonLabel="Finish";if(!this.nextSubmits){this.nextSubmits=true}}else{console.log("[SIGN] Invalid fields remaining",t.map((function(e){return e.name})));this.nextButtonLabel="Next";this.nextSubmits=false}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;if(i.getAttribute("attached")==="1"){return}i.setAttribute("attached","1");i.addEventListener("input",(function(e){if(e.target.type==="radio"||e.target.type==="checkbox"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}else{n.checkRecipientFields()}}));i.addEventListener("attached",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,s,r;return __generator(this,(function(o){switch(o.label){case 0:console.log("[SIGN] onAttached",i.detail,i.target.value);this.showSpinner=true;o.label=1;case 1:o.trys.push([1,3,,4]);return[4,uploadEnvelopeFieldAttachment(this.endpoint,this.envelopeId,t.name,i.detail)];case 2:n=o.sent();this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();s=renderDocumentField("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,s);this.showSpinner=false;return[3,4];case 3:r=o.sent();console.log("Error uploading attachment",r);VerdocsToast("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("deleted",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,s,r;return __generator(this,(function(o){switch(o.label){case 0:console.log("[SIGN] onDeleted",i.detail,i.target.value);this.showSpinner=true;o.label=1;case 1:o.trys.push([1,3,,4]);return[4,deleteEnvelopeFieldAttachment(this.endpoint,this.envelopeId,t.name)];case 2:n=o.sent();console.log("[SIGN] Deleted attachment",n);this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();s=renderDocumentField("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,s);this.showSpinner=false;return[3,4];case 3:r=o.sent();console.log("Error uploading attachment",r);VerdocsToast("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("focusout",(function(e){if(t.type!=="dropdown"&&t.type!=="attachment"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}}));i.addEventListener("fieldChange",(function(e){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}));i.setAttribute("templateid",this.envelope.template_id);i.setAttribute("fieldname",t.name);i.setAttribute("page",e.pageNumber);i.setAttribute("xScale",e.xScale);i.setAttribute("yScale",e.yScale);var s=formatFullName(this.recipient);i.setAttribute("initials",fullNameToInitials(s));i.setAttribute("name",s)};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;var n=this.getSortedFillableFields();console.log("[SIGN] Rendering fields for page",i.pageNumber,n);n.forEach((function(e,n){if(e.page!==i.pageNumber){return}var s=renderDocumentField("envelope",e,i,{disabled:false,editable:false,draggable:false,done:t.isDone},n);if(!s){return}if(Array.isArray(s)){s.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,s)}}));this.sortedRecipients.filter((function(e){return e.role_name!==t.recipient.role_name&&(e.status==="invited"||e.status==="opened"||e.status==="pending")})).forEach((function(){t.getRecipientFields().filter((function(e){return e.page===i.pageNumber})).forEach((function(e){var n=renderDocumentField("envelope",e,i,{disabled:true,editable:false,draggable:false,done:t.isDone});if(!n){return}if(Array.isArray(n)){n.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,n)}}))}));this.checkRecipientFields()};e.prototype.render=function(){var e=this;if(this.showLoadError){return h(Host,null,h("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:function(){window.location.reload()}}))}if(!this.envelope){return h(Host,null,h("verdocs-loader",null))}if(this.fatalErrorMessage){return h(Host,{class:{agreed:this.agreed}},h("div",{class:"fatal-error"},h("div",{class:"message"},h("div",{class:"header"},this.fatalErrorHeader),h("p",null,this.fatalErrorMessage))))}if(this.isDone){return h(Host,{class:{agreed:this.agreed}},h("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var i;return(i=e.sdkError)===null||i===void 0?void 0:i.emit(t.detail)}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(t){t.preventDefault();t.stopPropagation();e.showDone=false;e.isDone=true}}),this.submitting&&h("div",{class:"loading-indicator"},h("verdocs-loader",null)))}if(!this.agreed){return h(Host,{class:"agreed"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"agree"},h("verdocs-checkbox",{name:"agree",label:"By checking this box, you:",onInput:function(){return e.handleClickAgree()}}),h("ul",null,h("li",null,"Agree to use electronic records and signatures, and confirm you have read the"," ",h("a",{href:"https://verdocs.com/en/electronic-record-signature-disclosure/",target:"_blank"},"Electronic Record and Signatures Disclosure"),"."),h("li",null,"Agree to Verdocs'"," ",h("a",{href:"https://verdocs.com/en/eula",target:"_blank"},"End User License Agreement")," ","and confirm you have read Verdocs'"," ",h("a",{href:"https://verdocs.com/en/privacy-policy/",target:"_blank"},"Privacy Policy"),".")))))}if(this.kbaStep==="pin"){return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},h("verdocs-kba-dialog",{mode:"text",step:1,steps:1,helptitle:"Document is protected by a PIN code",helptext:"Please enter your PIN code to proceed. If you do not have one, please contact the sender.",label:"PIN Code",onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){submitKbaPin(this.endpoint,this.envelopeId,this.roleId,t.detail).then((function(t){console.log("[SIGN] PIN code submission result",t);if(t.kba_step==="complete"){e.kbaStep=""}})).catch((function(e){var t,i;console.log("[SIGN] Error submitting PIN",e);VerdocsToast(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Unable to verify PIN code. Please try again.",{style:"error"})}));return[2]}))}))}}))))}if(this.kbaStep==="identity"){return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},h("verdocs-kba-dialog",{mode:"identity",helptitle:"Document requires identity verification",helptext:"Please complete your contact details to proceed.",recipient:this.recipient,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e;var i=this;return __generator(this,(function(n){e=t.detail;submitKbaIdentity(this.endpoint,this.envelopeId,this.roleId,{firstName:e.first_name,lastName:e.last_name,address:e.address,city:e.city,state:e.state,zip:e.zip,ssnLast4:e.ssn_last_4}).then((function(e){console.log("[SIGN] Identity submission result",e);i.kbaStep=e.kba_step})).catch((function(e){var t,i;console.log("[SIGN] Error submitting identity",e);VerdocsToast(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Unable to verify identity.",{style:"error"})}));return[2]}))}))}}))))}if(this.kbaStep==="challenge"){var t=this.kbaChoices.length;var i=this.kbaQuestions[t];console.log("Showing KBA question",{questionNumber:t,kbaQuestion:i},this.kbaChoices);return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},this.kbaChoices.length>=this.kbaQuestions.length?h("verdocs-spinner",null):h("verdocs-kba-dialog",{mode:"choice",helptitle:"Your identity requires additional verification",helptext:(i===null||i===void 0?void 0:i.prompt)||"Please select one of the options below.",choices:(i===null||i===void 0?void 0:i.answer)||["Skip Question"],step:t+1,steps:this.kbaQuestions.length,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,s,r,o,a;var l=this;return __generator(this,(function(c){switch(c.label){case 0:s=t.detail;this.kbaChoices=__spreadArray(__spreadArray([],this.kbaChoices,true),[s],false);if(!(this.kbaChoices.length>=this.kbaQuestions.length))return[3,4];r=this.kbaQuestions.map((function(e,t){return{type:e.type,answer:l.kbaChoices[t]}}));console.log("Submitting KBA responses",this.kbaChoices,r);c.label=1;case 1:c.trys.push([1,3,,4]);return[4,submitKbaChallengeResponse(this.endpoint,this.envelopeId,this.roleId,r)];case 2:o=c.sent();console.log("KBA challenge response",o);this.kbaStep=o.kba_step;if(this.kbaStep==="failed"){this.fatalErrorHeader="Identity Verification Failed";this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.";this.isDone=true}else{this.kbaQuestions=((e=o.questions)===null||e===void 0?void 0:e.question)||[];this.kbaChoices=[]}return[3,4];case 3:a=c.sent();console.log("Error submitting KBA challenge",a);this.kbaStep="";this.fatalErrorHeader="Unable to Verify Identity";this.fatalErrorMessage=((n=(i=a.response)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.error)||"Please try again later.";this.isDone=true;return[3,4];case 4:return[2]}}))}))}}))))}return h(Host,null,h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name),h("div",{style:{flex:"1"}}),!this.finishLater&&h("verdocs-button",{size:"xsmall",label:this.nextButtonLabel,disabled:!this.agreed,onClick:function(){return e.handleNext()}}),h("div",{style:{marginLeft:"10px"}}),h("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?inProgressMenuOptions:doneMenuOptions,onOptionSelected:function(t){return e.handleOptionSelected(t)}}))),h("div",{class:"document",style:{paddingTop:"15px"}},(this.envelope.documents||[]).map((function(t){var i=integerSequence(1,t.pages);return h(Fragment,null,i.map((function(i){var n;var s=((n=t.page_sizes)===null||n===void 0?void 0:n[i])||{width:612,height:792};return h("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:t.id,endpoint:e.endpoint,virtualWidth:s.width,virtualHeight:s.height,pageNumber:i,onPageRendered:function(t){return e.handlePageRendered(t)},type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&h("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the ".concat(this.documentsSingularPlural,", use the link in the original email notification inviting you to review and finish the document."),onNext:function(){return e.showFinishLater=false}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}),this.submitting||this.showSpinner&&h("verdocs-portal",null,h("div",{class:"spinner-overlay"},h("verdocs-spinner",null))))};return e}();VerdocsSign.style=VerdocsSignStyle0;export{VerdocsSign as verdocs_sign};
|
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,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n["throw"](e))}catch(e){r(e)}}function l(e){e.done?i(e.value):s(e.value).then(o,a)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=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(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];s=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++){if(r||!(n in t)){if(!r)r=Array.prototype.slice.call(t,0,n);r[n]=t[n]}}return e.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment}from"./index-272d51a4.js";import{VerdocsEndpoint,startSigningSession,getKbaStep,envelopeRecipientAgree,envelopeRecipientDecline,updateEnvelopeField,createSignature,updateEnvelopeFieldSignature,createInitials,updateEnvelopeFieldInitials,isValidPhone,isValidEmail,sortFields,envelopeRecipientSubmit,getEnvelope,uploadEnvelopeFieldAttachment,deleteEnvelopeFieldAttachment,formatFullName,fullNameToInitials,submitKbaPin,submitKbaIdentity,submitKbaChallengeResponse,integerSequence}from"@verdocs/js-sdk";import{a as saveAttachment,u as updateDocumentFieldValue,r as renderDocumentField,g as getFieldId}from"./utils-bd656c37.js";import{V as VerdocsToast}from"./Toast-c4843828.js";import{S as SDKError}from"./errors-887f1e88.js";import{S as Store}from"./Datastore-3f924d94.js";import"./_commonjsHelpers-bdec4bbd.js";import"./Types-95d86a44.js";import"./format-b8602175.js";var verdocsSignCss='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign .agree{-ms-flex:0;flex:0;width:600px;display:-ms-flexbox;display:flex;max-width:90%;padding:30px 15px;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree li{margin:0.5em 0}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);margin-top:15px}verdocs-sign .fatal-error .message{max-width:50%;width:50%;font-size:16px;background:white;border-radius:5px;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#654dcb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400;padding:0 10px}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 46px;flex:0 0 46px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 12px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}.spinner-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background:rgba(0, 0, 0, 0.4980392157);-ms-flex-pack:center;justify-content:center}';var VerdocsSignStyle0=verdocsSignCss;var inProgressMenuOptions=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var doneMenuOptions=[{id:"print",label:"Print"},{id:"download",label:"Download"}];var VerdocsSign=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError",7);this.envelopeLoaded=createEvent(this,"envelopeLoaded",7);this.envelopeUpdated=createEvent(this,"envelopeUpdated",7);this.recipientIndex=-1;this.endpoint=null;this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.roleNames=[];this.sortedRecipients=[];this.recipient=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.fatalErrorHeader="";this.fatalErrorMessage="";this.focusedField="";this.submitting=false;this.submitted=false;this.isDone=false;this.showDone=false;this.showLoadError=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.documentsSingularPlural="document";this.kbaStep="";this.kbaQuestions=[];this.showSpinner=false;this.kbaChoices=[];this.loading=true;this.envelope=null}e.prototype.componentWillLoad=function(){if(!this.endpoint){console.log("[SIGN] Creating signing endpoint");this.endpoint=new VerdocsEndpoint({sessionType:"signing"})}};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,s,r,o,a,l,d,c;var h=this;return __generator(this,(function(u){switch(u.label){case 0:if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError("[SIGN] Missing required envelopId",500,""));return[2]}if(!this.roleId){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new SDKError("[SIGN] Missing required roleId",500,""));return[2]}if(!this.inviteCode){(i=this.sdkError)===null||i===void 0?void 0:i.emit(new SDKError("[SIGN] Missing required inviteCode",500,""));return[2]}u.label=1;case 1:u.trys.push([1,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.envelopeId," / ").concat(this.roleId));return[4,startSigningSession(this.endpoint,this.envelopeId,this.roleId,this.inviteCode)];case 2:a=u.sent(),l=a.envelope,d=a.recipient;console.log("[SIGN] Loaded signing session",l,d);this.recipient=d;this.envelope=l;Store.updateEnvelope(this.envelopeId,l);this.sortedRecipients=__spreadArray([],this.envelope.recipients,true);this.sortedRecipients.sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}));this.roleNames=this.sortedRecipients.map((function(e){return e.role_name}));if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.recipientIndex=this.roleNames.findIndex((function(e){return e==h.roleId}));if(this.recipientIndex>-1){this.recipient=this.sortedRecipients[this.recipientIndex];this.agreed=this.recipient.agreed}else{console.warn("[SIGN] Could not find our recipient record",this.roleId,this.sortedRecipients)}this.submitted=this.recipient.status==="submitted";this.isDone=this.submitted;this.showDone=this.submitted;if(this.envelope.status==="canceled"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="This envelope has been canceled. Please contact its sender for more information."}else if(this.recipient.status==="declined"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="You have declined to sign this envelope."}else if(this.agreed){this.nextButtonLabel="Next"}this.checkRecipientFields();(n=this.envelopeLoaded)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope});if(!this.isDone){getKbaStep(this.endpoint,this.envelopeId,this.roleId).then((function(e){var t;console.log("[SIGN] KBA Step",e);h.kbaStep=e.kba_step;if(h.kbaStep==="failed"){h.fatalErrorHeader="Identity Verification Failed";h.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.";h.isDone=true}else{h.kbaQuestions=((t=e.questions)===null||t===void 0?void 0:t.question)||[];h.kbaChoices=[]}})).catch((function(e){return console.log("Error getting KBA step",e)}))}return[3,4];case 3:c=u.sent();console.log("[SIGN] Error with signing session",c);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(c.message,(r=c.response)===null||r===void 0?void 0:r.status,(o=c.response)===null||o===void 0?void 0:o.data));this.showLoadError=true;return[3,4];case 4:return[2]}}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var t=document.getElementById("verdocs-sign-header");if(e&&t){console.log("[SIGN] Moving header");t.remove();e.append(t)}};e.prototype.handleClickAgree=function(){var e=this;this.submitting=true;envelopeRecipientAgree(this.endpoint,this.envelopeId,this.roleId,true).then((function(){var t;e.nextButtonLabel="Next";e.recipient.agreed=true;e.submitting=false;e.agreed=true;(t=e.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:e.endpoint,envelope:e.envelope,event:"agreed"})})).catch((function(t){var i,n,s;console.log("[SIGN] Update failure",t);e.submitting=false;(i=e.sdkError)===null||i===void 0?void 0:i.emit(new SDKError(t.message,(n=t.response)===null||n===void 0?void 0:n.status,(s=t.response)===null||s===void 0?void 0:s.data))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,s,r,o,a,l;return __generator(this,(function(d){switch(d.label){case 0:o=e.detail.id;switch(o){case"later":return[3,1];case"claim":return[3,2];case"decline":return[3,3];case"print":return[3,5];case"download":return[3,6]}return[3,7];case 1:this.finishLater=true;this.showFinishLater=true;(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});return[3,7];case 2:VerdocsToast("This feature will be available in an upcoming release.");(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});return[3,7];case 3:this.submitting=true;return[4,envelopeRecipientDecline(this.endpoint,this.envelopeId,this.roleId)];case 4:a=d.sent();console.log("[SIGN] Decline result",a);(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"});this.submitting=false;this.fatalErrorHeader="Declined";this.fatalErrorMessage="You have declined to sign this envelope.";return[3,7];case 5:window.print();(s=this.envelopeUpdated)===null||s===void 0?void 0:s.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,7];case 6:{l=this.envelope.documents.find((function(e){return e.type==="attachment"}));if(l){saveAttachment(this.endpoint,this.envelope,l.id).catch((function(e){console.log("[SIGN] Error downloading PDF",e)}));(r=this.envelopeUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})}}return[3,7];case 7:return[2]}}))}))};e.prototype.updateRecipientFieldValue=function(e,t){var i=this;console.log("[SIGN] updateRecipientFieldValue",e,t);this.getRecipientFields().forEach((function(n){if(n.name===e){n.value=t.value;n.settings=t.settings;updateDocumentFieldValue(n);i.checkRecipientFields()}}))};e.prototype.saveFieldChange=function(e,t){var i=this;console.log("[SIGN] saveFieldChange",e,t);updateEnvelopeField(this.endpoint,this.envelopeId,e,t).then((function(t){return i.updateRecipientFieldValue(e,t)})).catch((function(e){var t,n,s,r,o,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((s=(n=e.response)===null||n===void 0?void 0:n.data)===null||s===void 0?void 0:s.error)==="jwt expired"){console.log("[SIGN] Signing session expired");i.fatalErrorHeader="Signing Session Expired";i.fatalErrorMessage="Please reload your browser to continue."}else{console.log("[SIGN] Server error",e)}(r=i.sdkError)===null||r===void 0?void 0:r.emit(new SDKError(e.message,(o=e.response)===null||o===void 0?void 0:o.status,(a=e.response)===null||a===void 0?void 0:a.data))}))};e.prototype.handleFieldChange=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,s,r,o,a,l;var d=this;return __generator(this,(function(c){switch(c.label){case 0:i=t.target,n=i.value,s=i.checked;r=e.type;switch(r){case"textarea":return[3,1];case"textbox":return[3,1];case"checkbox":return[3,2];case"radio":return[3,3];case"dropdown":return[3,4];case"initial":return[3,5];case"signature":return[3,8];case"date":return[3,11];case"timestamp":return[3,12]}return[3,13];case 1:return[2,this.saveFieldChange(e.name,{prepared:false,value:n})];case 2:{return[2,this.saveFieldChange(e.name,{prepared:false,value:String(t.target.checked)})]}c.label=3;case 3:{return[2,this.saveFieldChange(e.name,{prepared:false,value:String(t.target.checked)})]}c.label=4;case 4:console.log("Saving dropdown",e.name,t.detail);return[2,this.saveFieldChange(e.name,{prepared:false,value:t.detail})];case 5:if(!t.detail){return[2]}this.showSpinner=true;return[4,fetch(t.detail)];case 6:return[4,c.sent().blob()];case 7:o=c.sent();return[2,createInitials(this.endpoint,"initial",o).then((function(t){return __awaiter(d,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:return[4,updateEnvelopeFieldInitials(this.endpoint,this.envelopeId,e.name,t.id)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.log("Error updating initials",e);d.showSpinner=false}))];case 8:if(!t.detail){return[2]}this.showSpinner=true;return[4,fetch(t.detail)];case 9:return[4,c.sent().blob()];case 10:a=c.sent();return[2,createSignature(this.endpoint,"signature",a).then((function(t){return __awaiter(d,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:console.log("Signature update result",t);return[4,updateEnvelopeFieldSignature(this.endpoint,this.envelopeId,e.name,t.id)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.warn("[SIGN] Error updating signature",e);d.showSpinner=false}))];case 11:l=t.detail.formattedDate;if(l){return[2,this.saveFieldChange(e.name,{prepared:false,value:l})]}return[3,14];case 12:console.log("[SIGN] Updating timestamp",{value:n,ts:t.target.getAttribute("timestamp")});return[3,14];case 13:console.log("[SIGN] Unhandled field update",{value:n,checked:s},e);return[3,14];case 14:return[2]}}))}))};e.prototype.isFieldFilled=function(e){var t=e.value,i=t===void 0?"":t;switch(e.type){case"textarea":case"textbox":switch(e.validator||""){case"email":return isValidEmail(i);case"phone":return isValidPhone(i);default:return(i||"").trim()!==""}case"signature":return i==="signed";case"initial":return i==="initialed";case"timestamp":return true;case"date":return!!i;case"attachment":return i==="attached";case"dropdown":return i!=="";case"checkbox":return i==="true";case"radio":if(!!e.group){return this.getRecipientFields().filter((function(t){return t.group===e.group})).some((function(e){return e.value==="true"}))}return e.value==="true";default:return false}};e.prototype.isFieldValid=function(e){return!e.required||this.isFieldFilled(e)};e.prototype.getSortedFillableFields=function(){var e=this.getRecipientFields().filter((function(e){return e.type!=="timestamp"}));sortFields(e);return e};e.prototype.handleNext=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,s,r,o,a,l,d;var c=this;return __generator(this,(function(h){switch(h.label){case 0:if(!this.nextSubmits)return[3,5];h.label=1;case 1:h.trys.push([1,3,,4]);(e=document.getElementById("air-datepicker-global-container"))===null||e===void 0?void 0:e.remove();this.submitting=true;return[4,envelopeRecipientSubmit(this.endpoint,this.envelopeId,this.roleId)];case 2:t=h.sent();console.log("[SIGN] Submitted successfully",t);this.recipient.status="submitted";this.showDone=true;console.log("[SIGN] Reloading envelope");getEnvelope(this.endpoint,this.envelopeId).then((function(e){c.envelope=e;c.submitting=false})).catch((function(e){console.log("[SIGN] Error reloading envelope",e);c.submitting=false}));return[3,4];case 3:i=h.sent();console.log("[SIGN] Error submitting",i);return[3,4];case 4:return[2];case 5:n=this.getSortedFillableFields().filter((function(e){return e.required&&!c.isFieldFilled(e)}));sortFields(n);s=n.findIndex((function(e){return e.name===c.focusedField}));r=s+1;if(r>=n.length){r=0}o=n[r];a=0;if(a<n.length&&["signature","initial"].includes(o.type)&&["initialed","signed"].includes(o.value)){a++;r++;if(r>=n.length){r=0}o=n[r]}if(a>=n.length){o=null}if(o){l=getFieldId(o);d=document.getElementById(l);d===null||d===void 0?void 0:d.scrollIntoView({behavior:"smooth"});d===null||d===void 0?void 0:d.focusField();this.focusedField=o.name}return[2]}}))}))};e.prototype.getRecipientFields=function(){var e=this;return this.envelope.fields.filter((function(t){return t.role_name===e.recipient.role_name}))};e.prototype.checkRecipientFields=function(){var e=this;var t=this.getRecipientFields().filter((function(t){return!e.isFieldValid(t)}));if(t.length<1){this.nextButtonLabel="Finish";if(!this.nextSubmits){this.nextSubmits=true}}else{console.log("[SIGN] Invalid fields remaining",t.map((function(e){return e.name})));this.nextButtonLabel="Next";this.nextSubmits=false}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;if(i.getAttribute("attached")==="1"){return}i.setAttribute("attached","1");i.addEventListener("input",(function(e){if(e.target.type==="radio"||e.target.type==="checkbox"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}else{n.checkRecipientFields()}}));i.addEventListener("attached",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,s,r;return __generator(this,(function(o){switch(o.label){case 0:console.log("[SIGN] onAttached",i.detail,i.target.value);this.showSpinner=true;o.label=1;case 1:o.trys.push([1,3,,4]);return[4,uploadEnvelopeFieldAttachment(this.endpoint,this.envelopeId,t.name,i.detail)];case 2:n=o.sent();this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();s=renderDocumentField("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,s);this.showSpinner=false;return[3,4];case 3:r=o.sent();console.log("Error uploading attachment",r);VerdocsToast("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("deleted",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,s,r;return __generator(this,(function(o){switch(o.label){case 0:console.log("[SIGN] onDeleted",i.detail,i.target.value);this.showSpinner=true;o.label=1;case 1:o.trys.push([1,3,,4]);return[4,deleteEnvelopeFieldAttachment(this.endpoint,this.envelopeId,t.name)];case 2:n=o.sent();console.log("[SIGN] Deleted attachment",n);this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();s=renderDocumentField("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,s);this.showSpinner=false;return[3,4];case 3:r=o.sent();console.log("Error uploading attachment",r);VerdocsToast("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("focusout",(function(e){if(t.type!=="dropdown"&&t.type!=="attachment"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}}));i.addEventListener("fieldChange",(function(e){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}));i.setAttribute("templateid",this.envelope.template_id);i.setAttribute("fieldname",t.name);i.setAttribute("page",e.pageNumber);i.setAttribute("xScale",e.xScale);i.setAttribute("yScale",e.yScale);var s=formatFullName(this.recipient);i.setAttribute("initials",fullNameToInitials(s));i.setAttribute("name",s)};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;var n=this.getSortedFillableFields();console.log("[SIGN] Rendering fields for page",i.pageNumber,n);n.forEach((function(e,n){if(e.page!==i.pageNumber){return}var s=renderDocumentField("envelope",e,i,{disabled:false,editable:false,draggable:false,done:t.isDone},n);if(!s){return}if(Array.isArray(s)){s.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,s)}}));this.sortedRecipients.filter((function(e){return e.role_name!==t.recipient.role_name&&(e.status==="invited"||e.status==="opened"||e.status==="pending")})).forEach((function(){t.getRecipientFields().filter((function(e){return e.page===i.pageNumber})).forEach((function(e){var n=renderDocumentField("envelope",e,i,{disabled:true,editable:false,draggable:false,done:t.isDone});if(!n){return}if(Array.isArray(n)){n.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,n)}}))}));this.checkRecipientFields()};e.prototype.render=function(){var e=this;if(this.showLoadError){return h(Host,null,h("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:function(){window.location.reload()}}))}if(!this.envelope){return h(Host,null,h("verdocs-loader",null))}if(this.fatalErrorMessage){return h(Host,{class:{agreed:this.agreed}},h("div",{class:"fatal-error"},h("div",{class:"message"},h("div",{class:"header"},this.fatalErrorHeader),h("p",null,this.fatalErrorMessage))))}if(this.isDone){return h(Host,{class:{agreed:this.agreed}},h("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var i;return(i=e.sdkError)===null||i===void 0?void 0:i.emit(t.detail)}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(t){t.preventDefault();t.stopPropagation();e.showDone=false;e.isDone=true}}),this.submitting&&h("div",{class:"loading-indicator"},h("verdocs-loader",null)))}if(!this.agreed){return h(Host,{class:"agreed"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"agree"},h("verdocs-checkbox",{name:"agree",label:"By checking this box, you:",onInput:function(){return e.handleClickAgree()}}),h("ul",null,h("li",null,"Agree to use electronic records and signatures, and confirm you have read the"," ",h("a",{href:"https://verdocs.com/en/electronic-record-signature-disclosure/",target:"_blank"},"Electronic Record and Signatures Disclosure"),"."),h("li",null,"Agree to Verdocs'"," ",h("a",{href:"https://verdocs.com/en/eula",target:"_blank"},"End User License Agreement")," ","and confirm you have read Verdocs'"," ",h("a",{href:"https://verdocs.com/en/privacy-policy/",target:"_blank"},"Privacy Policy"),".")))))}if(this.kbaStep==="pin"){return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},h("verdocs-kba-dialog",{mode:"text",step:1,steps:1,helptitle:"Document is protected by a PIN code",helptext:"Please enter your PIN code to proceed. If you do not have one, please contact the sender.",label:"PIN Code",onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){submitKbaPin(this.endpoint,this.envelopeId,this.roleId,t.detail).then((function(t){console.log("[SIGN] PIN code submission result",t);if(t.kba_step==="complete"){e.kbaStep=""}})).catch((function(e){var t,i;console.log("[SIGN] Error submitting PIN",e);VerdocsToast(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Unable to verify PIN code. Please try again.",{style:"error"})}));return[2]}))}))}}))))}if(this.kbaStep==="identity"){return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},h("verdocs-kba-dialog",{mode:"identity",helptitle:"Document requires identity verification",helptext:"Please complete your contact details to proceed.",recipient:this.recipient,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e;var i=this;return __generator(this,(function(n){e=t.detail;submitKbaIdentity(this.endpoint,this.envelopeId,this.roleId,{firstName:e.first_name,lastName:e.last_name,address:e.address,city:e.city,state:e.state,zip:e.zip,ssnLast4:e.ssn_last_4}).then((function(e){console.log("[SIGN] Identity submission result",e);i.kbaStep=e.kba_step})).catch((function(e){var t,i;console.log("[SIGN] Error submitting identity",e);VerdocsToast(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Unable to verify identity.",{style:"error"})}));return[2]}))}))}}))))}if(this.kbaStep==="challenge"){var t=this.kbaChoices.length;var i=this.kbaQuestions[t];return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},this.kbaChoices.length>=this.kbaQuestions.length?h("verdocs-spinner",null):h("verdocs-kba-dialog",{mode:"choice",helptitle:"Your identity requires additional verification",helptext:(i===null||i===void 0?void 0:i.prompt)||"Please select one of the options below.",choices:(i===null||i===void 0?void 0:i.answer)||["Skip Question"],step:t+1,steps:this.kbaQuestions.length,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,s,r,o,a;var l=this;return __generator(this,(function(d){switch(d.label){case 0:s=t.detail;this.kbaChoices=__spreadArray(__spreadArray([],this.kbaChoices,true),[s],false);if(!(this.kbaChoices.length>=this.kbaQuestions.length))return[3,4];r=this.kbaQuestions.map((function(e,t){return{type:e.type,answer:l.kbaChoices[t]}}));console.log("Submitting KBA responses",this.kbaChoices,r);d.label=1;case 1:d.trys.push([1,3,,4]);return[4,submitKbaChallengeResponse(this.endpoint,this.envelopeId,this.roleId,r)];case 2:o=d.sent();console.log("KBA challenge response",o);this.kbaStep=o.kba_step;if(this.kbaStep==="failed"){this.fatalErrorHeader="Identity Verification Failed";this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.";this.isDone=true}else{this.kbaQuestions=((e=o.questions)===null||e===void 0?void 0:e.question)||[];this.kbaChoices=[]}return[3,4];case 3:a=d.sent();console.log("Error submitting KBA challenge",a);this.kbaStep="";this.fatalErrorHeader="Unable to Verify Identity";this.fatalErrorMessage=((n=(i=a.response)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.error)||"Please try again later.";this.isDone=true;return[3,4];case 4:return[2]}}))}))}}))))}return h(Host,null,h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name),h("div",{style:{flex:"1"}}),!this.finishLater&&h("verdocs-button",{size:"xsmall",label:this.nextButtonLabel,disabled:!this.agreed,onClick:function(){return e.handleNext()}}),h("div",{style:{marginLeft:"10px"}}),h("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?inProgressMenuOptions:doneMenuOptions,onOptionSelected:function(t){return e.handleOptionSelected(t)}}))),h("div",{class:"document",style:{paddingTop:"15px"}},(this.envelope.documents||[]).map((function(t){var i=integerSequence(1,t.pages);return h(Fragment,null,i.map((function(i){var n;var s=((n=t.page_sizes)===null||n===void 0?void 0:n[i])||{width:612,height:792};return h("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:t.id,endpoint:e.endpoint,virtualWidth:s.width,virtualHeight:s.height,pageNumber:i,onPageRendered:function(t){return e.handlePageRendered(t)},type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&h("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the ".concat(this.documentsSingularPlural,", use the link in the original email notification inviting you to review and finish the document."),onNext:function(){return e.showFinishLater=false}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}),this.submitting||this.showSpinner&&h("verdocs-portal",null,h("div",{class:"spinner-overlay"},h("verdocs-spinner",null))))};return e}();VerdocsSign.style=VerdocsSignStyle0;export{VerdocsSign as verdocs_sign};
|
2
2
|
//# sourceMappingURL=verdocs-sign.entry.js.map
|