@verdocs/web-sdk 1.7.4 → 1.7.7
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/{VerdocsEndpoint-4b97517d.js → VerdocsEndpoint-efa7c21e.js} +42 -2
- package/dist/cjs/VerdocsEndpoint-efa7c21e.js.map +1 -0
- package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-dropdown_4.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-quick-functions_3.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-search.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +4 -30
- package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.css +32 -9
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +17 -40
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/components/VerdocsEndpoint.js +41 -1
- package/dist/components/VerdocsEndpoint.js.map +1 -1
- package/dist/components/verdocs-sign.js +3 -29
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{VerdocsEndpoint-9353e4a0.js → VerdocsEndpoint-9260b220.js} +42 -2
- package/dist/esm/VerdocsEndpoint-9260b220.js.map +1 -0
- package/dist/esm/verdocs-auth.entry.js +1 -1
- package/dist/esm/verdocs-dropdown_4.entry.js +1 -1
- package/dist/esm/verdocs-quick-functions_3.entry.js +1 -1
- package/dist/esm/verdocs-search.entry.js +1 -1
- package/dist/esm/verdocs-sign.entry.js +4 -30
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/VerdocsEndpoint-9260b220.js +2 -0
- package/dist/esm-es5/VerdocsEndpoint-9260b220.js.map +1 -0
- package/dist/esm-es5/verdocs-auth.entry.js +1 -1
- package/dist/esm-es5/verdocs-dropdown_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-quick-functions_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-search.entry.js +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/typings.d.ts +4 -0
- package/dist/verdocs-web-sdk/{p-b3419893.entry.js → p-051cc391.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-b3419893.entry.js.map → p-051cc391.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-06530c98.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-06530c98.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-0df2b27c.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-4e29c137.entry.js → p-1f82a5b4.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-4e29c137.entry.js.map → p-1f82a5b4.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-ba477710.system.entry.js → p-2ab7beb1.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-ba477710.system.entry.js.map → p-2ab7beb1.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-337c2313.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-337c2313.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-24d7c3b0.entry.js → p-339b3031.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-24d7c3b0.entry.js.map → p-339b3031.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-c3e77379.system.entry.js → p-7b2c0c20.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c3e77379.system.entry.js.map → p-7b2c0c20.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-9d801657.system.entry.js → p-7d3b43cb.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-9d801657.system.entry.js.map → p-7d3b43cb.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-bd2004b7.entry.js → p-8615b75d.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-bd2004b7.entry.js.map → p-8615b75d.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-1f4039a4.system.entry.js → p-93f92d14.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-1f4039a4.system.entry.js.map → p-93f92d14.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-a10c13cd.js +2 -0
- package/dist/verdocs-web-sdk/p-a10c13cd.js.map +1 -0
- package/dist/verdocs-web-sdk/p-d00144e7.system.js +2 -0
- package/dist/{esm-es5/VerdocsEndpoint-9353e4a0.js.map → verdocs-web-sdk/p-d00144e7.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/VerdocsEndpoint-4b97517d.js.map +0 -1
- package/dist/esm/VerdocsEndpoint-9353e4a0.js.map +0 -1
- package/dist/esm-es5/VerdocsEndpoint-9353e4a0.js +0 -2
- package/dist/verdocs-web-sdk/p-07f55897.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-07f55897.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-64127985.system.js +0 -2
- package/dist/verdocs-web-sdk/p-64127985.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-72115808.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-72115808.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-7f162244.js +0 -2
- package/dist/verdocs-web-sdk/p-7f162244.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{l(o.next(e))}catch(e){r(e)}}function s(e){try{l(o["throw"](e))}catch(e){r(e)}}function l(e){e.done?n(e.value):i(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-af5f4964.js";import{V as VerdocsEndpoint,g as getSigningSession,a as getDocument,u as updateRecipientStatus,b as getDocumentFile,c as updateDocumentField}from"./VerdocsEndpoint-9353e4a0.js";var e164Regex=new RegExp(/\+[1-9]\d{6,14}/g);function simpleE164Validator(e){return e!==null&&e.length<16&&e.length>6&&e164Regex.test(e)||e===""||e===null}var EmailRegEx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var isValidEmail=function(e){return EmailRegEx.test(e)};var isValidPhone=function(e){return simpleE164Validator(e)};function getRGBA(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function rescale(e,t){return e*t}var verdocsSignCss='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{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;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);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}';var VerdocsSign=function(){function e(e){registerInstance(this,e);this.endpoint=VerdocsEndpoint.getDefault();this.documentId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o,i,r;var a=this;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.documentId," / ").concat(this.documentId));return[4,getSigningSession(this.endpoint,{documentId:this.documentId,roleId:this.roleId,inviteCode:this.inviteCode})];case 1:e=s.sent(),t=e.session,n=e.recipient,o=e.signerToken;console.log("[SIGN] Got signing session ".concat(t.email," / ").concat(t.profile_id));this.recipient=n;this.signerToken=o;this.endpoint.setToken(o);if(this.recipient.agreed){this.nextButtonLabel="Next"}return[4,getDocument(this.endpoint,this.documentId)];case 2:i=s.sent();this.document=i;console.log("[SIGN] Signing document",i);this.pdfUrl="".concat(this.endpoint.getBaseURL(),"/documents/").concat(this.documentId,"/envelope_documents/").concat(i.envelope_document_id,"?file=true");this.recipientIndex=this.document.recipients.findIndex((function(e){return e.role_name==a.roleId}));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((function(e){return e.recipient_role===a.roleId}));console.log("Loaded fields",this.fields);return[3,4];case 3:r=s.sent();console.log("Error with signing session",r);return[3,4];case 4:return[2]}}))}))};e.prototype.handleClickAgree=function(){var e=this;console.log("agree clicked");updateRecipientStatus(this.endpoint,this.documentId,this.roleId,"update",{agreed:true}).then((function(t){console.log("update result",t);e.nextButtonLabel="Next";e.recipient=t})).catch((function(e){console.log("update failure",e)}))};e.prototype.savePDF=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o;return __generator(this,(function(i){switch(i.label){case 0:e="".concat(this.document.name," - ").concat(this.document.updated_at.split("T")[0],".pdf");return[4,getDocumentFile(this.endpoint,this.documentId,this.document.envelope_document_id)];case 1:t=i.sent();n=new XMLHttpRequest;n.responseType="blob";n.onload=function(){var t=document.createElement("a");t.href=window.URL.createObjectURL(n.response);t.download=e;t.style.display="none";document.body.appendChild(t);t.click();t.remove()};o="data:application/pdf;base64,".concat(t);console.log("url",o.length,o);n.open("GET","data:application/pdf;base64,".concat(t));n.send();return[2]}}))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((function(){}));break}return[2]}))}))};e.prototype.handleFieldChange=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(i){console.log("fieldChange",e,t.detail);switch(e.type){case"textbox":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){var t,n,o;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((o=(n=e.response)===null||n===void 0?void 0:n.data)===null||o===void 0?void 0:o.error)==="jwt expired"){console.log("jwt expired")}console.log("Error updating",e)}));break;case"checkbox_group":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:[{id:n,checked:t.detail}]}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"radio_button_group":o=e.settings.options.map((function(e){return{id:e.id,selected:n===e.id}}));updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:o}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"dropdown":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"initial":console.log("Got initial",t.detail);break;case"signature":console.log("Got signature",t.detail);break}return[2]}))}))};e.prototype.renderCheckboxGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xScale,n.x);var a=rescale(e.yScale,n.y);var s={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-checkbox",{style:s,order:o,value:n.checked,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.renderRadioGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xScale,n.x);var a=rescale(e.yScale,n.y);var s={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-radio-button",{style:s,order:o,value:n.id,name:t.name,checked:n.selected,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.isFieldValid=function(e){var t,n,o,i,r,a,s,l,c,d,u,p;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return isValidEmail(((n=e.settings)===null||n===void 0?void 0:n.result)||"");case"phone":return isValidPhone(((o=e.settings)===null||o===void 0?void 0:o.result)||"");default:return!!((i=e.settings)===null||i===void 0?void 0:i.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((r=e.settings)===null||r===void 0?void 0:r.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":var h=(((l=(s=e.settings)===null||s===void 0?void 0:s.options)===null||l===void 0?void 0:l.filter((function(e){return e.checked})))||[]).length;return h>=(((c=e.settings)===null||c===void 0?void 0:c.minimum_checked)||0)&&h<=(((d=e.settings)===null||d===void 0?void 0:d.maximum_checked)||999);case"radio_button_group":return(((p=(u=e.settings)===null||u===void 0?void 0:u.options)===null||p===void 0?void 0:p.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.getFieldId=function(e){return"verdocs-doc-fld-".concat(e.name)};e.prototype.handleNext=function(){var e=this;var t=this.fields.filter((function(e){return e.required}));console.log("required Fields",t);var n=t.findIndex((function(t){return t.name===e.focusedField}));console.log("focused Index",n);var o=n+1;if(o>=t.length){o=0}var i=t[o];console.log("next required field",i);if(i){var r=this.getFieldId(i);var a=document.getElementById(r);console.log("focusing",r,a);a===null||a===void 0?void 0:a.focusField();this.focusedField=i.name}};e.prototype.setControlStyles=function(e,t,n){var o=t.settings,i=o.x,r=i===void 0?0:i,a=o.y,s=a===void 0?0:a,l=o.width,c=l===void 0?150:l,d=o.height,u=d===void 0?50:d;e.style.width="".concat(c,"px");e.style.height="".concat(u,"px");e.style.position="absolute";e.style.left="".concat(rescale(n.xScale,r),"px");e.style.bottom="".concat(rescale(n.yScale,s),"px");e.style.transform="scale(".concat(n.xScale,", ").concat(n.yScale,")");e.style.backgroundColor=t["rgba"]||getRGBA(this.recipientIndex)};e.prototype.renderField=function(e,t){var n=this;var o=document.getElementById(t.containerId+"-controls");if(!o){return}var i=this.getFieldId(e);var r=document.getElementById(i);if(r){this.setControlStyles(r,e,t);return}var a;switch(e.type){case"attachment":case"checkbox":case"date":case"dropdown":case"initial":case"payment":case"signature":case"textarea":case"textbox":a=document.createElement("verdocs-field-".concat(e.type));break;case"checkbox_group":break;case"radio_button_group":break;default:console.log("[SIGN] Skipping unsupported field type",e)}if(a){a.field=e;a.recipient=this.recipient;a.setAttribute("id",i);a.addEventListener("fieldChange",(function(t){return n.handleFieldChange(e,t)}));this.setControlStyles(a,e,t);o.appendChild(a)}};e.prototype.handlePageRendered=function(e){var t=this;var n=e.detail;console.log("[SIGN] Page rendered",n);var o=this.fields.filter((function(e){return e.page===n.renderedPage.pageNumber}));console.log("[SIGN] Fields on page",o);o.forEach((function(e){return t.renderField(e,n.renderedPage)}))};e.prototype.render=function(){var e=this;var t,n,o,i;var r=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return h(Host,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(t=this.recipient)===null||t===void 0?void 0:t.agreed}},h("div",{class:"header"},h("div",{class:"intro"},"Please review and act on these documents."),h("div",{class:"toolbar"},h("div",{class:"tools"},h("verdocs-dropdown",{options:r,onOptionSelected:function(t){return e.handleOptionSelected(t)}}),!((n=this.recipient)===null||n===void 0?void 0:n.agreed)?h("div",{class:"agree"},h("div",{class:"agree-checkbox"},h("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:function(){return e.handleClickAgree()}}),h("label",{htmlFor:"agree-checkbox-element"})),h("span",null,"I agree to use electronic records and signatures.")):h("div",{style:{flex:"1"}}),h("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((o=this.recipient)===null||o===void 0?void 0:o.agreed),onClick:function(){return e.handleNext()}})))),!((i=this.recipient)===null||i===void 0?void 0:i.agreed)?h("div",{class:"cover"}):h("div",{style:{display:"none"}}),h("div",{class:"document"},this.pdfUrl?h("verdocs-view",{source:this.pdfUrl,endpoint:this.endpoint,onPageRendered:function(t){return e.handlePageRendered(t)},pageLayers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}):h("verdocs-loader",null)))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,i){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?n(e.value):o(e.value).then(a,s)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(r=a[0]&2?o["return"]:a[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;if(o=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];o=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-af5f4964.js";import{V as VerdocsEndpoint,g as getSigningSession,a as getDocument,u as updateRecipientStatus,b as getDocumentFile,c as updateDocumentField}from"./VerdocsEndpoint-9260b220.js";var e164Regex=new RegExp(/\+[1-9]\d{6,14}/g);function simpleE164Validator(e){return e!==null&&e.length<16&&e.length>6&&e164Regex.test(e)||e===""||e===null}var EmailRegEx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var isValidEmail=function(e){return EmailRegEx.test(e)};var isValidPhone=function(e){return simpleE164Validator(e)};function getRGBA(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function rescale(e,t){return e*t}var verdocsSignCss='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{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0;flex:0;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex-align:center;align-items:center;-webkit-transition:all 0.25s;transition:all 0.25s;-ms-flex-pack:center;justify-content:center;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%;max-width:1028px}verdocs-sign .intro{width:100%;height:60px;display:-ms-flexbox;display:flex;background:#ffffff;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .intro .inner{width:100%;color:#111111;padding:0 14px;font-size:20px;font-weight:500;line-height:28px;max-width:1024px}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;display:-ms-flexbox;display:flex;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}verdocs-sign .document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}';var VerdocsSign=function(){function e(e){registerInstance(this,e);this.endpoint=VerdocsEndpoint.getDefault();this.documentId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,o,r;var a=this;return __generator(this,(function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.documentId," / ").concat(this.documentId));return[4,getSigningSession(this.endpoint,{documentId:this.documentId,roleId:this.roleId,inviteCode:this.inviteCode})];case 1:e=s.sent(),t=e.session,n=e.recipient,i=e.signerToken;console.log("[SIGN] Got signing session ".concat(t.email," / ").concat(t.profile_id));this.recipient=n;this.signerToken=i;this.endpoint.setToken(i);if(this.recipient.agreed){this.nextButtonLabel="Next"}return[4,getDocument(this.endpoint,this.documentId)];case 2:o=s.sent();this.document=o;console.log("[SIGN] Signing document",o);this.pdfUrl="".concat(this.endpoint.getBaseURL(),"/documents/").concat(this.documentId,"/envelope_documents/").concat(o.envelope_document_id,"?file=true");this.recipientIndex=this.document.recipients.findIndex((function(e){return e.role_name==a.roleId}));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((function(e){return e.recipient_role===a.roleId}));console.log("Loaded fields",this.fields);return[3,4];case 3:r=s.sent();console.log("Error with signing session",r);return[3,4];case 4:return[2]}}))}))};e.prototype.handleClickAgree=function(){var e=this;console.log("agree clicked");updateRecipientStatus(this.endpoint,this.documentId,this.roleId,"update",{agreed:true}).then((function(t){console.log("update result",t);e.nextButtonLabel="Next";e.recipient=t})).catch((function(e){console.log("update failure",e)}))};e.prototype.savePDF=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i;return __generator(this,(function(o){switch(o.label){case 0:e="".concat(this.document.name," - ").concat(this.document.updated_at.split("T")[0],".pdf");return[4,getDocumentFile(this.endpoint,this.documentId,this.document.envelope_document_id)];case 1:t=o.sent();n=new XMLHttpRequest;n.responseType="blob";n.onload=function(){var t=document.createElement("a");t.href=window.URL.createObjectURL(n.response);t.download=e;t.style.display="none";document.body.appendChild(t);t.click();t.remove()};i="data:application/pdf;base64,".concat(t);console.log("url",i.length,i);n.open("GET","data:application/pdf;base64,".concat(t));n.send();return[2]}}))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((function(){}));break}return[2]}))}))};e.prototype.handleFieldChange=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var i;return __generator(this,(function(o){console.log("fieldChange",e,t.detail);switch(e.type){case"textbox":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){var t,n,i;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.error)==="jwt expired"){console.log("jwt expired")}console.log("Error updating",e)}));break;case"checkbox_group":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:[{id:n,checked:t.detail}]}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"radio_button_group":i=e.settings.options.map((function(e){return{id:e.id,selected:n===e.id}}));updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:{options:i}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"dropdown":updateDocumentField(this.endpoint,this.documentId,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"initial":console.log("Got initial",t.detail);break;case"signature":console.log("Got signature",t.detail);break}return[2]}))}))};e.prototype.renderCheckboxGroupOption=function(e,t,n,i){var o=this;var r=rescale(e.xScale,n.x);var a=rescale(e.yScale,n.y);var s={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-checkbox",{style:s,order:i,value:n.checked,onFieldChange:function(e){return o.handleFieldChange(t,e,n.id)}})};e.prototype.renderRadioGroupOption=function(e,t,n,i){var o=this;var r=rescale(e.xScale,n.x);var a=rescale(e.yScale,n.y);var s={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xScale,", ").concat(e.yScale,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-radio-button",{style:s,order:i,value:n.id,name:t.name,checked:n.selected,onFieldChange:function(e){return o.handleFieldChange(t,e,n.id)}})};e.prototype.isFieldValid=function(e){var t,n,i,o,r,a,s,l,c,d,u,p;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return isValidEmail(((n=e.settings)===null||n===void 0?void 0:n.result)||"");case"phone":return isValidPhone(((i=e.settings)===null||i===void 0?void 0:i.result)||"");default:return!!((o=e.settings)===null||o===void 0?void 0:o.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((r=e.settings)===null||r===void 0?void 0:r.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":var h=(((l=(s=e.settings)===null||s===void 0?void 0:s.options)===null||l===void 0?void 0:l.filter((function(e){return e.checked})))||[]).length;return h>=(((c=e.settings)===null||c===void 0?void 0:c.minimum_checked)||0)&&h<=(((d=e.settings)===null||d===void 0?void 0:d.maximum_checked)||999);case"radio_button_group":return(((p=(u=e.settings)===null||u===void 0?void 0:u.options)===null||p===void 0?void 0:p.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.getFieldId=function(e){return"verdocs-doc-fld-".concat(e.name)};e.prototype.handleNext=function(){var e=this;var t=this.fields.filter((function(e){return e.required}));console.log("required Fields",t);var n=t.findIndex((function(t){return t.name===e.focusedField}));console.log("focused Index",n);var i=n+1;if(i>=t.length){i=0}var o=t[i];console.log("next required field",o);if(o){var r=this.getFieldId(o);var a=document.getElementById(r);console.log("focusing",r,a);a===null||a===void 0?void 0:a.focusField();this.focusedField=o.name}};e.prototype.setControlStyles=function(e,t,n){var i=t.settings,o=i.x,r=o===void 0?0:o,a=i.y,s=a===void 0?0:a,l=i.width,c=l===void 0?150:l,d=i.height,u=d===void 0?50:d;e.style.width="".concat(c,"px");e.style.height="".concat(u,"px");e.style.position="absolute";e.style.left="".concat(rescale(n.xScale,r),"px");e.style.bottom="".concat(rescale(n.yScale,s),"px");e.style.transform="scale(".concat(n.xScale,", ").concat(n.yScale,")");e.style.backgroundColor=t["rgba"]||getRGBA(this.recipientIndex)};e.prototype.renderField=function(e,t){var n=this;var i=document.getElementById(t.containerId+"-controls");if(!i){return}var o=this.getFieldId(e);var r=document.getElementById(o);if(r){this.setControlStyles(r,e,t);return}var a;switch(e.type){case"attachment":case"checkbox":case"date":case"dropdown":case"initial":case"payment":case"signature":case"textarea":case"textbox":a=document.createElement("verdocs-field-".concat(e.type));break;case"checkbox_group":break;case"radio_button_group":break;default:console.log("[SIGN] Skipping unsupported field type",e)}if(a){a.field=e;a.recipient=this.recipient;a.setAttribute("id",o);a.addEventListener("fieldChange",(function(t){return n.handleFieldChange(e,t)}));this.setControlStyles(a,e,t);i.appendChild(a)}};e.prototype.handlePageRendered=function(e){var t=this;var n=e.detail;console.log("[SIGN] Page rendered",n);var i=this.fields.filter((function(e){return e.page===n.renderedPage.pageNumber}));console.log("[SIGN] Fields on page",i);i.forEach((function(e){return t.renderField(e,n.renderedPage)}))};e.prototype.render=function(){var e=this;var t,n,i,o;var r=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return h(Host,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(t=this.recipient)===null||t===void 0?void 0:t.agreed}},h("div",{class:"intro"},h("div",{class:"inner"},"Please review and act on these documents.")),h("div",{class:"header"},h("div",{class:"inner"},h("div",{class:"toolbar"},h("div",{class:"tools"},h("verdocs-dropdown",{options:r,onOptionSelected:function(t){return e.handleOptionSelected(t)}}),!((n=this.recipient)===null||n===void 0?void 0:n.agreed)?h("div",{class:"agree"},h("div",{class:"agree-checkbox"},h("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:function(){return e.handleClickAgree()}}),h("label",{htmlFor:"agree-checkbox-element"})),h("span",null,"I agree to use electronic records and signatures.")):h("div",{style:{flex:"1"}}),h("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((i=this.recipient)===null||i===void 0?void 0:i.agreed),onClick:function(){return e.handleNext()}}))))),!((o=this.recipient)===null||o===void 0?void 0:o.agreed)?h("div",{class:"cover"}):h("div",{style:{display:"none"}}),h("div",{class:"document"},this.pdfUrl?h("div",{class:"inner"},h("verdocs-view",{source:this.pdfUrl,endpoint:this.endpoint,onPageRendered:function(t){return e.handlePageRendered(t)},pageLayers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})):h("verdocs-loader",null)))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|
|
2
2
|
//# sourceMappingURL=verdocs-sign.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["node_modules/@verdocs/js-sdk/Utils/Locales.js","node_modules/@verdocs/js-sdk/Templates/Validators.js","node_modules/@verdocs/js-sdk/Utils/Colors.js","node_modules/@verdocs/js-sdk/Utils/Fields.js","src/components/embeds/verdocs-sign/verdocs-sign.scss?tag=verdocs-sign","src/components/embeds/verdocs-sign/verdocs-sign.tsx"],"names":["e164Regex","RegExp","simpleE164Validator","code","length","test","EmailRegEx","isValidEmail","value","isValidPhone","getRGBA","roleIndex","rescale","r","n","verdocsSignCss","VerdocsSign","class_1","hostRef","this","endpoint","VerdocsEndpoint","getDefault","documentId","roleId","inviteCode","recipient","signerToken","pdfUrl","recipientIndex","document","fields","hasSignature","nextButtonLabel","focusedField","prototype","componentDidLoad","console","log","concat","Documents.getSigningSession","_o","_p","sent","session","email","profile_id","setToken","agreed","Documents.getDocument","getBaseURL","envelope_document_id","recipients","findIndex","role_name","_this","filter","field","recipient_role","e_1","handleClickAgree","updateRecipientStatus","then","catch","e","savePDF","fileName","name","updated_at","split","Documents.getDocumentFile","data","xhr","XMLHttpRequest","responseType","onload","a","createElement","href","window","URL","createObjectURL","response","download","style","display","body","appendChild","click","remove","url","open","send","handleOptionSelected","detail","id","alert","handleFieldChange","optionId","type","Documents.updateDocumentField","prepared","_a","status","_c","_b","error","options","checked","settings","map","option","selected","renderCheckboxGroupOption","page","index","left","xScale","x","bottom","yScale","y","position","transform","backgroundColor","h","order","onFieldChange","renderRadioGroupOption","isFieldValid","validator","result","_d","_e","_f","_h","_g","_j","minimum_checked","_k","maximum_checked","_m","_l","getFieldId","handleNext","requiredFields","required","focusedIndex","nextFocusedIndex","nextRequiredField","el","getElementById","focusField","setControlStyles","docPage","_q","_r","width","_s","height","renderField","controlsDiv","containerId","existingField","setAttribute","addEventListener","handlePageRendered","pageInfo","renderedPage","pageNumber","forEach","render","menuOptions","label","disabled","Host","class","storybook","onOptionSelected","onChange","htmlFor","flex","size","onClick","source","onPageRendered","pageLayers"],"mappings":"6qDA00CA,IAAIA,UAAY,IAAIC,OAAO,oBACpB,SAASC,oBAAoBC,GAChC,OAAQA,IAAS,MAAQA,EAAKC,OAAS,IAAMD,EAAKC,OAAS,GAAKJ,UAAUK,KAAKF,IAAUA,IAAS,IAAMA,IAAS,KCxzCrH,IAAIG,WAAa,yJACV,IAAIC,aAAe,SAAUC,GAAS,OAAOF,WAAWD,KAAKG,IAC7D,IAAIC,aAAe,SAAUD,GAAS,OAAON,oBAAoBM,ICQjE,SAASE,QAAQC,GACpB,OAAQA,EAAY,IAChB,KAAK,EACD,OAAOA,IAAc,EAAI,yBAA2B,2BACxD,KAAK,EACD,MAAO,yBACX,KAAK,EACD,MAAO,yBACX,KAAK,EACD,MAAO,2BACX,KAAK,EACD,MAAO,2BACX,KAAK,EACD,MAAO,0BACX,KAAK,EACD,MAAO,2BACX,KAAK,EACD,MAAO,yBACX,KAAK,EACD,MAAO,2BACX,KAAK,EACD,MAAO,yBACX,QACI,MAAO,4BChCZ,SAASC,QAAQC,EAAGC,GACvB,OAAOD,EAAIC,ECtBf,IAAMC,eAAiB,w+ECuBVC,YAAW,WALxB,SAAAC,EAAAC,4BASUC,KAAAC,SAA4BC,gBAAgBC,aAM5CH,KAAAI,WAA4B,KAM5BJ,KAAAK,OAAwB,KAMxBL,KAAAM,WAA4B,KAE3BN,KAAAO,UAA+B,KAE/BP,KAAAQ,YAAc,KACdR,KAAAS,OAAS,KACTT,KAAAU,gBAA0B,EAC1BV,KAAAW,SAA6B,KAC7BX,KAAAY,OAA2B,GAE3BZ,KAAAa,aAAe,MAEfb,KAAAc,gBAAkB,QAElBd,KAAAe,aAAe,GAElBjB,EAAAkB,UAAAC,iBAAN,wKAEIC,QAAQC,IAAI,qCAAAC,OAAqCpB,KAAKI,WAAU,OAAAgB,OAAMpB,KAAKI,aACjC,MAAA,CAAA,EAAMiB,kBAA4BrB,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A,OAAA,KAAA,sDAGFA,EAAA,MAAA,CAAKzC,MAAO,CAACiG,KAAM,OAErBxD,EAAA,iBAAA,CAAgByD,KAAK,QAAQT,MAAO1J,KAAKc,gBAAiB6I,YAAWtE,EAAArF,KAAKO,aAAS,MAAA8E,SAAA,OAAA,EAAAA,EAAExD,QAAQuI,QAAS,WAAM,OAAAhI,EAAKyF,sBAKrHZ,EAAAjH,KAAKO,aAAS,MAAA0G,SAAA,OAAA,EAAAA,EAAEpF,QAAS6E,EAAA,MAAA,CAAKmD,MAAM,UAAanD,EAAA,MAAA,CAAKzC,MAAO,CAACC,QAAS,UAEzEwC,EAAA,MAAA,CAAKmD,MAAM,YACR7J,KAAKS,OACJiG,EAAA,eAAA,CACE2D,OAAQrK,KAAKS,OACbR,SAAUD,KAAKC,SACfqK,eAAgB,SAAAzH,GAAK,OAAAT,EAAK+G,mBAAmBtG,IAC7C0H,WAAY,CACV,CAACvH,KAAM,OAAQgC,KAAM,UACrB,CAAChC,KAAM,WAAYgC,KAAM,UAI7B0B,EAAA,iBAAA,kBA5bY","sourcesContent":["export var Countries = [\n {\n code: '+7 840',\n name: 'Abkhazia',\n value: '+7',\n },\n {\n code: '+93',\n name: 'Afghanistan',\n value: '+93',\n },\n {\n code: '+355',\n name: 'Albania',\n value: '+355',\n },\n {\n code: '+213',\n name: 'Algeria',\n value: '+213',\n },\n {\n code: '+1',\n name: 'American Samoa',\n value: '+1',\n },\n {\n code: '+376',\n name: 'Andorra',\n value: '+376',\n },\n {\n code: '+244',\n name: 'Angola',\n value: '+244',\n },\n {\n code: '+1',\n name: 'Anguilla',\n value: '+1',\n },\n {\n code: '+1',\n name: 'Antigua and Barbuda',\n value: '+1',\n },\n {\n code: '+54',\n name: 'Argentina',\n value: '+54',\n },\n {\n code: '+374',\n name: 'Armenia',\n value: '+374',\n },\n {\n code: '+297',\n name: 'Aruba',\n value: '+297',\n },\n {\n code: '+247',\n name: 'Ascension',\n value: '+247',\n },\n {\n code: '+61',\n name: 'Australia',\n value: '+61',\n },\n {\n code: '+672',\n name: 'Australian External Territories',\n value: '+672',\n },\n {\n code: '+43',\n name: 'Austria',\n value: '+43',\n },\n {\n code: '+994',\n name: 'Azerbaijan',\n value: '+994',\n },\n {\n code: '+1',\n name: 'Bahamas',\n value: '+1',\n },\n {\n code: '+973',\n name: 'Bahrain',\n value: '+973',\n },\n {\n code: '+880',\n name: 'Bangladesh',\n value: '+880',\n },\n {\n code: '+1',\n name: 'Barbados',\n value: '+1',\n },\n {\n code: '+1',\n name: 'Barbuda',\n value: '+1',\n },\n {\n code: '+375',\n name: 'Belarus',\n value: '+375',\n },\n {\n code: '+32',\n name: 'Belgium',\n value: '+32',\n },\n {\n code: '+501',\n name: 'Belize',\n value: '+501',\n },\n {\n code: '+229',\n name: 'Benin',\n value: '+229',\n },\n {\n code: '+1',\n name: 'Bermuda',\n value: '+1',\n },\n {\n code: '+975',\n name: 'Bhutan',\n value: '+975',\n },\n {\n code: '+591',\n name: 'Bolivia',\n value: '+591',\n },\n {\n code: '+387',\n name: 'Bosnia and Herzegovina',\n value: '+387',\n },\n {\n code: '+267',\n name: 'Botswana',\n value: '+267',\n },\n {\n code: '+55',\n name: 'Brazil',\n value: '+55',\n },\n {\n code: '+246',\n name: 'British Indian Ocean Territory',\n value: '+246',\n },\n {\n code: '+1',\n name: 'British Virgin Islands',\n value: '+1',\n },\n {\n code: '+673',\n name: 'Brunei',\n value: '+673',\n },\n {\n code: '+359',\n name: 'Bulgaria',\n value: '+359',\n },\n {\n code: '+226',\n name: 'Burkina Faso',\n value: '+226',\n },\n {\n code: '+257',\n name: 'Burundi',\n value: '+257',\n },\n {\n code: '+855',\n name: 'Cambodia',\n value: '+855',\n },\n {\n code: '+237',\n name: 'Cameroon',\n value: '+237',\n },\n {\n code: '+1',\n name: 'Canada',\n value: '+1',\n },\n {\n code: '+238',\n name: 'Cape Verde',\n value: '+238',\n },\n {\n code: '+1',\n name: 'Cayman Islands',\n value: '+1',\n },\n {\n code: '+236',\n name: 'Central African Republic',\n value: '+236',\n },\n {\n code: '+235',\n name: 'Chad',\n value: '+235',\n },\n {\n code: '+56',\n name: 'Chile',\n value: '+56',\n },\n {\n code: '+86',\n name: 'China',\n value: '+86',\n },\n {\n code: '+61',\n name: 'Christmas Island',\n value: '+61',\n },\n {\n code: '+61',\n name: 'Cocos-Keeling Islands',\n value: '+61',\n },\n {\n code: '+57',\n name: 'Colombia',\n value: '+57',\n },\n {\n code: '+269',\n name: 'Comoros',\n value: '+269',\n },\n {\n code: '+242',\n name: 'Congo',\n value: '+242',\n },\n {\n code: '+243',\n name: 'Congo, Dem. Rep. of (Zaire)',\n value: '+243',\n },\n {\n code: '+682',\n name: 'Cook Islands',\n value: '+682',\n },\n {\n code: '+506',\n name: 'Costa Rica',\n value: '+506',\n },\n {\n code: '+385',\n name: 'Croatia',\n value: '+385',\n },\n {\n code: '+53',\n name: 'Cuba',\n value: '+53',\n },\n {\n code: '+599',\n name: 'Curacao',\n value: '+599',\n },\n {\n code: '+537',\n name: 'Cyprus',\n value: '+537',\n },\n {\n code: '+420',\n name: 'Czech Republic',\n value: '+420',\n },\n {\n code: '+45',\n name: 'Denmark',\n value: '+45',\n },\n {\n code: '+246',\n name: 'Diego Garcia',\n value: '+246',\n },\n {\n code: '+253',\n name: 'Djibouti',\n value: '+253',\n },\n {\n code: '+1',\n name: 'Dominica',\n value: '+1',\n },\n {\n code: '+1',\n name: 'Dominican Republic',\n value: '+1',\n },\n {\n code: '+670',\n name: 'East Timor',\n value: '+670',\n },\n {\n code: '+56',\n name: 'Easter Island',\n value: '+56',\n },\n {\n code: '+593',\n name: 'Ecuador',\n value: '+593',\n },\n {\n code: '+20',\n name: 'Egypt',\n value: '+20',\n },\n {\n code: '+503',\n name: 'El Salvador',\n value: '+503',\n },\n {\n code: '+240',\n name: 'Equatorial Guinea',\n value: '+240',\n },\n {\n code: '+291',\n name: 'Eritrea',\n value: '+291',\n },\n {\n code: '+372',\n name: 'Estonia',\n value: '+372',\n },\n {\n code: '+251',\n name: 'Ethiopia',\n value: '+251',\n },\n {\n code: '+500',\n name: 'Falkland Islands',\n value: '+500',\n },\n {\n code: '+298',\n name: 'Faroe Islands',\n value: '+298',\n },\n {\n code: '+679',\n name: 'Fiji',\n value: '+679',\n },\n {\n code: '+358',\n name: 'Finland',\n value: '+358',\n },\n {\n code: '+33',\n name: 'France',\n value: '+33',\n },\n {\n code: '+596',\n name: 'Martinique',\n value: '+596',\n },\n {\n code: '+594',\n name: 'French Guiana',\n value: '+594',\n },\n {\n code: '+689',\n name: 'French Polynesia',\n value: '+689',\n },\n {\n code: '+241',\n name: 'Gabon',\n value: '+241',\n },\n {\n code: '+220',\n name: 'Gambia',\n value: '+220',\n },\n {\n code: '+995',\n name: 'Georgia',\n value: '+995',\n },\n {\n code: '+49',\n name: 'Germany',\n value: '+49',\n },\n {\n code: '+233',\n name: 'Ghana',\n value: '+233',\n },\n {\n code: '+350',\n name: 'Gibraltar',\n value: '+350',\n },\n {\n code: '+30',\n name: 'Greece',\n value: '+30',\n },\n {\n code: '+299',\n name: 'Greenland',\n value: '+299',\n },\n {\n code: '+1',\n name: 'Grenada',\n value: '+1',\n },\n {\n code: '+590',\n name: 'Guadeloupe',\n value: '+590',\n },\n {\n code: '+1',\n name: 'Guam',\n value: '+1',\n },\n {\n code: '+502',\n name: 'Guatemala',\n value: '+502',\n },\n {\n code: '+224',\n name: 'Guinea',\n value: '+224',\n },\n {\n code: '+245',\n name: 'Guinea-Bissau',\n value: '+245',\n },\n {\n code: '+595',\n name: 'Guyana',\n value: '+595',\n },\n {\n code: '+509',\n name: 'Haiti',\n value: '+509',\n },\n {\n code: '+504',\n name: 'Honduras',\n value: '+504',\n },\n {\n code: '+852',\n name: 'Hong Kong SAR China',\n value: '+852',\n },\n {\n code: '+36',\n name: 'Hungary',\n value: '+36',\n },\n {\n code: '+354',\n name: 'Iceland',\n value: '+354',\n },\n {\n code: '+91',\n name: 'India',\n value: '+91',\n },\n {\n code: '+62',\n name: 'Indonesia',\n value: '+62',\n },\n {\n code: '+98',\n name: 'Iran',\n value: '+98',\n },\n {\n code: '+964',\n name: 'Iraq',\n value: '+964',\n },\n {\n code: '+353',\n name: 'Ireland',\n value: '+353',\n },\n {\n code: '+972',\n name: 'Israel',\n value: '+972',\n },\n {\n code: '+39',\n name: 'Italy',\n value: '+39',\n },\n {\n code: '+225',\n name: 'Ivory Coast',\n value: '+225',\n },\n {\n code: '+1',\n name: 'Jamaica',\n value: '+1',\n },\n {\n code: '+81',\n name: 'Japan',\n value: '+81',\n },\n {\n code: '+962',\n name: 'Jordan',\n value: '+962',\n },\n {\n code: '+77',\n name: 'Kazakhstan',\n value: '+7',\n },\n {\n code: '+254',\n name: 'Kenya',\n value: '+254',\n },\n {\n code: '+686',\n name: 'Kiribati',\n value: '+686',\n },\n {\n code: '+965',\n name: 'Kuwait',\n value: '+965',\n },\n {\n code: '+996',\n name: 'Kyrgyzstan',\n value: '+996',\n },\n {\n code: '+856',\n name: 'Laos',\n value: '+856',\n },\n {\n code: '+371',\n name: 'Latvia',\n value: '+371',\n },\n {\n code: '+961',\n name: 'Lebanon',\n value: '+961',\n },\n {\n code: '+266',\n name: 'Lesotho',\n value: '+266',\n },\n {\n code: '+231',\n name: 'Liberia',\n value: '+231',\n },\n {\n code: '+218',\n name: 'Libya',\n value: '+218',\n },\n {\n code: '+423',\n name: 'Liechtenstein',\n value: '+423',\n },\n {\n code: '+370',\n name: 'Lithuania',\n value: '+370',\n },\n {\n code: '+352',\n name: 'Luxembourg',\n value: '+352',\n },\n {\n code: '+853',\n name: 'Macau SAR China',\n value: '+853',\n },\n {\n code: '+389',\n name: 'Macedonia',\n value: '+389',\n },\n {\n code: '+261',\n name: 'Madagascar',\n value: '+261',\n },\n {\n code: '+265',\n name: 'Malawi',\n value: '+265',\n },\n {\n code: '+60',\n name: 'Malaysia',\n value: '+60',\n },\n {\n code: '+960',\n name: 'Maldives',\n value: '+960',\n },\n {\n code: '+223',\n name: 'Mali',\n value: '+223',\n },\n {\n code: '+356',\n name: 'Malta',\n value: '+356',\n },\n {\n code: '+692',\n name: 'Marshall Islands',\n value: '+692',\n },\n {\n code: '+596',\n name: 'Martinique',\n value: '+596',\n },\n {\n code: '+222',\n name: 'Mauritania',\n value: '+222',\n },\n {\n code: '+230',\n name: 'Mauritius',\n value: '+230',\n },\n {\n code: '+262',\n name: 'Mayotte or Réunion',\n value: '+262',\n },\n {\n code: '+52',\n name: 'Mexico',\n value: '+52',\n },\n {\n code: '+691',\n name: 'Micronesia',\n value: '+691',\n },\n {\n code: '+1',\n name: 'Midway Island',\n value: '+1',\n },\n {\n code: '+373',\n name: 'Moldova',\n value: '+373',\n },\n {\n code: '+377',\n name: 'Monaco',\n value: '+377',\n },\n {\n code: '+976',\n name: 'Mongolia',\n value: '+976',\n },\n {\n code: '+382',\n name: 'Montenegro',\n value: '+382',\n },\n {\n code: '+1',\n name: 'Montserrat',\n value: '+1',\n },\n {\n code: '+212',\n name: 'Morocco',\n value: '+212',\n },\n {\n code: '+95',\n name: 'Myanmar',\n value: '+95',\n },\n {\n code: '+264',\n name: 'Namibia',\n value: '+264',\n },\n {\n code: '+674',\n name: 'Nauru',\n value: '+674',\n },\n {\n code: '+977',\n name: 'Nepal',\n value: '+977',\n },\n {\n code: '+31',\n name: 'Netherlands',\n value: '+31',\n },\n {\n code: '+599',\n name: 'Netherlands Antilles',\n value: '+599',\n },\n {\n code: '+1',\n name: 'Nevis',\n value: '+1',\n },\n {\n code: '+687',\n name: 'New Caledonia',\n value: '+687',\n },\n {\n code: '+64',\n name: 'New Zealand',\n value: '+64',\n },\n {\n code: '+505',\n name: 'Nicaragua',\n value: '+505',\n },\n {\n code: '+227',\n name: 'Niger',\n value: '+227',\n },\n {\n code: '+234',\n name: 'Nigeria',\n value: '+234',\n },\n {\n code: '+683',\n name: 'Niue',\n value: '+683',\n },\n {\n code: '+672',\n name: 'Norfolk Island',\n value: '+672',\n },\n {\n code: '+850',\n name: 'North Korea',\n value: '+850',\n },\n {\n code: '+1',\n name: 'Northern Mariana Islands',\n value: '+1',\n },\n {\n code: '+47',\n name: 'Norway',\n value: '+47',\n },\n {\n code: '+968',\n name: 'Oman',\n value: '+968',\n },\n {\n code: '+92',\n name: 'Pakistan',\n value: '+92',\n },\n {\n code: '+680',\n name: 'Palau',\n value: '+680',\n },\n {\n code: '+970',\n name: 'Palestinian Territory',\n value: '+970',\n },\n {\n code: '+507',\n name: 'Panama',\n value: '+507',\n },\n {\n code: '+675',\n name: 'Papua New Guinea',\n value: '+675',\n },\n {\n code: '+595',\n name: 'Paraguay',\n value: '+595',\n },\n {\n code: '+51',\n name: 'Peru',\n value: '+51',\n },\n {\n code: '+63',\n name: 'Philippines',\n value: '+63',\n },\n {\n code: '+48',\n name: 'Poland',\n value: '+48',\n },\n {\n code: '+351',\n name: 'Portugal',\n value: '+351',\n },\n {\n code: '+1',\n name: 'Puerto Rico',\n value: '+1',\n },\n {\n code: '+974',\n name: 'Qatar',\n value: '+974',\n },\n {\n code: '+40',\n name: 'Romania',\n value: '+40',\n },\n {\n code: '+7',\n name: 'Russia',\n value: '+7',\n },\n {\n code: '+250',\n name: 'Rwanda',\n value: '+250',\n },\n {\n code: '508',\n name: 'Saint Pierre and Miquelon',\n value: '508',\n },\n {\n code: '+685',\n name: 'Samoa',\n value: '+685',\n },\n {\n code: '+378',\n name: 'San Marino',\n value: '+378',\n },\n {\n code: '+966',\n name: 'Saudi Arabia',\n value: '+966',\n },\n {\n code: '+221',\n name: 'Senegal',\n value: '+221',\n },\n {\n code: '+381',\n name: 'Serbia',\n value: '+381',\n },\n {\n code: '+248',\n name: 'Seychelles',\n value: '+248',\n },\n {\n code: '+232',\n name: 'Sierra Leone',\n value: '+232',\n },\n {\n code: '+65',\n name: 'Singapore',\n value: '+65',\n },\n {\n code: '+421',\n name: 'Slovakia',\n value: '+421',\n },\n {\n code: '+386',\n name: 'Slovenia',\n value: '+386',\n },\n {\n code: '+677',\n name: 'Solomon Islands',\n value: '+677',\n },\n {\n code: '+27',\n name: 'South Africa',\n value: '+27',\n },\n {\n code: '+500',\n name: 'South Georgia and the South Sandwich Islands',\n value: '+500',\n },\n {\n code: '+82',\n name: 'South Korea',\n value: '+82',\n },\n {\n code: '+34',\n name: 'Spain',\n value: '+34',\n },\n {\n code: '+94',\n name: 'Sri Lanka',\n value: '+94',\n },\n {\n code: '+249',\n name: 'Sudan',\n value: '+249',\n },\n {\n code: '+597',\n name: 'Suriname',\n value: '+597',\n },\n {\n code: '+268',\n name: 'Swaziland',\n value: '+268',\n },\n {\n code: '+46',\n name: 'Sweden',\n value: '+46',\n },\n {\n code: '+41',\n name: 'Switzerland',\n value: '+41',\n },\n {\n code: '+963',\n name: 'Syria',\n value: '+963',\n },\n {\n code: '+886',\n name: 'Taiwan',\n value: '+886',\n },\n {\n code: '+992',\n name: 'Tajikistan',\n value: '+992',\n },\n {\n code: '+255',\n name: 'Tanzania',\n value: '+255',\n },\n {\n code: '+66',\n name: 'Thailand',\n value: '+66',\n },\n {\n code: '+670',\n name: 'Timor Leste',\n value: '+670',\n },\n {\n code: '+228',\n name: 'Togo',\n value: '+228',\n },\n {\n code: '+690',\n name: 'Tokelau',\n value: '+690',\n },\n {\n code: '+676',\n name: 'Tonga',\n value: '+676',\n },\n {\n code: '+1',\n name: 'Trinidad and Tobago',\n value: '+1',\n },\n {\n code: '+216',\n name: 'Tunisia',\n value: '+216',\n },\n {\n code: '+90',\n name: 'Turkey',\n value: '+90',\n },\n {\n code: '+993',\n name: 'Turkmenistan',\n value: '+993',\n },\n {\n code: '+1',\n name: 'Turks and Caicos Islands',\n value: '+1',\n },\n {\n code: '+688',\n name: 'Tuvalu',\n value: '+688',\n },\n {\n code: '+1',\n name: 'U.S. Virgin Islands',\n value: '+1',\n },\n {\n code: '+256',\n name: 'Uganda',\n value: '+256',\n },\n {\n code: '+380',\n name: 'Ukraine',\n value: '+380',\n },\n {\n code: '+971',\n name: 'United Arab Emirates',\n value: '+971',\n },\n {\n code: '+44',\n name: 'United Kingdom',\n value: '+44',\n },\n {\n code: '+1',\n name: 'United States',\n value: '+1',\n },\n {\n code: '+598',\n name: 'Uruguay',\n value: '+598',\n },\n {\n code: '+998',\n name: 'Uzbekistan',\n value: '+998',\n },\n {\n code: '+678',\n name: 'Vanuatu',\n value: '+678',\n },\n {\n code: '+58',\n name: 'Venezuela',\n value: '+58',\n },\n {\n code: '+84',\n name: 'Vietnam',\n value: '+84',\n },\n {\n code: '+1',\n name: 'Wake Island',\n value: '+1',\n },\n {\n code: '+681',\n name: 'Wallis and Futuna',\n value: '+681',\n },\n {\n code: '+967',\n name: 'Yemen',\n value: '+967',\n },\n {\n code: '+260',\n name: 'Zambia',\n value: '+260',\n },\n {\n code: '+255',\n name: 'Zanzibar',\n value: '+255',\n },\n {\n code: '+263',\n name: 'Zimbabwe',\n value: '+263',\n },\n];\nexport function getCountryByCode(code) {\n var found = Countries.find(function (country) { return country.code === code; });\n if (found)\n return found;\n if (isFrenchGuiana(code)) {\n return {\n code: '+594',\n name: 'French Guiana',\n value: '+594',\n };\n }\n else if (isGuadeloupe(code)) {\n return {\n code: '+590',\n name: 'Guadeloupe',\n value: '+590',\n };\n }\n else if (isMartinique(code)) {\n return {\n code: '+596',\n name: 'Martinique',\n value: '+596',\n };\n }\n else if (isMayotte(code)) {\n return {\n code: '+262',\n name: 'Mayotte or Réunion',\n value: '+262',\n };\n }\n return null;\n}\nexport function isFrenchGuiana(code) {\n return '+594' === code.substring(0, 4);\n}\nexport function isGuadeloupe(code) {\n return '+590' === code.substring(0, 4);\n}\nexport function isMartinique(code) {\n return '+596' === code.substring(0, 4);\n}\nexport function isMayotte(code) {\n return '+262' === code.substring(0, 4);\n}\nexport function getPlusOneCountry(code) {\n var info = null;\n switch (code.substring(0, 5)) {\n case '+1684':\n info = {\n code: '+1',\n name: 'American Samoa',\n value: '+1',\n };\n break;\n case '+1264':\n info = {\n code: '+1',\n name: 'Anguilla',\n value: '+1',\n };\n case '+1268':\n info = {\n code: '+1',\n name: 'Antigua and Barbuda',\n value: '+1',\n };\n case '+1242':\n info = {\n code: '+1',\n name: 'Bahamas',\n value: '+1',\n };\n break;\n case '+1246':\n info = {\n code: '+1',\n name: 'Barbados',\n value: '+1',\n };\n break;\n case '+1441':\n info = {\n code: '+1',\n name: 'Bermuda',\n value: '+1',\n };\n break;\n case '+1284':\n info = {\n code: '+1',\n name: 'British Virgin Islands',\n value: '+1',\n };\n break;\n case '+1':\n info = {\n code: '+1',\n name: '',\n value: '+1',\n };\n break;\n default:\n break;\n }\n return info;\n}\nexport function isCanada(code) {\n var canadianAreaCodes = [\n '403',\n '587',\n '780',\n '825',\n '604',\n '250',\n '778',\n '236',\n '204',\n '431',\n '506',\n '709',\n '867',\n '782',\n '902',\n '867',\n '548',\n '705',\n '365',\n '613',\n '807',\n '226',\n '289',\n '437',\n '519',\n '647',\n '905',\n '249',\n '343',\n '416',\n '902',\n '782',\n '450',\n '418',\n '579',\n '873',\n '367',\n '514',\n '581',\n '819',\n '438',\n '639',\n '306',\n '867',\n ];\n var areaCode = code.substring(0, 5);\n return canadianAreaCodes.findIndex(function (x) { return '+1' + x === areaCode; }) > -1;\n}\nexport function isAmericanSamoa(code) {\n return code.substring(0, 5) === '+1684';\n}\nexport function isDominicanRepublic(code) {\n return '+1809' === code.substring(0, 5) || '+1829' === code.substring(0, 5) || '+1849' === code.substring(0, 5);\n}\nexport function isPuertoRico(code) {\n return code.substring(0, 5) === '+' || code.substring(0, 5) === '+';\n}\n// need to finish\nexport function getMatchingCountry(code, substrings) {\n var toMatch = code.substring(0, substrings);\n return Countries.filter(function (c) { return c.code === toMatch; }).length;\n}\nvar e164Regex = new RegExp(/\\+[1-9]\\d{6,14}/g);\nexport function simpleE164Validator(code) {\n return (code !== null && code.length < 16 && code.length > 6 && e164Regex.test(code)) || code === '' || code === null;\n}\n","import { simpleE164Validator } from '../Utils/Locales';\n/**\n * Get all defined validators\n *\n * ```typescript\n * import {Documents} from '@verdocs/js-sdk/Templates';\n *\n * await Documents.getDocuments(templateID);\n * ```\n */\nexport var getValidators = function (endpoint) {\n return endpoint.api //\n .get('/validators')\n .then(function (r) { return r.data; });\n};\nexport var getValidator = function (endpoint, validatorName) {\n return endpoint.api //\n .get(\"/validators/\".concat(validatorName))\n .then(function (r) { return r.data; });\n};\nvar EmailRegEx = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\nexport var isValidEmail = function (value) { return EmailRegEx.test(value); };\nexport var isValidPhone = function (value) { return simpleE164Validator(value); };\nexport var isValidRoleName = function (value, roles) { return roles.findIndex(function (role) { return role.name === value; }) !== -1; };\nvar TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;\nexport var isValidTag = function (value, tags) { return TagRegEx.test(value) || tags.findIndex(function (tag) { return tag.name === value; }) !== -1; };\n","/**\n * Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.\n */\nexport function getRGB(rgba) {\n var rgbNumbers = rgba.replace('rgba(', '').replace(')', '').split(',');\n var rgbObject = {\n red: +rgbNumbers[0],\n green: +rgbNumbers[1],\n blue: +rgbNumbers[2],\n alpha: +rgbNumbers[3],\n };\n var alpha = 1 - rgbObject.alpha;\n var red = Math.round((rgbObject.alpha * (rgbObject.red / 255) + alpha) * 255);\n var green = Math.round((rgbObject.alpha * (rgbObject.green / 255) + alpha) * 255);\n var blue = Math.round((rgbObject.alpha * (rgbObject.blue / 255) + alpha) * 255);\n return '#' + rgbToHex(red) + rgbToHex(green) + rgbToHex(blue);\n}\n/**\n * Given an RGB string value, returns the hex equivalent.\n */\nfunction rgbToHex(rgb) {\n var hex = rgb.toString(16);\n if (hex.length < 2) {\n return '0' + hex;\n }\n return hex;\n}\n/**\n * Given a signer role index, return the color code for that signer.\n */\nexport function getRGBA(roleIndex) {\n switch (roleIndex % 10) {\n case 0:\n return roleIndex === 0 ? 'rgba(255, 193, 7, 0.4)' : 'rgba(134, 134, 134, 0.3)'; // #FFE69C\n case 1:\n return 'rgba(156, 39, 176, .4)'; // '#E3C3E9'\n case 2:\n return 'rgba(33, 150, 243, .4)'; // '#C1E1FB'\n case 3:\n return 'rgba(220, 231, 117, 0.3)';\n case 4:\n return 'rgba(121, 134, 203, 0.3)';\n case 5:\n return 'rgba(77, 182, 172, 0.3)';\n case 6:\n return 'rgba(255, 202, 165, 0.3)';\n case 7:\n return 'rgba(2, 247, 190, 0.3)';\n case 8:\n return 'rgba(255, 138, 101, 0.3)';\n case 9:\n return 'rgba(82, 255, 79, 0.3)';\n default:\n return 'rgba(229, 115, 155, 0.3)';\n }\n}\n/**\n * Given a role name, return a color code for it. This works by computing a hash code so the specific color returned\n * is not specified explicitly, but will be the same for every call with the same input value.\n */\nexport function nameToRGBA(str) {\n if (!!str) {\n var validNum = parseInt(str.slice(-1), 10);\n if (!isNaN(validNum)) {\n str += (validNum * 99).toString();\n }\n var hash = 0;\n for (var i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n hash = Math.round(hash / 1.3);\n var c = (hash & 0x00ffff08).toString(16).toUpperCase();\n var hex = '#' + '00000'.substring(0, 6 - c.length) + c;\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n var color = {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n };\n return \"rgba(\".concat(color.r, \", \").concat(color.g, \", \").concat(color.b, \", 0.2)\");\n }\n}\n/**\n * Helper function to obtain a color code given a role name given various possible inputs.\n */\nexport function getRoleColor(name, roles, index) {\n if (index) {\n return getRGBA(index);\n }\n else if (roles && roles.length > 0) {\n var roleIndex = roles.findIndex(function (role) { return role.name === name; });\n if (roleIndex > -1) {\n return roles[roleIndex].rgba || getRGBA(roleIndex);\n }\n else {\n return nameToRGBA(name);\n }\n }\n else {\n return nameToRGBA(name);\n }\n}\n","export function getRTop(y, fieldHeight, iTextHeight, yRatio) {\n return iTextHeight - (y + fieldHeight) * yRatio;\n}\nexport function getRLeft(x, ratio) {\n return x * ratio;\n}\nexport function getRValue(y, ratio) {\n return y * ratio;\n}\nexport function blobToBase64(image) {\n var fileReader = new FileReader();\n return new Promise(function (resolve, reject) {\n fileReader.onerror = function () {\n reject(new DOMException('Problem reading blob.'));\n };\n fileReader.onload = function () {\n resolve(fileReader.result);\n };\n fileReader.readAsDataURL(image);\n });\n}\nexport function rescale(r, n) {\n return r * n;\n}\n","@import '../../../theme.scss';\n\nverdocs-sign {\n display: flex;\n overflow: hidden;\n position: relative;\n min-height: 600px;\n flex-direction: column;\n box-sizing: border-box;\n font-family: $verdocs-primary-font;\n\n div {\n box-sizing: border-box;\n }\n\n .header {\n flex: 0 0 115px;\n z-index: 1000;\n background-color: $medium-bg;\n box-shadow: 0 4px 4px 0 rgb(0 0 0 / 24%), 0 0 4px 0 rgb(0 0 0 / 12%);\n transition: all 0.25s;\n }\n\n .intro {\n background-color: #ffffff;\n width: 100%;\n margin: 0 auto;\n padding: 20px;\n max-width: 1028px;\n color: rgba(0, 0, 0, 0.87);\n }\n\n .toolbar {\n width: 100%;\n margin: 0 auto;\n padding: 0 14px;\n max-width: 1028px;\n position: relative;\n }\n\n .tools {\n width: 100%;\n color: #fff;\n height: 56px;\n padding: 4px;\n display: flex;\n font-size: 12px;\n align-items: center;\n flex-direction: row;\n background-color: $medium-bg;\n }\n\n .cover {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 999;\n position: absolute;\n background: rgba(0, 0, 0, 0.5);\n }\n\n .document {\n flex: 1;\n height: 100%;\n position: relative;\n overflow-y: scroll;\n }\n\n .agree {\n flex: 1;\n flex-direction: row;\n display: flex;\n align-items: center;\n margin-right: 10px;\n\n .intro {\n display: none;\n }\n\n .header {\n flex: 0 0 56px;\n }\n\n .agree-checkbox {\n background: #ccc;\n flex: 0 0 20px;\n display: flex;\n width: 20px;\n height: 20px;\n border-radius: 3px;\n position: relative;\n margin: 0 10px 0 14px;\n\n input[type='checkbox']:checked + label:after {\n filter: alpha(opacity=100);\n opacity: 1;\n }\n\n label {\n left: 2px;\n top: 2px;\n width: 16px;\n height: 16px;\n cursor: pointer;\n position: absolute;\n background: #33354c;\n box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.8);\n\n .agree-checkbox label:hover::after {\n filter: alpha(opacity=30);\n opacity: 0.3;\n }\n\n &:after {\n top: 2px;\n left: 3px;\n width: 8px;\n opacity: 0;\n height: 5px;\n content: '';\n position: absolute;\n background: transparent;\n filter: alpha(opacity=0);\n transform: rotate(-45deg);\n border: 2px solid #fcfff4;\n border-top: none;\n border-right: none;\n }\n }\n }\n }\n}\n","import {Host} from '@stencil/core';\nimport {VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {Documents} from '@verdocs/js-sdk/Documents';\nimport {getRGBA} from '@verdocs/js-sdk/Utils/Colors';\nimport {rescale} from '@verdocs/js-sdk/Utils/Fields';\nimport {Component, Prop, State, h} from '@stencil/core';\nimport {updateRecipientStatus} from '@verdocs/js-sdk/Documents/Recipients';\nimport {isValidEmail, isValidPhone} from '@verdocs/js-sdk/Templates/Validators';\nimport {IDocument, IDocumentField, IRecipient} from '@verdocs/js-sdk/Documents/Documents';\nimport {IDocumentPageInfo} from '../../elements/verdocs-document-page/verdocs-document-page';\nimport {IPageRenderEvent} from '../verdocs-view/verdocs-view';\n\n/**\n * Display a document signing experience.\n *\n * *NOTE: This sample document will reset every 10 minutes.*\n * ***NOTE: This sample document will reset every 10 minutes...***\n */\n@Component({\n tag: 'verdocs-sign',\n styleUrl: 'verdocs-sign.scss',\n shadow: false,\n})\nexport class VerdocsSign {\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 * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a\n * signing session.\n */\n @Prop() documentId: string | null = null;\n\n /**\n * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a\n * signing session.\n */\n @Prop() roleId: string | null = null;\n\n /**\n * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a\n * signing session.\n */\n @Prop() inviteCode: string | null = null;\n\n @State() recipient: IRecipient | null = null;\n\n @State() signerToken = null;\n @State() pdfUrl = null;\n @State() recipientIndex: number = -1;\n @State() document: IDocument | null = null;\n @State() fields: IDocumentField[] = [];\n\n @State() hasSignature = false;\n\n @State() nextButtonLabel = 'Start';\n\n @State() focusedField = '';\n\n async componentDidLoad() {\n try {\n console.log(`[SIGN] Processing invite code for ${this.documentId} / ${this.documentId}`);\n const {session, recipient, signerToken} = await Documents.getSigningSession(this.endpoint, {\n documentId: this.documentId,\n roleId: this.roleId,\n inviteCode: this.inviteCode,\n });\n\n console.log(`[SIGN] Got signing session ${session.email} / ${session.profile_id}`);\n\n this.recipient = recipient;\n this.signerToken = signerToken;\n this.endpoint.setToken(signerToken);\n\n if (this.recipient.agreed) {\n this.nextButtonLabel = 'Next';\n }\n\n const document = await Documents.getDocument(this.endpoint, this.documentId);\n this.document = document;\n console.log('[SIGN] Signing document', document);\n\n this.pdfUrl = `${this.endpoint.getBaseURL()}/documents/${this.documentId}/envelope_documents/${document.envelope_document_id}?file=true`;\n\n this.recipientIndex = this.document.recipients.findIndex(recipient => recipient.role_name == this.roleId);\n if (this.recipientIndex > -1) {\n console.log('Found recipient', this.document.recipients[this.recipientIndex]);\n }\n\n this.fields = this.document.fields.filter(field => field.recipient_role === this.roleId);\n console.log('Loaded fields', this.fields);\n\n // TODO: Fix service to allow this?\n // const sigs = await getSignatures();\n // console.log('sigs', sigs);\n } catch (e) {\n console.log('Error with signing session', e);\n }\n }\n\n handleClickAgree() {\n console.log('agree clicked');\n updateRecipientStatus(this.endpoint, this.documentId, this.roleId, 'update', {agreed: true})\n .then(r => {\n console.log('update result', r);\n this.nextButtonLabel = 'Next';\n this.recipient = r;\n })\n .catch(e => {\n console.log('update failure', e);\n });\n }\n\n async savePDF() {\n const fileName = `${this.document.name} - ${this.document.updated_at.split('T')[0]}.pdf`;\n const data = await Documents.getDocumentFile(this.endpoint, this.documentId, this.document.envelope_document_id);\n\n // This is better in React than doing window.href= or similar to trigger a download. For a description of the technique\n // see https://stackoverflow.com/questions/8126623/downloading-canvas-element-to-an-image\n let xhr = new XMLHttpRequest();\n xhr.responseType = 'blob';\n xhr.onload = function () {\n let a = document.createElement('a');\n a.href = window.URL.createObjectURL(xhr.response);\n a.download = fileName;\n a.style.display = 'none';\n document.body.appendChild(a);\n a.click();\n a.remove();\n };\n\n const url = `data:application/pdf;base64,${data}`;\n console.log('url', url.length, url);\n xhr.open('GET', `data:application/pdf;base64,${data}`);\n xhr.send();\n }\n\n async handleOptionSelected(e) {\n switch (e.detail.id) {\n case 'later':\n // this.router.navigate([`view/sign/${this.envelopeId}/role/${this.roleName}/saved`]);\n if (!window?.['STORYBOOK_ENV']) {\n window.alert('User intends to sign later.');\n }\n break;\n case 'claim':\n break;\n case 'decline':\n break;\n case 'print':\n break;\n case 'download':\n this.savePDF().catch(() => {});\n break;\n }\n }\n\n async handleFieldChange(field: IDocumentField, e: any, optionId?: string) {\n console.log('fieldChange', field, e.detail);\n switch (field.type) {\n case 'textbox':\n Documents.updateDocumentField(this.endpoint, this.documentId, field.name, {prepared: false, value: e.detail})\n .then(r => console.log('Update result', r))\n .catch(e => {\n if (e.response?.status === 401 && e.response?.data?.error === 'jwt expired') {\n console.log('jwt expired');\n }\n console.log('Error updating', e);\n });\n break;\n\n case 'checkbox_group':\n Documents.updateDocumentField(this.endpoint, this.documentId, field.name, {prepared: false, value: {options: [{id: optionId, checked: e.detail}]}})\n .then(r => console.log('Update result', r))\n .catch(e => console.log('Error updating', e));\n break;\n\n case 'radio_button_group':\n const options = field.settings.options.map(option => ({id: option.id, selected: optionId === option.id}));\n Documents.updateDocumentField(this.endpoint, this.documentId, field.name, {prepared: false, value: {options}})\n .then(r => console.log('Update result', r))\n .catch(e => console.log('Error updating', e));\n break;\n\n case 'dropdown':\n Documents.updateDocumentField(this.endpoint, this.documentId, field.name, {prepared: false, value: e.detail})\n .then(r => console.log('Update result', r))\n .catch(e => console.log('Error updating', e));\n break;\n\n case 'initial':\n console.log('Got initial', e.detail);\n break;\n\n case 'signature':\n console.log('Got signature', e.detail);\n break;\n }\n }\n\n renderCheckboxGroupOption(page: IDocumentPageInfo, field: IDocumentField, option: any, index: number) {\n const left = rescale(page.xScale, option.x);\n const bottom = rescale(page.yScale, option.y);\n\n const style = {\n left: `${left}px`,\n bottom: `${bottom}px`,\n position: 'absolute',\n transform: `scale(${page.xScale}, ${page.yScale})`,\n backgroundColor: getRGBA(this.recipientIndex),\n } as any;\n\n return <verdocs-field-checkbox style={style} order={index} value={option.checked} onFieldChange={e => this.handleFieldChange(field, e, option.id)} />;\n }\n\n renderRadioGroupOption(page: IDocumentPageInfo, field: IDocumentField, option: any, index: number) {\n const left = rescale(page.xScale, option.x);\n const bottom = rescale(page.yScale, option.y);\n\n const style = {\n left: `${left}px`,\n bottom: `${bottom}px`,\n position: 'absolute',\n transform: `scale(${page.xScale}, ${page.yScale})`,\n backgroundColor: getRGBA(this.recipientIndex),\n } as any;\n\n return (\n <verdocs-field-radio-button\n style={style}\n order={index}\n value={option.id}\n name={field.name}\n checked={option.selected}\n onFieldChange={e => this.handleFieldChange(field, e, option.id)}\n />\n );\n }\n\n isFieldValid(field: IDocumentField) {\n switch (field.type) {\n case 'textbox':\n switch (field.settings?.validator || '') {\n case 'email':\n return isValidEmail(field.settings?.result || '');\n case 'phone':\n return isValidPhone(field.settings?.result || '');\n default:\n return !!field.settings?.result;\n }\n\n case 'signature':\n case 'initial':\n case 'textarea':\n case 'date':\n case 'attachment':\n return !!field.settings?.result;\n case 'dropdown':\n return !!field.settings?.value;\n case 'checkbox_group':\n const checked = (field.settings?.options?.filter(option => option.checked) || []).length;\n return checked >= (field.settings?.minimum_checked || 0) && checked <= (field.settings?.maximum_checked || 999);\n case 'radio_button_group':\n return (field.settings?.options?.filter(option => option.selected) || []).length > 0;\n // TODO\n // case 'checkbox':\n // return <verdocs-field-checkbox style={style} value={result || ''} id={id} />;\n // case 'payment':\n // return <verdocs-field-payment style={style} field={field} id={id} />;\n default:\n return false;\n }\n }\n\n // (async () => {\n // await customElements.whenDefined('verdocs-field-signature');\n // const els = document.getElementById('verdocs-field-signature');\n // await els.focusField();\n // })();\n\n getFieldId(field: IDocumentField) {\n return `verdocs-doc-fld-${field.name}`;\n }\n\n handleNext() {\n // Find and focus the next incomplete required field\n const requiredFields = this.fields.filter(field => field.required);\n console.log('required Fields', requiredFields);\n\n const focusedIndex = requiredFields.findIndex(field => field.name === this.focusedField);\n console.log('focused Index', focusedIndex);\n\n let nextFocusedIndex = focusedIndex + 1;\n if (nextFocusedIndex >= requiredFields.length) {\n nextFocusedIndex = 0;\n }\n\n const nextRequiredField = requiredFields[nextFocusedIndex];\n console.log('next required field', nextRequiredField);\n\n if (nextRequiredField) {\n const id = this.getFieldId(nextRequiredField);\n const el = document.getElementById(id) as any;\n console.log('focusing', id, el);\n el?.focusField();\n this.focusedField = nextRequiredField.name;\n }\n }\n\n setControlStyles(el: HTMLElement, field: IDocumentField, docPage: IDocumentPageInfo) {\n const {x = 0, y = 0, width = 150, height = 50} = field.settings;\n\n el.style.width = `${width}px`;\n el.style.height = `${height}px`;\n el.style.position = 'absolute';\n el.style.left = `${rescale(docPage.xScale, x)}px`;\n el.style.bottom = `${rescale(docPage.yScale, y)}px`;\n el.style.transform = `scale(${docPage.xScale}, ${docPage.yScale})`;\n el.style.backgroundColor = field['rgba'] || getRGBA(this.recipientIndex);\n }\n\n renderField(field: IDocumentField, docPage: IDocumentPageInfo /*, index: number*/) {\n const controlsDiv = document.getElementById(docPage.containerId + '-controls');\n if (!controlsDiv) {\n return;\n }\n\n const id = this.getFieldId(field);\n\n const existingField = document.getElementById(id);\n\n if (existingField) {\n this.setControlStyles(existingField, field, docPage);\n return;\n }\n\n let el;\n switch (field.type) {\n case 'attachment':\n case 'checkbox':\n case 'date':\n case 'dropdown':\n case 'initial':\n case 'payment':\n case 'signature':\n case 'textarea':\n case 'textbox':\n el = document.createElement(`verdocs-field-${field.type}`);\n break;\n // case 'textbox':\n // el = document.createElement('verdocs-field-textbox');\n // el.setAttribute('field', field);\n // // el.setAttribute('value', result || '');\n // // el.setAttribute('placeholder', placeholder || '');\n // el.addEventListener('fieldChange', e => this.handleFieldChange(field, e));\n // break;\n // case 'textarea':\n // el = document.createElement('verdocs-field-textarea');\n // el.setAttribute('value', result || '');\n // el.setAttribute('placeholder', placeholder || '');\n // break;\n // case 'date':\n // el = document.createElement('verdocs-field-date');\n // el.setAttribute('value', result || '');\n // el.setAttribute('placeholder', placeholder || '');\n // break;\n // case 'dropdown':\n // el = document.createElement('verdocs-field-dropdown');\n // el.setAttribute('options', options);\n // el.setAttribute('value', value);\n // break;\n // case 'checkbox':\n // el = document.createElement('verdocs-field-checkbox');\n // el.setAttribute('value', result || '');\n // break;\n case 'checkbox_group':\n // el = document.createElement('verdocs-field-signature');\n // el.setAttribute('value', base64);\n break;\n // return field.settings.options.map((option: any, index) => this.renderCheckboxGroupOption(renderOnPage, field, option, index));\n case 'radio_button_group':\n // el = document.createElement('verdocs-field-signature');\n // el.setAttribute('value', base64);\n break;\n // return field.settings.options.map((option: any, index) => this.renderRadioGroupOption(renderOnPage, field, option, index));\n // case 'attachment':\n // el = document.createElement('verdocs-field-attachment');\n // el.setAttribute('value', result || '');\n // break;\n // case 'payment':\n // el = document.createElement('verdocs-field-payment');\n // break;\n default:\n console.log('[SIGN] Skipping unsupported field type', field);\n }\n\n if (el) {\n el.field = field;\n el.recipient = this.recipient;\n el.setAttribute('id', id);\n // el.setAttribute('required', required);\n el.addEventListener('fieldChange', e => this.handleFieldChange(field, e));\n this.setControlStyles(el, field, docPage);\n controlsDiv.appendChild(el);\n }\n }\n\n handlePageRendered(e) {\n const pageInfo = e.detail as IPageRenderEvent;\n console.log('[SIGN] Page rendered', pageInfo);\n\n const fields = this.fields.filter(field => field.page === pageInfo.renderedPage.pageNumber);\n console.log('[SIGN] Fields on page', fields);\n fields.forEach(field => this.renderField(field, pageInfo.renderedPage));\n // .map((field, index) => this.renderField(field, index));\n // this.pdfPageInfo = e.detail;\n }\n\n render() {\n const menuOptions = [\n {id: 'later', label: 'Finish Later'}, //\n {id: 'claim', label: 'Claim the Document', disabled: true},\n {id: 'decline', label: 'Decline to Sign'},\n {id: 'print', label: 'Print Without Signing'},\n {id: 'download', label: 'Download'},\n ];\n\n return (\n <Host class={{storybook: !!window?.['STORYBOOK_ENV'], agreed: this.recipient?.agreed}}>\n <div class=\"header\">\n <div class=\"intro\">Please review and act on these documents.</div>\n <div class=\"toolbar\">\n <div class=\"tools\">\n <verdocs-dropdown options={menuOptions} onOptionSelected={e => this.handleOptionSelected(e)} />\n\n {!this.recipient?.agreed ? (\n <div class=\"agree\">\n <div class=\"agree-checkbox\">\n <input type=\"checkbox\" value=\"None\" id=\"agree-checkbox-element\" name=\"agree\" onChange={() => this.handleClickAgree()} />\n <label htmlFor=\"agree-checkbox-element\" />\n </div>\n <span>I agree to use electronic records and signatures.</span>\n </div>\n ) : (\n <div style={{flex: '1'}} />\n )}\n <verdocs-button size=\"small\" label={this.nextButtonLabel} disabled={!this.recipient?.agreed} onClick={() => this.handleNext()} />\n </div>\n </div>\n </div>\n\n {!this.recipient?.agreed ? <div class=\"cover\" /> : <div style={{display: 'none'}} />}\n\n <div class=\"document\">\n {this.pdfUrl ? (\n <verdocs-view\n source={this.pdfUrl}\n endpoint={this.endpoint}\n onPageRendered={e => this.handlePageRendered(e)}\n pageLayers={[\n {name: 'page', type: 'canvas'},\n {name: 'controls', type: 'div'},\n ]}\n />\n ) : (\n <verdocs-loader />\n )}\n\n {/*{(this.pdfPageInfo?.pages || []).map(page => (*/}\n {/* <div class=\"page-controls\">*/}\n {/* {this.pdfPageInfo?.numRendered > 0 ? (*/}\n {/* this.fields.filter(field => field.page === page.pageNumber).map((field, index) => this.renderField(field, index))*/}\n {/* ) : (*/}\n {/* <div style={{display: 'none'}}>Waiting for PDF to render...</div>*/}\n {/* )}*/}\n {/* </div>*/}\n {/*))}*/}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["node_modules/@verdocs/js-sdk/Utils/Locales.js","node_modules/@verdocs/js-sdk/Templates/Validators.js","node_modules/@verdocs/js-sdk/Utils/Colors.js","node_modules/@verdocs/js-sdk/Utils/Fields.js","src/components/embeds/verdocs-sign/verdocs-sign.scss?tag=verdocs-sign","src/components/embeds/verdocs-sign/verdocs-sign.tsx"],"names":["e164Regex","RegExp","simpleE164Validator","code","length","test","EmailRegEx","isValidEmail","value","isValidPhone","getRGBA","roleIndex","rescale","r","n","verdocsSignCss","VerdocsSign","class_1","hostRef","this","endpoint","VerdocsEndpoint","getDefault","documentId","roleId","inviteCode","recipient","signerToken","pdfUrl","recipientIndex","document","fields","hasSignature","nextButtonLabel","focusedField","prototype","componentDidLoad","console","log","concat","Documents.getSigningSession","_o","_p","sent","session","email","profile_id","setToken","agreed","Documents.getDocument","getBaseURL","envelope_document_id","recipients","findIndex","role_name","_this","filter","field","recipient_role","e_1","handleClickAgree","updateRecipientStatus","then","catch","e","savePDF","fileName","name","updated_at","split","Documents.getDocumentFile","data","xhr","XMLHttpRequest","responseType","onload","a","createElement","href","window","URL","createObjectURL","response","download","style","display","body","appendChild","click","remove","url","open","send","handleOptionSelected","detail","id","alert","handleFieldChange","optionId","type","Documents.updateDocumentField","prepared","_a","status","_c","_b","error","options","checked","settings","map","option","selected","renderCheckboxGroupOption","page","index","left","xScale","x","bottom","yScale","y","position","transform","backgroundColor","h","order","onFieldChange","renderRadioGroupOption","isFieldValid","validator","result","_d","_e","_f","_h","_g","_j","minimum_checked","_k","maximum_checked","_m","_l","getFieldId","handleNext","requiredFields","required","focusedIndex","nextFocusedIndex","nextRequiredField","el","getElementById","focusField","setControlStyles","docPage","_q","_r","width","_s","height","renderField","controlsDiv","containerId","existingField","setAttribute","addEventListener","handlePageRendered","pageInfo","renderedPage","pageNumber","forEach","render","menuOptions","label","disabled","Host","class","storybook","onOptionSelected","onChange","htmlFor","flex","size","onClick","source","onPageRendered","pageLayers"],"mappings":"6qDA00CA,IAAIA,UAAY,IAAIC,OAAO,oBACpB,SAASC,oBAAoBC,GAChC,OAAQA,IAAS,MAAQA,EAAKC,OAAS,IAAMD,EAAKC,OAAS,GAAKJ,UAAUK,KAAKF,IAAUA,IAAS,IAAMA,IAAS,KCxzCrH,IAAIG,WAAa,yJACV,IAAIC,aAAe,SAAUC,GAAS,OAAOF,WAAWD,KAAKG,IAC7D,IAAIC,aAAe,SAAUD,GAAS,OAAON,oBAAoBM,ICQjE,SAASE,QAAQC,GACpB,OAAQA,EAAY,IAChB,KAAK,EACD,OAAOA,IAAc,EAAI,yBAA2B,2BACxD,KAAK,EACD,MAAO,yBACX,KAAK,EACD,MAAO,yBACX,KAAK,EACD,MAAO,2BACX,KAAK,EACD,MAAO,2BACX,KAAK,EACD,MAAO,0BACX,KAAK,EACD,MAAO,2BACX,KAAK,EACD,MAAO,yBACX,KAAK,EACD,MAAO,2BACX,KAAK,EACD,MAAO,yBACX,QACI,MAAO,4BChCZ,SAASC,QAAQC,EAAGC,GACvB,OAAOD,EAAIC,ECtBf,IAAMC,eAAiB,6iGCuBVC,YAAW,WALxB,SAAAC,EAAAC,4BASUC,KAAAC,SAA4BC,gBAAgBC,aAM5CH,KAAAI,WAA4B,KAM5BJ,KAAAK,OAAwB,KAMxBL,KAAAM,WAA4B,KAE3BN,KAAAO,UAA+B,KAE/BP,KAAAQ,YAAc,KACdR,KAAAS,OAAS,KACTT,KAAAU,gBAA0B,EAC1BV,KAAAW,SAA6B,KAC7BX,KAAAY,OAA2B,GAE3BZ,KAAAa,aAAe,MAEfb,KAAAc,gBAAkB,QAElBd,KAAAe,a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CAAKmD,MAAM,SACTnD,EAAA,MAAA,CAAKmD,MAAM,kBACTnD,EAAA,QAAA,CAAO1B,KAAK,WAAW3F,MAAM,OAAOuF,GAAG,yBAAyB5B,KAAK,QAAQgH,SAAU,WAAM,OAAA5H,EAAKK,sBAClGiE,EAAA,QAAA,CAAOuD,QAAQ,4BAEjBvD,EAAA,OAAA,KAAA,sDAGFA,EAAA,MAAA,CAAKzC,MAAO,CAACiG,KAAM,OAErBxD,EAAA,iBAAA,CAAgByD,KAAK,QAAQT,MAAO1J,KAAKc,gBAAiB6I,YAAWtE,EAAArF,KAAKO,aAAS,MAAA8E,SAAA,OAAA,EAAAA,EAAExD,QAAQuI,QAAS,WAAM,OAAAhI,EAAKyF,uBAMvHZ,EAAAjH,KAAKO,aAAS,MAAA0G,SAAA,OAAA,EAAAA,EAAEpF,QAAS6E,EAAA,MAAA,CAAKmD,MAAM,UAAanD,EAAA,MAAA,CAAKzC,MAAO,CAACC,QAAS,UAEzEwC,EAAA,MAAA,CAAKmD,MAAM,YACR7J,KAAKS,OACJiG,EAAA,MAAA,CAAKmD,MAAM,SACTnD,EAAA,eAAA,CACE2D,OAAQrK,KAAKS,OACbR,SAAUD,KAAKC,SACfqK,eAAgB,SAAAzH,GAAK,OAAAT,EAAK+G,mBAAmBtG,IAC7C0H,WAAY,CACV,CAACvH,KAAM,OAAQgC,KAAM,UACrB,CAAChC,KAAM,WAAYgC,KAAM,WAK/B0B,EAAA,iBAAA,kBAzaY","sourcesContent":["export var Countries = [\n {\n code: '+7 840',\n name: 'Abkhazia',\n value: '+7',\n },\n {\n code: '+93',\n name: 'Afghanistan',\n value: '+93',\n },\n {\n code: '+355',\n name: 'Albania',\n value: '+355',\n },\n {\n code: '+213',\n name: 'Algeria',\n value: '+213',\n },\n {\n code: '+1',\n name: 'American Samoa',\n value: '+1',\n },\n {\n code: '+376',\n name: 'Andorra',\n value: '+376',\n },\n {\n code: '+244',\n name: 'Angola',\n value: '+244',\n },\n {\n code: '+1',\n name: 'Anguilla',\n value: '+1',\n },\n {\n code: '+1',\n name: 'Antigua and Barbuda',\n value: '+1',\n },\n {\n code: '+54',\n name: 'Argentina',\n value: '+54',\n },\n {\n code: '+374',\n name: 'Armenia',\n value: '+374',\n },\n {\n code: '+297',\n name: 'Aruba',\n value: '+297',\n },\n {\n code: '+247',\n name: 'Ascension',\n value: '+247',\n },\n {\n code: '+61',\n name: 'Australia',\n value: '+61',\n },\n {\n code: '+672',\n name: 'Australian External Territories',\n value: '+672',\n },\n {\n code: '+43',\n name: 'Austria',\n value: '+43',\n },\n {\n code: '+994',\n name: 'Azerbaijan',\n value: '+994',\n },\n {\n code: '+1',\n name: 'Bahamas',\n value: '+1',\n },\n {\n code: '+973',\n name: 'Bahrain',\n value: '+973',\n },\n {\n code: '+880',\n name: 'Bangladesh',\n value: '+880',\n },\n {\n code: '+1',\n name: 'Barbados',\n value: '+1',\n },\n {\n code: '+1',\n name: 'Barbuda',\n value: '+1',\n },\n {\n code: '+375',\n name: 'Belarus',\n value: '+375',\n },\n {\n code: '+32',\n name: 'Belgium',\n value: '+32',\n },\n {\n code: '+501',\n name: 'Belize',\n value: '+501',\n },\n {\n code: '+229',\n name: 'Benin',\n value: '+229',\n },\n {\n code: '+1',\n name: 'Bermuda',\n value: '+1',\n },\n {\n code: '+975',\n name: 'Bhutan',\n value: '+975',\n },\n {\n code: '+591',\n name: 'Bolivia',\n value: '+591',\n },\n {\n code: '+387',\n name: 'Bosnia and Herzegovina',\n value: '+387',\n },\n {\n code: '+267',\n name: 'Botswana',\n value: '+267',\n },\n {\n code: '+55',\n name: 'Brazil',\n value: '+55',\n },\n {\n code: '+246',\n name: 'British Indian Ocean Territory',\n value: '+246',\n },\n {\n code: '+1',\n name: 'British Virgin Islands',\n value: '+1',\n },\n {\n code: '+673',\n name: 'Brunei',\n value: '+673',\n },\n {\n code: '+359',\n name: 'Bulgaria',\n value: '+359',\n },\n {\n code: '+226',\n name: 'Burkina Faso',\n value: '+226',\n },\n {\n code: '+257',\n name: 'Burundi',\n value: '+257',\n },\n {\n code: '+855',\n name: 'Cambodia',\n value: '+855',\n },\n {\n code: '+237',\n name: 'Cameroon',\n value: '+237',\n },\n {\n code: '+1',\n name: 'Canada',\n value: '+1',\n },\n {\n code: '+238',\n name: 'Cape Verde',\n value: '+238',\n },\n {\n code: '+1',\n name: 'Cayman Islands',\n value: '+1',\n },\n {\n code: '+236',\n name: 'Central African Republic',\n value: '+236',\n },\n {\n code: '+235',\n name: 'Chad',\n value: '+235',\n },\n {\n code: '+56',\n name: 'Chile',\n value: '+56',\n },\n {\n code: '+86',\n name: 'China',\n value: '+86',\n },\n {\n code: '+61',\n name: 'Christmas Island',\n value: '+61',\n },\n {\n code: '+61',\n name: 'Cocos-Keeling Islands',\n value: '+61',\n },\n {\n code: '+57',\n name: 'Colombia',\n value: '+57',\n },\n {\n code: '+269',\n name: 'Comoros',\n value: '+269',\n },\n {\n code: '+242',\n name: 'Congo',\n value: '+242',\n },\n {\n code: '+243',\n name: 'Congo, Dem. Rep. of (Zaire)',\n value: '+243',\n },\n {\n code: '+682',\n name: 'Cook Islands',\n value: '+682',\n },\n {\n code: '+506',\n name: 'Costa Rica',\n value: '+506',\n },\n {\n code: '+385',\n name: 'Croatia',\n value: '+385',\n },\n {\n code: '+53',\n name: 'Cuba',\n value: '+53',\n },\n {\n code: '+599',\n name: 'Curacao',\n value: '+599',\n },\n {\n code: '+537',\n name: 'Cyprus',\n value: '+537',\n },\n {\n code: '+420',\n name: 'Czech Republic',\n value: '+420',\n },\n {\n code: '+45',\n name: 'Denmark',\n value: '+45',\n },\n {\n code: '+246',\n name: 'Diego Garcia',\n value: '+246',\n },\n {\n code: '+253',\n name: 'Djibouti',\n value: '+253',\n },\n {\n code: '+1',\n name: 'Dominica',\n value: '+1',\n },\n {\n code: '+1',\n name: 'Dominican Republic',\n value: '+1',\n },\n {\n code: '+670',\n name: 'East Timor',\n value: '+670',\n },\n {\n code: '+56',\n name: 'Easter Island',\n value: '+56',\n },\n {\n code: '+593',\n name: 'Ecuador',\n value: '+593',\n },\n {\n code: '+20',\n name: 'Egypt',\n value: '+20',\n },\n {\n code: '+503',\n name: 'El Salvador',\n value: '+503',\n },\n {\n code: '+240',\n name: 'Equatorial Guinea',\n value: '+240',\n },\n {\n code: '+291',\n name: 'Eritrea',\n value: '+291',\n },\n {\n code: '+372',\n name: 'Estonia',\n value: '+372',\n },\n {\n code: '+251',\n name: 'Ethiopia',\n value: '+251',\n },\n {\n code: '+500',\n name: 'Falkland Islands',\n value: '+500',\n },\n {\n code: '+298',\n name: 'Faroe Islands',\n value: '+298',\n },\n {\n code: '+679',\n name: 'Fiji',\n value: '+679',\n },\n {\n code: '+358',\n name: 'Finland',\n value: '+358',\n },\n {\n code: '+33',\n name: 'France',\n value: '+33',\n },\n {\n code: '+596',\n name: 'Martinique',\n value: '+596',\n },\n {\n code: '+594',\n name: 'French Guiana',\n value: '+594',\n },\n {\n code: '+689',\n name: 'French Polynesia',\n value: '+689',\n },\n {\n code: '+241',\n name: 'Gabon',\n value: '+241',\n },\n {\n code: '+220',\n name: 'Gambia',\n value: '+220',\n },\n {\n code: '+995',\n name: 'Georgia',\n value: '+995',\n },\n {\n code: '+49',\n name: 'Germany',\n value: '+49',\n },\n {\n code: '+233',\n name: 'Ghana',\n value: '+233',\n },\n {\n code: '+350',\n name: 'Gibraltar',\n value: '+350',\n },\n {\n code: '+30',\n name: 'Greece',\n value: '+30',\n },\n {\n code: '+299',\n name: 'Greenland',\n value: '+299',\n },\n {\n code: '+1',\n name: 'Grenada',\n value: '+1',\n },\n {\n code: '+590',\n name: 'Guadeloupe',\n value: '+590',\n },\n {\n code: '+1',\n name: 'Guam',\n value: '+1',\n },\n {\n code: '+502',\n name: 'Guatemala',\n value: '+502',\n },\n {\n code: '+224',\n name: 'Guinea',\n value: '+224',\n },\n {\n code: '+245',\n name: 'Guinea-Bissau',\n value: '+245',\n },\n {\n code: '+595',\n name: 'Guyana',\n value: '+595',\n },\n {\n code: '+509',\n name: 'Haiti',\n value: '+509',\n },\n {\n code: '+504',\n name: 'Honduras',\n value: '+504',\n },\n {\n code: '+852',\n name: 'Hong Kong SAR China',\n value: '+852',\n },\n {\n code: '+36',\n name: 'Hungary',\n value: '+36',\n },\n {\n code: '+354',\n name: 'Iceland',\n value: '+354',\n },\n {\n code: '+91',\n name: 'India',\n value: '+91',\n },\n {\n code: '+62',\n name: 'Indonesia',\n value: '+62',\n },\n {\n code: '+98',\n name: 'Iran',\n value: '+98',\n },\n {\n code: '+964',\n name: 'Iraq',\n value: '+964',\n },\n {\n code: '+353',\n name: 'Ireland',\n value: '+353',\n },\n {\n code: '+972',\n name: 'Israel',\n value: '+972',\n },\n {\n code: '+39',\n name: 'Italy',\n value: '+39',\n },\n {\n code: '+225',\n name: 'Ivory Coast',\n value: '+225',\n },\n {\n code: '+1',\n name: 'Jamaica',\n value: '+1',\n },\n {\n code: '+81',\n name: 'Japan',\n value: '+81',\n },\n {\n code: '+962',\n name: 'Jordan',\n value: '+962',\n },\n {\n code: '+77',\n name: 'Kazakhstan',\n value: '+7',\n },\n {\n code: '+254',\n name: 'Kenya',\n value: '+254',\n },\n {\n code: '+686',\n name: 'Kiribati',\n value: '+686',\n },\n {\n code: '+965',\n name: 'Kuwait',\n value: '+965',\n },\n {\n code: '+996',\n name: 'Kyrgyzstan',\n value: '+996',\n },\n {\n code: '+856',\n name: 'Laos',\n value: '+856',\n },\n {\n code: '+371',\n name: 'Latvia',\n value: '+371',\n },\n {\n code: '+961',\n name: 'Lebanon',\n value: '+961',\n },\n {\n code: '+266',\n name: 'Lesotho',\n value: '+266',\n },\n {\n code: '+231',\n name: 'Liberia',\n value: '+231',\n },\n {\n code: '+218',\n name: 'Libya',\n value: '+218',\n },\n {\n code: '+423',\n name: 'Liechtenstein',\n value: '+423',\n },\n {\n code: '+370',\n name: 'Lithuania',\n value: '+370',\n },\n {\n code: '+352',\n name: 'Luxembourg',\n value: '+352',\n },\n {\n code: '+853',\n name: 'Macau SAR China',\n value: '+853',\n },\n {\n code: '+389',\n name: 'Macedonia',\n value: '+389',\n },\n {\n code: '+261',\n name: 'Madagascar',\n value: '+261',\n },\n {\n code: '+265',\n name: 'Malawi',\n value: '+265',\n },\n {\n code: '+60',\n name: 'Malaysia',\n value: '+60',\n },\n {\n code: '+960',\n name: 'Maldives',\n value: '+960',\n },\n {\n code: '+223',\n name: 'Mali',\n value: '+223',\n },\n {\n code: '+356',\n name: 'Malta',\n value: '+356',\n },\n {\n code: '+692',\n name: 'Marshall Islands',\n value: '+692',\n },\n {\n code: '+596',\n name: 'Martinique',\n value: '+596',\n },\n {\n code: '+222',\n name: 'Mauritania',\n value: '+222',\n },\n {\n code: '+230',\n name: 'Mauritius',\n value: '+230',\n },\n {\n code: '+262',\n name: 'Mayotte or Réunion',\n value: '+262',\n },\n {\n code: '+52',\n name: 'Mexico',\n value: '+52',\n },\n {\n code: '+691',\n name: 'Micronesia',\n value: '+691',\n },\n {\n code: '+1',\n name: 'Midway Island',\n value: '+1',\n },\n {\n code: '+373',\n name: 'Moldova',\n value: '+373',\n },\n {\n code: '+377',\n name: 'Monaco',\n value: '+377',\n },\n {\n code: '+976',\n name: 'Mongolia',\n value: '+976',\n },\n {\n code: '+382',\n name: 'Montenegro',\n value: '+382',\n },\n {\n code: '+1',\n name: 'Montserrat',\n value: '+1',\n },\n {\n code: '+212',\n name: 'Morocco',\n value: '+212',\n },\n {\n code: '+95',\n name: 'Myanmar',\n value: '+95',\n },\n {\n code: '+264',\n name: 'Namibia',\n value: '+264',\n },\n {\n code: '+674',\n name: 'Nauru',\n value: '+674',\n },\n {\n code: '+977',\n name: 'Nepal',\n value: '+977',\n },\n {\n code: '+31',\n name: 'Netherlands',\n value: '+31',\n },\n {\n code: '+599',\n name: 'Netherlands Antilles',\n value: '+599',\n },\n {\n code: '+1',\n name: 'Nevis',\n value: '+1',\n },\n {\n code: '+687',\n name: 'New Caledonia',\n value: '+687',\n },\n {\n code: '+64',\n name: 'New Zealand',\n value: '+64',\n },\n {\n code: '+505',\n name: 'Nicaragua',\n value: '+505',\n },\n {\n code: '+227',\n name: 'Niger',\n value: '+227',\n },\n {\n code: '+234',\n name: 'Nigeria',\n value: '+234',\n },\n {\n code: '+683',\n name: 'Niue',\n value: '+683',\n },\n {\n code: '+672',\n name: 'Norfolk Island',\n value: '+672',\n },\n {\n code: '+850',\n name: 'North Korea',\n value: '+850',\n },\n {\n code: '+1',\n name: 'Northern Mariana Islands',\n value: '+1',\n },\n {\n code: '+47',\n name: 'Norway',\n value: '+47',\n },\n {\n code: '+968',\n name: 'Oman',\n value: '+968',\n },\n {\n code: '+92',\n name: 'Pakistan',\n value: '+92',\n },\n {\n code: '+680',\n name: 'Palau',\n value: '+680',\n },\n {\n code: '+970',\n name: 'Palestinian Territory',\n value: '+970',\n },\n {\n code: '+507',\n name: 'Panama',\n value: '+507',\n },\n {\n code: '+675',\n name: 'Papua New Guinea',\n value: '+675',\n },\n {\n code: '+595',\n name: 'Paraguay',\n value: '+595',\n },\n {\n code: '+51',\n name: 'Peru',\n value: '+51',\n },\n {\n code: '+63',\n name: 'Philippines',\n value: '+63',\n },\n {\n code: '+48',\n name: 'Poland',\n value: '+48',\n },\n {\n code: '+351',\n name: 'Portugal',\n value: '+351',\n },\n {\n code: '+1',\n name: 'Puerto Rico',\n value: '+1',\n },\n {\n code: '+974',\n name: 'Qatar',\n value: '+974',\n },\n {\n code: '+40',\n name: 'Romania',\n value: '+40',\n },\n {\n code: '+7',\n name: 'Russia',\n value: '+7',\n },\n {\n code: '+250',\n name: 'Rwanda',\n value: '+250',\n },\n {\n code: '508',\n name: 'Saint Pierre and Miquelon',\n value: '508',\n },\n {\n code: '+685',\n name: 'Samoa',\n value: '+685',\n },\n {\n code: '+378',\n name: 'San Marino',\n value: '+378',\n },\n {\n code: '+966',\n name: 'Saudi Arabia',\n value: '+966',\n },\n {\n code: '+221',\n name: 'Senegal',\n value: '+221',\n },\n {\n code: '+381',\n name: 'Serbia',\n value: '+381',\n },\n {\n code: '+248',\n name: 'Seychelles',\n value: '+248',\n },\n {\n code: '+232',\n name: 'Sierra Leone',\n value: '+232',\n },\n {\n code: '+65',\n name: 'Singapore',\n value: '+65',\n },\n {\n code: '+421',\n name: 'Slovakia',\n value: '+421',\n },\n {\n code: '+386',\n name: 'Slovenia',\n value: '+386',\n },\n {\n code: '+677',\n name: 'Solomon Islands',\n value: '+677',\n },\n {\n code: '+27',\n name: 'South Africa',\n value: '+27',\n },\n {\n code: '+500',\n name: 'South Georgia and the South Sandwich Islands',\n value: '+500',\n },\n {\n code: '+82',\n name: 'South Korea',\n value: '+82',\n },\n {\n code: '+34',\n name: 'Spain',\n value: '+34',\n },\n {\n code: '+94',\n name: 'Sri Lanka',\n value: '+94',\n },\n {\n code: '+249',\n name: 'Sudan',\n value: '+249',\n },\n {\n code: '+597',\n name: 'Suriname',\n value: '+597',\n },\n {\n code: '+268',\n name: 'Swaziland',\n value: '+268',\n },\n {\n code: '+46',\n name: 'Sweden',\n value: '+46',\n },\n {\n code: '+41',\n name: 'Switzerland',\n value: '+41',\n },\n {\n code: '+963',\n name: 'Syria',\n value: '+963',\n },\n {\n code: '+886',\n name: 'Taiwan',\n value: '+886',\n },\n {\n code: '+992',\n name: 'Tajikistan',\n value: '+992',\n },\n {\n code: '+255',\n name: 'Tanzania',\n value: '+255',\n },\n {\n code: '+66',\n name: 'Thailand',\n value: '+66',\n },\n {\n code: '+670',\n name: 'Timor Leste',\n value: '+670',\n },\n {\n code: '+228',\n name: 'Togo',\n value: '+228',\n },\n {\n code: '+690',\n name: 'Tokelau',\n value: '+690',\n },\n {\n code: '+676',\n name: 'Tonga',\n value: '+676',\n },\n {\n code: '+1',\n name: 'Trinidad and Tobago',\n value: '+1',\n },\n {\n code: '+216',\n name: 'Tunisia',\n value: '+216',\n },\n {\n code: '+90',\n name: 'Turkey',\n value: '+90',\n },\n {\n code: '+993',\n name: 'Turkmenistan',\n value: '+993',\n },\n {\n code: '+1',\n name: 'Turks and Caicos Islands',\n value: '+1',\n },\n {\n code: '+688',\n name: 'Tuvalu',\n value: '+688',\n },\n {\n code: '+1',\n name: 'U.S. Virgin Islands',\n value: '+1',\n },\n {\n code: '+256',\n name: 'Uganda',\n value: '+256',\n },\n {\n code: '+380',\n name: 'Ukraine',\n value: '+380',\n },\n {\n code: '+971',\n name: 'United Arab Emirates',\n value: '+971',\n },\n {\n code: '+44',\n name: 'United Kingdom',\n value: '+44',\n },\n {\n code: '+1',\n name: 'United States',\n value: '+1',\n },\n {\n code: '+598',\n name: 'Uruguay',\n value: '+598',\n },\n {\n code: '+998',\n name: 'Uzbekistan',\n value: '+998',\n },\n {\n code: '+678',\n name: 'Vanuatu',\n value: '+678',\n },\n {\n code: '+58',\n name: 'Venezuela',\n value: '+58',\n },\n {\n code: '+84',\n name: 'Vietnam',\n value: '+84',\n },\n {\n code: '+1',\n name: 'Wake Island',\n value: '+1',\n },\n {\n code: '+681',\n name: 'Wallis and Futuna',\n value: '+681',\n },\n {\n code: '+967',\n name: 'Yemen',\n value: '+967',\n },\n {\n code: '+260',\n name: 'Zambia',\n value: '+260',\n },\n {\n code: '+255',\n name: 'Zanzibar',\n value: '+255',\n },\n {\n code: '+263',\n name: 'Zimbabwe',\n value: '+263',\n },\n];\nexport function getCountryByCode(code) {\n var found = Countries.find(function (country) { return country.code === code; });\n if (found)\n return found;\n if (isFrenchGuiana(code)) {\n return {\n code: '+594',\n name: 'French Guiana',\n value: '+594',\n };\n }\n else if (isGuadeloupe(code)) {\n return {\n code: '+590',\n name: 'Guadeloupe',\n value: '+590',\n };\n }\n else if (isMartinique(code)) {\n return {\n code: '+596',\n name: 'Martinique',\n value: '+596',\n };\n }\n else if (isMayotte(code)) {\n return {\n code: '+262',\n name: 'Mayotte or Réunion',\n value: '+262',\n };\n }\n return null;\n}\nexport function isFrenchGuiana(code) {\n return '+594' === code.substring(0, 4);\n}\nexport function isGuadeloupe(code) {\n return '+590' === code.substring(0, 4);\n}\nexport function isMartinique(code) {\n return '+596' === code.substring(0, 4);\n}\nexport function isMayotte(code) {\n return '+262' === code.substring(0, 4);\n}\nexport function getPlusOneCountry(code) {\n var info = null;\n switch (code.substring(0, 5)) {\n case '+1684':\n info = {\n code: '+1',\n name: 'American Samoa',\n value: '+1',\n };\n break;\n case '+1264':\n info = {\n code: '+1',\n name: 'Anguilla',\n value: '+1',\n };\n case '+1268':\n info = {\n code: '+1',\n name: 'Antigua and Barbuda',\n value: '+1',\n };\n case '+1242':\n info = {\n code: '+1',\n name: 'Bahamas',\n value: '+1',\n };\n break;\n case '+1246':\n info = {\n code: '+1',\n name: 'Barbados',\n value: '+1',\n };\n break;\n case '+1441':\n info = {\n code: '+1',\n name: 'Bermuda',\n value: '+1',\n };\n break;\n case '+1284':\n info = {\n code: '+1',\n name: 'British Virgin Islands',\n value: '+1',\n };\n break;\n case '+1':\n info = {\n code: '+1',\n name: '',\n value: '+1',\n };\n break;\n default:\n break;\n }\n return info;\n}\nexport function isCanada(code) {\n var canadianAreaCodes = [\n '403',\n '587',\n '780',\n '825',\n '604',\n '250',\n '778',\n '236',\n '204',\n '431',\n '506',\n '709',\n '867',\n '782',\n '902',\n '867',\n '548',\n '705',\n '365',\n '613',\n '807',\n '226',\n '289',\n '437',\n '519',\n '647',\n '905',\n '249',\n '343',\n '416',\n '902',\n '782',\n '450',\n '418',\n '579',\n '873',\n '367',\n '514',\n '581',\n '819',\n '438',\n '639',\n '306',\n '867',\n ];\n var areaCode = code.substring(0, 5);\n return canadianAreaCodes.findIndex(function (x) { return '+1' + x === areaCode; }) > -1;\n}\nexport function isAmericanSamoa(code) {\n return code.substring(0, 5) === '+1684';\n}\nexport function isDominicanRepublic(code) {\n return '+1809' === code.substring(0, 5) || '+1829' === code.substring(0, 5) || '+1849' === code.substring(0, 5);\n}\nexport function isPuertoRico(code) {\n return code.substring(0, 5) === '+' || code.substring(0, 5) === '+';\n}\n// need to finish\nexport function getMatchingCountry(code, substrings) {\n var toMatch = code.substring(0, substrings);\n return Countries.filter(function (c) { return c.code === toMatch; }).length;\n}\nvar e164Regex = new RegExp(/\\+[1-9]\\d{6,14}/g);\nexport function simpleE164Validator(code) {\n return (code !== null && code.length < 16 && code.length > 6 && e164Regex.test(code)) || code === '' || code === null;\n}\n","import { simpleE164Validator } from '../Utils/Locales';\n/**\n * Get all defined validators\n *\n * ```typescript\n * import {Documents} from '@verdocs/js-sdk/Templates';\n *\n * await Documents.getDocuments(templateID);\n * ```\n */\nexport var getValidators = function (endpoint) {\n return endpoint.api //\n .get('/validators')\n .then(function (r) { return r.data; });\n};\nexport var getValidator = function (endpoint, validatorName) {\n return endpoint.api //\n .get(\"/validators/\".concat(validatorName))\n .then(function (r) { return r.data; });\n};\nvar EmailRegEx = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\nexport var isValidEmail = function (value) { return EmailRegEx.test(value); };\nexport var isValidPhone = function (value) { return simpleE164Validator(value); };\nexport var isValidRoleName = function (value, roles) { return roles.findIndex(function (role) { return role.name === value; }) !== -1; };\nvar TagRegEx = /^[a-zA-Z0-9-]{0,32}$/;\nexport var isValidTag = function (value, tags) { return TagRegEx.test(value) || tags.findIndex(function (tag) { return tag.name === value; }) !== -1; };\n","/**\n * Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.\n */\nexport function getRGB(rgba) {\n var rgbNumbers = rgba.replace('rgba(', '').replace(')', '').split(',');\n var rgbObject = {\n red: +rgbNumbers[0],\n green: +rgbNumbers[1],\n blue: +rgbNumbers[2],\n alpha: +rgbNumbers[3],\n };\n var alpha = 1 - rgbObject.alpha;\n var red = Math.round((rgbObject.alpha * (rgbObject.red / 255) + alpha) * 255);\n var green = Math.round((rgbObject.alpha * (rgbObject.green / 255) + alpha) * 255);\n var blue = Math.round((rgbObject.alpha * (rgbObject.blue / 255) + alpha) * 255);\n return '#' + rgbToHex(red) + rgbToHex(green) + rgbToHex(blue);\n}\n/**\n * Given an RGB string value, returns the hex equivalent.\n */\nfunction rgbToHex(rgb) {\n var hex = rgb.toString(16);\n if (hex.length < 2) {\n return '0' + hex;\n }\n return hex;\n}\n/**\n * Given a signer role index, return the color code for that signer.\n */\nexport function getRGBA(roleIndex) {\n switch (roleIndex % 10) {\n case 0:\n return roleIndex === 0 ? 'rgba(255, 193, 7, 0.4)' : 'rgba(134, 134, 134, 0.3)'; // #FFE69C\n case 1:\n return 'rgba(156, 39, 176, .4)'; // '#E3C3E9'\n case 2:\n return 'rgba(33, 150, 243, .4)'; // '#C1E1FB'\n case 3:\n return 'rgba(220, 231, 117, 0.3)';\n case 4:\n return 'rgba(121, 134, 203, 0.3)';\n case 5:\n return 'rgba(77, 182, 172, 0.3)';\n case 6:\n return 'rgba(255, 202, 165, 0.3)';\n case 7:\n return 'rgba(2, 247, 190, 0.3)';\n case 8:\n return 'rgba(255, 138, 101, 0.3)';\n case 9:\n return 'rgba(82, 255, 79, 0.3)';\n default:\n return 'rgba(229, 115, 155, 0.3)';\n }\n}\n/**\n * Given a role name, return a color code for it. This works by computing a hash code so the specific color returned\n * is not specified explicitly, but will be the same for every call with the same input value.\n */\nexport function nameToRGBA(str) {\n if (!!str) {\n var validNum = parseInt(str.slice(-1), 10);\n if (!isNaN(validNum)) {\n str += (validNum * 99).toString();\n }\n var hash = 0;\n for (var i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n hash = Math.round(hash / 1.3);\n var c = (hash & 0x00ffff08).toString(16).toUpperCase();\n var hex = '#' + '00000'.substring(0, 6 - c.length) + c;\n var result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n var color = {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n };\n return \"rgba(\".concat(color.r, \", \").concat(color.g, \", \").concat(color.b, \", 0.2)\");\n }\n}\n/**\n * Helper function to obtain a color code given a role name given various possible inputs.\n */\nexport function getRoleColor(name, roles, index) {\n if (index) {\n return getRGBA(index);\n }\n else if (roles && roles.length > 0) {\n var roleIndex = roles.findIndex(function (role) { return role.name === name; });\n if (roleIndex > -1) {\n return roles[roleIndex].rgba || getRGBA(roleIndex);\n }\n else {\n return nameToRGBA(name);\n }\n }\n else {\n return nameToRGBA(name);\n }\n}\n","export function getRTop(y, fieldHeight, iTextHeight, yRatio) {\n return iTextHeight - (y + fieldHeight) * yRatio;\n}\nexport function getRLeft(x, ratio) {\n return x * ratio;\n}\nexport function getRValue(y, ratio) {\n return y * ratio;\n}\nexport function blobToBase64(image) {\n var fileReader = new FileReader();\n return new Promise(function (resolve, reject) {\n fileReader.onerror = function () {\n reject(new DOMException('Problem reading blob.'));\n };\n fileReader.onload = function () {\n resolve(fileReader.result);\n };\n fileReader.readAsDataURL(image);\n });\n}\nexport function rescale(r, n) {\n return r * n;\n}\n","@import '../../../theme.scss';\n\nverdocs-sign {\n display: flex;\n overflow: hidden;\n position: relative;\n min-height: 600px;\n flex-direction: column;\n box-sizing: border-box;\n font-family: $verdocs-primary-font;\n\n div {\n box-sizing: border-box;\n }\n\n .header {\n flex: 0;\n display: flex;\n z-index: 1000;\n align-items: center;\n transition: all 0.25s;\n justify-content: center;\n background-color: $medium-bg;\n box-shadow: 0 4px 4px 0 rgb(0 0 0 / 24%), 0 0 4px 0 rgb(0 0 0 / 12%);\n\n .inner {\n width: 100%;\n max-width: 1028px;\n }\n }\n\n .intro {\n width: 100%;\n height: 60px;\n display: flex;\n background: #ffffff;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n\n .inner {\n width: 100%;\n color: #111111;\n padding: 0 14px;\n font-size: 20px;\n font-weight: 500;\n line-height: 28px;\n max-width: 1024px;\n }\n }\n\n &.agreed {\n .intro {\n //display: none;\n }\n }\n\n .toolbar {\n width: 100%;\n margin: 0 auto;\n padding: 0 14px;\n position: relative;\n }\n\n .tools {\n width: 100%;\n color: #fff;\n height: 56px;\n display: flex;\n font-size: 12px;\n align-items: center;\n flex-direction: row;\n background-color: $medium-bg;\n }\n\n .cover {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 999;\n position: absolute;\n background: rgba(0, 0, 0, 0.5);\n }\n\n .document {\n flex: 1;\n height: 100%;\n display: flex;\n position: relative;\n overflow-y: scroll;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n\n .inner {\n width: 100%;\n max-width: 1028px;\n }\n }\n\n .agree {\n flex: 1;\n flex-direction: row;\n display: flex;\n align-items: center;\n margin-right: 10px;\n\n .intro {\n display: none;\n }\n\n .header {\n flex: 0 0 56px;\n }\n\n .agree-checkbox {\n background: #ccc;\n flex: 0 0 20px;\n display: flex;\n width: 20px;\n height: 20px;\n border-radius: 3px;\n position: relative;\n margin: 0 10px 0 14px;\n\n input[type='checkbox']:checked + label:after {\n filter: alpha(opacity=100);\n opacity: 1;\n }\n\n label {\n left: 2px;\n top: 2px;\n width: 16px;\n height: 16px;\n cursor: pointer;\n position: absolute;\n background: #33354c;\n box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.8);\n\n .agree-checkbox label:hover::after {\n filter: alpha(opacity=30);\n opacity: 0.3;\n }\n\n &:after {\n top: 2px;\n left: 3px;\n width: 8px;\n opacity: 0;\n height: 5px;\n content: '';\n position: absolute;\n background: transparent;\n filter: alpha(opacity=0);\n transform: rotate(-45deg);\n border: 2px solid #fcfff4;\n border-top: none;\n border-right: none;\n }\n }\n }\n }\n}\n","import {Host} from '@stencil/core';\nimport {VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {Documents} from '@verdocs/js-sdk/Documents';\nimport {getRGBA} from '@verdocs/js-sdk/Utils/Colors';\nimport {rescale} from '@verdocs/js-sdk/Utils/Fields';\nimport {Component, Prop, State, h} from '@stencil/core';\nimport {updateRecipientStatus} from '@verdocs/js-sdk/Documents/Recipients';\nimport {isValidEmail, isValidPhone} from '@verdocs/js-sdk/Templates/Validators';\nimport {IDocument, IDocumentField, IRecipient} from '@verdocs/js-sdk/Documents/Documents';\nimport {IDocumentPageInfo} from '../../elements/verdocs-document-page/verdocs-document-page';\nimport {IPageRenderEvent} from '../verdocs-view/verdocs-view';\n\n/**\n * Display a document signing experience.\n *\n * *NOTE: This sample document will reset every 10 minutes.*\n * ***NOTE: This sample document will reset every 10 minutes...***\n */\n@Component({\n tag: 'verdocs-sign',\n styleUrl: 'verdocs-sign.scss',\n shadow: false,\n})\nexport class VerdocsSign {\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 * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a\n * signing session.\n */\n @Prop() documentId: string | null = null;\n\n /**\n * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a\n * signing session.\n */\n @Prop() roleId: string | null = null;\n\n /**\n * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a\n * signing session.\n */\n @Prop() inviteCode: string | null = null;\n\n @State() recipient: IRecipient | null = null;\n\n @State() signerToken = null;\n @State() pdfUrl = null;\n @State() recipientIndex: number = -1;\n @State() document: IDocument | null = null;\n @State() fields: IDocumentField[] = [];\n\n @State() hasSignature = false;\n\n @State() nextButtonLabel = 'Start';\n\n @State() focusedField = '';\n\n async componentDidLoad() {\n try {\n console.log(`[SIGN] Processing invite code for ${this.documentId} / ${this.documentId}`);\n const {session, recipient, signerToken} = await Documents.getSigningSession(this.endpoint, {\n documentId: this.documentId,\n roleId: this.roleId,\n inviteCode: this.inviteCode,\n });\n\n console.log(`[SIGN] Got signing session ${session.email} / ${session.profile_id}`);\n\n this.recipient = recipient;\n this.signerToken = signerToken;\n this.endpoint.setToken(signerToken);\n\n if (this.recipient.agreed) {\n this.nextButtonLabel = 'Next';\n }\n\n const document = await Documents.getDocument(this.endpoint, this.documentId);\n this.document = document;\n console.log('[SIGN] Signing document', document);\n\n this.pdfUrl = `${this.endpoint.getBaseURL()}/documents/${this.documentId}/envelope_documents/${document.envelope_document_id}?file=true`;\n\n this.recipientIndex = this.document.recipients.findIndex(recipient => recipient.role_name == this.roleId);\n if (this.recipientIndex > -1) {\n console.log('Found recipient', this.document.recipients[this.recipientIndex]);\n }\n\n this.fields = this.document.fields.filter(field => field.recipient_role === this.roleId);\n console.log('Loaded fields', this.fields);\n\n // TODO: Fix service to allow this?\n // const sigs = await getSignatures();\n // console.log('sigs', sigs);\n } catch (e) {\n console.log('Error with signing session', e);\n }\n }\n\n handleClickAgree() {\n console.log('agree clicked');\n updateRecipientStatus(this.endpoint, this.documentId, this.roleId, 'update', {agreed: true})\n .then(r => {\n console.log('update result', r);\n this.nextButtonLabel = 'Next';\n this.recipient = r;\n })\n .catch(e => {\n console.log('update failure', e);\n });\n }\n\n async savePDF() {\n const fileName = `${this.document.name} - ${this.document.updated_at.split('T')[0]}.pdf`;\n const data = await Documents.getDocumentFile(this.endpoint, this.documentId, this.document.envelope_document_id);\n\n // This is better in React than doing window.href= or similar to trigger a download. For a description of the technique\n // see https://stackoverflow.com/questions/8126623/downloading-canvas-element-to-an-image\n let xhr = new XMLHttpRequest();\n xhr.responseType = 'blob';\n xhr.onload = function () {\n let a = document.createElement('a');\n a.href = window.URL.createObjectURL(xhr.response);\n a.download = fileName;\n a.style.display = 'none';\n document.body.appendChild(a);\n a.click();\n a.remove();\n };\n\n const url = `data:application/pdf;base64,${data}`;\n console.log('url', url.length, url);\n xhr.open('GET', `data:application/pdf;base64,${data}`);\n xhr.send();\n }\n\n async handleOptionSelected(e) {\n switch (e.detail.id) {\n case 'later':\n // this.router.navigate([`view/sign/${this.envelopeId}/role/${this.roleName}/saved`]);\n if (!window?.['STORYBOOK_ENV']) {\n window.alert('User intends to sign later.');\n }\n break;\n case 'claim':\n break;\n case 'decline':\n break;\n case 'print':\n break;\n case 'download':\n this.savePDF().catch(() => {});\n break;\n }\n }\n\n async handleFieldChange(field: IDocumentField, e: any, optionId?: string) {\n console.log('fieldChange', field, e.detail);\n switch (field.type) {\n case 'textbox':\n Documents.updateDocumentField(this.endpoint, this.documentId, field.name, {prepared: false, value: e.detail})\n .then(r => console.log('Update result', r))\n .catch(e => {\n if (e.response?.status === 401 && e.response?.data?.error === 'jwt expired') {\n console.log('jwt expired');\n }\n console.log('Error updating', e);\n });\n break;\n\n case 'checkbox_group':\n Documents.updateDocumentField(this.endpoint, this.documentId, field.name, {prepared: false, value: {options: [{id: optionId, checked: e.detail}]}})\n .then(r => console.log('Update result', r))\n .catch(e => console.log('Error updating', e));\n break;\n\n case 'radio_button_group':\n const options = field.settings.options.map(option => ({id: option.id, selected: optionId === option.id}));\n Documents.updateDocumentField(this.endpoint, this.documentId, field.name, {prepared: false, value: {options}})\n .then(r => console.log('Update result', r))\n .catch(e => console.log('Error updating', e));\n break;\n\n case 'dropdown':\n Documents.updateDocumentField(this.endpoint, this.documentId, field.name, {prepared: false, value: e.detail})\n .then(r => console.log('Update result', r))\n .catch(e => console.log('Error updating', e));\n break;\n\n case 'initial':\n console.log('Got initial', e.detail);\n break;\n\n case 'signature':\n console.log('Got signature', e.detail);\n break;\n }\n }\n\n renderCheckboxGroupOption(page: IDocumentPageInfo, field: IDocumentField, option: any, index: number) {\n const left = rescale(page.xScale, option.x);\n const bottom = rescale(page.yScale, option.y);\n\n const style = {\n left: `${left}px`,\n bottom: `${bottom}px`,\n position: 'absolute',\n transform: `scale(${page.xScale}, ${page.yScale})`,\n backgroundColor: getRGBA(this.recipientIndex),\n } as any;\n\n return <verdocs-field-checkbox style={style} order={index} value={option.checked} onFieldChange={e => this.handleFieldChange(field, e, option.id)} />;\n }\n\n renderRadioGroupOption(page: IDocumentPageInfo, field: IDocumentField, option: any, index: number) {\n const left = rescale(page.xScale, option.x);\n const bottom = rescale(page.yScale, option.y);\n\n const style = {\n left: `${left}px`,\n bottom: `${bottom}px`,\n position: 'absolute',\n transform: `scale(${page.xScale}, ${page.yScale})`,\n backgroundColor: getRGBA(this.recipientIndex),\n } as any;\n\n return (\n <verdocs-field-radio-button\n style={style}\n order={index}\n value={option.id}\n name={field.name}\n checked={option.selected}\n onFieldChange={e => this.handleFieldChange(field, e, option.id)}\n />\n );\n }\n\n isFieldValid(field: IDocumentField) {\n switch (field.type) {\n case 'textbox':\n switch (field.settings?.validator || '') {\n case 'email':\n return isValidEmail(field.settings?.result || '');\n case 'phone':\n return isValidPhone(field.settings?.result || '');\n default:\n return !!field.settings?.result;\n }\n\n case 'signature':\n case 'initial':\n case 'textarea':\n case 'date':\n case 'attachment':\n return !!field.settings?.result;\n case 'dropdown':\n return !!field.settings?.value;\n case 'checkbox_group':\n const checked = (field.settings?.options?.filter(option => option.checked) || []).length;\n return checked >= (field.settings?.minimum_checked || 0) && checked <= (field.settings?.maximum_checked || 999);\n case 'radio_button_group':\n return (field.settings?.options?.filter(option => option.selected) || []).length > 0;\n // TODO\n // case 'checkbox':\n // return <verdocs-field-checkbox style={style} value={result || ''} id={id} />;\n // case 'payment':\n // return <verdocs-field-payment style={style} field={field} id={id} />;\n default:\n return false;\n }\n }\n\n // (async () => {\n // await customElements.whenDefined('verdocs-field-signature');\n // const els = document.getElementById('verdocs-field-signature');\n // await els.focusField();\n // })();\n\n getFieldId(field: IDocumentField) {\n return `verdocs-doc-fld-${field.name}`;\n }\n\n handleNext() {\n // Find and focus the next incomplete required field\n const requiredFields = this.fields.filter(field => field.required);\n console.log('required Fields', requiredFields);\n\n const focusedIndex = requiredFields.findIndex(field => field.name === this.focusedField);\n console.log('focused Index', focusedIndex);\n\n let nextFocusedIndex = focusedIndex + 1;\n if (nextFocusedIndex >= requiredFields.length) {\n nextFocusedIndex = 0;\n }\n\n const nextRequiredField = requiredFields[nextFocusedIndex];\n console.log('next required field', nextRequiredField);\n\n if (nextRequiredField) {\n const id = this.getFieldId(nextRequiredField);\n const el = document.getElementById(id) as any;\n console.log('focusing', id, el);\n el?.focusField();\n this.focusedField = nextRequiredField.name;\n }\n }\n\n setControlStyles(el: HTMLElement, field: IDocumentField, docPage: IDocumentPageInfo) {\n const {x = 0, y = 0, width = 150, height = 50} = field.settings;\n\n el.style.width = `${width}px`;\n el.style.height = `${height}px`;\n el.style.position = 'absolute';\n el.style.left = `${rescale(docPage.xScale, x)}px`;\n el.style.bottom = `${rescale(docPage.yScale, y)}px`;\n el.style.transform = `scale(${docPage.xScale}, ${docPage.yScale})`;\n el.style.backgroundColor = field['rgba'] || getRGBA(this.recipientIndex);\n }\n\n renderField(field: IDocumentField, docPage: IDocumentPageInfo /*, index: number*/) {\n const controlsDiv = document.getElementById(docPage.containerId + '-controls');\n if (!controlsDiv) {\n return;\n }\n\n const id = this.getFieldId(field);\n\n const existingField = document.getElementById(id);\n\n if (existingField) {\n this.setControlStyles(existingField, field, docPage);\n return;\n }\n\n let el;\n switch (field.type) {\n case 'attachment':\n case 'checkbox':\n case 'date':\n case 'dropdown':\n case 'initial':\n case 'payment':\n case 'signature':\n case 'textarea':\n case 'textbox':\n el = document.createElement(`verdocs-field-${field.type}`);\n break;\n case 'checkbox_group':\n // el = document.createElement('verdocs-field-signature');\n // el.setAttribute('value', base64);\n break;\n // return field.settings.options.map((option: any, index) => this.renderCheckboxGroupOption(renderOnPage, field, option, index));\n case 'radio_button_group':\n // el = document.createElement('verdocs-field-signature');\n // el.setAttribute('value', base64);\n break;\n // return field.settings.options.map((option: any, index) => this.renderRadioGroupOption(renderOnPage, field, option, index));\n // case 'attachment':\n // el = document.createElement('verdocs-field-attachment');\n // el.setAttribute('value', result || '');\n // break;\n // case 'payment':\n // el = document.createElement('verdocs-field-payment');\n // break;\n default:\n console.log('[SIGN] Skipping unsupported field type', field);\n }\n\n if (el) {\n el.field = field;\n el.recipient = this.recipient;\n el.setAttribute('id', id);\n // el.setAttribute('required', required);\n el.addEventListener('fieldChange', e => this.handleFieldChange(field, e));\n this.setControlStyles(el, field, docPage);\n controlsDiv.appendChild(el);\n }\n }\n\n handlePageRendered(e) {\n const pageInfo = e.detail as IPageRenderEvent;\n console.log('[SIGN] Page rendered', pageInfo);\n\n const fields = this.fields.filter(field => field.page === pageInfo.renderedPage.pageNumber);\n console.log('[SIGN] Fields on page', fields);\n fields.forEach(field => this.renderField(field, pageInfo.renderedPage));\n // .map((field, index) => this.renderField(field, index));\n // this.pdfPageInfo = e.detail;\n }\n\n render() {\n const menuOptions = [\n {id: 'later', label: 'Finish Later'}, //\n {id: 'claim', label: 'Claim the Document', disabled: true},\n {id: 'decline', label: 'Decline to Sign'},\n {id: 'print', label: 'Print Without Signing'},\n {id: 'download', label: 'Download'},\n ];\n\n return (\n <Host class={{storybook: !!window?.['STORYBOOK_ENV'], agreed: this.recipient?.agreed}}>\n <div class=\"intro\">\n <div class=\"inner\">Please review and act on these documents.</div>\n </div>\n\n <div class=\"header\">\n <div class=\"inner\">\n <div class=\"toolbar\">\n <div class=\"tools\">\n <verdocs-dropdown options={menuOptions} onOptionSelected={e => this.handleOptionSelected(e)} />\n\n {!this.recipient?.agreed ? (\n <div class=\"agree\">\n <div class=\"agree-checkbox\">\n <input type=\"checkbox\" value=\"None\" id=\"agree-checkbox-element\" name=\"agree\" onChange={() => this.handleClickAgree()} />\n <label htmlFor=\"agree-checkbox-element\" />\n </div>\n <span>I agree to use electronic records and signatures.</span>\n </div>\n ) : (\n <div style={{flex: '1'}} />\n )}\n <verdocs-button size=\"small\" label={this.nextButtonLabel} disabled={!this.recipient?.agreed} onClick={() => this.handleNext()} />\n </div>\n </div>\n </div>\n </div>\n\n {!this.recipient?.agreed ? <div class=\"cover\" /> : <div style={{display: 'none'}} />}\n\n <div class=\"document\">\n {this.pdfUrl ? (\n <div class=\"inner\">\n <verdocs-view\n source={this.pdfUrl}\n endpoint={this.endpoint}\n onPageRendered={e => this.handlePageRendered(e)}\n pageLayers={[\n {name: 'page', type: 'canvas'},\n {name: 'controls', type: 'div'},\n ]}\n />\n </div>\n ) : (\n <verdocs-loader />\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|