decord/source/modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx

133 lines
4.9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 9557
// Function ID: 9558
2026-07-29 08:29:29 +00:00
// Name: useShouldOpenGameProfileModal
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 4509, 676, 698, 1403, 9558, 4791, 9559, 38, 2]
2026-07-29 08:29:29 +00:00
// Exports: default, gameIdIsAcceptable, gameIsAcceptable
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 9557 (useShouldOpenGameProfileModal)
import hasFlagAll from "hasFlag" /* 1403 */;
import isAgeRestrictedContentClassification from "isAgeRestrictedContentClassification" /* 4791 */;
import GameFlags from "GameFlags" /* 9558 */;
import closure_4 from "noop" /* 19 */;
import closure_5 from "handleLoadMessages" /* 4509 */;
import { AnalyticEvents } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
let closure_7 = { NoMatch: "no match", NSFW: "nsfw", Disabled: "profile disabled" };
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx");
2026-07-20 16:05:17 +00:00
export default function useShouldOpenGameProfileModal(applicationId) {
let str = applicationId.applicationId;
if (str === undefined) {
str = "";
}
const source = applicationId.source;
({ trackEntryPointImpression, gameId } = applicationId);
if (trackEntryPointImpression === undefined) {
trackEntryPointImpression = true;
}
2026-08-24 06:08:38 +00:00
importAll = undefined;
2026-07-23 10:11:24 +00:00
let gameRecord;
let isLoading;
let shouldOpenGameProfile;
2026-07-29 08:29:29 +00:00
importAll = isLoading.useRef(false);
gameId = trackEntryPointImpression(gameRecord[7])({ applicationId: str, gameId });
2026-07-23 10:11:24 +00:00
gameRecord = gameId.gameRecord;
isLoading = gameId.isLoading;
2026-08-12 06:57:52 +00:00
shouldOpenGameProfile = null != gameRecord;
if (shouldOpenGameProfile) {
shouldOpenGameProfile = !importAll(tmp[4]).hasFlag(gameRecord.gameFlags, source(tmp[5]).GameFlags.GAME_PROFILE_DISABLED);
const obj2 = importAll(tmp[4]);
2026-07-29 08:29:29 +00:00
}
2026-08-12 06:57:52 +00:00
let items = [gameRecord, shouldOpenGameProfile, isLoading, source, trackEntryPointImpression];
2026-07-23 10:11:24 +00:00
const effect = isLoading.useEffect(() => {
2026-08-12 06:57:52 +00:00
let current = ref.current;
if (!current) {
current = !trackEntryPointImpression;
}
if (!current) {
current = isLoading;
}
if (!current) {
current = null == gameRecord;
}
if (!current) {
let track = trackEntryPointImpression;
let GAME_PROFILE_ENTRY_POINT_AVAILABLE = gameRecord;
trackEntryPointImpression(gameRecord[8])(null != source, "Cannot track a Game Profile Entry Point Impressions without a source.");
let flag = shouldOpenGameProfile;
if (null == gameRecord) {
2026-08-24 06:08:38 +00:00
const items = [closure_1_7.NoMatch];
2026-08-12 06:57:52 +00:00
let tmp11 = items;
} else {
const items1 = [];
if (obj3.hasFlag(tmp8.gameFlags, source(GAME_PROFILE_ENTRY_POINT_AVAILABLE[5]).GameFlags.GAME_PROFILE_DISABLED)) {
2026-08-24 06:08:38 +00:00
items1.push(closure_1_7.Disabled);
2026-08-12 06:57:52 +00:00
}
obj3 = ref(GAME_PROFILE_ENTRY_POINT_AVAILABLE[4]);
const tmp19 = source;
tmp11 = items1;
if (tmp19Result.isAgeRestrictedContentClassification(tmp8.contentClassification)) {
2026-08-24 06:08:38 +00:00
items1.push(closure_1_7.NSFW);
2026-08-12 06:57:52 +00:00
tmp11 = items1;
2026-07-20 16:05:17 +00:00
}
2026-08-12 06:57:52 +00:00
tmp19Result = source(GAME_PROFILE_ENTRY_POINT_AVAILABLE[6]);
2026-07-20 16:05:17 +00:00
}
2026-08-12 06:57:52 +00:00
track = track(GAME_PROFILE_ENTRY_POINT_AVAILABLE[3]).track;
2026-08-24 06:08:38 +00:00
GAME_PROFILE_ENTRY_POINT_AVAILABLE = closure_1_6.GAME_PROFILE_ENTRY_POINT_AVAILABLE;
2026-08-12 06:57:52 +00:00
const obj = { game_profile_available: null, application_id: null, rejection_reason: null, source: null };
obj[0] = flag;
obj[1] = gameRecord.id;
obj[2] = tmp11;
obj[3] = source;
track(GAME_PROFILE_ENTRY_POINT_AVAILABLE, obj);
flag = true;
ref.current = true;
const tmp5 = source;
const trackResult = track(GAME_PROFILE_ENTRY_POINT_AVAILABLE[3]);
2026-07-20 16:05:17 +00:00
}
2026-08-12 06:57:52 +00:00
}, items);
2026-07-20 16:05:17 +00:00
return { shouldOpenGameProfile, gameId: gameId.gameId };
};
2026-07-29 08:29:29 +00:00
export const gameIsAcceptable = function gameIsAcceptable(gameFlags) {
if (null == gameFlags) {
const items = [closure_7.NoMatch];
let arr = items;
} else {
const items1 = [];
2026-08-24 06:08:38 +00:00
if (obj2.hasFlag(gameFlags.gameFlags, GameFlags.GameFlags.GAME_PROFILE_DISABLED)) {
2026-07-29 08:29:29 +00:00
arr = items1.push(closure_7.Disabled);
}
2026-08-24 06:08:38 +00:00
obj2 = hasFlagAll;
2026-07-29 08:29:29 +00:00
const tmp8 = require;
arr = items1;
if (tmp8Result.isAgeRestrictedContentClassification(gameFlags.contentClassification)) {
arr = items1.push(closure_7.NSFW);
arr = items1;
}
2026-08-24 06:08:38 +00:00
tmp8Result = isAgeRestrictedContentClassification;
2026-07-29 08:29:29 +00:00
}
return 0 === arr.length;
};
2026-08-05 07:35:12 +00:00
export const gameIdIsAcceptable = function gameIdIsAcceptable(closure_0) {
game = game.getGame(closure_0);
2026-07-29 08:29:29 +00:00
if (null == game) {
const items = [closure_7.NoMatch];
let arr = items;
} else {
const items1 = [];
2026-08-24 06:08:38 +00:00
if (obj2.hasFlag(game.gameFlags, GameFlags.GameFlags.GAME_PROFILE_DISABLED)) {
2026-07-29 08:29:29 +00:00
arr = items1.push(closure_7.Disabled);
}
2026-08-24 06:08:38 +00:00
obj2 = hasFlagAll;
2026-07-29 08:29:29 +00:00
const tmp9 = require;
arr = items1;
if (tmp9Result.isAgeRestrictedContentClassification(game.contentClassification)) {
arr = items1.push(closure_7.NSFW);
arr = items1;
}
2026-08-24 06:08:38 +00:00
tmp9Result = isAgeRestrictedContentClassification;
2026-07-29 08:29:29 +00:00
}
return 0 === arr.length;
2026-07-20 16:05:17 +00:00
};