decord/source/modules/user_profile/UserProfileAnalyticsUtils.tsx

835 lines
28 KiB
TypeScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 8935
// Function ID: 8936
2026-07-20 16:05:17 +00:00
// Name: getProfileProperties
2026-08-15 05:55:55 +00:00
// Dependencies: [8936, 5289, 5407, 4652, 1990, 4559, 4030, 1922, 5365, 8931, 676, 505, 1435, 8416, 698, 5042, 8940, 2]
2026-07-29 08:29:29 +00:00
// Exports: getActivityType, getTrackUserRelationshipProperties, maybeTrackUserProfileUiViewed, trackDmProfileToggled, trackUserProfileActivityAction, trackUserProfileActivityJoined, trackUserProfileBadgeAction, trackUserProfileEditAction, trackUserProfileEditSaved, trackUserProfileWishlistAction
2026-07-20 16:05:17 +00:00
2026-08-15 05:55:55 +00:00
// Module 8935 (getProfileProperties)
import initialize from "initialize";
2026-07-29 08:29:29 +00:00
import recomputeFromAppTokens from "recomputeFromAppTokens";
import { FetchState } from "recomputeFromAppTokens";
import recomputeAffinities from "recomputeAffinities";
import reset from "reset";
import trackCommunicationDisabled from "trackCommunicationDisabled";
import sortActivity from "sortActivity";
2026-08-11 06:20:06 +00:00
import markAllUserIdListsStale from "markAllUserIdListsStale";
2026-07-29 08:29:29 +00:00
import mergeGuildAvatar from "mergeGuildAvatar";
import createUserWidgetFromServer from "createUserWidgetFromServer";
2026-07-23 10:11:24 +00:00
import { TrackUserProfileProperties as closure_13 } from "USER_PROFILE_TOOLTIP_DELAY";
import ME from "ME";
import { StatusTypes } from "sum";
let closure_14;
let closure_15;
const require = arg1;
2026-07-29 08:29:29 +00:00
function getProfileProperties(guildMemberProfile) {
2026-07-20 16:05:17 +00:00
let guildMember;
let user;
let userProfile;
2026-07-29 08:29:29 +00:00
({ user, userProfile, guildMember } = guildMemberProfile);
if (userProfile == null) {
userProfile = guildMemberProfile.guildMemberProfile;
2026-07-20 16:05:17 +00:00
}
let nick;
2026-07-29 08:29:29 +00:00
if (guildMember != null) {
2026-07-20 16:05:17 +00:00
nick = guildMember.nick;
}
2026-07-29 08:29:29 +00:00
const items = [];
2026-07-20 16:05:17 +00:00
if (Boolean(nick)) {
items.push(constants.NICKNAME);
}
let pronouns;
2026-07-29 08:29:29 +00:00
if (userProfile != null) {
pronouns = userProfile.pronouns;
2026-07-20 16:05:17 +00:00
}
if (Boolean(pronouns)) {
items.push(constants.PRONOUNS);
}
let avatar;
2026-07-29 08:29:29 +00:00
if (user != null) {
2026-07-20 16:05:17 +00:00
avatar = user.avatar;
}
if (!Boolean(avatar)) {
let banner;
2026-07-29 08:29:29 +00:00
if (userProfile != null) {
banner = userProfile.banner;
2026-07-20 16:05:17 +00:00
}
if (!Boolean(banner)) {
let bio;
2026-07-29 08:29:29 +00:00
if (userProfile != null) {
bio = userProfile.bio;
2026-07-20 16:05:17 +00:00
}
if (Boolean(bio)) {
items.push(constants.BIO);
}
let themeColors;
2026-07-29 08:29:29 +00:00
if (userProfile != null) {
themeColors = userProfile.themeColors;
2026-07-20 16:05:17 +00:00
}
let tmp23 = null != themeColors;
if (tmp23) {
2026-07-29 08:29:29 +00:00
const themeColors1 = userProfile.themeColors;
2026-07-20 16:05:17 +00:00
tmp23 = undefined !== themeColors1.find((arg0) => null !== arg0);
}
if (tmp23) {
items.push(constants.THEME);
}
let avatarDecoration;
2026-07-29 08:29:29 +00:00
if (user != null) {
2026-07-20 16:05:17 +00:00
avatarDecoration = user.avatarDecoration;
}
if (null != avatarDecoration) {
items.push(constants.AVATAR_DECORATION);
}
let profileEffect;
2026-07-29 08:29:29 +00:00
if (userProfile != null) {
profileEffect = userProfile.profileEffect;
2026-07-20 16:05:17 +00:00
}
if (null != profileEffect) {
items.push(constants.PROFILE_EFFECT);
}
return items;
} else {
let banner1;
2026-07-29 08:29:29 +00:00
if (userProfile != null) {
banner1 = userProfile.banner;
2026-07-20 16:05:17 +00:00
}
2026-08-11 06:20:06 +00:00
items.push(require(1435) /* getAvatarURL */.isAnimatedIconHash(banner1) ? constants.ANIMATED_BANNER : constants.BANNER);
const obj2 = require(1435) /* getAvatarURL */;
2026-07-20 16:05:17 +00:00
}
} else {
let avatar1;
2026-07-29 08:29:29 +00:00
if (user != null) {
2026-07-20 16:05:17 +00:00
avatar1 = user.avatar;
}
2026-08-11 06:20:06 +00:00
items.push(require(1435) /* getAvatarURL */.isAnimatedIconHash(avatar1) ? constants.ANIMATED_AVATAR : constants.AVATAR);
const obj = require(1435) /* getAvatarURL */;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
function getTrackUserProfileProperties(userId) {
2026-07-20 16:05:17 +00:00
let guildId;
let layout;
let sessionId;
let showGuildProfile;
let sourceSessionId;
2026-07-29 08:29:29 +00:00
({ guildId, showGuildProfile } = userId);
({ layout, userId, sessionId, sourceSessionId } = userId);
2026-07-20 16:05:17 +00:00
if (showGuildProfile === undefined) {
showGuildProfile = true;
}
2026-07-23 10:11:24 +00:00
user = user.getUser(userId);
2026-07-20 16:05:17 +00:00
if (null == user) {
return {};
} else {
let id;
2026-07-29 08:29:29 +00:00
if (user != null) {
2026-07-20 16:05:17 +00:00
id = user.id;
}
let tmp3;
if (showGuildProfile) {
tmp3 = guildId;
}
2026-08-15 05:55:55 +00:00
const displayProfile = require(8416) /* useDisplayProfile */.getDisplayProfile(id, tmp3);
2026-07-20 16:05:17 +00:00
let member = null;
if (showGuildProfile) {
member = null;
if (null != guildId) {
let id1;
2026-07-29 08:29:29 +00:00
if (user != null) {
2026-07-20 16:05:17 +00:00
id1 = user.id;
}
member = member.getMember(guildId, id1);
}
}
2026-07-29 08:29:29 +00:00
let obj = { profile_layout: null, profile_session_id: null, source_profile_session_id: null, profile_properties: null, guild_profile_properties: null, profile_activity_types: null, profile_badges: null, avatar_decoration_sku_id: null, profile_effect_sku_id: null, profile_frame_sku_id: null, user_status: null, is_guild_profile: null, is_bot_profile: null, is_private_to_viewer: null };
obj[0] = layout;
obj[1] = sessionId;
obj[2] = sourceSessionId;
obj = { user: null, userProfile: null };
obj[0] = user;
2026-07-20 16:05:17 +00:00
let _userProfile;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
_userProfile = displayProfile._userProfile;
}
2026-07-29 08:29:29 +00:00
obj[1] = _userProfile;
obj[3] = getProfileProperties(obj);
const obj1 = { guildMember: null, guildMemberProfile: null };
obj1[0] = member;
2026-07-20 16:05:17 +00:00
let _guildMemberProfile;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
_guildMemberProfile = displayProfile._guildMemberProfile;
}
2026-07-29 08:29:29 +00:00
obj1[1] = _guildMemberProfile;
obj[4] = getProfileProperties(obj1);
const activities = sortActivity.getActivities(user.id);
2026-07-20 16:05:17 +00:00
const mapped = activities.map((type) => type.type);
2026-07-29 08:29:29 +00:00
obj[5] = mapped.filter((arg0) => undefined !== arg0);
2026-07-20 16:05:17 +00:00
let found;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
const badges = displayProfile.getBadges();
2026-07-29 08:29:29 +00:00
if (badges != null) {
2026-07-20 16:05:17 +00:00
const mapped1 = badges.map((id) => id.id);
2026-08-04 21:03:28 +00:00
found = mapped1.filter((str) => typeof str === "string");
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (found == null) {
2026-07-20 16:05:17 +00:00
found = [];
}
2026-07-29 08:29:29 +00:00
obj[6] = found;
2026-07-20 16:05:17 +00:00
const avatarDecoration = user.avatarDecoration;
let skuId;
2026-07-29 08:29:29 +00:00
if (avatarDecoration != null) {
2026-07-20 16:05:17 +00:00
skuId = avatarDecoration.skuId;
}
2026-07-29 08:29:29 +00:00
obj[7] = skuId;
2026-07-20 16:05:17 +00:00
let skuId1;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
const profileEffect = displayProfile.profileEffect;
2026-07-29 08:29:29 +00:00
if (profileEffect != null) {
2026-07-20 16:05:17 +00:00
skuId1 = profileEffect.skuId;
}
}
2026-07-29 08:29:29 +00:00
obj[8] = skuId1;
2026-07-20 16:05:17 +00:00
let skuId2;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
const profileFrame = displayProfile.profileFrame;
2026-07-29 08:29:29 +00:00
if (profileFrame != null) {
2026-07-20 16:05:17 +00:00
skuId2 = profileFrame.skuId;
}
}
2026-07-29 08:29:29 +00:00
obj[9] = skuId2;
id = user.id;
const status = obj5.getStatus(id);
if (status === StatusTypes.ONLINE) {
if (obj5.isMobileOnline(id)) {
const _HermesInternal2 = HermesInternal;
let combined = "" + status + "-mobile";
}
obj[10] = combined;
guildId = undefined;
if (displayProfile != null) {
guildId = displayProfile.guildId;
}
obj[11] = null != guildId;
obj[12] = user.bot;
let flag;
if (displayProfile != null) {
flag = displayProfile.private;
}
if (flag == null) {
flag = false;
}
obj[13] = flag;
return obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
combined = status;
if (status === tmp14.ONLINE) {
const _HermesInternal = HermesInternal;
combined = "" + status + "-desktop";
2026-07-20 16:05:17 +00:00
}
2026-08-15 05:55:55 +00:00
const obj6 = require(8416) /* useDisplayProfile */;
2026-07-29 08:29:29 +00:00
tmp14 = StatusTypes;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
function trackUserProfileAction(applicationId) {
let action;
let analyticsLocations;
let channelId;
let guildId;
let messageId;
let roleId;
let section;
let widgetType;
applicationId = applicationId.applicationId;
({ guildId, channelId, messageId, roleId, widgetType, analyticsLocations, action, section } = applicationId);
let obj = importDefault(698);
obj = {};
2026-08-15 05:55:55 +00:00
const merged = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectGuildAnalyticsMetadata(guildId));
const obj3 = require(5042) /* collectGuildAnalyticsMetadata */;
const merged1 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectChannelAnalyticsMetadataFromId(channelId));
2026-07-29 08:29:29 +00:00
const merged2 = Object.assign(getTrackUserProfileProperties(applicationId));
const userId = applicationId.userId;
2026-07-20 16:05:17 +00:00
if (null == userId) {
2026-07-29 08:29:29 +00:00
obj = {};
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const userAffinity = authStore.getUserAffinity(userId);
obj = { related_user_id: null, relationship_type: null, related_since: null, num_mutual_friends: null, num_mutual_guilds: null, communication_probability: null, communication_rank: null };
obj[0] = userId;
obj[1] = store2.getRelationshipType(userId);
obj[2] = store2.getSince(userId);
obj[3] = store3.getMutualFriendsCount(userId);
2026-07-20 16:05:17 +00:00
const mutualGuilds = store3.getMutualGuilds(userId);
let length;
2026-07-29 08:29:29 +00:00
if (mutualGuilds != null) {
2026-07-20 16:05:17 +00:00
length = mutualGuilds.length;
}
2026-07-29 08:29:29 +00:00
obj[4] = length;
2026-07-20 16:05:17 +00:00
let prop;
2026-07-29 08:29:29 +00:00
if (userAffinity != null) {
2026-07-20 16:05:17 +00:00
prop = userAffinity.communicationProbability;
}
2026-07-29 08:29:29 +00:00
obj[5] = prop;
2026-07-20 16:05:17 +00:00
let communicationRank;
2026-07-29 08:29:29 +00:00
if (userAffinity != null) {
2026-07-20 16:05:17 +00:00
communicationRank = userAffinity.communicationRank;
}
2026-07-29 08:29:29 +00:00
obj[6] = communicationRank;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const merged3 = Object.assign(obj);
const obj1 = { application_id: applicationId, application_linked: null };
let tmp8 = null;
2026-07-20 16:05:17 +00:00
if (null != applicationId) {
2026-07-29 08:29:29 +00:00
tmp8 = null;
if (store.getFetchStateForApplication(applicationId) === FetchState.FETCHED) {
tmp8 = null != obj7.getNewestTokenForApplication(applicationId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj7 = store;
}
obj1[1] = tmp8;
const merged4 = Object.assign(obj1);
obj.location_stack = analyticsLocations;
obj.profile_action = action;
obj.profile_section = section;
obj.source_message_id = messageId;
obj.source_role_id = roleId;
obj.widget_type = widgetType;
2026-07-20 16:05:17 +00:00
obj.track(constants3.USER_PROFILE_ACTION, obj);
}
2026-07-23 10:11:24 +00:00
({ ActivityTypes: closure_14, AnalyticEvents: closure_15 } = ME);
2026-07-29 08:29:29 +00:00
let result = require("recomputeAffinities").fileFinishedImporting("modules/user_profile/UserProfileAnalyticsUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const getActivityType = function getActivityType(arg0) {
let tmp = arg0;
if (null != arg0) {
let str = "VOICE";
if ("VOICE" !== arg0) {
const _Object = Object;
const _Object2 = Object;
const keys = Object.keys(closure_14);
const values = Object.values(closure_14);
str = keys[values.indexOf(values, arg0)];
}
tmp = str;
}
return tmp;
};
export const getTrackUserRelationshipProperties = function getTrackUserRelationshipProperties(userId) {
userId = userId.userId;
if (null == userId) {
return {};
} else {
const userAffinity = authStore.getUserAffinity(userId);
const obj = { related_user_id: null, relationship_type: null, related_since: null, num_mutual_friends: null, num_mutual_guilds: null, communication_probability: null, communication_rank: null };
obj[0] = userId;
obj[1] = store2.getRelationshipType(userId);
obj[2] = store2.getSince(userId);
obj[3] = store3.getMutualFriendsCount(userId);
const mutualGuilds = store3.getMutualGuilds(userId);
let length;
if (mutualGuilds != null) {
length = mutualGuilds.length;
}
obj[4] = length;
let prop;
if (userAffinity != null) {
prop = userAffinity.communicationProbability;
}
obj[5] = prop;
let communicationRank;
if (userAffinity != null) {
communicationRank = userAffinity.communicationRank;
}
obj[6] = communicationRank;
return obj;
}
};
2026-07-20 16:05:17 +00:00
export { trackUserProfileAction };
2026-07-29 08:29:29 +00:00
export const maybeTrackUserProfileUiViewed = function maybeTrackUserProfileUiViewed(userId) {
2026-07-20 16:05:17 +00:00
let analyticsLocations;
let channelId;
let fetchStartedAt;
let guildId;
let profileUi;
let timeToFetchMs;
let timeToInteractiveMs;
let timeToLoadMs;
let viewStartedAt;
2026-08-15 05:55:55 +00:00
let trackResult = require(8940) /* isUserProfilePerformanceAnalyticsEnabled */;
2026-07-29 08:29:29 +00:00
if (trackResult.isUserProfilePerformanceAnalyticsEnabled("UserProfileAnalyticsUtils")) {
({ timeToInteractiveMs, timeToLoadMs, timeToFetchMs } = userId);
let num = timeToInteractiveMs;
({ guildId, channelId, analyticsLocations, profileUi, viewStartedAt, fetchStartedAt } = userId);
if (timeToInteractiveMs == null) {
num = 0;
}
let tmp5 = num <= 0;
if (!tmp5) {
let num3 = timeToLoadMs;
if (timeToLoadMs == null) {
num3 = 0;
}
tmp5 = num3 <= 0;
}
if (!tmp5) {
let num4 = timeToFetchMs;
if (timeToFetchMs == null) {
num4 = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp5 = num4 <= 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp5) {
trackResult = {};
2026-08-15 05:55:55 +00:00
let tmpResult = tmp(5042);
2026-07-29 08:29:29 +00:00
const merged = Object.assign(tmpResult.collectGuildAnalyticsMetadata(guildId));
2026-08-15 05:55:55 +00:00
tmpResult = tmp(5042);
2026-07-29 08:29:29 +00:00
const merged1 = Object.assign(tmpResult.collectChannelAnalyticsMetadataFromId(channelId));
const merged2 = Object.assign(getTrackUserProfileProperties(userId));
userId = userId.userId;
if (null == userId) {
let obj = {};
} else {
const userAffinity = authStore.getUserAffinity(userId);
obj = { related_user_id: null, relationship_type: null, related_since: null, num_mutual_friends: null, num_mutual_guilds: null, communication_probability: null, communication_rank: null };
obj[0] = userId;
obj[1] = store2.getRelationshipType(userId);
obj[2] = store2.getSince(userId);
obj[3] = store3.getMutualFriendsCount(userId);
const mutualGuilds = store3.getMutualGuilds(userId);
let length;
if (mutualGuilds != null) {
length = mutualGuilds.length;
}
obj[4] = length;
let prop;
if (userAffinity != null) {
prop = userAffinity.communicationProbability;
}
obj[5] = prop;
let communicationRank;
if (userAffinity != null) {
communicationRank = userAffinity.communicationRank;
}
obj[6] = communicationRank;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const merged3 = Object.assign(obj);
trackResult.location_stack = analyticsLocations;
trackResult.profile_ui = profileUi;
trackResult.view_started_at = viewStartedAt;
trackResult.fetch_started_at = fetchStartedAt;
trackResult.time_to_interactive_ms = timeToInteractiveMs;
trackResult.time_to_load_ms = timeToLoadMs;
trackResult.time_to_fetch_ms = timeToFetchMs;
trackResult = importDefault(698).track(constants3.USER_PROFILE_UI_VIEWED, trackResult);
const obj2 = importDefault(698);
2026-07-20 16:05:17 +00:00
}
}
};
2026-07-29 08:29:29 +00:00
export const trackUserProfileActivityJoined = function trackUserProfileActivityJoined(userId) {
2026-07-20 16:05:17 +00:00
let activityName;
let activityPlatform;
let activitySessionId;
let activityType;
let analyticsLocations;
let applicationId;
let channelId;
let guildId;
2026-07-29 08:29:29 +00:00
let voiceChannelId;
({ activityType, voiceChannelId } = userId);
({ guildId, channelId, analyticsLocations, activityName, activityPlatform, activitySessionId, applicationId } = userId);
let obj = importDefault(698);
2026-07-20 16:05:17 +00:00
obj = {};
2026-08-15 05:55:55 +00:00
const merged = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectGuildAnalyticsMetadata(guildId));
const obj3 = require(5042) /* collectGuildAnalyticsMetadata */;
const merged1 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectChannelAnalyticsMetadataFromId(channelId));
2026-07-29 08:29:29 +00:00
const merged2 = Object.assign(getTrackUserProfileProperties(userId));
userId = userId.userId;
if (null == userId) {
obj = {};
} else {
const userAffinity = authStore.getUserAffinity(userId);
obj = { related_user_id: null, relationship_type: null, related_since: null, num_mutual_friends: null, num_mutual_guilds: null, communication_probability: null, communication_rank: null };
obj[0] = userId;
obj[1] = store2.getRelationshipType(userId);
obj[2] = store2.getSince(userId);
obj[3] = store3.getMutualFriendsCount(userId);
const mutualGuilds = store3.getMutualGuilds(userId);
let length;
if (mutualGuilds != null) {
length = mutualGuilds.length;
}
obj[4] = length;
let prop;
if (userAffinity != null) {
prop = userAffinity.communicationProbability;
}
obj[5] = prop;
let communicationRank;
if (userAffinity != null) {
communicationRank = userAffinity.communicationRank;
}
obj[6] = communicationRank;
}
const merged3 = Object.assign(obj);
obj.location_stack = analyticsLocations;
2026-07-20 16:05:17 +00:00
let str = "VOICE";
if (null == voiceChannelId) {
2026-07-29 08:29:29 +00:00
let tmp8 = activityType;
if (null != activityType) {
let str2 = "VOICE";
if ("VOICE" !== activityType) {
const _Object = Object;
const _Object2 = Object;
const keys = Object.keys(closure_14);
const values = Object.values(closure_14);
str2 = keys[values.indexOf(values, activityType)];
}
tmp8 = str2;
}
str = tmp8;
}
obj.activity_type = str;
obj.activity_name = activityName;
obj.activity_platform = activityPlatform;
obj.activity_session_id = activitySessionId;
obj.application_id = applicationId;
obj.voice_channel_id = voiceChannelId;
2026-07-20 16:05:17 +00:00
obj.track(constants3.USER_PROFILE_ACTIVITY_JOINED, obj);
};
2026-07-29 08:29:29 +00:00
export const trackUserProfileActivityAction = function trackUserProfileActivityAction(userId) {
2026-07-20 16:05:17 +00:00
let action;
let activity;
let analyticsLocations;
let channelId;
let display;
let entry;
let guildId;
let outbox;
let stream;
2026-07-29 08:29:29 +00:00
let voiceChannelId;
({ activity, entry, outbox } = userId);
({ guildId, channelId, analyticsLocations, action, display, stream, voiceChannelId } = userId);
let obj = importDefault(698);
2026-07-20 16:05:17 +00:00
obj = {};
2026-08-15 05:55:55 +00:00
const merged = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectGuildAnalyticsMetadata(guildId));
const obj3 = require(5042) /* collectGuildAnalyticsMetadata */;
const merged1 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectChannelAnalyticsMetadataFromId(channelId));
2026-07-29 08:29:29 +00:00
const merged2 = Object.assign(getTrackUserProfileProperties(userId));
userId = userId.userId;
if (null == userId) {
obj = {};
} else {
const userAffinity = authStore.getUserAffinity(userId);
obj = { related_user_id: null, relationship_type: null, related_since: null, num_mutual_friends: null, num_mutual_guilds: null, communication_probability: null, communication_rank: null };
obj[0] = userId;
obj[1] = store2.getRelationshipType(userId);
obj[2] = store2.getSince(userId);
obj[3] = store3.getMutualFriendsCount(userId);
const mutualGuilds = store3.getMutualGuilds(userId);
let length;
if (mutualGuilds != null) {
length = mutualGuilds.length;
}
obj[4] = length;
let prop;
if (userAffinity != null) {
prop = userAffinity.communicationProbability;
}
obj[5] = prop;
let communicationRank;
if (userAffinity != null) {
communicationRank = userAffinity.communicationRank;
}
obj[6] = communicationRank;
}
const merged3 = Object.assign(obj);
obj.location_stack = analyticsLocations;
obj.activity_action = action;
obj.activity_display = display;
2026-07-20 16:05:17 +00:00
if (null != stream) {
let type = constants2.STREAMING;
2026-07-29 08:29:29 +00:00
} else if (activity != null) {
2026-07-20 16:05:17 +00:00
type = activity.type;
}
2026-07-29 08:29:29 +00:00
let tmp9 = type;
if (null != type) {
let str = "VOICE";
if ("VOICE" !== type) {
const _Object = Object;
const _Object2 = Object;
const keys = Object.keys(constants2);
const values = Object.values(constants2);
str = keys[values.indexOf(values, type)];
}
tmp9 = str;
}
obj.activity_type = tmp9;
2026-07-20 16:05:17 +00:00
let name;
2026-07-29 08:29:29 +00:00
if (activity != null) {
2026-07-20 16:05:17 +00:00
name = activity.name;
}
2026-07-29 08:29:29 +00:00
obj.activity_name = name;
2026-07-20 16:05:17 +00:00
let platform;
2026-07-29 08:29:29 +00:00
if (activity != null) {
2026-07-20 16:05:17 +00:00
platform = activity.platform;
}
2026-07-29 08:29:29 +00:00
obj.activity_platform = platform;
2026-07-20 16:05:17 +00:00
let session_id;
2026-07-29 08:29:29 +00:00
if (activity != null) {
2026-07-20 16:05:17 +00:00
session_id = activity.session_id;
}
2026-07-29 08:29:29 +00:00
obj.activity_session_id = session_id;
2026-07-20 16:05:17 +00:00
let application_id;
2026-07-29 08:29:29 +00:00
if (activity != null) {
2026-07-20 16:05:17 +00:00
application_id = activity.application_id;
}
2026-07-29 08:29:29 +00:00
obj.activity_application_id = application_id;
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (entry != null) {
2026-07-20 16:05:17 +00:00
id = entry.id;
}
2026-07-29 08:29:29 +00:00
obj.item_id = id;
2026-07-20 16:05:17 +00:00
let author_id;
2026-07-29 08:29:29 +00:00
if (entry != null) {
2026-07-20 16:05:17 +00:00
author_id = entry.author_id;
}
2026-07-29 08:29:29 +00:00
obj.author_id_v2 = author_id;
2026-07-20 16:05:17 +00:00
let mapped;
2026-07-29 08:29:29 +00:00
if (outbox != null) {
2026-07-20 16:05:17 +00:00
const entries = outbox.entries;
mapped = entries.map((id) => id.id);
}
2026-07-29 08:29:29 +00:00
obj.item_ids = mapped;
2026-07-20 16:05:17 +00:00
let mapped1;
2026-07-29 08:29:29 +00:00
if (outbox != null) {
2026-07-20 16:05:17 +00:00
const entries1 = outbox.entries;
mapped1 = entries1.map((author_id) => author_id.author_id);
}
2026-07-29 08:29:29 +00:00
obj.author_ids_v2 = mapped1;
obj.voice_channel_id = voiceChannelId;
2026-07-20 16:05:17 +00:00
obj.track(constants3.USER_PROFILE_ACTIVITY_ACTION, obj);
};
2026-07-29 08:29:29 +00:00
export const trackUserProfileBadgeAction = function trackUserProfileBadgeAction(userId) {
2026-07-20 16:05:17 +00:00
let analyticsLocations;
let badgeAction;
let badgeId;
let channelId;
let guildId;
let position;
2026-07-29 08:29:29 +00:00
({ badgeId, userId } = userId);
2026-07-20 16:05:17 +00:00
let tmp;
2026-07-29 08:29:29 +00:00
({ guildId, channelId, analyticsLocations, badgeAction, position } = userId);
2026-07-20 16:05:17 +00:00
if (null != badgeId) {
if (null != userId) {
2026-07-23 10:11:24 +00:00
badgeById = badgeById.getBadgeById(badgeId, userId);
2026-07-20 16:05:17 +00:00
let current_tier;
2026-07-29 08:29:29 +00:00
if (badgeById != null) {
2026-07-20 16:05:17 +00:00
current_tier = badgeById.current_tier;
}
tmp = current_tier;
}
}
2026-07-29 08:29:29 +00:00
let obj = importDefault(698);
2026-07-20 16:05:17 +00:00
obj = {};
2026-08-15 05:55:55 +00:00
const merged = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectGuildAnalyticsMetadata(guildId));
const obj3 = require(5042) /* collectGuildAnalyticsMetadata */;
const merged1 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectChannelAnalyticsMetadataFromId(channelId));
2026-07-29 08:29:29 +00:00
const merged2 = Object.assign(getTrackUserProfileProperties(userId));
const userId2 = userId.userId;
if (null == userId2) {
obj = {};
} else {
const userAffinity = authStore.getUserAffinity(userId2);
obj = { related_user_id: null, relationship_type: null, related_since: null, num_mutual_friends: null, num_mutual_guilds: null, communication_probability: null, communication_rank: null };
obj[0] = userId2;
obj[1] = store2.getRelationshipType(userId2);
obj[2] = store2.getSince(userId2);
obj[3] = store3.getMutualFriendsCount(userId2);
const mutualGuilds = store3.getMutualGuilds(userId2);
let length;
if (mutualGuilds != null) {
length = mutualGuilds.length;
}
obj[4] = length;
let prop;
if (userAffinity != null) {
prop = userAffinity.communicationProbability;
}
obj[5] = prop;
let communicationRank;
if (userAffinity != null) {
communicationRank = userAffinity.communicationRank;
}
obj[6] = communicationRank;
}
const merged3 = Object.assign(obj);
obj.location_stack = analyticsLocations;
obj.badge_action = badgeAction;
obj.badge_id = badgeId;
obj.badge_tier = tmp;
obj.position = position;
2026-07-20 16:05:17 +00:00
obj.track(constants3.USER_PROFILE_BADGE_ACTION, obj);
};
export const trackDmProfileToggled = function trackDmProfileToggled(displayProfile) {
displayProfile = displayProfile.displayProfile;
let userId;
2026-07-23 10:11:24 +00:00
userId = undefined;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
userId = displayProfile.userId;
}
let findActivityResult = null;
if (null != userId) {
2026-07-29 08:29:29 +00:00
findActivityResult = sortActivity.findActivity(userId, (type) => {
2026-07-20 16:05:17 +00:00
type = type.type;
2026-07-23 10:11:24 +00:00
if (null != outer1_7.getAnyStreamForUser(userId)) {
let tmp2 = type === outer1_14.PLAYING;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
tmp2 = type !== outer1_14.CUSTOM_STATUS;
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
}
2026-07-29 08:29:29 +00:00
let obj = importDefault(698);
2026-07-20 16:05:17 +00:00
obj = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(getTrackUserProfileProperties({ userId }));
obj.is_profile_open = displayProfile.isProfileOpen;
2026-07-20 16:05:17 +00:00
let large_image;
2026-07-29 08:29:29 +00:00
if (findActivityResult != null) {
2026-07-20 16:05:17 +00:00
const assets = findActivityResult.assets;
2026-07-29 08:29:29 +00:00
if (assets != null) {
2026-07-20 16:05:17 +00:00
large_image = assets.large_image;
}
}
2026-07-29 08:29:29 +00:00
if (large_image == null) {
2026-07-20 16:05:17 +00:00
let small_image;
2026-07-29 08:29:29 +00:00
if (findActivityResult != null) {
2026-07-20 16:05:17 +00:00
const assets2 = findActivityResult.assets;
2026-07-29 08:29:29 +00:00
if (assets2 != null) {
2026-07-20 16:05:17 +00:00
small_image = assets2.small_image;
}
}
large_image = small_image;
}
2026-07-29 08:29:29 +00:00
obj.has_images = Boolean(large_image);
obj.is_friend = store2.isFriend(userId);
obj.viewed_profile_user_id = userId;
2026-07-20 16:05:17 +00:00
let result;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
result = displayProfile.hasPremiumCustomization();
}
2026-07-29 08:29:29 +00:00
obj.profile_has_nitro_customization = result;
2026-07-20 16:05:17 +00:00
let hasThemeColorsResult;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
hasThemeColorsResult = displayProfile.hasThemeColors();
}
2026-07-29 08:29:29 +00:00
obj.profile_has_theme_color_customized = hasThemeColorsResult;
2026-07-20 16:05:17 +00:00
let prop;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
prop = displayProfile.popoutAnimationParticleType;
}
2026-07-29 08:29:29 +00:00
obj.profile_has_theme_animation = null != prop;
2026-07-20 16:05:17 +00:00
obj.track(constants3.DM_PROFILE_TOGGLED, obj);
};
2026-07-29 08:29:29 +00:00
export const trackUserProfileEditAction = function trackUserProfileEditAction(userId) {
2026-07-20 16:05:17 +00:00
let action;
let analyticsLocations;
let applicationId;
let channelId;
let gameId;
let guildId;
let numCharacters;
let numResults;
let widgetEdited;
2026-07-29 08:29:29 +00:00
({ action, applicationId } = userId);
2026-07-20 16:05:17 +00:00
let obj = {};
2026-07-29 08:29:29 +00:00
({ guildId, channelId, analyticsLocations, widgetEdited, gameId, numResults, numCharacters } = userId);
const merged = Object.assign(userId);
obj.action = action;
2026-07-20 16:05:17 +00:00
trackUserProfileAction(obj);
obj = {};
2026-07-29 08:29:29 +00:00
const obj2 = importDefault(698);
2026-08-15 05:55:55 +00:00
const merged1 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectGuildAnalyticsMetadata(guildId));
const obj4 = require(5042) /* collectGuildAnalyticsMetadata */;
const merged2 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectChannelAnalyticsMetadataFromId(channelId));
2026-07-29 08:29:29 +00:00
const merged3 = Object.assign(getTrackUserProfileProperties(userId));
obj = { application_id: applicationId, application_linked: null };
let tmp6 = null;
if (null != applicationId) {
tmp6 = null;
if (store.getFetchStateForApplication(applicationId) === FetchState.FETCHED) {
tmp6 = null != obj7.getNewestTokenForApplication(applicationId);
}
obj7 = store;
}
obj[1] = tmp6;
const merged4 = Object.assign(obj);
obj.location_stack = analyticsLocations;
obj.edit_action = action;
obj.widget_edited = widgetEdited;
obj.game_id = gameId;
obj.num_results = numResults;
obj.num_characters = numCharacters;
obj.application_id = applicationId;
2026-07-20 16:05:17 +00:00
obj2.track(constants3.USER_PROFILE_EDIT_ACTION, obj);
};
2026-07-29 08:29:29 +00:00
export const trackUserProfileEditSaved = function trackUserProfileEditSaved(userId) {
2026-07-20 16:05:17 +00:00
let analyticsLocations;
let channelId;
let gameIds;
let guildId;
let isWidgetRemoved;
let numCharactersCommentary;
let tags;
let widgetEdited;
let obj = {};
2026-07-29 08:29:29 +00:00
({ guildId, channelId, analyticsLocations, widgetEdited, gameIds, tags, numCharactersCommentary, isWidgetRemoved } = userId);
const merged = Object.assign(userId);
obj.action = "EDIT_SAVED";
2026-07-20 16:05:17 +00:00
trackUserProfileAction(obj);
obj = {};
2026-07-29 08:29:29 +00:00
const obj2 = importDefault(698);
2026-08-15 05:55:55 +00:00
const merged1 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectGuildAnalyticsMetadata(guildId));
const obj4 = require(5042) /* collectGuildAnalyticsMetadata */;
const merged2 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectChannelAnalyticsMetadataFromId(channelId));
2026-07-29 08:29:29 +00:00
const merged3 = Object.assign(getTrackUserProfileProperties(userId));
obj.location_stack = analyticsLocations;
obj.widget_edited = widgetEdited;
obj.game_ids = gameIds;
obj.tags = tags;
obj.num_characters_commentary = numCharactersCommentary;
obj.is_widget_removed = isWidgetRemoved;
2026-07-20 16:05:17 +00:00
obj2.track(constants3.USER_PROFILE_EDIT_SAVED, obj);
};
2026-07-29 08:29:29 +00:00
export const trackUserProfileWishlistAction = function trackUserProfileWishlistAction(userId) {
2026-07-20 16:05:17 +00:00
let action;
let analyticsLocations;
let channelId;
let guildId;
let productLines;
let skuId;
let wishlistId;
2026-07-29 08:29:29 +00:00
({ action, productLines } = userId);
2026-07-20 16:05:17 +00:00
let obj = {};
2026-07-29 08:29:29 +00:00
({ guildId, channelId, analyticsLocations, wishlistId, skuId } = userId);
const merged = Object.assign(userId);
obj.action = action;
2026-07-20 16:05:17 +00:00
trackUserProfileAction(obj);
obj = {};
2026-07-29 08:29:29 +00:00
const obj2 = importDefault(698);
2026-08-15 05:55:55 +00:00
const merged1 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectGuildAnalyticsMetadata(guildId));
const obj4 = require(5042) /* collectGuildAnalyticsMetadata */;
const merged2 = Object.assign(require(5042) /* collectGuildAnalyticsMetadata */.collectChannelAnalyticsMetadataFromId(channelId));
2026-07-29 08:29:29 +00:00
const merged3 = Object.assign(getTrackUserProfileProperties(userId));
obj.location_stack = analyticsLocations;
obj.action_type = action;
obj.wishlist_id = wishlistId;
obj.sku_id = skuId;
2026-07-20 16:05:17 +00:00
if (null != productLines) {
const _Array = Array;
let items = Array.from(productLines);
} else {
items = [];
}
2026-07-29 08:29:29 +00:00
obj.product_lines = items;
2026-07-20 16:05:17 +00:00
obj2.track(constants3.USER_PROFILE_WISHLIST_ACTION, obj);
};