@poolse/react 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,149 +1,170 @@
1
- # Changelog
2
-
3
- All notable changes to `@poolse/react` are documented here. Format follows
4
- [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
- [semver](https://semver.org).
6
-
7
- ## [2.0.0] — 2026-06-03
8
-
9
- Lockstep release with `@poolse/sdk@2.0.0` and `@poolse/react-ui@2.0.0`.
10
-
11
- ### Breaking
12
-
13
- - **`useUser(externalId)`** — was `useUser(userId)`. The hook now
14
- consumes the tenant's own user id. Pass the value from
15
- `message.sender_external_id`, `membership.external_id`, or any
16
- other external_id-shaped field on the wire.
17
- - **`useTyping(conversationId).typing`** now returns `Set<externalId>`
18
- (was `Set<userId>`). Same for `usePresence(conversationId).online`.
19
- - **`useMembers(conversationId).removeMember(externalId)`** — was
20
- `removeMember(userId)`. The hook translates external_id → user_id
21
- internally; the DELETE endpoint still takes user_id but you don't
22
- see it.
23
-
24
- ### Migration
25
-
26
- See `MIGRATING.md` at the repo root.
27
-
28
- ## [1.1.0] — 2026-06-02
29
-
30
- Lockstep release with `@poolse/sdk@1.1.0` and `@poolse/react-ui@1.1.0`.
31
- No API changes in `@poolse/react` itself — version bumped to keep the
32
- three packages in sync, so customers can pin one version across the
33
- whole client surface.
34
-
35
- ### Changed
36
-
37
- - README rewritten with a full per-hook reference: signatures, return
38
- shapes, the realtime channels each hook subscribes to, the optimistic
39
- send + thread routing strategy in `useMessages`, the buffered-reads
40
- race fix in `useMembers`, the cache + dedup semantics in `useUser`,
41
- and the synchronous-snapshot rollback pattern used by edits and
42
- optimistic removes.
43
- - Repo-wide prettier formatting fixes (whitespace only).
44
-
45
- ## [1.0.0-beta.0] — 2026-06-01
46
-
47
- First beta of the stable API. Promotes the full 0.2.x hook surface
48
- (useMessages with reply_count routing, useThread with full-thread
49
- fetch, useMembers with buffered read-receipt events,
50
- useConversations with unreadCounts + markConversationRead) to a
51
- stable namespace. No breaking changes relative to `0.2.0-alpha.7`
52
- — version bump + removed verbose diagnostic logs.
53
-
54
- ## [0.2.0] — 2026-06-01
55
-
56
- ### Fixed
57
-
58
- - Realtime read receipts now actually fire. The server-side broadcast
59
- call in `Messaging.do_mark_read` was missing — the alpha.2 commit
60
- added the channel handler and the SDK subscription but the broadcast
61
- itself never made it into the commit, so no `member:read` event was
62
- ever sent. Fixed in the matching server release; `useMembers` also
63
- logs received events as `[poolse] member:read received` for easy
64
- observability.
65
-
66
- ### Changed — thread replies routed to reply_count only
67
-
68
- - `useMessages` no longer adds incoming thread replies to the main
69
- feed — replies belong to the side-pane that `useThread` populates.
70
- Realtime `message:new` with `thread_root_id` set now bumps the
71
- root's `reply_count` and skips the upsert. Matches the new server
72
- behavior (`WHERE thread_root_id IS NULL` on `list_messages`), so
73
- refresh and realtime stay consistent.
74
- - `useThread` default page size raised from 50 → 500 so a typical
75
- thread loads in one round-trip. `loadMore` remains as an escape
76
- hatch.
77
- - `useMembers` now buffers `member:read` events that fire before the
78
- initial fetch lands, then replays them once members are loaded.
79
- Fixes the realtime read-receipt race where reads arriving in the
80
- subscribe → fetch-response window were silently dropped.
81
-
82
- ### Added
83
-
84
- - `useMessages` now maintains `Message.reply_count` live — increments
85
- on inbound thread reply, decrements on reply soft-delete. No server
86
- round-trip; the thread pill in `<MessageRow>` updates immediately.
87
-
88
- ### Fixed
89
-
90
- - `useMembers` catch path now `console.error`s the underlying error
91
- with a `[poolse]` prefix so silent failures are debuggable from
92
- DevTools.
93
-
94
- ### Added (continued)
95
-
96
- - `useMessages.edit(messageId, body)` — optimistic edit with rollback
97
- on server error. Server enforces sender-only authorization.
98
- - `useMessages.delete(messageId)` — optimistic soft-delete (sets
99
- `deleted_at` + null body locally, rolls back on error).
100
- - `useMessages.markReadUpTo(messageId)` — wraps
101
- `chat.conversations.one(id).messages.markRead`; advances the
102
- caller's read cursor and triggers server-side read-receipt
103
- broadcasts to other members.
104
- - `useConversations` now exposes `unreadCounts: Record<convId, number>`
105
- plus `markConversationRead(convId)` for sidebar-badge UIs.
106
- - `useThread.edit(messageId, body)` / `useThread.delete(messageId)`
107
- for inline reply editing inside `<ThreadView>`.
108
-
109
- ### Changed
110
-
111
- - `useMembers(conversationId)` now treats an empty string id as
112
- "skip fetch" (returns `{ members: [], loading: false }`) so
113
- callers can conditionally enable member loading without wrapping
114
- in a `enabled ?` guard.
115
- - `useMembers` subscribes to the new `member:read` realtime event
116
- and advances the matching membership's `last_read_message_id` /
117
- `last_read_at` in place. The sender's check-double glyph now
118
- flips in real time without a refetch.
119
- - Provider auto-resolves the SDK's new default `apiUrl` when none
120
- is passed in config.
121
-
122
- ## [0.1.1] — 2026-06-01
123
-
124
- ### Fixed
125
-
126
- - `useMessages.send()` now stamps the optimistic temp message's
127
- `sender_id` with the current user's id (via `useMe` internally).
128
- Without this, self-sent messages briefly rendered on the "other"
129
- side of the chat until the realtime echo replaced them.
130
-
131
- ## [0.1.0] — 2026-06-01
132
-
133
- First publishable release.
134
-
135
- ### Added
136
-
137
- - `<PoolseProvider>` — mount-once SDK instance with ref-stable callbacks
138
- (safe to pass `config={{getToken: () => ...}}` inline on every render).
139
- - `usePoolse()` — raw `Poolse` instance escape hatch.
140
- - Realtime hooks: `useMe`, `useConversations`, `useConversation`,
141
- `useMembers`, `useMessages`, `useThread`, `useReactions`, `useTyping`,
142
- `usePresence`, `useRealtimeStatus`.
143
- - Attachments: `useAttachmentUpload`, `useAttachmentUrl`.
144
- - Real-time conversation list — `useConversations` subscribes to the
145
- user's `user:<id>` channel and prepends on `conversation:created`
146
- push (no manual refetch needed).
147
- - Optimistic message send with id-based dedup: `useMessages.send()`
148
- inserts under the same id the server will assign, so realtime echo
149
- upserts in place.
1
+ # Changelog
2
+
3
+ All notable changes to `@poolse/react` are documented here. Format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
+ [semver](https://semver.org).
6
+
7
+ ## [2.13.0] — 2026-08-23
8
+
9
+ ### Fixed
10
+
11
+ - **Video calls now open with the camera on.** `useCallRoom` pinned its
12
+ options to the first render, but a call screen mounts long before a
13
+ call exists — so the room was always built from options captured when
14
+ nothing was ringing, i.e. audio. Cameras never opened on a video call
15
+ and the toggle looked broken.
16
+
17
+ ### Added
18
+
19
+ - **`useCallRoom().alone`** — everyone else has left and is not coming
20
+ back. Wire it to your hang-up path; see `@poolse/sdk`'s
21
+ `CallRoom.onAlone` for the guards that keep it from firing on an
22
+ unanswered outbound call.
23
+ - **`useCallRoom().switchCamera` / `.facingMode`** — front/rear camera.
24
+ - **`useCallRoom`** options `facing` and `aloneGraceMs`.
25
+ - **`useVoiceRoom().alone`** — the same signal for the peer-to-peer mesh
26
+ fallback, so both transports end an abandoned call.
27
+
28
+ ## [2.0.0] — 2026-06-03
29
+
30
+ Lockstep release with `@poolse/sdk@2.0.0` and `@poolse/react-ui@2.0.0`.
31
+
32
+ ### Breaking
33
+
34
+ - **`useUser(externalId)`** — was `useUser(userId)`. The hook now
35
+ consumes the tenant's own user id. Pass the value from
36
+ `message.sender_external_id`, `membership.external_id`, or any
37
+ other external_id-shaped field on the wire.
38
+ - **`useTyping(conversationId).typing`** now returns `Set<externalId>`
39
+ (was `Set<userId>`). Same for `usePresence(conversationId).online`.
40
+ - **`useMembers(conversationId).removeMember(externalId)`** — was
41
+ `removeMember(userId)`. The hook translates external_id → user_id
42
+ internally; the DELETE endpoint still takes user_id but you don't
43
+ see it.
44
+
45
+ ### Migration
46
+
47
+ See `MIGRATING.md` at the repo root.
48
+
49
+ ## [1.1.0] — 2026-06-02
50
+
51
+ Lockstep release with `@poolse/sdk@1.1.0` and `@poolse/react-ui@1.1.0`.
52
+ No API changes in `@poolse/react` itself — version bumped to keep the
53
+ three packages in sync, so customers can pin one version across the
54
+ whole client surface.
55
+
56
+ ### Changed
57
+
58
+ - README rewritten with a full per-hook reference: signatures, return
59
+ shapes, the realtime channels each hook subscribes to, the optimistic
60
+ send + thread routing strategy in `useMessages`, the buffered-reads
61
+ race fix in `useMembers`, the cache + dedup semantics in `useUser`,
62
+ and the synchronous-snapshot rollback pattern used by edits and
63
+ optimistic removes.
64
+ - Repo-wide prettier formatting fixes (whitespace only).
65
+
66
+ ## [1.0.0-beta.0] — 2026-06-01
67
+
68
+ First beta of the stable API. Promotes the full 0.2.x hook surface
69
+ (useMessages with reply_count routing, useThread with full-thread
70
+ fetch, useMembers with buffered read-receipt events,
71
+ useConversations with unreadCounts + markConversationRead) to a
72
+ stable namespace. No breaking changes relative to `0.2.0-alpha.7`
73
+ — version bump + removed verbose diagnostic logs.
74
+
75
+ ## [0.2.0] — 2026-06-01
76
+
77
+ ### Fixed
78
+
79
+ - Realtime read receipts now actually fire. The server-side broadcast
80
+ call in `Messaging.do_mark_read` was missing — the alpha.2 commit
81
+ added the channel handler and the SDK subscription but the broadcast
82
+ itself never made it into the commit, so no `member:read` event was
83
+ ever sent. Fixed in the matching server release; `useMembers` also
84
+ logs received events as `[poolse] member:read received` for easy
85
+ observability.
86
+
87
+ ### Changed — thread replies routed to reply_count only
88
+
89
+ - `useMessages` no longer adds incoming thread replies to the main
90
+ feed — replies belong to the side-pane that `useThread` populates.
91
+ Realtime `message:new` with `thread_root_id` set now bumps the
92
+ root's `reply_count` and skips the upsert. Matches the new server
93
+ behavior (`WHERE thread_root_id IS NULL` on `list_messages`), so
94
+ refresh and realtime stay consistent.
95
+ - `useThread` default page size raised from 50 → 500 so a typical
96
+ thread loads in one round-trip. `loadMore` remains as an escape
97
+ hatch.
98
+ - `useMembers` now buffers `member:read` events that fire before the
99
+ initial fetch lands, then replays them once members are loaded.
100
+ Fixes the realtime read-receipt race where reads arriving in the
101
+ subscribe → fetch-response window were silently dropped.
102
+
103
+ ### Added
104
+
105
+ - `useMessages` now maintains `Message.reply_count` live — increments
106
+ on inbound thread reply, decrements on reply soft-delete. No server
107
+ round-trip; the thread pill in `<MessageRow>` updates immediately.
108
+
109
+ ### Fixed
110
+
111
+ - `useMembers` catch path now `console.error`s the underlying error
112
+ with a `[poolse]` prefix so silent failures are debuggable from
113
+ DevTools.
114
+
115
+ ### Added (continued)
116
+
117
+ - `useMessages.edit(messageId, body)` — optimistic edit with rollback
118
+ on server error. Server enforces sender-only authorization.
119
+ - `useMessages.delete(messageId)` — optimistic soft-delete (sets
120
+ `deleted_at` + null body locally, rolls back on error).
121
+ - `useMessages.markReadUpTo(messageId)` — wraps
122
+ `chat.conversations.one(id).messages.markRead`; advances the
123
+ caller's read cursor and triggers server-side read-receipt
124
+ broadcasts to other members.
125
+ - `useConversations` now exposes `unreadCounts: Record<convId, number>`
126
+ plus `markConversationRead(convId)` for sidebar-badge UIs.
127
+ - `useThread.edit(messageId, body)` / `useThread.delete(messageId)`
128
+ for inline reply editing inside `<ThreadView>`.
129
+
130
+ ### Changed
131
+
132
+ - `useMembers(conversationId)` now treats an empty string id as
133
+ "skip fetch" (returns `{ members: [], loading: false }`) so
134
+ callers can conditionally enable member loading without wrapping
135
+ in a `enabled ?` guard.
136
+ - `useMembers` subscribes to the new `member:read` realtime event
137
+ and advances the matching membership's `last_read_message_id` /
138
+ `last_read_at` in place. The sender's check-double glyph now
139
+ flips in real time without a refetch.
140
+ - Provider auto-resolves the SDK's new default `apiUrl` when none
141
+ is passed in config.
142
+
143
+ ## [0.1.1] — 2026-06-01
144
+
145
+ ### Fixed
146
+
147
+ - `useMessages.send()` now stamps the optimistic temp message's
148
+ `sender_id` with the current user's id (via `useMe` internally).
149
+ Without this, self-sent messages briefly rendered on the "other"
150
+ side of the chat until the realtime echo replaced them.
151
+
152
+ ## [0.1.0] — 2026-06-01
153
+
154
+ First publishable release.
155
+
156
+ ### Added
157
+
158
+ - `<PoolseProvider>` — mount-once SDK instance with ref-stable callbacks
159
+ (safe to pass `config={{getToken: () => ...}}` inline on every render).
160
+ - `usePoolse()` — raw `Poolse` instance escape hatch.
161
+ - Realtime hooks: `useMe`, `useConversations`, `useConversation`,
162
+ `useMembers`, `useMessages`, `useThread`, `useReactions`, `useTyping`,
163
+ `usePresence`, `useRealtimeStatus`.
164
+ - Attachments: `useAttachmentUpload`, `useAttachmentUrl`.
165
+ - Real-time conversation list — `useConversations` subscribes to the
166
+ user's `user:<id>` channel and prepends on `conversation:created`
167
+ push (no manual refetch needed).
168
+ - Optimistic message send with id-based dedup: `useMessages.send()`
169
+ inserts under the same id the server will assign, so realtime echo
170
+ upserts in place.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Poolse
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Poolse
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.