elk/composables/push-notifications/types.ts

27 lines
906 B
TypeScript
Raw Normal View History

2022-12-23 23:56:16 +01:00
import type { Emoji, PushSubscription as MastoPushSubscription, PushSubscriptionAlerts, SubscriptionPolicy } from 'masto'
import type { UserLogin } from '~/types'
export type SubscriptionResult = 'subscribed' | 'notification-denied' | 'not-supported' | 'invalid-vapid-key' | 'no-user'
export interface PushManagerSubscriptionInfo {
registration: ServiceWorkerRegistration
subscription: PushSubscription | null
}
2023-01-03 02:23:16 +01:00
export interface RequiredUserLogin extends Required<Pick<UserLogin, 'server' | 'token' | 'vapidKey'>> {
pushSubscription?: MastoPushSubscription
}
export interface CreatePushNotification {
alerts?: Partial<PushSubscriptionAlerts> | null
policy?: SubscriptionPolicy
}
export type PushNotificationRequest = Record<string, boolean>
export type PushNotificationPolicy = Record<string, SubscriptionPolicy>
2022-12-23 23:56:16 +01:00
export interface CustomEmojisInfo {
lastUpdate: number
emojis: Emoji[]
}