Files
discord-decomp/sources/modules/quests/lib/analytics/AnalyticsHooks.tsx
T
2026-07-27 16:20:00 +03:00

296 lines
17 KiB
TypeScript

/* Metro module 9949; source: modules/quests/lib/analytics/AnalyticsHooks.tsx; dependencies: [31, 661, 9513, 7110, 7091, 7122, 7120, 7071, 491, 477, 7127, 6531, 7121, 683, 2] */
function _fun77879(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:6, offset: 0x01e0f97d, size: 239 bytes, params: 8, frame: 20
const env0_0 = require;
const closure = useTrackQuestEventWithImpression;
const closure2 = useTrackAdContentEventWithImpression;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importAll(31) /* metro dependency 31 */;
const env0_4 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/lib/analytics/AnalyticsHooks.tsx');
exports.useTrackQuestEventWithImpression = closure;
exports.useTrackQuestContentClickedWithImpression = useTrackQuestContentClickedWithImpression;
exports.useTrackAdContentEventWithImpression = closure2;
exports.useTrackAdContentClickedWithImpression = useTrackAdContentClickedWithImpression;
exports.useQuestsEmbedFallbackAnalytics = useQuestsEmbedFallbackAnalytics;
exports.useBountyCarouselEmptyStateAnalytics = useBountyCarouselEmptyStateAnalytics;
exports.useQuestHomeEntrypointAnalyticsEvents = useQuestHomeEntrypointAnalyticsEvents;
}
function useTrackQuestEventWithImpression() { // fn#77880, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:131, offset: 0x01e0fa6c, size: 73 bytes, params: 1, frame: 14
return env0_3.useCallback(_fun77881,
[(require(9513) /* metro dependency 9513: ContentImpressionTrackerHooks */).useQuestImpression()]);
}
function useTrackAdContentEventWithImpression() { // fn#77882, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:343, offset: 0x01e0fb2b, size: 73 bytes, params: 1, frame: 14
return env0_3.useCallback(_fun77883,
[(require(9513) /* metro dependency 9513: ContentImpressionTrackerHooks */).useQuestImpression()]);
}
function useTrackQuestContentClickedWithImpression() { // fn#77884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:757, offset: 0x01e0fbea, size: 51 bytes, params: 1, frame: 14
return env0_3.useCallback(_fun77885, [useTrackQuestEventWithImpression()]);
}
function useTrackAdContentClickedWithImpression() { // fn#77887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:1857, offset: 0x01e0fecb, size: 51 bytes, params: 1, frame: 14
return env0_3.useCallback(_fun77888, [useTrackAdContentEventWithImpression()]);
}
function useQuestsEmbedFallbackAnalytics(a0, a1) { // fn#77890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:2802, offset: 0x01e1016a, size: 57 bytes, params: 3, frame: 15
const env0_0 = a0;
const env0_1 = a1;
env0_3.useEffect(_fun77891, [a0, a1]);
}
function useBountyCarouselEmptyStateAnalytics(a0) { // fn#77892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:2958, offset: 0x01e101d5, size: 46 bytes, params: 2, frame: 14
const env0_0 = a0;
env0_3.useEffect(_fun77893, [a0]);
}
function useQuestHomeEntrypointAnalyticsEvents({questHomeHero, shouldShowQuestHomeHeroContent}) { // fn#77894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:3129, offset: 0x01e1023c, size: 367 bytes, params: 2, frame: 19
let env0_3 = undefined;
const QuestContent = (require(6531) /* metro dependency 6531: QuestTypes */).QuestContent;
const r3 = shouldShowQuestHomeHeroContent ? QuestContent.QUEST_HOME_ENTRYPOINT_THEMED : QuestContent.QUEST_HOME_ENTRYPOINT;
const value2 = env0_3.useMemo(_fun77895, [r3]);
env0_3 = value2;
const value3 = env0_3.useCallback(_fun77896, [questHomeHero, shouldShowQuestHomeHeroContent, r3, value2]);
return env0_3.useMemo(_fun77901, [env0_3.useCallback(_fun77897, [value3]), env0_3.useCallback(_fun77898, [value3]),
env0_3.useCallback(function() {
importDefault(dependencyMap[13]).track(AnalyticEvents.QUEST_HOME_ONBOARDING_POPOVER_RENDERED);
}, []), env0_3.useCallback(_fun77900, [value2, questHomeHero])]);
}
function _fun77881(a0) { // fn#77881, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:232, offset: 0x01e0fab5, size: 118 bytes, params: 2, frame: 17
let value = environment.__proto__;
value = undefined;
const analyticsActionsModule = require(7110) /* metro dependency 7110: AnalyticsActions */;
const trackQuestEvent = analyticsActionsModule.trackQuestEvent;
const object3 = {};
copyDataProperties(object3, a0, undefined);
const object4 = {};
copyDataProperties(object4, a0.properties, undefined);
object4['impression_id'] = env0_0 == null ? value : env0_0.getId();
object3['properties'] = object4;
Reflect.apply(trackQuestEvent, analyticsActionsModule, [object3]);
return value;
}
function _fun77883(a0) { // fn#77883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:448, offset: 0x01e0fb74, size: 118 bytes, params: 2, frame: 17
let value = environment.__proto__;
value = undefined;
const analyticsActionsModule = require(7110) /* metro dependency 7110: AnalyticsActions */;
const trackAdContentEvent = analyticsActionsModule.trackAdContentEvent;
const object3 = {};
copyDataProperties(object3, a0, undefined);
const object4 = {};
copyDataProperties(object4, a0.properties, undefined);
object4['impression_id'] = env0_0 == null ? value : env0_0.getId();
object3['properties'] = object4;
Reflect.apply(trackAdContentEvent, analyticsActionsModule, [object3]);
return value;
}
function _fun77885({questId, questContent, questContentCTA, questContentPosition, questContentRowIndex, trackGuildAndChannelMetadata, sourceQuestContent}) { // fn#77885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:873, offset: 0x01e0fc1d, size: 205 bytes, params: 2, frame: 19
var environment;
let value = environment.__proto__;
const env0_7 = (require(7091) /* metro dependency 7091: QuestDataUtils */).getAdMetadataSealed(sourceQuestContent);
const env0_8 = (require(7091) /* metro dependency 7091: QuestDataUtils */).getAdTrafficMetadataSealed(sourceQuestContent,
questId);
const getAdUser = (require(7122) /* metro dependency 7122: AdDataUtilsAndroid */).getAdUser;
const analyticsTypesModule = require(7120) /* metro dependency 7120: AnalyticsTypes */;
const getQuestContentName = analyticsTypesModule.getQuestContentName;
value = Reflect.apply(getAdUser, value, [Reflect.apply(getQuestContentName, analyticsTypesModule, [questContent])]);
value.then(_fun77886);
}
function _fun77888({adContentId, relatedQuestId, adCreativeType, questContent, questContentCTA, questContentPosition, questContentRowIndex, trackGuildAndChannelMetadata, sourceQuestContent}) { // fn#77888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:1974, offset: 0x01e0fefe, size: 173 bytes, params: 2, frame: 16
var environment;
let value = environment.__proto__;
const getAdUser = (require(7122) /* metro dependency 7122: AdDataUtilsAndroid */).getAdUser;
const analyticsTypesModule = require(7120) /* metro dependency 7120: AnalyticsTypes */;
const getQuestContentName = analyticsTypesModule.getQuestContentName;
value = Reflect.apply(getAdUser, value, [Reflect.apply(getQuestContentName, analyticsTypesModule, [questContent])]);
value.then(_fun77889);
}
function _fun77891() { // fn#77891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:2861, offset: 0x01e101a3, size: 50 bytes, params: 1, frame: 14
const value = environment.__proto__;
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackQuestEmbedFallbackViewed(require, env0_0);
}
function _fun77893() { // fn#77893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:3020, offset: 0x01e10203, size: 57 bytes, params: 1, frame: 12
var value2;
if (env0_0 != null) {
value2 = environment.__proto__;
(require(7110) /* metro dependency 7110: AnalyticsActions */).trackBountyCarouselEmptyStateViewed(env0_0);
}
}
function _fun77895() { // fn#77895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:3344, offset: 0x01e103ab, size: 50 bytes, params: 1, frame: 11
let value = environment.__proto__;
value = require(7120) /* metro dependency 7120: AnalyticsTypes */;
value = value.getContentProperties(env0_2);
delete value.row_index;
return value;
}
function _fun77896(a0) { // fn#77896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:3439, offset: 0x01e103dd, size: 173 bytes, params: 2, frame: 18
var value2;
var value3;
var moduleValue;
var trackAdContentEvent;
var object2;
if (questHomeHero == null) {
value2 = environment.__proto__;
(importDefault(683) /* metro dependency 683: AnalyticsUtils */).track(a0, env0_3);
} else if (shouldShowQuestHomeHeroContent) {
value3 = environment.__proto__;
moduleValue = require(7110) /* metro dependency 7110: AnalyticsActions */;
trackAdContentEvent = moduleValue.trackAdContentEvent;
object2 = {};
object2.adContentId = questHomeHero.id;
object2.adCreativeType = (require(7121) /* metro dependency 7121: AdCreativeType */).AdCreativeType.QUEST_HOME_HERO;
object2.event = a0;
object2.properties = env0_3;
object2.sourceQuestContent = env0_2;
Reflect.apply(trackAdContentEvent, moduleValue, [object2]);
} else {
value2 = environment.__proto__;
(importDefault(683) /* metro dependency 683: AnalyticsUtils */).track(a0, env0_3);
}
}
function _fun77897() { // fn#77897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:3649, offset: 0x01e1048a, size: 29 bytes, params: 1, frame: 11
const binding = env0_4;
const QUEST_HOVER = AnalyticEvents.QUEST_HOVER;
binding(QUEST_HOVER);
}
function _fun77898() { // fn#77898, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:3695, offset: 0x01e104a7, size: 29 bytes, params: 1, frame: 11
const binding = env0_4;
const QUEST_HOVER_OFF = AnalyticEvents.QUEST_HOVER_OFF;
binding(QUEST_HOVER_OFF);
}
function _fun77900() { // fn#77900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:3830, offset: 0x01e104f3, size: 114 bytes, params: 1, frame: 17
var object2;
var r7;
var id;
let value = environment.__proto__;
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
const track = defaultImport.track;
const QUEST_CONTENT_CLICKED = AnalyticEvents.QUEST_CONTENT_CLICKED;
const object3 = {is_targeted: false};
value = environment;
copyDataProperties(object3, env0_3, value);
if (questHomeHero != null) {
id = questHomeHero.id;
object2 = {ad_content_id: id};
r7 = id;
} else {
object2 = {};
r7 = value;
}
copyDataProperties(object3, object2, r7);
Reflect.apply(track, defaultImport, [QUEST_CONTENT_CLICKED, object3]);
}
function _fun77901() { // fn#77901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:3959, offset: 0x01e10565, size: 51 bytes, params: 1, frame: 3
return {handleMouseEnter: env0_5, handleMouseLeave: env0_6, handleOnboardingPopoutRender: env0_7,
handleEntrypointClick: env0_8};
}
function _fun77886(a0) { // fn#77886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:1155, offset: 0x01e0fcea, size: 481 bytes, params: 2, frame: 24
var advertisingId;
var moduleValue3;
var moduleValue4;
const binding = env1_0;
const object3 = {};
object3.questId = questId;
const QUEST_CONTENT_CLICKED = AnalyticEvents.QUEST_CONTENT_CLICKED;
object3.event = QUEST_CONTENT_CLICKED;
const object4 = {};
const value3 = undefined;
const analyticsTypesModule = require(7120) /* metro dependency 7120: AnalyticsTypes */;
const getContentProperties = analyticsTypesModule.getContentProperties;
copyDataProperties(object4, Reflect.apply(getContentProperties, analyticsTypesModule, [questContent,
questContentPosition, questContentRowIndex]), undefined);
copyDataProperties(object4, (importDefault(7071) /* metro dependency 7071: getDeviceMetadataNative */)(), undefined);
object4['cta_name'] = questContentCTA;
object4['click_id'] = (require(491) /* metro dependency 491 */).v4();
const value5 = null;
if (value5 != a0) {
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
advertisingId = moduleValue3.isIOS() ? a0.advertisingId : value5;
} else {
advertisingId = value5;
}
object4['apple_advertising_id'] = advertisingId;
if (value5 != a0) {
moduleValue4 = require(477) /* metro dependency 477: PlatformUtils */;
advertisingId = moduleValue4.isAndroid() ? a0.advertisingId : value5;
} else {
advertisingId = value5;
}
object4['android_advertising_id'] = advertisingId;
object4['metadata_sealed'] = value5 != env0_7 ? env0_7 : value5;
object4['traffic_metadata_sealed'] = value5 != env0_8 ? env0_8 : value5;
const currentQuestHomeSearchSession = (require(7127) /* metro dependency 7127: QuestHomeSearchSession */).getCurrentQuestHomeSearchSession();
const uuid = value5 == currentQuestHomeSearchSession ? value3 : currentQuestHomeSearchSession.uuid;
object4['search_session_id'] = value5 != uuid ? uuid : value5;
object3.properties = object4;
object3.trackGuildAndChannelMetadata = trackGuildAndChannelMetadata;
const questDataUtilsModule = require(7091) /* metro dependency 7091: QuestDataUtils */;
object3.shouldExtendSession = questDataUtilsModule.isBillableQuestContent(questContent);
object3.sourceQuestContent = sourceQuestContent;
binding(object3);
return value3;
}
function _fun77889(a0) { // fn#77889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10135:2215, offset: 0x01e0ffab, size: 447 bytes, params: 2, frame: 24
var advertisingId;
var moduleValue3;
var moduleValue4;
const binding = env1_0;
const object3 = {};
object3.adContentId = adContentId;
object3.relatedQuestId = relatedQuestId;
object3.adCreativeType = adCreativeType;
const QUEST_CONTENT_CLICKED = AnalyticEvents.QUEST_CONTENT_CLICKED;
object3.event = QUEST_CONTENT_CLICKED;
const object4 = {};
const value3 = undefined;
const analyticsTypesModule = require(7120) /* metro dependency 7120: AnalyticsTypes */;
const getContentProperties = analyticsTypesModule.getContentProperties;
copyDataProperties(object4, Reflect.apply(getContentProperties, analyticsTypesModule, [questContent,
questContentPosition, questContentRowIndex]), undefined);
copyDataProperties(object4, (importDefault(7071) /* metro dependency 7071: getDeviceMetadataNative */)(), undefined);
object4['cta_name'] = questContentCTA;
object4['click_id'] = (require(491) /* metro dependency 491 */).v4();
const value5 = null;
if (value5 != a0) {
moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */;
advertisingId = moduleValue3.isIOS() ? a0.advertisingId : value5;
} else {
advertisingId = value5;
}
object4['apple_advertising_id'] = advertisingId;
if (value5 != a0) {
moduleValue4 = require(477) /* metro dependency 477: PlatformUtils */;
advertisingId = moduleValue4.isAndroid() ? a0.advertisingId : value5;
} else {
advertisingId = value5;
}
object4['android_advertising_id'] = advertisingId;
const currentQuestHomeSearchSession = (require(7127) /* metro dependency 7127: QuestHomeSearchSession */).getCurrentQuestHomeSearchSession();
const uuid = value5 == currentQuestHomeSearchSession ? value3 : currentQuestHomeSearchSession.uuid;
object4['search_session_id'] = value5 != uuid ? uuid : value5;
object3.properties = object4;
object3.trackGuildAndChannelMetadata = trackGuildAndChannelMetadata;
const questDataUtilsModule = require(7091) /* metro dependency 7091: QuestDataUtils */;
object3.shouldExtendSession = questDataUtilsModule.isBillableQuestContent(questContent);
object3.sourceQuestContent = sourceQuestContent;
binding(object3);
return value3;
}