UNPKG

@atlaskit/analytics-listeners

Version:

Fabric analytics listeners to be used by the products

70 lines 5.23 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _inherits from "@babel/runtime/helpers/inherits"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _listenerMap; function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } import React from 'react'; import { FabricChannel } from './types'; import FabricElementsListener from './fabric/FabricElementsListener'; import AtlaskitListener from './atlaskit/AtlaskitListener'; import Logger from './helpers/logger'; import NavigationListener from './navigation/NavigationListener'; import FabricEditorListener from './fabric/FabricEditorListener'; import MediaAnalyticsListener from './media/MediaAnalyticsListener'; import PeopleTeamsAnalyticsListener from './peopleTeams/PeopleTeamsAnalyticsListener'; import NotificationsAnalyticsListener from './notifications/NotificationsAnalyticsListener'; import RecentWorkAnalyticsListener from './recentWork/RecentWorkAnalyticsListener'; import AtlasAnalyticsListener from './atlas/AtlasAnalyticsListener'; import CrossFlowAnalyticsListener from './cross-flow/CrossFlowAnalyticsListener'; import LinkingPlatformAnalyticsListener from './linkingPlatform/LinkingPlatformAnalyticsListener'; import PostOfficeAnalyticsListener from './postOffice/PostOfficeAnalyticsListener'; import AIMateAnalyticsListener from './aiMate/AIMateAnalyticsListener'; import AVPAnalyticsListener from './avp/AVPAnalyticsListener'; import GrowthAnalyticsListener from './growth/GrowthAnalyticsListener'; import OmniChannelAnalyticsListener from './omni-channel/OmniChannelAnalyticsListener'; import TownsquareHomeAnalyticsListener from './townsquareHome/TownsquareHomeAnalyticsListener'; import RovoExtensionAnalyticsListener from './rovoExtension/RovoExtensionAnalyticsListener'; import TeamworkGraphAnalyticsListener from './teamworkGraph/TeamworkGraphAnalyticsListener'; var listenerMap = (_listenerMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_listenerMap, FabricChannel.elements, FabricElementsListener), FabricChannel.editor, FabricEditorListener), FabricChannel.atlaskit, AtlaskitListener), FabricChannel.navigation, NavigationListener), FabricChannel.media, MediaAnalyticsListener), FabricChannel.peopleTeams, PeopleTeamsAnalyticsListener), FabricChannel.notifications, NotificationsAnalyticsListener), FabricChannel.recentWork, RecentWorkAnalyticsListener), FabricChannel.atlas, AtlasAnalyticsListener), FabricChannel.crossFlow, CrossFlowAnalyticsListener), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_listenerMap, FabricChannel.linkingPlatform, LinkingPlatformAnalyticsListener), FabricChannel.postOffice, PostOfficeAnalyticsListener), FabricChannel.aiMate, AIMateAnalyticsListener), FabricChannel.avp, AVPAnalyticsListener), FabricChannel.growth, GrowthAnalyticsListener), FabricChannel.omniChannel, OmniChannelAnalyticsListener), FabricChannel.townsquareHome, TownsquareHomeAnalyticsListener), FabricChannel.rovoExtension, RovoExtensionAnalyticsListener), FabricChannel.teamworkGraph, TeamworkGraphAnalyticsListener)); var FabricAnalyticsListeners = /*#__PURE__*/function (_React$Component) { function FabricAnalyticsListeners(props) { var _this; _classCallCheck(this, FabricAnalyticsListeners); _this = _callSuper(this, FabricAnalyticsListeners, [props]); _this.logger = new Logger({ logLevel: props.logLevel }); return _this; } _inherits(FabricAnalyticsListeners, _React$Component); return _createClass(FabricAnalyticsListeners, [{ key: "render", value: function render() { var _this2 = this; var _this$props = this.props, client = _this$props.client, children = _this$props.children, logLevel = _this$props.logLevel, excludedChannels = _this$props.excludedChannels; if (typeof logLevel === 'number') { this.logger.setLogLevel(logLevel); } var listeners = Object.keys(listenerMap).filter(function (channel) { return !excludedChannels || excludedChannels.indexOf(channel) < 0; }).map(function (channel) { return listenerMap[channel]; }).reduce(function (prev, Listener) { return /*#__PURE__*/React.createElement(Listener, { client: client, logger: _this2.logger }, prev); }, children); return listeners; } }]); }(React.Component); export default FabricAnalyticsListeners;