decord/source/modules/app_analytics/useTrackImpression.tsx

121 lines
3.7 KiB
TypeScript
Raw Normal View History

2026-07-28 08:39:19 +00:00
// Module ID: 8402
// Function ID: 67030
2026-07-20 16:05:17 +00:00
// Name: trackImpression
2026-07-28 08:39:19 +00:00
// Dependencies: [31, 1348, 1907, 3982, 676, 480, 675, 686, 4359, 636, 4373, 4594, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-28 08:39:19 +00:00
// Module 8402 (trackImpression)
2026-07-23 10:11:24 +00:00
import result from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import closure_6 from "_isNativeReflectConstruct";
import withEqualityFn from "withEqualityFn";
import isThrottled from "isThrottled";
let closure_10;
let closure_11;
let closure_7;
let closure_8;
let closure_9;
const require = arg1;
2026-07-20 16:05:17 +00:00
function trackImpression(type, arg1, arg2) {
let name;
let properties;
let flag = arg1;
let flag2 = arg2;
if (arg1 === undefined) {
flag = false;
}
if (flag2 === undefined) {
flag2 = false;
}
({ name, type, properties } = type);
2026-07-23 10:11:24 +00:00
if (type.type === require(480) /* isThrottled */.ImpressionTypes.MODAL) {
2026-07-20 16:05:17 +00:00
if (null == type.name) {
let obj = callback4();
}
}
if (!flag2) {
callback(type);
}
let guild_id;
if (null != properties) {
guild_id = properties.guild_id;
}
if (null == guild_id) {
guild_id = guildId.getGuildId();
}
let channel_id;
if (null != properties) {
channel_id = properties.channel_id;
}
if (null == channel_id) {
channel_id = channelId.getChannelId(guild_id);
}
obj = { impression_type: type, location: callback3() };
2026-07-23 10:11:24 +00:00
const obj2 = require(675) /* expandLocation */;
2026-07-28 08:39:19 +00:00
const merged = Object.assign(require(4359) /* _createForOfIteratorHelperLoose */.collectGuildAnalyticsMetadata(guild_id));
const obj4 = require(4359) /* _createForOfIteratorHelperLoose */;
const merged1 = Object.assign(require(4359) /* _createForOfIteratorHelperLoose */.collectChannelAnalyticsMetadata(channel.getChannel(channel_id)));
2026-07-20 16:05:17 +00:00
const merged2 = Object.assign(properties);
const result = obj2.expandEventProperties(obj);
if (flag) {
callback2(null, null);
} else {
if (tmp13) {
2026-07-23 10:11:24 +00:00
require(675) /* expandLocation */.debugLogEvent(name, result);
isThrottled(name, result);
const obj6 = require(675) /* expandLocation */;
2026-07-20 16:05:17 +00:00
}
callback2(name, result);
2026-07-23 10:11:24 +00:00
tmp13 = null != name && null != type;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
({ setCurrentImpression: closure_7, cleanupImpression: closure_8, setDebugTrackedData: closure_9, getLocation: closure_10, getImpressionStack: closure_11 } = withEqualityFn);
isThrottled = { analyticEventConfigs: require("expandLocation").AnalyticEventConfigs, dispatcher: require("dispatcher"), TRACK_ACTION_NAME: "TRACK" };
isThrottled = isThrottled.trackMaker(isThrottled);
let result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/app_analytics/useTrackImpression.tsx");
2026-07-20 16:05:17 +00:00
export default function useTrackImpression(arg0) {
let obj = arg1;
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
2026-07-23 10:11:24 +00:00
obj = { disableTrack: false, trackOnInitialLoad: false };
2026-07-20 16:05:17 +00:00
}
const dependencyMap = arg2;
let React;
2026-07-23 10:11:24 +00:00
let _isNativeReflectConstruct;
2026-07-20 16:05:17 +00:00
function trackImpressionEffect() {
2026-07-23 10:11:24 +00:00
const tmp = !obj(636)(ref.current, obj);
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-23 10:11:24 +00:00
ref.current = obj;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const tmp4 = !obj(636)(ref2.current, dependencyMap);
2026-07-20 16:05:17 +00:00
if (tmp4) {
2026-07-23 10:11:24 +00:00
ref2.current = dependencyMap;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
obj = {};
const merged = Object.assign(obj);
2026-07-28 08:39:19 +00:00
obj["sequenceId"] = obj(4373)("impression_");
2026-07-23 10:11:24 +00:00
outer1_13(obj, obj.disableTrack);
2026-07-20 16:05:17 +00:00
return () => {
if (null != obj) {
2026-07-23 10:11:24 +00:00
outer2_8(obj);
2026-07-20 16:05:17 +00:00
}
};
}
React = React.useRef(undefined);
2026-07-23 10:11:24 +00:00
_isNativeReflectConstruct = React.useRef(undefined);
2026-07-28 08:39:19 +00:00
obj(4594)(() => {
2026-07-20 16:05:17 +00:00
if (obj.trackOnInitialLoad) {
return trackImpressionEffect();
}
});
const effect = React.useEffect(() => {
if (!obj.trackOnInitialLoad) {
return trackImpressionEffect();
}
});
};
export { trackImpression };