@verdocs/web-sdk 1.9.26 → 1.9.31
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/{Envelopes-d44c4a28.js → Envelopes-752bdc31.js} +10 -2
- package/dist/cjs/Envelopes-752bdc31.js.map +1 -0
- package/dist/cjs/{Templates-805e8ffa.js → Templates-a4370308.js} +2 -2
- package/dist/cjs/{Templates-805e8ffa.js.map → Templates-a4370308.js.map} +1 -1
- package/dist/cjs/index-1329d89c.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{templateStore-a1ccccdb.js → templateStore-8c8dc4c1.js} +2 -2
- package/dist/cjs/{templateStore-a1ccccdb.js.map → templateStore-8c8dc4c1.js.map} +1 -1
- package/dist/cjs/{utils-aa1285cc.js → utils-91d249b4.js} +12 -1
- package/dist/cjs/utils-91d249b4.js.map +1 -0
- package/dist/cjs/verdocs-build.cjs.entry.js +3 -3
- package/dist/cjs/verdocs-document-page_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-document-page_2.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-dropdown_2.cjs.entry.js +3 -2
- package/dist/cjs/verdocs-dropdown_2.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-field-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-date.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-initial.cjs.entry.js +4 -4
- package/dist/cjs/verdocs-field-initial.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-signature_3.cjs.entry.js +4 -4
- package/dist/cjs/verdocs-field-signature_3.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-field-textarea.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-textbox.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-field-timestamp.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview.cjs.entry.js +3 -3
- package/dist/cjs/verdocs-send.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +72 -41
- package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-template-create_4.cjs.entry.js +3 -3
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/elements/verdocs-document-page/verdocs-document-page.js +1 -1
- package/dist/collection/components/elements/verdocs-document-page/verdocs-document-page.js.map +1 -1
- package/dist/collection/components/elements/verdocs-field-initial/verdocs-field-initial.js +3 -3
- package/dist/collection/components/elements/verdocs-field-initial/verdocs-field-initial.js.map +1 -1
- package/dist/collection/components/elements/verdocs-field-signature/verdocs-field-signature.js +3 -3
- package/dist/collection/components/elements/verdocs-field-signature/verdocs-field-signature.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +72 -41
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +2 -2
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js.map +1 -1
- package/dist/collection/utils/Envelopes.js +7 -0
- package/dist/collection/utils/Envelopes.js.map +1 -1
- package/dist/collection/utils/envelopeStore.js +1 -0
- package/dist/collection/utils/envelopeStore.js.map +1 -1
- package/dist/collection/utils/utils.js +10 -0
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/templateStore.js +1 -1
- package/dist/components/utils.js +11 -1
- package/dist/components/utils.js.map +1 -1
- package/dist/components/verdocs-document-page2.js +1 -1
- package/dist/components/verdocs-document-page2.js.map +1 -1
- package/dist/components/verdocs-field-initial.js +3 -3
- package/dist/components/verdocs-field-initial.js.map +1 -1
- package/dist/components/verdocs-field-signature2.js +3 -3
- package/dist/components/verdocs-field-signature2.js.map +1 -1
- package/dist/components/verdocs-sign.js +72 -41
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/components/verdocs-template-fields2.js +1 -1
- package/dist/components/verdocs-view2.js +9 -1
- package/dist/components/verdocs-view2.js.map +1 -1
- package/dist/docs.json +2 -2
- package/dist/esm/{Envelopes-28a4c67f.js → Envelopes-83934981.js} +10 -2
- package/dist/esm/Envelopes-83934981.js.map +1 -0
- package/dist/esm/{Templates-653648bb.js → Templates-41762101.js} +2 -2
- package/dist/esm/{Templates-653648bb.js.map → Templates-41762101.js.map} +1 -1
- package/dist/esm/index-f78d163d.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{templateStore-8585145f.js → templateStore-103a54ab.js} +2 -2
- package/dist/esm/{templateStore-8585145f.js.map → templateStore-103a54ab.js.map} +1 -1
- package/dist/esm/{utils-c666adcf.js → utils-36d44309.js} +12 -2
- package/dist/esm/utils-36d44309.js.map +1 -0
- package/dist/esm/verdocs-build.entry.js +3 -3
- package/dist/esm/verdocs-document-page_2.entry.js +1 -1
- package/dist/esm/verdocs-document-page_2.entry.js.map +1 -1
- package/dist/esm/verdocs-dropdown_2.entry.js +3 -2
- package/dist/esm/verdocs-dropdown_2.entry.js.map +1 -1
- package/dist/esm/verdocs-field-checkbox.entry.js +1 -1
- package/dist/esm/verdocs-field-date.entry.js +1 -1
- package/dist/esm/verdocs-field-dropdown.entry.js +1 -1
- package/dist/esm/verdocs-field-initial.entry.js +4 -4
- package/dist/esm/verdocs-field-initial.entry.js.map +1 -1
- package/dist/esm/verdocs-field-payment.entry.js +1 -1
- package/dist/esm/verdocs-field-radio-button.entry.js +1 -1
- package/dist/esm/verdocs-field-signature_3.entry.js +4 -4
- package/dist/esm/verdocs-field-signature_3.entry.js.map +1 -1
- package/dist/esm/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm/verdocs-field-textbox.entry.js +2 -2
- package/dist/esm/verdocs-field-timestamp.entry.js +1 -1
- package/dist/esm/verdocs-preview.entry.js +3 -3
- package/dist/esm/verdocs-send.entry.js +1 -1
- package/dist/esm/verdocs-sign.entry.js +72 -41
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/esm/verdocs-template-create_4.entry.js +3 -3
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/Envelopes-83934981.js +2 -0
- package/dist/esm-es5/Envelopes-83934981.js.map +1 -0
- package/dist/esm-es5/{Templates-653648bb.js → Templates-41762101.js} +2 -2
- package/dist/esm-es5/{Templates-653648bb.js.map → Templates-41762101.js.map} +0 -0
- package/dist/esm-es5/index-f78d163d.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/{templateStore-8585145f.js → templateStore-103a54ab.js} +2 -2
- package/dist/esm-es5/{templateStore-8585145f.js.map → templateStore-103a54ab.js.map} +0 -0
- package/dist/esm-es5/utils-36d44309.js +2 -0
- package/dist/esm-es5/utils-36d44309.js.map +1 -0
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-document-page_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-document-page_2.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-dropdown_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-dropdown_2.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-field-checkbox.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-date.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-dropdown.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-initial.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-initial.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-radio-button.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-signature_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-signature_3.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-timestamp.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview.entry.js +1 -1
- package/dist/esm-es5/verdocs-send.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-template-create_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js.map +1 -1
- package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +2 -1
- package/dist/types/utils/envelopeStore.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/verdocs-web-sdk/p-0225575c.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-0225575c.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-6ec79ddc.system.entry.js → p-0398fe67.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-6ec79ddc.system.entry.js.map → p-0398fe67.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-7421e32e.entry.js → p-102bc4bc.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-102bc4bc.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-15aa525d.entry.js → p-19a634b9.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-15aa525d.entry.js.map → p-19a634b9.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-9e5fcf92.system.entry.js → p-1b3be2ae.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-9e5fcf92.system.entry.js.map → p-1b3be2ae.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-f47224c8.system.entry.js → p-206bbfe3.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f47224c8.system.entry.js.map → p-206bbfe3.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-a6781789.system.entry.js → p-26e0caa5.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-a6781789.system.entry.js.map → p-26e0caa5.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-e02e05a2.entry.js → p-29044b5b.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-e02e05a2.entry.js.map → p-29044b5b.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-a98ced34.system.entry.js → p-2d1b5389.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-a98ced34.system.entry.js.map → p-2d1b5389.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-b5f64429.entry.js → p-2e8a3d90.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-b5f64429.entry.js.map → p-2e8a3d90.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-075025ab.system.js → p-30fcf18d.system.js} +2 -2
- package/dist/verdocs-web-sdk/{p-075025ab.system.js.map → p-30fcf18d.system.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-5b7a5deb.js → p-3ce35714.js} +2 -2
- package/dist/verdocs-web-sdk/{p-5b7a5deb.js.map → p-3ce35714.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-1cb6f31a.entry.js → p-455c2dd9.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-1cb6f31a.entry.js.map → p-455c2dd9.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-a51bb6bf.js → p-458b639d.js} +2 -2
- package/dist/verdocs-web-sdk/{p-a51bb6bf.js.map → p-458b639d.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-49227301.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-5f036dfe.entry.js.map → p-49227301.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-c41d9fc0.entry.js → p-515f3ab2.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c41d9fc0.entry.js.map → p-515f3ab2.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-57fad02b.system.js +2 -0
- package/dist/verdocs-web-sdk/p-57fad02b.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-78f5c8ad.system.js → p-58c4b767.system.js} +2 -2
- package/dist/verdocs-web-sdk/p-58c4b767.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-7937a240.system.entry.js → p-5e693763.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-7937a240.system.entry.js.map → p-5e693763.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-db837a46.system.entry.js → p-6896b64c.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-db837a46.system.entry.js.map → p-6896b64c.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-6baf87ba.js +2 -0
- package/dist/verdocs-web-sdk/p-6baf87ba.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-7fd610f5.entry.js → p-6d858f25.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-7fd610f5.entry.js.map → p-6d858f25.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-2bc68d06.system.js → p-6d8b9e75.system.js} +2 -2
- package/dist/verdocs-web-sdk/{p-2bc68d06.system.js.map → p-6d8b9e75.system.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-070ba589.system.entry.js → p-729db0b6.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-070ba589.system.entry.js.map → p-729db0b6.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-f7a56f6c.entry.js → p-78c6b2b1.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-78c6b2b1.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-c6de4457.system.entry.js → p-7d1a5bc5.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c6de4457.system.entry.js.map → p-7d1a5bc5.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-4f3b1c7c.entry.js → p-8c2cdcc4.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-4f3b1c7c.entry.js.map → p-8c2cdcc4.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-97329951.system.js.map +1 -1
- package/dist/verdocs-web-sdk/{p-4d371bfe.system.entry.js → p-99495fbb.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-4d371bfe.system.entry.js.map → p-99495fbb.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-38d5bc9e.entry.js → p-9f381d10.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-38d5bc9e.entry.js.map → p-9f381d10.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-a45632ec.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-695a3cce.entry.js.map → p-a45632ec.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-1fc3f986.system.entry.js → p-b5cf7ddc.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-b5cf7ddc.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-b76c949d.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-b76c949d.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-0ca01601.system.entry.js → p-bd6175d9.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-0ca01601.system.entry.js.map → p-bd6175d9.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-c16b6ca4.system.js +1 -1
- package/dist/verdocs-web-sdk/p-c16b6ca4.system.js.map +1 -1
- package/dist/verdocs-web-sdk/{p-92e526a0.system.entry.js → p-c35a211a.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-c35a211a.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-5a08e378.entry.js → p-c3d5596a.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-5a08e378.entry.js.map → p-c3d5596a.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-f68306f5.entry.js → p-c8fb8a55.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f68306f5.entry.js.map → p-c8fb8a55.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-0126c601.entry.js → p-cc30f8c8.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-0126c601.entry.js.map → p-cc30f8c8.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-cf6cfa4f.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-cf6cfa4f.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-d1c6b0f4.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-c731755d.system.entry.js.map → p-d1c6b0f4.system.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-9dc3b579.system.entry.js → p-d9413770.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-9dc3b579.system.entry.js.map → p-d9413770.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-de207098.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-de207098.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-ff1278ed.js.map +1 -1
- package/dist/verdocs-web-sdk/{p-fcc3041d.js → p-ff3b285c.js} +2 -2
- package/dist/verdocs-web-sdk/p-ff3b285c.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/Envelopes-d44c4a28.js.map +0 -1
- package/dist/cjs/utils-aa1285cc.js.map +0 -1
- package/dist/esm/Envelopes-28a4c67f.js.map +0 -1
- package/dist/esm/utils-c666adcf.js.map +0 -1
- package/dist/esm-es5/Envelopes-28a4c67f.js +0 -2
- package/dist/esm-es5/Envelopes-28a4c67f.js.map +0 -1
- package/dist/esm-es5/utils-c666adcf.js +0 -2
- package/dist/esm-es5/utils-c666adcf.js.map +0 -1
- package/dist/verdocs-web-sdk/p-1058c062.system.js +0 -2
- package/dist/verdocs-web-sdk/p-1058c062.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-1fc3f986.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-4b516c47.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-4b516c47.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-5f036dfe.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-695a3cce.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-7421e32e.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-78f5c8ad.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-92e526a0.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-c731755d.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-c7a22e57.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-c7a22e57.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-de06e0c6.js +0 -2
- package/dist/verdocs-web-sdk/p-de06e0c6.js.map +0 -1
- package/dist/verdocs-web-sdk/p-f7a56f6c.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-f9103136.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-f9103136.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-fa25cd77.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-fa25cd77.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-fcc3041d.js.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(t,e,o,i){function n(t){return t instanceof o?t:new o((function(e){e(t)}))}return new(o||(o=Promise))((function(o,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function s(t){try{l(i["throw"](t))}catch(t){r(t)}}function l(t){t.done?o(t.value):n(t.value).then(a,s)}l((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var o={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,n,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return l([t,e])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(o)try{if(i=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(r=o.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(a[0]===6&&o.label<r[1]){o.label=r[1];r=a;break}if(r&&o.label<r[2]){o.label=r[2];o.ops.push(a);break}if(r[2])o.ops.pop();o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t];n=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-97329951.system.js","./p-05eb4fed.system.js","./p-78f5c8ad.system.js","./p-e12b7fbc.system.js","./p-af2c2f79.system.js"],(function(t){"use strict";var e,o,i,n,r,a,s;return{setters:[function(t){e=t.r;o=t.c;i=t.h;n=t.H},function(t){r=t.g},function(t){a=t.g},function(t){s=t.c},function(){}],execute:function(){var l='verdocs-field-signature{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;width:83px;height:36px;display:block;font-size:11px;position:relative;letter-spacing:0.3px;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left;border:1px solid rgba(0, 0, 0, 0.2)}verdocs-field-signature.disabled{opacity:0.5}verdocs-field-signature.done{border:none;opacity:1}verdocs-field-signature img{display:block;max-width:100%;max-height:100%}verdocs-field-signature button{-webkit-box-sizing:border-box;box-sizing:border-box;border:none;color:rgba(0, 0, 0, 0.87);font-weight:500;-webkit-transform-origin:0 0;transform-origin:0 0;height:100%;width:100%;background:none;font-size:11px}verdocs-field-signature button.hide{display:none}verdocs-field-signature.required{border:1px solid #cc0000}verdocs-field-signature.focused{-webkit-animation:verdocs-field-pulse 0.75s 2;animation:verdocs-field-pulse 0.75s 2}verdocs-field-signature verdocs-button-panel{top:-3px;left:-2px;opacity:0.5;z-index:1000;cursor:pointer;position:absolute;-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-field-signature verdocs-button-panel[data-active],verdocs-field-signature verdocs-button-panel:hover{opacity:1}verdocs-field-signature verdocs-button-panel .icon svg{fill:#333333}verdocs-field-signature verdocs-button-panel .icon:hover svg{fill:#000000}';var d='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20"><path d="m7.5 18.5-.312-2.667q-.188-.125-.396-.25-.209-.125-.396-.229l-2.479 1.063-2.521-4.334 2.125-1.625q.021-.104.021-.229v-.458q0-.125-.021-.229L1.396 7.917l2.521-4.313 2.5 1.042q.166-.104.375-.229.208-.125.396-.229L7.5 1.5h5l.312 2.688q.188.104.396.229.209.125.396.229l2.479-1.042 2.521 4.313-2.125 1.625v.916l2.125 1.625-2.521 4.334-2.5-1.063q-.166.104-.375.229-.208.125-.396.25L12.5 18.5Zm2.479-5.521q1.229 0 2.104-.875T12.958 10q0-1.229-.875-2.104t-2.104-.875q-1.208 0-2.094.875Q7 8.771 7 10t.885 2.104q.886.875 2.094.875Zm0-1.75q-.5 0-.864-.364Q8.75 10.5 8.75 10t.365-.865q.364-.364.864-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.792 6.521h1.542l.25-2.146q.625-.167 1.198-.51.573-.344 1.031-.823l2.021.854.771-1.271-1.771-1.354q.104-.292.156-.615.052-.323.052-.656 0-.292-.052-.604-.052-.313-.135-.646l1.77-1.375-.77-1.271-2.021.875q-.479-.5-1.042-.833-.562-.334-1.187-.5l-.271-2.167H9.208l-.25 2.167q-.625.166-1.187.5-.563.333-1.042.812l-2-.854-.771 1.271 1.73 1.354q-.084.333-.136.656Q5.5 9.708 5.5 10t.052.604q.052.313.136.667l-1.73 1.354.771 1.271 2-.834q.479.459 1.042.792.562.334 1.187.5Z"/></svg>';var c=t("verdocs_field_signature",function(){function t(t){e(this,t);this.fieldChange=o(this,"fieldChange",7);this.settingsPress=o(this,"settingsPress",7);this.field=null;this.name="";this.disabled=false;this.editable=false;this.moveable=false;this.done=false;this.roleindex=0;this.tempSignature=""}t.prototype.focusField=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.handleShow();console.log("focused",this);return[2]}))}))};t.prototype.hideDialog=function(){var t;(t=this.dialog)===null||t===void 0?void 0:t.remove();this.dialog=null};t.prototype.handleAdopt=function(t){var e;console.log("[SIGNATURE] Adopted signature");this.tempSignature=t.detail;(e=this.fieldChange)===null||e===void 0?void 0:e.emit(this.tempSignature);this.hideDialog()};t.prototype.handleShow=function(){var t=this;this.dialog=document.createElement("verdocs-signature-dialog");this.dialog.setAttribute("name",this.name);this.dialog.setAttribute("roleindex",this.roleindex);this.dialog.addEventListener("cancel",(function(){return t.hideDialog()}));this.dialog.addEventListener("next",(function(e){return t.handleAdopt(e)}));document.body.append(this.dialog)};t.prototype.render=function(){var t=this;var e,o,s;var l=a(this.field);var c=this.tempSignature||l.base64;var p=(o=(e=this.disabled)!==null&&e!==void 0?e:l.disabled)!==null&&o!==void 0?o:false;var u=this.field["rgba"]||r(this.roleindex);if(this.done){return i(n,{class:{done:this.done}},c&&i("img",{src:this.tempSignature||l.base64,alt:"Signature"}))}return i(n,{class:{required:(s=this.field)===null||s===void 0?void 0:s.required,disabled:p},style:{backgroundColor:u}},c?i("img",{src:this.tempSignature||l.base64,alt:"Signature"}):i("button",{onClick:function(){return!p&&t.handleShow()}},"Signature"),this.editable&&i("verdocs-button-panel",{icon:d},i("h6",null,"Field Settings"),i("form",null,i("verdocs-select-input",{label:"Recipient",options:[{label:"Buyer",value:"Buyer"},{label:"Seller",value:"Seller"}]}),i("verdocs-text-input",{label:"Field Name",value:"",placeholder:"Stored field name...",onInput:function(t){return console.log("ipt",t)}}),i("verdocs-text-input",{label:"Placeholder",value:"",placeholder:"Placeholder text...",onInput:function(t){return console.log("ipt",t)}}))))};return t}());c.style=l;var p='verdocs-signature-dialog{font-family:"Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box;position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:#0000007f}verdocs-signature-dialog .dialog{width:100%;max-width:340px;border-radius:4px;overflow:hidden;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);background:#f9f9f9}verdocs-signature-dialog .heading{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;padding:20px 20px 0 20px;line-height:28px;font-size:20px;font-weight:500}verdocs-signature-dialog .content{font-size:14px;padding:20px}verdocs-signature-dialog .buttons{display:-ms-flexbox;display:flex;margin:20px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:center;align-items:center}verdocs-signature-dialog .buttons verdocs-button{margin-left:16px}verdocs-signature-dialog canvas{background:#ffffff;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 auto;width:300px;height:79px;max-width:100%;-webkit-box-shadow:0 0 6px 0 #0000001f;box-shadow:0 0 6px 0 #0000001f}verdocs-signature-dialog .disclaimer{text-align:justify;padding:8px 0;font-size:11px;line-height:14px;color:rgba(0, 0, 0, 0.54)}verdocs-signature-dialog .as-shown{font-size:11px;margin:4px 0 20px 4px;color:rgba(0, 0, 0, 0.54)}verdocs-signature-dialog .tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-signature-dialog .tabs .tab{padding:8px 15px;cursor:pointer}verdocs-signature-dialog .tabs .tab.active{border-bottom:2px solid #cccccc}verdocs-signature-dialog .tabs .tab:hover{color:#55bc81}';var u=t("verdocs_signature_dialog",function(){function t(t){e(this,t);this.next=o(this,"next",7);this.cancel=o(this,"cancel",7);this.name="";this.fontLoaded=false;this.enteredName="";this.mode="type"}t.prototype.componentWillLoad=function(){var t=this;this.enteredName=this.name;var e=new FontFace("Dancing Script","url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)");e.load().then((function(e){document.fonts.add(e);t.fontLoaded=true}))};t.prototype.componentDidLoad=function(){this.redrawSignature()};t.prototype.componentDidUpdate=function(){this.redrawSignature()};t.prototype.redrawSignature=function(){if(!this.canvasElement){return}var t=this.canvasElement.width;var e=this.canvasElement.getContext("2d");e.clearRect(0,0,this.canvasElement.width,this.canvasElement.height);var o=100;do{o-=2;e.font="".concat(o,"px Dancing Script")}while(e.measureText(this.enteredName).width>t-32);e.textAlign="center";e.textBaseline="middle";e.font="".concat(o,"px Dancing Script");e.fillText(this.enteredName,this.canvasElement.width/2,this.canvasElement.height/2)};t.prototype.handleNameChange=function(t){this.enteredName=t.target.value};t.prototype.handleCancel=function(t){t.stopPropagation();t.preventDefault();this.cancel.emit()};t.prototype.handleAdopt=function(t){t.stopPropagation();t.preventDefault();var e=this.canvasElement.toDataURL("image/png");this.next.emit(e)};t.prototype.render=function(){var t=this;return i(n,{onClick:function(e){return t.handleCancel(e)}},i("div",{class:"dialog"},i("div",{class:"heading"},"Create Your Signature"),i("div",{class:"content"},i("verdocs-text-input",{placeholder:"Full Name...",label:"Full Name",value:this.enteredName,onInput:function(e){return t.handleNameChange(e)},onClick:function(t){return t.stopPropagation()}}),i("div",{class:"as-shown"},"As shown on driver's license or govt. ID card."),this.fontLoaded?i("canvas",{ref:function(e){return t.canvasElement=e}}):i("div",{style:{display:"none"}}),i("div",{class:"disclaimer"},"By clicking Adopt, I agree that the signature will be the electronic representation of my signature for all purposes when I (or my agent) use them on documents, including legally binding contracts — just the same as a pen-and-paper signature or initial."),i("div",{class:"buttons"},i("verdocs-button",{label:"CANCEL",size:"normal",variant:"outline",onClick:function(e){return t.handleCancel(e)}}),i("verdocs-button",{label:"Adopt & Sign",size:"normal",onClick:function(e){return t.handleAdopt(e)}})))))};return t}());u.style=p;var h='verdocs-toolbar-icon{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:inline-block}verdocs-toolbar-icon .icon{display:inline-block;cursor:pointer}verdocs-toolbar-icon .icon svg{fill:#5c6575}verdocs-toolbar-icon .tooltip{display:none;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;background:#ffffff;color:#33364b;max-width:240px;font-weight:bold;padding:5px 10px;font-size:13px;position:relative;border-radius:4px;z-index:10000}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}';var f=t("verdocs_toolbar_icon",function(){function t(t){e(this,t);this.text="";this.icon="";this.containerId="verdocs-toolbar-icon-".concat(Math.random().toString(36).substring(2,11))}t.prototype.componentDidLoad=function(){this.popperInstance=s(this.iconEl,this.tooltip,{})};t.prototype.disconnectedCallback=function(){if(this.popperInstance){this.popperInstance.destroy();this.popperInstance=null}};t.prototype.show=function(){var t,e;(t=this.tooltip)===null||t===void 0?void 0:t.setAttribute("data-show","");(e=this.popperInstance)===null||e===void 0?void 0:e.update().catch((function(){}))};t.prototype.hide=function(){var t;(t=this.tooltip)===null||t===void 0?void 0:t.removeAttribute("data-show")};t.prototype.render=function(){var t=this;return i(n,{class:{}},i("div",{"aria-describedby":this.containerId,class:"icon",innerHTML:this.icon,onMouseEnter:function(){return t.show()},onFocus:function(){return t.show()},onMouseLeave:function(){return t.hide()},onBlur:function(){return t.hide()},ref:function(e){return t.iconEl=e}}),i("div",{id:this.containerId,role:"tooltip",class:"tooltip","data-popper-placement":"bottom",ref:function(e){return t.tooltip=e}},this.text,i("div",{"data-popper-arrow":"true",class:"arrow"})))};return t}());f.style=h}}}));
|
|
2
|
-
//# sourceMappingURL=p-c7a22e57.system.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["src/components/elements/verdocs-field-signature/verdocs-field-signature.scss?tag=verdocs-field-signature","src/components/elements/verdocs-field-signature/verdocs-field-signature.tsx","src/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.scss?tag=verdocs-signature-dialog","src/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.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"],"names":["verdocsFieldSignatureCss","settingsIcon","VerdocsFieldSignature","exports","class_1","prototype","focusField","this","handleShow","console","log","hideDialog","_a","dialog","remove","handleAdopt","e","tempSignature","detail","fieldChange","emit","_this","document","createElement","setAttribute","name","roleindex","addEventListener","body","append","render","settings","getFieldSettings","field","value","base64","disabled","_b","backgroundColor","getRGBA","done","h","Host","class","src","alt","required","_c","style","onClick","editable","icon","label","options","placeholder","onInput","verdocsSignatureDialogCss","VerdocsSignatureDialog","class_2","componentWillLoad","enteredName","ds","FontFace","load","then","font","fonts","add","fontLoaded","componentDidLoad","redrawSignature","componentDidUpdate","canvasElement","canvasWidth","width","context","getContext","clearRect","height","fontSize","concat","measureText","textAlign","textBaseline","fillText","handleNameChange","target","handleCancel","stopPropagation","preventDefault","cancel","data","toDataURL","next","ref","el","display","size","variant","verdocsToolbarIconCss","VerdocsToolbarIcon","Math","random","toString","substring","class_3","popperInstance","createPopper","iconEl","tooltip","disconnectedCallback","destroy","show","update","catch","hide","removeAttribute","aria-describedby","containerId","innerHTML","onMouseEnter","onFocus","onMouseLeave","onBlur","id","role","data-popper-placement","text","data-popper-arrow"],"mappings":"mwDAAA,IAAMA,EAA2B,03CCMjC,IAAMC,EACJ,6rCAWWC,EAAqBC,EAAA,0BAAA,oIAIwB,eAKhC,iBAKK,oBAMA,oBAKA,gBAKJ,qBAKI,qBAkBL,GANRC,EAAAC,UAAAC,WAAN,gGACRC,KAAKC,aACLC,QAAQC,IAAI,UAAWH,uBAQzBH,EAAAC,UAAAM,WAAA,kBACEC,EAAAL,KAAKM,UAAM,MAAAD,SAAA,OAAA,EAAAA,EAAEE,SACbP,KAAKM,OAAS,MAGhBT,EAAAC,UAAAU,YAAA,SAAYC,SACVP,QAAQC,IAAI,iCACZH,KAAKU,cAAgBD,EAAEE,QACvBN,EAAAL,KAAKY,eAAW,MAAAP,SAAA,OAAA,EAAAA,EAAEQ,KAAKb,KAAKU,eAC5BV,KAAKI,cAGPP,EAAAC,UAAAG,WAAA,WAAA,IAAAa,EAAAd,KACEA,KAAKM,OAASS,SAASC,cAAc,4BACrChB,KAAKM,OAAOW,aAAa,OAAQjB,KAAKkB,MACtClB,KAAKM,OAAOW,aAAa,YAAajB,KAAKmB,WAC3CnB,KAAKM,OAAOc,iBAAiB,UAAU,WAAM,OAAAN,EAAKV,gBAClDJ,KAAKM,OAAOc,iBAAiB,QAAQ,SAAAX,GAAK,OAAAK,EAAKN,YAAYC,MAC3DM,SAASM,KAAKC,OAAOtB,KAAKM,SAG5BT,EAAAC,UAAAyB,OAAA,WAAA,IAAAT,EAAAd,eACE,IAAMwB,EAAWC,EAAiBzB,KAAK0B,OACvC,IAAMC,EAAQ3B,KAAKU,eAAiBc,EAASI,OAC7C,IAAMC,GAAWC,GAAAzB,EAAAL,KAAK6B,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AAA,EAAE4E,SAASC,OAAM,gBAGtCT,EAAApG,UAAA8G,KAAA,kBACEvG,EAAAL,KAAKsG,WAAO,MAAAjG,SAAA,OAAA,EAAAA,EAAEwG,gBAAgB,cAOhCX,EAAApG,UAAAyB,OAAA,WAAA,IAAAT,EAAAd,KACE,OACEkC,EAACC,EAAI,CAACC,MAAO,IACXF,EAAA,MAAA,CAAA4E,mBACoB9G,KAAK+G,YACvB3E,MAAM,OACN4E,UAAWhH,KAAK4C,KAChBqE,aAAc,WAAM,OAAAnG,EAAK2F,QACzBS,QAAS,WAAM,OAAApG,EAAK2F,QACpBU,aAAc,WAAM,OAAArG,EAAK8F,QACzBQ,OAAQ,WAAM,OAAAtG,EAAK8F,QACnBrB,IAAK,SAAAC,GAAE,OAAK1E,EAAKuF,OAASb,KAE5BtD,EAAA,MAAA,CAAKmF,GAAIrH,KAAK+G,YAAaO,KAAK,UAAUlF,MAAM,UAASmF,wBAAuB,SAAShC,IAAK,SAAAC,GAAE,OAAK1E,EAAKwF,QAAUd,IACjHxF,KAAKwH,KACNtF,EAAA,MAAA,CAAAuF,oBAAuB,OAAOrF,MAAM,sBAhEf","sourcesContent":["@import '../../../theme.scss';\n\nverdocs-field-signature {\n font-family: $verdocs-primary-font;\n width: 83px;\n height: 36px;\n display: block;\n font-size: 11px;\n position: relative;\n letter-spacing: 0.3px;\n background-color: transparent;\n transform-origin: bottom left;\n border: 1px solid rgba(0, 0, 0, 0.2);\n\n &.disabled {\n opacity: 0.5;\n }\n\n &.done {\n border: none;\n opacity: 1;\n }\n\n img {\n display: block;\n max-width: 100%;\n max-height: 100%;\n }\n\n button {\n box-sizing: border-box;\n border: none;\n color: rgba(0, 0, 0, 0.87);\n font-weight: 500;\n transform-origin: 0 0;\n height: 100%;\n width: 100%;\n background: none;\n font-size: 11px;\n\n &.hide {\n display: none;\n }\n }\n\n &.required {\n border: 1px solid rgb(204, 0, 0);\n }\n\n &.focused {\n animation: verdocs-field-pulse 0.75s 2;\n }\n\n verdocs-button-panel {\n top: -3px;\n left: -2px;\n opacity: 0.5;\n z-index: 1000;\n cursor: pointer;\n position: absolute;\n transform: scale(0.6);\n\n &[data-active],\n &:hover {\n opacity: 1;\n }\n\n .icon {\n svg {\n fill: #333333;\n }\n\n &:hover {\n svg {\n fill: #000000;\n }\n }\n }\n }\n}\n","import {getRGBA} from '@verdocs/js-sdk/Utils/Colors';\nimport {ITemplateField} from '@verdocs/js-sdk/Templates/Types';\nimport {IDocumentField} from '@verdocs/js-sdk/Envelopes/Types';\nimport {Component, h, Host, Prop, Event, EventEmitter, Method, State} from '@stencil/core';\nimport {getFieldSettings} from '../../../utils/utils';\n\nconst settingsIcon =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\"><path d=\"m7.5 18.5-.312-2.667q-.188-.125-.396-.25-.209-.125-.396-.229l-2.479 1.063-2.521-4.334 2.125-1.625q.021-.104.021-.229v-.458q0-.125-.021-.229L1.396 7.917l2.521-4.313 2.5 1.042q.166-.104.375-.229.208-.125.396-.229L7.5 1.5h5l.312 2.688q.188.104.396.229.209.125.396.229l2.479-1.042 2.521 4.313-2.125 1.625v.916l2.125 1.625-2.521 4.334-2.5-1.063q-.166.104-.375.229-.208.125-.396.25L12.5 18.5Zm2.479-5.521q1.229 0 2.104-.875T12.958 10q0-1.229-.875-2.104t-2.104-.875q-1.208 0-2.094.875Q7 8.771 7 10t.885 2.104q.886.875 2.094.875Zm0-1.75q-.5 0-.864-.364Q8.75 10.5 8.75 10t.365-.865q.364-.364.864-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.792 6.521h1.542l.25-2.146q.625-.167 1.198-.51.573-.344 1.031-.823l2.021.854.771-1.271-1.771-1.354q.104-.292.156-.615.052-.323.052-.656 0-.292-.052-.604-.052-.313-.135-.646l1.77-1.375-.77-1.271-2.021.875q-.479-.5-1.042-.833-.562-.334-1.187-.5l-.271-2.167H9.208l-.25 2.167q-.625.166-1.187.5-.563.333-1.042.812l-2-.854-.771 1.271 1.73 1.354q-.084.333-.136.656Q5.5 9.708 5.5 10t.052.604q.052.313.136.667l-1.73 1.354.771 1.271 2-.834q.479.459 1.042.792.562.334 1.187.5Z\"/></svg>';\n\n/**\n * Displays a signature field. If a signature already exists, it will be displayed and the field will be disabled. Otherwise, a placeholder\n * button will be shown. Clicking the button will show a dialog to adopt a signature.\n */\n@Component({\n tag: 'verdocs-field-signature',\n styleUrl: 'verdocs-field-signature.scss',\n shadow: false,\n})\nexport class VerdocsFieldSignature {\n /**\n * The document or template field to display.\n */\n @Prop() field: IDocumentField | ITemplateField | null = null;\n\n /**\n * If set, the signature creation dialog will be initialized with this text.\n */\n @Prop() name?: string = '';\n\n /**\n * If set, overrides the field's settings object. Primarily used to support \"preview\" modes where all fields are disabled.\n */\n @Prop() disabled?: boolean = false;\n\n /**\n * If set, a settings icon will be displayed on hover. The settings shown allow the field's recipient and other settings to be\n * changed, so it should typically only be enabled in the Builder.\n */\n @Prop() editable?: boolean = false;\n\n /**\n * If set, the field may be dragged to a new location. This should only be enabled in the Builder, or for self-placed fields.\n */\n @Prop() moveable?: boolean = false;\n\n /**\n * If set, the field is considered \"done\" and is drawn in a display-final-value state.\n */\n @Prop() done?: boolean = false;\n\n /**\n * If set, the field will be colored using this index value to select the background color.\n */\n @Prop() roleindex?: number = 0;\n\n /**\n * Event emitted when the field has changed.\n */\n @Event({composed: true}) fieldChange: EventEmitter<string>;\n\n /**\n * Event fired on every character entered into / deleted from the field.\n */\n @Event({composed: true}) settingsPress: EventEmitter;\n\n @Method() async focusField() {\n this.handleShow();\n console.log('focused', this);\n }\n\n @State()\n tempSignature: string = '';\n\n private dialog?: any;\n\n hideDialog() {\n this.dialog?.remove();\n this.dialog = null;\n }\n\n handleAdopt(e: any) {\n console.log('[SIGNATURE] Adopted signature');\n this.tempSignature = e.detail;\n this.fieldChange?.emit(this.tempSignature);\n this.hideDialog();\n }\n\n handleShow() {\n this.dialog = document.createElement('verdocs-signature-dialog');\n this.dialog.setAttribute('name', this.name);\n this.dialog.setAttribute('roleindex', this.roleindex);\n this.dialog.addEventListener('cancel', () => this.hideDialog());\n this.dialog.addEventListener('next', e => this.handleAdopt(e));\n document.body.append(this.dialog);\n }\n\n render() {\n const settings = getFieldSettings(this.field);\n const value = this.tempSignature || settings.base64;\n const disabled = this.disabled ?? settings.disabled ?? false;\n const backgroundColor = this.field['rgba'] || getRGBA(this.roleindex);\n\n if (this.done) {\n return <Host class={{done: this.done}}>{value && <img src={this.tempSignature || settings.base64} alt=\"Signature\" />}</Host>;\n }\n\n return (\n <Host class={{required: this.field?.required, disabled}} style={{backgroundColor}}>\n {value ? <img src={this.tempSignature || settings.base64} alt=\"Signature\" /> : <button onClick={() => !disabled && this.handleShow()}>Signature</button>}\n\n {this.editable && (\n <verdocs-button-panel icon={settingsIcon}>\n <h6>Field Settings</h6>\n <form>\n <verdocs-select-input\n label=\"Recipient\"\n options={[\n {label: 'Buyer', value: 'Buyer'},\n {label: 'Seller', value: 'Seller'},\n ]}\n />\n\n <verdocs-text-input label=\"Field Name\" value=\"\" placeholder=\"Stored field name...\" onInput={e => console.log('ipt', e)} />\n <verdocs-text-input label=\"Placeholder\" value=\"\" placeholder=\"Placeholder text...\" onInput={e => console.log('ipt', e)} />\n </form>\n </verdocs-button-panel>\n )}\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-signature-dialog {\n font-family: $primary-font;\n box-sizing: border-box;\n position: fixed;\n z-index: 10000;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #0000007f;\n\n .dialog {\n width: 100%;\n max-width: 340px;\n border-radius: 4px;\n overflow: hidden;\n box-shadow: 3px 3px 5px 1px rgba(40, 40, 40, 0.4);\n background: $dialog-bg;\n }\n\n .heading {\n display: flex;\n flex-direction: row;\n padding: 20px 20px 0 20px;\n line-height: 28px;\n font-size: 20px;\n font-weight: 500;\n }\n\n .content {\n font-size: 14px;\n padding: 20px;\n }\n\n .buttons {\n display: flex;\n margin: 20px 0 0 0;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n\n verdocs-button {\n margin-left: 16px;\n }\n }\n\n canvas {\n background: $verdocs-grey-4;\n box-sizing: border-box;\n margin: 0 auto;\n width: 300px;\n // TODO: The original app had an aspect ratio of (80 / 305) * (signatureBodyWidth - 20)\n height: 79px;\n max-width: 100%;\n box-shadow: 0 0 6px 0 #0000001f;\n }\n\n .disclaimer {\n text-align: justify;\n padding: 8px 0;\n font-size: 11px;\n line-height: 14px;\n color: rgba(0, 0, 0, 0.54);\n }\n\n .as-shown {\n font-size: 11px;\n margin: 4px 0 20px 4px;\n color: rgba(0, 0, 0, 0.54);\n }\n\n .tabs {\n display: flex;\n flex-direction: row;\n\n .tab {\n padding: 8px 15px;\n cursor: pointer;\n\n &.active {\n border-bottom: 2px solid $light-border-color;\n }\n\n &:hover {\n color: $primary-color;\n }\n }\n }\n}\n","import {Component, Prop, h, Event, EventEmitter, State, Host} from '@stencil/core';\n\n/**\n * Display a dialog that allows the user to specify a signature image, either by using a signature-font-generated image\n * based on their full name, or by hand-drawing their signature with a mouse or tablet.\n */\n@Component({\n tag: 'verdocs-signature-dialog',\n styleUrl: 'verdocs-signature-dialog.scss',\n})\nexport class VerdocsSignatureDialog {\n private canvasElement?: HTMLCanvasElement;\n\n /**\n * Initial signature text\n */\n @Prop() name: string = '';\n\n /**\n * Fired when the user completes the dialog and clicks Adopt. The event detail will contain a base64-encoded string\n * representation of the signature adopted.\n */\n @Event({composed: true}) next: EventEmitter<string>;\n\n /**\n * Fired if the user cancels the dialog.\n */\n @Event({composed: true}) cancel: EventEmitter;\n\n @State() fontLoaded = false;\n\n @State() enteredName: string = '';\n\n @State() mode: string = 'type';\n\n componentWillLoad() {\n this.enteredName = this.name;\n\n const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');\n ds.load().then(font => {\n document.fonts.add(font);\n this.fontLoaded = true;\n });\n }\n\n componentDidLoad() {\n this.redrawSignature();\n }\n\n componentDidUpdate() {\n this.redrawSignature();\n }\n\n redrawSignature() {\n if (!this.canvasElement) {\n return;\n }\n\n const canvasWidth = this.canvasElement.width;\n\n const context = this.canvasElement.getContext('2d');\n context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);\n\n let fontSize = 100;\n do {\n fontSize -= 2;\n context.font = `${fontSize}px Dancing Script`;\n } while (context.measureText(this.enteredName).width > canvasWidth - 32); // 32px padding each side\n\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n context.font = `${fontSize}px Dancing Script`;\n context.fillText(this.enteredName, this.canvasElement.width / 2, this.canvasElement.height / 2);\n }\n\n handleNameChange(e: any) {\n this.enteredName = e.target.value;\n }\n\n handleCancel(e: any) {\n e.stopPropagation();\n e.preventDefault();\n this.cancel.emit();\n }\n\n handleAdopt(e: any) {\n e.stopPropagation();\n e.preventDefault();\n const data = this.canvasElement.toDataURL('image/png');\n this.next.emit(data);\n }\n\n /*\n selColor(hex: string) {\n this.color = hex;\n this.animateDraw();\n }\n\n stopDraw() {\n this.paint = false;\n this.adoptedAndSigned = !this.hasSignature();\n }\n\n draw(e) {\n this.paint = true;\n this.addPoints(e, false);\n this.animateDraw();\n }\n\n recordPoints(e) {\n if (this.paint) {\n this.addPoints(e, true);\n this.animateDraw();\n }\n }\n\n animateDraw() {\n this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);\n\n this.canvas.strokeStyle = this.color || '#000000';\n this.canvas.lineJoin = 'round';\n this.canvas.lineWidth = 3;\n\n for (let i = 0; i < this.points.length; i++) {\n this.canvas.beginPath();\n if (this.points[i].drag && i) {\n this.canvas.moveTo(this.points[i - 1].x, this.points[i - 1].y);\n // this.canvas.arc(this.points[i - 1].x, this.points[i - 1].y, 2, 0, 2 * Math.PI, false);\n } else {\n this.canvas.moveTo(this.points[i].x - 1, this.points[i].y);\n // this.canvas.arc(this.points[i].x, this.points[i].y, 2, 0, 2 * Math.PI, false);\n }\n\n this.canvas.lineTo(this.points[i].x, this.points[i].y);\n this.canvas.closePath();\n this.canvas.stroke();\n }\n }\n\n drawCurve(color: string, curve: number) {\n this.canvas.beginPath();\n }\n\n\n\n addPoints(e, drag: boolean) {\n if (window) {\n let x;\n let y;\n e.preventDefault();\n if (e.touches && e.touches.length > 0) {\n x = e.touches[0].clientX;\n } else {\n x = e.clientX;\n }\n\n if (e.touches && e.touches.length > 0) {\n y = e.touches[0].clientY;\n } else {\n y = e.clientY;\n }\n const rect = this.signatureCanvas.nativeElement.getBoundingClientRect();\n this.points.push({\n x: x - rect.left,\n y: y - rect.top,\n drag: drag\n });\n }\n }\n\n clearPad() {\n this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);\n this.points = [];\n this.adoptedAndSigned = !this.hasSignature();\n }\n\n async adoptAndSign() {\n try {\n this.adoptedAndSigned = true;\n await this.updateFullName();\n await this.captureSignatureFromCanvas();\n const message = this.signatureMode === 'Signature' ? 'Saving Signature' : 'Saving Initial';\n this.snackbarService.open(message, 'OK', this.snackbarService.initConfig(null, 'bottom'));\n this.handleMode();\n } catch (err) {\n this.snackbarService.open('Failed to apply signature', 'OK', this.snackbarService.initConfig(null, 'bottom'));\n }\n }\n\n handleMode() {\n let currentField;\n switch (this.mode) {\n case 'signerview':\n if (this.signatureMode === 'Signature') {\n this.signatureService.postSignatureBlob().then(result => {\n if (result && result.id && result.url) {\n currentField = this.signatureService.currField;\n this.signatureService.updateSigned(currentField.fName, true);\n this.signatureService.toggleSig(false);\n this.signatureService.setSignatureId(result.id);\n this.signatureService.putSignatureField(this.envelopeId, this.fieldName, result.id).then(res => {\n this.eventTracker.createEvent({\n category: 'verdoc',\n action: 'verdoc signed',\n label: `verdoc id: ${this.envelopeId}`\n })\n if (res && res.settings) {\n this.signatureService.setSignatureData(res.settings.base64);\n this.signatureService.setSignatureId(res.settings.signature_id);\n }\n this.snackbarService.dismiss();\n this.dialog.close({ status: 'saved', temp_sig: res.settings.base64, sig_id: res.settings.signature_id });\n }).catch(err => {\n this.snackbarService.open('Failed to save signature. Please try again.', 'DISMISS', {\n duration: 3000\n });\n this.adoptedAndSigned = false;\n return err;\n });\n }\n });\n } else {\n this.signatureService.postInitialBlob().then(result => {\n if (result && result.id && result.url) {\n currentField = this.signatureService.currField;\n this.signatureService.updateInitialed(currentField.fName, true);\n this.signatureService.setInitialId(result.id);\n this.signatureService.toggleSig(false);\n this.signatureService.putInitialField(this.envelopeId, this.fieldName, result.id).then(res => {\n if (res && res.settings) {\n this.signatureService.setInitialData(res.settings.base64);\n this.signatureService.setInitialId(res.settings.initial_id);\n }\n this.snackbarService.dismiss();\n this.dialog.close({ status: 'saved', temp_int: res.settings.base64, int_id: res.settings.initial_id });\n }).catch(err => {\n this.snackbarService.open('Failed to save initial. Please try again.', 'DISMISS', {\n duration: 3000\n });\n this.adoptedAndSigned = false;\n return err;\n });\n }\n });\n }\n break;\n }\n }\n */\n\n render() {\n return (\n <Host onClick={e => this.handleCancel(e)}>\n <div class=\"dialog\">\n <div class=\"heading\">Create Your Signature</div>\n\n <div class=\"content\">\n <verdocs-text-input placeholder=\"Full Name...\" label=\"Full Name\" value={this.enteredName} onInput={e => this.handleNameChange(e)} onClick={e => e.stopPropagation()} />\n <div class=\"as-shown\">As shown on driver's license or govt. ID card.</div>\n\n {/*<div class=\"tabs\">*/}\n {/* <div class={{tab: true, active: this.mode === 'type'}} onClick={() => (this.mode = 'type')}>*/}\n {/* Type*/}\n {/* </div>*/}\n {/*<div class={{tab: true, active: this.mode === 'draw'}} onClick={() => (this.mode = 'draw')}>*/}\n {/* Draw*/}\n {/*</div>*/}\n {/*</div>*/}\n\n {this.fontLoaded ? <canvas ref={el => (this.canvasElement = el as HTMLCanvasElement)} /> : <div style={{display: 'none'}} />}\n\n <div class=\"disclaimer\">\n By clicking Adopt, I agree that the signature will be the electronic representation of my signature for all purposes when I (or my agent) use them on documents,\n including legally binding contracts — just the same as a pen-and-paper signature or initial.\n </div>\n\n <div class=\"buttons\">\n <verdocs-button label=\"CANCEL\" size=\"normal\" variant=\"outline\" onClick={e => this.handleCancel(e)} />\n <verdocs-button label=\"Adopt & Sign\" size=\"normal\" onClick={e => this.handleAdopt(e)} />\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-toolbar-icon {\n font-family: $verdocs-primary-font;\n display: inline-block;\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: 10000;\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}\n","import {createPopper, Instance} from '@popperjs/core';\nimport {Component, h, Host, Prop, State} from '@stencil/core';\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@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 * 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: '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=\"bottom\" 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"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as e}from"./p-fcc3041d.js";import{c as o}from"./p-5ea05a1d.js";const{state:l,onChange:n}=o({envelope:null,loadProgress:0,loading:true,error:"",roleNames:[],dirty:false});n("envelope",(async e=>{if(!e){console.log("[ENVELOPESTORE] Clearing envelope");l.roleNames=[];l.dirty=false;l.loading=false;l.error="";l.loadProgress=0;return}console.log("[ENVELOPESTORE] Loaded envelope",e);l.roleNames=e.recipients.map((e=>e.role_name));console.log("[ENVELOPESTORE] Loaded roles",l.roleNames)}));const r=async(o,n)=>{var r,a;if(!n){console.log(`[ENVELOPES] Missing required envelope ID`);return}if(((r=l.envelope)===null||r===void 0?void 0:r.id)===n){console.log(`[ENVELOPES] Skipping load for already-loaded envelope ID`);return}l.error="";l.loading=true;l.envelope=null;try{console.log(`[ENVELOPES] Loading envelope ${n}`);const r=await e(o,n,true);if(!r){console.log("[ENVELOPES] Unable to load envelope");return}l.envelope=r;l.loading=false}catch(e){l.loading=false;l.error=((a=e===null||e===void 0?void 0:e.response)===null||a===void 0?void 0:a.status)===401?"Authentication required":e.message;console.log("[ENVELOPES] Error loading envelope",e);throw e}};export{r as g,l as s};
|
|
2
|
-
//# sourceMappingURL=p-de06e0c6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["src/utils/envelopeStore.ts","src/utils/Envelopes.ts"],"names":["state","onChange","createStore","envelope","loadProgress","loading","error","roleNames","dirty","async","newEnvelope","console","log","recipients","map","recipient","role_name","getEnvelopeById","endpoint","envelopeId","_a","EnvelopeStore","id","getEnvelope","e","_b","response","status","message"],"mappings":"8EAMMA,MAACA,EAAKC,SAAEA,GAAYC,EAAY,CACpCC,SAAU,KACVC,aAAc,EACdC,QAAS,KACTC,MAAO,GAEPC,UAAW,GACXC,MAAO,QAGTP,EAAS,YAAYQ,MAAMC,IACzB,IAAKA,EAAa,CAChBC,QAAQC,IAAI,qCACZZ,EAAMO,UAAY,GAClBP,EAAMQ,MAAQ,MACdR,EAAMK,QAAU,MAChBL,EAAMM,MAAQ,GACdN,EAAMI,aAAe,EACrB,OAGFO,QAAQC,IAAI,kCAAmCF,GAE/CV,EAAMO,UAAYG,EAAYG,WAAWC,KAAIC,GAAaA,EAAUC,YAEpEL,QAAQC,IAAI,+BAAgCZ,EAAMO,oBCzBvCU,EAAkBR,MAAOS,EAA2BC,aAC/D,IAAKA,EAAY,CACfR,QAAQC,IAAI,4CACZ,OAGF,KAAIQ,EAAAC,EAAclB,YAAQ,MAAAiB,SAAA,OAAA,EAAAA,EAAEE,MAAOH,EAAY,CAC7CR,QAAQC,IAAI,4DACZ,OAGFS,EAAcf,MAAQ,GACtBe,EAAchB,QAAU,KACxBgB,EAAclB,SAAW,KAEzB,IACEQ,QAAQC,IAAI,gCAAgCO,KAC5C,MAAMhB,QAAiBoB,EAAYL,EAAUC,EAAY,MACzD,IAAKhB,EAAU,CACbQ,QAAQC,IAAI,uCACZ,OAGFS,EAAclB,SAAWA,EACzBkB,EAAchB,QAAU,MACxB,MAAOmB,GACPH,EAAchB,QAAU,MACxBgB,EAAcf,QAAQmB,EAAAD,IAAC,MAADA,SAAC,OAAA,EAADA,EAAGE,YAAQ,MAAAD,SAAA,OAAA,EAAAA,EAAEE,UAAW,IAAM,0BAA4BH,EAAEI,QAClFjB,QAAQC,IAAI,qCAAsCY,GAClD,MAAMA","sourcesContent":["// NOTE: Do not attempt to convert this to a named-export module. It triggers compilation issues in Rollup that I spent days trying to\n// resolve. This needs to export a single default value of the store's state. Any helper functions should go in Templates.ts here.\n\nimport {createStore} from '@stencil/store';\nimport {IEnvelope} from '@verdocs/js-sdk/Envelopes/Types';\n\nconst {state, onChange} = createStore({\n envelope: null as IEnvelope | null,\n loadProgress: 0,\n loading: true,\n error: '',\n\n roleNames: [] as string[],\n dirty: false,\n});\n\nonChange('envelope', async newEnvelope => {\n if (!newEnvelope) {\n console.log('[ENVELOPESTORE] Clearing envelope');\n state.roleNames = [];\n state.dirty = false;\n state.loading = false;\n state.error = '';\n state.loadProgress = 0;\n return;\n }\n\n console.log('[ENVELOPESTORE] Loaded envelope', newEnvelope);\n\n state.roleNames = newEnvelope.recipients.map(recipient => recipient.role_name);\n newEnvelope.recipients;\n console.log('[ENVELOPESTORE] Loaded roles', state.roleNames);\n});\n\nexport default state;\n","import {VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {getEnvelope} from '@verdocs/js-sdk/Envelopes/Envelopes';\nimport EnvelopeStore from './envelopeStore';\n\n// Allows envelope data to be cached for reuse between components, without parent components having to prop-drill entire envelopes into\n// child elements.\nexport const getEnvelopeById = async (endpoint: VerdocsEndpoint, envelopeId: string) => {\n if (!envelopeId) {\n console.log(`[ENVELOPES] Missing required envelope ID`);\n return;\n }\n\n if (EnvelopeStore.envelope?.id === envelopeId) {\n console.log(`[ENVELOPES] Skipping load for already-loaded envelope ID`);\n return;\n }\n\n EnvelopeStore.error = '';\n EnvelopeStore.loading = true;\n EnvelopeStore.envelope = null;\n\n try {\n console.log(`[ENVELOPES] Loading envelope ${envelopeId}`);\n const envelope = await getEnvelope(endpoint, envelopeId, true);\n if (!envelope) {\n console.log('[ENVELOPES] Unable to load envelope');\n return;\n }\n\n EnvelopeStore.envelope = envelope;\n EnvelopeStore.loading = false;\n } catch (e) {\n EnvelopeStore.loading = false;\n EnvelopeStore.error = e?.response?.status === 401 ? 'Authentication required' : e.message;\n console.log('[ENVELOPES] Error loading envelope', e);\n throw e;\n }\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["src/components/elements/verdocs-document-page/verdocs-document-page.scss?tag=verdocs-document-page","src/components/elements/verdocs-document-page/verdocs-document-page.tsx","src/components/controls/verdocs-loader/verdocs-loader.scss?tag=verdocs-loader","src/components/controls/verdocs-loader/verdocs-loader.tsx"],"names":["verdocsDocumentPageCss","VerdocsDocumentPage","name","type","Math","random","toString","substring","this","virtualWidth","virtualHeight","[object Object]","resizeObserver","ResizeObserver","throttle","entries","entry","renderedWidth","contentRect","width","renderedHeight","notifyRenderedSize","observe","container","_a","disconnect","skipFirstNotification","pageRendered","emit","containerId","pageNumber","naturalWidth","naturalHeight","aspectRatio","xScale","yScale","height","h","Host","id","style","layers","map","layer","class","src","pageImageUri","alt","aria-hidden","onLoad","e","target","verdocsLoaderCss","VerdocsLoader"],"mappings":"4HAAA,MAAMA,EAAyB,6SCgBlBC,EAAmB,4FAOC,mBAMF,oBAME,uBAMC,gBAcD,CAAC,CAACC,KAAM,OAAQC,KAAM,4BAO9B,yBAAyBC,KAAKC,SAASC,SAAS,IAAIC,UAA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C,aACVC,IAAK,QAAQvC,KAAKsB,aAAYkB,cACjB,KACbC,OAASC,IAQP1C,KAAKuB,aAAemB,EAAEC,OAAOpB,aAC7BvB,KAAKwB,cAAgBkB,EAAEC,OAAOnB,cAC9BxB,KAAKyB,YAAczB,KAAKuB,aAAevB,KAAKwB,cAC5CxB,KAAKE,cAAgBF,KAAKC,aAAeD,KAAKyB,6DCpJ9D,MAAMmB,EAAmB,kqUCUZC,EAAa,+BACxB1C,SACE,OAAO0B,EAACC,EAAI","sourcesContent":["@import '../../../theme.scss';\n\nverdocs-document-page {\n width: 100%;\n position: relative;\n\n .verdocs-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","// NOTE: This component does not have a story because it's not intended for external use.\n\nimport {Component, h, Host, Prop, Event, EventEmitter, State, Element} from '@stencil/core';\nimport {IDocumentPageInfo, IPageLayer} from '../../../utils/Types';\nimport {throttle} from '../../../utils/utils';\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-document-page',\n styleUrl: 'verdocs-document-page.scss',\n shadow: false,\n})\nexport class VerdocsDocumentPage {\n @Element() container: HTMLElement;\n private resizeObserver: ResizeObserver;\n\n /**\n * The URL of the image to render as the page background.\n */\n @Prop() pageImageUri: string = '';\n\n /**\n * The page number being rendered. Not used internally, but included in callbacks/events beacuse page numbers\n * are used everywhere in document handling. (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() 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\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\n @State() skipFirstNotification = true;\n\n componentDidLoad(): void {\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 disconnectedCallback() {\n this.resizeObserver?.disconnect();\n }\n\n // Left here for documentation purposes in case we find an edge case where this isn't true. But we apparently don't need this.\n // When we add the resize observer it will always be triggered at least once so notifying here as well is just a dupe.\n // componentDidRender() {\n // this.notifyRenderedSize();\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 this.pageRendered.emit({\n container: this.container,\n containerId: this.containerId,\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: this.renderedWidth / this.virtualWidth,\n yScale: this.renderedHeight / this.virtualHeight,\n });\n }\n\n render() {\n const height = `${this.renderedHeight}px`;\n\n return (\n <Host id={`${this.containerId}`} style={{height}}>\n {this.layers.map(layer =>\n layer.type === 'div' ? (\n <div class=\"verdocs-document-page-layer\" id={`${this.containerId}-${layer.name}`} style={{height}} />\n ) : (\n <img\n class=\"verdocs-document-page-layer img\"\n id={`${this.containerId}-${layer.name}`}\n src={this.pageImageUri}\n alt={`Page ${this.pageNumber}`}\n aria-hidden={true}\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 }}\n />\n ),\n )}\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-loader {\n display: block;\n position: absolute;\n top: 50%;\n left: 50%;\n margin-left: -20px;\n margin-top: -20px;\n font-size: 24px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n text-indent: -9999em;\n -webkit-animation: load5 1.1s infinite ease;\n animation: verdocs-loader-kf 1.1s infinite ease;\n -webkit-transform: translateZ(0);\n -ms-transform: translateZ(0);\n transform: translateZ(0);\n}\n\n@keyframes verdocs-loader-kf {\n 0%,\n 100% {\n box-shadow: 0em -2.6em 0em 0em $verdocs-bg-2, 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), 2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2),\n 0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), -2.6em 0em 0 0em rgba(0, 0, 0, 0.3), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.4);\n }\n 12.5% {\n box-shadow: 0em -2.6em 0em 0em rgba(0, 0, 0, 0.4), 1.8em -1.8em 0 0em $verdocs-bg-2, 2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2),\n 0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), -2.6em 0em 0 0em rgba(0, 0, 0, 0.2), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.3);\n }\n 25% {\n box-shadow: 0em -2.6em 0em 0em rgba(0, 0, 0, 0.3), 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.4), 2.5em 0em 0 0em $verdocs-bg-2, 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2),\n 0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), -2.6em 0em 0 0em rgba(0, 0, 0, 0.2), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2);\n }\n 37.5% {\n box-shadow: 0em -2.6em 0em 0em rgba(0, 0, 0, 0.2), 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.3), 2.5em 0em 0 0em rgba(0, 0, 0, 0.4), 1.75em 1.75em 0 0em $verdocs-bg-2,\n 0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), -2.6em 0em 0 0em rgba(0, 0, 0, 0.2), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2);\n }\n 50% {\n box-shadow: 0em -2.6em 0em 0em rgba(0, 0, 0, 0.2), 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), 2.5em 0em 0 0em rgba(0, 0, 0, 0.3), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.4),\n 0em 2.5em 0 0em $verdocs-bg-2, -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.2), -2.6em 0em 0 0em rgba(0, 0, 0, 0.2), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2);\n }\n 62.5% {\n box-shadow: 0em -2.6em 0em 0em rgba(0, 0, 0, 0.2), 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), 2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.3),\n 0em 2.5em 0 0em rgba(0, 0, 0, 0.4), -1.8em 1.8em 0 0em $verdocs-bg-2, -2.6em 0em 0 0em rgba(0, 0, 0, 0.2), -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2);\n }\n 75% {\n box-shadow: 0em -2.6em 0em 0em rgba(0, 0, 0, 0.2), 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), 2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2),\n 0em 2.5em 0 0em rgba(0, 0, 0, 0.3), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.4), -2.6em 0em 0 0em $verdocs-bg-2, -1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2);\n }\n 87.5% {\n box-shadow: 0em -2.6em 0em 0em rgba(0, 0, 0, 0.2), 1.8em -1.8em 0 0em rgba(0, 0, 0, 0.2), 2.5em 0em 0 0em rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0em rgba(0, 0, 0, 0.2),\n 0em 2.5em 0 0em rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0em rgba(0, 0, 0, 0.3), -2.6em 0em 0 0em rgba(0, 0, 0, 0.4), -1.8em -1.8em 0 0em $verdocs-bg-2;\n }\n}\n","import {Component, h, Host} from '@stencil/core';\n\n/**\n * Animated loader placeholder. There are currently no configuration options for this control.\n */\n@Component({\n tag: 'verdocs-loader',\n styleUrl: 'verdocs-loader.scss',\n shadow: false,\n})\nexport class VerdocsLoader {\n render() {\n return <Host />;\n }\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e,c as i,h as t,H as s,F as n}from"./p-ff1278ed.js";import{b as o,s as r,u as a,c as l,d,f as c,a as h,r as u,e as v}from"./p-fcc3041d.js";import"./p-8efc9749.js";import{a as f,i as p}from"./p-e662f81b.js";import{V as g}from"./p-5e67c42f.js";import{g as x,s as m}from"./p-de06e0c6.js";import{S as b}from"./p-7a1b2643.js";import"./p-21603661.js";import"./p-5ea05a1d.js";var w=undefined&&undefined.__awaiter||function(e,i,t,s){function n(e){return e instanceof t?e:new t((function(i){i(e)}))}return new(t||(t=Promise))((function(t,o){function r(e){try{l(s.next(e))}catch(e){o(e)}}function a(e){try{l(s["throw"](e))}catch(e){o(e)}}function l(e){e.done?t(e.value):n(e.value).then(r,a)}l((s=s.apply(e,i||[])).next())}))};var y=undefined&&undefined.__generator||function(e,i){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},s,n,o,r;return r={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(i){return l([e,i])}}function l(r){if(s)throw new TypeError("Generator is already executing.");while(t)try{if(s=1,n&&(o=r[0]&2?n["return"]:r[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;if(n=0,o)r=[r[0]&2,o.value];switch(r[0]){case 0:case 1:o=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;n=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!o||r[1]>o[0]&&r[1]<o[3])){t.label=r[1];break}if(r[0]===6&&t.label<o[1]){t.label=o[1];o=r;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(r);break}if(o[2])t.ops.pop();t.trys.pop();continue}r=i.call(e,t)}catch(e){r=[6,e];n=0}finally{s=o=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var k=function(e,i,t,s){return w(void 0,void 0,void 0,(function(){return y(this,(function(n){return[2,e.api.put("/envelopes/".concat(i,"/recipients/").concat(t),s).then((function(e){return e.data}))]}))}))};var S=function(e,i,t){return k(e,i,t,{action:"submit"})};var I=function(e,i,t){return k(e,i,t,{action:"decline"})};var N=function(e,i,t,s){return k(e,i,t,{action:"update",agreed:s})};var z=function(e,i,t){var s=new FormData;s.append("signature",t,i);return e.api.post("/signatures",s).then((function(e){return e.data}))};var j=function(e,i,t){var s=new FormData;s.append("initial",t,i);return e.api.post("/initials",s).then((function(e){return e.data}))};const F='verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign .header{color:#fff;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 56px;flex:0 0 56px;padding:0 15px;font-size:12px;-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 .logo{width:80px;margin:-6px 0 0 10px}verdocs-sign .header .title{padding-left:16px;font-size:18px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}verdocs-sign .intro{width:100%;display:-ms-flexbox;display:flex;-ms-flex:0 0 60px;flex:0 0 60px;color:#111111;padding:0 15px;font-size:18px;font-weight:500;line-height:28px;-ms-flex-direction:row;flex-direction:row;background:#ffffff;-ms-flex-align:center;align-items:center}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;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;-ms-flex-pack:center;justify-content:center}verdocs-sign .document .inner{width:100%;max-width:1028px}verdocs-sign .agree{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:0 15px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}@media print{verdocs-sign .header{display:none}}';const G=`<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"></path></svg>`;const H=`<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"></path></svg>`;const C=class{constructor(t){e(this,t);this.sdkError=i(this,"sdkError",7);this.envelopeLoaded=i(this,"envelopeLoaded",7);this.envelopeUpdated=i(this,"envelopeUpdated",7);this.endpoint=null;this.recipientIndex=-1;this.fields=[];this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.recipient=null;this.signerToken=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.errorMessage="";this.focusedField="";this.isDone=false;this.showDone=false;this.finishLater=false;this.showFinishLater=false}componentWillLoad(){this.endpoint=new g({sessionType:"signing"})}async componentDidLoad(){var e,i,t,s,n,r,a;if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new b("[SIGN] Missing required envelopId",500,""));return}if(!this.roleId){(i=this.sdkError)===null||i===void 0?void 0:i.emit(new b("[SIGN] Missing required roleId",500,""));return}if(!this.inviteCode){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new b("[SIGN] Missing required inviteCode",500,""));return}try{console.log(`[SIGN] Processing invite code for ${this.envelopeId} / ${this.roleId}`);const{session:e,recipient:i,signerToken:t}=await o(this.endpoint,{envelopeId:this.envelopeId,roleId:this.roleId,inviteCode:this.inviteCode});console.log(`[SIGN] Loaded signing session ${e.email} / ${e.profile_id}`);this.recipient=i;this.signerToken=t;this.endpoint.setToken(t);if(this.recipient.agreed){this.nextButtonLabel="Next"}await x(this.endpoint,this.envelopeId);this.recipientIndex=m.envelope.recipients.findIndex((e=>e.role_name==this.roleId));if(this.recipientIndex>-1){this.recipient=m.envelope.recipients[this.recipientIndex];this.fields=this.recipient.fields}this.isDone=["submitted","canceled","declined"].includes(this.recipient.status);console.log("Done",this.isDone);(s=this.envelopeLoaded)===null||s===void 0?void 0:s.emit({endpoint:this.endpoint,envelope:m.envelope})}catch(e){console.log("Error with signing session",e);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new b(e.message,(r=e.response)===null||r===void 0?void 0:r.status,(a=e.response)===null||a===void 0?void 0:a.data))}}handleClickAgree(){N(this.endpoint,this.envelopeId,this.roleId,true).then((e=>{var i;this.nextButtonLabel="Next";this.recipient=e;(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:m.envelope,event:"agreed"})})).catch((e=>{var i,t,s;console.log("Update failure",e);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new b(e.message,(t=e.response)===null||t===void 0?void 0:t.status,(s=e.response)===null||s===void 0?void 0:s.data))}))}async handleOptionSelected(e){switch(e.detail.id){case"later":this.finishLater=true;this.showFinishLater=true;break;case"claim":break;case"decline":{const e=await I(this.endpoint,this.envelopeId,this.roleId);console.log("Decline result",e);this.isDone=true}break;case"print":window.print();break;case"download":r(this.endpoint,m.envelope,m.envelope.envelope_document_id).catch((()=>{}));break}}saveFieldChange(e,i){a(this.endpoint,this.envelopeId,e,i).catch((e=>{var i,t,s,n,o,r;if(((i=e.response)===null||i===void 0?void 0:i.status)===401&&((s=(t=e.response)===null||t===void 0?void 0:t.data)===null||s===void 0?void 0:s.error)==="jwt expired"){console.log("[SIGN] Signing session expired");this.errorMessage="Signing session expired."}else{console.log("[SIGN] Server error",e)}(n=this.sdkError)===null||n===void 0?void 0:n.emit(new b(e.message,(o=e.response)===null||o===void 0?void 0:o.status,(r=e.response)===null||r===void 0?void 0:r.data))}))}async handleFieldChange(e,i){const{value:t,checked:s}=i.target;switch(e.type){case"textbox":return this.saveFieldChange(e.name,{prepared:false,value:t});case"checkbox_group":{const t=e.settings.options.map((e=>({id:e.id,checked:i.target.checked})));return this.saveFieldChange(e.name,{prepared:false,value:{options:t}})}case"radio_button_group":{const t=e.settings.options.map((e=>({id:e.id,selected:i.target.value===e.id})));return this.saveFieldChange(e.name,{prepared:false,value:{options:t}})}case"dropdown":return this.saveFieldChange(e.name,{prepared:false,value:i.detail});case"initial":const n=await(await fetch(i.detail)).blob();return j(this.endpoint,"initial",n).then((i=>{console.log("New initials",e.name,i);d(this.endpoint,this.envelopeId,e.name,i.id)}));case"signature":const o=await(await fetch(i.detail)).blob();return z(this.endpoint,"signature",o).then((i=>{console.log("New sign",e.name,i);l(this.endpoint,this.envelopeId,e.name,i.id)}));case"date":const r=i.target.getAttribute("iso");return this.saveFieldChange(e.name,{prepared:false,value:r});case"timestamp":console.log("Updating timestamp",{value:t,ts:i.target.getAttribute("timestamp")});break;default:console.log("Unhandled field update",{value:t,checked:s},e);break}}isFieldValid(e){var i,t,s,n,o,r,a;const{required:l=false}=e;const{result:d="",value:c="",base64:h=""}=e.settings||{};switch(e.type){case"textbox":switch(((i=e.settings)===null||i===void 0?void 0:i.validator)||""){case"email":return p(d);case"phone":return f(d);default:return!l||d!==""}case"signature":case"initial":return!l||h!=="";case"timestamp":return true;case"textarea":case"date":case"attachment":return!l||d!=="";case"dropdown":return!l||c!=="";case"checkbox_group":const u=(((s=(t=e.settings)===null||t===void 0?void 0:t.options)===null||s===void 0?void 0:s.filter((e=>e.checked)))||[]).length;return!l||u>=(((n=e.settings)===null||n===void 0?void 0:n.minimum_checked)||0)&&u<=(((o=e.settings)===null||o===void 0?void 0:o.maximum_checked)||999);case"radio_button_group":return!l||(((a=(r=e.settings)===null||r===void 0?void 0:r.options)===null||a===void 0?void 0:a.filter((e=>e.selected)))||[]).length>0;default:return false}}async handleNext(){var e;if(this.nextSubmits){try{const e=await S(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Submitted successfully",e);this.showDone=true;this.isDone=true}catch(e){console.log("Error submitting",e)}return}const i=this.fields.filter((e=>e.required));const t=i.findIndex((e=>e.name===this.focusedField));let s=t+1;if(s>=i.length){s=0}let n=i[s];let o=0;if(o<i.length&&["signature","initial"].includes(n.type)&&((e=n.settings)===null||e===void 0?void 0:e.result)==="signed"){o++;s++;if(s>=i.length){s=0}n=i[s]}if(o>=i.length){n=null}if(n){const e=v(n);const i=document.getElementById(e);i===null||i===void 0?void 0:i.focusField();this.focusedField=n.name}}checkRecipientFields(){const e=this.recipient.fields.filter((e=>!this.isFieldValid(e)));if(e.length<1){this.nextButtonLabel="Finish";this.nextSubmits=true}else{console.log("[SIGN] Remaining invalid fields",e);this.nextSubmits=false}}attachFieldAttributes(e,i,t,s){var n;s.addEventListener("input",(e=>this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))));s.addEventListener("fieldChange",(e=>this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))));s.setAttribute("roleindex",t);s.setAttribute("xScale",e.xScale);s.setAttribute("yScale",e.yScale);s.setAttribute("initials",this.recipient?c(this.recipient.full_name):"");s.setAttribute("name",((n=this.recipient)===null||n===void 0?void 0:n.full_name)||"")}handlePageRendered(e){const i=e.detail;const t=h(m.roleNames,this.recipient.role_name);const s=this.recipient.fields.filter((e=>e.page===i.pageNumber));console.log("[SIGN] Page rendered, updating fields",{pageInfo:i,roleIndex:t,recipientFields:s});s.forEach((e=>{const s=u(e,i,t,{disabled:false,editable:false,draggable:false,done:this.isDone});if(!s){return}if(Array.isArray(s)){s.map((s=>this.attachFieldAttributes(i,e,t,s)))}else{this.attachFieldAttributes(i,e,t,s)}}));m.envelope.recipients.filter((e=>e.role_name!==this.recipient.role_name)).map((e=>{const t=h(m.roleNames,e.role_name);const s=e.fields.filter((e=>e.page===i.pageNumber));s.forEach((e=>{const s=u(e,i,t,{disabled:true,editable:false,draggable:false,done:this.isDone});if(!s){return}s.setAttribute("roleindex",t);s.setAttribute("xScale",i.xScale);s.setAttribute("yScale",i.yScale)}))}));this.checkRecipientFields()}render(){var e,i,o,a;if(m.loading||!m.envelope){return t(s,null,t("verdocs-loader",null))}const l=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing",disabled:true},{id:"download",label:"Download"}];return t(s,{class:{agreed:(e=this.recipient)===null||e===void 0?void 0:e.agreed}},!this.isDone&&!this.finishLater&&t("div",{class:"intro"},"Please review and act on these documents."),!this.isDone&&t("div",{class:"header"},!this.isDone&&!this.finishLater&&t("verdocs-dropdown",{options:l,onOptionSelected:e=>this.handleOptionSelected(e)}),!((i=this.recipient)===null||i===void 0?void 0:i.agreed)?t("div",{class:"agree"},t("verdocs-checkbox",{name:"agree",label:"I agree to use electronic records and signatures.",onInput:()=>this.handleClickAgree()})):t(n,null,t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},m.envelope.name),t("div",{style:{flex:"1"}}),t("div",{innerHTML:G,style:{width:"24px",height:"24px",fill:"#fff",cursor:"pointer"},onClick:()=>window.print()}),t("div",{innerHTML:H,style:{width:"24px",height:"24px",fill:"#fff",cursor:"pointer",margin:"0 16px",maginRight:"30px"},onClick:()=>r(this.endpoint,m.envelope,m.envelope.envelope_document_id).catch((()=>{}))})),!this.isDone&&!this.finishLater&&t("verdocs-button",{size:"small",label:this.nextButtonLabel,disabled:!((o=this.recipient)===null||o===void 0?void 0:o.agreed),onClick:()=>this.handleNext()})),!this.isDone&&!((a=this.recipient)===null||a===void 0?void 0:a.agreed)?t("div",{class:"cover"}):t("div",{style:{display:"none"}}),this.isDone?t("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:e=>{var i;return(i=this.sdkError)===null||i===void 0?void 0:i.emit(e.detail)}}):t("div",{class:"document"},(m.envelope.documents||[]).map((e=>{const i=[...(e===null||e===void 0?void 0:e.pages)||[]];i.sort(((e,i)=>e.sequence-i.sequence));return t(n,null,i.map((e=>t("verdocs-document-page",{pageImageUri:e.display_uri,virtualWidth:612,virtualHeight:792,pageNumber:e.sequence,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))))}))),this.showFinishLater&&t("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the document, use the link in the original email notification inviting you to review and finish the document.",onNext:()=>this.showFinishLater=false}),this.errorMessage&&t("verdocs-ok-dialog",{heading:"Network Error",message:this.errorMessage,onNext:()=>this.errorMessage=""}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the Verdoc at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.",onNext:()=>this.showDone=false}))}};C.style=F;export{C as verdocs_sign};
|
|
2
|
-
//# sourceMappingURL=p-f9103136.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["node_modules/@verdocs/js-sdk/Envelopes/Recipients.js","node_modules/@verdocs/js-sdk/Envelopes/Signatures.js","node_modules/@verdocs/js-sdk/Envelopes/Initials.js","src/components/embeds/verdocs-sign/verdocs-sign.scss?tag=verdocs-sign","src/components/embeds/verdocs-sign/verdocs-sign.tsx"],"names":["__awaiter","this","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__generator","body","_","label","sent","t","trys","ops","f","y","g","verb","throw","return","Symbol","iterator","n","v","op","TypeError","call","pop","length","push","updateRecipient","endpoint","envelopeId","roleName","params","_a","api","put","concat","r","data","envelopeRecipientSubmit","action","envelopeRecipientDecline","envelopeRecipientAgree","agreed","createSignature","name","signature","FormData","append","post","createInitials","initials","verdocsSignCss","PrintIcon","DownloadIcon","VerdocsSign","recipientIndex","fields","[object Object]","VerdocsEndpoint","sessionType","sdkError","emit","SDKError","roleId","_b","inviteCode","_c","console","log","session","recipient","signerToken","Envelopes.getSigningSession","email","profile_id","setToken","nextButtonLabel","getEnvelopeById","EnvelopeStore","envelope","recipients","findIndex","role_name","isDone","includes","status","_d","envelopeLoaded","_e","message","_f","response","_g","envelopeUpdated","event","catch","detail","id","finishLater","showFinishLater","declineResult","window","print","savePDF","envelope_document_id","fieldName","Envelopes.updateEnvelopeField","error","errorMessage","field","checked","target","type","saveFieldChange","prepared","options","settings","map","option","selected","initialsBlob","fetch","blob","newInitials","updateEnvelopeFieldInitials","signatureBlob","newSignature","updateEnvelopeFieldSignature","iso","getAttribute","ts","required","base64","validator","isValidEmail","isValidPhone","checkedCount","filter","minimum_checked","maximum_checked","nextSubmits","showDone","requiredFields","focusedIndex","focusedField","nextFocusedIndex","nextRequiredField","skips","getFieldId","el","document","getElementById","focusField","invalidFields","isFieldValid","pageInfo","roleIndex","addEventListener","handleFieldChange","finally","checkRecipientFields","setAttribute","xScale","yScale","fullNameToInitials","full_name","getRoleIndex","roleNames","recipientFields","page","pageNumber","forEach","renderDocumentField","disabled","editable","draggable","Array","isArray","attachFieldAttributes","otherRecipient","otherRoleIndex","loading","h","Host","menuOptions","class","onOptionSelected","handleOptionSelected","onInput","handleClickAgree","Fragment","src","alt","style","flex","innerHTML","width","height","fill","cursor","onClick","margin","maginRight","size","handleNext","display","onSdkError","documents","envelopeDocument","pages","sort","a","b","sequence","pageImageUri","display_uri","virtualWidth","virtualHeight","onPageRendered","handlePageRendered","layers","heading","onNext"],"mappings":"6XAAA,IAAIA,EAAaC,WAAQA,UAAKD,WAAc,SAAUE,EAASC,EAAYC,EAAGC,GAC1E,SAASC,EAAMC,GAAS,OAAOA,aAAiBH,EAAIG,EAAQ,IAAIH,GAAE,SAAUI,GAAWA,EAAQD,MAC/F,OAAO,IAAKH,IAAMA,EAAIK,WAAU,SAAUD,EAASE,GAC/C,SAASC,EAAUJ,GAAS,IAAMK,EAAKP,EAAUQ,KAAKN,IAAW,MAAOO,GAAKJ,EAAOI,IACpF,SAASC,EAASR,GAAS,IAAMK,EAAKP,EAAU,SAASE,IAAW,MAAOO,GAAKJ,EAAOI,IACvF,SAASF,EAAKI,GAAUA,EAAOC,KAAOT,EAAQQ,EAAOT,OAASD,EAAMU,EAAOT,OAAOW,KAAKP,EAAWI,GAClGH,GAAMP,EAAYA,EAAUc,MAAMjB,EAASC,GAAc,KAAKU,YAGtE,IAAIO,EAAenB,WAAQA,UAAKmB,aAAgB,SAAUlB,EAASmB,GAC/D,IAAIC,EAAI,CAAEC,MAAO,EAAGC,KAAM,WAAa,GAAIC,EAAE,GAAK,EAAG,MAAMA,EAAE,GAAI,OAAOA,EAAE,IAAOC,KAAM,GAAIC,IAAK,IAAMC,EAAGC,EAAGJ,EAAGK,EAC/G,OAAOA,EAAI,CAAEjB,KAAMkB,EAAK,GAAIC,MAASD,EAAK,GAAIE,OAAUF,EAAK,WAAaG,SAAW,aAA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EAAcC,SAASgI,WAAa,IAAI1F,KAAI2F,IAC5C,MAAMC,EAAQ,KAAKD,IAAgB,MAAhBA,SAAgB,OAAA,EAAhBA,EAAkBC,QAAS,IAC9CA,EAAMC,MAAK,CAACC,EAAGC,IAAMD,EAAEE,SAAWD,EAAEC,WAEpC,OACE/B,EAACQ,EAAQ,KACNmB,EAAM5F,KAAIoD,GACTa,EAAA,wBAAA,CACEgC,aAAc7C,EAAK8C,YACnBC,aAAc,IACdC,cAAe,IACf/C,WAAYD,EAAK4C,SACjBK,eAAgB7N,GAAKb,KAAK2O,mBAAmB9N,GAC7C+N,OAAQ,CACN,CAAChL,KAAM,OAAQoE,KAAM,UACrB,CAACpE,KAAM,WAAYoE,KAAM,iBAUxChI,KAAKmH,iBACJmF,EAAA,oBAAA,CACEuC,QAAQ,8CACRpI,QAAQ,4HACRqI,OAAQ,IAAO9O,KAAKmH,gBAAkB,QAIzCnH,KAAK4H,cAAgB0E,EAAA,oBAAA,CAAmBuC,QAAQ,gBAAgBpI,QAASzG,KAAK4H,aAAckH,OAAQ,IAAO9O,KAAK4H,aAAe,KAC/H5H,KAAK6J,UACJyC,EAAA,oBAAA,CACEuC,QAAQ,eACRpI,QAAQ,wOACRqI,OAAQ,IAAO9O,KAAK6J,SAAW","sourcesContent":["var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n/**\n * Update a recipient's status block\n */\nexport var updateRecipient = function (endpoint, envelopeId, roleName, params) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .put(\"/envelopes/\".concat(envelopeId, \"/recipients/\").concat(roleName), params)\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Submit an envelope (signing is finished). Note that all fields must be valid/completed for this to succeed.\n */\nexport var envelopeRecipientSubmit = function (endpoint, envelopeId, roleName) {\n return updateRecipient(endpoint, envelopeId, roleName, { action: 'submit' });\n};\n/**\n * Decline to complete an envelope (signing will not terminated).\n */\nexport var envelopeRecipientDecline = function (endpoint, envelopeId, roleName) {\n return updateRecipient(endpoint, envelopeId, roleName, { action: 'decline' });\n};\n/**\n * Claim / change ownership of an envelope. This is a special-case operation only available in certain workflows.\n */\nexport var envelopeRecipientChangeOwner = function (endpoint, envelopeId, roleName, email, fullName) { return updateRecipient(endpoint, envelopeId, roleName, { action: 'owner_update', email: email, full_name: fullName }); };\n/**\n * Agree to electronic signing.\n */\nexport var envelopeRecipientAgree = function (endpoint, envelopeId, roleName, agreed) {\n return updateRecipient(endpoint, envelopeId, roleName, { action: 'update', agreed: agreed });\n};\n/**\n * Change a recipient's name.\n */\nexport var envelopeRecipientUpdateName = function (endpoint, envelopeId, roleName, fullName) {\n return updateRecipient(endpoint, envelopeId, roleName, { action: 'update', new_full_name: fullName });\n};\n/**\n * Change a recipient's name.\n */\nexport var envelopeRecipientPrepare = function (endpoint, envelopeId, roleName, recipients) {\n return updateRecipient(endpoint, envelopeId, roleName, { action: 'prepare', recipients: recipients });\n};\nexport var getSignerToken = function (endpoint, envelopeId, roleName) {\n return endpoint.api //\n .get(\"/envelopes/\".concat(envelopeId, \"/recipients/\").concat(encodeURIComponent(roleName), \"/signer-token\"))\n .then(function (r) { return r.data; });\n};\nexport var getInPersonLink = function (endpoint, envelopeId, roleName) {\n return endpoint.api //\n .get(\"/envelopes/\".concat(envelopeId, \"/recipients/\").concat(encodeURIComponent(roleName), \"?in_person_link=true\"))\n .then(function (r) { return r.data; });\n};\n","/**\n * Create a signature block. In a typical signing workflow, the user is asked at the beginning of the process to \"adopt\"\n * a signature block to be used for all signature fields in the document. Thus, this is typically called one time to\n * create and store a signature block. Thereafter, the ID of the signature block may be re-used for each signature field\n * to be \"stamped\" by the user.\n */\nexport var createSignature = function (endpoint, name, signature) {\n var data = new FormData();\n data.append('signature', signature, name);\n return endpoint.api //\n .post(\"/signatures\", data)\n .then(function (r) { return r.data; });\n};\n/**\n * Get the availbable signatures for a user.\n */\nexport var getSignatures = function (endpoint) {\n return endpoint.api //\n .get('/signatures')\n .then(function (r) { return r.data; });\n};\n/**\n * Get a user's signature by ID.\n */\nexport var getSignature = function (endpoint, signatureId) {\n return endpoint.api //\n .get(\"/signatures/\".concat(signatureId))\n .then(function (r) { return r.data; });\n};\n/**\n * Delete a user's signature.\n */\nexport var deleteSignature = function (endpoint, signatureId) {\n return endpoint.api //\n .delete(\"/signatures/\".concat(signatureId))\n .then(function (r) { return r.data; });\n};\n","/**\n * Create an initials block. In a typical signing workflow, the user is asked at the beginning of the process to \"adopt\"\n * an initials block to be used for all initials fields in the document. Thus, this is typically called one time to\n * create and store an initials block. Thereafter, the ID of the initials block may be re-used for each initials field\n * to be \"stamped\" by the user.\n */\nexport var createInitials = function (endpoint, name, initials) {\n var data = new FormData();\n data.append('initial', initials, name);\n return endpoint.api //\n .post(\"/initials\", data)\n .then(function (r) { return r.data; });\n};\n","@import '../../../theme.scss';\n\nverdocs-sign {\n display: flex;\n overflow: hidden;\n position: relative;\n min-height: 600px;\n flex-direction: column;\n box-sizing: border-box;\n font-family: $verdocs-primary-font;\n\n div {\n display: block;\n box-sizing: border-box;\n }\n\n input {\n vertical-align: top;\n }\n\n .header {\n color: #fff;\n display: flex;\n z-index: 1000;\n flex: 0 0 56px;\n padding: 0 15px;\n font-size: 12px;\n align-items: center;\n flex-direction: row;\n transition: all 0.25s;\n background-color: $medium-bg;\n box-shadow: 0 4px 4px 0 rgb(0 0 0 / 24%), 0 0 4px 0 rgb(0 0 0 / 12%);\n\n .logo {\n width: 80px;\n margin: -6px 0 0 10px;\n }\n\n .title {\n padding-left: 16px;\n font-size: 18px;\n font-weight: 500;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n\n .intro {\n width: 100%;\n display: flex;\n flex: 0 0 60px;\n color: #111111;\n padding: 0 15px;\n font-size: 18px;\n font-weight: 500;\n line-height: 28px;\n flex-direction: row;\n background: #ffffff;\n align-items: center;\n }\n\n .cover {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 999;\n position: absolute;\n background: rgba(0, 0, 0, 0.5);\n }\n\n .document {\n flex: 1;\n height: 100%;\n display: flex;\n padding: 15px;\n row-gap: 15px;\n min-height: 200px;\n position: relative;\n overflow-y: scroll;\n align-items: center;\n box-sizing: border-box;\n flex-direction: column;\n justify-content: center;\n\n .inner {\n width: 100%;\n max-width: 1028px;\n }\n }\n\n .agree {\n flex: 1;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 15px;\n\n .intro {\n display: none;\n }\n\n .header {\n flex: 0 0 56px;\n }\n }\n}\n\n@media print {\n verdocs-sign .header {\n display: none;\n }\n}\n","import {VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {Envelopes} from '@verdocs/js-sdk/Envelopes';\nimport {createInitials} from '@verdocs/js-sdk/Envelopes/Initials';\nimport {createSignature} from '@verdocs/js-sdk/Envelopes/Signatures';\nimport {IDocumentField, IEnvelope, IRecipient} from '@verdocs/js-sdk/Envelopes/Types';\nimport {envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubmit} from '@verdocs/js-sdk/Envelopes/Recipients';\nimport {isValidEmail, isValidPhone} from '@verdocs/js-sdk/Templates/Validators';\nimport {Event, EventEmitter, Host, Fragment, Component, Prop, State, h} from '@stencil/core';\nimport {updateEnvelopeFieldInitials, updateEnvelopeFieldSignature} from '@verdocs/js-sdk/Envelopes/Envelopes';\nimport {fullNameToInitials, getFieldId, getRoleIndex, renderDocumentField, savePDF} from '../../../utils/utils';\nimport {getEnvelopeById} from '../../../utils/Envelopes';\nimport EnvelopeStore from '../../../utils/envelopeStore';\nimport {IDocumentPageInfo} from '../../../utils/Types';\nimport {SDKError} from '../../../utils/errors';\n\nconst PrintIcon = `<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\"><path d=\"M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z\"></path></svg>`;\n\nconst DownloadIcon = `<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\"><path d=\"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z\"></path></svg>`;\n\n/**\n * Display an envelope signing experience. This will display the envelope's attached\n * documents with signing fields overlaid on each page.\n *\n * The component will attempt to initiate a signing session and load the specified\n * envelope. If successful, the recipient's fields will be enabled and the user will\n * be able to sign the envelope's attached documents. If not, an `sdkError` will be\n * thrown and the component will be blank/empty. To provide the best user experience,\n * applications should capture and handle this error to provide the user with\n * instructions/options for next steps based on the application's design and workflow.\n *\n * Unlike other components, this will always create its own endpoint to manage the\n * session session. This endpoint will be included in event callbacks for the\n * convenience of host applications that may wish to make server calls using the\n * signer's credentials once signing is complete (e.g. to obtain copies of\n * the signed attachments.)\n */\n@Component({\n tag: 'verdocs-sign',\n styleUrl: 'verdocs-sign.scss',\n shadow: false,\n})\nexport class VerdocsSign {\n endpoint: VerdocsEndpoint = null;\n\n /**\n * The ID of the envelope to sign.\n */\n @Prop() envelopeId: string | null = null;\n\n /**\n * The ID of the role that will be signing e.g. 'Recipient 1'\n */\n @Prop() roleId: string | null = null;\n\n /**\n * The invite code for the signer.\n */\n @Prop() inviteCode: string | null = null;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the envelope is updated in any way.\n */\n @Event({composed: true}) envelopeLoaded: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope}>;\n\n /**\n * Event fired when the envelope is updated in any way.\n */\n @Event({composed: true}) envelopeUpdated: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}>;\n\n @State() recipient: IRecipient | null = null;\n @State() signerToken = null;\n // @State() envelope: IEnvelope | null = null;\n // @State() fields: IDocumentField[] = [];\n @State() hasSignature = false;\n @State() nextButtonLabel = 'Start';\n @State() nextSubmits = false;\n @State() errorMessage = '';\n @State() focusedField = '';\n @State() isDone = false;\n @State() showDone = false;\n\n @State() finishLater = false;\n @State() showFinishLater = false;\n\n recipientIndex: number = -1;\n fields: IDocumentField[] = [];\n\n componentWillLoad() {\n this.endpoint = new VerdocsEndpoint({sessionType: 'signing'});\n }\n\n async componentDidLoad() {\n if (!this.envelopeId) {\n this.sdkError?.emit(new SDKError('[SIGN] Missing required envelopId', 500, ''));\n return;\n }\n\n if (!this.roleId) {\n this.sdkError?.emit(new SDKError('[SIGN] Missing required roleId', 500, ''));\n return;\n }\n\n if (!this.inviteCode) {\n this.sdkError?.emit(new SDKError('[SIGN] Missing required inviteCode', 500, ''));\n return;\n }\n\n try {\n console.log(`[SIGN] Processing invite code for ${this.envelopeId} / ${this.roleId}`);\n const {session, recipient, signerToken} = await Envelopes.getSigningSession(this.endpoint, {\n envelopeId: this.envelopeId,\n roleId: this.roleId,\n inviteCode: this.inviteCode,\n });\n\n console.log(`[SIGN] Loaded signing session ${session.email} / ${session.profile_id}`);\n\n this.recipient = recipient;\n this.signerToken = signerToken;\n this.endpoint.setToken(signerToken);\n\n if (this.recipient.agreed) {\n this.nextButtonLabel = 'Next';\n }\n\n await getEnvelopeById(this.endpoint, this.envelopeId);\n // const envelope = await Envelopes.getEnvelope(this.endpoint, this.envelopeId);\n // this.envelope = envelope;\n // console.log('[SIGN] Loaded envelope', envelope);\n\n this.recipientIndex = EnvelopeStore.envelope.recipients.findIndex(recipient => recipient.role_name == this.roleId);\n if (this.recipientIndex > -1) {\n this.recipient = EnvelopeStore.envelope.recipients[this.recipientIndex];\n this.fields = this.recipient.fields;\n }\n\n this.isDone = ['submitted', 'canceled', 'declined'].includes(this.recipient.status);\n console.log('Done', this.isDone);\n\n // TODO: Fix service to allow this?\n // const sigs = await getSignatures();\n // console.log('sigs', sigs);\n\n this.envelopeLoaded?.emit({endpoint: this.endpoint, envelope: EnvelopeStore.envelope});\n } catch (e) {\n console.log('Error with signing session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n handleClickAgree() {\n envelopeRecipientAgree(this.endpoint, this.envelopeId, this.roleId, true)\n .then(r => {\n this.nextButtonLabel = 'Next';\n this.recipient = r;\n this.envelopeUpdated?.emit({endpoint: this.endpoint, envelope: EnvelopeStore.envelope, event: 'agreed'});\n })\n .catch(e => {\n console.log('Update failure', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n });\n }\n\n async handleOptionSelected(e) {\n switch (e.detail.id) {\n case 'later':\n this.finishLater = true;\n this.showFinishLater = true;\n // this.router.navigate([`view/sign/${this.envelopeId}/role/${this.roleName}/saved`]);\n // if (!window?.['STORYBOOK_ENV']) {\n // window.alert('User intends to sign later.');\n // }\n break;\n case 'claim':\n break;\n case 'decline':\n {\n const declineResult = await envelopeRecipientDecline(this.endpoint, this.envelopeId, this.roleId);\n console.log('Decline result', declineResult);\n this.isDone = true;\n }\n break;\n case 'print':\n window.print();\n break;\n case 'download':\n savePDF(this.endpoint, EnvelopeStore.envelope, EnvelopeStore.envelope.envelope_document_id).catch(() => {});\n break;\n }\n }\n\n saveFieldChange(fieldName: string, fields: Record<string, any>) {\n Envelopes.updateEnvelopeField(this.endpoint, this.envelopeId, fieldName, fields) //\n .catch(e => {\n if (e.response?.status === 401 && e.response?.data?.error === 'jwt expired') {\n // TODO: Do we want to improve the instructions here?\n console.log('[SIGN] Signing session expired');\n this.errorMessage = 'Signing session expired.';\n } else {\n console.log('[SIGN] Server error', e);\n }\n\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n });\n }\n\n async handleFieldChange(field: IDocumentField, e: any) {\n const {value, checked} = e.target;\n\n switch (field.type) {\n case 'textbox':\n return this.saveFieldChange(field.name, {prepared: false, value});\n\n case 'checkbox_group': {\n const options = field.settings.options.map(option => ({id: option.id, checked: e.target.checked}));\n return this.saveFieldChange(field.name, {prepared: false, value: {options}});\n }\n\n case 'radio_button_group': {\n const options = field.settings.options.map(option => ({id: option.id, selected: e.target.value === option.id}));\n return this.saveFieldChange(field.name, {prepared: false, value: {options}});\n }\n\n case 'dropdown':\n return this.saveFieldChange(field.name, {prepared: false, value: e.detail});\n\n case 'initial':\n const initialsBlob = await (await fetch(e.detail)).blob();\n return createInitials(this.endpoint, 'initial', initialsBlob) //\n .then(newInitials => {\n console.log('New initials', field.name, newInitials);\n updateEnvelopeFieldInitials(this.endpoint, this.envelopeId, field.name, newInitials.id);\n });\n\n case 'signature':\n const signatureBlob = await (await fetch(e.detail)).blob();\n return createSignature(this.endpoint, 'signature', signatureBlob) //\n .then(newSignature => {\n console.log('New sign', field.name, newSignature);\n updateEnvelopeFieldSignature(this.endpoint, this.envelopeId, field.name, newSignature.id);\n });\n\n case 'date':\n const iso = e.target.getAttribute('iso');\n return this.saveFieldChange(field.name, {prepared: false, value: iso});\n\n case 'timestamp':\n console.log('Updating timestamp', {value, ts: e.target.getAttribute('timestamp')});\n break;\n\n default:\n console.log('Unhandled field update', {value, checked}, field);\n break;\n }\n }\n\n isFieldValid(field: IDocumentField) {\n const {required = false} = field;\n const {result = '', value = '', base64 = ''} = field.settings || {};\n switch (field.type) {\n case 'textbox':\n switch (field.settings?.validator || '') {\n case 'email':\n return isValidEmail(result);\n case 'phone':\n return isValidPhone(result);\n default:\n return !required || result !== '';\n }\n\n case 'signature':\n case 'initial':\n return !required || base64 !== '';\n\n // Timestamp fields get automatically filled when the envelope is submitted.\n case 'timestamp':\n return true;\n\n case 'textarea':\n case 'date':\n case 'attachment':\n return !required || result !== '';\n\n case 'dropdown':\n return !required || value !== '';\n\n case 'checkbox_group':\n const checkedCount = (field.settings?.options?.filter(option => option.checked) || []).length;\n return !required || (checkedCount >= (field.settings?.minimum_checked || 0) && checkedCount <= (field.settings?.maximum_checked || 999));\n\n case 'radio_button_group':\n return !required || (field.settings?.options?.filter(option => option.selected) || []).length > 0;\n // TODO\n // case 'checkbox':\n // return <verdocs-field-checkbox style={style} value={result || ''} id={id} />;\n // case 'payment':\n // return <verdocs-field-payment style={style} field={field} id={id} />;\n default:\n return false;\n }\n }\n\n async handleNext() {\n if (this.nextSubmits) {\n try {\n const result = await envelopeRecipientSubmit(this.endpoint, this.envelopeId, this.roleId);\n console.log('[SIGN] Submitted successfully', result);\n this.showDone = true;\n this.isDone = true;\n // updateRecipientStatus()\n } catch (e) {\n console.log('Error submitting', e);\n }\n return;\n // You're done.\n // You can access the Verdoc at any time by clicking on the link from invitation email.\n //\n // After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.\n //\n // Thank you for using Verdocs.\n // Got it, thanks\n }\n\n // Find and focus the next incomplete required field\n const requiredFields = this.fields.filter(field => field.required);\n const focusedIndex = requiredFields.findIndex(field => field.name === this.focusedField);\n\n let nextFocusedIndex = focusedIndex + 1;\n if (nextFocusedIndex >= requiredFields.length) {\n nextFocusedIndex = 0;\n }\n\n let nextRequiredField = requiredFields[nextFocusedIndex];\n\n // Skip signature and initial fields that are already filled in. We have to count our \"skips\" just in case, to avoid infinite loops.\n let skips = 0;\n if (skips < requiredFields.length && ['signature', 'initial'].includes(nextRequiredField.type) && nextRequiredField.settings?.result === 'signed') {\n skips++;\n nextFocusedIndex++;\n if (nextFocusedIndex >= requiredFields.length) {\n nextFocusedIndex = 0;\n }\n nextRequiredField = requiredFields[nextFocusedIndex];\n }\n\n if (skips >= requiredFields.length) {\n nextRequiredField = null;\n }\n\n if (nextRequiredField) {\n const id = getFieldId(nextRequiredField);\n const el = document.getElementById(id) as any;\n el?.focusField();\n this.focusedField = nextRequiredField.name;\n }\n }\n\n // See if everything that \"needs to be\" filled in is, and all \"fillable fields\" are valid\n checkRecipientFields() {\n const invalidFields = this.recipient.fields.filter(field => !this.isFieldValid(field));\n if (invalidFields.length < 1) {\n this.nextButtonLabel = 'Finish';\n this.nextSubmits = true;\n } else {\n console.log('[SIGN] Remaining invalid fields', invalidFields);\n this.nextSubmits = false;\n }\n }\n\n attachFieldAttributes(pageInfo, field, roleIndex, el) {\n el.addEventListener('input', e => this.handleFieldChange(field, e).finally(() => this.checkRecipientFields()));\n el.addEventListener('fieldChange', e => this.handleFieldChange(field, e).finally(() => this.checkRecipientFields()));\n\n el.setAttribute('roleindex', roleIndex);\n el.setAttribute('xScale', pageInfo.xScale);\n el.setAttribute('yScale', pageInfo.yScale);\n el.setAttribute('initials', this.recipient ? fullNameToInitials(this.recipient.full_name) : '');\n el.setAttribute('name', this.recipient?.full_name || '');\n }\n\n handlePageRendered(e) {\n const pageInfo = e.detail as IDocumentPageInfo;\n const roleIndex = getRoleIndex(EnvelopeStore.roleNames, this.recipient.role_name);\n const recipientFields = this.recipient.fields.filter(field => field.page === pageInfo.pageNumber);\n console.log('[SIGN] Page rendered, updating fields', {pageInfo, roleIndex, recipientFields});\n\n recipientFields.forEach(field => {\n const el = renderDocumentField(field, pageInfo, roleIndex, {disabled: false, editable: false, draggable: false, done: this.isDone});\n if (!el) {\n return;\n }\n\n if (Array.isArray(el)) {\n el.map(e => this.attachFieldAttributes(pageInfo, field, roleIndex, e));\n } else {\n this.attachFieldAttributes(pageInfo, field, roleIndex, el);\n }\n\n // interact(el).draggable({\n // listeners: {\n // start(event) {\n // console.log('[FIELDS] Drag started', event.type, event.target);\n // },\n // move(event) {\n // const oldX = +(event.target.getAttribute('posX') || 0);\n // const oldY = +(event.target.getAttribute('posY') || 0);\n // const xScale = +(event.target.getAttribute('xScale') || 1);\n // const yScale = +(event.target.getAttribute('yScale') || 1);\n // const newX = event.dx / xScale + oldX;\n // const newY = event.dy / yScale + oldY;\n // event.target.setAttribute('posX', newX);\n // event.target.setAttribute('posy', newY);\n // updateCssTransform(event.target, 'translate', `${newX}px, ${newY}px`);\n // },\n // end(event) {\n // console.log('[FIELDS] Drag ended', event);\n // // event.target.setAttribute('posX', 0);\n // // event.target.setAttribute('posy', 0);\n // // updateCssTransform(event.target, 'translate', `${0}px, ${0}px`);\n // },\n // },\n // });\n });\n\n // Render fields for \"the other\" recipients\n EnvelopeStore.envelope.recipients\n .filter(recipient => recipient.role_name !== this.recipient.role_name)\n .map(otherRecipient => {\n const otherRoleIndex = getRoleIndex(EnvelopeStore.roleNames, otherRecipient.role_name);\n const recipientFields = otherRecipient.fields.filter(field => field.page === pageInfo.pageNumber);\n // const fields = this.fields.filter(field => field.page_sequence === pageInfo.renderedPage.pageNumber);\n recipientFields.forEach(field => {\n const el = renderDocumentField(field, pageInfo, otherRoleIndex, {disabled: true, editable: false, draggable: false, done: this.isDone});\n if (!el) {\n return;\n }\n\n el.setAttribute('roleindex', otherRoleIndex);\n el.setAttribute('xScale', pageInfo.xScale);\n el.setAttribute('yScale', pageInfo.yScale);\n });\n });\n\n this.checkRecipientFields();\n }\n\n render() {\n if (EnvelopeStore.loading || !EnvelopeStore.envelope) {\n return (\n <Host>\n <verdocs-loader />\n </Host>\n );\n }\n\n const menuOptions = [\n {id: 'later', label: 'Finish Later'}, //\n // {id: 'claim', label: 'Claim the Document', disabled: true},\n {id: 'decline', label: 'Decline to Sign'},\n {id: 'print', label: 'Print Without Signing', disabled: true},\n {id: 'download', label: 'Download'},\n ];\n\n return (\n <Host class={{agreed: this.recipient?.agreed}}>\n {!this.isDone && !this.finishLater && <div class=\"intro\">Please review and act on these documents.</div>}\n\n {!this.isDone && (\n <div class=\"header\">\n {!this.isDone && !this.finishLater && <verdocs-dropdown options={menuOptions} onOptionSelected={e => this.handleOptionSelected(e)} />}\n\n {!this.recipient?.agreed ? (\n <div class=\"agree\">\n <verdocs-checkbox name=\"agree\" label=\"I agree to use electronic records and signatures.\" onInput={() => this.handleClickAgree()} />\n </div>\n ) : (\n <Fragment>\n <img src=\"https://verdocs.com/assets/white-logo.svg\" alt=\"Verdocs Logo\" class=\"logo\" />\n <div class=\"title\">{EnvelopeStore.envelope.name}</div>\n <div style={{flex: '1'}} />\n <div innerHTML={PrintIcon} style={{width: '24px', height: '24px', fill: '#fff', cursor: 'pointer'}} onClick={() => window.print()} />\n <div\n innerHTML={DownloadIcon}\n style={{width: '24px', height: '24px', fill: '#fff', cursor: 'pointer', margin: '0 16px', maginRight: '30px'}}\n onClick={() => savePDF(this.endpoint, EnvelopeStore.envelope, EnvelopeStore.envelope.envelope_document_id).catch(() => {})}\n />\n </Fragment>\n )}\n\n {!this.isDone && !this.finishLater && <verdocs-button size=\"small\" label={this.nextButtonLabel} disabled={!this.recipient?.agreed} onClick={() => this.handleNext()} />}\n </div>\n )}\n\n {!this.isDone && !this.recipient?.agreed ? <div class=\"cover\" /> : <div style={{display: 'none'}} />}\n\n {this.isDone ? (\n // <div>test</div>\n <verdocs-view endpoint={this.endpoint} envelopeId={this.envelopeId} onSdkError={e => this.sdkError?.emit(e.detail)} />\n ) : (\n <div class=\"document\">\n {(EnvelopeStore.envelope.documents || []).map(envelopeDocument => {\n const pages = [...(envelopeDocument?.pages || [])];\n pages.sort((a, b) => a.sequence - b.sequence);\n\n return (\n <Fragment>\n {pages.map(page => (\n <verdocs-document-page\n pageImageUri={page.display_uri}\n virtualWidth={612}\n virtualHeight={792}\n pageNumber={page.sequence}\n onPageRendered={e => this.handlePageRendered(e)}\n layers={[\n {name: 'page', type: 'canvas'},\n {name: 'controls', type: 'div'},\n ]}\n />\n ))}\n </Fragment>\n );\n })}\n </div>\n )}\n\n {this.showFinishLater && (\n <verdocs-ok-dialog\n heading=\"You've saved your document to finish later.\"\n message=\"To complete the document, use the link in the original email notification inviting you to review and finish the document.\"\n onNext={() => (this.showFinishLater = false)}\n />\n )}\n\n {this.errorMessage && <verdocs-ok-dialog heading=\"Network Error\" message={this.errorMessage} onNext={() => (this.errorMessage = '')} />}\n {this.showDone && (\n <verdocs-ok-dialog\n heading=\"You're Done!\"\n message=\"You can access the Verdoc 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.\"\n onNext={() => (this.showDone = false)}\n />\n )}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as o,c as t,h as i,H as e}from"./p-ff1278ed.js";import{g as s}from"./p-6de76553.js";import{g as r}from"./p-fcc3041d.js";import{c as n}from"./p-ec26fc38.js";import"./p-21603661.js";const a='verdocs-field-signature{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;width:83px;height:36px;display:block;font-size:11px;position:relative;letter-spacing:0.3px;background-color:transparent;-webkit-transform-origin:bottom left;transform-origin:bottom left;border:1px solid rgba(0, 0, 0, 0.2)}verdocs-field-signature.disabled{opacity:0.5}verdocs-field-signature.done{border:none;opacity:1}verdocs-field-signature img{display:block;max-width:100%;max-height:100%}verdocs-field-signature button{-webkit-box-sizing:border-box;box-sizing:border-box;border:none;color:rgba(0, 0, 0, 0.87);font-weight:500;-webkit-transform-origin:0 0;transform-origin:0 0;height:100%;width:100%;background:none;font-size:11px}verdocs-field-signature button.hide{display:none}verdocs-field-signature.required{border:1px solid #cc0000}verdocs-field-signature.focused{-webkit-animation:verdocs-field-pulse 0.75s 2;animation:verdocs-field-pulse 0.75s 2}verdocs-field-signature verdocs-button-panel{top:-3px;left:-2px;opacity:0.5;z-index:1000;cursor:pointer;position:absolute;-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-field-signature verdocs-button-panel[data-active],verdocs-field-signature verdocs-button-panel:hover{opacity:1}verdocs-field-signature verdocs-button-panel .icon svg{fill:#333333}verdocs-field-signature verdocs-button-panel .icon:hover svg{fill:#000000}';const l='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20"><path d="m7.5 18.5-.312-2.667q-.188-.125-.396-.25-.209-.125-.396-.229l-2.479 1.063-2.521-4.334 2.125-1.625q.021-.104.021-.229v-.458q0-.125-.021-.229L1.396 7.917l2.521-4.313 2.5 1.042q.166-.104.375-.229.208-.125.396-.229L7.5 1.5h5l.312 2.688q.188.104.396.229.209.125.396.229l2.479-1.042 2.521 4.313-2.125 1.625v.916l2.125 1.625-2.521 4.334-2.5-1.063q-.166.104-.375.229-.208.125-.396.25L12.5 18.5Zm2.479-5.521q1.229 0 2.104-.875T12.958 10q0-1.229-.875-2.104t-2.104-.875q-1.208 0-2.094.875Q7 8.771 7 10t.885 2.104q.886.875 2.094.875Zm0-1.75q-.5 0-.864-.364Q8.75 10.5 8.75 10t.365-.865q.364-.364.864-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.792 6.521h1.542l.25-2.146q.625-.167 1.198-.51.573-.344 1.031-.823l2.021.854.771-1.271-1.771-1.354q.104-.292.156-.615.052-.323.052-.656 0-.292-.052-.604-.052-.313-.135-.646l1.77-1.375-.77-1.271-2.021.875q-.479-.5-1.042-.833-.562-.334-1.187-.5l-.271-2.167H9.208l-.25 2.167q-.625.166-1.187.5-.563.333-1.042.812l-2-.854-.771 1.271 1.73 1.354q-.084.333-.136.656Q5.5 9.708 5.5 10t.052.604q.052.313.136.667l-1.73 1.354.771 1.271 2-.834q.479.459 1.042.792.562.334 1.187.5Z"/></svg>';const d=class{constructor(i){o(this,i);this.fieldChange=t(this,"fieldChange",7);this.settingsPress=t(this,"settingsPress",7);this.field=null;this.name="";this.disabled=false;this.editable=false;this.moveable=false;this.done=false;this.roleindex=0;this.tempSignature=""}async focusField(){this.handleShow();console.log("focused",this)}hideDialog(){var o;(o=this.dialog)===null||o===void 0?void 0:o.remove();this.dialog=null}handleAdopt(o){var t;console.log("[SIGNATURE] Adopted signature");this.tempSignature=o.detail;(t=this.fieldChange)===null||t===void 0?void 0:t.emit(this.tempSignature);this.hideDialog()}handleShow(){this.dialog=document.createElement("verdocs-signature-dialog");this.dialog.setAttribute("name",this.name);this.dialog.setAttribute("roleindex",this.roleindex);this.dialog.addEventListener("cancel",(()=>this.hideDialog()));this.dialog.addEventListener("next",(o=>this.handleAdopt(o)));document.body.append(this.dialog)}render(){var o,t,n;const a=r(this.field);const d=this.tempSignature||a.base64;const c=(t=(o=this.disabled)!==null&&o!==void 0?o:a.disabled)!==null&&t!==void 0?t:false;const p=this.field["rgba"]||s(this.roleindex);if(this.done){return i(e,{class:{done:this.done}},d&&i("img",{src:this.tempSignature||a.base64,alt:"Signature"}))}return i(e,{class:{required:(n=this.field)===null||n===void 0?void 0:n.required,disabled:c},style:{backgroundColor:p}},d?i("img",{src:this.tempSignature||a.base64,alt:"Signature"}):i("button",{onClick:()=>!c&&this.handleShow()},"Signature"),this.editable&&i("verdocs-button-panel",{icon:l},i("h6",null,"Field Settings"),i("form",null,i("verdocs-select-input",{label:"Recipient",options:[{label:"Buyer",value:"Buyer"},{label:"Seller",value:"Seller"}]}),i("verdocs-text-input",{label:"Field Name",value:"",placeholder:"Stored field name...",onInput:o=>console.log("ipt",o)}),i("verdocs-text-input",{label:"Placeholder",value:"",placeholder:"Placeholder text...",onInput:o=>console.log("ipt",o)}))))}};d.style=a;const c='verdocs-signature-dialog{font-family:"Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box;position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:#0000007f}verdocs-signature-dialog .dialog{width:100%;max-width:340px;border-radius:4px;overflow:hidden;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);background:#f9f9f9}verdocs-signature-dialog .heading{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;padding:20px 20px 0 20px;line-height:28px;font-size:20px;font-weight:500}verdocs-signature-dialog .content{font-size:14px;padding:20px}verdocs-signature-dialog .buttons{display:-ms-flexbox;display:flex;margin:20px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:center;align-items:center}verdocs-signature-dialog .buttons verdocs-button{margin-left:16px}verdocs-signature-dialog canvas{background:#ffffff;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 auto;width:300px;height:79px;max-width:100%;-webkit-box-shadow:0 0 6px 0 #0000001f;box-shadow:0 0 6px 0 #0000001f}verdocs-signature-dialog .disclaimer{text-align:justify;padding:8px 0;font-size:11px;line-height:14px;color:rgba(0, 0, 0, 0.54)}verdocs-signature-dialog .as-shown{font-size:11px;margin:4px 0 20px 4px;color:rgba(0, 0, 0, 0.54)}verdocs-signature-dialog .tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-signature-dialog .tabs .tab{padding:8px 15px;cursor:pointer}verdocs-signature-dialog .tabs .tab.active{border-bottom:2px solid #cccccc}verdocs-signature-dialog .tabs .tab:hover{color:#55bc81}';const p=class{constructor(i){o(this,i);this.next=t(this,"next",7);this.cancel=t(this,"cancel",7);this.name="";this.fontLoaded=false;this.enteredName="";this.mode="type"}componentWillLoad(){this.enteredName=this.name;const o=new FontFace("Dancing Script","url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)");o.load().then((o=>{document.fonts.add(o);this.fontLoaded=true}))}componentDidLoad(){this.redrawSignature()}componentDidUpdate(){this.redrawSignature()}redrawSignature(){if(!this.canvasElement){return}const o=this.canvasElement.width;const t=this.canvasElement.getContext("2d");t.clearRect(0,0,this.canvasElement.width,this.canvasElement.height);let i=100;do{i-=2;t.font=`${i}px Dancing Script`}while(t.measureText(this.enteredName).width>o-32);t.textAlign="center";t.textBaseline="middle";t.font=`${i}px Dancing Script`;t.fillText(this.enteredName,this.canvasElement.width/2,this.canvasElement.height/2)}handleNameChange(o){this.enteredName=o.target.value}handleCancel(o){o.stopPropagation();o.preventDefault();this.cancel.emit()}handleAdopt(o){o.stopPropagation();o.preventDefault();const t=this.canvasElement.toDataURL("image/png");this.next.emit(t)}render(){return i(e,{onClick:o=>this.handleCancel(o)},i("div",{class:"dialog"},i("div",{class:"heading"},"Create Your Signature"),i("div",{class:"content"},i("verdocs-text-input",{placeholder:"Full Name...",label:"Full Name",value:this.enteredName,onInput:o=>this.handleNameChange(o),onClick:o=>o.stopPropagation()}),i("div",{class:"as-shown"},"As shown on driver's license or govt. ID card."),this.fontLoaded?i("canvas",{ref:o=>this.canvasElement=o}):i("div",{style:{display:"none"}}),i("div",{class:"disclaimer"},"By clicking Adopt, I agree that the signature will be the electronic representation of my signature for all purposes when I (or my agent) use them on documents, including legally binding contracts — just the same as a pen-and-paper signature or initial."),i("div",{class:"buttons"},i("verdocs-button",{label:"CANCEL",size:"normal",variant:"outline",onClick:o=>this.handleCancel(o)}),i("verdocs-button",{label:"Adopt & Sign",size:"normal",onClick:o=>this.handleAdopt(o)})))))}};p.style=c;const h='verdocs-toolbar-icon{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:inline-block}verdocs-toolbar-icon .icon{display:inline-block;cursor:pointer}verdocs-toolbar-icon .icon svg{fill:#5c6575}verdocs-toolbar-icon .tooltip{display:none;-webkit-box-shadow:0 0 10px 1px #999999;box-shadow:0 0 10px 1px #999999;background:#ffffff;color:#33364b;max-width:240px;font-weight:bold;padding:5px 10px;font-size:13px;position:relative;border-radius:4px;z-index:10000}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}';const g=class{constructor(t){o(this,t);this.text="";this.icon="";this.containerId=`verdocs-toolbar-icon-${Math.random().toString(36).substring(2,11)}`}componentDidLoad(){this.popperInstance=n(this.iconEl,this.tooltip,{})}disconnectedCallback(){if(this.popperInstance){this.popperInstance.destroy();this.popperInstance=null}}show(){var o,t;(o=this.tooltip)===null||o===void 0?void 0:o.setAttribute("data-show","");(t=this.popperInstance)===null||t===void 0?void 0:t.update().catch((()=>{}))}hide(){var o;(o=this.tooltip)===null||o===void 0?void 0:o.removeAttribute("data-show")}render(){return i(e,{class:{}},i("div",{"aria-describedby":this.containerId,class:"icon",innerHTML:this.icon,onMouseEnter:()=>this.show(),onFocus:()=>this.show(),onMouseLeave:()=>this.hide(),onBlur:()=>this.hide(),ref:o=>this.iconEl=o}),i("div",{id:this.containerId,role:"tooltip",class:"tooltip","data-popper-placement":"bottom",ref:o=>this.tooltip=o},this.text,i("div",{"data-popper-arrow":"true",class:"arrow"})))}};g.style=h;export{d as verdocs_field_signature,p as verdocs_signature_dialog,g as verdocs_toolbar_icon};
|
|
2
|
-
//# sourceMappingURL=p-fa25cd77.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["src/components/elements/verdocs-field-signature/verdocs-field-signature.scss?tag=verdocs-field-signature","src/components/elements/verdocs-field-signature/verdocs-field-signature.tsx","src/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.scss?tag=verdocs-signature-dialog","src/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.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"],"names":["verdocsFieldSignatureCss","settingsIcon","VerdocsFieldSignature","[object Object]","this","handleShow","console","log","_a","dialog","remove","e","tempSignature","detail","fieldChange","emit","hideDialog","document","createElement","setAttribute","name","roleindex","addEventListener","handleAdopt","body","append","settings","getFieldSettings","field","value","base64","disabled","_b","backgroundColor","getRGBA","done","h","Host","class","src","alt","required","_c","style","onClick","editable","icon","label","options","placeholder","onInput","verdocsSignatureDialogCss","VerdocsSignatureDialog","enteredName","ds","FontFace","load","then","font","fonts","add","fontLoaded","redrawSignature","canvasElement","canvasWidth","width","context","getContext","clearRect","height","fontSize","measureText","textAlign","textBaseline","fillText","target","stopPropagation","preventDefault","cancel","data","toDataURL","next","handleCancel","handleNameChange","ref","el","display","size","variant","verdocsToolbarIconCss","VerdocsToolbarIcon","Math","random","toString","substring","popperInstance","createPopper","iconEl","tooltip","destroy","update","catch","removeAttribute","aria-describedby","containerId","innerHTML","onMouseEnter","show","onFocus","onMouseLeave","hide","onBlur","id","role","data-popper-placement","text","data-popper-arrow"],"mappings":"6LAAA,MAAMA,EAA2B,03CCMjC,MAAMC,EACJ,+rCAWWC,EAAqB,gIAIwB,eAKhC,iBAKK,oBAMA,oBAKA,gBAKJ,qBAKI,qBAkBL,GANdC,mBACRC,KAAKC,aACLC,QAAQC,IAAI,UAAWH,MAQzBD,oBACEK,EAAAJ,KAAKK,UAAM,MAAAD,SAAA,OAAA,EAAAA,EAAEE,SACbN,KAAKK,OAAS,KAGhBN,YAAYQ,SACVL,QAAQC,IAAI,iCACZH,KAAKQ,cAAgBD,EAAEE,QACvBL,EAAAJ,KAAKU,eAAW,MAAAN,SAAA,OAAA,EAAAA,EAAEO,KAAKX,KAAKQ,eAC5BR,KAAKY,aAGPb,aACEC,KAAKK,OAASQ,SAASC,cAAc,4BACrCd,KAAKK,OAAOU,aAAa,OAAQf,KAAKgB,MACtChB,KAAKK,OAAOU,aAAa,YAAaf,KAAKiB,WAC3CjB,KAAKK,OAAOa,iBAAiB,UAAU,IAAMlB,KAAKY,eAClDZ,KAAKK,OAAOa,iBAAiB,QAAQX,GAAKP,KAAKmB,YAAYZ,KAC3DM,SAASO,KAAKC,OAAOrB,KAAKK,QAG5BN,mBACE,MAAMuB,EAAWC,EAAiBvB,KAAKwB,OACvC,MAAMC,EAAQzB,KAAKQ,eAAiBc,EAASI,OAC7C,MAAMC,GAAWC,GAAAxB,EAAAJ,KAAK2B,YAAQ,MAAAvB,SAAA,EAAAA,EAAIkB,EAASK,YA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K8F,QAAUb,GACjHjF,KAAK+G,KACN/E,EAAA,MAAA,CAAAgF,oBAAuB,OAAO9E,MAAM","sourcesContent":["@import '../../../theme.scss';\n\nverdocs-field-signature {\n font-family: $verdocs-primary-font;\n width: 83px;\n height: 36px;\n display: block;\n font-size: 11px;\n position: relative;\n letter-spacing: 0.3px;\n background-color: transparent;\n transform-origin: bottom left;\n border: 1px solid rgba(0, 0, 0, 0.2);\n\n &.disabled {\n opacity: 0.5;\n }\n\n &.done {\n border: none;\n opacity: 1;\n }\n\n img {\n display: block;\n max-width: 100%;\n max-height: 100%;\n }\n\n button {\n box-sizing: border-box;\n border: none;\n color: rgba(0, 0, 0, 0.87);\n font-weight: 500;\n transform-origin: 0 0;\n height: 100%;\n width: 100%;\n background: none;\n font-size: 11px;\n\n &.hide {\n display: none;\n }\n }\n\n &.required {\n border: 1px solid rgb(204, 0, 0);\n }\n\n &.focused {\n animation: verdocs-field-pulse 0.75s 2;\n }\n\n verdocs-button-panel {\n top: -3px;\n left: -2px;\n opacity: 0.5;\n z-index: 1000;\n cursor: pointer;\n position: absolute;\n transform: scale(0.6);\n\n &[data-active],\n &:hover {\n opacity: 1;\n }\n\n .icon {\n svg {\n fill: #333333;\n }\n\n &:hover {\n svg {\n fill: #000000;\n }\n }\n }\n }\n}\n","import {getRGBA} from '@verdocs/js-sdk/Utils/Colors';\nimport {ITemplateField} from '@verdocs/js-sdk/Templates/Types';\nimport {IDocumentField} from '@verdocs/js-sdk/Envelopes/Types';\nimport {Component, h, Host, Prop, Event, EventEmitter, Method, State} from '@stencil/core';\nimport {getFieldSettings} from '../../../utils/utils';\n\nconst settingsIcon =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\"><path d=\"m7.5 18.5-.312-2.667q-.188-.125-.396-.25-.209-.125-.396-.229l-2.479 1.063-2.521-4.334 2.125-1.625q.021-.104.021-.229v-.458q0-.125-.021-.229L1.396 7.917l2.521-4.313 2.5 1.042q.166-.104.375-.229.208-.125.396-.229L7.5 1.5h5l.312 2.688q.188.104.396.229.209.125.396.229l2.479-1.042 2.521 4.313-2.125 1.625v.916l2.125 1.625-2.521 4.334-2.5-1.063q-.166.104-.375.229-.208.125-.396.25L12.5 18.5Zm2.479-5.521q1.229 0 2.104-.875T12.958 10q0-1.229-.875-2.104t-2.104-.875q-1.208 0-2.094.875Q7 8.771 7 10t.885 2.104q.886.875 2.094.875Zm0-1.75q-.5 0-.864-.364Q8.75 10.5 8.75 10t.365-.865q.364-.364.864-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.792 6.521h1.542l.25-2.146q.625-.167 1.198-.51.573-.344 1.031-.823l2.021.854.771-1.271-1.771-1.354q.104-.292.156-.615.052-.323.052-.656 0-.292-.052-.604-.052-.313-.135-.646l1.77-1.375-.77-1.271-2.021.875q-.479-.5-1.042-.833-.562-.334-1.187-.5l-.271-2.167H9.208l-.25 2.167q-.625.166-1.187.5-.563.333-1.042.812l-2-.854-.771 1.271 1.73 1.354q-.084.333-.136.656Q5.5 9.708 5.5 10t.052.604q.052.313.136.667l-1.73 1.354.771 1.271 2-.834q.479.459 1.042.792.562.334 1.187.5Z\"/></svg>';\n\n/**\n * Displays a signature field. If a signature already exists, it will be displayed and the field will be disabled. Otherwise, a placeholder\n * button will be shown. Clicking the button will show a dialog to adopt a signature.\n */\n@Component({\n tag: 'verdocs-field-signature',\n styleUrl: 'verdocs-field-signature.scss',\n shadow: false,\n})\nexport class VerdocsFieldSignature {\n /**\n * The document or template field to display.\n */\n @Prop() field: IDocumentField | ITemplateField | null = null;\n\n /**\n * If set, the signature creation dialog will be initialized with this text.\n */\n @Prop() name?: string = '';\n\n /**\n * If set, overrides the field's settings object. Primarily used to support \"preview\" modes where all fields are disabled.\n */\n @Prop() disabled?: boolean = false;\n\n /**\n * If set, a settings icon will be displayed on hover. The settings shown allow the field's recipient and other settings to be\n * changed, so it should typically only be enabled in the Builder.\n */\n @Prop() editable?: boolean = false;\n\n /**\n * If set, the field may be dragged to a new location. This should only be enabled in the Builder, or for self-placed fields.\n */\n @Prop() moveable?: boolean = false;\n\n /**\n * If set, the field is considered \"done\" and is drawn in a display-final-value state.\n */\n @Prop() done?: boolean = false;\n\n /**\n * If set, the field will be colored using this index value to select the background color.\n */\n @Prop() roleindex?: number = 0;\n\n /**\n * Event emitted when the field has changed.\n */\n @Event({composed: true}) fieldChange: EventEmitter<string>;\n\n /**\n * Event fired on every character entered into / deleted from the field.\n */\n @Event({composed: true}) settingsPress: EventEmitter;\n\n @Method() async focusField() {\n this.handleShow();\n console.log('focused', this);\n }\n\n @State()\n tempSignature: string = '';\n\n private dialog?: any;\n\n hideDialog() {\n this.dialog?.remove();\n this.dialog = null;\n }\n\n handleAdopt(e: any) {\n console.log('[SIGNATURE] Adopted signature');\n this.tempSignature = e.detail;\n this.fieldChange?.emit(this.tempSignature);\n this.hideDialog();\n }\n\n handleShow() {\n this.dialog = document.createElement('verdocs-signature-dialog');\n this.dialog.setAttribute('name', this.name);\n this.dialog.setAttribute('roleindex', this.roleindex);\n this.dialog.addEventListener('cancel', () => this.hideDialog());\n this.dialog.addEventListener('next', e => this.handleAdopt(e));\n document.body.append(this.dialog);\n }\n\n render() {\n const settings = getFieldSettings(this.field);\n const value = this.tempSignature || settings.base64;\n const disabled = this.disabled ?? settings.disabled ?? false;\n const backgroundColor = this.field['rgba'] || getRGBA(this.roleindex);\n\n if (this.done) {\n return <Host class={{done: this.done}}>{value && <img src={this.tempSignature || settings.base64} alt=\"Signature\" />}</Host>;\n }\n\n return (\n <Host class={{required: this.field?.required, disabled}} style={{backgroundColor}}>\n {value ? <img src={this.tempSignature || settings.base64} alt=\"Signature\" /> : <button onClick={() => !disabled && this.handleShow()}>Signature</button>}\n\n {this.editable && (\n <verdocs-button-panel icon={settingsIcon}>\n <h6>Field Settings</h6>\n <form>\n <verdocs-select-input\n label=\"Recipient\"\n options={[\n {label: 'Buyer', value: 'Buyer'},\n {label: 'Seller', value: 'Seller'},\n ]}\n />\n\n <verdocs-text-input label=\"Field Name\" value=\"\" placeholder=\"Stored field name...\" onInput={e => console.log('ipt', e)} />\n <verdocs-text-input label=\"Placeholder\" value=\"\" placeholder=\"Placeholder text...\" onInput={e => console.log('ipt', e)} />\n </form>\n </verdocs-button-panel>\n )}\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-signature-dialog {\n font-family: $primary-font;\n box-sizing: border-box;\n position: fixed;\n z-index: 10000;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #0000007f;\n\n .dialog {\n width: 100%;\n max-width: 340px;\n border-radius: 4px;\n overflow: hidden;\n box-shadow: 3px 3px 5px 1px rgba(40, 40, 40, 0.4);\n background: $dialog-bg;\n }\n\n .heading {\n display: flex;\n flex-direction: row;\n padding: 20px 20px 0 20px;\n line-height: 28px;\n font-size: 20px;\n font-weight: 500;\n }\n\n .content {\n font-size: 14px;\n padding: 20px;\n }\n\n .buttons {\n display: flex;\n margin: 20px 0 0 0;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n\n verdocs-button {\n margin-left: 16px;\n }\n }\n\n canvas {\n background: $verdocs-grey-4;\n box-sizing: border-box;\n margin: 0 auto;\n width: 300px;\n // TODO: The original app had an aspect ratio of (80 / 305) * (signatureBodyWidth - 20)\n height: 79px;\n max-width: 100%;\n box-shadow: 0 0 6px 0 #0000001f;\n }\n\n .disclaimer {\n text-align: justify;\n padding: 8px 0;\n font-size: 11px;\n line-height: 14px;\n color: rgba(0, 0, 0, 0.54);\n }\n\n .as-shown {\n font-size: 11px;\n margin: 4px 0 20px 4px;\n color: rgba(0, 0, 0, 0.54);\n }\n\n .tabs {\n display: flex;\n flex-direction: row;\n\n .tab {\n padding: 8px 15px;\n cursor: pointer;\n\n &.active {\n border-bottom: 2px solid $light-border-color;\n }\n\n &:hover {\n color: $primary-color;\n }\n }\n }\n}\n","import {Component, Prop, h, Event, EventEmitter, State, Host} from '@stencil/core';\n\n/**\n * Display a dialog that allows the user to specify a signature image, either by using a signature-font-generated image\n * based on their full name, or by hand-drawing their signature with a mouse or tablet.\n */\n@Component({\n tag: 'verdocs-signature-dialog',\n styleUrl: 'verdocs-signature-dialog.scss',\n})\nexport class VerdocsSignatureDialog {\n private canvasElement?: HTMLCanvasElement;\n\n /**\n * Initial signature text\n */\n @Prop() name: string = '';\n\n /**\n * Fired when the user completes the dialog and clicks Adopt. The event detail will contain a base64-encoded string\n * representation of the signature adopted.\n */\n @Event({composed: true}) next: EventEmitter<string>;\n\n /**\n * Fired if the user cancels the dialog.\n */\n @Event({composed: true}) cancel: EventEmitter;\n\n @State() fontLoaded = false;\n\n @State() enteredName: string = '';\n\n @State() mode: string = 'type';\n\n componentWillLoad() {\n this.enteredName = this.name;\n\n const ds = new FontFace('Dancing Script', 'url(https://fonts.gstatic.com/s/dancingscript/v19/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSo3Sup6hNX6plRP.woff)');\n ds.load().then(font => {\n document.fonts.add(font);\n this.fontLoaded = true;\n });\n }\n\n componentDidLoad() {\n this.redrawSignature();\n }\n\n componentDidUpdate() {\n this.redrawSignature();\n }\n\n redrawSignature() {\n if (!this.canvasElement) {\n return;\n }\n\n const canvasWidth = this.canvasElement.width;\n\n const context = this.canvasElement.getContext('2d');\n context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);\n\n let fontSize = 100;\n do {\n fontSize -= 2;\n context.font = `${fontSize}px Dancing Script`;\n } while (context.measureText(this.enteredName).width > canvasWidth - 32); // 32px padding each side\n\n context.textAlign = 'center';\n context.textBaseline = 'middle';\n context.font = `${fontSize}px Dancing Script`;\n context.fillText(this.enteredName, this.canvasElement.width / 2, this.canvasElement.height / 2);\n }\n\n handleNameChange(e: any) {\n this.enteredName = e.target.value;\n }\n\n handleCancel(e: any) {\n e.stopPropagation();\n e.preventDefault();\n this.cancel.emit();\n }\n\n handleAdopt(e: any) {\n e.stopPropagation();\n e.preventDefault();\n const data = this.canvasElement.toDataURL('image/png');\n this.next.emit(data);\n }\n\n /*\n selColor(hex: string) {\n this.color = hex;\n this.animateDraw();\n }\n\n stopDraw() {\n this.paint = false;\n this.adoptedAndSigned = !this.hasSignature();\n }\n\n draw(e) {\n this.paint = true;\n this.addPoints(e, false);\n this.animateDraw();\n }\n\n recordPoints(e) {\n if (this.paint) {\n this.addPoints(e, true);\n this.animateDraw();\n }\n }\n\n animateDraw() {\n this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);\n\n this.canvas.strokeStyle = this.color || '#000000';\n this.canvas.lineJoin = 'round';\n this.canvas.lineWidth = 3;\n\n for (let i = 0; i < this.points.length; i++) {\n this.canvas.beginPath();\n if (this.points[i].drag && i) {\n this.canvas.moveTo(this.points[i - 1].x, this.points[i - 1].y);\n // this.canvas.arc(this.points[i - 1].x, this.points[i - 1].y, 2, 0, 2 * Math.PI, false);\n } else {\n this.canvas.moveTo(this.points[i].x - 1, this.points[i].y);\n // this.canvas.arc(this.points[i].x, this.points[i].y, 2, 0, 2 * Math.PI, false);\n }\n\n this.canvas.lineTo(this.points[i].x, this.points[i].y);\n this.canvas.closePath();\n this.canvas.stroke();\n }\n }\n\n drawCurve(color: string, curve: number) {\n this.canvas.beginPath();\n }\n\n\n\n addPoints(e, drag: boolean) {\n if (window) {\n let x;\n let y;\n e.preventDefault();\n if (e.touches && e.touches.length > 0) {\n x = e.touches[0].clientX;\n } else {\n x = e.clientX;\n }\n\n if (e.touches && e.touches.length > 0) {\n y = e.touches[0].clientY;\n } else {\n y = e.clientY;\n }\n const rect = this.signatureCanvas.nativeElement.getBoundingClientRect();\n this.points.push({\n x: x - rect.left,\n y: y - rect.top,\n drag: drag\n });\n }\n }\n\n clearPad() {\n this.canvas.clearRect(0, 0, this.canvas.canvas.offsetWidth, this.canvas.canvas.offsetHeight);\n this.points = [];\n this.adoptedAndSigned = !this.hasSignature();\n }\n\n async adoptAndSign() {\n try {\n this.adoptedAndSigned = true;\n await this.updateFullName();\n await this.captureSignatureFromCanvas();\n const message = this.signatureMode === 'Signature' ? 'Saving Signature' : 'Saving Initial';\n this.snackbarService.open(message, 'OK', this.snackbarService.initConfig(null, 'bottom'));\n this.handleMode();\n } catch (err) {\n this.snackbarService.open('Failed to apply signature', 'OK', this.snackbarService.initConfig(null, 'bottom'));\n }\n }\n\n handleMode() {\n let currentField;\n switch (this.mode) {\n case 'signerview':\n if (this.signatureMode === 'Signature') {\n this.signatureService.postSignatureBlob().then(result => {\n if (result && result.id && result.url) {\n currentField = this.signatureService.currField;\n this.signatureService.updateSigned(currentField.fName, true);\n this.signatureService.toggleSig(false);\n this.signatureService.setSignatureId(result.id);\n this.signatureService.putSignatureField(this.envelopeId, this.fieldName, result.id).then(res => {\n this.eventTracker.createEvent({\n category: 'verdoc',\n action: 'verdoc signed',\n label: `verdoc id: ${this.envelopeId}`\n })\n if (res && res.settings) {\n this.signatureService.setSignatureData(res.settings.base64);\n this.signatureService.setSignatureId(res.settings.signature_id);\n }\n this.snackbarService.dismiss();\n this.dialog.close({ status: 'saved', temp_sig: res.settings.base64, sig_id: res.settings.signature_id });\n }).catch(err => {\n this.snackbarService.open('Failed to save signature. Please try again.', 'DISMISS', {\n duration: 3000\n });\n this.adoptedAndSigned = false;\n return err;\n });\n }\n });\n } else {\n this.signatureService.postInitialBlob().then(result => {\n if (result && result.id && result.url) {\n currentField = this.signatureService.currField;\n this.signatureService.updateInitialed(currentField.fName, true);\n this.signatureService.setInitialId(result.id);\n this.signatureService.toggleSig(false);\n this.signatureService.putInitialField(this.envelopeId, this.fieldName, result.id).then(res => {\n if (res && res.settings) {\n this.signatureService.setInitialData(res.settings.base64);\n this.signatureService.setInitialId(res.settings.initial_id);\n }\n this.snackbarService.dismiss();\n this.dialog.close({ status: 'saved', temp_int: res.settings.base64, int_id: res.settings.initial_id });\n }).catch(err => {\n this.snackbarService.open('Failed to save initial. Please try again.', 'DISMISS', {\n duration: 3000\n });\n this.adoptedAndSigned = false;\n return err;\n });\n }\n });\n }\n break;\n }\n }\n */\n\n render() {\n return (\n <Host onClick={e => this.handleCancel(e)}>\n <div class=\"dialog\">\n <div class=\"heading\">Create Your Signature</div>\n\n <div class=\"content\">\n <verdocs-text-input placeholder=\"Full Name...\" label=\"Full Name\" value={this.enteredName} onInput={e => this.handleNameChange(e)} onClick={e => e.stopPropagation()} />\n <div class=\"as-shown\">As shown on driver's license or govt. ID card.</div>\n\n {/*<div class=\"tabs\">*/}\n {/* <div class={{tab: true, active: this.mode === 'type'}} onClick={() => (this.mode = 'type')}>*/}\n {/* Type*/}\n {/* </div>*/}\n {/*<div class={{tab: true, active: this.mode === 'draw'}} onClick={() => (this.mode = 'draw')}>*/}\n {/* Draw*/}\n {/*</div>*/}\n {/*</div>*/}\n\n {this.fontLoaded ? <canvas ref={el => (this.canvasElement = el as HTMLCanvasElement)} /> : <div style={{display: 'none'}} />}\n\n <div class=\"disclaimer\">\n By clicking Adopt, I agree that the signature will be the electronic representation of my signature for all purposes when I (or my agent) use them on documents,\n including legally binding contracts — just the same as a pen-and-paper signature or initial.\n </div>\n\n <div class=\"buttons\">\n <verdocs-button label=\"CANCEL\" size=\"normal\" variant=\"outline\" onClick={e => this.handleCancel(e)} />\n <verdocs-button label=\"Adopt & Sign\" size=\"normal\" onClick={e => this.handleAdopt(e)} />\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-toolbar-icon {\n font-family: $verdocs-primary-font;\n display: inline-block;\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: 10000;\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}\n","import {createPopper, Instance} from '@popperjs/core';\nimport {Component, h, Host, Prop, State} from '@stencil/core';\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@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 * 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: '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=\"bottom\" 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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["node_modules/@verdocs/js-sdk/Envelopes/Envelopes.js","node_modules/@verdocs/js-sdk/Utils/Fields.js","src/utils/utils.ts"],"names":["__awaiter","this","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__generator","body","_","label","sent","t","trys","ops","f","y","g","verb","throw","return","Symbol","iterator","n","v","op","TypeError","call","pop","length","push","getSigningSession","endpoint","params","_a","api","get","concat","envelopeId","encodeURIComponent","roleId","inviteCode","r","signerToken","headers","signer_token","session","decodeAccessTokenBody","setToken","recipient","data","getEnvelope","ssr","getEnvelopeFile","documentId","responseType","Buffer","from","toString","updateEnvelopeField","fieldName","put","updateEnvelopeFieldSignature","signatureId","updateEnvelopeFieldInitials","initialId","rescale","integerSequence","start","count","Array","fill","map","index","fullNameToInitials","name","split","word","join","defaultWidth","field","type","defaultHeight","setControlStyles","el","xScale","yScale","option","settings","setting","x","width","height","optionSettings","undefined","options","_b","_c","_d","style","position","left","bottom","transform","getFieldId","getFieldOptionId","renderDocumentField","docPage","roleIndex","fieldOptions","disabled","editable","draggable","controlsDiv","document","getElementById","containerId","console","log","id","existingField","createElement","setAttribute","appendChild","checkboxIndex","cbEl","buttonIndex","radioEl","getRoleIndex","roles","role","indexOf","getFieldSettings","required","updateCssTransform","key","currentTransform","components","matchAll","filter","component","savePDF","async","envelope","fileName","updated_at","Envelopes.getEnvelopeFile","xhr","XMLHttpRequest","onload","a","href","window","URL","createObjectURL","response","download","display","click","remove","open","send","throttle","delay","timer","args","clearTimeout","setTimeout"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U,KAAOL,IACrC/D,KAAIoE,GAAaA,EAAU,KAC9B,GAAGL,KAAO7I,MACVoF,KAAK,YAGI+D,EAAUC,MAAO9G,EAA2B+G,EAAqBzF,KAC5E,MAAM0F,EAAW,GAAGD,EAASpE,UAAUoE,EAASE,WAAWrE,MAAM,KAAK,SACtE,MAAM1B,QAAagG,EAA0BlH,EAAU+G,EAASxB,GAAIjE,GAIpE,IAAI6F,EAAM,IAAIC,eACdD,EAAI5F,aAAe,OACnB4F,EAAIE,OAAS,WACX,IAAIC,EAAIpC,SAASO,cAAc,KAC/B6B,EAAEC,KAAOC,OAAOC,IAAIC,gBAAgBP,EAAIQ,UACxCL,EAAEM,SAAWZ,EACbM,EAAEnD,MAAM0D,QAAU,OAClB3C,SAAS1G,KAAKmH,YAAY2B,GAC1BA,EAAEQ,QACFR,EAAES,UAGJZ,EAAIa,KAAK,MAAO,+BAA+B9G,KAC/CiG,EAAIc,cAMOC,EAAW,CAACnJ,EAAGoJ,KAC1B,IAAIC,EAAa,EACjB,OAAO,YAAaC,GAClBC,aAAaF,GACbA,EAAQG,YAAW,IAAMxJ,EAAET,MAAMlB,KAAMiL,IAAOF","sourcesContent":["var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport { decodeAccessTokenBody } from '../Utils/Token';\n/**\n * Create an envelope\n *\n * ```typescript\n * import {Envelopes, ICreateEnvelopeRole, ICreateEnvelopeRequest} from '@verdocs/js-sdk/Envelopes';\n *\n * const role1: ICreateEnvelopeRole = {\n * type: 'signer',\n * name: 'Seller',\n * full_name: 'Paige Turner',\n * email: 'paige.turner@nomail.com',\n * phone: '',\n * sequence: 1,\n * delegator: false,\n * message: '',\n * };\n *\n * const role2: ICreateEnvelopeRole = {\n * type: 'signer',\n * name: 'Buyer',\n * full_name: 'Will Power',\n * email: 'will.power@nomail.com',\n * phone: '',\n * sequence: 2,\n * delegator: false,\n * message: '',\n * };\n *\n * const request: ICreateEnvelopeRequest = {template_id: 'd2338742-f3a1-465b-8592-806587413cc1', name: 'Bill of Sale', roles: [role1, role2]};\n * const {id, recipients} = await Envelopes.createEnvelope(VerdocsEndpoint.getDefault(), request);\n * ```\n */\nexport var createEnvelope = function (endpoint, request) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .post('/envelopes', request)\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Get a summary of currently active envelopes.\n *\n * ```typescript\n * import {Envelopes} from '@verdocs/js-sdk/Envelopes';\n *\n * const {action_required, completed, waiting_on_others} = await Envelopes.getSummary(VerdocsEndpoint.getDefault());\n * ```\n */\nexport var getSummary = function (endpoint, page) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .post('/envelopes/summary', { page: page })\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Search for envelopes matching various criteria.\n *\n * ```typescript\n * import {Envelopes} from '@verdocs/js-sdk/Envelopes';\n *\n * const {result, page, total} = await Envelopes.search(VerdocsEndpoint.getDefault(), { ... });\n * ```\n */\nexport var searchEnvelopes = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .post('/envelopes/search', params)\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Get a signing session for an Envelope.\n */\nexport var getSigningSession = function (endpoint, params) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .get(\"/envelopes/\".concat(params.envelopeId, \"/recipients/\").concat(encodeURIComponent(params.roleId), \"/invitation/\").concat(params.inviteCode))\n .then(function (r) {\n var _a;\n // Avoiding a jsonwebtoken dependency here - we don't actually need the whole library\n var signerToken = ((_a = r.headers) === null || _a === void 0 ? void 0 : _a.signer_token) || '';\n var session = decodeAccessTokenBody(signerToken);\n endpoint.setToken(signerToken);\n return { recipient: r.data, session: session, signerToken: signerToken };\n })];\n });\n}); };\n/**\n * Get the list of recipients for an Envelope.\n */\nexport var getEnvelopeRecipients = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .get(\"/envelopes/\".concat(envelopeId, \"/recipients\"))\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Get all metadata for an Envelope.\n */\nexport var getEnvelope = function (endpoint, envelopeId, ssr) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .get(\"/envelopes/\".concat(envelopeId) + (ssr ? '?ssr=true' : ''))\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Get all metadata for an Envelope.\n */\nexport var getEnvelopeDocument = function (endpoint, envelopeId, documentId) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .get(\"/envelopes/\".concat(envelopeId, \"/envelope_documents/\").concat(documentId))\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Cancel an Envelope.\n */\nexport var cancelEnvelope = function (endpoint, envelopeId) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .put(\"/envelopes/\".concat(envelopeId), { action: 'cancel' })\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Returns true if the recipient has a pending action. Note that this does not necessarily mean the recipient can act (yet).\n */\nexport var recipientHasAction = function (recipient) { return !['submitted', 'canceled', 'declined'].includes(recipient.status); };\n/**\n * Returns the recipients who still have a pending action. Note that not all of these recipients may be able to act (yet).\n */\nexport var getRecipientsWithActions = function (envelope) { return ((envelope === null || envelope === void 0 ? void 0 : envelope.recipients) || []).filter(recipientHasAction); };\n/**\n * Returns true if the recipient can act.\n */\nexport var recipientCanAct = function (recipient, recipientsWithActions) { var _a; return recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence); };\n/**\n * Returns true if the user can act.\n */\nexport var userCanAct = function (email, recipientsWithActions) {\n var _a;\n var recipient = recipientsWithActions.find(function (r) { return r.email === email; });\n return recipient && recipient.sequence === ((_a = recipientsWithActions === null || recipientsWithActions === void 0 ? void 0 : recipientsWithActions[0]) === null || _a === void 0 ? void 0 : _a.sequence);\n};\n/**\n * Get (binary download) a file attached to an Envelope. It is important to use this method\n * rather than a direct A HREF or similar link to set the authorization headers for the\n * request.\n */\nexport var getEnvelopeFile = function (endpoint, envelopeId, documentId) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .get(\"/envelopes/\".concat(envelopeId, \"/envelope_documents/\").concat(documentId, \"?file=true\"), {\n responseType: 'arraybuffer',\n })\n .then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];\n });\n}); };\n/**\n * Update a Document field. Typically called during the signing process as a Recipient fills in fields.\n */\nexport var updateEnvelopeField = function (endpoint, envelopeId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .put(\"/envelopes/\".concat(envelopeId, \"/fields/\").concat(fieldName), value)\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a\n * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.\n */\nexport var updateEnvelopeFieldSignature = function (endpoint, envelopeId, fieldName, signatureId) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .put(\"/envelopes/\".concat(envelopeId, \"/fields/\").concat(fieldName, \"/signature/\").concat(signatureId))\n .then(function (r) { return r.data; })];\n });\n}); };\n/**\n * Update a Document signature field. Signature fields are ID-driven. Call `Document.createSignature()` first to create a\n * signature for a Recipient, then call `Documents.updateDocumentFieldSignature()` to attach it to a field.\n */\nexport var updateEnvelopeFieldInitials = function (endpoint, envelopeId, fieldName, initialId) { return __awaiter(void 0, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, endpoint.api //\n .put(\"/envelopes/\".concat(envelopeId, \"/fields/\").concat(fieldName, \"/initial/\").concat(initialId))\n .then(function (r) { return r.data; })];\n });\n}); };\n","export function getRTop(y, fieldHeight, iTextHeight, yRatio) {\n return iTextHeight - (y + fieldHeight) * yRatio;\n}\nexport function getRLeft(x, ratio) {\n return x * ratio;\n}\nexport function getRValue(y, ratio) {\n return y * ratio;\n}\nexport function blobToBase64(image) {\n var fileReader = new FileReader();\n return new Promise(function (resolve, reject) {\n fileReader.onerror = function () {\n reject(new DOMException('Problem reading blob.'));\n };\n fileReader.onload = function () {\n resolve(fileReader.result);\n };\n fileReader.readAsDataURL(image);\n });\n}\nexport function rescale(r, n) {\n return r * n;\n}\n","// These should probably all move to JS-SDK\nimport {VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {Envelopes} from '@verdocs/js-sdk/Envelopes';\nimport {rescale} from '@verdocs/js-sdk/Utils/Fields';\nimport {ITemplateField} from '@verdocs/js-sdk/Templates/Types';\nimport {IDocumentField, IEnvelope} from '@verdocs/js-sdk/Envelopes/Types';\nimport {IDocumentPageInfo} from './Types';\n\nexport const integerSequence = (start: number, count: number): number[] =>\n Array(count)\n .fill(1)\n .map((_, index) => index + start);\n\nexport const fullNameToInitials = (name: string) =>\n name\n .split(' ')\n .map(word => word[0])\n .join('');\n\nexport const defaultWidth = (field: ITemplateField | IDocumentField) => {\n switch (field.type) {\n case 'attachment':\n case 'payment':\n return 24;\n case 'checkbox':\n case 'checkbox_group':\n case 'radio_button_group':\n return 14;\n case 'signature':\n case 'initial':\n return 82;\n }\n\n return 150;\n};\n\nexport const defaultHeight = (field: ITemplateField | IDocumentField) => {\n switch (field.type) {\n case 'attachment':\n case 'payment':\n return 24;\n case 'checkbox':\n case 'checkbox_group':\n case 'radio_button_group':\n return 14;\n case 'signature':\n case 'initial':\n return 41;\n }\n\n return 50;\n};\n\nexport const setControlStyles = (el: HTMLElement, field: ITemplateField | IDocumentField, xScale: number, yScale: number, option?: number) => {\n const settings = (field as ITemplateField).setting || (field as IDocumentField).settings;\n let {x = 0, y = 0, width = defaultWidth(field), height = defaultHeight(field)} = settings;\n\n const optionSettings = option !== undefined && settings.options[option] ? settings.options[option] : null;\n if (optionSettings) {\n x = optionSettings.x ?? x;\n y = optionSettings.y ?? y;\n width = optionSettings.width ?? width;\n height = optionSettings.height ?? height;\n }\n\n el.style.width = `${width}px`;\n el.style.height = `${height}px`;\n el.style.position = 'absolute';\n el.style.left = `${rescale(xScale, x)}px`;\n el.style.bottom = `${rescale(yScale, y)}px`;\n el.style.transform = `scale(${xScale}, ${yScale})`;\n // el.style.backgroundColor = field['rgba'] || getRGBA(roleIndex);\n};\n\nexport const getFieldId = (field: ITemplateField | IDocumentField) => {\n return `verdocs-doc-fld-${field.name}`;\n};\n\nexport const getFieldOptionId = (field: ITemplateField | IDocumentField, index: number) => {\n return `verdocs-doc-fld-${field.name}-${index}`;\n};\n\ninterface IFieldOptions {\n disabled?: boolean;\n editable?: boolean;\n draggable?: boolean;\n done?: boolean;\n}\n\nexport const renderDocumentField = (field: ITemplateField | IDocumentField, docPage: IDocumentPageInfo, roleIndex: number, fieldOptions: IFieldOptions) => {\n const {disabled = false, editable = false, draggable = false, done = false} = fieldOptions;\n const controlsDiv = document.getElementById(docPage.containerId + '-controls');\n if (!controlsDiv) {\n console.log('[renderDocumentField] No controls DIV found', docPage.containerId + '-controls', docPage);\n return;\n }\n\n switch (field.type) {\n case 'attachment':\n case 'date':\n case 'dropdown':\n case 'initial':\n case 'payment':\n case 'signature':\n case 'timestamp':\n case 'textarea':\n case 'textbox': {\n const id = getFieldId(field);\n const existingField = document.getElementById(id);\n if (existingField) {\n setControlStyles(existingField, field, docPage.xScale, docPage.yScale);\n return existingField;\n }\n\n const el: any = document.createElement(`verdocs-field-${field.type}`);\n el.field = field;\n el.setAttribute('id', id);\n el.setAttribute('roleIndex', roleIndex);\n\n if (disabled) {\n el.setAttribute('tabindex', -1);\n el.setAttribute('disabled', true);\n } else {\n el.setAttribute('tabIndex', 1);\n }\n\n if (editable) {\n el.setAttribute('editable', true);\n }\n\n if (draggable) {\n el.setAttribute('draggable', true);\n }\n\n if (done) {\n el.setAttribute('done', true);\n }\n\n setControlStyles(el, field, docPage.xScale, docPage.yScale);\n controlsDiv.appendChild(el);\n\n return el;\n }\n\n case 'checkbox_group':\n return ((field as any).settings || (field as any).setting || {}).options.map((_, checkboxIndex) => {\n const id = getFieldOptionId(field, checkboxIndex);\n const existingField = document.getElementById(id);\n if (existingField) {\n setControlStyles(existingField, field, docPage.xScale, docPage.yScale);\n return existingField;\n }\n\n const cbEl: any = document.createElement(`verdocs-field-checkbox`);\n cbEl.field = field;\n cbEl.setAttribute('id', id);\n cbEl.setAttribute('roleIndex', roleIndex);\n cbEl.setAttribute('option', checkboxIndex);\n if (disabled) {\n cbEl.setAttribute('disabled', true);\n }\n if (done) {\n cbEl.setAttribute('done', true);\n }\n setControlStyles(cbEl, field, docPage.xScale, docPage.yScale, checkboxIndex);\n controlsDiv.appendChild(cbEl);\n\n return cbEl;\n });\n\n case 'radio_button_group':\n return ((field as any).settings || (field as any).setting || {}).options.map((_, buttonIndex) => {\n const id = getFieldOptionId(field, buttonIndex);\n const existingField = document.getElementById(id);\n if (existingField) {\n setControlStyles(existingField, field, docPage.xScale, docPage.yScale);\n return existingField;\n }\n\n const radioEl: any = document.createElement(`verdocs-field-radio-button`);\n radioEl.field = field;\n radioEl.setAttribute('id', id);\n radioEl.setAttribute('roleIndex', roleIndex);\n radioEl.setAttribute('option', buttonIndex);\n if (disabled) {\n radioEl.setAttribute('disabled', true);\n }\n if (done) {\n radioEl.setAttribute('done', true);\n }\n setControlStyles(radioEl, field, docPage.xScale, docPage.yScale, buttonIndex);\n controlsDiv.appendChild(radioEl);\n\n return radioEl;\n });\n\n // case 'attachment':\n // el = document.createElement('verdocs-field-attachment');\n // el.setAttribute('value', result || '');\n // break;\n // case 'payment':\n // el = document.createElement('verdocs-field-payment');\n // break;\n default:\n console.log('[PREVIEW] Skipping unsupported field type', field);\n return null;\n }\n};\n\nexport const getRoleIndex = (roles: string[], role: string) => roles.indexOf(role) || 0;\n\n// TODO: We can clean this up a lot if we alter the API to emit both setting and settings regardless of the source type,\n// but then merge the SDK types to encourage developers to use just `settings`.\nexport const getFieldSettings = (field: ITemplateField | IDocumentField) => {\n if ((field as ITemplateField).setting) {\n return (field as ITemplateField).setting;\n }\n\n if ((field as IDocumentField).settings) {\n return (field as IDocumentField).settings;\n }\n\n return {x: 0, y: 0, required: false, disabled: false, result: '', value: ''};\n};\n\n/**\n * Helper function to safely set/update components in a CSS transform attribute. Transform is normally set as a string of\n * `operation1(param) operation2(param) ...` components, which makes updating them a bit of a pain. This will remove the\n * specified component if it's already set and replace it with the new value, without touching the other components that\n * may already be set. Note that this operation moves the component to the end of the transform chain so it's not meant\n * to be used for order-sensitive components e.g. translate-then-rotate.\n */\nexport const updateCssTransform = (el: HTMLElement, key: string, value: string) => {\n // e.g. 'scale(1.87908, 1.87908) translate(0px, 0px);'\n const currentTransform = el.style.transform;\n // e.g. ['scale(1.87908, 1.87908)', 'scale', '1.87908, 1.87908', ...], [ 'translate(0px, 0px)', 'translate', '0px, 0px']]\n const components = [...currentTransform.matchAll(/(\\w+)\\(([^)]*)\\)/gi)];\n el.style.transform = [\n components //\n .filter(component => component[1] !== key) // Remove the entry if it's already set\n .map(component => component[0]), // Convert back the remaining entries\n `${key}(${value})`,\n ].join(' ');\n};\n\nexport const savePDF = async (endpoint: VerdocsEndpoint, envelope: IEnvelope, documentId: string) => {\n const fileName = `${envelope.name} - ${envelope.updated_at.split('T')[0]}.pdf`;\n const data = await Envelopes.getEnvelopeFile(endpoint, envelope.id, documentId);\n\n // This is better in React than doing window.href= or similar to trigger a download. For a description of the technique\n // see https://stackoverflow.com/questions/8126623/downloading-canvas-element-to-an-image\n let xhr = new XMLHttpRequest();\n xhr.responseType = 'blob';\n xhr.onload = function () {\n let a = document.createElement('a');\n a.href = window.URL.createObjectURL(xhr.response);\n a.download = fileName;\n a.style.display = 'none';\n document.body.appendChild(a);\n a.click();\n a.remove();\n };\n\n xhr.open('GET', `data:application/pdf;base64,${data}`);\n xhr.send();\n};\n\n/**\n * Throttle a given function by a delay value. Useful for things like resizeObserver.\n */\nexport const throttle = (f, delay) => {\n let timer: any = 0;\n return function (...args) {\n clearTimeout(timer);\n timer = setTimeout(() => f.apply(this, args), delay);\n };\n};\n"]}
|