feat(notifications): add deterministic notification preference handling (#885) - #940
Draft
s6pa1rta3n-lab wants to merge 1 commit into
Draft
feat(notifications): add deterministic notification preference handling (#885)#940s6pa1rta3n-lab wants to merge 1 commit into
s6pa1rta3n-lab wants to merge 1 commit into
Conversation
|
@s6pa1rta3n-lab is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #885
Summary & Motivation
Users need predictable, robust, and deterministic control over settlement, market, wallet, and dispute notifications. This PR introduces an account-scoped notification preferences subsystem with explicit defaults, conflict resolution, offline reconciliation, and UI controls.
Acceptance Criteria Checklist
useNotificationPreferencesStorekeyed by normalized account ID (e.g. Stellar address or normalizedanonymous). Switching accounts immediately rebinds preferences and isolates custom settings without cross-contamination (app/state/notificationPreferences.ts,hooks/useNotificationPreferences.ts).DEFAULT_NOTIFICATION_PREFERENCESprovides explicit immutable defaults (intensity:important, default channels:inApp: true, categories: all high-signal enabled, quiet hours configured) withisDefaultstatus checking (lib/notification-preferences.ts,types/notification-preferences.ts).applyOfflineMutationandreconcilePreferencesprovide deterministic Last-Write-Wins (LWW) resolution and monotonic versioning with mutation deduplication tracking (lib/notification-preferences.ts,app/state/notificationPreferences.ts).lib/__tests__/notification-preferences.test.ts,app/state/__tests__/notificationPreferences.test.ts,hooks/__tests__/useNotificationPreferences.test.tsx).Implementation Details
types/notification-preferences.ts): Typed definitions for notification categories (settlement,market,wallet,dispute,payout,system,account), delivery channels (inApp,email,push), intensity profiles (important,balanced,everything), quiet hours, and mutation records.lib/notification-preferences.ts): Deterministic pure functions for normalization, cloning, validation, offline mutations, LWW reconciliation, and notification filtering (shouldDeliverNotification).app/state/notificationPreferences.ts): Account-scoped Zustand store usingpersistmiddleware, offline network listeners, and cross-tab storage synchronization.hooks/useNotificationPreferences.ts): React hook binding active wallet address to scoped notification preferences with ergonomic setters and reset capabilities.app/(dashboard)/settings/page.tsx): Dedicated Notifications tab with granular category and channel switches, intensity presets, active account indicators, and default reset actions.Security & Failure-Mode Considerations
importantpreset.Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC