-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathmessages.ts
125 lines (103 loc) · 2.53 KB
/
messages.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
/* eslint-disable no-use-before-define */
import { snippets } from './eval-snippets';
import { Config, ConsentState, RuleBundle } from './types';
export type BackgroundMessage = InitResponseMessage | EvalResponseMessage | OptOutMessage | OptInMessage | SelfTestMessage;
export type ContentScriptMessage =
| InitMessage
| EvalMessage
| DetectedMessage
| FoundMessage
| OptOutResultMessage
| OptInResultMessage
| SelfTestResultMessage
| DoneMessage
| ErrorMessage
| ReportMessage;
export type BackgroundDevtoolsMessage = DevtoolsAuditMessage | InstanceTerminatedMessage | InitResponseMessage;
export type DevtoolsMessage = DevtoolsInitMessage;
export type InitMessage = {
type: 'init';
url: string;
};
export type EvalMessage = {
type: 'eval';
id: string;
code: string;
snippetId?: keyof typeof snippets;
};
export type DetectedMessage = {
type: 'cmpDetected';
cmp: string;
url: string;
};
export type FoundMessage = {
type: 'popupFound';
cmp: string;
url: string;
};
export type OptOutResultMessage = {
type: 'optOutResult';
cmp: string;
result: boolean;
scheduleSelfTest: boolean;
url: string;
};
export type OptInResultMessage = {
type: 'optInResult';
cmp: string;
result: boolean;
scheduleSelfTest: boolean;
url: string;
};
export type SelfTestResultMessage = {
type: 'selfTestResult';
cmp: string;
result: boolean;
url: string;
};
export type DoneMessage = {
type: 'autoconsentDone';
cmp: string;
isCosmetic: boolean;
url: string;
};
export type ErrorMessage = {
type: 'autoconsentError';
details: any;
};
export type InitResponseMessage = {
type: 'initResp';
rules: RuleBundle;
config: Config;
};
export type EvalResponseMessage = {
type: 'evalResp';
id: string;
result: any;
};
export type OptOutMessage = {
type: 'optOut';
};
export type OptInMessage = {
type: 'optIn';
};
export type SelfTestMessage = {
type: 'selfTest';
};
export type ReportMessage = {
type: 'report';
instanceId: string; // A unique identifier for the frame.
url: string; // Current frame URL
mainFrame: boolean; // `true` iff this frame is the top frame.
state: ConsentState;
};
export type DevtoolsAuditMessage = ReportMessage & { tabId: number; frameId: number };
export type InstanceTerminatedMessage = {
type: 'instanceTerminated';
tabId: number;
instanceId: string;
};
export type DevtoolsInitMessage = {
type: 'init';
tabId: number;
};