@verdocs/web-sdk 6.5.0-beta.32 → 6.5.0-beta.34
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/{Types-RUyU-svM.js → Types-YJQtg77a.js} +4 -3
- package/dist/{esm/Types-dqxNbm_b.js.map → cjs/Types-YJQtg77a.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-otZIKCGM.js → utils-DjHWIYcY.js} +3 -3
- package/dist/cjs/{utils-otZIKCGM.js.map → utils-DjHWIYcY.js.map} +1 -1
- package/dist/cjs/verdocs-adopt-signature-dialog_8.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-contact-picker.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-field-attachment_11.cjs.entry.js +86 -12
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-preview.verdocs-send.verdocs-template-attachments.verdocs-template-build-tabs.verdocs-template-fields.verdocs-template-roles.verdocs-template-settings.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-preview_7.cjs.entry.js +36 -25
- package/dist/cjs/verdocs-sign.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-template-document-page.verdocs-toolbar-icon.entry.cjs.js.map +1 -1
- 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/embeds/verdocs-send/verdocs-send.css +8 -0
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +3 -1
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
- package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.css +34 -0
- package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.js +77 -2
- package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.js.map +1 -1
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.css +3 -0
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +6 -5
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js.map +1 -1
- package/dist/collection/components/templates/verdocs-template-document-page/verdocs-template-document-page.js +3 -3
- package/dist/collection/components/templates/verdocs-template-document-page/verdocs-template-document-page.js.map +1 -1
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.css +21 -0
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +31 -21
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js.map +1 -1
- package/dist/collection/utils/Types.js +2 -1
- package/dist/collection/utils/Types.js.map +1 -1
- package/dist/components/{p-DLKz8oGD.js → p-1PWpeHpK.js} +3 -3
- package/dist/components/{p-DLKz8oGD.js.map → p-1PWpeHpK.js.map} +1 -1
- package/dist/components/{p-BSXsWUmY.js → p-BWvUv89M.js} +39 -29
- package/dist/components/p-BWvUv89M.js.map +1 -0
- package/dist/components/{p-CrKrBZZL.js → p-BcGvNPBh.js} +7 -7
- package/dist/components/{p-CrKrBZZL.js.map → p-BcGvNPBh.js.map} +1 -1
- package/dist/components/{p-YzC4BSrh.js → p-BttIJYW3.js} +7 -5
- package/dist/components/p-BttIJYW3.js.map +1 -0
- package/dist/components/{p-88SuPfj4.js → p-C35_YsQk.js} +3 -3
- package/dist/components/{p-88SuPfj4.js.map → p-C35_YsQk.js.map} +1 -1
- package/dist/components/{p-COtqu2dZ.js → p-CMNmfu0F.js} +3 -3
- package/dist/components/{p-COtqu2dZ.js.map → p-CMNmfu0F.js.map} +1 -1
- package/dist/components/{p-B7nY_WEM.js → p-CY-c2d8q.js} +9 -9
- package/dist/components/p-CY-c2d8q.js.map +1 -0
- package/dist/components/{p-DWZamcQd.js → p-CeHrzafI.js} +9 -8
- package/dist/components/p-CeHrzafI.js.map +1 -0
- package/dist/components/{p-BaFfUg65.js → p-DKO4_Yp9.js} +3 -3
- package/dist/components/{p-BaFfUg65.js.map → p-DKO4_Yp9.js.map} +1 -1
- package/dist/components/{p-Dl7Xw8F0.js → p-DMMF9yT2.js} +3 -3
- package/dist/components/{p-Dl7Xw8F0.js.map → p-DMMF9yT2.js.map} +1 -1
- package/dist/components/p-Dh9AjNdu.js +292 -0
- package/dist/components/p-Dh9AjNdu.js.map +1 -0
- package/dist/components/{p-IUjGbyAi.js → p-Dk8BEvRP.js} +3 -3
- package/dist/components/{p-IUjGbyAi.js.map → p-Dk8BEvRP.js.map} +1 -1
- package/dist/components/{p-ChDalz5Z.js → p-DyeSZpGe.js} +3 -3
- package/dist/components/{p-ChDalz5Z.js.map → p-DyeSZpGe.js.map} +1 -1
- package/dist/components/{p-Bu_0SDFO.js → p-Iv65sQlJ.js} +3 -3
- package/dist/components/{p-Bu_0SDFO.js.map → p-Iv65sQlJ.js.map} +1 -1
- package/dist/components/verdocs-build.js +8 -8
- package/dist/components/verdocs-contact-picker.js +1 -1
- package/dist/components/verdocs-envelope-document-page.js +1 -1
- package/dist/components/verdocs-envelope-sidebar.js +1 -1
- package/dist/components/verdocs-envelopes-list.js +2 -2
- package/dist/components/verdocs-field-date.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-signing-progress.js +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-templates-list.js +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/Types-BqoC0yeA.js +9 -0
- package/dist/{cjs/Types-RUyU-svM.js.map → esm/Types-BqoC0yeA.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-ivPfUH2E.js → utils-Deu82Q9L.js} +3 -3
- package/dist/esm/{utils-ivPfUH2E.js.map → utils-Deu82Q9L.js.map} +1 -1
- package/dist/esm/verdocs-adopt-signature-dialog_8.entry.js +2 -2
- package/dist/esm/verdocs-contact-picker.entry.js +2 -2
- package/dist/esm/verdocs-download-dialog_4.entry.js +2 -2
- package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm/verdocs-envelopes-list.entry.js +2 -2
- package/dist/esm/verdocs-field-attachment_11.entry.js +86 -12
- package/dist/esm/verdocs-pagination_2.entry.js +2 -2
- package/dist/esm/verdocs-preview.verdocs-send.verdocs-template-attachments.verdocs-template-build-tabs.verdocs-template-fields.verdocs-template-roles.verdocs-template-settings.entry.js.map +1 -1
- package/dist/esm/verdocs-preview_7.entry.js +37 -26
- package/dist/esm/verdocs-sign.entry.js +2 -2
- package/dist/esm/verdocs-template-document-page.verdocs-toolbar-icon.entry.js.map +1 -1
- 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/Types-BqoC0yeA.js +2 -0
- package/dist/esm-es5/{Types-dqxNbm_b.js.map → Types-BqoC0yeA.js.map} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{utils-ivPfUH2E.js → utils-Deu82Q9L.js} +2 -2
- package/dist/esm-es5/{utils-ivPfUH2E.js.map → utils-Deu82Q9L.js.map} +1 -1
- package/dist/esm-es5/verdocs-adopt-signature-dialog_8.entry.js +1 -1
- package/dist/esm-es5/verdocs-contact-picker.entry.js +2 -2
- package/dist/esm-es5/verdocs-download-dialog_4.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_11.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_11.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview.verdocs-send.verdocs-template-attachments.verdocs-template-build-tabs.verdocs-template-fields.verdocs-template-roles.verdocs-template-settings.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-preview_7.entry.js +2 -2
- package/dist/esm-es5/verdocs-preview_7.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-document-page.verdocs-toolbar-icon.entry.js.map +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-date/verdocs-field-date.d.ts +6 -1
- package/dist/types/components/templates/verdocs-template-fields/verdocs-template-fields.d.ts +3 -3
- package/dist/types/utils/Types.d.ts +1 -1
- package/dist/verdocs-web-sdk/{p-751501f3.entry.js → p-07a00b97.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-96c50a15.system.entry.js → p-16e4f438.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-b7a88f34.system.entry.js → p-178d03a6.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-1bde2f57.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-1bde2f57.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-3c1ca466.entry.js → p-3aebfd86.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-12a23bdb.entry.js → p-4671fd0b.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f615bed5.entry.js → p-5cf0d300.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-7165eccc.system.entry.js → p-8cb631da.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-932934f5.system.entry.js +8 -0
- package/dist/verdocs-web-sdk/p-932934f5.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-cff62722.system.entry.js → p-9ec65cad.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
- package/dist/verdocs-web-sdk/p-B_NM_Ddi.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-dY2Fe8ON.system.js.map → p-BaVMqmM6.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-D0t6QCh_.system.js → p-BgKRsvh1.system.js} +2 -2
- package/dist/verdocs-web-sdk/{p-D0t6QCh_.system.js.map → p-BgKRsvh1.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-BqoC0yeA.js +2 -0
- package/dist/verdocs-web-sdk/{p-dqxNbm_b.js.map → p-BqoC0yeA.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-BxZoitZ8.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-C2OP3llY.system.js +2 -0
- package/dist/verdocs-web-sdk/{p-CgZsFvRv.system.js.map → p-C2OP3llY.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-Baa2Y5Zk.system.js.map → p-C5FCNerT.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-DKu4yKnD.system.js.map → p-CwV2z4y9.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-BM3jxk1D.system.js.map → p-DAagWDJf.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-DDdzKvq8.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-BUDKtx9r.system.js.map → p-DZCgLJyz.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-Cz_PSCK3.system.js.map → p-Dxsz-5-P.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-BpvxoJa6.system.js.map → p-H1Tf5vYL.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-f5d355d5.system.entry.js → p-c0fbae7e.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-6598380f.entry.js → p-c1b0b0a8.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-3899da33.entry.js → p-c288939e.entry.js} +3 -3
- package/dist/verdocs-web-sdk/{p-4cbec34e.system.entry.js → p-c4ca9e20.system.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-d09f0a2c.entry.js +8 -0
- package/dist/verdocs-web-sdk/p-d09f0a2c.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-363f13cb.system.entry.js → p-dbaaa79f.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-42ad9ea7.entry.js → p-e74f4251.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-fe97fd80.entry.js → p-ea23d10b.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-721b3041.system.entry.js → p-ee6623f7.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-f986d5dd.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-f986d5dd.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-CHm_85GB.js → p-oC6bZSel.js} +2 -2
- package/dist/verdocs-web-sdk/{p-CHm_85GB.js.map → p-oC6bZSel.js.map} +1 -1
- package/dist/verdocs-web-sdk/verdocs-preview.verdocs-send.verdocs-template-attachments.verdocs-template-build-tabs.verdocs-template-fields.verdocs-template-roles.verdocs-template-settings.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-template-document-page.verdocs-toolbar-icon.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/components/p-B7nY_WEM.js.map +0 -1
- package/dist/components/p-BSXsWUmY.js.map +0 -1
- package/dist/components/p-DR_BGSby.js +0 -217
- package/dist/components/p-DR_BGSby.js.map +0 -1
- package/dist/components/p-DWZamcQd.js.map +0 -1
- package/dist/components/p-YzC4BSrh.js.map +0 -1
- package/dist/esm/Types-dqxNbm_b.js +0 -8
- package/dist/esm-es5/Types-dqxNbm_b.js +0 -2
- package/dist/verdocs-web-sdk/p-344a99c7.system.entry.js +0 -8
- package/dist/verdocs-web-sdk/p-344a99c7.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-8c86b7fd.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-8c86b7fd.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-CgZsFvRv.system.js +0 -2
- package/dist/verdocs-web-sdk/p-DNUz9v6d.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-DsA3pbFK.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-DyCZUrdb.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-c3e7b3ce.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-c3e7b3ce.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-dqxNbm_b.js +0 -2
- package/dist/verdocs-web-sdk/p-e23c5042.entry.js +0 -8
- package/dist/verdocs-web-sdk/p-e23c5042.entry.js.map +0 -1
- /package/dist/verdocs-web-sdk/{p-751501f3.entry.js.map → p-07a00b97.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-96c50a15.system.entry.js.map → p-16e4f438.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-b7a88f34.system.entry.js.map → p-178d03a6.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-3c1ca466.entry.js.map → p-3aebfd86.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-12a23bdb.entry.js.map → p-4671fd0b.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-f615bed5.entry.js.map → p-5cf0d300.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-7165eccc.system.entry.js.map → p-8cb631da.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-cff62722.system.entry.js.map → p-9ec65cad.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-f5d355d5.system.entry.js.map → p-c0fbae7e.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-6598380f.entry.js.map → p-c1b0b0a8.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-3899da33.entry.js.map → p-c288939e.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-4cbec34e.system.entry.js.map → p-c4ca9e20.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-363f13cb.system.entry.js.map → p-dbaaa79f.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-42ad9ea7.entry.js.map → p-e74f4251.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-fe97fd80.entry.js.map → p-ea23d10b.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-721b3041.system.entry.js.map → p-ee6623f7.system.entry.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,i,n){function o(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,s){function r(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n["throw"](e))}catch(e){s(e)}}function l(e){e.done?i(e.value):o(e.value).then(r,a)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,r=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return r.next=a(0),r["throw"]=a(1),r["return"]=a(2),typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(i=0)),i)try{if(n=1,o&&(s=a[0]&2?o["return"]:a[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,a[1])).done)return s;if(o=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;o=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];o=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var n=0,o=t.length,s;n<o;n++){if(s||!(n in t)){if(!s)s=Array.prototype.slice.call(t,0,n);s[n]=t[n]}}return e.concat(s||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-BIRwgFLv.js";import{VerdocsEndpoint,DEFAULT_DISCLOSURES,startSigningSession,envelopeRecipientAgree,getEnvelope,updateEnvelopeField,createSignature,createInitials,sortFields,envelopeRecipientSubmit,isFieldValid,isFieldFilled,uploadEnvelopeFieldAttachment,deleteEnvelopeFieldAttachment,formatFullName,fullNameToInitials,verifySigner,delegateRecipient,envelopeRecipientDecline,integerSequence,askQuestion,getEnvelopeDocumentDownloadLink,getEnvelopesZip}from"@verdocs/js-sdk";import{u as updateDocumentFieldValue,g as getFieldId,r as renderDocumentFlag,a as renderDocumentField,d as defaultHeight}from"./utils-ivPfUH2E.js";import{D as DocumentPageIcon}from"./Icons-COC8ZzcY.js";import{V as VerdocsToast}from"./Toast-CyvDgtoV.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-bS8INhRF.js";import"./index-dzBXqXlK.js";import"./Types-dqxNbm_b.js";var verdocsSignCss='verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;min-height:700px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#f5f5f5;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-sign verdocs-button>button.standard{background:#2a63f6}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;padding-right:140px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign>.document .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;max-width:1028px;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-sign>.document .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-sign>.document .document-separator:first-child{margin-top:0}verdocs-sign .signed-document-container{width:64%;margin-left:260px;-webkit-transition:all 0.3s ease;transition:all 0.3s ease}verdocs-sign .signed-document-container.zoom-normal{width:64%;margin-left:260px}verdocs-sign .signed-document-container.zoom-zoom1{width:80%;margin-left:200px}verdocs-sign .signed-document-container.zoom-zoom2{width:100%;margin-left:150px}verdocs-sign .signed-document-container.zoom-zoom2 .verdocs-flag-instance{opacity:0;pointer-events:none}@media (max-width: 768px){verdocs-sign verdocs-sign-footer{padding:0 10px}verdocs-sign verdocs-sign-footer .buttons{gap:8px}verdocs-sign verdocs-sign-footer .buttons button{font-size:10px}verdocs-sign .signed-document-container{width:100%;margin-left:0}verdocs-sign .signed-document-container.zoom-normal,verdocs-sign .signed-document-container.zoom-zoom1,verdocs-sign .signed-document-container.zoom-zoom2{width:100%;margin-left:0}verdocs-sign>.document{padding-right:15px}verdocs-sign .verdocs-flag-instance{display:none !important}verdocs-sign .controls-toolbar .center-controls{display:none}verdocs-sign .controls-toolbar .right-controls .mobile-next-button{display:block;margin-right:10px}verdocs-sign .controls-toolbar .right-controls .minus,verdocs-sign .controls-toolbar .right-controls .plus{display:none}}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);margin-top:15px}verdocs-sign .fatal-error .message{max-width:360px;width:50%;font-size:16px;background:white;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#4c56cb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400;padding:0 10px}@media print{verdocs-sign .header,.controls-toolbar,.verdocs-flag-instance,verdocs-signing-progress{display:none !important}verdocs-sign{min-height:auto;background-color:white}verdocs-sign>.document{overflow:visible;height:auto;display:block;padding:0;margin:0}verdocs-sign>.document .document-separator{display:none}verdocs-sign .signed-document-container{width:100%;margin:0}}#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}.controls-toolbar{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:54px;padding:0 12px 0 24px;background-color:#ffffff;border-bottom:1px solid #e0e0e0;-webkit-box-shadow:none;box-shadow:none;font-family:"Inter", sans-serif;color:#424242;z-index:1000}.controls-toolbar .left-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.controls-toolbar .left-controls .title{font-weight:500;font-size:16px;color:#242424;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.controls-toolbar .center-controls{-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:10px;font-size:14px;display:none}.controls-toolbar .center-controls .label{color:#000000;font-weight:300}.controls-toolbar .center-controls .select-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.controls-toolbar .center-controls .select-wrapper verdocs-select-input{margin:0}.controls-toolbar .center-controls .select-wrapper verdocs-select-input .input-label{display:none}.controls-toolbar .center-controls .select-wrapper verdocs-select-input .input-element{background:transparent;border:1px solid #e0e0e0;height:32px;padding:2px 8px;min-width:60px;text-align:center;font-family:inherit;color:#424242}.controls-toolbar .center-controls .select-wrapper verdocs-select-input .input-element:focus{border-color:#2a63f6}.controls-toolbar .center-controls .count{color:#000000;font-weight:300}.controls-toolbar .right-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}.controls-toolbar .right-controls .mobile-next-button{display:none}.controls-toolbar .right-controls .icon-button{width:32px;height:32px;display:-ms-flexbox;display:flex;color:#424242;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:background-color 0.2s;transition:background-color 0.2s}.controls-toolbar .right-controls .icon-button:hover{background-color:#f5f5f5}.controls-toolbar .right-controls .icon-button.disabled{opacity:0.3;pointer-events:none}.controls-toolbar .right-controls .icon-button svg{display:block;width:20px;height:20px}';var ToolbarMinusIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11ZM14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z" fill="#424242" /></svg>';var ToolbarPlusIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5ZM8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z" fill="#424242" /></svg>';var ToolbarDownloadIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 16.9988C15.7761 16.9988 16 17.2226 16 17.4988C16 17.7442 15.8231 17.9484 15.5899 17.9907L15.5 17.9988H4.5C4.22386 17.9988 4 17.7749 4 17.4988C4 17.2533 4.17688 17.0492 4.41012 17.0068L4.5 16.9988H15.5ZM10.0001 2.00098C10.2456 2.00098 10.4497 2.17798 10.492 2.41124L10.5 2.50112L10.496 14.295L14.1414 10.6466C14.3148 10.4729 14.5842 10.4534 14.7792 10.5882L14.8485 10.646C15.0222 10.8194 15.0418 11.0888 14.907 11.2838L14.8492 11.3531L10.3574 15.8531C10.285 15.9257 10.1957 15.9714 10.1021 15.9901L9.99608 15.9999C9.83511 15.9999 9.69192 15.9237 9.60051 15.8056L5.14386 11.3537C4.94846 11.1586 4.94823 10.842 5.14336 10.6466C5.3168 10.4729 5.58621 10.4534 5.78117 10.5883L5.85046 10.6461L9.496 14.287L9.5 2.50083C9.50008 2.22469 9.724 2.00098 10.0001 2.00098Z" fill="#424242"/></svg>';var ToolbarPrintIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 4.5C5 3.67157 5.67157 3 6.5 3H13.5C14.3284 3 15 3.67157 15 4.5V5H15.5C16.8807 5 18 6.11929 18 7.5V12.5C18 13.3284 17.3284 14 16.5 14H15V15.5C15 16.3284 14.3284 17 13.5 17H6.5C5.67157 17 5 16.3284 5 15.5V14H3.5C2.67157 14 2 13.3284 2 12.5V7.5C2 6.11929 3.11929 5 4.5 5H5V4.5ZM6 5H14V4.5C14 4.22386 13.7761 4 13.5 4H6.5C6.22386 4 6 4.22386 6 4.5V5ZM5 13V11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V13H16.5C16.7761 13 17 12.7761 17 12.5V7.5C17 6.67157 16.3284 6 15.5 6H4.5C3.67157 6 3 6.67157 3 7.5V12.5C3 12.7761 3.22386 13 3.5 13H5ZM6.5 11C6.22386 11 6 11.2239 6 11.5V15.5C6 15.7761 6.22386 16 6.5 16H13.5C13.7761 16 14 15.7761 14 15.5V11.5C14 11.2239 13.7761 11 13.5 11H6.5Z" fill="#424242"/></svg>';var VerdocsSign=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.envelopeLoaded=createEvent(this,"envelopeLoaded");this.envelopeUpdated=createEvent(this,"envelopeUpdated");this.endpoint=new VerdocsEndpoint({sessionType:"signing"});this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.toolbarStyle="controls";this.recipient=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.fatalErrorHeader="";this.fatalErrorMessage="";this.focusedField="";this.disclosures=DEFAULT_DISCLOSURES;this.fieldUpdateCounter=0;this.submitting=false;this.submitted=false;this.isDone=false;this.showDone=false;this.adoptingSignature=false;this.showLoadError=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.signatureId=null;this.initialId=null;this.documentsSingularPlural="document";this.authStep=null;this.authMethodStates={};this.pageNumber=1;this.kbaQuestions=null;this.showSpinner=false;this.declining=false;this.delegating=false;this.delegated=false;this.kbaChoices=[];this.showDownloadDialog=false;this.loading=true;this.envelope=null;this.zoomLevel="normal";this.signingProgressMode="start";this.polling=false;this.renderedPages={};this.pollingInterval=null}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,o,s,r,a;var l=this;return __generator(this,(function(c){switch(c.label){case 0:this.updateZoomFromWindow();window.addEventListener("resize",(function(){return l.updateZoomFromWindow()}));if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError("[SIGN] Missing required envelopId",500,""));return[2]}if(!this.roleId){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new SDKError("[SIGN] Missing required roleId",500,""));return[2]}if(!this.inviteCode){(i=this.sdkError)===null||i===void 0?void 0:i.emit(new SDKError("[SIGN] Missing required inviteCode",500,""));return[2]}c.label=1;case 1:c.trys.push([1,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.envelopeId," / ").concat(this.roleId));return[4,startSigningSession(this.endpoint,this.envelopeId,this.roleId,this.inviteCode)];case 2:r=c.sent();this.processAuthResponse(r);return[3,4];case 3:a=c.sent();console.log("[SIGN] Error with signing session",a);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(a.message,(o=a.response)===null||o===void 0?void 0:o.status,(s=a.response)===null||s===void 0?void 0:s.data));this.showLoadError=true;return[3,4];case 4:return[2]}}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var t=document.getElementById("verdocs-sign-header");if(e&&t){console.log("[SIGN] Moving header");t.remove();e.append(t)}this.setupIntersectionObserver()};e.prototype.disconnectedCallback=function(){var e=this;var t;this.stopPolling();(t=this.observer)===null||t===void 0?void 0:t.disconnect();window.removeEventListener("resize",(function(){return e.updateZoomFromWindow()}))};e.prototype.updateZoomFromWindow=function(){var e=window.innerWidth;if(e<768){if(this.zoomLevel!=="zoom2")this.zoomLevel="zoom2"}else if(e<1024){if(this.zoomLevel!=="zoom1")this.zoomLevel="zoom1"}else{if(this.zoomLevel!=="normal")this.zoomLevel="normal"}};e.prototype.setupIntersectionObserver=function(){var e=this;var t=this.el.querySelectorAll("verdocs-envelope-document-page");if(t.length===0)return;if(this.observer){this.observer.disconnect()}var i=this.el.querySelector(".signed-document-container");var n={root:i,rootMargin:"-40% 0px -40% 0px",threshold:0};this.observer=new IntersectionObserver((function(t){t.forEach((function(t){if(t.isIntersecting){var i=t.target.id;var n=parseInt(i.replace("page-",""),10);if(!isNaN(n)&&e.pageNumber!==n){e.pageNumber=n}}}))}),n);t.forEach((function(t){return e.observer.observe(t)}))};e.prototype.processAuthResponse=function(e){var t,i,n,o,s,r,a,l;var c=e.envelope,d=e.recipient;(t=c.documents)===null||t===void 0?void 0:t.sort((function(e,t){return e.order!==t.order?t.order-e.order:t.created_at.localeCompare(e.created_at)}));var u=d.auth_step;this.recipient=d;this.envelope=c;this.disclosures=((n=(i=this.envelope)===null||i===void 0?void 0:i.organization)===null||n===void 0?void 0:n.disclaimer)||DEFAULT_DISCLOSURES;this.authStep=u;this.delegated=!!d.delegated_to;this.agreed=d.agreed;this.signatureId=((s=(o=e.signatures)===null||o===void 0?void 0:o[0])===null||s===void 0?void 0:s.id)||null;this.initialId=((a=(r=e.initials)===null||r===void 0?void 0:r[0])===null||a===void 0?void 0:a.id)||null;this.submitted=d.status==="submitted";this.loading=false;this.isDone=this.submitted;this.showDone=this.submitted;Store.updateEnvelope(this.envelopeId,c);if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.authMethodStates=d.auth_method_states||{};this.kbaQuestions=d.kba_questions;if(Object.values(this.authMethodStates).includes("failed")){this.fatalErrorHeader="Recipient Verification Failed";this.fatalErrorMessage="We were unable to verify your identity. The sender has been notified.";this.isDone=true}if(this.envelope.status==="canceled"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="This envelope has been canceled. The sender has been notified."}else if(d.status==="declined"){this.fatalErrorHeader="Declined";this.fatalErrorMessage="You have declined to sign this request. The sender has been notified."}else if(this.agreed){this.nextButtonLabel="Next"}this.checkRecipientFields();(l=this.envelopeLoaded)===null||l===void 0?void 0:l.emit({endpoint:this.endpoint,envelope:this.envelope})};e.prototype.handleClickAgree=function(){var e=this;this.submitting=true;console.log("[SIGN] Accepting disclosures",this.disclosures);envelopeRecipientAgree(this.endpoint,this.envelopeId,this.roleId,this.disclosures).then((function(){var t;e.nextButtonLabel="Next";e.recipient.agreed=true;e.submitting=false;e.agreed=true;(t=e.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:e.endpoint,envelope:e.envelope,event:"agreed"})})).catch((function(t){var i,n,o;console.log("[SIGN] Unable to accept disclosures",t);VerdocsToast("Unable to accept disclosures, please try again later",{style:"error"});(i=e.sdkError)===null||i===void 0?void 0:i.emit(new SDKError(t.message,(n=t.response)===null||n===void 0?void 0:n.status,(o=t.response)===null||o===void 0?void 0:o.data));e.submitting=false}))};e.prototype.handlePageSelect=function(e){var t=parseInt(e.target.value);if(!isNaN(t)){this.pageNumber=t;var i=this.el.querySelector(".signed-document-container");var n=this.el.querySelector("#page-".concat(t));if(i&&n){var o=n.offsetTop-20;i.scrollTo({top:o,behavior:"smooth"})}}};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(n){switch(e.detail.id){case"later":this.finishLater=true;this.showFinishLater=true;(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});break;case"delegate":this.delegating=true;break;case"decline":this.declining=true;break;case"print":window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":this.showDownloadDialog=true;this.startPolling();break}return[2]}))}))};e.prototype.startPolling=function(){var e=this;this.stopPolling();var t=function(){var t,i,n,o,s,r;var a=((t=e.envelope)===null||t===void 0?void 0:t.status)==="complete"||!!((i=e.envelope)===null||i===void 0?void 0:i.signed);var l=(o=(n=e.envelope)===null||n===void 0?void 0:n.documents)===null||o===void 0?void 0:o.some((function(e){return e.type==="certificate"}));var c=(r=(s=e.envelope)===null||s===void 0?void 0:s.recipients)===null||r===void 0?void 0:r.every((function(e){return e.status==="submitted"}));if(a&&l)return false;if(!c)return false;return true};if(!t()){return}this.polling=true;this.pollingInterval=setInterval((function(){return __awaiter(e,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,getEnvelope(this.endpoint,this.envelopeId)];case 1:e=n.sent();this.envelope=e;Store.updateEnvelope(this.envelopeId,e);this.checkRecipientFields();if(!t()){this.stopPolling()}return[3,3];case 2:i=n.sent();console.error("[SIGN] Polling error",i);this.stopPolling();return[3,3];case 3:return[2]}}))}))}),5e3)};e.prototype.stopPolling=function(){if(this.pollingInterval){clearInterval(this.pollingInterval);this.pollingInterval=null}this.polling=false};e.prototype.handleZoomIn=function(){if(this.zoomLevel==="normal"){this.zoomLevel="zoom1"}else if(this.zoomLevel==="zoom1"){this.zoomLevel="zoom2"}};e.prototype.handleZoomOut=function(){if(this.zoomLevel==="zoom1"){this.zoomLevel="normal"}else if(this.zoomLevel==="zoom2"){this.zoomLevel="zoom1"}};e.prototype.updateRecipientFieldValue=function(e,t){var i=this;console.log("[SIGN] updateRecipientFieldValue",e,t);this.getRecipientFields().forEach((function(n){if(n.name===e){n.value=t.value;n.settings=t.settings;updateDocumentFieldValue(n);i.fieldUpdateCounter++;i.markEnvelopeStarted();i.checkRecipientFields()}}))};e.prototype.markEnvelopeStarted=function(){var e=JSON.parse(localStorage.getItem("startedEnvelopes")||"[]");if(!e.includes(this.envelopeId)){e.push(this.envelopeId);while(e.length>10){e.shift()}localStorage.setItem("startedEnvelopes",JSON.stringify(e))}};e.prototype.saveFieldChange=function(e,t,i){var n=this;var o=this.getRecipientFields().find((function(t){return t.name===e}));if(o===null||o===void 0?void 0:o.readonly){return}console.log("[SIGN] saveFieldChange",e,{value:t,prepared:i});updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e,t,i).then((function(t){return n.updateRecipientFieldValue(e,t)})).catch((function(e){var t,i,o,s,r,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((o=(i=e.response)===null||i===void 0?void 0:i.data)===null||o===void 0?void 0:o.error)==="jwt expired"){console.log("[SIGN] Signing session expired");n.fatalErrorHeader="Signing Session Expired";n.fatalErrorMessage="Please reload your browser to continue."}else{console.log("[SIGN] Server error",e);VerdocsToast("Unable to save change, please try again later",{style:"error"})}(s=n.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(e.message,(r=e.response)===null||r===void 0?void 0:r.status,(a=e.response)===null||a===void 0?void 0:a.data))}))};e.prototype.handleFieldChange=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,o,s,r,r,r,a,r,r,r,l,c;var d=this;return __generator(this,(function(u){switch(u.label){case 0:i=t.target,n=i.value,o=i.checked;s=e.type;switch(s){case"textarea":return[3,1];case"textbox":return[3,1];case"checkbox":return[3,2];case"radio":return[3,3];case"dropdown":return[3,4];case"initial":return[3,5];case"signature":return[3,14];case"date":return[3,23];case"timestamp":return[3,24]}return[3,25];case 1:return[2,this.saveFieldChange(e.name,n,false)];case 2:{return[2,this.saveFieldChange(e.name,String(t.target.checked),false)]}u.label=3;case 3:{return[2,this.saveFieldChange(e.name,String(t.target.checked),false)]}u.label=4;case 4:console.log("Saving dropdown",e.name,t.detail);return[2,this.saveFieldChange(e.name,t.detail,false)];case 5:if(t.detail===undefined){return[2]}if(!(t.detail===null))return[3,7];console.log("[SIGN] Clearing initial");return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,null,false)];case 6:r=u.sent();return[2,this.updateRecipientFieldValue(e.name,r)];case 7:if(!this.initialId)return[3,9];console.log("[SIGN] Reusing initial",this.initialId);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,this.initialId,false)];case 8:r=u.sent();return[2,this.updateRecipientFieldValue(e.name,r)];case 9:if(!(typeof t.detail==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.detail)))return[3,11];console.log("[SIGN] Reusing initial",t.detail);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.detail,false)];case 10:r=u.sent();this.initialId=t.detail;return[2,this.updateRecipientFieldValue(e.name,r)];case 11:this.showSpinner=true;return[4,fetch(t.detail)];case 12:return[4,u.sent().blob()];case 13:a=u.sent();return[2,createInitials(this.endpoint,"initial",a).then((function(t){return __awaiter(d,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.id,false)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.initialId=t.id;this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.log("Error updating initials",e);VerdocsToast("Unable to save initials, please try again later",{style:"error"});d.showSpinner=false}))];case 14:if(t.detail===undefined){return[2]}if(!(t.detail===null))return[3,16];console.log("[SIGN] Clearing signature");return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,null,false)];case 15:r=u.sent();return[2,this.updateRecipientFieldValue(e.name,r)];case 16:if(!this.signatureId)return[3,18];console.log("[SIGN] Reusing signature",this.signatureId);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,this.signatureId,false)];case 17:r=u.sent();return[2,this.updateRecipientFieldValue(e.name,r)];case 18:if(!(typeof t.detail==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.detail)))return[3,20];console.log("[SIGN] Reusing signature",t.detail);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.detail,false)];case 19:r=u.sent();this.signatureId=t.detail;return[2,this.updateRecipientFieldValue(e.name,r)];case 20:this.showSpinner=true;return[4,fetch(t.detail)];case 21:return[4,u.sent().blob()];case 22:l=u.sent();console.log("[SIGN] Creating new signature");return[2,createSignature(this.endpoint,"signature",l).then((function(t){return __awaiter(d,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:console.log("Signature update result",t);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.id,false)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.signatureId=t.id;this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.warn("[SIGN] Error updating signature",e);VerdocsToast("Unable to save signature, please try again later",{style:"error"});d.showSpinner=false}))];case 23:c=t.detail.formattedDate;if(c){return[2,this.saveFieldChange(e.name,c,false)]}return[3,26];case 24:console.log("[SIGN] Updating timestamp",{value:n,ts:t.target.getAttribute("timestamp")});return[3,26];case 25:console.log("[SIGN] Unhandled field update",{value:n,checked:o},e);return[3,26];case 26:return[2]}}))}))};e.prototype.getSortedFillableFields=function(){var e=this.getRecipientFields().filter((function(e){return e.type!=="timestamp"&&!e.readonly}));sortFields(e);return e};e.prototype.handleNext=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,o,s,r;var a=this;return __generator(this,(function(l){switch(l.label){case 0:if(!this.nextSubmits)return[3,5];l.label=1;case 1:l.trys.push([1,3,,4]);(e=document.getElementById("air-datepicker-global-container"))===null||e===void 0?void 0:e.remove();this.submitting=true;return[4,envelopeRecipientSubmit(this.endpoint,this.envelopeId,this.roleId)];case 2:t=l.sent();console.log("[SIGN] Submitted successfully",t);window.location.reload();return[3,4];case 3:i=l.sent();console.log("[SIGN] Error submitting",i);this.submitting=false;VerdocsToast("Unable to submit document, please try again.",{style:"error"});return[3,4];case 4:return[2];case 5:n=this.getSortedFillableFields().filter((function(e){return!a.isFieldActuallyFilled(e)}));o=this.getNextFieldFromList(n);if(o){s=getFieldId(o);r=document.getElementById(s);r===null||r===void 0?void 0:r.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});r===null||r===void 0?void 0:r.focusField();this.focusedField=o.name}return[2]}}))}))};e.prototype.getRecipientFields=function(){var e=this;var t;return((t=this.envelope)===null||t===void 0?void 0:t.fields.filter((function(t){return t.role_name===e.recipient.role_name})))||[]};e.prototype.checkRecipientFields=function(){var e=this;var t=this.getRecipientFields().filter((function(t){return!isFieldValid(t,e.getRecipientFields())}));if(t.length<1){this.nextButtonLabel="Finish";if(!this.nextSubmits){this.nextSubmits=true}}else{this.nextButtonLabel="Next";this.nextSubmits=false}this.updateAllFlags();var i=JSON.parse(localStorage.getItem("startedEnvelopes")||"[]");var n=i.includes(this.envelopeId);if(this.nextSubmits){this.signingProgressMode="completed"}else if(n){this.signingProgressMode="signing"}else{this.signingProgressMode="start"}};e.prototype.isFieldActuallyFilled=function(e){if(e.type==="radio"&&e.group){var t=this.getRecipientFields().some((function(t){return t.group===e.group&&t.value==="true"}));if(t){return true}}return isFieldFilled(e,this.getRecipientFields())&&(e.type!=="dropdown"||!!e.value)&&(e.type!=="radio"||e.value==="true")&&(e.type!=="checkbox"||e.value==="true")};e.prototype.getNextRequiredField=function(){var e=this;var t=this.getSortedFillableFields().filter((function(t){return t.required&&!e.isFieldActuallyFilled(t)}));sortFields(t);if(t.length===0){var i=this.getSortedFillableFields().filter((function(t){return!e.isFieldActuallyFilled(t)}));sortFields(i);if(i.length>0){return this.getNextFieldFromList(i)}return null}return this.getNextFieldFromList(t)};e.prototype.getNextFieldFromList=function(e){var t=this;var i=e.findIndex((function(e){return e.name===t.focusedField}));var n=i+1;if(n>=e.length){n=0}return e[n]};e.prototype.handlePrev=function(){var e=this;var t;var i=this.getSortedFillableFields();var n=i.findIndex((function(t){return t.name===e.focusedField}));if(n>0){var o=i[n-1];var s=getFieldId(o);var r=document.getElementById(s);r===null||r===void 0?void 0:r.scrollIntoView({behavior:"smooth",block:"center"});(t=r===null||r===void 0?void 0:r.focusField)===null||t===void 0?void 0:t.call(r);this.focusedField=o.name}};e.prototype.updateAllFlags=function(){var e=this;Object.values(this.renderedPages).forEach((function(t){e.updateFlagsForPage(t)}))};e.prototype.updateFlagsForPage=function(e){var t=this;if(!e)return;var i=document.getElementById(e.containerId+"-controls");if(!i)return;var n=i.querySelectorAll(".verdocs-flag-instance");n.forEach((function(e){return e.remove()}));var o=this.getNextRequiredField();var s=this.getRecipientFields().find((function(e){return e.name===t.focusedField}));if(s&&!isFieldFilled(s,this.getRecipientFields())){o=s}if(o&&o.page===e.pageNumber&&o.document_id===e.documentId){var r="fill";var a="FILL";var l=false;if(!o.required){a="FILL";l=true}renderDocumentFlag(e,o.y,o.height||defaultHeight(o.type),{variant:r,label:a,showSkip:l,onSkip:function(){t.handleNext()},onClick:function(){var e;var t=getFieldId(o);var i=document.getElementById(t);i===null||i===void 0?void 0:i.scrollIntoView({behavior:"smooth",block:"center"});(e=i===null||i===void 0?void 0:i.focusField)===null||e===void 0?void 0:e.call(i)}})}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;if(i.getAttribute("attached")==="1"){return}i.setAttribute("attached","1");i.addEventListener("input",(function(e){if(e.target.type==="radio"||e.target.type==="checkbox"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}else{n.checkRecipientFields()}}));i.addEventListener("attached",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,o,s;return __generator(this,(function(r){switch(r.label){case 0:console.log("[SIGN] onAttached",i.detail,i.target.value);this.showSpinner=true;r.label=1;case 1:r.trys.push([1,3,,4]);return[4,uploadEnvelopeFieldAttachment(this.endpoint,this.envelopeId,this.roleId,t.name,i.detail)];case 2:n=r.sent();this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();o=renderDocumentField("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,o);this.showSpinner=false;return[3,4];case 3:s=r.sent();console.log("Error uploading attachment",s);VerdocsToast("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("deleted",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,o,s;return __generator(this,(function(r){switch(r.label){case 0:console.log("[SIGN] onDeleted",i.detail,i.target.value);this.showSpinner=true;r.label=1;case 1:r.trys.push([1,3,,4]);return[4,deleteEnvelopeFieldAttachment(this.endpoint,this.envelopeId,this.roleId,t.name)];case 2:n=r.sent();console.log("[SIGN] Deleted attachment",n);this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();o=renderDocumentField("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,o);this.showSpinner=false;return[3,4];case 3:s=r.sent();console.log("Error uploading attachment",s);VerdocsToast("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("focusout",(function(e){if(t.type!=="dropdown"&&t.type!=="attachment"&&t.type!=="signature"&&t.type!=="initial"&&t.type!=="checkbox"&&t.type!=="radio"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}}));i.addEventListener("fieldChange",(function(e){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}));i.addEventListener("adopt",(function(){n.focusedField=t.name;n.adoptingSignature=true}));i.setAttribute("templateid",this.envelope.template_id);i.setAttribute("fieldname",t.name);i.setAttribute("page",e.pageNumber);i.setAttribute("xScale",e.xScale);i.setAttribute("yScale",e.yScale);var o=formatFullName(this.recipient);i.setAttribute("initials",fullNameToInitials(o));i.setAttribute("name",o);if(this.signatureId){i.setAttribute("signatureid",this.signatureId)}if(this.initialId){i.setAttribute("initialid",this.initialId)}};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;this.renderedPages["".concat(i.documentId,":").concat(i.pageNumber)]=i;var n=this.getSortedFillableFields();n.filter((function(e){return e&&e.document_id===i.documentId&&e.page===i.pageNumber})).forEach((function(e,n){var o=renderDocumentField("envelope",e,i,{disabled:false,editable:false,draggable:false,done:t.isDone},n);if(!o){return}if(Array.isArray(o)){o.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,o)}}));this.envelope.recipients.filter((function(e){return e.role_name!==t.recipient.role_name&&(e.status==="invited"||e.status==="opened"||e.status==="pending")})).forEach((function(){t.getRecipientFields().filter((function(e){return e.document_id===i.documentId&&e.page===i.pageNumber})).forEach((function(e){var n=renderDocumentField("envelope",e,i,{disabled:true,editable:false,draggable:false,done:t.isDone});if(!n){return}if(Array.isArray(n)){n.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,n)}}))}));this.checkRecipientFields();this.updateFlagsForPage(i)};e.prototype.handleAuthenticateSigner=function(e){var t=this;console.log("[SIGN] Submitting authentication step",e);verifySigner(this.endpoint,e).then((function(e){console.log("[SIGN] Verification successful",e);t.processAuthResponse(e)})).catch((function(e){var i,n,o,s,r,a;console.log("[SIGN] Error submitting authentication step",e);console.log((i=e.response)===null||i===void 0?void 0:i.data);if((s=(o=(n=e.response)===null||n===void 0?void 0:n.data)===null||o===void 0?void 0:o.error)===null||s===void 0?void 0:s.includes("failed")){t.fatalErrorHeader="Recipient Verification Failed";t.fatalErrorMessage="We were unable to verify your identity. The sender has been notified.";t.isDone=true}else{VerdocsToast(((a=(r=e.response)===null||r===void 0?void 0:r.data)===null||a===void 0?void 0:a.error)||"Unable to verify your identity. Please try again.",{style:"error"})}}))};e.prototype.render=function(){var e=this;if(this.showLoadError){return h(Host,null,h("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:function(){window.location.reload()}}))}if(!this.envelope){return h(Host,null,h("verdocs-loader",null))}if(this.fatalErrorMessage){return h(Host,{class:{agreed:this.agreed}},h("div",{class:"fatal-error"},h("div",{class:"message"},h("div",{class:"header"},this.fatalErrorHeader),h("p",null,this.fatalErrorMessage))))}if(this.delegated){return h(Host,{class:{agreed:false}},h("div",{class:"fatal-error"},h("div",{class:"message"},h("div",{class:"header"},"Delegated Signing Request"),h("p",null,"You have delegated signing to another recipient. You will not be able to sign this request again."))))}if(this.isDone){return h(Host,{class:{agreed:this.agreed}},h("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var i;return(i=e.sdkError)===null||i===void 0?void 0:i.emit(t.detail)}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(t){t.preventDefault();t.stopPropagation();e.showDone=false;e.isDone=true}}),this.submitting&&h("div",{class:"loading-indicator"},h("verdocs-loader",null)))}if(this.delegating){return h(Host,{class:"agreed"},h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("verdocs-delegate-dialog",{endpoint:this.endpoint,envelope:this.envelope,onExit:function(){return e.delegating=false},onNext:function(t){delegateRecipient(e.endpoint,e.envelopeId,e.roleId,t.detail).then((function(t){VerdocsToast("Delegation request submitted.",{style:"success"});console.log("[SIGN] Delegated successfully",t);e.delegated=true;e.delegating=false})).catch((function(e){console.log("[SIGN] Error delegating request",e);VerdocsToast("Unable to process delegation request. Please try again later.",{style:"error"})}))}}))}if(this.declining){return h(Host,{class:"agreed"},h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("verdocs-ok-dialog",{heading:"Decline Signing Request",message:"If you decline to sign this request, you will not be able to sign again in the future. The envelope sender will be notified.",buttonLabel:"OK",showCancel:true,onExit:function(){return e.declining=false},onNext:function(){envelopeRecipientDecline(e.endpoint,e.envelopeId,e.roleId).then((function(e){console.log("[SIGN] Decline result",e);window.location.reload()})).catch((function(e){console.warn("[SIGN] Error declining signing session",e);VerdocsToast("Unable to decline, please try again later",{style:"error"})}))}}))}if(!this.agreed){return h(Host,{class:"agreed"},h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("verdocs-disclosure-dialog",{disclosures:this.disclosures,delegator:this.recipient.delegator,onDelegate:function(){return e.delegating=true},onDecline:function(){return e.declining=true},onAccept:function(){return e.handleClickAgree()}}))}if(this.authStep==="passcode"){return h("verdocs-passcode-dialog",{endpoint:this.endpoint,onNext:function(t){return e.processAuthResponse(t.detail.response)}})}if(this.authStep==="email"){return h("verdocs-otp-dialog",{endpoint:this.endpoint,method:"email",onNext:function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.processAuthResponse(t.detail.response);return[2]}))}))}})}if(this.authStep==="kba"&&!this.authMethodStates.kba){return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},h("verdocs-kba-dialog",{mode:"identity",helptitle:"Document requires identity verification",helptext:"Please complete your contact details to proceed.",recipient:this.recipient,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(i){e=t.detail;this.handleAuthenticateSigner({auth_method:"kba",first_name:e.first_name,last_name:e.last_name,address:e.address,city:e.city,state:e.state,zip:e.zip,dob:e.dob});return[2]}))}))}}))))}if(this.authStep==="kba"&&this.authMethodStates.kba==="questions"){var t=this.kbaChoices.length;var i=this.kbaQuestions[t];return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},this.kbaChoices.length>=this.kbaQuestions.length?h("verdocs-spinner",null):h("verdocs-kba-dialog",{mode:"choice",helptitle:"Your identity requires additional verification",helptext:(i===null||i===void 0?void 0:i.prompt)||"Please select one of the options below.",choices:(i===null||i===void 0?void 0:i.answer)||["Skip Question"],step:t+1,steps:this.kbaQuestions.length,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i;var n=this;return __generator(this,(function(o){e=t.detail;this.kbaChoices=__spreadArray(__spreadArray([],this.kbaChoices,true),[e],false);if(this.kbaChoices.length>=this.kbaQuestions.length){i=this.kbaQuestions.map((function(e,t){return{type:e.type,answer:n.kbaChoices[t]}}));console.log("Submitting KBA responses",this.kbaChoices,i);this.handleAuthenticateSigner({auth_method:"kba",responses:i})}return[2]}))}))}}))))}var n=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var o=[{id:"print",label:"Print"},{id:"download",label:"Download"}];if(this.recipient.delegator){n.unshift({id:"delegate",label:"Delegate"})}var s=this.getRecipientFields().filter((function(t){return!isFieldValid(t,e.getRecipientFields())}));s.length>0?console.log("[SIGN] Invalid fields remaining",s.map((function(e){return e.name}))):console.log("[SIGN] All field valid");var r=this.envelope.documents.reduce((function(e,t){return e+t.pages}),0);var a=integerSequence(1,r).map((function(e){return{label:e.toString(),value:e.toString()}}));var l=0;return h(Host,null,this.toolbarStyle==="menu"&&h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name),h("div",{style:{flex:"1"}}),!this.finishLater&&h("verdocs-button",{size:"xsmall",label:this.nextButtonLabel,disabled:!this.agreed||this.submitting,onClick:function(){return e.handleNext()}}),h("div",{style:{marginLeft:"10px"}}),h("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?n:o,onOptionSelected:function(t){return e.handleOptionSelected(t)}}))),this.toolbarStyle==="controls"&&h("div",{class:"controls-toolbar"},h("div",{class:"left-controls"},h("div",{class:"title"},this.envelope.name)),h("div",{class:"center-controls"},h("span",{class:"label"},"Page"),h("div",{class:"select-wrapper"},h("verdocs-select-input",{options:a,value:this.pageNumber.toString(),onInput:function(t){return e.handlePageSelect(t)}})),h("span",{class:"count"},"of ",r)),h("div",{class:"right-controls"},h("verdocs-button",{class:"mobile-next-button",label:this.nextButtonLabel,size:"xsmall",disabled:!this.agreed||this.submitting,onClick:function(){return e.handleNext()}}),h("div",{class:{"icon-button":true,minus:true,disabled:this.zoomLevel==="normal"},innerHTML:ToolbarMinusIcon,onClick:function(){return e.handleZoomOut()}}),h("div",{class:{"icon-button":true,plus:true,disabled:this.zoomLevel==="zoom2"},innerHTML:ToolbarPlusIcon,onClick:function(){return e.handleZoomIn()}}),h("div",{class:"icon-button download",innerHTML:ToolbarDownloadIcon,onClick:function(){return e.handleOptionSelected({detail:{id:"download"}})}}),h("div",{class:"icon-button print",innerHTML:ToolbarPrintIcon,onClick:function(){return e.handleOptionSelected({detail:{id:"print"}})}}))),h("verdocs-signing-progress",{mode:this.signingProgressMode,focusedField:this.focusedField,fields:this.getSortedFillableFields(),recipientFields:this.getRecipientFields(),onStarted:function(){e.adoptingSignature=true},onNext:function(){return e.handleNext()},onPrevious:function(){return e.handlePrev()},onExit:function(){return e.handleNext()}}),h("div",{class:"document signed-document-container zoom-".concat(this.zoomLevel)},(this.envelope.documents||[]).map((function(t){var i=integerSequence(1,t.pages);return h(Fragment,null,e.envelope.documents.length>1&&h("div",{class:"document-separator"},h("div",{innerHTML:DocumentPageIcon}),h("span",null,t.name)),i.map((function(i){var n;var o=((n=t.page_sizes)===null||n===void 0?void 0:n[i])||{width:612,height:792};l++;return h("verdocs-envelope-document-page",{id:"page-".concat(l),envelopeId:e.envelopeId,documentId:t.id,endpoint:e.endpoint,virtualWidth:o.width,virtualHeight:o.height,pageNumber:i,onPageRendered:function(t){return e.handlePageRendered(t)},type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&h("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the ".concat(this.documentsSingularPlural,", use the link in the original email notification inviting you to review and finish the document."),onNext:function(){e.isDone=true;e.showFinishLater=false}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}),this.adoptingSignature&&h("verdocs-adopt-signature-dialog",{name:formatFullName(this.recipient),onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,o,s,r,a,l;var c=this;return __generator(this,(function(d){switch(d.label){case 0:console.log("[SIGN] Adopting signature/initials block",t.detail);this.showSpinner=true;return[4,fetch(t.detail.signature)];case 1:return[4,d.sent().blob()];case 2:e=d.sent();return[4,fetch(t.detail.initials)];case 3:return[4,d.sent().blob()];case 4:i=d.sent();return[4,createSignature(this.endpoint,"signature",e)];case 5:n=d.sent();console.log("[SIGN] Created signature",n);this.signatureId=n.id;return[4,createInitials(this.endpoint,"initial",i)];case 6:o=d.sent();console.log("[SIGN] Created initials",o);this.initialId=o.id;this.showSpinner=false;this.adoptingSignature=false;s=JSON.parse(localStorage.getItem("startedEnvelopes")||"[]");if(!s.includes(this.envelopeId)){s.push(this.envelopeId);while(s.length>10){s.shift()}localStorage.setItem("startedEnvelopes",JSON.stringify(s))}if(!this.focusedField)return[3,11];r=this.getRecipientFields().find((function(e){return e.name===c.focusedField}));if(!r)return[3,10];if(!(r.type==="signature"))return[3,8];return[4,this.handleFieldChange(r,{detail:this.signatureId})];case 7:d.sent();return[3,10];case 8:if(!(r.type==="initial"))return[3,10];return[4,this.handleFieldChange(r,{detail:this.initialId})];case 9:d.sent();d.label=10;case 10:this.focusedField="";d.label=11;case 11:a=this.el.querySelectorAll("verdocs-field-signature");a.forEach((function(e){return e.setAttribute("signatureid",c.signatureId)}));l=this.el.querySelectorAll("verdocs-field-initial");l.forEach((function(e){return e.setAttribute("initialid",c.initialId)}));this.checkRecipientFields();return[2]}}))}))},onExit:function(){return e.adoptingSignature=false}}),(this.submitting||this.showSpinner)&&h("verdocs-portal",null,h("div",{class:"spinner-overlay"},h("verdocs-spinner",null))),this.showDownloadDialog&&h("verdocs-download-dialog",{signed:this.envelope.signed,polling:this.polling,documents:this.envelope.documents,onExit:function(){e.showDownloadDialog=false;e.stopPolling()},onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,o,s,r,a,r,l,r,c,d;return __generator(this,(function(u){switch(u.label){case 0:this.showDownloadDialog=false;this.stopPolling();i=t.detail,n=i.action,o=i.documentId;console.log("[SIGN] Download action selected:",n,o);u.label=1;case 1:u.trys.push([1,11,,12]);if(!(n==="document"))return[3,4];s=o||((e=this.envelope.documents.find((function(e){return e.type==="attachment"})))===null||e===void 0?void 0:e.id);if(!s)return[3,3];return[4,getEnvelopeDocumentDownloadLink(this.endpoint,s)];case 2:r=u.sent();window.open(r,"_blank");u.label=3;case 3:return[3,10];case 4:if(!(n==="certificate"))return[3,8];a=this.envelope.documents.find((function(e){return e.type==="certificate"}));if(!a)return[3,6];return[4,getEnvelopeDocumentDownloadLink(this.endpoint,a.id)];case 5:r=u.sent();window.open(r,"_blank");return[3,7];case 6:VerdocsToast("Certificate not yet available.",{style:"info"});u.label=7;case 7:return[3,10];case 8:if(!(n==="zip"))return[3,10];return[4,getEnvelopesZip(this.endpoint,[this.envelopeId])];case 9:l=u.sent();r=window.URL.createObjectURL(l.data);c=document.createElement("a");c.href=r;c.download="".concat(this.envelope.name,".zip");document.body.appendChild(c);c.click();c.remove();window.URL.revokeObjectURL(r);u.label=10;case 10:return[3,12];case 11:d=u.sent();console.error("Download error",d);VerdocsToast("Unable to complete download request.",{style:"error"});return[3,12];case 12:return[2]}}))}))}}),!this.loading&&!this.isDone&&h("verdocs-sign-footer",{endpoint:this.endpoint,envelopeId:this.envelopeId,isDone:this.isDone,onAskQuestion:function(t){askQuestion(e.endpoint,e.envelopeId,e.roleId,{question:t.detail.question}).then((function(){return VerdocsToast("Your question has been sent.",{style:"success"})})).catch((function(e){console.log("Error asking question",e);VerdocsToast("Unable to send question, please try again later.",{style:"error"})}))},onDecline:function(){return e.declining=true},onFinishLater:function(){return e.showFinishLater=true}}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,i,n){function o(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,s){function r(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n["throw"](e))}catch(e){s(e)}}function l(e){e.done?i(e.value):o(e.value).then(r,a)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,r=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return r.next=a(0),r["throw"]=a(1),r["return"]=a(2),typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(i=0)),i)try{if(n=1,o&&(s=a[0]&2?o["return"]:a[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,a[1])).done)return s;if(o=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;o=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];o=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var n=0,o=t.length,s;n<o;n++){if(s||!(n in t)){if(!s)s=Array.prototype.slice.call(t,0,n);s[n]=t[n]}}return e.concat(s||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-BIRwgFLv.js";import{VerdocsEndpoint,DEFAULT_DISCLOSURES,startSigningSession,envelopeRecipientAgree,getEnvelope,updateEnvelopeField,createSignature,createInitials,sortFields,envelopeRecipientSubmit,isFieldValid,isFieldFilled,uploadEnvelopeFieldAttachment,deleteEnvelopeFieldAttachment,formatFullName,fullNameToInitials,verifySigner,delegateRecipient,envelopeRecipientDecline,integerSequence,askQuestion,getEnvelopeDocumentDownloadLink,getEnvelopesZip}from"@verdocs/js-sdk";import{u as updateDocumentFieldValue,g as getFieldId,r as renderDocumentFlag,a as renderDocumentField,d as defaultHeight}from"./utils-Deu82Q9L.js";import{D as DocumentPageIcon}from"./Icons-COC8ZzcY.js";import{V as VerdocsToast}from"./Toast-CyvDgtoV.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-bS8INhRF.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsSignCss='verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;min-height:700px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#f5f5f5;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-sign verdocs-button>button.standard{background:#2a63f6}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;padding-right:140px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign>.document .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;max-width:1028px;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-sign>.document .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-sign>.document .document-separator:first-child{margin-top:0}verdocs-sign .signed-document-container{width:64%;margin-left:260px;-webkit-transition:all 0.3s ease;transition:all 0.3s ease}verdocs-sign .signed-document-container.zoom-normal{width:64%;margin-left:260px}verdocs-sign .signed-document-container.zoom-zoom1{width:80%;margin-left:200px}verdocs-sign .signed-document-container.zoom-zoom2{width:100%;margin-left:150px}verdocs-sign .signed-document-container.zoom-zoom2 .verdocs-flag-instance{opacity:0;pointer-events:none}@media (max-width: 768px){verdocs-sign verdocs-sign-footer{padding:0 10px}verdocs-sign verdocs-sign-footer .buttons{gap:8px}verdocs-sign verdocs-sign-footer .buttons button{font-size:10px}verdocs-sign .signed-document-container{width:100%;margin-left:0}verdocs-sign .signed-document-container.zoom-normal,verdocs-sign .signed-document-container.zoom-zoom1,verdocs-sign .signed-document-container.zoom-zoom2{width:100%;margin-left:0}verdocs-sign>.document{padding-right:15px}verdocs-sign .verdocs-flag-instance{display:none !important}verdocs-sign .controls-toolbar .center-controls{display:none}verdocs-sign .controls-toolbar .right-controls .mobile-next-button{display:block;margin-right:10px}verdocs-sign .controls-toolbar .right-controls .minus,verdocs-sign .controls-toolbar .right-controls .plus{display:none}}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);margin-top:15px}verdocs-sign .fatal-error .message{max-width:360px;width:50%;font-size:16px;background:white;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#4c56cb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400;padding:0 10px}@media print{verdocs-sign .header,.controls-toolbar,.verdocs-flag-instance,verdocs-signing-progress{display:none !important}verdocs-sign{min-height:auto;background-color:white}verdocs-sign>.document{overflow:visible;height:auto;display:block;padding:0;margin:0}verdocs-sign>.document .document-separator{display:none}verdocs-sign .signed-document-container{width:100%;margin:0}}#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}.controls-toolbar{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:54px;padding:0 12px 0 24px;background-color:#ffffff;border-bottom:1px solid #e0e0e0;-webkit-box-shadow:none;box-shadow:none;font-family:"Inter", sans-serif;color:#424242;z-index:1000}.controls-toolbar .left-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.controls-toolbar .left-controls .title{font-weight:500;font-size:16px;color:#242424;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.controls-toolbar .center-controls{-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:10px;font-size:14px;display:none}.controls-toolbar .center-controls .label{color:#000000;font-weight:300}.controls-toolbar .center-controls .select-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.controls-toolbar .center-controls .select-wrapper verdocs-select-input{margin:0}.controls-toolbar .center-controls .select-wrapper verdocs-select-input .input-label{display:none}.controls-toolbar .center-controls .select-wrapper verdocs-select-input .input-element{background:transparent;border:1px solid #e0e0e0;height:32px;padding:2px 8px;min-width:60px;text-align:center;font-family:inherit;color:#424242}.controls-toolbar .center-controls .select-wrapper verdocs-select-input .input-element:focus{border-color:#2a63f6}.controls-toolbar .center-controls .count{color:#000000;font-weight:300}.controls-toolbar .right-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}.controls-toolbar .right-controls .mobile-next-button{display:none}.controls-toolbar .right-controls .icon-button{width:32px;height:32px;display:-ms-flexbox;display:flex;color:#424242;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:background-color 0.2s;transition:background-color 0.2s}.controls-toolbar .right-controls .icon-button:hover{background-color:#f5f5f5}.controls-toolbar .right-controls .icon-button.disabled{opacity:0.3;pointer-events:none}.controls-toolbar .right-controls .icon-button svg{display:block;width:20px;height:20px}';var ToolbarMinusIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11ZM14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z" fill="#424242" /></svg>';var ToolbarPlusIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5ZM8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z" fill="#424242" /></svg>';var ToolbarDownloadIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 16.9988C15.7761 16.9988 16 17.2226 16 17.4988C16 17.7442 15.8231 17.9484 15.5899 17.9907L15.5 17.9988H4.5C4.22386 17.9988 4 17.7749 4 17.4988C4 17.2533 4.17688 17.0492 4.41012 17.0068L4.5 16.9988H15.5ZM10.0001 2.00098C10.2456 2.00098 10.4497 2.17798 10.492 2.41124L10.5 2.50112L10.496 14.295L14.1414 10.6466C14.3148 10.4729 14.5842 10.4534 14.7792 10.5882L14.8485 10.646C15.0222 10.8194 15.0418 11.0888 14.907 11.2838L14.8492 11.3531L10.3574 15.8531C10.285 15.9257 10.1957 15.9714 10.1021 15.9901L9.99608 15.9999C9.83511 15.9999 9.69192 15.9237 9.60051 15.8056L5.14386 11.3537C4.94846 11.1586 4.94823 10.842 5.14336 10.6466C5.3168 10.4729 5.58621 10.4534 5.78117 10.5883L5.85046 10.6461L9.496 14.287L9.5 2.50083C9.50008 2.22469 9.724 2.00098 10.0001 2.00098Z" fill="#424242"/></svg>';var ToolbarPrintIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 4.5C5 3.67157 5.67157 3 6.5 3H13.5C14.3284 3 15 3.67157 15 4.5V5H15.5C16.8807 5 18 6.11929 18 7.5V12.5C18 13.3284 17.3284 14 16.5 14H15V15.5C15 16.3284 14.3284 17 13.5 17H6.5C5.67157 17 5 16.3284 5 15.5V14H3.5C2.67157 14 2 13.3284 2 12.5V7.5C2 6.11929 3.11929 5 4.5 5H5V4.5ZM6 5H14V4.5C14 4.22386 13.7761 4 13.5 4H6.5C6.22386 4 6 4.22386 6 4.5V5ZM5 13V11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V13H16.5C16.7761 13 17 12.7761 17 12.5V7.5C17 6.67157 16.3284 6 15.5 6H4.5C3.67157 6 3 6.67157 3 7.5V12.5C3 12.7761 3.22386 13 3.5 13H5ZM6.5 11C6.22386 11 6 11.2239 6 11.5V15.5C6 15.7761 6.22386 16 6.5 16H13.5C13.7761 16 14 15.7761 14 15.5V11.5C14 11.2239 13.7761 11 13.5 11H6.5Z" fill="#424242"/></svg>';var VerdocsSign=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.envelopeLoaded=createEvent(this,"envelopeLoaded");this.envelopeUpdated=createEvent(this,"envelopeUpdated");this.endpoint=new VerdocsEndpoint({sessionType:"signing"});this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.toolbarStyle="controls";this.recipient=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.fatalErrorHeader="";this.fatalErrorMessage="";this.focusedField="";this.disclosures=DEFAULT_DISCLOSURES;this.fieldUpdateCounter=0;this.submitting=false;this.submitted=false;this.isDone=false;this.showDone=false;this.adoptingSignature=false;this.showLoadError=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.signatureId=null;this.initialId=null;this.documentsSingularPlural="document";this.authStep=null;this.authMethodStates={};this.pageNumber=1;this.kbaQuestions=null;this.showSpinner=false;this.declining=false;this.delegating=false;this.delegated=false;this.kbaChoices=[];this.showDownloadDialog=false;this.loading=true;this.envelope=null;this.zoomLevel="normal";this.signingProgressMode="start";this.polling=false;this.renderedPages={};this.pollingInterval=null}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,o,s,r,a;var l=this;return __generator(this,(function(c){switch(c.label){case 0:this.updateZoomFromWindow();window.addEventListener("resize",(function(){return l.updateZoomFromWindow()}));if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError("[SIGN] Missing required envelopId",500,""));return[2]}if(!this.roleId){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new SDKError("[SIGN] Missing required roleId",500,""));return[2]}if(!this.inviteCode){(i=this.sdkError)===null||i===void 0?void 0:i.emit(new SDKError("[SIGN] Missing required inviteCode",500,""));return[2]}c.label=1;case 1:c.trys.push([1,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.envelopeId," / ").concat(this.roleId));return[4,startSigningSession(this.endpoint,this.envelopeId,this.roleId,this.inviteCode)];case 2:r=c.sent();this.processAuthResponse(r);return[3,4];case 3:a=c.sent();console.log("[SIGN] Error with signing session",a);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(a.message,(o=a.response)===null||o===void 0?void 0:o.status,(s=a.response)===null||s===void 0?void 0:s.data));this.showLoadError=true;return[3,4];case 4:return[2]}}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var t=document.getElementById("verdocs-sign-header");if(e&&t){console.log("[SIGN] Moving header");t.remove();e.append(t)}this.setupIntersectionObserver()};e.prototype.disconnectedCallback=function(){var e=this;var t;this.stopPolling();(t=this.observer)===null||t===void 0?void 0:t.disconnect();window.removeEventListener("resize",(function(){return e.updateZoomFromWindow()}))};e.prototype.updateZoomFromWindow=function(){var e=window.innerWidth;if(e<768){if(this.zoomLevel!=="zoom2")this.zoomLevel="zoom2"}else if(e<1024){if(this.zoomLevel!=="zoom1")this.zoomLevel="zoom1"}else{if(this.zoomLevel!=="normal")this.zoomLevel="normal"}};e.prototype.setupIntersectionObserver=function(){var e=this;var t=this.el.querySelectorAll("verdocs-envelope-document-page");if(t.length===0)return;if(this.observer){this.observer.disconnect()}var i=this.el.querySelector(".signed-document-container");var n={root:i,rootMargin:"-40% 0px -40% 0px",threshold:0};this.observer=new IntersectionObserver((function(t){t.forEach((function(t){if(t.isIntersecting){var i=t.target.id;var n=parseInt(i.replace("page-",""),10);if(!isNaN(n)&&e.pageNumber!==n){e.pageNumber=n}}}))}),n);t.forEach((function(t){return e.observer.observe(t)}))};e.prototype.processAuthResponse=function(e){var t,i,n,o,s,r,a,l;var c=e.envelope,d=e.recipient;(t=c.documents)===null||t===void 0?void 0:t.sort((function(e,t){return e.order!==t.order?t.order-e.order:t.created_at.localeCompare(e.created_at)}));var u=d.auth_step;this.recipient=d;this.envelope=c;this.disclosures=((n=(i=this.envelope)===null||i===void 0?void 0:i.organization)===null||n===void 0?void 0:n.disclaimer)||DEFAULT_DISCLOSURES;this.authStep=u;this.delegated=!!d.delegated_to;this.agreed=d.agreed;this.signatureId=((s=(o=e.signatures)===null||o===void 0?void 0:o[0])===null||s===void 0?void 0:s.id)||null;this.initialId=((a=(r=e.initials)===null||r===void 0?void 0:r[0])===null||a===void 0?void 0:a.id)||null;this.submitted=d.status==="submitted";this.loading=false;this.isDone=this.submitted;this.showDone=this.submitted;Store.updateEnvelope(this.envelopeId,c);if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.authMethodStates=d.auth_method_states||{};this.kbaQuestions=d.kba_questions;if(Object.values(this.authMethodStates).includes("failed")){this.fatalErrorHeader="Recipient Verification Failed";this.fatalErrorMessage="We were unable to verify your identity. The sender has been notified.";this.isDone=true}if(this.envelope.status==="canceled"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="This envelope has been canceled. The sender has been notified."}else if(d.status==="declined"){this.fatalErrorHeader="Declined";this.fatalErrorMessage="You have declined to sign this request. The sender has been notified."}else if(this.agreed){this.nextButtonLabel="Next"}this.checkRecipientFields();(l=this.envelopeLoaded)===null||l===void 0?void 0:l.emit({endpoint:this.endpoint,envelope:this.envelope})};e.prototype.handleClickAgree=function(){var e=this;this.submitting=true;console.log("[SIGN] Accepting disclosures",this.disclosures);envelopeRecipientAgree(this.endpoint,this.envelopeId,this.roleId,this.disclosures).then((function(){var t;e.nextButtonLabel="Next";e.recipient.agreed=true;e.submitting=false;e.agreed=true;(t=e.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:e.endpoint,envelope:e.envelope,event:"agreed"})})).catch((function(t){var i,n,o;console.log("[SIGN] Unable to accept disclosures",t);VerdocsToast("Unable to accept disclosures, please try again later",{style:"error"});(i=e.sdkError)===null||i===void 0?void 0:i.emit(new SDKError(t.message,(n=t.response)===null||n===void 0?void 0:n.status,(o=t.response)===null||o===void 0?void 0:o.data));e.submitting=false}))};e.prototype.handlePageSelect=function(e){var t=parseInt(e.target.value);if(!isNaN(t)){this.pageNumber=t;var i=this.el.querySelector(".signed-document-container");var n=this.el.querySelector("#page-".concat(t));if(i&&n){var o=n.offsetTop-20;i.scrollTo({top:o,behavior:"smooth"})}}};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(n){switch(e.detail.id){case"later":this.finishLater=true;this.showFinishLater=true;(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});break;case"delegate":this.delegating=true;break;case"decline":this.declining=true;break;case"print":window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":this.showDownloadDialog=true;this.startPolling();break}return[2]}))}))};e.prototype.startPolling=function(){var e=this;this.stopPolling();var t=function(){var t,i,n,o,s,r;var a=((t=e.envelope)===null||t===void 0?void 0:t.status)==="complete"||!!((i=e.envelope)===null||i===void 0?void 0:i.signed);var l=(o=(n=e.envelope)===null||n===void 0?void 0:n.documents)===null||o===void 0?void 0:o.some((function(e){return e.type==="certificate"}));var c=(r=(s=e.envelope)===null||s===void 0?void 0:s.recipients)===null||r===void 0?void 0:r.every((function(e){return e.status==="submitted"}));if(a&&l)return false;if(!c)return false;return true};if(!t()){return}this.polling=true;this.pollingInterval=setInterval((function(){return __awaiter(e,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,getEnvelope(this.endpoint,this.envelopeId)];case 1:e=n.sent();this.envelope=e;Store.updateEnvelope(this.envelopeId,e);this.checkRecipientFields();if(!t()){this.stopPolling()}return[3,3];case 2:i=n.sent();console.error("[SIGN] Polling error",i);this.stopPolling();return[3,3];case 3:return[2]}}))}))}),5e3)};e.prototype.stopPolling=function(){if(this.pollingInterval){clearInterval(this.pollingInterval);this.pollingInterval=null}this.polling=false};e.prototype.handleZoomIn=function(){if(this.zoomLevel==="normal"){this.zoomLevel="zoom1"}else if(this.zoomLevel==="zoom1"){this.zoomLevel="zoom2"}};e.prototype.handleZoomOut=function(){if(this.zoomLevel==="zoom1"){this.zoomLevel="normal"}else if(this.zoomLevel==="zoom2"){this.zoomLevel="zoom1"}};e.prototype.updateRecipientFieldValue=function(e,t){var i=this;console.log("[SIGN] updateRecipientFieldValue",e,t);this.getRecipientFields().forEach((function(n){if(n.name===e){n.value=t.value;n.settings=t.settings;updateDocumentFieldValue(n);i.fieldUpdateCounter++;i.markEnvelopeStarted();i.checkRecipientFields()}}))};e.prototype.markEnvelopeStarted=function(){var e=JSON.parse(localStorage.getItem("startedEnvelopes")||"[]");if(!e.includes(this.envelopeId)){e.push(this.envelopeId);while(e.length>10){e.shift()}localStorage.setItem("startedEnvelopes",JSON.stringify(e))}};e.prototype.saveFieldChange=function(e,t,i){var n=this;var o=this.getRecipientFields().find((function(t){return t.name===e}));if(o===null||o===void 0?void 0:o.readonly){return}console.log("[SIGN] saveFieldChange",e,{value:t,prepared:i});updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e,t,i).then((function(t){return n.updateRecipientFieldValue(e,t)})).catch((function(e){var t,i,o,s,r,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((o=(i=e.response)===null||i===void 0?void 0:i.data)===null||o===void 0?void 0:o.error)==="jwt expired"){console.log("[SIGN] Signing session expired");n.fatalErrorHeader="Signing Session Expired";n.fatalErrorMessage="Please reload your browser to continue."}else{console.log("[SIGN] Server error",e);VerdocsToast("Unable to save change, please try again later",{style:"error"})}(s=n.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(e.message,(r=e.response)===null||r===void 0?void 0:r.status,(a=e.response)===null||a===void 0?void 0:a.data))}))};e.prototype.handleFieldChange=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,o,s,r,r,r,a,r,r,r,l,c;var d=this;return __generator(this,(function(u){switch(u.label){case 0:i=t.target,n=i.value,o=i.checked;s=e.type;switch(s){case"textarea":return[3,1];case"textbox":return[3,1];case"checkbox":return[3,2];case"radio":return[3,3];case"dropdown":return[3,4];case"initial":return[3,5];case"signature":return[3,14];case"date":return[3,23];case"timestamp":return[3,24]}return[3,25];case 1:return[2,this.saveFieldChange(e.name,n,false)];case 2:{return[2,this.saveFieldChange(e.name,String(t.target.checked),false)]}u.label=3;case 3:{return[2,this.saveFieldChange(e.name,String(t.target.checked),false)]}u.label=4;case 4:console.log("Saving dropdown",e.name,t.detail);return[2,this.saveFieldChange(e.name,t.detail,false)];case 5:if(t.detail===undefined){return[2]}if(!(t.detail===null))return[3,7];console.log("[SIGN] Clearing initial");return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,null,false)];case 6:r=u.sent();return[2,this.updateRecipientFieldValue(e.name,r)];case 7:if(!this.initialId)return[3,9];console.log("[SIGN] Reusing initial",this.initialId);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,this.initialId,false)];case 8:r=u.sent();return[2,this.updateRecipientFieldValue(e.name,r)];case 9:if(!(typeof t.detail==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.detail)))return[3,11];console.log("[SIGN] Reusing initial",t.detail);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.detail,false)];case 10:r=u.sent();this.initialId=t.detail;return[2,this.updateRecipientFieldValue(e.name,r)];case 11:this.showSpinner=true;return[4,fetch(t.detail)];case 12:return[4,u.sent().blob()];case 13:a=u.sent();return[2,createInitials(this.endpoint,"initial",a).then((function(t){return __awaiter(d,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.id,false)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.initialId=t.id;this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.log("Error updating initials",e);VerdocsToast("Unable to save initials, please try again later",{style:"error"});d.showSpinner=false}))];case 14:if(t.detail===undefined){return[2]}if(!(t.detail===null))return[3,16];console.log("[SIGN] Clearing signature");return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,null,false)];case 15:r=u.sent();return[2,this.updateRecipientFieldValue(e.name,r)];case 16:if(!this.signatureId)return[3,18];console.log("[SIGN] Reusing signature",this.signatureId);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,this.signatureId,false)];case 17:r=u.sent();return[2,this.updateRecipientFieldValue(e.name,r)];case 18:if(!(typeof t.detail==="string"&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.detail)))return[3,20];console.log("[SIGN] Reusing signature",t.detail);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.detail,false)];case 19:r=u.sent();this.signatureId=t.detail;return[2,this.updateRecipientFieldValue(e.name,r)];case 20:this.showSpinner=true;return[4,fetch(t.detail)];case 21:return[4,u.sent().blob()];case 22:l=u.sent();console.log("[SIGN] Creating new signature");return[2,createSignature(this.endpoint,"signature",l).then((function(t){return __awaiter(d,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:console.log("Signature update result",t);return[4,updateEnvelopeField(this.endpoint,this.envelopeId,this.roleId,e.name,t.id,false)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.signatureId=t.id;this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.warn("[SIGN] Error updating signature",e);VerdocsToast("Unable to save signature, please try again later",{style:"error"});d.showSpinner=false}))];case 23:c=t.detail.formattedDate;if(c){return[2,this.saveFieldChange(e.name,c,false)]}return[3,26];case 24:console.log("[SIGN] Updating timestamp",{value:n,ts:t.target.getAttribute("timestamp")});return[3,26];case 25:console.log("[SIGN] Unhandled field update",{value:n,checked:o},e);return[3,26];case 26:return[2]}}))}))};e.prototype.getSortedFillableFields=function(){var e=this.getRecipientFields().filter((function(e){return e.type!=="timestamp"&&!e.readonly}));sortFields(e);return e};e.prototype.handleNext=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,o,s,r;var a=this;return __generator(this,(function(l){switch(l.label){case 0:if(!this.nextSubmits)return[3,5];l.label=1;case 1:l.trys.push([1,3,,4]);(e=document.getElementById("air-datepicker-global-container"))===null||e===void 0?void 0:e.remove();this.submitting=true;return[4,envelopeRecipientSubmit(this.endpoint,this.envelopeId,this.roleId)];case 2:t=l.sent();console.log("[SIGN] Submitted successfully",t);window.location.reload();return[3,4];case 3:i=l.sent();console.log("[SIGN] Error submitting",i);this.submitting=false;VerdocsToast("Unable to submit document, please try again.",{style:"error"});return[3,4];case 4:return[2];case 5:n=this.getSortedFillableFields().filter((function(e){return!a.isFieldActuallyFilled(e)}));o=this.getNextFieldFromList(n);if(o){s=getFieldId(o);r=document.getElementById(s);r===null||r===void 0?void 0:r.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});r===null||r===void 0?void 0:r.focusField();this.focusedField=o.name}return[2]}}))}))};e.prototype.getRecipientFields=function(){var e=this;var t;return((t=this.envelope)===null||t===void 0?void 0:t.fields.filter((function(t){return t.role_name===e.recipient.role_name})))||[]};e.prototype.checkRecipientFields=function(){var e=this;var t=this.getRecipientFields().filter((function(t){return!isFieldValid(t,e.getRecipientFields())}));if(t.length<1){this.nextButtonLabel="Finish";if(!this.nextSubmits){this.nextSubmits=true}}else{this.nextButtonLabel="Next";this.nextSubmits=false}this.updateAllFlags();var i=JSON.parse(localStorage.getItem("startedEnvelopes")||"[]");var n=i.includes(this.envelopeId);if(this.nextSubmits){this.signingProgressMode="completed"}else if(n){this.signingProgressMode="signing"}else{this.signingProgressMode="start"}};e.prototype.isFieldActuallyFilled=function(e){if(e.type==="radio"&&e.group){var t=this.getRecipientFields().some((function(t){return t.group===e.group&&t.value==="true"}));if(t){return true}}return isFieldFilled(e,this.getRecipientFields())&&(e.type!=="dropdown"||!!e.value)&&(e.type!=="radio"||e.value==="true")&&(e.type!=="checkbox"||e.value==="true")};e.prototype.getNextRequiredField=function(){var e=this;var t=this.getSortedFillableFields().filter((function(t){return t.required&&!e.isFieldActuallyFilled(t)}));sortFields(t);if(t.length===0){var i=this.getSortedFillableFields().filter((function(t){return!e.isFieldActuallyFilled(t)}));sortFields(i);if(i.length>0){return this.getNextFieldFromList(i)}return null}return this.getNextFieldFromList(t)};e.prototype.getNextFieldFromList=function(e){var t=this;var i=e.findIndex((function(e){return e.name===t.focusedField}));var n=i+1;if(n>=e.length){n=0}return e[n]};e.prototype.handlePrev=function(){var e=this;var t;var i=this.getSortedFillableFields();var n=i.findIndex((function(t){return t.name===e.focusedField}));if(n>0){var o=i[n-1];var s=getFieldId(o);var r=document.getElementById(s);r===null||r===void 0?void 0:r.scrollIntoView({behavior:"smooth",block:"center"});(t=r===null||r===void 0?void 0:r.focusField)===null||t===void 0?void 0:t.call(r);this.focusedField=o.name}};e.prototype.updateAllFlags=function(){var e=this;Object.values(this.renderedPages).forEach((function(t){e.updateFlagsForPage(t)}))};e.prototype.updateFlagsForPage=function(e){var t=this;if(!e)return;var i=document.getElementById(e.containerId+"-controls");if(!i)return;var n=i.querySelectorAll(".verdocs-flag-instance");n.forEach((function(e){return e.remove()}));var o=this.getNextRequiredField();var s=this.getRecipientFields().find((function(e){return e.name===t.focusedField}));if(s&&!isFieldFilled(s,this.getRecipientFields())){o=s}if(o&&o.page===e.pageNumber&&o.document_id===e.documentId){var r="fill";var a="FILL";var l=false;if(!o.required){a="FILL";l=true}renderDocumentFlag(e,o.y,o.height||defaultHeight(o.type),{variant:r,label:a,showSkip:l,onSkip:function(){t.handleNext()},onClick:function(){var e;var t=getFieldId(o);var i=document.getElementById(t);i===null||i===void 0?void 0:i.scrollIntoView({behavior:"smooth",block:"center"});(e=i===null||i===void 0?void 0:i.focusField)===null||e===void 0?void 0:e.call(i)}})}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;if(i.getAttribute("attached")==="1"){return}i.setAttribute("attached","1");i.addEventListener("input",(function(e){if(e.target.type==="radio"||e.target.type==="checkbox"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}else{n.checkRecipientFields()}}));i.addEventListener("attached",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,o,s;return __generator(this,(function(r){switch(r.label){case 0:console.log("[SIGN] onAttached",i.detail,i.target.value);this.showSpinner=true;r.label=1;case 1:r.trys.push([1,3,,4]);return[4,uploadEnvelopeFieldAttachment(this.endpoint,this.envelopeId,this.roleId,t.name,i.detail)];case 2:n=r.sent();this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();o=renderDocumentField("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,o);this.showSpinner=false;return[3,4];case 3:s=r.sent();console.log("Error uploading attachment",s);VerdocsToast("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("deleted",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,o,s;return __generator(this,(function(r){switch(r.label){case 0:console.log("[SIGN] onDeleted",i.detail,i.target.value);this.showSpinner=true;r.label=1;case 1:r.trys.push([1,3,,4]);return[4,deleteEnvelopeFieldAttachment(this.endpoint,this.envelopeId,this.roleId,t.name)];case 2:n=r.sent();console.log("[SIGN] Deleted attachment",n);this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();o=renderDocumentField("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,o);this.showSpinner=false;return[3,4];case 3:s=r.sent();console.log("Error uploading attachment",s);VerdocsToast("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("focusout",(function(e){if(t.type!=="dropdown"&&t.type!=="attachment"&&t.type!=="signature"&&t.type!=="initial"&&t.type!=="checkbox"&&t.type!=="radio"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}}));i.addEventListener("fieldChange",(function(e){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}));i.addEventListener("adopt",(function(){n.focusedField=t.name;n.adoptingSignature=true}));i.setAttribute("templateid",this.envelope.template_id);i.setAttribute("fieldname",t.name);i.setAttribute("page",e.pageNumber);i.setAttribute("xScale",e.xScale);i.setAttribute("yScale",e.yScale);var o=formatFullName(this.recipient);i.setAttribute("initials",fullNameToInitials(o));i.setAttribute("name",o);if(this.signatureId){i.setAttribute("signatureid",this.signatureId)}if(this.initialId){i.setAttribute("initialid",this.initialId)}};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;this.renderedPages["".concat(i.documentId,":").concat(i.pageNumber)]=i;var n=this.getSortedFillableFields();n.filter((function(e){return e&&e.document_id===i.documentId&&e.page===i.pageNumber})).forEach((function(e,n){var o=renderDocumentField("envelope",e,i,{disabled:false,editable:false,draggable:false,done:t.isDone},n);if(!o){return}if(Array.isArray(o)){o.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,o)}}));this.envelope.recipients.filter((function(e){return e.role_name!==t.recipient.role_name&&(e.status==="invited"||e.status==="opened"||e.status==="pending")})).forEach((function(){t.getRecipientFields().filter((function(e){return e.document_id===i.documentId&&e.page===i.pageNumber})).forEach((function(e){var n=renderDocumentField("envelope",e,i,{disabled:true,editable:false,draggable:false,done:t.isDone});if(!n){return}if(Array.isArray(n)){n.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,n)}}))}));this.checkRecipientFields();this.updateFlagsForPage(i)};e.prototype.handleAuthenticateSigner=function(e){var t=this;console.log("[SIGN] Submitting authentication step",e);verifySigner(this.endpoint,e).then((function(e){console.log("[SIGN] Verification successful",e);t.processAuthResponse(e)})).catch((function(e){var i,n,o,s,r,a;console.log("[SIGN] Error submitting authentication step",e);console.log((i=e.response)===null||i===void 0?void 0:i.data);if((s=(o=(n=e.response)===null||n===void 0?void 0:n.data)===null||o===void 0?void 0:o.error)===null||s===void 0?void 0:s.includes("failed")){t.fatalErrorHeader="Recipient Verification Failed";t.fatalErrorMessage="We were unable to verify your identity. The sender has been notified.";t.isDone=true}else{VerdocsToast(((a=(r=e.response)===null||r===void 0?void 0:r.data)===null||a===void 0?void 0:a.error)||"Unable to verify your identity. Please try again.",{style:"error"})}}))};e.prototype.render=function(){var e=this;if(this.showLoadError){return h(Host,null,h("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:function(){window.location.reload()}}))}if(!this.envelope){return h(Host,null,h("verdocs-loader",null))}if(this.fatalErrorMessage){return h(Host,{class:{agreed:this.agreed}},h("div",{class:"fatal-error"},h("div",{class:"message"},h("div",{class:"header"},this.fatalErrorHeader),h("p",null,this.fatalErrorMessage))))}if(this.delegated){return h(Host,{class:{agreed:false}},h("div",{class:"fatal-error"},h("div",{class:"message"},h("div",{class:"header"},"Delegated Signing Request"),h("p",null,"You have delegated signing to another recipient. You will not be able to sign this request again."))))}if(this.isDone){return h(Host,{class:{agreed:this.agreed}},h("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var i;return(i=e.sdkError)===null||i===void 0?void 0:i.emit(t.detail)}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(t){t.preventDefault();t.stopPropagation();e.showDone=false;e.isDone=true}}),this.submitting&&h("div",{class:"loading-indicator"},h("verdocs-loader",null)))}if(this.delegating){return h(Host,{class:"agreed"},h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("verdocs-delegate-dialog",{endpoint:this.endpoint,envelope:this.envelope,onExit:function(){return e.delegating=false},onNext:function(t){delegateRecipient(e.endpoint,e.envelopeId,e.roleId,t.detail).then((function(t){VerdocsToast("Delegation request submitted.",{style:"success"});console.log("[SIGN] Delegated successfully",t);e.delegated=true;e.delegating=false})).catch((function(e){console.log("[SIGN] Error delegating request",e);VerdocsToast("Unable to process delegation request. Please try again later.",{style:"error"})}))}}))}if(this.declining){return h(Host,{class:"agreed"},h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("verdocs-ok-dialog",{heading:"Decline Signing Request",message:"If you decline to sign this request, you will not be able to sign again in the future. The envelope sender will be notified.",buttonLabel:"OK",showCancel:true,onExit:function(){return e.declining=false},onNext:function(){envelopeRecipientDecline(e.endpoint,e.envelopeId,e.roleId).then((function(e){console.log("[SIGN] Decline result",e);window.location.reload()})).catch((function(e){console.warn("[SIGN] Error declining signing session",e);VerdocsToast("Unable to decline, please try again later",{style:"error"})}))}}))}if(!this.agreed){return h(Host,{class:"agreed"},h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("verdocs-disclosure-dialog",{disclosures:this.disclosures,delegator:this.recipient.delegator,onDelegate:function(){return e.delegating=true},onDecline:function(){return e.declining=true},onAccept:function(){return e.handleClickAgree()}}))}if(this.authStep==="passcode"){return h("verdocs-passcode-dialog",{endpoint:this.endpoint,onNext:function(t){return e.processAuthResponse(t.detail.response)}})}if(this.authStep==="email"){return h("verdocs-otp-dialog",{endpoint:this.endpoint,method:"email",onNext:function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.processAuthResponse(t.detail.response);return[2]}))}))}})}if(this.authStep==="kba"&&!this.authMethodStates.kba){return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},h("verdocs-kba-dialog",{mode:"identity",helptitle:"Document requires identity verification",helptext:"Please complete your contact details to proceed.",recipient:this.recipient,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(i){e=t.detail;this.handleAuthenticateSigner({auth_method:"kba",first_name:e.first_name,last_name:e.last_name,address:e.address,city:e.city,state:e.state,zip:e.zip,dob:e.dob});return[2]}))}))}}))))}if(this.authStep==="kba"&&this.authMethodStates.kba==="questions"){var t=this.kbaChoices.length;var i=this.kbaQuestions[t];return h(Host,{class:"kba"},h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name))),h("div",{class:"document",style:{paddingTop:"15px"}},h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),h("div",{class:"cover"},h("div",{class:"kba"},this.kbaChoices.length>=this.kbaQuestions.length?h("verdocs-spinner",null):h("verdocs-kba-dialog",{mode:"choice",helptitle:"Your identity requires additional verification",helptext:(i===null||i===void 0?void 0:i.prompt)||"Please select one of the options below.",choices:(i===null||i===void 0?void 0:i.answer)||["Skip Question"],step:t+1,steps:this.kbaQuestions.length,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i;var n=this;return __generator(this,(function(o){e=t.detail;this.kbaChoices=__spreadArray(__spreadArray([],this.kbaChoices,true),[e],false);if(this.kbaChoices.length>=this.kbaQuestions.length){i=this.kbaQuestions.map((function(e,t){return{type:e.type,answer:n.kbaChoices[t]}}));console.log("Submitting KBA responses",this.kbaChoices,i);this.handleAuthenticateSigner({auth_method:"kba",responses:i})}return[2]}))}))}}))))}var n=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var o=[{id:"print",label:"Print"},{id:"download",label:"Download"}];if(this.recipient.delegator){n.unshift({id:"delegate",label:"Delegate"})}var s=this.getRecipientFields().filter((function(t){return!isFieldValid(t,e.getRecipientFields())}));s.length>0?console.log("[SIGN] Invalid fields remaining",s.map((function(e){return e.name}))):console.log("[SIGN] All field valid");var r=this.envelope.documents.reduce((function(e,t){return e+t.pages}),0);var a=integerSequence(1,r).map((function(e){return{label:e.toString(),value:e.toString()}}));var l=0;return h(Host,null,this.toolbarStyle==="menu"&&h("div",{id:"verdocs-sign-header"},h("div",{class:"inner"},h("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),h("div",{class:"title"},this.envelope.name),h("div",{style:{flex:"1"}}),!this.finishLater&&h("verdocs-button",{size:"xsmall",label:this.nextButtonLabel,disabled:!this.agreed||this.submitting,onClick:function(){return e.handleNext()}}),h("div",{style:{marginLeft:"10px"}}),h("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?n:o,onOptionSelected:function(t){return e.handleOptionSelected(t)}}))),this.toolbarStyle==="controls"&&h("div",{class:"controls-toolbar"},h("div",{class:"left-controls"},h("div",{class:"title"},this.envelope.name)),h("div",{class:"center-controls"},h("span",{class:"label"},"Page"),h("div",{class:"select-wrapper"},h("verdocs-select-input",{options:a,value:this.pageNumber.toString(),onInput:function(t){return e.handlePageSelect(t)}})),h("span",{class:"count"},"of ",r)),h("div",{class:"right-controls"},h("verdocs-button",{class:"mobile-next-button",label:this.nextButtonLabel,size:"xsmall",disabled:!this.agreed||this.submitting,onClick:function(){return e.handleNext()}}),h("div",{class:{"icon-button":true,minus:true,disabled:this.zoomLevel==="normal"},innerHTML:ToolbarMinusIcon,onClick:function(){return e.handleZoomOut()}}),h("div",{class:{"icon-button":true,plus:true,disabled:this.zoomLevel==="zoom2"},innerHTML:ToolbarPlusIcon,onClick:function(){return e.handleZoomIn()}}),h("div",{class:"icon-button download",innerHTML:ToolbarDownloadIcon,onClick:function(){return e.handleOptionSelected({detail:{id:"download"}})}}),h("div",{class:"icon-button print",innerHTML:ToolbarPrintIcon,onClick:function(){return e.handleOptionSelected({detail:{id:"print"}})}}))),h("verdocs-signing-progress",{mode:this.signingProgressMode,focusedField:this.focusedField,fields:this.getSortedFillableFields(),recipientFields:this.getRecipientFields(),onStarted:function(){e.adoptingSignature=true},onNext:function(){return e.handleNext()},onPrevious:function(){return e.handlePrev()},onExit:function(){return e.handleNext()}}),h("div",{class:"document signed-document-container zoom-".concat(this.zoomLevel)},(this.envelope.documents||[]).map((function(t){var i=integerSequence(1,t.pages);return h(Fragment,null,e.envelope.documents.length>1&&h("div",{class:"document-separator"},h("div",{innerHTML:DocumentPageIcon}),h("span",null,t.name)),i.map((function(i){var n;var o=((n=t.page_sizes)===null||n===void 0?void 0:n[i])||{width:612,height:792};l++;return h("verdocs-envelope-document-page",{id:"page-".concat(l),envelopeId:e.envelopeId,documentId:t.id,endpoint:e.endpoint,virtualWidth:o.width,virtualHeight:o.height,pageNumber:i,onPageRendered:function(t){return e.handlePageRendered(t)},type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&h("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the ".concat(this.documentsSingularPlural,", use the link in the original email notification inviting you to review and finish the document."),onNext:function(){e.isDone=true;e.showFinishLater=false}}),this.showDone&&h("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}),this.adoptingSignature&&h("verdocs-adopt-signature-dialog",{name:formatFullName(this.recipient),onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,o,s,r,a,l;var c=this;return __generator(this,(function(d){switch(d.label){case 0:console.log("[SIGN] Adopting signature/initials block",t.detail);this.showSpinner=true;return[4,fetch(t.detail.signature)];case 1:return[4,d.sent().blob()];case 2:e=d.sent();return[4,fetch(t.detail.initials)];case 3:return[4,d.sent().blob()];case 4:i=d.sent();return[4,createSignature(this.endpoint,"signature",e)];case 5:n=d.sent();console.log("[SIGN] Created signature",n);this.signatureId=n.id;return[4,createInitials(this.endpoint,"initial",i)];case 6:o=d.sent();console.log("[SIGN] Created initials",o);this.initialId=o.id;this.showSpinner=false;this.adoptingSignature=false;s=JSON.parse(localStorage.getItem("startedEnvelopes")||"[]");if(!s.includes(this.envelopeId)){s.push(this.envelopeId);while(s.length>10){s.shift()}localStorage.setItem("startedEnvelopes",JSON.stringify(s))}if(!this.focusedField)return[3,11];r=this.getRecipientFields().find((function(e){return e.name===c.focusedField}));if(!r)return[3,10];if(!(r.type==="signature"))return[3,8];return[4,this.handleFieldChange(r,{detail:this.signatureId})];case 7:d.sent();return[3,10];case 8:if(!(r.type==="initial"))return[3,10];return[4,this.handleFieldChange(r,{detail:this.initialId})];case 9:d.sent();d.label=10;case 10:this.focusedField="";d.label=11;case 11:a=this.el.querySelectorAll("verdocs-field-signature");a.forEach((function(e){return e.setAttribute("signatureid",c.signatureId)}));l=this.el.querySelectorAll("verdocs-field-initial");l.forEach((function(e){return e.setAttribute("initialid",c.initialId)}));this.checkRecipientFields();return[2]}}))}))},onExit:function(){return e.adoptingSignature=false}}),(this.submitting||this.showSpinner)&&h("verdocs-portal",null,h("div",{class:"spinner-overlay"},h("verdocs-spinner",null))),this.showDownloadDialog&&h("verdocs-download-dialog",{signed:this.envelope.signed,polling:this.polling,documents:this.envelope.documents,onExit:function(){e.showDownloadDialog=false;e.stopPolling()},onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,o,s,r,a,r,l,r,c,d;return __generator(this,(function(u){switch(u.label){case 0:this.showDownloadDialog=false;this.stopPolling();i=t.detail,n=i.action,o=i.documentId;console.log("[SIGN] Download action selected:",n,o);u.label=1;case 1:u.trys.push([1,11,,12]);if(!(n==="document"))return[3,4];s=o||((e=this.envelope.documents.find((function(e){return e.type==="attachment"})))===null||e===void 0?void 0:e.id);if(!s)return[3,3];return[4,getEnvelopeDocumentDownloadLink(this.endpoint,s)];case 2:r=u.sent();window.open(r,"_blank");u.label=3;case 3:return[3,10];case 4:if(!(n==="certificate"))return[3,8];a=this.envelope.documents.find((function(e){return e.type==="certificate"}));if(!a)return[3,6];return[4,getEnvelopeDocumentDownloadLink(this.endpoint,a.id)];case 5:r=u.sent();window.open(r,"_blank");return[3,7];case 6:VerdocsToast("Certificate not yet available.",{style:"info"});u.label=7;case 7:return[3,10];case 8:if(!(n==="zip"))return[3,10];return[4,getEnvelopesZip(this.endpoint,[this.envelopeId])];case 9:l=u.sent();r=window.URL.createObjectURL(l.data);c=document.createElement("a");c.href=r;c.download="".concat(this.envelope.name,".zip");document.body.appendChild(c);c.click();c.remove();window.URL.revokeObjectURL(r);u.label=10;case 10:return[3,12];case 11:d=u.sent();console.error("Download error",d);VerdocsToast("Unable to complete download request.",{style:"error"});return[3,12];case 12:return[2]}}))}))}}),!this.loading&&!this.isDone&&h("verdocs-sign-footer",{endpoint:this.endpoint,envelopeId:this.envelopeId,isDone:this.isDone,onAskQuestion:function(t){askQuestion(e.endpoint,e.envelopeId,e.roleId,{question:t.detail.question}).then((function(){return VerdocsToast("Your question has been sent.",{style:"success"})})).catch((function(e){console.log("Error asking question",e);VerdocsToast("Unable to send question, please try again later.",{style:"error"})}))},onDecline:function(){return e.declining=true},onFinishLater:function(){return e.showFinishLater=true}}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|
|
2
2
|
//# sourceMappingURL=verdocs-sign.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdocs-template-document-page.verdocs-toolbar-icon.entry.js","sources":["src/components/templates/verdocs-template-document-page/verdocs-template-document-page.scss?tag=verdocs-template-document-page","src/components/templates/verdocs-template-document-page/verdocs-template-document-page.tsx","src/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.scss?tag=verdocs-toolbar-icon","src/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-template-document-page {\n width: 100%;\n position: relative;\n\n .verdocs-template-document-page-layer {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n box-shadow: 0 0 10px 5px #0000000f;\n\n &.img {\n width: 100%;\n }\n }\n\n .placeholder {\n opacity: 0.1;\n width: 612px;\n height: 792px;\n box-shadow: 0 0 10px 5px #0000000f;\n }\n}\n","// NOTE: This component does not have a story because it's not intended for external use.\n\nimport {getTemplate, getTemplateDocumentPageDisplayUri, type ITemplate, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {Component, h, Host, Prop, Event, EventEmitter, State, Element, Fragment} from '@stencil/core';\nimport {IDocumentPageInfo, IPageLayer} from '../../../utils/Types';\nimport {getControlStyles, getFieldId} from '../../../utils/utils';\nimport {throttle} from '../../../utils/utils';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Represents one document page. This is primarily a layout container used to coordinate positions of\n * page-related layers such as the page itself, signature fields, etc. It is not intended to be used\n * on its own as an individual component.\n */\n@Component({\n tag: 'verdocs-template-document-page',\n styleUrl: 'verdocs-template-document-page.scss',\n shadow: false,\n})\nexport class VerdocsTemplateDocumentPage {\n private templateListenerId = null;\n private resizeObserver: ResizeObserver;\n\n @Element() container: HTMLElement;\n\n /**\n * The endpoint to load from.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * Whether the fields should be editable (Builder)\n */\n @Prop() editable = false;\n\n /**\n * Whether the fields should be disabled (Builder)\n */\n @Prop() disabled = false;\n\n /**\n * Whether the field are interactable (done/submitted disables this)\n */\n @Prop() done = false;\n\n /**\n * The ID of the template the document is for.\n */\n @Prop() templateId: string = '';\n\n /**\n * The ID of the document to display.\n */\n @Prop() documentId: string = '';\n\n /**\n * The page number being rendered. (Reminder: page numbers are 1-based.)\n */\n @Prop() pageNumber: number = 1;\n\n /**\n * The \"virtual\" width of the page canvas. Defaults to 612 which at 72dpi is 8.5\" wide. This is used to compute\n * the aspect ratio of the final rendered element when scaling up/down.\n */\n @Prop() virtualWidth: number = 612;\n\n /**\n * The \"virtual\" height of the page canvas. Defaults to 792 which at 72dpi is 11\" tall. This is used to compute\n * the aspect ratio of the final rendered element when scaling up/down.\n */\n @Prop({mutable: true}) virtualHeight: number = 792;\n\n /**\n * The layers that will be rendered. The DOM structure will be a DIV container with one child DIV for each layer.\n * The parent DIV will have a unique ID, and each child DIV will have that ID with the layer name appended, e.g.\n * if `pages` was ['page', 'fields'] the structure will be:\n *\n * ```\n * <div id=\"verdocs-document-page-ker2fr1p9\">\n * <div id=\"verdocs-document-page-ker2fr1p9-page\"></div>\n * <div id=\"verdocs-document-page-ker2fr1p9-fields\"></div>\n * </div>\n * ```\n */\n @Prop() layers: IPageLayer[] = [{name: 'page', type: 'canvas'}];\n\n /**\n * Fired when a page has been rendered. This is also fired when the page is resized.\n */\n @Event() pageRendered: EventEmitter<IDocumentPageInfo>;\n\n @State() containerId = `verdocs-document-page-${Math.random().toString(36).substring(2, 11)}`;\n @State() renderedWidth: number = this.virtualWidth;\n @State() renderedHeight: number = this.virtualHeight;\n @State() naturalWidth: number = this.virtualWidth;\n @State() naturalHeight: number = this.virtualHeight;\n @State() aspectRatio: number = this.virtualWidth / this.virtualHeight;\n @State() skipFirstNotification = true;\n @State() pageDisplayUri = '';\n @State() xScale = 1;\n @State() yScale = 1;\n\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n async componentWillLoad() {\n this.pageDisplayUri = await getTemplateDocumentPageDisplayUri(this.endpoint, this.documentId, this.pageNumber);\n this.listenToTemplate();\n }\n\n componentDidLoad() {\n this.resizeObserver = new ResizeObserver(\n throttle(entries => {\n for (const entry of entries) {\n const renderedWidth = entry.contentRect.width;\n this.renderedWidth = renderedWidth;\n this.renderedHeight = this.virtualHeight * (renderedWidth / this.virtualWidth);\n }\n\n this.notifyRenderedSize();\n }, 100),\n );\n\n this.resizeObserver.observe(this.container);\n }\n\n componentDidUpdate() {\n // This is fired when fields are updated and triggers the parent to re-attach behaviors like drag-and-drop\n this.notifyRenderedSize();\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.unlistenToTemplate();\n }\n\n async listenToTemplate() {\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n this.template = template;\n this.loading = false;\n },\n );\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n notifyRenderedSize() {\n // We skip one notification because by default we will always get at least two, one when rendering the initial size\n // and a second once we're able to compute the scale size, when the resizeObserver sets renderedWidth/renderedHeight.\n if (this.skipFirstNotification) {\n this.skipFirstNotification = false;\n return;\n }\n\n const xScale = this.renderedWidth / this.virtualWidth;\n if (this.xScale !== xScale) {\n this.xScale = xScale;\n }\n\n const yScale = this.renderedHeight / this.virtualHeight;\n if (this.yScale !== yScale) {\n this.yScale = yScale;\n }\n\n this.pageRendered.emit({\n // container: this.container,\n containerId: this.containerId,\n documentId: this.documentId,\n pageNumber: this.pageNumber,\n virtualWidth: this.virtualWidth,\n virtualHeight: this.virtualHeight,\n renderedWidth: this.renderedWidth,\n renderedHeight: this.renderedHeight,\n naturalWidth: this.naturalWidth,\n naturalHeight: this.naturalHeight,\n aspectRatio: this.aspectRatio,\n xScale,\n yScale,\n });\n }\n\n render() {\n if (this.loading) {\n return (\n <Host>\n <img src=\"https://public-assets.verdocs.com/loading-placeholder.png\" class=\"placeholder\" alt=\"Placeholder page\" />\n </Host>\n );\n }\n\n const height = `${this.renderedHeight}px`;\n\n return (\n <Host id={`${this.containerId}`} style={{height, flex: `0 0 ${height}`}}>\n {this.layers.map(layer =>\n layer.type === 'div' ? (\n <div class=\"verdocs-template-document-page-layer\" id={`${this.containerId}-${layer.name}`} style={{height}}>\n {layer.name === 'controls' &&\n (this.template?.fields || [])\n .filter(field => field && field.document_id === this.documentId && field.page === this.pageNumber)\n .map(field => {\n const id = getFieldId(field);\n let {name, type, multiline} = field;\n const {xScale, yScale, templateId, editable, disabled, done, pageNumber} = this;\n if (field['setting']?.leading > 0 || field['settings']?.leading > 0) {\n type = 'textarea';\n multiline = true;\n }\n switch (type as any) {\n case 'textbox':\n return (\n <verdocs-field-textbox\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n multiline={multiline}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'textarea':\n return (\n <verdocs-field-textarea\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'date':\n return (\n <verdocs-field-date\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'attachment':\n return (\n <verdocs-field-attachment\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'dropdown':\n return (\n <verdocs-field-dropdown\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'initial':\n return (\n <verdocs-field-initial\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'signature':\n return (\n <verdocs-field-signature\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, this.xScale, this.yScale)}\n />\n );\n case 'timestamp':\n return (\n <verdocs-field-timestamp\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'checkbox':\n return (\n <verdocs-field-checkbox\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'radio':\n return (\n <verdocs-field-radio\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n default:\n return <Fragment>{name}</Fragment>;\n }\n })}\n </div>\n ) : this.pageDisplayUri ? (\n <img\n class=\"verdocs-template-document-page-layer img\"\n id={`${this.containerId}-${layer.name}`}\n src={this.pageDisplayUri}\n alt={`Page ${this.pageNumber}`}\n aria-hidden={true}\n loading=\"lazy\"\n onLoad={(e: any) => {\n // Note that all we really care about is the aspect ratio. We track the natural Width and Height but they aren't really that\n // useful as individual values. The image will already have been scaled down to fit a DIV for display (100%, auto height).\n // Builder places fields offset into the rendered display area, not the original document's dimensions. So its X/Y values\n // for a field are based on the responsive Web view the Template editor was seeing. The IMG was scaled down there in the\n // exact same way, so we just honor it. We capture the natural width and height here more as information. Then we use the\n // aspect ratio to adjust the \"virtual\" height in case the page is not 8.5\"x11\".\n // TODO: Store this in the DB with each page.\n this.naturalWidth = e.target.naturalWidth;\n this.naturalHeight = e.target.naturalHeight;\n this.aspectRatio = this.naturalWidth / this.naturalHeight;\n this.virtualHeight = this.virtualWidth / this.aspectRatio;\n this.renderedHeight = e.target.offsetWidth / this.aspectRatio;\n }}\n />\n ) : (\n <div></div>\n ),\n )}\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-toolbar-icon {\n font-family: $verdocs-primary-font;\n //display: inline-block;\n display: flex;\n position: relative;\n align-items: center;\n justify-content: center;\n\n .icon {\n display: inline-block;\n cursor: pointer;\n\n svg {\n fill: $choice-available-color;\n }\n }\n\n .tooltip {\n display: none;\n box-shadow: 0 0 10px 1px #999999;\n background: #ffffff;\n color: $label-color;\n max-width: 240px;\n font-weight: bold;\n padding: 5px 10px;\n font-size: 13px;\n position: relative;\n border-radius: 4px;\n z-index: 20000;\n white-space: nowrap;\n\n .arrow,\n .arrow::before {\n position: absolute;\n width: 8px;\n height: 8px;\n background: inherit;\n }\n\n .arrow {\n visibility: hidden;\n top: -4px;\n }\n\n .arrow::before {\n visibility: visible;\n content: '';\n transform: rotate(45deg);\n }\n\n &[data-show] {\n display: block;\n }\n\n &[data-popper-placement^='top'] > .arrow {\n bottom: -4px;\n }\n\n &[data-popper-placement^='bottom'] > .arrow {\n top: -4px;\n }\n\n &[data-popper-placement^='left'] > .arrow {\n right: -4px;\n }\n\n &[data-popper-placement^='right'] > .arrow {\n left: -4px;\n }\n\n // For the floating menu\n &[data-popper-placement^='left'] {\n //margin-right: 22px !important;\n padding: 3px 10px;\n\n & > .arrow {\n right: -1px;\n }\n }\n }\n}\n","import {createPopper, Instance} from '@popperjs/core';\nimport {Component, h, Host, Prop, State} from '@stencil/core';\nimport {Placement} from '@popperjs/core/lib/enums';\n// import {Component, Event, EventEmitter, h, Host, Prop, State} from '@stencil/core';\n\n/**\n * Displays a simple help icon. Upon hover or focus, a tooltip will be displayed with help text.\n *\n * ```ts\n * <verdocs-toolbar-icon text=\"Sample tooltip text\" icon={CalendarIcon} />\n * ```\n */\n@Component({\n tag: 'verdocs-toolbar-icon',\n styleUrl: 'verdocs-toolbar-icon.scss',\n shadow: false,\n})\nexport class VerdocsToolbarIcon {\n iconEl: HTMLDivElement;\n tooltip: HTMLDivElement;\n popperInstance: Instance;\n\n /**\n * Help text to display on hover/focus\n */\n @Prop() text: string = '';\n\n /**\n * SVG icon to display\n */\n @Prop() icon: string = '';\n\n /**\n * Override the Popper \"placement\" setting\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Triggered when the icon is pressed\n */\n // @Event({composed: true}) press: EventEmitter;\n\n @State() containerId = `verdocs-toolbar-icon-${Math.random().toString(36).substring(2, 11)}`;\n\n componentDidLoad() {\n this.popperInstance = createPopper(this.iconEl, this.tooltip, {\n placement: this.placement,\n modifiers: this.placement === 'left' ? [{name: 'offset', options: {offset: [0, 20]}}] : [],\n });\n // placement: 'top-end',\n // modifiers: [{name: 'offset', options: {offset: [0, 10]}}],\n // });\n }\n\n disconnectedCallback() {\n if (this.popperInstance) {\n this.popperInstance.destroy();\n this.popperInstance = null;\n }\n }\n\n show() {\n this.tooltip?.setAttribute('data-show', '');\n this.popperInstance?.update().catch(() => {});\n }\n\n hide() {\n this.tooltip?.removeAttribute('data-show');\n }\n\n // handlePress() {\n // this.press?.emit();\n // }\n\n render() {\n return (\n <Host class={{}}>\n <div\n aria-describedby={this.containerId}\n class=\"icon\"\n innerHTML={this.icon}\n onMouseEnter={() => this.show()}\n onFocus={() => this.show()}\n onMouseLeave={() => this.hide()}\n onBlur={() => this.hide()}\n ref={el => (this.iconEl = el as HTMLDivElement)}\n />\n <div id={this.containerId} role=\"tooltip\" class=\"tooltip\" data-popper-placement={this.placement} ref={el => (this.tooltip = el as HTMLDivElement)}>\n {this.text}\n <div data-popper-arrow=\"true\" class=\"arrow\" />\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA,MAAM,8BAA8B,GAAG,wjBAAwjB;;MCmBllB,2BAA2B,GAAA,MAAA;AALxC,IAAA,WAAA,CAAA,OAAA,EAAA;;;AAMU,QAAA,IAAkB,CAAA,kBAAA,GAAG,IAAI;AAKjC;;AAEG;AACK,QAAA,IAAA,CAAA,QAAQ,GAAoB,eAAe,CAAC,UAAU,EAAE;AAEhE;;AAEG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAG,KAAK;AAExB;;AAEG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAG,KAAK;AAExB;;AAEG;AACK,QAAA,IAAI,CAAA,IAAA,GAAG,KAAK;AAEpB;;AAEG;AACK,QAAA,IAAU,CAAA,UAAA,GAAW,EAAE;AAE/B;;AAEG;AACK,QAAA,IAAU,CAAA,UAAA,GAAW,EAAE;AAE/B;;AAEG;AACK,QAAA,IAAU,CAAA,UAAA,GAAW,CAAC;AAE9B;;;AAGG;AACK,QAAA,IAAY,CAAA,YAAA,GAAW,GAAG;AAElC;;;AAGG;AACoB,QAAA,IAAa,CAAA,aAAA,GAAW,GAAG;AAElD;;;;;;;;;;;AAWG;AACK,QAAA,IAAA,CAAA,MAAM,GAAiB,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAC,CAAC;QAOtD,IAAA,CAAA,WAAW,GAAG,CAAA,sB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EAAE,EAAA,EACb,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,kBAAA,EACoB,IAAI,CAAC,WAAW,EAClC,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE,IAAI,CAAC,IAAI,EACpB,YAAY,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,EAC/B,OAAO,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,EAC1B,YAAY,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,EAC/B,MAAM,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,EACzB,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,MAAM,GAAG,EAAoB,CAAC,EAC/C,CAAA,EACF,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,EAAC,SAAS,EAAC,KAAK,EAAC,SAAS,EAAwB,uBAAA,EAAA,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,OAAO,GAAG,EAAoB,CAAC,EAAA,EAC9I,IAAI,CAAC,IAAI,EACV,CAAuB,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,mBAAA,EAAA,MAAM,EAAC,KAAK,EAAC,OAAO,EAAG,CAAA,CAC1C,CACD;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"verdocs-template-document-page.verdocs-toolbar-icon.entry.js","sources":["src/components/templates/verdocs-template-document-page/verdocs-template-document-page.scss?tag=verdocs-template-document-page","src/components/templates/verdocs-template-document-page/verdocs-template-document-page.tsx","src/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.scss?tag=verdocs-toolbar-icon","src/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-template-document-page {\n width: 100%;\n position: relative;\n\n .verdocs-template-document-page-layer {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n box-shadow: 0 0 10px 5px #0000000f;\n\n &.img {\n width: 100%;\n }\n }\n\n .placeholder {\n opacity: 0.1;\n width: 612px;\n height: 792px;\n box-shadow: 0 0 10px 5px #0000000f;\n }\n}\n","// NOTE: This component does not have a story because it's not intended for external use.\n\nimport {getTemplate, getTemplateDocumentPageDisplayUri, type ITemplate, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {Component, h, Host, Prop, Event, EventEmitter, State, Element, Fragment} from '@stencil/core';\nimport {IDocumentPageInfo, IPageLayer} from '../../../utils/Types';\nimport {getControlStyles, getFieldId} from '../../../utils/utils';\nimport {throttle} from '../../../utils/utils';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Represents one document page. This is primarily a layout container used to coordinate positions of\n * page-related layers such as the page itself, signature fields, etc. It is not intended to be used\n * on its own as an individual component.\n */\n@Component({\n tag: 'verdocs-template-document-page',\n styleUrl: 'verdocs-template-document-page.scss',\n shadow: false,\n})\nexport class VerdocsTemplateDocumentPage {\n private templateListenerId = null;\n private resizeObserver: ResizeObserver;\n\n @Element() container: HTMLElement;\n\n /**\n * The endpoint to load from.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * Whether the fields should be editable (Builder)\n */\n @Prop() editable = false;\n\n /**\n * Whether the fields should be disabled (Builder)\n */\n @Prop() disabled = false;\n\n /**\n * Whether the field are interactable (done/submitted disables this)\n */\n @Prop() done = false;\n\n /**\n * The ID of the template the document is for.\n */\n @Prop({reflect: true}) templateId: string = '';\n\n /**\n * The ID of the document to display.\n */\n @Prop({reflect: true}) documentId: string = '';\n\n /**\n * The page number being rendered. (Reminder: page numbers are 1-based.)\n */\n @Prop({reflect: true}) pageNumber: number = 1;\n\n /**\n * The \"virtual\" width of the page canvas. Defaults to 612 which at 72dpi is 8.5\" wide. This is used to compute\n * the aspect ratio of the final rendered element when scaling up/down.\n */\n @Prop() virtualWidth: number = 612;\n\n /**\n * The \"virtual\" height of the page canvas. Defaults to 792 which at 72dpi is 11\" tall. This is used to compute\n * the aspect ratio of the final rendered element when scaling up/down.\n */\n @Prop({mutable: true}) virtualHeight: number = 792;\n\n /**\n * The layers that will be rendered. The DOM structure will be a DIV container with one child DIV for each layer.\n * The parent DIV will have a unique ID, and each child DIV will have that ID with the layer name appended, e.g.\n * if `pages` was ['page', 'fields'] the structure will be:\n *\n * ```\n * <div id=\"verdocs-document-page-ker2fr1p9\">\n * <div id=\"verdocs-document-page-ker2fr1p9-page\"></div>\n * <div id=\"verdocs-document-page-ker2fr1p9-fields\"></div>\n * </div>\n * ```\n */\n @Prop() layers: IPageLayer[] = [{name: 'page', type: 'canvas'}];\n\n /**\n * Fired when a page has been rendered. This is also fired when the page is resized.\n */\n @Event() pageRendered: EventEmitter<IDocumentPageInfo>;\n\n @State() containerId = `verdocs-document-page-${Math.random().toString(36).substring(2, 11)}`;\n @State() renderedWidth: number = this.virtualWidth;\n @State() renderedHeight: number = this.virtualHeight;\n @State() naturalWidth: number = this.virtualWidth;\n @State() naturalHeight: number = this.virtualHeight;\n @State() aspectRatio: number = this.virtualWidth / this.virtualHeight;\n @State() skipFirstNotification = true;\n @State() pageDisplayUri = '';\n @State() xScale = 1;\n @State() yScale = 1;\n\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n async componentWillLoad() {\n this.pageDisplayUri = await getTemplateDocumentPageDisplayUri(this.endpoint, this.documentId, this.pageNumber);\n this.listenToTemplate();\n }\n\n componentDidLoad() {\n this.resizeObserver = new ResizeObserver(\n throttle(entries => {\n for (const entry of entries) {\n const renderedWidth = entry.contentRect.width;\n this.renderedWidth = renderedWidth;\n this.renderedHeight = this.virtualHeight * (renderedWidth / this.virtualWidth);\n }\n\n this.notifyRenderedSize();\n }, 100),\n );\n\n this.resizeObserver.observe(this.container);\n }\n\n componentDidUpdate() {\n // This is fired when fields are updated and triggers the parent to re-attach behaviors like drag-and-drop\n this.notifyRenderedSize();\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.unlistenToTemplate();\n }\n\n async listenToTemplate() {\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n this.template = template;\n this.loading = false;\n },\n );\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n notifyRenderedSize() {\n // We skip one notification because by default we will always get at least two, one when rendering the initial size\n // and a second once we're able to compute the scale size, when the resizeObserver sets renderedWidth/renderedHeight.\n if (this.skipFirstNotification) {\n this.skipFirstNotification = false;\n return;\n }\n\n const xScale = this.renderedWidth / this.virtualWidth;\n if (this.xScale !== xScale) {\n this.xScale = xScale;\n }\n\n const yScale = this.renderedHeight / this.virtualHeight;\n if (this.yScale !== yScale) {\n this.yScale = yScale;\n }\n\n this.pageRendered.emit({\n // container: this.container,\n containerId: this.containerId,\n documentId: this.documentId,\n pageNumber: this.pageNumber,\n virtualWidth: this.virtualWidth,\n virtualHeight: this.virtualHeight,\n renderedWidth: this.renderedWidth,\n renderedHeight: this.renderedHeight,\n naturalWidth: this.naturalWidth,\n naturalHeight: this.naturalHeight,\n aspectRatio: this.aspectRatio,\n xScale,\n yScale,\n });\n }\n\n render() {\n if (this.loading) {\n return (\n <Host>\n <img src=\"https://public-assets.verdocs.com/loading-placeholder.png\" class=\"placeholder\" alt=\"Placeholder page\" />\n </Host>\n );\n }\n\n const height = `${this.renderedHeight}px`;\n\n return (\n <Host id={`${this.containerId}`} style={{height, flex: `0 0 ${height}`}}>\n {this.layers.map(layer =>\n layer.type === 'div' ? (\n <div class=\"verdocs-template-document-page-layer\" id={`${this.containerId}-${layer.name}`} style={{height}}>\n {layer.name === 'controls' &&\n (this.template?.fields || [])\n .filter(field => field && field.document_id === this.documentId && field.page === this.pageNumber)\n .map(field => {\n const id = getFieldId(field);\n let {name, type, multiline} = field;\n const {xScale, yScale, templateId, editable, disabled, done, pageNumber} = this;\n if (field['setting']?.leading > 0 || field['settings']?.leading > 0) {\n type = 'textarea';\n multiline = true;\n }\n switch (type as any) {\n case 'textbox':\n return (\n <verdocs-field-textbox\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n multiline={multiline}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'textarea':\n return (\n <verdocs-field-textarea\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'date':\n return (\n <verdocs-field-date\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'attachment':\n return (\n <verdocs-field-attachment\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'dropdown':\n return (\n <verdocs-field-dropdown\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'initial':\n return (\n <verdocs-field-initial\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'signature':\n return (\n <verdocs-field-signature\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, this.xScale, this.yScale)}\n />\n );\n case 'timestamp':\n return (\n <verdocs-field-timestamp\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'checkbox':\n return (\n <verdocs-field-checkbox\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n case 'radio':\n return (\n <verdocs-field-radio\n id={id}\n fieldname={name}\n source=\"template\"\n sourceid={templateId}\n editable={editable}\n disabled={disabled}\n done={done}\n xscale={xScale}\n yscale={yScale}\n pagenumber={pageNumber}\n style={getControlStyles(field, xScale, yScale)}\n />\n );\n default:\n return <Fragment>{name}</Fragment>;\n }\n })}\n </div>\n ) : this.pageDisplayUri ? (\n <img\n class=\"verdocs-template-document-page-layer img\"\n id={`${this.containerId}-${layer.name}`}\n src={this.pageDisplayUri}\n alt={`Page ${this.pageNumber}`}\n aria-hidden={true}\n loading=\"lazy\"\n onLoad={(e: any) => {\n // Note that all we really care about is the aspect ratio. We track the natural Width and Height but they aren't really that\n // useful as individual values. The image will already have been scaled down to fit a DIV for display (100%, auto height).\n // Builder places fields offset into the rendered display area, not the original document's dimensions. So its X/Y values\n // for a field are based on the responsive Web view the Template editor was seeing. The IMG was scaled down there in the\n // exact same way, so we just honor it. We capture the natural width and height here more as information. Then we use the\n // aspect ratio to adjust the \"virtual\" height in case the page is not 8.5\"x11\".\n // TODO: Store this in the DB with each page.\n this.naturalWidth = e.target.naturalWidth;\n this.naturalHeight = e.target.naturalHeight;\n this.aspectRatio = this.naturalWidth / this.naturalHeight;\n this.virtualHeight = this.virtualWidth / this.aspectRatio;\n this.renderedHeight = e.target.offsetWidth / this.aspectRatio;\n }}\n />\n ) : (\n <div></div>\n ),\n )}\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-toolbar-icon {\n font-family: $verdocs-primary-font;\n //display: inline-block;\n display: flex;\n position: relative;\n align-items: center;\n justify-content: center;\n\n .icon {\n display: inline-block;\n cursor: pointer;\n\n svg {\n fill: $choice-available-color;\n }\n }\n\n .tooltip {\n display: none;\n box-shadow: 0 0 10px 1px #999999;\n background: #ffffff;\n color: $label-color;\n max-width: 240px;\n font-weight: bold;\n padding: 5px 10px;\n font-size: 13px;\n position: relative;\n border-radius: 4px;\n z-index: 20000;\n white-space: nowrap;\n\n .arrow,\n .arrow::before {\n position: absolute;\n width: 8px;\n height: 8px;\n background: inherit;\n }\n\n .arrow {\n visibility: hidden;\n top: -4px;\n }\n\n .arrow::before {\n visibility: visible;\n content: '';\n transform: rotate(45deg);\n }\n\n &[data-show] {\n display: block;\n }\n\n &[data-popper-placement^='top'] > .arrow {\n bottom: -4px;\n }\n\n &[data-popper-placement^='bottom'] > .arrow {\n top: -4px;\n }\n\n &[data-popper-placement^='left'] > .arrow {\n right: -4px;\n }\n\n &[data-popper-placement^='right'] > .arrow {\n left: -4px;\n }\n\n // For the floating menu\n &[data-popper-placement^='left'] {\n //margin-right: 22px !important;\n padding: 3px 10px;\n\n & > .arrow {\n right: -1px;\n }\n }\n }\n}\n","import {createPopper, Instance} from '@popperjs/core';\nimport {Component, h, Host, Prop, State} from '@stencil/core';\nimport {Placement} from '@popperjs/core/lib/enums';\n// import {Component, Event, EventEmitter, h, Host, Prop, State} from '@stencil/core';\n\n/**\n * Displays a simple help icon. Upon hover or focus, a tooltip will be displayed with help text.\n *\n * ```ts\n * <verdocs-toolbar-icon text=\"Sample tooltip text\" icon={CalendarIcon} />\n * ```\n */\n@Component({\n tag: 'verdocs-toolbar-icon',\n styleUrl: 'verdocs-toolbar-icon.scss',\n shadow: false,\n})\nexport class VerdocsToolbarIcon {\n iconEl: HTMLDivElement;\n tooltip: HTMLDivElement;\n popperInstance: Instance;\n\n /**\n * Help text to display on hover/focus\n */\n @Prop() text: string = '';\n\n /**\n * SVG icon to display\n */\n @Prop() icon: string = '';\n\n /**\n * Override the Popper \"placement\" setting\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Triggered when the icon is pressed\n */\n // @Event({composed: true}) press: EventEmitter;\n\n @State() containerId = `verdocs-toolbar-icon-${Math.random().toString(36).substring(2, 11)}`;\n\n componentDidLoad() {\n this.popperInstance = createPopper(this.iconEl, this.tooltip, {\n placement: this.placement,\n modifiers: this.placement === 'left' ? [{name: 'offset', options: {offset: [0, 20]}}] : [],\n });\n // placement: 'top-end',\n // modifiers: [{name: 'offset', options: {offset: [0, 10]}}],\n // });\n }\n\n disconnectedCallback() {\n if (this.popperInstance) {\n this.popperInstance.destroy();\n this.popperInstance = null;\n }\n }\n\n show() {\n this.tooltip?.setAttribute('data-show', '');\n this.popperInstance?.update().catch(() => {});\n }\n\n hide() {\n this.tooltip?.removeAttribute('data-show');\n }\n\n // handlePress() {\n // this.press?.emit();\n // }\n\n render() {\n return (\n <Host class={{}}>\n <div\n aria-describedby={this.containerId}\n class=\"icon\"\n innerHTML={this.icon}\n onMouseEnter={() => this.show()}\n onFocus={() => this.show()}\n onMouseLeave={() => this.hide()}\n onBlur={() => this.hide()}\n ref={el => (this.iconEl = el as HTMLDivElement)}\n />\n <div id={this.containerId} role=\"tooltip\" class=\"tooltip\" data-popper-placement={this.placement} ref={el => (this.tooltip = el as HTMLDivElement)}>\n {this.text}\n <div data-popper-arrow=\"true\" class=\"arrow\" />\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA,MAAM,8BAA8B,GAAG,wjBAAwjB;;MCmBllB,2BAA2B,GAAA,MAAA;AALxC,IAAA,WAAA,CAAA,OAAA,EAAA;;;AAMU,QAAA,IAAkB,CAAA,kBAAA,GAAG,IA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IAAI,EAAC,SAAS,EAAC,KAAK,EAAC,SAAS,EAAwB,uBAAA,EAAA,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,OAAO,GAAG,EAAoB,CAAC,EAAA,EAC9I,IAAI,CAAC,IAAI,EACV,CAAuB,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,mBAAA,EAAA,MAAM,EAAC,KAAK,EAAC,OAAO,EAAG,CAAA,CAC1C,CACD;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,o,i){function r(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function n(e){try{l(i["throw"](e))}catch(e){a(e)}}function l(e){e.done?o(e.value):r(e.value).then(s,n)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=n(0),s["throw"]=n(1),s["return"]=n(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function n(e){return function(t){return l([e,t])}}function l(n){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,n[0]&&(o=0)),o)try{if(i=1,r&&(a=n[0]&2?r["return"]:n[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,n[1])).done)return a;if(r=0,a)n=[n[0]&2,a.value];switch(n[0]){case 0:case 1:a=n;break;case 4:o.label++;return{value:n[1],done:false};case 5:o.label++;r=n[1];n=[0];continue;case 7:n=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(n[0]===6||n[0]===2)){o=0;continue}if(n[0]===3&&(!a||n[1]>a[0]&&n[1]<a[3])){o.label=n[1];break}if(n[0]===6&&o.label<a[1]){o.label=a[1];a=n;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(n);break}if(a[2])o.ops.pop();o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e];r=0}finally{i=a=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-BIRwgFLv.js";import{VerdocsEndpoint,getTemplateDocumentPageDisplayUri,getTemplate}from"@verdocs/js-sdk";import{t as throttle,c as getControlStyles,g as getFieldId}from"./utils-ivPfUH2E.js";import{S as Store}from"./Datastore-bS8INhRF.js";import{c as createPopper}from"./popper-BfP9ezJQ.js";import"./index-dzBXqXlK.js";import"./Types-dqxNbm_b.js";var verdocsTemplateDocumentPageCss="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)}";var VerdocsTemplateDocumentPage=function(){function e(e){registerInstance(this,e);this.pageRendered=createEvent(this,"pageRendered");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.editable=false;this.disabled=false;this.done=false;this.templateId="";this.documentId="";this.pageNumber=1;this.virtualWidth=612;this.virtualHeight=792;this.layers=[{name:"page",type:"canvas"}];this.containerId="verdocs-document-page-".concat(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=true;this.pageDisplayUri="";this.xScale=1;this.yScale=1;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=this;return[4,getTemplateDocumentPageDisplayUri(this.endpoint,this.documentId,this.pageNumber)];case 1:e.pageDisplayUri=t.sent();this.listenToTemplate();return[2]}}))}))};e.prototype.componentDidLoad=function(){var e=this;this.resizeObserver=new ResizeObserver(throttle((function(t){for(var o=0,i=t;o<i.length;o++){var r=i[o];var a=r.contentRect.width;e.renderedWidth=a;e.renderedHeight=e.virtualHeight*(a/e.virtualWidth)}e.notifyRenderedSize()}),100));this.resizeObserver.observe(this.container)};e.prototype.componentDidUpdate=function(){this.notifyRenderedSize()};e.prototype.disconnectedCallback=function(){var e;(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect();this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.notifyRenderedSize=function(){if(this.skipFirstNotification){this.skipFirstNotification=false;return}var e=this.renderedWidth/this.virtualWidth;if(this.xScale!==e){this.xScale=e}var t=this.renderedHeight/this.virtualHeight;if(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})};e.prototype.render=function(){var e=this;if(this.loading){return h(Host,null,h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",class:"placeholder",alt:"Placeholder page"}))}var t="".concat(this.renderedHeight,"px");return h(Host,{id:"".concat(this.containerId),style:{height:t,flex:"0 0 ".concat(t)}},this.layers.map((function(o){var i;return o.type==="div"?h("div",{class:"verdocs-template-document-page-layer",id:"".concat(e.containerId,"-").concat(o.name),style:{height:t}},o.name==="controls"&&(((i=e.template)===null||i===void 0?void 0:i.fields)||[]).filter((function(t){return t&&t.document_id===e.documentId&&t.page===e.pageNumber})).map((function(t){var o,i;var r=getFieldId(t);var a=t.name,s=t.type,n=t.multiline;var l=e,c=l.xScale,d=l.yScale,u=l.templateId,p=l.editable,f=l.disabled,m=l.done,b=l.pageNumber;if(((o=t["setting"])===null||o===void 0?void 0:o.leading)>0||((i=t["settings"])===null||i===void 0?void 0:i.leading)>0){s="textarea";n=true}switch(s){case"textbox":return h("verdocs-field-textbox",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,multiline:n,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"textarea":return h("verdocs-field-textarea",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"date":return h("verdocs-field-date",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"attachment":return h("verdocs-field-attachment",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"dropdown":return h("verdocs-field-dropdown",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"initial":return h("verdocs-field-initial",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"signature":return h("verdocs-field-signature",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,e.xScale,e.yScale)});case"timestamp":return h("verdocs-field-timestamp",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"checkbox":return h("verdocs-field-checkbox",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"radio":return h("verdocs-field-radio",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});default:return h(Fragment,null,a)}}))):e.pageDisplayUri?h("img",{class:"verdocs-template-document-page-layer img",id:"".concat(e.containerId,"-").concat(o.name),src:e.pageDisplayUri,alt:"Page ".concat(e.pageNumber),"aria-hidden":true,loading:"lazy",onLoad:function(t){e.naturalWidth=t.target.naturalWidth;e.naturalHeight=t.target.naturalHeight;e.aspectRatio=e.naturalWidth/e.naturalHeight;e.virtualHeight=e.virtualWidth/e.aspectRatio;e.renderedHeight=t.target.offsetWidth/e.aspectRatio}}):h("div",null)})))};Object.defineProperty(e.prototype,"container",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsTemplateDocumentPage.style=verdocsTemplateDocumentPageCss;var verdocsToolbarIconCss='verdocs-toolbar-icon{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}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}';var VerdocsToolbarIcon=function(){function e(e){registerInstance(this,e);this.text="";this.icon="";this.placement="bottom";this.containerId="verdocs-toolbar-icon-".concat(Math.random().toString(36).substring(2,11))}e.prototype.componentDidLoad=function(){this.popperInstance=createPopper(this.iconEl,this.tooltip,{placement:this.placement,modifiers:this.placement==="left"?[{name:"offset",options:{offset:[0,20]}}]:[]})};e.prototype.disconnectedCallback=function(){if(this.popperInstance){this.popperInstance.destroy();this.popperInstance=null}};e.prototype.show=function(){var e,t;(e=this.tooltip)===null||e===void 0?void 0:e.setAttribute("data-show","");(t=this.popperInstance)===null||t===void 0?void 0:t.update().catch((function(){}))};e.prototype.hide=function(){var e;(e=this.tooltip)===null||e===void 0?void 0:e.removeAttribute("data-show")};e.prototype.render=function(){var e=this;return h(Host,{key:"f8516f47ac92cf82f1b833d76a8e13d819c597bd",class:{}},h("div",{key:"1d7a381d4d662bfcad7519da73535151bb99ecd2","aria-describedby":this.containerId,class:"icon",innerHTML:this.icon,onMouseEnter:function(){return e.show()},onFocus:function(){return e.show()},onMouseLeave:function(){return e.hide()},onBlur:function(){return e.hide()},ref:function(t){return e.iconEl=t}}),h("div",{key:"c4704c4cd442985192999bf4a26307e43923a54c",id:this.containerId,role:"tooltip",class:"tooltip","data-popper-placement":this.placement,ref:function(t){return e.tooltip=t}},this.text,h("div",{key:"4e25e78425814b991913d1e537b9cf049053185f","data-popper-arrow":"true",class:"arrow"})))};return e}();VerdocsToolbarIcon.style=verdocsToolbarIconCss;export{VerdocsTemplateDocumentPage as verdocs_template_document_page,VerdocsToolbarIcon as verdocs_toolbar_icon};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,o,i){function r(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function n(e){try{l(i["throw"](e))}catch(e){a(e)}}function l(e){e.done?o(e.value):r(e.value).then(s,n)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=n(0),s["throw"]=n(1),s["return"]=n(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function n(e){return function(t){return l([e,t])}}function l(n){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,n[0]&&(o=0)),o)try{if(i=1,r&&(a=n[0]&2?r["return"]:n[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,n[1])).done)return a;if(r=0,a)n=[n[0]&2,a.value];switch(n[0]){case 0:case 1:a=n;break;case 4:o.label++;return{value:n[1],done:false};case 5:o.label++;r=n[1];n=[0];continue;case 7:n=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(n[0]===6||n[0]===2)){o=0;continue}if(n[0]===3&&(!a||n[1]>a[0]&&n[1]<a[3])){o.label=n[1];break}if(n[0]===6&&o.label<a[1]){o.label=a[1];a=n;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(n);break}if(a[2])o.ops.pop();o.trys.pop();continue}n=t.call(e,o)}catch(e){n=[6,e];r=0}finally{i=a=0}if(n[0]&5)throw n[1];return{value:n[0]?n[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-BIRwgFLv.js";import{VerdocsEndpoint,getTemplateDocumentPageDisplayUri,getTemplate}from"@verdocs/js-sdk";import{t as throttle,c as getControlStyles,g as getFieldId}from"./utils-Deu82Q9L.js";import{S as Store}from"./Datastore-bS8INhRF.js";import{c as createPopper}from"./popper-BfP9ezJQ.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsTemplateDocumentPageCss="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)}";var VerdocsTemplateDocumentPage=function(){function e(e){registerInstance(this,e);this.pageRendered=createEvent(this,"pageRendered");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.editable=false;this.disabled=false;this.done=false;this.templateId="";this.documentId="";this.pageNumber=1;this.virtualWidth=612;this.virtualHeight=792;this.layers=[{name:"page",type:"canvas"}];this.containerId="verdocs-document-page-".concat(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=true;this.pageDisplayUri="";this.xScale=1;this.yScale=1;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=this;return[4,getTemplateDocumentPageDisplayUri(this.endpoint,this.documentId,this.pageNumber)];case 1:e.pageDisplayUri=t.sent();this.listenToTemplate();return[2]}}))}))};e.prototype.componentDidLoad=function(){var e=this;this.resizeObserver=new ResizeObserver(throttle((function(t){for(var o=0,i=t;o<i.length;o++){var r=i[o];var a=r.contentRect.width;e.renderedWidth=a;e.renderedHeight=e.virtualHeight*(a/e.virtualWidth)}e.notifyRenderedSize()}),100));this.resizeObserver.observe(this.container)};e.prototype.componentDidUpdate=function(){this.notifyRenderedSize()};e.prototype.disconnectedCallback=function(){var e;(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect();this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.notifyRenderedSize=function(){if(this.skipFirstNotification){this.skipFirstNotification=false;return}var e=this.renderedWidth/this.virtualWidth;if(this.xScale!==e){this.xScale=e}var t=this.renderedHeight/this.virtualHeight;if(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})};e.prototype.render=function(){var e=this;if(this.loading){return h(Host,null,h("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",class:"placeholder",alt:"Placeholder page"}))}var t="".concat(this.renderedHeight,"px");return h(Host,{id:"".concat(this.containerId),style:{height:t,flex:"0 0 ".concat(t)}},this.layers.map((function(o){var i;return o.type==="div"?h("div",{class:"verdocs-template-document-page-layer",id:"".concat(e.containerId,"-").concat(o.name),style:{height:t}},o.name==="controls"&&(((i=e.template)===null||i===void 0?void 0:i.fields)||[]).filter((function(t){return t&&t.document_id===e.documentId&&t.page===e.pageNumber})).map((function(t){var o,i;var r=getFieldId(t);var a=t.name,s=t.type,n=t.multiline;var l=e,c=l.xScale,d=l.yScale,u=l.templateId,p=l.editable,f=l.disabled,m=l.done,b=l.pageNumber;if(((o=t["setting"])===null||o===void 0?void 0:o.leading)>0||((i=t["settings"])===null||i===void 0?void 0:i.leading)>0){s="textarea";n=true}switch(s){case"textbox":return h("verdocs-field-textbox",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,multiline:n,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"textarea":return h("verdocs-field-textarea",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"date":return h("verdocs-field-date",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"attachment":return h("verdocs-field-attachment",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"dropdown":return h("verdocs-field-dropdown",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"initial":return h("verdocs-field-initial",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"signature":return h("verdocs-field-signature",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,e.xScale,e.yScale)});case"timestamp":return h("verdocs-field-timestamp",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"checkbox":return h("verdocs-field-checkbox",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});case"radio":return h("verdocs-field-radio",{id:r,fieldname:a,source:"template",sourceid:u,editable:p,disabled:f,done:m,xscale:c,yscale:d,pagenumber:b,style:getControlStyles(t,c,d)});default:return h(Fragment,null,a)}}))):e.pageDisplayUri?h("img",{class:"verdocs-template-document-page-layer img",id:"".concat(e.containerId,"-").concat(o.name),src:e.pageDisplayUri,alt:"Page ".concat(e.pageNumber),"aria-hidden":true,loading:"lazy",onLoad:function(t){e.naturalWidth=t.target.naturalWidth;e.naturalHeight=t.target.naturalHeight;e.aspectRatio=e.naturalWidth/e.naturalHeight;e.virtualHeight=e.virtualWidth/e.aspectRatio;e.renderedHeight=t.target.offsetWidth/e.aspectRatio}}):h("div",null)})))};Object.defineProperty(e.prototype,"container",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsTemplateDocumentPage.style=verdocsTemplateDocumentPageCss;var verdocsToolbarIconCss='verdocs-toolbar-icon{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}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}';var VerdocsToolbarIcon=function(){function e(e){registerInstance(this,e);this.text="";this.icon="";this.placement="bottom";this.containerId="verdocs-toolbar-icon-".concat(Math.random().toString(36).substring(2,11))}e.prototype.componentDidLoad=function(){this.popperInstance=createPopper(this.iconEl,this.tooltip,{placement:this.placement,modifiers:this.placement==="left"?[{name:"offset",options:{offset:[0,20]}}]:[]})};e.prototype.disconnectedCallback=function(){if(this.popperInstance){this.popperInstance.destroy();this.popperInstance=null}};e.prototype.show=function(){var e,t;(e=this.tooltip)===null||e===void 0?void 0:e.setAttribute("data-show","");(t=this.popperInstance)===null||t===void 0?void 0:t.update().catch((function(){}))};e.prototype.hide=function(){var e;(e=this.tooltip)===null||e===void 0?void 0:e.removeAttribute("data-show")};e.prototype.render=function(){var e=this;return h(Host,{key:"f8516f47ac92cf82f1b833d76a8e13d819c597bd",class:{}},h("div",{key:"1d7a381d4d662bfcad7519da73535151bb99ecd2","aria-describedby":this.containerId,class:"icon",innerHTML:this.icon,onMouseEnter:function(){return e.show()},onFocus:function(){return e.show()},onMouseLeave:function(){return e.hide()},onBlur:function(){return e.hide()},ref:function(t){return e.iconEl=t}}),h("div",{key:"c4704c4cd442985192999bf4a26307e43923a54c",id:this.containerId,role:"tooltip",class:"tooltip","data-popper-placement":this.placement,ref:function(t){return e.tooltip=t}},this.text,h("div",{key:"4e25e78425814b991913d1e537b9cf049053185f","data-popper-arrow":"true",class:"arrow"})))};return e}();VerdocsToolbarIcon.style=verdocsToolbarIconCss;export{VerdocsTemplateDocumentPage as verdocs_template_document_page,VerdocsToolbarIcon as verdocs_toolbar_icon};
|
|
2
2
|
//# sourceMappingURL=verdocs-template-document-page_2.entry.js.map
|