@sentry/react 7.15.0 → 7.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import { getGlobalObject } from '@sentry/utils';
1
+ import { WINDOW } from '@sentry/utils';
2
2
  import hoistNonReactStatics from 'hoist-non-react-statics';
3
3
  import * as React from 'react';
4
4
 
5
- var _jsxFileName = "/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouter.tsx";
5
+ const _jsxFileName = "/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouter.tsx";
6
6
 
7
7
  // We need to disable eslint no-explict-any because any is required for the
8
8
  // react-router typings.
@@ -10,8 +10,6 @@ var _jsxFileName = "/home/runner/work/sentry-javascript/sentry-javascript/packag
10
10
 
11
11
  /* eslint-enable @typescript-eslint/no-explicit-any */
12
12
 
13
- var global = getGlobalObject();
14
-
15
13
  let activeTransaction;
16
14
 
17
15
  function reactRouterV4Instrumentation(
@@ -41,8 +39,8 @@ function createReactRouterInstrumentation(
41
39
  return history.location.pathname;
42
40
  }
43
41
 
44
- if (global && global.location) {
45
- return global.location.pathname;
42
+ if (WINDOW && WINDOW.location) {
43
+ return WINDOW.location.pathname;
46
44
  }
47
45
 
48
46
  return undefined;
@@ -59,7 +57,7 @@ function createReactRouterInstrumentation(
59
57
  return [pathname, 'url'];
60
58
  }
61
59
 
62
- var branches = matchRoutes(allRoutes, pathname, matchPath);
60
+ const branches = matchRoutes(allRoutes, pathname, matchPath);
63
61
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
64
62
  for (let x = 0; x < branches.length; x++) {
65
63
  if (branches[x].match.isExact) {
@@ -70,12 +68,12 @@ function createReactRouterInstrumentation(
70
68
  return [pathname, 'url'];
71
69
  }
72
70
 
73
- var tags = {
71
+ const tags = {
74
72
  'routing.instrumentation': name,
75
73
  };
76
74
 
77
75
  return (customStartTransaction, startTransactionOnPageLoad = true, startTransactionOnLocationChange = true) => {
78
- var initPathName = getInitPathName();
76
+ const initPathName = getInitPathName();
79
77
  if (startTransactionOnPageLoad && initPathName) {
80
78
  const [name, source] = normalizeTransactionName(initPathName);
81
79
  activeTransaction = customStartTransaction({
@@ -121,7 +119,7 @@ function matchRoutes(
121
119
  branch = [],
122
120
  ) {
123
121
  routes.some(route => {
124
- var match = route.path
122
+ const match = route.path
125
123
  ? matchPath(pathname, route)
126
124
  : branch.length
127
125
  ? branch[branch.length - 1].match // use parent match
@@ -147,9 +145,9 @@ function computeRootMatch(pathname) {
147
145
 
148
146
  /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
149
147
  function withSentryRouting(Route) {
150
- var componentDisplayName = (Route ).displayName || (Route ).name;
148
+ const componentDisplayName = (Route ).displayName || (Route ).name;
151
149
 
152
- var WrappedRoute = (props) => {
150
+ const WrappedRoute = (props) => {
153
151
  if (activeTransaction && props && props.computedMatch && props.computedMatch.isExact) {
154
152
  activeTransaction.setName(props.computedMatch.path, 'route');
155
153
  }
@@ -157,7 +155,7 @@ function withSentryRouting(Route) {
157
155
  // @ts-ignore Setting more specific React Component typing for `R` generic above
158
156
  // will break advanced type inference done by react router params:
159
157
  // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164
160
- return React.createElement(Route, { ...props, __self: this, __source: {fileName: _jsxFileName, lineNumber: 176}} );
158
+ return React.createElement(Route, { ...props, __self: this, __source: {fileName: _jsxFileName, lineNumber: 174}} );
161
159
  };
162
160
 
163
161
  WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouter.js","sources":["../../src/reactrouter.tsx"],"sourcesContent":["import { Transaction, TransactionSource } from '@sentry/types';\nimport { getGlobalObject } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { Action, Location, ReactRouterInstrumentation } from './types';\n\n// We need to disable eslint no-explict-any because any is required for the\n// react-router typings.\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype Match = { path: string; url: string; params: Record<string, any>; isExact: boolean };\n\nexport type RouterHistory = {\n location?: Location;\n listen?(cb: (location: Location, action: Action) => void): void;\n} & Record<string, any>;\n\nexport type RouteConfig = {\n [propName: string]: any;\n path?: string | string[];\n exact?: boolean;\n component?: JSX.Element;\n routes?: RouteConfig[];\n};\n\ntype MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null;\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nconst global = getGlobalObject<Window>();\n\nlet activeTransaction: Transaction | undefined;\n\nexport function reactRouterV4Instrumentation(\n history: RouterHistory,\n routes?: RouteConfig[],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n return createReactRouterInstrumentation(history, 'react-router-v4', routes, matchPath);\n}\n\nexport function reactRouterV5Instrumentation(\n history: RouterHistory,\n routes?: RouteConfig[],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n return createReactRouterInstrumentation(history, 'react-router-v5', routes, matchPath);\n}\n\nfunction createReactRouterInstrumentation(\n history: RouterHistory,\n name: string,\n allRoutes: RouteConfig[] = [],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n function getInitPathName(): string | undefined {\n if (history && history.location) {\n return history.location.pathname;\n }\n\n if (global && global.location) {\n return global.location.pathname;\n }\n\n return undefined;\n }\n\n /**\n * Normalizes a transaction name. Returns the new name as well as the\n * source of the transaction.\n *\n * @param pathname The initial pathname we normalize\n */\n function normalizeTransactionName(pathname: string): [string, TransactionSource] {\n if (allRoutes.length === 0 || !matchPath) {\n return [pathname, 'url'];\n }\n\n const branches = matchRoutes(allRoutes, pathname, matchPath);\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let x = 0; x < branches.length; x++) {\n if (branches[x].match.isExact) {\n return [branches[x].match.path, 'route'];\n }\n }\n\n return [pathname, 'url'];\n }\n\n const tags = {\n 'routing.instrumentation': name,\n };\n\n return (customStartTransaction, startTransactionOnPageLoad = true, startTransactionOnLocationChange = true): void => {\n const initPathName = getInitPathName();\n if (startTransactionOnPageLoad && initPathName) {\n const [name, source] = normalizeTransactionName(initPathName);\n activeTransaction = customStartTransaction({\n name,\n op: 'pageload',\n tags,\n metadata: {\n source,\n },\n });\n }\n\n if (startTransactionOnLocationChange && history.listen) {\n history.listen((location, action) => {\n if (action && (action === 'PUSH' || action === 'POP')) {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n\n const [name, source] = normalizeTransactionName(location.pathname);\n activeTransaction = customStartTransaction({\n name,\n op: 'navigation',\n tags,\n metadata: {\n source,\n },\n });\n }\n });\n }\n };\n}\n\n/**\n * Matches a set of routes to a pathname\n * Based on implementation from\n */\nfunction matchRoutes(\n routes: RouteConfig[],\n pathname: string,\n matchPath: MatchPath,\n branch: Array<{ route: RouteConfig; match: Match }> = [],\n): Array<{ route: RouteConfig; match: Match }> {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? branch[branch.length - 1].match // use parent match\n : computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, matchPath, branch);\n }\n }\n\n return !!match;\n });\n\n return branch;\n}\n\nfunction computeRootMatch(pathname: string): Match {\n return { path: '/', url: '/', params: {}, isExact: pathname === '/' };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\nexport function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R {\n const componentDisplayName = (Route as any).displayName || (Route as any).name;\n\n const WrappedRoute: React.FC<P> = (props: P) => {\n if (activeTransaction && props && props.computedMatch && props.computedMatch.isExact) {\n activeTransaction.setName(props.computedMatch.path, 'route');\n }\n\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return <Route {...props} />;\n };\n\n WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;\n hoistNonReactStatics(WrappedRoute, Route);\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return WrappedRoute;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n"],"names":[],"mappings":";;;;AAAA;;AAOA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"reactrouter.js","sources":["../../src/reactrouter.tsx"],"sourcesContent":["import { Transaction, TransactionSource } from '@sentry/types';\nimport { WINDOW } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\n\nimport { Action, Location, ReactRouterInstrumentation } from './types';\n\n// We need to disable eslint no-explict-any because any is required for the\n// react-router typings.\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype Match = { path: string; url: string; params: Record<string, any>; isExact: boolean };\n\nexport type RouterHistory = {\n location?: Location;\n listen?(cb: (location: Location, action: Action) => void): void;\n} & Record<string, any>;\n\nexport type RouteConfig = {\n [propName: string]: any;\n path?: string | string[];\n exact?: boolean;\n component?: JSX.Element;\n routes?: RouteConfig[];\n};\n\ntype MatchPath = (pathname: string, props: string | string[] | any, parent?: Match | null) => Match | null;\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nlet activeTransaction: Transaction | undefined;\n\nexport function reactRouterV4Instrumentation(\n history: RouterHistory,\n routes?: RouteConfig[],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n return createReactRouterInstrumentation(history, 'react-router-v4', routes, matchPath);\n}\n\nexport function reactRouterV5Instrumentation(\n history: RouterHistory,\n routes?: RouteConfig[],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n return createReactRouterInstrumentation(history, 'react-router-v5', routes, matchPath);\n}\n\nfunction createReactRouterInstrumentation(\n history: RouterHistory,\n name: string,\n allRoutes: RouteConfig[] = [],\n matchPath?: MatchPath,\n): ReactRouterInstrumentation {\n function getInitPathName(): string | undefined {\n if (history && history.location) {\n return history.location.pathname;\n }\n\n if (WINDOW && WINDOW.location) {\n return WINDOW.location.pathname;\n }\n\n return undefined;\n }\n\n /**\n * Normalizes a transaction name. Returns the new name as well as the\n * source of the transaction.\n *\n * @param pathname The initial pathname we normalize\n */\n function normalizeTransactionName(pathname: string): [string, TransactionSource] {\n if (allRoutes.length === 0 || !matchPath) {\n return [pathname, 'url'];\n }\n\n const branches = matchRoutes(allRoutes, pathname, matchPath);\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let x = 0; x < branches.length; x++) {\n if (branches[x].match.isExact) {\n return [branches[x].match.path, 'route'];\n }\n }\n\n return [pathname, 'url'];\n }\n\n const tags = {\n 'routing.instrumentation': name,\n };\n\n return (customStartTransaction, startTransactionOnPageLoad = true, startTransactionOnLocationChange = true): void => {\n const initPathName = getInitPathName();\n if (startTransactionOnPageLoad && initPathName) {\n const [name, source] = normalizeTransactionName(initPathName);\n activeTransaction = customStartTransaction({\n name,\n op: 'pageload',\n tags,\n metadata: {\n source,\n },\n });\n }\n\n if (startTransactionOnLocationChange && history.listen) {\n history.listen((location, action) => {\n if (action && (action === 'PUSH' || action === 'POP')) {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n\n const [name, source] = normalizeTransactionName(location.pathname);\n activeTransaction = customStartTransaction({\n name,\n op: 'navigation',\n tags,\n metadata: {\n source,\n },\n });\n }\n });\n }\n };\n}\n\n/**\n * Matches a set of routes to a pathname\n * Based on implementation from\n */\nfunction matchRoutes(\n routes: RouteConfig[],\n pathname: string,\n matchPath: MatchPath,\n branch: Array<{ route: RouteConfig; match: Match }> = [],\n): Array<{ route: RouteConfig; match: Match }> {\n routes.some(route => {\n const match = route.path\n ? matchPath(pathname, route)\n : branch.length\n ? branch[branch.length - 1].match // use parent match\n : computeRootMatch(pathname); // use default \"root\" match\n\n if (match) {\n branch.push({ route, match });\n\n if (route.routes) {\n matchRoutes(route.routes, pathname, matchPath, branch);\n }\n }\n\n return !!match;\n });\n\n return branch;\n}\n\nfunction computeRootMatch(pathname: string): Match {\n return { path: '/', url: '/', params: {}, isExact: pathname === '/' };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\nexport function withSentryRouting<P extends Record<string, any>, R extends React.ComponentType<P>>(Route: R): R {\n const componentDisplayName = (Route as any).displayName || (Route as any).name;\n\n const WrappedRoute: React.FC<P> = (props: P) => {\n if (activeTransaction && props && props.computedMatch && props.computedMatch.isExact) {\n activeTransaction.setName(props.computedMatch.path, 'route');\n }\n\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return <Route {...props} />;\n };\n\n WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;\n hoistNonReactStatics(WrappedRoute, Route);\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params:\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13dc4235c069e25fe7ee16e11f529d909f9f3ff8/types/react-router/index.d.ts#L154-L164\n return WrappedRoute;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n"],"names":[],"mappings":";;;;AAAA,MAAA,YAAA,GAAA,0FAAA,CAAA;;AAOA;AACA;AACA;;AAiBA;AACA;AACA,IAAA,iBAAA,CAAA;AACA;AACA,SAAA,4BAAA;AACA,EAAA,OAAA;AACA,EAAA,MAAA;AACA,EAAA,SAAA;AACA,EAAA;AACA,EAAA,OAAA,gCAAA,CAAA,OAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,SAAA,CAAA,CAAA;AACA,CAAA;AACA;AACA,SAAA,4BAAA;AACA,EAAA,OAAA;AACA,EAAA,MAAA;AACA,EAAA,SAAA;AACA,EAAA;AACA,EAAA,OAAA,gCAAA,CAAA,OAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,SAAA,CAAA,CAAA;AACA,CAAA;AACA;AACA,SAAA,gCAAA;AACA,EAAA,OAAA;AACA,EAAA,IAAA;AACA,EAAA,SAAA,GAAA,EAAA;AACA,EAAA,SAAA;AACA,EAAA;AACA,EAAA,SAAA,eAAA,GAAA;AACA,IAAA,IAAA,OAAA,IAAA,OAAA,CAAA,QAAA,EAAA;AACA,MAAA,OAAA,OAAA,CAAA,QAAA,CAAA,QAAA,CAAA;AAC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oBAAA,CAAA,YAAA,EAAA,KAAA,CAAA,CAAA;AACA;AACA;AACA;AACA,EAAA,OAAA,YAAA,CAAA;AACA,CAAA;AACA;;;;"}
@@ -1,10 +1,8 @@
1
- import { getGlobalObject } from '@sentry/utils';
1
+ import { WINDOW } from '@sentry/utils';
2
2
 
3
3
  // Many of the types below had to be mocked out to prevent typescript issues
4
4
  // these types are required for correct functionality.
5
5
 
6
- var global = getGlobalObject();
7
-
8
6
  /**
9
7
  * Creates routing instrumentation for React Router v3
10
8
  * Works for React Router >= 3.2.0 and < 4.0.0
@@ -26,11 +24,11 @@ function reactRouterV3Instrumentation(
26
24
  let activeTransaction;
27
25
  let prevName;
28
26
 
29
- // Have to use global.location because history.location might not be defined.
30
- if (startTransactionOnPageLoad && global && global.location) {
27
+ // Have to use window.location because history.location might not be defined.
28
+ if (startTransactionOnPageLoad && WINDOW && WINDOW.location) {
31
29
  normalizeTransactionName(
32
30
  routes,
33
- global.location ,
31
+ WINDOW.location ,
34
32
  match,
35
33
  (localName, source = 'url') => {
36
34
  prevName = localName;
@@ -54,7 +52,7 @@ function reactRouterV3Instrumentation(
54
52
  if (activeTransaction) {
55
53
  activeTransaction.finish();
56
54
  }
57
- var tags = {
55
+ const tags = {
58
56
  'routing.instrumentation': 'react-router-v3',
59
57
  };
60
58
  if (prevName) {
@@ -97,7 +95,7 @@ function normalizeTransactionName(
97
95
  return callback(name);
98
96
  }
99
97
 
100
- var routePath = getRouteStringFromRoutes(renderProps.routes || []);
98
+ const routePath = getRouteStringFromRoutes(renderProps.routes || []);
101
99
  if (routePath.length === 0 || routePath === '/*') {
102
100
  return callback(name);
103
101
  }
@@ -116,11 +114,11 @@ function getRouteStringFromRoutes(routes) {
116
114
  return '';
117
115
  }
118
116
 
119
- var routesWithPaths = routes.filter((route) => !!route.path);
117
+ const routesWithPaths = routes.filter((route) => !!route.path);
120
118
 
121
119
  let index = -1;
122
120
  for (let x = routesWithPaths.length - 1; x >= 0; x--) {
123
- var route = routesWithPaths[x];
121
+ const route = routesWithPaths[x];
124
122
  if (route.path && route.path.startsWith('/')) {
125
123
  index = x;
126
124
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouterv3.js","sources":["../../src/reactrouterv3.ts"],"sourcesContent":["import { Primitive, Transaction, TransactionContext, TransactionSource } from '@sentry/types';\nimport { getGlobalObject } from '@sentry/utils';\n\nimport { Location, ReactRouterInstrumentation } from './types';\n\n// Many of the types below had to be mocked out to prevent typescript issues\n// these types are required for correct functionality.\n\ntype HistoryV3 = {\n location?: Location;\n listen?(cb: (location: Location) => void): void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} & Record<string, any>;\n\nexport type Route = { path?: string; childRoutes?: Route[] };\n\nexport type Match = (\n props: { location: Location; routes: Route[] },\n cb: (error?: Error, _redirectLocation?: Location, renderProps?: { routes?: Route[] }) => void,\n) => void;\n\ntype ReactRouterV3TransactionSource = Extract<TransactionSource, 'url' | 'route'>;\n\nconst global = getGlobalObject<Window>();\n\n/**\n * Creates routing instrumentation for React Router v3\n * Works for React Router >= 3.2.0 and < 4.0.0\n *\n * @param history object from the `history` library\n * @param routes a list of all routes, should be\n * @param match `Router.match` utility\n */\nexport function reactRouterV3Instrumentation(\n history: HistoryV3,\n routes: Route[],\n match: Match,\n): ReactRouterInstrumentation {\n return (\n startTransaction: (context: TransactionContext) => Transaction | undefined,\n startTransactionOnPageLoad: boolean = true,\n startTransactionOnLocationChange: boolean = true,\n ) => {\n let activeTransaction: Transaction | undefined;\n let prevName: string | undefined;\n\n // Have to use global.location because history.location might not be defined.\n if (startTransactionOnPageLoad && global && global.location) {\n normalizeTransactionName(\n routes,\n global.location as unknown as Location,\n match,\n (localName: string, source: ReactRouterV3TransactionSource = 'url') => {\n prevName = localName;\n activeTransaction = startTransaction({\n name: prevName,\n op: 'pageload',\n tags: {\n 'routing.instrumentation': 'react-router-v3',\n },\n metadata: {\n source,\n },\n });\n },\n );\n }\n\n if (startTransactionOnLocationChange && history.listen) {\n history.listen(location => {\n if (location.action === 'PUSH' || location.action === 'POP') {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n const tags: Record<string, Primitive> = {\n 'routing.instrumentation': 'react-router-v3',\n };\n if (prevName) {\n tags.from = prevName;\n }\n normalizeTransactionName(routes, location, match, (localName: string, source: TransactionSource = 'url') => {\n prevName = localName;\n activeTransaction = startTransaction({\n name: prevName,\n op: 'navigation',\n tags,\n metadata: {\n source,\n },\n });\n });\n }\n });\n }\n };\n}\n\n/**\n * Normalize transaction names using `Router.match`\n */\nfunction normalizeTransactionName(\n appRoutes: Route[],\n location: Location,\n match: Match,\n callback: (pathname: string, source?: ReactRouterV3TransactionSource) => void,\n): void {\n let name = location.pathname;\n match(\n {\n location,\n routes: appRoutes,\n },\n (error, _redirectLocation, renderProps) => {\n if (error || !renderProps) {\n return callback(name);\n }\n\n const routePath = getRouteStringFromRoutes(renderProps.routes || []);\n if (routePath.length === 0 || routePath === '/*') {\n return callback(name);\n }\n\n name = routePath;\n return callback(name, 'route');\n },\n );\n}\n\n/**\n * Generate route name from array of routes\n */\nfunction getRouteStringFromRoutes(routes: Route[]): string {\n if (!Array.isArray(routes) || routes.length === 0) {\n return '';\n }\n\n const routesWithPaths: Route[] = routes.filter((route: Route) => !!route.path);\n\n let index = -1;\n for (let x = routesWithPaths.length - 1; x >= 0; x--) {\n const route = routesWithPaths[x];\n if (route.path && route.path.startsWith('/')) {\n index = x;\n break;\n }\n }\n\n return routesWithPaths\n .slice(index)\n .filter(({ path }) => !!path)\n .map(({ path }) => path)\n .join('');\n}\n"],"names":[],"mappings":";;AAKA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"reactrouterv3.js","sources":["../../src/reactrouterv3.ts"],"sourcesContent":["import { Primitive, Transaction, TransactionContext, TransactionSource } from '@sentry/types';\nimport { WINDOW } from '@sentry/utils';\n\nimport { Location, ReactRouterInstrumentation } from './types';\n\n// Many of the types below had to be mocked out to prevent typescript issues\n// these types are required for correct functionality.\n\ntype HistoryV3 = {\n location?: Location;\n listen?(cb: (location: Location) => void): void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} & Record<string, any>;\n\nexport type Route = { path?: string; childRoutes?: Route[] };\n\nexport type Match = (\n props: { location: Location; routes: Route[] },\n cb: (error?: Error, _redirectLocation?: Location, renderProps?: { routes?: Route[] }) => void,\n) => void;\n\ntype ReactRouterV3TransactionSource = Extract<TransactionSource, 'url' | 'route'>;\n\n/**\n * Creates routing instrumentation for React Router v3\n * Works for React Router >= 3.2.0 and < 4.0.0\n *\n * @param history object from the `history` library\n * @param routes a list of all routes, should be\n * @param match `Router.match` utility\n */\nexport function reactRouterV3Instrumentation(\n history: HistoryV3,\n routes: Route[],\n match: Match,\n): ReactRouterInstrumentation {\n return (\n startTransaction: (context: TransactionContext) => Transaction | undefined,\n startTransactionOnPageLoad: boolean = true,\n startTransactionOnLocationChange: boolean = true,\n ) => {\n let activeTransaction: Transaction | undefined;\n let prevName: string | undefined;\n\n // Have to use window.location because history.location might not be defined.\n if (startTransactionOnPageLoad && WINDOW && WINDOW.location) {\n normalizeTransactionName(\n routes,\n WINDOW.location as unknown as Location,\n match,\n (localName: string, source: ReactRouterV3TransactionSource = 'url') => {\n prevName = localName;\n activeTransaction = startTransaction({\n name: prevName,\n op: 'pageload',\n tags: {\n 'routing.instrumentation': 'react-router-v3',\n },\n metadata: {\n source,\n },\n });\n },\n );\n }\n\n if (startTransactionOnLocationChange && history.listen) {\n history.listen(location => {\n if (location.action === 'PUSH' || location.action === 'POP') {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n const tags: Record<string, Primitive> = {\n 'routing.instrumentation': 'react-router-v3',\n };\n if (prevName) {\n tags.from = prevName;\n }\n normalizeTransactionName(routes, location, match, (localName: string, source: TransactionSource = 'url') => {\n prevName = localName;\n activeTransaction = startTransaction({\n name: prevName,\n op: 'navigation',\n tags,\n metadata: {\n source,\n },\n });\n });\n }\n });\n }\n };\n}\n\n/**\n * Normalize transaction names using `Router.match`\n */\nfunction normalizeTransactionName(\n appRoutes: Route[],\n location: Location,\n match: Match,\n callback: (pathname: string, source?: ReactRouterV3TransactionSource) => void,\n): void {\n let name = location.pathname;\n match(\n {\n location,\n routes: appRoutes,\n },\n (error, _redirectLocation, renderProps) => {\n if (error || !renderProps) {\n return callback(name);\n }\n\n const routePath = getRouteStringFromRoutes(renderProps.routes || []);\n if (routePath.length === 0 || routePath === '/*') {\n return callback(name);\n }\n\n name = routePath;\n return callback(name, 'route');\n },\n );\n}\n\n/**\n * Generate route name from array of routes\n */\nfunction getRouteStringFromRoutes(routes: Route[]): string {\n if (!Array.isArray(routes) || routes.length === 0) {\n return '';\n }\n\n const routesWithPaths: Route[] = routes.filter((route: Route) => !!route.path);\n\n let index = -1;\n for (let x = routesWithPaths.length - 1; x >= 0; x--) {\n const route = routesWithPaths[x];\n if (route.path && route.path.startsWith('/')) {\n index = x;\n break;\n }\n }\n\n return routesWithPaths\n .slice(index)\n .filter(({ path }) => !!path)\n .map(({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A,CAAA;AACA,CAAA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA,CAAA,MAAA,EAAA;AACA,EAAA,IAAA,CAAA,KAAA,CAAA,OAAA,CAAA,MAAA,CAAA,IAAA,MAAA,CAAA,MAAA,KAAA,CAAA,EAAA;AACA,IAAA,OAAA,EAAA,CAAA;AACA,GAAA;AACA;AACA,EAAA,MAAA,eAAA,GAAA,MAAA,CAAA,MAAA,CAAA,CAAA,KAAA,KAAA,CAAA,CAAA,KAAA,CAAA,IAAA,CAAA,CAAA;AACA;AACA,EAAA,IAAA,KAAA,GAAA,CAAA,CAAA,CAAA;AACA,EAAA,KAAA,IAAA,CAAA,GAAA,eAAA,CAAA,MAAA,GAAA,CAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,EAAA,EAAA;AACA,IAAA,MAAA,KAAA,GAAA,eAAA,CAAA,CAAA,CAAA,CAAA;AACA,IAAA,IAAA,KAAA,CAAA,IAAA,IAAA,KAAA,CAAA,IAAA,CAAA,UAAA,CAAA,GAAA,CAAA,EAAA;AACA,MAAA,KAAA,GAAA,CAAA,CAAA;AACA,MAAA,MAAA;AACA,KAAA;AACA,GAAA;AACA;AACA,EAAA,OAAA,eAAA;AACA,KAAA,KAAA,CAAA,KAAA,CAAA;AACA,KAAA,MAAA,CAAA,CAAA,EAAA,IAAA,EAAA,KAAA,CAAA,CAAA,IAAA,CAAA;AACA,KAAA,GAAA,CAAA,CAAA,EAAA,IAAA,EAAA,KAAA,IAAA,CAAA;AACA,KAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AACA;;;;"}
@@ -1,8 +1,8 @@
1
- import { getGlobalObject, getNumberOfUrlSegments, logger } from '@sentry/utils';
1
+ import { WINDOW, getNumberOfUrlSegments, logger } from '@sentry/utils';
2
2
  import hoistNonReactStatics from 'hoist-non-react-statics';
3
3
  import React__default from 'react';
4
4
 
5
- var _jsxFileName = "/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouterv6.tsx";
5
+ const _jsxFileName = "/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouterv6.tsx";
6
6
 
7
7
  let activeTransaction;
8
8
 
@@ -14,9 +14,7 @@ let _matchRoutes;
14
14
  let _customStartTransaction;
15
15
  let _startTransactionOnLocationChange;
16
16
 
17
- var global = getGlobalObject();
18
-
19
- var SENTRY_TAGS = {
17
+ const SENTRY_TAGS = {
20
18
  'routing.instrumentation': 'react-router-v6',
21
19
  };
22
20
 
@@ -32,7 +30,7 @@ function reactRouterV6Instrumentation(
32
30
  startTransactionOnPageLoad = true,
33
31
  startTransactionOnLocationChange = true,
34
32
  ) => {
35
- var initPathName = global && global.location && global.location.pathname;
33
+ const initPathName = WINDOW && WINDOW.location && WINDOW.location.pathname;
36
34
  if (startTransactionOnPageLoad && initPathName) {
37
35
  activeTransaction = customStartTransaction({
38
36
  name: initPathName,
@@ -64,29 +62,33 @@ function getNormalizedName(
64
62
  return [location.pathname, 'url'];
65
63
  }
66
64
 
67
- var branches = matchRoutes(routes, location);
65
+ const branches = matchRoutes(routes, location);
68
66
 
69
67
  let pathBuilder = '';
70
68
  if (branches) {
71
69
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
72
70
  for (let x = 0; x < branches.length; x++) {
73
- var branch = branches[x];
74
- var route = branch.route;
71
+ const branch = branches[x];
72
+ const route = branch.route;
75
73
  if (route) {
76
74
  // Early return if index route
77
75
  if (route.index) {
78
76
  return [branch.pathname, 'route'];
79
77
  }
80
78
 
81
- var path = route.path;
79
+ const path = route.path;
82
80
  if (path) {
83
- var newPath = path[0] === '/' ? path : `/${path}`;
81
+ const newPath = path[0] === '/' || pathBuilder[pathBuilder.length - 1] === '/' ? path : `/${path}`;
84
82
  pathBuilder += newPath;
85
83
  if (branch.pathname === location.pathname) {
86
- // If the route defined on the element is something like
87
- // <Route path="/stores/:storeId/products/:productId" element={<div>Product</div>} />
88
- // We should check against the branch.pathname for the number of / seperators
89
- if (getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname)) {
84
+ if (
85
+ // If the route defined on the element is something like
86
+ // <Route path="/stores/:storeId/products/:productId" element={<div>Product</div>} />
87
+ // We should check against the branch.pathname for the number of / seperators
88
+ getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname) &&
89
+ // We should not count wildcard operators in the url segments calculation
90
+ pathBuilder.slice(-2) !== '/*'
91
+ ) {
90
92
  return [newPath, 'route'];
91
93
  }
92
94
  return [pathBuilder, 'route'];
@@ -156,9 +158,9 @@ function withSentryReactRouterV6Routing(Routes) {
156
158
  let isBaseLocation = false;
157
159
  let routes;
158
160
 
159
- var SentryRoutes = (props) => {
160
- var location = _useLocation();
161
- var navigationType = _useNavigationType();
161
+ const SentryRoutes = (props) => {
162
+ const location = _useLocation();
163
+ const navigationType = _useNavigationType();
162
164
 
163
165
  _useEffect(() => {
164
166
  // Performance concern:
@@ -178,7 +180,7 @@ function withSentryReactRouterV6Routing(Routes) {
178
180
 
179
181
  // @ts-ignore Setting more specific React Component typing for `R` generic above
180
182
  // will break advanced type inference done by react router params
181
- return React__default.createElement(Routes, { ...props, __self: this, __source: {fileName: _jsxFileName, lineNumber: 225}} );
183
+ return React__default.createElement(Routes, { ...props, __self: this, __source: {fileName: _jsxFileName, lineNumber: 227}} );
182
184
  };
183
185
 
184
186
  hoistNonReactStatics(SentryRoutes, Routes);
@@ -201,12 +203,12 @@ function wrapUseRoutes(origUseRoutes) {
201
203
  let isBaseLocation = false;
202
204
 
203
205
  return (routes, location) => {
204
- var SentryRoutes = (props) => {
205
- var Routes = origUseRoutes(routes, location);
206
+ const SentryRoutes = (props) => {
207
+ const Routes = origUseRoutes(routes, location);
206
208
 
207
- var locationArgObject = typeof location === 'string' ? { pathname: location } : location;
208
- var locationObject = (locationArgObject ) || _useLocation();
209
- var navigationType = _useNavigationType();
209
+ const locationArgObject = typeof location === 'string' ? { pathname: location } : location;
210
+ const locationObject = (locationArgObject ) || _useLocation();
211
+ const navigationType = _useNavigationType();
210
212
 
211
213
  _useEffect(() => {
212
214
  isBaseLocation = true;
@@ -223,7 +225,7 @@ function wrapUseRoutes(origUseRoutes) {
223
225
  return Routes;
224
226
  };
225
227
 
226
- return React__default.createElement(SentryRoutes, {__self: this, __source: {fileName: _jsxFileName, lineNumber: 270}} );
228
+ return React__default.createElement(SentryRoutes, {__self: this, __source: {fileName: _jsxFileName, lineNumber: 272}} );
227
229
  };
228
230
  }
229
231
 
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouterv6.js","sources":["../../src/reactrouterv6.tsx"],"sourcesContent":["// Inspired from Donnie McNeal's solution:\n// https://gist.github.com/wontondon/e8c4bdf2888875e4c755712e99279536\n\nimport { Transaction, TransactionContext, TransactionSource } from '@sentry/types';\nimport { getGlobalObject, getNumberOfUrlSegments, logger } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport React from 'react';\n\nimport { Action, Location } from './types';\n\ninterface RouteObject {\n caseSensitive?: boolean;\n children?: RouteObject[];\n element?: React.ReactNode;\n index?: boolean;\n path?: string;\n}\n\ntype Params<Key extends string = string> = {\n readonly [key in Key]: string | undefined;\n};\n\ntype UseRoutes = (routes: RouteObject[], locationArg?: Partial<Location> | string) => React.ReactElement | null;\n\n// https://github.com/remix-run/react-router/blob/9fa54d643134cd75a0335581a75db8100ed42828/packages/react-router/lib/router.ts#L114-L134\ninterface RouteMatch<ParamKey extends string = string> {\n /**\n * The names and values of dynamic parameters in the URL.\n */\n params: Params<ParamKey>;\n /**\n * The portion of the URL pathname that was matched.\n */\n pathname: string;\n /**\n * The portion of the URL pathname that was matched before child routes.\n */\n pathnameBase: string;\n /**\n * The route object that was used to match.\n */\n route: RouteObject;\n}\n\ntype UseEffect = (cb: () => void, deps: unknown[]) => void;\ntype UseLocation = () => Location;\ntype UseNavigationType = () => Action;\ntype CreateRoutesFromChildren = (children: JSX.Element[]) => RouteObject[];\ntype MatchRoutes = (routes: RouteObject[], location: Location) => RouteMatch[] | null;\n\nlet activeTransaction: Transaction | undefined;\n\nlet _useEffect: UseEffect;\nlet _useLocation: UseLocation;\nlet _useNavigationType: UseNavigationType;\nlet _createRoutesFromChildren: CreateRoutesFromChildren;\nlet _matchRoutes: MatchRoutes;\nlet _customStartTransaction: (context: TransactionContext) => Transaction | undefined;\nlet _startTransactionOnLocationChange: boolean;\n\nconst global = getGlobalObject<Window>();\n\nconst SENTRY_TAGS = {\n 'routing.instrumentation': 'react-router-v6',\n};\n\nexport function reactRouterV6Instrumentation(\n useEffect: UseEffect,\n useLocation: UseLocation,\n useNavigationType: UseNavigationType,\n createRoutesFromChildren: CreateRoutesFromChildren,\n matchRoutes: MatchRoutes,\n) {\n return (\n customStartTransaction: (context: TransactionContext) => Transaction | undefined,\n startTransactionOnPageLoad = true,\n startTransactionOnLocationChange = true,\n ): void => {\n const initPathName = global && global.location && global.location.pathname;\n if (startTransactionOnPageLoad && initPathName) {\n activeTransaction = customStartTransaction({\n name: initPathName,\n op: 'pageload',\n tags: SENTRY_TAGS,\n metadata: {\n source: 'url',\n },\n });\n }\n\n _useEffect = useEffect;\n _useLocation = useLocation;\n _useNavigationType = useNavigationType;\n _matchRoutes = matchRoutes;\n _createRoutesFromChildren = createRoutesFromChildren;\n\n _customStartTransaction = customStartTransaction;\n _startTransactionOnLocationChange = startTransactionOnLocationChange;\n };\n}\n\nfunction getNormalizedName(\n routes: RouteObject[],\n location: Location,\n matchRoutes: MatchRoutes,\n): [string, TransactionSource] {\n if (!routes || routes.length === 0 || !matchRoutes) {\n return [location.pathname, 'url'];\n }\n\n const branches = matchRoutes(routes, location);\n\n let pathBuilder = '';\n if (branches) {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let x = 0; x < branches.length; x++) {\n const branch = branches[x];\n const route = branch.route;\n if (route) {\n // Early return if index route\n if (route.index) {\n return [branch.pathname, 'route'];\n }\n\n const path = route.path;\n if (path) {\n const newPath = path[0] === '/' ? path : `/${path}`;\n pathBuilder += newPath;\n if (branch.pathname === location.pathname) {\n // If the route defined on the element is something like\n // <Route path=\"/stores/:storeId/products/:productId\" element={<div>Product</div>} />\n // We should check against the branch.pathname for the number of / seperators\n if (getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname)) {\n return [newPath, 'route'];\n }\n return [pathBuilder, 'route'];\n }\n }\n }\n }\n }\n\n return [location.pathname, 'url'];\n}\n\nfunction updatePageloadTransaction(location: Location, routes: RouteObject[]): void {\n if (activeTransaction) {\n activeTransaction.setName(...getNormalizedName(routes, location, _matchRoutes));\n }\n}\n\nfunction handleNavigation(\n location: Location,\n routes: RouteObject[],\n navigationType: Action,\n isBaseLocation: boolean,\n): void {\n if (isBaseLocation) {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n\n return;\n }\n\n if (_startTransactionOnLocationChange && (navigationType === 'PUSH' || navigationType === 'POP')) {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n\n const [name, source] = getNormalizedName(routes, location, _matchRoutes);\n activeTransaction = _customStartTransaction({\n name,\n op: 'navigation',\n tags: SENTRY_TAGS,\n metadata: {\n source,\n },\n });\n }\n}\n\nexport function withSentryReactRouterV6Routing<P extends Record<string, any>, R extends React.FC<P>>(Routes: R): R {\n if (\n !_useEffect ||\n !_useLocation ||\n !_useNavigationType ||\n !_createRoutesFromChildren ||\n !_matchRoutes ||\n !_customStartTransaction\n ) {\n __DEBUG_BUILD__ &&\n logger.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.\n useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.\n createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}. customStartTransaction: ${_customStartTransaction}.`);\n\n return Routes;\n }\n\n let isBaseLocation: boolean = false;\n let routes: RouteObject[];\n\n const SentryRoutes: React.FC<P> = (props: P) => {\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n _useEffect(() => {\n // Performance concern:\n // This is repeated when <Routes /> is rendered.\n routes = _createRoutesFromChildren(props.children);\n isBaseLocation = true;\n\n updatePageloadTransaction(location, routes);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.children]);\n\n _useEffect(() => {\n handleNavigation(location, routes, navigationType, isBaseLocation);\n }, [props.children, location, navigationType, isBaseLocation]);\n\n isBaseLocation = false;\n\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return <Routes {...props} />;\n };\n\n hoistNonReactStatics(SentryRoutes, Routes);\n\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return SentryRoutes;\n}\n\nexport function wrapUseRoutes(origUseRoutes: UseRoutes): UseRoutes {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes || !_customStartTransaction) {\n __DEBUG_BUILD__ &&\n logger.warn(\n 'reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.',\n );\n\n return origUseRoutes;\n }\n\n let isBaseLocation: boolean = false;\n\n return (routes: RouteObject[], location?: Partial<Location> | string): React.ReactElement | null => {\n const SentryRoutes: React.FC<unknown> = (props: unknown) => {\n const Routes = origUseRoutes(routes, location);\n\n const locationArgObject = typeof location === 'string' ? { pathname: location } : location;\n const locationObject = (locationArgObject as Location) || _useLocation();\n const navigationType = _useNavigationType();\n\n _useEffect(() => {\n isBaseLocation = true;\n\n updatePageloadTransaction(locationObject, routes);\n }, [props]);\n\n _useEffect(() => {\n handleNavigation(locationObject, routes, navigationType, isBaseLocation);\n }, [props, locationObject, navigationType, isBaseLocation]);\n\n isBaseLocation = false;\n\n return Routes;\n };\n\n return <SentryRoutes />;\n };\n}\n"],"names":[],"mappings":";;;;AAAA;;AAkDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"reactrouterv6.js","sources":["../../src/reactrouterv6.tsx"],"sourcesContent":["// Inspired from Donnie McNeal's solution:\n// https://gist.github.com/wontondon/e8c4bdf2888875e4c755712e99279536\n\nimport { Transaction, TransactionContext, TransactionSource } from '@sentry/types';\nimport { getNumberOfUrlSegments, logger, WINDOW } from '@sentry/utils';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport React from 'react';\n\nimport { Action, Location } from './types';\n\ninterface RouteObject {\n caseSensitive?: boolean;\n children?: RouteObject[];\n element?: React.ReactNode;\n index?: boolean;\n path?: string;\n}\n\ntype Params<Key extends string = string> = {\n readonly [key in Key]: string | undefined;\n};\n\ntype UseRoutes = (routes: RouteObject[], locationArg?: Partial<Location> | string) => React.ReactElement | null;\n\n// https://github.com/remix-run/react-router/blob/9fa54d643134cd75a0335581a75db8100ed42828/packages/react-router/lib/router.ts#L114-L134\ninterface RouteMatch<ParamKey extends string = string> {\n /**\n * The names and values of dynamic parameters in the URL.\n */\n params: Params<ParamKey>;\n /**\n * The portion of the URL pathname that was matched.\n */\n pathname: string;\n /**\n * The portion of the URL pathname that was matched before child routes.\n */\n pathnameBase: string;\n /**\n * The route object that was used to match.\n */\n route: RouteObject;\n}\n\ntype UseEffect = (cb: () => void, deps: unknown[]) => void;\ntype UseLocation = () => Location;\ntype UseNavigationType = () => Action;\ntype CreateRoutesFromChildren = (children: JSX.Element[]) => RouteObject[];\ntype MatchRoutes = (routes: RouteObject[], location: Location) => RouteMatch[] | null;\n\nlet activeTransaction: Transaction | undefined;\n\nlet _useEffect: UseEffect;\nlet _useLocation: UseLocation;\nlet _useNavigationType: UseNavigationType;\nlet _createRoutesFromChildren: CreateRoutesFromChildren;\nlet _matchRoutes: MatchRoutes;\nlet _customStartTransaction: (context: TransactionContext) => Transaction | undefined;\nlet _startTransactionOnLocationChange: boolean;\n\nconst SENTRY_TAGS = {\n 'routing.instrumentation': 'react-router-v6',\n};\n\nexport function reactRouterV6Instrumentation(\n useEffect: UseEffect,\n useLocation: UseLocation,\n useNavigationType: UseNavigationType,\n createRoutesFromChildren: CreateRoutesFromChildren,\n matchRoutes: MatchRoutes,\n) {\n return (\n customStartTransaction: (context: TransactionContext) => Transaction | undefined,\n startTransactionOnPageLoad = true,\n startTransactionOnLocationChange = true,\n ): void => {\n const initPathName = WINDOW && WINDOW.location && WINDOW.location.pathname;\n if (startTransactionOnPageLoad && initPathName) {\n activeTransaction = customStartTransaction({\n name: initPathName,\n op: 'pageload',\n tags: SENTRY_TAGS,\n metadata: {\n source: 'url',\n },\n });\n }\n\n _useEffect = useEffect;\n _useLocation = useLocation;\n _useNavigationType = useNavigationType;\n _matchRoutes = matchRoutes;\n _createRoutesFromChildren = createRoutesFromChildren;\n\n _customStartTransaction = customStartTransaction;\n _startTransactionOnLocationChange = startTransactionOnLocationChange;\n };\n}\n\nfunction getNormalizedName(\n routes: RouteObject[],\n location: Location,\n matchRoutes: MatchRoutes,\n): [string, TransactionSource] {\n if (!routes || routes.length === 0 || !matchRoutes) {\n return [location.pathname, 'url'];\n }\n\n const branches = matchRoutes(routes, location);\n\n let pathBuilder = '';\n if (branches) {\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let x = 0; x < branches.length; x++) {\n const branch = branches[x];\n const route = branch.route;\n if (route) {\n // Early return if index route\n if (route.index) {\n return [branch.pathname, 'route'];\n }\n\n const path = route.path;\n if (path) {\n const newPath = path[0] === '/' || pathBuilder[pathBuilder.length - 1] === '/' ? path : `/${path}`;\n pathBuilder += newPath;\n if (branch.pathname === location.pathname) {\n if (\n // If the route defined on the element is something like\n // <Route path=\"/stores/:storeId/products/:productId\" element={<div>Product</div>} />\n // We should check against the branch.pathname for the number of / seperators\n getNumberOfUrlSegments(pathBuilder) !== getNumberOfUrlSegments(branch.pathname) &&\n // We should not count wildcard operators in the url segments calculation\n pathBuilder.slice(-2) !== '/*'\n ) {\n return [newPath, 'route'];\n }\n return [pathBuilder, 'route'];\n }\n }\n }\n }\n }\n\n return [location.pathname, 'url'];\n}\n\nfunction updatePageloadTransaction(location: Location, routes: RouteObject[]): void {\n if (activeTransaction) {\n activeTransaction.setName(...getNormalizedName(routes, location, _matchRoutes));\n }\n}\n\nfunction handleNavigation(\n location: Location,\n routes: RouteObject[],\n navigationType: Action,\n isBaseLocation: boolean,\n): void {\n if (isBaseLocation) {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n\n return;\n }\n\n if (_startTransactionOnLocationChange && (navigationType === 'PUSH' || navigationType === 'POP')) {\n if (activeTransaction) {\n activeTransaction.finish();\n }\n\n const [name, source] = getNormalizedName(routes, location, _matchRoutes);\n activeTransaction = _customStartTransaction({\n name,\n op: 'navigation',\n tags: SENTRY_TAGS,\n metadata: {\n source,\n },\n });\n }\n}\n\nexport function withSentryReactRouterV6Routing<P extends Record<string, any>, R extends React.FC<P>>(Routes: R): R {\n if (\n !_useEffect ||\n !_useLocation ||\n !_useNavigationType ||\n !_createRoutesFromChildren ||\n !_matchRoutes ||\n !_customStartTransaction\n ) {\n __DEBUG_BUILD__ &&\n logger.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.\n useEffect: ${_useEffect}. useLocation: ${_useLocation}. useNavigationType: ${_useNavigationType}.\n createRoutesFromChildren: ${_createRoutesFromChildren}. matchRoutes: ${_matchRoutes}. customStartTransaction: ${_customStartTransaction}.`);\n\n return Routes;\n }\n\n let isBaseLocation: boolean = false;\n let routes: RouteObject[];\n\n const SentryRoutes: React.FC<P> = (props: P) => {\n const location = _useLocation();\n const navigationType = _useNavigationType();\n\n _useEffect(() => {\n // Performance concern:\n // This is repeated when <Routes /> is rendered.\n routes = _createRoutesFromChildren(props.children);\n isBaseLocation = true;\n\n updatePageloadTransaction(location, routes);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.children]);\n\n _useEffect(() => {\n handleNavigation(location, routes, navigationType, isBaseLocation);\n }, [props.children, location, navigationType, isBaseLocation]);\n\n isBaseLocation = false;\n\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return <Routes {...props} />;\n };\n\n hoistNonReactStatics(SentryRoutes, Routes);\n\n // @ts-ignore Setting more specific React Component typing for `R` generic above\n // will break advanced type inference done by react router params\n return SentryRoutes;\n}\n\nexport function wrapUseRoutes(origUseRoutes: UseRoutes): UseRoutes {\n if (!_useEffect || !_useLocation || !_useNavigationType || !_matchRoutes || !_customStartTransaction) {\n __DEBUG_BUILD__ &&\n logger.warn(\n 'reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.',\n );\n\n return origUseRoutes;\n }\n\n let isBaseLocation: boolean = false;\n\n return (routes: RouteObject[], location?: Partial<Location> | string): React.ReactElement | null => {\n const SentryRoutes: React.FC<unknown> = (props: unknown) => {\n const Routes = origUseRoutes(routes, location);\n\n const locationArgObject = typeof location === 'string' ? { pathname: location } : location;\n const locationObject = (locationArgObject as Location) || _useLocation();\n const navigationType = _useNavigationType();\n\n _useEffect(() => {\n isBaseLocation = true;\n\n updatePageloadTransaction(locationObject, routes);\n }, [props]);\n\n _useEffect(() => {\n handleNavigation(locationObject, routes, navigationType, isBaseLocation);\n }, [props, locationObject, navigationType, isBaseLocation]);\n\n isBaseLocation = false;\n\n return Routes;\n };\n\n return <SentryRoutes />;\n };\n}\n"],"names":["React"],"mappings":";;;;AAAA,MAAA,YAAA,GAAA,4FAAA,CAAA;;AAkDA,IAAA,iBAAA,CAAA;AACA;AACA,IAAA,UAAA,CAAA;AACA,IAAA,YAAA,CAAA;AACA,IAAA,kBAAA,CAAA;AACA,IAAA,yBAAA,CAAA;AACA,IAAA,YAAA,CAAA;AACA,IAAA,uBAAA,CAAA;AACA,IAAA,iCAAA,CAAA;AACA;AACA,MAAA,WAAA,GAAA;AACA,EAAA,yBAAA,EAAA,iBAAA;AACA,CAAA,CAAA;AACA;AACA,SAAA,4BAAA;AACA,EAAA,SAAA;AACA,EAAA,WAAA;AACA,EAAA,iBAAA;AACA,EAAA,wBAAA;AACA,EAAA,WAAA;AACA,EAAA;AACA,EAAA,OAAA;AACA,IAAA,sBAAA;AACA,IAAA,0BAAA,GAAA,IAAA;AACA,IAAA,gCAAA,GAAA,IAAA;AACA,OAAA;AACA,IAAA,MAAA,YAAA,GAAA,MAAA,IAAA,MAAA,CAAA,QAAA,IAAA,MAAA,CAAA,QAAA,CAAA,QAAA,CAAA;AACA,IAAA,IAAA,0BAAA,IAAA,YAAA,EAAA;AACA,MAAA,iBAAA,GAAA,sBAAA,CAAA;AACA,QAAA,IAAA,EAAA,YAAA;AACA,QAAA,EAAA,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AAA,CAAA,MAAA,EAAA,QAAA,KAAA;AACA,IAAA,MAAA,YAAA,GAAA,CAAA,KAAA,KAAA;AACA,MAAA,MAAA,MAAA,GAAA,aAAA,CAAA,MAAA,EAAA,QAAA,CAAA,CAAA;AACA;AACA,MAAA,MAAA,iBAAA,GAAA,OAAA,QAAA,KAAA,QAAA,GAAA,EAAA,QAAA,EAAA,QAAA,EAAA,GAAA,QAAA,CAAA;AACA,MAAA,MAAA,cAAA,GAAA,CAAA,iBAAA,MAAA,YAAA,EAAA,CAAA;AACA,MAAA,MAAA,cAAA,GAAA,kBAAA,EAAA,CAAA;AACA;AACA,MAAA,UAAA,CAAA,MAAA;AACA,QAAA,cAAA,GAAA,IAAA,CAAA;AACA;AACA,QAAA,yBAAA,CAAA,cAAA,EAAA,MAAA,CAAA,CAAA;AACA,OAAA,EAAA,CAAA,KAAA,CAAA,CAAA,CAAA;AACA;AACA,MAAA,UAAA,CAAA,MAAA;AACA,QAAA,gBAAA,CAAA,cAAA,EAAA,MAAA,EAAA,cAAA,EAAA,cAAA,CAAA,CAAA;AACA,OAAA,EAAA,CAAA,KAAA,EAAA,cAAA,EAAA,cAAA,EAAA,cAAA,CAAA,CAAA,CAAA;AACA;AACA,MAAA,cAAA,GAAA,KAAA,CAAA;AACA;AACA,MAAA,OAAA,MAAA,CAAA;AACA,KAAA,CAAA;AACA;AACA,IAAA,OAAAA,cAAA,CAAA,aAAA,CAAA,YAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,QAAA,EAAA,CAAA,QAAA,EAAA,YAAA,EAAA,UAAA,EAAA,GAAA,CAAA,CAAA,EAAA,CAAA;AACA,GAAA,CAAA;AACA;;;;"}
package/esm/redux.js CHANGED
@@ -2,10 +2,10 @@ import { configureScope } from '@sentry/browser';
2
2
 
3
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
4
4
 
5
- var ACTION_BREADCRUMB_CATEGORY = 'redux.action';
6
- var ACTION_BREADCRUMB_TYPE = 'info';
5
+ const ACTION_BREADCRUMB_CATEGORY = 'redux.action';
6
+ const ACTION_BREADCRUMB_TYPE = 'info';
7
7
 
8
- var defaultOptions = {
8
+ const defaultOptions = {
9
9
  actionTransformer: action => action,
10
10
  stateTransformer: state => state || null,
11
11
  };
@@ -17,19 +17,19 @@ var defaultOptions = {
17
17
  */
18
18
  function createReduxEnhancer(enhancerOptions) {
19
19
  // Note: We return an any type as to not have type conflicts.
20
- var options = {
20
+ const options = {
21
21
  ...defaultOptions,
22
22
  ...enhancerOptions,
23
23
  };
24
24
 
25
25
  return (next) =>
26
26
  (reducer, initialState) => {
27
- var sentryReducer = (state, action) => {
28
- var newState = reducer(state, action);
27
+ const sentryReducer = (state, action) => {
28
+ const newState = reducer(state, action);
29
29
 
30
30
  configureScope(scope => {
31
31
  /* Action breadcrumbs */
32
- var transformedAction = options.actionTransformer(action);
32
+ const transformedAction = options.actionTransformer(action);
33
33
  if (typeof transformedAction !== 'undefined' && transformedAction !== null) {
34
34
  scope.addBreadcrumb({
35
35
  category: ACTION_BREADCRUMB_CATEGORY,
@@ -39,7 +39,7 @@ function createReduxEnhancer(enhancerOptions) {
39
39
  }
40
40
 
41
41
  /* Set latest state to scope */
42
- var transformedState = options.stateTransformer(newState);
42
+ const transformedState = options.stateTransformer(newState);
43
43
  if (typeof transformedState !== 'undefined' && transformedState !== null) {
44
44
  scope.setContext('state', { state: { type: 'redux', value: transformedState } });
45
45
  } else {
package/esm/redux.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"redux.js","sources":["../../src/redux.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { configureScope } from '@sentry/browser';\nimport { Scope } from '@sentry/types';\n\ninterface Action<T = any> {\n type: T;\n}\n\ninterface AnyAction extends Action {\n [extraProps: string]: any;\n}\n\ntype Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;\n\ntype Dispatch<A extends Action = AnyAction> = <T extends A>(action: T, ...extraArgs: any[]) => T;\n\ntype ExtendState<State, Extension> = [Extension] extends [never] ? State : State & Extension;\n\ntype Unsubscribe = () => void;\n\ninterface Store<S = any, A extends Action = AnyAction, StateExt = never, Ext = Record<string, unknown>> {\n dispatch: Dispatch<A>;\n getState(): S;\n subscribe(listener: () => void): Unsubscribe;\n replaceReducer<NewState, NewActions extends Action>(\n nextReducer: Reducer<NewState, NewActions>,\n ): Store<ExtendState<NewState, StateExt>, NewActions, StateExt, Ext> & Ext;\n}\n\ndeclare const $CombinedState: unique symbol;\n\ntype CombinedState<S> = { readonly [$CombinedState]?: undefined } & S;\n\ntype PreloadedState<S> = Required<S> extends {\n [$CombinedState]: undefined;\n}\n ? S extends CombinedState<infer S1>\n ? { [K in keyof S1]?: S1[K] extends Record<string, unknown> ? PreloadedState<S1[K]> : S1[K] }\n : never\n : { [K in keyof S]: S[K] extends string | number | boolean | symbol ? S[K] : PreloadedState<S[K]> };\n\ntype StoreEnhancerStoreCreator<Ext = Record<string, unknown>, StateExt = never> = <\n S = any,\n A extends Action = AnyAction,\n>(\n reducer: Reducer<S, A>,\n preloadedState?: PreloadedState<S>,\n) => Store<ExtendState<S, StateExt>, A, StateExt, Ext> & Ext;\n\nexport interface SentryEnhancerOptions<S = any> {\n /**\n * Transforms the state before attaching it to an event.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not attach the state.\n */\n stateTransformer(state: S | undefined): (S & any) | null;\n /**\n * Transforms the action before sending it as a breadcrumb.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not send the breadcrumb.\n */\n actionTransformer(action: AnyAction): AnyAction | null;\n /**\n * Called on every state update, configure the Sentry Scope with the redux state.\n */\n configureScopeWithState?(scope: Scope, state: S): void;\n}\n\nconst ACTION_BREADCRUMB_CATEGORY = 'redux.action';\nconst ACTION_BREADCRUMB_TYPE = 'info';\n\nconst defaultOptions: SentryEnhancerOptions = {\n actionTransformer: action => action,\n stateTransformer: state => state || null,\n};\n\n/**\n * Creates an enhancer that would be passed to Redux's createStore to log actions and the latest state to Sentry.\n *\n * @param enhancerOptions Options to pass to the enhancer\n */\nfunction createReduxEnhancer(enhancerOptions?: Partial<SentryEnhancerOptions>): any {\n // Note: We return an any type as to not have type conflicts.\n const options = {\n ...defaultOptions,\n ...enhancerOptions,\n };\n\n return (next: StoreEnhancerStoreCreator): StoreEnhancerStoreCreator =>\n <S = any, A extends Action = AnyAction>(reducer: Reducer<S, A>, initialState?: PreloadedState<S>) => {\n const sentryReducer: Reducer<S, A> = (state, action): S => {\n const newState = reducer(state, action);\n\n configureScope(scope => {\n /* Action breadcrumbs */\n const transformedAction = options.actionTransformer(action);\n if (typeof transformedAction !== 'undefined' && transformedAction !== null) {\n scope.addBreadcrumb({\n category: ACTION_BREADCRUMB_CATEGORY,\n data: transformedAction,\n type: ACTION_BREADCRUMB_TYPE,\n });\n }\n\n /* Set latest state to scope */\n const transformedState = options.stateTransformer(newState);\n if (typeof transformedState !== 'undefined' && transformedState !== null) {\n scope.setContext('state', { state: { type: 'redux', value: transformedState } });\n } else {\n scope.setContext('state', null);\n }\n\n /* Allow user to configure scope with latest state */\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { configureScopeWithState } = options;\n if (typeof configureScopeWithState === 'function') {\n configureScopeWithState(scope, newState);\n }\n });\n\n return newState;\n };\n\n return next(sentryReducer, initialState);\n };\n}\n\nexport { createReduxEnhancer };\n"],"names":[],"mappings":";;AAAA;;AAoEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"redux.js","sources":["../../src/redux.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { configureScope } from '@sentry/browser';\nimport { Scope } from '@sentry/types';\n\ninterface Action<T = any> {\n type: T;\n}\n\ninterface AnyAction extends Action {\n [extraProps: string]: any;\n}\n\ntype Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;\n\ntype Dispatch<A extends Action = AnyAction> = <T extends A>(action: T, ...extraArgs: any[]) => T;\n\ntype ExtendState<State, Extension> = [Extension] extends [never] ? State : State & Extension;\n\ntype Unsubscribe = () => void;\n\ninterface Store<S = any, A extends Action = AnyAction, StateExt = never, Ext = Record<string, unknown>> {\n dispatch: Dispatch<A>;\n getState(): S;\n subscribe(listener: () => void): Unsubscribe;\n replaceReducer<NewState, NewActions extends Action>(\n nextReducer: Reducer<NewState, NewActions>,\n ): Store<ExtendState<NewState, StateExt>, NewActions, StateExt, Ext> & Ext;\n}\n\ndeclare const $CombinedState: unique symbol;\n\ntype CombinedState<S> = { readonly [$CombinedState]?: undefined } & S;\n\ntype PreloadedState<S> = Required<S> extends {\n [$CombinedState]: undefined;\n}\n ? S extends CombinedState<infer S1>\n ? { [K in keyof S1]?: S1[K] extends Record<string, unknown> ? PreloadedState<S1[K]> : S1[K] }\n : never\n : { [K in keyof S]: S[K] extends string | number | boolean | symbol ? S[K] : PreloadedState<S[K]> };\n\ntype StoreEnhancerStoreCreator<Ext = Record<string, unknown>, StateExt = never> = <\n S = any,\n A extends Action = AnyAction,\n>(\n reducer: Reducer<S, A>,\n preloadedState?: PreloadedState<S>,\n) => Store<ExtendState<S, StateExt>, A, StateExt, Ext> & Ext;\n\nexport interface SentryEnhancerOptions<S = any> {\n /**\n * Transforms the state before attaching it to an event.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not attach the state.\n */\n stateTransformer(state: S | undefined): (S & any) | null;\n /**\n * Transforms the action before sending it as a breadcrumb.\n * Use this to remove any private data before sending it to Sentry.\n * Return null to not send the breadcrumb.\n */\n actionTransformer(action: AnyAction): AnyAction | null;\n /**\n * Called on every state update, configure the Sentry Scope with the redux state.\n */\n configureScopeWithState?(scope: Scope, state: S): void;\n}\n\nconst ACTION_BREADCRUMB_CATEGORY = 'redux.action';\nconst ACTION_BREADCRUMB_TYPE = 'info';\n\nconst defaultOptions: SentryEnhancerOptions = {\n actionTransformer: action => action,\n stateTransformer: state => state || null,\n};\n\n/**\n * Creates an enhancer that would be passed to Redux's createStore to log actions and the latest state to Sentry.\n *\n * @param enhancerOptions Options to pass to the enhancer\n */\nfunction createReduxEnhancer(enhancerOptions?: Partial<SentryEnhancerOptions>): any {\n // Note: We return an any type as to not have type conflicts.\n const options = {\n ...defaultOptions,\n ...enhancerOptions,\n };\n\n return (next: StoreEnhancerStoreCreator): StoreEnhancerStoreCreator =>\n <S = any, A extends Action = AnyAction>(reducer: Reducer<S, A>, initialState?: PreloadedState<S>) => {\n const sentryReducer: Reducer<S, A> = (state, action): S => {\n const newState = reducer(state, action);\n\n configureScope(scope => {\n /* Action breadcrumbs */\n const transformedAction = options.actionTransformer(action);\n if (typeof transformedAction !== 'undefined' && transformedAction !== null) {\n scope.addBreadcrumb({\n category: ACTION_BREADCRUMB_CATEGORY,\n data: transformedAction,\n type: ACTION_BREADCRUMB_TYPE,\n });\n }\n\n /* Set latest state to scope */\n const transformedState = options.stateTransformer(newState);\n if (typeof transformedState !== 'undefined' && transformedState !== null) {\n scope.setContext('state', { state: { type: 'redux', value: transformedState } });\n } else {\n scope.setContext('state', null);\n }\n\n /* Allow user to configure scope with latest state */\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { configureScopeWithState } = options;\n if (typeof configureScopeWithState === 'function') {\n configureScopeWithState(scope, newState);\n }\n });\n\n return newState;\n };\n\n return next(sentryReducer, initialState);\n };\n}\n\nexport { createReduxEnhancer };\n"],"names":[],"mappings":";;AAAA;;AAoEA,MAAA,0BAAA,GAAA,cAAA,CAAA;AACA,MAAA,sBAAA,GAAA,MAAA,CAAA;AACA;AACA,MAAA,cAAA,GAAA;AACA,EAAA,iBAAA,EAAA,MAAA,IAAA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GAAA,OAAA,CAAA;AACA,UAAA,IAAA,OAAA,uBAAA,KAAA,UAAA,EAAA;AACA,YAAA,uBAAA,CAAA,KAAA,EAAA,QAAA,CAAA,CAAA;AACA,WAAA;AACA,SAAA,CAAA,CAAA;AACA;AACA,QAAA,OAAA,QAAA,CAAA;AACA,OAAA,CAAA;AACA;AACA,MAAA,OAAA,IAAA,CAAA,aAAA,EAAA,YAAA,CAAA,CAAA;AACA,KAAA,CAAA;AACA;;;;"}
package/esm/sdk.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { BrowserOptions, init as browserInit, SDK_VERSION } from '@sentry/browser';\n\n/**\n * Inits the React SDK\n */\nexport function init(options: BrowserOptions): void {\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || {\n name: 'sentry.javascript.react',\n packages: [\n {\n name: 'npm:@sentry/react',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n browserInit(options);\n}\n"],"names":[],"mappings":";;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { BrowserOptions, init as browserInit, SDK_VERSION } from '@sentry/browser';\n\n/**\n * Inits the React SDK\n */\nexport function init(options: BrowserOptions): void {\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || {\n name: 'sentry.javascript.react',\n packages: [\n {\n name: 'npm:@sentry/react',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n browserInit(options);\n}\n"],"names":["browserInit"],"mappings":";;AAEA;AACA;AACA;AACA,SAAA,IAAA,CAAA,OAAA,EAAA;AACA,EAAA,OAAA,CAAA,SAAA,GAAA,OAAA,CAAA,SAAA,IAAA,EAAA,CAAA;AACA,EAAA,OAAA,CAAA,SAAA,CAAA,GAAA,GAAA,OAAA,CAAA,SAAA,CAAA,GAAA,IAAA;AACA,IAAA,IAAA,EAAA,yBAAA;AACA,IAAA,QAAA,EAAA;AACA,MAAA;AACA,QAAA,IAAA,EAAA,mBAAA;AACA,QAAA,OAAA,EAAA,WAAA;AACA,OAAA;AACA,KAAA;AACA,IAAA,OAAA,EAAA,WAAA;AACA,GAAA,CAAA;AACA,EAAAA,MAAA,CAAA,OAAA,CAAA,CAAA;AACA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/react",
3
- "version": "7.15.0",
3
+ "version": "7.16.0",
4
4
  "description": "Official Sentry SDK for React.js",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/react",
@@ -16,9 +16,9 @@
16
16
  "access": "public"
17
17
  },
18
18
  "dependencies": {
19
- "@sentry/browser": "7.15.0",
20
- "@sentry/types": "7.15.0",
21
- "@sentry/utils": "7.15.0",
19
+ "@sentry/browser": "7.16.0",
20
+ "@sentry/types": "7.16.0",
21
+ "@sentry/utils": "7.16.0",
22
22
  "hoist-non-react-statics": "^3.3.2",
23
23
  "tslib": "^1.9.3"
24
24
  },
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouter.d.ts","sourceRoot":"","sources":["../../src/reactrouter.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAKvE,aAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1F,oBAAY,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,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C,EAAE,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAoB9G"}
@@ -1 +1 @@
1
- {"version":3,"file":"reactrouterv3.d.ts","sourceRoot":"","sources":["../../src/reactrouterv3.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAK/D,aAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,GAAG,IAAI,CAAC;CAEjD,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAExB,oBAAY,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAA;CAAE,CAAC;AAE7D,oBAAY,KAAK,GAAG,CAClB,KAAK,EAAE;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,KAAK,EAAE,CAAA;CAAE,EAC9C,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;CAAE,KAAK,IAAI,KAC1F,IAAI,CAAC;AAMV;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,KAAK,EAAE,EACf,KAAK,EAAE,KAAK,GACX,0BAA0B,CA0D5B"}
1
+ {"version":3,"file":"reactrouterv3.d.ts","sourceRoot":"","sources":["../../src/reactrouterv3.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAK/D,aAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,QA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