@nivaro/react 0.3.7 → 0.3.8

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.
@@ -8,7 +8,7 @@ import { normalizeReplaySampling as x, replaySampleDraw as Ae, currentReplayRout
8
8
  import { emitReplayTap as Ce, setReplayRecorderMode as N, registerReplayCapture as Ie, clipEndOffset as _e, withClipKind as De } from "../shared/lib/replay-capture.js";
9
9
  import { instrumentConsole as qe, instrumentRequests as Le, redactSecrets as Te } from "../shared/lib/replay-context.js";
10
10
  import { instrumentSocket as Pe } from "../shared/lib/replay-socket.js";
11
- const Ne = "nivaro-react@0.3.7", j = 1e4, Me = 150, Oe = 3e3, Ue = 600, We = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
11
+ const Ne = "nivaro-react@0.3.8", j = 1e4, Me = 150, Oe = 3e3, Ue = 600, We = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
12
12
  function Fe(n) {
13
13
  return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
14
14
  const l = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
package/dist/index.d.ts CHANGED
@@ -2179,10 +2179,12 @@ export declare function DelegationCard({ user, onSaved, forUser, coversFor }: {
2179
2179
  }>;
2180
2180
  }): JSX.Element;
2181
2181
 
2182
- export declare function DelegationConsoleView({ className, onNotice }: DelegationConsoleViewProps): JSX.Element;
2182
+ export declare function DelegationConsoleView({ className, onNotice, compactHeader }: DelegationConsoleViewProps): JSX.Element;
2183
2183
 
2184
2184
  export declare interface DelegationConsoleViewProps {
2185
2185
  className?: string;
2186
+ /** Host already shows the title (a tab of a page): drop the icon and heading. */
2187
+ compactHeader?: boolean;
2186
2188
  /** Host toast hook. */
2187
2189
  onNotice?: (message: string) => void;
2188
2190
  }
@@ -3062,6 +3064,13 @@ export declare const FORCE_RELOAD_EVENT = "nvr:force-refresh";
3062
3064
  *
3063
3065
  * A second push while a countdown is running restarts the clock with the
3064
3066
  * newer duration — the later instruction wins.
3067
+ *
3068
+ * The countdown runs against a wall-clock deadline, not a count of timer
3069
+ * ticks: a background tab's timers wake about once a minute, so counting 15
3070
+ * ticks took 15 minutes there (staging, 2026-10-23 — idle tabs on an old
3071
+ * build never reloaded while the admin watched). A throttled tab reloads at
3072
+ * its first wake past the deadline, and a frozen one the moment it is shown
3073
+ * or focused again.
3065
3074
  */
3066
3075
  export declare function ForceReloadBanner(): JSX.Element | null;
3067
3076
 
@@ -5959,8 +5968,10 @@ declare interface NotificationActionsProps {
5959
5968
  className?: string;
5960
5969
  }
5961
5970
 
5962
- export declare function NotificationAnalyticsView({ className }: {
5971
+ export declare function NotificationAnalyticsView({ className, compactHeader }: {
5963
5972
  className?: string;
5973
+ /** Host already shows the title (a tab of a page): drop the icon and heading. */
5974
+ compactHeader?: boolean;
5964
5975
  }): JSX.Element;
5965
5976
 
5966
5977
  /**
@@ -6171,8 +6182,10 @@ declare interface NotificationSourcesCardProps {
6171
6182
  * admin console page and any headless host. Needs NivaroProvider (+ an
6172
6183
  * optional NavigationContext for the "Manage →" links).
6173
6184
  */
6174
- export declare function NotificationSubscriptionsView({ title }: {
6185
+ export declare function NotificationSubscriptionsView({ title, compactHeader }: {
6175
6186
  title?: string;
6187
+ /** Host already shows the title (a tab of a page): drop the icon and heading. */
6188
+ compactHeader?: boolean;
6176
6189
  }): JSX.Element;
6177
6190
 
6178
6191
  export declare type NotificationTarget = {
@@ -1,39 +1,44 @@
1
- import { jsxs as n, jsx as i } from "react/jsx-runtime";
2
- import { RotateCw as u } from "lucide-react";
3
- import { useState as m, useEffect as l } from "react";
4
- const c = "nvr:force-refresh";
5
- function g() {
6
- const [e, b] = m(null), [a, o] = m(0);
7
- return l(() => {
8
- const r = (t) => {
9
- const s = t.detail ?? {}, d = Math.max(5, Number(s.seconds) || 30);
10
- b({ seconds: d, message: String(s.message ?? "") }), o(d);
1
+ import { jsxs as a, jsx as c } from "react/jsx-runtime";
2
+ import { RotateCw as p } from "lucide-react";
3
+ import { useState as m, useRef as h, useEffect as l } from "react";
4
+ const w = "nvr:force-refresh";
5
+ function E() {
6
+ const [t, u] = m(null), [b, o] = m(() => Date.now()), s = h(!1);
7
+ l(() => {
8
+ const e = (n) => {
9
+ const r = n.detail ?? {}, f = Math.max(5, Number(r.seconds) || 30), d = Date.now();
10
+ u({ deadline: d + f * 1e3, message: String(r.message ?? "") }), o(d);
11
11
  };
12
- return window.addEventListener(c, r), () => window.removeEventListener(c, r);
12
+ return window.addEventListener(w, e), () => window.removeEventListener(w, e);
13
13
  }, []), l(() => {
14
- if (!e) return;
15
- const r = setInterval(() => {
16
- o((t) => t <= 1 ? (window.location.reload(), 0) : t - 1);
17
- }, 1e3);
18
- return () => clearInterval(r);
19
- }, [e]), e ? /* @__PURE__ */ n(
14
+ if (!t) return;
15
+ const e = () => {
16
+ const r = Date.now();
17
+ o(r), r >= t.deadline && !s.current && (s.current = !0, window.location.reload());
18
+ }, n = setInterval(e, 1e3);
19
+ return document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), window.addEventListener("pageshow", e), () => {
20
+ clearInterval(n), document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e), window.removeEventListener("pageshow", e);
21
+ };
22
+ }, [t]);
23
+ const i = t ? Math.max(0, Math.ceil((t.deadline - b) / 1e3)) : 0;
24
+ return t ? /* @__PURE__ */ a(
20
25
  "div",
21
26
  {
22
27
  role: "alert",
23
- "data-nvr-force-reload": a,
28
+ "data-nvr-force-reload": i,
24
29
  "data-nvr-recording-hide": !0,
25
30
  className: "fixed inset-x-0 top-0 z-[150] flex items-center justify-center gap-3 border-b border-amber-300 bg-amber-50 px-4 py-2.5 text-[13px] text-amber-900 dark:border-amber-500/40 dark:bg-[#3a2e10] dark:text-amber-200",
26
31
  children: [
27
- /* @__PURE__ */ i(u, { className: "h-4 w-4 animate-spin" }),
28
- /* @__PURE__ */ n("span", { children: [
29
- /* @__PURE__ */ n("span", { className: "font-semibold", children: [
32
+ /* @__PURE__ */ c(p, { className: "h-4 w-4 animate-spin" }),
33
+ /* @__PURE__ */ a("span", { children: [
34
+ /* @__PURE__ */ a("span", { className: "font-semibold", children: [
30
35
  "This page will reload in ",
31
- a,
36
+ i,
32
37
  "s"
33
38
  ] }),
34
- e.message ? ` — ${e.message}` : " — an administrator pushed an update."
39
+ t.message ? ` — ${t.message}` : " — an administrator pushed an update."
35
40
  ] }),
36
- /* @__PURE__ */ i(
41
+ /* @__PURE__ */ c(
37
42
  "button",
38
43
  {
39
44
  type: "button",
@@ -47,6 +52,6 @@ function g() {
47
52
  ) : null;
48
53
  }
49
54
  export {
50
- c as FORCE_RELOAD_EVENT,
51
- g as ForceReloadBanner
55
+ w as FORCE_RELOAD_EVENT,
56
+ E as ForceReloadBanner
52
57
  };