@pmate/chat-sdk 0.12.0-next.80 → 0.12.0-next.81

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.
Files changed (2) hide show
  1. package/lib/snapshot.js +3 -1
  2. package/package.json +1 -1
package/lib/snapshot.js CHANGED
@@ -45,6 +45,8 @@ export async function fetchConversationSnapshot(options) {
45
45
  const projected = projectConversationReading(state, { id: options.threadId, kind });
46
46
  const present = createMessagePresenter();
47
47
  const timeline = projectMessageTimeline({ appId: options.appId, profileId: options.profileId, threadId: options.threadId, messages, outgoing: [], decode: () => undefined, reading: projected.messageReading });
48
+ const recalled = new Set(timeline.filter(item => item.recalled).map(item => item.id));
49
+ const displayed = timeline.map(present).map(message => message.quote?.messageId && recalled.has(message.quote.messageId) ? { ...message, quote: { ...message.quote, content: "", recalled: true } } : message);
48
50
  return { appId: value.appId, accountId: value.accountId, profileId: value.profileId, teamId: value.teamId, threadId: value.threadId, generatedAt: value.generatedAt, contact: value.contact, group: value.group,
49
- messages: timeline.map(present), hasEarlier: page.nextBefore !== null, unread: summary, checkpoint: page.checkpoint, readingCursor: reading.syncCursor, serverTiming: response.headers.get("server-timing") };
51
+ messages: displayed, hasEarlier: page.nextBefore !== null, unread: summary, checkpoint: page.checkpoint, readingCursor: reading.syncCursor, serverTiming: response.headers.get("server-timing") };
50
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/chat-sdk",
3
- "version": "0.12.0-next.80",
3
+ "version": "0.12.0-next.81",
4
4
  "description": "Local-first chat SDK, message subscriptions, reading state, and shared chat UI primitives",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",