@ai-matrx/meet 0.11.37 → 0.11.39

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/react.js CHANGED
@@ -841,6 +841,12 @@ var MEET_ROUTES = {
841
841
  state: "/api/v1/meet/state",
842
842
  /** S4: `withdraw` (stop waiting) or `leave` (close this tab); the pass may ride in the body. */
843
843
  leave: "/api/v1/meet/leave",
844
+ /**
845
+ * S8: a host's browser just called an admission DOOR (`meet_admit` · `meet_deny` ·
846
+ * `meet_undeny` · `meet_admit_all`). Payload-free: the server republishes the room's
847
+ * replicated state (the People badge's waiting count) from the database truth.
848
+ */
849
+ admissionChanged: "/api/v1/meet/admission/changed",
844
850
  /** S4: a pass holder (guests included) saw the recording notice, for this run. */
845
851
  consent: "/api/v1/meet/consent"
846
852
  };
@@ -4313,6 +4319,34 @@ function createMeetingSession(options) {
4313
4319
  function hint() {
4314
4320
  channel?.send(MEET_EVENTS.stateChanged, { v: null });
4315
4321
  }
4322
+ async function tellServerAdmissionChanged(operation) {
4323
+ const meeting = store.snapshot().meeting;
4324
+ if (meeting === null) return;
4325
+ const pass = options.resolvePass?.() ?? null;
4326
+ try {
4327
+ const response = await options.api.request({
4328
+ path: MEET_ROUTES.admissionChanged,
4329
+ method: "POST",
4330
+ requireAuth: false,
4331
+ operation,
4332
+ body: { meeting_id: meeting.id },
4333
+ ...pass !== null ? { headers: { [MEETING_PASS_HEADER]: pass } } : {}
4334
+ });
4335
+ if (!response.ok) {
4336
+ report(
4337
+ "warn",
4338
+ `${operation}: the server answered ${response.status} when told about the admission change`,
4339
+ "The decision was saved. The waiting count in the room may lag until the next change."
4340
+ );
4341
+ }
4342
+ } catch (error) {
4343
+ report(
4344
+ "warn",
4345
+ `${operation}: ${String(error)}`,
4346
+ "The decision was saved. The waiting count in the room may lag until the next change."
4347
+ );
4348
+ }
4349
+ }
4316
4350
  async function refreshQueue() {
4317
4351
  const meeting = store.snapshot().meeting;
4318
4352
  if (meeting === null || isGuest(identity) || !isHostRole(effectiveRole(store.snapshot()))) return;
@@ -4468,6 +4502,7 @@ function createMeetingSession(options) {
4468
4502
  decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
4469
4503
  decidedBy: by
4470
4504
  });
4505
+ await tellServerAdmissionChanged("meet.admit");
4471
4506
  hint();
4472
4507
  },
4473
4508
  async undeny(entry) {
@@ -4480,6 +4515,7 @@ function createMeetingSession(options) {
4480
4515
  byUserId: by
4481
4516
  });
4482
4517
  store.upsertLobby({ ...entry, state: decidedState(row.admissionState), decidedAt: (/* @__PURE__ */ new Date()).toISOString(), decidedBy: by });
4518
+ await tellServerAdmissionChanged("meet.undeny");
4483
4519
  hint();
4484
4520
  },
4485
4521
  async admitAll() {
@@ -4489,6 +4525,7 @@ function createMeetingSession(options) {
4489
4525
  for (const row of rows) {
4490
4526
  store.setAdmission(row.identity, row.admissionState, by);
4491
4527
  }
4528
+ await tellServerAdmissionChanged("meet.admitAll");
4492
4529
  hint();
4493
4530
  },
4494
4531
  startWaiting() {
@@ -6276,7 +6313,22 @@ function createInRoomClient(options) {
6276
6313
  function refusal2(response, operation, remedy) {
6277
6314
  return refusalFromResponse(response, operation, remedy);
6278
6315
  }
6279
- return {
6316
+ let toldPresenting = false;
6317
+ let tellChain = Promise.resolve();
6318
+ store.subscribe(() => {
6319
+ const local = store.snapshot().participants.find((p) => p.isLocal);
6320
+ const sharing = local?.screenSharing === true;
6321
+ if (sharing === toldPresenting || local === void 0) return;
6322
+ toldPresenting = sharing;
6323
+ const on = sharing;
6324
+ tellChain = tellChain.then(() => client.moderate({ action: "present", on })).then(
6325
+ () => void 0,
6326
+ (error) => {
6327
+ console.warn(`[meet] the server did not take presenter=${String(on)}: ${String(error)}`);
6328
+ }
6329
+ );
6330
+ });
6331
+ const client = {
6280
6332
  async moderate(request) {
6281
6333
  const operation = `meet.moderate(${request.action})`;
6282
6334
  const hdrs = headers();
@@ -6481,6 +6533,7 @@ function createInRoomClient(options) {
6481
6533
  });
6482
6534
  }
6483
6535
  };
6536
+ return client;
6484
6537
  }
6485
6538
 
6486
6539
  // src/core/livekit-driver.ts
@@ -8147,11 +8200,7 @@ function useRoom() {
8147
8200
  toggleScreenShare: useCallback2(async () => {
8148
8201
  const on = !(local?.screenSharing ?? false);
8149
8202
  await requireEngine(engine, "toggleScreenShare").setScreenShareEnabled(on);
8150
- const sharing = host?.store.snapshot().participants.find((p) => p.isLocal)?.screenSharing ?? false;
8151
- if (host !== null && sharing === on) {
8152
- await host.inRoom.moderate({ action: "present", on }).catch(() => void 0);
8153
- }
8154
- }, [engine, host, local]),
8203
+ }, [engine, local]),
8155
8204
  // S8: a hand is SERVER state (`/moderate raise_hand · lower_hand`, server time), replicated
8156
8205
  // back as the `matrx.hand` attribute — no client sets its own hand on the wire.
8157
8206
  toggleHand: useCallback2(async () => {
@@ -11354,7 +11403,16 @@ function LeaveControl({ onLeave }) {
11354
11403
  /* @__PURE__ */ jsx6("button", { type: "button", className: "mx-meet__menu-item mx-meet__menu-item--danger", onClick: endNow, children: words.end_for_all }),
11355
11404
  /* @__PURE__ */ jsx6("button", { type: "button", className: "mx-meet__menu-item", onClick: () => setOpen("menu"), children: "Cancel" })
11356
11405
  ] }) : null,
11357
- failure !== null ? /* @__PURE__ */ jsx6("p", { className: "mx-meet__menu-note", role: "alert", children: failure }) : null
11406
+ failure !== null ? /* @__PURE__ */ jsx6(
11407
+ ErrorBox,
11408
+ {
11409
+ className: "mx-meet__menu-note",
11410
+ message: failure,
11411
+ operation: "Complete this meeting action",
11412
+ origin: "meet/components",
11413
+ children: failure
11414
+ }
11415
+ ) : null
11358
11416
  ] }) }) : null
11359
11417
  ] });
11360
11418
  }