-
Notifications
You must be signed in to change notification settings - Fork 306
/
Events.ts
260 lines (224 loc) · 6.38 KB
/
Events.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
import type { Appearance, LanguageOptions } from '@masknet/public-api'
import type { SerializableTypedMessages } from '@masknet/typed-message'
import type { ProfileIdentifier, PersonaIdentifier, ECKeyIdentifier } from '@masknet/base'
import type { NetworkPluginID, PluginID } from '../types/PluginID.js'
import type { PersonaInformation, RelationFavor } from '../types/Persona.js'
import type { EnhanceableSite, ExtensionSite } from '../Site/types.js'
export interface MaskSettingsEvents {
appearanceSettings: Appearance
telemetrySettings: boolean
pluginIDSettings: Record<EnhanceableSite | ExtensionSite, NetworkPluginID>
languageSettings: LanguageOptions
currentPersonaIdentifier: ECKeyIdentifier | undefined
}
export interface MaskContentScriptEvents {
// TODO: Maybe in-page UI related messages should use Context instead of messages?
autoPasteFailed: AutoPasteFailedEvent
replaceComposition: SerializableTypedMessages
// TODO: move to plugin message
profileTabUpdated: ProfileTabEvent
profileTabHidden: { hidden: boolean }
postReplacerHidden: postReplacerHiddenEvent
profileTabActive: { active: boolean }
NFTAvatarUpdated: NFTAvatarEvent
NFTAvatarTimelineUpdated: NFTAvatarEvent
nftAvatarSettingDialogUpdated: NFTAvatarSettingDialogEvent
}
export interface MaskEvents extends MaskSettingsEvents, MaskContentScriptEvents {
telemetryIDReset: string
/** value is "bulkKey" */
legacySettings_bulkDiscoverNS: string
/** emit when the settings changed. */
legacySettings_set: SettingsUpdateEvent
/** emit when the settings finished syncing with storage. */
legacySettings_broadcast: SettingsUpdateEvent
ownPersonaChanged: void
ownProofChanged: void
NFTProjectTwitterDetect: NFTProjectTwitterDetectEvent
relationsChanged: RelationChangedEvent[]
pluginMinimalModeChanged: [id: string, newStatus: boolean]
hostPermissionChanged: void
personasChanged: void
allPluginsReady: boolean
requestExtensionPermission: RequestExtensionPermissionEvent
personaSignRequest: PersonaSignRequestEvent
maskSDKHotModuleReload: void
__kv_backend_persistent__: [string, unknown]
__kv_backend_in_memory__: [string, unknown]
popupRouteUpdated: string
reactQuerySync: any
}
interface UpdateEvent<Data> {
readonly reason: 'update' | 'delete' | 'new'
readonly of: Data
}
export interface CompositionDialogEvent {
readonly reason: 'timeline' | 'popup' | 'reply'
readonly open: boolean
readonly content?: SerializableTypedMessages
readonly options?: {
initialMetas?: Record<string, unknown>
target?: EncryptionTargetType
startupPlugin?: string
startupPluginProps?: any
isOpenFromApplicationBoard?: boolean
}
}
export interface Web3ProfileDialogEvent {
open: boolean
}
export interface CheckSecurityConfirmationDialogEvent {
open: boolean
}
export type CheckSecurityDialogEvent =
| {
open: true
searchHidden: boolean
tokenAddress?: string
chainId?: number
}
| {
open: false
}
export type ApplicationDialogEvent = {
open: boolean
pluginID: string
isVerified?: boolean
selectedPersona?: PersonaInformation
}
export type PersonaBindFinishEvent = {
pluginID?: string
}
export type AvatarSettingDialogEvent = {
open: boolean
startPicking?: boolean
}
export interface NFTProjectTwitterDetectEvent {
address?: string
}
export interface SettingsDialogEvent {
open: boolean
targetTab?: string
}
export type ProfileCardEvent =
| {
open: false
}
| {
open: true
userId: string
address?: string
anchorBounding: DOMRect
anchorEl: HTMLElement | null
external?: boolean
}
export type NonFungibleTokenDialogEvent =
| {
open: true
pluginID: NetworkPluginID
chainId: number
tokenId: string
tokenAddress: string
ownerAddress?: string
origin?: 'pfp' | 'web3-profile-card' | 'web3-profile-tab' | 'unknown'
}
| {
open: false
}
export enum EncryptionTargetType {
Public = 'public',
Self = 'self',
E2E = 'e2e',
}
export interface NFTAvatarSettingDialogEvent {
open: boolean
}
interface SettingsUpdateEvent {
key: string
value: any
}
export interface redpacketDialogEvent {
open: boolean
// CompositionType from '@masknet/plugin-infra/content-script'
compositionType?: 'popup' | 'timeline'
source?: PluginID
}
export interface SmartPayDialogEvent {
open: boolean
}
export interface RenameWalletEvent {
address?: string
}
export interface FollowLensDialogEvent {
open: boolean
handle: string
}
export enum ProfileTabs {
WEB3 = 'web3',
DAO = 'dao',
}
interface ProfileTabEvent {
show: boolean
type?: ProfileTabs
}
export interface postReplacerHiddenEvent {
hidden: boolean
postId: string
}
export interface HideSearchResultInspectorEvent {
hide: boolean
}
export interface NFTAvatarEvent {
userId: string
avatarId: string
address?: string
tokenId?: string
schema?: number
chainId?: number
pluginID?: NetworkPluginID
}
export interface TokenType {
name: string
symbol: string
address: string
decimals?: number
}
export interface SwapDialogEvent {
open: boolean
traderProps?: {
defaultInputCoin?: TokenType
defaultOutputCoin?: TokenType
chainId?: number
}
}
export interface SwitchLogoDialogEvent {
open: boolean
}
export interface WalletSettingsDialogEvent {
pluginID?: string
}
/** This is a subset of browser.permissions.Permission */
export type PossiblyUsedWebExtensionPermission = 'clipboardRead'
export interface RequestExtensionPermissionEvent {
permissions?: PossiblyUsedWebExtensionPermission[]
}
export interface AutoPasteFailedEvent {
text: string
image?: Blob
}
export type RelationChangedEvent = UpdateEvent<ProfileIdentifier | PersonaIdentifier> & {
favor: RelationFavor
}
export interface PersonaSignRequestEvent {
requestID: string
selectedPersona?: PersonaIdentifier
}
export interface RequestsUpdatedEvent {
hasRequest: boolean
}
export type WalletLockStatusUpdatedEvent = boolean
export type PasswordStatusUpdatedEvent = boolean
export interface PopupWalletConnectEvent {
open: boolean
uri?: string
}