@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.cjs CHANGED
@@ -1162,6 +1162,12 @@ var MEET_ROUTES = {
1162
1162
  state: "/api/v1/meet/state",
1163
1163
  /** S4: `withdraw` (stop waiting) or `leave` (close this tab); the pass may ride in the body. */
1164
1164
  leave: "/api/v1/meet/leave",
1165
+ /**
1166
+ * S8: a host's browser just called an admission DOOR (`meet_admit` · `meet_deny` ·
1167
+ * `meet_undeny` · `meet_admit_all`). Payload-free: the server republishes the room's
1168
+ * replicated state (the People badge's waiting count) from the database truth.
1169
+ */
1170
+ admissionChanged: "/api/v1/meet/admission/changed",
1165
1171
  /** S4: a pass holder (guests included) saw the recording notice, for this run. */
1166
1172
  consent: "/api/v1/meet/consent"
1167
1173
  };
@@ -4634,6 +4640,34 @@ function createMeetingSession(options) {
4634
4640
  function hint() {
4635
4641
  channel?.send(MEET_EVENTS.stateChanged, { v: null });
4636
4642
  }
4643
+ async function tellServerAdmissionChanged(operation) {
4644
+ const meeting = store.snapshot().meeting;
4645
+ if (meeting === null) return;
4646
+ const pass = options.resolvePass?.() ?? null;
4647
+ try {
4648
+ const response = await options.api.request({
4649
+ path: MEET_ROUTES.admissionChanged,
4650
+ method: "POST",
4651
+ requireAuth: false,
4652
+ operation,
4653
+ body: { meeting_id: meeting.id },
4654
+ ...pass !== null ? { headers: { [MEETING_PASS_HEADER]: pass } } : {}
4655
+ });
4656
+ if (!response.ok) {
4657
+ report(
4658
+ "warn",
4659
+ `${operation}: the server answered ${response.status} when told about the admission change`,
4660
+ "The decision was saved. The waiting count in the room may lag until the next change."
4661
+ );
4662
+ }
4663
+ } catch (error) {
4664
+ report(
4665
+ "warn",
4666
+ `${operation}: ${String(error)}`,
4667
+ "The decision was saved. The waiting count in the room may lag until the next change."
4668
+ );
4669
+ }
4670
+ }
4637
4671
  async function refreshQueue() {
4638
4672
  const meeting = store.snapshot().meeting;
4639
4673
  if (meeting === null || isGuest(identity) || !isHostRole(effectiveRole(store.snapshot()))) return;
@@ -4789,6 +4823,7 @@ function createMeetingSession(options) {
4789
4823
  decidedAt: (/* @__PURE__ */ new Date()).toISOString(),
4790
4824
  decidedBy: by
4791
4825
  });
4826
+ await tellServerAdmissionChanged("meet.admit");
4792
4827
  hint();
4793
4828
  },
4794
4829
  async undeny(entry) {
@@ -4801,6 +4836,7 @@ function createMeetingSession(options) {
4801
4836
  byUserId: by
4802
4837
  });
4803
4838
  store.upsertLobby({ ...entry, state: decidedState(row.admissionState), decidedAt: (/* @__PURE__ */ new Date()).toISOString(), decidedBy: by });
4839
+ await tellServerAdmissionChanged("meet.undeny");
4804
4840
  hint();
4805
4841
  },
4806
4842
  async admitAll() {
@@ -4810,6 +4846,7 @@ function createMeetingSession(options) {
4810
4846
  for (const row of rows) {
4811
4847
  store.setAdmission(row.identity, row.admissionState, by);
4812
4848
  }
4849
+ await tellServerAdmissionChanged("meet.admitAll");
4813
4850
  hint();
4814
4851
  },
4815
4852
  startWaiting() {
@@ -6595,7 +6632,22 @@ function createInRoomClient(options) {
6595
6632
  function refusal2(response, operation, remedy) {
6596
6633
  return refusalFromResponse(response, operation, remedy);
6597
6634
  }
6598
- return {
6635
+ let toldPresenting = false;
6636
+ let tellChain = Promise.resolve();
6637
+ store.subscribe(() => {
6638
+ const local = store.snapshot().participants.find((p) => p.isLocal);
6639
+ const sharing = local?.screenSharing === true;
6640
+ if (sharing === toldPresenting || local === void 0) return;
6641
+ toldPresenting = sharing;
6642
+ const on = sharing;
6643
+ tellChain = tellChain.then(() => client.moderate({ action: "present", on })).then(
6644
+ () => void 0,
6645
+ (error) => {
6646
+ console.warn(`[meet] the server did not take presenter=${String(on)}: ${String(error)}`);
6647
+ }
6648
+ );
6649
+ });
6650
+ const client = {
6599
6651
  async moderate(request) {
6600
6652
  const operation = `meet.moderate(${request.action})`;
6601
6653
  const hdrs = headers();
@@ -6800,6 +6852,7 @@ function createInRoomClient(options) {
6800
6852
  });
6801
6853
  }
6802
6854
  };
6855
+ return client;
6803
6856
  }
6804
6857
 
6805
6858
  // src/core/livekit-driver.ts
@@ -8466,11 +8519,7 @@ function useRoom() {
8466
8519
  toggleScreenShare: (0, import_react4.useCallback)(async () => {
8467
8520
  const on = !(local?.screenSharing ?? false);
8468
8521
  await requireEngine(engine, "toggleScreenShare").setScreenShareEnabled(on);
8469
- const sharing = host?.store.snapshot().participants.find((p) => p.isLocal)?.screenSharing ?? false;
8470
- if (host !== null && sharing === on) {
8471
- await host.inRoom.moderate({ action: "present", on }).catch(() => void 0);
8472
- }
8473
- }, [engine, host, local]),
8522
+ }, [engine, local]),
8474
8523
  // S8: a hand is SERVER state (`/moderate raise_hand · lower_hand`, server time), replicated
8475
8524
  // back as the `matrx.hand` attribute — no client sets its own hand on the wire.
8476
8525
  toggleHand: (0, import_react4.useCallback)(async () => {
@@ -11673,7 +11722,16 @@ function LeaveControl({ onLeave }) {
11673
11722
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mx-meet__menu-item mx-meet__menu-item--danger", onClick: endNow, children: words.end_for_all }),
11674
11723
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mx-meet__menu-item", onClick: () => setOpen("menu"), children: "Cancel" })
11675
11724
  ] }) : null,
11676
- failure !== null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mx-meet__menu-note", role: "alert", children: failure }) : null
11725
+ failure !== null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
11726
+ import_design_system.ErrorBox,
11727
+ {
11728
+ className: "mx-meet__menu-note",
11729
+ message: failure,
11730
+ operation: "Complete this meeting action",
11731
+ origin: "meet/components",
11732
+ children: failure
11733
+ }
11734
+ ) : null
11677
11735
  ] }) }) : null
11678
11736
  ] });
11679
11737
  }