Ecommerce Delivery delivers notifications through two complementary channels: Firebase Cloud Messaging (FCM) for browser push notifications and a REST-backed in-app feed. When a user grants notification permission in the browser, the app registers a device token with the backend so the server can push notifications to that device even when the tab is not in focus. Users can also browse all past notifications from the dedicatedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/ecommerce-delivery-frontend/llms.txt
Use this file to discover all available pages before exploring further.
/notifications page, which uses infinite scroll to load them from the API.
Firebase Cloud Messaging (FCM)
Configuration
src/firebase/init.js initialises the Firebase compat SDK using environment variables for every sensitive value:
firebase instance and the messaging object so other modules can import them directly.
Background notifications
Background push notifications (received when the tab is not active or the browser is minimised) are handled by the service worker atpublic/firebase-messaging-sw.js. The service worker must be registered separately and kept in sync with the Firebase SDK version used in the app.
FCM token registration flow
Request notification permission
After login,
Notification.requestPermission() is called. The browser shows its native permission prompt to the user.Retrieve FCM token
If the user grants permission,
getToken(messaging, { vapidKey }) is called to retrieve the device-specific FCM token:The VAPID key used in
getToken() is currently hardcoded inside formSignIn.vue (value shown above). For production deployments it should be moved to an environment variable (e.g. process.env.VAPID_KEY) to avoid exposing it in source control.In-app notification feed
Route
/notifications renders pages/notifications/Notifications.vue, which is a thin wrapper that mounts ListNotifications:
Infinite scroll fetch
ListNotifications uses q-infinite-scroll to lazily load notifications in pages of 10. Each scroll event calls listNotifications(index, done), which increments the page counter and fires getNotifications():
notifications reactive array and pagination.pags is updated from the server’s response. Scrolling stops when pagination.pags === pagination.pag.
ItemNotification
Each notification in the list is rendered by theItemNotification component, which receives the notification object as the notify prop:
