@grafana/faro-react 2.9.0 → 2.11.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 (200) hide show
  1. package/dist/bundle/faro-react.iife.js +11 -8
  2. package/dist/bundle/faro-react.iife.js.map +1 -0
  3. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.js +13 -0
  4. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js +26 -0
  5. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPrimitive.js +15 -0
  6. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPropertyKey.js +10 -0
  7. package/dist/cjs/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/typeof.js +17 -0
  8. package/dist/cjs/_virtual/_rolldown/runtime.js +24 -0
  9. package/dist/cjs/dependencies.js +20 -4
  10. package/dist/cjs/dependencies.js.map +1 -1
  11. package/dist/cjs/errorBoundary/FaroErrorBoundary.js +62 -67
  12. package/dist/cjs/errorBoundary/FaroErrorBoundary.js.map +1 -1
  13. package/dist/cjs/errorBoundary/const.js +7 -4
  14. package/dist/cjs/errorBoundary/const.js.map +1 -1
  15. package/dist/cjs/errorBoundary/index.js +6 -8
  16. package/dist/cjs/errorBoundary/types.js +0 -1
  17. package/dist/cjs/errorBoundary/withFaroErrorBoundary.js +17 -15
  18. package/dist/cjs/errorBoundary/withFaroErrorBoundary.js.map +1 -1
  19. package/dist/cjs/index.js +480 -109
  20. package/dist/cjs/instrumentation.js +19 -16
  21. package/dist/cjs/instrumentation.js.map +1 -1
  22. package/dist/cjs/profiler/FaroProfiler.js +75 -97
  23. package/dist/cjs/profiler/FaroProfiler.js.map +1 -1
  24. package/dist/cjs/profiler/index.js +4 -6
  25. package/dist/cjs/profiler/withFaroProfiler.js +20 -15
  26. package/dist/cjs/profiler/withFaroProfiler.js.map +1 -1
  27. package/dist/cjs/router/index.js +26 -21
  28. package/dist/cjs/router/initialize.js +30 -26
  29. package/dist/cjs/router/initialize.js.map +1 -1
  30. package/dist/cjs/router/types.js +20 -16
  31. package/dist/cjs/router/types.js.map +1 -1
  32. package/dist/cjs/router/v4v5/FaroRoute.js +12 -12
  33. package/dist/cjs/router/v4v5/FaroRoute.js.map +1 -1
  34. package/dist/cjs/router/v4v5/activeEvent.js +23 -17
  35. package/dist/cjs/router/v4v5/activeEvent.js.map +1 -1
  36. package/dist/cjs/router/v4v5/index.js +8 -10
  37. package/dist/cjs/router/v4v5/initialize.js +36 -34
  38. package/dist/cjs/router/v4v5/initialize.js.map +1 -1
  39. package/dist/cjs/router/v4v5/routerDependencies.js +30 -8
  40. package/dist/cjs/router/v4v5/routerDependencies.js.map +1 -1
  41. package/dist/cjs/router/v4v5/types.js +0 -1
  42. package/dist/cjs/router/v6v7/FaroRoutes.js +42 -59
  43. package/dist/cjs/router/v6v7/FaroRoutes.js.map +1 -1
  44. package/dist/cjs/router/v6v7/index.js +14 -16
  45. package/dist/cjs/router/v6v7/initialize.js +34 -32
  46. package/dist/cjs/router/v6v7/initialize.js.map +1 -1
  47. package/dist/cjs/router/v6v7/routerDependencies.js +59 -16
  48. package/dist/cjs/router/v6v7/routerDependencies.js.map +1 -1
  49. package/dist/cjs/router/v6v7/types.js +0 -1
  50. package/dist/cjs/router/v6v7/utils.js +27 -32
  51. package/dist/cjs/router/v6v7/utils.js.map +1 -1
  52. package/dist/cjs/router/v6v7/withFaroRouterInstrumentation.js +32 -25
  53. package/dist/cjs/router/v6v7/withFaroRouterInstrumentation.js.map +1 -1
  54. package/dist/cjs/types.js +0 -1
  55. package/dist/cjs/utils/index.js +9 -11
  56. package/dist/cjs/utils/reactVersion.js +24 -18
  57. package/dist/cjs/utils/reactVersion.js.map +1 -1
  58. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.js +12 -0
  59. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js +25 -0
  60. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPrimitive.js +14 -0
  61. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPropertyKey.js +9 -0
  62. package/dist/esm/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/typeof.js +11 -0
  63. package/dist/esm/dependencies.js +9 -5
  64. package/dist/esm/dependencies.js.map +1 -1
  65. package/dist/esm/errorBoundary/FaroErrorBoundary.js +61 -66
  66. package/dist/esm/errorBoundary/FaroErrorBoundary.js.map +1 -1
  67. package/dist/esm/errorBoundary/const.js +7 -3
  68. package/dist/esm/errorBoundary/const.js.map +1 -1
  69. package/dist/esm/errorBoundary/index.js +4 -4
  70. package/dist/esm/errorBoundary/types.js +0 -2
  71. package/dist/esm/errorBoundary/withFaroErrorBoundary.js +15 -12
  72. package/dist/esm/errorBoundary/withFaroErrorBoundary.js.map +1 -1
  73. package/dist/esm/index.js +21 -7
  74. package/dist/esm/instrumentation.js +20 -15
  75. package/dist/esm/instrumentation.js.map +1 -1
  76. package/dist/esm/profiler/FaroProfiler.js +74 -96
  77. package/dist/esm/profiler/FaroProfiler.js.map +1 -1
  78. package/dist/esm/profiler/index.js +3 -3
  79. package/dist/esm/profiler/withFaroProfiler.js +18 -12
  80. package/dist/esm/profiler/withFaroProfiler.js.map +1 -1
  81. package/dist/esm/router/index.js +12 -5
  82. package/dist/esm/router/initialize.js +31 -26
  83. package/dist/esm/router/initialize.js.map +1 -1
  84. package/dist/esm/router/types.js +19 -15
  85. package/dist/esm/router/types.js.map +1 -1
  86. package/dist/esm/router/v4v5/FaroRoute.js +11 -9
  87. package/dist/esm/router/v4v5/FaroRoute.js.map +1 -1
  88. package/dist/esm/router/v4v5/activeEvent.js +18 -16
  89. package/dist/esm/router/v4v5/activeEvent.js.map +1 -1
  90. package/dist/esm/router/v4v5/index.js +4 -4
  91. package/dist/esm/router/v4v5/initialize.js +35 -31
  92. package/dist/esm/router/v4v5/initialize.js.map +1 -1
  93. package/dist/esm/router/v4v5/routerDependencies.js +13 -9
  94. package/dist/esm/router/v4v5/routerDependencies.js.map +1 -1
  95. package/dist/esm/router/v4v5/types.js +0 -2
  96. package/dist/esm/router/v6v7/FaroRoutes.js +41 -26
  97. package/dist/esm/router/v6v7/FaroRoutes.js.map +1 -1
  98. package/dist/esm/router/v6v7/index.js +5 -5
  99. package/dist/esm/router/v6v7/initialize.js +33 -29
  100. package/dist/esm/router/v6v7/initialize.js.map +1 -1
  101. package/dist/esm/router/v6v7/routerDependencies.js +24 -20
  102. package/dist/esm/router/v6v7/routerDependencies.js.map +1 -1
  103. package/dist/esm/router/v6v7/types.js +0 -2
  104. package/dist/esm/router/v6v7/utils.js +28 -32
  105. package/dist/esm/router/v6v7/utils.js.map +1 -1
  106. package/dist/esm/router/v6v7/withFaroRouterInstrumentation.js +33 -25
  107. package/dist/esm/router/v6v7/withFaroRouterInstrumentation.js.map +1 -1
  108. package/dist/esm/types.js +0 -2
  109. package/dist/esm/utils/index.js +2 -2
  110. package/dist/esm/utils/reactVersion.js +20 -17
  111. package/dist/esm/utils/reactVersion.js.map +1 -1
  112. package/dist/types/dependencies.d.ts +7 -4
  113. package/dist/types/errorBoundary/FaroErrorBoundary.d.ts +15 -13
  114. package/dist/types/errorBoundary/const.d.ts +5 -2
  115. package/dist/types/errorBoundary/index.d.ts +5 -4
  116. package/dist/types/errorBoundary/types.d.ts +20 -17
  117. package/dist/types/errorBoundary/withFaroErrorBoundary.d.ts +6 -3
  118. package/dist/types/index.d.ts +24 -11
  119. package/dist/types/instrumentation.d.ts +11 -8
  120. package/dist/types/profiler/FaroProfiler.d.ts +24 -22
  121. package/dist/types/profiler/index.d.ts +3 -3
  122. package/dist/types/profiler/withFaroProfiler.d.ts +6 -3
  123. package/dist/types/router/index.d.ts +14 -7
  124. package/dist/types/router/initialize.d.ts +5 -2
  125. package/dist/types/router/types.d.ts +23 -20
  126. package/dist/types/router/v4v5/FaroRoute.d.ts +6 -3
  127. package/dist/types/router/v4v5/activeEvent.d.ts +8 -5
  128. package/dist/types/router/v4v5/index.d.ts +5 -4
  129. package/dist/types/router/v4v5/initialize.d.ts +8 -5
  130. package/dist/types/router/v4v5/routerDependencies.d.ts +10 -7
  131. package/dist/types/router/v4v5/types.d.ts +16 -13
  132. package/dist/types/router/v6v7/FaroRoutes.d.ts +6 -3
  133. package/dist/types/router/v6v7/index.d.ts +6 -5
  134. package/dist/types/router/v6v7/initialize.d.ts +11 -8
  135. package/dist/types/router/v6v7/routerDependencies.d.ts +14 -11
  136. package/dist/types/router/v6v7/types.d.ts +57 -58
  137. package/dist/types/router/v6v7/utils.d.ts +7 -4
  138. package/dist/types/router/v6v7/withFaroRouterInstrumentation.d.ts +11 -10
  139. package/dist/types/types.d.ts +24 -18
  140. package/dist/types/utils/index.d.ts +2 -1
  141. package/dist/types/utils/reactVersion.d.ts +11 -8
  142. package/package.json +17 -21
  143. package/dist/bundle/types/dependencies.d.ts +0 -4
  144. package/dist/bundle/types/errorBoundary/FaroErrorBoundary.d.ts +0 -14
  145. package/dist/bundle/types/errorBoundary/const.d.ts +0 -2
  146. package/dist/bundle/types/errorBoundary/index.d.ts +0 -4
  147. package/dist/bundle/types/errorBoundary/types.d.ts +0 -19
  148. package/dist/bundle/types/errorBoundary/withFaroErrorBoundary.d.ts +0 -3
  149. package/dist/bundle/types/index.d.ts +0 -11
  150. package/dist/bundle/types/instrumentation.d.ts +0 -9
  151. package/dist/bundle/types/profiler/FaroProfiler.d.ts +0 -24
  152. package/dist/bundle/types/profiler/FaroProfiler.test.d.ts +0 -1
  153. package/dist/bundle/types/profiler/index.d.ts +0 -3
  154. package/dist/bundle/types/profiler/withFaroProfiler.d.ts +0 -3
  155. package/dist/bundle/types/router/index.d.ts +0 -7
  156. package/dist/bundle/types/router/initialize.d.ts +0 -2
  157. package/dist/bundle/types/router/types.d.ts +0 -24
  158. package/dist/bundle/types/router/v4v5/FaroRoute.d.ts +0 -3
  159. package/dist/bundle/types/router/v4v5/activeEvent.d.ts +0 -5
  160. package/dist/bundle/types/router/v4v5/index.d.ts +0 -4
  161. package/dist/bundle/types/router/v4v5/initialize.d.ts +0 -5
  162. package/dist/bundle/types/router/v4v5/routerDependencies.d.ts +0 -7
  163. package/dist/bundle/types/router/v4v5/types.d.ts +0 -16
  164. package/dist/bundle/types/router/v6v7/FaroRoutes.d.ts +0 -3
  165. package/dist/bundle/types/router/v6v7/index.d.ts +0 -5
  166. package/dist/bundle/types/router/v6v7/initialize.d.ts +0 -8
  167. package/dist/bundle/types/router/v6v7/routerDependencies.d.ts +0 -11
  168. package/dist/bundle/types/router/v6v7/types.d.ts +0 -69
  169. package/dist/bundle/types/router/v6v7/utils.d.ts +0 -4
  170. package/dist/bundle/types/router/v6v7/withFaroRouterInstrumentation.d.ts +0 -17
  171. package/dist/bundle/types/types.d.ts +0 -24
  172. package/dist/bundle/types/utils/index.d.ts +0 -1
  173. package/dist/bundle/types/utils/reactVersion.d.ts +0 -8
  174. package/dist/cjs/errorBoundary/index.js.map +0 -1
  175. package/dist/cjs/errorBoundary/types.js.map +0 -1
  176. package/dist/cjs/index.js.map +0 -1
  177. package/dist/cjs/profiler/FaroProfiler.test.js +0 -75
  178. package/dist/cjs/profiler/FaroProfiler.test.js.map +0 -1
  179. package/dist/cjs/profiler/index.js.map +0 -1
  180. package/dist/cjs/router/index.js.map +0 -1
  181. package/dist/cjs/router/v4v5/index.js.map +0 -1
  182. package/dist/cjs/router/v4v5/types.js.map +0 -1
  183. package/dist/cjs/router/v6v7/index.js.map +0 -1
  184. package/dist/cjs/router/v6v7/types.js.map +0 -1
  185. package/dist/cjs/types.js.map +0 -1
  186. package/dist/cjs/utils/index.js.map +0 -1
  187. package/dist/esm/errorBoundary/index.js.map +0 -1
  188. package/dist/esm/errorBoundary/types.js.map +0 -1
  189. package/dist/esm/index.js.map +0 -1
  190. package/dist/esm/profiler/FaroProfiler.test.js +0 -73
  191. package/dist/esm/profiler/FaroProfiler.test.js.map +0 -1
  192. package/dist/esm/profiler/index.js.map +0 -1
  193. package/dist/esm/router/index.js.map +0 -1
  194. package/dist/esm/router/v4v5/index.js.map +0 -1
  195. package/dist/esm/router/v4v5/types.js.map +0 -1
  196. package/dist/esm/router/v6v7/index.js.map +0 -1
  197. package/dist/esm/router/v6v7/types.js.map +0 -1
  198. package/dist/esm/types.js.map +0 -1
  199. package/dist/esm/utils/index.js.map +0 -1
  200. package/dist/types/profiler/FaroProfiler.test.d.ts +0 -1
package/dist/esm/index.js CHANGED
@@ -1,7 +1,21 @@
1
- export { FaroErrorBoundary, faroErrorBoundaryInitialState, withFaroErrorBoundary } from './errorBoundary';
2
- export { ReactIntegration } from './instrumentation';
3
- export { FaroProfiler, withFaroProfiler } from './profiler';
4
- export { FaroRoute, FaroRoutes, NavigationType, ReactRouterVersion, createReactRouterV4Options, createReactRouterV5Options, createReactRouterV6Options, createReactRouterV6DataOptions, createReactRouterV7Options, createReactRouterV7DataOptions, setReactRouterV4V5SSRDependencies, setReactRouterV6SSRDependencies, setReactRouterV7SSRDependencies, withFaroRouterInstrumentation, } from './router';
5
- export { getMajorReactVersion, isReactVersionAtLeast, isReactVersionAtLeast16, isReactVersionAtLeast17, isReactVersionAtLeast18, isReactVersionAtLeast19, reactVersion, reactVersionMajor, } from './utils';
6
- export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, browserMeta, buildStackFrame, ConsoleInstrumentation, ConsoleTransport, createInternalLogger, createPromiseBuffer, createSession, deepEqual, defaultExceptionType, defaultEventDomain, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, ErrorsInstrumentation, FetchTransport, genShortID, getCurrentTimestamp, getDataFromSafariExtensions, getInternalFaroFromGlobalObject, getStackFramesFromError, getTransportBody, getWebInstrumentations, globalObject, initializeFaro, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, InternalLoggerLevel, LogLevel, makeCoreConfig, noop, parseStacktrace, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, ViewInstrumentation, WebVitalsInstrumentation, userActionDataAttribute, userActionTimeoutDataAttribute, } from '@grafana/faro-web-sdk';
7
- //# sourceMappingURL=index.js.map
1
+ import { faroErrorBoundaryInitialState } from "./errorBoundary/const.js";
2
+ import { getMajorReactVersion, isReactVersionAtLeast, isReactVersionAtLeast16, isReactVersionAtLeast17, isReactVersionAtLeast18, isReactVersionAtLeast19, reactVersion, reactVersionMajor } from "./utils/reactVersion.js";
3
+ import "./utils/index.js";
4
+ import { FaroErrorBoundary } from "./errorBoundary/FaroErrorBoundary.js";
5
+ import { withFaroErrorBoundary } from "./errorBoundary/withFaroErrorBoundary.js";
6
+ import "./errorBoundary/index.js";
7
+ import { NavigationType, ReactRouterVersion } from "./router/types.js";
8
+ import { setReactRouterV4V5SSRDependencies } from "./router/v4v5/routerDependencies.js";
9
+ import { FaroRoute } from "./router/v4v5/FaroRoute.js";
10
+ import { createReactRouterV4Options, createReactRouterV5Options } from "./router/v4v5/initialize.js";
11
+ import { setReactRouterV6SSRDependencies, setReactRouterV7SSRDependencies } from "./router/v6v7/routerDependencies.js";
12
+ import { FaroRoutes } from "./router/v6v7/FaroRoutes.js";
13
+ import { createReactRouterV6DataOptions, createReactRouterV6Options, createReactRouterV7DataOptions, createReactRouterV7Options } from "./router/v6v7/initialize.js";
14
+ import { withFaroRouterInstrumentation } from "./router/v6v7/withFaroRouterInstrumentation.js";
15
+ import "./router/index.js";
16
+ import { ReactIntegration } from "./instrumentation.js";
17
+ import { FaroProfiler } from "./profiler/FaroProfiler.js";
18
+ import { withFaroProfiler } from "./profiler/withFaroProfiler.js";
19
+ import "./profiler/index.js";
20
+ import { BaseExtension, BaseInstrumentation, BaseTransport, ConsoleInstrumentation, ConsoleTransport, ErrorsInstrumentation, FetchTransport, InternalLoggerLevel, LogLevel, TransportItemType, VERSION, ViewInstrumentation, WebVitalsInstrumentation, allLogLevels, browserMeta, buildStackFrame, createInternalLogger, createPromiseBuffer, createSession, deepEqual, defaultEventDomain, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, faro, genShortID, getCurrentTimestamp, getDataFromSafariExtensions, getInternalFaroFromGlobalObject, getStackFramesFromError, getTransportBody, getWebInstrumentations, globalObject, initializeFaro, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, makeCoreConfig, noop, parseStacktrace, setInternalFaroOnGlobalObject, transportItemTypeToBodyKey, userActionDataAttribute, userActionTimeoutDataAttribute } from "@grafana/faro-web-sdk";
21
+ export { BaseExtension, BaseInstrumentation, BaseTransport, ConsoleInstrumentation, ConsoleTransport, ErrorsInstrumentation, FaroErrorBoundary, FaroProfiler, FaroRoute, FaroRoutes, FetchTransport, InternalLoggerLevel, LogLevel, NavigationType, ReactIntegration, ReactRouterVersion, TransportItemType, VERSION, ViewInstrumentation, WebVitalsInstrumentation, allLogLevels, browserMeta, buildStackFrame, createInternalLogger, createPromiseBuffer, createReactRouterV4Options, createReactRouterV5Options, createReactRouterV6DataOptions, createReactRouterV6Options, createReactRouterV7DataOptions, createReactRouterV7Options, createSession, deepEqual, defaultEventDomain, defaultExceptionType, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, faro, faroErrorBoundaryInitialState, genShortID, getCurrentTimestamp, getDataFromSafariExtensions, getInternalFaroFromGlobalObject, getMajorReactVersion, getStackFramesFromError, getTransportBody, getWebInstrumentations, globalObject, initializeFaro, internalGlobalObjectKey, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isInternalFaroOnGlobalObject, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isReactVersionAtLeast, isReactVersionAtLeast16, isReactVersionAtLeast17, isReactVersionAtLeast18, isReactVersionAtLeast19, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, makeCoreConfig, noop, parseStacktrace, reactVersion, reactVersionMajor, setInternalFaroOnGlobalObject, setReactRouterV4V5SSRDependencies, setReactRouterV6SSRDependencies, setReactRouterV7SSRDependencies, transportItemTypeToBodyKey, userActionDataAttribute, userActionTimeoutDataAttribute, withFaroErrorBoundary, withFaroProfiler, withFaroRouterInstrumentation };
@@ -1,16 +1,21 @@
1
- import { BaseInstrumentation, VERSION } from '@grafana/faro-web-sdk';
2
- import { setDependencies } from './dependencies';
3
- import { initializeReactRouterInstrumentation } from './router';
4
- export class ReactIntegration extends BaseInstrumentation {
5
- constructor(options = {}) {
6
- super();
7
- this.options = options;
8
- this.name = '@grafana/faro-react';
9
- this.version = VERSION;
10
- }
11
- initialize() {
12
- setDependencies(this.internalLogger, this.api);
13
- initializeReactRouterInstrumentation(this.options);
14
- }
15
- }
1
+ import { setDependencies } from "./dependencies.js";
2
+ import { initializeReactRouterInstrumentation } from "./router/initialize.js";
3
+ import "./router/index.js";
4
+ import { BaseInstrumentation, VERSION } from "@grafana/faro-web-sdk";
5
+ //#region src/instrumentation.ts
6
+ var ReactIntegration = class extends BaseInstrumentation {
7
+ constructor(options = {}) {
8
+ super();
9
+ this.options = options;
10
+ this.name = "@grafana/faro-react";
11
+ this.version = VERSION;
12
+ }
13
+ initialize() {
14
+ setDependencies(this.internalLogger, this.api);
15
+ initializeReactRouterInstrumentation(this.options);
16
+ }
17
+ };
18
+ //#endregion
19
+ export { ReactIntegration };
20
+
16
21
  //# sourceMappingURL=instrumentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,oCAAoC,EAAE,MAAM,UAAU,CAAC;AAGhE,MAAM,OAAO,gBAAiB,SAAQ,mBAAmB;IAIvD,YAAoB,UAAkC,EAAE;QACtD,KAAK,EAAE,CAAC;QADU,YAAO,GAAP,OAAO,CAA6B;QAHxD,SAAI,GAAG,qBAAqB,CAAC;QAC7B,YAAO,GAAG,OAAO,CAAC;IAIlB,CAAC;IAED,UAAU;QACR,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,oCAAoC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;CACF","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","names":[],"sources":["../../src/instrumentation.ts"],"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: string = 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"],"mappings":";;;;;AAMA,IAAa,mBAAb,cAAsC,oBAAoB;CAIxD,YAAY,UAA0C,CAAC,GAAG;EACxD,MAAM;EADY,KAAA,UAAA;EAHpB,KAAA,OAAO;EACP,KAAA,UAAkB;CAIlB;CAEA,aAAmB;EACjB,gBAAgB,KAAK,gBAAgB,KAAK,GAAG;EAC7C,qCAAqC,KAAK,OAAO;CACnD;AACF"}
@@ -1,97 +1,75 @@
1
- // React is required in scope for JSX transformation with the classic transform
2
- // @ts-expect-error - TS6133: React appears unused but is required for JSX
3
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
4
- import React, { Component } from 'react';
5
- import { VERSION } from '@grafana/faro-web-sdk';
6
- import { api, internalLogger } from '../dependencies';
7
- export class FaroProfiler extends Component {
8
- get isOtelInitialized() {
9
- return !!(api === null || api === void 0 ? void 0 : api.isOTELInitialized());
10
- }
11
- get otel() {
12
- return api === null || api === void 0 ? void 0 : api.getOTEL();
13
- }
14
- get tracer() {
15
- var _a;
16
- return (_a = this.otel) === null || _a === void 0 ? void 0 : _a.trace.getTracer('@grafana/faro-react', VERSION);
17
- }
18
- createSpan(spanName, options) {
19
- var _a, _b;
20
- const span = this.tracer.startSpan(spanName, {
21
- startTime: options === null || options === void 0 ? void 0 : options.startTime,
22
- attributes: Object.assign({ 'react.component.name': this.props.name }, ((_a = options === null || options === void 0 ? void 0 : options.attributes) !== null && _a !== void 0 ? _a : {})),
23
- });
24
- (_b = this.otel) === null || _b === void 0 ? void 0 : _b.trace.setSpan(this.otel.context.active(), span);
25
- if (options === null || options === void 0 ? void 0 : options.endTime) {
26
- span.end(options.endTime);
27
- }
28
- return span;
29
- }
30
- createChildSpan(spanName, parent, options) {
31
- var _a;
32
- let span;
33
- (_a = this.otel) === null || _a === void 0 ? void 0 : _a.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {
34
- span = this.createSpan(spanName, options);
35
- });
36
- return span;
37
- }
38
- constructor(props) {
39
- super(props);
40
- this.mountSpan = undefined;
41
- this.renderSpan = undefined;
42
- this.updateSpan = undefined;
43
- if (this.isOtelInitialized) {
44
- this.mountSpan = this.createSpan('componentMount');
45
- }
46
- else {
47
- internalLogger === null || internalLogger === void 0 ? void 0 : internalLogger.error('The Faro React Profiler requires tracing instrumentation. Please enable it in the "instrumentations" section of your config.');
48
- }
49
- }
50
- componentDidMount() {
51
- if (this.isOtelInitialized && this.mountSpan) {
52
- // Let OTel stamp the end via its hrTime helper (`performance.timeOrigin +
53
- // performance.now()`), which is monotonic. Passing `Date.now()` here would mix the
54
- // wall clock with the mount span's start time (auto-stamped by OTel from hrTime),
55
- // making `endTime - startTime` drift with NTP / DST / manual clock changes.
56
- this.mountSpan.end();
57
- // Start the `componentRender` span immediately. It covers the live, mounted lifetime
58
- // of the component and is ended in `componentWillUnmount`. By starting and ending it
59
- // without explicit timestamps, both boundaries are stamped from OTel hrTime
60
- // (monotonic). This avoids the wall-clock issues of the previous implementation
61
- // which captured `Date.now()` here and subtracted it from another `Date.now()` at
62
- // unmount — a problem that compounded over a long-lived component (router/app
63
- // shells can live for the entire session).
64
- this.renderSpan = this.createChildSpan('componentRender', this.mountSpan);
65
- }
66
- }
67
- shouldComponentUpdate({ updateProps }) {
68
- if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {
69
- const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);
70
- if (changedProps.length > 0) {
71
- this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {
72
- attributes: {
73
- 'react.component.changed_props': changedProps,
74
- },
75
- });
76
- }
77
- }
78
- return true;
79
- }
80
- componentDidUpdate() {
81
- if (this.isOtelInitialized && this.updateSpan) {
82
- this.updateSpan.end();
83
- this.updateSpan = undefined;
84
- }
85
- }
86
- componentWillUnmount() {
87
- if (this.isOtelInitialized && this.renderSpan) {
88
- // End via OTel hrTime (monotonic). See `componentDidMount` for rationale.
89
- this.renderSpan.end();
90
- this.renderSpan = undefined;
91
- }
92
- }
93
- render() {
94
- return this.props.children;
95
- }
96
- }
1
+ import { api, internalLogger } from "../dependencies.js";
2
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js";
3
+ import { Component } from "react";
4
+ import { VERSION } from "@grafana/faro-web-sdk";
5
+ //#region src/profiler/FaroProfiler.tsx
6
+ var FaroProfiler = class extends Component {
7
+ get isOtelInitialized() {
8
+ return !!(api === null || api === void 0 ? void 0 : api.isOTELInitialized());
9
+ }
10
+ get otel() {
11
+ return api === null || api === void 0 ? void 0 : api.getOTEL();
12
+ }
13
+ get tracer() {
14
+ var _this$otel;
15
+ return (_this$otel = this.otel) === null || _this$otel === void 0 ? void 0 : _this$otel.trace.getTracer("@grafana/faro-react", VERSION);
16
+ }
17
+ createSpan(spanName, options) {
18
+ var _options$attributes, _this$otel2;
19
+ const span = this.tracer.startSpan(spanName, {
20
+ startTime: options === null || options === void 0 ? void 0 : options.startTime,
21
+ attributes: _objectSpread2({ "react.component.name": this.props.name }, (_options$attributes = options === null || options === void 0 ? void 0 : options.attributes) !== null && _options$attributes !== void 0 ? _options$attributes : {})
22
+ });
23
+ (_this$otel2 = this.otel) === null || _this$otel2 === void 0 || _this$otel2.trace.setSpan(this.otel.context.active(), span);
24
+ if (options === null || options === void 0 ? void 0 : options.endTime) span.end(options.endTime);
25
+ return span;
26
+ }
27
+ createChildSpan(spanName, parent, options) {
28
+ var _this$otel3;
29
+ let span;
30
+ (_this$otel3 = this.otel) === null || _this$otel3 === void 0 || _this$otel3.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {
31
+ span = this.createSpan(spanName, options);
32
+ });
33
+ return span;
34
+ }
35
+ constructor(props) {
36
+ super(props);
37
+ this.mountSpan = void 0;
38
+ this.renderSpan = void 0;
39
+ this.updateSpan = void 0;
40
+ if (this.isOtelInitialized) this.mountSpan = this.createSpan("componentMount");
41
+ else internalLogger === null || internalLogger === void 0 || internalLogger.error("The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.");
42
+ }
43
+ componentDidMount() {
44
+ if (this.isOtelInitialized && this.mountSpan) {
45
+ this.mountSpan.end();
46
+ this.renderSpan = this.createChildSpan("componentRender", this.mountSpan);
47
+ }
48
+ }
49
+ shouldComponentUpdate({ updateProps }) {
50
+ if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {
51
+ const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);
52
+ if (changedProps.length > 0) this.updateSpan = this.createChildSpan("componentUpdate", this.mountSpan, { attributes: { "react.component.changed_props": changedProps } });
53
+ }
54
+ return true;
55
+ }
56
+ componentDidUpdate() {
57
+ if (this.isOtelInitialized && this.updateSpan) {
58
+ this.updateSpan.end();
59
+ this.updateSpan = void 0;
60
+ }
61
+ }
62
+ componentWillUnmount() {
63
+ if (this.isOtelInitialized && this.renderSpan) {
64
+ this.renderSpan.end();
65
+ this.renderSpan = void 0;
66
+ }
67
+ }
68
+ render() {
69
+ return this.props.children;
70
+ }
71
+ };
72
+ //#endregion
73
+ export { FaroProfiler };
74
+
97
75
  //# sourceMappingURL=FaroProfiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/FaroProfiler.tsx"],"names":[],"mappings":"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","sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\n// React is required in scope for JSX transformation with the classic transform\n// @ts-expect-error - TS6133: React appears unused but is required for JSX\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport React, { 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 renderSpan: Span | 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 // Let OTel stamp the end via its hrTime helper (`performance.timeOrigin +\n // performance.now()`), which is monotonic. Passing `Date.now()` here would mix the\n // wall clock with the mount span's start time (auto-stamped by OTel from hrTime),\n // making `endTime - startTime` drift with NTP / DST / manual clock changes.\n this.mountSpan.end();\n\n // Start the `componentRender` span immediately. It covers the live, mounted lifetime\n // of the component and is ended in `componentWillUnmount`. By starting and ending it\n // without explicit timestamps, both boundaries are stamped from OTel hrTime\n // (monotonic). This avoids the wall-clock issues of the previous implementation\n // which captured `Date.now()` here and subtracted it from another `Date.now()` at\n // unmount — a problem that compounded over a long-lived component (router/app\n // shells can live for the entire session).\n this.renderSpan = this.createChildSpan('componentRender', this.mountSpan);\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.renderSpan) {\n // End via OTel hrTime (monotonic). See `componentDidMount` for rationale.\n this.renderSpan.end();\n this.renderSpan = undefined;\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\n }\n}\n"]}
1
+ {"version":3,"file":"FaroProfiler.js","names":[],"sources":["../../../src/profiler/FaroProfiler.tsx"],"sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\n// React is required in scope for JSX transformation with the classic transform\n// @ts-expect-error - TS6133: React appears unused but is required for JSX\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport React, { 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 renderSpan: Span | 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 // Let OTel stamp the end via its hrTime helper (`performance.timeOrigin +\n // performance.now()`), which is monotonic. Passing `Date.now()` here would mix the\n // wall clock with the mount span's start time (auto-stamped by OTel from hrTime),\n // making `endTime - startTime` drift with NTP / DST / manual clock changes.\n this.mountSpan.end();\n\n // Start the `componentRender` span immediately. It covers the live, mounted lifetime\n // of the component and is ended in `componentWillUnmount`. By starting and ending it\n // without explicit timestamps, both boundaries are stamped from OTel hrTime\n // (monotonic). This avoids the wall-clock issues of the previous implementation\n // which captured `Date.now()` here and subtracted it from another `Date.now()` at\n // unmount — a problem that compounded over a long-lived component (router/app\n // shells can live for the entire session).\n this.renderSpan = this.createChildSpan('componentRender', this.mountSpan);\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.renderSpan) {\n // End via OTel hrTime (monotonic). See `componentDidMount` for rationale.\n this.renderSpan.end();\n this.renderSpan = undefined;\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\n }\n}\n"],"mappings":";;;;;AAkBA,IAAa,eAAb,cAAkC,UAA6B;CAK7D,IAAY,oBAA6B;EACvC,OAAO,CAAC,EAAA,QAAA,QAAA,QAAA,KAAA,IAAA,KAAA,IAAC,IAAK,kBAAkB;CAClC;CAEA,IAAY,OAA4B;EACtC,OAAA,QAAA,QAAA,QAAA,KAAA,IAAA,KAAA,IAAO,IAAK,QAAQ;CACtB;CAEA,IAAY,SAAiB;;EAC3B,QAAA,aAAO,KAAK,UAAA,QAAA,eAAA,KAAA,IAAA,KAAA,IAAA,WAAM,MAAM,UAAU,uBAAuB,OAAO;CAClE;CAEA,WACE,UACA,SACM;;EACN,MAAM,OAAO,KAAK,OAAO,UAAU,UAAU;GAC3C,WAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAW,QAAS;GACpB,YAAA,eAAA,EACE,wBAAwB,KAAK,MAAM,KAAA,IAAA,sBAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAC/B,QAAS,gBAAA,QAAA,wBAAA,KAAA,IAAA,sBAAc,CAAC,CAC9B;EACF,CAAC;EAED,CAAA,cAAA,KAAK,UAAA,QAAA,gBAAA,KAAA,KAAA,YAAM,MAAM,QAAQ,KAAK,KAAK,QAAQ,OAAO,GAAG,IAAI;EAEzD,IAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAI,QAAS,SACX,KAAK,IAAI,QAAQ,OAAO;EAG1B,OAAO;CACT;CAEA,gBACE,UACA,QACA,SACM;;EACN,IAAI;EAEJ,CAAA,cAAA,KAAK,UAAA,QAAA,gBAAA,KAAA,KAAA,YAAM,QAAQ,KAAK,KAAK,KAAK,MAAM,QAAQ,KAAK,KAAK,QAAQ,OAAO,GAAG,MAAM,SAAS;GACzF,OAAO,KAAK,WAAW,UAAU,OAAO;EAC1C,CAAC;EAED,OAAO;CACT;CAEA,YAAY,OAA0B;EACpC,MAAM,KAAK;EApDb,KAAU,YAA8B,KAAA;EACxC,KAAU,aAA+B,KAAA;EACzC,KAAU,aAA+B,KAAA;EAoDvC,IAAI,KAAK,mBACP,KAAK,YAAY,KAAK,WAAW,gBAAgB;OAEjD,mBAAA,QAAA,mBAAA,KAAA,KAAA,eAAgB,MACd,gIACF;CAEJ;CAEA,oBAAmC;EACjC,IAAI,KAAK,qBAAqB,KAAK,WAAW;GAK5C,KAAK,UAAU,IAAI;GASnB,KAAK,aAAa,KAAK,gBAAgB,mBAAmB,KAAK,SAAS;EAC1E;CACF;CAEA,sBAA+B,EAAE,eAA2C;EAC1E,IAAI,KAAK,qBAAqB,KAAK,aAAa,gBAAgB,KAAK,MAAM,aAAa;GACtF,MAAM,eAAe,OAAO,KAAK,WAAW,CAAC,CAAC,QAAQ,QAAQ,YAAY,SAAS,KAAK,MAAM,YAAY,IAAI;GAE9G,IAAI,aAAa,SAAS,GACxB,KAAK,aAAa,KAAK,gBAAgB,mBAAmB,KAAK,WAAW,EACxE,YAAY,EACV,iCAAiC,aACnC,EACF,CAAC;EAEL;EAEA,OAAO;CACT;CAEA,qBAAoC;EAClC,IAAI,KAAK,qBAAqB,KAAK,YAAY;GAC7C,KAAK,WAAW,IAAI;GACpB,KAAK,aAAa,KAAA;EACpB;CACF;CAEA,uBAAsC;EACpC,IAAI,KAAK,qBAAqB,KAAK,YAAY;GAE7C,KAAK,WAAW,IAAI;GACpB,KAAK,aAAa,KAAA;EACpB;CACF;CAEA,SAA6B;EAC3B,OAAO,KAAK,MAAM;CACpB;AACF"}
@@ -1,3 +1,3 @@
1
- export { FaroProfiler } from './FaroProfiler';
2
- export { withFaroProfiler } from './withFaroProfiler';
3
- //# sourceMappingURL=index.js.map
1
+ import { FaroProfiler } from "./FaroProfiler.js";
2
+ import { withFaroProfiler } from "./withFaroProfiler.js";
3
+ export { FaroProfiler, withFaroProfiler };
@@ -1,14 +1,20 @@
1
- import hoistNonReactStatics from 'hoist-non-react-statics';
2
- import React from 'react';
3
- import { unknownString } from '@grafana/faro-web-sdk';
4
- import { FaroProfiler } from './FaroProfiler';
5
- export function withFaroProfiler(WrappedComponent, options) {
6
- var _a, _b, _c;
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) => (React.createElement(FaroProfiler, { name: componentDisplayName, updateProps: props },
9
- React.createElement(WrappedComponent, Object.assign({}, props))));
10
- Component.displayName = `faroProfiler(${componentDisplayName})`;
11
- hoistNonReactStatics(Component, WrappedComponent);
12
- return Component;
1
+ import { FaroProfiler } from "./FaroProfiler.js";
2
+ import React from "react";
3
+ import { unknownString } from "@grafana/faro-web-sdk";
4
+ import hoistNonReactStatics from "hoist-non-react-statics";
5
+ //#region src/profiler/withFaroProfiler.tsx
6
+ function withFaroProfiler(WrappedComponent, options) {
7
+ var _ref, _ref2, _options$name;
8
+ const componentDisplayName = (_ref = (_ref2 = (_options$name = options === null || options === void 0 ? void 0 : options.name) !== null && _options$name !== void 0 ? _options$name : WrappedComponent.displayName) !== null && _ref2 !== void 0 ? _ref2 : WrappedComponent.name) !== null && _ref !== void 0 ? _ref : unknownString;
9
+ const Component = (props) => /* @__PURE__ */ React.createElement(FaroProfiler, {
10
+ name: componentDisplayName,
11
+ updateProps: props
12
+ }, /* @__PURE__ */ React.createElement(WrappedComponent, props));
13
+ Component.displayName = `faroProfiler(${componentDisplayName})`;
14
+ hoistNonReactStatics(Component, WrappedComponent);
15
+ return Component;
13
16
  }
17
+ //#endregion
18
+ export { withFaroProfiler };
19
+
14
20
  //# sourceMappingURL=withFaroProfiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,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,oBAAC,YAAY,IAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK;QAC1D,oBAAC,gBAAgB,oBAAK,KAAK,EAAI,CAClB,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 React from 'react';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-web-sdk';\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","names":[],"sources":["../../../src/profiler/withFaroProfiler.tsx"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport React from 'react';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '@grafana/faro-web-sdk';\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"],"mappings":";;;;;AASA,SAAgB,iBACd,kBACA,SACO;;CACP,MAAM,wBAAA,QAAA,SAAA,gBAAA,YAAA,QAAA,YAAA,KAAA,IAAA,KAAA,IAAuB,QAAS,UAAA,QAAA,kBAAA,KAAA,IAAA,gBAAQ,iBAAiB,iBAAA,QAAA,UAAA,KAAA,IAAA,QAAe,iBAAiB,UAAA,QAAA,SAAA,KAAA,IAAA,OAAQ;CAEvG,MAAM,aAAoB,UACxB,sBAAA,cAAC,cAAD;EAAc,MAAM;EAAsB,aAAa;CAEzC,GADZ,sBAAA,cAAC,kBAAqB,KAAQ,CAClB;CAGhB,UAAU,cAAc,gBAAgB,qBAAqB;CAE7D,qBAAqB,WAAW,gBAAgB;CAEhD,OAAO;AACT"}
@@ -1,5 +1,12 @@
1
- export { initializeReactRouterInstrumentation } from './initialize';
2
- export { NavigationType, ReactRouterVersion } from './types';
3
- export { FaroRoute, createReactRouterV4Options, createReactRouterV5Options, setReactRouterV4V5SSRDependencies, } from './v4v5';
4
- export { FaroRoutes, createReactRouterV6Options, createReactRouterV6DataOptions, setReactRouterV6SSRDependencies, setReactRouterV7SSRDependencies, withFaroRouterInstrumentation, createReactRouterV7Options, createReactRouterV7DataOptions, } from './v6v7';
5
- //# sourceMappingURL=index.js.map
1
+ import { NavigationType, ReactRouterVersion } from "./types.js";
2
+ import { setReactRouterV4V5SSRDependencies } from "./v4v5/routerDependencies.js";
3
+ import { FaroRoute } from "./v4v5/FaroRoute.js";
4
+ import { createReactRouterV4Options, createReactRouterV5Options } from "./v4v5/initialize.js";
5
+ import "./v4v5/index.js";
6
+ import { setReactRouterV6SSRDependencies, setReactRouterV7SSRDependencies } from "./v6v7/routerDependencies.js";
7
+ import { FaroRoutes } from "./v6v7/FaroRoutes.js";
8
+ import { createReactRouterV6DataOptions, createReactRouterV6Options, createReactRouterV7DataOptions, createReactRouterV7Options } from "./v6v7/initialize.js";
9
+ import { withFaroRouterInstrumentation } from "./v6v7/withFaroRouterInstrumentation.js";
10
+ import "./v6v7/index.js";
11
+ import { initializeReactRouterInstrumentation } from "./initialize.js";
12
+ export { FaroRoute, FaroRoutes, NavigationType, ReactRouterVersion, createReactRouterV4Options, createReactRouterV5Options, createReactRouterV6DataOptions, createReactRouterV6Options, createReactRouterV7DataOptions, createReactRouterV7Options, initializeReactRouterInstrumentation, setReactRouterV4V5SSRDependencies, setReactRouterV6SSRDependencies, setReactRouterV7SSRDependencies, withFaroRouterInstrumentation };
@@ -1,28 +1,33 @@
1
- import { internalLogger } from '../dependencies';
2
- import { ReactRouterVersion } from './types';
3
- import { initializeReactRouterV4V5Instrumentation } from './v4v5';
4
- import { initializeReactRouterV6DataRouterInstrumentation, initializeReactRouterV6Instrumentation } from './v6v7';
5
- export function initializeReactRouterInstrumentation(options) {
6
- var _a;
7
- const initMessage = 'Initializing React Router';
8
- switch ((_a = options.router) === null || _a === void 0 ? void 0 : _a.version) {
9
- case ReactRouterVersion.V7:
10
- case ReactRouterVersion.V6:
11
- internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
12
- initializeReactRouterV6Instrumentation(options.router.dependencies);
13
- break;
14
- case ReactRouterVersion.V7_data_router:
15
- case ReactRouterVersion.V6_data_router:
16
- internalLogger.debug(`${initMessage} ${options.router.version} data router instrumentation`);
17
- initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);
18
- break;
19
- case ReactRouterVersion.V5:
20
- case ReactRouterVersion.V4:
21
- internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
22
- initializeReactRouterV4V5Instrumentation(options.router.dependencies);
23
- break;
24
- default:
25
- internalLogger.debug('Skipping initialization of React Router instrumentation');
26
- }
1
+ import { internalLogger } from "../dependencies.js";
2
+ import "./types.js";
3
+ import { initializeReactRouterV4V5Instrumentation } from "./v4v5/initialize.js";
4
+ import "./v4v5/index.js";
5
+ import { initializeReactRouterV6DataRouterInstrumentation, initializeReactRouterV6Instrumentation } from "./v6v7/initialize.js";
6
+ import "./v6v7/index.js";
7
+ //#region src/router/initialize.ts
8
+ function initializeReactRouterInstrumentation(options) {
9
+ var _options$router;
10
+ const initMessage = "Initializing React Router";
11
+ switch ((_options$router = options.router) === null || _options$router === void 0 ? void 0 : _options$router.version) {
12
+ case "v7":
13
+ case "v6":
14
+ internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
15
+ initializeReactRouterV6Instrumentation(options.router.dependencies);
16
+ break;
17
+ case "v7_data_router":
18
+ case "v6_data_router":
19
+ internalLogger.debug(`${initMessage} ${options.router.version} data router instrumentation`);
20
+ initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);
21
+ break;
22
+ case "v5":
23
+ case "v4":
24
+ internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
25
+ initializeReactRouterV4V5Instrumentation(options.router.dependencies);
26
+ break;
27
+ default: internalLogger.debug("Skipping initialization of React Router instrumentation");
28
+ }
27
29
  }
30
+ //#endregion
31
+ export { initializeReactRouterInstrumentation };
32
+
28
33
  //# sourceMappingURL=initialize.js.map
@@ -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,QAAQ,CAAC;AAElH,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,CAAC;QAC3B,KAAK,kBAAkB,CAAC,EAAE;YACxB,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;YACjF,sCAAsC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM;QAER,KAAK,kBAAkB,CAAC,cAAc,CAAC;QACvC,KAAK,kBAAkB,CAAC,cAAc;YACpC,cAAc,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,8BAA8B,CAAC,CAAC;YAC7F,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 './v6v7';\n\nexport function initializeReactRouterInstrumentation(options: ReactIntegrationConfig): void {\n const initMessage = 'Initializing React Router';\n\n switch (options.router?.version) {\n case ReactRouterVersion.V7:\n case ReactRouterVersion.V6:\n internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);\n initializeReactRouterV6Instrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V7_data_router:\n case ReactRouterVersion.V6_data_router:\n internalLogger.debug(`${initMessage} ${options.router.version} 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","names":[],"sources":["../../../src/router/initialize.ts"],"sourcesContent":["import { internalLogger } from '../dependencies';\nimport type { ReactIntegrationConfig } from '../types';\n\nimport { ReactRouterVersion } from './types';\nimport { initializeReactRouterV4V5Instrumentation } from './v4v5';\nimport { initializeReactRouterV6DataRouterInstrumentation, initializeReactRouterV6Instrumentation } from './v6v7';\n\nexport function initializeReactRouterInstrumentation(options: ReactIntegrationConfig): void {\n const initMessage = 'Initializing React Router';\n\n switch (options.router?.version) {\n case ReactRouterVersion.V7:\n case ReactRouterVersion.V6:\n internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);\n initializeReactRouterV6Instrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V7_data_router:\n case ReactRouterVersion.V6_data_router:\n internalLogger.debug(`${initMessage} ${options.router.version} 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"],"mappings":";;;;;;;AAOA,SAAgB,qCAAqC,SAAuC;;CAC1F,MAAM,cAAc;CAEpB,SAAA,kBAAQ,QAAQ,YAAA,QAAA,oBAAA,KAAA,IAAA,KAAA,IAAA,gBAAQ,SAAxB;EACE,KAAA;EACA,KAAA;GACE,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,iBAAiB;GAC/E,uCAAuC,QAAQ,OAAO,YAAY;GAClE;EAEF,KAAA;EACA,KAAA;GACE,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,6BAA6B;GAC3F,iDAAiD,QAAQ,OAAO,YAAY;GAC5E;EAEF,KAAA;EACA,KAAA;GACE,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,iBAAiB;GAC/E,yCAAyC,QAAQ,OAAO,YAAY;GACpE;EAEF,SACE,eAAe,MAAM,yDAAyD;CAClF;AACF"}
@@ -1,16 +1,20 @@
1
- export var ReactRouterVersion;
2
- (function (ReactRouterVersion) {
3
- ReactRouterVersion["V4"] = "v4";
4
- ReactRouterVersion["V5"] = "v5";
5
- ReactRouterVersion["V6"] = "v6";
6
- ReactRouterVersion["V6_data_router"] = "v6_data_router";
7
- ReactRouterVersion["V7"] = "v7";
8
- ReactRouterVersion["V7_data_router"] = "v7_data_router";
9
- })(ReactRouterVersion || (ReactRouterVersion = {}));
10
- export var NavigationType;
11
- (function (NavigationType) {
12
- NavigationType["Pop"] = "POP";
13
- NavigationType["Push"] = "PUSH";
14
- NavigationType["Replace"] = "REPLACE";
15
- })(NavigationType || (NavigationType = {}));
1
+ //#region src/router/types.ts
2
+ let ReactRouterVersion = /* @__PURE__ */ function(ReactRouterVersion) {
3
+ ReactRouterVersion["V4"] = "v4";
4
+ ReactRouterVersion["V5"] = "v5";
5
+ ReactRouterVersion["V6"] = "v6";
6
+ ReactRouterVersion["V6_data_router"] = "v6_data_router";
7
+ ReactRouterVersion["V7"] = "v7";
8
+ ReactRouterVersion["V7_data_router"] = "v7_data_router";
9
+ return ReactRouterVersion;
10
+ }({});
11
+ let NavigationType = /* @__PURE__ */ function(NavigationType) {
12
+ NavigationType["Pop"] = "POP";
13
+ NavigationType["Push"] = "PUSH";
14
+ NavigationType["Replace"] = "REPLACE";
15
+ return NavigationType;
16
+ }({});
17
+ //#endregion
18
+ export { NavigationType, ReactRouterVersion };
19
+
16
20
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/router/types.ts"],"names":[],"mappings":"AAaA,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,+BAAS,CAAA;IACT,+BAAS,CAAA;IACT,+BAAS,CAAA;IACT,uDAAiC,CAAA;IACjC,+BAAS,CAAA;IACT,uDAAiC,CAAA;AACnC,CAAC,EAPW,kBAAkB,KAAlB,kBAAkB,QAO7B;AAED,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;IACb,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,KAAd,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 V7 = 'v7',\n V7_data_router = 'v7_data_router',\n}\n\nexport enum NavigationType {\n Pop = 'POP',\n Push = 'PUSH',\n Replace = 'REPLACE',\n}\n"]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/router/types.ts"],"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 V7 = 'v7',\n V7_data_router = 'v7_data_router',\n}\n\nexport enum NavigationType {\n Pop = 'POP',\n Push = 'PUSH',\n Replace = 'REPLACE',\n}\n"],"mappings":";AAaA,IAAY,qBAAL,yBAAA,oBAAA;CACL,mBAAA,QAAA;CACA,mBAAA,QAAA;CACA,mBAAA,QAAA;CACA,mBAAA,oBAAA;CACA,mBAAA,QAAA;CACA,mBAAA,oBAAA;;AACF,EAAA,CAAA,CAAA;AAEA,IAAY,iBAAL,yBAAA,gBAAA;CACL,eAAA,SAAA;CACA,eAAA,UAAA;CACA,eAAA,aAAA;;AACF,EAAA,CAAA,CAAA"}
@@ -1,11 +1,13 @@
1
- import React from 'react';
2
- import { setActiveEventRoute } from './activeEvent';
3
- import { Route } from './routerDependencies';
4
- export function FaroRoute(props) {
5
- var _a;
6
- if ((_a = props === null || props === void 0 ? void 0 : props.computedMatch) === null || _a === void 0 ? void 0 : _a.isExact) {
7
- setActiveEventRoute(props.computedMatch.path);
8
- }
9
- return React.createElement(Route, Object.assign({}, props));
1
+ import { setActiveEventRoute } from "./activeEvent.js";
2
+ import { Route } from "./routerDependencies.js";
3
+ import React from "react";
4
+ //#region src/router/v4v5/FaroRoute.tsx
5
+ function FaroRoute(props) {
6
+ var _props$computedMatch;
7
+ if (props === null || props === void 0 || (_props$computedMatch = props.computedMatch) === null || _props$computedMatch === void 0 ? void 0 : _props$computedMatch.isExact) setActiveEventRoute(props.computedMatch.path);
8
+ return /* @__PURE__ */ React.createElement(Route, props);
10
9
  }
10
+ //#endregion
11
+ export { FaroRoute };
12
+
11
13
  //# sourceMappingURL=FaroRoute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,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,oBAAC,KAAK,oBAAK,KAAK,EAAI,CAAC;AAC9B,CAAC","sourcesContent":["import React from 'react';\n\nimport { 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","names":[],"sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"sourcesContent":["import React from 'react';\n\nimport { setActiveEventRoute } from './activeEvent';\nimport { Route } from './routerDependencies';\nimport type { ReactRouterV4V5RouteProps } from './types';\n\nexport function FaroRoute(props: ReactRouterV4V5RouteProps): React.JSX.Element {\n if (props?.computedMatch?.isExact) {\n setActiveEventRoute(props.computedMatch.path);\n }\n\n return <Route {...props} />;\n}\n"],"mappings":";;;;AAMA,SAAgB,UAAU,OAAqD;;CAC7E,IAAA,UAAA,QAAA,UAAA,KAAA,MAAA,uBAAI,MAAO,mBAAA,QAAA,yBAAA,KAAA,IAAA,KAAA,IAAA,qBAAe,SACxB,oBAAoB,MAAM,cAAc,IAAI;CAG9C,OAAO,sBAAA,cAAC,OAAU,KAAQ;AAC5B"}
@@ -1,20 +1,22 @@
1
- import { EVENT_ROUTE_CHANGE } from '@grafana/faro-web-sdk';
2
- import { api } from '../../dependencies';
3
- export let activeEvent = undefined;
4
- export function createNewActiveEvent(url) {
5
- activeEvent = {
6
- route: '',
7
- url,
8
- };
9
- return activeEvent;
1
+ import { api } from "../../dependencies.js";
2
+ import { EVENT_ROUTE_CHANGE } from "@grafana/faro-web-sdk";
3
+ //#region src/router/v4v5/activeEvent.ts
4
+ let activeEvent = void 0;
5
+ function createNewActiveEvent(url) {
6
+ activeEvent = {
7
+ route: "",
8
+ url
9
+ };
10
+ return activeEvent;
10
11
  }
11
- export function setActiveEventRoute(route) {
12
- if (activeEvent) {
13
- activeEvent.route = route;
14
- }
12
+ function setActiveEventRoute(route) {
13
+ if (activeEvent) activeEvent.route = route;
15
14
  }
16
- export function sendActiveEvent() {
17
- api.pushEvent(EVENT_ROUTE_CHANGE, activeEvent, undefined, { skipDedupe: true });
18
- activeEvent = undefined;
15
+ function sendActiveEvent() {
16
+ api.pushEvent(EVENT_ROUTE_CHANGE, activeEvent, void 0, { skipDedupe: true });
17
+ activeEvent = void 0;
19
18
  }
19
+ //#endregion
20
+ export { activeEvent, createNewActiveEvent, sendActiveEvent, setActiveEventRoute };
21
+
20
22
  //# sourceMappingURL=activeEvent.js.map
@@ -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,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
+ {"version":3,"file":"activeEvent.js","names":[],"sources":["../../../../src/router/v4v5/activeEvent.ts"],"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"],"mappings":";;;AAMA,IAAW,cAAsD,KAAA;AAEjE,SAAgB,qBAAqB,KAAyC;CAC5E,cAAc;EACZ,OAAO;EACP;CACF;CAEA,OAAO;AACT;AAEA,SAAgB,oBAAoB,OAAqB;CACvD,IAAI,aACF,YAAY,QAAQ;AAExB;AAEA,SAAgB,kBAAwB;CACtC,IAAI,UAAU,oBAAoB,aAAa,KAAA,GAAW,EAAE,YAAY,KAAK,CAAC;CAE9E,cAAc,KAAA;AAChB"}
@@ -1,4 +1,4 @@
1
- export { FaroRoute } from './FaroRoute';
2
- export { createReactRouterV4Options, createReactRouterV5Options, initializeReactRouterV4V5Instrumentation, } from './initialize';
3
- export { setReactRouterV4V5SSRDependencies } from './routerDependencies';
4
- //# sourceMappingURL=index.js.map
1
+ import { setReactRouterV4V5SSRDependencies } from "./routerDependencies.js";
2
+ import { FaroRoute } from "./FaroRoute.js";
3
+ import { createReactRouterV4Options, createReactRouterV5Options, initializeReactRouterV4V5Instrumentation } from "./initialize.js";
4
+ export { FaroRoute, createReactRouterV4Options, createReactRouterV5Options, initializeReactRouterV4V5Instrumentation, setReactRouterV4V5SSRDependencies };