mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced tracking for code block interactions, including language selection and preview toggling. - Improved error reporting for HTML block preview failures, providing better visibility into issues. - **Bug Fixes** - Added explicit feedback and tracking when cross-origin isolation is not supported during code block preview setup. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
import { createIdentifier } from '@blocksuite/global/di';
|
|
import type { ExtensionType } from '@blocksuite/store';
|
|
|
|
import type { CodeBlockEvents } from './code-block.js';
|
|
import type { OutDatabaseAllEvents } from './database.js';
|
|
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,
|
|
EdgelessToolPickedEvent,
|
|
ElementCreationEvent,
|
|
ElementLockEvent,
|
|
ElementUpdatedEvent,
|
|
LatexEvent,
|
|
LinkedDocCreatedEvent,
|
|
LinkEvent,
|
|
MindMapCollapseEvent,
|
|
TelemetryEvent,
|
|
} from './types.js';
|
|
|
|
export type TelemetryEventMap = OutDatabaseAllEvents &
|
|
LinkToolbarEvents &
|
|
SlashMenuEvents &
|
|
CodeBlockEvents &
|
|
NoteEvents & {
|
|
DocCreated: DocCreatedEvent;
|
|
Link: TelemetryEvent;
|
|
LinkedDocCreated: LinkedDocCreatedEvent;
|
|
SplitNote: TelemetryEvent;
|
|
CanvasElementAdded: ElementCreationEvent;
|
|
CanvasElementUpdated: ElementUpdatedEvent;
|
|
EdgelessElementLocked: ElementLockEvent;
|
|
ExpandedAndCollapsed: MindMapCollapseEvent;
|
|
AttachmentReloadedEvent:
|
|
| AttachmentReloadedEvent
|
|
| AttachmentReloadedEventInToolbar;
|
|
AttachmentUpgradedEvent: AttachmentUpgradedEvent;
|
|
AttachmentUploadedEvent: AttachmentUploadedEvent;
|
|
BlockCreated: BlockCreationEvent;
|
|
EdgelessToolPicked: EdgelessToolPickedEvent;
|
|
CreateEmbedBlock: LinkEvent;
|
|
Latex: LatexEvent;
|
|
};
|
|
|
|
export interface TelemetryService {
|
|
track<T extends keyof TelemetryEventMap>(
|
|
eventName: T,
|
|
props: TelemetryEventMap[T]
|
|
): void;
|
|
}
|
|
|
|
export const TelemetryProvider = createIdentifier<TelemetryService>(
|
|
'AffineTelemetryService'
|
|
);
|
|
|
|
export const TelemetryExtension = (
|
|
service: TelemetryService
|
|
): ExtensionType => {
|
|
return {
|
|
setup: di => {
|
|
di.override(TelemetryProvider, () => service);
|
|
},
|
|
};
|
|
};
|