"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.top10MemberHandler = void 0;
const core_1 = require("@roomstay/core");
const react_1 = __importDefault(require("react"));
const react_i18next_1 = require("react-i18next");
const EmailPasswordMemberModal_1 = __importDefault(require("../../components/members/SignInModal/EmailPasswordMemberModal"));
const RoomstayThemeEngine_1 = __importDefault(require("../../providers/RoomstayThemeEngine"));
const Translation_1 = require("../../translations/Translation");
const top10MemberHandler = (hotel) => {
    var _a, _b, _c, _d, _e;
    const { t } = (0, react_i18next_1.useTranslation)();
    const hasTop10 = (_b = (_a = hotel === null || hotel === void 0 ? void 0 : hotel.integrations) === null || _a === void 0 ? void 0 : _a.includes(core_1.EIntegration.Top10)) !== null && _b !== void 0 ? _b : false;
    const hasRmsTop10 = (_d = (_c = hotel === null || hotel === void 0 ? void 0 : hotel.integrations) === null || _c === void 0 ? void 0 : _c.includes(core_1.EIntegration.RmsTop10)) !== null && _d !== void 0 ? _d : false;
    const provider = hasTop10 ? core_1.EMembershipProvider.Top10 : core_1.EMembershipProvider.RmsTop10;
    return {
        provider,
        isAvailable: hasTop10 || hasRmsTop10,
        renderSignInModal: () => {
            var _a, _b;
            return (react_1.default.createElement(EmailPasswordMemberModal_1.default, { title: t(Translation_1.Translation.ExternalMemberPopup.Top10Title), subTitle: t(Translation_1.Translation.ExternalMemberPopup.Top10SubTitle), image: ((_a = hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImages) === null || _a === void 0 ? void 0 : _a[core_1.EMembershipProvider.Top10]) || (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImage) || RoomstayThemeEngine_1.default.getImageAssetUrl('top10-login.svg'), isOpen: true, imageSize: (_b = hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyModalImageSize) !== null && _b !== void 0 ? _b : 'none', provider: provider }));
        },
        memberOnlyImage: ((_e = hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyImages) === null || _e === void 0 ? void 0 : _e[core_1.EMembershipProvider.Top10]) || (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyImage) || RoomstayThemeEngine_1.default.getImageAssetUrl('top10-login.svg'),
        title: t(Translation_1.Translation.ExternalMemberPopup.Top10Title),
        name: t(Translation_1.Translation.Step.Room.RoomInfo.MemberOnlyRow.Top10),
    };
};
exports.top10MemberHandler = top10MemberHandler;
//# sourceMappingURL=Top10MemberHandler.js.map