@verdocs/web-sdk 4.2.158 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Datastore-b1742da2.js +1783 -0
- package/dist/cjs/Icons-02a47df1.js +7 -0
- package/dist/cjs/{index-2589e4d1.js → index-ccac8641.js} +19 -31
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-6d673ca1.js → utils-ba1e95e0.js} +3 -2
- package/dist/cjs/verdocs-auth.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js +22 -13
- package/dist/cjs/verdocs-button-panel_2.cjs.entry.js +1 -1
- package/dist/cjs/{verdocs-button_3.cjs.entry.js → verdocs-button_2.cjs.entry.js} +1 -56
- package/dist/cjs/{verdocs-checkbox_4.cjs.entry.js → verdocs-checkbox_6.cjs.entry.js} +115 -24
- package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-dialog.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +30 -15
- package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +32 -17
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +64 -45
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +105 -156
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +38 -25
- package/dist/cjs/{verdocs-file-chooser_2.cjs.entry.js → verdocs-file-chooser.cjs.entry.js} +2 -21
- package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +27 -5
- package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-organization-card_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +2 -2
- package/dist/cjs/{verdocs-preview_9.cjs.entry.js → verdocs-preview_5.cjs.entry.js} +219 -591
- package/dist/cjs/verdocs-progress-bar.cjs.entry.js +25 -0
- package/dist/cjs/verdocs-quick-functions.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-search-box.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-search-tabs.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +11 -12
- package/dist/cjs/verdocs-spinner.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-status-indicator.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-table.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-template-card.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-template-create.cjs.entry.js +108 -0
- package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +78 -63
- package/dist/cjs/verdocs-template-role-properties.cjs.entry.js +58 -37
- package/dist/cjs/verdocs-template-star.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-template-tags.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-templates-list.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-toggle.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +2 -5
- package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.js +5 -21
- package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +27 -40
- package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js +27 -28
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +45 -44
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +12 -11
- package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +28 -28
- package/dist/collection/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.js +34 -15
- package/dist/collection/components/envelopes/verdocs-envelope-recipient-summary/verdocs-envelope-recipient-summary.js +35 -17
- package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.js +67 -45
- package/dist/collection/components/fields/verdocs-field-attachment/verdocs-field-attachment.js +29 -18
- package/dist/collection/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.js +30 -20
- package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.js +30 -22
- package/dist/collection/components/fields/verdocs-field-dropdown/verdocs-field-dropdown.js +29 -17
- package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js +30 -18
- package/dist/collection/components/fields/verdocs-field-payment/verdocs-field-payment.js +192 -139
- package/dist/collection/components/fields/verdocs-field-radio/verdocs-field-radio.js +30 -20
- package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js +30 -18
- package/dist/collection/components/fields/verdocs-field-textarea/verdocs-field-textarea.js +31 -19
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.css +31 -0
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +44 -44
- package/dist/collection/components/fields/verdocs-field-timestamp/verdocs-field-timestamp.js +29 -17
- package/dist/collection/components/templates/verdocs-template-build-tabs/verdocs-template-build-tabs.js +37 -32
- package/dist/collection/components/templates/verdocs-template-create/verdocs-template-create.js +7 -15
- package/dist/collection/components/templates/verdocs-template-document-page/verdocs-template-document-page.css +6 -0
- package/dist/collection/components/templates/verdocs-template-document-page/verdocs-template-document-page.js +79 -61
- package/dist/collection/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.js +48 -24
- package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +63 -61
- package/dist/collection/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.js +61 -36
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +63 -46
- package/dist/collection/components/templates/verdocs-template-star/verdocs-template-star.js +1 -1
- package/dist/collection/components/templates/verdocs-template-tags/verdocs-template-tags.js +1 -1
- package/dist/collection/utils/Datastore.js +141 -0
- package/dist/collection/utils/Templates.js +2 -0
- package/dist/collection/utils/utils.js +3 -2
- package/dist/components/index.js +1 -7
- package/dist/components/{p-3044c9cb.js → p-070bebd7.js} +1 -1
- package/dist/components/{p-69881420.js → p-0ca7012b.js} +1 -1
- package/dist/components/{p-b2bf338f.js → p-0d063bf9.js} +65 -35
- package/dist/components/{p-ac7578f6.js → p-0e332769.js} +1 -1
- package/dist/components/{p-12594438.js → p-1030e0b1.js} +32 -32
- package/dist/components/{p-a655b737.js → p-15d530b8.js} +6 -6
- package/dist/components/{p-71dd305b.js → p-18999830.js} +2 -2
- package/dist/components/{p-90540412.js → p-1ae5d7e0.js} +1 -1
- package/dist/components/{p-4d2f2954.js → p-1e2e8b1c.js} +1 -1
- package/dist/components/{p-c7a21595.js → p-1e67ebdf.js} +67 -42
- package/dist/components/{p-72e959a7.js → p-1fc15f94.js} +31 -32
- package/dist/components/{p-85ef4d07.js → p-2548f3f0.js} +49 -38
- package/dist/components/{p-fe533b11.js → p-258c3c53.js} +125 -101
- package/dist/components/{p-263dc67d.js → p-315d6592.js} +1 -1
- package/dist/components/{p-4dc4418a.js → p-3201d529.js} +1 -1
- package/dist/components/{p-7786799a.js → p-324ed895.js} +8 -4
- package/dist/components/{p-b0af9b72.js → p-4bc5ac82.js} +3 -2
- package/dist/components/{p-ffe8b41d.js → p-4dd750e9.js} +1 -1
- package/dist/components/{p-b679d760.js → p-4e08dcdd.js} +33 -32
- package/dist/components/{p-82fb3284.js → p-58c2bd5d.js} +1 -1
- package/dist/components/{p-d3170dcd.js → p-5a9cea40.js} +4 -4
- package/dist/components/{p-c7db1c7d.js → p-5d1dec61.js} +52 -53
- package/dist/components/{p-8b27ce22.js → p-5d4bbcd0.js} +1 -1
- package/dist/components/{p-1e66385b.js → p-5d82a9f3.js} +64 -57
- package/dist/components/{p-877eaf65.js → p-5eb45a4f.js} +1 -1
- package/dist/components/{p-62f8b36c.js → p-6400f542.js} +36 -14
- package/dist/components/{p-6e8c00bc.js → p-642af221.js} +32 -31
- package/dist/components/{p-03660739.js → p-649a2ae7.js} +31 -32
- package/dist/components/{p-e4ac6259.js → p-6fcd99d1.js} +2 -2
- package/dist/components/p-7e9c499e.js +4 -0
- package/dist/components/{p-cdf871dd.js → p-81794664.js} +30 -29
- package/dist/components/{p-1b60debe.js → p-82a3f92e.js} +30 -29
- package/dist/components/{p-921297ba.js → p-84ae0283.js} +1 -1
- package/dist/components/{p-7927a846.js → p-8d3c0b4c.js} +2 -2
- package/dist/components/{p-83a2fa2f.js → p-8fbc64e9.js} +72 -55
- package/dist/components/{p-945d225a.js → p-94065def.js} +90 -88
- package/dist/components/{p-0e64ccc3.js → p-9bb47a5a.js} +1 -1
- package/dist/components/{p-df4ac086.js → p-a3e12c74.js} +2 -2
- package/dist/components/{p-6b369b14.js → p-b16c202a.js} +1 -1
- package/dist/components/{p-3518350d.js → p-b9034018.js} +4 -4
- package/dist/components/{p-b8cd75c0.js → p-b9a18099.js} +56 -46
- package/dist/components/{p-8f942993.js → p-bdc03b91.js} +32 -31
- package/dist/components/{p-4535a9fd.js → p-c7b00ce6.js} +36 -17
- package/dist/components/{p-e4a852b5.js → p-c8fedb4e.js} +7 -6
- package/dist/components/{p-0162bdd3.js → p-caa41754.js} +31 -34
- package/dist/components/{p-83245875.js → p-cf6ea837.js} +2 -2
- package/dist/components/p-da4d4eed.js +1781 -0
- package/dist/components/p-ea5954bd.js +4 -0
- package/dist/components/{p-42a676b7.js → p-ec894daf.js} +2 -2
- package/dist/components/{p-556596e4.js → p-f72b9c45.js} +1 -1
- package/dist/components/{p-a7bbe96b.js → p-f990140a.js} +3 -3
- package/dist/components/{p-db4a15fd.js → p-fcad60f5.js} +1 -1
- package/dist/components/verdocs-auth.js +4 -4
- package/dist/components/verdocs-build.js +93 -115
- package/dist/components/verdocs-button-panel.js +1 -1
- package/dist/components/verdocs-button.js +1 -1
- package/dist/components/verdocs-checkbox.js +1 -1
- package/dist/components/verdocs-component-error.js +1 -1
- package/dist/components/verdocs-contact-picker.js +1 -1
- package/dist/components/verdocs-dialog.js +1 -1
- package/dist/components/verdocs-dropdown.js +1 -1
- package/dist/components/verdocs-envelope-document-page.js +1 -1
- package/dist/components/verdocs-envelope-recipient-link.js +1 -1
- package/dist/components/verdocs-envelope-recipient-summary.js +37 -19
- package/dist/components/verdocs-envelope-sidebar.js +76 -54
- package/dist/components/verdocs-envelopes-list.js +12 -12
- package/dist/components/verdocs-field-attachment.js +1 -1
- package/dist/components/verdocs-field-checkbox.js +1 -1
- package/dist/components/verdocs-field-date.js +1 -1
- package/dist/components/verdocs-field-dropdown.js +1 -1
- package/dist/components/verdocs-field-initial.js +1 -1
- package/dist/components/verdocs-field-payment.js +106 -33
- package/dist/components/verdocs-field-radio.js +1 -1
- package/dist/components/verdocs-field-signature.js +1 -1
- package/dist/components/verdocs-field-textarea.js +1 -1
- package/dist/components/verdocs-field-textbox.js +1 -1
- package/dist/components/verdocs-field-timestamp.js +1 -1
- package/dist/components/verdocs-file-chooser.js +56 -1
- package/dist/components/verdocs-help-icon.js +1 -1
- package/dist/components/verdocs-initial-dialog.js +1 -1
- package/dist/components/verdocs-kba-dialog.js +1 -1
- package/dist/components/verdocs-loader.js +1 -1
- package/dist/components/verdocs-ok-dialog.js +1 -1
- package/dist/components/verdocs-organization-card.js +2 -2
- package/dist/components/verdocs-pagination.js +1 -1
- package/dist/components/verdocs-portal.js +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-progress-bar.js +1 -1
- package/dist/components/verdocs-quick-filter.js +1 -1
- package/dist/components/verdocs-quick-functions.js +1 -1
- package/dist/components/verdocs-radio-button.js +1 -1
- package/dist/components/verdocs-search-box.js +1 -1
- package/dist/components/verdocs-search-tabs.js +1 -1
- package/dist/components/verdocs-select-input.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign.js +24 -23
- package/dist/components/verdocs-signature-dialog.js +1 -1
- package/dist/components/verdocs-spinner.js +1 -1
- package/dist/components/verdocs-status-indicator.js +1 -1
- package/dist/components/verdocs-switch.js +1 -1
- package/dist/components/verdocs-table.js +1 -1
- package/dist/components/verdocs-tabs.js +1 -1
- package/dist/components/verdocs-template-build-tabs.js +1 -1
- package/dist/components/verdocs-template-card.js +1 -1
- package/dist/components/verdocs-template-create.js +148 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-field-properties.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-template-role-properties.js +1 -1
- package/dist/components/verdocs-template-roles.js +1 -1
- package/dist/components/verdocs-template-star.js +1 -1
- package/dist/components/verdocs-template-tags.js +2 -2
- package/dist/components/verdocs-templates-list.js +11 -11
- package/dist/components/verdocs-text-input.js +1 -1
- package/dist/components/verdocs-toggle-button.js +1 -1
- package/dist/components/verdocs-toggle.js +1 -1
- package/dist/components/verdocs-toolbar-icon.js +1 -1
- package/dist/components/verdocs-upload-dialog.js +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/custom-elements.json +2114 -0
- package/dist/esm/Datastore-52fcbac6.js +1781 -0
- package/dist/esm/Icons-190fd11d.js +4 -0
- package/dist/esm/{index-c8587076.js → index-272d51a4.js} +20 -30
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-27fa12eb.js → utils-47de6f79.js} +3 -2
- package/dist/esm/verdocs-auth.entry.js +1 -1
- package/dist/esm/verdocs-build.entry.js +23 -14
- package/dist/esm/verdocs-button-panel_2.entry.js +1 -1
- package/dist/esm/{verdocs-button_3.entry.js → verdocs-button_2.entry.js} +2 -56
- package/dist/esm/{verdocs-checkbox_4.entry.js → verdocs-checkbox_6.entry.js} +115 -26
- package/dist/esm/verdocs-contact-picker_2.entry.js +2 -2
- package/dist/esm/verdocs-dialog.entry.js +1 -1
- package/dist/esm/verdocs-dropdown.entry.js +1 -1
- package/dist/esm/verdocs-envelope-document-page.entry.js +2 -2
- package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +31 -16
- package/dist/esm/verdocs-envelope-recipient-summary.entry.js +33 -18
- package/dist/esm/verdocs-envelope-sidebar.entry.js +65 -46
- package/dist/esm/verdocs-envelopes-list.entry.js +2 -2
- package/dist/esm/verdocs-field-attachment_13.entry.js +105 -156
- package/dist/esm/verdocs-field-payment.entry.js +38 -25
- package/dist/{components/p-fe2dca8c.js → esm/verdocs-file-chooser.entry.js} +8 -31
- package/dist/esm/verdocs-kba-dialog_2.entry.js +27 -5
- package/dist/esm/verdocs-ok-dialog.entry.js +1 -1
- package/dist/esm/verdocs-organization-card_2.entry.js +1 -1
- package/dist/esm/verdocs-pagination_2.entry.js +2 -2
- package/dist/esm/{verdocs-preview_9.entry.js → verdocs-preview_5.entry.js} +221 -589
- package/dist/esm/verdocs-progress-bar.entry.js +21 -0
- package/dist/esm/verdocs-quick-functions.entry.js +1 -1
- package/dist/esm/verdocs-radio-button.entry.js +1 -1
- package/dist/esm/verdocs-search-box.entry.js +1 -1
- package/dist/esm/verdocs-search-tabs.entry.js +1 -1
- package/dist/esm/verdocs-sign.entry.js +11 -12
- package/dist/esm/verdocs-spinner.entry.js +1 -1
- package/dist/esm/verdocs-status-indicator.entry.js +1 -1
- package/dist/esm/verdocs-table.entry.js +1 -1
- package/dist/esm/verdocs-template-card.entry.js +1 -1
- package/dist/{components/p-f9cc62a7.js → esm/verdocs-template-create.entry.js} +15 -69
- package/dist/esm/verdocs-template-document-page_2.entry.js +79 -64
- package/dist/esm/verdocs-template-role-properties.entry.js +59 -38
- package/dist/esm/verdocs-template-star.entry.js +2 -2
- package/dist/esm/verdocs-template-tags.entry.js +2 -2
- package/dist/esm/verdocs-templates-list.entry.js +1 -1
- package/dist/esm/verdocs-toggle.entry.js +1 -1
- package/dist/esm/verdocs-web-sdk.js +4 -4
- package/dist/esm-es5/Datastore-52fcbac6.js +1 -0
- package/dist/esm-es5/Icons-190fd11d.js +1 -0
- package/dist/esm-es5/index-272d51a4.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{utils-27fa12eb.js → utils-47de6f79.js} +1 -1
- package/dist/esm-es5/verdocs-auth.entry.js +1 -1
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-button-panel_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-button_2.entry.js +1 -0
- package/dist/esm-es5/verdocs-checkbox_6.entry.js +1 -0
- package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-dialog.entry.js +1 -1
- package/dist/esm-es5/verdocs-dropdown.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-file-chooser.entry.js +1 -0
- package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
- package/dist/esm-es5/verdocs-organization-card_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_5.entry.js +1 -0
- package/dist/esm-es5/verdocs-progress-bar.entry.js +1 -0
- package/dist/esm-es5/verdocs-quick-functions.entry.js +1 -1
- package/dist/esm-es5/verdocs-radio-button.entry.js +1 -1
- package/dist/esm-es5/verdocs-search-box.entry.js +1 -1
- package/dist/esm-es5/verdocs-search-tabs.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-spinner.entry.js +1 -1
- package/dist/esm-es5/verdocs-status-indicator.entry.js +1 -1
- package/dist/esm-es5/verdocs-table.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-card.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-create.entry.js +1 -0
- package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-role-properties.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-star.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-tags.entry.js +1 -1
- package/dist/esm-es5/verdocs-templates-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-toggle.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/controls/verdocs-text-input/verdocs-text-input.d.ts +0 -2
- package/dist/types/components/embeds/verdocs-build/verdocs-build.d.ts +8 -32
- package/dist/types/components/embeds/verdocs-preview/verdocs-preview.d.ts +6 -8
- package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +7 -6
- package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +3 -3
- package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +6 -5
- package/dist/types/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.d.ts +6 -3
- package/dist/types/components/envelopes/verdocs-envelope-recipient-summary/verdocs-envelope-recipient-summary.d.ts +6 -3
- package/dist/types/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.d.ts +8 -4
- package/dist/types/components/fields/verdocs-field-attachment/verdocs-field-attachment.d.ts +6 -7
- package/dist/types/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.d.ts +6 -7
- package/dist/types/components/fields/verdocs-field-date/verdocs-field-date.d.ts +6 -7
- package/dist/types/components/fields/verdocs-field-dropdown/verdocs-field-dropdown.d.ts +6 -7
- package/dist/types/components/fields/verdocs-field-initial/verdocs-field-initial.d.ts +6 -7
- package/dist/types/components/fields/verdocs-field-payment/verdocs-field-payment.d.ts +44 -30
- package/dist/types/components/fields/verdocs-field-radio/verdocs-field-radio.d.ts +6 -7
- package/dist/types/components/fields/verdocs-field-signature/verdocs-field-signature.d.ts +6 -7
- package/dist/types/components/fields/verdocs-field-textarea/verdocs-field-textarea.d.ts +6 -7
- package/dist/types/components/fields/verdocs-field-textbox/verdocs-field-textbox.d.ts +5 -12
- package/dist/types/components/fields/verdocs-field-timestamp/verdocs-field-timestamp.d.ts +6 -7
- package/dist/types/components/templates/verdocs-template-build-tabs/verdocs-template-build-tabs.d.ts +7 -4
- package/dist/types/components/templates/verdocs-template-document-page/verdocs-template-document-page.d.ts +7 -4
- package/dist/types/components/templates/verdocs-template-field-properties/verdocs-template-field-properties.d.ts +7 -8
- package/dist/types/components/templates/verdocs-template-fields/verdocs-template-fields.d.ts +6 -8
- package/dist/types/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.d.ts +7 -7
- package/dist/types/components/templates/verdocs-template-roles/verdocs-template-roles.d.ts +7 -6
- package/dist/types/components.d.ts +176 -409
- package/dist/types/utils/Datastore.d.ts +24 -0
- package/dist/types/utils/Templates.d.ts +3 -0
- package/dist/types/utils/utils.d.ts +1 -1
- package/dist/verdocs-web-sdk/{p-98c5f5a5.entry.js → p-0ca1e87c.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-fc053d00.entry.js → p-167e3d7e.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-1efce6e0.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-7bd37bca.entry.js → p-2a1287ec.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-6419b913.system.js → p-2be751c4.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-cb30f11e.entry.js → p-2f73c9de.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-3364cc13.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-196bc80f.system.entry.js → p-37d747fb.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-386d789c.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-3a1fa556.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-0fd57194.entry.js → p-41cbf650.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-26715b8b.entry.js → p-4b36ca30.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-98501408.system.entry.js → p-4e9e154f.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-a3778013.system.entry.js → p-511a4ecc.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-65a4e01e.entry.js → p-524f37a0.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-13fe8650.system.entry.js → p-53f4c7c3.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-54f085d1.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-cca517dc.entry.js → p-584113d1.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f8cad58e.entry.js → p-5f1a000c.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-256f07fd.system.entry.js → p-62f15675.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-9b921211.js → p-650697bd.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c06d2604.entry.js → p-65c5398e.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-6a95ce12.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-0446030b.entry.js → p-6ced37ed.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-16619383.entry.js → p-7464b84f.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-6e3fa0c4.system.entry.js → p-761f6656.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-30bc5986.entry.js → p-76cc40fe.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c45dc777.entry.js → p-771c2f92.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-78191329.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-79f842b4.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-f3c995d8.system.entry.js → p-7c8938e7.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-7e9c499e.js +1 -0
- package/dist/verdocs-web-sdk/p-8221a48f.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-860b9f94.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-89cdecac.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-8a2ff048.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-921b56fd.system.entry.js → p-914e131c.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5737f0ae.system.js → p-9186f42e.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-8e233a6b.system.entry.js → p-9227d400.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-92ce6180.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-9567cb7d.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-9812e99d.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-4b4801ad.system.entry.js → p-982f1b36.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-1b6736fe.system.entry.js → p-9d0b0e36.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-6d1d86ff.system.entry.js → p-a08886c1.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-e25e1dcf.entry.js → p-a165607e.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-a242aa80.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-a7db9f1f.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-5d6a2fda.system.entry.js → p-a9635106.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-aebb0cd9.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-b00ef194.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-b0b958a0.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-b8737f7b.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-49988769.js → p-b9654a5e.js} +2 -2
- package/dist/verdocs-web-sdk/p-bb0effe1.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-bcc23811.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-0c3a471b.entry.js → p-bd7406ae.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-e8d91957.entry.js → p-bdd7b3d3.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c5818330.entry.js → p-c1728f5c.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-c18c718f.system.js +1 -0
- package/dist/verdocs-web-sdk/{p-731066de.system.entry.js → p-c6fd3e53.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-c7cd6843.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-4f7c72f9.system.entry.js → p-c9f40726.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-ca712f40.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-cbb75c5e.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-751b0280.entry.js → p-d475fff3.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-91c4298b.system.entry.js → p-d5870e33.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-e5126f26.system.entry.js → p-d8dae4e9.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-d93c7661.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-93093a7a.system.entry.js → p-d98cbd0f.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-da4d4eed.js +1 -0
- package/dist/verdocs-web-sdk/{p-2298c22e.entry.js → p-ddb17b3e.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-df04f0ca.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -0
- package/dist/verdocs-web-sdk/{p-2aea0c7b.system.entry.js → p-e438bd02.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-e5044463.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-0c42cb22.system.entry.js → p-e5d291f3.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7f1e0c5e.entry.js → p-e6dbb0f7.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c4d61c66.entry.js → p-e83cd333.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-efd8149f.system.js +1 -0
- package/dist/verdocs-web-sdk/p-f4fcf7a5.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-97b951e6.system.entry.js → p-f5d01982.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-f65a9b03.entry.js +1 -0
- package/dist/verdocs-web-sdk/p-f7abe6e2.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-6e55af26.system.entry.js → p-f9b37af2.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.js +1 -1
- package/package.json +3 -3
- package/dist/cjs/EnvelopeStore-f1cd9bd3.js +0 -96
- package/dist/cjs/Icons-9a6f2f7c.js +0 -86
- package/dist/cjs/TemplateFieldStore-7bcc0f7a.js +0 -44
- package/dist/cjs/TemplateRoleStore-e8bb00ec.js +0 -51
- package/dist/cjs/TemplateStore-db21be4d.js +0 -99
- package/dist/cjs/index-2a189d85.js +0 -3721
- package/dist/cjs/index-76d03a35.js +0 -196
- package/dist/cjs/verdocs-loader.cjs.entry.js +0 -20
- package/dist/collection/components/templates/verdocs-template-attachments/verdocs-template-attachments.css +0 -120
- package/dist/collection/components/templates/verdocs-template-attachments/verdocs-template-attachments.js +0 -284
- package/dist/collection/components/templates/verdocs-template-name/verdocs-template-name.css +0 -0
- package/dist/collection/components/templates/verdocs-template-name/verdocs-template-name.js +0 -196
- package/dist/collection/components/templates/verdocs-template-visibillity/verdocs-template-visibility.css +0 -86
- package/dist/collection/components/templates/verdocs-template-visibillity/verdocs-template-visibility.js +0 -203
- package/dist/collection/utils/EnvelopeStore.js +0 -90
- package/dist/collection/utils/TemplateFieldStore.js +0 -36
- package/dist/collection/utils/TemplateRoleStore.js +0 -41
- package/dist/collection/utils/TemplateStore.js +0 -94
- package/dist/components/p-00d39dca.js +0 -39
- package/dist/components/p-0933fb2d.js +0 -127
- package/dist/components/p-09d28afd.js +0 -97
- package/dist/components/p-3555cef1.js +0 -122
- package/dist/components/p-474b6663.js +0 -1314
- package/dist/components/p-821f2345.js +0 -93
- package/dist/components/p-9b5a4f9e.js +0 -44
- package/dist/components/p-a706bac9.js +0 -3719
- package/dist/components/p-b0766439.js +0 -76
- package/dist/components/p-ed9a1a21.js +0 -200
- package/dist/components/verdocs-template-attachments.d.ts +0 -11
- package/dist/components/verdocs-template-attachments.js +0 -6
- package/dist/components/verdocs-template-name.d.ts +0 -11
- package/dist/components/verdocs-template-name.js +0 -6
- package/dist/components/verdocs-template-visibility.d.ts +0 -11
- package/dist/components/verdocs-template-visibility.js +0 -6
- package/dist/esm/EnvelopeStore-4599b7d3.js +0 -93
- package/dist/esm/Icons-faf0377f.js +0 -76
- package/dist/esm/TemplateFieldStore-909147d8.js +0 -39
- package/dist/esm/TemplateRoleStore-2fef1fdb.js +0 -44
- package/dist/esm/TemplateStore-ace14a8b.js +0 -97
- package/dist/esm/index-24d8ae6a.js +0 -194
- package/dist/esm/index-7588a071.js +0 -3719
- package/dist/esm/verdocs-file-chooser_2.entry.js +0 -53
- package/dist/esm/verdocs-loader.entry.js +0 -16
- package/dist/esm-es5/EnvelopeStore-4599b7d3.js +0 -1
- package/dist/esm-es5/Icons-faf0377f.js +0 -1
- package/dist/esm-es5/TemplateFieldStore-909147d8.js +0 -1
- package/dist/esm-es5/TemplateRoleStore-2fef1fdb.js +0 -1
- package/dist/esm-es5/TemplateStore-ace14a8b.js +0 -1
- package/dist/esm-es5/index-24d8ae6a.js +0 -1
- package/dist/esm-es5/index-7588a071.js +0 -1
- package/dist/esm-es5/index-c8587076.js +0 -1
- package/dist/esm-es5/verdocs-button_3.entry.js +0 -1
- package/dist/esm-es5/verdocs-checkbox_4.entry.js +0 -1
- package/dist/esm-es5/verdocs-file-chooser_2.entry.js +0 -1
- package/dist/esm-es5/verdocs-loader.entry.js +0 -1
- package/dist/esm-es5/verdocs-preview_9.entry.js +0 -1
- package/dist/types/components/templates/verdocs-template-attachments/verdocs-template-attachments.d.ts +0 -56
- package/dist/types/components/templates/verdocs-template-name/verdocs-template-name.d.ts +0 -41
- package/dist/types/components/templates/verdocs-template-visibillity/verdocs-template-visibility.d.ts +0 -42
- package/dist/types/utils/EnvelopeStore.d.ts +0 -12
- package/dist/types/utils/TemplateFieldStore.d.ts +0 -9
- package/dist/types/utils/TemplateRoleStore.d.ts +0 -11
- package/dist/types/utils/TemplateStore.d.ts +0 -16
- package/dist/verdocs-web-sdk/p-0c51c5be.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-194f9f4d.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-1bb57e5d.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-1ce2f724.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-2211234d.system.js +0 -1
- package/dist/verdocs-web-sdk/p-2305c1e8.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-341d540f.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-368a36ea.system.js +0 -1
- package/dist/verdocs-web-sdk/p-36b5d46e.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-483f3d7f.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-569434fb.system.js +0 -1
- package/dist/verdocs-web-sdk/p-56c1ebd6.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-5bf2910c.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-60da2bbe.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-6fda3817.js +0 -1
- package/dist/verdocs-web-sdk/p-79e222f8.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-7d18cb23.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-7d593603.system.js +0 -1
- package/dist/verdocs-web-sdk/p-9515e206.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-9fabdbb1.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-9ff1be63.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-a04aac80.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-a706bac9.js +0 -1
- package/dist/verdocs-web-sdk/p-b0766439.js +0 -1
- package/dist/verdocs-web-sdk/p-b17843d9.system.js +0 -1
- package/dist/verdocs-web-sdk/p-b56793c4.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-b7a9f07d.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-b84d1a25.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-bb253149.js +0 -1
- package/dist/verdocs-web-sdk/p-bd642df2.js +0 -1
- package/dist/verdocs-web-sdk/p-c7115b35.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-cd546dbe.system.js +0 -1
- package/dist/verdocs-web-sdk/p-cde4c155.js +0 -1
- package/dist/verdocs-web-sdk/p-d86c8c1a.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-dbddb752.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-dcd3eb1b.js +0 -1
- package/dist/verdocs-web-sdk/p-e123f19c.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e294b6c2.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e48b387d.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e83a163d.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-e952ab89.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-f08eb8bf.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-f5064e0c.system.js +0 -1
- package/dist/verdocs-web-sdk/p-f79b8537.system.js +0 -1
- package/dist/verdocs-web-sdk/p-fa06e241.entry.js +0 -1
@@ -1,16 +1,11 @@
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, F as Fragment, g as getElement } from './index-
|
2
|
-
import { VerdocsEndpoint, integerSequence, getOrganizationContacts, isValidEmail, createEnvelope, getRGBA, formatFullName,
|
3
|
-
import { g as getTemplateFieldStore, u as updateStoreField } from './TemplateFieldStore-909147d8.js';
|
4
|
-
import { g as getTemplateRoleStore, b as getRoleNames, a as getRoleIndex, u as updateStoreRole } from './TemplateRoleStore-2fef1fdb.js';
|
5
|
-
import { g as getTemplateStore } from './TemplateStore-ace14a8b.js';
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, F as Fragment, g as getElement } from './index-272d51a4.js';
|
2
|
+
import { VerdocsEndpoint, getTemplate, integerSequence, getOrganizationContacts, isValidEmail, createEnvelope, getRGBA, formatFullName, updateField, createField, updateTemplateRole, createTemplateRole } from '@verdocs/js-sdk';
|
6
3
|
import { S as SDKError } from './errors-887f1e88.js';
|
4
|
+
import { S as Store } from './Datastore-52fcbac6.js';
|
7
5
|
import { V as VerdocsToast } from './Toast-c4843828.js';
|
8
|
-
import { D as DocIcon, P as PngIcon, J as JpgIcon, a as PdfIcon, F as FileIcon$1, b as PageCountIcon, T as TrashIcon } from './Icons-faf0377f.js';
|
9
6
|
import { f as format } from './format-b8602175.js';
|
10
7
|
import { i as interact } from './interact.min-a71beb3d.js';
|
11
|
-
import { b as updateCssTransform, c as removeCssTransform, d as setControlStyles, g as getFieldId, e as defaultWidth, f as defaultHeight } from './utils-
|
12
|
-
import './index-24d8ae6a.js';
|
13
|
-
import './index-7588a071.js';
|
8
|
+
import { b as updateCssTransform, c as removeCssTransform, d as setControlStyles, g as getFieldId, e as defaultWidth, f as defaultHeight } from './utils-47de6f79.js';
|
14
9
|
import './_commonjsHelpers-bdec4bbd.js';
|
15
10
|
import './Types-95d86a44.js';
|
16
11
|
|
@@ -21,16 +16,31 @@ const VerdocsPreview = class {
|
|
21
16
|
constructor(hostRef) {
|
22
17
|
registerInstance(this, hostRef);
|
23
18
|
this.sdkError = createEvent(this, "sdkError", 7);
|
24
|
-
this.
|
25
|
-
this.fieldStore = null;
|
26
|
-
this.roleStore = null;
|
19
|
+
this.templateListenerId = null;
|
27
20
|
this.endpoint = VerdocsEndpoint.getDefault();
|
28
21
|
this.templateId = null;
|
29
22
|
this.loading = true;
|
23
|
+
this.template = null;
|
24
|
+
}
|
25
|
+
disconnectedCallback() {
|
26
|
+
this.unlistenToTemplate();
|
27
|
+
}
|
28
|
+
async listenToTemplate() {
|
29
|
+
this.unlistenToTemplate();
|
30
|
+
Store.subscribe('templates', this.templateId, () => getTemplate(this.endpoint, this.templateId), false, (template) => {
|
31
|
+
this.template = template;
|
32
|
+
this.loading = false;
|
33
|
+
});
|
34
|
+
}
|
35
|
+
unlistenToTemplate() {
|
36
|
+
if (this.templateListenerId) {
|
37
|
+
Store.store.delListener(this.templateListenerId);
|
38
|
+
this.templateListenerId = null;
|
39
|
+
}
|
30
40
|
}
|
31
41
|
onTemplateIdChanged(newTemplateId) {
|
32
42
|
console.log('[PREVIEW] Template ID changed', newTemplateId);
|
33
|
-
this.
|
43
|
+
this.listenToTemplate();
|
34
44
|
}
|
35
45
|
async componentWillLoad() {
|
36
46
|
var _a, _b, _c;
|
@@ -44,40 +54,25 @@ const VerdocsPreview = class {
|
|
44
54
|
console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);
|
45
55
|
return;
|
46
56
|
}
|
47
|
-
|
57
|
+
this.listenToTemplate();
|
48
58
|
}
|
49
59
|
catch (e) {
|
50
60
|
console.log('[PREVIEW] Error with preview session', e);
|
51
61
|
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
52
62
|
}
|
53
63
|
}
|
54
|
-
async loadTemplate(templateId) {
|
55
|
-
if (templateId) {
|
56
|
-
getTemplateStore(this.endpoint, templateId, false)
|
57
|
-
.then(ts => {
|
58
|
-
this.templateStore = ts;
|
59
|
-
this.fieldStore = getTemplateFieldStore(this.templateId);
|
60
|
-
this.roleStore = getTemplateRoleStore(this.templateId);
|
61
|
-
this.loading = false;
|
62
|
-
})
|
63
|
-
.catch(e => {
|
64
|
-
console.log('Unable to load template', e);
|
65
|
-
throw e;
|
66
|
-
});
|
67
|
-
}
|
68
|
-
}
|
69
64
|
handlePageRendered(_e) {
|
70
65
|
// const pageInfo = e.detail as IDocumentPageInfo;
|
71
|
-
// const fields = this.
|
66
|
+
// const fields = (this.template?.fields || []).filter(field => field.page === pageInfo.pageNumber);
|
72
67
|
// console.log('[PREVIEW] Page rendered', pageInfo, fields);
|
73
68
|
// fields.forEach(field => renderDocumentField(field, pageInfo, {disabled: true, editable: false, draggable: false}));
|
74
69
|
}
|
75
70
|
render() {
|
76
|
-
var _a
|
71
|
+
var _a;
|
77
72
|
if (this.loading) {
|
78
73
|
return (h(Host, null, h("verdocs-loader", null)));
|
79
74
|
}
|
80
|
-
return (h(Host, null, (((
|
75
|
+
return (h(Host, null, (((_a = this.template) === null || _a === void 0 ? void 0 : _a.documents) || []).map(document => {
|
81
76
|
const pageNumbers = integerSequence(1, document.pages);
|
82
77
|
return (h(Fragment, null, pageNumbers.map(pageNumber => {
|
83
78
|
var _a;
|
@@ -95,6 +90,9 @@ const VerdocsPreview = class {
|
|
95
90
|
};
|
96
91
|
VerdocsPreview.style = VerdocsPreviewStyle0;
|
97
92
|
|
93
|
+
const getRoleNames = (template) => ((template === null || template === void 0 ? void 0 : template.roles) || []).map(role => role.name);
|
94
|
+
const getRoleIndex = (template, role_name) => Math.max(getRoleNames(template).findIndex(name => name === role_name), 0);
|
95
|
+
|
98
96
|
const verdocsSendCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}";
|
99
97
|
const VerdocsSendStyle0 = verdocsSendCss;
|
100
98
|
|
@@ -110,6 +108,7 @@ const VerdocsSend = class {
|
|
110
108
|
this.exit = createEvent(this, "exit", 7);
|
111
109
|
this.sdkError = createEvent(this, "sdkError", 7);
|
112
110
|
this.searchContacts = createEvent(this, "searchContacts", 7);
|
111
|
+
this.templateListenerId = null;
|
113
112
|
this.endpoint = VerdocsEndpoint.getDefault();
|
114
113
|
this.templateId = null;
|
115
114
|
this.environment = '';
|
@@ -118,15 +117,33 @@ const VerdocsSend = class {
|
|
118
117
|
this.sessionContacts = [];
|
119
118
|
this.sending = false;
|
120
119
|
this.rolesCompleted = {};
|
121
|
-
this.
|
122
|
-
this.
|
120
|
+
this.loading = true;
|
121
|
+
this.template = null;
|
122
|
+
}
|
123
|
+
disconnectedCallback() {
|
124
|
+
this.unlistenToTemplate();
|
125
|
+
}
|
126
|
+
async listenToTemplate() {
|
127
|
+
console.log('[SEND] Loading template', this.templateId);
|
128
|
+
this.unlistenToTemplate();
|
129
|
+
Store.subscribe('templates', this.templateId, () => getTemplate(this.endpoint, this.templateId), false, (template) => {
|
130
|
+
this.template = template;
|
131
|
+
this.loading = false;
|
132
|
+
this.rolesCompleted = {};
|
133
|
+
});
|
134
|
+
}
|
135
|
+
unlistenToTemplate() {
|
136
|
+
if (this.templateListenerId) {
|
137
|
+
Store.store.delListener(this.templateListenerId);
|
138
|
+
this.templateListenerId = null;
|
139
|
+
}
|
123
140
|
}
|
124
141
|
async reset() {
|
125
142
|
this.rolesCompleted = {};
|
126
143
|
}
|
127
144
|
onTemplateIdChanged(newTemplateId) {
|
128
145
|
console.log('[SEND] Template ID changed', newTemplateId);
|
129
|
-
this.
|
146
|
+
this.listenToTemplate();
|
130
147
|
}
|
131
148
|
async componentWillLoad() {
|
132
149
|
var _a, _b, _c;
|
@@ -163,37 +180,18 @@ const VerdocsSend = class {
|
|
163
180
|
console.log(`[SEND] Missing required template ID ${this.templateId}`);
|
164
181
|
return;
|
165
182
|
}
|
166
|
-
|
183
|
+
this.listenToTemplate();
|
167
184
|
}
|
168
185
|
catch (e) {
|
169
186
|
console.log('[SEND] Error with send session', e);
|
170
187
|
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
171
188
|
}
|
172
189
|
}
|
173
|
-
async loadTemplate(templateId) {
|
174
|
-
var _a, _b, _c, _d, _e;
|
175
|
-
if (!templateId) {
|
176
|
-
return;
|
177
|
-
}
|
178
|
-
try {
|
179
|
-
this.templateStore = await getTemplateStore(this.endpoint, templateId, false);
|
180
|
-
this.roleStore = getTemplateRoleStore(templateId);
|
181
|
-
this.recomputeRolesCompleted();
|
182
|
-
if (!((_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable)) {
|
183
|
-
console.warn(`[SEND] Template is not sendable`, templateId);
|
184
|
-
}
|
185
|
-
}
|
186
|
-
catch (e) {
|
187
|
-
console.log('[SEND] Error with preview session', e);
|
188
|
-
(_c = this.sdkError) === null || _c === void 0 ? void 0 : _c.emit(new SDKError(e.message, (_d = e.response) === null || _d === void 0 ? void 0 : _d.status, (_e = e.response) === null || _e === void 0 ? void 0 : _e.data));
|
189
|
-
}
|
190
|
-
}
|
191
190
|
recomputeRolesCompleted() {
|
192
191
|
var _a;
|
193
|
-
const roles = ((_a = this.roleStore) === null || _a === void 0 ? void 0 : _a.get('roles')) || [];
|
194
|
-
const rolesAtLevel = {};
|
195
192
|
this.rolesCompleted = {};
|
196
|
-
|
193
|
+
const rolesAtLevel = {};
|
194
|
+
(((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || []).forEach(role => {
|
197
195
|
const level = role.sequence - 1;
|
198
196
|
rolesAtLevel[level] || (rolesAtLevel[level] = []);
|
199
197
|
const id = `r-${level}-${rolesAtLevel[level].length}`;
|
@@ -207,15 +205,13 @@ const VerdocsSend = class {
|
|
207
205
|
}
|
208
206
|
getLevels() {
|
209
207
|
var _a;
|
210
|
-
const
|
211
|
-
const levels = [...new Set(roles.map(role => role.sequence - 1))];
|
208
|
+
const levels = [...new Set((((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || []).map(role => role.sequence - 1))];
|
212
209
|
levels.sort((a, b) => a - b);
|
213
210
|
return levels;
|
214
211
|
}
|
215
212
|
getRolesAtLevel(level) {
|
216
213
|
var _a;
|
217
|
-
const
|
218
|
-
const rolesAtLevel = roles
|
214
|
+
const rolesAtLevel = (((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || [])
|
219
215
|
.filter(role => role.sequence - 1 === level)
|
220
216
|
.map((role, index) => ({
|
221
217
|
...role,
|
@@ -248,7 +244,7 @@ const VerdocsSend = class {
|
|
248
244
|
this.showPickerForId = role.id;
|
249
245
|
}
|
250
246
|
handleSend(e) {
|
251
|
-
var _a, _b
|
247
|
+
var _a, _b;
|
252
248
|
if (this.sending) {
|
253
249
|
console.log('[SEND] Skipping duplicate send', e);
|
254
250
|
return;
|
@@ -260,7 +256,7 @@ const VerdocsSend = class {
|
|
260
256
|
(_a = this.sendingEnvelope) === null || _a === void 0 ? void 0 : _a.emit({ sending: true });
|
261
257
|
const details = {
|
262
258
|
template_id: this.templateId,
|
263
|
-
name: ((
|
259
|
+
name: ((_b = this.template) === null || _b === void 0 ? void 0 : _b.name) || 'New Envelope',
|
264
260
|
environment: this.environment,
|
265
261
|
initial_reminder: 0,
|
266
262
|
followup_reminders: 0,
|
@@ -271,12 +267,12 @@ const VerdocsSend = class {
|
|
271
267
|
console.log('[SEND] Creating envelope', details);
|
272
268
|
createEnvelope(this.endpoint, details)
|
273
269
|
.then(r => {
|
274
|
-
var _a, _b
|
270
|
+
var _a, _b;
|
275
271
|
console.log('[SEND] Send envelope', r);
|
276
272
|
this.reset().catch((e) => console.log('Unknown Error', e));
|
277
273
|
this.sending = false;
|
278
274
|
(_a = this.sendingEnvelope) === null || _a === void 0 ? void 0 : _a.emit({ sending: false });
|
279
|
-
(_b = this.send) === null || _b === void 0 ? void 0 : _b.emit({ ...details, name:
|
275
|
+
(_b = this.send) === null || _b === void 0 ? void 0 : _b.emit({ ...details, name: details.name, envelope_id: r.id, envelope: r });
|
280
276
|
})
|
281
277
|
.catch(e => {
|
282
278
|
var _a, _b, _c;
|
@@ -292,22 +288,25 @@ const VerdocsSend = class {
|
|
292
288
|
(_a = this.exit) === null || _a === void 0 ? void 0 : _a.emit();
|
293
289
|
}
|
294
290
|
render() {
|
295
|
-
var _a
|
291
|
+
var _a;
|
292
|
+
if (this.loading) {
|
293
|
+
return (h(Host, null, h("verdocs-loader", null)));
|
294
|
+
}
|
296
295
|
if (!this.endpoint.session) {
|
297
296
|
return (h(Host, { style: { display: 'flex' } }, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
298
297
|
}
|
299
298
|
const levels = this.getLevels();
|
300
|
-
const roleNames = getRoleNames(this.roleStore);
|
301
299
|
const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email));
|
302
300
|
// TODO: Reactivate once SMS is re-enabled
|
303
301
|
// const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
|
304
|
-
const allRolesAssigned = rolesAssigned.length >=
|
305
|
-
|
306
|
-
return (h(Host, { class: { sendable: (_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
|
302
|
+
const allRolesAssigned = rolesAssigned.length >= getRoleNames(this.template).length;
|
303
|
+
return (h(Host, { class: { sendable: (_a = this.template) === null || _a === void 0 ? void 0 : _a.is_sendable } }, h("div", { class: "recipients" }, h("div", { class: "left-line" }), h("div", { class: `level level-start` }, this.getLevelIcon(-1), h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
|
307
304
|
var _a, _b, _c, _d;
|
308
305
|
const unknown = !role.email;
|
309
306
|
const elId = `verdocs-send-recipient-${role.role_name}`;
|
310
|
-
|
307
|
+
const roleIndex = getRoleIndex(this.template, role.role_name);
|
308
|
+
const rgba = getRGBA(roleIndex);
|
309
|
+
return unknown ? (h("div", { class: "recipient", "data-ri": roleIndex, "data-rn": role.role_name, style: { backgroundColor: rgba }, onClick: e => this.handleClickRole(e, role), id: elId }, ((_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.first_name) ? formatFullName(this.rolesCompleted[role.id]) : role.role_name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-portal", { anchor: elId, onClickAway: () => (this.showPickerForId = '') }, h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_b = this.rolesCompleted[role.id]) !== null && _b !== void 0 ? _b : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } }))))) : (h("div", { class: "recipient", style: { borderColor: rgba }, onClick: e => this.handleClickRole(e, role), id: elId }, ((_c = this.rolesCompleted[role.id]) === null || _c === void 0 ? void 0 : _c.first_name) ? formatFullName(this.rolesCompleted[role.id]) : role.role_name, h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (h("verdocs-portal", { anchor: elId, onClickAway: () => (this.showPickerForId = '') }, h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: ((_d = this.rolesCompleted[role.id]) !== null && _d !== void 0 ? _d : role), onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } })))));
|
311
310
|
})))), h("div", { class: `level level-done` }, this.getLevelIcon(levels.length), h("div", { class: "complete" }, "Signing Complete"))), h("div", { class: "buttons" }, h("verdocs-button", { label: "Cancel", size: "small", variant: "outline", onClick: e => this.handleCancel(e), disabled: this.sending }), h("verdocs-button", { label: "Send", size: "small", disabled: !allRolesAssigned || this.sending, onClick: e => this.handleSend(e) }), this.sending && h("verdocs-spinner", null))));
|
312
311
|
}
|
313
312
|
static get watchers() { return {
|
@@ -316,140 +315,6 @@ const VerdocsSend = class {
|
|
316
315
|
};
|
317
316
|
VerdocsSend.style = VerdocsSendStyle0;
|
318
317
|
|
319
|
-
const verdocsTemplateAttachmentsCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}";
|
320
|
-
const VerdocsTemplateAttachmentsStyle0 = verdocsTemplateAttachmentsCss;
|
321
|
-
|
322
|
-
const VerdocsTemplateAttachments = class {
|
323
|
-
constructor(hostRef) {
|
324
|
-
registerInstance(this, hostRef);
|
325
|
-
this.exit = createEvent(this, "exit", 7);
|
326
|
-
this.next = createEvent(this, "next", 7);
|
327
|
-
this.templateUpdated = createEvent(this, "templateUpdated", 7);
|
328
|
-
this.sdkError = createEvent(this, "sdkError", 7);
|
329
|
-
this.endpoint = VerdocsEndpoint.getDefault();
|
330
|
-
this.templateId = '';
|
331
|
-
this.uploading = false;
|
332
|
-
this.progressLabel = 'Uploading...';
|
333
|
-
this.progressPercent = 0;
|
334
|
-
this.showDeleteError = false;
|
335
|
-
this.confirmDeleteDocument = null;
|
336
|
-
this.store = null;
|
337
|
-
}
|
338
|
-
async componentWillLoad() {
|
339
|
-
var _a, _b, _c;
|
340
|
-
try {
|
341
|
-
this.endpoint.loadSession();
|
342
|
-
if (!this.templateId) {
|
343
|
-
console.log(`[ROLES] Missing required template ID ${this.templateId}`);
|
344
|
-
return;
|
345
|
-
}
|
346
|
-
if (!this.endpoint.session) {
|
347
|
-
console.log('[ROLES] Unable to start builder session, must be authenticated');
|
348
|
-
return;
|
349
|
-
}
|
350
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
351
|
-
}
|
352
|
-
catch (e) {
|
353
|
-
console.log('[TEMPLATE ATTACHMENTS] Error loading template', e);
|
354
|
-
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
355
|
-
}
|
356
|
-
}
|
357
|
-
handleCancel(e) {
|
358
|
-
e.stopPropagation();
|
359
|
-
this.exit.emit();
|
360
|
-
}
|
361
|
-
handleUploadProgress(percent) {
|
362
|
-
if (percent >= 99) {
|
363
|
-
this.progressPercent = 100;
|
364
|
-
this.progressLabel = 'Processing...';
|
365
|
-
}
|
366
|
-
else {
|
367
|
-
this.progressPercent = percent;
|
368
|
-
}
|
369
|
-
}
|
370
|
-
async handleUpload(e) {
|
371
|
-
var _a, _b, _c, _d;
|
372
|
-
e.stopPropagation();
|
373
|
-
const file = e.detail.file;
|
374
|
-
if (!file) {
|
375
|
-
return;
|
376
|
-
}
|
377
|
-
console.log('[ATTACHMENTS] Uploading...', file);
|
378
|
-
this.uploading = true;
|
379
|
-
this.progressLabel = 'Uploading...';
|
380
|
-
try {
|
381
|
-
const template = await createTemplateDocument(this.endpoint, this.templateId, file, this.handleUploadProgress.bind(this));
|
382
|
-
console.log('[ATTACHMENTS] Created attachment', template);
|
383
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
384
|
-
console.log('[ATTACHMENTS] Updated template', this.store.state);
|
385
|
-
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: this.store.state, event: 'attachments' });
|
386
|
-
this.uploading = false;
|
387
|
-
this.progressLabel = '';
|
388
|
-
this.progressPercent = 0;
|
389
|
-
}
|
390
|
-
catch (e) {
|
391
|
-
console.log('[ATTACHMENTS] Error creating template', e);
|
392
|
-
(_b = this.sdkError) === null || _b === void 0 ? void 0 : _b.emit(new SDKError(e.message, (_c = e.response) === null || _c === void 0 ? void 0 : _c.status, (_d = e.response) === null || _d === void 0 ? void 0 : _d.data));
|
393
|
-
this.uploading = false;
|
394
|
-
}
|
395
|
-
}
|
396
|
-
handleNext(e) {
|
397
|
-
var _a;
|
398
|
-
e.stopPropagation();
|
399
|
-
this.uploading = false;
|
400
|
-
this.progressLabel = '';
|
401
|
-
this.progressPercent = 0;
|
402
|
-
(_a = this.next) === null || _a === void 0 ? void 0 : _a.emit({ template: this.store.state });
|
403
|
-
}
|
404
|
-
async confirmDelete() {
|
405
|
-
await deleteTemplateDocument(this.endpoint, this.templateId, this.confirmDeleteDocument.id);
|
406
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
407
|
-
console.log('[ATTACHMENTS] New template', this.store.state);
|
408
|
-
this.confirmDeleteDocument = null;
|
409
|
-
}
|
410
|
-
async handleDelete(document) {
|
411
|
-
var _a;
|
412
|
-
if (((_a = this.store.state) === null || _a === void 0 ? void 0 : _a.documents.length) > 1) {
|
413
|
-
this.confirmDeleteDocument = document;
|
414
|
-
}
|
415
|
-
else {
|
416
|
-
this.showDeleteError = true;
|
417
|
-
}
|
418
|
-
}
|
419
|
-
getFileIcon(document) {
|
420
|
-
switch (document.mime) {
|
421
|
-
case 'application/pdf':
|
422
|
-
return PdfIcon;
|
423
|
-
case 'image/jpeg':
|
424
|
-
return JpgIcon;
|
425
|
-
case 'image/png':
|
426
|
-
return PngIcon;
|
427
|
-
case 'application/msword':
|
428
|
-
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
429
|
-
return DocIcon;
|
430
|
-
}
|
431
|
-
return FileIcon$1;
|
432
|
-
}
|
433
|
-
render() {
|
434
|
-
var _a, _b, _c;
|
435
|
-
if (!this.endpoint.session) {
|
436
|
-
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
437
|
-
}
|
438
|
-
const templateState = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state;
|
439
|
-
if (!templateState.isLoaded) {
|
440
|
-
return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
|
441
|
-
}
|
442
|
-
// This is meant to be a companion for larger visual experiences so we just go blank on errors for now.
|
443
|
-
if (!this.endpoint.session || !templateState.profile_id) {
|
444
|
-
return h(Host, { class: "empty" });
|
445
|
-
}
|
446
|
-
return (h(Host, null, h("h5", null, "Existing Attachments"), h("div", { class: "attachments" }, (_b = this.store) === null || _b === void 0 ? void 0 : _b.state.documents.map(document => (h("div", { class: "attachment" }, h("div", { class: "file-icon", innerHTML: this.getFileIcon(document) }), h("div", { class: "filename", title: document.name }, document.name), h("div", { class: "pages" }, h("div", { class: "count" }, document.pages), h("div", { class: "pages-icon", innerHTML: PageCountIcon })), h("div", { class: "trash-icon", innerHTML: TrashIcon, onClick: () => this.handleDelete(document) }))))), h("h5", null, "Attach a New Document"), this.uploading ? (h("div", { class: "loader-wrapper" }, h("verdocs-loader", null), this.progressLabel && (h("div", { class: "progress-wrapper" }, h("verdocs-progress-bar", { showPercent: true, percent: this.progressPercent, label: this.progressLabel }))))) : (h("verdocs-file-chooser", { onFileSelected: e => this.handleUpload(e) })), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e), disabled: this.uploading }), h("verdocs-button", { label: "Next", size: "small", onClick: e => this.handleNext(e), disabled: !((_c = this.store) === null || _c === void 0 ? void 0 : _c.state.documents.length) || this.uploading })), this.showDeleteError && (h("verdocs-ok-dialog", { heading: "Unable to Delete Attachment", message: "Templates must contain at least one attachment.", onNext: () => (this.showDeleteError = false) })), this.confirmDeleteDocument && (h("verdocs-ok-dialog", { heading: "Delete this Attachment?", message: "This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.", onNext: () => this.confirmDelete(), showCancel: true, onExit: () => {
|
447
|
-
this.confirmDeleteDocument = null;
|
448
|
-
} }))));
|
449
|
-
}
|
450
|
-
};
|
451
|
-
VerdocsTemplateAttachments.style = VerdocsTemplateAttachmentsStyle0;
|
452
|
-
|
453
318
|
const verdocsTemplateBuildTabsCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}";
|
454
319
|
const VerdocsTemplateBuildTabsStyle0 = verdocsTemplateBuildTabsCss;
|
455
320
|
|
@@ -461,21 +326,38 @@ const VerdocsTemplateBuildTabs = class {
|
|
461
326
|
registerInstance(this, hostRef);
|
462
327
|
this.sdkError = createEvent(this, "sdkError", 7);
|
463
328
|
this.stepChanged = createEvent(this, "stepChanged", 7);
|
329
|
+
this.templateListenerId = null;
|
464
330
|
this.endpoint = VerdocsEndpoint.getDefault();
|
465
331
|
this.templateId = null;
|
466
332
|
this.step = 'preview';
|
467
|
-
this.
|
333
|
+
this.loading = true;
|
334
|
+
this.template = null;
|
335
|
+
}
|
336
|
+
disconnectedCallback() {
|
337
|
+
this.unlistenToTemplate();
|
338
|
+
}
|
339
|
+
async listenToTemplate() {
|
340
|
+
this.unlistenToTemplate();
|
341
|
+
Store.subscribe('templates', this.templateId, () => getTemplate(this.endpoint, this.templateId), false, (template) => {
|
342
|
+
this.template = template;
|
343
|
+
this.loading = false;
|
344
|
+
});
|
345
|
+
}
|
346
|
+
unlistenToTemplate() {
|
347
|
+
if (this.templateListenerId) {
|
348
|
+
Store.store.delListener(this.templateListenerId);
|
349
|
+
this.templateListenerId = null;
|
350
|
+
}
|
468
351
|
}
|
469
352
|
onTemplateIdChanged(newTemplateId) {
|
470
353
|
console.log('[BUILD_TABS] Template ID changed', newTemplateId);
|
471
|
-
this.
|
354
|
+
this.listenToTemplate();
|
472
355
|
}
|
473
356
|
onStepChanged(newStep) {
|
474
357
|
console.log('[BUILD_TABS] Step changed', newStep);
|
475
|
-
this.loadTemplate(this.templateId).catch((e) => console.log('Unknown Error', e));
|
476
358
|
}
|
477
359
|
async componentWillLoad() {
|
478
|
-
var _a, _b, _c
|
360
|
+
var _a, _b, _c;
|
479
361
|
try {
|
480
362
|
this.endpoint.loadSession();
|
481
363
|
if (!this.endpoint.session) {
|
@@ -487,27 +369,16 @@ const VerdocsTemplateBuildTabs = class {
|
|
487
369
|
console.log('[BUILD_TABS] Missing required template ID, forcing view to attachments');
|
488
370
|
return;
|
489
371
|
}
|
490
|
-
|
491
|
-
this.templateStore = await getTemplateStore(this.endpoint, this.templateId, false);
|
492
|
-
}
|
493
|
-
catch (e) {
|
494
|
-
console.log('[BUILD_TABS] Error loading template', e);
|
495
|
-
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
496
|
-
}
|
372
|
+
this.listenToTemplate();
|
497
373
|
}
|
498
374
|
catch (e) {
|
499
375
|
console.log('[BUILD_TABS] Error loading template', e);
|
500
|
-
(
|
501
|
-
}
|
502
|
-
}
|
503
|
-
async loadTemplate(templateId) {
|
504
|
-
if (templateId) {
|
505
|
-
this.templateStore = await getTemplateStore(this.endpoint, templateId, false);
|
376
|
+
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
506
377
|
}
|
507
378
|
}
|
508
379
|
setStep(e) {
|
509
380
|
var _a;
|
510
|
-
console.log('Selected step', e.detail.tab.id);
|
381
|
+
console.log('[BUILD_TABS] Selected step', e.detail.tab.id);
|
511
382
|
e.stopPropagation();
|
512
383
|
e.preventDefault();
|
513
384
|
this.step = e.detail.tab.id;
|
@@ -526,18 +397,16 @@ const VerdocsTemplateBuildTabs = class {
|
|
526
397
|
});
|
527
398
|
}
|
528
399
|
render() {
|
529
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
400
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
401
|
+
if (this.loading) {
|
402
|
+
return (h(Host, null, h("verdocs-loader", null)));
|
403
|
+
}
|
530
404
|
if (!this.endpoint.session) {
|
531
405
|
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
532
406
|
}
|
533
|
-
|
534
|
-
let canEditFields =
|
535
|
-
|
536
|
-
if (this.templateId && this.templateStore && this.templateStore.state) {
|
537
|
-
canEditRoles = ((_c = (_b = (_a = this.templateStore) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
538
|
-
canEditFields = canEditRoles && ((_f = (_e = (_d = this.templateStore) === null || _d === void 0 ? void 0 : _d.state) === null || _e === void 0 ? void 0 : _e.roles) === null || _f === void 0 ? void 0 : _f.length) > 0;
|
539
|
-
canPreview = canEditFields && ((_j = (_h = (_g = this.templateStore) === null || _g === void 0 ? void 0 : _g.state) === null || _h === void 0 ? void 0 : _h.fields) === null || _j === void 0 ? void 0 : _j.length) > 0;
|
540
|
-
}
|
407
|
+
const canEditRoles = (((_a = this.template) === null || _a === void 0 ? void 0 : _a.documents) || []).length > 0;
|
408
|
+
let canEditFields = canEditRoles && (((_b = this.template) === null || _b === void 0 ? void 0 : _b.roles) || []).length > 0;
|
409
|
+
const canPreview = canEditFields && (((_c = this.template) === null || _c === void 0 ? void 0 : _c.fields) || []).length > 0;
|
541
410
|
let selectedStepIndex = Math.max(STEPS.indexOf(this.step), 0);
|
542
411
|
if (!canPreview && selectedStepIndex >= 4) {
|
543
412
|
selectedStepIndex = 3;
|
@@ -554,8 +423,8 @@ const VerdocsTemplateBuildTabs = class {
|
|
554
423
|
{ id: 'settings', disabled: !canEditFields, label: 'Settings' },
|
555
424
|
{ id: 'fields', disabled: !canEditFields, label: 'Fields' },
|
556
425
|
{ id: 'preview', disabled: !canPreview, label: 'Preview/Send' },
|
557
|
-
] }), this.templateId && (h("div", { class: "info" }, h("verdocs-button-panel", { icon: HelpIcon }, h("div", { class: "template-details-panel" }, h("h6", null, "Template Details"), h("div", { class: "row" }, h("label", null, "ID:"), h("div", { class: "value" }, this.templateId), h("div", { class: "icon-button", innerHTML: CopyIcon, onClick: () => this.copyTemplateId() })), h("div", { class: "row" }, h("label", null, "Name:"), h("div", { class: "value" }, (
|
558
|
-
|
426
|
+
] }), this.templateId && (h("div", { class: "info" }, h("verdocs-button-panel", { icon: HelpIcon }, h("div", { class: "template-details-panel" }, h("h6", null, "Template Details"), h("div", { class: "row" }, h("label", null, "ID:"), h("div", { class: "value" }, this.templateId), h("div", { class: "icon-button", innerHTML: CopyIcon, onClick: () => this.copyTemplateId() })), h("div", { class: "row" }, h("label", null, "Name:"), h("div", { class: "value" }, (_d = this.template) === null || _d === void 0 ? void 0 : _d.name)), h("div", { class: "row" }, h("label", null, "Visibility:"), h("div", { class: "value" }, ((_e = this.template) === null || _e === void 0 ? void 0 : _e.is_public) ? 'Public' : ((_f = this.template) === null || _f === void 0 ? void 0 : _f.is_personal) ? 'Private' : 'Shared')), h("div", { class: "row" }, h("label", null, "Created:"), h("div", { class: "value" }, ((_g = this.template) === null || _g === void 0 ? void 0 : _g.counter) ? format(new Date((_h = this.template) === null || _h === void 0 ? void 0 : _h.created_at), 'P p') : '')), h("div", { class: "row" }, h("label", null, "Used:"), h("div", { class: "value" }, (_j = this.template) === null || _j === void 0 ? void 0 :
|
427
|
+
_j.counter, " time(s)"))))))));
|
559
428
|
}
|
560
429
|
static get watchers() { return {
|
561
430
|
"templateId": ["onTemplateIdChanged"],
|
@@ -564,112 +433,6 @@ const VerdocsTemplateBuildTabs = class {
|
|
564
433
|
};
|
565
434
|
VerdocsTemplateBuildTabs.style = VerdocsTemplateBuildTabsStyle0;
|
566
435
|
|
567
|
-
const verdocsTemplateCreateCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-create{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-create form .upload-box{-webkit-box-sizing:border-box;box-sizing:border-box;width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box.drag-over{border:2px solid #4c56cb}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create p{color:#33364b;margin-top:20px;font-size:18px;font-weight:500;overflow-wrap:anywhere}verdocs-template-create p.subscript{color:#5c6575;font-size:14px;margin:20px}verdocs-template-create .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .progress-wrapper{padding:20px}verdocs-template-create .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}verdocs-template-create .error{margin:20px 0;color:#cc0000}";
|
568
|
-
const VerdocsTemplateCreateStyle0 = verdocsTemplateCreateCss;
|
569
|
-
|
570
|
-
const FileIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>';
|
571
|
-
const VerdocsTemplateCreate = class {
|
572
|
-
constructor(hostRef) {
|
573
|
-
registerInstance(this, hostRef);
|
574
|
-
this.exit = createEvent(this, "exit", 7);
|
575
|
-
this.next = createEvent(this, "next", 7);
|
576
|
-
this.sdkError = createEvent(this, "sdkError", 7);
|
577
|
-
this.templateCreated = createEvent(this, "templateCreated", 7);
|
578
|
-
this.endpoint = VerdocsEndpoint.getDefault();
|
579
|
-
this.maxSize = 20.5 * 1024 * 1024;
|
580
|
-
this.file = undefined;
|
581
|
-
this.creating = false;
|
582
|
-
this.progressLabel = 'Uploading...';
|
583
|
-
this.progressPercent = 0;
|
584
|
-
this.errorMessage = '';
|
585
|
-
}
|
586
|
-
componentWillLoad() {
|
587
|
-
this.endpoint.setTimeout(30000);
|
588
|
-
this.endpoint.loadSession();
|
589
|
-
}
|
590
|
-
handleFileChanged(e) {
|
591
|
-
var _a;
|
592
|
-
this.errorMessage = '';
|
593
|
-
this.file = ((_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) || null;
|
594
|
-
console.log('[CREATE] Selected file', this.file);
|
595
|
-
const totalSize = this.file.size;
|
596
|
-
if (totalSize > this.maxSize) {
|
597
|
-
this.errorMessage = 'Total file size must not exceed 20MB.';
|
598
|
-
}
|
599
|
-
}
|
600
|
-
handleUpload(e) {
|
601
|
-
e.stopPropagation();
|
602
|
-
const fileElem = document.getElementById('verdocs-template-create-file');
|
603
|
-
fileElem.click();
|
604
|
-
}
|
605
|
-
handleCancel(e) {
|
606
|
-
e.stopPropagation();
|
607
|
-
this.exit.emit();
|
608
|
-
}
|
609
|
-
async handleSubmit(e) {
|
610
|
-
var _a, _b, _c;
|
611
|
-
e.stopPropagation();
|
612
|
-
// Should be true if we're here because onClick is only enabled then. We're just guarding this for Typescript.
|
613
|
-
if (!this.file) {
|
614
|
-
return;
|
615
|
-
}
|
616
|
-
this.creating = true;
|
617
|
-
this.progressLabel = 'Uploading...';
|
618
|
-
try {
|
619
|
-
const template = await createTemplate(this.endpoint, {
|
620
|
-
name: this.file.name,
|
621
|
-
// TODO: Make optional in the SDK
|
622
|
-
initial_reminder: 0,
|
623
|
-
followup_reminders: 0,
|
624
|
-
documents: [this.file],
|
625
|
-
}, percent => {
|
626
|
-
if (percent >= 99) {
|
627
|
-
this.progressLabel = 'Processing...';
|
628
|
-
this.progressPercent = 100;
|
629
|
-
}
|
630
|
-
else {
|
631
|
-
this.progressPercent = percent;
|
632
|
-
}
|
633
|
-
});
|
634
|
-
console.log('[CREATE] Created template', template);
|
635
|
-
getTemplateStore(this.endpoint, template.id, true)
|
636
|
-
.then(() => {
|
637
|
-
var _a, _b;
|
638
|
-
(_a = this.templateCreated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template, templateId: template.id });
|
639
|
-
(_b = this.next) === null || _b === void 0 ? void 0 : _b.emit(template);
|
640
|
-
this.creating = false;
|
641
|
-
this.progressLabel = '';
|
642
|
-
this.progressPercent = 0;
|
643
|
-
})
|
644
|
-
.catch(e => {
|
645
|
-
console.log(e);
|
646
|
-
});
|
647
|
-
}
|
648
|
-
catch (e) {
|
649
|
-
console.log('[CREATE] Error creating template', e);
|
650
|
-
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
651
|
-
this.creating = false;
|
652
|
-
}
|
653
|
-
}
|
654
|
-
render() {
|
655
|
-
if (!this.endpoint.session) {
|
656
|
-
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
657
|
-
}
|
658
|
-
return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("input", { type: "file", id: "verdocs-template-create-file", multiple: true, accept: ".pdf,application/pdf,.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", style: { display: 'none' }, onChange: e => this.handleFileChanged(e) }), this.creating ? (h("div", { class: "loader-wrapper" }, h("verdocs-loader", null), this.progressLabel && (h("div", { class: "progress-wrapper" }, h("verdocs-progress-bar", { showPercent: true, percent: this.progressPercent, label: this.progressLabel }))))) : (h("div", { class: "upload-box", onDrop: (e) => {
|
659
|
-
e.preventDefault();
|
660
|
-
e.target.classList.remove('drag-over');
|
661
|
-
this.file = e.dataTransfer.files[0];
|
662
|
-
if (this.file.size > this.maxSize) {
|
663
|
-
this.errorMessage = 'Total file size must not exceed 20MB.';
|
664
|
-
}
|
665
|
-
}, onDragOver: (e) => {
|
666
|
-
e.preventDefault();
|
667
|
-
e.dataTransfer.dropEffect = 'copy';
|
668
|
-
}, onDragEnter: (e) => e.target.classList.add('drag-over'), onDragLeave: (e) => e.target.classList.remove('drag-over') }, h("span", { innerHTML: FileIcon, style: { display: 'flex', justifyContent: 'center' } }), h("p", null, this.file ? this.file.name : 'Drag and drop your files here'), h("p", { class: "subscript" }, "Supported files: PDF, Word"), h("verdocs-button", { label: this.file ? 'Select a different file' : 'Select a file from your computer', size: "small", onClick: e => this.handleUpload(e) }))), !!this.errorMessage && h("div", { class: "error" }, this.errorMessage), h("div", { class: "buttons" }, h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e), disabled: this.creating }), h("verdocs-button", { label: "Next", size: "small", onClick: e => this.handleSubmit(e), disabled: !this.file || this.creating || !!this.errorMessage })))));
|
669
|
-
}
|
670
|
-
};
|
671
|
-
VerdocsTemplateCreate.style = VerdocsTemplateCreateStyle0;
|
672
|
-
|
673
436
|
const verdocsTemplateFieldsCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";
|
674
437
|
const VerdocsTemplateFieldsStyle0 = verdocsTemplateFieldsCss;
|
675
438
|
|
@@ -704,10 +467,8 @@ const VerdocsTemplateFields = class {
|
|
704
467
|
this.sdkError = createEvent(this, "sdkError", 7);
|
705
468
|
this.templateUpdated = createEvent(this, "templateUpdated", 7);
|
706
469
|
this.fieldsUpdated = createEvent(this, "fieldsUpdated", 7);
|
470
|
+
this.templateListenerId = null;
|
707
471
|
this.pageHeights = {};
|
708
|
-
this.templateStore = null;
|
709
|
-
this.fieldStore = null;
|
710
|
-
this.roleStore = null;
|
711
472
|
this.cachedPageInfo = {};
|
712
473
|
this.endpoint = VerdocsEndpoint.getDefault();
|
713
474
|
this.templateId = null;
|
@@ -716,9 +477,10 @@ const VerdocsTemplateFields = class {
|
|
716
477
|
this.showMustSelectRole = false;
|
717
478
|
this.selectedRoleName = '';
|
718
479
|
this.loading = true;
|
480
|
+
this.template = null;
|
719
481
|
}
|
720
|
-
onTemplateIdChanged(
|
721
|
-
this.
|
482
|
+
onTemplateIdChanged() {
|
483
|
+
this.listenToTemplate();
|
722
484
|
}
|
723
485
|
// Stop field-placement mode if ESC is pressed
|
724
486
|
handleKeyDown(ev) {
|
@@ -727,7 +489,7 @@ const VerdocsTemplateFields = class {
|
|
727
489
|
}
|
728
490
|
}
|
729
491
|
async componentWillLoad() {
|
730
|
-
var _a, _b, _c
|
492
|
+
var _a, _b, _c;
|
731
493
|
try {
|
732
494
|
this.endpoint.loadSession();
|
733
495
|
if (!this.templateId) {
|
@@ -738,17 +500,11 @@ const VerdocsTemplateFields = class {
|
|
738
500
|
console.log('[FIELDS] Unable to start builder session, must be authenticated');
|
739
501
|
return;
|
740
502
|
}
|
741
|
-
|
742
|
-
this.loadTemplate(this.templateId).catch(e => console.log('[BUILD] Unable to load template', e));
|
743
|
-
}
|
744
|
-
catch (e) {
|
745
|
-
console.log('[FIELDS] Error loading template', e);
|
746
|
-
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
747
|
-
}
|
503
|
+
this.listenToTemplate();
|
748
504
|
}
|
749
505
|
catch (e) {
|
750
506
|
console.log('[FIELDS] Error with fields session', e);
|
751
|
-
(
|
507
|
+
(_a = this.sdkError) === null || _a === void 0 ? void 0 : _a.emit(new SDKError(e.message, (_b = e.response) === null || _b === void 0 ? void 0 : _b.status, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data));
|
752
508
|
}
|
753
509
|
}
|
754
510
|
componentDidRender() {
|
@@ -764,35 +520,40 @@ const VerdocsTemplateFields = class {
|
|
764
520
|
componentWillUpdate() {
|
765
521
|
var _a, _b;
|
766
522
|
// If a new role was added and there were none yet so far, or the "selected" role was deleted, reset our selection
|
767
|
-
const roles = ((_a = this.
|
523
|
+
const roles = ((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || [];
|
768
524
|
if (!this.selectedRoleName || !roles.find(role => role && role.name === this.selectedRoleName)) {
|
769
525
|
this.selectedRoleName = ((_b = roles[0]) === null || _b === void 0 ? void 0 : _b.name) || '';
|
770
526
|
console.log('[FIELDS] Selected new role', this.selectedRoleName);
|
771
527
|
}
|
772
528
|
}
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
this.
|
529
|
+
disconnectedCallback() {
|
530
|
+
this.unlistenToTemplate();
|
531
|
+
}
|
532
|
+
async listenToTemplate() {
|
533
|
+
this.unlistenToTemplate();
|
534
|
+
Store.subscribe('templates', this.templateId, () => getTemplate(this.endpoint, this.templateId), false, (template) => {
|
535
|
+
var _a, _b;
|
536
|
+
this.template = template;
|
781
537
|
this.loading = false;
|
782
|
-
|
783
|
-
|
538
|
+
this.selectedRoleName = ((_b = (_a = template.roles) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name) || '';
|
539
|
+
});
|
540
|
+
}
|
541
|
+
unlistenToTemplate() {
|
542
|
+
if (this.templateListenerId) {
|
543
|
+
Store.store.delListener(this.templateListenerId);
|
544
|
+
this.templateListenerId = null;
|
784
545
|
}
|
785
546
|
}
|
786
547
|
attachFieldAttributes(pageInfo, field, el) {
|
787
548
|
// el.addEventListener('input', e => this.handleFieldChange(field, e));
|
788
549
|
el.addEventListener('settingsChanged', () => {
|
789
|
-
var _a
|
790
|
-
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template:
|
550
|
+
var _a;
|
551
|
+
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: this.template, event: 'added-field' });
|
791
552
|
});
|
792
553
|
el.addEventListener('deleted', () => {
|
793
|
-
var _a
|
554
|
+
var _a;
|
794
555
|
el.remove();
|
795
|
-
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template:
|
556
|
+
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: this.template, event: 'updated-field' });
|
796
557
|
});
|
797
558
|
el.setAttribute('templateid', this.templateId);
|
798
559
|
el.setAttribute('fieldname', field.name);
|
@@ -802,12 +563,12 @@ const VerdocsTemplateFields = class {
|
|
802
563
|
el.setAttribute('name', field.name);
|
803
564
|
}
|
804
565
|
handlePageRendered(e) {
|
566
|
+
var _a;
|
805
567
|
const pageInfo = e.detail;
|
806
568
|
// console.log('[FIELDS] Page rendered', pageInfo.pageNumber, pageInfo.xScale, pageInfo.yScale);
|
807
569
|
this.cachedPageInfo[pageInfo.pageNumber] = pageInfo;
|
808
570
|
this.pageHeights[pageInfo.pageNumber] = pageInfo.naturalHeight;
|
809
|
-
this.
|
810
|
-
.get('fields')
|
571
|
+
(((_a = this.template) === null || _a === void 0 ? void 0 : _a.fields) || [])
|
811
572
|
.filter(field => field && field.page === pageInfo.pageNumber)
|
812
573
|
.forEach(field => {
|
813
574
|
const id = getFieldId(field);
|
@@ -839,10 +600,9 @@ const VerdocsTemplateFields = class {
|
|
839
600
|
updateCssTransform(event.target, 'translate', `${newX}px, ${newY}px`);
|
840
601
|
}
|
841
602
|
async handleMoveEnd(event) {
|
842
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
603
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
843
604
|
const name = event.target.getAttribute('fieldname');
|
844
|
-
const
|
845
|
-
const field = this.fieldStore.get('fields').find(field => field.name === name);
|
605
|
+
const field = (((_a = this.template) === null || _a === void 0 ? void 0 : _a.fields) || []).find(field => field.name === name);
|
846
606
|
if (!field) {
|
847
607
|
console.log('[FIELDS] Unable to find field', name, event.target);
|
848
608
|
return;
|
@@ -858,10 +618,9 @@ const VerdocsTemplateFields = class {
|
|
858
618
|
// (positive displacement) while bottom measures "up" from the bottom (negative displacement).
|
859
619
|
const newX = Math.max(clientRect.left - parentRect.left, 0);
|
860
620
|
let newY = Math.max(renderedHeight - (parentRect.bottom - clientRect.bottom), 0);
|
861
|
-
console.log('drop', { pageNumber, newX, newY });
|
862
621
|
let newPageNumber = parseInt(pageNumber);
|
863
622
|
if (newY > renderedHeight) {
|
864
|
-
newPageNumber = Math.min(newPageNumber + 1, ((_d = (_c = (_b =
|
623
|
+
newPageNumber = Math.min(newPageNumber + 1, ((_d = (_c = (((_b = this.template) === null || _b === void 0 ? void 0 : _b.documents) || [])) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.pages) || 1);
|
865
624
|
newY -= renderedHeight;
|
866
625
|
renderedHeight = this.cachedPageInfo[newPageNumber].renderedHeight;
|
867
626
|
console.log('Next page', { newPageNumber, newY, renderedHeight });
|
@@ -870,38 +629,43 @@ const VerdocsTemplateFields = class {
|
|
870
629
|
newPageNumber = Math.max(newPageNumber - 1, 1);
|
871
630
|
renderedHeight = this.cachedPageInfo[newPageNumber].renderedHeight;
|
872
631
|
newY += renderedHeight;
|
873
|
-
console.log('Next page', { newPageNumber, newY, renderedHeight });
|
632
|
+
console.log('[FIELDS] Next page', { newPageNumber, newY, renderedHeight });
|
874
633
|
}
|
875
634
|
const { x, y } = this.viewCoordinatesToPageCoordinates(newX, newY, pageNumber, naturalWidth - width, naturalHeight - height);
|
876
635
|
try {
|
877
636
|
const params = { x, y, page: newPageNumber };
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
637
|
+
const updatedField = await updateField(this.endpoint, this.templateId, name, params);
|
638
|
+
console.log('[FIELDS] Updated', updatedField);
|
639
|
+
const newTemplate = JSON.parse(JSON.stringify(this.template));
|
640
|
+
const fieldIndex = newTemplate.fields.findIndex(field => field.name === name);
|
641
|
+
if (fieldIndex > -1) {
|
642
|
+
newTemplate.fields[fieldIndex] = updatedField;
|
643
|
+
}
|
644
|
+
Store.updateTemplate(this.templateId, newTemplate);
|
882
645
|
event.target.removeAttribute('posX');
|
883
646
|
event.target.removeAttribute('posY');
|
884
647
|
removeCssTransform(event.target);
|
885
648
|
const { xScale = 1, yScale = 1 } = this.cachedPageInfo[pageNumber];
|
886
|
-
setControlStyles(event.target,
|
887
|
-
(_e = this.templateUpdated) === null || _e === void 0 ? void 0 : _e.emit({ endpoint: this.endpoint, template:
|
649
|
+
setControlStyles(event.target, updatedField, xScale, yScale);
|
650
|
+
(_e = this.templateUpdated) === null || _e === void 0 ? void 0 : _e.emit({ endpoint: this.endpoint, template: newTemplate, event: 'updated-field' });
|
888
651
|
}
|
889
652
|
catch (e) {
|
890
653
|
VerdocsToast('Error updating field, please try again later', { style: 'error' });
|
891
654
|
console.log('[FIELDS] Error updating field', e);
|
892
|
-
(
|
655
|
+
(_f = this.sdkError) === null || _f === void 0 ? void 0 : _f.emit(new SDKError(e.message, (_g = e.response) === null || _g === void 0 ? void 0 : _g.status, (_h = e.response) === null || _h === void 0 ? void 0 : _h.data));
|
893
656
|
event.target.removeAttribute('posX');
|
894
657
|
event.target.removeAttribute('posY');
|
895
658
|
removeCssTransform(event.target);
|
896
659
|
}
|
897
660
|
}
|
898
661
|
generateFieldName(type, pageNumber) {
|
662
|
+
var _a;
|
899
663
|
let i = 1;
|
900
664
|
let fieldName;
|
901
665
|
do {
|
902
666
|
fieldName = `${type}P${pageNumber}-${i}`;
|
903
667
|
i++;
|
904
|
-
} while (this.
|
668
|
+
} while ((((_a = this.template) === null || _a === void 0 ? void 0 : _a.fields) || []).some(field => field && field.name === fieldName));
|
905
669
|
return fieldName;
|
906
670
|
}
|
907
671
|
// Scale the X,Y clicks to the virtual page dimensions. Also ensure the field doesn't go off the page.
|
@@ -912,7 +676,7 @@ const VerdocsTemplateFields = class {
|
|
912
676
|
return { x, y };
|
913
677
|
}
|
914
678
|
async handleClickPage(e, pageNumber) {
|
915
|
-
var _a
|
679
|
+
var _a;
|
916
680
|
if (this.placing) {
|
917
681
|
const clickedX = e.offsetX;
|
918
682
|
const clickedY = e.offsetY;
|
@@ -945,22 +709,24 @@ const VerdocsTemplateFields = class {
|
|
945
709
|
options: this.placing === 'radio' ? [{ id: 'option-1', label: 'Option 1' }] : [],
|
946
710
|
};
|
947
711
|
console.log('[FIELDS] Will save new field', field);
|
948
|
-
const
|
949
|
-
console.log('[FIELDS] Saved field',
|
950
|
-
|
712
|
+
const newField = await createField(this.endpoint, this.templateId, field);
|
713
|
+
console.log('[FIELDS] Saved field', newField);
|
714
|
+
const newTemplate = JSON.parse(JSON.stringify(this.template));
|
715
|
+
newTemplate.fields.push(newField);
|
716
|
+
Store.updateTemplate(this.templateId, newTemplate);
|
717
|
+
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: newTemplate, event: 'added-field' });
|
951
718
|
this.placing = null;
|
952
|
-
(_a = this.templateUpdated) === null || _a === void 0 ? void 0 : _a.emit({ endpoint: this.endpoint, template: (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state, event: 'added-field' });
|
953
719
|
}
|
954
720
|
}
|
955
721
|
render() {
|
956
722
|
var _a, _b, _c;
|
723
|
+
if (this.loading) {
|
724
|
+
return (h(Host, null, h("verdocs-loader", null)));
|
725
|
+
}
|
957
726
|
if (!this.endpoint.session) {
|
958
727
|
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
959
728
|
}
|
960
|
-
|
961
|
-
return (h(Host, null, h("verdocs-loader", null)));
|
962
|
-
}
|
963
|
-
const selectableRoles = this.roleStore.get('roles').map(role => ({ value: role.name, label: role.full_name ? `${role.name}: ${role.full_name}` : role.name }));
|
729
|
+
const selectableRoles = (((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || []).map(role => ({ value: role.name, label: role.full_name ? `${role.name}: ${role.full_name}` : role.name }));
|
964
730
|
return (h(Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, onSubmit: () => { } }, h("div", { id: "verdocs-template-fields-toolbar" }, h("div", { class: "add-for" }, "Add field:"), h("verdocs-select-input", { value: this.selectedRoleName, options: selectableRoles, onInput: (e) => (this.selectedRoleName = e.target.value) }), menuOptions.map(option => (h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, class: option.class, onClick: () => {
|
965
731
|
// We ignore empty-tooltip entries because they're separators
|
966
732
|
if (option.tooltip) {
|
@@ -972,7 +738,7 @@ const VerdocsTemplateFields = class {
|
|
972
738
|
this.showMustSelectRole = true;
|
973
739
|
}
|
974
740
|
}
|
975
|
-
} })))), h("div", { class: "pages" }, (((
|
741
|
+
} })))), h("div", { class: "pages" }, (((_b = this.template) === null || _b === void 0 ? void 0 : _b.documents) || []).map(document => {
|
976
742
|
const pageNumbers = integerSequence(1, document.pages);
|
977
743
|
return pageNumbers.map(page => {
|
978
744
|
const pageSize = document.page_sizes[page];
|
@@ -981,7 +747,7 @@ const VerdocsTemplateFields = class {
|
|
981
747
|
{ name: 'controls', type: 'div' },
|
982
748
|
] }));
|
983
749
|
});
|
984
|
-
})), this.showMustSelectRole && (h("verdocs-ok-dialog", { heading: "Unable to add field", message: this.
|
750
|
+
})), this.showMustSelectRole && (h("verdocs-ok-dialog", { heading: "Unable to add field", message: (((_c = this.template) === null || _c === void 0 ? void 0 : _c.roles) || []).length > 0 ? 'Please select a role before adding fields.' : 'Please add at least one role before adding fields.', onNext: () => (this.showMustSelectRole = false) }))));
|
985
751
|
}
|
986
752
|
static get watchers() { return {
|
987
753
|
"templateId": ["onTemplateIdChanged"]
|
@@ -989,85 +755,13 @@ const VerdocsTemplateFields = class {
|
|
989
755
|
};
|
990
756
|
VerdocsTemplateFields.style = VerdocsTemplateFieldsStyle0;
|
991
757
|
|
992
|
-
const verdocsTemplateNameCss = "";
|
993
|
-
const VerdocsTemplateNameStyle0 = verdocsTemplateNameCss;
|
994
|
-
|
995
|
-
const VerdocsTemplateName = class {
|
996
|
-
constructor(hostRef) {
|
997
|
-
registerInstance(this, hostRef);
|
998
|
-
this.close = createEvent(this, "close", 7);
|
999
|
-
this.sdkError = createEvent(this, "sdkError", 7);
|
1000
|
-
this.templateUpdated = createEvent(this, "templateUpdated", 7);
|
1001
|
-
this.store = null;
|
1002
|
-
this.endpoint = VerdocsEndpoint.getDefault();
|
1003
|
-
this.templateId = '';
|
1004
|
-
this.name = '';
|
1005
|
-
this.dirty = false;
|
1006
|
-
}
|
1007
|
-
async componentWillLoad() {
|
1008
|
-
var _a, _b, _c, _d, _e;
|
1009
|
-
try {
|
1010
|
-
this.endpoint.loadSession();
|
1011
|
-
if (!this.templateId) {
|
1012
|
-
console.log(`[ROLES] Missing required template ID ${this.templateId}`);
|
1013
|
-
return;
|
1014
|
-
}
|
1015
|
-
if (!this.endpoint.session) {
|
1016
|
-
console.log('[ROLES] Unable to start builder session, must be authenticated');
|
1017
|
-
return;
|
1018
|
-
}
|
1019
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
1020
|
-
this.name = (_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.name;
|
1021
|
-
this.dirty = false;
|
1022
|
-
}
|
1023
|
-
catch (e) {
|
1024
|
-
console.log('[TEMPLATE NAME] Error loading template', e);
|
1025
|
-
(_c = this.sdkError) === null || _c === void 0 ? void 0 : _c.emit(new SDKError(e.message, (_d = e.response) === null || _d === void 0 ? void 0 : _d.status, (_e = e.response) === null || _e === void 0 ? void 0 : _e.data));
|
1026
|
-
}
|
1027
|
-
}
|
1028
|
-
handleCancel(e) {
|
1029
|
-
var _a, _b, _c;
|
1030
|
-
e.stopPropagation();
|
1031
|
-
this.name = (_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.name;
|
1032
|
-
this.dirty = false;
|
1033
|
-
console.log('Closing');
|
1034
|
-
(_c = this.close) === null || _c === void 0 ? void 0 : _c.emit();
|
1035
|
-
}
|
1036
|
-
async handleSave(e) {
|
1037
|
-
var _a, _b, _c;
|
1038
|
-
e.stopPropagation();
|
1039
|
-
await updateTemplate(this.endpoint, this.templateId, { name: this.name });
|
1040
|
-
if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.state) {
|
1041
|
-
this.store.state.name = this.name;
|
1042
|
-
}
|
1043
|
-
this.dirty = false;
|
1044
|
-
(_b = this.templateUpdated) === null || _b === void 0 ? void 0 : _b.emit({ endpoint: this.endpoint, template: this.store.state, event: 'name' });
|
1045
|
-
(_c = this.close) === null || _c === void 0 ? void 0 : _c.emit();
|
1046
|
-
}
|
1047
|
-
render() {
|
1048
|
-
var _a, _b;
|
1049
|
-
if (!this.endpoint.session) {
|
1050
|
-
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
1051
|
-
}
|
1052
|
-
if ((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.isLoading) {
|
1053
|
-
return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
|
1054
|
-
}
|
1055
|
-
return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("label", { htmlFor: "verdocs-template-name" }, "Template Name"), h("verdocs-text-input", { id: "verdocs-template-name", value: this.name, autocomplete: "off", placeholder: "Template Name...", onInput: (e) => {
|
1056
|
-
var _a, _b;
|
1057
|
-
this.name = e.target.value;
|
1058
|
-
this.dirty = this.name !== ((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.name);
|
1059
|
-
} }), h("div", { class: "buttons" }, h("verdocs-button", { size: "small", variant: "outline", label: "Cancel", disabled: !this.dirty, onClick: e => this.handleCancel(e) }), h("verdocs-button", { size: "small", label: "Save", disabled: !this.dirty, onClick: e => this.handleSave(e) })))));
|
1060
|
-
}
|
1061
|
-
};
|
1062
|
-
VerdocsTemplateName.style = VerdocsTemplateNameStyle0;
|
1063
|
-
|
1064
758
|
const verdocsTemplateRolesCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;min-width:400px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-top:0;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 15px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:rgba(101, 77, 203, 0.4980392157);border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:rgba(101, 77, 203, 0.4980392157);-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}";
|
1065
759
|
const VerdocsTemplateRolesStyle0 = verdocsTemplateRolesCss;
|
1066
760
|
|
1067
|
-
const senderLabels = {
|
1068
|
-
|
1069
|
-
|
1070
|
-
};
|
761
|
+
// const senderLabels: Record<TTemplateSender, string> = {
|
762
|
+
// template_owner: 'Template Owner',
|
763
|
+
// envelope_creator: 'Envelope Creator',
|
764
|
+
// };
|
1071
765
|
const settingsIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';
|
1072
766
|
const startIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';
|
1073
767
|
const stepIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';
|
@@ -1083,13 +777,31 @@ const VerdocsTemplateRoles = class {
|
|
1083
777
|
this.exit = createEvent(this, "exit", 7);
|
1084
778
|
this.sdkError = createEvent(this, "sdkError", 7);
|
1085
779
|
this.rolesUpdated = createEvent(this, "rolesUpdated", 7);
|
1086
|
-
this.
|
1087
|
-
this.roleStore = null;
|
780
|
+
this.templateListenerId = null;
|
1088
781
|
this.endpoint = VerdocsEndpoint.getDefault();
|
1089
782
|
this.templateId = '';
|
1090
783
|
this.showingRoleDialog = null;
|
1091
784
|
this.sender = null;
|
1092
785
|
this.loading = true;
|
786
|
+
this.template = null;
|
787
|
+
}
|
788
|
+
disconnectedCallback() {
|
789
|
+
this.unlistenToTemplate();
|
790
|
+
}
|
791
|
+
async listenToTemplate() {
|
792
|
+
console.log('[ROLES] Loading template', this.templateId);
|
793
|
+
this.unlistenToTemplate();
|
794
|
+
Store.subscribe('templates', this.templateId, () => getTemplate(this.endpoint, this.templateId), false, (template) => {
|
795
|
+
console.log('[BUILD] Template Updated', template);
|
796
|
+
this.template = template;
|
797
|
+
this.loading = false;
|
798
|
+
});
|
799
|
+
}
|
800
|
+
unlistenToTemplate() {
|
801
|
+
if (this.templateListenerId) {
|
802
|
+
Store.store.delListener(this.templateListenerId);
|
803
|
+
this.templateListenerId = null;
|
804
|
+
}
|
1093
805
|
}
|
1094
806
|
async componentWillLoad() {
|
1095
807
|
var _a, _b, _c;
|
@@ -1103,18 +815,7 @@ const VerdocsTemplateRoles = class {
|
|
1103
815
|
console.log('[ROLES] Unable to start builder session, must be authenticated');
|
1104
816
|
return;
|
1105
817
|
}
|
1106
|
-
|
1107
|
-
.then(ts => {
|
1108
|
-
this.templateStore = ts;
|
1109
|
-
this.roleStore = getTemplateRoleStore(this.templateId);
|
1110
|
-
this.loading = false;
|
1111
|
-
this.roleStore.onChange('roles', roles => {
|
1112
|
-
var _a;
|
1113
|
-
console.log('[ROLES] Roles changed', { roles });
|
1114
|
-
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles });
|
1115
|
-
});
|
1116
|
-
})
|
1117
|
-
.catch(e => console.warn(e));
|
818
|
+
this.listenToTemplate();
|
1118
819
|
}
|
1119
820
|
catch (e) {
|
1120
821
|
console.log('[FIELDS] Error with preview session', e);
|
@@ -1158,12 +859,8 @@ const VerdocsTemplateRoles = class {
|
|
1158
859
|
overlap: 0.05,
|
1159
860
|
ondrop: async function onDrop(event) {
|
1160
861
|
var _a;
|
1161
|
-
console.log('dropped', event.target.classList);
|
1162
862
|
event.target.classList.remove('active');
|
1163
|
-
|
1164
|
-
const targetSequence = +event.target.dataset.sequence;
|
1165
|
-
const targetOrder = +event.target.dataset.order;
|
1166
|
-
updateStoreRole(this.roleStore, roleName, { sequence: targetSequence, order: targetOrder });
|
863
|
+
// This will re-sort the roles and renumbers them via server calls if necessary
|
1167
864
|
await this.renumberTemplateRoles();
|
1168
865
|
console.log('[ROLES] Updated roles', this.getSortedRoles());
|
1169
866
|
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
@@ -1191,7 +888,10 @@ const VerdocsTemplateRoles = class {
|
|
1191
888
|
(_a = this.next) === null || _a === void 0 ? void 0 : _a.emit();
|
1192
889
|
}
|
1193
890
|
getSortedRoles() {
|
1194
|
-
|
891
|
+
var _a;
|
892
|
+
// NOTE: This mutates the source array but that's OK because everything that touches
|
893
|
+
// it will want the same thing done.
|
894
|
+
return (((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || []).sort((a, b) => {
|
1195
895
|
return a.sequence === b.sequence ? a.order - b.order : a.sequence - b.sequence;
|
1196
896
|
});
|
1197
897
|
}
|
@@ -1209,14 +909,15 @@ const VerdocsTemplateRoles = class {
|
|
1209
909
|
return roles.map(role => role.name);
|
1210
910
|
}
|
1211
911
|
getRolesAtSequence(sequence) {
|
912
|
+
var _a;
|
1212
913
|
// Entries can be undefined when deleted because Stencil has no remove() operator yet for stores.
|
1213
914
|
// See https://github.com/ionic-team/stencil-store/issues/23
|
1214
|
-
return this.
|
915
|
+
return (((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || []).filter(role => role && role.sequence === sequence);
|
1215
916
|
}
|
1216
917
|
// When the user drags a role around, we handle placement "between" items by assigning it a half-order number
|
1217
918
|
// e.g. 1.5 to place it between items 1 and 2, 0.5 to place it at the beginning, or last+0.5 to place it at the end.
|
1218
919
|
// Then we re-sort the list of roles and renumber them.
|
1219
|
-
renumberTemplateRoles() {
|
920
|
+
async renumberTemplateRoles() {
|
1220
921
|
// console.log('Renumbering roles', this.getSequenceNumbers(), JSON.stringify(this.roleStore.state));
|
1221
922
|
// Avoid dupe renumber attempts
|
1222
923
|
const renumbered = [];
|
@@ -1229,24 +930,30 @@ const VerdocsTemplateRoles = class {
|
|
1229
930
|
role.sequence = newSequenceIndex + 1;
|
1230
931
|
role.order = newOrderIndex + 1;
|
1231
932
|
renumbered.push(role.name);
|
1232
|
-
renumberRequests.push(updateTemplateRole(this.endpoint, this.templateId, role.name, {
|
1233
|
-
sequence: role.sequence,
|
1234
|
-
order: role.order,
|
1235
|
-
}));
|
933
|
+
renumberRequests.push(updateTemplateRole(this.endpoint, this.templateId, role.name, { sequence: role.sequence, order: role.order }));
|
1236
934
|
}
|
1237
935
|
}
|
1238
936
|
});
|
1239
937
|
});
|
1240
|
-
|
938
|
+
if (renumberRequests.length > 0) {
|
939
|
+
console.log(`[ROLES] Submitting ${renumberRequests.length} renumber requests`);
|
940
|
+
return Promise.all(renumberRequests).then(async () => {
|
941
|
+
// When renumbering, we don't try to update the store for every individual item
|
942
|
+
// changing. We just do it once at the end.
|
943
|
+
this.template = await Store.getTemplate(this.endpoint, this.templateId, true);
|
944
|
+
});
|
945
|
+
}
|
946
|
+
return true;
|
1241
947
|
}
|
1242
948
|
// Look for name conflicts, because they're UGC and can be anything, regardless of order.
|
1243
949
|
getNextRoleName() {
|
950
|
+
var _a, _b;
|
1244
951
|
let name = '';
|
1245
|
-
let nextNumber =
|
952
|
+
let nextNumber = (((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || []).length;
|
1246
953
|
do {
|
1247
954
|
nextNumber++;
|
1248
955
|
name = `Recipient ${nextNumber}`;
|
1249
|
-
} while (!name || this.
|
956
|
+
} while (!name || (((_b = this.template) === null || _b === void 0 ? void 0 : _b.roles) || []).some(role => role && role.name === name));
|
1250
957
|
return name;
|
1251
958
|
}
|
1252
959
|
callCreateRole(name, sequence, order) {
|
@@ -1266,10 +973,15 @@ const VerdocsTemplateRoles = class {
|
|
1266
973
|
delegator: false,
|
1267
974
|
kba_method: null,
|
1268
975
|
})
|
1269
|
-
.then(async (
|
976
|
+
.then(async (role) => {
|
1270
977
|
var _a;
|
1271
|
-
console.log('[ROLES] Created role',
|
1272
|
-
|
978
|
+
console.log('[ROLES] Created role', role);
|
979
|
+
const newTemplate = JSON.parse(JSON.stringify(this.template));
|
980
|
+
newTemplate.roles.push(role);
|
981
|
+
// TODO: Verify this immediately triggers a self-update
|
982
|
+
console.log('Updating template in data store');
|
983
|
+
Store.updateTemplate(this.templateId, newTemplate);
|
984
|
+
// This will re-sort the roles and renumbers them via server calls if necessary
|
1273
985
|
await this.renumberTemplateRoles();
|
1274
986
|
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'added', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
1275
987
|
})
|
@@ -1290,25 +1002,23 @@ const VerdocsTemplateRoles = class {
|
|
1290
1002
|
this.callCreateRole(name, sequence, order);
|
1291
1003
|
}
|
1292
1004
|
render() {
|
1293
|
-
var _a, _b, _c, _d;
|
1294
1005
|
if (!this.endpoint.session) {
|
1295
1006
|
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
1296
1007
|
}
|
1297
|
-
if (this.loading || !
|
1298
|
-
console.log('Loading', this.loading, (_b = this.templateStore) === null || _b === void 0 ? void 0 : _b.state.isLoaded);
|
1008
|
+
if (this.loading || !this.template) {
|
1299
1009
|
return (h(Host, { class: "loading" }, h("verdocs-loader", null)));
|
1300
1010
|
}
|
1301
1011
|
const roleNames = this.getRoleNames();
|
1302
1012
|
const sequences = this.getSequenceNumbers();
|
1303
|
-
return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-roles" }, h("div", { class: "sender" }, h("span", { class: "label" }, "
|
1013
|
+
return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Roles and Workflow"), h("div", { class: "participants" }, h("div", { class: "left-line" }), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: startIcon }), h("div", { class: "row-roles" }, h("div", { class: "sender" }, h("span", { class: "label" }, "Send Envelope")))), h("div", { class: "row add-sequence", "data-sequence": 0 }, h("div", { class: "icon", innerHTML: plusIcon }), h("div", { class: "row-roles" }, h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (h(Fragment, null, h("div", { class: "row" }, h("div", { class: "icon", innerHTML: stepIcon }), h("div", { class: "row-roles" }, h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
|
1304
1014
|
const unknown = !role.email;
|
1305
|
-
|
1306
|
-
return unknown ? (h(Fragment, null, h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.name, " ", h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence }))) : (h(Fragment, null, h("div", { class: "recipient", style: { borderColor: getRGBA(getRoleIndex(this.roleStore, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), formatFullName(role), " ", h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence })));
|
1015
|
+
return unknown ? (h(Fragment, null, h("div", { class: "recipient", style: { backgroundColor: getRGBA(getRoleIndex(this.template, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.name, " ", h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence }))) : (h(Fragment, null, h("div", { class: "recipient", style: { borderColor: getRGBA(getRoleIndex(this.template, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), formatFullName(role), " ", h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence })));
|
1307
1016
|
}), h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), sequences.length > 0 && (h("div", { class: "row add-sequence", "data-sequence": sequence }, h("div", { class: "row-roles" }, h("div", { class: "icon", innerHTML: plusIcon }), h("div", { class: "dropzone", "data-sequence": sequence + 1, "data-order": 1 }, "Add Step"))))))), h("div", { class: "row", "data-sequence": sequences.length + 1 }, h("div", { class: "row-roles" }, h("div", { class: "icon", innerHTML: plusIcon }), h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, sequences.length + 1) }))), h("div", { class: "row" }, h("div", { class: "icon", innerHTML: doneIcon }), h("div", { class: "row-roles" }, h("div", { class: "complete" }, "Document Complete")))), roleNames.length < 1 && (h("div", { class: "empty" }, "You must add at least one Role before proceeding.", h("br", null), " Click the ", h("span", { innerHTML: plusIcon }), " Add button above to get started.")), h("div", { class: "buttons" }, h("div", { class: "flex-fill" }), h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
|
1308
1017
|
this.showingRoleDialog = null;
|
1309
1018
|
}, onDelete: async () => {
|
1310
1019
|
var _a;
|
1311
1020
|
this.showingRoleDialog = null;
|
1021
|
+
// This will re-sort the roles and renumbers them via server calls if necessary
|
1312
1022
|
await this.renumberTemplateRoles();
|
1313
1023
|
(_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
|
1314
1024
|
} }))));
|
@@ -1317,82 +1027,4 @@ const VerdocsTemplateRoles = class {
|
|
1317
1027
|
};
|
1318
1028
|
VerdocsTemplateRoles.style = VerdocsTemplateRolesStyle0;
|
1319
1029
|
|
1320
|
-
|
1321
|
-
const VerdocsTemplateVisibilityStyle0 = verdocsTemplateVisibilityCss;
|
1322
|
-
|
1323
|
-
const VerdocsTemplateVisibility = class {
|
1324
|
-
constructor(hostRef) {
|
1325
|
-
registerInstance(this, hostRef);
|
1326
|
-
this.close = createEvent(this, "close", 7);
|
1327
|
-
this.sdkError = createEvent(this, "sdkError", 7);
|
1328
|
-
this.templateUpdated = createEvent(this, "templateUpdated", 7);
|
1329
|
-
this.store = null;
|
1330
|
-
this.endpoint = VerdocsEndpoint.getDefault();
|
1331
|
-
this.templateId = '';
|
1332
|
-
this.dirty = false;
|
1333
|
-
this.personal = false;
|
1334
|
-
this.public = false;
|
1335
|
-
}
|
1336
|
-
async componentWillLoad() {
|
1337
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
1338
|
-
try {
|
1339
|
-
this.endpoint.loadSession();
|
1340
|
-
if (!this.templateId) {
|
1341
|
-
console.log(`[VISIBILITY] Missing required template ID ${this.templateId}`);
|
1342
|
-
return;
|
1343
|
-
}
|
1344
|
-
if (!this.endpoint.session) {
|
1345
|
-
console.log('[VISIBILITY] Unable to start builder session, must be authenticated');
|
1346
|
-
return;
|
1347
|
-
}
|
1348
|
-
this.store = await getTemplateStore(this.endpoint, this.templateId, false);
|
1349
|
-
this.personal = ((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_personal) || true;
|
1350
|
-
this.public = ((_d = (_c = this.store) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.is_public) || false;
|
1351
|
-
this.dirty = false;
|
1352
|
-
}
|
1353
|
-
catch (e) {
|
1354
|
-
console.log('[TEMPLATE VISIBILITY] Error loading template', e);
|
1355
|
-
(_e = this.sdkError) === null || _e === void 0 ? void 0 : _e.emit(new SDKError(e.message, (_f = e.response) === null || _f === void 0 ? void 0 : _f.status, (_g = e.response) === null || _g === void 0 ? void 0 : _g.data));
|
1356
|
-
}
|
1357
|
-
}
|
1358
|
-
handleCancel(e) {
|
1359
|
-
var _a, _b, _c, _d, _e;
|
1360
|
-
e.stopPropagation();
|
1361
|
-
this.personal = (_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.is_personal;
|
1362
|
-
this.public = (_d = (_c = this.store) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.is_public;
|
1363
|
-
this.dirty = false;
|
1364
|
-
(_e = this.close) === null || _e === void 0 ? void 0 : _e.emit();
|
1365
|
-
}
|
1366
|
-
async handleSave(e) {
|
1367
|
-
var _a, _b, _c;
|
1368
|
-
e.stopPropagation();
|
1369
|
-
await updateTemplate(this.endpoint, this.templateId, { is_personal: this.personal, is_public: this.public });
|
1370
|
-
if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.state) {
|
1371
|
-
this.store.state.is_personal = this.personal;
|
1372
|
-
this.store.state.is_public = this.public;
|
1373
|
-
}
|
1374
|
-
this.dirty = false;
|
1375
|
-
(_b = this.templateUpdated) === null || _b === void 0 ? void 0 : _b.emit({ endpoint: this.endpoint, template: this.store.state, event: 'visibility' });
|
1376
|
-
(_c = this.close) === null || _c === void 0 ? void 0 : _c.emit();
|
1377
|
-
}
|
1378
|
-
render() {
|
1379
|
-
var _a, _b;
|
1380
|
-
if (!this.endpoint.session) {
|
1381
|
-
return (h(Host, null, h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
|
1382
|
-
}
|
1383
|
-
// This is meant to be a companion for larger visual experiences so we just go blank on errors for now.
|
1384
|
-
if (!this.endpoint.session || !((_b = (_a = this.store) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.isLoaded)) {
|
1385
|
-
return h(Host, { class: "empty" });
|
1386
|
-
}
|
1387
|
-
return (h(Host, null, h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, h("h5", null, "Visibility"), h("div", { class: "input-row" }, h("label", { htmlFor: "verdocs-is-shared" }, "Shared"), h("verdocs-checkbox", { id: "verdocs-is-shared", name: "is-shared", checked: !this.personal, value: "on", onInput: (e) => {
|
1388
|
-
this.personal = !e.target.checked;
|
1389
|
-
this.dirty = true;
|
1390
|
-
} })), h("div", { class: "description" }, "Shared templates are visible to other members of your Organization (if any)."), h("div", { class: "input-row" }, h("label", { htmlFor: "verdocs-is-public" }, "Public"), h("verdocs-checkbox", { id: "verdocs-is-public", name: "is-public", checked: this.public, value: "on", onInput: (e) => {
|
1391
|
-
this.public = e.target.checked;
|
1392
|
-
this.dirty = true;
|
1393
|
-
} })), h("div", { class: "description" }, "Public templates may appear in results when any other user searches for templates. Note that a template may be both Personal and Public, which may be useful if you want your template to be found via search but not otherwise displayed to other members of your Organization (if any)."), h("div", { class: "buttons" }, h("verdocs-button", { size: "small", variant: "outline", label: "Cancel", disabled: !this.dirty, onClick: e => this.handleCancel(e) }), h("verdocs-button", { size: "small", label: "Save", disabled: !this.dirty, onClick: e => this.handleSave(e) })))));
|
1394
|
-
}
|
1395
|
-
};
|
1396
|
-
VerdocsTemplateVisibility.style = VerdocsTemplateVisibilityStyle0;
|
1397
|
-
|
1398
|
-
export { VerdocsPreview as verdocs_preview, VerdocsSend as verdocs_send, VerdocsTemplateAttachments as verdocs_template_attachments, VerdocsTemplateBuildTabs as verdocs_template_build_tabs, VerdocsTemplateCreate as verdocs_template_create, VerdocsTemplateFields as verdocs_template_fields, VerdocsTemplateName as verdocs_template_name, VerdocsTemplateRoles as verdocs_template_roles, VerdocsTemplateVisibility as verdocs_template_visibility };
|
1030
|
+
export { VerdocsPreview as verdocs_preview, VerdocsSend as verdocs_send, VerdocsTemplateBuildTabs as verdocs_template_build_tabs, VerdocsTemplateFields as verdocs_template_fields, VerdocsTemplateRoles as verdocs_template_roles };
|