"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultErrorMessages = exports.ERROR_CODES = void 0;
exports.ERROR_CODES = {
    elementMountError: 'element-mount-error',
    initializeError: 'initialize-error',
    remoteScriptError: 'remote-script-error',
};
exports.defaultErrorMessages = (_a = {},
    _a[exports.ERROR_CODES.remoteScriptError] = "Can't load the FramePay remote script",
    _a[exports.ERROR_CODES.elementMountError] = "Can't mount the element component",
    _a[exports.ERROR_CODES.initializeError] = "\n        FramePay initialize error\r\n\n        See https://github.com/Rebilly/framepay-react/tree/alpha#the-framepay-context-framepayprovider\r\n\n        See https://www.rebilly.com/docs/dev-docs/framepay-global-reference/#framepay.initialize",
    _a);
var ErrorBuilder = /** @class */ (function () {
    function ErrorBuilder() {
    }
    ErrorBuilder.prototype.make = function (_a) {
        var code = _a.code, details = _a.details, trace = _a.trace;
        return {
            code: code,
            details: details,
            message: exports.defaultErrorMessages[code],
            trace: trace || null,
        };
    };
    return ErrorBuilder;
}());
var handler = new ErrorBuilder();
var FramePayError = function (_a) {
    var code = _a.code, _b = _a.details, details = _b === void 0 ? '' : _b, _c = _a.trace, trace = _c === void 0 ? '' : _c;
    return handler.make({
        code: code,
        details: details,
        trace: trace,
    });
};
FramePayError.codes = exports.ERROR_CODES;
exports.default = FramePayError;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhbWVwYXktZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbGliL2ZyYW1lcGF5LWVycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBYSxRQUFBLFdBQVcsR0FBRztJQUN2QixpQkFBaUIsRUFBRSxxQkFBcUI7SUFDeEMsZUFBZSxFQUFFLGtCQUFrQjtJQUNuQyxpQkFBaUIsRUFBRSxxQkFBcUI7Q0FDN0IsQ0FBQztBQUVILFFBQUEsb0JBQW9CLEdBQUcsQ0F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