@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.mjs CHANGED
@@ -279,6 +279,9 @@ var MeetingState = class {
279
279
  this.localParticipant = {
280
280
  id: patch.id ?? "",
281
281
  name: patch.name ?? "",
282
+ isHost: patch.isHost ?? false,
283
+ isModerator: patch.isModerator ?? false,
284
+ permissions: patch.permissions,
282
285
  media: {
283
286
  stream: patch.media?.stream ?? null,
284
287
  // ◄ FIX: Capture the stream from the patch here
@@ -318,6 +321,9 @@ var MeetingState = class {
318
321
  ...prev,
319
322
  id: patch.id ?? prev.id,
320
323
  name: patch.name ?? prev.name,
324
+ isHost: patch.isHost ?? prev.isHost,
325
+ isModerator: patch.isModerator ?? prev.isModerator,
326
+ permissions: patch.permissions ?? prev.permissions,
321
327
  media: nextMedia
322
328
  };
323
329
  this.notify("localParticipant");
@@ -1755,8 +1761,9 @@ var SFUClient = class {
1755
1761
  }
1756
1762
  }
1757
1763
  async cancelJoinRequest(requestId) {
1758
- if (!requestId) throw new Error("requestId is required");
1759
- if (!this.send({ type: "cancel_join_request", payload: { request_id: requestId } })) {
1764
+ const id = requestId || this.pendingJoinRequestId;
1765
+ if (!id) return;
1766
+ if (!this.send({ type: "cancel_join_request", payload: { request_id: id } })) {
1760
1767
  throw new Error("SFU signaling is not connected");
1761
1768
  }
1762
1769
  this.pendingJoinRequestId = null;
@@ -2332,7 +2339,7 @@ var VideoSDKCore = class {
2332
2339
  onParticipantPermissionsChanged: (participantId, permissions) => {
2333
2340
  if (participantId === this.myId) {
2334
2341
  const current = this.state.localParticipant;
2335
- this.state.updateLocalParticipant({ id: this.myId, name: this.participantName, isHost: Boolean(permissions?.moderate) && current?.isHost, isModerator: Boolean(permissions?.moderate), permissions });
2342
+ this.state.updateLocalParticipant({ id: this.myId, name: this.participantName, isHost: current?.isHost, isModerator: Boolean(permissions?.moderate), permissions });
2336
2343
  }
2337
2344
  },
2338
2345
  onJoinRequested: (request) => {
@@ -2941,6 +2948,9 @@ var MeetingProvider = ({
2941
2948
  const entryResponseListeners = useRef(
2942
2949
  /* @__PURE__ */ new Set()
2943
2950
  );
2951
+ const joinRequestCanceledListeners = useRef(/* @__PURE__ */ new Set());
2952
+ const participantRemovedListeners = useRef(/* @__PURE__ */ new Set());
2953
+ const participantPermissionsChangedListeners = useRef(/* @__PURE__ */ new Set());
2944
2954
  const meetingLeftListeners = useRef(/* @__PURE__ */ new Set());
2945
2955
  const trackStateListeners = useRef(/* @__PURE__ */ new Set());
2946
2956
  const recordingStartedListeners = useRef(/* @__PURE__ */ new Set());
@@ -2972,6 +2982,15 @@ var MeetingProvider = ({
2972
2982
  onEntryResponded: (p, d) => {
2973
2983
  entryResponseListeners.current.forEach((fn) => fn(p, d));
2974
2984
  },
2985
+ onJoinRequestCanceled: (requestId) => {
2986
+ joinRequestCanceledListeners.current.forEach((fn) => fn(requestId));
2987
+ },
2988
+ onParticipantRemoved: (participantId, removedBy) => {
2989
+ participantRemovedListeners.current.forEach((fn) => fn(participantId, removedBy));
2990
+ },
2991
+ onParticipantPermissionsChanged: (participantId, permissions) => {
2992
+ participantPermissionsChangedListeners.current.forEach((fn) => fn(participantId, permissions));
2993
+ },
2975
2994
  onMeetingLeft: () => {
2976
2995
  meetingLeftListeners.current.forEach((fn) => fn());
2977
2996
  },
@@ -3160,6 +3179,24 @@ var MeetingProvider = ({
3160
3179
  entryResponseListeners.current.delete(cb);
3161
3180
  };
3162
3181
  },
3182
+ onJoinRequestCanceled: (cb) => {
3183
+ joinRequestCanceledListeners.current.add(cb);
3184
+ return () => {
3185
+ joinRequestCanceledListeners.current.delete(cb);
3186
+ };
3187
+ },
3188
+ onParticipantRemoved: (cb) => {
3189
+ participantRemovedListeners.current.add(cb);
3190
+ return () => {
3191
+ participantRemovedListeners.current.delete(cb);
3192
+ };
3193
+ },
3194
+ onParticipantPermissionsChanged: (cb) => {
3195
+ participantPermissionsChangedListeners.current.add(cb);
3196
+ return () => {
3197
+ participantPermissionsChangedListeners.current.delete(cb);
3198
+ };
3199
+ },
3163
3200
  onMeetingLeft: (cb) => {
3164
3201
  meetingLeftListeners.current.add(cb);
3165
3202
  return () => {
@@ -3278,6 +3315,18 @@ var useMeeting = (handlers) => {
3278
3315
  if (!handlers?.onEntryResponded) return;
3279
3316
  return ctx.onEntryResponded(handlers.onEntryResponded);
3280
3317
  }, [handlers?.onEntryResponded]);
3318
+ useEffect3(() => {
3319
+ if (!handlers?.onJoinRequestCanceled) return;
3320
+ return ctx.onJoinRequestCanceled(handlers.onJoinRequestCanceled);
3321
+ }, [handlers?.onJoinRequestCanceled]);
3322
+ useEffect3(() => {
3323
+ if (!handlers?.onParticipantRemoved) return;
3324
+ return ctx.onParticipantRemoved(handlers.onParticipantRemoved);
3325
+ }, [handlers?.onParticipantRemoved]);
3326
+ useEffect3(() => {
3327
+ if (!handlers?.onParticipantPermissionsChanged) return;
3328
+ return ctx.onParticipantPermissionsChanged(handlers.onParticipantPermissionsChanged);
3329
+ }, [handlers?.onParticipantPermissionsChanged]);
3281
3330
  useEffect3(() => {
3282
3331
  if (!handlers?.onMeetingLeft) return;
3283
3332
  return ctx.onMeetingLeft(handlers.onMeetingLeft);