+
+
Notification Settings
+
+ Choose which notification types you want to receive. These apply to the notification center for owners and admins.
+
+
+
+ {isLoadingNotificationSettings ? (
+
+ ) : (
+
+ {notificationCategories.map((cat) => (
+
+
+
{cat.label}
+
{cat.description}
+
+
+ {
+ const next = { ...notificationSettings, [cat.id]: checked === true }
+ setNotificationSettings(next)
+ setIsSavingNotificationSettings(true)
+ updateNotificationSettings(next)
+ .then(() => {
+ toast.success('Notification settings updated')
+ })
+ .catch((err) => {
+ toast.error(getAuthErrorMessage(err) || 'Failed to update settings')
+ setNotificationSettings(notificationSettings)
+ })
+ .finally(() => setIsSavingNotificationSettings(false))
+ }}
+ disabled={isSavingNotificationSettings}
+ />
+
+ {notificationSettings[cat.id] !== false ? 'On' : 'Off'}
+
+
+
+ ))}
+
+ )}
+
+ )}
+
{activeTab === 'audit' && (
diff --git a/lib/api/notification-settings.ts b/lib/api/notification-settings.ts
new file mode 100644
index 0000000..cfe1d2c
--- /dev/null
+++ b/lib/api/notification-settings.ts
@@ -0,0 +1,22 @@
+/**
+ * @file Notification settings API client
+ */
+
+import apiRequest from './client'
+
+export interface NotificationSettingsResponse {
+ settings: Record
+ categories: { id: string; label: string; description: string }[]
+}
+
+export async function getNotificationSettings(): Promise {
+ return apiRequest('/notification-settings')
+}
+
+export async function updateNotificationSettings(settings: Record): Promise {
+ return apiRequest('/notification-settings', {
+ method: 'PATCH',
+ body: JSON.stringify({ settings }),
+ headers: { 'Content-Type': 'application/json' },
+ })
+}