mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
- lib/head.ts: ONE_SLASH rewrites `//models/x` to `/models/x` in the head (the router's replaceState read `//models/x` as host `models` and the browser refused it); STALE reloads once per minute per tab on a ChunkLoadError and marks `window.hzStale`. - lib/analytics/noise.ts and `<Errors/>`: unhandled errors are reported without Outlook's SafeLinks bridge, cross-origin `Script error.`, wallet extensions' `window.ethereum`, ResizeObserver's deferral, or a chunk failure being reloaded. - `generate_lead` and `add_to_cart` are not events in @hanzo/events' table, so no platform was sent them: the sales lead is `sales_contacted`, the plan card's cart is `plan_selected`. - `<html data-hydrated>` once the page has committed, for anything that presses. - The home's sign-in panel on a guest host no longer leaves for hanzo.ai on arrival; /login and /signup still do. - Gates: @hanzo/event 0.3.55 loads no pixel for a driven browser, so the tag gates start from a person's (one `person` in heard.ts); stale expectations follow the product (sign-in-first plan CTAs, /invite private, /bot/details, the home's structure, providers-wide `#choices`). Co-authored-by: Hanzo Dev <[email protected]>
39 lines
1.8 KiB
TypeScript
39 lines
1.8 KiB
TypeScript
/**
|
|
* Errors the page did not raise and cannot fix, kept out of error tracking.
|
|
*
|
|
* Outlook's link scanner `Object Not Found Matching Id:N, MethodName:update,
|
|
* ParamCount:4`, thrown by the CefSharp bridge it
|
|
* injects when it opens a mailed link
|
|
* another origin's script `Script error.`: the browser hides the rest, so
|
|
* there is nothing to read, group or fix
|
|
* a wallet extension `window.ethereum…`, written into the page by the
|
|
* extension, not by this site
|
|
* ResizeObserver `ResizeObserver loop completed with undelivered
|
|
* notifications`: the browser deferring a resize to
|
|
* the next frame, which is not a failure
|
|
*
|
|
* And a chunk failure the head is already recovering from (lib/head.ts `STALE`
|
|
* sets `window.hzStale` before it reloads): the reload is the fix, not an error.
|
|
*/
|
|
|
|
const NOISE = [
|
|
/^Object Not Found Matching Id:\d+, MethodName:\w+, ParamCount:\d+/,
|
|
/^Script error\.?$/,
|
|
/\bwindow\.ethereum\b/,
|
|
/^ResizeObserver loop (completed with undelivered notifications|limit exceeded)/,
|
|
]
|
|
|
|
/** The message an error event or a rejection carries, however it was thrown. */
|
|
function said(err: unknown): string {
|
|
if (typeof err === 'string') return err
|
|
if (err && typeof err === 'object' && 'message' in err) return String((err as { message: unknown }).message)
|
|
return ''
|
|
}
|
|
|
|
/** Whether `err` is one of the above: an error that is not this site's. */
|
|
export function noise(err: unknown): boolean {
|
|
if (typeof window !== 'undefined' && (window as { hzStale?: boolean }).hzStale) return true
|
|
const message = said(err)
|
|
return NOISE.some((re) => re.test(message))
|
|
}
|