wacrm/src/lib
Arnas Donauskas 054c9e4e47
feat(team): member presence (online / away / offline) on the roster
Adds a live presence layer so the Settings → Team members roster and the
inbox Assign dropdown show who is actively using the dashboard, idle, or
gone. Implements #269.

How it works
- New `member_presence` table + `touch_presence` SECURITY DEFINER RPC
  (migration 024). Account-scoped SELECT RLS mirrors the read-only
  roster; the RPC derives account_id server-side, never client-supplied.
- The active client heartbeats 'online'/'away' every ~30s; 'offline' is
  derived by viewers from staleness, so a closed tab resolves to offline
  without an unreliable unload write.
- Pure, unit-tested derivation/formatting in src/lib/presence.ts.
- `usePresence` reads the table, subscribes to Realtime (subscribe-then-
  merge so events landing mid-fetch aren't clobbered), and re-derives
  offline on a 15s tick.
- Roster: avatar badge + tooltip + "N online · N away · N offline"
  summary, with an aria-label so AT/keyboard users get presence too.
  Inbox Assign dropdown: matching dot before each teammate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 14:37:29 +03:00
..
auth feat(inbox): graduate chat media send to GA (remove beta flag) 2026-06-18 11:38:54 +03:00
automations fix(automations): persist default match_type for Keyword Match triggers 2026-06-22 10:20:38 +03:00
contacts refactor(contacts): improve code readability and formatting in import modal and CSV parsing 2026-06-16 12:59:03 +05:30
dashboard test: foundational Vitest suite for security + critical pure logic 2026-05-18 16:06:02 +03:00
flows feat(webhook,engines): account-scoped routing 2026-05-31 18:45:48 +03:00
storage fix(inbox): harden media send — GC orphans, per-type caps, voice cap 2026-06-18 10:28:19 +03:00
supabase fix: make Supabase browser client a singleton 2026-04-16 19:39:24 +03:00
whatsapp feat(templates): upload image for template headers; fix image-URL submit (#230) 2026-06-18 14:00:54 +03:00
broadcast-status.test.ts feat(theme): sweep remaining violet-* → primary across all surfaces 2026-05-22 17:00:32 +03:00
broadcast-status.ts fix(theme): keep status-badge token contract green (CI test) 2026-06-17 13:08:32 +03:00
currency.test.ts fix(currency): make formatCurrency total + add unit tests 2026-06-08 15:10:56 +03:00
currency.ts fix(currency): make formatCurrency total + add unit tests 2026-06-08 15:10:56 +03:00
presence.test.ts feat(team): member presence (online / away / offline) on the roster 2026-06-22 14:37:29 +03:00
presence.ts feat(team): member presence (online / away / offline) on the roster 2026-06-22 14:37:29 +03:00
rate-limit.test.ts test: foundational Vitest suite for security + critical pure logic 2026-05-18 16:06:02 +03:00
rate-limit.ts refactor(inbox): record voice notes client-side, drop server ffmpeg 2026-06-18 11:27:12 +03:00
template-status.ts fix(theme): keep status-badge token contract green (CI test) 2026-06-17 13:08:32 +03:00
themes.ts feat(theme): add light/dark mode toggle (#243) 2026-06-16 17:29:46 +03:00
utils.ts feat: initial commit 2026-04-16 17:53:27 +03:00