@tellescope/video-chat 1.3.25 → 1.3.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/video-chat",
3
- "version": "1.3.25",
3
+ "version": "1.3.26",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -35,7 +35,7 @@
35
35
  "@mui/icons-material": "^5.0.1",
36
36
  "@mui/material": "^5.0.2",
37
37
  "@tellescope/constants": "^1.3.24",
38
- "@tellescope/react-components": "^1.3.25",
38
+ "@tellescope/react-components": "^1.3.26",
39
39
  "@tellescope/sdk": "^1.3.25",
40
40
  "@tellescope/types-client": "^1.3.24",
41
41
  "@tellescope/types-models": "^1.3.24",
@@ -55,7 +55,7 @@
55
55
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
56
56
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
57
57
  },
58
- "gitHead": "b0763c5db209879f150d7289a2e031740b2fb371",
58
+ "gitHead": "c4626933b58bb8f6fc07f8ba747c31377827218f",
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  }
package/src/video.tsx CHANGED
@@ -1,12 +1,16 @@
1
- import React, { useCallback, useState, CSSProperties, Children, useEffect } from "react"
1
+ import React, { useCallback, useState, useEffect } from "react"
2
2
 
3
3
  import {
4
4
  useResolvedSession,
5
5
  useSession,
6
6
  Styled,
7
+ UserAndEnduserSelectorProps,
8
+ useMeetings,
9
+ UserAndEnduserSelector,
7
10
  } from "@tellescope/react-components"
8
11
 
9
12
  import {
13
+ APIError,
10
14
  UserIdentity,
11
15
  } from "@tellescope/types-utilities"
12
16
  import {
@@ -50,6 +54,7 @@ import {
50
54
  JoinVideoCallProps,
51
55
  } from "./video_shared"
52
56
  import { ConsoleLogger, DefaultDeviceController, Logger, LogLevel } from "amazon-chime-sdk-js";
57
+ import { Enduser, Meeting, User } from "@tellescope/types-client";
53
58
 
54
59
  const WithContext = ({ children } : { children: React.ReactNode }) => {
55
60
  const [meeting, setMeeting] = useState(undefined as MeetingInfo | undefined)
@@ -264,4 +269,37 @@ export const LocalPreview = ({ style=defaultPreviewStyle }: Styled) => {
264
269
 
265
270
  return <video id={PREVIEW_ELEMENT_ID} style={style}/>
266
271
  }
267
- export { VideoTileGrid }
272
+ export { VideoTileGrid }
273
+
274
+ export interface CreateMeetingProps extends Omit<UserAndEnduserSelectorProps, 'onSelect'> {
275
+ onSuccess?: ({ id } : { id: string }) => void,
276
+ onError?: (e: APIError) => void,
277
+ roomTitle?: string,
278
+ }
279
+ export const CreateMeeting = ({
280
+ roomTitle: defaultRoomTitle = "Group Chat",
281
+ onSuccess, onError,
282
+ ...props
283
+ } : CreateMeetingProps) => {
284
+ const session = useSession()
285
+
286
+ const handleCreateRoom = useCallback(({ users, endusers }: { users: User[], endusers: Enduser[] }) => {
287
+ const userIds = users.map(u => u.id)
288
+ const enduserIds = endusers.map(e => e.id)
289
+
290
+ session.api.meetings.start_meeting({
291
+ attendees: ([
292
+ ...userIds.map(id => ({ type: 'user', id } as UserIdentity)),
293
+ ...enduserIds.map(id => ({ type: 'enduser', id } as UserIdentity)),
294
+ ])
295
+ })
296
+ .then(r => {
297
+ onSuccess?.(r)
298
+ })
299
+ .catch(onError)
300
+ }, [session, onSuccess, onError])
301
+
302
+ return (
303
+ <UserAndEnduserSelector {...props} onSelect={handleCreateRoom} />
304
+ )
305
+ }