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

No files matched your search

@@ -0,0 +1,19 @@
// Metro module 5973 (f5974).
const r9 = {
ACTIVITY: "activity",
APP_DISCOVERY: "app_discovery",
OAUTH: "oauth",
CUSTOM_ACTIVITY_LINK: "custom_activity_link",
ACTIVITY_INVITE: "activity_invite",
ACTIVITY_INSTANCE: "activity_instance",
RICH_PRESENCE_INVITE: "rich_presence_invite",
LEGACY_RICH_PRESENCE_INVITE: "legacy_rich_presence_invite",
REQUEST_TO_STREAM: "request_to_stream",
UNKNOWN: "unknown"
};
const r20 = {
ACTIVE: "active",
DEAD: "dead"
};
export { r9 as LinkType };
export { r20 as AppMessageEmbedState };
@@ -0,0 +1,37 @@
// Metro module 12351 (f12352).
import { createAppMessageEmbed } from "./createAppMessageEmbed";
import { getOrFetchCustomActivityLink } from "../../../activities/utils/CustomActivityLinkUtils";
export function createActivityMessageEmbed({ theme, embedUrl, message, app, params }) {
const appMessageEmbed = createAppMessageEmbed({
theme,
embedUrl,
message,
app
});
if (appMessageEmbed == null) {
return null;
}
const linkId = params.linkId;
if (linkId == null) {
return appMessageEmbed;
}
const orFetchCustomActivityLink = getOrFetchCustomActivityLink(app.id, linkId);
const r24 = orFetchCustomActivityLink == null;
let r25 = null;
if (!r24) {
let staticBannerSrc = orFetchCustomActivityLink.getAssetURL();
if (staticBannerSrc == null) {
staticBannerSrc = null;
}
r25 = {
...appMessageEmbed,
title: app.name,
header: orFetchCustomActivityLink.title,
info: orFetchCustomActivityLink.description,
bannerRatio: "bot",
staticBannerSrc,
tagline: null
};
}
return r25;
}
@@ -0,0 +1,254 @@
// Metro module 11133 (f11134).
import UserStore from "../../../../stores/UserStore";
import ApplicationAssetsStore, { FetchState } from "../../ApplicationAssetsStore";
import ApplicationStore from "../../ApplicationStore";
import { AppLauncherRouteName } from "../../../app_launcher/native/AppLauncherNativeConstants";
import { CodedLinkExtendedType } from "../../../messages/native/renderer/row_data/embeds/coded_links/CodedLinksConstants";
import { fetchApplication } from "../../ApplicationActionCreators";
import { getContentClassificationVisibility, ContentClassificationVisibility } from "../../../content_classification/ContentClassificationVisibility";
import getEmbedThemeColors from "../../../messages/native/renderer/row_data/embeds/getEmbedThemeColors";
import { intl, t } from "../../../../intl/index.native";
import { AppMessageEmbedDisplayType } from "../../../messages/native/renderer/row_data/embeds/coded_links/CodedLinksTypes";
import * as _AppLauncherUtils from "../../../app_launcher/utils/AppLauncherUtils";
import { fetchAssetIds, getAssetIds, getAssetImage } from "../../../../utils/ApplicationAssetUtils";
import { canLaunchFrame } from "../../../frames/utils/canLaunchFrame";
import { getPlayInContext } from "../utils/getPlayInContext";
import { getAppIconSrc, getAppGradientColors } from "./utils/nativeAppMessageEmbedUtil";
import { getUserBannerURL } from "../../../../utils/AvatarUtils";
import URLUtils from "../../../../utils/URLUtils";
import { joinOrStartActivityInChannel } from "./utils/joinOrStartActivityInChannel";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import { launchActivityInBotDM } from "../../../app_launcher/utils/AppLauncherPlayUtils";
import { CommandOrigin } from "../../../application_commands/ApplicationCommandTypes";
import FramesActionCreators_native from "../../../frames/FramesActionCreators.native";
import { getBestActiveInput } from "../../../../utils/native/ChatInputUtils";
import { KeyboardTypes } from "../../../keyboard/native/KeyboardTypes";
import { installApplication } from "../../../../utils/native/ApplicationUtils";
import { copy } from "../../../../utils/ClipboardUtils.native";
import { presentLinkCopied } from "../../../toast/native/ToastUtils";
import { assertNever } from "../../../../utils/GlobalUtils";
const _excluded = ["embedded_cover"];
let c7521_11 = 512;
export function getAppLinkGateResult({ appId, channel, message, theme }) {
let r30;
const application = ApplicationStore.getApplication(appId);
if (application == null) {
if (ApplicationStore.isFetchingApplication(appId) === false) {
fetchApplication(appId);
}
return {
state: "unavailable"
};
}
const contentClassificationVisibility = getContentClassificationVisibility(application.contentClassification, channel, UserStore.getCurrentUser()?.nsfwAllowed);
if (contentClassificationVisibility !== ContentClassificationVisibility.DISPLAY) {
const baseColors = getEmbedThemeColors(theme).baseColors;
const info = contentClassificationVisibility === ContentClassificationVisibility.BLOCK_UNDERAGE ? intl.string(t.LPOzxB) : intl.string(t.NIZyKq);
r30 = {
state: "blocked",
model: {
...baseColors,
displayType: AppMessageEmbedDisplayType.BLOCKED,
appId: "",
messageId: message.id,
title: null,
header: intl.string(t.bZBN64),
info,
tagline: null,
iconSrc: null,
staticBannerSrc: null,
bannerRatio: "bot",
actions: [],
embedUrl: null,
extendedType: CodedLinkExtendedType.APP_MESSAGE_EMBED,
gradientColors: [],
type: null,
headerText: null
}
};
} else {
r30 = {
state: "display",
app: application
};
}
return r30;
}
export function createAppMessageEmbed({ theme, embedUrl, message, app }) {
let r150, info;
const baseColors = getEmbedThemeColors(theme).baseColors;
const channel_id = message.channel_id;
const { id, name, bot, tags, maxParticipants, icon } = app;
const isEmbeddedApp = _AppLauncherUtils.isEmbeddedApp(app);
if (isEmbeddedApp) {
const applicationAssetFetchState = ApplicationAssetsStore.getApplicationAssetFetchState(id);
if (applicationAssetFetchState === FetchState.NOT_FETCHED) {
fetchAssetIds(id, _excluded);
return null;
}
if (applicationAssetFetchState === FetchState.FETCHING) {
return null;
}
}
const tagline = maxParticipants != null && maxParticipants > 0 ? intl.formatToPlainString(t.z8EAJW, {
count: maxParticipants
}) : intl.string(t.RjceQU);
const actions = [];
if (isEmbeddedApp) {
if (canLaunchFrame(app)) {
actions.push({
id: "play_frame",
label: intl.string(t.RscU7I)
});
} else {
const playInContext = getPlayInContext(id, channel_id);
const { instanceId, isCurrentlyInInstance } = playInContext;
if (playInContext.canLaunchInChannel) {
const r87 = intl.string(t.RscU7I);
actions.push({
id: "play_in_channel",
label: isCurrentlyInInstance ? intl.string(t.DPfdsq) : instanceId != null ? intl.string(t.VJlc0S) : r87,
disabled: isCurrentlyInInstance
});
} else {
actions.push({
id: "play_in_dm",
label: intl.string(t.JeK1Wg)
});
}
}
}
L28: {
info = tags.join(" ∙ ");
const { id: id2, bot: bot2 } = app;
if (_AppLauncherUtils.isEmbeddedApp(app)) {
let r133 = getAssetIds(id2, _excluded);
if (r133 == null) {
r133 = [];
}
const [r137] = r133;
const staticBannerSrc = r137 != null ? getAssetImage(id2, r137, c7521_11) : null;
if (staticBannerSrc != null) {
r150 = {
bannerRatio: "activity",
staticBannerSrc
};
break L28;
}
}
if (bot2 != null) {
const userBannerURL = getUserBannerURL({
id: bot2.id,
banner: bot2.banner,
size: 512,
canAnimate: false
});
r150 = userBannerURL != null ? {
bannerRatio: "bot",
staticBannerSrc: userBannerURL
} : {
bannerRatio: "bot",
staticBannerSrc: null
};
} else {
r150 = {
bannerRatio: "bot",
staticBannerSrc: null
};
}
}
const iconSrc = icon != null ? getAppIconSrc(id, icon, bot) : null;
let r158 = iconSrc;
if (r158 == null) {
r158 = r150.staticBannerSrc;
}
if (r158 == null) {
r158 = void 0;
}
return {
...baseColors,
...r150,
displayType: AppMessageEmbedDisplayType.DISPLAY,
appId: app.id,
messageId: message.id,
title: null,
header: name,
info,
tagline,
iconSrc,
actions,
embedUrl,
extendedType: CodedLinkExtendedType.APP_MESSAGE_EMBED,
gradientColors: getAppGradientColors(r158),
type: null,
headerText: null
};
}
export function handleTapAppMessageEmbed(a0) {
const application = ApplicationStore.getApplication(a0.appId);
const r19 = URLUtils.toURLSafe(a0.embedUrl);
let referrerId = r19 == null ? void 0 : r19.searchParams.get("referrer_id");
if (referrerId == null) {
referrerId = a0.message.author.id;
}
let customId = r19 == null ? void 0 : r19.searchParams.get("custom_id");
if (customId == null) {
customId = void 0;
}
const actionId = a0.actionId;
if (actionId === "play_in_channel") {
joinOrStartActivityInChannel({
appId: a0.appId,
channelId: a0.message.channel_id,
analyticsLocations: [AnalyticsLocation.APP_MESSAGE_EMBED],
referrerId,
customId
});
} else if (actionId === "play_in_dm") {
if (application?.bot == null) {
return void 0;
}
launchActivityInBotDM({
appId: a0.appId,
botId: application.bot.id,
analyticsLocations: [AnalyticsLocation.APP_MESSAGE_EMBED],
commandOrigin: CommandOrigin.APP_MESSAGE_EMBED,
referrerId,
customId
});
} else if (actionId === "play_frame") {
FramesActionCreators_native.launchFrame({
applicationId: a0.appId
});
} else if (actionId === "view_in_app_launcher") {
const bestActiveInput = getBestActiveInput();
if (bestActiveInput != null) {
bestActiveInput.openCustomKeyboard({
type: KeyboardTypes.APP_LAUNCHER,
context: {
initialRouteName: AppLauncherRouteName.APPLICATION_VIEW,
initiallyExpanded: true,
applicationId: a0.appId,
referrerId,
customId
}
});
}
} else if (actionId === "add_app") {
if (application == null) {
return void 0;
}
installApplication({
applicationId: application.id,
customInstallUrl: application.customInstallUrl,
installParams: application.installParams,
integrationTypesConfig: application.integrationTypesConfig,
source: "app_message_embed"
});
} else if (actionId === "link_copied") {
copy(a0.embedUrl);
presentLinkCopied();
} else {
assertNever(a0.actionId);
}
}
@@ -0,0 +1,68 @@
// Metro module 11139 (f11140).
import EmbeddedActivitiesStore from "../../../../activities/EmbeddedActivitiesStore";
import ChannelStore from "../../../../../stores/ChannelStore";
import SelectedChannelStore from "../../../../../stores/SelectedChannelStore";
import transitionToActivity_native from "../../../../activities/utils/transitionToActivity.native";
import { runPrimaryAppCommandOrJoinEmbeddedActivity } from "../../../../activities/EmbeddedActivitiesActionCreators";
import getEmbeddedActivitiesManager_native from "../../../../activities/utils/getEmbeddedActivitiesManager.native";
function $mk116157($env) {
return (a0) => a0.applicationId === $env[0];
}
export async function joinOrStartActivityInChannel(c26947_0) {
let r123;
let guild_id, c26947_2, c26947_3;
L22: {
L18: {
let env30359;
c26947_3 = void 0;
const r10 = env30359 = {};
c26947_2 = r10;
env30359[0] = void 0;
env30359[1] = void 0;
env30359[2] = void 0;
env30359[3] = void 0;
env30359[4] = void 0;
env30359[0] = c26947_0.appId;
env30359[1] = c26947_0.channelId;
env30359[2] = c26947_0.analyticsLocations;
env30359[3] = c26947_0.customId;
env30359[4] = c26947_0.referrerId;
env30359[5] = void 0;
env30359[6] = void 0;
env30359[7] = void 0;
env30359[8] = void 0;
env30359[9] = void 0;
env30359[10] = void 0;
await void 0;
env30359[5] = EmbeddedActivitiesStore.getSelfEmbeddedActivityForChannel(env30359[1]);
env30359[6] = SelectedChannelStore.getVoiceChannelId();
const applicationId = env30359[5]?.applicationId;
const r61 = c26947_2;
if (applicationId === env30359[0] && env30359[6] === env30359[1]) {
env30359[7] = ChannelStore.getChannel(env30359[1]);
const guild_id2 = env30359[7]?.guild_id;
guild_id = guild_id2;
if (guild_id2 == null) {
guild_id = null;
}
env30359[8] = guild_id;
transitionToActivity_native(env30359[8], env30359[5].location);
break L18;
}
env30359[9] = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(env30359[1]).filter($mk116157(r61));
env30359[10] = env30359[9].length > 0 ? env30359[9][0].compositeInstanceId : void 0;
r123 = await runPrimaryAppCommandOrJoinEmbeddedActivity({
channelId: env30359[1],
applicationId: env30359[0],
isStart: env30359[10] == null,
embeddedActivitiesManager: getEmbeddedActivitiesManager_native(),
analyticsLocations: env30359[2],
customId: env30359[3],
referrerId: env30359[4]
});
break L22;
}
return true;
}
return r123;
}
@@ -0,0 +1,32 @@
// Metro module 11138 (f11139).
import { hexToRgba } from "../../../../../utils/ColorUtils";
import Module712 from "../../../../../_bundle/Module712";
import { hasFetchedColors, maybeFetchColors } from "../../../../avatar/useAvatarColor";
import { getHeroColors } from "../../../../content_inventory/memberlist/useHeroColors";
import AvatarUtils from "../../../../../utils/AvatarUtils";
let c7525_3 = "#000000";
let c7525_4 = [hexToRgba(Module712.unsafe_rawColors.PRIMARY_760), hexToRgba(Module712.unsafe_rawColors.PRIMARY_760)];
export function getAppGradientColors(a0) {
if (a0 == null) {
return c7525_4;
}
if (hasFetchedColors(a0)) {
const heroColors = getHeroColors(a0);
const { primaryColor, secondaryColor } = heroColors;
return (primaryColor === c7525_3 && secondaryColor === c7525_3) === false ? [hexToRgba(primaryColor), hexToRgba(secondaryColor)] : c7525_4;
}
maybeFetchColors(a0);
return c7525_4;
}
export function getAppIconSrc(a0, a1, a2) {
let r11 = AvatarUtils.getApplicationIconURL({
id: a0,
icon: a1,
bot: a2,
fallbackAvatar: false
});
if (r11 == null) {
r11 = null;
}
return r11;
}
@@ -0,0 +1,22 @@
// Metro module 5976 (f5977).
import URLUtils from "../../../../utils/URLUtils";
export function extractActivityBookmarkParams(a0) {
const r13 = URLUtils.toURLSafe(a0);
let referrerId = r13 == null ? void 0 : r13.searchParams.get("referrer_id");
if (referrerId == null) {
referrerId = void 0;
}
let customId = r13 == null ? void 0 : r13.searchParams.get("custom_id");
if (customId == null) {
customId = void 0;
}
let linkId = r13 == null ? void 0 : r13.searchParams.get("link_id");
if (linkId == null) {
linkId = void 0;
}
return {
referrerId,
customId,
linkId
};
}
@@ -0,0 +1,51 @@
// Metro module 11136 (f11137).
import EmbeddedActivitiesStore from "../../../activities/EmbeddedActivitiesStore";
import SelectedChannelStore from "../../../../stores/SelectedChannelStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useEmbeddedActivityLaunchability, EmbeddedActivityLaunchability, getEmbeddedActivityLaunchabilityForChannel } from "../../../activities/utils/getEmbeddedActivityLaunchability";
export function usePlayInContext(c18554_0) {
const stateFromStores = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getChannelId());
const stateFromStores2 = useStateFromStores([EmbeddedActivitiesStore], () => {
if (stateFromStores == null) {
return null;
}
const r11 = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(stateFromStores).filter((item) => item.applicationId === c18554_0);
return r11.length > 0 ? r11[0] : void 0;
});
const compositeInstanceId = stateFromStores2?.compositeInstanceId;
const location2 = stateFromStores2?.location;
const stateFromStores3 = useStateFromStores([EmbeddedActivitiesStore], () => EmbeddedActivitiesStore.getCurrentEmbeddedActivity());
return {
currentChannelId: stateFromStores,
instanceId: compositeInstanceId,
instanceLocation: location2,
isCurrentlyInInstance: compositeInstanceId != null && stateFromStores3?.compositeInstanceId === compositeInstanceId,
canLaunchInChannel: useEmbeddedActivityLaunchability(stateFromStores) === EmbeddedActivityLaunchability.CAN_LAUNCH
};
}
export function getPlayInContext(c18555_0, a1) {
const currentChannelId = a1 == null ? SelectedChannelStore.getChannelId() : a1;
if (currentChannelId == null) {
return {
currentChannelId: null,
instanceId: null,
instanceLocation: null,
isCurrentlyInInstance: false,
canLaunchInChannel: false
};
}
const r19 = currentChannelId != null ? getEmbeddedActivityLaunchabilityForChannel(currentChannelId) : EmbeddedActivityLaunchability.NO_CHANNEL;
const CAN_LAUNCH = EmbeddedActivityLaunchability.CAN_LAUNCH;
const r33 = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(currentChannelId).filter((item) => item.applicationId === c18555_0);
const r36 = r33.length > 0 ? r33[0] : void 0;
const compositeInstanceId = r36?.compositeInstanceId;
const location2 = r36?.location;
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
return {
currentChannelId,
instanceId: compositeInstanceId,
instanceLocation: location2,
isCurrentlyInInstance: compositeInstanceId != null && currentEmbeddedActivity?.compositeInstanceId === compositeInstanceId,
canLaunchInChannel: r19 === CAN_LAUNCH
};
}
@@ -0,0 +1,79 @@
// Metro module 5978 (f5979).
import { useRef } from "react";
import { AnalyticEvents } from "../../../../Constants";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { trackingConfigWithDefaults } from "./appMessageEmbedTrackingConfig";
import { useIsVisible } from "../../../../_bundle/Module5980";
const r18 = {
VIEW: "view",
PLAY: "play",
CLOUD_PLAY: "cloud_play",
JOIN: "join",
ADD_APP: "add_app",
JOIN_SERVER: "join_server",
INVITE: "invite",
SYNC: "sync",
CONTENT: "content",
BANNER: "banner",
STREAM: "stream",
CONNECT_ACCOUNT: "connect_account"
};
export { r18 as ClickArea };
export function trackAppEmbedClick(a0) {
const { applicationId, linkType, area } = a0;
AnalyticsUtils.track(AnalyticEvents.APP_EMBED_CLICKED, {
application_id: applicationId,
link_type: linkType,
area,
referrer_id: a0.referrerId,
custom_id: a0.customId,
is_dead_end: a0.isDeadEnd,
message_id: a0.messageId
});
}
export function trackAppEmbedViewed(a0) {
const { appId, linkType, referrerId, customId } = a0;
AnalyticsUtils.track(AnalyticEvents.APP_EMBED_VIEWED, {
application_id: appId,
link_type: linkType,
referrer_id: referrerId,
custom_id: customId,
guild_id: a0.guildId,
channel_id: a0.channelId,
message_id: a0.messageId,
app_embed_state: a0.appEmbedState
});
}
export function useTrackAppEmbedViewed(a0) {
let c15339_0 = trackingConfigWithDefaults(a0);
const ref = useRef(false);
return useIsVisible((a0) => {
const current = ref.current;
if (current ? !current : a0) {
ref.current = true;
const onView = c15339_0.onView;
if (onView != null) {
onView.call(c15339_0);
}
const { id, linkType, referrerId, activityCustomId } = c15339_0;
AnalyticsUtils.track(AnalyticEvents.APP_EMBED_VIEWED, {
application_id: id,
link_type: linkType,
referrer_id: referrerId,
custom_id: activityCustomId,
guild_id: c15339_0.guildId,
channel_id: c15339_0.channelId,
message_id: c15339_0.messageId,
app_embed_state: c15339_0.appEmbedState
});
}
}, void 0);
}
export function trackAppEmbedLinkSent(a0, a1, a2, a3) {
AnalyticsUtils.track(AnalyticEvents.APP_EMBED_LINK_SENT, {
application_id: a0,
link_type: a1,
referrer_id: a2,
custom_id: a3
});
}
@@ -0,0 +1,40 @@
// Metro module 5979 (f5980).
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import { LinkType } from "../MessageEmbedConstants";
export function trackingConfigWithDefaults(a0) {
let id = a0?.id;
if (id == null) {
id = "0";
}
let linkType = a0?.linkType;
if (linkType == null) {
linkType = LinkType.UNKNOWN;
}
let referrerId = a0?.referrerId;
if (referrerId == null) {
referrerId = AuthenticationStore.getId();
}
const activityCustomId = a0?.activityCustomId;
const onView = a0?.onView;
const onLinkCopied = a0?.onLinkCopied;
const guildId = a0?.guildId;
const channelId = a0?.channelId;
const messageId = a0?.messageId;
let isDeadEnd = a0?.isDeadEnd;
if (isDeadEnd == null) {
isDeadEnd = false;
}
return {
id,
linkType,
referrerId,
activityCustomId,
onView,
onLinkCopied,
guildId,
channelId,
messageId,
isDeadEnd,
appEmbedState: a0?.appEmbedState
};
}