@videosdk.live/react-sdk 0.1.100 → 0.1.102

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.
@@ -2,10 +2,10 @@ import { Participant } from './participant';
2
2
  import { Stream } from './stream';
3
3
 
4
4
  export enum CharacterMode {
5
- TEXT = "text",
6
- CO_PILOT = "co_pilot",
7
- AUTO_PILOT = "auto_pilot",
8
- VISION_PILOT = "vision_pilot"
5
+ TEXT = 'text',
6
+ CO_PILOT = 'co_pilot',
7
+ AUTO_PILOT = 'auto_pilot',
8
+ VISION_PILOT = 'vision_pilot'
9
9
  }
10
10
 
11
11
  export enum CharacterState {
@@ -35,6 +35,11 @@ export class Character extends Participant {
35
35
  */
36
36
  knowledgeBases: string[];
37
37
 
38
+ /**
39
+ * @description This represents language of interaction
40
+ */
41
+ language: string;
42
+
38
43
  /**
39
44
  * @description This represents communication mode of character participant
40
45
  */
@@ -61,8 +66,8 @@ export class Character extends Participant {
61
66
  sendMessage(text: string): Promise<void>;
62
67
 
63
68
  /**
64
- * @description This method can be used to interrupt a character participant
65
- */
69
+ * @description This method can be used to interrupt a character participant
70
+ */
66
71
  interrupt(): Promise<void>;
67
72
 
68
73
  /**
@@ -79,7 +84,9 @@ export class Character extends Participant {
79
84
  | 'character-state-changed'
80
85
  | 'character-message'
81
86
  | 'character-joined'
82
- | 'character-left',
87
+ | 'character-left'
88
+ | 'user-message'
89
+ | 'data',
83
90
  listener: (data: any) => void
84
91
  ): void;
85
92
  /**
@@ -96,7 +103,9 @@ export class Character extends Participant {
96
103
  | 'character-state-changed'
97
104
  | 'character-message'
98
105
  | 'character-joined'
99
- | 'character-left',
106
+ | 'character-left'
107
+ | 'user-message'
108
+ | 'data',
100
109
  listener: (data: any) => void
101
110
  ): void;
102
111
  }
@@ -1010,6 +1010,39 @@ export function useFile(): {
1010
1010
  }) => Promise<string | null>;
1011
1011
  };
1012
1012
 
1013
+ /**
1014
+ * @returns - This will return `startWhiteboard()`, `stopWhiteboard()` and `whiteboardUrl`.
1015
+ * ---
1016
+ * **useWhiteboard example**
1017
+ * ```javascript
1018
+ * const { startWhiteboard, stopWhiteboard, whiteboardUrl } = useWhiteboard();
1019
+ *
1020
+ * async function handleStartWhiteboard() {
1021
+ * await startWhiteboard();
1022
+ * }
1023
+ *
1024
+ * async function handleStopWhiteboard() {
1025
+ * await stopWhiteboard();
1026
+ * }
1027
+ * ```
1028
+ */
1029
+ export function useWhiteboard(): {
1030
+ /**
1031
+ * @description Starts the whiteboard for the meeting.
1032
+ */
1033
+ startWhiteboard: () => Promise<void>;
1034
+
1035
+ /**
1036
+ * @description Stops the whiteboard session for the meeting.
1037
+ */
1038
+ stopWhiteboard: () => Promise<void>;
1039
+
1040
+ /**
1041
+ * @description The URL of the active whiteboard, or `null` if the whiteboard is not currently active.
1042
+ */
1043
+ whiteboardUrl: string | null;
1044
+ };
1045
+
1013
1046
  /**
1014
1047
  * @param onTranscriptionStateChanged - This will triggered when a realtime transcription state is changed.
1015
1048
  * ---
@@ -1082,6 +1115,10 @@ export function useTranscription({
1082
1115
  * ---
1083
1116
  * @param onCharacterMessage - This will triggered when a character response/message is published.
1084
1117
  * ---
1118
+ * @param onUserMessage - This will triggered when a user/participant message is published.
1119
+ * ---
1120
+ * @param onData - This will triggered when a character worker notify payload.
1121
+ * ---
1085
1122
  * @param onStreamEnabled - It's a callback which gets triggered whenever a character's video, audio or screen share stream is enabled.
1086
1123
  * ---
1087
1124
  * @param onStreamEnabled - It's a callback which gets triggered whenever a character's video, audio or screen share stream is disabled.
@@ -1105,6 +1142,14 @@ export function useTranscription({
1105
1142
  * console.log('character message Payload:', data);
1106
1143
  * }
1107
1144
  *
1145
+ * function onUserMessage(data) {
1146
+ * console.log('user message Payload:', data);
1147
+ * }
1148
+ *
1149
+ * function onData(topic, data) {
1150
+ * console.log('character data available:', topic, data);
1151
+ * }
1152
+ *
1108
1153
  * const { join, leave, sendMessage, interrupt } = useCharacter({
1109
1154
  * interactionId,
1110
1155
  * // OR
@@ -1113,10 +1158,13 @@ export function useTranscription({
1113
1158
  * characterRole,
1114
1159
  * characterMode,
1115
1160
  * knowledgeBases,
1161
+ * language,
1116
1162
  * },
1117
1163
  * {
1118
1164
  * onCharacterStateChanged,
1119
1165
  * onCharacterMessage,
1166
+ * onUserMessage,
1167
+ * onData,
1120
1168
  * onCharacterJoined,
1121
1169
  * onCharacterLeft,
1122
1170
  *
@@ -1143,7 +1191,8 @@ export function useCharacter(
1143
1191
  displayName,
1144
1192
  characterRole,
1145
1193
  characterMode,
1146
- knowledgeBases
1194
+ knowledgeBases,
1195
+ language
1147
1196
  }: {
1148
1197
  interactionId: string;
1149
1198
  // OR
@@ -1152,11 +1201,13 @@ export function useCharacter(
1152
1201
  characterRole: string;
1153
1202
  characterMode: 'text' | 'co_pilot' | 'auto_pilot' | 'vision_pilot';
1154
1203
  knowledgeBases: string[];
1204
+ language: string;
1155
1205
  },
1156
1206
  {
1157
1207
  onCharacterStateChanged,
1158
1208
  onCharacterMessage,
1159
-
1209
+ onUserMessage,
1210
+ onData,
1160
1211
  onStreamEnabled,
1161
1212
  onStreamDisabled,
1162
1213
  onMediaStatusChanged,
@@ -1166,12 +1217,20 @@ export function useCharacter(
1166
1217
  id: string;
1167
1218
  status: CharacterState;
1168
1219
  }) => void;
1169
- onCharacterMessage?: (data: {
1220
+ onUserMessage?: (data: {
1170
1221
  participantId: string;
1171
1222
  participantName: string;
1172
1223
  text: string;
1173
1224
  timestamp: number;
1174
1225
  }) => void;
1226
+ onCharacterMessage?: (data: {
1227
+ characterId: string;
1228
+ characterName: string;
1229
+ text: string;
1230
+ timestamp: number;
1231
+ }) => void;
1232
+
1233
+ onData?: (topic: string, data: any) => void;
1175
1234
  onCharacterJoined?: () => void;
1176
1235
  onCharacterLeft?: () => void;
1177
1236
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@videosdk.live/react-sdk",
3
- "version": "0.1.100",
3
+ "version": "0.1.102",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.modern.js",
@@ -27,6 +27,7 @@
27
27
  "author": "videosdk.live",
28
28
  "homepage": "https://docs.videosdk.live/docs/realtime-communication/sdk-reference/react-sdk/setup",
29
29
  "devDependencies": {
30
+ "@types/react": "^18.3.5",
30
31
  "babel-eslint": "^10.0.1",
31
32
  "eslint": "^5.16.0",
32
33
  "husky": "^2.3.0",
@@ -73,7 +74,7 @@
73
74
  }
74
75
  },
75
76
  "dependencies": {
76
- "@videosdk.live/js-sdk": "0.0.96",
77
+ "@videosdk.live/js-sdk": "0.0.98",
77
78
  "events": "^3.3.0"
78
79
  }
79
80
  }