35 lines
1.6 KiB
TypeScript
35 lines
1.6 KiB
TypeScript
// Metro module 8362 (f8363).
|
|
import { useMemo } from "react";
|
|
import { UserProfileAnalyticsTypes } from "../../Constants";
|
|
export default function useUserProfileAnalyticsProperties({ userId, user, channelId, guildId, displayProfile, guildMember, profileEffectSkuId, type }) {
|
|
let memo2;
|
|
memo2 = void 0;
|
|
const memo = useMemo(() => {
|
|
let type2 = type;
|
|
if (type == null) {
|
|
type2 = UserProfileAnalyticsTypes.USER_SHEET;
|
|
}
|
|
return {
|
|
type: type2,
|
|
other_user_id: userId,
|
|
channel_id: channelId,
|
|
guild_id: guildId,
|
|
profile_has_nitro_customization: displayProfile != null && (displayProfile == null ? void 0 : displayProfile.hasPremiumCustomization()),
|
|
profile_has_theme_color_customized: displayProfile != null && displayProfile.hasThemeColors(),
|
|
profile_has_theme_animation: displayProfile?.popoutAnimationParticleType != null,
|
|
has_avatar_decoration: Boolean(guildMember?.avatarDecoration) || Boolean(user?.avatarDecoration),
|
|
has_profile_effect: profileEffectSkuId != null
|
|
};
|
|
}, [userId, channelId, guildId, displayProfile, guildMember?.avatarDecoration, user?.avatarDecoration, profileEffectSkuId, type]);
|
|
memo2 = useMemo(() => ({
|
|
has_nickname: Boolean(guildMember?.nick),
|
|
has_guild_member_avatar: Boolean(guildMember?.avatar),
|
|
has_guild_member_banner: displayProfile == null ? void 0 : displayProfile.isUsingGuildMemberBanner(),
|
|
has_guild_member_bio: displayProfile == null ? void 0 : displayProfile.isUsingGuildMemberBio()
|
|
}), [displayProfile, guildMember]);
|
|
return useMemo(() => guildId == null ? memo : {
|
|
...memo,
|
|
...memo2
|
|
}, [guildId, memo, memo2]);
|
|
};
|