import { h } from "@stencil/core";
import classNames from "classnames";
import { faCheck, faCircleNotch, faTimes } from "@fortawesome/free-solid-svg-icons";
import { getIconHtmlFromIconDefinition } from "../../../../../utils/icons/getIconHtmlFromIconDefinition";
import { DataTestIdsEnum } from "../../../../../constants/dataTestIds.enum";
const iconData = {
    pending: faCircleNotch,
    success: faCheck,
    fail: faTimes,
    invalid: faTimes,
};
export class TransactionDetailsBody {
    constructor() {
        this.transactionClass = 'transaction-container';
        this.status = undefined;
        this.hash = undefined;
    }
    render() {
        const statusIcon = this.status ? iconData[this.status] : null;
        const iconHtml = statusIcon ? getIconHtmlFromIconDefinition(statusIcon) : null;
        return (h("div", { class: this.transactionClass, key: this.hash, "data-testid": DataTestIdsEnum.transactionDetailsToastBody }, iconHtml && (h("div", { key: '9f5f62c6703523b25fe2569c08ccf5af21aca706', innerHTML: iconHtml, class: classNames('icon', {
                'fa-spin': this.status === 'pending',
            }) })), h("span", { key: 'e5d5771f789dcfaeb10cafb7cc4d11d4d236af95' }, this.hash.length > 12 ? `${this.hash.slice(0, 6)}...${this.hash.slice(-6)}` : this.hash)));
    }
    static get is() { return "transaction-toast-details-body"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["transaction-toast-details-body.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["transaction-toast-details-body.css"]
        };
    }
    static get properties() {
        return {
            "transactionClass": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "transaction-class",
                "reflect": false,
                "defaultValue": "'transaction-container'"
            },
            "status": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "status",
                "reflect": false
            },
            "hash": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "hash",
                "reflect": false
            }
        };
    }
}
//# sourceMappingURL=transaction-toast-details-body.js.map
