Skip to content

feat(realtime): add Web Push claim notification coordinator - #416

Open
gbolly122 wants to merge 1 commit into
Refract-Protocol:mainfrom
gbolly122:feat/299-web-push-claims
Open

gbolly122 wants to merge 1 commit into
Refract-Protocol:mainfrom
gbolly122:feat/299-web-push-claims

Conversation

@gbolly122

Copy link
Copy Markdown

Summary

Adds the Web Push claim-notification coordinator for issue #299: user-initiated
permission prompting, persisted opt-out handling, event-id claiming to suppress
duplicate notifications while a tab is open, and lock-screen-safe payload
building that strips wallet addresses, exact payout amounts, and other claim
detail.

Closes #299

Type of change

  • New feature
  • Tests / CI

What changed

  • src/lib/realtime/webPushClaims.ts
    • WebPushClaimNotificationCoordinator with explicit prompt reasons
      (post_purchase, notification_settings) and a hard refusal to prompt on
      page load.
    • Persisted opt-out respected before any permission request.
    • Event-id claim integration so the in-app realtime path and push path do not
      notify the same event twice.
    • buildLockScreenSafePushNotification strips sensitive fields and falls back
      to a generic title/body/deep link.
    • validateVapidPublicKey for the fail-fast NEXT_PUBLIC_* configuration
      pattern.
  • src/lib/realtime/webPushClaims.test.ts
    • prompt gating and opt-out behavior
    • event-id suppression
    • lock-screen payload privacy and VAPID validation

Validation

npx vitest run src/lib/realtime/webPushClaims.test.ts
Test Files  1 passed (1)
Tests       2 passed (2)

Checklist

  • I read CONTRIBUTING.md
  • Tests added for the change
  • Full local gate — blocked by pre-existing main issues: 16 tracked files
    are 0 bytes and src/app/cover/page.tsx is truncated, so tsc/vitest fail
    on main before this change.
  • No secrets or env values committed
  • Behaviour documented in code comments and this PR

Notes for reviewers

The backend push sender/VAPID provisioning remains the documented out-of-scope
dependency. Service-worker registration and UI wiring depend on the missing
layout/notification-shell files; this PR provides the coordinator and tests so
it can land independently of that restoration work.

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@gbolly122 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Web Push Notifications for Critical Claim Events When No Tab Is Open

1 participant