"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.Theme = exports.DeviceMask = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var React = _interopRequireWildcard(require("react"));
var _uiCore = require("@megafon/ui-core");
var _uiHelpers = require("@megafon/ui-helpers");
var _StoreButton = _interopRequireWildcard(require("../StoreButton/StoreButton"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var Theme = exports.Theme = {
  DEFAULT: 'default',
  GREEN: 'green',
  SPB_SKY_1: 'spbSky1',
  SPB_SKY_0: 'spbSky0'
};
var DeviceMask = exports.DeviceMask = {
  ANDROID: 'android',
  NEW_IPHONE: 'new-iphone',
  /** DEPRECATED: 'black-iphone', 'white-iphone', 'iphone-12' */
  BLACK_IPHONE: 'black-iphone',
  WHITE_IPHONE: 'white-iphone',
  IPHONE_12: 'iphone-12'
};
var testIdPrefix = 'StoreBanner';
var cn = (0, _uiHelpers.cnCreate)('mfui-store-banner');
var StoreBanner = function StoreBanner(_ref) {
  var className = _ref.className,
    _ref$classes = _ref.classes,
    _ref$classes2 = _ref$classes === void 0 ? {} : _ref$classes,
    rootClassName = _ref$classes2.root,
    appleLinkClassName = _ref$classes2.appleLink,
    galaxyStoreLinkClassName = _ref$classes2.galaxyStoreLink,
    googleLinkClassName = _ref$classes2.googleLink,
    huaweiLinkClassName = _ref$classes2.huaweiLink,
    miStoreLinkClassName = _ref$classes2.miStoreLink,
    ruStoreLinkClassName = _ref$classes2.ruStoreLink,
    vAppstoreLinkClassName = _ref$classes2.vAppstoreLink,
    buttonClassName = _ref$classes2.button,
    title = _ref.title,
    text = _ref.text,
    linkApple = _ref.linkApple,
    linkGalaxyStore = _ref.linkGalaxyStore,
    linkGoogle = _ref.linkGoogle,
    linkHuawei = _ref.linkHuawei,
    linkMiStore = _ref.linkMiStore,
    linkRuStore = _ref.linkRuStore,
    linkVAppstore = _ref.linkVAppstore,
    linkButton = _ref.linkButton,
    _ref$textButton = _ref.textButton,
    textButton = _ref$textButton === void 0 ? 'Установите приложение' : _ref$textButton,
    rel = _ref.rel,
    qrCode = _ref.qrCode,
    imageSrc = _ref.imageSrc,
    _ref$theme = _ref.theme,
    theme = _ref$theme === void 0 ? 'default' : _ref$theme,
    deviceMask = _ref.deviceMask,
    isContentLeftMobile = _ref.isContentLeftMobile,
    rootRef = _ref.rootRef,
    dataAttrs = _ref.dataAttrs,
    onClickApple = _ref.onClickApple,
    onClickGalaxyStore = _ref.onClickGalaxyStore,
    onClickGoogle = _ref.onClickGoogle,
    onClickHuawei = _ref.onClickHuawei,
    onClickMiStore = _ref.onClickMiStore,
    onClickRuStore = _ref.onClickRuStore,
    onClickVAppstore = _ref.onClickVAppstore;
  return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
    className: cn({
      theme: theme,
      mask: deviceMask,
      'content-left-mobile': isContentLeftMobile
    }, [className, rootClassName]),
    ref: rootRef
  }, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
    className: cn('container')
  }, /*#__PURE__*/React.createElement("div", {
    className: cn('grid')
  }, /*#__PURE__*/React.createElement(_uiCore.Grid, null, /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
    all: "6",
    mobile: "12",
    rightOffsetWide: "1"
  }, /*#__PURE__*/React.createElement("div", {
    className: cn('content')
  }, /*#__PURE__*/React.createElement(_uiCore.Header, {
    as: "h2",
    className: cn('title'),
    color: "inherit"
  }, (0, _uiHelpers.convert)(title, _uiHelpers.titleConvertConfig)), /*#__PURE__*/React.createElement("div", {
    className: cn('text'),
    color: "inherit"
  }, (0, _uiHelpers.convert)(text, _uiHelpers.textConvertConfig)), /*#__PURE__*/React.createElement("div", {
    className: cn('links', {
      three: !!linkApple && !!linkGoogle && !!linkHuawei
    })
  }, !linkButton && qrCode && /*#__PURE__*/React.createElement("img", {
    src: qrCode,
    className: cn('qr-code'),
    alt: "QR-\u043A\u043E\u0434",
    "data-testid": "".concat(testIdPrefix, "-qrCode")
  }), !linkButton && /*#__PURE__*/React.createElement("div", {
    className: cn('stores'),
    "data-testid": "".concat(testIdPrefix, "-stores")
  }, linkApple && /*#__PURE__*/React.createElement(_StoreButton["default"], {
    dataAttrs: {
      root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.linkApple
    },
    theme: _StoreButton.Theme.APP_STORE,
    href: linkApple,
    rel: rel,
    onClick: onClickApple,
    className: cn('store-link', {
      'app-store': true
    }, appleLinkClassName)
  }), linkGoogle && /*#__PURE__*/React.createElement(_StoreButton["default"], {
    dataAttrs: {
      root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.linkGoogle
    },
    theme: _StoreButton.Theme.GOOGLE_PLAY,
    href: linkGoogle,
    rel: rel,
    className: cn('store-link', {
      'google-play': true
    }, googleLinkClassName),
    onClick: onClickGoogle
  }), linkRuStore && /*#__PURE__*/React.createElement(_StoreButton["default"], {
    dataAttrs: {
      root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.linkRuStore
    },
    theme: _StoreButton.Theme.RU_STORE,
    href: linkRuStore,
    rel: rel,
    className: cn('store-link', {
      'ru-store': true
    }, ruStoreLinkClassName),
    onClick: onClickRuStore
  }), linkGalaxyStore && /*#__PURE__*/React.createElement(_StoreButton["default"], {
    dataAttrs: {
      root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.linkGalaxyStore
    },
    theme: _StoreButton.Theme.GALAXY_STORE,
    href: linkGalaxyStore,
    rel: rel,
    className: cn('store-link', {
      'galaxy-store': true
    }, galaxyStoreLinkClassName),
    onClick: onClickGalaxyStore
  }), linkHuawei && /*#__PURE__*/React.createElement(_StoreButton["default"], {
    dataAttrs: {
      root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.linkHuawei
    },
    theme: _StoreButton.Theme.HUAWEI_STORE,
    href: linkHuawei,
    rel: rel,
    className: cn('store-link', {
      'huawei-store': true
    }, huaweiLinkClassName),
    onClick: onClickHuawei
  }), linkMiStore && /*#__PURE__*/React.createElement(_StoreButton["default"], {
    dataAttrs: {
      root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.linkMiStore
    },
    theme: _StoreButton.Theme.MI_STORE,
    href: linkMiStore,
    rel: rel,
    className: cn('store-link', {
      'mi-store': true
    }, miStoreLinkClassName),
    onClick: onClickMiStore
  }), linkVAppstore && /*#__PURE__*/React.createElement(_StoreButton["default"], {
    dataAttrs: {
      root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.linkVAppstore
    },
    theme: _StoreButton.Theme.V_APPSTORE,
    href: linkVAppstore,
    rel: rel,
    className: cn('store-link', {
      'v-appstore': true
    }, vAppstoreLinkClassName),
    onClick: onClickVAppstore
  })), linkButton && /*#__PURE__*/React.createElement(_uiCore.Button, {
    dataAttrs: {
      root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
    },
    className: cn('button', [buttonClassName]),
    href: linkButton,
    rel: rel,
    theme: theme === 'green' ? 'purple' : 'green'
  }, textButton)))), /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
    all: "4",
    desktop: "6",
    tablet: "6",
    mobile: "12"
  }, /*#__PURE__*/React.createElement("div", {
    className: cn('device-wrapper')
  }, /*#__PURE__*/React.createElement("div", {
    className: cn('device-mask')
  }), /*#__PURE__*/React.createElement("img", {
    src: imageSrc,
    className: cn('screen'),
    alt: "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F \u043D\u0430 \u044D\u043A\u0440\u0430\u043D\u0435 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430"
  })))))));
};
var _default = exports["default"] = StoreBanner;