import { FabricChannel } from '@atlaskit/analytics-listeners';
import { AnalyticsQueue } from './analytics-queue';
export var editorAnalyticsChannel = FabricChannel.editor;
export var fireAnalyticsEvent = function fireAnalyticsEvent(createAnalyticsEvent) {
  return function (_ref) {
    var payload = _ref.payload,
      _ref$channel = _ref.channel,
      channel = _ref$channel === void 0 ? editorAnalyticsChannel : _ref$channel;
    if (!createAnalyticsEvent) {
      return;
    }
    var queue = AnalyticsQueue.get();
    queue.schedule(function () {
      var _createAnalyticsEvent;
      return (_createAnalyticsEvent = createAnalyticsEvent(payload)) === null || _createAnalyticsEvent === void 0 ? void 0 : _createAnalyticsEvent.fire(channel);
    });
  };
};