"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = MembersOnlyRow;
const contexts_1 = require("../../../../../contexts/index.js");
const hooks_1 = require("../../../../../hooks/index.js");
const classnames_1 = __importDefault(require("classnames"));
const react_1 = __importStar(require("react"));
const react_i18next_1 = require("react-i18next");
const Translation_1 = require("translations/Translation");
const BEButton_1 = __importDefault(require("../../../../generic/BEButton"));
const Icon_1 = __importStar(require("../../../../generic/Icon/Icon"));
const Pill_1 = __importStar(require("../../../../generic/Pill"));
const Text_1 = __importStar(require("../../../../generic/Text"));
const RoomDetailsPriceBlock_1 = __importDefault(require("../RoomDetailsPriceBlock"));
const MultiMembersOnlyRow_1 = __importDefault(require("./MultiMembersOnlyRow"));
const Color_1 = require("../../../../../util/Color");
const DataLayer_1 = __importStar(require("../../../../../util/DataLayer"));
function MembersOnlyRow() {
    const { externalMembershipHandlers } = (0, react_1.useContext)(contexts_1.CompanyContext);
    if (externalMembershipHandlers.length > 1) {
        return react_1.default.createElement(MultiMembersOnlyRow_1.default, null);
    }
    else {
        return react_1.default.createElement(SingleMembersOnlyRow, null);
    }
}
function SingleMembersOnlyRow() {
    const ccx = (0, react_1.useContext)(contexts_1.CompanyContext);
    const { hotel } = (0, hooks_1.useCurrentHotel)();
    const { t } = (0, react_i18next_1.useTranslation)();
    const currentRow = (0, react_1.useRef)(null);
    const classes = (0, classnames_1.default)('room-info', {
        '--locked': true,
    });
    let isLocked = false;
    if (!ccx.signedInUser) {
        isLocked = true;
    }
    const openSignupModalOnClick = () => {
        DataLayer_1.default.instance.sendInteraction('Member Signup Modal', DataLayer_1.InteractionType.BUTTON, DataLayer_1.InteractionStep.ROOMS);
        ccx.openMemberSignupModal();
    };
    return (react_1.default.createElement("div", { className: classes, ref: currentRow },
        react_1.default.createElement("div", { className: "row room-info-gated" }, isLocked ? (react_1.default.createElement(react_1.default.Fragment, null,
            react_1.default.createElement("div", { className: "col-md-8 room-info-gated-left" },
                react_1.default.createElement("div", { className: "u-flex flex-column h-100" },
                    react_1.default.createElement("div", null,
                        (hotel === null || hotel === void 0 ? void 0 : hotel.memberOnlyImage) && react_1.default.createElement("div", { className: "room-info-gated-left-image", style: { backgroundImage: `url('${hotel.memberOnlyImage}')` } }),
                        react_1.default.createElement("div", { className: "u-marg-bottom-half room-info-gated-left-prices" },
                            react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Body, color: Color_1.Color.Success },
                                react_1.default.createElement("strong", null, t(Translation_1.Translation.Step.Room.RoomInfo.MemberOnlyRow.MemberOnlyPrices)))),
                        react_1.default.createElement("div", { className: "u-marg-bottom u-h-ml-2 text-small u-clear-font-weight room-info-gated-left-deals", dangerouslySetInnerHTML: {
                                __html: t(Translation_1.Translation.Step.Room.RoomInfo.MemberOnlyRow.DealsForOnly, {
                                    companyShort: ccx === null || ccx === void 0 ? void 0 : ccx.companyShort,
                                }),
                            } }),
                        react_1.default.createElement("div", { className: "u-marg-bottom", onClick: openSignupModalOnClick },
                            react_1.default.createElement(Pill_1.default, { icon: Icon_1.IconType.Money, type: Pill_1.PillType.Success }, t(Translation_1.Translation.Step.Room.RoomInfo.SignUpToSee)))),
                    react_1.default.createElement("div", { className: "u-flex justify-content-start u-marg-top-bottom@m-" },
                        react_1.default.createElement("div", { className: "u-marg-right u-inline-flex" },
                            react_1.default.createElement(BEButton_1.default, { icon: Icon_1.IconType.ArrowRight2, isText: true, primary: true, size: "small", iconPosition: "right", onClick: openSignupModalOnClick }, t(Translation_1.Translation.Step.Room.ReadMore)))))),
            react_1.default.createElement("div", { className: "col-md-4 u-flex flex-column align-items-start align-items-md-end justify-content-start room-info-gated-right" },
                react_1.default.createElement(RoomDetailsPriceBlock_1.default, { isLocked: isLocked, averagePreDiscount: 321, averagePrice: 321, isMemberOnly: true }),
                react_1.default.createElement("div", { className: "u-marg-top u-w-100@m-" }, isLocked && (react_1.default.createElement(BEButton_1.default, { filled: true, success: true, mobileWidth: true, onClick: openSignupModalOnClick }, t(Translation_1.Translation.Step.Room.RoomInfo.RevealPrices))))))) : (react_1.default.createElement("div", { className: "d-flex justify-content-center w-100" },
            react_1.default.createElement("div", { className: "d-flex align-items-center" },
                react_1.default.createElement("span", { className: "room-details--content-price-lock u-marg-right", style: { opacity: 1, position: 'unset', transform: 'none' } },
                    react_1.default.createElement(Icon_1.default, { icon: Icon_1.IconType.Lock, color: Color_1.Color.Success })),
                react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Body, color: Color_1.Color.Success, inline: true },
                    react_1.default.createElement("strong", null, t(Translation_1.Translation.Step.Room.RoomInfo.MemberOnlyDealsActivated)))))))));
}
//# sourceMappingURL=MembersOnlyRow.js.map