This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,67 @@
// Metro module 5520 (f5521).
import { useMemo } from "react";
import ApplicationStore from "../../applications/ApplicationStore";
import ApplicationRecord from "../../../records/ApplicationRecord";
import { ApplicationTypes } from "../../applications/ApplicationConstants";
import { GameLinkTypes } from "../../../flow/Server";
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
let $mk76428 = function() {
return (a0) => a0.type === GameLinkTypes.OFFICIAL;
};
export function getAuthorizationApp(a0) {
if (a0 == null) {
return null;
}
if (a0.type !== ApplicationTypes.GAME) {
return a0;
}
const linkedGames = a0.linkedGames;
const r7 = linkedGames == null ? void 0 : linkedGames.find($mk76428());
let r13 = r7?.application;
if (r13 == null) {
r13 = ApplicationStore.getApplication(r7?.id);
}
if (r13 == null) {
r13 = null;
}
return r13;
}
export function useAuthorizationApp(a0) {
const getOrFetchApplication = useGetOrFetchApplication(a0 == null ? void 0 : a0 instanceof ApplicationRecord ? void 0 : a0.getOfficialApplicationId());
return useMemo(() => {
let r12;
const r1 = a0 == null;
let r2 = null;
if (!r1) {
if (a0 instanceof ApplicationRecord) {
const r13 = a0 == null;
let r14 = null;
if (!r13) {
const type = a0.type;
const GAME = ApplicationTypes.GAME;
r14 = a0;
if (type === GAME) {
const linkedGames = a0.linkedGames;
const r9 = linkedGames == null ? void 0 : linkedGames.find($mk76428());
let r20 = r9?.application;
if (r20 == null) {
r20 = ApplicationStore.getApplication(r9?.id);
}
if (r20 == null) {
r20 = null;
}
r14 = r20;
}
}
r12 = r14;
} else {
r12 = getOrFetchApplication;
if (getOrFetchApplication == null) {
r12 = null;
}
}
r2 = r12;
}
return r2;
}, [a0, getOrFetchApplication]);
}
@@ -0,0 +1,54 @@
// Metro module 5522 (f5523).
import { useEffect, useMemo } from "react";
import AuthorizedAppsStore, { FetchState } from "../../oauth2/AuthorizedAppsStore";
import { useStateFromStoresArray, useStateFromStores } from "../../../_bundle/Module589";
import { isNotNullish } from "../../../utils/GlobalUtils";
import AuthorizedAppsActionCreators from "../../oauth2/AuthorizedAppsActionCreators";
const useAuthorizedAppsTokens = function useAuthorizedAppsTokens(a0, a1) {
let stateFromStoresArray;
const disableFetch2 = (a1 == null ? {} : a1).disableFetch;
const disableFetch = disableFetch2 !== void 0 && disableFetch2;
const stateFromStoresArray2 = useStateFromStoresArray([AuthorizedAppsStore], () => {
let r8 = a0 == null ? void 0 : a0.map((item) => AuthorizedAppsStore.getNewestTokenForApplication(item)).filter(isNotNullish);
if (r8 == null) {
r8 = [];
}
return r8;
}, [a0]);
const stateFromStores = useStateFromStores([AuthorizedAppsStore], () => {
let r6 = a0 == null ? void 0 : a0.every((item) => AuthorizedAppsStore.getFetchStateForApplication(item) === FetchState.FETCHED);
if (r6 == null) {
r6 = false;
}
return r6;
}, [a0]);
stateFromStoresArray = useStateFromStoresArray([AuthorizedAppsStore], () => {
let r6 = a0 == null ? void 0 : a0.filter((item) => AuthorizedAppsStore.getFetchStateForApplication(item) === FetchState.NOT_FETCHED);
if (r6 == null) {
r6 = [];
}
return r6;
}, [a0]);
useEffect(() => {
let r3 = disableFetch;
if (!disableFetch) {
r3 = stateFromStoresArray.length === 0;
}
if (!r3) {
AuthorizedAppsActionCreators.fetch(stateFromStoresArray);
}
}, [disableFetch, stateFromStoresArray]);
return {
tokens: stateFromStoresArray2,
fetched: stateFromStores
};
};
export { useAuthorizedAppsTokens };
export function useAuthorizedAppsToken(a0, a1) {
const authorizedAppsTokens = useAuthorizedAppsTokens(useMemo(() => a0 != null ? [a0] : null, [a0]), a1);
const tokens = authorizedAppsTokens.tokens;
return {
token: tokens.length > 0 ? tokens[0] : null,
fetched: authorizedAppsTokens.fetched
};
}
@@ -0,0 +1,82 @@
// Metro module 5534 (f5535).
import { useCallback } from "react";
import ConnectedAccountsStore from "../../../stores/ConnectedAccountsStore";
import { useStateFromStores } from "../../../_bundle/Module589";
import ConnectedAccountsActionCreators from "../../../actions/ConnectedAccountsActionCreators";
let env3402 = {};
export function useProviderConnection(a0) {
let env14907 = {
$parent: env3402
};
env14907[0] = a0;
const stateFromStores = useStateFromStores([ConnectedAccountsStore], () => {
const r5 = env14907[0];
return r5 != null ? ConnectedAccountsStore.getAccount(null, r5) : null;
});
const stateFromStores2 = useStateFromStores([ConnectedAccountsStore], () => ConnectedAccountsStore.isFetching());
const hasConnection = stateFromStores != null && !stateFromStores.revoked;
let c14908_0 = async (c29521_0) => {
let r59;
let location2;
let c29521_5 = 0;
let c31373_0;
L20: {
try {
c31373_0 = void 0;
const r18 = env14907[0];
if (r18 == null) {
break L20;
}
c29521_5 = 1;
location2 = c29521_0;
if (c29521_0 == null) {
location2 = "Account Linking";
}
c31373_0 = await ConnectedAccountsActionCreators.authorize(r18, {
location: location2
});
r59 = c31373_0.ok ? c31373_0.body?.url != null ? {
success: true,
url: c31373_0.body.url
} : {
success: false
} : {
success: false
};
c29521_5 = 0;
} catch ($e) {
let r7 = $e;
if (c29521_5 !== 0) {
while (true) {
try {
c29521_5 = 0;
} catch ($e) {
r7 = $e;
if (c29521_5 === 0) {
break;
}
continue;
}
return {
success: false
};
}
}
throw r7;
}
return r59;
}
return {
success: false
};
};
return {
loading: stateFromStores2,
hasConnection,
canConnect: a0 != null,
startConnection: useCallback(function() {
return c14908_0.apply(this, arguments);
}, [a0]),
account: stateFromStores
};
}