43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
// Metro module 8491 (f8492).
|
|
import GameStore from "../../games/GameStore";
|
|
import { Distributors } from "../../../Constants";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import { SteamReleaseStatus } from "../../../_bundle/Module8492";
|
|
import { ThirdPartyGameApplicationWebsiteCategory } from "../../../_bundle/Module8490";
|
|
import { isNullOrEmpty } from "../../../utils/StringUtils";
|
|
export function buildSteamStoreUrl(a0) {
|
|
return `https://store.steampowered.com/app/${encodeURIComponent(a0)}`;
|
|
}
|
|
export function useSteamWebsiteUrl(a0) {
|
|
return useStateFromStores([GameStore], () => {
|
|
let r42;
|
|
if (a0 == null) {
|
|
return null;
|
|
}
|
|
const game = GameStore.getGame(a0);
|
|
if (game == null) {
|
|
return null;
|
|
}
|
|
if (game.steamReleaseStatus === SteamReleaseStatus.RETIRED_ABANDONED) {
|
|
return null;
|
|
}
|
|
const url = game.websites.find((website) => website.category === ThirdPartyGameApplicationWebsiteCategory.STEAM)?.url;
|
|
const r25 = game.thirdPartySkus.filter((thirdPartySku) => thirdPartySku.distributor === Distributors.STEAM && !isNullOrEmpty(thirdPartySku.id));
|
|
const id = r25[0]?.id;
|
|
let r34 = isNullOrEmpty(id) ? null : `https://store.steampowered.com/app/${encodeURIComponent(id)}`;
|
|
L16: {
|
|
if (r25.length > 1) {
|
|
r42 = url;
|
|
if (r42 != null) {
|
|
break L16;
|
|
}
|
|
}
|
|
if (r34 == null) {
|
|
r34 = url ?? null;
|
|
}
|
|
r42 = r34;
|
|
}
|
|
return r42;
|
|
}, [a0]);
|
|
}
|