@grafana/faro-web-sdk 1.0.0-beta3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -6
- package/dist/bundle/faro-web-sdk.iife.js +1 -0
- package/dist/cjs/config/getWebInstrumentations.js +1 -0
- package/dist/cjs/config/getWebInstrumentations.js.map +1 -1
- package/dist/cjs/config/makeCoreConfig.js +4 -4
- package/dist/cjs/config/makeCoreConfig.js.map +1 -1
- package/dist/cjs/index.js +6 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/instrumentations/console/instrumentation.js +2 -2
- package/dist/cjs/instrumentations/console/instrumentation.js.map +1 -1
- package/dist/cjs/instrumentations/errors/instrumentation.js +2 -2
- package/dist/cjs/instrumentations/errors/instrumentation.js.map +1 -1
- package/dist/cjs/instrumentations/errors/registerOnerror.js +2 -2
- package/dist/cjs/instrumentations/errors/registerOnerror.js.map +1 -1
- package/dist/cjs/instrumentations/errors/registerOnunhandledrejection.js +2 -2
- package/dist/cjs/instrumentations/errors/registerOnunhandledrejection.js.map +1 -1
- package/dist/cjs/instrumentations/index.js +3 -1
- package/dist/cjs/instrumentations/index.js.map +1 -1
- package/dist/cjs/instrumentations/session/instrumentation.js +3 -3
- package/dist/cjs/instrumentations/session/instrumentation.js.map +1 -1
- package/dist/cjs/instrumentations/view/index.js +6 -0
- package/dist/cjs/instrumentations/view/index.js.map +1 -0
- package/dist/cjs/instrumentations/view/instrumentation.js +44 -0
- package/dist/cjs/instrumentations/view/instrumentation.js.map +1 -0
- package/dist/cjs/instrumentations/webVitals/instrumentation.js +1 -1
- package/dist/cjs/instrumentations/webVitals/instrumentation.js.map +1 -1
- package/dist/cjs/metas/index.js +5 -1
- package/dist/cjs/metas/index.js.map +1 -1
- package/dist/cjs/{session.js → metas/session/createSession.js} +1 -1
- package/dist/cjs/metas/session/createSession.js.map +1 -0
- package/dist/cjs/metas/session/index.js +6 -0
- package/dist/cjs/metas/session/index.js.map +1 -0
- package/dist/cjs/metas/view/const.js +7 -0
- package/dist/cjs/metas/view/const.js.map +1 -0
- package/dist/cjs/metas/view/index.js +6 -0
- package/dist/cjs/metas/view/index.js.map +1 -0
- package/dist/cjs/transports/console/transport.js +1 -1
- package/dist/cjs/transports/console/transport.js.map +1 -1
- package/dist/cjs/transports/fetch/transport.js.map +1 -1
- package/dist/esm/config/getWebInstrumentations.js +2 -1
- package/dist/esm/config/getWebInstrumentations.js.map +1 -1
- package/dist/esm/config/makeCoreConfig.js +5 -5
- package/dist/esm/config/makeCoreConfig.js.map +1 -1
- package/dist/esm/index.js +3 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instrumentations/console/instrumentation.js +2 -2
- package/dist/esm/instrumentations/console/instrumentation.js.map +1 -1
- package/dist/esm/instrumentations/errors/instrumentation.js +2 -2
- package/dist/esm/instrumentations/errors/instrumentation.js.map +1 -1
- package/dist/esm/instrumentations/errors/registerOnerror.js +2 -2
- package/dist/esm/instrumentations/errors/registerOnerror.js.map +1 -1
- package/dist/esm/instrumentations/errors/registerOnunhandledrejection.js +2 -2
- package/dist/esm/instrumentations/errors/registerOnunhandledrejection.js.map +1 -1
- package/dist/esm/instrumentations/index.js +1 -0
- package/dist/esm/instrumentations/index.js.map +1 -1
- package/dist/esm/instrumentations/session/instrumentation.js +3 -3
- package/dist/esm/instrumentations/session/instrumentation.js.map +1 -1
- package/dist/esm/instrumentations/view/index.js +2 -0
- package/dist/esm/instrumentations/view/index.js.map +1 -0
- package/dist/esm/instrumentations/view/instrumentation.js +22 -0
- package/dist/esm/instrumentations/view/instrumentation.js.map +1 -0
- package/dist/esm/instrumentations/webVitals/instrumentation.js +1 -1
- package/dist/esm/instrumentations/webVitals/instrumentation.js.map +1 -1
- package/dist/esm/metas/index.js +2 -0
- package/dist/esm/metas/index.js.map +1 -1
- package/dist/esm/{session.js → metas/session/createSession.js} +1 -1
- package/dist/esm/metas/session/createSession.js.map +1 -0
- package/dist/esm/metas/session/index.js +2 -0
- package/dist/esm/metas/session/index.js.map +1 -0
- package/dist/esm/metas/view/const.js +4 -0
- package/dist/esm/metas/view/const.js.map +1 -0
- package/dist/esm/metas/view/index.js +2 -0
- package/dist/esm/metas/view/index.js.map +1 -0
- package/dist/esm/transports/console/transport.js +1 -1
- package/dist/esm/transports/console/transport.js.map +1 -1
- package/dist/esm/transports/fetch/transport.js.map +1 -1
- package/dist/{cjs → types}/config/getWebInstrumentations.d.ts +0 -0
- package/dist/{cjs → types}/config/index.d.ts +0 -0
- package/dist/{cjs → types}/config/makeCoreConfig.d.ts +0 -0
- package/dist/{cjs → types}/config/types.d.ts +0 -0
- package/dist/{cjs → types}/consts.d.ts +0 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/{cjs → types}/initialize.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/console/index.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/console/instrumentation.d.ts +1 -1
- package/dist/{cjs → types}/instrumentations/console/types.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/const.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/getErrorDetails.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/getValueAndTypeFromMessage.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/index.d.ts +0 -0
- package/dist/{esm → types}/instrumentations/errors/instrumentation.d.ts +1 -1
- package/dist/types/instrumentations/errors/registerOnerror.d.ts +2 -0
- package/dist/types/instrumentations/errors/registerOnunhandledrejection.d.ts +2 -0
- package/dist/{cjs → types}/instrumentations/errors/stackFrames/buildStackFrame.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/stackFrames/const.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/stackFrames/getDataFromSafariExtensions.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/stackFrames/getStackFramesFromError.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/stackFrames/index.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/stackFrames/parseStacktrace.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/errors/types.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/index.d.ts +1 -0
- package/dist/{cjs → types}/instrumentations/session/index.d.ts +0 -0
- package/dist/{cjs → types}/instrumentations/session/instrumentation.d.ts +0 -0
- package/dist/types/instrumentations/view/index.d.ts +1 -0
- package/dist/types/instrumentations/view/instrumentation.d.ts +8 -0
- package/dist/{cjs → types}/instrumentations/webVitals/index.d.ts +0 -0
- package/dist/{esm → types}/instrumentations/webVitals/instrumentation.d.ts +1 -1
- package/dist/{cjs → types}/metas/browser/index.d.ts +0 -0
- package/dist/{cjs → types}/metas/browser/meta.d.ts +0 -0
- package/dist/{cjs → types}/metas/const.d.ts +0 -0
- package/dist/{cjs → types}/metas/index.d.ts +2 -0
- package/dist/{cjs → types}/metas/page/index.d.ts +0 -0
- package/dist/{cjs → types}/metas/page/meta.d.ts +0 -0
- package/dist/{cjs/session.d.ts → types/metas/session/createSession.d.ts} +0 -0
- package/dist/types/metas/session/index.d.ts +1 -0
- package/dist/types/metas/view/const.d.ts +3 -0
- package/dist/types/metas/view/index.d.ts +1 -0
- package/dist/{cjs → types}/transports/console/index.d.ts +0 -0
- package/dist/{esm → types}/transports/console/transport.d.ts +1 -1
- package/dist/{cjs → types}/transports/console/types.d.ts +0 -0
- package/dist/{cjs → types}/transports/fetch/index.d.ts +0 -0
- package/dist/{cjs → types}/transports/fetch/transport.d.ts +3 -3
- package/dist/{cjs → types}/transports/fetch/types.d.ts +0 -0
- package/dist/{cjs → types}/transports/index.d.ts +0 -0
- package/package.json +21 -13
- package/dist/cjs/index.d.ts +0 -12
- package/dist/cjs/instrumentations/errors/instrumentation.d.ts +0 -6
- package/dist/cjs/instrumentations/errors/registerOnerror.d.ts +0 -2
- package/dist/cjs/instrumentations/errors/registerOnerror.test.d.ts +0 -1
- package/dist/cjs/instrumentations/errors/registerOnerror.test.js +0 -23
- package/dist/cjs/instrumentations/errors/registerOnerror.test.js.map +0 -1
- package/dist/cjs/instrumentations/errors/registerOnunhandledrejection.d.ts +0 -2
- package/dist/cjs/instrumentations/session/instrumentation.test.d.ts +0 -1
- package/dist/cjs/instrumentations/session/instrumentation.test.js +0 -47
- package/dist/cjs/instrumentations/session/instrumentation.test.js.map +0 -1
- package/dist/cjs/instrumentations/webVitals/instrumentation.d.ts +0 -14
- package/dist/cjs/session.js.map +0 -1
- package/dist/cjs/transports/console/transport.d.ts +0 -10
- package/dist/cjs/transports/fetch/transport.test.d.ts +0 -1
- package/dist/cjs/transports/fetch/transport.test.js +0 -193
- package/dist/cjs/transports/fetch/transport.test.js.map +0 -1
- package/dist/esm/config/getWebInstrumentations.d.ts +0 -3
- package/dist/esm/config/index.d.ts +0 -3
- package/dist/esm/config/makeCoreConfig.d.ts +0 -3
- package/dist/esm/config/types.d.ts +0 -9
- package/dist/esm/consts.d.ts +0 -1
- package/dist/esm/index.d.ts +0 -12
- package/dist/esm/initialize.d.ts +0 -3
- package/dist/esm/instrumentations/console/index.d.ts +0 -2
- package/dist/esm/instrumentations/console/instrumentation.d.ts +0 -10
- package/dist/esm/instrumentations/console/types.d.ts +0 -4
- package/dist/esm/instrumentations/errors/const.d.ts +0 -7
- package/dist/esm/instrumentations/errors/getErrorDetails.d.ts +0 -3
- package/dist/esm/instrumentations/errors/getValueAndTypeFromMessage.d.ts +0 -1
- package/dist/esm/instrumentations/errors/index.d.ts +0 -3
- package/dist/esm/instrumentations/errors/registerOnerror.d.ts +0 -2
- package/dist/esm/instrumentations/errors/registerOnerror.test.d.ts +0 -1
- package/dist/esm/instrumentations/errors/registerOnerror.test.js +0 -21
- package/dist/esm/instrumentations/errors/registerOnerror.test.js.map +0 -1
- package/dist/esm/instrumentations/errors/registerOnunhandledrejection.d.ts +0 -2
- package/dist/esm/instrumentations/errors/stackFrames/buildStackFrame.d.ts +0 -2
- package/dist/esm/instrumentations/errors/stackFrames/const.d.ts +0 -15
- package/dist/esm/instrumentations/errors/stackFrames/getDataFromSafariExtensions.d.ts +0 -1
- package/dist/esm/instrumentations/errors/stackFrames/getStackFramesFromError.d.ts +0 -2
- package/dist/esm/instrumentations/errors/stackFrames/index.d.ts +0 -4
- package/dist/esm/instrumentations/errors/stackFrames/parseStacktrace.d.ts +0 -2
- package/dist/esm/instrumentations/errors/types.d.ts +0 -8
- package/dist/esm/instrumentations/index.d.ts +0 -6
- package/dist/esm/instrumentations/session/index.d.ts +0 -1
- package/dist/esm/instrumentations/session/instrumentation.d.ts +0 -8
- package/dist/esm/instrumentations/session/instrumentation.test.d.ts +0 -1
- package/dist/esm/instrumentations/session/instrumentation.test.js +0 -45
- package/dist/esm/instrumentations/session/instrumentation.test.js.map +0 -1
- package/dist/esm/instrumentations/webVitals/index.d.ts +0 -1
- package/dist/esm/metas/browser/index.d.ts +0 -1
- package/dist/esm/metas/browser/meta.d.ts +0 -2
- package/dist/esm/metas/const.d.ts +0 -2
- package/dist/esm/metas/index.d.ts +0 -3
- package/dist/esm/metas/page/index.d.ts +0 -1
- package/dist/esm/metas/page/meta.d.ts +0 -2
- package/dist/esm/session.d.ts +0 -2
- package/dist/esm/session.js.map +0 -1
- package/dist/esm/transports/console/index.d.ts +0 -2
- package/dist/esm/transports/console/types.d.ts +0 -4
- package/dist/esm/transports/fetch/index.d.ts +0 -2
- package/dist/esm/transports/fetch/transport.d.ts +0 -16
- package/dist/esm/transports/fetch/transport.test.d.ts +0 -1
- package/dist/esm/transports/fetch/transport.test.js +0 -119
- package/dist/esm/transports/fetch/transport.test.js.map +0 -1
- package/dist/esm/transports/fetch/types.d.ts +0 -13
- package/dist/esm/transports/index.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# @grafana/faro-web-sdk
|
|
2
2
|
|
|
3
|
-
Faro is a SDK that can instrument frontend JavaScript applications to collect telemetry and forward it to the
|
|
4
|
-
(with app agent receiver integration enabled).
|
|
3
|
+
Faro is a SDK that can instrument frontend JavaScript applications to collect telemetry and forward it to the
|
|
4
|
+
[Grafana Agent][grafana-agent-docs] (with app agent receiver integration enabled).
|
|
5
5
|
|
|
6
|
-
Grafana Agent can then send this data to either [Loki]
|
|
6
|
+
Grafana Agent can then send this data to either [Loki][grafana-logs] or [Tempo][grafana-traces].
|
|
7
7
|
|
|
8
8
|
_Warning_: currently pre-release and subject to frequent breaking changes. Use at your own risk.
|
|
9
9
|
|
|
10
10
|
## Get started
|
|
11
11
|
|
|
12
|
-
See [quick start for web applications]
|
|
12
|
+
See [quick start for web applications][quick-start].
|
|
13
|
+
|
|
14
|
+
Alternatively, you can use the CDN version of the library. See [use cdn library][use-cdn] for details on how to do so.
|
|
13
15
|
|
|
14
16
|
## Instrumentations
|
|
15
17
|
|
|
@@ -17,11 +19,13 @@ See [quick start for web applications](https://github.com/grafana/faro-web-sdk/b
|
|
|
17
19
|
- errors - captures unhandled top level exceptions
|
|
18
20
|
- web-vitals - captures performance metrics reported by web vitals API
|
|
19
21
|
- session - sends session start event
|
|
22
|
+
- view - sends view changed event
|
|
20
23
|
|
|
21
24
|
## Metas
|
|
22
25
|
|
|
23
26
|
- browser - captures browser metadata: name, version, etc
|
|
24
27
|
- page - captures current URL
|
|
28
|
+
- view - the web SDK enforces a `default` value for the view meta
|
|
25
29
|
|
|
26
30
|
## Transports
|
|
27
31
|
|
|
@@ -54,11 +58,11 @@ throw new Error('oh no');
|
|
|
54
58
|
faro.api.pushError(new Error('oh no'));
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
With
|
|
61
|
+
With OTel tracing and browser console capture:
|
|
58
62
|
|
|
59
63
|
```ts
|
|
64
|
+
import { ConsoleInstrumentation, getWebInstrumentations, initializeFaro } from '@grafana/faro-web-sdk';
|
|
60
65
|
import { TracingInstrumentation } from '@grafana/faro-web-tracing';
|
|
61
|
-
import { ConsoleInstrumentation, initializeFaro, getWebInstrumentations } from '@grafana/faro-web-sdk';
|
|
62
66
|
|
|
63
67
|
const faro = initializeFaro({
|
|
64
68
|
url: 'https://agent.myapp/collect',
|
|
@@ -83,3 +87,9 @@ faro.api
|
|
|
83
87
|
// will be captured
|
|
84
88
|
throw new Error('oh no');
|
|
85
89
|
```
|
|
90
|
+
|
|
91
|
+
[grafana-agent-docs]: https://grafana.com/docs/agent/latest/
|
|
92
|
+
[grafana-logs]: https://grafana.com/logs/
|
|
93
|
+
[grafana-traces]: https://grafana.com/traces/
|
|
94
|
+
[quick-start]: https://github.com/grafana/faro-web-sdk/blob/main/docs/sources/tutorials/quick-start-browser.md
|
|
95
|
+
[use-cdn]: https://github.com/grafana/faro-web-sdk/blob/main/docs/sources/tutorials/use-cdn-library.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var GrafanaFaroWebSdk=function(e){"use strict";var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t={},i={get exports(){return t},set exports(e){t=e}};function r(e,n){return typeof e===n}function o(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function a(e,n){try{return e instanceof n}catch(e){return!1}}!function(e,t){!function(n,i){var r="function",o="undefined",a="object",s="string",u="model",l="name",c="type",d="vendor",p="version",f="architecture",g="console",b="mobile",m="tablet",v="smarttv",h="wearable",w="embedded",y="Amazon",E="Apple",x="ASUS",k="BlackBerry",T="Browser",L="Chrome",S="Firefox",O="Google",I="Huawei",N="LG",C="Microsoft",R="Motorola",A="Opera",j="Samsung",D="Sharp",P="Sony",z="Xiaomi",M="Zebra",F="Facebook",_=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===s&&-1!==B(n).indexOf(B(e))},B=function(e){return e.toLowerCase()},U=function(e,n){if(typeof e===s)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof n===o?e:e.substring(0,350)},V=function(e,n){for(var t,o,s,u,l,c,d=0;d<n.length&&!l;){var p=n[d],f=n[d+1];for(t=o=0;t<p.length&&!l;)if(l=p[t++].exec(e))for(s=0;s<f.length;s++)c=l[++o],typeof(u=f[s])===a&&u.length>0?2===u.length?typeof u[1]==r?this[u[0]]=u[1].call(this,c):this[u[0]]=u[1]:3===u.length?typeof u[1]!==r||u[1].exec&&u[1].test?this[u[0]]=c?c.replace(u[1],u[2]):i:this[u[0]]=c?u[1].call(this,c,u[2]):i:4===u.length&&(this[u[0]]=c?u[3].call(this,c.replace(u[1],u[2])):i):this[u]=c||i;d+=2}},q=function(e,n){for(var t in n)if(typeof n[t]===a&&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},G={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"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,p],[/opios[\/ ]+([\w\.]+)/i],[p,[l,A+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[l,A]],[/(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|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[l,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[l,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[l,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+T],p],[/\bfocus\/([\w\.]+)/i],[p,[l,S+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[l,A+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[l,A+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[l,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[p,[l,S]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+T]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+T],p],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,F],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[l,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[l,L+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,L+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[l,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[p,q,{"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],[l,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[l,S+" 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],[l,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,B]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",B]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,B]]],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,[d,j],[c,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[d,j],[c,b]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[d,E],[c,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[d,E],[c,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[d,I],[c,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[d,I],[c,b]],[/\b(poco[\w ]+)(?: 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," "],[d,z],[c,b]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[d,z],[c,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[d,"OPPO"],[c,b]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[d,"Vivo"],[c,b]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[d,"Realme"],[c,b]],[/\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,[d,R],[c,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[d,R],[c,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[d,N],[c,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[d,N],[c,b]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[d,"Lenovo"],[c,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[d,"Nokia"],[c,b]],[/(pixel c)\b/i],[u,[d,O],[c,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[d,O],[c,b]],[/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,[d,P],[c,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[d,P],[c,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[d,"OnePlus"],[c,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[d,y],[c,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[d,y],[c,b]],[/(playbook);[-\w\),; ]+(rim)/i],[u,d,[c,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[d,k],[c,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[d,x],[c,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[d,x],[c,b]],[/(nexus 9)/i],[u,[d,"HTC"],[c,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[u,/_/g," "],[c,b]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[d,"Acer"],[c,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[d,"Meizu"],[c,b]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[d,D],[c,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,u,[c,b]],[/(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],[d,u,[c,m]],[/(surface duo)/i],[u,[d,C],[c,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[d,"Fairphone"],[c,b]],[/(u304aa)/i],[u,[d,"AT&T"],[c,b]],[/\bsie-(\w*)/i],[u,[d,"Siemens"],[c,b]],[/\b(rct\w+) b/i],[u,[d,"RCA"],[c,m]],[/\b(venue[\d ]{2,7}) b/i],[u,[d,"Dell"],[c,m]],[/\b(q(?:mv|ta)\w+) b/i],[u,[d,"Verizon"],[c,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[d,"Barnes & Noble"],[c,m]],[/\b(tm\d{3}\w+) b/i],[u,[d,"NuVision"],[c,m]],[/\b(k88) b/i],[u,[d,"ZTE"],[c,m]],[/\b(nx\d{3}j) b/i],[u,[d,"ZTE"],[c,b]],[/\b(gen\d{3}) b.+49h/i],[u,[d,"Swiss"],[c,b]],[/\b(zur\d{3}) b/i],[u,[d,"Swiss"],[c,m]],[/\b((zeki)?tb.*\b) b/i],[u,[d,"Zeki"],[c,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],u,[c,m]],[/\b(ns-?\w{0,9}) b/i],[u,[d,"Insignia"],[c,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[d,"NextBook"],[c,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],u,[c,b]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],u,[c,b]],[/\b(ph-1) /i],[u,[d,"Essential"],[c,b]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[d,"Envizen"],[c,m]],[/\b(trio[-\w\. ]+) b/i],[u,[d,"MachSpeed"],[c,m]],[/\btu_(1491) b/i],[u,[d,"Rotor"],[c,m]],[/(shield[\w ]+) b/i],[u,[d,"Nvidia"],[c,m]],[/(sprint) (\w+)/i],[d,u,[c,b]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[d,C],[c,b]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[d,M],[c,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[d,M],[c,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,u,[c,g]],[/droid.+; (shield) bui/i],[u,[d,"Nvidia"],[c,g]],[/(playstation [345portablevi]+)/i],[u,[d,P],[c,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[d,C],[c,g]],[/smart-tv.+(samsung)/i],[d,[c,v]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[d,j],[c,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,N],[c,v]],[/(apple) ?tv/i],[d,[u,E+" TV"],[c,v]],[/crkey/i],[[u,L+"cast"],[d,O],[c,v]],[/droid.+aft(\w)( bui|\))/i],[u,[d,y],[c,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[d,D],[c,v]],[/(bravia[\w ]+)( bui|\))/i],[u,[d,P],[c,v]],[/(mitv-\w{5}) bui/i],[u,[d,z],[c,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,U],[u,U],[c,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[c,v]],[/((pebble))app/i],[d,u,[c,h]],[/droid.+; (glass) \d/i],[u,[d,O],[c,h]],[/droid.+; (wt63?0{2,3})\)/i],[u,[d,M],[c,h]],[/(quest( 2)?)/i],[u,[d,F],[c,h]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[c,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[c,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[c,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[c,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[c,b]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[l,"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],[l,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[p,q,G]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[p,q,G]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,p],[/\(bb(10);/i],[p,[l,k]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[l,S+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[l,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[l,L+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[l,"Chromium OS"],p],[/(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],[l,p],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[l,p]]},K=function(e,t){if(typeof e===a&&(t=e,e=i),!(this instanceof K))return new K(e,t).getResult();var r=e||(typeof n!==o&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),g=t?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}(W,t):W;return this.getBrowser=function(){var e,n={};return n[l]=i,n[p]=i,V.call(n,r,g.browser),n.major=typeof(e=n.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:i,n},this.getCPU=function(){var e={};return e[f]=i,V.call(e,r,g.cpu),e},this.getDevice=function(){var e={};return e[d]=i,e[u]=i,e[c]=i,V.call(e,r,g.device),e},this.getEngine=function(){var e={};return e[l]=i,e[p]=i,V.call(e,r,g.engine),e},this.getOS=function(){var e={};return e[l]=i,e[p]=i,V.call(e,r,g.os),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 r},this.setUA=function(e){return r=typeof e===s&&e.length>350?U(e,350):e,this},this.setUA(r),this};K.VERSION="1.0.32",K.BROWSER=_([l,p,"major"]),K.CPU=_([f]),K.DEVICE=_([u,d,c,g,b,v,m,h,w]),K.ENGINE=K.OS=_([l,p]),e.exports&&(t=e.exports=K),t.UAParser=K;var H=typeof n!==o&&(n.jQuery||n.Zepto);if(H&&!H.ua){var X=new K;H.ua=X.getResult(),H.ua.get=function(){return X.getUA()},H.ua.set=function(e){X.setUA(e);var n=X.getResult();for(var t in n)H.ua[t]=n[t]}}}("object"==typeof window?window:n)}(i,t);const s=e=>r(e,"undefined"),u=e=>r(e,"null"),l=e=>r(e,"string"),c=e=>r(e,"number")&&!isNaN(e)||r(e,"bigint"),d=e=>!u(e)&&r(e,"object"),p=e=>r(e,"function"),f=e=>o(e,"Array"),g=e=>!d(e)&&!p(e),b=!s(Event),m=e=>b&&a(e,Event),v="undefined"!=typeof Error,h=e=>v&&a(e,Error),w=e=>o(e,"ErrorEvent"),y=e=>o(e,"DOMError"),E=e=>o(e,"DOMException"),x="undefined"!=typeof Element,k="undefined"!=typeof Map;function T(e,n){if(e===n)return!0;if(r(e,"number")&&isNaN(e))return r(n,"number")&&isNaN(n);const t=f(e),i=f(n);if(t!==i)return!1;if(t&&i){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 o=d(e),a=d(n);if(o!==a)return!1;if(e&&n&&o&&a){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 L(){return(new Date).toISOString()}var S;e.LogLevel=void 0,(S=e.LogLevel||(e.LogLevel={})).TRACE="trace",S.DEBUG="debug",S.INFO="info",S.LOG="log",S.WARN="warn",S.ERROR="error";const O=e.LogLevel.LOG,I=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function N(){}function C(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 R="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function A(e=10){return Array.from(Array(e)).map((()=>R[Math.floor(Math.random()*R.length)])).join("")}var j;e.TransportItemType=void 0,(j=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",j.LOG="log",j.MEASUREMENT="measurement",j.TRACE="trace",j.EVENT="event";const D={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function P(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 z;e.InternalLoggerLevel=void 0,(z=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[z.OFF=0]="OFF",z[z.ERROR=1]="ERROR",z[z.WARN=2]="WARN",z[z.INFO=3]="INFO",z[z.VERBOSE=4]="VERBOSE";const M={debug:N,error:N,info:N,prefix:"Faro",warn:N},F=e.InternalLoggerLevel.ERROR,_=Object.assign({},console);let $=_;function B(e){var n;return $=null!==(n=e.unpatchedConsole)&&void 0!==n?n:$,$}function U(n=_,t=F){const i=M;return t>e.InternalLoggerLevel.OFF&&(i.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${i.prefix}\n`,...e)}:N,i.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${i.prefix}\n`,...e)}:N,i.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${i.prefix}\n`,...e)}:N,i.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${i.prefix}\n`,...e)}:N),i}let V=M;function q(e,n){return V=U(e,n.internalLoggerLevel),V}class G{constructor(){this.unpatchedConsole=_,this.internalLogger=M,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 W extends G{getIgnoreUrls(){return[]}}function K(n){return{[D[n.type]]:n.type===e.TransportItemType.TRACE?n.payload:[n.payload],meta:n.meta}}const H="Error";let X;function Z(n,t,i,r,o){t.debug("Initializing API");const a=function(n,t,i,r,o){let a;return t.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),a={trace:e,context:n}},isOTELInitialized:()=>!!a,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,o);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),function(n,t,i,r,o,a){var s;t.debug("Initializing exceptions API");let l=null;X=null!==(s=i.parseStacktrace)&&void 0!==s?s:X;const c=e=>{t.debug("Changing stacktrace parser"),X=null!=e?e:X};return c(i.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:()=>X,pushError:(n,{skipDedupe:s,stackFrames:c,type:d}={})=>{d=d||n.name||H;const p={meta:r.value,payload:{type:d,value:n.message,timestamp:L(),trace:a.getTraceContext()},type:e.TransportItemType.EXCEPTION};(null==(c=null!=c?c:n.stack?null==X?void 0:X(n).frames:void 0)?void 0:c.length)&&(p.payload.stacktrace={frames:c});const f={type:p.payload.type,value:p.payload.value,stackTrace:p.payload.stacktrace};s||!i.dedupe||u(l)||!T(f,l)?(l=f,t.debug("Pushing exception\n",p),o.execute(p)):t.debug("Skipping error push because it is the same as the last one\n",p.payload)}}}(0,t,i,r,o,a)),function(e,n,t,i,r){let o,a,s;n.debug("Initializing meta API");const u=e=>{a&&i.remove(a),a={user:e},i.add(a)},l=e=>{o&&i.remove(o),o={session:e},i.add(o)};return{setUser:u,resetUser:u,setSession:l,resetSession:l,getSession:()=>i.value.session,setView:e=>{s&&i.remove(s),s={view:e},i.add(s)},getView:()=>i.value.view}}(0,t,0,r)),function(n,t,i,r,o,a){t.debug("Initializing logs API");let s=null;return{pushLog:(n,{context:l,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:O,context:null!=l?l:{},timestamp:L(),trace:a.getTraceContext()},meta:r.value},f={message:p.payload.message,level:p.payload.level,context:p.payload.context};if(!d&&i.dedupe&&!u(s)&&T(f,s))return void t.debug("Skipping log push because it is the same as the last one\n",p.payload);s=f,t.debug("Pushing log\n",p),o.execute(p)}catch(e){t.error("Error pushing log\n",e)}}}}(0,t,i,r,o,a)),function(n,t,i,r,o,a){t.debug("Initializing measurements API");let s=null;return{pushMeasurement:(n,{skipDedupe:l}={})=>{try{const c={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},n),{trace:a.getTraceContext()}),meta:r.value},d={type:c.payload.type,values:c.payload.values};if(!l&&i.dedupe&&!u(s)&&T(d,s))return void t.debug("Skipping measurement push because it is the same as the last one\n",c.payload);s=d,t.debug("Pushing measurement\n",c),o.execute(c)}catch(e){t.error("Error pushing measurement\n",e)}}}}(0,t,i,r,o,a)),function(n,t,i,r,o,a){let s=null;return{pushEvent:(n,l,c,{skipDedupe:d}={})=>{try{const p={meta:r.value,payload:{name:n,domain:null!=c?c:i.eventDomain,attributes:l,timestamp:L(),trace:a.getTraceContext()},type:e.TransportItemType.EVENT},f={name:p.payload.name,attributes:p.payload.attributes,domain:p.payload.domain};if(!d&&i.dedupe&&!u(s)&&T(f,s))return void t.debug("Skipping event push because it is the same as the last one\n",p.payload);s=f,t.debug("Pushing event\n",p),o.execute(p)}catch(e){t.error("Error pushing event",e)}}}}(0,t,i,r,o,a))}const J="undefined"==typeof window?global:window;class Q extends G{constructor(){super(...arguments),this.api={},this.transports={}}}const Y="1.0.0";const ee="_faroInternal";function ne(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(J,ee,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function te(){return ee in J}function ie(n,t,i,r,o,a,s){return t.debug("Initializing Faro"),e.faro={api:a,config:i,instrumentations:s,internalLogger:t,metas:r,pause:o.pause,transports:o,unpatchedConsole:n,unpause:o.unpause},ne(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 J)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(J,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}function re(e){const n=B(e),t=q(n,e);if(te()&&!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,p(n)?n():n)),{}),a=()=>{if(r.length){const e=o();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),i.push(...e),a()},remove:(...e)=>{n.debug("Removing metas\n",e),i=i.filter((n=>!e.includes(n))),a()},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=function(e,n,t,i){n.debug("Initializing transports");const r=[];let o=t.paused,a=[];return{add:(...o)=>{n.debug("Adding transports"),o.forEach((o=>{n.debug(`Adding "${o.name}" transport`),r.some((e=>e===o))?n.warn(`Transport ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=n,o.config=t,o.metas=i,r.push(o))}))},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(P(e))}))},getBeforeSendHooks:()=>[...a],execute:e=>{if(!o){let t=e;for(const e of a){const n=e(t);if(null===n)return;t=n}for(const e of r)n.debug(`Transporting item using ${e.name}\n`,t),e.send(t)}},isPaused:()=>o,pause:()=>{n.debug("Pausing transports"),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"),o=!1}}}(n,t,e,i),o=Z(0,t,e,i,r),a=function(e,n,t,i,r,o){n.debug("Initializing instrumentations");const a=[];return{add:(...s)=>{n.debug("Adding instrumentations"),s.forEach((s=>{n.debug(`Adding "${s.name}" instrumentation`),a.some((e=>e.name===s.name))?n.warn(`Instrumentation ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=n,s.config=t,s.metas=i,s.transports=r,s.api=o,a.push(s),s.initialize())}))},get instrumentations(){return[...a]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,i;n.debug(`Removing "${e.name}" instrumentation`);const r=a.reduce(((n,t,i)=>null===n&&t.name===e.name?i:null),null);r?(null===(i=(t=a[r]).destroy)||void 0===i||i.call(t),a.splice(r,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,i,r,o),s=ie(n,t,e,i,r,o,a);return function(e){var n;const t={sdk:{name:"@grafana/faro-core",version:Y,integrations:e.config.instrumentations.map((({name:e,version:n})=>({name:e,version:n})))}};e.config.session&&e.api.setSession(e.config.session),e.config.app&&(t.app=e.config.app),e.config.user&&(t.user=e.config.user),e.config.view&&(t.view=e.config.view),e.metas.add(t,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(s),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend),e.transports.addIgnoreErrorsPatterns(e.config.ignoreErrors)}(s),function(e){e.instrumentations.add(...e.config.instrumentations)}(s),s}e.faro={};const oe="faro",ae={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}};class se extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=t.VERSION}sendSessionStartEvent(e){const n=e.session;n&&n!==this.notifiedSession&&(this.notifiedSession=n,this.api.pushEvent(ae.EventNames.SESSION_START,{},void 0,{skipDedupe:!0}))}initialize(){this.sendSessionStartEvent(this.metas.value),this.metas.addListener(this.sendSessionStartEvent.bind(this))}}class ue extends Q{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=Y}initialize(){this.logDebug("Initializing\n",this.options),I.filter((e=>{var n;return!(null!==(n=this.options.disabledLevels)&&void 0!==n?n:ue.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)}}}))}}ue.defaultDisabledLevels=[e.LogLevel.DEBUG,e.LogLevel.TRACE,e.LogLevel.LOG];const le=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,ce=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,de=/\((\S*)(?::(\d+))(?::(\d+))\)/,pe="address at ",fe=pe.length,ge=/^\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,be=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,me="safari-extension",ve="safari-web-extension",he=/Minified React error #\d+;/i;function we(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 ye(e,n){const t=null==e?void 0:e.includes(me),i=!t&&(null==e?void 0:e.includes(ve));return t||i?[(null==e?void 0:e.includes("@"))?e.split("@")[0]:e,t?`${me}:${n}`:`${ve}:${n}`]:[e,n]}function Ee(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,a,s,u;if(r=ce.exec(t)){if(o=r[1],a=r[2],s=r[3],u=r[4],null==a?void 0:a.startsWith("eval")){const e=de.exec(a);e&&(a=e[1],s=e[2],u=e[3])}a=(null==a?void 0:a.startsWith(pe))?a.substring(fe):a,[o,a]=ye(o,a)}else if(r=ge.exec(t)){if(o=r[1],a=r[3],s=r[4],u=r[5],a&&a.includes(" > eval")){const e=be.exec(a);e&&(o=o||"eval",a=e[1],s=e[2])}else 0===i&&!u&&c(e.columnNumber)&&(u=String(e.columnNumber+1));[o,a]=ye(o,a)}return(a||o)&&n.push(we(a,o,s?Number(s):void 0,u?Number(u):void 0)),n}),[]);return he.test(e.message)?t.slice(1):t}function xe(e){return{frames:Ee(e)}}function ke(e){let n,t,i,r,o=[];if(w(e)&&e.error)n=e.error.message,t=e.error.name,o=Ee(e.error);else if((i=y(e))||E(e)){const{name:r,message:o}=e;t=null!=r?r:i?"DOMError":"DOMException",n=o?`${t}: ${o}`:t}else h(e)?(n=e.message,o=Ee(e)):(d(e)||(r=m(e)))&&(t=r?e.constructor.name:void 0,n=`Non-Error exception captured with keys: ${Object.keys(e)}`);return[n,t,o]}function Te(e){const n=window.onerror;window.onerror=(...t)=>{try{const[i,r,o,a,s]=t;let u,c,d=[];const p=l(i),f=we(r,"?",o,a);s||!p?([u,c,d]=ke(null!=s?s:i),0===d.length&&(d=[f])):p&&([u,c]=function(e){var n,t;const i=e.match(le),r=null!==(n=null==i?void 0:i[1])&&void 0!==n?n:H;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 Le extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=Y}initialize(){var e;this.logDebug("Initializing"),Te(this.api),e=this.api,window.addEventListener("unhandledrejection",(n=>{var t,i;let r,o,a=n;a.reason?a=n.reason:(null===(t=n.detail)||void 0===t?void 0:t.reason)&&(a=null===(i=n.detail)||void 0===i?void 0:i.reason),g(a)?(r=`Non-Error promise rejection captured with value: ${String(a)}`,o="UnhandledRejection"):[r,o]=ke(a),r&&e.pushError(new Error(r),{type:o})}))}}class Se extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=t.VERSION}sendViewChangedEvent(e){const n=e.view;n&&n!==this.notifiedView&&(this.notifiedView=n,this.api.pushEvent(ae.EventNames.VIEW_CHANGED,{},void 0,{skipDedupe:!0}))}initialize(){this.sendViewChangedEvent(this.metas.value),this.metas.addListener(this.sendViewChangedEvent.bind(this))}}var Oe,Ie,Ne,Ce,Re,Ae=-1,je=function(e){addEventListener("pageshow",(function(n){n.persisted&&(Ae=n.timeStamp,e(n))}),!0)},De=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},Pe=function(){var e=De();return e&&e.activationStart||0},ze=function(e,n){var t=De(),i="navigate";return Ae>=0?i="back-forward-cache":t&&(i=document.prerendering||Pe()>0?"prerender":document.wasDiscarded?"restore":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}},Me=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){}},Fe=function(e,n,t,i){var r,o;return function(a){n.value>=0&&(a||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))}},_e=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},$e=function(e){var n=function(n){"pagehide"!==n.type&&"hidden"!==document.visibilityState||e(n)};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Be=function(e){var n=!1;return function(t){n||(e(t),n=!0)}},Ue=-1,Ve=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},qe=function(e){"hidden"===document.visibilityState&&Ue>-1&&(Ue="visibilitychange"===e.type?e.timeStamp:0,We())},Ge=function(){addEventListener("visibilitychange",qe,!0),addEventListener("prerenderingchange",qe,!0)},We=function(){removeEventListener("visibilitychange",qe,!0),removeEventListener("prerenderingchange",qe,!0)},Ke=function(){return Ue<0&&(Ue=Ve(),Ge(),je((function(){setTimeout((function(){Ue=Ve(),Ge()}),0)}))),{get firstHiddenTime(){return Ue}}},He=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},Xe=function(e,n){n=n||{},He((function(){var t,i=[1800,3e3],r=Ke(),o=ze("FCP"),a=Me("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(a.disconnect(),e.startTime<r.firstHiddenTime&&(o.value=Math.max(e.startTime-Pe(),0),o.entries.push(e),t(!0)))}))}));a&&(t=Fe(e,o,i,n.reportAllChanges),je((function(r){o=ze("FCP"),t=Fe(e,o,i,n.reportAllChanges),_e((function(){o.value=performance.now()-r.timeStamp,t(!0)}))})))}))},Ze={passive:!0,capture:!0},Je=new Date,Qe=function(e,n){Oe||(Oe=n,Ie=e,Ne=new Date,nn(removeEventListener),Ye())},Ye=function(){if(Ie>=0&&Ie<Ne-Je){var e={entryType:"first-input",name:Oe.type,target:Oe.target,cancelable:Oe.cancelable,startTime:Oe.timeStamp,processingStart:Oe.timeStamp+Ie};Ce.forEach((function(n){n(e)})),Ce=[]}},en=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(){Qe(e,n),r()},i=function(){r()},r=function(){removeEventListener("pointerup",t,Ze),removeEventListener("pointercancel",i,Ze)};addEventListener("pointerup",t,Ze),addEventListener("pointercancel",i,Ze)}(n,e):Qe(n,e)}},nn=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,en,Ze)}))},tn=0,rn=1/0,on=0,an=function(e){e.forEach((function(e){e.interactionId&&(rn=Math.min(rn,e.interactionId),on=Math.max(on,e.interactionId),tn=on?(on-rn)/7+1:0)}))},sn=function(){return Re?tn:performance.interactionCount||0},un=function(){"interactionCount"in performance||Re||(Re=Me("event",an,{type:"event",buffered:!0,durationThreshold:0}))},ln=0,cn=function(){return sn()-ln},dn=[],pn={},fn=function(e){var n=dn[dn.length-1],t=pn[e.interactionId];if(t||dn.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]};pn[i.id]=i,dn.push(i)}dn.sort((function(e,n){return n.latency-e.latency})),dn.splice(10).forEach((function(e){delete pn[e.id]}))}},gn={},bn=function e(n){document.prerendering?He((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)};class mn extends Q{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=Y}initialize(){this.logDebug("Initializing"),Object.entries(mn.mapping).forEach((([e,n])=>{n((n=>{this.api.pushMeasurement({type:"web-vitals",values:{[e]:n.value}})}))}))}}function vn(e={}){const n=[new Le,new mn,new se,new Se];return!1!==e.captureConsole&&n.push(new ue({disabledLevels:e.captureConsoleDisabledLevels})),n}mn.mapping={cls:function(e,n){n=n||{},Xe(Be((function(){var t,i=[.1,.25],r=ze("CLS",0),o=0,a=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=a[0],t=a[a.length-1];o&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(o+=e.value,a.push(e)):(o=e.value,a=[e])}})),o>r.value&&(r.value=o,r.entries=a,t())},u=Me("layout-shift",s);u&&(t=Fe(e,r,i,n.reportAllChanges),$e((function(){s(u.takeRecords()),t(!0)})),je((function(){o=0,r=ze("CLS",0),t=Fe(e,r,i,n.reportAllChanges),_e((function(){return t()}))})),setTimeout(t,0))})))},fcp:Xe,fid:function(e,n){n=n||{},He((function(){var t,i=[100,300],r=Ke(),o=ze("FID"),a=function(e){e.startTime<r.firstHiddenTime&&(o.value=e.processingStart-e.startTime,o.entries.push(e),t(!0))},s=function(e){e.forEach(a)},u=Me("first-input",s);t=Fe(e,o,i,n.reportAllChanges),u&&$e(Be((function(){s(u.takeRecords()),u.disconnect()}))),u&&je((function(){var r;o=ze("FID"),t=Fe(e,o,i,n.reportAllChanges),Ce=[],Ie=-1,Oe=null,nn(addEventListener),r=a,Ce.push(r),Ye()}))}))},inp:function(e,n){n=n||{},He((function(){var t=[200,500];un();var i,r=ze("INP"),o=function(e){e.forEach((function(e){e.interactionId&&fn(e),"first-input"===e.entryType&&!dn.some((function(n){return n.entries.some((function(n){return e.duration===n.duration&&e.startTime===n.startTime}))}))&&fn(e)}));var n,t=(n=Math.min(dn.length-1,Math.floor(cn()/50)),dn[n]);t&&t.latency!==r.value&&(r.value=t.latency,r.entries=t.entries,i())},a=Me("event",o,{durationThreshold:n.durationThreshold||40});i=Fe(e,r,t,n.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),$e((function(){o(a.takeRecords()),r.value<0&&cn()>0&&(r.value=0,r.entries=[]),i(!0)})),je((function(){dn=[],ln=sn(),r=ze("INP"),i=Fe(e,r,t,n.reportAllChanges)})))}))},lcp:function(e,n){n=n||{},He((function(){var t,i=[2500,4e3],r=Ke(),o=ze("LCP"),a=function(e){var n=e[e.length-1];if(n){var i=Math.max(n.startTime-Pe(),0);i<r.firstHiddenTime&&(o.value=i,o.entries=[n],t())}},s=Me("largest-contentful-paint",a);if(s){t=Fe(e,o,i,n.reportAllChanges);var u=Be((function(){gn[o.id]||(a(s.takeRecords()),s.disconnect(),gn[o.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,u,!0)})),$e(u),je((function(r){o=ze("LCP"),t=Fe(e,o,i,n.reportAllChanges),_e((function(){o.value=performance.now()-r.timeStamp,gn[o.id]=!0,t(!0)}))}))}}))},ttfb:function(e,n){n=n||{};var t=[800,1800],i=ze("TTFB"),r=Fe(e,i,t,n.reportAllChanges);bn((function(){var o=De();if(o){var a=o.responseStart;if(a<=0||a>performance.now())return;i.value=Math.max(a-Pe(),0),i.entries=[o],r(!0),je((function(){i=ze("TTFB",0),(r=Fe(e,i,t,n.reportAllChanges))(!0)}))}}))}};const hn="browser",wn=()=>{const e=new t.UAParser,{name:n,version:i}=e.getBrowser(),{name:r,version:o}=e.getOS(),a="unknown";return{browser:{name:null!=n?n:a,version:null!=i?i:a,os:`${null!=r?r:a} ${null!=o?o:a}`,mobile:navigator.userAgent.includes("Mobi")}}},yn=()=>({page:{url:location.href}}),En=[wn,yn];function xn(e){return{id:A(),attributes:e}}const kn={name:"default"};function Tn(e,n,t,i){return new(t||(t=Promise))((function(r,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((i=i.apply(e,n||[])).next())}))}class Ln extends W{constructor(e){var n,t,i,r;super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-fetch",this.version=Y,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=C({size:null!==(i=e.bufferSize)&&void 0!==i?i:30,concurrency:null!==(r=e.concurrency)&&void 0!==r?r:5})}send(e){return Tn(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((()=>{const n=JSON.stringify(K(e)),{url:t,requestOptions:i,apiKey:r}=this.options,o=null!=i?i:{},{headers:a}=o,s=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}(o,["headers"]);return fetch(t,Object.assign({method:"POST",headers:Object.assign(Object.assign({"Content-Type":"application/json"},null!=a?a:{}),r?{"x-api-key":r}:{}),body:n,keepalive:!0},null!=s?s:{})).then((e=>(429===e.status&&(this.disabledUntil=this.getRetryAfterDate(e),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),e))).catch((e=>{this.logError("Failed sending payload to the receiver\n",JSON.parse(n),e)}))}))}catch(e){this.logError(e)}}))}getIgnoreUrls(){return[this.options.url]}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 Sn(e){var n,t,i,r,o,a,s,u,l,c,d;const p=[],f=U(e.unpatchedConsole,e.internalLoggerLevel);return e.transports?((e.url||e.apiKey)&&f.error('if "transports" is defined, "url" and "apiKey" should not be defined'),p.push(...e.transports)):e.url?p.push(new Ln({url:e.url,apiKey:e.apiKey})):f.error('either "url" or "transports" must be defined'),{app:e.app,dedupe:null===(n=e.dedupe)||void 0===n||n,globalObjectKey:e.globalObjectKey||oe,instrumentations:null!==(t=e.instrumentations)&&void 0!==t?t:vn(),internalLoggerLevel:null!==(i=e.internalLoggerLevel)&&void 0!==i?i:F,isolate:null!==(r=e.isolate)&&void 0!==r&&r,metas:null!==(o=e.metas)&&void 0!==o?o:En,parseStacktrace:xe,paused:null!==(a=e.paused)&&void 0!==a&&a,preventGlobalExposure:null!==(s=e.preventGlobalExposure)&&void 0!==s&&s,transports:p,unpatchedConsole:null!==(u=e.unpatchedConsole)&&void 0!==u?u:_,beforeSend:e.beforeSend,eventDomain:null!==(l=e.eventDomain)&&void 0!==l?l:hn,ignoreErrors:e.ignoreErrors,session:null!==(c=e.session)&&void 0!==c?c:xn(),user:e.user,view:null!==(d=e.view)&&void 0!==d?d:kn}}return e.BaseExtension=G,e.BaseInstrumentation=Q,e.BaseTransport=W,e.ConsoleInstrumentation=ue,e.ConsoleTransport=class extends W{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-web-sdk:transport-console",this.version=Y}send(n){var t;return this.unpatchedConsole[null!==(t=this.options.level)&&void 0!==t?t:e.LogLevel.DEBUG]("New event",K(n))}},e.Conventions=ae,e.ErrorsInstrumentation=Le,e.FetchTransport=Ln,e.VERSION=Y,e.ViewInstrumentation=Se,e.WebVitalsInstrumentation=mn,e.allLogLevels=I,e.browserMeta=wn,e.buildStackFrame=we,e.createInternalLogger=U,e.createPromiseBuffer=C,e.createSession=xn,e.deepEqual=T,e.defaultEventDomain=hn,e.defaultExceptionType=H,e.defaultGlobalObjectKey=oe,e.defaultInternalLoggerLevel=F,e.defaultLogLevel=O,e.defaultMetas=En,e.defaultViewMeta=kn,e.genShortID=A,e.getCurrentTimestamp=L,e.getDataFromSafariExtensions=ye,e.getInternalFaroFromGlobalObject=function(){return J[ee]},e.getStackFramesFromError=Ee,e.getTransportBody=K,e.getWebInstrumentations=vn,e.globalObject=J,e.initializeFaro=function(e){const n=Sn(e);if(n)return re(n)},e.internalGlobalObjectKey=ee,e.isArray=f,e.isBoolean=e=>r(e,"boolean"),e.isDomError=y,e.isDomException=E,e.isElement=e=>x&&a(e,Element),e.isElementDefined=x,e.isError=h,e.isErrorDefined=v,e.isErrorEvent=w,e.isEvent=m,e.isEventDefined=b,e.isFunction=p,e.isInstanceOf=a,e.isInt=e=>c(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=te,e.isMap=e=>k&&a(e,Map),e.isMapDefined=k,e.isNull=u,e.isNumber=c,e.isObject=d,e.isPrimitive=g,e.isRegExp=e=>o(e,"RegExp"),e.isString=l,e.isSymbol=e=>r(e,"symbol"),e.isSyntheticEvent=e=>d(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>p(null==e?void 0:e.then),e.isToString=o,e.isTypeof=r,e.isUndefined=s,e.makeCoreConfig=Sn,e.noop=N,e.pageMeta=yn,e.parseStacktrace=xe,e.setInternalFaroOnGlobalObject=ne,e.transportItemTypeToBodyKey=D,e}({});
|
|
@@ -8,6 +8,7 @@ function getWebInstrumentations(options) {
|
|
|
8
8
|
new instrumentations_1.ErrorsInstrumentation(),
|
|
9
9
|
new instrumentations_1.WebVitalsInstrumentation(),
|
|
10
10
|
new instrumentations_1.SessionInstrumentation(),
|
|
11
|
+
new instrumentations_1.ViewInstrumentation(),
|
|
11
12
|
];
|
|
12
13
|
if (options.captureConsole !== false) {
|
|
13
14
|
instrumentations.push(new instrumentations_1.ConsoleInstrumentation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWebInstrumentations.js","sourceRoot":"","sources":["../../../src/config/getWebInstrumentations.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"getWebInstrumentations.js","sourceRoot":"","sources":["../../../src/config/getWebInstrumentations.ts"],"names":[],"mappings":";;;AAEA,wDAM6B;AAI7B,SAAgB,sBAAsB,CAAC,OAA2C;IAA3C,wBAAA,EAAA,YAA2C;IAChF,IAAM,gBAAgB,GAAsB;QAC1C,IAAI,wCAAqB,EAAE;QAC3B,IAAI,2CAAwB,EAAE;QAC9B,IAAI,yCAAsB,EAAE;QAC5B,IAAI,sCAAmB,EAAE;KAC1B,CAAC;IAEF,IAAI,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;QACpC,gBAAgB,CAAC,IAAI,CACnB,IAAI,yCAAsB,CAAC;YACzB,cAAc,EAAE,OAAO,CAAC,4BAA4B;SACrD,CAAC,CACH,CAAC;KACH;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAjBD,wDAiBC","sourcesContent":["import type { Instrumentation } from '@grafana/faro-core';\n\nimport {\n ConsoleInstrumentation,\n ErrorsInstrumentation,\n SessionInstrumentation,\n ViewInstrumentation,\n WebVitalsInstrumentation,\n} from '../instrumentations';\n\nimport type { GetWebInstrumentationsOptions } from './types';\n\nexport function getWebInstrumentations(options: GetWebInstrumentationsOptions = {}): Instrumentation[] {\n const instrumentations: Instrumentation[] = [\n new ErrorsInstrumentation(),\n new WebVitalsInstrumentation(),\n new SessionInstrumentation(),\n new ViewInstrumentation(),\n ];\n\n if (options.captureConsole !== false) {\n instrumentations.push(\n new ConsoleInstrumentation({\n disabledLevels: options.captureConsoleDisabledLevels,\n })\n );\n }\n\n return instrumentations;\n}\n"]}
|
|
@@ -5,11 +5,10 @@ var faro_core_1 = require("@grafana/faro-core");
|
|
|
5
5
|
var consts_1 = require("../consts");
|
|
6
6
|
var instrumentations_1 = require("../instrumentations");
|
|
7
7
|
var metas_1 = require("../metas");
|
|
8
|
-
var session_1 = require("../session");
|
|
9
8
|
var transports_1 = require("../transports");
|
|
10
9
|
var getWebInstrumentations_1 = require("./getWebInstrumentations");
|
|
11
10
|
function makeCoreConfig(browserConfig) {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
11
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
13
12
|
var transports = [];
|
|
14
13
|
var internalLogger = (0, faro_core_1.createInternalLogger)(browserConfig.unpatchedConsole, browserConfig.internalLoggerLevel);
|
|
15
14
|
if (browserConfig.transports) {
|
|
@@ -41,10 +40,11 @@ function makeCoreConfig(browserConfig) {
|
|
|
41
40
|
transports: transports,
|
|
42
41
|
unpatchedConsole: (_h = browserConfig.unpatchedConsole) !== null && _h !== void 0 ? _h : faro_core_1.defaultUnpatchedConsole,
|
|
43
42
|
beforeSend: browserConfig.beforeSend,
|
|
43
|
+
eventDomain: (_j = browserConfig.eventDomain) !== null && _j !== void 0 ? _j : consts_1.defaultEventDomain,
|
|
44
44
|
ignoreErrors: browserConfig.ignoreErrors,
|
|
45
|
-
session: (
|
|
45
|
+
session: (_k = browserConfig.session) !== null && _k !== void 0 ? _k : (0, metas_1.createSession)(),
|
|
46
46
|
user: browserConfig.user,
|
|
47
|
-
|
|
47
|
+
view: (_l = browserConfig.view) !== null && _l !== void 0 ? _l : metas_1.defaultViewMeta,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
exports.makeCoreConfig = makeCoreConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeCoreConfig.js","sourceRoot":"","sources":["../../../src/config/makeCoreConfig.ts"],"names":[],"mappings":";;;AAAA,gDAK4B;AAG5B,oCAA+C;AAC/C,wDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"makeCoreConfig.js","sourceRoot":"","sources":["../../../src/config/makeCoreConfig.ts"],"names":[],"mappings":";;;AAAA,gDAK4B;AAG5B,oCAA+C;AAC/C,wDAAsD;AACtD,kCAAwE;AACxE,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,OAAO;QACL,GAAG,EAAE,aAAa,CAAC,GAAG;QACtB,MAAM,EAAE,MAAA,aAAa,CAAC,MAAM,mCAAI,IAAI;QACpC,eAAe,EAAE,aAAa,CAAC,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,MAAA,aAAa,CAAC,KAAK,mCAAI,oBAAY;QAC1C,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;QACxC,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,IAAA,qBAAa,GAAE;QACjD,IAAI,EAAE,aAAa,CAAC,IAAI;QACxB,IAAI,EAAE,MAAA,aAAa,CAAC,IAAI,mCAAI,uBAAe;KAC5C,CAAC;AACJ,CAAC;AA3CD,wCA2CC","sourcesContent":["import {\n createInternalLogger,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultUnpatchedConsole,\n} from '@grafana/faro-core';\nimport type { Config, Transport } from '@grafana/faro-core';\n\nimport { defaultEventDomain } from '../consts';\nimport { parseStacktrace } from '../instrumentations';\nimport { createSession, defaultMetas, defaultViewMeta } from '../metas';\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 return {\n app: browserConfig.app,\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: browserConfig.metas ?? defaultMetas,\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 session: browserConfig.session ?? createSession(),\n user: browserConfig.user,\n view: browserConfig.view ?? defaultViewMeta,\n };\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
|
-
exports.
|
|
4
|
-
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 = void 0;
|
|
3
|
+
exports.isFunction = exports.isEventDefined = 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.pageMeta = exports.defaultViewMeta = exports.defaultMetas = exports.createSession = exports.browserMeta = 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.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 = 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; } });
|
|
@@ -16,13 +16,14 @@ Object.defineProperty(exports, "ErrorsInstrumentation", { enumerable: true, get:
|
|
|
16
16
|
Object.defineProperty(exports, "getDataFromSafariExtensions", { enumerable: true, get: function () { return instrumentations_1.getDataFromSafariExtensions; } });
|
|
17
17
|
Object.defineProperty(exports, "getStackFramesFromError", { enumerable: true, get: function () { return instrumentations_1.getStackFramesFromError; } });
|
|
18
18
|
Object.defineProperty(exports, "parseStacktrace", { enumerable: true, get: function () { return instrumentations_1.parseStacktrace; } });
|
|
19
|
+
Object.defineProperty(exports, "ViewInstrumentation", { enumerable: true, get: function () { return instrumentations_1.ViewInstrumentation; } });
|
|
19
20
|
Object.defineProperty(exports, "WebVitalsInstrumentation", { enumerable: true, get: function () { return instrumentations_1.WebVitalsInstrumentation; } });
|
|
20
21
|
var metas_1 = require("./metas");
|
|
21
22
|
Object.defineProperty(exports, "browserMeta", { enumerable: true, get: function () { return metas_1.browserMeta; } });
|
|
23
|
+
Object.defineProperty(exports, "createSession", { enumerable: true, get: function () { return metas_1.createSession; } });
|
|
22
24
|
Object.defineProperty(exports, "defaultMetas", { enumerable: true, get: function () { return metas_1.defaultMetas; } });
|
|
25
|
+
Object.defineProperty(exports, "defaultViewMeta", { enumerable: true, get: function () { return metas_1.defaultViewMeta; } });
|
|
23
26
|
Object.defineProperty(exports, "pageMeta", { enumerable: true, get: function () { return metas_1.pageMeta; } });
|
|
24
|
-
var session_1 = require("./session");
|
|
25
|
-
Object.defineProperty(exports, "createSession", { enumerable: true, get: function () { return session_1.createSession; } });
|
|
26
27
|
var transports_1 = require("./transports");
|
|
27
28
|
Object.defineProperty(exports, "ConsoleTransport", { enumerable: true, get: function () { return transports_1.ConsoleTransport; } });
|
|
28
29
|
Object.defineProperty(exports, "FetchTransport", { enumerable: true, get: function () { return transports_1.FetchTransport; } });
|
|
@@ -40,6 +41,7 @@ Object.defineProperty(exports, "defaultExceptionType", { enumerable: true, get:
|
|
|
40
41
|
Object.defineProperty(exports, "defaultGlobalObjectKey", { enumerable: true, get: function () { return faro_core_1.defaultGlobalObjectKey; } });
|
|
41
42
|
Object.defineProperty(exports, "defaultInternalLoggerLevel", { enumerable: true, get: function () { return faro_core_1.defaultInternalLoggerLevel; } });
|
|
42
43
|
Object.defineProperty(exports, "defaultLogLevel", { enumerable: true, get: function () { return faro_core_1.defaultLogLevel; } });
|
|
44
|
+
Object.defineProperty(exports, "genShortID", { enumerable: true, get: function () { return faro_core_1.genShortID; } });
|
|
43
45
|
Object.defineProperty(exports, "getCurrentTimestamp", { enumerable: true, get: function () { return faro_core_1.getCurrentTimestamp; } });
|
|
44
46
|
Object.defineProperty(exports, "getInternalFaroFromGlobalObject", { enumerable: true, get: function () { return faro_core_1.getInternalFaroFromGlobalObject; } });
|
|
45
47
|
Object.defineProperty(exports, "getTransportBody", { enumerable: true, get: function () { return faro_core_1.getTransportBody; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -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,
|
|
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,uDAS4B;AAR1B,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;AAI1B,iCAA8F;AAArF,oGAAA,WAAW,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,qGAAA,YAAY,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAE5E,2CAAgE;AAAvD,8GAAA,gBAAgB,OAAA;AAAE,4GAAA,cAAc,OAAA;AAQzC,gDAwD4B;AAvD1B,iGAAA,IAAI,OAAA;AACJ,yGAAA,YAAY,OAAA;AACZ,0GAAA,aAAa,OAAA;AACb,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AACb,wGAAA,WAAW,OAAA;AACX,iHAAA,oBAAoB,OAAA;AACpB,gHAAA,mBAAmB,OAAA;AACnB,sGAAA,SAAS,OAAA;AACT,iHAAA,oBAAoB,OAAA;AACpB,mHAAA,sBAAsB,OAAA;AACtB,uHAAA,0BAA0B,OAAA;AAC1B,4GAAA,eAAe,OAAA;AACf,uGAAA,UAAU,OAAA;AACV,gHAAA,mBAAmB,OAAA;AACnB,4HAAA,+BAA+B,OAAA;AAC/B,6GAAA,gBAAgB,OAAA;AAChB,yGAAA,YAAY,OAAA;AACZ,oHAAA,uBAAuB,OAAA;AACvB,oGAAA,OAAO,OAAA;AACP,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,2GAAA,cAAc,OAAA;AACd,sGAAA,SAAS,OAAA;AACT,6GAAA,gBAAgB,OAAA;AAChB,oGAAA,OAAO,OAAA;AACP,2GAAA,cAAc,OAAA;AACd,yGAAA,YAAY,OAAA;AACZ,oGAAA,OAAO,OAAA;AACP,2GAAA,cAAc,OAAA;AACd,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,kGAAA,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","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} from './instrumentations';\nexport type { ConsoleInstrumentationOptions, ErrorEvent, ExtendedPromiseRejectionEvent } from './instrumentations';\n\nexport { browserMeta, createSession, defaultMetas, defaultViewMeta, pageMeta } 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"]}
|
|
@@ -41,13 +41,13 @@ var ConsoleInstrumentation = /** @class */ (function (_super) {
|
|
|
41
41
|
args[_i] = arguments[_i];
|
|
42
42
|
}
|
|
43
43
|
try {
|
|
44
|
-
_this.
|
|
44
|
+
_this.api.pushLog(args, { level: level });
|
|
45
45
|
}
|
|
46
46
|
catch (err) {
|
|
47
47
|
_this.logError(err);
|
|
48
48
|
}
|
|
49
49
|
finally {
|
|
50
|
-
(_a = _this.
|
|
50
|
+
(_a = _this.unpatchedConsole)[level].apply(_a, args);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/console/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0F;AAI1F;IAA4C,0CAAmB;IAM7D,gCAAoB,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAA/D,YACE,iBAAO,SACR;QAFmB,aAAO,GAAP,OAAO,CAAoC;QALtD,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,mBAAO,CAAC;;IAM3B,CAAC;IAED,2CAAU,GAAV;QAAA,iBAiBC;QAhBC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE9C,wBAAY;aACT,MAAM,CAAC,UAAC,KAAK,YAAK,OAAA,CAAC,CAAC,MAAA,KAAI,CAAC,OAAO,CAAC,cAAc,mCAAI,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA,EAAA,CAAC;aACjH,OAAO,CAAC,UAAC,KAAK;YACb,yCAAyC;YACzC,OAAO,CAAC,KAAK,CAAC,GAAG;;gBAAC,cAAO;qBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;oBAAP,yBAAO;;gBACvB,IAAI;oBACF,KAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/console/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAA0F;AAI1F;IAA4C,0CAAmB;IAM7D,gCAAoB,OAA2C;QAA3C,wBAAA,EAAA,YAA2C;QAA/D,YACE,iBAAO,SACR;QAFmB,aAAO,GAAP,OAAO,CAAoC;QALtD,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,mBAAO,CAAC;;IAM3B,CAAC;IAED,2CAAU,GAAV;QAAA,iBAiBC;QAhBC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE9C,wBAAY;aACT,MAAM,CAAC,UAAC,KAAK,YAAK,OAAA,CAAC,CAAC,MAAA,KAAI,CAAC,OAAO,CAAC,cAAc,mCAAI,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA,EAAA,CAAC;aACjH,OAAO,CAAC,UAAC,KAAK;YACb,yCAAyC;YACzC,OAAO,CAAC,KAAK,CAAC,GAAG;;gBAAC,cAAO;qBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;oBAAP,yBAAO;;gBACvB,IAAI;oBACF,KAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;iBACnC;gBAAC,OAAO,GAAG,EAAE;oBACZ,KAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;iBACpB;wBAAS;oBACR,CAAA,KAAA,KAAI,CAAC,gBAAgB,CAAA,CAAC,KAAK,CAAC,WAAI,IAAI,EAAE;iBACvC;YACH,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC;IAvBM,4CAAqB,GAAe,CAAC,oBAAQ,CAAC,KAAK,EAAE,oBAAQ,CAAC,KAAK,EAAE,oBAAQ,CAAC,GAAG,CAAC,CAAC;IAwB5F,6BAAC;CAAA,AA5BD,CAA4C,+BAAmB,GA4B9D;AA5BY,wDAAsB","sourcesContent":["import { allLogLevels, BaseInstrumentation, LogLevel, VERSION } from '@grafana/faro-core';\n\nimport type { ConsoleInstrumentationOptions } from './types';\n\nexport class ConsoleInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-console';\n readonly version = VERSION;\n\n static defaultDisabledLevels: LogLevel[] = [LogLevel.DEBUG, LogLevel.TRACE, LogLevel.LOG];\n\n constructor(private options: ConsoleInstrumentationOptions = {}) {\n super();\n }\n\n initialize() {\n this.logDebug('Initializing\\n', this.options);\n\n allLogLevels\n .filter((level) => !(this.options.disabledLevels ?? ConsoleInstrumentation.defaultDisabledLevels).includes(level))\n .forEach((level) => {\n /* eslint-disable-next-line no-console */\n console[level] = (...args) => {\n try {\n this.api.pushLog(args, { level });\n } catch (err) {\n this.logError(err);\n } finally {\n this.unpatchedConsole[level](...args);\n }\n };\n });\n }\n}\n"]}
|
|
@@ -29,8 +29,8 @@ var ErrorsInstrumentation = /** @class */ (function (_super) {
|
|
|
29
29
|
}
|
|
30
30
|
ErrorsInstrumentation.prototype.initialize = function () {
|
|
31
31
|
this.logDebug('Initializing');
|
|
32
|
-
(0, registerOnerror_1.registerOnerror)(this.
|
|
33
|
-
(0, registerOnunhandledrejection_1.registerOnunhandledrejection)(this.
|
|
32
|
+
(0, registerOnerror_1.registerOnerror)(this.api);
|
|
33
|
+
(0, registerOnunhandledrejection_1.registerOnunhandledrejection)(this.api);
|
|
34
34
|
};
|
|
35
35
|
return ErrorsInstrumentation;
|
|
36
36
|
}(faro_core_1.BaseInstrumentation));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAkE;AAElE,qDAAoD;AACpD,+EAA8E;AAE9E;IAA2C,yCAAmB;IAA9D;QAAA,qEAWC;QAVU,UAAI,GAAG,8CAA8C,CAAC;QACtD,aAAO,GAAG,mBAAO,CAAC;;IAS7B,CAAC;IAPC,0CAAU,GAAV;QACE,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,IAAA,iCAAe,EAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAkE;AAElE,qDAAoD;AACpD,+EAA8E;AAE9E;IAA2C,yCAAmB;IAA9D;QAAA,qEAWC;QAVU,UAAI,GAAG,8CAA8C,CAAC;QACtD,aAAO,GAAG,mBAAO,CAAC;;IAS7B,CAAC;IAPC,0CAAU,GAAV;QACE,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,IAAA,iCAAe,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE1B,IAAA,2DAA4B,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IACH,4BAAC;AAAD,CAAC,AAXD,CAA2C,+BAAmB,GAW7D;AAXY,sDAAqB","sourcesContent":["import { BaseInstrumentation, VERSION } from '@grafana/faro-core';\n\nimport { registerOnerror } from './registerOnerror';\nimport { registerOnunhandledrejection } from './registerOnunhandledrejection';\n\nexport class ErrorsInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-errors';\n readonly version = VERSION;\n\n initialize(): void {\n this.logDebug('Initializing');\n\n registerOnerror(this.api);\n\n registerOnunhandledrejection(this.api);\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ var const_1 = require("./const");
|
|
|
6
6
|
var getErrorDetails_1 = require("./getErrorDetails");
|
|
7
7
|
var getValueAndTypeFromMessage_1 = require("./getValueAndTypeFromMessage");
|
|
8
8
|
var stackFrames_1 = require("./stackFrames");
|
|
9
|
-
function registerOnerror(
|
|
9
|
+
function registerOnerror(api) {
|
|
10
10
|
// The error event is a little bit different than other events when it comes to the listener
|
|
11
11
|
// window.addEventListener does not provide all parameters, hence we need to use the window.onerror syntax
|
|
12
12
|
// TODO: investigate https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror
|
|
@@ -35,7 +35,7 @@ function registerOnerror(faro) {
|
|
|
35
35
|
stackFrames = [initialStackFrame];
|
|
36
36
|
}
|
|
37
37
|
if (value) {
|
|
38
|
-
|
|
38
|
+
api.pushError(new Error(value), { type: type, stackFrames: stackFrames });
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerOnerror.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnerror.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"registerOnerror.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnerror.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAG9C,iCAAwC;AACxC,qDAAoD;AACpD,2EAA0E;AAC1E,6CAAgD;AAEhD,SAAgB,eAAe,CAAC,GAAQ;IACtC,4FAA4F;IAC5F,0GAA0G;IAC1G,iGAAiG;IAEjG,IAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;IAElC,MAAM,CAAC,OAAO,GAAG;;QAAC,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QACvB,IAAI;YACK,IAAA,GAAG,GAAkC,IAAI,GAAtC,EAAE,MAAM,GAA0B,IAAI,GAA9B,EAAE,MAAM,GAAkB,IAAI,GAAtB,EAAE,KAAK,GAAW,IAAI,GAAf,EAAE,KAAK,GAAI,IAAI,GAAR,CAAS;YACjD,IAAI,KAAK,SAAoB,CAAC;YAC9B,IAAI,IAAI,SAAoB,CAAC;YAC7B,IAAI,WAAW,GAA0B,EAAE,CAAC;YAC5C,IAAM,aAAa,GAAG,IAAA,oBAAQ,EAAC,GAAG,CAAC,CAAC;YACpC,IAAM,iBAAiB,GAAG,IAAA,6BAAe,EAAC,MAAM,EAAE,qBAAa,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YAEhF,IAAI,KAAK,IAAI,CAAC,aAAa,EAAE;gBAC3B,KAA6B,IAAA,iCAAe,EAAC,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAkB,CAAC,EAA5E,KAAK,QAAA,EAAE,IAAI,QAAA,EAAE,WAAW,QAAA,CAAqD;gBAE9E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC5B,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;iBACnC;aACF;iBAAM,IAAI,aAAa,EAAE;gBACxB,KAAgB,IAAA,uDAA0B,EAAC,GAAG,CAAC,EAA9C,KAAK,QAAA,EAAE,IAAI,QAAA,CAAoC;gBAChD,WAAW,GAAG,CAAC,iBAAiB,CAAC,CAAC;aACnC;YAED,IAAI,KAAK,EAAE;gBACT,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,MAAA,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;aACxD;SACF;gBAAS;YACR,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACjC;IACH,CAAC,CAAC;AACJ,CAAC;AAlCD,0CAkCC","sourcesContent":["import { isString } from '@grafana/faro-core';\nimport type { API, ExceptionStackFrame } from '@grafana/faro-core';\n\nimport { unknownString } from './const';\nimport { getErrorDetails } from './getErrorDetails';\nimport { getValueAndTypeFromMessage } from './getValueAndTypeFromMessage';\nimport { buildStackFrame } from './stackFrames';\n\nexport function registerOnerror(api: API): void {\n // The error event is a little bit different than other events when it comes to the listener\n // window.addEventListener does not provide all parameters, hence we need to use the window.onerror syntax\n // TODO: investigate https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror\n\n const oldOnerror = window.onerror;\n\n window.onerror = (...args) => {\n try {\n const [evt, source, lineno, colno, error] = args;\n let value: string | undefined;\n let type: string | undefined;\n let stackFrames: ExceptionStackFrame[] = [];\n const eventIsString = isString(evt);\n const initialStackFrame = buildStackFrame(source, unknownString, lineno, colno);\n\n if (error || !eventIsString) {\n [value, type, stackFrames] = getErrorDetails((error ?? evt) as Error | Event);\n\n if (stackFrames.length === 0) {\n stackFrames = [initialStackFrame];\n }\n } else if (eventIsString) {\n [value, type] = getValueAndTypeFromMessage(evt);\n stackFrames = [initialStackFrame];\n }\n\n if (value) {\n api.pushError(new Error(value), { type, stackFrames });\n }\n } finally {\n oldOnerror?.apply(window, args);\n }\n };\n}\n"]}
|
|
@@ -4,7 +4,7 @@ exports.registerOnunhandledrejection = void 0;
|
|
|
4
4
|
var faro_core_1 = require("@grafana/faro-core");
|
|
5
5
|
var const_1 = require("./const");
|
|
6
6
|
var getErrorDetails_1 = require("./getErrorDetails");
|
|
7
|
-
function registerOnunhandledrejection(
|
|
7
|
+
function registerOnunhandledrejection(api) {
|
|
8
8
|
window.addEventListener('unhandledrejection', function (evt) {
|
|
9
9
|
var _a;
|
|
10
10
|
var _b, _c;
|
|
@@ -25,7 +25,7 @@ function registerOnunhandledrejection(faro) {
|
|
|
25
25
|
_a = (0, getErrorDetails_1.getErrorDetails)(error), value = _a[0], type = _a[1];
|
|
26
26
|
}
|
|
27
27
|
if (value) {
|
|
28
|
-
|
|
28
|
+
api.pushError(new Error(value), { type: type });
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerOnunhandledrejection.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnunhandledrejection.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"registerOnunhandledrejection.js","sourceRoot":"","sources":["../../../../src/instrumentations/errors/registerOnunhandledrejection.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AAGjD,iCAA0E;AAC1E,qDAAoD;AAGpD,SAAgB,4BAA4B,CAAC,GAAQ;IACnD,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,UAAC,GAAkC;;;QAC/E,IAAI,KAAK,GAAG,GAAG,CAAC;QAEhB,IAAI,KAAK,CAAC,MAAM,EAAE;YAChB,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;SACpB;aAAM,IAAI,MAAA,GAAG,CAAC,MAAM,0CAAE,MAAM,EAAE;YAC7B,KAAK,GAAG,MAAA,GAAG,CAAC,MAAM,0CAAE,MAAM,CAAC;SAC5B;QAED,IAAI,KAAyB,CAAC;QAC9B,IAAI,IAAwB,CAAC;QAE7B,IAAI,IAAA,uBAAW,EAAC,KAAK,CAAC,EAAE;YACtB,KAAK,GAAG,UAAG,+BAAuB,cAAI,MAAM,CAAC,KAAK,CAAC,CAAE,CAAC;YACtD,IAAI,GAAG,8BAAsB,CAAC;SAC/B;aAAM;YACL,KAAgB,IAAA,iCAAe,EAAC,KAAK,CAAC,EAArC,KAAK,QAAA,EAAE,IAAI,QAAA,CAA2B;SACxC;QAED,IAAI,KAAK,EAAE;YACT,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;SAC3C;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAxBD,oEAwBC","sourcesContent":["import { isPrimitive } from '@grafana/faro-core';\nimport type { API } from '@grafana/faro-core';\n\nimport { primitiveUnhandledType, primitiveUnhandledValue } from './const';\nimport { getErrorDetails } from './getErrorDetails';\nimport type { ExtendedPromiseRejectionEvent } from './types';\n\nexport function registerOnunhandledrejection(api: API): void {\n window.addEventListener('unhandledrejection', (evt: ExtendedPromiseRejectionEvent) => {\n let error = evt;\n\n if (error.reason) {\n error = evt.reason;\n } else if (evt.detail?.reason) {\n error = evt.detail?.reason;\n }\n\n let value: string | undefined;\n let type: string | undefined;\n\n if (isPrimitive(error)) {\n value = `${primitiveUnhandledValue} ${String(error)}`;\n type = primitiveUnhandledType;\n } else {\n [value, type] = getErrorDetails(error);\n }\n\n if (value) {\n api.pushError(new Error(value), { type });\n }\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebVitalsInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.buildStackFrame = exports.ConsoleInstrumentation = exports.SessionInstrumentation = void 0;
|
|
3
|
+
exports.WebVitalsInstrumentation = exports.ViewInstrumentation = exports.parseStacktrace = exports.getStackFramesFromError = exports.getDataFromSafariExtensions = exports.ErrorsInstrumentation = exports.buildStackFrame = exports.ConsoleInstrumentation = exports.SessionInstrumentation = void 0;
|
|
4
4
|
var session_1 = require("./session");
|
|
5
5
|
Object.defineProperty(exports, "SessionInstrumentation", { enumerable: true, get: function () { return session_1.SessionInstrumentation; } });
|
|
6
6
|
var console_1 = require("./console");
|
|
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "ErrorsInstrumentation", { enumerable: true, get:
|
|
|
11
11
|
Object.defineProperty(exports, "getDataFromSafariExtensions", { enumerable: true, get: function () { return errors_1.getDataFromSafariExtensions; } });
|
|
12
12
|
Object.defineProperty(exports, "getStackFramesFromError", { enumerable: true, get: function () { return errors_1.getStackFramesFromError; } });
|
|
13
13
|
Object.defineProperty(exports, "parseStacktrace", { enumerable: true, get: function () { return errors_1.parseStacktrace; } });
|
|
14
|
+
var view_1 = require("./view");
|
|
15
|
+
Object.defineProperty(exports, "ViewInstrumentation", { enumerable: true, get: function () { return view_1.ViewInstrumentation; } });
|
|
14
16
|
var webVitals_1 = require("./webVitals");
|
|
15
17
|
Object.defineProperty(exports, "WebVitalsInstrumentation", { enumerable: true, get: function () { return webVitals_1.WebVitalsInstrumentation; } });
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentations/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAE/B,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAG/B,mCAMkB;AALhB,yGAAA,eAAe,OAAA;AACf,+GAAA,qBAAqB,OAAA;AACrB,qHAAA,2BAA2B,OAAA;AAC3B,iHAAA,uBAAuB,OAAA;AACvB,yGAAA,eAAe,OAAA;AAIjB,yCAAuD;AAA9C,qHAAA,wBAAwB,OAAA","sourcesContent":["export { SessionInstrumentation } from './session';\n\nexport { ConsoleInstrumentation } from './console';\nexport type { ConsoleInstrumentationOptions } from './console';\n\nexport {\n buildStackFrame,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n} from './errors';\nexport type { ErrorEvent, ExtendedPromiseRejectionEvent } from './errors';\n\nexport { WebVitalsInstrumentation } from './webVitals';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentations/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAE/B,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAG/B,mCAMkB;AALhB,yGAAA,eAAe,OAAA;AACf,+GAAA,qBAAqB,OAAA;AACrB,qHAAA,2BAA2B,OAAA;AAC3B,iHAAA,uBAAuB,OAAA;AACvB,yGAAA,eAAe,OAAA;AAIjB,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,yCAAuD;AAA9C,qHAAA,wBAAwB,OAAA","sourcesContent":["export { SessionInstrumentation } from './session';\n\nexport { ConsoleInstrumentation } from './console';\nexport type { ConsoleInstrumentationOptions } from './console';\n\nexport {\n buildStackFrame,\n ErrorsInstrumentation,\n getDataFromSafariExtensions,\n getStackFramesFromError,\n parseStacktrace,\n} from './errors';\nexport type { ErrorEvent, ExtendedPromiseRejectionEvent } from './errors';\n\nexport { ViewInstrumentation } from './view';\n\nexport { WebVitalsInstrumentation } from './webVitals';\n"]}
|
|
@@ -33,12 +33,12 @@ var SessionInstrumentation = /** @class */ (function (_super) {
|
|
|
33
33
|
this.notifiedSession = session;
|
|
34
34
|
// no need to add attributes and session id, they are included as part of meta
|
|
35
35
|
// automatically
|
|
36
|
-
this.
|
|
36
|
+
this.api.pushEvent(faro_core_1.Conventions.EventNames.SESSION_START, {}, undefined, { skipDedupe: true });
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
SessionInstrumentation.prototype.initialize = function () {
|
|
40
|
-
this.sendSessionStartEvent(this.
|
|
41
|
-
this.
|
|
40
|
+
this.sendSessionStartEvent(this.metas.value);
|
|
41
|
+
this.metas.addListener(this.sendSessionStartEvent.bind(this));
|
|
42
42
|
};
|
|
43
43
|
return SessionInstrumentation;
|
|
44
44
|
}(faro_core_1.BaseInstrumentation));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAEvC,gDAAyF;AAEzF,4CAA4C;AAC5C;IAA4C,0CAAmB;IAA/D;QAAA,qEAwBC;QAvBU,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,sBAAO,CAAC;;IAsB7B,CAAC;IAhBS,sDAAqB,GAA7B,UAA8B,IAAU;QACtC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe,EAAE;YAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;YAC/B,8EAA8E;YAC9E,gBAAgB;YAChB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/session/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAEvC,gDAAyF;AAEzF,4CAA4C;AAC5C;IAA4C,0CAAmB;IAA/D;QAAA,qEAwBC;QAvBU,UAAI,GAAG,+CAA+C,CAAC;QACvD,aAAO,GAAG,sBAAO,CAAC;;IAsB7B,CAAC;IAhBS,sDAAqB,GAA7B,UAA8B,IAAU;QACtC,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe,EAAE;YAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;YAC/B,8EAA8E;YAC9E,gBAAgB;YAChB,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,uBAAW,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC/F;IACH,CAAC;IAED,2CAAU,GAAV;QACE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IACH,6BAAC;AAAD,CAAC,AAxBD,CAA4C,+BAAmB,GAwB9D;AAxBY,wDAAsB","sourcesContent":["import { VERSION } from 'ua-parser-js';\n\nimport { BaseInstrumentation, Conventions, Meta, MetaSession } from '@grafana/faro-core';\n\n// all this does is send SESSION_START event\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 !== this.notifiedSession) {\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(Conventions.EventNames.SESSION_START, {}, undefined, { skipDedupe: true });\n }\n }\n\n initialize() {\n this.sendSessionStartEvent(this.metas.value);\n\n this.metas.addListener(this.sendSessionStartEvent.bind(this));\n }\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewInstrumentation = void 0;
|
|
4
|
+
var instrumentation_1 = require("./instrumentation");
|
|
5
|
+
Object.defineProperty(exports, "ViewInstrumentation", { enumerable: true, get: function () { return instrumentation_1.ViewInstrumentation; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/instrumentations/view/index.ts"],"names":[],"mappings":";;;AAAA,qDAAwD;AAA/C,sHAAA,mBAAmB,OAAA","sourcesContent":["export { ViewInstrumentation } from './instrumentation';\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ViewInstrumentation = void 0;
|
|
19
|
+
var ua_parser_js_1 = require("ua-parser-js");
|
|
20
|
+
var faro_core_1 = require("@grafana/faro-core");
|
|
21
|
+
// all this does is send VIEW_CHANGED event
|
|
22
|
+
var ViewInstrumentation = /** @class */ (function (_super) {
|
|
23
|
+
__extends(ViewInstrumentation, _super);
|
|
24
|
+
function ViewInstrumentation() {
|
|
25
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
+
_this.name = '@grafana/faro-web-sdk:instrumentation-view';
|
|
27
|
+
_this.version = ua_parser_js_1.VERSION;
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
ViewInstrumentation.prototype.sendViewChangedEvent = function (meta) {
|
|
31
|
+
var view = meta.view;
|
|
32
|
+
if (view && view !== this.notifiedView) {
|
|
33
|
+
this.notifiedView = view;
|
|
34
|
+
this.api.pushEvent(faro_core_1.Conventions.EventNames.VIEW_CHANGED, {}, undefined, { skipDedupe: true });
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
ViewInstrumentation.prototype.initialize = function () {
|
|
38
|
+
this.sendViewChangedEvent(this.metas.value);
|
|
39
|
+
this.metas.addListener(this.sendViewChangedEvent.bind(this));
|
|
40
|
+
};
|
|
41
|
+
return ViewInstrumentation;
|
|
42
|
+
}(faro_core_1.BaseInstrumentation));
|
|
43
|
+
exports.ViewInstrumentation = ViewInstrumentation;
|
|
44
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/view/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6CAAuC;AAEvC,gDAAsF;AAEtF,2CAA2C;AAC3C;IAAyC,uCAAmB;IAA5D;QAAA,qEAuBC;QAtBU,UAAI,GAAG,4CAA4C,CAAC;QACpD,aAAO,GAAG,sBAAO,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,uBAAW,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;SAC9F;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 { VERSION } from 'ua-parser-js';\n\nimport { BaseInstrumentation, Conventions, Meta, MetaView } 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(Conventions.EventNames.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"]}
|
|
@@ -33,7 +33,7 @@ var WebVitalsInstrumentation = /** @class */ (function (_super) {
|
|
|
33
33
|
var indicator = _a[0], executor = _a[1];
|
|
34
34
|
executor(function (metric) {
|
|
35
35
|
var _a;
|
|
36
|
-
_this.
|
|
36
|
+
_this.api.pushMeasurement({
|
|
37
37
|
type: 'web-vitals',
|
|
38
38
|
values: (_a = {},
|
|
39
39
|
_a[indicator] = metric.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/webVitals/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAA6E;AAE7E,gDAAkE;AAElE;IAA8C,4CAAmB;IAAjE;QAAA,qEA2BC;QA1BU,UAAI,GAAG,kDAAkD,CAAC;QAC1D,aAAO,GAAG,mBAAO,CAAC;;IAyB7B,CAAC;IAdC,6CAAU,GAAV;QAAA,iBAaC;QAZC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAC,EAAqB;gBAApB,SAAS,QAAA,EAAE,QAAQ,QAAA;YAC5E,QAAQ,CAAC,UAAC,MAAM;;gBACd,KAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../../src/instrumentations/webVitals/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAA6E;AAE7E,gDAAkE;AAElE;IAA8C,4CAAmB;IAAjE;QAAA,qEA2BC;QA1BU,UAAI,GAAG,kDAAkD,CAAC;QAC1D,aAAO,GAAG,mBAAO,CAAC;;IAyB7B,CAAC;IAdC,6CAAU,GAAV;QAAA,iBAaC;QAZC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAE9B,MAAM,CAAC,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAC,EAAqB;gBAApB,SAAS,QAAA,EAAE,QAAQ,QAAA;YAC5E,QAAQ,CAAC,UAAC,MAAM;;gBACd,KAAI,CAAC,GAAG,CAAC,eAAe,CAAC;oBACvB,IAAI,EAAE,YAAY;oBAClB,MAAM;wBACJ,GAAC,SAAS,IAAG,MAAM,CAAC,KAAK;2BAC1B;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAtBM,gCAAO,GAAG;QACf,GAAG,EAAE,mBAAM;QACX,GAAG,EAAE,mBAAM;QACX,GAAG,EAAE,mBAAM;QACX,GAAG,EAAE,mBAAM;QACX,GAAG,EAAE,mBAAM;QACX,IAAI,EAAE,oBAAO;KACd,CAAC;IAgBJ,+BAAC;CAAA,AA3BD,CAA8C,+BAAmB,GA2BhE;AA3BY,4DAAwB","sourcesContent":["import { getCLS, getFCP, getFID, getINP, getLCP, getTTFB } from 'web-vitals';\n\nimport { BaseInstrumentation, VERSION } from '@grafana/faro-core';\n\nexport class WebVitalsInstrumentation extends BaseInstrumentation {\n readonly name = '@grafana/faro-web-sdk:instrumentation-web-vitals';\n readonly version = VERSION;\n\n static mapping = {\n cls: getCLS,\n fcp: getFCP,\n fid: getFID,\n inp: getINP,\n lcp: getLCP,\n ttfb: getTTFB,\n };\n\n initialize(): void {\n this.logDebug('Initializing');\n\n Object.entries(WebVitalsInstrumentation.mapping).forEach(([indicator, executor]) => {\n executor((metric) => {\n this.api.pushMeasurement({\n type: 'web-vitals',\n values: {\n [indicator]: metric.value,\n },\n });\n });\n });\n }\n}\n"]}
|