75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
// Metro module 8758 (f8759).
|
|
import { useMemo } from "react";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { CollectiblesItemType } from "../../../_bundle/Module1901";
|
|
const getBundleDescription = function getBundleDescription(a0, r6 = false) {
|
|
if (r6) {
|
|
return intl.formatToPlainString(t["/0Yndu"], {
|
|
num: a0.bundledProducts?.length
|
|
});
|
|
}
|
|
let bundledProducts = a0.bundledProducts;
|
|
if (bundledProducts == null) {
|
|
bundledProducts = [];
|
|
}
|
|
const r30 = [];
|
|
let r31 = false;
|
|
for (const item of bundledProducts) {
|
|
const type = item.type;
|
|
if (CollectiblesItemType.AVATAR_DECORATION === type) {
|
|
r30.push(intl.formatToPlainString(t.Ntv9Jt, {
|
|
itemName: item.name
|
|
}));
|
|
} else if (CollectiblesItemType.PROFILE_EFFECT === type) {
|
|
r30.push(intl.formatToPlainString(t["3Y8q7a"], {
|
|
itemName: item.name
|
|
}));
|
|
} else if (CollectiblesItemType.NAMEPLATE === type) {
|
|
r30.push(intl.formatToPlainString(t["2keXky"], {
|
|
itemName: item.name
|
|
}));
|
|
r31 = true;
|
|
}
|
|
}
|
|
if (r31) {
|
|
return intl.formatToPlainString(t.Ofrqj6, {
|
|
joinedItems: r30.join(", ").replace(/, ([^,]*)$/, " & $1")
|
|
});
|
|
}
|
|
return intl.formatToPlainString(t.Ofrqj6, {
|
|
joinedItems: r30.join(" & ")
|
|
});
|
|
};
|
|
export function useProductDescription(a0) {
|
|
let r5 = arguments[1];
|
|
if (r5 === void 0) {
|
|
r5 = false;
|
|
}
|
|
let c16772_1 = r5;
|
|
return useMemo(() => {
|
|
if (a0 != null && a0.summary != null && a0.summary !== "") {
|
|
if (a0.type === CollectiblesItemType.BUNDLE && a0.summary.includes("{joinedItems}")) {
|
|
return a0.summary.replace("{joinedItems}", getBundleDescription(a0, c16772_1));
|
|
}
|
|
return a0.summary;
|
|
}
|
|
const type = a0?.type;
|
|
if (CollectiblesItemType.AVATAR_DECORATION === type) {
|
|
return intl.string(t["3lv7q2"]);
|
|
}
|
|
if (CollectiblesItemType.PROFILE_EFFECT === type) {
|
|
return intl.string(t.VhJL72);
|
|
}
|
|
if (CollectiblesItemType.NAMEPLATE === type) {
|
|
return intl.string(t.ik37EZ);
|
|
}
|
|
if (CollectiblesItemType.PROFILE_FRAME === type) {
|
|
return intl.string(t.fWzWPp);
|
|
}
|
|
if (CollectiblesItemType.BUNDLE === type) {
|
|
return getBundleDescription(a0, c16772_1);
|
|
}
|
|
return "";
|
|
}, [a0, r5]);
|
|
}
|