chore(editor): add tracking events to attachments (#12317)

Closes: [BS-3483](https://linear.app/affine-design/issue/BS-3483/event-tracking-loading-block)
This commit is contained in:
fundon
2025-05-18 01:57:42 +00:00
parent 8726b0e462
commit a028f027be
5 changed files with 76 additions and 2 deletions
@@ -6,6 +6,9 @@ import type { LinkToolbarEvents } from './link.js';
import type { NoteEvents } from './note.js';
import type { SlashMenuEvents } from './slash-menu.js';
import type {
AttachmentReloadedEvent,
AttachmentReloadedEventInToolbar,
AttachmentUpgradedEvent,
AttachmentUploadedEvent,
BlockCreationEvent,
DocCreatedEvent,
@@ -31,6 +34,10 @@ export type TelemetryEventMap = OutDatabaseAllEvents &
CanvasElementUpdated: ElementUpdatedEvent;
EdgelessElementLocked: ElementLockEvent;
ExpandedAndCollapsed: MindMapCollapseEvent;
AttachmentReloadedEvent:
| AttachmentReloadedEvent
| AttachmentReloadedEventInToolbar;
AttachmentUpgradedEvent: AttachmentUpgradedEvent;
AttachmentUploadedEvent: AttachmentUploadedEvent;
BlockCreated: BlockCreationEvent;
EdgelessToolPicked: EdgelessToolPickedEvent;
@@ -61,9 +61,36 @@ export interface MindMapCollapseEvent extends TelemetryEvent {
type: 'expand' | 'collapse';
}
export interface AttachmentReloadedEvent extends TelemetryEvent {
page: 'doc editor' | 'whiteboard editor';
segment: 'doc' | 'whiteboard';
module: 'attachment';
control: 'reload';
category: 'card' | 'embed';
type: string; // file type
}
export interface AttachmentReloadedEventInToolbar extends TelemetryEvent {
page: 'doc editor' | 'whiteboard editor';
segment: 'doc' | 'whiteboard';
module: 'toolbar';
control: 'reload';
category: 'attachment';
type: string; // file type
}
export interface AttachmentUpgradedEvent extends TelemetryEvent {
page: 'doc editor' | 'whiteboard editor';
segment: 'doc' | 'whiteboard';
module: 'attachment';
control: 'upgrade';
category: 'card' | 'embed';
type: string; // file type
}
export interface AttachmentUploadedEvent extends TelemetryEvent {
page: 'doc editor' | 'whiteboard editor';
segment: 'attachment';
segment: 'doc' | 'whiteboard';
module: 'attachment';
control: 'uploader';
type: string; // file type