"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.Views = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));

var _react = _interopRequireDefault(require("react"));

var _lib = require("@sentecacommerce-theme/lib");

var _dynamic = _interopRequireDefault(require("next/dynamic"));

var _ = require("..");

var Views = function Views() {
  var _useUIState = (0, _lib.useUIState)(),
      views = _useUIState.views;

  var _useConfigState = (0, _lib.useConfigState)(),
      configViews = _useConfigState.views;

  var viewsMap = _react["default"].useMemo(function () {
    var _ref;

    return _ref = {}, _ref[configViews.auth] = (0, _dynamic["default"])(function () {
      return Promise.resolve().then(function () {
        return (0, _interopRequireWildcard2["default"])(require('../Modals'));
      }).then(function (mod) {
        return mod.AuthPopup;
      });
    }, {
      loading: function loading() {
        return /*#__PURE__*/_react["default"].createElement(_.Spinner, null);
      },
      ssr: false
    }), _ref[configViews.storePickUp] = (0, _dynamic["default"])(function () {
      return Promise.resolve().then(function () {
        return (0, _interopRequireWildcard2["default"])(require('../Modals'));
      }).then(function (mod) {
        return mod.PickUpFromStore;
      });
    }, {
      loading: function loading() {
        return /*#__PURE__*/_react["default"].createElement(_.Spinner, null);
      },
      ssr: false
    }), _ref[configViews.itemDesc] = (0, _dynamic["default"])(function () {
      return Promise.resolve().then(function () {
        return (0, _interopRequireWildcard2["default"])(require('../Modals'));
      }).then(function (mod) {
        return mod.ItemDescription;
      });
    }, {
      loading: function loading() {
        return /*#__PURE__*/_react["default"].createElement(_.Spinner, null);
      },
      ssr: false
    }), _ref[configViews.bagModal] = (0, _dynamic["default"])(function () {
      return Promise.resolve().then(function () {
        return (0, _interopRequireWildcard2["default"])(require('../Modals'));
      }).then(function (mod) {
        return mod.AddToBagModal;
      });
    }, {
      loading: function loading() {
        return /*#__PURE__*/_react["default"].createElement(_.Spinner, null);
      },
      ssr: false
    }), _ref[configViews.subForProduct] = (0, _dynamic["default"])(function () {
      return Promise.resolve().then(function () {
        return (0, _interopRequireWildcard2["default"])(require('../Modals'));
      }).then(function (mod) {
        return mod.SubscribeForProduct;
      });
    }, {
      loading: function loading() {
        return /*#__PURE__*/_react["default"].createElement(_.Spinner, null);
      },
      ssr: false
    }), _ref;
  }, []);

  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, views == null ? void 0 : views.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement(viewsMap[item.id], (0, _extends2["default"])({}, item.props, {
      key: item.id
    }));
  }));
};

exports.Views = Views;
//# sourceMappingURL=index.js.map