decord/alpha/source/modules/app_analytics/useTrackImpression.tsx

137 lines
4.2 KiB
TypeScript
Raw Normal View History

// Module ID: 9128
// Function ID: 9129
// Name: useTrackImpression
// Dependencies: [19, 2044, 2098, 4650, 1242, 1249, 1241, 573, 5009, 1331, 5033, 5290, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 9128 (useTrackImpression)
import DispatcherDefault from "Dispatcher" /* 573 */;
import AnalyticsUtils2 from "AnalyticsUtils" /* 1241 */;
import discord_common_AnalyticsUtils from "discord_common/AnalyticsUtils" /* 1249 */;
import _modDef1331 from "module_1331" /* 1331 */;
import AppAnalyticsUtils from "AppAnalyticsUtils" /* 5009 */;
import noop from "module_19" /* 19 */;
import ChannelStore from "ChannelStore" /* 2044 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2098 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4650 */;
2026-07-23 10:11:24 +00:00
require = fn;
function trackImpression(type, disableTrack, arg2) {
let flag = disableTrack;
if (disableTrack === undefined) {
2026-07-20 16:05:17 +00:00
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);
if (type.type === discord_common_AnalyticsUtils.ImpressionTypes.MODAL) {
2026-07-20 16:05:17 +00:00
if (null == type.name) {
const obj = closure_1_11();
2026-07-20 16:05:17 +00:00
}
}
if (!flag2) {
React5(type);
2026-07-20 16:05:17 +00:00
}
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) {
guild_id = SelectedGuildStore.getGuildId();
2026-07-20 16:05:17 +00:00
}
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) {
channel_id = SelectedChannelStore.getChannelId(guild_id);
2026-07-20 16:05:17 +00:00
}
const tmpResult = AnalyticsUtils2;
const obj2 = { impression_type: type, location: closure_1_10() };
const merged = Object.assign(AppAnalyticsUtils.collectGuildAnalyticsMetadata(guild_id));
const tmpResult4 = AppAnalyticsUtils;
const merged1 = Object.assign(AppAnalyticsUtils.collectChannelAnalyticsMetadata(ChannelStore.getChannel(channel_id)));
2026-07-20 16:05:17 +00:00
const merged2 = Object.assign(properties);
const result = tmpResult.expandEventProperties(obj2);
2026-07-20 16:05:17 +00:00
if (flag) {
React7(null, null);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (tmp15) {
tmp(1241).debugLogEvent(name, result);
closure_12(name, result);
const tmpResult6 = tmp(1241);
2026-07-20 16:05:17 +00:00
}
React7(name, result);
2026-07-29 08:29:29 +00:00
tmp15 = null != name && null != type;
2026-07-20 16:05:17 +00:00
}
}
const ImpressionStore = fn(1242);
({ setCurrentImpression: closure_7, cleanupImpression: closure_8, setDebugTrackedData: closure_9, getLocation: c10, getImpressionStack: closure_11 } = ImpressionStore);
const AnalyticsUtils = fn(1249);
let closure_12 = AnalyticsUtils.trackMaker({ analyticEventConfigs: fn(1241).AnalyticEventConfigs, dispatcher: DispatcherDefault, TRACK_ACTION_NAME: "TRACK" });
const size = fn(2);
let result = size.fileFinishedImporting("modules/app_analytics/useTrackImpression.tsx");
2026-07-20 16:05:17 +00:00
export default function useTrackImpression(arg0, arg1, current) {
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
}
dependencyMap = current;
noop = undefined;
noop = noop.useRef(undefined);
noop.useRef(undefined);
obj(5290)(() => {
2026-07-20 16:05:17 +00:00
if (obj.trackOnInitialLoad) {
const tmp6 = _modDef1331(ref.current, closure_0);
2026-07-29 08:29:29 +00:00
if (!tmp6) {
ref.current = tmp5;
}
const tmp10 = _modDef1331(ref2.current, current);
2026-07-29 08:29:29 +00:00
if (!tmp10) {
ref2.current = current;
2026-07-29 08:29:29 +00:00
}
if (!tmp6) {
obj = {};
const merged = Object.assign(tmp5);
obj.sequenceId = tmp2(5033)("impression_");
trackImpression(obj, tmp.disableTrack);
2026-07-29 08:29:29 +00:00
const fn = () => {
if (null != obj) {
closure_2_8(tmp);
2026-07-29 08:29:29 +00:00
}
};
}
return fn;
2026-07-20 16:05:17 +00:00
}
});
const effect = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (!obj.trackOnInitialLoad) {
const tmp6 = _modDef1331(ref.current, closure_0);
2026-07-29 08:29:29 +00:00
if (!tmp6) {
ref.current = tmp5;
}
const tmp10 = _modDef1331(ref2.current, current);
2026-07-29 08:29:29 +00:00
if (!tmp10) {
ref2.current = current;
2026-07-29 08:29:29 +00:00
}
if (!tmp6) {
obj = {};
const merged = Object.assign(tmp5);
obj.sequenceId = tmp2(5033)("impression_");
trackImpression(obj, tmp.disableTrack);
2026-07-29 08:29:29 +00:00
const fn = () => {
if (null != obj) {
closure_2_8(tmp);
2026-07-29 08:29:29 +00:00
}
};
}
return fn;
2026-07-20 16:05:17 +00:00
}
});
};
export { trackImpression };