@verdocs/web-sdk 6.13.1 → 6.13.2
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/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js +13 -4
- package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +10 -6
- package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +3 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +10 -6
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +4 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.js +36 -4
- package/dist/collection/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.js.map +1 -1
- package/dist/components/{p-BTrjJycH.js → p-06em1_P-.js} +2 -2
- package/dist/components/{p-VqyGWtIp.js → p-Blr31TcJ.js} +2 -2
- package/dist/components/p-Blr31TcJ.js.map +1 -0
- package/dist/components/p-D495hZfr.js +2 -0
- package/dist/components/p-D495hZfr.js.map +1 -0
- package/dist/components/verdocs-build.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign-footer.js +1 -1
- package/dist/components/verdocs-sign.js +1 -1
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-download-dialog_4.entry.js +13 -4
- package/dist/esm/verdocs-download-dialog_4.entry.js.map +1 -1
- package/dist/esm/verdocs-preview_6.entry.js +10 -6
- package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm/verdocs-sign.entry.js +3 -1
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-download-dialog_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-download-dialog_4.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +2 -2
- package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +1 -0
- package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +1 -0
- package/dist/types/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.d.ts +4 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/verdocs-web-sdk/{p-f3924e9e.entry.js → p-1b818cdf.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-1b818cdf.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-575b6f98.system.entry.js → p-24dcc54e.system.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-24dcc54e.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-935267a6.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-935267a6.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-BdZ5Ghsa.system.js +1 -1
- package/dist/verdocs-web-sdk/p-a9899fce.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-a9899fce.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-2e382167.entry.js → p-ea6c0b55.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-ea6c0b55.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-3f9102c4.system.entry.js → p-eccac670.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-eccac670.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +3 -3
- package/dist/components/p-E2hWLZ47.js +0 -2
- package/dist/components/p-E2hWLZ47.js.map +0 -1
- package/dist/components/p-VqyGWtIp.js.map +0 -1
- package/dist/verdocs-web-sdk/p-2e382167.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-3f9102c4.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-575b6f98.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-957e4cb0.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-957e4cb0.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-f3924e9e.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-f41af68e.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-f41af68e.system.entry.js.map +0 -1
- /package/dist/components/{p-BTrjJycH.js.map → p-06em1_P-.js.map} +0 -0
|
@@ -24,6 +24,10 @@ export class VerdocsSignFooter {
|
|
|
24
24
|
* If the recipient is "done," some buttons will be hidden.
|
|
25
25
|
*/
|
|
26
26
|
this.isDone = false;
|
|
27
|
+
/**
|
|
28
|
+
* The envelope's brand, if any.
|
|
29
|
+
*/
|
|
30
|
+
this.brand = null;
|
|
27
31
|
/**
|
|
28
32
|
* Event fired when the envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.
|
|
29
33
|
*/
|
|
@@ -136,11 +140,16 @@ export class VerdocsSignFooter {
|
|
|
136
140
|
// }
|
|
137
141
|
// }
|
|
138
142
|
render() {
|
|
139
|
-
var _a, _b, _c, _d, _e, _f
|
|
140
|
-
const
|
|
141
|
-
const
|
|
143
|
+
var _a, _b, _c, _d, _e, _f;
|
|
144
|
+
const org = (_a = this.envelope) === null || _a === void 0 ? void 0 : _a.organization;
|
|
145
|
+
const poweredByLabel = ((_b = this.brand) === null || _b === void 0 ? void 0 : _b.powered_by_label) || (org === null || org === void 0 ? void 0 : org.powered_by_label);
|
|
146
|
+
const poweredByUrl = ((_c = this.brand) === null || _c === void 0 ? void 0 : _c.powered_by_label) ? (_d = this.brand) === null || _d === void 0 ? void 0 : _d.powered_by_url : org === null || org === void 0 ? void 0 : org.powered_by_url;
|
|
147
|
+
const termsUrl = ((_e = this.brand) === null || _e === void 0 ? void 0 : _e.terms_use_url) || (org === null || org === void 0 ? void 0 : org.terms_use_url);
|
|
148
|
+
const privacyUrl = ((_f = this.brand) === null || _f === void 0 ? void 0 : _f.privacy_policy_url) || (org === null || org === void 0 ? void 0 : org.privacy_policy_url);
|
|
149
|
+
const hasPoweredBy = !!poweredByLabel;
|
|
150
|
+
const hasLinks = !!termsUrl || !!privacyUrl;
|
|
142
151
|
const hasButtons = !this.isDone;
|
|
143
|
-
return (h(Host, { key: '
|
|
152
|
+
return (h(Host, { key: '91d822a2405449adbfb2cce4c87a4086958e4e79', class: { 'has-buttons': hasButtons, 'no-buttons': !hasButtons, 'has-powered-by': hasPoweredBy, 'has-links': hasLinks, 'just-buttons': !hasPoweredBy && !hasLinks } }, poweredByLabel && (h("div", { key: '5f856e6ba57091e30e455657fb304c6718d9b80c', class: "powered-by" }, poweredByUrl ? (h("a", { href: poweredByUrl, target: "_blank", rel: "noopener noreferrer" }, h("span", null, poweredByLabel))) : (h("span", null, poweredByLabel)))), !this.isDone && (h("div", { key: 'a9090f99ebc82d1b6602e52edd6d92f8eb94efcc', class: "buttons" }, h("button", { key: '08c7596ba10f3240dd29dc9d30f92ea3d6e4b0c3', onClick: () => (this.askingQuestion = true) }, h("span", { key: '19ba5c915fab3c7e38598f0cf90b1a8c82cc86d8', innerHTML: QuestionIcon }), "Ask Sender a Question"), h("button", { key: '12189b38952064e2a65e6c28f7a5f95d75f12ba7', onClick: () => { var _a; return (_a = this.decline) === null || _a === void 0 ? void 0 : _a.emit(); } }, h("span", { key: 'a5df4760b465ad3c8be1cec7ddbc8d4c88dfa3e2', innerHTML: DeclineIcon }), "Decline Signing"), h("button", { key: 'dfd2079149f39c688bd535474ed2a5d86b9be75d', onClick: () => { var _a; return (_a = this.finishLater) === null || _a === void 0 ? void 0 : _a.emit(); } }, h("span", { key: '35da50d7a9dd7fdf9d0748248cc1a5d98b9d3d11', innerHTML: SaveIcon }), "Finish Later"))), h("div", { key: '7d50e834619ee75a6651d8dc8a0f8e2bcc3c17ad', class: "links" }, termsUrl && (h("a", { key: '02fb19b915a6c22156a91001e90941219efc529c', href: termsUrl, target: "_blank", rel: "noopener noreferrer" }, h("span", { key: '752ca1e97fd782fdefe6fdd0d1b2831ea54ca80c' }, "Terms of Use"))), privacyUrl && (h("a", { key: 'd27725658461073751f76b7c33e76df527b6ea7c', href: privacyUrl, target: "_blank", rel: "noopener noreferrer" }, h("span", { key: '1e7ef9f0a9e88a877bb432b8bf5e4311b759d651' }, "Privacy Policy")))), this.askingQuestion && (h("verdocs-question-dialog", { key: 'c2ceb8bd5237792f3ef42f919bd837c11dff9a12', onNext: e => {
|
|
144
153
|
var _a;
|
|
145
154
|
(_a = this.askQuestion) === null || _a === void 0 ? void 0 : _a.emit({ question: e.detail.question });
|
|
146
155
|
this.askingQuestion = false;
|
|
@@ -223,6 +232,29 @@ export class VerdocsSignFooter {
|
|
|
223
232
|
"reflect": false,
|
|
224
233
|
"attribute": "is-done",
|
|
225
234
|
"defaultValue": "false"
|
|
235
|
+
},
|
|
236
|
+
"brand": {
|
|
237
|
+
"type": "unknown",
|
|
238
|
+
"mutable": false,
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "Record<string, any> | null",
|
|
241
|
+
"resolved": "any | string",
|
|
242
|
+
"references": {
|
|
243
|
+
"Record": {
|
|
244
|
+
"location": "global",
|
|
245
|
+
"id": "global::Record"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"required": false,
|
|
250
|
+
"optional": false,
|
|
251
|
+
"docs": {
|
|
252
|
+
"tags": [],
|
|
253
|
+
"text": "The envelope's brand, if any."
|
|
254
|
+
},
|
|
255
|
+
"getter": false,
|
|
256
|
+
"setter": false,
|
|
257
|
+
"defaultValue": "null"
|
|
226
258
|
}
|
|
227
259
|
};
|
|
228
260
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdocs-sign-footer.js","sourceRoot":"","sources":["../../../../src/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.tsx"],"names":[],"mappings":"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","sourcesContent":["import {IEnvelope} from '@verdocs/js-sdk';\nimport {Component, h, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {getEnvelope, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst QuestionIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z\" fill=\"#424242\"/></svg>`;\nconst DeclineIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M7.14645 7.14645C7.34171 6.95118 7.65829 6.95118 7.85355 7.14645L10 9.29289L12.1464 7.14645C12.3417 6.95118 12.6583 6.95118 12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L10.7071 10L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L10 10.7071L7.85355 12.8536C7.65829 13.0488 7.34171 13.0488 7.14645 12.8536C6.95118 12.6583 6.95118 12.3417 7.14645 12.1464L9.29289 10L7.14645 7.85355C6.95118 7.65829 6.95118 7.34171 7.14645 7.14645ZM3 6C3 4.34315 4.34315 3 6 3H14C15.6569 3 17 4.34315 17 6V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6ZM6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V6C16 4.89543 15.1046 4 14 4H6Z\" fill=\"#424242\"/></svg>`;\nconst SaveIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 5C3 3.89543 3.89543 3 5 3H13.3787C13.9091 3 14.4178 3.21071 14.7929 3.58579L16.4142 5.20711C16.7893 5.58218 17 6.09089 17 6.62132V15C17 16.1046 16.1046 17 15 17H5C3.89543 17 3 16.1046 3 15V5ZM5 4C4.44772 4 4 4.44772 4 5V15C4 15.5523 4.44772 16 5 16L5 11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V16C15.5523 16 16 15.5523 16 15V6.62132C16 6.3561 15.8946 6.10175 15.7071 5.91421L14.0858 4.29289C13.8983 4.10536 13.6439 4 13.3787 4L13 4V6.5C13 7.32843 12.3284 8 11.5 8L7.5 8C6.67157 8 6 7.32843 6 6.5L6 4H5ZM7 4L7 6.5C7 6.77614 7.22386 7 7.5 7L11.5 7C11.7761 7 12 6.77614 12 6.5V4L7 4ZM14 16V11.5C14 11.2239 13.7761 11 13.5 11H6.5C6.22386 11 6 11.2239 6 11.5V16H14Z\" fill=\"#424242\"/></svg>`;\n\n/**\n * Typically presented by the `verdocs-sign` component. Displays a footer toolbar\n * with a few convenience functions for the envelope recipient to use.\n */\n@Component({\n tag: 'verdocs-sign-footer',\n styleUrl: 'verdocs-sign-footer.scss',\n shadow: false,\n})\nexport class VerdocsSignFooter {\n private envelopeListenerId = null;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The envelope ID to render. Set ONE OF templateId or envelopeId. If both are set, envelopeId will be ignored.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * If the recipient is \"done,\" some buttons will be hidden.\n */\n @Prop() isDone = false;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) askQuestion: EventEmitter<{question: string}>;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) decline: EventEmitter;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) finishLater: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n // @Event({composed: true}) envelopeUpdated: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}>;\n\n @State() askingQuestion = false;\n @State() declinine = false;\n @State() envelope: IEnvelope | null = null;\n\n async componentWillLoad() {\n try {\n // NOTE: The caller must have a signing session already active and shared to us via\n // the endpoint property.\n if (!this.envelopeId) {\n console.log(`[FOOTER] Missing required envelope ID ${this.envelopeId}`);\n return;\n }\n\n this.listenToEnvelope();\n } catch (e) {\n console.log('[FOOTER] Error loading envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[FOOTER] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n false,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n // handleRecipientAction(recipient: IRecipient, id: string) {\n // console.log('[SIDEBAR] Recipient action', id, recipient);\n // switch (id) {\n // case 'update':\n // this.showUpdateDialog = recipient.role_name;\n // break;\n //\n // case 'reminder':\n // remindRecipient(this.endpoint, this.envelopeId, recipient.role_name)\n // .then(() => {\n // VerdocsToast('Reminder Sent', {style: 'success'});\n // })\n // .catch(e => {\n // console.log('[SIDEBAR] Error resending invitation', e);\n // VerdocsToast('Error resending invitation: ' + e.message, {style: 'error'});\n // });\n // break;\n //\n // case 'reinvite':\n // this.showReinviteDialog = recipient.role_name;\n // break;\n //\n // case 'inperson':\n // this.showRecipientDialog = recipient.role_name;\n // break;\n //\n // case 'modify':\n // VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});\n // break;\n //\n // case 'details':\n // VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});\n // break;\n // }\n // }\n\n // handleUpdateRecipient(originalRecipient: IRecipient, updatedRecipient: IRecipient) {\n // console.log('Updating recipient', originalRecipient, updatedRecipient);\n // const fields: any = {};\n // if (updatedRecipient.email !== originalRecipient.email) {\n // fields.email = updatedRecipient.email;\n // }\n // if (updatedRecipient.phone !== originalRecipient.phone) {\n // fields.phone = updatedRecipient.phone;\n // }\n // if (updatedRecipient.message !== originalRecipient.message) {\n // fields.message = updatedRecipient.message;\n // }\n // if (updatedRecipient.first_name !== originalRecipient.first_name) {\n // fields.first_name = updatedRecipient.first_name;\n // }\n // if (updatedRecipient.last_name !== originalRecipient.last_name) {\n // fields.last_name = updatedRecipient.last_name;\n // }\n //\n // if (Object.keys(fields).length > 0) {\n // updateRecipient(this.endpoint, this.envelopeId, originalRecipient.role_name, fields)\n // .then(r => {\n // // TODO: Reload the envelope?\n // VerdocsToast('Recipient updated', {style: 'success'});\n // console.log('[SIDEBAR] Updated recipient', r);\n // Store.getEnvelope(this.endpoint, this.envelopeId, true);\n // this.showUpdateDialog = '';\n // })\n // .catch(e => {\n // VerdocsToast(e.response.data.error, {style: 'error'});\n // this.showUpdateDialog = '';\n // });\n // } else {\n // this.showUpdateDialog = '';\n // }\n // }\n\n render() {\n const hasPoweredBy = !!this.envelope?.organization?.powered_by_label;\n const hasLinks = !!this.envelope?.organization?.terms_use_url || !!this.envelope?.organization?.privacy_policy_url;\n const hasButtons = !this.isDone;\n\n return (\n <Host class={{'has-buttons': hasButtons, 'no-buttons': !hasButtons, 'has-powered-by': hasPoweredBy, 'has-links': hasLinks, 'just-buttons': !hasPoweredBy && !hasLinks}}>\n {this.envelope?.organization?.powered_by_label && (\n <div class=\"powered-by\">\n {this.envelope?.organization?.powered_by_url ? (\n <a href={this.envelope?.organization?.powered_by_url} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>{this.envelope?.organization?.powered_by_label}</span>\n </a>\n ) : (\n <span>{this.envelope?.organization?.powered_by_label}</span>\n )}\n </div>\n )}\n\n {!this.isDone && (\n <div class=\"buttons\">\n <button onClick={() => (this.askingQuestion = true)}>\n <span innerHTML={QuestionIcon} />\n Ask Sender a Question\n </button>\n <button onClick={() => this.decline?.emit()}>\n <span innerHTML={DeclineIcon} />\n Decline Signing\n </button>\n <button onClick={() => this.finishLater?.emit()}>\n <span innerHTML={SaveIcon} />\n Finish Later\n </button>\n </div>\n )}\n\n <div class=\"links\">\n {this.envelope?.organization?.terms_use_url && (\n <a href={this.envelope?.organization?.terms_use_url} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>Terms of Use</span>\n </a>\n )}\n {this.envelope?.organization?.privacy_policy_url && (\n <a href={this.envelope?.organization?.privacy_policy_url} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>Privacy Policy</span>\n </a>\n )}\n </div>\n\n {this.askingQuestion && (\n <verdocs-question-dialog\n onNext={e => {\n this.askQuestion?.emit({question: e.detail.question});\n this.askingQuestion = false;\n }}\n onExit={() => (this.askingQuestion = false)}\n />\n )}\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"verdocs-sign-footer.js","sourceRoot":"","sources":["../../../../src/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.tsx"],"names":[],"mappings":"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","sourcesContent":["import {IEnvelope} from '@verdocs/js-sdk';\nimport {Component, h, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {getEnvelope, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst QuestionIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z\" fill=\"#424242\"/></svg>`;\nconst DeclineIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M7.14645 7.14645C7.34171 6.95118 7.65829 6.95118 7.85355 7.14645L10 9.29289L12.1464 7.14645C12.3417 6.95118 12.6583 6.95118 12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L10.7071 10L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L10 10.7071L7.85355 12.8536C7.65829 13.0488 7.34171 13.0488 7.14645 12.8536C6.95118 12.6583 6.95118 12.3417 7.14645 12.1464L9.29289 10L7.14645 7.85355C6.95118 7.65829 6.95118 7.34171 7.14645 7.14645ZM3 6C3 4.34315 4.34315 3 6 3H14C15.6569 3 17 4.34315 17 6V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6ZM6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V6C16 4.89543 15.1046 4 14 4H6Z\" fill=\"#424242\"/></svg>`;\nconst SaveIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 5C3 3.89543 3.89543 3 5 3H13.3787C13.9091 3 14.4178 3.21071 14.7929 3.58579L16.4142 5.20711C16.7893 5.58218 17 6.09089 17 6.62132V15C17 16.1046 16.1046 17 15 17H5C3.89543 17 3 16.1046 3 15V5ZM5 4C4.44772 4 4 4.44772 4 5V15C4 15.5523 4.44772 16 5 16L5 11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V16C15.5523 16 16 15.5523 16 15V6.62132C16 6.3561 15.8946 6.10175 15.7071 5.91421L14.0858 4.29289C13.8983 4.10536 13.6439 4 13.3787 4L13 4V6.5C13 7.32843 12.3284 8 11.5 8L7.5 8C6.67157 8 6 7.32843 6 6.5L6 4H5ZM7 4L7 6.5C7 6.77614 7.22386 7 7.5 7L11.5 7C11.7761 7 12 6.77614 12 6.5V4L7 4ZM14 16V11.5C14 11.2239 13.7761 11 13.5 11H6.5C6.22386 11 6 11.2239 6 11.5V16H14Z\" fill=\"#424242\"/></svg>`;\n\n/**\n * Typically presented by the `verdocs-sign` component. Displays a footer toolbar\n * with a few convenience functions for the envelope recipient to use.\n */\n@Component({\n tag: 'verdocs-sign-footer',\n styleUrl: 'verdocs-sign-footer.scss',\n shadow: false,\n})\nexport class VerdocsSignFooter {\n private envelopeListenerId = null;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The envelope ID to render. Set ONE OF templateId or envelopeId. If both are set, envelopeId will be ignored.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * If the recipient is \"done,\" some buttons will be hidden.\n */\n @Prop() isDone = false;\n\n /**\n * The envelope's brand, if any.\n */\n @Prop() brand: Record<string, any> | null = null;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) askQuestion: EventEmitter<{question: string}>;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) decline: EventEmitter;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) finishLater: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n // @Event({composed: true}) envelopeUpdated: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}>;\n\n @State() askingQuestion = false;\n @State() declinine = false;\n @State() envelope: IEnvelope | null = null;\n\n async componentWillLoad() {\n try {\n // NOTE: The caller must have a signing session already active and shared to us via\n // the endpoint property.\n if (!this.envelopeId) {\n console.log(`[FOOTER] Missing required envelope ID ${this.envelopeId}`);\n return;\n }\n\n this.listenToEnvelope();\n } catch (e) {\n console.log('[FOOTER] Error loading envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[FOOTER] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n false,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n // handleRecipientAction(recipient: IRecipient, id: string) {\n // console.log('[SIDEBAR] Recipient action', id, recipient);\n // switch (id) {\n // case 'update':\n // this.showUpdateDialog = recipient.role_name;\n // break;\n //\n // case 'reminder':\n // remindRecipient(this.endpoint, this.envelopeId, recipient.role_name)\n // .then(() => {\n // VerdocsToast('Reminder Sent', {style: 'success'});\n // })\n // .catch(e => {\n // console.log('[SIDEBAR] Error resending invitation', e);\n // VerdocsToast('Error resending invitation: ' + e.message, {style: 'error'});\n // });\n // break;\n //\n // case 'reinvite':\n // this.showReinviteDialog = recipient.role_name;\n // break;\n //\n // case 'inperson':\n // this.showRecipientDialog = recipient.role_name;\n // break;\n //\n // case 'modify':\n // VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});\n // break;\n //\n // case 'details':\n // VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});\n // break;\n // }\n // }\n\n // handleUpdateRecipient(originalRecipient: IRecipient, updatedRecipient: IRecipient) {\n // console.log('Updating recipient', originalRecipient, updatedRecipient);\n // const fields: any = {};\n // if (updatedRecipient.email !== originalRecipient.email) {\n // fields.email = updatedRecipient.email;\n // }\n // if (updatedRecipient.phone !== originalRecipient.phone) {\n // fields.phone = updatedRecipient.phone;\n // }\n // if (updatedRecipient.message !== originalRecipient.message) {\n // fields.message = updatedRecipient.message;\n // }\n // if (updatedRecipient.first_name !== originalRecipient.first_name) {\n // fields.first_name = updatedRecipient.first_name;\n // }\n // if (updatedRecipient.last_name !== originalRecipient.last_name) {\n // fields.last_name = updatedRecipient.last_name;\n // }\n //\n // if (Object.keys(fields).length > 0) {\n // updateRecipient(this.endpoint, this.envelopeId, originalRecipient.role_name, fields)\n // .then(r => {\n // // TODO: Reload the envelope?\n // VerdocsToast('Recipient updated', {style: 'success'});\n // console.log('[SIDEBAR] Updated recipient', r);\n // Store.getEnvelope(this.endpoint, this.envelopeId, true);\n // this.showUpdateDialog = '';\n // })\n // .catch(e => {\n // VerdocsToast(e.response.data.error, {style: 'error'});\n // this.showUpdateDialog = '';\n // });\n // } else {\n // this.showUpdateDialog = '';\n // }\n // }\n\n render() {\n const org = this.envelope?.organization;\n const poweredByLabel = this.brand?.powered_by_label || org?.powered_by_label;\n const poweredByUrl = this.brand?.powered_by_label ? this.brand?.powered_by_url : org?.powered_by_url;\n const termsUrl = this.brand?.terms_use_url || org?.terms_use_url;\n const privacyUrl = this.brand?.privacy_policy_url || org?.privacy_policy_url;\n const hasPoweredBy = !!poweredByLabel;\n const hasLinks = !!termsUrl || !!privacyUrl;\n const hasButtons = !this.isDone;\n\n return (\n <Host class={{'has-buttons': hasButtons, 'no-buttons': !hasButtons, 'has-powered-by': hasPoweredBy, 'has-links': hasLinks, 'just-buttons': !hasPoweredBy && !hasLinks}}>\n {poweredByLabel && (\n <div class=\"powered-by\">\n {poweredByUrl ? (\n <a href={poweredByUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>{poweredByLabel}</span>\n </a>\n ) : (\n <span>{poweredByLabel}</span>\n )}\n </div>\n )}\n\n {!this.isDone && (\n <div class=\"buttons\">\n <button onClick={() => (this.askingQuestion = true)}>\n <span innerHTML={QuestionIcon} />\n Ask Sender a Question\n </button>\n <button onClick={() => this.decline?.emit()}>\n <span innerHTML={DeclineIcon} />\n Decline Signing\n </button>\n <button onClick={() => this.finishLater?.emit()}>\n <span innerHTML={SaveIcon} />\n Finish Later\n </button>\n </div>\n )}\n\n <div class=\"links\">\n {termsUrl && (\n <a href={termsUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>Terms of Use</span>\n </a>\n )}\n {privacyUrl && (\n <a href={privacyUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>Privacy Policy</span>\n </a>\n )}\n </div>\n\n {this.askingQuestion && (\n <verdocs-question-dialog\n onNext={e => {\n this.askQuestion?.emit({question: e.detail.question});\n this.askingQuestion = false;\n }}\n onExit={() => (this.askingQuestion = false)}\n />\n )}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as o,c as i,h as t,d as s,F as n,t as l}from"./p-yZBlG3YQ.js";import{VerdocsEndpoint as r,getEnvelope as d,getEnvelopesZip as a,getEnvelopeDocumentDownloadLink as c,cancelEnvelope as h,getCombinedEnvelopeDocumentDownloadLink as v,getMyRecipient as m,integerSequence as p}from"@verdocs/js-sdk";import{D as f}from"./p-17OorOnH.js";import{V as u}from"./p-D97GxsI-.js";import{S as w}from"./p-C1sRVZWv.js";import{S as g}from"./p-C7hFgM52.js";import{d as x}from"./p-C90lxyUX.js";import{d as b}from"./p-PVw56Shw.js";import{d as C}from"./p-DscL0SIM.js";import{d as y}from"./p-C8yiLtCJ.js";import{d as k}from"./p-DqzFuSNN.js";import{d as z}from"./p-5FU3bYQ3.js";import{d as L}from"./p-8J_y0V9M.js";import{d as V}from"./p-E2hWLZ47.js";const E=()=>`verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);background-color:#f5f5f5}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column;padding-right:15px}verdocs-view .document .inner{width:100%;max-width:1028px}verdocs-view .signed-document-container{width:64%;margin:0 auto;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;gap:15px}verdocs-view .signed-document-container.zoom-normal{width:64%}verdocs-view .signed-document-container.zoom-zoom1{width:80%}verdocs-view .signed-document-container.zoom-zoom2{width:100%}@media (max-width: 768px){verdocs-view .signed-document-container{width:100%}verdocs-view .signed-document-container.zoom-normal,verdocs-view .signed-document-container.zoom-zoom1,verdocs-view .signed-document-container.zoom-zoom2{width:100%}verdocs-view .controls-toolbar .center-controls{display:none}verdocs-view .controls-toolbar .right-controls .icon-button.minus,verdocs-view .controls-toolbar .right-controls .icon-button.plus{display:none}}verdocs-view .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7);-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}verdocs-view verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}#verdocs-view-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:54px;padding:0 12px 0 24px;background-color:#ffffff;border-bottom:1px solid #e0e0e0;-webkit-box-shadow:none;box-shadow:none;font-family:"Inter", sans-serif;color:#424242;z-index:1000;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}#verdocs-view-header .left-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}#verdocs-view-header .left-controls .title{font-weight:500;font-size:16px;color:#242424;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#verdocs-view-header .center-controls{-ms-flex:1;flex:1;display:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:10px;font-size:14px}#verdocs-view-header .right-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}#verdocs-view-header .right-controls .icon-button{width:32px;height:32px;display:-ms-flexbox;display:flex;color:#424242;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:background-color 0.2s;transition:background-color 0.2s}#verdocs-view-header .right-controls .icon-button:hover{background-color:#f5f5f5}#verdocs-view-header .right-controls .icon-button.disabled{opacity:0.3;pointer-events:none}#verdocs-view-header .right-controls .icon-button svg{display:block;width:20px;height:20px}@media print{#verdocs-view-header{display:none !important}verdocs-view{min-height:auto;background-color:white}verdocs-view .document{overflow:visible;height:auto;display:block;padding:0}verdocs-view .signed-document-container{width:100%;margin:0}}`;const H=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11ZM14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z" fill="#424242" /></svg>`;const I=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5ZM8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z" fill="#424242" /></svg>`;const M=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 16.9988C15.7761 16.9988 16 17.2226 16 17.4988C16 17.7442 15.8231 17.9484 15.5899 17.9907L15.5 17.9988H4.5C4.22386 17.9988 4 17.7749 4 17.4988C4 17.2533 4.17688 17.0492 4.41012 17.0068L4.5 16.9988H15.5ZM10.0001 2.00098C10.2456 2.00098 10.4497 2.17798 10.492 2.41124L10.5 2.50112L10.496 14.295L14.1414 10.6466C14.3148 10.4729 14.5842 10.4534 14.7792 10.5882L14.8485 10.646C15.0222 10.8194 15.0418 11.0888 14.907 11.2838L14.8492 11.3531L10.3574 15.8531C10.285 15.9257 10.1957 15.9714 10.1021 15.9901L9.99608 15.9999C9.83511 15.9999 9.69192 15.9237 9.60051 15.8056L5.14386 11.3537C4.94846 11.1586 4.94823 10.842 5.14336 10.6466C5.3168 10.4729 5.58621 10.4534 5.78117 10.5883L5.85046 10.6461L9.496 14.287L9.5 2.50083C9.50008 2.22469 9.724 2.00098 10.0001 2.00098Z" fill="#424242"/></svg>`;const j=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 4.5C5 3.67157 5.67157 3 6.5 3H13.5C14.3284 3 15 3.67157 15 4.5V5H15.5C16.8807 5 18 6.11929 18 7.5V12.5C18 13.3284 17.3284 14 16.5 14H15V15.5C15 16.3284 14.3284 17 13.5 17H6.5C5.67157 17 5 16.3284 5 15.5V14H3.5C2.67157 14 2 13.3284 2 12.5V7.5C2 6.11929 3.11929 5 4.5 5H5V4.5ZM6 5H14V4.5C14 4.22386 13.7761 4 13.5 4H6.5C6.22386 4 6 4.22386 6 4.5V5ZM5 13V11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V13H16.5C16.7761 13 17 12.7761 17 12.5V7.5C17 6.67157 16.3284 6 15.5 6H4.5C3.67157 6 3 6.67157 3 7.5V12.5C3 12.7761 3.22386 13 3.5 13H5ZM6.5 11C6.22386 11 6 11.2239 6 11.5V15.5C6 15.7761 6.22386 16 6.5 16H13.5C13.7761 16 14 15.7761 14 15.5V11.5C14 11.2239 13.7761 11 13.5 11H6.5Z" fill="#424242"/></svg>`;const Z=e(class e extends o{constructor(e){super();if(e!==false){this.__registerHost()}this.sdkError=i(this,"sdkError");this.envelopeUpdated=i(this,"envelopeUpdated");this.another=i(this,"another");this.view=i(this,"view");this.next=i(this,"next");this.envelopeListenerId=null;this.endpoint=null;this.envelopeId="";this.headerTargetId=null;this.canceling=false;this.showCancelDone=false;this.showLoadError=false;this.loading=true;this.envelope=null;this.zoomLevel="normal";this.showDownloadDialog=false;this.polling=false;this.pollingInterval=null}async componentWillLoad(){var e,o,i;this.updateZoomFromWindow();window.addEventListener("resize",(()=>this.updateZoomFromWindow()));if(!this.endpoint){this.endpoint=r.getDefault();this.endpoint.loadSession()}if(!this.envelopeId){console.error(`[VIEW] Missing required envelopeId`);return}await this.listenToEnvelope();if(!this.envelope){try{console.log("[VIEW] Loading envelope...");this.envelope=await d(this.endpoint,this.envelopeId);console.log("[VIEW] Loaded envelope",this.envelope)}catch(t){this.showLoadError=true;(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(t.message,(o=t.response)===null||o===void 0?void 0:o.status,(i=t.response)===null||i===void 0?void 0:i.data))}}}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null;const o=document.getElementById("verdocs-view-header");if(e&&o){console.log("[VIEW] Moving header");o.remove();e.append(o)}}disconnectedCallback(){this.stopPolling();this.unlistenToEnvelope();window.removeEventListener("resize",(()=>this.updateZoomFromWindow()))}updateZoomFromWindow(){const e=window.innerWidth;if(e<768){if(this.zoomLevel!=="zoom2")this.zoomLevel="zoom2"}else if(e<1024){if(this.zoomLevel!=="zoom1")this.zoomLevel="zoom1"}else{if(this.zoomLevel!=="normal")this.zoomLevel="normal"}}async listenToEnvelope(){console.log("[VIEW] Loading envelope",this.envelopeId);this.unlistenToEnvelope();g.subscribe("envelopes",this.envelopeId,(()=>d(this.endpoint,this.envelopeId)),true,(e=>{this.envelope=e;this.loading=false}))}unlistenToEnvelope(){if(this.envelopeListenerId){g.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}}handlePageRendered(e){}async handleOptionSelected(e){var o,i,t,s;switch(e.detail.id){case"cancel":if(confirm("Are you sure you wish to cancel this envelope? This action cannot be undone.")){this.canceling=true;h(this.endpoint,this.envelopeId).then((e=>{this.canceling=false;console.log("[VIEW] Envelope canceled",e);return d(this.endpoint,this.envelopeId)})).then((e=>{console.log("[VIEW] Loaded new envelope details",e);this.envelope=e})).catch((e=>{var o,i,t;this.canceling=false;console.log("[VIEW] Error canceling envelope",e);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new w(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(t=e.response)===null||t===void 0?void 0:t.data))}));this.showCancelDone=true;(o=this.envelopeUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"canceled"})}break;case"print":window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":this.showDownloadDialog=true;this.startPolling();break;case"download-attachments":try{const e=this.envelope.documents.find((e=>e.type==="attachment"));if(e){const o=await c(this.endpoint,e.id);window.open(o,"_blank")}}catch(e){console.log("Unable to download document",e);u(((s=(t=e.response)===null||t===void 0?void 0:t.data)===null||s===void 0?void 0:s.error)||"Unable to download document. Please try again later.",{style:"error"})}break;case"download-certificate":{const e=this.envelope.documents.find((e=>e.type==="certificate"));if(e){const o=await c(this.endpoint,e.id);window.open(o,"_blank")}}break;case"download-all":a(this.endpoint,[this.envelope.id]).then((()=>{var e;(e=this.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})})).catch((e=>{console.log("Error downloading Zip",e)}));break}}startPolling(){this.stopPolling();const e=()=>{var e,o,i,t,s,n;const l=((e=this.envelope)===null||e===void 0?void 0:e.status)==="complete"||!!((o=this.envelope)===null||o===void 0?void 0:o.signed);const r=(t=(i=this.envelope)===null||i===void 0?void 0:i.documents)===null||t===void 0?void 0:t.some((e=>e.type==="certificate"));const d=(n=(s=this.envelope)===null||s===void 0?void 0:s.recipients)===null||n===void 0?void 0:n.every((e=>e.status==="submitted"));if(l&&r)return false;if(!d)return false;return true};if(!e()){return}this.polling=true;this.pollingInterval=setInterval((async()=>{try{const o=await d(this.endpoint,this.envelopeId);this.envelope=o;g.updateEnvelope(this.envelopeId,o);if(!e()){this.stopPolling()}}catch(e){console.error("[VIEW] Polling error",e);this.stopPolling()}}),5e3)}stopPolling(){if(this.pollingInterval){clearInterval(this.pollingInterval);this.pollingInterval=null}this.polling=false}handleZoomIn(){if(this.zoomLevel==="normal"){this.zoomLevel="zoom1"}else if(this.zoomLevel==="zoom1"){this.zoomLevel="zoom2"}}handleZoomOut(){if(this.zoomLevel==="zoom1"){this.zoomLevel="normal"}else if(this.zoomLevel==="zoom2"){this.zoomLevel="zoom1"}}async handleDownloadDocuments(e){var o,i;const{action:t,documentId:s}=e.detail;console.log("[VIEW] Download action selected:",t,s);try{switch(t){case f.certificate:const e=this.envelope.documents.find((e=>e.type==="certificate"));if(!e){u("Certificate not yet available.",{style:"info"});break}const t=await c(this.endpoint,e.id);window.open(t,"_blank");break;case f.combined:const n=s||((o=this.envelope.documents.find((e=>e.type==="certificate")))===null||o===void 0?void 0:o.id);const l=await v(this.endpoint,n);window.open(l,"_blank");break;case f.document:const r=s||((i=this.envelope.documents.find((e=>e.type==="attachment")))===null||i===void 0?void 0:i.id);if(!r)break;const d=await c(this.endpoint,r);window.open(d,"_blank");break;case f.zip:const h=await a(this.endpoint,[this.envelopeId]);const m=window.URL.createObjectURL(h.data);const p=document.createElement("a");p.href=m;p.download=`${this.envelope.name}.zip`;document.body.appendChild(p);p.click();p.remove();window.URL.revokeObjectURL(m);break}}catch(e){console.error("Download error",e);u("Unable to complete download request.",{style:"error"})}}render(){var e;if(this.loading){return t(s,null,t("verdocs-loader",null))}if(this.showLoadError){return t(s,null,t("verdocs-ok-dialog",{heading:"Unable to View Envelope",message:`Sorry, that envelope is not valid.`,buttonLabel:"OK",onNext:()=>{this.showLoadError=false}}))}if(!this.envelope){return t(s,null,t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"}))}const o=m(this.endpoint.session,this.envelope);return t(s,null,t("div",{class:"controls-toolbar",id:"verdocs-view-header"},t("div",{class:"left-controls"},t("div",{class:"title"},this.envelope.name)),t("div",{class:"center-controls"}),t("div",{class:"right-controls"},t("div",{class:{"icon-button":true,minus:true,disabled:this.zoomLevel==="normal"},innerHTML:H,onClick:()=>this.handleZoomOut()}),t("div",{class:{"icon-button":true,plus:true,disabled:this.zoomLevel==="zoom2"},innerHTML:I,onClick:()=>this.handleZoomIn()}),t("div",{class:"icon-button download",innerHTML:M,onClick:()=>this.handleOptionSelected({detail:{id:"download"}})}),t("div",{class:"icon-button print",innerHTML:j,onClick:()=>this.handleOptionSelected({detail:{id:"print"}})}))),t("div",{class:`document signed-document-container zoom-${this.zoomLevel}`,style:{paddingTop:this.headerTargetId?"70px":"15px"}},(((e=this.envelope)===null||e===void 0?void 0:e.documents)||[]).filter((e=>e.type!=="certificate")).map((e=>{const o=p(1,e.pages);return t(n,null,o.map((o=>{var i;const s=((i=e.page_sizes)===null||i===void 0?void 0:i[o])||{width:612,height:792};return t("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,type:"filled",virtualWidth:s.width,virtualHeight:s.height,pageNumber:o,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showCancelDone&&t("verdocs-ok-dialog",{heading:"Cancelled",message:`This envelope has been cancelled successfully.`,onNext:()=>{this.showCancelDone=false}}),this.canceling&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)),this.showDownloadDialog&&t("verdocs-download-dialog",{signed:this.envelope.status==="complete"||this.envelope.signed,polling:this.polling,documents:this.envelope.documents,onExit:()=>{this.showDownloadDialog=false;this.stopPolling()},onDownload:e=>this.handleDownloadDocuments(e)}),!!o&&t("verdocs-sign-footer",{endpoint:this.endpoint,envelopeId:this.envelopeId,isDone:true,onAskQuestion:()=>{},onDecline:()=>{},onFinishLater:()=>{}}))}get component(){return this}static get style(){return E()}},[0,"verdocs-view",{endpoint:[16],envelopeId:[1,"envelope-id"],headerTargetId:[1,"header-target-id"],canceling:[32],showCancelDone:[32],showLoadError:[32],loading:[32],envelope:[32],zoomLevel:[32],showDownloadDialog:[32],polling:[32]}]);function D(){if(typeof customElements==="undefined"){return}const e=["verdocs-view","verdocs-dialog","verdocs-download-dialog","verdocs-envelope-document-page","verdocs-flag","verdocs-loader","verdocs-ok-dialog","verdocs-question-dialog","verdocs-sign-footer"];e.forEach((e=>{switch(e){case"verdocs-view":if(!customElements.get(l(e))){customElements.define(l(e),Z)}break;case"verdocs-dialog":if(!customElements.get(l(e))){x()}break;case"verdocs-download-dialog":if(!customElements.get(l(e))){b()}break;case"verdocs-envelope-document-page":if(!customElements.get(l(e))){C()}break;case"verdocs-flag":if(!customElements.get(l(e))){y()}break;case"verdocs-loader":if(!customElements.get(l(e))){k()}break;case"verdocs-ok-dialog":if(!customElements.get(l(e))){z()}break;case"verdocs-question-dialog":if(!customElements.get(l(e))){L()}break;case"verdocs-sign-footer":if(!customElements.get(l(e))){V()}break}}))}export{Z as V,D as d};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as o,c as i,h as t,d as s,F as n,t as l}from"./p-yZBlG3YQ.js";import{VerdocsEndpoint as r,getEnvelope as d,getEnvelopesZip as a,getEnvelopeDocumentDownloadLink as c,cancelEnvelope as h,getCombinedEnvelopeDocumentDownloadLink as v,getMyRecipient as m,integerSequence as p}from"@verdocs/js-sdk";import{D as f}from"./p-17OorOnH.js";import{V as u}from"./p-D97GxsI-.js";import{S as w}from"./p-C1sRVZWv.js";import{S as g}from"./p-C7hFgM52.js";import{d as x}from"./p-C90lxyUX.js";import{d as b}from"./p-PVw56Shw.js";import{d as C}from"./p-DscL0SIM.js";import{d as y}from"./p-C8yiLtCJ.js";import{d as k}from"./p-DqzFuSNN.js";import{d as z}from"./p-5FU3bYQ3.js";import{d as L}from"./p-8J_y0V9M.js";import{d as V}from"./p-D495hZfr.js";const E=()=>`verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);background-color:#f5f5f5}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column;padding-right:15px}verdocs-view .document .inner{width:100%;max-width:1028px}verdocs-view .signed-document-container{width:64%;margin:0 auto;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;gap:15px}verdocs-view .signed-document-container.zoom-normal{width:64%}verdocs-view .signed-document-container.zoom-zoom1{width:80%}verdocs-view .signed-document-container.zoom-zoom2{width:100%}@media (max-width: 768px){verdocs-view .signed-document-container{width:100%}verdocs-view .signed-document-container.zoom-normal,verdocs-view .signed-document-container.zoom-zoom1,verdocs-view .signed-document-container.zoom-zoom2{width:100%}verdocs-view .controls-toolbar .center-controls{display:none}verdocs-view .controls-toolbar .right-controls .icon-button.minus,verdocs-view .controls-toolbar .right-controls .icon-button.plus{display:none}}verdocs-view .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7);-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}verdocs-view verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}#verdocs-view-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:54px;padding:0 12px 0 24px;background-color:#ffffff;border-bottom:1px solid #e0e0e0;-webkit-box-shadow:none;box-shadow:none;font-family:"Inter", sans-serif;color:#424242;z-index:1000;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}#verdocs-view-header .left-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}#verdocs-view-header .left-controls .title{font-weight:500;font-size:16px;color:#242424;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#verdocs-view-header .center-controls{-ms-flex:1;flex:1;display:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:10px;font-size:14px}#verdocs-view-header .right-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}#verdocs-view-header .right-controls .icon-button{width:32px;height:32px;display:-ms-flexbox;display:flex;color:#424242;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:background-color 0.2s;transition:background-color 0.2s}#verdocs-view-header .right-controls .icon-button:hover{background-color:#f5f5f5}#verdocs-view-header .right-controls .icon-button.disabled{opacity:0.3;pointer-events:none}#verdocs-view-header .right-controls .icon-button svg{display:block;width:20px;height:20px}@media print{#verdocs-view-header{display:none !important}verdocs-view{min-height:auto;background-color:white}verdocs-view .document{overflow:visible;height:auto;display:block;padding:0}verdocs-view .signed-document-container{width:100%;margin:0}}`;const H=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11ZM14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z" fill="#424242" /></svg>`;const I=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5ZM8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z" fill="#424242" /></svg>`;const M=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 16.9988C15.7761 16.9988 16 17.2226 16 17.4988C16 17.7442 15.8231 17.9484 15.5899 17.9907L15.5 17.9988H4.5C4.22386 17.9988 4 17.7749 4 17.4988C4 17.2533 4.17688 17.0492 4.41012 17.0068L4.5 16.9988H15.5ZM10.0001 2.00098C10.2456 2.00098 10.4497 2.17798 10.492 2.41124L10.5 2.50112L10.496 14.295L14.1414 10.6466C14.3148 10.4729 14.5842 10.4534 14.7792 10.5882L14.8485 10.646C15.0222 10.8194 15.0418 11.0888 14.907 11.2838L14.8492 11.3531L10.3574 15.8531C10.285 15.9257 10.1957 15.9714 10.1021 15.9901L9.99608 15.9999C9.83511 15.9999 9.69192 15.9237 9.60051 15.8056L5.14386 11.3537C4.94846 11.1586 4.94823 10.842 5.14336 10.6466C5.3168 10.4729 5.58621 10.4534 5.78117 10.5883L5.85046 10.6461L9.496 14.287L9.5 2.50083C9.50008 2.22469 9.724 2.00098 10.0001 2.00098Z" fill="#424242"/></svg>`;const j=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 4.5C5 3.67157 5.67157 3 6.5 3H13.5C14.3284 3 15 3.67157 15 4.5V5H15.5C16.8807 5 18 6.11929 18 7.5V12.5C18 13.3284 17.3284 14 16.5 14H15V15.5C15 16.3284 14.3284 17 13.5 17H6.5C5.67157 17 5 16.3284 5 15.5V14H3.5C2.67157 14 2 13.3284 2 12.5V7.5C2 6.11929 3.11929 5 4.5 5H5V4.5ZM6 5H14V4.5C14 4.22386 13.7761 4 13.5 4H6.5C6.22386 4 6 4.22386 6 4.5V5ZM5 13V11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V13H16.5C16.7761 13 17 12.7761 17 12.5V7.5C17 6.67157 16.3284 6 15.5 6H4.5C3.67157 6 3 6.67157 3 7.5V12.5C3 12.7761 3.22386 13 3.5 13H5ZM6.5 11C6.22386 11 6 11.2239 6 11.5V15.5C6 15.7761 6.22386 16 6.5 16H13.5C13.7761 16 14 15.7761 14 15.5V11.5C14 11.2239 13.7761 11 13.5 11H6.5Z" fill="#424242"/></svg>`;const Z=e(class e extends o{constructor(e){super();if(e!==false){this.__registerHost()}this.sdkError=i(this,"sdkError");this.envelopeUpdated=i(this,"envelopeUpdated");this.another=i(this,"another");this.view=i(this,"view");this.next=i(this,"next");this.envelopeListenerId=null;this.endpoint=null;this.envelopeId="";this.headerTargetId=null;this.canceling=false;this.showCancelDone=false;this.showLoadError=false;this.loading=true;this.envelope=null;this.zoomLevel="normal";this.showDownloadDialog=false;this.polling=false;this.pollingInterval=null}async componentWillLoad(){var e,o,i;this.updateZoomFromWindow();window.addEventListener("resize",(()=>this.updateZoomFromWindow()));if(!this.endpoint){this.endpoint=r.getDefault();this.endpoint.loadSession()}if(!this.envelopeId){console.error(`[VIEW] Missing required envelopeId`);return}await this.listenToEnvelope();if(!this.envelope){try{console.log("[VIEW] Loading envelope...");this.envelope=await d(this.endpoint,this.envelopeId);console.log("[VIEW] Loaded envelope",this.envelope)}catch(t){this.showLoadError=true;(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(t.message,(o=t.response)===null||o===void 0?void 0:o.status,(i=t.response)===null||i===void 0?void 0:i.data))}}}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null;const o=document.getElementById("verdocs-view-header");if(e&&o){console.log("[VIEW] Moving header");o.remove();e.append(o)}}disconnectedCallback(){this.stopPolling();this.unlistenToEnvelope();window.removeEventListener("resize",(()=>this.updateZoomFromWindow()))}updateZoomFromWindow(){const e=window.innerWidth;if(e<768){if(this.zoomLevel!=="zoom2")this.zoomLevel="zoom2"}else if(e<1024){if(this.zoomLevel!=="zoom1")this.zoomLevel="zoom1"}else{if(this.zoomLevel!=="normal")this.zoomLevel="normal"}}async listenToEnvelope(){console.log("[VIEW] Loading envelope",this.envelopeId);this.unlistenToEnvelope();g.subscribe("envelopes",this.envelopeId,(()=>d(this.endpoint,this.envelopeId)),true,(e=>{this.envelope=e;this.loading=false}))}unlistenToEnvelope(){if(this.envelopeListenerId){g.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}}handlePageRendered(e){}async handleOptionSelected(e){var o,i,t,s;switch(e.detail.id){case"cancel":if(confirm("Are you sure you wish to cancel this envelope? This action cannot be undone.")){this.canceling=true;h(this.endpoint,this.envelopeId).then((e=>{this.canceling=false;console.log("[VIEW] Envelope canceled",e);return d(this.endpoint,this.envelopeId)})).then((e=>{console.log("[VIEW] Loaded new envelope details",e);this.envelope=e})).catch((e=>{var o,i,t;this.canceling=false;console.log("[VIEW] Error canceling envelope",e);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new w(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(t=e.response)===null||t===void 0?void 0:t.data))}));this.showCancelDone=true;(o=this.envelopeUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"canceled"})}break;case"print":window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":this.showDownloadDialog=true;this.startPolling();break;case"download-attachments":try{const e=this.envelope.documents.find((e=>e.type==="attachment"));if(e){const o=await c(this.endpoint,e.id);window.open(o,"_blank")}}catch(e){console.log("Unable to download document",e);u(((s=(t=e.response)===null||t===void 0?void 0:t.data)===null||s===void 0?void 0:s.error)||"Unable to download document. Please try again later.",{style:"error"})}break;case"download-certificate":{const e=this.envelope.documents.find((e=>e.type==="certificate"));if(e){const o=await c(this.endpoint,e.id);window.open(o,"_blank")}}break;case"download-all":a(this.endpoint,[this.envelope.id]).then((()=>{var e;(e=this.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})})).catch((e=>{console.log("Error downloading Zip",e)}));break}}startPolling(){this.stopPolling();const e=()=>{var e,o,i,t,s,n;const l=((e=this.envelope)===null||e===void 0?void 0:e.status)==="complete"||!!((o=this.envelope)===null||o===void 0?void 0:o.signed);const r=(t=(i=this.envelope)===null||i===void 0?void 0:i.documents)===null||t===void 0?void 0:t.some((e=>e.type==="certificate"));const d=(n=(s=this.envelope)===null||s===void 0?void 0:s.recipients)===null||n===void 0?void 0:n.every((e=>e.status==="submitted"));if(l&&r)return false;if(!d)return false;return true};if(!e()){return}this.polling=true;this.pollingInterval=setInterval((async()=>{try{const o=await d(this.endpoint,this.envelopeId);this.envelope=o;g.updateEnvelope(this.envelopeId,o);if(!e()){this.stopPolling()}}catch(e){console.error("[VIEW] Polling error",e);this.stopPolling()}}),5e3)}stopPolling(){if(this.pollingInterval){clearInterval(this.pollingInterval);this.pollingInterval=null}this.polling=false}handleZoomIn(){if(this.zoomLevel==="normal"){this.zoomLevel="zoom1"}else if(this.zoomLevel==="zoom1"){this.zoomLevel="zoom2"}}handleZoomOut(){if(this.zoomLevel==="zoom1"){this.zoomLevel="normal"}else if(this.zoomLevel==="zoom2"){this.zoomLevel="zoom1"}}async handleDownloadDocuments(e){var o,i;const{action:t,documentId:s}=e.detail;console.log("[VIEW] Download action selected:",t,s);try{switch(t){case f.certificate:const e=this.envelope.documents.find((e=>e.type==="certificate"));if(!e){u("Certificate not yet available.",{style:"info"});break}const t=await c(this.endpoint,e.id);window.open(t,"_blank");break;case f.combined:const n=s||((o=this.envelope.documents.find((e=>e.type==="certificate")))===null||o===void 0?void 0:o.id);const l=await v(this.endpoint,n);window.open(l,"_blank");break;case f.document:const r=s||((i=this.envelope.documents.find((e=>e.type==="attachment")))===null||i===void 0?void 0:i.id);if(!r)break;const d=await c(this.endpoint,r);window.open(d,"_blank");break;case f.zip:const h=await a(this.endpoint,[this.envelopeId]);const m=window.URL.createObjectURL(h.data);const p=document.createElement("a");p.href=m;p.download=`${this.envelope.name}.zip`;document.body.appendChild(p);p.click();p.remove();window.URL.revokeObjectURL(m);break}}catch(e){console.error("Download error",e);u("Unable to complete download request.",{style:"error"})}}render(){var e;if(this.loading){return t(s,null,t("verdocs-loader",null))}if(this.showLoadError){return t(s,null,t("verdocs-ok-dialog",{heading:"Unable to View Envelope",message:`Sorry, that envelope is not valid.`,buttonLabel:"OK",onNext:()=>{this.showLoadError=false}}))}if(!this.envelope){return t(s,null,t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"}))}const o=m(this.endpoint.session,this.envelope);return t(s,null,t("div",{class:"controls-toolbar",id:"verdocs-view-header"},t("div",{class:"left-controls"},t("div",{class:"title"},this.envelope.name)),t("div",{class:"center-controls"}),t("div",{class:"right-controls"},t("div",{class:{"icon-button":true,minus:true,disabled:this.zoomLevel==="normal"},innerHTML:H,onClick:()=>this.handleZoomOut()}),t("div",{class:{"icon-button":true,plus:true,disabled:this.zoomLevel==="zoom2"},innerHTML:I,onClick:()=>this.handleZoomIn()}),t("div",{class:"icon-button download",innerHTML:M,onClick:()=>this.handleOptionSelected({detail:{id:"download"}})}),t("div",{class:"icon-button print",innerHTML:j,onClick:()=>this.handleOptionSelected({detail:{id:"print"}})}))),t("div",{class:`document signed-document-container zoom-${this.zoomLevel}`,style:{paddingTop:this.headerTargetId?"70px":"15px"}},(((e=this.envelope)===null||e===void 0?void 0:e.documents)||[]).filter((e=>e.type!=="certificate")).map((e=>{const o=p(1,e.pages);return t(n,null,o.map((o=>{var i;const s=((i=e.page_sizes)===null||i===void 0?void 0:i[o])||{width:612,height:792};return t("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,type:"filled",virtualWidth:s.width,virtualHeight:s.height,pageNumber:o,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showCancelDone&&t("verdocs-ok-dialog",{heading:"Cancelled",message:`This envelope has been cancelled successfully.`,onNext:()=>{this.showCancelDone=false}}),this.canceling&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)),this.showDownloadDialog&&t("verdocs-download-dialog",{signed:this.envelope.status==="complete"||this.envelope.signed,polling:this.polling,documents:this.envelope.documents,onExit:()=>{this.showDownloadDialog=false;this.stopPolling()},onDownload:e=>this.handleDownloadDocuments(e)}),!!o&&t("verdocs-sign-footer",{endpoint:this.endpoint,envelopeId:this.envelopeId,isDone:true,onAskQuestion:()=>{},onDecline:()=>{},onFinishLater:()=>{}}))}get component(){return this}static get style(){return E()}},[0,"verdocs-view",{endpoint:[16],envelopeId:[1,"envelope-id"],headerTargetId:[1,"header-target-id"],canceling:[32],showCancelDone:[32],showLoadError:[32],loading:[32],envelope:[32],zoomLevel:[32],showDownloadDialog:[32],polling:[32]}]);function D(){if(typeof customElements==="undefined"){return}const e=["verdocs-view","verdocs-dialog","verdocs-download-dialog","verdocs-envelope-document-page","verdocs-flag","verdocs-loader","verdocs-ok-dialog","verdocs-question-dialog","verdocs-sign-footer"];e.forEach((e=>{switch(e){case"verdocs-view":if(!customElements.get(l(e))){customElements.define(l(e),Z)}break;case"verdocs-dialog":if(!customElements.get(l(e))){x()}break;case"verdocs-download-dialog":if(!customElements.get(l(e))){b()}break;case"verdocs-envelope-document-page":if(!customElements.get(l(e))){C()}break;case"verdocs-flag":if(!customElements.get(l(e))){y()}break;case"verdocs-loader":if(!customElements.get(l(e))){k()}break;case"verdocs-ok-dialog":if(!customElements.get(l(e))){z()}break;case"verdocs-question-dialog":if(!customElements.get(l(e))){L()}break;case"verdocs-sign-footer":if(!customElements.get(l(e))){V()}break}}))}export{Z as V,D as d};
|
|
2
|
+
//# sourceMappingURL=p-06em1_P-.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as s,c as i,h as n,d as t,t as o}from"./p-yZBlG3YQ.js";import{getTemplate as r,getBrands as d,getOrganization as a,formatFullName as l,getOrganizationContacts as c,isValidEmail as p,createEnvelope as h,getRGBA as f}from"@verdocs/js-sdk";import{D as v,g as u}from"./p-Cq60Emo_.js";import{u as m,d as x}from"./p-ByrpRZ3E.js";import{V as b}from"./p-D97GxsI-.js";import{S as g}from"./p-C1sRVZWv.js";import{S as w}from"./p-C7hFgM52.js";import{d as k}from"./p-Bb5V9TQx.js";import{d as y}from"./p-DGNIsXfr.js";import{d as S}from"./p-C-v22G3g.js";import{d as E}from"./p-C8yiLtCJ.js";import{d as C}from"./p-DqzFuSNN.js";import{d as D}from"./p-DreV6Npp.js";const z=e=>((e===null||e===void 0?void 0:e.roles)||[]).map((e=>e.name));const N=(e,s)=>Math.max(z(e).findIndex((e=>e===s)),0);const M=()=>`verdocs-send{--send-ink:var(--verdocs-body-color, #111827);--send-ink-2:#374151;--send-muted:#6b7280;--send-faint:#9ca3af;--send-rule:#e5e7eb;--send-control-border:#d1d5db;--send-accent:var(--verdocs-link-color, #4c56cb);--send-accent-tint:#f4f5fc;--send-accent-tint-2:#e6e7f8;--send-warning-bg:#fffbeb;--send-warning-border:#fde68a;--send-warning-icon:#d97706;--send-warning-text:#78350f;--send-radius:var(--verdocs-dialog-radius, 8px);--send-min-height:480px;--send-max-width:480px;display:none;position:relative;overflow:hidden;width:100%;max-width:var(--verdocs-send-max-width, var(--send-max-width));-webkit-box-sizing:border-box;box-sizing:border-box;background:#ffffff;color:var(--send-ink);font-size:14px;border-radius:var(--send-radius);border:1px solid var(--send-rule);font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-send *{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-send.sendable{display:block}verdocs-send .track{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:var(--send-min-height);-webkit-transition:-webkit-transform 220ms ease-out;transition:-webkit-transform 220ms ease-out;transition:transform 220ms ease-out;transition:transform 220ms ease-out, -webkit-transform 220ms ease-out}verdocs-send.detail-open .track{-webkit-transform:translateX(-100%);transform:translateX(-100%)}@media (prefers-reduced-motion: reduce){verdocs-send .track{-webkit-transition:none;transition:none}}verdocs-send .pane{padding:16px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .main-pane{-ms-flex:1;flex:1}verdocs-send .detail-pane{position:absolute;top:0;left:100%;bottom:0;width:100%;overflow:hidden}verdocs-send .detail{-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .detail-body-wrap{position:relative;-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .detail-body{-ms-flex:1;flex:1;min-height:0;overflow-y:auto}verdocs-send .scroll-fade{position:absolute;left:0;right:0;bottom:0;height:36px;opacity:0;pointer-events:none;-webkit-transition:opacity 150ms ease-out;transition:opacity 150ms ease-out;background:-webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0)), to(#ffffff));background:linear-gradient(rgba(255, 255, 255, 0), #ffffff)}verdocs-send .scrollable:not(.at-end)>.scroll-fade{opacity:1}verdocs-send .recipient-detail verdocs-contact-picker{-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .section-title{font-size:12px;font-weight:600;color:var(--send-ink-2);margin:0 0 6px 0}verdocs-send .delivery-title{margin-top:16px}verdocs-send .step{font-size:11px;color:var(--send-muted);padding:10px 0 4px 0}verdocs-send .recipient,verdocs-send .kv{all:unset;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;border-top:1px solid var(--send-rule);color:var(--send-ink);font-family:inherit}verdocs-send .recipient:focus-visible,verdocs-send .kv:focus-visible{outline:2px solid var(--send-accent);outline-offset:-2px;border-radius:4px}verdocs-send .recipient .chevron,verdocs-send .kv .chevron{-ms-flex:0 0 16px;flex:0 0 16px;width:16px;height:16px;color:var(--send-faint)}verdocs-send .recipient .chevron svg,verdocs-send .kv .chevron svg{width:16px;height:16px;display:block}verdocs-send .recipient{padding:8px 6px 8px 0}verdocs-send .recipient:last-child{border-bottom:1px solid var(--send-rule)}verdocs-send .recipient .who{-ms-flex:1;flex:1;min-width:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .recipient .role-name{font-size:13px;font-weight:600}verdocs-send .recipient .who-detail{font-size:12px;color:var(--send-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .recipient .who-detail.configure{color:var(--send-accent);font-weight:500}verdocs-send .recipient .options{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:4px;margin-top:3px}verdocs-send .recipient .pill{height:18px;padding:0 6px;border-radius:999px;font-size:10px;font-weight:500;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;background:var(--send-accent-tint);color:var(--send-ink-2)}verdocs-send .role-dot{-ms-flex:0 0 10px;flex:0 0 10px;width:10px;height:10px;border-radius:50%;border:1px solid rgba(0, 0, 0, 0.1)}verdocs-send .kv{height:40px;padding:0 6px 0 0;font-size:13px}verdocs-send .kv:last-child{border-bottom:1px solid var(--send-rule)}verdocs-send .kv:disabled{cursor:default;color:var(--send-muted)}verdocs-send .kv .key{-ms-flex:0 0 84px;flex:0 0 84px;color:var(--send-muted)}verdocs-send .kv .value{-ms-flex:1;flex:1;min-width:0;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .kv .value small{font-size:inherit;font-weight:400;color:var(--send-muted)}verdocs-send .kv .value.off{color:var(--send-warning-icon)}verdocs-send .main-spacer,verdocs-send .detail-spacer{-ms-flex:1;flex:1}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:14px;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}verdocs-send .buttons .error-message{width:100%;color:#cc0000;font-size:13px;margin-bottom:10px}verdocs-send .detail-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin:-2px 0 14px 0}verdocs-send .detail-header .back{all:unset;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;cursor:pointer;font-size:13px;font-weight:500;color:var(--send-accent);font-family:inherit;-ms-flex:0 0 52px;flex:0 0 52px}verdocs-send .detail-header .back .icon,verdocs-send .detail-header .back .icon svg{width:16px;height:16px;display:block}verdocs-send .detail-header .back:focus-visible{outline:2px solid var(--send-accent);outline-offset:2px;border-radius:4px}verdocs-send .detail-header .detail-title{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;font-size:14px;font-weight:600;text-align:center}verdocs-send .detail-header .detail-header-spacer{-ms-flex:0 0 52px;flex:0 0 52px}verdocs-send .detail-footer{margin-top:10px;padding-top:12px;border-top:1px solid var(--send-rule)}verdocs-send .detail-footer verdocs-button,verdocs-send .detail-footer verdocs-button button{width:100%}verdocs-send .hint{font-size:12px;line-height:1.5;color:var(--send-muted);margin:10px 0 0 0}verdocs-send .option-list{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .option{all:unset;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;padding:10px 0;font-size:13px;font-family:inherit;color:var(--send-ink);border-top:1px solid var(--send-rule)}verdocs-send .option:first-child{border-top:0}verdocs-send .option:focus-visible{outline:2px solid var(--send-accent);outline-offset:-2px;border-radius:4px}verdocs-send .option .radio{-ms-flex:0 0 16px;flex:0 0 16px;width:16px;height:16px;border-radius:50%;border:1px solid var(--send-control-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-send .option.selected .radio{border-color:var(--send-accent)}verdocs-send .option.selected .radio::after{content:"";width:8px;height:8px;border-radius:50%;background:var(--send-accent)}verdocs-send .option .swatch{-ms-flex:0 0 22px;flex:0 0 22px;width:22px;height:22px;border-radius:5px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-size:9px;font-weight:700;color:#ffffff;overflow:hidden}verdocs-send .option .swatch.logo{background:#ffffff;border:1px solid var(--send-rule)}verdocs-send .option .swatch img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain;display:block}verdocs-send .option .option-label{-ms-flex:1;flex:1;min-width:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .option .option-label small{font-size:11px;color:var(--send-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .option-divider{height:0;margin:2px 0;border-top:1px solid var(--send-control-border)}verdocs-send .option-divider+.option{border-top:0}verdocs-send .hint a{color:var(--send-accent);font-weight:500;text-decoration:none;border-bottom:1px solid var(--send-accent-tint-2)}verdocs-send .hint a .icon,verdocs-send .hint a .icon svg{width:11px;height:11px;display:inline-block;vertical-align:-1px;margin-left:2px}verdocs-send .expires-field{position:relative}verdocs-send .expires-field input{width:100%;height:36px;padding:0 52px 0 10px;font-size:14px;font-family:inherit;color:var(--send-ink);background:#ffffff;border:1px solid var(--send-control-border);border-radius:6px;outline:none}verdocs-send .expires-field input:focus{border-color:var(--send-accent);-webkit-box-shadow:0 0 0 2px var(--send-accent-tint-2);box-shadow:0 0 0 2px var(--send-accent-tint-2)}verdocs-send .expires-field input::-webkit-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::-moz-placeholder{color:var(--send-faint)}verdocs-send .expires-field input:-ms-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::-ms-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::placeholder{color:var(--send-faint)}verdocs-send .expires-field .suffix{position:absolute;right:10px;top:0;height:36px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;font-size:13px;color:var(--send-muted);pointer-events:none}verdocs-send .sender-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;row-gap:4px;margin:0 0 10px 0}verdocs-send .sender-field label{font-size:12px;font-weight:500;color:var(--send-ink-2)}verdocs-send .sender-field input{width:100%;height:36px;padding:0 10px;font-size:14px;font-family:inherit;color:var(--send-ink);background:#ffffff;border:1px solid var(--send-control-border);border-radius:6px;outline:none}verdocs-send .sender-field input:focus{border-color:var(--send-accent);-webkit-box-shadow:0 0 0 2px var(--send-accent-tint-2);box-shadow:0 0 0 2px var(--send-accent-tint-2)}verdocs-send .sender-field .field-error{font-size:12px;color:#cc0000}verdocs-send .notice{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-top:4px;padding:10px 12px;font-size:12px;line-height:1.5;border-radius:6px;color:var(--send-ink-2);background:var(--send-accent-tint);border:1px solid var(--send-accent-tint-2)}verdocs-send .notice>.icon{-ms-flex:0 0 18px;flex:0 0 18px;width:18px;height:18px;margin-top:1px;color:var(--send-accent)}verdocs-send .notice>.icon svg{width:18px;height:18px;display:block}verdocs-send .warning{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-top:12px;padding:10px 12px;font-size:12px;line-height:1.5;border-radius:6px;color:var(--send-warning-text);background:var(--send-warning-bg);border:1px solid var(--send-warning-border)}verdocs-send .warning>.icon{-ms-flex:0 0 18px;flex:0 0 18px;width:18px;height:18px;margin-top:1px;color:var(--send-warning-icon)}verdocs-send .warning>.icon svg{width:18px;height:18px;display:block}verdocs-send .warning a{color:var(--send-accent);font-weight:500;text-decoration:none;border-bottom:1px solid var(--send-accent-tint-2)}verdocs-send .warning a .icon,verdocs-send .warning a .icon svg{width:11px;height:11px;display:inline-block;vertical-align:-1px;margin-left:2px}verdocs-send verdocs-checkbox{display:block;padding:4px 0;font-size:13px}`;const j='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 6 6 6-6 6"/></svg>';const B='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>';const I='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4M12 17h.01"/></svg>';const _='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>';const T='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M10 14 21 3M21 14v7H3V3h7"/></svg>';const L="https://app.verdocs.com/assets/blue-logo.svg";const V=.25;const $=60;const R=500;const H=1;const O=120;const G=120;const A={email:"Email",passcode:"Passcode",sms:"SMS",kba:"KBA",id:"ID check"};const P=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.beforeSend=i(this,"beforeSend");this.send=i(this,"send");this.exit=i(this,"exit");this.sdkError=i(this,"sdkError");this.searchContacts=i(this,"searchContacts");this.templateListenerId=null;this.endpoint=v;this.templateId=null;this.environment="";this.showCancel=true;this.brandKey="";this.swipeStart=null;this.swallowNextClick=false;this.loadedOrganizationId="";this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`;this.view="main";this.editingRoleId="";this.sessionContacts=[];this.sending=false;this.brands=[];this.organization=null;this.expiresInDays="";this.noContact=false;this.senderDefaults={name:"",email:""};this.senderName="";this.senderEmail="";this.rolesCompleted={};this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}componentDidLoad(){this.el.addEventListener("click",(e=>{if(this.swallowNextClick){this.swallowNextClick=false;e.stopPropagation();e.preventDefault()}}),true)}componentDidRender(){var e,s;m(this.el.querySelector(".detail-body"));(e=this.el.querySelector(".main-pane"))===null||e===void 0?void 0:e.toggleAttribute("inert",this.view!=="main");(s=this.el.querySelector(".detail-pane"))===null||s===void 0?void 0:s.toggleAttribute("inert",this.view==="main")}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();w.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),true,(e=>{console.log("[SEND] Got new template",e);this.template=e;this.loading=false;this.rolesCompleted={};this.view="main";this.editingRoleId="";this.recomputeRolesCompleted();this.loadBrands()}))}loadBrands(){var e;const s=(e=this.template)===null||e===void 0?void 0:e.organization_id;if(!s||s===this.loadedOrganizationId){return}const i=!!this.loadedOrganizationId;this.loadedOrganizationId=s;this.brands=[];this.organization=null;if(i){this.brandKey=""}const n=()=>{var e;return((e=this.template)===null||e===void 0?void 0:e.organization_id)===s};d(this.endpoint,s).then((e=>{if(n()){this.brands=e||[]}})).catch((e=>console.log("[SEND] Unable to load brands",e)));a(this.endpoint,s).then((e=>{if(n()){this.organization=e}})).catch((e=>console.log("[SEND] Unable to load organization",e)))}handleExpiryInput(e){const s=(e.target.value||"").replace(/[^0-9]/g,"");this.expiresInDays=s?String(Math.min(Math.max(Number(s),H),O)):"";e.target.value=this.expiresInDays}effectiveExpiryDays(){const e=Number(this.expiresInDays);return e>=H?e:G}expiresAt(){return new Date(Date.now()+this.effectiveExpiryDays()*24*60*60*1e3)}unlistenToTemplate(){if(this.templateListenerId){w.store.delListener(this.templateListenerId);this.templateListenerId=null}}async reset(){this.rolesCompleted={};this.view="main";this.editingRoleId="";this.brandKey="";this.expiresInDays="";this.noContact=false;this.senderName="";this.senderEmail=""}effectiveSenderName(){return this.senderName||this.senderDefaults.name}effectiveSenderEmail(){return this.senderEmail||this.senderDefaults.email}senderOverrides(){const e=this.senderName.trim();const s=this.senderEmail.trim();return{sender_name:e&&e!==this.senderDefaults.name?e:undefined,sender_email:s&&s!==this.senderDefaults.email?s:undefined}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,s,i;try{this.endpoint.onSessionChanged(((e,s,i)=>{if(!i){return}const n={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){this.senderDefaults={name:l(i),email:i.email||""};this.sessionContacts=[n];c(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e);this.sessionContacts=[...e,n]})).catch((e=>{console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return}if(!this.templateId){console.log(`[SEND] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(n){console.log("[SEND] Error with send session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new g(n.message,(s=n.response)===null||s===void 0?void 0:s.status,(i=n.response)===null||i===void 0?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const s={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence;s[i]||(s[i]=[]);const n=`r-${i}-${s[i].length}`;s[i].push({...e,id:n,role_name:e.name,first_name:e.first_name,last_name:e.last_name});if(e.first_name&&p(e.email)){this.rolesCompleted[n]={...e,id:n,role_name:e.name,first_name:e.first_name,last_name:e.last_name}}}))}getSequenceNumbers(){var e;const s={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{s[e.sequence]=true}));return Object.keys(s).map((e=>+e)).sort(((e,s)=>e-s))}getRolesAtLevel(e){var s;const i=(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).filter((s=>s.sequence===e)).map(((s,i)=>({...s,id:`r-${e}-${i}`,role_name:s.name,first_name:s.first_name,last_name:s.last_name})));return i}getRoleById(e){for(const s of this.getSequenceNumbers()){const i=this.getRolesAtLevel(s).find((s=>s.id===e));if(i){return i}}return null}getRecipientOptionLabels(e){if(!e){return[]}const s=(e.auth_methods||[]).filter((e=>e!=="email")).map((e=>A[e]||e));if(e.delegator){s.push("May delegate")}if(e.name_locked){s.push("Name locked")}return s}getDefaultBrand(){var e;const s=(e=this.organization)===null||e===void 0?void 0:e.default_brand_id;return s&&this.brands.find((e=>e.id===s))||null}getDefaultBrandLabel(){var e;const s=(e=this.getDefaultBrand())===null||e===void 0?void 0:e.name;return`Default (${s||"Verdocs"})`}getSelectedBrandLabel(){if(!this.brandKey){return this.getDefaultBrandLabel()}const e=this.brands.find((e=>e.key===this.brandKey));return(e===null||e===void 0?void 0:e.name)||(e===null||e===void 0?void 0:e.key)||this.brandKey}showView(e){this.view=e}handleSelectContact(e,s){e.preventDefault();this.rolesCompleted={...this.rolesCompleted,[s.id]:{...s,...e.detail}};this.editingRoleId="";this.view="main"}handleClickRole(e,s){e.stopPropagation();this.editingRoleId=s.id;this.view="recipient"}handleSend(e){var s;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;const i=Intl.DateTimeFormat().resolvedOptions();const n={template_id:this.templateId,name:((s=this.template)===null||s===void 0?void 0:s.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),timezone:i.timeZone,locale:i.locale,expires_at:this.expiresAt().toISOString()};n.no_contact=this.noContact;const{sender_name:t,sender_email:o}=this.senderOverrides();if(t){n.sender_name=t}if(o){n.sender_email=o}if(this.brandKey){n.brand_key=this.brandKey}const r=this.beforeSend.emit({...n,name:n.name,template:this.template});if(r.defaultPrevented){console.log("[SEND] Send cancelled by parent",n);this.sending=false;return}console.log("[SEND] Creating envelope",n);h(this.endpoint,n).then((e=>{var s;console.log("[SEND] Send envelope",e);this.reset().catch((e=>console.log("Unknown Error",e)));this.sending=false;(s=this.send)===null||s===void 0?void 0:s.emit({...n,name:n.name,envelope_id:e.id,envelope:e})})).catch((e=>{var s,i,n;console.log("[SEND] Send error",e);b(((i=(s=e.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.error)||"Error creating envelope, please try again later.");this.sending=false;(n=this.sdkError)===null||n===void 0?void 0:n.emit(e)}))}handleCancel(e){var s;e.stopPropagation();(s=this.exit)===null||s===void 0?void 0:s.emit()}handleSwipeStart(e){var s,i;this.swallowNextClick=false;const n=e.currentTarget;const t=n.getBoundingClientRect();const o=!!((i=(s=e.target)===null||s===void 0?void 0:s.closest)===null||i===void 0?void 0:i.call(s,"input, textarea, select, [contenteditable]"));if(this.view==="main"||o||e.clientX-t.left>t.width*V){this.swipeStart=null;return}this.swipeStart={x:e.clientX,y:e.clientY,time:Date.now()}}handleSwipeEnd(e){const s=this.swipeStart;this.swipeStart=null;if(!s){return}const i=e.clientX-s.x;const n=Math.abs(e.clientY-s.y);if(i>=$&&i>n&&Date.now()-s.time<=R){this.swallowNextClick=true;this.showView("main")}}renderDetailHeader(e){return n("div",{class:"detail-header"},n("button",{type:"button",class:"back",onClick:()=>this.showView("main")},n("span",{class:"icon",innerHTML:B}),"Back"),n("div",{class:"detail-title"},e),n("div",{class:"detail-header-spacer"}))}renderDetailBody(e){return n("div",{class:"detail-body-wrap"},n("div",{class:"detail-body",onScroll:e=>m(e.target)},e),n("div",{class:"scroll-fade"}))}renderDoneButton(){return n("div",{class:"detail-footer"},n("verdocs-button",{label:"Done",size:"small",onClick:()=>this.showView("main")}))}renderRecipientView(){var e;const s=this.getRoleById(this.editingRoleId);if(!s){return n("div",{class:"detail recipient-detail"},this.renderDetailHeader("Recipient"))}const i=N(this.template,s.role_name);return n("div",{class:"detail recipient-detail"},this.renderDetailHeader([n("span",{class:"role-dot",style:{backgroundColor:f(i)}}),s.role_name]),n("verdocs-contact-picker",{key:s.id,showCancel:false,onExit:()=>this.showView("main"),onNext:e=>this.handleSelectContact(e,s),contactSuggestions:this.sessionContacts,templateRole:(e=this.rolesCompleted[s.id])!==null&&e!==void 0?e:s,onSearchContacts:e=>{var s;return(s=this.searchContacts)===null||s===void 0?void 0:s.emit(e.detail)}}))}renderBrandSwatch(e,s){const i=(e===null||e===void 0?void 0:e.favicon_url)||(e===null||e===void 0?void 0:e.thumbnail_url)||(e?null:L);if(i){return n("span",{class:"swatch logo"},n("img",{src:i,alt:""}))}return n("span",{class:"swatch",style:{backgroundColor:(e===null||e===void 0?void 0:e.primary_color)||"#4c56cb"}},s.substring(0,2).toUpperCase())}renderBrandOption(e,s,i,t){return n("button",{type:"button",class:{option:true,selected:this.brandKey===e},onClick:()=>this.brandKey=e},n("span",{class:"radio"}),t,n("span",{class:"option-label"},s,n("small",null,i)))}renderBrandView(){const e=this.getDefaultBrand();const s=this.brands.filter((s=>s.id!==(e===null||e===void 0?void 0:e.id))).sort(((e,s)=>(e.name||e.key).localeCompare(s.name||s.key)));const i=this.brands.length>0;return n("div",{class:"detail"},this.renderDetailHeader("Brand"),this.renderDetailBody([n("div",{class:"option-list"},this.renderBrandOption("",this.getDefaultBrandLabel(),"Organization default",this.renderBrandSwatch(e,(e===null||e===void 0?void 0:e.name)||"V")),s.length>0&&n("div",{class:"option-divider"}),s.map((e=>this.renderBrandOption(e.key,e.name||e.key,e.key,this.renderBrandSwatch(e,e.name||e.key))))),!i&&n("p",{class:"hint"},"Configure the look and feel of the signing experience by"," ",n("a",{href:`${u(this.endpoint)}/settings/branding`,target:"_blank",rel:"noopener"},"Creating a Brand",n("span",{class:"icon",innerHTML:T})),".")]),this.renderDoneButton())}renderExpiresView(){const e=this.expiresAt();const s=`${e.toLocaleDateString(undefined,{month:"short",day:"numeric",year:"numeric"})} at ${e.toLocaleTimeString(undefined,{hour:"numeric",minute:"2-digit"})}`;return n("div",{class:"detail"},this.renderDetailHeader("Expiration"),this.renderDetailBody([n("div",{class:"expires-field"},n("input",{type:"text",inputMode:"numeric","aria-label":"Expires in (days)",placeholder:String(G),value:this.expiresInDays,disabled:this.sending,onInput:e=>this.handleExpiryInput(e)}),n("span",{class:"suffix"},"days")),n("p",{class:"hint"},"This envelope will expire on ",s,". Expirations may be set from ",H,"-",O," days. If left blank, this will default to ",G,".")]),this.renderDoneButton())}renderSenderView(){const e=!this.senderEmail.trim()||p(this.senderEmail.trim());return n("div",{class:"detail"},this.renderDetailHeader("Sender"),this.renderDetailBody([n("div",{class:"sender-field"},n("label",{htmlFor:`${this.containerId}-sender-name`},"Name"),n("input",{id:`${this.containerId}-sender-name`,type:"text",value:this.effectiveSenderName(),disabled:this.sending,onInput:e=>this.senderName=e.target.value})),n("div",{class:"sender-field"},n("label",{htmlFor:`${this.containerId}-sender-email`},"Email"),n("input",{id:`${this.containerId}-sender-email`,type:"email",value:this.effectiveSenderEmail(),disabled:this.sending,onInput:e=>this.senderEmail=e.target.value}),!e&&n("div",{class:"field-error"},"Enter a valid email address.")),n("div",{class:"notice"},n("span",{class:"icon",innerHTML:_}),n("div",null,"These set the name recipients see as the sender and where replies and notifications go. Messages are still delivered from the Verdocs address; a custom sender configured under Settings is needed for delivery from your own domain."))]),this.renderDoneButton())}renderNotificationsView(){return n("div",{class:"detail"},this.renderDetailHeader("Notifications"),this.renderDetailBody([n("verdocs-checkbox",{size:"small",label:"Disable notifications",checked:this.noContact,onInput:e=>this.noContact=!!e.target.checked}),this.noContact&&n("div",{class:"warning"},n("span",{class:"icon",innerHTML:I}),n("div",null,"Disabling notifications turns off invitations and reminders to recipients as well as status updates to you. You may obtain invite links in the recipient summary or via an API call. We strongly recommend enabling"," ",n("a",{href:`${u(this.endpoint)}/settings/webhooks`,target:"_blank",rel:"noopener"},"Webhooks",n("span",{class:"icon",innerHTML:T}))," ","to help automate this process."))]),this.renderDoneButton())}renderDetail(){switch(this.view){case"recipient":return this.renderRecipientView();case"brand":return this.renderBrandView();case"expires":return this.renderExpiresView();case"notifications":return this.renderNotificationsView();case"sender":return this.renderSenderView();default:return null}}render(){var e;if(this.loading){return n(t,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(t,{style:{display:"flex"}},n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const s=this.getSequenceNumbers();const i=Object.values(this.rolesCompleted).filter((e=>p(e.email)&&e.first_name&&e.last_name));const o=i.length>=z(this.template).length;const r=i.map((e=>e.email.toLowerCase()));const d=new Set(r).size<r.length;const a=this.expiresAt();const c=a.toLocaleDateString(undefined,{month:"short",day:"numeric"});return n(t,{class:{sendable:(e=this.template)===null||e===void 0?void 0:e.is_sendable,"detail-open":this.view!=="main"}},n("div",{class:"track"},n("div",{class:"pane main-pane","aria-hidden":this.view!=="main"?"true":"false"},n("div",{class:"section-title"},"Recipients"),n("div",{class:"recipients"},s.map((e=>[s.length>1&&n("div",{class:"step"},"Step ",e),this.getRolesAtLevel(e).map((e=>{const s=N(this.template,e.role_name);const t=this.rolesCompleted[e.id];const o=t&&i.findIndex((s=>s.role_name===e.role_name))>-1;const r=this.getRecipientOptionLabels(t);return n("button",{type:"button",class:"recipient","data-ri":s,"data-rn":e.role_name,onClick:s=>this.handleClickRole(s,e)},n("span",{class:"role-dot",style:{backgroundColor:f(s)}}),n("span",{class:"who"},n("span",{class:"role-name"},e.role_name),o?n("span",{class:"who-detail"},l(t)," · ",t.email):n("span",{class:"who-detail configure"},"Configure recipient"),r.length>0&&n("span",{class:"options"},r.map((e=>n("span",{class:"pill"},e))))),n("span",{class:"chevron",innerHTML:j}))}))]))),n("div",{class:"section-title delivery-title"},"Delivery"),n("div",{class:"delivery"},n("button",{type:"button",class:"kv",onClick:()=>this.showView("brand"),disabled:this.sending},n("span",{class:"key"},"Brand"),n("span",{class:"value"},this.getSelectedBrandLabel()),n("span",{class:"chevron",innerHTML:j})),n("button",{type:"button",class:"kv",onClick:()=>this.showView("expires"),disabled:this.sending},n("span",{class:"key"},"Expires"),n("span",{class:"value"},this.effectiveExpiryDays()," days ",n("small",null,"· ",c)),n("span",{class:"chevron",innerHTML:j})),n("button",{type:"button",class:"kv",onClick:()=>this.showView("sender"),disabled:this.sending},n("span",{class:"key"},"Sender"),n("span",{class:"value"},this.effectiveSenderName()||this.effectiveSenderEmail(),this.effectiveSenderName()&&this.effectiveSenderEmail()?n("small",null," · ",this.effectiveSenderEmail()):null),n("span",{class:"chevron",innerHTML:j})),n("button",{type:"button",class:"kv",onClick:()=>this.showView("notifications"),disabled:this.sending},n("span",{class:"key"},"Notifications"),n("span",{class:{value:true,off:this.noContact}},this.noContact?"Off":"On"),n("span",{class:"chevron",innerHTML:j}))),n("div",{class:"main-spacer"}),n("div",{class:"buttons"},d&&n("div",{class:"error-message"},"Recipients cannot share the same email."),this.sending&&n("verdocs-spinner",null),this.showCancel&&n("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),n("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending||d,onClick:e=>this.handleSend(e)}))),n("div",{class:"pane detail-pane","aria-hidden":this.view==="main"?"true":"false",onPointerDown:e=>this.handleSwipeStart(e),onPointerUp:e=>this.handleSwipeEnd(e),onPointerCancel:()=>this.swipeStart=null},this.renderDetail())))}get el(){return this}static get watchers(){return{templateId:[{onTemplateIdChanged:0}]}}static get style(){return M()}},[0,"verdocs-send",{endpoint:[16],templateId:[513,"template-id"],environment:[1],showCancel:[4,"show-cancel"],brandKey:[1025,"brand-key"],containerId:[32],view:[32],editingRoleId:[32],sessionContacts:[32],sending:[32],brands:[32],organization:[32],expiresInDays:[32],noContact:[32],senderDefaults:[32],senderName:[32],senderEmail:[32],rolesCompleted:[32],loading:[32],template:[32],reset:[64]},undefined,{templateId:[{onTemplateIdChanged:0}]}]);function U(){if(typeof customElements==="undefined"){return}const e=["verdocs-send","verdocs-button","verdocs-checkbox","verdocs-component-error","verdocs-contact-picker","verdocs-flag","verdocs-loader","verdocs-spinner"];e.forEach((e=>{switch(e){case"verdocs-send":if(!customElements.get(o(e))){customElements.define(o(e),P)}break;case"verdocs-button":if(!customElements.get(o(e))){k()}break;case"verdocs-checkbox":if(!customElements.get(o(e))){y()}break;case"verdocs-component-error":if(!customElements.get(o(e))){S()}break;case"verdocs-contact-picker":if(!customElements.get(o(e))){x()}break;case"verdocs-flag":if(!customElements.get(o(e))){E()}break;case"verdocs-loader":if(!customElements.get(o(e))){C()}break;case"verdocs-spinner":if(!customElements.get(o(e))){D()}break}}))}export{P as V,U as d};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as s,c as i,h as t,d as n,t as o}from"./p-yZBlG3YQ.js";import{getTemplate as r,getBrands as d,getOrganization as a,formatFullName as l,getOrganizationContacts as c,isValidEmail as p,createEnvelope as h,getRGBA as f}from"@verdocs/js-sdk";import{D as v,g as u}from"./p-Cq60Emo_.js";import{u as m,d as x}from"./p-ByrpRZ3E.js";import{V as b}from"./p-D97GxsI-.js";import{S as g}from"./p-C1sRVZWv.js";import{S as w}from"./p-C7hFgM52.js";import{d as k}from"./p-Bb5V9TQx.js";import{d as y}from"./p-DGNIsXfr.js";import{d as S}from"./p-C-v22G3g.js";import{d as E}from"./p-C8yiLtCJ.js";import{d as D}from"./p-DqzFuSNN.js";import{d as C}from"./p-DreV6Npp.js";const z=e=>((e===null||e===void 0?void 0:e.roles)||[]).map((e=>e.name));const N=(e,s)=>Math.max(z(e).findIndex((e=>e===s)),0);const j=()=>`verdocs-send{--send-ink:var(--verdocs-body-color, #111827);--send-ink-2:#374151;--send-muted:#6b7280;--send-faint:#9ca3af;--send-rule:#e5e7eb;--send-control-border:#d1d5db;--send-accent:var(--verdocs-link-color, #4c56cb);--send-accent-tint:#f4f5fc;--send-accent-tint-2:#e6e7f8;--send-warning-bg:#fffbeb;--send-warning-border:#fde68a;--send-warning-icon:#d97706;--send-warning-text:#78350f;--send-radius:var(--verdocs-dialog-radius, 8px);--send-min-height:480px;--send-max-width:480px;display:none;position:relative;overflow:hidden;width:100%;max-width:var(--verdocs-send-max-width, var(--send-max-width));-webkit-box-sizing:border-box;box-sizing:border-box;background:#ffffff;color:var(--send-ink);font-size:14px;border-radius:var(--send-radius);border:1px solid var(--send-rule);font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-send *{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-send.sendable{display:block}verdocs-send .track{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:var(--send-min-height);-webkit-transition:-webkit-transform 220ms ease-out;transition:-webkit-transform 220ms ease-out;transition:transform 220ms ease-out;transition:transform 220ms ease-out, -webkit-transform 220ms ease-out}verdocs-send.detail-open .track{-webkit-transform:translateX(-100%);transform:translateX(-100%)}@media (prefers-reduced-motion: reduce){verdocs-send .track{-webkit-transition:none;transition:none}}verdocs-send .pane{padding:16px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .main-pane{-ms-flex:1;flex:1}verdocs-send .detail-pane{position:absolute;top:0;left:100%;bottom:0;width:100%;overflow:hidden}verdocs-send .detail{-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .detail-body-wrap{position:relative;-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .detail-body{-ms-flex:1;flex:1;min-height:0;overflow-y:auto}verdocs-send .scroll-fade{position:absolute;left:0;right:0;bottom:0;height:36px;opacity:0;pointer-events:none;-webkit-transition:opacity 150ms ease-out;transition:opacity 150ms ease-out;background:-webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0)), to(#ffffff));background:linear-gradient(rgba(255, 255, 255, 0), #ffffff)}verdocs-send .scrollable:not(.at-end)>.scroll-fade{opacity:1}verdocs-send .recipient-detail verdocs-contact-picker{-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .section-title{font-size:12px;font-weight:600;color:var(--send-ink-2);margin:0 0 6px 0}verdocs-send .delivery-title{margin-top:16px}verdocs-send .step{font-size:11px;color:var(--send-muted);padding:10px 0 4px 0}verdocs-send .recipient,verdocs-send .kv{all:unset;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;border-top:1px solid var(--send-rule);color:var(--send-ink);font-family:inherit}verdocs-send .recipient:focus-visible,verdocs-send .kv:focus-visible{outline:2px solid var(--send-accent);outline-offset:-2px;border-radius:4px}verdocs-send .recipient .chevron,verdocs-send .kv .chevron{-ms-flex:0 0 16px;flex:0 0 16px;width:16px;height:16px;color:var(--send-faint)}verdocs-send .recipient .chevron svg,verdocs-send .kv .chevron svg{width:16px;height:16px;display:block}verdocs-send .recipient{padding:8px 6px 8px 0}verdocs-send .recipient:last-child{border-bottom:1px solid var(--send-rule)}verdocs-send .recipient .who{-ms-flex:1;flex:1;min-width:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .recipient .role-name{font-size:13px;font-weight:600}verdocs-send .recipient .who-detail{font-size:12px;color:var(--send-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .recipient .who-detail.configure{color:var(--send-accent);font-weight:500}verdocs-send .recipient .options{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:4px;margin-top:3px}verdocs-send .recipient .pill{height:18px;padding:0 6px;border-radius:999px;font-size:10px;font-weight:500;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;background:var(--send-accent-tint);color:var(--send-ink-2)}verdocs-send .role-dot{-ms-flex:0 0 10px;flex:0 0 10px;width:10px;height:10px;border-radius:50%;border:1px solid rgba(0, 0, 0, 0.1)}verdocs-send .kv{height:40px;padding:0 6px 0 0;font-size:13px}verdocs-send .kv:last-child{border-bottom:1px solid var(--send-rule)}verdocs-send .kv:disabled{cursor:default;color:var(--send-muted)}verdocs-send .kv .key{-ms-flex:0 0 84px;flex:0 0 84px;color:var(--send-muted)}verdocs-send .kv .value{-ms-flex:1;flex:1;min-width:0;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .kv .value small{font-size:inherit;font-weight:400;color:var(--send-muted)}verdocs-send .kv .value.off{color:var(--send-warning-icon)}verdocs-send .main-spacer,verdocs-send .detail-spacer{-ms-flex:1;flex:1}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:14px;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}verdocs-send .buttons .error-message{width:100%;color:#cc0000;font-size:13px;margin-bottom:10px}verdocs-send .detail-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin:-2px 0 14px 0}verdocs-send .detail-header .back{all:unset;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;cursor:pointer;font-size:13px;font-weight:500;color:var(--send-accent);font-family:inherit;-ms-flex:0 0 52px;flex:0 0 52px}verdocs-send .detail-header .back .icon,verdocs-send .detail-header .back .icon svg{width:16px;height:16px;display:block}verdocs-send .detail-header .back:focus-visible{outline:2px solid var(--send-accent);outline-offset:2px;border-radius:4px}verdocs-send .detail-header .detail-title{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;font-size:14px;font-weight:600;text-align:center}verdocs-send .detail-header .detail-header-spacer{-ms-flex:0 0 52px;flex:0 0 52px}verdocs-send .detail-footer{margin-top:10px;padding-top:12px;border-top:1px solid var(--send-rule)}verdocs-send .detail-footer verdocs-button,verdocs-send .detail-footer verdocs-button button{width:100%}verdocs-send .hint{font-size:12px;line-height:1.5;color:var(--send-muted);margin:10px 0 0 0}verdocs-send .option-list{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .option{all:unset;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;padding:10px 0;font-size:13px;font-family:inherit;color:var(--send-ink);border-top:1px solid var(--send-rule)}verdocs-send .option:first-child{border-top:0}verdocs-send .option:focus-visible{outline:2px solid var(--send-accent);outline-offset:-2px;border-radius:4px}verdocs-send .option .radio{-ms-flex:0 0 16px;flex:0 0 16px;width:16px;height:16px;border-radius:50%;border:1px solid var(--send-control-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-send .option.selected .radio{border-color:var(--send-accent)}verdocs-send .option.selected .radio::after{content:"";width:8px;height:8px;border-radius:50%;background:var(--send-accent)}verdocs-send .option .swatch{-ms-flex:0 0 22px;flex:0 0 22px;width:22px;height:22px;border-radius:5px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-size:9px;font-weight:700;color:#ffffff;overflow:hidden}verdocs-send .option .swatch.logo{background:#ffffff;border:1px solid var(--send-rule)}verdocs-send .option .swatch img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain;display:block}verdocs-send .option .option-label{-ms-flex:1;flex:1;min-width:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .option .option-label small{font-size:11px;color:var(--send-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .option-divider{height:0;margin:2px 0;border-top:1px solid var(--send-control-border)}verdocs-send .option-divider+.option{border-top:0}verdocs-send .hint a{color:var(--send-accent);font-weight:500;text-decoration:none;border-bottom:1px solid var(--send-accent-tint-2)}verdocs-send .hint a .icon,verdocs-send .hint a .icon svg{width:11px;height:11px;display:inline-block;vertical-align:-1px;margin-left:2px}verdocs-send .expires-field{position:relative}verdocs-send .expires-field input{width:100%;height:36px;padding:0 52px 0 10px;font-size:14px;font-family:inherit;color:var(--send-ink);background:#ffffff;border:1px solid var(--send-control-border);border-radius:6px;outline:none}verdocs-send .expires-field input:focus{border-color:var(--send-accent);-webkit-box-shadow:0 0 0 2px var(--send-accent-tint-2);box-shadow:0 0 0 2px var(--send-accent-tint-2)}verdocs-send .expires-field input::-webkit-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::-moz-placeholder{color:var(--send-faint)}verdocs-send .expires-field input:-ms-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::-ms-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::placeholder{color:var(--send-faint)}verdocs-send .expires-field .suffix{position:absolute;right:10px;top:0;height:36px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;font-size:13px;color:var(--send-muted);pointer-events:none}verdocs-send .sender-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;row-gap:4px;margin:0 0 10px 0}verdocs-send .sender-field label{font-size:12px;font-weight:500;color:var(--send-ink-2)}verdocs-send .sender-field input{width:100%;height:36px;padding:0 10px;font-size:14px;font-family:inherit;color:var(--send-ink);background:#ffffff;border:1px solid var(--send-control-border);border-radius:6px;outline:none}verdocs-send .sender-field input:focus{border-color:var(--send-accent);-webkit-box-shadow:0 0 0 2px var(--send-accent-tint-2);box-shadow:0 0 0 2px var(--send-accent-tint-2)}verdocs-send .sender-field .field-error{font-size:12px;color:#cc0000}verdocs-send .notice{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-top:4px;padding:10px 12px;font-size:12px;line-height:1.5;border-radius:6px;color:var(--send-ink-2);background:var(--send-accent-tint);border:1px solid var(--send-accent-tint-2)}verdocs-send .notice>.icon{-ms-flex:0 0 18px;flex:0 0 18px;width:18px;height:18px;margin-top:1px;color:var(--send-accent)}verdocs-send .notice>.icon svg{width:18px;height:18px;display:block}verdocs-send .warning{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-top:12px;padding:10px 12px;font-size:12px;line-height:1.5;border-radius:6px;color:var(--send-warning-text);background:var(--send-warning-bg);border:1px solid var(--send-warning-border)}verdocs-send .warning>.icon{-ms-flex:0 0 18px;flex:0 0 18px;width:18px;height:18px;margin-top:1px;color:var(--send-warning-icon)}verdocs-send .warning>.icon svg{width:18px;height:18px;display:block}verdocs-send .warning a{color:var(--send-accent);font-weight:500;text-decoration:none;border-bottom:1px solid var(--send-accent-tint-2)}verdocs-send .warning a .icon,verdocs-send .warning a .icon svg{width:11px;height:11px;display:inline-block;vertical-align:-1px;margin-left:2px}verdocs-send verdocs-checkbox{display:block;padding:4px 0;font-size:13px}`;const M='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 6 6 6-6 6"/></svg>';const B='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>';const I='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4M12 17h.01"/></svg>';const _='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>';const T='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M10 14 21 3M21 14v7H3V3h7"/></svg>';const L="https://app.verdocs.com/assets/blue-logo.svg";const $=.25;const R=60;const V=500;const H=1;const O=120;const G=120;const A={email:"Email",passcode:"Passcode",sms:"SMS",kba:"KBA",id:"ID check"};const P=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.beforeSend=i(this,"beforeSend");this.send=i(this,"send");this.exit=i(this,"exit");this.sdkError=i(this,"sdkError");this.searchContacts=i(this,"searchContacts");this.templateListenerId=null;this.endpoint=v;this.templateId=null;this.environment="";this.showCancel=true;this.brandKey="";this.swipeStart=null;this.swallowNextClick=false;this.loadedOrganizationId="";this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`;this.view="main";this.editingRoleId="";this.sessionContacts=[];this.sending=false;this.brands=[];this.organization=null;this.expiresInDays="";this.noContact=false;this.senderDefaults={name:"",email:""};this.senderName="";this.senderEmail="";this.rolesCompleted={};this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}componentDidLoad(){this.el.addEventListener("click",(e=>{if(this.swallowNextClick){this.swallowNextClick=false;e.stopPropagation();e.preventDefault()}}),true)}componentDidRender(){var e,s;m(this.el.querySelector(".detail-body"));(e=this.el.querySelector(".main-pane"))===null||e===void 0?void 0:e.toggleAttribute("inert",this.view!=="main");(s=this.el.querySelector(".detail-pane"))===null||s===void 0?void 0:s.toggleAttribute("inert",this.view==="main")}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();w.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),true,(e=>{console.log("[SEND] Got new template",e);this.template=e;this.loading=false;this.rolesCompleted={};this.view="main";this.editingRoleId="";this.recomputeRolesCompleted();this.loadBrands()}))}loadBrands(){var e;const s=(e=this.template)===null||e===void 0?void 0:e.organization_id;if(!s||s===this.loadedOrganizationId){return}const i=!!this.loadedOrganizationId;this.loadedOrganizationId=s;this.brands=[];this.organization=null;if(i){this.brandKey=""}const t=()=>{var e;return((e=this.template)===null||e===void 0?void 0:e.organization_id)===s};d(this.endpoint,s).then((e=>{if(t()){this.brands=e||[]}})).catch((e=>console.log("[SEND] Unable to load brands",e)));a(this.endpoint,s).then((e=>{if(t()){this.organization=e}})).catch((e=>console.log("[SEND] Unable to load organization",e)))}handleExpiryInput(e){const s=(e.target.value||"").replace(/[^0-9]/g,"");this.expiresInDays=s?String(Math.min(Math.max(Number(s),H),O)):"";e.target.value=this.expiresInDays}effectiveExpiryDays(){const e=Number(this.expiresInDays);return e>=H?e:G}expiresAt(){return new Date(Date.now()+this.effectiveExpiryDays()*24*60*60*1e3)}unlistenToTemplate(){if(this.templateListenerId){w.store.delListener(this.templateListenerId);this.templateListenerId=null}}async reset(){this.rolesCompleted={};this.view="main";this.editingRoleId="";this.brandKey="";this.expiresInDays="";this.noContact=false;this.senderName="";this.senderEmail=""}brandSenderName(){var e;const s=this.brandKey?this.brands.find((e=>e.key===this.brandKey)):this.getDefaultBrand();return(s===null||s===void 0?void 0:s.email_display_name)||(s===null||s===void 0?void 0:s.email_sender_name)||((e=this.organization)===null||e===void 0?void 0:e.name)||""}effectiveSenderName(){return this.senderName||this.brandSenderName()}effectiveSenderEmail(){return this.senderEmail||this.senderDefaults.email}senderOverrides(){const e=this.senderName.trim();const s=this.senderEmail.trim();return{sender_name:e&&e!==this.brandSenderName()?e:undefined,sender_email:s&&s!==this.senderDefaults.email?s:undefined}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,s,i;try{this.endpoint.onSessionChanged(((e,s,i)=>{if(!i){return}const t={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){this.senderDefaults={name:l(i),email:i.email||""};this.sessionContacts=[t];c(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e);this.sessionContacts=[...e,t]})).catch((e=>{console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return}if(!this.templateId){console.log(`[SEND] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(t){console.log("[SEND] Error with send session",t);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new g(t.message,(s=t.response)===null||s===void 0?void 0:s.status,(i=t.response)===null||i===void 0?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const s={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence;s[i]||(s[i]=[]);const t=`r-${i}-${s[i].length}`;s[i].push({...e,id:t,role_name:e.name,first_name:e.first_name,last_name:e.last_name});if(e.first_name&&p(e.email)){this.rolesCompleted[t]={...e,id:t,role_name:e.name,first_name:e.first_name,last_name:e.last_name}}}))}getSequenceNumbers(){var e;const s={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{s[e.sequence]=true}));return Object.keys(s).map((e=>+e)).sort(((e,s)=>e-s))}getRolesAtLevel(e){var s;const i=(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).filter((s=>s.sequence===e)).map(((s,i)=>({...s,id:`r-${e}-${i}`,role_name:s.name,first_name:s.first_name,last_name:s.last_name})));return i}getRoleById(e){for(const s of this.getSequenceNumbers()){const i=this.getRolesAtLevel(s).find((s=>s.id===e));if(i){return i}}return null}getRecipientOptionLabels(e){if(!e){return[]}const s=(e.auth_methods||[]).filter((e=>e!=="email")).map((e=>A[e]||e));if(e.delegator){s.push("May delegate")}if(e.name_locked){s.push("Name locked")}return s}getDefaultBrand(){var e;const s=(e=this.organization)===null||e===void 0?void 0:e.default_brand_id;return s&&this.brands.find((e=>e.id===s))||null}getDefaultBrandLabel(){var e;const s=(e=this.getDefaultBrand())===null||e===void 0?void 0:e.name;return`Default (${s||"Verdocs"})`}getSelectedBrandLabel(){if(!this.brandKey){return this.getDefaultBrandLabel()}const e=this.brands.find((e=>e.key===this.brandKey));return(e===null||e===void 0?void 0:e.name)||(e===null||e===void 0?void 0:e.key)||this.brandKey}showView(e){this.view=e}handleSelectContact(e,s){e.preventDefault();this.rolesCompleted={...this.rolesCompleted,[s.id]:{...s,...e.detail}};this.editingRoleId="";this.view="main"}handleClickRole(e,s){e.stopPropagation();this.editingRoleId=s.id;this.view="recipient"}handleSend(e){var s;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;const i=Intl.DateTimeFormat().resolvedOptions();const t={template_id:this.templateId,name:((s=this.template)===null||s===void 0?void 0:s.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),timezone:i.timeZone,locale:i.locale,expires_at:this.expiresAt().toISOString()};t.no_contact=this.noContact;const{sender_name:n,sender_email:o}=this.senderOverrides();if(n){t.sender_name=n}if(o){t.sender_email=o}if(this.brandKey){t.brand_key=this.brandKey}const r=this.beforeSend.emit({...t,name:t.name,template:this.template});if(r.defaultPrevented){console.log("[SEND] Send cancelled by parent",t);this.sending=false;return}console.log("[SEND] Creating envelope",t);h(this.endpoint,t).then((e=>{var s;console.log("[SEND] Send envelope",e);this.reset().catch((e=>console.log("Unknown Error",e)));this.sending=false;(s=this.send)===null||s===void 0?void 0:s.emit({...t,name:t.name,envelope_id:e.id,envelope:e})})).catch((e=>{var s,i,t;console.log("[SEND] Send error",e);b(((i=(s=e.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.error)||"Error creating envelope, please try again later.");this.sending=false;(t=this.sdkError)===null||t===void 0?void 0:t.emit(e)}))}handleCancel(e){var s;e.stopPropagation();(s=this.exit)===null||s===void 0?void 0:s.emit()}handleSwipeStart(e){var s,i;this.swallowNextClick=false;const t=e.currentTarget;const n=t.getBoundingClientRect();const o=!!((i=(s=e.target)===null||s===void 0?void 0:s.closest)===null||i===void 0?void 0:i.call(s,"input, textarea, select, [contenteditable]"));if(this.view==="main"||o||e.clientX-n.left>n.width*$){this.swipeStart=null;return}this.swipeStart={x:e.clientX,y:e.clientY,time:Date.now()}}handleSwipeEnd(e){const s=this.swipeStart;this.swipeStart=null;if(!s){return}const i=e.clientX-s.x;const t=Math.abs(e.clientY-s.y);if(i>=R&&i>t&&Date.now()-s.time<=V){this.swallowNextClick=true;this.showView("main")}}renderDetailHeader(e){return t("div",{class:"detail-header"},t("button",{type:"button",class:"back",onClick:()=>this.showView("main")},t("span",{class:"icon",innerHTML:B}),"Back"),t("div",{class:"detail-title"},e),t("div",{class:"detail-header-spacer"}))}renderDetailBody(e){return t("div",{class:"detail-body-wrap"},t("div",{class:"detail-body",onScroll:e=>m(e.target)},e),t("div",{class:"scroll-fade"}))}renderDoneButton(){return t("div",{class:"detail-footer"},t("verdocs-button",{label:"Done",size:"small",onClick:()=>this.showView("main")}))}renderRecipientView(){var e;const s=this.getRoleById(this.editingRoleId);if(!s){return t("div",{class:"detail recipient-detail"},this.renderDetailHeader("Recipient"))}const i=N(this.template,s.role_name);return t("div",{class:"detail recipient-detail"},this.renderDetailHeader([t("span",{class:"role-dot",style:{backgroundColor:f(i)}}),s.role_name]),t("verdocs-contact-picker",{key:s.id,showCancel:false,onExit:()=>this.showView("main"),onNext:e=>this.handleSelectContact(e,s),contactSuggestions:this.sessionContacts,templateRole:(e=this.rolesCompleted[s.id])!==null&&e!==void 0?e:s,onSearchContacts:e=>{var s;return(s=this.searchContacts)===null||s===void 0?void 0:s.emit(e.detail)}}))}renderBrandSwatch(e,s){const i=(e===null||e===void 0?void 0:e.favicon_url)||(e===null||e===void 0?void 0:e.thumbnail_url)||(e?null:L);if(i){return t("span",{class:"swatch logo"},t("img",{src:i,alt:""}))}return t("span",{class:"swatch",style:{backgroundColor:(e===null||e===void 0?void 0:e.primary_color)||"#4c56cb"}},s.substring(0,2).toUpperCase())}renderBrandOption(e,s,i,n){return t("button",{type:"button",class:{option:true,selected:this.brandKey===e},onClick:()=>this.brandKey=e},t("span",{class:"radio"}),n,t("span",{class:"option-label"},s,t("small",null,i)))}renderBrandView(){const e=this.getDefaultBrand();const s=this.brands.filter((s=>s.id!==(e===null||e===void 0?void 0:e.id))).sort(((e,s)=>(e.name||e.key).localeCompare(s.name||s.key)));const i=this.brands.length>0;return t("div",{class:"detail"},this.renderDetailHeader("Brand"),this.renderDetailBody([t("div",{class:"option-list"},this.renderBrandOption("",this.getDefaultBrandLabel(),"Organization default",this.renderBrandSwatch(e,(e===null||e===void 0?void 0:e.name)||"V")),s.length>0&&t("div",{class:"option-divider"}),s.map((e=>this.renderBrandOption(e.key,e.name||e.key,e.key,this.renderBrandSwatch(e,e.name||e.key))))),!i&&t("p",{class:"hint"},"Configure the look and feel of the signing experience by"," ",t("a",{href:`${u(this.endpoint)}/settings/branding`,target:"_blank",rel:"noopener"},"Creating a Brand",t("span",{class:"icon",innerHTML:T})),".")]),this.renderDoneButton())}renderExpiresView(){const e=this.expiresAt();const s=`${e.toLocaleDateString(undefined,{month:"short",day:"numeric",year:"numeric"})} at ${e.toLocaleTimeString(undefined,{hour:"numeric",minute:"2-digit"})}`;return t("div",{class:"detail"},this.renderDetailHeader("Expiration"),this.renderDetailBody([t("div",{class:"expires-field"},t("input",{type:"text",inputMode:"numeric","aria-label":"Expires in (days)",placeholder:String(G),value:this.expiresInDays,disabled:this.sending,onInput:e=>this.handleExpiryInput(e)}),t("span",{class:"suffix"},"days")),t("p",{class:"hint"},"This envelope will expire on ",s,". Expirations may be set from ",H,"-",O," days. If left blank, this will default to ",G,".")]),this.renderDoneButton())}renderSenderView(){const e=!this.senderEmail.trim()||p(this.senderEmail.trim());return t("div",{class:"detail"},this.renderDetailHeader("Sender"),this.renderDetailBody([t("div",{class:"sender-field"},t("label",{htmlFor:`${this.containerId}-sender-name`},"Name"),t("input",{id:`${this.containerId}-sender-name`,type:"text",value:this.effectiveSenderName(),disabled:this.sending,onInput:e=>this.senderName=e.target.value})),t("div",{class:"sender-field"},t("label",{htmlFor:`${this.containerId}-sender-email`},"Email"),t("input",{id:`${this.containerId}-sender-email`,type:"email",value:this.effectiveSenderEmail(),disabled:this.sending,onInput:e=>this.senderEmail=e.target.value}),!e&&t("div",{class:"field-error"},"Enter a valid email address.")),t("div",{class:"notice"},t("span",{class:"icon",innerHTML:_}),t("div",null,'The name is what recipients see as the sender, for example "Sentry <notifications@verdocs.com>", and starts as your brand\'s name. The email is where status updates about this envelope are sent and what the certificate shows as the sender. Delivery from your own address needs a custom sender set up under Settings.'))]),this.renderDoneButton())}renderNotificationsView(){return t("div",{class:"detail"},this.renderDetailHeader("Notifications"),this.renderDetailBody([t("verdocs-checkbox",{size:"small",label:"Disable notifications",checked:this.noContact,onInput:e=>this.noContact=!!e.target.checked}),this.noContact&&t("div",{class:"warning"},t("span",{class:"icon",innerHTML:I}),t("div",null,"Disabling notifications turns off invitations and reminders to recipients as well as status updates to you. You may obtain invite links in the recipient summary or via an API call. We strongly recommend enabling"," ",t("a",{href:`${u(this.endpoint)}/settings/webhooks`,target:"_blank",rel:"noopener"},"Webhooks",t("span",{class:"icon",innerHTML:T}))," ","to help automate this process."))]),this.renderDoneButton())}renderDetail(){switch(this.view){case"recipient":return this.renderRecipientView();case"brand":return this.renderBrandView();case"expires":return this.renderExpiresView();case"notifications":return this.renderNotificationsView();case"sender":return this.renderSenderView();default:return null}}render(){var e;if(this.loading){return t(n,null,t("verdocs-loader",null))}if(!this.endpoint.session){return t(n,{style:{display:"flex"}},t("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const s=this.getSequenceNumbers();const i=Object.values(this.rolesCompleted).filter((e=>p(e.email)&&e.first_name&&e.last_name));const o=i.length>=z(this.template).length;const r=i.map((e=>e.email.toLowerCase()));const d=new Set(r).size<r.length;const a=this.expiresAt();const c=a.toLocaleDateString(undefined,{month:"short",day:"numeric"});return t(n,{class:{sendable:(e=this.template)===null||e===void 0?void 0:e.is_sendable,"detail-open":this.view!=="main"}},t("div",{class:"track"},t("div",{class:"pane main-pane","aria-hidden":this.view!=="main"?"true":"false"},t("div",{class:"section-title"},"Recipients"),t("div",{class:"recipients"},s.map((e=>[s.length>1&&t("div",{class:"step"},"Step ",e),this.getRolesAtLevel(e).map((e=>{const s=N(this.template,e.role_name);const n=this.rolesCompleted[e.id];const o=n&&i.findIndex((s=>s.role_name===e.role_name))>-1;const r=this.getRecipientOptionLabels(n);return t("button",{type:"button",class:"recipient","data-ri":s,"data-rn":e.role_name,onClick:s=>this.handleClickRole(s,e)},t("span",{class:"role-dot",style:{backgroundColor:f(s)}}),t("span",{class:"who"},t("span",{class:"role-name"},e.role_name),o?t("span",{class:"who-detail"},l(n)," · ",n.email):t("span",{class:"who-detail configure"},"Configure recipient"),r.length>0&&t("span",{class:"options"},r.map((e=>t("span",{class:"pill"},e))))),t("span",{class:"chevron",innerHTML:M}))}))]))),t("div",{class:"section-title delivery-title"},"Delivery"),t("div",{class:"delivery"},t("button",{type:"button",class:"kv",onClick:()=>this.showView("brand"),disabled:this.sending},t("span",{class:"key"},"Brand"),t("span",{class:"value"},this.getSelectedBrandLabel()),t("span",{class:"chevron",innerHTML:M})),t("button",{type:"button",class:"kv",onClick:()=>this.showView("expires"),disabled:this.sending},t("span",{class:"key"},"Expires"),t("span",{class:"value"},this.effectiveExpiryDays()," days ",t("small",null,"· ",c)),t("span",{class:"chevron",innerHTML:M})),t("button",{type:"button",class:"kv",onClick:()=>this.showView("sender"),disabled:this.sending},t("span",{class:"key"},"Sender"),t("span",{class:"value"},this.effectiveSenderName()||this.effectiveSenderEmail(),this.effectiveSenderName()&&this.effectiveSenderEmail()?t("small",null," · ",this.effectiveSenderEmail()):null),t("span",{class:"chevron",innerHTML:M})),t("button",{type:"button",class:"kv",onClick:()=>this.showView("notifications"),disabled:this.sending},t("span",{class:"key"},"Notifications"),t("span",{class:{value:true,off:this.noContact}},this.noContact?"Off":"On"),t("span",{class:"chevron",innerHTML:M}))),t("div",{class:"main-spacer"}),t("div",{class:"buttons"},d&&t("div",{class:"error-message"},"Recipients cannot share the same email."),this.sending&&t("verdocs-spinner",null),this.showCancel&&t("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),t("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending||d,onClick:e=>this.handleSend(e)}))),t("div",{class:"pane detail-pane","aria-hidden":this.view==="main"?"true":"false",onPointerDown:e=>this.handleSwipeStart(e),onPointerUp:e=>this.handleSwipeEnd(e),onPointerCancel:()=>this.swipeStart=null},this.renderDetail())))}get el(){return this}static get watchers(){return{templateId:[{onTemplateIdChanged:0}]}}static get style(){return j()}},[0,"verdocs-send",{endpoint:[16],templateId:[513,"template-id"],environment:[1],showCancel:[4,"show-cancel"],brandKey:[1025,"brand-key"],containerId:[32],view:[32],editingRoleId:[32],sessionContacts:[32],sending:[32],brands:[32],organization:[32],expiresInDays:[32],noContact:[32],senderDefaults:[32],senderName:[32],senderEmail:[32],rolesCompleted:[32],loading:[32],template:[32],reset:[64]},undefined,{templateId:[{onTemplateIdChanged:0}]}]);function U(){if(typeof customElements==="undefined"){return}const e=["verdocs-send","verdocs-button","verdocs-checkbox","verdocs-component-error","verdocs-contact-picker","verdocs-flag","verdocs-loader","verdocs-spinner"];e.forEach((e=>{switch(e){case"verdocs-send":if(!customElements.get(o(e))){customElements.define(o(e),P)}break;case"verdocs-button":if(!customElements.get(o(e))){k()}break;case"verdocs-checkbox":if(!customElements.get(o(e))){y()}break;case"verdocs-component-error":if(!customElements.get(o(e))){S()}break;case"verdocs-contact-picker":if(!customElements.get(o(e))){x()}break;case"verdocs-flag":if(!customElements.get(o(e))){E()}break;case"verdocs-loader":if(!customElements.get(o(e))){D()}break;case"verdocs-spinner":if(!customElements.get(o(e))){C()}break}}))}export{P as V,U as d};
|
|
2
|
+
//# sourceMappingURL=p-Blr31TcJ.js.map
|