@interfere/react 12.3.1 → 12.4.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 +6 -0
- package/dist/{activity-D13ZVan9.mjs → activity-oYlZ5aa1.mjs} +1 -1
- package/dist/{api-DSUjs8zG.d.mts → api-BXjfYV5Z.d.mts} +1 -0
- package/dist/api-C8aG7li1.mjs +1 -0
- package/dist/click-span-gate-6dNMhjc7.mjs +1 -0
- package/dist/{delivery-DDe-2SLc.mjs → delivery-D7hULClu.mjs} +1 -1
- package/dist/error-boundary.d.mts +1 -1
- package/dist/{errors-BfUmjgWO.mjs → errors-B8XYW4Q7.mjs} +1 -1
- package/dist/{exception-span-BfP73aqG.mjs → exception-span-B74fhBQb.mjs} +1 -1
- package/dist/export-filter-CnyAaPct.mjs +1 -0
- package/dist/exporter-CCgTznZ0.mjs +1 -0
- package/dist/exporter-logs-BbzSiQJi.mjs +1 -0
- package/dist/index-CPrYhbZR.d.mts +4 -0
- package/dist/ingest-backoff-BdBT-jss.mjs +1 -0
- package/dist/instrumentations-NN81kslu.mjs +1 -0
- package/dist/{instrumentations-D656I08h.d.mts → instrumentations-S-BCpguB.d.mts} +8 -9
- package/dist/internal/activity/activity.mjs +1 -1
- package/dist/internal/capture/capture-boundary.d.mts +1 -1
- package/dist/internal/capture/capture.d.mts +1 -1
- package/dist/internal/capture/exception-span.mjs +1 -1
- package/dist/internal/clock/sent-at.d.mts +5 -0
- package/dist/internal/clock/sent-at.mjs +1 -0
- package/dist/internal/ingest-backoff/ingest-backoff.d.mts +13 -0
- package/dist/internal/ingest-backoff/ingest-backoff.mjs +1 -0
- package/dist/internal/kernel-registry.d.mts +1 -1
- package/dist/internal/kernel.d.mts +2 -2
- package/dist/internal/kernel.mjs +1 -1
- package/dist/internal/otel/export-filter.d.mts +12 -0
- package/dist/internal/otel/export-filter.mjs +1 -0
- package/dist/internal/otel/exporter-logs.mjs +1 -1
- package/dist/internal/otel/exporter.mjs +1 -1
- package/dist/internal/otel/index.d.mts +3 -3
- package/dist/internal/otel/index.mjs +1 -1
- package/dist/internal/otel/instrumentations/click-span-gate.d.mts +8 -0
- package/dist/internal/otel/instrumentations/click-span-gate.mjs +1 -0
- package/dist/internal/otel/instrumentations/instrumentations.d.mts +2 -2
- package/dist/internal/otel/instrumentations/instrumentations.mjs +1 -1
- package/dist/internal/otel/instrumentations/network-failure.d.mts +2 -0
- package/dist/internal/otel/instrumentations/network-failure.mjs +1 -0
- package/dist/internal/otel/keepalive-chunks.d.mts +6 -0
- package/dist/internal/otel/keepalive-chunks.mjs +1 -0
- package/dist/internal/otel/page-scope-context-manager.d.mts +1 -1
- package/dist/internal/otel/page-scope-context-manager.mjs +1 -1
- package/dist/internal/otel/provider.d.mts +1 -1
- package/dist/internal/otel/provider.mjs +1 -1
- package/dist/internal/page-lifecycle/keepalive-budget.d.mts +2 -2
- package/dist/internal/page-lifecycle/keepalive-budget.mjs +1 -1
- package/dist/internal/page-lifecycle/page-lifecycle.d.mts +2 -0
- package/dist/internal/page-lifecycle/page-lifecycle.mjs +1 -1
- package/dist/internal/plugins/plugin-runtime.d.mts +1 -1
- package/dist/internal/plugins/plugin-runtime.mjs +1 -1
- package/dist/internal/react-context.d.mts +1 -1
- package/dist/internal/react-dom-keys.d.mts +3 -0
- package/dist/internal/react-dom-keys.mjs +1 -0
- package/dist/internal/sw-queue-protocol.d.mts +2 -0
- package/dist/internal/sw-queue-protocol.mjs +1 -0
- package/dist/internal/sw-queue.mjs +1 -1
- package/dist/internal/third-party-hosts.d.mts +5 -5
- 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/keepalive-budget-BfoHXD04.mjs +1 -0
- package/dist/keepalive-chunks-BZv3PhHT.mjs +1 -0
- package/dist/kernel-zu11DwyQ.mjs +1 -0
- package/dist/{loader-DIaWtHND.mjs → loader-CZ-5Z5A5.mjs} +1 -1
- package/dist/msw-C0yLYJU2.mjs +255 -0
- package/dist/network-failure-DFMPEnXx.d.mts +19 -0
- package/dist/network-failure-GVLV_sUF.mjs +1 -0
- package/dist/{page-lifecycle-DTWqGlz2.mjs → page-lifecycle-rJEJNdKj.mjs} +1 -1
- package/dist/page-scope-context-manager-Bs-m4fv7.mjs +1 -0
- package/dist/{page-scope-context-manager-r92ZMJok.d.mts → page-scope-context-manager-DUhBvuAz.d.mts} +2 -2
- package/dist/{plugin-runtime-B1oFO16q.mjs → plugin-runtime-DgB1_Xc5.mjs} +1 -1
- package/dist/plugins/device.d.mts +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.d.mts +1 -1
- package/dist/plugins/rage-clicks.d.mts +1 -1
- package/dist/plugins/replay/index.d.mts +1 -1
- package/dist/plugins/replay/index.mjs +1 -1
- package/dist/plugins/replay/upload/delivery.d.mts +1 -1
- package/dist/plugins/replay/upload/delivery.mjs +1 -1
- package/dist/plugins/replay/upload/upload.mjs +1 -1
- package/dist/{provider-CrzoxIxC.d.mts → provider-BMMGZWyS.d.mts} +6 -5
- package/dist/provider-DwCQ_vj0.mjs +1 -0
- package/dist/{provider-cUByhzgv.d.mts → provider-Dy0mVCx5.d.mts} +4 -2
- package/dist/provider.d.mts +1 -1
- package/dist/react-dom-keys-BIJuLkQR.mjs +1 -0
- package/dist/react-error-handler.d.mts +1 -1
- package/dist/sent-at-CEM8UV3W.mjs +1 -0
- package/dist/session-retry-Dgkk0yui.mjs +1 -0
- package/dist/sw-queue-protocol-DnTSOWxy.mjs +1 -0
- package/dist/sw-queue-protocol-DqP1EQtQ.d.mts +22 -0
- package/dist/third-party-hosts-CYOuLL_s.mjs +1 -0
- package/dist/tracking/api.d.mts +1 -1
- package/dist/tracking/api.mjs +1 -1
- package/dist/tracking/lifecycle.fixture.d.mts +73 -0
- package/dist/tracking/lifecycle.fixture.mjs +1 -0
- package/dist/tracking/registration.fixture.d.mts +1 -1
- package/dist/tracking/registration.fixture.mjs +1 -255
- package/dist/tracking/session-retry.mjs +1 -1
- package/dist/upload-D55WVf_o.mjs +1 -0
- package/dist/{version-D1R2jz3K.mjs → version-CtEAnX65.mjs} +1 -1
- package/package.json +4 -4
- package/dist/api-D922KFvx.mjs +0 -1
- package/dist/exporter-CJo_iRgv.mjs +0 -1
- package/dist/exporter-logs-DS2AXWnV.mjs +0 -1
- package/dist/index-BZ_yQUGY.d.mts +0 -4
- package/dist/instrumentations-CdmvdXrJ.mjs +0 -1
- package/dist/keepalive-budget-DeafGnVZ.mjs +0 -1
- package/dist/kernel-OzI-YQDt.mjs +0 -1
- package/dist/page-scope-context-manager-DhArvVJ_.mjs +0 -1
- package/dist/provider-CDJwsZLm.mjs +0 -1
- package/dist/session-retry-C2Uh7eZ6.mjs +0 -1
- package/dist/third-party-hosts-BoJNL3xG.mjs +0 -1
- package/dist/upload-BIh8Q5UQ.mjs +0 -1
package/README.md
CHANGED
|
@@ -194,6 +194,12 @@ Finish attribute mutations synchronously in `onEnd`, before it returns. OpenTele
|
|
|
194
194
|
|
|
195
195
|
The SDK calls each processor's `forceFlush` during flush and `shutdown` during disposal. Use a fresh processor instance for each SDK initialization and do not share it with another provider. `tracing: false` skips tracing setup, including custom processors.
|
|
196
196
|
|
|
197
|
+
## Trace export and context
|
|
198
|
+
|
|
199
|
+
The SDK batches ended spans and sends them every 60 seconds, or sooner when 200 spans are waiting. When the page is hidden or unloaded, it sends everything still queued at once with a keepalive request. Spans still queued when a tab is killed without a hide event, such as a crash, are lost. Logs are sent every 5 seconds.
|
|
200
|
+
|
|
201
|
+
The SDK tracks the active span without zone.js. A click or submit span ends when its synchronous event handler returns. Spans started after an `await` in that handler, including fetch and XHR requests, are children of the page span instead of the click span. If your app loads zone.js itself, as Angular does, the SDK does not use it.
|
|
202
|
+
|
|
197
203
|
## Documentation
|
|
198
204
|
|
|
199
205
|
Visit [interfere.com/docs](https://interfere.com/docs) for the full documentation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as createLogger}from"./log-D6Ht--tv.mjs";import{n as
|
|
1
|
+
import{t as createLogger}from"./log-D6Ht--tv.mjs";import{n as onPageHidden,r as onPageShown}from"./page-lifecycle-rJEJNdKj.mjs";const log=createLogger(`activity`),IDLE_AFTER_MS=3e5,EXPIRE_AFTER_MS=9e5,MAX_AGE_MS=864e5,CHECK_INTERVAL_MS=3e4,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;pausedFor=null;lastPausedExceptionMs=null;lastActivityMs=0;keepaliveUntilMs=0;checkTimer=null;unsubscribeShown=null;unsubscribeHidden=null;pauseHandlers=new Set;resumeHandlers=new Set;pausedExceptionHandlers=new Set;onPause(handler){return subscribe(this.pauseHandlers,handler)}onExceptionWhilePaused(handler){return subscribe(this.pausedExceptionHandlers,handler)}noteException(){if(this.pausedFor===null)return;let now=monotonicNow();this.lastPausedExceptionMs!==null&&now-this.lastPausedExceptionMs<3e5||(this.lastPausedExceptionMs=now,fire(this.pausedExceptionHandlers,this.pausedFor))}onResume(handler){return subscribe(this.resumeHandlers,handler)}start(session){if(this.checkTimer===null&&typeof globalThis.addEventListener==`function`){this.session=session,this.pausedFor=null,this.lastPausedExceptionMs=null,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.unsubscribeHidden=onPageHidden(this.onHidden),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.unsubscribeHidden?.(),this.unsubscribeShown=null,this.unsubscribeHidden=null,this.session=null,this.pausedFor=null,this.lastPausedExceptionMs=null,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}pause(reason){this.pausedFor===null&&(this.pausedFor=reason,this.lastPausedExceptionMs=null,log.debug(`session paused: %s`,reason),fire(this.pauseHandlers,reason))}onHidden=()=>{this.pause(`hidden`)};poll=()=>{this.pausedFor===null&&(this.isOverMaxAge()||this.idleMs()>=3e5)&&this.pause(`idle`)};onInput=()=>{let now=monotonicNow();if(this.isOverMaxAge()||now-this.lastActivityMs>=9e5){this.resume(now,`rotated`);return}if(this.pausedFor!==null){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.pausedFor=null,this.lastPausedExceptionMs=null,this.touch(now),this.session?.markActivity(),fire(this.resumeHandlers,reason)}touch(now){this.lastActivityMs=now,this.keepaliveUntilMs=now+1e3}};export{MAX_AGE_MS as a,IDLE_AFTER_MS as i,CHECK_INTERVAL_MS as n,EXPIRE_AFTER_MS as r,ActivityMonitor as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as createLogger}from"./log-D6Ht--tv.mjs";import{t as ActivityMonitor}from"./activity-oYlZ5aa1.mjs";import{n as fetchIngest}from"./ingest-backoff-BdBT-jss.mjs";import{t as DeviceManager}from"./device-DRK7hhLi.mjs";import{t as GeoDetector}from"./geo-D2wa9bGs.mjs";import{t as SessionManager}from"./session-C30CtCVv.mjs";import{t as SessionRetry}from"./session-retry-Dgkk0yui.mjs";import{omitUndefined}from"@interfere/helpers/omit-undefined";import{InterfereClient,InterfereError}from"@interfere/javascript";const log=createLogger(`tracking`);function syncKey(sessionId,deviceId,fpHash){return`${sessionId}|${deviceId??``}|${fpHash??``}`}var SessionTracker=class{client;device;geo;mgr=null;activity=new ActivityMonitor;currentIdentity=null;identifiedSessionId=null;identifiedDeviceId=null;lastSyncedKey=null;inflightSyncKey=null;syncAttemptMs=0;generation=0;syncRetry=new SessionRetry;syncRetryKey=null;identityStarted=!1;constructor(opts){this.client=new InterfereClient({...opts.target,maxRetries:0,timeoutInSeconds:10,fetch:Object.assign(async(input,init)=>fetchIngest(input,async()=>(opts.fetcher??globalThis.fetch)(input,{...init,credentials:`omit`,keepalive:!0})),opts.fetcher??globalThis.fetch)}),this.device=opts.device??new DeviceManager,this.geo=opts.geo??new GeoDetector}start(){this.mgr=new SessionManager(id=>{this.onRotate(id)}),this.activity.start({markActivity:()=>{this.markActivity()},reset:()=>{this.rotateSession()},startedAt:()=>this.getSessionStartedAt()})}startDeviceIdentity(){this.identityStarted||(this.invalidateSync(),this.identityStarted=!0,this.device.init(),this.geo.detect(),this.backfillIdentity())}discardDeviceIdentity(){this.invalidateSync(),this.identityStarted=!1,this.device.clear(),this.geo.clear()}async backfillIdentity(){let gen=this.generation;if(await Promise.resolve(),gen!==this.generation||!this.identityStarted)return;let initialSessionId=this.mgr?.getSessionId()??null,initialFpHash=this.device.getFpHash();initialSessionId&&await this.syncSession(initialSessionId,this.device.getDeviceId(),initialFpHash),this.currentIdentity&&this.identify(this.currentIdentity);let fpHash=await this.device.whenFingerprintReady(),sessionId=this.mgr?.getSessionId()??null;gen===this.generation&&this.identityStarted&&sessionId&&fpHash!==initialFpHash&&this.syncSession(sessionId,this.device.getDeviceId(),fpHash)}onSessionPause(handler){return this.activity.onPause(handler)}onSessionExceptionWhilePaused(handler){return this.activity.onExceptionWhilePaused(handler)}noteException(){this.activity.noteException()}onSessionResume(handler){return this.activity.onResume(handler)}sessionId(){let id=this.mgr?.getSessionId()??null;return id&&this.ensureSynced(id),id}windowId(){return this.mgr?.getWindowId()??null}markActivity(){this.mgr?.markActivity()}getSessionStartedAt(){return this.mgr?.getSessionStartedAt()??0}getDeviceId(){return this.device.getDeviceId()}getFpHash(){return this.device.getFpHash()}getIdentity(){return this.currentIdentity}async identify(params){if(!this.mgr)return;let sessionId=this.mgr.getSessionId();if(this.identifiedSessionId===sessionId&&this.identifiedDeviceId===this.device.getDeviceId()){log.debug(`skipped, already identified for session %s`,sessionId);return}this.currentIdentity=params,this.identifiedSessionId=sessionId,this.identifiedDeviceId=this.device.getDeviceId();let gen=this.generation,[fpHash,country]=await Promise.all([this.device.whenFingerprintReady(),this.geo.detect()]),deviceId=this.device.getDeviceId();if(gen!==this.generation){this.identifiedSessionId=null;return}log.info(`POST session %s → identify`,sessionId),this.postIdentify(sessionId,omitUndefined({deviceId,fpHash,sessionId,...params,country:country||void 0}))}async postIdentify(sessionId,body){try{await this.client.sessions.identifySession(body)}catch{this.identifiedSessionId=null,log.warn(`identify failed for session %s`,sessionId)}}clearIdentity(){this.currentIdentity=null,this.identifiedSessionId=null,this.identifiedDeviceId=null}reset(){this.invalidateSync(),this.clearIdentity(),this.identityStarted&&this.device.reset(),this.mgr?.reset()}rotateSession(){this.mgr?.reset()}dispose(){this.activity.stop(),this.invalidateSync(),this.clearIdentity(),this.mgr=null}invalidateSync(){this.generation+=1,this.syncRetry.reset(),this.syncRetryKey=null,this.lastSyncedKey=null,this.inflightSyncKey=null,this.syncAttemptMs=0}currentSyncKey(){let sessionId=this.mgr?.sessionId;return sessionId?syncKey(sessionId,this.device.getDeviceId(),this.device.getFpHash()):null}ensureSynced(sessionId){let deviceId=this.device.getDeviceId(),fpHash=this.device.getFpHash(),key=syncKey(sessionId,deviceId,fpHash);this.lastSyncedKey!==key&&this.inflightSyncKey!==key&&(Date.now()-this.syncAttemptMs<5e3||this.syncSession(sessionId,deviceId,fpHash))}async syncSession(sessionId,deviceId,fpHash){let key=syncKey(sessionId,deviceId,fpHash);if(this.lastSyncedKey===key||this.inflightSyncKey===key)return;this.syncRetryKey!==key&&(this.syncRetry.reset(),this.syncRetryKey=key),this.syncRetry.cancel();let{generation}=this;this.inflightSyncKey=key,this.syncAttemptMs=Date.now();try{await this.client.sessions.createSession({sessionId,deviceId,fpHash}),generation===this.generation&&key===this.currentSyncKey()&&(this.lastSyncedKey=key,this.syncRetry.reset())}catch(error){log.warn(`session sync failed`),error instanceof InterfereError&&generation===this.generation&&key===this.currentSyncKey()&&this.syncRetry.schedule(error,()=>{let current=this.mgr?.sessionId;generation===this.generation&¤t&&this.ensureSynced(current)})}finally{generation===this.generation&&this.inflightSyncKey===key&&(this.inflightSyncKey=null)}}async onRotate(sessionId){this.syncAttemptMs=Date.now();let gen=this.generation;try{await Promise.resolve();let fpHash=this.device.getFpHash(),deviceId=this.device.getDeviceId();if(gen!==this.generation)return;log.debug(`POST session %s (device=%s fp=%s)`,sessionId,deviceId??`pending`,fpHash??`none`),this.syncSession(sessionId,deviceId,fpHash)}catch{}}};export{SessionTracker as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const TEXT_ENTRY_INPUT_TYPES=new Set([`date`,`datetime-local`,`email`,`month`,`number`,`password`,`search`,`tel`,`text`,`time`,`url`,`week`]);function isTextEntry(element){return element instanceof HTMLTextAreaElement?!0:element instanceof HTMLInputElement?TEXT_ENTRY_INPUT_TYPES.has(element.type):element instanceof HTMLElement&&element.isContentEditable}function createClickSpanGate(){let previous;return element=>{let at=performance.now(),last=previous;if(previous={element,at},isTextEntry(element))return!1;if(last===void 0)return!0;let elapsed=at-last.at;return last.element===element&&elapsed<1e3?!1:!(last.element instanceof HTMLLabelElement&&last.element.control===element&&elapsed<100)}}export{createClickSpanGate as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as createLogger}from"./log-D6Ht--tv.mjs";import{t as reserveKeepaliveBody}from"./keepalive-budget-
|
|
1
|
+
import{t as createLogger}from"./log-D6Ht--tv.mjs";import{t as reserveKeepaliveBody}from"./keepalive-budget-BfoHXD04.mjs";import{t as gzipForUnload}from"./unload-gzip-WX9FyWPs.mjs";import{t as uploadReplayChunk}from"./upload-D55WVf_o.mjs";import{omitUndefined}from"@interfere/helpers/omit-undefined";const log=createLogger(`replay`),REPLAY_TRACER_NAME=`@interfere/react/replay`,textEncoder=new TextEncoder,FATAL_STATUSES=new Set([401,403,413]);function classifyRejection(status){return status===409?`skipped`:FATAL_STATUSES.has(status)?`fatal`:`retryable`}async function prepareBody(compressor,rawBytes){if(!compressor.gzip)return{body:rawBytes,encoding:null,release:null};try{return{body:await compressor.gzip(rawBytes),encoding:`gzip`,release:null}}catch(error){return log.warn(`gzip failed for chunk; sending uncompressed: %o`,error),{body:rawBytes,encoding:null,release:null}}}function prepareUnloadBody(rawBytes){let rawRelease=reserveKeepaliveBody(rawBytes.byteLength);if(rawRelease)return{body:rawBytes,encoding:null,release:rawRelease};let compressed=gzipForUnload(rawBytes);return compressed?{body:compressed,encoding:`gzip`,release:reserveKeepaliveBody(compressed.byteLength)}:{body:rawBytes,encoding:null,release:null}}function encodeReplayMeta(chunk,payload){return btoa(JSON.stringify({activityCount:payload.activityCount,eventCount:payload.eventCount,firstTs:payload.firstTs,hasFullSnapshot:payload.hasFullSnapshot,lastTs:payload.lastTs,segmentId:chunk.segmentId,windowId:chunk.windowId}))}async function deliverChunk({ctx,chunk,target,compressor,payload,trigger,unload}){let sessionId=ctx.getSessionId();if(!sessionId)return`ok`;let rawBytes=textEncoder.encode(payload.bodyJson),uncompressedBytes=rawBytes.byteLength,prepared=unload?prepareUnloadBody(rawBytes):await prepareBody(compressor,rawBytes),headers={"x-replay-meta":encodeReplayMeta(chunk,payload)};prepared.encoding===`gzip`&&(headers[`content-encoding`]=`gzip`);let keepalive=prepared.release!==null,response;try{let upload=await uploadReplayChunk(target,sessionId,prepared.body,headers,{keepalive});if(!upload.ok)return await upload.body?.cancel(),classifyRejection(upload.status);response=await upload.json()}catch(error){return log.warn(`replay chunk upload failed: %o`,error),`retryable`}finally{prepared.release?.()}let objectKey=typeof response==`object`&&response&&`objectKey`in response&&typeof response.objectKey==`string`?response.objectKey:null;if(trigger===void 0&&!unload)return`ok`;let attributes=omitUndefined({"replay.chunk.size_bytes":uncompressedBytes,"replay.chunk.event_count":payload.eventCount,"replay.chunk.uri":objectKey||void 0,"replay.chunk.compressed_bytes":prepared.encoding===`gzip`?prepared.body.byteLength:void 0,"replay.chunk.first_event_ts":payload.firstTs??void 0,"replay.chunk.last_event_ts":payload.lastTs??void 0,"replay.chunk.trigger":trigger,"replay.chunk.unload":unload||void 0,"replay.chunk.keepalive":unload?keepalive:void 0});return ctx.getTracer(REPLAY_TRACER_NAME).startSpan(`replay.chunk`,{attributes}).end(),`ok`}export{deliverChunk as n,REPLAY_TRACER_NAME as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InterfereContextValue, i as InterfereContext } from "./provider-
|
|
1
|
+
import { a as InterfereContextValue, i as InterfereContext } from "./provider-BMMGZWyS.mjs";
|
|
2
2
|
import { Component, ContextType, ErrorInfo, ReactNode } from "react";
|
|
3
3
|
//#region src/error-boundary.d.ts
|
|
4
4
|
export interface ErrorBoundaryProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as hasServerDigest}from"./server-digest-CzGdvjW1.mjs";import{t as hasEventListenerPair}from"./event-capabilities-Dd0Hoaq2.mjs";import{n as onConsoleCall}from"./console-patch-WNKoLE7U.mjs";import{t as THIRD_PARTY_IGNORE}from"./third-party-hosts-
|
|
1
|
+
import{t as hasServerDigest}from"./server-digest-CzGdvjW1.mjs";import{t as hasEventListenerPair}from"./event-capabilities-Dd0Hoaq2.mjs";import{n as onConsoleCall}from"./console-patch-WNKoLE7U.mjs";import{t as THIRD_PARTY_IGNORE}from"./third-party-hosts-CYOuLL_s.mjs";import{MECHANISM_TYPE,isNonErrorException,toException}from"@interfere/types/sdk/errors";import{omitUndefined}from"@interfere/helpers/omit-undefined";function capture(ctx,opts){ctx.recordException(opts.error,omitUndefined({mechanism:opts.mechanism,fallbackFrames:opts.fallbackFrame&&!isNonErrorException(opts.error)?[opts.fallbackFrame]:void 0}))}function findErrorArg(args){return args.find(arg=>arg instanceof Error)??null}function resourceError(target){return target instanceof HTMLImageElement||target instanceof HTMLScriptElement?target.src?{tag:target.localName,url:target.src}:null:target instanceof HTMLLinkElement&&target.href?{tag:target.localName,url:target.href}:null}function isIgnoredResourceUrl(url){return THIRD_PARTY_IGNORE.some(pattern=>pattern.test(url))}function createResourceGate(){let seen=new Set,windowStart=0,windowCount=0;return(url=>{if(seen.has(url))return!1;let now=Date.now();return now-windowStart>6e4&&(windowStart=now,windowCount=0),windowCount>=20?!1:(seen.size>=100&&seen.clear(),seen.add(url),windowCount+=1,!0)})}function createRepeatGate(){let counts=new Map,windowStart=0;return(key=>{let now=Date.now();now-windowStart>6e4&&(windowStart=now,counts.clear());let count=counts.get(key)??0;return count>=5?!1:(counts.size>=100&&counts.clear(),counts.set(key,count+1),!0)})}const errorsPlugin={name:`errors`,setup(ctx){let originalOnError=globalThis.onerror,originalStackTraceLimit=Error.stackTraceLimit;Error.stackTraceLimit<50&&(Error.stackTraceLimit=50);let repeatGate=createRepeatGate();globalThis.onerror=(msg,source,line,col,error)=>{if(error instanceof Error&&!hasServerDigest(error)&&repeatGate(`${typeof msg==`string`?msg:msg.type}|${String(source)}|${String(line)}|${String(col)}`)){let fallbackFrame=typeof source==`string`?omitUndefined({file:source,id:`fallback-0`,line:typeof line==`number`?line:void 0,column:typeof col==`number`?col:void 0}):null;capture(ctx,omitUndefined({error,mechanism:{handled:!1,type:MECHANISM_TYPE.browser.onerror},fallbackFrame:fallbackFrame??void 0}))}return typeof originalOnError==`function`&&originalOnError.call(globalThis,msg,source,line,col,error)};let onUnhandledRejection=event=>{hasServerDigest(event.reason)||capture(ctx,{error:toException(event.reason),mechanism:omitUndefined({handled:!1,type:MECHANISM_TYPE.browser.onunhandledrejection,synthetic:event.reason instanceof Error?void 0:!0})})},cspReportsByDisposition={enforce:new Set,report:new Set},onSecurityPolicyViolation=event=>{let seenCspReports=cspReportsByDisposition[event.disposition],key=`${event.violatedDirective}|${event.blockedURI}`;seenCspReports.has(key)||seenCspReports.size>=5||(seenCspReports.add(key),capture(ctx,{error:{kind:`non-error`,serialized:{blockedURI:event.blockedURI,columnNumber:event.columnNumber,disposition:event.disposition,lineNumber:event.lineNumber,sourceFile:event.sourceFile,violatedDirective:event.violatedDirective},type:`SecurityPolicyViolation`,value:event.disposition===`report`?`CSP ${event.violatedDirective} reported ${event.blockedURI||`inline`} (report-only)`:`CSP ${event.violatedDirective} blocked ${event.blockedURI||`inline`}`},mechanism:{handled:event.disposition===`report`,type:MECHANISM_TYPE.browser.securityPolicyViolation}}))},resourceGate=createResourceGate(),onResourceError=event=>{let resource=resourceError(event.target);resource&&!isIgnoredResourceUrl(resource.url)&&resourceGate(resource.url)&&capture(ctx,{error:{kind:`non-error`,serialized:{url:resource.url},type:`ResourceLoadError`,value:`Failed to load ${resource.tag}: ${resource.url}`},mechanism:{handled:!1,type:MECHANISM_TYPE.browser.resourceError}})},supportsEventTarget=hasEventListenerPair(globalThis.addEventListener,globalThis.removeEventListener);supportsEventTarget&&(globalThis.addEventListener(`unhandledrejection`,onUnhandledRejection),globalThis.addEventListener(`securitypolicyviolation`,onSecurityPolicyViolation),globalThis.addEventListener(`error`,onResourceError,!0));let unsubscribeConsole=onConsoleCall((level,args)=>{if(level!==`error`)return;let error=findErrorArg(args);error&&error.name!==`AbortError`&&!hasServerDigest(error)&&capture(ctx,{error,mechanism:{handled:!0,type:MECHANISM_TYPE.browser.consoleError}})});return()=>{Error.stackTraceLimit=originalStackTraceLimit,globalThis.onerror=originalOnError,supportsEventTarget&&(globalThis.removeEventListener(`unhandledrejection`,onUnhandledRejection),globalThis.removeEventListener(`securitypolicyviolation`,onSecurityPolicyViolation),globalThis.removeEventListener(`error`,onResourceError,!0)),unsubscribeConsole()}}};export{errorsPlugin as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as
|
|
1
|
+
import{t as getGlobal}from"./global-DYq1Z4_H.mjs";import{t as safeStringify}from"./stringify-DvuHsAT4.mjs";import{isNonErrorException,toExceptions}from"@interfere/types/sdk/errors";import{SpanStatusCode}from"@opentelemetry/api";import{exceptionSpanName}from"@interfere/types/sdk/throw-site";function buildExceptionEventAttrs(value,opts){let attrs={"interfere.exception.handled":opts.mechanism.handled,"interfere.exception.mechanism":opts.mechanism.type};if(opts.errorDigest&&(attrs[`interfere.error.digest`]=opts.errorDigest),opts.subtype&&(attrs[`interfere.exception.subtype`]=opts.subtype),isNonErrorException(value))return attrs[`exception.type`]=value.type,attrs[`exception.message`]=value.value,attrs[`interfere.exception.kind`]=`non-error`,attrs[`interfere.exception.serialized`]=safeStringify(value.serialized),attrs;attrs[`exception.type`]=value.name,attrs[`exception.message`]=value.message,attrs[`interfere.exception.kind`]=`error`,value.stack&&(attrs[`exception.stacktrace`]=value.stack),attrs[`interfere.exception.chain`]=safeStringify(toExceptions(value,opts.mechanism));let debugIds=getGlobal(`_debugIds`);return typeof debugIds==`object`&&debugIds&&Object.keys(debugIds).length>0&&(attrs[`interfere.exception.debug_ids`]=safeStringify(debugIds)),opts.appendFrames&&opts.appendFrames.length>0&&(attrs[`interfere.exception.appended_frames`]=safeStringify(opts.appendFrames)),opts.fallbackFrames&&opts.fallbackFrames.length>0&&(attrs[`interfere.exception.fallback_frames`]=safeStringify(opts.fallbackFrames)),attrs}function recordExceptionOnSpan(span,value,attrs,handled){span.addEvent(`exception`,attrs),handled||span.setStatus({code:SpanStatusCode.ERROR,message:isNonErrorException(value)?value.value:value.message})}function startExceptionSpan(tracer,value){return tracer.startSpan(exceptionSpanName(value),{attributes:{"interfere.capture.kind":`exception`}})}export{recordExceptionOnSpan as n,startExceptionSpan as r,buildExceptionEventAttrs as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hrTimeToMilliseconds}from"@opentelemetry/core";function shouldExportSpan(span){return!(span.instrumentationScope.name===`@opentelemetry/instrumentation-long-task`&&hrTimeToMilliseconds(span.duration)<500)}function carriesException(span){return span.events.some(event=>event.name===`exception`)}function createExportFilterProcessor(next,onExceptionSpan){let flushScheduled=!1,flushSoon=()=>{flushScheduled||(flushScheduled=!0,queueMicrotask(()=>{flushScheduled=!1,next.forceFlush().catch(()=>{})}))};return{onStart:(span,parentContext)=>{next.onStart(span,parentContext)},onEnd:span=>{shouldExportSpan(span)&&(next.onEnd(span),carriesException(span)&&(onExceptionSpan?.(),flushSoon()))},forceFlush:async()=>next.forceFlush(),shutdown:async()=>next.shutdown()}}export{shouldExportSpan as n,createExportFilterProcessor as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as fetchIngest}from"./ingest-backoff-BdBT-jss.mjs";import{n as stampSentAt}from"./sent-at-CEM8UV3W.mjs";import{t as reserveKeepaliveBody}from"./keepalive-budget-BfoHXD04.mjs";import{t as sendInKeepaliveChunks}from"./keepalive-chunks-BZv3PhHT.mjs";import{t as PRODUCER_VERSION}from"./version-CtEAnX65.mjs";import{t as IngestLogExporter}from"./exporter-logs-BbzSiQJi.mjs";import{t as IngestMetricExporter}from"./exporter-metrics-DZYqUo6_.mjs";import{toError}from"@interfere/types/sdk/errors";import{InterfereClient,InterfereError}from"@interfere/javascript";import{TELEMETRY_EXPORT_TIMEOUT_MS,retryTelemetry}from"@interfere/helpers/retry-telemetry";import{ExportResultCode}from"@opentelemetry/core";import{JsonTraceSerializer}from"@opentelemetry/otlp-transformer";import{z}from"zod";const INGEST_IGNORE_RE=/\/drain\/v1\/(?:traces|logs|metrics)(?:\?|$)/u,AUTH_INVALID_HALT_COOLDOWN_MS=3e5,HALT_MESSAGES={release_not_found:`ingest halted: the ingest endpoint does not recognize this build's release`,public_key_rejected:`ingest paused: the ingest endpoint rejected this page's public key`};let haltReason=null,authHaltExpiresAt=0,consecutiveAuthRejections=0;function resetIngestHalt(){haltReason=null,authHaltExpiresAt=0,consecutiveAuthRejections=0}function currentHaltReason(){return haltReason===`public_key_rejected`&&Date.now()>=authHaltExpiresAt&&(haltReason=null,consecutiveAuthRejections=2),haltReason}function isIngestHalted(){return currentHaltReason()!==null}const textEncoder=new TextEncoder;function detectUnacceptableExport(error){if(currentHaltReason()!==null||error.statusCode!==422&&error.statusCode!==401)return;let body=error.body;if(typeof body==`object`&&body&&`code`in body){if(error.statusCode===422&&body.code===`RELEASE_NOT_FOUND`){haltReason=`release_not_found`,console.warn(`[interfere] the ingest endpoint does not recognize this build's release. Telemetry export is disabled for this page load. Check that source-map upload and finalization succeeded and that build and runtime use the same surface key.`);return}if(error.statusCode===401&&body.code===`AUTH_PK_INVALID`){if(consecutiveAuthRejections+=1,consecutiveAuthRejections<3)return;haltReason=`public_key_rejected`,authHaltExpiresAt=Date.now()+AUTH_INVALID_HALT_COOLDOWN_MS,console.warn(`[interfere] the ingest endpoint rejected this page's public key ${consecutiveAuthRejections} times in a row — telemetry export is paused for ${AUTH_INVALID_HALT_COOLDOWN_MS/6e4} minutes, then retried once. Check that INTERFERE_PUBLIC_KEY matches an active surface; a deleted surface's key stays rejected until the page is rebuilt with the new key.`)}}}function makeSender(input,signal){let client=new InterfereClient({...input.clientOptions,maxRetries:0,timeoutInSeconds:TELEMETRY_EXPORT_TIMEOUT_MS/1e3,fetch:Object.assign(async(url,init)=>fetchIngest(url,async()=>{let body=init?.body,bytes=typeof body==`string`?textEncoder.encode(body).byteLength:0,dispatch=async(abortSignal,keepalive)=>globalThis.fetch(url,{...init,headers:stampSentAt(new Headers(init?.headers)),credentials:`omit`,keepalive,signal:abortSignal});return retryTelemetry(async abortSignal=>{let release=reserveKeepaliveBody(bytes,32e3);if(release===null)return dispatch(abortSignal,!1);try{return await dispatch(abortSignal,!0)}catch(error){if(!(error instanceof TypeError)||abortSignal.aborted)throw error}finally{release()}return dispatch(abortSignal,!1)},init?.signal)}),globalThis.fetch)});return((payload,resultCallback)=>{if(!payload||payload.byteLength===0){resultCallback({code:ExportResultCode.SUCCESS});return}let reason=currentHaltReason();if(reason!==null){resultCallback({code:ExportResultCode.FAILED,error:Error(HALT_MESSAGES[reason])});return}(async()=>{try{let body=z.record(z.string(),z.unknown()).parse(JSON.parse(new TextDecoder().decode(payload)));await client.drain.otlpExport({signal,body},{headers:{"x-interfere-producer-version":PRODUCER_VERSION}}),consecutiveAuthRejections=0,resultCallback({code:ExportResultCode.SUCCESS})}catch(error){error instanceof InterfereError&&detectUnacceptableExport(error),resultCallback({code:ExportResultCode.FAILED,error:toError(error)})}})()})}var IngestTraceExporter=class{send;constructor(send){this.send=send}export(spans,resultCallback){if(spans.length===0){resultCallback({code:ExportResultCode.SUCCESS});return}sendInKeepaliveChunks(spans,chunk=>JsonTraceSerializer.serializeRequest(chunk),this.send,resultCallback)}async shutdown(){return Promise.resolve()}async forceFlush(){return Promise.resolve()}};function createTraceExporter(input){return new IngestTraceExporter(makeSender(input,`traces`))}function createMetricExporter(input,gatedResourceAttributes){return new IngestMetricExporter(makeSender(input,`metrics`),gatedResourceAttributes)}function createLogExporter(input){return new IngestLogExporter(makeSender(input,`logs`))}export{isIngestHalted as a,createTraceExporter as i,createLogExporter as n,resetIngestHalt as o,createMetricExporter as r,INGEST_IGNORE_RE as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as sendInKeepaliveChunks}from"./keepalive-chunks-BZv3PhHT.mjs";import{ExportResultCode}from"@opentelemetry/core";import{JsonLogsSerializer}from"@opentelemetry/otlp-transformer";var IngestLogExporter=class{send;constructor(send){this.send=send}export(logs,resultCallback){if(logs.length===0){resultCallback({code:ExportResultCode.SUCCESS});return}sendInKeepaliveChunks(logs,chunk=>JsonLogsSerializer.serializeRequest(chunk),this.send,resultCallback)}async shutdown(){return Promise.resolve()}async forceFlush(){return Promise.resolve()}};export{IngestLogExporter as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as ingestQueueAnswerSchema,t as INGEST_QUEUE_QUERY}from"./sw-queue-protocol-DnTSOWxy.mjs";let consecutiveFailures=0,blockedUntil=0,queueState=null;function resetIngestBackoff(){consecutiveFailures=0,blockedUntil=0,queueState=null}var IngestBackoffError=class extends Error{constructor(){super(`Interfere ingest is backing off after a network failure; request not sent`),this.name=`IngestBackoffError`}};function noteNetworkFailure(){Date.now()<blockedUntil||(consecutiveFailures+=1,blockedUntil=Date.now()+Math.min(5e3*2**(consecutiveFailures-1),6e5))}function absoluteUrl(input){try{return new URL(input instanceof Request?input.url:String(input),globalThis.location.href).href}catch{return null}}function currentController(){try{return`serviceWorker`in navigator?navigator.serviceWorker.controller:null}catch{return null}}async function askIngestQueue(state,url){let{promise,resolve}=Promise.withResolvers(),channel=new MessageChannel;channel.port1.addEventListener(`message`,event=>{let answer=ingestQueueAnswerSchema.safeParse(event.data);state.responsive=!0,resolve(answer.success&&answer.data.accepted),channel.port1.close()}),channel.port1.start();let query={type:INGEST_QUEUE_QUERY,url};try{state.controller.postMessage(query,[channel.port2])}catch{channel.port1.close(),resolve(!1)}return promise}function queryIngestQueue(input,controller){let url=absoluteUrl(input);if(!controller||url===null)return null;queueState?.controller!==controller&&(queueState={answers:new Map,controller,responsive:!1});let state=queueState,answer=state.answers.get(url);return!answer&&state.answers.size<32&&(answer=askIngestQueue(state,url),state.answers.set(url,answer)),answer?{answer,state}:null}async function ingestQueueAccepts(query){if(!query?.state.responsive)return!1;let timer,timeout=new Promise(resolve=>{timer=setTimeout(()=>{resolve(!1)},1e3)});try{return await Promise.race([query.answer,timeout])}finally{clearTimeout(timer)}}async function fetchIngest(url,send,controller=currentController()){let query=queryIngestQueue(url,controller),viaQueue=!1;if(Date.now()<blockedUntil&&(viaQueue=await ingestQueueAccepts(query),!viaQueue))throw new IngestBackoffError;let response;try{response=await send()}catch(error){throw error instanceof TypeError&¬eNetworkFailure(),error}return viaQueue||(consecutiveFailures=0,blockedUntil=0),response}export{fetchIngest as n,resetIngestBackoff as r,IngestBackoffError as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as DEFAULT_PRIVACY_POLICY}from"./privacy-CRuL0X8r.mjs";import{t as THIRD_PARTY_IGNORE}from"./third-party-hosts-CYOuLL_s.mjs";import{n as describeActionable,r as isActionable}from"./actionable-DOmVf_ib.mjs";import{i as stampUrlAttrs,n as ATTR_URL_FULL,r as ATTR_URL_PATH}from"./url-attrs-BdcyE2n6.mjs";import{t as stampHttpSpanRoute}from"./http-span-route-t2gig-KI.mjs";import{t as createClickSpanGate}from"./click-span-gate-6dNMhjc7.mjs";import{n as settleFetchFailure,r as settleXhrFailure,t as createPageExitWatch}from"./network-failure-GVLV_sUF.mjs";import{MECHANISM_TYPE}from"@interfere/types/sdk/errors";import{omitUndefined}from"@interfere/helpers/omit-undefined";import{registerInstrumentations}from"@opentelemetry/instrumentation";import{BrowserNavigationInstrumentation,defaultSanitizeUrl}from"@opentelemetry/instrumentation-browser-navigation";import{DocumentLoadInstrumentation}from"@opentelemetry/instrumentation-document-load";import{FetchInstrumentation}from"@opentelemetry/instrumentation-fetch";import{LongTaskInstrumentation}from"@opentelemetry/instrumentation-long-task";import{UserInteractionInstrumentation}from"@opentelemetry/instrumentation-user-interaction";import{XMLHttpRequestInstrumentation}from"@opentelemetry/instrumentation-xml-http-request";import{getElementXPath}from"@opentelemetry/sdk-trace-web";const DEFAULT_FAILURE_RANGES=[[400,599]];function resolveFailureRanges(opt){if(opt===!1)return null;if(opt===void 0||opt===!0)return DEFAULT_FAILURE_RANGES;let codes=opt.statusCodes;return codes&&codes.length>0?codes:DEFAULT_FAILURE_RANGES}function createFailureGate(){let seen=new Set,windowStart=0,windowCount=0;return(key=>{if(seen.has(key))return!1;let now=Date.now();return now-windowStart>6e4&&(windowStart=now,windowCount=0),windowCount>=20?!1:(seen.size>=100&&seen.clear(),seen.add(key),windowCount+=1,!0)})}function failureKey(method,discriminator,url){let path;try{path=new URL(url).pathname}catch{path=url}return`${method} ${discriminator} ${path}`}function statusMatches(status,ranges){for(let range of ranges)if(typeof range==`number`){if(status===range)return!0}else if(status>=range[0]&&status<=range[1])return!0;return!1}function recordHttpFailure(span,status,method,url,mechanism){span.addEvent(`exception`,{"exception.message":`HTTP ${status} ${method} ${url}`,"exception.type":`HttpResponseError`,"interfere.exception.handled":!1,"interfere.exception.kind":`error`,"interfere.exception.mechanism":mechanism})}function maybeCaptureFetchFailure(span,result,failureRanges,method,url,gate){if(!failureRanges)return;let status=result?.status;typeof status!=`number`||status<=0||!statusMatches(status,failureRanges)||(!gate||gate(failureKey(method,status,url)))&&recordHttpFailure(span,status,method,url,MECHANISM_TYPE.browser.fetchFailedResponse)}function applyFetchSpanAttrs(span,request,result,failureRanges,pageExit,isTrackedUrl,resolveRoute,gate){let url=resolveFetchUrl(span,request,result);if(!url)return;let parsed;try{parsed=new URL(url)}catch{return}span.setAttribute(ATTR_URL_PATH,parsed.pathname);let tracked=isTrackedUrl(url),method=resolveFetchMethod(request);if(tracked){if(stampHttpSpanRoute(span,method,parsed.pathname,resolveRoute),isPrefetchRequest(request))return;result instanceof Response?maybeCaptureFetchFailure(span,result,failureRanges,method,url,gate):failureRanges&&settleFetchFailure(span,request,result,pageExit,method,url,()=>!gate||gate(failureKey(method,`network`,url)))}}function applyXhrSpanAttrs(span,xhr,failureRanges,pageExit,isTrackedUrl,gate,resolveRoute){let url=xhr.responseURL||spanUrlFull(span);if(!(url&&isTrackedUrl(url)))return;let parsed;try{parsed=new URL(url)}catch{return}let method=isReadableSpan(span)?String(span.attributes[`http.request.method`]??span.attributes[`http.method`]??`XHR`):`XHR`;if(span.setAttribute(ATTR_URL_PATH,parsed.pathname),stampHttpSpanRoute(span,method,parsed.pathname,resolveRoute),!failureRanges)return;let{status}=xhr;if(typeof status==`number`){if(status===0){settleXhrFailure(span,pageExit,url,()=>!gate||gate(failureKey(`XHR`,`network`,url)));return}statusMatches(status,failureRanges)&&(!gate||gate(failureKey(`XHR`,status,url)))&&recordHttpFailure(span,status,`XHR`,url,MECHANISM_TYPE.browser.xhrFailedResponse)}}function resolveFetchUrl(span,request,result){return responseUrl(result)??requestUrl(request)??spanUrlFull(span)}function isReadableSpan(span){return`attributes`in span}function spanUrlFull(span){if(!isReadableSpan(span))return null;let url=span.attributes[`url.full`]??span.attributes[`http.url`];return typeof url==`string`?url:null}function responseUrl(result){return result instanceof Response&&result.url?result.url:null}function requestUrl(request){return typeof request==`string`?request:readStringProp(request,`url`)??readStringProp(request,`href`)}function resolveFetchMethod(request){return readStringProp(request,`method`)??`GET`}function readStringProp(value,key){if(!(typeof value==`object`&&value&&key in value))return null;let prop=Reflect.get(value,key);return typeof prop==`string`?prop:null}const testOnlyApplyFetchSpanAttrs=applyFetchSpanAttrs,testOnlyApplyXhrSpanAttrs=applyXhrSpanAttrs,testOnlyResolveFailureRanges=resolveFailureRanges,testOnlyCreateFailureGate=createFailureGate,NEVER_MATCH=/^$/u,ESCAPE_RE=/[.*+?^${}()|[\]\\]/gu;function sameOriginPattern(){if(typeof window>`u`)return NEVER_MATCH;let{protocol,host}=globalThis.location;return RegExp(`^${protocol}//${host.replace(ESCAPE_RE,String.raw`\$&`)}`,`u`)}function stampInteractionAttrs(eventType,element,span,policy){let desc=describeActionable(element,policy);span.setAttribute(`ui.event_type`,eventType),span.setAttribute(`ui.target.tag`,desc.tag),desc.privacy&&(span.setAttribute(`ui.target.privacy`,desc.privacy),span.setAttribute(`target_xpath`,getElementXPath(element,!1))),desc.label&&span.setAttribute(`ui.target.label`,desc.label),desc.id&&span.setAttribute(`ui.target.id`,desc.id),desc.name&&span.setAttribute(`ui.target.name`,desc.name),desc.role&&span.setAttribute(`ui.target.role`,desc.role),desc.ariaLabel&&span.setAttribute(`ui.target.aria_label`,desc.ariaLabel),desc.text&&span.setAttribute(`ui.target.text`,desc.text)}const PREFETCH_HEADER_NAMES=[`next-router-prefetch`,`next-router-segment-prefetch`];function isPrefetchRequest(request){if(typeof request==`string`||request instanceof URL)return!1;let headers;try{headers=typeof Request<`u`&&request instanceof Request?request.headers:new Headers(request.headers)}catch{return!1}return PREFETCH_HEADER_NAMES.some(name=>headers.has(name))||headers.get(`purpose`)===`prefetch`||headers.get(`sec-purpose`)?.includes(`prefetch`)===!0}function escapeRegExp(value){return value.replaceAll(/[.*+?^${}()|[\]\\]/gu,String.raw`\$&`)}function apiHostToMatcher(host){return RegExp(`^https?://${escapeRegExp(host)}(:\\d+)?([/?#]|$)`,`u`)}function registerBundledInstrumentations(input){let{tracerProvider,loggerProvider,ignoreUrls,apiHosts=[],propagateContextUrls=[],privacyPolicy=DEFAULT_PRIVACY_POLICY,isInteractionCaptureEnabled=()=>!0,redactUrl=url=>url}=input,{resolveRoute}=input,origin=sameOriginPattern(),propagateMatchers=[...apiHosts.map(host=>apiHostToMatcher(host)),...propagateContextUrls],fetchIgnore=[...ignoreUrls,...THIRD_PARTY_IGNORE],failureRanges=resolveFailureRanges(input.captureFailedRequests),failureGate=createFailureGate(),pageExit=createPageExitWatch();function isTrackedUrl(url){return origin.test(url)||propagateMatchers.some(re=>re instanceof RegExp?re.test(url):url.includes(re))}let pageEventsEnabled=!1,admitClick=createClickSpanGate(),coreInstrumentations=[new FetchInstrumentation({applyCustomAttributesOnSpan:(span,request,result)=>{applyFetchSpanAttrs(span,request,result,failureRanges,pageExit,isTrackedUrl,resolveRoute,failureGate)},ignoreUrls:fetchIgnore,measureRequestSize:!0,propagateTraceHeaderCorsUrls:[origin,...propagateMatchers],requestHook:(span,request)=>{isPrefetchRequest(request)&&span.setAttribute(`http.request.prefetch`,!0)}}),new XMLHttpRequestInstrumentation({applyCustomAttributesOnSpan:(span,xhr)=>{applyXhrSpanAttrs(span,xhr,failureRanges,pageExit,isTrackedUrl,failureGate,resolveRoute)},ignoreUrls:fetchIgnore,propagateTraceHeaderCorsUrls:[origin,...propagateMatchers]}),new LongTaskInstrumentation({observerCallback:(span,info)=>{stampUrlAttrs(span,resolveRoute);let containerType=info.longtaskEntry.attribution[0]?.containerType;containerType&&span.setAttribute(`longtask.container_type`,containerType)}}),new UserInteractionInstrumentation({eventNames:[`click`,`submit`],shouldPreventSpanCreation:(eventType,element,span)=>!(pageEventsEnabled&&isInteractionCaptureEnabled())||eventType===`click`&&!(isActionable(element)&&admitClick(element))||(stampInteractionAttrs(eventType,element,span,privacyPolicy),stampUrlAttrs(span,resolveRoute),!1)})],pageEventsInstrumentations=[new DocumentLoadInstrumentation({applyCustomAttributesOnSpan:{resourceFetch:(span,entry)=>{let name=entry?.name;if(typeof name!=`string`)return;let url;try{url=new URL(name)}catch{return}let isCrossOrigin=typeof window<`u`&&url.origin!==globalThis.location.origin;span.updateName(isCrossOrigin?`resource: ${url.host}${url.pathname}`:`resource: ${url.pathname}`),span.setAttribute(ATTR_URL_FULL,name),span.setAttribute(ATTR_URL_PATH,url.pathname),span.setAttribute(`server.address`,url.host)}},enabled:!1}),new BrowserNavigationInstrumentation({enabled:!1,sanitizeUrl:url=>redactUrl(defaultSanitizeUrl(url))})],unregisterCore=registerInstrumentations(omitUndefined({tracerProvider,loggerProvider,instrumentations:coreInstrumentations})),unregisterPageEvents=null,setPageEventsEnabled=enabled=>{if(pageEventsEnabled=enabled,enabled){unregisterPageEvents??=registerInstrumentations(omitUndefined({tracerProvider,loggerProvider,instrumentations:pageEventsInstrumentations}));return}unregisterPageEvents?.(),unregisterPageEvents=null};return{dispose:()=>{setPageEventsEnabled(!1),unregisterCore(),pageExit.dispose()},setPageEventsEnabled}}export{testOnlyResolveFailureRanges as a,testOnlyCreateFailureGate as i,testOnlyApplyFetchSpanAttrs as n,testOnlyApplyXhrSpanAttrs as r,registerBundledInstrumentations as t};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { i as PrivacyPolicy } from "./privacy-CPKosXDP.mjs";
|
|
2
|
+
import { n as FetchSpanRequest, r as PageExitWatch, t as FetchError } from "./network-failure-DFMPEnXx.mjs";
|
|
2
3
|
import { Span } from "@opentelemetry/api";
|
|
3
|
-
import { FetchCustomAttributeFunction } from "@opentelemetry/instrumentation-fetch";
|
|
4
4
|
import { WebTracerProvider } from "@opentelemetry/sdk-trace-web";
|
|
5
5
|
import { LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
6
6
|
//#region src/internal/otel/instrumentations/instrumentations.d.ts
|
|
7
|
-
type FetchError = Exclude<Parameters<FetchCustomAttributeFunction>[2], Response>;
|
|
8
|
-
type FetchSpanRequest = Request | RequestInfo | RequestInit | URL;
|
|
9
7
|
/**
|
|
10
8
|
* Inclusive HTTP status range. `[400, 499]` matches every 4xx;
|
|
11
9
|
* a bare number matches that exact code.
|
|
@@ -18,19 +16,20 @@ interface CaptureFailedRequestsOptions {
|
|
|
18
16
|
/**
|
|
19
17
|
* Promote tracked failed fetch/XHR responses to captured exception events.
|
|
20
18
|
* On by default (same-origin 4xx + 5xx, deduped + rate-limited); `false`
|
|
21
|
-
* disables, `{ statusCodes }` tunes the matched ranges.
|
|
19
|
+
* disables, `{ statusCodes }` tunes the matched ranges. Aborted and timed-out
|
|
20
|
+
* requests are not failures: their spans get `interfere.http.cancelled`.
|
|
21
|
+
* Transport failures are dropped when the page is hidden or unloaded
|
|
22
|
+
* within one second, since browsers fail in-flight requests on navigation.
|
|
22
23
|
*/
|
|
23
24
|
type CaptureFailedRequestsOption = boolean | CaptureFailedRequestsOptions;
|
|
24
25
|
declare function resolveFailureRanges(opt: CaptureFailedRequestsOption | undefined): readonly HttpStatusCodeRange[] | null;
|
|
25
26
|
declare function createFailureGate(): (key: string) => boolean;
|
|
26
|
-
declare function
|
|
27
|
-
declare function
|
|
28
|
-
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;
|
|
27
|
+
declare function applyFetchSpanAttrs(span: Span, request: FetchSpanRequest, result: Response | FetchError, failureRanges: readonly HttpStatusCodeRange[] | null, pageExit: PageExitWatch, isTrackedUrl: (url: string) => boolean, resolveRoute: ((pathname: string) => string | undefined) | undefined, gate?: (key: string) => boolean): void;
|
|
28
|
+
declare function applyXhrSpanAttrs(span: Span, xhr: Pick<XMLHttpRequest, "responseURL" | "status">, failureRanges: readonly HttpStatusCodeRange[] | null, pageExit: PageExitWatch, isTrackedUrl: (url: string) => boolean, gate?: (key: string) => boolean, resolveRoute?: (pathname: string) => string | undefined): void;
|
|
29
29
|
declare const testOnlyApplyFetchSpanAttrs: typeof applyFetchSpanAttrs;
|
|
30
30
|
declare const testOnlyApplyXhrSpanAttrs: typeof applyXhrSpanAttrs;
|
|
31
31
|
declare const testOnlyResolveFailureRanges: typeof resolveFailureRanges;
|
|
32
32
|
declare const testOnlyCreateFailureGate: typeof createFailureGate;
|
|
33
|
-
declare const testOnlyClassifyNetworkError: typeof classifyNetworkError;
|
|
34
33
|
interface InstrumentationsInput {
|
|
35
34
|
/**
|
|
36
35
|
* Hostnames the fetch + XHR instrumentations inject `traceparent` onto,
|
|
@@ -88,4 +87,4 @@ declare function registerBundledInstrumentations(input: InstrumentationsInput):
|
|
|
88
87
|
setPageEventsEnabled: (enabled: boolean) => void;
|
|
89
88
|
};
|
|
90
89
|
//#endregion
|
|
91
|
-
export { InstrumentationsInput as a, testOnlyApplyXhrSpanAttrs as c,
|
|
90
|
+
export { InstrumentationsInput as a, testOnlyApplyXhrSpanAttrs as c, HttpStatusCodeRange as i, testOnlyCreateFailureGate as l, CaptureFailedRequestsOption as n, registerBundledInstrumentations as o, CaptureFailedRequestsOptions as r, testOnlyApplyFetchSpanAttrs as s, BundledInstrumentations as t, testOnlyResolveFailureRanges as u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as MAX_AGE_MS,i as IDLE_AFTER_MS,n as CHECK_INTERVAL_MS,r as EXPIRE_AFTER_MS,t as ActivityMonitor}from"../../activity-
|
|
1
|
+
import{a as MAX_AGE_MS,i as IDLE_AFTER_MS,n as CHECK_INTERVAL_MS,r as EXPIRE_AFTER_MS,t as ActivityMonitor}from"../../activity-oYlZ5aa1.mjs";export{ActivityMonitor,CHECK_INTERVAL_MS,EXPIRE_AFTER_MS,IDLE_AFTER_MS,MAX_AGE_MS};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as InterfereContextValue, i as InterfereContext } from "../../provider-
|
|
1
|
+
import { a as InterfereContextValue, i as InterfereContext } from "../../provider-BMMGZWyS.mjs";
|
|
2
2
|
import { Component, ContextType, ReactNode } from "react";
|
|
3
3
|
//#region src/internal/capture/capture-boundary.d.ts
|
|
4
4
|
interface CaptureBoundaryProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as recordExceptionOnSpan,r as startExceptionSpan,t as buildExceptionEventAttrs}from"../../exception-span-
|
|
1
|
+
import{n as recordExceptionOnSpan,r as startExceptionSpan,t as buildExceptionEventAttrs}from"../../exception-span-B74fhBQb.mjs";export{buildExceptionEventAttrs,recordExceptionOnSpan,startExceptionSpan};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region src/internal/clock/sent-at.d.ts
|
|
2
|
+
export declare const SENT_AT_HEADER = "x-interfere-sent-at";
|
|
3
|
+
/** Stamps the device's current epoch milliseconds on an ingest request so the gateway can measure device clock skew; call once per attempt. */
|
|
4
|
+
export declare function stampSentAt(headers: Headers): Headers;
|
|
5
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as stampSentAt,t as SENT_AT_HEADER}from"../../sent-at-CEM8UV3W.mjs";export{SENT_AT_HEADER,stampSentAt};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { n as IngestQueueController } from "../../sw-queue-protocol-DqP1EQtQ.mjs";
|
|
2
|
+
//#region src/internal/ingest-backoff/ingest-backoff.d.ts
|
|
3
|
+
/** Test-only reset of the ingest network backoff. */
|
|
4
|
+
export declare function resetIngestBackoff(): void;
|
|
5
|
+
/** Rejection for an ingest request skipped because an earlier network failure is still backing off. */
|
|
6
|
+
export declare class IngestBackoffError extends Error {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Sends one ingest request to `url` unless an earlier network failure is still backing off. A fetch rejection with a `TypeError` (no HTTP response: blocked, offline or unreachable) pauses every ingest request on the page for 5 s, doubling per consecutive failure up to 10 minutes. Any HTTP response clears the backoff. During a pause, a request still goes out when the page's controlling service worker runs `installIngestQueue` and confirms it queues `url`, because that worker answers a network failure with a queued 202 instead of a page-visible error. `controller` defaults to the page's controlling service worker.
|
|
11
|
+
*/
|
|
12
|
+
export declare function fetchIngest(url: RequestInfo | URL, send: () => Promise<Response>, controller?: IngestQueueController | null): Promise<Response>;
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as fetchIngest,r as resetIngestBackoff,t as IngestBackoffError}from"../../ingest-backoff-BdBT-jss.mjs";export{IngestBackoffError,fetchIngest,resetIngestBackoff};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as Kernel } from "../provider-
|
|
1
|
+
import { s as Kernel } from "../provider-BMMGZWyS.mjs";
|
|
2
2
|
//#region src/internal/kernel-registry.d.ts
|
|
3
3
|
export declare function registerKernel(kernel: Kernel): void;
|
|
4
4
|
export declare function unregisterKernel(kernel: Kernel): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as PrivacyOptions } from "../privacy-CPKosXDP.mjs";
|
|
2
|
-
import { _ as readReleaseSlugFromGlobals, c as KernelConsent, d as KernelInternalOptions, f as KernelOptions, g as createKernel, h as buildSdkStack, l as KernelDevice, m as TracingOptions, p as KernelSession, s as Kernel, u as KernelIdentity } from "../provider-
|
|
3
|
-
import { i as HttpStatusCodeRange, n as CaptureFailedRequestsOption, r as CaptureFailedRequestsOptions } from "../instrumentations-
|
|
2
|
+
import { _ as readReleaseSlugFromGlobals, c as KernelConsent, d as KernelInternalOptions, f as KernelOptions, g as createKernel, h as buildSdkStack, l as KernelDevice, m as TracingOptions, p as KernelSession, s as Kernel, u as KernelIdentity } from "../provider-BMMGZWyS.mjs";
|
|
3
|
+
import { i as HttpStatusCodeRange, n as CaptureFailedRequestsOption, r as CaptureFailedRequestsOptions } from "../instrumentations-S-BCpguB.mjs";
|
|
4
4
|
import { t as RecordExceptionOpts } from "../exception-span-zN1tvBdh.mjs";
|
|
5
5
|
import { t as isEnabledByEnvironment } from "../environment-CtCFKD2N.mjs";
|
|
6
6
|
export { type CaptureFailedRequestsOption, type CaptureFailedRequestsOptions, type HttpStatusCodeRange, Kernel, KernelConsent, KernelDevice, KernelIdentity, KernelInternalOptions, KernelOptions, KernelSession, type PrivacyOptions, type RecordExceptionOpts, TracingOptions, buildSdkStack, createKernel, isEnabledByEnvironment, readReleaseSlugFromGlobals };
|
package/dist/internal/kernel.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as isEnabledByEnvironment}from"../environment-CoEXhF1a.mjs";import{i as readReleaseSlugFromGlobals,n as buildSdkStack,r as createKernel,t as Kernel}from"../kernel-
|
|
1
|
+
import{t as isEnabledByEnvironment}from"../environment-CoEXhF1a.mjs";import{i as readReleaseSlugFromGlobals,n as buildSdkStack,r as createKernel,t as Kernel}from"../kernel-zu11DwyQ.mjs";export{Kernel,buildSdkStack,createKernel,isEnabledByEnvironment,readReleaseSlugFromGlobals};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReadableSpan, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
2
|
+
//#region src/internal/otel/export-filter.d.ts
|
|
3
|
+
/** Whether a finished span is worth exporting. Long tasks under 500 ms are dropped. */
|
|
4
|
+
export declare function shouldExportSpan(span: ReadableSpan): boolean;
|
|
5
|
+
/** Forwards only exportable spans to the wrapped export processor, flushes it as soon as a span carrying an exception is queued, and reports that span to `onExceptionSpan`. */
|
|
6
|
+
export declare function createExportFilterProcessor(next: SpanProcessor, onExceptionSpan?: () => void): {
|
|
7
|
+
onStart: (span: import("@opentelemetry/sdk-trace-base").Span, parentContext: import("@opentelemetry/api").Context) => void;
|
|
8
|
+
onEnd: (span: ReadableSpan) => void;
|
|
9
|
+
forceFlush: () => Promise<void>;
|
|
10
|
+
shutdown: () => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as shouldExportSpan,t as createExportFilterProcessor}from"../../export-filter-CnyAaPct.mjs";export{createExportFilterProcessor,shouldExportSpan};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as IngestLogExporter}from"../../exporter-logs-
|
|
1
|
+
import{t as IngestLogExporter}from"../../exporter-logs-BbzSiQJi.mjs";export{IngestLogExporter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as isIngestHalted,i as createTraceExporter,n as createLogExporter,o as resetIngestHalt,r as createMetricExporter,t as INGEST_IGNORE_RE}from"../../exporter-
|
|
1
|
+
import{a as isIngestHalted,i as createTraceExporter,n as createLogExporter,o as resetIngestHalt,r as createMetricExporter,t as INGEST_IGNORE_RE}from"../../exporter-CCgTznZ0.mjs";export{INGEST_IGNORE_RE,createLogExporter,createMetricExporter,createTraceExporter,isIngestHalted,resetIngestHalt};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as InstrumentationsInput, i as HttpStatusCodeRange, n as CaptureFailedRequestsOption, o as registerBundledInstrumentations, r as CaptureFailedRequestsOptions, t as BundledInstrumentations } from "../../instrumentations-
|
|
1
|
+
import { a as InstrumentationsInput, i as HttpStatusCodeRange, n as CaptureFailedRequestsOption, o as registerBundledInstrumentations, r as CaptureFailedRequestsOptions, t as BundledInstrumentations } from "../../instrumentations-S-BCpguB.mjs";
|
|
2
2
|
import { a as seedPageScope, i as installNavigationScope, n as PAGE_SCOPE_MAX_AGE_MS, r as createPageScopeRotator, t as NavigationScopeInput } from "../../navigation-CkiV6lJY.mjs";
|
|
3
3
|
import { t as readPropagationFromDocument } from "../../propagation-CssinKCy.mjs";
|
|
4
|
-
import { n as OtelProviderInput, r as buildOtelProvider, t as OtelProviderHandle } from "../../provider-
|
|
4
|
+
import { n as OtelProviderInput, r as buildOtelProvider, t as OtelProviderHandle } from "../../provider-Dy0mVCx5.mjs";
|
|
5
5
|
import { n as captureWebVitals } from "../../web-vitals-x8y70B5x.mjs";
|
|
6
|
-
import "../../index-
|
|
6
|
+
import "../../index-CPrYhbZR.mjs";
|
|
7
7
|
export { type BundledInstrumentations, type CaptureFailedRequestsOption, type CaptureFailedRequestsOptions, type HttpStatusCodeRange, type InstrumentationsInput, type NavigationScopeInput, type OtelProviderHandle, type OtelProviderInput, PAGE_SCOPE_MAX_AGE_MS, buildOtelProvider, captureWebVitals, createPageScopeRotator, installNavigationScope, readPropagationFromDocument, registerBundledInstrumentations, seedPageScope };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as registerBundledInstrumentations}from"../../instrumentations-
|
|
1
|
+
import{t as registerBundledInstrumentations}from"../../instrumentations-NN81kslu.mjs";import{i as seedPageScope,n as createPageScopeRotator,r as installNavigationScope,t as PAGE_SCOPE_MAX_AGE_MS}from"../../navigation-DwkvuhFR.mjs";import{t as readPropagationFromDocument}from"../../propagation-DVcqCu_E.mjs";import{t as buildOtelProvider}from"../../provider-DwCQ_vj0.mjs";import{t as captureWebVitals}from"../../web-vitals-CxXDUgpl.mjs";export{PAGE_SCOPE_MAX_AGE_MS,buildOtelProvider,captureWebVitals,createPageScopeRotator,installNavigationScope,readPropagationFromDocument,registerBundledInstrumentations,seedPageScope};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/internal/otel/instrumentations/click-span-gate.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Decides which actionable clicks become spans. Skips focusing a text field,
|
|
4
|
+
* the control click a `<label>` forwards, and repeat clicks on the same
|
|
5
|
+
* element within a second; rage clicks are recorded separately.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createClickSpanGate(): (element: Element) => boolean;
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as createClickSpanGate}from"../../../click-span-gate-6dNMhjc7.mjs";export{createClickSpanGate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as InstrumentationsInput, c as testOnlyApplyXhrSpanAttrs,
|
|
2
|
-
export { BundledInstrumentations, CaptureFailedRequestsOption, CaptureFailedRequestsOptions, HttpStatusCodeRange, InstrumentationsInput, registerBundledInstrumentations, testOnlyApplyFetchSpanAttrs, testOnlyApplyXhrSpanAttrs,
|
|
1
|
+
import { a as InstrumentationsInput, c as testOnlyApplyXhrSpanAttrs, i as HttpStatusCodeRange, l as testOnlyCreateFailureGate, n as CaptureFailedRequestsOption, o as registerBundledInstrumentations, r as CaptureFailedRequestsOptions, s as testOnlyApplyFetchSpanAttrs, t as BundledInstrumentations, u as testOnlyResolveFailureRanges } from "../../../instrumentations-S-BCpguB.mjs";
|
|
2
|
+
export { BundledInstrumentations, CaptureFailedRequestsOption, CaptureFailedRequestsOptions, HttpStatusCodeRange, InstrumentationsInput, registerBundledInstrumentations, testOnlyApplyFetchSpanAttrs, testOnlyApplyXhrSpanAttrs, testOnlyCreateFailureGate, testOnlyResolveFailureRanges };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as testOnlyResolveFailureRanges,i as testOnlyCreateFailureGate,n as testOnlyApplyFetchSpanAttrs,r as testOnlyApplyXhrSpanAttrs,t as registerBundledInstrumentations}from"../../../instrumentations-NN81kslu.mjs";export{registerBundledInstrumentations,testOnlyApplyFetchSpanAttrs,testOnlyApplyXhrSpanAttrs,testOnlyCreateFailureGate,testOnlyResolveFailureRanges};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as settleFetchFailure, i as createPageExitWatch, n as FetchSpanRequest, o as settleXhrFailure, r as PageExitWatch, t as FetchError } from "../../../network-failure-DFMPEnXx.mjs";
|
|
2
|
+
export { FetchError, FetchSpanRequest, PageExitWatch, createPageExitWatch, settleFetchFailure, settleXhrFailure };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as settleFetchFailure,r as settleXhrFailure,t as createPageExitWatch}from"../../../network-failure-GVLV_sUF.mjs";export{createPageExitWatch,settleFetchFailure,settleXhrFailure};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { r as SignalSender } from "../../exporter-logs-DMr5-1Yi.mjs";
|
|
2
|
+
import { ExportResult } from "@opentelemetry/core";
|
|
3
|
+
//#region src/internal/otel/keepalive-chunks.d.ts
|
|
4
|
+
/** Sends `items` as one request, or as keepalive-sized requests while the page is hidden, and reports one result: the first failure, else success. */
|
|
5
|
+
export declare function sendInKeepaliveChunks<T>(items: T[], serialize: (items: T[]) => Uint8Array | undefined, send: SignalSender, resultCallback: (result: ExportResult) => void): void;
|
|
6
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as sendInKeepaliveChunks}from"../../keepalive-chunks-BZv3PhHT.mjs";export{sendInKeepaliveChunks};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as PageScopeRotator, t as PageScopeContextManager } from "../../page-scope-context-manager-
|
|
1
|
+
import { n as PageScopeRotator, t as PageScopeContextManager } from "../../page-scope-context-manager-DUhBvuAz.mjs";
|
|
2
2
|
export { PageScopeContextManager, PageScopeRotator };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as PageScopeContextManager}from"../../page-scope-context-manager-
|
|
1
|
+
import{t as PageScopeContextManager}from"../../page-scope-context-manager-Bs-m4fv7.mjs";export{PageScopeContextManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as OtelProviderInput, r as buildOtelProvider, t as OtelProviderHandle } from "../../provider-
|
|
1
|
+
import { n as OtelProviderInput, r as buildOtelProvider, t as OtelProviderHandle } from "../../provider-Dy0mVCx5.mjs";
|
|
2
2
|
export { OtelProviderHandle, OtelProviderInput, buildOtelProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as buildOtelProvider}from"../../provider-
|
|
1
|
+
import{t as buildOtelProvider}from"../../provider-DwCQ_vj0.mjs";export{buildOtelProvider};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/internal/page-lifecycle/keepalive-budget.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Reserves keepalive budget for one request body. Returns the release callback when the
|
|
3
|
+
* Reserves keepalive budget for one request body. Returns the release callback when the page's in-flight keepalive bodies stay within `limit` (the shared budget by default), or null when the request must go out without keepalive.
|
|
4
4
|
*/
|
|
5
|
-
export declare function reserveKeepaliveBody(bytes: number): (() => void) | null;
|
|
5
|
+
export declare function reserveKeepaliveBody(bytes: number, limit?: number): (() => void) | null;
|
|
6
6
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as reserveKeepaliveBody}from"../../keepalive-budget-
|
|
1
|
+
import{t as reserveKeepaliveBody}from"../../keepalive-budget-BfoHXD04.mjs";export{reserveKeepaliveBody};
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
type Handler = () => void;
|
|
3
3
|
export declare function onPageHidden(handler: Handler): () => void;
|
|
4
4
|
export declare function onPageShown(handler: Handler): () => void;
|
|
5
|
+
/** Whether the page is hidden, as tracked by the same `visibilitychange`, `pagehide` and `pageshow` signals the hidden and shown handlers use. */
|
|
6
|
+
export declare function isPageHidden(): boolean;
|
|
5
7
|
/** Fires on `beforeunload`, before the browser commits the navigation; the page may still survive, so subscribers flush and keep running. */
|
|
6
8
|
export declare function onPageUnloading(handler: Handler): () => void;
|
|
7
9
|
/** Test hook — drops every handler and unbinds the listeners. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as resetPageLifecycleForTests,i as onPageUnloading,n as onPageHidden,r as onPageShown,t as isPageHidden}from"../../page-lifecycle-rJEJNdKj.mjs";export{isPageHidden,onPageHidden,onPageShown,onPageUnloading,resetPageLifecycleForTests};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { v as PluginRuntime } from "../../provider-
|
|
1
|
+
import { v as PluginRuntime } from "../../provider-BMMGZWyS.mjs";
|
|
2
2
|
export { PluginRuntime };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as PluginRuntime}from"../../plugin-runtime-
|
|
1
|
+
import{t as PluginRuntime}from"../../plugin-runtime-DgB1_Xc5.mjs";export{PluginRuntime};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as InterfereContextValue, i as InterfereContext, o as NULL_CONTEXT_VALUE } from "../provider-
|
|
1
|
+
import { a as InterfereContextValue, i as InterfereContext, o as NULL_CONTEXT_VALUE } from "../provider-BMMGZWyS.mjs";
|
|
2
2
|
export { InterfereContext, InterfereContextValue, NULL_CONTEXT_VALUE };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as primeReactDomKeys}from"../react-dom-keys-BIJuLkQR.mjs";export{primeReactDomKeys};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ingestQueueAnswerSchema, i as answerIngestQueueQuery, n as IngestQueueController, o as ingestQueueQuerySchema, r as IngestQueueQuery, t as INGEST_QUEUE_QUERY } from "../sw-queue-protocol-DqP1EQtQ.mjs";
|
|
2
|
+
export { INGEST_QUEUE_QUERY, IngestQueueController, IngestQueueQuery, answerIngestQueueQuery, ingestQueueAnswerSchema, ingestQueueQuerySchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as ingestQueueQuerySchema,n as answerIngestQueueQuery,r as ingestQueueAnswerSchema,t as INGEST_QUEUE_QUERY}from"../sw-queue-protocol-DnTSOWxy.mjs";export{INGEST_QUEUE_QUERY,answerIngestQueueQuery,ingestQueueAnswerSchema,ingestQueueQuerySchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isRetryableStatus}from"@interfere/helpers/retry-request";import{Queue}from"workbox-background-sync";const SYNTHETIC_QUEUED_RESPONSE={status:202,statusText:`Queued`};async function postToClients(message){let clients=await self.clients.matchAll({includeUncontrolled:!1});for(let client of clients)client.postMessage(message)}async function totalQueueBytes(queue){let entries=await queue.getAll(),total=0;for(let entry of entries){let meta=entry.metadata;meta&&`bytes`in meta&&typeof meta.bytes==`number`&&(total+=meta.bytes)}return total}async function pruneOldest(queue,neededBytes){let total=await totalQueueBytes(queue);for(;total+neededBytes>10485760;){let dropped=await queue.shiftRequest();if(!dropped)break;let meta=dropped.metadata;meta&&`bytes`in meta&&typeof meta.bytes==`number`&&(total-=meta.bytes),await postToClients({reason:`queue_size_cap`,type:`interfere.sw.dropped`,url:dropped.request.url})}}async function enqueue(queue,request){let cloned=request.clone(),bytes=(await cloned.clone().arrayBuffer()).byteLength;await pruneOldest(queue,bytes),await queue.pushRequest({metadata:{bytes},request:cloned}),await postToClients({type:`interfere.sw.queued`,url:request.url})}function installIngestQueue(options={}){let matches=options.match??(url=>url.pathname.startsWith(`/api/interfere/`)),replayInFlight,replay=async q=>{replayInFlight??=(async()=>{try{let entry=await q.shiftRequest();for(;entry;){try{let res=await self.fetch(entry.request.clone());if(!res.ok&&isRetryableStatus(res.status))throw Error(`retry status ${res.status}`);await postToClients({type:`interfere.sw.replayed`,url:entry.request.url})}catch(error){throw await q.unshiftRequest(entry),error}entry=await q.shiftRequest()}}finally{replayInFlight=void 0}})(),await replayInFlight},queue=new Queue(options.queueName??`interfere-ingest`,{maxRetentionTime:1440,onSync:async({queue:q})=>{await replay(q)}});self.addEventListener(`activate`,event=>{event.waitUntil(replay(queue).catch(()=>{}))}),self.addEventListener(`fetch`,event=>{let{request}=event;if(request.method!==`POST`)return;let url;try{url=new URL(request.url)}catch{return}matches(url,request)&&event.respondWith((async()=>{try{let res=await self.fetch(request.clone());return res.ok?res:isRetryableStatus(res.status)?(await enqueue(queue,request),new Response(null,SYNTHETIC_QUEUED_RESPONSE)):res}catch{return await enqueue(queue,request),new Response(null,SYNTHETIC_QUEUED_RESPONSE)}})())})}export{installIngestQueue};
|
|
1
|
+
import{i as ingestQueueQuerySchema,n as answerIngestQueueQuery}from"../sw-queue-protocol-DnTSOWxy.mjs";import{isRetryableStatus}from"@interfere/helpers/retry-request";import{Queue}from"workbox-background-sync";const SYNTHETIC_QUEUED_RESPONSE={status:202,statusText:`Queued`};async function postToClients(message){let clients=await self.clients.matchAll({includeUncontrolled:!1});for(let client of clients)client.postMessage(message)}async function totalQueueBytes(queue){let entries=await queue.getAll(),total=0;for(let entry of entries){let meta=entry.metadata;meta&&`bytes`in meta&&typeof meta.bytes==`number`&&(total+=meta.bytes)}return total}async function pruneOldest(queue,neededBytes){let total=await totalQueueBytes(queue);for(;total+neededBytes>10485760;){let dropped=await queue.shiftRequest();if(!dropped)break;let meta=dropped.metadata;meta&&`bytes`in meta&&typeof meta.bytes==`number`&&(total-=meta.bytes),await postToClients({reason:`queue_size_cap`,type:`interfere.sw.dropped`,url:dropped.request.url})}}async function enqueue(queue,request){let cloned=request.clone(),bytes=(await cloned.clone().arrayBuffer()).byteLength;await pruneOldest(queue,bytes),await queue.pushRequest({metadata:{bytes},request:cloned}),await postToClients({type:`interfere.sw.queued`,url:request.url})}function installIngestQueue(options={}){let matches=options.match??(url=>url.pathname.startsWith(`/api/interfere/`)),replayInFlight,replay=async q=>{replayInFlight??=(async()=>{try{let entry=await q.shiftRequest();for(;entry;){try{let res=await self.fetch(entry.request.clone());if(!res.ok&&isRetryableStatus(res.status))throw Error(`retry status ${res.status}`);await postToClients({type:`interfere.sw.replayed`,url:entry.request.url})}catch(error){throw await q.unshiftRequest(entry),error}entry=await q.shiftRequest()}}finally{replayInFlight=void 0}})(),await replayInFlight},queue=new Queue(options.queueName??`interfere-ingest`,{maxRetentionTime:1440,onSync:async({queue:q})=>{await replay(q)}});self.addEventListener(`activate`,event=>{event.waitUntil(replay(queue).catch(()=>{}))}),self.addEventListener(`message`,event=>{let[port]=event.ports,query=ingestQueueQuerySchema.safeParse(event.data);port&&query.success&&answerIngestQueueQuery(query.data,port,matches)}),self.addEventListener(`fetch`,event=>{let{request}=event;if(request.method!==`POST`)return;let url;try{url=new URL(request.url)}catch{return}matches(url,request)&&event.respondWith((async()=>{try{let res=await self.fetch(request.clone());return res.ok?res:isRetryableStatus(res.status)?(await enqueue(queue,request),new Response(null,SYNTHETIC_QUEUED_RESPONSE)):res}catch{return await enqueue(queue,request),new Response(null,SYNTHETIC_QUEUED_RESPONSE)}})())})}export{installIngestQueue};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/internal/third-party-hosts.d.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* Requests and resource loads the SDK never surfaces: analytics, ads,
|
|
4
|
+
* replay, monitoring and auth vendors that otherwise turn into orphan-span
|
|
5
|
+
* and resource-error noise. A vendor host matches itself and any subdomain;
|
|
6
|
+
* the path patterns catch vendors commonly proxied through the customer's
|
|
7
|
+
* own origin. App-specific noise belongs in `tracing.ignoreUrls`.
|
|
8
8
|
*
|
|
9
9
|
* Dependency-free on purpose so the error-only bundle can reuse it without
|
|
10
10
|
* pulling in the OTel SDK that `internal/otel/*` carries.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as THIRD_PARTY_IGNORE}from"../third-party-hosts-
|
|
1
|
+
import{t as THIRD_PARTY_IGNORE}from"../third-party-hosts-CYOuLL_s.mjs";export{THIRD_PARTY_IGNORE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as SDK_NAME,r as SDK_VERSION,t as PRODUCER_VERSION}from"../version-
|
|
1
|
+
import{n as SDK_NAME,r as SDK_VERSION,t as PRODUCER_VERSION}from"../version-CtEAnX65.mjs";export{PRODUCER_VERSION,SDK_NAME,SDK_VERSION};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as KernelOptions, s as Kernel } from "../provider-
|
|
1
|
+
import { f as KernelOptions, s as Kernel } from "../provider-BMMGZWyS.mjs";
|
|
2
2
|
import { ConsentInput, ConsentState } from "@interfere/types/sdk/plugins/manifest";
|
|
3
3
|
import { IdentifyParams } from "@interfere/types/sdk/identify";
|
|
4
4
|
//#region src/internal/wrapper-singleton.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as createLogger}from"../log-D6Ht--tv.mjs";import{n as registerKernel,r as unregisterKernel}from"../kernel-registry-6f-3VCIy.mjs";import{n as isForceEnableActive,t as hasPublicKey}from"../config-VOyDjqS7.mjs";import{t as isEnabledByEnvironment}from"../environment-CoEXhF1a.mjs";import{r as createKernel}from"../kernel-
|
|
1
|
+
import{t as createLogger}from"../log-D6Ht--tv.mjs";import{n as registerKernel,r as unregisterKernel}from"../kernel-registry-6f-3VCIy.mjs";import{n as isForceEnableActive,t as hasPublicKey}from"../config-VOyDjqS7.mjs";import{t as isEnabledByEnvironment}from"../environment-CoEXhF1a.mjs";import{r as createKernel}from"../kernel-zu11DwyQ.mjs";import{t as primeReactDomKeys}from"../react-dom-keys-BIJuLkQR.mjs";import{n as isBotUserAgent}from"../bot-YLSbnCeg.mjs";const log=createLogger(`init`);function createWrapperSingleton(input){let kernel=null,pending=null,queuedConsent=null,queuedIdentity=null,listeners=new Set;function emit(){for(let listener of listeners)listener()}async function initKernel(internalOpts){try{let k=await createKernel({opts:internalOpts});return kernel=k,registerKernel(k),queuedConsent&&=(k.consent.set(queuedConsent.value),null),queuedIdentity&&=(k.identity.set(queuedIdentity),null),emit(),k}finally{pending=null}}return{async close(){if(!kernel)return;let previous=kernel;await previous.dispose(),kernel=null,unregisterKernel(previous),emit()},consent:{get:()=>kernel?.consent.get()??null,set:value=>{kernel?kernel.consent.set(value):queuedConsent={value}}},getKernel(){if(!kernel)throw Error(`Interfere SDK not initialized. Call init() from your ${input.initEntryName} entrypoint.`);return kernel},getKernelOrNull(){return kernel},identity:{clear:()=>{queuedIdentity=null,kernel?.identity.clear()},get:()=>kernel?.identity.get()??queuedIdentity,set:async params=>{if(kernel)return kernel.identity.set(params);queuedIdentity=params}},async init(opts={}){if(kernel)return kernel;if(pending)return pending;if(!(opts.enabled??isEnabledByEnvironment())||!isForceEnableActive()&&isBotUserAgent())return null;if(!hasPublicKey())return log.warn(`No public key is configured, so the SDK is disabled. Set INTERFERE_PUBLIC_KEY (VITE_INTERFERE_PUBLIC_KEY for Vite) on builds that should send telemetry.`),null;let internalOpts={...opts,_wrapperVersions:[input.producerVersion]};return primeReactDomKeys(),pending=initKernel(internalOpts),pending},subscribeToKernel(listener){return listeners.add(listener),(()=>{listeners.delete(listener)})}}}export{createWrapperSingleton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const KEEPALIVE_BODY_BUDGET_BYTES=6e4;let keepaliveBodyBytes=0;function reserveKeepaliveBody(bytes,limit=KEEPALIVE_BODY_BUDGET_BYTES){if(keepaliveBodyBytes+bytes>Math.min(limit,KEEPALIVE_BODY_BUDGET_BYTES))return null;keepaliveBodyBytes+=bytes;let released=!1;return(()=>{released||(released=!0,keepaliveBodyBytes-=bytes)})}export{reserveKeepaliveBody as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as isPageHidden}from"./page-lifecycle-rJEJNdKj.mjs";import{ExportResultCode}from"@opentelemetry/core";function splitForKeepalive(items,serialize){let chunks=[],pending=[items];for(let next=pending.pop();next;next=pending.pop()){if(next.length<=1||(serialize(next)?.byteLength??0)<=16e3){chunks.push(next);continue}let middle=Math.ceil(next.length/2);pending.push(next.slice(middle),next.slice(0,middle))}return chunks}function sendInKeepaliveChunks(items,serialize,send,resultCallback){let chunks=isPageHidden()?splitForKeepalive(items,serialize):[items];if(chunks.length===1){send(serialize(items),resultCallback);return}let pending=chunks.length,failure,settle=result=>{result.code!==ExportResultCode.SUCCESS&&(failure??=result),--pending,pending===0&&resultCallback(failure??{code:ExportResultCode.SUCCESS})};for(let chunk of chunks)send(serialize(chunk),settle)}export{sendInKeepaliveChunks as t};
|