import { h, Host } from "@stencil/core";
import { DefaultEndpoint } from "../../../utils/Environment";
const QuestionIcon = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 0C8.95313 0 0 8.95313 0 20C0 31.0469 8.95313 40 20 40C31.0469 40 40 31.0469 40 20C40 8.95313 31.0469 0 20 0ZM20 36.25C11.0391 36.25 3.75 28.9602 3.75 20C3.75 11.0398 11.0391 3.75 20 3.75C28.9609 3.75 36.25 11.0398 36.25 20C36.25 28.9602 28.9609 36.25 20 36.25Z" fill="white"/><path d="M20 26.25C18.5938 26.25 17.5 27.3438 17.5 28.75C17.5 30.1562 18.5234 31.25 20 31.25C21.3359 31.25 22.5 30.1562 22.5 28.75C22.5 27.3438 21.3359 26.25 20 26.25ZM22.5859 10H18.5938C15.5469 10 13.125 12.4219 13.125 15.4688C13.125 16.4844 13.9844 17.3438 15 17.3438C16.0156 17.3438 16.875 16.4844 16.875 15.4688C16.875 14.5312 17.5859 13.75 18.5234 13.75H22.5156C23.5234 13.75 24.375 14.5312 24.375 15.4688C24.375 16.0938 24.0625 16.5703 23.5156 16.8828L19.0625 19.6094C18.4375 20 18.125 20.625 18.125 21.25V22.5C18.125 23.5156 18.9844 24.375 20 24.375C21.0156 24.375 21.875 23.5156 21.875 22.5V22.3438L25.3984 20.1562C27.0391 19.1406 28.0547 17.3438 28.0547 15.4688C28.125 12.4219 25.7031 10 22.5859 10Z" fill="#E7E7E7"/></svg>`;
/**
 * Delegate signing responsibility to another recipient.
 */
export class VerdocsDelegateDialog {
    constructor() {
        /**
         * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
         */
        this.endpoint = DefaultEndpoint;
        /**
         * The envelope to process.
         */
        this.envelope = null;
        this.first_name = '';
        this.last_name = '';
        this.email = '';
        this.phone = '';
        this.message = '';
    }
    handleCancel() {
        this.exit.emit();
    }
    // We need a separate event handler for clicking the background because it can receive events "through" other child components
    handleDismiss(e) {
        if (e.target.class === 'background-overlay') {
            e.preventDefault();
            this.handleCancel();
        }
    }
    // We need a separate event handler for clicking the background because it can receive events "through" other child components
    handleDelegate() {
        this.next.emit({
            first_name: this.first_name,
            last_name: this.last_name,
            email: this.email,
            phone: this.phone,
            message: this.message,
        });
    }
    render() {
        return (h(Host, { key: '1b273825b9e7829da0e4c2f1e0dd198b99e22778' }, h("div", { key: 'ee6933619eccc3bd070a39cfe203db31f9e49360', class: "background-overlay", onClick: e => this.handleDismiss(e) }, h("div", { key: 'a5dd9c14107423563cd9f125ada09e093a2f339a', class: "dialog" }, h("div", { key: '9de61c918546d1c07e6910bf510a86a7b02b3ec4', class: "heading" }, "Delegate \"", this.envelope.name, "\""), h("div", { key: '4a18099b2af26a5ffacfef8316224ff46d0e6130', class: "help-box" }, h("div", { key: '1edddc209d05847359e5899c635a434b84df5cbf', class: "help-icon", innerHTML: QuestionIcon }), h("div", { key: '3b88b1a8fe4432a76ecdd7c890af1c62f6e37e15', class: "help-details" }, h("div", { key: 'c912b3030e38e44f6e99708c70dc914bb8c16d7b', class: "help-title" }, "Please verify your email address"), h("div", { key: '743843ee38ee599147c38428794f75433418ad8f', class: "help-text" }, "Check your email for a one-time code, and enter it below."))), h("div", { key: 'a1c76355c3085882a3a85b2e9d92e7e6fdb52ae0', class: "input names" }, h("label", { key: 'a67cddd940d0b12e85eb4e838a4ea74763b8114b', htmlFor: "verdocs-delegate-email" }, "New Recipient:"), h("input", { key: '119c0d496eed6721e0a75f83f1419a9d5f491bd7', type: "text", id: "verdocs-delegate-first", name: "verdocs-delegate-first", autocomplete: "blocked", placeholder: "First name...", value: this.first_name, onInput: (e) => (this.first_name = e.target.value) }), h("input", { key: '6a63aaf105137ca0e1dac6cf7a19f4b82d8c47d6', type: "text", id: "verdocs-delegate-last", name: "verdocs-delegate-last", autocomplete: "blocked", placeholder: "Last name...", value: this.last_name, onInput: (e) => (this.last_name = e.target.value) })), h("div", { key: '347e2279573063eb892c0b813468d5c09408531a', class: "input" }, h("label", { key: '825073c57fd16fbf3e310280f308c43be821965d', htmlFor: "verdocs-delegate-email" }, "Email Address:"), h("input", { key: '56838680257dee66d68c0e725caf836ea40ff295', type: "text", id: "verdocs-delegate-email", name: "verdocs-delegate-email", autocomplete: "blocked", placeholder: "New recipient email address...", value: this.email, onInput: (e) => (this.email = e.target.value) })), h("div", { key: '063226a4aed54f801b830c79d8bd09c27538454e', class: "input" }, h("label", { key: '19a7c63649de25be50d55441e1c27e80bea5ca0a', htmlFor: "verdocs-delegate-phone" }, "Phone:"), h("input", { key: '433ad74b6599db5c29d52948fdd373c3dbe62736', type: "text", id: "verdocs-delegate-phone", name: "verdocs-delegate-phone", autocomplete: "blocked", placeholder: "Optional phone number...", value: this.phone, onInput: (e) => (this.phone = e.target.value) })), h("div", { key: '07a2f3a2f4ba17bd89104f1d0d113650c7415dbd', class: "input" }, h("label", { key: 'eab9f7cde38d80e75c35b731cb3e1bc8a0f41bab', htmlFor: "verdocs-delegate-email" }, "Message:"), h("textarea", { key: '4aceddbcca0ef4b30a7d04fd15509588fabe9732', id: "verdocs-delegate-message", name: "verdocs-delegate-message", rows: 3, autocomplete: "blocked", placeholder: "Optional message to include in the invitation...", onInput: (e) => (this.message = e.target.value) }, this.message)), h("div", { key: '6c24b31253ca9146f93b6ae17deb984ce4aa5c5a', class: "buttons" }, h("verdocs-button", { key: 'd17fe7c1c699a49c7fe923ed528b18c8d780ddbb', label: "Cancel", variant: "outline", onClick: () => this.handleCancel() }), h("verdocs-button", { key: '260a127ef6c7c8a6703ad46136233302ed4d0437', label: 'Delegate', onClick: () => this.handleDelegate(), disabled: !this.first_name || !this.last_name || !this.email }))))));
    }
    static get is() { return "verdocs-delegate-dialog"; }
    static get originalStyleUrls() {
        return {
            "$": ["verdocs-delegate-dialog.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["verdocs-delegate-dialog.css"]
        };
    }
    static get properties() {
        return {
            "endpoint": {
                "type": "unknown",
                "attribute": "endpoint",
                "mutable": true,
                "complexType": {
                    "original": "VerdocsEndpoint",
                    "resolved": "VerdocsEndpoint",
                    "references": {
                        "VerdocsEndpoint": {
                            "location": "import",
                            "path": "@verdocs/js-sdk",
                            "id": "node_modules::VerdocsEndpoint"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used."
                },
                "getter": false,
                "setter": false,
                "defaultValue": "DefaultEndpoint"
            },
            "envelope": {
                "type": "unknown",
                "attribute": "envelope",
                "mutable": false,
                "complexType": {
                    "original": "IEnvelope | null",
                    "resolved": "IEnvelope",
                    "references": {
                        "IEnvelope": {
                            "location": "import",
                            "path": "@verdocs/js-sdk",
                            "id": "node_modules::IEnvelope"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The envelope to process."
                },
                "getter": false,
                "setter": false,
                "defaultValue": "null"
            }
        };
    }
    static get states() {
        return {
            "first_name": {},
            "last_name": {},
            "email": {},
            "phone": {},
            "message": {}
        };
    }
    static get events() {
        return [{
                "method": "exit",
                "name": "exit",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "next",
                "name": "next",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event fired when the process has completed successfully."
                },
                "complexType": {
                    "original": "{first_name: string; last_name: string; email: string; phone: string; message: string}",
                    "resolved": "{ first_name: string; last_name: string; email: string; phone: string; message: string; }",
                    "references": {}
                }
            }];
    }
}
//# sourceMappingURL=verdocs-delegate-dialog.js.map
