1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-03-29 21:01:01 +02:00
focalboard/webapp/src/telemetry/telemetryClient.ts
Jesús Espino 3f451d568b
Cherry-Pick: Adding the "contact admin" link (#3229) (#3263)
* Adding the "contact admin" link (#3229)

* Allowing to contact admin to upgrade from the card limit notification box

* Adding the styles

* Improving the interface

* i18n changes

* Fixing linter errors

* Using the right notificationBox

* Fixing tests

* Fixing tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-05 16:24:07 -06:00

97 lines
3.1 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {IUser} from '../user'
import {TelemetryHandler} from './telemetry'
export const TelemetryCategory = 'boards'
export const TelemetryActions = {
ClickChannelHeader: 'clickChannelHeader',
ClickChannelIntro: 'channelIntro_boardLink',
ViewBoard: 'viewBoard',
CreateBoard: 'createBoard',
DuplicateBoard: 'duplicateBoard',
DeleteBoard: 'deleteBoard',
DeleteBoardTemplate: 'deleteBoardTemplate',
ShareBoard: 'shareBoard',
CreateBoardTemplate: 'createBoardTemplate',
CreateBoardViaTemplate: 'createBoardViaTemplate',
AddTemplateFromBoard: 'AddTemplateFromBoard',
CreateBoardView: 'createBoardView',
DuplicateBoardView: 'duplicagteBoardView',
DeleteBoardView: 'deleteBoardView',
EditCardProperty: 'editCardProperty',
ViewCard: 'viewCard',
CreateCard: 'createCard',
CreateCardTemplate: 'createCardTemplate',
CreateCardViaTemplate: 'createCardViaTemplate',
DuplicateCard: 'duplicateCard',
DeleteCard: 'deleteCard',
AddTemplateFromCard: 'addTemplateFromCard',
ViewSharedBoard: 'viewSharedBoard',
ShareBoardOpenModal: 'shareBoard_openModal',
ShareBoardLogin: 'shareBoard_login',
ShareLinkPublicCopy: 'shareLinkPublic_copy',
ShareLinkInternalCopy: 'shareLinkInternal_copy',
ImportArchive: 'settings_importArchive',
ImportTrello: 'settings_importTrello',
ImportAsana: 'settings_importAsana',
ImportNotion: 'settings_importNotion',
ImportJira: 'settings_importJira',
ImportTodoist: 'settings_importTodoist',
ExportArchive: 'settings_exportArchive',
StartTour: 'welcomeScreen_startTour',
SkipTour: 'welcomeScreen_skipTour',
CloudMoreInfo: 'cloud_more_info',
ViewLimitReached: 'limit_ViewLimitReached',
ViewLimitCTAPerformed: 'limit_ViewLimitLinkOpen',
LimitCardCTAPerformed: 'limit_CardLimitCTAPerformed',
LimitCardLimitReached: 'limit_cardLimitReached',
LimitCardLimitLinkOpen: 'limit_cardLimitLinkOpen',
}
interface IEventProps {
channelID?: string,
teamID?: string,
board?: string,
view?: string,
viewType?: string,
card?: string,
cardTemplateId?: string,
boardTemplateId?: string,
shareBoardEnabled?: boolean,
}
class TelemetryClient {
public telemetryHandler?: TelemetryHandler
public user?: IUser
setTelemetryHandler(telemetryHandler?: TelemetryHandler): void {
this.telemetryHandler = telemetryHandler
}
setUser(user: IUser): void {
this.user = user
}
trackEvent(category: string, event: string, props?: IEventProps): void {
if (this.telemetryHandler) {
const userId = this.user?.id
this.telemetryHandler.trackEvent(userId || '', '', category, event, props)
}
}
pageVisited(category: string, name: string): void {
if (this.telemetryHandler) {
const userId = this.user?.id
this.telemetryHandler.pageVisited(userId || '', '', category, name)
}
}
}
const telemetryClient = new TelemetryClient()
export {TelemetryClient}
export default telemetryClient