-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathbanner.ts
More file actions
137 lines (130 loc) · 3.26 KB
/
Copy pathbanner.ts
File metadata and controls
137 lines (130 loc) · 3.26 KB
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
import { SubmittedAccountOp } from '@/libs/accountOp/submittedAccountOp'
import { ControllerInterface } from './controller'
import { UserRequest } from './userRequest'
export type IBannerController = ControllerInterface<
InstanceType<typeof import('../controllers/banner/banner').BannerController>
>
export type BannerType = 'error' | 'warning' | 'info' | 'success'
export type BannerCategory =
| 'pending-to-be-signed-acc-op'
| 'pending-to-be-confirmed-acc-ops'
| 'successful-acc-op'
| 'failed-acc-ops'
| 'bridge-in-progress'
| 'bridge-waiting-approval-to-resolve'
| 'bridge-ready'
| 'bridge-completed'
| 'bridge-failed'
| 'temp-seed-not-confirmed'
| 'old-account'
interface BannerRequirements {
minBalanceTotal?: number
maxBalanceTotal?: number
minTxnsTotal?: number
maxTxnsTotal?: number
minAppVersion?: string
whitelistedAddresses?: string[]
shouldHaveKeys?: boolean
}
export interface Banner {
id: number | string
type: BannerType | MarketingBannerTypes
category?: BannerCategory
title: string
text?: string
emoji?: string
// Force a single action on purpose
actions: [Action] | []
dismissAction?: Action
meta?: {
accountAddr?: string
startTime?: number
endTime?: number
requirements?: BannerRequirements
accountOpsDataForNextUpdate?: Pick<
SubmittedAccountOp,
'accountAddr' | 'chainId' | 'timestamp' | 'id'
>[]
[key: string]: any
}
}
export type MarketingBannerTypes = 'updates' | 'rewards' | 'new' | 'vote' | 'tips' | 'alert'
export type Action = (
| {
actionName: 'open-pending-dapp-requests'
}
| {
actionName: 'open-accountOp'
meta: { requestId: UserRequest['id'] }
}
| {
actionName: 'reject-accountOp'
meta: {
err: string
requestId: UserRequest['id']
shouldOpenNextAction: boolean
}
}
| {
actionName: 'sync-keys'
meta: { email: string; keys: string[] }
}
| {
actionName: 'open-external-url'
meta: { url: string }
}
| {
actionName: 'backup-keystore-secret'
}
| {
actionName: 'reject-bridge'
meta: { activeRouteIds: string[] }
}
| {
actionName: 'proceed-bridge'
meta: { activeRouteId: string }
}
| {
actionName: 'close-bridge'
meta: { activeRouteIds: string[]; isHideStyle: boolean }
}
| {
actionName: 'open-swap-and-bridge-tab'
}
| {
actionName: 'hide-activity-banner'
meta: { timestamp: number; addr: string; chainId: bigint; isHideStyle: boolean }
}
| {
actionName: 'update-extension-version'
}
| {
// Mobile-only: apply a downloaded over the air update (bundle) by restarting the app
actionName: 'apply-ota-update'
}
| {
actionName: 'reload-selected-account'
}
| {
actionName: 'dismiss-7702-banner'
meta: { accountAddr: string }
}
| {
actionName: 'view-bridge'
}
| {
actionName: 'enable-networks'
meta: { networkChainIds: bigint[] }
}
| {
actionName: 'enable-networks'
meta: { networkChainIds: bigint[] }
}
| {
actionName: 'dismiss-defi-positions-banner'
}
| { actionName: 'open-link'; meta: { url: string } }
| { actionName: 'survey'; meta: { surveyId: string } }
) & {
label?: string
}