@tellescope/video-chat 1.3.32 → 1.3.33

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.32",
3
+ "version": "1.3.33",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -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": "30e2d9bb967db68d0d117dfb85ba1383bb82616a",
58
+ "gitHead": "9af0a42a6d12f0c2c4366060fb46fe134f6bd04b",
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  }
@@ -120,12 +120,14 @@ export type WaitingRoomProps = {
120
120
  calendarEvent: CalendarEvent,
121
121
  onGoBack?: () => void,
122
122
  }
123
- export const WaitingRoom = ({ calendarEvent, onGoBack } : WaitingRoomProps) => {
123
+ interface WaitingRoomResolvedProps extends WaitingRoomProps {
124
+ join: (meetingInfo: { Meeting: MeetingInfo } | string, attendeeInfo?: { Attendee: AttendeeInfo }) => Promise<void>,
125
+ start?: () => void,
126
+ }
127
+ const WaitingRoomShared = ({ calendarEvent, join, start, onGoBack }: WaitingRoomResolvedProps) => {
124
128
  const session = useResolvedSession()
125
129
  const [, { findById: findEvent }] = useCalendarEvents()
126
130
  const [, { findById: findMeeting }] = useMeetings()
127
- const { startAndJoinMeeting } = useStartAndJoinMeetingForCalendarEvent(calendarEvent.id)
128
- const { joinMeeting } = useJoinVideoCall()
129
131
 
130
132
  const tsMeeting = findMeeting(calendarEvent?.meetingId ?? '')
131
133
 
@@ -157,12 +159,13 @@ export const WaitingRoom = ({ calendarEvent, onGoBack } : WaitingRoomProps) => {
157
159
  <LoadingButton variant="contained"
158
160
  disabled={
159
161
  (!meetingIsStarted && !isHost)
162
+ || (!meetingIsStarted && !start)
160
163
  || (meetingIsStarted && !tsMeeting)
161
164
  }
162
165
  onClick={
163
166
  meetingIsStarted
164
- ? () => joinMeeting(tsMeeting.id)
165
- : startAndJoinMeeting
167
+ ? () => join(tsMeeting.id)
168
+ : start
166
169
  }
167
170
  submitText={
168
171
  meetingIsStarted ? "Join Meeting" : "Start Meeting"
@@ -190,6 +193,26 @@ export const WaitingRoom = ({ calendarEvent, onGoBack } : WaitingRoomProps) => {
190
193
  )
191
194
  }
192
195
 
196
+ // Only users can start meeting, avoid using useStartAndJoin... hook as enduser
197
+ const WaitingRoomUser = (props : WaitingRoomProps) => {
198
+ const { startAndJoinMeeting } = useStartAndJoinMeetingForCalendarEvent(props.calendarEvent.id)
199
+ const { joinMeeting } = useJoinVideoCall()
200
+
201
+ return <WaitingRoomShared {...props} start={startAndJoinMeeting} join={joinMeeting} />
202
+ }
203
+
204
+ const WaitingRoomEnduser = (props : WaitingRoomProps) => {
205
+ const { joinMeeting } = useJoinVideoCall()
206
+ return <WaitingRoomShared {...props} join={joinMeeting} />
207
+ }
208
+
209
+ export const WaitingRoom = (props: WaitingRoomProps) => {
210
+ const session = useResolvedSession()
211
+ const Component = session.type === 'user' ? WaitingRoomUser : WaitingRoomEnduser
212
+
213
+ return <Component {...props} />
214
+ }
215
+
193
216
  export interface VideoCallNativeProps {
194
217
  onLeave?: () => void,
195
218
  }