@marktiderman/genesis-notifications
0.4.7Primitive · CollaborationOne notifier for Genesis apps: a domain (chat, forms, sites, support) says who and what; this decides how and when. defineNotifications registers types (category, channels, critical, transactional, device action categories, Android channels); notify() queues them through a security-definer SQL function; the in-app feed is also the outbox; one runner (claim with SKIP LOCKED, retries with jittered backoff, deferrals) sends Expo push (batches of 100, receipts, dead tokens pruned, private previews) and Resend email (rendered once for byte-identical retries, tenant sender identities, RFC 8058 one-click unsubscribe, bounce and complaint suppression); preferences by category and channel with tenant defaults and quiet hours across daylight saving; secret links built at send time; erasure. Hooks for React and React Native, a web bell, feed, preferences matrix and admin views on genesis-ui, a native feed on genesis-ui-native. Part of the Genesis framework.
One notifier for every part of a Genesis app. A domain package (chat, forms, sites, support) decides **who** is told and **what**: the candidates, its own mutes and mentions, who may see what. The notifier decides **how and when**:
- the channel: the in-app feed, Expo push, email; - quiet hours, read in the person's time zone and right across daylight saving; - preferences by category and channel, with tenant defaults, and `critical` types always on; - delay-then-skip-if-read for email; - dedupe, retries, delivery receipts, and pruning dead push tokens.
pnpm add @marktiderman/genesis-notificationsOther exports (13)
assertNoSecrets · CHANNELS · defineNotifications · DELIVERY_STATUSES · GENESIS_TEST_CATEGORY · GENESIS_TEST_TYPE · IOS_ID_PATTERN · KEY_PATTERN · MAX_EMAIL_DELAY_SECONDS · MESSAGE_ACTIONS · NotificationRegistryError · recipientsToJson · SecretInDataError
And 21 types.
Other exports (13)
assertNoSecrets · CHANNELS · defineNotifications · DELIVERY_STATUSES · GENESIS_TEST_CATEGORY · GENESIS_TEST_TYPE · IOS_ID_PATTERN · KEY_PATTERN · MAX_EMAIL_DELAY_SECONDS · MESSAGE_ACTIONS · NotificationRegistryError · recipientsToJson · SecretInDataError
And 21 types.
Other exports (7)
createRunner · DEFAULT_BATCH_SIZE · DEFAULT_MAX_ATTEMPTS · DEFAULT_MAX_DEFERRALS · defaultBackoff · failureOf · jobOutcome
And 10 types.
Other exports (46)
cancelNotification · canonicalJson · checkSenderDomain · createInboundEmailHandler · createNotificationRunner · createNotificationsHandler · createRateLimiter · createUnsubscribeToken · defaultEmailTemplate · displayName · emailEventOf · emailHash · escapeHtml · EXPO_RECEIPTS_BATCH · EXPO_RECEIPTS_URL · EXPO_SEND_BATCH · EXPO_SEND_URL · expoErrorCode · expoPushProvider · headerSafe · inboundEmailOf · isReservedDomain · isRetryableStatus · isSafeAddress · NotificationStoreError · notify · parseAddress · refusedOutright · REQUEST_TIMEOUT_MS · RESEND_API · RESEND_DEFAULT_PER_SECOND · RESEND_RECEIVING_API · resendProvider · resolveSecretLink · retryAfterSeconds · SECRET_LINK_PLACEHOLDER · SecretLinkError · SENDER_OWNERSHIP_HOST · senderOwnershipRecord · SendError · supabaseNotificationStore · syncNotificationTypes · unsubscribeHeaders · verifyResendWebhook · verifyUnsubscribeToken · WEBHOOK_TOLERANCE_SECONDS
And 37 types.
Components (1)
- BrandLayoutBeta
The brand frame every notification email shares.
Other exports (4)
brandedDefaultTemplate · EmailButton · EmailText · reactEmailTemplate
Other exports (6)
choicesOf · FEED_COLUMNS · NOTIFICATIONS_MIGRATIONS · NOTIFICATIONS_PACKAGE · notificationsClient · NotificationsClientError
And 5 types.
Components (1)
- NotificationsProviderBeta
Provides the notifier to the hooks.
Hooks (4)
- useNotifications
The person's feed.
- useNotificationsContext
The provider's client, registry and user. Throws outside one.
- usePreferences
The person's preferences by category and channel. A tenant's default isn't shown here (the server applies it); what shows for a channel the person never chose is the type's default.
- useUnreadCount
The unread count (0 while signed out).
Other exports (3)
notificationKeys · notificationsClient · preferenceRows
And 5 types.
Components (2)
- NotificationBellBeta
The bell. Opening it marks what it shows as seen; opening a row marks it read.
- NotificationFeedBeta
The whole feed, in a card: mark read on open, archive, mark all read.
Other exports (6)
CHANNEL_LABELS · DeliveryLog · NotificationRowView · PreferencesMatrix · SendTestNotification · SuppressionList
And 1 types.
Components (1)
- NotificationsFeedBeta
The feed on ui-native's `NotificationsPage`: pull to refresh, unread dots, a tap marks read and opens. Realtime refetches it (NotificationsProvider).
Hooks (1)
- useNotificationsFeedHeader
The feed's `Stack.Screen` options, with "Mark all read" while anything is unread. Pass the feed's `limit` if you changed it, so both read one query.
Other exports (8)
CHANNEL_LABELS · ChannelPreferences · NotificationPreferences · NOTIFICATIONS_FEED_LIMIT · notificationsPushBackend · NotificationsPushBackendError · notificationsPushPreferences · pushOptionsFrom
And 2 types.
Other exports (1)
notificationsBlock