decord/source/modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx
2026-07-23 10:11:24 +00:00

84 lines
3 KiB
TypeScript

// Module ID: 8589
// Function ID: 68200
// Name: getRejectionReasons
// Dependencies: [31, 4151, 653, 675, 1360, 8590, 8591, 8592, 44, 2]
// Exports: default, gameIdIsAcceptable
// Module 8589 (getRejectionReasons)
import result from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import { AnalyticEvents } from "ME";
const require = arg1;
function getRejectionReasons(gameFlags) {
if (null == gameFlags) {
const items = [closure_7.NoMatch];
return items;
} else {
const items1 = [];
if (obj.hasFlag(gameFlags.gameFlags, require(8590) /* GameFlags */.GameFlags.GAME_PROFILE_DISABLED)) {
items1.push(closure_7.Disabled);
}
const themes = gameFlags.themes;
if (themes.includes(require(8591) /* ThirdPartyGameApplicationThemes */.ThirdPartyGameApplicationThemes.EROTIC)) {
items1.push(closure_7.NSFW);
}
return items1;
}
}
function gameIsAcceptable(game) {
return 0 === getRejectionReasons(game).length;
}
let closure_7 = { NoMatch: "no match", NSFW: "nsfw", Disabled: "profile disabled" };
const result = require("ME").fileFinishedImporting("modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx");
export default function useShouldOpenGameProfileModal(applicationId) {
let gameId;
let trackEntryPointImpression;
let str = applicationId.applicationId;
if (str === undefined) {
str = "";
}
const source = applicationId.source;
({ trackEntryPointImpression, gameId } = applicationId);
if (trackEntryPointImpression === undefined) {
trackEntryPointImpression = true;
}
let closure_2;
let gameRecord;
let isLoading;
let shouldOpenGameProfile;
closure_2 = isLoading.useRef(false);
let obj = { applicationId: str, gameId };
gameId = trackEntryPointImpression(gameRecord[7])(obj);
gameRecord = gameId.gameRecord;
isLoading = gameId.isLoading;
shouldOpenGameProfile = gameIsAcceptable(gameRecord);
let items = [gameRecord, shouldOpenGameProfile, isLoading, source, trackEntryPointImpression];
const effect = isLoading.useEffect(() => {
if (!ref.current) {
if (trackEntryPointImpression) {
if (!isLoading) {
if (null != gameRecord) {
trackEntryPointImpression(gameRecord[8])(null != source, "Cannot track a Game Profile Entry Point Impressions without a source.");
let items = outer1_8(gameRecord);
if (items === undefined) {
items = [];
}
let obj = trackEntryPointImpression(gameRecord[3]);
obj = { game_profile_available: shouldOpenGameProfile, application_id: gameRecord.id, rejection_reason: items, source };
obj.track(outer1_6.GAME_PROFILE_ENTRY_POINT_AVAILABLE, obj);
ref.current = true;
const tmp12 = source;
const tmp16 = shouldOpenGameProfile;
}
}
}
}
}, items);
return { shouldOpenGameProfile, gameId: gameId.gameId };
};
export { gameIsAcceptable };
export const gameIdIsAcceptable = function gameIdIsAcceptable(arg0) {
return gameIsAcceptable(game.getGame(arg0));
};