decord/stable/source/modules/app_analytics/useTrackImpression.tsx
github-actions e2bc0408ee chore: update source for stable 346.13
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-22 22:11:40 +00:00

136 lines
4.2 KiB
TypeScript

// Module ID: 8894
// Function ID: 8895
// Name: useTrackImpression
// Dependencies: [19, 1957, 2011, 4458, 1241, 1248, 1240, 573, 4816, 1330, 4840, 5073, 2]
// Exports: default
// Module 8894 (useTrackImpression)
import DispatcherDefault from "Dispatcher" /* 573 */;
import AnalyticsUtils2 from "AnalyticsUtils" /* 1240 */;
import discord_common_AnalyticsUtils from "discord_common/AnalyticsUtils" /* 1248 */;
import _modDef1330 from "module_1330" /* 1330 */;
import AppAnalyticsUtils from "AppAnalyticsUtils" /* 4816 */;
import noop from "module_19" /* 19 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4458 */;
require = fn;
function trackImpression(type, disableTrack, arg2) {
let flag = disableTrack;
if (disableTrack === undefined) {
flag = false;
}
let flag2 = arg2;
if (arg2 === undefined) {
flag2 = false;
}
({ name, type, properties } = type);
if (type.type === discord_common_AnalyticsUtils.ImpressionTypes.MODAL) {
if (null == type.name) {
const obj = closure_1_11();
}
}
if (!flag2) {
React5(type);
}
let guild_id;
if (properties != null) {
guild_id = properties.guild_id;
}
if (guild_id == null) {
guild_id = SelectedGuildStore.getGuildId();
}
let channel_id;
if (properties != null) {
channel_id = properties.channel_id;
}
if (channel_id == null) {
channel_id = SelectedChannelStore.getChannelId(guild_id);
}
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)));
const merged2 = Object.assign(properties);
const result = tmpResult.expandEventProperties(obj2);
if (flag) {
React7(null, null);
} else {
if (tmp15) {
tmp(1240).debugLogEvent(name, result);
closure_12(name, result);
const tmpResult6 = tmp(1240);
}
React7(name, result);
tmp15 = null != name && null != type;
}
}
const ImpressionStore = fn(1241);
({ setCurrentImpression: closure_7, cleanupImpression: closure_8, setDebugTrackedData: closure_9, getLocation: c10, getImpressionStack: closure_11 } = ImpressionStore);
const AnalyticsUtils = fn(1248);
let closure_12 = AnalyticsUtils.trackMaker({ analyticEventConfigs: fn(1240).AnalyticEventConfigs, dispatcher: DispatcherDefault, TRACK_ACTION_NAME: "TRACK" });
const size = fn(2);
let result = size.fileFinishedImporting("modules/app_analytics/useTrackImpression.tsx");
export default function useTrackImpression(arg0, arg1, current) {
closure_0 = arg0;
let obj = arg1;
if (arg1 === undefined) {
obj = { disableTrack: false, trackOnInitialLoad: false };
}
dependencyMap = current;
noop = undefined;
noop = noop.useRef(undefined);
noop.useRef(undefined);
obj(5073)(() => {
if (obj.trackOnInitialLoad) {
const tmp6 = _modDef1330(ref.current, closure_0);
if (!tmp6) {
ref.current = tmp5;
}
const tmp10 = _modDef1330(ref2.current, current);
if (!tmp10) {
ref2.current = current;
}
if (!tmp6) {
obj = {};
const merged = Object.assign(tmp5);
obj.sequenceId = tmp2(4840)("impression_");
trackImpression(obj, tmp.disableTrack);
const fn = () => {
if (null != obj) {
closure_2_8(tmp);
}
};
}
return fn;
}
});
const effect = noop.useEffect(() => {
if (!obj.trackOnInitialLoad) {
const tmp6 = _modDef1330(ref.current, closure_0);
if (!tmp6) {
ref.current = tmp5;
}
const tmp10 = _modDef1330(ref2.current, current);
if (!tmp10) {
ref2.current = current;
}
if (!tmp6) {
obj = {};
const merged = Object.assign(tmp5);
obj.sequenceId = tmp2(4840)("impression_");
trackImpression(obj, tmp.disableTrack);
const fn = () => {
if (null != obj) {
closure_2_8(tmp);
}
};
}
return fn;
}
});
};
export { trackImpression };