180 lines
5.3 KiB
React
180 lines
5.3 KiB
React
// Metro module 1146 (f1147).
|
|
import { WINDOW, startBrowserTracingPageLoadSpan, startBrowserTracingNavigationSpan, browserTracingIntegration } from "./Module1024";
|
|
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getActiveSpan, getRootSpan, spanToJSON, getCurrentScope } from "./Module817";
|
|
import { hoistNonReactStatics } from "./getStatics";
|
|
function $mk68209($env) {
|
|
return (a0) => {
|
|
let match;
|
|
const r3 = $env;
|
|
if (a0.path) {
|
|
match = (0, r3[1])(r3[0], a0);
|
|
} else {
|
|
const r4 = r3[2];
|
|
match = r4.length ? r4[r4.length - 1].match : {
|
|
path: "/",
|
|
url: "/",
|
|
params: {},
|
|
isExact: r3[0] === "/"
|
|
};
|
|
}
|
|
if (match) {
|
|
let r17 = r3[2];
|
|
r17.push({
|
|
route: a0,
|
|
match
|
|
});
|
|
if (a0.routes) {
|
|
let env24240;
|
|
const routes3 = a0.routes;
|
|
const r23 = r3[0];
|
|
const r24 = r3[1];
|
|
const r26 = env24240 = {
|
|
$parent: $env.$parent
|
|
};
|
|
env24240[2] = void 0;
|
|
env24240[0] = r23;
|
|
env24240[1] = r24;
|
|
if (r17 === void 0) {
|
|
r17 = [];
|
|
}
|
|
env24240[2] = r17;
|
|
routes3.some($mk68209(r26));
|
|
}
|
|
}
|
|
return !!match;
|
|
};
|
|
}
|
|
let matchRoutes;
|
|
let env953 = {};
|
|
const instrumentReactRouter = function instrumentReactRouter(a0, a1, a2, a3, a4) {
|
|
let c12836_0 = a0;
|
|
let r5 = arguments[5];
|
|
if (r5 === void 0) {
|
|
r5 = [];
|
|
}
|
|
let c12836_2 = r5;
|
|
let c12836_3 = arguments[6];
|
|
const normalizeTransactionName2 = function normalizeTransactionName(a0) {
|
|
if (c12836_2.length !== 0) {
|
|
if (c12836_3) {
|
|
for (const item of matchRoutes(c12836_2, a0, c12836_3)) {
|
|
if (!item.match.isExact) {
|
|
continue;
|
|
}
|
|
return [item.match.path, "route"];
|
|
}
|
|
return [a0, "url"];
|
|
}
|
|
}
|
|
return [a0, "url"];
|
|
};
|
|
if (a1) {
|
|
const r22 = a3.location ? a3.location.pathname : WINDOW.location ? WINDOW.location.pathname : void 0;
|
|
if (r22) {
|
|
const [name, r32] = normalizeTransactionName2(r22);
|
|
const attributes = {};
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = "pageload";
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = `auto.pageload.react.${a4}`;
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = r32;
|
|
startBrowserTracingPageLoadSpan(a0, {
|
|
name,
|
|
attributes
|
|
});
|
|
}
|
|
}
|
|
if (a2 ? a3.listen : a2) {
|
|
a3.listen((a0, a1) => {
|
|
L4: {
|
|
if (a1) {
|
|
if (a1 !== "PUSH" && a1 !== "POP") {
|
|
break L4;
|
|
}
|
|
const [name, r8] = normalizeTransactionName2(a0.pathname);
|
|
const attributes = {};
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = "navigation";
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = `auto.navigation.react.${a4}`;
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = r8;
|
|
startBrowserTracingNavigationSpan(c12836_0, {
|
|
name,
|
|
attributes
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
};
|
|
matchRoutes = function matchRoutes(a0, a1, a2) {
|
|
let env12837;
|
|
const r2 = env12837 = {
|
|
$parent: env953
|
|
};
|
|
env12837[0] = a1;
|
|
env12837[1] = a2;
|
|
let r6 = arguments[3];
|
|
if (r6 === void 0) {
|
|
r6 = [];
|
|
}
|
|
env12837[2] = r6;
|
|
a0.some($mk68209(r2));
|
|
return r6;
|
|
};
|
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
value: "Module"
|
|
});
|
|
export function reactRouterV4BrowserTracingIntegration(a0) {
|
|
const r14 = browserTracingIntegration({
|
|
...a0,
|
|
instrumentPageLoad: false,
|
|
instrumentNavigation: false
|
|
});
|
|
let c12838_0 = r14;
|
|
const { history: history2, routes, matchPath, instrumentPageLoad = true, instrumentNavigation = true } = a0;
|
|
return {
|
|
...r14,
|
|
afterAllSetup: (a0) => {
|
|
c12838_0.afterAllSetup(a0);
|
|
instrumentReactRouter(a0, instrumentPageLoad, instrumentNavigation, history2, "reactrouter_v4", routes, matchPath);
|
|
}
|
|
};
|
|
}
|
|
export function reactRouterV5BrowserTracingIntegration(a0) {
|
|
const r14 = browserTracingIntegration({
|
|
...a0,
|
|
instrumentPageLoad: false,
|
|
instrumentNavigation: false
|
|
});
|
|
let c12839_0 = r14;
|
|
const { history: history3, routes: routes2, matchPath: matchPath2, instrumentPageLoad: instrumentPageLoad2 = true, instrumentNavigation: instrumentNavigation2 = true } = a0;
|
|
return {
|
|
...r14,
|
|
afterAllSetup: (a0) => {
|
|
c12839_0.afterAllSetup(a0);
|
|
instrumentReactRouter(a0, instrumentPageLoad2, instrumentNavigation2, history3, "reactrouter_v5", routes2, matchPath2);
|
|
}
|
|
};
|
|
}
|
|
export function withSentryRouting(a0) {
|
|
const r7 = a0.displayName || a0.name;
|
|
const WrappedRoute = (props) => {
|
|
if (props == null ? void 0 : props.computedMatch?.isExact) {
|
|
const path = props.computedMatch.path;
|
|
const activeSpan = getActiveSpan();
|
|
const r9 = activeSpan && getRootSpan(activeSpan);
|
|
let r23 = void 0;
|
|
if (r9) {
|
|
const op = spanToJSON(r9).op;
|
|
r23 = op !== "navigation" ? op === "pageload" ? r9 : void 0 : r9;
|
|
}
|
|
getCurrentScope().setTransactionName(path);
|
|
if (r23) {
|
|
r23.updateName(path);
|
|
r23.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "route");
|
|
}
|
|
}
|
|
return <a0 {...props} />;
|
|
};
|
|
WrappedRoute.displayName = `sentryRoute(${r7})`;
|
|
hoistNonReactStatics(WrappedRoute, a0);
|
|
return WrappedRoute;
|
|
}
|