@launchdarkly/browser-telemetry 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -590,6 +590,13 @@ interface LDClientLogging {
|
|
|
590
590
|
readonly logger: MinLogger;
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
+
/**
|
|
594
|
+
* Minimal client interface which allows waiting for initialization.
|
|
595
|
+
*/
|
|
596
|
+
interface LDClientInitialization {
|
|
597
|
+
waitForInitialization(timeout?: number): Promise<void>;
|
|
598
|
+
}
|
|
599
|
+
|
|
593
600
|
/**
|
|
594
601
|
* Initialize the LaunchDarkly telemetry client
|
|
595
602
|
*
|
|
@@ -736,4 +743,4 @@ declare function close(): void;
|
|
|
736
743
|
*/
|
|
737
744
|
declare function initTelemetryInstance(options?: Options): BrowserTelemetry;
|
|
738
745
|
|
|
739
|
-
export { type Breadcrumb, type BreadcrumbClass, type BreadcrumbData, type BreadcrumbDataValue, type BreadcrumbFilter, type BreadcrumbLevel, type BrowserTelemetry, type BrowserTelemetryInspector, type Collector, type CustomBreadcrumb, type ErrorData, type ErrorDataFilter, type FeatureManagementBreadcrumb, type HttpBreadcrumb, type HttpBreadcrumbOptions, type ImplementsCrumb, type LDClientLogging, type LDClientTracking, type LogBreadcrumb, type MinLogger, type NavigationBreadcrumb, type Options, type Recorder, type StackFrame, type StackOptions, type StackTrace, type UiBreadcrumb, type UrlFilter, addBreadcrumb, captureError, captureErrorEvent, close, getTelemetryInstance, initTelemetry, initTelemetryInstance, inspectors, register };
|
|
746
|
+
export { type Breadcrumb, type BreadcrumbClass, type BreadcrumbData, type BreadcrumbDataValue, type BreadcrumbFilter, type BreadcrumbLevel, type BrowserTelemetry, type BrowserTelemetryInspector, type Collector, type CustomBreadcrumb, type ErrorData, type ErrorDataFilter, type FeatureManagementBreadcrumb, type HttpBreadcrumb, type HttpBreadcrumbOptions, type ImplementsCrumb, type LDClientInitialization, type LDClientLogging, type LDClientTracking, type LogBreadcrumb, type MinLogger, type NavigationBreadcrumb, type Options, type Recorder, type StackFrame, type StackOptions, type StackTrace, type UiBreadcrumb, type UrlFilter, addBreadcrumb, captureError, captureErrorEvent, close, getTelemetryInstance, initTelemetry, initTelemetryInstance, inspectors, register };
|
package/dist/index.d.ts
CHANGED
|
@@ -590,6 +590,13 @@ interface LDClientLogging {
|
|
|
590
590
|
readonly logger: MinLogger;
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
+
/**
|
|
594
|
+
* Minimal client interface which allows waiting for initialization.
|
|
595
|
+
*/
|
|
596
|
+
interface LDClientInitialization {
|
|
597
|
+
waitForInitialization(timeout?: number): Promise<void>;
|
|
598
|
+
}
|
|
599
|
+
|
|
593
600
|
/**
|
|
594
601
|
* Initialize the LaunchDarkly telemetry client
|
|
595
602
|
*
|
|
@@ -736,4 +743,4 @@ declare function close(): void;
|
|
|
736
743
|
*/
|
|
737
744
|
declare function initTelemetryInstance(options?: Options): BrowserTelemetry;
|
|
738
745
|
|
|
739
|
-
export { type Breadcrumb, type BreadcrumbClass, type BreadcrumbData, type BreadcrumbDataValue, type BreadcrumbFilter, type BreadcrumbLevel, type BrowserTelemetry, type BrowserTelemetryInspector, type Collector, type CustomBreadcrumb, type ErrorData, type ErrorDataFilter, type FeatureManagementBreadcrumb, type HttpBreadcrumb, type HttpBreadcrumbOptions, type ImplementsCrumb, type LDClientLogging, type LDClientTracking, type LogBreadcrumb, type MinLogger, type NavigationBreadcrumb, type Options, type Recorder, type StackFrame, type StackOptions, type StackTrace, type UiBreadcrumb, type UrlFilter, addBreadcrumb, captureError, captureErrorEvent, close, getTelemetryInstance, initTelemetry, initTelemetryInstance, inspectors, register };
|
|
746
|
+
export { type Breadcrumb, type BreadcrumbClass, type BreadcrumbData, type BreadcrumbDataValue, type BreadcrumbFilter, type BreadcrumbLevel, type BrowserTelemetry, type BrowserTelemetryInspector, type Collector, type CustomBreadcrumb, type ErrorData, type ErrorDataFilter, type FeatureManagementBreadcrumb, type HttpBreadcrumb, type HttpBreadcrumbOptions, type ImplementsCrumb, type LDClientInitialization, type LDClientLogging, type LDClientTracking, type LogBreadcrumb, type MinLogger, type NavigationBreadcrumb, type Options, type Recorder, type StackFrame, type StackOptions, type StackTrace, type UiBreadcrumb, type UrlFilter, addBreadcrumb, captureError, captureErrorEvent, close, getTelemetryInstance, initTelemetry, initTelemetryInstance, inspectors, register };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function
|
|
2
|
-
`):[]}return R[o]}function I(o,c){typeof c!="number"&&(c=Number(c));let l=/function ([^(]*)\(([^)]*)\)/,d=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,u="",b=10,g=D(o),
|
|
1
|
+
function $(e){try{return e.target}catch(t){return}}var Oe=">",Ce=` ${Oe} `;function Be(e){let t=e;return typeof t=="object"&&t!=null&&t.parentNode}function De(e){if(typeof e.className!="string")return;let t=e.className;if(e.className.includes(" ")&&(t=e.className.replace(" ",".")),t!=="")return`.${t}`}function Ie(e){if(!e.tagName)return"";let t=[];t.push(e.tagName.toLowerCase()),e.id&&t.push(`#${e.id}`);let r=De(e);return r&&t.push(r),t.join("")}function H(e,t={maxDepth:10}){let r=[],n=e;for(;Be(n)&&n.parentNode&&r.length<t.maxDepth;){let i=Ie(n);if(i==="html")break;r.push(i),n=n.parentNode}return r.reverse().join(Ce)}var A=class{constructor(){window.addEventListener("click",t=>{var n;let r=$(t);if(r){let i={class:"ui",type:"click",level:"info",timestamp:Date.now(),message:H(r)};(n=this._destination)==null||n.addBreadcrumb(i)}},!0)}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var Me=1e3,Ne=["INPUT","TEXTAREA"],X=class{constructor(){window.addEventListener("keypress",t=>{var i;let r=$(t),n=r;if(r&&(Ne.includes(r.tagName)||n!=null&&n.isContentEditable)){let m={class:"ui",type:"input",level:"info",timestamp:Date.now(),message:H(r)};this._shouldDeduplicate(m)||((i=this._destination)==null||i.addBreadcrumb(m),this._lastEvent=m)}},!0)}register(t,r){this._destination=t}unregister(){this._destination=void 0}_shouldDeduplicate(t){return this._lastEvent?Math.abs(t.timestamp-this._lastEvent.timestamp)<=Me&&this._lastEvent.message===t.message:!1}};var j=class{constructor(){window.addEventListener("error",t=>{var r;(r=this._destination)==null||r.captureErrorEvent(t)},!0),window.addEventListener("unhandledrejection",t=>{var r;t.reason&&((r=this._destination)==null||r.captureError(t.reason))},!0)}register(t){this._destination=t}unregister(){this._destination=void 0}};function re(e,t){return t?e.reduce((r,n)=>n(r),t):""}function q(e,t){var r;(r=e.data)!=null&&r.url&&(e.data.url=re(t.urlFilters,e.data.url))}var Pe="__LaunchDarkly_original_fetch",K=window.fetch;function Ue(e,t){var i;let r="",n="GET";return typeof e=="string"&&(r=e),typeof Request!="undefined"&&e instanceof Request&&(r=e.url,n=e.method),typeof URL!="undefined"&&e instanceof URL&&(r=e.toString()),t&&(n=(i=t.method)!=null?i:n),{url:r,method:n}}function ne(e){function t(...r){let n=Date.now();return K.apply(this,r).then(i=>{let m={class:"http",timestamp:n,level:i.ok?"info":"error",type:"fetch",data:{...Ue(r[0],r[1]),statusCode:i.status,statusText:i.statusText}};return e(m),i})}t.prototype=K==null?void 0:K.prototype;try{Object.defineProperty(t,Pe,{value:K,writable:!0,configurable:!0})}catch(r){}window.fetch=t}var W=class{constructor(t){ne(r=>{var n;q(r,t),(n=this._destination)==null||n.addBreadcrumb(r)})}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var ye="__LaunchDarkly_original_xhr",$e=`${ye}_open`,He=`${ye}_send`,Q="__LaunchDarkly_data_xhr",be=window.XMLHttpRequest.prototype.open,xe=window.XMLHttpRequest.prototype.send;function ie(e){function t(...n){this.addEventListener("error",function(i){let m=this[Q];m.error=!0}),this.addEventListener("loadend",function(i){let m=this[Q];m&&m.timestamp&&e({class:"http",timestamp:m.timestamp,level:m.error?"error":"info",type:"xhr",data:{url:m.url,method:m.method,statusCode:this.status,statusText:this.statusText}})},!0),be.apply(this,n);try{let i={method:n==null?void 0:n[0],url:n==null?void 0:n[1]};Object.defineProperty(this,Q,{value:i,writable:!0,configurable:!0})}catch(i){}}function r(...n){xe.apply(this,n);let i=this[Q];i&&(i.timestamp=Date.now())}window.XMLHttpRequest.prototype.open=t,window.XMLHttpRequest.prototype.send=r;try{Object.defineProperties(window.XMLHttpRequest,{[$e]:{value:be,writable:!0,configurable:!0},[He]:{value:xe,writable:!0,configurable:!0}})}catch(n){}}var G=class{constructor(t){ie(r=>{var n;q(r,t),(n=this._destination)==null||n.addBreadcrumb(r)})}register(t,r){this._destination=t}unregister(){this._destination=void 0}};var Ae=/sdk\/evalx\/[^/]+\/contexts\/(?<context>[^/?]*)\??.*?/,Xe=/\/eval\/[^/]+\/(?<context>[^/?]*)\??.*?/;function je(e){let t=new URL(e),r=!1;return t.username&&(t.username="redacted",r=!0),t.password&&(t.password="redacted",r=!0),r?t.toString():e}function qe(e){var t,r;if(e.includes("/sdk/evalx")){let n=e.match(Ae),i=(t=n==null?void 0:n.groups)==null?void 0:t.context;if(i)return e.replace(i,"*".repeat(i.length))}if(e.includes("/eval/")){let n=e.match(Xe),i=(r=n==null?void 0:n.groups)==null?void 0:r.context;if(i)return e.replace(i,"*".repeat(i.length))}return e}function se(e){return qe(je(e))}function oe(e,t,r){e.breadcrumbs.evaluations&&t.push({type:"flag-used",name:"launchdarkly-browser-telemetry-flag-used",synchronous:!0,method(n,i,m){r.handleFlagUsed(n,i,m)}}),e.breadcrumbs.flagChange&&t.push({type:"flag-detail-changed",name:"launchdarkly-browser-telemetry-flag-used",synchronous:!0,method(n,i){r.handleFlagDetailChanged(n,i)}})}var S={warn:console.warn},Ke="LaunchDarkly - Browser Telemetry:";function k(e){return`${Ke} ${e}`}function M(e){return{warn:(...t)=>{if(!e){S.warn(...t);return}try{e.warn(...t)}catch(r){S.warn(...t),S.warn(k("The provided logger threw an exception, using fallback logger."))}}}}var We={start:0,end:3},Ge={start:4,end:5},ae={start:6,end:7},ce={start:8,end:8},ze={start:9,end:9},Ve={start:10,end:15};function Ye(){if(crypto&&crypto.getRandomValues){let t=new Uint8Array(16);return crypto.getRandomValues(t),[...t.values()]}let e=[];for(let t=0;t<16;t+=1)e.push(Math.floor(Math.random()*256));return e}function N(e,t){let r="";for(let n=t.start;n<=t.end;n+=1)r+=e[n].toString(16).padStart(2,"0");return r}function Ze(e){return e[ce.start]=(e[ce.start]|128)&191,e[ae.start]=e[ae.start]&15|64,`${N(e,We)}-${N(e,Ge)}-${N(e,ae)}-${N(e,ce)}${N(e,ze)}-${N(e,Ve)}`}function Je(){let e=Ye();return Ze(e)}function ue(){return typeof crypto!==void 0&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Je()}var v={};(function(e,t){if(!e)return;let r=[].slice,n="?",i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function m(T,O){return Object.prototype.hasOwnProperty.call(T,O)}function x(T){return typeof T=="undefined"}v.wrap=function(O){function R(){try{return O.apply(this,arguments)}catch(L){throw v.report(L),L}}return R},v.computeStackTrace=function(){let R={};function L(o){if(!v.remoteFetching)return"";try{let l=function(){try{return new e.XMLHttpRequest}catch(d){return new e.ActiveXObject("Microsoft.XMLHTTP")}}();return l.open("GET",o,!1),l.send(""),l.responseText}catch(c){return""}}function D(o){if(typeof o!="string")return[];if(!m(R,o)){let c="",l="";try{l=e.document.domain}catch(u){}let d=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(o);d&&d[2]===l&&(c=L(o)),R[o]=c?c.split(`
|
|
2
|
+
`):[]}return R[o]}function I(o,c){typeof c!="number"&&(c=Number(c));let l=/function ([^(]*)\(([^)]*)\)/,d=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,u="",b=10,g=D(o),f;if(!g.length)return n;for(let a=0;a<b;++a)if(u=g[c-a]+u,!x(u)&&((f=d.exec(u))||(f=l.exec(u))))return f[1];return n}function U(o,c){typeof c!="number"&&(c=Number(c));let l=D(o);if(!l.length)return null;let d=[],u=Math.floor(v.linesOfContext/2),b=u+v.linesOfContext%2,g=Math.max(0,c-u-1),f=Math.min(l.length,c+b-1);c-=1;for(let a=g;a<f;++a)x(l[a])||d.push(l[a]);return d.length>0?d:null}function Y(o){return o.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function fe(o){return Y(o).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function Z(o,c){let l,d;for(let u=0,b=c.length;u<b;++u)if((l=D(c[u])).length&&(l=l.join(`
|
|
3
3
|
`),d=o.exec(l)))return{url:c[u],line:l.substring(0,d.index).split(`
|
|
4
4
|
`).length,column:d.index-l.lastIndexOf(`
|
|
5
|
-
`,d.index)-1};return null}function te(o,c,l){typeof l!="number"&&(l=Number(l));let d=D(c),u=new RegExp(`\\b${Y(o)}\\b`),b;return l-=1,d&&d.length>l&&(b=u.exec(d[l]))?b.index:null}function we(o){if(x(e&&e.document))return;let c=[e.location.href],l=e.document.getElementsByTagName("script"),d,u=`${o}`,b=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,g=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,
|
|
6
|
-
`),a=[],h,s,p,w=/^(.*) is undefined$/.exec(o.message);for(let y=0,J=
|
|
7
|
-
`),b=[],g;for(let
|
|
8
|
-
`);if(c.length<4)return null;let l=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,d=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,u=/^\s*Line (\d+) of function script\s*$/i,b=[],g=e&&e.document&&e.document.getElementsByTagName("script"),
|
|
5
|
+
`,d.index)-1};return null}function te(o,c,l){typeof l!="number"&&(l=Number(l));let d=D(c),u=new RegExp(`\\b${Y(o)}\\b`),b;return l-=1,d&&d.length>l&&(b=u.exec(d[l]))?b.index:null}function we(o){if(x(e&&e.document))return;let c=[e.location.href],l=e.document.getElementsByTagName("script"),d,u=`${o}`,b=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,g=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,f,a,h;for(let s=0;s<l.length;++s){let p=l[s];p.src&&c.push(p.src)}if(!(a=b.exec(u)))f=new RegExp(Y(u).replace(/\s+/g,"\\s+"));else{let s=a[1]?`\\s+${a[1]}`:"",p=a[2].split(",").join("\\s*,\\s*");d=Y(a[3]).replace(/;$/,";?"),f=new RegExp(`function${s}\\s*\\(\\s*${p}\\s*\\)\\s*{\\s*${d}\\s*}`)}if(h=Z(f,c))return h;if(a=g.exec(u)){let s=a[1];if(d=fe(a[2]),f=new RegExp(`on${s}=[\\'"]\\s*${d}\\s*[\\'"]`,"i"),(h=Z(f,c[0]))||(f=new RegExp(d),h=Z(f,c)))return h}return null}function de(o){if(!o.stack)return null;let c=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,l=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,d=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,u,b=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,g=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=o.stack.split(`
|
|
6
|
+
`),a=[],h,s,p,w=/^(.*) is undefined$/.exec(o.message);for(let y=0,J=f.length;y<J;++y){if(s=c.exec(f[y])){let he=s[2]&&s[2].indexOf("native")===0;u=s[2]&&s[2].indexOf("eval")===0,u&&(h=g.exec(s[2]))&&(s[2]=h[1],s[3]=h[2],s[4]=h[3]),p={url:he?null:s[2],func:s[1]||n,args:he?[s[2]]:[],line:s[3]?+s[3]:null,column:s[4]?+s[4]:null}}else if(s=d.exec(f[y]))p={url:s[2],func:s[1]||n,args:[],line:+s[3],column:s[4]?+s[4]:null};else if(s=l.exec(f[y]))u=s[3]&&s[3].indexOf(" > eval")>-1,u&&(h=b.exec(s[3]))?(s[3]=h[1],s[4]=h[2],s[5]=null):y===0&&!s[5]&&!x(o.columnNumber)&&(a[0].column=o.columnNumber+1),p={url:s[3],func:s[1]||n,args:s[2]?s[2].split(","):[],line:s[4]?+s[4]:null,column:s[5]?+s[5]:null};else continue;!p.func&&p.line&&(p.func=I(p.url,p.line)),p.context=p.line?U(p.url,p.line):null,a.push(p)}return a.length?(a[0]&&a[0].line&&!a[0].column&&w&&(a[0].column=te(w[1],a[0].url,a[0].line)),{mode:"stack",name:o.name,message:o.message,stack:a}):null}function Se(o){let{stacktrace:c}=o;if(!c)return null;let l=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,d=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,u=c.split(`
|
|
7
|
+
`),b=[],g;for(let f=0;f<u.length;f+=2){let a=null;if((g=l.exec(u[f]))?a={url:g[2],line:+g[1],column:null,func:g[3],args:[]}:(g=d.exec(u[f]))&&(a={url:g[6],line:+g[1],column:+g[2],func:g[3]||g[4],args:g[5]?g[5].split(","):[]}),a){if(!a.func&&a.line&&(a.func=I(a.url,a.line)),a.line)try{a.context=U(a.url,a.line)}catch(h){}a.context||(a.context=[u[f+1]]),b.push(a)}}return b.length?{mode:"stacktrace",name:o.name,message:o.message,stack:b}:null}function Fe(o){let c=o.message.split(`
|
|
8
|
+
`);if(c.length<4)return null;let l=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,d=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,u=/^\s*Line (\d+) of function script\s*$/i,b=[],g=e&&e.document&&e.document.getElementsByTagName("script"),f=[],a;for(let h in g)m(g,h)&&!g[h].src&&f.push(g[h]);for(let h=2;h<c.length;h+=2){let s=null;if(a=l.exec(c[h]))s={url:a[2],func:a[3],args:[],line:+a[1],column:null};else if(a=d.exec(c[h])){s={url:a[3],func:a[4],args:[],line:+a[1],column:null};let p=+a[1],w=f[a[2]-1];if(w){let y=D(s.url);if(y){y=y.join(`
|
|
9
9
|
`);let J=y.indexOf(w.innerText);J>=0&&(s.line=p+y.substring(0,J).split(`
|
|
10
|
-
`).length)}}}else if(a=u.exec(c[h])){let p=e.location.href.replace(/#.*$/,""),w=new RegExp(fe(c[h+1])),y=Z(w,[p]);s={url:p,func:"",args:[],line:y?y.line:a[1],column:null}}if(s){s.func||(s.func=I(s.url,s.line));let p=$(s.url,s.line),w=p?p[Math.floor(p.length/2)]:null;p&&w&&w.replace(/^\s*/,"")===c[h+1].replace(/^\s*/,"")?s.context=p:s.context=[c[h+1]],b.push(s)}}return b.length?{mode:"multiline",name:o.name,message:c[0],stack:b}:null}function pe(o,c,l,d){let u={url:c,line:l};if(u.url&&u.line){o.incomplete=!1,u.func||(u.func=I(u.url,u.line)),u.context||(u.context=$(u.url,u.line));let b=/ '([^']+)' /.exec(d);if(b&&(u.column=te(b[1],u.url,u.line)),o.stack.length>0&&o.stack[0].url===u.url){if(o.stack[0].line===u.line)return!1;if(!o.stack[0].line&&o.stack[0].func===u.func)return o.stack[0].line=u.line,o.stack[0].context=u.context,!1}return o.stack.unshift(u),o.partial=!0,!0}return o.incomplete=!0,!1}function ge(o,c){let l=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,d=[],u={},b=!1,g,m,a;for(let s=ge.caller;s&&!b;s=s.caller)if(!(s===F||s===v.report)){if(m={url:null,func:n,args:[],line:null,column:null},s.name?m.func=s.name:(g=l.exec(s.toString()))&&(m.func=g[1]),typeof m.func=="undefined")try{m.func=g.input.substring(0,g.input.indexOf("{"))}catch(p){}if(a=we(s)){m.url=a.url,m.line=a.line,m.func===n&&(m.func=I(m.url,m.line));let p=/ '([^']+)' /.exec(o.message||o.description);p&&(m.column=te(p[1],a.url,a.line))}u[`${s}`]?b=!0:u[`${s}`]=!0,d.push(m)}c&&d.splice(0,c);let h={mode:"callers",name:o.name,message:o.message,stack:d};return pe(h,o.sourceURL||o.fileName,o.line||o.lineNumber,o.message||o.description),h}function F(o,c){let l=null;c=c==null?0:+c;try{if(l=Se(o),l)return l}catch(d){}try{if(l=de(o),l)return l}catch(d){}try{if(l=Fe(o),l)return l}catch(d){}try{if(l=ge(o,c+1),l)return l}catch(d){}return{name:o.name,message:o.message,mode:"failed",stack:[]}}function Re(o){o=(o==null?0:+o)+1;try{throw new Error}catch(c){return F(c,o+1)}}return F.augmentStackTraceWithInitialElement=pe,F.computeStackTraceFromStackProp=de,F.guessFunctionName=I,F.gatherContext=$,F.ofCaller=Re,F.getSource=D,F}(),v.remoteFetching||(v.remoteFetching=!0),v.collectWindowErrors||(v.collectWindowErrors=!0),(!v.linesOfContext||v.linesOfContext<1)&&(v.linesOfContext=11)})(typeof window!="undefined"?window:global);function ee(){return v}var ve="(index)";function Ze(e,t){let r=e;if(e.startsWith(t)){if(r=e.slice(t.length),r.startsWith("/")&&(r=r.slice(1)),r==="")return ve;r.endsWith("/")&&(r+=ve)}return r}function Ee(e,t,r){if(t.length<=e.maxLength)return t;let n=Math.max(0,r-e.beforeColumnCharacters),i=Math.min(t.length,n+e.maxLength);return t.slice(n,i)}function Le(e,t,r,n){let i=e<0?0:e,f=t>r.length?r.length:t;return i<f?r.slice(i,f).map(n):[]}function Je(e,t){let{context:r}=e;if(!r)return{};let{maxLineLength:n}=t.source,i=Math.floor(n/2),f=T=>Ee({maxLength:t.source.maxLineLength,beforeColumnCharacters:i},T,0),x=Math.floor(r.length/2);return{srcBefore:Le(x-t.source.beforeLines,x,r,f),srcLine:Ee({maxLength:n,beforeColumnCharacters:i},r[x],e.column||0),srcAfter:Le(x+1,x+1+t.source.afterLines,r,f)}}function le(e,t){return{frames:ee().computeStackTrace(e).stack.reverse().map(i=>({fileName:Ze(i.url,window.location.origin),function:i.func,line:i.line,col:i.column,...Je(i,t)}))}}var Te="$ld:telemetry",Qe=`${Te}:error`,et=`${Te}:session:init`,_e="generic",tt="exception was null or undefined",rt="exception had no message";function ke(e){switch(typeof e){case"string":case"boolean":case"number":return e;default:return}}function nt(e,t){return e===void 0?void 0:t(e)}function it(e){let t=ee(),r=Math.max(e.source.afterLines,e.source.beforeLines),n=t;n.linesOfContext=r*2+1}function st(e){return e.logger!==void 0}var B=class{constructor(t){this._options=t;this._pendingEvents=[];this._breadcrumbs=[];this._inspectorInstances=[];this._collectors=[];this._sessionId=ue();this._eventsDropped=!1;this._breadcrumbFilterError=!1;this._errorFilterError=!1;var f;it(t.stack),this._collectors.push(new j),this._collectors.push(...t.collectors),this._maxPendingEvents=t.maxPendingEvents,this._maxBreadcrumbs=t.breadcrumbs.maxBreadcrumbs;let r=[se];t.breadcrumbs.http.customUrlFilter&&r.push(t.breadcrumbs.http.customUrlFilter),t.breadcrumbs.http.instrumentFetch&&this._collectors.push(new W({urlFilters:r})),t.breadcrumbs.http.instrumentXhr&&this._collectors.push(new G({urlFilters:r})),t.breadcrumbs.click&&this._collectors.push(new A),t.breadcrumbs.keyboardInput&&this._collectors.push(new X),this._collectors.forEach(x=>x.register(this,this._sessionId));let n=this,i=[];oe(t,i,n),this._inspectorInstances.push(...i),this._logger=(f=this._options.logger)!=null?f:S}register(t){this._client=t,this._setLogger(),this._client.track(et,{sessionId:this._sessionId}),this._pendingEvents.forEach(r=>{var n;(n=this._client)==null||n.track(r.type,r.data)}),this._pendingEvents=[]}_setLogger(){this._options.logger?this._logger=this._options.logger:st(this._client)?this._logger=this._client.logger:this._logger=S}inspectors(){return this._inspectorInstances}_capture(t,r){var i;let n=this._applyFilters(r,this._options.errorFilters,f=>{this._errorFilterError||(this._errorFilterError=!0,this._logger.warn(k(`Error applying error filters: ${f}`)))});n!==void 0&&(this._client===void 0&&(this._pendingEvents.push({type:t,data:n}),this._pendingEvents.length>this._maxPendingEvents&&(this._eventsDropped||(this._eventsDropped=!0,this._logger.warn(k("Maximum pending events reached. Old events will be dropped until the SDK client is registered."))),this._pendingEvents.shift())),(i=this._client)==null||i.track(t,n))}captureError(t){var i,f;let n=t!=null?{type:t.name||((i=t.constructor)==null?void 0:i.name)||_e,message:(f=t.message)!=null?f:rt,stack:le(t,this._options.stack),breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId}:{type:_e,message:tt,stack:{frames:[]},breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId};this._capture(Qe,n)}captureErrorEvent(t){this.captureError(t.error)}_applyFilters(t,r,n){try{return r.reduce((i,f)=>nt(i,f),t)}catch(i){n(i);return}}addBreadcrumb(t){let r=this._applyFilters(t,this._options.breadcrumbs.filters,n=>{this._breadcrumbFilterError||(this._breadcrumbFilterError=!0,this._logger.warn(k(`Error applying breadcrumb filters: ${n}`)))});r!==void 0&&(this._breadcrumbs.push(r),this._breadcrumbs.length>this._maxBreadcrumbs&&this._breadcrumbs.shift())}close(){this._collectors.forEach(t=>t.unregister())}handleFlagUsed(t,r,n){let i={type:"flag-evaluated",data:{key:t,value:ke(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(i)}handleFlagDetailChanged(t,r){let n={type:"flag-detail-changed",data:{key:t,value:ke(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(n)}};function ot(){return{breadcrumbs:{maxBreadcrumbs:50,evaluations:!0,flagChange:!0,click:!0,keyboardInput:!0,http:{instrumentFetch:!0,instrumentXhr:!0},filters:[]},stack:{source:{beforeLines:3,afterLines:3,maxLineLength:280}},maxPendingEvents:100,collectors:[],errorFilters:[]}}function P(e,t,r){return k(`Config option "${e}" should be of type ${t}, got ${r}, using default value`)}function _(e,t,r){return n=>{let i=typeof n;return i===e?!0:(r==null||r.warn(P(t,e,i)),!1)}}function E(e,t,r){return e!=null&&(!r||r(e))?e:t}function at(e,t,r){if(e!==void 0&&e!==!1&&typeof e!="object")return r==null||r.warn(P("breadcrumbs.http","HttpBreadCrumbOptions | false",typeof e)),t;if(e===!1)return{instrumentFetch:!1,instrumentXhr:!1};e!=null&&e.customUrlFilter&&typeof e.customUrlFilter!="function"&&(r==null||r.warn(k(`The "breadcrumbs.http.customUrlFilter" must be a function. Received ${typeof e.customUrlFilter}`)));let n=e!=null&&e.customUrlFilter&&typeof(e==null?void 0:e.customUrlFilter)=="function"?e.customUrlFilter:void 0;return{instrumentFetch:E(e==null?void 0:e.instrumentFetch,t.instrumentFetch,_("boolean","breadcrumbs.http.instrumentFetch",r)),instrumentXhr:E(e==null?void 0:e.instrumentXhr,t.instrumentXhr,_("boolean","breadcrumbs.http.instrumentXhr",r)),customUrlFilter:n}}function ct(e){if(e.logger){let{logger:t}=e;if(typeof t=="object"&&t!==null&&"warn"in t)return M(t);S.warn(P("logger","MinLogger or LDLogger",typeof t))}}function ut(e,t,r){var n,i,f;return{source:{beforeLines:E((n=e==null?void 0:e.source)==null?void 0:n.beforeLines,t.source.beforeLines,_("number","stack.beforeLines",r)),afterLines:E((i=e==null?void 0:e.source)==null?void 0:i.afterLines,t.source.afterLines,_("number","stack.afterLines",r)),maxLineLength:E((f=e==null?void 0:e.source)==null?void 0:f.maxLineLength,t.source.maxLineLength,_("number","stack.maxLineLength",r))}}}function V(e,t){var n,i,f,x,T,O,R;let r=ot();return e.breadcrumbs&&_("object","breadcrumbs",t)(e.breadcrumbs),e.stack&&_("object","stack",t)(e.stack),{breadcrumbs:{maxBreadcrumbs:E((n=e.breadcrumbs)==null?void 0:n.maxBreadcrumbs,r.breadcrumbs.maxBreadcrumbs,_("number","breadcrumbs.maxBreadcrumbs",t)),evaluations:E((i=e.breadcrumbs)==null?void 0:i.evaluations,r.breadcrumbs.evaluations,_("boolean","breadcrumbs.evaluations",t)),flagChange:E((f=e.breadcrumbs)==null?void 0:f.flagChange,r.breadcrumbs.flagChange,_("boolean","breadcrumbs.flagChange",t)),click:E((x=e.breadcrumbs)==null?void 0:x.click,r.breadcrumbs.click,_("boolean","breadcrumbs.click",t)),keyboardInput:E((T=e.breadcrumbs)==null?void 0:T.keyboardInput,r.breadcrumbs.keyboardInput,_("boolean","breadcrumbs.keyboardInput",t)),http:at((O=e.breadcrumbs)==null?void 0:O.http,r.breadcrumbs.http,t),filters:E((R=e.breadcrumbs)==null?void 0:R.filters,r.breadcrumbs.filters,L=>Array.isArray(L)?!0:(t==null||t.warn(P("breadcrumbs.filters","BreadcrumbFilter[]",typeof L)),!1))},stack:ut(e.stack,r.stack),maxPendingEvents:E(e.maxPendingEvents,r.maxPendingEvents,_("number","maxPendingEvents",t)),collectors:[...E(e.collectors,r.collectors,L=>Array.isArray(L)?!0:(t==null||t.warn(P("collectors","Collector[]",typeof L)),!1))],logger:ct(e),errorFilters:E(e.errorFilters,r.errorFilters,L=>Array.isArray(L)?!0:(t==null||t.warn(P("errorFilters","ErrorDataFilter[]",typeof L)),!1))}}var z,me=!1;function pr(e){let t=M(e==null?void 0:e.logger);if(z){t.warn(k("Telemetry has already been initialized. Ignoring new options."));return}let r=V(e||{},t);z=new B(r)}function C(){if(!z){if(me)return;S.warn(k("Telemetry has not been initialized")),me=!0;return}return z}function gr(){z=void 0,me=!1}function xr(){var e;return((e=C())==null?void 0:e.inspectors())||[]}function yr(e){var t;(t=C())==null||t.captureError(e)}function vr(e){var t;(t=C())==null||t.captureErrorEvent(e)}function Er(e){var t;(t=C())==null||t.addBreadcrumb(e)}function Lr(e){var t;(t=C())==null||t.register(e)}function _r(){var e;(e=C())==null||e.close()}function Br(e){let t=V(e||{},M(e==null?void 0:e.logger));return new B(t)}export{Er as addBreadcrumb,yr as captureError,vr as captureErrorEvent,_r as close,C as getTelemetryInstance,pr as initTelemetry,Br as initTelemetryInstance,xr as inspectors,Lr as register,gr as resetTelemetryInstance};
|
|
10
|
+
`).length)}}}else if(a=u.exec(c[h])){let p=e.location.href.replace(/#.*$/,""),w=new RegExp(fe(c[h+1])),y=Z(w,[p]);s={url:p,func:"",args:[],line:y?y.line:a[1],column:null}}if(s){s.func||(s.func=I(s.url,s.line));let p=U(s.url,s.line),w=p?p[Math.floor(p.length/2)]:null;p&&w&&w.replace(/^\s*/,"")===c[h+1].replace(/^\s*/,"")?s.context=p:s.context=[c[h+1]],b.push(s)}}return b.length?{mode:"multiline",name:o.name,message:c[0],stack:b}:null}function pe(o,c,l,d){let u={url:c,line:l};if(u.url&&u.line){o.incomplete=!1,u.func||(u.func=I(u.url,u.line)),u.context||(u.context=U(u.url,u.line));let b=/ '([^']+)' /.exec(d);if(b&&(u.column=te(b[1],u.url,u.line)),o.stack.length>0&&o.stack[0].url===u.url){if(o.stack[0].line===u.line)return!1;if(!o.stack[0].line&&o.stack[0].func===u.func)return o.stack[0].line=u.line,o.stack[0].context=u.context,!1}return o.stack.unshift(u),o.partial=!0,!0}return o.incomplete=!0,!1}function ge(o,c){let l=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,d=[],u={},b=!1,g,f,a;for(let s=ge.caller;s&&!b;s=s.caller)if(!(s===F||s===v.report)){if(f={url:null,func:n,args:[],line:null,column:null},s.name?f.func=s.name:(g=l.exec(s.toString()))&&(f.func=g[1]),typeof f.func=="undefined")try{f.func=g.input.substring(0,g.input.indexOf("{"))}catch(p){}if(a=we(s)){f.url=a.url,f.line=a.line,f.func===n&&(f.func=I(f.url,f.line));let p=/ '([^']+)' /.exec(o.message||o.description);p&&(f.column=te(p[1],a.url,a.line))}u[`${s}`]?b=!0:u[`${s}`]=!0,d.push(f)}c&&d.splice(0,c);let h={mode:"callers",name:o.name,message:o.message,stack:d};return pe(h,o.sourceURL||o.fileName,o.line||o.lineNumber,o.message||o.description),h}function F(o,c){let l=null;c=c==null?0:+c;try{if(l=Se(o),l)return l}catch(d){}try{if(l=de(o),l)return l}catch(d){}try{if(l=Fe(o),l)return l}catch(d){}try{if(l=ge(o,c+1),l)return l}catch(d){}return{name:o.name,message:o.message,mode:"failed",stack:[]}}function Re(o){o=(o==null?0:+o)+1;try{throw new Error}catch(c){return F(c,o+1)}}return F.augmentStackTraceWithInitialElement=pe,F.computeStackTraceFromStackProp=de,F.guessFunctionName=I,F.gatherContext=U,F.ofCaller=Re,F.getSource=D,F}(),v.remoteFetching||(v.remoteFetching=!0),v.collectWindowErrors||(v.collectWindowErrors=!0),(!v.linesOfContext||v.linesOfContext<1)&&(v.linesOfContext=11)})(typeof window!="undefined"?window:global);function ee(){return v}var ve="(index)";function Qe(e,t){let r=e;if(e.startsWith(t)){if(r=e.slice(t.length),r.startsWith("/")&&(r=r.slice(1)),r==="")return ve;r.endsWith("/")&&(r+=ve)}return r}function Ee(e,t,r){if(t.length<=e.maxLength)return t;let n=Math.max(0,r-e.beforeColumnCharacters),i=Math.min(t.length,n+e.maxLength);return t.slice(n,i)}function Le(e,t,r,n){let i=e<0?0:e,m=t>r.length?r.length:t;return i<m?r.slice(i,m).map(n):[]}function et(e,t){let{context:r}=e;if(!r)return{};let{maxLineLength:n}=t.source,i=Math.floor(n/2),m=T=>Ee({maxLength:t.source.maxLineLength,beforeColumnCharacters:i},T,0),x=Math.floor(r.length/2);return{srcBefore:Le(x-t.source.beforeLines,x,r,m),srcLine:Ee({maxLength:n,beforeColumnCharacters:i},r[x],e.column||0),srcAfter:Le(x+1,x+1+t.source.afterLines,r,m)}}function le(e,t){return{frames:ee().computeStackTrace(e).stack.reverse().map(i=>({fileName:Qe(i.url,window.location.origin),function:i.func,line:i.line,col:i.column,...et(i,t)}))}}var Te="$ld:telemetry",tt=`${Te}:error`,rt=`${Te}:session:init`,_e="generic",nt="exception was null or undefined",it="exception had no message",st=5;function ke(e){switch(typeof e){case"string":case"boolean":case"number":return e;default:return}}function ot(e,t){return e===void 0?void 0:t(e)}function at(e){let t=ee(),r=Math.max(e.source.afterLines,e.source.beforeLines),n=t;n.linesOfContext=r*2+1}function ct(e){return e.logger!==void 0}function ut(e){return e.waitForInitialization!==void 0}var C=class{constructor(t){this._options=t;this._pendingEvents=[];this._breadcrumbs=[];this._inspectorInstances=[];this._collectors=[];this._sessionId=ue();this._registrationComplete=!1;this._clientRegistered=!1;this._eventsDropped=!1;this._breadcrumbFilterError=!1;this._errorFilterError=!1;var m;at(t.stack),this._collectors.push(new j),this._collectors.push(...t.collectors),this._maxPendingEvents=t.maxPendingEvents,this._maxBreadcrumbs=t.breadcrumbs.maxBreadcrumbs;let r=[se];t.breadcrumbs.http.customUrlFilter&&r.push(t.breadcrumbs.http.customUrlFilter),t.breadcrumbs.http.instrumentFetch&&this._collectors.push(new W({urlFilters:r})),t.breadcrumbs.http.instrumentXhr&&this._collectors.push(new G({urlFilters:r})),t.breadcrumbs.click&&this._collectors.push(new A),t.breadcrumbs.keyboardInput&&this._collectors.push(new X),this._collectors.forEach(x=>x.register(this,this._sessionId));let n=this,i=[];oe(t,i,n),this._inspectorInstances.push(...i),this._logger=(m=this._options.logger)!=null?m:S}register(t){if(this._client!==void 0)return;this._client=t,this._setLogger();let r=()=>{var n;(n=this._client)==null||n.track(rt,{sessionId:this._sessionId}),this._pendingEvents.forEach(i=>{var m;(m=this._client)==null||m.track(i.type,i.data)}),this._pendingEvents=[],this._registrationComplete=!0};ut(t)?(async()=>{try{await t.waitForInitialization(st)}catch(n){}r()})():r()}_setLogger(){this._options.logger?this._logger=this._options.logger:ct(this._client)?this._logger=this._client.logger:this._logger=S}inspectors(){return this._inspectorInstances}_capture(t,r){var i;let n=this._applyFilters(r,this._options.errorFilters,m=>{this._errorFilterError||(this._errorFilterError=!0,this._logger.warn(k(`Error applying error filters: ${m}`)))});n!==void 0&&(this._registrationComplete?(i=this._client)==null||i.track(t,n):(this._pendingEvents.push({type:t,data:n}),this._pendingEvents.length>this._maxPendingEvents&&(this._eventsDropped||(this._eventsDropped=!0,this._logger.warn(k("Maximum pending events reached. Old events will be dropped until the SDK client is registered."))),this._pendingEvents.shift())))}captureError(t){var i,m;let n=t!=null?{type:t.name||((i=t.constructor)==null?void 0:i.name)||_e,message:(m=t.message)!=null?m:it,stack:le(t,this._options.stack),breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId}:{type:_e,message:nt,stack:{frames:[]},breadcrumbs:[...this._breadcrumbs],sessionId:this._sessionId};this._capture(tt,n)}captureErrorEvent(t){this.captureError(t.error)}_applyFilters(t,r,n){try{return r.reduce((i,m)=>ot(i,m),t)}catch(i){n(i);return}}addBreadcrumb(t){let r=this._applyFilters(t,this._options.breadcrumbs.filters,n=>{this._breadcrumbFilterError||(this._breadcrumbFilterError=!0,this._logger.warn(k(`Error applying breadcrumb filters: ${n}`)))});r!==void 0&&(this._breadcrumbs.push(r),this._breadcrumbs.length>this._maxBreadcrumbs&&this._breadcrumbs.shift())}close(){this._collectors.forEach(t=>t.unregister())}handleFlagUsed(t,r,n){let i={type:"flag-evaluated",data:{key:t,value:ke(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(i)}handleFlagDetailChanged(t,r){let n={type:"flag-detail-changed",data:{key:t,value:ke(r.value)},timestamp:new Date().getTime(),class:"feature-management",level:"info"};this.addBreadcrumb(n)}};function lt(){return{breadcrumbs:{maxBreadcrumbs:50,evaluations:!0,flagChange:!0,click:!0,keyboardInput:!0,http:{instrumentFetch:!0,instrumentXhr:!0},filters:[]},stack:{source:{beforeLines:3,afterLines:3,maxLineLength:280}},maxPendingEvents:100,collectors:[],errorFilters:[]}}function P(e,t,r){return k(`Config option "${e}" should be of type ${t}, got ${r}, using default value`)}function _(e,t,r){return n=>{let i=typeof n;return i===e?!0:(r==null||r.warn(P(t,e,i)),!1)}}function E(e,t,r){return e!=null&&(!r||r(e))?e:t}function mt(e,t,r){if(e!==void 0&&e!==!1&&typeof e!="object")return r==null||r.warn(P("breadcrumbs.http","HttpBreadCrumbOptions | false",typeof e)),t;if(e===!1)return{instrumentFetch:!1,instrumentXhr:!1};e!=null&&e.customUrlFilter&&typeof e.customUrlFilter!="function"&&(r==null||r.warn(k(`The "breadcrumbs.http.customUrlFilter" must be a function. Received ${typeof e.customUrlFilter}`)));let n=e!=null&&e.customUrlFilter&&typeof(e==null?void 0:e.customUrlFilter)=="function"?e.customUrlFilter:void 0;return{instrumentFetch:E(e==null?void 0:e.instrumentFetch,t.instrumentFetch,_("boolean","breadcrumbs.http.instrumentFetch",r)),instrumentXhr:E(e==null?void 0:e.instrumentXhr,t.instrumentXhr,_("boolean","breadcrumbs.http.instrumentXhr",r)),customUrlFilter:n}}function ft(e){if(e.logger){let{logger:t}=e;if(typeof t=="object"&&t!==null&&"warn"in t)return M(t);S.warn(P("logger","MinLogger or LDLogger",typeof t))}}function dt(e,t,r){var n,i,m;return{source:{beforeLines:E((n=e==null?void 0:e.source)==null?void 0:n.beforeLines,t.source.beforeLines,_("number","stack.beforeLines",r)),afterLines:E((i=e==null?void 0:e.source)==null?void 0:i.afterLines,t.source.afterLines,_("number","stack.afterLines",r)),maxLineLength:E((m=e==null?void 0:e.source)==null?void 0:m.maxLineLength,t.source.maxLineLength,_("number","stack.maxLineLength",r))}}}function z(e,t){var n,i,m,x,T,O,R;let r=lt();return e.breadcrumbs&&_("object","breadcrumbs",t)(e.breadcrumbs),e.stack&&_("object","stack",t)(e.stack),{breadcrumbs:{maxBreadcrumbs:E((n=e.breadcrumbs)==null?void 0:n.maxBreadcrumbs,r.breadcrumbs.maxBreadcrumbs,_("number","breadcrumbs.maxBreadcrumbs",t)),evaluations:E((i=e.breadcrumbs)==null?void 0:i.evaluations,r.breadcrumbs.evaluations,_("boolean","breadcrumbs.evaluations",t)),flagChange:E((m=e.breadcrumbs)==null?void 0:m.flagChange,r.breadcrumbs.flagChange,_("boolean","breadcrumbs.flagChange",t)),click:E((x=e.breadcrumbs)==null?void 0:x.click,r.breadcrumbs.click,_("boolean","breadcrumbs.click",t)),keyboardInput:E((T=e.breadcrumbs)==null?void 0:T.keyboardInput,r.breadcrumbs.keyboardInput,_("boolean","breadcrumbs.keyboardInput",t)),http:mt((O=e.breadcrumbs)==null?void 0:O.http,r.breadcrumbs.http,t),filters:E((R=e.breadcrumbs)==null?void 0:R.filters,r.breadcrumbs.filters,L=>Array.isArray(L)?!0:(t==null||t.warn(P("breadcrumbs.filters","BreadcrumbFilter[]",typeof L)),!1))},stack:dt(e.stack,r.stack),maxPendingEvents:E(e.maxPendingEvents,r.maxPendingEvents,_("number","maxPendingEvents",t)),collectors:[...E(e.collectors,r.collectors,L=>Array.isArray(L)?!0:(t==null||t.warn(P("collectors","Collector[]",typeof L)),!1))],logger:ft(e),errorFilters:E(e.errorFilters,r.errorFilters,L=>Array.isArray(L)?!0:(t==null||t.warn(P("errorFilters","ErrorDataFilter[]",typeof L)),!1))}}var V,me=!1;function yr(e){let t=M(e==null?void 0:e.logger);if(V){t.warn(k("Telemetry has already been initialized. Ignoring new options."));return}let r=z(e||{},t);V=new C(r)}function B(){if(!V){if(me)return;S.warn(k("Telemetry has not been initialized")),me=!0;return}return V}function vr(){V=void 0,me=!1}function _r(){var e;return((e=B())==null?void 0:e.inspectors())||[]}function kr(e){var t;(t=B())==null||t.captureError(e)}function Tr(e){var t;(t=B())==null||t.captureErrorEvent(e)}function wr(e){var t;(t=B())==null||t.addBreadcrumb(e)}function Sr(e){var t;(t=B())==null||t.register(e)}function Fr(){var e;(e=B())==null||e.close()}function Nr(e){let t=z(e||{},M(e==null?void 0:e.logger));return new C(t)}export{wr as addBreadcrumb,kr as captureError,Tr as captureErrorEvent,Fr as close,B as getTelemetryInstance,yr as initTelemetry,Nr as initTelemetryInstance,_r as inspectors,Sr as register,vr as resetTelemetryInstance};
|
|
11
11
|
/**
|
|
12
12
|
* https://github.com/csnover/TraceKit
|
|
13
13
|
* @license MIT
|