"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;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderBookingEngine = void 0;
exports.default = FullPageBookingEngineElement;
require("../../../assets/scss/main.global.scss");
const contexts_1 = require("../../contexts/index.js");
const react_1 = __importStar(require("react"));
const react_dom_1 = require("react-dom");
const react_router_dom_1 = require("react-router-dom");
const FullPageBookingEngineElementEvents_1 = require("./FullPageBookingEngineElementEvents");
function FullPageBookingEngineElement({ engine }) {
    // TODO: Refactor this to trigger via useEvents hook
    FullPageBookingEngineElementEvents_1.FullPageBookingEngineElementEvents.reload = () => {
        setIncrementor((one) => one + 1);
    };
    // const [createdSession, createdSessionSet] = useState<boolean>(false);
    // const setup = useCallback(async () => {
    //     try {
    //         await API.Session.startSession();
    //     } catch (e) {
    //         console.error('failed to create session');
    //     }
    //     createdSessionSet(true);
    // }, []);
    // useEffect(() => {
    //     setup();
    // }, [setup]);
    const [, setIncrementor] = (0, react_1.useState)(0);
    return (react_1.default.createElement(react_1.Suspense, { fallback: react_1.default.createElement(react_1.default.Fragment, null) },
        react_1.default.createElement(react_router_dom_1.HashRouter, { future: {
                v7_startTransition: false,
                v7_relativeSplatPath: false,
            } },
            react_1.default.createElement(contexts_1.BookingEngineContextWrapper, { engine: engine },
                react_1.default.createElement(contexts_1.NotificationContextWrapper, null,
                    react_1.default.createElement(contexts_1.ErrorContextWrapper, null,
                        react_1.default.createElement(contexts_1.CompanyContextWrapper, { configCompany: engine.getConfig().company },
                            react_1.default.createElement(contexts_1.HotelOverridesContextWrapper, null,
                                react_1.default.createElement(contexts_1.BasketContextWrapper, null,
                                    react_1.default.createElement(contexts_1.FullPageEngineContextWrapper, null))))))))));
}
const renderBookingEngine = (container, engine) => {
    (0, react_dom_1.render)(react_1.default.createElement(FullPageBookingEngineElement, { engine: engine }), container);
};
exports.renderBookingEngine = renderBookingEngine;
//# sourceMappingURL=FullPageBookingEngineElement.js.map