// Module ID: 9080 // Function ID: 9081 // Name: useTrackImpression // Dependencies: [19, 2041, 2095, 4609, 1242, 1249, 1241, 573, 4968, 1331, 4992, 5235, 2] // Exports: default // Module 9080 (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" /* 4968 */; import noop from "module_19" /* 19 */; import ChannelStore from "ChannelStore" /* 2041 */; import SelectedChannelStore from "SelectedChannelStore" /* 2095 */; import SelectedGuildStore from "SelectedGuildStore" /* 4609 */; 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(5235)(() => { 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(4992)("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(4992)("impression_"); trackImpression(obj, tmp.disableTrack); const fn = () => { if (null != obj) { closure_2_8(tmp); } }; } return fn; } }); }; export { trackImpression };