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

+67
View File
@@ -0,0 +1,67 @@
// Metro module 8949 (f8950).
import ChannelStore from "../../stores/ChannelStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import { EMPTY_NUX_SERVER, FAVORITES, ME } from "../../Constants";
import { RemovedScopes } from "./scopes";
import { OAuth2Scopes } from "../../_bundle/Module8174";
import { parse } from "../../_bundle/keysSorter";
import * as _PermissionUtils from "../../utils/PermissionUtils";
import { deserialize } from "../../_bundle/HighLow";
export function filterScopes(a0) {
const r8 = a0.filter((item) => !RemovedScopes.includes(item));
if (r8.includes(OAuth2Scopes.BOT) && !r8.includes(OAuth2Scopes.APPLICATIONS_COMMANDS)) {
r8.push(OAuth2Scopes.APPLICATIONS_COMMANDS);
}
return r8;
}
export function parseOAuth2AuthorizeProps(a0) {
const r13 = parse(a0, {
arrayFormat: "bracket"
});
let NONE = _PermissionUtils.NONE;
try {
NONE = deserialize(r13.permissions != null ? r13.permissions !== "" ? r13.permissions : "0" : "0");
} catch ($e) {}
const channel_id = r13.channel_id;
let guild_id = r13.guild_id;
if (guild_id == null) {
guild_id = ChannelStore.getChannel(channel_id)?.guild_id;
}
if (guild_id == null) {
guild_id = SelectedGuildStore.getGuildId();
}
const guildId = (function sanitizeOAuthGuild(a0) {
let r1 = a0;
if ([ME, FAVORITES, EMPTY_NUX_SERVER].includes(a0)) {
return void 0;
}
if (a0 == null) {
r1 = void 0;
}
return r1;
})(guild_id);
let client_id = r13.client_id;
if (client_id == null) {
client_id = "";
}
let scope = r13.scope;
if (scope == null) {
scope = "";
}
return {
clientId: client_id,
scopes: scope.replace(/\+/g, " ").split(" ").filter((item) => item.length > 0),
responseType: r13.response_type,
redirectUri: r13.redirect_uri,
codeChallenge: r13.code_challenge,
codeChallengeMethod: r13.code_challenge_method,
state: r13.state,
permissions: NONE,
channelId: channel_id,
guildId,
prompt: r13.prompt,
disableGuildSelect: r13.disable_guild_select === "true",
integrationType: r13.integration_type == null ? void 0 : Number(r13.integration_type),
nonce: r13.nonce
};
}
@@ -0,0 +1,89 @@
// Metro module 5523 (f5524).
import AuthorizedAppsStore, { FetchState } from "./AuthorizedAppsStore";
import { Endpoints } from "../../Constants";
import { BatchInvocationManager, BatchInvocationManagerResetError } from "../../_bundle/Timeout";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
let c3395_7, fetchAuthorizedApps;
const tokensToAppTokensMap = function tokensToAppTokensMap(body, applicationIds) {
const r2 = Object;
let r19 = applicationIds == null ? void 0 : applicationIds.map((item) => [item, null]);
if (r19 == null) {
r19 = [];
}
const r22 = r2.fromEntries(r19);
for (const item of body) {
r22[item.application.id] = item;
}
return r22;
};
fetchAuthorizedApps = async function fetchAuthorizedApps(application_ids) {
const applicationIds = application_ids;
await HTTP.get({
url: Endpoints.OAUTH2_TOKENS,
oldFormErrors: true,
rejectWithError: true,
query: {
application_ids
}
}).then((result) => Dispatcher.dispatch({
type: "USER_AUTHORIZED_APPS_UPDATE",
isFullFetch: applicationIds == null,
tokens: tokensToAppTokensMap(result.body, applicationIds)
}), () => Dispatcher.dispatch({
type: "USER_AUTHORIZED_APPS_REQUEST_FAILED",
request: applicationIds == null ? {
type: "full"
} : {
type: "partial",
applicationIds
}
}));
};
c3395_7 = new BatchInvocationManager(fetchAuthorizedApps, {
predicate: (a0) => AuthorizedAppsStore.getFetchStateForApplication(a0) !== FetchState.FETCHING,
onQueued: (a0) => Dispatcher.dispatch({
type: "USER_AUTHORIZED_APPS_REQUEST",
request: {
type: "partial",
applicationIds: a0
}
}),
onCancelled: (a0) => Dispatcher.dispatch({
type: "USER_AUTHORIZED_APPS_REQUEST_CANCELLED",
applicationIds: a0
})
});
const r41 = {
fetch: (a0) => {
if (AuthorizedAppsStore.getFetchState() !== FetchState.FETCHING) {
if (a0 != null) {
c3395_7.queue(a0).catch((error) => {
if (error instanceof BatchInvocationManagerResetError) {
return void 0;
}
throw error;
});
} else {
c3395_7.reset();
Dispatcher.dispatch({
type: "USER_AUTHORIZED_APPS_REQUEST",
request: {
type: "full"
}
});
fetchAuthorizedApps();
}
}
},
delete: function(a0) {
HTTP.del({
url: Endpoints.OAUTH2_TOKEN(a0),
oldFormErrors: true,
rejectWithError: true
}).then(() => {
this.fetch();
});
}
};
export default r41;
+165
View File
@@ -0,0 +1,165 @@
// Metro module 5123 (f5124).
import ChannelStore from "../../stores/ChannelStore";
import ConnectedAppsStore from "../../stores/ConnectedAppsStore";
import MessageStore from "../../stores/MessageStore";
import { isObjectEntryNotNullish } from "../../utils/GlobalUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
function $mk75499() {
return (a0) => a0.application.parent_id == null;
}
let c3085_6, c3085_7, c3085_8, c3085_9, NOT_FETCHED, c3085_11, c3085_12, updateFetchStates;
const recomputeFromAppTokens = function recomputeFromAppTokens() {
const r5 = [...c3085_7.values()];
c3085_8 = r5;
c3085_9 = r5.filter($mk75499());
};
updateFetchStates = function updateFetchStates(a0, applicationIds) {
if (applicationIds == null) {
NOT_FETCHED = a0;
c3085_11.clear();
c3085_12 = c3085_12 + 1;
} else {
for (const item of applicationIds) {
c3085_11.set(item, a0);
}
c3085_12 = c3085_12 + 1;
}
};
c3085_6 = {
NOT_FETCHED: "NOT_FETCHED",
FETCHING: "FETCHING",
FETCHED: "FETCHED"
};
c3085_7 = new Map();
c3085_8 = [];
c3085_9 = [];
NOT_FETCHED = c3085_6.NOT_FETCHED;
c3085_11 = new Map();
c3085_12 = 0;
class AuthorizedAppsStore extends Module589.Store {
static displayName = "AuthorizedAppsStore";
initialize() {
this.waitFor(ChannelStore, ConnectedAppsStore, MessageStore);
}
getNewestTokenForApplication(a0) {
const r1 = a0 == null;
let r2 = null;
if (!r1) {
let r7 = c3085_7.get(a0);
if (r7 == null) {
r7 = null;
}
r2 = r7;
}
return r2;
}
getNewestTokens() {
return c3085_8;
}
getNewestTokensForNonChildrenApplications() {
return c3085_9;
}
getFetchState() {
return NOT_FETCHED;
}
getFetchStateForApplication(a0) {
let r10;
L6: {
if (NOT_FETCHED !== c3085_6.FETCHING && NOT_FETCHED !== c3085_6.FETCHED) {
r10 = c3085_11.get(a0);
if (r10 != null) {
break L6;
}
r10 = NOT_FETCHED;
} else {
r10 = NOT_FETCHED;
}
}
return r10;
}
getApplicationFetchStateVersion() {
return c3085_12;
}
}
const authorizedAppsStore = new AuthorizedAppsStore(Dispatcher, {
USER_AUTHORIZED_APPS_REQUEST: function handleUserAuthorizedAppsRequest(a0) {
if (a0.request.type === "full") {
updateFetchStates(c3085_6.FETCHING);
} else {
updateFetchStates(c3085_6.FETCHING, a0.request.applicationIds);
}
},
USER_AUTHORIZED_APPS_REQUEST_CANCELLED: function handleUserAuthorizedAppsRequestCancelled(a0) {
let r1 = false;
for (const applicationId of a0.applicationIds) {
if (c3085_11.get(applicationId) === c3085_6.FETCHING) {
c3085_11.delete(applicationId);
r1 = true;
}
}
if (r1) {
c3085_12 = c3085_12 + 1;
}
},
USER_AUTHORIZED_APPS_REQUEST_FAILED: function handleUserAuthorizedAppsRequestFailed(a0) {
if (a0.request.type === "full") {
updateFetchStates(c3085_6.FETCHED);
} else {
updateFetchStates(c3085_6.FETCHED, a0.request.applicationIds);
}
},
USER_AUTHORIZED_APPS_UPDATE: function handleAuthorizedAppsUpdate(a0) {
const isFullFetch = a0.isFullFetch;
const FETCHED = c3085_6.FETCHED;
if (isFullFetch) {
updateFetchStates(FETCHED);
c3085_7 = new Map(Object.entries(a0.tokens).filter(isObjectEntryNotNullish));
recomputeFromAppTokens();
} else {
updateFetchStates(FETCHED, Object.keys(a0.tokens));
for (const item of Object.entries(a0.tokens)) {
const [r44, r45] = item;
if (r45 == null) {
c3085_7.delete(r44);
} else {
c3085_7.set(r44, r45);
}
}
recomputeFromAppTokens();
}
},
OAUTH2_TOKEN_CREATE: function handleOAuth2TokenCreate(a0) {
const { id, application } = a0;
c3085_7.set(application.id, {
id,
application,
scopes: a0.scopes
});
const r17 = [...c3085_7.values()];
c3085_8 = r17;
c3085_9 = r17.filter($mk75499());
},
OAUTH2_TOKEN_DELETE: function handleOAuth2TokenDelete(a0) {
const id = a0.id;
const r11 = c3085_7.get(a0.applicationId);
if (r11 != null && r11.id === id) {
c3085_7.delete(r11.application.id);
const r20 = [...c3085_7.values()];
c3085_8 = r20;
c3085_9 = r20.filter($mk75499());
return void 0;
}
return false;
},
LOGOUT: function handleLogout() {
c3085_7 = new Map();
c3085_8 = [];
c3085_9 = [];
NOT_FETCHED = c3085_6.NOT_FETCHED;
c3085_11.clear();
c3085_12 = c3085_12 + 1;
}
});
export default authorizedAppsStore;
export { c3085_6 as FetchState };
+10
View File
@@ -0,0 +1,10 @@
// Metro module 8948 (f8949).
const r8 = {
CONNECT_ACCOUNT: "CONNECT_ACCOUNT",
SELECT_INSTALL_TYPE: "SELECT_INSTALL_TYPE",
AUTHORIZE_SCOPES: "AUTHORIZE_SCOPES",
AUTHORIZE_BOT_PERMISSIONS: "AUTHORIZE_BOT_PERMISSIONS",
AUTHORIZE_MFA: "AUTHORIZE_MFA"
};
export { r8 as OAuth2Steps };
export const EMOJI_POINTING_DOWN_CODE_POINT = "1f447";
+37
View File
@@ -0,0 +1,37 @@
// Metro module 8954 (f8955).
import { MarketingURLs } from "../../Constants";
import { getIsSocialLayerParentApplication } from "../applications/useIsSocialLayerParentApplication";
import { intl, t } from "../../intl/index.native";
import { isAgeRestrictedContentClassification } from "../content_classification/utils";
export function getApplicationDetailsText(a0) {
const isSocialLayerParentApplication = getIsSocialLayerParentApplication(a0);
if (a0.privacy_policy_url != null && a0.terms_of_service_url != null) {
return intl.format(isSocialLayerParentApplication ? t.yVfotv : t.rxlyKL, {
application: a0.name,
privacyPolicyURL: a0.privacy_policy_url,
termsOfServiceURL: a0.terms_of_service_url,
discordPrivacyPolicyURL: MarketingURLs.PRIVACY
});
}
if (a0.privacy_policy_url != null) {
return intl.format(isSocialLayerParentApplication ? t.pYVSah : t.TBvmM2, {
application: a0.name,
privacyPolicyURL: a0.privacy_policy_url,
discordPrivacyPolicyURL: MarketingURLs.PRIVACY
});
}
if (a0.terms_of_service_url != null) {
return intl.format(isSocialLayerParentApplication ? t.nBLOp5 : t["q0T/Q1"], {
application: a0.name,
termsOfServiceURL: a0.terms_of_service_url,
discordPrivacyPolicyURL: MarketingURLs.PRIVACY
});
}
return intl.format(isSocialLayerParentApplication ? t["8LemYv"] : t["3Ywek3"], {
application: a0.name,
discordPrivacyPolicyURL: MarketingURLs.PRIVACY
});
}
export function isContentClassificationRestricted(a0, a1) {
return a0 != null && isAgeRestrictedContentClassification(a0) && a1 === false;
}
+175
View File
@@ -0,0 +1,175 @@
// Metro module 8956 (f8957).
import ChannelStore from "../../stores/ChannelStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import { ChannelTypes, Endpoints } from "../../Constants";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
import AuthenticationActionCreators from "../../actions/AuthenticationActionCreators";
import { getLoginPath } from "../../_bundle/getAuthenticationPath";
const getLocationContextServer = function getLocationContextServer() {
const basicChannel = ChannelStore.getBasicChannel(SelectedChannelStore.getChannelId());
let guild_id2 = basicChannel?.guild_id;
if (guild_id2 == null) {
guild_id2 = "10000";
}
let channel_id = basicChannel?.id;
if (channel_id == null) {
channel_id = "10000";
}
let channel_type = basicChannel?.type;
if (channel_type == null) {
channel_type = ChannelTypes.UNKNOWN;
}
return {
guild_id: guild_id2,
channel_id,
channel_type
};
};
export { getLocationContextServer };
export function acceptWhitelist(a0) {
return HTTP.post({
url: Endpoints.OAUTH2_WHITELIST_ACCEPT,
query: {
token: a0
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
}
export async function authorize(c26328_0) {
let c26328_2;
c26328_2 = void 0;
let c30009_0 = c26328_0.authorize;
let c30009_1 = c26328_0.clientId;
let c30009_2 = c26328_0.scopes;
let c30009_3 = c26328_0.responseType;
let c30009_4 = c26328_0.redirectUri;
let c30009_5 = c26328_0.codeChallenge;
let c30009_6 = c26328_0.codeChallengeMethod;
let c30009_7 = c26328_0.state;
let c30009_8 = c26328_0.permissions;
let c30009_9 = c26328_0.guildId;
let c30009_10 = c26328_0.channelId;
let c30009_11 = c26328_0.integrationType;
let c30009_12 = c26328_0.connectedAccountProvider;
let c30009_13 = c26328_0.nonce;
await void 0;
return (await HTTP.post({
url: Endpoints.OAUTH2_AUTHORIZE,
query: {
client_id: c30009_1,
response_type: c30009_3,
redirect_uri: c30009_4,
code_challenge: c30009_5,
code_challenge_method: c30009_6,
scope: c30009_2.join(" "),
state: c30009_7,
nonce: c30009_13
},
body: {
guild_id: c30009_9,
webhook_channel_id: c30009_9 != null ? c30009_10 != null ? c30009_10 : void 0 : void 0,
channel_id: c30009_9 == null ? c30009_10 != null ? c30009_10 : void 0 : void 0,
permissions: c30009_8,
authorize: c30009_0,
integration_type: c30009_11,
connected_account_provider: c30009_12,
location_context: (0, getLocationContextServer)()
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body;
}
export async function fetchAuthorization(c26329_0) {
let c26329_2;
c26329_2 = void 0;
let c30010_0 = c26329_0.clientId;
let c30010_1 = c26329_0.scopes;
let c30010_2 = c26329_0.responseType;
let c30010_3 = c26329_0.redirectUri;
let c30010_4 = c26329_0.codeChallenge;
let c30010_5 = c26329_0.codeChallengeMethod;
let c30010_6 = c26329_0.state;
let c30010_7 = c26329_0.integrationType;
let c30010_8 = c26329_0.connectedAccountProvider;
let c30010_9 = c26329_0.nonce;
let c30010_10 = c26329_0.signal;
await void 0;
return (await HTTP.get({
url: Endpoints.OAUTH2_AUTHORIZE,
query: {
client_id: c30010_0,
response_type: c30010_2,
redirect_uri: c30010_3,
code_challenge: c30010_4,
code_challenge_method: c30010_5,
scope: c30010_1.join(" "),
state: c30010_6,
integration_type: c30010_7,
connected_account_provider: c30010_8,
nonce: c30010_9
},
signal: c30010_10,
retries: 3,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body;
}
export async function startSamsungAuthorization(client_id, c26330_1, response_type, redirect_uri, state) {
await HTTP.get({
url: Endpoints.OAUTH2_AUTHORIZE_SAMSUNG,
query: {
client_id,
state,
response_type,
redirect_uri,
prompt: "consent",
scope: c26330_1.join(" ")
},
rejectWithError: rejectWithMigratedError()
});
}
export async function fetchChannels(guild_id) {
return (await HTTP.get({
url: Endpoints.OAUTH2_AUTHORIZE_WEBHOOK_CHANNELS,
query: {
guild_id
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body;
}
export function logoutWithRedirect(a0, a1) {
AuthenticationActionCreators.logout(a1, getLoginPath(a0.pathname + a0.search, false));
}
export async function verifyUserCode(user_code) {
return await HTTP.post({
url: Endpoints.OAUTH2_DEVICE_VERIFY,
body: {
user_code
},
rejectWithError: rejectWithMigratedError()
});
}
export async function finishUserCode(user_code2, result) {
return await HTTP.post({
url: Endpoints.OAUTH2_DEVICE_FINISH,
body: {
user_code: user_code2,
result
},
rejectWithError: rejectWithMigratedError()
});
}
export async function finishUserCodeTwoWayLinkError(user_code3, error_code, error_source) {
return await HTTP.post({
url: Endpoints.OAUTH2_DEVICE_FINISH,
body: {
user_code: user_code3,
result: "two_way_link_error",
error_code,
error_source
},
rejectWithError: rejectWithMigratedError()
});
}
+11
View File
@@ -0,0 +1,11 @@
// Metro module 8957 (f8958).
import { deserialize } from "../../_bundle/HighLow";
export function convertOAuth2Authorization(a0) {
return a0.guilds != null ? {
...a0,
guilds: a0.guilds.map((guild) => ({
...guild,
permissions: deserialize(guild.permissions)
}))
} : a0;
}
@@ -0,0 +1,86 @@
// Metro module 9019 (f9020).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { getTextForDisclosure, ApplicationDisclosure } from "../../applications/disclosures";
import { GlobeEarthIcon } from "../../../design/components/Icon/native/redesign/generated/GlobeEarthIcon";
import { EmbedIcon } from "../../../design/components/Icon/native/redesign/generated/EmbedIcon";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import { getSecurityMessage } from "../scopes";
import { LinkIcon } from "../../../design/components/Icon/native/redesign/generated/LinkIcon";
import { intl, t } from "../../../intl/index.native";
import { LockIcon } from "../../../design/components/Icon/native/redesign/generated/LockIcon";
import { getApplicationDetailsText } from "../Utils";
import { HammerIcon } from "../../../design/components/Icon/native/redesign/generated/HammerIcon";
import { ClockIcon } from "../../../design/components/Icon/native/redesign/generated/ClockIcon";
import { OAuth2Scopes } from "../../../_bundle/Module8174";
import { RobotIcon } from "../../../design/components/Icon/native/redesign/generated/RobotIcon";
import { ShieldIcon } from "../../../design/components/Icon/native/redesign/generated/ShieldIcon";
import { Text } from "../../../design/components/Text/native/Text";
let useStyles;
const ApplicationDetailsEntry = function ApplicationDetailsEntry(props) {
const { iconComponent, text } = props;
const styles = useStyles();
return <View style={styles.entry}>
{iconComponent != null ? iconComponent({
style: styles.entryIcon
}) : null}
<Text variant="text-sm/normal" color="text-default" style={styles.entryText}>{text}</Text>
</View>;
};
useStyles = createStyles({
applicationDetails: {
flexDirection: "column",
gap: 16
},
entry: {
flexDirection: "row",
alignItems: "center",
gap: 8
},
entryText: {
flex: 1
},
entryIcon: {
width: 16,
height: 16,
tintColor: Module712.colors.TEXT_MUTED
}
});
export default function ApplicationDetails(props) {
const { application, scopes: scopes2, redirectUri, approximateGuildCount, isEmbeddedFlow, disclosures: disclosures2, connectedAccount } = props;
const styles = useStyles();
const date = new Date(SnowflakeUtils.extractTimestamp(application.id));
const securityMessage = getSecurityMessage(scopes2);
let origin = null;
if (redirectUri != null && !isEmbeddedFlow) {
try {
origin = new URL(redirectUri).href.split("/").slice(0, 3).join("/");
} catch ($e) {
origin = redirectUri;
}
}
const r72 = [origin != null ? <ApplicationDetailsEntry iconComponent={LinkIcon} text={intl.format(t["5k5OKD"], {
origin
})} /> : null, <ApplicationDetailsEntry iconComponent={LockIcon} text={getApplicationDetailsText(application)} />, , , , , ,];
const r85 = connectedAccount != null ? <ApplicationDetailsEntry iconComponent={HammerIcon} text={intl.string(t["8qui3M"])} /> : null;
const date2 = date;
r72[2] = r85;
r72[3] = <ApplicationDetailsEntry iconComponent={ClockIcon} text={intl.formatToPlainString(t["+1bjc8"], {
date: date2
})} />;
r72[4] = scopes2.includes(OAuth2Scopes.BOT) ? approximateGuildCount != null ? <ApplicationDetailsEntry iconComponent={RobotIcon} text={intl.formatToPlainString(t.UHGHSP, {
guildCount: approximateGuildCount
})} /> : null : null;
r72[5] = <ApplicationDetailsEntry iconComponent={ShieldIcon} text={securityMessage} />;
r72[6] = disclosures2 != null ? disclosures2.map((item) => {
const textForDisclosure = getTextForDisclosure(item);
const props = ApplicationDisclosure.IP_LOCATION === item ? {
iconComponent: GlobeEarthIcon
} : ApplicationDisclosure.DISPLAYS_ADVERTISEMENTS === item ? {
iconComponent: EmbedIcon
} : null;
return props != null ? textForDisclosure != null ? <ApplicationDetailsEntry key={item.toFixed()} text={textForDisclosure} {...props} /> : null : null;
}) : null;
return <View style={styles.applicationDetails}>{r72}</View>;
};
@@ -0,0 +1,105 @@
// Metro module 9008 (f9009).
import { View } from "react-native";
import { MAX_FRIENDS } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useIsSocialLayerParentApplication from "../../applications/useIsSocialLayerParentApplication";
import { OAuth2Scopes } from "../../../_bundle/Module8174";
import { intl, t } from "../../../intl/index.native";
import { FriendsIcon } from "../../../design/components/Icon/native/redesign/generated/FriendsIcon";
import { ChatSmileIcon } from "../../../design/components/Icon/native/redesign/generated/ChatSmileIcon";
import { GameControllerIcon } from "../../../design/components/Icon/native/redesign/generated/GameControllerIcon";
import { SettingsIcon } from "../../../design/components/Icon/native/redesign/generated/SettingsIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { AuthorizeFormSeparator } from "./AuthorizeFormSeparator";
let useStyles;
const ApplicationEducationEntry = function ApplicationEducationEntry(props) {
const { iconComponent, text } = props;
const styles = useStyles();
return <View style={styles.entry}>
{iconComponent != null ? iconComponent({
style: styles.entryIcon
}) : null}
<Text variant="text-md/normal" style={styles.entryText}>{text}</Text>
</View>;
};
useStyles = createStyles({
applicationEducation: {
flexDirection: "column",
gap: 16
},
entry: {
flexDirection: "row",
alignItems: "center",
gap: 12
},
entryText: {
flex: 1
},
entryIcon: {
width: 20,
height: 20,
tintColor: Module712.colors.TEXT_MUTED
}
});
export default function ApplicationEducation(props) {
let r17;
const { application, accountScopes } = props;
const styles = useStyles();
const r16 = [];
const isSocialLayerParentApplication = useIsSocialLayerParentApplication(application);
if (accountScopes.includes(OAuth2Scopes.SDK_SOCIAL_LAYER)) {
const r107 = isSocialLayerParentApplication ? intl.formatToPlainString(t["3Mau0y"], {
applicationName: application.name
}) : intl.string(t.ex4sMU);
const r119 = {
iconComponent: FriendsIcon,
text: isSocialLayerParentApplication ? intl.formatToPlainString(t.z9peav, {
maxFriends: MAX_FRIENDS
}) : intl.formatToPlainString(t.WNKzo9, {
maxFriends: MAX_FRIENDS
})
};
r16.push(r119, {
iconComponent: ChatSmileIcon,
text: isSocialLayerParentApplication ? intl.string(t.daY6xj) : intl.string(t.j7peBh)
}, {
iconComponent: GameControllerIcon,
text: isSocialLayerParentApplication ? intl.string(t["/bdaNN"]) : intl.string(t["feD3+i"])
}, {
iconComponent: SettingsIcon,
text: isSocialLayerParentApplication ? intl.string(t.mSqazC) : intl.string(t.YFFVM1)
});
r17 = r107;
} else {
const r40 = accountScopes.includes(OAuth2Scopes.SDK_SOCIAL_LAYER_PRESENCE);
r17 = void 0;
if (r40) {
const r48 = isSocialLayerParentApplication ? intl.formatToPlainString(t["3Mau0y"], {
applicationName: application.name
}) : intl.string(t.ex4sMU);
r16.push({
iconComponent: FriendsIcon,
text: isSocialLayerParentApplication ? intl.formatToPlainString(t.z9peav, {
maxFriends: MAX_FRIENDS
}) : intl.formatToPlainString(t.WNKzo9, {
maxFriends: MAX_FRIENDS
})
}, {
iconComponent: GameControllerIcon,
text: isSocialLayerParentApplication ? intl.string(t["/bdaNN"]) : intl.string(t["feD3+i"])
}, {
iconComponent: SettingsIcon,
text: isSocialLayerParentApplication ? intl.string(t.mSqazC) : intl.string(t.YFFVM1)
});
r17 = r48;
}
}
return r16.length !== 0 ? <>
<View style={styles.applicationEducation}>
{r17 != null ? r17.length > 0 ? <Text variant="text-sm/normal" color="text-default">{r17}</Text> : null : null}
{r16.map((item, index) => <ApplicationEducationEntry key={index} iconComponent={item.iconComponent} text={item.text} />)}
</View>
<AuthorizeFormSeparator />
</> : null;
};
@@ -0,0 +1,13 @@
// Metro module 9013 (f9014).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
const useStyles = createStyles({
separator: {
height: 1,
backgroundColor: Module712.colors.BORDER_SUBTLE
}
});
export function AuthorizeFormSeparator() {
return <View style={useStyles().separator} />;
}
+90
View File
@@ -0,0 +1,90 @@
// Metro module 9014 (f9015).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { intl, t } from "../../../intl/index.native";
import { CircleXIcon } from "../../../design/components/Icon/native/redesign/generated/CircleXIcon";
import Module712 from "../../../_bundle/Module712";
import { CircleCheckIcon } from "../../../design/components/Icon/native/redesign/generated/CircleCheckIcon";
import { Text } from "../../../design/components/Text/native/Text";
import useInitialValue from "../../../hooks/useInitialValue";
import { FAKE_SCOPES, getScopeNames } from "../scopes";
import { ApplicationIntegrationType } from "../../../_bundle/Module8028";
import { OAuth2Scopes } from "../../../_bundle/Module8174";
let useStyles;
const Scope = function Scope(props) {
const { text, error, isFake } = props;
const styles = useStyles();
return <View style={styles.scopeContainer} accessible accessibilityLabel={`${isFake ? intl.string(t.OX8EMU) : intl.string(t["0lpCFG"])}: ${text}${error != null ? `. ${error}` : ""}`}>
<View style={styles.iconWrapper} accessible={false} importantForAccessibility="no-hide-descendants">
{isFake ? <CircleXIcon style={styles.fakeScopeIcon} color={Module712.colors.TEXT_MUTED} size="refresh_sm" /> : <CircleCheckIcon color={Module712.colors.TEXT_MUTED} size="refresh_sm" />}
</View>
<View style={styles.scope}>
<Text variant="text-md/normal" color={isFake ? "text-muted" : void 0}>{text}</Text>
{error != null ? <Text variant="text-xs/normal">{error}</Text> : null}
</View>
</View>;
};
useStyles = createStyles({
scopesContainer: {
flexDirection: "column",
gap: 16
},
scopes: {
flexDirection: "column",
gap: 16
},
scopeContainer: {
flexDirection: "row"
},
scope: {
flex: 1,
flexDirection: "column",
justifyContent: "center"
},
iconWrapper: {
marginRight: 12,
width: 20,
height: 20
},
fakeScopeIcon: {
opacity: 0.6
}
});
export default function AuthorizeScopes(props) {
const { application, accountScopes, requestedScopes, integrationType, errors, isTrustedName = false } = props;
const styles = useStyles();
const initialValue = useInitialValue(() => FAKE_SCOPES[Math.floor(Math.random() * FAKE_SCOPES.length)]);
if (accountScopes.length === 0) {
return null;
}
const text = initialValue();
const r20 = isTrustedName ? t.PZpY9c : t["1Hz+Sl"];
let r10 = integrationType === ApplicationIntegrationType.USER_INSTALL && requestedScopes.includes(OAuth2Scopes.APPLICATIONS_COMMANDS);
const r57 = [<Text variant="heading-sm/normal" color="text-default">
{intl.format(r20, {
application: application.name
})}
</Text>, ,];
const r65 = [accountScopes.map((accountScope) => {
return getScopeNames(accountScope, accountScopes).map((item, index) => {
let error = void 0;
if (index === 0) {
const r3 = errors == null;
let r15 = void 0;
if (!r3) {
const r16 = errors[accountScope];
r15 = r16 == null ? void 0 : r16[0];
}
error = r15;
}
return <Scope key={`${accountScope}-${index}`} text={item} error={error} />;
});
}).flat(), , ,];
if (r10) {
r10 = <Scope text={intl.string(t.Ls2XRq)} />;
}
r65[1] = r10;
r65[2] = <Scope text={text} isFake />;
r57[1] = <View style={styles.scopes}>{r65}</View>;
return <View style={styles.scopesContainer}>{r57}</View>;
};
+69
View File
@@ -0,0 +1,69 @@
// Metro module 9017 (f9018).
import { useState, useEffect } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { NONE } from "../../../utils/PermissionUtils";
import { invert, has } from "../../../_bundle/HighLow";
import { OrderedPermissions, getPermissionName } from "../permissions";
import { Checkbox } from "../../../design/components/Checkbox/native/Checkbox.native";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { XSmallIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
const useStyles = createStyles({
disabledPermissionIcon: {
width: 24,
height: 24,
flexGrow: 0,
flexShrink: 0,
alignItems: "center",
justifyContent: "center",
borderRadius: Module712.radii.sm,
backgroundColor: Module712.colors.ICON_FEEDBACK_CRITICAL
}
});
export default function BotPermissions(props) {
const { application, permissions, deniedPermissions, onPermissionsChange, guild } = props;
const styles = useStyles();
const [state, setState] = useState(NONE);
useEffect(() => {
onPermissionsChange(true, permissions);
setState(invert(guild.permissions));
onPermissionsChange(false, invert(guild.permissions));
}, [guild.permissions, onPermissionsChange, permissions]);
const r43 = OrderedPermissions.filter((orderedPermission) => has(permissions, orderedPermission));
const r14 = r43.filter((item) => !has(state, item)).map((item) => {
const permissionName = getPermissionName(item);
const checked = !has(deniedPermissions, item);
return <Checkbox key={String(item)} checked={checked} onToggle={(event) => onPermissionsChange(event, item)} label={permissionName} />;
});
const r13 = r43.filter((item) => has(state, item)).map((item) => {
const permissionName = getPermissionName(item);
return <Stack key={String(item)} direction="horizontal" align="center">
<View style={styles.disabledPermissionIcon}>
<XSmallIcon size="sm" color="white" />
</View>
<Text variant="text-md/medium">{permissionName}</Text>
</Stack>;
});
return <Stack spacing={16}>
<Stack>
<Text variant="text-sm/medium" color="text-subtle">
{intl.format(t.sOaT2j, {
applicationName: application.name,
guildName: guild.name
})}
</Text>
<Stack spacing={12}>{r14}</Stack>
</Stack>
{r13.length > 0 ? <Stack>
<Text variant="text-sm/medium" color="text-subtle">
{intl.format(t.fsOkF4, {
applicationName: application.name
})}
</Text>
<Stack spacing={12}>{r13}</Stack>
</Stack> : null}
</Stack>;
};
@@ -0,0 +1,193 @@
// Metro module 8962 (f8963).
import { useEffect } from "react";
import { View } from "react-native";
import ApplicationStore from "../../applications/ApplicationStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import UserStore from "../../../stores/UserStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useTheme from "../../../hooks/useTheme";
import { useStateFromStores } from "../../../_bundle/Module589";
import Platforms from "../../../lib/Platforms";
import AvatarUtils, { makeSource } from "../../../utils/AvatarUtils";
import * as _shared from "../../../design/shared";
import ApplicationActionCreators from "../../applications/ApplicationActionCreators";
import { Avatar, AvatarSizes, Icon } from "../../../design/void/native";
import { MoreHorizontalIcon } from "../../../design/components/Icon/native/redesign/generated/MoreHorizontalIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import authorizeConnection_native from "../../connections/authorizeConnection.native";
import { CircleInformationIcon } from "../../../design/components/Icon/native/redesign/generated/CircleInformationIcon";
import { CheckmarkLargeIcon } from "../../../design/components/Icon/native/redesign/generated/CheckmarkLargeIcon";
const useStyles = createStyles({
container: {
flexDirection: "column",
gap: 16,
width: "100%"
},
header: {
flexDirection: "column",
alignItems: "center",
gap: 8,
marginBottom: 8
},
headerIcons: {
flexDirection: "row",
alignItems: "center",
gap: 16,
marginBottom: 8
},
card: {
flexDirection: "row",
alignItems: "center",
gap: 12,
padding: 16,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 1,
borderRadius: Module712.radii.md
},
cardName: {
flex: 1,
minWidth: 0
},
cardInfo: {
flex: 1,
minWidth: 0,
flexDirection: "column",
gap: 2
},
platformIcon: {
width: 40,
height: 40,
borderRadius: Module712.radii.sm
},
platformIconSmall: {
width: 32,
height: 32,
borderRadius: Module712.radii.sm
},
infoNotice: {
flexDirection: "row",
alignItems: "flex-start",
gap: 8,
padding: 12,
backgroundColor: Module712.colors.BACKGROUND_FEEDBACK_INFO,
borderColor: Module712.colors.ICON_FEEDBACK_INFO,
borderWidth: 1,
borderRadius: Module712.radii.sm
},
infoText: {
flex: 1
},
divider: {
height: 1,
backgroundColor: Module712.colors.BORDER_SUBTLE,
marginVertical: 8
}
});
export default function ConnectAccountStep(props) {
const { clientId, platformType, platformName } = props;
const styles = useStyles();
const theme = useTheme();
const stateFromStores = useStateFromStores([ApplicationStore], () => ApplicationStore.getApplication(clientId), [clientId]);
const stateFromStores2 = useStateFromStores([AuthenticationStore, UserStore], () => AuthenticationStore.getId() != null ? UserStore.getCurrentUser() : null);
const r10 = Platforms.get(platformType);
const r1 = r10 != null;
let source = null;
if (r1) {
const isThemeLight = _shared.isThemeLight(theme);
const icon = r10.icon;
source = makeSource(isThemeLight ? icon.lightPNG : icon.darkPNG);
}
const source3 = stateFromStores != null ? AvatarUtils.getApplicationIconSource({
id: stateFromStores.id,
icon: stateFromStores.icon
}) : void 0;
const source2 = stateFromStores2 != null ? AvatarUtils.getUserAvatarSource(stateFromStores2) : void 0;
let applicationName = stateFromStores?.name;
if (applicationName == null) {
applicationName = "";
}
useEffect(() => {
ApplicationActionCreators.fetchApplication(clientId);
}, [clientId]);
return <View style={styles.container}>
<View style={styles.header}>
<View style={styles.headerIcons}>
<Avatar source={source3} size={AvatarSizes.XLARGE} />
<MoreHorizontalIcon color={Module712.colors.INTERACTIVE_TEXT_DEFAULT} size="md" />
<Avatar source={source2} size={AvatarSizes.XLARGE} />
</View>
<Text variant="text-lg/normal" color="text-default">
{intl.string(t.uT1CPa)}
</Text>
<Text variant="heading-xl/semibold" color="mobile-text-heading-primary">{applicationName}</Text>
</View>
<Text variant="text-sm/normal" color="text-default">
{intl.format(t["aJRE/Q"], {
applicationName,
platformName
})}
</Text>
<View style={styles.card}>
{source != null ? <Icon source={source} style={styles.platformIcon} disableColor /> : null}
<Text variant="text-md/medium" style={styles.cardName} color="text-default">{platformName}</Text>
<Button variant="primary" size="sm" onPress={function onPress() {
authorizeConnection_native({
platformType,
location: "OAuth2 Connect Account Step"
});
}} text={intl.string(t.S0W8Z5)} />
</View>
<View style={styles.infoNotice}>
<CircleInformationIcon color={Module712.colors.ICON_FEEDBACK_INFO} size="sm" />
<Text variant="text-sm/normal" color="text-default" style={styles.infoText}>
{intl.format(t["8psEFX"], {
platformName,
applicationName
})}
</Text>
</View>
</View>;
};
export function ConnectedAccountCard(props) {
const { platformType: platformType2, platformName, connectedAccount, applicationName } = props;
const styles = useStyles();
const theme = useTheme();
const r6 = Platforms.get(platformType2);
const r1 = r6 != null;
let source = null;
if (r1) {
const isThemeLight = _shared.isThemeLight(theme);
const icon = r6.icon;
source = makeSource(isThemeLight ? icon.lightPNG : icon.darkPNG);
}
return <View style={styles.container}>
<Text variant="text-sm/normal" color="text-default">
{intl.format(t["+oaRw3"], {
platformName
})}
</Text>
<View style={styles.card}>
{source != null ? <Icon source={source} style={styles.platformIconSmall} disableColor /> : null}
<View style={styles.cardInfo}>
<Text variant="text-md/medium" color="mobile-text-heading-primary">{connectedAccount.name}</Text>
<Text variant="text-xs/normal" color="text-muted">
{intl.format(t.Dkd7sE, {
platformName,
connectedAccountId: connectedAccount.id
})}
</Text>
</View>
<CheckmarkLargeIcon color={Module712.colors.TEXT_FEEDBACK_POSITIVE} size="sm" />
</View>
<Text variant="text-sm/normal" color="text-default">
{intl.format(t.pyRNXJ, {
applicationName
})}
</Text>
<View style={styles.divider} />
</View>;
}
+4
View File
@@ -0,0 +1,4 @@
// Metro module 10677 (f10678).
export const OAUTH2_AUTHORIZE_MODAL_KEY = "oauth2-authorize";
export const OAUTH2_SUCCESS_RESULT_MODAL_KEY = "oauth2-success-result";
export const OAUTH2_ERROR_RESULT_MODAL_KEY = "oauth2-error-result";
+47
View File
@@ -0,0 +1,47 @@
// Metro module 8960 (f8961).
import { Image as Image2, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import Module8961 from "../../../_bundle/Module8961";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import ModalActionCreators from "../../../actions/ModalActionCreators";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
gap: 16,
paddingHorizontal: 16,
justifyContent: "center",
flexDirection: "column"
},
inner: {
flex: 1,
flexDirection: "column",
alignItems: "center",
justifyContent: "center"
},
text: {
marginTop: 24,
textAlign: "center"
},
image: {
tintColor: Module712.colors.TEXT_FEEDBACK_WARNING
}
});
export default function ErrorResult(props) {
let error = props.error;
const hideFooter = props.hideFooter;
const styles = useStyles();
const r28 = [<Image2 source={Module8961} style={styles.image} />, ,];
if (error == null) {
error = intl.string(t.mqn873);
}
r28[1] = <Text style={styles.text} variant="text-md/medium">{error}</Text>;
return <SafeAreaPaddingView bottom style={styles.container}>
<View style={styles.inner}>{r28}</View>
{hideFooter ? null : <Button size="lg" text={intl.string(t.cpT0Cq)} onPress={() => ModalActionCreators.pop()} />}
</SafeAreaPaddingView>;
};
+71
View File
@@ -0,0 +1,71 @@
// Metro module 9015 (f9016).
import { useCallback } from "react";
import { View } from "react-native";
import { Permissions } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { intl, t } from "../../../intl/index.native";
import { has } from "../../../_bundle/HighLow";
import { Text } from "../../../design/components/Text/native/Text";
import { LegacyText } from "../../../design/void/native";
import { FormRow } from "../../../design/void/Form/native/index";
const useStyles = createStyles({
selectorGroup: {
display: "flex",
flexDirection: "column",
gap: 8
},
select: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
borderRadius: Module712.radii.xs
},
label: {
color: Module712.colors.TEXT_SUBTLE,
fontWeight: "500"
},
error: {
color: Module712.unsafe_rawColors.RED_400
}
});
let c5899_10 = "GuildSelector";
export default function GuildSelector(props) {
const { error, selectedGuildId, onGuildChange, guilds, disabled } = props;
const styles = useStyles();
const callback = useCallback(() => {
const r16 = import("../../../components_native/common/ItemSelectorActionSheet");
const r25 = {
title: intl.string(t.oM4E1A),
items: guilds.filter((guild) => has(guild.permissions, Permissions.MANAGE_GUILD)).map((item) => ({
label: item.name,
value: item.id
})),
onItemSelect: (a0) => {
onGuildChange(a0);
ActionSheetActionCreators.hideActionSheet(c5899_10);
},
selectedItem: null,
hasIcons: false
};
let selectedItem = selectedGuildId;
if (selectedGuildId == null) {
selectedItem = void 0;
}
r25.selectedItem = selectedItem;
ActionSheetActionCreators.openLazy(r16, c5899_10, r25);
}, [guilds, onGuildChange, selectedGuildId]);
const r24 = guilds.find((guild) => guild.id === selectedGuildId);
const r42 = [<Text variant="eyebrow" color="text-default">
{intl.string(t["1DXFFd"])}
</Text>, error != null ? error !== "" ? <LegacyText style={styles.error}>{error}</LegacyText> : null : null, , ,];
let label = r24?.name;
if (label == null) {
label = intl.string(t.oM4E1A);
}
r42[2] = <FormRow label={label} disabled={disabled} trailing={<FormRow.Arrow />} DEPRECATED_style={styles.select} onPress={callback} />;
r42[3] = <LegacyText style={styles.label}>
{intl.format(t.t9Jm9o, {})}
</LegacyText>;
return <View style={styles.selectorGroup}>{r42}</View>;
};
export { useStyles };
+73
View File
@@ -0,0 +1,73 @@
// Metro module 9030 (f9031).
import { View } from "react-native";
import { UserFlags } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import AvatarUtils from "../../../utils/AvatarUtils";
import { Avatar, AvatarSizes } from "../../../design/void/native";
import { Text } from "../../../design/components/Text/native/Text";
import BotTag from "../../applications/native/BotTag";
import { hasFlag } from "../../../_bundle/Module1384";
import { intl, t } from "../../../intl/index.native";
const useStyles = createStyles({
header: {
paddingBottom: 16,
marginHorizontal: 16,
borderTopLeftRadius: Module712.radii.sm,
borderTopRightRadius: Module712.radii.sm,
flexDirection: "column",
justifyContent: "center",
alignItems: "center"
},
applicationNameWrapper: {
flexDirection: "row"
},
headerIcons: {
alignItems: "center",
flexDirection: "row",
justifyContent: "space-between",
marginBottom: 24
},
ellipseGroup: {
flexDirection: "row",
justifyContent: "space-between",
marginHorizontal: 24
},
ellipse: {
width: 4,
height: 4,
marginHorizontal: 2,
backgroundColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
opacity: 0.1,
borderRadius: 2
},
botTag: {
marginTop: 4,
marginLeft: 8
}
});
export default function Header(props) {
const { user, application, accountScopes, bot } = props;
const styles = useStyles();
return <View style={styles.header}>
<View style={styles.headerIcons}>
<Avatar source={AvatarUtils.getApplicationIconSource({
id: application.id,
icon: application.icon
})} size={AvatarSizes.XLARGE} />
<View style={styles.ellipseGroup}>
<View style={styles.ellipse} />
<View style={styles.ellipse} />
<View style={styles.ellipse} />
</View>
<Avatar source={user != null ? AvatarUtils.getUserAvatarSource(user) : void 0} size={AvatarSizes.XLARGE} />
</View>
<View style={styles.applicationNameWrapper}>
<Text variant="text-lg/bold" color="mobile-text-heading-primary">{application.name}</Text>
{bot != null ? <BotTag style={styles.botTag} verified={bot.public_flags != null && hasFlag(bot.public_flags, UserFlags.VERIFIED_BOT)} /> : null}
</View>
<Text variant="heading-md/normal" color="text-default">
{accountScopes.length > 0 ? intl.string(t.jFbDnJ) : intl.string(t["X+Fdpo"])}
</Text>
</View>;
};
@@ -0,0 +1,108 @@
// Metro module 9003 (f9004).
import { useMemo } from "react";
import { View, StyleSheet } from "react-native";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import AvatarUtils from "../../../utils/AvatarUtils";
import { ApplicationIntegrationType } from "../../../_bundle/Module8028";
import { UserPlusIcon } from "../../../design/components/Icon/native/redesign/generated/UserPlusIcon";
import { intl, t } from "../../../intl/index.native";
import { ServerIcon } from "../../../design/components/Icon/native/redesign/generated/ServerIcon";
import FastImage from "../../../components_native/common/FastImage";
import { Text } from "../../../design/components/Text/native/Text";
import DetailsHeader from "../../app_launcher/native/screens/application_view/app/DetailsHeader";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import { BetaTag } from "../../../design/void/native";
const useStyles = createStyles({
container: {
alignItems: "center",
flexDirection: "column"
},
header: {
justifyContent: "center",
alignItems: "center",
gap: 16,
marginTop: 24,
marginBottom: 32,
width: "100%"
},
rows: {
alignSelf: "stretch",
borderRadius: Module712.radii.sm
},
divider: {
height: StyleSheet.hairlineWidth,
backgroundColor: Module712.colors.BORDER_SUBTLE,
marginTop: -1 * StyleSheet.hairlineWidth
},
learnMore: {
marginVertical: 16
},
descriptionContainer: {
backgroundColor: Module712.colors.CARD_BACKGROUND_DEFAULT,
width: "100%",
borderRadius: Module712.radii.sm
},
descriptionMainContainer: {
padding: 8
},
appIcon: {
height: 82,
width: 82,
borderRadius: Module712.radii.xl
},
appIconMask: {
padding: 4,
borderRadius: Module712.radii.xl + 4
},
loadingIcon: {
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED
}
});
export default function IntegrationTypeSelector(props) {
let memo;
const { application, onSelect } = props;
memo = void 0;
const styles = useStyles();
const memo2 = useMemo(() => AvatarUtils.getApplicationIconSource({
id: application.id,
icon: application.icon
}), [application.icon, application.id]);
memo = useMemo(() => [{
type: ApplicationIntegrationType.USER_INSTALL,
icon: UserPlusIcon,
label: intl.string(t.aCg60P),
subLabel: intl.string(t.YeiIUZ),
beta: false
}, {
type: ApplicationIntegrationType.GUILD_INSTALL,
icon: ServerIcon,
label: intl.string(t.E64YCz),
subLabel: intl.string(t.bbtoKm),
beta: false
}].filter((item) => {
const integrationTypesConfig = application.integrationTypesConfig;
return (integrationTypesConfig == null ? void 0 : integrationTypesConfig[item.type]?.oauth2InstallParams) != null;
}), [application.integrationTypesConfig]);
return <View style={styles.container}>
<View style={styles.header}>
<View style={styles.appIconMask}>
{memo2 != null ? <FastImage style={styles.appIcon} source={memo2} /> : <View style={[styles.appIcon, styles.loadingIcon]} />}
</View>
<Text variant="heading-lg/bold" color="mobile-text-heading-primary">{application.name}</Text>
{application.description != null && <DetailsHeader hideName application={application} viewContainerStyle={styles.descriptionContainer} mainContainerStyle={styles.descriptionMainContainer} />}
</View>
<View style={styles.rows}>
<TableRowGroup hasIcons>
{memo.map((item, index) => {
return <TableRow key={item.type} icon={jsx(item.icon, {
color: "interactive-text-default"
})} label={item.label} subLabel={item.subLabel} onPress={() => onSelect(item.type)} start={index === 0} end={index === memo.length - 1} arrow trailing={item.beta ? <BetaTag /> : void 0} />;
})}
</TableRowGroup>
</View>
</View>;
};
export { useStyles };
@@ -0,0 +1,135 @@
// Metro module 10021 (f10022).
import { useRef, useState, useLayoutEffect } from "react";
import { ScrollView, View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import KeyboardAwareView from "../../keyboard/native/KeyboardAwareView";
import ObscuredSurface from "../../safety_common/native/ObscuredSurface";
const useStyles = createStyles({
fill: {
flex: 1
},
scrollView: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
paddingHorizontal: 16
},
scrollViewContentLandscape: {
flexDirection: "row",
alignItems: "center",
width: "100%",
flexGrow: 1,
gap: 16
},
scrollViewContentPortrait: {
flexDirection: "column",
width: "100%",
flexGrow: 1,
gap: 16
},
header: {
paddingTop: 24
},
bodyContainer: {
flexDirection: "column",
gap: 16,
padding: 16
},
bodyContainerBackground: {
marginHorizontal: 16,
backgroundColor: Module712.colors.BORDER_SUBTLE,
borderRadius: Module712.radii.lg
},
footerPortrait: {
flexDirection: "column",
padding: 16,
gap: 16
},
separator: {
height: 1,
backgroundColor: Module712.colors.BORDER_SUBTLE
}
});
export default function OAuth2AuthorizeContent(props) {
const { header, body, footer, appDetails, centerContent, setAllContentSeen, hasContentBackground, onScroll: onScroll2, obscured } = props;
const styles = useStyles();
const ref = useRef(null);
const windowDimensions_native = useWindowDimensions_native();
const r6 = windowDimensions_native.width > windowDimensions_native.height;
const safeAreaInsets_native = useSafeAreaInsets_native();
const { left, right, bottom } = safeAreaInsets_native;
const [state, setState] = useState(-1);
const [state2, setState2] = useState(-1);
const [state3, setState3] = useState(-1);
const r3 = state >= 0 && state2 >= 0 && (footer == null || state3 >= 0);
let c17629_8 = r3;
useLayoutEffect(() => {
if (c17629_8) {
const r5 = {
layoutMeasurement: {
height: state2
},
contentSize: {
height: state
}
};
const { layoutMeasurement, contentOffset = {
y: 0
} } = r5;
if (layoutMeasurement.height + contentOffset.y >= r5.contentSize.height - 5) {
if (setAllContentSeen != null) {
setAllContentSeen(true);
}
} else if (setAllContentSeen != null) {
setAllContentSeen(false);
}
}
}, [state, r3, state2, setAllContentSeen]);
return <KeyboardAwareView style={[styles.fill, {
marginBottom: bottom
}]}>
<ScrollView style={[styles.scrollView, {
paddingLeft: left,
paddingRight: right
}]} contentContainerStyle={[r6 ? styles.scrollViewContentLandscape : styles.scrollViewContentPortrait]} ref={ref} onContentSizeChange={(event, a1) => {
const current = ref.current;
if (current != null) {
current.scrollTo({
y: 0
});
}
setState(a1);
}} scrollEventThrottle={16} onLayout={(event) => {
setState2(event.nativeEvent.layout.height);
}} onScroll={(event) => {
const nativeEvent = event.nativeEvent;
const { layoutMeasurement, contentOffset = {
y: 0
} } = nativeEvent;
if (layoutMeasurement.height + contentOffset.y >= nativeEvent.contentSize.height - 5 && setAllContentSeen != null) {
setAllContentSeen(true);
}
if (onScroll2 != null) {
onScroll2(event);
}
}} centerContent={centerContent}>
<ObscuredSurface obscured={obscured}>
{header != null ? <View style={styles.header}>{header}</View> : null}
<View style={[styles.bodyContainer, hasContentBackground ? styles.bodyContainerBackground : null, r6 ? {
flex: 1
} : {}]}>
{body}
{appDetails != null ? <>
<View style={styles.separator} />
<View>{appDetails}</View>
</> : null}
</View>
</ObscuredSurface>
</ScrollView>
{footer != null ? <View onLayout={(event) => {
setState3(event.nativeEvent.layout.height);
}} style={styles.footerPortrait}>{footer}</View> : null}
</KeyboardAwareView>;
};
@@ -0,0 +1,100 @@
// Metro module 10018 (f10019).
import { useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useOAuth2AuthorizeForm from "./useOAuth2AuthorizeForm";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import { withSpring } from "../../../design/animation/reanimated/spring/spring";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../intl/index.native";
import { ArrowSmallLeftIcon } from "../../../design/components/Icon/native/redesign/generated/ArrowSmallLeftIcon";
import { XSmallIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import OAuth2AuthorizeContent from "./OAuth2AuthorizeContent";
let c6663_7 = {
overshootClamping: true,
stiffness: 20,
damping: 15,
mass: 0.03
};
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
},
contentContainer: {
flex: 1
},
titleContainer: {
padding: 16,
flexDirection: "row",
gap: 16
},
titleContainerBorder: {
position: "absolute",
left: 0,
right: 0,
bottom: 0,
height: 1,
backgroundColor: Module712.colors.BORDER_SUBTLE
},
title: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
marginEnd: 40
}
});
const __initData = {
code: "function OAuth2AuthorizeModalTsx1(){const{borderOpacity}=this.__closure;var _borderOpacity$get;return{opacity:(_borderOpacity$get=borderOpacity.get())!==null&&_borderOpacity$get!==void 0?_borderOpacity$get:1};}"
};
export default function OAuth2AuthorizeModal(props) {
const styles = useStyles();
const oAuth2AuthorizeForm = useOAuth2AuthorizeForm(props);
let c17628_0 = oAuth2AuthorizeForm;
const top = useSafeAreaInsets_native().top;
const sharedValue = useSharedValue(0);
const b = function b() {
let opacity = sharedValue.get();
if (opacity == null) {
opacity = 1;
}
return {
opacity
};
};
b.__closure = {
borderOpacity: sharedValue
};
b.__workletHash = 5916964482569;
b.__initData = __initData;
const animatedStyle = useAnimatedStyle(b);
const callback = useCallback((a0) => {
sharedValue.set(withSpring(a0.nativeEvent.contentOffset.y > 16 ? 1 : 0, c6663_7));
}, [sharedValue]);
return <View style={styles.container}>
<View style={[styles.titleContainer, {
paddingTop: top + 16
}]}>
<PressableOpacity accessibilityRole="button" accessibilityLabel={oAuth2AuthorizeForm.backStep != null ? intl.string(t["13/7kX"]) : intl.string(t.cpT0Cq)} onPress={() => {
const goBackOrCancel = c17628_0.goBackOrCancel;
return goBackOrCancel == null ? void 0 : goBackOrCancel.call(c17628_0);
}}>
{oAuth2AuthorizeForm.backStep != null ? <ArrowSmallLeftIcon color={Module712.colors.INTERACTIVE_TEXT_DEFAULT} /> : <XSmallIcon color={Module712.colors.INTERACTIVE_TEXT_DEFAULT} />}
</PressableOpacity>
<View style={styles.title}>
<Text variant="redesign/heading-18/bold" accessibilityRole="header">
{intl.string(t["y+/PE9"])}
</Text>
</View>
<ReanimatedRexport.View style={[styles.titleContainerBorder, animatedStyle]} />
</View>
<SafeAreaPaddingView bottom style={styles.contentContainer}>
<OAuth2AuthorizeContent {...oAuth2AuthorizeForm} onScroll={callback} centerContent />
</SafeAreaPaddingView>
</View>;
};
+140
View File
@@ -0,0 +1,140 @@
// Metro module 11002 (f11003).
import { useMemo, useCallback, useEffect } from "react";
import { Image as Image2, ScrollView, View } from "react-native";
import ChannelStore from "../../../stores/ChannelStore";
import PermissionStore from "../../../stores/PermissionStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import { AnalyticEvents, Permissions } from "../../../Constants";
import { AppLauncherRouteName } from "../../app_launcher/native/AppLauncherNativeConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStore, OrientationType } from "../../device/native/DeviceOrientation";
import { intl, t } from "../../../intl/index.native";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { transitionToGuild } from "../../routing/transitionToGuild.native";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { useStateFromStores } from "../../../_bundle/Module589";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { getBestActiveInput } from "../../../utils/native/ChatInputUtils";
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import Module11003 from "../../../_bundle/Module11003";
import { Text } from "../../../design/components/Text/native/Text";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
},
scrollView: {
flex: 1
},
scrollViewContentContainer: {
height: "100%",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
alignItems: "center",
justifyContent: "center"
},
inner: {
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
paddingHorizontal: 16
},
text: {
marginTop: 24,
paddingHorizontal: 40,
textAlign: "center"
},
footer: {
flexDirection: "column",
justifyContent: "space-between",
padding: 16,
gap: 16
},
footerLandscape: {
flexDirection: "row-reverse",
padding: 16
},
footerPortrait: {
flexDirection: "column",
padding: 16
}
});
export default function SuccessResultModal(props) {
let stateFromStores, stateFromStores2;
const { guild, application } = props;
stateFromStores = void 0;
stateFromStores2 = void 0;
const styles = useStyles();
const orientation = useStore().orientation;
const memo = useMemo(() => application != null ? guild != null ? intl.format(t.IlF6IY, {
installedApplicationName: application?.name,
guildName: guild?.name
}) : intl.format(t.vTVC5T, {
installedApplicationName: application?.name
}) : intl.string(t["Dp+rgP"]), [application, guild]);
const callback3 = useCallback(() => {
if (guild?.id != null) {
ModalActionCreators.pop();
transitionToGuild(guild?.id);
AnalyticsUtils.track(AnalyticEvents.OAUTH2_AUTHORIZE_SUCCESS_GO_TO_GUILD_CLICKED, {
application_id: application?.id,
guild_id: guild?.id
});
}
}, [guild, application?.id]);
stateFromStores = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getChannelId());
stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(stateFromStores));
const callback2 = useCallback(() => {
ModalActionCreators.pop();
ActionSheetActionCreators.hideActionSheet();
if (stateFromStores != null && application != null) {
AnalyticsUtils.track(AnalyticEvents.OAUTH2_AUTHORIZE_SUCCESS_OPEN_APP_CLICKED, {
application_id: application.id
});
setImmediate(() => {
const bestActiveInput = getBestActiveInput();
if (bestActiveInput != null) {
bestActiveInput.openCustomKeyboard({
type: KeyboardTypes.APP_LAUNCHER,
context: {
initialRouteName: AppLauncherRouteName.APPLICATION_VIEW,
application
}
});
}
});
}
}, [application, stateFromStores]);
const callback = useCallback(() => {
ModalActionCreators.pop();
AnalyticsUtils.track(AnalyticEvents.OAUTH2_AUTHORIZE_SUCCESS_CLOSE_CLICKED, {
application_id: application?.id
});
}, [application?.id]);
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OAUTH2_AUTHORIZE_SUCCESS_VIEWED, {
application_id: application?.id
});
}, [application?.id]);
const stateFromStores3 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.SEND_MESSAGES, stateFromStores2));
const r109 = [<ScrollView style={styles.scrollView} contentContainerStyle={styles.scrollViewContentContainer}>
<View style={styles.inner}>
<Image2 source={Module11003} />
<Text style={styles.text} variant="text-lg/medium">
{intl.string(t.se5gLj)}
</Text>
{memo != null ? <Text style={styles.text} variant="text-sm/normal">{memo}</Text> : null}
</View>
</ScrollView>, <View style={[styles.footer, orientation === OrientationType.LANDSCAPE ? styles.footerLandscape : styles.footerPortrait]}>
<>
{guild != null ? <Button size="lg" text={intl.formatToPlainString(t.UdYYP3, {
guildName: guild?.name
})} onPress={callback3} /> : null}
{stateFromStores != null ? stateFromStores3 ? <Button size="lg" text={intl.string(t["0cCDKP"])} onPress={callback2} /> : null : null}
<Button size="lg" variant={guild != null ? "tertiary" : void 0} text={intl.string(t.cpT0Cq)} onPress={callback} />
</>
</View>];
return <SafeAreaPaddingView bottom style={styles.container}>{r109}</SafeAreaPaddingView>;
};
@@ -0,0 +1,123 @@
// Metro module 9016 (f9017).
import { useState, useRef, useCallback, useEffect } from "react";
import { View } from "react-native";
import { createChannelRecord } from "../../../records/ChannelRecord";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserStore from "../../../stores/UserStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { intl, t } from "../../../intl/index.native";
import { computeChannelName } from "../../channel/useChannelName";
import { fetchChannels } from "../actions";
import { Text } from "../../../design/components/Text/native/Text";
import { LegacyText } from "../../../design/void/native";
import { FormRow } from "../../../design/void/Form/native/index";
const useStyles = createStyles({
selectorGroup: {
flexDirection: "column",
gap: 8
},
select: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
borderRadius: Module712.radii.xs
},
label: {
color: Module712.colors.TEXT_SUBTLE,
fontWeight: "500"
},
error: {
color: Module712.unsafe_rawColors.RED_400
}
});
let c5900_13 = "WebhookGuildChannelSelector";
export default function WebhookGuildChannelSelector(props) {
const { selectedGuildId, selectedChannelId, onChannelChange, error } = props;
const styles = useStyles();
const [state, setState] = useState(null);
const ref = useRef(false);
const callback = useCallback(() => {
if (state != null && state.guildId === selectedGuildId) {
const r21 = import("../../../components_native/common/ItemSelectorActionSheet");
const r30 = {
title: intl.string(t["Re/64R"]),
items: state.channels.map((channel) => ({
label: computeChannelName(createChannelRecord(channel), UserStore, RelationshipStore),
value: channel.id
})),
onItemSelect: (a0) => {
onChannelChange(a0);
ActionSheetActionCreators.hideActionSheet(c5900_13);
},
selectedItem: null,
hasIcons: false
};
let selectedItem = selectedChannelId;
if (selectedChannelId == null) {
selectedItem = void 0;
}
r30.selectedItem = selectedItem;
ActionSheetActionCreators.openLazy(r21, c5900_13, r30);
}
}, [state, onChannelChange, selectedChannelId, selectedGuildId]);
useEffect(() => {
let _updateChannels2 = function _updateChannels() {
const r9 = async (c31484_0) => {
let c31484_2;
let env31986;
c31484_2 = void 0;
const r9 = env31986 = {};
let c31484_1 = r9;
env31986[0] = c31484_0;
env31986[1] = void 0;
env31986[1] = await fetchChannels(c31484_0);
if (selectedGuildId === env31986[0]) {
env31986[1].sort((a, b) => a.name.localeCompare(b.name));
(0, setState)({
guildId: env31986[0],
channels: env31986[1]
});
ref.current = true;
}
};
_updateChannels2 = r9;
return r9.apply(this, arguments);
};
setState(null);
if (selectedGuildId == null) {
onChannelChange(null);
} else {
(function updateChannels(a0) {
return _updateChannels2.apply(this, arguments);
})(selectedGuildId);
}
}, [onChannelChange, selectedGuildId]);
useEffect(() => {
if (ref.current) {
if (state == null) {
if (selectedChannelId != null) {
onChannelChange(null);
}
} else if (!state.channels.some((channel) => channel.id === selectedChannelId)) {
onChannelChange(null);
}
}
}, [state, onChannelChange, selectedChannelId, selectedGuildId]);
if (selectedGuildId == null) {
return null;
}
const r38 = state == null ? void 0 : state.channels.find((channel) => channel.id === selectedChannelId);
const r60 = [<Text variant="eyebrow" color="text-default">
{intl.string(t["8qKd+J"])}
</Text>, error != null ? error !== "" ? <LegacyText style={styles.error}>{error}</LegacyText> : null : null, , ,];
let label = r38?.name;
if (label == null) {
label = intl.string(t["Re/64R"]);
}
r60[2] = <FormRow label={label} disabled={selectedGuildId == null} trailing={<FormRow.Arrow />} DEPRECATED_style={styles.select} onPress={callback} />;
r60[3] = <LegacyText style={styles.label}>
{intl.string(t.kQXMfN)}
</LegacyText>;
return <View style={styles.selectorGroup}>{r60}</View>;
};
export { useStyles };
@@ -0,0 +1,59 @@
// Metro module 11001 (f11002).
import { OAUTH2_ERROR_RESULT_MODAL_KEY, OAUTH2_SUCCESS_RESULT_MODAL_KEY } from "./Constants";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import URLUtils from "../../../utils/URLUtils";
import { getBrowserManagerSelectedBrowser } from "../../links/native/BrowserManager";
import { WebBrowserType } from "../../../ConstantsIOS";
import Linking from "../../../lib/native/Linking";
let c7411_5 = /oauth2\/authorized/;
let c7411_6 = /oauth2\/error/;
export default function authorizeCallback(a0) {
const { location: location2, canceled, application, guild } = a0;
let wasDeepLink = a0.wasDeepLink;
if (location2 != null) {
let r32 = URLUtils.toURLSafe(location2);
if (r32 == null) {
r32 = {};
}
const { host, pathname, searchParams } = r32;
if (host != null && URLUtils.isDiscordHostname(host) && pathname != null) {
if (pathname.match(c7411_5) != null) {
ModalActionCreators.pushLazy(import("./SuccessResult"), {
application,
guild
}, OAUTH2_SUCCESS_RESULT_MODAL_KEY);
return void 0;
}
if (pathname.match(c7411_6) != null) {
if (!canceled) {
const r70 = import("./ErrorResult");
const r71 = searchParams == null;
let error = void 0;
if (!r71) {
const r75 = searchParams.get("error_description");
error = r75 == null ? void 0 : r75.toString();
}
if (error == null) {
const r78 = searchParams == null;
let r79 = void 0;
if (!r78) {
const r81 = searchParams.get("error");
r79 = r81 == null ? void 0 : r81.toString();
}
error = r79;
}
ModalActionCreators.pushLazy(r70, {
error
}, OAUTH2_ERROR_RESULT_MODAL_KEY);
}
return void 0;
}
}
if (wasDeepLink) {
wasDeepLink = getBrowserManagerSelectedBrowser() === WebBrowserType.IN_APP;
}
Linking.openURL(location2, wasDeepLink ? WebBrowserType.SAFARI : void 0);
} else if (!canceled) {
ModalActionCreators.pushLazy(import("./ErrorResult"), void 0, OAUTH2_ERROR_RESULT_MODAL_KEY);
}
};
File diff suppressed because it is too large. Load diff
+73
View File
@@ -0,0 +1,73 @@
// Metro module 8959 (f8960).
import { Permissions } from "../../Constants";
import { has } from "../../_bundle/HighLow";
import * as _index_native from "../../intl/index.native";
import { intl } from "../../intl/index.native";
let c5861_5;
let c5861_4 = [Permissions.ADMINISTRATOR, Permissions.MANAGE_GUILD, Permissions.MANAGE_ROLES, Permissions.MANAGE_CHANNELS, Permissions.KICK_MEMBERS, Permissions.BAN_MEMBERS, Permissions.CREATE_INSTANT_INVITE, Permissions.MANAGE_NICKNAMES, Permissions.CHANGE_NICKNAME, Permissions.MANAGE_GUILD_EXPRESSIONS, Permissions.CREATE_GUILD_EXPRESSIONS, Permissions.MANAGE_WEBHOOKS, Permissions.VIEW_AUDIT_LOG, Permissions.VIEW_CHANNEL, Permissions.MANAGE_EVENTS, Permissions.CREATE_EVENTS, Permissions.MODERATE_MEMBERS, Permissions.VIEW_GUILD_ANALYTICS, Permissions.VIEW_CREATOR_MONETIZATION_ANALYTICS, Permissions.USE_EXTERNAL_APPS, Permissions.SEND_MESSAGES, Permissions.SEND_MESSAGES_IN_THREADS, Permissions.CREATE_PUBLIC_THREADS, Permissions.CREATE_PRIVATE_THREADS, Permissions.SEND_TTS_MESSAGES, Permissions.MANAGE_MESSAGES, Permissions.MANAGE_THREADS, Permissions.EMBED_LINKS, Permissions.ATTACH_FILES, Permissions.READ_MESSAGE_HISTORY, Permissions.MENTION_EVERYONE, Permissions.ADD_REACTIONS, Permissions.USE_EXTERNAL_EMOJIS, Permissions.USE_EXTERNAL_STICKERS, Permissions.USE_APPLICATION_COMMANDS, Permissions.SEND_VOICE_MESSAGES, Permissions.SEND_POLLS, Permissions.PIN_MESSAGES, Permissions.BYPASS_SLOWMODE, Permissions.MANAGE_OFFICIAL_MESSAGES, Permissions.CONNECT, Permissions.SPEAK, Permissions.MUTE_MEMBERS, Permissions.DEAFEN_MEMBERS, Permissions.MOVE_MEMBERS, Permissions.USE_VAD, Permissions.PRIORITY_SPEAKER, Permissions.REQUEST_TO_SPEAK, Permissions.STREAM, Permissions.USE_EMBEDDED_ACTIVITIES, Permissions.USE_SOUNDBOARD, Permissions.USE_EXTERNAL_SOUNDS, Permissions.SET_VOICE_CHANNEL_STATUS];
const r70 = {};
r70[Permissions.ADMINISTRATOR.toString()] = () => intl.string(_index_native.t.PGvZqX);
r70[Permissions.MANAGE_GUILD.toString()] = () => intl.string(_index_native.t.QZRcfO);
r70[Permissions.MANAGE_ROLES.toString()] = () => intl.string(_index_native.t["C8d+oG"]);
r70[Permissions.MANAGE_CHANNELS.toString()] = () => intl.string(_index_native.t["9qLtWs"]);
r70[Permissions.KICK_MEMBERS.toString()] = () => intl.string(_index_native.t.pBNv6i);
r70[Permissions.BAN_MEMBERS.toString()] = () => intl.string(_index_native.t.oTBA7N);
r70[Permissions.CREATE_INSTANT_INVITE.toString()] = () => intl.string(_index_native.t.zJrgTG);
r70[Permissions.MANAGE_NICKNAMES.toString()] = () => intl.string(_index_native.t["t+Ct5x"]);
r70[Permissions.CHANGE_NICKNAME.toString()] = () => intl.string(_index_native.t.dilOF6);
r70[Permissions.MANAGE_GUILD_EXPRESSIONS.toString()] = () => intl.string(_index_native.t.bbuXIn);
r70[Permissions.CREATE_GUILD_EXPRESSIONS.toString()] = () => intl.string(_index_native.t.HarVuP);
r70[Permissions.MANAGE_WEBHOOKS.toString()] = () => intl.string(_index_native.t["/ADKmM"]);
r70[Permissions.VIEW_AUDIT_LOG.toString()] = () => intl.string(_index_native.t.fZgLpA);
r70[Permissions.VIEW_CHANNEL.toString()] = () => intl.string(_index_native.t.uV83yi);
r70[Permissions.SEND_MESSAGES.toString()] = () => intl.string(_index_native.t.T32rkC);
r70[Permissions.SEND_TTS_MESSAGES.toString()] = () => intl.string(_index_native.t.Mg7bku);
r70[Permissions.MANAGE_MESSAGES.toString()] = () => intl.string(_index_native.t["6lU9xM"]);
r70[Permissions.EMBED_LINKS.toString()] = () => intl.string(_index_native.t["969dEL"]);
r70[Permissions.ATTACH_FILES.toString()] = () => intl.string(_index_native.t["3AS4UM"]);
r70[Permissions.READ_MESSAGE_HISTORY.toString()] = () => intl.string(_index_native.t.l9ufaR);
r70[Permissions.MENTION_EVERYONE.toString()] = () => intl.string(_index_native.t.Y78KGC);
r70[Permissions.ADD_REACTIONS.toString()] = () => intl.string(_index_native.t.yEoJAr);
r70[Permissions.USE_EXTERNAL_EMOJIS.toString()] = () => intl.string(_index_native.t.BpBGZU);
r70[Permissions.USE_EXTERNAL_STICKERS.toString()] = () => intl.string(_index_native.t["UeRs+b"]);
r70[Permissions.USE_APPLICATION_COMMANDS.toString()] = () => intl.string(_index_native.t.shbR1a);
r70[Permissions.SEND_VOICE_MESSAGES.toString()] = () => intl.string(_index_native.t["+8GStU"]);
r70[Permissions.CONNECT.toString()] = () => intl.string(_index_native.t.S0W8Z5);
r70[Permissions.SPEAK.toString()] = () => intl.string(_index_native.t["8w1tIR"]);
r70[Permissions.MUTE_MEMBERS.toString()] = () => intl.string(_index_native.t["8EI30/"]);
r70[Permissions.DEAFEN_MEMBERS.toString()] = () => intl.string(_index_native.t["9L47Fr"]);
r70[Permissions.MOVE_MEMBERS.toString()] = () => intl.string(_index_native.t.YtjJPQ);
r70[Permissions.USE_VAD.toString()] = () => intl.string(_index_native.t["08zAV7"]);
r70[Permissions.PRIORITY_SPEAKER.toString()] = () => intl.string(_index_native.t.BVK71i);
r70[Permissions.CREATE_PUBLIC_THREADS.toString()] = () => intl.string(_index_native.t["25rKnX"]);
r70[Permissions.CREATE_PRIVATE_THREADS.toString()] = () => intl.string(_index_native.t.QwbTSa);
r70[Permissions.SEND_MESSAGES_IN_THREADS.toString()] = () => intl.string(_index_native.t.fTE74g);
r70[Permissions.MANAGE_THREADS.toString()] = () => intl.string(_index_native.t.kEqgr7);
r70[Permissions.MANAGE_EVENTS.toString()] = () => intl.string(_index_native.t.HIgA5a);
r70[Permissions.CREATE_EVENTS.toString()] = () => intl.string(_index_native.t.qyjZua);
r70[Permissions.MODERATE_MEMBERS.toString()] = () => intl.string(_index_native.t["7DgVBr"]);
r70[Permissions.REQUEST_TO_SPEAK.toString()] = () => intl.string(_index_native.t["5kicT2"]);
r70[Permissions.VIEW_GUILD_ANALYTICS.toString()] = () => intl.string(_index_native.t["rQJBE/"]);
r70[Permissions.VIEW_CREATOR_MONETIZATION_ANALYTICS.toString()] = () => intl.string(_index_native.t["0lTLTv"]);
r70[Permissions.STREAM.toString()] = () => intl.string(_index_native.t.FlNoSV);
r70[Permissions.USE_EMBEDDED_ACTIVITIES.toString()] = () => intl.string(_index_native.t.rLSGeh);
r70[Permissions.USE_SOUNDBOARD.toString()] = () => intl.string(_index_native.t.Bco7NG);
r70[Permissions.USE_EXTERNAL_SOUNDS.toString()] = () => intl.string(_index_native.t.pwaVJ6);
r70[Permissions.SET_VOICE_CHANNEL_STATUS.toString()] = () => intl.string(_index_native.t.VBwkUf);
r70[Permissions.SEND_POLLS.toString()] = () => intl.string(_index_native.t.UMQ7Ww);
r70[Permissions.USE_EXTERNAL_APPS.toString()] = () => intl.string(_index_native.t.TtA5rK);
r70[Permissions.PIN_MESSAGES.toString()] = () => intl.string(_index_native.t.Y5BI39);
r70[Permissions.BYPASS_SLOWMODE.toString()] = () => intl.string(_index_native.t.kqcjeV);
r70[Permissions.MANAGE_OFFICIAL_MESSAGES.toString()] = () => intl.string(_index_native.t.Aj9ruN);
c5861_5 = r70;
export { c5861_4 as OrderedPermissions };
export function containsDisallowedPermission(c16891_0) {
return Object.values(Permissions).some((item) => has(c16891_0, item) && !c5861_4.includes(item));
}
export function getPermissionName(a0) {
const r9 = c5861_5[a0.toString()];
if (r9 == null) {
throw new Error(`Unknown permission. Did you provide a _single_ bit flag? Perm: ${a0}`);
}
return r9();
}
+177
View File
@@ -0,0 +1,177 @@
// Metro module 8950 (f8951).
import { intl, t } from "../../intl/index.native";
import { OAuth2Scopes } from "../../_bundle/Module8174";
const r13 = [() => intl.string(t["6xfSCq"]), () => intl.string(t.ymSk0r), () => intl.string(t.EnN7c5), () => intl.string(t["4wMpBs"]), () => intl.string(t.CncpnK), () => intl.string(t.X9pGvJ), () => intl.string(t.sGOSG4), () => intl.string(t.JfibUq)];
const r25 = [OAuth2Scopes.BOT, OAuth2Scopes.OPENID, OAuth2Scopes.IDENTIFY, OAuth2Scopes.IDENTIFY_PREMIUM, OAuth2Scopes.EMAIL, OAuth2Scopes.CONNECTIONS, OAuth2Scopes.MESSAGES_READ, OAuth2Scopes.GUILDS, OAuth2Scopes.GUILDS_JOIN, OAuth2Scopes.GUILDS_MEMBERS_READ, OAuth2Scopes.GUILDS_CHANNELS_READ, OAuth2Scopes.GDM_JOIN, OAuth2Scopes.RPC, OAuth2Scopes.RPC_NOTIFICATIONS_READ, OAuth2Scopes.RPC_VOICE_READ, OAuth2Scopes.RPC_VOICE_WRITE, OAuth2Scopes.RPC_VIDEO_READ, OAuth2Scopes.RPC_VIDEO_WRITE, OAuth2Scopes.RPC_SCREENSHARE_READ, OAuth2Scopes.RPC_SCREENSHARE_WRITE, OAuth2Scopes.RPC_ACTIVITIES_WRITE, OAuth2Scopes.APPLICATION_IDENTITIES_WRITE, OAuth2Scopes.MANAGED_PLATFORM_APPLICATION_IDENTITIES_WRITE, OAuth2Scopes.APPLICATIONS_BUILDS_UPLOAD, OAuth2Scopes.APPLICATIONS_BUILDS_READ, OAuth2Scopes.APPLICATIONS_COMMANDS, OAuth2Scopes.APPLICATIONS_COMMANDS_UPDATE, OAuth2Scopes.APPLICATIONS_COMMANDS_PERMISSIONS_UPDATE, OAuth2Scopes.APPLICATIONS_STORE_UPDATE, OAuth2Scopes.APPLICATIONS_ENTITLEMENTS, OAuth2Scopes.ACTIVITIES_INVITES_WRITE, OAuth2Scopes.ACTIVITIES_READ, OAuth2Scopes.ACTIVITIES_WRITE, OAuth2Scopes.RELATIONSHIPS_READ, OAuth2Scopes.RELATIONSHIPS_WRITE, OAuth2Scopes.VOICE, OAuth2Scopes.DM_CHANNELS_READ, OAuth2Scopes.DM_CHANNELS_MESSAGES_READ, OAuth2Scopes.DM_CHANNELS_MESSAGES_WRITE, OAuth2Scopes.ROLE_CONNECTIONS_WRITE, OAuth2Scopes.PRESENCES_READ, OAuth2Scopes.PRESENCES_WRITE, OAuth2Scopes.GATEWAY_CONNECT, OAuth2Scopes.PAYMENT_SOURCES_COUNTRY_CODE, OAuth2Scopes.SDK_SOCIAL_LAYER_PRESENCE, OAuth2Scopes.SDK_SOCIAL_LAYER];
const r215 = r25.concat([OAuth2Scopes.WEBHOOK_INCOMING, OAuth2Scopes.BOT]);
export { r13 as FAKE_SCOPES };
export { r25 as OrderedAccountScopes };
export { r215 as ValidScopes };
export const RemovedScopes = ["rpc.api"];
export function getScopeNames(a0, a1) {
if (OAuth2Scopes.IDENTIFY === a0) {
return [intl.string(t.DD9KQh)];
}
if (OAuth2Scopes.IDENTIFY_PREMIUM === a0) {
return [intl.string(t.xhQsxx)];
}
if (OAuth2Scopes.OPENID === a0) {
return [intl.string(t.R5IKv1)];
}
if (OAuth2Scopes.EMAIL === a0) {
return [intl.string(t.rvFS2t)];
}
if (OAuth2Scopes.BOT === a0) {
return [intl.string(t.pRpdox)];
}
if (OAuth2Scopes.CONNECTIONS === a0) {
return [intl.string(t["1AwaU1"])];
}
if (OAuth2Scopes.MESSAGES_READ === a0) {
return [intl.string(t.jVXrHb)];
}
if (OAuth2Scopes.GUILDS === a0) {
return [intl.string(t.QKGJkC)];
}
if (OAuth2Scopes.GUILDS_JOIN === a0) {
return [intl.string(t.ETGDR9)];
}
if (OAuth2Scopes.GUILDS_MEMBERS_READ === a0) {
return a1.includes(OAuth2Scopes.VOICE) ? [intl.string(t.OSvmfH)] : [intl.string(t.o6M1aS)];
}
if (OAuth2Scopes.GUILDS_CHANNELS_READ === a0) {
return [intl.string(t.BWGAgt)];
}
if (OAuth2Scopes.GDM_JOIN === a0) {
return [intl.string(t["55B4wA"])];
}
if (OAuth2Scopes.RPC === a0) {
return [intl.string(t.EDBEeK)];
}
if (OAuth2Scopes.RPC_NOTIFICATIONS_READ === a0) {
return [intl.string(t["6kDHWV"])];
}
if (OAuth2Scopes.RPC_VOICE_WRITE === a0) {
return [intl.string(t["531s7c"])];
}
if (OAuth2Scopes.RPC_VIDEO_READ === a0) {
return [intl.string(t.zbUSWO)];
}
if (OAuth2Scopes.RPC_VIDEO_WRITE === a0) {
return [intl.string(t["y+MdAM"])];
}
if (OAuth2Scopes.RPC_SCREENSHARE_READ === a0) {
return [intl.string(t.b0i0CO)];
}
if (OAuth2Scopes.RPC_SCREENSHARE_WRITE === a0) {
return [intl.string(t["9Rmxux"])];
}
if (OAuth2Scopes.RPC_VOICE_READ === a0) {
return [intl.string(t.rznmpz)];
}
if (OAuth2Scopes.RPC_ACTIVITIES_WRITE === a0) {
return [intl.string(t.KQwJDf)];
}
if (OAuth2Scopes.APPLICATIONS_BUILDS_UPLOAD === a0) {
return [intl.string(t.Iwbtgk)];
}
if (OAuth2Scopes.APPLICATIONS_BUILDS_READ === a0) {
return [intl.string(t.ZkZCCW)];
}
if (OAuth2Scopes.APPLICATIONS_COMMANDS === a0) {
return [intl.string(t.H4q49X)];
}
if (OAuth2Scopes.APPLICATIONS_COMMANDS_UPDATE === a0) {
return [intl.string(t.mxeq6u)];
}
if (OAuth2Scopes.APPLICATIONS_COMMANDS_PERMISSIONS_UPDATE === a0) {
return [intl.string(t["7SIoW7"])];
}
if (OAuth2Scopes.APPLICATIONS_STORE_UPDATE === a0) {
return [intl.string(t["Rba/Xn"])];
}
if (OAuth2Scopes.APPLICATIONS_ENTITLEMENTS === a0) {
return [intl.string(t.xeNgGI)];
}
if (OAuth2Scopes.ACTIVITIES_READ === a0) {
return [intl.string(t["4+tSce"])];
}
if (OAuth2Scopes.ACTIVITIES_WRITE === a0) {
return [intl.string(t["6OsWXX"])];
}
if (OAuth2Scopes.RELATIONSHIPS_READ === a0) {
return [intl.string(t["521/7W"])];
}
if (OAuth2Scopes.RELATIONSHIPS_WRITE === a0) {
return [intl.string(t["qR/txQ"])];
}
if (OAuth2Scopes.VOICE === a0) {
return [intl.string(t.XK5zdO)];
}
if (OAuth2Scopes.DM_CHANNELS_READ === a0) {
return [intl.string(t.w8emlT)];
}
if (OAuth2Scopes.ROLE_CONNECTIONS_WRITE === a0) {
return [intl.string(t.Bv0wZj)];
}
if (OAuth2Scopes.PRESENCES_READ === a0) {
return [intl.string(t.JUWeyf)];
}
if (OAuth2Scopes.PRESENCES_WRITE === a0) {
return [intl.string(t.apHLwv)];
}
if (OAuth2Scopes.DM_CHANNELS_MESSAGES_READ === a0) {
return [intl.string(t.FHeB8p)];
}
if (OAuth2Scopes.DM_CHANNELS_MESSAGES_WRITE === a0) {
return [intl.string(t["mdh+xY"])];
}
if (OAuth2Scopes.GATEWAY_CONNECT === a0) {
return [intl.string(t["uJd+85"])];
}
if (OAuth2Scopes.PAYMENT_SOURCES_COUNTRY_CODE === a0) {
return [intl.string(t.hycwLK)];
}
if (OAuth2Scopes.ACTIVITIES_INVITES_WRITE === a0) {
return [intl.string(t.IM4Cje)];
}
if (OAuth2Scopes.APPLICATION_IDENTITIES_WRITE === a0) {
return [intl.string(t["1zioRF"])];
}
if (OAuth2Scopes.MANAGED_PLATFORM_APPLICATION_IDENTITIES_WRITE === a0) {
return [intl.string(t["4l1DWw"])];
}
if (OAuth2Scopes.SDK_SOCIAL_LAYER_PRESENCE === a0) {
const r263 = [intl.string(t.Pl1dTW), intl.string(t.mPRcyT), intl.string(t.F7J4NE), intl.string(t.syJLx9)];
if (!a1.includes(OAuth2Scopes.APPLICATION_IDENTITIES_WRITE)) {
r263.push(intl.string(t["1zioRF"]));
}
return r263;
}
if (OAuth2Scopes.SDK_SOCIAL_LAYER === a0) {
const r202 = [intl.string(t.Pl1dTW), intl.string(t["hc/+yg"]), intl.string(t.mPRcyT), intl.string(t.F7J4NE), intl.string(t["2wxXX9"])];
if (!a1.includes(OAuth2Scopes.APPLICATION_IDENTITIES_WRITE)) {
r202.push(intl.string(t["1zioRF"]));
}
return r202;
}
return [a0];
}
export function isSocialLayerUmbrellaScope(a0) {
return a0 === OAuth2Scopes.SDK_SOCIAL_LAYER_PRESENCE || a0 === OAuth2Scopes.SDK_SOCIAL_LAYER;
}
export function getSecurityMessage(a0) {
let r39;
L8: {
if (!a0.includes(OAuth2Scopes.DM_CHANNELS_MESSAGES_WRITE) && !a0.includes(OAuth2Scopes.SDK_SOCIAL_LAYER)) {
if (!a0.includes(OAuth2Scopes.MESSAGES_READ) && !a0.includes(OAuth2Scopes.DM_CHANNELS_MESSAGES_READ)) {
r39 = intl.format(t["TeL+Ct"], {});
break L8;
}
r39 = intl.format(t.Soy7jJ, {});
} else {
r39 = intl.format(t.o0GMBD, {});
}
}
return r39;
}
+6
View File
@@ -0,0 +1,6 @@
// Metro module 8958 (f8959).
const r8 = {
NONE: "none",
CONSENT: "consent"
};
export { r8 as OAuth2Prompts };