@ai-matrx/meet 0.9.0 → 0.10.0

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.
@@ -1,6 +1,6 @@
1
- export { A as AiPanel, a as AttendanceNotice, b as Avatar, C as Captions, c as ChatPanel, d as ConnectionDot, e as ConsentNotice, f as ControlBar, g as ControlButton, H as HostMenu, L as LobbyPanel, M as MeetSkinRoom, h as MeetingOverlays, i as MenuItem, P as PanelShell, j as ParticipantTile, k as PeoplePanel, l as PersonMenu, m as Popover, n as PreJoin, Q as QualityBars, R as ReactionOverlay, o as RecordingIndicator, S as SettingsPanel, p as ShortcutsSheet, q as Stage, T as Toast } from '../components-BeCQ9h0h.cjs';
1
+ export { A as AiPanel, a as AttendanceNotice, b as Avatar, C as Captions, c as ChatPanel, d as ConnectionDot, e as ConsentNotice, f as ControlBar, g as ControlButton, H as HostMenu, L as LobbyPanel, M as MeetSkinRoom, h as MeetingOverlays, i as MenuItem, P as PanelShell, j as ParticipantTile, k as PeoplePanel, l as PersonMenu, m as Popover, n as PreJoin, Q as QualityBars, R as ReactionOverlay, o as RecordingIndicator, S as SettingsPanel, p as ShortcutsSheet, q as Stage, T as Toast } from '../components-DKHfkEVB.cjs';
2
2
  import { ReactNode, SVGProps } from 'react';
3
- import { C as CollabPanel } from '../collab-B6scmSST.cjs';
3
+ import { C as CollabPanel } from '../collab-C2R-kQnV.cjs';
4
4
 
5
5
  /**
6
6
  * POLLS, Q&A, THE SHARED WHITEBOARD AND BREAKOUT ROOMS — the in-room surfaces (Meet wave 5).
@@ -1,6 +1,6 @@
1
- export { A as AiPanel, a as AttendanceNotice, b as Avatar, C as Captions, c as ChatPanel, d as ConnectionDot, e as ConsentNotice, f as ControlBar, g as ControlButton, H as HostMenu, L as LobbyPanel, M as MeetSkinRoom, h as MeetingOverlays, i as MenuItem, P as PanelShell, j as ParticipantTile, k as PeoplePanel, l as PersonMenu, m as Popover, n as PreJoin, Q as QualityBars, R as ReactionOverlay, o as RecordingIndicator, S as SettingsPanel, p as ShortcutsSheet, q as Stage, T as Toast } from '../components-D0TqyeiY.js';
1
+ export { A as AiPanel, a as AttendanceNotice, b as Avatar, C as Captions, c as ChatPanel, d as ConnectionDot, e as ConsentNotice, f as ControlBar, g as ControlButton, H as HostMenu, L as LobbyPanel, M as MeetSkinRoom, h as MeetingOverlays, i as MenuItem, P as PanelShell, j as ParticipantTile, k as PeoplePanel, l as PersonMenu, m as Popover, n as PreJoin, Q as QualityBars, R as ReactionOverlay, o as RecordingIndicator, S as SettingsPanel, p as ShortcutsSheet, q as Stage, T as Toast } from '../components-CMtSekZS.js';
2
2
  import { ReactNode, SVGProps } from 'react';
3
- import { C as CollabPanel } from '../collab-B6scmSST.js';
3
+ import { C as CollabPanel } from '../collab-C2R-kQnV.js';
4
4
 
5
5
  /**
6
6
  * POLLS, Q&A, THE SHARED WHITEBOARD AND BREAKOUT ROOMS — the in-room surfaces (Meet wave 5).
@@ -184,7 +184,17 @@ var MEET_ROUTES = {
184
184
  */
185
185
  collab: "/api/v1/meet/collab",
186
186
  /** Meet wave 5: translate finished caption lines into this viewer's language. */
187
- captionsTranslate: "/api/v1/meet/captions/translate"
187
+ captionsTranslate: "/api/v1/meet/captions/translate",
188
+ /**
189
+ * S4 — THE STATE READ (CORE-DESIGN §2.6): `GET ?meeting_id=` with `x-meet-pass`. This
190
+ * person's admission (lazy expiry applied), whether anyone who can admit is here, the run's
191
+ * phase. Read every `waiting_poll_seconds` while waiting and on every `mx.state.changed`.
192
+ */
193
+ state: "/api/v1/meet/state",
194
+ /** S4: `withdraw` (stop waiting) or `leave` (close this tab); the pass may ride in the body. */
195
+ leave: "/api/v1/meet/leave",
196
+ /** S4: a pass holder (guests included) saw the recording notice, for this run. */
197
+ consent: "/api/v1/meet/consent"
188
198
  };
189
199
 
190
200
  // src/core/recording.ts
@@ -366,7 +376,7 @@ function observedPhase(input) {
366
376
  case "left":
367
377
  return "prejoin";
368
378
  case "lobby":
369
- return "waiting:knocking";
379
+ return waitingPhase(snapshot);
370
380
  case "requesting-token":
371
381
  case "connecting":
372
382
  return "joining";
@@ -375,6 +385,24 @@ function observedPhase(input) {
375
385
  return "in_call";
376
386
  }
377
387
  }
388
+ function waitingPhase(snapshot) {
389
+ switch (snapshot.waiting?.admission) {
390
+ case "waiting_host":
391
+ return "waiting:host_not_started";
392
+ case "denied":
393
+ return "denied";
394
+ case "expired":
395
+ return "knock_expired";
396
+ case "withdrawn":
397
+ return "left";
398
+ case "ended":
399
+ return "ended";
400
+ case "removed":
401
+ return "refused:removed";
402
+ default:
403
+ return "waiting:knocking";
404
+ }
405
+ }
378
406
  var ADMITTER_ROLES = /* @__PURE__ */ new Set(["host", "cohost"]);
379
407
  function observe(input) {
380
408
  const { snapshot } = input;
@@ -389,7 +417,7 @@ function observe(input) {
389
417
  reason: phase.startsWith("refused:") ? phase.slice("refused:".length) : null,
390
418
  role,
391
419
  connection: snapshot?.phase === "reconnecting" ? "reconnecting" : "stable",
392
- hostPresent: inCall && snapshot !== null ? snapshot.participants.some((p) => ADMITTER_ROLES.has(p.role)) : null,
420
+ hostPresent: inCall && snapshot !== null ? snapshot.participants.some((p) => ADMITTER_ROLES.has(p.role)) : snapshot?.phase === "lobby" ? snapshot.waiting?.admittersPresent ?? null : null,
393
421
  lobbyCount: canAdmit && snapshot !== null ? snapshot.lobby.filter((entry) => entry.state === "knocking").length : 0,
394
422
  recording: snapshot?.recording === "recording" || snapshot?.recording === "stopping",
395
423
  audioBlocked: null,
@@ -935,12 +963,22 @@ function useLobby() {
935
963
  async () => requireSession(session, "admitAll").admitAll(),
936
964
  [session]
937
965
  ),
938
- knock: useCallback2(
939
- (roomName) => requireSession(session, "knock").knock(roomName),
966
+ undeny: useCallback2(
967
+ async (entry) => requireSession(session, "undeny").undeny(entry),
940
968
  [session]
941
969
  )
942
970
  };
943
971
  }
972
+ function useWaiting() {
973
+ const host = useMeetHost();
974
+ const snapshot = useMeetSnapshot();
975
+ const session = host?.meetings ?? null;
976
+ return {
977
+ waiting: snapshot?.waiting ?? null,
978
+ withdraw: useCallback2(async () => requireSession(session, "withdraw").withdraw(), [session]),
979
+ askAgain: useCallback2(async () => requireSession(session, "askAgain").askAgain(), [session])
980
+ };
981
+ }
944
982
  function useRecording() {
945
983
  const host = useMeetHost();
946
984
  const snapshot = useMeetSnapshot();
@@ -4427,7 +4465,7 @@ function MeetSkinRoom({
4427
4465
  ) });
4428
4466
  }
4429
4467
  if (phase === "lobby") {
4430
- return /* @__PURE__ */ jsx5("div", { className: "mx-meet mx-meet--lobby", children: /* @__PURE__ */ jsx5(WaitingRoom, { roomName, host }) });
4468
+ return /* @__PURE__ */ jsx5("div", { className: "mx-meet mx-meet--lobby", children: /* @__PURE__ */ jsx5(WaitingRoom, { host, ...onLeave !== void 0 ? { onLeave } : {} }) });
4431
4469
  }
4432
4470
  return /* @__PURE__ */ jsxs3("div", { className: "mx-meet", children: [
4433
4471
  /* @__PURE__ */ jsx5(ConsentNotice, {}),
@@ -4452,21 +4490,58 @@ function MeetSkinRoom({
4452
4490
  /* @__PURE__ */ jsx5(ControlBar, { ...onLeave !== void 0 ? { onLeave } : {} })
4453
4491
  ] });
4454
4492
  }
4455
- function WaitingRoom({ roomName, host }) {
4456
- const knocked = useRef6(false);
4457
- useEffect6(() => {
4458
- if (knocked.current) return;
4459
- knocked.current = true;
4460
- host.meetings.knock(roomName);
4461
- }, [host, roomName]);
4493
+ function WaitingRoom({ host, onLeave }) {
4494
+ const { waiting, withdraw, askAgain } = useWaiting();
4495
+ const [busy, setBusy] = useState4(false);
4496
+ const admission = waiting?.admission ?? "knocking";
4497
+ const run = (action) => () => {
4498
+ setBusy(true);
4499
+ void action().catch(() => void 0).finally(() => setBusy(false));
4500
+ };
4501
+ const home = /* @__PURE__ */ jsx5(Button, { type: "button", variant: "outline", onClick: () => onLeave !== void 0 ? onLeave() : window.location.assign("/"), children: "Back to home" });
4502
+ let title;
4503
+ let line = null;
4504
+ let actions;
4505
+ switch (admission) {
4506
+ case "waiting_host":
4507
+ title = "Waiting for the host to start";
4508
+ actions = /* @__PURE__ */ jsx5(Button, { type: "button", variant: "outline", disabled: busy, onClick: run(withdraw), children: "Leave" });
4509
+ break;
4510
+ case "denied":
4511
+ title = "The host declined your request";
4512
+ actions = /* @__PURE__ */ jsxs3(Fragment, { children: [
4513
+ waiting?.reknockAllowed === true ? /* @__PURE__ */ jsx5(Button, { type: "button", disabled: busy, onClick: run(askAgain), children: "Ask to join again" }) : null,
4514
+ home
4515
+ ] });
4516
+ break;
4517
+ case "expired":
4518
+ title = "No one responded";
4519
+ actions = /* @__PURE__ */ jsxs3(Fragment, { children: [
4520
+ /* @__PURE__ */ jsx5(Button, { type: "button", disabled: busy, onClick: run(askAgain), children: "Ask again" }),
4521
+ home
4522
+ ] });
4523
+ break;
4524
+ case "withdrawn":
4525
+ title = "You left the waiting room";
4526
+ actions = /* @__PURE__ */ jsxs3(Fragment, { children: [
4527
+ /* @__PURE__ */ jsx5(Button, { type: "button", disabled: busy, onClick: run(askAgain), children: "Rejoin" }),
4528
+ home
4529
+ ] });
4530
+ break;
4531
+ case "ended":
4532
+ title = "The meeting has ended";
4533
+ actions = home;
4534
+ break;
4535
+ default:
4536
+ title = "Waiting for the host to let you in";
4537
+ line = waiting?.admittersPresent === false ? "The host isn't here yet" : null;
4538
+ actions = /* @__PURE__ */ jsx5(Button, { type: "button", variant: "outline", disabled: busy, onClick: run(withdraw), children: "Cancel request" });
4539
+ }
4462
4540
  return /* @__PURE__ */ jsxs3("div", { className: "mx-meet__waiting", children: [
4463
4541
  /* @__PURE__ */ jsx5(Avatar, { name: host.identity.displayName, url: host.identity.avatarUrl, size: 72 }),
4464
- /* @__PURE__ */ jsx5("h1", { className: "mx-meet__prejoin-title", children: "Waiting for the host to let you in" }),
4465
- /* @__PURE__ */ jsxs3("p", { className: "mx-meet__empty-body", children: [
4466
- "You are in the waiting room as ",
4467
- host.identity.displayName,
4468
- ". You will join automatically once you are admitted."
4469
- ] })
4542
+ /* @__PURE__ */ jsx5("h1", { className: "mx-meet__prejoin-title", children: title }),
4543
+ line !== null ? /* @__PURE__ */ jsx5("p", { className: "mx-meet__empty-body", role: "status", "data-meet-notice": "host-absent", children: line }) : null,
4544
+ /* @__PURE__ */ jsx5("div", { className: "mx-meet__waiting-actions", children: actions })
4470
4545
  ] });
4471
4546
  }
4472
4547
  function HostMenu() {