blob: b3a3435dd4fadf7bdf38311a050a894ca6b358fc (
plain)
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
|
import { ExternalLinkProps } from '../../renderer/components/ExternalLink';
import { InternalLinkProps } from '../../renderer/components/InternalLink';
import { ButtonProps } from '../../renderer/lib/components';
import { RoutePath } from '../../shared/routes';
import { Url } from '../constants';
export type SystemNotificationAction =
| {
type: 'navigate-internal';
link: {
to: RoutePath;
text?: string;
};
}
| {
type: 'navigate-external';
link: {
to: Url;
text?: string;
withAuth?: boolean;
};
};
export interface InAppNotificationTroubleshootInfo {
details: string;
steps: string[];
buttons?: Array<InAppNotificationTroubleshootButton>;
}
export interface InAppNotificationTroubleshootButton {
label: string;
action: () => void;
variant?: 'primary' | 'success' | 'destructive';
}
export type InAppNotificationAction =
| {
type: 'troubleshoot-dialog';
troubleshoot: InAppNotificationTroubleshootInfo;
}
| {
type: 'close';
close: () => void;
}
| {
type: 'navigate-internal';
link: Pick<InternalLinkProps, 'to' | 'onClick' | 'aria-label'>;
}
| {
type: 'navigate-external';
link: Pick<ExternalLinkProps, 'to' | 'onClick' | 'aria-label' | 'withAuth'>;
}
| {
type: 'run-function';
button: Pick<ButtonProps, 'onClick' | 'aria-label'>;
};
export type InAppNotificationIndicatorType = 'success' | 'warning' | 'error';
export enum SystemNotificationSeverityType {
info = 0,
low,
medium,
high,
}
export enum SystemNotificationCategory {
tunnelState,
expiry,
newVersion,
inconsistentVersion,
}
interface NotificationProvider {
mayDisplay(): boolean;
}
export interface SystemNotification {
message: string;
severity: SystemNotificationSeverityType;
category: SystemNotificationCategory;
throttle?: boolean;
presentOnce?: { value: boolean; name: string };
suppressInDevelopment?: boolean;
action?: SystemNotificationAction;
}
export interface InAppNotification {
indicator?: InAppNotificationIndicatorType;
action?: InAppNotificationAction;
title: string;
subtitle?: string | InAppNotificationSubtitle[];
}
export interface InAppNotificationSubtitle {
content: string;
action?: InAppNotificationAction;
}
export interface SystemNotificationProvider extends NotificationProvider {
getSystemNotification(): SystemNotification | undefined;
}
export interface InAppNotificationProvider extends NotificationProvider {
getInAppNotification(): InAppNotification | undefined;
}
|