Files
AFFiNE-Mirror/packages/frontend/track/src/events.ts
T
renovate 846350bbb1 chore: bump up oxlint version to v0.16.9 (#12122)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [oxlint](https://oxc.rs) ([source](https://redirect.github.com/oxc-project/oxc/tree/HEAD/npm/oxlint)) | [`0.16.8` -> `0.16.9`](https://renovatebot.com/diffs/npm/oxlint/0.16.8/0.16.9) | [![age](https://developer.mend.io/api/mc/badges/age/npm/oxlint/0.16.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/oxlint/0.16.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/oxlint/0.16.8/0.16.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/oxlint/0.16.8/0.16.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>oxc-project/oxc (oxlint)</summary>

### [`v0.16.9`](https://redirect.github.com/oxc-project/oxc/releases/tag/oxlint_v0.16.9): oxlint v0.16.9

[Compare Source](https://redirect.github.com/oxc-project/oxc/compare/oxlint_v0.16.8...oxlint_v0.16.9)

#### \[0.16.9] - 2025-05-03

##### Features

-   [`63f02a8`](https://redirect.github.com/oxc-project/oxc/commit/63f02a8) linter: Add react/forward_ref_uses_ref ([#&#8203;10506](https://redirect.github.com/oxc-project/oxc/issues/10506)) (x6eull)
-   [`a3ada34`](https://redirect.github.com/oxc-project/oxc/commit/a3ada34) linter: Implement fixer for unicorn/prefer-number-properties ([#&#8203;10693](https://redirect.github.com/oxc-project/oxc/issues/10693)) (camc314)
-   [`e97a4e0`](https://redirect.github.com/oxc-project/oxc/commit/e97a4e0) linter: Add fixer to unicorn/prefer-spread ([#&#8203;10691](https://redirect.github.com/oxc-project/oxc/issues/10691)) (camc314)
-   [`a69a0ee`](https://redirect.github.com/oxc-project/oxc/commit/a69a0ee) linter: Add eslint/block-scoped-var ([#&#8203;10237](https://redirect.github.com/oxc-project/oxc/issues/10237)) (yefan)
-   [`387af3a`](https://redirect.github.com/oxc-project/oxc/commit/387af3a) linter: Report vars only used as types ([#&#8203;10664](https://redirect.github.com/oxc-project/oxc/issues/10664)) (camc314)
-   [`eac205f`](https://redirect.github.com/oxc-project/oxc/commit/eac205f) linter: Add unicorn/consistent-assert rule ([#&#8203;10653](https://redirect.github.com/oxc-project/oxc/issues/10653)) (Shota Kitahara)
-   [`0e6a727`](https://redirect.github.com/oxc-project/oxc/commit/0e6a727) linter: Add autofixer for eslint/radix ([#&#8203;10652](https://redirect.github.com/oxc-project/oxc/issues/10652)) (yefan)
-   [`fb070c4`](https://redirect.github.com/oxc-project/oxc/commit/fb070c4) linter/no-extra-boolean-cast: Implement auto-fixer ([#&#8203;10682](https://redirect.github.com/oxc-project/oxc/issues/10682)) (DonIsaac)
-   [`432cd77`](https://redirect.github.com/oxc-project/oxc/commit/432cd77) linter/no-new-wrapper: Implement auto-fixer ([#&#8203;10680](https://redirect.github.com/oxc-project/oxc/issues/10680)) (DonIsaac)

##### Bug Fixes

-   [`4ee95ec`](https://redirect.github.com/oxc-project/oxc/commit/4ee95ec) editor: Activate extension when astro files are opened too ([#&#8203;10725](https://redirect.github.com/oxc-project/oxc/issues/10725)) (Sysix)
-   [`46665bd`](https://redirect.github.com/oxc-project/oxc/commit/46665bd) langage_server: Fix initialize nested configs ([#&#8203;10698](https://redirect.github.com/oxc-project/oxc/issues/10698)) (Sysix)
-   [`eb3f37c`](https://redirect.github.com/oxc-project/oxc/commit/eb3f37c) language_server: On configuration change, send updated diagnostics to the client ([#&#8203;10764](https://redirect.github.com/oxc-project/oxc/issues/10764)) (Sysix)
-   [`8c499c6`](https://redirect.github.com/oxc-project/oxc/commit/8c499c6) linter: Fix panic when doing code gen on regexp ([#&#8203;10769](https://redirect.github.com/oxc-project/oxc/issues/10769)) (camc314)
-   [`8e99abf`](https://redirect.github.com/oxc-project/oxc/commit/8e99abf) linter: Fix grammer in no unused vars diagnostic msg ([#&#8203;10770](https://redirect.github.com/oxc-project/oxc/issues/10770)) (camc314)
-   [`b38338a`](https://redirect.github.com/oxc-project/oxc/commit/b38338a) linter: Make require post message target origin a fixer a suggestion ([#&#8203;10754](https://redirect.github.com/oxc-project/oxc/issues/10754)) (camc314)
-   [`48c542d`](https://redirect.github.com/oxc-project/oxc/commit/48c542d) linter: Skip linting vue <script> where `lang` is not js / ts ([#&#8203;10740](https://redirect.github.com/oxc-project/oxc/issues/10740)) (Boshen)
-   [`c9575f6`](https://redirect.github.com/oxc-project/oxc/commit/c9575f6) linter: Fix false positive in react/exhaustive deps ([#&#8203;10727](https://redirect.github.com/oxc-project/oxc/issues/10727)) (camc314)
-   [`d8d8f64`](https://redirect.github.com/oxc-project/oxc/commit/d8d8f64) linter: Shorten span of promise/prefer-await-to-then ([#&#8203;10717](https://redirect.github.com/oxc-project/oxc/issues/10717)) (camc314)
-   [`a88e349`](https://redirect.github.com/oxc-project/oxc/commit/a88e349) linter: Mark `isNan` and `isFinite` as dangerous fixes in `unicorn/prefer-number-properties` ([#&#8203;10706](https://redirect.github.com/oxc-project/oxc/issues/10706)) (Sysix)
-   [`f4ab05f`](https://redirect.github.com/oxc-project/oxc/commit/f4ab05f) linter: Panic in unicorn/no-useless-spread ([#&#8203;10715](https://redirect.github.com/oxc-project/oxc/issues/10715)) (camc314)
-   [`06f1717`](https://redirect.github.com/oxc-project/oxc/commit/06f1717) linter: False positive in no unused vars when importing value used as type ([#&#8203;10690](https://redirect.github.com/oxc-project/oxc/issues/10690)) (camc314)
-   [`746b318`](https://redirect.github.com/oxc-project/oxc/commit/746b318) linter: False positive in typescript/explicit-function-return-type with `satisfies` ([#&#8203;10668](https://redirect.github.com/oxc-project/oxc/issues/10668)) (camc314)
-   [`cce1043`](https://redirect.github.com/oxc-project/oxc/commit/cce1043) linter: False positive in typescript/explicit-function-return-type ([#&#8203;10667](https://redirect.github.com/oxc-project/oxc/issues/10667)) (camc314)
-   [`c89da93`](https://redirect.github.com/oxc-project/oxc/commit/c89da93) linter: False positive in eslint/curly on windows ([#&#8203;10671](https://redirect.github.com/oxc-project/oxc/issues/10671)) (camc314)
-   [`374e19e`](https://redirect.github.com/oxc-project/oxc/commit/374e19e) linter: False positive in react/jsx-curly-brace-presence ([#&#8203;10663](https://redirect.github.com/oxc-project/oxc/issues/10663)) (camc314)
-   [`e7c2b32`](https://redirect.github.com/oxc-project/oxc/commit/e7c2b32) linter: Move `consistent-assert` to `pedantic` ([#&#8203;10665](https://redirect.github.com/oxc-project/oxc/issues/10665)) (camc314)
-   [`344ef88`](https://redirect.github.com/oxc-project/oxc/commit/344ef88) linter: False positive in `eslint/no-unused-vars` when calling inside sequence expression ([#&#8203;10646](https://redirect.github.com/oxc-project/oxc/issues/10646)) (Ulrich Stark)
-   [`98bcd5f`](https://redirect.github.com/oxc-project/oxc/commit/98bcd5f) lsp: Incorrect quick fix offset in vue files ([#&#8203;10742](https://redirect.github.com/oxc-project/oxc/issues/10742)) (camc314)

##### Documentation

-   [`275fe71`](https://redirect.github.com/oxc-project/oxc/commit/275fe71) editor: `oxc.flags` are not related to `oxlint` ([#&#8203;10645](https://redirect.github.com/oxc-project/oxc/issues/10645)) (Sysix)

##### Refactor

-   [`2efe3f0`](https://redirect.github.com/oxc-project/oxc/commit/2efe3f0) linter: Move run on regex node to utils ([#&#8203;10772](https://redirect.github.com/oxc-project/oxc/issues/10772)) (camc314)

##### Testing

-   [`1c4f90f`](https://redirect.github.com/oxc-project/oxc/commit/1c4f90f) editor: Add test for nested config serverity ([#&#8203;10697](https://redirect.github.com/oxc-project/oxc/issues/10697)) (Sysix)
-   [`9ebf3d4`](https://redirect.github.com/oxc-project/oxc/commit/9ebf3d4) language_server: Refactor tester to use WorkspaceWorker ([#&#8203;10730](https://redirect.github.com/oxc-project/oxc/issues/10730)) (Sysix)
-   [`5a709ad`](https://redirect.github.com/oxc-project/oxc/commit/5a709ad) language_server: Add test for `init_nested_configs` ([#&#8203;10728](https://redirect.github.com/oxc-project/oxc/issues/10728)) (Sysix)
-   [`2615758`](https://redirect.github.com/oxc-project/oxc/commit/2615758) language_server: Fix slow test ([#&#8203;10659](https://redirect.github.com/oxc-project/oxc/issues/10659)) (Alexander S.)
-   [`fd18aaa`](https://redirect.github.com/oxc-project/oxc/commit/fd18aaa) language_server: Skip slow test ([#&#8203;10658](https://redirect.github.com/oxc-project/oxc/issues/10658)) (overlookmotel)
-   [`f6f1c5c`](https://redirect.github.com/oxc-project/oxc/commit/f6f1c5c) lsp: Include fixed content in lsp snapshots ([#&#8203;10744](https://redirect.github.com/oxc-project/oxc/issues/10744)) (camc314)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNjQuMCIsInVwZGF0ZWRJblZlciI6IjM5LjI2NC4wIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5IiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyJdfQ==-->
2025-05-04 05:34:35 +00:00

736 lines
18 KiB
TypeScript

// let '$' stands for unspecific matrix
/* eslint-disable rxjs/finnish */
// SECTION: app events
type GeneralEvents = 'openMigrationDataHelp';
type CmdkEvents = 'quickSearch' | 'recentDocs' | 'searchResultsDocs';
type AppEvents =
| 'checkUpdates'
| 'downloadUpdate'
| 'downloadApp'
| 'quitAndInstall'
| 'openChangelog'
| 'dismissChangelog'
| 'contactUs'
| 'findInPage';
type NavigationEvents =
| 'openInNewTab'
| 'openInSplitView'
| 'openInPeekView'
| 'switchTab'
| 'switchSplitView'
| 'tabAction'
| 'splitViewAction'
| 'navigate'
| 'goBack'
| 'goForward'
| 'toggle' // toggle navigation panel
| 'open'
| 'close'; // openclose modal/diaglog
// END SECTIONalias
// SECTION: doc events
type WorkspaceEvents =
| 'createWorkspace'
| 'upgradeWorkspace'
| 'enableCloudWorkspace'
| 'import'
| 'export'
| 'openWorkspaceList';
type DocEvents =
| 'createDoc'
| 'quickStart'
| 'renameDoc'
| 'linkDoc'
| 'deleteDoc'
| 'restoreDoc'
| 'switchPageMode'
| 'openDocOptionsMenu'
| 'openDocInfo'
| 'copyBlockToLink'
| 'loadDoc'
| 'bookmark'
| 'editProperty'
| 'editPropertyMeta'
| 'addProperty';
type EditorEvents =
| 'bold'
| 'italic'
| 'underline'
| 'strikeThrough'
| 'foldEdgelessNote';
// END SECTION
// SECTION: setting events
type SettingEvents =
| 'openSettings'
| 'changeAppSetting'
| 'changeEditorSetting'
| 'recoverArchivedWorkspace'
| 'deleteArchivedWorkspace'
| 'deleteUnusedBlob';
// END SECTION
// SECTION: organize events
type CollectionEvents =
| 'createCollection'
| 'deleteCollection'
| 'renameCollection'
| 'addDocToCollection';
type FolderEvents =
| 'createFolder'
| 'renameFolder'
| 'moveFolder'
| 'deleteFolder';
type TagEvents = 'createTag' | 'deleteTag' | 'renameTag' | 'tagDoc';
type FavoriteEvents = 'toggleFavorite';
type OrganizeItemEvents = // doc, link, folder, collection, tag
| 'createOrganizeItem'
| 'renameOrganizeItem'
| 'moveOrganizeItem'
| 'deleteOrganizeItem'
| 'orderOrganizeItem'
| 'removeOrganizeItem';
type OrganizeEvents =
| OrganizeItemEvents
| CollectionEvents
| FolderEvents
| TagEvents
| FavoriteEvents;
type DNDEvents = 'dragStart' | 'drag' | 'drop';
// END SECTION
// SECTION: cloud events
type ShareEvents =
| 'createShareLink'
| 'copyShareLink'
| 'openShareMenu'
| 'share';
type DocRoleEvents =
| 'modifyDocDefaultRole'
| 'modifyUserDocRole'
| 'inviteUserDocRole';
type AuthEvents =
| 'requestSignIn'
| 'signIn'
| 'signInFail'
| 'signedIn'
| 'signOut';
type AccountEvents = 'uploadAvatar' | 'removeAvatar' | 'updateUserName';
type PaymentEvents =
| 'viewPlans'
| 'bookDemo'
| 'checkout'
| 'subscribe'
| 'changeSubscriptionRecurring'
| 'confirmChangingSubscriptionRecurring'
| 'cancelSubscription'
| 'confirmCancelingSubscription'
| 'resumeSubscription'
| 'confirmResumingSubscription';
// END SECTION
// SECTION: ai
type AIEvents = 'addEmbeddingDoc';
// END SECTION
// SECTION: attachment
type AttachmentEvents =
| 'openAttachmentInFullscreen'
| 'openAttachmentInNewTab'
| 'openAttachmentInPeekView'
| 'openAttachmentInSplitView'
| 'openPDFRendererFail';
// END SECTION
// SECTION: template
type TemplateEvents = 'openTemplateListMenu';
// END SECTION
// SECTION: notification
type NotificationEvents = 'openInbox' | 'clickNotification';
// END SECTION
// SECTION: Integration
type IntegrationEvents =
| 'connectIntegration'
| 'disconnectIntegration'
| 'modifyIntegrationSettings'
| 'startIntegrationImport'
| 'selectIntegrationImport'
| 'confirmIntegrationImport'
| 'abortIntegrationImport'
| 'completeIntegrationImport';
// END SECTION
// SECTION: journal
type MeetingEvents =
| 'toggleRecordingBar'
| 'startRecording'
| 'dismissRecording'
| 'finishRecording'
| 'transcribeRecording'
| 'openTranscribeNotes'
| 'toggleMeetingFeatureFlag'
| 'activeMenubarAppItem';
// END SECTION
// SECTION: mention
type MentionEvents = 'mentionMember' | 'noAccessPrompted';
// END SECTION
type UserEvents =
| GeneralEvents
| AppEvents
| NavigationEvents
| WorkspaceEvents
| DocEvents
| EditorEvents
| SettingEvents
| CmdkEvents
| OrganizeEvents
| ShareEvents
| DocRoleEvents
| AuthEvents
| AccountEvents
| PaymentEvents
| DNDEvents
| AIEvents
| AttachmentEvents
| TemplateEvents
| NotificationEvents
| IntegrationEvents
| MeetingEvents
| MentionEvents;
interface PageDivision {
[page: string]: {
[segment: string]: {
[module: string]: UserEvents[];
};
};
}
interface PageEvents extends PageDivision {
// page: {
// $: {}
// ^ if empty
// segment: {
// module: ['event1', 'event2']
// },
// },
// to: page.$.segment.module.event1()
$: {
$: {
$: ['createWorkspace', 'checkout'];
auth: ['requestSignIn', 'signIn', 'signedIn', 'signInFail', 'signOut'];
};
sharePanel: {
$: [
'createShareLink',
'copyShareLink',
'export',
'open',
'modifyDocDefaultRole',
'modifyUserDocRole',
'inviteUserDocRole',
];
};
docInfoPanel: {
$: ['open'];
property: ['editProperty', 'addProperty', 'editPropertyMeta'];
databaseProperty: ['editProperty'];
};
settingsPanel: {
menu: ['openSettings'];
workspace: [
'viewPlans',
'export',
'addProperty',
'editPropertyMeta',
'deleteUnusedBlob',
];
archivedWorkspaces: [
'recoverArchivedWorkspace',
'deleteArchivedWorkspace',
];
profileAndBadge: ['viewPlans'];
accountUsage: ['viewPlans'];
accountSettings: ['uploadAvatar', 'removeAvatar', 'updateUserName'];
plans: [
'checkout',
'subscribe',
'changeSubscriptionRecurring',
'confirmChangingSubscriptionRecurring',
'cancelSubscription',
'confirmCancelingSubscription',
'resumeSubscription',
'confirmResumingSubscription',
];
billing: ['viewPlans', 'bookDemo'];
about: ['checkUpdates', 'downloadUpdate', 'changeAppSetting'];
integrationList: [
'connectIntegration',
'disconnectIntegration',
'modifyIntegrationSettings',
'startIntegrationImport',
'selectIntegrationImport',
'confirmIntegrationImport',
'abortIntegrationImport',
'completeIntegrationImport',
];
meetings: ['toggleMeetingFeatureFlag'];
};
cmdk: {
recent: ['recentDocs'];
results: ['searchResultsDocs'];
general: ['copyShareLink', 'goBack', 'goForward', 'findInPage'];
creation: ['createDoc'];
workspace: ['createWorkspace'];
settings: ['openSettings', 'changeAppSetting'];
navigation: ['navigate'];
editor: [
'toggleFavorite',
'switchPageMode',
'createDoc',
'export',
'deleteDoc',
'restoreDoc',
];
docInfo: ['open'];
docHistory: ['open'];
updates: ['quitAndInstall'];
help: ['contactUs', 'openChangelog'];
};
navigationPanel: {
$: ['quickSearch', 'createDoc', 'navigate', 'openSettings', 'toggle'];
organize: [
'createOrganizeItem',
'renameOrganizeItem',
'moveOrganizeItem',
'deleteOrganizeItem',
'orderOrganizeItem',
'openInNewTab',
'openInSplitView',
'toggleFavorite',
'drop',
];
docs: ['createDoc', 'deleteDoc', 'linkDoc', 'drop'];
collections: [
'createDoc',
'addDocToCollection',
'removeOrganizeItem',
'drop',
];
folders: ['createDoc', 'drop'];
tags: ['createDoc', 'tagDoc', 'drop'];
favorites: ['createDoc', 'drop'];
migrationData: ['openMigrationDataHelp'];
bottomButtons: [
'downloadApp',
'quitAndInstall',
'openChangelog',
'dismissChangelog',
];
others: ['navigate'];
importModal: ['open'];
workspaceList: [
'requestSignIn',
'open',
'createWorkspace',
'createDoc',
'openSettings',
];
profileAndBadge: ['openSettings'];
journal: ['navigate'];
};
aiOnboarding: {
dialog: ['viewPlans'];
};
docHistory: {
$: ['open', 'close', 'switchPageMode', 'viewPlans'];
};
importModal: {
$: ['open', 'import', 'createDoc'];
};
paywall: {
storage: ['viewPlans'];
aiAction: ['viewPlans'];
};
appTabsHeader: {
$: ['tabAction', 'dragStart'];
};
header: {
$: ['dragStart'];
actions: [
'createDoc',
'createWorkspace',
'switchPageMode',
'toggleFavorite',
'openDocInfo',
'renameDoc',
];
docOptions: [
'open',
'deleteDoc',
'renameDoc',
'switchPageMode',
'createDoc',
'import',
'toggleFavorite',
'export',
];
history: ['open'];
pageInfo: ['open'];
importModal: ['open'];
snapshot: ['import', 'export'];
};
chatPanel: {
chatPanelInput: ['addEmbeddingDoc'];
};
attachment: {
$: [
'openAttachmentInFullscreen',
'openAttachmentInNewTab',
'openAttachmentInPeekView',
'openAttachmentInSplitView',
'openPDFRendererFail',
];
};
sidebar: {
newDoc: ['quickStart'];
template: ['openTemplateListMenu', 'quickStart'];
notifications: ['openInbox', 'clickNotification'];
};
splitViewIndicator: {
$: ['splitViewAction', 'openInSplitView', 'openInPeekView'];
};
};
doc: {
$: {
$: ['loadDoc'];
};
editor: {
slashMenu: ['linkDoc', 'createDoc', 'bookmark'];
atMenu: [
'linkDoc',
'import',
'createDoc',
'mentionMember',
'noAccessPrompted',
];
quickSearch: ['createDoc'];
formatToolbar: ['bold'];
pageRef: ['navigate'];
toolbar: [
'copyBlockToLink',
'openInSplitView',
'openInNewTab',
'openInPeekView',
];
aiActions: ['requestSignIn'];
starterBar: ['quickStart', 'openTemplateListMenu'];
audioBlock: ['transcribeRecording', 'openTranscribeNotes'];
};
inlineDocInfo: {
$: ['toggle'];
property: ['editProperty', 'editPropertyMeta', 'addProperty'];
databaseProperty: ['editProperty'];
};
sidepanel: {
property: ['addProperty', 'editPropertyMeta'];
};
biDirectionalLinksPanel: {
$: ['toggle'];
backlinkTitle: ['toggle', 'navigate'];
backlinkPreview: ['navigate'];
};
};
edgeless: {
pageBlock: {
headerToolbar: [
'toggle',
'openDocInfo',
'copyBlockToLink',
'switchPageMode',
];
};
};
workspace: {
$: {
$: ['upgradeWorkspace'];
};
};
allDocs: {
header: {
actions: ['createDoc', 'createWorkspace'];
};
list: {
docMenu: [
'createDoc',
'deleteDoc',
'openInSplitView',
'toggleFavorite',
'openInNewTab',
];
};
};
collection: {
docList: {
docMenu: ['removeOrganizeItem'];
};
};
tag: {};
trash: {};
subscriptionLanding: {
$: {
$: ['checkout'];
};
};
menubarApp: {
menubarActionsMenu: {
menubarActionsList: ['activeMenubarAppItem', 'startRecording'];
};
};
popup: {
$: {
recordingBar: [
'toggleRecordingBar',
'startRecording',
'dismissRecording',
'finishRecording',
];
};
};
}
type OrganizeItemType = 'doc' | 'folder' | 'collection' | 'tag' | 'favorite';
type OrganizeItemArgs =
| {
type: 'link';
target: OrganizeItemType;
}
| {
type: OrganizeItemType;
};
type PaymentEventArgs = {
plan: string;
recurring: string;
};
type AttachmentEventArgs = {
type: string; // file type
};
type TabActionControlType =
| 'click'
| 'dnd'
| 'midClick'
| 'xButton'
| 'contextMenu';
type TabActionType =
| 'pin'
| 'unpin'
| 'close'
| 'refresh'
| 'moveTab'
| 'openInSplitView'
| 'openInNewTab'
| 'switchSplitView'
| 'switchTab'
| 'separateTabs';
type SplitViewActionControlType = 'menu' | 'indicator';
type SplitViewActionType = 'open' | 'close' | 'move' | 'closeOthers';
type AuthArgs = {
method: 'password' | 'magic-link' | 'oauth' | 'otp';
provider?: string;
};
type ImportStatus = 'importing' | 'failed' | 'success';
type ImportArgs = {
type: string;
status?: ImportStatus;
error?: string;
result?: {
docCount: number;
};
};
type IntegrationArgs<T extends Record<string, any>> = {
type: string;
control: 'Readwise Card' | 'Readwise settings' | 'Readwise import list';
} & T;
type RecordingEventArgs = {
type: 'Meeting record';
method?: string;
option?: 'Auto transcribing' | 'handle transcribing' | 'on' | 'off';
};
export type EventArgs = {
createWorkspace: { flavour: string };
signIn: AuthArgs;
signedIn: AuthArgs;
signInFail: AuthArgs & { reason: string };
viewPlans: PaymentEventArgs;
checkout: PaymentEventArgs;
subscribe: PaymentEventArgs;
cancelSubscription: PaymentEventArgs;
confirmCancelingSubscription: PaymentEventArgs;
resumeSubscription: PaymentEventArgs;
confirmResumingSubscription: PaymentEventArgs;
changeSubscriptionRecurring: PaymentEventArgs;
confirmChangingSubscriptionRecurring: PaymentEventArgs;
navigate: { to: string };
openSettings: { to: string };
changeAppSetting: { key: string; value: string | boolean | number };
changeEditorSetting: { key: string; value: string | boolean | number };
createOrganizeItem: OrganizeItemArgs;
renameOrganizeItem: OrganizeItemArgs;
moveOrganizeItem: OrganizeItemArgs;
removeOrganizeItem: OrganizeItemArgs;
deleteOrganizeItem: OrganizeItemArgs;
orderOrganizeItem: OrganizeItemArgs;
openInNewTab: { type: OrganizeItemType };
openInSplitView: { type: OrganizeItemType; route?: string };
tabAction: {
type?: OrganizeItemType;
control: TabActionControlType;
action: TabActionType;
};
splitViewAction: {
control: SplitViewActionControlType;
action: SplitViewActionType;
};
toggleFavorite: OrganizeItemArgs & { on: boolean };
toggle: { type: 'collapse' | 'expand' };
createDoc: { mode?: 'edgeless' | 'page' };
quickStart: { with: 'page' | 'edgeless' | 'template' | 'ai' };
switchPageMode: { mode: 'edgeless' | 'page' };
createShareLink: { mode: 'edgeless' | 'page' };
copyShareLink: {
type: 'default' | 'doc' | 'whiteboard' | 'block' | 'element';
};
import: ImportArgs;
export: { type: string };
copyBlockToLink: {
type: string;
};
editProperty: { type: string };
editPropertyMeta: { type: string; field: string };
addProperty: { type: string; control: 'at menu' | 'property list' };
linkDoc: { type: string; journal: boolean };
drop: { type: string };
dragStart: { type: string };
addEmbeddingDoc: {
type?: 'page' | 'edgeless';
control: 'addButton' | 'atMenu';
method: 'doc' | 'file' | 'tags' | 'collections' | 'suggestion';
};
openAttachmentInFullscreen: AttachmentEventArgs;
openAttachmentInNewTab: AttachmentEventArgs;
openAttachmentInPeekView: AttachmentEventArgs;
openAttachmentInSplitView: AttachmentEventArgs;
modifyUserDocRole: { role: string };
modifyDocDefaultRole: { role: string };
inviteUserDocRole: {
control: 'member list';
role: string;
};
openInbox: { unreadCount: number };
clickNotification: {
type: string;
item: 'read' | 'button' | 'dismiss';
button?: string;
};
connectIntegration: IntegrationArgs<{ result: 'success' | 'failed' }>;
disconnectIntegration: IntegrationArgs<{ method: 'keep' | 'delete' }>;
modifyIntegrationSettings: IntegrationArgs<{
item: string;
option: any;
method: any;
}>;
startIntegrationImport: IntegrationArgs<{
method: 'new' | 'withtimestamp' | 'cleartimestamp';
}>;
selectIntegrationImport: IntegrationArgs<{
method: 'single' | 'all';
option: 'on' | 'off';
}>;
confirmIntegrationImport: IntegrationArgs<{
method: 'new' | 'withtimestamp';
}>;
abortIntegrationImport: IntegrationArgs<{
time: number;
done: number;
total: number;
}>;
completeIntegrationImport: IntegrationArgs<{
time: number;
done: number;
total: number;
}>;
toggleRecordingBar: RecordingEventArgs & {
method: string;
appName: string;
};
startRecording: RecordingEventArgs & {
method: string;
appName: string;
};
dismissRecording: RecordingEventArgs & {
method: string;
appName: string;
};
finishRecording: RecordingEventArgs & {
method: 'fail' | 'success';
appName: string;
};
transcribeRecording: RecordingEventArgs & {
method: 'fail' | 'success';
option: 'Auto transcribing' | 'handle transcribing';
};
openTranscribeNotes: RecordingEventArgs & {
method: 'success' | 'reach limit' | 'not signed in' | 'not owner';
option: 'on' | 'off';
};
toggleMeetingFeatureFlag: RecordingEventArgs & {
option: 'on' | 'off';
};
activeMenubarAppItem: RecordingEventArgs & {
control:
| 'Open Journal'
| 'New Page'
| 'New Edgeless'
| 'Start recording meeting'
| 'Stop recording'
| 'Open AFFiNE'
| 'About AFFiNE'
| 'Meeting Settings'
| 'Quit AFFiNE Completely';
};
mentionMember: {
type: 'member' | 'invite' | 'more';
};
noAccessPrompted: {};
loadDoc: {
workspaceId: string;
docId: string;
time: number;
success: boolean;
};
};
// for type checking
// if it complains, check the definition of [EventArgs] to make sure it's key is a subset of [UserEvents]
export const YOU_MUST_DEFINE_ARGS_WITH_WRONG_EVENT_NAME: keyof EventArgs extends UserEvents
? true
: false = true;
export type Events = PageEvents;