@interfere/react 11.1.1 → 12.0.0

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.
Files changed (136) hide show
  1. package/README.md +4 -4
  2. package/dist/activity-BfYxFVcK.d.mts +36 -0
  3. package/dist/api-wpS4xoMY.d.mts +70 -0
  4. package/dist/api.d.mts +8 -7
  5. package/dist/api.mjs +1 -1
  6. package/dist/config-Rm-ct4K1.d.mts +12 -0
  7. package/dist/device-vFtWy12y.d.mts +35 -0
  8. package/dist/error-boundary.d.mts +7 -7
  9. package/dist/error-boundary.mjs +1 -1
  10. package/dist/exporter-logs-CeGwMiMo.d.mts +51 -0
  11. package/dist/geo-PDfIZY4L.d.mts +16 -0
  12. package/dist/index-CatPKbtv.d.mts +4 -0
  13. package/dist/instrumentations-Bgm2EazU.d.mts +91 -0
  14. package/dist/internal/activity.d.mts +1 -35
  15. package/dist/internal/activity.mjs +1 -1
  16. package/dist/internal/browser-context.d.mts +44 -4
  17. package/dist/internal/browser-context.mjs +1 -1
  18. package/dist/internal/capture-boundary.d.mts +6 -5
  19. package/dist/internal/capture-boundary.mjs +1 -1
  20. package/dist/internal/capture.d.mts +3 -4
  21. package/dist/internal/capture.mjs +1 -1
  22. package/dist/internal/config.d.mts +26 -27
  23. package/dist/internal/config.mjs +1 -1
  24. package/dist/internal/consent.d.mts +16 -8
  25. package/dist/internal/console-patch.d.mts +6 -7
  26. package/dist/internal/console-patch.mjs +1 -1
  27. package/dist/internal/dom/actionable.d.mts +5 -7
  28. package/dist/internal/dom/actionable.mjs +1 -1
  29. package/dist/internal/hydration.d.mts +2 -3
  30. package/dist/internal/kernel-registry.d.mts +5 -6
  31. package/dist/internal/kernel.d.mts +2 -292
  32. package/dist/internal/kernel.mjs +1 -1
  33. package/dist/internal/otel/exporter-logs.d.mts +1 -12
  34. package/dist/internal/otel/exporter-logs.mjs +1 -1
  35. package/dist/internal/otel/exporter-metrics.d.mts +2 -14
  36. package/dist/internal/otel/exporter-metrics.mjs +1 -1
  37. package/dist/internal/otel/exporter.d.mts +2 -29
  38. package/dist/internal/otel/exporter.mjs +1 -1
  39. package/dist/internal/otel/http-span-route.d.mts +4 -0
  40. package/dist/internal/otel/http-span-route.mjs +1 -0
  41. package/dist/internal/otel/index.d.mts +7 -5
  42. package/dist/internal/otel/index.mjs +1 -1
  43. package/dist/internal/otel/initial-navigation.d.mts +3 -4
  44. package/dist/internal/otel/initial-navigation.mjs +1 -1
  45. package/dist/internal/otel/instrumentations.d.mts +2 -89
  46. package/dist/internal/otel/instrumentations.mjs +1 -1
  47. package/dist/internal/otel/navigation.d.mts +2 -0
  48. package/dist/internal/otel/navigation.mjs +1 -0
  49. package/dist/internal/otel/normalize-path.d.mts +9 -0
  50. package/dist/internal/otel/normalize-path.mjs +1 -0
  51. package/dist/internal/otel/page-scope-context-manager.d.mts +2 -31
  52. package/dist/internal/otel/page-scope-context-manager.mjs +1 -1
  53. package/dist/internal/otel/propagation.d.mts +1 -19
  54. package/dist/internal/otel/propagation.mjs +1 -1
  55. package/dist/internal/otel/provider.d.mts +1 -86
  56. package/dist/internal/otel/provider.mjs +1 -1
  57. package/dist/internal/otel/url-attrs.d.mts +7 -0
  58. package/dist/internal/otel/url-attrs.mjs +1 -0
  59. package/dist/internal/otel/web-vitals.d.mts +1 -33
  60. package/dist/internal/otel/web-vitals.mjs +1 -1
  61. package/dist/internal/page-lifecycle.d.mts +4 -5
  62. package/dist/internal/page-lifecycle.mjs +1 -1
  63. package/dist/internal/plugin-runtime.d.mts +1 -38
  64. package/dist/internal/plugin-runtime.mjs +1 -1
  65. package/dist/internal/react-context.d.mts +1 -43
  66. package/dist/internal/react-context.mjs +1 -1
  67. package/dist/internal/server-digest.d.mts +4 -3
  68. package/dist/internal/server-digest.mjs +1 -1
  69. package/dist/internal/sw-queue.d.mts +4 -5
  70. package/dist/internal/sw-queue.mjs +1 -1
  71. package/dist/internal/third-party-hosts.d.mts +2 -3
  72. package/dist/internal/third-party-hosts.mjs +1 -1
  73. package/dist/internal/version.d.mts +4 -5
  74. package/dist/internal/version.mjs +1 -1
  75. package/dist/internal/wrapper-singleton.d.mts +5 -6
  76. package/dist/internal/wrapper-singleton.mjs +1 -1
  77. package/dist/navigation-CkiV6lJY.d.mts +54 -0
  78. package/dist/page-scope-context-manager-r92ZMJok.d.mts +17 -0
  79. package/dist/plugins/device.d.mts +5 -0
  80. package/dist/plugins/device.mjs +1 -0
  81. package/dist/plugins/errors.d.mts +1 -1
  82. package/dist/plugins/errors.mjs +1 -1
  83. package/dist/plugins/lib/loader.d.mts +2 -11
  84. package/dist/plugins/lib/loader.mjs +1 -1
  85. package/dist/plugins/lib/types.d.mts +2 -24
  86. package/dist/plugins/logs.d.mts +1 -1
  87. package/dist/plugins/logs.mjs +1 -1
  88. package/dist/plugins/page-events.d.mts +5 -0
  89. package/dist/plugins/page-events.mjs +1 -0
  90. package/dist/plugins/rage-clicks.d.mts +1 -1
  91. package/dist/plugins/rage-clicks.mjs +1 -1
  92. package/dist/plugins/replay/buffer.d.mts +9 -6
  93. package/dist/plugins/replay/buffer.mjs +1 -1
  94. package/dist/plugins/replay/chunking.d.mts +18 -9
  95. package/dist/plugins/replay/chunking.mjs +1 -1
  96. package/dist/plugins/replay/compressor-host.d.mts +3 -4
  97. package/dist/plugins/replay/compressor-host.mjs +1 -1
  98. package/dist/plugins/replay/config.d.mts +1 -11
  99. package/dist/plugins/replay/config.mjs +1 -1
  100. package/dist/plugins/replay/delivery.d.mts +8 -9
  101. package/dist/plugins/replay/delivery.mjs +1 -1
  102. package/dist/plugins/replay/index.d.mts +1 -1
  103. package/dist/plugins/replay/index.mjs +1 -1
  104. package/dist/plugins/replay/recorder.d.mts +12 -6
  105. package/dist/plugins/replay/recorder.mjs +1 -1
  106. package/dist/plugins/replay/sequence.d.mts +5 -4
  107. package/dist/plugins/replay/sequence.mjs +1 -1
  108. package/dist/plugins/replay/upload.d.mts +4 -0
  109. package/dist/plugins/replay/upload.mjs +1 -0
  110. package/dist/propagation-CssinKCy.d.mts +26 -0
  111. package/dist/provider-50LbJ4Tl.d.mts +466 -0
  112. package/dist/provider-Cp6noibq.d.mts +101 -0
  113. package/dist/provider.d.mts +2 -58
  114. package/dist/provider.mjs +1 -1
  115. package/dist/react-error-handler.d.mts +9 -11
  116. package/dist/react-error-handler.mjs +1 -1
  117. package/dist/rrweb-CE6GKCEq.mjs +150 -0
  118. package/dist/tracking/api.d.mts +1 -54
  119. package/dist/tracking/api.mjs +1 -1
  120. package/dist/tracking/device.d.mts +1 -32
  121. package/dist/tracking/device.mjs +1 -1
  122. package/dist/tracking/geo.d.mts +1 -13
  123. package/dist/tracking/geo.mjs +1 -1
  124. package/dist/tracking/session.d.mts +6 -7
  125. package/dist/tracking/session.mjs +1 -1
  126. package/dist/util/bot.d.mts +2 -3
  127. package/dist/util/bot.mjs +1 -1
  128. package/dist/util/global.d.mts +4 -10
  129. package/dist/util/global.mjs +1 -1
  130. package/dist/util/log.d.mts +11 -7
  131. package/dist/util/log.mjs +1 -1
  132. package/dist/util/stringify.d.mts +2 -3
  133. package/dist/version-BniHrwLD.mjs +1 -0
  134. package/dist/web-vitals-x8y70B5x.d.mts +34 -0
  135. package/package.json +67 -48
  136. package/dist/package.mjs +0 -1
package/README.md CHANGED
@@ -28,10 +28,10 @@
28
28
 
29
29
  ## Framework Guides
30
30
 
31
- | Framework | Package | Guide |
32
- | --- | --- | --- |
33
- | Next.js | [`@interfere/next`](https://www.npmjs.com/package/@interfere/next) | [docs/next.md](docs/next.md) |
34
- | Vite | [`@interfere/vite`](https://www.npmjs.com/package/@interfere/vite) + `@interfere/react` | [docs/vite.md](docs/vite.md) |
31
+ | Framework | Package | Guide |
32
+ | --------- | --------------------------------------------------------------------------------------- | ---------------------------- |
33
+ | Next.js | [`@interfere/next`](https://www.npmjs.com/package/@interfere/next) | [docs/next.md](docs/next.md) |
34
+ | Vite | [`@interfere/vite`](https://www.npmjs.com/package/@interfere/vite) + `@interfere/react` | [docs/vite.md](docs/vite.md) |
35
35
 
36
36
  ## Installation
37
37
 
@@ -0,0 +1,36 @@
1
+ //#region src/internal/activity.d.ts
2
+ declare const IDLE_AFTER_MS: number;
3
+ declare const EXPIRE_AFTER_MS: number;
4
+ declare const MAX_AGE_MS: number;
5
+ declare const CHECK_INTERVAL_MS: number;
6
+ declare const KEEPALIVE_THROTTLE_MS = 1000;
7
+ interface ActivitySession {
8
+ markActivity: () => void;
9
+ reset: () => void;
10
+ /** Wall-clock epoch ms the session began; `0` when unknown. */
11
+ startedAt: () => number;
12
+ }
13
+ type SessionResumeReason = "idle" | "rotated";
14
+ type Handler<A> = (arg: A) => void;
15
+ declare class ActivityMonitor {
16
+ private session;
17
+ private paused;
18
+ private lastActivityMs;
19
+ private keepaliveUntilMs;
20
+ private checkTimer;
21
+ private unsubscribeShown;
22
+ private readonly pauseHandlers;
23
+ private readonly resumeHandlers;
24
+ onPause(handler: Handler<void>): () => void;
25
+ onResume(handler: Handler<SessionResumeReason>): () => void;
26
+ start(session: ActivitySession): void;
27
+ stop(): void;
28
+ private idleMs;
29
+ private isOverMaxAge;
30
+ private readonly poll;
31
+ private readonly onInput;
32
+ private resume;
33
+ private touch;
34
+ }
35
+ //#endregion
36
+ export { IDLE_AFTER_MS as a, SessionResumeReason as c, EXPIRE_AFTER_MS as i, ActivitySession as n, KEEPALIVE_THROTTLE_MS as o, CHECK_INTERVAL_MS as r, MAX_AGE_MS as s, ActivityMonitor as t };
@@ -0,0 +1,70 @@
1
+ import { c as SessionResumeReason } from "./activity-BfYxFVcK.mjs";
2
+ import { t as DeviceManager } from "./device-vFtWy12y.mjs";
3
+ import { t as GeoDetector } from "./geo-PDfIZY4L.mjs";
4
+ import { InterfereClient } from "@interfere/javascript";
5
+ import { IdentifyParams } from "@interfere/types/sdk/identify";
6
+ //#region src/tracking/api.d.ts
7
+ interface SessionTrackerOptions {
8
+ device?: DeviceManager;
9
+ fetcher?: typeof globalThis.fetch;
10
+ geo?: GeoDetector;
11
+ target: InterfereClient.Options;
12
+ }
13
+ declare class SessionTracker {
14
+ private readonly client;
15
+ private readonly device;
16
+ private readonly geo;
17
+ private mgr;
18
+ private readonly activity;
19
+ private currentIdentity;
20
+ private identifiedSessionId;
21
+ private lastSyncedKey;
22
+ private inflightSyncKey;
23
+ private syncAttemptMs;
24
+ private generation;
25
+ private identityStarted;
26
+ constructor(opts: SessionTrackerOptions);
27
+ start(): void;
28
+ startDeviceIdentity(): void;
29
+ discardDeviceIdentity(): void;
30
+ private backfillIdentity;
31
+ onSessionPause(handler: () => void): () => void;
32
+ onSessionResume(handler: (reason: SessionResumeReason) => void): () => void;
33
+ sessionId(): (string & import("zod").$brand<"SessionId">) | null;
34
+ windowId(): string | null;
35
+ markActivity(): void;
36
+ getSessionStartedAt(): number;
37
+ getDeviceId(): string | null;
38
+ getFpHash(): string | null;
39
+ getIdentity(): {
40
+ avatar?: string | undefined;
41
+ email?: string | undefined;
42
+ identifier: string;
43
+ name?: string | undefined;
44
+ source: {
45
+ name: "Clerk";
46
+ type: "clerk";
47
+ } | {
48
+ name: "Auth0";
49
+ type: "auth0";
50
+ } | {
51
+ name: "WorkOS";
52
+ type: "workos";
53
+ } | {
54
+ name: string;
55
+ type: "custom";
56
+ };
57
+ traits?: Record<string, unknown> | undefined;
58
+ } | null;
59
+ identify(params: IdentifyParams): Promise<void>;
60
+ private postIdentify;
61
+ clearIdentity(): void;
62
+ reset(): void;
63
+ rotateSession(): void;
64
+ dispose(): void;
65
+ private ensureSynced;
66
+ private syncSession;
67
+ private onRotate;
68
+ }
69
+ //#endregion
70
+ export { SessionTrackerOptions as n, SessionTracker as t };
package/dist/api.d.mts CHANGED
@@ -6,11 +6,13 @@ import { Span, SpanOptions } from "@opentelemetry/api";
6
6
  * by `fn` are recorded on the span before re-throwing — caller still owns
7
7
  * the error.
8
8
  *
9
- * Works pre-init: `trace.getTracer()` returns a no-op tracer that still
10
- * runs `fn` and propagates its return value, so call sites don't need
11
- * defensive checks.
9
+ * Records through the kernel's private tracer provider once `init()` has
10
+ * run — the SDK never installs a global provider, so the global registry
11
+ * alone would silently produce non-recording spans. Works pre-init: the
12
+ * global registry's no-op tracer still runs `fn` and propagates its
13
+ * return value, so call sites don't need defensive checks.
12
14
  */
13
- declare function span<T>(name: string, fn: (span: Span) => T, options?: SpanOptions): T;
15
+ export declare function span<T>(name: string, fn: (span: Span) => T, options?: SpanOptions): T;
14
16
  /**
15
17
  * Captures an error. Records on the active OTel span (when present) AND on
16
18
  * the legacy envelope path. Accepts any thrown value; non-Error inputs that
@@ -19,6 +21,5 @@ declare function span<T>(name: string, fn: (span: Span) => T, options?: SpanOpti
19
21
  *
20
22
  * Safe to call before init — drops silently if no kernel is registered.
21
23
  */
22
- declare function capture(error: unknown): void;
23
- //#endregion
24
- export { capture, span };
24
+ export declare function capture(error: unknown): void;
25
+ //#endregion
package/dist/api.mjs CHANGED
@@ -1 +1 @@
1
- import{activeKernel}from"./internal/kernel-registry.mjs";import{MECHANISM_TYPE,toError,toException}from"@interfere/types/sdk/errors";import{SpanStatusCode,trace}from"@opentelemetry/api";function tracer(){return trace.getTracer(`@interfere/react`)}function isPromise(value){return!!value&&(typeof value==`object`||typeof value==`function`)&&typeof value.then==`function`}function span(name,fn,options){return tracer().startActiveSpan(name,options??{},s=>{try{let result=fn(s);return isPromise(result)?result.then(value=>(s.end(),value),error=>{let e=toError(error);throw s.recordException(e),s.setStatus({code:SpanStatusCode.ERROR,message:e.message}),s.end(),error}):(s.end(),result)}catch(error){let e=toError(error);throw s.recordException(e),s.setStatus({code:SpanStatusCode.ERROR,message:e.message}),s.end(),error}})}function capture(error){activeKernel()?.recordException(toException(error),{mechanism:{type:MECHANISM_TYPE.manual.capture,handled:!0}})}export{capture,span};
1
+ import{activeKernel}from"./internal/kernel-registry.mjs";import{MECHANISM_TYPE,toError,toException}from"@interfere/types/sdk/errors";import{SpanStatusCode,trace}from"@opentelemetry/api";const TRACER_NAME=`@interfere/react`;function tracer(){return activeKernel()?.getTracer(TRACER_NAME)??trace.getTracer(TRACER_NAME)}function isPromise(value){return value!==null&&(typeof value==`object`||typeof value==`function`)&&`then`in value&&typeof value.then==`function`}function span(name,fn,options){return tracer().startActiveSpan(name,options??{},s=>{try{let result=fn(s);return isPromise(result)?result.then(value=>(s.end(),value),error=>{let e=toError(error);throw s.recordException(e),s.setStatus({code:SpanStatusCode.ERROR,message:e.message}),s.end(),error}):(s.end(),result)}catch(error){let e=toError(error);throw s.recordException(e),s.setStatus({code:SpanStatusCode.ERROR,message:e.message}),s.end(),error}})}function capture(error){activeKernel()?.recordException(toException(error),{mechanism:{handled:!0,type:MECHANISM_TYPE.manual.capture}})}export{capture,span};
@@ -0,0 +1,12 @@
1
+ import { SetRequired } from "@interfere/helpers/set-required";
2
+ import { recordOptions } from "rrweb";
3
+ //#region src/plugins/replay/config.d.ts
4
+ declare const INTERFERE_MASK_TEXT_CLASS = "interfere-mask";
5
+ declare const INTERFERE_BLOCK_CLASS = "interfere-block";
6
+ declare const INTERFERE_IGNORE_CLASS = "interfere-ignore";
7
+ type ReplayConfig = Pick<recordOptions<unknown>, "blockClass" | "blockSelector" | "ignoreClass" | "ignoreSelector" | "maskAllInputs" | "maskInputFn" | "maskInputOptions" | "maskTextClass" | "maskTextFn" | "maskTextSelector" | "recordCanvas">;
8
+ type ReplayOption = boolean | ReplayConfig;
9
+ type ReplayRecordOptions = SetRequired<ReplayConfig, "maskTextClass" | "blockClass" | "ignoreClass">;
10
+ declare function toRecordOptions(config: ReplayConfig): ReplayRecordOptions;
11
+ //#endregion
12
+ export { ReplayOption as a, ReplayConfig as i, INTERFERE_IGNORE_CLASS as n, ReplayRecordOptions as o, INTERFERE_MASK_TEXT_CLASS as r, toRecordOptions as s, INTERFERE_BLOCK_CLASS as t };
@@ -0,0 +1,35 @@
1
+ //#region src/tracking/device.d.ts
2
+ /**
3
+ * Producer of an opaque, stable per-browser fingerprint hash. The default
4
+ * dynamic-imports the FingerprintJS OSS library and self-defers via
5
+ * `requestIdleCallback` so the ~1.5s of synchronous font / canvas / WebGL
6
+ * probing the library performs on a cold load doesn't land on the
7
+ * hydration tick. Tests inject a fixed-value provider that resolves
8
+ * immediately — they pay nothing for the production deferral.
9
+ */
10
+ type FingerprintProvider = () => Promise<string | null>;
11
+ /**
12
+ * Resolves on the next browser idle frame, capped at 5s. Falls back to
13
+ * `setTimeout(0)` (next macrotask) on hosts without
14
+ * `requestIdleCallback`. Exported only for the unit test that pins the
15
+ * "default provider gates fingerprint work via RIC" contract — not part
16
+ * of the package's public surface.
17
+ */
18
+ declare function whenIdle(): Promise<undefined>;
19
+ declare class DeviceManager {
20
+ private deviceId;
21
+ private fpHash;
22
+ private fpPending;
23
+ private epoch;
24
+ private readonly fingerprintProvider;
25
+ constructor(fingerprintProvider?: FingerprintProvider);
26
+ init(): void;
27
+ private startFingerprint;
28
+ getDeviceId(): string | null;
29
+ getFpHash(): string | null;
30
+ whenFingerprintReady(): Promise<string | null>;
31
+ reset(): string;
32
+ clear(): void;
33
+ }
34
+ //#endregion
35
+ export { FingerprintProvider as n, whenIdle as r, DeviceManager as t };
@@ -1,8 +1,7 @@
1
- import { InterfereContext, InterfereContextValue } from "./internal/react-context.mjs";
2
- import "./provider.mjs";
1
+ import { a as InterfereContextValue, i as InterfereContext } from "./provider-50LbJ4Tl.mjs";
3
2
  import { Component, ContextType, ErrorInfo, ReactNode } from "react";
4
3
  //#region src/error-boundary.d.ts
5
- interface ErrorBoundaryProps {
4
+ export interface ErrorBoundaryProps {
6
5
  children: ReactNode;
7
6
  fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);
8
7
  onError?: (error: Error, info: ErrorInfo) => void;
@@ -18,16 +17,17 @@ interface ErrorBoundaryState {
18
17
  *
19
18
  * Class component required — React has no hook-based error boundary API.
20
19
  */
21
- declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
20
+ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
22
21
  static contextType: import("react").Context<InterfereContextValue | null>;
23
22
  context: ContextType<typeof InterfereContext>;
24
23
  state: ErrorBoundaryState;
25
- static getDerivedStateFromError(error: Error): ErrorBoundaryState;
24
+ static getDerivedStateFromError(error: Error): {
25
+ error: Error;
26
+ };
26
27
  componentDidCatch(error: Error & {
27
28
  digest?: string;
28
29
  }, info: ErrorInfo): void;
29
30
  private readonly reset;
30
31
  render(): ReactNode;
31
32
  }
32
- //#endregion
33
- export { ErrorBoundary, ErrorBoundaryProps };
33
+ //#endregion
@@ -1 +1 @@
1
- "use client";import{captureReactError}from"./internal/capture.mjs";import{InterfereContext}from"./internal/react-context.mjs";import{MECHANISM_TYPE}from"@interfere/types/sdk/errors";import{Component}from"react";var ErrorBoundary=class extends Component{static contextType=InterfereContext;state={error:null};static getDerivedStateFromError(error){return{error}}componentDidCatch(error,info){captureReactError(this.context?.kernel??null,error,info.componentStack,{type:MECHANISM_TYPE.react.errorBoundary,handled:!0}),this.props.onError?.(error,info)}reset=()=>{this.setState({error:null})};render(){let{error}=this.state;if(error){let{fallback}=this.props;return typeof fallback==`function`?fallback(error,this.reset):fallback??null}return this.props.children}};export{ErrorBoundary};
1
+ "use client";import{captureReactError}from"./internal/capture.mjs";import{InterfereContext}from"./internal/react-context.mjs";import{MECHANISM_TYPE}from"@interfere/types/sdk/errors";import{Component}from"react";var ErrorBoundary=class extends Component{static contextType=InterfereContext;state={error:null};static getDerivedStateFromError(error){return{error}}componentDidCatch(error,info){captureReactError(this.context?.kernel??null,error,info.componentStack,{handled:!0,type:MECHANISM_TYPE.react.errorBoundary}),this.props.onError?.(error,info)}reset=()=>{this.setState({error:null})};render(){let{error}=this.state;if(error){let{fallback}=this.props;return typeof fallback==`function`?fallback(error,this.reset):fallback??null}return this.props.children}};export{ErrorBoundary};
@@ -0,0 +1,51 @@
1
+ import { Attributes } from "@opentelemetry/api";
2
+ import { InterfereClient } from "@interfere/javascript";
3
+ import { ExportResult } from "@opentelemetry/core";
4
+ import { AggregationTemporality, PushMetricExporter, ResourceMetrics } from "@opentelemetry/sdk-metrics";
5
+ import { LogRecordExporter, ReadableLogRecord } from "@opentelemetry/sdk-logs";
6
+ import { ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base";
7
+ //#region src/internal/otel/exporter-metrics.d.ts
8
+ interface GatedResourceAttributes {
9
+ attributes: Attributes;
10
+ isEnabled: () => boolean;
11
+ }
12
+ declare class IngestMetricExporter implements PushMetricExporter {
13
+ private readonly gatedResourceAttributes;
14
+ private readonly send;
15
+ constructor(send: SignalSender, gatedResourceAttributes?: GatedResourceAttributes);
16
+ export(metrics: ResourceMetrics, resultCallback: (result: ExportResult) => void): void;
17
+ selectAggregationTemporality(): AggregationTemporality;
18
+ forceFlush(): Promise<void>;
19
+ shutdown(): Promise<void>;
20
+ }
21
+ //#endregion
22
+ //#region src/internal/otel/exporter.d.ts
23
+ declare const INGEST_IGNORE_RE: RegExp;
24
+ type SignalSender = (payload: Uint8Array | undefined, resultCallback: (result: ExportResult) => void) => void;
25
+ interface ExporterCommon {
26
+ clientOptions: InterfereClient.Options;
27
+ }
28
+ /** Test-only reset — the halt is deliberately page-lifetime state. */
29
+ declare function resetIngestHalt(): void;
30
+ declare function isIngestHalted(): boolean;
31
+ declare class IngestTraceExporter implements SpanExporter {
32
+ private readonly send;
33
+ constructor(send: SignalSender);
34
+ export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
35
+ shutdown(): Promise<void>;
36
+ forceFlush(): Promise<void>;
37
+ }
38
+ declare function createTraceExporter(input: ExporterCommon): IngestTraceExporter;
39
+ declare function createMetricExporter(input: ExporterCommon, gatedResourceAttributes?: GatedResourceAttributes): IngestMetricExporter;
40
+ declare function createLogExporter(input: ExporterCommon): IngestLogExporter;
41
+ //#endregion
42
+ //#region src/internal/otel/exporter-logs.d.ts
43
+ declare class IngestLogExporter implements LogRecordExporter {
44
+ private readonly send;
45
+ constructor(send: SignalSender);
46
+ export(logs: ReadableLogRecord[], resultCallback: (result: ExportResult) => void): void;
47
+ shutdown(): Promise<void>;
48
+ forceFlush(): Promise<void>;
49
+ }
50
+ //#endregion
51
+ export { createMetricExporter as a, resetIngestHalt as c, createLogExporter as i, GatedResourceAttributes as l, INGEST_IGNORE_RE as n, createTraceExporter as o, SignalSender as r, isIngestHalted as s, IngestLogExporter as t, IngestMetricExporter as u };
@@ -0,0 +1,16 @@
1
+ //#region src/tracking/geo.d.ts
2
+ declare class GeoDetector {
3
+ private cached;
4
+ private pending;
5
+ private failed;
6
+ private epoch;
7
+ private readonly fetcher;
8
+ constructor(fetcher?: typeof globalThis.fetch);
9
+ detect(): Promise<string | null>;
10
+ private resolveCountryCode;
11
+ getCountry(): string | null;
12
+ clear(): void;
13
+ private fetchCountryCode;
14
+ }
15
+ //#endregion
16
+ export { GeoDetector as t };
@@ -0,0 +1,4 @@
1
+ import "./instrumentations-Bgm2EazU.mjs";
2
+ import "./navigation-CkiV6lJY.mjs";
3
+ import "./provider-Cp6noibq.mjs";
4
+ import "./web-vitals-x8y70B5x.mjs";
@@ -0,0 +1,91 @@
1
+ import { Span } from "@opentelemetry/api";
2
+ import { FetchCustomAttributeFunction } from "@opentelemetry/instrumentation-fetch";
3
+ import { LoggerProvider } from "@opentelemetry/sdk-logs";
4
+ import { WebTracerProvider } from "@opentelemetry/sdk-trace-web";
5
+ //#region src/internal/otel/instrumentations.d.ts
6
+ type FetchError = Exclude<Parameters<FetchCustomAttributeFunction>[2], Response>;
7
+ type FetchSpanRequest = Request | RequestInfo | RequestInit | URL;
8
+ /**
9
+ * Inclusive HTTP status range. `[400, 499]` matches every 4xx;
10
+ * a bare number matches that exact code.
11
+ */
12
+ type HttpStatusCodeRange = number | readonly [number, number];
13
+ interface CaptureFailedRequestsOptions {
14
+ /** Defaults to `[[400, 599]]` (4xx + 5xx) when not specified. */
15
+ statusCodes?: readonly HttpStatusCodeRange[];
16
+ }
17
+ /**
18
+ * Promote tracked failed fetch/XHR responses to captured exception events.
19
+ * On by default (same-origin 4xx + 5xx, deduped + rate-limited); `false`
20
+ * disables, `{ statusCodes }` tunes the matched ranges.
21
+ */
22
+ type CaptureFailedRequestsOption = boolean | CaptureFailedRequestsOptions;
23
+ declare function resolveFailureRanges(opt: CaptureFailedRequestsOption | undefined): readonly HttpStatusCodeRange[] | null;
24
+ /**
25
+ * Per-instrumentation gate that keeps failed-request capture low-noise:
26
+ * dedupes by `method+status+path` (so a flapping endpoint is captured once)
27
+ * and rate-limits to {@link FAILURE_RATE_MAX} captures per
28
+ * {@link FAILURE_RATE_WINDOW_MS} as a flood backstop. State lives in the
29
+ * closure — one gate per kernel instance, no module-level mutable state.
30
+ */
31
+ declare function createFailureGate(): (key: string) => boolean;
32
+ declare function classifyNetworkError(message: string): "abort" | "network" | "timeout";
33
+ declare function applyFetchSpanAttrs(span: Span, request: FetchSpanRequest, result: Response | FetchError, failureRanges: readonly HttpStatusCodeRange[] | null, isTrackedUrl: (url: string) => boolean, resolveRoute: ((pathname: string) => string | undefined) | undefined, gate?: (key: string) => boolean): void;
34
+ declare function applyXhrSpanAttrs(span: Span, xhr: Pick<XMLHttpRequest, "responseURL" | "status">, failureRanges: readonly HttpStatusCodeRange[] | null, isTrackedUrl: (url: string) => boolean, gate?: (key: string) => boolean, resolveRoute?: (pathname: string) => string | undefined): void;
35
+ declare const testOnlyApplyFetchSpanAttrs: typeof applyFetchSpanAttrs;
36
+ declare const testOnlyApplyXhrSpanAttrs: typeof applyXhrSpanAttrs;
37
+ declare const testOnlyResolveFailureRanges: typeof resolveFailureRanges;
38
+ declare const testOnlyCreateFailureGate: typeof createFailureGate;
39
+ declare const testOnlyClassifyNetworkError: typeof classifyNetworkError;
40
+ interface InstrumentationsInput {
41
+ /**
42
+ * Hostnames the fetch + XHR instrumentations inject `traceparent` onto,
43
+ * matched by host (any path/port/scheme). Same-origin always propagates.
44
+ */
45
+ apiHosts?: string[];
46
+ /** See {@link CaptureFailedRequestsOption}. On by default. */
47
+ captureFailedRequests?: CaptureFailedRequestsOption;
48
+ /**
49
+ * URLs the SDK exempts from `fetch` and `XHR` instrumentation —
50
+ * typically our own ingest/OTLP endpoints, so the SDK doesn't trace
51
+ * its own export requests in an infinite loop. Combined with the
52
+ * `THIRD_PARTY_IGNORE` defaults and the customer's `ignoreUrls`.
53
+ */
54
+ ignoreUrls: (string | RegExp)[];
55
+ loggerProvider?: LoggerProvider;
56
+ /**
57
+ * Customer-supplied URL patterns the fetch + XHR instrumentations
58
+ * inject `traceparent` + `baggage` headers on. Same-origin requests
59
+ * always propagate.
60
+ */
61
+ propagateContextUrls?: (string | RegExp)[];
62
+ /**
63
+ * Pathname → low-cardinality route template (e.g. `/blog/[slug]`).
64
+ * Drives span renaming + `url.path` / `http.route` attrs across
65
+ * fetch, document-load, user-interaction, and long-task.
66
+ */
67
+ resolveRoute?: (pathname: string) => string | undefined;
68
+ /**
69
+ * The kernel's private provider — instrumentations register against
70
+ * it, not the global one, so customer OTel setups stay untouched.
71
+ */
72
+ tracerProvider: WebTracerProvider;
73
+ }
74
+ interface BundledInstrumentations {
75
+ dispose: () => void;
76
+ /** Idempotent toggle for the analytics-consent-gated pageEvents signals. */
77
+ setPageEventsEnabled: (enabled: boolean) => void;
78
+ }
79
+ /**
80
+ * Registers the browser auto-instrumentations against the kernel's
81
+ * private provider. Every instrumentation is enriched with the same
82
+ * route-template-aware URL attributes so dashboards can slice fetch /
83
+ * interaction / long-task / resource-load by `http.route` without
84
+ * cardinality blow-up from raw pathnames.
85
+ */
86
+ declare function registerBundledInstrumentations(input: InstrumentationsInput): {
87
+ dispose: () => void;
88
+ setPageEventsEnabled: (enabled: boolean) => void;
89
+ };
90
+ //#endregion
91
+ export { InstrumentationsInput as a, testOnlyApplyXhrSpanAttrs as c, testOnlyResolveFailureRanges as d, HttpStatusCodeRange as i, testOnlyClassifyNetworkError as l, CaptureFailedRequestsOption as n, registerBundledInstrumentations as o, CaptureFailedRequestsOptions as r, testOnlyApplyFetchSpanAttrs as s, BundledInstrumentations as t, testOnlyCreateFailureGate as u };
@@ -1,36 +1,2 @@
1
- //#region src/internal/activity.d.ts
2
- declare const IDLE_AFTER_MS: number;
3
- declare const EXPIRE_AFTER_MS: number;
4
- declare const MAX_AGE_MS: number;
5
- declare const CHECK_INTERVAL_MS: number;
6
- declare const KEEPALIVE_THROTTLE_MS = 1000;
7
- interface ActivitySession {
8
- markActivity: () => void;
9
- reset: () => void;
10
- /** Wall-clock epoch ms the session began; `0` when unknown. */
11
- startedAt: () => number;
12
- }
13
- type SessionResumeReason = "idle" | "rotated";
14
- type Handler<A> = (arg: A) => void;
15
- declare class ActivityMonitor {
16
- private session;
17
- private paused;
18
- private lastActivityMs;
19
- private keepaliveUntilMs;
20
- private checkTimer;
21
- private unsubscribeShown;
22
- private readonly pauseHandlers;
23
- private readonly resumeHandlers;
24
- onPause(handler: Handler<void>): () => void;
25
- onResume(handler: Handler<SessionResumeReason>): () => void;
26
- start(session: ActivitySession): void;
27
- stop(): void;
28
- private idleMs;
29
- private isOverMaxAge;
30
- private readonly poll;
31
- private readonly onInput;
32
- private resume;
33
- private touch;
34
- }
35
- //#endregion
1
+ import { a as IDLE_AFTER_MS, c as SessionResumeReason, i as EXPIRE_AFTER_MS, n as ActivitySession, o as KEEPALIVE_THROTTLE_MS, r as CHECK_INTERVAL_MS, s as MAX_AGE_MS, t as ActivityMonitor } from "../activity-BfYxFVcK.mjs";
36
2
  export { ActivityMonitor, ActivitySession, CHECK_INTERVAL_MS, EXPIRE_AFTER_MS, IDLE_AFTER_MS, KEEPALIVE_THROTTLE_MS, MAX_AGE_MS, SessionResumeReason };
@@ -1 +1 @@
1
- import{createLogger}from"../util/log.mjs";import{onPageShown}from"./page-lifecycle.mjs";const log=createLogger(`activity`),IDLE_AFTER_MS=3e5,EXPIRE_AFTER_MS=9e5,MAX_AGE_MS=864e5,CHECK_INTERVAL_MS=3e4,KEEPALIVE_THROTTLE_MS=1e3,ACTIVITY_EVENTS=[`pointerdown`,`keydown`,`scroll`,`touchstart`,`mousemove`];function monotonicNow(){return typeof performance>`u`?Date.now():performance.now()}function subscribe(set,handler){return set.add(handler),()=>{set.delete(handler)}}function fire(handlers,arg){for(let handler of handlers)try{handler(arg)}catch(error){log.warn(`activity handler threw`,error)}}var ActivityMonitor=class{session=null;paused=!1;lastActivityMs=0;keepaliveUntilMs=0;checkTimer=null;unsubscribeShown=null;pauseHandlers=new Set;resumeHandlers=new Set;onPause(handler){return subscribe(this.pauseHandlers,handler)}onResume(handler){return subscribe(this.resumeHandlers,handler)}start(session){if(this.checkTimer===null&&typeof globalThis.addEventListener==`function`){this.session=session,this.paused=!1,this.lastActivityMs=monotonicNow(),this.keepaliveUntilMs=0;for(let type of ACTIVITY_EVENTS)globalThis.addEventListener(type,this.onInput,{capture:!0,passive:!0});this.unsubscribeShown=onPageShown(this.onInput),this.checkTimer=setInterval(this.poll,CHECK_INTERVAL_MS)}}stop(){if(this.checkTimer!==null){clearInterval(this.checkTimer),this.checkTimer=null;for(let type of ACTIVITY_EVENTS)globalThis.removeEventListener(type,this.onInput,!0);this.unsubscribeShown?.(),this.unsubscribeShown=null,this.session=null,this.paused=!1,this.lastActivityMs=0,this.keepaliveUntilMs=0}}idleMs(){return monotonicNow()-this.lastActivityMs}isOverMaxAge(){let startedAt=this.session?.startedAt()??0;return startedAt>0&&Date.now()-startedAt>=864e5}poll=()=>{this.paused||(this.isOverMaxAge()||this.idleMs()>=3e5)&&(this.paused=!0,log.debug(`session paused`),fire(this.pauseHandlers))};onInput=()=>{let now=monotonicNow();if(this.isOverMaxAge()||now-this.lastActivityMs>=9e5){this.resume(now,`rotated`);return}if(this.paused){this.resume(now,`idle`);return}now<this.keepaliveUntilMs||(this.touch(now),this.session?.markActivity())};resume(now,reason){reason===`rotated`&&(log.debug(`resume after expiry → new session`),this.session?.reset()),this.paused=!1,this.touch(now),this.session?.markActivity(),fire(this.resumeHandlers,reason)}touch(now){this.lastActivityMs=now,this.keepaliveUntilMs=now+KEEPALIVE_THROTTLE_MS}};export{ActivityMonitor,CHECK_INTERVAL_MS,EXPIRE_AFTER_MS,IDLE_AFTER_MS,KEEPALIVE_THROTTLE_MS,MAX_AGE_MS};
1
+ import{createLogger}from"../util/log.mjs";import{onPageShown}from"./page-lifecycle.mjs";const log=createLogger(`activity`),IDLE_AFTER_MS=3e5,EXPIRE_AFTER_MS=9e5,MAX_AGE_MS=864e5,CHECK_INTERVAL_MS=3e4,KEEPALIVE_THROTTLE_MS=1e3,ACTIVITY_EVENTS=[`pointerdown`,`keydown`,`scroll`,`touchstart`,`mousemove`];function monotonicNow(){return typeof performance>`u`?Date.now():performance.now()}function subscribe(set,handler){return set.add(handler),(()=>{set.delete(handler)})}function fire(handlers,arg){for(let handler of handlers)try{handler(arg)}catch(error){log.warn(`activity handler threw: %s`,error instanceof Error?error.constructor.name:`UnknownError`)}}var ActivityMonitor=class{session=null;paused=!1;lastActivityMs=0;keepaliveUntilMs=0;checkTimer=null;unsubscribeShown=null;pauseHandlers=new Set;resumeHandlers=new Set;onPause(handler){return subscribe(this.pauseHandlers,handler)}onResume(handler){return subscribe(this.resumeHandlers,handler)}start(session){if(this.checkTimer===null&&typeof globalThis.addEventListener==`function`){this.session=session,this.paused=!1,this.lastActivityMs=monotonicNow(),this.keepaliveUntilMs=0;for(let type of ACTIVITY_EVENTS)globalThis.addEventListener(type,this.onInput,{capture:!0,passive:!0});this.unsubscribeShown=onPageShown(this.onInput),this.checkTimer=setInterval(this.poll,CHECK_INTERVAL_MS)}}stop(){if(this.checkTimer!==null){clearInterval(this.checkTimer),this.checkTimer=null;for(let type of ACTIVITY_EVENTS)globalThis.removeEventListener(type,this.onInput,!0);this.unsubscribeShown?.(),this.unsubscribeShown=null,this.session=null,this.paused=!1,this.lastActivityMs=0,this.keepaliveUntilMs=0}}idleMs(){return monotonicNow()-this.lastActivityMs}isOverMaxAge(){let startedAt=this.session?.startedAt()??0;return startedAt>0&&Date.now()-startedAt>=864e5}poll=()=>{this.paused||(this.isOverMaxAge()||this.idleMs()>=3e5)&&(this.paused=!0,log.debug(`session paused`),fire(this.pauseHandlers,void 0))};onInput=()=>{let now=monotonicNow();if(this.isOverMaxAge()||now-this.lastActivityMs>=9e5){this.resume(now,`rotated`);return}if(this.paused){this.resume(now,`idle`);return}now<this.keepaliveUntilMs||(this.touch(now),this.session?.markActivity())};resume(now,reason){reason===`rotated`&&(log.debug(`resume after expiry → new session`),this.session?.reset()),this.paused=!1,this.touch(now),this.session?.markActivity(),fire(this.resumeHandlers,reason)}touch(now){this.lastActivityMs=now,this.keepaliveUntilMs=now+KEEPALIVE_THROTTLE_MS}};export{ActivityMonitor,CHECK_INTERVAL_MS,EXPIRE_AFTER_MS,IDLE_AFTER_MS,KEEPALIVE_THROTTLE_MS,MAX_AGE_MS};
@@ -1,5 +1,45 @@
1
- import { BrowserContext } from "@interfere/types/sdk/plugins/context/browser";
2
1
  //#region src/internal/browser-context.d.ts
3
- declare function collectContext(): Promise<BrowserContext>;
4
- //#endregion
5
- export { collectContext };
2
+ export declare function collectContext(): Promise<{
3
+ browser: {
4
+ display: {
5
+ screen: {
6
+ height: number;
7
+ orientation: OrientationType;
8
+ width: number;
9
+ };
10
+ };
11
+ language: string;
12
+ timezone: string;
13
+ } | null;
14
+ device: {
15
+ browser: {
16
+ fullVersion?: string | undefined;
17
+ major?: string | undefined;
18
+ name?: string | undefined;
19
+ type?: string | undefined;
20
+ version?: string | undefined;
21
+ };
22
+ cpu: {
23
+ architecture?: string | undefined;
24
+ bitness?: string | undefined;
25
+ };
26
+ device: {
27
+ model?: string | undefined;
28
+ type?: string | undefined;
29
+ vendor?: string | undefined;
30
+ };
31
+ engine: {
32
+ name?: string | undefined;
33
+ version?: string | undefined;
34
+ };
35
+ frozenUa?: boolean | undefined;
36
+ os: {
37
+ name?: string | undefined;
38
+ version?: string | undefined;
39
+ versionFull?: string | undefined;
40
+ };
41
+ ua: string;
42
+ } | null;
43
+ runtime: "browser";
44
+ }>;
45
+ //#endregion
@@ -1 +1 @@
1
- import{UAParser}from"@ua-parser-js/pro-enterprise";import{InApps}from"@ua-parser-js/pro-enterprise/extensions";import{isFrozenUA}from"@ua-parser-js/pro-enterprise/helpers";const NOT_A_BRAND_REGEX=/not.a.brand/iu,HIGH_ENTROPY_HINTS=[`bitness`,`platformVersion`,`fullVersionList`];async function getDeviceMetadata(){if(typeof navigator>`u`)return null;let uaData=navigator.userAgentData,[parsed,hints]=await Promise.all([UAParser(navigator.userAgent,InApps).withClientHints(),uaData?.getHighEntropyValues?uaData.getHighEntropyValues(HIGH_ENTROPY_HINTS).catch(()=>({})):Promise.resolve({})]);if(!parsed)return null;let fullVersion=hints.fullVersionList?.find(b=>!NOT_A_BRAND_REGEX.test(b.brand))?.version;return{...parsed,browser:{...parsed.browser,...fullVersion?{fullVersion}:{}},cpu:{...parsed.cpu,...hints.bitness?{bitness:hints.bitness}:{}},os:{...parsed.os,...hints.platformVersion?{versionFull:hints.platformVersion}:{}},frozenUa:isFrozenUA(navigator.userAgent)}}function getBrowserMetadata(){if([typeof navigator,typeof screen,typeof globalThis].some(x=>x===`undefined`))return null;let{language}=navigator;return{language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,display:{screen:{height:screen.availHeight,width:screen.availWidth,orientation:screen.orientation?.type}}}}async function collectContext(){return{runtime:`browser`,browser:getBrowserMetadata(),device:await getDeviceMetadata()}}export{collectContext};
1
+ import{UAParser}from"@ua-parser-js/pro-enterprise";import{InApps}from"@ua-parser-js/pro-enterprise/extensions";import{isFrozenUA}from"@ua-parser-js/pro-enterprise/helpers";const NOT_A_BRAND_REGEX=/not.a.brand/iu,HIGH_ENTROPY_HINTS=[`bitness`,`platformVersion`,`fullVersionList`];async function getDeviceMetadata(){if(typeof navigator>`u`)return null;let uaData=navigator.userAgentData,[parsed,hints]=await Promise.all([UAParser(navigator.userAgent,InApps).withClientHints(),uaData?.getHighEntropyValues?uaData.getHighEntropyValues(HIGH_ENTROPY_HINTS).catch(()=>({})):Promise.resolve({})]);if(parsed==null)return null;let fullVersion=hints.fullVersionList?.find(b=>!NOT_A_BRAND_REGEX.test(b.brand))?.version,metadata={...parsed,browser:{...parsed.browser},cpu:{...parsed.cpu},frozenUa:isFrozenUA(navigator.userAgent),os:{...parsed.os}};return fullVersion&&(metadata.browser.fullVersion=fullVersion),hints.bitness&&(metadata.cpu.bitness=hints.bitness),hints.platformVersion&&(metadata.os.versionFull=hints.platformVersion),metadata}function getBrowserMetadata(){if([typeof navigator,typeof screen,typeof globalThis].some(x=>x===`undefined`))return null;let{language}=navigator;return{display:{screen:{height:screen.availHeight,orientation:screen.orientation?.type,width:screen.availWidth}},language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}async function collectContext(){return{browser:getBrowserMetadata(),device:await getDeviceMetadata(),runtime:`browser`}}export{collectContext};
@@ -1,4 +1,4 @@
1
- import { InterfereContext, InterfereContextValue } from "./react-context.mjs";
1
+ import { a as InterfereContextValue, i as InterfereContext } from "../provider-50LbJ4Tl.mjs";
2
2
  import { Component, ContextType, ReactNode } from "react";
3
3
  //#region src/internal/capture-boundary.d.ts
4
4
  interface CaptureBoundaryProps {
@@ -30,12 +30,13 @@ interface CaptureBoundaryState {
30
30
  * `mechanism.handled` is `false` because from Interfere's perspective we
31
31
  * captured the error but did not render a fallback — propagation continues.
32
32
  */
33
- declare class CaptureBoundary extends Component<CaptureBoundaryProps, CaptureBoundaryState> {
33
+ export declare class CaptureBoundary extends Component<CaptureBoundaryProps, CaptureBoundaryState> {
34
34
  static contextType: import("react").Context<InterfereContextValue | null>;
35
35
  context: ContextType<typeof InterfereContext>;
36
36
  state: CaptureBoundaryState;
37
- static getDerivedStateFromError(error: Error): CaptureBoundaryState;
37
+ static getDerivedStateFromError(error: Error): {
38
+ error: Error;
39
+ };
38
40
  render(): ReactNode;
39
41
  }
40
- //#endregion
41
- export { CaptureBoundary };
42
+ //#endregion
@@ -1 +1 @@
1
- "use client";import{captureReactError}from"./capture.mjs";import{InterfereContext}from"./react-context.mjs";import{hasServerDigest}from"./server-digest.mjs";import{MECHANISM_TYPE}from"@interfere/types/sdk/errors";import{Component}from"react";var CaptureBoundary=class extends Component{static contextType=InterfereContext;state={error:null};static getDerivedStateFromError(error){return{error}}render(){if(this.state.error)throw hasServerDigest(this.state.error)||captureReactError(this.context?.kernel??null,this.state.error,null,{type:MECHANISM_TYPE.react.captureBoundary,handled:!1}),this.state.error;return this.props.children}};export{CaptureBoundary};
1
+ "use client";import{captureReactError}from"./capture.mjs";import{InterfereContext}from"./react-context.mjs";import{hasServerDigest}from"./server-digest.mjs";import{MECHANISM_TYPE}from"@interfere/types/sdk/errors";import{Component}from"react";var CaptureBoundary=class extends Component{static contextType=InterfereContext;state={error:null};static getDerivedStateFromError(error){return{error}}render(){if(this.state.error)throw hasServerDigest(this.state.error)||captureReactError(this.context?.kernel??null,this.state.error,null,{handled:!1,type:MECHANISM_TYPE.react.captureBoundary}),this.state.error;return this.props.children}};export{CaptureBoundary};
@@ -1,4 +1,4 @@
1
- import { Kernel } from "./kernel.mjs";
1
+ import { s as Kernel } from "../provider-50LbJ4Tl.mjs";
2
2
  import { ErrorMechanism } from "@interfere/types/sdk/plugins/payload/errors";
3
3
  //#region src/internal/capture.d.ts
4
4
  /**
@@ -16,8 +16,7 @@ import { ErrorMechanism } from "@interfere/types/sdk/plugins/payload/errors";
16
16
  * `<InterfereProvider>` tree, in which case we silently skip capture and
17
17
  * let the host render its fallback / call its `onError` callback.
18
18
  */
19
- declare function captureReactError(kernel: Kernel | null, error: Error & {
19
+ export declare function captureReactError(kernel: Pick<Kernel, "recordException"> | null, error: Error & {
20
20
  digest?: string;
21
21
  }, componentStack: string | null | undefined, mechanism: ErrorMechanism): void;
22
- //#endregion
23
- export { captureReactError };
22
+ //#endregion
@@ -1 +1 @@
1
- import{isHydrationError}from"./hydration.mjs";import{parseReactComponentStack}from"@interfere/types/sdk/errors";function captureReactError(kernel,error,componentStack,mechanism){if(!kernel)return;let hydration=isHydrationError(error);kernel.recordException(error,{mechanism:hydration?{...mechanism,synthetic:!1}:mechanism,...hydration?{subtype:`hydration`}:{},...componentStack?{appendFrames:parseReactComponentStack(componentStack)}:{},...error.digest?{errorDigest:error.digest}:{}})}export{captureReactError};
1
+ import{isHydrationError}from"./hydration.mjs";import{parseReactComponentStack}from"@interfere/types/sdk/errors";import{omitUndefined}from"@interfere/helpers/omit-undefined";function captureReactError(kernel,error,componentStack,mechanism){if(!kernel)return;let hydration=isHydrationError(error);kernel.recordException(error,omitUndefined({mechanism:hydration?{...mechanism,synthetic:!1}:mechanism,subtype:hydration?`hydration`:void 0,appendFrames:componentStack?parseReactComponentStack(componentStack):void 0,errorDigest:error.digest||void 0}))}export{captureReactError};
@@ -1,29 +1,28 @@
1
1
  //#region src/internal/config.d.ts
2
- interface IngestTarget {
3
- headers: Headers;
4
- url: string;
5
- }
6
- interface AuthHeaders {
7
- headers: Headers;
8
- }
9
- declare function setIngestHost(host: string): void;
10
- declare function withQueryParam(url: string, key: string, value: string): string;
11
- declare function appendPathBeforeQuery(url: string, path: string): string;
12
- declare function resolveTargets(apiHost?: string, ingestHost?: string): {
13
- /**
14
- * Base URL for OTLP exports — the trace/metric exporters append the
15
- * sink path themselves. Avoids the kernel having to regex-strip
16
- * `/v2/sink` off the configured URL to derive a base.
17
- */
18
- collectorBaseUrl: string;
19
- config: IngestTarget;
20
- /**
21
- * Identity headers shared across every collector-bound request
22
- * (OTLP exporters, replay upload, session sync). One source of
23
- * truth for auth + force-enable.
24
- */
25
- ingest: AuthHeaders;
26
- session: IngestTarget;
2
+ /**
3
+ * Force enable is the explicit opt-in for telemetry outside production. It
4
+ * also overrides the bot gate, so a browser under test can start a kernel.
5
+ */
6
+ export declare function isForceEnableActive(): boolean;
7
+ export declare function setIngestHost(host: string): void;
8
+ export declare function resolveTargets(apiHost?: string, ingestHost?: string): {
9
+ config: {
10
+ headers: Record<string, string>;
11
+ publicKeyHeader: {
12
+ apiKey: string;
13
+ } | undefined;
14
+ timeoutInSeconds: number;
15
+ maxRetries: number;
16
+ baseUrl: string;
17
+ };
18
+ ingest: {
19
+ headers: Record<string, string>;
20
+ publicKeyHeader: {
21
+ apiKey: string;
22
+ } | undefined;
23
+ timeoutInSeconds: number;
24
+ maxRetries: number;
25
+ baseUrl: string;
26
+ };
27
27
  };
28
- //#endregion
29
- export { AuthHeaders, IngestTarget, appendPathBeforeQuery, resolveTargets, setIngestHost, withQueryParam };
28
+ //#endregion