import type { APSBody, Notification, NotificationBody, NotificationHeaders } from "./notification.js"; /** * Empty interface on purpose to allow for TS * autocompletion to be extended by the user. * Must be exported to allow extending in the user's code. */ export interface NotificationCustomAppData { } type AlertField = string | { "loc-key": string; "loc-args"?: string[]; }; type LiveActivityNotificationBody = { /** * The UNIX timestamp that represents the date at which a Live Activity * becomes stale, or out of date. * * For more information, see [Displaying live data with Live Activities](https://developer.apple.com/documentation/ActivityKit/displaying-live-data-with-live-activities). */ staleDate?: number; /** * A number that the system uses to sort the * notifications from your app. * * The highest score gets featured in the notification summary. * See relevanceScore. * * If your remote notification updates a Live Activity, you can * set any `Double` value; for example, 25, 50, 75, or 100. */ relevanceScore?: number; /** * The UNIX timestamp that marks the time when you send the remote * notification that updates or ends a Live Activity. * * For more information, see `Updating and ending your Live Activity * with ActivityKit push notifications`. * * --- * * Implementation note: this is optional: if not provided, it will * fallback to `Date.now()`. This could be useful if you are sending * frequent updates and might not be able to ensure an order. * * Please also note that Push Notification console requires it * when sending a start event, so this library allows it for all * the kinds. */ timestamp?: number; /** * The updated or final content for a Live Activity. The content of * this dictionary must match the data you describe with your custom * [ActivityAttributes](https://developer.apple.com/documentation/ActivityKit/ActivityAttributes) implementation. * * For more information, see `Updating and ending your Live Activity * with ActivityKit push notifications`. * * --- * * Implementation note: */ contentState: Record; } & ({ /** * The string that describes whether you start, update, or end an * ongoing Live Activity with the remote push notification. * * To start the Live Activity, use `start`. * To update the Live Activity, use `update`. * To end the Live Activity, use `end`. * * For more information, see `Updating and ending your Live Activity * with ActivityKit push notifications`. */ event: "end"; /** * The UNIX timestamp that represents the date at which the system * ends a Live Activity and removes it from the Dynamic Island and * the Lock Screen. * * For more information, see `Updating and ending * your Live Activity with ActivityKit push notifications`. * * Default: 4 hours (system default). * * @see https://developer.apple.com/documentation/activitykit/starting-and-updating-live-activities-with-activitykit-push-notifications#End-the-Live-Activity-with-a-custom-dismissal-date */ dismissalDate?: number; /** * Alert will light up the device in case of critical notifications and play * a sound, if provided. * * Title and body are shown as a traditional alert notification on the devices * that do not support Live Activities. Both are mandatory for a notification * to run. */ alert?: { title: AlertField; body: AlertField; /** * The exact filename of the sound file to play when the * notification is received. * * Please note that, for Live Activities, you cannot * specify other details (just like classic Alert notifications). * * If not specified, the system will play the default sound * (like you specified "default" as value). */ sound?: string; }; } | { /** * The string that describes whether you start, update, or end an * ongoing Live Activity with the remote push notification. * * To start the Live Activity, use `start`. * To update the Live Activity, use `update`. * To end the Live Activity, use `end`. * * For more information, see `Updating and ending your Live Activity * with ActivityKit push notifications`. */ event: "update"; /** * Alert will light up the device in case of critical notifications and play * a sound, if provided. * * Title and body are shown as a traditional alert notification on the devices * that do not support Live Activities. Both are mandatory for a notification * to run. */ alert?: { title: AlertField; body: AlertField; /** * The exact filename of the sound file to play when the * notification is received. * * Please note that, for Live Activities, you cannot * specify other details (just like classic Alert notifications). * * If not specified, the system will play the default sound * (like you specified "default" as value). */ sound?: string; }; } | ({ /** * The string that describes whether you start, update, or end an * ongoing Live Activity with the remote push notification. * * To start the Live Activity, use `start`. * To update the Live Activity, use `update`. * To end the Live Activity, use `end`. * * For more information, see `Updating and ending your Live Activity * with ActivityKit push notifications`. */ event: "start"; /** * A string you use when you start a Live Activity with a remote * push notification. It must match the name of the structure that * describes the dynamic data that appears in a Live Activity. * * For more information, see `Updating and ending your Live Activity * with ActivityKit push notifications`. */ attributesType: string; /** * The dictionary that contains data you pass to a Live Activity * that you start with a remote push notification. * * For more information, see `Updating and ending your Live Activity * with ActivityKit push notifications`. */ attributes: Record; /** * Alert will light up the device in case of critical notifications and play * a sound, if provided. * * Title and body are shown as a traditional alert notification on the devices * that do not support Live Activities. Both are mandatory for a notification * to run. */ alert: { title: AlertField; body: AlertField; /** * The exact filename of the sound file to play when the * notification is received. * * Please note that, for Live Activities, you cannot * specify other details (just like classic Alert notifications). * * If not specified, the system will play the default sound * (like you specified "default" as value). */ sound?: string; }; } & ({ /** * When provided, it will make your app to generate a new push token * for the Live Activity after starting the new live activity. * * @see https://developer.apple.com/documentation/ActivityKit/starting-and-updating-live-activities-with-activitykit-push-notifications#Construct-the-payload-that-starts-a-Live-Activity * * --- * * This means the part containing the async task for `pushToStartToken` * gets awakened in order to deliver the token. * * This attributes works fine for normal live activities but not * for broadcast live activities. Starting an activity with this attribute * doesn't link it to the broadcast activity (so, it cannot be updated). * * Cannot be used with input-push-channel: logs report * "Incoming message contains two forms of push input" and refuses to parse * the message. */ inputPushToken?: 1; inputPushChannel?: never; } | { /** * Provide a broadcast channel identifier to start the live activity * and listen for updates on that channel. * * @see https://developer.apple.com/documentation/usernotifications/sending-channel-management-requests-to-apns * @see https://developer.apple.com/documentation/ActivityKit/starting-and-updating-live-activities-with-activitykit-push-notifications#Construct-the-payload-that-starts-a-Live-Activity * * --- * * Cannot be used with input-push-token: logs report * "Incoming message contains two forms of push input" and refuses to parse * the message. */ inputPushChannel?: string; inputPushToken?: never; }))); type NotificationData = NotificationHeaders & NotificationBody; type NotificationObject = Notification>; /** * Creates a notification about an ongoing Live Activity * * @param appBundleId The topic of the notification. It will be suffixed, if needed, with `.push-type.liveactivity`. * @param data * @returns */ export declare function LiveActivityNotification(appBundleId: string, data: NotificationData): NotificationObject; export {};