@grafana/faro-react 2.9.0 → 2.10.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
@@ -1,20 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReactIntegration = void 0;
4
- const faro_web_sdk_1 = require("@grafana/faro-web-sdk");
5
- const dependencies_1 = require("./dependencies");
6
- const router_1 = require("./router");
7
- class ReactIntegration extends faro_web_sdk_1.BaseInstrumentation {
8
- constructor(options = {}) {
9
- super();
10
- this.options = options;
11
- this.name = '@grafana/faro-react';
12
- this.version = faro_web_sdk_1.VERSION;
13
- }
14
- initialize() {
15
- (0, dependencies_1.setDependencies)(this.internalLogger, this.api);
16
- (0, router_1.initializeReactRouterInstrumentation)(this.options);
17
- }
18
- }
3
+ const require_dependencies = require("./dependencies.js");
4
+ const require_router_initialize = require("./router/initialize.js");
5
+ require("./router/index.js");
6
+ let _grafana_faro_web_sdk = require("@grafana/faro-web-sdk");
7
+ //#region src/instrumentation.ts
8
+ var ReactIntegration = class extends _grafana_faro_web_sdk.BaseInstrumentation {
9
+ constructor(options = {}) {
10
+ super();
11
+ this.options = options;
12
+ this.name = "@grafana/faro-react";
13
+ this.version = _grafana_faro_web_sdk.VERSION;
14
+ }
15
+ initialize() {
16
+ require_dependencies.setDependencies(this.internalLogger, this.api);
17
+ require_router_initialize.initializeReactRouterInstrumentation(this.options);
18
+ }
19
+ };
20
+ //#endregion
19
21
  exports.ReactIntegration = ReactIntegration;
22
+
20
23
  //# sourceMappingURL=instrumentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";;;AAAA,wDAAqE;AAErE,iDAAiD;AACjD,qCAAgE;AAGhE,MAAa,gBAAiB,SAAQ,kCAAmB;IAIvD,YAAoB,UAAkC,EAAE;QACtD,KAAK,EAAE,CAAC;QADU,YAAO,GAAP,OAAO,CAA6B;QAHxD,SAAI,GAAG,qBAAqB,CAAC;QAC7B,YAAO,GAAG,sBAAO,CAAC;IAIlB,CAAC;IAED,UAAU;QACR,IAAA,8BAAe,EAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAA,6CAAoC,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAZD,4CAYC","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":["BaseInstrumentation","VERSION"],"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,cAAsCA,sBAAAA,oBAAoB;CAIxD,YAAY,UAA0C,CAAC,GAAG;EACxD,MAAM;EADY,KAAA,UAAA;EAHpB,KAAA,OAAO;EACP,KAAA,UAAkBC,sBAAAA;CAIlB;CAEA,aAAmB;EACjB,qBAAA,gBAAgB,KAAK,gBAAgB,KAAK,GAAG;EAC7C,0BAAA,qCAAqC,KAAK,OAAO;CACnD;AACF"}
@@ -1,101 +1,79 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FaroProfiler = void 0;
4
- // React is required in scope for JSX transformation with the classic transform
5
- // @ts-expect-error - TS6133: React appears unused but is required for JSX
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- const react_1 = require("react");
8
- const faro_web_sdk_1 = require("@grafana/faro-web-sdk");
9
- const dependencies_1 = require("../dependencies");
10
- class FaroProfiler extends react_1.Component {
11
- get isOtelInitialized() {
12
- return !!(dependencies_1.api === null || dependencies_1.api === void 0 ? void 0 : dependencies_1.api.isOTELInitialized());
13
- }
14
- get otel() {
15
- return dependencies_1.api === null || dependencies_1.api === void 0 ? void 0 : dependencies_1.api.getOTEL();
16
- }
17
- get tracer() {
18
- var _a;
19
- return (_a = this.otel) === null || _a === void 0 ? void 0 : _a.trace.getTracer('@grafana/faro-react', faro_web_sdk_1.VERSION);
20
- }
21
- createSpan(spanName, options) {
22
- var _a, _b;
23
- const span = this.tracer.startSpan(spanName, {
24
- startTime: options === null || options === void 0 ? void 0 : options.startTime,
25
- attributes: Object.assign({ 'react.component.name': this.props.name }, ((_a = options === null || options === void 0 ? void 0 : options.attributes) !== null && _a !== void 0 ? _a : {})),
26
- });
27
- (_b = this.otel) === null || _b === void 0 ? void 0 : _b.trace.setSpan(this.otel.context.active(), span);
28
- if (options === null || options === void 0 ? void 0 : options.endTime) {
29
- span.end(options.endTime);
30
- }
31
- return span;
32
- }
33
- createChildSpan(spanName, parent, options) {
34
- var _a;
35
- let span;
36
- (_a = this.otel) === null || _a === void 0 ? void 0 : _a.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {
37
- span = this.createSpan(spanName, options);
38
- });
39
- return span;
40
- }
41
- constructor(props) {
42
- super(props);
43
- this.mountSpan = undefined;
44
- this.renderSpan = undefined;
45
- this.updateSpan = undefined;
46
- if (this.isOtelInitialized) {
47
- this.mountSpan = this.createSpan('componentMount');
48
- }
49
- else {
50
- dependencies_1.internalLogger === null || dependencies_1.internalLogger === void 0 ? void 0 : dependencies_1.internalLogger.error('The Faro React Profiler requires tracing instrumentation. Please enable it in the "instrumentations" section of your config.');
51
- }
52
- }
53
- componentDidMount() {
54
- if (this.isOtelInitialized && this.mountSpan) {
55
- // Let OTel stamp the end via its hrTime helper (`performance.timeOrigin +
56
- // performance.now()`), which is monotonic. Passing `Date.now()` here would mix the
57
- // wall clock with the mount span's start time (auto-stamped by OTel from hrTime),
58
- // making `endTime - startTime` drift with NTP / DST / manual clock changes.
59
- this.mountSpan.end();
60
- // Start the `componentRender` span immediately. It covers the live, mounted lifetime
61
- // of the component and is ended in `componentWillUnmount`. By starting and ending it
62
- // without explicit timestamps, both boundaries are stamped from OTel hrTime
63
- // (monotonic). This avoids the wall-clock issues of the previous implementation
64
- // which captured `Date.now()` here and subtracted it from another `Date.now()` at
65
- // unmount — a problem that compounded over a long-lived component (router/app
66
- // shells can live for the entire session).
67
- this.renderSpan = this.createChildSpan('componentRender', this.mountSpan);
68
- }
69
- }
70
- shouldComponentUpdate({ updateProps }) {
71
- if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {
72
- const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);
73
- if (changedProps.length > 0) {
74
- this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {
75
- attributes: {
76
- 'react.component.changed_props': changedProps,
77
- },
78
- });
79
- }
80
- }
81
- return true;
82
- }
83
- componentDidUpdate() {
84
- if (this.isOtelInitialized && this.updateSpan) {
85
- this.updateSpan.end();
86
- this.updateSpan = undefined;
87
- }
88
- }
89
- componentWillUnmount() {
90
- if (this.isOtelInitialized && this.renderSpan) {
91
- // End via OTel hrTime (monotonic). See `componentDidMount` for rationale.
92
- this.renderSpan.end();
93
- this.renderSpan = undefined;
94
- }
95
- }
96
- render() {
97
- return this.props.children;
98
- }
99
- }
3
+ const require_runtime = require("../_virtual/_rolldown/runtime.js");
4
+ const require_dependencies = require("../dependencies.js");
5
+ const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/objectSpread2.js");
6
+ let react = require("react");
7
+ react = require_runtime.__toESM(react);
8
+ let _grafana_faro_web_sdk = require("@grafana/faro-web-sdk");
9
+ //#region src/profiler/FaroProfiler.tsx
10
+ var FaroProfiler = class extends react.Component {
11
+ get isOtelInitialized() {
12
+ return !!(require_dependencies.api === null || require_dependencies.api === void 0 ? void 0 : require_dependencies.api.isOTELInitialized());
13
+ }
14
+ get otel() {
15
+ return require_dependencies.api === null || require_dependencies.api === void 0 ? void 0 : require_dependencies.api.getOTEL();
16
+ }
17
+ get tracer() {
18
+ var _this$otel;
19
+ return (_this$otel = this.otel) === null || _this$otel === void 0 ? void 0 : _this$otel.trace.getTracer("@grafana/faro-react", _grafana_faro_web_sdk.VERSION);
20
+ }
21
+ createSpan(spanName, options) {
22
+ var _options$attributes, _this$otel2;
23
+ const span = this.tracer.startSpan(spanName, {
24
+ startTime: options === null || options === void 0 ? void 0 : options.startTime,
25
+ attributes: require_objectSpread2.default({ "react.component.name": this.props.name }, (_options$attributes = options === null || options === void 0 ? void 0 : options.attributes) !== null && _options$attributes !== void 0 ? _options$attributes : {})
26
+ });
27
+ (_this$otel2 = this.otel) === null || _this$otel2 === void 0 || _this$otel2.trace.setSpan(this.otel.context.active(), span);
28
+ if (options === null || options === void 0 ? void 0 : options.endTime) span.end(options.endTime);
29
+ return span;
30
+ }
31
+ createChildSpan(spanName, parent, options) {
32
+ var _this$otel3;
33
+ let span;
34
+ (_this$otel3 = this.otel) === null || _this$otel3 === void 0 || _this$otel3.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {
35
+ span = this.createSpan(spanName, options);
36
+ });
37
+ return span;
38
+ }
39
+ constructor(props) {
40
+ super(props);
41
+ this.mountSpan = void 0;
42
+ this.renderSpan = void 0;
43
+ this.updateSpan = void 0;
44
+ if (this.isOtelInitialized) this.mountSpan = this.createSpan("componentMount");
45
+ else require_dependencies.internalLogger === null || require_dependencies.internalLogger === void 0 || require_dependencies.internalLogger.error("The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.");
46
+ }
47
+ componentDidMount() {
48
+ if (this.isOtelInitialized && this.mountSpan) {
49
+ this.mountSpan.end();
50
+ this.renderSpan = this.createChildSpan("componentRender", this.mountSpan);
51
+ }
52
+ }
53
+ shouldComponentUpdate({ updateProps }) {
54
+ if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {
55
+ const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);
56
+ if (changedProps.length > 0) this.updateSpan = this.createChildSpan("componentUpdate", this.mountSpan, { attributes: { "react.component.changed_props": changedProps } });
57
+ }
58
+ return true;
59
+ }
60
+ componentDidUpdate() {
61
+ if (this.isOtelInitialized && this.updateSpan) {
62
+ this.updateSpan.end();
63
+ this.updateSpan = void 0;
64
+ }
65
+ }
66
+ componentWillUnmount() {
67
+ if (this.isOtelInitialized && this.renderSpan) {
68
+ this.renderSpan.end();
69
+ this.renderSpan = void 0;
70
+ }
71
+ }
72
+ render() {
73
+ return this.props.children;
74
+ }
75
+ };
76
+ //#endregion
100
77
  exports.FaroProfiler = FaroProfiler;
78
+
101
79
  //# 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":["Component","api","VERSION"],"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,cAAkCA,MAAAA,UAA6B;CAK7D,IAAY,oBAA6B;EACvC,OAAO,CAAC,EAAA,qBAAA,QAAA,QAAA,qBAAA,QAAA,KAAA,IAAA,KAAA,IAACC,qBAAAA,IAAK,kBAAkB;CAClC;CAEA,IAAY,OAA4B;EACtC,OAAA,qBAAA,QAAA,QAAA,qBAAA,QAAA,KAAA,IAAA,KAAA,IAAOA,qBAAAA,IAAK,QAAQ;CACtB;CAEA,IAAY,SAAiB;;EAC3B,QAAA,aAAO,KAAK,UAAA,QAAA,eAAA,KAAA,IAAA,KAAA,IAAA,WAAM,MAAM,UAAU,uBAAuBC,sBAAAA,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,sBAAA,QAAA,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,qBAAA,mBAAA,QAAA,qBAAA,mBAAA,KAAA,KAAA,qBAAA,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,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withFaroProfiler = exports.FaroProfiler = void 0;
4
- var FaroProfiler_1 = require("./FaroProfiler");
5
- Object.defineProperty(exports, "FaroProfiler", { enumerable: true, get: function () { return FaroProfiler_1.FaroProfiler; } });
6
- var withFaroProfiler_1 = require("./withFaroProfiler");
7
- Object.defineProperty(exports, "withFaroProfiler", { enumerable: true, get: function () { return withFaroProfiler_1.withFaroProfiler; } });
8
- //# sourceMappingURL=index.js.map
3
+ const require_profiler_FaroProfiler = require("./FaroProfiler.js");
4
+ const require_profiler_withFaroProfiler = require("./withFaroProfiler.js");
5
+ exports.FaroProfiler = require_profiler_FaroProfiler.FaroProfiler;
6
+ exports.withFaroProfiler = require_profiler_withFaroProfiler.withFaroProfiler;
@@ -1,20 +1,25 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.withFaroProfiler = withFaroProfiler;
7
- const hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
8
- const react_1 = __importDefault(require("react"));
9
- const faro_web_sdk_1 = require("@grafana/faro-web-sdk");
10
- const FaroProfiler_1 = require("./FaroProfiler");
3
+ const require_runtime = require("../_virtual/_rolldown/runtime.js");
4
+ const require_profiler_FaroProfiler = require("./FaroProfiler.js");
5
+ let react = require("react");
6
+ react = require_runtime.__toESM(react);
7
+ let _grafana_faro_web_sdk = require("@grafana/faro-web-sdk");
8
+ let hoist_non_react_statics = require("hoist-non-react-statics");
9
+ hoist_non_react_statics = require_runtime.__toESM(hoist_non_react_statics);
10
+ //#region src/profiler/withFaroProfiler.tsx
11
11
  function withFaroProfiler(WrappedComponent, options) {
12
- var _a, _b, _c;
13
- 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 : faro_web_sdk_1.unknownString;
14
- const Component = (props) => (react_1.default.createElement(FaroProfiler_1.FaroProfiler, { name: componentDisplayName, updateProps: props },
15
- react_1.default.createElement(WrappedComponent, Object.assign({}, props))));
16
- Component.displayName = `faroProfiler(${componentDisplayName})`;
17
- (0, hoist_non_react_statics_1.default)(Component, WrappedComponent);
18
- return Component;
12
+ var _ref, _ref2, _options$name;
13
+ 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 : _grafana_faro_web_sdk.unknownString;
14
+ const Component = (props) => /* @__PURE__ */ react.default.createElement(require_profiler_FaroProfiler.FaroProfiler, {
15
+ name: componentDisplayName,
16
+ updateProps: props
17
+ }, /* @__PURE__ */ react.default.createElement(WrappedComponent, props));
18
+ Component.displayName = `faroProfiler(${componentDisplayName})`;
19
+ (0, hoist_non_react_statics.default)(Component, WrappedComponent);
20
+ return Component;
19
21
  }
22
+ //#endregion
23
+ exports.withFaroProfiler = withFaroProfiler;
24
+
20
25
  //# sourceMappingURL=withFaroProfiler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";;;;;AASA,4CAiBC;AA1BD,sFAA2D;AAC3D,kDAA0B;AAG1B,wDAAsD;AAEtD,iDAA8C;AAG9C,SAAgB,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,4BAAa,CAAC;IAErH,MAAM,SAAS,GAAU,CAAC,KAAQ,EAAE,EAAE,CAAC,CACrC,8BAAC,2BAAY,IAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK;QAC1D,8BAAC,gBAAgB,oBAAK,KAAK,EAAI,CAClB,CAChB,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,gBAAgB,oBAAoB,GAAG,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 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":["unknownString","FaroProfiler"],"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,OAAQA,sBAAAA;CAEvG,MAAM,aAAoB,UACxB,sBAAA,QAAA,cAACC,8BAAAA,cAAD;EAAc,MAAM;EAAsB,aAAa;CAEzC,GADZ,sBAAA,QAAA,cAAC,kBAAqB,KAAQ,CAClB;CAGhB,UAAU,cAAc,gBAAgB,qBAAqB;CAE7D,CAAA,GAAA,wBAAA,QAAA,CAAqB,WAAW,gBAAgB;CAEhD,OAAO;AACT"}
@@ -1,23 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createReactRouterV7DataOptions = exports.createReactRouterV7Options = exports.withFaroRouterInstrumentation = exports.setReactRouterV7SSRDependencies = exports.setReactRouterV6SSRDependencies = exports.createReactRouterV6DataOptions = exports.createReactRouterV6Options = exports.FaroRoutes = exports.setReactRouterV4V5SSRDependencies = exports.createReactRouterV5Options = exports.createReactRouterV4Options = exports.FaroRoute = exports.ReactRouterVersion = exports.NavigationType = exports.initializeReactRouterInstrumentation = void 0;
4
- var initialize_1 = require("./initialize");
5
- Object.defineProperty(exports, "initializeReactRouterInstrumentation", { enumerable: true, get: function () { return initialize_1.initializeReactRouterInstrumentation; } });
6
- var types_1 = require("./types");
7
- Object.defineProperty(exports, "NavigationType", { enumerable: true, get: function () { return types_1.NavigationType; } });
8
- Object.defineProperty(exports, "ReactRouterVersion", { enumerable: true, get: function () { return types_1.ReactRouterVersion; } });
9
- var v4v5_1 = require("./v4v5");
10
- Object.defineProperty(exports, "FaroRoute", { enumerable: true, get: function () { return v4v5_1.FaroRoute; } });
11
- Object.defineProperty(exports, "createReactRouterV4Options", { enumerable: true, get: function () { return v4v5_1.createReactRouterV4Options; } });
12
- Object.defineProperty(exports, "createReactRouterV5Options", { enumerable: true, get: function () { return v4v5_1.createReactRouterV5Options; } });
13
- Object.defineProperty(exports, "setReactRouterV4V5SSRDependencies", { enumerable: true, get: function () { return v4v5_1.setReactRouterV4V5SSRDependencies; } });
14
- var v6v7_1 = require("./v6v7");
15
- Object.defineProperty(exports, "FaroRoutes", { enumerable: true, get: function () { return v6v7_1.FaroRoutes; } });
16
- Object.defineProperty(exports, "createReactRouterV6Options", { enumerable: true, get: function () { return v6v7_1.createReactRouterV6Options; } });
17
- Object.defineProperty(exports, "createReactRouterV6DataOptions", { enumerable: true, get: function () { return v6v7_1.createReactRouterV6DataOptions; } });
18
- Object.defineProperty(exports, "setReactRouterV6SSRDependencies", { enumerable: true, get: function () { return v6v7_1.setReactRouterV6SSRDependencies; } });
19
- Object.defineProperty(exports, "setReactRouterV7SSRDependencies", { enumerable: true, get: function () { return v6v7_1.setReactRouterV7SSRDependencies; } });
20
- Object.defineProperty(exports, "withFaroRouterInstrumentation", { enumerable: true, get: function () { return v6v7_1.withFaroRouterInstrumentation; } });
21
- Object.defineProperty(exports, "createReactRouterV7Options", { enumerable: true, get: function () { return v6v7_1.createReactRouterV7Options; } });
22
- Object.defineProperty(exports, "createReactRouterV7DataOptions", { enumerable: true, get: function () { return v6v7_1.createReactRouterV7DataOptions; } });
23
- //# sourceMappingURL=index.js.map
3
+ const require_router_types = require("./types.js");
4
+ const require_router_v4v5_routerDependencies = require("./v4v5/routerDependencies.js");
5
+ const require_router_v4v5_FaroRoute = require("./v4v5/FaroRoute.js");
6
+ const require_router_v4v5_initialize = require("./v4v5/initialize.js");
7
+ require("./v4v5/index.js");
8
+ const require_router_v6v7_routerDependencies = require("./v6v7/routerDependencies.js");
9
+ const require_router_v6v7_FaroRoutes = require("./v6v7/FaroRoutes.js");
10
+ const require_router_v6v7_initialize = require("./v6v7/initialize.js");
11
+ const require_router_v6v7_withFaroRouterInstrumentation = require("./v6v7/withFaroRouterInstrumentation.js");
12
+ require("./v6v7/index.js");
13
+ const require_router_initialize = require("./initialize.js");
14
+ exports.FaroRoute = require_router_v4v5_FaroRoute.FaroRoute;
15
+ exports.FaroRoutes = require_router_v6v7_FaroRoutes.FaroRoutes;
16
+ exports.NavigationType = require_router_types.NavigationType;
17
+ exports.ReactRouterVersion = require_router_types.ReactRouterVersion;
18
+ exports.createReactRouterV4Options = require_router_v4v5_initialize.createReactRouterV4Options;
19
+ exports.createReactRouterV5Options = require_router_v4v5_initialize.createReactRouterV5Options;
20
+ exports.createReactRouterV6DataOptions = require_router_v6v7_initialize.createReactRouterV6DataOptions;
21
+ exports.createReactRouterV6Options = require_router_v6v7_initialize.createReactRouterV6Options;
22
+ exports.createReactRouterV7DataOptions = require_router_v6v7_initialize.createReactRouterV7DataOptions;
23
+ exports.createReactRouterV7Options = require_router_v6v7_initialize.createReactRouterV7Options;
24
+ exports.initializeReactRouterInstrumentation = require_router_initialize.initializeReactRouterInstrumentation;
25
+ exports.setReactRouterV4V5SSRDependencies = require_router_v4v5_routerDependencies.setReactRouterV4V5SSRDependencies;
26
+ exports.setReactRouterV6SSRDependencies = require_router_v6v7_routerDependencies.setReactRouterV6SSRDependencies;
27
+ exports.setReactRouterV7SSRDependencies = require_router_v6v7_routerDependencies.setReactRouterV7SSRDependencies;
28
+ exports.withFaroRouterInstrumentation = require_router_v6v7_withFaroRouterInstrumentation.withFaroRouterInstrumentation;
@@ -1,31 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeReactRouterInstrumentation = initializeReactRouterInstrumentation;
4
- const dependencies_1 = require("../dependencies");
5
- const types_1 = require("./types");
6
- const v4v5_1 = require("./v4v5");
7
- const v6v7_1 = require("./v6v7");
3
+ const require_dependencies = require("../dependencies.js");
4
+ require("./types.js");
5
+ const require_router_v4v5_initialize = require("./v4v5/initialize.js");
6
+ require("./v4v5/index.js");
7
+ const require_router_v6v7_initialize = require("./v6v7/initialize.js");
8
+ require("./v6v7/index.js");
9
+ //#region src/router/initialize.ts
8
10
  function initializeReactRouterInstrumentation(options) {
9
- var _a;
10
- const initMessage = 'Initializing React Router';
11
- switch ((_a = options.router) === null || _a === void 0 ? void 0 : _a.version) {
12
- case types_1.ReactRouterVersion.V7:
13
- case types_1.ReactRouterVersion.V6:
14
- dependencies_1.internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
15
- (0, v6v7_1.initializeReactRouterV6Instrumentation)(options.router.dependencies);
16
- break;
17
- case types_1.ReactRouterVersion.V7_data_router:
18
- case types_1.ReactRouterVersion.V6_data_router:
19
- dependencies_1.internalLogger.debug(`${initMessage} ${options.router.version} data router instrumentation`);
20
- (0, v6v7_1.initializeReactRouterV6DataRouterInstrumentation)(options.router.dependencies);
21
- break;
22
- case types_1.ReactRouterVersion.V5:
23
- case types_1.ReactRouterVersion.V4:
24
- dependencies_1.internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
25
- (0, v4v5_1.initializeReactRouterV4V5Instrumentation)(options.router.dependencies);
26
- break;
27
- default:
28
- dependencies_1.internalLogger.debug('Skipping initialization of React Router instrumentation');
29
- }
11
+ var _options$router;
12
+ const initMessage = "Initializing React Router";
13
+ switch ((_options$router = options.router) === null || _options$router === void 0 ? void 0 : _options$router.version) {
14
+ case "v7":
15
+ case "v6":
16
+ require_dependencies.internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
17
+ require_router_v6v7_initialize.initializeReactRouterV6Instrumentation(options.router.dependencies);
18
+ break;
19
+ case "v7_data_router":
20
+ case "v6_data_router":
21
+ require_dependencies.internalLogger.debug(`${initMessage} ${options.router.version} data router instrumentation`);
22
+ require_router_v6v7_initialize.initializeReactRouterV6DataRouterInstrumentation(options.router.dependencies);
23
+ break;
24
+ case "v5":
25
+ case "v4":
26
+ require_dependencies.internalLogger.debug(`${initMessage} ${options.router.version} instrumentation`);
27
+ require_router_v4v5_initialize.initializeReactRouterV4V5Instrumentation(options.router.dependencies);
28
+ break;
29
+ default: require_dependencies.internalLogger.debug("Skipping initialization of React Router instrumentation");
30
+ }
30
31
  }
32
+ //#endregion
33
+ exports.initializeReactRouterInstrumentation = initializeReactRouterInstrumentation;
34
+
31
35
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":";;AAOA,oFAyBC;AAhCD,kDAAiD;AAGjD,mCAA6C;AAC7C,iCAAkE;AAClE,iCAAkH;AAElH,SAAgB,oCAAoC,CAAC,OAA+B;;IAClF,MAAM,WAAW,GAAG,2BAA2B,CAAC;IAEhD,QAAQ,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,EAAE,CAAC;QAChC,KAAK,0BAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,0BAAkB,CAAC,EAAE;YACxB,6BAAc,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;YACjF,IAAA,6CAAsC,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM;QAER,KAAK,0BAAkB,CAAC,cAAc,CAAC;QACvC,KAAK,0BAAkB,CAAC,cAAc;YACpC,6BAAc,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,8BAA8B,CAAC,CAAC;YAC7F,IAAA,uDAAgD,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,GAAG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,kBAAkB,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 './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,qBAAA,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,iBAAiB;GAC/E,+BAAA,uCAAuC,QAAQ,OAAO,YAAY;GAClE;EAEF,KAAA;EACA,KAAA;GACE,qBAAA,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,6BAA6B;GAC3F,+BAAA,iDAAiD,QAAQ,OAAO,YAAY;GAC5E;EAEF,KAAA;EACA,KAAA;GACE,qBAAA,eAAe,MAAM,GAAG,YAAY,GAAG,QAAQ,OAAO,QAAQ,iBAAiB;GAC/E,+BAAA,yCAAyC,QAAQ,OAAO,YAAY;GACpE;EAEF,SACE,qBAAA,eAAe,MAAM,yDAAyD;CAClF;AACF"}
@@ -1,19 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NavigationType = exports.ReactRouterVersion = void 0;
4
- var ReactRouterVersion;
5
- (function (ReactRouterVersion) {
6
- ReactRouterVersion["V4"] = "v4";
7
- ReactRouterVersion["V5"] = "v5";
8
- ReactRouterVersion["V6"] = "v6";
9
- ReactRouterVersion["V6_data_router"] = "v6_data_router";
10
- ReactRouterVersion["V7"] = "v7";
11
- ReactRouterVersion["V7_data_router"] = "v7_data_router";
12
- })(ReactRouterVersion || (exports.ReactRouterVersion = ReactRouterVersion = {}));
13
- var NavigationType;
14
- (function (NavigationType) {
15
- NavigationType["Pop"] = "POP";
16
- NavigationType["Push"] = "PUSH";
17
- NavigationType["Replace"] = "REPLACE";
18
- })(NavigationType || (exports.NavigationType = NavigationType = {}));
3
+ //#region src/router/types.ts
4
+ let ReactRouterVersion = /* @__PURE__ */ function(ReactRouterVersion) {
5
+ ReactRouterVersion["V4"] = "v4";
6
+ ReactRouterVersion["V5"] = "v5";
7
+ ReactRouterVersion["V6"] = "v6";
8
+ ReactRouterVersion["V6_data_router"] = "v6_data_router";
9
+ ReactRouterVersion["V7"] = "v7";
10
+ ReactRouterVersion["V7_data_router"] = "v7_data_router";
11
+ return ReactRouterVersion;
12
+ }({});
13
+ let NavigationType = /* @__PURE__ */ function(NavigationType) {
14
+ NavigationType["Pop"] = "POP";
15
+ NavigationType["Push"] = "PUSH";
16
+ NavigationType["Replace"] = "REPLACE";
17
+ return NavigationType;
18
+ }({});
19
+ //#endregion
20
+ exports.NavigationType = NavigationType;
21
+ exports.ReactRouterVersion = ReactRouterVersion;
22
+
19
23
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/router/types.ts"],"names":[],"mappings":";;;AAaA,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,kCAAlB,kBAAkB,QAO7B;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 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,17 +1,17 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FaroRoute = FaroRoute;
7
- const react_1 = __importDefault(require("react"));
8
- const activeEvent_1 = require("./activeEvent");
9
- const routerDependencies_1 = require("./routerDependencies");
3
+ const require_runtime = require("../../_virtual/_rolldown/runtime.js");
4
+ const require_router_v4v5_activeEvent = require("./activeEvent.js");
5
+ const require_router_v4v5_routerDependencies = require("./routerDependencies.js");
6
+ let react = require("react");
7
+ react = require_runtime.__toESM(react);
8
+ //#region src/router/v4v5/FaroRoute.tsx
10
9
  function FaroRoute(props) {
11
- var _a;
12
- if ((_a = props === null || props === void 0 ? void 0 : props.computedMatch) === null || _a === void 0 ? void 0 : _a.isExact) {
13
- (0, activeEvent_1.setActiveEventRoute)(props.computedMatch.path);
14
- }
15
- return react_1.default.createElement(routerDependencies_1.Route, Object.assign({}, props));
10
+ var _props$computedMatch;
11
+ if (props === null || props === void 0 || (_props$computedMatch = props.computedMatch) === null || _props$computedMatch === void 0 ? void 0 : _props$computedMatch.isExact) require_router_v4v5_activeEvent.setActiveEventRoute(props.computedMatch.path);
12
+ return /* @__PURE__ */ react.default.createElement(require_router_v4v5_routerDependencies.Route, props);
16
13
  }
14
+ //#endregion
15
+ exports.FaroRoute = FaroRoute;
16
+
17
17
  //# sourceMappingURL=FaroRoute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";;;;;AAMA,8BAMC;AAZD,kDAA0B;AAE1B,+CAAoD;AACpD,6DAA6C;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,8BAAC,0BAAK,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":["Route"],"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,gCAAA,oBAAoB,MAAM,cAAc,IAAI;CAG9C,OAAO,sBAAA,QAAA,cAACA,uCAAAA,OAAU,KAAQ;AAC5B"}