"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useAnalyticsEvents = void 0;
var _react = require("react");
var _analyticsNext = require("@atlaskit/analytics-next");
var _constants = require("../constants");
var _createEventPayload = _interopRequireDefault(require("./create-event-payload"));
/**
 * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
 *
 * Generates Typescript types for analytics events from analytics.spec.yaml
 *
 * @codegen <<SignedSource::ac0d75fa9e8d43c947e88f47ba1267aa>>
 * @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
 */

var useAnalyticsEvents = exports.useAnalyticsEvents = function useAnalyticsEvents() {
  var _useAnalyticsNextEven = (0, _analyticsNext.useAnalyticsEvents)(),
    createAnalyticsEvent = _useAnalyticsNextEven.createAnalyticsEvent;
  var fireEvent = (0, _react.useCallback)(function () {
    var event = createAnalyticsEvent(_createEventPayload.default.apply(void 0, arguments));
    event.fire(_constants.EVENT_CHANNEL);
  }, [createAnalyticsEvent]);
  return {
    fireEvent: fireEvent
  };
};