95 lines
2.7 KiB
JavaScript
95 lines
2.7 KiB
JavaScript
// Metro module 1193 (f1194).
|
|
import { addBreadcrumb, debug, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from "./Module817";
|
|
import { startUserInteractionSpan } from "./Module1165";
|
|
import { UI_ACTION } from "./Module1155";
|
|
import { SPAN_ORIGIN_AUTO_INTERACTION } from "./Module1158";
|
|
let category, type, c997_4, c997_6;
|
|
const addGestureBreadcrumb = function addGestureBreadcrumb(a0, { event, name: name2 }) {
|
|
const r23 = {
|
|
message: a0,
|
|
level: "info",
|
|
type,
|
|
category
|
|
};
|
|
if (event) {
|
|
const data = {
|
|
gesture: name2
|
|
};
|
|
for (const item of Object.keys(c997_6)) {
|
|
const r34 = c997_6[item];
|
|
if (r34 in event) {
|
|
data[r34] = event[r34];
|
|
}
|
|
}
|
|
r23.data = data;
|
|
}
|
|
addBreadcrumb(r23);
|
|
debug.log(`[GestureTracing] ${r23.message}`);
|
|
};
|
|
category = "gesture";
|
|
type = "user";
|
|
c997_4 = "gesture";
|
|
c997_6 = {
|
|
NUMBER_OF_POINTERS: "numberOfPointers",
|
|
NUMBER_OF_TOUCHES: "numberOfTouches",
|
|
FORCE: "force",
|
|
FORCE_CHANGE: "forceChange",
|
|
ROTATION: "rotation",
|
|
ROTATION_CHANGE: "rotationChange",
|
|
SCALE: "scale",
|
|
SCALE_CHANGE: "scaleChange",
|
|
DURATION: "duration",
|
|
VELOCITY: "velocity",
|
|
VELOCITY_X: "velocityX",
|
|
VELOCITY_Y: "velocityY"
|
|
};
|
|
export const DEFAULT_BREADCRUMB_CATEGORY = "gesture";
|
|
export const DEFAULT_BREADCRUMB_TYPE = "user";
|
|
export const GESTURE_POSTFIX_LENGTH = 14;
|
|
export const ACTION_GESTURE_FALLBACK = "gesture";
|
|
export function sentryTraceGesture(a0, a1) {
|
|
let name, onBegin, onEnd;
|
|
const elementId = a0;
|
|
if (a1) {
|
|
if (a1.handlers) {
|
|
if (a0) {
|
|
name = a1.handlerName.length > 14 ? a1.handlerName.substring(0, a1.handlerName.length - 14).toLowerCase() : c997_4;
|
|
onBegin = a1.handlers.onBegin;
|
|
a1.handlers.onBegin = (a0) => {
|
|
const r22 = startUserInteractionSpan({
|
|
elementId,
|
|
op: `${UI_ACTION}.${name}`
|
|
});
|
|
if (r22) {
|
|
r22.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_INTERACTION);
|
|
}
|
|
addGestureBreadcrumb(`Gesture ${elementId} begin.`, {
|
|
event: a0,
|
|
name
|
|
});
|
|
if (onBegin) {
|
|
onBegin(a0);
|
|
}
|
|
};
|
|
onEnd = a1.handlers.onEnd;
|
|
a1.handlers.onEnd = (a0) => {
|
|
addGestureBreadcrumb(`Gesture ${elementId} end.`, {
|
|
event: a0,
|
|
name
|
|
});
|
|
if (onEnd) {
|
|
onEnd(a0);
|
|
}
|
|
};
|
|
return a1;
|
|
}
|
|
debug.warn("[GestureTracing] Can not wrap gesture without name.");
|
|
return a1;
|
|
}
|
|
debug.warn("[GestureTracing] Can not wrap gesture without handlers. If you want to wrap a gesture composition wrap individual gestures.");
|
|
return a1;
|
|
}
|
|
debug.warn("[GestureTracing] Gesture can not be undefined");
|
|
return a1;
|
|
}
|