@defcomm/meetingsdk 0.5.0 → 0.5.1

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/dist/index.d.mts CHANGED
@@ -268,7 +268,7 @@ declare class VideoSDKCore {
268
268
  };
269
269
  approveJoinRequest(requestId: string): Promise<void>;
270
270
  rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
271
- cancelJoinRequest(requestId: string): Promise<void | undefined>;
271
+ cancelJoinRequest(requestId?: string): Promise<void | undefined>;
272
272
  muteAllAudio(): Promise<void>;
273
273
  unmuteAllAudio(): Promise<void>;
274
274
  removeParticipant(participantId: string): Promise<void>;
@@ -350,7 +350,7 @@ type MeetingContextValue = {
350
350
  onPubSubMessage: <T extends PubSubTopic>(topic: T, cb: (message: PubSubMessage<PubSubTopicConfig[T]["message"]>) => void) => () => void;
351
351
  approveJoinRequest: (requestId: string) => void;
352
352
  rejectJoinRequest: (requestId: string) => void;
353
- cancelJoinRequest: (requestId: string) => Promise<void> | undefined;
353
+ cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
354
354
  muteAllAudio: () => Promise<void>;
355
355
  unmuteAllAudio: () => Promise<void>;
356
356
  removeParticipant: (participantId: string) => Promise<void>;
@@ -363,6 +363,9 @@ type MeetingContextValue = {
363
363
  onError: (cb: (err: any) => void) => () => void;
364
364
  onEntryRequested: (cb: (req: any) => void) => () => void;
365
365
  onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
366
+ onJoinRequestCanceled: (cb: (requestId: string) => void) => () => void;
367
+ onParticipantRemoved: (cb: (participantId: string, removedBy: string) => void) => () => void;
368
+ onParticipantPermissionsChanged: (cb: (participantId: string, permissions: any) => void) => () => void;
366
369
  onMeetingLeft: (cb: () => void) => () => void;
367
370
  onTrackStateChanged: (cb: (track: any) => void) => () => void;
368
371
  onRecordingStarted: (cb: (recording: Recording) => void) => () => void;
@@ -381,6 +384,9 @@ declare const useMeeting: (handlers?: {
381
384
  onError?: (err: any) => void;
382
385
  onEntryRequested?: (req: any) => void;
383
386
  onEntryResponded?: (payload: any, decision?: any) => void;
387
+ onJoinRequestCanceled?: (requestId: string) => void;
388
+ onParticipantRemoved?: (participantId: string, removedBy: string) => void;
389
+ onParticipantPermissionsChanged?: (participantId: string, permissions: any) => void;
384
390
  onMeetingLeft?: () => void;
385
391
  onTrackStateChanged?: (track: any) => void;
386
392
  onRecordingStarted?: (recording: any) => void;
@@ -420,7 +426,7 @@ declare const useMeeting: (handlers?: {
420
426
  onPubSubMessage: <T extends PubSubTopic>(topic: T, cb: (message: PubSubMessage<PubSubTopicConfig[T]["message"]>) => void) => () => void;
421
427
  approveJoinRequest: (requestId: string) => void;
422
428
  rejectJoinRequest: (requestId: string) => void;
423
- cancelJoinRequest: (requestId: string) => Promise<void> | undefined;
429
+ cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
424
430
  muteAllAudio: () => Promise<void>;
425
431
  unmuteAllAudio: () => Promise<void>;
426
432
  removeParticipant: (participantId: string) => Promise<void>;
@@ -433,6 +439,9 @@ declare const useMeeting: (handlers?: {
433
439
  onError: (cb: (err: any) => void) => () => void;
434
440
  onEntryRequested: (cb: (req: any) => void) => () => void;
435
441
  onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
442
+ onJoinRequestCanceled: (cb: (requestId: string) => void) => () => void;
443
+ onParticipantRemoved: (cb: (participantId: string, removedBy: string) => void) => () => void;
444
+ onParticipantPermissionsChanged: (cb: (participantId: string, permissions: any) => void) => () => void;
436
445
  onMeetingLeft: (cb: () => void) => () => void;
437
446
  onTrackStateChanged: (cb: (track: any) => void) => () => void;
438
447
  onRecordingStarted: (cb: (recording: Recording) => void) => () => void;
package/dist/index.d.ts CHANGED
@@ -268,7 +268,7 @@ declare class VideoSDKCore {
268
268
  };
269
269
  approveJoinRequest(requestId: string): Promise<void>;
270
270
  rejectJoinRequest(requestId: string, reason?: string): Promise<void>;
271
- cancelJoinRequest(requestId: string): Promise<void | undefined>;
271
+ cancelJoinRequest(requestId?: string): Promise<void | undefined>;
272
272
  muteAllAudio(): Promise<void>;
273
273
  unmuteAllAudio(): Promise<void>;
274
274
  removeParticipant(participantId: string): Promise<void>;
@@ -350,7 +350,7 @@ type MeetingContextValue = {
350
350
  onPubSubMessage: <T extends PubSubTopic>(topic: T, cb: (message: PubSubMessage<PubSubTopicConfig[T]["message"]>) => void) => () => void;
351
351
  approveJoinRequest: (requestId: string) => void;
352
352
  rejectJoinRequest: (requestId: string) => void;
353
- cancelJoinRequest: (requestId: string) => Promise<void> | undefined;
353
+ cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
354
354
  muteAllAudio: () => Promise<void>;
355
355
  unmuteAllAudio: () => Promise<void>;
356
356
  removeParticipant: (participantId: string) => Promise<void>;
@@ -363,6 +363,9 @@ type MeetingContextValue = {
363
363
  onError: (cb: (err: any) => void) => () => void;
364
364
  onEntryRequested: (cb: (req: any) => void) => () => void;
365
365
  onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
366
+ onJoinRequestCanceled: (cb: (requestId: string) => void) => () => void;
367
+ onParticipantRemoved: (cb: (participantId: string, removedBy: string) => void) => () => void;
368
+ onParticipantPermissionsChanged: (cb: (participantId: string, permissions: any) => void) => () => void;
366
369
  onMeetingLeft: (cb: () => void) => () => void;
367
370
  onTrackStateChanged: (cb: (track: any) => void) => () => void;
368
371
  onRecordingStarted: (cb: (recording: Recording) => void) => () => void;
@@ -381,6 +384,9 @@ declare const useMeeting: (handlers?: {
381
384
  onError?: (err: any) => void;
382
385
  onEntryRequested?: (req: any) => void;
383
386
  onEntryResponded?: (payload: any, decision?: any) => void;
387
+ onJoinRequestCanceled?: (requestId: string) => void;
388
+ onParticipantRemoved?: (participantId: string, removedBy: string) => void;
389
+ onParticipantPermissionsChanged?: (participantId: string, permissions: any) => void;
384
390
  onMeetingLeft?: () => void;
385
391
  onTrackStateChanged?: (track: any) => void;
386
392
  onRecordingStarted?: (recording: any) => void;
@@ -420,7 +426,7 @@ declare const useMeeting: (handlers?: {
420
426
  onPubSubMessage: <T extends PubSubTopic>(topic: T, cb: (message: PubSubMessage<PubSubTopicConfig[T]["message"]>) => void) => () => void;
421
427
  approveJoinRequest: (requestId: string) => void;
422
428
  rejectJoinRequest: (requestId: string) => void;
423
- cancelJoinRequest: (requestId: string) => Promise<void> | undefined;
429
+ cancelJoinRequest: (requestId?: string) => Promise<void> | undefined;
424
430
  muteAllAudio: () => Promise<void>;
425
431
  unmuteAllAudio: () => Promise<void>;
426
432
  removeParticipant: (participantId: string) => Promise<void>;
@@ -433,6 +439,9 @@ declare const useMeeting: (handlers?: {
433
439
  onError: (cb: (err: any) => void) => () => void;
434
440
  onEntryRequested: (cb: (req: any) => void) => () => void;
435
441
  onEntryResponded: (cb: (payload: any, decision?: any) => void) => () => void;
442
+ onJoinRequestCanceled: (cb: (requestId: string) => void) => () => void;
443
+ onParticipantRemoved: (cb: (participantId: string, removedBy: string) => void) => () => void;
444
+ onParticipantPermissionsChanged: (cb: (participantId: string, permissions: any) => void) => () => void;
436
445
  onMeetingLeft: (cb: () => void) => () => void;
437
446
  onTrackStateChanged: (cb: (track: any) => void) => () => void;
438
447
  onRecordingStarted: (cb: (recording: Recording) => void) => () => void;
package/dist/index.js CHANGED
@@ -309,6 +309,9 @@ var MeetingState = class {
309
309
  this.localParticipant = {
310
310
  id: patch.id ?? "",
311
311
  name: patch.name ?? "",
312
+ isHost: patch.isHost ?? false,
313
+ isModerator: patch.isModerator ?? false,
314
+ permissions: patch.permissions,
312
315
  media: {
313
316
  stream: patch.media?.stream ?? null,
314
317
  // ◄ FIX: Capture the stream from the patch here
@@ -348,6 +351,9 @@ var MeetingState = class {
348
351
  ...prev,
349
352
  id: patch.id ?? prev.id,
350
353
  name: patch.name ?? prev.name,
354
+ isHost: patch.isHost ?? prev.isHost,
355
+ isModerator: patch.isModerator ?? prev.isModerator,
356
+ permissions: patch.permissions ?? prev.permissions,
351
357
  media: nextMedia
352
358
  };
353
359
  this.notify("localParticipant");
@@ -1785,8 +1791,9 @@ var SFUClient = class {
1785
1791
  }
1786
1792
  }
1787
1793
  async cancelJoinRequest(requestId) {
1788
- if (!requestId) throw new Error("requestId is required");
1789
- if (!this.send({ type: "cancel_join_request", payload: { request_id: requestId } })) {
1794
+ const id = requestId || this.pendingJoinRequestId;
1795
+ if (!id) return;
1796
+ if (!this.send({ type: "cancel_join_request", payload: { request_id: id } })) {
1790
1797
  throw new Error("SFU signaling is not connected");
1791
1798
  }
1792
1799
  this.pendingJoinRequestId = null;
@@ -2362,7 +2369,7 @@ var VideoSDKCore = class {
2362
2369
  onParticipantPermissionsChanged: (participantId, permissions) => {
2363
2370
  if (participantId === this.myId) {
2364
2371
  const current = this.state.localParticipant;
2365
- this.state.updateLocalParticipant({ id: this.myId, name: this.participantName, isHost: Boolean(permissions?.moderate) && current?.isHost, isModerator: Boolean(permissions?.moderate), permissions });
2372
+ this.state.updateLocalParticipant({ id: this.myId, name: this.participantName, isHost: current?.isHost, isModerator: Boolean(permissions?.moderate), permissions });
2366
2373
  }
2367
2374
  },
2368
2375
  onJoinRequested: (request) => {
@@ -2971,6 +2978,9 @@ var MeetingProvider = ({
2971
2978
  const entryResponseListeners = (0, import_react2.useRef)(
2972
2979
  /* @__PURE__ */ new Set()
2973
2980
  );
2981
+ const joinRequestCanceledListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
2982
+ const participantRemovedListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
2983
+ const participantPermissionsChangedListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
2974
2984
  const meetingLeftListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
2975
2985
  const trackStateListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
2976
2986
  const recordingStartedListeners = (0, import_react2.useRef)(/* @__PURE__ */ new Set());
@@ -3002,6 +3012,15 @@ var MeetingProvider = ({
3002
3012
  onEntryResponded: (p, d) => {
3003
3013
  entryResponseListeners.current.forEach((fn) => fn(p, d));
3004
3014
  },
3015
+ onJoinRequestCanceled: (requestId) => {
3016
+ joinRequestCanceledListeners.current.forEach((fn) => fn(requestId));
3017
+ },
3018
+ onParticipantRemoved: (participantId, removedBy) => {
3019
+ participantRemovedListeners.current.forEach((fn) => fn(participantId, removedBy));
3020
+ },
3021
+ onParticipantPermissionsChanged: (participantId, permissions) => {
3022
+ participantPermissionsChangedListeners.current.forEach((fn) => fn(participantId, permissions));
3023
+ },
3005
3024
  onMeetingLeft: () => {
3006
3025
  meetingLeftListeners.current.forEach((fn) => fn());
3007
3026
  },
@@ -3190,6 +3209,24 @@ var MeetingProvider = ({
3190
3209
  entryResponseListeners.current.delete(cb);
3191
3210
  };
3192
3211
  },
3212
+ onJoinRequestCanceled: (cb) => {
3213
+ joinRequestCanceledListeners.current.add(cb);
3214
+ return () => {
3215
+ joinRequestCanceledListeners.current.delete(cb);
3216
+ };
3217
+ },
3218
+ onParticipantRemoved: (cb) => {
3219
+ participantRemovedListeners.current.add(cb);
3220
+ return () => {
3221
+ participantRemovedListeners.current.delete(cb);
3222
+ };
3223
+ },
3224
+ onParticipantPermissionsChanged: (cb) => {
3225
+ participantPermissionsChangedListeners.current.add(cb);
3226
+ return () => {
3227
+ participantPermissionsChangedListeners.current.delete(cb);
3228
+ };
3229
+ },
3193
3230
  onMeetingLeft: (cb) => {
3194
3231
  meetingLeftListeners.current.add(cb);
3195
3232
  return () => {
@@ -3308,6 +3345,18 @@ var useMeeting = (handlers) => {
3308
3345
  if (!handlers?.onEntryResponded) return;
3309
3346
  return ctx.onEntryResponded(handlers.onEntryResponded);
3310
3347
  }, [handlers?.onEntryResponded]);
3348
+ (0, import_react4.useEffect)(() => {
3349
+ if (!handlers?.onJoinRequestCanceled) return;
3350
+ return ctx.onJoinRequestCanceled(handlers.onJoinRequestCanceled);
3351
+ }, [handlers?.onJoinRequestCanceled]);
3352
+ (0, import_react4.useEffect)(() => {
3353
+ if (!handlers?.onParticipantRemoved) return;
3354
+ return ctx.onParticipantRemoved(handlers.onParticipantRemoved);
3355
+ }, [handlers?.onParticipantRemoved]);
3356
+ (0, import_react4.useEffect)(() => {
3357
+ if (!handlers?.onParticipantPermissionsChanged) return;
3358
+ return ctx.onParticipantPermissionsChanged(handlers.onParticipantPermissionsChanged);
3359
+ }, [handlers?.onParticipantPermissionsChanged]);
3311
3360
  (0, import_react4.useEffect)(() => {
3312
3361
  if (!handlers?.onMeetingLeft) return;
3313
3362
  return ctx.onMeetingLeft(handlers.onMeetingLeft);