// Metro module 8476 (f8477). import { useRef, useEffect } from "react"; import GameStore from "../../games/GameStore"; import { AnalyticEvents } from "../../../Constants"; import AnalyticsUtils from "../../../utils/AnalyticsUtils"; import { hasFlag } from "../../../_bundle/Module1384"; import { GameFlags } from "../../../_bundle/Module8477"; import * as _utils from "../../content_classification/utils"; import useResolveGameForProfile from "./useResolveGameForProfile"; import Module38 from "../../../_bundle/Module38"; let c5427_7 = { NoMatch: "no match", NSFW: "nsfw", Disabled: "profile disabled" }; export default function useShouldOpenGameProfileModal({ applicationId = "", gameId, source, trackEntryPointImpression = true }) { let r44; let c16609_1 = trackEntryPointImpression; const ref = useRef(false); const resolveGameForProfile = useResolveGameForProfile({ applicationId, gameId }); const { gameId: gameId2, gameRecord, isLoading } = resolveGameForProfile; if (gameRecord == null) { r44 = [c5427_7.NoMatch]; } else { const r28 = []; if (hasFlag(gameRecord.gameFlags, GameFlags.GAME_PROFILE_DISABLED)) { r28.push(c5427_7.Disabled); } const isAgeRestrictedContentClassification = _utils.isAgeRestrictedContentClassification(gameRecord.contentClassification); r44 = r28; if (isAgeRestrictedContentClassification) { r28.push(c5427_7.NSFW); r44 = r28; } } const game_profile_available = r44.length === 0; useEffect(() => { let rejection_reason; if (!ref.current && c16609_1 && !isLoading && gameRecord != null) { Module38(source != null, "Cannot track a Game Profile Entry Point Impressions without a source."); if (gameRecord == null) { rejection_reason = [c5427_7.NoMatch]; } else { const r21 = []; if (hasFlag(gameRecord.gameFlags, GameFlags.GAME_PROFILE_DISABLED)) { r21.push(c5427_7.Disabled); } const isAgeRestrictedContentClassification = _utils.isAgeRestrictedContentClassification(gameRecord.contentClassification); rejection_reason = r21; if (isAgeRestrictedContentClassification) { r21.push(c5427_7.NSFW); rejection_reason = r21; } } AnalyticsUtils.track(AnalyticEvents.GAME_PROFILE_ENTRY_POINT_AVAILABLE, { game_profile_available, application_id: gameRecord.id, rejection_reason, source }); ref.current = true; } }, [gameRecord, game_profile_available, isLoading, source, trackEntryPointImpression]); return { shouldOpenGameProfile: game_profile_available, gameId: gameId2 }; }; export function gameIsAcceptable(a0) { let r27; if (a0 == null) { r27 = [c5427_7.NoMatch]; } else { const r4 = []; if (hasFlag(a0.gameFlags, GameFlags.GAME_PROFILE_DISABLED)) { r4.push(c5427_7.Disabled); } const isAgeRestrictedContentClassification = _utils.isAgeRestrictedContentClassification(a0.contentClassification); r27 = r4; if (isAgeRestrictedContentClassification) { r4.push(c5427_7.NSFW); r27 = r4; } } return r27.length === 0; } export function gameIdIsAcceptable(a0) { let r30; const game = GameStore.getGame(a0); if (game == null) { r30 = [c5427_7.NoMatch]; } else { const r12 = []; if (hasFlag(game.gameFlags, GameFlags.GAME_PROFILE_DISABLED)) { r12.push(c5427_7.Disabled); } const isAgeRestrictedContentClassification = _utils.isAgeRestrictedContentClassification(game.contentClassification); r30 = r12; if (isAgeRestrictedContentClassification) { r12.push(c5427_7.NSFW); r30 = r12; } } return r30.length === 0; }