Notifications & dialogs

Notifications and dialogs go through the SDK — never through the browser's alert/confirm/prompt, which would break the shell's consistency.

Pushing a notification #

import { useNotificationStore } from '@kubuno/sdk'

// pousser une notification dans le centre de notifications du host
useNotificationStore.getState().push({
  title:    'Note partagée',
  body:     `« ${note.title} » a été partagée avec vous`,
  moduleId: 'memo',
  icon:     'StickyNote',   // icône Lucide
  link:     '/memo',        // navigation au clic
})

The exact shape: { title, body, moduleId, icon?, link? }. Notifications persist for the duration of the session.

The notification matrix #

Declare your types so the user can choose email/push per activity:

// déclarer les types de notifications dans Réglages → Notifications
NotificationRegistry.register({
  moduleId: 'memo', title: 'Memo', order: 30,
  activities: [
    { id: 'note_shared',   label: 'Une note est partagée', emailDefault: true, pushDefault: true },
    { id: 'note_reminder', label: "Rappel d'une note",     pushDefault: true },
  ],
})

Dialogs: confirm & prompt #

import { useConfirm, prompt } from '@kubuno/sdk'

const { confirm } = useConfirm()

// au lieu de window.confirm(...)
if (await confirm({ title: 'Supprimer la note ?', danger: true })) {
  await deleteNote(id)
}

// au lieu de window.prompt(...)
const name = await prompt({ title: 'Nom de la note', defaultValue: note.title })
if (name !== null) rename(note.id, name)
UX rule

confirm() returns a Promise<boolean>, prompt() a Promise<string|null>. For context menus, use MenuDropdown from @ui.