@verdocs/web-sdk 5.0.9 → 5.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Datastore-5b860927.js → Datastore-4448f6ef.js} +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-30de2530.js → utils-746daf30.js} +1 -0
- package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-checkbox_6.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +27 -15
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +3 -2
- package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-menu-panel_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-sign.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/fields/verdocs-field-attachment/verdocs-field-attachment.js +24 -1
- package/dist/collection/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.js +24 -1
- package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.js +1 -1
- package/dist/collection/components/fields/verdocs-field-dropdown/verdocs-field-dropdown.js +24 -1
- package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js +24 -1
- package/dist/collection/components/fields/verdocs-field-payment/verdocs-field-payment.js +24 -1
- package/dist/collection/components/fields/verdocs-field-radio/verdocs-field-radio.js +24 -1
- package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js +24 -1
- package/dist/collection/components/fields/verdocs-field-textarea/verdocs-field-textarea.js +27 -3
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +28 -3
- package/dist/collection/components/fields/verdocs-field-timestamp/verdocs-field-timestamp.js +24 -1
- package/dist/collection/utils/Datastore.js +3 -3
- package/dist/collection/utils/utils.js +1 -0
- package/dist/components/{p-15b1e7a0.js → p-0689fc47.js} +2 -2
- package/dist/components/{p-ec56d92f.js → p-0ed0ac8b.js} +13 -13
- package/dist/components/{p-c9a4ef35.js → p-14c80ae8.js} +5 -3
- package/dist/components/{p-7246d2ee.js → p-176a07b2.js} +3 -3
- package/dist/components/{p-f21ef4fb.js → p-211fa3e2.js} +5 -3
- package/dist/components/{p-5df09a0d.js → p-261521bc.js} +5 -3
- package/dist/components/{p-d9074622.js → p-27548ebd.js} +1 -1
- package/dist/components/{p-ca8e3721.js → p-2ddf4d5b.js} +5 -3
- package/dist/components/{p-9c37d4b3.js → p-314d698d.js} +1 -1
- package/dist/components/{p-6506ddb4.js → p-5182136e.js} +5 -3
- package/dist/components/{p-b712e729.js → p-58d027d1.js} +3 -3
- package/dist/components/{p-e36c8c69.js → p-5e378f0e.js} +5 -3
- package/dist/components/{p-f7462b26.js → p-6c4fe42c.js} +1 -1
- package/dist/components/{p-052fcdac.js → p-7cd6c0ce.js} +1 -1
- package/dist/components/{p-005c3387.js → p-9bcf9620.js} +1 -1
- package/dist/components/{p-fca85ba0.js → p-a55f08ad.js} +14 -14
- package/dist/components/{p-eefda339.js → p-a60453aa.js} +2 -2
- package/dist/components/{p-ed4f91be.js → p-adf1586f.js} +1 -1
- package/dist/components/{p-093d51c8.js → p-af5ecc92.js} +1 -0
- package/dist/components/{p-332a97b3.js → p-b99b485b.js} +1 -1
- package/dist/components/{p-6c18617e.js → p-c1159428.js} +9 -5
- package/dist/components/{p-1a77c51b.js → p-c662e5f4.js} +3 -3
- package/dist/components/{p-60eb7451.js → p-c76fab71.js} +13 -13
- package/dist/components/{p-053a0408.js → p-d8340641.js} +5 -3
- package/dist/components/{p-b36c979b.js → p-d9a2e920.js} +8 -5
- package/dist/components/{p-5654568d.js → p-efa3b8ac.js} +1 -1
- package/dist/components/verdocs-build.js +21 -21
- package/dist/components/verdocs-contact-picker.js +1 -1
- package/dist/components/verdocs-envelope-document-page.js +1 -1
- package/dist/components/verdocs-envelope-recipient-link.js +1 -1
- package/dist/components/verdocs-envelope-recipient-summary.js +1 -1
- package/dist/components/verdocs-envelope-sidebar.js +2 -2
- package/dist/components/verdocs-envelopes-list.js +2 -2
- package/dist/components/verdocs-field-attachment.js +1 -1
- package/dist/components/verdocs-field-checkbox.js +1 -1
- package/dist/components/verdocs-field-date.js +1 -1
- package/dist/components/verdocs-field-dropdown.js +1 -1
- package/dist/components/verdocs-field-initial.js +1 -1
- package/dist/components/verdocs-field-payment.js +5 -3
- package/dist/components/verdocs-field-radio.js +1 -1
- package/dist/components/verdocs-field-signature.js +1 -1
- package/dist/components/verdocs-field-textarea.js +1 -1
- package/dist/components/verdocs-field-textbox.js +1 -1
- package/dist/components/verdocs-field-timestamp.js +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-quick-filter.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign.js +4 -4
- package/dist/components/verdocs-template-attachments.js +1 -1
- package/dist/components/verdocs-template-build-tabs.js +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-field-properties.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-template-role-properties.js +1 -1
- package/dist/components/verdocs-template-roles.js +1 -1
- package/dist/components/verdocs-templates-list.js +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/{Datastore-d29d4aeb.js → Datastore-b55570ff.js} +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-a5f5c427.js → utils-bd656c37.js} +1 -0
- package/dist/esm/verdocs-build.entry.js +1 -1
- package/dist/esm/verdocs-checkbox_6.entry.js +1 -1
- package/dist/esm/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm/verdocs-field-attachment_13.entry.js +27 -15
- package/dist/esm/verdocs-field-payment.entry.js +3 -2
- package/dist/esm/verdocs-kba-dialog_2.entry.js +2 -2
- package/dist/esm/verdocs-menu-panel_2.entry.js +1 -1
- package/dist/esm/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_6.entry.js +2 -2
- package/dist/esm/verdocs-sign.entry.js +2 -2
- package/dist/esm/verdocs-template-document-page_2.entry.js +2 -2
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/{Datastore-d29d4aeb.js → Datastore-b55570ff.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{utils-a5f5c427.js → utils-bd656c37.js} +1 -1
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-checkbox_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-menu-panel_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/fields/verdocs-field-attachment/verdocs-field-attachment.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-dropdown/verdocs-field-dropdown.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-initial/verdocs-field-initial.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-payment/verdocs-field-payment.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-radio/verdocs-field-radio.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-signature/verdocs-field-signature.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-textarea/verdocs-field-textarea.d.ts +7 -2
- package/dist/types/components/fields/verdocs-field-textbox/verdocs-field-textbox.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-timestamp/verdocs-field-timestamp.d.ts +6 -1
- package/dist/types/components.d.ts +82 -2
- package/dist/types/utils/Datastore.d.ts +3 -6
- package/dist/verdocs-web-sdk/{p-917aab58.system.entry.js → p-00ed440b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-cfed8cc1.js → p-0c45b79c.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5b0cd815.system.entry.js → p-19462841.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-42b157d2.entry.js → p-1eb501c3.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-66bf3ba8.system.entry.js → p-2b7edf3a.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-2224ca6d.entry.js → p-2d7d0805.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-fe48c408.entry.js → p-35903760.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-55de8cd1.system.js → p-35dcb386.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7e73805f.system.entry.js → p-3cc50f0b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-51c97029.entry.js → p-4a960ba5.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-660bda06.entry.js → p-553a341c.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b712e729.js → p-58d027d1.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c94b0dc5.system.entry.js → p-6b4de004.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-27da4a2b.entry.js → p-6da00869.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-a8809e33.entry.js → p-7688bc89.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c2766b5a.entry.js → p-786bacad.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-7abbdb69.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-c253ae24.system.entry.js → p-7b1e00e5.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-8bdd951b.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-5ce491ac.system.entry.js → p-8d7d61ee.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5aa76635.system.entry.js → p-9021fc7b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f40fe8d7.entry.js → p-91977069.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-95ba9c43.entry.js → p-9233595a.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-6546599d.entry.js → p-94ffe928.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-87ac8456.entry.js → p-a4b05f08.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-b0436bc7.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-899617aa.system.entry.js → p-b0fbfc24.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-62217123.system.entry.js → p-ba92b80b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c60743ac.system.entry.js → p-bbf30adc.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-f3b5052f.system.entry.js → p-e3077c5e.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b029989a.system.entry.js → p-ea078594.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-bea73364.entry.js → p-ea75f159.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-cb7aa6b8.system.entry.js → p-eb3ceb39.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-fc90cc87.entry.js → p-ef7813ed.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-736a2c41.system.js → p-f29eb00a.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-ff8143df.system.entry.js → p-fda9c437.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/verdocs-web-sdk/p-30c3f624.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-9dabaa06.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-c3f825d4.system.entry.js +0 -1
@@ -1 +1 @@
|
|
1
|
-
import{r as e,c as t,h as o,H as i,F as s,g as a}from"./p-b9654a5e.js";import{VerdocsEndpoint as r,getTemplateDocumentPageDisplayUri as d,getTemplate as l}from"@verdocs/js-sdk";import{t as c,j as n,g as p}from"./p-
|
1
|
+
import{r as e,c as t,h as o,H as i,F as s,g as a}from"./p-b9654a5e.js";import{VerdocsEndpoint as r,getTemplateDocumentPageDisplayUri as d,getTemplate as l}from"@verdocs/js-sdk";import{t as c,j as n,g as p}from"./p-0c45b79c.js";import{S as h}from"./p-58d027d1.js";import{c as b}from"./p-68a5aaff.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";import"./p-12bab948.js";const u=class{constructor(o){e(this,o),this.pageRendered=t(this,"pageRendered",7),this.templateListenerId=null,this.endpoint=r.getDefault(),this.editable=!1,this.disabled=!1,this.done=!1,this.templateId="",this.documentId="",this.pageNumber=1,this.virtualWidth=612,this.virtualHeight=792,this.layers=[{name:"page",type:"canvas"}],this.containerId=`verdocs-document-page-${Math.random().toString(36).substring(2,11)}`,this.renderedWidth=this.virtualWidth,this.renderedHeight=this.virtualHeight,this.naturalWidth=this.virtualWidth,this.naturalHeight=this.virtualHeight,this.aspectRatio=this.virtualWidth/this.virtualHeight,this.skipFirstNotification=!0,this.pageDisplayUri="",this.xScale=1,this.yScale=1,this.loading=!0,this.template=null}async componentWillLoad(){this.pageDisplayUri=await d(this.endpoint,this.documentId,this.pageNumber),this.listenToTemplate()}componentDidLoad(){this.resizeObserver=new ResizeObserver(c((e=>{for(const t of e){const e=t.contentRect.width;this.renderedWidth=e,this.renderedHeight=this.virtualHeight*(e/this.virtualWidth)}this.notifyRenderedSize()}),100)),this.resizeObserver.observe(this.container)}componentDidUpdate(){this.notifyRenderedSize()}disconnectedCallback(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),h.subscribe("templates",this.templateId,(()=>l(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(h.store.delListener(this.templateListenerId),this.templateListenerId=null)}notifyRenderedSize(){if(this.skipFirstNotification)return void(this.skipFirstNotification=!1);const e=this.renderedWidth/this.virtualWidth;this.xScale!==e&&(this.xScale=e);const t=this.renderedHeight/this.virtualHeight;this.yScale!==t&&(this.yScale=t),this.pageRendered.emit({containerId:this.containerId,documentId:this.documentId,pageNumber:this.pageNumber,virtualWidth:this.virtualWidth,virtualHeight:this.virtualHeight,renderedWidth:this.renderedWidth,renderedHeight:this.renderedHeight,naturalWidth:this.naturalWidth,naturalHeight:this.naturalHeight,aspectRatio:this.aspectRatio,xScale:e,yScale:t})}render(){if(this.loading)return o(i,null,o("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",class:"placeholder",alt:"Placeholder page"}));const e=`${this.renderedHeight}px`;return o(i,{id:`${this.containerId}`,style:{height:e,flex:`0 0 ${e}`}},this.layers.map((t=>{var i;return"div"===t.type?o("div",{class:"verdocs-template-document-page-layer",id:`${this.containerId}-${t.name}`,style:{height:e}},"controls"===t.name&&((null===(i=this.template)||void 0===i?void 0:i.fields)||[]).filter((e=>e&&e.page===this.pageNumber)).map((e=>{var t,i;const a=p(e);let{name:r,type:d,multiline:l}=e;const{xScale:c,yScale:h,templateId:b,editable:u,disabled:m,done:g,pageNumber:f}=this;switch(((null===(t=e.setting)||void 0===t?void 0:t.leading)>0||(null===(i=e.settings)||void 0===i?void 0:i.leading)>0)&&(d="textarea",l=!0),d){case"textbox":return o("verdocs-field-textbox",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,multiline:l,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});case"textarea":return o("verdocs-field-textarea",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});case"date":return o("verdocs-field-date",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});case"attachment":return o("verdocs-field-attachment",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});case"dropdown":return o("verdocs-field-dropdown",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});case"initial":return o("verdocs-field-initial",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});case"signature":return o("verdocs-field-signature",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,this.xScale,this.yScale)});case"timestamp":return o("verdocs-field-timestamp",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});case"checkbox":return o("verdocs-field-checkbox",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});case"radio":return o("verdocs-field-radio",{id:a,fieldname:r,source:"template",sourceid:b,editable:u,disabled:m,done:g,xscale:c,yscale:h,pagenumber:f,style:n(e,c,h)});default:return o(s,null,r)}}))):this.pageDisplayUri?o("img",{class:"verdocs-template-document-page-layer img",id:`${this.containerId}-${t.name}`,src:this.pageDisplayUri,alt:`Page ${this.pageNumber}`,"aria-hidden":!0,loading:"lazy",onLoad:e=>{this.naturalWidth=e.target.naturalWidth,this.naturalHeight=e.target.naturalHeight,this.aspectRatio=this.naturalWidth/this.naturalHeight,this.virtualHeight=this.virtualWidth/this.aspectRatio,this.renderedHeight=e.target.offsetWidth/this.aspectRatio}}):o("div",null)})))}get container(){return a(this)}};u.style="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-document-page{width:100%;position:relative}verdocs-template-document-page .verdocs-template-document-page-layer{position:absolute;top:0;left:0;right:0;bottom:0;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-document-page .verdocs-template-document-page-layer.img{width:100%}verdocs-template-document-page .placeholder{opacity:0.1;width:612px;height:792px;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}";const m=class{constructor(t){e(this,t),this.text="",this.icon="",this.placement="bottom",this.containerId=`verdocs-toolbar-icon-${Math.random().toString(36).substring(2,11)}`}componentDidLoad(){this.popperInstance=b(this.iconEl,this.tooltip,{placement:this.placement,modifiers:"left"===this.placement?[{name:"offset",options:{offset:[0,20]}}]:[]})}disconnectedCallback(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null)}show(){var e,t;null===(e=this.tooltip)||void 0===e||e.setAttribute("data-show",""),null===(t=this.popperInstance)||void 0===t||t.update().catch((()=>{}))}hide(){var e;null===(e=this.tooltip)||void 0===e||e.removeAttribute("data-show")}render(){return o(i,{key:"98b2f6b2a2711df2cf8e687e38684d495b6e7d50",class:{}},o("div",{key:"49500d4d3348e2ccd6c9cbe7867645756c6cf5ef","aria-describedby":this.containerId,class:"icon",innerHTML:this.icon,onMouseEnter:()=>this.show(),onFocus:()=>this.show(),onMouseLeave:()=>this.hide(),onBlur:()=>this.hide(),ref:e=>this.iconEl=e}),o("div",{key:"e64aa823a8a09b10a9166f96be633439d959d3ff",id:this.containerId,role:"tooltip",class:"tooltip","data-popper-placement":this.placement,ref:e=>this.tooltip=e},this.text,o("div",{key:"399156e882824870173ecf3e4bcc35f2ba720b8c","data-popper-arrow":"true",class:"arrow"})))}};m.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-toolbar-icon{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:inline-block}verdocs-toolbar-icon .icon{display:inline-block;cursor:pointer}verdocs-toolbar-icon .icon svg{fill:#5c6575}verdocs-toolbar-icon .tooltip{display:none;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;background:#ffffff;color:#33364b;max-width:240px;font-weight:bold;padding:5px 10px;font-size:13px;position:relative;border-radius:4px;z-index:20000;white-space:nowrap}verdocs-toolbar-icon .tooltip .arrow,verdocs-toolbar-icon .tooltip .arrow::before{position:absolute;width:8px;height:8px;background:inherit}verdocs-toolbar-icon .tooltip .arrow{visibility:hidden;top:-4px}verdocs-toolbar-icon .tooltip .arrow::before{visibility:visible;content:"";-webkit-transform:rotate(45deg);transform:rotate(45deg)}verdocs-toolbar-icon .tooltip[data-show]{display:block}verdocs-toolbar-icon .tooltip[data-popper-placement^=top]>.arrow{bottom:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=bottom]>.arrow{top:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]>.arrow{right:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=right]>.arrow{left:-4px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]{padding:3px 10px}verdocs-toolbar-icon .tooltip[data-popper-placement^=left]>.arrow{right:-1px}';export{u as verdocs_template_document_page,m as verdocs_toolbar_icon}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,c as i,h as t,H as s,F as o}from"./p-b9654a5e.js";import{VerdocsEndpoint as n,startSigningSession as a,getKbaStep as l,envelopeRecipientAgree as r,envelopeRecipientDecline as d,updateEnvelopeField as c,createSignature as h,updateEnvelopeFieldSignature as p,createInitials as g,updateEnvelopeFieldInitials as u,isValidPhone as v,isValidEmail as m,sortFields as x,envelopeRecipientSubmit as b,getEnvelope as f,uploadEnvelopeFieldAttachment as y,deleteEnvelopeFieldAttachment as w,formatFullName as k,fullNameToInitials as S,submitKbaPin as N,submitKbaIdentity as I,submitKbaChallengeResponse as G,integerSequence as P}from"@verdocs/js-sdk";import{a as z,u as F,r as E,g as A}from"./p-cfed8cc1.js";import{V as D}from"./p-04c07b7b.js";import{S as U}from"./p-fd97809c.js";import{S as V}from"./p-b712e729.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";import"./p-12bab948.js";const L=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}],T=[{id:"print",label:"Print"},{id:"download",label:"Download"}],j=class{constructor(t){e(this,t),this.sdkError=i(this,"sdkError",7),this.envelopeLoaded=i(this,"envelopeLoaded",7),this.envelopeUpdated=i(this,"envelopeUpdated",7),this.recipientIndex=-1,this.endpoint=null,this.envelopeId=null,this.roleId=null,this.inviteCode=null,this.headerTargetId=null,this.roleNames=[],this.sortedRecipients=[],this.recipient=null,this.hasSignature=!1,this.nextButtonLabel="Start",this.nextSubmits=!1,this.fatalErrorHeader="",this.fatalErrorMessage="",this.focusedField="",this.submitting=!1,this.submitted=!1,this.isDone=!1,this.showDone=!1,this.showLoadError=!1,this.finishLater=!1,this.showFinishLater=!1,this.agreed=!1,this.documentsSingularPlural="document",this.kbaStep="",this.kbaQuestions=[],this.showSpinner=!1,this.kbaChoices=[],this.loading=!0,this.envelope=null}componentWillLoad(){this.endpoint||(console.log("[SIGN] Creating signing endpoint"),this.endpoint=new n({sessionType:"signing"}))}async componentDidLoad(){var e,i,t,s,o,n,r;if(this.envelopeId)if(this.roleId)if(this.inviteCode)try{console.log(`[SIGN] Processing invite code for ${this.envelopeId} / ${this.roleId}`);const{envelope:e,recipient:i}=await a(this.endpoint,this.envelopeId,this.roleId,this.inviteCode);console.log("[SIGN] Loaded signing session",e,i),this.recipient=i,this.envelope=e,V.updateEnvelope(this.envelopeId,e),this.sortedRecipients=[...this.envelope.recipients],this.sortedRecipients.sort(((e,i)=>e.sequence===i.sequence?e.order-i.order:e.sequence-i.sequence)),this.roleNames=this.sortedRecipients.map((e=>e.role_name)),this.envelope.documents.length>0&&(this.documentsSingularPlural="document(s)"),this.recipientIndex=this.roleNames.findIndex((e=>e==this.roleId)),this.recipientIndex>-1?(this.recipient=this.sortedRecipients[this.recipientIndex],this.agreed=this.recipient.agreed):console.warn("[SIGN] Could not find our recipient record",this.roleId,this.sortedRecipients),this.submitted="submitted"===this.recipient.status,this.isDone=this.submitted,this.showDone=this.submitted,"canceled"===this.envelope.status?(this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="This envelope has been canceled. Please contact its sender for more information."):"declined"===this.recipient.status?(this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="You have declined to sign this envelope."):this.agreed&&(this.nextButtonLabel="Next"),this.checkRecipientFields(),null===(s=this.envelopeLoaded)||void 0===s||s.emit({endpoint:this.endpoint,envelope:this.envelope}),this.isDone||l(this.endpoint,this.envelopeId,this.roleId).then((e=>{var i;console.log("[SIGN] KBA Step",e),this.kbaStep=e.kba_step,"failed"===this.kbaStep?(this.fatalErrorHeader="Identity Verification Failed",this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.",this.isDone=!0):(this.kbaQuestions=(null===(i=e.questions)||void 0===i?void 0:i.question)||[],this.kbaChoices=[])})).catch((e=>console.log("Error getting KBA step",e)))}catch(e){console.log("[SIGN] Error with signing session",e),null===(o=this.sdkError)||void 0===o||o.emit(new U(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(r=e.response)||void 0===r?void 0:r.data)),this.showLoadError=!0}else null===(t=this.sdkError)||void 0===t||t.emit(new U("[SIGN] Missing required inviteCode",500,""));else null===(i=this.sdkError)||void 0===i||i.emit(new U("[SIGN] Missing required roleId",500,""));else null===(e=this.sdkError)||void 0===e||e.emit(new U("[SIGN] Missing required envelopId",500,""))}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null,i=document.getElementById("verdocs-sign-header");e&&i&&(console.log("[SIGN] Moving header"),i.remove(),e.append(i))}handleClickAgree(){this.submitting=!0,r(this.endpoint,this.envelopeId,this.roleId,!0).then((()=>{var e;this.nextButtonLabel="Next",this.recipient.agreed=!0,this.submitting=!1,this.agreed=!0,null===(e=this.envelopeUpdated)||void 0===e||e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"agreed"})})).catch((e=>{var i,t,s;console.log("[SIGN] Update failure",e),this.submitting=!1,null===(i=this.sdkError)||void 0===i||i.emit(new U(e.message,null===(t=e.response)||void 0===t?void 0:t.status,null===(s=e.response)||void 0===s?void 0:s.data))}))}async handleOptionSelected(e){var i,t,s,o,n;switch(e.detail.id){case"later":this.finishLater=!0,this.showFinishLater=!0,null===(i=this.envelopeUpdated)||void 0===i||i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});break;case"claim":D("This feature will be available in an upcoming release."),null===(t=this.envelopeUpdated)||void 0===t||t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});break;case"decline":{this.submitting=!0;const e=await d(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Decline result",e),null===(s=this.envelopeUpdated)||void 0===s||s.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"}),this.submitting=!1,this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="You have declined to sign this envelope."}break;case"print":window.print(),null===(o=this.envelopeUpdated)||void 0===o||o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":{const e=this.envelope.documents.find((e=>"attachment"===e.type));e&&(z(this.endpoint,this.envelope,e.id).catch((e=>{console.log("[SIGN] Error downloading PDF",e)})),null===(n=this.envelopeUpdated)||void 0===n||n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"}))}}}updateRecipientFieldValue(e,i){console.log("[SIGN] updateRecipientFieldValue",e),this.getRecipientFields().forEach((t=>{t.name===e&&(t.value=i.value,t.settings=i.settings,F(t),this.checkRecipientFields())}))}saveFieldChange(e,i){console.log("[SIGN] updateRecipientFieldValue",e),c(this.endpoint,this.envelopeId,e,i).then((i=>this.updateRecipientFieldValue(e,i))).catch((e=>{var i,t,s,o,n,a;401===(null===(i=e.response)||void 0===i?void 0:i.status)&&"jwt expired"===(null===(s=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.error)?(console.log("[SIGN] Signing session expired"),this.fatalErrorHeader="Signing Session Expired",this.fatalErrorMessage="Please reload your browser to continue."):console.log("[SIGN] Server error",e),null===(o=this.sdkError)||void 0===o||o.emit(new U(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(a=e.response)||void 0===a?void 0:a.data))}))}async handleFieldChange(e,i){const{value:t,checked:s}=i.target;switch(e.type){case"textarea":case"textbox":return this.saveFieldChange(e.name,{prepared:!1,value:t});case"checkbox":case"radio":return this.saveFieldChange(e.name,{prepared:!1,value:String(i.target.checked)});case"dropdown":return console.log("Saving dropdown",e.name,i.detail),this.saveFieldChange(e.name,{prepared:!1,value:i.detail});case"initial":if(!i.detail)return;this.showSpinner=!0;const o=await(await fetch(i.detail)).blob();return g(this.endpoint,"initial",o).then((async i=>{const t=await u(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t),this.showSpinner=!1})).catch((e=>{console.log("Error updating initials",e),this.showSpinner=!1}));case"signature":if(!i.detail)return;this.showSpinner=!0;const n=await(await fetch(i.detail)).blob();return h(this.endpoint,"signature",n).then((async i=>{console.log("Signature update result",i);const t=await p(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t),this.showSpinner=!1})).catch((e=>{console.warn("[SIGN] Error updating signature",e),this.showSpinner=!1}));case"date":const{formattedDate:a}=i.detail;if(a)return this.saveFieldChange(e.name,{prepared:!1,value:a});break;case"timestamp":console.log("[SIGN] Updating timestamp",{value:t,ts:i.target.getAttribute("timestamp")});break;default:console.log("[SIGN] Unhandled field update",{value:t,checked:s},e)}}isFieldFilled(e){const{value:i=""}=e;switch(e.type){case"textarea":case"textbox":switch(e.validator||""){case"email":return m(i);case"phone":return v(i);default:return""!==(i||"").trim()}case"signature":return"signed"===i;case"initial":return"initialed"===i;case"timestamp":return!0;case"date":return!!i;case"attachment":return"attached"===i;case"dropdown":return""!==i;case"checkbox":return"true"===i;case"radio":return e.group?this.getRecipientFields().filter((i=>i.group===e.group)).some((e=>"true"===e.value)):"true"===e.value;default:return!1}}isFieldValid(e){return!e.required||this.isFieldFilled(e)}getSortedFillableFields(){const e=this.getRecipientFields().filter((e=>"timestamp"!==e.type));return x(e),e}async handleNext(){var e;if(this.nextSubmits){try{null===(e=document.getElementById("air-datepicker-global-container"))||void 0===e||e.remove(),this.submitting=!0;const i=await b(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Submitted successfully",i),this.recipient.status="submitted",this.showDone=!0,console.log("[SIGN] Reloading envelope"),f(this.endpoint,this.envelopeId).then((e=>{this.envelope=e,this.submitting=!1})).catch((e=>{console.log("[SIGN] Error reloading envelope",e),this.submitting=!1}))}catch(e){console.log("[SIGN] Error submitting",e)}return}const i=this.getSortedFillableFields().filter((e=>e.required&&!this.isFieldFilled(e)));x(i);let t=i.findIndex((e=>e.name===this.focusedField))+1;t>=i.length&&(t=0);let s=i[t],o=0;if(o<i.length&&["signature","initial"].includes(s.type)&&["initialed","signed"].includes(s.value)&&(o++,t++,t>=i.length&&(t=0),s=i[t]),o>=i.length&&(s=null),s){const e=A(s),i=document.getElementById(e);null==i||i.scrollIntoView({behavior:"smooth"}),null==i||i.focusField(),this.focusedField=s.name}}getRecipientFields(){return this.envelope.fields.filter((e=>e.role_name===this.recipient.role_name))}checkRecipientFields(){const e=this.getRecipientFields().filter((e=>!this.isFieldValid(e)));e.length<1?(this.nextButtonLabel="Finish",this.nextSubmits||(this.nextSubmits=!0)):(console.log("[SIGN] Invalid fields remaining",e.map((e=>e.name))),this.nextButtonLabel="Next",this.nextSubmits=!1)}attachFieldAttributes(e,i,t){if("1"===t.getAttribute("attached"))return;t.setAttribute("attached","1"),t.addEventListener("input",(e=>{"radio"===e.target.type||"checkbox"===e.target.type?this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields())):this.checkRecipientFields()})),t.addEventListener("attached",(async t=>{console.log("[SIGN] onAttached",t.detail,t.target.value),this.showSpinner=!0;try{const s=await y(this.endpoint,this.envelopeId,i.name,t.detail);this.updateRecipientFieldValue(i.name,s),this.checkRecipientFields();const o=E("envelope",i,e,{disabled:!1,editable:!1,draggable:!1,done:this.isDone});this.attachFieldAttributes(e,i,o),this.showSpinner=!1}catch(t){console.log("Error uploading attachment",t),D("Unable to upload attachment, please try again later",{style:"error"}),this.showSpinner=!1}})),t.addEventListener("deleted",(async t=>{console.log("[SIGN] onDeleted",t.detail,t.target.value),this.showSpinner=!0;try{const t=await w(this.endpoint,this.envelopeId,i.name);console.log("[SIGN] Deleted attachment",t),this.updateRecipientFieldValue(i.name,t),this.checkRecipientFields();const s=E("envelope",i,e,{disabled:!1,editable:!1,draggable:!1,done:this.isDone});this.attachFieldAttributes(e,i,s),this.showSpinner=!1}catch(t){console.log("Error uploading attachment",t),D("Unable to upload attachment, please try again later",{style:"error"}),this.showSpinner=!1}})),t.addEventListener("focusout",(e=>{"dropdown"!==i.type&&"attachment"!==i.type&&this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))})),t.addEventListener("fieldChange",(e=>{this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))})),t.setAttribute("templateid",this.envelope.template_id),t.setAttribute("fieldname",i.name),t.setAttribute("page",e.pageNumber),t.setAttribute("xScale",e.xScale),t.setAttribute("yScale",e.yScale);const s=k(this.recipient);t.setAttribute("initials",S(s)),t.setAttribute("name",s)}handlePageRendered(e){const i=e.detail,t=this.getSortedFillableFields();console.log("[SIGN] Rendering fields for page",i.pageNumber,t),t.forEach(((e,t)=>{if(e.page!==i.pageNumber)return;const s=E("envelope",e,i,{disabled:!1,editable:!1,draggable:!1,done:this.isDone},t);s&&(Array.isArray(s)?s.map((t=>this.attachFieldAttributes(i,e,t))):this.attachFieldAttributes(i,e,s))})),this.sortedRecipients.filter((e=>e.role_name!==this.recipient.role_name&&("invited"===e.status||"opened"===e.status||"pending"===e.status))).forEach((()=>{this.getRecipientFields().filter((e=>e.page===i.pageNumber)).forEach((e=>{const t=E("envelope",e,i,{disabled:!0,editable:!1,draggable:!1,done:this.isDone});t&&(Array.isArray(t)?t.map((t=>this.attachFieldAttributes(i,e,t))):this.attachFieldAttributes(i,e,t))}))})),this.checkRecipientFields()}render(){if(this.showLoadError)return t(s,null,t("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:()=>{window.location.reload()}}));if(!this.envelope)return t(s,null,t("verdocs-loader",null));if(this.fatalErrorMessage)return t(s,{class:{agreed:this.agreed}},t("div",{class:"fatal-error"},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",class:"placeholder",alt:"Placeholder page"}),t("div",{class:"message"},t("div",{class:"header"},this.fatalErrorHeader),t("p",null,this.fatalErrorMessage))));if(this.isDone)return t(s,{class:{agreed:this.agreed}},t("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:e=>{var i;return null===(i=this.sdkError)||void 0===i?void 0:i.emit(e.detail)}}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:`You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`,onNext:e=>{e.preventDefault(),e.stopPropagation(),this.showDone=!1,this.isDone=!0}}),this.submitting&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)));if(!this.agreed)return t(s,{class:"agreed"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"agree"},t("verdocs-checkbox",{name:"agree",label:"By checking this box, you:",onInput:()=>this.handleClickAgree()}),t("ul",null,t("li",null,"Agree to use electronic records and signatures, and confirm you have read the"," ",t("a",{href:"https://verdocs.com/en/electronic-record-signature-disclosure/",target:"_blank"},"Electronic Record and Signatures Disclosure"),"."),t("li",null,"Agree to Verdocs'"," ",t("a",{href:"https://verdocs.com/en/eula",target:"_blank"},"End User License Agreement")," ","and confirm you have read Verdocs'"," ",t("a",{href:"https://verdocs.com/en/privacy-policy/",target:"_blank"},"Privacy Policy"),".")))));if("pin"===this.kbaStep)return t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},t("verdocs-kba-dialog",{mode:"text",step:1,steps:1,helptitle:"Document is protected by a PIN code",helptext:"Please enter your PIN code to proceed. If you do not have one, please contact the sender.",label:"PIN Code",onNext:async e=>{N(this.endpoint,this.envelopeId,this.roleId,e.detail).then((e=>{console.log("[SIGN] PIN code submission result",e),"complete"===e.kba_step&&(this.kbaStep="")})).catch((e=>{var i,t;console.log("[SIGN] Error submitting PIN",e),D((null===(t=null===(i=e.response)||void 0===i?void 0:i.data)||void 0===t?void 0:t.error)||"Unable to verify PIN code. Please try again.",{style:"error"})}))}}))));if("identity"===this.kbaStep)return t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},t("verdocs-kba-dialog",{mode:"identity",helptitle:"Document requires identity verification",helptext:"Please complete your contact details to proceed.",recipient:this.recipient,onNext:async e=>{const i=e.detail;I(this.endpoint,this.envelopeId,this.roleId,{firstName:i.first_name,lastName:i.last_name,address:i.address,city:i.city,state:i.state,zip:i.zip,ssnLast4:i.ssn_last_4}).then((e=>{console.log("[SIGN] Identity submission result",e),this.kbaStep=e.kba_step})).catch((e=>{var i,t;console.log("[SIGN] Error submitting identity",e),D((null===(t=null===(i=e.response)||void 0===i?void 0:i.data)||void 0===t?void 0:t.error)||"Unable to verify identity.",{style:"error"})}))}}))));if("challenge"===this.kbaStep){const e=this.kbaChoices.length,i=this.kbaQuestions[e];return console.log("Showing KBA question",{questionNumber:e,kbaQuestion:i},this.kbaChoices),t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},this.kbaChoices.length>=this.kbaQuestions.length?t("verdocs-spinner",null):t("verdocs-kba-dialog",{mode:"choice",helptitle:"Your identity requires additional verification",helptext:(null==i?void 0:i.prompt)||"Please select one of the options below.",choices:(null==i?void 0:i.answer)||["Skip Question"],step:e+1,steps:this.kbaQuestions.length,onNext:async e=>{var i,t,s;if(this.kbaChoices=[...this.kbaChoices,e.detail],this.kbaChoices.length>=this.kbaQuestions.length){const o=this.kbaQuestions.map(((e,i)=>({type:e.type,answer:this.kbaChoices[i]})));console.log("Submitting KBA responses",this.kbaChoices,o);try{const e=await G(this.endpoint,this.envelopeId,this.roleId,o);console.log("KBA challenge response",e),this.kbaStep=e.kba_step,"failed"===this.kbaStep?(this.fatalErrorHeader="Identity Verification Failed",this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.",this.isDone=!0):(this.kbaQuestions=(null===(i=e.questions)||void 0===i?void 0:i.question)||[],this.kbaChoices=[])}catch(e){console.log("Error submitting KBA challenge",e),this.kbaStep="",this.fatalErrorHeader="Unable to Verify Identity",this.fatalErrorMessage=(null===(s=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.error)||"Please try again later.",this.isDone=!0}}}}))))}return t(s,null,t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name),t("div",{style:{flex:"1"}}),!this.finishLater&&t("verdocs-button",{size:"xsmall",label:this.nextButtonLabel,disabled:!this.agreed,onClick:()=>this.handleNext()}),t("div",{style:{marginLeft:"10px"}}),t("verdocs-dropdown",{options:this.isDone||this.finishLater?T:L,onOptionSelected:e=>this.handleOptionSelected(e)}))),t("div",{class:"document",style:{paddingTop:"15px"}},(this.envelope.documents||[]).map((e=>{const i=P(1,e.pages);return t(o,null,i.map((i=>{var s;const o=(null===(s=e.page_sizes)||void 0===s?void 0:s[i])||{width:612,height:792};return t("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,virtualWidth:o.width,virtualHeight:o.height,pageNumber:i,onPageRendered:e=>this.handlePageRendered(e),type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&t("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:`To complete the ${this.documentsSingularPlural}, use the link in the original email notification inviting you to review and finish the document.`,onNext:()=>this.showFinishLater=!1}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:`You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`,onNext:()=>{this.showDone=!1,this.isDone=!0}}),this.submitting||this.showSpinner&&t("verdocs-portal",null,t("div",{class:"spinner-overlay"},t("verdocs-spinner",null))))}};j.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign .agree{-ms-flex:0;flex:0;width:600px;display:-ms-flexbox;display:flex;max-width:90%;padding:30px 15px;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree li{margin:0.5em 0}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);margin-top:15px}verdocs-sign .fatal-error .message{width:50%;font-size:16px;background:white;border-radius:5px;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#654dcb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 46px;flex:0 0 46px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 12px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}.spinner-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background:rgba(0, 0, 0, 0.4980392157);-ms-flex-pack:center;justify-content:center}';export{j as verdocs_sign}
|
1
|
+
import{r as e,c as i,h as t,H as s,F as o}from"./p-b9654a5e.js";import{VerdocsEndpoint as n,startSigningSession as a,getKbaStep as l,envelopeRecipientAgree as r,envelopeRecipientDecline as d,updateEnvelopeField as c,createSignature as h,updateEnvelopeFieldSignature as p,createInitials as g,updateEnvelopeFieldInitials as u,isValidPhone as v,isValidEmail as m,sortFields as x,envelopeRecipientSubmit as b,getEnvelope as f,uploadEnvelopeFieldAttachment as y,deleteEnvelopeFieldAttachment as w,formatFullName as k,fullNameToInitials as S,submitKbaPin as N,submitKbaIdentity as I,submitKbaChallengeResponse as G,integerSequence as P}from"@verdocs/js-sdk";import{a as z,u as F,r as E,g as A}from"./p-0c45b79c.js";import{V as D}from"./p-04c07b7b.js";import{S as U}from"./p-fd97809c.js";import{S as V}from"./p-58d027d1.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";import"./p-12bab948.js";const L=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}],T=[{id:"print",label:"Print"},{id:"download",label:"Download"}],j=class{constructor(t){e(this,t),this.sdkError=i(this,"sdkError",7),this.envelopeLoaded=i(this,"envelopeLoaded",7),this.envelopeUpdated=i(this,"envelopeUpdated",7),this.recipientIndex=-1,this.endpoint=null,this.envelopeId=null,this.roleId=null,this.inviteCode=null,this.headerTargetId=null,this.roleNames=[],this.sortedRecipients=[],this.recipient=null,this.hasSignature=!1,this.nextButtonLabel="Start",this.nextSubmits=!1,this.fatalErrorHeader="",this.fatalErrorMessage="",this.focusedField="",this.submitting=!1,this.submitted=!1,this.isDone=!1,this.showDone=!1,this.showLoadError=!1,this.finishLater=!1,this.showFinishLater=!1,this.agreed=!1,this.documentsSingularPlural="document",this.kbaStep="",this.kbaQuestions=[],this.showSpinner=!1,this.kbaChoices=[],this.loading=!0,this.envelope=null}componentWillLoad(){this.endpoint||(console.log("[SIGN] Creating signing endpoint"),this.endpoint=new n({sessionType:"signing"}))}async componentDidLoad(){var e,i,t,s,o,n,r;if(this.envelopeId)if(this.roleId)if(this.inviteCode)try{console.log(`[SIGN] Processing invite code for ${this.envelopeId} / ${this.roleId}`);const{envelope:e,recipient:i}=await a(this.endpoint,this.envelopeId,this.roleId,this.inviteCode);console.log("[SIGN] Loaded signing session",e,i),this.recipient=i,this.envelope=e,V.updateEnvelope(this.envelopeId,e),this.sortedRecipients=[...this.envelope.recipients],this.sortedRecipients.sort(((e,i)=>e.sequence===i.sequence?e.order-i.order:e.sequence-i.sequence)),this.roleNames=this.sortedRecipients.map((e=>e.role_name)),this.envelope.documents.length>0&&(this.documentsSingularPlural="document(s)"),this.recipientIndex=this.roleNames.findIndex((e=>e==this.roleId)),this.recipientIndex>-1?(this.recipient=this.sortedRecipients[this.recipientIndex],this.agreed=this.recipient.agreed):console.warn("[SIGN] Could not find our recipient record",this.roleId,this.sortedRecipients),this.submitted="submitted"===this.recipient.status,this.isDone=this.submitted,this.showDone=this.submitted,"canceled"===this.envelope.status?(this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="This envelope has been canceled. Please contact its sender for more information."):"declined"===this.recipient.status?(this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="You have declined to sign this envelope."):this.agreed&&(this.nextButtonLabel="Next"),this.checkRecipientFields(),null===(s=this.envelopeLoaded)||void 0===s||s.emit({endpoint:this.endpoint,envelope:this.envelope}),this.isDone||l(this.endpoint,this.envelopeId,this.roleId).then((e=>{var i;console.log("[SIGN] KBA Step",e),this.kbaStep=e.kba_step,"failed"===this.kbaStep?(this.fatalErrorHeader="Identity Verification Failed",this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.",this.isDone=!0):(this.kbaQuestions=(null===(i=e.questions)||void 0===i?void 0:i.question)||[],this.kbaChoices=[])})).catch((e=>console.log("Error getting KBA step",e)))}catch(e){console.log("[SIGN] Error with signing session",e),null===(o=this.sdkError)||void 0===o||o.emit(new U(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(r=e.response)||void 0===r?void 0:r.data)),this.showLoadError=!0}else null===(t=this.sdkError)||void 0===t||t.emit(new U("[SIGN] Missing required inviteCode",500,""));else null===(i=this.sdkError)||void 0===i||i.emit(new U("[SIGN] Missing required roleId",500,""));else null===(e=this.sdkError)||void 0===e||e.emit(new U("[SIGN] Missing required envelopId",500,""))}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null,i=document.getElementById("verdocs-sign-header");e&&i&&(console.log("[SIGN] Moving header"),i.remove(),e.append(i))}handleClickAgree(){this.submitting=!0,r(this.endpoint,this.envelopeId,this.roleId,!0).then((()=>{var e;this.nextButtonLabel="Next",this.recipient.agreed=!0,this.submitting=!1,this.agreed=!0,null===(e=this.envelopeUpdated)||void 0===e||e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"agreed"})})).catch((e=>{var i,t,s;console.log("[SIGN] Update failure",e),this.submitting=!1,null===(i=this.sdkError)||void 0===i||i.emit(new U(e.message,null===(t=e.response)||void 0===t?void 0:t.status,null===(s=e.response)||void 0===s?void 0:s.data))}))}async handleOptionSelected(e){var i,t,s,o,n;switch(e.detail.id){case"later":this.finishLater=!0,this.showFinishLater=!0,null===(i=this.envelopeUpdated)||void 0===i||i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});break;case"claim":D("This feature will be available in an upcoming release."),null===(t=this.envelopeUpdated)||void 0===t||t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});break;case"decline":{this.submitting=!0;const e=await d(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Decline result",e),null===(s=this.envelopeUpdated)||void 0===s||s.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"}),this.submitting=!1,this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="You have declined to sign this envelope."}break;case"print":window.print(),null===(o=this.envelopeUpdated)||void 0===o||o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":{const e=this.envelope.documents.find((e=>"attachment"===e.type));e&&(z(this.endpoint,this.envelope,e.id).catch((e=>{console.log("[SIGN] Error downloading PDF",e)})),null===(n=this.envelopeUpdated)||void 0===n||n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"}))}}}updateRecipientFieldValue(e,i){console.log("[SIGN] updateRecipientFieldValue",e),this.getRecipientFields().forEach((t=>{t.name===e&&(t.value=i.value,t.settings=i.settings,F(t),this.checkRecipientFields())}))}saveFieldChange(e,i){console.log("[SIGN] updateRecipientFieldValue",e),c(this.endpoint,this.envelopeId,e,i).then((i=>this.updateRecipientFieldValue(e,i))).catch((e=>{var i,t,s,o,n,a;401===(null===(i=e.response)||void 0===i?void 0:i.status)&&"jwt expired"===(null===(s=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.error)?(console.log("[SIGN] Signing session expired"),this.fatalErrorHeader="Signing Session Expired",this.fatalErrorMessage="Please reload your browser to continue."):console.log("[SIGN] Server error",e),null===(o=this.sdkError)||void 0===o||o.emit(new U(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(a=e.response)||void 0===a?void 0:a.data))}))}async handleFieldChange(e,i){const{value:t,checked:s}=i.target;switch(e.type){case"textarea":case"textbox":return this.saveFieldChange(e.name,{prepared:!1,value:t});case"checkbox":case"radio":return this.saveFieldChange(e.name,{prepared:!1,value:String(i.target.checked)});case"dropdown":return console.log("Saving dropdown",e.name,i.detail),this.saveFieldChange(e.name,{prepared:!1,value:i.detail});case"initial":if(!i.detail)return;this.showSpinner=!0;const o=await(await fetch(i.detail)).blob();return g(this.endpoint,"initial",o).then((async i=>{const t=await u(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t),this.showSpinner=!1})).catch((e=>{console.log("Error updating initials",e),this.showSpinner=!1}));case"signature":if(!i.detail)return;this.showSpinner=!0;const n=await(await fetch(i.detail)).blob();return h(this.endpoint,"signature",n).then((async i=>{console.log("Signature update result",i);const t=await p(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t),this.showSpinner=!1})).catch((e=>{console.warn("[SIGN] Error updating signature",e),this.showSpinner=!1}));case"date":const{formattedDate:a}=i.detail;if(a)return this.saveFieldChange(e.name,{prepared:!1,value:a});break;case"timestamp":console.log("[SIGN] Updating timestamp",{value:t,ts:i.target.getAttribute("timestamp")});break;default:console.log("[SIGN] Unhandled field update",{value:t,checked:s},e)}}isFieldFilled(e){const{value:i=""}=e;switch(e.type){case"textarea":case"textbox":switch(e.validator||""){case"email":return m(i);case"phone":return v(i);default:return""!==(i||"").trim()}case"signature":return"signed"===i;case"initial":return"initialed"===i;case"timestamp":return!0;case"date":return!!i;case"attachment":return"attached"===i;case"dropdown":return""!==i;case"checkbox":return"true"===i;case"radio":return e.group?this.getRecipientFields().filter((i=>i.group===e.group)).some((e=>"true"===e.value)):"true"===e.value;default:return!1}}isFieldValid(e){return!e.required||this.isFieldFilled(e)}getSortedFillableFields(){const e=this.getRecipientFields().filter((e=>"timestamp"!==e.type));return x(e),e}async handleNext(){var e;if(this.nextSubmits){try{null===(e=document.getElementById("air-datepicker-global-container"))||void 0===e||e.remove(),this.submitting=!0;const i=await b(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Submitted successfully",i),this.recipient.status="submitted",this.showDone=!0,console.log("[SIGN] Reloading envelope"),f(this.endpoint,this.envelopeId).then((e=>{this.envelope=e,this.submitting=!1})).catch((e=>{console.log("[SIGN] Error reloading envelope",e),this.submitting=!1}))}catch(e){console.log("[SIGN] Error submitting",e)}return}const i=this.getSortedFillableFields().filter((e=>e.required&&!this.isFieldFilled(e)));x(i);let t=i.findIndex((e=>e.name===this.focusedField))+1;t>=i.length&&(t=0);let s=i[t],o=0;if(o<i.length&&["signature","initial"].includes(s.type)&&["initialed","signed"].includes(s.value)&&(o++,t++,t>=i.length&&(t=0),s=i[t]),o>=i.length&&(s=null),s){const e=A(s),i=document.getElementById(e);null==i||i.scrollIntoView({behavior:"smooth"}),null==i||i.focusField(),this.focusedField=s.name}}getRecipientFields(){return this.envelope.fields.filter((e=>e.role_name===this.recipient.role_name))}checkRecipientFields(){const e=this.getRecipientFields().filter((e=>!this.isFieldValid(e)));e.length<1?(this.nextButtonLabel="Finish",this.nextSubmits||(this.nextSubmits=!0)):(console.log("[SIGN] Invalid fields remaining",e.map((e=>e.name))),this.nextButtonLabel="Next",this.nextSubmits=!1)}attachFieldAttributes(e,i,t){if("1"===t.getAttribute("attached"))return;t.setAttribute("attached","1"),t.addEventListener("input",(e=>{"radio"===e.target.type||"checkbox"===e.target.type?this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields())):this.checkRecipientFields()})),t.addEventListener("attached",(async t=>{console.log("[SIGN] onAttached",t.detail,t.target.value),this.showSpinner=!0;try{const s=await y(this.endpoint,this.envelopeId,i.name,t.detail);this.updateRecipientFieldValue(i.name,s),this.checkRecipientFields();const o=E("envelope",i,e,{disabled:!1,editable:!1,draggable:!1,done:this.isDone});this.attachFieldAttributes(e,i,o),this.showSpinner=!1}catch(t){console.log("Error uploading attachment",t),D("Unable to upload attachment, please try again later",{style:"error"}),this.showSpinner=!1}})),t.addEventListener("deleted",(async t=>{console.log("[SIGN] onDeleted",t.detail,t.target.value),this.showSpinner=!0;try{const t=await w(this.endpoint,this.envelopeId,i.name);console.log("[SIGN] Deleted attachment",t),this.updateRecipientFieldValue(i.name,t),this.checkRecipientFields();const s=E("envelope",i,e,{disabled:!1,editable:!1,draggable:!1,done:this.isDone});this.attachFieldAttributes(e,i,s),this.showSpinner=!1}catch(t){console.log("Error uploading attachment",t),D("Unable to upload attachment, please try again later",{style:"error"}),this.showSpinner=!1}})),t.addEventListener("focusout",(e=>{"dropdown"!==i.type&&"attachment"!==i.type&&this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))})),t.addEventListener("fieldChange",(e=>{this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))})),t.setAttribute("templateid",this.envelope.template_id),t.setAttribute("fieldname",i.name),t.setAttribute("page",e.pageNumber),t.setAttribute("xScale",e.xScale),t.setAttribute("yScale",e.yScale);const s=k(this.recipient);t.setAttribute("initials",S(s)),t.setAttribute("name",s)}handlePageRendered(e){const i=e.detail,t=this.getSortedFillableFields();console.log("[SIGN] Rendering fields for page",i.pageNumber,t),t.forEach(((e,t)=>{if(e.page!==i.pageNumber)return;const s=E("envelope",e,i,{disabled:!1,editable:!1,draggable:!1,done:this.isDone},t);s&&(Array.isArray(s)?s.map((t=>this.attachFieldAttributes(i,e,t))):this.attachFieldAttributes(i,e,s))})),this.sortedRecipients.filter((e=>e.role_name!==this.recipient.role_name&&("invited"===e.status||"opened"===e.status||"pending"===e.status))).forEach((()=>{this.getRecipientFields().filter((e=>e.page===i.pageNumber)).forEach((e=>{const t=E("envelope",e,i,{disabled:!0,editable:!1,draggable:!1,done:this.isDone});t&&(Array.isArray(t)?t.map((t=>this.attachFieldAttributes(i,e,t))):this.attachFieldAttributes(i,e,t))}))})),this.checkRecipientFields()}render(){if(this.showLoadError)return t(s,null,t("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:()=>{window.location.reload()}}));if(!this.envelope)return t(s,null,t("verdocs-loader",null));if(this.fatalErrorMessage)return t(s,{class:{agreed:this.agreed}},t("div",{class:"fatal-error"},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",class:"placeholder",alt:"Placeholder page"}),t("div",{class:"message"},t("div",{class:"header"},this.fatalErrorHeader),t("p",null,this.fatalErrorMessage))));if(this.isDone)return t(s,{class:{agreed:this.agreed}},t("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:e=>{var i;return null===(i=this.sdkError)||void 0===i?void 0:i.emit(e.detail)}}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:`You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`,onNext:e=>{e.preventDefault(),e.stopPropagation(),this.showDone=!1,this.isDone=!0}}),this.submitting&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)));if(!this.agreed)return t(s,{class:"agreed"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"agree"},t("verdocs-checkbox",{name:"agree",label:"By checking this box, you:",onInput:()=>this.handleClickAgree()}),t("ul",null,t("li",null,"Agree to use electronic records and signatures, and confirm you have read the"," ",t("a",{href:"https://verdocs.com/en/electronic-record-signature-disclosure/",target:"_blank"},"Electronic Record and Signatures Disclosure"),"."),t("li",null,"Agree to Verdocs'"," ",t("a",{href:"https://verdocs.com/en/eula",target:"_blank"},"End User License Agreement")," ","and confirm you have read Verdocs'"," ",t("a",{href:"https://verdocs.com/en/privacy-policy/",target:"_blank"},"Privacy Policy"),".")))));if("pin"===this.kbaStep)return t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},t("verdocs-kba-dialog",{mode:"text",step:1,steps:1,helptitle:"Document is protected by a PIN code",helptext:"Please enter your PIN code to proceed. If you do not have one, please contact the sender.",label:"PIN Code",onNext:async e=>{N(this.endpoint,this.envelopeId,this.roleId,e.detail).then((e=>{console.log("[SIGN] PIN code submission result",e),"complete"===e.kba_step&&(this.kbaStep="")})).catch((e=>{var i,t;console.log("[SIGN] Error submitting PIN",e),D((null===(t=null===(i=e.response)||void 0===i?void 0:i.data)||void 0===t?void 0:t.error)||"Unable to verify PIN code. Please try again.",{style:"error"})}))}}))));if("identity"===this.kbaStep)return t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},t("verdocs-kba-dialog",{mode:"identity",helptitle:"Document requires identity verification",helptext:"Please complete your contact details to proceed.",recipient:this.recipient,onNext:async e=>{const i=e.detail;I(this.endpoint,this.envelopeId,this.roleId,{firstName:i.first_name,lastName:i.last_name,address:i.address,city:i.city,state:i.state,zip:i.zip,ssnLast4:i.ssn_last_4}).then((e=>{console.log("[SIGN] Identity submission result",e),this.kbaStep=e.kba_step})).catch((e=>{var i,t;console.log("[SIGN] Error submitting identity",e),D((null===(t=null===(i=e.response)||void 0===i?void 0:i.data)||void 0===t?void 0:t.error)||"Unable to verify identity.",{style:"error"})}))}}))));if("challenge"===this.kbaStep){const e=this.kbaChoices.length,i=this.kbaQuestions[e];return console.log("Showing KBA question",{questionNumber:e,kbaQuestion:i},this.kbaChoices),t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},this.kbaChoices.length>=this.kbaQuestions.length?t("verdocs-spinner",null):t("verdocs-kba-dialog",{mode:"choice",helptitle:"Your identity requires additional verification",helptext:(null==i?void 0:i.prompt)||"Please select one of the options below.",choices:(null==i?void 0:i.answer)||["Skip Question"],step:e+1,steps:this.kbaQuestions.length,onNext:async e=>{var i,t,s;if(this.kbaChoices=[...this.kbaChoices,e.detail],this.kbaChoices.length>=this.kbaQuestions.length){const o=this.kbaQuestions.map(((e,i)=>({type:e.type,answer:this.kbaChoices[i]})));console.log("Submitting KBA responses",this.kbaChoices,o);try{const e=await G(this.endpoint,this.envelopeId,this.roleId,o);console.log("KBA challenge response",e),this.kbaStep=e.kba_step,"failed"===this.kbaStep?(this.fatalErrorHeader="Identity Verification Failed",this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.",this.isDone=!0):(this.kbaQuestions=(null===(i=e.questions)||void 0===i?void 0:i.question)||[],this.kbaChoices=[])}catch(e){console.log("Error submitting KBA challenge",e),this.kbaStep="",this.fatalErrorHeader="Unable to Verify Identity",this.fatalErrorMessage=(null===(s=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.error)||"Please try again later.",this.isDone=!0}}}}))))}return t(s,null,t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name),t("div",{style:{flex:"1"}}),!this.finishLater&&t("verdocs-button",{size:"xsmall",label:this.nextButtonLabel,disabled:!this.agreed,onClick:()=>this.handleNext()}),t("div",{style:{marginLeft:"10px"}}),t("verdocs-dropdown",{options:this.isDone||this.finishLater?T:L,onOptionSelected:e=>this.handleOptionSelected(e)}))),t("div",{class:"document",style:{paddingTop:"15px"}},(this.envelope.documents||[]).map((e=>{const i=P(1,e.pages);return t(o,null,i.map((i=>{var s;const o=(null===(s=e.page_sizes)||void 0===s?void 0:s[i])||{width:612,height:792};return t("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,virtualWidth:o.width,virtualHeight:o.height,pageNumber:i,onPageRendered:e=>this.handlePageRendered(e),type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&t("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:`To complete the ${this.documentsSingularPlural}, use the link in the original email notification inviting you to review and finish the document.`,onNext:()=>this.showFinishLater=!1}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:`You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`,onNext:()=>{this.showDone=!1,this.isDone=!0}}),this.submitting||this.showSpinner&&t("verdocs-portal",null,t("div",{class:"spinner-overlay"},t("verdocs-spinner",null))))}};j.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign .agree{-ms-flex:0;flex:0;width:600px;display:-ms-flexbox;display:flex;max-width:90%;padding:30px 15px;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree li{margin:0.5em 0}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);margin-top:15px}verdocs-sign .fatal-error .message{width:50%;font-size:16px;background:white;border-radius:5px;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#654dcb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 46px;flex:0 0 46px;font-size:12px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 12px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}.spinner-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background:rgba(0, 0, 0, 0.4980392157);-ms-flex-pack:center;justify-content:center}';export{j as verdocs_sign}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{r as e,c as t,h as i,H as o,F as s,g as n}from"./p-b9654a5e.js";import{VerdocsEndpoint as l,getTemplate as r,integerSequence as a,getOrganizationContacts as d,isValidEmail as c,createEnvelope as h,getRGBA as u,formatFullName as p,createTemplateDocument as v,deleteTemplateDocument as m,updateField as f,createField as g,updateTemplateRole as b,createTemplateRole as x}from"@verdocs/js-sdk";import{S as w}from"./p-fd97809c.js";import{S as y}from"./p-b712e729.js";import{V as k}from"./p-04c07b7b.js";import{D as E,P as S,J as q,a as C,F as M,b as T,T as I}from"./p-b0766439.js";import{f as L}from"./p-12bab948.js";import{i as H}from"./p-a901dff2.js";import{b as Z,c as D,d as z,g as O,e as _,f as N}from"./p-cfed8cc1.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";const V=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId=null,this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e),this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[PREVIEW] Unable to start builder session, must be authenticated");if(!this.templateId)return void console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);this.listenToTemplate()}catch(o){console.log("[PREVIEW] Error with preview session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}handlePageRendered(e){}render(){var e;return i(o,null,this.loading?i("verdocs-loader",null):((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).map((e=>{const t=a(1,e.pages);return i(s,null,t.map((t=>{var o;const s=(null===(o=e.page_sizes)||void 0===o?void 0:o[t])||{width:612,height:792};return i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:!0,editable:!1,done:!1,virtualWidth:s.width,virtualHeight:s.height,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};V.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';const A=e=>((null==e?void 0:e.roles)||[]).map((e=>e.name)),R='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>',j=class{constructor(i){e(this,i),this.sendingEnvelope=t(this,"sendingEnvelope",7),this.send=t(this,"send",7),this.exit=t(this,"exit",7),this.sdkError=t(this,"sdkError",7),this.searchContacts=t(this,"searchContacts",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId=null,this.environment="",this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`,this.showPickerForId="",this.sessionContacts=[],this.sending=!1,this.rolesCompleted={},this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId),this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1,this.rolesCompleted={}}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e),this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{if(this.endpoint.onSessionChanged(((e,t,i)=>{if(!i)return;const o={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};i&&(this.sessionContacts=[o],d(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e),this.sessionContacts=[...e,o]})).catch((e=>{console.log("[SEND] Error getting contacts",e)})))})),this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[SEND] Unable to start Send operation, must be authenticated");if(!this.templateId)return void console.log(`[SEND] Missing required template ID ${this.templateId}`);this.listenToTemplate()}catch(o){console.log("[SEND] Error with send session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const t={};((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence-1;t[i]||(t[i]=[]);const o=`r-${i}-${t[i].length}`;t[i].push({...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name}),e.first_name&&c(e.email)&&(this.rolesCompleted[o]={...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name})}))}getLevels(){var e;const t=[...new Set(((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).map((e=>e.sequence-1)))];return t.sort(((e,t)=>e-t)),t}getRolesAtLevel(e){var t;const i=((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).filter((t=>t.sequence-1===e)).map(((t,i)=>({...t,id:`r-${e}-${i}`,role_name:t.name,first_name:"",last_name:""})));return i}getLevelIcon(e){const t=this.getLevels();return i("div",e<0?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}:e>=t.length?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}:{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'})}handleSelectContact(e,t){e.preventDefault(),this.rolesCompleted[t.id]={...t,...e.detail},this.showPickerForId=""}handleClickRole(e,t){e.stopPropagation(),this.showPickerForId=t.id}handleSend(e){var t,i;if(this.sending)return void console.log("[SEND] Skipping duplicate send",e);console.log("[SEND] Sending",e),e.preventDefault(),e.stopPropagation(),this.sending=!0,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!0});const o={template_id:this.templateId,name:(null===(i=this.template)||void 0===i?void 0:i.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};console.log("[SEND] Creating envelope",o),h(this.endpoint,o).then((e=>{var t,i;console.log("[SEND] Send envelope",e),this.reset().catch((e=>console.log("Unknown Error",e))),this.sending=!1,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!1}),null===(i=this.send)||void 0===i||i.emit({...o,name:o.name,envelope_id:e.id,envelope:e})})).catch((e=>{var t,i,o;console.log("Send error",e),k((null===(i=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===i?void 0:i.error)||"Error creating envelope, please try again later."),this.sending=!1,null===(o=this.sendingEnvelope)||void 0===o||o.emit({sending:!1})}))}handleCancel(e){var t;e.stopPropagation(),null===(t=this.exit)||void 0===t||t.emit()}render(){var e;if(this.loading)return i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const t=this.getLevels(),s=Object.values(this.rolesCompleted).filter((e=>c(e.email))).length>=A(this.template).length;return i(o,{class:{sendable:null===(e=this.template)||void 0===e?void 0:e.is_sendable}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:"level level-start"},this.getLevelIcon(-1),i("div",{class:"complete"},"Send Envelope")),t.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon(e),this.getRolesAtLevel(e).map((e=>{var t,o,s,n;const l=!e.email,r=`verdocs-send-recipient-${e.role_name}`,a=(d=e.role_name,Math.max(A(this.template).findIndex((e=>e===d)),0));var d;const c=u(a);return l?i("div",{class:"recipient","data-ri":a,"data-rn":e.role_name,style:{backgroundColor:c},onClick:t=>this.handleClickRole(t,e),id:r},(null===(t=this.rolesCompleted[e.id])||void 0===t?void 0:t.first_name)?p(this.rolesCompleted[e.id]):e.role_name,i("div",{class:"icon",innerHTML:R}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:r,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(o=this.rolesCompleted[e.id])&&void 0!==o?o:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}}))):i("div",{class:"recipient",style:{borderColor:c},onClick:t=>this.handleClickRole(t,e),id:r},(null===(s=this.rolesCompleted[e.id])||void 0===s?void 0:s.first_name)?p(this.rolesCompleted[e.id]):e.role_name,i("div",{class:"icon",innerHTML:R}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:r,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(n=this.rolesCompleted[e.id])&&void 0!==n?n:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}})))}))))),i("div",{class:"level level-done"},this.getLevelIcon(t.length),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!s||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};j.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';const U=class{constructor(i){e(this,i),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.templateUpdated=t(this,"templateUpdated",7),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId="",this.uploading=!1,this.progressLabel="Uploading...",this.progressPercent=0,this.showDeleteError=!1,this.confirmDeleteDocument=null,this.loading=!0,this.template=null}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(o){console.log("[TEMPLATE ATTACHMENTS] Error loading template",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}handleCancel(e){e.stopPropagation(),this.exit.emit()}handleUploadProgress(e){e>=99?(this.progressPercent=100,this.progressLabel="Processing..."):this.progressPercent=e}async handleUpload(e){var t,i,o,s;e.stopPropagation();const n=e.detail.file;if(n){console.log("[ATTACHMENTS] Uploading...",n),this.uploading=!0,this.progressLabel="Uploading...";try{const e=await v(this.endpoint,this.templateId,n,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e),this.template=await y.getTemplate(this.endpoint,this.templateId,!0),console.log("[ATTACHMENTS] Updated template",this.template),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"}),this.uploading=!1,this.progressLabel="",this.progressPercent=0}catch(e){console.log("[ATTACHMENTS] Error creating template",e),null===(i=this.sdkError)||void 0===i||i.emit(new w(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(s=e.response)||void 0===s?void 0:s.data)),this.uploading=!1}}}handleNext(e){var t;e.stopPropagation(),this.uploading=!1,this.progressLabel="",this.progressPercent=0,null===(t=this.next)||void 0===t||t.emit({template:this.template})}async confirmDelete(){await m(this.endpoint,this.templateId,this.confirmDeleteDocument.id),this.template=await y.getTemplate(this.endpoint,this.templateId,!0),console.log("[ATTACHMENTS] New template",this.template),this.confirmDeleteDocument=null}async handleDelete(e){var t;((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).length>1?this.confirmDeleteDocument=e:this.showDeleteError=!0}getFileIcon(e){switch(e.mime){case"application/pdf":return C;case"image/jpeg":return q;case"image/png":return S;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return E}return M}render(){var e,t;return this.endpoint.session?this.loading?i(o,{class:"loading"},i("verdocs-loader",null)):this.endpoint.session&&this.template?i(o,null,i("h5",null,"Existing Attachments"),i("div",{class:"attachments"},((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).map((e=>i("div",{class:"attachment"},i("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),i("div",{class:"filename",title:e.name},e.name),i("div",{class:"pages"},i("div",{class:"count"},e.pages),i("div",{class:"pages-icon",innerHTML:T})),i("div",{class:"trash-icon",innerHTML:I,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:!0,percent:this.progressPercent,label:this.progressLabel}))):i("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleNext(e),disabled:!((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).length||this.uploading})),this.showDeleteError&&i("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=!1}),this.confirmDeleteDocument&&i("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:()=>this.confirmDelete(),showCancel:!0,onExit:()=>{this.confirmDeleteDocument=null}})):i(o,{class:"empty"}):i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};U.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';const B=["attachments","roles","settings","fields","preview"],P=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.stepChanged=t(this,"stepChanged",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId=null,this.step="preview",this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e),this.listenToTemplate()}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e)}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");if(!this.templateId)return this.step="attachments",void console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");this.listenToTemplate()}catch(o){console.log("[BUILD_TABS] Error loading template",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}setStep(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id),e.stopPropagation(),e.preventDefault(),this.step=e.detail.tab.id,null===(t=this.stepChanged)||void 0===t||t.emit(e.detail.tab.id)}copyTemplateId(){navigator.clipboard.writeText(this.templateId).then((()=>{k("Template ID copied",{style:"success",duration:3e3})})).catch((e=>{var t;console.warn("[BUILD_TABS] Error copying to clipboard",e),null===(t=this.sdkError)||void 0===t||t.emit(e)}))}render(){var e,t,s,n,l,r,a,d,c;if(this.loading)return i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const h=((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).length>0;let u=h&&((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).length>0;const p=u&&((null===(s=this.template)||void 0===s?void 0:s.fields)||[]).length>0;let v=Math.max(B.indexOf(this.step),0);return!p&&v>=4&&(v=3),!u&&v>=3&&(v=1),!h&&v>=1&&(v=0),i(o,null,i("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:v,tabs:[{id:"attachments",disabled:!1,label:"Attachment(s)"},{id:"roles",disabled:!h,label:"Roles"},{id:"settings",disabled:!u,label:"Settings"},{id:"fields",disabled:!u,label:"Fields"},{id:"preview",disabled:!p,label:"Preview/Send"}]}),this.templateId&&i("div",{class:"info"},i("verdocs-button-panel",{icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>'},i("div",{class:"template-details-panel"},i("h6",null,"Template Details"),i("div",{class:"row"},i("label",null,"ID:"),i("div",{class:"value"},this.templateId),i("div",{class:"icon-button",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>',onClick:()=>this.copyTemplateId()})),i("div",{class:"row"},i("label",null,"Name:"),i("div",{class:"value"},null===(n=this.template)||void 0===n?void 0:n.name)),i("div",{class:"row"},i("label",null,"Visibility:"),i("div",{class:"value"},(null===(l=this.template)||void 0===l?void 0:l.is_public)?"Public":(null===(r=this.template)||void 0===r?void 0:r.is_personal)?"Private":"Shared")),i("div",{class:"row"},i("label",null,"Created:"),i("div",{class:"value"},(null===(a=this.template)||void 0===a?void 0:a.counter)?L(new Date(null===(d=this.template)||void 0===d?void 0:d.created_at),"P p"):"")),i("div",{class:"row"},i("label",null,"Used:"),i("div",{class:"value"},null===(c=this.template)||void 0===c?void 0:c.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};P.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';const $='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>',F=[{id:"signature",tooltip:"Signature",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>',class:"signature"},{id:"initial",tooltip:"Initials",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>',class:"initial"},{id:"sep1",tooltip:"",icon:$,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>',class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>',class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>',class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>',class:"dropdown"},{id:"sep2",tooltip:"",icon:$,class:"separator"},{id:"date",tooltip:"Date",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>',class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>',class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>',class:"attachment"}],Q=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.fieldsUpdated=t(this,"fieldsUpdated",7),this.templateListenerId=null,this.pageHeights={},this.cachedPageInfo={},this.endpoint=l.getDefault(),this.templateId=null,this.toolbarTargetId=null,this.placing=null,this.showMustSelectRole=!1,this.selectedRoleName="",this.loading=!0,this.template=null}onTemplateIdChanged(){this.listenToTemplate()}handleKeyDown(e){"Escape"===e.key&&(this.placing=null)}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[FIELDS] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[FIELDS] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(o){console.log("[FIELDS] Error with fields session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}componentDidRender(){H.dynamicDrop(!0);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null,t=document.getElementById("verdocs-template-fields-toolbar");e&&t&&(console.log("[FIELDS] Moving toolbar"),t.remove(),e.append(t))}componentWillUpdate(){var e,t;const i=(null===(e=this.template)||void 0===e?void 0:e.roles)||[];this.selectedRoleName&&i.find((e=>e&&e.name===this.selectedRoleName))||(this.selectedRoleName=(null===(t=i[0])||void 0===t?void 0:t.name)||"",console.log("[FIELDS] Selected new role",this.selectedRoleName))}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{var t,i;this.template=e,this.loading=!1,this.selectedRoleName=(null===(i=null===(t=e.roles)||void 0===t?void 0:t[0])||void 0===i?void 0:i.name)||""}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}attachFieldAttributes(e,t,i){i.addEventListener("settingsChanged",(()=>{var e;null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:this.template,event:"added-field"})})),i.addEventListener("deleted",(()=>{var e;i.remove(),null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})})),i.setAttribute("templateid",this.templateId),i.setAttribute("fieldname",t.name),i.setAttribute("pageNumber",String(e.pageNumber)),i.setAttribute("xScale",String(e.xScale)),i.setAttribute("yScale",String(e.yScale)),i.setAttribute("name",t.name)}handlePageRendered(e){var t;const i=e.detail;this.cachedPageInfo[i.pageNumber]=i,this.pageHeights[i.pageNumber]=i.naturalHeight,((null===(t=this.template)||void 0===t?void 0:t.fields)||[]).filter((e=>e&&e.page===i.pageNumber)).forEach((e=>{const t=O(e),i=document.getElementById(t);i&&(i.setAttribute("fieldname",e.name),i.setAttribute("pagenumber",String(e.page)),this.makeDraggable(i))}))}makeDraggable(e){H(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),o=+(e.target.getAttribute("xScale")||1),s=+(e.target.getAttribute("yScale")||1),n=e.dx/o+t,l=e.dy/s+i;e.target.setAttribute("posX",n),e.target.setAttribute("posy",l),Z(e.target,"translate",`${n}px, ${l}px`)}async handleMoveEnd(e){var t,i,o,s,n,l,r,a;const d=e.target.getAttribute("fieldname"),c=((null===(t=this.template)||void 0===t?void 0:t.fields)||[]).find((e=>e.name===d));if(!c)return void console.log("[FIELDS] Unable to find field",d,e.target);const h=e.target.getAttribute("pagenumber");let{naturalWidth:u=612,naturalHeight:p=792,renderedHeight:v=792}=this.cachedPageInfo[h];const m=e.target.getBoundingClientRect(),g=e.target.parentElement.getBoundingClientRect(),b=c.width||_(c.type),x=c.height||N(c.type),E=Math.max(m.left-g.left,0);let S=Math.max(v-(g.bottom-m.bottom),0),q=parseInt(h);S>v?(q=Math.min(q+1,(null===(s=null===(o=(null===(i=this.template)||void 0===i?void 0:i.documents)||[])||void 0===o?void 0:o[0])||void 0===s?void 0:s.pages)||1),S-=v,v=this.cachedPageInfo[q].renderedHeight,console.log("Next page",{newPageNumber:q,newY:S,renderedHeight:v})):S<0&&(q=Math.max(q-1,1),v=this.cachedPageInfo[q].renderedHeight,S+=v,console.log("[FIELDS] Next page",{newPageNumber:q,newY:S,renderedHeight:v}));const{x:C,y:M}=this.viewCoordinatesToPageCoordinates(E,S,h,u-b,p-x);try{const t={x:C,y:M,page:q},i=await f(this.endpoint,this.templateId,d,t);console.log("[FIELDS] Updated",i);const o=JSON.parse(JSON.stringify(this.template)),s=o.fields.findIndex((e=>e.name===d));s>-1&&(o.fields[s]=i),y.updateTemplate(this.templateId,o),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),D(e.target);const{xScale:l=1,yScale:r=1}=this.cachedPageInfo[h];z(e.target,i,l,r),null===(n=this.templateUpdated)||void 0===n||n.emit({endpoint:this.endpoint,template:o,event:"updated-field"})}catch(t){k("Error updating field, please try again later",{style:"error"}),console.log("[FIELDS] Error updating field",t),null===(l=this.sdkError)||void 0===l||l.emit(new w(t.message,null===(r=t.response)||void 0===r?void 0:r.status,null===(a=t.response)||void 0===a?void 0:a.data)),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),D(e.target)}}generateFieldName(e,t){var i;let o,s=1;do{o=`${e}P${t}-${s}`,s++}while(((null===(i=this.template)||void 0===i?void 0:i.fields)||[]).some((e=>e&&e.name===o)));return o}viewCoordinatesToPageCoordinates(e,t,i,o,s){const{xScale:n=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];return{x:Math.floor(Math.min(e/n,o)),y:Math.floor(Math.min(Math.max(r-t,0)/l,s))}}async handleClickPage(e,t){var i;if(this.placing){const o=e.offsetX,s=e.offsetY,n=_(this.placing),l=N(this.placing),r=this.cachedPageInfo[t],{naturalWidth:a=612,naturalHeight:d=792}=r,c=this.viewCoordinatesToPageCoordinates(o,s,t,a-n,d-l),h=Math.floor(c.x),u=Math.floor(c.y),p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:r.documentId,type:this.placing,required:"radio"!==this.placing,page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:h,y:u,width:n,height:l,multiline:!1,options:"radio"===this.placing?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);const v=await g(this.endpoint,this.templateId,p);console.log("[FIELDS] Saved field",v);const m=JSON.parse(JSON.stringify(this.template));m.fields.push(v),y.updateTemplate(this.templateId,m),null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:m,event:"added-field"}),this.placing=null}}render(){var e,t,s;if(this.loading)return i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const n=((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).map((e=>({value:e.name,label:e.full_name?`${e.name}: ${e.full_name}`:e.name})));return i(o,{class:this.placing?{[`placing-${this.placing}`]:!0}:{},onSubmit:()=>{}},i("div",{id:"verdocs-template-fields-toolbar"},i("div",{class:"add-for"},"Add field:"),i("verdocs-select-input",{value:this.selectedRoleName,options:n,onInput:e=>this.selectedRoleName=e.target.value}),F.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:()=>{e.tooltip&&(this.selectedRoleName?this.placing=e.id:this.showMustSelectRole=!0)}})))),i("div",{class:"pages"},((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).map((e=>a(1,e.pages).map((t=>{const o=e.page_sizes[t];return i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:(null==o?void 0:o.width)||612,virtualHeight:(null==o?void 0:o.height)||792,disabled:!0,editable:!0,done:!1,onClick:e=>this.handleClickPage(e,t),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))))),this.showMustSelectRole&&i("verdocs-ok-dialog",{heading:"Unable to add field",message:((null===(s=this.template)||void 0===s?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:()=>this.showMustSelectRole=!1}))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};
|
1
|
+
import{r as e,c as t,h as i,H as o,F as s,g as n}from"./p-b9654a5e.js";import{VerdocsEndpoint as l,getTemplate as r,integerSequence as a,getOrganizationContacts as d,isValidEmail as c,createEnvelope as h,getRGBA as u,formatFullName as p,createTemplateDocument as v,deleteTemplateDocument as m,updateField as f,createField as g,updateTemplateRole as b,createTemplateRole as x}from"@verdocs/js-sdk";import{S as w}from"./p-fd97809c.js";import{S as y}from"./p-58d027d1.js";import{V as k}from"./p-04c07b7b.js";import{D as E,P as S,J as q,a as C,F as M,b as T,T as I}from"./p-b0766439.js";import{f as L}from"./p-12bab948.js";import{i as H}from"./p-a901dff2.js";import{b as Z,c as D,d as z,g as O,e as _,f as N}from"./p-0c45b79c.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";const V=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId=null,this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e),this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[PREVIEW] Unable to start builder session, must be authenticated");if(!this.templateId)return void console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);this.listenToTemplate()}catch(o){console.log("[PREVIEW] Error with preview session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}handlePageRendered(e){}render(){var e;return i(o,null,this.loading?i("verdocs-loader",null):((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).map((e=>{const t=a(1,e.pages);return i(s,null,t.map((t=>{var o;const s=(null===(o=e.page_sizes)||void 0===o?void 0:o[t])||{width:612,height:792};return i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:!0,editable:!1,done:!1,virtualWidth:s.width,virtualHeight:s.height,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};V.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';const A=e=>((null==e?void 0:e.roles)||[]).map((e=>e.name)),R='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>',j=class{constructor(i){e(this,i),this.sendingEnvelope=t(this,"sendingEnvelope",7),this.send=t(this,"send",7),this.exit=t(this,"exit",7),this.sdkError=t(this,"sdkError",7),this.searchContacts=t(this,"searchContacts",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId=null,this.environment="",this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`,this.showPickerForId="",this.sessionContacts=[],this.sending=!1,this.rolesCompleted={},this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId),this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1,this.rolesCompleted={}}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e),this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{if(this.endpoint.onSessionChanged(((e,t,i)=>{if(!i)return;const o={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};i&&(this.sessionContacts=[o],d(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e),this.sessionContacts=[...e,o]})).catch((e=>{console.log("[SEND] Error getting contacts",e)})))})),this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[SEND] Unable to start Send operation, must be authenticated");if(!this.templateId)return void console.log(`[SEND] Missing required template ID ${this.templateId}`);this.listenToTemplate()}catch(o){console.log("[SEND] Error with send session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const t={};((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence-1;t[i]||(t[i]=[]);const o=`r-${i}-${t[i].length}`;t[i].push({...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name}),e.first_name&&c(e.email)&&(this.rolesCompleted[o]={...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name})}))}getLevels(){var e;const t=[...new Set(((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).map((e=>e.sequence-1)))];return t.sort(((e,t)=>e-t)),t}getRolesAtLevel(e){var t;const i=((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).filter((t=>t.sequence-1===e)).map(((t,i)=>({...t,id:`r-${e}-${i}`,role_name:t.name,first_name:"",last_name:""})));return i}getLevelIcon(e){const t=this.getLevels();return i("div",e<0?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}:e>=t.length?{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}:{class:"level-icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'})}handleSelectContact(e,t){e.preventDefault(),this.rolesCompleted[t.id]={...t,...e.detail},this.showPickerForId=""}handleClickRole(e,t){e.stopPropagation(),this.showPickerForId=t.id}handleSend(e){var t,i;if(this.sending)return void console.log("[SEND] Skipping duplicate send",e);console.log("[SEND] Sending",e),e.preventDefault(),e.stopPropagation(),this.sending=!0,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!0});const o={template_id:this.templateId,name:(null===(i=this.template)||void 0===i?void 0:i.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};console.log("[SEND] Creating envelope",o),h(this.endpoint,o).then((e=>{var t,i;console.log("[SEND] Send envelope",e),this.reset().catch((e=>console.log("Unknown Error",e))),this.sending=!1,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!1}),null===(i=this.send)||void 0===i||i.emit({...o,name:o.name,envelope_id:e.id,envelope:e})})).catch((e=>{var t,i,o;console.log("Send error",e),k((null===(i=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===i?void 0:i.error)||"Error creating envelope, please try again later."),this.sending=!1,null===(o=this.sendingEnvelope)||void 0===o||o.emit({sending:!1})}))}handleCancel(e){var t;e.stopPropagation(),null===(t=this.exit)||void 0===t||t.emit()}render(){var e;if(this.loading)return i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const t=this.getLevels(),s=Object.values(this.rolesCompleted).filter((e=>c(e.email))).length>=A(this.template).length;return i(o,{class:{sendable:null===(e=this.template)||void 0===e?void 0:e.is_sendable}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:"level level-start"},this.getLevelIcon(-1),i("div",{class:"complete"},"Send Envelope")),t.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon(e),this.getRolesAtLevel(e).map((e=>{var t,o,s,n;const l=!e.email,r=`verdocs-send-recipient-${e.role_name}`,a=(d=e.role_name,Math.max(A(this.template).findIndex((e=>e===d)),0));var d;const c=u(a);return l?i("div",{class:"recipient","data-ri":a,"data-rn":e.role_name,style:{backgroundColor:c},onClick:t=>this.handleClickRole(t,e),id:r},(null===(t=this.rolesCompleted[e.id])||void 0===t?void 0:t.first_name)?p(this.rolesCompleted[e.id]):e.role_name,i("div",{class:"icon",innerHTML:R}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:r,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(o=this.rolesCompleted[e.id])&&void 0!==o?o:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}}))):i("div",{class:"recipient",style:{borderColor:c},onClick:t=>this.handleClickRole(t,e),id:r},(null===(s=this.rolesCompleted[e.id])||void 0===s?void 0:s.first_name)?p(this.rolesCompleted[e.id]):e.role_name,i("div",{class:"icon",innerHTML:R}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:r,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(n=this.rolesCompleted[e.id])&&void 0!==n?n:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}})))}))))),i("div",{class:"level level-done"},this.getLevelIcon(t.length),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!s||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};j.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';const U=class{constructor(i){e(this,i),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.templateUpdated=t(this,"templateUpdated",7),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId="",this.uploading=!1,this.progressLabel="Uploading...",this.progressPercent=0,this.showDeleteError=!1,this.confirmDeleteDocument=null,this.loading=!0,this.template=null}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(o){console.log("[TEMPLATE ATTACHMENTS] Error loading template",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}handleCancel(e){e.stopPropagation(),this.exit.emit()}handleUploadProgress(e){e>=99?(this.progressPercent=100,this.progressLabel="Processing..."):this.progressPercent=e}async handleUpload(e){var t,i,o,s;e.stopPropagation();const n=e.detail.file;if(n){console.log("[ATTACHMENTS] Uploading...",n),this.uploading=!0,this.progressLabel="Uploading...";try{const e=await v(this.endpoint,this.templateId,n,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e),this.template=await y.getTemplate(this.endpoint,this.templateId,!0),console.log("[ATTACHMENTS] Updated template",this.template),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"}),this.uploading=!1,this.progressLabel="",this.progressPercent=0}catch(e){console.log("[ATTACHMENTS] Error creating template",e),null===(i=this.sdkError)||void 0===i||i.emit(new w(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(s=e.response)||void 0===s?void 0:s.data)),this.uploading=!1}}}handleNext(e){var t;e.stopPropagation(),this.uploading=!1,this.progressLabel="",this.progressPercent=0,null===(t=this.next)||void 0===t||t.emit({template:this.template})}async confirmDelete(){await m(this.endpoint,this.templateId,this.confirmDeleteDocument.id),this.template=await y.getTemplate(this.endpoint,this.templateId,!0),console.log("[ATTACHMENTS] New template",this.template),this.confirmDeleteDocument=null}async handleDelete(e){var t;((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).length>1?this.confirmDeleteDocument=e:this.showDeleteError=!0}getFileIcon(e){switch(e.mime){case"application/pdf":return C;case"image/jpeg":return q;case"image/png":return S;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return E}return M}render(){var e,t;return this.endpoint.session?this.loading?i(o,{class:"loading"},i("verdocs-loader",null)):this.endpoint.session&&this.template?i(o,null,i("h5",null,"Existing Attachments"),i("div",{class:"attachments"},((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).map((e=>i("div",{class:"attachment"},i("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),i("div",{class:"filename",title:e.name},e.name),i("div",{class:"pages"},i("div",{class:"count"},e.pages),i("div",{class:"pages-icon",innerHTML:T})),i("div",{class:"trash-icon",innerHTML:I,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:!0,percent:this.progressPercent,label:this.progressLabel}))):i("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleNext(e),disabled:!((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).length||this.uploading})),this.showDeleteError&&i("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=!1}),this.confirmDeleteDocument&&i("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:()=>this.confirmDelete(),showCancel:!0,onExit:()=>{this.confirmDeleteDocument=null}})):i(o,{class:"empty"}):i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};U.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';const B=["attachments","roles","settings","fields","preview"],P=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.stepChanged=t(this,"stepChanged",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId=null,this.step="preview",this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e),this.listenToTemplate()}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e)}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");if(!this.templateId)return this.step="attachments",void console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");this.listenToTemplate()}catch(o){console.log("[BUILD_TABS] Error loading template",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}setStep(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id),e.stopPropagation(),e.preventDefault(),this.step=e.detail.tab.id,null===(t=this.stepChanged)||void 0===t||t.emit(e.detail.tab.id)}copyTemplateId(){navigator.clipboard.writeText(this.templateId).then((()=>{k("Template ID copied",{style:"success",duration:3e3})})).catch((e=>{var t;console.warn("[BUILD_TABS] Error copying to clipboard",e),null===(t=this.sdkError)||void 0===t||t.emit(e)}))}render(){var e,t,s,n,l,r,a,d,c;if(this.loading)return i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const h=((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).length>0;let u=h&&((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).length>0;const p=u&&((null===(s=this.template)||void 0===s?void 0:s.fields)||[]).length>0;let v=Math.max(B.indexOf(this.step),0);return!p&&v>=4&&(v=3),!u&&v>=3&&(v=1),!h&&v>=1&&(v=0),i(o,null,i("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:v,tabs:[{id:"attachments",disabled:!1,label:"Attachment(s)"},{id:"roles",disabled:!h,label:"Roles"},{id:"settings",disabled:!u,label:"Settings"},{id:"fields",disabled:!u,label:"Fields"},{id:"preview",disabled:!p,label:"Preview/Send"}]}),this.templateId&&i("div",{class:"info"},i("verdocs-button-panel",{icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>'},i("div",{class:"template-details-panel"},i("h6",null,"Template Details"),i("div",{class:"row"},i("label",null,"ID:"),i("div",{class:"value"},this.templateId),i("div",{class:"icon-button",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>',onClick:()=>this.copyTemplateId()})),i("div",{class:"row"},i("label",null,"Name:"),i("div",{class:"value"},null===(n=this.template)||void 0===n?void 0:n.name)),i("div",{class:"row"},i("label",null,"Visibility:"),i("div",{class:"value"},(null===(l=this.template)||void 0===l?void 0:l.is_public)?"Public":(null===(r=this.template)||void 0===r?void 0:r.is_personal)?"Private":"Shared")),i("div",{class:"row"},i("label",null,"Created:"),i("div",{class:"value"},(null===(a=this.template)||void 0===a?void 0:a.counter)?L(new Date(null===(d=this.template)||void 0===d?void 0:d.created_at),"P p"):"")),i("div",{class:"row"},i("label",null,"Used:"),i("div",{class:"value"},null===(c=this.template)||void 0===c?void 0:c.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};P.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';const $='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>',F=[{id:"signature",tooltip:"Signature",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>',class:"signature"},{id:"initial",tooltip:"Initials",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>',class:"initial"},{id:"sep1",tooltip:"",icon:$,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>',class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>',class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>',class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>',class:"dropdown"},{id:"sep2",tooltip:"",icon:$,class:"separator"},{id:"date",tooltip:"Date",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>',class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>',class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>',class:"attachment"}],Q=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.fieldsUpdated=t(this,"fieldsUpdated",7),this.templateListenerId=null,this.pageHeights={},this.cachedPageInfo={},this.endpoint=l.getDefault(),this.templateId=null,this.toolbarTargetId=null,this.placing=null,this.showMustSelectRole=!1,this.selectedRoleName="",this.loading=!0,this.template=null}onTemplateIdChanged(){this.listenToTemplate()}handleKeyDown(e){"Escape"===e.key&&(this.placing=null)}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[FIELDS] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[FIELDS] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(o){console.log("[FIELDS] Error with fields session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}componentDidRender(){H.dynamicDrop(!0);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null,t=document.getElementById("verdocs-template-fields-toolbar");e&&t&&(console.log("[FIELDS] Moving toolbar"),t.remove(),e.append(t))}componentWillUpdate(){var e,t;const i=(null===(e=this.template)||void 0===e?void 0:e.roles)||[];this.selectedRoleName&&i.find((e=>e&&e.name===this.selectedRoleName))||(this.selectedRoleName=(null===(t=i[0])||void 0===t?void 0:t.name)||"",console.log("[FIELDS] Selected new role",this.selectedRoleName))}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{var t,i;this.template=e,this.loading=!1,this.selectedRoleName=(null===(i=null===(t=e.roles)||void 0===t?void 0:t[0])||void 0===i?void 0:i.name)||""}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}attachFieldAttributes(e,t,i){i.addEventListener("settingsChanged",(()=>{var e;null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:this.template,event:"added-field"})})),i.addEventListener("deleted",(()=>{var e;i.remove(),null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})})),i.setAttribute("templateid",this.templateId),i.setAttribute("fieldname",t.name),i.setAttribute("pageNumber",String(e.pageNumber)),i.setAttribute("xScale",String(e.xScale)),i.setAttribute("yScale",String(e.yScale)),i.setAttribute("name",t.name)}handlePageRendered(e){var t;const i=e.detail;this.cachedPageInfo[i.pageNumber]=i,this.pageHeights[i.pageNumber]=i.naturalHeight,((null===(t=this.template)||void 0===t?void 0:t.fields)||[]).filter((e=>e&&e.page===i.pageNumber)).forEach((e=>{const t=O(e),i=document.getElementById(t);i&&(i.setAttribute("fieldname",e.name),i.setAttribute("pagenumber",String(e.page)),this.makeDraggable(i))}))}makeDraggable(e){H(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),o=+(e.target.getAttribute("xScale")||1),s=+(e.target.getAttribute("yScale")||1),n=e.dx/o+t,l=e.dy/s+i;e.target.setAttribute("posX",n),e.target.setAttribute("posy",l),Z(e.target,"translate",`${n}px, ${l}px`)}async handleMoveEnd(e){var t,i,o,s,n,l,r,a;const d=e.target.getAttribute("fieldname"),c=((null===(t=this.template)||void 0===t?void 0:t.fields)||[]).find((e=>e.name===d));if(!c)return void console.log("[FIELDS] Unable to find field",d,e.target);const h=e.target.getAttribute("pagenumber");let{naturalWidth:u=612,naturalHeight:p=792,renderedHeight:v=792}=this.cachedPageInfo[h];const m=e.target.getBoundingClientRect(),g=e.target.parentElement.getBoundingClientRect(),b=c.width||_(c.type),x=c.height||N(c.type),E=Math.max(m.left-g.left,0);let S=Math.max(v-(g.bottom-m.bottom),0),q=parseInt(h);S>v?(q=Math.min(q+1,(null===(s=null===(o=(null===(i=this.template)||void 0===i?void 0:i.documents)||[])||void 0===o?void 0:o[0])||void 0===s?void 0:s.pages)||1),S-=v,v=this.cachedPageInfo[q].renderedHeight,console.log("Next page",{newPageNumber:q,newY:S,renderedHeight:v})):S<0&&(q=Math.max(q-1,1),v=this.cachedPageInfo[q].renderedHeight,S+=v,console.log("[FIELDS] Next page",{newPageNumber:q,newY:S,renderedHeight:v}));const{x:C,y:M}=this.viewCoordinatesToPageCoordinates(E,S,h,u-b,p-x);try{const t={x:C,y:M,page:q},i=await f(this.endpoint,this.templateId,d,t);console.log("[FIELDS] Updated",i);const o=JSON.parse(JSON.stringify(this.template)),s=o.fields.findIndex((e=>e.name===d));s>-1&&(o.fields[s]=i),y.updateTemplate(this.templateId,o),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),D(e.target);const{xScale:l=1,yScale:r=1}=this.cachedPageInfo[h];z(e.target,i,l,r),null===(n=this.templateUpdated)||void 0===n||n.emit({endpoint:this.endpoint,template:o,event:"updated-field"})}catch(t){k("Error updating field, please try again later",{style:"error"}),console.log("[FIELDS] Error updating field",t),null===(l=this.sdkError)||void 0===l||l.emit(new w(t.message,null===(r=t.response)||void 0===r?void 0:r.status,null===(a=t.response)||void 0===a?void 0:a.data)),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),D(e.target)}}generateFieldName(e,t){var i;let o,s=1;do{o=`${e}P${t}-${s}`,s++}while(((null===(i=this.template)||void 0===i?void 0:i.fields)||[]).some((e=>e&&e.name===o)));return o}viewCoordinatesToPageCoordinates(e,t,i,o,s){const{xScale:n=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];return{x:Math.floor(Math.min(e/n,o)),y:Math.floor(Math.min(Math.max(r-t,0)/l,s))}}async handleClickPage(e,t){var i;if(this.placing){const o=e.offsetX,s=e.offsetY,n=_(this.placing),l=N(this.placing),r=this.cachedPageInfo[t],{naturalWidth:a=612,naturalHeight:d=792}=r,c=this.viewCoordinatesToPageCoordinates(o,s,t,a-n,d-l),h=Math.floor(c.x),u=Math.floor(c.y),p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:r.documentId,type:this.placing,required:"radio"!==this.placing,page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:h,y:u,width:n,height:l,multiline:!1,options:"radio"===this.placing?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);const v=await g(this.endpoint,this.templateId,p);console.log("[FIELDS] Saved field",v);const m=JSON.parse(JSON.stringify(this.template));m.fields.push(v),y.updateTemplate(this.templateId,m),null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:m,event:"added-field"}),this.placing=null}}render(){var e,t,s;if(this.loading)return i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const n=((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).map((e=>({value:e.name,label:e.full_name?`${e.name}: ${e.full_name}`:e.name})));return i(o,{class:this.placing?{[`placing-${this.placing}`]:!0}:{},onSubmit:()=>{}},i("div",{id:"verdocs-template-fields-toolbar"},i("div",{class:"add-for"},"Add field:"),i("verdocs-select-input",{value:this.selectedRoleName,options:n,onInput:e=>this.selectedRoleName=e.target.value}),F.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:()=>{e.tooltip&&(this.selectedRoleName?this.placing=e.id:this.showMustSelectRole=!0)}})))),i("div",{class:"pages"},((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).map((e=>a(1,e.pages).map((t=>{const o=e.page_sizes[t];return i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:(null==o?void 0:o.width)||612,virtualHeight:(null==o?void 0:o.height)||792,disabled:!0,editable:!0,done:!1,onClick:e=>this.handleClickPage(e,t),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))))),this.showMustSelectRole&&i("verdocs-ok-dialog",{heading:"Unable to add field",message:((null===(s=this.template)||void 0===s?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:()=>this.showMustSelectRole=!1}))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};
|
2
2
|
/**!
|
3
3
|
* Sortable 1.15.6
|
4
4
|
* @author RubaXa <trash@rubaxa.org>
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,c as t,h as o,F as i,H as s}from"./p-b9654a5e.js";import{VerdocsEndpoint as a,formatFullName as c,isValidEmail as r}from"@verdocs/js-sdk";import{h as d}from"./p-cfed8cc1.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";import"./p-12bab948.js";const l=class{constructor(o){e(this,o),this.searchContacts=t(this,"searchContacts",7),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.endpoint=a.getDefault(),this.templateRole=null,this.contactSuggestions=[],this.first_name=void 0,this.last_name=void 0,this.email=void 0,this.phone=void 0,this.zip=void 0,this.address=void 0,this.message=void 0,this.showSuggestions=!1,this.showMessage=!1,this.delegator=!1,this.showKba=!1,this.kba_method="",this.kba_pin="",this.nameFieldId=`verdocs-contact-picker-name-${Math.random().toString(36).substring(2,11)}`,this.firstNameFieldId=`verdocs-contact-picker-firstname-${Math.random().toString(36).substring(2,11)}`,this.lastNameFieldId=`verdocs-contact-picker-lastname-${Math.random().toString(36).substring(2,11)}`,this.emailFieldId=`verdocs-contact-picker-email-${Math.random().toString(36).substring(2,11)}`,this.phoneFieldId=`verdocs-contact-picker-phone-${Math.random().toString(36).substring(2,11)}`}componentWillLoad(){if(this.templateRole){const e=c(this.templateRole).split(" "),t=this.templateRole.first_name||e.shift()||"",o=this.templateRole.last_name||e.join(" ")||"";this.first_name=t,this.last_name=o,this.email=this.templateRole.email||"",this.phone=this.templateRole.phone||"",this.delegator=this.templateRole.delegator||!1,this.message=this.templateRole.message||"",this.showMessage=""!==this.message,this.kba_method=this.templateRole.kba_method||"",this.kba_pin=this.templateRole.kba_pin||"",this.showKba=!!this.kba_method}}handleFirstNameChange(e){var t;this.first_name=e.target.value,null===(t=this.searchContacts)||void 0===t||t.emit({query:this.first_name})}handleLastNameChange(e){var t;this.last_name=e.target.value,null===(t=this.searchContacts)||void 0===t||t.emit({query:this.last_name})}handleCancel(e){var t;e.stopPropagation(),this.showSuggestions=!1,null===(t=this.exit)||void 0===t||t.emit()}handleSubmit(e){var t;e.stopPropagation(),this.showSuggestions=!1,null===(t=this.next)||void 0===t||t.emit({first_name:this.first_name,last_name:this.last_name,email:this.email,phone:this.phone,message:this.message,delegator:this.delegator,kba_method:this.kba_method,kba_pin:this.kba_pin,address:this.address,zip:this.zip})}handleSelectSuggestion(e,t){e.stopPropagation(),this.first_name=t.first_name,this.last_name=t.last_name,this.email=t.email,this.phone=t.phone,this.showSuggestions=!1}render(){const e=this.first_name&&this.last_name&&r(this.email)&&(!this.kba_method||"pin"===this.kba_method&&this.kba_pin||"identity"===this.kba_method);return o("form",{key:"2ce99d1c3ae979f25dde56e4a9dc7ec56cec2542",onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},o("div",{key:"6257ebf610c9ea9a8f6238311ad1b4ed0095e498",class:"row"},o("label",{key:"c36d51599847033b0c096c9d5de7d8af49e05c7d",htmlFor:this.nameFieldId},"Name:"),o("div",{key:"23cdb2afffff2ede3429c8591093eb89ca89d4b6",class:"names-row"},o("input",{key:"d281392383863edbcfc14440e18631b97962ea2f",id:this.firstNameFieldId,name:this.firstNameFieldId,type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.first_name,placeholder:"First...",onFocus:()=>{var e;return this.showSuggestions=(null===(e=this.contactSuggestions)||void 0===e?void 0:e.length)>0},onInput:e=>this.handleFirstNameChange(e)}),o("input",{key:"eea0626eb854ae95c32ad7e98d479a614e7df81c",id:this.lastNameFieldId,name:this.lastNameFieldId,type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.last_name,placeholder:"Last...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.handleLastNameChange(e)})),this.showSuggestions&&o("div",{key:"2e3fc57f42e3281b83b03e53b92c07243dcff544",class:"dropdown"},this.contactSuggestions.filter((e=>!this.first_name||e.first_name.toLowerCase().includes(this.first_name.toLowerCase()))).map((e=>{var t;return o("div",{key:null!==(t=e.id)&&void 0!==t?t:e.email,class:"suggestion",onClick:t=>this.handleSelectSuggestion(t,e)},e.picture?o("img",{alt:"Avatar",class:"avatar",src:e.picture}):o("div",{class:"avatar",innerHTML:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-user"><path d="M15 13a3 3 0 1 0-6 0"/><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"/><circle cx="12" cy="8" r="2"/></svg>'}),o("div",{class:"details"},o("div",{class:"name"},c(e)),e.email&&o("div",{class:"destination"},e.email),e.phone&&o("div",{class:"destination"},e.phone)))})))),o("div",{key:"f18fd6d889ea70f8a5e51bd1780007b3ff061b56",class:"row"},o("label",{key:"5cda3922bb705ed0d3af00644df9ef8d42042021",htmlFor:this.emailFieldId},"Email:"),o("input",{key:"34474c4c8bbbde2802b3c2f58ea3abed4b3e27f6",id:this.emailFieldId,name:this.emailFieldId,type:"text","data-lpignore":"true",autoComplete:"blocked",value:this.email,placeholder:"Email address...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.email=e.target.value})),o("div",{key:"c757b186ca60272855ed5701c59857856dcd863f",class:"row"},o("label",{key:"1d971705ab36609db6a4e9cb7d24281d98441cd5",htmlFor:this.phoneFieldId},"Phone:"),o("input",{key:"2a516e28498a6727409ef51e61ca3fe912c65789",id:this.phoneFieldId,name:this.phoneFieldId,type:"text","data-lpignore":"true",autoComplete:"blocked",value:this.phone,placeholder:"Phone (SMS)...",onFocus:()=>this.showSuggestions=!1,onInput:e=>{this.phone=d(e.target.value)}})),this.showKba&&o(i,{key:"05cdb2c78abc3156d04a012c40a52f2c6ab24a86"},o("div",{key:"56d53a04ba6ab45ecc30f11e44669ad503400a49",class:"kba-row"},o("label",{key:"8af91071db065071bb40e931ea92231f31e9c0c9"},"KBA:"),o("verdocs-select-input",{key:"3f2eec31ee0078779eeed5d3f2fbd222fcdbaa42",value:this.kba_method,onInput:e=>{this.kba_method=e.target.value,this.zip="",this.address="",this.kba_pin=""},options:[{label:"None",value:""},{label:"PIN Code",value:"pin"},{label:"Full Verification",value:"identity"}]}),o("div",{key:"33e9efc07399e6930264b4b79f73a5497728c7c7",style:{flex:"1"}}),o("verdocs-help-icon",{key:"bc5ec8ad3fcf22a4f9a0f4659b574e238526574a",text:"Knowledge-Based Authentication adds additional authentication for this user either via a simple PIN code or full address validation. NOTE: There may be a fee for using this feature."})),"pin"===this.kba_method&&o("div",{key:"cd07404e1e9cd0a344c0975bdd23b2374d97ad61",class:"row pin-code"},o("input",{key:"92909cedb50e11bffe60dcd032b2d8c3dd901834",id:"verdocs-pin-code",name:"verdocs-pin-code",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.kba_pin,placeholder:"PIN Code...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.kba_pin=e.target.value})),"identity"===this.kba_method&&o("div",{key:"6ad1983ac8f9394bb9f35a8a9bba2f16d48d7bcd",class:"row address"},o("input",{key:"d598a1fb52b77eb85f17bda65f1730900d1d94e5",id:"verdocs-address",name:"verdocs-address",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.address,placeholder:"Address...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.address=e.target.value}),o("verdocs-help-icon",{key:"09d3cfa8e92c6c59cda2cff599ae474296de35a0",text:"Pre-fill the recipient's current street address. They will still be asked ID challenge questions."})),"identity"===this.kba_method&&o("div",{key:"1ccb3caa35f5474f40245ca1fe9c11aa175b4cc2",class:"row zip-code"},o("input",{key:"e967aba3ffac6e25f359c56c0bd5cd057394ad82",id:"verdocs-zip-code",name:"verdocs-zip-code",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.zip,placeholder:"Zip Code...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.zip=e.target.value}),o("verdocs-help-icon",{key:"b4075b320d84028e8717e8383113751155a6aebf",text:"Pre-fill the recipient's current zip code. They will still be asked ID challenge questions."}))),this.showMessage&&o("div",{key:"8212baa1274eb1dd98deeec972afeeb5bfb3c400",class:"row message"},o("label",{key:"1b1c58c77ebd0dfd1e193e68a9bf472d93b8914f",htmlFor:"verdocs-contact-picker-message"},"Message:"),o("input",{key:"d5525496367b3fa0bde52a91bad7f68964454a3c",id:"verdocs-contact-picker-message",name:"verdocs-contact-picker-message",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.message,placeholder:"Message shown in invitation...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.message=e.target.value})),o("div",{key:"c39a19e49ea3ae82ecb287bf2acb87734237fdb9",class:"buttons"},o("verdocs-toggle-button",{key:"311f86449b98cad74d5811473578ab223237d39e",icon:'<svg focusable="false" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.5 3.75a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3h-15Zm4.125 3a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Zm-3.873 8.703a4.126 4.126 0 0 1 7.746 0 .75.75 0 0 1-.351.92 7.47 7.47 0 0 1-3.522.877 7.47 7.47 0 0 1-3.522-.877.75.75 0 0 1-.351-.92ZM15 8.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15ZM14.25 12a.75.75 0 0 1 .75-.75h3.75a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75Zm.75 2.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15Z" clip-rule="evenodd" /></svg>',size:"small",active:this.showKba,onToggle:e=>{this.showKba=e.detail.active,e.detail.active||(this.kba_pin="",this.kba_method="",this.zip=""),this.showSuggestions=!1}}),o("verdocs-toggle-button",{key:"c51c8bba37758ad6ada6946d9c2df9880204b1be",icon:'<svg focusable="false" viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"></path></svg>',size:"small",active:this.showMessage,onToggle:e=>{this.showMessage=e.detail.active,this.showSuggestions=!1}}),o("div",{key:"747951c6d9273bf5142be1f20b6e51a2cc4239d5",class:"flex-fill"}),o("verdocs-button",{key:"12f60448cac7f6bb6804119ad620bdc77d4c0c9c",variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e)}),o("verdocs-button",{key:"507b52e7904d9e5c31e1ba40c7ffa0ccba7763f2",label:"OK",size:"small",disabled:!e,onClick:e?e=>this.handleSubmit(e):()=>{}})))}};l.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-contact-picker{display:block;border:1px solid #ebebeb;background-color:#ffffff;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-webkit-box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1);box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1)}verdocs-contact-picker form{gap:12px;width:300px;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#f5f5fa}verdocs-contact-picker form .row{gap:8px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-contact-picker form .row.message{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}verdocs-contact-picker form .names-row{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .names-row>input{font-size:14px;width:103px}verdocs-contact-picker form .kba-row{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .kba-row verdocs-select-input{margin:0}verdocs-contact-picker form .pin-code{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .pin-code>input{-ms-flex:0;flex:0;width:133px;font-size:14px;margin-left:58px}verdocs-contact-picker form .address{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .address>input{-ms-flex:1;flex:1;font-size:14px;margin-left:58px}verdocs-contact-picker form .zip-code{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .zip-code>input{-ms-flex:1;flex:1;font-size:14px;margin-left:58px}verdocs-contact-picker form label{display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;font-size:14px;font-weight:500;color:#5c6575}verdocs-contact-picker form .row.message label{-ms-flex:0;flex:0}verdocs-contact-picker form .row.message input{width:100%}verdocs-contact-picker form input{-ms-flex:1;flex:1;padding:6px;font-size:14px;border-radius:3px;background:rgba(0, 0, 0, 0.0196078431);border:1px solid rgba(112, 122, 229, 0.3725490196)}verdocs-contact-picker form input:focus{outline:none}verdocs-contact-picker form .dropdown{left:0;right:0;top:49px;z-index:1000000;max-height:225px;overflow-y:scroll;position:absolute;background:#ffffff;-webkit-box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1);box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1)}verdocs-contact-picker form .dropdown .suggestion{display:-ms-flexbox;display:flex;padding:6px 12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .dropdown .suggestion svg{width:32px;height:32px}verdocs-contact-picker form .dropdown .suggestion .avatar{width:32px;height:32px;-ms-flex:0 0 32px;flex:0 0 32px;margin-right:8px;border-radius:100%}verdocs-contact-picker form .dropdown .suggestion .details{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-contact-picker form .dropdown .suggestion .name{font-size:16px;font-weight:500;margin-bottom:3px;color:#092c4c}verdocs-contact-picker form .dropdown .suggestion .destination{font-size:14px;margin-bottom:3px;color:#33364b}verdocs-contact-picker form .dropdown .suggestion:hover{background:#eee;cursor:pointer}verdocs-contact-picker .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-contact-picker ::-webkit-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::-moz-placeholder{color:#aaaaaa}verdocs-contact-picker :-ms-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::-ms-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::placeholder{color:#aaaaaa}verdocs-contact-picker [data-lastpass-icon-root]{display:none !important}';const n=class{constructor(o){e(this,o),this.toggle=t(this,"toggle",7),this.active=!1,this.icon=null,this.label=null,this.size="normal",this._active=!1}componentWillLoad(){this._active=this.active}handleToggle(e){var t;e.stopPropagation();const o=!this._active;this._active=o,null===(t=this.toggle)||void 0===t||t.emit({active:o})}render(){return o(s,{key:"57d988cf0335a521279382d8c91be3b7af3b1f87",class:`size-${this.size}`},this.icon?o("button",{innerHTML:this.icon,class:{active:this._active},onClick:e=>this.handleToggle(e)}):o("button",{class:{active:this._active},onClick:e=>this.handleToggle(e)},this.label))}};n.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-toggle-button{font-family:"Inter", "Barlow", sans-serif}verdocs-toggle-button button{border:none;outline:none;cursor:pointer;-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;background:#cccccc;color:#33364b}verdocs-toggle-button button svg{max-width:100%;max-height:100%;fill:#33364b}verdocs-toggle-button button.active{background:#55bc81;color:#f5f5fa}verdocs-toggle-button button.active svg{fill:#f5f5fa}verdocs-toggle-button button:focus{border:none;outline:none}verdocs-toggle-button.size-normal button{width:40px;height:40px;padding:6px;border-radius:4px}verdocs-toggle-button.size-small button{width:34px;height:34px;padding:4px;border-radius:2px}';export{l as verdocs_contact_picker,n as verdocs_toggle_button}
|
1
|
+
import{r as e,c as t,h as o,F as i,H as s}from"./p-b9654a5e.js";import{VerdocsEndpoint as a,formatFullName as c,isValidEmail as r}from"@verdocs/js-sdk";import{h as d}from"./p-0c45b79c.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";import"./p-12bab948.js";const l=class{constructor(o){e(this,o),this.searchContacts=t(this,"searchContacts",7),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.endpoint=a.getDefault(),this.templateRole=null,this.contactSuggestions=[],this.first_name=void 0,this.last_name=void 0,this.email=void 0,this.phone=void 0,this.zip=void 0,this.address=void 0,this.message=void 0,this.showSuggestions=!1,this.showMessage=!1,this.delegator=!1,this.showKba=!1,this.kba_method="",this.kba_pin="",this.nameFieldId=`verdocs-contact-picker-name-${Math.random().toString(36).substring(2,11)}`,this.firstNameFieldId=`verdocs-contact-picker-firstname-${Math.random().toString(36).substring(2,11)}`,this.lastNameFieldId=`verdocs-contact-picker-lastname-${Math.random().toString(36).substring(2,11)}`,this.emailFieldId=`verdocs-contact-picker-email-${Math.random().toString(36).substring(2,11)}`,this.phoneFieldId=`verdocs-contact-picker-phone-${Math.random().toString(36).substring(2,11)}`}componentWillLoad(){if(this.templateRole){const e=c(this.templateRole).split(" "),t=this.templateRole.first_name||e.shift()||"",o=this.templateRole.last_name||e.join(" ")||"";this.first_name=t,this.last_name=o,this.email=this.templateRole.email||"",this.phone=this.templateRole.phone||"",this.delegator=this.templateRole.delegator||!1,this.message=this.templateRole.message||"",this.showMessage=""!==this.message,this.kba_method=this.templateRole.kba_method||"",this.kba_pin=this.templateRole.kba_pin||"",this.showKba=!!this.kba_method}}handleFirstNameChange(e){var t;this.first_name=e.target.value,null===(t=this.searchContacts)||void 0===t||t.emit({query:this.first_name})}handleLastNameChange(e){var t;this.last_name=e.target.value,null===(t=this.searchContacts)||void 0===t||t.emit({query:this.last_name})}handleCancel(e){var t;e.stopPropagation(),this.showSuggestions=!1,null===(t=this.exit)||void 0===t||t.emit()}handleSubmit(e){var t;e.stopPropagation(),this.showSuggestions=!1,null===(t=this.next)||void 0===t||t.emit({first_name:this.first_name,last_name:this.last_name,email:this.email,phone:this.phone,message:this.message,delegator:this.delegator,kba_method:this.kba_method,kba_pin:this.kba_pin,address:this.address,zip:this.zip})}handleSelectSuggestion(e,t){e.stopPropagation(),this.first_name=t.first_name,this.last_name=t.last_name,this.email=t.email,this.phone=t.phone,this.showSuggestions=!1}render(){const e=this.first_name&&this.last_name&&r(this.email)&&(!this.kba_method||"pin"===this.kba_method&&this.kba_pin||"identity"===this.kba_method);return o("form",{key:"2ce99d1c3ae979f25dde56e4a9dc7ec56cec2542",onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},o("div",{key:"6257ebf610c9ea9a8f6238311ad1b4ed0095e498",class:"row"},o("label",{key:"c36d51599847033b0c096c9d5de7d8af49e05c7d",htmlFor:this.nameFieldId},"Name:"),o("div",{key:"23cdb2afffff2ede3429c8591093eb89ca89d4b6",class:"names-row"},o("input",{key:"d281392383863edbcfc14440e18631b97962ea2f",id:this.firstNameFieldId,name:this.firstNameFieldId,type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.first_name,placeholder:"First...",onFocus:()=>{var e;return this.showSuggestions=(null===(e=this.contactSuggestions)||void 0===e?void 0:e.length)>0},onInput:e=>this.handleFirstNameChange(e)}),o("input",{key:"eea0626eb854ae95c32ad7e98d479a614e7df81c",id:this.lastNameFieldId,name:this.lastNameFieldId,type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.last_name,placeholder:"Last...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.handleLastNameChange(e)})),this.showSuggestions&&o("div",{key:"2e3fc57f42e3281b83b03e53b92c07243dcff544",class:"dropdown"},this.contactSuggestions.filter((e=>!this.first_name||e.first_name.toLowerCase().includes(this.first_name.toLowerCase()))).map((e=>{var t;return o("div",{key:null!==(t=e.id)&&void 0!==t?t:e.email,class:"suggestion",onClick:t=>this.handleSelectSuggestion(t,e)},e.picture?o("img",{alt:"Avatar",class:"avatar",src:e.picture}):o("div",{class:"avatar",innerHTML:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-user"><path d="M15 13a3 3 0 1 0-6 0"/><path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"/><circle cx="12" cy="8" r="2"/></svg>'}),o("div",{class:"details"},o("div",{class:"name"},c(e)),e.email&&o("div",{class:"destination"},e.email),e.phone&&o("div",{class:"destination"},e.phone)))})))),o("div",{key:"f18fd6d889ea70f8a5e51bd1780007b3ff061b56",class:"row"},o("label",{key:"5cda3922bb705ed0d3af00644df9ef8d42042021",htmlFor:this.emailFieldId},"Email:"),o("input",{key:"34474c4c8bbbde2802b3c2f58ea3abed4b3e27f6",id:this.emailFieldId,name:this.emailFieldId,type:"text","data-lpignore":"true",autoComplete:"blocked",value:this.email,placeholder:"Email address...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.email=e.target.value})),o("div",{key:"c757b186ca60272855ed5701c59857856dcd863f",class:"row"},o("label",{key:"1d971705ab36609db6a4e9cb7d24281d98441cd5",htmlFor:this.phoneFieldId},"Phone:"),o("input",{key:"2a516e28498a6727409ef51e61ca3fe912c65789",id:this.phoneFieldId,name:this.phoneFieldId,type:"text","data-lpignore":"true",autoComplete:"blocked",value:this.phone,placeholder:"Phone (SMS)...",onFocus:()=>this.showSuggestions=!1,onInput:e=>{this.phone=d(e.target.value)}})),this.showKba&&o(i,{key:"05cdb2c78abc3156d04a012c40a52f2c6ab24a86"},o("div",{key:"56d53a04ba6ab45ecc30f11e44669ad503400a49",class:"kba-row"},o("label",{key:"8af91071db065071bb40e931ea92231f31e9c0c9"},"KBA:"),o("verdocs-select-input",{key:"3f2eec31ee0078779eeed5d3f2fbd222fcdbaa42",value:this.kba_method,onInput:e=>{this.kba_method=e.target.value,this.zip="",this.address="",this.kba_pin=""},options:[{label:"None",value:""},{label:"PIN Code",value:"pin"},{label:"Full Verification",value:"identity"}]}),o("div",{key:"33e9efc07399e6930264b4b79f73a5497728c7c7",style:{flex:"1"}}),o("verdocs-help-icon",{key:"bc5ec8ad3fcf22a4f9a0f4659b574e238526574a",text:"Knowledge-Based Authentication adds additional authentication for this user either via a simple PIN code or full address validation. NOTE: There may be a fee for using this feature."})),"pin"===this.kba_method&&o("div",{key:"cd07404e1e9cd0a344c0975bdd23b2374d97ad61",class:"row pin-code"},o("input",{key:"92909cedb50e11bffe60dcd032b2d8c3dd901834",id:"verdocs-pin-code",name:"verdocs-pin-code",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.kba_pin,placeholder:"PIN Code...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.kba_pin=e.target.value})),"identity"===this.kba_method&&o("div",{key:"6ad1983ac8f9394bb9f35a8a9bba2f16d48d7bcd",class:"row address"},o("input",{key:"d598a1fb52b77eb85f17bda65f1730900d1d94e5",id:"verdocs-address",name:"verdocs-address",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.address,placeholder:"Address...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.address=e.target.value}),o("verdocs-help-icon",{key:"09d3cfa8e92c6c59cda2cff599ae474296de35a0",text:"Pre-fill the recipient's current street address. They will still be asked ID challenge questions."})),"identity"===this.kba_method&&o("div",{key:"1ccb3caa35f5474f40245ca1fe9c11aa175b4cc2",class:"row zip-code"},o("input",{key:"e967aba3ffac6e25f359c56c0bd5cd057394ad82",id:"verdocs-zip-code",name:"verdocs-zip-code",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.zip,placeholder:"Zip Code...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.zip=e.target.value}),o("verdocs-help-icon",{key:"b4075b320d84028e8717e8383113751155a6aebf",text:"Pre-fill the recipient's current zip code. They will still be asked ID challenge questions."}))),this.showMessage&&o("div",{key:"8212baa1274eb1dd98deeec972afeeb5bfb3c400",class:"row message"},o("label",{key:"1b1c58c77ebd0dfd1e193e68a9bf472d93b8914f",htmlFor:"verdocs-contact-picker-message"},"Message:"),o("input",{key:"d5525496367b3fa0bde52a91bad7f68964454a3c",id:"verdocs-contact-picker-message",name:"verdocs-contact-picker-message",type:"text","data-lpignore":"true",autocomplete:"blocked",value:this.message,placeholder:"Message shown in invitation...",onFocus:()=>this.showSuggestions=!1,onInput:e=>this.message=e.target.value})),o("div",{key:"c39a19e49ea3ae82ecb287bf2acb87734237fdb9",class:"buttons"},o("verdocs-toggle-button",{key:"311f86449b98cad74d5811473578ab223237d39e",icon:'<svg focusable="false" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M4.5 3.75a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3h-15Zm4.125 3a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Zm-3.873 8.703a4.126 4.126 0 0 1 7.746 0 .75.75 0 0 1-.351.92 7.47 7.47 0 0 1-3.522.877 7.47 7.47 0 0 1-3.522-.877.75.75 0 0 1-.351-.92ZM15 8.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15ZM14.25 12a.75.75 0 0 1 .75-.75h3.75a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75Zm.75 2.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15Z" clip-rule="evenodd" /></svg>',size:"small",active:this.showKba,onToggle:e=>{this.showKba=e.detail.active,e.detail.active||(this.kba_pin="",this.kba_method="",this.zip=""),this.showSuggestions=!1}}),o("verdocs-toggle-button",{key:"c51c8bba37758ad6ada6946d9c2df9880204b1be",icon:'<svg focusable="false" viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"></path></svg>',size:"small",active:this.showMessage,onToggle:e=>{this.showMessage=e.detail.active,this.showSuggestions=!1}}),o("div",{key:"747951c6d9273bf5142be1f20b6e51a2cc4239d5",class:"flex-fill"}),o("verdocs-button",{key:"12f60448cac7f6bb6804119ad620bdc77d4c0c9c",variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e)}),o("verdocs-button",{key:"507b52e7904d9e5c31e1ba40c7ffa0ccba7763f2",label:"OK",size:"small",disabled:!e,onClick:e?e=>this.handleSubmit(e):()=>{}})))}};l.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-contact-picker{display:block;border:1px solid #ebebeb;background-color:#ffffff;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-webkit-box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1);box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1)}verdocs-contact-picker form{gap:12px;width:300px;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#f5f5fa}verdocs-contact-picker form .row{gap:8px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-contact-picker form .row.message{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start}verdocs-contact-picker form .names-row{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .names-row>input{font-size:14px;width:103px}verdocs-contact-picker form .kba-row{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .kba-row verdocs-select-input{margin:0}verdocs-contact-picker form .pin-code{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .pin-code>input{-ms-flex:0;flex:0;width:133px;font-size:14px;margin-left:58px}verdocs-contact-picker form .address{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .address>input{-ms-flex:1;flex:1;font-size:14px;margin-left:58px}verdocs-contact-picker form .zip-code{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .zip-code>input{-ms-flex:1;flex:1;font-size:14px;margin-left:58px}verdocs-contact-picker form label{display:-ms-flexbox;display:flex;-ms-flex:0 0 50px;flex:0 0 50px;font-size:14px;font-weight:500;color:#5c6575}verdocs-contact-picker form .row.message label{-ms-flex:0;flex:0}verdocs-contact-picker form .row.message input{width:100%}verdocs-contact-picker form input{-ms-flex:1;flex:1;padding:6px;font-size:14px;border-radius:3px;background:rgba(0, 0, 0, 0.0196078431);border:1px solid rgba(112, 122, 229, 0.3725490196)}verdocs-contact-picker form input:focus{outline:none}verdocs-contact-picker form .dropdown{left:0;right:0;top:49px;z-index:1000000;max-height:225px;overflow-y:scroll;position:absolute;background:#ffffff;-webkit-box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1);box-shadow:0 0 15px 0 rgba(0, 0, 0, 0.1)}verdocs-contact-picker form .dropdown .suggestion{display:-ms-flexbox;display:flex;padding:6px 12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker form .dropdown .suggestion svg{width:32px;height:32px}verdocs-contact-picker form .dropdown .suggestion .avatar{width:32px;height:32px;-ms-flex:0 0 32px;flex:0 0 32px;margin-right:8px;border-radius:100%}verdocs-contact-picker form .dropdown .suggestion .details{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-contact-picker form .dropdown .suggestion .name{font-size:16px;font-weight:500;margin-bottom:3px;color:#092c4c}verdocs-contact-picker form .dropdown .suggestion .destination{font-size:14px;margin-bottom:3px;color:#33364b}verdocs-contact-picker form .dropdown .suggestion:hover{background:#eee;cursor:pointer}verdocs-contact-picker .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-contact-picker .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-contact-picker ::-webkit-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::-moz-placeholder{color:#aaaaaa}verdocs-contact-picker :-ms-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::-ms-input-placeholder{color:#aaaaaa}verdocs-contact-picker ::placeholder{color:#aaaaaa}verdocs-contact-picker [data-lastpass-icon-root]{display:none !important}';const n=class{constructor(o){e(this,o),this.toggle=t(this,"toggle",7),this.active=!1,this.icon=null,this.label=null,this.size="normal",this._active=!1}componentWillLoad(){this._active=this.active}handleToggle(e){var t;e.stopPropagation();const o=!this._active;this._active=o,null===(t=this.toggle)||void 0===t||t.emit({active:o})}render(){return o(s,{key:"57d988cf0335a521279382d8c91be3b7af3b1f87",class:`size-${this.size}`},this.icon?o("button",{innerHTML:this.icon,class:{active:this._active},onClick:e=>this.handleToggle(e)}):o("button",{class:{active:this._active},onClick:e=>this.handleToggle(e)},this.label))}};n.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-toggle-button{font-family:"Inter", "Barlow", sans-serif}verdocs-toggle-button button{border:none;outline:none;cursor:pointer;-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;background:#cccccc;color:#33364b}verdocs-toggle-button button svg{max-width:100%;max-height:100%;fill:#33364b}verdocs-toggle-button button.active{background:#55bc81;color:#f5f5fa}verdocs-toggle-button button.active svg{fill:#f5f5fa}verdocs-toggle-button button:focus{border:none;outline:none}verdocs-toggle-button.size-normal button{width:40px;height:40px;padding:6px;border-radius:4px}verdocs-toggle-button.size-small button{width:34px;height:34px;padding:4px;border-radius:2px}';export{l as verdocs_contact_picker,n as verdocs_toggle_button}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as e,c as t,h as i,F as s,H as o}from"./p-b9654a5e.js";import{getRGBA as n}from"@verdocs/js-sdk";import{S as r}from"./p-b0766439.js";import{S as a}from"./p-58d027d1.js";const d=class{constructor(i){e(this,i),this.settingsChanged=t(this,"settingsChanged",7),this.deleted=t(this,"deleted",7),this.source="template",this.sourceid="",this.fieldname="",this.field=null,this.disabled=!1,this.done=!1,this.editable=!1,this.moveable=!1,this.xscale=1,this.yscale=1,this.pagenumber=1,this.showingProperties=!1,this.focused=!1,this.fields=void 0,this.pageNum=void 0,this.roleName=void 0,this.fieldId=void 0,this.recipients=void 0,this.selectedRoleName=void 0,this.pdfPages=void 0,this.currentSignature=void 0,this.currentSignatureId=void 0,this.currentInitial=void 0,this.currentInitialId=void 0,this.signed=!1,this.preparedMessage=void 0,this.signatureUrl="",this.roleindex=0}componentWillLoad(){if(this.recipients&&this.recipients.length>0){const e=this.recipients.find((e=>"preparer"===e.type));console.log("Found preparer",e),e&&(this.preparedMessage=`Prepared by ${e.full_name}`)}}async focusField(){this.focused=!0,setTimeout((()=>{this.focused=!1}),500)}async showSettingsPanel(){const e=document.getElementById(`verdocs-settings-panel-${this.fieldname}`);e&&e.showPanel&&e.showPanel()}async hideSettingsPanel(){const e=document.getElementById(`verdocs-settings-panel-${this.fieldname}`);e&&e.hidePanel&&e.hidePanel()}render(){const{source:e,sourceid:t,fieldname:d,editable:l=!1,done:c=!1,disabled:p=!1,focused:h,xscale:g=1,yscale:f=1}=this,{index:b,field:m}=a.getField(e,t,d,this.field),u=n(b);return m?c?i(o,{class:{done:c}},"$✓"):i(o,{class:{focused:h,disabled:p},style:{backgroundColor:u}},i("button",{class:{hide:this.signed}},"$"),i("div",this.signed?{class:"frame"}:{style:{display:"none"}}),i("img",{width:"100%",height:"100%",src:this.signatureUrl,alt:"Payment Icon"}),l&&i(s,null,i("div",{id:`verdocs-settings-panel-trigger-${d}`,style:{transform:`scale(${Math.floor(1/g*1e3)/1e3}, ${Math.floor(1/f*1e3)/1e3})`},class:"settings-icon",innerHTML:r,onClick:e=>{e.stopPropagation(),this.showingProperties=!this.showingProperties}}),this.showingProperties&&i("verdocs-portal",{anchor:`verdocs-settings-panel-trigger-${m.name}`,onClickAway:()=>this.showingProperties=!1},i("verdocs-template-field-properties",{templateId:t,fieldName:m.name,onClose:()=>this.showingProperties=!1,onDelete:()=>{var e;return null===(e=this.deleted)||void 0===e||e.emit({fieldName:d}),this.hideSettingsPanel()},onSettingsChanged:e=>{var t;return null===(t=this.settingsChanged)||void 0===t||t.emit(e.detail),this.hideSettingsPanel()},helpText:"Check boxes allow the user to select one or more (non-exclusive) options."})))):i(s,null)}};d.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-field-payment{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;width:24px;height:24px;display:block;font-size:11px;position:relative;scroll-margin:20px 0;border:1px solid #cfa;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left}verdocs-field-payment.disabled{opacity:0.5}verdocs-field-payment button,verdocs-field-payment div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-field-payment button{color:rgba(0, 0, 0, 0.87);font-weight:500;-webkit-transform-origin:0 0;transform-origin:0 0;height:100%;width:100%;background:none;font-size:11px}verdocs-field-payment button.hide{display:none}verdocs-field-payment input{float:left;font-family:Arial, sans-serif}verdocs-field-payment select{position:absolute;font-family:Arial, sans-serif;background:linear-gradient(55deg, transparent 50%, #333 50%), linear-gradient(125deg, #333 50%, transparent 50%), linear-gradient(to right, transparent, transparent);background-position:calc(100% - 7px) 4px, calc(100% - 3px) 4px, 100% 0;background-size:5px 5px, 5px 5px, 2.5em 2.5em;background-repeat:no-repeat;-webkit-appearance:none;-moz-appearance:none;appearance:none}verdocs-field-payment .frame{width:100%;height:100%;background-size:contain;text-align:left}verdocs-field-payment .frame img{position:absolute;height:auto;width:100%}verdocs-field-payment.focused{-webkit-animation:verdocs-field-pulse 0.4s 1;animation:verdocs-field-pulse 0.4s 1}verdocs-field-payment .settings-icon{position:absolute;top:-3px;left:-20px;display:inline-block;cursor:pointer;opacity:0.3}verdocs-field-payment .settings-icon svg{fill:#707ae5}verdocs-field-payment .settings-icon:hover{opacity:1}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}';export{d as verdocs_field_payment}
|