@grafana/faro-react 1.0.0-beta5 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +1 -1
  2. package/dist/bundle/faro-react.iife.js +3 -12
  3. package/dist/cjs/dependencies.js +9 -0
  4. package/dist/cjs/dependencies.js.map +1 -0
  5. package/dist/cjs/errorBoundary/FaroErrorBoundary.js +3 -2
  6. package/dist/cjs/errorBoundary/FaroErrorBoundary.js.map +1 -1
  7. package/dist/cjs/errorBoundary/types.js.map +1 -1
  8. package/dist/cjs/errorBoundary/withFaroErrorBoundary.js.map +1 -1
  9. package/dist/cjs/index.js +5 -2
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/instrumentation.js +6 -4
  12. package/dist/cjs/instrumentation.js.map +1 -1
  13. package/dist/cjs/profiler/FaroProfiler.js +5 -8
  14. package/dist/cjs/profiler/FaroProfiler.js.map +1 -1
  15. package/dist/cjs/profiler/withFaroProfiler.js.map +1 -1
  16. package/dist/cjs/router/initialize.js +8 -7
  17. package/dist/cjs/router/initialize.js.map +1 -1
  18. package/dist/cjs/router/v4v5/FaroRoute.js +2 -2
  19. package/dist/cjs/router/v4v5/FaroRoute.js.map +1 -1
  20. package/dist/cjs/router/v4v5/activeEvent.js +3 -3
  21. package/dist/cjs/router/v4v5/activeEvent.js.map +1 -1
  22. package/dist/cjs/router/v4v5/index.js +3 -3
  23. package/dist/cjs/router/v4v5/index.js.map +1 -1
  24. package/dist/cjs/router/v4v5/initialize.js +3 -3
  25. package/dist/cjs/router/v4v5/initialize.js.map +1 -1
  26. package/dist/cjs/router/v4v5/{dependencies.js → routerDependencies.js} +4 -5
  27. package/dist/cjs/router/v4v5/routerDependencies.js.map +1 -0
  28. package/dist/cjs/router/v4v5/types.js.map +1 -1
  29. package/dist/cjs/router/v6/FaroRoutes.js +9 -8
  30. package/dist/cjs/router/v6/FaroRoutes.js.map +1 -1
  31. package/dist/cjs/router/v6/index.js +3 -3
  32. package/dist/cjs/router/v6/index.js.map +1 -1
  33. package/dist/cjs/router/v6/initialize.js +3 -3
  34. package/dist/cjs/router/v6/initialize.js.map +1 -1
  35. package/dist/cjs/router/v6/{dependencies.js → routerDependencies.js} +4 -5
  36. package/dist/cjs/router/v6/routerDependencies.js.map +1 -0
  37. package/dist/cjs/router/v6/utils.js +2 -2
  38. package/dist/cjs/router/v6/utils.js.map +1 -1
  39. package/dist/esm/dependencies.js +7 -0
  40. package/dist/esm/dependencies.js.map +1 -0
  41. package/dist/esm/errorBoundary/FaroErrorBoundary.js +4 -3
  42. package/dist/esm/errorBoundary/FaroErrorBoundary.js.map +1 -1
  43. package/dist/esm/errorBoundary/types.js.map +1 -1
  44. package/dist/esm/errorBoundary/withFaroErrorBoundary.js.map +1 -1
  45. package/dist/esm/index.js +1 -1
  46. package/dist/esm/index.js.map +1 -1
  47. package/dist/esm/instrumentation.js +5 -3
  48. package/dist/esm/instrumentation.js.map +1 -1
  49. package/dist/esm/profiler/FaroProfiler.js +5 -7
  50. package/dist/esm/profiler/FaroProfiler.js.map +1 -1
  51. package/dist/esm/profiler/withFaroProfiler.js.map +1 -1
  52. package/dist/esm/router/initialize.js +8 -7
  53. package/dist/esm/router/initialize.js.map +1 -1
  54. package/dist/esm/router/v4v5/FaroRoute.js +1 -1
  55. package/dist/esm/router/v4v5/FaroRoute.js.map +1 -1
  56. package/dist/esm/router/v4v5/activeEvent.js +3 -3
  57. package/dist/esm/router/v4v5/activeEvent.js.map +1 -1
  58. package/dist/esm/router/v4v5/index.js +1 -1
  59. package/dist/esm/router/v4v5/index.js.map +1 -1
  60. package/dist/esm/router/v4v5/initialize.js +3 -3
  61. package/dist/esm/router/v4v5/initialize.js.map +1 -1
  62. package/dist/esm/router/v4v5/{dependencies.js → routerDependencies.js} +2 -4
  63. package/dist/esm/router/v4v5/routerDependencies.js.map +1 -0
  64. package/dist/esm/router/v4v5/types.js.map +1 -1
  65. package/dist/esm/router/v6/FaroRoutes.js +4 -3
  66. package/dist/esm/router/v6/FaroRoutes.js.map +1 -1
  67. package/dist/esm/router/v6/index.js +1 -1
  68. package/dist/esm/router/v6/index.js.map +1 -1
  69. package/dist/esm/router/v6/initialize.js +3 -3
  70. package/dist/esm/router/v6/initialize.js.map +1 -1
  71. package/dist/esm/router/v6/{dependencies.js → routerDependencies.js} +2 -4
  72. package/dist/esm/router/v6/routerDependencies.js.map +1 -0
  73. package/dist/esm/router/v6/utils.js +1 -1
  74. package/dist/esm/router/v6/utils.js.map +1 -1
  75. package/dist/types/dependencies.d.ts +4 -0
  76. package/dist/types/errorBoundary/types.d.ts +0 -2
  77. package/dist/types/index.d.ts +2 -2
  78. package/dist/types/instrumentation.d.ts +2 -2
  79. package/dist/types/router/initialize.d.ts +1 -2
  80. package/dist/types/router/v4v5/index.d.ts +1 -1
  81. package/dist/types/router/v4v5/initialize.d.ts +1 -2
  82. package/dist/types/router/v4v5/{dependencies.d.ts → routerDependencies.d.ts} +1 -3
  83. package/dist/types/router/v4v5/types.d.ts +1 -1
  84. package/dist/types/router/v6/index.d.ts +1 -1
  85. package/dist/types/router/v6/initialize.d.ts +1 -2
  86. package/dist/types/router/v6/{dependencies.d.ts → routerDependencies.d.ts} +1 -3
  87. package/package.json +5 -5
  88. package/dist/cjs/router/v4v5/dependencies.js.map +0 -1
  89. package/dist/cjs/router/v6/dependencies.js.map +0 -1
  90. package/dist/esm/router/v4v5/dependencies.js.map +0 -1
  91. package/dist/esm/router/v6/dependencies.js.map +0 -1
@@ -29,12 +29,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.FaroProfiler = void 0;
30
30
  var react_1 = require("react");
31
31
  var faro_web_sdk_1 = require("@grafana/faro-web-sdk");
32
+ var dependencies_1 = require("../dependencies");
32
33
  var FaroProfiler = /** @class */ (function (_super) {
33
34
  __extends(FaroProfiler, _super);
34
35
  function FaroProfiler(props) {
35
- var _this = this;
36
- var _a;
37
- _this = _super.call(this, props) || this;
36
+ var _this = _super.call(this, props) || this;
38
37
  _this.mountSpan = undefined;
39
38
  _this.mountSpanEndTime = undefined;
40
39
  _this.updateSpan = undefined;
@@ -42,22 +41,20 @@ var FaroProfiler = /** @class */ (function (_super) {
42
41
  _this.mountSpan = _this.createSpan('componentMount');
43
42
  }
44
43
  else {
45
- (_a = faro_web_sdk_1.faro.internalLogger) === null || _a === void 0 ? void 0 : _a.error('The Faro React Profiler requires tracing instrumentation. Please enable it in the "instrumentations" section of your config.');
44
+ 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.');
46
45
  }
47
46
  return _this;
48
47
  }
49
48
  Object.defineProperty(FaroProfiler.prototype, "isOtelInitialized", {
50
49
  get: function () {
51
- var _a;
52
- return !!((_a = faro_web_sdk_1.faro.api) === null || _a === void 0 ? void 0 : _a.isOTELInitialized());
50
+ return !!(dependencies_1.api === null || dependencies_1.api === void 0 ? void 0 : dependencies_1.api.isOTELInitialized());
53
51
  },
54
52
  enumerable: false,
55
53
  configurable: true
56
54
  });
57
55
  Object.defineProperty(FaroProfiler.prototype, "otel", {
58
56
  get: function () {
59
- var _a;
60
- return (_a = faro_web_sdk_1.faro.api) === null || _a === void 0 ? void 0 : _a.getOTEL();
57
+ return dependencies_1.api === null || dependencies_1.api === void 0 ? void 0 : dependencies_1.api.getOTEL();
61
58
  },
62
59
  enumerable: false,
63
60
  configurable: true
@@ -1 +1 @@
1
- {"version":3,"file":"FaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/FaroProfiler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAAkC;AAIlC,sDAAsD;AAQtD;IAAkC,gCAA4B;IAoD5D,sBAAY,KAAwB;QAApC,iBAUC;;gBATC,kBAAM,KAAK,CAAC;QApDJ,eAAS,GAAqB,SAAS,CAAC;QACxC,sBAAgB,GAAuB,SA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EAAE,IAAI,CAAC,SAAS,EAAE;oBACxE,UAAU,EAAE;wBACV,+BAA+B,EAAE,YAAY;qBAC9C;iBACF,CAAC,CAAC;aACJ;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEQ,yCAAkB,GAA3B;QACE,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,UAAU,EAAE;YAC7C,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;SAC7B;IACH,CAAC;IAEQ,2CAAoB,GAA7B;QACE,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,EAAE;YAC5C,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,EAAE;gBACtD,SAAS,EAAE,IAAI,CAAC,gBAAgB;gBAChC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;aACpB,CAAC,CAAC;SACJ;IACH,CAAC;IAEQ,6BAAM,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IACH,mBAAC;AAAD,CAAC,AA1GD,CAAkC,iBAAS,GA0G1C;AA1GY,oCAAY","sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\nimport { Component } from 'react';\nimport type { ReactNode } from 'react';\n\nimport type { OTELApi } from '@grafana/faro-web-sdk';\nimport { faro, VERSION } from '@grafana/faro-web-sdk';\n\nexport interface FaroProfilerProps {\n children: ReactNode;\n name: string;\n updateProps: Record<string, unknown>;\n}\n\nexport class FaroProfiler extends Component<FaroProfilerProps> {\n protected mountSpan: Span | undefined = undefined;\n protected mountSpanEndTime: number | undefined = undefined;\n protected updateSpan: Span | undefined = undefined;\n\n private get isOtelInitialized(): boolean {\n return !!faro.api?.isOTELInitialized();\n }\n\n private get otel(): OTELApi | undefined {\n return faro.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 faro.internalLogger?.error(\n 'The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.'\n );\n }\n }\n\n override componentDidMount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.mountSpanEndTime = Date.now();\n this.mountSpan.end(this.mountSpanEndTime);\n }\n }\n\n override shouldComponentUpdate({ updateProps }: FaroProfilerProps): boolean {\n if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {\n const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);\n\n if (changedProps.length > 0) {\n this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {\n attributes: {\n 'react.component.changed_props': changedProps,\n },\n });\n }\n }\n\n return true;\n }\n\n override componentDidUpdate(): void {\n if (this.isOtelInitialized && this.updateSpan) {\n this.updateSpan.end();\n this.updateSpan = undefined;\n }\n }\n\n override componentWillUnmount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.createChildSpan('componentRender', this.mountSpan, {\n startTime: this.mountSpanEndTime,\n endTime: Date.now(),\n });\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\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,WAAW,EAAE;YACtF,IAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,IAAK,OAAA,WAAW,CAAC,GAAG,CAAC,KAAK,KAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,EAAhD,CAAgD,CAAC,CAAC;YAEhH,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,EAAE;oBACxE,UAAU,EAAE;wBACV,+BAA+B,EAAE,YAAY;qBAC9C;iBACF,CAAC,CAAC;aACJ;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEQ,yCAAkB,GAA3B;QACE,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,UAAU,EAAE;YAC7C,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;SAC7B;IACH,CAAC;IAEQ,2CAAoB,GAA7B;QACE,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,EAAE;YAC5C,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,EAAE;gBACtD,SAAS,EAAE,IAAI,CAAC,gBAAgB;gBAChC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;aACpB,CAAC,CAAC;SACJ;IACH,CAAC;IAEQ,6BAAM,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IACH,mBAAC;AAAD,CAAC,AA1GD,CAAkC,iBAAS,GA0G1C;AA1GY,oCAAY","sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\nimport { Component } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { VERSION } from '@grafana/faro-web-sdk';\nimport type { OTELApi } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\n\nexport interface FaroProfilerProps {\n children: ReactNode;\n name: string;\n updateProps: Record<string, unknown>;\n}\n\nexport class FaroProfiler extends Component<FaroProfilerProps> {\n protected mountSpan: Span | undefined = undefined;\n protected mountSpanEndTime: number | undefined = undefined;\n protected updateSpan: Span | undefined = undefined;\n\n private get isOtelInitialized(): boolean {\n return !!api?.isOTELInitialized();\n }\n\n private get otel(): OTELApi | undefined {\n return api?.getOTEL()!;\n }\n\n private get tracer(): Tracer {\n return this.otel?.trace.getTracer('@grafana/faro-react', VERSION)!;\n }\n\n private createSpan(\n spanName: string,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n const span = this.tracer.startSpan(spanName, {\n startTime: options?.startTime,\n attributes: {\n 'react.component.name': this.props.name,\n ...(options?.attributes ?? {}),\n },\n });\n\n this.otel?.trace.setSpan(this.otel.context.active(), span);\n\n if (options?.endTime) {\n span.end(options.endTime);\n }\n\n return span;\n }\n\n private createChildSpan(\n spanName: string,\n parent: Span,\n options?: { startTime?: number; endTime?: number; attributes?: Attributes }\n ): Span {\n let span: Span;\n\n this.otel?.context.with(this.otel.trace.setSpan(this.otel.context.active(), parent), () => {\n span = this.createSpan(spanName, options);\n });\n\n return span!;\n }\n\n constructor(props: FaroProfilerProps) {\n super(props);\n\n if (this.isOtelInitialized) {\n this.mountSpan = this.createSpan('componentMount');\n } else {\n internalLogger?.error(\n 'The Faro React Profiler requires tracing instrumentation. Please enable it in the \"instrumentations\" section of your config.'\n );\n }\n }\n\n override componentDidMount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.mountSpanEndTime = Date.now();\n this.mountSpan.end(this.mountSpanEndTime);\n }\n }\n\n override shouldComponentUpdate({ updateProps }: FaroProfilerProps): boolean {\n if (this.isOtelInitialized && this.mountSpan && updateProps !== this.props.updateProps) {\n const changedProps = Object.keys(updateProps).filter((key) => updateProps[key] !== this.props.updateProps[key]);\n\n if (changedProps.length > 0) {\n this.updateSpan = this.createChildSpan('componentUpdate', this.mountSpan, {\n attributes: {\n 'react.component.changed_props': changedProps,\n },\n });\n }\n }\n\n return true;\n }\n\n override componentDidUpdate(): void {\n if (this.isOtelInitialized && this.updateSpan) {\n this.updateSpan.end();\n this.updateSpan = undefined;\n }\n }\n\n override componentWillUnmount(): void {\n if (this.isOtelInitialized && this.mountSpan) {\n this.createChildSpan('componentRender', this.mountSpan, {\n startTime: this.mountSpanEndTime,\n endTime: Date.now(),\n });\n }\n }\n\n override render(): ReactNode {\n return this.props.children;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oFAA2D;AAG3D,kCAAyC;AACzC,+CAA8C;AAG9C,SAAgB,gBAAgB,CAC9B,gBAAkC,EAClC,OAAgD;;IAEhD,IAAM,oBAAoB,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,qBAAa,CAAC;IAErH,IAAM,SAAS,GAAU,UAAC,KAAQ,IAAK,OAAA,CACrC,uBAAC,2BAAY,aAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,gBAC1D,uBAAC,gBAAgB,eAAK,KAAK,EAAI,IAClB,CAChB,EAJsC,CAItC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,uBAAgB,oBAAoB,MAAG,CAAC;IAEhE,IAAA,iCAAoB,EAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC;AAjBD,4CAiBC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '../utils';\nimport { FaroProfiler } from './FaroProfiler';\nimport type { FaroProfilerProps } from './FaroProfiler';\n\nexport function withFaroProfiler<P extends Record<string, any>>(\n WrappedComponent: ComponentType<P>,\n options?: Omit<FaroProfilerProps, 'updateProps'>\n): FC<P> {\n const componentDisplayName = options?.name ?? WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (props: P) => (\n <FaroProfiler name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </FaroProfiler>\n );\n\n Component.displayName = `faroProfiler(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
1
+ {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oFAA2D;AAG3D,kCAAyC;AAEzC,+CAA8C;AAG9C,SAAgB,gBAAgB,CAC9B,gBAAkC,EAClC,OAAgD;;IAEhD,IAAM,oBAAoB,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,qBAAa,CAAC;IAErH,IAAM,SAAS,GAAU,UAAC,KAAQ,IAAK,OAAA,CACrC,uBAAC,2BAAY,aAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,gBAC1D,uBAAC,gBAAgB,eAAK,KAAK,EAAI,IAClB,CAChB,EAJsC,CAItC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,uBAAgB,oBAAoB,MAAG,CAAC;IAEhE,IAAA,iCAAoB,EAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC;AAjBD,4CAiBC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '../utils';\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,23 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initializeReactRouterInstrumentation = void 0;
4
+ var dependencies_1 = require("../dependencies");
4
5
  var types_1 = require("./types");
5
6
  var v4v5_1 = require("./v4v5");
6
7
  var v6_1 = require("./v6");
7
- function initializeReactRouterInstrumentation(config, faro) {
8
+ function initializeReactRouterInstrumentation(options) {
8
9
  var _a;
9
- switch ((_a = config.router) === null || _a === void 0 ? void 0 : _a.version) {
10
+ switch ((_a = options.router) === null || _a === void 0 ? void 0 : _a.version) {
10
11
  case types_1.ReactRouterVersion.V6:
11
- faro.internalLogger.debug('Initializing React Router V6 instrumentation');
12
- (0, v6_1.initializeReactRouterV6Instrumentation)(config.router.dependencies, faro);
12
+ dependencies_1.internalLogger.debug('Initializing React Router V6 instrumentation');
13
+ (0, v6_1.initializeReactRouterV6Instrumentation)(options.router.dependencies);
13
14
  break;
14
15
  case types_1.ReactRouterVersion.V5:
15
16
  case types_1.ReactRouterVersion.V4:
16
- faro.internalLogger.debug("Initializing React Router ".concat(config.router.version, " instrumentation"));
17
- (0, v4v5_1.initializeReactRouterV4V5Instrumentation)(config.router.dependencies, faro);
17
+ dependencies_1.internalLogger.debug("Initializing React Router ".concat(options.router.version, " instrumentation"));
18
+ (0, v4v5_1.initializeReactRouterV4V5Instrumentation)(options.router.dependencies);
18
19
  break;
19
20
  default:
20
- faro.internalLogger.debug('Skipping initialization of React Router instrumentation');
21
+ dependencies_1.internalLogger.debug('Skipping initialization of React Router instrumentation');
21
22
  }
22
23
  }
23
24
  exports.initializeReactRouterInstrumentation = initializeReactRouterInstrumentation;
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":";;;AAGA,iCAA6C;AAC7C,+BAAkE;AAClE,2BAA8D;AAE9D,SAAgB,oCAAoC,CAAC,MAA8B,EAAE,IAAU;;IAC7F,QAAQ,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,EAAE;QAC9B,KAAK,0BAAkB,CAAC,EAAE;YACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;YAC1E,IAAA,2CAAsC,EAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACzE,MAAM;QAER,KAAK,0BAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,0BAAkB,CAAC,EAAE;YACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,oCAA6B,MAAM,CAAC,MAAM,CAAC,OAAO,qBAAkB,CAAC,CAAC;YAChG,IAAA,+CAAwC,EAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YAC3E,MAAM;QAER;YACE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;KACxF;AACH,CAAC;AAhBD,oFAgBC","sourcesContent":["import type { Faro } from '@grafana/faro-web-sdk';\n\nimport type { ReactIntegrationConfig } from '../types';\nimport { ReactRouterVersion } from './types';\nimport { initializeReactRouterV4V5Instrumentation } from './v4v5';\nimport { initializeReactRouterV6Instrumentation } from './v6';\n\nexport function initializeReactRouterInstrumentation(config: ReactIntegrationConfig, faro: Faro): void {\n switch (config.router?.version) {\n case ReactRouterVersion.V6:\n faro.internalLogger.debug('Initializing React Router V6 instrumentation');\n initializeReactRouterV6Instrumentation(config.router.dependencies, faro);\n break;\n\n case ReactRouterVersion.V5:\n case ReactRouterVersion.V4:\n faro.internalLogger.debug(`Initializing React Router ${config.router.version} instrumentation`);\n initializeReactRouterV4V5Instrumentation(config.router.dependencies, faro);\n break;\n\n default:\n faro.internalLogger.debug('Skipping initialization of React Router instrumentation');\n }\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AAGjD,iCAA6C;AAC7C,+BAAkE;AAClE,2BAA8D;AAE9D,SAAgB,oCAAoC,CAAC,OAA+B;;IAClF,QAAQ,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,EAAE;QAC/B,KAAK,0BAAkB,CAAC,EAAE;YACxB,6BAAc,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;YACrE,IAAA,2CAAsC,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACpE,MAAM;QAER,KAAK,0BAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,0BAAkB,CAAC,EAAE;YACxB,6BAAc,CAAC,KAAK,CAAC,oCAA6B,OAAO,CAAC,MAAM,CAAC,OAAO,qBAAkB,CAAC,CAAC;YAC5F,IAAA,+CAAwC,EAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACtE,MAAM;QAER;YACE,6BAAc,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;KACnF;AACH,CAAC;AAhBD,oFAgBC","sourcesContent":["import { internalLogger } from '../dependencies';\nimport type { ReactIntegrationConfig } from '../types';\n\nimport { ReactRouterVersion } from './types';\nimport { initializeReactRouterV4V5Instrumentation } from './v4v5';\nimport { initializeReactRouterV6Instrumentation } from './v6';\n\nexport function initializeReactRouterInstrumentation(options: ReactIntegrationConfig): void {\n switch (options.router?.version) {\n case ReactRouterVersion.V6:\n internalLogger.debug('Initializing React Router V6 instrumentation');\n initializeReactRouterV6Instrumentation(options.router.dependencies);\n break;\n\n case ReactRouterVersion.V5:\n case ReactRouterVersion.V4:\n internalLogger.debug(`Initializing React Router ${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"]}
@@ -14,13 +14,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.FaroRoute = void 0;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var activeEvent_1 = require("./activeEvent");
17
- var dependencies_1 = require("./dependencies");
17
+ var routerDependencies_1 = require("./routerDependencies");
18
18
  function FaroRoute(props) {
19
19
  var _a;
20
20
  if ((_a = props === null || props === void 0 ? void 0 : props.computedMatch) === null || _a === void 0 ? void 0 : _a.isExact) {
21
21
  (0, activeEvent_1.setActiveEventRoute)(props.computedMatch.path);
22
22
  }
23
- return (0, jsx_runtime_1.jsx)(dependencies_1.Route, __assign({}, props));
23
+ return (0, jsx_runtime_1.jsx)(routerDependencies_1.Route, __assign({}, props));
24
24
  }
25
25
  exports.FaroRoute = FaroRoute;
26
26
  //# sourceMappingURL=FaroRoute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAoD;AACpD,+CAAuC;AAGvC,SAAgB,SAAS,CAAC,KAAgC;;IACxD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EAAE;QACjC,IAAA,iCAAmB,EAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC/C;IAED,OAAO,uBAAC,oBAAK,eAAK,KAAK,EAAI,CAAC;AAC9B,CAAC;AAND,8BAMC","sourcesContent":["import { setActiveEventRoute } from './activeEvent';\nimport { Route } from './dependencies';\nimport type { ReactRouterV4V5RouteProps } from './types';\n\nexport function FaroRoute(props: ReactRouterV4V5RouteProps) {\n if (props?.computedMatch?.isExact) {\n setActiveEventRoute(props.computedMatch.path);\n }\n\n return <Route {...props} />;\n}\n"]}
1
+ {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAoD;AACpD,2DAA6C;AAG7C,SAAgB,SAAS,CAAC,KAAgC;;IACxD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EAAE;QACjC,IAAA,iCAAmB,EAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC/C;IAED,OAAO,uBAAC,0BAAK,eAAK,KAAK,EAAI,CAAC;AAC9B,CAAC;AAND,8BAMC","sourcesContent":["import { setActiveEventRoute } from './activeEvent';\nimport { Route } from './routerDependencies';\nimport type { ReactRouterV4V5RouteProps } from './types';\n\nexport function FaroRoute(props: ReactRouterV4V5RouteProps) {\n if (props?.computedMatch?.isExact) {\n setActiveEventRoute(props.computedMatch.path);\n }\n\n return <Route {...props} />;\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendActiveEvent = exports.setActiveEventRoute = exports.createNewActiveEvent = exports.activeEvent = void 0;
4
- var dependencies_1 = require("./dependencies");
4
+ var dependencies_1 = require("../../dependencies");
5
5
  exports.activeEvent = undefined;
6
6
  function createNewActiveEvent(url) {
7
7
  exports.activeEvent = {
8
- url: url,
9
8
  route: '',
9
+ url: url,
10
10
  };
11
11
  return exports.activeEvent;
12
12
  }
@@ -18,7 +18,7 @@ function setActiveEventRoute(route) {
18
18
  }
19
19
  exports.setActiveEventRoute = setActiveEventRoute;
20
20
  function sendActiveEvent() {
21
- dependencies_1.faro.api.pushEvent('routeChange', exports.activeEvent, undefined, { skipDedupe: true });
21
+ dependencies_1.api.pushEvent('routeChange', exports.activeEvent, undefined, { skipDedupe: true });
22
22
  exports.activeEvent = undefined;
23
23
  }
24
24
  exports.sendActiveEvent = sendActiveEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"activeEvent.js","sourceRoot":"","sources":["../../../../src/router/v4v5/activeEvent.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AAG3B,QAAA,WAAW,GAA2C,SAAS,CAAC;AAE3E,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,mBAAW,GAAG;QACZ,GAAG,KAAA;QACH,KAAK,EAAE,EAAE;KACV,CAAC;IAEF,OAAO,mBAAW,CAAC;AACrB,CAAC;AAPD,oDAOC;AAED,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,IAAI,mBAAW,EAAE;QACf,mBAAW,CAAC,KAAK,GAAG,KAAK,CAAC;KAC3B;AACH,CAAC;AAJD,kDAIC;AAED,SAAgB,eAAe;IAC7B,mBAAI,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,EAAE,mBAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhF,mBAAW,GAAG,SAAS,CAAC;AAC1B,CAAC;AAJD,0CAIC","sourcesContent":["import { faro } from './dependencies';\nimport type { ReactRouterV4V5ActiveEvent } from './types';\n\nexport let activeEvent: ReactRouterV4V5ActiveEvent | undefined = undefined;\n\nexport function createNewActiveEvent(url: string): ReactRouterV4V5ActiveEvent {\n activeEvent = {\n url,\n route: '',\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 faro.api.pushEvent('routeChange', activeEvent, undefined, { skipDedupe: true });\n\n activeEvent = undefined;\n}\n"]}
1
+ {"version":3,"file":"activeEvent.js","sourceRoot":"","sources":["../../../../src/router/v4v5/activeEvent.ts"],"names":[],"mappings":";;;AAAA,mDAAyC;AAI9B,QAAA,WAAW,GAA2C,SAAS,CAAC;AAE3E,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,mBAAW,GAAG;QACZ,KAAK,EAAE,EAAE;QACT,GAAG,KAAA;KACJ,CAAC;IAEF,OAAO,mBAAW,CAAC;AACrB,CAAC;AAPD,oDAOC;AAED,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,IAAI,mBAAW,EAAE;QACf,mBAAW,CAAC,KAAK,GAAG,KAAK,CAAC;KAC3B;AACH,CAAC;AAJD,kDAIC;AAED,SAAgB,eAAe;IAC7B,kBAAG,CAAC,SAAS,CAAC,aAAa,EAAE,mBAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAE3E,mBAAW,GAAG,SAAS,CAAC;AAC1B,CAAC;AAJD,0CAIC","sourcesContent":["import { 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('routeChange', activeEvent, undefined, { skipDedupe: true });\n\n activeEvent = undefined;\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeReactRouterV4V5Instrumentation = exports.FaroRoute = exports.setReactRouterV4V5SSRDependencies = void 0;
4
- var dependencies_1 = require("./dependencies");
5
- Object.defineProperty(exports, "setReactRouterV4V5SSRDependencies", { enumerable: true, get: function () { return dependencies_1.setReactRouterV4V5SSRDependencies; } });
3
+ exports.setReactRouterV4V5SSRDependencies = exports.initializeReactRouterV4V5Instrumentation = exports.FaroRoute = void 0;
6
4
  var FaroRoute_1 = require("./FaroRoute");
7
5
  Object.defineProperty(exports, "FaroRoute", { enumerable: true, get: function () { return FaroRoute_1.FaroRoute; } });
8
6
  var initialize_1 = require("./initialize");
9
7
  Object.defineProperty(exports, "initializeReactRouterV4V5Instrumentation", { enumerable: true, get: function () { return initialize_1.initializeReactRouterV4V5Instrumentation; } });
8
+ var routerDependencies_1 = require("./routerDependencies");
9
+ Object.defineProperty(exports, "setReactRouterV4V5SSRDependencies", { enumerable: true, get: function () { return routerDependencies_1.setReactRouterV4V5SSRDependencies; } });
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/router/v4v5/index.ts"],"names":[],"mappings":";;;AAAA,+CAAmE;AAA1D,iIAAA,iCAAiC,OAAA;AAE1C,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,2CAAwE;AAA/D,sIAAA,wCAAwC,OAAA","sourcesContent":["export { setReactRouterV4V5SSRDependencies } from './dependencies';\n\nexport { FaroRoute } from './FaroRoute';\n\nexport { initializeReactRouterV4V5Instrumentation } from './initialize';\n\nexport type { ReactRouterV4V5ActiveEvent, ReactRouterV4V5Dependencies, ReactRouterV4V5RouteShape } from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/router/v4v5/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,2CAAwE;AAA/D,sIAAA,wCAAwC,OAAA;AAEjD,2DAAyE;AAAhE,uIAAA,iCAAiC,OAAA","sourcesContent":["export { FaroRoute } from './FaroRoute';\n\nexport { initializeReactRouterV4V5Instrumentation } from './initialize';\n\nexport { setReactRouterV4V5SSRDependencies } from './routerDependencies';\n\nexport type { ReactRouterV4V5ActiveEvent, ReactRouterV4V5Dependencies, ReactRouterV4V5RouteShape } from './types';\n"]}
@@ -8,15 +8,15 @@ var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics
8
8
  var faro_web_sdk_1 = require("@grafana/faro-web-sdk");
9
9
  var types_1 = require("../types");
10
10
  var activeEvent_1 = require("./activeEvent");
11
- var dependencies_1 = require("./dependencies");
12
11
  var FaroRoute_1 = require("./FaroRoute");
13
- function initializeReactRouterV4V5Instrumentation(dependencies, faro) {
12
+ var routerDependencies_1 = require("./routerDependencies");
13
+ function initializeReactRouterV4V5Instrumentation(dependencies) {
14
14
  var _a, _b, _c, _d;
15
15
  var Route = dependencies.Route;
16
16
  var componentDisplayName = (_a = Route.displayName) !== null && _a !== void 0 ? _a : Route.name;
17
17
  FaroRoute_1.FaroRoute.displayName = "faroRoute(".concat(componentDisplayName, ")");
18
18
  (0, hoist_non_react_statics_1.default)(FaroRoute_1.FaroRoute, Route);
19
- (0, dependencies_1.setDependencies)(dependencies, faro);
19
+ (0, routerDependencies_1.setReactRouterV4V5Dependencies)(dependencies);
20
20
  (0, activeEvent_1.createNewActiveEvent)((_b = faro_web_sdk_1.globalObject.location) === null || _b === void 0 ? void 0 : _b.href);
21
21
  (_d = (_c = dependencies.history).listen) === null || _d === void 0 ? void 0 : _d.call(_c, function (_location, action) {
22
22
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v4v5/initialize.ts"],"names":[],"mappings":";;;;;;AAAA,oFAA2D;AAG3D,sDAAqD;AAGrD,kCAA0C;AAC1C,6CAAsE;AACtE,+CAAiD;AACjD,yCAAwC;AAGxC,SAAgB,wCAAwC,CAAC,YAAyC,EAAE,IAAU;;IAC5G,IAAM,KAAK,GAAG,YAAY,CAAC,KAA0B,CAAC;IACtD,IAAM,oBAAoB,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,KAAK,CAAC,IAAI,CAAC;IAC5D,qBAA+B,CAAC,WAAW,GAAG,oBAAa,oBAAoB,MAAG,CAAC;IACpF,IAAA,iCAAoB,EAAC,qBAAS,EAAE,KAAK,CAAC,CAAC;IAEvC,IAAA,8BAAe,EAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAEpC,IAAA,kCAAoB,EAAC,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;IAElD,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,MAAM,mDAAG,UAAC,SAAS,EAAE,MAAM;;QAC9C,IAAI,MAAM,KAAK,sBAAc,CAAC,IAAI,IAAI,MAAM,KAAK,sBAAc,CAAC,GAAG,EAAE;YACnE,IAAA,6BAAe,GAAE,CAAC;YAElB,IAAA,kCAAoB,EAAC,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;SACnD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,4FAiBC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { FunctionComponent } from 'react';\n\nimport { globalObject } from '@grafana/faro-web-sdk';\nimport type { Faro } from '@grafana/faro-web-sdk';\n\nimport { NavigationType } from '../types';\nimport { createNewActiveEvent, sendActiveEvent } from './activeEvent';\nimport { setDependencies } from './dependencies';\nimport { FaroRoute } from './FaroRoute';\nimport type { ReactRouterV4V5Dependencies } from './types';\n\nexport function initializeReactRouterV4V5Instrumentation(dependencies: ReactRouterV4V5Dependencies, faro: Faro): void {\n const Route = dependencies.Route as FunctionComponent;\n const componentDisplayName = Route.displayName ?? Route.name;\n (FaroRoute as FunctionComponent).displayName = `faroRoute(${componentDisplayName})`;\n hoistNonReactStatics(FaroRoute, Route);\n\n setDependencies(dependencies, faro);\n\n createNewActiveEvent(globalObject.location?.href);\n\n dependencies.history.listen?.((_location, action) => {\n if (action === NavigationType.Push || action === NavigationType.Pop) {\n sendActiveEvent();\n\n createNewActiveEvent(globalObject.location?.href);\n }\n });\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v4v5/initialize.ts"],"names":[],"mappings":";;;;;;AAAA,oFAA2D;AAG3D,sDAAqD;AAErD,kCAA0C;AAE1C,6CAAsE;AACtE,yCAAwC;AACxC,2DAAsE;AAGtE,SAAgB,wCAAwC,CAAC,YAAyC;;IAChG,IAAM,KAAK,GAAG,YAAY,CAAC,KAA0B,CAAC;IACtD,IAAM,oBAAoB,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,KAAK,CAAC,IAAI,CAAC;IAC5D,qBAA+B,CAAC,WAAW,GAAG,oBAAa,oBAAoB,MAAG,CAAC;IACpF,IAAA,iCAAoB,EAAC,qBAAS,EAAE,KAAK,CAAC,CAAC;IAEvC,IAAA,mDAA8B,EAAC,YAAY,CAAC,CAAC;IAE7C,IAAA,kCAAoB,EAAC,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;IAElD,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,MAAM,mDAAG,UAAC,SAAS,EAAE,MAAM;;QAC9C,IAAI,MAAM,KAAK,sBAAc,CAAC,IAAI,IAAI,MAAM,KAAK,sBAAc,CAAC,GAAG,EAAE;YACnE,IAAA,6BAAe,GAAE,CAAC;YAElB,IAAA,kCAAoB,EAAC,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;SACnD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,4FAiBC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { FunctionComponent } from 'react';\n\nimport { globalObject } from '@grafana/faro-web-sdk';\n\nimport { NavigationType } from '../types';\n\nimport { createNewActiveEvent, sendActiveEvent } from './activeEvent';\nimport { FaroRoute } from './FaroRoute';\nimport { setReactRouterV4V5Dependencies } from './routerDependencies';\nimport type { ReactRouterV4V5Dependencies } from './types';\n\nexport function initializeReactRouterV4V5Instrumentation(dependencies: ReactRouterV4V5Dependencies): void {\n const Route = dependencies.Route as FunctionComponent;\n const componentDisplayName = Route.displayName ?? Route.name;\n (FaroRoute as FunctionComponent).displayName = `faroRoute(${componentDisplayName})`;\n hoistNonReactStatics(FaroRoute, Route);\n\n setReactRouterV4V5Dependencies(dependencies);\n\n createNewActiveEvent(globalObject.location?.href);\n\n dependencies.history.listen?.((_location, action) => {\n if (action === NavigationType.Push || action === NavigationType.Pop) {\n sendActiveEvent();\n\n createNewActiveEvent(globalObject.location?.href);\n }\n });\n}\n"]}
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setReactRouterV4V5SSRDependencies = exports.setDependencies = exports.Route = exports.history = exports.faro = exports.isInitialized = void 0;
3
+ exports.setReactRouterV4V5SSRDependencies = exports.setReactRouterV4V5Dependencies = exports.Route = exports.history = exports.isInitialized = void 0;
4
4
  exports.isInitialized = false;
5
- function setDependencies(dependencies, newFaro) {
5
+ function setReactRouterV4V5Dependencies(dependencies) {
6
6
  exports.isInitialized = true;
7
- exports.faro = newFaro;
8
7
  exports.history = dependencies.history;
9
8
  exports.Route = dependencies.Route;
10
9
  }
11
- exports.setDependencies = setDependencies;
10
+ exports.setReactRouterV4V5Dependencies = setReactRouterV4V5Dependencies;
12
11
  function setReactRouterV4V5SSRDependencies(newDependencies) {
13
12
  exports.Route = newDependencies.Route;
14
13
  }
15
14
  exports.setReactRouterV4V5SSRDependencies = setReactRouterV4V5SSRDependencies;
16
- //# sourceMappingURL=dependencies.js.map
15
+ //# sourceMappingURL=routerDependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routerDependencies.js","sourceRoot":"","sources":["../../../../src/router/v4v5/routerDependencies.ts"],"names":[],"mappings":";;;AAIW,QAAA,aAAa,GAAG,KAAK,CAAC;AAIjC,SAAgB,8BAA8B,CAAC,YAAyC;IACtF,qBAAa,GAAG,IAAI,CAAC;IAErB,eAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IAC/B,aAAK,GAAG,YAAY,CAAC,KAAK,CAAC;AAC7B,CAAC;AALD,wEAKC;AAED,SAAgB,iCAAiC,CAAC,eAA2D;IAC3G,aAAK,GAAG,eAAe,CAAC,KAAK,CAAC;AAChC,CAAC;AAFD,8EAEC","sourcesContent":["import type { ReactRouterHistory } from '../types';\n\nimport type { ReactRouterV4V5Dependencies, ReactRouterV4V5RouteShape } from './types';\n\nexport let isInitialized = false;\nexport let history: ReactRouterHistory;\nexport let Route: ReactRouterV4V5RouteShape;\n\nexport function setReactRouterV4V5Dependencies(dependencies: ReactRouterV4V5Dependencies): void {\n isInitialized = true;\n\n history = dependencies.history;\n Route = dependencies.Route;\n}\n\nexport function setReactRouterV4V5SSRDependencies(newDependencies: Pick<ReactRouterV4V5Dependencies, 'Route'>): void {\n Route = newDependencies.Route;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/router/v4v5/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactRouterHistory } from '../types';\n\nexport type ReactRouterV4V5RouteShape = any;\n\nexport interface ReactRouterV4V5RouteProps extends Record<string, any> {\n computedMatch?: {\n isExact: boolean;\n path: string;\n };\n}\n\nexport interface ReactRouterV4V5Dependencies {\n history: ReactRouterHistory;\n Route: ReactRouterV4V5RouteShape;\n}\n\nexport interface ReactRouterV4V5ActiveEvent extends Record<string, string> {\n url: string;\n route: string;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/router/v4v5/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactRouterHistory } from '../types';\n\nexport type ReactRouterV4V5RouteShape = any;\n\nexport interface ReactRouterV4V5RouteProps extends Record<string, any> {\n computedMatch?: {\n isExact: boolean;\n path: string;\n };\n}\n\nexport interface ReactRouterV4V5Dependencies {\n history: ReactRouterHistory;\n Route: ReactRouterV4V5RouteShape;\n}\n\nexport interface ReactRouterV4V5ActiveEvent extends Record<string, string> {\n route: string;\n url: string;\n}\n"]}
@@ -15,24 +15,25 @@ exports.FaroRoutes = void 0;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var react_1 = require("react");
17
17
  var faro_web_sdk_1 = require("@grafana/faro-web-sdk");
18
+ var dependencies_1 = require("../../dependencies");
18
19
  var types_1 = require("../types");
19
- var dependencies_1 = require("./dependencies");
20
+ var routerDependencies_1 = require("./routerDependencies");
20
21
  var utils_1 = require("./utils");
21
22
  function FaroRoutes(props) {
22
23
  var _a;
23
- var location = dependencies_1.useLocation === null || dependencies_1.useLocation === void 0 ? void 0 : (0, dependencies_1.useLocation)();
24
- var navigationType = dependencies_1.useNavigationType === null || dependencies_1.useNavigationType === void 0 ? void 0 : (0, dependencies_1.useNavigationType)();
25
- var routes = (0, react_1.useMemo)(function () { var _a; return (_a = dependencies_1.createRoutesFromChildren === null || dependencies_1.createRoutesFromChildren === void 0 ? void 0 : (0, dependencies_1.createRoutesFromChildren)(props.children)) !== null && _a !== void 0 ? _a : []; }, [props.children]);
24
+ var location = routerDependencies_1.useLocation === null || routerDependencies_1.useLocation === void 0 ? void 0 : (0, routerDependencies_1.useLocation)();
25
+ var navigationType = routerDependencies_1.useNavigationType === null || routerDependencies_1.useNavigationType === void 0 ? void 0 : (0, routerDependencies_1.useNavigationType)();
26
+ var routes = (0, react_1.useMemo)(function () { var _a; return (_a = routerDependencies_1.createRoutesFromChildren === null || routerDependencies_1.createRoutesFromChildren === void 0 ? void 0 : (0, routerDependencies_1.createRoutesFromChildren)(props.children)) !== null && _a !== void 0 ? _a : []; }, [props.children]);
26
27
  (0, react_1.useEffect)(function () {
27
28
  var _a;
28
- if (dependencies_1.isInitialized && (navigationType === types_1.NavigationType.Push || navigationType === types_1.NavigationType.Pop)) {
29
- dependencies_1.faro.api.pushEvent('routeChange', {
30
- url: (_a = faro_web_sdk_1.globalObject.location) === null || _a === void 0 ? void 0 : _a.href,
29
+ if (routerDependencies_1.isInitialized && (navigationType === types_1.NavigationType.Push || navigationType === types_1.NavigationType.Pop)) {
30
+ dependencies_1.api.pushEvent('routeChange', {
31
31
  route: (0, utils_1.getRouteFromLocation)(routes, location),
32
+ url: (_a = faro_web_sdk_1.globalObject.location) === null || _a === void 0 ? void 0 : _a.href,
32
33
  });
33
34
  }
34
35
  }, [location, navigationType, routes]);
35
- var ActualRoutes = (_a = props.routesComponent) !== null && _a !== void 0 ? _a : dependencies_1.Routes;
36
+ var ActualRoutes = (_a = props.routesComponent) !== null && _a !== void 0 ? _a : routerDependencies_1.Routes;
36
37
  return (0, jsx_runtime_1.jsx)(ActualRoutes, __assign({}, props));
37
38
  }
38
39
  exports.FaroRoutes = FaroRoutes;
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoutes.js","sourceRoot":"","sources":["../../../../src/router/v6/FaroRoutes.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,sDAAqD;AAErD,kCAA0C;AAC1C,+CAAuH;AAEvH,iCAA+C;AAE/C,SAAgB,UAAU,CAAC,KAA+B;;IACxD,IAAM,QAAQ,GAAG,0BAAW,aAAX,0BAAW,2BAAX,0BAAW,GAAI,CAAC;IACjC,IAAM,cAAc,GAAG,gCAAiB,aAAjB,gCAAiB,2BAAjB,gCAAiB,GAAI,CAAC;IAE7C,IAAM,MAAM,GAAG,IAAA,eAAO,EAAC,sBAAM,OAAA,MAAA,uCAAwB,aAAxB,uCAAwB,2BAAxB,uCAAwB,EAAG,KAAK,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAA,EAAA,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEjG,IAAA,iBAAS,EAAC;;QACR,IAAI,4BAAa,IAAI,CAAC,cAAc,KAAK,sBAAc,CAAC,IAAI,IAAI,cAAc,KAAK,sBAAc,CAAC,GAAG,CAAC,EAAE;YACtG,mBAAI,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,EAAE;gBAChC,GAAG,EAAE,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI;gBAChC,KAAK,EAAE,IAAA,4BAAoB,EAAC,MAAM,EAAE,QAAQ,CAAC;aAC9C,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvC,IAAM,YAAY,GAAG,MAAA,KAAK,CAAC,eAAe,mCAAI,qBAAM,CAAC;IAErD,OAAO,uBAAC,YAAY,eAAK,KAAK,EAAI,CAAC;AACrC,CAAC;AAlBD,gCAkBC","sourcesContent":["import { useEffect, useMemo } from 'react';\n\nimport { globalObject } from '@grafana/faro-web-sdk';\n\nimport { NavigationType } from '../types';\nimport { createRoutesFromChildren, faro, isInitialized, Routes, useLocation, useNavigationType } from './dependencies';\nimport type { ReactRouterV6RoutesProps } from './types';\nimport { getRouteFromLocation } from './utils';\n\nexport function FaroRoutes(props: ReactRouterV6RoutesProps) {\n const location = useLocation?.();\n const navigationType = useNavigationType?.();\n\n const routes = useMemo(() => createRoutesFromChildren?.(props.children) ?? [], [props.children]);\n\n useEffect(() => {\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n faro.api.pushEvent('routeChange', {\n url: globalObject.location?.href,\n route: getRouteFromLocation(routes, location),\n });\n }\n }, [location, navigationType, routes]);\n\n const ActualRoutes = props.routesComponent ?? Routes;\n\n return <ActualRoutes {...props} />;\n}\n"]}
1
+ {"version":3,"file":"FaroRoutes.js","sourceRoot":"","sources":["../../../../src/router/v6/FaroRoutes.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,sDAAqD;AAErD,mDAAyC;AACzC,kCAA0C;AAE1C,2DAAuH;AAEvH,iCAA+C;AAE/C,SAAgB,UAAU,CAAC,KAA+B;;IACxD,IAAM,QAAQ,GAAG,gCAAW,aAAX,gCAAW,2BAAX,gCAAW,GAAI,CAAC;IACjC,IAAM,cAAc,GAAG,sCAAiB,aAAjB,sCAAiB,2BAAjB,sCAAiB,GAAI,CAAC;IAE7C,IAAM,MAAM,GAAG,IAAA,eAAO,EAAC,sBAAM,OAAA,MAAA,6CAAwB,aAAxB,6CAAwB,2BAAxB,6CAAwB,EAAG,KAAK,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAA,EAAA,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEjG,IAAA,iBAAS,EAAC;;QACR,IAAI,kCAAa,IAAI,CAAC,cAAc,KAAK,sBAAc,CAAC,IAAI,IAAI,cAAc,KAAK,sBAAc,CAAC,GAAG,CAAC,EAAE;YACtG,kBAAG,CAAC,SAAS,CAAC,aAAa,EAAE;gBAC3B,KAAK,EAAE,IAAA,4BAAoB,EAAC,MAAM,EAAE,QAAQ,CAAC;gBAC7C,GAAG,EAAE,MAAA,2BAAY,CAAC,QAAQ,0CAAE,IAAI;aACjC,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvC,IAAM,YAAY,GAAG,MAAA,KAAK,CAAC,eAAe,mCAAI,2BAAM,CAAC;IAErD,OAAO,uBAAC,YAAY,eAAK,KAAK,EAAI,CAAC;AACrC,CAAC;AAlBD,gCAkBC","sourcesContent":["import { useEffect, useMemo } from 'react';\n\nimport { globalObject } from '@grafana/faro-web-sdk';\n\nimport { api } from '../../dependencies';\nimport { NavigationType } from '../types';\n\nimport { createRoutesFromChildren, isInitialized, Routes, useLocation, useNavigationType } from './routerDependencies';\nimport type { ReactRouterV6RoutesProps } from './types';\nimport { getRouteFromLocation } from './utils';\n\nexport function FaroRoutes(props: ReactRouterV6RoutesProps) {\n const location = useLocation?.();\n const navigationType = useNavigationType?.();\n\n const routes = useMemo(() => createRoutesFromChildren?.(props.children) ?? [], [props.children]);\n\n useEffect(() => {\n if (isInitialized && (navigationType === NavigationType.Push || navigationType === NavigationType.Pop)) {\n api.pushEvent('routeChange', {\n route: getRouteFromLocation(routes, location),\n url: globalObject.location?.href,\n });\n }\n }, [location, navigationType, routes]);\n\n const ActualRoutes = props.routesComponent ?? Routes;\n\n return <ActualRoutes {...props} />;\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeReactRouterV6Instrumentation = exports.FaroRoutes = exports.setReactRouterV6SSRDependencies = void 0;
4
- var dependencies_1 = require("./dependencies");
5
- Object.defineProperty(exports, "setReactRouterV6SSRDependencies", { enumerable: true, get: function () { return dependencies_1.setReactRouterV6SSRDependencies; } });
3
+ exports.setReactRouterV6SSRDependencies = exports.initializeReactRouterV6Instrumentation = exports.FaroRoutes = void 0;
6
4
  var FaroRoutes_1 = require("./FaroRoutes");
7
5
  Object.defineProperty(exports, "FaroRoutes", { enumerable: true, get: function () { return FaroRoutes_1.FaroRoutes; } });
8
6
  var initialize_1 = require("./initialize");
9
7
  Object.defineProperty(exports, "initializeReactRouterV6Instrumentation", { enumerable: true, get: function () { return initialize_1.initializeReactRouterV6Instrumentation; } });
8
+ var routerDependencies_1 = require("./routerDependencies");
9
+ Object.defineProperty(exports, "setReactRouterV6SSRDependencies", { enumerable: true, get: function () { return routerDependencies_1.setReactRouterV6SSRDependencies; } });
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/router/v6/index.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AAAxD,+HAAA,+BAA+B,OAAA;AAExC,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAEnB,2CAAsE;AAA7D,oIAAA,sCAAsC,OAAA","sourcesContent":["export { setReactRouterV6SSRDependencies } from './dependencies';\n\nexport { FaroRoutes } from './FaroRoutes';\n\nexport { initializeReactRouterV6Instrumentation } from './initialize';\n\nexport type {\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6Params,\n ReactRouterV6RouteMatch,\n ReactRouterV6RouteObject,\n ReactRouterV6RoutesProps,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/router/v6/index.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAEnB,2CAAsE;AAA7D,oIAAA,sCAAsC,OAAA;AAE/C,2DAAuE;AAA9D,qIAAA,+BAA+B,OAAA","sourcesContent":["export { FaroRoutes } from './FaroRoutes';\n\nexport { initializeReactRouterV6Instrumentation } from './initialize';\n\nexport { setReactRouterV6SSRDependencies } from './routerDependencies';\n\nexport type {\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6Params,\n ReactRouterV6RouteMatch,\n ReactRouterV6RouteObject,\n ReactRouterV6RoutesProps,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './types';\n"]}
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.initializeReactRouterV6Instrumentation = void 0;
7
7
  var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
8
- var dependencies_1 = require("./dependencies");
9
8
  var FaroRoutes_1 = require("./FaroRoutes");
10
- function initializeReactRouterV6Instrumentation(dependencies, faro) {
9
+ var routerDependencies_1 = require("./routerDependencies");
10
+ function initializeReactRouterV6Instrumentation(dependencies) {
11
11
  (0, hoist_non_react_statics_1.default)(FaroRoutes_1.FaroRoutes, dependencies.Routes);
12
- (0, dependencies_1.setDependencies)(dependencies, faro);
12
+ (0, routerDependencies_1.setReactRouterV6Dependencies)(dependencies);
13
13
  }
14
14
  exports.initializeReactRouterV6Instrumentation = initializeReactRouterV6Instrumentation;
15
15
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v6/initialize.ts"],"names":[],"mappings":";;;;;;AAAA,oFAA2D;AAI3D,+CAAiD;AACjD,2CAA0C;AAG1C,SAAgB,sCAAsC,CAAC,YAAuC,EAAE,IAAU;IACxG,IAAA,iCAAoB,EAAC,uBAAU,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAEtD,IAAA,8BAAe,EAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC;AAJD,wFAIC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport type { Faro } from '@grafana/faro-web-sdk';\n\nimport { setDependencies } from './dependencies';\nimport { FaroRoutes } from './FaroRoutes';\nimport type { ReactRouterV6Dependencies } from './types';\n\nexport function initializeReactRouterV6Instrumentation(dependencies: ReactRouterV6Dependencies, faro: Faro): void {\n hoistNonReactStatics(FaroRoutes, dependencies.Routes);\n\n setDependencies(dependencies, faro);\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v6/initialize.ts"],"names":[],"mappings":";;;;;;AAAA,oFAA2D;AAE3D,2CAA0C;AAC1C,2DAAoE;AAGpE,SAAgB,sCAAsC,CAAC,YAAuC;IAC5F,IAAA,iCAAoB,EAAC,uBAAU,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAEtD,IAAA,iDAA4B,EAAC,YAAY,CAAC,CAAC;AAC7C,CAAC;AAJD,wFAIC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\n\nimport { FaroRoutes } from './FaroRoutes';\nimport { setReactRouterV6Dependencies } from './routerDependencies';\nimport type { ReactRouterV6Dependencies } from './types';\n\nexport function initializeReactRouterV6Instrumentation(dependencies: ReactRouterV6Dependencies): void {\n hoistNonReactStatics(FaroRoutes, dependencies.Routes);\n\n setReactRouterV6Dependencies(dependencies);\n}\n"]}
@@ -1,19 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setReactRouterV6SSRDependencies = exports.setDependencies = exports.useNavigationType = exports.useLocation = exports.Routes = exports.matchRoutes = exports.createRoutesFromChildren = exports.faro = exports.isInitialized = void 0;
3
+ exports.setReactRouterV6SSRDependencies = exports.setReactRouterV6Dependencies = exports.useNavigationType = exports.useLocation = exports.Routes = exports.matchRoutes = exports.createRoutesFromChildren = exports.isInitialized = void 0;
4
4
  exports.isInitialized = false;
5
- function setDependencies(newDependencies, newFaro) {
5
+ function setReactRouterV6Dependencies(newDependencies) {
6
6
  exports.isInitialized = true;
7
- exports.faro = newFaro;
8
7
  exports.createRoutesFromChildren = newDependencies.createRoutesFromChildren;
9
8
  exports.matchRoutes = newDependencies.matchRoutes;
10
9
  exports.Routes = newDependencies.Routes;
11
10
  exports.useLocation = newDependencies.useLocation;
12
11
  exports.useNavigationType = newDependencies.useNavigationType;
13
12
  }
14
- exports.setDependencies = setDependencies;
13
+ exports.setReactRouterV6Dependencies = setReactRouterV6Dependencies;
15
14
  function setReactRouterV6SSRDependencies(newDependencies) {
16
15
  exports.Routes = newDependencies.Routes;
17
16
  }
18
17
  exports.setReactRouterV6SSRDependencies = setReactRouterV6SSRDependencies;
19
- //# sourceMappingURL=dependencies.js.map
18
+ //# sourceMappingURL=routerDependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routerDependencies.js","sourceRoot":"","sources":["../../../../src/router/v6/routerDependencies.ts"],"names":[],"mappings":";;;AASW,QAAA,aAAa,GAAG,KAAK,CAAC;AAOjC,SAAgB,4BAA4B,CAAC,eAA0C;IACrF,qBAAa,GAAG,IAAI,CAAC;IAErB,gCAAwB,GAAG,eAAe,CAAC,wBAAwB,CAAC;IACpE,mBAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,cAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAChC,mBAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,yBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;AACxD,CAAC;AARD,oEAQC;AAED,SAAgB,+BAA+B,CAAC,eAA0D;IACxG,cAAM,GAAG,eAAe,CAAC,MAAM,CAAC;AAClC,CAAC;AAFD,0EAEC","sourcesContent":["import type {\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './types';\n\nexport let isInitialized = false;\nexport let createRoutesFromChildren: ReactRouterV6CreateRoutesFromChildren;\nexport let matchRoutes: ReactRouterV6MatchRoutes;\nexport let Routes: ReactRouterV6RoutesShape;\nexport let useLocation: ReactRouterV6UseLocation;\nexport let useNavigationType: ReactRouterV6UseNavigationType;\n\nexport function setReactRouterV6Dependencies(newDependencies: ReactRouterV6Dependencies): void {\n isInitialized = true;\n\n createRoutesFromChildren = newDependencies.createRoutesFromChildren;\n matchRoutes = newDependencies.matchRoutes;\n Routes = newDependencies.Routes;\n useLocation = newDependencies.useLocation;\n useNavigationType = newDependencies.useNavigationType;\n}\n\nexport function setReactRouterV6SSRDependencies(newDependencies: Pick<ReactRouterV6Dependencies, 'Routes'>): void {\n Routes = newDependencies.Routes;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRouteFromLocation = exports.getNumberOfUrlSegments = void 0;
4
- var dependencies_1 = require("./dependencies");
4
+ var routerDependencies_1 = require("./routerDependencies");
5
5
  function getNumberOfUrlSegments(url) {
6
6
  return url.split(/\\?\//).filter(function (currentSegment) { return currentSegment.length > 0 && currentSegment !== ','; }).length;
7
7
  }
@@ -10,7 +10,7 @@ function getRouteFromLocation(routes, location) {
10
10
  if (!routes || routes.length === 0) {
11
11
  return location.pathname;
12
12
  }
13
- var matchedRoutes = (0, dependencies_1.matchRoutes)(routes, location);
13
+ var matchedRoutes = (0, routerDependencies_1.matchRoutes)(routes, location);
14
14
  var pathBuilder = '';
15
15
  if (matchedRoutes) {
16
16
  for (var x = 0; x < matchedRoutes.length; x++) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/router/v6/utils.ts"],"names":[],"mappings":";;;AACA,+CAA6C;AAG7C,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC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iBACF;aACF;SACF;KACF;IAED,OAAO,QAAQ,CAAC,QAAQ,CAAC;AAC3B,CAAC;AAvCD,oDAuCC","sourcesContent":["import type { ReactRouterLocation } from '../types';\nimport { matchRoutes } from './dependencies';\nimport type { ReactRouterV6RouteObject } from './types';\n\nexport function getNumberOfUrlSegments(url: string): number {\n return url.split(/\\\\?\\//).filter((currentSegment) => currentSegment.length > 0 && currentSegment !== ',').length;\n}\n\nexport function getRouteFromLocation(routes: ReactRouterV6RouteObject[], location: ReactRouterLocation): string {\n if (!routes || routes.length === 0) {\n return location.pathname;\n }\n\n const matchedRoutes = matchRoutes(routes, location);\n\n let pathBuilder = '';\n\n if (matchedRoutes) {\n for (let x = 0; x < matchedRoutes.length; x++) {\n const branch = matchedRoutes[x]!;\n const route = branch.route;\n\n if (route) {\n if (route.index) {\n return branch.pathname;\n }\n\n let path = route.path;\n\n if (path) {\n path = path.startsWith('/') ? path : `/${path}`;\n\n pathBuilder += path;\n\n if (branch.pathname === location.pathname) {\n if (getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname)) {\n return path;\n }\n\n return pathBuilder;\n }\n }\n }\n }\n }\n\n return location.pathname;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/router/v6/utils.ts"],"names":[],"mappings":";;;AAEA,2DAAmD;AAGnD,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,UAAC,cAAc,IAAK,OAAA,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,KAAK,GAAG,EAAnD,CAAmD,CAAC,CAAC,MAAM,CAAC;AACnH,CAAC;AAFD,wDAEC;AAED,SAAgB,oBAAoB,CAAC,MAAkC,EAAE,QAA6B;IACpG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QAClC,OAAO,QAAQ,CAAC,QAAQ,CAAC;KAC1B;IAED,IAAM,aAAa,GAAG,IAAA,gCAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,IAAI,WAAW,GAAG,EAAE,CAAC;IAErB,IAAI,aAAa,EAAE;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,IAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAE,CAAC;YACjC,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAE3B,IAAI,KAAK,EAAE;gBACT,IAAI,KAAK,CAAC,KAAK,EAAE;oBACf,OAAO,MAAM,CAAC,QAAQ,CAAC;iBACxB;gBAED,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;gBAEtB,IAAI,IAAI,EAAE;oBACR,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAI,IAAI,CAAE,CAAC;oBAEhD,WAAW,IAAI,IAAI,CAAC;oBAEpB,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,EAAE;wBACzC,IAAI,sBAAsB,CAAC,WAAW,CAAC,KAAK,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;4BACnF,OAAO,IAAI,CAAC;yBACb;wBAED,OAAO,WAAW,CAAC;qBACpB;iBACF;aACF;SACF;KACF;IAED,OAAO,QAAQ,CAAC,QAAQ,CAAC;AAC3B,CAAC;AAvCD,oDAuCC","sourcesContent":["import type { ReactRouterLocation } from '../types';\n\nimport { matchRoutes } from './routerDependencies';\nimport type { ReactRouterV6RouteObject } from './types';\n\nexport function getNumberOfUrlSegments(url: string): number {\n return url.split(/\\\\?\\//).filter((currentSegment) => currentSegment.length > 0 && currentSegment !== ',').length;\n}\n\nexport function getRouteFromLocation(routes: ReactRouterV6RouteObject[], location: ReactRouterLocation): string {\n if (!routes || routes.length === 0) {\n return location.pathname;\n }\n\n const matchedRoutes = matchRoutes(routes, location);\n\n let pathBuilder = '';\n\n if (matchedRoutes) {\n for (let x = 0; x < matchedRoutes.length; x++) {\n const branch = matchedRoutes[x]!;\n const route = branch.route;\n\n if (route) {\n if (route.index) {\n return branch.pathname;\n }\n\n let path = route.path;\n\n if (path) {\n path = path.startsWith('/') ? path : `/${path}`;\n\n pathBuilder += path;\n\n if (branch.pathname === location.pathname) {\n if (getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname)) {\n return path;\n }\n\n return pathBuilder;\n }\n }\n }\n }\n }\n\n return location.pathname;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export let internalLogger;
2
+ export let api;
3
+ export function setDependencies(newInternalLogger, newApi) {
4
+ internalLogger = newInternalLogger;
5
+ api = newApi;
6
+ }
7
+ //# sourceMappingURL=dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/dependencies.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAI,cAA8B,CAAC;AAC1C,MAAM,CAAC,IAAI,GAAQ,CAAC;AAEpB,MAAM,UAAU,eAAe,CAAC,iBAAiC,EAAE,MAAW;IAC5E,cAAc,GAAG,iBAAiB,CAAC;IACnC,GAAG,GAAG,MAAM,CAAC;AACf,CAAC","sourcesContent":["import type { API, InternalLogger } from '@grafana/faro-web-sdk';\n\nexport let internalLogger: InternalLogger;\nexport let api: API;\n\nexport function setDependencies(newInternalLogger: InternalLogger, newApi: API): void {\n internalLogger = newInternalLogger;\n api = newApi;\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { Component, isValidElement } from 'react';
2
- import { faro, isFunction } from '@grafana/faro-web-sdk';
2
+ import { isFunction } from '@grafana/faro-web-sdk';
3
+ import { api, internalLogger } from '../dependencies';
3
4
  import { isReactVersionAtLeast17 } from '../utils';
4
5
  import { faroErrorBoundaryInitialState } from './const';
5
6
  export class FaroErrorBoundary extends Component {
@@ -27,7 +28,7 @@ export class FaroErrorBoundary extends Component {
27
28
  var _a, _b, _c, _d;
28
29
  const errorWithComponentStack = this.getErrorWithComponentStack(error, errorInfo);
29
30
  (_b = (_a = this.props).beforeCapture) === null || _b === void 0 ? void 0 : _b.call(_a, errorWithComponentStack);
30
- faro.api.pushError(errorWithComponentStack);
31
+ api.pushError(errorWithComponentStack);
31
32
  (_d = (_c = this.props).onError) === null || _d === void 0 ? void 0 : _d.call(_c, errorWithComponentStack);
32
33
  this.setState({ hasError: true, error });
33
34
  }
@@ -55,7 +56,7 @@ export class FaroErrorBoundary extends Component {
55
56
  return element;
56
57
  }
57
58
  if (this.props.fallback) {
58
- faro.internalLogger.warn('ErrorBoundary\n', 'Cannot get a valid ReactElement from "fallback"');
59
+ internalLogger === null || internalLogger === void 0 ? void 0 : internalLogger.warn('ErrorBoundary\n', 'Cannot get a valid ReactElement from "fallback"');
59
60
  }
60
61
  return null;
61
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FaroErrorBoundary.js","sourceRoot":"","sources":["../../../src/errorBoundary/FaroErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAGxD,MAAM,OAAO,iBAAkB,SAAQ,SAAyD;IAG9F,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QAHN,UAAK,GAA2B,6BAA6B,CAAC;QAKrE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAED,0BAA0B,CAAC,KAAY,EAAE,SAAoB;QAC3D,IAAI,CAAC,uB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CAAC,CAAC;IAC/C,CAAC;IAEQ,MAAM;QACb,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACxB,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;SACtF;QAED,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC9C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;YACrB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEpE,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,OAAO,CAAC;SAChB;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,EAAE,iDAAiD,CAAC,CAAC;SAChG;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Component, isValidElement } from 'react';\nimport type { ErrorInfo, ReactNode } from 'react';\n\nimport { faro, isFunction } from '@grafana/faro-web-sdk';\n\nimport { isReactVersionAtLeast17 } from '../utils';\nimport { faroErrorBoundaryInitialState } from './const';\nimport type { FaroErrorBoundaryProps, FaroErrorBoundaryState } from './types';\n\nexport class FaroErrorBoundary extends Component<FaroErrorBoundaryProps, FaroErrorBoundaryState> {\n override state: FaroErrorBoundaryState = faroErrorBoundaryInitialState;\n\n constructor(props: FaroErrorBoundaryProps) {\n super(props);\n\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n }\n\n getErrorWithComponentStack(error: Error, errorInfo: ErrorInfo): Error {\n if (!isReactVersionAtLeast17 || !errorInfo.componentStack) {\n return error;\n }\n\n const newError = new Error(error.message);\n\n newError.name = `React ErrorBoundary ${error.name}`;\n newError.stack = errorInfo.componentStack;\n\n return newError;\n }\n\n static getDerivedStateFromError(error: Error): FaroErrorBoundaryState {\n return {\n hasError: true,\n error,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n const errorWithComponentStack = this.getErrorWithComponentStack(error, errorInfo);\n\n this.props.beforeCapture?.(errorWithComponentStack);\n\n faro.api.pushError(errorWithComponentStack);\n\n this.props.onError?.(errorWithComponentStack);\n\n this.setState({ hasError: true, error });\n }\n\n override componentDidMount(): void {\n this.props.onMount?.();\n }\n\n override componentWillUnmount(): void {\n this.props.onUnmount?.(this.state.error);\n }\n\n resetErrorBoundary(): void {\n this.props.onReset?.(this.state.error);\n\n this.setState(faroErrorBoundaryInitialState);\n }\n\n override render(): ReactNode {\n if (!this.state.hasError) {\n return isFunction(this.props.children) ? this.props.children() : this.props.children;\n }\n\n const element = !isFunction(this.props.fallback)\n ? this.props.fallback\n : this.props.fallback(this.state.error!, this.resetErrorBoundary);\n\n if (isValidElement(element)) {\n return element;\n }\n\n if (this.props.fallback) {\n faro.internalLogger.warn('ErrorBoundary\\n', 'Cannot get a valid ReactElement from \"fallback\"');\n }\n\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"FaroErrorBoundary.js","sourceRoot":"","sources":["../../../src/errorBoundary/FaroErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAGxD,MAAM,OAAO,iBAAkB,SAAQ,SAAyD;IAG9F,YAAY,K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EAAC,SAAS,mDAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,kBAAkB;;QAChB,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,OAAO,mDAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEvC,IAAI,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;IAC/C,CAAC;IAEQ,MAAM;QACb,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACxB,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;SACtF;QAED,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC9C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;YACrB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEpE,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;YAC3B,OAAO,OAAO,CAAC;SAChB;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,IAAI,CAAC,iBAAiB,EAAE,iDAAiD,CAAC,CAAC;SAC5F;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { Component, isValidElement } from 'react';\nimport type { ErrorInfo, ReactNode } from 'react';\n\nimport { isFunction } from '@grafana/faro-web-sdk';\n\nimport { api, internalLogger } from '../dependencies';\nimport { isReactVersionAtLeast17 } from '../utils';\n\nimport { faroErrorBoundaryInitialState } from './const';\nimport type { FaroErrorBoundaryProps, FaroErrorBoundaryState } from './types';\n\nexport class FaroErrorBoundary extends Component<FaroErrorBoundaryProps, FaroErrorBoundaryState> {\n override state: FaroErrorBoundaryState = faroErrorBoundaryInitialState;\n\n constructor(props: FaroErrorBoundaryProps) {\n super(props);\n\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n }\n\n getErrorWithComponentStack(error: Error, errorInfo: ErrorInfo): Error {\n if (!isReactVersionAtLeast17 || !errorInfo.componentStack) {\n return error;\n }\n\n const newError = new Error(error.message);\n\n newError.name = `React ErrorBoundary ${error.name}`;\n newError.stack = errorInfo.componentStack;\n\n return newError;\n }\n\n static getDerivedStateFromError(error: Error): FaroErrorBoundaryState {\n return {\n hasError: true,\n error,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n const errorWithComponentStack = this.getErrorWithComponentStack(error, errorInfo);\n\n this.props.beforeCapture?.(errorWithComponentStack);\n\n api.pushError(errorWithComponentStack);\n\n this.props.onError?.(errorWithComponentStack);\n\n this.setState({ hasError: true, error });\n }\n\n override componentDidMount(): void {\n this.props.onMount?.();\n }\n\n override componentWillUnmount(): void {\n this.props.onUnmount?.(this.state.error);\n }\n\n resetErrorBoundary(): void {\n this.props.onReset?.(this.state.error);\n\n this.setState(faroErrorBoundaryInitialState);\n }\n\n override render(): ReactNode {\n if (!this.state.hasError) {\n return isFunction(this.props.children) ? this.props.children() : this.props.children;\n }\n\n const element = !isFunction(this.props.fallback)\n ? this.props.fallback\n : this.props.fallback(this.state.error!, this.resetErrorBoundary);\n\n if (isValidElement(element)) {\n return element;\n }\n\n if (this.props.fallback) {\n internalLogger?.warn('ErrorBoundary\\n', 'Cannot get a valid ReactElement from \"fallback\"');\n }\n\n return null;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/errorBoundary/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactElement, ReactNode } from 'react';\n\nimport type { Faro } from '@grafana/faro-web-sdk';\n\nexport type ReactNodeRender = () => ReactNode;\n\nexport type ReactProps = Record<string, any>;\n\nexport type FaroErrorBoundaryFallbackRender = (error: Error, resetError: VoidFunction) => ReactElement;\n\nexport interface FaroErrorBoundaryProps {\n faro?: Faro;\n beforeCapture?: (error: Error | null) => void;\n children?: ReactNode | ReactNodeRender;\n fallback?: ReactElement | FaroErrorBoundaryFallbackRender;\n onError?: (error: Error) => void;\n onMount?: VoidFunction;\n onReset?: (error: Error | null) => void;\n onUnmount?: (error: Error | null) => void;\n}\n\nexport interface FaroErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/errorBoundary/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactElement, ReactNode } from 'react';\n\nexport type ReactNodeRender = () => ReactNode;\n\nexport type ReactProps = Record<string, any>;\n\nexport type FaroErrorBoundaryFallbackRender = (error: Error, resetError: VoidFunction) => ReactElement;\n\nexport interface FaroErrorBoundaryProps {\n beforeCapture?: (error: Error | null) => void;\n children?: ReactNode | ReactNodeRender;\n fallback?: ReactElement | FaroErrorBoundaryFallbackRender;\n onError?: (error: Error) => void;\n onMount?: VoidFunction;\n onReset?: (error: Error | null) => void;\n onUnmount?: (error: Error | null) => void;\n}\n\nexport interface FaroErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroErrorBoundary.js","sourceRoot":"","sources":["../../../src/errorBoundary/withFaroErrorBoundary.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,UAAU,qBAAqB,CACnC,gBAAkC,EAClC,kBAA0C;;IAE1C,MAAM,oBAAoB,GAAG,MAAA,MAAA,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,aAAa,CAAC;IAEpG,MAAM,SAAS,GAAU,CAAC,qBAAwB,EAAE,EAAE,CAAC,CACrD,KAAC,iBAAiB,oBAAK,kBAAkB,cACvC,KAAC,gBAAgB,oBAAK,qBAAqB,EAAI,IAC7B,CACrB,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,qBAAqB,oBAAoB,GAAG,CAAC;IAErE,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '../utils';\nimport { FaroErrorBoundary } from './FaroErrorBoundary';\nimport type { FaroErrorBoundaryProps, ReactProps } from './types';\n\nexport function withFaroErrorBoundary<P extends ReactProps = {}>(\n WrappedComponent: ComponentType<P>,\n errorBoundaryProps: FaroErrorBoundaryProps\n): FC<P> {\n const componentDisplayName = WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (wrappedComponentProps: P) => (\n <FaroErrorBoundary {...errorBoundaryProps}>\n <WrappedComponent {...wrappedComponentProps} />\n </FaroErrorBoundary>\n );\n\n Component.displayName = `faroErrorBoundary(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
1
+ {"version":3,"file":"withFaroErrorBoundary.js","sourceRoot":"","sources":["../../../src/errorBoundary/withFaroErrorBoundary.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,UAAU,qBAAqB,CACnC,gBAAkC,EAClC,kBAA0C;;IAE1C,MAAM,oBAAoB,GAAG,MAAA,MAAA,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,aAAa,CAAC;IAEpG,MAAM,SAAS,GAAU,CAAC,qBAAwB,EAAE,EAAE,CAAC,CACrD,KAAC,iBAAiB,oBAAK,kBAAkB,cACvC,KAAC,gBAAgB,oBAAK,qBAAqB,EAAI,IAC7B,CACrB,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,qBAAqB,oBAAoB,GAAG,CAAC;IAErE,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '../utils';\n\nimport { FaroErrorBoundary } from './FaroErrorBoundary';\nimport type { FaroErrorBoundaryProps, ReactProps } from './types';\n\nexport function withFaroErrorBoundary<P extends ReactProps = {}>(\n WrappedComponent: ComponentType<P>,\n errorBoundaryProps: FaroErrorBoundaryProps\n): FC<P> {\n const componentDisplayName = WrappedComponent.displayName ?? WrappedComponent.name ?? unknownString;\n\n const Component: FC<P> = (wrappedComponentProps: P) => (\n <FaroErrorBoundary {...errorBoundaryProps}>\n <WrappedComponent {...wrappedComponentProps} />\n </FaroErrorBoundary>\n );\n\n Component.displayName = `faroErrorBoundary(${componentDisplayName})`;\n\n hoistNonReactStatics(Component, WrappedComponent);\n\n return Component;\n}\n"]}
package/dist/esm/index.js CHANGED
@@ -3,5 +3,5 @@ export { ReactIntegration } from './instrumentation';
3
3
  export { FaroProfiler, withFaroProfiler } from './profiler';
4
4
  export { FaroRoute, FaroRoutes, NavigationType, ReactRouterVersion, setReactRouterV4V5SSRDependencies, setReactRouterV6SSRDependencies, } from './router';
5
5
  export { getMajorReactVersion, isReactVersionAtLeast, isReactVersionAtLeast16, isReactVersionAtLeast17, isReactVersionAtLeast18, reactVersion, reactVersionMajor, } from './utils';
6
- export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, browserMeta, buildStackFrame, ConsoleInstrumentation, ConsoleTransport, Conventions, createInternalLogger, createPromiseBuffer, createSession, deepEqual, defaultExceptionType, defaultEventDomain, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, defaultMetas, ErrorsInstrumentation, FetchTransport, 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, pageMeta, parseStacktrace, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, WebVitalsInstrumentation, } from '@grafana/faro-web-sdk';
6
+ export { faro, allLogLevels, BaseExtension, BaseInstrumentation, BaseTransport, browserMeta, buildStackFrame, ConsoleInstrumentation, ConsoleTransport, Conventions, createInternalLogger, createPromiseBuffer, createSession, deepEqual, defaultExceptionType, defaultEventDomain, defaultGlobalObjectKey, defaultInternalLoggerLevel, defaultLogLevel, defaultMetas, defaultViewMeta, 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, pageMeta, parseStacktrace, setInternalFaroOnGlobalObject, TransportItemType, transportItemTypeToBodyKey, VERSION, ViewInstrumentation, WebVitalsInstrumentation, } from '@grafana/faro-web-sdk';
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAS1G,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG5D,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,UAAU,CAAC;AAqBlB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,2BAA2B,EAC3B,+BAA+B,EAC/B,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,6BAA6B,EAC7B,iBAAiB,EACjB,0BAA0B,EAC1B,OAAO,EACP,wBAAwB,GACzB,MAAM,uBAAuB,CAAC","sourcesContent":["export { FaroErrorBoundary, faroErrorBoundaryInitialState, withFaroErrorBoundary } from './errorBoundary';\nexport type {\n FaroErrorBoundaryFallbackRender,\n FaroErrorBoundaryProps,\n FaroErrorBoundaryState,\n ReactNodeRender,\n ReactProps,\n} from './errorBoundary';\n\nexport { ReactIntegration } from './instrumentation';\n\nexport { FaroProfiler, withFaroProfiler } from './profiler';\nexport type { FaroProfilerProps } from './profiler';\n\nexport {\n FaroRoute,\n FaroRoutes,\n NavigationType,\n ReactRouterVersion,\n setReactRouterV4V5SSRDependencies,\n setReactRouterV6SSRDependencies,\n} from './router';\nexport type {\n ReactRouterHistory,\n ReactRouterLocation,\n ReactRouterV4V5ActiveEvent,\n ReactRouterV4V5Dependencies,\n ReactRouterV4V5RouteShape,\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6Params,\n ReactRouterV6RouteMatch,\n ReactRouterV6RouteObject,\n ReactRouterV6RoutesProps,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './router';\n\nexport type { ReactIntegrationConfig, ReactRouterV4V5Config, ReactRouterV6Config } from './types';\n\nexport {\n getMajorReactVersion,\n isReactVersionAtLeast,\n isReactVersionAtLeast16,\n isReactVersionAtLeast17,\n isReactVersionAtLeast18,\n reactVersion,\n reactVersionMajor,\n} from './utils';\n\nexport {\n faro,\n allLogLevels,\n BaseExtension,\n BaseInstrumentation,\n BaseTransport,\n browserMeta,\n buildStackFrame,\n ConsoleInstrumentation,\n ConsoleTransport,\n Conventions,\n createInternalLogger,\n createPromiseBuffer,\n createSession,\n deepEqual,\n defaultExceptionType,\n defaultEventDomain,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultLogLevel,\n defaultMetas,\n ErrorsInstrumentation,\n FetchTransport,\n getCurrentTimestamp,\n getDataFromSafariExtensions,\n getInternalFaroFromGlobalObject,\n getStackFramesFromError,\n getTransportBody,\n getWebInstrumentations,\n globalObject,\n initializeFaro,\n internalGlobalObjectKey,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isInternalFaroOnGlobalObject,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n InternalLoggerLevel,\n LogLevel,\n makeCoreConfig,\n noop,\n pageMeta,\n parseStacktrace,\n setInternalFaroOnGlobalObject,\n TransportItemType,\n transportItemTypeToBodyKey,\n VERSION,\n WebVitalsInstrumentation,\n} from '@grafana/faro-web-sdk';\n\nexport type {\n Faro,\n API,\n APIEvent,\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BeforeSendHook,\n BrowserConfig,\n Config,\n ConsoleInstrumentationOptions,\n ConsoleTransportOptions,\n ErrorEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n ExtendedPromiseRejectionEvent,\n FetchTransportOptions,\n FetchTransportRequestOptions,\n GlobalObject,\n Instrumentation,\n Instrumentations,\n InternalLogger,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n Meta,\n MetaAPI,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n OTELApi,\n Patterns,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n UnpatchedConsole,\n} from '@grafana/faro-web-sdk';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAS1G,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG5D,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,UAAU,CAAC;AAqBlB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,+BAA+B,EAC/B,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,4BAA4B,EAC5B,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,6BAA6B,EAC7B,iBAAiB,EACjB,0BAA0B,EAC1B,OAAO,EACP,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC","sourcesContent":["export { FaroErrorBoundary, faroErrorBoundaryInitialState, withFaroErrorBoundary } from './errorBoundary';\nexport type {\n FaroErrorBoundaryFallbackRender,\n FaroErrorBoundaryProps,\n FaroErrorBoundaryState,\n ReactNodeRender,\n ReactProps,\n} from './errorBoundary';\n\nexport { ReactIntegration } from './instrumentation';\n\nexport { FaroProfiler, withFaroProfiler } from './profiler';\nexport type { FaroProfilerProps } from './profiler';\n\nexport {\n FaroRoute,\n FaroRoutes,\n NavigationType,\n ReactRouterVersion,\n setReactRouterV4V5SSRDependencies,\n setReactRouterV6SSRDependencies,\n} from './router';\nexport type {\n ReactRouterHistory,\n ReactRouterLocation,\n ReactRouterV4V5ActiveEvent,\n ReactRouterV4V5Dependencies,\n ReactRouterV4V5RouteShape,\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6Params,\n ReactRouterV6RouteMatch,\n ReactRouterV6RouteObject,\n ReactRouterV6RoutesProps,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './router';\n\nexport type { ReactIntegrationConfig, ReactRouterV4V5Config, ReactRouterV6Config } from './types';\n\nexport {\n getMajorReactVersion,\n isReactVersionAtLeast,\n isReactVersionAtLeast16,\n isReactVersionAtLeast17,\n isReactVersionAtLeast18,\n reactVersion,\n reactVersionMajor,\n} from './utils';\n\nexport {\n faro,\n allLogLevels,\n BaseExtension,\n BaseInstrumentation,\n BaseTransport,\n browserMeta,\n buildStackFrame,\n ConsoleInstrumentation,\n ConsoleTransport,\n Conventions,\n createInternalLogger,\n createPromiseBuffer,\n createSession,\n deepEqual,\n defaultExceptionType,\n defaultEventDomain,\n defaultGlobalObjectKey,\n defaultInternalLoggerLevel,\n defaultLogLevel,\n defaultMetas,\n defaultViewMeta,\n ErrorsInstrumentation,\n FetchTransport,\n genShortID,\n getCurrentTimestamp,\n getDataFromSafariExtensions,\n getInternalFaroFromGlobalObject,\n getStackFramesFromError,\n getTransportBody,\n getWebInstrumentations,\n globalObject,\n initializeFaro,\n internalGlobalObjectKey,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isInternalFaroOnGlobalObject,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n InternalLoggerLevel,\n LogLevel,\n makeCoreConfig,\n noop,\n pageMeta,\n parseStacktrace,\n setInternalFaroOnGlobalObject,\n TransportItemType,\n transportItemTypeToBodyKey,\n VERSION,\n ViewInstrumentation,\n WebVitalsInstrumentation,\n} from '@grafana/faro-web-sdk';\n\nexport type {\n Faro,\n API,\n APIEvent,\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BeforeSendHook,\n BrowserConfig,\n Config,\n ConsoleInstrumentationOptions,\n ConsoleTransportOptions,\n ErrorEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n ExtendedPromiseRejectionEvent,\n Extension,\n FetchTransportOptions,\n FetchTransportRequestOptions,\n GlobalObject,\n Instrumentation,\n Instrumentations,\n InternalLogger,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n Meta,\n MetaAPI,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n OTELApi,\n Patterns,\n PushErrorOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n UnpatchedConsole,\n} from '@grafana/faro-web-sdk';\n"]}