@verdocs/web-sdk 1.9.26 → 1.9.30
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-5c4569c8.js} +10 -2
- package/dist/cjs/Envelopes-5c4569c8.js.map +1 -0
- package/dist/cjs/{Templates-805e8ffa.js → Templates-7d9dda98.js} +2 -2
- package/dist/cjs/{Templates-805e8ffa.js.map → Templates-7d9dda98.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-0d394f32.js} +2 -2
- package/dist/cjs/{templateStore-a1ccccdb.js.map → templateStore-0d394f32.js.map} +1 -1
- package/dist/cjs/{utils-aa1285cc.js → utils-0666fb5d.js} +13 -1
- package/dist/cjs/utils-0666fb5d.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 +66 -30
- 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 +64 -29
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +3 -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 +11 -0
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/templateStore.js +1 -1
- package/dist/components/utils.js +12 -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 +64 -29
- 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-b87b1909.js} +10 -2
- package/dist/esm/Envelopes-b87b1909.js.map +1 -0
- package/dist/esm/{Templates-653648bb.js → Templates-452173e6.js} +2 -2
- package/dist/esm/{Templates-653648bb.js.map → Templates-452173e6.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-d6995852.js} +2 -2
- package/dist/esm/{templateStore-8585145f.js.map → templateStore-d6995852.js.map} +1 -1
- package/dist/esm/{utils-c666adcf.js → utils-5cddd371.js} +13 -2
- package/dist/esm/utils-5cddd371.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 +66 -30
- 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-b87b1909.js +2 -0
- package/dist/esm-es5/Envelopes-b87b1909.js.map +1 -0
- package/dist/esm-es5/{Templates-653648bb.js → Templates-452173e6.js} +2 -2
- package/dist/esm-es5/{Templates-653648bb.js.map → Templates-452173e6.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-d6995852.js} +2 -2
- package/dist/esm-es5/{templateStore-8585145f.js.map → templateStore-d6995852.js.map} +0 -0
- package/dist/esm-es5/utils-5cddd371.js +2 -0
- package/dist/esm-es5/utils-5cddd371.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 +1 -0
- package/dist/types/utils/envelopeStore.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/verdocs-web-sdk/{p-1cb6f31a.entry.js → p-0105b271.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-1cb6f31a.entry.js.map → p-0105b271.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-5b7a5deb.js → p-01a88d6f.js} +2 -2
- package/dist/verdocs-web-sdk/{p-5b7a5deb.js.map → p-01a88d6f.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-e02e05a2.entry.js → p-06652374.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-e02e05a2.entry.js.map → p-06652374.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-c6de4457.system.entry.js → p-0e5b8a3c.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c6de4457.system.entry.js.map → p-0e5b8a3c.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-7421e32e.entry.js → p-1c035886.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-1c035886.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-7fd610f5.entry.js → p-1d96d8e2.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-7fd610f5.entry.js.map → p-1d96d8e2.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-9dc3b579.system.entry.js → p-1ee79c76.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-9dc3b579.system.entry.js.map → p-1ee79c76.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-695a3cce.entry.js → p-26409bd3.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-695a3cce.entry.js.map → p-26409bd3.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-15aa525d.entry.js → p-2c00bfe5.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-15aa525d.entry.js.map → p-2c00bfe5.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-92e526a0.system.entry.js → p-2ce6d16e.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-2ce6d16e.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-9e5fcf92.system.entry.js → p-30e6ba76.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-9e5fcf92.system.entry.js.map → p-30e6ba76.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-0ca01601.system.entry.js → p-3397509c.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-0ca01601.system.entry.js.map → p-3397509c.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-6ec79ddc.system.entry.js → p-41758626.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-6ec79ddc.system.entry.js.map → p-41758626.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-4a6d038d.js +2 -0
- package/dist/verdocs-web-sdk/p-4a6d038d.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-f47224c8.system.entry.js → p-4b5c0516.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f47224c8.system.entry.js.map → p-4b5c0516.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-075025ab.system.js → p-4dfd765a.system.js} +2 -2
- package/dist/verdocs-web-sdk/{p-075025ab.system.js.map → p-4dfd765a.system.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-4d371bfe.system.entry.js → p-529b7da3.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-4d371bfe.system.entry.js.map → p-529b7da3.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-f7a56f6c.entry.js → p-534f0a97.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-534f0a97.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-584d8151.js +2 -0
- package/dist/verdocs-web-sdk/{p-a51bb6bf.js.map → p-584d8151.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-1fc3f986.system.entry.js → p-58e850fe.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-58e850fe.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-db837a46.system.entry.js → p-5fd49bc3.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-db837a46.system.entry.js.map → p-5fd49bc3.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-625b1c62.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-5f036dfe.entry.js.map → p-625b1c62.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-fcc3041d.js → p-72984b2f.js} +2 -2
- package/dist/verdocs-web-sdk/p-72984b2f.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-4f3b1c7c.entry.js → p-822f510f.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-4f3b1c7c.entry.js.map → p-822f510f.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-38d5bc9e.entry.js → p-8917f698.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-38d5bc9e.entry.js.map → p-8917f698.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-a6781789.system.entry.js → p-8945bf3c.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-a6781789.system.entry.js.map → p-8945bf3c.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-8ba71030.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-8ba71030.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-0126c601.entry.js → p-8d5a6ec9.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-0126c601.entry.js.map → p-8d5a6ec9.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-95518265.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-95518265.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-97329951.system.js.map +1 -1
- package/dist/verdocs-web-sdk/{p-78f5c8ad.system.js → p-9ff3e906.system.js} +2 -2
- package/dist/verdocs-web-sdk/p-9ff3e906.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-f68306f5.entry.js → p-a2702bfa.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-f68306f5.entry.js.map → p-a2702bfa.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-b5f64429.entry.js → p-a3fff56c.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-b5f64429.entry.js.map → p-a3fff56c.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-c7a4ccd5.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-c7a4ccd5.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-070ba589.system.entry.js → p-d0d56c55.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-070ba589.system.entry.js.map → p-d0d56c55.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-5a08e378.entry.js → p-d93d1b8d.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-5a08e378.entry.js.map → p-d93d1b8d.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-dcd4f1c9.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-dcd4f1c9.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-decfd8b1.system.js +2 -0
- package/dist/verdocs-web-sdk/p-decfd8b1.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-c41d9fc0.entry.js → p-dfd06a67.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-c41d9fc0.entry.js.map → p-dfd06a67.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-7937a240.system.entry.js → p-eb74df9e.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-7937a240.system.entry.js.map → p-eb74df9e.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-f4193d8f.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-c731755d.system.entry.js.map → p-f4193d8f.system.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-a98ced34.system.entry.js → p-f4451ad4.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-a98ced34.system.entry.js.map → p-f4451ad4.system.entry.js.map} +0 -0
- package/dist/verdocs-web-sdk/{p-2bc68d06.system.js → p-fcedb50f.system.js} +2 -2
- package/dist/verdocs-web-sdk/{p-2bc68d06.system.js.map → p-fcedb50f.system.js.map} +0 -0
- package/dist/verdocs-web-sdk/p-ff1278ed.js.map +1 -1
- 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-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-a51bb6bf.js +0 -2
- 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
|
@@ -6,7 +6,7 @@ import { envelopeRecipientAgree, envelopeRecipientDecline, envelopeRecipientSubm
|
|
|
6
6
|
import { isValidEmail, isValidPhone } from '@verdocs/js-sdk/Templates/Validators';
|
|
7
7
|
import { Host, Fragment, h } from '@stencil/core';
|
|
8
8
|
import { updateEnvelopeFieldInitials, updateEnvelopeFieldSignature } from '@verdocs/js-sdk/Envelopes/Envelopes';
|
|
9
|
-
import { fullNameToInitials, getFieldId, getRoleIndex, renderDocumentField, savePDF } from '../../../utils/utils';
|
|
9
|
+
import { fullNameToInitials, getFieldId, getRoleIndex, renderDocumentField, savePDF, updateDocumentFieldValue } from '../../../utils/utils';
|
|
10
10
|
import { getEnvelopeById } from '../../../utils/Envelopes';
|
|
11
11
|
import EnvelopeStore from '../../../utils/envelopeStore';
|
|
12
12
|
import { SDKError } from '../../../utils/errors';
|
|
@@ -75,22 +75,23 @@ export class VerdocsSign {
|
|
|
75
75
|
});
|
|
76
76
|
console.log(`[SIGN] Loaded signing session ${session.email} / ${session.profile_id}`);
|
|
77
77
|
this.recipient = recipient;
|
|
78
|
+
console.log('[SIGN] We are recipient', this.recipient);
|
|
78
79
|
this.signerToken = signerToken;
|
|
79
80
|
this.endpoint.setToken(signerToken);
|
|
80
81
|
if (this.recipient.agreed) {
|
|
81
82
|
this.nextButtonLabel = 'Next';
|
|
82
83
|
}
|
|
83
84
|
await getEnvelopeById(this.endpoint, this.envelopeId);
|
|
84
|
-
// const envelope = await Envelopes.getEnvelope(this.endpoint, this.envelopeId);
|
|
85
|
-
// this.envelope = envelope;
|
|
86
|
-
// console.log('[SIGN] Loaded envelope', envelope);
|
|
87
85
|
this.recipientIndex = EnvelopeStore.envelope.recipients.findIndex(recipient => recipient.role_name == this.roleId);
|
|
88
86
|
if (this.recipientIndex > -1) {
|
|
89
87
|
this.recipient = EnvelopeStore.envelope.recipients[this.recipientIndex];
|
|
90
88
|
this.fields = this.recipient.fields;
|
|
89
|
+
console.log('[SIGN] Found our recipient in the envelope', this.recipientIndex, this.recipient, this.fields);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.log('[SIGN] Could not find our recipient record', this.roleId, EnvelopeStore.envelope.recipients);
|
|
91
93
|
}
|
|
92
94
|
this.isDone = ['submitted', 'canceled', 'declined'].includes(this.recipient.status);
|
|
93
|
-
console.log('Done', this.isDone);
|
|
94
95
|
// TODO: Fix service to allow this?
|
|
95
96
|
// const sigs = await getSignatures();
|
|
96
97
|
// console.log('sigs', sigs);
|
|
@@ -142,8 +143,21 @@ export class VerdocsSign {
|
|
|
142
143
|
break;
|
|
143
144
|
}
|
|
144
145
|
}
|
|
146
|
+
updateRecipientFieldValue(fieldName, updateResult) {
|
|
147
|
+
this.recipient.fields.forEach(oldField => {
|
|
148
|
+
if (oldField.name === fieldName) {
|
|
149
|
+
console.log('New settings', fieldName, updateResult.settings);
|
|
150
|
+
oldField.settings = updateResult.settings;
|
|
151
|
+
// TODO: When we break out other fields like value, update them here too
|
|
152
|
+
updateDocumentFieldValue(oldField);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
145
156
|
saveFieldChange(fieldName, fields) {
|
|
146
157
|
Envelopes.updateEnvelopeField(this.endpoint, this.envelopeId, fieldName, fields) //
|
|
158
|
+
.then(updateResult => {
|
|
159
|
+
this.updateRecipientFieldValue(fieldName, updateResult);
|
|
160
|
+
})
|
|
147
161
|
.catch(e => {
|
|
148
162
|
var _a, _b, _c, _d, _e, _f;
|
|
149
163
|
if (((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) === 401 && ((_c = (_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) === 'jwt expired') {
|
|
@@ -175,16 +189,16 @@ export class VerdocsSign {
|
|
|
175
189
|
case 'initial':
|
|
176
190
|
const initialsBlob = await (await fetch(e.detail)).blob();
|
|
177
191
|
return createInitials(this.endpoint, 'initial', initialsBlob) //
|
|
178
|
-
.then(newInitials => {
|
|
179
|
-
|
|
180
|
-
|
|
192
|
+
.then(async (newInitials) => {
|
|
193
|
+
const updateResult = await updateEnvelopeFieldInitials(this.endpoint, this.envelopeId, field.name, newInitials.id);
|
|
194
|
+
this.updateRecipientFieldValue(field.name, updateResult);
|
|
181
195
|
});
|
|
182
196
|
case 'signature':
|
|
183
197
|
const signatureBlob = await (await fetch(e.detail)).blob();
|
|
184
198
|
return createSignature(this.endpoint, 'signature', signatureBlob) //
|
|
185
|
-
.then(newSignature => {
|
|
186
|
-
|
|
187
|
-
|
|
199
|
+
.then(async (newSignature) => {
|
|
200
|
+
const updateResult = await updateEnvelopeFieldSignature(this.endpoint, this.envelopeId, field.name, newSignature.id);
|
|
201
|
+
this.updateRecipientFieldValue(field.name, updateResult);
|
|
188
202
|
});
|
|
189
203
|
case 'date':
|
|
190
204
|
const iso = e.target.getAttribute('iso');
|
|
@@ -213,6 +227,7 @@ export class VerdocsSign {
|
|
|
213
227
|
}
|
|
214
228
|
case 'signature':
|
|
215
229
|
case 'initial':
|
|
230
|
+
console.log('Evaluating initial field', field);
|
|
216
231
|
return !required || base64 !== '';
|
|
217
232
|
// Timestamp fields get automatically filled when the envelope is submitted.
|
|
218
233
|
case 'timestamp':
|
|
@@ -245,19 +260,11 @@ export class VerdocsSign {
|
|
|
245
260
|
console.log('[SIGN] Submitted successfully', result);
|
|
246
261
|
this.showDone = true;
|
|
247
262
|
this.isDone = true;
|
|
248
|
-
// updateRecipientStatus()
|
|
249
263
|
}
|
|
250
264
|
catch (e) {
|
|
251
265
|
console.log('Error submitting', e);
|
|
252
266
|
}
|
|
253
267
|
return;
|
|
254
|
-
// You're done.
|
|
255
|
-
// You can access the Verdoc at any time by clicking on the link from invitation email.
|
|
256
|
-
//
|
|
257
|
-
// After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.
|
|
258
|
-
//
|
|
259
|
-
// Thank you for using Verdocs.
|
|
260
|
-
// Got it, thanks
|
|
261
268
|
}
|
|
262
269
|
// Find and focus the next incomplete required field
|
|
263
270
|
const requiredFields = this.fields.filter(field => field.required);
|
|
@@ -296,12 +303,14 @@ export class VerdocsSign {
|
|
|
296
303
|
}
|
|
297
304
|
else {
|
|
298
305
|
console.log('[SIGN] Remaining invalid fields', invalidFields);
|
|
306
|
+
this.nextButtonLabel = 'Next';
|
|
299
307
|
this.nextSubmits = false;
|
|
300
308
|
}
|
|
301
309
|
}
|
|
302
310
|
attachFieldAttributes(pageInfo, field, roleIndex, el) {
|
|
303
311
|
var _a;
|
|
304
312
|
el.addEventListener('input', e => this.handleFieldChange(field, e).finally(() => this.checkRecipientFields()));
|
|
313
|
+
el.addEventListener('blur', () => this.checkRecipientFields());
|
|
305
314
|
el.addEventListener('fieldChange', e => this.handleFieldChange(field, e).finally(() => this.checkRecipientFields()));
|
|
306
315
|
el.setAttribute('roleindex', roleIndex);
|
|
307
316
|
el.setAttribute('xScale', pageInfo.xScale);
|
|
@@ -353,19 +362,34 @@ export class VerdocsSign {
|
|
|
353
362
|
// Render fields for "the other" recipients
|
|
354
363
|
EnvelopeStore.envelope.recipients
|
|
355
364
|
.filter(recipient => recipient.role_name !== this.recipient.role_name)
|
|
356
|
-
.
|
|
365
|
+
.forEach(otherRecipient => {
|
|
357
366
|
const otherRoleIndex = getRoleIndex(EnvelopeStore.roleNames, otherRecipient.role_name);
|
|
358
367
|
const recipientFields = otherRecipient.fields.filter(field => field.page === pageInfo.pageNumber);
|
|
359
|
-
//
|
|
368
|
+
// We don't render other recipients' fields if they've already acted, because those values are now stamped into the document page.
|
|
369
|
+
// TODO: Do we want to render alternate treatments for recipients who have declined (red boxes?) and/or if the envelope is cancelled?
|
|
370
|
+
// TODO: When doing server-side rendering we probably want to "stamp" values into the rendered PDF only once the recipient is done
|
|
371
|
+
// acting. Do this once vSign is in Production.
|
|
372
|
+
// TODO: Changed tacks here. During signing we show the template PDFs and everybody's fields, filled in or no. When done, we switch
|
|
373
|
+
// to showing the envelope PDFs with stamped-in values. Confirm this is a good approach.
|
|
374
|
+
// if (!['submitted', 'signed'].includes(otherRecipient.status)) {
|
|
360
375
|
recipientFields.forEach(field => {
|
|
361
|
-
const el = renderDocumentField(field, pageInfo, otherRoleIndex, {
|
|
376
|
+
const el = renderDocumentField(field, pageInfo, otherRoleIndex, {
|
|
377
|
+
disabled: true,
|
|
378
|
+
editable: false,
|
|
379
|
+
draggable: false,
|
|
380
|
+
done: this.isDone,
|
|
381
|
+
});
|
|
362
382
|
if (!el) {
|
|
363
383
|
return;
|
|
364
384
|
}
|
|
365
|
-
el.setAttribute
|
|
366
|
-
el.setAttribute
|
|
367
|
-
|
|
385
|
+
// TODO: Research why this occurs. There are cases when we're getting "el.setAttribute is not a function"
|
|
386
|
+
if (el.setAttribute) {
|
|
387
|
+
el.setAttribute('roleindex', otherRoleIndex);
|
|
388
|
+
el.setAttribute('xScale', pageInfo.xScale);
|
|
389
|
+
el.setAttribute('yScale', pageInfo.yScale);
|
|
390
|
+
}
|
|
368
391
|
});
|
|
392
|
+
// }
|
|
369
393
|
});
|
|
370
394
|
this.checkRecipientFields();
|
|
371
395
|
}
|
|
@@ -386,10 +410,21 @@ export class VerdocsSign {
|
|
|
386
410
|
h("verdocs-view", { endpoint: this.endpoint, envelopeId: this.envelopeId, onSdkError: e => { var _a; return (_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } })) : (h("div", { class: "document" }, (EnvelopeStore.envelope.documents || []).map(envelopeDocument => {
|
|
387
411
|
const pages = [...((envelopeDocument === null || envelopeDocument === void 0 ? void 0 : envelopeDocument.pages) || [])];
|
|
388
412
|
pages.sort((a, b) => a.sequence - b.sequence);
|
|
389
|
-
return (h(Fragment, null, pages.map(page =>
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
413
|
+
return (h(Fragment, null, pages.map(page => {
|
|
414
|
+
var _a;
|
|
415
|
+
// In signing mode we show the original template page with all the recipient fields so we can show source formatting and
|
|
416
|
+
// where everything went. This is also a visual indicator when optional fields weren't filled in by previous actors, or
|
|
417
|
+
// future signers still need to act. Once we're "done" we flip to showing the envelope's documents which have the final
|
|
418
|
+
// field vales (so far) stamped into them.
|
|
419
|
+
const templatePage = (_a = EnvelopeStore.template) === null || _a === void 0 ? void 0 : _a.pages.find(p => p.sequence === page.sequence);
|
|
420
|
+
// TODO: Confirm that a pure page-number match is good enough to find the matching template page. We need to make sure
|
|
421
|
+
// we either don't reset our page numbers for additional attachments, or add match-on identifiers to work around that.
|
|
422
|
+
// console.log('tp', templatePage, page);
|
|
423
|
+
return (h("verdocs-document-page", { pageImageUri: (templatePage === null || templatePage === void 0 ? void 0 : templatePage.display_uri) || page.display_uri, virtualWidth: 612, virtualHeight: 792, pageNumber: page.sequence, onPageRendered: e => this.handlePageRendered(e), layers: [
|
|
424
|
+
{ name: 'page', type: 'canvas' },
|
|
425
|
+
{ name: 'controls', type: 'div' },
|
|
426
|
+
] }));
|
|
427
|
+
})));
|
|
393
428
|
}))), this.showFinishLater && (h("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 && h("verdocs-ok-dialog", { heading: "Network Error", message: this.errorMessage, onNext: () => (this.errorMessage = '') }), this.showDone && (h("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) }))));
|
|
394
429
|
}
|
|
395
430
|
static get is() { return "verdocs-sign"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdocs-sign.js","sourceRoot":"","sources":["../../../../src/components/embeds/verdocs-sign/verdocs-sign.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAC,eAAe,EAAC,MAAM,sCAAsC,CAAC;AAErE,OAAO,EAAC,sBAAsB,EAAE,wBAAwB,EAAE,uBAAuB,EAAC,MAAM,sCAAsC,CAAC;AAC/H,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAC,KAAK,EAAgB,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,2BAA2B,EAAE,4BAA4B,EAAC,MAAM,qCAAqC,CAAC;AAC9G,OAAO,EAAC,kBA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AAI,CAAC,YAAY,GAAG,EAAE,CAAC,GAAI;MACtI,IAAI,CAAC,QAAQ,IAAI,CAChB,yBACE,OAAO,EAAC,cAAc,EACtB,OAAO,EAAC,uOAAuO,EAC/O,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,GACrC,CACH,CACI,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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 )}\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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, updateDocumentFieldValue} 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 console.log('[SIGN] We are recipient', this.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\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 console.log('[SIGN] Found our recipient in the envelope', this.recipientIndex, this.recipient, this.fields);\n } else {\n console.log('[SIGN] Could not find our recipient record', this.roleId, EnvelopeStore.envelope.recipients);\n }\n\n this.isDone = ['submitted', 'canceled', 'declined'].includes(this.recipient.status);\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 updateRecipientFieldValue(fieldName: string, updateResult: any) {\n this.recipient.fields.forEach(oldField => {\n if (oldField.name === fieldName) {\n console.log('New settings', fieldName, updateResult.settings);\n oldField.settings = updateResult.settings;\n // TODO: When we break out other fields like value, update them here too\n updateDocumentFieldValue(oldField);\n }\n });\n }\n\n saveFieldChange(fieldName: string, fields: Record<string, any>) {\n Envelopes.updateEnvelopeField(this.endpoint, this.envelopeId, fieldName, fields) //\n .then(updateResult => {\n this.updateRecipientFieldValue(fieldName, updateResult);\n })\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(async newInitials => {\n const updateResult = await updateEnvelopeFieldInitials(this.endpoint, this.envelopeId, field.name, newInitials.id);\n this.updateRecipientFieldValue(field.name, updateResult);\n });\n\n case 'signature':\n const signatureBlob = await (await fetch(e.detail)).blob();\n return createSignature(this.endpoint, 'signature', signatureBlob) //\n .then(async newSignature => {\n const updateResult = await updateEnvelopeFieldSignature(this.endpoint, this.envelopeId, field.name, newSignature.id);\n this.updateRecipientFieldValue(field.name, updateResult);\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 console.log('Evaluating initial field', field);\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 } catch (e) {\n console.log('Error submitting', e);\n }\n\n return;\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.nextButtonLabel = 'Next';\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('blur', () => 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 .forEach(otherRecipient => {\n const otherRoleIndex = getRoleIndex(EnvelopeStore.roleNames, otherRecipient.role_name);\n const recipientFields = otherRecipient.fields.filter(field => field.page === pageInfo.pageNumber);\n\n // We don't render other recipients' fields if they've already acted, because those values are now stamped into the document page.\n // TODO: Do we want to render alternate treatments for recipients who have declined (red boxes?) and/or if the envelope is cancelled?\n // TODO: When doing server-side rendering we probably want to \"stamp\" values into the rendered PDF only once the recipient is done\n // acting. Do this once vSign is in Production.\n // TODO: Changed tacks here. During signing we show the template PDFs and everybody's fields, filled in or no. When done, we switch\n // to showing the envelope PDFs with stamped-in values. Confirm this is a good approach.\n // if (!['submitted', 'signed'].includes(otherRecipient.status)) {\n recipientFields.forEach(field => {\n const el = renderDocumentField(field, pageInfo, otherRoleIndex, {\n disabled: true,\n editable: false,\n draggable: false,\n done: this.isDone,\n });\n if (!el) {\n return;\n }\n\n // TODO: Research why this occurs. There are cases when we're getting \"el.setAttribute is not a function\"\n if (el.setAttribute) {\n el.setAttribute('roleindex', otherRoleIndex);\n el.setAttribute('xScale', pageInfo.xScale);\n el.setAttribute('yScale', pageInfo.yScale);\n }\n });\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 // In signing mode we show the original template page with all the recipient fields so we can show source formatting and\n // where everything went. This is also a visual indicator when optional fields weren't filled in by previous actors, or\n // future signers still need to act. Once we're \"done\" we flip to showing the envelope's documents which have the final\n // field vales (so far) stamped into them.\n const templatePage = EnvelopeStore.template?.pages.find(p => p.sequence === page.sequence);\n // TODO: Confirm that a pure page-number match is good enough to find the matching template page. We need to make sure\n // we either don't reset our page numbers for additional attachments, or add match-on identifiers to work around that.\n // console.log('tp', templatePage, page);\n return (\n <verdocs-document-page\n pageImageUri={templatePage?.display_uri || 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 })}\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"]}
|
|
@@ -3,9 +3,10 @@ export default {
|
|
|
3
3
|
title: 'Embeds/Sign',
|
|
4
4
|
component: 'verdocs-sign',
|
|
5
5
|
args: {
|
|
6
|
-
|
|
6
|
+
// https://verdocs.com/view/sign/42158c4b-8520-4e30-bbcc-65cd4590cdde/roleName/Seller/invitation/50d97f77ace9d8c87e2e9c40d2bd10fd
|
|
7
|
+
envelopeId: '42158c4b-8520-4e30-bbcc-65cd4590cdde',
|
|
7
8
|
roleId: 'Seller',
|
|
8
|
-
inviteCode: '
|
|
9
|
+
inviteCode: '50d97f77ace9d8c87e2e9c40d2bd10fd',
|
|
9
10
|
},
|
|
10
11
|
argTypes: {},
|
|
11
12
|
parameters: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdocs-sign.stories.js","sourceRoot":"","sources":["../../../../src/components/embeds/verdocs-sign/verdocs-sign.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,UAAU,CAAC;AAG9B,eAAe;EACb,KAAK,EAAE,aAAa;EACpB,SAAS,EAAE,cAAc;EACzB,IAAI,EAAE;IACJ,UAAU,EAAE,sCAAsC;IAClD,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,kCAAkC;GAC/C;EACD,QAAQ,EAAE,EAAE;EACZ,UAAU,EAAE;IACV,MAAM,EAAE,YAAY;GACrB;CACM,CAAC;AAEV,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,IAAI,CAAA,6BAA6B,UAAU,YAAY,MAAM,gBAAgB,UAAU,KAAK,CAAC","sourcesContent":["import {html} from 'lit-html';\nimport {Meta} from '@storybook/web-components';\n\nexport default {\n title: 'Embeds/Sign',\n component: 'verdocs-sign',\n args: {\n envelopeId: '
|
|
1
|
+
{"version":3,"file":"verdocs-sign.stories.js","sourceRoot":"","sources":["../../../../src/components/embeds/verdocs-sign/verdocs-sign.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,UAAU,CAAC;AAG9B,eAAe;EACb,KAAK,EAAE,aAAa;EACpB,SAAS,EAAE,cAAc;EACzB,IAAI,EAAE;IACJ,iIAAiI;IACjI,UAAU,EAAE,sCAAsC;IAClD,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,kCAAkC;GAC/C;EACD,QAAQ,EAAE,EAAE;EACZ,UAAU,EAAE;IACV,MAAM,EAAE,YAAY;GACrB;CACM,CAAC;AAEV,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,IAAI,CAAA,6BAA6B,UAAU,YAAY,MAAM,gBAAgB,UAAU,KAAK,CAAC","sourcesContent":["import {html} from 'lit-html';\nimport {Meta} from '@storybook/web-components';\n\nexport default {\n title: 'Embeds/Sign',\n component: 'verdocs-sign',\n args: {\n // https://verdocs.com/view/sign/42158c4b-8520-4e30-bbcc-65cd4590cdde/roleName/Seller/invitation/50d97f77ace9d8c87e2e9c40d2bd10fd\n envelopeId: '42158c4b-8520-4e30-bbcc-65cd4590cdde',\n roleId: 'Seller',\n inviteCode: '50d97f77ace9d8c87e2e9c40d2bd10fd',\n },\n argTypes: {},\n parameters: {\n layout: 'fullscreen',\n },\n} as Meta;\n\nexport const Sign = ({envelopeId, roleId, inviteCode}) => html`<verdocs-sign .envelopeId=${envelopeId} .roleId=${roleId} .inviteCode=${inviteCode} />`;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getEnvelope } from '@verdocs/js-sdk/Envelopes/Envelopes';
|
|
2
2
|
import EnvelopeStore from './envelopeStore';
|
|
3
|
+
import { getTemplate } from '@verdocs/js-sdk/Templates/Templates';
|
|
3
4
|
// Allows envelope data to be cached for reuse between components, without parent components having to prop-drill entire envelopes into
|
|
4
5
|
// child elements.
|
|
5
6
|
export const getEnvelopeById = async (endpoint, envelopeId) => {
|
|
@@ -23,6 +24,12 @@ export const getEnvelopeById = async (endpoint, envelopeId) => {
|
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
EnvelopeStore.envelope = envelope;
|
|
27
|
+
const template = await getTemplate(endpoint, envelope.template_id, true);
|
|
28
|
+
if (!envelope) {
|
|
29
|
+
console.log('[ENVELOPES] Unable to load template');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
EnvelopeStore.template = template;
|
|
26
33
|
EnvelopeStore.loading = false;
|
|
27
34
|
}
|
|
28
35
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Envelopes.js","sourceRoot":"","sources":["../../src/utils/Envelopes.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAC,MAAM,qCAAqC,CAAC;AAChE,OAAO,aAAa,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Envelopes.js","sourceRoot":"","sources":["../../src/utils/Envelopes.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAC,MAAM,qCA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CAAC;IAC9B,aAAa,CAAC,KAAK,GAAG,CAAA,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,QAAQ,0CAAE,MAAM,MAAK,GAAG,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,CAAC,CAAC,CAAC;IACrD,MAAM,CAAC,CAAC;GACT;AACH,CAAC,CAAC","sourcesContent":["import {VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {getEnvelope} from '@verdocs/js-sdk/Envelopes/Envelopes';\nimport EnvelopeStore from './envelopeStore';\nimport {getTemplate} from '@verdocs/js-sdk/Templates/Templates';\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\n const template = await getTemplate(endpoint, envelope.template_id, true);\n if (!envelope) {\n console.log('[ENVELOPES] Unable to load template');\n return;\n }\n\n EnvelopeStore.template = template;\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelopeStore.js","sourceRoot":"","sources":["../../src/utils/envelopeStore.ts"],"names":[],"mappings":"AAAA,sIAAsI;AACtI,kIAAkI;AAElI,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"envelopeStore.js","sourceRoot":"","sources":["../../src/utils/envelopeStore.ts"],"names":[],"mappings":"AAAA,sIAAsI;AACtI,kIAAkI;AAElI,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAI3C,MAAM,EAAC,KAAK,EAAE,QAAQ,EAAC,GAAG,WAAW,CAAC;EACpC,QAAQ,EAAE,IAAwB;EAClC,QAAQ,EAAE,IAAwB;EAClC,YAAY,EAAE,CAAC;EACf,OAAO,EAAE,IAAI;EACb,KAAK,EAAE,EAAE;EAET,SAAS,EAAE,EAAc;EACzB,KAAK,EAAE,KAAK;CACb,CAAC,CAAC;AAEH,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAC,WAAW,EAAC,EAAE;EACvC,IAAI,CAAC,WAAW,EAAE;IAChB,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACjD,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;IACrB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;IACvB,OAAO;GACR;EAED,OAAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,WAAW,CAAC,CAAC;EAE5D,KAAK,CAAC,SAAS,GAAG,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;EAC/E,WAAW,CAAC,UAAU,CAAC;EACvB,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC;AAEH,eAAe,KAAK,CAAC","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';\nimport {ITemplate} from '@verdocs/js-sdk/Templates/Types';\n\nconst {state, onChange} = createStore({\n envelope: null as IEnvelope | null,\n template: null as ITemplate | 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"]}
|
|
@@ -62,6 +62,17 @@ export const getFieldId = (field) => {
|
|
|
62
62
|
export const getFieldOptionId = (field, index) => {
|
|
63
63
|
return `verdocs-doc-fld-${field.name}-${index}`;
|
|
64
64
|
};
|
|
65
|
+
export const updateDocumentFieldValue = (field) => {
|
|
66
|
+
const id = getFieldId(field);
|
|
67
|
+
const existingField = document.getElementById(id);
|
|
68
|
+
if (existingField) {
|
|
69
|
+
console.log('Found existing field', existingField);
|
|
70
|
+
existingField.field = field;
|
|
71
|
+
existingField.setAttribute('id', id); // We need this to trigger a re-render
|
|
72
|
+
existingField.setAttribute('disabled', true); // We need this to trigger a re-render
|
|
73
|
+
existingField.setAttribute('disabled', false); // We need this to trigger a re-render
|
|
74
|
+
}
|
|
75
|
+
};
|
|
65
76
|
export const renderDocumentField = (field, docPage, roleIndex, fieldOptions) => {
|
|
66
77
|
const { disabled = false, editable = false, draggable = false, done = false } = fieldOptions;
|
|
67
78
|
const controlsDiv = document.getElementById(docPage.containerId + '-controls');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAKrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,KAAa,EAAY,EAAE,CACxE,KAAK,CAAC,KAAK,CAAC;GACT,IAAI,CAAC,CAAC,CAAC;GACP,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE,CACjD,IAAI;GACD,KAAK,CAAC,GAAG,CAAC;GACV,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;GACpB,IAAI,CAAC,EAAE,CAAC,CAAC;AAEd,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAsC,EAAE,EAAE;EACrE,QAAQ,KAAK,CAAC,IAAI,EAAE;IAClB,KAAK,YAAY,CAAC;IAClB,KAAK,SAAS;MACZ,OAAO,EAAE,CAAC;IACZ,KAAK,UAAU,CAAC;IAChB,KAAK,gBAAgB,CAAC;IACtB,KAAK,oBAAoB;MACvB,OAAO,EAAE,CAAC;IACZ,KAAK,WAAW,CAAC;IACjB,KAAK,SAAS;MACZ,OAAO,EAAE,CAAC;GACb;EAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAsC,EAAE,EAAE;EACtE,QAAQ,KAAK,CAAC,IAAI,EAAE;IAClB,KAAK,YAAY,CAAC;IAClB,KAAK,SAAS;MACZ,OAAO,EAAE,CAAC;IACZ,KAAK,UAAU,CAAC;IAChB,KAA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AAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;EACvD,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// 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"]}
|
|
1
|
+
{"version":3,"file":"utils.js","source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AAC;IACzB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC,CAAC,KAAK,EAAE,CAAC;IACV,CAAC,CAAC,MAAM,EAAE,CAAC;EACb,CAAC,CAAC;EAEF,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,+BAA+B,IAAI,EAAE,CAAC,CAAC;EACvD,GAAG,CAAC,IAAI,EAAE,CAAC;AACb,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;EACnC,IAAI,KAAK,GAAQ,CAAC,CAAC;EACnB,OAAO,UAAU,GAAG,IAAI;IACtB,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;EACvD,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// 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 updateDocumentFieldValue = (field: ITemplateField | IDocumentField) => {\n const id = getFieldId(field);\n const existingField = document.getElementById(id) as any;\n if (existingField) {\n console.log('Found existing field', existingField);\n existingField.field = field;\n existingField.setAttribute('id', id); // We need this to trigger a re-render\n existingField.setAttribute('disabled', true); // We need this to trigger a re-render\n existingField.setAttribute('disabled', false); // We need this to trigger a re-render\n }\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"]}
|