"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var framepay_error_1 = __importDefault(require("../../framepay-error"));
var base_element_1 = __importDefault(require("./base-element"));
var SamsungPayElement = /** @class */ (function (_super) {
    __extends(SamsungPayElement, _super);
    function SamsungPayElement() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SamsungPayElement.prototype.setupElement = function () {
        var _this = this;
        var Framepay = this.props.Framepay;
        var makeElement = function () {
            // elementNode already checked in BaseElement.handleSetupElement
            // just ts checks fix
            if (!_this.elementNode) {
                throw (0, framepay_error_1.default)({
                    code: framepay_error_1.default.codes.elementMountError,
                    details: "SamsungPayElement invalid elementNode",
                });
            }
            try {
                return Framepay.samsungPay.mount(_this.elementNode);
            }
            catch (e) {
                throw (0, framepay_error_1.default)({
                    code: framepay_error_1.default.codes.elementMountError,
                    details: "SamsungPayElement error in remote api call",
                    trace: e,
                });
            }
        };
        var element = makeElement();
        this.setState({ element: element });
    };
    return SamsungPayElement;
}(base_element_1.default));
exports.default = SamsungPayElement;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Ftc3VuZ3BheS1lbGVtZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi9jb21wb25lbnR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