decord/source/modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

134 lines
4.8 KiB
TypeScript

// Module ID: 8811
// Function ID: 8812
// Name: useShouldOpenGameProfileModal
// Dependencies: [19, 1917, 1074, 1241, 1385, 8812, 5197, 8813, 38, 2]
// Exports: default, gameIdIsAcceptable, gameIsAcceptable, trackEntryPoint
// Module 8811 (useShouldOpenGameProfileModal)
import _modDef38 from "module_38" /* 38 */;
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */;
import FlagUtilsAll from "FlagUtils" /* 1385 */;
import utils from "utils" /* 5197 */;
import GameFlags from "GameFlags" /* 8812 */;
import noop from "module_19" /* 19 */;
import GameStore from "GameStore" /* 1917 */;
const require = globalThis.__r;
require = fn;
const AnalyticEvents = fn(1074).AnalyticEvents;
const RejectionReason = { NoMatch: "no match", NSFW: "nsfw", Disabled: "profile disabled", Obscured: "obscured" };
const size = fn(2);
const result = size.fileFinishedImporting("modules/game_profile/hooks/useShouldOpenGameProfileModal.tsx");
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;
}
let gameRecord;
let isLoading;
importAll = isLoading.useRef(false);
const gameId2 = trackEntryPointImpression(gameRecord[7])({ applicationId: str, gameId });
gameRecord = gameId2.gameRecord;
isLoading = gameId2.isLoading;
let shouldOpenGameProfile = null != gameRecord;
if (shouldOpenGameProfile) {
shouldOpenGameProfile = !require("FlagUtils").hasFlag(gameRecord.gameFlags, source(tmp[5]).GameFlags.GAME_PROFILE_DISABLED);
const obj2 = require("FlagUtils");
}
let items = [gameRecord, shouldOpenGameProfile, isLoading, source, trackEntryPointImpression];
const effect = isLoading.useEffect(() => {
let current = ref.current;
if (!current) {
current = !trackEntryPointImpression;
}
if (!current) {
current = isLoading;
}
if (!current) {
current = null == gameRecord;
}
if (!current) {
let track = importDefault;
let GAME_PROFILE_ENTRY_POINT_AVAILABLE = dependencyMap;
_modDef38(null != source, "Cannot track a Game Profile Entry Point Impressions without a source.");
let flag = shouldOpenGameProfile;
if (null == gameRecord) {
const items = [obj.NoMatch];
let tmp11 = items;
} else {
const items1 = [];
if (obj3.hasFlag(tmp8.gameFlags, GameFlags.GameFlags.GAME_PROFILE_DISABLED)) {
items1.push(obj.Disabled);
}
obj3 = FlagUtilsAll;
tmp11 = items1;
if (tmp19Result.isAgeRestrictedContentClassification(tmp8.contentClassification)) {
items1.push(obj.NSFW);
tmp11 = items1;
}
tmp19Result = utils;
}
track = track(1241).track;
GAME_PROFILE_ENTRY_POINT_AVAILABLE = AnalyticEvents.GAME_PROFILE_ENTRY_POINT_AVAILABLE;
obj = { game_profile_available: flag, application_id: gameRecord.id, rejection_reason: tmp11, source };
track(GAME_PROFILE_ENTRY_POINT_AVAILABLE, obj);
flag = true;
ref.current = true;
const trackResult = track(1241);
}
}, items);
return { shouldOpenGameProfile, gameId: gameId2.gameId };
};
export { RejectionReason };
export const trackEntryPoint = function trackEntryPoint(game_profile_available, id, items, CallTile) {
if (items === undefined) {
items = [];
}
AnalyticsUtilsDefault.track(AnalyticEvents.GAME_PROFILE_ENTRY_POINT_AVAILABLE, { game_profile_available, application_id: id, rejection_reason: items, source: CallTile });
};
export const gameIsAcceptable = function gameIsAcceptable(gameFlags) {
if (null == gameFlags) {
const items = [obj.NoMatch];
let arr = items;
} else {
const items1 = [];
if (obj2.hasFlag(gameFlags.gameFlags, GameFlags.GameFlags.GAME_PROFILE_DISABLED)) {
items1.push(obj.Disabled);
}
obj2 = FlagUtilsAll;
arr = items1;
if (tmp8Result.isAgeRestrictedContentClassification(gameFlags.contentClassification)) {
items1.push(obj.NSFW);
arr = items1;
}
tmp8Result = utils;
}
return 0 === arr.length;
};
export const gameIdIsAcceptable = function gameIdIsAcceptable(gameId) {
const game = GameStore.getGame(gameId);
if (null == game) {
const items = [obj.NoMatch];
let arr = items;
} else {
const items1 = [];
if (obj2.hasFlag(game.gameFlags, GameFlags.GameFlags.GAME_PROFILE_DISABLED)) {
items1.push(obj.Disabled);
}
obj2 = FlagUtilsAll;
arr = items1;
if (tmp9Result.isAgeRestrictedContentClassification(game.contentClassification)) {
items1.push(obj.NSFW);
arr = items1;
}
tmp9Result = utils;
}
return 0 === arr.length;
};