UI: keep local shell updates

This commit is contained in:
AidarKC
2026-08-22 18:34:40 +04:00
parent 781157299f
commit c425fa41aa
4 changed files with 339 additions and 4 deletions
@@ -6,6 +6,7 @@ let transport = null;
let transportDepth = 0;
const recentFingerprints = new Map();
let notifySent = null;
let lastCapturedPayload = null;
function nowTs() {
return Date.now();
@@ -85,6 +86,11 @@ export function setClientErrorSentNotifier(fn) {
notifySent = typeof fn === 'function' ? fn : null;
}
export function getLastClientErrorPayload() {
if (!lastCapturedPayload) return null;
return { ...lastCapturedPayload };
}
export function isClientErrorReportingEnabled() {
try {
return localStorage.getItem(UI_ERROR_REPORTING_KEY) === '1';
@@ -104,6 +110,7 @@ export function setClientErrorReportingEnabled(enabled) {
export async function captureClientError(details = {}) {
const payload = buildPayload(details);
if (!payload.message) return false;
lastCapturedPayload = payload;
const fingerprint = details.dedupeKey || makeFingerprint(payload);
if (isDuplicate(fingerprint)) return false;