"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.CollectionSectionHeaderActionBar = void 0;
var _designSystem = require("@wix/design-system");
var _react = _interopRequireDefault(require("react"));
var _ToolbarCollectionContext = require("../ToolbarCollectionContext");
var _bi = require("@wix/bex-core/bi");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CollectionSectionHeader/CollectionSectionHeaderActionBar.tsx";
const CollectionSectionHeaderActionBar = ({
  section,
  biComponentType
}) => {
  const {
    toolbarBIReporter
  } = (0, _ToolbarCollectionContext.useToolbarCollectionContext)();
  const {
    primaryAction
  } = section;
  const handleClick = () => {
    toolbarBIReporter.reportBi((0, _bi.wixPatternsSectionHeaderPrimaryActionClicked)({
      sectionId: section.id,
      cta: primaryAction == null ? void 0 : primaryAction.id,
      componentType: biComponentType
    }));
    primaryAction == null || primaryAction.onClick == null || primaryAction.onClick();
  };
  return /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    direction: "horizontal",
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 32,
      columnNumber: 5
    }
  }, primaryAction && /*#__PURE__*/_react.default.createElement(_designSystem.TextButton, {
    prefixIcon: primaryAction.prefixIcon,
    dataHook: "collection-section-header-primary-action",
    onClick: handleClick,
    size: "small",
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 34,
      columnNumber: 9
    }
  }, primaryAction.label));
};
exports.CollectionSectionHeaderActionBar = CollectionSectionHeaderActionBar;
//# sourceMappingURL=CollectionSectionHeaderActionBar.js.map