mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-03 10:40:44 +08:00
@@ -5,6 +5,7 @@ import type { LinkToolbarEvents } from './link.js';
|
||||
import type { NoteEvents } from './note.js';
|
||||
import type {
|
||||
AttachmentUploadedEvent,
|
||||
BlockCreationEvent,
|
||||
DocCreatedEvent,
|
||||
ElementCreationEvent,
|
||||
ElementLockEvent,
|
||||
@@ -24,6 +25,7 @@ export type TelemetryEventMap = OutDatabaseAllEvents &
|
||||
EdgelessElementLocked: ElementLockEvent;
|
||||
ExpandedAndCollapsed: MindMapCollapseEvent;
|
||||
AttachmentUploadedEvent: AttachmentUploadedEvent;
|
||||
BlockCreated: BlockCreationEvent;
|
||||
};
|
||||
|
||||
export interface TelemetryService {
|
||||
|
||||
@@ -51,6 +51,10 @@ export interface ElementLockEvent extends TelemetryEvent {
|
||||
control: 'lock' | 'unlock' | 'group-lock';
|
||||
}
|
||||
|
||||
export interface BlockCreationEvent extends TelemetryEvent {
|
||||
blockType: string;
|
||||
}
|
||||
|
||||
export interface MindMapCollapseEvent extends TelemetryEvent {
|
||||
page: 'whiteboard editor';
|
||||
segment: 'mind map';
|
||||
|
||||
@@ -274,6 +274,15 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
|
||||
place: 'after',
|
||||
removeEmptyLine: true,
|
||||
})
|
||||
.pipe(({ insertedTableBlockId }) => {
|
||||
if (insertedTableBlockId) {
|
||||
const telemetry =
|
||||
rootComponent.std.getOptional(TelemetryProvider);
|
||||
telemetry?.track('BlockCreated', {
|
||||
blockType: 'affine:table',
|
||||
});
|
||||
}
|
||||
})
|
||||
.run();
|
||||
},
|
||||
},
|
||||
@@ -612,8 +621,8 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
|
||||
if (insertedDatabaseBlockId) {
|
||||
const telemetry =
|
||||
rootComponent.std.getOptional(TelemetryProvider);
|
||||
telemetry?.track('AddDatabase', {
|
||||
blockId: insertedDatabaseBlockId,
|
||||
telemetry?.track('BlockCreated', {
|
||||
blockType: 'affine:database',
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -675,8 +684,8 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
|
||||
if (insertedDatabaseBlockId) {
|
||||
const telemetry =
|
||||
rootComponent.std.getOptional(TelemetryProvider);
|
||||
telemetry?.track('AddDatabase', {
|
||||
blockId: insertedDatabaseBlockId,
|
||||
telemetry?.track('BlockCreated', {
|
||||
blockType: 'affine:database',
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user