@grafana/faro-react 1.14.3 → 1.16.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.
Files changed (49) hide show
  1. package/dist/bundle/faro-react.iife.js +1 -1
  2. package/dist/bundle/types/router/v6/withFaroRouterInstrumentation.d.ts +2 -1
  3. package/dist/cjs/dependencies.js +2 -2
  4. package/dist/cjs/dependencies.js.map +1 -1
  5. package/dist/cjs/errorBoundary/FaroErrorBoundary.js.map +1 -1
  6. package/dist/cjs/errorBoundary/withFaroErrorBoundary.js +1 -2
  7. package/dist/cjs/errorBoundary/withFaroErrorBoundary.js.map +1 -1
  8. package/dist/cjs/instrumentation.js.map +1 -1
  9. package/dist/cjs/profiler/FaroProfiler.js.map +1 -1
  10. package/dist/cjs/profiler/withFaroProfiler.js +2 -3
  11. package/dist/cjs/profiler/withFaroProfiler.js.map +1 -1
  12. package/dist/cjs/router/initialize.js +1 -2
  13. package/dist/cjs/router/initialize.js.map +1 -1
  14. package/dist/cjs/router/types.js +2 -2
  15. package/dist/cjs/router/types.js.map +1 -1
  16. package/dist/cjs/router/v4v5/FaroRoute.js +1 -2
  17. package/dist/cjs/router/v4v5/FaroRoute.js.map +1 -1
  18. package/dist/cjs/router/v4v5/activeEvent.js +4 -4
  19. package/dist/cjs/router/v4v5/activeEvent.js.map +1 -1
  20. package/dist/cjs/router/v4v5/initialize.js +3 -4
  21. package/dist/cjs/router/v4v5/initialize.js.map +1 -1
  22. package/dist/cjs/router/v4v5/routerDependencies.js +3 -3
  23. package/dist/cjs/router/v4v5/routerDependencies.js.map +1 -1
  24. package/dist/cjs/router/v6/FaroRoutes.js +1 -2
  25. package/dist/cjs/router/v6/FaroRoutes.js.map +1 -1
  26. package/dist/cjs/router/v6/initialize.js +4 -5
  27. package/dist/cjs/router/v6/initialize.js.map +1 -1
  28. package/dist/cjs/router/v6/routerDependencies.js +4 -4
  29. package/dist/cjs/router/v6/routerDependencies.js.map +1 -1
  30. package/dist/cjs/router/v6/utils.js +2 -3
  31. package/dist/cjs/router/v6/utils.js.map +1 -1
  32. package/dist/cjs/router/v6/withFaroRouterInstrumentation.js +1 -2
  33. package/dist/cjs/router/v6/withFaroRouterInstrumentation.js.map +1 -1
  34. package/dist/cjs/utils/reactVersion.js +3 -3
  35. package/dist/cjs/utils/reactVersion.js.map +1 -1
  36. package/dist/esm/errorBoundary/FaroErrorBoundary.js.map +1 -1
  37. package/dist/esm/profiler/FaroProfiler.js.map +1 -1
  38. package/dist/esm/profiler/withFaroProfiler.js +1 -1
  39. package/dist/esm/profiler/withFaroProfiler.js.map +1 -1
  40. package/dist/esm/router/initialize.js.map +1 -1
  41. package/dist/esm/router/v4v5/FaroRoute.js.map +1 -1
  42. package/dist/esm/router/v4v5/activeEvent.js.map +1 -1
  43. package/dist/esm/router/v4v5/initialize.js.map +1 -1
  44. package/dist/esm/router/v6/FaroRoutes.js.map +1 -1
  45. package/dist/esm/router/v6/utils.js.map +1 -1
  46. package/dist/esm/router/v6/withFaroRouterInstrumentation.js.map +1 -1
  47. package/dist/esm/utils/reactVersion.js.map +1 -1
  48. package/dist/types/router/v6/withFaroRouterInstrumentation.d.ts +2 -1
  49. package/package.json +4 -4
@@ -24,4 +24,4 @@ var GrafanaFaroReact=function(e,t){"use strict";const r={hasError:!1,error:null}
24
24
  *
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
- */function A(){return N||(N=1,"production"===process.env.NODE_ENV?I.exports=function(){if(T)return D;T=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function g(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:switch(e=e.type){case c:case s:case n:case a:case o:case f:return e;default:switch(e=e&&e.$$typeof){case u:case l:case y:case d:case i:return e;default:return p}}case r:return p}}}function _(e){return g(e)===s}return D.AsyncMode=c,D.ConcurrentMode=s,D.ContextConsumer=u,D.ContextProvider=i,D.Element=t,D.ForwardRef=l,D.Fragment=n,D.Lazy=y,D.Memo=d,D.Portal=r,D.Profiler=a,D.StrictMode=o,D.Suspense=f,D.isAsyncMode=function(e){return _(e)||g(e)===c},D.isConcurrentMode=_,D.isContextConsumer=function(e){return g(e)===u},D.isContextProvider=function(e){return g(e)===i},D.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},D.isForwardRef=function(e){return g(e)===l},D.isFragment=function(e){return g(e)===n},D.isLazy=function(e){return g(e)===y},D.isMemo=function(e){return g(e)===d},D.isPortal=function(e){return g(e)===r},D.isProfiler=function(e){return g(e)===a},D.isStrictMode=function(e){return g(e)===o},D.isSuspense=function(e){return g(e)===f},D.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===s||e===a||e===o||e===f||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===i||e.$$typeof===u||e.$$typeof===l||e.$$typeof===b||e.$$typeof===v||e.$$typeof===h||e.$$typeof===m)},D.typeOf=g,D}():I.exports=(F||(F=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function g(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var m=e.type;switch(m){case c:case s:case n:case a:case o:case f:return m;default:var b=m&&m.$$typeof;switch(b){case u:case l:case y:case d:case i:return b;default:return p}}case r:return p}}}var _=c,O=s,S=u,j=i,E=t,R=l,P=n,w=y,k=d,C=r,$=a,T=o,x=f,I=!1;function D(e){return g(e)===s}M.AsyncMode=_,M.ConcurrentMode=O,M.ContextConsumer=S,M.ContextProvider=j,M.Element=E,M.ForwardRef=R,M.Fragment=P,M.Lazy=w,M.Memo=k,M.Portal=C,M.Profiler=$,M.StrictMode=T,M.Suspense=x,M.isAsyncMode=function(e){return I||(I=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(e)||g(e)===c},M.isConcurrentMode=D,M.isContextConsumer=function(e){return g(e)===u},M.isContextProvider=function(e){return g(e)===i},M.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},M.isForwardRef=function(e){return g(e)===l},M.isFragment=function(e){return g(e)===n},M.isLazy=function(e){return g(e)===y},M.isMemo=function(e){return g(e)===d},M.isPortal=function(e){return g(e)===r},M.isProfiler=function(e){return g(e)===a},M.isStrictMode=function(e){return g(e)===o},M.isSuspense=function(e){return g(e)===f},M.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===s||e===a||e===o||e===f||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===i||e.$$typeof===u||e.$$typeof===l||e.$$typeof===b||e.$$typeof===v||e.$$typeof===h||e.$$typeof===m)},M.typeOf=g}()),M)),I.exports}var U=function(){if(L)return V;L=1;var e=A(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},n={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};function a(r){return e.isMemo(r)?n:o[r.$$typeof]||t}o[e.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o[e.Memo]=n;var i=Object.defineProperty,u=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols,s=Object.getOwnPropertyDescriptor,l=Object.getPrototypeOf,f=Object.prototype;return V=function e(t,n,o){if("string"!=typeof n){if(f){var p=l(n);p&&p!==f&&e(t,p,o)}var d=u(n);c&&(d=d.concat(c(n)));for(var y=a(t),m=a(n),b=0;b<d.length;++b){var v=d[b];if(!(r[v]||o&&o[v]||m&&m[v]||y&&y[v])){var h=s(n,v);try{i(t,v,h)}catch(e){}}}}return t},V}(),z=n(U);const B="unknown";var W,q;let G,Y;function H(e){return G={route:"",url:e},G}function K(e){e.history,Y=e.Route}function J(e){var t,r;return(null===(t=null==e?void 0:e.computedMatch)||void 0===t?void 0:t.isExact)&&(r=e.computedMatch.path,G&&(G.route=r)),x.jsx(Y,Object.assign({},e))}function X(r){var n,o,a,i;const u=r.Route,c=null!==(n=u.displayName)&&void 0!==n?n:u.name;J.displayName=`faroRoute(${c})`,z(J,u),K(r),H(null===(o=t.globalObject.location)||void 0===o?void 0:o.href),null===(i=(a=r.history).listen)||void 0===i||i.call(a,((r,n)=>{var o;n!==e.NavigationType.Push&&n!==e.NavigationType.Pop||(m.pushEvent(t.EVENT_ROUTE_CHANGE,G,void 0,{skipDedupe:!0}),G=void 0,H(null===(o=t.globalObject.location)||void 0===o?void 0:o.href))}))}e.ReactRouterVersion=void 0,(W=e.ReactRouterVersion||(e.ReactRouterVersion={})).V4="v4",W.V5="v5",W.V6="v6",W.V6_data_router="v6_data_router",e.NavigationType=void 0,(q=e.NavigationType||(e.NavigationType={})).Pop="POP",q.Push="PUSH",q.Replace="REPLACE";let Q,Z,ee,te,re,ne=!1;function oe(e){return e.split(/\\?\//).filter((e=>e.length>0&&","!==e)).length}function ae(e,t){if(!e||0===e.length)return t.pathname;const r=Z(e,t);let n="";if(r)for(let e=0;e<r.length;e++){const o=r[e],a=o.route;if(a){if(a.index)return o.pathname;let e=a.path;if(e&&(e=e.startsWith("/")?e:`/${e}`,n+=e,o.pathname===t.pathname))return oe(n)!==oe(o.pathname)?e:n}}return t.pathname}function ie(r){var n;const o=null==te?void 0:te(),a=null==re?void 0:re(),i=d.useMemo((()=>{var e;return null!==(e=null==Q?void 0:Q(r.children))&&void 0!==e?e:[]}),[r.children]),u=d.useRef({});d.useEffect((()=>{var r,n;if(ne&&(a===e.NavigationType.Push||a===e.NavigationType.Pop)){const e=ae(i,o),a=null===(r=t.globalObject.location)||void 0===r?void 0:r.href;m.pushEvent(t.EVENT_ROUTE_CHANGE,Object.assign({toRoute:e,toUrl:null===(n=t.globalObject.location)||void 0===n?void 0:n.href},u.current)),u.current={fromRoute:e,fromUrl:a}}}),[o,a,i]);const c=null!==(n=r.routesComponent)&&void 0!==n?n:ee;return x.jsx(c,Object.assign({},r))}function ue(e){var t;z(ie,e.Routes),ne=!0,Q=(t=e).createRoutesFromChildren,Z=t.matchRoutes,ee=t.Routes,te=t.useLocation,re=t.useNavigationType}function ce(e){ne=!0,Z=e.matchRoutes}class se extends t.BaseInstrumentation{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-react",this.version=t.VERSION}initialize(){var t,r;t=this.internalLogger,r=this.api,y=t,m=r,function(t){var r;const n="Initializing React Router";switch(null===(r=t.router)||void 0===r?void 0:r.version){case e.ReactRouterVersion.V6:y.debug(`${n} V6 instrumentation`),ue(t.router.dependencies);break;case e.ReactRouterVersion.V6_data_router:y.debug(`${n} V6 data router instrumentation`),ce(t.router.dependencies);break;case e.ReactRouterVersion.V5:case e.ReactRouterVersion.V4:y.debug(`${n} ${t.router.version} instrumentation`),X(t.router.dependencies);break;default:y.debug("Skipping initialization of React Router instrumentation")}}(this.options)}}class le extends d.Component{get isOtelInitialized(){return!!(null==m?void 0:m.isOTELInitialized())}get otel(){return null==m?void 0:m.getOTEL()}get tracer(){var e;return null===(e=this.otel)||void 0===e?void 0:e.trace.getTracer("@grafana/faro-react",t.VERSION)}createSpan(e,t){var r,n;const o=this.tracer.startSpan(e,{startTime:null==t?void 0:t.startTime,attributes:Object.assign({"react.component.name":this.props.name},null!==(r=null==t?void 0:t.attributes)&&void 0!==r?r:{})});return null===(n=this.otel)||void 0===n||n.trace.setSpan(this.otel.context.active(),o),(null==t?void 0:t.endTime)&&o.end(t.endTime),o}createChildSpan(e,t,r){var n;let o;return null===(n=this.otel)||void 0===n||n.context.with(this.otel.trace.setSpan(this.otel.context.active(),t),(()=>{o=this.createSpan(e,r)})),o}constructor(e){super(e),this.mountSpan=void 0,this.mountSpanEndTime=void 0,this.updateSpan=void 0,this.isOtelInitialized?this.mountSpan=this.createSpan("componentMount"):null==y||y.error('The Faro React Profiler requires tracing instrumentation. Please enable it in the "instrumentations" section of your config.')}componentDidMount(){this.isOtelInitialized&&this.mountSpan&&(this.mountSpanEndTime=Date.now(),this.mountSpan.end(this.mountSpanEndTime))}shouldComponentUpdate({updateProps:e}){if(this.isOtelInitialized&&this.mountSpan&&e!==this.props.updateProps){const t=Object.keys(e).filter((t=>e[t]!==this.props.updateProps[t]));t.length>0&&(this.updateSpan=this.createChildSpan("componentUpdate",this.mountSpan,{attributes:{"react.component.changed_props":t}}))}return!0}componentDidUpdate(){this.isOtelInitialized&&this.updateSpan&&(this.updateSpan.end(),this.updateSpan=void 0)}componentWillUnmount(){this.isOtelInitialized&&this.mountSpan&&this.createChildSpan("componentRender",this.mountSpan,{startTime:this.mountSpanEndTime,endTime:Date.now()})}render(){return this.props.children}}return Object.defineProperty(e,"BaseExtension",{enumerable:!0,get:function(){return t.BaseExtension}}),Object.defineProperty(e,"BaseInstrumentation",{enumerable:!0,get:function(){return t.BaseInstrumentation}}),Object.defineProperty(e,"BaseTransport",{enumerable:!0,get:function(){return t.BaseTransport}}),Object.defineProperty(e,"ConsoleInstrumentation",{enumerable:!0,get:function(){return t.ConsoleInstrumentation}}),Object.defineProperty(e,"ConsoleTransport",{enumerable:!0,get:function(){return t.ConsoleTransport}}),Object.defineProperty(e,"Conventions",{enumerable:!0,get:function(){return t.Conventions}}),Object.defineProperty(e,"ErrorsInstrumentation",{enumerable:!0,get:function(){return t.ErrorsInstrumentation}}),Object.defineProperty(e,"FetchTransport",{enumerable:!0,get:function(){return t.FetchTransport}}),Object.defineProperty(e,"InternalLoggerLevel",{enumerable:!0,get:function(){return t.InternalLoggerLevel}}),Object.defineProperty(e,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(e,"TransportItemType",{enumerable:!0,get:function(){return t.TransportItemType}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return t.VERSION}}),Object.defineProperty(e,"ViewInstrumentation",{enumerable:!0,get:function(){return t.ViewInstrumentation}}),Object.defineProperty(e,"WebVitalsInstrumentation",{enumerable:!0,get:function(){return t.WebVitalsInstrumentation}}),Object.defineProperty(e,"allLogLevels",{enumerable:!0,get:function(){return t.allLogLevels}}),Object.defineProperty(e,"browserMeta",{enumerable:!0,get:function(){return t.browserMeta}}),Object.defineProperty(e,"buildStackFrame",{enumerable:!0,get:function(){return t.buildStackFrame}}),Object.defineProperty(e,"createInternalLogger",{enumerable:!0,get:function(){return t.createInternalLogger}}),Object.defineProperty(e,"createPromiseBuffer",{enumerable:!0,get:function(){return t.createPromiseBuffer}}),Object.defineProperty(e,"createSession",{enumerable:!0,get:function(){return t.createSession}}),Object.defineProperty(e,"deepEqual",{enumerable:!0,get:function(){return t.deepEqual}}),Object.defineProperty(e,"defaultEventDomain",{enumerable:!0,get:function(){return t.defaultEventDomain}}),Object.defineProperty(e,"defaultExceptionType",{enumerable:!0,get:function(){return t.defaultExceptionType}}),Object.defineProperty(e,"defaultGlobalObjectKey",{enumerable:!0,get:function(){return t.defaultGlobalObjectKey}}),Object.defineProperty(e,"defaultInternalLoggerLevel",{enumerable:!0,get:function(){return t.defaultInternalLoggerLevel}}),Object.defineProperty(e,"defaultLogLevel",{enumerable:!0,get:function(){return t.defaultLogLevel}}),Object.defineProperty(e,"faro",{enumerable:!0,get:function(){return t.faro}}),Object.defineProperty(e,"genShortID",{enumerable:!0,get:function(){return t.genShortID}}),Object.defineProperty(e,"getCurrentTimestamp",{enumerable:!0,get:function(){return t.getCurrentTimestamp}}),Object.defineProperty(e,"getDataFromSafariExtensions",{enumerable:!0,get:function(){return t.getDataFromSafariExtensions}}),Object.defineProperty(e,"getInternalFaroFromGlobalObject",{enumerable:!0,get:function(){return t.getInternalFaroFromGlobalObject}}),Object.defineProperty(e,"getStackFramesFromError",{enumerable:!0,get:function(){return t.getStackFramesFromError}}),Object.defineProperty(e,"getTransportBody",{enumerable:!0,get:function(){return t.getTransportBody}}),Object.defineProperty(e,"getWebInstrumentations",{enumerable:!0,get:function(){return t.getWebInstrumentations}}),Object.defineProperty(e,"globalObject",{enumerable:!0,get:function(){return t.globalObject}}),Object.defineProperty(e,"initializeFaro",{enumerable:!0,get:function(){return t.initializeFaro}}),Object.defineProperty(e,"internalGlobalObjectKey",{enumerable:!0,get:function(){return t.internalGlobalObjectKey}}),Object.defineProperty(e,"isArray",{enumerable:!0,get:function(){return t.isArray}}),Object.defineProperty(e,"isBoolean",{enumerable:!0,get:function(){return t.isBoolean}}),Object.defineProperty(e,"isDomError",{enumerable:!0,get:function(){return t.isDomError}}),Object.defineProperty(e,"isDomException",{enumerable:!0,get:function(){return t.isDomException}}),Object.defineProperty(e,"isElement",{enumerable:!0,get:function(){return t.isElement}}),Object.defineProperty(e,"isElementDefined",{enumerable:!0,get:function(){return t.isElementDefined}}),Object.defineProperty(e,"isError",{enumerable:!0,get:function(){return t.isError}}),Object.defineProperty(e,"isErrorDefined",{enumerable:!0,get:function(){return t.isErrorDefined}}),Object.defineProperty(e,"isErrorEvent",{enumerable:!0,get:function(){return t.isErrorEvent}}),Object.defineProperty(e,"isEvent",{enumerable:!0,get:function(){return t.isEvent}}),Object.defineProperty(e,"isEventDefined",{enumerable:!0,get:function(){return t.isEventDefined}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return t.isFunction}}),Object.defineProperty(e,"isInstanceOf",{enumerable:!0,get:function(){return t.isInstanceOf}}),Object.defineProperty(e,"isInt",{enumerable:!0,get:function(){return t.isInt}}),Object.defineProperty(e,"isInternalFaroOnGlobalObject",{enumerable:!0,get:function(){return t.isInternalFaroOnGlobalObject}}),Object.defineProperty(e,"isMap",{enumerable:!0,get:function(){return t.isMap}}),Object.defineProperty(e,"isMapDefined",{enumerable:!0,get:function(){return t.isMapDefined}}),Object.defineProperty(e,"isNull",{enumerable:!0,get:function(){return t.isNull}}),Object.defineProperty(e,"isNumber",{enumerable:!0,get:function(){return t.isNumber}}),Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return t.isObject}}),Object.defineProperty(e,"isPrimitive",{enumerable:!0,get:function(){return t.isPrimitive}}),Object.defineProperty(e,"isRegExp",{enumerable:!0,get:function(){return t.isRegExp}}),Object.defineProperty(e,"isString",{enumerable:!0,get:function(){return t.isString}}),Object.defineProperty(e,"isSymbol",{enumerable:!0,get:function(){return t.isSymbol}}),Object.defineProperty(e,"isSyntheticEvent",{enumerable:!0,get:function(){return t.isSyntheticEvent}}),Object.defineProperty(e,"isThenable",{enumerable:!0,get:function(){return t.isThenable}}),Object.defineProperty(e,"isToString",{enumerable:!0,get:function(){return t.isToString}}),Object.defineProperty(e,"isTypeof",{enumerable:!0,get:function(){return t.isTypeof}}),Object.defineProperty(e,"isUndefined",{enumerable:!0,get:function(){return t.isUndefined}}),Object.defineProperty(e,"makeCoreConfig",{enumerable:!0,get:function(){return t.makeCoreConfig}}),Object.defineProperty(e,"noop",{enumerable:!0,get:function(){return t.noop}}),Object.defineProperty(e,"parseStacktrace",{enumerable:!0,get:function(){return t.parseStacktrace}}),Object.defineProperty(e,"setInternalFaroOnGlobalObject",{enumerable:!0,get:function(){return t.setInternalFaroOnGlobalObject}}),Object.defineProperty(e,"transportItemTypeToBodyKey",{enumerable:!0,get:function(){return t.transportItemTypeToBodyKey}}),e.FaroErrorBoundary=j,e.FaroProfiler=le,e.FaroRoute=J,e.FaroRoutes=ie,e.ReactIntegration=se,e.createReactRouterV4Options=function(t){return{version:e.ReactRouterVersion.V4,dependencies:t}},e.createReactRouterV5Options=function(t){return{version:e.ReactRouterVersion.V5,dependencies:t}},e.createReactRouterV6DataOptions=function(t){return{version:e.ReactRouterVersion.V6_data_router,dependencies:t}},e.createReactRouterV6Options=function(t){return{version:e.ReactRouterVersion.V6,dependencies:t}},e.faroErrorBoundaryInitialState=r,e.getMajorReactVersion=O,e.isReactVersionAtLeast=S,e.isReactVersionAtLeast16=_,e.isReactVersionAtLeast17=g,e.isReactVersionAtLeast18=h,e.reactVersion=b,e.reactVersionMajor=v,e.setReactRouterV4V5SSRDependencies=function(e){Y=e.Route},e.setReactRouterV6SSRDependencies=function(e){ee=e.Routes},e.withFaroErrorBoundary=function(e,t){var r,n;const o=null!==(n=null!==(r=e.displayName)&&void 0!==r?r:e.name)&&void 0!==n?n:B,a=r=>x.jsx(j,Object.assign({},t,{children:x.jsx(e,Object.assign({},r))}));return a.displayName=`faroErrorBoundary(${o})`,z(a,e),a},e.withFaroProfiler=function(e,t){var r,n,o;const a=null!==(o=null!==(n=null!==(r=null==t?void 0:t.name)&&void 0!==r?r:e.displayName)&&void 0!==n?n:e.name)&&void 0!==o?o:B,i=t=>x.jsx(le,Object.assign({name:a,updateProps:t},{children:x.jsx(e,Object.assign({},t))}));return i.displayName=`faroProfiler(${a})`,z(i,e),i},e.withFaroRouterInstrumentation=function(r){let n={};return r.subscribe((o=>{var a,i;const u=o.historyAction,c=o.location,s=r.routes;if(ne&&(u===e.NavigationType.Push||u===e.NavigationType.Pop)){const e=ae(s,c),r=null===(a=t.globalObject.location)||void 0===a?void 0:a.href;m.pushEvent(t.EVENT_ROUTE_CHANGE,Object.assign({toRoute:e,toUrl:null===(i=t.globalObject.location)||void 0===i?void 0:i.href},n)),n={fromRoute:e,fromUrl:r}}})),r},e}({},GrafanaFaroWebSdk);
27
+ */function A(){return N||(N=1,"production"===process.env.NODE_ENV?I.exports=function(){if(T)return D;T=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function g(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:switch(e=e.type){case c:case s:case n:case a:case o:case f:return e;default:switch(e=e&&e.$$typeof){case u:case l:case y:case d:case i:return e;default:return p}}case r:return p}}}function _(e){return g(e)===s}return D.AsyncMode=c,D.ConcurrentMode=s,D.ContextConsumer=u,D.ContextProvider=i,D.Element=t,D.ForwardRef=l,D.Fragment=n,D.Lazy=y,D.Memo=d,D.Portal=r,D.Profiler=a,D.StrictMode=o,D.Suspense=f,D.isAsyncMode=function(e){return _(e)||g(e)===c},D.isConcurrentMode=_,D.isContextConsumer=function(e){return g(e)===u},D.isContextProvider=function(e){return g(e)===i},D.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},D.isForwardRef=function(e){return g(e)===l},D.isFragment=function(e){return g(e)===n},D.isLazy=function(e){return g(e)===y},D.isMemo=function(e){return g(e)===d},D.isPortal=function(e){return g(e)===r},D.isProfiler=function(e){return g(e)===a},D.isStrictMode=function(e){return g(e)===o},D.isSuspense=function(e){return g(e)===f},D.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===s||e===a||e===o||e===f||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===i||e.$$typeof===u||e.$$typeof===l||e.$$typeof===b||e.$$typeof===v||e.$$typeof===h||e.$$typeof===m)},D.typeOf=g,D}():I.exports=(F||(F=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,s=e?Symbol.for("react.concurrent_mode"):60111,l=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,m=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function g(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var m=e.type;switch(m){case c:case s:case n:case a:case o:case f:return m;default:var b=m&&m.$$typeof;switch(b){case u:case l:case y:case d:case i:return b;default:return p}}case r:return p}}}var _=c,O=s,S=u,j=i,E=t,R=l,P=n,w=y,k=d,C=r,$=a,T=o,x=f,I=!1;function D(e){return g(e)===s}M.AsyncMode=_,M.ConcurrentMode=O,M.ContextConsumer=S,M.ContextProvider=j,M.Element=E,M.ForwardRef=R,M.Fragment=P,M.Lazy=w,M.Memo=k,M.Portal=C,M.Profiler=$,M.StrictMode=T,M.Suspense=x,M.isAsyncMode=function(e){return I||(I=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(e)||g(e)===c},M.isConcurrentMode=D,M.isContextConsumer=function(e){return g(e)===u},M.isContextProvider=function(e){return g(e)===i},M.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},M.isForwardRef=function(e){return g(e)===l},M.isFragment=function(e){return g(e)===n},M.isLazy=function(e){return g(e)===y},M.isMemo=function(e){return g(e)===d},M.isPortal=function(e){return g(e)===r},M.isProfiler=function(e){return g(e)===a},M.isStrictMode=function(e){return g(e)===o},M.isSuspense=function(e){return g(e)===f},M.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===s||e===a||e===o||e===f||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===i||e.$$typeof===u||e.$$typeof===l||e.$$typeof===b||e.$$typeof===v||e.$$typeof===h||e.$$typeof===m)},M.typeOf=g}()),M)),I.exports}var U=function(){if(L)return V;L=1;var e=A(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},n={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};function a(r){return e.isMemo(r)?n:o[r.$$typeof]||t}o[e.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o[e.Memo]=n;var i=Object.defineProperty,u=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols,s=Object.getOwnPropertyDescriptor,l=Object.getPrototypeOf,f=Object.prototype;return V=function e(t,n,o){if("string"!=typeof n){if(f){var p=l(n);p&&p!==f&&e(t,p,o)}var d=u(n);c&&(d=d.concat(c(n)));for(var y=a(t),m=a(n),b=0;b<d.length;++b){var v=d[b];if(!(r[v]||o&&o[v]||m&&m[v]||y&&y[v])){var h=s(n,v);try{i(t,v,h)}catch(e){}}}}return t},V}(),z=n(U);const B="unknown";var W,q;let G,Y;function H(e){return G={route:"",url:e},G}function K(e){e.history,Y=e.Route}function J(e){var t,r;return(null===(t=null==e?void 0:e.computedMatch)||void 0===t?void 0:t.isExact)&&(r=e.computedMatch.path,G&&(G.route=r)),x.jsx(Y,Object.assign({},e))}function X(r){var n,o,a,i;const u=r.Route,c=null!==(n=u.displayName)&&void 0!==n?n:u.name;J.displayName=`faroRoute(${c})`,z(J,u),K(r),H(null===(o=t.globalObject.location)||void 0===o?void 0:o.href),null===(i=(a=r.history).listen)||void 0===i||i.call(a,((r,n)=>{var o;n!==e.NavigationType.Push&&n!==e.NavigationType.Pop||(m.pushEvent(t.EVENT_ROUTE_CHANGE,G,void 0,{skipDedupe:!0}),G=void 0,H(null===(o=t.globalObject.location)||void 0===o?void 0:o.href))}))}e.ReactRouterVersion=void 0,(W=e.ReactRouterVersion||(e.ReactRouterVersion={})).V4="v4",W.V5="v5",W.V6="v6",W.V6_data_router="v6_data_router",e.NavigationType=void 0,(q=e.NavigationType||(e.NavigationType={})).Pop="POP",q.Push="PUSH",q.Replace="REPLACE";let Q,Z,ee,te,re,ne=!1;function oe(e){return e.split(/\\?\//).filter((e=>e.length>0&&","!==e)).length}function ae(e,t){if(!e||0===e.length)return t.pathname;const r=Z(e,t);let n="";if(r)for(let e=0;e<r.length;e++){const o=r[e],a=o.route;if(a){if(a.index)return o.pathname;let e=a.path;if(e&&(e=e.startsWith("/")?e:`/${e}`,n+=e,o.pathname===t.pathname))return oe(n)!==oe(o.pathname)?e:n}}return t.pathname}function ie(r){var n;const o=null==te?void 0:te(),a=null==re?void 0:re(),i=d.useMemo((()=>{var e;return null!==(e=null==Q?void 0:Q(r.children))&&void 0!==e?e:[]}),[r.children]),u=d.useRef({});d.useEffect((()=>{var r,n;if(ne&&(a===e.NavigationType.Push||a===e.NavigationType.Pop)){const e=ae(i,o),a=null===(r=t.globalObject.location)||void 0===r?void 0:r.href;m.pushEvent(t.EVENT_ROUTE_CHANGE,Object.assign({toRoute:e,toUrl:null===(n=t.globalObject.location)||void 0===n?void 0:n.href},u.current)),u.current={fromRoute:e,fromUrl:a}}}),[o,a,i]);const c=null!==(n=r.routesComponent)&&void 0!==n?n:ee;return x.jsx(c,Object.assign({},r))}function ue(e){var t;z(ie,e.Routes),ne=!0,Q=(t=e).createRoutesFromChildren,Z=t.matchRoutes,ee=t.Routes,te=t.useLocation,re=t.useNavigationType}function ce(e){ne=!0,Z=e.matchRoutes}class se extends t.BaseInstrumentation{constructor(e={}){super(),this.options=e,this.name="@grafana/faro-react",this.version=t.VERSION}initialize(){var t,r;t=this.internalLogger,r=this.api,y=t,m=r,function(t){var r;const n="Initializing React Router";switch(null===(r=t.router)||void 0===r?void 0:r.version){case e.ReactRouterVersion.V6:y.debug(`${n} V6 instrumentation`),ue(t.router.dependencies);break;case e.ReactRouterVersion.V6_data_router:y.debug(`${n} V6 data router instrumentation`),ce(t.router.dependencies);break;case e.ReactRouterVersion.V5:case e.ReactRouterVersion.V4:y.debug(`${n} ${t.router.version} instrumentation`),X(t.router.dependencies);break;default:y.debug("Skipping initialization of React Router instrumentation")}}(this.options)}}class le extends d.Component{get isOtelInitialized(){return!!(null==m?void 0:m.isOTELInitialized())}get otel(){return null==m?void 0:m.getOTEL()}get tracer(){var e;return null===(e=this.otel)||void 0===e?void 0:e.trace.getTracer("@grafana/faro-react",t.VERSION)}createSpan(e,t){var r,n;const o=this.tracer.startSpan(e,{startTime:null==t?void 0:t.startTime,attributes:Object.assign({"react.component.name":this.props.name},null!==(r=null==t?void 0:t.attributes)&&void 0!==r?r:{})});return null===(n=this.otel)||void 0===n||n.trace.setSpan(this.otel.context.active(),o),(null==t?void 0:t.endTime)&&o.end(t.endTime),o}createChildSpan(e,t,r){var n;let o;return null===(n=this.otel)||void 0===n||n.context.with(this.otel.trace.setSpan(this.otel.context.active(),t),(()=>{o=this.createSpan(e,r)})),o}constructor(e){super(e),this.mountSpan=void 0,this.mountSpanEndTime=void 0,this.updateSpan=void 0,this.isOtelInitialized?this.mountSpan=this.createSpan("componentMount"):null==y||y.error('The Faro React Profiler requires tracing instrumentation. Please enable it in the "instrumentations" section of your config.')}componentDidMount(){this.isOtelInitialized&&this.mountSpan&&(this.mountSpanEndTime=Date.now(),this.mountSpan.end(this.mountSpanEndTime))}shouldComponentUpdate({updateProps:e}){if(this.isOtelInitialized&&this.mountSpan&&e!==this.props.updateProps){const t=Object.keys(e).filter((t=>e[t]!==this.props.updateProps[t]));t.length>0&&(this.updateSpan=this.createChildSpan("componentUpdate",this.mountSpan,{attributes:{"react.component.changed_props":t}}))}return!0}componentDidUpdate(){this.isOtelInitialized&&this.updateSpan&&(this.updateSpan.end(),this.updateSpan=void 0)}componentWillUnmount(){this.isOtelInitialized&&this.mountSpan&&this.createChildSpan("componentRender",this.mountSpan,{startTime:this.mountSpanEndTime,endTime:Date.now()})}render(){return this.props.children}}return Object.defineProperty(e,"BaseExtension",{enumerable:!0,get:function(){return t.BaseExtension}}),Object.defineProperty(e,"BaseInstrumentation",{enumerable:!0,get:function(){return t.BaseInstrumentation}}),Object.defineProperty(e,"BaseTransport",{enumerable:!0,get:function(){return t.BaseTransport}}),Object.defineProperty(e,"ConsoleInstrumentation",{enumerable:!0,get:function(){return t.ConsoleInstrumentation}}),Object.defineProperty(e,"ConsoleTransport",{enumerable:!0,get:function(){return t.ConsoleTransport}}),Object.defineProperty(e,"Conventions",{enumerable:!0,get:function(){return t.Conventions}}),Object.defineProperty(e,"ErrorsInstrumentation",{enumerable:!0,get:function(){return t.ErrorsInstrumentation}}),Object.defineProperty(e,"FetchTransport",{enumerable:!0,get:function(){return t.FetchTransport}}),Object.defineProperty(e,"InternalLoggerLevel",{enumerable:!0,get:function(){return t.InternalLoggerLevel}}),Object.defineProperty(e,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(e,"TransportItemType",{enumerable:!0,get:function(){return t.TransportItemType}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return t.VERSION}}),Object.defineProperty(e,"ViewInstrumentation",{enumerable:!0,get:function(){return t.ViewInstrumentation}}),Object.defineProperty(e,"WebVitalsInstrumentation",{enumerable:!0,get:function(){return t.WebVitalsInstrumentation}}),Object.defineProperty(e,"allLogLevels",{enumerable:!0,get:function(){return t.allLogLevels}}),Object.defineProperty(e,"browserMeta",{enumerable:!0,get:function(){return t.browserMeta}}),Object.defineProperty(e,"buildStackFrame",{enumerable:!0,get:function(){return t.buildStackFrame}}),Object.defineProperty(e,"createInternalLogger",{enumerable:!0,get:function(){return t.createInternalLogger}}),Object.defineProperty(e,"createPromiseBuffer",{enumerable:!0,get:function(){return t.createPromiseBuffer}}),Object.defineProperty(e,"createSession",{enumerable:!0,get:function(){return t.createSession}}),Object.defineProperty(e,"deepEqual",{enumerable:!0,get:function(){return t.deepEqual}}),Object.defineProperty(e,"defaultEventDomain",{enumerable:!0,get:function(){return t.defaultEventDomain}}),Object.defineProperty(e,"defaultExceptionType",{enumerable:!0,get:function(){return t.defaultExceptionType}}),Object.defineProperty(e,"defaultGlobalObjectKey",{enumerable:!0,get:function(){return t.defaultGlobalObjectKey}}),Object.defineProperty(e,"defaultInternalLoggerLevel",{enumerable:!0,get:function(){return t.defaultInternalLoggerLevel}}),Object.defineProperty(e,"defaultLogLevel",{enumerable:!0,get:function(){return t.defaultLogLevel}}),Object.defineProperty(e,"faro",{enumerable:!0,get:function(){return t.faro}}),Object.defineProperty(e,"genShortID",{enumerable:!0,get:function(){return t.genShortID}}),Object.defineProperty(e,"getCurrentTimestamp",{enumerable:!0,get:function(){return t.getCurrentTimestamp}}),Object.defineProperty(e,"getDataFromSafariExtensions",{enumerable:!0,get:function(){return t.getDataFromSafariExtensions}}),Object.defineProperty(e,"getInternalFaroFromGlobalObject",{enumerable:!0,get:function(){return t.getInternalFaroFromGlobalObject}}),Object.defineProperty(e,"getStackFramesFromError",{enumerable:!0,get:function(){return t.getStackFramesFromError}}),Object.defineProperty(e,"getTransportBody",{enumerable:!0,get:function(){return t.getTransportBody}}),Object.defineProperty(e,"getWebInstrumentations",{enumerable:!0,get:function(){return t.getWebInstrumentations}}),Object.defineProperty(e,"globalObject",{enumerable:!0,get:function(){return t.globalObject}}),Object.defineProperty(e,"initializeFaro",{enumerable:!0,get:function(){return t.initializeFaro}}),Object.defineProperty(e,"internalGlobalObjectKey",{enumerable:!0,get:function(){return t.internalGlobalObjectKey}}),Object.defineProperty(e,"isArray",{enumerable:!0,get:function(){return t.isArray}}),Object.defineProperty(e,"isBoolean",{enumerable:!0,get:function(){return t.isBoolean}}),Object.defineProperty(e,"isDomError",{enumerable:!0,get:function(){return t.isDomError}}),Object.defineProperty(e,"isDomException",{enumerable:!0,get:function(){return t.isDomException}}),Object.defineProperty(e,"isElement",{enumerable:!0,get:function(){return t.isElement}}),Object.defineProperty(e,"isElementDefined",{enumerable:!0,get:function(){return t.isElementDefined}}),Object.defineProperty(e,"isError",{enumerable:!0,get:function(){return t.isError}}),Object.defineProperty(e,"isErrorDefined",{enumerable:!0,get:function(){return t.isErrorDefined}}),Object.defineProperty(e,"isErrorEvent",{enumerable:!0,get:function(){return t.isErrorEvent}}),Object.defineProperty(e,"isEvent",{enumerable:!0,get:function(){return t.isEvent}}),Object.defineProperty(e,"isEventDefined",{enumerable:!0,get:function(){return t.isEventDefined}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return t.isFunction}}),Object.defineProperty(e,"isInstanceOf",{enumerable:!0,get:function(){return t.isInstanceOf}}),Object.defineProperty(e,"isInt",{enumerable:!0,get:function(){return t.isInt}}),Object.defineProperty(e,"isInternalFaroOnGlobalObject",{enumerable:!0,get:function(){return t.isInternalFaroOnGlobalObject}}),Object.defineProperty(e,"isMap",{enumerable:!0,get:function(){return t.isMap}}),Object.defineProperty(e,"isMapDefined",{enumerable:!0,get:function(){return t.isMapDefined}}),Object.defineProperty(e,"isNull",{enumerable:!0,get:function(){return t.isNull}}),Object.defineProperty(e,"isNumber",{enumerable:!0,get:function(){return t.isNumber}}),Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return t.isObject}}),Object.defineProperty(e,"isPrimitive",{enumerable:!0,get:function(){return t.isPrimitive}}),Object.defineProperty(e,"isRegExp",{enumerable:!0,get:function(){return t.isRegExp}}),Object.defineProperty(e,"isString",{enumerable:!0,get:function(){return t.isString}}),Object.defineProperty(e,"isSymbol",{enumerable:!0,get:function(){return t.isSymbol}}),Object.defineProperty(e,"isSyntheticEvent",{enumerable:!0,get:function(){return t.isSyntheticEvent}}),Object.defineProperty(e,"isThenable",{enumerable:!0,get:function(){return t.isThenable}}),Object.defineProperty(e,"isToString",{enumerable:!0,get:function(){return t.isToString}}),Object.defineProperty(e,"isTypeof",{enumerable:!0,get:function(){return t.isTypeof}}),Object.defineProperty(e,"isUndefined",{enumerable:!0,get:function(){return t.isUndefined}}),Object.defineProperty(e,"makeCoreConfig",{enumerable:!0,get:function(){return t.makeCoreConfig}}),Object.defineProperty(e,"noop",{enumerable:!0,get:function(){return t.noop}}),Object.defineProperty(e,"parseStacktrace",{enumerable:!0,get:function(){return t.parseStacktrace}}),Object.defineProperty(e,"setInternalFaroOnGlobalObject",{enumerable:!0,get:function(){return t.setInternalFaroOnGlobalObject}}),Object.defineProperty(e,"transportItemTypeToBodyKey",{enumerable:!0,get:function(){return t.transportItemTypeToBodyKey}}),e.FaroErrorBoundary=j,e.FaroProfiler=le,e.FaroRoute=J,e.FaroRoutes=ie,e.ReactIntegration=se,e.createReactRouterV4Options=function(t){return{version:e.ReactRouterVersion.V4,dependencies:t}},e.createReactRouterV5Options=function(t){return{version:e.ReactRouterVersion.V5,dependencies:t}},e.createReactRouterV6DataOptions=function(t){return{version:e.ReactRouterVersion.V6_data_router,dependencies:t}},e.createReactRouterV6Options=function(t){return{version:e.ReactRouterVersion.V6,dependencies:t}},e.faroErrorBoundaryInitialState=r,e.getMajorReactVersion=O,e.isReactVersionAtLeast=S,e.isReactVersionAtLeast16=_,e.isReactVersionAtLeast17=g,e.isReactVersionAtLeast18=h,e.reactVersion=b,e.reactVersionMajor=v,e.setReactRouterV4V5SSRDependencies=function(e){Y=e.Route},e.setReactRouterV6SSRDependencies=function(e){ee=e.Routes},e.withFaroErrorBoundary=function(e,t){var r,n;const o=null!==(n=null!==(r=e.displayName)&&void 0!==r?r:e.name)&&void 0!==n?n:B,a=r=>x.jsx(j,Object.assign({},t,{children:x.jsx(e,Object.assign({},r))}));return a.displayName=`faroErrorBoundary(${o})`,z(a,e),a},e.withFaroProfiler=function(e,t){var r,n,o;const a=null!==(o=null!==(n=null!==(r=null==t?void 0:t.name)&&void 0!==r?r:e.displayName)&&void 0!==n?n:e.name)&&void 0!==o?o:B,i=t=>x.jsx(le,{name:a,updateProps:t,children:x.jsx(e,Object.assign({},t))});return i.displayName=`faroProfiler(${a})`,z(i,e),i},e.withFaroRouterInstrumentation=function(r){let n={};return r.subscribe((o=>{var a,i;const u=o.historyAction,c=o.location,s=r.routes;if(ne&&(u===e.NavigationType.Push||u===e.NavigationType.Pop)){const e=ae(s,c),r=null===(a=t.globalObject.location)||void 0===a?void 0:a.href;m.pushEvent(t.EVENT_ROUTE_CHANGE,Object.assign({toRoute:e,toUrl:null===(i=t.globalObject.location)||void 0===i?void 0:i.href},n)),n={fromRoute:e,fromUrl:r}}})),r},e}({},GrafanaFaroWebSdk);
@@ -1,4 +1,5 @@
1
- import { NavigationType, ReactRouterLocation } from '../types';
1
+ import { NavigationType } from '../types';
2
+ import type { ReactRouterLocation } from '../types';
2
3
  import type { RouteObjectV6DataRouter } from './types';
3
4
  interface RouterState {
4
5
  historyAction: NavigationType | any;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setDependencies = exports.api = exports.internalLogger = void 0;
3
+ exports.api = exports.internalLogger = void 0;
4
+ exports.setDependencies = setDependencies;
4
5
  function setDependencies(newInternalLogger, newApi) {
5
6
  exports.internalLogger = newInternalLogger;
6
7
  exports.api = newApi;
7
8
  }
8
- exports.setDependencies = setDependencies;
9
9
  //# sourceMappingURL=dependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/dependencies.ts"],"names":[],"mappings":";;;AAKA,SAAgB,eAAe,CAAC,iBAAiC,EAAE,MAAW;IAC5E,sBAAc,GAAG,iBAAiB,CAAC;IACnC,WAAG,GAAG,MAAM,CAAC;AACf,CAAC;AAHD,0CAGC","sourcesContent":["import type { API, InternalLogger } from '@grafana/faro-web-sdk';\n\nexport let internalLogger: InternalLogger;\nexport let api: API;\n\nexport function setDependencies(newInternalLogger: InternalLogger, newApi: API): void {\n internalLogger = newInternalLogger;\n api = newApi;\n}\n"]}
1
+ {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/dependencies.ts"],"names":[],"mappings":";;;AAKA,0CAGC;AAHD,SAAgB,eAAe,CAAC,iBAAiC,EAAE,MAAW;IAC5E,sBAAc,GAAG,iBAAiB,CAAC;IACnC,WAAG,GAAG,MAAM,CAAC;AACf,CAAC","sourcesContent":["import type { API, InternalLogger } from '@grafana/faro-web-sdk';\n\nexport let internalLogger: InternalLogger;\nexport let api: API;\n\nexport function setDependencies(newInternalLogger: InternalLogger, newApi: API): void {\n internalLogger = newInternalLogger;\n api = newApi;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FaroErrorBoundary.js","sour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AI,CAAC,iBAAiB,EAAE,iDAAiD,CAAC,CAAC;SAC5F;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IACH,wBAAC;AAAD,CAAC,AA1ED,CAAuC,iBAAS,GA0E/C;AA1EY,8CAAiB","sourcesContent":["import { Component, isValidElement } from 'react';\nimport type { ErrorInfo, ReactNode } from 'react';\n\nimport { isFunction } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\nimport { isReactVersionAtLeast17 } from '../utils';\n\nimport { faroErrorBoundaryInitialState } from './const';\nimport type { FaroErrorBoundaryProps, FaroErrorBoundaryState } from './types';\n\nexport class FaroErrorBoundary extends Component<FaroErrorBoundaryProps, FaroErrorBoundaryState> {\n override state: FaroErrorBoundaryState = faroErrorBoundaryInitialState;\n\n constructor(props: FaroErrorBoundaryProps) {\n super(props);\n\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n }\n\n getErrorWithComponentStack(error: Error, errorInfo: ErrorInfo): Error {\n if (!isReactVersionAtLeast17 || !errorInfo.componentStack) {\n return error;\n }\n\n const newError = new Error(error.message);\n\n newError.name = `React ErrorBoundary ${error.name}`;\n newError.stack = errorInfo.componentStack;\n\n return newError;\n }\n\n static getDerivedStateFromError(error: Error): FaroErrorBoundaryState {\n return {\n hasError: true,\n error,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n const errorWithComponentStack = this.getErrorWithComponentStack(error, errorInfo);\n\n this.props.beforeCapture?.(errorWithComponentStack);\n\n api.pushError(errorWithComponentStack, this.props.pushErrorOptions);\n\n this.props.onError?.(errorWithComponentStack);\n\n this.setState({ hasError: true, error });\n }\n\n override componentDidMount(): void {\n this.props.onMount?.();\n }\n\n override componentWillUnmount(): void {\n this.props.onUnmount?.(this.state.error);\n }\n\n resetErrorBoundary(): void {\n this.props.onReset?.(this.state.error);\n\n this.setState(faroErrorBoundaryInitialState);\n }\n\n override render(): ReactNode {\n if (!this.state.hasError) {\n return isFunction(this.props.children) ? this.props.children() : this.props.children;\n }\n\n const element = !isFunction(this.props.fallback)\n ? this.props.fallback\n : this.props.fallback(this.state.error!, this.resetErrorBoundary);\n\n if (isValidElement(element)) {\n return element;\n }\n\n if (this.props.fallback) {\n internalLogger?.warn('ErrorBoundary\\n', 'Cannot get a valid ReactElement from \"fallback\"');\n }\n\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"FaroErrorBoundary.js","sourceRoot":"","sources":["../../../src/errorBoundary/FaroErrorBoundary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAAkD;AAGlD,sDAAmD;AAEnD,gDAAsD;AACtD,kCAAmD;AAEnD,iCAAwD;AAGxD;IAAuC,qCAAyD;IAG9F,2BAAY,KAA6B;QACvC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QAHN,WAAK,GAA2B,qCAA6B,CAAC;QAKrE,KAAI,CAAC,kBAAkB,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;IAC/D,CAAC;IAED,sDAA0B,GAA1B,UAA2B,KAAY,EAAE,SAAoB;QAC3D,IAAI,CAAC,+BAAuB,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAM,QAAQ,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE1C,QAAQ,CAAC,IAAI,GAAG,8BAAuB,KAAK,CAAC,IAAI,CAAE,CAAC;QACpD,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,cAAc,CAAC;QAE1C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,0CAAwB,GAA/B,UAAgC,KAAY;QAC1C,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,KAAK,OAAA;SACN,CAAC;IACJ,CAAC;IAEQ,6CAAiB,GAA1B,UAA2B,KAAY,EAAE,SAAoB;;QAC3D,IAAM,uBAAuB,GAAG,IAAI,CAAC,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AC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEpE,IAAI,IAAA,sBAAc,EAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,6BAAc,aAAd,6BAAc,uBAAd,6BAAc,CAAE,IAAI,CAAC,iBAAiB,EAAE,iDAAiD,CAAC,CAAC;QAC7F,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IACH,wBAAC;AAAD,CAAC,AA1ED,CAAuC,iBAAS,GA0E/C;AA1EY,8CAAiB","sourcesContent":["import { Component, isValidElement } from 'react';\nimport type { ErrorInfo, ReactNode } from 'react';\n\nimport { isFunction } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\nimport { isReactVersionAtLeast17 } from '../utils';\n\nimport { faroErrorBoundaryInitialState } from './const';\nimport type { FaroErrorBoundaryProps, FaroErrorBoundaryState } from './types';\n\nexport class FaroErrorBoundary extends Component<FaroErrorBoundaryProps, FaroErrorBoundaryState> {\n override state: FaroErrorBoundaryState = faroErrorBoundaryInitialState;\n\n constructor(props: FaroErrorBoundaryProps) {\n super(props);\n\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n }\n\n getErrorWithComponentStack(error: Error, errorInfo: ErrorInfo): Error {\n if (!isReactVersionAtLeast17 || !errorInfo.componentStack) {\n return error;\n }\n\n const newError = new Error(error.message);\n\n newError.name = `React ErrorBoundary ${error.name}`;\n newError.stack = errorInfo.componentStack;\n\n return newError;\n }\n\n static getDerivedStateFromError(error: Error): FaroErrorBoundaryState {\n return {\n hasError: true,\n error,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n const errorWithComponentStack = this.getErrorWithComponentStack(error, errorInfo);\n\n this.props.beforeCapture?.(errorWithComponentStack);\n\n api.pushError(errorWithComponentStack, this.props.pushErrorOptions);\n\n this.props.onError?.(errorWithComponentStack);\n\n this.setState({ hasError: true, error });\n }\n\n override componentDidMount(): void {\n this.props.onMount?.();\n }\n\n override componentWillUnmount(): void {\n this.props.onUnmount?.(this.state.error);\n }\n\n resetErrorBoundary(): void {\n this.props.onReset?.(this.state.error);\n\n this.setState(faroErrorBoundaryInitialState);\n }\n\n override render(): ReactNode {\n if (!this.state.hasError) {\n return isFunction(this.props.children) ? this.props.children() : this.props.children;\n }\n\n const element = !isFunction(this.props.fallback)\n ? this.props.fallback\n : this.props.fallback(this.state.error!, this.resetErrorBoundary);\n\n if (isValidElement(element)) {\n return element;\n }\n\n if (this.props.fallback) {\n internalLogger?.warn('ErrorBoundary\\n', 'Cannot get a valid ReactElement from \"fallback\"');\n }\n\n return null;\n }\n}\n"]}
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.withFaroErrorBoundary = void 0;
17
+ exports.withFaroErrorBoundary = withFaroErrorBoundary;
18
18
  var jsx_runtime_1 = require("react/jsx-runtime");
19
19
  var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
20
20
  var faro_core_1 = require("@grafana/faro-core");
@@ -27,5 +27,4 @@ function withFaroErrorBoundary(WrappedComponent, errorBoundaryProps) {
27
27
  (0, hoist_non_react_statics_1.default)(Component, WrappedComponent);
28
28
  return Component;
29
29
  }
30
- exports.withFaroErrorBoundary = withFaroErrorBoundary;
31
30
  //# sourceMappingURL=withFaroErrorBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroErrorBoundary.js","sourceRoot":"","sources":["../../../src/errorBoundary/withFaroErrorBoundary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oFAA2D;AAG3D,gDAAmD;AAEnD,yDAAwD;AAGxD,SAAgB,qBAAqB,CACnC,gBAAkC,EAClC,kBAA0C;;IAE1C,IAAM,oBAAoB,GAAG,MAAA,MAAA,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,yBAAa,CAAC;IAEpG,IAAM,SAAS,GAAU,UAAC,qBAAwB,IAAK,OAAA,CACrD,uBAAC,qCAAiB,eAAK,kBAAkB,cACvC,uBAAC,gBAAgB,eAAK,qBAAqB,EAAI,IAC7B,CACrB,EAJsD,CAItD,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,4BAAqB,oBAAoB,MAAG,CAAC;IAErE,IAAA,iCAAoB,EAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC;AAjBD,sDAiBC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-core';\n\nimport { FaroErrorBoundary } from './FaroErrorBoundary';\nimport type { FaroErrorBoundaryProps, ReactProps } from './types';\n\nexport function withFaroErrorBoundary<P extends ReactProps = {}>(\n WrappedComponent: ComponentType<P>,\n errorBoundaryProps: FaroErrorBoundaryProps\n): FC<P> {\n const componentDisplayName = WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (wrappedComponentProps: P) => (\n <FaroErrorBoundary {...errorBoundaryProps}>\n <WrappedComponent {...wrappedComponentProps} />\n </FaroErrorBoundary>\n );\n\n Component.displayName = `faroErrorBoundary(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
1
+ {"version":3,"file":"withFaroErrorBoundary.js","sourceRoot":"","sources":["../../../src/errorBoundary/withFaroErrorBoundary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAQA,sDAiBC;;AAzBD,oFAA2D;AAG3D,gDAAmD;AAEnD,yDAAwD;AAGxD,SAAgB,qBAAqB,CACnC,gBAAkC,EAClC,kBAA0C;;IAE1C,IAAM,oBAAoB,GAAG,MAAA,MAAA,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,yBAAa,CAAC;IAEpG,IAAM,SAAS,GAAU,UAAC,qBAAwB,IAAK,OAAA,CACrD,uBAAC,qCAAiB,eAAK,kBAAkB,cACvC,uBAAC,gBAAgB,eAAK,qBAAqB,EAAI,IAC7B,CACrB,EAJsD,CAItD,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,4BAAqB,oBAAoB,MAAG,CAAC;IAErE,IAAA,iCAAoB,EAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-core';\n\nimport { FaroErrorBoundary } from './FaroErrorBoundary';\nimport type { FaroErrorBoundaryProps, ReactProps } from './types';\n\nexport function withFaroErrorBoundary<P extends ReactProps = {}>(\n WrappedComponent: ComponentType<P>,\n errorBoundaryProps: FaroErrorBoundaryProps\n): FC<P> {\n const componentDisplayName = WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (wrappedComponentProps: P) => (\n <FaroErrorBoundary {...errorBoundaryProps}>\n <WrappedComponent {...wrappedComponentProps} />\n </FaroErrorBoundary>\n );\n\n Component.displayName = `faroErrorBoundary(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,sDAAqE;AAErE,+CAAiD;AACjD,mCAAgE;AAGhE;IAAsC,oCAAmB;IAIvD,0BAAoB,OAAoC;QAApC,wBAAA,EAAA,YAAoC;QAAxD,YACE,iBAAO,SACR;QAFmB,aAAO,GAAP,OAAO,CAA6B;QAHxD,UAAI,GAAG,qBAAqB,CAAC;QAC7B,aAAO,GAAG,sBAAO,CAAC;;IAIlB,CAAC;IAED,qCAAU,GAAV;QACE,IAAA,8BAAe,EAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAA,6CAAoC,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IACH,uBAAC;AAAD,CAAC,AAZD,CAAsC,kCAAmB,GAYxD;AAZY,4CAAgB","sourcesContent":["import { BaseInstrumentation, VERSION } from '@grafana/faro-web-sdk';\n\nimport { setDependencies } from './dependencies';\nimport { initializeReactRouterInstrumentation } from './router';\nimport type { ReactIntegrationConfig } from './types';\n\nexport class ReactIntegration extends BaseInstrumentation {\n name = '@grafana/faro-react';\n version = VERSION;\n\n constructor(private options: ReactIntegrationConfig = {}) {\n super();\n }\n\n initialize(): void {\n setDependencies(this.internalLogger, this.api);\n initializeReactRouterInstrumentation(this.options);\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,sDAAqE;AAErE,+CAAiD;AACjD,mCAAgE;AAGhE;IAAsC,oCAAmB;IAIvD,0BAAoB,OAAoC;QAApC,wBAAA,EAAA,YAAoC;QACtD,YAAA,MAAK,WAAE,SAAC;QADU,aAAO,GAAP,OAAO,CAA6B;QAHxD,UAAI,GAAG,qBAAqB,CAAC;QAC7B,aAAO,GAAG,sBAAO,CAAC;;IAIlB,CAAC;IAED,qCAAU,GAAV;QACE,IAAA,8BAAe,EAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAA,6CAAoC,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IACH,uBAAC;AAAD,CAAC,AAZD,CAAsC,kCAAmB,GAYxD;AAZY,4CAAgB","sourcesContent":["import { BaseInstrumentation, VERSION } from '@grafana/faro-web-sdk';\n\nimport { setDependencies } from './dependencies';\nimport { initializeReactRouterInstrumentation } from './router';\nimport type { ReactIntegrationConfig } from './types';\n\nexport class ReactIntegration extends BaseInstrumentation {\n name = '@grafana/faro-react';\n version = VERSION;\n\n constructor(private options: ReactIntegrationConfig = {}) {\n super();\n }\n\n initialize(): void {\n setDependencies(this.internalLogger, this.api);\n initializeReactRouterInstrumentation(this.options);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/FaroProfiler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAAkC;AAGlC,sDAAgD;AAGhD,gDAAsD;AAQtD;IAAkC,gCAA4B;IAoD5D,sBAAY,KAAwB;QAApC,YACE,kBAAM,KAAK,CAAC,SASb;QA7DS,eAAS,GAAqB,SAAS,CAAC;QACxC,sBAAgB,GAAuB,SAAS,CAAC;QACjD,gBAAU,GAAqB,SAAS,CAAC;QAoDjD,IAAI,KAAI,CAAC,iBAAiB,EAAE;YAC1B,KAAI,CAAC,SAAS,GAAG,KAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;SACpD;aAAM;YACL,6BAAc,aAAd,6BAAc,uBAAd,6BAAc,CAAE,KAAK,CACnB,8HAA8H,CAC/H,CAAC;SACH;;IACH,CAAC;IAzDD,sBAAY,2CAAiB;aAA7B;YACE,OAAO,CAAC,CAAC,CAAA,kBAAG,aAAH,kBAAG,uBAAH,kBAAG,CAAE,iBAAiB,EAAE,CAAA,CAAC;QACpC,CAAC;;;OAAA;IAED,sBAAY,8BAAI;aAAhB;YACE,OAAO,kBAAG,aAAH,kBAAG,uBAAH,kBAAG,CAAE,OAAO,EAAG,CAAC;QACzB,CAAC;;;OAAA;IAED,sBAAY,gCAAM;aAAlB;;YACE,OAAO,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,CAAC,SAAS,CAAC,qBAAqB,E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IAEQ,6BAAM,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IACH,mBAAC;AAAD,CAAC,AA1GD,CAAkC,iBAAS,GA0G1C;AA1GY,oCAAY","sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\nimport { Component } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { VERSION } from '@grafana/faro-web-sdk';\nimport type { OTELApi } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\n\nexport interface FaroProfilerProps {\n children: ReactNode;\n name: string;\n updateProps: Record<string, unknown>;\n}\n\nexport class FaroProfiler extends Component<FaroProfilerProps> {\n protected mountSpan: Span | undefined = undefined;\n protected mountSpanEndTime: number | undefined = undefined;\n protected updateSpan: Span | undefined = undefined;\n\n private get isOtelInitialized(): boolean {\n return !!api?.isOTELInitialized();\n }\n\n private get otel(): OTELApi | undefined {\n return api?.getOTEL()!;\n }\n\n private get tracer(): Tracer {\n return this.otel?.trace.getTracer('@grafana/faro-react', VERSION)!;\n }\n\n private createSpan(\n spanName: string,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n const span = this.tracer.startSpan(spanName, {\n startTime: options?.startTime,\n attributes: {\n 'react.component.name': this.props.name,\n ...(options?.attributes ?? {}),\n },\n });\n\n this.otel?.trace.setSpan(this.otel.context.active(), span);\n\n if (options?.endTime) {\n span.end(options.endTime);\n }\n\n return span;\n }\n\n private createChildSpan(\n spanName: string,\n parent: Span,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n let span: Span;\n\n this.otel?.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {\n span = this.createSpan(spanName, options);\n });\n\n return span!;\n }\n\n constructor(props: FaroProfilerProps) {\n super(props);\n\n if (this.isOtelInitialized) {\n this.mountSpan = this.createSpan('componentMount');\n } else {\n internalLogger?.error(\n 'The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.'\n );\n }\n }\n\n override componentDidMount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.mountSpanEndTime = Date.now();\n this.mountSpan.end(this.mountSpanEndTime);\n }\n }\n\n override shouldComponentUpdate({ updateProps }: FaroProfilerProps): boolean {\n if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {\n const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);\n\n if (changedProps.length > 0) {\n this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {\n attributes: {\n 'react.component.changed_props': changedProps,\n },\n });\n }\n }\n\n return true;\n }\n\n override componentDidUpdate(): void {\n if (this.isOtelInitialized && this.updateSpan) {\n this.updateSpan.end();\n this.updateSpan = undefined;\n }\n }\n\n override componentWillUnmount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.createChildSpan('componentRender', this.mountSpan, {\n startTime: this.mountSpanEndTime,\n endTime: Date.now(),\n });\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\n }\n}\n"]}
1
+ {"version":3,"file":"FaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/FaroProfiler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAAkC;AAGlC,sDAAgD;AAGhD,gDAAsD;AAQtD;IAAkC,gCAA4B;IAoD5D,sBAAY,KAAwB;QAClC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QApDL,eAAS,GAAqB,SAAS,CAAC;QACxC,sBAAgB,GAAuB,SAAS,CAAC;QACjD,gBAAU,GAAqB,SAAS,CAAC;QAoDjD,IAAI,KAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,KAAI,CAAC,SAAS,GAAG,KAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,6BAAc,aAAd,6BAAc,uBAAd,6BAAc,CAAE,KAAK,CACnB,8HAA8H,CAC/H,CAAC;QACJ,CAAC;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CAAC,iBAAiB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC9C,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC9B,CAAC;IACH,CAAC;IAEQ,2CAAoB,GAA7B;QACE,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,EAAE;gBACtD,SAAS,EAAE,IAAI,CAAC,gBAAgB;gBAChC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;aACpB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEQ,6BAAM,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IACH,mBAAC;AAAD,CAAC,AA1GD,CAAkC,iBAAS,GA0G1C;AA1GY,oCAAY","sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\nimport { Component } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { VERSION } from '@grafana/faro-web-sdk';\nimport type { OTELApi } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\n\nexport interface FaroProfilerProps {\n children: ReactNode;\n name: string;\n updateProps: Record<string, unknown>;\n}\n\nexport class FaroProfiler extends Component<FaroProfilerProps> {\n protected mountSpan: Span | undefined = undefined;\n protected mountSpanEndTime: number | undefined = undefined;\n protected updateSpan: Span | undefined = undefined;\n\n private get isOtelInitialized(): boolean {\n return !!api?.isOTELInitialized();\n }\n\n private get otel(): OTELApi | undefined {\n return api?.getOTEL()!;\n }\n\n private get tracer(): Tracer {\n return this.otel?.trace.getTracer('@grafana/faro-react', VERSION)!;\n }\n\n private createSpan(\n spanName: string,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n const span = this.tracer.startSpan(spanName, {\n startTime: options?.startTime,\n attributes: {\n 'react.component.name': this.props.name,\n ...(options?.attributes ?? {}),\n },\n });\n\n this.otel?.trace.setSpan(this.otel.context.active(), span);\n\n if (options?.endTime) {\n span.end(options.endTime);\n }\n\n return span;\n }\n\n private createChildSpan(\n spanName: string,\n parent: Span,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n let span: Span;\n\n this.otel?.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {\n span = this.createSpan(spanName, options);\n });\n\n return span!;\n }\n\n constructor(props: FaroProfilerProps) {\n super(props);\n\n if (this.isOtelInitialized) {\n this.mountSpan = this.createSpan('componentMount');\n } else {\n internalLogger?.error(\n 'The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.'\n );\n }\n }\n\n override componentDidMount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.mountSpanEndTime = Date.now();\n this.mountSpan.end(this.mountSpanEndTime);\n }\n }\n\n override shouldComponentUpdate({ updateProps }: FaroProfilerProps): boolean {\n if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {\n const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);\n\n if (changedProps.length > 0) {\n this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {\n attributes: {\n 'react.component.changed_props': changedProps,\n },\n });\n }\n }\n\n return true;\n }\n\n override componentDidUpdate(): void {\n if (this.isOtelInitialized && this.updateSpan) {\n this.updateSpan.end();\n this.updateSpan = undefined;\n }\n }\n\n override componentWillUnmount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.createChildSpan('componentRender', this.mountSpan, {\n startTime: this.mountSpanEndTime,\n endTime: Date.now(),\n });\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\n }\n}\n"]}
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.withFaroProfiler = void 0;
17
+ exports.withFaroProfiler = withFaroProfiler;
18
18
  var jsx_runtime_1 = require("react/jsx-runtime");
19
19
  var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
20
20
  var faro_core_1 = require("@grafana/faro-core");
@@ -22,10 +22,9 @@ var FaroProfiler_1 = require("./FaroProfiler");
22
22
  function withFaroProfiler(WrappedComponent, options) {
23
23
  var _a, _b, _c;
24
24
  var componentDisplayName = (_c = (_b = (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : WrappedComponent.displayName) !== null && _b !== void 0 ? _b : WrappedComponent.name) !== null && _c !== void 0 ? _c : faro_core_1.unknownString;
25
- var Component = function (props) { return ((0, jsx_runtime_1.jsx)(FaroProfiler_1.FaroProfiler, __assign({ name: componentDisplayName, updateProps: props }, { children: (0, jsx_runtime_1.jsx)(WrappedComponent, __assign({}, props)) }))); };
25
+ var Component = function (props) { return ((0, jsx_runtime_1.jsx)(FaroProfiler_1.FaroProfiler, { name: componentDisplayName, updateProps: props, children: (0, jsx_runtime_1.jsx)(WrappedComponent, __assign({}, props)) })); };
26
26
  Component.displayName = "faroProfiler(".concat(componentDisplayName, ")");
27
27
  (0, hoist_non_react_statics_1.default)(Component, WrappedComponent);
28
28
  return Component;
29
29
  }
30
- exports.withFaroProfiler = withFaroProfiler;
31
30
  //# sourceMappingURL=withFaroProfiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oFAA2D;AAG3D,gDAAmD;AAEnD,+CAA8C;AAG9C,SAAgB,gBAAgB,CAC9B,gBAAkC,EAClC,OAAgD;;IAEhD,IAAM,oBAAoB,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,yBAAa,CAAC;IAErH,IAAM,SAAS,GAAU,UAAC,KAAQ,IAAK,OAAA,CACrC,uBAAC,2BAAY,aAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,gBAC1D,uBAAC,gBAAgB,eAAK,KAAK,EAAI,IAClB,CAChB,EAJsC,CAItC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,uBAAgB,oBAAoB,MAAG,CAAC;IAEhE,IAAA,iCAAoB,EAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC;AAjBD,4CAiBC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-core';\n\nimport { FaroProfiler } from './FaroProfiler';\nimport type { FaroProfilerProps } from './FaroProfiler';\n\nexport function withFaroProfiler<P extends Record<string, any>>(\n WrappedComponent: ComponentType<P>,\n options?: Omit<FaroProfilerProps, 'updateProps'>\n): FC<P> {\n const componentDisplayName = options?.name ?? WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (props: P) => (\n <FaroProfiler name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </FaroProfiler>\n );\n\n Component.displayName = `faroProfiler(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
1
+ {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAQA,4CAiBC;;AAzBD,oFAA2D;AAG3D,gDAAmD;AAEnD,+CAA8C;AAG9C,SAAgB,gBAAgB,CAC9B,gBAAkC,EAClC,OAAgD;;IAEhD,IAAM,oBAAoB,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,yBAAa,CAAC;IAErH,IAAM,SAAS,GAAU,UAAC,KAAQ,IAAK,OAAA,CACrC,uBAAC,2BAAY,IAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,YAC1D,uBAAC,gBAAgB,eAAK,KAAK,EAAI,GAClB,CAChB,EAJsC,CAItC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,uBAAgB,oBAAoB,MAAG,CAAC;IAEhE,IAAA,iCAAoB,EAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-core';\n\nimport { FaroProfiler } from './FaroProfiler';\nimport type { FaroProfilerProps } from './FaroProfiler';\n\nexport function withFaroProfiler<P extends Record<string, any>>(\n WrappedComponent: ComponentType<P>,\n options?: Omit<FaroProfilerProps, 'updateProps'>\n): FC<P> {\n const componentDisplayName = options?.name ?? WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (props: P) => (\n <FaroProfiler name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </FaroProfiler>\n );\n\n Component.displayName = `faroProfiler(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeReactRouterInstrumentation = void 0;
3
+ exports.initializeReactRouterInstrumentation = initializeReactRouterInstrumentation;
4
4
  var dependencies_1 = require("../dependencies");
5
5
  var types_1 = require("./types");
6
6
  var v4v5_1 = require("./v4v5");
@@ -26,5 +26,4 @@ function initializeReactRouterInstrumentation(options) {
26
26
  dependencies_1.internalLogger.debug('Skipping initialization of React Router instrumentation');
27
27
  }
28
28
  }
29
- exports.initializeReactRouterInstrumentation = initializeReactRouterInstrumentation;
30
29
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AAGjD,iCAA6C;AAC7C,+BAAkE;AAClE,2BAAgH;AAEhH,SAAgB,oCAAoC,CAAC,OAA+B;;IAClF,IAAM,WAAW,GAAG,2BAA2B,CAAC;IAEhD,QAAQ,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,EAAE;QAC/B,KAAK,0BAAkB,CAAC,EAAE;YACxB,6BAAc,CAAC,KAAK,CAAC,UAAG,WAAW,wBAAqB,CAAC,CAAC;YAC1D,IAAA,2CAAsC,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM;QAER,KAAK,0BAAkB,CAAC,cAAc;YACpC,6BAAc,CAAC,KAAK,CAAC,UAAG,WAAW,oCAAiC,CAAC,CAAC;YACtE,IAAA,qDAAgD,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YAC9E,MAAM;QAER,KAAK,0BAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,0BAAkB,CAAC,EAAE;YACxB,6BAAc,CAAC,KAAK,CAAC,UAAG,WAAW,cAAI,OAAO,CAAC,MAAM,CAAC,OAAO,qBAAkB,CAAC,CAAC;YACjF,IAAA,+CAAwC,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACtE,MAAM;QAER;YACE,6BAAc,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;KACnF;AACH,CAAC;AAvBD,oFAuBC","sourcesContent":["import { internalLogger } from '../dependencies';\nimport type { ReactIntegrationConfig } from '../types';\n\nimport { ReactRouterVersion } from './types';\nimport { initializeReactRouterV4V5Instrumentation } from './v4v5';\nimport { initializeReactRouterV6DataRouterInstrumentation, initializeReactRouterV6Instrumentation } from './v6';\n\nexport function initializeReactRouterInstrumentation(options: ReactIntegrationConfig): void {\n const initMessage = 'Initializing React Router';\n\n switch (options.router?.version) {\n case ReactRouterVersion.V6:\n internalLogger.debug(`${initMessage} V6 instrumentation`);\n initializeReactRouterV6Instrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V6_data_router:\n internalLogger.debug(`${initMessage} V6 data router instrumentation`);\n initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V5:\n case ReactRouterVersion.V4:\n internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);\n initializeReactRouterV4V5Instrumentation(options.router.dependencies);\n break;\n\n default:\n internalLogger.debug('Skipping initialization of React Router instrumentation');\n }\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":";;AAOA,oFAuBC;AA9BD,gDAAiD;AAGjD,iCAA6C;AAC7C,+BAAkE;AAClE,2BAAgH;AAEhH,SAAgB,oCAAoC,CAAC,OAA+B;;IAClF,IAAM,WAAW,GAAG,2BAA2B,CAAC;IAEhD,QAAQ,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,EAAE,CAAC;QAChC,KAAK,0BAAkB,CAAC,EAAE;YACxB,6BAAc,CAAC,KAAK,CAAC,UAAG,WAAW,wBAAqB,CAAC,CAAC;YAC1D,IAAA,2CAAsC,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM;QAER,KAAK,0BAAkB,CAAC,cAAc;YACpC,6BAAc,CAAC,KAAK,CAAC,UAAG,WAAW,oCAAiC,CAAC,CAAC;YACtE,IAAA,qDAAgD,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YAC9E,MAAM;QAER,KAAK,0BAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,0BAAkB,CAAC,EAAE;YACxB,6BAAc,CAAC,KAAK,CAAC,UAAG,WAAW,cAAI,OAAO,CAAC,MAAM,CAAC,OAAO,qBAAkB,CAAC,CAAC;YACjF,IAAA,+CAAwC,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACtE,MAAM;QAER;YACE,6BAAc,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;IACpF,CAAC;AACH,CAAC","sourcesContent":["import { internalLogger } from '../dependencies';\nimport type { ReactIntegrationConfig } from '../types';\n\nimport { ReactRouterVersion } from './types';\nimport { initializeReactRouterV4V5Instrumentation } from './v4v5';\nimport { initializeReactRouterV6DataRouterInstrumentation, initializeReactRouterV6Instrumentation } from './v6';\n\nexport function initializeReactRouterInstrumentation(options: ReactIntegrationConfig): void {\n const initMessage = 'Initializing React Router';\n\n switch (options.router?.version) {\n case ReactRouterVersion.V6:\n internalLogger.debug(`${initMessage} V6 instrumentation`);\n initializeReactRouterV6Instrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V6_data_router:\n internalLogger.debug(`${initMessage} V6 data router instrumentation`);\n initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V5:\n case ReactRouterVersion.V4:\n internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);\n initializeReactRouterV4V5Instrumentation(options.router.dependencies);\n break;\n\n default:\n internalLogger.debug('Skipping initialization of React Router instrumentation');\n }\n}\n"]}
@@ -7,11 +7,11 @@ var ReactRouterVersion;
7
7
  ReactRouterVersion["V5"] = "v5";
8
8
  ReactRouterVersion["V6"] = "v6";
9
9
  ReactRouterVersion["V6_data_router"] = "v6_data_router";
10
- })(ReactRouterVersion = exports.ReactRouterVersion || (exports.ReactRouterVersion = {}));
10
+ })(ReactRouterVersion || (exports.ReactRouterVersion = ReactRouterVersion = {}));
11
11
  var NavigationType;
12
12
  (function (NavigationType) {
13
13
  NavigationType["Pop"] = "POP";
14
14
  NavigationType["Push"] = "PUSH";
15
15
  NavigationType["Replace"] = "REPLACE";
16
- })(NavigationType = exports.NavigationType || (exports.NavigationType = {}));
16
+ })(NavigationType || (exports.NavigationType = NavigationType = {}));
17
17
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/router/types.ts"],"names":[],"mappings":";;;AAaA,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,+BAAS,CAAA;IACT,+BAAS,CAAA;IACT,+BAAS,CAAA;IACT,uDAAiC,CAAA;AACnC,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;IACb,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB","sourcesContent":["export interface ReactRouterLocation<S extends any = unknown> {\n hash: string;\n key: string;\n pathname: string;\n search: string;\n state: S;\n}\n\nexport interface ReactRouterHistory extends Record<string, any> {\n listen?: (cb: (location: ReactRouterLocation, action: NavigationType) => void) => void;\n location?: ReactRouterLocation;\n}\n\nexport enum ReactRouterVersion {\n V4 = 'v4',\n V5 = 'v5',\n V6 = 'v6',\n V6_data_router = 'v6_data_router',\n}\n\nexport enum NavigationType {\n Pop = 'POP',\n Push = 'PUSH',\n Replace = 'REPLACE',\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/router/types.ts"],"names":[],"mappings":";;;AAaA,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,+BAAS,CAAA;IACT,+BAAS,CAAA;IACT,+BAAS,CAAA;IACT,uDAAiC,CAAA;AACnC,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;IACb,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB","sourcesContent":["export interface ReactRouterLocation<S extends any = unknown> {\n hash: string;\n key: string;\n pathname: string;\n search: string;\n state: S;\n}\n\nexport interface ReactRouterHistory extends Record<string, any> {\n listen?: (cb: (location: ReactRouterLocation, action: NavigationType) => void) => void;\n location?: ReactRouterLocation;\n}\n\nexport enum ReactRouterVersion {\n V4 = 'v4',\n V5 = 'v5',\n V6 = 'v6',\n V6_data_router = 'v6_data_router',\n}\n\nexport enum NavigationType {\n Pop = 'POP',\n Push = 'PUSH',\n Replace = 'REPLACE',\n}\n"]}
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.FaroRoute = void 0;
14
+ exports.FaroRoute = FaroRoute;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var activeEvent_1 = require("./activeEvent");
17
17
  var routerDependencies_1 = require("./routerDependencies");
@@ -22,5 +22,4 @@ function FaroRoute(props) {
22
22
  }
23
23
  return (0, jsx_runtime_1.jsx)(routerDependencies_1.Route, __assign({}, props));
24
24
  }
25
- exports.FaroRoute = FaroRoute;
26
25
  //# sourceMappingURL=FaroRoute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAoD;AACpD,2DAA6C;AAG7C,SAAgB,SAAS,CAAC,KAAgC;;IACxD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EAAE;QACjC,IAAA,iCAAmB,EAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC/C;IAED,OAAO,uBAAC,0BAAK,eAAK,KAAK,EAAI,CAAC;AAC9B,CAAC;AAND,8BAMC","sourcesContent":["import { setActiveEventRoute } from './activeEvent';\nimport { Route } from './routerDependencies';\nimport type { ReactRouterV4V5RouteProps } from './types';\n\nexport function FaroRoute(props: ReactRouterV4V5RouteProps) {\n if (props?.computedMatch?.isExact) {\n setActiveEventRoute(props.computedMatch.path);\n }\n\n return <Route {...props} />;\n}\n"]}
1
+ {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAIA,8BAMC;;AAVD,6CAAoD;AACpD,2DAA6C;AAG7C,SAAgB,SAAS,CAAC,KAAgC;;IACxD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EAAE,CAAC;QAClC,IAAA,iCAAmB,EAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,uBAAC,0BAAK,eAAK,KAAK,EAAI,CAAC;AAC9B,CAAC","sourcesContent":["import { setActiveEventRoute } from './activeEvent';\nimport { Route } from './routerDependencies';\nimport type { ReactRouterV4V5RouteProps } from './types';\n\nexport function FaroRoute(props: ReactRouterV4V5RouteProps) {\n if (props?.computedMatch?.isExact) {\n setActiveEventRoute(props.computedMatch.path);\n }\n\n return <Route {...props} />;\n}\n"]}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendActiveEvent = exports.setActiveEventRoute = exports.createNewActiveEvent = exports.activeEvent = void 0;
3
+ exports.activeEvent = void 0;
4
+ exports.createNewActiveEvent = createNewActiveEvent;
5
+ exports.setActiveEventRoute = setActiveEventRoute;
6
+ exports.sendActiveEvent = sendActiveEvent;
4
7
  var faro_web_sdk_1 = require("@grafana/faro-web-sdk");
5
8
  var dependencies_1 = require("../../dependencies");
6
9
  exports.activeEvent = undefined;
@@ -11,16 +14,13 @@ function createNewActiveEvent(url) {
11
14
  };
12
15
  return exports.activeEvent;
13
16
  }
14
- exports.createNewActiveEvent = createNewActiveEvent;
15
17
  function setActiveEventRoute(route) {
16
18
  if (exports.activeEvent) {
17
19
  exports.activeEvent.route = route;
18
20
  }
19
21
  }
20
- exports.setActiveEventRoute = setActiveEventRoute;
21
22
  function sendActiveEvent() {
22
23
  dependencies_1.api.pushEvent(faro_web_sdk_1.EVENT_ROUTE_CHANGE, exports.activeEvent, undefined, { skipDedupe: true });
23
24
  exports.activeEvent = undefined;
24
25
  }
25
- exports.sendActiveEvent = sendActiveEvent;
26
26
  //# sourceMappingURL=activeEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"activeEvent.js","sourceRoot":"","sources":["../../../../src/router/v4v5/activeEvent.ts"],"names":[],"mappings":";;;AAAA,sDAA2D;AAE3D,mDAAyC;AAI9B,QAAA,WAAW,GAA2C,SAAS,CAAC;AAE3E,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,mBAAW,GAAG;QACZ,KAAK,EAAE,EAAE;QACT,GAAG,KAAA;KACJ,CAAC;IAEF,OAAO,mBAAW,CAAC;AACrB,CAAC;AAPD,oDAOC;AAED,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,IAAI,mBAAW,EAAE;QACf,mBAAW,CAAC,KAAK,GAAG,KAAK,CAAC;KAC3B;AACH,CAAC;AAJD,kDAIC;AAED,SAAgB,eAAe;IAC7B,kBAAG,CAAC,SAAS,CAAC,iCAAkB,EAAE,mBAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhF,mBAAW,GAAG,SAAS,CAAC;AAC1B,CAAC;AAJD,0CAIC","sourcesContent":["import { EVENT_ROUTE_CHANGE } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\n\nimport type { ReactRouterV4V5ActiveEvent } from './types';\n\nexport let activeEvent: ReactRouterV4V5ActiveEvent | undefined = undefined;\n\nexport function createNewActiveEvent(url: string): ReactRouterV4V5ActiveEvent {\n activeEvent = {\n route: '',\n url,\n };\n\n return activeEvent;\n}\n\nexport function setActiveEventRoute(route: string): void {\n if (activeEvent) {\n activeEvent.route = route;\n }\n}\n\nexport function sendActiveEvent(): void {\n api.pushEvent(EVENT_ROUTE_CHANGE, activeEvent, undefined, { skipDedupe: true });\n\n activeEvent = undefined;\n}\n"]}
1
+ {"version":3,"file":"activeEvent.js","sourceRoot":"","sources":["../../../../src/router/v4v5/activeEvent.ts"],"names":[],"mappings":";;;AAQA,oDAOC;AAED,kDAIC;AAED,0CAIC;AA3BD,sDAA2D;AAE3D,mDAAyC;AAI9B,QAAA,WAAW,GAA2C,SAAS,CAAC;AAE3E,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,mBAAW,GAAG;QACZ,KAAK,EAAE,EAAE;QACT,GAAG,KAAA;KACJ,CAAC;IAEF,OAAO,mBAAW,CAAC;AACrB,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,IAAI,mBAAW,EAAE,CAAC;QAChB,mBAAW,CAAC,KAAK,GAAG,KAAK,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,SAAgB,eAAe;IAC7B,kBAAG,CAAC,SAAS,CAAC,iCAAkB,EAAE,mBAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhF,mBAAW,GAAG,SAAS,CAAC;AAC1B,CAAC","sourcesContent":["import { EVENT_ROUTE_CHANGE } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\n\nimport type { ReactRouterV4V5ActiveEvent } from './types';\n\nexport let activeEvent: ReactRouterV4V5ActiveEvent | undefined = undefined;\n\nexport function createNewActiveEvent(url: string): ReactRouterV4V5ActiveEvent {\n activeEvent = {\n route: '',\n url,\n };\n\n return activeEvent;\n}\n\nexport function setActiveEventRoute(route: string): void {\n if (activeEvent) {\n activeEvent.route = route;\n }\n}\n\nexport function sendActiveEvent(): void {\n api.pushEvent(EVENT_ROUTE_CHANGE, activeEvent, undefined, { skipDedupe: true });\n\n activeEvent = undefined;\n}\n"]}
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createReactRouterV5Options = exports.createReactRouterV4Options = exports.initializeReactRouterV4V5Instrumentation = void 0;
6
+ exports.initializeReactRouterV4V5Instrumentation = initializeReactRouterV4V5Instrumentation;
7
+ exports.createReactRouterV4Options = createReactRouterV4Options;
8
+ exports.createReactRouterV5Options = createReactRouterV5Options;
7
9
  var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
8
10
  var faro_web_sdk_1 = require("@grafana/faro-web-sdk");
9
11
  var types_1 = require("../types");
@@ -26,19 +28,16 @@ function initializeReactRouterV4V5Instrumentation(dependencies) {
26
28
  }
27
29
  });
28
30
  }
29
- exports.initializeReactRouterV4V5Instrumentation = initializeReactRouterV4V5Instrumentation;
30
31
  function createReactRouterV4Options(dependencies) {
31
32
  return {
32
33
  version: types_1.ReactRouterVersion.V4,
33
34
  dependencies: dependencies,
34
35
  };
35
36
  }
36
- exports.createReactRouterV4Options = createReactRouterV4Options;
37
37
  function createReactRouterV5Options(dependencies) {
38
38
  return {
39
39
  version: types_1.ReactRouterVersion.V5,
40
40
  dependencies: dependencies,
41
41
  };
42
42
  }
43
- exports.createReactRouterV5Options = createReactRouterV5Options;
44
43
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v4v5/initialize.ts"],"names":[],"mappings":";;;;;;AAAA,oFAA2D;AAG3D,sDAAqD;AAGrD,kCAA8D;AAE9D,6CAAsE;AACtE,yCAAwC;AACxC,2DAAsE;AAGtE,SAAgB,wCAAwC,CAAC,YAAyC;;IAChG,IAAM,KAAK,GAAG,YAAY,CAAC,KAA0B,CAAC;IACtD,IAAM,oBAAoB,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,KAAK,CAAC,IAAI,CAAC;IAC5D,qBAA+B,CAAC,WAAW,GAAG,oBAAa,oBAAoB,MAAG,CAAC;IACpF,IAAA,iCAAoB,EAAC,qBAAS,EAAE,KAAK,CAAC,CAAC;IAEvC,IAAA,mDAA8B,EAAC,YAAY,CAAC,CAAC;IAE7C,IAAA,kCAAoB,EAAC,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;IAElD,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,MAAM,mDAAG,UAAC,SAAS,EAAE,MAAM;;QAC9C,IAAI,MAAM,KAAK,sBAAc,CAAC,IAAI,IAAI,MAAM,KAAK,sBAAc,CAAC,GAAG,EAAE;YACnE,IAAA,6BAAe,GAAE,CAAC;YAElB,IAAA,kCAAoB,EAAC,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;SACnD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,4FAiBC;AAED,SAAgB,0BAA0B,CAAC,YAAyC;IAClF,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,EAAE;QAC9B,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AALD,gEAKC;AAED,SAAgB,0BAA0B,CAAC,YAAyC;IAClF,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,EAAE;QAC9B,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AALD,gEAKC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { FunctionComponent } from 'react';\n\nimport { globalObject } from '@grafana/faro-web-sdk';\n\nimport type { ReactRouterV4V5Config } from '../../types';\nimport { NavigationType, ReactRouterVersion } from '../types';\n\nimport { createNewActiveEvent, sendActiveEvent } from './activeEvent';\nimport { FaroRoute } from './FaroRoute';\nimport { setReactRouterV4V5Dependencies } from './routerDependencies';\nimport type { ReactRouterV4V5Dependencies } from './types';\n\nexport function initializeReactRouterV4V5Instrumentation(dependencies: ReactRouterV4V5Dependencies): void {\n const Route = dependencies.Route as FunctionComponent;\n const componentDisplayName = Route.displayName ?? Route.name;\n (FaroRoute as FunctionComponent).displayName = `faroRoute(${componentDisplayName})`;\n hoistNonReactStatics(FaroRoute, Route);\n\n setReactRouterV4V5Dependencies(dependencies);\n\n createNewActiveEvent(globalObject.location?.href);\n\n dependencies.history.listen?.((_location, action) => {\n if (action === NavigationType.Push || action === NavigationType.Pop) {\n sendActiveEvent();\n\n createNewActiveEvent(globalObject.location?.href);\n }\n });\n}\n\nexport function createReactRouterV4Options(dependencies: ReactRouterV4V5Dependencies): ReactRouterV4V5Config {\n return {\n version: ReactRouterVersion.V4,\n dependencies,\n };\n}\n\nexport function createReactRouterV5Options(dependencies: ReactRouterV4V5Dependencies): ReactRouterV4V5Config {\n return {\n version: ReactRouterVersion.V5,\n dependencies,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v4v5/initialize.ts"],"names":[],"mappings":";;;;;AAaA,4FAiBC;AAED,gEAKC;AAED,gEAKC;AA5CD,oFAA2D;AAG3D,sDAAqD;AAGrD,kCAA8D;AAE9D,6CAAsE;AACtE,yCAAwC;AACxC,2DAAsE;AAGtE,SAAgB,wCAAwC,CAAC,YAAyC;;IAChG,IAAM,KAAK,GAAG,YAAY,CAAC,KAA0B,CAAC;IACtD,IAAM,oBAAoB,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,KAAK,CAAC,IAAI,CAAC;IAC5D,qBAA+B,CAAC,WAAW,GAAG,oBAAa,oBAAoB,MAAG,CAAC;IACpF,IAAA,iCAAoB,EAAC,qBAAS,EAAE,KAAK,CAAC,CAAC;IAEvC,IAAA,mDAA8B,EAAC,YAAY,CAAC,CAAC;IAE7C,IAAA,kCAAoB,EAAC,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;IAElD,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,MAAM,mDAAG,UAAC,SAAS,EAAE,MAAM;;QAC9C,IAAI,MAAM,KAAK,sBAAc,CAAC,IAAI,IAAI,MAAM,KAAK,sBAAc,CAAC,GAAG,EAAE,CAAC;YACpE,IAAA,6BAAe,GAAE,CAAC;YAElB,IAAA,kCAAoB,EAAC,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,0BAA0B,CAAC,YAAyC;IAClF,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,EAAE;QAC9B,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAAC,YAAyC;IAClF,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,EAAE;QAC9B,YAAY,cAAA;KACb,CAAC;AACJ,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { FunctionComponent } from 'react';\n\nimport { globalObject } from '@grafana/faro-web-sdk';\n\nimport type { ReactRouterV4V5Config } from '../../types';\nimport { NavigationType, ReactRouterVersion } from '../types';\n\nimport { createNewActiveEvent, sendActiveEvent } from './activeEvent';\nimport { FaroRoute } from './FaroRoute';\nimport { setReactRouterV4V5Dependencies } from './routerDependencies';\nimport type { ReactRouterV4V5Dependencies } from './types';\n\nexport function initializeReactRouterV4V5Instrumentation(dependencies: ReactRouterV4V5Dependencies): void {\n const Route = dependencies.Route as FunctionComponent;\n const componentDisplayName = Route.displayName ?? Route.name;\n (FaroRoute as FunctionComponent).displayName = `faroRoute(${componentDisplayName})`;\n hoistNonReactStatics(FaroRoute, Route);\n\n setReactRouterV4V5Dependencies(dependencies);\n\n createNewActiveEvent(globalObject.location?.href);\n\n dependencies.history.listen?.((_location, action) => {\n if (action === NavigationType.Push || action === NavigationType.Pop) {\n sendActiveEvent();\n\n createNewActiveEvent(globalObject.location?.href);\n }\n });\n}\n\nexport function createReactRouterV4Options(dependencies: ReactRouterV4V5Dependencies): ReactRouterV4V5Config {\n return {\n version: ReactRouterVersion.V4,\n dependencies,\n };\n}\n\nexport function createReactRouterV5Options(dependencies: ReactRouterV4V5Dependencies): ReactRouterV4V5Config {\n return {\n version: ReactRouterVersion.V5,\n dependencies,\n };\n}\n"]}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setReactRouterV4V5SSRDependencies = exports.setReactRouterV4V5Dependencies = exports.Route = exports.history = exports.isInitialized = void 0;
3
+ exports.Route = exports.history = exports.isInitialized = void 0;
4
+ exports.setReactRouterV4V5Dependencies = setReactRouterV4V5Dependencies;
5
+ exports.setReactRouterV4V5SSRDependencies = setReactRouterV4V5SSRDependencies;
4
6
  exports.isInitialized = false;
5
7
  function setReactRouterV4V5Dependencies(dependencies) {
6
8
  exports.isInitialized = true;
7
9
  exports.history = dependencies.history;
8
10
  exports.Route = dependencies.Route;
9
11
  }
10
- exports.setReactRouterV4V5Dependencies = setReactRouterV4V5Dependencies;
11
12
  function setReactRouterV4V5SSRDependencies(newDependencies) {
12
13
  exports.Route = newDependencies.Route;
13
14
  }
14
- exports.setReactRouterV4V5SSRDependencies = setReactRouterV4V5SSRDependencies;
15
15
  //# sourceMappingURL=routerDependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routerDependencies.js","sourceRoot":"","sources":["../../../../src/router/v4v5/routerDependencies.ts"],"names":[],"mappings":";;;AAIW,QAAA,aAAa,GAAG,KAAK,CAAC;AAIjC,SAAgB,8BAA8B,CAAC,YAAyC;IACtF,qBAAa,GAAG,IAAI,CAAC;IAErB,eAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IAC/B,aAAK,GAAG,YAAY,CAAC,KAAK,CAAC;AAC7B,CAAC;AALD,wEAKC;AAED,SAAgB,iCAAiC,CAAC,eAA2D;IAC3G,aAAK,GAAG,eAAe,CAAC,KAAK,CAAC;AAChC,CAAC;AAFD,8EAEC","sourcesContent":["import type { ReactRouterHistory } from '../types';\n\nimport type { ReactRouterV4V5Dependencies, ReactRouterV4V5RouteShape } from './types';\n\nexport let isInitialized = false;\nexport let history: ReactRouterHistory;\nexport let Route: ReactRouterV4V5RouteShape;\n\nexport function setReactRouterV4V5Dependencies(dependencies: ReactRouterV4V5Dependencies): void {\n isInitialized = true;\n\n history = dependencies.history;\n Route = dependencies.Route;\n}\n\nexport function setReactRouterV4V5SSRDependencies(newDependencies: Pick<ReactRouterV4V5Dependencies, 'Route'>): void {\n Route = newDependencies.Route;\n}\n"]}
1
+ {"version":3,"file":"routerDependencies.js","sourceRoot":"","sources":["../../../../src/router/v4v5/routerDependencies.ts"],"names":[],"mappings":";;;AAQA,wEAKC;AAED,8EAEC;AAbU,QAAA,aAAa,GAAG,KAAK,CAAC;AAIjC,SAAgB,8BAA8B,CAAC,YAAyC;IACtF,qBAAa,GAAG,IAAI,CAAC;IAErB,eAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IAC/B,aAAK,GAAG,YAAY,CAAC,KAAK,CAAC;AAC7B,CAAC;AAED,SAAgB,iCAAiC,CAAC,eAA2D;IAC3G,aAAK,GAAG,eAAe,CAAC,KAAK,CAAC;AAChC,CAAC","sourcesContent":["import type { ReactRouterHistory } from '../types';\n\nimport type { ReactRouterV4V5Dependencies, ReactRouterV4V5RouteShape } from './types';\n\nexport let isInitialized = false;\nexport let history: ReactRouterHistory;\nexport let Route: ReactRouterV4V5RouteShape;\n\nexport function setReactRouterV4V5Dependencies(dependencies: ReactRouterV4V5Dependencies): void {\n isInitialized = true;\n\n history = dependencies.history;\n Route = dependencies.Route;\n}\n\nexport function setReactRouterV4V5SSRDependencies(newDependencies: Pick<ReactRouterV4V5Dependencies, 'Route'>): void {\n Route = newDependencies.Route;\n}\n"]}
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.FaroRoutes = void 0;
14
+ exports.FaroRoutes = FaroRoutes;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var react_1 = require("react");
17
17
  var faro_web_sdk_1 = require("@grafana/faro-web-sdk");
@@ -40,5 +40,4 @@ function FaroRoutes(props) {
40
40
  var ActualRoutes = (_a = props.routesComponent) !== null && _a !== void 0 ? _a : routerDependencies_1.Routes;
41
41
  return (0, jsx_runtime_1.jsx)(ActualRoutes, __assign({}, props));
42
42
  }
43
- exports.FaroRoutes = FaroRoutes;
44
43
  //# sourceMappingURL=FaroRoutes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoutes.js","sourceRoot":"","sources":["../../../../src/router/v6/FaroRoutes.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAmD;AAEnD,sDAAyE;AAEzE,mDAAyC;AACzC,kCAA0C;AAE1C,2DAAuH;AAEvH,iCAA+C;AAE/C,SAAgB,UAAU,CAAC,KAA+B;;IACxD,IAAM,QAAQ,GAAG,gCAAW,aAAX,gCAAW,2BAAX,gCAAW,GAAI,CAAC;IACjC,IAAM,cAAc,GAAG,sCAAiB,aAAjB,sCAAiB,2BAAjB,sCAAiB,GAAI,CAAC;IAE7C,IAAM,MAAM,GAAG,IAAA,eAAO,EAAC,sBAAM,OAAA,MAAA,6CAAwB,aAAxB,6CAAwB,2BAAxB,6CAAwB,EAAG,KAAK,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAA,EAAA,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEjG,IAAM,YAAY,GAAG,IAAA,cAAM,EAAiC,EAAE,CAAC,CAAC;IAEhE,IAAA,iBAAS,EAAC;;QACR,IAAI,kCAAa,IAAI,CAAC,cAAc,KAAK,sBAAc,CAAC,IAAI,IAAI,cAAc,KAAK,sBAAc,CAAC,GAAG,CAAC,EAAE;YACtG,IAAM,KAAK,GAAG,IAAA,4BAAoB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAM,GAAG,GAAG,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC;YAExC,kBAAG,CAAC,SAAS,CAAC,iCAAkB,aAC9B,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,IAC/B,YAAY,CAAC,OAAO,EACvB,CAAC;YAEH,YAAY,CAAC,OAAO,GAAG;gBACrB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,GAAG;aACb,CAAC;SACH;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvC,IAAM,YAAY,GAAG,MAAA,KAAK,CAAC,eAAe,mCAAI,2BAAM,CAAC;IAErD,OAAO,uBAAC,YAAY,eAAK,KAAK,EAAI,CAAC;AACrC,CAAC;AA7BD,gCA6BC","sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\n\nimport { EVENT_ROUTE_CHANGE, globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType } from '../types';\n\nimport { createRoutesFromChildren, isInitialized, Routes, useLocation, useNavigationType } from './routerDependencies';\nimport type { EventRouteTransitionAttributes, ReactRouterV6RoutesProps } from './types';\nimport { getRouteFromLocation } from './utils';\n\nexport function FaroRoutes(props: ReactRouterV6RoutesProps) {\n const location = useLocation?.();\n const navigationType = useNavigationType?.();\n\n const routes = useMemo(() => createRoutesFromChildren?.(props.children) ?? [], [props.children]);\n\n const lastRouteRef = useRef<EventRouteTransitionAttributes>({});\n\n useEffect(() => {\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n const route = getRouteFromLocation(routes, location);\n const url = globalObject.location?.href;\n\n api.pushEvent(EVENT_ROUTE_CHANGE, {\n toRoute: route,\n toUrl: globalObject.location?.href,\n ...lastRouteRef.current,\n });\n\n lastRouteRef.current = {\n fromRoute: route,\n fromUrl: url,\n };\n }\n }, [location, navigationType, routes]);\n\n const ActualRoutes = props.routesComponent ?? Routes;\n\n return <ActualRoutes {...props} />;\n}\n"]}
1
+ {"version":3,"file":"FaroRoutes.js","sourceRoot":"","sources":["../../../../src/router/v6/FaroRoutes.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAWA,gCA6BC;;AAxCD,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AC;IAErD,OAAO,uBAAC,YAAY,eAAK,KAAK,EAAI,CAAC;AACrC,CAAC","sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\n\nimport { EVENT_ROUTE_CHANGE, globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType } from '../types';\n\nimport { createRoutesFromChildren, isInitialized, Routes, useLocation, useNavigationType } from './routerDependencies';\nimport type { EventRouteTransitionAttributes, ReactRouterV6RoutesProps } from './types';\nimport { getRouteFromLocation } from './utils';\n\nexport function FaroRoutes(props: ReactRouterV6RoutesProps) {\n const location = useLocation?.();\n const navigationType = useNavigationType?.();\n\n const routes = useMemo(() => createRoutesFromChildren?.(props.children) ?? [], [props.children]);\n\n const lastRouteRef = useRef<EventRouteTransitionAttributes>({});\n\n useEffect(() => {\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n const route = getRouteFromLocation(routes, location);\n const url = globalObject.location?.href;\n\n api.pushEvent(EVENT_ROUTE_CHANGE, {\n toRoute: route,\n toUrl: globalObject.location?.href,\n ...lastRouteRef.current,\n });\n\n lastRouteRef.current = {\n fromRoute: route,\n fromUrl: url,\n };\n }\n }, [location, navigationType, routes]);\n\n const ActualRoutes = props.routesComponent ?? Routes;\n\n return <ActualRoutes {...props} />;\n}\n"]}
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createReactRouterV6DataOptions = exports.initializeReactRouterV6DataRouterInstrumentation = exports.createReactRouterV6Options = exports.initializeReactRouterV6Instrumentation = void 0;
6
+ exports.initializeReactRouterV6Instrumentation = initializeReactRouterV6Instrumentation;
7
+ exports.createReactRouterV6Options = createReactRouterV6Options;
8
+ exports.initializeReactRouterV6DataRouterInstrumentation = initializeReactRouterV6DataRouterInstrumentation;
9
+ exports.createReactRouterV6DataOptions = createReactRouterV6DataOptions;
7
10
  var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
8
11
  var types_1 = require("../types");
9
12
  var FaroRoutes_1 = require("./FaroRoutes");
@@ -12,23 +15,19 @@ function initializeReactRouterV6Instrumentation(dependencies) {
12
15
  (0, hoist_non_react_statics_1.default)(FaroRoutes_1.FaroRoutes, dependencies.Routes);
13
16
  (0, routerDependencies_1.setReactRouterV6Dependencies)(dependencies);
14
17
  }
15
- exports.initializeReactRouterV6Instrumentation = initializeReactRouterV6Instrumentation;
16
18
  function createReactRouterV6Options(dependencies) {
17
19
  return {
18
20
  version: types_1.ReactRouterVersion.V6,
19
21
  dependencies: dependencies,
20
22
  };
21
23
  }
22
- exports.createReactRouterV6Options = createReactRouterV6Options;
23
24
  function initializeReactRouterV6DataRouterInstrumentation(dependencies) {
24
25
  (0, routerDependencies_1.setReactRouterV6DataRouterDependencies)(dependencies);
25
26
  }
26
- exports.initializeReactRouterV6DataRouterInstrumentation = initializeReactRouterV6DataRouterInstrumentation;
27
27
  function createReactRouterV6DataOptions(dependencies) {
28
28
  return {
29
29
  version: types_1.ReactRouterVersion.V6_data_router,
30
30
  dependencies: dependencies,
31
31
  };
32
32
  }
33
- exports.createReactRouterV6DataOptions = createReactRouterV6DataOptions;
34
33
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v6/initialize.ts"],"names":[],"mappings":";;;;;;AAAA,oFAA2D;AAG3D,kCAA8C;AAE9C,2CAA0C;AAC1C,2DAG8B;AAG9B,SAAgB,sCAAsC,CAAC,YAAuC;IAC5F,IAAA,iCAAoB,EAAC,uBAAU,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACtD,IAAA,iDAA4B,EAAC,YAAY,CAAC,CAAC;AAC7C,CAAC;AAHD,wFAGC;AAED,SAAgB,0BAA0B,CAAC,YAAuC;IAChF,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,EAAE;QAC9B,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AALD,gEAKC;AAED,SAAgB,gDAAgD,CAC9D,YAAiD;IAEjD,IAAA,2DAAsC,EAAC,YAAY,CAAC,CAAC;AACvD,CAAC;AAJD,4GAIC;AAED,SAAgB,8BAA8B,CAC5C,YAAiD;IAEjD,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,cAAc;QAC1C,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AAPD,wEAOC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport type { ReactRouterV6Config, ReactRouterV6DataRouterConfig } from '../../types';\nimport { ReactRouterVersion } from '../types';\n\nimport { FaroRoutes } from './FaroRoutes';\nimport {\n setReactRouterV6DataRouterDependencies as setReactRouterV6DataRouterDependencies,\n setReactRouterV6Dependencies,\n} from './routerDependencies';\nimport type { ReactRouterV6DataRouterDependencies, ReactRouterV6Dependencies } from './types';\n\nexport function initializeReactRouterV6Instrumentation(dependencies: ReactRouterV6Dependencies): void {\n hoistNonReactStatics(FaroRoutes, dependencies.Routes);\n setReactRouterV6Dependencies(dependencies);\n}\n\nexport function createReactRouterV6Options(dependencies: ReactRouterV6Dependencies): ReactRouterV6Config {\n return {\n version: ReactRouterVersion.V6,\n dependencies,\n };\n}\n\nexport function initializeReactRouterV6DataRouterInstrumentation(\n dependencies: ReactRouterV6DataRouterDependencies\n): void {\n setReactRouterV6DataRouterDependencies(dependencies);\n}\n\nexport function createReactRouterV6DataOptions(\n dependencies: ReactRouterV6DataRouterDependencies\n): ReactRouterV6DataRouterConfig {\n return {\n version: ReactRouterVersion.V6_data_router,\n dependencies,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v6/initialize.ts"],"names":[],"mappings":";;;;;AAYA,wFAGC;AAED,gEAKC;AAED,4GAIC;AAED,wEAOC;AArCD,oFAA2D;AAG3D,kCAA8C;AAE9C,2CAA0C;AAC1C,2DAG8B;AAG9B,SAAgB,sCAAsC,CAAC,YAAuC;IAC5F,IAAA,iCAAoB,EAAC,uBAAU,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACtD,IAAA,iDAA4B,EAAC,YAAY,CAAC,CAAC;AAC7C,CAAC;AAED,SAAgB,0BAA0B,CAAC,YAAuC;IAChF,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,EAAE;QAC9B,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AAED,SAAgB,gDAAgD,CAC9D,YAAiD;IAEjD,IAAA,2DAAsC,EAAC,YAAY,CAAC,CAAC;AACvD,CAAC;AAED,SAAgB,8BAA8B,CAC5C,YAAiD;IAEjD,OAAO;QACL,OAAO,EAAE,0BAAkB,CAAC,cAAc;QAC1C,YAAY,cAAA;KACb,CAAC;AACJ,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport type { ReactRouterV6Config, ReactRouterV6DataRouterConfig } from '../../types';\nimport { ReactRouterVersion } from '../types';\n\nimport { FaroRoutes } from './FaroRoutes';\nimport {\n setReactRouterV6DataRouterDependencies as setReactRouterV6DataRouterDependencies,\n setReactRouterV6Dependencies,\n} from './routerDependencies';\nimport type { ReactRouterV6DataRouterDependencies, ReactRouterV6Dependencies } from './types';\n\nexport function initializeReactRouterV6Instrumentation(dependencies: ReactRouterV6Dependencies): void {\n hoistNonReactStatics(FaroRoutes, dependencies.Routes);\n setReactRouterV6Dependencies(dependencies);\n}\n\nexport function createReactRouterV6Options(dependencies: ReactRouterV6Dependencies): ReactRouterV6Config {\n return {\n version: ReactRouterVersion.V6,\n dependencies,\n };\n}\n\nexport function initializeReactRouterV6DataRouterInstrumentation(\n dependencies: ReactRouterV6DataRouterDependencies\n): void {\n setReactRouterV6DataRouterDependencies(dependencies);\n}\n\nexport function createReactRouterV6DataOptions(\n dependencies: ReactRouterV6DataRouterDependencies\n): ReactRouterV6DataRouterConfig {\n return {\n version: ReactRouterVersion.V6_data_router,\n dependencies,\n };\n}\n"]}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setReactRouterV6DataRouterDependencies = exports.setReactRouterV6SSRDependencies = exports.setReactRouterV6Dependencies = exports.useNavigationType = exports.useLocation = exports.Routes = exports.matchRoutes = exports.createRoutesFromChildren = exports.isInitialized = void 0;
3
+ exports.useNavigationType = exports.useLocation = exports.Routes = exports.matchRoutes = exports.createRoutesFromChildren = exports.isInitialized = void 0;
4
+ exports.setReactRouterV6Dependencies = setReactRouterV6Dependencies;
5
+ exports.setReactRouterV6SSRDependencies = setReactRouterV6SSRDependencies;
6
+ exports.setReactRouterV6DataRouterDependencies = setReactRouterV6DataRouterDependencies;
4
7
  exports.isInitialized = false;
5
8
  function setReactRouterV6Dependencies(newDependencies) {
6
9
  exports.isInitialized = true;
@@ -10,14 +13,11 @@ function setReactRouterV6Dependencies(newDependencies) {
10
13
  exports.useLocation = newDependencies.useLocation;
11
14
  exports.useNavigationType = newDependencies.useNavigationType;
12
15
  }
13
- exports.setReactRouterV6Dependencies = setReactRouterV6Dependencies;
14
16
  function setReactRouterV6SSRDependencies(newDependencies) {
15
17
  exports.Routes = newDependencies.Routes;
16
18
  }
17
- exports.setReactRouterV6SSRDependencies = setReactRouterV6SSRDependencies;
18
19
  function setReactRouterV6DataRouterDependencies(newDependencies) {
19
20
  exports.isInitialized = true;
20
21
  exports.matchRoutes = newDependencies.matchRoutes;
21
22
  }
22
- exports.setReactRouterV6DataRouterDependencies = setReactRouterV6DataRouterDependencies;
23
23
  //# sourceMappingURL=routerDependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routerDependencies.js","sourceRoot":"","sources":["../../../../src/router/v6/routerDependencies.ts"],"names":[],"mappings":";;;AAUW,QAAA,aAAa,GAAG,KAAK,CAAC;AAOjC,SAAgB,4BAA4B,CAAC,eAA0C;IACrF,qBAAa,GAAG,IAAI,CAAC;IAErB,gCAAwB,GAAG,eAAe,CAAC,wBAAwB,CAAC;IACpE,mBAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,cAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAChC,mBAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,yBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;AACxD,CAAC;AARD,oEAQC;AAED,SAAgB,+BAA+B,CAAC,eAA0D;IACxG,cAAM,GAAG,eAAe,CAAC,MAAM,CAAC;AAClC,CAAC;AAFD,0EAEC;AAED,SAAgB,sCAAsC,CAAC,eAAoD;IACzG,qBAAa,GAAG,IAAI,CAAC;IACrB,mBAAW,GAAG,eAAe,CAAC,WAAW,CAAC;AAC5C,CAAC;AAHD,wFAGC","sourcesContent":["import type {\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6DataRouterDependencies,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './types';\n\nexport let isInitialized = false;\nexport let createRoutesFromChildren: ReactRouterV6CreateRoutesFromChildren;\nexport let matchRoutes: ReactRouterV6MatchRoutes;\nexport let Routes: ReactRouterV6RoutesShape;\nexport let useLocation: ReactRouterV6UseLocation;\nexport let useNavigationType: ReactRouterV6UseNavigationType;\n\nexport function setReactRouterV6Dependencies(newDependencies: ReactRouterV6Dependencies): void {\n isInitialized = true;\n\n createRoutesFromChildren = newDependencies.createRoutesFromChildren;\n matchRoutes = newDependencies.matchRoutes;\n Routes = newDependencies.Routes;\n useLocation = newDependencies.useLocation;\n useNavigationType = newDependencies.useNavigationType;\n}\n\nexport function setReactRouterV6SSRDependencies(newDependencies: Pick<ReactRouterV6Dependencies, 'Routes'>): void {\n Routes = newDependencies.Routes;\n}\n\nexport function setReactRouterV6DataRouterDependencies(newDependencies: ReactRouterV6DataRouterDependencies): void {\n isInitialized = true;\n matchRoutes = newDependencies.matchRoutes;\n}\n"]}
1
+ {"version":3,"file":"routerDependencies.js","sourceRoot":"","sources":["../../../../src/router/v6/routerDependencies.ts"],"names":[],"mappings":";;;AAiBA,oEAQC;AAED,0EAEC;AAED,wFAGC;AAxBU,QAAA,aAAa,GAAG,KAAK,CAAC;AAOjC,SAAgB,4BAA4B,CAAC,eAA0C;IACrF,qBAAa,GAAG,IAAI,CAAC;IAErB,gCAAwB,GAAG,eAAe,CAAC,wBAAwB,CAAC;IACpE,mBAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,cAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAChC,mBAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,yBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;AACxD,CAAC;AAED,SAAgB,+BAA+B,CAAC,eAA0D;IACxG,cAAM,GAAG,eAAe,CAAC,MAAM,CAAC;AAClC,CAAC;AAED,SAAgB,sCAAsC,CAAC,eAAoD;IACzG,qBAAa,GAAG,IAAI,CAAC;IACrB,mBAAW,GAAG,eAAe,CAAC,WAAW,CAAC;AAC5C,CAAC","sourcesContent":["import type {\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6DataRouterDependencies,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './types';\n\nexport let isInitialized = false;\nexport let createRoutesFromChildren: ReactRouterV6CreateRoutesFromChildren;\nexport let matchRoutes: ReactRouterV6MatchRoutes;\nexport let Routes: ReactRouterV6RoutesShape;\nexport let useLocation: ReactRouterV6UseLocation;\nexport let useNavigationType: ReactRouterV6UseNavigationType;\n\nexport function setReactRouterV6Dependencies(newDependencies: ReactRouterV6Dependencies): void {\n isInitialized = true;\n\n createRoutesFromChildren = newDependencies.createRoutesFromChildren;\n matchRoutes = newDependencies.matchRoutes;\n Routes = newDependencies.Routes;\n useLocation = newDependencies.useLocation;\n useNavigationType = newDependencies.useNavigationType;\n}\n\nexport function setReactRouterV6SSRDependencies(newDependencies: Pick<ReactRouterV6Dependencies, 'Routes'>): void {\n Routes = newDependencies.Routes;\n}\n\nexport function setReactRouterV6DataRouterDependencies(newDependencies: ReactRouterV6DataRouterDependencies): void {\n isInitialized = true;\n matchRoutes = newDependencies.matchRoutes;\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRouteFromLocation = exports.getNumberOfUrlSegments = void 0;
3
+ exports.getNumberOfUrlSegments = getNumberOfUrlSegments;
4
+ exports.getRouteFromLocation = getRouteFromLocation;
4
5
  var routerDependencies_1 = require("./routerDependencies");
5
6
  function getNumberOfUrlSegments(url) {
6
7
  return url.split(/\\?\//).filter(function (currentSegment) { return currentSegment.length > 0 && currentSegment !== ','; }).length;
7
8
  }
8
- exports.getNumberOfUrlSegments = getNumberOfUrlSegments;
9
9
  function getRouteFromLocation(routes, location) {
10
10
  if (!routes || routes.length === 0) {
11
11
  return location.pathname;
@@ -36,5 +36,4 @@ function getRouteFromLocation(routes, location) {
36
36
  }
37
37
  return location.pathname;
38
38
  }
39
- exports.getRouteFromLocation = getRouteFromLocation;
40
39
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/router/v6/utils.ts"],"names":[],"mappings":";;;AAEA,2DAAmD;AAGnD,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,UAAC,cAAc,IAAK,OAAA,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,KAAK,GAAG,EAAnD,CAAmD,CAAC,CAAC,MAAM,CAAC;AACnH,CAAC;AAFD,wDAEC;AAED,SAAgB,oBAAoB,CAAC,MAAkC,EAAE,QAA6B;IACpG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QAClC,OAAO,QAAQ,CAAC,QAAQ,CAAC;KAC1B;IAED,IAAM,aAAa,GAAG,IAAA,gCAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,IAAI,WAAW,GAAG,EAAE,CAAC;IAErB,IAAI,aAAa,EAAE;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,IAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAE,CAAC;YACjC,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAE3B,IAAI,KAAK,EAAE;gBACT,IAAI,KAAK,CAAC,KAAK,EAAE;oBACf,OAAO,MAAM,CAAC,QAAQ,CAAC;iBACxB;gBAED,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;gBAEtB,IAAI,IAAI,EAAE;oBACR,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAI,IAAI,CAAE,CAAC;oBAEhD,WAAW,IAAI,IAAI,CAAC;oBAEpB,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,EAAE;wBACzC,IAAI,sBAAsB,CAAC,WAAW,CAAC,KAAK,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;4BACnF,OAAO,IAAI,CAAC;yBACb;wBAED,OAAO,WAAW,CAAC;qBACpB;iBACF;aACF;SACF;KACF;IAED,OAAO,QAAQ,CAAC,QAAQ,CAAC;AAC3B,CAAC;AAvCD,oDAuCC","sourcesContent":["import type { ReactRouterLocation } from '../types';\n\nimport { matchRoutes } from './routerDependencies';\nimport type { ReactRouterV6RouteObject } from './types';\n\nexport function getNumberOfUrlSegments(url: string): number {\n return url.split(/\\\\?\\//).filter((currentSegment) => currentSegment.length > 0 && currentSegment !== ',').length;\n}\n\nexport function getRouteFromLocation(routes: ReactRouterV6RouteObject[], location: ReactRouterLocation): string {\n if (!routes || routes.length === 0) {\n return location.pathname;\n }\n\n const matchedRoutes = matchRoutes(routes, location);\n\n let pathBuilder = '';\n\n if (matchedRoutes) {\n for (let x = 0; x < matchedRoutes.length; x++) {\n const branch = matchedRoutes[x]!;\n const route = branch.route;\n\n if (route) {\n if (route.index) {\n return branch.pathname;\n }\n\n let path = route.path;\n\n if (path) {\n path = path.startsWith('/') ? path : `/${path}`;\n\n pathBuilder += path;\n\n if (branch.pathname === location.pathname) {\n if (getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname)) {\n return path;\n }\n\n return pathBuilder;\n }\n }\n }\n }\n }\n\n return location.pathname;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/router/v6/utils.ts"],"names":[],"mappings":";;AAKA,wDAEC;AAED,oDAuCC;AA9CD,2DAAmD;AAGnD,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,UAAC,cAAc,IAAK,OAAA,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,KAAK,GAAG,EAAnD,CAAmD,CAAC,CAAC,MAAM,CAAC;AACnH,CAAC;AAED,SAAgB,oBAAoB,CAAC,MAAkC,EAAE,QAA6B;IACpG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAM,aAAa,GAAG,IAAA,gCAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,IAAI,WAAW,GAAG,EAAE,CAAC;IAErB,IAAI,aAAa,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,IAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAE,CAAC;YACjC,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAE3B,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;oBAChB,OAAO,MAAM,CAAC,QAAQ,CAAC;gBACzB,CAAC;gBAED,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;gBAEtB,IAAI,IAAI,EAAE,CAAC;oBACT,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAI,IAAI,CAAE,CAAC;oBAEhD,WAAW,IAAI,IAAI,CAAC;oBAEpB,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,EAAE,CAAC;wBAC1C,IAAI,sBAAsB,CAAC,WAAW,CAAC,KAAK,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;4BACpF,OAAO,IAAI,CAAC;wBACd,CAAC;wBAED,OAAO,WAAW,CAAC;oBACrB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC,QAAQ,CAAC;AAC3B,CAAC","sourcesContent":["import type { ReactRouterLocation } from '../types';\n\nimport { matchRoutes } from './routerDependencies';\nimport type { ReactRouterV6RouteObject } from './types';\n\nexport function getNumberOfUrlSegments(url: string): number {\n return url.split(/\\\\?\\//).filter((currentSegment) => currentSegment.length > 0 && currentSegment !== ',').length;\n}\n\nexport function getRouteFromLocation(routes: ReactRouterV6RouteObject[], location: ReactRouterLocation): string {\n if (!routes || routes.length === 0) {\n return location.pathname;\n }\n\n const matchedRoutes = matchRoutes(routes, location);\n\n let pathBuilder = '';\n\n if (matchedRoutes) {\n for (let x = 0; x < matchedRoutes.length; x++) {\n const branch = matchedRoutes[x]!;\n const route = branch.route;\n\n if (route) {\n if (route.index) {\n return branch.pathname;\n }\n\n let path = route.path;\n\n if (path) {\n path = path.startsWith('/') ? path : `/${path}`;\n\n pathBuilder += path;\n\n if (branch.pathname === location.pathname) {\n if (getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname)) {\n return path;\n }\n\n return pathBuilder;\n }\n }\n }\n }\n }\n\n return location.pathname;\n}\n"]}
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.withFaroRouterInstrumentation = void 0;
14
+ exports.withFaroRouterInstrumentation = withFaroRouterInstrumentation;
15
15
  var faro_web_sdk_1 = require("@grafana/faro-web-sdk");
16
16
  var dependencies_1 = require("../../dependencies");
17
17
  var types_1 = require("../types");
@@ -39,5 +39,4 @@ function withFaroRouterInstrumentation(router) {
39
39
  });
40
40
  return router;
41
41
  }
42
- exports.withFaroRouterInstrumentation = withFaroRouterInstrumentation;
43
42
  //# sourceMappingURL=withFaroRouterInstrumentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroRouterInstrumentation.js","sourceRoot":"","sources":["../../../../src/router/v6/withFaroRouterInstrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAAyE;AAEzE,mDAAyC;AACzC,kCAA+D;AAE/D,2DAAqD;AAErD,iCAA+C;AAa/C;;GAEG;AACH,SAAgB,6BAA6B,CAA4B,MAAS;IAChF,IAAI,SAAS,GAAmC,EAAE,CAAC;IAEnD,MAAM,CAAC,SAAS,CAAC,UAAC,KAAK;;QACrB,IAAM,cAAc,GAAmB,KAAK,CAAC,aAAa,CAAC;QAC3D,IAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAE7B,IAAI,kCAAa,IAAI,CAAC,cAAc,KAAK,sBAAc,CAAC,IAAI,IAAI,cAAc,KAAK,sBAAc,CAAC,GAAG,CAAC,EAAE;YACtG,IAAM,KAAK,GAAG,IAAA,4BAAoB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAM,GAAG,GAAG,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC;YAExC,kBAAG,CAAC,SAAS,CAAC,iCAAkB,aAC9B,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,IAC/B,SAAS,EACZ,CAAC;YAEH,SAAS,GAAG;gBACV,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,GAAG;aACb,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,sEA0BC","sourcesContent":["import { EVENT_ROUTE_CHANGE, globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType, ReactRouterLocation } from '../types';\n\nimport { isInitialized } from './routerDependencies';\nimport type { EventRouteTransitionAttributes, RouteObjectV6DataRouter } from './types';\nimport { getRouteFromLocation } from './utils';\n\ninterface RouterState {\n historyAction: NavigationType | any;\n location: ReactRouterLocation;\n}\n\ninterface Router {\n state: RouterState;\n routes: RouteObjectV6DataRouter[];\n subscribe(fn: (state: RouterState) => void): () => void;\n}\n\n/**\n * To use with React Router 6.4 data APIs.\n */\nexport function withFaroRouterInstrumentation<R extends Router = Router>(router: R) {\n let lastRoute: EventRouteTransitionAttributes = {};\n\n router.subscribe((state) => {\n const navigationType: NavigationType = state.historyAction;\n const location = state.location;\n const routes = router.routes;\n\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n const route = getRouteFromLocation(routes, location);\n const url = globalObject.location?.href;\n\n api.pushEvent(EVENT_ROUTE_CHANGE, {\n toRoute: route,\n toUrl: globalObject.location?.href,\n ...lastRoute,\n });\n\n lastRoute = {\n fromRoute: route,\n fromUrl: url,\n };\n }\n });\n\n return router;\n}\n"]}
1
+ {"version":3,"file":"withFaroRouterInstrumentation.js","sourceRoot":"","sources":["../../../../src/router/v6/withFaroRouterInstrumentation.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAwBA,sEA0BC;AAlDD,sDAAyE;AAEzE,mDAAyC;AACzC,kCAA0C;AAG1C,2DAAqD;AAErD,iCAA+C;AAa/C;;GAEG;AACH,SAAgB,6BAA6B,CAA4B,MAAS;IAChF,IAAI,SAAS,GAAmC,EAAE,CAAC;IAEnD,MAAM,CAAC,SAAS,CAAC,UAAC,KAAK;;QACrB,IAAM,cAAc,GAAmB,KAAK,CAAC,aAAa,CAAC;QAC3D,IAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAE7B,IAAI,kCAAa,IAAI,CAAC,cAAc,KAAK,sBAAc,CAAC,IAAI,IAAI,cAAc,KAAK,sBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACvG,IAAM,KAAK,GAAG,IAAA,4BAAoB,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAM,GAAG,GAAG,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC;YAExC,kBAAG,CAAC,SAAS,CAAC,iCAAkB,aAC9B,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,IAC/B,SAAS,EACZ,CAAC;YAEH,SAAS,GAAG;gBACV,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,GAAG;aACb,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { EVENT_ROUTE_CHANGE, globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType } from '../types';\nimport type { ReactRouterLocation } from '../types';\n\nimport { isInitialized } from './routerDependencies';\nimport type { EventRouteTransitionAttributes, RouteObjectV6DataRouter } from './types';\nimport { getRouteFromLocation } from './utils';\n\ninterface RouterState {\n historyAction: NavigationType | any;\n location: ReactRouterLocation;\n}\n\ninterface Router {\n state: RouterState;\n routes: RouteObjectV6DataRouter[];\n subscribe(fn: (state: RouterState) => void): () => void;\n}\n\n/**\n * To use with React Router 6.4 data APIs.\n */\nexport function withFaroRouterInstrumentation<R extends Router = Router>(router: R) {\n let lastRoute: EventRouteTransitionAttributes = {};\n\n router.subscribe((state) => {\n const navigationType: NavigationType = state.historyAction;\n const location = state.location;\n const routes = router.routes;\n\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n const route = getRouteFromLocation(routes, location);\n const url = globalObject.location?.href;\n\n api.pushEvent(EVENT_ROUTE_CHANGE, {\n toRoute: route,\n toUrl: globalObject.location?.href,\n ...lastRoute,\n });\n\n lastRoute = {\n fromRoute: route,\n fromUrl: url,\n };\n }\n });\n\n return router;\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isReactVersionAtLeast = exports.getMajorReactVersion = exports.isReactVersionAtLeast16 = exports.isReactVersionAtLeast17 = exports.isReactVersionAtLeast18 = exports.reactVersionMajor = exports.reactVersion = void 0;
3
+ exports.isReactVersionAtLeast16 = exports.isReactVersionAtLeast17 = exports.isReactVersionAtLeast18 = exports.reactVersionMajor = exports.reactVersion = void 0;
4
+ exports.getMajorReactVersion = getMajorReactVersion;
5
+ exports.isReactVersionAtLeast = isReactVersionAtLeast;
4
6
  var react_1 = require("react");
5
7
  exports.reactVersion = react_1.version;
6
8
  exports.reactVersionMajor = getMajorReactVersion();
@@ -16,9 +18,7 @@ function getMajorReactVersion() {
16
18
  return null;
17
19
  }
18
20
  }
19
- exports.getMajorReactVersion = getMajorReactVersion;
20
21
  function isReactVersionAtLeast(version) {
21
22
  return exports.reactVersionMajor === null ? false : exports.reactVersionMajor >= version;
22
23
  }
23
- exports.isReactVersionAtLeast = isReactVersionAtLeast;
24
24
  //# sourceMappingURL=reactVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reactVersion.js","sourceRoot":"","sources":["../../../src/utils/reactVersion.ts"],"names":[],"mappings":";;;AAAA,+BAAgC;AAEnB,QAAA,YAAY,GAAG,eAAO,CAAC;AACvB,QAAA,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;AAC3C,QAAA,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AACpD,QAAA,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AACpD,QAAA,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AAEjE,SAAgB,oBAAoB;IAClC,IAAM,KAAK,GAAG,oBAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI;QACF,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;KACjD;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AARD,oDAQC;AAED,SAAgB,qBAAqB,CAAC,OAAe;IACnD,OAAO,yBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAiB,IAAI,OAAO,CAAC;AAC3E,CAAC;AAFD,sDAEC","sourcesContent":["import { version } from 'react';\n\nexport const reactVersion = version;\nexport const reactVersionMajor = getMajorReactVersion();\nexport const isReactVersionAtLeast18 = isReactVersionAtLeast(18);\nexport const isReactVersionAtLeast17 = isReactVersionAtLeast(17);\nexport const isReactVersionAtLeast16 = isReactVersionAtLeast(16);\n\nexport function getMajorReactVersion(): number | null {\n const major = reactVersion.split('.');\n\n try {\n return major[0] ? parseInt(major[0], 10) : null;\n } catch (err) {\n return null;\n }\n}\n\nexport function isReactVersionAtLeast(version: number): boolean {\n return reactVersionMajor === null ? false : reactVersionMajor >= version;\n}\n"]}
1
+ {"version":3,"file":"reactVersion.js","sourceRoot":"","sources":["../../../src/utils/reactVersion.ts"],"names":[],"mappings":";;;AAQA,oDAQC;AAED,sDAEC;AApBD,+BAAgC;AAEnB,QAAA,YAAY,GAAG,eAAO,CAAC;AACvB,QAAA,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;AAC3C,QAAA,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AACpD,QAAA,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AACpD,QAAA,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AAEjE,SAAgB,oBAAoB;IAClC,IAAM,KAAK,GAAG,oBAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,CAAC;QACH,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAgB,qBAAqB,CAAC,OAAe;IACnD,OAAO,yBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAiB,IAAI,OAAO,CAAC;AAC3E,CAAC","sourcesContent":["import { version } from 'react';\n\nexport const reactVersion = version;\nexport const reactVersionMajor = getMajorReactVersion();\nexport const isReactVersionAtLeast18 = isReactVersionAtLeast(18);\nexport const isReactVersionAtLeast17 = isReactVersionAtLeast(17);\nexport const isReactVersionAtLeast16 = isReactVersionAtLeast(16);\n\nexport function getMajorReactVersion(): number | null {\n const major = reactVersion.split('.');\n\n try {\n return major[0] ? parseInt(major[0], 10) : null;\n } catch (err) {\n return null;\n }\n}\n\nexport function isReactVersionAtLeast(version: number): boolean {\n return reactVersionMajor === null ? false : reactVersionMajor >= version;\n}\n"]}
@@ -1 +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AAI,cAAc,CAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,OAAO,CAAC;SAChB;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,CAAC,iBAAiB,EAAE,iDAAiD,CAAC,CAAC;SAC5F;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Component, isValidElement } from 'react';\nimport type { ErrorInfo, ReactNode } from 'react';\n\nimport { isFunction } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\nimport { isReactVersionAtLeast17 } from '../utils';\n\nimport { faroErrorBoundaryInitialState } from './const';\nimport type { FaroErrorBoundaryProps, FaroErrorBoundaryState } from './types';\n\nexport class FaroErrorBoundary extends Component<FaroErrorBoundaryProps, FaroErrorBoundaryState> {\n override state: FaroErrorBoundaryState = faroErrorBoundaryInitialState;\n\n constructor(props: FaroErrorBoundaryProps) {\n super(props);\n\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n }\n\n getErrorWithComponentStack(error: Error, errorInfo: ErrorInfo): Error {\n if (!isReactVersionAtLeast17 || !errorInfo.componentStack) {\n return error;\n }\n\n const newError = new Error(error.message);\n\n newError.name = `React ErrorBoundary ${error.name}`;\n newError.stack = errorInfo.componentStack;\n\n return newError;\n }\n\n static getDerivedStateFromError(error: Error): FaroErrorBoundaryState {\n return {\n hasError: true,\n error,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n const errorWithComponentStack = this.getErrorWithComponentStack(error, errorInfo);\n\n this.props.beforeCapture?.(errorWithComponentStack);\n\n api.pushError(errorWithComponentStack, this.props.pushErrorOptions);\n\n this.props.onError?.(errorWithComponentStack);\n\n this.setState({ hasError: true, error });\n }\n\n override componentDidMount(): void {\n this.props.onMount?.();\n }\n\n override componentWillUnmount(): void {\n this.props.onUnmount?.(this.state.error);\n }\n\n resetErrorBoundary(): void {\n this.props.onReset?.(this.state.error);\n\n this.setState(faroErrorBoundaryInitialState);\n }\n\n override render(): ReactNode {\n if (!this.state.hasError) {\n return isFunction(this.props.children) ? this.props.children() : this.props.children;\n }\n\n const element = !isFunction(this.props.fallback)\n ? this.props.fallback\n : this.props.fallback(this.state.error!, this.resetErrorBoundary);\n\n if (isValidElement(element)) {\n return element;\n }\n\n if (this.props.fallback) {\n internalLogger?.warn('ErrorBoundary\\n', 'Cannot get a valid ReactElement from \"fallback\"');\n }\n\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"FaroErrorBoundary.js","sourceRoot":"","sources":["../../../src/errorBoundary/FaroErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAGxD,MAAM,OAAO,iBAAkB,SAAQ,SAAyD;IAG9F,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHN,UAAK,GAA2B,6BAA6B,CAAC;QAKrE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAED,0BAA0B,CAAC,KAAY,EAAE,SAAoB;QAC3D,IAAI,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE1C,QAAQ,CAAC,IAAI,GAAG,uBAAuB,KAAK,CAAC,IAAI,EAAE,CAAC;QACpD,QAAQ,CAA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AQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QACvF,CAAC;QAED,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC9C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;YACrB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEpE,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,CAAC,iBAAiB,EAAE,iDAAiD,CAAC,CAAC;QAC7F,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Component, isValidElement } from 'react';\nimport type { ErrorInfo, ReactNode } from 'react';\n\nimport { isFunction } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\nimport { isReactVersionAtLeast17 } from '../utils';\n\nimport { faroErrorBoundaryInitialState } from './const';\nimport type { FaroErrorBoundaryProps, FaroErrorBoundaryState } from './types';\n\nexport class FaroErrorBoundary extends Component<FaroErrorBoundaryProps, FaroErrorBoundaryState> {\n override state: FaroErrorBoundaryState = faroErrorBoundaryInitialState;\n\n constructor(props: FaroErrorBoundaryProps) {\n super(props);\n\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n }\n\n getErrorWithComponentStack(error: Error, errorInfo: ErrorInfo): Error {\n if (!isReactVersionAtLeast17 || !errorInfo.componentStack) {\n return error;\n }\n\n const newError = new Error(error.message);\n\n newError.name = `React ErrorBoundary ${error.name}`;\n newError.stack = errorInfo.componentStack;\n\n return newError;\n }\n\n static getDerivedStateFromError(error: Error): FaroErrorBoundaryState {\n return {\n hasError: true,\n error,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n const errorWithComponentStack = this.getErrorWithComponentStack(error, errorInfo);\n\n this.props.beforeCapture?.(errorWithComponentStack);\n\n api.pushError(errorWithComponentStack, this.props.pushErrorOptions);\n\n this.props.onError?.(errorWithComponentStack);\n\n this.setState({ hasError: true, error });\n }\n\n override componentDidMount(): void {\n this.props.onMount?.();\n }\n\n override componentWillUnmount(): void {\n this.props.onUnmount?.(this.state.error);\n }\n\n resetErrorBoundary(): void {\n this.props.onReset?.(this.state.error);\n\n this.setState(faroErrorBoundaryInitialState);\n }\n\n override render(): ReactNode {\n if (!this.state.hasError) {\n return isFunction(this.props.children) ? this.props.children() : this.props.children;\n }\n\n const element = !isFunction(this.props.fallback)\n ? this.props.fallback\n : this.props.fallback(this.state.error!, this.resetErrorBoundary);\n\n if (isValidElement(element)) {\n return element;\n }\n\n if (this.props.fallback) {\n internalLogger?.warn('ErrorBoundary\\n', 'Cannot get a valid ReactElement from \"fallback\"');\n }\n\n return null;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/FaroProfiler.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAQtD,MAAM,OAAO,YAAa,SAAQ,SAA4B;IAK5D,IAAY,iBAAiB;QAC3B,OAAO,CAAC,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,iBAAiB,EAAE,CAAA,CAAC;IACpC,CAAC;IAED,IAAY,IAAI;QACd,OAAO,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,EAAG,CAAC;IACzB,CAAC;IAED,IAAY,MAAM;;QAChB,OA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,UAAU,CAAC,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;SAC7B;IACH,CAAC;IAEQ,oBAAoB;QAC3B,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,EAAE;YAC5C,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,EAAE;gBACtD,SAAS,EAAE,IAAI,CAAC,gBAAgB;gBAChC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;aACpB,CAAC,CAAC;SACJ;IACH,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\nimport { Component } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { VERSION } from '@grafana/faro-web-sdk';\nimport type { OTELApi } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\n\nexport interface FaroProfilerProps {\n children: ReactNode;\n name: string;\n updateProps: Record<string, unknown>;\n}\n\nexport class FaroProfiler extends Component<FaroProfilerProps> {\n protected mountSpan: Span | undefined = undefined;\n protected mountSpanEndTime: number | undefined = undefined;\n protected updateSpan: Span | undefined = undefined;\n\n private get isOtelInitialized(): boolean {\n return !!api?.isOTELInitialized();\n }\n\n private get otel(): OTELApi | undefined {\n return api?.getOTEL()!;\n }\n\n private get tracer(): Tracer {\n return this.otel?.trace.getTracer('@grafana/faro-react', VERSION)!;\n }\n\n private createSpan(\n spanName: string,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n const span = this.tracer.startSpan(spanName, {\n startTime: options?.startTime,\n attributes: {\n 'react.component.name': this.props.name,\n ...(options?.attributes ?? {}),\n },\n });\n\n this.otel?.trace.setSpan(this.otel.context.active(), span);\n\n if (options?.endTime) {\n span.end(options.endTime);\n }\n\n return span;\n }\n\n private createChildSpan(\n spanName: string,\n parent: Span,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n let span: Span;\n\n this.otel?.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {\n span = this.createSpan(spanName, options);\n });\n\n return span!;\n }\n\n constructor(props: FaroProfilerProps) {\n super(props);\n\n if (this.isOtelInitialized) {\n this.mountSpan = this.createSpan('componentMount');\n } else {\n internalLogger?.error(\n 'The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.'\n );\n }\n }\n\n override componentDidMount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.mountSpanEndTime = Date.now();\n this.mountSpan.end(this.mountSpanEndTime);\n }\n }\n\n override shouldComponentUpdate({ updateProps }: FaroProfilerProps): boolean {\n if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {\n const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);\n\n if (changedProps.length > 0) {\n this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {\n attributes: {\n 'react.component.changed_props': changedProps,\n },\n });\n }\n }\n\n return true;\n }\n\n override componentDidUpdate(): void {\n if (this.isOtelInitialized && this.updateSpan) {\n this.updateSpan.end();\n this.updateSpan = undefined;\n }\n }\n\n override componentWillUnmount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.createChildSpan('componentRender', this.mountSpan, {\n startTime: this.mountSpanEndTime,\n endTime: Date.now(),\n });\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\n }\n}\n"]}
1
+ {"version":3,"file":"FaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/FaroProfiler.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAQtD,MAAM,OAAO,YAAa,SAAQ,SAA4B;IAK5D,IAAY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IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,EAAE;oBACxE,UAAU,EAAE;wBACV,+BAA+B,EAAE,YAAY;qBAC9C;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEQ,kBAAkB;QACzB,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC9C,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC9B,CAAC;IACH,CAAC;IAEQ,oBAAoB;QAC3B,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAC7C,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,EAAE;gBACtD,SAAS,EAAE,IAAI,CAAC,gBAAgB;gBAChC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;aACpB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\nimport { Component } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { VERSION } from '@grafana/faro-web-sdk';\nimport type { OTELApi } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\n\nexport interface FaroProfilerProps {\n children: ReactNode;\n name: string;\n updateProps: Record<string, unknown>;\n}\n\nexport class FaroProfiler extends Component<FaroProfilerProps> {\n protected mountSpan: Span | undefined = undefined;\n protected mountSpanEndTime: number | undefined = undefined;\n protected updateSpan: Span | undefined = undefined;\n\n private get isOtelInitialized(): boolean {\n return !!api?.isOTELInitialized();\n }\n\n private get otel(): OTELApi | undefined {\n return api?.getOTEL()!;\n }\n\n private get tracer(): Tracer {\n return this.otel?.trace.getTracer('@grafana/faro-react', VERSION)!;\n }\n\n private createSpan(\n spanName: string,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n const span = this.tracer.startSpan(spanName, {\n startTime: options?.startTime,\n attributes: {\n 'react.component.name': this.props.name,\n ...(options?.attributes ?? {}),\n },\n });\n\n this.otel?.trace.setSpan(this.otel.context.active(), span);\n\n if (options?.endTime) {\n span.end(options.endTime);\n }\n\n return span;\n }\n\n private createChildSpan(\n spanName: string,\n parent: Span,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n let span: Span;\n\n this.otel?.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {\n span = this.createSpan(spanName, options);\n });\n\n return span!;\n }\n\n constructor(props: FaroProfilerProps) {\n super(props);\n\n if (this.isOtelInitialized) {\n this.mountSpan = this.createSpan('componentMount');\n } else {\n internalLogger?.error(\n 'The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.'\n );\n }\n }\n\n override componentDidMount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.mountSpanEndTime = Date.now();\n this.mountSpan.end(this.mountSpanEndTime);\n }\n }\n\n override shouldComponentUpdate({ updateProps }: FaroProfilerProps): boolean {\n if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {\n const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);\n\n if (changedProps.length > 0) {\n this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {\n attributes: {\n 'react.component.changed_props': changedProps,\n },\n });\n }\n }\n\n return true;\n }\n\n override componentDidUpdate(): void {\n if (this.isOtelInitialized && this.updateSpan) {\n this.updateSpan.end();\n this.updateSpan = undefined;\n }\n }\n\n override componentWillUnmount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.createChildSpan('componentRender', this.mountSpan, {\n startTime: this.mountSpanEndTime,\n endTime: Date.now(),\n });\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\n }\n}\n"]}
@@ -5,7 +5,7 @@ import { FaroProfiler } from './FaroProfiler';
5
5
  export function withFaroProfiler(WrappedComponent, options) {
6
6
  var _a, _b, _c;
7
7
  const componentDisplayName = (_c = (_b = (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : WrappedComponent.displayName) !== null && _b !== void 0 ? _b : WrappedComponent.name) !== null && _c !== void 0 ? _c : unknownString;
8
- const Component = (props) => (_jsx(FaroProfiler, Object.assign({ name: componentDisplayName, updateProps: props }, { children: _jsx(WrappedComponent, Object.assign({}, props)) })));
8
+ const Component = (props) => (_jsx(FaroProfiler, { name: componentDisplayName, updateProps: props, children: _jsx(WrappedComponent, Object.assign({}, props)) }));
9
9
  Component.displayName = `faroProfiler(${componentDisplayName})`;
10
10
  hoistNonReactStatics(Component, WrappedComponent);
11
11
  return Component;
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,UAAU,gBAAgB,CAC9B,gBAAkC,EAClC,OAAgD;;IAEhD,MAAM,oBAAoB,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,aAAa,CAAC;IAErH,MAAM,SAAS,GAAU,CAAC,KAAQ,EAAE,EAAE,CAAC,CACrC,KAAC,YAAY,kBAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,gBAC1D,KAAC,gBAAgB,oBAAK,KAAK,EAAI,IAClB,CAChB,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,gBAAgB,oBAAoB,GAAG,CAAC;IAEhE,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-core';\n\nimport { FaroProfiler } from './FaroProfiler';\nimport type { FaroProfilerProps } from './FaroProfiler';\n\nexport function withFaroProfiler<P extends Record<string, any>>(\n WrappedComponent: ComponentType<P>,\n options?: Omit<FaroProfilerProps, 'updateProps'>\n): FC<P> {\n const componentDisplayName = options?.name ?? WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (props: P) => (\n <FaroProfiler name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </FaroProfiler>\n );\n\n Component.displayName = `faroProfiler(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
1
+ {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,UAAU,gBAAgB,CAC9B,gBAAkC,EAClC,OAAgD;;IAEhD,MAAM,oBAAoB,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,aAAa,CAAC;IAErH,MAAM,SAAS,GAAU,CAAC,KAAQ,EAAE,EAAE,CAAC,CACrC,KAAC,YAAY,IAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,YAC1D,KAAC,gBAAgB,oBAAK,KAAK,EAAI,GAClB,CAChB,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,gBAAgB,oBAAoB,GAAG,CAAC;IAEhE,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-core';\n\nimport { FaroProfiler } from './FaroProfiler';\nimport type { FaroProfilerProps } from './FaroProfiler';\n\nexport function withFaroProfiler<P extends Record<string, any>>(\n WrappedComponent: ComponentType<P>,\n options?: Omit<FaroProfilerProps, 'updateProps'>\n): FC<P> {\n const componentDisplayName = options?.name ?? WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (props: P) => (\n <FaroProfiler name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </FaroProfiler>\n );\n\n Component.displayName = `faroProfiler(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,wCAAwC,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,gDAAgD,EAAE,sCAAsC,EAAE,MAAM,MAAM,CAAC;AAEhH,MAAM,UAAU,oCAAoC,CAAC,OAA+B;;IAClF,MAAM,WAAW,GAAG,2BAA2B,CAAC;IAEhD,QAAQ,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,EAAE;QAC/B,KAAK,kBAAkB,CAAC,EAAE;YACxB,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,qBAAqB,CAAC,CAAC;YAC1D,sCAAsC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM;QAER,KAAK,kBAAkB,CAAC,cAAc;YACpC,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,iCAAiC,CAAC,CAAC;YACtE,gDAAgD,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YAC9E,MAAM;QAER,KAAK,kBAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,kBAAkB,CAAC,EAAE;YACxB,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;YACjF,wCAAwC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACtE,MAAM;QAER;YACE,cAAc,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;KACnF;AACH,CAAC","sourcesContent":["import { internalLogger } from '../dependencies';\nimport type { ReactIntegrationConfig } from '../types';\n\nimport { ReactRouterVersion } from './types';\nimport { initializeReactRouterV4V5Instrumentation } from './v4v5';\nimport { initializeReactRouterV6DataRouterInstrumentation, initializeReactRouterV6Instrumentation } from './v6';\n\nexport function initializeReactRouterInstrumentation(options: ReactIntegrationConfig): void {\n const initMessage = 'Initializing React Router';\n\n switch (options.router?.version) {\n case ReactRouterVersion.V6:\n internalLogger.debug(`${initMessage} V6 instrumentation`);\n initializeReactRouterV6Instrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V6_data_router:\n internalLogger.debug(`${initMessage} V6 data router instrumentation`);\n initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V5:\n case ReactRouterVersion.V4:\n internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);\n initializeReactRouterV4V5Instrumentation(options.router.dependencies);\n break;\n\n default:\n internalLogger.debug('Skipping initialization of React Router instrumentation');\n }\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,wCAAwC,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,gDAAgD,EAAE,sCAAsC,EAAE,MAAM,MAAM,CAAC;AAEhH,MAAM,UAAU,oCAAoC,CAAC,OAA+B;;IAClF,MAAM,WAAW,GAAG,2BAA2B,CAAC;IAEhD,QAAQ,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,EAAE,CAAC;QAChC,KAAK,kBAAkB,CAAC,EAAE;YACxB,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,qBAAqB,CAAC,CAAC;YAC1D,sCAAsC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM;QAER,KAAK,kBAAkB,CAAC,cAAc;YACpC,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,iCAAiC,CAAC,CAAC;YACtE,gDAAgD,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YAC9E,MAAM;QAER,KAAK,kBAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,kBAAkB,CAAC,EAAE;YACxB,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;YACjF,wCAAwC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACtE,MAAM;QAER;YACE,cAAc,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;IACpF,CAAC;AACH,CAAC","sourcesContent":["import { internalLogger } from '../dependencies';\nimport type { ReactIntegrationConfig } from '../types';\n\nimport { ReactRouterVersion } from './types';\nimport { initializeReactRouterV4V5Instrumentation } from './v4v5';\nimport { initializeReactRouterV6DataRouterInstrumentation, initializeReactRouterV6Instrumentation } from './v6';\n\nexport function initializeReactRouterInstrumentation(options: ReactIntegrationConfig): void {\n const initMessage = 'Initializing React Router';\n\n switch (options.router?.version) {\n case ReactRouterVersion.V6:\n internalLogger.debug(`${initMessage} V6 instrumentation`);\n initializeReactRouterV6Instrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V6_data_router:\n internalLogger.debug(`${initMessage} V6 data router instrumentation`);\n initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V5:\n case ReactRouterVersion.V4:\n internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);\n initializeReactRouterV4V5Instrumentation(options.router.dependencies);\n break;\n\n default:\n internalLogger.debug('Skipping initialization of React Router instrumentation');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,MAAM,UAAU,SAAS,CAAC,KAAgC;;IACxD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EAAE;QACjC,mBAAmB,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC/C;IAED,OAAO,KAAC,KAAK,oBAAK,KAAK,EAAI,CAAC;AAC9B,CAAC","sourcesContent":["import { setActiveEventRoute } from './activeEvent';\nimport { Route } from './routerDependencies';\nimport type { ReactRouterV4V5RouteProps } from './types';\n\nexport function FaroRoute(props: ReactRouterV4V5RouteProps) {\n if (props?.computedMatch?.isExact) {\n setActiveEventRoute(props.computedMatch.path);\n }\n\n return <Route {...props} />;\n}\n"]}
1
+ {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,MAAM,UAAU,SAAS,CAAC,KAAgC;;IACxD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EAAE,CAAC;QAClC,mBAAmB,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,KAAC,KAAK,oBAAK,KAAK,EAAI,CAAC;AAC9B,CAAC","sourcesContent":["import { setActiveEventRoute } from './activeEvent';\nimport { Route } from './routerDependencies';\nimport type { ReactRouterV4V5RouteProps } from './types';\n\nexport function FaroRoute(props: ReactRouterV4V5RouteProps) {\n if (props?.computedMatch?.isExact) {\n setActiveEventRoute(props.computedMatch.path);\n }\n\n return <Route {...props} />;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"activeEvent.js","sourceRoot":"","sources":["../../../../src/router/v4v5/activeEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAIzC,MAAM,CAAC,IAAI,WAAW,GAA2C,SAAS,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,WAAW,GAAG;QACZ,KAAK,EAAE,EAAE;QACT,GAAG;KACJ,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,IAAI,WAAW,EAAE;QACf,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;KAC3B;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhF,WAAW,GAAG,SAAS,CAAC;AAC1B,CAAC","sourcesContent":["import { EVENT_ROUTE_CHANGE } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\n\nimport type { ReactRouterV4V5ActiveEvent } from './types';\n\nexport let activeEvent: ReactRouterV4V5ActiveEvent | undefined = undefined;\n\nexport function createNewActiveEvent(url: string): ReactRouterV4V5ActiveEvent {\n activeEvent = {\n route: '',\n url,\n };\n\n return activeEvent;\n}\n\nexport function setActiveEventRoute(route: string): void {\n if (activeEvent) {\n activeEvent.route = route;\n }\n}\n\nexport function sendActiveEvent(): void {\n api.pushEvent(EVENT_ROUTE_CHANGE, activeEvent, undefined, { skipDedupe: true });\n\n activeEvent = undefined;\n}\n"]}
1
+ {"version":3,"file":"activeEvent.js","sourceRoot":"","sources":["../../../../src/router/v4v5/activeEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAIzC,MAAM,CAAC,IAAI,WAAW,GAA2C,SAAS,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,WAAW,GAAG;QACZ,KAAK,EAAE,EAAE;QACT,GAAG;KACJ,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,IAAI,WAAW,EAAE,CAAC;QAChB,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhF,WAAW,GAAG,SAAS,CAAC;AAC1B,CAAC","sourcesContent":["import { EVENT_ROUTE_CHANGE } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\n\nimport type { ReactRouterV4V5ActiveEvent } from './types';\n\nexport let activeEvent: ReactRouterV4V5ActiveEvent | undefined = undefined;\n\nexport function createNewActiveEvent(url: string): ReactRouterV4V5ActiveEvent {\n activeEvent = {\n route: '',\n url,\n };\n\n return activeEvent;\n}\n\nexport function setActiveEventRoute(route: string): void {\n if (activeEvent) {\n activeEvent.route = route;\n }\n}\n\nexport function sendActiveEvent(): void {\n api.pushEvent(EVENT_ROUTE_CHANGE, activeEvent, undefined, { skipDedupe: true });\n\n activeEvent = undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v4v5/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAGtE,MAAM,UAAU,wCAAwC,CAAC,YAAyC;;IAChG,MAAM,KAAK,GAAG,YAAY,CAAC,KAA0B,CAAC;IACtD,MAAM,oBAAoB,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,KAAK,CAAC,IAAI,CAAC;IAC5D,SAA+B,CAAC,WAAW,GAAG,aAAa,oBAAoB,GAAG,CAAC;IACpF,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEvC,8BAA8B,CAAC,YAAY,CAAC,CAAC;IAE7C,oBAAoB,CAAC,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;IAElD,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,MAAM,mDAAG,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;;QAClD,IAAI,MAAM,KAAK,cAAc,CAAC,IAAI,IAAI,MAAM,KAAK,cAAc,CAAC,GAAG,EAAE;YACnE,eAAe,EAAE,CAAC;YAElB,oBAAoB,CAAC,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;SACnD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,YAAyC;IAClF,OAAO;QACL,OAAO,EAAE,kBAAkB,CAAC,EAAE;QAC9B,YAAY;KACb,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,YAAyC;IAClF,OAAO;QACL,OAAO,EAAE,kBAAkB,CAAC,EAAE;QAC9B,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { FunctionComponent } from 'react';\n\nimport { globalObject } from '@grafana/faro-web-sdk';\n\nimport type { ReactRouterV4V5Config } from '../../types';\nimport { NavigationType, ReactRouterVersion } from '../types';\n\nimport { createNewActiveEvent, sendActiveEvent } from './activeEvent';\nimport { FaroRoute } from './FaroRoute';\nimport { setReactRouterV4V5Dependencies } from './routerDependencies';\nimport type { ReactRouterV4V5Dependencies } from './types';\n\nexport function initializeReactRouterV4V5Instrumentation(dependencies: ReactRouterV4V5Dependencies): void {\n const Route = dependencies.Route as FunctionComponent;\n const componentDisplayName = Route.displayName ?? Route.name;\n (FaroRoute as FunctionComponent).displayName = `faroRoute(${componentDisplayName})`;\n hoistNonReactStatics(FaroRoute, Route);\n\n setReactRouterV4V5Dependencies(dependencies);\n\n createNewActiveEvent(globalObject.location?.href);\n\n dependencies.history.listen?.((_location, action) => {\n if (action === NavigationType.Push || action === NavigationType.Pop) {\n sendActiveEvent();\n\n createNewActiveEvent(globalObject.location?.href);\n }\n });\n}\n\nexport function createReactRouterV4Options(dependencies: ReactRouterV4V5Dependencies): ReactRouterV4V5Config {\n return {\n version: ReactRouterVersion.V4,\n dependencies,\n };\n}\n\nexport function createReactRouterV5Options(dependencies: ReactRouterV4V5Dependencies): ReactRouterV4V5Config {\n return {\n version: ReactRouterVersion.V5,\n dependencies,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v4v5/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAGtE,MAAM,UAAU,wCAAwC,CAAC,YAAyC;;IAChG,MAAM,KAAK,GAAG,YAAY,CAAC,KAA0B,CAAC;IACtD,MAAM,oBAAoB,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,KAAK,CAAC,IAAI,CAAC;IAC5D,SAA+B,CAAC,WAAW,GAAG,aAAa,oBAAoB,GAAG,CAAC;IACpF,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEvC,8BAA8B,CAAC,YAAY,CAAC,CAAC;IAE7C,oBAAoB,CAAC,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;IAElD,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,MAAM,mDAAG,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;;QAClD,IAAI,MAAM,KAAK,cAAc,CAAC,IAAI,IAAI,MAAM,KAAK,cAAc,CAAC,GAAG,EAAE,CAAC;YACpE,eAAe,EAAE,CAAC;YAElB,oBAAoB,CAAC,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,YAAyC;IAClF,OAAO;QACL,OAAO,EAAE,kBAAkB,CAAC,EAAE;QAC9B,YAAY;KACb,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,YAAyC;IAClF,OAAO;QACL,OAAO,EAAE,kBAAkB,CAAC,EAAE;QAC9B,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { FunctionComponent } from 'react';\n\nimport { globalObject } from '@grafana/faro-web-sdk';\n\nimport type { ReactRouterV4V5Config } from '../../types';\nimport { NavigationType, ReactRouterVersion } from '../types';\n\nimport { createNewActiveEvent, sendActiveEvent } from './activeEvent';\nimport { FaroRoute } from './FaroRoute';\nimport { setReactRouterV4V5Dependencies } from './routerDependencies';\nimport type { ReactRouterV4V5Dependencies } from './types';\n\nexport function initializeReactRouterV4V5Instrumentation(dependencies: ReactRouterV4V5Dependencies): void {\n const Route = dependencies.Route as FunctionComponent;\n const componentDisplayName = Route.displayName ?? Route.name;\n (FaroRoute as FunctionComponent).displayName = `faroRoute(${componentDisplayName})`;\n hoistNonReactStatics(FaroRoute, Route);\n\n setReactRouterV4V5Dependencies(dependencies);\n\n createNewActiveEvent(globalObject.location?.href);\n\n dependencies.history.listen?.((_location, action) => {\n if (action === NavigationType.Push || action === NavigationType.Pop) {\n sendActiveEvent();\n\n createNewActiveEvent(globalObject.location?.href);\n }\n });\n}\n\nexport function createReactRouterV4Options(dependencies: ReactRouterV4V5Dependencies): ReactRouterV4V5Config {\n return {\n version: ReactRouterVersion.V4,\n dependencies,\n };\n}\n\nexport function createReactRouterV5Options(dependencies: ReactRouterV4V5Dependencies): ReactRouterV4V5Config {\n return {\n version: ReactRouterVersion.V5,\n dependencies,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoutes.js","sourceRoot":"","sources":["../../../../src/router/v6/FaroRoutes.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;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OAAO,GAAG;gBACrB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,GAAG;aACb,CAAC;SACH;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,eAAe,mCAAI,MAAM,CAAC;IAErD,OAAO,KAAC,YAAY,oBAAK,KAAK,EAAI,CAAC;AACrC,CAAC","sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\n\nimport { EVENT_ROUTE_CHANGE, globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType } from '../types';\n\nimport { createRoutesFromChildren, isInitialized, Routes, useLocation, useNavigationType } from './routerDependencies';\nimport type { EventRouteTransitionAttributes, ReactRouterV6RoutesProps } from './types';\nimport { getRouteFromLocation } from './utils';\n\nexport function FaroRoutes(props: ReactRouterV6RoutesProps) {\n const location = useLocation?.();\n const navigationType = useNavigationType?.();\n\n const routes = useMemo(() => createRoutesFromChildren?.(props.children) ?? [], [props.children]);\n\n const lastRouteRef = useRef<EventRouteTransitionAttributes>({});\n\n useEffect(() => {\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n const route = getRouteFromLocation(routes, location);\n const url = globalObject.location?.href;\n\n api.pushEvent(EVENT_ROUTE_CHANGE, {\n toRoute: route,\n toUrl: globalObject.location?.href,\n ...lastRouteRef.current,\n });\n\n lastRouteRef.current = {\n fromRoute: route,\n fromUrl: url,\n };\n }\n }, [location, navigationType, routes]);\n\n const ActualRoutes = props.routesComponent ?? Routes;\n\n return <ActualRoutes {...props} />;\n}\n"]}
1
+ {"version":3,"file":"FaroRoutes.js","sourceRoot":"","sources":["../../../../src/router/v6/FaroRoutes.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,YAA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KAAK;gBAChB,OAAO,EAAE,GAAG;aACb,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,eAAe,mCAAI,MAAM,CAAC;IAErD,OAAO,KAAC,YAAY,oBAAK,KAAK,EAAI,CAAC;AACrC,CAAC","sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\n\nimport { EVENT_ROUTE_CHANGE, globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType } from '../types';\n\nimport { createRoutesFromChildren, isInitialized, Routes, useLocation, useNavigationType } from './routerDependencies';\nimport type { EventRouteTransitionAttributes, ReactRouterV6RoutesProps } from './types';\nimport { getRouteFromLocation } from './utils';\n\nexport function FaroRoutes(props: ReactRouterV6RoutesProps) {\n const location = useLocation?.();\n const navigationType = useNavigationType?.();\n\n const routes = useMemo(() => createRoutesFromChildren?.(props.children) ?? [], [props.children]);\n\n const lastRouteRef = useRef<EventRouteTransitionAttributes>({});\n\n useEffect(() => {\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n const route = getRouteFromLocation(routes, location);\n const url = globalObject.location?.href;\n\n api.pushEvent(EVENT_ROUTE_CHANGE, {\n toRoute: route,\n toUrl: globalObject.location?.href,\n ...lastRouteRef.current,\n });\n\n lastRouteRef.current = {\n fromRoute: route,\n fromUrl: url,\n };\n }\n }, [location, navigationType, routes]);\n\n const ActualRoutes = props.routesComponent ?? Routes;\n\n return <ActualRoutes {...props} />;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/router/v6/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,C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QAAQ,CAAC;AAC3B,CAAC","sourcesContent":["import type { ReactRouterLocation } from '../types';\n\nimport { matchRoutes } from './routerDependencies';\nimport type { ReactRouterV6RouteObject } from './types';\n\nexport function getNumberOfUrlSegments(url: string): number {\n return url.split(/\\\\?\\//).filter((currentSegment) => currentSegment.length > 0 && currentSegment !== ',').length;\n}\n\nexport function getRouteFromLocation(routes: ReactRouterV6RouteObject[], location: ReactRouterLocation): string {\n if (!routes || routes.length === 0) {\n return location.pathname;\n }\n\n const matchedRoutes = matchRoutes(routes, location);\n\n let pathBuilder = '';\n\n if (matchedRoutes) {\n for (let x = 0; x < matchedRoutes.length; x++) {\n const branch = matchedRoutes[x]!;\n const route = branch.route;\n\n if (route) {\n if (route.index) {\n return branch.pathname;\n }\n\n let path = route.path;\n\n if (path) {\n path = path.startsWith('/') ? path : `/${path}`;\n\n pathBuilder += path;\n\n if (branch.pathname === location.pathname) {\n if (getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname)) {\n return path;\n }\n\n return pathBuilder;\n }\n }\n }\n }\n }\n\n return location.pathname;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/router/v6/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;AACnH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAkC,EAAE,QAA6B;IACpG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,IAAI,WAAW,GAAG,EAAE,CAAC;IAErB,IAAI,aAAa,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAE,CAAC;YACjC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAE3B,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;oBAChB,OAAO,MAAM,CAAC,QAAQ,CAAC;gBACzB,CAAC;gBAED,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;gBAEtB,IAAI,IAAI,EAAE,CAAC;oBACT,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;oBAEhD,WAAW,IAAI,IAAI,CAAC;oBAEpB,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,EAAE,CAAC;wBAC1C,IAAI,sBAAsB,CAAC,WAAW,CAAC,KAAK,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;4BACpF,OAAO,IAAI,CAAC;wBACd,CAAC;wBAED,OAAO,WAAW,CAAC;oBACrB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC,QAAQ,CAAC;AAC3B,CAAC","sourcesContent":["import type { ReactRouterLocation } from '../types';\n\nimport { matchRoutes } from './routerDependencies';\nimport type { ReactRouterV6RouteObject } from './types';\n\nexport function getNumberOfUrlSegments(url: string): number {\n return url.split(/\\\\?\\//).filter((currentSegment) => currentSegment.length > 0 && currentSegment !== ',').length;\n}\n\nexport function getRouteFromLocation(routes: ReactRouterV6RouteObject[], location: ReactRouterLocation): string {\n if (!routes || routes.length === 0) {\n return location.pathname;\n }\n\n const matchedRoutes = matchRoutes(routes, location);\n\n let pathBuilder = '';\n\n if (matchedRoutes) {\n for (let x = 0; x < matchedRoutes.length; x++) {\n const branch = matchedRoutes[x]!;\n const route = branch.route;\n\n if (route) {\n if (route.index) {\n return branch.pathname;\n }\n\n let path = route.path;\n\n if (path) {\n path = path.startsWith('/') ? path : `/${path}`;\n\n pathBuilder += path;\n\n if (branch.pathname === location.pathname) {\n if (getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname)) {\n return path;\n }\n\n return pathBuilder;\n }\n }\n }\n }\n }\n\n return location.pathname;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroRouterInstrumentation.js","sourceRoot":"","sources":["../../../../src/router/v6/withFaroRouterInstrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAuB,MAAM,UAAU,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAa/C;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAA4B,MAAS;IAChF,IAAI,SAAS,GAAmC,EAAE,CAAC;IAEnD,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;;QACzB,MAAM,cAAc,GAAmB,KAAK,CAAC,aAAa,CAAC;QAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAE7B,IAAI,aAAa,IAAI,CAAC,cAAc,KAAK,cAAc,CAAC,IAAI,IAAI,cAAc,KAAK,cAAc,CAAC,GAAG,CAAC,EAAE;YACtG,MAAM,KAAK,GAAG,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACrD,MAAM,GAAG,GAAG,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC;YAExC,GAAG,CAAC,SAAS,CAAC,kBAAkB,kBAC9B,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,IAC/B,SAAS,EACZ,CAAC;YAEH,SAAS,GAAG;gBACV,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,GAAG;aACb,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { EVENT_ROUTE_CHANGE, globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType, ReactRouterLocation } from '../types';\n\nimport { isInitialized } from './routerDependencies';\nimport type { EventRouteTransitionAttributes, RouteObjectV6DataRouter } from './types';\nimport { getRouteFromLocation } from './utils';\n\ninterface RouterState {\n historyAction: NavigationType | any;\n location: ReactRouterLocation;\n}\n\ninterface Router {\n state: RouterState;\n routes: RouteObjectV6DataRouter[];\n subscribe(fn: (state: RouterState) => void): () => void;\n}\n\n/**\n * To use with React Router 6.4 data APIs.\n */\nexport function withFaroRouterInstrumentation<R extends Router = Router>(router: R) {\n let lastRoute: EventRouteTransitionAttributes = {};\n\n router.subscribe((state) => {\n const navigationType: NavigationType = state.historyAction;\n const location = state.location;\n const routes = router.routes;\n\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n const route = getRouteFromLocation(routes, location);\n const url = globalObject.location?.href;\n\n api.pushEvent(EVENT_ROUTE_CHANGE, {\n toRoute: route,\n toUrl: globalObject.location?.href,\n ...lastRoute,\n });\n\n lastRoute = {\n fromRoute: route,\n fromUrl: url,\n };\n }\n });\n\n return router;\n}\n"]}
1
+ {"version":3,"file":"withFaroRouterInstrumentation.js","sourceRoot":"","sources":["../../../../src/router/v6/withFaroRouterInstrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAa/C;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAA4B,MAAS;IAChF,IAAI,SAAS,GAAmC,EAAE,CAAC;IAEnD,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;;QACzB,MAAM,cAAc,GAAmB,KAAK,CAAC,aAAa,CAAC;QAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAE7B,IAAI,aAAa,IAAI,CAAC,cAAc,KAAK,cAAc,CAAC,IAAI,IAAI,cAAc,KAAK,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACvG,MAAM,KAAK,GAAG,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACrD,MAAM,GAAG,GAAG,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC;YAExC,GAAG,CAAC,SAAS,CAAC,kBAAkB,kBAC9B,OAAO,EAAE,KAAK,EACd,KAAK,EAAE,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,IAC/B,SAAS,EACZ,CAAC;YAEH,SAAS,GAAG;gBACV,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,GAAG;aACb,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { EVENT_ROUTE_CHANGE, globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType } from '../types';\nimport type { ReactRouterLocation } from '../types';\n\nimport { isInitialized } from './routerDependencies';\nimport type { EventRouteTransitionAttributes, RouteObjectV6DataRouter } from './types';\nimport { getRouteFromLocation } from './utils';\n\ninterface RouterState {\n historyAction: NavigationType | any;\n location: ReactRouterLocation;\n}\n\ninterface Router {\n state: RouterState;\n routes: RouteObjectV6DataRouter[];\n subscribe(fn: (state: RouterState) => void): () => void;\n}\n\n/**\n * To use with React Router 6.4 data APIs.\n */\nexport function withFaroRouterInstrumentation<R extends Router = Router>(router: R) {\n let lastRoute: EventRouteTransitionAttributes = {};\n\n router.subscribe((state) => {\n const navigationType: NavigationType = state.historyAction;\n const location = state.location;\n const routes = router.routes;\n\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n const route = getRouteFromLocation(routes, location);\n const url = globalObject.location?.href;\n\n api.pushEvent(EVENT_ROUTE_CHANGE, {\n toRoute: route,\n toUrl: globalObject.location?.href,\n ...lastRoute,\n });\n\n lastRoute = {\n fromRoute: route,\n fromUrl: url,\n };\n }\n });\n\n return router;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reactVersion.js","sourceRoot":"","sources":["../../../src/utils/reactVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AACpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;AACxD,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AAEjE,MAAM,UAAU,oBAAoB;IAClC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI;QACF,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;KACjD;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,IAAI,OAAO,CAAC;AAC3E,CAAC","sourcesContent":["import { version } from 'react';\n\nexport const reactVersion = version;\nexport const reactVersionMajor = getMajorReactVersion();\nexport const isReactVersionAtLeast18 = isReactVersionAtLeast(18);\nexport const isReactVersionAtLeast17 = isReactVersionAtLeast(17);\nexport const isReactVersionAtLeast16 = isReactVersionAtLeast(16);\n\nexport function getMajorReactVersion(): number | null {\n const major = reactVersion.split('.');\n\n try {\n return major[0] ? parseInt(major[0], 10) : null;\n } catch (err) {\n return null;\n }\n}\n\nexport function isReactVersionAtLeast(version: number): boolean {\n return reactVersionMajor === null ? false : reactVersionMajor >= version;\n}\n"]}
1
+ {"version":3,"file":"reactVersion.js","sourceRoot":"","sources":["../../../src/utils/reactVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AACpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;AACxD,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAC;AAEjE,MAAM,UAAU,oBAAoB;IAClC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,CAAC;QACH,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,IAAI,OAAO,CAAC;AAC3E,CAAC","sourcesContent":["import { version } from 'react';\n\nexport const reactVersion = version;\nexport const reactVersionMajor = getMajorReactVersion();\nexport const isReactVersionAtLeast18 = isReactVersionAtLeast(18);\nexport const isReactVersionAtLeast17 = isReactVersionAtLeast(17);\nexport const isReactVersionAtLeast16 = isReactVersionAtLeast(16);\n\nexport function getMajorReactVersion(): number | null {\n const major = reactVersion.split('.');\n\n try {\n return major[0] ? parseInt(major[0], 10) : null;\n } catch (err) {\n return null;\n }\n}\n\nexport function isReactVersionAtLeast(version: number): boolean {\n return reactVersionMajor === null ? false : reactVersionMajor >= version;\n}\n"]}
@@ -1,4 +1,5 @@
1
- import { NavigationType, ReactRouterLocation } from '../types';
1
+ import { NavigationType } from '../types';
2
+ import type { ReactRouterLocation } from '../types';
2
3
  import type { RouteObjectV6DataRouter } from './types';
3
4
  interface RouterState {
4
5
  historyAction: NavigationType | any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/faro-react",
3
- "version": "1.14.3",
3
+ "version": "1.16.0",
4
4
  "description": "Faro package that enables easier integration in projects built with React.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -55,8 +55,8 @@
55
55
  "quality:circular-deps": "madge --circular ."
56
56
  },
57
57
  "dependencies": {
58
- "@grafana/faro-web-sdk": "^1.14.3",
59
- "@grafana/faro-web-tracing": "^1.14.3",
58
+ "@grafana/faro-web-sdk": "^1.16.0",
59
+ "@grafana/faro-web-tracing": "^1.16.0",
60
60
  "hoist-non-react-statics": "^3.3.2"
61
61
  },
62
62
  "devDependencies": {
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "eaad1e4e4889aaa9a5a3539e169edc025d993ab0"
85
+ "gitHead": "4b902517e4f28c703ac3db1154209abe25e5216b"
86
86
  }