From c44951a458d7598169c51e0ed51cf063b0df3a7a Mon Sep 17 00:00:00 2001 From: Milorad Filipovic Date: Wed, 7 Dec 2022 11:20:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=88=20Updating=20telemetry=20events?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor-ui/src/mixins/history.ts | 28 +++++++++--------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/packages/editor-ui/src/mixins/history.ts b/packages/editor-ui/src/mixins/history.ts index 68c81b386e6ab..4b1b24c4b3b72 100644 --- a/packages/editor-ui/src/mixins/history.ts +++ b/packages/editor-ui/src/mixins/history.ts @@ -40,12 +40,7 @@ export const historyHelper = mixins(debounceHelper, deviceSupportHelpers).extend this.callDebounced('undo', { debounceTime: UNDO_REDO_DEBOUNCE_INTERVAL, trailing: true }); } } - if (this.isNDVOpen) { - const activeNode = this.ndvStore.activeNode; - if (activeNode) { - this.$telemetry.track(`User hit undo in NDV`, { node_type: activeNode.type }); - } - } + this.trackUndoAttempt(event); }, async undo() { const command = this.historyStore.popUndoableToUndo(); @@ -96,21 +91,18 @@ export const historyHelper = mixins(debounceHelper, deviceSupportHelpers).extend this.trackCommand(command, 'redo'); }, trackCommand(command: Undoable, type: 'undo'|'redo'): void { - let telemetryData: { type: string|null, commands: Array> } = { type: null, commands: [] }; if (command instanceof Command) { - telemetryData = { - type: 'single', - commands: [command], - }; + this.$telemetry.track(`User hit ${type}`, { commands_length: 1, commands: [ command.name ] }); } else if (command instanceof BulkCommand) { - telemetryData = { - type: 'bulk', - commands: command.commands, - }; + this.$telemetry.track(`User hit ${type}`, { commands_length: command.commands.length, commands: command.commands.map(c => c.name) }); } - if (telemetryData.type && telemetryData.commands.length > 0) { - telemetryData.commands.forEach(command => { delete command.eventBus; }); - this.$telemetry.track(`User hit ${type}`, telemetryData); + }, + trackUndoAttempt(event: KeyboardEvent) { + if (this.isNDVOpen && !event.shiftKey) { + const activeNode = this.ndvStore.activeNode; + if (activeNode) { + this.$telemetry.track(`User hit undo in NDV`, { node_type: activeNode.type }); + } } }, },