"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ExploreAppsState = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _mobx = require("mobx");
var _bi = require("@wix/bex-core/bi");
var _ExploreAppsModal = require("./ExploreAppsModal");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/MoreActions/ExploreAppsState.tsx";
class ExploreAppsState {
  constructor({
    modalProps,
    reportBi,
    translatedText
  }) {
    (0, _defineProperty2.default)(this, "modalProps", void 0);
    (0, _defineProperty2.default)(this, "moreActionsMenuItem", void 0);
    (0, _defineProperty2.default)(this, "isModalOpen", false);
    (0, _defineProperty2.default)(this, "reportBi", _reportProps => {});
    (0, _defineProperty2.default)(this, "Modal", void 0);
    this.modalProps = modalProps;
    this.moreActionsMenuItem = {
      biName: 'Explore Apps',
      text: translatedText,
      prefixIcon: /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.RelatedApps, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 43,
          columnNumber: 19
        }
      }),
      onClick: this.openExploreAppsModal.bind(this),
      modalProps
    };
    this.reportBi = reportBi;
    this.Modal = _ExploreAppsModal.ExploreAppsModal;
    (0, _mobx.makeObservable)(this, {
      modalProps: _mobx.observable.ref,
      moreActionsMenuItem: _mobx.observable.ref,
      isModalOpen: _mobx.observable,
      openExploreAppsModal: _mobx.action,
      closeExploreAppsModal: _mobx.action
    });
  }
  openExploreAppsModal() {
    this.isModalOpen = true;
  }
  closeExploreAppsModal() {
    this.isModalOpen = false;
  }
  onInstallationSuccess({
    appId
  }) {
    this.reportBi((0, _bi.wixPatternsAppWasInstalledSrc144Evid200)({
      appId
    }));
  }
}
exports.ExploreAppsState = ExploreAppsState;
//# sourceMappingURL=ExploreAppsState.js.map