@interfere/react 12.0.1 → 12.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{api-wpS4xoMY.d.mts → api-DEVCOKkJ.d.mts} +4 -0
  2. package/dist/dist-ByNfzdQp.mjs +17 -0
  3. package/dist/error-boundary.d.mts +1 -1
  4. package/dist/{index-D-HGWlgi.d.mts → index-BVwotsYa.d.mts} +1 -1
  5. package/dist/internal/capture-boundary.d.mts +1 -1
  6. package/dist/internal/capture.d.mts +1 -1
  7. package/dist/internal/consent.d.mts +2 -8
  8. package/dist/internal/consent.mjs +1 -1
  9. package/dist/internal/kernel-registry.d.mts +1 -1
  10. package/dist/internal/kernel.d.mts +1 -1
  11. package/dist/internal/kernel.mjs +1 -1
  12. package/dist/internal/otel/exporter.mjs +1 -1
  13. package/dist/internal/otel/index.d.mts +2 -2
  14. package/dist/internal/otel/provider.d.mts +1 -1
  15. package/dist/internal/otel/provider.mjs +1 -1
  16. package/dist/internal/plugin-runtime.d.mts +1 -1
  17. package/dist/internal/plugin-runtime.mjs +1 -1
  18. package/dist/internal/react-context.d.mts +1 -1
  19. package/dist/internal/sw-queue.mjs +1 -1
  20. package/dist/internal/version.mjs +1 -1
  21. package/dist/internal/wrapper-singleton.d.mts +3 -3
  22. package/dist/internal/wrapper-singleton.mjs +1 -1
  23. package/dist/plugins/device.d.mts +1 -1
  24. package/dist/plugins/errors.d.mts +1 -1
  25. package/dist/plugins/lib/loader.d.mts +1 -1
  26. package/dist/plugins/lib/types.d.mts +1 -1
  27. package/dist/plugins/logs.d.mts +1 -1
  28. package/dist/plugins/logs.mjs +1 -1
  29. package/dist/plugins/page-events.d.mts +1 -1
  30. package/dist/plugins/rage-clicks.d.mts +1 -1
  31. package/dist/plugins/replay/delivery.d.mts +1 -1
  32. package/dist/plugins/replay/index.d.mts +1 -1
  33. package/dist/{provider-DRuvRafW.d.mts → provider-B2L5znqI.d.mts} +24 -16
  34. package/dist/{provider-CF0h4Mah.d.mts → provider-Df5aXrYa.d.mts} +4 -2
  35. package/dist/provider.d.mts +1 -1
  36. package/dist/react-error-handler.d.mts +1 -1
  37. package/dist/tracking/api.d.mts +1 -1
  38. package/dist/tracking/api.mjs +1 -1
  39. package/dist/tracking/registration.fixture.d.mts +3112 -0
  40. package/dist/tracking/registration.fixture.mjs +133 -0
  41. package/dist/tracking/session-retry.d.mts +10 -0
  42. package/dist/tracking/session-retry.mjs +1 -0
  43. package/dist/{version-XRSM9Pwm.mjs → version-CmerIGVk.mjs} +1 -1
  44. package/package.json +5 -5
@@ -22,6 +22,8 @@ declare class SessionTracker {
22
22
  private inflightSyncKey;
23
23
  private syncAttemptMs;
24
24
  private generation;
25
+ private readonly syncRetry;
26
+ private syncRetryKey;
25
27
  private identityStarted;
26
28
  constructor(opts: SessionTrackerOptions);
27
29
  start(): void;
@@ -62,6 +64,8 @@ declare class SessionTracker {
62
64
  reset(): void;
63
65
  rotateSession(): void;
64
66
  dispose(): void;
67
+ private invalidateSync;
68
+ private currentSyncKey;
65
69
  private ensureSynced;
66
70
  private syncSession;
67
71
  private onRotate;
@@ -0,0 +1,17 @@
1
+ var chars=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,intToChar$1=new Uint8Array(64),charToInt=new Uint8Array(128);for(let i=0;i<chars.length;i++){let c=chars.charCodeAt(i);intToChar$1[i]=c,charToInt[c]=i}function encodeInteger(builder,num){do{let clamped=num&31;num>>>=5,num>0&&(clamped|=32),builder.write(intToChar$1[clamped])}while(num>0)}function encodeSign(num){return num<0?-num<<1|1:num<<1}var bufLength=16384,td=typeof TextDecoder<`u`?new TextDecoder:typeof Buffer<`u`?{decode(buf){return Buffer.from(buf.buffer,buf.byteOffset,buf.byteLength).toString()}}:{decode(buf){let out=``;for(let i=0;i<buf.length;i++)out+=String.fromCharCode(buf[i]);return out}},StringWriter=class{constructor(){this.pos=0,this.out=``,this.buffer=new Uint8Array(bufLength)}write(v){let{buffer}=this;buffer[this.pos++]=v,this.pos===bufLength&&(this.out+=td.decode(buffer),this.pos=0)}flush(){let{buffer,out,pos}=this;return pos>0?out+td.decode(buffer.subarray(0,pos)):out}};function encodeRangeMappings(decoded){if(decoded.length===0)return``;let writer=new StringWriter;for(let i=0;i<decoded.length;i++){let indices=decoded[i];i>0&&writer.write(59);let index=0;for(let j=0;j<indices.length;j++){let offset=indices[j];encodeInteger(writer,offset-index),index=offset}}return writer.flush()}function encode(decoded){let writer=new StringWriter,sourcesIndex=0,sourceLine=0,sourceColumn=0,namesIndex=0;for(let i=0;i<decoded.length;i++){let line=decoded[i];if(i>0&&writer.write(59),line.length===0)continue;let genColumn=0;for(let j=0;j<line.length;j++){let segment=line[j];j>0&&writer.write(44),encodeInteger(writer,encodeSign(segment[0]-genColumn)),genColumn=segment[0],segment.length!==1&&(encodeInteger(writer,encodeSign(segment[1]-sourcesIndex)),encodeInteger(writer,encodeSign(segment[2]-sourceLine)),encodeInteger(writer,encodeSign(segment[3]-sourceColumn)),sourcesIndex=segment[1],sourceLine=segment[2],sourceColumn=segment[3],segment.length!==4&&(encodeInteger(writer,encodeSign(segment[4]-namesIndex)),namesIndex=segment[4]))}}return writer.flush()}var BitSet=class BitSet{constructor(arg){this.bits=arg instanceof BitSet?arg.bits.slice():[]}add(n){this.bits[n>>5]|=1<<(n&31)}has(n){return!!(this.bits[n>>5]&1<<(n&31))}},Chunk=class Chunk{constructor(start,end,content){this.start=start,this.end=end,this.original=content,this.intro=``,this.outro=``,this.content=content,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(content){this.outro+=content}appendRight(content){this.intro+=content}clone(){let chunk=new Chunk(this.start,this.end,this.original);return chunk.intro=this.intro,chunk.outro=this.outro,chunk.content=this.content,chunk.storeName=this.storeName,chunk.edited=this.edited,chunk}contains(index){return this.start<index&&index<this.end}eachNext(fn){fn(this);let chunk=this.next;for(;chunk;)fn(chunk),chunk=chunk.next}eachPrevious(fn){fn(this);let chunk=this.previous;for(;chunk;)fn(chunk),chunk=chunk.previous}edit(content,storeName,contentOnly){return this.content=content,contentOnly||(this.intro=``,this.outro=``),this.storeName=storeName,this.edited=!0,this}prependLeft(content){this.outro=content+this.outro}prependRight(content){this.intro=content+this.intro}reset(){this.intro=``,this.outro=``,this.edited&&=(this.content=this.original,this.storeName=!1,!1)}split(index){let sliceIndex=index-this.start,originalBefore=this.original.slice(0,sliceIndex),originalAfter=this.original.slice(sliceIndex);this.original=originalBefore;let newChunk=new Chunk(index,this.end,originalAfter);return newChunk.outro=this.outro,this.outro=``,this.end=index,this.edited?(newChunk.edit(``,!1,!0),this.content=``):this.content=originalBefore,newChunk.next=this.next,newChunk.next&&(newChunk.next.previous=newChunk),newChunk.previous=this,this.next=newChunk,newChunk}toString(){return this.intro+this.content+this.outro}trimEnd(rx){if(this.outro=this.outro.replace(rx,``),this.outro.length)return!0;let trimmed=this.content.replace(rx,``);if(trimmed.length)return trimmed!==this.content&&(this.edited?this.edit(trimmed,this.storeName,!0):this.split(this.start+trimmed.length).edit(``,void 0,!0)),!0;if(this.edit(``,void 0,!0),this.intro=this.intro.replace(rx,``),this.intro.length)return!0}trimStart(rx){if(this.intro=this.intro.replace(rx,``),this.intro.length)return!0;let trimmed=this.content.replace(rx,``);if(trimmed.length)return trimmed!==this.content&&(this.edited?this.edit(trimmed,this.storeName,!0):(this.split(this.end-trimmed.length),this.edit(``,void 0,!0))),!0;if(this.edit(``,void 0,!0),this.outro=this.outro.replace(rx,``),this.outro.length)return!0}},MagicStringError=class extends Error{name=`MagicStringError`;constructor(message,options){super(`[MagicString] ${message}`,options)}};function getBtoa(){if(typeof globalThis<`u`&&typeof globalThis.btoa==`function`)return str=>globalThis.btoa(unescape(encodeURIComponent(str)));let buffer=globalThis.Buffer;return buffer?str=>buffer.from(str,`utf-8`).toString(`base64`):()=>{throw new MagicStringError("unsupported environment: `btoa` or `Buffer` is required")}}const btoa=getBtoa();var SourceMap=class{constructor(properties){if(this.version=3,this.file=properties.file,this.sources=properties.sources,this.sourcesContent=properties.sourcesContent,this.names=properties.names,this.mappings=typeof properties.mappings==`string`?properties.mappings:encode(properties.mappings),properties.x_google_ignoreList!==void 0&&(this.x_google_ignoreList=properties.x_google_ignoreList),properties.debugId!==void 0&&(this.debugId=properties.debugId),properties.rangeMappings!==void 0){let shouldOutputRangeMapping=!1;for(let line of properties.rangeMappings)if(line.length!==0){shouldOutputRangeMapping=!0;break}shouldOutputRangeMapping&&(this.rangeMappings=encodeRangeMappings(properties.rangeMappings))}}toString(){return JSON.stringify(this)}toUrl(){return`data:application/json;charset=utf-8;base64,${btoa(this.toString())}`}};function getLocator(source){let lineOffsets=[0];for(let i=source.indexOf(`
2
+ `);i!==-1;i=source.indexOf(`
3
+ `,i+1))lineOffsets.push(i+1);return function(index){let i=0,j=lineOffsets.length;for(;i<j;){let m=i+j>>1;index<lineOffsets[m]?j=m:i=m+1}let line=i-1;return{line,column:index-lineOffsets[line]}}}function getRelativePath(from,to){let fromParts=from.split(/[/\\]/),toParts=to.split(/[/\\]/);for(fromParts.pop();fromParts[0]===toParts[0];)fromParts.shift(),toParts.shift();if(fromParts.length){let i=fromParts.length;for(;i--;)fromParts[i]=`..`}return fromParts.concat(toParts).join(`/`)}function guessIndent(code){let lines=code.split(`
4
+ `),tabbed=lines.filter(line=>/^\t+/.test(line)),spaced=lines.filter(line=>/^ {2,}/.test(line));if(tabbed.length===0&&spaced.length===0)return null;if(tabbed.length>=spaced.length)return` `;let min=spaced.reduce((previous,current)=>{let numSpaces=/^ +/.exec(current)[0].length;return Math.min(numSpaces,previous)},1/0);return` `.repeat(min)}const toString=Object.prototype.toString;function isObject(thing){return toString.call(thing)===`[object Object]`}const intToChar=(()=>{let chars=new Uint8Array(64);for(let i=0;i<64;i++)chars[i]=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.charCodeAt(i);return chars})(),FLUSH_THRESHOLD=16348,scratch=new Uint8Array(16384);function writeVlq(pos,num){num=num<0?-num<<1|1:num<<1;do{let clamped=num&31;num>>>=5,num>0&&(clamped|=32),scratch[pos++]=intToChar[clamped]}while(num>0);return pos}const decoder=new TextDecoder;var MappingsEncoder=class{constructor(){this.out=``,this.pos=0,this.lines=[],this.buffered=0,this.needsComma=!1,this.prevGenColumn=0,this.prevSourceIndex=0,this.prevSourceLine=0,this.prevSourceColumn=0,this.prevNameIndex=0}endLine(segments){this.lines.push(segments),this.buffered+=segments.length+1,this.buffered>=4096&&this.drain(null)}segments(segments){this.drain(segments)}finish(segments){return this.drain(segments),this.flush(),this.out}drain(trailing){let lines=this.lines,lineCount=lines.length;for(let l=0;l<=lineCount;l++){let line=l<lineCount?lines[l]:trailing;if(line===null)break;for(let i=0;i<line.length;i++){this.pos>FLUSH_THRESHOLD&&this.flush();let segment=line[i];this.needsComma&&(scratch[this.pos++]=44),this.needsComma=!0,this.pos=writeVlq(this.pos,segment[0]-this.prevGenColumn),this.prevGenColumn=segment[0],this.pos=writeVlq(this.pos,segment[1]-this.prevSourceIndex),this.prevSourceIndex=segment[1],this.pos=writeVlq(this.pos,segment[2]-this.prevSourceLine),this.prevSourceLine=segment[2],this.pos=writeVlq(this.pos,segment[3]-this.prevSourceColumn),this.prevSourceColumn=segment[3],segment.length===5&&(this.pos=writeVlq(this.pos,segment[4]-this.prevNameIndex),this.prevNameIndex=segment[4])}l<lineCount&&(this.pos>FLUSH_THRESHOLD&&this.flush(),scratch[this.pos++]=59,this.needsComma=!1,this.prevGenColumn=0)}lines.length=0,this.buffered=0,this.flush()}flush(){this.out+=decoder.decode(scratch.subarray(0,this.pos)),this.pos=0}};function isWordCode(code){return code>=97&&code<=122||code>=65&&code<=90||code>=48&&code<=57||code===95}var Mappings=class{constructor(hires,encoder=null){this.hires=hires,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.rawRangeMappings=[],this.rawRangeMappingsIndices=this.rawRangeMappings[this.generatedCodeLine]=[],this.encoder=encoder}nextLine(){this.encoder===null?(this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[]):(this.encoder.endLine(this.rawSegments),this.rawSegments=[],this.generatedCodeLine+=1),this.generatedCodeColumn=0,this.rawRangeMappings[this.generatedCodeLine]=this.rawRangeMappingsIndices=[]}addEdit(sourceIndex,content,loc,nameIndex){if(content.length){let contentLengthMinusOne=content.length-1,contentLineEnd=content.indexOf(`
5
+ `,0),previousContentLineEnd=-1;for(;contentLineEnd>=0&&contentLengthMinusOne>contentLineEnd;){let segment=[this.generatedCodeColumn,sourceIndex,loc.line,loc.column];nameIndex>=0&&segment.push(nameIndex),this.rawSegments.push(segment),this.nextLine(),previousContentLineEnd=contentLineEnd,contentLineEnd=content.indexOf(`
6
+ `,contentLineEnd+1)}let segment=[this.generatedCodeColumn,sourceIndex,loc.line,loc.column];nameIndex>=0&&segment.push(nameIndex),this.rawSegments.push(segment),this.advance(content.slice(previousContentLineEnd+1))}}addUneditedChunk(sourceIndex,chunk,original,loc,sourcemapLocations){let end=chunk.end,i=chunk.start;if(this.hires){let boundary=this.hires===`boundary`,experimentalRange=this.hires===`experimental-range`,encoder=experimentalRange?null:this.encoder,charInHiresBoundary=!1;for(;i<end;){encoder!==null&&this.rawSegments.length>=4096&&(encoder.segments(this.rawSegments),this.rawSegments.length=0),experimentalRange&&i+1>=end&&this.rawSegments.push([this.generatedCodeColumn,sourceIndex,loc.line,loc.column]);let code=original.charCodeAt(i);code===10?(loc.line+=1,loc.column=0,this.nextLine(),charInHiresBoundary=!1):(boundary?isWordCode(code)?charInHiresBoundary||=(this.rawSegments.push([this.generatedCodeColumn,sourceIndex,loc.line,loc.column]),!0):(this.rawSegments.push([this.generatedCodeColumn,sourceIndex,loc.line,loc.column]),charInHiresBoundary=!1):experimentalRange?i===chunk.start&&(this.rawRangeMappingsIndices.push(this.rawSegments.length),this.rawSegments.push([this.generatedCodeColumn,sourceIndex,loc.line,loc.column])):this.rawSegments.push([this.generatedCodeColumn,sourceIndex,loc.line,loc.column]),loc.column+=1,this.generatedCodeColumn+=1),i+=1}}else{let bits=sourcemapLocations.bits;for(;i<end;){let newline=original.indexOf(`
7
+ `,i);if((newline===-1||newline>end)&&(newline=end),newline>i){this.rawSegments.push([this.generatedCodeColumn,sourceIndex,loc.line,loc.column]);for(let w=i+1>>5,last=newline-1>>5;w<=last;w++){let word=bits[w];if(!word)continue;let base=w<<5;for(;word;){let lowest=word&-word,index=base+31-Math.clz32(lowest);if(index>i&&index<newline){let offset=index-i;this.rawSegments.push([this.generatedCodeColumn+offset,sourceIndex,loc.line,loc.column+offset])}word^=lowest}}loc.column+=newline-i,this.generatedCodeColumn+=newline-i}if(newline===end)break;loc.line+=1,loc.column=0,this.nextLine(),i=newline+1}}}advance(str){if(!str)return;let lastNewline=str.lastIndexOf(`
8
+ `);for(let i=str.indexOf(`
9
+ `);i!==-1;i=str.indexOf(`
10
+ `,i+1))this.nextLine();this.generatedCodeColumn+=str.length-lastNewline-1}};const warned={insertLeft:!1,insertRight:!1,storeName:!1};function expandReplacement(replacement,matched,position,str,captures,namedCaptures){if(!replacement.includes(`$`))return replacement;let result=``,index=0;for(;index<replacement.length;){let dollar=replacement.indexOf(`$`,index);if(dollar===-1){result+=replacement.slice(index);break}result+=replacement.slice(index,dollar);let char=replacement[dollar+1],expansion=`$`,consumed=1;if(char===`$`)consumed=2;else if(char===`&`)expansion=matched,consumed=2;else if(char==="`")expansion=str.slice(0,position),consumed=2;else if(char===`'`)expansion=str.slice(position+matched.length),consumed=2;else if(char===`<`&&namedCaptures!==void 0){let close=replacement.indexOf(`>`,dollar+2);close!==-1&&(expansion=namedCaptures[replacement.slice(dollar+2,close)]??``,consumed=close+1-dollar)}else if(char>=`0`&&char<=`9`){let second=replacement[dollar+2],double=second>=`0`&&second<=`9`?Number(char+second):NaN,single=Number(char);double>=1&&double<=captures.length?(expansion=captures[double-1]??``,consumed=3):single>=1&&single<=captures.length&&(expansion=captures[single-1]??``,consumed=2)}result+=expansion,index=dollar+consumed}return result}var MagicString=class MagicString{constructor(string,options={}){let chunk=new Chunk(0,string.length,string);Object.defineProperties(this,{original:{writable:!0,value:string},outro:{writable:!0,value:``},intro:{writable:!0,value:``},firstChunk:{writable:!0,value:chunk},lastChunk:{writable:!0,value:chunk},lastSearchedChunk:{writable:!0,value:chunk},byStart:{writable:!0,value:new Map([[0,chunk]])},byEnd:{writable:!0,value:new Map([[string.length,chunk]])},filename:{writable:!0,value:options.filename},indentExclusionRanges:{writable:!0,value:options.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new BitSet},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:options.ignoreList},offset:{writable:!0,value:options.offset||0},hasMovedChunks:{writable:!0,value:!1}})}addSourcemapLocation(char){this.sourcemapLocations.add(char)}append(content){if(typeof content!=`string`)throw new MagicStringError(`content must be a string, got ${typeof content}`);return this.outro+=content,this}appendLeft(index,content){if(index+=this.offset,typeof content!=`string`)throw new MagicStringError(`content must be a string, got ${typeof content}`);this._split(index);let chunk=this.byEnd.get(index);return chunk?chunk.appendLeft(content):this.intro+=content,this}appendRight(index,content){if(index+=this.offset,typeof content!=`string`)throw new MagicStringError(`content must be a string, got ${typeof content}`);this._split(index);let chunk=this.byStart.get(index);return chunk?chunk.appendRight(content):this.outro+=content,this}clone(){let cloned=new MagicString(this.original,{filename:this.filename,ignoreList:this.ignoreList,offset:this.offset}),originalChunk=this.firstChunk,clonedChunk=cloned.firstChunk=cloned.lastSearchedChunk=originalChunk.clone();for(;originalChunk;){cloned.byStart.set(clonedChunk.start,clonedChunk),cloned.byEnd.set(clonedChunk.end,clonedChunk);let nextOriginalChunk=originalChunk.next,nextClonedChunk=nextOriginalChunk&&nextOriginalChunk.clone();nextClonedChunk&&(clonedChunk.next=nextClonedChunk,nextClonedChunk.previous=clonedChunk,clonedChunk=nextClonedChunk),originalChunk=nextOriginalChunk}return cloned.lastChunk=clonedChunk,this.indentExclusionRanges&&(cloned.indentExclusionRanges=this.indentExclusionRanges.slice()),cloned.sourcemapLocations=new BitSet(this.sourcemapLocations),cloned.storedNames={...this.storedNames},cloned.intro=this.intro,cloned.outro=this.outro,cloned.hasMovedChunks=this.hasMovedChunks,cloned}generateDecodedMap(options){options||={};let mappings=new Mappings(options.hires),names=this._generateMappings(mappings);return{...this._mapProperties(options,names),mappings:mappings.raw,rangeMappings:mappings.rawRangeMappings}}generateMap(options){options||={};let encoder=new MappingsEncoder,mappings=new Mappings(options.hires,encoder),names=this._generateMappings(mappings);return new SourceMap({...this._mapProperties(options,names),mappings:encoder.finish(mappings.rawSegments),rangeMappings:mappings.rawRangeMappings})}_generateMappings(mappings){let names=Object.keys(this.storedNames),locate=getLocator(this.original);return this.intro&&mappings.advance(this.intro),this.firstChunk.eachNext(chunk=>{let loc=locate(chunk.start);chunk.intro.length&&mappings.advance(chunk.intro),chunk.edited?mappings.addEdit(0,chunk.content,loc,chunk.storeName?names.indexOf(chunk.original):-1):mappings.addUneditedChunk(0,chunk,this.original,loc,this.sourcemapLocations),chunk.outro.length&&mappings.advance(chunk.outro)}),this.outro&&mappings.advance(this.outro),names}_mapProperties(options,names){return{file:options.file?options.file.split(/[/\\]/).pop():void 0,sources:[options.source?getRelativePath(options.file||``,options.source):options.file||``],sourcesContent:options.includeContent?[this.original]:void 0,names,x_google_ignoreList:this.ignoreList?[0]:void 0}}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=guessIndent(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?` `:this.indentStr}indent(indentStr,options){let pattern=/^[^\r\n]/gm;if(isObject(indentStr)&&(options=indentStr,indentStr=void 0),indentStr===void 0&&(this._ensureindentStr(),indentStr=this.indentStr||` `),indentStr===``)return this;let resolvedIndentStr=indentStr;options||={};let isExcluded={};options.exclude&&(typeof options.exclude[0]==`number`?[options.exclude]:options.exclude).forEach(exclusion=>{for(let i=exclusion[0];i<exclusion[1];i+=1)isExcluded[i]=!0});let shouldIndentNextCharacter=options.indentStart!==!1,indentPiece=str=>{if(str===``)return str;let indented=str.replace(pattern,(match,offset)=>offset>0||shouldIndentNextCharacter?`${resolvedIndentStr}${match}`:match);return shouldIndentNextCharacter=str[str.length-1]===`
11
+ `,indented};this.intro=indentPiece(this.intro);let charIndex=0,chunk=this.firstChunk,indentAt=index=>{shouldIndentNextCharacter=!1,index===chunk.start?chunk.appendRight(resolvedIndentStr):(this._splitChunk(chunk,index),chunk=chunk.next,chunk.prependRight(resolvedIndentStr))};for(;chunk;){let end=chunk.end;if(isExcluded[chunk.start]||(chunk.intro=indentPiece(chunk.intro)),chunk.edited)isExcluded[charIndex]||(chunk.content=indentPiece(chunk.content));else if(options.exclude)for(charIndex=chunk.start;charIndex<end;){if(!isExcluded[charIndex]){let char=this.original.charCodeAt(charIndex);char===10?shouldIndentNextCharacter=!0:char!==13&&shouldIndentNextCharacter&&indentAt(charIndex)}charIndex+=1}else for(charIndex=chunk.start;charIndex<end;){if(!shouldIndentNextCharacter){let nextLine=this.original.indexOf(`
12
+ `,charIndex);if(nextLine===-1||nextLine>=end)break;shouldIndentNextCharacter=!0,charIndex=nextLine+1;continue}let char=this.original.charCodeAt(charIndex);if(char===10||char===13){charIndex+=1;continue}indentAt(charIndex),charIndex+=1}isExcluded[chunk.end-1]||(chunk.outro=indentPiece(chunk.outro)),charIndex=chunk.end,chunk=chunk.next}return this.outro=indentPiece(this.outro),this}insert(){throw new MagicStringError(`insert() is deprecated, use appendLeft() or prependRight()`)}insertLeft(index,content){return warned.insertLeft||=(console.warn(`magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead`),!0),this.appendLeft(index,content)}insertRight(index,content){return warned.insertRight||=(console.warn(`magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead`),!0),this.prependRight(index,content)}move(start,end,index,affinity=`right`){if(start+=this.offset,end+=this.offset,index+=this.offset,start===end)return this;if(index>=start&&index<=end)throw new MagicStringError(`cannot move a selection inside itself`);this._split(start),this._split(end),this._split(index);let first=this.byStart.get(start),last=this.byEnd.get(end);if(this.hasMovedChunks){let cursor=first;for(;cursor!==last;)if(cursor=cursor.next,!cursor||cursor.start<start||cursor.end>end)throw new MagicStringError(`cannot move ${start} to ${end} because an earlier move split that range`)}let oldLeft=first.previous,oldRight=last.next,newLeft,newRight;if(affinity===`left`){if(newLeft=this.byEnd.get(index)??null,newLeft){if(newLeft.next===first)return this;newRight=newLeft.next}else{if(first===this.firstChunk)return this;newRight=this.firstChunk}}else if(newRight=this.byStart.get(index)??null,newRight){if(newRight.previous===last)return this;newLeft=newRight.previous}else{if(last===this.lastChunk)return this;newLeft=this.lastChunk}return oldLeft&&(oldLeft.next=oldRight),oldRight&&(oldRight.previous=oldLeft),newLeft&&(newLeft.next=first),newRight&&(newRight.previous=last),first.previous||(this.firstChunk=last.next),last.next||(this.lastChunk=first.previous,this.lastChunk.next=null),first.previous=newLeft,last.next=newRight||null,newLeft||(this.firstChunk=first),newRight||(this.lastChunk=last),this.hasMovedChunks=!0,this}overwrite(start,end,content,options){let optionObject=typeof options==`object`&&options?options:{};return this.update(start,end,content,{...optionObject,overwrite:!optionObject.contentOnly})}update(start,end,content,options){if(start+=this.offset,end+=this.offset,typeof content!=`string`)throw new MagicStringError(`content must be a string, got ${typeof content}`);if(this.original.length!==0&&(start<0&&(start=Math.max(0,start+this.original.length)),end<0&&(end=Math.max(0,end+this.original.length))),start<0)throw new MagicStringError(`start ${start} is out of bounds`);if(end>this.original.length)throw new MagicStringError(`end ${end} is out of bounds`);if(start===end)throw new MagicStringError(`cannot overwrite a zero-length range at ${start}, use appendLeft() or prependRight()`);if(start>end)throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);this._split(start),this._split(end),options===!0&&(warned.storeName||=(console.warn(`The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string`),!0),options={storeName:!0});let optionObject=typeof options==`object`&&options?options:{},storeName=optionObject.storeName||!1,overwrite=optionObject.overwrite||!1;if(storeName){let original=this.original.slice(start,end);Object.defineProperty(this.storedNames,original,{writable:!0,value:!0,enumerable:!0})}let first=this.byStart.get(start),last=this.byEnd.get(end);if(first){let chunk=first;for(;chunk!==last;){if(chunk.next!==this.byStart.get(chunk.end))throw new MagicStringError(`cannot overwrite across a split point`);chunk=chunk.next,chunk.edit(``,!1)}first.edit(content,storeName,!overwrite)}else{let newChunk=new Chunk(start,end,``).edit(content,storeName);last.next=newChunk,newChunk.previous=last}return this}prepend(content){if(typeof content!=`string`)throw new MagicStringError(`content must be a string, got ${typeof content}`);return this.intro=content+this.intro,this}prependLeft(index,content){if(index+=this.offset,typeof content!=`string`)throw new MagicStringError(`content must be a string, got ${typeof content}`);this._split(index);let chunk=this.byEnd.get(index);return chunk?chunk.prependLeft(content):this.intro=content+this.intro,this}prependRight(index,content){if(index+=this.offset,typeof content!=`string`)throw new MagicStringError(`content must be a string, got ${typeof content}`);this._split(index);let chunk=this.byStart.get(index);return chunk?chunk.prependRight(content):this.outro=content+this.outro,this}remove(start,end){if(start+=this.offset,end+=this.offset,this.original.length!==0&&(start<0&&(start=Math.max(0,start+this.original.length)),end<0&&(end=Math.max(0,end+this.original.length))),start===end)return this;if(start<0||end>this.original.length)throw new MagicStringError(`range ${start}–${end} is out of bounds`);if(start>end)throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);this._split(start),this._split(end);let chunk=this.byStart.get(start);for(;chunk;)chunk.start>start&&(chunk.intro=``),chunk.end<end&&(chunk.outro=``),chunk.edit(``,!1,!0),chunk=end>chunk.end?this.byStart.get(chunk.end):null;return this}reset(start,end){if(start+=this.offset,end+=this.offset,this.original.length!==0&&(start<0&&(start=Math.max(0,start+this.original.length)),end<0&&(end=Math.max(0,end+this.original.length))),start===end)return this;if(start<0||end>this.original.length)throw new MagicStringError(`range ${start}–${end} is out of bounds`);if(start>end)throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);this._split(start),this._split(end);let chunk=this.byStart.get(start);for(;chunk;)chunk.reset(),chunk=end>chunk.end?this.byStart.get(chunk.end):null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let chunk=this.lastChunk;for(;chunk;){if(chunk.outro.length)return chunk.outro[chunk.outro.length-1];if(chunk.content.length)return chunk.content[chunk.content.length-1];if(chunk.intro.length)return chunk.intro[chunk.intro.length-1];chunk=chunk.previous}return this.intro.length?this.intro[this.intro.length-1]:``}lastLine(){let lineIndex=this.outro.lastIndexOf(`
13
+ `);if(lineIndex!==-1)return this.outro.substr(lineIndex+1);let lineStr=this.outro,chunk=this.lastChunk;for(;chunk;){if(chunk.outro.length>0){if(lineIndex=chunk.outro.lastIndexOf(`
14
+ `),lineIndex!==-1)return chunk.outro.substr(lineIndex+1)+lineStr;lineStr=chunk.outro+lineStr}if(chunk.content.length>0){if(lineIndex=chunk.content.lastIndexOf(`
15
+ `),lineIndex!==-1)return chunk.content.substr(lineIndex+1)+lineStr;lineStr=chunk.content+lineStr}if(chunk.intro.length>0){if(lineIndex=chunk.intro.lastIndexOf(`
16
+ `),lineIndex!==-1)return chunk.intro.substr(lineIndex+1)+lineStr;lineStr=chunk.intro+lineStr}chunk=chunk.previous}return lineIndex=this.intro.lastIndexOf(`
17
+ `),lineIndex===-1?this.intro+lineStr:this.intro.substr(lineIndex+1)+lineStr}slice(start=0,end=this.original.length-this.offset){start+=this.offset,end+=this.offset,this.original.length!==0&&(start<0&&(start=Math.max(0,start+this.original.length)),end<0&&(end=Math.max(0,end+this.original.length)));let result=``,chunk=this.firstChunk;for(;chunk&&(chunk.start>start||chunk.end<=start);){if(chunk.start<end&&chunk.end>=end||end===0&&chunk.start===0)return result;chunk=chunk.next}if(chunk&&chunk.edited&&chunk.start!==start)throw new MagicStringError(`cannot use edited character ${start} as slice start anchor`);let startChunk=chunk;for(;chunk&&(end!==0||chunk.start!==0);){chunk.intro&&(startChunk!==chunk||chunk.start===start)&&(result+=chunk.intro);let containsEnd=chunk.start<end&&chunk.end>=end;if(containsEnd&&chunk.edited&&chunk.end!==end)throw new MagicStringError(`cannot use edited character ${end} as slice end anchor`);let sliceStart=startChunk===chunk?start-chunk.start:0,sliceEnd=containsEnd?chunk.content.length+end-chunk.end:chunk.content.length;if(result+=chunk.content.slice(sliceStart,sliceEnd),chunk.outro&&(!containsEnd||chunk.end===end)&&(result+=chunk.outro),containsEnd)break;chunk=chunk.next}return result}snip(start,end){let clone=this.clone();return clone.remove(0,start),clone.remove(end,clone.original.length),clone}_split(index){if(this.byStart.get(index)||this.byEnd.get(index))return;let chunk=this.lastSearchedChunk,previousChunk=chunk,searchForward=index>chunk.end;for(;chunk;){if(chunk.contains(index))return this._splitChunk(chunk,index);if(chunk=searchForward?this.byStart.get(chunk.end):this.byEnd.get(chunk.start),chunk===previousChunk)return;previousChunk=chunk}}_splitChunk(chunk,index){if(chunk.edited&&chunk.content.length){let loc=getLocator(this.original)(index);throw new MagicStringError(`cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`)}let newChunk=chunk.split(index);return this.byEnd.set(index,chunk),this.byStart.set(index,newChunk),this.byEnd.set(newChunk.end,newChunk),chunk===this.lastChunk&&(this.lastChunk=newChunk),this.lastSearchedChunk=chunk,!0}toString(){let str=this.intro,chunk=this.firstChunk;for(;chunk;)str+=chunk.toString(),chunk=chunk.next;return str+this.outro}isEmpty(){if(this.intro.length&&this.intro.trim())return!1;let chunk=this.firstChunk;for(;chunk;){if(chunk.intro.length&&chunk.intro.trim()||chunk.content.length&&chunk.content.trim()||chunk.outro.length&&chunk.outro.trim())return!1;chunk=chunk.next}return!(this.outro.length&&this.outro.trim())}length(){let chunk=this.firstChunk,length=0;for(;chunk;)length+=chunk.intro.length+chunk.content.length+chunk.outro.length,chunk=chunk.next;return length}trimLines(){return this.trim(`[\\r\\n]`)}trim(charType){return this.trimStart(charType).trimEnd(charType)}trimEndAborted(charType){let rx=RegExp(`${charType||`\\s`}+$`);if(this.outro=this.outro.replace(rx,``),this.outro.length)return!0;let chunk=this.lastChunk;do{let end=chunk.end,aborted=chunk.trimEnd(rx);if(chunk.end!==end&&(this.lastChunk===chunk&&(this.lastChunk=chunk.next),this.byEnd.set(chunk.end,chunk),this.byStart.set(chunk.next.start,chunk.next),this.byEnd.set(chunk.next.end,chunk.next)),aborted)return!0;chunk=chunk.previous}while(chunk);return this.intro=this.intro.replace(rx,``),this.intro.length>0}trimEnd(charType){return this.trimEndAborted(charType),this}trimStartAborted(charType){let rx=RegExp(`^${charType||`\\s`}+`);if(this.intro=this.intro.replace(rx,``),this.intro.length)return!0;let chunk=this.firstChunk;do{let end=chunk.end,aborted=chunk.trimStart(rx);if(chunk.end!==end&&(chunk===this.lastChunk&&(this.lastChunk=chunk.next),this.byEnd.set(chunk.end,chunk),this.byStart.set(chunk.next.start,chunk.next),this.byEnd.set(chunk.next.end,chunk.next)),aborted)return!0;chunk=chunk.next}while(chunk);return this.outro=this.outro.replace(rx,``),this.outro.length>0}trimStart(charType){return this.trimStartAborted(charType),this}hasChanged(){if(this.intro||this.outro)return!0;let outputIndex=0,chunk=this.firstChunk;for(;chunk;){if(chunk.intro||chunk.outro)return!0;if(!chunk.edited&&chunk.start===outputIndex)outputIndex=chunk.end;else{if(!this.original.startsWith(chunk.content,outputIndex))return!0;outputIndex+=chunk.content.length}chunk=chunk.next}return outputIndex!==this.original.length}_hasRemovedContent(start,end){let chunk=this.byStart.get(start);if(!chunk){chunk=this.lastSearchedChunk;let searchForward=start>=chunk.end;for(;chunk&&!chunk.contains(start);)chunk=searchForward?this.byStart.get(chunk.end):this.byEnd.get(chunk.start);chunk&&(this.lastSearchedChunk=chunk)}for(;chunk&&chunk.start<end;){if(chunk.content===``)return!0;chunk=this.byStart.get(chunk.end)}return!1}_replaceRegexp(searchValue,replacement){function getReplacement(match,str){return typeof replacement==`string`?expandReplacement(replacement,match[0],match.index,str,match.slice(1),match.groups):match.groups===void 0?replacement(match[0],...match.slice(1),match.index,str):replacement(match[0],...match.slice(1),match.index,str,match.groups)}let replaceMatch=match=>{if(match.index==null||this._hasRemovedContent(match.index,match.index+match[0].length))return!1;let replacement=getReplacement(match,this.original);return replacement===match[0]||(match[0].length===0?this.appendRight(match.index,replacement):this.overwrite(match.index,match.index+match[0].length,replacement)),!0};if(searchValue.global){searchValue.lastIndex=0;for(let match of this.original.matchAll(searchValue))replaceMatch(match)}else{let match=this.original.match(searchValue);if(match&&!replaceMatch(match)){let global=new RegExp(searchValue.source,`${searchValue.flags}g`);for(let next of this.original.matchAll(global))if(replaceMatch(next))break}}return this}_replaceString(string,replacement){let{original}=this,index=original.indexOf(string);for(;index!==-1;){if(this._hasRemovedContent(index,index+string.length)){index=original.indexOf(string,index+string.length);continue}replacement=typeof replacement==`function`?replacement(string,index,original):expandReplacement(replacement,string,index,original,[],void 0),string!==replacement&&(string.length===0?this.appendRight(index,replacement):this.overwrite(index,index+string.length,replacement));break}return this}replace(searchValue,replacement){return typeof searchValue==`string`?this._replaceString(searchValue,replacement):this._replaceRegexp(searchValue,replacement)}_replaceAllString(string,replacement){let{original}=this,stringLength=string.length;if(stringLength===0){for(let index=0;index<=original.length;index+=1){if(this._hasRemovedContent(index,index))continue;let _replacement=typeof replacement==`function`?replacement(``,index,original):expandReplacement(replacement,``,index,original,[],void 0);_replacement!==``&&this.appendRight(index,_replacement)}return this}for(let index=original.indexOf(string);index!==-1;index=original.indexOf(string,index+stringLength)){if(this._hasRemovedContent(index,index+stringLength))continue;let previous=original.slice(index,index+stringLength),_replacement=typeof replacement==`function`?replacement(previous,index,original):expandReplacement(replacement,previous,index,original,[],void 0);previous!==_replacement&&this.overwrite(index,index+stringLength,_replacement)}return this}replaceAll(searchValue,replacement){if(typeof searchValue==`string`)return this._replaceAllString(searchValue,replacement);if(!searchValue.global)throw new MagicStringError(`replaceAll() requires a global RegExp`);return this._replaceRegexp(searchValue,replacement)}};export{MagicString,MagicString as default};
@@ -1,4 +1,4 @@
1
- import { a as InterfereContextValue, i as InterfereContext } from "./provider-DRuvRafW.mjs";
1
+ import { a as InterfereContextValue, i as InterfereContext } from "./provider-B2L5znqI.mjs";
2
2
  import { Component, ContextType, ErrorInfo, ReactNode } from "react";
3
3
  //#region src/error-boundary.d.ts
4
4
  export interface ErrorBoundaryProps {
@@ -1,4 +1,4 @@
1
1
  import "./instrumentations-Bgm2EazU.mjs";
2
2
  import "./navigation-CkiV6lJY.mjs";
3
- import "./provider-CF0h4Mah.mjs";
3
+ import "./provider-Df5aXrYa.mjs";
4
4
  import "./web-vitals-x8y70B5x.mjs";
@@ -1,4 +1,4 @@
1
- import { a as InterfereContextValue, i as InterfereContext } from "../provider-DRuvRafW.mjs";
1
+ import { a as InterfereContextValue, i as InterfereContext } from "../provider-B2L5znqI.mjs";
2
2
  import { Component, ContextType, ReactNode } from "react";
3
3
  //#region src/internal/capture-boundary.d.ts
4
4
  interface CaptureBoundaryProps {
@@ -1,4 +1,4 @@
1
- import { s as Kernel } from "../provider-DRuvRafW.mjs";
1
+ import { s as Kernel } from "../provider-B2L5znqI.mjs";
2
2
  import { ErrorMechanism } from "@interfere/types/sdk/plugins/payload/errors";
3
3
  //#region src/internal/capture.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { ConsentCategory, ConsentState, PluginKey } from "@interfere/types/sdk/plugins/manifest";
1
+ import { ConsentCategory, ConsentInput, ConsentState, PluginKey } from "@interfere/types/sdk/plugins/manifest";
2
2
  import { EventType } from "@interfere/types/sdk/envelope";
3
3
  //#region src/internal/consent.d.ts
4
4
  export declare const DEFAULT_CONSENT: {
@@ -8,13 +8,7 @@ export declare const DEFAULT_CONSENT: {
8
8
  export declare function getPluginConsentCategory(key: PluginKey): "analytics" | "necessary" | "replay";
9
9
  export declare function isConsentAllowed(category: ConsentCategory, consentState: ConsentState | null): boolean;
10
10
  export declare function shouldCaptureEvent(type: EventType, consentState: ConsentState | null): boolean;
11
- export declare function resolveGrantedConsent(consent?: ConsentState): {
12
- analytics: true;
13
- replay: true;
14
- } | {
15
- replay: boolean;
16
- analytics: boolean;
17
- } | {
11
+ export declare function resolveGrantedConsent(consent?: ConsentInput): {
18
12
  analytics: boolean;
19
13
  replay: boolean;
20
14
  };
@@ -1 +1 @@
1
- import{PLUGIN_MANIFEST}from"@interfere/types/sdk/plugins/manifest";const DEFAULT_CONSENT={analytics:!0,replay:!0},PLUGIN_CONSENT_BY_KEY=Object.fromEntries(PLUGIN_MANIFEST.map(plugin=>[plugin.name,plugin.consentCategory])),EVENT_CONSENT_BY_TYPE=Object.fromEntries(PLUGIN_MANIFEST.flatMap(plugin=>plugin.events.map(event=>[event.name,plugin.consentCategory]))),GATEABLE_CATEGORIES=Object.keys(DEFAULT_CONSENT);function getPluginConsentCategory(key){return PLUGIN_CONSENT_BY_KEY[key]}function isConsentAllowed(category,consentState){return category===`necessary`||consentState===null||consentState[category]===!0}function shouldCaptureEvent(type,consentState){return isConsentAllowed(EVENT_CONSENT_BY_TYPE[type],consentState)}function resolveGrantedConsent(consent){return{...DEFAULT_CONSENT,...consent}}function hasConsentChanged(current,next){for(let category of GATEABLE_CATEGORIES)if(current?.[category]!==next?.[category])return!0;return!1}export{DEFAULT_CONSENT,getPluginConsentCategory,hasConsentChanged,isConsentAllowed,resolveGrantedConsent,shouldCaptureEvent};
1
+ import{PLUGIN_MANIFEST}from"@interfere/types/sdk/plugins/manifest";const DEFAULT_CONSENT={analytics:!0,replay:!0},PLUGIN_CONSENT_BY_KEY=Object.fromEntries(PLUGIN_MANIFEST.map(plugin=>[plugin.name,plugin.consentCategory])),EVENT_CONSENT_BY_TYPE=Object.fromEntries(PLUGIN_MANIFEST.flatMap(plugin=>plugin.events.map(event=>[event.name,plugin.consentCategory]))),GATEABLE_CATEGORIES=Object.keys(DEFAULT_CONSENT);function getPluginConsentCategory(key){return PLUGIN_CONSENT_BY_KEY[key]}function isConsentAllowed(category,consentState){return category===`necessary`||consentState===null||consentState[category]===!0}function shouldCaptureEvent(type,consentState){return isConsentAllowed(EVENT_CONSENT_BY_TYPE[type],consentState)}function resolveGrantedConsent(consent){return consent===!0||consent===!1?{analytics:consent,replay:consent}:{...DEFAULT_CONSENT,...consent}}function hasConsentChanged(current,next){for(let category of GATEABLE_CATEGORIES)if(current?.[category]!==next?.[category])return!0;return!1}export{DEFAULT_CONSENT,getPluginConsentCategory,hasConsentChanged,isConsentAllowed,resolveGrantedConsent,shouldCaptureEvent};
@@ -1,4 +1,4 @@
1
- import { s as Kernel } from "../provider-DRuvRafW.mjs";
1
+ import { s as Kernel } from "../provider-B2L5znqI.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,3 +1,3 @@
1
- import { _ as createKernel, c as KernelConsent, d as KernelInternalOptions, f as KernelOptions, g as buildSdkStack, h as TracingOptions, l as KernelDevice, m as RecordExceptionOpts, p as KernelSession, s as Kernel, u as KernelIdentity, v as isEnabledByEnvironment, y as readReleaseSlugFromGlobals } from "../provider-DRuvRafW.mjs";
1
+ import { _ as createKernel, c as KernelConsent, d as KernelInternalOptions, f as KernelOptions, g as buildSdkStack, h as TracingOptions, l as KernelDevice, m as RecordExceptionOpts, p as KernelSession, s as Kernel, u as KernelIdentity, v as isEnabledByEnvironment, y as readReleaseSlugFromGlobals } from "../provider-B2L5znqI.mjs";
2
2
  import { i as HttpStatusCodeRange, n as CaptureFailedRequestsOption, r as CaptureFailedRequestsOptions } from "../instrumentations-Bgm2EazU.mjs";
3
3
  export { type CaptureFailedRequestsOption, type CaptureFailedRequestsOptions, type HttpStatusCodeRange, Kernel, KernelConsent, KernelDevice, KernelIdentity, KernelInternalOptions, KernelOptions, KernelSession, RecordExceptionOpts, TracingOptions, buildSdkStack, createKernel, isEnabledByEnvironment, readReleaseSlugFromGlobals };
@@ -1 +1 @@
1
- import{createLogger}from"../util/log.mjs";import{onPageHidden}from"./page-lifecycle.mjs";import{SessionTracker}from"../tracking/api.mjs";import{getGlobal}from"../util/global.mjs";import{safeStringify}from"../util/stringify.mjs";import{resolveTargets,setIngestHost}from"./config.mjs";import{t as PRODUCER_VERSION}from"../version-XRSM9Pwm.mjs";import{INGEST_IGNORE_RE}from"./otel/exporter.mjs";import{recordInitialNavigation}from"./otel/initial-navigation.mjs";import{PluginRuntime}from"./plugin-runtime.mjs";import{isNonErrorException,shouldDropBrowserExtensionNoise,shouldDropUnresolvableStack,toExceptions}from"@interfere/types/sdk/errors";import{trace}from"@opentelemetry/api";import{omitUndefined}from"@interfere/helpers/omit-undefined";import{InterfereClient}from"@interfere/javascript";import{FORCE_ENABLE_GLOBAL,RELEASE_SLUG_GLOBAL,SDK_STACK_GLOBAL}from"@interfere/types/sdk/injected-globals";import{releaseSlugSchema}from"@interfere/types/releases/slug";import{readBakedPlugins,remoteConfigInputSchema}from"@interfere/types/sdk/remote-config";const log=createLogger(`kernel`),REPLAY_UPLOAD_RE=/\/v3\/replay\/upload\//u;function buildSdkStack(wrapperVersions){return[...wrapperVersions??[],PRODUCER_VERSION]}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}var Kernel=class{consent;identity;device;session;seen=new WeakSet;initialNavigationSeen=new Set;runtime=null;otel=null;otelDispose=null;otelControls=null;deviceInfoCaptureEnabled=!1;unsubscribePageHidden=null;tracker;constructor(tracker){this.tracker=tracker,this.consent={get:()=>this.requireRuntime().getConsent(),set:value=>{let runtime=this.requireRuntime();value?runtime.setConsent(value):runtime.resetConsent()}},this.identity={clear:()=>{this.tracker.reset()},get:()=>this.tracker.getIdentity(),set:async params=>this.tracker.identify(params)},this.device={getDeviceId:()=>this.tracker.getDeviceId(),getFpHash:()=>this.tracker.getFpHash()},this.session={getId:()=>this.tracker.sessionId(),getWindowId:()=>this.tracker.windowId()},this.unsubscribePageHidden=onPageHidden(()=>{this.flush().catch(()=>{})})}attachRuntime(runtime){this.runtime=runtime}requireRuntime(){if(!this.runtime)throw Error(`Kernel runtime not attached. createKernel must call attachRuntime before any consent/dispose path runs.`);return this.runtime}getSessionId(){return this.tracker.sessionId()??``}getWindowId(){return this.tracker.windowId()??``}onSessionPause(handler){return this.tracker.onSessionPause(handler)}onSessionResume(handler){return this.tracker.onSessionResume(handler)}getPluginConfigState(key){return this.requireRuntime().getPluginConfigState(key)}getReplayConfig(){return this.requireRuntime().getReplayConfig()}subscribePluginConfigState(key,listener){return this.requireRuntime().subscribePluginConfigState(key,listener)}getTracer(name){return this.otel?.tracerProvider.getTracer(name)??trace.getTracer(name)}startPageEventsCapture(){let{otelControls:controls,otel}=this;return!controls||!otel?null:(controls.setPageEventsEnabled(!0),this.recordInitialNavigation(otel.loggerProvider),(()=>{controls.setPageEventsEnabled(!1)}))}startDeviceInfoCapture(){return this.tracker.startDeviceIdentity(),this.deviceInfoCaptureEnabled=!0,(reason=>{this.deviceInfoCaptureEnabled=!1,reason===`consent-revoked`&&this.tracker.discardDeviceIdentity()})}isDeviceInfoCaptureEnabled(){return this.deviceInfoCaptureEnabled}recordException(value,opts){if(!isNonErrorException(value)){if(this.seen.has(value))return;this.seen.add(value)}if(!isNonErrorException(value)){let stacks=[],current=value;for(let depth=0;current&&depth<5;depth+=1)current.stack&&stacks.push(current.stack),current=current.cause instanceof Error?current.cause:void 0;if(shouldDropBrowserExtensionNoise(stacks)||shouldDropUnresolvableStack(stacks))return}let attrs=buildExceptionEventAttrs(value,opts),active=trace.getActiveSpan();if(active?.isRecording()){active.addEvent(`exception`,attrs);return}let span=this.otel?.tracerProvider.getTracer(`@interfere/react/exception`).startSpan(`interfere.exception.capture`);span&&(span.addEvent(`exception`,attrs),span.end())}recordLog(input){this.otel&&this.otel.loggerProvider.getLogger(`@interfere/react`).emit(omitUndefined({body:input.body,severityNumber:input.severityNumber,severityText:input.severityText,attributes:input.attributes}))}recordInitialNavigation(loggerProvider){recordInitialNavigation({getSessionId:()=>this.session.getId(),getWindowId:()=>this.session.getWindowId(),loggerProvider,seen:this.initialNavigationSeen})}async flush(){this.otel&&await this.otel.flush()}attachOtel(handle,dispose,controls){this.otel=handle,this.otelDispose=dispose,this.otelControls=controls??null}syncProviderConfig(config){this.requireRuntime().applyProviderConfig(config.plugins,config.consent)}async dispose(){this.unsubscribePageHidden?.(),this.unsubscribePageHidden=null,this.runtime&&await this.runtime.dispose(),this.tracker.dispose(),this.otelDispose?.(),this.otelDispose=null,this.otel&&=(await this.otel.shutdown(),null)}};async function createKernel(input={}){let{opts={}}=input,fetcher=opts.fetch??globalThis.fetch.bind(globalThis),remotePlugins=await resolveRemotePlugins(opts,fetcher),targets=resolveTargets(opts.apiHost);log.info(`ingest: %s`,targets.ingest.baseUrl),getGlobal(FORCE_ENABLE_GLOBAL)&&log.warn(`FORCE_ENABLE is active. Events will be dropped by production ingest. This should only be set during local development.`);let tracker=new SessionTracker({fetcher,target:targets.ingest});opts._wrapperVersions?.length&&Object.assign(globalThis,{[SDK_STACK_GLOBAL]:opts._wrapperVersions});let kernel=new Kernel(tracker),runtime=new PluginRuntime(kernel,opts.consent,remotePlugins??{});if(kernel.attachRuntime(runtime),tracker.start(),runtime.start(),opts.tracing!==!1){let resolvedTracing={...typeof opts.tracing==`object`?opts.tracing:void 0};opts.serviceName&&(resolvedTracing.serviceName=opts.serviceName),opts._internalAdditionalSpanProcessors&&(resolvedTracing.additionalSpanProcessors=opts._internalAdditionalSpanProcessors),opts._internalAdditionalLogRecordProcessors&&(resolvedTracing.additionalLogRecordProcessors=opts._internalAdditionalLogRecordProcessors),opts._internalAdditionalMetricReaders&&(resolvedTracing.additionalMetricReaders=opts._internalAdditionalMetricReaders),await wireOtel(kernel,targets,opts._wrapperVersions,resolvedTracing)}return remotePlugins?runtime.applyRemoteConfig(remotePlugins):runtime.applyRemoteConfigDefaults(),kernel}async function resolveRemotePlugins(opts,fetcher){let baked=readBakedPlugins();if(baked)return baked;let remoteConfig=await fetchRemoteConfig(resolveTargets(opts.apiHost).config,fetcher);return remoteConfig?.ingestUrl&&setIngestHost(remoteConfig.ingestUrl),remoteConfig?.plugins??null}async function wireOtel(kernel,targets,wrapperVersions,tracing){let{buildOtelProvider,captureWebVitals,createPageScopeRotator,installNavigationScope,PAGE_SCOPE_MAX_AGE_MS,readPropagationFromDocument,registerBundledInstrumentations,seedPageScope}=await import(`./otel/index.mjs`),releaseSlug=readReleaseSlugFromGlobals(),handle=buildOtelProvider(omitUndefined({clientOptions:targets.ingest,getDeviceId:()=>kernel.device.getDeviceId(),getSessionId:()=>kernel.session.getId(),isDeviceInfoEnabled:()=>kernel.isDeviceInfoCaptureEnabled(),releaseSlug,sdkStack:buildSdkStack(wrapperVersions),serviceName:tracing.serviceName||void 0,additionalSpanProcessors:tracing.additionalSpanProcessors,additionalLogRecordProcessors:tracing.additionalLogRecordProcessors,additionalMetricReaders:tracing.additionalMetricReaders})),scopeSpanInput=omitUndefined({tracer:handle.tracerProvider.getTracer(`@interfere/react/navigation`),resolveRoute:tracing.resolveRoute}),extracted=readPropagationFromDocument();handle.contextManager.setPageScope(extracted??seedPageScope(scopeSpanInput)),handle.contextManager.setRotation(createPageScopeRotator(scopeSpanInput),PAGE_SCOPE_MAX_AGE_MS);let disposeNavigationScope=installNavigationScope({...scopeSpanInput,setPageScope:ctx=>{handle.contextManager.setPageScope(ctx)}}),instrumentations=registerBundledInstrumentations(omitUndefined({tracerProvider:handle.tracerProvider,loggerProvider:handle.loggerProvider,ignoreUrls:[INGEST_IGNORE_RE,`${targets.config.baseUrl}/v3/config`,`${targets.ingest.baseUrl}/v3/session`,REPLAY_UPLOAD_RE],apiHosts:tracing.apiHosts,propagateContextUrls:tracing.propagateContextUrls,resolveRoute:tracing.resolveRoute,captureFailedRequests:tracing.captureFailedRequests}));tracing.webVitals!==!1&&captureWebVitals(omitUndefined({flush:async()=>handle.flush(),meter:handle.meterProvider.getMeter(`@interfere/react/web-vitals`),resolveRoute:tracing.resolveRoute})),kernel.attachOtel(handle,()=>{disposeNavigationScope(),instrumentations.dispose()},{setPageEventsEnabled:instrumentations.setPageEventsEnabled})}async function fetchRemoteConfig(configTarget,fetcher){try{let client=new InterfereClient({...configTarget,fetch:Object.assign(async(url,init)=>fetcher(url,{...init,credentials:`omit`}),fetcher)});return remoteConfigInputSchema.parse(await client.config.getSdkConfig())}catch{return log.warn(`remote config fetch failed, using local defaults`),null}}function isEnabledByEnvironment(){if(typeof process>`u`||process.env===void 0||process.env===null)return!0;let nodeEnv=process.env.NODE_ENV;return nodeEnv===`production`||nodeEnv===void 0||!!getGlobal(FORCE_ENABLE_GLOBAL)||!!process.env.INTERFERE_FORCE_ENABLE}function readReleaseSlugFromGlobals(){let value=getGlobal(RELEASE_SLUG_GLOBAL);return typeof value==`string`?releaseSlugSchema.parse(value):null}export{Kernel,buildSdkStack,createKernel,isEnabledByEnvironment,readReleaseSlugFromGlobals};
1
+ import{createLogger}from"../util/log.mjs";import{onPageHidden}from"./page-lifecycle.mjs";import{getGlobal}from"../util/global.mjs";import{resolveTargets,setIngestHost}from"./config.mjs";import{SessionTracker}from"../tracking/api.mjs";import{safeStringify}from"../util/stringify.mjs";import{t as PRODUCER_VERSION}from"../version-CmerIGVk.mjs";import{INGEST_IGNORE_RE}from"./otel/exporter.mjs";import{recordInitialNavigation}from"./otel/initial-navigation.mjs";import{PluginRuntime}from"./plugin-runtime.mjs";import{isNonErrorException,shouldDropBrowserExtensionNoise,shouldDropUnresolvableStack,toExceptions}from"@interfere/types/sdk/errors";import{trace}from"@opentelemetry/api";import{omitUndefined}from"@interfere/helpers/omit-undefined";import{FORCE_ENABLE_GLOBAL,RELEASE_SLUG_GLOBAL,SDK_STACK_GLOBAL}from"@interfere/types/sdk/injected-globals";import{InterfereClient}from"@interfere/javascript";import{releaseSlugSchema}from"@interfere/types/releases/slug";import{readBakedPlugins,remoteConfigInputSchema}from"@interfere/types/sdk/remote-config";const log=createLogger(`kernel`),REPLAY_UPLOAD_RE=/\/v3\/replay\/upload\//u;function buildSdkStack(wrapperVersions){return[...wrapperVersions??[],PRODUCER_VERSION]}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}var Kernel=class{consent;identity;device;session;seen=new WeakSet;initialNavigationSeen=new Set;runtime=null;otel=null;otelDispose=null;otelControls=null;deviceInfoCaptureEnabled=!1;unsubscribePageHidden=null;tracker;constructor(tracker){this.tracker=tracker,this.consent={get:()=>this.requireRuntime().getConsent(),set:value=>{let runtime=this.requireRuntime();value===void 0?runtime.resetConsent():runtime.setConsent(value)}},this.identity={clear:()=>{this.tracker.reset()},get:()=>this.tracker.getIdentity(),set:async params=>this.tracker.identify(params)},this.device={getDeviceId:()=>this.tracker.getDeviceId(),getFpHash:()=>this.tracker.getFpHash()},this.session={getId:()=>this.tracker.sessionId(),getWindowId:()=>this.tracker.windowId()},this.unsubscribePageHidden=onPageHidden(()=>{this.flush().catch(()=>{})})}attachRuntime(runtime){this.runtime=runtime}requireRuntime(){if(!this.runtime)throw Error(`Kernel runtime not attached. createKernel must call attachRuntime before any consent/dispose path runs.`);return this.runtime}getSessionId(){return this.tracker.sessionId()??``}getWindowId(){return this.tracker.windowId()??``}onSessionPause(handler){return this.tracker.onSessionPause(handler)}onSessionResume(handler){return this.tracker.onSessionResume(handler)}getPluginConfigState(key){return this.requireRuntime().getPluginConfigState(key)}getReplayConfig(){return this.requireRuntime().getReplayConfig()}subscribePluginConfigState(key,listener){return this.requireRuntime().subscribePluginConfigState(key,listener)}getTracer(name){return this.otel?.tracerProvider.getTracer(name)??trace.getTracer(name)}startPageEventsCapture(){let{otelControls:controls,otel}=this;return!controls||!otel?null:(controls.setPageEventsEnabled(!0),this.recordInitialNavigation(otel.loggerProvider),(()=>{controls.setPageEventsEnabled(!1)}))}startDeviceInfoCapture(){return this.tracker.startDeviceIdentity(),this.deviceInfoCaptureEnabled=!0,(reason=>{this.deviceInfoCaptureEnabled=!1,reason===`consent-revoked`&&this.tracker.discardDeviceIdentity()})}isDeviceInfoCaptureEnabled(){return this.deviceInfoCaptureEnabled}recordException(value,opts){if(!isNonErrorException(value)){if(this.seen.has(value))return;this.seen.add(value)}if(!isNonErrorException(value)){let stacks=[],current=value;for(let depth=0;current&&depth<5;depth+=1)current.stack&&stacks.push(current.stack),current=current.cause instanceof Error?current.cause:void 0;if(shouldDropBrowserExtensionNoise(stacks)||shouldDropUnresolvableStack(stacks))return}let attrs=buildExceptionEventAttrs(value,opts),active=trace.getActiveSpan();if(active?.isRecording()){active.addEvent(`exception`,attrs);return}let span=this.otel?.tracerProvider.getTracer(`@interfere/react/exception`).startSpan(`interfere.exception.capture`);span&&(span.addEvent(`exception`,attrs),span.end())}recordLog(input){this.otel&&this.otel.loggerProvider.getLogger(`@interfere/react`).emit(omitUndefined({body:input.body,severityNumber:input.severityNumber,severityText:input.severityText,attributes:input.attributes}))}recordInitialNavigation(loggerProvider){recordInitialNavigation({getSessionId:()=>this.session.getId(),getWindowId:()=>this.session.getWindowId(),loggerProvider,seen:this.initialNavigationSeen})}async flush(){this.otel&&await this.otel.flush()}attachOtel(handle,dispose,controls){this.otel=handle,this.otelDispose=dispose,this.otelControls=controls??null}syncProviderConfig(config){this.requireRuntime().applyProviderConfig(config.plugins,config.consent)}async dispose(){this.unsubscribePageHidden?.(),this.unsubscribePageHidden=null,this.runtime&&await this.runtime.dispose(),this.tracker.dispose(),this.otelDispose?.(),this.otelDispose=null,this.otel&&=(await this.otel.shutdown(),null)}};async function createKernel(input={}){let{opts={}}=input,fetcher=opts.fetch??globalThis.fetch.bind(globalThis),remotePlugins=await resolveRemotePlugins(opts,fetcher),targets=resolveTargets(opts.apiHost);log.info(`ingest: %s`,targets.ingest.baseUrl),getGlobal(FORCE_ENABLE_GLOBAL)&&log.warn(`FORCE_ENABLE is active. Events will be dropped by production ingest. This should only be set during local development.`);let tracker=new SessionTracker({fetcher,target:targets.ingest});opts._wrapperVersions?.length&&Object.assign(globalThis,{[SDK_STACK_GLOBAL]:opts._wrapperVersions});let kernel=new Kernel(tracker),runtime=new PluginRuntime(kernel,opts.consent,remotePlugins??{});if(kernel.attachRuntime(runtime),tracker.start(),runtime.start(),opts.tracing!==!1){let resolvedTracing={...typeof opts.tracing==`object`?opts.tracing:void 0};opts.serviceName&&(resolvedTracing.serviceName=opts.serviceName),opts.serviceNamespace!==void 0&&(resolvedTracing.serviceNamespace=opts.serviceNamespace),opts._internalAdditionalSpanProcessors&&(resolvedTracing.additionalSpanProcessors=opts._internalAdditionalSpanProcessors),opts._internalAdditionalLogRecordProcessors&&(resolvedTracing.additionalLogRecordProcessors=opts._internalAdditionalLogRecordProcessors),opts._internalAdditionalMetricReaders&&(resolvedTracing.additionalMetricReaders=opts._internalAdditionalMetricReaders),await wireOtel(kernel,targets,opts._wrapperVersions,resolvedTracing)}return remotePlugins?runtime.applyRemoteConfig(remotePlugins):runtime.applyRemoteConfigDefaults(),kernel}async function resolveRemotePlugins(opts,fetcher){let baked=readBakedPlugins();if(baked)return baked;let remoteConfig=await fetchRemoteConfig(resolveTargets(opts.apiHost).config,fetcher);return remoteConfig?.ingestUrl&&setIngestHost(remoteConfig.ingestUrl),remoteConfig?.plugins??null}async function wireOtel(kernel,targets,wrapperVersions,tracing){let{buildOtelProvider,captureWebVitals,createPageScopeRotator,installNavigationScope,PAGE_SCOPE_MAX_AGE_MS,readPropagationFromDocument,registerBundledInstrumentations,seedPageScope}=await import(`./otel/index.mjs`),releaseSlug=readReleaseSlugFromGlobals(),handle=buildOtelProvider(omitUndefined({clientOptions:targets.ingest,getDeviceId:()=>kernel.device.getDeviceId(),getSessionId:()=>kernel.session.getId(),isDeviceInfoEnabled:()=>kernel.isDeviceInfoCaptureEnabled(),releaseSlug,sdkStack:buildSdkStack(wrapperVersions),serviceName:tracing.serviceName||void 0,serviceNamespace:tracing.serviceNamespace,additionalSpanProcessors:tracing.additionalSpanProcessors,additionalLogRecordProcessors:tracing.additionalLogRecordProcessors,additionalMetricReaders:tracing.additionalMetricReaders})),scopeSpanInput=omitUndefined({tracer:handle.tracerProvider.getTracer(`@interfere/react/navigation`),resolveRoute:tracing.resolveRoute}),extracted=readPropagationFromDocument();handle.contextManager.setPageScope(extracted??seedPageScope(scopeSpanInput)),handle.contextManager.setRotation(createPageScopeRotator(scopeSpanInput),PAGE_SCOPE_MAX_AGE_MS);let disposeNavigationScope=installNavigationScope({...scopeSpanInput,setPageScope:ctx=>{handle.contextManager.setPageScope(ctx)}}),instrumentations=registerBundledInstrumentations(omitUndefined({tracerProvider:handle.tracerProvider,loggerProvider:handle.loggerProvider,ignoreUrls:[INGEST_IGNORE_RE,`${targets.config.baseUrl}/v3/config`,`${targets.ingest.baseUrl}/v3/session`,REPLAY_UPLOAD_RE],apiHosts:tracing.apiHosts,propagateContextUrls:tracing.propagateContextUrls,resolveRoute:tracing.resolveRoute,captureFailedRequests:tracing.captureFailedRequests}));tracing.webVitals!==!1&&captureWebVitals(omitUndefined({flush:async()=>handle.flush(),meter:handle.meterProvider.getMeter(`@interfere/react/web-vitals`),resolveRoute:tracing.resolveRoute})),kernel.attachOtel(handle,()=>{disposeNavigationScope(),instrumentations.dispose()},{setPageEventsEnabled:instrumentations.setPageEventsEnabled})}async function fetchRemoteConfig(configTarget,fetcher){try{let client=new InterfereClient({...configTarget,fetch:Object.assign(async(url,init)=>fetcher(url,{...init,credentials:`omit`}),fetcher)});return remoteConfigInputSchema.parse(await client.config.getSdkConfig())}catch{return log.warn(`remote config fetch failed, using local defaults`),null}}function isEnabledByEnvironment(){if(typeof process>`u`||process.env===void 0||process.env===null)return!0;let nodeEnv=process.env.NODE_ENV;return nodeEnv===`production`||nodeEnv===void 0||!!getGlobal(FORCE_ENABLE_GLOBAL)||!!process.env.INTERFERE_FORCE_ENABLE}function readReleaseSlugFromGlobals(){let value=getGlobal(RELEASE_SLUG_GLOBAL);return typeof value==`string`?releaseSlugSchema.parse(value):null}export{Kernel,buildSdkStack,createKernel,isEnabledByEnvironment,readReleaseSlugFromGlobals};
@@ -1 +1 @@
1
- import{t as PRODUCER_VERSION}from"../../version-XRSM9Pwm.mjs";import{IngestLogExporter}from"./exporter-logs.mjs";import{IngestMetricExporter}from"./exporter-metrics.mjs";import{toError}from"@interfere/types/sdk/errors";import{InterfereClient,InterfereError}from"@interfere/javascript";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;let ingestHalted=!1,consecutiveAuthRejections=0;function resetIngestHalt(){ingestHalted=!1,consecutiveAuthRejections=0}function isIngestHalted(){return ingestHalted}function detectUnacceptableExport(error){if(ingestHalted||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`){ingestHalted=!0,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;ingestHalted=!0,console.warn(`[interfere] the ingest endpoint rejected this page's public key ${consecutiveAuthRejections} times in a row — telemetry export is disabled for this page load. Check that INTERFERE_PUBLIC_KEY matches an active surface.`)}}}function makeSender(input,signal){let client=new InterfereClient({...input.clientOptions,maxRetries:0,fetch:Object.assign(async(url,init)=>globalThis.fetch(url,{...init,credentials:`omit`,keepalive:!0}),globalThis.fetch)});return((payload,resultCallback)=>{if(!payload||payload.byteLength===0){resultCallback({code:ExportResultCode.SUCCESS});return}if(ingestHalted){resultCallback({code:ExportResultCode.FAILED,error:Error(`ingest halted: the ingest endpoint rejected this build's release`)});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}this.send(JsonTraceSerializer.serializeRequest(spans),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{INGEST_IGNORE_RE,createLogExporter,createMetricExporter,createTraceExporter,isIngestHalted,resetIngestHalt};
1
+ import{t as PRODUCER_VERSION}from"../../version-CmerIGVk.mjs";import{IngestLogExporter}from"./exporter-logs.mjs";import{IngestMetricExporter}from"./exporter-metrics.mjs";import{toError}from"@interfere/types/sdk/errors";import{InterfereClient,InterfereError}from"@interfere/javascript";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;let ingestHalted=!1,consecutiveAuthRejections=0;function resetIngestHalt(){ingestHalted=!1,consecutiveAuthRejections=0}function isIngestHalted(){return ingestHalted}function detectUnacceptableExport(error){if(ingestHalted||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`){ingestHalted=!0,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;ingestHalted=!0,console.warn(`[interfere] the ingest endpoint rejected this page's public key ${consecutiveAuthRejections} times in a row — telemetry export is disabled for this page load. Check that INTERFERE_PUBLIC_KEY matches an active surface.`)}}}function makeSender(input,signal){let client=new InterfereClient({...input.clientOptions,maxRetries:0,fetch:Object.assign(async(url,init)=>globalThis.fetch(url,{...init,credentials:`omit`,keepalive:!0}),globalThis.fetch)});return((payload,resultCallback)=>{if(!payload||payload.byteLength===0){resultCallback({code:ExportResultCode.SUCCESS});return}if(ingestHalted){resultCallback({code:ExportResultCode.FAILED,error:Error(`ingest halted: the ingest endpoint rejected this build's release`)});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}this.send(JsonTraceSerializer.serializeRequest(spans),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{INGEST_IGNORE_RE,createLogExporter,createMetricExporter,createTraceExporter,isIngestHalted,resetIngestHalt};
@@ -1,7 +1,7 @@
1
1
  import { a as InstrumentationsInput, i as HttpStatusCodeRange, n as CaptureFailedRequestsOption, o as registerBundledInstrumentations, r as CaptureFailedRequestsOptions, t as BundledInstrumentations } from "../../instrumentations-Bgm2EazU.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-CF0h4Mah.mjs";
4
+ import { n as OtelProviderInput, r as buildOtelProvider, t as OtelProviderHandle } from "../../provider-Df5aXrYa.mjs";
5
5
  import { n as captureWebVitals } from "../../web-vitals-x8y70B5x.mjs";
6
- import "../../index-D-HGWlgi.mjs";
6
+ import "../../index-BVwotsYa.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,2 +1,2 @@
1
- import { n as OtelProviderInput, r as buildOtelProvider, t as OtelProviderHandle } from "../../provider-CF0h4Mah.mjs";
1
+ import { n as OtelProviderInput, r as buildOtelProvider, t as OtelProviderHandle } from "../../provider-Df5aXrYa.mjs";
2
2
  export { OtelProviderHandle, OtelProviderInput, buildOtelProvider };
@@ -1 +1 @@
1
- import{getStringGlobal}from"../../util/global.mjs";import{n as SDK_NAME,r as SDK_VERSION}from"../../version-XRSM9Pwm.mjs";import{createLogExporter,createMetricExporter,createTraceExporter}from"./exporter.mjs";import{PageScopeContextManager}from"./page-scope-context-manager.mjs";import{context,propagation}from"@opentelemetry/api";import{omitUndefined}from"@interfere/helpers/omit-undefined";import{ENVIRONMENT_GLOBAL}from"@interfere/types/sdk/injected-globals";import{CompositePropagator,W3CBaggagePropagator,W3CTraceContextPropagator}from"@opentelemetry/core";import{detectResources,resourceFromAttributes}from"@opentelemetry/resources";import{MeterProvider,PeriodicExportingMetricReader}from"@opentelemetry/sdk-metrics";import{resolveEnvironment}from"@interfere/types/sdk/runtime";import{browserDetector}from"@opentelemetry/opentelemetry-browser-detector";import{BatchLogRecordProcessor,LoggerProvider}from"@opentelemetry/sdk-logs";import{BatchSpanProcessor}from"@opentelemetry/sdk-trace-base";import{WebTracerProvider}from"@opentelemetry/sdk-trace-web";import{createSessionLogRecordProcessor,createSessionSpanProcessor}from"@opentelemetry/web-common";const ATTR_DEVICE_ID=`device.id`,BROWSER_BATCH_OPTIONS={exportTimeoutMillis:1e4,maxExportBatchSize:10,maxQueueSize:2048,scheduledDelayMillis:2e3};function createDeviceSpanProcessor(opts){return{forceFlush:async()=>Promise.resolve(),onEnd(){},onStart(span){let id=opts.getDeviceId();id&&span.setAttribute(ATTR_DEVICE_ID,id)},shutdown:async()=>Promise.resolve()}}function createDeviceLogRecordProcessor(opts){return{forceFlush:async()=>Promise.resolve(),onEmit(logRecord){let id=opts.getDeviceId();id&&logRecord.setAttribute(ATTR_DEVICE_ID,id)},shutdown:async()=>Promise.resolve()}}function stampGatedAttributes(target,opts){if(opts.isEnabled())for(let[key,value]of Object.entries(opts.attributes))value!==void 0&&target.setAttribute(key,value)}function createDeviceInfoSpanProcessor(opts){return{forceFlush:async()=>Promise.resolve(),onEnd(){},onStart:span=>{stampGatedAttributes(span,opts)},shutdown:async()=>Promise.resolve()}}function createDeviceInfoLogRecordProcessor(opts){return{forceFlush:async()=>Promise.resolve(),onEmit:logRecord=>{stampGatedAttributes(logRecord,opts)},shutdown:async()=>Promise.resolve()}}function buildOtelProvider(input){let environment=resolveEnvironment({explicit:getStringGlobal(ENVIRONMENT_GLOBAL),env:typeof process>`u`?{}:{INTERFERE_ENVIRONMENT:process.env.INTERFERE_ENVIRONMENT,NODE_ENV:process.env.NODE_ENV,VERCEL_ENV:process.env.VERCEL_ENV}}),resource=resourceFromAttributes(omitUndefined({"service.name":input.serviceName??`interfere-sdk`,"service.namespace":`interfere`,"deployment.environment.name":environment,"telemetry.sdk.language":`webjs`,"interfere.sdk.name":SDK_NAME,"interfere.sdk.version":SDK_VERSION,"interfere.sdk.stack":input.sdkStack.join(`, `),"release.slug":input.releaseSlug||void 0})),deviceInfoAttributes=detectResources({detectors:[browserDetector]}).attributes,isDeviceInfoEnabled=input.isDeviceInfoEnabled??(()=>!1),traceExporter=createTraceExporter({clientOptions:input.clientOptions}),{getSessionId}=input,{getDeviceId}=input,spanProcessors=[createSessionSpanProcessor({getSessionId}),createDeviceSpanProcessor({getDeviceId}),createDeviceInfoSpanProcessor({attributes:deviceInfoAttributes,isEnabled:isDeviceInfoEnabled}),new BatchSpanProcessor(traceExporter,BROWSER_BATCH_OPTIONS),...input.additionalSpanProcessors??[]],tracerProvider=new WebTracerProvider({resource,spanProcessors}),contextManager=new PageScopeContextManager;contextManager.enable(),context.setGlobalContextManager(contextManager)||contextManager.disable(),propagation.fields().length===0&&propagation.setGlobalPropagator(new CompositePropagator({propagators:[new W3CTraceContextPropagator,new W3CBaggagePropagator]}));let metricExporter=createMetricExporter({clientOptions:input.clientOptions},{attributes:deviceInfoAttributes,isEnabled:isDeviceInfoEnabled}),metricReader=new PeriodicExportingMetricReader({exportIntervalMillis:3e4,exporter:metricExporter}),meterProvider=new MeterProvider({readers:[metricReader,...input.additionalMetricReaders??[]],resource}),logExporter=createLogExporter({clientOptions:input.clientOptions}),loggerProvider=new LoggerProvider({processors:[createSessionLogRecordProcessor({getSessionId}),createDeviceLogRecordProcessor({getDeviceId}),createDeviceInfoLogRecordProcessor({attributes:deviceInfoAttributes,isEnabled:isDeviceInfoEnabled}),new BatchLogRecordProcessor({exporter:logExporter,...BROWSER_BATCH_OPTIONS}),...input.additionalLogRecordProcessors??[]],resource});return{contextManager,flush:async()=>{await Promise.allSettled([tracerProvider.forceFlush(),metricReader.forceFlush(),loggerProvider.forceFlush()])},loggerProvider,meterProvider,metricReader,shutdown:async()=>{await Promise.allSettled([tracerProvider.shutdown(),meterProvider.shutdown(),loggerProvider.shutdown()])},tracerProvider}}export{buildOtelProvider};
1
+ import{getStringGlobal}from"../../util/global.mjs";import{n as SDK_NAME,r as SDK_VERSION}from"../../version-CmerIGVk.mjs";import{createLogExporter,createMetricExporter,createTraceExporter}from"./exporter.mjs";import{PageScopeContextManager}from"./page-scope-context-manager.mjs";import{context,propagation}from"@opentelemetry/api";import{omitUndefined}from"@interfere/helpers/omit-undefined";import{ENVIRONMENT_GLOBAL}from"@interfere/types/sdk/injected-globals";import{CompositePropagator,W3CBaggagePropagator,W3CTraceContextPropagator}from"@opentelemetry/core";import{defaultServiceName,detectResources,resourceFromAttributes}from"@opentelemetry/resources";import{MeterProvider,PeriodicExportingMetricReader}from"@opentelemetry/sdk-metrics";import{resolveEnvironment}from"@interfere/types/sdk/runtime";import{browserDetector}from"@opentelemetry/opentelemetry-browser-detector";import{BatchLogRecordProcessor,LoggerProvider}from"@opentelemetry/sdk-logs";import{BatchSpanProcessor}from"@opentelemetry/sdk-trace-base";import{WebTracerProvider}from"@opentelemetry/sdk-trace-web";import{createSessionLogRecordProcessor,createSessionSpanProcessor}from"@opentelemetry/web-common";const ATTR_DEVICE_ID=`device.id`,BROWSER_BATCH_OPTIONS={exportTimeoutMillis:1e4,maxExportBatchSize:10,maxQueueSize:2048,scheduledDelayMillis:2e3};function createDeviceSpanProcessor(opts){return{forceFlush:async()=>Promise.resolve(),onEnd(){},onStart(span){let id=opts.getDeviceId();id&&span.setAttribute(ATTR_DEVICE_ID,id)},shutdown:async()=>Promise.resolve()}}function createDeviceLogRecordProcessor(opts){return{forceFlush:async()=>Promise.resolve(),onEmit(logRecord){let id=opts.getDeviceId();id&&logRecord.setAttribute(ATTR_DEVICE_ID,id)},shutdown:async()=>Promise.resolve()}}function stampGatedAttributes(target,opts){if(opts.isEnabled())for(let[key,value]of Object.entries(opts.attributes))value!==void 0&&target.setAttribute(key,value)}function createDeviceInfoSpanProcessor(opts){return{forceFlush:async()=>Promise.resolve(),onEnd(){},onStart:span=>{stampGatedAttributes(span,opts)},shutdown:async()=>Promise.resolve()}}function createDeviceInfoLogRecordProcessor(opts){return{forceFlush:async()=>Promise.resolve(),onEmit:logRecord=>{stampGatedAttributes(logRecord,opts)},shutdown:async()=>Promise.resolve()}}function buildOtelProvider(input){let environment=resolveEnvironment({explicit:getStringGlobal(ENVIRONMENT_GLOBAL),env:typeof process>`u`?{}:{INTERFERE_ENVIRONMENT:process.env.INTERFERE_ENVIRONMENT,NODE_ENV:process.env.NODE_ENV,VERCEL_ENV:process.env.VERCEL_ENV}}),resource=resourceFromAttributes(omitUndefined({"service.name":input.serviceName||defaultServiceName(),"service.namespace":input.serviceNamespace,"deployment.environment.name":environment,"telemetry.sdk.language":`webjs`,"interfere.sdk.name":SDK_NAME,"interfere.sdk.version":SDK_VERSION,"interfere.sdk.stack":input.sdkStack.join(`, `),"release.slug":input.releaseSlug||void 0})),deviceInfoAttributes=detectResources({detectors:[browserDetector]}).attributes,isDeviceInfoEnabled=input.isDeviceInfoEnabled??(()=>!1),traceExporter=createTraceExporter({clientOptions:input.clientOptions}),{getSessionId}=input,{getDeviceId}=input,spanProcessors=[createSessionSpanProcessor({getSessionId}),createDeviceSpanProcessor({getDeviceId}),createDeviceInfoSpanProcessor({attributes:deviceInfoAttributes,isEnabled:isDeviceInfoEnabled}),new BatchSpanProcessor(traceExporter,BROWSER_BATCH_OPTIONS),...input.additionalSpanProcessors??[]],tracerProvider=new WebTracerProvider({resource,spanProcessors}),contextManager=new PageScopeContextManager;contextManager.enable(),context.setGlobalContextManager(contextManager)||contextManager.disable(),propagation.fields().length===0&&propagation.setGlobalPropagator(new CompositePropagator({propagators:[new W3CTraceContextPropagator,new W3CBaggagePropagator]}));let metricExporter=createMetricExporter({clientOptions:input.clientOptions},{attributes:deviceInfoAttributes,isEnabled:isDeviceInfoEnabled}),metricReader=new PeriodicExportingMetricReader({exportIntervalMillis:3e4,exporter:metricExporter}),meterProvider=new MeterProvider({readers:[metricReader,...input.additionalMetricReaders??[]],resource}),logExporter=createLogExporter({clientOptions:input.clientOptions}),loggerProvider=new LoggerProvider({processors:[createSessionLogRecordProcessor({getSessionId}),createDeviceLogRecordProcessor({getDeviceId}),createDeviceInfoLogRecordProcessor({attributes:deviceInfoAttributes,isEnabled:isDeviceInfoEnabled}),new BatchLogRecordProcessor({exporter:logExporter,...BROWSER_BATCH_OPTIONS}),...input.additionalLogRecordProcessors??[]],resource});return{contextManager,flush:async()=>{await Promise.allSettled([tracerProvider.forceFlush(),metricReader.forceFlush(),loggerProvider.forceFlush()])},loggerProvider,meterProvider,metricReader,shutdown:async()=>{await Promise.allSettled([tracerProvider.shutdown(),meterProvider.shutdown(),loggerProvider.shutdown()])},tracerProvider}}export{buildOtelProvider};
@@ -1,2 +1,2 @@
1
- import { b as PluginRuntime } from "../provider-DRuvRafW.mjs";
1
+ import { b as PluginRuntime } from "../provider-B2L5znqI.mjs";
2
2
  export { PluginRuntime };
@@ -1 +1 @@
1
- import{createLogger}from"../util/log.mjs";import devicePlugin from"../plugins/device.mjs";import errorsPlugin from"../plugins/errors.mjs";import{getPluginConsentCategory,hasConsentChanged,isConsentAllowed,resolveGrantedConsent}from"./consent.mjs";import{loadPlugin,resolveFeatures}from"../plugins/lib/loader.mjs";import{PLUGIN_MANIFEST}from"@interfere/types/sdk/plugins/manifest";const log=createLogger(`plugin-runtime`);var PluginRuntime=class{activeCleanups=new Map;pending=new Set;features=resolveFeatures();pluginConfigListeners=new Map;remoteConfig={};remoteConfigSettled=!1;consentState=null;configSettled=!1;replayConfig={};syncVersion=0;disposed=!1;context;hasInitialConsent;constructor(context,consent,remoteConfig={}){this.context=context,this.hasInitialConsent=consent!==void 0,this.consentState=consent===void 0?null:resolveGrantedConsent(consent),this.configSettled=this.hasInitialConsent,this.remoteConfig=remoteConfig}getConsent(){return this.consentState}getReplayConfig(){return this.replayConfig}applyProviderConfig(overrides,consent){let replay=overrides?.replay;this.features=resolveFeatures(overrides),this.replayConfig=typeof replay==`object`?replay:{},consent===void 0?this.hasInitialConsent||(this.consentState=null):this.consentState=resolveGrantedConsent(consent),this.configSettled=!0,this.sync()}setConsent(nextConsent){let nextState=resolveGrantedConsent(nextConsent);(!this.configSettled||hasConsentChanged(this.consentState,nextState))&&(this.consentState=nextState,this.configSettled=!0,this.sync())}resetConsent(){(!this.configSettled||hasConsentChanged(this.consentState,null))&&(this.consentState=null,this.configSettled=!0,this.sync())}applyRemoteConfig(config){this.remoteConfig=config,this.remoteConfigSettled=!0,this.emitPluginConfigState(),this.sync()}applyRemoteConfigDefaults(){this.remoteConfigSettled=!0,this.emitPluginConfigState(),this.sync()}start(){for(let[key,plugin]of[[`errors`,errorsPlugin],[`device`,devicePlugin]])if(this.shouldEnablePlugin(key)){let cleanup=plugin.setup(this.context);cleanup&&this.activeCleanups.set(key,cleanup)}this.sync()}async dispose(){this.disposed=!0,this.syncVersion+=1;for(let key of this.activeCleanups.keys())this.deactivate(key,`dispose`);await Promise.allSettled(this.pending)}shouldEnablePlugin(key){let category=getPluginConsentCategory(key);return category!==`necessary`&&!this.configSettled?!1:this.features[key]&&this.remoteConfig[key]!==!1&&isConsentAllowed(category,this.consentState)}getPluginConfigState(key){return this.remoteConfigSettled?this.remoteConfig[key]===!1?`disabled`:`enabled`:`pending`}subscribePluginConfigState(key,listener){let listeners=this.pluginConfigListeners.get(key)??new Set;return listeners.add(listener),this.pluginConfigListeners.set(key,listeners),(()=>{listeners.delete(listener),listeners.size===0&&this.pluginConfigListeners.delete(key)})}emitPluginConfigState(){for(let[key,listeners]of this.pluginConfigListeners){let state=this.getPluginConfigState(key);for(let listener of listeners)listener(state)}}teardownReason(key){let category=getPluginConsentCategory(key);return isConsentAllowed(category,this.consentState)?`disabled`:`consent-revoked`}deactivate(key,reason){let cleanup=this.activeCleanups.get(key);if(cleanup){try{cleanup(reason)}catch{log.warn(`cleanup failed for %s`,key)}this.activeCleanups.delete(key)}}async activate(key){if(this.activeCleanups.has(key)||!this.shouldEnablePlugin(key))return;let version=this.syncVersion,cleanup=await loadPlugin(key,this.context);if(cleanup){if(version!==this.syncVersion||!this.shouldEnablePlugin(key)){cleanup(this.teardownReason(key));return}this.activeCleanups.set(key,cleanup)}}sync(){if(!this.disposed){this.syncVersion+=1;for(let plugin of PLUGIN_MANIFEST){if(this.shouldEnablePlugin(plugin.name)){if(plugin.name===`errors`){if(!this.activeCleanups.has(`errors`)){let cleanup=errorsPlugin.setup(this.context);cleanup&&this.activeCleanups.set(`errors`,cleanup)}continue}let p=(async()=>{try{await this.activate(plugin.name)}catch{log.warn(`non-critical plugin loading failed`)}})();this.pending.add(p),(async()=>{await p,this.pending.delete(p)})();continue}this.deactivate(plugin.name,this.teardownReason(plugin.name))}}}};export{PluginRuntime};
1
+ import{createLogger}from"../util/log.mjs";import{getPluginConsentCategory,hasConsentChanged,isConsentAllowed,resolveGrantedConsent}from"./consent.mjs";import devicePlugin from"../plugins/device.mjs";import errorsPlugin from"../plugins/errors.mjs";import{loadPlugin,resolveFeatures}from"../plugins/lib/loader.mjs";import{PLUGIN_MANIFEST}from"@interfere/types/sdk/plugins/manifest";const log=createLogger(`plugin-runtime`);var PluginRuntime=class{activeCleanups=new Map;pending=new Set;features=resolveFeatures();pluginConfigListeners=new Map;remoteConfig={};remoteConfigSettled=!1;consentState=null;configSettled=!1;replayConfig={};syncVersion=0;disposed=!1;context;hasInitialConsent;constructor(context,consent,remoteConfig={}){this.context=context,this.hasInitialConsent=consent!==void 0,this.consentState=consent===void 0?null:resolveGrantedConsent(consent),this.configSettled=this.hasInitialConsent,this.remoteConfig=remoteConfig}getConsent(){return this.consentState}getReplayConfig(){return this.replayConfig}applyProviderConfig(overrides,consent){let replay=overrides?.replay;this.features=resolveFeatures(overrides),this.replayConfig=typeof replay==`object`?replay:{},consent===void 0?this.hasInitialConsent||(this.consentState=null):this.consentState=resolveGrantedConsent(consent),this.configSettled=!0,this.sync()}setConsent(nextConsent){let nextState=resolveGrantedConsent(nextConsent);(!this.configSettled||hasConsentChanged(this.consentState,nextState))&&(this.consentState=nextState,this.configSettled=!0,this.sync())}resetConsent(){(!this.configSettled||hasConsentChanged(this.consentState,null))&&(this.consentState=null,this.configSettled=!0,this.sync())}applyRemoteConfig(config){this.remoteConfig=config,this.remoteConfigSettled=!0,this.emitPluginConfigState(),this.sync()}applyRemoteConfigDefaults(){this.remoteConfigSettled=!0,this.emitPluginConfigState(),this.sync()}start(){for(let[key,plugin]of[[`errors`,errorsPlugin],[`device`,devicePlugin]])if(this.shouldEnablePlugin(key)){let cleanup=plugin.setup(this.context);cleanup&&this.activeCleanups.set(key,cleanup)}this.sync()}async dispose(){this.disposed=!0,this.syncVersion+=1;for(let key of this.activeCleanups.keys())this.deactivate(key,`dispose`);await Promise.allSettled(this.pending)}shouldEnablePlugin(key){let category=getPluginConsentCategory(key);return category!==`necessary`&&!this.configSettled?!1:this.features[key]&&this.remoteConfig[key]!==!1&&isConsentAllowed(category,this.consentState)}getPluginConfigState(key){return this.remoteConfigSettled?this.remoteConfig[key]===!1?`disabled`:`enabled`:`pending`}subscribePluginConfigState(key,listener){let listeners=this.pluginConfigListeners.get(key)??new Set;return listeners.add(listener),this.pluginConfigListeners.set(key,listeners),(()=>{listeners.delete(listener),listeners.size===0&&this.pluginConfigListeners.delete(key)})}emitPluginConfigState(){for(let[key,listeners]of this.pluginConfigListeners){let state=this.getPluginConfigState(key);for(let listener of listeners)listener(state)}}teardownReason(key){let category=getPluginConsentCategory(key);return isConsentAllowed(category,this.consentState)?`disabled`:`consent-revoked`}deactivate(key,reason){let cleanup=this.activeCleanups.get(key);if(cleanup){try{cleanup(reason)}catch{log.warn(`cleanup failed for %s`,key)}this.activeCleanups.delete(key)}}async activate(key){if(this.activeCleanups.has(key)||!this.shouldEnablePlugin(key))return;let version=this.syncVersion,cleanup=await loadPlugin(key,this.context);if(cleanup){if(version!==this.syncVersion||!this.shouldEnablePlugin(key)){cleanup(this.teardownReason(key));return}this.activeCleanups.set(key,cleanup)}}sync(){if(!this.disposed){this.syncVersion+=1;for(let plugin of PLUGIN_MANIFEST){if(this.shouldEnablePlugin(plugin.name)){if(plugin.name===`errors`){if(!this.activeCleanups.has(`errors`)){let cleanup=errorsPlugin.setup(this.context);cleanup&&this.activeCleanups.set(`errors`,cleanup)}continue}let p=(async()=>{try{await this.activate(plugin.name)}catch{log.warn(`non-critical plugin loading failed`)}})();this.pending.add(p),(async()=>{await p,this.pending.delete(p)})();continue}this.deactivate(plugin.name,this.teardownReason(plugin.name))}}}};export{PluginRuntime};
@@ -1,2 +1,2 @@
1
- import { a as InterfereContextValue, i as InterfereContext, o as NULL_CONTEXT_VALUE } from "../provider-DRuvRafW.mjs";
1
+ import { a as InterfereContextValue, i as InterfereContext, o as NULL_CONTEXT_VALUE } from "../provider-B2L5znqI.mjs";
2
2
  export { InterfereContext, InterfereContextValue, NULL_CONTEXT_VALUE };
@@ -1 +1 @@
1
- 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/`)),queue=new Queue(options.queueName??`interfere-ingest`,{maxRetentionTime:1440,onSync:async({queue:q})=>{let entry=await q.shiftRequest();for(;entry;){try{let res=await self.fetch(entry.request.clone());if(!res.ok&&(res.status>=500||res.status===429))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()}}});self.addEventListener(`activate`,event=>{event.waitUntil(queue.replayRequests().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:res.status>=500||res.status===429?(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{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&&(res.status>=500||res.status===429))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:res.status>=500||res.status===429?(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 +1 @@
1
- import{n as SDK_NAME,r as SDK_VERSION,t as PRODUCER_VERSION}from"../version-XRSM9Pwm.mjs";export{PRODUCER_VERSION,SDK_NAME,SDK_VERSION};
1
+ import{n as SDK_NAME,r as SDK_VERSION,t as PRODUCER_VERSION}from"../version-CmerIGVk.mjs";export{PRODUCER_VERSION,SDK_NAME,SDK_VERSION};
@@ -1,12 +1,12 @@
1
- import { f as KernelOptions, s as Kernel } from "../provider-DRuvRafW.mjs";
2
- import { ConsentState } from "@interfere/types/sdk/plugins/manifest";
1
+ import { f as KernelOptions, s as Kernel } from "../provider-B2L5znqI.mjs";
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
5
5
  export interface WrapperSingleton {
6
6
  close: () => Promise<void>;
7
7
  consent: {
8
8
  get: () => ConsentState | null;
9
- set: (value?: ConsentState) => void;
9
+ set: (value?: ConsentInput) => void;
10
10
  };
11
11
  getKernel: () => Kernel;
12
12
  getKernelOrNull: () => Kernel | null;
@@ -1 +1 @@
1
- import{registerKernel,unregisterKernel}from"./kernel-registry.mjs";import{isBotUserAgent}from"../util/bot.mjs";import{isForceEnableActive}from"./config.mjs";import{createKernel,isEnabledByEnvironment}from"./kernel.mjs";function createWrapperSingleton(input){let kernel=null,pending=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),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?.consent.set(value)},getKernel(){if(!kernel)throw Error(`Interfere SDK not initialized. Call init() from your ${input.initEntryName} entrypoint.`);return kernel},getKernelOrNull(){return kernel},identity:{clear:()=>kernel?.identity.clear(),get:()=>kernel?.identity.get()??null,set:async params=>kernel?.identity.set(params)??Promise.resolve()},async init(opts={}){return kernel||pending||(!(opts.enabled??isEnabledByEnvironment())||!isForceEnableActive()&&isBotUserAgent()?null:(pending=initKernel({...opts,_wrapperVersions:[input.producerVersion]}),pending))},subscribeToKernel(listener){return listeners.add(listener),(()=>{listeners.delete(listener)})}}}export{createWrapperSingleton};
1
+ import{registerKernel,unregisterKernel}from"./kernel-registry.mjs";import{isForceEnableActive}from"./config.mjs";import{createKernel,isEnabledByEnvironment}from"./kernel.mjs";import{isBotUserAgent}from"../util/bot.mjs";function createWrapperSingleton(input){let kernel=null,pending=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),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?.consent.set(value)},getKernel(){if(!kernel)throw Error(`Interfere SDK not initialized. Call init() from your ${input.initEntryName} entrypoint.`);return kernel},getKernelOrNull(){return kernel},identity:{clear:()=>kernel?.identity.clear(),get:()=>kernel?.identity.get()??null,set:async params=>kernel?.identity.set(params)??Promise.resolve()},async init(opts={}){return kernel||pending||(!(opts.enabled??isEnabledByEnvironment())||!isForceEnableActive()&&isBotUserAgent()?null:(pending=initKernel({...opts,_wrapperVersions:[input.producerVersion]}),pending))},subscribeToKernel(listener){return listeners.add(listener),(()=>{listeners.delete(listener)})}}}export{createWrapperSingleton};
@@ -1,4 +1,4 @@
1
- import { T as Plugin } from "../provider-DRuvRafW.mjs";
1
+ import { T as Plugin } from "../provider-B2L5znqI.mjs";
2
2
  //#region src/plugins/device.d.ts
3
3
  declare const devicePlugin: Plugin;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { T as Plugin } from "../provider-DRuvRafW.mjs";
1
+ import { T as Plugin } from "../provider-B2L5znqI.mjs";
2
2
  //#region src/plugins/errors.d.ts
3
3
  declare const errorsPlugin: Plugin;
4
4
  //#endregion
@@ -1,2 +1,2 @@
1
- import { C as loadPlugin, S as PluginOverrides, w as resolveFeatures, x as LOADERS } from "../../provider-DRuvRafW.mjs";
1
+ import { C as loadPlugin, S as PluginOverrides, w as resolveFeatures, x as LOADERS } from "../../provider-B2L5znqI.mjs";
2
2
  export { LOADERS, PluginOverrides, loadPlugin, resolveFeatures };
@@ -1,2 +1,2 @@
1
- import { D as PluginConfigState, E as PluginCleanup, O as PluginContext, T as Plugin, k as PluginTeardownReason } from "../../provider-DRuvRafW.mjs";
1
+ import { D as PluginConfigState, E as PluginCleanup, O as PluginContext, T as Plugin, k as PluginTeardownReason } from "../../provider-B2L5znqI.mjs";
2
2
  export { Plugin, PluginCleanup, PluginConfigState, PluginContext, PluginTeardownReason };
@@ -1,4 +1,4 @@
1
- import { T as Plugin } from "../provider-DRuvRafW.mjs";
1
+ import { T as Plugin } from "../provider-B2L5znqI.mjs";
2
2
  //#region src/plugins/logs.d.ts
3
3
  /**
4
4
  * Subscribes to the central console patch so string-only console calls
@@ -1 +1 @@
1
- import{activeKernel}from"../internal/kernel-registry.mjs";import{safeStringify}from"../util/stringify.mjs";import{onConsoleCall}from"../internal/console-patch.mjs";import{SeverityNumber}from"@opentelemetry/api-logs";const LEVEL_TO_SEVERITY={debug:{number:SeverityNumber.DEBUG,text:`DEBUG`},error:{number:SeverityNumber.ERROR,text:`ERROR`},info:{number:SeverityNumber.INFO,text:`INFO`},log:{number:SeverityNumber.INFO,text:`INFO`},warn:{number:SeverityNumber.WARN,text:`WARN`}},logsPlugin={name:`logs`,setup(){return onConsoleCall((level,args)=>{if(args.some(a=>a instanceof Error))return;let kernel=activeKernel();if(!kernel)return;let sev=LEVEL_TO_SEVERITY[level];kernel.recordLog({attributes:{"console.level":level},body:args.length===1?safeStringify(args[0]):args.map(element=>safeStringify(element)).join(` `),severityNumber:sev.number,severityText:sev.text})})}};export{logsPlugin as default};
1
+ import{activeKernel}from"../internal/kernel-registry.mjs";import{onConsoleCall}from"../internal/console-patch.mjs";import{safeStringify}from"../util/stringify.mjs";import{SeverityNumber}from"@opentelemetry/api-logs";const LEVEL_TO_SEVERITY={debug:{number:SeverityNumber.DEBUG,text:`DEBUG`},error:{number:SeverityNumber.ERROR,text:`ERROR`},info:{number:SeverityNumber.INFO,text:`INFO`},log:{number:SeverityNumber.INFO,text:`INFO`},warn:{number:SeverityNumber.WARN,text:`WARN`}},logsPlugin={name:`logs`,setup(){return onConsoleCall((level,args)=>{if(args.some(a=>a instanceof Error))return;let kernel=activeKernel();if(!kernel)return;let sev=LEVEL_TO_SEVERITY[level];kernel.recordLog({attributes:{"console.level":level},body:args.length===1?safeStringify(args[0]):args.map(element=>safeStringify(element)).join(` `),severityNumber:sev.number,severityText:sev.text})})}};export{logsPlugin as default};
@@ -1,4 +1,4 @@
1
- import { T as Plugin } from "../provider-DRuvRafW.mjs";
1
+ import { T as Plugin } from "../provider-B2L5znqI.mjs";
2
2
  //#region src/plugins/page-events.d.ts
3
3
  declare const pageEventsPlugin: Plugin;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { T as Plugin } from "../provider-DRuvRafW.mjs";
1
+ import { T as Plugin } from "../provider-B2L5znqI.mjs";
2
2
  //#region src/plugins/rage-clicks.d.ts
3
3
  declare const rageClicksPlugin: Plugin;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { O as PluginContext } from "../../provider-DRuvRafW.mjs";
1
+ import { O as PluginContext } from "../../provider-B2L5znqI.mjs";
2
2
  import { resolveTargets } from "../../internal/config.mjs";
3
3
  import { ReplayChunkPayload } from "./chunking.mjs";
4
4
  import { Compressor } from "./compressor-host.mjs";
@@ -1,4 +1,4 @@
1
- import { T as Plugin } from "../../provider-DRuvRafW.mjs";
1
+ import { T as Plugin } from "../../provider-B2L5znqI.mjs";
2
2
  //#region src/plugins/replay/index.d.ts
3
3
  declare const replayPlugin: Plugin;
4
4
  //#endregion
@@ -1,15 +1,15 @@
1
1
  import { c as SessionResumeReason } from "./activity-BfYxFVcK.mjs";
2
2
  import { a as ReplayOption, i as ReplayConfig } from "./config-Rm-ct4K1.mjs";
3
- import { t as SessionTracker } from "./api-wpS4xoMY.mjs";
3
+ import { t as SessionTracker } from "./api-DEVCOKkJ.mjs";
4
4
  import { n as CaptureFailedRequestsOption, t as BundledInstrumentations } from "./instrumentations-Bgm2EazU.mjs";
5
- import { t as OtelProviderHandle } from "./provider-CF0h4Mah.mjs";
6
- import "./index-D-HGWlgi.mjs";
5
+ import { t as OtelProviderHandle } from "./provider-Df5aXrYa.mjs";
6
+ import "./index-BVwotsYa.mjs";
7
7
  import { NonErrorException } from "@interfere/types/sdk/errors";
8
8
  import { Tracer } from "@opentelemetry/api";
9
9
  import { PropsWithChildren } from "react";
10
- import { SessionId } from "@interfere/types/data/session";
11
- import { ConsentState, PluginKey } from "@interfere/types/sdk/plugins/manifest";
10
+ import { ConsentInput, ConsentState, PluginKey } from "@interfere/types/sdk/plugins/manifest";
12
11
  import { RemotePluginConfig } from "@interfere/types/sdk/remote-config";
12
+ import { SessionId } from "@interfere/types/data/session";
13
13
  import { MetricReader } from "@opentelemetry/sdk-metrics";
14
14
  import { LogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
15
15
  import { SpanProcessor } from "@opentelemetry/sdk-trace-base";
@@ -71,11 +71,11 @@ declare class PluginRuntime {
71
71
  private disposed;
72
72
  private readonly context;
73
73
  private readonly hasInitialConsent;
74
- constructor(context: PluginContext, consent?: ConsentState, remoteConfig?: RemotePluginConfig);
74
+ constructor(context: PluginContext, consent?: ConsentInput, remoteConfig?: RemotePluginConfig);
75
75
  getConsent(): ConsentState | null;
76
76
  getReplayConfig(): ReplayConfig;
77
- applyProviderConfig(overrides: PluginOverrides | undefined, consent: ConsentState | undefined): void;
78
- setConsent(nextConsent?: ConsentState): void;
77
+ applyProviderConfig(overrides: PluginOverrides | undefined, consent: ConsentInput | undefined): void;
78
+ setConsent(nextConsent?: ConsentInput): void;
79
79
  resetConsent(): void;
80
80
  applyRemoteConfig(config: RemotePluginConfig): void;
81
81
  applyRemoteConfigDefaults(): void;
@@ -94,8 +94,12 @@ declare class PluginRuntime {
94
94
  //#region src/internal/kernel.d.ts
95
95
  declare function buildSdkStack(wrapperVersions?: string[]): string[];
96
96
  interface KernelOptions {
97
- /** Saved consent applied before device identity and tracing start. */
98
- consent?: ConsentState | undefined;
97
+ /**
98
+ * Current analytics/replay permission, applied at startup. Omit to keep defaults.
99
+ * Booleans set both categories; objects replace the decision with omitted categories allowed.
100
+ * This does not disable errors, logs, tracing, or session storage.
101
+ */
102
+ consent?: ConsentInput | undefined;
99
103
  /**
100
104
  * The endpoint the SDK posts telemetry to. Defaults to Interfere's
101
105
  * endpoint. Set it to a subdomain of your own site that resolves to
@@ -115,12 +119,14 @@ interface KernelOptions {
115
119
  fetch?: typeof globalThis.fetch;
116
120
  /**
117
121
  * Override the OTel `service.name` resource attribute. Defaults to
118
- * `"interfere-sdk"`. Customers running multiple frontends in one
122
+ * `"unknown_service"`. Customers running multiple frontends in one
119
123
  * monitoring backend (e.g. `"@interfere/website"` vs
120
124
  * `"@interfere/app"`) set this so spans/metrics/logs slice
121
125
  * cleanly by surface.
122
126
  */
123
127
  serviceName?: string;
128
+ /** Optional application namespace for grouping related services. */
129
+ serviceNamespace?: string;
124
130
  /**
125
131
  * `false` skips the OTel module entirely — the bundler code-splits
126
132
  * `internal/otel/*` out of this path so the error-only bundle never
@@ -204,7 +210,8 @@ interface KernelInternalOptions extends KernelOptions {
204
210
  }
205
211
  interface KernelConsent {
206
212
  get: () => ConsentState | null;
207
- set: (value?: ConsentState) => void;
213
+ /** Replace the current analytics/replay decision. Omit to remove consent gating. */
214
+ set: (value?: ConsentInput) => void;
208
215
  }
209
216
  interface KernelIdentity {
210
217
  clear: () => void;
@@ -349,7 +356,7 @@ declare class Kernel implements PluginContext {
349
356
  */
350
357
  attachOtel(handle: OtelProviderHandle, dispose: () => void, controls?: Pick<BundledInstrumentations, "setPageEventsEnabled">): void;
351
358
  syncProviderConfig(config: {
352
- consent?: ConsentState | undefined;
359
+ consent?: ConsentInput | undefined;
353
360
  plugins?: PluginOverrides | undefined;
354
361
  }): void;
355
362
  dispose(): Promise<void>;
@@ -376,7 +383,7 @@ declare function readReleaseSlugFromGlobals(): (`rel_${string}` & import("zod").
376
383
  interface InterfereContextValue {
377
384
  consent: {
378
385
  get: () => ConsentState | null;
379
- set: (state?: ConsentState) => void;
386
+ set: (state?: ConsentInput) => void;
380
387
  };
381
388
  device: {
382
389
  getDeviceId: () => string | null;
@@ -415,11 +422,12 @@ declare const InterfereContext: import("react").Context<InterfereContextValue |
415
422
  //#region src/provider.d.ts
416
423
  interface InterfereProviderProps extends PropsWithChildren {
417
424
  /**
418
- * Consent state gating which plugin categories may run. Omit (or pass
425
+ * Current permission for analytics and replay. Use true or false
426
+ * for both categories, or booleans per category; omitted categories are allowed. Omit (or pass
419
427
  * `undefined`) to preserve consent supplied to `init()`. Without initial
420
428
  * consent, omitting this prop leaves every category allowed.
421
429
  */
422
- consent?: ConsentState | undefined;
430
+ consent?: ConsentInput | undefined;
423
431
  /**
424
432
  * Auto-install an internal capture boundary around `children` so
425
433
  * render-phase React errors are reported even when the host app has no
@@ -1,7 +1,7 @@
1
1
  import { t as PageScopeContextManager } from "./page-scope-context-manager-r92ZMJok.mjs";
2
2
  import { InterfereClient } from "@interfere/javascript";
3
- import { SessionId } from "@interfere/types/data/session";
4
3
  import { ReleaseSlug } from "@interfere/types/releases/slug";
4
+ import { SessionId } from "@interfere/types/data/session";
5
5
  import { MeterProvider, MetricReader, PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
6
6
  import { LogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
7
7
  import { SpanProcessor } from "@opentelemetry/sdk-trace-base";
@@ -57,9 +57,11 @@ interface OtelProviderInput {
57
57
  sdkStack: string[];
58
58
  /**
59
59
  * Override the OTel `service.name` resource attribute. Defaults to
60
- * `"interfere-sdk"`.
60
+ * `"unknown_service"`.
61
61
  */
62
62
  serviceName?: string;
63
+ /** Optional application namespace for grouping related services. */
64
+ serviceNamespace?: string;
63
65
  }
64
66
  interface OtelProviderHandle {
65
67
  /**
@@ -1,3 +1,3 @@
1
1
  import { a as ReplayOption, i as ReplayConfig } from "./config-Rm-ct4K1.mjs";
2
- import { S as PluginOverrides, a as InterfereContextValue, i as InterfereContext, n as useInterfere, r as useSession, t as InterfereProvider } from "./provider-DRuvRafW.mjs";
2
+ import { S as PluginOverrides, a as InterfereContextValue, i as InterfereContext, n as useInterfere, r as useSession, t as InterfereProvider } from "./provider-B2L5znqI.mjs";
3
3
  export { InterfereContext, type InterfereContextValue, InterfereProvider, type PluginOverrides, type ReplayConfig, type ReplayOption, useInterfere, useSession };