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

+143
View File
@@ -0,0 +1,143 @@
// Metro module 5759 (f5760).
import { useMemo, useState, useEffect } from "react";
import ConnectedAccountsStore from "../../stores/ConnectedAccountsStore";
import UserStore from "../../stores/UserStore";
import { PlatformTypes, ACTIVITY_PLATFORM_TYPES } from "../../Constants";
import { KeyboardKeysUpdated } from "../../_bundle/Module5760";
import Durations from "../../utils/Durations";
import { useStateFromStores } from "../../_bundle/Module589";
import { PlayStationVoiceExperiment } from "../game_console/PlayStationVoiceExperiment";
import Module12 from "../../_bundle/Module12";
import Platforms from "../../lib/Platforms";
function $mk76953($env) {
return (a0) => {
let r18;
const r3 = $env;
const type = a0.type;
const r2 = $env.$parent;
if (type === r2[8].PLAYSTATION_STAGING) {
r18 = r3[2];
} else {
const r11 = r3[1];
let r0 = r11 === void 0;
if (!r0) {
const r8 = r2[10][a0.type];
r0 = !(r8 == null ? void 0 : r8.includes(r11.id));
}
r18 = !r0;
if (r0) {
let r21 = !!r3[0];
if (!r21) {
const migrationData = a0.migrationData;
const r24 = migrationData == null ? void 0 : migrationData.getMigrationExperimentEnabled("ConnectionsHooks");
r21 = r24 ? !r24 : a0.enabled;
}
r18 = r21;
}
}
return r18;
};
}
let $mk76952 = function() {
return () => UserStore.getCurrentUser();
};
let env3587 = {};
const PlatformTypes2 = PlatformTypes;
const r36 = {};
r36[PlatformTypes2.INSTAGRAM] = ["1036753656588017764"];
const c3587_10 = r36;
const c3587_11 = new Map([[PlatformTypes2.INSTAGRAM, new Date(2023, 1, 18).getTime()]]);
const c3587_12 = 30 * Durations.Millis.DAY;
const c3587_13 = new Map([[PlatformTypes2.PLAYSTATION, 2], [PlatformTypes2.XBOX, 2], [PlatformTypes2.SPOTIFY, 1], [PlatformTypes2.STEAM, 1], [PlatformTypes2.TWITCH, 1]]);
export function usePlatformAllowed(a0) {
let env15098;
const r1 = env15098 = {
$parent: env3587
};
env15098[0] = a0.forUserProfile;
env15098[1] = void 0;
env15098[2] = void 0;
env15098[1] = useStateFromStores([UserStore], $mk76952());
env15098[2] = PlayStationVoiceExperiment.useConfig({
location: "f2f7ef_1"
}).allowPlayStationStaging;
return $mk76953(r1);
}
export function usePlatforms() {
let c15099_1, memo;
let env15100;
const stateFromStores = useStateFromStores([ConnectedAccountsStore], () => ConnectedAccountsStore.getAccounts());
const r15 = env15100 = {
$parent: env3587
};
env15100[0] = false;
env15100[1] = void 0;
env15100[2] = void 0;
env15100[1] = useStateFromStores([UserStore], $mk76952());
env15100[2] = PlayStationVoiceExperiment.useConfig({
location: "f2f7ef_1"
}).allowPlayStationStaging;
const r28 = $mk76953(r15);
c15099_1 = r28;
memo = useMemo(() => {
const set = new Set();
let c25599_0 = set;
stateFromStores.forEach((stateFromStore) => c25599_0.add(stateFromStore.type));
return set;
}, [stateFromStores]);
return useMemo(() => Module12.sortBy(Platforms.filter(c15099_1), [(a0) => {
let r8 = c3587_11.has(a0.type);
if (r8) {
const r11 = Date.now();
let r14 = c3587_11.get(a0.type);
if (r14 == null) {
r14 = 0;
}
r8 = r11 < r14 + c3587_12;
}
return !r8;
}, (a0) => memo.has(a0.type), (a0) => a0.hasMetadata, (a0) => !ACTIVITY_PLATFORM_TYPES.has(a0.type), (a0) => a0.name]), [memo, r28]);
}
export function useEmptyStatePlatforms() {
let env15102;
const r3 = env15102 = {
$parent: env3587
};
env15102[0] = false;
env15102[1] = useStateFromStores([UserStore], $mk76952());
env15102[2] = PlayStationVoiceExperiment.useConfig({
location: "f2f7ef_1"
}).allowPlayStationStaging;
const r21 = $mk76953(r3);
let c15101_0 = r21;
return useMemo(() => Module12.sortBy(Platforms.filter(c15101_0), [(a0) => {
let r7 = c3587_13.get(a0.type);
if (r7 == null) {
r7 = 0;
}
return -1 * r7;
}, (a0) => a0.name]), [r21]);
}
export function useLegacyPlatformType(a0) {
let handleKeyUp2;
const handleKeyDown2 = function handleKeyDown(a0) {
if (a0.key === KeyboardKeysUpdated.SHIFT) {
setState(true);
}
};
handleKeyUp2 = function handleKeyUp(a0) {
if (a0.key === KeyboardKeysUpdated.SHIFT) {
setState(false);
}
};
const [state, setState] = useState(false);
useEffect(() => {
window.addEventListener("keydown", handleKeyDown2);
window.addEventListener("keyup", handleKeyUp2);
return () => {
window.removeEventListener("keydown", handleKeyDown2);
window.removeEventListener("keyup", handleKeyUp2);
};
}, []);
return state ? a0 === PlatformTypes.TWITTER ? PlatformTypes.TWITTER_LEGACY : a0 : a0;
}
@@ -0,0 +1,79 @@
// Metro module 10022 (f10023).
import { Endpoints } from "../../Constants";
import { HTTP } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
import { requestMembersForRole } from "../guild_settings/GuildRoleMemberActionCreators";
export function fetchRoleConnectionsConfiguration(a0, a1) {
const roleId = a1;
HTTP.get({
url: Endpoints.GUILD_ROLE_CONNECTIONS_CONFIGURATION(a0, a1),
rejectWithError: true
}).then((result) => {
Dispatcher.dispatch({
type: "GUILD_ROLE_CONNECTIONS_CONFIGURATIONS_FETCH_SUCCESS",
roleId,
roleConnectionConfigurations: result.body.length > 0 ? result.body.map((a0) => a0.map((item) => ({
connectionType: item.connection_type,
connectionMetadataField: item.connection_metadata_field,
applicationId: item.application_id,
operator: item.operator,
value: item.value
}))) : []
});
}).catch(() => {});
}
export async function putRoleConnectionsConfigurations(c26601_0, c26601_1, c26601_2) {
let c26601_4;
let env30179;
c26601_4 = void 0;
const r10 = env30179 = {};
let c26601_3 = r10;
env30179[0] = c26601_0;
env30179[1] = c26601_1;
env30179[2] = void 0;
env30179[3] = void 0;
let body = c26601_2.map((a0) => a0.map((item) => ({
connection_type: item.connectionType,
connection_metadata_field: item.connectionMetadataField,
application_id: item.applicationId,
operator: item.operator,
value: item.value
})));
const r41 = {
url: Endpoints.GUILD_ROLE_CONNECTIONS_CONFIGURATION(c26601_0, c26601_1),
body: null,
oldFormErrors: true,
rejectWithError: false
};
if (body.length === 0) {
body = [];
}
r41.body = body;
env30179[2] = await HTTP.put(r41).then((result) => result.body.length > 0 ? result.body.map((item) => item.map((item) => ({
connectionType: item.connection_type,
connectionMetadataField: item.connection_metadata_field,
applicationId: item.application_id,
operator: item.operator,
value: item.value
}))) : []);
env30179[3] = await requestMembersForRole(env30179[0], env30179[1], false);
if (env30179[3] != null) {
Dispatcher.dispatch({
type: "GUILD_ROLE_MEMBER_COUNT_UPDATE",
guildId: env30179[0],
roleId: env30179[1],
count: env30179[3]
});
}
Dispatcher.dispatch({
type: "GUILD_ROLE_CONNECTIONS_CONFIGURATIONS_FETCH_SUCCESS",
roleId: env30179[1],
roleConnectionConfigurations: env30179[2]
});
}
export async function fetchUserApplicationRoleConnections() {
return (await HTTP.get({
url: Endpoints.APPLICATION_USER_ROLE_CONNECTIONS,
rejectWithError: false
})).body;
}
+330
View File
@@ -0,0 +1,330 @@
// Metro module 4996 (f4997).
import GuildRoleStore from "../../stores/GuildRoleStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import { MetadataFields, OperatorTypes } from "./Constants";
import { Permissions, PlatformTypes } from "../../Constants";
import URLUtils from "../../utils/URLUtils";
import Module38 from "../../_bundle/Module38";
import { t, intl } from "../../intl/index.native";
import Module12 from "../../_bundle/Module12";
import getConnectionsRoles from "../channel/getConnectionsRoles";
import { useStateFromStores } from "../../_bundle/Module589";
import { UNSAFE_isDismissibleContentDismissed } from "../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../_bundle/Module1358";
const r27 = {
AND: 0,
0: "AND",
OR: 1,
1: "OR"
};
export const officialApplicationIds = ["426537812993638400", "1042836142560645130", "296023718839451649", "979802510766268446", "1031611223235637258", "512333785338216465"];
export { r27 as ConnectionConfigurationRuleOperator };
export function getCallbackParamsFromURL(a0) {
let r17 = URLUtils.toURLSafe(a0);
if (r17 == null) {
r17 = {
searchParams: new URLSearchParams()
};
}
const r27 = Object.fromEntries(r17.searchParams);
const { code, state, error, error_description } = r27;
Module38(!Array.isArray(code), "Received multiple query param values for code");
Module38(!Array.isArray(state), "Received multiple query param values for state");
Module38(!Array.isArray(error), "Received multiple query param values for error");
Module38(!Array.isArray(error_description), "Received multiple query param values for error_description");
return {
code,
state,
error,
errorDescription: error_description
};
}
export function getConnectionsCheckText(a0) {
let r26, connectionMetadataField, connectionType, operator, operatorText;
let days;
L14: {
connectionType = a0.connectionType;
connectionMetadataField = a0.connectionMetadataField;
operator = a0.operator;
operatorText = a0.operatorText;
const value = a0.value;
days = void 0;
days = Math.round(Number(value));
if (OperatorTypes.EQUAL === operator) {
const H97H4S = t.H97H4S;
r26 = connectionType === PlatformTypes.PAYPAL && connectionMetadataField === MetadataFields.PAYPAL_VERIFIED ? t["N95b+f"] : H97H4S;
} else if (OperatorTypes.NOT_EQUAL === operator) {
r26 = t["D9B/q2"];
} else if (OperatorTypes.LESS_THAN === operator) {
r26 = t["3ru8/N"];
days = Math.max(0, days - 1);
} else {
if (OperatorTypes.GREATER_THAN !== operator) {
if (operator !== void 0) {
r26 = null;
if (operator !== null) {
break L14;
}
}
return null;
}
r26 = t.wCVDHn;
days = Math.max(0, days + 1);
}
}
if (operatorText != null) {
r26 = operatorText;
}
let r65 = r26;
if (r65 != null) {
r65 = r26;
if (operator != null) {
if (PlatformTypes.REDDIT === connectionType) {
if (MetadataFields.CREATED_AT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
days
})
});
} else if (MetadataFields.REDDIT_TOTAL_KARMA === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.P2JAEc, {
karma: days
})
});
} else if (MetadataFields.REDDIT_GOLD === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.string(t["+/5TCx"])
});
} else {
if (MetadataFields.REDDIT_MOD !== connectionMetadataField) {
return null;
}
r65 = intl.format(r26, {
platformQuantityHook: () => intl.string(t["9rPbEs"])
});
}
} else if (PlatformTypes.STEAM === connectionType) {
if (MetadataFields.CREATED_AT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
days
})
});
} else if (MetadataFields.STEAM_GAME_COUNT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.H9eLoe, {
count: days
})
});
} else if (MetadataFields.STEAM_ITEM_COUNT_TF2 === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.MceZJ6, {
count: days
})
});
} else {
if (MetadataFields.STEAM_ITEM_COUNT_DOTA2 !== connectionMetadataField) {
return null;
}
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.dMnRar, {
count: days
})
});
}
} else if (PlatformTypes.BLUESKY === connectionType) {
if (MetadataFields.CREATED_AT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
days
})
});
} else if (MetadataFields.BLUESKY_FOLLOWERS_COUNT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.xIdKU8, {
count: days
})
});
} else {
if (MetadataFields.BLUESKY_STATUSES_COUNT !== connectionMetadataField) {
return null;
}
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t["dy3+NR"], {
count: days
})
});
}
} else if (PlatformTypes.TWITTER === connectionType) {
if (MetadataFields.CREATED_AT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
days
})
});
} else if (MetadataFields.TWITTER_VERIFIED === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.string(t.xRygZL)
});
} else if (MetadataFields.TWITTER_FOLLOWERS_COUNT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.bkajar, {
count: days
})
});
} else {
if (MetadataFields.TWITTER_STATUSES_COUNT !== connectionMetadataField) {
return null;
}
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.MI7NKi, {
count: days
})
});
}
} else if (PlatformTypes.PAYPAL === connectionType) {
if (MetadataFields.CREATED_AT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
days
})
});
} else {
if (MetadataFields.PAYPAL_VERIFIED !== connectionMetadataField) {
return null;
}
r65 = intl.format(r26, {
platformQuantityHook: () => intl.string(t.slSQuB)
});
}
} else if (PlatformTypes.EBAY === connectionType) {
if (MetadataFields.CREATED_AT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.TPbtEu, {
days
})
});
} else if (MetadataFields.EBAY_TOP_RATED_SELLER === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.string(t.TEEYwa)
});
} else if (MetadataFields.EBAY_POSITIVE_FEEDBACK_PERCENTAGE === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.rl9Vgy, {
value: days
})
});
} else if (MetadataFields.EBAY_UNIQUE_POSITIVE_FEEDBACK_COUNT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.QP5W1R, {
count: days
})
});
} else {
if (MetadataFields.EBAY_UNIQUE_NEGATIVE_FEEDBACK_COUNT !== connectionMetadataField) {
return null;
}
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t["6ZFYdK"], {
count: days
})
});
}
} else {
if (PlatformTypes.TIKTOK !== connectionType) {
return null;
}
if (MetadataFields.TIKTOK_VERIFIED === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.string(t.uv7ety)
});
} else if (MetadataFields.TIKTOK_FOLLOWER_COUNT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.qIPDRy, {
count: days
})
});
} else if (MetadataFields.TIKTOK_FOLLOWING_COUNT === connectionMetadataField) {
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t.zRta4X, {
count: days
})
});
} else {
if (MetadataFields.TIKTOK_LIKES_COUNT !== connectionMetadataField) {
return null;
}
r65 = intl.format(r26, {
platformQuantityHook: () => intl.formatToPlainString(t["ar0WW+"], {
count: days
})
});
}
}
}
}
return r65;
}
export function isVerifiedRolesChannelVisible(a0) {
return a0.some((item) => item.tags.guild_connections === null);
}
export function getVisibleConnectionsRole(a0) {
let r33;
const guildMember = a0.guildMember;
let guild = a0.guild;
let sortedGuildRoles = a0.sortedGuildRoles;
const { channel, onlyChannelConnectionRoles = false } = a0;
if (guildMember == null) {
return null;
}
if (guild == null && channel != null) {
guild = GuildStore.getGuild(channel.getGuildId());
}
if (guild == null) {
return null;
}
const id = guild.id;
if (sortedGuildRoles == null) {
sortedGuildRoles = GuildRoleStore.getSortedRoles(id);
}
const r22 = sortedGuildRoles.filter((sortedGuildRole) => sortedGuildRole.tags.guild_connections === null && guildMember.roles.includes(sortedGuildRole.id));
const r31 = Module12.intersection(r22, getConnectionsRoles(channel));
if (r31.length > 0) {
let r35 = r31[0];
if (r35 == null) {
r35 = null;
}
r33 = r35;
} else {
r33 = null;
if (!onlyChannelConnectionRoles) {
let r34 = r22[0];
if (r34 == null) {
r34 = null;
}
r33 = r34;
}
}
return r33;
}
export function getCreatedAtDate(a0, a1) {
if (a0 != null && a0 !== "") {
const date = new Date(a0);
return date instanceof Date ? isNaN(date.getTime()) ? null : date.toLocaleDateString(a1, {
month: "short",
day: "numeric",
year: "numeric"
}) : null;
}
return null;
}
export function useShowLinkedRolesAdminNux(c14498_0) {
return useStateFromStores([GuildRoleStore, PermissionStore], () => {
const r12 = GuildRoleStore.getSortedRoles(c14498_0.id).some((item) => item.tags.guild_connections === null);
const r20 = UNSAFE_isDismissibleContentDismissed(DismissibleContent.CONNECTIONS_NUX);
const r25 = PermissionStore.can(Permissions.MANAGE_ROLES, c14498_0);
return (r12 ? !r12 : r20) && r25;
});
}
+57
View File
@@ -0,0 +1,57 @@
// Metro module 4997 (f4998).
const r14 = {
EQUAL: 1,
1: "EQUAL",
NOT_EQUAL: 2,
2: "NOT_EQUAL",
LESS_THAN: 3,
3: "LESS_THAN",
GREATER_THAN: 4,
4: "GREATER_THAN"
};
const r19 = {
CREATED_AT: "created_at",
REDDIT_TOTAL_KARMA: "total_karma",
REDDIT_GOLD: "gold",
REDDIT_MOD: "mod",
BLUESKY_FOLLOWERS_COUNT: "followers_count",
BLUESKY_STATUSES_COUNT: "statuses_count",
STEAM_GAME_COUNT: "game_count",
STEAM_ITEM_COUNT_TF2: "item_count_tf2",
STEAM_ITEM_COUNT_DOTA2: "item_count_dota2",
TWITTER_VERIFIED: "verified",
TWITTER_FOLLOWERS_COUNT: "followers_count",
TWITTER_STATUSES_COUNT: "statuses_count",
PAYPAL_VERIFIED: "verified",
EBAY_POSITIVE_FEEDBACK_PERCENTAGE: "positive_feedback_percentage",
EBAY_TOP_RATED_SELLER: "top_rated_seller",
EBAY_UNIQUE_NEGATIVE_FEEDBACK_COUNT: "unique_negative_feedback_count",
EBAY_UNIQUE_POSITIVE_FEEDBACK_COUNT: "unique_positive_feedback_count",
TIKTOK_VERIFIED: "verified",
TIKTOK_FOLLOWER_COUNT: "follower_count",
TIKTOK_FOLLOWING_COUNT: "following_count",
TIKTOK_LIKES_COUNT: "likes_count"
};
const r36 = {
INTEGER_LESS_THAN_EQUAL: 1,
1: "INTEGER_LESS_THAN_EQUAL",
INTEGER_GREATER_THAN_EQUAL: 2,
2: "INTEGER_GREATER_THAN_EQUAL",
INTEGER_EQUAL: 3,
3: "INTEGER_EQUAL",
INTEGER_NOT_EQUAL: 4,
4: "INTEGER_NOT_EQUAL",
DATETIME_LESS_THAN_EQUAL: 5,
5: "DATETIME_LESS_THAN_EQUAL",
DATETIME_GREATER_THAN_EQUAL: 6,
6: "DATETIME_GREATER_THAN_EQUAL",
BOOLEAN_EQUAL: 7,
7: "BOOLEAN_EQUAL",
BOOLEAN_NOT_EQUAL: 8,
8: "BOOLEAN_NOT_EQUAL"
};
export { r14 as OperatorTypes };
export { r19 as MetadataFields };
export const GUILD_ROLE_CONNECTION_APPLICATION_CONNECTION_TYPE = "application";
export const GUILD_ROLE_CONNECTION_APPLICATION_IDENTITY_CONNECTION_TYPE = "application_identity";
export { r36 as MetadataItemTypes };
@@ -0,0 +1,6 @@
// Metro module 8173 (f8174).
import { OAuth2Scopes } from "../../_bundle/Module8174";
const r14 = [OAuth2Scopes.ACTIVITIES_WRITE, OAuth2Scopes.EMAIL, OAuth2Scopes.IDENTIFY];
export const CRUNCHYROLL_LINK_DEST_ORIGIN = "https://crunchyroll.com";
export const CRUNCHYROLL_CLIENT_ID = "981509069309354054";
export { r14 as CRUNCHYROLL_CLIENT_SCOPES };
@@ -0,0 +1,8 @@
// Metro module 9000 (f9001).
export const EXAMPLE_DOMAIN = "example.com";
export function getDnsName(a0) {
return `_discord.${a0}`;
}
export function getHttpName(a0) {
return `https://${a0}/.well-known/discord`;
}
@@ -0,0 +1,11 @@
// Metro module 9002 (f9003).
import { PlatformTypes } from "../../Constants";
export function validateHandle(a0, a1) {
if (a1 === PlatformTypes.MASTODON) {
/^@?[a-z0-9_]+([.-]+[a-z0-9_]+)*@[^@]+\.[^.@]{2,}$/i.test(a0);
}
return /^.+\.[^.@]{2,}$/.test(a0);
}
export function getExampleHandle(a0) {
return a0 !== PlatformTypes.MASTODON ? a0 === PlatformTypes.BLUESKY ? "example.bsky.social" : "[email protected]" : "@[email protected]";
}
@@ -0,0 +1,16 @@
// Metro module 11010 (f11011).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c7419_0 = new Map();
class GuildRoleConnectionEligibilityStore extends Module589.Store {
static displayName = "GuildRoleConnectionEligibilityStore";
getGuildRoleConnectionEligibility(a0) {
return a0 != null ? c7419_0.get(a0) : void 0;
}
}
const guildRoleConnectionEligibilityStore = new GuildRoleConnectionEligibilityStore(Dispatcher, {
GUILD_ROLE_CONNECTION_ELIGIBILITY_FETCH_SUCCESS: function handleFetchSuccess(a0) {
c7419_0.set(a0.roleId, a0.roleConnectionEligibility);
}
});
export default guildRoleConnectionEligibilityStore;
@@ -0,0 +1,20 @@
// Metro module 16450 (f16451).
import GuildStore from "../../stores/GuildStore";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c11837_1 = new Map();
class GuildRoleConnectionsConfigurationStore extends Module589.Store {
static displayName = "GuildRoleConnectionsConfigurationStore";
initialize() {
this.waitFor(GuildStore);
}
getGuildRoleConnectionsConfiguration(a0) {
return c11837_1.get(a0);
}
}
const guildRoleConnectionsConfigurationStore = new GuildRoleConnectionsConfigurationStore(Dispatcher, {
GUILD_ROLE_CONNECTIONS_CONFIGURATIONS_FETCH_SUCCESS: function handleFetchSuccess(a0) {
c11837_1.set(a0.roleId, a0.roleConnectionConfigurations);
}
});
export default guildRoleConnectionsConfigurationStore;
@@ -0,0 +1,45 @@
// Metro module 16477 (f16478).
import { OperatorTypes } from "./Constants";
export function realizedOperatorFor(a0) {
return a0 == null ? OperatorTypes.GREATER_THAN : a0;
}
export function displayedValueFor(a0, a1) {
let r9 = a0;
const r8 = Math;
const r3 = Number;
if (a0 == null) {
r9 = 0;
}
const r12 = r8.round(r3(r9));
if (OperatorTypes.GREATER_THAN === a1) {
return Math.max(1, r12 + 1);
}
if (OperatorTypes.LESS_THAN === a1) {
return Math.max(0, r12 - 1);
}
return r12;
}
export function storedValueFor(a0, a1) {
let r9 = a0;
const r8 = Math;
const r5 = Number;
if (a0 == null) {
r9 = 0;
}
const r12 = r8.round(r5(r9));
if (OperatorTypes.GREATER_THAN === a1) {
return Math.max(0, r12 - 1).toString();
}
if (OperatorTypes.LESS_THAN === a1) {
return Math.max(1, r12 + 1).toString();
}
return r12.toString();
}
export function minDisplayedValueFor(a0) {
if (OperatorTypes.GREATER_THAN === a0) {
return 1;
}
if (OperatorTypes.LESS_THAN === a0) {
return 0;
}
}
@@ -0,0 +1,144 @@
// Metro module 8965 (f8966).
import { GUILD_ROLE_CONNECTION_APPLICATION_CONNECTION_TYPE } from "./Constants";
import { PlatformTypes } from "../../Constants";
import Dispatcher from "../../Dispatcher";
import ActionSheetActionCreators from "../action_sheet/native/ActionSheetActionCreators";
import XboxLinkModalActionCreators from "../user_settings/connections/native/two_way_link/xbox/XboxLinkModalActionCreators";
import PlayStationLinkModalActionCreators from "../user_settings/connections/native/two_way_link/playstation/PlayStationLinkModalActionCreators";
import CrunchyrollLinkModalActionCreators from "../user_settings/connections/native/two_way_link/crunchyroll/CrunchyrollLinkModalActionCreators";
import ModalActionCreators from "../../actions/ModalActionCreators";
import Platforms from "../../lib/Platforms";
import { handleClick } from "../../utils/MaskedLinkUtils";
import Linking from "../../lib/native/Linking";
import ConnectedAccountsActionCreators from "../../actions/ConnectedAccountsActionCreators";
function $mk106153($env) {
return function handleModalClose() {
const r5 = $env.$parent[0];
if (r5 != null) {
r5();
}
const r8 = $env;
const r2 = $env.$parent.$parent;
(0, r2[1])(r2[2][2]).unsubscribe("MODAL_POP", r8[0]);
};
}
let env5865 = {};
export default function authorizeConnection(a0) {
let env16893;
const r3 = env16893 = {
$parent: env5865
};
let platformType = a0.platformType;
let location2 = a0.location;
const onClose = a0.onClose;
env16893[0] = onClose;
const overrideUrl = a0.overrideUrl;
env16893[1] = overrideUrl;
const successRedirect = a0.successRedirect;
if (platformType === PlatformTypes.LEAGUE_OF_LEGENDS) {
platformType = PlatformTypes.RIOT_GAMES;
}
if (location2 == null) {
location2 = "mobile";
}
L26: {
if (platformType === PlatformTypes.XBOX) {
ActionSheetActionCreators.hideActionSheet();
XboxLinkModalActionCreators.showModal([location2]);
if (onClose != null) {
let env16898;
const r140 = env16898 = {
$parent: r3
};
const r144 = $mk106153(r140);
env16898[0] = r144;
Dispatcher.subscribe("MODAL_POP", r144);
}
} else {
if (platformType !== PlatformTypes.PLAYSTATION && platformType !== PlatformTypes.PLAYSTATION_STAGING) {
if (platformType === PlatformTypes.CRUNCHYROLL) {
ActionSheetActionCreators.hideActionSheet();
CrunchyrollLinkModalActionCreators.showModal([location2]);
if (onClose == null) {
break L26;
}
let env16896;
const r102 = env16896 = {
$parent: r3
};
const r106 = $mk106153(r102);
env16896[0] = r106;
Dispatcher.subscribe("MODAL_POP", r106);
break L26;
}
if (platformType === PlatformTypes.DOMAIN) {
ActionSheetActionCreators.hideActionSheet();
ModalActionCreators.pushLazy(import("./native/DomainVerifyModal"), {
locationStack: [location2]
});
if (onClose == null) {
break L26;
}
let env16895;
const r83 = env16895 = {
$parent: r3
};
const r87 = $mk106153(r83);
env16895[0] = r87;
Dispatcher.subscribe("MODAL_POP", r87);
break L26;
}
if (Platforms.get(platformType)?.isFederated === true) {
ActionSheetActionCreators.hideActionSheet();
ModalActionCreators.pushLazy(import("./native/FederatedSocialModal"), {
platformType,
location: location2,
successRedirect
});
if (onClose == null) {
break L26;
}
let env16894;
const r57 = env16894 = {
$parent: r3
};
const r61 = $mk106153(r57);
env16894[0] = r61;
Dispatcher.subscribe("MODAL_POP", r61);
break L26;
}
if (overrideUrl != null && platformType === GUILD_ROLE_CONNECTION_APPLICATION_CONNECTION_TYPE) {
handleClick({
shouldConfirm: true,
href: overrideUrl,
onConfirm: () => {
Linking.openURL(env16893[1]);
}
});
break L26;
}
ConnectedAccountsActionCreators.authorize(platformType, {
location: location2,
successRedirect
}).then((result) => {
const url = result.body.url;
if (url != null) {
Linking.openURL(url);
}
});
break L26;
}
ActionSheetActionCreators.hideActionSheet();
PlayStationLinkModalActionCreators.showModal([location2], platformType);
if (onClose != null) {
let env16897;
const r121 = env16897 = {
$parent: r3
};
const r125 = $mk106153(r121);
env16897[0] = r125;
Dispatcher.subscribe("MODAL_POP", r125);
}
}
}
};
@@ -0,0 +1,26 @@
// Metro module 16481 (f16482).
import { createExperiment } from "../../experiments/index";
const experiment = createExperiment({
kind: "guild",
id: "2026-04_application_identity_linked_roles",
label: "Application Identity Linked Roles",
defaultConfig: {
enabled: false
},
treatments: [{
id: 1,
label: "Enable Application Identity Linked Roles",
config: {
enabled: true
}
}]
});
export { experiment as ApplicationIdentityLinkedRolesExperiment };
export function useApplicationIdentityLinkedRolesEnabled(a0, a1) {
return experiment.useExperiment({
guildId: a0,
location: a1
}, {
autoTrackExposure: false
}).enabled;
}
@@ -0,0 +1,286 @@
// Metro module 10024 (f10025).
import { View } from "react-native";
import { MetadataFields, MetadataItemTypes } from "../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { intl, t } from "../../../intl/index.native";
import Module10025 from "../../../_bundle/Module10025";
import Module10026 from "../../../_bundle/Module10026";
import Module12 from "../../../_bundle/Module12";
import { shortenAndLocalizeNumber } from "../../../utils/NumberUtils";
import { Text } from "../../../design/components/Text/native/Text";
import { Icon } from "../../../design/void/native";
import { getCreatedAtDate } from "../ConnectionsUtils";
let useStyles, VanityMetric, VanityItem, VanityTag, VanityDate;
const PaypalVanityTag = function PaypalVanityTag(props) {
const style = props.style;
const styles = useStyles();
return <VanityTag key={MetadataFields.PAYPAL_VERIFIED} style={[styles.paypalVerifiedTag, style]} label={intl.string(t.IhXLyx)} textStyle={styles.paypalVerifiedTagText} />;
};
VanityMetric = function VanityMetric(props) {
const { count, label, style, percent } = props;
const styles = useStyles();
const value = shortenAndLocalizeNumber(count) + (percent ? "%" : "");
return <Text variant="text-xs/normal" color="text-muted" style={[styles.connectedAccountVanityMetadata, style]}>
{typeof label === "string" ? intl.format(t.HLoinF, {
name: label,
value
}) : intl.format(label, {
value
})}
</Text>;
};
VanityItem = function VanityItem(props) {
const { label, imageSrc, imageAlt, style } = props;
const styles = useStyles();
return <View style={[styles.connectedAccountVanityMetadata, styles.connectedAccountVanityMetadataItem, style]}>
<Icon source={imageSrc} accessibilityLabel={imageAlt} style={styles.connectedAccountVanityMetadataItemIcon} disableColor />
<Text variant="text-xs/normal" color="text-muted" style={style}>{label}</Text>
</View>;
};
VanityTag = function VanityTag(props) {
const { label, style, textStyle } = props;
const styles = useStyles();
return <View style={[styles.connectedAccountVanityMetadata, styles.connectedAccountVanityMetadataTag, style]}>
<Text variant="text-xs/normal" color="text-muted" style={textStyle}>{label}</Text>
</View>;
};
VanityDate = function VanityDate(props) {
const { date, label, locale, style } = props;
return <Text variant="text-xs/normal" color="text-muted" style={[useStyles().connectedAccountVanityMetadata, style]}>
{intl.format(t.HLoinF, {
value: getCreatedAtDate(date, locale),
name: label
})}
</Text>;
};
useStyles = createStyles({
connectedAccountVanityMetadata: {
marginTop: 4,
paddingRight: 8
},
connectedAccountVanityMetadataItem: {
flexDirection: "row",
alignItems: "center"
},
connectedAccountVanityMetadataItemIcon: {
height: 18,
width: 18,
marginRight: 8
},
connectedAccountVanityMetadataTag: {
backgroundColor: Module712.colors.BORDER_SUBTLE,
borderRadius: Module712.radii.md,
paddingHorizontal: 8,
paddingVertical: 1,
marginRight: 8
},
paypalVerifiedTag: {
backgroundColor: Module712.colors.STATUS_POSITIVE_BACKGROUND
},
paypalVerifiedTagText: {
color: Module712.colors.WHITE
}
});
export function generateRedditMetadataItems(a0, style = void 0) {
const r6 = Number;
let r5 = a0[MetadataFields.REDDIT_TOTAL_KARMA];
if (r5 == null) {
r5 = -1;
}
const r18 = [];
const count = r6(r5);
const r7 = a0[MetadataFields.REDDIT_GOLD];
const r22 = a0[MetadataFields.REDDIT_MOD];
if (count > -1) {
r18.push(<VanityMetric key={MetadataFields.REDDIT_TOTAL_KARMA} style={style} count={count} label={t.SbCNox} />);
}
if (r7 === "1") {
r18.push(<VanityTag key={MetadataFields.REDDIT_GOLD} style={style} label={intl.string(t["06rDHU"])} />);
}
if (r22 === "1") {
r18.push(<VanityTag key={MetadataFields.REDDIT_MOD} style={style} label={intl.string(t.oWM95M)} />);
}
return r18;
}
export function generateTwitterMetadataItems(a0, style = void 0) {
const r7 = Number;
let r14 = a0[MetadataFields.TWITTER_STATUSES_COUNT];
if (r14 == null) {
r14 = -1;
}
const count2 = r7(r14);
const r16 = Number;
let r18 = a0[MetadataFields.TWITTER_FOLLOWERS_COUNT];
if (r18 == null) {
r18 = -1;
}
const r19 = [];
const count = r16(r18);
if (count2 > -1) {
r19.push(<VanityMetric key={MetadataFields.TWITTER_STATUSES_COUNT} style={style} count={count2} label={t.llwqqe} />);
}
if (count > -1) {
r19.push(<VanityMetric key={MetadataFields.TWITTER_FOLLOWERS_COUNT} style={style} count={count} label={t.LMNOUQ} />);
}
return r19;
}
export function generateBlueskyMetadataItems(a0, style = void 0) {
const r7 = Number;
let r14 = a0[MetadataFields.BLUESKY_STATUSES_COUNT];
if (r14 == null) {
r14 = -1;
}
const count2 = r7(r14);
const r16 = Number;
let r18 = a0[MetadataFields.BLUESKY_FOLLOWERS_COUNT];
if (r18 == null) {
r18 = -1;
}
const r19 = [];
const count = r16(r18);
if (count2 > -1) {
r19.push(<VanityMetric key={MetadataFields.BLUESKY_STATUSES_COUNT} style={style} count={count2} label={t.thA2ir} />);
}
if (count > -1) {
r19.push(<VanityMetric key={MetadataFields.BLUESKY_FOLLOWERS_COUNT} style={style} count={count} label={t.RQath2} />);
}
return r19;
}
export function generateSteamMetadataItems(a0, style = void 0) {
const r7 = Number;
let r19 = a0[MetadataFields.STEAM_GAME_COUNT];
if (r19 == null) {
r19 = -1;
}
const count3 = r7(r19);
const r8 = Number;
let r22 = a0[MetadataFields.STEAM_ITEM_COUNT_DOTA2];
if (r22 == null) {
r22 = -1;
}
const count2 = r8(r22);
const r23 = Number;
let r25 = a0[MetadataFields.STEAM_ITEM_COUNT_TF2];
if (r25 == null) {
r25 = -1;
}
const r26 = [];
const count = r23(r25);
if (count3 > -1) {
r26.push(<VanityMetric key={MetadataFields.STEAM_GAME_COUNT} style={style} count={count3} label={t["ppXMu/"]} />);
}
if (count2 > -1) {
r26.push(<VanityItem key={MetadataFields.STEAM_ITEM_COUNT_DOTA2} style={style} label={intl.format(t.Y88M5x, {
count: count2
})} imageSrc={Module10025} imageAlt={intl.string(t.HKUEZo)} />);
}
if (count > -1) {
r26.push(<VanityItem key={MetadataFields.STEAM_ITEM_COUNT_TF2} style={style} label={intl.format(t.Y88M5x, {
count
})} imageSrc={Module10026} imageAlt={intl.string(t.C8p1Sh)} />);
}
return r26;
}
export function generatePaypalMetadataItems(a0, style = void 0) {
const r1 = [];
if (a0[MetadataFields.PAYPAL_VERIFIED] === "1") {
r1.push(<PaypalVanityTag style={style} />);
}
return r1;
}
export function generateEbayMetadataItems(a0, style = void 0) {
const r6 = Number;
let r5 = a0[MetadataFields.EBAY_POSITIVE_FEEDBACK_PERCENTAGE];
if (r5 == null) {
r5 = -1;
}
const r15 = [];
const count = r6(r5);
const r18 = a0[MetadataFields.EBAY_TOP_RATED_SELLER];
if (count > 0) {
r15.push(<VanityMetric key={MetadataFields.EBAY_POSITIVE_FEEDBACK_PERCENTAGE} style={style} count={count} label={t.YmL22d} percent />);
}
if (r18 === "1") {
r15.push(<VanityTag key={MetadataFields.EBAY_TOP_RATED_SELLER} style={style} label={intl.string(t.TEEYwa)} />);
}
return r15;
}
export function generateTikTokMetadataItems(a0, style = void 0) {
const r6 = a0[MetadataFields.TIKTOK_VERIFIED];
const r8 = Number;
let r17 = a0[MetadataFields.TIKTOK_FOLLOWER_COUNT];
if (r17 == null) {
r17 = -1;
}
const count = r8(r17);
const r11 = Number;
let r20 = a0[MetadataFields.TIKTOK_FOLLOWING_COUNT];
if (r20 == null) {
r20 = -1;
}
const count2 = r11(r20);
const r22 = Number;
let r24 = a0[MetadataFields.TIKTOK_LIKES_COUNT];
if (r24 == null) {
r24 = -1;
}
const r25 = [];
const count3 = r22(r24);
if (count > -1) {
r25.push(<VanityMetric key={MetadataFields.TIKTOK_FOLLOWER_COUNT} style={style} count={count} label={t["Mpm/Bc"]} />);
}
if (count2 > -1) {
r25.push(<VanityMetric key={MetadataFields.TIKTOK_FOLLOWING_COUNT} style={style} count={count2} label={t.ftf12v} />);
}
if (count3 > -1) {
r25.push(<VanityMetric key={MetadataFields.TIKTOK_LIKES_COUNT} style={style} count={count3} label={t.Qwhe5j} />);
}
if (r6 === "1") {
r25.push(<VanityTag key={MetadataFields.TIKTOK_VERIFIED} style={style} label={intl.string(t.QHHwRR)} />);
}
return r25;
}
export function generateRoleConnectionMetadataItems(a0) {
let c17638_0 = a0;
let style = arguments[1];
if (style === void 0) {
style = void 0;
}
let locale = arguments[2];
if (locale === void 0) {
locale = void 0;
}
const r0 = [];
const r14 = Object.keys(a0.metadata);
if (a0.application_metadata != null && Object.keys(a0.application_metadata).length !== 0 && r14.length !== 0) {
for (const item of Module12.sortBy(r14, (a0) => {
const application_metadata = c17638_0.application_metadata;
return application_metadata == null ? void 0 : application_metadata[a0]?.name;
})) {
const r58 = a0.application_metadata[item];
if (r58 != null) {
const date = a0.metadata[item];
try {
const type = r58.type;
if (MetadataItemTypes.BOOLEAN_EQUAL !== type && MetadataItemTypes.BOOLEAN_NOT_EQUAL !== type) {
if (MetadataItemTypes.DATETIME_GREATER_THAN_EQUAL !== type && MetadataItemTypes.DATETIME_LESS_THAN_EQUAL !== type) {
if (MetadataItemTypes.INTEGER_EQUAL !== type && MetadataItemTypes.INTEGER_NOT_EQUAL !== type && MetadataItemTypes.INTEGER_GREATER_THAN_EQUAL !== type && MetadataItemTypes.INTEGER_LESS_THAN_EQUAL !== type) {
continue;
}
r0.push(<VanityMetric key={r58.key} style={style} count={Number(date)} label={r58.name} />);
continue;
}
r0.push(<VanityDate key={r58.key} style={style} date={date} locale={locale} label={r58.name} />);
continue;
}
if (r58.type === MetadataItemTypes.BOOLEAN_EQUAL && date === "1" || r58.type === MetadataItemTypes.BOOLEAN_NOT_EQUAL && date !== "1") {
r0.push(<VanityTag key={r58.key} style={style} label={r58.name} />);
}
} catch ($e) {}
}
}
return r0;
}
return r0;
}
@@ -0,0 +1,26 @@
// Metro module 13992 (f13993).
import { PlatformTypes } from "../../../Constants";
import Module712 from "../../../_bundle/Module712";
const r15 = {};
r15[PlatformTypes.CRUNCHYROLL] = Module712.unsafe_rawColors.PLATFORM_CRUNCHYROLL;
r15[PlatformTypes.PLAYSTATION_STAGING] = Module712.unsafe_rawColors.PLATFORM_PLAYSTATION;
r15[PlatformTypes.PLAYSTATION] = Module712.unsafe_rawColors.PLATFORM_PLAYSTATION;
r15[PlatformTypes.GITHUB] = Module712.unsafe_rawColors.PLATFORM_GITHUB;
r15[PlatformTypes.SAMSUNG] = Module712.unsafe_rawColors.PLATFORM_SAMSUNG;
r15[PlatformTypes.XBOX] = Module712.unsafe_rawColors.PLATFORM_XBOX;
r15[PlatformTypes.SPOTIFY] = Module712.unsafe_rawColors.PLATFORM_SPOTIFY;
r15[PlatformTypes.TWITTER_LEGACY] = Module712.unsafe_rawColors.PLATFORM_TWITTER;
r15[PlatformTypes.TWITTER] = Module712.unsafe_rawColors.PLATFORM_TWITTER;
r15[PlatformTypes.FACEBOOK] = Module712.unsafe_rawColors.PLATFORM_FACEBOOK;
r15[PlatformTypes.REDDIT] = Module712.unsafe_rawColors.PLATFORM_REDDIT;
r15[PlatformTypes.STEAM] = Module712.unsafe_rawColors.PLATFORM_STEAM;
r15[PlatformTypes.LEAGUE_OF_LEGENDS] = Module712.unsafe_rawColors.PLATFORM_LOL;
r15[PlatformTypes.SKYPE] = Module712.unsafe_rawColors.PLATFORM_SKYPE;
r15[PlatformTypes.BUNGIE] = Module712.unsafe_rawColors.PLATFORM_BUNGIE;
r15[PlatformTypes.BATTLENET] = Module712.unsafe_rawColors.PLATFORM_BATTLENET;
r15[PlatformTypes.YOUTUBE] = Module712.unsafe_rawColors.PLATFORM_YOUTUBE;
r15[PlatformTypes.TWITCH] = Module712.unsafe_rawColors.PLATFORM_TWITCH;
let c9776_0 = r15;
export function getConnectionBackgroundColor(a0) {
return c9776_0[a0];
}
@@ -0,0 +1,279 @@
// Metro module 11009 (f11010).
import { useState, useEffect } from "react";
import { ActivityIndicator, View } from "react-native";
import UserRecord from "../../../records/UserRecord";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import GuildRoleStore from "../../../stores/GuildRoleStore";
import GuildStore from "../../../stores/GuildStore";
import GuildRoleConnectionEligibilityStore from "../GuildRoleConnectionEligibilityStore";
import { OperatorTypes } from "../Constants";
import { AnalyticEvents, EMPTY_STRING_SNOWFLAKE_ID } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { intl, t } from "../../../intl/index.native";
import { getConnectionsCheckText, officialApplicationIds } from "../ConnectionsUtils";
import { CheckmarkLargeIcon } from "../../../design/components/Icon/native/redesign/generated/CheckmarkLargeIcon";
import { Text } from "../../../design/components/Text/native/Text";
import useTheme from "../../../hooks/useTheme";
import Module12 from "../../../_bundle/Module12";
import { useToken } from "../../../design/tokens/native/useToken";
import Platforms from "../../../lib/Platforms";
import OfficialConnectionIcon from "./OfficialConnectionIcon";
import BotTag from "../../applications/native/BotTag";
import { Icon, Avatar, AvatarSizes } from "../../../design/void/native";
import { makeSource } from "../../../utils/AvatarUtils";
import * as _shared from "../../../design/shared";
import Module38 from "../../../_bundle/Module38";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { useStateFromStores } from "../../../_bundle/Module589";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { collectChannelAnalyticsMetadataFromId, collectGuildAnalyticsMetadata } from "../../app_analytics/AppAnalyticsUtils";
import GuildActionCreators from "../../../actions/GuildActionCreators";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import VerifiedRoleIcon from "./VerifiedRoleIcon";
import { Button } from "../../../design/components/Button/native/Button.native";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { openGuildRoleConnectionsModal } from "./GuildRoleConnectionsModalActionCreators";
import showUserProfileActionSheet from "../../user_profile/native/showUserProfileActionSheet";
let useStyles, PopoutChecks;
const PopoutCheck = function PopoutCheck(props) {
const { connectionType, connectionMetadataField, operator, value, description } = props;
const styles2 = useStyles();
const r22 = description != null ? OperatorTypes.LESS_THAN === operator ? intl.format(t["2p7dA3"], {
description,
count: Math.max(0, Number(value) - 1)
}) : OperatorTypes.GREATER_THAN === operator ? intl.format(t["2p7dA3"], {
description,
count: Math.max(0, Number(value) + 1)
}) : description : getConnectionsCheckText({
connectionType,
connectionMetadataField,
operator,
value
});
return r22 == null ? null : <View style={styles2.popoutCheck}>
<CheckmarkLargeIcon size="sm" style={styles2.popoutCheckIcon} />
<Text variant="text-xs/medium" color="mobile-text-heading-primary">{r22}</Text>
</View>;
};
PopoutChecks = function PopoutChecks(props) {
let c18457_3, c18457_4, token;
const { eligibilityStates, guildId } = props;
c18457_3 = void 0;
c18457_4 = void 0;
token = void 0;
const styles = useStyles();
let c18457_2 = useTheme();
const r18 = Module12.groupBy(eligibilityStates, (a0) => `${a0.connection_type}${a0.application_id != null ? `:${a0.application_id}` : ""}`);
c18457_3 = r18;
const r22 = Object.keys(r18);
c18457_4 = r22.length - 1;
token = useToken(Module712.unsafe_rawColors.GREEN_330);
return <>
{r22.map((a0, index) => {
const r5 = c18457_3[a0];
const r10 = r5.filter((item) => item.operator != null);
const r33 = r5.find((item) => item.application != null);
const r12 = Platforms.get(a0);
const application = r33?.application;
const user = application?.bot != null ? new UserRecord(application.bot) : null;
let r48 = application?.id;
if (r48 == null) {
r48 = "";
}
const r11 = officialApplicationIds.includes(r48) ? <OfficialConnectionIcon style={styles.botTag} guildId={guildId} roleColor={token} size={16} /> : user != null ? <BotTag style={styles.botTag} verified={false} /> : void 0;
const style = [styles.popoutChecksGroup, index < c18457_4 ? styles.popoutChecksGroupBottomMargin : null];
const r75 = r12 != null;
let r14 = null;
if (r75) {
const isThemeDark = _shared.isThemeDark(c18457_2);
const icon = r12.icon;
r14 = <Icon style={styles.popoutCheckGroupPlatformIcon} source={makeSource(isThemeDark ? icon.darkPNG : icon.lightPNG)} disableColor size={Icon.Sizes.MEDIUM} />;
}
const r92 = [r14, user != null ? <Avatar style={styles.popoutCheckGroupPlatformIcon} user={user} size={AvatarSizes.XSMALL} guildId={void 0} /> : null, , ,];
let r110 = r12?.name;
if (r110 == null) {
r110 = application?.name;
}
r92[2] = <Text variant="text-sm/medium" color="interactive-text-active">{r110}</Text>;
r92[3] = r11;
return <View key={a0} style={style}>
<View style={styles.popoutCheckGroupName}>{r92}</View>
{r10.map(({ connection_type, connection_metadata_field, operator, value, description }) => {
Module38(connection_metadata_field != null, "connectionMetadataField is null");
Module38(operator != null, "operator is null");
Module38(value != null, "value is null");
return <PopoutCheck key={`${connection_type}:${connection_metadata_field}:${operator}:${value}`} connectionType={connection_type} connectionMetadataField={connection_metadata_field} operator={operator} value={value} description={description} />;
})}
</View>;
})}
</>;
};
useStyles = createStyles({
container: {
flexDirection: "column",
alignItems: "center",
padding: 16
},
header: {
width: "100%",
flexDirection: "row",
alignItems: "center",
paddingBottom: 16,
borderBottomWidth: 1,
borderBottomColor: Module712.colors.BORDER_SUBTLE,
marginBottom: Module712.space.PX_24
},
verifiedContainer: {
marginRight: 8,
height: 24,
width: 24
},
headerTextContainer: {
flexShrink: 1,
flexDirection: "column"
},
verifiedCheck: {
position: "absolute",
left: 0,
top: 0
},
loadingSpinner: {
marginVertical: 40
},
popoutCheck: {
flexDirection: "row",
alignItems: "center",
marginTop: 8,
marginLeft: 32,
paddingRight: 20
},
popoutCheckIcon: {
marginRight: 8,
tintColor: Module712.colors.TEXT_FEEDBACK_POSITIVE
},
popoutChecksGroup: {
width: "100%",
marginBottom: 24
},
popoutChecksGroupBottomMargin: {
paddingBottom: 12,
borderBottomWidth: 1,
borderBottomColor: Module712.colors.BORDER_SUBTLE,
marginBottom: 12
},
popoutCheckGroupName: {
flexDirection: "row",
alignItems: "center"
},
popoutCheckGroupPlatformIcon: {
marginRight: 8
},
button: {
marginBottom: 8
},
botTag: {
marginLeft: 4
}
});
export default function ConnectionsRoleMessageBadgeActionSheet(props) {
let r26, stateFromStores4;
let stateFromStores2, stateFromStores3, state, setState;
const { userId, roleId, channelId, guildId: guildId2 } = props;
stateFromStores2 = void 0;
stateFromStores3 = void 0;
state = void 0;
setState = void 0;
const styles2 = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.CONNECTIONS_ROLE_POPOUT).analyticsLocations;
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId2));
stateFromStores2 = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
const stateFromStores5 = useStateFromStores([GuildMemberStore], () => GuildMemberStore.getMember(guildId2, stateFromStores2));
stateFromStores3 = useStateFromStores([GuildRoleConnectionEligibilityStore], () => GuildRoleConnectionEligibilityStore.getGuildRoleConnectionEligibility(roleId));
[state, setState] = useState(stateFromStores3 == null);
const r20 = stateFromStores5 == null ? void 0 : stateFromStores5.roles.includes(roleId);
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.PASSPORT_ROLE_POPOUT_VIEWED, {
other_user_id: userId,
role_id: roleId,
...collectChannelAnalyticsMetadataFromId(channelId),
...collectGuildAnalyticsMetadata(guildId2)
});
}, [userId, roleId, channelId, guildId2]);
useEffect(() => {
let r2 = state;
if (state) {
r2 = stateFromStores3 == null;
}
if (r2) {
GuildActionCreators.fetchGuildRoleConnectionsEligibility(guildId2, roleId).then(() => setState(false));
}
}, [guildId2, roleId, state, stateFromStores3]);
const r76 = stateFromStores3 == null ? void 0 : stateFromStores3.flat().some((item) => item.application_id === void 0);
L12: {
L11: {
stateFromStores4 = useStateFromStores([GuildRoleStore], () => stateFromStores != null ? GuildRoleStore.getRole(stateFromStores.id, roleId) : void 0);
if (stateFromStores3 != null) {
if (stateFromStores3.length === 1 && stateFromStores3[0].length === 1) {
break L11;
}
if (stateFromStores3.length === 1) {
r26 = intl.format(t["0eBj3x"], {});
break L12;
}
r26 = intl.format(t.D7uftB, {});
break L12;
}
}
r26 = intl.string(t.jDym4E);
}
let guildId3 = stateFromStores?.id;
if (guildId3 == null) {
guildId3 = EMPTY_STRING_SNOWFLAKE_ID;
}
let role = stateFromStores4;
if (role == null) {
role = void 0;
}
return <AnalyticsLocationProvider value={analyticsLocations}>
<BottomSheet>
<View style={styles2.container}>
<View style={styles2.header}>
<View style={styles2.verifiedContainer}>
<VerifiedRoleIcon style={styles2.verifiedCheck} guildId={guildId3} role={role} size={24} />
</View>
<View style={styles2.headerTextContainer}>
<Text variant="text-lg/semibold" color="mobile-text-heading-primary">
{stateFromStores4?.name}
</Text>
<Text variant="text-xs/normal" color="text-default">{r26}</Text>
</View>
</View>
{stateFromStores3 != null && stateFromStores3.flat() != null ? <>
<PopoutChecks eligibilityStates={stateFromStores3.flat()} guildId={guildId2} />
{r20 ? null : <View style={styles2.button}>
<Button onPress={function onPress() {
ActionSheetActionCreators.hideActionSheet("ConnectionsRoleMessageBadgeActionSheet");
openGuildRoleConnectionsModal({
guildId: guildId2
});
}} text={intl.string(t.T1t1WV)} variant="primary" grow />
</View>}
{r76 ? <View style={styles2.button}>
<Button onPress={function onPress() {
showUserProfileActionSheet({
userId,
channelId,
roleId,
sourceAnalyticsLocations: analyticsLocations
});
}} text={intl.string(t.hgKDnG)} variant="secondary" grow />
</View> : null}
</> : <ActivityIndicator style={styles2.loadingSpinner} size="large" />}
</View>
</BottomSheet>
</AnalyticsLocationProvider>;
};
export { PopoutChecks };
@@ -0,0 +1,294 @@
// Metro module 8994 (f8995).
import { useState } from "react";
import { View } from "react-native";
import { Endpoints, PlatformTypes } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
import { HTTP } from "../../../_bundle/sendRequest";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import FreeFormInputGroup from "../../../design/void/Form/native/FreeFormInputGroup";
import { EXAMPLE_DOMAIN, getDnsName, getHttpName } from "../DomainVerifyUtils";
import { Button } from "../../../design/components/Button/native/Button.native";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { getHeaderBackButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
import { HermesBuiltin } from "../../../_hermes/prelude";
let useStyles, c5883_11, DNSProofScreen, HTTPProofScreen;
const DomainScreen = function DomainScreen(props) {
let navigation, state, setState, setState2;
const onClose2 = props.onClose;
navigation = void 0;
state = void 0;
setState = void 0;
setState2 = void 0;
const verify = function verify() {
setState2(true);
setState(null);
HTTP.post({
url: Endpoints.CONNECTION(PlatformTypes.DOMAIN, state),
body: {},
rejectWithError: false
}).then(() => {
onClose2();
}).catch((error) => {
if (error.body?.proof) {
navigation.push(c5883_11.PROOF_DNS, {
proof: error.body.proof,
domain: state
});
} else {
const body = error.body;
const r10 = body == null;
let r11 = void 0;
if (!r10) {
const errors = body.errors;
const r13 = errors == null;
r11 = void 0;
if (!r13) {
const domain3 = errors.domain;
const r15 = domain3 == null;
r11 = void 0;
if (!r15) {
const _errors = domain3._errors;
r11 = _errors == null ? void 0 : _errors[0]?.message;
}
}
}
if (!r11) {
r11 = error.body?.message;
}
if (!r11) {
r11 = error.message;
}
setState(r11);
}
}).finally(() => {
setState2(false);
});
};
const styles = useStyles();
navigation = useNavigation();
let onChangeText;
[state, onChangeText] = useState("");
let error;
[error, setState] = useState(null);
let loading;
[loading, setState2] = useState(false);
return <SafeAreaPaddingView bottom style={styles.container}>
<Text variant="text-md/normal" color="text-default" style={styles.description}>
{intl.string(t.NxPUqY)}
</Text>
<FreeFormInputGroup autoFocus style={styles.input} label={intl.string(t["4jIAa+"])} placeholder={EXAMPLE_DOMAIN} error={error} returnKeyType="done" onChangeText={onChangeText} onSubmitEditing={verify} />
<Button loading={loading} disabled={state === ""} text={intl.string(t.PDTjLN)} onPress={verify} />
</SafeAreaPaddingView>;
};
DNSProofScreen = function DNSProofScreen(props) {
const { onClose: onClose3, domain, proof } = props;
const styles = useStyles();
const navigation2 = useNavigation();
const [state, setState3] = useState(null);
const [loading, setState4] = useState(false);
return <SafeAreaPaddingView bottom style={styles.container}>
<Text variant="text-md/normal">
{intl.string(t.cSURbq)}
</Text>
<View style={styles.dns}>
<Text variant="text-md/normal">
{intl.string(t.GL3q7k)}
</Text>
<Text variant="text-md/normal" selectable style={styles.code}>
{getDnsName(domain)}
</Text>
<Text variant="text-md/normal">
{intl.string(t.Ccmixu)}
</Text>
<Text variant="text-md/normal" selectable style={styles.code}>TXT</Text>
<Text variant="text-md/normal">
{intl.string(t.PVLriT)}
</Text>
<Text variant="text-md/normal" selectable style={styles.code}>{proof}</Text>
</View>
{state != null && <Text variant="text-md/normal" color="text-feedback-critical" style={styles.error}>{state}</Text>}
<View style={styles.button}>
<Button loading={loading} text={intl.string(t["13ofGu"])} onPress={function onPress() {
setState4(true);
setState3(null);
HTTP.post({
url: Endpoints.CONNECTION(PlatformTypes.DOMAIN, domain),
body: {},
rejectWithError: false
}).then(() => {
onClose3();
}).catch((error) => {
const body = error.body;
const r2 = body == null;
let r8 = void 0;
if (!r2) {
const errors = body.errors;
const r10 = errors == null;
r8 = void 0;
if (!r10) {
const domain3 = errors.domain;
const r12 = domain3 == null;
r8 = void 0;
if (!r12) {
const _errors = domain3._errors;
r8 = _errors == null ? void 0 : _errors[0]?.message;
}
}
}
if (!r8) {
r8 = error.body?.message;
}
if (!r8) {
r8 = error.message;
}
setState3(r8);
}).finally(() => {
setState4(false);
});
}} />
</View>
<View style={styles.button}>
<Button variant="secondary" text={intl.string(t.CkfdNx)} onPress={() => {
navigation2.push(c5883_11.PROOF_HTTP, {
proof,
domain
});
}} />
</View>
</SafeAreaPaddingView>;
};
HTTPProofScreen = function HTTPProofScreen(props) {
const { onClose: onClose4, domain: domain2, proof: proof2 } = props;
const styles = useStyles();
const navigation3 = useNavigation();
const [state, setState5] = useState(null);
const [loading, setState6] = useState(false);
return <SafeAreaPaddingView bottom style={styles.container}>
<Text variant="text-md/normal">
{intl.string(t.p4ql7y)}
</Text>
<View style={styles.dns}>
<Text variant="text-md/normal">
{intl.string(t.GL3q7k)}
</Text>
<Text variant="text-md/normal" selectable style={styles.code}>
{getHttpName(domain2)}
</Text>
<Text variant="text-md/normal">
{intl.string(t.PVLriT)}
</Text>
<Text variant="text-md/normal" selectable style={styles.code}>{proof2}</Text>
</View>
{state != null && <Text variant="text-md/normal" color="text-feedback-critical" style={styles.error}>{state}</Text>}
<View style={styles.button}>
<Button loading={loading} text={intl.string(t["13ofGu"])} onPress={function onPress() {
setState6(true);
setState5(null);
HTTP.post({
url: Endpoints.CONNECTION(PlatformTypes.DOMAIN, domain2),
body: {},
rejectWithError: false
}).then(() => {
onClose4();
}).catch((error) => {
const body = error.body;
const r2 = body == null;
let r8 = void 0;
if (!r2) {
const errors = body.errors;
const r10 = errors == null;
r8 = void 0;
if (!r10) {
const domain3 = errors.domain;
const r12 = domain3 == null;
r8 = void 0;
if (!r12) {
const _errors = domain3._errors;
r8 = _errors == null ? void 0 : _errors[0]?.message;
}
}
}
if (!r8) {
r8 = error.body?.message;
}
if (!r8) {
r8 = error.message;
}
setState5(r8);
}).finally(() => {
setState6(false);
});
}} />
</View>
<View style={styles.button}>
<Button variant="secondary" text={intl.string(t.RhJMVQ)} onPress={() => {
navigation3.pop();
}} />
</View>
</SafeAreaPaddingView>;
};
useStyles = createStyles({
container: {
padding: 16
},
description: {
textAlign: "center"
},
input: {
paddingHorizontal: 0,
paddingVertical: 0,
marginVertical: 16
},
dns: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderRadius: Module712.radii.xs,
padding: 8,
marginTop: 16
},
error: {
marginTop: 16
},
code: {
fontFamily: "monospace",
marginBottom: 4
},
button: {
marginTop: 16
}
});
c5883_11 = {
DOMAIN: "DOMAIN",
PROOF_DNS: "PROOF_DNS",
PROOF_HTTP: "PROOF_HTTP"
};
export default function DomainVerifyModal(props) {
if (props == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
const onClose5 = function onClose() {
return ModalActionCreators.pop();
};
const screens = {};
screens[c5883_11.DOMAIN] = {
headerTitle: intl.string(t["7lo8+e"]),
headerLeft: getHeaderBackButton(onClose5),
render: () => <DomainScreen onClose={onClose5} />
};
screens[c5883_11.PROOF_DNS] = {
headerTitle: intl.string(t["7lo8+e"]),
headerLeft: getHeaderBackButton(onClose5),
render: (a0) => <DNSProofScreen domain={a0.domain} proof={a0.proof} onClose={onClose5} />
};
screens[c5883_11.PROOF_HTTP] = {
headerTitle: intl.string(t["7lo8+e"]),
headerLeft: getHeaderBackButton(onClose5),
render: (a0) => <HTTPProofScreen domain={a0.domain} proof={a0.proof} onClose={onClose5} />
};
return <Navigator screens={screens} initialRouteName={c5883_11.DOMAIN} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,121 @@
// Metro module 9001 (f9002).
import { useState } from "react";
import { WebBrowserType } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Platforms from "../../../lib/Platforms";
import { intl, t } from "../../../intl/index.native";
import ConnectedAccountsActionCreators from "../../../actions/ConnectedAccountsActionCreators";
import Linking from "../../../lib/native/Linking";
import { getExampleHandle, validateHandle } from "../FederatedSocialUtils";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import { Text } from "../../../design/components/Text/native/Text";
import FreeFormInputGroup from "../../../design/void/Form/native/FreeFormInputGroup";
import { ClearButtonVisibility } from "../../../design/void/native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { getHeaderBackButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
const useStyles = createStyles({
container: {
padding: 16
},
description: {
textAlign: "center"
},
input: {
paddingHorizontal: 0,
paddingVertical: 0,
marginVertical: 16
}
});
export default function FederatedSocialModal(props) {
let c16915_0 = props;
let serviceName = Platforms.get(props.platformType)?.name;
if (serviceName == null) {
serviceName = intl.string(t["bU/GZm"]);
}
return <Navigator initialRouteName="root" screens={{
root: {
headerTitle: intl.formatToPlainString(t["ImMhq+"], {
serviceName
}),
headerLeft: getHeaderBackButton(props.onClose),
render: () => {
let state, setState, setState2;
const { location: location2, successRedirect, platformType, onClose } = c16915_0;
state = void 0;
setState = void 0;
setState2 = void 0;
let _tryHandle2 = function _tryHandle() {
const r9 = async () => {
let c31985_3 = 0;
let c32129_0;
L14: {
try {
c32129_0 = void 0;
setState2(true);
setState(null);
c31985_3 = 1;
c32129_0 = (await ConnectedAccountsActionCreators.authorize(platformType, {
location: location2,
successRedirect,
handle: state
})).body;
if (c32129_0?.url == null) {
throw new Error();
}
Linking.openURLExternally(c32129_0.url, WebBrowserType.SAFARI);
(0, onClose)();
c31985_3 = 0;
} catch ($e) {
let r7 = $e;
if (c31985_3 !== 0) {
while (true) {
try {
c31985_3 = 0;
setState(intl.string(t["7wbPNl"]));
(0, setState2)(false);
break L14;
} catch ($e) {
r7 = $e;
if (c31985_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
_tryHandle2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
let onChangeText;
[state, onChangeText] = useState("");
let error;
[error, setState] = useState(null);
let loading;
[loading, setState2] = useState(false);
let serviceName = Platforms.get(platformType)?.name;
if (serviceName == null) {
serviceName = intl.string(t["bU/GZm"]);
}
const tryHandle = function tryHandle() {
return _tryHandle2.apply(this, arguments);
};
const exampleHandle = getExampleHandle(platformType);
const r63 = validateHandle(state, platformType);
return <SafeAreaPaddingView bottom style={styles.container}>
<Text variant="text-md/normal" color="text-default" style={styles.description}>
{intl.formatToPlainString(t["7TByKh"], {
serviceName
})}
</Text>
<FreeFormInputGroup autoFocus style={styles.input} label={intl.string(t.tZ9QFR)} placeholder={exampleHandle} error={error} returnKeyType="done" onChangeText={onChangeText} onSubmitEditing={tryHandle} clearButtonVisibility={ClearButtonVisibility.WITH_CONTENT} autoCapitalize="none" autoComplete="off" autoCorrect={false} />
<Button loading={loading} disabled={!r63} text={intl.string(t.PDTjLN)} onPress={tryHandle} />
</SafeAreaPaddingView>;
}
}
}} />;
};
@@ -0,0 +1,888 @@
// Metro module 10006 (f10007).
import { useMemo, useCallback, useState, useEffect } from "react";
import { ActivityIndicator, Pressable, View } from "react-native";
import AuthorizedAppsStore from "../../oauth2/AuthorizedAppsStore";
import LocaleStore from "../../user_settings/LocaleStore";
import UserRecord from "../../../records/UserRecord";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import ChannelStore from "../../../stores/ChannelStore";
import ConnectedAccountsStore from "../../../stores/ConnectedAccountsStore";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import PermissionStore from "../../../stores/PermissionStore";
import { GUILD_ROLE_CONNECTION_APPLICATION_CONNECTION_TYPE, GUILD_ROLE_CONNECTION_APPLICATION_IDENTITY_CONNECTION_TYPE, MetadataFields, OperatorTypes } from "../Constants";
import { ACTIVITY_PLATFORM_TYPES, AnalyticEvents, EMPTY_STRING_SNOWFLAKE_ID, FRIEND_SYNC_PLATFORM_TYPES, MarketingURLs, Permissions, PlatformTypes, UserSettingsSections } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useTheme from "../../../hooks/useTheme";
import Platforms from "../../../lib/Platforms";
import { makeSource } from "../../../utils/AvatarUtils";
import * as _shared from "../../../design/shared";
import { Icon, Avatar, AvatarSizes } from "../../../design/void/native";
import { getChannelIcon } from "../../../utils/native/ChannelUtils";
import useChannelName from "../../channel/useChannelName";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { getConnectionsCheckText, officialApplicationIds } from "../ConnectionsUtils";
import { useGetOrFetchApplicationBatched } from "../../applications/useGetOrFetchApplicationBatched";
import useStartAuthorize from "../../application_account_linking/native/useStartAuthorize";
import BotTag from "../../applications/native/BotTag";
import Module10008 from "../../../_bundle/Module10008";
import Module10009 from "../../../_bundle/Module10009";
import Module12 from "../../../_bundle/Module12";
import { useToken } from "../../../design/tokens/native/useToken";
import OfficialConnectionIcon from "./OfficialConnectionIcon";
import Module38 from "../../../_bundle/Module38";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import Module9311 from "../../../_bundle/Module9311";
import useMountEffect from "../../../hooks/useMountEffect";
import { FormSwitchRow } from "../../../design/void/Form/native/index";
import ConnectedAccountsActionCreators from "../../../actions/ConnectedAccountsActionCreators";
import { useStateFromStores } from "../../../_bundle/Module589";
import getConnectionsRoles from "../../channel/getConnectionsRoles";
import GuildActionCreators from "../../../actions/GuildActionCreators";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { collectGuildAnalyticsMetadata } from "../../app_analytics/AppAnalyticsUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
import { makeGuildRoleConnectionsConnectAccountsActionSheetKey } from "./GuildRoleConnectionsModalActionCreators";
import authorizeConnection_native from "../authorizeConnection.native";
import Dispatcher from "../../../Dispatcher";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { ApplicationIntegrationType } from "../../../_bundle/Module8028";
import { fetchUserApplicationRoleConnections } from "../ConnectionsRoleActionCreators";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { ConnectedUserAccount, ConnectedApplicationUserRoleAccount } from "../../user_profile/native/LegacyUserProfileConnections";
import VerifiedRoleIcon from "./VerifiedRoleIcon";
import { Button } from "../../../design/components/Button/native/Button.native";
let useStyles, ChannelName, ConnectionsCheck, IdentityConnectionsCheckGroup, ConnectionsChecks, ConnectedUserAccountOptions, c6654_39, GuildRoleConnectionsConnectAccountsActionSheet;
const PlatformIcon = function PlatformIcon(props) {
const platformType = props.platformType;
const styles2 = useStyles();
const theme = useTheme();
const r8 = Platforms.get(platformType);
const isThemeLight = _shared.isThemeLight(theme);
const icon = r8.icon;
return <Icon source={makeSource(isThemeLight ? icon.lightPNG : icon.darkPNG)} style={styles2.platformIcon} disableColor />;
};
ChannelName = function ChannelName(props) {
const { channel, style } = props;
const styles2 = useStyles();
const channelIcon = getChannelIcon(channel);
return <View style={[styles2.channelName, style]}>
{channelIcon != null ? <Icon source={channelIcon} style={styles2.channelNameIcon} /> : null}
<Text variant="heading-lg/semibold" color="text-default" style={styles2.channelNameText} lineClamp={1}>
{useChannelName(channel)}
</Text>
</View>;
};
ConnectionsCheck = function ConnectionsCheck(props) {
let r57, operatorText;
const { connectionType, connectionMetadataField, operator, value, result: result2, description } = props;
const styles2 = useStyles();
if (connectionType === GUILD_ROLE_CONNECTION_APPLICATION_IDENTITY_CONNECTION_TYPE) {
return null;
}
if (description != null) {
r57 = OperatorTypes.LESS_THAN === operator ? intl.format(t["2p7dA3"], {
description,
count: Math.max(0, Number(value) - 1)
}) : OperatorTypes.GREATER_THAN === operator ? intl.format(t["2p7dA3"], {
description,
count: Math.max(0, Number(value) + 1)
}) : description;
} else {
L16: {
if (OperatorTypes.EQUAL === operator) {
const r44 = t["0BlpbA"];
operatorText = connectionType === PlatformTypes.PAYPAL && connectionMetadataField === MetadataFields.PAYPAL_VERIFIED ? t.dcSDhW : r44;
} else if (OperatorTypes.NOT_EQUAL === operator) {
operatorText = t.otcpTN;
} else if (OperatorTypes.LESS_THAN === operator) {
operatorText = t.Ef35xs;
} else {
if (OperatorTypes.GREATER_THAN !== operator) {
if (operator !== void 0) {
operatorText = void 0;
if (operator !== null) {
break L16;
}
}
return null;
}
operatorText = t["8W9OXU"];
}
}
r57 = getConnectionsCheckText({
connectionType,
connectionMetadataField,
operator,
operatorText,
value
});
}
return r57 == null ? null : <Text variant="text-xs/normal" color={result2 ? "text-default" : "text-feedback-critical"} style={styles2.connectionsCheck}>{r57}</Text>;
};
IdentityConnectionsCheckGroup = function IdentityConnectionsCheckGroup(props) {
let result;
const { eligibilityState, onAttempted: onAttempted2, onIdentityAuthorize } = props;
result = void 0;
const styles2 = useStyles();
const startAuthorize = useStartAuthorize(useGetOrFetchApplicationBatched(eligibilityState.application_id));
const { canStartAuthorization, startAuthorization } = startAuthorize;
let canStartAuthorization2 = canStartAuthorization;
const { identity_connected_account_type, identity_auth_required_scopes } = eligibilityState;
let r14 = canStartAuthorization;
if (!canStartAuthorization) {
r14 = canStartAuthorization;
if (identity_connected_account_type != null) {
r14 = canStartAuthorization;
if (identity_auth_required_scopes != null) {
const r38 = Platforms.get(identity_connected_account_type);
const r39 = r38 != null && r38.enabled;
r14 = canStartAuthorization;
if (r39) {
canStartAuthorization2 = true;
r14 = true;
}
}
}
}
const application = eligibilityState.application;
const memo3 = useMemo(() => application?.bot != null ? new UserRecord(application.bot) : null, [application]);
result = eligibilityState.result;
const r18 = memo3 != null ? <BotTag style={styles2.botTag} verified={memo3.isVerifiedBot()} /> : void 0;
const r63 = result ? <Icon source={Module10008} style={styles2.connectionsChecksGroupCheckmark} /> : r14 ? <Icon source={Module10009} style={styles2.connectionsChecksGroupCaret} /> : <Text variant="text-md/medium" color="text-muted">
{intl.string(t.cEts68)}
</Text>;
const callback2 = useCallback(() => {
if (!result && canStartAuthorization2) {
const wasAlreadyConnected2 = identity_connected_account_type != null && ConnectedAccountsStore.getAccounts().some((item) => item.type === identity_connected_account_type);
const r16 = wasAlreadyConnected2 ? null : eligibilityState.connection_type;
let application_id = eligibilityState.application_id;
if (application_id == null) {
application_id = null;
}
onAttempted2(r16, application_id);
if (canStartAuthorization) {
startAuthorization({
analyticsLocations: ["Verified Roles Connect Accounts Modal"]
});
} else if (identity_connected_account_type != null && identity_auth_required_scopes != null && eligibilityState.application_id != null) {
onIdentityAuthorize({
applicationId: eligibilityState.application_id,
scopes: identity_auth_required_scopes,
connectedAccountProvider: identity_connected_account_type,
wasAlreadyConnected: wasAlreadyConnected2
});
}
}
}, [result, r14, canStartAuthorization, startAuthorization, onAttempted2, onIdentityAuthorize, eligibilityState.connection_type, eligibilityState.application_id, identity_connected_account_type, identity_auth_required_scopes]);
let r92 = application?.id;
if (r92 == null) {
r92 = "";
}
const r93 = officialApplicationIds.includes(r92);
const r94 = r93 ? null : <Pressable accessibilityRole="button" style={[styles2.connectionsChecksGroup, result ? styles2.connectionsChecksGroupPassed : null, r14 ? null : styles2.connectionsChecksGroupPlatformDisabled]} disabled={result ? result : !r14} onPress={callback2}>
{memo3 != null ? <Avatar style={styles2.appIcon} user={memo3} size={AvatarSizes.XSMALL} guildId={void 0} /> : null}
<View style={styles2.connectionsChecksGroupTextContainer}>
<View style={styles2.connectionsChecksGroupTextNameContainer}>
<Text variant="text-md/medium" color="mobile-text-heading-primary">
{application?.name}
</Text>
{r18}
</View>
{r14 ? null : result ? null : <Text variant="text-xs/normal" color="text-muted" style={styles2.connectionsCheck}>
{intl.string(t["+z5dYe"])}
</Text>}
</View>
{r63}
</Pressable>;
return r94;
};
ConnectionsChecks = function ConnectionsChecks(props) {
let memo2, token;
const { eligibilityStatesGroups, onPlatformAttempt, onPlatformConnect, onPlatformConnected, onPlatformIdentityAuthorize } = props;
let initialAttemptedPlatformType3 = props.initialAttemptedPlatformType;
let initialAttemptedApplicationId2 = props.initialAttemptedApplicationId;
memo2 = void 0;
token = void 0;
const styles = useStyles();
const [state, setState] = useState({});
const [state2, setState2] = useState(0);
if (initialAttemptedPlatformType3 == null) {
initialAttemptedPlatformType3 = null;
}
const [state3, setState3] = useState(initialAttemptedPlatformType3);
if (initialAttemptedApplicationId2 == null) {
initialAttemptedApplicationId2 = null;
}
const [state4, setState4] = useState(initialAttemptedApplicationId2);
const memo = useMemo(() => Module12.flatten(eligibilityStatesGroups), [eligibilityStatesGroups]);
memo2 = useMemo(() => Module12.groupBy(memo, (a0) => `${a0.connection_type}${a0.application_id != null ? `:${a0.application_id}` : ""}`), [memo]);
useEffect(() => setState2(Date.now()), [memo]);
useEffect(() => {
if (state3 != null) {
const r17 = memo2[`${state3}${state4 != null ? `:${state4}` : ""}`];
if (r17 != null && r17.every((item) => item.result)) {
let r23 = r17[0]?.identity_connected_account_type;
if (r23 == null) {
r23 = state3;
}
let r28 = r17.find((item) => item.application != null)?.application;
if (r28 == null) {
r28 = null;
}
onPlatformConnected(r23, r28);
}
}
}, [memo2, state3, state4, onPlatformConnected]);
token = useToken(Module712.unsafe_rawColors.GREEN_330);
return <>
{Object.keys(memo2).sort((a, b) => {
const r11 = memo2[a].every((item) => item.result);
const r16 = memo2[b].every((item) => item.result);
return r11 === true ? r16 !== false ? r11 === false ? r16 === true ? -1 : 0 : 0 : 1 : r11 === false ? r16 === true ? -1 : 0 : 0;
}).map((a0) => {
const r4 = memo2[a0];
if (a0.startsWith(`${GUILD_ROLE_CONNECTION_APPLICATION_IDENTITY_CONNECTION_TYPE}:`) && r4[0] != null) {
return <IdentityConnectionsCheckGroup key={a0} eligibilityState={r4[0]} onAttempted={(event, a1) => {
setState3(event);
setState4(a1);
if (event != null) {
onPlatformAttempt();
}
}} onIdentityAuthorize={onPlatformIdentityAuthorize} />;
}
const r45 = r4.find((item) => item.operator == null);
const r17 = r4.filter((item) => item.operator != null);
const r48 = (r45 == null || r45.result) && r17.every((item) => item.result);
let content, c26595_1, application2;
const r53 = r4.find((item) => item.application != null);
const r15 = Platforms.get(a0);
c26595_1 = r15;
const r13 = r15 == null || r15.enabled;
application2 = r53?.application;
const user = application2?.bot != null ? new UserRecord(application2.bot) : null;
let r68 = application2?.id;
if (r68 == null) {
r68 = "";
}
const r69 = officialApplicationIds.includes(r68);
let r72 = r15?.type;
if (r72 == null) {
r72 = GUILD_ROLE_CONNECTION_APPLICATION_CONNECTION_TYPE;
}
const r73 = state[r72];
const r74 = (r48 ? !r48 : r73 != null) && r73 <= state2;
const r87 = r48 ? <Icon source={Module10008} style={styles.connectionsChecksGroupCheckmark} /> : r74 ? <Text variant="text-sm/semibold" color="text-brand">
{intl.string(t["5911Lb"])}
</Text> : r13 ? <Icon source={Module10009} style={styles.connectionsChecksGroupCaret} /> : <Text variant="text-md/medium" color="text-muted">
{intl.string(t.cEts68)}
</Text>;
const type = r15?.type;
const STEAM = PlatformTypes.STEAM;
let r122 = void 0;
if (type === STEAM) {
content = intl.string(t.NcZh6K);
r122 = content;
}
const r133 = r69 ? <OfficialConnectionIcon style={styles.botTag} guildId={EMPTY_STRING_SNOWFLAKE_ID} roleColor={token} size={16} /> : user != null ? <BotTag style={styles.botTag} verified={user.isVerifiedBot()} /> : void 0;
const style = [styles.connectionsChecksGroup, r48 ? styles.connectionsChecksGroupPassed : null, r13 ? null : styles.connectionsChecksGroupPlatformDisabled];
const disabled = r48 || !r13;
const r171 = [r48 ? null : r74 ? <View style={styles.connectionsChecksGroupRequirementsNotMet}>
<Text variant="text-xs/normal" color="text-overlay-light">
{intl.string(t.UB3hKo)}
</Text>
</View> : null, r15 != null ? <PlatformIcon platformType={r15.type} /> : null, user != null ? <Avatar style={styles.appIcon} user={user} size={AvatarSizes.XSMALL} guildId={void 0} /> : null, , ,];
let r197 = r15?.name;
if (r197 == null) {
r197 = application2?.name;
}
r171[3] = <View style={styles.connectionsChecksGroupTextContainer}>
<View style={styles.connectionsChecksGroupTextNameContainer}>
<Text variant="text-md/medium" color="mobile-text-heading-primary">{r197}</Text>
{r133}
{r122 != null ? <Pressable onPress={() => {
Module38(content != null, "tooltip is null");
ToastActionCreators.open({
key: "CONNECTIONS_STEAM_TOOLTIP",
icon: Module9311,
content
});
}}>
<Icon source={Module9311} size={Icon.Sizes.SMALL_20} style={styles.connectionsChecksGroupTextNameInfoIcon} />
</Pressable> : null}
</View>
{r17.map(({ connection_type, connection_metadata_field, operator, value, result: result2, description }) => {
Module38(connection_metadata_field != null, "connectionMetadataField is null");
Module38(operator != null, "operator is null");
Module38(value != null, "value is null");
return <ConnectionsCheck key={connection_metadata_field} connectionType={connection_type} connectionMetadataField={connection_metadata_field} operator={operator} value={value} result={result2} description={description} />;
})}
</View>;
r171[4] = r87;
return <Pressable key={a0} accessibilityRole="button" style={style} disabled={disabled} onPress={() => {
let r5 = c26595_1?.type;
if (r5 == null) {
r5 = GUILD_ROLE_CONNECTION_APPLICATION_CONNECTION_TYPE;
}
let r13 = application2;
if (application2 == null) {
r13 = null;
}
const r6 = {
...state
};
r6[r5] = Date.now();
setState(r6);
setState3(r5);
let r23 = r13?.id;
if (r23 == null) {
r23 = null;
}
setState4(r23);
onPlatformAttempt();
onPlatformConnect(r5, r13);
}}>{r171}</Pressable>;
})}
</>;
};
ConnectedUserAccountOptions = function ConnectedUserAccountOptions(props) {
const { account, setShowPreviewInvisibleIcon, setShowPreviewMetadata } = props;
const styles2 = useStyles();
const [value2, setState5] = useState(account.friendSync);
const [value, setState6] = useState(account.showActivity);
const [state5, setState7] = useState(account.metadataVisibility === 1);
const [state6, setState8] = useState(account.visibility === 1);
useMountEffect(() => {
setShowPreviewInvisibleIcon(!state6);
setShowPreviewMetadata(state5);
});
const r54 = Platforms.get(account.type);
const r59 = FRIEND_SYNC_PLATFORM_TYPES.has(account.type) ? <FormSwitchRow label={intl.string(t["+KCMSi"])} value={value2} onValueChange={(value) => {
setState5(value);
ConnectedAccountsActionCreators.setFriendSync(account.type, account.id, value);
}} /> : void 0;
const r75 = ACTIVITY_PLATFORM_TYPES.has(account.type) ? <FormSwitchRow label={intl.formatToPlainString(t["6u6J0q"], {
platform: r54.name
})} value={value} onValueChange={(value) => {
setState6(value);
ConnectedAccountsActionCreators.setShowActivity(account.type, account.id, value);
}} /> : void 0;
const r96 = r54.hasMetadata === true ? <FormSwitchRow label={intl.string(t.FYKGsL)} value={state5} disabled={!state6} onValueChange={(value) => {
setShowPreviewMetadata(value);
setState7(value);
ConnectedAccountsActionCreators.setMetadataVisibility(account.type, account.id, value ? 1 : 0);
}} /> : void 0;
return <View style={styles2.accountConnectedPrivacyOptionsContainer}>
<FormSwitchRow label={intl.string(t.f7yOAX)} value={state6} onValueChange={(value) => {
setShowPreviewInvisibleIcon(!value);
setState8(value);
ConnectedAccountsActionCreators.setVisibility(account.type, account.id, value ? 1 : 0);
}} />
{r96}
{r75}
{r59}
</View>;
};
useStyles = createStyles({
container: {
padding: 12
},
connectionsChecksGroups: {
marginTop: 16,
flexDirection: "column"
},
connectionsChecksGroup: {
flexDirection: "row",
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 2,
borderRadius: Module712.radii.md,
paddingHorizontal: 16,
paddingVertical: 20,
marginBottom: 16,
width: "100%",
alignItems: "center",
position: "relative"
},
connectionsChecksGroupPassed: {
borderColor: Module712.colors.BACKGROUND_BASE_LOWEST,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
connectionsChecksGroupPlatformDisabled: {
backgroundColor: Module712.colors.BORDER_SUBTLE
},
connectionsChecksGroupRequirementsNotMet: {
paddingVertical: 4,
paddingHorizontal: 12,
borderRadius: Module712.radii.md,
backgroundColor: Module712.colors.BACKGROUND_FEEDBACK_CRITICAL,
position: "absolute",
top: -8,
right: 20
},
connectionsChecksGroupTextContainer: {
flex: 1
},
connectionsChecksGroupTextNameContainer: {
flexDirection: "row",
alignItems: "center"
},
connectionsChecksGroupTextNameInfoIcon: {
marginLeft: 4,
tintColor: Module712.colors.TEXT_FEEDBACK_WARNING
},
connectionsChecksGroupCheckmark: {
tintColor: Module712.colors.TEXT_FEEDBACK_POSITIVE,
width: 24,
height: 24
},
connectionsChecksGroupCaret: {
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
width: 24,
height: 24
},
connectionsCheck: {
marginTop: 4
},
platformIcon: {
width: 24,
height: 24,
marginRight: 12
},
channelName: {
flexDirection: "row",
alignItems: "center",
marginBottom: 4
},
channelNameIcon: {
tintColor: Module712.colors.TEXT_MUTED,
marginRight: 8,
width: 24,
height: 24
},
channelNameText: {
overflow: "hidden"
},
header: {
flexDirection: "row",
width: "100%",
alignItems: "center",
marginBottom: 8
},
content: {
width: "100%"
},
footerText: {
marginBottom: 16
},
accountConnectedContainer: {
flexDirection: "column",
alignItems: "flex-start",
marginVertical: 24
},
accountConnectedPreview: {
width: "100%"
},
accountConnectedPreviewConnectedUserAccount: {
marginTop: 8,
borderRadius: Module712.radii.xs,
borderWidth: 1,
borderColor: Module712.colors.BORDER_SUBTLE
},
accountConnectedPrivacy: {
marginTop: 16,
width: "100%"
},
accountConnectedPrivacyOptionsContainer: {
marginTop: 8,
borderWidth: 1,
borderColor: Module712.colors.BORDER_SUBTLE,
borderRadius: Module712.radii.xs,
padding: 8,
flexDirection: "column"
},
roleGranted: {
flexDirection: "row",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
paddingVertical: 12,
paddingHorizontal: 8,
borderTopStartRadius: 4,
borderTopEndRadius: 4,
marginTop: 16
},
roleGrantedName: {
overflow: "hidden",
marginRight: 24
},
verifiedIcon: {
marginRight: 8
},
channelsGranted: {
flexDirection: "column",
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL,
padding: 16,
borderBottomStartRadius: 4,
borderBottomEndRadius: 4,
marginBottom: 24
},
manageConnectionsButton: {
marginTop: 8
},
loading: {
marginTop: 24,
marginBottom: 32,
alignSelf: "center"
},
appIcon: {
marginRight: 8
},
botTag: {
marginLeft: 4
}
});
c6654_39 = {
CHECKS_REQUIRED: 0,
0: "CHECKS_REQUIRED",
ACCOUNT_CONNECTED: 1,
1: "ACCOUNT_CONNECTED",
ROLE_GRANTED: 2,
2: "ROLE_GRANTED"
};
GuildRoleConnectionsConnectAccountsActionSheet = function GuildRoleConnectionsConnectAccountsActionSheet(props) {
let r166, r228, r426, r473;
let setState9, setState10, setState11, setState12, state7, setState13, stateFromStores, state8, setState14, state9, setState15, setState16, setState17, stateFromStores2, c17617_19;
const { guildId, role, initialAttemptedPlatformType, initialAttemptedApplicationId, onCloseModal } = props;
setState9 = void 0;
setState10 = void 0;
setState11 = void 0;
setState12 = void 0;
state7 = void 0;
setState13 = void 0;
stateFromStores = void 0;
state8 = void 0;
setState14 = void 0;
state9 = void 0;
setState15 = void 0;
setState16 = void 0;
setState17 = void 0;
stateFromStores2 = void 0;
c17617_19 = void 0;
let _handleAssignRole2 = function _handleAssignRole() {
const r9 = async () => {
setState13(true);
await GuildActionCreators.assignGuildRoleConnection(guildId, role.id);
};
_handleAssignRole2 = r9;
return r9.apply(this, arguments);
};
const styles2 = useStyles();
let state;
[state, setState9] = useState(c6654_39.CHECKS_REQUIRED);
let eligibilityStatesGroups2;
[eligibilityStatesGroups2, setState10] = useState(null);
let state2;
[state2, setState11] = useState(false);
let disabled;
[disabled, setState12] = useState(true);
[state7, setState13] = useState(false);
const [showMetadata, setShowPreviewMetadata2] = useState(true);
const [showInvisibleIcon, setShowPreviewInvisibleIcon2] = useState(false);
const stateFromStores3 = useStateFromStores([ConnectedAccountsStore], () => ConnectedAccountsStore.getAccounts());
const stateFromStores5 = useStateFromStores([AuthorizedAppsStore], () => AuthorizedAppsStore.getNewestTokens());
stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
[state8, setState14] = useState(null);
[state9, setState15] = useState(null);
let state3;
[state3, setState16] = useState(() => {
const r1 = initialAttemptedPlatformType != null;
let r2 = null;
if (r1) {
let applicationId2 = initialAttemptedApplicationId;
if (initialAttemptedApplicationId == null) {
applicationId2 = null;
}
r2 = {
platformType: initialAttemptedPlatformType,
applicationId: applicationId2
};
}
return r2;
});
let state4;
[state4, setState17] = useState(null);
const theme = useTheme();
stateFromStores2 = useStateFromStores([GuildMemberStore], () => GuildMemberStore.getMember(guildId, stateFromStores));
const stateFromStores6 = useStateFromStores([ChannelStore], () => ChannelStore.getMutableGuildChannelsForGuild(guildId));
const stateFromStores4 = useStateFromStores([LocaleStore], () => LocaleStore.locale);
const r40 = Object.values(stateFromStores6).filter((item) => PermissionStore.can(Permissions.VIEW_CHANNEL, item) && PermissionStore.can(Permissions.SEND_MESSAGES, item) && getConnectionsRoles(item).includes(role));
c17617_19 = r40;
useEffect(() => {
GuildActionCreators.fetchGuildRoleConnectionsEligibility(guildId, role.id).then((result) => {
setState10(result);
setState11(result.some((item) => item.every((item) => item.result)));
setState12(false);
});
}, [guildId, role.id, stateFromStores3, stateFromStores5]);
useEffect(() => {
if (initialAttemptedPlatformType == null) {
AnalyticsUtils.track(AnalyticEvents.PASSPORT_CHALLENGE_VIEWED, {
role_id: role.id,
...collectGuildAnalyticsMetadata(guildId)
});
}
}, [initialAttemptedPlatformType, role.id, guildId]);
useEffect(() => {
let r3 = state7;
if (state7) {
r3 = stateFromStores2 != null;
}
if (r3) {
r3 = stateFromStores2.roles.includes(role.id);
}
if (r3) {
setState13(false);
if (c17617_19.length > 0) {
setState9(c6654_39.ROLE_GRANTED);
} else {
ActionSheetActionCreators.hideActionSheet();
}
AnalyticsUtils.track(AnalyticEvents.PASSPORT_CHALLENGE_FINISHED, {
role_id: role.id,
...collectGuildAnalyticsMetadata(guildId)
});
}
}, [state7, r40.length, stateFromStores2, guildId, role.id]);
if (c6654_39.CHECKS_REQUIRED === state) {
r166 = <View style={styles2.header}>
<Text variant="heading-lg/extrabold">
{intl.string(t.zOZh3R)}
</Text>
</View>;
} else if (c6654_39.ACCOUNT_CONNECTED === state) {
Module38(state8 != null, "lastPlatformConnected is null");
let platformName = Platforms.get(state8)?.name;
if (platformName == null) {
platformName = state9?.name;
}
r166 = <Text variant="heading-lg/extrabold" style={styles2.header}>
{intl.format(t.yQvgBO, {
platformName
})}
</Text>;
} else {
r166 = c6654_39.ROLE_GRANTED === state ? <Text variant="heading-lg/extrabold" style={styles2.header}>
{intl.string(t.najNdz)}
</Text> : null;
}
const handleManageConnections = function handleManageConnections() {
if (onCloseModal != null) {
onCloseModal();
}
ActionSheetActionCreators.hideActionSheet();
openUserSettings({
screen: UserSettingsSections.CONNECTIONS
});
};
const handleManageAuthorizedApplications = function handleManageAuthorizedApplications() {
if (onCloseModal != null) {
onCloseModal();
}
ActionSheetActionCreators.hideActionSheet();
openUserSettings({
screen: UserSettingsSections.AUTHORIZED_APPS
});
};
const r224 = [r166, , ,];
if (c6654_39.CHECKS_REQUIRED === state) {
const r367 = eligibilityStatesGroups2 != null && eligibilityStatesGroups2.length > 1;
const r4 = eligibilityStatesGroups2 != null && eligibilityStatesGroups2.length === 1 && eligibilityStatesGroups2[0].length === 1;
if (!disabled && eligibilityStatesGroups2 != null) {
const r387 = r4 ? t.jHfRvZ : r367 ? t["mOQ8k+"] : t.U0olLg;
const handlePlatformAttempt = function handlePlatformAttempt() {
AnalyticsUtils.track(AnalyticEvents.PASSPORT_CHALLENGE_STARTED, {
role_id: role.id,
...collectGuildAnalyticsMetadata(guildId)
});
};
const handlePlatformConnect = function handlePlatformConnect(a0, a1) {
const initialAttemptedPlatformType2 = a0;
authorizeConnection_native({
platformType: a0,
location: "Verified Roles Connect Accounts Modal",
onClose: () => {
let r10 = a1?.id;
if (r10 == null) {
r10 = null;
}
const r8 = {
overrideUrl: a1?.role_connections_verification_url
};
ActionSheetActionCreators.openLazy(Promise.resolve({
default: GuildRoleConnectionsConnectAccountsActionSheet
}), makeGuildRoleConnectionsConnectAccountsActionSheetKey(role.id), {
role,
guildId,
initialAttemptedPlatformType: initialAttemptedPlatformType2,
initialAttemptedApplicationId: initialAttemptedPlatformType2 != null ? r10 : null,
overrideUrl: r8.overrideUrl,
onCloseModal
});
},
overrideUrl: a1?.role_connections_verification_url
});
};
const handlePlatformIdentityAuthorize = function handlePlatformIdentityAuthorize({ applicationId, scopes, connectedAccountProvider, wasAlreadyConnected }) {
ActionSheetActionCreators.hideActionSheet();
const r5 = `OAuth2AuthorizeModal-${applicationId}`;
let c26597_2 = r5;
const handleModalClose2 = function handleModalClose(a0) {
if (a0.key === c26597_2) {
Dispatcher.unsubscribe("MODAL_POP", handleModalClose2);
const initialAttemptedPlatformType3 = wasAlreadyConnected ? null : GUILD_ROLE_CONNECTION_APPLICATION_IDENTITY_CONNECTION_TYPE;
ActionSheetActionCreators.openLazy(Promise.resolve({
default: GuildRoleConnectionsConnectAccountsActionSheet
}), makeGuildRoleConnectionsConnectAccountsActionSheetKey(role.id), {
role,
guildId,
initialAttemptedPlatformType: initialAttemptedPlatformType3,
initialAttemptedApplicationId: initialAttemptedPlatformType3 != null ? applicationId : null,
overrideUrl: ({}).overrideUrl,
onCloseModal
});
}
};
Dispatcher.subscribe("MODAL_POP", handleModalClose2);
ModalActionCreators.pushLazy(import("../../oauth2/native/OAuth2AuthorizeModal"), {
clientId: applicationId,
scopes,
integrationType: ApplicationIntegrationType.USER_INSTALL,
connectedAccountProvider,
callback: () => {},
dismissOAuthModal: () => ModalActionCreators.popWithKey(c26597_2)
}, r5);
};
const handlePlatformConnected = function handlePlatformConnected(a0, a1) {
setState14(a0);
setState15(a1);
setState9(c6654_39.ACCOUNT_CONNECTED);
setState16(null);
if (a1 != null) {
fetchUserApplicationRoleConnections().then((result) => {
setState17(result);
}).catch(() => {});
}
};
const r397 = [<Text variant="text-md/medium" color="text-default">
{intl.format(r387, {
roleName: role.name
})}
</Text>, , ,];
let initialAttemptedPlatformType3 = state3?.platformType;
if (initialAttemptedPlatformType3 == null) {
initialAttemptedPlatformType3 = null;
}
let initialAttemptedApplicationId2 = state3?.applicationId;
if (initialAttemptedApplicationId2 == null) {
initialAttemptedApplicationId2 = null;
}
r397[1] = <View style={styles2.connectionsChecksGroups}>
<ConnectionsChecks eligibilityStatesGroups={eligibilityStatesGroups2} onPlatformAttempt={handlePlatformAttempt} onPlatformConnect={handlePlatformConnect} onPlatformConnected={handlePlatformConnected} onPlatformIdentityAuthorize={handlePlatformIdentityAuthorize} initialAttemptedPlatformType={initialAttemptedPlatformType3} initialAttemptedApplicationId={initialAttemptedApplicationId2} />
</View>;
r397[2] = <Text variant="text-xs/normal" style={styles2.footerText} color="text-default">
{intl.format(t.gsgvxh, {
privacyPolicyUrl: MarketingURLs.PRIVACY,
onAuthorizedApplicationsClick: handleManageAuthorizedApplications,
onConnectionsClick: handleManageConnections
})}
</Text>;
r426 = <View style={styles2.content}>{r397}</View>;
} else {
r426 = <ActivityIndicator size="large" style={styles2.loading} />;
}
r228 = r426;
} else if (c6654_39.ACCOUNT_CONNECTED === state) {
Module38(state8 != null, "lastPlatformConnected is null");
const account2 = stateFromStores3.find((item) => state8 === item.type);
const applicationRoleConnection = state4 == null ? void 0 : state4.find((item) => item.application.id === state9?.id);
r228 = <View style={styles2.content}>
<View style={styles2.accountConnectedContainer}>
{account2 == null && applicationRoleConnection == null ? <ActivityIndicator size="large" style={styles2.loading} /> : <>
{account2 != null ? <>
<View style={styles2.accountConnectedPreview}>
<Text variant="eyebrow" color="text-default">
{intl.string(t.TOjkEg)}
</Text>
<ConnectedUserAccount account={account2} userId={stateFromStores} theme={theme} locale={stateFromStores4} style={styles2.accountConnectedPreviewConnectedUserAccount} showMetadata={showMetadata} showInvisibleIcon={showInvisibleIcon} />
</View>
<View style={styles2.accountConnectedPrivacy}>
<Text variant="eyebrow" color="text-default">
{intl.string(t.jndPhX)}
</Text>
<ConnectedUserAccountOptions account={account2} setShowPreviewInvisibleIcon={setShowPreviewInvisibleIcon2} setShowPreviewMetadata={setShowPreviewMetadata2} />
</View>
</> : null}
{applicationRoleConnection != null ? <View style={styles2.accountConnectedPreview}>
<Text variant="eyebrow" color="text-default">
{intl.string(t.TOjkEg)}
</Text>
<ConnectedApplicationUserRoleAccount applicationRoleConnection={applicationRoleConnection} theme={theme} locale={stateFromStores4} style={styles2.accountConnectedPreviewConnectedUserAccount} />
</View> : null}
</>}
</View>
<Text variant="text-md/normal" color="text-default">
{intl.format(t.gsgvxh, {
privacyPolicyUrl: MarketingURLs.PRIVACY,
onAuthorizedApplicationsClick: handleManageAuthorizedApplications,
onConnectionsClick: handleManageConnections
})}
</Text>
</View>;
} else {
r228 = c6654_39.ROLE_GRANTED === state ? <View style={styles2.content}>
<View style={styles2.roleGranted}>
<VerifiedRoleIcon guildId={guildId} style={styles2.verifiedIcon} role={role} size={24} />
<Text variant="text-lg/semibold" color="mobile-text-heading-primary" lineClamp={1} style={styles2.roleGrantedName}>{role.name}</Text>
</View>
<View style={styles2.channelsGranted}>
{r40.map((item) => <ChannelName key={item.id} channel={item} />)}
</View>
</View> : null;
}
r224[1] = r228;
if (c6654_39.CHECKS_REQUIRED === state) {
if (!disabled) {
disabled = !state2;
}
if (!disabled) {
disabled = state7;
}
r473 = <Button variant="primary" onPress={() => (function handleAssignRole() {
return _handleAssignRole2.apply(this, arguments);
})()} disabled={disabled} text={intl.string(t["8SuVoE"])} grow />;
} else if (c6654_39.ACCOUNT_CONNECTED === state) {
r473 = <Button variant="primary" onPress={() => setState9(c6654_39.CHECKS_REQUIRED)} text={intl.string(t.i4jeWR)} grow />;
} else {
let r433 = eligibilityStatesGroups2 == null ? void 0 : eligibilityStatesGroups2.flat().some((item) => item.application_id == null);
if (r433 == null) {
r433 = false;
}
r473 = <>
<Button variant="primary" onPress={() => {
if (onCloseModal != null) {
onCloseModal();
}
ActionSheetActionCreators.hideActionSheet();
}} text={intl.string(t.cpT0Cq)} grow />
{r433 ? <View style={styles2.manageConnectionsButton}>
<Button variant="secondary" onPress={handleManageConnections} text={intl.string(t.VXV55P)} grow />
</View> : null}
</>;
}
r224[2] = r473;
return <BottomSheet>
<View style={styles2.container}>{r224}</View>
</BottomSheet>;
};
export default GuildRoleConnectionsConnectAccountsActionSheet;
@@ -0,0 +1,23 @@
// Metro module 10014 (f10015).
import { memo, useMemo } from "react";
import { intl, t } from "../../../intl/index.native";
import { HeaderActionButton } from "../../../design/components/Navigator/native/HeaderActionButton.native";
import Module7699 from "../../../_bundle/Module7699";
import GuildRoleConnectionsScreen from "./GuildRoleConnectionsScreen";
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
const initialRouteName = "GUILD_ROLE_CONNECTIONS_SCREEN";
const r21 = memo(function({ guildId, onClose }) {
return <Navigator screens={useMemo(() => {
const guildId2 = guildId;
const onClose2 = onClose;
const r10 = {};
r10[initialRouteName] = {
title: intl.string(t.ghtnss),
headerLeft: () => null,
headerRight: () => <HeaderActionButton source={Module7699} onPress={onClose2} accessibilityLabel={intl.string(t.cpT0Cq)} />,
render: () => <GuildRoleConnectionsScreen guildId={guildId2} onCloseModal={onClose2} />
};
return r10;
}, [guildId, onClose])} initialRouteName={initialRouteName} />;
});
export default r21;
@@ -0,0 +1,24 @@
// Metro module 10013 (f10014).
import ModalActionCreators from "../../../actions/ModalActionCreators";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
let c6658_3 = "ROLE_CONNECTIONS_MODAL_KEY";
export function openGuildRoleConnectionsModal({ guildId, onClose: onClose2 }) {
ModalActionCreators.pushLazy(import("./GuildRoleConnectionsModal"), {
guildId,
onClose: function onClose() {
ModalActionCreators.popWithKey(c6658_3);
if (onClose2 != null) {
onClose2();
}
}
}, c6658_3);
}
export function makeGuildRoleConnectionsConnectAccountsActionSheetKey(a0) {
return `GuildRoleConnectionsConnectAccountsActionSheet-${a0}`;
}
export function openGuildRoleConnectionsConnectAccountModal(a0, a1) {
ActionSheetActionCreators.openLazy(import("./GuildRoleConnectionsConnectAccountsActionSheet"), `GuildRoleConnectionsConnectAccountsActionSheet-${a0.id}`, {
role: a0,
guildId: a1
});
}
@@ -0,0 +1,195 @@
// Metro module 10015 (f10016).
import { useState, useEffect } from "react";
import { Pressable, ScrollView, View } from "react-native";
import UserRecord from "../../../records/UserRecord";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import GuildRoleStore from "../../../stores/GuildRoleStore";
import { AnalyticEvents, HelpdeskArticles } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { CutoutDirection, CutoutableAvatarImage, AvatarSizes, Icon } from "../../../design/void/native";
import useTheme from "../../../hooks/useTheme";
import { useStateFromStores } from "../../../_bundle/Module589";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { collectGuildAnalyticsMetadata } from "../../app_analytics/AppAnalyticsUtils";
import GuildActionCreators from "../../../actions/GuildActionCreators";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { makeGuildRoleConnectionsConnectAccountsActionSheetKey } from "./GuildRoleConnectionsModalActionCreators";
import Platforms from "../../../lib/Platforms";
import AvatarUtils from "../../../utils/AvatarUtils";
import * as _shared from "../../../design/shared";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import Module10012 from "../../../_bundle/Module10012";
import VerifiedRoleIcon from "./VerifiedRoleIcon";
import UserSummaryItem from "../../../components_native/common/UserSummaryItem";
const useStyles = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
flex: 1
},
content: {
flexDirection: "column",
alignItems: "center",
padding: 16
},
infoText: {
marginTop: 24
},
verifiedRoles: {
marginTop: 24,
flexDirection: "column",
width: "100%"
},
verifiedRole: {
flexDirection: "row",
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 2,
borderRadius: Module712.radii.md,
paddingHorizontal: 16,
paddingVertical: 20,
marginBottom: 16,
width: "100%",
alignItems: "center",
position: "relative"
},
verifiedRoleHasRole: {
borderColor: Module712.colors.BACKGROUND_BASE_LOWEST,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
verifiedRolePressed: {
borderColor: Module712.colors.BORDER_MUTED
},
verifiedRoleIcon: {
marginRight: 12
},
roleCheckmark: {
width: 20,
height: 20,
borderRadius: 10,
backgroundColor: Module712.colors.BACKGROUND_BRAND,
position: "absolute",
right: -8,
top: -8
},
verifiedRoleName: {
flex: 1,
overflow: "hidden",
marginRight: 32
},
platformIconContainer: {
flexDirection: "row"
},
cutout: {
marginRight: -6
}
});
const cutout = {
direction: CutoutDirection.RIGHT,
radius: 8
};
export default function GuildRoleConnectionsScreen(props) {
let stateFromStores, stateFromStores2, state, setState;
const { guildId, onCloseModal } = props;
stateFromStores = void 0;
stateFromStores2 = void 0;
state = void 0;
setState = void 0;
const styles = useStyles();
let c17625_3 = useTheme();
const stateFromStores3 = useStateFromStores([GuildRoleStore], () => GuildRoleStore.getSortedRoles(guildId));
stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId());
stateFromStores2 = useStateFromStores([GuildMemberStore], () => GuildMemberStore.getMember(guildId, stateFromStores));
[state, setState] = useState([]);
useEffect(() => {
if (state.length !== 0) {
AnalyticsUtils.track(AnalyticEvents.PASSPORT_ENTRY_VIEWED, {
role_ids: state.map((item) => item.role_id),
...collectGuildAnalyticsMetadata(guildId)
});
}
}, [guildId, state]);
useEffect(() => {
GuildActionCreators.getGuildRoleConnectionsConfigurations(guildId).then((result) => setState(result));
}, [guildId]);
if (stateFromStores2 == null) {
return null;
}
const r13 = stateFromStores3.filter((item) => item.tags.guild_connections === null);
return <View style={styles.container}>
<ScrollView contentContainerStyle={styles.content}>
<Text style={styles.infoText} variant="heading-md/semibold" color="mobile-text-heading-primary">
{intl.format(t["Y+TsEV"], {
helpdeskArticleUrl: HelpdeskUtils.getArticleURL(HelpdeskArticles.CONNECTION_DETAILS)
})}
</Text>
<View style={styles.verifiedRoles}>
{r13.map((a0) => {
let c26600_2, c26600_3;
const role = a0;
const r5 = stateFromStores2.roles.includes(a0.id);
let c26599_1 = r5;
const id = a0.id;
c26600_2 = void 0;
c26600_3 = void 0;
const renderedUsers = [];
let c26600_1 = renderedUsers;
const r26 = state.find((item) => item.role_id === id);
c26600_2 = r26;
if (r26 != null) {
const set = new Set();
c26600_3 = set;
r26.rules.flat().forEach((item) => {
if (item.application_id === void 0) {
c26600_3.add(item.connection_type);
} else {
c26600_3.add(item.application_id);
}
});
Array.from(set).forEach((item, index) => {
const cutout2 = index !== c26600_3.size - 1 ? cutout : null;
if (isNaN(parseInt(item))) {
const r57 = Platforms.get(item);
const isThemeDark = _shared.isThemeDark(c17625_3);
const r70 = r57 == null;
c26600_1.push(<CutoutableAvatarImage key={item} size={AvatarSizes.XSMALL} source={AvatarUtils.makeSource(isThemeDark ? r70 ? void 0 : r57.icon.darkPNG : r70 ? void 0 : r57.icon.lightPNG)} style={styles.cutout} cutout={cutout2} />);
} else {
const bot = c26600_2.applications[item]?.bot;
if (bot !== void 0) {
c26600_1.push(<CutoutableAvatarImage key={item} size={AvatarSizes.XSMALL} user={new UserRecord(bot)} guildId={guildId} style={styles.cutout} cutout={cutout2} />);
}
}
});
}
return <Pressable key={a0.id} accessibilityRole="button" style={(a0) => [styles.verifiedRole, c26599_1 ? styles.verifiedRoleHasRole : null, a0.pressed ? styles.verifiedRolePressed : null]} onPress={() => {
if (c26599_1) {
let c30178_0 = role;
const guildId2 = guildId;
ActionSheetActionCreators.openLazy(import("./LeaveConnectionRoleActionSheet"), `LeaveConnectionRoleActionSheet-${role.id}`, {
onLeaveRolePressed: () => {
ActionSheetActionCreators.hideActionSheet();
GuildActionCreators.unassignGuildRoleConnection(guildId2, c30178_0.id);
}
});
} else {
ActionSheetActionCreators.openLazy(import("./GuildRoleConnectionsConnectAccountsActionSheet"), makeGuildRoleConnectionsConnectAccountsActionSheetKey(role.id), {
role,
guildId,
onCloseModal
});
}
}}>
{r5 ? <View style={styles.roleCheckmark}>
<Icon size={Icon.Sizes.SMALL_20} source={Module10012} color={Module712.unsafe_rawColors.WHITE} />
</View> : null}
<VerifiedRoleIcon style={styles.verifiedRoleIcon} guildId={guildId} role={a0} size={24} />
<Text variant="text-md/medium" color="mobile-text-heading-primary" lineClamp={1} style={styles.verifiedRoleName}>{a0.name}</Text>
<UserSummaryItem style={styles.platformIconContainer} users={[]} renderedUsers={renderedUsers} max={3} withNames={false} avatarSize={AvatarSizes.XSMALL} withPlusCount />
</Pressable>;
})}
</View>
</ScrollView>
</View>;
};
@@ -0,0 +1,36 @@
// Metro module 10016 (f10017).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
padding: 12
},
marginTop: {
marginTop: 8
},
button: {
marginTop: 8,
marginBottom: 16
}
});
export default function LeaveConnectionRoleActionSheet(props) {
const onLeaveRolePressed = props.onLeaveRolePressed;
const styles = useStyles();
return <BottomSheet>
<View style={styles.container}>
<Text variant="heading-lg/extrabold" color="mobile-text-heading-primary">
{intl.string(t.vytvJF)}
</Text>
<Text style={styles.marginTop} variant="text-md/normal" color="text-default">
{intl.string(t.caJwb5)}
</Text>
<View style={styles.button}>
<Button variant="destructive" onPress={onLeaveRolePressed} text={intl.string(t["+Oi4XF"])} grow />
</View>
</View>
</BottomSheet>;
};
@@ -0,0 +1,58 @@
// Metro module 10010 (f10011).
import { View } from "react-native";
import { DEFAULT_ROLE_COLOR_HEX, EMPTY_STRING_SNOWFLAKE_ID } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useRoleIcon } from "../../guild_boosting/native/RoleIconUtils";
import Module712 from "../../../_bundle/Module712";
import { getDarkness, hex2int } from "../../../_bundle/int2hslRaw";
import { Icon } from "../../../design/void/native";
import Module10011 from "../../../_bundle/Module10011";
import Module10012 from "../../../_bundle/Module10012";
const useStyles = createStyles({
verifiedCheck: {
position: "absolute",
left: 0,
top: 0
}
});
export default function OfficialConnectionIcon(props) {
const { guildId, role } = props;
let roleId = props.roleId;
let roleColor = props.roleColor;
const { size, style, displayRoleIcon } = props;
const styles = useStyles();
const r9 = {
width: size,
height: size
};
if (roleId == null) {
roleId = role?.id;
}
if (roleId == null) {
roleId = EMPTY_STRING_SNOWFLAKE_ID;
}
const roleIcon = useRoleIcon({
guildId,
roleId,
size
});
if (displayRoleIcon !== false && roleIcon != null) {
return <View style={[style, r9]}>{roleIcon}</View>;
}
if (roleColor == null) {
roleColor = role?.colorString;
}
if (roleColor == null) {
roleColor = DEFAULT_ROLE_COLOR_HEX;
}
let WHITE = Module712.unsafe_rawColors.WHITE;
const darkness = getDarkness(hex2int(roleColor));
const color = roleColor;
if (darkness < 0.3) {
WHITE = Module712.unsafe_rawColors.PRIMARY_630;
}
return <View style={[style, r9]}>
<Icon style={[styles.verifiedCheck, r9]} size={Icon.Sizes.CUSTOM} source={Module10011} color={color} />
<Icon style={[styles.verifiedCheck, r9]} size={Icon.Sizes.CUSTOM} source={Module10012} color={WHITE} />
</View>;
};
@@ -0,0 +1,57 @@
// Metro module 5559 (f5560).
import { View } from "react-native";
import { DEFAULT_ROLE_COLOR_HEX, EMPTY_STRING_SNOWFLAKE_ID } from "../../../Constants";
import Module712 from "../../../_bundle/Module712";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { getHigherContrastColor } from "../../user_profile/utils/getHigherContrastColor";
import { useRoleIcon } from "../../guild_boosting/native/RoleIconUtils";
import { LinkIcon } from "../../../design/components/Icon/native/redesign/generated/LinkIcon";
const WHITE = Module712.unsafe_rawColors.WHITE;
const PRIMARY_630 = Module712.unsafe_rawColors.PRIMARY_630;
const useStyles = createStyles({
iconContainer: {
alignItems: "center",
justifyContent: "center",
borderRadius: Module712.radii.round
}
});
export default function VerifiedRoleIcon(props) {
const { guildId, role } = props;
let roleId = props.roleId;
let roleColor = props.roleColor;
const { size, style, displayRoleIcon } = props;
const styles = useStyles();
if (roleColor == null) {
roleColor = role?.colorString;
}
if (roleColor == null) {
roleColor = DEFAULT_ROLE_COLOR_HEX;
}
const higherContrastColor = getHigherContrastColor({
backgroundColor: roleColor,
colors: [WHITE, PRIMARY_630]
});
const size2 = size - size / 8 * 2;
if (roleId == null) {
roleId = role?.id;
}
if (roleId == null) {
roleId = EMPTY_STRING_SNOWFLAKE_ID;
}
let r36 = useRoleIcon({
guildId,
roleId,
size: size2
});
if (!(displayRoleIcon !== false && r36 != null)) {
r36 = <LinkIcon style={{
width: size2,
height: size2
}} size="custom" color={higherContrastColor} />;
}
return <View style={[style, styles.iconContainer, {
width: size,
height: size,
backgroundColor: roleColor
}]}>{r36}</View>;
};
@@ -0,0 +1,6 @@
// Metro module 13995 (f13996).
import { PlatformTypes } from "../../Constants";
let c9779_0 = new Set([PlatformTypes.XBOX, PlatformTypes.PLAYSTATION, PlatformTypes.PLAYSTATION_STAGING, PlatformTypes.CRUNCHYROLL]);
export default function shouldWarnConnectedAccountTwoWay(a0) {
return c9779_0.has(a0.type) && a0.twoWayLink;
};