ref(analytics): Use analytics from features/analytics

This commit is contained in:
hristoterezov 2017-10-10 18:43:22 -05:00 committed by yanas
parent a3a871d4b3
commit df1437f018
16 changed files with 88 additions and 78 deletions

View File

@ -16,7 +16,7 @@ import UIEvents from './service/UI/UIEvents';
import UIUtil from './modules/UI/util/UIUtil'; import UIUtil from './modules/UI/util/UIUtil';
import * as JitsiMeetConferenceEvents from './ConferenceEvents'; import * as JitsiMeetConferenceEvents from './ConferenceEvents';
import { initAnalytics } from './react/features/analytics'; import { initAnalytics, sendEvent } from './react/features/analytics';
import EventEmitter from "events"; import EventEmitter from "events";
@ -1315,7 +1315,7 @@ export default {
promise = createLocalTracksF({ devices: ['video'] }) promise = createLocalTracksF({ devices: ['video'] })
.then(([stream]) => this.useVideoStream(stream)) .then(([stream]) => this.useVideoStream(stream))
.then(() => { .then(() => {
JitsiMeetJS.analytics.sendEvent( sendEvent(
'conference.sharingDesktop.stop'); 'conference.sharingDesktop.stop');
logger.log('switched back to local video'); logger.log('switched back to local video');
if (!this.localVideo && wasVideoMuted) { if (!this.localVideo && wasVideoMuted) {
@ -1486,7 +1486,7 @@ export default {
return this.useVideoStream(stream); return this.useVideoStream(stream);
}).then(() => { }).then(() => {
this.videoSwitchInProgress = false; this.videoSwitchInProgress = false;
JitsiMeetJS.analytics.sendEvent('conference.sharingDesktop.start'); sendEvent('conference.sharingDesktop.start');
logger.log('sharing local desktop'); logger.log('sharing local desktop');
}).catch(error => { }).catch(error => {
this.videoSwitchInProgress = false; this.videoSwitchInProgress = false;
@ -1753,7 +1753,7 @@ export default {
room.selectParticipant(id); room.selectParticipant(id);
} catch (e) { } catch (e) {
JitsiMeetJS.analytics.sendEvent( sendEvent(
'selectParticipant.failed'); 'selectParticipant.failed');
reportError(e); reportError(e);
} }
@ -1973,7 +1973,7 @@ export default {
// Longer delays will be caused by something else and will just // Longer delays will be caused by something else and will just
// poison the data. // poison the data.
if (delay < 2000) { if (delay < 2000) {
JitsiMeetJS.analytics.sendEvent('stream.switch.delay', sendEvent('stream.switch.delay',
{value: delay}); {value: delay});
} }
}); });
@ -2005,7 +2005,7 @@ export default {
APP.UI.addListener( APP.UI.addListener(
UIEvents.VIDEO_DEVICE_CHANGED, UIEvents.VIDEO_DEVICE_CHANGED,
(cameraDeviceId) => { (cameraDeviceId) => {
JitsiMeetJS.analytics.sendEvent('settings.changeDevice.video'); sendEvent('settings.changeDevice.video');
createLocalTracksF({ createLocalTracksF({
devices: ['video'], devices: ['video'],
cameraDeviceId: cameraDeviceId, cameraDeviceId: cameraDeviceId,
@ -2033,7 +2033,7 @@ export default {
APP.UI.addListener( APP.UI.addListener(
UIEvents.AUDIO_DEVICE_CHANGED, UIEvents.AUDIO_DEVICE_CHANGED,
(micDeviceId) => { (micDeviceId) => {
JitsiMeetJS.analytics.sendEvent( sendEvent(
'settings.changeDevice.audioIn'); 'settings.changeDevice.audioIn');
createLocalTracksF({ createLocalTracksF({
devices: ['audio'], devices: ['audio'],
@ -2054,7 +2054,7 @@ export default {
APP.UI.addListener( APP.UI.addListener(
UIEvents.AUDIO_OUTPUT_DEVICE_CHANGED, UIEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
(audioOutputDeviceId) => { (audioOutputDeviceId) => {
JitsiMeetJS.analytics.sendEvent( sendEvent(
'settings.changeDevice.audioOut'); 'settings.changeDevice.audioOut');
APP.settings.setAudioOutputDeviceId(audioOutputDeviceId) APP.settings.setAudioOutputDeviceId(audioOutputDeviceId)
.then(() => logger.log('changed audio output device')) .then(() => logger.log('changed audio output device'))
@ -2361,9 +2361,7 @@ export default {
* NOTE: Should be used after conference.init * NOTE: Should be used after conference.init
*/ */
logEvent(name, value, label) { logEvent(name, value, label) {
if (JitsiMeetJS.analytics) { sendEvent(name, {value, label});
JitsiMeetJS.analytics.sendEvent(name, {value, label});
}
if (room) { if (room) {
room.sendApplicationLog(JSON.stringify({name, value, label})); room.sendApplicationLog(JSON.stringify({name, value, label}));
} }

View File

@ -1,4 +1,4 @@
/* global APP, $, config, interfaceConfig, JitsiMeetJS */ /* global APP, $, config, interfaceConfig */
/* /*
* Copyright @ 2015 Atlassian Pty Ltd * Copyright @ 2015 Atlassian Pty Ltd
* *
@ -23,6 +23,9 @@ import VideoLayout from '../videolayout/VideoLayout';
import { import {
JitsiRecordingStatus JitsiRecordingStatus
} from '../../../react/features/base/lib-jitsi-meet'; } from '../../../react/features/base/lib-jitsi-meet';
import {
sendEvent
} from '../../../react/features/analytics';
import { setToolboxEnabled } from '../../../react/features/toolbox'; import { setToolboxEnabled } from '../../../react/features/toolbox';
import { setNotificationsEnabled } from '../../../react/features/notifications'; import { setNotificationsEnabled } from '../../../react/features/notifications';
import { import {
@ -437,7 +440,7 @@ var Recording = {
return; return;
} }
JitsiMeetJS.analytics.sendEvent('recording.clicked'); sendEvent('recording.clicked');
switch (this.currentState) { switch (this.currentState) {
case JitsiRecordingStatus.ON: case JitsiRecordingStatus.ON:
case JitsiRecordingStatus.RETRYING: case JitsiRecordingStatus.RETRYING:
@ -445,7 +448,7 @@ var Recording = {
_showStopRecordingPrompt(this.recordingType).then( _showStopRecordingPrompt(this.recordingType).then(
() => { () => {
this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED); this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED);
JitsiMeetJS.analytics.sendEvent('recording.stopped'); sendEvent('recording.stopped');
}, },
() => {}); () => {});
break; break;
@ -457,19 +460,19 @@ var Recording = {
this.eventEmitter.emit( this.eventEmitter.emit(
UIEvents.RECORDING_TOGGLED, UIEvents.RECORDING_TOGGLED,
{ streamId }); { streamId });
JitsiMeetJS.analytics.sendEvent('recording.started'); sendEvent('recording.started');
}).catch(reason => { }).catch(reason => {
if (reason !== APP.UI.messageHandler.CANCEL) if (reason !== APP.UI.messageHandler.CANCEL)
logger.error(reason); logger.error(reason);
else else
JitsiMeetJS.analytics.sendEvent('recording.canceled'); sendEvent('recording.canceled');
}); });
else { else {
if (this.predefinedToken) { if (this.predefinedToken) {
this.eventEmitter.emit( this.eventEmitter.emit(
UIEvents.RECORDING_TOGGLED, UIEvents.RECORDING_TOGGLED,
{ token: this.predefinedToken }); { token: this.predefinedToken });
JitsiMeetJS.analytics.sendEvent('recording.started'); sendEvent('recording.started');
return; return;
} }
@ -477,12 +480,12 @@ var Recording = {
this.eventEmitter.emit( this.eventEmitter.emit(
UIEvents.RECORDING_TOGGLED, UIEvents.RECORDING_TOGGLED,
{ token }); { token });
JitsiMeetJS.analytics.sendEvent('recording.started'); sendEvent('recording.started');
}).catch(reason => { }).catch(reason => {
if (reason !== APP.UI.messageHandler.CANCEL) if (reason !== APP.UI.messageHandler.CANCEL)
logger.error(reason); logger.error(reason);
else else
JitsiMeetJS.analytics.sendEvent('recording.canceled'); sendEvent('recording.canceled');
}); });
} }
break; break;

View File

@ -1,5 +1,4 @@
/* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError, /* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError */
JitsiMeetJS */
const logger = require("jitsi-meet-logger").getLogger(__filename); const logger = require("jitsi-meet-logger").getLogger(__filename);
import UIUtil from '../util/UIUtil'; import UIUtil from '../util/UIUtil';
@ -9,6 +8,7 @@ import VideoLayout from "../videolayout/VideoLayout";
import LargeContainer from '../videolayout/LargeContainer'; import LargeContainer from '../videolayout/LargeContainer';
import Filmstrip from '../videolayout/Filmstrip'; import Filmstrip from '../videolayout/Filmstrip';
import { sendEvent } from '../../../react/features/analytics';
import { import {
participantJoined, participantJoined,
participantLeft participantLeft
@ -79,11 +79,11 @@ export default class SharedVideoManager {
url => { url => {
this.emitter.emit( this.emitter.emit(
UIEvents.UPDATE_SHARED_VIDEO, url, 'start'); UIEvents.UPDATE_SHARED_VIDEO, url, 'start');
JitsiMeetJS.analytics.sendEvent('sharedvideo.started'); sendEvent('sharedvideo.started');
}, },
err => { err => {
logger.log('SHARED VIDEO CANCELED', err); logger.log('SHARED VIDEO CANCELED', err);
JitsiMeetJS.analytics.sendEvent('sharedvideo.canceled'); sendEvent('sharedvideo.canceled');
} }
); );
return; return;
@ -102,7 +102,7 @@ export default class SharedVideoManager {
} }
this.emitter.emit( this.emitter.emit(
UIEvents.UPDATE_SHARED_VIDEO, this.url, 'stop'); UIEvents.UPDATE_SHARED_VIDEO, this.url, 'stop');
JitsiMeetJS.analytics.sendEvent('sharedvideo.stoped'); sendEvent('sharedvideo.stoped');
}, },
() => {}); () => {});
} else { } else {
@ -114,7 +114,7 @@ export default class SharedVideoManager {
dialog = null; dialog = null;
} }
); );
JitsiMeetJS.analytics.sendEvent('sharedvideo.alreadyshared'); sendEvent('sharedvideo.alreadyshared');
} }
} }
@ -218,7 +218,7 @@ export default class SharedVideoManager {
self.smartAudioMute(); self.smartAudioMute();
} else if (event.data == YT.PlayerState.PAUSED) { } else if (event.data == YT.PlayerState.PAUSED) {
self.smartAudioUnmute(); self.smartAudioUnmute();
JitsiMeetJS.analytics.sendEvent('sharedvideo.paused'); sendEvent('sharedvideo.paused');
} }
self.fireSharedVideoEvent(event.data == YT.PlayerState.PAUSED); self.fireSharedVideoEvent(event.data == YT.PlayerState.PAUSED);
}; };
@ -248,7 +248,7 @@ export default class SharedVideoManager {
else if (event.data.volume <=0 || event.data.muted) { else if (event.data.volume <=0 || event.data.muted) {
self.smartAudioUnmute(); self.smartAudioUnmute();
} }
JitsiMeetJS.analytics.sendEvent('sharedvideo.volumechanged'); sendEvent('sharedvideo.volumechanged');
}; };
window.onPlayerReady = function(event) { window.onPlayerReady = function(event) {

View File

@ -1,8 +1,10 @@
/* global $, APP, JitsiMeetJS */ /* global $, APP */
import UIUtil from "../../util/UIUtil"; import UIUtil from "../../util/UIUtil";
import UIEvents from "../../../../service/UI/UIEvents"; import UIEvents from "../../../../service/UI/UIEvents";
import Settings from '../../../settings/Settings'; import Settings from '../../../settings/Settings';
import { sendEvent } from '../../../../react/features/analytics';
const sidePanelsContainerId = 'sideToolbarContainer'; const sidePanelsContainerId = 'sideToolbarContainer';
const htmlStr = ` const htmlStr = `
<div id="profile_container" class="sideToolbarContainer__inner"> <div id="profile_container" class="sideToolbarContainer__inner">
@ -74,7 +76,7 @@ export default {
// LOGIN // LOGIN
function loginClicked () { function loginClicked () {
JitsiMeetJS.analytics.sendEvent('authenticate.login.clicked'); sendEvent('authenticate.login.clicked');
emitter.emit(UIEvents.AUTH_CLICKED); emitter.emit(UIEvents.AUTH_CLICKED);
} }
@ -84,7 +86,7 @@ export default {
function logoutClicked () { function logoutClicked () {
let titleKey = "dialog.logoutTitle"; let titleKey = "dialog.logoutTitle";
let msgKey = "dialog.logoutQuestion"; let msgKey = "dialog.logoutQuestion";
JitsiMeetJS.analytics.sendEvent('authenticate.logout.clicked'); sendEvent('authenticate.logout.clicked');
// Ask for confirmation // Ask for confirmation
APP.UI.messageHandler.openTwoButtonDialog({ APP.UI.messageHandler.openTwoButtonDialog({
titleKey: titleKey, titleKey: titleKey,

View File

@ -1,10 +1,12 @@
/* global $, APP, JitsiMeetJS, interfaceConfig */ /* global $, APP, interfaceConfig */
import { setFilmstripVisibility } from '../../../react/features/filmstrip'; import { setFilmstripVisibility } from '../../../react/features/filmstrip';
import UIEvents from "../../../service/UI/UIEvents"; import UIEvents from "../../../service/UI/UIEvents";
import UIUtil from "../util/UIUtil"; import UIUtil from "../util/UIUtil";
import { sendEvent } from '../../../react/features/analytics';
const Filmstrip = { const Filmstrip = {
/** /**
* *
@ -141,7 +143,7 @@ const Filmstrip = {
return; return;
} }
if (sendAnalytics) { if (sendAnalytics) {
JitsiMeetJS.analytics.sendEvent('toolbar.filmstrip.toggled'); sendEvent('toolbar.filmstrip.toggled');
} }
this.filmstrip.toggleClass("hidden"); this.filmstrip.toggleClass("hidden");

View File

@ -1,6 +1,7 @@
/* global APP, $, JitsiMeetJS, interfaceConfig */ /* global APP, $, interfaceConfig */
import { toggleDialog } from '../../react/features/base/dialog'; import { toggleDialog } from '../../react/features/base/dialog';
import { sendEvent } from '../../react/features/analytics';
import { SpeakerStats } from '../../react/features/speaker-stats'; import { SpeakerStats } from '../../react/features/speaker-stats';
/** /**
@ -20,20 +21,20 @@ function initGlobalShortcuts() {
}); });
KeyboardShortcut.registerShortcut("?", null, function() { KeyboardShortcut.registerShortcut("?", null, function() {
JitsiMeetJS.analytics.sendEvent("shortcut.shortcut.help"); sendEvent("shortcut.shortcut.help");
showKeyboardShortcutsPanel(true); showKeyboardShortcutsPanel(true);
}, "keyboardShortcuts.toggleShortcuts"); }, "keyboardShortcuts.toggleShortcuts");
// register SPACE shortcut in two steps to insure visibility of help message // register SPACE shortcut in two steps to insure visibility of help message
KeyboardShortcut.registerShortcut(" ", null, function() { KeyboardShortcut.registerShortcut(" ", null, function() {
JitsiMeetJS.analytics.sendEvent("shortcut.talk.clicked"); sendEvent("shortcut.talk.clicked");
APP.conference.muteAudio(true); APP.conference.muteAudio(true);
}); });
KeyboardShortcut._addShortcutToHelp("SPACE","keyboardShortcuts.pushToTalk"); KeyboardShortcut._addShortcutToHelp("SPACE","keyboardShortcuts.pushToTalk");
if(!interfaceConfig.filmStripOnly) { if(!interfaceConfig.filmStripOnly) {
KeyboardShortcut.registerShortcut("T", null, () => { KeyboardShortcut.registerShortcut("T", null, () => {
JitsiMeetJS.analytics.sendEvent("shortcut.speakerStats.clicked"); sendEvent("shortcut.speakerStats.clicked");
APP.store.dispatch(toggleDialog(SpeakerStats, { APP.store.dispatch(toggleDialog(SpeakerStats, {
conference: APP.conference conference: APP.conference
})); }));

View File

@ -1,10 +1,15 @@
// @flow // @flow
import JitsiMeetJS, { isAnalyticsEnabled } from '../base/lib-jitsi-meet'; import JitsiMeetJS, {
analytics,
isAnalyticsEnabled
} from '../base/lib-jitsi-meet';
import { getJitsiMeetGlobalNS, loadScript } from '../base/util'; import { getJitsiMeetGlobalNS, loadScript } from '../base/util';
const logger = require('jitsi-meet-logger').getLogger(__filename); const logger = require('jitsi-meet-logger').getLogger(__filename);
export const sendEvent = analytics.sendEvent.bind(analytics);
/** /**
* Loads the analytics scripts and inits JitsiMeetJS.analytics by setting * Loads the analytics scripts and inits JitsiMeetJS.analytics by setting
* permanent properties and setting the handlers from the loaded scripts. * permanent properties and setting the handlers from the loaded scripts.
@ -19,8 +24,6 @@ export function initAnalytics({ getState }: { getState: Function }) {
getJitsiMeetGlobalNS().analyticsHandlers = []; getJitsiMeetGlobalNS().analyticsHandlers = [];
window.analyticsHandlers = []; // Legacy support. window.analyticsHandlers = []; // Legacy support.
const { analytics } = JitsiMeetJS;
if (!analytics || !isAnalyticsEnabled(getState)) { if (!analytics || !isAnalyticsEnabled(getState)) {
return; return;
} }

View File

@ -2,8 +2,8 @@
import UIEvents from '../../../../service/UI/UIEvents'; import UIEvents from '../../../../service/UI/UIEvents';
import { sendEvent } from '../../analytics';
import { CONNECTION_ESTABLISHED } from '../connection'; import { CONNECTION_ESTABLISHED } from '../connection';
import JitsiMeetJS from '../lib-jitsi-meet';
import { setVideoMuted, VIDEO_MUTISM_AUTHORITY } from '../media'; import { setVideoMuted, VIDEO_MUTISM_AUTHORITY } from '../media';
import { import {
getLocalParticipant, getLocalParticipant,
@ -191,7 +191,7 @@ function _pinParticipant(store, next, action) {
videoType = 'remote'; videoType = 'remote';
} }
JitsiMeetJS.analytics.sendEvent( sendEvent(
`${actionName}.${videoType}`, `${actionName}.${videoType}`,
{ value: conference.getParticipantCount() }); { value: conference.getParticipantCount() });
} }

View File

@ -19,6 +19,8 @@ export const JitsiRecordingStatus = JitsiMeetJS.constants.recordingStatus;
export const JitsiTrackErrors = JitsiMeetJS.errors.track; export const JitsiTrackErrors = JitsiMeetJS.errors.track;
export const JitsiTrackEvents = JitsiMeetJS.events.track; export const JitsiTrackEvents = JitsiMeetJS.events.track;
export const analytics = JitsiMeetJS.analytics;
export * from './actions'; export * from './actions';
export * from './actionTypes'; export * from './actionTypes';
export * from './constants'; export * from './constants';

View File

@ -4,9 +4,9 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { sendEvent } from '../../analytics';
import { Dialog } from '../../base/dialog'; import { Dialog } from '../../base/dialog';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import JitsiMeetJS from '../../base/lib-jitsi-meet';
import { cancelFeedback, submitFeedback } from '../actions'; import { cancelFeedback, submitFeedback } from '../actions';
@ -145,7 +145,7 @@ class FeedbackDialog extends Component {
* @inheritdoc * @inheritdoc
*/ */
componentDidMount() { componentDidMount() {
JitsiMeetJS.analytics.sendEvent('feedback.open'); sendEvent('feedback.open');
} }
/** /**

View File

@ -2,10 +2,10 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { sendEvent } from '../../analytics';
import { getInviteURL } from '../../base/connection'; import { getInviteURL } from '../../base/connection';
import { Dialog } from '../../base/dialog'; import { Dialog } from '../../base/dialog';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import JitsiMeetJS from '../../base/lib-jitsi-meet';
import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants'; import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
import DialInNumbersForm from './DialInNumbersForm'; import DialInNumbersForm from './DialInNumbersForm';
@ -51,7 +51,7 @@ class InviteDialog extends Component {
* @inheritdoc * @inheritdoc
*/ */
componentWillUnmount() { componentWillUnmount() {
JitsiMeetJS.analytics.sendEvent('toolbar.invite.close'); sendEvent('toolbar.invite.close');
} }
/** /**

View File

@ -2,8 +2,8 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { sendEvent } from '../../analytics';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import JitsiMeetJS from '../../base/lib-jitsi-meet';
import { kickParticipant } from '../../base/participants'; import { kickParticipant } from '../../base/participants';
import RemoteVideoMenuButton from './RemoteVideoMenuButton'; import RemoteVideoMenuButton from './RemoteVideoMenuButton';
@ -83,7 +83,7 @@ class KickButton extends Component {
_onClick() { _onClick() {
const { dispatch, onClick, participantID } = this.props; const { dispatch, onClick, participantID } = this.props;
JitsiMeetJS.analytics.sendEvent( sendEvent(
'remotevideomenu.kick', 'remotevideomenu.kick',
{ {
value: 1, value: 1,

View File

@ -2,8 +2,8 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { sendEvent } from '../../analytics';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import JitsiMeetJS from '../../base/lib-jitsi-meet';
import { muteRemoteParticipant } from '../../base/participants'; import { muteRemoteParticipant } from '../../base/participants';
import RemoteVideoMenuButton from './RemoteVideoMenuButton'; import RemoteVideoMenuButton from './RemoteVideoMenuButton';
@ -97,7 +97,7 @@ class MuteButton extends Component {
_onClick() { _onClick() {
const { dispatch, onClick, participantID } = this.props; const { dispatch, onClick, participantID } = this.props;
JitsiMeetJS.analytics.sendEvent( sendEvent(
'remotevideomenu.mute', 'remotevideomenu.mute',
{ {
value: 1, value: 1,

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import JitsiMeetJS from '../../base/lib-jitsi-meet'; import { sendEvent } from '../../analytics';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import RemoteVideoMenuButton from './RemoteVideoMenuButton'; import RemoteVideoMenuButton from './RemoteVideoMenuButton';
@ -130,7 +130,7 @@ class RemoteControlButton extends Component {
} }
if (eventName) { if (eventName) {
JitsiMeetJS.analytics.sendEvent( sendEvent(
`remotevideomenu.remotecontrol.${eventName}`, `remotevideomenu.remotecontrol.${eventName}`,
{ {
value: 1, value: 1,

View File

@ -4,13 +4,13 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { sendEvent } from '../../analytics';
import { DEFAULT_AVATAR_RELATIVE_PATH } from '../../base/participants'; import { DEFAULT_AVATAR_RELATIVE_PATH } from '../../base/participants';
import UIEvents from '../../../../service/UI/UIEvents'; import UIEvents from '../../../../service/UI/UIEvents';
import ToolbarButton from './ToolbarButton'; import ToolbarButton from './ToolbarButton';
declare var APP: Object; declare var APP: Object;
declare var JitsiMeetJS: Object;
/** /**
* The default configuration for the button. * The default configuration for the button.
@ -102,7 +102,7 @@ class ProfileButton extends Component {
*/ */
_onClick() { _onClick() {
if (!this.props._unclickable) { if (!this.props._unclickable) {
JitsiMeetJS.analytics.sendEvent('toolbar.profile.toggled'); sendEvent('toolbar.profile.toggled');
APP.UI.emitEvent(UIEvents.TOGGLE_PROFILE); APP.UI.emitEvent(UIEvents.TOGGLE_PROFILE);
} }
} }

View File

@ -2,6 +2,7 @@
import React from 'react'; import React from 'react';
import { sendEvent } from '../analytics';
import { ParticipantCounter } from '../contact-list'; import { ParticipantCounter } from '../contact-list';
import { openDeviceSelectionDialog } from '../device-selection'; import { openDeviceSelectionDialog } from '../device-selection';
import { InfoDialogButton, openInviteDialog } from '../invite'; import { InfoDialogButton, openInviteDialog } from '../invite';
@ -12,7 +13,6 @@ import ProfileButton from './components/ProfileButton';
declare var APP: Object; declare var APP: Object;
declare var interfaceConfig: Object; declare var interfaceConfig: Object;
declare var JitsiMeetJS: Object;
/** /**
* The cache of {@link getDefaultButtons()}. * The cache of {@link getDefaultButtons()}.
@ -42,9 +42,9 @@ export default function getDefaultButtons() {
const newVideoMutedState = !APP.conference.isLocalVideoMuted(); const newVideoMutedState = !APP.conference.isLocalVideoMuted();
if (newVideoMutedState) { if (newVideoMutedState) {
JitsiMeetJS.analytics.sendEvent('toolbar.video.enabled'); sendEvent('toolbar.video.enabled');
} else { } else {
JitsiMeetJS.analytics.sendEvent('toolbar.video.disabled'); sendEvent('toolbar.video.disabled');
} }
APP.UI.emitEvent(UIEvents.VIDEO_MUTED, newVideoMutedState); APP.UI.emitEvent(UIEvents.VIDEO_MUTED, newVideoMutedState);
}, },
@ -64,7 +64,7 @@ export default function getDefaultButtons() {
return; return;
} }
JitsiMeetJS.analytics.sendEvent('shortcut.videomute.toggled'); sendEvent('shortcut.videomute.toggled');
APP.conference.toggleVideoMuted(); APP.conference.toggleVideoMuted();
}, },
shortcutDescription: 'keyboardShortcuts.videoMute', shortcutDescription: 'keyboardShortcuts.videoMute',
@ -81,13 +81,13 @@ export default function getDefaultButtons() {
<span id = 'unreadMessages' /></span>, <span id = 'unreadMessages' /></span>,
id: 'toolbar_button_chat', id: 'toolbar_button_chat',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent('toolbar.chat.toggled'); sendEvent('toolbar.chat.toggled');
APP.UI.emitEvent(UIEvents.TOGGLE_CHAT); APP.UI.emitEvent(UIEvents.TOGGLE_CHAT);
}, },
shortcut: 'C', shortcut: 'C',
shortcutAttr: 'toggleChatPopover', shortcutAttr: 'toggleChatPopover',
shortcutFunc() { shortcutFunc() {
JitsiMeetJS.analytics.sendEvent('shortcut.chat.toggled'); sendEvent('shortcut.chat.toggled');
APP.UI.toggleChat(); APP.UI.toggleChat();
}, },
shortcutDescription: 'keyboardShortcuts.toggleChat', shortcutDescription: 'keyboardShortcuts.toggleChat',
@ -104,7 +104,7 @@ export default function getDefaultButtons() {
enabled: true, enabled: true,
id: 'toolbar_contact_list', id: 'toolbar_contact_list',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent( sendEvent(
'toolbar.contacts.toggled'); 'toolbar.contacts.toggled');
APP.UI.emitEvent(UIEvents.TOGGLE_CONTACT_LIST); APP.UI.emitEvent(UIEvents.TOGGLE_CONTACT_LIST);
}, },
@ -121,9 +121,9 @@ export default function getDefaultButtons() {
id: 'toolbar_button_desktopsharing', id: 'toolbar_button_desktopsharing',
onClick() { onClick() {
if (APP.conference.isSharingScreen) { if (APP.conference.isSharingScreen) {
JitsiMeetJS.analytics.sendEvent('toolbar.screen.disabled'); sendEvent('toolbar.screen.disabled');
} else { } else {
JitsiMeetJS.analytics.sendEvent('toolbar.screen.enabled'); sendEvent('toolbar.screen.enabled');
} }
APP.UI.emitEvent(UIEvents.TOGGLE_SCREENSHARING); APP.UI.emitEvent(UIEvents.TOGGLE_SCREENSHARING);
}, },
@ -137,7 +137,7 @@ export default function getDefaultButtons() {
shortcut: 'D', shortcut: 'D',
shortcutAttr: 'toggleDesktopSharingPopover', shortcutAttr: 'toggleDesktopSharingPopover',
shortcutFunc() { shortcutFunc() {
JitsiMeetJS.analytics.sendEvent('shortcut.screen.toggled'); sendEvent('shortcut.screen.toggled');
// eslint-disable-next-line no-empty-function // eslint-disable-next-line no-empty-function
APP.conference.toggleScreenSharing().catch(() => {}); APP.conference.toggleScreenSharing().catch(() => {});
@ -157,7 +157,7 @@ export default function getDefaultButtons() {
}, },
id: 'toolbar_button_fodeviceselection', id: 'toolbar_button_fodeviceselection',
onClick(dispatch: Function) { onClick(dispatch: Function) {
JitsiMeetJS.analytics.sendEvent( sendEvent(
'toolbar.fodeviceselection.toggled'); 'toolbar.fodeviceselection.toggled');
dispatch(openDeviceSelectionDialog()); dispatch(openDeviceSelectionDialog());
@ -177,7 +177,7 @@ export default function getDefaultButtons() {
hidden: true, hidden: true,
id: 'toolbar_button_dialpad', id: 'toolbar_button_dialpad',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent('toolbar.sip.dialpad.clicked'); sendEvent('toolbar.sip.dialpad.clicked');
}, },
tooltipKey: 'toolbar.dialpad' tooltipKey: 'toolbar.dialpad'
}, },
@ -191,7 +191,7 @@ export default function getDefaultButtons() {
hidden: true, hidden: true,
id: 'toolbar_button_etherpad', id: 'toolbar_button_etherpad',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent('toolbar.etherpad.clicked'); sendEvent('toolbar.etherpad.clicked');
APP.UI.emitEvent(UIEvents.ETHERPAD_CLICKED); APP.UI.emitEvent(UIEvents.ETHERPAD_CLICKED);
}, },
tooltipKey: 'toolbar.etherpad' tooltipKey: 'toolbar.etherpad'
@ -205,7 +205,7 @@ export default function getDefaultButtons() {
enabled: true, enabled: true,
id: 'toolbar_button_fullScreen', id: 'toolbar_button_fullScreen',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent('toolbar.fullscreen.enabled'); sendEvent('toolbar.fullscreen.enabled');
APP.UI.emitEvent(UIEvents.TOGGLE_FULLSCREEN); APP.UI.emitEvent(UIEvents.TOGGLE_FULLSCREEN);
}, },
@ -213,7 +213,7 @@ export default function getDefaultButtons() {
shortcutAttr: 'toggleFullscreenPopover', shortcutAttr: 'toggleFullscreenPopover',
shortcutDescription: 'keyboardShortcuts.fullScreen', shortcutDescription: 'keyboardShortcuts.fullScreen',
shortcutFunc() { shortcutFunc() {
JitsiMeetJS.analytics.sendEvent('shortcut.fullscreen.toggled'); sendEvent('shortcut.fullscreen.toggled');
APP.UI.toggleFullScreen(); APP.UI.toggleFullScreen();
}, },
tooltipKey: 'toolbar.fullscreen' tooltipKey: 'toolbar.fullscreen'
@ -229,7 +229,7 @@ export default function getDefaultButtons() {
isDisplayed: () => true, isDisplayed: () => true,
id: 'toolbar_button_hangup', id: 'toolbar_button_hangup',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent('toolbar.hangup'); sendEvent('toolbar.hangup');
APP.UI.emitEvent(UIEvents.HANGUP); APP.UI.emitEvent(UIEvents.HANGUP);
}, },
tooltipKey: 'toolbar.hangup' tooltipKey: 'toolbar.hangup'
@ -252,7 +252,7 @@ export default function getDefaultButtons() {
enabled: true, enabled: true,
id: 'toolbar_button_link', id: 'toolbar_button_link',
onClick(dispatch: Function) { onClick(dispatch: Function) {
JitsiMeetJS.analytics.sendEvent('toolbar.invite.clicked'); sendEvent('toolbar.invite.clicked');
dispatch(openInviteDialog()); dispatch(openInviteDialog());
}, },
@ -280,12 +280,11 @@ export default function getDefaultButtons() {
APP.UI.showCustomToolbarPopup( APP.UI.showCustomToolbarPopup(
'microphone', 'unableToUnmutePopup', true, 5000); 'microphone', 'unableToUnmutePopup', true, 5000);
} else { } else {
JitsiMeetJS.analytics sendEvent('toolbar.audio.unmuted');
.sendEvent('toolbar.audio.unmuted');
APP.UI.emitEvent(UIEvents.AUDIO_MUTED, false, true); APP.UI.emitEvent(UIEvents.AUDIO_MUTED, false, true);
} }
} else { } else {
JitsiMeetJS.analytics.sendEvent('toolbar.audio.muted'); sendEvent('toolbar.audio.muted');
APP.UI.emitEvent(UIEvents.AUDIO_MUTED, true, true); APP.UI.emitEvent(UIEvents.AUDIO_MUTED, true, true);
} }
}, },
@ -306,7 +305,7 @@ export default function getDefaultButtons() {
shortcut: 'M', shortcut: 'M',
shortcutAttr: 'mutePopover', shortcutAttr: 'mutePopover',
shortcutFunc() { shortcutFunc() {
JitsiMeetJS.analytics.sendEvent('shortcut.audiomute.toggled'); sendEvent('shortcut.audiomute.toggled');
APP.conference.toggleAudioMuted(); APP.conference.toggleAudioMuted();
}, },
shortcutDescription: 'keyboardShortcuts.mute', shortcutDescription: 'keyboardShortcuts.mute',
@ -329,14 +328,14 @@ export default function getDefaultButtons() {
enabled: true, enabled: true,
id: 'toolbar_button_raisehand', id: 'toolbar_button_raisehand',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent('toolbar.raiseHand.clicked'); sendEvent('toolbar.raiseHand.clicked');
APP.conference.maybeToggleRaisedHand(); APP.conference.maybeToggleRaisedHand();
}, },
shortcut: 'R', shortcut: 'R',
shortcutAttr: 'raiseHandPopover', shortcutAttr: 'raiseHandPopover',
shortcutDescription: 'keyboardShortcuts.raiseHand', shortcutDescription: 'keyboardShortcuts.raiseHand',
shortcutFunc() { shortcutFunc() {
JitsiMeetJS.analytics.sendEvent('shortcut.raisehand.clicked'); sendEvent('shortcut.raisehand.clicked');
APP.conference.maybeToggleRaisedHand(); APP.conference.maybeToggleRaisedHand();
}, },
tooltipKey: 'toolbar.raiseHand' tooltipKey: 'toolbar.raiseHand'
@ -364,7 +363,7 @@ export default function getDefaultButtons() {
enabled: true, enabled: true,
id: 'toolbar_button_settings', id: 'toolbar_button_settings',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent('toolbar.settings.toggled'); sendEvent('toolbar.settings.toggled');
APP.UI.emitEvent(UIEvents.TOGGLE_SETTINGS); APP.UI.emitEvent(UIEvents.TOGGLE_SETTINGS);
}, },
sideContainerId: 'settings_container', sideContainerId: 'settings_container',
@ -379,7 +378,7 @@ export default function getDefaultButtons() {
enabled: true, enabled: true,
id: 'toolbar_button_sharedvideo', id: 'toolbar_button_sharedvideo',
onClick() { onClick() {
JitsiMeetJS.analytics.sendEvent('toolbar.sharedvideo.clicked'); sendEvent('toolbar.sharedvideo.clicked');
APP.UI.emitEvent(UIEvents.SHARED_VIDEO_CLICKED); APP.UI.emitEvent(UIEvents.SHARED_VIDEO_CLICKED);
}, },
popups: [ popups: [