@nivaro/react 0.3.0 → 0.3.2
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +341 -0
- package/dist/index.js +764 -723
- package/dist/shared/components/ClientChaosToolbar.js +410 -0
- package/dist/shared/components/LoadErrorNote.js +49 -0
- package/dist/shared/components/PretendDown.js +258 -0
- package/dist/shared/components/ProfileView.js +54 -49
- package/dist/shared/components/QueryErrorState.js +16 -0
- package/dist/shared/components/ReportView.js +1351 -1338
- package/dist/shared/components/WidgetSlot.js +438 -418
- package/dist/shared/components/chaos/DeclareIncidentButton.js +72 -0
- package/dist/shared/components/chaos/DrillBanner.js +119 -0
- package/dist/shared/components/chaos/DrillTag.js +62 -0
- package/dist/shared/components/chaos/GameDayStrip.js +61 -0
- package/dist/shared/components/chat/huddle/HuddleAudioUi.js +95 -92
- package/dist/shared/components/chat/huddle/HuddleCallBar.js +69 -64
- package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +40 -39
- package/dist/shared/components/chat/huddle/HuddleStageTools.js +30 -27
- package/dist/shared/components/chat/huddle/huddle-dismiss.js +12 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +25 -20
- package/dist/shared/components/client-chaos-gate.js +51 -0
- package/dist/shared/components/integrations/console/SignalCard.js +172 -167
- package/dist/shared/components/layout-editor/EditorTopBar.js +108 -105
- package/dist/shared/components/layout-editor/LayoutEditor.js +514 -508
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +18 -10
- package/dist/shared/components/pipeline/PipelineEditorView.js +495 -479
- package/dist/shared/components/pipeline/TeamsView.js +184 -169
- package/dist/shared/lib/client-chaos.js +359 -0
- package/dist/shared/lib/load-error.js +26 -0
- package/dist/shared/lib/socket-realtime.js +31 -30
- package/dist/shared/lib/worker-socket.js +108 -89
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ var c = (h, t, e) => w(h, typeof t != "symbol" ? t + "" : t, e);
|
|
|
4
4
|
import { micConstraints as y, loadDevicePrefs as T } from "./huddle-device-prefs.js";
|
|
5
5
|
import { huddleLive as M } from "./huddle-live.js";
|
|
6
6
|
import { aggregateQuality as b } from "./huddle-quality.js";
|
|
7
|
-
import { SfuSession as
|
|
7
|
+
import { SfuSession as A, MESH_OVERLAP_MS as L } from "./huddle-sfu.js";
|
|
8
8
|
const p = {
|
|
9
9
|
room: null,
|
|
10
10
|
status: "idle",
|
|
@@ -18,8 +18,13 @@ const p = {
|
|
|
18
18
|
mode: "mesh",
|
|
19
19
|
micLabel: null,
|
|
20
20
|
handAt: null
|
|
21
|
-
}, V =
|
|
22
|
-
|
|
21
|
+
}, O = 15e3, V = {
|
|
22
|
+
video: { frameRate: 15, width: { ideal: 1920 }, height: { ideal: 1080 } },
|
|
23
|
+
audio: !1,
|
|
24
|
+
selfBrowserSurface: "include",
|
|
25
|
+
surfaceSwitching: "include"
|
|
26
|
+
};
|
|
27
|
+
function C(h, t) {
|
|
23
28
|
return h < t;
|
|
24
29
|
}
|
|
25
30
|
function g(h, t, e) {
|
|
@@ -31,15 +36,15 @@ function g(h, t, e) {
|
|
|
31
36
|
}
|
|
32
37
|
return s;
|
|
33
38
|
}
|
|
34
|
-
function
|
|
39
|
+
function $(h) {
|
|
35
40
|
const t = h.map((e) => e.name || "Someone");
|
|
36
41
|
return t.length === 0 ? "" : t.length === 1 ? t[0] : t.length === 2 ? `${t[0]} and ${t[1]}` : `${t[0]}, ${t[1]} and ${t.length - 2} other${t.length - 2 === 1 ? "" : "s"}`;
|
|
37
42
|
}
|
|
38
|
-
function
|
|
43
|
+
function q(h) {
|
|
39
44
|
const t = Math.max(0, Math.floor(h / 1e3)), e = Math.floor(t / 60), s = Math.floor(e / 60), i = String(e % 60).padStart(2, "0"), o = String(t % 60).padStart(2, "0");
|
|
40
45
|
return s ? `${s}:${i}:${o}` : `${e}:${o}`;
|
|
41
46
|
}
|
|
42
|
-
class
|
|
47
|
+
class I {
|
|
43
48
|
constructor() {
|
|
44
49
|
c(this, "state", p);
|
|
45
50
|
c(this, "listeners", /* @__PURE__ */ new Set());
|
|
@@ -112,7 +117,7 @@ class C {
|
|
|
112
117
|
// ── Transport ─────────────────────────────────────────────────────────────
|
|
113
118
|
/** Bind the host's socket adapter once; later calls with the same adapter are no-ops. */
|
|
114
119
|
attach(t, e, s) {
|
|
115
|
-
if (this.fetchIce = e, this.fetchSfu = s
|
|
120
|
+
if (this.fetchIce = e, s && (this.fetchSfu = s), this.transport !== t) {
|
|
116
121
|
for (const i of this.offs) i();
|
|
117
122
|
this.transport = t, M.attach(t), this.offs = [
|
|
118
123
|
t.on("huddle:peers", (i) => this.onPeers(i)),
|
|
@@ -230,7 +235,7 @@ class C {
|
|
|
230
235
|
this.ping && clearInterval(this.ping), this.ping = setInterval(() => {
|
|
231
236
|
var n;
|
|
232
237
|
this.state.room && ((n = this.transport) == null || n.emit("huddle:ping", { room: this.state.room }));
|
|
233
|
-
},
|
|
238
|
+
}, O), (this.state.muted || this.state.sharing) && ((r = this.transport) == null || r.emit("huddle:state", {
|
|
234
239
|
room: t.room,
|
|
235
240
|
muted: this.state.muted,
|
|
236
241
|
screen: this.state.sharing
|
|
@@ -287,7 +292,7 @@ class C {
|
|
|
287
292
|
let i;
|
|
288
293
|
try {
|
|
289
294
|
const f = await this.fetchSfu(e, s);
|
|
290
|
-
if (this.state.room !== e || this.state.self !== s || (i = new
|
|
295
|
+
if (this.state.room !== e || this.state.self !== s || (i = new A(), this.sfu = i, await i.connect(f, {
|
|
291
296
|
onTrack: (a, d, v) => this.onSfuTrack(a, d, v),
|
|
292
297
|
onTrackEnd: (a, d) => this.onSfuTrackEnd(a, d),
|
|
293
298
|
onReconnecting: () => {
|
|
@@ -315,7 +320,7 @@ class C {
|
|
|
315
320
|
});
|
|
316
321
|
return;
|
|
317
322
|
}
|
|
318
|
-
this.meshCloseTimer && clearTimeout(this.meshCloseTimer), this.meshCloseTimer = setTimeout(() => this.closeMeshLinks(),
|
|
323
|
+
this.meshCloseTimer && clearTimeout(this.meshCloseTimer), this.meshCloseTimer = setTimeout(() => this.closeMeshLinks(), L);
|
|
319
324
|
}
|
|
320
325
|
/** The SFU's labelled video for a peer (#2858): camera tile and shared screen, apart. */
|
|
321
326
|
sfuVideoOf(t) {
|
|
@@ -372,6 +377,8 @@ class C {
|
|
|
372
377
|
off: "Huddles are turned off on this instance.",
|
|
373
378
|
"no-dm": "Huddles run in channels and record rooms.",
|
|
374
379
|
"not-signed-in": "Sign in again to join.",
|
|
380
|
+
// One seat per person: joining from another window or app moves you there.
|
|
381
|
+
moved: "You joined this huddle from another window, so it ended here.",
|
|
375
382
|
unavailable: "The huddle service is unavailable right now."
|
|
376
383
|
};
|
|
377
384
|
this.teardown(), this.set({
|
|
@@ -399,7 +406,7 @@ class C {
|
|
|
399
406
|
if (this.links.has(t)) return this.links.get(t) ?? null;
|
|
400
407
|
const r = new RTCPeerConnection({ iceServers: o }), l = {
|
|
401
408
|
pc: r,
|
|
402
|
-
polite:
|
|
409
|
+
polite: C(s, t),
|
|
403
410
|
makingOffer: !1,
|
|
404
411
|
ignoreOffer: !1,
|
|
405
412
|
screenSender: null,
|
|
@@ -504,10 +511,7 @@ class C {
|
|
|
504
511
|
if (this.state.status !== "live" || this.state.sharing) return;
|
|
505
512
|
let t;
|
|
506
513
|
try {
|
|
507
|
-
t = await navigator.mediaDevices.getDisplayMedia(
|
|
508
|
-
video: { frameRate: 15, width: { ideal: 1920 }, height: { ideal: 1080 } },
|
|
509
|
-
audio: !1
|
|
510
|
-
});
|
|
514
|
+
t = await navigator.mediaDevices.getDisplayMedia(V);
|
|
511
515
|
} catch {
|
|
512
516
|
return;
|
|
513
517
|
}
|
|
@@ -596,7 +600,7 @@ async function k(h, t) {
|
|
|
596
600
|
const e = h;
|
|
597
601
|
typeof e.setSinkId == "function" && await e.setSinkId(t).catch(() => null);
|
|
598
602
|
}
|
|
599
|
-
const
|
|
603
|
+
const N = new I();
|
|
600
604
|
function F() {
|
|
601
605
|
if (typeof navigator > "u" || typeof window > "u")
|
|
602
606
|
return { audio: !1, screen: !1 };
|
|
@@ -607,10 +611,11 @@ function F() {
|
|
|
607
611
|
};
|
|
608
612
|
}
|
|
609
613
|
export {
|
|
610
|
-
|
|
611
|
-
q as
|
|
614
|
+
V as SCREEN_SHARE_OPTIONS,
|
|
615
|
+
q as formatElapsed,
|
|
616
|
+
N as huddleStore,
|
|
612
617
|
F as huddleSupport,
|
|
613
618
|
g as mergeRoster,
|
|
614
|
-
|
|
615
|
-
|
|
619
|
+
$ as peerSummary,
|
|
620
|
+
C as politeFor
|
|
616
621
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useQuery as C } from "@tanstack/react-query";
|
|
2
|
+
import { useSyncExternalStore as u, useEffect as w } from "react";
|
|
3
|
+
import { useApiFetchConfig as g } from "../context.js";
|
|
4
|
+
import { subscribeClientChaos as c, getClientChaos as f, canUseClientChaos as m, stopClientChaos as S, pretendDownVersion as T } from "../lib/client-chaos.js";
|
|
5
|
+
const E = ["client-chaos", "status"];
|
|
6
|
+
function _(d) {
|
|
7
|
+
const t = m(d), { apiBase: r, authHeaders: h, credentials: p } = g(), s = C({
|
|
8
|
+
queryKey: [...E, r],
|
|
9
|
+
enabled: t,
|
|
10
|
+
staleTime: 6e4,
|
|
11
|
+
retry: !1,
|
|
12
|
+
queryFn: async () => {
|
|
13
|
+
var o, i;
|
|
14
|
+
try {
|
|
15
|
+
const a = await fetch(`${r}/chaos/status`, {
|
|
16
|
+
headers: h,
|
|
17
|
+
credentials: p,
|
|
18
|
+
cache: "no-store"
|
|
19
|
+
});
|
|
20
|
+
if (a.status === 404) return { present: !1, allowed: !1, reason: null };
|
|
21
|
+
const e = await a.json().catch(() => null);
|
|
22
|
+
return a.ok ? {
|
|
23
|
+
present: !0,
|
|
24
|
+
allowed: ((o = e == null ? void 0 : e.data) == null ? void 0 : o.allowed) === !0,
|
|
25
|
+
reason: ((i = e == null ? void 0 : e.data) == null ? void 0 : i.reason) ?? null
|
|
26
|
+
} : {
|
|
27
|
+
present: !0,
|
|
28
|
+
allowed: !1,
|
|
29
|
+
reason: (e == null ? void 0 : e.error) ?? `The server said ${a.status}.`
|
|
30
|
+
};
|
|
31
|
+
} catch {
|
|
32
|
+
return { present: !1, allowed: !1, reason: null };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}), n = t ? s.data ? { loading: !1, ...s.data } : { loading: s.isLoading, present: !1, allowed: !1, reason: null } : { loading: !1, present: !1, allowed: !1, reason: null }, l = !n.loading && !n.allowed && (s.isFetched || !t);
|
|
36
|
+
return w(() => {
|
|
37
|
+
l && f() && S();
|
|
38
|
+
}, [l]), n;
|
|
39
|
+
}
|
|
40
|
+
function x() {
|
|
41
|
+
return u(c, f, () => null);
|
|
42
|
+
}
|
|
43
|
+
function D() {
|
|
44
|
+
return u(c, T, () => 0);
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
E as CLIENT_CHAOS_STATUS_KEY,
|
|
48
|
+
x as useClientChaos,
|
|
49
|
+
_ as useClientChaosGate,
|
|
50
|
+
D as usePretendDownVersion
|
|
51
|
+
};
|