Developer Docs

Notifications & Alerts โ€” Integration Guide

Overview

The notification system provides real-time alerts and user-configurable preferences for murchase updates, workroom actions, promotions, and security events. It consists of two main features:

  1. NotificationCenter โ€” A bell icon dropdown in the nav bar with live feed, badge count, and mark-all-read
  2. Notification Preferences โ€” Toggle controls in Account Settings for Email, SMS, and Push per category

Quick Start (Frontend)

For Users

View Notifications: Click the bell icon (๐Ÿ””) in the top navigation bar to open the dropdown feed.

Manage Preferences: Go to /settings โ†’ Notifications section to configure which notifications you receive and how (Email, SMS, Push).


State Management

`notificationStore.svelte.ts`

A Svelte 5 reactive class using $state and $derived runes.

Notification Item Shape:

interface NotificationItem {
	id: string;
	type: 'MURCHASE_STATUS' | 'WORKROOM_ACTION' | 'PROMOTION' | 'SECURITY';
	title: string;
	description: string;
	timestamp: string;
	read: boolean;
	icon?: string;
}

Preferences Shape:

type Channel = 'email' | 'sms' | 'push';
type Category = 'murchases' | 'workroom' | 'promotions' | 'security';

interface PreferenceMap {
	[category: Category]: {
		[channel: Channel]: boolean;
	};
}

GraphQL Operations

Queries

query GetNotificationPreferences {
	notificationPreferences {
		category
		email
		sms
		push
	}
}

Mutations

mutation UpdateNotificationPreferences($input: UpdatePreferencesInput!) {
	updatePreferences(input: $input) {
		category
		email
		sms
		push
	}
}

mutation RegisterPushToken($input: RegisterPushTokenInput!) {
	registerPushToken(input: $input) {
		success
	}
}

Backend Integration Status (Alerts Subgraph)

Feature Status Notes
Preference Storage โœ… Working PostgreSQL schema updated
Email Delivery (Resend) โœ… Working OTP and Murchase confirmations
SMS Delivery โฌœ TODO Twilio integration planned
Shared Templates โœ… Working Handlebars templates for common murchase events
WebSocket subscriptions โฌœ TODO MURCHASE_STATUS_CHANGED, WORKROOM_ACTION_REQUIRED
Push notification registration โœ… Working In-house APNs/FCM dispatch via Mobile Push Infrastructure
Vertical-specific templates โฌœ TODO Restaurant tracker vs Tour itinerary