@grafana/faro-web-sdk 1.2.9 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/bundle/faro-web-sdk.iife.js +1 -1
  2. package/dist/bundle/types/index.d.ts +1 -1
  3. package/dist/bundle/types/instrumentations/console/instrumentation.d.ts +1 -1
  4. package/dist/bundle/types/instrumentations/errors/instrumentation.d.ts +1 -1
  5. package/dist/bundle/types/instrumentations/session/instrumentation.d.ts +1 -1
  6. package/dist/bundle/types/instrumentations/view/instrumentation.d.ts +1 -1
  7. package/dist/bundle/types/instrumentations/webVitals/instrumentation.d.ts +1 -1
  8. package/dist/bundle/types/transports/console/transport.d.ts +1 -1
  9. package/dist/bundle/types/transports/fetch/transport.d.ts +1 -1
  10. package/dist/cjs/config/makeCoreConfig.js +2 -7
  11. package/dist/cjs/config/makeCoreConfig.js.map +1 -1
  12. package/dist/cjs/index.js +8 -1
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/cjs/instrumentations/session/instrumentation.js +23 -19
  15. package/dist/cjs/instrumentations/session/instrumentation.js.map +1 -1
  16. package/dist/cjs/instrumentations/session/sessionManager/sessionConstants.js +1 -1
  17. package/dist/cjs/instrumentations/session/sessionManager/sessionConstants.js.map +1 -1
  18. package/dist/cjs/instrumentations/view/instrumentation.js +6 -2
  19. package/dist/cjs/instrumentations/view/instrumentation.js.map +1 -1
  20. package/dist/esm/config/makeCoreConfig.js +3 -8
  21. package/dist/esm/config/makeCoreConfig.js.map +1 -1
  22. package/dist/esm/index.js +1 -1
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/instrumentations/session/instrumentation.js +23 -19
  25. package/dist/esm/instrumentations/session/instrumentation.js.map +1 -1
  26. package/dist/esm/instrumentations/session/sessionManager/sessionConstants.js +1 -1
  27. package/dist/esm/instrumentations/session/sessionManager/sessionConstants.js.map +1 -1
  28. package/dist/esm/instrumentations/view/instrumentation.js +6 -2
  29. package/dist/esm/instrumentations/view/instrumentation.js.map +1 -1
  30. package/dist/types/index.d.ts +1 -1
  31. package/dist/types/instrumentations/console/instrumentation.d.ts +1 -1
  32. package/dist/types/instrumentations/errors/instrumentation.d.ts +1 -1
  33. package/dist/types/instrumentations/session/instrumentation.d.ts +1 -1
  34. package/dist/types/instrumentations/view/instrumentation.d.ts +1 -1
  35. package/dist/types/instrumentations/webVitals/instrumentation.d.ts +1 -1
  36. package/dist/types/transports/console/transport.d.ts +1 -1
  37. package/dist/types/transports/fetch/transport.d.ts +1 -1
  38. package/package.json +3 -3
@@ -1 +1 @@
1
- var GrafanaFaroWebSdk=function(e){"use strict";function n(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(t[i[s]]=e[i[s]])}return t}function t(e,n,t,i){return new(t||(t=Promise))((function(s,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var n;e.done?s(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,a)}l((i=i.apply(e,n||[])).next())}))}function i(e,n){return typeof e===n}function s(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function r(e,n){try{return e instanceof n}catch(e){return!1}}"function"==typeof SuppressedError&&SuppressedError;const o=e=>i(e,"undefined"),a=e=>i(e,"null"),l=e=>i(e,"string"),u=e=>i(e,"number")&&!isNaN(e)||i(e,"bigint"),c=e=>!a(e)&&i(e,"object"),d=e=>i(e,"function"),p=e=>s(e,"Array"),f=e=>!c(e)&&!d(e),g=!o(Event),b=e=>g&&r(e,Event),m="undefined"!=typeof Error,v=e=>m&&r(e,Error),h=e=>s(e,"ErrorEvent"),w=e=>s(e,"DOMError"),y=e=>s(e,"DOMException"),S="undefined"!=typeof Element,E="undefined"!=typeof Map;function T(e,n){if(e===n)return!0;if(i(e,"number")&&isNaN(e))return i(n,"number")&&isNaN(n);const t=p(e),s=p(n);if(t!==s)return!1;if(t&&s){const t=e.length;if(t!==n.length)return!1;for(let i=t;0!=i--;)if(!T(e[i],n[i]))return!1;return!0}const r=c(e),o=c(n);if(r!==o)return!1;if(e&&n&&r&&o){const t=Object.keys(e),i=Object.keys(n);if(t.length!==i.length)return!1;for(let e of t)if(!i.includes(e))return!1;for(let i of t)if(!T(e[i],n[i]))return!1;return!0}return!1}function x(){return(new Date).toISOString()}var k;e.LogLevel=void 0,(k=e.LogLevel||(e.LogLevel={})).TRACE="trace",k.DEBUG="debug",k.INFO="info",k.LOG="log",k.WARN="warn",k.ERROR="error";const I=e.LogLevel.LOG,O=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function L(){}function A(e){const{size:n,concurrency:t}=e,i=[];let s=0;const r=()=>{if(s<t&&i.length){const{producer:e,resolve:n,reject:t}=i.shift();s++,e().then((e=>{s--,r(),n(e)}),(e=>{s--,r(),t(e)}))}};return{add:e=>{if(i.length+s>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{i.push({producer:e,resolve:n,reject:t}),r()}))}}}const C="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function N(e=10){return Array.from(Array(e)).map((()=>C[Math.floor(Math.random()*C.length)])).join("")}function j(){return Date.now()}var R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},M={exports:{}},_={exports:{}};_.exports=function(e,n){var t,i,s,r,o,a,l,u;for(t=3&e.length,i=e.length-t,s=n,o=3432918353,a=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,s=27492+(65535&(r=5*(65535&(s=(s^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(l=0,t){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:s^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return s^=e.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0};var D=_.exports,U={exports:{}};!function(e){e.exports=function(e,n){for(var t,i=e.length,s=n^i,r=0;i>=4;)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+((1540483477*(t>>>16)&65535)<<16),s=1540483477*(65535&s)+((1540483477*(s>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),i-=4,++r;switch(i){case 3:s^=(255&e.charCodeAt(r+2))<<16;case 2:s^=(255&e.charCodeAt(r+1))<<8;case 1:s=1540483477*(65535&(s^=255&e.charCodeAt(r)))+((1540483477*(s>>>16)&65535)<<16)}return s=1540483477*(65535&(s^=s>>>13))+((1540483477*(s>>>16)&65535)<<16),(s^=s>>>15)>>>0}}(U);var P=D,B=U.exports;M.exports=P;var z=M.exports.murmur3=P;M.exports.murmur2=B;class F{constructor(e,n){var t,i;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(i=null==n?void 0:n.sendTimeout)&&void 0!==i?i:250,this.paused=(null==n?void 0:n.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&this.flush()}))}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval((()=>this.flush()),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const n=new Map;return e.forEach((e=>{const t=z(JSON.stringify(e.meta));let i=n.get(t);i=void 0===i?[e]:[...i,e],n.set(t,i)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var $;e.TransportItemType=void 0,($=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",$.LOG="log",$.MEASUREMENT="measurement",$.TRACE="trace",$.EVENT="event";const V={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function q(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,i=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>l(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}var G;e.InternalLoggerLevel=void 0,(G=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[G.OFF=0]="OFF",G[G.ERROR=1]="ERROR",G[G.WARN=2]="WARN",G[G.INFO=3]="INFO",G[G.VERBOSE=4]="VERBOSE";const W={debug:L,error:L,info:L,prefix:"Faro",warn:L},K=e.InternalLoggerLevel.ERROR,H=Object.assign({},console);let X=H;function J(e){var n;return X=null!==(n=e.unpatchedConsole)&&void 0!==n?n:X,X}function Z(n=H,t=K){const i=W;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:L,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:L,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:L,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:L),i}let Y=W;function Q(e,n){return Y=Z(e,n.internalLoggerLevel),Y}class ee{constructor(){this.unpatchedConsole=H,this.internalLogger=W,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class ne extends ee{isBatched(){return!1}getIgnoreUrls(){return[]}}function te(e,n){var t,i;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const s=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===s)return e;const r=(null==s?void 0:s.scopeSpans)||[],o=(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},s),{scopeSpans:[...r,...o]})]})}function ie(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const i=V[n.type],s=t[i];t=Object.assign(Object.assign({},t),{[i]:void 0===s?[n.payload]:[...s,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:te(t.traces,n.payload.resourceSpans)})}})),t}const se="Error";let re;function oe(n,t,i,s,r){t.debug("Initializing API");const o=function(n,t,i,s,r){let o;return t.debug("Initializing traces API"),{getOTEL:()=>o,getTraceContext:()=>{const e=null==o?void 0:o.trace.getSpanContext(o.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),o={trace:e,context:n}},isOTELInitialized:()=>!!o,pushTraces:n=>{try{const i={type:e.TransportItemType.TRACE,payload:n,meta:s.value};t.debug("Pushing trace\n",i),r.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,s,r);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),function(n,t,i,s,r,o){var l;t.debug("Initializing exceptions API");let u=null;re=null!==(l=i.parseStacktrace)&&void 0!==l?l:re;const c=e=>{t.debug("Changing stacktrace parser"),re=null!=e?e:re};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>re,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:p}={})=>{d=d||n.name||se;const f={meta:s.value,payload:{type:d,value:n.message,timestamp:x(),trace:o.getTraceContext(),context:null!=p?p:{}},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==re?void 0:re(n).frames:void 0)?void 0:c.length)&&(f.payload.stacktrace={frames:c});const g={type:f.payload.type,value:f.payload.value,stackTrace:f.payload.stacktrace,context:f.payload.context};l||!i.dedupe||a(u)||!T(g,u)?(u=g,t.debug("Pushing exception\n",f),r.execute(f)):t.debug("Skipping error push because it is the same as the last one\n",f.payload)}}}(0,t,i,s,r,o)),function(e,n,t,i,s){let r,o,a;n.debug("Initializing meta API");const l=e=>{o&&i.remove(o),o={user:e},i.add(o)},u=e=>{r&&i.remove(r),r={session:e},i.add(r)};return{setUser:l,resetUser:l,setSession:u,resetSession:u,getSession:()=>i.value.session,setView:e=>{a&&i.remove(a),a={view:e},i.add(a)},getView:()=>i.value.view}}(0,t,0,s)),function(n,t,i,s,r,o){t.debug("Initializing logs API");let l=null;return{pushLog:(n,{context:u,level:c,skipDedupe:d}={})=>{try{const p={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=c?c:I,context:null!=u?u:{},timestamp:x(),trace:o.getTraceContext()},meta:s.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!a(l)&&T(f,l))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing log\n",p),r.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,s,r,o)),function(n,t,i,s,r,o){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c}={})=>{var d;try{const p={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:o.getTraceContext(),timestamp:null!==(d=n.timestamp)&&void 0!==d?d:x(),context:null!=c?c:{}}),meta:s.value},f={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&i.dedupe&&!a(l)&&T(f,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing measurement\n",p),r.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,s,r,o)),function(n,t,i,s,r,o){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d}={})=>{try{const p={meta:s.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:u,timestamp:x(),trace:o.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!a(l)&&T(f,l))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing event\n",p),r.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,s,r,o))}const ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;class le extends ee{constructor(){super(...arguments),this.api={},this.transports={}}}const ue="1.2.9";const ce="_faroInternal";function de(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(ae,ce,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function pe(){return ce in ae}function fe(n,t,i,s,r,o,a){return t.debug("Initializing Faro"),e.faro={api:o,config:i,instrumentations:a,internalLogger:t,metas:s,pause:r.pause,transports:r,unpatchedConsole:n,unpause:r.unpause},de(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in ae)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(ae,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function ge(e){const n=J(e),t=Q(n,e);if(pe()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const i=function(e,n,t){let i=[],s=[];const r=()=>i.reduce(((e,n)=>Object.assign(e,d(n)?n():n)),{}),o=()=>{if(s.length){const e=r();s.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),o()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),o()},addListener:e=>{n.debug("Adding metas listener\n",e),s.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),s=s.filter((n=>n!==e))},get value(){return r()}}}(0,t),s=function(e,n,t,i){var s;n.debug("Initializing transports");const r=[];let o=t.paused,a=[];const l=e=>{let n=e;for(const e of a){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},u=e=>{const t=l(e);if(0!==t.length)for(const e of r)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)},c=e=>{var i;const[s]=l([e]);if(void 0!==s)for(const e of r)n.debug(`Transporting item using ${e.name}\n`,s),e.isBatched()?(null===(i=t.batching)||void 0===i?void 0:i.enabled)||e.send([s]):e.send(s)};let d;return(null===(s=t.batching)||void 0===s?void 0:s.enabled)&&(d=new F(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:o})),{add:(...s)=>{n.debug("Adding transports"),s.forEach((s=>{n.debug(`Adding "${s.name}" transport`),r.some((e=>e===s))?n.warn(`Transport ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=n,s.config=t,s.metas=i,r.push(s))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&a.push(q(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{var n;o||((null===(n=t.batching)||void 0===n?void 0:n.enabled)?(null==d||d.addItem(e),c(e)):c(e))},isPaused:()=>o,pause:()=>{n.debug("Pausing transports"),null==d||d.pause(),o=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=r.indexOf(e);-1!==t?r.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...r]},unpause:()=>{n.debug("Unpausing transports"),null==d||d.start(),o=!1}}}(n,t,e,i),r=oe(0,t,e,i,s),o=function(e,n,t,i,s,r){n.debug("Initializing instrumentations");const o=[];return{add:(...a)=>{n.debug("Adding instrumentations"),a.forEach((a=>{n.debug(`Adding "${a.name}" instrumentation`),o.some((e=>e.name===a.name))?n.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=i,a.transports=s,a.api=r,o.push(a),a.initialize())}))},get instrumentations(){return[...o]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const s=o.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);s?(null===(i=(t=o[s]).destroy)||void 0===i||i.call(t),o.splice(s,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,s,r),a=fe(n,t,e,i,s,r,o);return function(e){var n,t;const i={sdk:{version:ue}};let s=e.config.session;(null===(n=e.config.sessionTracking)||void 0===n?void 0:n.enabled)&&(s=e.config.sessionTracking.session),s&&e.api.setSession(s),e.config.app&&(i.app=e.config.app),e.config.user&&(i.user=e.config.user),e.config.view&&(i.view=e.config.view),e.metas.add(i,...null!==(t=e.config.metas)&&void 0!==t?t:[])}(a),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(a),function(e){e.instrumentations.add(...e.config.instrumentations)}(a),a}e.faro={};const be="faro",me={enabled:!0,sendTimeout:250,itemLimit:50},ve="session_start";var he={exports:{}};!function(e,n){!function(t,i){var s="function",r="undefined",o="object",a="string",l="major",u="model",c="name",d="type",p="vendor",f="version",g="architecture",b="console",m="mobile",v="tablet",h="smarttv",w="wearable",y="embedded",S="Amazon",E="Apple",T="ASUS",x="BlackBerry",k="Browser",I="Chrome",O="Firefox",L="Google",A="Huawei",C="LG",N="Microsoft",j="Motorola",R="Opera",M="Samsung",_="Sharp",D="Sony",U="Xiaomi",P="Zebra",B="Facebook",z="Chromium OS",F="Mac OS",$=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},V=function(e,n){return typeof e===a&&-1!==q(n).indexOf(q(e))},q=function(e){return e.toLowerCase()},G=function(e,n){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof n===r?e:e.substring(0,350)},W=function(e,n){for(var t,r,a,l,u,c,d=0;d<n.length&&!u;){var p=n[d],f=n[d+1];for(t=r=0;t<p.length&&!u&&p[t];)if(u=p[t++].exec(e))for(a=0;a<f.length;a++)c=u[++r],typeof(l=f[a])===o&&l.length>0?2===l.length?typeof l[1]==s?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==s||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):i:this[l[0]]=c?l[1].call(this,c,l[2]):i:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):i):this[l]=c||i;d+=2}},K=function(e,n){for(var t in n)if(typeof n[t]===o&&n[t].length>0){for(var s=0;s<n[t].length;s++)if(V(n[t][s],e))return"?"===t?i:t}else if(V(n[t],e))return"?"===t?i:t;return e},H={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,f],[/opios[\/ ]+([\w\.]+)/i],[f,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[c,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[c,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[c,"UC"+k]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[c,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+k],f],[/\bfocus\/([\w\.]+)/i],[f,[c,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[c,"MIUI "+k]],[/fxios\/([-\w\.]+)/i],[f,[c,O]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+k]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+k],f],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,B],f],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[c,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[c,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[c,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[c,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,I+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[c,"Android "+k]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[f,K,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[c,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[c,O+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[c,f],[/(cobalt)\/([\w\.]+)/i],[c,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,q]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,q]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[p,M],[d,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[p,M],[d,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[p,E],[d,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[p,E],[d,v]],[/(macintosh);/i],[u,[p,E]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[p,_],[d,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[p,A],[d,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[p,A],[d,m]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[p,U],[d,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[p,U],[d,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[p,"OPPO"],[d,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[p,"Vivo"],[d,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[p,"Realme"],[d,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[p,j],[d,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[p,j],[d,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[p,C],[d,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[p,C],[d,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[p,"Lenovo"],[d,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[p,"Nokia"],[d,m]],[/(pixel c)\b/i],[u,[p,L],[d,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[p,L],[d,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[p,D],[d,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[p,D],[d,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[p,"OnePlus"],[d,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[p,S],[d,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[p,S],[d,m]],[/(playbook);[-\w\),; ]+(rim)/i],[u,p,[d,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[p,x],[d,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[p,T],[d,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[p,T],[d,m]],[/(nexus 9)/i],[u,[p,"HTC"],[d,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[u,/_/g," "],[d,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[p,"Acer"],[d,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[p,"Meizu"],[d,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,u,[d,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,u,[d,v]],[/(surface duo)/i],[u,[p,N],[d,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[p,"Fairphone"],[d,m]],[/(u304aa)/i],[u,[p,"AT&T"],[d,m]],[/\bsie-(\w*)/i],[u,[p,"Siemens"],[d,m]],[/\b(rct\w+) b/i],[u,[p,"RCA"],[d,v]],[/\b(venue[\d ]{2,7}) b/i],[u,[p,"Dell"],[d,v]],[/\b(q(?:mv|ta)\w+) b/i],[u,[p,"Verizon"],[d,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[p,"Barnes & Noble"],[d,v]],[/\b(tm\d{3}\w+) b/i],[u,[p,"NuVision"],[d,v]],[/\b(k88) b/i],[u,[p,"ZTE"],[d,v]],[/\b(nx\d{3}j) b/i],[u,[p,"ZTE"],[d,m]],[/\b(gen\d{3}) b.+49h/i],[u,[p,"Swiss"],[d,m]],[/\b(zur\d{3}) b/i],[u,[p,"Swiss"],[d,v]],[/\b((zeki)?tb.*\b) b/i],[u,[p,"Zeki"],[d,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],u,[d,v]],[/\b(ns-?\w{0,9}) b/i],[u,[p,"Insignia"],[d,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[p,"NextBook"],[d,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],u,[d,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],u,[d,m]],[/\b(ph-1) /i],[u,[p,"Essential"],[d,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[p,"Envizen"],[d,v]],[/\b(trio[-\w\. ]+) b/i],[u,[p,"MachSpeed"],[d,v]],[/\btu_(1491) b/i],[u,[p,"Rotor"],[d,v]],[/(shield[\w ]+) b/i],[u,[p,"Nvidia"],[d,v]],[/(sprint) (\w+)/i],[p,u,[d,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[p,N],[d,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[p,P],[d,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[p,P],[d,m]],[/smart-tv.+(samsung)/i],[p,[d,h]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[p,M],[d,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,C],[d,h]],[/(apple) ?tv/i],[p,[u,E+" TV"],[d,h]],[/crkey/i],[[u,I+"cast"],[p,L],[d,h]],[/droid.+aft(\w+)( bui|\))/i],[u,[p,S],[d,h]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[p,_],[d,h]],[/(bravia[\w ]+)( bui|\))/i],[u,[p,D],[d,h]],[/(mitv-\w{5}) bui/i],[u,[p,U],[d,h]],[/Hbbtv.*(technisat) (.*);/i],[p,u,[d,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,G],[u,G],[d,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,u,[d,b]],[/droid.+; (shield) bui/i],[u,[p,"Nvidia"],[d,b]],[/(playstation [345portablevi]+)/i],[u,[p,D],[d,b]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[p,N],[d,b]],[/((pebble))app/i],[p,u,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[p,E],[d,w]],[/droid.+; (glass) \d/i],[u,[p,L],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[u,[p,P],[d,w]],[/(quest( 2| pro)?)/i],[u,[p,B],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,y]],[/(aeobc)\b/i],[u,[p,S],[d,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[d,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,v]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,m]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[c,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[f,K,H]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[f,K,H]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,F],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,f],[/\(bb(10);/i],[f,[c,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[c,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[c,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[c,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[c,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[c,z],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,f],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[c,f]]},J=function(e,n){if(typeof e===o&&(n=e,e=i),!(this instanceof J))return new J(e,n).getResult();var b=typeof t!==r&&t.navigator?t.navigator:i,h=e||(b&&b.userAgent?b.userAgent:""),w=b&&b.userAgentData?b.userAgentData:i,y=n?function(e,n){var t={};for(var i in e)n[i]&&n[i].length%2==0?t[i]=n[i].concat(e[i]):t[i]=e[i];return t}(X,n):X,S=b&&b.userAgent==h;return this.getBrowser=function(){var e,n={};return n[c]=i,n[f]=i,W.call(n,h,y.browser),n[l]=typeof(e=n[f])===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i,S&&b&&b.brave&&typeof b.brave.isBrave==s&&(n[c]="Brave"),n},this.getCPU=function(){var e={};return e[g]=i,W.call(e,h,y.cpu),e},this.getDevice=function(){var e={};return e[p]=i,e[u]=i,e[d]=i,W.call(e,h,y.device),S&&!e[d]&&w&&w.mobile&&(e[d]=m),S&&"Macintosh"==e[u]&&b&&typeof b.standalone!==r&&b.maxTouchPoints&&b.maxTouchPoints>2&&(e[u]="iPad",e[d]=v),e},this.getEngine=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.engine),e},this.getOS=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.os),S&&!e[c]&&w&&"Unknown"!=w.platform&&(e[c]=w.platform.replace(/chrome os/i,z).replace(/macos/i,F)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return h},this.setUA=function(e){return h=typeof e===a&&e.length>350?G(e,350):e,this},this.setUA(h),this};J.VERSION="1.0.36",J.BROWSER=$([c,f,l]),J.CPU=$([g]),J.DEVICE=$([u,p,d,b,m,h,v,w,y]),J.ENGINE=J.OS=$([c,f]),e.exports&&(n=e.exports=J),n.UAParser=J;var Z=typeof t!==r&&(t.jQuery||t.Zepto);if(Z&&!Z.ua){var Y=new J;Z.ua=Y.getResult(),Z.ua.get=function(){return Y.getUA()},Z.ua.set=function(e){Y.setUA(e);var n=Y.getResult();for(var t in n)Z.ua[t]=n[t]}}}("object"==typeof window?window:R)}(he,he.exports);var we=he.exports;const ye=()=>{const e=new we.UAParser,{name:n,version:t}=e.getBrowser(),{name:i,version:s}=e.getOS(),r=e.getUA(),o=navigator.language,a=navigator.userAgent.includes("Mobi"),l=function(){if(!n||!t)return;if("userAgentData"in navigator)return navigator.userAgentData.brands;return}(),u="unknown";return{browser:{name:null!=n?n:u,version:null!=t?t:u,os:`${null!=i?i:u} ${null!=s?s:u}`,userAgent:null!=r?r:u,language:null!=o?o:u,mobile:a,brands:null!=l?l:u}}},Se=()=>({page:{url:location.href}}),Ee=[ye,Se];function Te(e){return{id:N(),attributes:e}}const xe={name:"default"},ke="sessionStorage",Ie="localStorage";function Oe(n){var t;try{let e;e=window[n];const t="__faro_storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(i){return null===(t=e.faro.internalLogger)||void 0===t||t.info(`Web storage of type ${n} is not available. Reason: ${i}`),!1}}function Le(e,n){return Re(n)?window[n].getItem(e):null}function Ae(e,n,t){if(Re(t))try{window[t].setItem(e,n)}catch(e){}}function Ce(e,n){Re(n)&&window[n].removeItem(e)}const Ne=Oe(Ie),je=Oe(ke);function Re(e){return e===Ie?Ne:e===ke&&je}function Me(e,n){let t,i=!1;const s=()=>{null!=t?(e(...t),t=null,setTimeout(s,n)):i=!1};return(...r)=>{i?t=r:(e(...r),i=!0,setTimeout(s,n))}}function _e(){var n,t,i;const s=e.faro.config.sessionTracking;let r=null!==(i=null!==(t=null===(n=null==s?void 0:s.sampler)||void 0===n?void 0:n.call(s,{metas:e.faro.metas.value}))&&void 0!==t?t:null==s?void 0:s.samplingRate)&&void 0!==i?i:1;if("number"!=typeof r){r=0}return Math.random()<r}const De="__FARO_SESSION__",Ue=144e5,Pe=9e5,Be=96e4,ze={enabled:!1,persistent:!1,maxSessionPersistenceTime:Be};function Fe({sessionId:e=N(),isSampled:n=!0}={}){const t=j();return{sessionId:e,lastActivity:t,started:t,isSampled:n}}function $e(e){if(null==e)return!1;const n=j();if(!(n-e.started<Ue))return!1;return n-e.lastActivity<Pe}function Ve({fetchUserSession:n,storeUserSession:t}){return function(){var i,s,r,o;if(!n||!t)return;const a=n();if($e(a))t(Object.assign(Object.assign({},a),{lastActivity:j()}));else{let n=qe(Fe({isSampled:_e()}),a);t(n),null===(i=e.faro.api)||void 0===i||i.setSession(n.sessionMeta),null===(r=null===(s=e.faro.config.sessionTracking)||void 0===s?void 0:s.onSessionChange)||void 0===r||r.call(s,null!==(o=null==a?void 0:a.sessionMeta)&&void 0!==o?o:null,n.sessionMeta)}}}function qe(n,t){var i,s;return Object.assign(Object.assign({},n),{sessionMeta:{id:n.sessionId,attributes:Object.assign(Object.assign(Object.assign({},null!==(s=null===(i=e.faro.metas.value.session)||void 0===i?void 0:i.attributes)&&void 0!==s?s:{}),null!=t?{previousSession:t.sessionId}:{}),{isSampled:n.isSampled.toString()})}})}class Ge{constructor(){this.updateSession=Me((()=>this.updateUserSession()),1e3),this.updateUserSession=Ve({fetchUserSession:Ge.fetchUserSession,storeUserSession:Ge.storeUserSession}),this.init()}static removeUserSession(){Ce(De,Ge.storageTypeLocal)}static storeUserSession(e){Ae(De,JSON.stringify(e),Ge.storageTypeLocal)}static fetchUserSession(){const e=Le(De,Ge.storageTypeLocal);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),window.addEventListener("storage",(n=>{var t,i,s;if(n.key!==De)return;const r=JSON.parse(null!==(t=n.newValue)&&void 0!==t?t:""),o=JSON.parse(null!==(i=n.oldValue)&&void 0!==i?i:"");r.sessionId!==o.sessionId&&(null===(s=e.faro.api)||void 0===s||s.setSession(r.sessionMeta))})),e.faro.metas.addListener((function(n){const t=n.session,i=Ge.fetchUserSession();if(t&&t.id!==(null==i?void 0:i.sessionId)){const n=qe(Fe({sessionId:t.id,isSampled:_e()}),i);Ge.storeUserSession(n),e.faro.api.setSession(n.sessionMeta)}}))}}Ge.storageTypeLocal=Ie;class We{constructor(){this.updateSession=Me((()=>this.updateUserSession()),1e3),this.updateUserSession=Ve({fetchUserSession:We.fetchUserSession,storeUserSession:We.storeUserSession}),this.init()}static removeUserSession(){Ce(De,We.storageTypeSession)}static storeUserSession(e){Ae(De,JSON.stringify(e),We.storageTypeSession)}static fetchUserSession(){const e=Le(De,We.storageTypeSession);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),e.faro.metas.addListener((function(n){const t=n.session,i=We.fetchUserSession();if(t&&t.id!==(null==i?void 0:i.sessionId)){const n=qe(Fe({sessionId:t.id,isSampled:_e()}),i);We.storeUserSession(n),e.faro.api.setSession(n.sessionMeta)}}))}}We.storageTypeSession=ke;class Ke extends le{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=ue}sendSessionStartEvent(e){var n,t;const i=e.session;if(i&&i.id!==(null===(n=this.notifiedSession)||void 0===n?void 0:n.id)){if(this.notifiedSession&&this.notifiedSession.id===(null===(t=i.attributes)||void 0===t?void 0:t.previousSession))return this.api.pushEvent("session_extend",{},void 0,{skipDedupe:!0}),void(this.notifiedSession=i);this.notifiedSession=i,this.api.pushEvent(ve,{},void 0,{skipDedupe:!0})}}createInitialSessionMeta(e){var n,t,i;let s=(e.persistent?Ge:We).fetchUserSession();if(e.persistent&&e.maxSessionPersistenceTime&&s){const n=j();s.lastActivity<n-e.maxSessionPersistenceTime&&(Ge.removeUserSession(),s=null)}let r=null===(n=e.session)||void 0===n?void 0:n.id,o=null===(t=e.session)||void 0===t?void 0:t.attributes;$e(s)?(r=null==s?void 0:s.sessionId,o=Object.assign(Object.assign({},null===(i=null==s?void 0:s.sessionMeta)||void 0===i?void 0:i.attributes),{isSampled:s.isSampled.toString()}),this.api.pushEvent("session_resume",{},void 0,{skipDedupe:!0})):(r=null!=r?r:Te().id,this.api.pushEvent(ve,{},void 0,{skipDedupe:!0}));return{id:r,attributes:Object.assign({isSampled:_e().toString()},o)}}initialize(){var e,t;this.logDebug("init session instrumentation");const i=this.config.sessionTracking;if(null==i?void 0:i.enabled){const s=(null===(e=this.config.sessionTracking)||void 0===e?void 0:e.persistent)?Ge:We,r=this.createInitialSessionMeta(i);s.storeUserSession(Fe({sessionId:r.id,isSampled:Boolean(r.attributes.isSampled)})),this.notifiedSession=r,this.api.setSession(r);const{updateSession:o}=new s;null===(t=this.transports)||void 0===t||t.addBeforeSendHooks((e=>{var t;o();const i=null===(t=e.meta.session)||void 0===t?void 0:t.attributes;if(i&&Boolean(null==i?void 0:i.isSampled)){const t=n(i,["isSampled"]);return e.meta.session=Object.assign(Object.assign({},e.meta.session),{attributes:t}),e}return null}))}else this.sendSessionStartEvent(this.metas.value);this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class He extends le{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=ue}initialize(){this.logDebug("Initializing\n",this.options),O.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:He.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...n)}}}))}}He.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const Xe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Je=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ze=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ye="address at ",Qe=Ye.length,en=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,nn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tn="safari-extension",sn="safari-web-extension",rn=/Minified React error #\d+;/i;function on(e,n,t,i){const s={filename:e||document.location.href,function:n||"?"};return void 0!==t&&(s.lineno=t),void 0!==i&&(s.colno=i),s}function an(e,n){const t=null==e?void 0:e.includes(tn),i=!t&&(null==e?void 0:e.includes(sn));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${tn}:${n}`:`${sn}:${n}`]:[e,n]}function ln(e){let n=[];e.stacktrace?n=e.stacktrace.split("\n").filter(((e,n)=>n%2==0)):e.stack&&(n=e.stack.split("\n"));const t=n.reduce(((n,t,i)=>{let s,r,o,a,l;if(s=Je.exec(t)){if(r=s[1],o=s[2],a=s[3],l=s[4],null==o?void 0:o.startsWith("eval")){const e=Ze.exec(o);e&&(o=e[1],a=e[2],l=e[3])}o=(null==o?void 0:o.startsWith(Ye))?o.substring(Qe):o,[r,o]=an(r,o)}else if(s=en.exec(t)){if(r=s[1],o=s[3],a=s[4],l=s[5],o&&o.includes(" > eval")){const e=nn.exec(o);e&&(r=r||"eval",o=e[1],a=e[2])}else 0===i&&!l&&u(e.columnNumber)&&(l=String(e.columnNumber+1));[r,o]=an(r,o)}return(o||r)&&n.push(on(o,r,a?Number(a):void 0,l?Number(l):void 0)),n}),[]);return rn.test(e.message)?t.slice(1):t}function un(e){return{frames:ln(e)}}function cn(e){let n,t,i,s,r=[];if(h(e)&&e.error)n=e.error.message,t=e.error.name,r=ln(e.error);else if((i=w(e))||y(e)){const{name:s,message:r}=e;t=null!=s?s:i?"DOMError":"DOMException",n=r?`${t}: ${r}`:t}else v(e)?(n=e.message,r=ln(e)):(c(e)||(s=b(e)))&&(t=s?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,r]}function dn(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,s,r,o,a]=t;let u,c,d=[];const p=l(i),f=on(s,"?",r,o);a||!p?([u,c,d]=cn(null!=a?a:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(Xe),s=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:se;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,s]}(i),d=[f]),u&&e.pushError(new Error(u),{type:c,stackFrames:d})}finally{null==n||n.apply(window,t)}}}class pn extends le{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=ue}initialize(){var e;this.logDebug("Initializing"),dn(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let s,r,o=n;o.reason?o=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(o=null===(i=n.detail)||void 0===i?void 0:i.reason);let a=[];f(o)?(s=`Non-Error promise rejection captured with value: ${String(o)}`,r="UnhandledRejection"):[s,r,a]=cn(o),s&&e.pushError(new Error(s),{type:r,stackFrames:a})}))}}class fn extends le{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=ue}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent("view_changed",{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var gn,bn,mn,vn,hn,wn=-1,yn=function(e){addEventListener("pageshow",(function(n){n.persisted&&(wn=n.timeStamp,e(n))}),!0)},Sn=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},En=function(){var e=Sn();return e&&e.activationStart||0},Tn=function(e,n){var t=Sn(),i="navigate";return wn>=0?i="back-forward-cache":t&&(document.prerendering||En()>0?i="prerender":document.wasDiscarded?i="restore":t.type&&(i=t.type.replace(/_/g,"-"))),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},xn=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},kn=function(e,n,t,i){var s,r;return function(o){n.value>=0&&(o||i)&&((r=n.value-(s||0))||void 0===s)&&(s=n.value,n.delta=r,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},In=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},On=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Ln=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},An=-1,Cn=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Nn=function(e){"hidden"===document.visibilityState&&An>-1&&(An="visibilitychange"===e.type?e.timeStamp:0,Rn())},jn=function(){addEventListener("visibilitychange",Nn,!0),addEventListener("prerenderingchange",Nn,!0)},Rn=function(){removeEventListener("visibilitychange",Nn,!0),removeEventListener("prerenderingchange",Nn,!0)},Mn=function(){return An<0&&(An=Cn(),jn(),yn((function(){setTimeout((function(){An=Cn(),jn()}),0)}))),{get firstHiddenTime(){return An}}},_n=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Dn=[1800,3e3],Un=function(e,n){n=n||{},_n((function(){var t,i=Mn(),s=Tn("FCP"),r=xn("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(r.disconnect(),e.startTime<i.firstHiddenTime&&(s.value=Math.max(e.startTime-En(),0),s.entries.push(e),t(!0)))}))}));r&&(t=kn(e,s,Dn,n.reportAllChanges),yn((function(i){s=Tn("FCP"),t=kn(e,s,Dn,n.reportAllChanges),In((function(){s.value=performance.now()-i.timeStamp,t(!0)}))})))}))},Pn=[.1,.25],Bn={passive:!0,capture:!0},zn=new Date,Fn=function(e,n){gn||(gn=n,bn=e,mn=new Date,qn(removeEventListener),$n())},$n=function(){if(bn>=0&&bn<mn-zn){var e={entryType:"first-input",name:gn.type,target:gn.target,cancelable:gn.cancelable,startTime:gn.timeStamp,processingStart:gn.timeStamp+bn};vn.forEach((function(n){n(e)})),vn=[]}},Vn=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){Fn(e,n),s()},i=function(){s()},s=function(){removeEventListener("pointerup",t,Bn),removeEventListener("pointercancel",i,Bn)};addEventListener("pointerup",t,Bn),addEventListener("pointercancel",i,Bn)}(n,e):Fn(n,e)}},qn=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,Vn,Bn)}))},Gn=[100,300],Wn=0,Kn=1/0,Hn=0,Xn=function(e){e.forEach((function(e){e.interactionId&&(Kn=Math.min(Kn,e.interactionId),Hn=Math.max(Hn,e.interactionId),Wn=Hn?(Hn-Kn)/7+1:0)}))},Jn=function(){return hn?Wn:performance.interactionCount||0},Zn=function(){"interactionCount"in performance||hn||(hn=xn("event",Xn,{type:"event",buffered:!0,durationThreshold:0}))},Yn=[200,500],Qn=0,et=function(){return Jn()-Qn},nt=[],tt={},it=function(e){var n=nt[nt.length-1],t=tt[e.interactionId];if(t||nt.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};tt[i.id]=i,nt.push(i)}nt.sort((function(e,n){return n.latency-e.latency})),nt.splice(10).forEach((function(e){delete tt[e.id]}))}},st=[2500,4e3],rt={},ot=[800,1800],at=function e(n){document.prerendering?_n((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class lt extends le{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=ue}initialize(){this.logDebug("Initializing"),Object.entries(lt.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function ut(e={}){const n=[new pn,new lt,new Ke,new fn];return!1!==e.captureConsole&&n.push(new He({disabledLevels:e.captureConsoleDisabledLevels})),n}lt.mapping={cls:function(e,n){n=n||{},Un(Ln((function(){var t,i=Tn("CLS",0),s=0,r=[],o=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=r[0],t=r[r.length-1];s&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(s+=e.value,r.push(e)):(s=e.value,r=[e])}})),s>i.value&&(i.value=s,i.entries=r,t())},a=xn("layout-shift",o);a&&(t=kn(e,i,Pn,n.reportAllChanges),On((function(){o(a.takeRecords()),t(!0)})),yn((function(){s=0,i=Tn("CLS",0),t=kn(e,i,Pn,n.reportAllChanges),In((function(){return t()}))})),setTimeout(t,0))})))},fcp:Un,fid:function(e,n){n=n||{},_n((function(){var t,i=Mn(),s=Tn("FID"),r=function(e){e.startTime<i.firstHiddenTime&&(s.value=e.processingStart-e.startTime,s.entries.push(e),t(!0))},o=function(e){e.forEach(r)},a=xn("first-input",o);t=kn(e,s,Gn,n.reportAllChanges),a&&On(Ln((function(){o(a.takeRecords()),a.disconnect()}))),a&&yn((function(){var i;s=Tn("FID"),t=kn(e,s,Gn,n.reportAllChanges),vn=[],bn=-1,gn=null,qn(addEventListener),i=r,vn.push(i),$n()}))}))},inp:function(e,n){n=n||{},_n((function(){var t;Zn();var i,s=Tn("INP"),r=function(e){e.forEach((function(e){e.interactionId&&it(e),"first-input"===e.entryType&&!nt.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&it(e)}));var n,t=(n=Math.min(nt.length-1,Math.floor(et()/50)),nt[n]);t&&t.latency!==s.value&&(s.value=t.latency,s.entries=t.entries,i())},o=xn("event",r,{durationThreshold:null!==(t=n.durationThreshold)&&void 0!==t?t:40});i=kn(e,s,Yn,n.reportAllChanges),o&&("interactionId"in PerformanceEventTiming.prototype&&o.observe({type:"first-input",buffered:!0}),On((function(){r(o.takeRecords()),s.value<0&&et()>0&&(s.value=0,s.entries=[]),i(!0)})),yn((function(){nt=[],Qn=Jn(),s=Tn("INP"),i=kn(e,s,Yn,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},_n((function(){var t,i=Mn(),s=Tn("LCP"),r=function(e){var n=e[e.length-1];n&&n.startTime<i.firstHiddenTime&&(s.value=Math.max(n.startTime-En(),0),s.entries=[n],t())},o=xn("largest-contentful-paint",r);if(o){t=kn(e,s,st,n.reportAllChanges);var a=Ln((function(){rt[s.id]||(r(o.takeRecords()),o.disconnect(),rt[s.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),On(a),yn((function(i){s=Tn("LCP"),t=kn(e,s,st,n.reportAllChanges),In((function(){s.value=performance.now()-i.timeStamp,rt[s.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=Tn("TTFB"),i=kn(e,t,ot,n.reportAllChanges);at((function(){var s=Sn();if(s){var r=s.responseStart;if(r<=0||r>performance.now())return;t.value=Math.max(r-En(),0),t.entries=[s],i(!0),yn((function(){t=Tn("TTFB",0),(i=kn(e,t,ot,n.reportAllChanges))(!0)}))}}))}};const ct="browser",dt=()=>({k6:{isK6Browser:!0}});class pt extends ne{constructor(e){var n,t,i,s;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=ue,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(n=e.defaultRateLimitBackoffMs)&&void 0!==n?n:5e3,this.getNow=null!==(t=e.getNow)&&void 0!==t?t:()=>Date.now(),this.promiseBuffer=A({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(s=e.concurrency)&&void 0!==s?s:5})}send(e){return t(this,void 0,void 0,(function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add((()=>{var t;const i=JSON.stringify(ie(e)),{url:s,requestOptions:r,apiKey:o}=this.options,a=null!=r?r:{},{headers:l}=a,u=n(a,["headers"]),c=null===(t=this.metas.value.session)||void 0===t?void 0:t.id;return fetch(s,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},null!=l?l:{}),o?{"x-api-key":o}:{}),c?{"x-faro-session-id":c}:{}),body:i,keepalive:i.length<=6e4},null!=u?u:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e.text().catch(L),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(i),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}isBatched(){return!0}getRetryAfterDate(e){const n=this.getNow(),t=e.headers.get("Retry-After");if(t){const e=Number(t);if(!isNaN(e))return new Date(1e3*e+n);const i=Date.parse(t);if(!isNaN(i))return new Date(i)}return new Date(n+this.rateLimitBackoffMs)}}function ft(e){var n,t,i,s,r,o,a,l,u,d,p;const f=[],g=Z(e.unpatchedConsole,e.internalLoggerLevel);e.transports?((e.url||e.apiKey)&&g.error('if "transports" is defined, "url" and "apiKey" should not be defined'),f.push(...e.transports)):e.url?f.push(new pt({url:e.url,apiKey:e.apiKey})):g.error('either "url" or "transports" must be defined');const b={app:e.app,batching:Object.assign(Object.assign({},me),e.batching),dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||be,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:ut(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:K,isolate:null!==(s=e.isolate)&&void 0!==s&&s,metas:function(){const n=Ee;return e.metas&&n.push(...e.metas),c(window.k6)?[...n,dt]:n}(),parseStacktrace:un,paused:null!==(r=e.paused)&&void 0!==r&&r,preventGlobalExposure:null!==(o=e.preventGlobalExposure)&&void 0!==o&&o,transports:f,unpatchedConsole:null!==(a=e.unpatchedConsole)&&void 0!==a?a:H,beforeSend:e.beforeSend,eventDomain:null!==(l=e.eventDomain)&&void 0!==l?l:ct,ignoreErrors:e.ignoreErrors,sessionTracking:Object.assign(Object.assign({},ze),e.sessionTracking),session:null!==(u=e.session)&&void 0!==u?u:Te(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:xe};return(null===(p=b.sessionTracking)||void 0===p?void 0:p.enabled)&&delete b.session,b}return e.BaseExtension=ee,e.BaseInstrumentation=le,e.BaseTransport=ne,e.ConsoleInstrumentation=He,e.ConsoleTransport=class extends ne{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=ue}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",ie([n]))}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.ErrorsInstrumentation=pn,e.FetchTransport=pt,e.MAX_SESSION_PERSISTENCE_TIME=Be,e.MAX_SESSION_PERSISTENCE_TIME_BUFFER=6e4,e.PersistentSessionsManager=Ge,e.SESSION_EXPIRATION_TIME=Ue,e.SESSION_INACTIVITY_TIME=Pe,e.STORAGE_KEY=De,e.SessionInstrumentation=Ke,e.VERSION=ue,e.ViewInstrumentation=fn,e.VolatileSessionsManager=We,e.WebVitalsInstrumentation=lt,e.allLogLevels=O,e.browserMeta=ye,e.buildStackFrame=on,e.createInternalLogger=Z,e.createPromiseBuffer=A,e.createSession=Te,e.deepEqual=T,e.defaultEventDomain=ct,e.defaultExceptionType=se,e.defaultGlobalObjectKey=be,e.defaultInternalLoggerLevel=K,e.defaultLogLevel=I,e.defaultMetas=Ee,e.defaultViewMeta=xe,e.genShortID=N,e.getCurrentTimestamp=x,e.getDataFromSafariExtensions=an,e.getInternalFaroFromGlobalObject=function(){return ae[ce]},e.getStackFramesFromError=ln,e.getTransportBody=ie,e.getWebInstrumentations=ut,e.globalObject=ae,e.initializeFaro=function(e){const n=ft(e);if(n)return ge(n)},e.internalGlobalObjectKey=ce,e.isArray=p,e.isBoolean=e=>i(e,"boolean"),e.isDomError=w,e.isDomException=y,e.isElement=e=>S&&r(e,Element),e.isElementDefined=S,e.isError=v,e.isErrorDefined=m,e.isErrorEvent=h,e.isEvent=b,e.isEventDefined=g,e.isFunction=d,e.isInstanceOf=r,e.isInt=e=>u(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=pe,e.isMap=e=>E&&r(e,Map),e.isMapDefined=E,e.isNull=a,e.isNumber=u,e.isObject=c,e.isPrimitive=f,e.isRegExp=e=>s(e,"RegExp"),e.isString=l,e.isSymbol=e=>i(e,"symbol"),e.isSyntheticEvent=e=>c(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>d(null==e?void 0:e.then),e.isToString=s,e.isTypeof=i,e.isUndefined=o,e.makeCoreConfig=ft,e.noop=L,e.pageMeta=Se,e.parseStacktrace=un,e.sdkMeta=()=>({sdk:{name:"@grafana/faro-core",version:ue,integrations:e.faro.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}}),e.setInternalFaroOnGlobalObject=de,e.transportItemTypeToBodyKey=V,e}({});
1
+ var GrafanaFaroWebSdk=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function i(e,n){try{return e instanceof n}catch(e){return!1}}const r=e=>n(e,"undefined"),o=e=>n(e,"null"),s=e=>n(e,"string"),a=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),l=e=>!o(e)&&n(e,"object"),u=e=>n(e,"function"),c=e=>t(e,"Array"),d=e=>!l(e)&&!u(e),p=!r(Event),f=e=>p&&i(e,Event),g="undefined"!=typeof Error,v=e=>g&&i(e,Error),m=e=>t(e,"ErrorEvent"),b=e=>t(e,"DOMError"),h=e=>t(e,"DOMException"),w="undefined"!=typeof Element,y="undefined"!=typeof Map;function E(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const i=c(e),r=c(t);if(i!==r)return!1;if(i&&r){const n=e.length;if(n!==t.length)return!1;for(let i=n;0!=i--;)if(!E(e[i],t[i]))return!1;return!0}const o=l(e),s=l(t);if(o!==s)return!1;if(e&&t&&o&&s){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let e of n)if(!i.includes(e))return!1;for(let i of n)if(!E(e[i],t[i]))return!1;return!0}return!1}function S(){return(new Date).toISOString()}var T;e.LogLevel=void 0,(T=e.LogLevel||(e.LogLevel={})).TRACE="trace",T.DEBUG="debug",T.INFO="info",T.LOG="log",T.WARN="warn",T.ERROR="error";const x=e.LogLevel.LOG,k=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function I(){}function O(e){const{size:n,concurrency:t}=e,i=[];let r=0;const o=()=>{if(r<t&&i.length){const{producer:e,resolve:n,reject:t}=i.shift();r++,e().then((e=>{r--,o(),n(e)}),(e=>{r--,o(),t(e)}))}};return{add:e=>{if(i.length+r>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{i.push({producer:e,resolve:n,reject:t}),o()}))}}}const L="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function N(e=10){return Array.from(Array(e)).map((()=>L[Math.floor(Math.random()*L.length)])).join("")}function A(){return Date.now()}var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},j={exports:{}},R={exports:{}};R.exports=function(e,n){var t,i,r,o,s,a,l,u;for(t=3&e.length,i=e.length-t,r=n,s=3432918353,a=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,t){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var _=R.exports,M={exports:{}};!function(e){e.exports=function(e,n){for(var t,i=e.length,r=n^i,o=0;i>=4;)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(t>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(t=1540483477*(65535&(t^=t>>>24))+((1540483477*(t>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:r^=(255&e.charCodeAt(o+2))<<16;case 2:r^=(255&e.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}}(M);var D=_,U=M.exports;j.exports=D;var P=j.exports.murmur3=D;j.exports.murmur2=U;class B{constructor(e,n){var t,i;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(i=null==n?void 0:n.sendTimeout)&&void 0!==i?i:250,this.paused=(null==n?void 0:n.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&this.flush()}))}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval((()=>this.flush()),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const n=new Map;return e.forEach((e=>{const t=P(JSON.stringify(e.meta));let i=n.get(t);i=void 0===i?[e]:[...i,e],n.set(t,i)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}var z;e.TransportItemType=void 0,(z=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",z.LOG="log",z.MEASUREMENT="measurement",z.TRACE="trace",z.EVENT="event";const F={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function V(n){return t=>{if(t.type===e.TransportItemType.EXCEPTION&&t.payload){const e=t.payload,i=`${e.type}: ${e.value}`;if(function(e,n){return e.some((e=>s(e)?n.includes(e):!!n.match(e)))}(n,i))return null}return t}}function $(e,n,t,i){var r;n.debug("Initializing transports");const o=[];let s=t.paused,a=[];const l=e=>{let n=e;for(const e of a){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},u=e=>{const t=l(e);if(0!==t.length)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let c;(null===(r=t.batching)||void 0===r?void 0:r.enabled)&&(c=new B(u,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:s}));return{add:(...r)=>{n.debug("Adding transports"),r.forEach((r=>{n.debug(`Adding "${r.name}" transport`);o.some((e=>e===r))?n.warn(`Transport ${r.name} is already added`):(r.unpatchedConsole=e,r.internalLogger=n,r.config=t,r.metas=i,o.push(r))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",a),e.forEach((e=>{e&&a.push(e)}))},addIgnoreErrorsPatterns:(...e)=>{n.debug("Adding ignoreErrorsPatterns\n",e),e.forEach((e=>{e&&a.push(V(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{var i;s||((null===(i=t.batching)||void 0===i?void 0:i.enabled)&&(null==c||c.addItem(e)),(e=>{var i,r;if((null===(i=t.batching)||void 0===i?void 0:i.enabled)&&o.every((e=>e.isBatched())))return;const[s]=l([e]);if(void 0!==s)for(const e of o)n.debug(`Transporting item using ${e.name}\n`,s),e.isBatched()?(null===(r=t.batching)||void 0===r?void 0:r.enabled)||e.send([s]):e.send(s)})(e))},isPaused:()=>s,pause:()=>{n.debug("Pausing transports"),null==c||c.pause(),s=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=o.indexOf(e);-1!==t?o.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{a.filter((n=>!e.includes(n)))},get transports(){return[...o]},unpause:()=>{n.debug("Unpausing transports"),null==c||c.start(),s=!1}}}var G;e.InternalLoggerLevel=void 0,(G=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[G.OFF=0]="OFF",G[G.ERROR=1]="ERROR",G[G.WARN=2]="WARN",G[G.INFO=3]="INFO",G[G.VERBOSE=4]="VERBOSE";const q={debug:I,error:I,info:I,prefix:"Faro",warn:I},W=e.InternalLoggerLevel.ERROR,K=Object.assign({},console);let H=K;function X(e){var n;return H=null!==(n=e.unpatchedConsole)&&void 0!==n?n:H,H}function J(n=K,t=W){const i=q;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:I,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:I,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:I,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:I),i}let Z=q;function Y(e,n){return Z=J(e,n.internalLoggerLevel),Z}class Q{constructor(){this.unpatchedConsole=K,this.internalLogger=q,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}class ee extends Q{isBatched(){return!1}getIgnoreUrls(){return[]}}function ne(e,n){var t,i;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const r=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===r)return e;const o=(null==r?void 0:r.scopeSpans)||[],s=(null===(i=null==n?void 0:n[0])||void 0===i?void 0:i.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},r),{scopeSpans:[...o,...s]})]})}function te(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const i=F[n.type],r=t[i];t=Object.assign(Object.assign({},t),{[i]:void 0===r?[n.payload]:[...r,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:ne(t.traces,n.payload.resourceSpans)})}})),t}const ie="Error";let re;function oe(n,t,i,r,s){t.debug("Initializing API");const a=function(n,t,i,r,o){let s;return t.debug("Initializing traces API"),{getOTEL:()=>s,getTraceContext:()=>{const e=null==s?void 0:s.trace.getSpanContext(s.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),s={trace:e,context:n}},isOTELInitialized:()=>!!s,pushTraces:n=>{try{const i={type:e.TransportItemType.TRACE,payload:n,meta:r.value};t.debug("Pushing trace\n",i),o.execute(i)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,r,s);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(n,t,i,r,s,a){var l;t.debug("Initializing exceptions API");let u=null;re=null!==(l=i.parseStacktrace)&&void 0!==l?l:re;const c=e=>{t.debug("Changing stacktrace parser"),re=null!=e?e:re};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>re,pushError:(n,{skipDedupe:l,stackFrames:c,type:d,context:p}={})=>{d=d||n.name||ie;const f={meta:r.value,payload:{type:d,value:n.message,timestamp:S(),trace:a.getTraceContext(),context:null!=p?p:{}},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==re?void 0:re(n).frames:void 0)?void 0:c.length)&&(f.payload.stacktrace={frames:c});const g={type:f.payload.type,value:f.payload.value,stackTrace:f.payload.stacktrace,context:f.payload.context};l||!i.dedupe||o(u)||!E(g,u)?(u=g,t.debug("Pushing exception\n",f),s.execute(f)):t.debug("Skipping error push because it is the same as the last one\n",f.payload)}}}(0,t,i,r,s,a)),function(e,n,t,i,r){let o,s,a;n.debug("Initializing meta API");const l=e=>{s&&i.remove(s),s={user:e},i.add(s)},u=e=>{o&&i.remove(o),o={session:e},i.add(o)};return{setUser:l,resetUser:l,setSession:u,resetSession:u,getSession:()=>i.value.session,setView:e=>{var n;if((null===(n=null==a?void 0:a.view)||void 0===n?void 0:n.name)===(null==e?void 0:e.name))return;const t=a;a={view:e},i.add(a),t&&i.remove(t)},getView:()=>i.value.view}}(0,t,0,r)),function(n,t,i,r,s,a){t.debug("Initializing logs API");let l=null;return{pushLog:(n,{context:u,level:c,skipDedupe:d}={})=>{try{const p={type:e.TransportItemType.LOG,payload:{message:n.map((e=>{try{return String(e)}catch(e){return""}})).join(" "),level:null!=c?c:x,context:null!=u?u:{},timestamp:S(),trace:a.getTraceContext()},meta:r.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing log\n",p),s.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,r,s,a)),function(n,t,i,r,s,a){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(n,{skipDedupe:u,context:c}={})=>{var d;try{const p={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:a.getTraceContext(),timestamp:null!==(d=n.timestamp)&&void 0!==d?d:S(),context:null!=c?c:{}}),meta:r.value},f={type:p.payload.type,values:p.payload.values,context:p.payload.context};if(!u&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing measurement\n",p),s.execute(p)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,r,s,a)),function(n,t,i,r,s,a){let l=null;return{pushEvent:(n,u,c,{skipDedupe:d}={})=>{try{const p={meta:r.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:u,timestamp:S(),trace:a.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!o(l)&&E(f,l))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);l=f,t.debug("Pushing event\n",p),s.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,r,s,a))}const se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;class ae extends Q{constructor(){super(...arguments),this.api={},this.transports={}}}const le="1.3.1";const ue="_faroInternal";function ce(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(se,ue,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function de(){return ue in se}function pe(n,t,i,r,o,s,a){return t.debug("Initializing Faro"),e.faro={api:s,config:i,instrumentations:a,internalLogger:t,metas:r,pause:o.pause,transports:o,unpatchedConsole:n,unpause:o.unpause},ce(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in se)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(se,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function fe(e){const n=X(e),t=Y(n,e);if(de()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const i=function(e,n,t){let i=[],r=[];const o=()=>i.reduce(((e,n)=>Object.assign(e,u(n)?n():n)),{}),s=()=>{if(r.length){const e=o();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),s()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),s()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return o()}}}(0,t),r=$(n,t,e,i),o=oe(0,t,e,i,r),s=function(e,n,t,i,r,o){n.debug("Initializing instrumentations");const s=[];return{add:(...a)=>{n.debug("Adding instrumentations"),a.forEach((a=>{n.debug(`Adding "${a.name}" instrumentation`),s.some((e=>e.name===a.name))?n.warn(`Instrumentation ${a.name} is already added`):(a.unpatchedConsole=e,a.internalLogger=n,a.config=t,a.metas=i,a.transports=r,a.api=o,s.push(a),a.initialize())}))},get instrumentations(){return[...s]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const r=s.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);r?(null===(i=(t=s[r]).destroy)||void 0===i||i.call(t),s.splice(r,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,r,o),a=pe(n,t,e,i,r,o,s);return function(e){var n,t;const i={sdk:{version:le}},r=null===(n=e.config.sessionTracking)||void 0===n?void 0:n.session;r&&e.api.setSession(r),e.config.app&&(i.app=e.config.app),e.config.user&&(i.user=e.config.user),e.config.view&&(i.view=e.config.view),e.metas.add(i,...null!==(t=e.config.metas)&&void 0!==t?t:[])}(a),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(a),function(e){e.instrumentations.add(...e.config.instrumentations)}(a),a}e.faro={};const ge="faro",ve={enabled:!0,sendTimeout:250,itemLimit:50},me="view_changed",be="session_start",he="session_resume",we="session_extend";var ye={exports:{}};!function(e,n){!function(t,i){var r="function",o="undefined",s="object",a="string",l="major",u="model",c="name",d="type",p="vendor",f="version",g="architecture",v="console",m="mobile",b="tablet",h="smarttv",w="wearable",y="embedded",E="Amazon",S="Apple",T="ASUS",x="BlackBerry",k="Browser",I="Chrome",O="Firefox",L="Google",N="Huawei",A="LG",C="Microsoft",j="Motorola",R="Opera",_="Samsung",M="Sharp",D="Sony",U="Xiaomi",P="Zebra",B="Facebook",z="Chromium OS",F="Mac OS",V=function(e){for(var n={},t=0;t<e.length;t++)n[e[t].toUpperCase()]=e[t];return n},$=function(e,n){return typeof e===a&&-1!==G(n).indexOf(G(e))},G=function(e){return e.toLowerCase()},q=function(e,n){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof n===o?e:e.substring(0,350)},W=function(e,n){for(var t,o,a,l,u,c,d=0;d<n.length&&!u;){var p=n[d],f=n[d+1];for(t=o=0;t<p.length&&!u&&p[t];)if(u=p[t++].exec(e))for(a=0;a<f.length;a++)c=u[++o],typeof(l=f[a])===s&&l.length>0?2===l.length?typeof l[1]==r?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==r||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):i:this[l[0]]=c?l[1].call(this,c,l[2]):i:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):i):this[l]=c||i;d+=2}},K=function(e,n){for(var t in n)if(typeof n[t]===s&&n[t].length>0){for(var r=0;r<n[t].length;r++)if($(n[t][r],e))return"?"===t?i:t}else if($(n[t],e))return"?"===t?i:t;return e},H={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,f],[/opios[\/ ]+([\w\.]+)/i],[f,[c,R+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[c,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[c,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[c,"UC"+k]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[c,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure "+k],f],[/\bfocus\/([\w\.]+)/i],[f,[c,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[c,R+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[c,R+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[c,"MIUI "+k]],[/fxios\/([-\w\.]+)/i],[f,[c,O]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 "+k]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 "+k],f],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,B],f],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[c,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[c,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[c,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[c,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,I+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[c,"Android "+k]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[c,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[f,K,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[c,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[c,O+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[c,f],[/(cobalt)\/([\w\.]+)/i],[c,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,G]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",G]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,G]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[p,_],[d,b]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[p,_],[d,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[p,S],[d,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[p,S],[d,b]],[/(macintosh);/i],[u,[p,S]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[p,M],[d,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[p,N],[d,b]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[p,N],[d,m]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[p,U],[d,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[p,U],[d,b]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[p,"OPPO"],[d,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[p,"Vivo"],[d,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[p,"Realme"],[d,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[p,j],[d,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[p,j],[d,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[p,A],[d,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[p,A],[d,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[p,"Lenovo"],[d,b]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[p,"Nokia"],[d,m]],[/(pixel c)\b/i],[u,[p,L],[d,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[p,L],[d,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[p,D],[d,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[p,D],[d,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[p,"OnePlus"],[d,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[p,E],[d,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[p,E],[d,m]],[/(playbook);[-\w\),; ]+(rim)/i],[u,p,[d,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[p,x],[d,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[p,T],[d,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[p,T],[d,m]],[/(nexus 9)/i],[u,[p,"HTC"],[d,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[u,/_/g," "],[d,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[p,"Acer"],[d,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[p,"Meizu"],[d,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,u,[d,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,u,[d,b]],[/(surface duo)/i],[u,[p,C],[d,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[p,"Fairphone"],[d,m]],[/(u304aa)/i],[u,[p,"AT&T"],[d,m]],[/\bsie-(\w*)/i],[u,[p,"Siemens"],[d,m]],[/\b(rct\w+) b/i],[u,[p,"RCA"],[d,b]],[/\b(venue[\d ]{2,7}) b/i],[u,[p,"Dell"],[d,b]],[/\b(q(?:mv|ta)\w+) b/i],[u,[p,"Verizon"],[d,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[p,"Barnes & Noble"],[d,b]],[/\b(tm\d{3}\w+) b/i],[u,[p,"NuVision"],[d,b]],[/\b(k88) b/i],[u,[p,"ZTE"],[d,b]],[/\b(nx\d{3}j) b/i],[u,[p,"ZTE"],[d,m]],[/\b(gen\d{3}) b.+49h/i],[u,[p,"Swiss"],[d,m]],[/\b(zur\d{3}) b/i],[u,[p,"Swiss"],[d,b]],[/\b((zeki)?tb.*\b) b/i],[u,[p,"Zeki"],[d,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],u,[d,b]],[/\b(ns-?\w{0,9}) b/i],[u,[p,"Insignia"],[d,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[p,"NextBook"],[d,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],u,[d,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],u,[d,m]],[/\b(ph-1) /i],[u,[p,"Essential"],[d,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[p,"Envizen"],[d,b]],[/\b(trio[-\w\. ]+) b/i],[u,[p,"MachSpeed"],[d,b]],[/\btu_(1491) b/i],[u,[p,"Rotor"],[d,b]],[/(shield[\w ]+) b/i],[u,[p,"Nvidia"],[d,b]],[/(sprint) (\w+)/i],[p,u,[d,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[p,C],[d,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[p,P],[d,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[p,P],[d,m]],[/smart-tv.+(samsung)/i],[p,[d,h]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[p,_],[d,h]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,A],[d,h]],[/(apple) ?tv/i],[p,[u,S+" TV"],[d,h]],[/crkey/i],[[u,I+"cast"],[p,L],[d,h]],[/droid.+aft(\w+)( bui|\))/i],[u,[p,E],[d,h]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[p,M],[d,h]],[/(bravia[\w ]+)( bui|\))/i],[u,[p,D],[d,h]],[/(mitv-\w{5}) bui/i],[u,[p,U],[d,h]],[/Hbbtv.*(technisat) (.*);/i],[p,u,[d,h]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,q],[u,q],[d,h]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,u,[d,v]],[/droid.+; (shield) bui/i],[u,[p,"Nvidia"],[d,v]],[/(playstation [345portablevi]+)/i],[u,[p,D],[d,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[p,C],[d,v]],[/((pebble))app/i],[p,u,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[p,S],[d,w]],[/droid.+; (glass) \d/i],[u,[p,L],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[u,[p,P],[d,w]],[/(quest( 2| pro)?)/i],[u,[p,B],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,y]],[/(aeobc)\b/i],[u,[p,E],[d,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[d,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[d,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,m]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[c,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[f,K,H]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[f,K,H]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,F],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,f],[/\(bb(10);/i],[f,[c,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[c,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[c,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[c,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[c,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[c,z],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,f],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[c,f]]},J=function(e,n){if(typeof e===s&&(n=e,e=i),!(this instanceof J))return new J(e,n).getResult();var v=typeof t!==o&&t.navigator?t.navigator:i,h=e||(v&&v.userAgent?v.userAgent:""),w=v&&v.userAgentData?v.userAgentData:i,y=n?function(e,n){var t={};for(var i in e)n[i]&&n[i].length%2==0?t[i]=n[i].concat(e[i]):t[i]=e[i];return t}(X,n):X,E=v&&v.userAgent==h;return this.getBrowser=function(){var e,n={};return n[c]=i,n[f]=i,W.call(n,h,y.browser),n[l]=typeof(e=n[f])===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i,E&&v&&v.brave&&typeof v.brave.isBrave==r&&(n[c]="Brave"),n},this.getCPU=function(){var e={};return e[g]=i,W.call(e,h,y.cpu),e},this.getDevice=function(){var e={};return e[p]=i,e[u]=i,e[d]=i,W.call(e,h,y.device),E&&!e[d]&&w&&w.mobile&&(e[d]=m),E&&"Macintosh"==e[u]&&v&&typeof v.standalone!==o&&v.maxTouchPoints&&v.maxTouchPoints>2&&(e[u]="iPad",e[d]=b),e},this.getEngine=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.engine),e},this.getOS=function(){var e={};return e[c]=i,e[f]=i,W.call(e,h,y.os),E&&!e[c]&&w&&"Unknown"!=w.platform&&(e[c]=w.platform.replace(/chrome os/i,z).replace(/macos/i,F)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return h},this.setUA=function(e){return h=typeof e===a&&e.length>350?q(e,350):e,this},this.setUA(h),this};J.VERSION="1.0.36",J.BROWSER=V([c,f,l]),J.CPU=V([g]),J.DEVICE=V([u,p,d,v,m,h,b,w,y]),J.ENGINE=J.OS=V([c,f]),e.exports&&(n=e.exports=J),n.UAParser=J;var Z=typeof t!==o&&(t.jQuery||t.Zepto);if(Z&&!Z.ua){var Y=new J;Z.ua=Y.getResult(),Z.ua.get=function(){return Y.getUA()},Z.ua.set=function(e){Y.setUA(e);var n=Y.getResult();for(var t in n)Z.ua[t]=n[t]}}}("object"==typeof window?window:C)}(ye,ye.exports);var Ee=ye.exports;const Se=()=>{const e=new Ee.UAParser,{name:n,version:t}=e.getBrowser(),{name:i,version:r}=e.getOS(),o=e.getUA(),s=navigator.language,a=navigator.userAgent.includes("Mobi"),l=function(){if(!n||!t)return;if("userAgentData"in navigator)return navigator.userAgentData.brands;return}(),u="unknown";return{browser:{name:null!=n?n:u,version:null!=t?t:u,os:`${null!=i?i:u} ${null!=r?r:u}`,userAgent:null!=o?o:u,language:null!=s?s:u,mobile:a,brands:null!=l?l:u}}},Te=()=>({page:{url:location.href}}),xe=[Se,Te];function ke(e){return{id:N(),attributes:e}}const Ie={name:"default"},Oe="sessionStorage",Le="localStorage";function Ne(n){var t;try{let e;e=window[n];const t="__faro_storage_test__";return e.setItem(t,t),e.removeItem(t),!0}catch(i){return null===(t=e.faro.internalLogger)||void 0===t||t.info(`Web storage of type ${n} is not available. Reason: ${i}`),!1}}function Ae(e,n){return Me(n)?window[n].getItem(e):null}function Ce(e,n,t){if(Me(t))try{window[t].setItem(e,n)}catch(e){}}function je(e,n){Me(n)&&window[n].removeItem(e)}const Re=Ne(Le),_e=Ne(Oe);function Me(e){return e===Le?Re:e===Oe&&_e}function De(e,n){let t,i=!1;const r=()=>{null!=t?(e(...t),t=null,setTimeout(r,n)):i=!1};return(...o)=>{i?t=o:(e(...o),i=!0,setTimeout(r,n))}}function Ue(){var n,t,i;const r=e.faro.config.sessionTracking;let o=null!==(i=null!==(t=null===(n=null==r?void 0:r.sampler)||void 0===n?void 0:n.call(r,{metas:e.faro.metas.value}))&&void 0!==t?t:null==r?void 0:r.samplingRate)&&void 0!==i?i:1;if("number"!=typeof o){o=0}return Math.random()<o}const Pe="__FARO_SESSION__",Be=144e5,ze=9e5,Fe=96e4,Ve={enabled:!0,persistent:!1,maxSessionPersistenceTime:Fe};function $e({sessionId:e=N(),isSampled:n=!0}={}){const t=A();return{sessionId:e,lastActivity:t,started:t,isSampled:n}}function Ge(e){if(null==e)return!1;const n=A();if(!(n-e.started<Be))return!1;return n-e.lastActivity<ze}function qe({fetchUserSession:n,storeUserSession:t}){return function(){var i,r,o,s;if(!n||!t)return;const a=n();if(Ge(a))t(Object.assign(Object.assign({},a),{lastActivity:A()}));else{let n=We($e({isSampled:Ue()}),a);t(n),null===(i=e.faro.api)||void 0===i||i.setSession(n.sessionMeta),null===(o=null===(r=e.faro.config.sessionTracking)||void 0===r?void 0:r.onSessionChange)||void 0===o||o.call(r,null!==(s=null==a?void 0:a.sessionMeta)&&void 0!==s?s:null,n.sessionMeta)}}}function We(n,t){var i,r;return Object.assign(Object.assign({},n),{sessionMeta:{id:n.sessionId,attributes:Object.assign(Object.assign(Object.assign({},null!==(r=null===(i=e.faro.metas.value.session)||void 0===i?void 0:i.attributes)&&void 0!==r?r:{}),null!=t?{previousSession:t.sessionId}:{}),{isSampled:n.isSampled.toString()})}})}class Ke{constructor(){this.updateSession=De((()=>this.updateUserSession()),1e3),this.updateUserSession=qe({fetchUserSession:Ke.fetchUserSession,storeUserSession:Ke.storeUserSession}),this.init()}static removeUserSession(){je(Pe,Ke.storageTypeLocal)}static storeUserSession(e){Ce(Pe,JSON.stringify(e),Ke.storageTypeLocal)}static fetchUserSession(){const e=Ae(Pe,Ke.storageTypeLocal);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),window.addEventListener("storage",(n=>{var t,i,r;if(n.key!==Pe)return;const o=JSON.parse(null!==(t=n.newValue)&&void 0!==t?t:""),s=JSON.parse(null!==(i=n.oldValue)&&void 0!==i?i:"");o.sessionId!==s.sessionId&&(null===(r=e.faro.api)||void 0===r||r.setSession(o.sessionMeta))})),e.faro.metas.addListener((function(n){const t=n.session,i=Ke.fetchUserSession();if(t&&t.id!==(null==i?void 0:i.sessionId)){const n=We($e({sessionId:t.id,isSampled:Ue()}),i);Ke.storeUserSession(n),e.faro.api.setSession(n.sessionMeta)}}))}}Ke.storageTypeLocal=Le;class He{constructor(){this.updateSession=De((()=>this.updateUserSession()),1e3),this.updateUserSession=qe({fetchUserSession:He.fetchUserSession,storeUserSession:He.storeUserSession}),this.init()}static removeUserSession(){je(Pe,He.storageTypeSession)}static storeUserSession(e){Ce(Pe,JSON.stringify(e),He.storageTypeSession)}static fetchUserSession(){const e=Ae(Pe,He.storageTypeSession);return e?JSON.parse(e):null}init(){document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.updateSession()})),e.faro.metas.addListener((function(n){const t=n.session,i=He.fetchUserSession();if(t&&t.id!==(null==i?void 0:i.sessionId)){const n=We($e({sessionId:t.id,isSampled:Ue()}),i);He.storeUserSession(n),e.faro.api.setSession(n.sessionMeta)}}))}}He.storageTypeSession=Oe;class Xe extends ae{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=le}sendSessionStartEvent(e){var n,t;const i=e.session;if(i&&i.id!==(null===(n=this.notifiedSession)||void 0===n?void 0:n.id)){if(this.notifiedSession&&this.notifiedSession.id===(null===(t=i.attributes)||void 0===t?void 0:t.previousSession))return this.api.pushEvent(we,{},void 0,{skipDedupe:!0}),void(this.notifiedSession=i);this.notifiedSession=i,this.api.pushEvent(be,{},void 0,{skipDedupe:!0})}}createInitialSessionMeta(e){var n,t,i;let r=(e.persistent?Ke:He).fetchUserSession();if(e.persistent&&e.maxSessionPersistenceTime&&r){const n=A();r.lastActivity<n-e.maxSessionPersistenceTime&&(Ke.removeUserSession(),r=null)}let o=null===(n=e.session)||void 0===n?void 0:n.id,s=null===(t=e.session)||void 0===t?void 0:t.attributes;Ge(r)?(o=null==r?void 0:r.sessionId,s=Object.assign(Object.assign({},null===(i=null==r?void 0:r.sessionMeta)||void 0===i?void 0:i.attributes),{isSampled:r.isSampled.toString()}),this.api.pushEvent(he,{},void 0,{skipDedupe:!0})):(o=null!=o?o:ke().id,this.api.pushEvent(be,{},void 0,{skipDedupe:!0}));return{id:o,attributes:Object.assign({isSampled:Ue().toString()},s)}}initialize(){var e,n,t;this.logDebug("init session instrumentation");const i=this.config.sessionTracking;if(null==i?void 0:i.enabled){const r=(null===(e=this.config.sessionTracking)||void 0===e?void 0:e.persistent)?Ke:He,o=this.createInitialSessionMeta(i);r.storeUserSession($e({sessionId:o.id,isSampled:"true"===(null===(n=o.attributes)||void 0===n?void 0:n.isSampled)})),null!=this.notifiedSession&&this.sendSessionStartEvent(o),this.notifiedSession=o,this.api.setSession(o);const{updateSession:s}=new r;null===(t=this.transports)||void 0===t||t.addBeforeSendHooks((e=>{var n,t,i;s();const r=null===(n=e.meta.session)||void 0===n?void 0:n.attributes;if(r&&"true"===(null==r?void 0:r.isSampled)){let n;n="structuredClone"in window?structuredClone(e):JSON.parse(JSON.stringify(e));const r=null===(t=n.meta.session)||void 0===t?void 0:t.attributes;return null==r||delete r.isSampled,0===Object.keys(null!=r?r:{}).length&&(null===(i=n.meta.session)||void 0===i||delete i.attributes),n}return null}))}else this.sendSessionStartEvent(this.metas.value);this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class Je extends ae{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=le}initialize(){this.logDebug("Initializing\n",this.options),k.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:Je.defaultDisabledLevels).includes(e)})).forEach((e=>{console[e]=(...n)=>{try{this.api.pushLog(n,{level:e})}catch(e){this.logError(e)}finally{this.unpatchedConsole[e](...n)}}}))}}Je.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const Ze=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ye=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Qe=/\((\S*)(?::(\d+))(?::(\d+))\)/,en="address at ",nn=en.length,tn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,rn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,on="safari-extension",sn="safari-web-extension",an=/Minified React error #\d+;/i;function ln(e,n,t,i){const r={filename:e||document.location.href,function:n||"?"};return void 0!==t&&(r.lineno=t),void 0!==i&&(r.colno=i),r}function un(e,n){const t=null==e?void 0:e.includes(on),i=!t&&(null==e?void 0:e.includes(sn));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${on}:${n}`:`${sn}:${n}`]:[e,n]}function cn(e){let n=[];e.stacktrace?n=e.stacktrace.split("\n").filter(((e,n)=>n%2==0)):e.stack&&(n=e.stack.split("\n"));const t=n.reduce(((n,t,i)=>{let r,o,s,l,u;if(r=Ye.exec(t)){if(o=r[1],s=r[2],l=r[3],u=r[4],null==s?void 0:s.startsWith("eval")){const e=Qe.exec(s);e&&(s=e[1],l=e[2],u=e[3])}s=(null==s?void 0:s.startsWith(en))?s.substring(nn):s,[o,s]=un(o,s)}else if(r=tn.exec(t)){if(o=r[1],s=r[3],l=r[4],u=r[5],s&&s.includes(" > eval")){const e=rn.exec(s);e&&(o=o||"eval",s=e[1],l=e[2])}else 0===i&&!u&&a(e.columnNumber)&&(u=String(e.columnNumber+1));[o,s]=un(o,s)}return(s||o)&&n.push(ln(s,o,l?Number(l):void 0,u?Number(u):void 0)),n}),[]);return an.test(e.message)?t.slice(1):t}function dn(e){return{frames:cn(e)}}function pn(e){let n,t,i,r,o=[];if(m(e)&&e.error)n=e.error.message,t=e.error.name,o=cn(e.error);else if((i=b(e))||h(e)){const{name:r,message:o}=e;t=null!=r?r:i?"DOMError":"DOMException",n=o?`${t}: ${o}`:t}else v(e)?(n=e.message,o=cn(e)):(l(e)||(r=f(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,o]}function fn(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,o,a,l]=t;let u,c,d=[];const p=s(i),f=ln(r,"?",o,a);l||!p?([u,c,d]=pn(null!=l?l:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(Ze),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:ie;return[null!==(t=null==i?void 0:i[2])&&void 0!==t?t:e,r]}(i),d=[f]),u&&e.pushError(new Error(u),{type:c,stackFrames:d})}finally{null==n||n.apply(window,t)}}}class gn extends ae{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=le}initialize(){var e;this.logDebug("Initializing"),fn(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,o,s=n;s.reason?s=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(s=null===(i=n.detail)||void 0===i?void 0:i.reason);let a=[];d(s)?(r=`Non-Error promise rejection captured with value: ${String(s)}`,o="UnhandledRejection"):[r,o,a]=pn(s),r&&e.pushError(new Error(r),{type:o,stackFrames:a})}))}}class vn extends ae{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=le}sendViewChangedEvent(e){var n,t,i;const r=e.view;r&&r.name!==(null===(n=this.notifiedView)||void 0===n?void 0:n.name)&&(this.api.pushEvent(me,{fromView:null!==(i=null===(t=this.notifiedView)||void 0===t?void 0:t.name)&&void 0!==i?i:"",toView:r.name},void 0,{skipDedupe:!0}),this.notifiedView=r)}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var mn,bn,hn,wn,yn,En=-1,Sn=function(e){addEventListener("pageshow",(function(n){n.persisted&&(En=n.timeStamp,e(n))}),!0)},Tn=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},xn=function(){var e=Tn();return e&&e.activationStart||0},kn=function(e,n){var t=Tn(),i="navigate";return En>=0?i="back-forward-cache":t&&(document.prerendering||xn()>0?i="prerender":document.wasDiscarded?i="restore":t.type&&(i=t.type.replace(/_/g,"-"))),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},In=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},t||{})),i}}catch(e){}},On=function(e,n,t,i){var r,o;return function(s){n.value>=0&&(s||i)&&((o=n.value-(r||0))||void 0===r)&&(r=n.value,n.delta=o,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},Ln=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},Nn=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},An=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},Cn=-1,jn=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Rn=function(e){"hidden"===document.visibilityState&&Cn>-1&&(Cn="visibilitychange"===e.type?e.timeStamp:0,Mn())},_n=function(){addEventListener("visibilitychange",Rn,!0),addEventListener("prerenderingchange",Rn,!0)},Mn=function(){removeEventListener("visibilitychange",Rn,!0),removeEventListener("prerenderingchange",Rn,!0)},Dn=function(){return Cn<0&&(Cn=jn(),_n(),Sn((function(){setTimeout((function(){Cn=jn(),_n()}),0)}))),{get firstHiddenTime(){return Cn}}},Un=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Pn=[1800,3e3],Bn=function(e,n){n=n||{},Un((function(){var t,i=Dn(),r=kn("FCP"),o=In("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-xn(),0),r.entries.push(e),t(!0)))}))}));o&&(t=On(e,r,Pn,n.reportAllChanges),Sn((function(i){r=kn("FCP"),t=On(e,r,Pn,n.reportAllChanges),Ln((function(){r.value=performance.now()-i.timeStamp,t(!0)}))})))}))},zn=[.1,.25],Fn={passive:!0,capture:!0},Vn=new Date,$n=function(e,n){mn||(mn=n,bn=e,hn=new Date,Wn(removeEventListener),Gn())},Gn=function(){if(bn>=0&&bn<hn-Vn){var e={entryType:"first-input",name:mn.type,target:mn.target,cancelable:mn.cancelable,startTime:mn.timeStamp,processingStart:mn.timeStamp+bn};wn.forEach((function(n){n(e)})),wn=[]}},qn=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){$n(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,Fn),removeEventListener("pointercancel",i,Fn)};addEventListener("pointerup",t,Fn),addEventListener("pointercancel",i,Fn)}(n,e):$n(n,e)}},Wn=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,qn,Fn)}))},Kn=[100,300],Hn=0,Xn=1/0,Jn=0,Zn=function(e){e.forEach((function(e){e.interactionId&&(Xn=Math.min(Xn,e.interactionId),Jn=Math.max(Jn,e.interactionId),Hn=Jn?(Jn-Xn)/7+1:0)}))},Yn=function(){return yn?Hn:performance.interactionCount||0},Qn=function(){"interactionCount"in performance||yn||(yn=In("event",Zn,{type:"event",buffered:!0,durationThreshold:0}))},et=[200,500],nt=0,tt=function(){return Yn()-nt},it=[],rt={},ot=function(e){var n=it[it.length-1],t=rt[e.interactionId];if(t||it.length<10||e.duration>n.latency){if(t)t.entries.push(e),t.latency=Math.max(t.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};rt[i.id]=i,it.push(i)}it.sort((function(e,n){return n.latency-e.latency})),it.splice(10).forEach((function(e){delete rt[e.id]}))}},st=[2500,4e3],at={},lt=[800,1800],ut=function e(n){document.prerendering?Un((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class ct extends ae{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=le}initialize(){this.logDebug("Initializing"),Object.entries(ct.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function dt(e={}){const n=[new gn,new ct,new Xe,new vn];return!1!==e.captureConsole&&n.push(new Je({disabledLevels:e.captureConsoleDisabledLevels})),n}ct.mapping={cls:function(e,n){n=n||{},Bn(An((function(){var t,i=kn("CLS",0),r=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=o[0],t=o[o.length-1];r&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(r+=e.value,o.push(e)):(r=e.value,o=[e])}})),r>i.value&&(i.value=r,i.entries=o,t())},a=In("layout-shift",s);a&&(t=On(e,i,zn,n.reportAllChanges),Nn((function(){s(a.takeRecords()),t(!0)})),Sn((function(){r=0,i=kn("CLS",0),t=On(e,i,zn,n.reportAllChanges),Ln((function(){return t()}))})),setTimeout(t,0))})))},fcp:Bn,fid:function(e,n){n=n||{},Un((function(){var t,i=Dn(),r=kn("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(r.value=e.processingStart-e.startTime,r.entries.push(e),t(!0))},s=function(e){e.forEach(o)},a=In("first-input",s);t=On(e,r,Kn,n.reportAllChanges),a&&Nn(An((function(){s(a.takeRecords()),a.disconnect()}))),a&&Sn((function(){var i;r=kn("FID"),t=On(e,r,Kn,n.reportAllChanges),wn=[],bn=-1,mn=null,Wn(addEventListener),i=o,wn.push(i),Gn()}))}))},inp:function(e,n){n=n||{},Un((function(){var t;Qn();var i,r=kn("INP"),o=function(e){e.forEach((function(e){e.interactionId&&ot(e),"first-input"===e.entryType&&!it.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&ot(e)}));var n,t=(n=Math.min(it.length-1,Math.floor(tt()/50)),it[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},s=In("event",o,{durationThreshold:null!==(t=n.durationThreshold)&&void 0!==t?t:40});i=On(e,r,et,n.reportAllChanges),s&&("interactionId"in PerformanceEventTiming.prototype&&s.observe({type:"first-input",buffered:!0}),Nn((function(){o(s.takeRecords()),r.value<0&&tt()>0&&(r.value=0,r.entries=[]),i(!0)})),Sn((function(){it=[],nt=Yn(),r=kn("INP"),i=On(e,r,et,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},Un((function(){var t,i=Dn(),r=kn("LCP"),o=function(e){var n=e[e.length-1];n&&n.startTime<i.firstHiddenTime&&(r.value=Math.max(n.startTime-xn(),0),r.entries=[n],t())},s=In("largest-contentful-paint",o);if(s){t=On(e,r,st,n.reportAllChanges);var a=An((function(){at[r.id]||(o(s.takeRecords()),s.disconnect(),at[r.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),Nn(a),Sn((function(i){r=kn("LCP"),t=On(e,r,st,n.reportAllChanges),Ln((function(){r.value=performance.now()-i.timeStamp,at[r.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=kn("TTFB"),i=On(e,t,lt,n.reportAllChanges);ut((function(){var r=Tn();if(r){var o=r.responseStart;if(o<=0||o>performance.now())return;t.value=Math.max(o-xn(),0),t.entries=[r],i(!0),Sn((function(){t=kn("TTFB",0),(i=On(e,t,lt,n.reportAllChanges))(!0)}))}}))}};const pt="browser",ft=()=>({k6:{isK6Browser:!0}});function gt(e,n,t,i){return new(t||(t=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}l((i=i.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class vt extends ee{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=le,this.disabledUntil=new Date,this.rateLimitBackoffMs=null!==(n=e.defaultRateLimitBackoffMs)&&void 0!==n?n:5e3,this.getNow=null!==(t=e.getNow)&&void 0!==t?t:()=>Date.now(),this.promiseBuffer=O({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return gt(this,void 0,void 0,(function*(){try{if(this.disabledUntil>new Date(this.getNow()))return this.logWarn(`Dropping transport item due to too many requests. Backoff until ${this.disabledUntil}`),Promise.resolve();yield this.promiseBuffer.add((()=>{var n;const t=JSON.stringify(te(e)),{url:i,requestOptions:r,apiKey:o}=this.options,s=null!=r?r:{},{headers:a}=s,l=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]])}return t}(s,["headers"]),u=null===(n=this.metas.value.session)||void 0===n?void 0:n.id;return fetch(i,Object.assign({method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},null!=a?a:{}),o?{"x-api-key":o}:{}),u?{"x-faro-session-id":u}:{}),body:t,keepalive:t.length<=6e4},null!=l?l:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e.text().catch(I),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(t),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}isBatched(){return!0}getRetryAfterDate(e){const n=this.getNow(),t=e.headers.get("Retry-After");if(t){const e=Number(t);if(!isNaN(e))return new Date(1e3*e+n);const i=Date.parse(t);if(!isNaN(i))return new Date(i)}return new Date(n+this.rateLimitBackoffMs)}}function mt(e){var n,t,i,r,o,s,a,u,c;const d=[],p=J(e.unpatchedConsole,e.internalLoggerLevel);e.transports?((e.url||e.apiKey)&&p.error('if "transports" is defined, "url" and "apiKey" should not be defined'),d.push(...e.transports)):e.url?d.push(new vt({url:e.url,apiKey:e.apiKey})):p.error('either "url" or "transports" must be defined');return{app:e.app,batching:Object.assign(Object.assign({},ve),e.batching),dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||ge,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:dt(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:W,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:function(){const n=xe;return e.metas&&n.push(...e.metas),l(window.k6)?[...n,ft]:n}(),parseStacktrace:dn,paused:null!==(o=e.paused)&&void 0!==o&&o,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:d,unpatchedConsole:null!==(a=e.unpatchedConsole)&&void 0!==a?a:K,beforeSend:e.beforeSend,eventDomain:null!==(u=e.eventDomain)&&void 0!==u?u:pt,ignoreErrors:e.ignoreErrors,sessionTracking:Object.assign(Object.assign({},Ve),e.sessionTracking),user:e.user,view:null!==(c=e.view)&&void 0!==c?c:Ie}}return e.BaseExtension=Q,e.BaseInstrumentation=ae,e.BaseTransport=ee,e.ConsoleInstrumentation=Je,e.ConsoleTransport=class extends ee{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=le}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",te([n]))}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.EVENT_CLICK="click",e.EVENT_NAVIGATION="navigation",e.EVENT_ROUTE_CHANGE="route_change",e.EVENT_SESSION_EXTEND=we,e.EVENT_SESSION_RESUME=he,e.EVENT_SESSION_START=be,e.EVENT_VIEW_CHANGED=me,e.ErrorsInstrumentation=gn,e.FetchTransport=vt,e.MAX_SESSION_PERSISTENCE_TIME=Fe,e.MAX_SESSION_PERSISTENCE_TIME_BUFFER=6e4,e.PersistentSessionsManager=Ke,e.SESSION_EXPIRATION_TIME=Be,e.SESSION_INACTIVITY_TIME=ze,e.STORAGE_KEY=Pe,e.SessionInstrumentation=Xe,e.VERSION=le,e.ViewInstrumentation=vn,e.VolatileSessionsManager=He,e.WebVitalsInstrumentation=ct,e.allLogLevels=k,e.browserMeta=Se,e.buildStackFrame=ln,e.createInternalLogger=J,e.createPromiseBuffer=O,e.createSession=ke,e.deepEqual=E,e.defaultEventDomain=pt,e.defaultExceptionType=ie,e.defaultGlobalObjectKey=ge,e.defaultInternalLoggerLevel=W,e.defaultLogLevel=x,e.defaultMetas=xe,e.defaultViewMeta=Ie,e.genShortID=N,e.getCurrentTimestamp=S,e.getDataFromSafariExtensions=un,e.getInternalFaroFromGlobalObject=function(){return se[ue]},e.getStackFramesFromError=cn,e.getTransportBody=te,e.getWebInstrumentations=dt,e.globalObject=se,e.initializeFaro=function(e){const n=mt(e);if(n)return fe(n)},e.internalGlobalObjectKey=ue,e.isArray=c,e.isBoolean=e=>n(e,"boolean"),e.isDomError=b,e.isDomException=h,e.isElement=e=>w&&i(e,Element),e.isElementDefined=w,e.isError=v,e.isErrorDefined=g,e.isErrorEvent=m,e.isEvent=f,e.isEventDefined=p,e.isFunction=u,e.isInstanceOf=i,e.isInt=e=>a(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=de,e.isMap=e=>y&&i(e,Map),e.isMapDefined=y,e.isNull=o,e.isNumber=a,e.isObject=l,e.isPrimitive=d,e.isRegExp=e=>t(e,"RegExp"),e.isString=s,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>l(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>u(null==e?void 0:e.then),e.isToString=t,e.isTypeof=n,e.isUndefined=r,e.makeCoreConfig=mt,e.noop=I,e.pageMeta=Te,e.parseStacktrace=dn,e.sdkMeta=()=>({sdk:{name:"@grafana/faro-core",version:le,integrations:e.faro.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}}),e.setInternalFaroOnGlobalObject=ce,e.transportItemTypeToBodyKey=F,e}({});
@@ -7,6 +7,6 @@ export type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectio
7
7
  export { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta, sdkMeta } from './metas';
8
8
  export { ConsoleTransport, FetchTransport } from './transports';
9
9
  export type { ClockFn, ConsoleTransportOptions, FetchTransportOptions, FetchTransportRequestOptions, } from './transports';
10
- export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, } from '@grafana/faro-core';
10
+ export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, EVENT_CLICK, EVENT_NAVIGATION, EVENT_ROUTE_CHANGE, EVENT_SESSION_EXTEND, EVENT_SESSION_RESUME, EVENT_SESSION_START, EVENT_VIEW_CHANGED, } from '@grafana/faro-core';
11
11
  export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BufferItem, Config, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, Extension, GlobalObject, Instrumentation, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, OTELApi, Patterns, PromiseBuffer, PromiseBufferOptions, PromiseProducer, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, } from '@grafana/faro-core';
12
12
  export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './instrumentations/session';
@@ -3,7 +3,7 @@ import type { ConsoleInstrumentationOptions } from './types';
3
3
  export declare class ConsoleInstrumentation extends BaseInstrumentation {
4
4
  private options;
5
5
  readonly name = "@grafana/faro-web-sdk:instrumentation-console";
6
- readonly version = "1.2.9";
6
+ readonly version = "1.3.1";
7
7
  static defaultDisabledLevels: LogLevel[];
8
8
  constructor(options?: ConsoleInstrumentationOptions);
9
9
  initialize(): void;
@@ -1,6 +1,6 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ErrorsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-errors";
4
- readonly version = "1.2.9";
4
+ readonly version = "1.3.1";
5
5
  initialize(): void;
6
6
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class SessionInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-session";
4
- readonly version = "1.2.9";
4
+ readonly version = "1.3.1";
5
5
  private notifiedSession;
6
6
  private sendSessionStartEvent;
7
7
  private createInitialSessionMeta;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ViewInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-view";
4
- readonly version = "1.2.9";
4
+ readonly version = "1.3.1";
5
5
  private notifiedView;
6
6
  private sendViewChangedEvent;
7
7
  initialize(): void;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class WebVitalsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals";
4
- readonly version = "1.2.9";
4
+ readonly version = "1.3.1";
5
5
  static mapping: {
6
6
  cls: (onReport: import("web-vitals").CLSReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void;
7
7
  fcp: (onReport: import("web-vitals").FCPReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void;
@@ -4,7 +4,7 @@ import type { ConsoleTransportOptions } from './types';
4
4
  export declare class ConsoleTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-console";
7
- readonly version = "1.2.9";
7
+ readonly version = "1.3.1";
8
8
  constructor(options?: ConsoleTransportOptions);
9
9
  send(item: TransportItem): void;
10
10
  }
@@ -4,7 +4,7 @@ import type { FetchTransportOptions } from './types';
4
4
  export declare class FetchTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-fetch";
7
- readonly version = "1.2.9";
7
+ readonly version = "1.3.1";
8
8
  promiseBuffer: PromiseBuffer<Response | void>;
9
9
  private readonly rateLimitBackoffMs;
10
10
  private readonly getNow;
@@ -30,7 +30,7 @@ var k6_1 = require("../metas/k6");
30
30
  var transports_1 = require("../transports");
31
31
  var getWebInstrumentations_1 = require("./getWebInstrumentations");
32
32
  function makeCoreConfig(browserConfig) {
33
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
33
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
34
34
  var transports = [];
35
35
  var internalLogger = (0, faro_core_1.createInternalLogger)(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);
36
36
  if (browserConfig.transports) {
@@ -77,14 +77,9 @@ function makeCoreConfig(browserConfig) {
77
77
  eventDomain: (_h = browserConfig.eventDomain) !== null && _h !== void 0 ? _h : consts_1.defaultEventDomain,
78
78
  ignoreErrors: browserConfig.ignoreErrors,
79
79
  sessionTracking: __assign(__assign({}, session_1.defaultSessionTrackingConfig), browserConfig.sessionTracking),
80
- // TODO: deprecate/remove legacy session object at ga
81
- session: (_j = browserConfig.session) !== null && _j !== void 0 ? _j : (0, metas_1.createSession)(),
82
80
  user: browserConfig.user,
83
- view: (_k = browserConfig.view) !== null && _k !== void 0 ? _k : metas_1.defaultViewMeta,
81
+ view: (_j = browserConfig.view) !== null && _j !== void 0 ? _j : metas_1.defaultViewMeta,
84
82
  };
85
- if ((_l = config.sessionTracking) === null || _l === void 0 ? void 0 : _l.enabled) {
86
- delete config.session;
87
- }
88
83
  return config;
89
84
  }
90
85
  exports.makeCoreConfig = makeCoreConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"makeCoreConfig.js","sourceRoot":"","sources":["../../../src/config/makeCoreConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAO4B;AAG5B,oCAA+C;AAC/C,wDAAsD;AACtD,uDAA2E;AAC3E,kCAAwE;AACxE,kCAA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AAC,eAAe,IAAI,kCAAsB;QACxE,gBAAgB,EAAE,MAAA,aAAa,CAAC,gBAAgB,mCAAI,IAAA,+CAAsB,GAAE;QAC5E,mBAAmB,EAAE,MAAA,aAAa,CAAC,mBAAmB,mCAAI,sCAA0B;QACpF,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,KAAK;QACvC,KAAK,EAAE,WAAW,EAAE;QACpB,eAAe,oCAAA;QACf,MAAM,EAAE,MAAA,aAAa,CAAC,MAAM,mCAAI,KAAK;QACrC,qBAAqB,EAAE,MAAA,aAAa,CAAC,qBAAqB,mCAAI,KAAK;QACnE,UAAU,YAAA;QACV,gBAAgB,EAAE,MAAA,aAAa,CAAC,gBAAgB,mCAAI,mCAAuB;QAE3E,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,2BAAkB;QAC5D,YAAY,EAAE,aAAa,CAAC,YAAY;QAExC,eAAe,wBACV,sCAA4B,GAC5B,aAAa,CAAC,eAAe,CACjC;QAED,qDAAqD;QACrD,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,IAAA,qBAAa,GAAE;QAEjD,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,IAAI,EAAE,MAAA,aAAa,CAAC,IAAI,mCAAI,uBAAe;KAC5C,CAAC;IAEF,IAAI,MAAA,MAAM,CAAC,eAAe,0CAAE,OAAO,EAAE;QACnC,OAAO,MAAM,CAAC,OAAO,CAAC;KACvB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA7ED,wCA6EC","sourcesContent":["import {\n createInternalLogger,\n defaultBatchingConfig,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultUnpatchedConsole,\n isObject,\n} from '@grafana/faro-core';\nimport type { Config, MetaItem, Transport } from '@grafana/faro-core';\n\nimport { defaultEventDomain } from '../consts';\nimport { parseStacktrace } from '../instrumentations';\nimport { defaultSessionTrackingConfig } from '../instrumentations/session';\nimport { createSession, defaultMetas, defaultViewMeta } from '../metas';\nimport { k6Meta } from '../metas/k6';\nimport { FetchTransport } from '../transports';\n\nimport { getWebInstrumentations } from './getWebInstrumentations';\nimport type { BrowserConfig } from './types';\n\nexport function makeCoreConfig(browserConfig: BrowserConfig): Config | undefined {\n const transports: Transport[] = [];\n\n const internalLogger = createInternalLogger(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);\n\n if (browserConfig.transports) {\n if (browserConfig.url || browserConfig.apiKey) {\n internalLogger.error('if \"transports\" is defined, \"url\" and \"apiKey\" should not be defined');\n }\n\n transports.push(...browserConfig.transports);\n } else if (browserConfig.url) {\n transports.push(\n new FetchTransport({\n url: browserConfig.url,\n apiKey: browserConfig.apiKey,\n })\n );\n } else {\n internalLogger.error('either \"url\" or \"transports\" must be defined');\n }\n\n function createMetas(): MetaItem[] {\n const initialMetas = defaultMetas;\n\n if (browserConfig.metas) {\n initialMetas.push(...browserConfig.metas);\n }\n\n const isK6BrowserSession = isObject((window as any).k6);\n\n if (isK6BrowserSession) {\n return [...initialMetas, k6Meta];\n }\n\n return initialMetas;\n }\n\n const config: Config = {\n app: browserConfig.app,\n batching: {\n ...defaultBatchingConfig,\n ...browserConfig.batching,\n },\n dedupe: browserConfig.dedupe ?? true,\n globalObjectKey: browserConfig.globalObjectKey || defaultGlobalObjectKey,\n instrumentations: browserConfig.instrumentations ?? getWebInstrumentations(),\n internalLoggerLevel: browserConfig.internalLoggerLevel ?? defaultInternalLoggerLevel,\n isolate: browserConfig.isolate ?? false,\n metas: createMetas(),\n parseStacktrace,\n paused: browserConfig.paused ?? false,\n preventGlobalExposure: browserConfig.preventGlobalExposure ?? false,\n transports,\n unpatchedConsole: browserConfig.unpatchedConsole ?? defaultUnpatchedConsole,\n\n beforeSend: browserConfig.beforeSend,\n eventDomain: browserConfig.eventDomain ?? defaultEventDomain,\n ignoreErrors: browserConfig.ignoreErrors,\n\n sessionTracking: {\n ...defaultSessionTrackingConfig,\n ...browserConfig.sessionTracking,\n },\n\n // TODO: deprecate/remove legacy session object at ga\n session: browserConfig.session ?? createSession(),\n\n user: browserConfig.user,\n view: browserConfig.view ?? defaultViewMeta,\n };\n\n if (config.sessionTracking?.enabled) {\n delete config.session;\n }\n\n return config;\n}\n"]}
1
+ {"version":3,"file":"makeCoreConfig.js","sourceRoot":"","sources":["../../../src/config/makeCoreConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAO4B;AAG5B,oCAA+C;AAC/C,wDAAsD;AACtD,uDAA2E;AAC3E,kCAAyD;AACzD,kCAAqC;AACrC,4CAA+C;AAE/C,mEAAkE;AAGlE,SAAgB,cAAc,CAAC,aAA4B;;IACzD,IAAM,UAAU,GAAgB,EAAE,CAAC;IAEnC,IAAM,cAAc,GAAG,IAAA,gCAAoB,EAAC,aAAa,CAAC,gBAAgB,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAE/G,IAAI,aAAa,CAAC,UAAU,EAAE;QAC5B,IAAI,aAAa,CAAC,GAAG,IAAI,aAAa,CAAC,MAAM,EAAE;YAC7C,cAAc,CAAC,KAAK,CAAC,sEAAsE,CAAC,CAAC;SAC9F;QAED,UAAU,CAAC,IAAI,OAAf,UAAU,EAAS,aAAa,CAAC,UAAU,EAAE;KAC9C;SAAM,IAAI,aAAa,CAAC,GAAG,EAAE;QAC5B,UAAU,CAAC,IAAI,CACb,IAAI,2BAAc,CAAC;YACjB,GAAG,EAAE,aAAa,CAAC,GAAG;YACtB,MAAM,EAAE,aAAa,CAAC,MAAM;SAC7B,CAAC,CACH,CAAC;KACH;SAAM;QACL,cAAc,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACtE;IAED,SAAS,WAAW;QAClB,IAAM,YAAY,GAAG,oBAAY,CAAC;QAElC,IAAI,aAAa,CAAC,KAAK,EAAE;YACvB,YAAY,CAAC,IAAI,OAAjB,YAAY,EAAS,aAAa,CAAC,KAAK,EAAE;SAC3C;QAED,IAA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Key,\n defaultInternalLoggerLevel,\n defaultUnpatchedConsole,\n isObject,\n} from '@grafana/faro-core';\nimport type { Config, MetaItem, Transport } from '@grafana/faro-core';\n\nimport { defaultEventDomain } from '../consts';\nimport { parseStacktrace } from '../instrumentations';\nimport { defaultSessionTrackingConfig } from '../instrumentations/session';\nimport { defaultMetas, defaultViewMeta } from '../metas';\nimport { k6Meta } from '../metas/k6';\nimport { FetchTransport } from '../transports';\n\nimport { getWebInstrumentations } from './getWebInstrumentations';\nimport type { BrowserConfig } from './types';\n\nexport function makeCoreConfig(browserConfig: BrowserConfig): Config | undefined {\n const transports: Transport[] = [];\n\n const internalLogger = createInternalLogger(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);\n\n if (browserConfig.transports) {\n if (browserConfig.url || browserConfig.apiKey) {\n internalLogger.error('if \"transports\" is defined, \"url\" and \"apiKey\" should not be defined');\n }\n\n transports.push(...browserConfig.transports);\n } else if (browserConfig.url) {\n transports.push(\n new FetchTransport({\n url: browserConfig.url,\n apiKey: browserConfig.apiKey,\n })\n );\n } else {\n internalLogger.error('either \"url\" or \"transports\" must be defined');\n }\n\n function createMetas(): MetaItem[] {\n const initialMetas = defaultMetas;\n\n if (browserConfig.metas) {\n initialMetas.push(...browserConfig.metas);\n }\n\n const isK6BrowserSession = isObject((window as any).k6);\n\n if (isK6BrowserSession) {\n return [...initialMetas, k6Meta];\n }\n\n return initialMetas;\n }\n\n const config: Config = {\n app: browserConfig.app,\n batching: {\n ...defaultBatchingConfig,\n ...browserConfig.batching,\n },\n dedupe: browserConfig.dedupe ?? true,\n globalObjectKey: browserConfig.globalObjectKey || defaultGlobalObjectKey,\n instrumentations: browserConfig.instrumentations ?? getWebInstrumentations(),\n internalLoggerLevel: browserConfig.internalLoggerLevel ?? defaultInternalLoggerLevel,\n isolate: browserConfig.isolate ?? false,\n metas: createMetas(),\n parseStacktrace,\n paused: browserConfig.paused ?? false,\n preventGlobalExposure: browserConfig.preventGlobalExposure ?? false,\n transports,\n unpatchedConsole: browserConfig.unpatchedConsole ?? defaultUnpatchedConsole,\n\n beforeSend: browserConfig.beforeSend,\n eventDomain: browserConfig.eventDomain ?? defaultEventDomain,\n ignoreErrors: browserConfig.ignoreErrors,\n\n sessionTracking: {\n ...defaultSessionTrackingConfig,\n ...browserConfig.sessionTracking,\n },\n\n user: browserConfig.user,\n view: browserConfig.view ?? defaultViewMeta,\n };\n\n return config;\n}\n"]}
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.internalGlobalObjectKey = exports.globalObject = exports.getTransportBody = exports.getInternalFaroFromGlobalObject = exports.getCurrentTimestamp = exports.genShortID = exports.defaultLogLevel = exports.defaultInternalLoggerLevel = exports.defaultGlobalObjectKey = exports.defaultExceptionType = exports.deepEqual = exports.createPromiseBuffer = exports.createInternalLogger = exports.Conventions = exports.BaseTransport = exports.BaseInstrumentation = exports.BaseExtension = exports.allLogLevels = exports.faro = exports.FetchTransport = exports.ConsoleTransport = exports.sdkMeta = exports.pageMeta = exports.defaultViewMeta = exports.defaultMetas = exports.createSession = exports.browserMeta = exports.SessionInstrumentation = exports.WebVitalsInstrumentation = exports.ViewInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.ConsoleInstrumentation = exports.buildStackFrame = exports.initializeFaro = exports.defaultEventDomain = exports.makeCoreConfig = exports.getWebInstrumentations = void 0;
4
- exports.STORAGE_KEY = exports.SESSION_INACTIVITY_TIME = exports.SESSION_EXPIRATION_TIME = exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = exports.MAX_SESSION_PERSISTENCE_TIME = exports.VolatileSessionsManager = exports.PersistentSessionsManager = exports.VERSION = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.setInternalFaroOnGlobalObject = exports.noop = exports.LogLevel = exports.InternalLoggerLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInternalFaroOnGlobalObject = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = void 0;
4
+ exports.STORAGE_KEY = exports.SESSION_INACTIVITY_TIME = exports.SESSION_EXPIRATION_TIME = exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = exports.MAX_SESSION_PERSISTENCE_TIME = exports.VolatileSessionsManager = exports.PersistentSessionsManager = exports.EVENT_VIEW_CHANGED = exports.EVENT_SESSION_START = exports.EVENT_SESSION_RESUME = exports.EVENT_SESSION_EXTEND = exports.EVENT_ROUTE_CHANGE = exports.EVENT_NAVIGATION = exports.EVENT_CLICK = exports.VERSION = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.setInternalFaroOnGlobalObject = exports.noop = exports.LogLevel = exports.InternalLoggerLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInternalFaroOnGlobalObject = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = void 0;
5
5
  var config_1 = require("./config");
6
6
  Object.defineProperty(exports, "getWebInstrumentations", { enumerable: true, get: function () { return config_1.getWebInstrumentations; } });
7
7
  Object.defineProperty(exports, "makeCoreConfig", { enumerable: true, get: function () { return config_1.makeCoreConfig; } });
@@ -85,6 +85,13 @@ Object.defineProperty(exports, "setInternalFaroOnGlobalObject", { enumerable: tr
85
85
  Object.defineProperty(exports, "TransportItemType", { enumerable: true, get: function () { return faro_core_1.TransportItemType; } });
86
86
  Object.defineProperty(exports, "transportItemTypeToBodyKey", { enumerable: true, get: function () { return faro_core_1.transportItemTypeToBodyKey; } });
87
87
  Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return faro_core_1.VERSION; } });
88
+ Object.defineProperty(exports, "EVENT_CLICK", { enumerable: true, get: function () { return faro_core_1.EVENT_CLICK; } });
89
+ Object.defineProperty(exports, "EVENT_NAVIGATION", { enumerable: true, get: function () { return faro_core_1.EVENT_NAVIGATION; } });
90
+ Object.defineProperty(exports, "EVENT_ROUTE_CHANGE", { enumerable: true, get: function () { return faro_core_1.EVENT_ROUTE_CHANGE; } });
91
+ Object.defineProperty(exports, "EVENT_SESSION_EXTEND", { enumerable: true, get: function () { return faro_core_1.EVENT_SESSION_EXTEND; } });
92
+ Object.defineProperty(exports, "EVENT_SESSION_RESUME", { enumerable: true, get: function () { return faro_core_1.EVENT_SESSION_RESUME; } });
93
+ Object.defineProperty(exports, "EVENT_SESSION_START", { enumerable: true, get: function () { return faro_core_1.EVENT_SESSION_START; } });
94
+ Object.defineProperty(exports, "EVENT_VIEW_CHANGED", { enumerable: true, get: function () { return faro_core_1.EVENT_VIEW_CHANGED; } });
88
95
  var session_1 = require("./instrumentations/session");
89
96
  Object.defineProperty(exports, "PersistentSessionsManager", { enumerable: true, get: function () { return session_1.PersistentSessionsManager; } });
90
97
  Object.defineProperty(exports, "VolatileSessionsManager", { enumerable: true, get: function () { return session_1.VolatileSessionsManager; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAkE;AAAzD,gHAAA,sBAAsB,OAAA;AAAE,wGAAA,cAAc,OAAA;AAG/C,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAE3B,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,uDAU4B;AAT1B,mHAAA,eAAe,OAAA;AACf,0HAAA,sBAAsB,OAAA;AACtB,yHAAA,qBAAqB,OAAA;AACrB,+HAAA,2BAA2B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KAAK,OAAA;AACL,yHAAA,4BAA4B,OAAA;AAC5B,kGAAA,KAAK,OAAA;AACL,yGAAA,YAAY,OAAA;AACZ,mGAAA,MAAM,OAAA;AACN,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,wGAAA,WAAW,OAAA;AACX,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,qGAAA,QAAQ,OAAA;AACR,6GAAA,gBAAgB,OAAA;AAChB,uGAAA,UAAU,OAAA;AACV,uGAAA,UAAU,OAAA;AACV,qGAAA,QAAQ,OAAA;AACR,wGAAA,WAAW,OAAA;AACX,gHAAA,mBAAmB,OAAA;AACnB,qGAAA,QAAQ,OAAA;AACR,iGAAA,IAAI,OAAA;AACJ,0HAAA,6BAA6B,OAAA;AAC7B,8GAAA,iBAAiB,OAAA;AACjB,uHAAA,0BAA0B,OAAA;AAC1B,oGAAA,OAAO,OAAA;AAkET,sDAQoC;AAPlC,oHAAA,yBAAyB,OAAA;AACzB,kHAAA,uBAAuB,OAAA;AACvB,uHAAA,4BAA4B,OAAA;AAC5B,8HAAA,mCAAmC,OAAA;AACnC,kHAAA,uBAAuB,OAAA;AACvB,kHAAA,uBAAuB,OAAA;AACvB,sGAAA,WAAW,OAAA","sourcesContent":["export { getWebInstrumentations, makeCoreConfig } from './config';\nexport type { BrowserConfig } from './config';\n\nexport { defaultEventDomain } from './consts';\n\nexport { initializeFaro } from './initialize';\n\nexport {\n buildStackFrame,\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n ViewInstrumentation,\n WebVitalsInstrumentation,\n SessionInstrumentation,\n} from './instrumentations';\nexport type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectionEvent } from './instrumentations';\n\nexport { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta, sdkMeta } from './metas';\n\nexport { ConsoleTransport, FetchTransport } from './transports';\nexport type {\n ClockFn,\n ConsoleTransportOptions,\n FetchTransportOptions,\n FetchTransportRequestOptions,\n} from './transports';\n\nexport {\n faro,\n allLogLevels,\n BaseExtension,\n BaseInstrumentation,\n BaseTransport,\n Conventions,\n createInternalLogger,\n createPromiseBuffer,\n deepEqual,\n defaultExceptionType,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n getInternalFaroFromGlobalObject,\n getTransportBody,\n globalObject,\n internalGlobalObjectKey,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isInternalFaroOnGlobalObject,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n InternalLoggerLevel,\n LogLevel,\n noop,\n setInternalFaroOnGlobalObject,\n TransportItemType,\n transportItemTypeToBodyKey,\n VERSION,\n} from '@grafana/faro-core';\n\nexport type {\n Faro,\n API,\n APIEvent,\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BeforeSendHook,\n BufferItem,\n Config,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n Extension,\n GlobalObject,\n Instrumentation,\n Instrumentations,\n InternalLogger,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n Meta,\n MetaAPI,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n OTELApi,\n Patterns,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n UnpatchedConsole,\n} from '@grafana/faro-core';\n\nexport {\n PersistentSessionsManager,\n VolatileSessionsManager,\n MAX_SESSION_PERSISTENCE_TIME,\n MAX_SESSION_PERSISTENCE_TIME_BUFFER,\n SESSION_EXPIRATION_TIME,\n SESSION_INACTIVITY_TIME,\n STORAGE_KEY,\n} from './instrumentations/session';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAAkE;AAAzD,gHAAA,sBAAsB,OAAA;AAAE,wGAAA,cAAc,OAAA;AAG/C,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAE3B,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,uDAU4B;AAT1B,mHAAA,eAAe,OAAA;AACf,0HAAA,sBAAsB,OAAA;AACtB,yHAAA,qBAAqB,OAAA;AACrB,+HAAA,2BAA2B,OAAA;AAC3B,2HAAA,uBAAuB,OAAA;AACvB,mHAAA,eAAe,OAAA;AACf,uHAAA,mBAAmB,OAAA;AACnB,4HAAA,wBAAwB,OAAA;AACxB,0HAAA,sBAAsB,OAAA;AAIxB,iCAAuG;AAA9F,oGAAA,WAAW,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,qGAAA,YAAY,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAAE,gGAAA,OAAO,OAAA;AAErF,2CAAgE;AAAvD,8GAAA,gBAAgB,OAAA;AAAE,4GAAA,cAAc,OAAA;AAQzC,gDA+D4B;AA9D1B,iGAAA,IAAI,OAAA;AACJ,yGAAA,YAAY,OAAA;AACZ,0GAAA,aAAa,OAAA;AACb,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AACb,wGAAA,WAAW,OAAA;AACX,i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oGAAA,OAAO,OAAA;AACP,wGAAA,WAAW,OAAA;AACX,6GAAA,gBAAgB,OAAA;AAChB,+GAAA,kBAAkB,OAAA;AAClB,iHAAA,oBAAoB,OAAA;AACpB,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA;AACnB,+GAAA,kBAAkB,OAAA;AAkEpB,sDAQoC;AAPlC,oHAAA,yBAAyB,OAAA;AACzB,kHAAA,uBAAuB,OAAA;AACvB,uHAAA,4BAA4B,OAAA;AAC5B,8HAAA,mCAAmC,OAAA;AACnC,kHAAA,uBAAuB,OAAA;AACvB,kHAAA,uBAAuB,OAAA;AACvB,sGAAA,WAAW,OAAA","sourcesContent":["export { getWebInstrumentations, makeCoreConfig } from './config';\nexport type { BrowserConfig } from './config';\n\nexport { defaultEventDomain } from './consts';\n\nexport { initializeFaro } from './initialize';\n\nexport {\n buildStackFrame,\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n ViewInstrumentation,\n WebVitalsInstrumentation,\n SessionInstrumentation,\n} from './instrumentations';\nexport type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectionEvent } from './instrumentations';\n\nexport { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta, sdkMeta } from './metas';\n\nexport { ConsoleTransport, FetchTransport } from './transports';\nexport type {\n ClockFn,\n ConsoleTransportOptions,\n FetchTransportOptions,\n FetchTransportRequestOptions,\n} from './transports';\n\nexport {\n faro,\n allLogLevels,\n BaseExtension,\n BaseInstrumentation,\n BaseTransport,\n Conventions,\n createInternalLogger,\n createPromiseBuffer,\n deepEqual,\n defaultExceptionType,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n getInternalFaroFromGlobalObject,\n getTransportBody,\n globalObject,\n internalGlobalObjectKey,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isInternalFaroOnGlobalObject,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n InternalLoggerLevel,\n LogLevel,\n noop,\n setInternalFaroOnGlobalObject,\n TransportItemType,\n transportItemTypeToBodyKey,\n VERSION,\n EVENT_CLICK,\n EVENT_NAVIGATION,\n EVENT_ROUTE_CHANGE,\n EVENT_SESSION_EXTEND,\n EVENT_SESSION_RESUME,\n EVENT_SESSION_START,\n EVENT_VIEW_CHANGED,\n} from '@grafana/faro-core';\n\nexport type {\n Faro,\n API,\n APIEvent,\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BeforeSendHook,\n BufferItem,\n Config,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n Extension,\n GlobalObject,\n Instrumentation,\n Instrumentations,\n InternalLogger,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n Meta,\n MetaAPI,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n OTELApi,\n Patterns,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n UnpatchedConsole,\n} from '@grafana/faro-core';\n\nexport {\n PersistentSessionsManager,\n VolatileSessionsManager,\n MAX_SESSION_PERSISTENCE_TIME,\n MAX_SESSION_PERSISTENCE_TIME_BUFFER,\n SESSION_EXPIRATION_TIME,\n SESSION_INACTIVITY_TIME,\n STORAGE_KEY,\n} from './instrumentations/session';\n"]}
@@ -25,17 +25,6 @@ var __assign = (this && this.__assign) || function () {
25
25
  };
26
26
  return __assign.apply(this, arguments);
27
27
  };
28
- var __rest = (this && this.__rest) || function (s, e) {
29
- var t = {};
30
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
31
- t[p] = s[p];
32
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
33
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
34
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
35
- t[p[i]] = s[p[i]];
36
- }
37
- return t;
38
- };
39
28
  Object.defineProperty(exports, "__esModule", { value: true });
40
29
  exports.SessionInstrumentation = void 0;
41
30
  var faro_core_1 = require("@grafana/faro-core");
@@ -97,7 +86,7 @@ var SessionInstrumentation = /** @class */ (function (_super) {
97
86
  return sessionMeta;
98
87
  };
99
88
  SessionInstrumentation.prototype.initialize = function () {
100
- var _a, _b;
89
+ var _a, _b, _c;
101
90
  this.logDebug('init session instrumentation');
102
91
  var sessionTracking = this.config.sessionTracking;
103
92
  if (sessionTracking === null || sessionTracking === void 0 ? void 0 : sessionTracking.enabled) {
@@ -107,19 +96,34 @@ var SessionInstrumentation = /** @class */ (function (_super) {
107
96
  var initialSessionMeta = this.createInitialSessionMeta(sessionTracking);
108
97
  SessionManager.storeUserSession((0, sessionManagerUtils_1.createUserSessionObject)({
109
98
  sessionId: initialSessionMeta.id,
110
- isSampled: Boolean(initialSessionMeta.attributes['isSampled']),
99
+ isSampled: ((_b = initialSessionMeta.attributes) === null || _b === void 0 ? void 0 : _b['isSampled']) === 'true',
111
100
  }));
101
+ if (this.notifiedSession != null) {
102
+ this.sendSessionStartEvent(initialSessionMeta);
103
+ }
112
104
  this.notifiedSession = initialSessionMeta;
113
105
  this.api.setSession(initialSessionMeta);
114
106
  var updateSession_1 = new SessionManager().updateSession;
115
- (_b = this.transports) === null || _b === void 0 ? void 0 : _b.addBeforeSendHooks(function (item) {
116
- var _a;
107
+ (_c = this.transports) === null || _c === void 0 ? void 0 : _c.addBeforeSendHooks(function (item) {
108
+ var _a, _b, _c;
117
109
  updateSession_1();
118
110
  var attributes = (_a = item.meta.session) === null || _a === void 0 ? void 0 : _a.attributes;
119
- if (attributes && Boolean(attributes === null || attributes === void 0 ? void 0 : attributes['isSampled'])) {
120
- var _ = attributes.isSampled, restAttributes = __rest(attributes, ["isSampled"]);
121
- item.meta.session = __assign(__assign({}, item.meta.session), { attributes: restAttributes });
122
- return item;
111
+ if (attributes && (attributes === null || attributes === void 0 ? void 0 : attributes['isSampled']) === 'true') {
112
+ var newItem = void 0;
113
+ // Structured clone is supported in all major browsers
114
+ // but for old browsers we need a fallback
115
+ if ('structuredClone' in window) {
116
+ newItem = structuredClone(item);
117
+ }
118
+ else {
119
+ newItem = JSON.parse(JSON.stringify(item));
120
+ }
121
+ var newAttributes = (_b = newItem.meta.session) === null || _b === void 0 ? void 0 : _b.attributes;
122
+ newAttributes === null || newAttributes === void 0 ? true : delete newAttributes['isSampled'];
123
+ if (Object.keys(newAttributes !== null && newAttributes !== void 0 ? newAttributes : {}).length === 0) {
124
+ (_c = newItem.meta.session) === null || _c === void 0 ? true : delete _c.attributes;
125
+ }
126
+ return newItem;
123
127
  }
124
128
  return null;
125
129
  });
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAS4B;AAG5B,qCAA4C;AAE5C,mDAAmE;AACnE,wFAAuF;AACvF,4EAAmG;AACnG,kFAAkF;AAElF;IAA4C,0CAAmB;IAA/D;QAAA,qEAoHC;QAnHU,UAAI,GAAG,+CAA+C,CAAC;QACvD,a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CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IACH,6BAAC;AAAD,CAAC,AApHD,CAA4C,+BAAmB,GAoH9D;AApHY,wDAAsB","sourcesContent":["import {\n BaseInstrumentation,\n dateNow,\n EVENT_SESSION_EXTEND,\n EVENT_SESSION_RESUME,\n EVENT_SESSION_START,\n Meta,\n MetaSession,\n VERSION,\n} from '@grafana/faro-core';\nimport type { Config } from '@grafana/faro-core';\n\nimport { createSession } from '../../metas';\n\nimport { type FaroUserSession, isSampled } from './sessionManager';\nimport { PersistentSessionsManager } from './sessionManager/PersistentSessionsManager';\nimport { createUserSessionObject, isUserSessionValid } from './sessionManager/sessionManagerUtils';\nimport { VolatileSessionsManager } from './sessionManager/VolatileSessionManager';\n\nexport class SessionInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-session';\n readonly version = VERSION;\n\n // previously notified session, to ensure we don't send session start\n // event twice for the same session\n private notifiedSession: MetaSession | undefined;\n\n private sendSessionStartEvent(meta: Meta): void {\n const session = meta.session;\n\n if (session && session.id !== this.notifiedSession?.id) {\n if (this.notifiedSession && this.notifiedSession.id === session.attributes?.['previousSession']) {\n this.api.pushEvent(EVENT_SESSION_EXTEND, {}, undefined, { skipDedupe: true });\n this.notifiedSession = session;\n return;\n }\n\n this.notifiedSession = session;\n // no need to add attributes and session id, they are included as part of meta\n // automatically\n this.api.pushEvent(EVENT_SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n private createInitialSessionMeta(sessionsConfig: Required<Config>['sessionTracking']): MetaSession {\n const sessionManager = sessionsConfig.persistent ? PersistentSessionsManager : VolatileSessionsManager;\n\n let userSession: FaroUserSession | null = sessionManager.fetchUserSession();\n\n if (sessionsConfig.persistent && sessionsConfig.maxSessionPersistenceTime && userSession) {\n const now = dateNow();\n const shouldClearPersistentSession = userSession.lastActivity < now - sessionsConfig.maxSessionPersistenceTime;\n\n if (shouldClearPersistentSession) {\n PersistentSessionsManager.removeUserSession();\n userSession = null;\n }\n }\n\n let sessionId = sessionsConfig.session?.id;\n let sessionAttributes = sessionsConfig.session?.attributes;\n\n if (isUserSessionValid(userSession)) {\n sessionId = userSession?.sessionId;\n sessionAttributes = {\n ...userSession?.sessionMeta?.attributes,\n isSampled: userSession!.isSampled.toString(),\n };\n this.api.pushEvent(EVENT_SESSION_RESUME, {}, undefined, { skipDedupe: true });\n } else {\n sessionId = sessionId ?? createSession().id;\n this.api.pushEvent(EVENT_SESSION_START, {}, undefined, { skipDedupe: true });\n }\n\n const sessionMeta: MetaSession = {\n id: sessionId,\n attributes: {\n isSampled: isSampled().toString(),\n // We do not want to recalculate the sampling decision on each init phase.\n // If session from web-storage has a isSampled attribute we will use that instead.\n ...sessionAttributes,\n },\n };\n\n return sessionMeta;\n }\n\n initialize() {\n this.logDebug('init session instrumentation');\n\n const sessionTracking = this.config.sessionTracking;\n\n if (sessionTracking?.enabled) {\n const SessionManager = this.config.sessionTracking?.persistent\n ? PersistentSessionsManager\n : VolatileSessionsManager;\n\n const initialSessionMeta = this.createInitialSessionMeta(sessionTracking);\n\n SessionManager.storeUserSession(\n createUserSessionObject({\n sessionId: initialSessionMeta.id,\n isSampled: Boolean(initialSessionMeta.attributes!['isSampled']),\n })\n );\n\n this.notifiedSession = initialSessionMeta;\n this.api.setSession(initialSessionMeta);\n\n const { updateSession } = new SessionManager();\n\n this.transports?.addBeforeSendHooks((item) => {\n updateSession();\n\n const attributes = item.meta.session?.attributes;\n\n if (attributes && Boolean(attributes?.['isSampled'])) {\n const { isSampled: _, ...restAttributes } = attributes;\n\n item.meta.session = {\n ...item.meta.session,\n attributes: restAttributes,\n };\n\n return item;\n }\n\n return null;\n });\n } else {\n this.sendSessionStartEvent(this.metas.value);\n }\n\n this.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],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AM,EAAE;wBAC/B,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;qBACjC;yBAAM;wBACL,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;qBAC5C;oBAED,IAAM,aAAa,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,OAAO,0CAAE,UAAU,CAAC;oBAChD,aAAa,aAAb,aAAa,4BAAb,aAAa,CAAG,WAAW,CAAC,CAAC;oBAEpC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;wBAC1C,MAAA,OAAO,CAAC,IAAI,CAAC,OAAO,+CAAE,UAAU,CAAC;qBACzC;oBAED,OAAO,OAAO,CAAC;iBAChB;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC9C;QAED,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IACH,6BAAC;AAAD,CAAC,AAlID,CAA4C,+BAAmB,GAkI9D;AAlIY,wDAAsB","sourcesContent":["import {\n BaseInstrumentation,\n dateNow,\n EVENT_SESSION_EXTEND,\n EVENT_SESSION_RESUME,\n EVENT_SESSION_START,\n Meta,\n MetaSession,\n VERSION,\n} from '@grafana/faro-core';\nimport type { Config } from '@grafana/faro-core';\n\nimport type { TransportItem } from '../..';\nimport { createSession } from '../../metas';\n\nimport { type FaroUserSession, isSampled } from './sessionManager';\nimport { PersistentSessionsManager } from './sessionManager/PersistentSessionsManager';\nimport { createUserSessionObject, isUserSessionValid } from './sessionManager/sessionManagerUtils';\nimport { VolatileSessionsManager } from './sessionManager/VolatileSessionManager';\n\nexport class SessionInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-session';\n readonly version = VERSION;\n\n // previously notified session, to ensure we don't send session start\n // event twice for the same session\n private notifiedSession: MetaSession | undefined;\n\n private sendSessionStartEvent(meta: Meta): void {\n const session = meta.session;\n\n if (session && session.id !== this.notifiedSession?.id) {\n if (this.notifiedSession && this.notifiedSession.id === session.attributes?.['previousSession']) {\n this.api.pushEvent(EVENT_SESSION_EXTEND, {}, undefined, { skipDedupe: true });\n this.notifiedSession = session;\n return;\n }\n\n this.notifiedSession = session;\n // no need to add attributes and session id, they are included as part of meta\n // automatically\n this.api.pushEvent(EVENT_SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n private createInitialSessionMeta(sessionsConfig: Required<Config>['sessionTracking']): MetaSession {\n const sessionManager = sessionsConfig.persistent ? PersistentSessionsManager : VolatileSessionsManager;\n\n let userSession: FaroUserSession | null = sessionManager.fetchUserSession();\n\n if (sessionsConfig.persistent && sessionsConfig.maxSessionPersistenceTime && userSession) {\n const now = dateNow();\n const shouldClearPersistentSession = userSession.lastActivity < now - sessionsConfig.maxSessionPersistenceTime;\n\n if (shouldClearPersistentSession) {\n PersistentSessionsManager.removeUserSession();\n userSession = null;\n }\n }\n\n let sessionId = sessionsConfig.session?.id;\n let sessionAttributes = sessionsConfig.session?.attributes;\n\n if (isUserSessionValid(userSession)) {\n sessionId = userSession?.sessionId;\n sessionAttributes = {\n ...userSession?.sessionMeta?.attributes,\n isSampled: userSession!.isSampled.toString(),\n };\n this.api.pushEvent(EVENT_SESSION_RESUME, {}, undefined, { skipDedupe: true });\n } else {\n sessionId = sessionId ?? createSession().id;\n this.api.pushEvent(EVENT_SESSION_START, {}, undefined, { skipDedupe: true });\n }\n\n const sessionMeta: MetaSession = {\n id: sessionId,\n attributes: {\n isSampled: isSampled().toString(),\n // We do not want to recalculate the sampling decision on each init phase.\n // If session from web-storage has a isSampled attribute we will use that instead.\n ...sessionAttributes,\n },\n };\n\n return sessionMeta;\n }\n\n initialize() {\n this.logDebug('init session instrumentation');\n\n const sessionTracking = this.config.sessionTracking;\n\n if (sessionTracking?.enabled) {\n const SessionManager = this.config.sessionTracking?.persistent\n ? PersistentSessionsManager\n : VolatileSessionsManager;\n\n const initialSessionMeta = this.createInitialSessionMeta(sessionTracking);\n\n SessionManager.storeUserSession(\n createUserSessionObject({\n sessionId: initialSessionMeta.id,\n isSampled: initialSessionMeta.attributes?.['isSampled'] === 'true',\n })\n );\n\n if (this.notifiedSession != null) {\n this.sendSessionStartEvent(initialSessionMeta as Meta);\n }\n\n this.notifiedSession = initialSessionMeta;\n this.api.setSession(initialSessionMeta);\n\n const { updateSession } = new SessionManager();\n\n this.transports?.addBeforeSendHooks((item) => {\n updateSession();\n\n const attributes = item.meta.session?.attributes;\n\n if (attributes && attributes?.['isSampled'] === 'true') {\n let newItem: TransportItem;\n\n // Structured clone is supported in all major browsers\n // but for old browsers we need a fallback\n if ('structuredClone' in window) {\n newItem = structuredClone(item);\n } else {\n newItem = JSON.parse(JSON.stringify(item));\n }\n\n const newAttributes = newItem.meta.session?.attributes;\n delete newAttributes?.['isSampled'];\n\n if (Object.keys(newAttributes ?? {}).length === 0) {\n delete newItem.meta.session?.attributes;\n }\n\n return newItem;\n }\n\n return null;\n });\n } else {\n this.sendSessionStartEvent(this.metas.value);\n }\n\n this.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}
@@ -8,7 +8,7 @@ exports.STORAGE_UPDATE_DELAY = 1 * 1000; // seconds
8
8
  exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER = 1 * 60 * 1000;
9
9
  exports.MAX_SESSION_PERSISTENCE_TIME = exports.SESSION_INACTIVITY_TIME + exports.MAX_SESSION_PERSISTENCE_TIME_BUFFER;
10
10
  exports.defaultSessionTrackingConfig = {
11
- enabled: false,
11
+ enabled: true,
12
12
  persistent: false,
13
13
  maxSessionPersistenceTime: exports.MAX_SESSION_PERSISTENCE_TIME,
14
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sessionConstants.js","sourceRoot":"","sources":["../../../../../src/instrumentations/session/sessionManager/sessionConstants.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM;AACpD,QAAA,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AACpD,QAAA,oBAAoB,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU;AAE3C,QAAA,mCAAmC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACpD,QAAA,4BAA4B,GAAG,+BAAuB,GAAG,2CAAmC,CAAC;AAE7F,QAAA,4BAA4B,GAA8B;IACrE,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,KAAK;IACjB,yBAAyB,EAAE,oCAA4B;CAC/C,CAAC","sourcesContent":["import type { Config } from '@grafana/faro-core';\n\nexport const STORAGE_KEY = '__FARO_SESSION__';\nexport const SESSION_EXPIRATION_TIME = 4 * 60 * 60 * 1000; // hrs\nexport const SESSION_INACTIVITY_TIME = 15 * 60 * 1000; // minutes\nexport const STORAGE_UPDATE_DELAY = 1 * 1000; // seconds\n\nexport const MAX_SESSION_PERSISTENCE_TIME_BUFFER = 1 * 60 * 1000;\nexport const MAX_SESSION_PERSISTENCE_TIME = SESSION_INACTIVITY_TIME + MAX_SESSION_PERSISTENCE_TIME_BUFFER;\n\nexport const defaultSessionTrackingConfig: Config['sessionTracking'] = {\n enabled: false,\n persistent: false,\n maxSessionPersistenceTime: MAX_SESSION_PERSISTENCE_TIME,\n} as const;\n"]}
1
+ {"version":3,"file":"sessionConstants.js","sourceRoot":"","sources":["../../../../../src/instrumentations/session/sessionManager/sessionConstants.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM;AACpD,QAAA,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AACpD,QAAA,oBAAoB,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU;AAE3C,QAAA,mCAAmC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACpD,QAAA,4BAA4B,GAAG,+BAAuB,GAAG,2CAAmC,CAAC;AAE7F,QAAA,4BAA4B,GAA8B;IACrE,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,KAAK;IACjB,yBAAyB,EAAE,oCAA4B;CAC/C,CAAC","sourcesContent":["import type { Config } from '@grafana/faro-core';\n\nexport const STORAGE_KEY = '__FARO_SESSION__';\nexport const SESSION_EXPIRATION_TIME = 4 * 60 * 60 * 1000; // hrs\nexport const SESSION_INACTIVITY_TIME = 15 * 60 * 1000; // minutes\nexport const STORAGE_UPDATE_DELAY = 1 * 1000; // seconds\n\nexport const MAX_SESSION_PERSISTENCE_TIME_BUFFER = 1 * 60 * 1000;\nexport const MAX_SESSION_PERSISTENCE_TIME = SESSION_INACTIVITY_TIME + MAX_SESSION_PERSISTENCE_TIME_BUFFER;\n\nexport const defaultSessionTrackingConfig: Config['sessionTracking'] = {\n enabled: true,\n persistent: false,\n maxSessionPersistenceTime: MAX_SESSION_PERSISTENCE_TIME,\n} as const;\n"]}
@@ -27,10 +27,14 @@ var ViewInstrumentation = /** @class */ (function (_super) {
27
27
  return _this;
28
28
  }
29
29
  ViewInstrumentation.prototype.sendViewChangedEvent = function (meta) {
30
+ var _a, _b, _c;
30
31
  var view = meta.view;
31
- if (view && view !== this.notifiedView) {
32
+ if (view && view.name !== ((_a = this.notifiedView) === null || _a === void 0 ? void 0 : _a.name)) {
33
+ this.api.pushEvent(faro_core_1.EVENT_VIEW_CHANGED, {
34
+ fromView: (_c = (_b = this.notifiedView) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '',
35
+ toView: view.name,
36
+ }, undefined, { skipDedupe: true });
32
37
  this.notifiedView = view;
33
- this.api.pushEvent(faro_core_1.EVENT_VIEW_CHANGED, {}, undefined, { skipDedupe: true });
34
38
  }
35
39
  };
36
40
  ViewInstrumentation.prototype.initialize = function () {
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/view/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAsG;AAEtG,2CAA2C;AAC3C;IAAyC,uCAAmB;IAA5D;QAAA,qEAuBC;QAtBU,UAAI,GAAG,4CAA4C,CAAC;QACpD,aAAO,GAAG,mBAAO,CAAC;;IAqB7B,CAAC;IAfS,kDAAoB,GAA5B,UAA6B,IAAU;QACrC,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAEzB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,8BAAkB,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC7E;IACH,CAAC;IAED,wCAAU,GAAV;QACE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IACH,0BAAC;AAAD,CAAC,AAvBD,CAAyC,+BAAmB,GAuB3D;AAvBY,kDAAmB","sourcesContent":["import { BaseInstrumentation, EVENT_VIEW_CHANGED, Meta, MetaView, VERSION } from '@grafana/faro-core';\n\n// all this does is send VIEW_CHANGED event\nexport class ViewInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-view';\n readonly version = VERSION;\n\n // previously notified view, to ensure we don't send view changed\n // event twice for the same view\n private notifiedView: MetaView | undefined;\n\n private sendViewChangedEvent(meta: Meta): void {\n const view = meta.view;\n\n if (view && view !== this.notifiedView) {\n this.notifiedView = view;\n\n this.api.pushEvent(EVENT_VIEW_CHANGED, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendViewChangedEvent(this.metas.value);\n\n this.metas.addListener(this.sendViewChangedEvent.bind(this));\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/view/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAsG;AAEtG,2CAA2C;AAC3C;IAAyC,uCAAmB;IAA5D;QAAA,qEA+BC;QA9BU,UAAI,GAAG,4CAA4C,CAAC;QACpD,aAAO,GAAG,mBAAO,CAAC;;IA6B7B,CAAC;IAvBS,kDAAoB,GAA5B,UAA6B,IAAU;;QACrC,IAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,MAAK,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAA,EAAE;YACjD,IAAI,CAAC,GAAG,CAAC,SAAS,CAChB,8BAAkB,EAClB;gBACE,QAAQ,EAAE,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,mCAAI,EAAE;gBACvC,MAAM,EAAE,IAAI,CAAC,IAAI;aAClB,EACD,SAAS,EACT,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;YAEF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B;IACH,CAAC;IAED,wCAAU,GAAV;QACE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IACH,0BAAC;AAAD,CAAC,AA/BD,CAAyC,+BAAmB,GA+B3D;AA/BY,kDAAmB","sourcesContent":["import { BaseInstrumentation, EVENT_VIEW_CHANGED, Meta, MetaView, VERSION } from '@grafana/faro-core';\n\n// all this does is send VIEW_CHANGED event\nexport class ViewInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-view';\n readonly version = VERSION;\n\n // previously notified view, to ensure we don't send view changed\n // event twice for the same view\n private notifiedView: MetaView | undefined;\n\n private sendViewChangedEvent(meta: Meta): void {\n const view = meta.view;\n\n if (view && view.name !== this.notifiedView?.name) {\n this.api.pushEvent(\n EVENT_VIEW_CHANGED,\n {\n fromView: this.notifiedView?.name ?? '',\n toView: view.name,\n },\n undefined,\n { skipDedupe: true }\n );\n\n this.notifiedView = view;\n }\n }\n\n initialize() {\n this.sendViewChangedEvent(this.metas.value);\n\n this.metas.addListener(this.sendViewChangedEvent.bind(this));\n }\n}\n"]}
@@ -2,12 +2,12 @@ import { createInternalLogger, defaultBatchingConfig, defaultGlobalObjectKey, de
2
2
  import { defaultEventDomain } from '../consts';
3
3
  import { parseStacktrace } from '../instrumentations';
4
4
  import { defaultSessionTrackingConfig } from '../instrumentations/session';
5
- import { createSession, defaultMetas, defaultViewMeta } from '../metas';
5
+ import { defaultMetas, defaultViewMeta } from '../metas';
6
6
  import { k6Meta } from '../metas/k6';
7
7
  import { FetchTransport } from '../transports';
8
8
  import { getWebInstrumentations } from './getWebInstrumentations';
9
9
  export function makeCoreConfig(browserConfig) {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11
11
  const transports = [];
12
12
  const internalLogger = createInternalLogger(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);
13
13
  if (browserConfig.transports) {
@@ -54,14 +54,9 @@ export function makeCoreConfig(browserConfig) {
54
54
  eventDomain: (_h = browserConfig.eventDomain) !== null && _h !== void 0 ? _h : defaultEventDomain,
55
55
  ignoreErrors: browserConfig.ignoreErrors,
56
56
  sessionTracking: Object.assign(Object.assign({}, defaultSessionTrackingConfig), browserConfig.sessionTracking),
57
- // TODO: deprecate/remove legacy session object at ga
58
- session: (_j = browserConfig.session) !== null && _j !== void 0 ? _j : createSession(),
59
57
  user: browserConfig.user,
60
- view: (_k = browserConfig.view) !== null && _k !== void 0 ? _k : defaultViewMeta,
58
+ view: (_j = browserConfig.view) !== null && _j !== void 0 ? _j : defaultViewMeta,
61
59
  };
62
- if ((_l = config.sessionTracking) === null || _l === void 0 ? void 0 : _l.enabled) {
63
- delete config.session;
64
- }
65
60
  return config;
66
61
  }
67
62
  //# sourceMappingURL=makeCoreConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"makeCoreConfig.js","sourceRoot":"","sources":["../../../src/config/makeCoreConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,MAAM,UAAU,cAAc,CAAC,aAA4B;;IACzD,MAAM,UAAU,GAAgB,EAAE,CAAC;IAEnC,MAAM,cAAc,GAAG,oBAAoB,CAAC,aAAa,CAA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B;QACpF,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,KAAK;QACvC,KAAK,EAAE,WAAW,EAAE;QACpB,eAAe;QACf,MAAM,EAAE,MAAA,aAAa,CAAC,MAAM,mCAAI,KAAK;QACrC,qBAAqB,EAAE,MAAA,aAAa,CAAC,qBAAqB,mCAAI,KAAK;QACnE,UAAU;QACV,gBAAgB,EAAE,MAAA,aAAa,CAAC,gBAAgB,mCAAI,uBAAuB;QAE3E,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,kBAAkB;QAC5D,YAAY,EAAE,aAAa,CAAC,YAAY;QAExC,eAAe,kCACV,4BAA4B,GAC5B,aAAa,CAAC,eAAe,CACjC;QAED,qDAAqD;QACrD,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,aAAa,EAAE;QAEjD,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,IAAI,EAAE,MAAA,aAAa,CAAC,IAAI,mCAAI,eAAe;KAC5C,CAAC;IAEF,IAAI,MAAA,MAAM,CAAC,eAAe,0CAAE,OAAO,EAAE;QACnC,OAAO,MAAM,CAAC,OAAO,CAAC;KACvB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createInternalLogger,\n defaultBatchingConfig,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultUnpatchedConsole,\n isObject,\n} from '@grafana/faro-core';\nimport type { Config, MetaItem, Transport } from '@grafana/faro-core';\n\nimport { defaultEventDomain } from '../consts';\nimport { parseStacktrace } from '../instrumentations';\nimport { defaultSessionTrackingConfig } from '../instrumentations/session';\nimport { createSession, defaultMetas, defaultViewMeta } from '../metas';\nimport { k6Meta } from '../metas/k6';\nimport { FetchTransport } from '../transports';\n\nimport { getWebInstrumentations } from './getWebInstrumentations';\nimport type { BrowserConfig } from './types';\n\nexport function makeCoreConfig(browserConfig: BrowserConfig): Config | undefined {\n const transports: Transport[] = [];\n\n const internalLogger = createInternalLogger(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);\n\n if (browserConfig.transports) {\n if (browserConfig.url || browserConfig.apiKey) {\n internalLogger.error('if \"transports\" is defined, \"url\" and \"apiKey\" should not be defined');\n }\n\n transports.push(...browserConfig.transports);\n } else if (browserConfig.url) {\n transports.push(\n new FetchTransport({\n url: browserConfig.url,\n apiKey: browserConfig.apiKey,\n })\n );\n } else {\n internalLogger.error('either \"url\" or \"transports\" must be defined');\n }\n\n function createMetas(): MetaItem[] {\n const initialMetas = defaultMetas;\n\n if (browserConfig.metas) {\n initialMetas.push(...browserConfig.metas);\n }\n\n const isK6BrowserSession = isObject((window as any).k6);\n\n if (isK6BrowserSession) {\n return [...initialMetas, k6Meta];\n }\n\n return initialMetas;\n }\n\n const config: Config = {\n app: browserConfig.app,\n batching: {\n ...defaultBatchingConfig,\n ...browserConfig.batching,\n },\n dedupe: browserConfig.dedupe ?? true,\n globalObjectKey: browserConfig.globalObjectKey || defaultGlobalObjectKey,\n instrumentations: browserConfig.instrumentations ?? getWebInstrumentations(),\n internalLoggerLevel: browserConfig.internalLoggerLevel ?? defaultInternalLoggerLevel,\n isolate: browserConfig.isolate ?? false,\n metas: createMetas(),\n parseStacktrace,\n paused: browserConfig.paused ?? false,\n preventGlobalExposure: browserConfig.preventGlobalExposure ?? false,\n transports,\n unpatchedConsole: browserConfig.unpatchedConsole ?? defaultUnpatchedConsole,\n\n beforeSend: browserConfig.beforeSend,\n eventDomain: browserConfig.eventDomain ?? defaultEventDomain,\n ignoreErrors: browserConfig.ignoreErrors,\n\n sessionTracking: {\n ...defaultSessionTrackingConfig,\n ...browserConfig.sessionTracking,\n },\n\n // TODO: deprecate/remove legacy session object at ga\n session: browserConfig.session ?? createSession(),\n\n user: browserConfig.user,\n view: browserConfig.view ?? defaultViewMeta,\n };\n\n if (config.sessionTracking?.enabled) {\n delete config.session;\n }\n\n return config;\n}\n"]}
1
+ {"version":3,"file":"makeCoreCon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CAAI,eAAe;KAC5C,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {\n createInternalLogger,\n defaultBatchingConfig,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultUnpatchedConsole,\n isObject,\n} from '@grafana/faro-core';\nimport type { Config, MetaItem, Transport } from '@grafana/faro-core';\n\nimport { defaultEventDomain } from '../consts';\nimport { parseStacktrace } from '../instrumentations';\nimport { defaultSessionTrackingConfig } from '../instrumentations/session';\nimport { defaultMetas, defaultViewMeta } from '../metas';\nimport { k6Meta } from '../metas/k6';\nimport { FetchTransport } from '../transports';\n\nimport { getWebInstrumentations } from './getWebInstrumentations';\nimport type { BrowserConfig } from './types';\n\nexport function makeCoreConfig(browserConfig: BrowserConfig): Config | undefined {\n const transports: Transport[] = [];\n\n const internalLogger = createInternalLogger(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);\n\n if (browserConfig.transports) {\n if (browserConfig.url || browserConfig.apiKey) {\n internalLogger.error('if \"transports\" is defined, \"url\" and \"apiKey\" should not be defined');\n }\n\n transports.push(...browserConfig.transports);\n } else if (browserConfig.url) {\n transports.push(\n new FetchTransport({\n url: browserConfig.url,\n apiKey: browserConfig.apiKey,\n })\n );\n } else {\n internalLogger.error('either \"url\" or \"transports\" must be defined');\n }\n\n function createMetas(): MetaItem[] {\n const initialMetas = defaultMetas;\n\n if (browserConfig.metas) {\n initialMetas.push(...browserConfig.metas);\n }\n\n const isK6BrowserSession = isObject((window as any).k6);\n\n if (isK6BrowserSession) {\n return [...initialMetas, k6Meta];\n }\n\n return initialMetas;\n }\n\n const config: Config = {\n app: browserConfig.app,\n batching: {\n ...defaultBatchingConfig,\n ...browserConfig.batching,\n },\n dedupe: browserConfig.dedupe ?? true,\n globalObjectKey: browserConfig.globalObjectKey || defaultGlobalObjectKey,\n instrumentations: browserConfig.instrumentations ?? getWebInstrumentations(),\n internalLoggerLevel: browserConfig.internalLoggerLevel ?? defaultInternalLoggerLevel,\n isolate: browserConfig.isolate ?? false,\n metas: createMetas(),\n parseStacktrace,\n paused: browserConfig.paused ?? false,\n preventGlobalExposure: browserConfig.preventGlobalExposure ?? false,\n transports,\n unpatchedConsole: browserConfig.unpatchedConsole ?? defaultUnpatchedConsole,\n\n beforeSend: browserConfig.beforeSend,\n eventDomain: browserConfig.eventDomain ?? defaultEventDomain,\n ignoreErrors: browserConfig.ignoreErrors,\n\n sessionTracking: {\n ...defaultSessionTrackingConfig,\n ...browserConfig.sessionTracking,\n },\n\n user: browserConfig.user,\n view: browserConfig.view ?? defaultViewMeta,\n };\n\n return config;\n}\n"]}
package/dist/esm/index.js CHANGED
@@ -4,6 +4,6 @@ export { initializeFaro } from './initialize';
4
4
  export { buildStackFrame, ConsoleInstrumentation, ErrorsInstrumentation, getDataFromSafariExtensions, getStackFramesFromError, parseStacktrace, ViewInstrumentation, WebVitalsInstrumentation, SessionInstrumentation, } from './instrumentations';
5
5
  export { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta, sdkMeta } from './metas';
6
6
  export { ConsoleTransport, FetchTransport } from './transports';
7
- export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, } from '@grafana/faro-core';
7
+ export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, EVENT_CLICK, EVENT_NAVIGATION, EVENT_ROUTE_CHANGE, EVENT_SESSION_EXTEND, EVENT_SESSION_RESUME, EVENT_SESSION_START, EVENT_VIEW_CHANGED, } from '@grafana/faro-core';
8
8
  export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './instrumentations/session';
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvG,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQhE,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,+BAA+B,EAC/B,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,IAAI,EACJ,6BAA6B,EAC7B,iBAAiB,EACjB,0BAA0B,EAC1B,OAAO,GACR,MAAM,oBAAoB,CAAC;AAiE5B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,mCAAmC,EACnC,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,GACZ,MAAM,4BAA4B,CAAC","sourcesContent":["export { getWebInstrumentations, makeCoreConfig } from './config';\nexport type { BrowserConfig } from './config';\n\nexport { defaultEventDomain } from './consts';\n\nexport { initializeFaro } from './initialize';\n\nexport {\n buildStackFrame,\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n ViewInstrumentation,\n WebVitalsInstrumentation,\n SessionInstrumentation,\n} from './instrumentations';\nexport type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectionEvent } from './instrumentations';\n\nexport { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta, sdkMeta } from './metas';\n\nexport { ConsoleTransport, FetchTransport } from './transports';\nexport type {\n ClockFn,\n ConsoleTransportOptions,\n FetchTransportOptions,\n FetchTransportRequestOptions,\n} from './transports';\n\nexport {\n faro,\n allLogLevels,\n BaseExtension,\n BaseInstrumentation,\n BaseTransport,\n Conventions,\n createInternalLogger,\n createPromiseBuffer,\n deepEqual,\n defaultExceptionType,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n getInternalFaroFromGlobalObject,\n getTransportBody,\n globalObject,\n internalGlobalObjectKey,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isInternalFaroOnGlobalObject,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n InternalLoggerLevel,\n LogLevel,\n noop,\n setInternalFaroOnGlobalObject,\n TransportItemType,\n transportItemTypeToBodyKey,\n VERSION,\n} from '@grafana/faro-core';\n\nexport type {\n Faro,\n API,\n APIEvent,\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BeforeSendHook,\n BufferItem,\n Config,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n Extension,\n GlobalObject,\n Instrumentation,\n Instrumentations,\n InternalLogger,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n Meta,\n MetaAPI,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n OTELApi,\n Patterns,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n UnpatchedConsole,\n} from '@grafana/faro-core';\n\nexport {\n PersistentSessionsManager,\n VolatileSessionsManager,\n MAX_SESSION_PERSISTENCE_TIME,\n MAX_SESSION_PERSISTENCE_TIME_BUFFER,\n SESSION_EXPIRATION_TIME,\n SESSION_INACTIVITY_TIME,\n STORAGE_KEY,\n} from './instrumentations/session';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvG,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQhE,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,+BAA+B,EAC/B,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,IAAI,EACJ,6BAA6B,EAC7B,iBAAiB,EACjB,0BAA0B,EAC1B,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAiE5B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,mCAAmC,EACnC,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,GACZ,MAAM,4BAA4B,CAAC","sourcesContent":["export { getWebInstrumentations, makeCoreConfig } from './config';\nexport type { BrowserConfig } from './config';\n\nexport { defaultEventDomain } from './consts';\n\nexport { initializeFaro } from './initialize';\n\nexport {\n buildStackFrame,\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n ViewInstrumentation,\n WebVitalsInstrumentation,\n SessionInstrumentation,\n} from './instrumentations';\nexport type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectionEvent } from './instrumentations';\n\nexport { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta, sdkMeta } from './metas';\n\nexport { ConsoleTransport, FetchTransport } from './transports';\nexport type {\n ClockFn,\n ConsoleTransportOptions,\n FetchTransportOptions,\n FetchTransportRequestOptions,\n} from './transports';\n\nexport {\n faro,\n allLogLevels,\n BaseExtension,\n BaseInstrumentation,\n BaseTransport,\n Conventions,\n createInternalLogger,\n createPromiseBuffer,\n deepEqual,\n defaultExceptionType,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n getInternalFaroFromGlobalObject,\n getTransportBody,\n globalObject,\n internalGlobalObjectKey,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isInternalFaroOnGlobalObject,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n InternalLoggerLevel,\n LogLevel,\n noop,\n setInternalFaroOnGlobalObject,\n TransportItemType,\n transportItemTypeToBodyKey,\n VERSION,\n EVENT_CLICK,\n EVENT_NAVIGATION,\n EVENT_ROUTE_CHANGE,\n EVENT_SESSION_EXTEND,\n EVENT_SESSION_RESUME,\n EVENT_SESSION_START,\n EVENT_VIEW_CHANGED,\n} from '@grafana/faro-core';\n\nexport type {\n Faro,\n API,\n APIEvent,\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BeforeSendHook,\n BufferItem,\n Config,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n Extension,\n GlobalObject,\n Instrumentation,\n Instrumentations,\n InternalLogger,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n Meta,\n MetaAPI,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n OTELApi,\n Patterns,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n UnpatchedConsole,\n} from '@grafana/faro-core';\n\nexport {\n PersistentSessionsManager,\n VolatileSessionsManager,\n MAX_SESSION_PERSISTENCE_TIME,\n MAX_SESSION_PERSISTENCE_TIME_BUFFER,\n SESSION_EXPIRATION_TIME,\n SESSION_INACTIVITY_TIME,\n STORAGE_KEY,\n} from './instrumentations/session';\n"]}
@@ -1,14 +1,3 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import { BaseInstrumentation, dateNow, EVENT_SESSION_EXTEND, EVENT_SESSION_RESUME, EVENT_SESSION_START, VERSION, } from '@grafana/faro-core';
13
2
  import { createSession } from '../../metas';
14
3
  import { isSampled } from './sessionManager';
@@ -66,7 +55,7 @@ export class SessionInstrumentation extends BaseInstrumentation {
66
55
  return sessionMeta;
67
56
  }
68
57
  initialize() {
69
- var _a, _b;
58
+ var _a, _b, _c;
70
59
  this.logDebug('init session instrumentation');
71
60
  const sessionTracking = this.config.sessionTracking;
72
61
  if (sessionTracking === null || sessionTracking === void 0 ? void 0 : sessionTracking.enabled) {
@@ -76,19 +65,34 @@ export class SessionInstrumentation extends BaseInstrumentation {
76
65
  const initialSessionMeta = this.createInitialSessionMeta(sessionTracking);
77
66
  SessionManager.storeUserSession(createUserSessionObject({
78
67
  sessionId: initialSessionMeta.id,
79
- isSampled: Boolean(initialSessionMeta.attributes['isSampled']),
68
+ isSampled: ((_b = initialSessionMeta.attributes) === null || _b === void 0 ? void 0 : _b['isSampled']) === 'true',
80
69
  }));
70
+ if (this.notifiedSession != null) {
71
+ this.sendSessionStartEvent(initialSessionMeta);
72
+ }
81
73
  this.notifiedSession = initialSessionMeta;
82
74
  this.api.setSession(initialSessionMeta);
83
75
  const { updateSession } = new SessionManager();
84
- (_b = this.transports) === null || _b === void 0 ? void 0 : _b.addBeforeSendHooks((item) => {
85
- var _a;
76
+ (_c = this.transports) === null || _c === void 0 ? void 0 : _c.addBeforeSendHooks((item) => {
77
+ var _a, _b, _c;
86
78
  updateSession();
87
79
  const attributes = (_a = item.meta.session) === null || _a === void 0 ? void 0 : _a.attributes;
88
- if (attributes && Boolean(attributes === null || attributes === void 0 ? void 0 : attributes['isSampled'])) {
89
- const { isSampled: _ } = attributes, restAttributes = __rest(attributes, ["isSampled"]);
90
- item.meta.session = Object.assign(Object.assign({}, item.meta.session), { attributes: restAttributes });
91
- return item;
80
+ if (attributes && (attributes === null || attributes === void 0 ? void 0 : attributes['isSampled']) === 'true') {
81
+ let newItem;
82
+ // Structured clone is supported in all major browsers
83
+ // but for old browsers we need a fallback
84
+ if ('structuredClone' in window) {
85
+ newItem = structuredClone(item);
86
+ }
87
+ else {
88
+ newItem = JSON.parse(JSON.stringify(item));
89
+ }
90
+ const newAttributes = (_b = newItem.meta.session) === null || _b === void 0 ? void 0 : _b.attributes;
91
+ newAttributes === null || newAttributes === void 0 ? true : delete newAttributes['isSampled'];
92
+ if (Object.keys(newAttributes !== null && newAttributes !== void 0 ? newAttributes : {}).length === 0) {
93
+ (_c = newItem.meta.session) === null || _c === void 0 ? true : delete _c.attributes;
94
+ }
95
+ return newItem;
92
96
  }
93
97
  return null;
94
98
  });
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EAGnB,OAAO,GACR,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAwB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAA/D;;QACW,SAAI,GAAG,+CAA+C,CAAC;QACvD,YAAO,GAAG,OAAO,CAAC;IAkH7B,CAAC;IA5GS,qBAAqB,CAAC,IAAU;;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,CAAC,EAAE,MAAK,MAAA,IAAI,CAAC,eAAe,0CAAE,EAAE,CAAA,EAAE;YACtD,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,EAAE,MAAK,MAAA,OAAO,CAAC,UAAU,0CAAG,iBAAiB,CAAC,CAAA,EAAE;gBAC/F,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,oBAAoB,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC9E,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;gBAC/B,OAAO;aACR;YAED,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;YAC/B,8EAA8E;YAC9E,gBAAgB;YAChB,IAAI,CAAC,GAAG,CAAC,SAA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C,OAAO,0CAAE,UAAU,CAAC;gBAEjD,IAAI,UAAU,IAAI,OAAO,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,WAAW,CAAC,CAAC,EAAE;oBACpD,MAAM,EAAE,SAAS,EAAE,CAAC,KAAwB,UAAU,EAA7B,cAAc,UAAK,UAAU,EAAhD,aAAmC,CAAa,CAAC;oBAEvD,IAAI,CAAC,IAAI,CAAC,OAAO,mCACZ,IAAI,CAAC,IAAI,CAAC,OAAO,KACpB,UAAU,EAAE,cAAc,GAC3B,CAAC;oBAEF,OAAO,IAAI,CAAC;iBACb;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC9C;QAED,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;CACF","sourcesContent":["import {\n BaseInstrumentation,\n dateNow,\n EVENT_SESSION_EXTEND,\n EVENT_SESSION_RESUME,\n EVENT_SESSION_START,\n Meta,\n MetaSession,\n VERSION,\n} from '@grafana/faro-core';\nimport type { Config } from '@grafana/faro-core';\n\nimport { createSession } from '../../metas';\n\nimport { type FaroUserSession, isSampled } from './sessionManager';\nimport { PersistentSessionsManager } from './sessionManager/PersistentSessionsManager';\nimport { createUserSessionObject, isUserSessionValid } from './sessionManager/sessionManagerUtils';\nimport { VolatileSessionsManager } from './sessionManager/VolatileSessionManager';\n\nexport class SessionInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-session';\n readonly version = VERSION;\n\n // previously notified session, to ensure we don't send session start\n // event twice for the same session\n private notifiedSession: MetaSession | undefined;\n\n private sendSessionStartEvent(meta: Meta): void {\n const session = meta.session;\n\n if (session && session.id !== this.notifiedSession?.id) {\n if (this.notifiedSession && this.notifiedSession.id === session.attributes?.['previousSession']) {\n this.api.pushEvent(EVENT_SESSION_EXTEND, {}, undefined, { skipDedupe: true });\n this.notifiedSession = session;\n return;\n }\n\n this.notifiedSession = session;\n // no need to add attributes and session id, they are included as part of meta\n // automatically\n this.api.pushEvent(EVENT_SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n private createInitialSessionMeta(sessionsConfig: Required<Config>['sessionTracking']): MetaSession {\n const sessionManager = sessionsConfig.persistent ? PersistentSessionsManager : VolatileSessionsManager;\n\n let userSession: FaroUserSession | null = sessionManager.fetchUserSession();\n\n if (sessionsConfig.persistent && sessionsConfig.maxSessionPersistenceTime && userSession) {\n const now = dateNow();\n const shouldClearPersistentSession = userSession.lastActivity < now - sessionsConfig.maxSessionPersistenceTime;\n\n if (shouldClearPersistentSession) {\n PersistentSessionsManager.removeUserSession();\n userSession = null;\n }\n }\n\n let sessionId = sessionsConfig.session?.id;\n let sessionAttributes = sessionsConfig.session?.attributes;\n\n if (isUserSessionValid(userSession)) {\n sessionId = userSession?.sessionId;\n sessionAttributes = {\n ...userSession?.sessionMeta?.attributes,\n isSampled: userSession!.isSampled.toString(),\n };\n this.api.pushEvent(EVENT_SESSION_RESUME, {}, undefined, { skipDedupe: true });\n } else {\n sessionId = sessionId ?? createSession().id;\n this.api.pushEvent(EVENT_SESSION_START, {}, undefined, { skipDedupe: true });\n }\n\n const sessionMeta: MetaSession = {\n id: sessionId,\n attributes: {\n isSampled: isSampled().toString(),\n // We do not want to recalculate the sampling decision on each init phase.\n // If session from web-storage has a isSampled attribute we will use that instead.\n ...sessionAttributes,\n },\n };\n\n return sessionMeta;\n }\n\n initialize() {\n this.logDebug('init session instrumentation');\n\n const sessionTracking = this.config.sessionTracking;\n\n if (sessionTracking?.enabled) {\n const SessionManager = this.config.sessionTracking?.persistent\n ? PersistentSessionsManager\n : VolatileSessionsManager;\n\n const initialSessionMeta = this.createInitialSessionMeta(sessionTracking);\n\n SessionManager.storeUserSession(\n createUserSessionObject({\n sessionId: initialSessionMeta.id,\n isSampled: Boolean(initialSessionMeta.attributes!['isSampled']),\n })\n );\n\n this.notifiedSession = initialSessionMeta;\n this.api.setSession(initialSessionMeta);\n\n const { updateSession } = new SessionManager();\n\n this.transports?.addBeforeSendHooks((item) => {\n updateSession();\n\n const attributes = item.meta.session?.attributes;\n\n if (attributes && Boolean(attributes?.['isSampled'])) {\n const { isSampled: _, ...restAttributes } = attributes;\n\n item.meta.session = {\n ...item.meta.session,\n attributes: restAttributes,\n };\n\n return item;\n }\n\n return null;\n });\n } else {\n this.sendSessionStartEvent(this.metas.value);\n }\n\n this.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EAGnB,OAAO,GACR,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAwB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAA/D;;QACW,SAAI,GAAG,+CAA+C,CAAC;QACvD,YAAO,GAAG,OAAO,CAAC;IAgI7B,CAAC;IA1HS,qBAAqB,CAAC,IAAU;;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,CAAC,EAAE,MAAK,MAAA,IAAI,CAAC,eAAe,0CAAE,EAAE,CAAA,EAAE;YACtD,IAAI,IAAI,CAAC,eAAe,IA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,OAAO,OAAO,CAAC;iBAChB;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC9C;QAED,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;CACF","sourcesContent":["import {\n BaseInstrumentation,\n dateNow,\n EVENT_SESSION_EXTEND,\n EVENT_SESSION_RESUME,\n EVENT_SESSION_START,\n Meta,\n MetaSession,\n VERSION,\n} from '@grafana/faro-core';\nimport type { Config } from '@grafana/faro-core';\n\nimport type { TransportItem } from '../..';\nimport { createSession } from '../../metas';\n\nimport { type FaroUserSession, isSampled } from './sessionManager';\nimport { PersistentSessionsManager } from './sessionManager/PersistentSessionsManager';\nimport { createUserSessionObject, isUserSessionValid } from './sessionManager/sessionManagerUtils';\nimport { VolatileSessionsManager } from './sessionManager/VolatileSessionManager';\n\nexport class SessionInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-session';\n readonly version = VERSION;\n\n // previously notified session, to ensure we don't send session start\n // event twice for the same session\n private notifiedSession: MetaSession | undefined;\n\n private sendSessionStartEvent(meta: Meta): void {\n const session = meta.session;\n\n if (session && session.id !== this.notifiedSession?.id) {\n if (this.notifiedSession && this.notifiedSession.id === session.attributes?.['previousSession']) {\n this.api.pushEvent(EVENT_SESSION_EXTEND, {}, undefined, { skipDedupe: true });\n this.notifiedSession = session;\n return;\n }\n\n this.notifiedSession = session;\n // no need to add attributes and session id, they are included as part of meta\n // automatically\n this.api.pushEvent(EVENT_SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n private createInitialSessionMeta(sessionsConfig: Required<Config>['sessionTracking']): MetaSession {\n const sessionManager = sessionsConfig.persistent ? PersistentSessionsManager : VolatileSessionsManager;\n\n let userSession: FaroUserSession | null = sessionManager.fetchUserSession();\n\n if (sessionsConfig.persistent && sessionsConfig.maxSessionPersistenceTime && userSession) {\n const now = dateNow();\n const shouldClearPersistentSession = userSession.lastActivity < now - sessionsConfig.maxSessionPersistenceTime;\n\n if (shouldClearPersistentSession) {\n PersistentSessionsManager.removeUserSession();\n userSession = null;\n }\n }\n\n let sessionId = sessionsConfig.session?.id;\n let sessionAttributes = sessionsConfig.session?.attributes;\n\n if (isUserSessionValid(userSession)) {\n sessionId = userSession?.sessionId;\n sessionAttributes = {\n ...userSession?.sessionMeta?.attributes,\n isSampled: userSession!.isSampled.toString(),\n };\n this.api.pushEvent(EVENT_SESSION_RESUME, {}, undefined, { skipDedupe: true });\n } else {\n sessionId = sessionId ?? createSession().id;\n this.api.pushEvent(EVENT_SESSION_START, {}, undefined, { skipDedupe: true });\n }\n\n const sessionMeta: MetaSession = {\n id: sessionId,\n attributes: {\n isSampled: isSampled().toString(),\n // We do not want to recalculate the sampling decision on each init phase.\n // If session from web-storage has a isSampled attribute we will use that instead.\n ...sessionAttributes,\n },\n };\n\n return sessionMeta;\n }\n\n initialize() {\n this.logDebug('init session instrumentation');\n\n const sessionTracking = this.config.sessionTracking;\n\n if (sessionTracking?.enabled) {\n const SessionManager = this.config.sessionTracking?.persistent\n ? PersistentSessionsManager\n : VolatileSessionsManager;\n\n const initialSessionMeta = this.createInitialSessionMeta(sessionTracking);\n\n SessionManager.storeUserSession(\n createUserSessionObject({\n sessionId: initialSessionMeta.id,\n isSampled: initialSessionMeta.attributes?.['isSampled'] === 'true',\n })\n );\n\n if (this.notifiedSession != null) {\n this.sendSessionStartEvent(initialSessionMeta as Meta);\n }\n\n this.notifiedSession = initialSessionMeta;\n this.api.setSession(initialSessionMeta);\n\n const { updateSession } = new SessionManager();\n\n this.transports?.addBeforeSendHooks((item) => {\n updateSession();\n\n const attributes = item.meta.session?.attributes;\n\n if (attributes && attributes?.['isSampled'] === 'true') {\n let newItem: TransportItem;\n\n // Structured clone is supported in all major browsers\n // but for old browsers we need a fallback\n if ('structuredClone' in window) {\n newItem = structuredClone(item);\n } else {\n newItem = JSON.parse(JSON.stringify(item));\n }\n\n const newAttributes = newItem.meta.session?.attributes;\n delete newAttributes?.['isSampled'];\n\n if (Object.keys(newAttributes ?? {}).length === 0) {\n delete newItem.meta.session?.attributes;\n }\n\n return newItem;\n }\n\n return null;\n });\n } else {\n this.sendSessionStartEvent(this.metas.value);\n }\n\n this.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}
@@ -5,7 +5,7 @@ export const STORAGE_UPDATE_DELAY = 1 * 1000; // seconds
5
5
  export const MAX_SESSION_PERSISTENCE_TIME_BUFFER = 1 * 60 * 1000;
6
6
  export const MAX_SESSION_PERSISTENCE_TIME = SESSION_INACTIVITY_TIME + MAX_SESSION_PERSISTENCE_TIME_BUFFER;
7
7
  export const defaultSessionTrackingConfig = {
8
- enabled: false,
8
+ enabled: true,
9
9
  persistent: false,
10
10
  maxSessionPersistenceTime: MAX_SESSION_PERSISTENCE_TIME,
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sessionConstants.js","sourceRoot":"","sources":["../../../../../src/instrumentations/session/sessionManager/sessionConstants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU;AAExD,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAG,uBAAuB,GAAG,mCAAmC,CAAC;AAE1G,MAAM,CAAC,MAAM,4BAA4B,GAA8B;IACrE,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,KAAK;IACjB,yBAAyB,EAAE,4BAA4B;CAC/C,CAAC","sourcesContent":["import type { Config } from '@grafana/faro-core';\n\nexport const STORAGE_KEY = '__FARO_SESSION__';\nexport const SESSION_EXPIRATION_TIME = 4 * 60 * 60 * 1000; // hrs\nexport const SESSION_INACTIVITY_TIME = 15 * 60 * 1000; // minutes\nexport const STORAGE_UPDATE_DELAY = 1 * 1000; // seconds\n\nexport const MAX_SESSION_PERSISTENCE_TIME_BUFFER = 1 * 60 * 1000;\nexport const MAX_SESSION_PERSISTENCE_TIME = SESSION_INACTIVITY_TIME + MAX_SESSION_PERSISTENCE_TIME_BUFFER;\n\nexport const defaultSessionTrackingConfig: Config['sessionTracking'] = {\n enabled: false,\n persistent: false,\n maxSessionPersistenceTime: MAX_SESSION_PERSISTENCE_TIME,\n} as const;\n"]}
1
+ {"version":3,"file":"sessionConstants.js","sourceRoot":"","sources":["../../../../../src/instrumentations/session/sessionManager/sessionConstants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU;AAExD,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAG,uBAAuB,GAAG,mCAAmC,CAAC;AAE1G,MAAM,CAAC,MAAM,4BAA4B,GAA8B;IACrE,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,KAAK;IACjB,yBAAyB,EAAE,4BAA4B;CAC/C,CAAC","sourcesContent":["import type { Config } from '@grafana/faro-core';\n\nexport const STORAGE_KEY = '__FARO_SESSION__';\nexport const SESSION_EXPIRATION_TIME = 4 * 60 * 60 * 1000; // hrs\nexport const SESSION_INACTIVITY_TIME = 15 * 60 * 1000; // minutes\nexport const STORAGE_UPDATE_DELAY = 1 * 1000; // seconds\n\nexport const MAX_SESSION_PERSISTENCE_TIME_BUFFER = 1 * 60 * 1000;\nexport const MAX_SESSION_PERSISTENCE_TIME = SESSION_INACTIVITY_TIME + MAX_SESSION_PERSISTENCE_TIME_BUFFER;\n\nexport const defaultSessionTrackingConfig: Config['sessionTracking'] = {\n enabled: true,\n persistent: false,\n maxSessionPersistenceTime: MAX_SESSION_PERSISTENCE_TIME,\n} as const;\n"]}
@@ -7,10 +7,14 @@ export class ViewInstrumentation extends BaseInstrumentation {
7
7
  this.version = VERSION;
8
8
  }
9
9
  sendViewChangedEvent(meta) {
10
+ var _a, _b, _c;
10
11
  const view = meta.view;
11
- if (view && view !== this.notifiedView) {
12
+ if (view && view.name !== ((_a = this.notifiedView) === null || _a === void 0 ? void 0 : _a.name)) {
13
+ this.api.pushEvent(EVENT_VIEW_CHANGED, {
14
+ fromView: (_c = (_b = this.notifiedView) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '',
15
+ toView: view.name,
16
+ }, undefined, { skipDedupe: true });
12
17
  this.notifiedView = view;
13
- this.api.pushEvent(EVENT_VIEW_CHANGED, {}, undefined, { skipDedupe: true });
14
18
  }
15
19
  }
16
20
  initialize() {
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/view/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAkB,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEtG,2CAA2C;AAC3C,MAAM,OAAO,mBAAoB,SAAQ,mBAAmB;IAA5D;;QACW,SAAI,GAAG,4CAA4C,CAAC;QACpD,YAAO,GAAG,OAAO,CAAC;IAqB7B,CAAC;IAfS,oBAAoB,CAAC,IAAU;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAEzB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC7E;IACH,CAAC;IAED,UAAU;QACR,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import { BaseInstrumentation, EVENT_VIEW_CHANGED, Meta, MetaView, VERSION } from '@grafana/faro-core';\n\n// all this does is send VIEW_CHANGED event\nexport class ViewInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-view';\n readonly version = VERSION;\n\n // previously notified view, to ensure we don't send view changed\n // event twice for the same view\n private notifiedView: MetaView | undefined;\n\n private sendViewChangedEvent(meta: Meta): void {\n const view = meta.view;\n\n if (view && view !== this.notifiedView) {\n this.notifiedView = view;\n\n this.api.pushEvent(EVENT_VIEW_CHANGED, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendViewChangedEvent(this.metas.value);\n\n this.metas.addListener(this.sendViewChangedEvent.bind(this));\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/view/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAkB,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEtG,2CAA2C;AAC3C,MAAM,OAAO,mBAAoB,SAAQ,mBAAmB;IAA5D;;QACW,SAAI,GAAG,4CAA4C,CAAC;QACpD,YAAO,GAAG,OAAO,CAAC;IA6B7B,CAAC;IAvBS,oBAAoB,CAAC,IAAU;;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,MAAK,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAA,EAAE;YACjD,IAAI,CAAC,GAAG,CAAC,SAAS,CAChB,kBAAkB,EAClB;gBACE,QAAQ,EAAE,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,mCAAI,EAAE;gBACvC,MAAM,EAAE,IAAI,CAAC,IAAI;aAClB,EACD,SAAS,EACT,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;YAEF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B;IACH,CAAC;IAED,UAAU;QACR,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import { BaseInstrumentation, EVENT_VIEW_CHANGED, Meta, MetaView, VERSION } from '@grafana/faro-core';\n\n// all this does is send VIEW_CHANGED event\nexport class ViewInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-view';\n readonly version = VERSION;\n\n // previously notified view, to ensure we don't send view changed\n // event twice for the same view\n private notifiedView: MetaView | undefined;\n\n private sendViewChangedEvent(meta: Meta): void {\n const view = meta.view;\n\n if (view && view.name !== this.notifiedView?.name) {\n this.api.pushEvent(\n EVENT_VIEW_CHANGED,\n {\n fromView: this.notifiedView?.name ?? '',\n toView: view.name,\n },\n undefined,\n { skipDedupe: true }\n );\n\n this.notifiedView = view;\n }\n }\n\n initialize() {\n this.sendViewChangedEvent(this.metas.value);\n\n this.metas.addListener(this.sendViewChangedEvent.bind(this));\n }\n}\n"]}
@@ -7,6 +7,6 @@ export type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectio
7
7
  export { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta, sdkMeta } from './metas';
8
8
  export { ConsoleTransport, FetchTransport } from './transports';
9
9
  export type { ClockFn, ConsoleTransportOptions, FetchTransportOptions, FetchTransportRequestOptions, } from './transports';
10
- export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, } from '@grafana/faro-core';
10
+ export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, Conventions, createInternalLogger, createPromiseBuffer, deepEqual, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, genShortID, getCurrentTimestamp, getInternalFaroFromGlobalObject, getTransportBody, globalObject, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, noop, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, EVENT_CLICK, EVENT_NAVIGATION, EVENT_ROUTE_CHANGE, EVENT_SESSION_EXTEND, EVENT_SESSION_RESUME, EVENT_SESSION_START, EVENT_VIEW_CHANGED, } from '@grafana/faro-core';
11
11
  export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BufferItem, Config, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, Extension, GlobalObject, Instrumentation, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, OTELApi, Patterns, PromiseBuffer, PromiseBufferOptions, PromiseProducer, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, } from '@grafana/faro-core';
12
12
  export { PersistentSessionsManager, VolatileSessionsManager, MAX_SESSION_PERSISTENCE_TIME, MAX_SESSION_PERSISTENCE_TIME_BUFFER, SESSION_EXPIRATION_TIME, SESSION_INACTIVITY_TIME, STORAGE_KEY, } from './instrumentations/session';
@@ -3,7 +3,7 @@ import type { ConsoleInstrumentationOptions } from './types';
3
3
  export declare class ConsoleInstrumentation extends BaseInstrumentation {
4
4
  private options;
5
5
  readonly name = "@grafana/faro-web-sdk:instrumentation-console";
6
- readonly version = "1.2.9";
6
+ readonly version = "1.3.1";
7
7
  static defaultDisabledLevels: LogLevel[];
8
8
  constructor(options?: ConsoleInstrumentationOptions);
9
9
  initialize(): void;
@@ -1,6 +1,6 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ErrorsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-errors";
4
- readonly version = "1.2.9";
4
+ readonly version = "1.3.1";
5
5
  initialize(): void;
6
6
  }
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class SessionInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-session";
4
- readonly version = "1.2.9";
4
+ readonly version = "1.3.1";
5
5
  private notifiedSession;
6
6
  private sendSessionStartEvent;
7
7
  private createInitialSessionMeta;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class ViewInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-view";
4
- readonly version = "1.2.9";
4
+ readonly version = "1.3.1";
5
5
  private notifiedView;
6
6
  private sendViewChangedEvent;
7
7
  initialize(): void;
@@ -1,7 +1,7 @@
1
1
  import { BaseInstrumentation } from '@grafana/faro-core';
2
2
  export declare class WebVitalsInstrumentation extends BaseInstrumentation {
3
3
  readonly name = "@grafana/faro-web-sdk:instrumentation-web-vitals";
4
- readonly version = "1.2.9";
4
+ readonly version = "1.3.1";
5
5
  static mapping: {
6
6
  cls: (onReport: import("web-vitals").CLSReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void;
7
7
  fcp: (onReport: import("web-vitals").FCPReportCallback, opts?: import("web-vitals").ReportOpts | undefined) => void;
@@ -4,7 +4,7 @@ import type { ConsoleTransportOptions } from './types';
4
4
  export declare class ConsoleTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-console";
7
- readonly version = "1.2.9";
7
+ readonly version = "1.3.1";
8
8
  constructor(options?: ConsoleTransportOptions);
9
9
  send(item: TransportItem): void;
10
10
  }
@@ -4,7 +4,7 @@ import type { FetchTransportOptions } from './types';
4
4
  export declare class FetchTransport extends BaseTransport {
5
5
  private options;
6
6
  readonly name = "@grafana/faro-web-sdk:transport-fetch";
7
- readonly version = "1.2.9";
7
+ readonly version = "1.3.1";
8
8
  promiseBuffer: PromiseBuffer<Response | void>;
9
9
  private readonly rateLimitBackoffMs;
10
10
  private readonly getNow;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/faro-web-sdk",
3
- "version": "1.2.9",
3
+ "version": "1.3.1",
4
4
  "description": "Faro instrumentations, metas, transports for web.",
5
5
  "keywords": [
6
6
  "observability",
@@ -52,7 +52,7 @@
52
52
  "quality:circular-deps": "madge --circular ."
53
53
  },
54
54
  "dependencies": {
55
- "@grafana/faro-core": "^1.2.9",
55
+ "@grafana/faro-core": "^1.3.1",
56
56
  "ua-parser-js": "^1.0.32",
57
57
  "web-vitals": "^3.1.1"
58
58
  },
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "d725ed85b06bfe1f8060b6adeb5bc22bf7ec637c"
66
+ "gitHead": "cc20a62fe70eabcfc02a1ac11e0a2b43d4d4528a"
67
67
  }