Checks if order tracking live notifications are supported on the current device.
This method verifies:
Platform Support: Returns false on Android and iOS < 16.2.
Example:
const modules = await Eitri.modules()
const liveNotificationIsSupported = modules.orderStatusLiveNotification?.isSupported
if (!liveNotificationIsSupported) return
const supported = await liveNotificationIsSupported()
if (!supported) {
console.log("Live notifications not available on this device")
// Fallback to push notifications or in-app updates
}
Promise resolving to true if live notifications are available, false otherwise.
Starts a new order tracking live notification for the specified order.
Creates a live notification (implemented as iOS Live Activity) that displays on the user's lock screen and Dynamic Island, showing real-time order status updates.
Platform Support: iOS 16.2+ only. Throws error on other platforms.
Important:
orderId can be activeorderId, returns existing activity infoExample:
const modules = await Eitri.modules()
const liveNotificationStart = modules.orderStatusLiveNotification?.start
if (!liveNotificationStart) return
try {
const result = await liveNotificationStart({
orderId: "12345",
orderIdDisplayText: "Order #ORD-12345",
storeName: "Test Store",
status: {
displayName: "Confirmed",
icon: "checkmark.circle",
progress: 0.25
},
message: "Your order has been confirmed",
estimatedTime: "30 min"
})
console.log("Live notification started:", result.activityId)
} catch (error) {
console.error("Failed to start live notification:", error)
}
Configuration for the live notification
Promise resolving to activity information including activityId and orderId
Updates an existing order tracking live notification with new status information.
Updates the live notification on the user's lock screen and Dynamic Island with new order status, progress, message, and estimated time.
Platform Support: iOS 16.2+ only. Throws error on other platforms.
Update Methods:
Live notifications can be updated in two ways:
When a live notification is started, iOS registers a push token with APNs. Eitri server can use this token to send remote updates, allowing you to update the live notification even when the app is not running.
Common Update Scenarios:
Example (update to preparing):
const modules = await Eitri.modules()
const liveNotificationUpdate = modules.orderStatusLiveNotification?.update
if (!liveNotificationUpdate) return
try {
await liveNotificationUpdate({
orderId: "12345",
status: {
displayName: "Preparing",
icon: "flame",
progress: 0.5
},
message: "Your order is being prepared",
estimatedTime: "25 min"
})
} catch (error) {
console.error("Failed to update live notification:", error)
}
Example (update to out for delivery):
const modules = await Eitri.modules()
const liveNotificationUpdate = modules.orderStatusLiveNotification?.update
if (!liveNotificationUpdate) return
await liveNotificationUpdate({
orderId: "12345",
status: {
displayName: "Out for delivery",
icon: "truck.box",
progress: 0.75
},
message: "Your order is on it's way",
estimatedTime: "10 min"
})
Example (update to delivered):
const modules = await Eitri.modules()
const liveNotificationUpdate = modules.orderStatusLiveNotification?.update
if (!liveNotificationUpdate) return
await liveNotificationUpdate({
orderId: "12345",
status: {
displayName: "Delivered",
icon: "checkmark.circle.fill",
progress: 1.0
},
message: "Your order has been delivered",
})
Updated order status information
Promise that resolves when the update is complete
Ends a specific order tracking live notification.
Dismisses the live notification from the user's lock screen and Dynamic Island. The notification is removed immediately.
Platform Support: iOS 16.2+ only. Throws error on other platforms.
Example:
const modules = await Eitri.modules()
const liveNotificationEnd = modules.orderStatusLiveNotification?.end
if (!liveNotificationEnd) return
try {
await liveNotificationEnd({
orderId: "12345"
})
console.log("Live notification ended successfully")
} catch (error) {
console.error("Failed to end live notification:", error)
}
Object containing the orderId to end
Promise that resolves when the live notification is dismissed
Ends all active order tracking live notifications for the current user.
Dismisses all live notifications associated with the app, regardless of order ID. Useful for cleanup operations like user logout.
Platform Support: iOS 16.2+ only. No-op on other platforms.
When to call:
Example:
// Clear all live notifications on logout
async function handleLogout() {
const modules = await Eitri.modules()
const liveNotificationEndAll = modules.orderStatusLiveNotification?.endAll
if (liveNotificationEndAll) {
await liveNotificationEndAll()
}
// Continue with logout flow...
}
Promise that resolves when all live notifications are dismissed
Retrieves information about all currently active order tracking live notifications.
Returns a list of all live notifications currently displayed for the user, including their order IDs and activity IDs.
Platform Support: iOS 16.2+ only. Returns empty array on other platforms.
Use cases:
Example:
const modules = await Eitri.modules()
const liveNotificationGetActiveNotifications = modules.orderStatusLiveNotification?.getActiveNotifications
if (!liveNotificationGetActiveNotifications) return
const activities = await liveNotificationGetActiveNotifications()
console.log(`${activities.length} active order notifications`)
activities.forEach(activity => {
console.log(`Order ${activity.orderId} - Activity ${activity.activityId}`)
})
// Check if specific order is being tracked
const isTracking = activities.some(a => a.orderId === "12345")
Promise resolving to array of active live notification info. Empty array if none active.
Functions that allow an Eitri-App to create and manage order tracking live notifications.
Live notifications display real-time order status updates on the lock screen and Dynamic Island, providing users with at-a-glance information about their order progress without opening the app.
Platform Support:
Important Notes:
orderIdcan be active at a time