import { h } from "@stencil/core";
import { DefaultEndpoint } from "../../../utils/Environment";
/**
 * 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("verdocs-dialog", { key: '544d1a6c11994393bcf8a132ed30f6eccd0a962b' }, h("div", { key: '8bb51625e1f274353c27e63fca73197748ee6d0a', slot: "heading", class: "heading" }, h("div", { key: '4c4ef03fe2bd65ba2926b5605a5ab4b7df99d7fa', class: "icon" }, h("svg", { key: 'c5628b19e7c4784e11ac200acea59da7cfc91e4d', width: "22", height: "19", viewBox: "0 0 22 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { key: 'a691386a9ec559b59d3c6a31cad9c205282afe81', "clip-path": "url(#clip0_34208_4881)" }, h("path", { key: '0b41bc704fb3dd77ad702b0d45fc1428e9578401', d: "M3.125 0.75C1.88398 0.75 0.875 1.75898 0.875 3V16.5C0.875 17.741 1.88398 18.75 3.125 18.75H12.125C13.366 18.75 14.375 17.741 14.375 16.5V15.8215C14.2801 15.8602 14.1852 15.8918 14.0867 15.9164L11.9738 16.4437C11.8684 16.4684 11.7629 16.4859 11.6574 16.493C11.6258 16.4965 11.5941 16.5 11.5625 16.5H9.3125C9.09805 16.5 8.90469 16.3805 8.80977 16.1906L8.50039 15.5684C8.44062 15.4488 8.32109 15.375 8.19102 15.375C8.06094 15.375 7.93789 15.4488 7.88164 15.5684L7.57227 16.1906C7.47031 16.398 7.24883 16.5211 7.02031 16.5C6.7918 16.4789 6.59492 16.3207 6.53164 16.1027L5.9375 14.1445L5.59297 15.2977C5.37852 16.0113 4.72109 16.5 3.97578 16.5H3.6875C3.37812 16.5 3.125 16.2469 3.125 15.9375C3.125 15.6281 3.37812 15.375 3.6875 15.375H3.97578C4.22539 15.375 4.44336 15.2133 4.51367 14.9742L5.0375 13.234C5.15703 12.8367 5.52266 12.5625 5.9375 12.5625C6.35234 12.5625 6.71797 12.8367 6.8375 13.234L7.24531 14.591C7.50547 14.373 7.83594 14.25 8.1875 14.25C8.74648 14.25 9.25625 14.5664 9.50586 15.0656L9.66055 15.375H9.97344C9.86445 15.0656 9.84336 14.7281 9.92422 14.3977L10.4516 12.2848C10.55 11.8875 10.7539 11.5289 11.0422 11.2406L14.375 7.90781V6.375H9.875C9.25273 6.375 8.75 5.87227 8.75 5.25V0.75H3.125ZM9.875 0.75V5.25H14.375L9.875 0.75ZM20.2039 5.66133C19.6555 5.11289 18.766 5.11289 18.2141 5.66133L17.1805 6.69492L19.6766 9.19102L20.7102 8.15742C21.2586 7.60898 21.2586 6.71953 20.7102 6.16758L20.2039 5.66133ZM11.8402 12.0352C11.6961 12.1793 11.5941 12.3586 11.5449 12.559L11.0176 14.6719C10.9684 14.8652 11.0246 15.0656 11.1652 15.2063C11.3059 15.3469 11.5062 15.4031 11.6996 15.3539L13.8125 14.8266C14.0094 14.7773 14.1922 14.6754 14.3363 14.5312L18.8785 9.98555L16.3824 7.48945L11.8402 12.0352Z" })), h("defs", { key: '593d9c1d9e6fa93eca2509ea769dcf6d0afe8e79' }, h("clipPath", { key: '3dbaefe2c7393d5a99ac8c9f765fb95a4e2027d7', id: "clip0_34208_4881" }, h("path", { key: '11b057d5fd402f7ff90862e711b118257a69fd0f', d: "M0.875 0.75H21.125V18.75H0.875V0.75Z", fill: "white" }))))), h("div", { key: '79e39509478cf0280ca8c73239b37b9ad5de555c', class: "title" }, "Delegate Signing")), h("div", { key: '9bb55554f1afa468c4656a6855d9925af58829b6', slot: "content", class: "content" }, h("div", { key: 'c11c7c7177cc210bf44aca35d57efbafe9b315a8', class: "verdocs-form" }, h("div", { key: 'd37e3e46e58ad3baea9cff07ed9cc1c02b39bd17', class: "verdocs-form-row" }, h("div", { key: 'b54e6c3b92c16f9a6b834bd56ebae4f53f7929f3', class: "field-group" }, h("label", { key: 'f79503717edfa2ae9853633f079111389beba237', htmlFor: "verdocs-delegate-first", class: "verdocs-form-label" }, "New Recipient*"), h("input", { key: '294c9b74eae2ebe3244cada48163353f20c833e8', type: "text", id: "verdocs-delegate-first", name: "verdocs-delegate-first", class: "verdocs-form-input", autocomplete: "blocked", placeholder: "First name", value: this.first_name, onInput: (e) => (this.first_name = e.target.value) })), h("div", { key: '2c032688ccb04eb7bbf6e640a97bef0d054386e0', class: "field-group" }, h("label", { key: '90ee75f1d13d5ceb104e3687186b3b0bc5efe474', htmlFor: "verdocs-delegate-last", class: "verdocs-form-label" }, "\u00A0"), h("input", { key: 'c085ce321324e97eb9318beba44e4bdd2fabdfdb', type: "text", id: "verdocs-delegate-last", name: "verdocs-delegate-last", class: "verdocs-form-input", autocomplete: "blocked", placeholder: "Last name", value: this.last_name, onInput: (e) => (this.last_name = e.target.value) }))), h("div", { key: '581f12132762f26dea3c6df76cb711736014a15d' }, h("label", { key: '5d2c0b5661a10eaf8bdd53eac208aadba3a33b44', htmlFor: "verdocs-delegate-email", class: "verdocs-form-label" }, "Email Address*"), h("input", { key: '481918ad1de4ea1a7ee755a88c243d230b752331', type: "text", id: "verdocs-delegate-email", name: "verdocs-delegate-email", class: "verdocs-form-input", autocomplete: "blocked", placeholder: "New recipient email address", value: this.email, onInput: (e) => (this.email = e.target.value) })), h("div", { key: 'b1634e4a91e0ee2503616cf7cb1f38aa5a1d6a6d' }, h("label", { key: 'efe53175934ac305a61ec9132256732cdbcc4701', htmlFor: "verdocs-delegate-phone", class: "verdocs-form-label" }, "Phone Number"), h("input", { key: '0d8da1233edfa2cfc43e340f0d8e5c9e454bebc8', type: "text", id: "verdocs-delegate-phone", name: "verdocs-delegate-phone", class: "verdocs-form-input", autocomplete: "blocked", placeholder: "Optional phone number", value: this.phone, onInput: (e) => (this.phone = e.target.value) })), h("div", { key: 'e427aa3b0e84ae5a20bd7cf297880f3e068bf30a' }, h("label", { key: 'fcc39c593662a5d78e1f01b2a4637b33853ca137', htmlFor: "verdocs-delegate-message", class: "verdocs-form-label" }, "Message (optional)"), h("textarea", { key: '5545f52a33743ffdeee683807af07f6cf41389f0', id: "verdocs-delegate-message", name: "verdocs-delegate-message", class: "verdocs-form-input", rows: 3, autocomplete: "blocked", placeholder: "Type message here...", onInput: (e) => (this.message = e.target.value) }, this.message)))), h("div", { key: '8d999fa80fdcbb064305fe9a80b34e91a92a490c', class: "footer", slot: "footer" }, h("div", { key: '24c4c2cb997f5b9cb4982730b48d5a37933cd0bd', class: "buttons" }, h("button", { key: '0959dd4ea59dc0a2abcdff4a9fc98e999de5f43a', class: "cancel", onClick: () => this.handleCancel() }, "Cancel"), h("button", { key: '7c211a4833c7e817c3029261da4b18520fbfaddf', class: "proceed", onClick: () => this.handleDelegate(), disabled: !this.first_name || !this.last_name || !this.email }, "Delegate")))));
    }
    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",
                "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",
                "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
