@ahmedramez-org/nexus-chat 1.0.0-beta.7 → 1.0.0-beta.8

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/package.json +1 -1
  2. package/window.js +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahmedramez-org/nexus-chat",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.8",
4
4
  "description": "NexusChat for any app: a connector and React component that load the prebuilt chat from IncortaCopilot (or a pinned copy), and the host contract types and checks.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
package/window.js CHANGED
@@ -15,6 +15,8 @@ const NARROW_VIEWPORT = 768;
15
15
  const READY_FALLBACK_MS = 5_000;
16
16
  /** At most this often, the app tells the chat the user is working (the chat paces its session reads). */
17
17
  const KEEP_ALIVE_MS = 10_000;
18
+ /** The embed protocol's version, on every message (nothing rejects a peer that sends none). */
19
+ const PROTOCOL_VERSION = 1;
18
20
  const NAME = 'Incorta Intelligence';
19
21
 
20
22
  /** The floating window and its launcher lift off the page; the launcher is a surface of its own. */
@@ -276,7 +278,8 @@ export function connectEmbeddedChat(win, iframe, { embedUrl, theme = 'light' })
276
278
  const skeleton = showNexusChatSkeleton(win.panel, theme);
277
279
  let fallback;
278
280
  let sent;
279
- const post = (message) => iframe.contentWindow?.postMessage(message, origin);
281
+ const post = (message) =>
282
+ iframe.contentWindow?.postMessage({ ...message, v: PROTOCOL_VERSION }, origin);
280
283
  const sendStyle = (force) => {
281
284
  const message = { nexusChat: 'style', theme, window: win.state() };
282
285
  const key = JSON.stringify(message);