"use strict";

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

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

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

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

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _Components = require("./Components");

var _profile = require("./profile.context");

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

var _templateObject, _templateObject2, _templateObject3, _templateObject4;

var componentsMap = {
  subscriptions: /*#__PURE__*/_react["default"].createElement(_Components.Subscriptions, null),
  'personal-info': /*#__PURE__*/_react["default"].createElement(_Components.AccountSettings, null),
  notifications: /*#__PURE__*/_react["default"].createElement(_Components.Notifications, null),
  vouchers: /*#__PURE__*/_react["default"].createElement(_Components.Vouchers, null),
  'company-details': /*#__PURE__*/_react["default"].createElement(_Components.CompanyDetails, null),
  'address-book': /*#__PURE__*/_react["default"].createElement(_Components.AddressBook, null),
  'loyalty-program': /*#__PURE__*/_react["default"].createElement(_Components.LoyaltyProgram, null),
  'order-history': /*#__PURE__*/_react["default"].createElement(_Components.OrderHistory, null)
};

var Profile = function Profile(props) {
  var navigation = props.navigation;

  var _useProfileState = (0, _profile.useProfileState)(),
      profileTab = _useProfileState.profileTab;

  var _useAuthGuard = (0, _lib.useAuthGuard)(),
      isLoggedIn = _useAuthGuard.isLoggedIn;

  if (!isLoggedIn) return null;
  return /*#__PURE__*/_react["default"].createElement(_lib.LocalLabelsProvider, {
    labels: props.labels
  }, /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(Inner, null, /*#__PURE__*/_react["default"].createElement(NavigationAside, {
    isVisible: !Boolean(profileTab)
  }, /*#__PURE__*/_react["default"].createElement(_Components.Navigation, {
    data: navigation
  })), /*#__PURE__*/_react["default"].createElement(TabContent, null, componentsMap[profileTab]))));
};

exports.Profile = Profile;

var Container = _styledComponents["default"].div.attrs({
  className: 'pt-3 mt-lg-4 px-3 px-lg-5 mx-auto'
})(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2["default"])(["\n  max-width: 1440px;\n"])));

var Inner = _styledComponents["default"].div.attrs({
  className: 'row'
})(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2["default"])([""])));

var NavigationAside = _styledComponents["default"].aside.attrs(function (props) {
  return {
    className: "col-12 col-lg-3 " + (props.isVisible ? 'd-block' : 'd-none') + " d-lg-block"
  };
})(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2["default"])([""])));

var TabContent = _styledComponents["default"].div.attrs({
  className: 'col-lg-9 px-0 px-lg-auto'
})(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2["default"])([""])));
//# sourceMappingURL=profile.component.js.map