decord/alpha/source/modules/user_profile/DisplayProfile.tsx

358 lines
10 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 8314
// Function ID: 8315
// Name: DisplayProfile
2026-10-12 06:59:38 +00:00
// Dependencies: [1392, 7323, 4769, 1415, 8291, 2]
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 8314 (DisplayProfile)
2026-10-09 10:00:15 +00:00
import PremiumConstants from "PremiumConstants" /* 1392 */;
import AvatarUtils from "AvatarUtils" /* 1415 */;
2026-10-12 06:59:38 +00:00
import ProfileCustomizationUtils from "ProfileCustomizationUtils" /* 8291 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const PremiumTypes = PremiumConstants.PremiumTypes;
const result = size.fileFinishedImporting("modules/user_profile/DisplayProfile.tsx");
2026-07-29 08:29:29 +00:00
class DisplayProfile {
2026-10-03 08:58:59 +00:00
constructor(userId, guildId) {
const obj = Object.create(new.target.prototype);
obj.userId = userId.userId;
2026-07-29 08:29:29 +00:00
guildId = undefined;
2026-10-03 08:58:59 +00:00
if (guildId != null) {
guildId = guildId.guildId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.guildId = guildId;
2026-10-03 08:58:59 +00:00
let banner;
if (guildId != null) {
banner = guildId.banner;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (banner == null) {
2026-10-03 08:58:59 +00:00
banner = userId.banner;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.banner = banner;
2026-10-03 08:58:59 +00:00
let bio1;
const bio = userId.bio;
if (guildId != null) {
bio1 = guildId.bio;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
if (null == bio1) {
bio1 = bio;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
obj.bio = bio1;
let pronouns1;
const pronouns = userId.pronouns;
if (guildId != null) {
pronouns1 = guildId.pronouns;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
if (null == pronouns1) {
pronouns1 = pronouns;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
obj.pronouns = pronouns1;
obj.accentColor = userId.accentColor;
let themeColors;
if (guildId != null) {
themeColors = guildId.themeColors;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (themeColors == null) {
2026-10-03 08:58:59 +00:00
themeColors = userId.themeColors;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.themeColors = themeColors;
2026-10-03 08:58:59 +00:00
let profileEffect;
if (guildId != null) {
profileEffect = guildId.profileEffect;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (profileEffect == null) {
2026-10-03 08:58:59 +00:00
profileEffect = userId.profileEffect;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.profileEffect = profileEffect;
2026-10-03 08:58:59 +00:00
let profileFrame;
if (guildId != null) {
profileFrame = guildId.profileFrame;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (profileFrame == null) {
2026-10-03 08:58:59 +00:00
profileFrame = userId.profileFrame;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.profileFrame = profileFrame;
2026-10-03 08:58:59 +00:00
let prop;
if (guildId != null) {
prop = guildId.popoutAnimationParticleType;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (prop == null) {
2026-10-03 08:58:59 +00:00
prop = userId.popoutAnimationParticleType;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.popoutAnimationParticleType = prop;
2026-10-03 08:58:59 +00:00
({ fetchStartedAt: tmp.fetchStartedAt, fetchEndedAt: tmp.fetchEndedAt } = userId);
obj._userProfile = userId;
obj._guildMemberProfile = guildId;
2026-07-29 08:29:29 +00:00
return obj;
}
2026-10-03 08:58:59 +00:00
hasThemeColors() {
const themeColors = this.themeColors;
let first;
if (themeColors != null) {
first = themeColors[0];
}
let tmp2 = null != first;
if (!tmp2) {
const themeColors2 = this.themeColors;
let tmp3;
if (themeColors2 != null) {
tmp3 = themeColors2[1];
}
tmp2 = null != tmp3;
}
return tmp2;
}
hasPremiumCustomization() {
const self = this;
const hasThemeColorsResult = this.isUsingGuildMemberBanner() || self.isUsingGuildMemberBio() || null != self.banner || self.hasThemeColors() || null != self.popoutAnimationParticleType;
return hasThemeColorsResult;
}
isUsingGuildMemberBanner() {
const _guildMemberProfile = this._guildMemberProfile;
let banner;
if (_guildMemberProfile != null) {
banner = _guildMemberProfile.banner;
}
return null != banner;
}
isUsingGuildMemberBio() {
const _guildMemberProfile = this._guildMemberProfile;
let bio;
if (_guildMemberProfile != null) {
bio = _guildMemberProfile.bio;
}
let tmp2 = null != bio;
if (tmp2) {
const _guildMemberProfile2 = this._guildMemberProfile;
let bio1;
if (_guildMemberProfile2 != null) {
bio1 = _guildMemberProfile2.bio;
}
tmp2 = "" !== bio1;
}
return tmp2;
}
isUsingGuildMemberPronouns() {
const _guildMemberProfile = this._guildMemberProfile;
let pronouns;
if (_guildMemberProfile != null) {
pronouns = _guildMemberProfile.pronouns;
}
let tmp2 = null != pronouns;
if (tmp2) {
const _guildMemberProfile2 = this._guildMemberProfile;
let pronouns1;
if (_guildMemberProfile2 != null) {
pronouns1 = _guildMemberProfile2.pronouns;
}
tmp2 = "" !== pronouns1;
}
return tmp2;
}
getBannerURL(arg0) {
let canAnimate;
const self = this;
({ canAnimate, size } = arg0);
if (null != this.guildId) {
let guildMemberBannerURL;
if (self.isUsingGuildMemberBanner()) {
const obj2 = { id: null, guildId: null, banner: null, canAnimate, size };
({ userId: obj4.id, guildId: obj4.guildId, banner: obj4.banner } = self);
const obj3 = AvatarUtils;
guildMemberBannerURL = obj3.getGuildMemberBannerURL(obj2);
}
return guildMemberBannerURL;
}
const obj = AvatarUtils;
const obj6 = { id: self.userId, banner: self.banner, canAnimate, size };
guildMemberBannerURL = obj.getUserBannerURL(obj6);
}
2026-10-08 09:57:35 +00:00
getPreviewBanner(bannerChange, setting, arg2) {
2026-10-03 08:58:59 +00:00
let bannerURL;
let num = arg2;
if (arg2 === undefined) {
num = 480;
}
2026-10-08 09:57:35 +00:00
if (null != bannerChange) {
2026-10-03 08:58:59 +00:00
let imageUri;
2026-10-08 09:57:35 +00:00
if (setting) {
imageUri = bannerChange.imageUri;
2026-10-03 08:58:59 +00:00
} else {
2026-10-08 09:57:35 +00:00
imageUri = bannerChange.staticImageUri;
2026-10-03 08:58:59 +00:00
if (imageUri == null) {
2026-10-08 09:57:35 +00:00
imageUri = bannerChange.imageUri;
2026-10-03 08:58:59 +00:00
}
}
bannerURL = imageUri;
} else {
const self = this;
2026-10-08 09:57:35 +00:00
if (null === bannerChange) {
2026-10-03 08:58:59 +00:00
let userBannerURL = null;
if (self.isUsingGuildMemberBanner()) {
2026-10-08 09:57:35 +00:00
const obj3 = { id: self.userId, banner: self._userProfile.banner, canAnimate: setting, size: num };
2026-10-03 08:58:59 +00:00
const obj2 = AvatarUtils;
userBannerURL = obj2.getUserBannerURL(obj3);
}
bannerURL = userBannerURL;
} else {
2026-10-08 09:57:35 +00:00
const obj = { canAnimate: setting, size: num };
2026-10-03 08:58:59 +00:00
bannerURL = self.getBannerURL(obj);
}
}
return bannerURL;
}
getPreviewBio(pendingBio) {
let bio;
const _guildMemberProfile = this._guildMemberProfile;
const obj = { pendingValue: pendingBio, userValue: this._userProfile.bio, guildValue: bio, guildId: this.guildId };
bio = undefined;
const getProfilePreviewValue = ProfileCustomizationUtils.getProfilePreviewValue;
ProfileCustomizationUtils;
if (_guildMemberProfile != null) {
bio = _guildMemberProfile.bio;
}
return getProfilePreviewValue(obj);
}
getPreviewPronouns(pendingValue) {
let pronouns;
const _guildMemberProfile = this._guildMemberProfile;
const obj = { pendingValue, userValue: this._userProfile.pronouns, guildValue: pronouns, guildId: this.guildId };
pronouns = undefined;
const getProfilePreviewValue = ProfileCustomizationUtils.getProfilePreviewValue;
ProfileCustomizationUtils;
if (_guildMemberProfile != null) {
pronouns = _guildMemberProfile.pronouns;
}
return getProfilePreviewValue(obj);
}
getPreviewThemeColors(pendingThemeColors) {
let tmp3;
let first;
if (pendingThemeColors != null) {
first = pendingThemeColors[0];
}
if (null == first) {
let themeColors;
const self = this;
if (undefined !== pendingThemeColors) {
themeColors = self._userProfile.themeColors;
} else {
themeColors = self.themeColors;
}
tmp3 = themeColors;
} else {
tmp3 = pendingThemeColors;
}
return tmp3;
}
getBadges() {
let badges = this._userProfile.badges;
if (badges == null) {
badges = [];
}
const items = [...badges];
const _guildMemberProfile = this._guildMemberProfile;
let badges1;
if (_guildMemberProfile != null) {
badges1 = _guildMemberProfile.badges;
}
if (badges1 == null) {
badges1 = [];
}
HermesBuiltin.arraySpread(items, badges1, tmp2);
return items;
}
getLegacyUsername() {
return this._userProfile.legacyUsername;
}
2026-07-29 08:29:29 +00:00
}
const prototype = DisplayProfile.prototype;
Object.defineProperty(prototype, "premiumSince", {
get: function premiumSince() {
return this._userProfile.premiumSince;
},
set: undefined
});
Object.defineProperty(prototype, "premiumGuildSince", {
get: function premiumGuildSince() {
return this._userProfile.premiumGuildSince;
},
set: undefined
});
Object.defineProperty(prototype, "premiumType", {
get: function premiumType() {
return this._userProfile.premiumType;
},
set: undefined
});
Object.defineProperty(prototype, "private", {
2026-10-03 08:58:59 +00:00
get: function() {
2026-07-29 08:29:29 +00:00
return this._userProfile.private;
},
set: undefined
});
Object.defineProperty(prototype, "widgets", {
get: function widgets() {
return this._userProfile.widgets;
},
set: undefined
});
Object.defineProperty(prototype, "gameWidgets", {
get: function gameWidgets() {
const widgets = this._userProfile.widgets;
let found;
if (widgets != null) {
found = widgets.filter(require("UserProfileGameWidgetTypes").isGameWidget);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return found;
},
set: undefined
});
Object.defineProperty(prototype, "primaryColor", {
get: function primaryColor() {
2026-07-29 08:29:29 +00:00
const themeColors = this.themeColors;
let first;
if (themeColors != null) {
first = themeColors[0];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (first == null) {
first = this.accentColor;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return first;
},
set: undefined
});
Object.defineProperty(prototype, "canUsePremiumProfileCustomization", {
get: function canUsePremiumProfileCustomization() {
2026-10-03 08:58:59 +00:00
const obj = require("PremiumUtils");
return obj.isPremiumAtLeast(this.premiumType, PremiumTypes.TIER_2);
2026-07-29 08:29:29 +00:00
},
set: undefined
});
Object.defineProperty(prototype, "canEditThemes", {
get: function canEditThemes() {
return this.canUsePremiumProfileCustomization;
},
set: undefined
});
Object.defineProperty(prototype, "application", {
get: function application() {
2026-07-29 08:29:29 +00:00
return this._userProfile.application;
},
set: undefined
});
Object.defineProperty(prototype, "isLoaded", {
get: function isLoaded() {
const self = this;
let tmp = undefined !== this._userProfile;
if (tmp) {
tmp = null == self.guildId || undefined !== self._guildMemberProfile;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
},
set: undefined
});
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default DisplayProfile;