@verdocs/web-sdk 6.5.0-beta.10 → 6.5.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index-CQ5bTnED.js +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{verdocs-field-attachment_13.cjs.entry.js → verdocs-field-attachment_11.cjs.entry.js} +14 -623
- package/dist/cjs/verdocs-initial-dialog.cjs.entry.js +229 -0
- package/dist/cjs/verdocs-initial-dialog.entry.cjs.js.map +1 -0
- package/dist/cjs/verdocs-sign.cjs.entry.js +72 -5
- package/dist/cjs/verdocs-sign.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-signature-dialog.cjs.entry.js +355 -0
- package/dist/cjs/verdocs-signature-dialog.entry.cjs.js.map +1 -0
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +72 -5
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js +17 -26
- package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js.map +1 -1
- package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js +32 -26
- package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js.map +1 -1
- package/dist/components/{p-CYoBhLFP.js → p-B4XIUesD.js} +42 -54
- package/dist/components/p-B4XIUesD.js.map +1 -0
- package/dist/components/{p-DjOK66Dt.js → p-BoIZ0eWm.js} +43 -55
- package/dist/components/p-BoIZ0eWm.js.map +1 -0
- package/dist/components/{p-BxnX5zPJ.js → p-BzCNCMTQ.js} +24 -53
- package/dist/components/p-BzCNCMTQ.js.map +1 -0
- package/dist/components/{p-DKJPJj6P.js → p-CaA92LBj.js} +43 -55
- package/dist/components/p-CaA92LBj.js.map +1 -0
- package/dist/components/{p-Bygkg9Ho.js → p-DlWkjPea.js} +17 -41
- package/dist/components/p-DlWkjPea.js.map +1 -0
- package/dist/components/verdocs-build.js +56 -68
- package/dist/components/verdocs-build.js.map +1 -1
- package/dist/components/verdocs-field-initial.js +1 -1
- package/dist/components/verdocs-field-signature.js +1 -1
- package/dist/components/verdocs-initial-dialog.js +263 -1
- package/dist/components/verdocs-initial-dialog.js.map +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-sign.js +72 -5
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/components/verdocs-signature-dialog.js +393 -1
- package/dist/components/verdocs-signature-dialog.js.map +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/esm/index-BIRwgFLv.js +10 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{verdocs-field-attachment_13.entry.js → verdocs-field-attachment_11.entry.js} +15 -622
- package/dist/{components/p-Daqfz15U.js → esm/verdocs-initial-dialog.entry.js} +8 -49
- package/dist/esm/verdocs-initial-dialog.entry.js.map +1 -0
- package/dist/esm/verdocs-sign.entry.js +72 -5
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/{components/p-0L80sqd9.js → esm/verdocs-signature-dialog.entry.js} +8 -53
- package/dist/esm/verdocs-signature-dialog.entry.js.map +1 -0
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/index-BIRwgFLv.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_11.entry.js +2 -0
- package/dist/esm-es5/verdocs-field-attachment_11.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-initial-dialog.entry.js +2 -0
- package/dist/esm-es5/verdocs-initial-dialog.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-signature-dialog.entry.js +2 -0
- package/dist/esm-es5/verdocs-signature-dialog.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/fields/verdocs-field-initial/verdocs-field-initial.d.ts +1 -4
- package/dist/types/components/fields/verdocs-field-signature/verdocs-field-signature.d.ts +2 -4
- package/dist/types/components.d.ts +10 -8
- package/dist/verdocs-web-sdk/p-12422d5d.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-12422d5d.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-2fb3119a.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-2fb3119a.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-36659fcd.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-36659fcd.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-48d217b4.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-48d217b4.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-5d720de7.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-5d720de7.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-8052a9b8.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-8052a9b8.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
- package/dist/verdocs-web-sdk/p-BYyqNgjP.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-D2FLn0Fu.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-DQr2_l0b.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-c7243201.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-c7243201.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-f0c0e64f.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-f0c0e64f.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-u99GfztJ.system.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-initial-dialog.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-sign.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-signature-dialog.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +2 -2
- package/dist/components/p-0L80sqd9.js.map +0 -1
- package/dist/components/p-BxnX5zPJ.js.map +0 -1
- package/dist/components/p-Bygkg9Ho.js.map +0 -1
- package/dist/components/p-CYoBhLFP.js.map +0 -1
- package/dist/components/p-DKJPJj6P.js.map +0 -1
- package/dist/components/p-Daqfz15U.js.map +0 -1
- package/dist/components/p-DjOK66Dt.js.map +0 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +0 -2
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-198d3577.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-198d3577.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-25b3c1d6.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-25b3c1d6.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-644689ce.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-644689ce.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-71ab2ea9.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-71ab2ea9.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-BBoL1FXa.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-DSPz-5FG.system.js.map +0 -1
|
@@ -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=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["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-BIRwgFLv.js";import{VerdocsEndpoint,DEFAULT_DISCLOSURES,startSigningSession,envelopeRecipientAgree,updateEnvelopeField,createSignature,createInitials,sortFields,envelopeRecipientSubmit,isFieldValid,isFieldFilled,uploadEnvelopeFieldAttachment,deleteEnvelopeFieldAttachment,formatFullName,fullNameToInitials,verifySigner,delegateRecipient,envelopeRecipientDecline,askQuestion,integerSequence}from"@verdocs/js-sdk";import{a as saveAttachment,u as updateDocumentFieldValue,g as getFieldId,r as renderDocumentFlag,b as renderDocumentField,d as defaultHeight}from"./utils-UeubfAI_.js";import{V as VerdocsToast}from"./Toast-CyvDgtoV.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-bS8INhRF.js";import"./index-dzBXqXlK.js";import"./Types-dqxNbm_b.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;min-height:700px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#f5f5f5;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-sign verdocs-button>button.standard{background:#2a63f6}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;padding-right:140px;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>.document .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;max-width:1028px;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-sign>.document .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-sign>.document .document-separator:first-child{margin-top:0}verdocs-sign .signed-document-container{width:64%;margin-left:260px}@media (max-width: 600px){verdocs-sign .signed-document-container{width:100%;margin-left:0}verdocs-sign>.document{padding-right:15px}verdocs-sign .verdocs-flag-instance{display:none !important}}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 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:360px;width:50%;font-size:16px;background:white;-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:#4c56cb}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 VerdocsSign=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.envelopeLoaded=createEvent(this,"envelopeLoaded");this.envelopeUpdated=createEvent(this,"envelopeUpdated");this.endpoint=new VerdocsEndpoint({sessionType:"signing"});this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.recipient=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.fatalErrorHeader="";this.fatalErrorMessage="";this.focusedField="";this.disclosures=DEFAULT_DISCLOSURES;this.submitting=false;this.submitted=false;this.isDone=false;this.showDone=false;this.adoptingSignature=false;this.showLoadError=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.signatureId=null;this.initialId=null;this.documentsSingularPlural="document";this.authStep=null;this.authMethodStates={};this.kbaQuestions=null;this.showSpinner=false;this.declining=false;this.delegating=false;this.delegated=false;this.kbaChoices=[];this.loading=true;this.envelope=null;this.renderedPages={}}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,s,r,o,a;return __generator(this,(function(l){switch(l.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]}l.label=1;case 1:l.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:o=l.sent();this.processAuthResponse(o);return[3,4];case 3:a=l.sent();console.log("[SIGN] Error with signing session",a);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(a.message,(s=a.response)===null||s===void 0?void 0:s.status,(r=a.response)===null||r===void 0?void 0:r.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.processAuthResponse=function(e){var t,i,n,s,r,o,a,l;var d=e.envelope,c=e.recipient;(t=d.documents)===null||t===void 0?void 0:t.sort((function(e,t){return e.order!==t.order?t.order-e.order:t.created_at.localeCompare(e.created_at)}));var u=c.auth_step;this.recipient=c;this.envelope=d;this.disclosures=((n=(i=this.envelope)===null||i===void 0?void 0:i.organization)===null||n===void 0?void 0:n.disclaimer)||DEFAULT_DISCLOSURES;this.authStep=u;this.delegated=!!c.delegated_to;this.agreed=c.agreed;this.signatureId=((r=(s=e.signatures)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.id)||null;this.initialId=((a=(o=e.initials)===null||o===void 0?void 0:o[0])===null||a===void 0?void 0:a.id)||null;this.submitted=c.status==="submitted";this.loading=false;this.isDone=this.submitted;this.showDone=this.submitted;Store.updateEnvelope(this.envelopeId,d);if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.authMethodStates=c.auth_method_states||{};this.kbaQuestions=c.kba_questions;if(Object.values(this.authMethodStates).includes("failed")){this.fatalErrorHeader="Recipient Verification Failed";this.fatalErrorMessage="We were unable to verify your identity. The sender has been notified.";this.isDone=true}if(this.envelope.status==="canceled"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="This envelope has been canceled. The sender has been notified."}else if(c.status==="declined"){this.fatalErrorHeader="Declined";this.fatalErrorMessage="You have declined to sign this request. The sender has been notified."}else if(this.agreed){this.nextButtonLabel="Next"}this.checkRecipientFields();(l=this.envelopeLoaded)===null||l===void 0?void 0:l.emit({endpoint:this.endpoint,envelope:this.envelope})};e.prototype.handleClickAgree=function(){var e=this;this.submitting=true;console.log("[SIGN] Accepting disclosures",this.disclosures);envelopeRecipientAgree(this.endpoint,this.envelopeId,this.roleId,this.disclosures).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] Unable to accept disclosures",t);VerdocsToast("Unable to accept disclosures, please try again later",{style:"error"});(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.submitting=false}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,s;return __generator(this,(function(r){switch(e.detail.id){case"later":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"});break;case"delegate":this.delegating=true;break;case"decline":this.declining=true;break;case"print":window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":{s=this.envelope.documents.find((function(e){return e.type==="attachment"}));if(s){saveAttachment(this.endpoint,this.envelope,s.id).catch((function(e){VerdocsToast("Unable to download PDF, please try again later",{style:"error"});console.log("[SIGN] Error downloading PDF",e)}));(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})}}break}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,i){var n=this;var s=this.getRecipientFields().find((function(t){return t.name===e}));if(s===null||s===void 0?void 0:s.readonly){return}console.log("[SIGN] saveFieldChange",e,{value:t,prepared:i});updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e,t,i).then((function(t){return n.updateRecipientFieldValue(e,t)})).catch((function(e){var t,i,s,r,o,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((s=(i=e.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.error)==="jwt expired"){console.log("[SIGN] Signing session expired");n.fatalErrorHeader="Signing Session Expired";n.fatalErrorMessage="Please reload your browser to continue."}else{console.log("[SIGN] Server error",e);VerdocsToast("Unable to save change, please try again later",{style:"error"})}(r=n.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,o,o,a,o,o,o,l,d;var c=this;return __generator(this,(function(u){switch(u.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,14];case"date":return[3,23];case"timestamp":return[3,24]}return[3,25];case 1:return[2,this.saveFieldChange(e.name,n,false)];case 2:{return[2,this.saveFieldChange(e.name,String(t.target.checked),false)]}u.label=3;case 3:{return[2,this.saveFieldChange(e.name,String(t.target.checked),false)]}u.label=4;case 4:console.log("Saving dropdown",e.name,t.detail);return[2,this.saveFieldChange(e.name,t.detail,false)];case 5:if(t.detail===undefined){return[2]}if(!(t.detail===null))return[3,7];console.log("[SIGN] Clearing initial");return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,null,false)];case 6:o=u.sent();return[2,this.updateRecipientFieldValue(e.name,o)];case 7:if(!this.initialId)return[3,9];console.log("[SIGN] Reusing initial",this.initialId);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,this.initialId,false)];case 8:o=u.sent();return[2,this.updateRecipientFieldValue(e.name,o)];case 9:if(!(typeof t.detail==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.detail)))return[3,11];console.log("[SIGN] Reusing initial",t.detail);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.detail,false)];case 10:o=u.sent();this.initialId=t.detail;return[2,this.updateRecipientFieldValue(e.name,o)];case 11:this.showSpinner=true;return[4,fetch(t.detail)];case 12:return[4,u.sent().blob()];case 13:a=u.sent();return[2,createInitials(this.endpoint,"initial",a).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,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.id,false)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.initialId=t.id;this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.log("Error updating initials",e);VerdocsToast("Unable to save initials, please try again later",{style:"error"});c.showSpinner=false}))];case 14:if(t.detail===undefined){return[2]}if(!(t.detail===null))return[3,16];console.log("[SIGN] Clearing signature");return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,null,false)];case 15:o=u.sent();return[2,this.updateRecipientFieldValue(e.name,o)];case 16:if(!this.signatureId)return[3,18];console.log("[SIGN] Reusing signature",this.signatureId);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,this.signatureId,false)];case 17:o=u.sent();return[2,this.updateRecipientFieldValue(e.name,o)];case 18:if(!(typeof t.detail==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.detail)))return[3,20];console.log("[SIGN] Reusing signature",t.detail);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.detail,false)];case 19:o=u.sent();this.signatureId=t.detail;return[2,this.updateRecipientFieldValue(e.name,o)];case 20:this.showSpinner=true;return[4,fetch(t.detail)];case 21:return[4,u.sent().blob()];case 22:l=u.sent();console.log("[SIGN] Creating new signature");return[2,createSignature(this.endpoint,"signature",l).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,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.id,false)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.signatureId=t.id;this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.warn("[SIGN] Error updating signature",e);VerdocsToast("Unable to save signature, please try again later",{style:"error"});c.showSpinner=false}))];case 23:d=t.detail.formattedDate;if(d){return[2,this.saveFieldChange(e.name,d,false)]}return[3,26];case 24:console.log("[SIGN] Updating timestamp",{value:n,ts:t.target.getAttribute("timestamp")});return[3,26];case 25:console.log("[SIGN] Unhandled field update",{value:n,checked:s},e);return[3,26];case 26:return[2]}}))}))};e.prototype.getSortedFillableFields=function(){var e=this.getRecipientFields().filter((function(e){return e.type!=="timestamp"}));sortFields(e);return e};e.prototype.handleNext=function(){var e;if(this.nextSubmits){try{(e=document.getElementById("air-datepicker-global-container"))===null||e===void 0?void 0:e.remove();this.submitting=true;var t=envelopeRecipientSubmit(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Submitted successfully",t);window.location.reload()}catch(e){console.log("[SIGN] Error submitting",e)}return}var i=this.getNextRequiredField();if(i){var n=getFieldId(i);var s=document.getElementById(n);s===null||s===void 0?void 0:s.scrollIntoView({behavior:"smooth"});s===null||s===void 0?void 0:s.focusField();this.focusedField=i.name}};e.prototype.getRecipientFields=function(){var e=this;var t;return((t=this.envelope)===null||t===void 0?void 0:t.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!isFieldValid(t,e.getRecipientFields())}));if(t.length<1){this.nextButtonLabel="Finish";if(!this.nextSubmits){this.nextSubmits=true}}else{this.nextButtonLabel="Next";this.nextSubmits=false}this.updateAllFlags()};e.prototype.getNextRequiredField=function(){var e=this;var t=this.getSortedFillableFields().filter((function(t){return t.required&&!isFieldFilled(t,e.getRecipientFields())}));sortFields(t);if(t.length===0){var i=this.getSortedFillableFields().filter((function(t){return!isFieldFilled(t,e.getRecipientFields())}));sortFields(i);if(i.length>0){return this.getNextFieldFromList(i)}return null}return this.getNextFieldFromList(t)};e.prototype.getNextFieldFromList=function(e){var t=this;var i=e.findIndex((function(e){return e.name===t.focusedField}));var n=i+1;if(n>=e.length){n=0}return e[n]};e.prototype.handlePrev=function(){var e=this;var t;var i=this.getSortedFillableFields();var n=i.findIndex((function(t){return t.name===e.focusedField}));if(n>0){var s=i[n-1];var r=getFieldId(s);var o=document.getElementById(r);o===null||o===void 0?void 0:o.scrollIntoView({behavior:"smooth",block:"center"});(t=o===null||o===void 0?void 0:o.focusField)===null||t===void 0?void 0:t.call(o);this.focusedField=s.name}};e.prototype.updateAllFlags=function(){var e=this;Object.values(this.renderedPages).forEach((function(t){e.updateFlagsForPage(t)}))};e.prototype.updateFlagsForPage=function(e){var t=this;if(!e)return;var i=document.getElementById(e.containerId+"-controls");if(!i)return;var n=i.querySelectorAll(".verdocs-flag-instance");n.forEach((function(e){return e.remove()}));var s=this.getNextRequiredField();if(s&&s.page===e.pageNumber&&s.document_id===e.documentId){var r="fill";var o="FILL";var a=false;if(!s.required){o="FILL or SKIP";a=true}renderDocumentFlag(e,s.y,s.height||defaultHeight(s.type),{variant:r,label:o,showSkip:a,onSkip:function(){t.handleNext()},onClick:function(){var e;var t=getFieldId(s);var i=document.getElementById(t);i===null||i===void 0?void 0:i.scrollIntoView({behavior:"smooth",block:"center"});(e=i===null||i===void 0?void 0:i.focusField)===null||e===void 0?void 0:e.call(i)}})}};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,this.roleId,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,this.roleId,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);if(this.signatureId){i.setAttribute("signatureid",this.signatureId)}if(this.initialId){i.setAttribute("initialid",this.initialId)}};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;this.renderedPages["".concat(i.documentId,":").concat(i.pageNumber)]=i;console.log("Page rendered",i);var n=this.getSortedFillableFields();console.log("[SIGN] Rendering fields for page",i.pageNumber,n);n.filter((function(e){return e&&e.document_id===i.documentId&&e.page===i.pageNumber})).forEach((function(e,n){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.envelope.recipients.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.document_id===i.documentId&&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();this.updateFlagsForPage(i)};e.prototype.handleAuthenticateSigner=function(e){var t=this;console.log("[SIGN] Submitting authentication step",e);verifySigner(this.endpoint,e).then((function(e){console.log("[SIGN] Verification successful",e);t.processAuthResponse(e)})).catch((function(e){var i,n,s,r,o;console.log("[SIGN] Error submitting authentication step",e);if((s=(n=(i=e.response)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.error)===null||s===void 0?void 0:s.includes("failed")){t.fatalErrorHeader="Recipient Verification Failed";t.fatalErrorMessage="We were unable to verify your identity. The sender has been notified.";t.isDone=true}else{VerdocsToast(((o=(r=e.response)===null||r===void 0?void 0:r.data)===null||o===void 0?void 0:o.error)||"Unable to verify your identity. Please try again.",{style:"error"})}}))};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.delegated){return h(Host,{class:{agreed:false}},h("div",{class:"fatal-error"},h("div",{class:"message"},h("div",{class:"header"},"Delegated Signing Request"),h("p",null,"You have delegated signing to another recipient. You will not be able to sign this request again."))))}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.delegating){return h(Host,{class:"agreed"},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("verdocs-delegate-dialog",{endpoint:this.endpoint,envelope:this.envelope,onExit:function(){return e.delegating=false},onNext:function(t){delegateRecipient(e.endpoint,e.envelopeId,e.roleId,t.detail).then((function(t){VerdocsToast("Delegation request submitted.",{style:"success"});console.log("[SIGN] Delegated successfully",t);e.delegated=true;e.delegating=false})).catch((function(e){console.log("[SIGN] Error delegating request",e);VerdocsToast("Unable to process delegation request. Please try again later.",{style:"error"})}))}}))}if(this.declining){return h(Host,{class:"agreed"},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("verdocs-ok-dialog",{heading:"Decline Signing Request",message:"If you decline to sign this request, you will not be able to sign again in the future. The envelope sender will be notified.",buttonLabel:"OK",showCancel:true,onExit:function(){return e.declining=false},onNext:function(){envelopeRecipientDecline(e.endpoint,e.envelopeId,e.roleId).then((function(e){console.log("[SIGN] Decline result",e);window.location.reload()})).catch((function(e){console.warn("[SIGN] Error declining signing session",e);VerdocsToast("Unable to decline, please try again later",{style:"error"})}))}}))}if(!this.agreed){return h(Host,{class:"agreed"},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("verdocs-disclosure-dialog",{disclosures:this.disclosures,delegator:this.recipient.delegator,onDelegate:function(){return e.delegating=true},onDecline:function(){return e.declining=true},onAccept:function(){return e.handleClickAgree()}}))}if(this.authStep==="passcode"){return h("verdocs-passcode-dialog",{endpoint:this.endpoint,onNext:function(t){return e.processAuthResponse(t.detail.response)}})}if(this.authStep==="email"){return h("verdocs-otp-dialog",{endpoint:this.endpoint,method:"email",onNext:function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.processAuthResponse(t.detail.response);return[2]}))}))}})}if(this.authStep==="kba"&&!this.authMethodStates.kba){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;return __generator(this,(function(i){e=t.detail;this.handleAuthenticateSigner({auth_method:"kba",first_name:e.first_name,last_name:e.last_name,address:e.address,city:e.city,state:e.state,zip:e.zip,dob:e.dob});return[2]}))}))}}))))}if(this.authStep==="kba"&&this.authMethodStates.kba==="questions"){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;var n=this;return __generator(this,(function(s){e=t.detail;this.kbaChoices=__spreadArray(__spreadArray([],this.kbaChoices,true),[e],false);if(this.kbaChoices.length>=this.kbaQuestions.length){i=this.kbaQuestions.map((function(e,t){return{type:e.type,answer:n.kbaChoices[t]}}));console.log("Submitting KBA responses",this.kbaChoices,i);this.handleAuthenticateSigner({auth_method:"kba",responses:i})}return[2]}))}))}}))))}var n=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var s=[{id:"print",label:"Print"},{id:"download",label:"Download"}];if(this.recipient.delegator){n.unshift({id:"delegate",label:"Delegate"})}var r=this.getRecipientFields().filter((function(t){return!isFieldValid(t,e.getRecipientFields())}));r.length>0?console.log("[SIGN] Invalid fields remaining",r.map((function(e){return e.name}))):console.log("[SIGN] All field valid");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||this.submitting,onClick:function(){return e.handleNext()}}),h("div",{style:{marginLeft:"10px"}}),h("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?n:s,onOptionSelected:function(t){return e.handleOptionSelected(t)}}))),function(){var t=e.getSortedFillableFields().find((function(t){return t.name===e.focusedField}));return h("verdocs-signing-progress",{mode:e.nextSubmits?"completed":"start",current:Math.max(1,e.getSortedFillableFields().findIndex((function(t){return t.name===e.focusedField}))+1),total:e.getSortedFillableFields().length,fieldLabel:(t===null||t===void 0?void 0:t.label)||(t===null||t===void 0?void 0:t.name)||"",fieldCompleted:t?!!isFieldFilled(t,e.getRecipientFields()):false,onStarted:function(){e.adoptingSignature=true},onNext:function(){return e.handleNext()},onPrevious:function(){return e.handlePrev()},onExit:function(){return e.handleNext()}})}(),h("div",{class:"document signed-document-container"},(this.envelope.documents||[]).map((function(t){var i=integerSequence(1,t.pages);return h(Fragment,null,e.envelope.documents.length>1&&h("div",{class:"document-separator"},h("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{d:"M20 2H8C6.9 2 6 2.9 6 4V16C6 17.1 6.9 18 8 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2ZM20 16H8V4H20V16ZM4 6H2V20C2 21.1 2.9 22 4 22H18V20H4V6ZM16 12V9C16 8.45 15.55 8 15 8H10V14H15C15.55 14 16 13.55 16 13V12ZM14.5 9.5L14.5001 12.5H11.5V9.5H14.5Z",fill:"currentColor"})),h("span",null,t.name)),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(){e.isDone=true;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.adoptingSignature&&h("verdocs-adopt-signature-dialog",{name:formatFullName(this.recipient),onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,s;return __generator(this,(function(r){switch(r.label){case 0:console.log("[SIGN] Adopting signature/initials block",t.detail);this.showSpinner=true;return[4,fetch(t.detail.signature)];case 1:return[4,r.sent().blob()];case 2:e=r.sent();return[4,fetch(t.detail.initials)];case 3:return[4,r.sent().blob()];case 4:i=r.sent();return[4,createSignature(this.endpoint,"signature",e)];case 5:n=r.sent();console.log("[SIGN] Created signature",n);this.signatureId=n.id;return[4,createInitials(this.endpoint,"initial",i)];case 6:s=r.sent();console.log("[SIGN] Created initials",s);this.initialId=s.id;this.showSpinner=false;this.adoptingSignature=false;return[2]}}))}))},onExit:function(){return e.adoptingSignature=false}}),(this.submitting||this.showSpinner)&&h("verdocs-portal",null,h("div",{class:"spinner-overlay"},h("verdocs-spinner",null))),!this.loading&&!this.isDone&&h("verdocs-sign-footer",{endpoint:this.endpoint,envelopeId:this.envelopeId,isDone:this.isDone,onAskQuestion:function(t){askQuestion(e.endpoint,e.envelopeId,e.roleId,{question:t.detail.question}).then((function(){return VerdocsToast("Your question has been sent.",{style:"success"})})).catch((function(e){console.log("Error asking question",e);VerdocsToast("Unable to send question, please try again later.",{style:"error"})}))},onDecline:function(){return e.declining=true},onFinishLater:function(){return e.showFinishLater=true}}))};return e}();VerdocsSign.style=verdocsSignCss;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=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["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-BIRwgFLv.js";import{VerdocsEndpoint,DEFAULT_DISCLOSURES,startSigningSession,envelopeRecipientAgree,updateEnvelopeField,createSignature,createInitials,sortFields,envelopeRecipientSubmit,isFieldValid,isFieldFilled,uploadEnvelopeFieldAttachment,deleteEnvelopeFieldAttachment,formatFullName,fullNameToInitials,verifySigner,delegateRecipient,envelopeRecipientDecline,askQuestion,integerSequence}from"@verdocs/js-sdk";import{a as saveAttachment,u as updateDocumentFieldValue,g as getFieldId,r as renderDocumentFlag,b as renderDocumentField,d as defaultHeight}from"./utils-UeubfAI_.js";import{V as VerdocsToast}from"./Toast-CyvDgtoV.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-bS8INhRF.js";import"./index-dzBXqXlK.js";import"./Types-dqxNbm_b.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;min-height:700px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#f5f5f5;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-sign verdocs-button>button.standard{background:#2a63f6}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;padding-right:140px;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>.document .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;max-width:1028px;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-sign>.document .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-sign>.document .document-separator:first-child{margin-top:0}verdocs-sign .signed-document-container{width:64%;margin-left:260px}@media (max-width: 600px){verdocs-sign .signed-document-container{width:100%;margin-left:0}verdocs-sign>.document{padding-right:15px}verdocs-sign .verdocs-flag-instance{display:none !important}}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 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:360px;width:50%;font-size:16px;background:white;-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:#4c56cb}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 getFieldLabel=function(e){if(!e)return"";var t={signature:"Signature",initial:"Initials",date:"Date",textbox:"Text Field",checkbox:"Checkbox",radio:"Radio Button",dropdown:"Dropdown",attachment:"Attachment",payment:"Payment"};var i=t[e.type]||"Field";if(e.required){return"Required ".concat(i,"*")}return"Optional ".concat(i)};var VerdocsSign=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.envelopeLoaded=createEvent(this,"envelopeLoaded");this.envelopeUpdated=createEvent(this,"envelopeUpdated");this.endpoint=new VerdocsEndpoint({sessionType:"signing"});this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.recipient=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.fatalErrorHeader="";this.fatalErrorMessage="";this.focusedField="";this.disclosures=DEFAULT_DISCLOSURES;this.submitting=false;this.submitted=false;this.isDone=false;this.showDone=false;this.adoptingSignature=false;this.showLoadError=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.signatureId=null;this.initialId=null;this.documentsSingularPlural="document";this.authStep=null;this.authMethodStates={};this.kbaQuestions=null;this.showSpinner=false;this.declining=false;this.delegating=false;this.delegated=false;this.kbaChoices=[];this.loading=true;this.envelope=null;this.renderedPages={}}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,s,r,o,a,l;var d=this;return __generator(this,(function(c){switch(c.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]}c.label=1;case 1:c.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:o=c.sent();this.processAuthResponse(o);a=this.getSortedFillableFields();if(a.length>0){setTimeout((function(){d.focusedField=a[0].name}),500)}return[3,4];case 3:l=c.sent();console.log("[SIGN] Error with signing session",l);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(l.message,(s=l.response)===null||s===void 0?void 0:s.status,(r=l.response)===null||r===void 0?void 0:r.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.processAuthResponse=function(e){var t,i,n,s,r,o,a,l;var d=e.envelope,c=e.recipient;(t=d.documents)===null||t===void 0?void 0:t.sort((function(e,t){return e.order!==t.order?t.order-e.order:t.created_at.localeCompare(e.created_at)}));var u=c.auth_step;this.recipient=c;this.envelope=d;this.disclosures=((n=(i=this.envelope)===null||i===void 0?void 0:i.organization)===null||n===void 0?void 0:n.disclaimer)||DEFAULT_DISCLOSURES;this.authStep=u;this.delegated=!!c.delegated_to;this.agreed=c.agreed;this.signatureId=((r=(s=e.signatures)===null||s===void 0?void 0:s[0])===null||r===void 0?void 0:r.id)||null;this.initialId=((a=(o=e.initials)===null||o===void 0?void 0:o[0])===null||a===void 0?void 0:a.id)||null;this.submitted=c.status==="submitted";this.loading=false;this.isDone=this.submitted;this.showDone=this.submitted;Store.updateEnvelope(this.envelopeId,d);if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.authMethodStates=c.auth_method_states||{};this.kbaQuestions=c.kba_questions;if(Object.values(this.authMethodStates).includes("failed")){this.fatalErrorHeader="Recipient Verification Failed";this.fatalErrorMessage="We were unable to verify your identity. The sender has been notified.";this.isDone=true}if(this.envelope.status==="canceled"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="This envelope has been canceled. The sender has been notified."}else if(c.status==="declined"){this.fatalErrorHeader="Declined";this.fatalErrorMessage="You have declined to sign this request. The sender has been notified."}else if(this.agreed){this.nextButtonLabel="Next"}this.checkRecipientFields();(l=this.envelopeLoaded)===null||l===void 0?void 0:l.emit({endpoint:this.endpoint,envelope:this.envelope})};e.prototype.handleClickAgree=function(){var e=this;this.submitting=true;console.log("[SIGN] Accepting disclosures",this.disclosures);envelopeRecipientAgree(this.endpoint,this.envelopeId,this.roleId,this.disclosures).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] Unable to accept disclosures",t);VerdocsToast("Unable to accept disclosures, please try again later",{style:"error"});(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.submitting=false}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,s;return __generator(this,(function(r){switch(e.detail.id){case"later":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"});break;case"delegate":this.delegating=true;break;case"decline":this.declining=true;break;case"print":window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":{s=this.envelope.documents.find((function(e){return e.type==="attachment"}));if(s){saveAttachment(this.endpoint,this.envelope,s.id).catch((function(e){VerdocsToast("Unable to download PDF, please try again later",{style:"error"});console.log("[SIGN] Error downloading PDF",e)}));(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})}}break}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,i){var n=this;var s=this.getRecipientFields().find((function(t){return t.name===e}));if(s===null||s===void 0?void 0:s.readonly){return}console.log("[SIGN] saveFieldChange",e,{value:t,prepared:i});updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e,t,i).then((function(t){return n.updateRecipientFieldValue(e,t)})).catch((function(e){var t,i,s,r,o,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((s=(i=e.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.error)==="jwt expired"){console.log("[SIGN] Signing session expired");n.fatalErrorHeader="Signing Session Expired";n.fatalErrorMessage="Please reload your browser to continue."}else{console.log("[SIGN] Server error",e);VerdocsToast("Unable to save change, please try again later",{style:"error"})}(r=n.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,o,o,a,o,o,o,l,d;var c=this;return __generator(this,(function(u){switch(u.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,14];case"date":return[3,23];case"timestamp":return[3,24]}return[3,25];case 1:return[2,this.saveFieldChange(e.name,n,false)];case 2:{return[2,this.saveFieldChange(e.name,String(t.target.checked),false)]}u.label=3;case 3:{return[2,this.saveFieldChange(e.name,String(t.target.checked),false)]}u.label=4;case 4:console.log("Saving dropdown",e.name,t.detail);return[2,this.saveFieldChange(e.name,t.detail,false)];case 5:if(t.detail===undefined){return[2]}if(!(t.detail===null))return[3,7];console.log("[SIGN] Clearing initial");return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,null,false)];case 6:o=u.sent();return[2,this.updateRecipientFieldValue(e.name,o)];case 7:if(!this.initialId)return[3,9];console.log("[SIGN] Reusing initial",this.initialId);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,this.initialId,false)];case 8:o=u.sent();return[2,this.updateRecipientFieldValue(e.name,o)];case 9:if(!(typeof t.detail==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.detail)))return[3,11];console.log("[SIGN] Reusing initial",t.detail);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.detail,false)];case 10:o=u.sent();this.initialId=t.detail;return[2,this.updateRecipientFieldValue(e.name,o)];case 11:this.showSpinner=true;return[4,fetch(t.detail)];case 12:return[4,u.sent().blob()];case 13:a=u.sent();return[2,createInitials(this.endpoint,"initial",a).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,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.id,false)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.initialId=t.id;this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.log("Error updating initials",e);VerdocsToast("Unable to save initials, please try again later",{style:"error"});c.showSpinner=false}))];case 14:if(t.detail===undefined){return[2]}if(!(t.detail===null))return[3,16];console.log("[SIGN] Clearing signature");return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,null,false)];case 15:o=u.sent();return[2,this.updateRecipientFieldValue(e.name,o)];case 16:if(!this.signatureId)return[3,18];console.log("[SIGN] Reusing signature",this.signatureId);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,this.signatureId,false)];case 17:o=u.sent();return[2,this.updateRecipientFieldValue(e.name,o)];case 18:if(!(typeof t.detail==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.detail)))return[3,20];console.log("[SIGN] Reusing signature",t.detail);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.detail,false)];case 19:o=u.sent();this.signatureId=t.detail;return[2,this.updateRecipientFieldValue(e.name,o)];case 20:this.showSpinner=true;return[4,fetch(t.detail)];case 21:return[4,u.sent().blob()];case 22:l=u.sent();console.log("[SIGN] Creating new signature");return[2,createSignature(this.endpoint,"signature",l).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,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.id,false)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.signatureId=t.id;this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.warn("[SIGN] Error updating signature",e);VerdocsToast("Unable to save signature, please try again later",{style:"error"});c.showSpinner=false}))];case 23:d=t.detail.formattedDate;if(d){return[2,this.saveFieldChange(e.name,d,false)]}return[3,26];case 24:console.log("[SIGN] Updating timestamp",{value:n,ts:t.target.getAttribute("timestamp")});return[3,26];case 25:console.log("[SIGN] Unhandled field update",{value:n,checked:s},e);return[3,26];case 26:return[2]}}))}))};e.prototype.getSortedFillableFields=function(){var e=this.getRecipientFields().filter((function(e){return e.type!=="timestamp"}));sortFields(e);return e};e.prototype.handleNext=function(){var e;if(this.nextSubmits){try{(e=document.getElementById("air-datepicker-global-container"))===null||e===void 0?void 0:e.remove();this.submitting=true;var t=envelopeRecipientSubmit(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Submitted successfully",t);window.location.reload()}catch(e){console.log("[SIGN] Error submitting",e)}return}var i=this.getNextRequiredField();if(i){var n=getFieldId(i);var s=document.getElementById(n);s===null||s===void 0?void 0:s.scrollIntoView({behavior:"smooth"});s===null||s===void 0?void 0:s.focusField();this.focusedField=i.name}};e.prototype.getRecipientFields=function(){var e=this;var t;return((t=this.envelope)===null||t===void 0?void 0:t.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!isFieldValid(t,e.getRecipientFields())}));if(t.length<1){this.nextButtonLabel="Finish";if(!this.nextSubmits){this.nextSubmits=true}}else{this.nextButtonLabel="Next";this.nextSubmits=false}this.updateAllFlags()};e.prototype.getNextRequiredField=function(){var e=this;var t=this.getSortedFillableFields().filter((function(t){return t.required&&!isFieldFilled(t,e.getRecipientFields())}));sortFields(t);console.log("[SIGN] Pending fields",t.map((function(e){return"".concat(e.name," (").concat(e.type,") req=").concat(e.required)})));if(t.length===0){var i=this.getSortedFillableFields().filter((function(t){return!isFieldFilled(t,e.getRecipientFields())}));sortFields(i);if(i.length>0){return this.getNextFieldFromList(i)}return null}return this.getNextFieldFromList(t)};e.prototype.getNextFieldFromList=function(e){var t=this;var i=e.findIndex((function(e){return e.name===t.focusedField}));var n=i+1;if(n>=e.length){n=0}return e[n]};e.prototype.handlePrev=function(){var e=this;var t;var i=this.getSortedFillableFields();var n=i.findIndex((function(t){return t.name===e.focusedField}));if(n>0){var s=i[n-1];var r=getFieldId(s);var o=document.getElementById(r);o===null||o===void 0?void 0:o.scrollIntoView({behavior:"smooth",block:"center"});(t=o===null||o===void 0?void 0:o.focusField)===null||t===void 0?void 0:t.call(o);this.focusedField=s.name}};e.prototype.updateAllFlags=function(){var e=this;Object.values(this.renderedPages).forEach((function(t){e.updateFlagsForPage(t)}))};e.prototype.updateFlagsForPage=function(e){var t=this;if(!e)return;var i=document.getElementById(e.containerId+"-controls");if(!i)return;var n=i.querySelectorAll(".verdocs-flag-instance");n.forEach((function(e){return e.remove()}));var s=this.getNextRequiredField();var r=this.getRecipientFields().find((function(e){return e.name===t.focusedField}));if(r&&!isFieldFilled(r,this.getRecipientFields())){s=r}if(s&&s.page===e.pageNumber&&s.document_id===e.documentId){var o="fill";var a="FILL";var l=false;if(!s.required){a="FILL or SKIP";l=true}renderDocumentFlag(e,s.y,s.height||defaultHeight(s.type),{variant:o,label:a,showSkip:l,onSkip:function(){t.handleNext()},onClick:function(){var e;var t=getFieldId(s);var i=document.getElementById(t);i===null||i===void 0?void 0:i.scrollIntoView({behavior:"smooth",block:"center"});(e=i===null||i===void 0?void 0:i.focusField)===null||e===void 0?void 0:e.call(i)}})}};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,this.roleId,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,this.roleId,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.addEventListener("adopt",(function(){n.focusedField=t.name;n.adoptingSignature=true}));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);if(this.signatureId){i.setAttribute("signatureid",this.signatureId)}if(this.initialId){i.setAttribute("initialid",this.initialId)}};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;this.renderedPages["".concat(i.documentId,":").concat(i.pageNumber)]=i;console.log("Page rendered",i);var n=this.getSortedFillableFields();console.log("[SIGN] Rendering fields for page",i.pageNumber,n);n.filter((function(e){return e&&e.document_id===i.documentId&&e.page===i.pageNumber})).forEach((function(e,n){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.envelope.recipients.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.document_id===i.documentId&&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();this.updateFlagsForPage(i)};e.prototype.handleAuthenticateSigner=function(e){var t=this;console.log("[SIGN] Submitting authentication step",e);verifySigner(this.endpoint,e).then((function(e){console.log("[SIGN] Verification successful",e);t.processAuthResponse(e)})).catch((function(e){var i,n,s,r,o,a;console.log("[SIGN] Error submitting authentication step",e);console.log((i=e.response)===null||i===void 0?void 0:i.data);if((r=(s=(n=e.response)===null||n===void 0?void 0:n.data)===null||s===void 0?void 0:s.error)===null||r===void 0?void 0:r.includes("failed")){t.fatalErrorHeader="Recipient Verification Failed";t.fatalErrorMessage="We were unable to verify your identity. The sender has been notified.";t.isDone=true}else{VerdocsToast(((a=(o=e.response)===null||o===void 0?void 0:o.data)===null||a===void 0?void 0:a.error)||"Unable to verify your identity. Please try again.",{style:"error"})}}))};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.delegated){return h(Host,{class:{agreed:false}},h("div",{class:"fatal-error"},h("div",{class:"message"},h("div",{class:"header"},"Delegated Signing Request"),h("p",null,"You have delegated signing to another recipient. You will not be able to sign this request again."))))}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.delegating){return h(Host,{class:"agreed"},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("verdocs-delegate-dialog",{endpoint:this.endpoint,envelope:this.envelope,onExit:function(){return e.delegating=false},onNext:function(t){delegateRecipient(e.endpoint,e.envelopeId,e.roleId,t.detail).then((function(t){VerdocsToast("Delegation request submitted.",{style:"success"});console.log("[SIGN] Delegated successfully",t);e.delegated=true;e.delegating=false})).catch((function(e){console.log("[SIGN] Error delegating request",e);VerdocsToast("Unable to process delegation request. Please try again later.",{style:"error"})}))}}))}if(this.declining){return h(Host,{class:"agreed"},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("verdocs-ok-dialog",{heading:"Decline Signing Request",message:"If you decline to sign this request, you will not be able to sign again in the future. The envelope sender will be notified.",buttonLabel:"OK",showCancel:true,onExit:function(){return e.declining=false},onNext:function(){envelopeRecipientDecline(e.endpoint,e.envelopeId,e.roleId).then((function(e){console.log("[SIGN] Decline result",e);window.location.reload()})).catch((function(e){console.warn("[SIGN] Error declining signing session",e);VerdocsToast("Unable to decline, please try again later",{style:"error"})}))}}))}if(!this.agreed){return h(Host,{class:"agreed"},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("verdocs-disclosure-dialog",{disclosures:this.disclosures,delegator:this.recipient.delegator,onDelegate:function(){return e.delegating=true},onDecline:function(){return e.declining=true},onAccept:function(){return e.handleClickAgree()}}))}if(this.authStep==="passcode"){return h("verdocs-passcode-dialog",{endpoint:this.endpoint,onNext:function(t){return e.processAuthResponse(t.detail.response)}})}if(this.authStep==="email"){return h("verdocs-otp-dialog",{endpoint:this.endpoint,method:"email",onNext:function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.processAuthResponse(t.detail.response);return[2]}))}))}})}if(this.authStep==="kba"&&!this.authMethodStates.kba){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;return __generator(this,(function(i){e=t.detail;this.handleAuthenticateSigner({auth_method:"kba",first_name:e.first_name,last_name:e.last_name,address:e.address,city:e.city,state:e.state,zip:e.zip,dob:e.dob});return[2]}))}))}}))))}if(this.authStep==="kba"&&this.authMethodStates.kba==="questions"){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;var n=this;return __generator(this,(function(s){e=t.detail;this.kbaChoices=__spreadArray(__spreadArray([],this.kbaChoices,true),[e],false);if(this.kbaChoices.length>=this.kbaQuestions.length){i=this.kbaQuestions.map((function(e,t){return{type:e.type,answer:n.kbaChoices[t]}}));console.log("Submitting KBA responses",this.kbaChoices,i);this.handleAuthenticateSigner({auth_method:"kba",responses:i})}return[2]}))}))}}))))}var n=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var s=[{id:"print",label:"Print"},{id:"download",label:"Download"}];if(this.recipient.delegator){n.unshift({id:"delegate",label:"Delegate"})}var r=this.getRecipientFields().filter((function(t){return!isFieldValid(t,e.getRecipientFields())}));r.length>0?console.log("[SIGN] Invalid fields remaining",r.map((function(e){return e.name}))):console.log("[SIGN] All field valid");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||this.submitting,onClick:function(){return e.handleNext()}}),h("div",{style:{marginLeft:"10px"}}),h("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?n:s,onOptionSelected:function(t){return e.handleOptionSelected(t)}}))),function(){var t=e.getSortedFillableFields().find((function(t){return t.name===e.focusedField}));var i=e.getSortedFillableFields().findIndex((function(t){return t.name===e.focusedField}))+1;var n=e.getSortedFillableFields().length;var s="start";if(e.nextSubmits){s="completed"}else if(e.signatureId||e.initialId){s="signing"}return h("verdocs-signing-progress",{mode:s,current:Math.max(1,i),total:n,fieldLabel:getFieldLabel(t),fieldCompleted:t?!!isFieldFilled(t,e.getRecipientFields()):false,onStarted:function(){e.adoptingSignature=true},onNext:function(){return e.handleNext()},onPrevious:function(){return e.handlePrev()},onExit:function(){return e.handleNext()}})}(),h("div",{class:"document signed-document-container"},(this.envelope.documents||[]).map((function(t){var i=integerSequence(1,t.pages);return h(Fragment,null,e.envelope.documents.length>1&&h("div",{class:"document-separator"},h("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{d:"M20 2H8C6.9 2 6 2.9 6 4V16C6 17.1 6.9 18 8 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2ZM20 16H8V4H20V16ZM4 6H2V20C2 21.1 2.9 22 4 22H18V20H4V6ZM16 12V9C16 8.45 15.55 8 15 8H10V14H15C15.55 14 16 13.55 16 13V12ZM14.5 9.5L14.5001 12.5H11.5V9.5H14.5Z",fill:"currentColor"})),h("span",null,t.name)),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(){e.isDone=true;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.adoptingSignature&&h("verdocs-adopt-signature-dialog",{name:formatFullName(this.recipient),onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,s,r,o,o;var a=this;return __generator(this,(function(l){switch(l.label){case 0:console.log("[SIGN] Adopting signature/initials block",t.detail);this.showSpinner=true;return[4,fetch(t.detail.signature)];case 1:return[4,l.sent().blob()];case 2:e=l.sent();return[4,fetch(t.detail.initials)];case 3:return[4,l.sent().blob()];case 4:i=l.sent();return[4,createSignature(this.endpoint,"signature",e)];case 5:n=l.sent();console.log("[SIGN] Created signature",n);this.signatureId=n.id;return[4,createInitials(this.endpoint,"initial",i)];case 6:s=l.sent();console.log("[SIGN] Created initials",s);this.initialId=s.id;this.showSpinner=false;this.adoptingSignature=false;if(!this.focusedField)return[3,11];r=this.getRecipientFields().find((function(e){return e.name===a.focusedField}));if(!(r&&!isFieldFilled(r,this.getRecipientFields())))return[3,11];console.log("[SIGN] Auto-applying adopted signature to focused field",r.name);if(!(r.type==="signature"))return[3,8];return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,r.name,this.signatureId,false)];case 7:o=l.sent();this.updateRecipientFieldValue(r.name,o);return[3,10];case 8:if(!(r.type==="initial"))return[3,10];return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,r.name,this.initialId,false)];case 9:o=l.sent();this.updateRecipientFieldValue(r.name,o);l.label=10;case 10:this.checkRecipientFields();l.label=11;case 11:return[2]}}))}))},onExit:function(){return e.adoptingSignature=false}}),(this.submitting||this.showSpinner)&&h("verdocs-portal",null,h("div",{class:"spinner-overlay"},h("verdocs-spinner",null))),!this.loading&&!this.isDone&&h("verdocs-sign-footer",{endpoint:this.endpoint,envelopeId:this.envelopeId,isDone:this.isDone,onAskQuestion:function(t){askQuestion(e.endpoint,e.envelopeId,e.roleId,{question:t.detail.question}).then((function(){return VerdocsToast("Your question has been sent.",{style:"success"})})).catch((function(e){console.log("Error asking question",e);VerdocsToast("Unable to send question, please try again later.",{style:"error"})}))},onDecline:function(){return e.declining=true},onFinishLater:function(){return e.showFinishLater=true}}))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|
|
2
2
|
//# sourceMappingURL=verdocs-sign.entry.js.map
|