Merge branch 'INDA-330-pii-update' into 'main'
[ProtonMail-WebClient.git] / packages / sieve / fixtures / v2EscapeVariables.ts
blobfd2810785ab8e073f4581407427417e656b9e905
1 import type { SimpleObject } from '@proton/components/containers/filters/interfaces';
2 import { ConditionComparator, ConditionType, FilterStatement } from '@proton/components/containers/filters/interfaces';
4 const tree = [
5     {
6         List: ['include', 'environment', 'variables', 'relational', 'comparator-i;ascii-numeric', 'spamtest'],
7         Type: 'Require',
8     },
9     {
10         List: ['fileinto', 'imap4flags', 'vacation'],
11         Type: 'Require',
12     },
13     {
14         Text: '# Generated: Do not run this script on spam messages',
15         Type: 'Comment',
16     },
17     {
18         If: {
19             Tests: [
20                 {
21                     Name: 'vnd.proton.spam-threshold',
22                     Keys: ['*'],
23                     Format: null,
24                     Match: {
25                         Type: 'Matches',
26                     },
27                     Type: 'Environment',
28                 },
29                 {
30                     Value: {
31                         Value: '${1}',
32                         Type: 'VariableString',
33                     },
34                     Flags: [],
35                     Format: {
36                         Type: 'ASCIINumeric',
37                     },
38                     Match: {
39                         Comparator: 'ge',
40                         Type: 'GreaterEqualsValue',
41                     },
42                     Type: 'SpamTest',
43                 },
44             ],
45             Type: 'AllOf',
46         },
47         Then: [
48             {
49                 Type: 'Return',
50             },
51         ],
52         Type: 'If',
53     },
54     {
55         Name: 'dollar',
56         Value: '$',
57         Flags: [],
58         Type: 'Set',
59     },
60     {
61         Text: '/**\r\n * @type or\r\n * @comparator ends\r\n */',
62         Type: 'Comment',
63     },
64     {
65         If: {
66             Tests: [
67                 {
68                     Headers: ['To', 'Cc', 'Bcc'],
69                     Keys: [
70                         {
71                             Type: 'VariableString',
72                             Value: '*${dollar}{frommail}',
73                         },
74                         '*${}',
75                         {
76                             Type: 'VariableString',
77                             Value: '*${dollar}{frommail} ${dollar}{tomail}',
78                         },
79                     ],
80                     Match: {
81                         Type: 'Matches',
82                     },
83                     Format: {
84                         Type: 'UnicodeCaseMap',
85                     },
86                     AddressPart: {
87                         Type: 'All',
88                     },
89                     Type: 'Address',
90                 },
91             ],
92             Type: 'AnyOf',
93         },
94         Then: [
95             {
96                 Name: 'archive',
97                 Type: 'FileInto',
98             },
99             {
100                 Name: 'polo',
101                 Type: 'FileInto',
102             },
103             {
104                 Name: {
105                     Value: '${dollar}{File}',
106                     Type: 'VariableString',
107                 },
108                 Type: 'FileInto',
109             },
110             {
111                 Flags: ['\\Seen', '\\Flagged'],
112                 Type: 'AddFlag',
113             },
114             {
115                 Type: 'Keep',
116             },
117             {
118                 Message: {
119                     Value: "<div>Je mange une pomme, ${dollar}{d3_so} pas ${déso} mais ${j'ai} faim pedro</div> ",
120                     Type: 'VariableString',
121                 },
122                 Args: {
123                     MIMEType: 'text/html',
124                 },
125                 Type: 'Vacation',
126             },
127         ],
128         Type: 'If',
129     },
132 const simple: SimpleObject = {
133     Operator: {
134         label: 'Any',
135         value: FilterStatement.ANY,
136     },
137     Conditions: [
138         {
139             Type: {
140                 label: 'Recipient',
141                 value: ConditionType.RECIPIENT,
142             },
143             Comparator: {
144                 label: 'ends with',
145                 value: ConditionComparator.ENDS,
146             },
147             Values: ['${frommail}', '${}', '${frommail} ${tomail}'],
148         },
149     ],
150     Actions: {
151         FileInto: ['archive', 'polo', '${File}'],
152         Mark: {
153             Read: true,
154             Starred: true,
155         },
156         Vacation: "<div>Je mange une pomme, ${d3_so} pas ${déso} mais ${j'ai} faim pedro</div> ",
157     },
160 export default { tree, simple };