1 import downloadFile from '@proton/shared/lib/helpers/downloadFile';
3 import { ALL_EVENTS_DEFAULT } from '../Pass/helpers';
5 export interface Event {
10 export const getConnectionEvents = (items: any[]): Event[] => {
11 const defaultEvent: Event = {
12 EventType: ALL_EVENTS_DEFAULT,
13 EventTypeName: ALL_EVENTS_DEFAULT,
15 return [defaultEvent, ...items];
18 export const getVPNEventColor = (event: string) => {
21 return 'color-danger';
23 return 'color-success';
29 export const getVPNEventIcon = (event: string) => {
32 return 'lock-open-filled-2';
35 case 'session_roaming':
36 return 'arrows-swap-right';
38 return 'lock-pen-filled';
42 export const downloadVPNEvents = async (response: Response) => {
43 const contentDisposition = response.headers.get('content-disposition');
44 if (!contentDisposition) {
48 const match = contentDisposition.match(/attachment; filename=(.*)/);
53 const blob = await response.blob();
54 downloadFile(blob, match[1]);