@pmate/chat-sdk 0.12.0-next.22 → 0.12.0-next.23

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.
@@ -140,7 +140,8 @@ export class ChatSession {
140
140
  /** One-time migration only: never establishes trusted history coverage. */
141
141
  importLegacyMessages(threadId, messages) { this.assertOpen(); return this.messages.importLegacy(threadId, messages); }
142
142
  getReadingSnapshot() { return this.closed || this.withdrawn ? undefined : this.reading.getSnapshot(); }
143
- subscribeReading(listener) { this.assertOpen(); return this.reading.subscribe(listener); }
143
+ subscribeReading(listener) { if (this.closed || this.withdrawn)
144
+ return () => { }; return this.reading.subscribe(listener); }
144
145
  refreshReading() { this.assertOpen(); this.reading.refresh(); }
145
146
  synchronizeReading(cursor, profileId) { this.assertOpen(); return this.reading.synchronize(cursor, profileId); }
146
147
  /** Explicit text-history acknowledgement; unheard audio stays unread. */
@@ -265,9 +266,11 @@ export class ChatSession {
265
266
  }
266
267
  retryMessage(messageId) { this.assertOpen(); return this.sender.retry(messageId); }
267
268
  observeMessages(threadId, ids, event, clientInstanceId) {
268
- if (this.closed && event === "receipts" && !threadId)
269
- return Promise.resolve();
270
- this.assertOpen();
269
+ if (this.closed || this.withdrawn) {
270
+ if (event === "receipts" && !threadId)
271
+ return Promise.resolve();
272
+ return Promise.reject(new Error(this.withdrawn ? "CHAT_ACCESS_REVOKED" : "CHAT_SESSION_CLOSED"));
273
+ }
271
274
  if (event === "receipts") {
272
275
  this.watchCounts(threadId, ids, clientInstanceId);
273
276
  return Promise.resolve();
@@ -382,7 +385,8 @@ export class ChatSession {
382
385
  return snapshot;
383
386
  }
384
387
  subscribe(target, listener, fields) {
385
- this.assertOpen();
388
+ if (this.closed || this.withdrawn)
389
+ return () => { };
386
390
  if (typeof target === "function") {
387
391
  this.globalListeners.add(target);
388
392
  return () => { this.globalListeners.delete(target); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/chat-sdk",
3
- "version": "0.12.0-next.22",
3
+ "version": "0.12.0-next.23",
4
4
  "description": "Cross-platform PMate chat input components, voice input primitives, and ASR helpers",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",