decord/source/modules/app_analytics/useTrackImpression.tsx

136 lines
4.1 KiB
TypeScript
Raw Normal View History

2026-09-02 09:53:35 +00:00
// Module ID: 8907
// Function ID: 8908
2026-07-20 16:05:17 +00:00
// Name: trackImpression
2026-09-02 09:53:35 +00:00
// Dependencies: [19, 1386, 1980, 4299, 696, 500, 695, 706, 4700, 656, 4724, 4945, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-09-02 09:53:35 +00:00
// Module 8907 (trackImpression)
import encodeProperties2 from "encodeProperties" /* 500 */;
import dispatcherDefault from "dispatcher" /* 706 */;
2026-09-01 10:26:29 +00:00
import collectGuildAnalyticsMetadata from "collectGuildAnalyticsMetadata" /* 4700 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "noop" /* 19 */;
2026-09-02 09:53:35 +00:00
import closure_4 from "ensureGuildLoaded" /* 1386 */;
import closure_5 from "handleConnectionOpen" /* 1980 */;
2026-09-01 10:26:29 +00:00
import closure_6 from "handleConnectionOpen" /* 4299 */;
2026-09-02 09:53:35 +00:00
import withEqualityFn from "withEqualityFn" /* 696 */;
import encodeProperties from "encodeProperties" /* 500 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function trackImpression(type, arg1, arg2) {
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
2026-07-29 08:29:29 +00:00
let flag2 = arg2;
if (arg2 === undefined) {
2026-07-20 16:05:17 +00:00
flag2 = false;
}
({ name, type, properties } = type);
2026-08-24 06:08:38 +00:00
if (type.type === encodeProperties2.ImpressionTypes.MODAL) {
2026-07-20 16:05:17 +00:00
if (null == type.name) {
let obj = callback4();
}
}
if (!flag2) {
callback(type);
}
let guild_id;
2026-07-29 08:29:29 +00:00
if (properties != null) {
2026-07-20 16:05:17 +00:00
guild_id = properties.guild_id;
}
2026-07-29 08:29:29 +00:00
if (guild_id == null) {
2026-07-20 16:05:17 +00:00
guild_id = guildId.getGuildId();
}
let channel_id;
2026-07-29 08:29:29 +00:00
if (properties != null) {
2026-07-20 16:05:17 +00:00
channel_id = properties.channel_id;
}
2026-07-29 08:29:29 +00:00
if (channel_id == null) {
2026-07-20 16:05:17 +00:00
channel_id = channelId.getChannelId(guild_id);
}
2026-09-02 09:53:35 +00:00
let tmpResult = tmp(695);
2026-07-20 16:05:17 +00:00
obj = { impression_type: type, location: callback3() };
2026-09-01 10:26:29 +00:00
tmpResult = tmp(4700);
2026-07-29 08:29:29 +00:00
const merged = Object.assign(tmpResult.collectGuildAnalyticsMetadata(guild_id));
2026-08-24 06:08:38 +00:00
const merged1 = Object.assign(collectGuildAnalyticsMetadata.collectChannelAnalyticsMetadata(channel.getChannel(channel_id)));
2026-07-20 16:05:17 +00:00
const merged2 = Object.assign(properties);
2026-07-29 08:29:29 +00:00
const result = tmpResult.expandEventProperties(obj);
2026-07-20 16:05:17 +00:00
if (flag) {
callback2(null, null);
} else {
2026-07-29 08:29:29 +00:00
if (tmp15) {
2026-09-02 09:53:35 +00:00
tmp(695).debugLogEvent(name, result);
2026-08-24 06:08:38 +00:00
callback5(name, result);
2026-09-02 09:53:35 +00:00
const tmpResult2 = tmp(695);
2026-07-20 16:05:17 +00:00
}
callback2(name, result);
2026-07-29 08:29:29 +00:00
tmp15 = null != name && null != type;
2026-07-20 16:05:17 +00:00
}
}
2026-08-24 06:08:38 +00:00
({ setCurrentImpression: error, cleanupImpression: closure_8, setDebugTrackedData: c9, getLocation: c10, getImpressionStack: unpackModuleId } = withEqualityFn);
encodeProperties = { analyticEventConfigs: require("expandEventProperties").AnalyticEventConfigs, dispatcher: dispatcherDefault, TRACK_ACTION_NAME: "TRACK" };
let closure_12 = encodeProperties.trackMaker(encodeProperties);
let result = require("set").fileFinishedImporting("modules/app_analytics/useTrackImpression.tsx");
2026-07-20 16:05:17 +00:00
export default function useTrackImpression(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
let obj = arg1;
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
}
2026-08-24 06:08:38 +00:00
dependencyMap = arg2;
2026-07-20 16:05:17 +00:00
let React;
2026-08-24 06:08:38 +00:00
closure_4 = undefined;
2026-07-20 16:05:17 +00:00
React = React.useRef(undefined);
2026-08-24 06:08:38 +00:00
closure_4 = React.useRef(undefined);
2026-09-01 10:26:29 +00:00
obj(4945)(() => {
2026-07-20 16:05:17 +00:00
if (obj.trackOnInitialLoad) {
2026-09-02 09:53:35 +00:00
const tmp6 = obj(656)(ref.current, obj);
2026-07-29 08:29:29 +00:00
if (!tmp6) {
ref.current = tmp5;
}
2026-09-02 09:53:35 +00:00
const tmp10 = obj(656)(ref2.current, dependencyMap);
2026-07-29 08:29:29 +00:00
if (!tmp10) {
ref2.current = dependencyMap;
}
if (!tmp6) {
obj = {};
const merged = Object.assign(tmp5);
2026-09-01 10:26:29 +00:00
obj.sequenceId = tmp2(4724)("impression_");
2026-08-24 06:08:38 +00:00
closure_1_13(obj, tmp.disableTrack);
2026-07-29 08:29:29 +00:00
const fn = () => {
if (null != obj) {
2026-08-24 06:08:38 +00:00
closure_1_8(tmp);
2026-07-29 08:29:29 +00:00
}
};
}
return fn;
2026-07-20 16:05:17 +00:00
}
});
const effect = React.useEffect(() => {
if (!obj.trackOnInitialLoad) {
2026-09-02 09:53:35 +00:00
const tmp6 = obj(656)(ref.current, obj);
2026-07-29 08:29:29 +00:00
if (!tmp6) {
ref.current = tmp5;
}
2026-09-02 09:53:35 +00:00
const tmp10 = obj(656)(ref2.current, dependencyMap);
2026-07-29 08:29:29 +00:00
if (!tmp10) {
ref2.current = dependencyMap;
}
if (!tmp6) {
obj = {};
const merged = Object.assign(tmp5);
2026-09-01 10:26:29 +00:00
obj.sequenceId = tmp2(4724)("impression_");
2026-08-24 06:08:38 +00:00
closure_1_13(obj, tmp.disableTrack);
2026-07-29 08:29:29 +00:00
const fn = () => {
if (null != obj) {
2026-08-24 06:08:38 +00:00
closure_1_8(tmp);
2026-07-29 08:29:29 +00:00
}
};
}
return fn;
2026-07-20 16:05:17 +00:00
}
});
};
export { trackImpression };