81 lines
2.4 KiB
TypeScript
81 lines
2.4 KiB
TypeScript
// Metro module 13933 (f13934).
|
|
import { isAvatarDecorationRecord } from "../collectibles/records/AvatarDecorationRecord";
|
|
import { isProfileEffectRecord } from "../collectibles/records/ProfileEffectRecord";
|
|
import { PremiumSubscriptionSKUs, SubscriptionPlanInfo } from "../premium/PremiumConstants";
|
|
import { CollectiblesItemType } from "../../_bundle/Module1901";
|
|
import { intl } from "../../intl/index.native";
|
|
import FamilyCenter_messages from "./FamilyCenter.messages";
|
|
import { getAvatarDecorationURL } from "../../utils/AvatarUtils";
|
|
const getCollectibleTypeName = function getCollectibleTypeName(type) {
|
|
if (CollectiblesItemType.AVATAR_DECORATION === type) {
|
|
return intl.string(FamilyCenter_messages.obi47v);
|
|
}
|
|
if (CollectiblesItemType.PROFILE_EFFECT === type) {
|
|
return intl.string(FamilyCenter_messages.RX8BMR);
|
|
}
|
|
if (CollectiblesItemType.NAMEPLATE === type) {
|
|
return intl.string(FamilyCenter_messages.nNGEHk);
|
|
}
|
|
if (CollectiblesItemType.BUNDLE === type) {
|
|
return intl.string(FamilyCenter_messages.VS1fKo);
|
|
}
|
|
if (CollectiblesItemType.PROFILE_FRAME === type) {
|
|
return intl.string(FamilyCenter_messages.JiIY1l);
|
|
}
|
|
return "";
|
|
};
|
|
export const PREVIEW_SIZE = 40;
|
|
export const NAMEPLATE_ASPECT_RATIO = 5.333333333333333;
|
|
export { getCollectibleTypeName };
|
|
export function getAvatarDecorationPreviewUrl(a0) {
|
|
if (a0.items.length === 0) {
|
|
return null;
|
|
}
|
|
const r7 = a0.items[0];
|
|
return isAvatarDecorationRecord(r7) ? getAvatarDecorationURL({
|
|
avatarDecoration: {
|
|
asset: r7.asset
|
|
},
|
|
size: 40,
|
|
canAnimate: true
|
|
}) : null;
|
|
}
|
|
export function getProfileEffectPreviewUrl(a0) {
|
|
if (a0.items.length === 0) {
|
|
return null;
|
|
}
|
|
const r8 = a0.items[0];
|
|
return isProfileEffectRecord(r8) ? r8.thumbnailPreviewSrc : null;
|
|
}
|
|
export function isGuildBoostSubscription(a0) {
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
return SubscriptionPlanInfo[a0]?.skuId === PremiumSubscriptionSKUs.GUILD;
|
|
}
|
|
export function getPurchaseDisplayInfo(a0, a1) {
|
|
let name, typeName;
|
|
const isSubscription = a1 != null;
|
|
if (a0 != null) {
|
|
name = a0.name;
|
|
typeName = getCollectibleTypeName(a0.type);
|
|
} else {
|
|
typeName = void 0;
|
|
name = void 0;
|
|
if (isSubscription) {
|
|
const r2 = a1 != null;
|
|
typeName = void 0;
|
|
name = void 0;
|
|
if (r2) {
|
|
name = SubscriptionPlanInfo[a1]?.name;
|
|
typeName = void 0;
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
displayName: name,
|
|
typeName,
|
|
isSubscription
|
|
};
|
|
}
|