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

143 lines
5.3 KiB
TypeScript
Raw Normal View History

// Module ID: 8681
// Function ID: 8682
2026-07-29 08:29:29 +00:00
// Name: useShouldOpenGameProfileModal
// Dependencies: [19, 1916, 1074, 1242, 1384, 8682, 5112, 8683, 38, 2]
2026-08-26 06:04:24 +00:00
// Exports: default, gameIdIsAcceptable, gameIsAcceptable, trackEntryPoint
2026-07-20 16:05:17 +00:00
// Module 8681 (useShouldOpenGameProfileModal)
import expandEventPropertiesDefault from "expandEventProperties" /* 1242 */;
import hasFlagAll from "hasFlag" /* 1384 */;
import isAgeRestrictedContentClassification from "isAgeRestrictedContentClassification" /* 5112 */;
import GameFlags from "GameFlags" /* 8682 */;
2026-08-24 06:08:38 +00:00
import closure_4 from "noop" /* 19 */;
import closure_5 from "createGamesFromMessage" /* 1916 */;
import { AnalyticEvents } from "ME" /* 1074 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-08-26 06:04:24 +00:00
let obj = { NoMatch: "no match", NSFW: "nsfw", Disabled: "profile disabled", Obscured: "obscured" };
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-26 06:04:24 +00:00
obj = { game_profile_available: null, application_id: null, rejection_reason: null, source: null };
2026-08-12 06:57:52 +00:00
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-08-26 06:04:24 +00:00
export const RejectionReason = obj;
export const trackEntryPoint = function trackEntryPoint(game_profile_available, id, items, CallTile) {
if (items === undefined) {
items = [];
}
obj = expandEventPropertiesDefault;
obj = { game_profile_available, application_id: id, rejection_reason: items, source: CallTile };
obj.track(AnalyticEvents.GAME_PROFILE_ENTRY_POINT_AVAILABLE, obj);
};
2026-07-29 08:29:29 +00:00
export const gameIsAcceptable = function gameIsAcceptable(gameFlags) {
if (null == gameFlags) {
2026-08-26 06:04:24 +00:00
const items = [obj.NoMatch];
2026-07-29 08:29:29 +00:00
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-08-26 06:04:24 +00:00
arr = items1.push(obj.Disabled);
2026-07-29 08:29:29 +00:00
}
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)) {
2026-08-26 06:04:24 +00:00
arr = items1.push(obj.NSFW);
2026-07-29 08:29:29 +00:00
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) {
2026-08-26 06:04:24 +00:00
const items = [obj.NoMatch];
2026-07-29 08:29:29 +00:00
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-08-26 06:04:24 +00:00
arr = items1.push(obj.Disabled);
2026-07-29 08:29:29 +00:00
}
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)) {
2026-08-26 06:04:24 +00:00
arr = items1.push(obj.NSFW);
2026-07-29 08:29:29 +00:00
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
};