@nivaro/react 0.2.54 → 0.2.56
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 +99 -98
- package/dist/index.d.ts +367 -2
- package/dist/index.js +645 -616
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/stale-chunk.js +60 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -1,53 +1,54 @@
|
|
|
1
1
|
import { endSessionRecording as $, appendSessionRecordingEvents as X, sessionRecordingEnabled as ce, startSessionRecording as T } from "@nivaro/sdk";
|
|
2
2
|
import { useRef as de, useEffect as fe } from "react";
|
|
3
|
-
import { sessionStore as pe, sharedChunkStore as
|
|
4
|
-
import { useAutoRecord as
|
|
5
|
-
import { useOptionalNivaroClient as
|
|
3
|
+
import { sessionStore as pe, sharedChunkStore as me, ReplayUploader as he, clearResume as P, ORPHAN_TTL_MS as we, readResume as ge, isResumable as ve, splitBySize as Z, writeResume as ye, KEEPALIVE_CHUNK_BYTES as be, CHUNK_BYTES as Re, backoffDelay as Se } from "./replayUploadQueue.js";
|
|
4
|
+
import { useAutoRecord as ke } from "./useAutoRecord.js";
|
|
5
|
+
import { useOptionalNivaroClient as Ee } from "../shared/context.js";
|
|
6
6
|
import { normalizeReplayMasking as B, buildReplayMaskingOptions as z } from "../shared/lib/replay-masking.js";
|
|
7
7
|
import { normalizeReplaySampling as x, replaySampleDraw as Ae, currentReplayRoute as _, isReplayRouteSampled as Y, attributeChunkRoutes as ee } from "../shared/lib/replay-sampling.js";
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
import { instrumentSocket as Pe } from "../shared/lib/replay-socket.js";
|
|
11
|
+
const Ne = "nivaro-react@0.2.56", j = 1e4, Me = 150, Oe = 3e3, Ue = 600, We = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
|
|
12
|
+
function Fe(n) {
|
|
13
|
+
return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
|
|
14
|
+
const l = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
|
|
15
|
+
return l && (d.Authorization = `Bearer ${l}`), fetch(`${n.url}/api/session-recordings/${f}/events`, {
|
|
15
16
|
method: "POST",
|
|
16
17
|
keepalive: !0,
|
|
17
|
-
credentials:
|
|
18
|
-
headers:
|
|
19
|
-
body:
|
|
18
|
+
credentials: l ? "omit" : "include",
|
|
19
|
+
headers: d,
|
|
20
|
+
body: a
|
|
20
21
|
});
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
|
-
async function
|
|
24
|
-
var
|
|
25
|
-
const
|
|
26
|
-
for (const [e, y] of
|
|
27
|
-
const
|
|
24
|
+
async function He(n, f, a, l, d) {
|
|
25
|
+
var u;
|
|
26
|
+
const c = Z(l), { routes: R } = ee(c, d.startRoute);
|
|
27
|
+
for (const [e, y] of c.entries()) {
|
|
28
|
+
const h = a();
|
|
28
29
|
try {
|
|
29
30
|
await n.request(
|
|
30
|
-
X(
|
|
31
|
+
X(f, h, y, {
|
|
31
32
|
route: R[e],
|
|
32
|
-
...
|
|
33
|
+
...d.build ? { build: d.build } : {}
|
|
33
34
|
})
|
|
34
35
|
);
|
|
35
|
-
} catch (
|
|
36
|
-
const b =
|
|
36
|
+
} catch (v) {
|
|
37
|
+
const b = v.status ?? ((u = v.response) == null ? void 0 : u.status);
|
|
37
38
|
if (b === 409) return "closed";
|
|
38
|
-
b === 413 && console.warn(`[session-recorder] chunk ${
|
|
39
|
+
b === 413 && console.warn(`[session-recorder] chunk ${h} too large — dropped`);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
return "ok";
|
|
42
43
|
}
|
|
43
|
-
const
|
|
44
|
-
let J = !1,
|
|
45
|
-
async function
|
|
46
|
-
if (!
|
|
44
|
+
const Ke = 3e4, $e = 3e4;
|
|
45
|
+
let J = !1, g = null, k = null;
|
|
46
|
+
async function Be(n = "error") {
|
|
47
|
+
if (!k) return null;
|
|
47
48
|
try {
|
|
48
49
|
return await Promise.race([
|
|
49
|
-
|
|
50
|
-
new Promise((
|
|
50
|
+
k(n),
|
|
51
|
+
new Promise((f) => setTimeout(() => f(null), 4e3))
|
|
51
52
|
]);
|
|
52
53
|
} catch {
|
|
53
54
|
return null;
|
|
@@ -62,27 +63,27 @@ async function Q() {
|
|
|
62
63
|
)), null;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
function V(n,
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
function V(n, f) {
|
|
67
|
+
const a = qe(n), l = Le(n), d = Pe(n), c = () => {
|
|
68
|
+
f == null || f();
|
|
68
69
|
try {
|
|
69
70
|
n("route", {
|
|
70
71
|
path: Te(window.location.pathname + window.location.search)
|
|
71
72
|
});
|
|
72
73
|
} catch {
|
|
73
74
|
}
|
|
74
|
-
},
|
|
75
|
-
return history.pushState = (...
|
|
76
|
-
|
|
77
|
-
}, history.replaceState = (...
|
|
78
|
-
|
|
79
|
-
}, window.addEventListener("popstate",
|
|
80
|
-
|
|
75
|
+
}, R = history.pushState.bind(history), u = history.replaceState.bind(history);
|
|
76
|
+
return history.pushState = (...e) => {
|
|
77
|
+
R(...e), c();
|
|
78
|
+
}, history.replaceState = (...e) => {
|
|
79
|
+
u(...e), c();
|
|
80
|
+
}, window.addEventListener("popstate", c), c(), () => {
|
|
81
|
+
a(), l(), d(), history.pushState = R, history.replaceState = u, window.removeEventListener("popstate", c);
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
|
|
84
|
+
function et(n = {}) {
|
|
85
|
+
const f = Ee(), a = n.client ?? f, l = n.app, d = n.disabled ?? !1, c = n.build ?? Ne;
|
|
86
|
+
ke({ client: a, disabled: d });
|
|
86
87
|
const R = de({
|
|
87
88
|
buffer: [],
|
|
88
89
|
stop: null,
|
|
@@ -100,22 +101,22 @@ function Xe(n = {}) {
|
|
|
100
101
|
sampled: !0
|
|
101
102
|
});
|
|
102
103
|
fe(() => {
|
|
103
|
-
if (!
|
|
104
|
-
let
|
|
104
|
+
if (!a || d || typeof window > "u") return;
|
|
105
|
+
let u = !1;
|
|
105
106
|
const e = R.current;
|
|
106
107
|
e.dead = !1;
|
|
107
|
-
const y =
|
|
108
|
-
if (!
|
|
108
|
+
const y = a, h = pe(), v = We(l), b = me(), E = Fe(y), te = async (t, r, i, m, s = {}) => {
|
|
109
|
+
if (!m || !E) {
|
|
109
110
|
await y.request(X(t, r, i, s));
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
114
|
-
}, o = new
|
|
113
|
+
const p = await E(t, JSON.stringify({ seq: r, events: i, ...s }));
|
|
114
|
+
if (!p.ok) throw Object.assign(new Error(`HTTP ${p.status}`), { status: p.status });
|
|
115
|
+
}, o = new he({ store: b, send: te, online: G });
|
|
115
116
|
let S = null, A = 0;
|
|
116
|
-
const re = () => document.readyState === "complete" && Date.now() - e.lastNavAt >=
|
|
117
|
+
const re = () => document.readyState === "complete" && Date.now() - e.lastNavAt >= Oe;
|
|
117
118
|
function C() {
|
|
118
|
-
o.recordingId && ye(
|
|
119
|
+
o.recordingId && ye(h, v, {
|
|
119
120
|
recordingId: o.recordingId,
|
|
120
121
|
nextSeq: o.nextSeq,
|
|
121
122
|
startedAt: e.startedAt,
|
|
@@ -134,25 +135,25 @@ function Xe(n = {}) {
|
|
|
134
135
|
}
|
|
135
136
|
function M() {
|
|
136
137
|
var t;
|
|
137
|
-
e.dead = !0, (t = e.stop) == null || t.call(e), I(), o.discard(), P(
|
|
138
|
+
e.dead = !0, (t = e.stop) == null || t.call(e), I(), o.discard(), P(h, v);
|
|
138
139
|
}
|
|
139
140
|
function O(t) {
|
|
140
141
|
if (e.buffer.length === 0 || !o.recordingId) return;
|
|
141
142
|
const r = e.buffer;
|
|
142
143
|
e.buffer = [];
|
|
143
|
-
const i = Z(r, t ? be : Re), { routes:
|
|
144
|
-
for (const [s,
|
|
145
|
-
o.enqueue(
|
|
144
|
+
const i = Z(r, t ? be : Re), { routes: m } = ee(i, e.bufferRoute);
|
|
145
|
+
for (const [s, p] of i.entries())
|
|
146
|
+
o.enqueue(p, { route: m[s], ...c ? { build: c } : {} });
|
|
146
147
|
C();
|
|
147
148
|
}
|
|
148
149
|
async function oe(t) {
|
|
149
|
-
if (!
|
|
150
|
+
if (!u) {
|
|
150
151
|
if (t === "retry") ne();
|
|
151
152
|
else if (t === "closed" || t === "abandoned") M();
|
|
152
153
|
else if (t === "stale")
|
|
153
154
|
try {
|
|
154
|
-
const r = await y.request(T(
|
|
155
|
-
if (
|
|
155
|
+
const r = await y.request(T(l));
|
|
156
|
+
if (u) return;
|
|
156
157
|
o.rebase(r.data.id), e.startedAt = Date.now(), C(), e.flushAfter = !0;
|
|
157
158
|
} catch {
|
|
158
159
|
M();
|
|
@@ -160,7 +161,7 @@ function Xe(n = {}) {
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
function w(t = !1, r = !1) {
|
|
163
|
-
return e.inFlight ? (t && (e.flushAfter = !0), e.inFlight) : e.dead || !o.recordingId || !t && !re() && e.buffer.length <
|
|
164
|
+
return e.inFlight ? (t && (e.flushAfter = !0), e.inFlight) : e.dead || !o.recordingId || !t && !re() && e.buffer.length < Ue || (O(r), !o.hasPending() || Date.now() < A) ? Promise.resolve() : (e.inFlight = o.drain(r).then(oe).catch(() => {
|
|
164
165
|
}).finally(() => {
|
|
165
166
|
e.inFlight = null, e.flushAfter && (e.flushAfter = !1, w(!0));
|
|
166
167
|
}), e.inFlight);
|
|
@@ -171,29 +172,29 @@ function Xe(n = {}) {
|
|
|
171
172
|
}
|
|
172
173
|
async function ie() {
|
|
173
174
|
const t = await Q();
|
|
174
|
-
if (
|
|
175
|
+
if (u || !t) return;
|
|
175
176
|
b.prune(Date.now() - we);
|
|
176
|
-
const r =
|
|
177
|
-
if (r &&
|
|
177
|
+
const r = ge(h, v);
|
|
178
|
+
if (r && ve(r, Date.now())) {
|
|
178
179
|
const s = await b.list(r.recordingId);
|
|
179
|
-
if (
|
|
180
|
+
if (u) return;
|
|
180
181
|
o.begin(r.recordingId, r.nextSeq, { trusted: !1, restored: s }), e.startedAt = r.startedAt;
|
|
181
182
|
} else {
|
|
182
|
-
r && (b.clear(r.recordingId), P(
|
|
183
|
-
const s = await y.request(T(
|
|
184
|
-
if (
|
|
183
|
+
r && (b.clear(r.recordingId), P(h, v));
|
|
184
|
+
const s = await y.request(T(l));
|
|
185
|
+
if (u) return;
|
|
185
186
|
o.begin(s.data.id), e.startedAt = Date.now();
|
|
186
187
|
}
|
|
187
188
|
C(), e.lastNavAt = Date.now();
|
|
188
|
-
const i = Ae(
|
|
189
|
+
const i = Ae(h);
|
|
189
190
|
e.route = _(), e.bufferRoute = e.route, e.sampled = Y(q, e.route, i);
|
|
190
|
-
const
|
|
191
|
-
var
|
|
191
|
+
const m = () => {
|
|
192
|
+
var p;
|
|
192
193
|
e.route = _();
|
|
193
194
|
const s = e.sampled;
|
|
194
195
|
if (e.sampled = Y(q, e.route, i), e.sampled && !s)
|
|
195
196
|
try {
|
|
196
|
-
(
|
|
197
|
+
(p = t.takeFullSnapshot) == null || p.call(
|
|
197
198
|
t,
|
|
198
199
|
!0
|
|
199
200
|
);
|
|
@@ -202,24 +203,24 @@ function Xe(n = {}) {
|
|
|
202
203
|
};
|
|
203
204
|
e.stop = t({
|
|
204
205
|
emit(s) {
|
|
205
|
-
e.sampled && (e.buffer.length === 0 && (e.bufferRoute = e.route), e.buffer.push(s), e.buffer.length >=
|
|
206
|
+
e.sampled && (e.buffer.length === 0 && (e.bufferRoute = e.route), e.buffer.push(s), e.buffer.length >= Me && U());
|
|
206
207
|
},
|
|
207
208
|
...z(() => D),
|
|
208
209
|
checkoutEveryNms: 6e4
|
|
209
210
|
}) ?? null, e.uninstrument = V(
|
|
210
|
-
(s,
|
|
211
|
+
(s, p) => t.addCustomEvent(
|
|
211
212
|
s,
|
|
212
|
-
|
|
213
|
+
p
|
|
213
214
|
),
|
|
214
215
|
() => {
|
|
215
|
-
e.lastNavAt = Date.now(),
|
|
216
|
+
e.lastNavAt = Date.now(), m();
|
|
216
217
|
}
|
|
217
|
-
),
|
|
218
|
+
), k = async () => {
|
|
218
219
|
if (!o.recordingId) return null;
|
|
219
220
|
const s = Date.now() - e.startedAt;
|
|
220
221
|
return await w(!0).catch(() => {
|
|
221
222
|
}), o.recordingId ? { recording_id: o.recordingId, offset_ms: s } : null;
|
|
222
|
-
}, N("full"),
|
|
223
|
+
}, N("full"), g = () => {
|
|
223
224
|
if (!o.recordingId) return null;
|
|
224
225
|
const s = Date.now() - e.startedAt;
|
|
225
226
|
return async () => (await w(!0).catch(() => {
|
|
@@ -228,12 +229,12 @@ function Xe(n = {}) {
|
|
|
228
229
|
}
|
|
229
230
|
async function se() {
|
|
230
231
|
const t = await Q();
|
|
231
|
-
|
|
232
|
+
u || !t || (e.buffer = [], e.prevWindow = [], e.route = _(), e.bufferRoute = e.route, e.prevWindowRoute = e.route, e.stop = t({
|
|
232
233
|
emit(r, i) {
|
|
233
234
|
Ce(r), i ? (e.prevWindow = e.buffer, e.prevWindowRoute = e.bufferRoute, e.buffer = [r], e.bufferRoute = e.route) : e.buffer.push(r);
|
|
234
235
|
},
|
|
235
236
|
...z(() => D),
|
|
236
|
-
checkoutEveryNms:
|
|
237
|
+
checkoutEveryNms: Ke
|
|
237
238
|
}) ?? null, e.uninstrument = V(
|
|
238
239
|
(r, i) => t.addCustomEvent(
|
|
239
240
|
r,
|
|
@@ -242,35 +243,35 @@ function Xe(n = {}) {
|
|
|
242
243
|
() => {
|
|
243
244
|
e.route = _();
|
|
244
245
|
}
|
|
245
|
-
), N("clip"),
|
|
246
|
-
const i = [...e.prevWindow, ...e.buffer],
|
|
247
|
-
if (i.length === 0 || !
|
|
246
|
+
), N("clip"), g = (r) => {
|
|
247
|
+
const i = [...e.prevWindow, ...e.buffer], m = e.prevWindow.length > 0 ? e.prevWindowRoute : e.bufferRoute;
|
|
248
|
+
if (i.length === 0 || !a) return null;
|
|
248
249
|
const s = _e(i, r);
|
|
249
250
|
return async () => {
|
|
250
|
-
const L = (await
|
|
251
|
-
De(T(
|
|
251
|
+
const L = (await a.request(
|
|
252
|
+
De(T(l ?? "error-clip", void 0, !0), r)
|
|
252
253
|
)).data.id;
|
|
253
254
|
let le = 0;
|
|
254
|
-
return await
|
|
255
|
+
return await He(a, L, () => le++, i, { startRoute: m, build: c }), await a.request($(L)).catch(() => {
|
|
255
256
|
}), { recording_id: L, offset_ms: s };
|
|
256
257
|
};
|
|
257
|
-
},
|
|
258
|
+
}, k = async (r) => {
|
|
258
259
|
if (r === "error") {
|
|
259
|
-
if (e.lastClip && Date.now() - e.lastClip.at <
|
|
260
|
+
if (e.lastClip && Date.now() - e.lastClip.at < $e)
|
|
260
261
|
return e.lastClip.link;
|
|
261
262
|
e.lastClip = { at: Date.now(), link: null };
|
|
262
263
|
}
|
|
263
|
-
const i =
|
|
264
|
+
const i = g == null ? void 0 : g(r);
|
|
264
265
|
if (!i) return null;
|
|
265
|
-
const
|
|
266
|
-
return r === "error" && (e.lastClip = { at: Date.now(), link:
|
|
266
|
+
const m = await i();
|
|
267
|
+
return r === "error" && (e.lastClip = { at: Date.now(), link: m }), m;
|
|
267
268
|
});
|
|
268
269
|
}
|
|
269
270
|
let W = !1, D = B(null), q = x(null);
|
|
270
271
|
async function ae() {
|
|
271
272
|
try {
|
|
272
|
-
const t = await
|
|
273
|
-
if (
|
|
273
|
+
const t = await a.request(ce());
|
|
274
|
+
if (u) return;
|
|
274
275
|
D = B(t.data.masking), q = x(t.data.sampling);
|
|
275
276
|
const r = t.data.cap_reached === !0;
|
|
276
277
|
W = t.data.enabled === !0 && !r;
|
|
@@ -285,10 +286,10 @@ function Xe(n = {}) {
|
|
|
285
286
|
};
|
|
286
287
|
document.addEventListener("visibilitychange", F);
|
|
287
288
|
const H = () => {
|
|
288
|
-
if (!(e.dead || !o.recordingId) && (O(!0), C(), !(!G() || !
|
|
289
|
+
if (!(e.dead || !o.recordingId) && (O(!0), C(), !(!G() || !E)))
|
|
289
290
|
for (const { chunk: t, body: r } of o.keepaliveBatch())
|
|
290
291
|
try {
|
|
291
|
-
|
|
292
|
+
E(t.recordingId, r).catch(() => {
|
|
292
293
|
});
|
|
293
294
|
} catch {
|
|
294
295
|
}
|
|
@@ -299,19 +300,19 @@ function Xe(n = {}) {
|
|
|
299
300
|
};
|
|
300
301
|
return window.addEventListener("online", K), () => {
|
|
301
302
|
var t, r;
|
|
302
|
-
|
|
303
|
+
u = !0, k = null, g = null, N(null), document.removeEventListener("visibilitychange", F), window.removeEventListener("pagehide", H), window.removeEventListener("online", K), clearInterval(ue), I(), (t = e.uninstrument) == null || t.call(e), e.uninstrument = null, (r = e.stop) == null || r.call(e), e.stop = null, e.prevWindow = [], w(!0).then(() => {
|
|
303
304
|
const i = o.recordingId;
|
|
304
305
|
i && (e.dead || y.request($(i)).catch(() => {
|
|
305
|
-
}), o.discard(), o.recordingId = null, P(
|
|
306
|
+
}), o.discard(), o.recordingId = null, P(h, v));
|
|
306
307
|
});
|
|
307
308
|
};
|
|
308
|
-
}, [
|
|
309
|
+
}, [a, d, l, c]);
|
|
309
310
|
}
|
|
310
311
|
Ie(
|
|
311
|
-
(n) =>
|
|
312
|
-
(n) => (
|
|
312
|
+
(n) => Be(n),
|
|
313
|
+
(n) => (g == null ? void 0 : g(n)) ?? null
|
|
313
314
|
);
|
|
314
315
|
export {
|
|
315
|
-
|
|
316
|
-
|
|
316
|
+
Be as captureErrorClip,
|
|
317
|
+
et as useSessionRecorder
|
|
317
318
|
};
|