@pmate/chat-sdk 0.12.0-next.85 → 0.12.0-next.86
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/lib/runtime/chatSession.js +9 -1
- package/package.json +17 -16
|
@@ -156,8 +156,16 @@ export class ChatSession {
|
|
|
156
156
|
this.groups?.hint({ id: groupThreadId(scope.appId, message.to, scope.teamId), kind: "group", targetId: message.to, teamId: scope.teamId }, Number.isSafeInteger(body.payload.versionNumber) ? body.payload.versionNumber : undefined);
|
|
157
157
|
}
|
|
158
158
|
const decoded = options.decode(message);
|
|
159
|
+
// A peer can react before history returns our own ACKed source message.
|
|
160
|
+
// Discussion windows store controls against canonical target IDs; retain
|
|
161
|
+
// the known sent local target in the same atomic receive batch so the
|
|
162
|
+
// reaction is visible without waiting for another network history read.
|
|
163
|
+
const control = message.body?.content;
|
|
164
|
+
const targetId = control?.reaction?.messageId ?? control?.recall?.messageId;
|
|
165
|
+
const outgoing = decoded && targetId ? this.sender.snapshot(decoded.threadId).find(record => record.hash === targetId && record.status === 'sent' && record.message.from === scope.profileId) : undefined;
|
|
166
|
+
const localTarget = outgoing && options.decode(outgoing.message);
|
|
159
167
|
if (decoded)
|
|
160
|
-
void this.messages.receive(decoded.threadId, [decoded]).then(async () => {
|
|
168
|
+
void this.messages.receive(decoded.threadId, localTarget ? [localTarget, decoded] : [decoded]).then(async () => {
|
|
161
169
|
if (!this.closed && this.readingStarted)
|
|
162
170
|
this.reading.refresh();
|
|
163
171
|
if (message.from === scope.profileId)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pmate/chat-sdk",
|
|
3
|
-
"version": "0.12.0-next.
|
|
3
|
+
"version": "0.12.0-next.86",
|
|
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",
|
|
@@ -58,6 +58,15 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"clean": "rimraf lib",
|
|
63
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json && cp src/voice/recorder-processor.js lib/voice/recorder-processor.js",
|
|
64
|
+
"prepack": "pnpm run build",
|
|
65
|
+
"npm:publish": "pnpm run build && npm publish --access public --registry https://registry.npmjs.org/",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"storybook": "storybook dev -p 6009",
|
|
68
|
+
"build-storybook": "storybook build --output-dir dist"
|
|
69
|
+
},
|
|
61
70
|
"dependencies": {
|
|
62
71
|
"@emoji-mart/data": "^1.2.1",
|
|
63
72
|
"@emoji-mart/react": "^1.1.1",
|
|
@@ -73,24 +82,16 @@
|
|
|
73
82
|
"devDependencies": {
|
|
74
83
|
"@storybook/addon-docs": "^9.0.17",
|
|
75
84
|
"@storybook/react-vite": "9.0.17",
|
|
76
|
-
"@tailwindcss/vite": "
|
|
77
|
-
"@types/react": "
|
|
78
|
-
"@types/react-dom": "
|
|
85
|
+
"@tailwindcss/vite": "catalog:",
|
|
86
|
+
"@types/react": "catalog:",
|
|
87
|
+
"@types/react-dom": "catalog:",
|
|
79
88
|
"fake-indexeddb": "^6.2.5",
|
|
80
|
-
"react": "
|
|
81
|
-
"react-dom": "
|
|
89
|
+
"react": "catalog:",
|
|
90
|
+
"react-dom": "catalog:",
|
|
82
91
|
"rimraf": "^6.1.2",
|
|
83
92
|
"storybook": "^9.0.17",
|
|
84
|
-
"tailwindcss": "
|
|
93
|
+
"tailwindcss": "catalog:",
|
|
85
94
|
"typescript": "5.9.2",
|
|
86
95
|
"vitest": "^4.0.17"
|
|
87
|
-
},
|
|
88
|
-
"scripts": {
|
|
89
|
-
"clean": "rimraf lib",
|
|
90
|
-
"build": "pnpm run clean && tsc -p tsconfig.build.json && cp src/voice/recorder-processor.js lib/voice/recorder-processor.js",
|
|
91
|
-
"npm:publish": "pnpm run build && npm publish --access public --registry https://registry.npmjs.org/",
|
|
92
|
-
"test": "vitest run",
|
|
93
|
-
"storybook": "storybook dev -p 6009",
|
|
94
|
-
"build-storybook": "storybook build --output-dir dist"
|
|
95
96
|
}
|
|
96
|
-
}
|
|
97
|
+
}
|