@ai-matrx/meet 0.11.35 → 0.11.37
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/CHANGELOG.md +12 -0
- package/dist/core.cjs +99 -86
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +73 -22
- package/dist/core.d.ts +73 -22
- package/dist/core.js +99 -86
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +99 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +99 -86
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +213 -106
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +20 -4
- package/dist/react.d.ts +20 -4
- package/dist/react.js +213 -106
- package/dist/react.js.map +1 -1
- package/dist/skins/meet.cjs +126 -20
- package/dist/skins/meet.cjs.map +1 -1
- package/dist/skins/meet.js +126 -20
- package/dist/skins/meet.js.map +1 -1
- package/dist/styles.css +7 -0
- package/package.json +3 -3
package/dist/skins/meet.cjs
CHANGED
|
@@ -243,6 +243,19 @@ function normalizeDeviceError(error, operation) {
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
// src/core/leave.ts
|
|
247
|
+
var DEFAULT_LEAVE_POLICY = { hostLeavePrompt: "leave_or_end", endConfirm: false };
|
|
248
|
+
function leaveChoices(args) {
|
|
249
|
+
if (args.role !== "host") return ["leave"];
|
|
250
|
+
switch (args.policy.hostLeavePrompt) {
|
|
251
|
+
case "must_assign_or_end":
|
|
252
|
+
return args.othersPresent ? ["assign_and_leave", "end_for_all"] : ["leave", "end_for_all"];
|
|
253
|
+
case "leave_only":
|
|
254
|
+
case "leave_or_end":
|
|
255
|
+
return ["leave", "end_for_all"];
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
246
259
|
// src/core/tokens.ts
|
|
247
260
|
var MEET_ROUTES = {
|
|
248
261
|
token: "/api/v1/meet/token",
|
|
@@ -1204,6 +1217,10 @@ function useRoom() {
|
|
|
1204
1217
|
async (request) => requireEngine(engine, "join").join(request),
|
|
1205
1218
|
[engine]
|
|
1206
1219
|
),
|
|
1220
|
+
checkElsewhere: (0, import_react5.useCallback)(
|
|
1221
|
+
async (roomName) => engine === null ? false : engine.checkElsewhere(roomName),
|
|
1222
|
+
[engine]
|
|
1223
|
+
),
|
|
1207
1224
|
leave: (0, import_react5.useCallback)(async () => requireEngine(engine, "leave").leave(), [engine]),
|
|
1208
1225
|
toggleMicrophone: (0, import_react5.useCallback)(
|
|
1209
1226
|
async () => requireEngine(engine, "toggleMicrophone").setMicrophoneEnabled(
|
|
@@ -1215,16 +1232,20 @@ function useRoom() {
|
|
|
1215
1232
|
async () => requireEngine(engine, "toggleCamera").setCameraEnabled(!(local?.cameraEnabled ?? false)),
|
|
1216
1233
|
[engine, local]
|
|
1217
1234
|
),
|
|
1218
|
-
toggleScreenShare: (0, import_react5.useCallback)(
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
)
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1235
|
+
toggleScreenShare: (0, import_react5.useCallback)(async () => {
|
|
1236
|
+
const on = !(local?.screenSharing ?? false);
|
|
1237
|
+
await requireEngine(engine, "toggleScreenShare").setScreenShareEnabled(on);
|
|
1238
|
+
const sharing = host?.store.snapshot().participants.find((p) => p.isLocal)?.screenSharing ?? false;
|
|
1239
|
+
if (host !== null && sharing === on) {
|
|
1240
|
+
await host.inRoom.moderate({ action: "present", on }).catch(() => void 0);
|
|
1241
|
+
}
|
|
1242
|
+
}, [engine, host, local]),
|
|
1243
|
+
// S8: a hand is SERVER state (`/moderate raise_hand · lower_hand`, server time), replicated
|
|
1244
|
+
// back as the `matrx.hand` attribute — no client sets its own hand on the wire.
|
|
1245
|
+
toggleHand: (0, import_react5.useCallback)(async () => {
|
|
1246
|
+
if (host === null) throw noRuntime("toggleHand");
|
|
1247
|
+
await host.inRoom.moderate({ action: local?.handRaised === true ? "lower_hand" : "raise_hand" });
|
|
1248
|
+
}, [host, local]),
|
|
1228
1249
|
react: (0, import_react5.useCallback)(
|
|
1229
1250
|
async (emoji) => requireEngine(engine, "react").react(emoji),
|
|
1230
1251
|
[engine]
|
|
@@ -1353,6 +1374,31 @@ function useWaiting() {
|
|
|
1353
1374
|
askAgain: (0, import_react5.useCallback)(async () => requireSession(session, "askAgain").askAgain(), [session])
|
|
1354
1375
|
};
|
|
1355
1376
|
}
|
|
1377
|
+
function useLeave() {
|
|
1378
|
+
const host = useMeetHost();
|
|
1379
|
+
const snapshot = useMeetSnapshot();
|
|
1380
|
+
const session = host?.meetings ?? null;
|
|
1381
|
+
const engine = host?.engine ?? null;
|
|
1382
|
+
const policy = snapshot?.leavePolicy ?? DEFAULT_LEAVE_POLICY;
|
|
1383
|
+
const participants = snapshot?.participants ?? [];
|
|
1384
|
+
const me = participants.find((p) => p.isLocal);
|
|
1385
|
+
const candidates = participants.filter((p) => !p.isLocal && !p.isAgent && p.role !== "viewer");
|
|
1386
|
+
const choices = leaveChoices({ policy, role: me?.role ?? null, othersPresent: candidates.length > 0 });
|
|
1387
|
+
return {
|
|
1388
|
+
choices,
|
|
1389
|
+
policy,
|
|
1390
|
+
candidates,
|
|
1391
|
+
leave: (0, import_react5.useCallback)(async () => requireEngine(engine, "leave").leave(), [engine]),
|
|
1392
|
+
endForAll: (0, import_react5.useCallback)(async () => requireSession(session, "endForAll").hostLeave("end_for_all"), [session]),
|
|
1393
|
+
assignAndLeave: (0, import_react5.useCallback)(
|
|
1394
|
+
async (person) => {
|
|
1395
|
+
await requireSession(session, "assignAndLeave").hostLeave({ assignTo: String(person.identity) });
|
|
1396
|
+
await requireEngine(engine, "leave").leave();
|
|
1397
|
+
},
|
|
1398
|
+
[session, engine]
|
|
1399
|
+
)
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1356
1402
|
function useRecording() {
|
|
1357
1403
|
const host = useMeetHost();
|
|
1358
1404
|
const snapshot = useMeetSnapshot();
|
|
@@ -3517,19 +3563,75 @@ function ControlBar({ onLeave }) {
|
|
|
3517
3563
|
] }) : null
|
|
3518
3564
|
] }) }) : null
|
|
3519
3565
|
] }),
|
|
3520
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3521
|
-
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LeaveControl, { onLeave })
|
|
3567
|
+
] })
|
|
3568
|
+
] });
|
|
3569
|
+
}
|
|
3570
|
+
var LEAVE_WORDS = {
|
|
3571
|
+
leave_or_end: { leave: "Leave call", assign_and_leave: "Assign a new host", end_for_all: "End call for everyone" },
|
|
3572
|
+
must_assign_or_end: { leave: "Leave meeting", assign_and_leave: "Assign a new host", end_for_all: "End meeting for all" },
|
|
3573
|
+
leave_only: { leave: "Leave", assign_and_leave: "Assign a new host", end_for_all: "End meeting" }
|
|
3574
|
+
};
|
|
3575
|
+
function LeaveControl({ onLeave }) {
|
|
3576
|
+
const leave = useLeave();
|
|
3577
|
+
const [open, setOpen] = (0, import_react10.useState)("none");
|
|
3578
|
+
const [failure, setFailure] = (0, import_react10.useState)(null);
|
|
3579
|
+
const words = LEAVE_WORDS[leave.policy.hostLeavePrompt];
|
|
3580
|
+
const run = (work, leaving) => {
|
|
3581
|
+
setFailure(null);
|
|
3582
|
+
void work().then(() => {
|
|
3583
|
+
setOpen("none");
|
|
3584
|
+
if (leaving) onLeave?.();
|
|
3585
|
+
}).catch((error) => setFailure(error instanceof Error ? error.message : String(error)));
|
|
3586
|
+
};
|
|
3587
|
+
const leaveNow = () => run(leave.leave, true);
|
|
3588
|
+
const endNow = () => run(leave.endForAll, false);
|
|
3589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "mx-meet__anchor", children: [
|
|
3590
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3591
|
+
ControlButton,
|
|
3592
|
+
{
|
|
3593
|
+
label: "Leave",
|
|
3594
|
+
danger: true,
|
|
3595
|
+
active: open !== "none",
|
|
3596
|
+
onClick: () => {
|
|
3597
|
+
if (leave.choices.length === 1 && leave.choices[0] === "leave") leaveNow();
|
|
3598
|
+
else setOpen(open === "none" ? "menu" : "none");
|
|
3599
|
+
},
|
|
3600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PhoneOffIcon, {})
|
|
3601
|
+
}
|
|
3602
|
+
),
|
|
3603
|
+
open !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Popover, { label: open === "assign" ? words.assign_and_leave : "Leave", onClose: () => setOpen("none"), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mx-meet__menu", "data-meet-leave-menu": leave.policy.hostLeavePrompt, children: [
|
|
3604
|
+
open === "menu" ? leave.choices.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3605
|
+
"button",
|
|
3522
3606
|
{
|
|
3523
|
-
|
|
3524
|
-
danger:
|
|
3607
|
+
type: "button",
|
|
3608
|
+
className: choice === "end_for_all" ? "mx-meet__menu-item mx-meet__menu-item--danger" : "mx-meet__menu-item",
|
|
3525
3609
|
onClick: () => {
|
|
3526
|
-
|
|
3527
|
-
|
|
3610
|
+
if (choice === "leave") leaveNow();
|
|
3611
|
+
else if (choice === "assign_and_leave") setOpen("assign");
|
|
3612
|
+
else if (leave.policy.endConfirm) setOpen("confirm");
|
|
3613
|
+
else endNow();
|
|
3528
3614
|
},
|
|
3529
|
-
children:
|
|
3530
|
-
}
|
|
3531
|
-
|
|
3532
|
-
|
|
3615
|
+
children: words[choice]
|
|
3616
|
+
},
|
|
3617
|
+
choice
|
|
3618
|
+
)) : null,
|
|
3619
|
+
open === "assign" ? leave.candidates.map((person) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3620
|
+
"button",
|
|
3621
|
+
{
|
|
3622
|
+
type: "button",
|
|
3623
|
+
className: "mx-meet__menu-item",
|
|
3624
|
+
onClick: () => run(() => leave.assignAndLeave(person), true),
|
|
3625
|
+
children: person.displayName
|
|
3626
|
+
},
|
|
3627
|
+
String(person.identity)
|
|
3628
|
+
)) : null,
|
|
3629
|
+
open === "confirm" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
3630
|
+
/* @__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 }),
|
|
3631
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "mx-meet__menu-item", onClick: () => setOpen("menu"), children: "Cancel" })
|
|
3632
|
+
] }) : null,
|
|
3633
|
+
failure !== null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "mx-meet__menu-note", role: "alert", children: failure }) : null
|
|
3634
|
+
] }) }) : null
|
|
3533
3635
|
] });
|
|
3534
3636
|
}
|
|
3535
3637
|
function useUnreadChat(open) {
|
|
@@ -4803,6 +4905,10 @@ function PreJoinBody({
|
|
|
4803
4905
|
(0, import_react10.useEffect)(() => {
|
|
4804
4906
|
void host.devices.refresh();
|
|
4805
4907
|
}, [host]);
|
|
4908
|
+
const { checkElsewhere } = room;
|
|
4909
|
+
(0, import_react10.useEffect)(() => {
|
|
4910
|
+
void checkElsewhere(roomName);
|
|
4911
|
+
}, [checkElsewhere, roomName]);
|
|
4806
4912
|
const joinWith = (secondDevice) => {
|
|
4807
4913
|
setJoining(true);
|
|
4808
4914
|
preview.release();
|