decord/beta/source/modules/app_analytics/useTrackImpression.tsx
github-actions 84d017ff78 chore: update source for beta 348.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-28 16:18:32 +00:00

136 lines
4.2 KiB
TypeScript

// Module ID: 8230
// Function ID: 8231
// Name: useTrackImpression
// Dependencies: [19, 2045, 2099, 4655, 1242, 1249, 1241, 573, 5016, 1331, 5040, 5298, 2]
// Exports: default
// Module 8230 (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" /* 5016 */;
import noop from "module_19" /* 19 */;
import ChannelStore from "ChannelStore" /* 2045 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2099 */;
import SelectedGuildStore from "SelectedGuildStore" /* 4655 */;
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(1241).debugLogEvent(name, result);
closure_12(name, result);
const tmpResult6 = tmp(1241);
}
React7(name, result);
tmp15 = null != name && null != type;
}
}
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");
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(5298)(() => {
if (obj.trackOnInitialLoad) {
const tmp6 = _modDef1331(ref.current, closure_0);
if (!tmp6) {
ref.current = tmp5;
}
const tmp10 = _modDef1331(ref2.current, current);
if (!tmp10) {
ref2.current = current;
}
if (!tmp6) {
obj = {};
const merged = Object.assign(tmp5);
obj.sequenceId = tmp2(5040)("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 = _modDef1331(ref.current, closure_0);
if (!tmp6) {
ref.current = tmp5;
}
const tmp10 = _modDef1331(ref2.current, current);
if (!tmp10) {
ref2.current = current;
}
if (!tmp6) {
obj = {};
const merged = Object.assign(tmp5);
obj.sequenceId = tmp2(5040)("impression_");
trackImpression(obj, tmp.disableTrack);
const fn = () => {
if (null != obj) {
closure_2_8(tmp);
}
};
}
return fn;
}
});
};
export { trackImpression };