@interfere/react 10.0.0 → 10.0.1-canary.1
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/api.d.mts.map +1 -1
- package/dist/api.mjs +1 -68
- package/dist/api.mjs.map +1 -1
- package/dist/error-boundary.d.mts +1 -2
- package/dist/error-boundary.d.mts.map +1 -1
- package/dist/error-boundary.mjs +1 -42
- package/dist/error-boundary.mjs.map +1 -1
- package/dist/internal/browser-context.d.mts.map +1 -1
- package/dist/internal/browser-context.mjs +1 -59
- package/dist/internal/browser-context.mjs.map +1 -1
- package/dist/internal/capture-boundary.d.mts +1 -2
- package/dist/internal/capture-boundary.d.mts.map +1 -1
- package/dist/internal/capture-boundary.mjs +1 -48
- package/dist/internal/capture-boundary.mjs.map +1 -1
- package/dist/internal/capture.mjs +1 -27
- package/dist/internal/capture.mjs.map +1 -1
- package/dist/internal/config.d.mts +3 -1
- package/dist/internal/config.d.mts.map +1 -1
- package/dist/internal/config.mjs +1 -33
- package/dist/internal/config.mjs.map +1 -1
- package/dist/internal/consent.d.mts.map +1 -1
- package/dist/internal/consent.mjs +1 -27
- package/dist/internal/consent.mjs.map +1 -1
- package/dist/internal/console-patch.d.mts.map +1 -1
- package/dist/internal/console-patch.mjs +1 -62
- package/dist/internal/console-patch.mjs.map +1 -1
- package/dist/internal/dom/actionable.d.mts.map +1 -1
- package/dist/internal/dom/actionable.mjs +1 -62
- package/dist/internal/dom/actionable.mjs.map +1 -1
- package/dist/internal/kernel-registry.d.mts.map +1 -1
- package/dist/internal/kernel-registry.mjs +1 -31
- package/dist/internal/kernel-registry.mjs.map +1 -1
- package/dist/internal/kernel.d.mts +1 -1
- package/dist/internal/kernel.d.mts.map +1 -1
- package/dist/internal/kernel.mjs +1 -322
- package/dist/internal/kernel.mjs.map +1 -1
- package/dist/internal/otel/exporter.d.mts +4 -12
- package/dist/internal/otel/exporter.d.mts.map +1 -1
- package/dist/internal/otel/exporter.mjs +1 -212
- package/dist/internal/otel/exporter.mjs.map +1 -1
- package/dist/internal/otel/index.mjs +1 -6
- package/dist/internal/otel/instrumentations.d.mts.map +1 -1
- package/dist/internal/otel/instrumentations.mjs +1 -150
- package/dist/internal/otel/instrumentations.mjs.map +1 -1
- package/dist/internal/otel/page-scope-context-manager.d.mts.map +1 -1
- package/dist/internal/otel/page-scope-context-manager.mjs +1 -36
- package/dist/internal/otel/page-scope-context-manager.mjs.map +1 -1
- package/dist/internal/otel/propagation.d.mts.map +1 -1
- package/dist/internal/otel/propagation.mjs +1 -40
- package/dist/internal/otel/propagation.mjs.map +1 -1
- package/dist/internal/otel/provider.d.mts +1 -2
- package/dist/internal/otel/provider.d.mts.map +1 -1
- package/dist/internal/otel/provider.mjs +1 -151
- package/dist/internal/otel/provider.mjs.map +1 -1
- package/dist/internal/otel/web-vitals.d.mts.map +1 -1
- package/dist/internal/otel/web-vitals.mjs +1 -162
- package/dist/internal/otel/web-vitals.mjs.map +1 -1
- package/dist/internal/page-lifecycle.d.mts.map +1 -1
- package/dist/internal/page-lifecycle.mjs +1 -33
- package/dist/internal/page-lifecycle.mjs.map +1 -1
- package/dist/internal/plugin-runtime.mjs +1 -101
- package/dist/internal/plugin-runtime.mjs.map +1 -1
- package/dist/internal/react-context.d.mts +1 -2
- package/dist/internal/react-context.d.mts.map +1 -1
- package/dist/internal/react-context.mjs +1 -34
- package/dist/internal/react-context.mjs.map +1 -1
- package/dist/internal/sw.d.mts.map +1 -1
- package/dist/internal/sw.mjs +1 -37
- package/dist/internal/sw.mjs.map +1 -1
- package/dist/internal/version.mjs +1 -7
- package/dist/internal/version.mjs.map +1 -1
- package/dist/internal/wrapper-singleton.d.mts.map +1 -1
- package/dist/internal/wrapper-singleton.mjs +1 -73
- package/dist/internal/wrapper-singleton.mjs.map +1 -1
- package/dist/package.mjs +1 -5
- package/dist/plugins/errors.d.mts.map +1 -1
- package/dist/plugins/errors.mjs +1 -84
- package/dist/plugins/errors.mjs.map +1 -1
- package/dist/plugins/lib/loader.mjs +1 -34
- package/dist/plugins/lib/loader.mjs.map +1 -1
- package/dist/plugins/lib/types.d.mts.map +1 -1
- package/dist/plugins/lib/types.mjs +1 -1
- package/dist/plugins/logs.d.mts.map +1 -1
- package/dist/plugins/logs.mjs +1 -53
- package/dist/plugins/logs.mjs.map +1 -1
- package/dist/plugins/rage-clicks.d.mts.map +1 -1
- package/dist/plugins/rage-clicks.mjs +1 -55
- package/dist/plugins/rage-clicks.mjs.map +1 -1
- package/dist/plugins/replay.d.mts.map +1 -1
- package/dist/plugins/replay.mjs +1 -101
- package/dist/plugins/replay.mjs.map +1 -1
- package/dist/provider.d.mts.map +1 -1
- package/dist/provider.mjs +1 -31
- package/dist/provider.mjs.map +1 -1
- package/dist/react-error-handler.d.mts.map +1 -1
- package/dist/react-error-handler.mjs +1 -62
- package/dist/react-error-handler.mjs.map +1 -1
- package/dist/tracking/api.d.mts.map +1 -1
- package/dist/tracking/api.mjs +1 -152
- package/dist/tracking/api.mjs.map +1 -1
- package/dist/tracking/device.d.mts.map +1 -1
- package/dist/tracking/device.mjs +1 -104
- package/dist/tracking/device.mjs.map +1 -1
- package/dist/tracking/geo.d.mts.map +1 -1
- package/dist/tracking/geo.mjs +2 -48
- package/dist/tracking/geo.mjs.map +1 -1
- package/dist/tracking/session.d.mts.map +1 -1
- package/dist/tracking/session.mjs +1 -75
- package/dist/tracking/session.mjs.map +1 -1
- package/dist/util/bot.d.mts.map +1 -1
- package/dist/util/bot.mjs +1 -14
- package/dist/util/bot.mjs.map +1 -1
- package/dist/util/global.d.mts.map +1 -1
- package/dist/util/global.mjs +1 -12
- package/dist/util/global.mjs.map +1 -1
- package/dist/util/log.d.mts.map +1 -1
- package/dist/util/log.mjs +1 -44
- package/dist/util/log.mjs.map +1 -1
- package/dist/util/stringify.d.mts.map +1 -1
- package/dist/util/stringify.mjs +1 -16
- package/dist/util/stringify.mjs.map +1 -1
- package/package.json +34 -33
package/dist/tracking/geo.mjs
CHANGED
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const CF_TRACE_URL = "https://cloudflare.com/cdn-cgi/trace";
|
|
4
|
-
function parseTrace(text) {
|
|
5
|
-
const result = {};
|
|
6
|
-
for (const line of text.split("\n")) {
|
|
7
|
-
const idx = line.indexOf("=");
|
|
8
|
-
if (idx > 0) result[line.slice(0, idx)] = line.slice(idx + 1);
|
|
9
|
-
}
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
12
|
-
var GeoDetector = class {
|
|
13
|
-
cached = null;
|
|
14
|
-
pending = null;
|
|
15
|
-
failed = false;
|
|
16
|
-
fetcher;
|
|
17
|
-
constructor(fetcher) {
|
|
18
|
-
this.fetcher = fetcher ?? globalThis.fetch.bind(globalThis);
|
|
19
|
-
}
|
|
20
|
-
detect() {
|
|
21
|
-
if (this.cached) return Promise.resolve(this.cached);
|
|
22
|
-
if (this.failed) return Promise.resolve(null);
|
|
23
|
-
if (!this.pending) this.pending = this.fetchCountryCode().then((code) => {
|
|
24
|
-
this.cached = code;
|
|
25
|
-
if (!code) this.failed = true;
|
|
26
|
-
this.pending = null;
|
|
27
|
-
return code;
|
|
28
|
-
});
|
|
29
|
-
return this.pending;
|
|
30
|
-
}
|
|
31
|
-
getCountry() {
|
|
32
|
-
return this.cached;
|
|
33
|
-
}
|
|
34
|
-
async fetchCountryCode() {
|
|
35
|
-
try {
|
|
36
|
-
const res = await this.fetcher(CF_TRACE_URL, { signal: AbortSignal.timeout(3e3) });
|
|
37
|
-
if (!res.ok) return null;
|
|
38
|
-
const raw = parseTrace(await res.text());
|
|
39
|
-
const trace = cloudflareTraceSchema.safeParse(raw);
|
|
40
|
-
if (!trace.success) return null;
|
|
41
|
-
return trace.data.loc.toUpperCase();
|
|
42
|
-
} catch {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
//#endregion
|
|
48
|
-
export { GeoDetector };
|
|
1
|
+
import{cloudflareTraceSchema}from"@interfere/types/sdk/geo";function parseTrace(text){let result={};for(let line of text.split(`
|
|
2
|
+
`)){let idx=line.indexOf(`=`);idx>0&&(result[line.slice(0,idx)]=line.slice(idx+1))}return result}var GeoDetector=class{cached=null;pending=null;failed=!1;fetcher;constructor(fetcher){this.fetcher=fetcher??globalThis.fetch.bind(globalThis)}detect(){return this.cached?Promise.resolve(this.cached):this.failed?Promise.resolve(null):(this.pending||=this.fetchCountryCode().then(code=>(this.cached=code,code||(this.failed=!0),this.pending=null,code)),this.pending)}getCountry(){return this.cached}async fetchCountryCode(){try{let res=await this.fetcher(`https://cloudflare.com/cdn-cgi/trace`,{signal:AbortSignal.timeout(3e3)});if(!res.ok)return null;let raw=parseTrace(await res.text()),trace=cloudflareTraceSchema.safeParse(raw);return trace.success?trace.data.loc.toUpperCase():null}catch{return null}}};export{GeoDetector};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geo.mjs","names":[],"sources":["../../src/tracking/geo.ts"],"sourcesContent":["import { cloudflareTraceSchema } from \"@interfere/types/sdk/geo\";\n\nconst CF_TRACE_URL = \"https://cloudflare.com/cdn-cgi/trace\";\n\nfunction parseTrace(text: string): Record<string, string> {\n const result: Record<string, string> = {};\n for (const line of text.split(\"\\n\")) {\n const idx = line.indexOf(\"=\");\n if (idx > 0) {\n result[line.slice(0, idx)] = line.slice(idx + 1);\n }\n }\n return result;\n}\n\nexport class GeoDetector {\n private cached: string | null = null;\n private pending: Promise<string | null> | null = null;\n private failed = false;\n private readonly fetcher: typeof globalThis.fetch;\n\n constructor(fetcher?: typeof globalThis.fetch) {\n this.fetcher = fetcher ?? globalThis.fetch.bind(globalThis);\n }\n\n detect(): Promise<string | null> {\n if (this.cached) {\n return Promise.resolve(this.cached);\n }\n\n if (this.failed) {\n return Promise.resolve(null);\n }\n\n if (!this.pending) {\n this.pending = this.fetchCountryCode().then((code) => {\n this.cached = code;\n if (!code) {\n this.failed = true;\n }\n this.pending = null;\n return code;\n });\n }\n\n return this.pending;\n }\n\n getCountry(): string | null {\n return this.cached;\n }\n\n private async fetchCountryCode(): Promise<string | null> {\n try {\n const res = await this.fetcher(CF_TRACE_URL, {\n signal: AbortSignal.timeout(3000),\n });\n if (!res.ok) {\n return null;\n }\n\n const raw = parseTrace(await res.text());\n const trace = cloudflareTraceSchema.safeParse(raw);\n if (!trace.success) {\n return null;\n }\n\n return trace.data.loc.toUpperCase();\n } catch {\n return null;\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"geo.mjs","names":[],"sources":["../../src/tracking/geo.ts"],"sourcesContent":["import { cloudflareTraceSchema } from \"@interfere/types/sdk/geo\";\n\nconst CF_TRACE_URL = \"https://cloudflare.com/cdn-cgi/trace\";\n\nfunction parseTrace(text: string): Record<string, string> {\n const result: Record<string, string> = {};\n for (const line of text.split(\"\\n\")) {\n const idx = line.indexOf(\"=\");\n if (idx > 0) {\n result[line.slice(0, idx)] = line.slice(idx + 1);\n }\n }\n return result;\n}\n\nexport class GeoDetector {\n private cached: string | null = null;\n private pending: Promise<string | null> | null = null;\n private failed = false;\n private readonly fetcher: typeof globalThis.fetch;\n\n constructor(fetcher?: typeof globalThis.fetch) {\n this.fetcher = fetcher ?? globalThis.fetch.bind(globalThis);\n }\n\n detect(): Promise<string | null> {\n if (this.cached) {\n return Promise.resolve(this.cached);\n }\n\n if (this.failed) {\n return Promise.resolve(null);\n }\n\n if (!this.pending) {\n this.pending = this.fetchCountryCode().then((code) => {\n this.cached = code;\n if (!code) {\n this.failed = true;\n }\n this.pending = null;\n return code;\n });\n }\n\n return this.pending;\n }\n\n getCountry(): string | null {\n return this.cached;\n }\n\n private async fetchCountryCode(): Promise<string | null> {\n try {\n const res = await this.fetcher(CF_TRACE_URL, {\n signal: AbortSignal.timeout(3000),\n });\n if (!res.ok) {\n return null;\n }\n\n const raw = parseTrace(await res.text());\n const trace = cloudflareTraceSchema.safeParse(raw);\n if (!trace.success) {\n return null;\n }\n\n return trace.data.loc.toUpperCase();\n } catch {\n return null;\n }\n }\n}\n"],"mappings":"4DAIA,SAAS,WAAW,KAAsC,CACxD,IAAM,OAAiC,CAAC,EACxC,IAAK,IAAM,QAAQ,KAAK,MAAM;CAAI,EAAG,CACnC,IAAM,IAAM,KAAK,QAAQ,GAAG,EACxB,IAAM,IACR,OAAO,KAAK,MAAM,EAAG,GAAG,GAAK,KAAK,MAAM,IAAM,CAAC,EAEnD,CACA,OAAO,MACT,CAEA,IAAa,YAAb,KAAyB,CACvB,OAAgC,KAChC,QAAiD,KACjD,OAAiB,GACjB,QAEA,YAAY,QAAmC,CAC7C,KAAK,QAAU,SAAW,WAAW,MAAM,KAAK,UAAU,CAC5D,CAEA,QAAiC,CAoB/B,OAnBI,KAAK,OACA,QAAQ,QAAQ,KAAK,MAAM,EAGhC,KAAK,OACA,QAAQ,QAAQ,IAAI,GAG7B,AACE,KAAK,UAAU,KAAK,iBAAiB,EAAE,KAAM,OAC3C,KAAK,OAAS,KACT,OACH,KAAK,OAAS,IAEhB,KAAK,QAAU,KACR,KACR,EAGI,KAAK,QACd,CAEA,YAA4B,CAC1B,OAAO,KAAK,MACd,CAEA,MAAc,kBAA2C,CACvD,GAAI,CACF,IAAM,IAAM,MAAM,KAAK,QAAQ,uCAAc,CAC3C,OAAQ,YAAY,QAAQ,GAAI,CAClC,CAAC,EACD,GAAI,CAAC,IAAI,GACP,OAAO,KAGT,IAAM,IAAM,WAAW,MAAM,IAAI,KAAK,CAAC,EACjC,MAAQ,sBAAsB,UAAU,GAAG,EAKjD,OAJK,MAAM,QAIJ,MAAM,KAAK,IAAI,YAAY,EAHzB,IAIX,MAAQ,CACN,OAAO,IACT,CACF,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.mts","names":[],"sources":["../../src/tracking/session.ts"],"mappings":";;;KAqBY,QAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"session.d.mts","names":[],"sources":["../../src/tracking/session.ts"],"mappings":";;;KAqBY,QAAA,IAAY,SAAiB;AAAA,cAE5B,cAAA;EACX,SAAA;EACA,QAAA;EAAA,iBACiB,KAAA;EAAA,iBACA,OAAA;EAAA,iBACA,QAAA;EAAA,QACT,cAAA;cAEI,QAAA,GAAW,QAAA;EAOvB,YAAA,CAAA,GAAgB,SAAS;EAQzB,WAAA,CAAA;EAAA,QAgBQ,OAAA;EAAA,QAWA,MAAA;EAAA,QAQA,KAAA;EAAA,QAKA,SAAA;AAAA"}
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/tracking/session.ts
|
|
3
|
-
const SESSION_ID_KEY = "interfere:session_id";
|
|
4
|
-
const LAST_ACTIVITY_KEY = "interfere:last_activity";
|
|
5
|
-
const WINDOW_ID_KEY = "interfere:window_id";
|
|
6
|
-
const SESSION_TIMEOUT_MS = 1800 * 1e3;
|
|
7
|
-
function tryStorage(type) {
|
|
8
|
-
try {
|
|
9
|
-
const s = globalThis[type];
|
|
10
|
-
const key = "__interfere_probe__";
|
|
11
|
-
s.setItem(key, "1");
|
|
12
|
-
s.removeItem(key);
|
|
13
|
-
return s;
|
|
14
|
-
} catch {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
var SessionManager = class {
|
|
19
|
-
sessionId = null;
|
|
20
|
-
windowId = null;
|
|
21
|
-
local;
|
|
22
|
-
session;
|
|
23
|
-
onRotate = null;
|
|
24
|
-
lastActivityMs = 0;
|
|
25
|
-
constructor(onRotate) {
|
|
26
|
-
this.local = tryStorage("localStorage");
|
|
27
|
-
this.session = tryStorage("sessionStorage");
|
|
28
|
-
this.onRotate = onRotate ?? null;
|
|
29
|
-
this.restore();
|
|
30
|
-
}
|
|
31
|
-
getSessionId() {
|
|
32
|
-
if (this.sessionId && !this.isExpired()) {
|
|
33
|
-
this.touch();
|
|
34
|
-
return this.sessionId;
|
|
35
|
-
}
|
|
36
|
-
return this.rotate();
|
|
37
|
-
}
|
|
38
|
-
getWindowId() {
|
|
39
|
-
if (this.windowId) return this.windowId;
|
|
40
|
-
const stored = this.session?.getItem(WINDOW_ID_KEY);
|
|
41
|
-
if (stored) {
|
|
42
|
-
this.windowId = stored;
|
|
43
|
-
return stored;
|
|
44
|
-
}
|
|
45
|
-
this.windowId = `win_${crypto.randomUUID()}`;
|
|
46
|
-
this.session?.setItem(WINDOW_ID_KEY, this.windowId);
|
|
47
|
-
return this.windowId;
|
|
48
|
-
}
|
|
49
|
-
restore() {
|
|
50
|
-
const stored = this.local?.getItem(SESSION_ID_KEY);
|
|
51
|
-
if (stored && !this.isExpired()) {
|
|
52
|
-
this.sessionId = stored;
|
|
53
|
-
this.touch();
|
|
54
|
-
} else this.rotate();
|
|
55
|
-
}
|
|
56
|
-
rotate() {
|
|
57
|
-
this.sessionId = v7();
|
|
58
|
-
this.local?.setItem(SESSION_ID_KEY, this.sessionId);
|
|
59
|
-
this.touch();
|
|
60
|
-
this.onRotate?.(this.sessionId);
|
|
61
|
-
return this.sessionId;
|
|
62
|
-
}
|
|
63
|
-
touch() {
|
|
64
|
-
this.lastActivityMs = Date.now();
|
|
65
|
-
this.local?.setItem(LAST_ACTIVITY_KEY, String(this.lastActivityMs));
|
|
66
|
-
}
|
|
67
|
-
isExpired() {
|
|
68
|
-
const raw = this.local?.getItem(LAST_ACTIVITY_KEY);
|
|
69
|
-
const ts = raw ? Number(raw) : this.lastActivityMs;
|
|
70
|
-
if (ts === 0) return true;
|
|
71
|
-
return Date.now() - ts > SESSION_TIMEOUT_MS;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
//#endregion
|
|
75
|
-
export { SessionManager };
|
|
1
|
+
import{v7}from"uuid";const SESSION_ID_KEY=`interfere:session_id`,LAST_ACTIVITY_KEY=`interfere:last_activity`,WINDOW_ID_KEY=`interfere:window_id`;function tryStorage(type){try{let s=globalThis[type],key=`__interfere_probe__`;return s.setItem(key,`1`),s.removeItem(key),s}catch{return null}}var SessionManager=class{sessionId=null;windowId=null;local;session;onRotate=null;lastActivityMs=0;constructor(onRotate){this.local=tryStorage(`localStorage`),this.session=tryStorage(`sessionStorage`),this.onRotate=onRotate??null,this.restore()}getSessionId(){return this.sessionId&&!this.isExpired()?(this.touch(),this.sessionId):this.rotate()}getWindowId(){if(this.windowId)return this.windowId;let stored=this.session?.getItem(WINDOW_ID_KEY);return stored?(this.windowId=stored,stored):(this.windowId=`win_${crypto.randomUUID()}`,this.session?.setItem(WINDOW_ID_KEY,this.windowId),this.windowId)}restore(){let stored=this.local?.getItem(SESSION_ID_KEY);stored&&!this.isExpired()?(this.sessionId=stored,this.touch()):this.rotate()}rotate(){return this.sessionId=v7(),this.local?.setItem(SESSION_ID_KEY,this.sessionId),this.touch(),this.onRotate?.(this.sessionId),this.sessionId}touch(){this.lastActivityMs=Date.now(),this.local?.setItem(LAST_ACTIVITY_KEY,String(this.lastActivityMs))}isExpired(){let raw=this.local?.getItem(LAST_ACTIVITY_KEY),ts=raw?Number(raw):this.lastActivityMs;return ts===0?!0:Date.now()-ts>18e5}};export{SessionManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.mjs","names":["uuidv7"],"sources":["../../src/tracking/session.ts"],"sourcesContent":["import type { SessionId } from \"@interfere/types/data/session\";\n\nimport { v7 as uuidv7 } from \"uuid\";\n\nconst SESSION_ID_KEY = \"interfere:session_id\";\nconst LAST_ACTIVITY_KEY = \"interfere:last_activity\";\nconst WINDOW_ID_KEY = \"interfere:window_id\";\nconst SESSION_TIMEOUT_MS = 30 * 60 * 1000;\n\nfunction tryStorage(type: \"localStorage\" | \"sessionStorage\"): Storage | null {\n try {\n const s = globalThis[type];\n const key = \"__interfere_probe__\";\n s.setItem(key, \"1\");\n s.removeItem(key);\n return s;\n } catch {\n return null;\n }\n}\n\nexport type OnRotate = (sessionId: string) => void;\n\nexport class SessionManager {\n sessionId: string | null = null;\n windowId: string | null = null;\n private readonly local: Storage | null;\n private readonly session: Storage | null;\n private readonly onRotate: OnRotate | null = null;\n private lastActivityMs = 0;\n\n constructor(onRotate?: OnRotate) {\n this.local = tryStorage(\"localStorage\");\n this.session = tryStorage(\"sessionStorage\");\n this.onRotate = onRotate ?? null;\n this.restore();\n }\n\n getSessionId(): SessionId {\n if (this.sessionId && !this.isExpired()) {\n this.touch();\n return this.sessionId as SessionId;\n }\n return this.rotate() as SessionId;\n }\n\n getWindowId(): string {\n if (this.windowId) {\n return this.windowId;\n }\n\n const stored = this.session?.getItem(WINDOW_ID_KEY);\n if (stored) {\n this.windowId = stored;\n return stored;\n }\n\n this.windowId = `win_${crypto.randomUUID()}`;\n this.session?.setItem(WINDOW_ID_KEY, this.windowId);\n return this.windowId;\n }\n\n private restore(): void {\n const stored = this.local?.getItem(SESSION_ID_KEY);\n\n if (stored && !this.isExpired()) {\n this.sessionId = stored;\n this.touch();\n } else {\n this.rotate();\n }\n }\n\n private rotate(): SessionId {\n this.sessionId = uuidv7();\n this.local?.setItem(SESSION_ID_KEY, this.sessionId);\n this.touch();\n this.onRotate?.(this.sessionId);\n return this.sessionId as SessionId;\n }\n\n private touch(): void {\n this.lastActivityMs = Date.now();\n this.local?.setItem(LAST_ACTIVITY_KEY, String(this.lastActivityMs));\n }\n\n private isExpired(): boolean {\n const raw = this.local?.getItem(LAST_ACTIVITY_KEY);\n const ts = raw ? Number(raw) : this.lastActivityMs;\n\n if (ts === 0) {\n return true;\n }\n return Date.now() - ts > SESSION_TIMEOUT_MS;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.mjs","names":["uuidv7"],"sources":["../../src/tracking/session.ts"],"sourcesContent":["import type { SessionId } from \"@interfere/types/data/session\";\n\nimport { v7 as uuidv7 } from \"uuid\";\n\nconst SESSION_ID_KEY = \"interfere:session_id\";\nconst LAST_ACTIVITY_KEY = \"interfere:last_activity\";\nconst WINDOW_ID_KEY = \"interfere:window_id\";\nconst SESSION_TIMEOUT_MS = 30 * 60 * 1000;\n\nfunction tryStorage(type: \"localStorage\" | \"sessionStorage\"): Storage | null {\n try {\n const s = globalThis[type];\n const key = \"__interfere_probe__\";\n s.setItem(key, \"1\");\n s.removeItem(key);\n return s;\n } catch {\n return null;\n }\n}\n\nexport type OnRotate = (sessionId: string) => void;\n\nexport class SessionManager {\n sessionId: string | null = null;\n windowId: string | null = null;\n private readonly local: Storage | null;\n private readonly session: Storage | null;\n private readonly onRotate: OnRotate | null = null;\n private lastActivityMs = 0;\n\n constructor(onRotate?: OnRotate) {\n this.local = tryStorage(\"localStorage\");\n this.session = tryStorage(\"sessionStorage\");\n this.onRotate = onRotate ?? null;\n this.restore();\n }\n\n getSessionId(): SessionId {\n if (this.sessionId && !this.isExpired()) {\n this.touch();\n return this.sessionId as SessionId;\n }\n return this.rotate() as SessionId;\n }\n\n getWindowId(): string {\n if (this.windowId) {\n return this.windowId;\n }\n\n const stored = this.session?.getItem(WINDOW_ID_KEY);\n if (stored) {\n this.windowId = stored;\n return stored;\n }\n\n this.windowId = `win_${crypto.randomUUID()}`;\n this.session?.setItem(WINDOW_ID_KEY, this.windowId);\n return this.windowId;\n }\n\n private restore(): void {\n const stored = this.local?.getItem(SESSION_ID_KEY);\n\n if (stored && !this.isExpired()) {\n this.sessionId = stored;\n this.touch();\n } else {\n this.rotate();\n }\n }\n\n private rotate(): SessionId {\n this.sessionId = uuidv7();\n this.local?.setItem(SESSION_ID_KEY, this.sessionId);\n this.touch();\n this.onRotate?.(this.sessionId);\n return this.sessionId as SessionId;\n }\n\n private touch(): void {\n this.lastActivityMs = Date.now();\n this.local?.setItem(LAST_ACTIVITY_KEY, String(this.lastActivityMs));\n }\n\n private isExpired(): boolean {\n const raw = this.local?.getItem(LAST_ACTIVITY_KEY);\n const ts = raw ? Number(raw) : this.lastActivityMs;\n\n if (ts === 0) {\n return true;\n }\n return Date.now() - ts > SESSION_TIMEOUT_MS;\n }\n}\n"],"mappings":"qBAIA,MAAM,eAAiB,uBACjB,kBAAoB,0BACpB,cAAgB,sBAGtB,SAAS,WAAW,KAAyD,CAC3E,GAAI,CACF,IAAM,EAAI,WAAW,MACf,IAAM,sBAGZ,OAFA,EAAE,QAAQ,IAAK,GAAG,EAClB,EAAE,WAAW,GAAG,EACT,CACT,MAAQ,CACN,OAAO,IACT,CACF,CAIA,IAAa,eAAb,KAA4B,CAC1B,UAA2B,KAC3B,SAA0B,KAC1B,MACA,QACA,SAA6C,KAC7C,eAAyB,EAEzB,YAAY,SAAqB,CAC/B,KAAK,MAAQ,WAAW,cAAc,EACtC,KAAK,QAAU,WAAW,gBAAgB,EAC1C,KAAK,SAAW,UAAY,KAC5B,KAAK,QAAQ,CACf,CAEA,cAA0B,CAKxB,OAJI,KAAK,WAAa,CAAC,KAAK,UAAU,GACpC,KAAK,MAAM,EACJ,KAAK,WAEP,KAAK,OAAO,CACrB,CAEA,aAAsB,CACpB,GAAI,KAAK,SACP,OAAO,KAAK,SAGd,IAAM,OAAS,KAAK,SAAS,QAAQ,aAAa,EAQlD,OAPI,QACF,KAAK,SAAW,OACT,SAGT,KAAK,SAAW,OAAO,OAAO,WAAW,IACzC,KAAK,SAAS,QAAQ,cAAe,KAAK,QAAQ,EAC3C,KAAK,SACd,CAEA,SAAwB,CACtB,IAAM,OAAS,KAAK,OAAO,QAAQ,cAAc,EAE7C,QAAU,CAAC,KAAK,UAAU,GAC5B,KAAK,UAAY,OACjB,KAAK,MAAM,GAEX,KAAK,OAAO,CAEhB,CAEA,QAA4B,CAK1B,MAJA,MAAK,UAAYA,GAAO,EACxB,KAAK,OAAO,QAAQ,eAAgB,KAAK,SAAS,EAClD,KAAK,MAAM,EACX,KAAK,WAAW,KAAK,SAAS,EACvB,KAAK,SACd,CAEA,OAAsB,CACpB,KAAK,eAAiB,KAAK,IAAI,EAC/B,KAAK,OAAO,QAAQ,kBAAmB,OAAO,KAAK,cAAc,CAAC,CACpE,CAEA,WAA6B,CAC3B,IAAM,IAAM,KAAK,OAAO,QAAQ,iBAAiB,EAC3C,GAAK,IAAM,OAAO,GAAG,EAAI,KAAK,eAKpC,OAHI,KAAO,EACF,GAEF,KAAK,IAAI,EAAI,GAAK,IAC3B,CACF"}
|
package/dist/util/bot.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.d.mts","names":[],"sources":["../../src/util/bot.ts"],"mappings":";;AAQA
|
|
1
|
+
{"version":3,"file":"bot.d.mts","names":[],"sources":["../../src/util/bot.ts"],"mappings":";;AAQA;;;;AAA8B;iBAAd,cAAA,CAAA"}
|
package/dist/util/bot.mjs
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/util/bot.ts
|
|
3
|
-
/**
|
|
4
|
-
* `isBot` covers the union of the Crawlers, Fetchers, CLIs, and Libraries
|
|
5
|
-
* extensions, so `isAICrawler` / `isAIAssistant` are strict subsets that
|
|
6
|
-
* don't need separate checks. Returns `false` outside the browser (no UA
|
|
7
|
-
* to inspect).
|
|
8
|
-
*/
|
|
9
|
-
function isBotUserAgent() {
|
|
10
|
-
if (typeof navigator === "undefined") return false;
|
|
11
|
-
return isBot(navigator.userAgent);
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { isBotUserAgent };
|
|
1
|
+
import{isBot}from"@ua-parser-js/pro-enterprise/bot-detection";function isBotUserAgent(){return typeof navigator>`u`?!1:isBot(navigator.userAgent)}export{isBotUserAgent};
|
package/dist/util/bot.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.mjs","names":[],"sources":["../../src/util/bot.ts"],"sourcesContent":["import { isBot } from \"@ua-parser-js/pro-enterprise/bot-detection\";\n\n/**\n * `isBot` covers the union of the Crawlers, Fetchers, CLIs, and Libraries\n * extensions, so `isAICrawler` / `isAIAssistant` are strict subsets that\n * don't need separate checks. Returns `false` outside the browser (no UA\n * to inspect).\n */\nexport function isBotUserAgent(): boolean {\n if (typeof navigator === \"undefined\") {\n return false;\n }\n return isBot(navigator.userAgent);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bot.mjs","names":[],"sources":["../../src/util/bot.ts"],"sourcesContent":["import { isBot } from \"@ua-parser-js/pro-enterprise/bot-detection\";\n\n/**\n * `isBot` covers the union of the Crawlers, Fetchers, CLIs, and Libraries\n * extensions, so `isAICrawler` / `isAIAssistant` are strict subsets that\n * don't need separate checks. Returns `false` outside the browser (no UA\n * to inspect).\n */\nexport function isBotUserAgent(): boolean {\n if (typeof navigator === \"undefined\") {\n return false;\n }\n return isBot(navigator.userAgent);\n}\n"],"mappings":"8DAQA,SAAgB,gBAA0B,CAIxC,OAHI,OAAO,UAAc,IAChB,GAEF,MAAM,UAAU,SAAS,CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.mts","names":[],"sources":["../../src/util/global.ts"],"mappings":";;AAMA;;;;;iBAAgB,SAAA,GAAA,CAAa,GAAA,WAAc,
|
|
1
|
+
{"version":3,"file":"global.d.mts","names":[],"sources":["../../src/util/global.ts"],"mappings":";;AAMA;;;;;iBAAgB,SAAA,GAAA,CAAa,GAAA,WAAc,CAAC"}
|
package/dist/util/global.mjs
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Typed read of a build-time-injected global. The Vite plugin and
|
|
4
|
-
* `withInterfere()` stamp values like `__INTERFERE_RELEASE_SLUG__` onto
|
|
5
|
-
* `globalThis`; this is the single read site so the unsafe cast lives in
|
|
6
|
-
* one place.
|
|
7
|
-
*/
|
|
8
|
-
function getGlobal(key) {
|
|
9
|
-
return globalThis[key];
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { getGlobal };
|
|
1
|
+
function getGlobal(key){return globalThis[key]}export{getGlobal};
|
package/dist/util/global.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.mjs","names":[],"sources":["../../src/util/global.ts"],"sourcesContent":["/**\n * Typed read of a build-time-injected global. The Vite plugin and\n * `withInterfere()` stamp values like `__INTERFERE_RELEASE_SLUG__` onto\n * `globalThis`; this is the single read site so the unsafe cast lives in\n * one place.\n */\nexport function getGlobal<T>(key: string): T | undefined {\n return (globalThis as Record<string, unknown>)[key] as T | undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"global.mjs","names":[],"sources":["../../src/util/global.ts"],"sourcesContent":["/**\n * Typed read of a build-time-injected global. The Vite plugin and\n * `withInterfere()` stamp values like `__INTERFERE_RELEASE_SLUG__` onto\n * `globalThis`; this is the single read site so the unsafe cast lives in\n * one place.\n */\nexport function getGlobal<T>(key: string): T | undefined {\n return (globalThis as Record<string, unknown>)[key] as T | undefined;\n}\n"],"mappings":"AAMA,SAAgB,UAAa,IAA4B,CACvD,OAAQ,WAAuC,IACjD"}
|
package/dist/util/log.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.mts","names":[],"sources":["../../src/util/log.ts"],"mappings":";KAAY,QAAA;AAAA,iBA6BI,WAAA,CAAY,
|
|
1
|
+
{"version":3,"file":"log.d.mts","names":[],"sources":["../../src/util/log.ts"],"mappings":";KAAY,QAAA;AAAA,iBA6BI,WAAA,CAAY,KAAe,EAAR,QAAQ;AAAA,iBAI3B,WAAA,CAAA,GAAe,QAAQ;AAAA,UAKtB,MAAA;EACf,KAAA,IAAS,IAAA;EACT,KAAA,IAAS,IAAA;EACT,IAAA,IAAQ,IAAA;EACR,IAAA,IAAQ,IAAA;AAAA;AAAA,iBAeM,YAAA,CAAa,KAAA,WAAgB,MAAM"}
|
package/dist/util/log.mjs
CHANGED
|
@@ -1,44 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const PRIORITY = {
|
|
3
|
-
debug: 0,
|
|
4
|
-
info: 1,
|
|
5
|
-
warn: 2,
|
|
6
|
-
error: 3,
|
|
7
|
-
none: 4
|
|
8
|
-
};
|
|
9
|
-
const CONSOLE_FN = {
|
|
10
|
-
debug: "debug",
|
|
11
|
-
info: "info",
|
|
12
|
-
warn: "warn",
|
|
13
|
-
error: "error"
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Customer apps see `warn` and above by default. Tests opt into silence by
|
|
17
|
-
* calling `setLogLevel("none")` in their setup file (we don't auto-detect
|
|
18
|
-
* the test runtime — verified empirically that vitest browser mode exposes
|
|
19
|
-
* neither `import.meta.env`, `process.env`, nor `__VITEST_*` globals to
|
|
20
|
-
* library code, so any "is this a test?" probe is unreliable).
|
|
21
|
-
*/
|
|
22
|
-
let threshold = PRIORITY.warn;
|
|
23
|
-
function setLogLevel(level) {
|
|
24
|
-
threshold = PRIORITY[level];
|
|
25
|
-
}
|
|
26
|
-
function getLogLevel() {
|
|
27
|
-
return Object.entries(PRIORITY).find(([, v]) => v === threshold)?.[0] ?? "warn";
|
|
28
|
-
}
|
|
29
|
-
function emit(level, prefix, args) {
|
|
30
|
-
if (PRIORITY[level] < threshold) return;
|
|
31
|
-
const fn = CONSOLE_FN[level];
|
|
32
|
-
globalThis.console[fn](prefix, ...args);
|
|
33
|
-
}
|
|
34
|
-
function createLogger(scope) {
|
|
35
|
-
const prefix = `[Interfere:${scope}]`;
|
|
36
|
-
return {
|
|
37
|
-
debug: (...args) => emit("debug", prefix, args),
|
|
38
|
-
info: (...args) => emit("info", prefix, args),
|
|
39
|
-
warn: (...args) => emit("warn", prefix, args),
|
|
40
|
-
error: (...args) => emit("error", prefix, args)
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
export { createLogger, getLogLevel, setLogLevel };
|
|
1
|
+
const PRIORITY={debug:0,info:1,warn:2,error:3,none:4},CONSOLE_FN={debug:`debug`,info:`info`,warn:`warn`,error:`error`};let threshold=PRIORITY.warn;function setLogLevel(level){threshold=PRIORITY[level]}function getLogLevel(){return Object.entries(PRIORITY).find(([,v])=>v===threshold)?.[0]??`warn`}function emit(level,prefix,args){if(PRIORITY[level]<threshold)return;let fn=CONSOLE_FN[level];globalThis.console[fn](prefix,...args)}function createLogger(scope){let prefix=`[Interfere:${scope}]`;return{debug:(...args)=>emit(`debug`,prefix,args),info:(...args)=>emit(`info`,prefix,args),warn:(...args)=>emit(`warn`,prefix,args),error:(...args)=>emit(`error`,prefix,args)}}export{createLogger,getLogLevel,setLogLevel};
|
package/dist/util/log.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.mjs","names":[],"sources":["../../src/util/log.ts"],"sourcesContent":["export type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\" | \"none\";\n\nconst PRIORITY: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n none: 4,\n};\n\nconst CONSOLE_FN: Record<\n Exclude<LogLevel, \"none\">,\n \"debug\" | \"info\" | \"warn\" | \"error\"\n> = {\n debug: \"debug\",\n info: \"info\",\n warn: \"warn\",\n error: \"error\",\n};\n\n/**\n * Customer apps see `warn` and above by default. Tests opt into silence by\n * calling `setLogLevel(\"none\")` in their setup file (we don't auto-detect\n * the test runtime — verified empirically that vitest browser mode exposes\n * neither `import.meta.env`, `process.env`, nor `__VITEST_*` globals to\n * library code, so any \"is this a test?\" probe is unreliable).\n */\nlet threshold = PRIORITY.warn;\n\nexport function setLogLevel(level: LogLevel): void {\n threshold = PRIORITY[level];\n}\n\nexport function getLogLevel(): LogLevel {\n const entry = Object.entries(PRIORITY).find(([, v]) => v === threshold);\n return (entry?.[0] ?? \"warn\") as LogLevel;\n}\n\nexport interface Logger {\n debug(...args: unknown[]): void;\n error(...args: unknown[]): void;\n info(...args: unknown[]): void;\n warn(...args: unknown[]): void;\n}\n\nfunction emit(\n level: Exclude<LogLevel, \"none\">,\n prefix: string,\n args: unknown[]\n): void {\n if (PRIORITY[level] < threshold) {\n return;\n }\n const fn = CONSOLE_FN[level];\n globalThis.console[fn](prefix, ...args);\n}\n\nexport function createLogger(scope: string): Logger {\n const prefix = `[Interfere:${scope}]`;\n return {\n debug: (...args) => emit(\"debug\", prefix, args),\n info: (...args) => emit(\"info\", prefix, args),\n warn: (...args) => emit(\"warn\", prefix, args),\n error: (...args) => emit(\"error\", prefix, args),\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.mjs","names":[],"sources":["../../src/util/log.ts"],"sourcesContent":["export type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\" | \"none\";\n\nconst PRIORITY: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n none: 4,\n};\n\nconst CONSOLE_FN: Record<\n Exclude<LogLevel, \"none\">,\n \"debug\" | \"info\" | \"warn\" | \"error\"\n> = {\n debug: \"debug\",\n info: \"info\",\n warn: \"warn\",\n error: \"error\",\n};\n\n/**\n * Customer apps see `warn` and above by default. Tests opt into silence by\n * calling `setLogLevel(\"none\")` in their setup file (we don't auto-detect\n * the test runtime — verified empirically that vitest browser mode exposes\n * neither `import.meta.env`, `process.env`, nor `__VITEST_*` globals to\n * library code, so any \"is this a test?\" probe is unreliable).\n */\nlet threshold = PRIORITY.warn;\n\nexport function setLogLevel(level: LogLevel): void {\n threshold = PRIORITY[level];\n}\n\nexport function getLogLevel(): LogLevel {\n const entry = Object.entries(PRIORITY).find(([, v]) => v === threshold);\n return (entry?.[0] ?? \"warn\") as LogLevel;\n}\n\nexport interface Logger {\n debug(...args: unknown[]): void;\n error(...args: unknown[]): void;\n info(...args: unknown[]): void;\n warn(...args: unknown[]): void;\n}\n\nfunction emit(\n level: Exclude<LogLevel, \"none\">,\n prefix: string,\n args: unknown[]\n): void {\n if (PRIORITY[level] < threshold) {\n return;\n }\n const fn = CONSOLE_FN[level];\n globalThis.console[fn](prefix, ...args);\n}\n\nexport function createLogger(scope: string): Logger {\n const prefix = `[Interfere:${scope}]`;\n return {\n debug: (...args) => emit(\"debug\", prefix, args),\n info: (...args) => emit(\"info\", prefix, args),\n warn: (...args) => emit(\"warn\", prefix, args),\n error: (...args) => emit(\"error\", prefix, args),\n };\n}\n"],"mappings":"AAEA,MAAM,SAAqC,CACzC,MAAO,EACP,KAAM,EACN,KAAM,EACN,MAAO,EACP,KAAM,CACR,EAEM,WAGF,CACF,MAAO,QACP,KAAM,OACN,KAAM,OACN,MAAO,OACT,EASA,IAAI,UAAY,SAAS,KAEzB,SAAgB,YAAY,MAAuB,CACjD,UAAY,SAAS,MACvB,CAEA,SAAgB,aAAwB,CAEtC,OADc,OAAO,QAAQ,QAAQ,EAAE,MAAM,EAAG,KAAO,IAAM,SACjD,IAAI,IAAM,MACxB,CASA,SAAS,KACP,MACA,OACA,KACM,CACN,GAAI,SAAS,OAAS,UACpB,OAEF,IAAM,GAAK,WAAW,OACtB,WAAW,QAAQ,IAAI,OAAQ,GAAG,IAAI,CACxC,CAEA,SAAgB,aAAa,MAAuB,CAClD,IAAM,OAAS,cAAc,MAAM,GACnC,MAAO,CACL,OAAQ,GAAG,OAAS,KAAK,QAAS,OAAQ,IAAI,EAC9C,MAAO,GAAG,OAAS,KAAK,OAAQ,OAAQ,IAAI,EAC5C,MAAO,GAAG,OAAS,KAAK,OAAQ,OAAQ,IAAI,EAC5C,OAAQ,GAAG,OAAS,KAAK,QAAS,OAAQ,IAAI,CAChD,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.d.mts","names":[],"sources":["../../src/util/stringify.ts"],"mappings":";;AAKA;;;;iBAAgB,aAAA,CAAc,
|
|
1
|
+
{"version":3,"file":"stringify.d.mts","names":[],"sources":["../../src/util/stringify.ts"],"mappings":";;AAKA;;;;iBAAgB,aAAA,CAAc,KAAc"}
|
package/dist/util/stringify.mjs
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* `JSON.stringify` with a `String(value)` fallback for circular refs and
|
|
4
|
-
* non-serialisable values (BigInt, …). Strings pass through unchanged so
|
|
5
|
-
* single-arg log calls don't get re-quoted.
|
|
6
|
-
*/
|
|
7
|
-
function safeStringify(value) {
|
|
8
|
-
if (typeof value === "string") return value;
|
|
9
|
-
try {
|
|
10
|
-
return JSON.stringify(value) ?? String(value);
|
|
11
|
-
} catch {
|
|
12
|
-
return String(value);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { safeStringify };
|
|
1
|
+
function safeStringify(value){if(typeof value==`string`)return value;try{return JSON.stringify(value)??String(value)}catch{return String(value)}}export{safeStringify};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.mjs","names":[],"sources":["../../src/util/stringify.ts"],"sourcesContent":["/**\n * `JSON.stringify` with a `String(value)` fallback for circular refs and\n * non-serialisable values (BigInt, …). Strings pass through unchanged so\n * single-arg log calls don't get re-quoted.\n */\nexport function safeStringify(value: unknown): string {\n if (typeof value === \"string\") {\n return value;\n }\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return String(value);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"stringify.mjs","names":[],"sources":["../../src/util/stringify.ts"],"sourcesContent":["/**\n * `JSON.stringify` with a `String(value)` fallback for circular refs and\n * non-serialisable values (BigInt, …). Strings pass through unchanged so\n * single-arg log calls don't get re-quoted.\n */\nexport function safeStringify(value: unknown): string {\n if (typeof value === \"string\") {\n return value;\n }\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return String(value);\n }\n}\n"],"mappings":"AAKA,SAAgB,cAAc,MAAwB,CACpD,GAAI,OAAO,OAAU,SACnB,OAAO,MAET,GAAI,CACF,OAAO,KAAK,UAAU,KAAK,GAAK,OAAO,KAAK,CAC9C,MAAQ,CACN,OAAO,OAAO,KAAK,CACrB,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interfere/react",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.1-canary.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Client-side React SDK for Interfere. Error tracking, session replay, and analytics.",
|
|
6
6
|
"keywords": [
|
|
@@ -26,42 +26,42 @@
|
|
|
26
26
|
"type": "module",
|
|
27
27
|
"exports": {
|
|
28
28
|
"./provider": {
|
|
29
|
-
"
|
|
29
|
+
"monorepo": "./src/provider.tsx",
|
|
30
30
|
"types": "./dist/provider.d.mts",
|
|
31
31
|
"default": "./dist/provider.mjs"
|
|
32
32
|
},
|
|
33
33
|
"./error-boundary": {
|
|
34
|
-
"
|
|
34
|
+
"monorepo": "./src/error-boundary.tsx",
|
|
35
35
|
"types": "./dist/error-boundary.d.mts",
|
|
36
36
|
"default": "./dist/error-boundary.mjs"
|
|
37
37
|
},
|
|
38
38
|
"./react-error-handler": {
|
|
39
|
-
"
|
|
39
|
+
"monorepo": "./src/react-error-handler.ts",
|
|
40
40
|
"types": "./dist/react-error-handler.d.mts",
|
|
41
41
|
"default": "./dist/react-error-handler.mjs"
|
|
42
42
|
},
|
|
43
43
|
"./api": {
|
|
44
|
-
"
|
|
44
|
+
"monorepo": "./src/api.ts",
|
|
45
45
|
"types": "./dist/api.d.mts",
|
|
46
46
|
"default": "./dist/api.mjs"
|
|
47
47
|
},
|
|
48
48
|
"./internal/kernel": {
|
|
49
|
-
"
|
|
49
|
+
"monorepo": "./src/internal/kernel.ts",
|
|
50
50
|
"types": "./dist/internal/kernel.d.mts",
|
|
51
51
|
"default": "./dist/internal/kernel.mjs"
|
|
52
52
|
},
|
|
53
53
|
"./internal/kernel-registry": {
|
|
54
|
-
"
|
|
54
|
+
"monorepo": "./src/internal/kernel-registry.ts",
|
|
55
55
|
"types": "./dist/internal/kernel-registry.d.mts",
|
|
56
56
|
"default": "./dist/internal/kernel-registry.mjs"
|
|
57
57
|
},
|
|
58
58
|
"./internal/version": {
|
|
59
|
-
"
|
|
59
|
+
"monorepo": "./src/internal/version.ts",
|
|
60
60
|
"types": "./dist/internal/version.d.mts",
|
|
61
61
|
"default": "./dist/internal/version.mjs"
|
|
62
62
|
},
|
|
63
63
|
"./internal/wrapper-singleton": {
|
|
64
|
-
"
|
|
64
|
+
"monorepo": "./src/internal/wrapper-singleton.ts",
|
|
65
65
|
"types": "./dist/internal/wrapper-singleton.d.mts",
|
|
66
66
|
"default": "./dist/internal/wrapper-singleton.mjs"
|
|
67
67
|
},
|
|
@@ -70,15 +70,14 @@
|
|
|
70
70
|
"default": "./dist/sw.mjs"
|
|
71
71
|
},
|
|
72
72
|
"./util/log": {
|
|
73
|
-
"
|
|
73
|
+
"monorepo": "./src/util/log.ts",
|
|
74
74
|
"types": "./dist/util/log.d.mts",
|
|
75
75
|
"default": "./dist/util/log.mjs"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"sideEffects": false,
|
|
79
79
|
"publishConfig": {
|
|
80
|
-
"access": "public"
|
|
81
|
-
"tag": "canary"
|
|
80
|
+
"access": "public"
|
|
82
81
|
},
|
|
83
82
|
"scripts": {
|
|
84
83
|
"build": "tsdown",
|
|
@@ -88,30 +87,30 @@
|
|
|
88
87
|
},
|
|
89
88
|
"dependencies": {
|
|
90
89
|
"@fingerprintjs/fingerprintjs": "^5.2.0",
|
|
91
|
-
"@interfere/constants": "^9.0.
|
|
92
|
-
"@interfere/types": "^9.0.0",
|
|
90
|
+
"@interfere/constants": "^9.0.2-canary.0",
|
|
91
|
+
"@interfere/types": "^9.0.3-canary.0",
|
|
93
92
|
"@opentelemetry/api": "^1.9.1",
|
|
94
|
-
"@opentelemetry/api-logs": "^0.
|
|
93
|
+
"@opentelemetry/api-logs": "^0.218.0",
|
|
95
94
|
"@opentelemetry/context-zone": "^2.7.1",
|
|
96
95
|
"@opentelemetry/core": "^2.7.0",
|
|
97
|
-
"@opentelemetry/exporter-logs-otlp-http": "^0.
|
|
98
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.
|
|
99
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.
|
|
100
|
-
"@opentelemetry/instrumentation": "^0.
|
|
101
|
-
"@opentelemetry/instrumentation-browser-navigation": "^0.
|
|
102
|
-
"@opentelemetry/instrumentation-document-load": "^0.
|
|
103
|
-
"@opentelemetry/instrumentation-fetch": "^0.
|
|
104
|
-
"@opentelemetry/instrumentation-long-task": "^0.
|
|
105
|
-
"@opentelemetry/instrumentation-user-interaction": "^0.
|
|
106
|
-
"@opentelemetry/instrumentation-xml-http-request": "^0.
|
|
107
|
-
"@opentelemetry/opentelemetry-browser-detector": "^0.
|
|
108
|
-
"@opentelemetry/otlp-transformer": "^0.
|
|
96
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.218.0",
|
|
97
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.218.0",
|
|
98
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
|
|
99
|
+
"@opentelemetry/instrumentation": "^0.218.0",
|
|
100
|
+
"@opentelemetry/instrumentation-browser-navigation": "^0.11.0",
|
|
101
|
+
"@opentelemetry/instrumentation-document-load": "^0.63.0",
|
|
102
|
+
"@opentelemetry/instrumentation-fetch": "^0.218.0",
|
|
103
|
+
"@opentelemetry/instrumentation-long-task": "^0.62.0",
|
|
104
|
+
"@opentelemetry/instrumentation-user-interaction": "^0.62.0",
|
|
105
|
+
"@opentelemetry/instrumentation-xml-http-request": "^0.218.0",
|
|
106
|
+
"@opentelemetry/opentelemetry-browser-detector": "^0.218.0",
|
|
107
|
+
"@opentelemetry/otlp-transformer": "^0.218.0",
|
|
109
108
|
"@opentelemetry/resources": "^2.7.0",
|
|
110
|
-
"@opentelemetry/sdk-logs": "^0.
|
|
109
|
+
"@opentelemetry/sdk-logs": "^0.218.0",
|
|
111
110
|
"@opentelemetry/sdk-metrics": "^2.7.0",
|
|
112
111
|
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
113
112
|
"@opentelemetry/sdk-trace-web": "^2.7.1",
|
|
114
|
-
"@opentelemetry/web-common": "^0.
|
|
113
|
+
"@opentelemetry/web-common": "^0.218.0",
|
|
115
114
|
"@ua-parser-js/pro-enterprise": "^2.0.6",
|
|
116
115
|
"rrweb": "2.0.0-alpha.4",
|
|
117
116
|
"uuid": "^14.0.0",
|
|
@@ -137,13 +136,15 @@
|
|
|
137
136
|
"@interfere/typescript-config": "^9.0.0",
|
|
138
137
|
"@rrweb/types": "2.0.0-alpha.20",
|
|
139
138
|
"@types/node": "^24.12.0",
|
|
140
|
-
"@types/react": "19.2.
|
|
139
|
+
"@types/react": "19.2.15",
|
|
141
140
|
"@types/react-dom": "19.2.3",
|
|
142
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
143
|
-
"@vitest/browser": "4.1.
|
|
144
|
-
"@vitest/browser-playwright": "4.1.
|
|
141
|
+
"@typescript/native-preview": "7.0.0-dev.20260522.1",
|
|
142
|
+
"@vitest/browser": "4.1.7",
|
|
143
|
+
"@vitest/browser-playwright": "4.1.7",
|
|
145
144
|
"@vitest/coverage-v8": "^4.1.6",
|
|
146
145
|
"playwright": "^1.60.0",
|
|
146
|
+
"react": "^19.2.6",
|
|
147
|
+
"react-dom": "^19.2.6",
|
|
147
148
|
"rolldown": "^1.0.0-rc.17",
|
|
148
149
|
"tsdown": "^0.22.0",
|
|
149
150
|
"vitest": "^4.1.6",
|