@interfere/react 12.0.5 → 12.1.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.
- package/README.md +103 -0
- package/dist/actionable-DOmVf_ib.mjs +1 -0
- package/dist/activity-D18VXGTn.mjs +1 -0
- package/dist/{activity-BfYxFVcK.d.mts → activity-Duhfgvxt.d.mts} +1 -1
- package/dist/{api-DEVCOKkJ.d.mts → api-CMPV9rgU.d.mts} +1 -1
- package/dist/api-DXmjUMZE.mjs +1 -0
- package/dist/api.mjs +1 -1
- package/dist/bot-YLSbnCeg.mjs +1 -0
- package/dist/buffer-BRn_kSm-.mjs +1 -0
- package/dist/capture-BV2RlsYg.mjs +1 -0
- package/dist/capture-boundary-Cz0jO-y5.mjs +1 -0
- package/dist/chunking-Dvs3f50A.d.mts +39 -0
- package/dist/chunking-qZffPbyY.mjs +2 -0
- package/dist/compressor-host-BAz6860r.d.mts +9 -0
- package/dist/compressor-host-CrKngamF.mjs +1 -0
- package/dist/config-Bm8myQlS.mjs +1 -0
- package/dist/config-CBqqY1AV.d.mts +29 -0
- package/dist/config-DapTbKhs.mjs +1 -0
- package/dist/{config-Rm-ct4K1.d.mts → config-Dyc09HCZ.d.mts} +2 -1
- package/dist/consent-COUmLJLD.mjs +1 -0
- package/dist/console-patch-WNKoLE7U.mjs +1 -0
- package/dist/delivery-DehIJWRh.mjs +1 -0
- package/dist/device-6T3DYkLD.mjs +1 -0
- package/dist/device-DRK7hhLi.mjs +1 -0
- package/dist/device-metadata-Ffi__vup.mjs +1 -0
- package/dist/{dist-ByNfzdQp.mjs → dist-Bcb677YG.mjs} +2 -2
- package/dist/environment-CoEXhF1a.mjs +1 -0
- package/dist/environment-_LKcAXKG.d.mts +9 -0
- package/dist/error-boundary.d.mts +1 -1
- package/dist/error-boundary.mjs +1 -1
- package/dist/errors-BDmCWb5z.mjs +1 -0
- package/dist/event-capabilities-Dd0Hoaq2.mjs +1 -0
- package/dist/exporter-DjvOtWYJ.mjs +1 -0
- package/dist/exporter-logs-DS2AXWnV.mjs +1 -0
- package/dist/exporter-metrics-DZYqUo6_.mjs +1 -0
- package/dist/geo-D2wa9bGs.mjs +2 -0
- package/dist/global-DYq1Z4_H.mjs +1 -0
- package/dist/http-span-route-t2gig-KI.mjs +1 -0
- package/dist/hydration-BIp2cKhz.mjs +1 -0
- package/dist/index-DBsXraeJ.d.mts +4 -0
- package/dist/initial-navigation-YeK6UUHX.mjs +1 -0
- package/dist/{instrumentations-Bgm2EazU.d.mts → instrumentations-BuccMAMj.d.mts} +8 -1
- package/dist/instrumentations-CY8NcP_M.mjs +1 -0
- package/dist/internal/{activity.d.mts → activity/activity.d.mts} +1 -1
- package/dist/internal/activity/activity.mjs +1 -0
- package/dist/internal/browser-context.mjs +1 -1
- package/dist/internal/capture-boundary.d.mts +1 -1
- package/dist/internal/capture-boundary.mjs +1 -1
- package/dist/internal/capture.d.mts +1 -1
- package/dist/internal/capture.mjs +1 -1
- package/dist/internal/config.d.mts +2 -28
- package/dist/internal/config.mjs +1 -1
- package/dist/internal/consent.mjs +1 -1
- package/dist/internal/console-patch.mjs +1 -1
- package/dist/internal/device-metadata.d.mts +41 -0
- package/dist/internal/device-metadata.mjs +1 -0
- package/dist/internal/dom/actionable.d.mts +4 -13
- package/dist/internal/dom/actionable.mjs +1 -1
- package/dist/internal/dom/privacy.d.mts +2 -0
- package/dist/internal/dom/privacy.mjs +1 -0
- package/dist/internal/environment.d.mts +2 -0
- package/dist/internal/environment.mjs +1 -0
- package/dist/internal/event-capabilities.d.mts +3 -0
- package/dist/internal/event-capabilities.mjs +1 -0
- package/dist/internal/hydration.mjs +1 -1
- package/dist/internal/kernel-registry.d.mts +1 -1
- package/dist/internal/kernel-registry.mjs +1 -1
- package/dist/internal/kernel.d.mts +5 -3
- package/dist/internal/kernel.mjs +1 -1
- package/dist/internal/otel/exporter-logs.mjs +1 -1
- package/dist/internal/otel/exporter-metrics.mjs +1 -1
- package/dist/internal/otel/exporter.mjs +1 -1
- package/dist/internal/otel/http-span-route.mjs +1 -1
- package/dist/internal/otel/index.d.mts +3 -3
- package/dist/internal/otel/index.mjs +1 -1
- package/dist/internal/otel/initial-navigation.d.mts +1 -0
- package/dist/internal/otel/initial-navigation.mjs +1 -1
- package/dist/internal/otel/instrumentations.d.mts +1 -1
- package/dist/internal/otel/instrumentations.mjs +1 -1
- package/dist/internal/otel/navigation.mjs +1 -1
- package/dist/internal/otel/normalize-path.mjs +1 -1
- package/dist/internal/otel/page-scope-context-manager.mjs +1 -1
- package/dist/internal/otel/propagation.mjs +1 -1
- package/dist/internal/otel/provider.d.mts +1 -1
- package/dist/internal/otel/provider.mjs +1 -1
- package/dist/internal/otel/url-attrs.mjs +1 -1
- package/dist/internal/otel/web-vitals.mjs +1 -1
- package/dist/internal/{page-lifecycle.d.mts → page-lifecycle/page-lifecycle.d.mts} +1 -1
- package/dist/internal/page-lifecycle/page-lifecycle.mjs +1 -0
- package/dist/internal/plugins/plugin-runtime.d.mts +2 -0
- package/dist/internal/plugins/plugin-runtime.mjs +1 -0
- package/dist/internal/react-context.d.mts +1 -1
- package/dist/internal/react-context.mjs +1 -1
- package/dist/internal/server-digest.mjs +1 -1
- package/dist/internal/third-party-hosts.mjs +1 -1
- package/dist/internal/version.mjs +1 -1
- package/dist/internal/wrapper-singleton.d.mts +1 -1
- package/dist/internal/wrapper-singleton.mjs +1 -1
- package/dist/kernel-BD57JxiH.mjs +1 -0
- package/dist/kernel-registry-6f-3VCIy.mjs +1 -0
- package/dist/loader-BGwWwN2n.mjs +1 -0
- package/dist/log-D6Ht--tv.mjs +1 -0
- package/dist/navigation-DwkvuhFR.mjs +1 -0
- package/dist/normalize-path-BChqP8pA.mjs +1 -0
- package/dist/page-events-config-CiJvdAaJ.d.mts +12 -0
- package/dist/{internal/page-lifecycle.mjs → page-lifecycle-BhSFqjlK.mjs} +1 -1
- package/dist/page-scope-context-manager-DhArvVJ_.mjs +1 -0
- package/dist/plugin-runtime-CnFVGbJw.mjs +1 -0
- package/dist/plugins/device.d.mts +1 -1
- package/dist/plugins/device.mjs +1 -1
- package/dist/plugins/errors.d.mts +1 -1
- package/dist/plugins/errors.mjs +1 -1
- package/dist/plugins/lib/loader.d.mts +1 -1
- package/dist/plugins/lib/loader.mjs +1 -1
- package/dist/plugins/lib/types.d.mts +1 -1
- package/dist/plugins/logs.d.mts +1 -1
- package/dist/plugins/logs.mjs +1 -1
- package/dist/plugins/page-events-config.d.mts +2 -0
- package/dist/plugins/page-events-config.mjs +1 -0
- package/dist/plugins/page-events.d.mts +1 -1
- package/dist/plugins/rage-clicks.d.mts +1 -1
- package/dist/plugins/rage-clicks.mjs +1 -1
- package/dist/plugins/replay/buffer.d.mts +1 -1
- package/dist/plugins/replay/buffer.mjs +1 -1
- package/dist/plugins/replay/chunking.d.mts +2 -38
- package/dist/plugins/replay/chunking.mjs +1 -2
- package/dist/plugins/replay/compressor-host.d.mts +2 -8
- package/dist/plugins/replay/compressor-host.mjs +1 -1
- package/dist/plugins/replay/config.d.mts +1 -1
- package/dist/plugins/replay/config.mjs +1 -1
- package/dist/plugins/replay/delivery.d.mts +4 -4
- package/dist/plugins/replay/delivery.mjs +1 -1
- package/dist/plugins/replay/index.d.mts +1 -1
- package/dist/plugins/replay/index.mjs +1 -1
- package/dist/plugins/replay/recorder.d.mts +1 -1
- package/dist/plugins/replay/recorder.mjs +1 -1
- package/dist/plugins/replay/redact-urls.d.mts +6 -0
- package/dist/plugins/replay/redact-urls.mjs +1 -0
- package/dist/plugins/replay/sequence.mjs +1 -1
- package/dist/plugins/replay/upload.d.mts +1 -1
- package/dist/plugins/replay/upload.mjs +1 -1
- package/dist/privacy-CPKosXDP.d.mts +31 -0
- package/dist/privacy-CRuL0X8r.mjs +1 -0
- package/dist/propagation-DVcqCu_E.mjs +1 -0
- package/dist/{provider-DWgb6tn9.d.mts → provider-C68KiG80.d.mts} +55 -39
- package/dist/provider-NuAexTzU.mjs +1 -0
- package/dist/{provider-2LrbA-ld.d.mts → provider-VZtcX6ZS.d.mts} +4 -1
- package/dist/provider.d.mts +4 -3
- package/dist/provider.mjs +1 -1
- package/dist/react-context-c1uTUJfB.mjs +1 -0
- package/dist/react-error-handler.d.mts +1 -1
- package/dist/react-error-handler.mjs +1 -1
- package/dist/recorder-CM6Ae_0S.mjs +1 -0
- package/dist/redact-urls-CwFod9d4.mjs +1 -0
- package/dist/sequence-B4dYChb0.mjs +1 -0
- package/dist/server-digest-CzGdvjW1.mjs +1 -0
- package/dist/session-C30CtCVv.mjs +1 -0
- package/dist/session-retry-DJHvfDaO.mjs +1 -0
- package/dist/stringify-DvuHsAT4.mjs +1 -0
- package/dist/third-party-hosts-BoJNL3xG.mjs +1 -0
- package/dist/tracking/api.d.mts +1 -1
- package/dist/tracking/api.mjs +1 -1
- package/dist/tracking/device.mjs +1 -1
- package/dist/tracking/geo.mjs +1 -2
- package/dist/tracking/registration.fixture.d.mts +119 -109
- package/dist/tracking/registration.fixture.mjs +148 -26
- package/dist/tracking/session-retry.mjs +1 -1
- package/dist/tracking/session.mjs +1 -1
- package/dist/upload-BPaD3YcA.mjs +1 -0
- package/dist/url-attrs-BdcyE2n6.mjs +1 -0
- package/dist/util/bot.d.mts +1 -0
- package/dist/util/bot.mjs +1 -1
- package/dist/util/global.mjs +1 -1
- package/dist/util/log.mjs +1 -1
- package/dist/util/stringify.mjs +1 -1
- package/dist/{version-CsfyuVoF.mjs → version-BuN6IItu.mjs} +1 -1
- package/dist/web-vitals-CxXDUgpl.mjs +1 -0
- package/package.json +6 -6
- package/dist/index-DvFfO2V9.d.mts +0 -4
- package/dist/internal/activity.mjs +0 -1
- package/dist/internal/plugin-runtime.d.mts +0 -2
- package/dist/internal/plugin-runtime.mjs +0 -1
package/dist/provider.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { a as ReplayOption, i as ReplayConfig } from "./config-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { a as ReplayOption, i as ReplayConfig } from "./config-Dyc09HCZ.mjs";
|
|
2
|
+
import { a as InterfereContextValue, i as InterfereContext, n as useInterfere, r as useSession, t as InterfereProvider, x as PluginOverrides } from "./provider-C68KiG80.mjs";
|
|
3
|
+
import { n as PageEventsOption, t as PageEventsConfig } from "./page-events-config-CiJvdAaJ.mjs";
|
|
4
|
+
export { InterfereContext, type InterfereContextValue, InterfereProvider, type PageEventsConfig, type PageEventsOption, type PluginOverrides, type ReplayConfig, type ReplayOption, useInterfere, useSession };
|
package/dist/provider.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{InterfereContext
|
|
1
|
+
"use client";import{n as NULL_CONTEXT_VALUE,t as InterfereContext}from"./react-context-c1uTUJfB.mjs";import{t as CaptureBoundary}from"./capture-boundary-Cz0jO-y5.mjs";import{useContext,useLayoutEffect}from"react";import{c}from"react/compiler-runtime";import{jsx}from"react/jsx-runtime";function InterfereProvider(t0){let $=c(14),{kernel,children,consent,plugins,captureRenderErrors,errorBoundary}=t0,t1,t2;$[0]!==consent||$[1]!==kernel||$[2]!==plugins?(t1=()=>{kernel?.syncProviderConfig({consent,plugins})},t2=[kernel,consent,plugins],$[0]=consent,$[1]=kernel,$[2]=plugins,$[3]=t1,$[4]=t2):(t1=$[3],t2=$[4]),useLayoutEffect(t1,t2);let t3;$[5]===kernel?t3=$[6]:(t3=kernel?{consent:kernel.consent,device:kernel.device,identity:kernel.identity,kernel,session:kernel.session}:NULL_CONTEXT_VALUE,$[5]=kernel,$[6]=t3);let value=t3,t4;$[7]!==captureRenderErrors||$[8]!==children||$[9]!==errorBoundary?(t4=captureRenderErrors??errorBoundary??!0?jsx(CaptureBoundary,{children}):children,$[7]=captureRenderErrors,$[8]=children,$[9]=errorBoundary,$[10]=t4):t4=$[10];let body=t4,t5;return $[11]!==body||$[12]!==value?(t5=jsx(InterfereContext,{value,children:body}),$[11]=body,$[12]=value,$[13]=t5):t5=$[13],t5}function useInterfere(){let ctx=useContext(InterfereContext);if(!ctx)throw Error(`useInterfere must be used within <InterfereProvider>`);return ctx}function useSession(){"use no memo";return useInterfere().session.getId()}export{InterfereContext,InterfereProvider,useInterfere,useSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext}from"react";const NULL_CONTEXT_VALUE={consent:{get:()=>null,set:()=>{}},device:{getDeviceId:()=>null,getFpHash:()=>null},identity:{clear:()=>{},get:()=>null,set:async()=>Promise.resolve()},kernel:null,session:{getId:()=>null,getWindowId:()=>null}},InterfereContext=createContext(null);export{NULL_CONTEXT_VALUE as n,InterfereContext as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{captureReactError}from"./
|
|
1
|
+
"use client";import{t as captureReactError}from"./capture-BV2RlsYg.mjs";import{MECHANISM_TYPE}from"@interfere/types/sdk/errors";function resolveKernel(source){return source?typeof source==`function`?source():source:null}function reactErrorHandler(options={}){let{kernel:kernelSource,...callbacks}=options;return{onCaughtError(error,info){error instanceof Error&&captureReactError(resolveKernel(kernelSource),error,info.componentStack,{type:MECHANISM_TYPE.react.caughtError,handled:!0}),callbacks.onCaughtError?.(error,info)},onRecoverableError(error,info){error instanceof Error&&captureReactError(resolveKernel(kernelSource),error,info.componentStack,{type:MECHANISM_TYPE.react.recoverableError,handled:!0,synthetic:!0}),callbacks.onRecoverableError?.(error,info)},onUncaughtError(error,info){error instanceof Error&&captureReactError(resolveKernel(kernelSource),error,info.componentStack,{type:MECHANISM_TYPE.react.uncaughtError,handled:!1}),callbacks.onUncaughtError?.(error,info)}}}export{reactErrorHandler};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as createLogger}from"./log-D6Ht--tv.mjs";const log=createLogger(`replay`);async function startReplayRecorder({onEvent,onFault,recordOptions,signal}){let record;try{({record}=await import(`./rrweb-CE6GKCEq.mjs`))}catch{return log.error(`rrweb failed to load, replay disabled`),null}if(signal?.aborted)return null;let stopRecording,recorder={start:()=>(stopRecording??=record({emit:onEvent,recordAfter:`DOMContentLoaded`,inlineStylesheet:!0,slimDOMOptions:`all`,checkoutEveryNms:6e4,sampling:{media:800,mousemove:50,scroll:150},...recordOptions,errorHandler:error=>(onFault(error),!0)}),stopRecording!==void 0),stop:()=>{stopRecording?.(),stopRecording=void 0}};return recorder.start()?recorder:(log.error(`rrweb failed to start, replay disabled`),null)}export{startReplayRecorder as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EventType,IncrementalSource,NodeType}from"@rrweb/types";const URL_ATTRIBUTES=[`action`,`cite`,`data`,`formaction`,`href`,`poster`,`src`,`xlink:href`];function redactSrcset(srcset,redactUrl){return srcset.split(`,`).map(candidate=>{let trimmed=candidate.trim(),space=trimmed.search(/\s/u);return space===-1?redactUrl(trimmed):`${redactUrl(trimmed.slice(0,space))}${trimmed.slice(space)}`}).join(`, `)}function redactAttributes(attributes,redactUrl){for(let name of URL_ATTRIBUTES){let value=attributes[name];typeof value==`string`&&(attributes[name]=redactUrl(value))}let{srcset}=attributes;typeof srcset==`string`&&(attributes.srcset=redactSrcset(srcset,redactUrl))}function redactNode(node,redactUrl){if(node.type===NodeType.Element&&redactAttributes(node.attributes,redactUrl),node.type===NodeType.Element||node.type===NodeType.Document)for(let child of node.childNodes)redactNode(child,redactUrl)}function redactReplayEvent(event,redactUrl){if(event.type===EventType.Meta){event.data.href=redactUrl(event.data.href);return}if(event.type===EventType.FullSnapshot){redactNode(event.data.node,redactUrl);return}if(event.type===EventType.IncrementalSnapshot&&event.data.source===IncrementalSource.Mutation){for(let added of event.data.adds)redactNode(added.node,redactUrl);for(let mutation of event.data.attributes)redactAttributes(mutation.attributes,redactUrl)}}export{redactReplayEvent as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function sessionStore(){try{let store=globalThis.sessionStorage,probe=`__interfere_replay_seq_probe__`;return store.setItem(probe,`1`),store.removeItem(probe),store}catch{return null}}function createSegmentSequence(windowId){let key=`interfere:replay_seq:${windowId}`,store=sessionStore(),stored=store?.getItem(key),next=stored?Number(stored):0;return(!Number.isInteger(next)||next<0)&&(next=0),{take(){let persisted=Number(store?.getItem(key));Number.isSafeInteger(persisted)&&persisted>next&&(next=persisted);let seq=next;return next+=1,store?.setItem(key,String(next)),seq}}}export{createSegmentSequence as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function hasServerDigest(value){return typeof value==`object`&&!!value&&`digest`in value&&typeof value.digest==`string`}export{hasServerDigest as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sessionIdSchema}from"@interfere/types/data/session";import{v7}from"uuid";const SESSION_ID_KEY=`interfere:session_id`,LAST_ACTIVITY_KEY=`interfere:last_activity`,SESSION_STARTED_KEY=`interfere:session_started`,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;sessionStartedMs=0;constructor(onRotate){this.local=tryStorage(`localStorage`),this.session=tryStorage(`sessionStorage`),this.onRotate=onRotate??null,this.restore()}getSessionId(){return this.sessionId?this.sessionId:this.rotate()}markActivity(){this.touch()}getSessionStartedAt(){return this.sessionStartedMs}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)}reset(){return this.rotate()}restore(){let stored=this.local?.getItem(SESSION_ID_KEY),startedRaw=this.local?.getItem(SESSION_STARTED_KEY),parsed=sessionIdSchema.safeParse(stored);this.sessionStartedMs=startedRaw?Number(startedRaw):0,parsed.success&&!this.isExpired()?(this.sessionId=parsed.data,this.touch()):this.rotate()}rotate(){return this.sessionId=sessionIdSchema.parse(v7()),this.sessionStartedMs=Date.now(),this.local?.setItem(SESSION_ID_KEY,this.sessionId),this.local?.setItem(SESSION_STARTED_KEY,String(this.sessionStartedMs)),this.touch(),this.onRotate?.(this.sessionId),this.sessionId}touch(){this.lastActivityMs=Date.now(),this.local?.setItem(LAST_ACTIVITY_KEY,String(this.lastActivityMs))}isExpired(){if(this.sessionStartedMs>0&&Date.now()-this.sessionStartedMs>864e5)return!0;let raw=this.local?.getItem(LAST_ACTIVITY_KEY),ts=raw?Number(raw):this.lastActivityMs;return ts===0||Date.now()-ts>9e5}};export{SessionManager as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const RETRY_DELAYS_MS=[5e3,15e3];var SessionRetry=class{timer=null;attempts=0;cancel(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}reset(){this.cancel(),this.attempts=0}schedule(error,retry){let status=error.statusCode,transient=status===void 0||status===408||status===429||status>=500&&status<600,delay=RETRY_DELAYS_MS[this.attempts];transient&&delay!==void 0&&this.timer===null&&(this.attempts+=1,this.timer=setTimeout(()=>{this.timer=null,retry()},delay))}};export{SessionRetry as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function safeStringify(value){if(typeof value==`string`)return value;try{return JSON.stringify(value)??String(value)}catch{return String(value)}}export{safeStringify as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const THIRD_PARTY_IGNORE=[/(?:^|\/\/)clerk\./u,/\.clerk\./u,/\.sentry\./u,/\.intercom\./u,/\.posthog\./u,/\.googletagmanager\.com/u,/\.google-analytics\.com/u,/\.googleapis\.com/u,/\.doubleclick\.net/u,/\.facebook\.com/u,/\.fbcdn\.net/u,/\.analytics\.google\.com/u,/px\.ads\.linkedin\.com/u,/\/__nextjs_/u];export{THIRD_PARTY_IGNORE as t};
|
package/dist/tracking/api.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SessionTrackerOptions, t as SessionTracker } from "../api-
|
|
1
|
+
import { n as SessionTrackerOptions, t as SessionTracker } from "../api-CMPV9rgU.mjs";
|
|
2
2
|
export { SessionTracker, SessionTrackerOptions };
|
package/dist/tracking/api.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as SessionTracker}from"../api-DXmjUMZE.mjs";export{SessionTracker};
|
package/dist/tracking/device.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as whenIdle,t as DeviceManager}from"../device-DRK7hhLi.mjs";export{DeviceManager,whenIdle};
|
package/dist/tracking/geo.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
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;epoch=0;fetcher;constructor(fetcher){this.fetcher=fetcher??globalThis.fetch.bind(globalThis)}async detect(){return this.cached?this.cached:this.failed?null:(this.pending??=this.resolveCountryCode(),this.pending)}async resolveCountryCode(){let{epoch}=this,code=await this.fetchCountryCode();return epoch===this.epoch?(this.cached=code,code||(this.failed=!0),this.pending=null,code):null}getCountry(){return this.cached}clear(){this.epoch+=1,this.cached=null,this.failed=!1,this.pending=null}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
|
+
import{t as GeoDetector}from"../geo-D2wa9bGs.mjs";export{GeoDetector};
|