Merge branch 'INDA-330-pii-update' into 'main'
[ProtonMail-WebClient.git] / packages / sieve / fixtures / v2Vacation.ts
blob7ddcd3a8279e5ff9fb9facfa03ead14e29e8287e
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         Text: '/**\r\n * @type and\r\n * @comparator default\r\n */',
56         Type: 'Comment',
57     },
58     {
59         If: {
60             Tests: [
61                 {
62                     Headers: ['X-Attached'],
63                     Type: 'Exists',
64                 },
65             ],
66             Type: 'AllOf',
67         },
68         Then: [
69             {
70                 Message: '<div>Vacation test<br></div>',
71                 Args: {
72                     MIMEType: 'text/html',
73                 },
74                 Type: 'Vacation',
75             },
76         ],
77         Type: 'If',
78     },
80 const simple: SimpleObject = {
81     Operator: {
82         label: 'All',
83         value: FilterStatement.ALL,
84     },
85     Conditions: [
86         {
87             Values: [],
88             Type: {
89                 label: 'Attachments',
90                 value: ConditionType.ATTACHMENTS,
91             },
92             Comparator: {
93                 label: 'contains',
94                 value: ConditionComparator.CONTAINS,
95             },
96         },
97     ],
98     Actions: {
99         Mark: {
100             Read: false,
101             Starred: false,
102         },
103         FileInto: [],
104         Vacation: '<div>Vacation test<br></div>',
105     },
108 export default { tree, simple };