feat(notifications): implement Web Push notifications for payment confirmations - #612
Closed
frankrichard99 wants to merge 3 commits into
Closed
frankrichard99 wants to merge 3 commits into
frankrichard99 wants to merge 3 commits into
Conversation
- Add /settings/api-keys page with list, create, and revoke flows - Add ApiKey type and API methods (list, create, revoke) to lib/api.ts - Add Settings link to wallet sidebar - Show full key once after creation with copy-to-clipboard - Mask key values after initial creation - Confirm before revoking with destructive action dialog - Handle loading, empty, and error states consistently Closes kellymusk#498
- Add /settings page with editable merchant name and personal name - Add change-email flow with verification email before updating - Add danger zone with delete account confirmation dialog - Update session provider to expose refreshMe and cached me data - Update wallet page to read merchant name from session context so changes reflect immediately without a page reload - Add Profile nav link to settings layout alongside API Keys Closes kellymusk#497
…firmations - Add usePushNotifications hook for SW registration, permission handling, subscription management, and iOS graceful fallback - Add PushNotificationToggle component with backend sync via custom events - Add push subscription API methods (subscribe, unsubscribe, status) - Add Notifications section to /settings page with opt-in toggle - Replace stale generated sw.js with clean custom service worker that imports the existing push-handler.js for push events and notification clicks - Register service worker at root layout for background delivery - Handle unsupported browsers, denied permissions, and loading states Closes kellymusk#496
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.
Summary
Implements Web Push notification support so merchants receive instant alerts when payments are confirmed.
What's included
/settingspage with clear states (on/off/unsupported/denied)Notification.permission, shows guidance when denied/push/subscribe,/push/unsubscribe,/push/status)Files changed
lib/api.tsPushSubscriptionRequest/Response/Statustypes andregisterPushSubscription,unregisterPushSubscription,getPushSubscriptionStatusmethodshooks/use-push-notifications.tscomponents/push-notification-toggle.tsxapp/(app)/settings/page.tsxPushNotificationTogglepublic/sw.jspush-handler.jsapp/layout.tsxBackend contract
The backend should:
POST /push/subscribewith{ endpoint, p256dh, auth }→ store subscriptionDELETE /push/unsubscribe→ remove subscriptionGET /push/statuswith{ enabled: boolean }confirmedwebhook, call the push service with payload:{ "title": "Payment received", "body": "You received 500 XLM from a customer", "url": "/transactions", "tag": "aframp-payment" } ## Closes #496