@grafana/faro-react 1.0.0-beta2 → 1.0.0-beta4

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 (120) hide show
  1. package/dist/bundle/faro-react.iife.js +27 -0
  2. package/dist/cjs/errorBoundary/FaroErrorBoundary.js.map +1 -1
  3. package/dist/cjs/errorBoundary/const.js.map +1 -1
  4. package/dist/cjs/errorBoundary/index.js.map +1 -1
  5. package/dist/cjs/errorBoundary/types.js.map +1 -1
  6. package/dist/cjs/errorBoundary/withFaroErrorBoundary.js.map +1 -1
  7. package/dist/cjs/index.js.map +1 -1
  8. package/dist/cjs/instrumentation.js.map +1 -1
  9. package/dist/cjs/profiler/FaroProfiler.js.map +1 -1
  10. package/dist/cjs/profiler/index.js.map +1 -1
  11. package/dist/cjs/profiler/withFaroProfiler.js.map +1 -1
  12. package/dist/cjs/router/index.js.map +1 -1
  13. package/dist/cjs/router/initialize.js.map +1 -1
  14. package/dist/cjs/router/types.js.map +1 -1
  15. package/dist/cjs/router/v4v5/FaroRoute.js.map +1 -1
  16. package/dist/cjs/router/v4v5/activeEvent.js.map +1 -1
  17. package/dist/cjs/router/v4v5/dependencies.js.map +1 -1
  18. package/dist/cjs/router/v4v5/index.js.map +1 -1
  19. package/dist/cjs/router/v4v5/initialize.js.map +1 -1
  20. package/dist/cjs/router/v4v5/types.js.map +1 -1
  21. package/dist/cjs/router/v6/FaroRoutes.js.map +1 -1
  22. package/dist/cjs/router/v6/dependencies.js.map +1 -1
  23. package/dist/cjs/router/v6/index.js.map +1 -1
  24. package/dist/cjs/router/v6/initialize.js.map +1 -1
  25. package/dist/cjs/router/v6/types.js.map +1 -1
  26. package/dist/cjs/router/v6/utils.js.map +1 -1
  27. package/dist/cjs/types.js.map +1 -1
  28. package/dist/cjs/utils/const.js.map +1 -1
  29. package/dist/cjs/utils/index.js.map +1 -1
  30. package/dist/cjs/utils/reactVersion.js.map +1 -1
  31. package/dist/esm/errorBoundary/FaroErrorBoundary.js.map +1 -1
  32. package/dist/esm/errorBoundary/const.js.map +1 -1
  33. package/dist/esm/errorBoundary/index.js.map +1 -1
  34. package/dist/esm/errorBoundary/types.js.map +1 -1
  35. package/dist/esm/errorBoundary/withFaroErrorBoundary.js.map +1 -1
  36. package/dist/esm/index.js.map +1 -1
  37. package/dist/esm/instrumentation.js.map +1 -1
  38. package/dist/esm/profiler/FaroProfiler.js +13 -13
  39. package/dist/esm/profiler/FaroProfiler.js.map +1 -1
  40. package/dist/esm/profiler/index.js.map +1 -1
  41. package/dist/esm/profiler/withFaroProfiler.js.map +1 -1
  42. package/dist/esm/router/index.js.map +1 -1
  43. package/dist/esm/router/initialize.js.map +1 -1
  44. package/dist/esm/router/types.js.map +1 -1
  45. package/dist/esm/router/v4v5/FaroRoute.js.map +1 -1
  46. package/dist/esm/router/v4v5/activeEvent.js.map +1 -1
  47. package/dist/esm/router/v4v5/dependencies.js.map +1 -1
  48. package/dist/esm/router/v4v5/index.js.map +1 -1
  49. package/dist/esm/router/v4v5/initialize.js.map +1 -1
  50. package/dist/esm/router/v4v5/types.js.map +1 -1
  51. package/dist/esm/router/v6/FaroRoutes.js.map +1 -1
  52. package/dist/esm/router/v6/dependencies.js.map +1 -1
  53. package/dist/esm/router/v6/index.js.map +1 -1
  54. package/dist/esm/router/v6/initialize.js.map +1 -1
  55. package/dist/esm/router/v6/types.js.map +1 -1
  56. package/dist/esm/router/v6/utils.js.map +1 -1
  57. package/dist/esm/types.js.map +1 -1
  58. package/dist/esm/utils/const.js.map +1 -1
  59. package/dist/esm/utils/index.js.map +1 -1
  60. package/dist/esm/utils/reactVersion.js.map +1 -1
  61. package/dist/{cjs → types}/errorBoundary/FaroErrorBoundary.d.ts +0 -0
  62. package/dist/{cjs → types}/errorBoundary/const.d.ts +0 -0
  63. package/dist/{cjs → types}/errorBoundary/index.d.ts +0 -0
  64. package/dist/{esm → types}/errorBoundary/types.d.ts +3 -3
  65. package/dist/{cjs → types}/errorBoundary/withFaroErrorBoundary.d.ts +0 -0
  66. package/dist/{cjs → types}/index.d.ts +1 -1
  67. package/dist/{cjs → types}/instrumentation.d.ts +0 -0
  68. package/dist/{cjs → types}/profiler/FaroProfiler.d.ts +0 -0
  69. package/dist/{cjs → types}/profiler/index.d.ts +0 -0
  70. package/dist/{cjs → types}/profiler/withFaroProfiler.d.ts +0 -0
  71. package/dist/{cjs → types}/router/index.d.ts +0 -0
  72. package/dist/{cjs → types}/router/initialize.d.ts +0 -0
  73. package/dist/{cjs → types}/router/types.d.ts +0 -0
  74. package/dist/{cjs → types}/router/v4v5/FaroRoute.d.ts +0 -0
  75. package/dist/{cjs → types}/router/v4v5/activeEvent.d.ts +0 -0
  76. package/dist/{cjs → types}/router/v4v5/dependencies.d.ts +0 -0
  77. package/dist/{cjs → types}/router/v4v5/index.d.ts +0 -0
  78. package/dist/{cjs → types}/router/v4v5/initialize.d.ts +0 -0
  79. package/dist/{cjs → types}/router/v4v5/types.d.ts +1 -1
  80. package/dist/{cjs → types}/router/v6/FaroRoutes.d.ts +0 -0
  81. package/dist/{cjs → types}/router/v6/dependencies.d.ts +0 -0
  82. package/dist/{cjs → types}/router/v6/index.d.ts +0 -0
  83. package/dist/{cjs → types}/router/v6/initialize.d.ts +0 -0
  84. package/dist/types/router/v6/types.d.ts +45 -0
  85. package/dist/{cjs → types}/router/v6/utils.d.ts +0 -0
  86. package/dist/{cjs → types}/types.d.ts +0 -0
  87. package/dist/{cjs → types}/utils/const.d.ts +0 -0
  88. package/dist/{cjs → types}/utils/index.d.ts +0 -0
  89. package/dist/{cjs → types}/utils/reactVersion.d.ts +0 -0
  90. package/package.json +34 -15
  91. package/dist/cjs/errorBoundary/types.d.ts +0 -19
  92. package/dist/cjs/router/v6/types.d.ts +0 -35
  93. package/dist/esm/errorBoundary/FaroErrorBoundary.d.ts +0 -14
  94. package/dist/esm/errorBoundary/const.d.ts +0 -2
  95. package/dist/esm/errorBoundary/index.d.ts +0 -4
  96. package/dist/esm/errorBoundary/withFaroErrorBoundary.d.ts +0 -3
  97. package/dist/esm/index.d.ts +0 -11
  98. package/dist/esm/instrumentation.d.ts +0 -9
  99. package/dist/esm/profiler/FaroProfiler.d.ts +0 -24
  100. package/dist/esm/profiler/index.d.ts +0 -3
  101. package/dist/esm/profiler/withFaroProfiler.d.ts +0 -3
  102. package/dist/esm/router/index.d.ts +0 -7
  103. package/dist/esm/router/initialize.d.ts +0 -3
  104. package/dist/esm/router/types.d.ts +0 -21
  105. package/dist/esm/router/v4v5/FaroRoute.d.ts +0 -3
  106. package/dist/esm/router/v4v5/activeEvent.d.ts +0 -5
  107. package/dist/esm/router/v4v5/dependencies.d.ts +0 -9
  108. package/dist/esm/router/v4v5/index.d.ts +0 -4
  109. package/dist/esm/router/v4v5/initialize.d.ts +0 -3
  110. package/dist/esm/router/v4v5/types.d.ts +0 -16
  111. package/dist/esm/router/v6/FaroRoutes.d.ts +0 -3
  112. package/dist/esm/router/v6/dependencies.d.ts +0 -11
  113. package/dist/esm/router/v6/index.d.ts +0 -4
  114. package/dist/esm/router/v6/initialize.d.ts +0 -3
  115. package/dist/esm/router/v6/types.d.ts +0 -35
  116. package/dist/esm/router/v6/utils.d.ts +0 -4
  117. package/dist/esm/types.d.ts +0 -12
  118. package/dist/esm/utils/const.d.ts +0 -1
  119. package/dist/esm/utils/index.d.ts +0 -2
  120. package/dist/esm/utils/reactVersion.d.ts +0 -7
@@ -1,19 +1,6 @@
1
1
  import { Component } from 'react';
2
2
  import { faro, VERSION } from '@grafana/faro-web-sdk';
3
3
  export class FaroProfiler extends Component {
4
- constructor(props) {
5
- var _a;
6
- super(props);
7
- this.mountSpan = undefined;
8
- this.mountSpanEndTime = undefined;
9
- this.updateSpan = undefined;
10
- if (this.isOtelInitialized) {
11
- this.mountSpan = this.createSpan('componentMount');
12
- }
13
- else {
14
- (_a = 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.');
15
- }
16
- }
17
4
  get isOtelInitialized() {
18
5
  var _a;
19
6
  return !!((_a = faro.api) === null || _a === void 0 ? void 0 : _a.isOTELInitialized());
@@ -46,6 +33,19 @@ export class FaroProfiler extends Component {
46
33
  });
47
34
  return span;
48
35
  }
36
+ constructor(props) {
37
+ var _a;
38
+ super(props);
39
+ this.mountSpan = undefined;
40
+ this.mountSpanEndTime = undefined;
41
+ this.updateSpan = undefined;
42
+ if (this.isOtelInitialized) {
43
+ this.mountSpan = this.createSpan('componentMount');
44
+ }
45
+ else {
46
+ (_a = 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.');
47
+ }
48
+ }
49
49
  componentDidMount() {
50
50
  if (this.isOtelInitialized && this.mountSpan) {
51
51
  this.mountSpanEndTime = Date.now();
@@ -1 +1 @@
1
- {"version":3,"file":"FaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/FaroProfiler.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQtD,MAAM,OAAO,YAAa,SAAQ,SAA4B;IAoD5D,YAAY,KAAwB;;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QApDL,cAAS,GAAqB,SAAS,CAAC;QACxC,qBAAgB,GAAuB,SAAS,CAAC;QACjD,eAAU,GAAqB,SAAS,CAAC;QAoDjD,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;SACpD;aAAM;YACL,MAAA,IAAI,CAAC,cAAc,0CAAE,KAAK,CACxB,8HAA8H,CAC/H,CAAC;SACH;IACH,CAAC;IAzDD,IAAY,iBAAiB;;QAC3B,OAAO,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,GAAG,0CAAE,iBAAiB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AC,EAAE,WAAW,EAAqB;QAC/D,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,IAAI,WAAW,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YACtF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,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,kBAAkB;QACzB,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,oBAAoB;QAC3B,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,SAAS,EAAE;YAC5C,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,EAAE;gBACtD,SAAS,EAAE,IAAI,CAAC,gBAAgB;gBAChC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;aACpB,CAAC,CAAC;SACJ;IACH,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["import type { Attributes, Span, Tracer } from '@opentelemetry/api';\nimport { Component } from 'react';\nimport type { ReactNode } from 'react';\n\nimport 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;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/profiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/profiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { FaroProfiler } from './FaroProfiler';\nexport type { FaroProfilerProps } from './FaroProfiler';\n\nexport { withFaroProfiler } from './withFaroProfiler';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,UAAU,gBAAgB,CAC9B,gBAAkC,EAClC,OAAgD;;IAEhD,MAAM,oBAAoB,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,aAAa,CAAC;IAErH,MAAM,SAAS,GAAU,CAAC,KAAQ,EAAE,EAAE,CAAC,CACrC,KAAC,YAAY,kBAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,gBAC1D,KAAC,gBAAgB,oBAAK,KAAK,EAAI,IAClB,CAChB,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,gBAAgB,oBAAoB,GAAG,CAAC;IAEhE,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"withFaroProfiler.js","sourceRoot":"","sources":["../../../src/profiler/withFaroProfiler.tsx"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,UAAU,gBAAgB,CAC9B,gBAAkC,EAClC,OAAgD;;IAEhD,MAAM,oBAAoB,GAAG,MAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,gBAAgB,CAAC,WAAW,mCAAI,gBAAgB,CAAC,IAAI,mCAAI,aAAa,CAAC;IAErH,MAAM,SAAS,GAAU,CAAC,KAAQ,EAAE,EAAE,CAAC,CACrC,KAAC,YAAY,kBAAC,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,KAAK,gBAC1D,KAAC,gBAAgB,oBAAK,KAAK,EAAI,IAClB,CAChB,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,gBAAgB,oBAAoB,GAAG,CAAC;IAEhE,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAElD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type { ComponentType, FC } from 'react';\n\nimport { unknownString } from '../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 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,iCAAiC,EAAE,MAAM,QAAQ,CAAC;AAGtE,OAAO,EAAE,UAAU,EAAE,+BAA+B,EAAE,MAAM,MAAM,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,SAAS,EAAE,iCAAiC,EAAE,MAAM,QAAQ,CAAC;AAGtE,OAAO,EAAE,UAAU,EAAE,+BAA+B,EAAE,MAAM,MAAM,CAAC","sourcesContent":["export { initializeReactRouterInstrumentation } from './initialize';\n\nexport { NavigationType, ReactRouterVersion } from './types';\nexport type { ReactRouterLocation, ReactRouterHistory } from './types';\n\nexport { FaroRoute, setReactRouterV4V5SSRDependencies } from './v4v5';\nexport type { ReactRouterV4V5ActiveEvent, ReactRouterV4V5Dependencies, ReactRouterV4V5RouteShape } from './v4v5';\n\nexport { FaroRoutes, setReactRouterV6SSRDependencies } from './v6';\nexport type {\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6Params,\n ReactRouterV6RouteMatch,\n ReactRouterV6RouteObject,\n ReactRouterV6RoutesProps,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './v6';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,wCAAwC,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,sCAAsC,EAAE,MAAM,MAAM,CAAC;AAE9D,MAAM,UAAU,oCAAoC,CAAC,MAA8B,EAAE,IAAU;;IAC7F,QAAQ,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,EAAE;QAC9B,KAAK,kBAAkB,CAAC,EAAE;YACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;YAC1E,sCAAsC,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACzE,MAAM;QAER,KAAK,kBAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,kBAAkB,CAAC,EAAE;YACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,6BAA6B,MAAM,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;YAChG,wCAAwC,CAAC,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"}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/router/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,wCAAwC,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,sCAAsC,EAAE,MAAM,MAAM,CAAC;AAE9D,MAAM,UAAU,oCAAoC,CAAC,MAA8B,EAAE,IAAU;;IAC7F,QAAQ,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,EAAE;QAC9B,KAAK,kBAAkB,CAAC,EAAE;YACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;YAC1E,sCAAsC,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACzE,MAAM;QAER,KAAK,kBAAkB,CAAC,EAAE,CAAC;QAC3B,KAAK,kBAAkB,CAAC,EAAE;YACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,6BAA6B,MAAM,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;YAChG,wCAAwC,CAAC,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","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 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/router/types.ts"],"names":[],"mappings":"AAaA,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,+BAAS,CAAA;IACT,+BAAS,CAAA;IACT,+BAAS,CAAA;AACX,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;IACb,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/router/types.ts"],"names":[],"mappings":"AAaA,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,+BAAS,CAAA;IACT,+BAAS,CAAA;IACT,+BAAS,CAAA;AACX,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;IACb,qCAAmB,CAAA;AACrB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB","sourcesContent":["export interface ReactRouterLocation<S extends any = unknown> {\n hash: string;\n key: string;\n pathname: string;\n search: string;\n state: S;\n}\n\nexport interface ReactRouterHistory extends Record<string, any> {\n listen?: (cb: (location: ReactRouterLocation, action: NavigationType) => void) => void;\n location?: ReactRouterLocation;\n}\n\nexport enum ReactRouterVersion {\n V4 = 'v4',\n V5 = 'v5',\n V6 = 'v6',\n}\n\nexport enum NavigationType {\n Pop = 'POP',\n Push = 'PUSH',\n Replace = 'REPLACE',\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,UAAU,SAAS,CAAC,KAAgC;;IACxD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EAAE;QACjC,mBAAmB,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC/C;IAED,OAAO,KAAC,KAAK,oBAAK,KAAK,EAAI,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"FaroRoute.js","sourceRoot":"","sources":["../../../../src/router/v4v5/FaroRoute.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,UAAU,SAAS,CAAC,KAAgC;;IACxD,IAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,0CAAE,OAAO,EAAE;QACjC,mBAAmB,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC/C;IAED,OAAO,KAAC,KAAK,oBAAK,KAAK,EAAI,CAAC;AAC9B,CAAC","sourcesContent":["import { setActiveEventRoute } from './activeEvent';\nimport { Route } from './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 +1 @@
1
- {"version":3,"file":"activeEvent.js","sourceRoot":"","sources":["../../../../src/router/v4v5/activeEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,MAAM,CAAC,IAAI,WAAW,GAA2C,SAAS,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,WAAW,GAAG;QACZ,GAAG;QACH,KAAK,EAAE,EAAE;KACV,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,IAAI,WAAW,EAAE;QACf,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;KAC3B;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhF,WAAW,GAAG,SAAS,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"file":"activeEvent.js","sourceRoot":"","sources":["../../../../src/router/v4v5/activeEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,MAAM,CAAC,IAAI,WAAW,GAA2C,SAAS,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,WAAW,GAAG;QACZ,GAAG;QACH,KAAK,EAAE,EAAE;KACV,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,IAAI,WAAW,EAAE;QACf,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;KAC3B;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhF,WAAW,GAAG,SAAS,CAAC;AAC1B,CAAC","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 +1 @@
1
- {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../../src/router/v4v5/dependencies.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,IAAI,aAAa,GAAG,KAAK,CAAC;AACjC,MAAM,CAAC,IAAI,IAAU,CAAC;AACtB,MAAM,CAAC,IAAI,OAA2B,CAAC;AACvC,MAAM,CAAC,IAAI,KAAgC,CAAC;AAE5C,MAAM,UAAU,eAAe,CAAC,YAAyC,EAAE,OAAa;IACtF,aAAa,GAAG,IAAI,CAAC;IAErB,IAAI,GAAG,OAAO,CAAC;IACf,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IAC/B,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,eAA2D;IAC3G,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../../src/router/v4v5/dependencies.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,IAAI,aAAa,GAAG,KAAK,CAAC;AACjC,MAAM,CAAC,IAAI,IAAU,CAAC;AACtB,MAAM,CAAC,IAAI,OAA2B,CAAC;AACvC,MAAM,CAAC,IAAI,KAAgC,CAAC;AAE5C,MAAM,UAAU,eAAe,CAAC,YAAyC,EAAE,OAAa;IACtF,aAAa,GAAG,IAAI,CAAC;IAErB,IAAI,GAAG,OAAO,CAAC;IACf,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IAC/B,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,eAA2D;IAC3G,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC;AAChC,CAAC","sourcesContent":["import type { Faro } from '@grafana/faro-web-sdk';\n\nimport type { ReactRouterHistory } from '../types';\nimport type { ReactRouterV4V5Dependencies, ReactRouterV4V5RouteShape } from './types';\n\nexport let isInitialized = false;\nexport let faro: Faro;\nexport let history: ReactRouterHistory;\nexport let Route: ReactRouterV4V5RouteShape;\n\nexport function setDependencies(dependencies: ReactRouterV4V5Dependencies, newFaro: Faro): void {\n isInitialized = true;\n\n faro = newFaro;\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":"index.js","sourceRoot":"","sources":["../../../../src/router/v4v5/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,wCAAwC,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/router/v4v5/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,wCAAwC,EAAE,MAAM,cAAc,CAAC","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 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v4v5/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,UAAU,wCAAwC,CAAC,YAAyC,EAAE,IAAU;;IAC5G,MAAM,KAAK,GAAG,YAAY,CAAC,KAA0B,CAAC;IACtD,MAAM,oBAAoB,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,KAAK,CAAC,IAAI,CAAC;IAC5D,SAA+B,CAAC,WAAW,GAAG,aAAa,oBAAoB,GAAG,CAAC;IACpF,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEvC,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAEpC,oBAAoB,CAAC,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;IAElD,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,MAAM,mDAAG,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;;QAClD,IAAI,MAAM,KAAK,cAAc,CAAC,IAAI,IAAI,MAAM,KAAK,cAAc,CAAC,GAAG,EAAE;YACnE,eAAe,EAAE,CAAC;YAElB,oBAAoB,CAAC,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;SACnD;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v4v5/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,UAAU,wCAAwC,CAAC,YAAyC,EAAE,IAAU;;IAC5G,MAAM,KAAK,GAAG,YAAY,CAAC,KAA0B,CAAC;IACtD,MAAM,oBAAoB,GAAG,MAAA,KAAK,CAAC,WAAW,mCAAI,KAAK,CAAC,IAAI,CAAC;IAC5D,SAA+B,CAAC,WAAW,GAAG,aAAa,oBAAoB,GAAG,CAAC;IACpF,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEvC,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAEpC,oBAAoB,CAAC,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;IAElD,MAAA,MAAA,YAAY,CAAC,OAAO,EAAC,MAAM,mDAAG,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;;QAClD,IAAI,MAAM,KAAK,cAAc,CAAC,IAAI,IAAI,MAAM,KAAK,cAAc,CAAC,GAAG,EAAE;YACnE,eAAe,EAAE,CAAC;YAElB,oBAAoB,CAAC,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;SACnD;IACH,CAAC,CAAC,CAAC;AACL,CAAC","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 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/router/v4v5/types.ts"],"names":[],"mappings":""}
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 +1 @@
1
- {"version":3,"file":"FaroRoutes.js","sourceRoot":"","sources":["../../../../src/router/v6/FaroRoutes.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEvH,OAAO,EAAE,oBAAoB,EAAE,M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AAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEvH,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,UAAU,UAAU,CAAC,KAA+B;;IACxD,MAAM,QAAQ,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,EAAI,CAAC;IACjC,MAAM,cAAc,GAAG,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,EAAI,CAAC;IAE7C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,WAAC,OAAA,MAAA,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAG,KAAK,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAA,EAAA,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEjG,SAAS,CAAC,GAAG,EAAE;;QACb,IAAI,aAAa,IAAI,CAAC,cAAc,KAAK,cAAc,CAAC,IAAI,IAAI,cAAc,KAAK,cAAc,CAAC,GAAG,CAAC,EAAE;YACtG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,EAAE;gBAChC,GAAG,EAAE,MAAA,YAAY,CAAC,QAAQ,0CAAE,IAAI;gBAChC,KAAK,EAAE,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC;aAC9C,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,eAAe,mCAAI,MAAM,CAAC;IAErD,OAAO,KAAC,YAAY,oBAAK,KAAK,EAAI,CAAC;AACrC,CAAC","sourcesContent":["import { useEffect, useMemo } 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 +1 @@
1
- {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../../src/router/v6/dependencies.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,IAAI,aAAa,GAAG,KAAK,CAAC;AACjC,MAAM,CAAC,IAAI,IAAU,CAAC;AACtB,MAAM,CAAC,IAAI,wBAA+D,CAAC;AAC3E,MAAM,CAAC,IAAI,WAAqC,CAAC;AACjD,MAAM,CAAC,IAAI,MAAgC,CAAC;AAC5C,MAAM,CAAC,IAAI,WAAqC,CAAC;AACjD,MAAM,CAAC,IAAI,iBAAiD,CAAC;AAE7D,MAAM,UAAU,eAAe,CAAC,eAA0C,EAAE,OAAa;IACvF,aAAa,GAAG,IAAI,CAAC;IAErB,IAAI,GAAG,OAAO,CAAC;IACf,wBAAwB,GAAG,eAAe,CAAC,wBAAwB,CAAC;IACpE,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAChC,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,eAA0D;IACxG,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;AAClC,CAAC"}
1
+ {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../../src/router/v6/dependencies.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,IAAI,aAAa,GAAG,KAAK,CAAC;AACjC,MAAM,CAAC,IAAI,IAAU,CAAC;AACtB,MAAM,CAAC,IAAI,wBAA+D,CAAC;AAC3E,MAAM,CAAC,IAAI,WAAqC,CAAC;AACjD,MAAM,CAAC,IAAI,MAAgC,CAAC;AAC5C,MAAM,CAAC,IAAI,WAAqC,CAAC;AACjD,MAAM,CAAC,IAAI,iBAAiD,CAAC;AAE7D,MAAM,UAAU,eAAe,CAAC,eAA0C,EAAE,OAAa;IACvF,aAAa,GAAG,IAAI,CAAC;IAErB,IAAI,GAAG,OAAO,CAAC;IACf,wBAAwB,GAAG,eAAe,CAAC,wBAAwB,CAAC;IACpE,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;IAChC,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAC1C,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,eAA0D;IACxG,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;AAClC,CAAC","sourcesContent":["import type { Faro } from '@grafana/faro-web-sdk';\n\nimport type {\n ReactRouterV6CreateRoutesFromChildren,\n ReactRouterV6Dependencies,\n ReactRouterV6MatchRoutes,\n ReactRouterV6RoutesShape,\n ReactRouterV6UseLocation,\n ReactRouterV6UseNavigationType,\n} from './types';\n\nexport let isInitialized = false;\nexport let faro: Faro;\nexport let createRoutesFromChildren: ReactRouterV6CreateRoutesFromChildren;\nexport let matchRoutes: ReactRouterV6MatchRoutes;\nexport let Routes: ReactRouterV6RoutesShape;\nexport let useLocation: ReactRouterV6UseLocation;\nexport let useNavigationType: ReactRouterV6UseNavigationType;\n\nexport function setDependencies(newDependencies: ReactRouterV6Dependencies, newFaro: Faro): void {\n isInitialized = true;\n\n faro = newFaro;\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 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/router/v6/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,sCAAsC,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/router/v6/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,sCAAsC,EAAE,MAAM,cAAc,CAAC","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 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v6/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAI3D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,UAAU,sCAAsC,CAAC,YAAuC,EAAE,IAAU;IACxG,oBAAoB,CAAC,UAAU,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAEtD,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC"}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/router/v6/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAI3D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,UAAU,sCAAsC,CAAC,YAAuC,EAAE,IAAU;IACxG,oBAAoB,CAAC,UAAU,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAEtD,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC","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 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/router/v6/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/router/v6/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactElement, ReactNode } from 'react';\n\nimport type { ReactRouterLocation } from '../types';\n\nexport interface ReactRouterV6BaseRouteObject {\n action?: (...args: any[]) => any;\n caseSensitive?: boolean;\n hasErrorBoundary?: boolean;\n handle?: any;\n id?: string;\n loader?: (...args: any[]) => any;\n path?: string;\n shouldRevalidate?: (...args: any[]) => any;\n}\n\nexport type ReactRouterV6RouteObject = ReactRouterV6BaseRouteObject &\n (\n | {\n children?: undefined;\n index: true;\n }\n | {\n children?: ReactRouterV6RouteObject[];\n index?: false;\n }\n );\n\nexport interface ReactRouterV6RoutesProps {\n children?: ReactNode;\n location?: Partial<ReactRouterLocation> | string;\n routesComponent?: ReactRouterV6RoutesShape;\n}\n\nexport type ReactRouterV6Params<Key extends string = string> = {\n readonly [key in Key]: string | undefined;\n};\n\nexport interface ReactRouterV6RouteMatch<ParamKey extends string = string> {\n params: ReactRouterV6Params<ParamKey>;\n pathname: string;\n pathnameBase: string;\n route: ReactRouterV6RouteObject;\n}\n\nexport type ReactRouterV6CreateRoutesFromChildren = (children: ReactNode) => ReactRouterV6RouteObject[];\n\nexport type ReactRouterV6MatchRoutes = (\n routes: ReactRouterV6RouteObject[],\n location: Partial<ReactRouterLocation> | string,\n basename?: string | undefined\n) => ReactRouterV6RouteMatch[] | null;\n\nexport type ReactRouterV6RoutesShape = (props: ReactRouterV6RoutesProps) => ReactElement | null;\n\nexport type ReactRouterV6UseLocation = () => ReactRouterLocation;\n\nexport type ReactRouterV6UseNavigationType = () => 'POP' | 'PUSH' | 'REPLACE';\n\nexport interface ReactRouterV6Dependencies {\n createRoutesFromChildren: ReactRouterV6CreateRoutesFromChildren;\n matchRoutes: ReactRouterV6MatchRoutes;\n Routes: ReactRouterV6RoutesShape;\n useLocation: ReactRouterV6UseLocation;\n useNavigationType: ReactRouterV6UseNavigationType;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/router/v6/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,cAAc,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AAC,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","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 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactRouterV4V5Dependencies, ReactRouterV6Dependencies, ReactRouterVersion } from './router';\n\nexport interface ReactRouterV4V5Config {\n version: ReactRouterVersion.V4 | ReactRouterVersion.V5;\n dependencies: ReactRouterV4V5Dependencies;\n}\n\nexport interface ReactRouterV6Config {\n version: ReactRouterVersion.V6;\n dependencies: ReactRouterV6Dependencies;\n}\n\nexport interface ReactIntegrationConfig {\n router?: ReactRouterV4V5Config | ReactRouterV6Config;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/utils/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/utils/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC","sourcesContent":["export const unknownString = 'unknown';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,GAClB,MAAM,gBAAgB,CAAC","sourcesContent":["export { unknownString } from './const';\n\nexport {\n getMajorReactVersion,\n isReactVersionAtLeast,\n isReactVersionAtLeast16,\n isReactVersionAtLeast17,\n isReactVersionAtLeast18,\n reactVersion,\n reactVersionMajor,\n} from './reactVersion';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reactVersion.js","sourceRoot":"","sources":["../../../src/utils/reactVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AACpC,MAAM,CAA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AC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI;QACF,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;KACjD;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,IAAI,OAAO,CAAC;AAC3E,CAAC","sourcesContent":["import { version } from 'react';\n\nexport const reactVersion = version;\nexport const reactVersionMajor = getMajorReactVersion();\nexport const isReactVersionAtLeast18 = isReactVersionAtLeast(18);\nexport const isReactVersionAtLeast17 = isReactVersionAtLeast(17);\nexport const isReactVersionAtLeast16 = isReactVersionAtLeast(16);\n\nexport function getMajorReactVersion(): number | null {\n const major = reactVersion.split('.');\n\n try {\n return major[0] ? parseInt(major[0], 10) : null;\n } catch (err) {\n return null;\n }\n}\n\nexport function isReactVersionAtLeast(version: number): boolean {\n return reactVersionMajor === null ? false : reactVersionMajor >= version;\n}\n"]}
File without changes
File without changes
@@ -1,8 +1,8 @@
1
1
  import type { ReactElement, ReactNode } from 'react';
2
2
  import type { Faro } from '@grafana/faro-web-sdk';
3
- export declare type ReactNodeRender = () => ReactNode;
4
- export declare type ReactProps = Record<string, any>;
5
- export declare type FaroErrorBoundaryFallbackRender = (error: Error, resetError: VoidFunction) => ReactElement;
3
+ export type ReactNodeRender = () => ReactNode;
4
+ export type ReactProps = Record<string, any>;
5
+ export type FaroErrorBoundaryFallbackRender = (error: Error, resetError: VoidFunction) => ReactElement;
6
6
  export interface FaroErrorBoundaryProps {
7
7
  faro?: Faro;
8
8
  beforeCapture?: (error: Error | null) => void;
@@ -8,4 +8,4 @@ export type { ReactRouterHistory, ReactRouterLocation, ReactRouterV4V5ActiveEven
8
8
  export type { ReactIntegrationConfig, ReactRouterV4V5Config, ReactRouterV6Config } from './types';
9
9
  export { getMajorReactVersion, isReactVersionAtLeast, isReactVersionAtLeast16, isReactVersionAtLeast17, isReactVersionAtLeast18, reactVersion, reactVersionMajor, } from './utils';
10
10
  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';
11
- export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BrowserConfig, Config, ConsoleInstrumentationOptions, ConsoleTransportOptions, ErrorEvent, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, ExtendedPromiseRejectionEvent, FetchTransportOptions, FetchTransportRequestOptions, GlobalObject, Instrumentation, InstrumentationLibrarySpan, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, OTELApi, Patterns, PushErrorOptions, PushLogOptions, PushMeasurementOptions, ResourceSpan, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, } from '@grafana/faro-web-sdk';
11
+ export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BrowserConfig, Config, ConsoleInstrumentationOptions, ConsoleTransportOptions, ErrorEvent, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, ExtendedPromiseRejectionEvent, FetchTransportOptions, FetchTransportRequestOptions, GlobalObject, Instrumentation, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, OTELApi, Patterns, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, } from '@grafana/faro-web-sdk';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  import type { ReactRouterHistory } from '../types';
2
- export declare type ReactRouterV4V5RouteShape = any;
2
+ export type ReactRouterV4V5RouteShape = any;
3
3
  export interface ReactRouterV4V5RouteProps extends Record<string, any> {
4
4
  computedMatch?: {
5
5
  isExact: boolean;
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,45 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { ReactRouterLocation } from '../types';
3
+ export interface ReactRouterV6BaseRouteObject {
4
+ action?: (...args: any[]) => any;
5
+ caseSensitive?: boolean;
6
+ hasErrorBoundary?: boolean;
7
+ handle?: any;
8
+ id?: string;
9
+ loader?: (...args: any[]) => any;
10
+ path?: string;
11
+ shouldRevalidate?: (...args: any[]) => any;
12
+ }
13
+ export type ReactRouterV6RouteObject = ReactRouterV6BaseRouteObject & ({
14
+ children?: undefined;
15
+ index: true;
16
+ } | {
17
+ children?: ReactRouterV6RouteObject[];
18
+ index?: false;
19
+ });
20
+ export interface ReactRouterV6RoutesProps {
21
+ children?: ReactNode;
22
+ location?: Partial<ReactRouterLocation> | string;
23
+ routesComponent?: ReactRouterV6RoutesShape;
24
+ }
25
+ export type ReactRouterV6Params<Key extends string = string> = {
26
+ readonly [key in Key]: string | undefined;
27
+ };
28
+ export interface ReactRouterV6RouteMatch<ParamKey extends string = string> {
29
+ params: ReactRouterV6Params<ParamKey>;
30
+ pathname: string;
31
+ pathnameBase: string;
32
+ route: ReactRouterV6RouteObject;
33
+ }
34
+ export type ReactRouterV6CreateRoutesFromChildren = (children: ReactNode) => ReactRouterV6RouteObject[];
35
+ export type ReactRouterV6MatchRoutes = (routes: ReactRouterV6RouteObject[], location: Partial<ReactRouterLocation> | string, basename?: string | undefined) => ReactRouterV6RouteMatch[] | null;
36
+ export type ReactRouterV6RoutesShape = (props: ReactRouterV6RoutesProps) => ReactElement | null;
37
+ export type ReactRouterV6UseLocation = () => ReactRouterLocation;
38
+ export type ReactRouterV6UseNavigationType = () => 'POP' | 'PUSH' | 'REPLACE';
39
+ export interface ReactRouterV6Dependencies {
40
+ createRoutesFromChildren: ReactRouterV6CreateRoutesFromChildren;
41
+ matchRoutes: ReactRouterV6MatchRoutes;
42
+ Routes: ReactRouterV6RoutesShape;
43
+ useLocation: ReactRouterV6UseLocation;
44
+ useNavigationType: ReactRouterV6UseNavigationType;
45
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
2
  "name": "@grafana/faro-react",
3
- "version": "1.0.0-beta2",
3
+ "version": "1.0.0-beta4",
4
4
  "description": "Faro package that enables easier integration in projects built with React.",
5
+ "keywords": [
6
+ "observability",
7
+ "apm",
8
+ "rum",
9
+ "logs",
10
+ "traces",
11
+ "metrics",
12
+ "react",
13
+ "react router",
14
+ "react profiler"
15
+ ],
5
16
  "license": "Apache-2.0",
6
17
  "author": "Grafana Labs",
7
18
  "homepage": "https://github.com/grafana/faro-web-sdk",
@@ -10,37 +21,45 @@
10
21
  "url": "https://github.com/grafana/faro-web-sdk.git",
11
22
  "directory": "packages/react"
12
23
  },
13
- "main": "dist/cjs/index.js",
14
- "module": "dist/esm/index.js",
15
- "types": "dist/cjs/index.d.ts",
24
+ "main": "./dist/cjs/index.js",
25
+ "module": "./dist/esm/index.js",
26
+ "types": "./dist/types/index.d.ts",
16
27
  "files": [
17
28
  "dist",
18
29
  "README.md",
19
30
  "LICENSE"
20
31
  ],
21
32
  "scripts": {
22
- "start": "yarn build -w",
23
- "build": "tsc --build tsconfig.all.json",
33
+ "start": "yarn watch",
34
+ "build": "run-s build:*",
35
+ "build:compile": "run-p build:compile:*",
36
+ "build:compile:cjs": "tsc --build tsconfig.cjs.json",
37
+ "build:compile:esm": "tsc --build tsconfig.esm.json",
38
+ "build:compile:bundle": "run-s build:compile:bundle:*",
39
+ "build:compile:bundle:create": "rollup -c ./rollup.config.js",
40
+ "build:compile:bundle:remove-extras": "rimraf dist/bundle/dist",
41
+ "watch": "run-s watch:compile",
42
+ "watch:compile": "yarn build:compile:cjs -w",
24
43
  "clean": "rimraf dist/ yarn-error.log",
25
44
  "quality": "run-s quality:*",
26
45
  "quality:test": "exit 0",
27
- "quality:format": "prettier --ignore-path ../../.prettierignore -w \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
46
+ "quality:format": "prettier --cache --cache-location=../../.cache/prettier/react --ignore-path ../../.prettierignore -w \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
28
47
  "quality:lint": "run-s quality:lint:*",
29
- "quality:lint:eslint": "eslint --ignore-path ../../.eslintignore \"./**/*.{js,jsx,ts,tsx}\"",
30
- "quality:lint:prettier": "prettier --ignore-path ../../.prettierignore -c \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
48
+ "quality:lint:eslint": "eslint --cache --cache-location ../../.cache/eslint/react --ignore-path ../../.eslintignore \"./**/*.{js,jsx,ts,tsx}\"",
49
+ "quality:lint:prettier": "prettier --cache --cache-location=../../.cache/prettier/react --ignore-path ../../.prettierignore -c \"./**/*.{js,jsx,ts,tsx,css,scss,md,yaml,yml,json}\"",
31
50
  "quality:lint:md": "markdownlint README.md",
32
51
  "quality:circular-deps": "madge --circular ."
33
52
  },
34
53
  "dependencies": {
35
- "@grafana/faro-web-sdk": "^1.0.0-beta2",
36
- "@grafana/faro-web-tracing": "^1.0.0-beta2",
54
+ "@grafana/faro-web-sdk": "^1.0.0-beta4",
55
+ "@grafana/faro-web-tracing": "^1.0.0-beta4",
37
56
  "hoist-non-react-statics": "^3.3.2"
38
57
  },
39
58
  "devDependencies": {
40
59
  "@types/hoist-non-react-statics": "^3.3.1",
41
- "@types/react": "^18.0.22",
42
- "react": "^18.1.0",
43
- "react-router-dom": "^6.4.2"
60
+ "@types/react": "^18.0.26",
61
+ "react": "^18.2.0",
62
+ "react-router-dom": "^6.4.5"
44
63
  },
45
64
  "peerDependencies": {
46
65
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
@@ -49,5 +68,5 @@
49
68
  "publishConfig": {
50
69
  "access": "public"
51
70
  },
52
- "gitHead": "908d0abf71a64a38bd9d5cc1bbba26d52e4ae063"
71
+ "gitHead": "88ab57b93286d22830db932a7dc74bcaf2dd4c3d"
53
72
  }
@@ -1,19 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import type { Faro } from '@grafana/faro-web-sdk';
3
- export declare type ReactNodeRender = () => ReactNode;
4
- export declare type ReactProps = Record<string, any>;
5
- export declare type FaroErrorBoundaryFallbackRender = (error: Error, resetError: VoidFunction) => ReactElement;
6
- export interface FaroErrorBoundaryProps {
7
- faro?: Faro;
8
- beforeCapture?: (error: Error | null) => void;
9
- children?: ReactNode | ReactNodeRender;
10
- fallback?: ReactElement | FaroErrorBoundaryFallbackRender;
11
- onError?: (error: Error) => void;
12
- onMount?: VoidFunction;
13
- onReset?: (error: Error | null) => void;
14
- onUnmount?: (error: Error | null) => void;
15
- }
16
- export interface FaroErrorBoundaryState {
17
- hasError: boolean;
18
- error: Error | null;
19
- }
@@ -1,35 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import type { ReactRouterLocation } from '../types';
3
- export interface ReactRouterV6RouteObject {
4
- caseSensitive?: boolean;
5
- children?: ReactRouterV6RouteObject[];
6
- element?: ReactNode;
7
- index?: boolean;
8
- path?: string;
9
- }
10
- export interface ReactRouterV6RoutesProps {
11
- children?: ReactNode;
12
- location?: Partial<ReactRouterLocation> | string;
13
- routesComponent?: ReactRouterV6RoutesShape;
14
- }
15
- export declare type ReactRouterV6Params<Key extends string = string> = {
16
- readonly [key in Key]: string | undefined;
17
- };
18
- export interface ReactRouterV6RouteMatch<ParamKey extends string = string> {
19
- params: ReactRouterV6Params<ParamKey>;
20
- pathname: string;
21
- pathnameBase: string;
22
- route: ReactRouterV6RouteObject;
23
- }
24
- export declare type ReactRouterV6CreateRoutesFromChildren = (children: ReactNode) => ReactRouterV6RouteObject[];
25
- export declare type ReactRouterV6MatchRoutes = (routes: ReactRouterV6RouteObject[], location: Partial<ReactRouterLocation> | string, basename?: string) => ReactRouterV6RouteMatch[] | null;
26
- export declare type ReactRouterV6RoutesShape = (props: ReactRouterV6RoutesProps) => ReactElement | null;
27
- export declare type ReactRouterV6UseLocation = () => ReactRouterLocation;
28
- export declare type ReactRouterV6UseNavigationType = () => 'POP' | 'PUSH' | 'REPLACE';
29
- export interface ReactRouterV6Dependencies {
30
- createRoutesFromChildren: ReactRouterV6CreateRoutesFromChildren;
31
- matchRoutes: ReactRouterV6MatchRoutes;
32
- Routes: ReactRouterV6RoutesShape;
33
- useLocation: ReactRouterV6UseLocation;
34
- useNavigationType: ReactRouterV6UseNavigationType;
35
- }
@@ -1,14 +0,0 @@
1
- import { Component } from 'react';
2
- import type { ErrorInfo, ReactNode } from 'react';
3
- import type { FaroErrorBoundaryProps, FaroErrorBoundaryState } from './types';
4
- export declare class FaroErrorBoundary extends Component<FaroErrorBoundaryProps, FaroErrorBoundaryState> {
5
- state: FaroErrorBoundaryState;
6
- constructor(props: FaroErrorBoundaryProps);
7
- getErrorWithComponentStack(error: Error, errorInfo: ErrorInfo): Error;
8
- static getDerivedStateFromError(error: Error): FaroErrorBoundaryState;
9
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
10
- componentDidMount(): void;
11
- componentWillUnmount(): void;
12
- resetErrorBoundary(): void;
13
- render(): ReactNode;
14
- }
@@ -1,2 +0,0 @@
1
- import type { FaroErrorBoundaryState } from './types';
2
- export declare const faroErrorBoundaryInitialState: FaroErrorBoundaryState;
@@ -1,4 +0,0 @@
1
- export { faroErrorBoundaryInitialState } from './const';
2
- export { FaroErrorBoundary } from './FaroErrorBoundary';
3
- export type { FaroErrorBoundaryFallbackRender, FaroErrorBoundaryProps, FaroErrorBoundaryState, ReactNodeRender, ReactProps, } from './types';
4
- export { withFaroErrorBoundary } from './withFaroErrorBoundary';
@@ -1,3 +0,0 @@
1
- import type { ComponentType, FC } from 'react';
2
- import type { FaroErrorBoundaryProps, ReactProps } from './types';
3
- export declare function withFaroErrorBoundary<P extends ReactProps = {}>(WrappedComponent: ComponentType<P>, errorBoundaryProps: FaroErrorBoundaryProps): FC<P>;
@@ -1,11 +0,0 @@
1
- export { FaroErrorBoundary, faroErrorBoundaryInitialState, withFaroErrorBoundary } from './errorBoundary';
2
- export type { FaroErrorBoundaryFallbackRender, FaroErrorBoundaryProps, FaroErrorBoundaryState, ReactNodeRender, ReactProps, } from './errorBoundary';
3
- export { ReactIntegration } from './instrumentation';
4
- export { FaroProfiler, withFaroProfiler } from './profiler';
5
- export type { FaroProfilerProps } from './profiler';
6
- export { FaroRoute, FaroRoutes, NavigationType, ReactRouterVersion, setReactRouterV4V5SSRDependencies, setReactRouterV6SSRDependencies, } from './router';
7
- export type { ReactRouterHistory, ReactRouterLocation, ReactRouterV4V5ActiveEvent, ReactRouterV4V5Dependencies, ReactRouterV4V5RouteShape, ReactRouterV6CreateRoutesFromChildren, ReactRouterV6Dependencies, ReactRouterV6MatchRoutes, ReactRouterV6Params, ReactRouterV6RouteMatch, ReactRouterV6RouteObject, ReactRouterV6RoutesProps, ReactRouterV6RoutesShape, ReactRouterV6UseLocation, ReactRouterV6UseNavigationType, } from './router';
8
- export type { ReactIntegrationConfig, ReactRouterV4V5Config, ReactRouterV6Config } from './types';
9
- export { getMajorReactVersion, isReactVersionAtLeast, isReactVersionAtLeast16, isReactVersionAtLeast17, isReactVersionAtLeast18, reactVersion, reactVersionMajor, } from './utils';
10
- 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';
11
- export type { Faro, API, APIEvent, BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BeforeSendHook, BrowserConfig, Config, ConsoleInstrumentationOptions, ConsoleTransportOptions, ErrorEvent, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, ExtendedPromiseRejectionEvent, FetchTransportOptions, FetchTransportRequestOptions, GlobalObject, Instrumentation, InstrumentationLibrarySpan, Instrumentations, InternalLogger, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, Meta, MetaAPI, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, OTELApi, Patterns, PushErrorOptions, PushLogOptions, PushMeasurementOptions, ResourceSpan, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, UnpatchedConsole, } from '@grafana/faro-web-sdk';
@@ -1,9 +0,0 @@
1
- import { BaseInstrumentation } from '@grafana/faro-web-sdk';
2
- import type { ReactIntegrationConfig } from './types';
3
- export declare class ReactIntegration extends BaseInstrumentation {
4
- private config;
5
- name: string;
6
- version: string;
7
- constructor(config?: ReactIntegrationConfig);
8
- initialize(): void;
9
- }