@meshagent/meshagent-react 0.37.2 → 0.38.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,3 +1,6 @@
1
+ ## [0.38.0]
2
+ - Stability
3
+
1
4
  ## [0.37.2]
2
5
  - Stability
3
6
 
package/dist/cjs/chat.js CHANGED
@@ -45,10 +45,10 @@ function ensureParticipants(document, localParticipant, includeLocalParticipant,
45
45
  ];
46
46
  const existing = new Set();
47
47
  for (const child of document.root.getChildren()
48
- .filter((c) => c.tagName !== undefined)) {
48
+ .filter((c) => c instanceof meshagent_1.Element)) {
49
49
  if (child.tagName === "members") {
50
50
  for (const member of child.getChildren()
51
- .filter((c) => c.tagName !== undefined)) {
51
+ .filter((c) => c instanceof meshagent_1.Element)) {
52
52
  const name = getParticipantName(member);
53
53
  if (name)
54
54
  existing.add(name);
@@ -45,9 +45,7 @@ function useRoomConnection(props) {
45
45
  if (cancelled)
46
46
  return;
47
47
  const room = new meshagent_2.RoomClient({
48
- protocol: new meshagent_2.Protocol({
49
- channel: new meshagent_2.WebSocketProtocolChannel({ url, jwt }),
50
- }),
48
+ protocolFactory: meshagent_2.WebSocketClientProtocol.createFactory({ url, token: jwt }),
51
49
  });
52
50
  setClient(room);
53
51
  setState('connecting');
@@ -65,7 +63,7 @@ function useRoomConnection(props) {
65
63
  },
66
64
  });
67
65
  if (enableMessaging) {
68
- await room.messaging.enable();
66
+ room.messaging.enable();
69
67
  }
70
68
  if (cancelled)
71
69
  return;
package/dist/esm/chat.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useState, useMemo } from "react";
2
- import { RemoteParticipant } from "@meshagent/meshagent";
2
+ import { Element, RemoteParticipant } from "@meshagent/meshagent";
3
3
  import { MeshagentFileUpload } from "./file-upload";
4
4
  import { useRoomParticipants } from "./document-connection-scope";
5
5
  import { useDocumentConnection, useDocumentChanged } from "./document-connection-scope";
@@ -39,10 +39,10 @@ function ensureParticipants(document, localParticipant, includeLocalParticipant,
39
39
  ];
40
40
  const existing = new Set();
41
41
  for (const child of document.root.getChildren()
42
- .filter((c) => c.tagName !== undefined)) {
42
+ .filter((c) => c instanceof Element)) {
43
43
  if (child.tagName === "members") {
44
44
  for (const member of child.getChildren()
45
- .filter((c) => c.tagName !== undefined)) {
45
+ .filter((c) => c instanceof Element)) {
46
46
  const name = getParticipantName(member);
47
47
  if (name)
48
48
  existing.add(name);
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState, useRef } from 'react';
2
2
  import { subscribe } from './subscribe-async-gen';
3
3
  import { RoomMessageEvent } from '@meshagent/meshagent';
4
- import { ParticipantToken, Protocol, RoomClient, WebSocketProtocolChannel, } from '@meshagent/meshagent';
4
+ import { ParticipantToken, RoomClient, WebSocketClientProtocol, } from '@meshagent/meshagent';
5
5
  /* -------------------------------------------------
6
6
  * Authorization helpers
7
7
  * ------------------------------------------------- */
@@ -39,9 +39,7 @@ export function useRoomConnection(props) {
39
39
  if (cancelled)
40
40
  return;
41
41
  const room = new RoomClient({
42
- protocol: new Protocol({
43
- channel: new WebSocketProtocolChannel({ url, jwt }),
44
- }),
42
+ protocolFactory: WebSocketClientProtocol.createFactory({ url, token: jwt }),
45
43
  });
46
44
  setClient(room);
47
45
  setState('connecting');
@@ -59,7 +57,7 @@ export function useRoomConnection(props) {
59
57
  },
60
58
  });
61
59
  if (enableMessaging) {
62
- await room.messaging.enable();
60
+ room.messaging.enable();
63
61
  }
64
62
  if (cancelled)
65
63
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent-react",
3
- "version": "0.37.2",
3
+ "version": "0.38.0",
4
4
  "description": "Meshagent React Client",
5
5
  "homepage": "https://github.com/meshagent/meshagent-react",
6
6
  "scripts": {
@@ -11,11 +11,13 @@
11
11
  "type": "module",
12
12
  "module": "dist/esm/index.js",
13
13
  "main": "./dist/esm/index.js",
14
- "types": "dist/index.d.ts",
14
+ "types": "./dist/esm/index.d.ts",
15
15
  "exports": {
16
16
  ".": {
17
- "module": "./dist/esm/index.js",
18
- "default": "./dist/cjs/index.js"
17
+ "types": "./dist/esm/index.d.ts",
18
+ "import": "./dist/esm/index.js",
19
+ "require": "./dist/cjs/index.js",
20
+ "default": "./dist/esm/index.js"
19
21
  },
20
22
  "./package.json": "./package.json"
21
23
  },
@@ -34,7 +36,7 @@
34
36
  "base-64": "^1.0.0",
35
37
  "livekit-client": "^2.15.5",
36
38
  "react": "^19.1.0",
37
- "@meshagent/meshagent": "^0.37.2",
39
+ "@meshagent/meshagent": "^0.38.0",
38
40
  "react-dom": "^19.1.0",
39
41
  "typescript": "^5.8.3",
40
42
  "uuid": "^11.1.0",
@@ -43,4 +45,4 @@
43
45
  "overrides": {
44
46
  "rollup": "4.52.5"
45
47
  }
46
- }
48
+ }