"use strict"; function FExternalComponent(props) { var _window = window, useContext = _window.useContext; var ctx = null; try { ctx = useContext(window.GlobalFamiryProductContext); } catch (e) {} if (!ctx || !ctx.ExternalComponent) { return React.createElement(React.Fragment, null, props.children); } return React.createElement(ctx.ExternalComponent, { src: props.src, component: props.component, props: props.props }, props.children); } "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var ExtendedModal = /*#__PURE__*/ function (_React$Component) { _inherits(ExtendedModal, _React$Component); function ExtendedModal(props) { var _this; _classCallCheck(this, ExtendedModal); _this = _possibleConstructorReturn(this, _getPrototypeOf(ExtendedModal).call(this, props)); _this.modalElement = null; _this.callback = function (e) { e.stopPropagation(); }; return _this; } _createClass(ExtendedModal, [{ key: "componentDidMount", value: function componentDidMount() { this.modalElement = document.createElement("div"); document.querySelector("body").appendChild(this.modalElement); ReactDOM.render(React.createElement(ExtendedModalView, _objectSpread({}, this.props), null), this.modalElement); window.addEventListener('mousedown', this.callback, true); window.addEventListener('touchstart', this.callback, true); document.querySelector('body').style.overflow = 'hidden'; (window['FAM'] || function () {})('goal', { goal: 'money_popup_extended_open' }); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.modalElement.remove(); window.removeEventListener('mousedown', this.callback, true); window.removeEventListener('touchstart', this.callback, true); document.querySelector('body').style.removeProperty('overflow'); } }, { key: "render", value: function render() { if (this.API) { this.API.refresh(this.props); } return null; } }]); return ExtendedModal; }(React.Component); var ExtendedModalView = /*#__PURE__*/ function (_React$Component2) { _inherits(ExtendedModalView, _React$Component2); function ExtendedModalView() { _classCallCheck(this, ExtendedModalView); return _possibleConstructorReturn(this, _getPrototypeOf(ExtendedModalView).apply(this, arguments)); } _createClass(ExtendedModalView, [{ key: "render", value: function render() { var _this2 = this; return React.createElement("div", { className: "tariffs-extended-modal", scrollable: "true" }, React.createElement("div", { className: "tariffs-extended-modal__header" }, React.createElement("a", { href: "", className: "tariffs-extended-modal__back-button", onClick: function onClick(e) { return _this2.props.backButtonClickHandler(e); } }, "\u041D\u0430\u0437\u0430\u0434"), React.createElement(Logo, null)), React.createElement("div", { className: "tariffs-extended-modal__body" }, React.createElement(Tariffs, this.props))); } }]); return ExtendedModalView; }(React.Component); "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Logo = /*#__PURE__*/ function (_React$Component) { _inherits(Logo, _React$Component); function Logo() { _classCallCheck(this, Logo); return _possibleConstructorReturn(this, _getPrototypeOf(Logo).apply(this, arguments)); } _createClass(Logo, [{ key: "render", value: function render() { return React.createElement("svg", _extends({ xmlns: "http://www.w3.org/2000/svg", width: 110, height: 44, fill: "none" }, this.props), React.createElement("g", { fill: "#000105", fillRule: "evenodd", clipPath: "url(#a)", clipRule: "evenodd" }, React.createElement("path", { d: "M26.6 29.99c-.79.82-1.785 1.232-2.98 1.232-1.217 0-2.22-.411-3.012-1.232-.79-.822-1.185-1.921-1.185-3.3 0-1.378.395-2.478 1.185-3.3.791-.821 1.795-1.231 3.011-1.231 1.196 0 2.19.41 2.98 1.232.791.82 1.187 1.92 1.187 3.299s-.396 2.478-1.186 3.3Zm1.095-9.748c-1.177-1.317-2.809-1.976-4.897-1.976-1.541 0-2.935.345-4.181 1.033-1.248.69-2.226 1.674-2.936 2.951-.71 1.277-1.064 2.757-1.064 4.44 0 1.683.355 3.163 1.064 4.441.71 1.277 1.688 2.26 2.936 2.95 1.246.69 2.64 1.033 4.181 1.033 2.23 0 3.934-.709 5.11-2.128v1.885h4.531V18.509h-4.744v1.733Zm30.925-1.976c-1.217 0-2.338.233-3.362.7a6.715 6.715 0 0 0-2.54 1.976 5.555 5.555 0 0 0-2.25-1.992c-.933-.456-1.977-.684-3.133-.684-1.054 0-2.021.182-2.903.547a5.99 5.99 0 0 0-2.236 1.582v-1.886h-4.532V34.87h4.745v-8.212c0-1.418.324-2.488.973-3.208.649-.72 1.52-1.08 2.616-1.08 2.068 0 3.102 1.288 3.102 3.862v8.638h4.744v-8.212c0-1.418.324-2.488.973-3.208.65-.72 1.531-1.08 2.646-1.08.994 0 1.76.32 2.297.959.537.638.806 1.607.806 2.903v8.638h4.744v-9.367c0-2.412-.604-4.223-1.81-5.429-1.206-1.206-2.833-1.81-4.88-1.81Zm11.798 16.609h4.744V18.512h-4.744v16.363Zm4.5-23.457c-.547-.513-1.257-.77-2.129-.77-.872 0-1.58.268-2.128.802-.547.535-.821 1.198-.821 1.988 0 .791.273 1.455.82 1.989.548.535 1.257.802 2.13.802.871 0 1.581-.273 2.128-.818.548-.545.821-1.235.821-2.069 0-.77-.273-1.41-.82-1.924ZM8.751 18.65h5.013v-3.934h-5.17V8.963a3.834 3.834 0 0 1 3.83-3.83 3.835 3.835 0 0 1 3.83 3.83v1.74h4.632v-1.74C20.886 4.296 17.089.5 12.423.5 7.757.5 3.961 4.296 3.961 8.963v5.753H.273v3.935h3.688v10.536h.04v5.685h4.745V22.524l.005-.141V18.65Zm73.553-.138h-1.882v16.362h4.745v-7.725l-.134-4.41h6.32v-4.227h-9.05Zm27.477 5.551v-5.551h-4.813V25.7c0 2.331-.583 4.472-2.976 4.472-1.868 0-2.938-1.695-2.938-4.04v-7.62h-4.812v8.329c0 2.49.637 4.354 1.912 5.599 1.275 1.244 3.004 1.867 5.183 1.867 1.468 0 2.86-.67 3.631-1.913l.253-.462v2.89a4.302 4.302 0 0 1-1.271 3.062 4.301 4.301 0 0 1-3.062 1.27c-1.602 0-3-.875-3.75-2.17l-3.591 2.847a8.888 8.888 0 0 0 7.341 3.883c4.903 0 8.892-3.99 8.892-8.892v-2.49h.001v-8.269" })), React.createElement("defs", null, React.createElement("clipPath", { id: "a" }, React.createElement("path", { fill: "#fff", d: "M0 0h110v43.735H0z" })))); } }]); return Logo; }(React.Component); "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Tariff = /*#__PURE__*/ function (_React$Component) { _inherits(Tariff, _React$Component); function Tariff(props) { var _this; _classCallCheck(this, Tariff); _this = _possibleConstructorReturn(this, _getPrototypeOf(Tariff).call(this, props)); _this.state = { display_option_description: null }; _this.ref = React.createRef(); return _this; } _createClass(Tariff, [{ key: "componentDidMount", value: function componentDidMount() { var _this2 = this; var observer = new IntersectionObserver(function (entries, observer) { if (entries[0].intersectionRatio !== 1) { return; } _this2.props.handleFocus(_this2.props); }, { root: this.props.tariffsContentRef.current, rootMargin: "0px 0% 0px 0%", threshold: 1 }); if (!this.props.hasExpertTariff && document.querySelector('[data-is-premium="true"]')) { this.props.tariffsContentRef.current.scrollLeft = document.querySelector('[data-is-premium="true"]').getBoundingClientRect().left; } observer.observe(this.ref.current); } }, { key: "render", value: function render() { var _this3 = this; return React.createElement("div", { className: "tariff" + (this.props.is_default ? ' tariff_recommended' : ''), "data-is-premium": this.props.tag === 'premium', "data-is-pro": this.props.tag === 'pro', ref: this.ref }, !!this.props.is_default && React.createElement("div", { className: "tariff__recommended" }, "\u041F\u043E\u043F\u0443\u043B\u044F\u0440\u043D\u044B\u0439 \u0442\u0430\u0440\u0438\u0444"), React.createElement("div", { className: "tariff__body" }, React.createElement(TariffHeader, _extends({}, this.props, { isActive: this.props.product_variant.indexOf(this.props.selectedTariffId) !== -1 || this.props.tag === 'pro' && this.props.selectedTariffId === 'famirytree_maximum', hideButtons: this.props.hideButtons })), React.createElement("div", { className: "tariff__options" }, this.props[this.props.isAllOptions ? 'mobile_options' : this.props.isMobile ? 'mobile_short_options' : 'short_options'].map(function (raw_option, i) { var option = raw_option; if (_typeof(option) !== 'object') { option = { slug: option, title: option, tags: [], description: null }; } else { option = { slug: raw_option.title, title: raw_option.title, tags: [], description: raw_option.description }; } if (raw_option.layout === 'consult_to_year_premium') { return React.createElement("div", { className: "consult-block", key: 'option' + i }, React.createElement("div", { className: "consult-block__heading" }, "\u041F\u0440\u0438 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0435 \u043D\u0430 \u0433\u043E\u0434"), React.createElement("div", { className: "consult-block__body" }, React.createElement("div", { className: "consult-block__gift" }, "\u041F\u043E\u0434\u0430\u0440\u043E\u043A"), React.createElement("div", { className: "consult-block__title consult-block__title_shine" }, "\u041A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u044F"), React.createElement("div", { className: "consult-block__description" }, "\u0441 \u044D\u043A\u0441\u043F\u0435\u0440\u0442\u043E\u043C-\u0433\u0435\u043D\u0435\u0430\u043B\u043E\u0433\u043E\u043C"), React.createElement("button", { className: "consult-block__button", onClick: function onClick() { _this3.props.toYear(); } }, "\u041A \u0442\u0430\u0440\u0438\u0444\u0443 \u043D\u0430 \u0433\u043E\u0434"))); } if (raw_option.layout === 'consult_gift') { return React.createElement("div", { className: "consult-block", key: 'option' + i }, React.createElement("div", { className: "consult-block__heading" }, "\u0412 \u043F\u043E\u0434\u0430\u0440\u043E\u043A"), React.createElement("div", { className: "consult-block__body" }, React.createElement("div", { className: "consult-block__title" }, "\u041A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u044F"), React.createElement("div", { className: "consult-block__description" }, "\u0441 \u044D\u043A\u0441\u043F\u0435\u0440\u0442\u043E\u043C-\u0433\u0435\u043D\u0435\u0430\u043B\u043E\u0433\u043E\u043C"), React.createElement("div", { className: "consult-block__prices" }, React.createElement("span", { className: "consult-block__price" }, "0 \u20BD"), React.createElement("span", { className: "consult-block__old-price" }, "990 \u20BD")))); } return React.createElement("div", { className: "tariff__option", key: 'option' + i }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" + (option.description ? ' tariff-option__title_with-description' : ''), onMouseEnter: function onMouseEnter(e) { _this3.props.onDisplayOptionChange(option.slug); }, onMouseLeave: function onMouseLeave(e) { _this3.props.onDisplayOptionChange(null); } }, option.title, option.tags.indexOf('cloud_backup') !== -1 && React.createElement("div", { className: "tariff-option__export-services" }, React.createElement("div", { className: "tariff-option__export-service tariff-option__export-service_dropbox" }), React.createElement("div", { className: "tariff-option__export-service tariff-option__export-service_gdrive" }), React.createElement("div", { className: "tariff-option__export-service tariff-option__export-service_yadisk" }), React.createElement("div", { className: "tariff-option__export-service tariff-option__export-service_mail" })), !_this3.props.isMobile && option.description && _this3.props.display_option_description === option.slug ? React.createElement("div", { className: "tariff-option__description" }, option.description) : null, _this3.props.isMobile && React.createElement("div", { className: "tariff-option__mobile-description" }, " ", option.description))); }))), this.props.product_variant.indexOf('famirytree_free') !== -1 && React.createElement("div", { className: "tariffs-expert" }, React.createElement("div", { className: "tariffs-expert__badge" }, "\u041D\u043E\u0432\u043E\u0435 \u0432 Famiry"), React.createElement("div", { className: "tariffs-expert__title" }, "\u0422\u0430\u0440\u0438\u0444 \u042D\u043A\u0441\u043F\u0435\u0440\u0442"), React.createElement("div", { className: "tariffs-expert__body" }, "\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0430 \u043B\u0438\u0447\u043D\u043E\u0433\u043E \u044D\u043A\u0441\u043F\u0435\u0440\u0442\u0430 \u043D\u0430 \u0433\u043E\u0434"), React.createElement("a", { href: "https://famiry.ru/id/wlcm/zgth-rurd-bmha", className: "tariffs-expert__button", target: "_blank" }, "\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435 \u043E \u0442\u0430\u0440\u0438\u0444\u0435"))); } }]); return Tariff; }(React.Component); "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var ExpertTariff = /*#__PURE__*/ function (_React$Component) { _inherits(ExpertTariff, _React$Component); function ExpertTariff(props) { var _this; _classCallCheck(this, ExpertTariff); _this = _possibleConstructorReturn(this, _getPrototypeOf(ExpertTariff).call(this, props)); _this.state = { display_option_description: null }; _this.ref = React.createRef(); return _this; } _createClass(ExpertTariff, [{ key: "componentDidMount", value: function componentDidMount() { var _this2 = this; var observer = new IntersectionObserver(function (entries, observer) { if (entries[0].intersectionRatio !== 1) { return; } _this2.props.handleFocus(_this2.props); }, { root: this.props.tariffsContentRef.current, rootMargin: "0px 0% 0px 0%", threshold: 1 }); this.props.tariffsContentRef.current.scrollLeft = document.querySelector('[data-is-expert="true"]').getBoundingClientRect().left; observer.observe(this.ref.current); } }, { key: "render", value: function render() { return React.createElement("div", { className: "tariff tariff_expert", ref: this.ref, "data-is-expert": "true" }, React.createElement("div", { className: "tariff__body" }, React.createElement("div", { className: "tariff__new" }, "\u041D\u043E\u0432\u043E\u0435 \u0432 Famiry"), React.createElement(TariffHeader, { price_without_discount: 9900, price: 8250, period_price: 8250, price_without_discount_formatted: "9 900 \u20BD", price_formatted: "8 250 \u20BD", title: "\u042D\u043A\u0441\u043F\u0435\u0440\u0442", description: "\u0414\u043B\u044F \u0442\u0435\u0445, \u043A\u0442\u043E \u0445\u043E\u0447\u0435\u0442 \u0434\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0441\u0432\u043E\u044E \u0440\u043E\u0434\u043E\u0441\u043B\u043E\u0432\u043D\u0443\u044E \u043F\u0440\u043E\u0444\u0435\u0441\u0441\u0438\u043E\u043D\u0430\u043B\u0430\u043C", isExpert: true }), React.createElement("div", { className: "tariff__price-note" }, "* \u0426\u0435\u043D\u0430 \u0443\u043A\u0430\u0437\u0430\u043D\u0430 \u043F\u0440\u0438 \u043E\u043F\u043B\u0430\u0442\u0435 \u0442\u0430\u0440\u0438\u0444\u0430 \u0437\u0430 \u0433\u043E\u0434"), React.createElement("div", { className: "tariff__options" }, React.createElement("div", { className: "tariff__option" }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" }, "50 \u0447\u0430\u0441\u043E\u0432 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0439 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0438 \u044D\u043A\u0441\u043F\u0435\u0440\u0442\u0430 \u043D\u0430 \u0433\u043E\u0434")), React.createElement("div", { className: "tariff__option" }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" }, "\u0412\u0441\u0435 \u043F\u0440\u0435\u0438\u043C\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u0440\u0438\u0444\u0430 ", React.createElement("strong", { className: "expert-tariff-pro-option" }, "\u041F\u0440\u043E"), " \u043D\u0430 \u0433\u043E\u0434")), React.createElement("div", { className: "tariff__option" }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" }, "\u0417\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435 \u0434\u0440\u0435\u0432\u0430 \u0441\u0435\u043C\u044C\u0438 \u0437\u0430 \u0432\u0430\u0441")), React.createElement("div", { className: "tariff__option" }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" }, "\u041F\u043E\u0438\u0441\u043A \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u0438 \u0432\xA0\u043E\u0446\u0438\u0444\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0430\u0440\u0445\u0438\u0432\u0430\u0445 \u0438\xA0\u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043D\u043D\u044B\u0445")), React.createElement("div", { className: "tariff__option" }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" }, "\u041E\u043D\u043B\u0430\u0439\u043D-\u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0438 \u0441\xA0\u044D\u043A\u0441\u043F\u0435\u0440\u0442\u043E\u043C")), React.createElement("div", { className: "tariff__option" }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" }, "\u0418\u043D\u0442\u0435\u0440\u0432\u044C\u044E \u0441\xA0\u0440\u043E\u0434\u0441\u0442\u0432\u0435\u043D\u043D\u0438\u043A\u0430\u043C\u0438")), React.createElement("div", { className: "tariff__option" }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" }, "\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430 \u0437\u0430\u043F\u0440\u043E\u0441\u043E\u0432 \u0432\xA0\u0430\u0440\u0445\u0438\u0432\u044B")), React.createElement("div", { className: "tariff__option" }, React.createElement("div", { className: "tariff-option__title tariff-option__title_with-check tariff-option__title_short" }, "\u041E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0440\u0430\u0431\u043E\u0442\u044B \u0440\u0435\u0433\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0438\u0441\u0441\u043B\u0435\u0434\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u0439"))))); } }]); return ExpertTariff; }(React.Component); "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var TariffHeader = /*#__PURE__*/ function (_React$Component) { _inherits(TariffHeader, _React$Component); function TariffHeader(props) { _classCallCheck(this, TariffHeader); return _possibleConstructorReturn(this, _getPrototypeOf(TariffHeader).call(this, props)); } _createClass(TariffHeader, [{ key: "navigateToTree", value: function navigateToTree() { window.location.href = 'https://famiry.ru/tree'; } }, { key: "render", value: function render() { var _this = this; var discount = Number(this.props.price_without_discount) - Number(this.props.price); var discountPercent = 0; if (this.props.price_without_discount) { discountPercent = Math.floor(100 * discount / this.props.price_without_discount / 5) * 5; } var unitString = ''; var price = 0; var priceString = ''; if (this.props.period_price_formatted) { price = this.props.period_price; priceString = this.props.period_price_formatted; if (this.props.period === 'month') { unitString = 'месяц'; } if (this.props.period === 'forever') { unitString = 'навсегда'; } } else { price = this.props.price; priceString = this.props.price_formatted; unitString = this.props.period_count + ' ' + this.props.period; if (unitString === '1 month') { unitString = 'месяц'; } if (unitString === '3 month') { unitString = '3 месяца'; } if (unitString === '12 month') { unitString = 'год'; } } if (this.props.isExpert) { unitString = 'месяц'; } return React.createElement("div", { className: "tariff-header" }, React.createElement("div", { className: "tariff__title" }, this.props.title, discountPercent !== 0 && React.createElement("div", { className: "tariff__discount-badge" }, "\u2212", discountPercent, "%")), this.props.price_without_discount !== 0 && Number(this.props.price_without_discount) !== Number(this.props.price) && React.createElement("div", { className: "tariff__old-price" }, this.props.price_without_discount_formatted), React.createElement("div", { className: "tariff__price" + (price === 0 ? ' tariff__price_free' : '') }, React.createElement("nobr", null, price === 0 ? React.createElement(React.Fragment, null, "\u0411\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u044B\u0439", React.createElement("br", null), "\u0442\u0430\u0440\u0438\u0444") : priceString), React.createElement("nobr", null, price !== 0 && React.createElement("div", { className: "tariff__price-unit" }, "/", unitString))), React.createElement("div", { className: "tariff__divider" }), React.createElement("div", { className: "tariff__description" }, this.props.description), !this.props.isExpert && (0 && this.props.isOnlyPopup ? React.createElement("div", { className: "tariff__active-buy-button" }, " ") : this.props.isActive ? React.createElement("div", { className: "tariff__active-buy-button" }, "\u0423\u0436\u0435 \u0443 \u0432\u0430\u0441") : React.createElement("button", { className: "tariff__buy-button", disabled: this.props.hideButtons, onClick: function onClick() { if (price === 0) { _this.navigateToTree(); } else if (_this.props.paymentHandler) { _this.props.paymentHandler(_this.props.id, _this.props); } } }, "\u041A\u0443\u043F\u0438\u0442\u044C")), this.props.isExpert && React.createElement(React.Fragment, null, React.createElement("a", { className: "tariff__button", href: "https://famiry.ru/id/wlcm/zgth-rurd-bmha", target: "_blank" }, "\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435 \u043E \u0442\u0430\u0440\u0438\u0444\u0435"))); } }]); return TariffHeader; }(React.Component); "use strict"; function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var BatteryIcon = /*#__PURE__*/ function (_React$Component) { _inherits(BatteryIcon, _React$Component); function BatteryIcon() { _classCallCheck(this, BatteryIcon); return _possibleConstructorReturn(this, _getPrototypeOf(BatteryIcon).apply(this, arguments)); } _createClass(BatteryIcon, [{ key: "render", value: function render() { if (this.props.variant === 'bar:small') { return React.createElement("svg", { width: "39", height: "20", viewBox: "0 0 39 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, React.createElement("rect", { width: "39", height: "20", rx: "4", fill: "#DEE3EB" }), React.createElement("rect", { x: "2", y: "2", width: "8", height: "16", rx: "2", fill: "#14C94A" }), React.createElement("rect", { x: "2", y: "2", width: "8", height: "16", rx: "2", fill: "#DB4437" })); } if (this.props.variant === 'bar:medium') { return React.createElement("svg", { width: "39", height: "20", viewBox: "0 0 39 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, React.createElement("g", { opacity: "0.2" }, React.createElement("rect", { width: "39", height: "20", rx: "4", fill: "#DEE3EB" }), React.createElement("rect", { width: "39", height: "20", rx: "4", fill: "white" })), React.createElement("rect", { x: "2", y: "2", width: "8", height: "16", rx: "2", fill: "#F4B400" }), React.createElement("rect", { x: "11", y: "2", width: "8", height: "16", rx: "2", fill: "#F4B400" }), React.createElement("rect", { x: "20", y: "2", width: "8", height: "16", rx: "2", fill: "#F4B400" })); } if (this.props.variant === 'bar:full') { return React.createElement("svg", { width: "39", height: "20", viewBox: "0 0 39 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, React.createElement("rect", { width: "39", height: "20", rx: "4", fill: "#DEE3EB" }), React.createElement("rect", { x: "2", y: "2", width: "8", height: "16", rx: "2", fill: "#14C94A" }), React.createElement("rect", { x: "11", y: "2", width: "8", height: "16", rx: "2", fill: "#14C94A" }), React.createElement("rect", { x: "20", y: "2", width: "8", height: "16", rx: "2", fill: "#14C94A" }), React.createElement("rect", { x: "29", y: "2", width: "8", height: "16", rx: "2", fill: "#14C94A" })); } } }]); return BatteryIcon; }(React.Component); var TariffsTable = /*#__PURE__*/ function (_React$Component2) { _inherits(TariffsTable, _React$Component2); function TariffsTable(props) { var _this; _classCallCheck(this, TariffsTable); _this = _possibleConstructorReturn(this, _getPrototypeOf(TariffsTable).call(this, props)); _this.state = { is_production: window.location.host === 'famiry.ru', loading: true, loadingError: false, options: [], display_option_description: null }; _this.barVariants = ['bar:small', 'bar:medium', 'bar:full']; return _this; } _createClass(TariffsTable, [{ key: "getOptions", value: function getOptions() { var _this2 = this; var url = "https://famiry.dev/id/api/v1/products/famirytree/options"; if (this.state.is_production) { url = "https://famiry.ru/id/api/v1/products/famirytree/options"; } this.setState({ loading: true, loadingError: false }); fetch(url, { headers: { 'Accept': 'application/json' } }).then(function (response) { return response.json(); }).then(function (data) { _this2.setState({ options: data.data }); }).catch(function (e) { _this2.setState({ loadingError: true }); console.error(e); }).finally(function () { _this2.setState({ loading: false }); }); } }, { key: "componentDidMount", value: function componentDidMount() { this.getOptions(); } }, { key: "render", value: function render() { var _this3 = this; return React.createElement("div", { className: "tariffs-table" }, React.createElement("div", { className: "tariffs-table__header" }, React.createElement("div", { className: "tariffs__period-toggle tariffs-period-toggle" }, this.props.tariffs.length > 1 ? Object.keys(this.props.periods).map(function (period) { return React.createElement("button", { className: "tariffs-period-toggle__item" + (period === _this3.props.period ? ' tariffs-period-toggle__item_active' : ''), onClick: function onClick() { return _this3.props.onChangePeriod(period); }, key: period }, _this3.props.periods[period], _this3.props.periodsDiscountPercent[period] > 0 && React.createElement("div", { className: "tariffs-period-toggle__discount" }, " ", _this3.props.periodsDiscountPercent[period], "%")); }) : null), this.props.tariffs.map(function (tariff) { return React.createElement("div", { className: "tariffs-table__header-wrapper" + (!!tariff.is_default ? ' tariffs-table__header-wrapper_recommended' : ''), "data-is-premium": tariff.product_variant.indexOf('famirytree_premium') !== -1, "data-is-pro": tariff.product_variant.indexOf('famirytree_pro') !== -1 }, !!tariff.is_default && React.createElement("div", { className: "tariff__recommended" }, "\u041F\u043E\u043F\u0443\u043B\u044F\u0440\u043D\u044B\u0439 \u0442\u0430\u0440\u0438\u0444"), React.createElement(TariffHeader, _extends({}, tariff, { isOnlyPopup: _this3.props.isOnlyPopup, paymentHandler: _this3.props.paymentHandler, isActive: tariff.product_variant.indexOf(_this3.props.selectedTariffId) !== -1 || _this3.props.tag === 'pro' && _this3.props.selectedTariffId === 'famirytree_maximum', stat: _this3.props.stat, hideButtons: _this3.props.hideButtons }))); })), React.createElement("div", { className: "tariffs-table__body" }, React.createElement("div", { className: "tariff-options" }, this.state.options.map(function (option) { return React.createElement("div", { className: "tariff-option", key: option.slug }, React.createElement("div", { className: "tariff-option__title" + (option.description ? ' tariff-option__title_with-description' : '') }, option.tags.indexOf('popular') !== -1 && React.createElement("div", { className: "tariff-option__popular" }, "\u041F\u043E\u043F\u0443\u043B\u044F\u0440\u043D\u043E"), option.tags.indexOf('soon') !== -1 && React.createElement("div", { className: "tariff-option__soon" }, "\u0421\u043A\u043E\u0440\u043E"), React.createElement("span", { onMouseEnter: function onMouseEnter(e) { _this3.setState({ display_option_description: _this3.state.display_option_description === option.slug ? null : option.slug }); }, onMouseLeave: function onMouseLeave(e) { _this3.setState({ display_option_description: null }); } }, option.title, option.tags.indexOf('cloud_backup') !== -1 && React.createElement("div", { className: "tariff-option__export-services" }, React.createElement("div", { className: "tariff-option__export-service tariff-option__export-service_dropbox" }), React.createElement("div", { className: "tariff-option__export-service tariff-option__export-service_gdrive" }), React.createElement("div", { className: "tariff-option__export-service tariff-option__export-service_yadisk" }), React.createElement("div", { className: "tariff-option__export-service tariff-option__export-service_mail" }))), option.description && _this3.state.display_option_description === option.slug ? React.createElement("div", { className: "tariff-option__description" }, option.description) : null), _this3.props.tariffs.map(function (tariff, i) { var optionData = tariff.options.find(function (o) { return o.slug === option.slug; }); var value = '—'; if (optionData) { if (optionData.display_value) { value = optionData.display_value; } else if (!optionData.value || optionData.value === 'no') { value = '—'; } else if (!optionData.display_value && _this3.barVariants.indexOf(optionData.value) !== -1) { value = React.createElement(BatteryIcon, { variant: optionData.value }); } else { value = React.createElement(CheckIcon, null); } } return React.createElement("div", { className: "tariff-option__value" + (!!tariff.is_default ? ' tariff-option__value_recommended' : ''), "data-is-premium": tariff.product_variant.indexOf('famirytree_premium') !== -1, "data-is-pro": tariff.product_variant.indexOf('famirytree_pro') !== -1, key: 'option' + i }, value); })); })))); } }]); return TariffsTable; }(React.Component); "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Tariffs = /*#__PURE__*/ function (_React$Component) { _inherits(Tariffs, _React$Component); function Tariffs(props) { var _this; _classCallCheck(this, Tariffs); _this = _possibleConstructorReturn(this, _getPrototypeOf(Tariffs).call(this, props)); _this.state = { is_production: window.location.host === 'famiry.ru', loading: true, loadingError: false, tariffs: [], periods: { year: 'В год', month: '3 месяца' }, periodsDiscountPercent: _this.props.periodsDiscountPercent ? _this.props.periodsDiscountPercent : { year: 0, month: 0 }, period: _this.props.defaultPeriod ? _this.props.defaultPeriod : 'year', display_option_description: null, focusedTariff: null, isAllOptions: false, isMobile: window.matchMedia('(max-width: 600px)') }; _this.tariffsContentRef = React.createRef(); return _this; } _createClass(Tariffs, [{ key: "getTariffs", value: function getTariffs() { var _this2 = this; var url = "https://famiry.dev/id/api/v1/products/famirytree/rates"; if (this.state.is_production) { url = "https://famiry.ru/id/api/v1/products/famirytree/rates"; } if (this.props.rateOption) { url = url + '?rate_option=' + this.props.rateOption; } var urlWithParams = new URL(url); urlWithParams.searchParams.set('withActiveOptionsFor', 'famirytree@user.' + this.props.userId + ',famiryauto@tree.' + this.props.treeId); this.setState({ loading: true, loadingError: false }); fetch(urlWithParams.toString(), { headers: { 'Accept': 'application/json' } }).then(function (response) { return response.json(); }).then(function (data) { var tariffs = data.data; if (_this2.props.selectedTariffId !== 'famirytree_free') { tariffs = []; for (var i in data.data) { if (data.data[i]['price'] > 0) { tariffs.push(data.data[i]); } } } _this2.setState({ tariffs: tariffs }); }).catch(function (e) { _this2.setState({ loadingError: true }); console.error(e); }).finally(function () { _this2.setState({ loading: false }); }); } }, { key: "componentDidMount", value: function componentDidMount() { this.getTariffs(); } }, { key: "render", value: function render() { var _this3 = this; var list = this.state.tariffs.filter(function (tariff) { if (tariff.period === 'forever') { return true; } return _this3.state.period === 'year' && tariff.period_count === 12 || _this3.state.period === 'month' && (tariff.period_count === 1 || tariff.period_count === 3) || _this3.state.tariffs.length === 1; }); return React.createElement("div", { className: "tariffs" }, React.createElement("div", { className: "tariffs__title" }, this.props.title ? this.props.title : React.createElement(React.Fragment, null, "\u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0434\u043B\u044F \u0441\u0435\u0431\u044F \u0432\u0430\u0448\u0443", React.createElement("span", { className: "tariffs__title_br" }), " \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u0443\u044E \u0441\u0435\u043C\u0435\u0439\u043D\u0443\u044E \u0438\u0441\u0442\u043E\u0440\u0438\u044E")), React.createElement("div", { className: "tariffs__subtitle" }, this.props.subtitle ? this.props.subtitle : 'Составляйте свое древо, находите родственников и совершайте новые открытия'), !this.props.isExtended && this.state.tariffs.length > 1 && React.createElement("div", { className: "tariffs__period-toggle tariffs-period-toggle" }, Object.keys(this.state.periods).map(function (period) { return React.createElement("button", { className: "tariffs-period-toggle__item" + (period === _this3.state.period ? ' tariffs-period-toggle__item_active' : ''), onClick: function onClick() { return _this3.setState({ period: period }); }, key: period }, _this3.state.periods[period], _this3.state.periodsDiscountPercent[period] > 0 && React.createElement("div", { className: "tariffs-period-toggle__discount" }, _this3.state.periodsDiscountPercent[period], "%")); })), !this.state.loading && this.props.isExtended && React.createElement(TariffsTable, { tariffs: list, periods: this.state.periods, period: this.state.period, periodsDiscountPercent: this.state.periodsDiscountPercent, onChangePeriod: function onChangePeriod(period) { return _this3.setState({ period: period }); }, periodChangeHandler: function periodChangeHandler(period) { return _this3.setState({ period: period }); }, paymentHandler: this.props.openPaymentUrl, selectedTariffId: this.props.selectedTariffId, isOnlyPopup: this.props.isOnlyPopup, hideButtons: this.props.hideButtons }), !this.props.isExtended && React.createElement("div", { className: "tariffs__content", ref: this.tariffsContentRef }, this.state.loading && React.createElement(React.Fragment, null, React.createElement("div", { className: "tariff-skeleton" }), React.createElement("div", { className: "tariff-skeleton" }), React.createElement("div", { className: "tariff-skeleton" })), !this.state.loading && !this.props.isExtended && list.map(function (tariff) { return React.createElement(Tariff, _extends({}, tariff, { key: tariff.id, paymentHandler: function paymentHandler(tariffId, tariff) { return _this3.props.openPaymentUrl(tariffId, tariff); }, selectedTariffId: _this3.props.selectedTariffId, display_option_description: _this3.state.display_option_description, onDisplayOptionChange: function onDisplayOptionChange(slug) { _this3.setState({ display_option_description: _this3.state.display_option_description === slug ? null : slug }); }, isAllOptions: _this3.state.isAllOptions, isOnlyPopup: _this3.props.isOnlyPopup, isMobile: _this3.state.isMobile, toYear: function toYear() { return _this3.setState({ period: 'year' }); }, handleFocus: _this3.props.handleFocus, tariffsContentRef: _this3.tariffsContentRef, hideButtons: _this3.props.hideButtons, hasExpertTariff: _this3.props.selectedTariffId === 'famirytree_premium' || _this3.props.selectedTariffId === 'famirytree_pro' })); }), !this.state.loading && (this.props.selectedTariffId === 'famirytree_premium' || this.props.selectedTariffId === 'famirytree_pro') && React.createElement(ExpertTariff, { isMobile: this.state.isMobile, handleFocus: this.props.handleFocus, tariffsContentRef: this.tariffsContentRef, isExpertTariff: true }), this.state.loadingError && React.createElement("div", { className: "tariffs__error" }, "\u0412\u043E \u0432\u0440\u0435\u043C\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u043F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430, ", React.createElement("br", null), "\u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443")), !this.state.isAllOptions && React.createElement("button", { className: "tariffs__mobile-more", onClick: function onClick() { _this3.setState({ isAllOptions: true }); } }, "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u043E\u043B\u043D\u043E\u0441\u0442\u044C\u044E"), this.props.moreClickHandler && !this.props.isExtended && React.createElement("a", { className: "tariffs__more", onClick: function onClick() { _this3.props.moreClickHandler(); (window['FAM'] || function () {})('goal', { goal: 'more_about_tariffs_at_tariffs' }); } }, "\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435 \u043E \u0442\u0430\u0440\u0438\u0444\u0430\u0445")); } }]); return Tariffs; }(React.Component); "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Modal = /*#__PURE__*/ function (_React$Component) { _inherits(Modal, _React$Component); function Modal(props) { var _this; _classCallCheck(this, Modal); _this = _possibleConstructorReturn(this, _getPrototypeOf(Modal).call(this, props)); _this.API = null; _this.body_scroll = null; _this.callback = function (e) { e.stopPropagation(); }; return _this; } _createClass(Modal, [{ key: "componentDidMount", value: function componentDidMount() { this.body_scroll = document.querySelector('body').scrollTop; document.querySelector('body').style.position = 'fixed'; document.querySelector('body').style.width = '100%'; document.querySelector('body').style.overflow = 'auto'; document.querySelector('body').style.top = '-' + this.body_scroll; if (!this.props.disableClickCatching) { window.addEventListener('mousedown', this.callback, true); window.addEventListener('touchstart', this.callback, true); } // @todo add esc } }, { key: "componentWillUnmount", value: function componentWillUnmount() { document.querySelector('body').style.removeProperty('position'); document.querySelector('body').style.removeProperty('overflow'); document.querySelector('body').style.removeProperty('width'); document.querySelector('body').style.removeProperty('top'); if (this.body_scroll !== null) { document.querySelector('body').scrollTop = this.body_scroll; } if (!this.props.disableClickCatching) { window.removeEventListener('mousedown', this.callback, true); window.removeEventListener('touchstart', this.callback, true); } } }, { key: "render", value: function render() { var _this2 = this; if (this.API) { this.API.refresh(this.props); } return ReactDOM.createPortal(React.createElement(ModalView, _objectSpread({ registerAPI: function registerAPI(API) { _this2.API = API; } }, this.props), null), document.body); } }]); return Modal; }(React.Component); var ModalView = /*#__PURE__*/ function (_React$Component2) { _inherits(ModalView, _React$Component2); function ModalView(props) { var _this3; _classCallCheck(this, ModalView); _this3 = _possibleConstructorReturn(this, _getPrototypeOf(ModalView).call(this, props)); _this3.modalRef = React.createRef(); _this3.modalContentRef = React.createRef(); return _this3; } _createClass(ModalView, [{ key: "componentDidMount", value: function componentDidMount() { var _this4 = this; this.props.registerAPI({ refresh: function refresh(props) { _this4.setState(props); } }); } }, { key: "componentWillUnmount", value: function componentWillUnmount() {} }, { key: "outsideClickHandler", value: function outsideClickHandler(e) { e.stopPropagation(); if (this.modalRef.current === e.target || this.modalContentRef.current === e.target) { this.props.onClose(); } } }, { key: "render", value: function render() { var _this5 = this; var props = this.props; var content = React.createElement(React.Fragment, null, props.title ? React.createElement("div", { className: "subheading text-center mb-5" }, props.title) : null, props.content, props.children); var style = { display: 'none' }; var style_content = {}; if (props.scroll) { style = { flexDirection: 'column', alignItems: 'center' }; style_content = { maxHeight: 'calc(100% - 40px)', overflow: 'hidden' }; content = React.createElement("div", { style: { maxHeight: '100%', overflowY: 'scroll' } }, content); } return React.createElement("div", { className: "quiz-modal " + this.props.modal_class, style: style, onMouseDown: function onMouseDown(e) { return _this5.outsideClickHandler(e); }, onTouchStart: function onTouchStart(e) { return _this5.outsideClickHandler(e); }, scrollable: "true", ref: this.modalRef }, React.createElement("div", { className: (props.custom_wrapper_class ? props.custom_wrapper_class : "quiz-modal__content-wrapper") + (props.add_wrapper_class ? " ".concat(props.add_wrapper_class) : ''), ref: this.modalContentRef }, this.props.prepend, !this.props.isCloseButtonInside && !this.props.isNoClose && React.createElement("div", { className: "quiz-modal__close", onClick: function onClick(e) { props.onClose(); }, style: this.props.isTransparentClose ? { opacity: '0.4' } : {} }, React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1", viewBox: "0 0 24 24" }, React.createElement("path", { style: { fill: 'currentColor', strokeWidth: 0 }, d: "M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z" }))), React.createElement("div", { className: (props.custom_content_class ? props.custom_content_class : "quiz-modal__content") + (props.add_class ? " ".concat(props.add_class) : ''), style: style_content, onClick: function onClick(e) { e.stopPropagation(); } }, this.props.isCloseButtonInside && !this.props.isNoClose && React.createElement("button", { className: "quiz-modal__close-button", style: this.props.isTransparentClose ? { opacity: '0.4' } : {}, onClick: function onClick(e) { e.preventDefault(); props.onClose(); } }), content))); } }]); return ModalView; }(React.Component); ModalView.defaultProps = { isCloseButtonInside: true }; "use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var FamiryGlobalCSSLoader = /*#__PURE__*/ function () { function FamiryGlobalCSSLoader() { _classCallCheck(this, FamiryGlobalCSSLoader); } _createClass(FamiryGlobalCSSLoader, null, [{ key: "load", value: function load(css_urls) { var promises = []; window['FamiryGlobalCSSLoaderData'] = window['FamiryGlobalCSSLoaderData'] ? window['FamiryGlobalCSSLoaderData'] : {}; var head = document.getElementsByTagName('head')[0]; var _loop = function _loop(i) { var url = css_urls[i]; if (!window['FamiryGlobalCSSLoaderData'][url]) { promises.push(new Promise(function (resolve, reject) { var link = document.createElement('link'); link.id = Math.floor(Math.random() * 99999999999); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = url; link.media = 'all'; link.onload = resolve; link.onerror = reject; head.appendChild(link); window['FamiryGlobalCSSLoaderData'][url] = link; })); } }; for (var i in css_urls) { _loop(i); } return Promise.all(promises); } }]); return FamiryGlobalCSSLoader; }(); "use strict"; function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var CheckIcon = /*#__PURE__*/ function (_React$Component) { _inherits(CheckIcon, _React$Component); function CheckIcon() { _classCallCheck(this, CheckIcon); return _possibleConstructorReturn(this, _getPrototypeOf(CheckIcon).apply(this, arguments)); } _createClass(CheckIcon, [{ key: "render", value: function render() { return React.createElement("svg", { width: "1.1em", height: "1em", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, React.createElement("path", { d: "M17.582 2.942a1.428 1.428 0 0 0-2.02 0l-9.086 9.087L2.438 7.99a1.428 1.428 0 1 0-2.02 2.02l5.048 5.047a1.423 1.423 0 0 0 2.02 0L17.582 4.961a1.428 1.428 0 0 0 0-2.02Z", fill: "#31AC52" })); } }]); return CheckIcon; }(React.Component); var PayPopup = /*#__PURE__*/ function (_React$Component2) { _inherits(PayPopup, _React$Component2); function PayPopup(props) { var _this; _classCallCheck(this, PayPopup); _this = _possibleConstructorReturn(this, _getPrototypeOf(PayPopup).call(this, props)); _this.CSS_URL = 'https://famiry.ru/id/global/tree/banner.css'; FamiryGlobalCSSLoader.load([_this.CSS_URL]); _this.version = window.famirytree_friend_invite_version; _this.state = { showInvitation: false, focusedTariff: null, isExtended: false }; return _this; } _createClass(PayPopup, [{ key: "backButtonClickHandler", value: function backButtonClickHandler(e) { e.preventDefault(); e.stopPropagation(); this.props.onClose(); } }, { key: "extendedButtonClickHandler", value: function extendedButtonClickHandler(e) { e.preventDefault(); e.stopPropagation(); this.setState({ isExtended: false }); } }, { key: "openPaymentUrl", value: function openPaymentUrl(rate_id, rate) { this.props.stat ? this.props.stat.onRateClick(rate_id, rate) : null; if (rate.goals && rate.goals.select) { (window['FAM'] || function () {})('goal', { goal: rate.goals.select }); } var url = "/id/tree/pay"; if (this.state.is_production) { url = "https://famiry.ru/id/tree/pay"; if (this.props.mode === 'frombot') { url = "https://famiry.ru/id/tree/payfrombot"; } } var params = new URLSearchParams(); params.set('tree_id', this.props.stat ? this.props.stat.user_id : this.props.treeId); params.set('user_id', this.props.stat ? this.props.stat.user_id : this.props.userId); params.set('option', this.props.stat ? this.props.stat.option : this.props.option); params.set('rate_id', rate_id); window.location.href = url + '?' + params.toString(); } }, { key: "componentDidMount", value: function componentDidMount() { (window['FAM'] || function () {})('goal', { goal: 'money_popup_open' }); document.querySelector('body').style.overflow = 'hidden'; } }, { key: "componentWillUnmount", value: function componentWillUnmount() { document.querySelector('body').style.overflow = 'auto'; } }, { key: "render", value: function render() { var _this2 = this; if (this.state.isExtended) { return React.createElement(ExtendedModal, _extends({}, this.props, { isExtended: this.state.isExtended, openPaymentUrl: this.openPaymentUrl.bind(this), backButtonClickHandler: this.extendedButtonClickHandler.bind(this), stat: this.props.stat })); } if (this.state.showInvitation) { return React.createElement(FExternalComponent, { src: '/tree/v1/auth/proxy/global/tree/friendinvite.js', props: { user_id: this.props.userId, onClose: function onClose() { return _this2.setState({ showInvitation: false }); } } }); } return React.createElement(Modal, { isNoClose: this.props.hasBackButton, content: React.createElement(React.Fragment, null, React.createElement("div", { className: "pay-popup__mobile-header" + (this.props.hasBackButton ? ' pay-popup__mobile-header_visible' : '') }, React.createElement("button", { className: "pay-popup__mobile-header-close-button", onClick: function onClick(e) { return _this2.backButtonClickHandler(e); } }), React.createElement("a", { className: "pay-popup__mobile-header-logo", href: "https://famiry.ru" })), React.createElement(Tariffs, _extends({}, this.props, { moreClickHandler: function moreClickHandler() { _this2.setState({ isExtended: true }); }, openPaymentUrl: this.openPaymentUrl.bind(this), stat: this.props.stat, handleFocus: function handleFocus(tariff) { _this2.setState({ focusedTariff: tariff }); } })), this.state.focusedTariff && React.createElement("div", { className: "pay-popup__mobile-footer" }, this.state.focusedTariff.isExpertTariff ? React.createElement("a", { className: "pay-popup__mobile-footer-button", href: "https://famiry.ru/id/wlcm/zgth-rurd-bmha", target: "_blank" }, "\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u0435\u0435") : this.state.focusedTariff.product_variant === this.props.selectedTariffId ? React.createElement("button", { className: "pay-popup__mobile-footer-button pay-popup__mobile-footer-button_active" }, "\u0423\u0436\u0435 \u0443 \u0432\u0430\u0441") : React.createElement("button", { className: "pay-popup__mobile-footer-button", disabled: this.state.focusedTariff.hideButtons, onClick: function onClick() { return _this2.openPaymentUrl(_this2.state.focusedTariff.id, _this2.state.focusedTariff); } }, "\u041A\u0443\u043F\u0438\u0442\u044C ", this.state.focusedTariff.title))), modal_class: "pay-popup-modal", add_class: "pay-popup", prepend: 1 || this.props.isOnlyPopup ? null : React.createElement("div", { className: "invitation-bar", onClick: function onClick(e) { return e.stopPropagation(); } }, "\u041A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u044F \u0441 \u044D\u043A\u0441\u043F\u0435\u0440\u0442\u043E\u043C ", React.createElement("span", { className: "invitation-bar__highlight" }, "\u0432 \u043F\u043E\u0434\u0430\u0440\u043E\u043A"), " \u0432 \u0442\u0430\u0440\u0438\u0444\u0435 \u041F\u0440\u0435\u043C\u0438\u0443\u043C"), onClose: function onClose() { return _this2.props.onClose(); } }); } }]); return PayPopup; }(React.Component); "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var PayPopupEventHandler = /*#__PURE__*/ function (_React$Component) { _inherits(PayPopupEventHandler, _React$Component); function PayPopupEventHandler(props) { var _this; _classCallCheck(this, PayPopupEventHandler); _this = _possibleConstructorReturn(this, _getPrototypeOf(PayPopupEventHandler).call(this, props)); _this.state = { isModalOpen: false, isExtended: false, eventProps: {} }; return _this; } _createClass(PayPopupEventHandler, [{ key: "popupOpenHandler", value: function popupOpenHandler(eventProps) { this.setState({ isModalOpen: true, eventProps: eventProps }); this.props.stat ? this.props.stat.onRatesOpened() : null; } }, { key: "componentDidMount", value: function componentDidMount() { var _this2 = this; window.addEventListener('OPEN_PAYMENTS_MODAL', function (e) { return _this2.popupOpenHandler(e.detail && e.detail.props || {}); }); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { var _this3 = this; window.removeEventListener('OPEN_PAYMENTS_MODAL', function () { return _this3.popupOpenHandler(); }); } }, { key: "popupCloseHandler", value: function popupCloseHandler() { this.setState({ isModalOpen: false, isExtended: false }); } }, { key: "openPaymentUrl", value: function openPaymentUrl(rate_id, rate) { this.props.stat ? this.props.stat.onRateClick(rate_id, rate) : null; if (rate.goals && rate.goals.select) { (window['FAM'] || function () {})('goal', { goal: rate.goals.select }); } var url = "/id/tree/pay"; if (this.state.is_production) { url = "https://famiry.ru/id/tree/pay"; if (this.props.mode === 'frombot') { url = "https://famiry.ru/id/tree/payfrombot"; } } var params = new URLSearchParams(); params.set('tree_id', this.props.stat ? this.props.stat.user_id : this.props.treeId); params.set('user_id', this.props.stat ? this.props.stat.user_id : this.props.userId); params.set('option', this.props.stat ? this.props.stat.option : this.props.option); params.set('rate_id', rate_id); window.location.href = url + '?' + params.toString(); } }, { key: "backButtonClickHandler", value: function backButtonClickHandler(e) { e.preventDefault(); e.stopPropagation(); this.setState({ isExtended: false }); } }, { key: "render", value: function render() { var _this4 = this; if (!this.state.isModalOpen) { return null; } if (this.state.isExtended) { return React.createElement(ExtendedModal, _extends({}, this.props, { openPaymentUrl: this.openPaymentUrl.bind(this), backButtonClickHandler: this.backButtonClickHandler.bind(this), stat: this.props.stat }, this.state.eventProps)); } return React.createElement(PayPopup, _extends({ treeId: this.props.tree_id, userId: this.props.user_id, onClose: function onClose() { return _this4.popupCloseHandler(); }, moreClickHandler: function moreClickHandler() { _this4.setState({ isExtended: true }); _this4.props.stat ? _this4.props.stat.onExtendedRatesOpened() : null; } }, this.props, this.state.eventProps)); } }]); return PayPopupEventHandler; }(React.Component);window['___component_1741997235664_2'] = PayPopupEventHandler;