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; } 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; } | { type: 'navigate-external'; link: Pick; } | { type: 'run-function'; button: Pick; }; 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; }