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,21 @@
// Metro module 8008 (f8009).
import { processColor } from "react-native";
import { DEFAULT_ROLE_COLOR_HEX } from "../../../../../Constants";
import Module712 from "../../../../../_bundle/Module712";
import { getDarkness, hex2int } from "../../../../../_bundle/int2hslRaw";
export function createConnectionsRoleTag(a0) {
let colorString = a0.colorString;
if (colorString == null) {
colorString = DEFAULT_ROLE_COLOR_HEX;
}
let WHITE = Module712.unsafe_rawColors.WHITE;
if (getDarkness(hex2int(colorString)) < 0.3) {
WHITE = Module712.unsafe_rawColors.PRIMARY_630;
}
return {
id: a0.id,
name: a0.name,
backgroundColor: processColor(colorString),
iconColor: processColor(WHITE)
};
}
@@ -0,0 +1,34 @@
// Metro module 12391 (f12392).
import ExplicitMediaStore from "../../../../explicit_media_redaction/ExplicitMediaStore";
import { getCtaButtonType, CtaButtonType } from "../../../CtaButtonUtils";
import * as _AgeVerificationUtils from "../../../../age_assurance/AgeVerificationUtils";
import { intl, t } from "../../../../../intl/index.native";
export function createCtaButton(a0, a1, a2) {
const ctaButtonType = getCtaButtonType(a0, a1);
const isAgeVerified = _AgeVerificationUtils.isAgeVerified();
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
if (CtaButtonType.MARK_AS_FALSE_POSITIVE === ctaButtonType) {
return {
text: intl.string(t["4q1Elf"]),
textColor: a2.reportFpTextColor,
backgroundColor: a2.reportFpBackgroundColor,
callback: ExplicitMediaStore.canSubmitFpReport(a0) ? CtaButtonType.MARK_AS_FALSE_POSITIVE : void 0
};
}
if (CtaButtonType.AGE_VERIFICATION_RETRY === ctaButtonType) {
return {
text: isAgeVerified ? intl.string(t["9KiIz6"]) : intl.string(t["/nicWo"]),
textColor: a2.retryTextColor,
backgroundColor: a2.retryBackgroundColor,
callback: shouldShowTiggerPawtect ? CtaButtonType.AGE_VERIFICATION_RETRY : void 0
};
}
if (CtaButtonType.CONNECT_TO_TEEN === ctaButtonType) {
return {
text: intl.string(t.n8a49k),
textColor: a2.retryTextColor,
backgroundColor: a2.retryBackgroundColor,
callback: CtaButtonType.CONNECT_TO_TEEN
};
}
}
@@ -0,0 +1,40 @@
// Metro module 7860 (f7861).
import GuildAutomodMessageStore from "../../../../guild_automod/GuildAutomodMessageStore";
import { HelpdeskArticles, MessageFlags } from "../../../../../Constants";
import { getEphemeralReasonMessage } from "../../../../application_commands/ApplicationCommandUserAppUtils";
import { intl, t } from "../../../../../intl/index.native";
import HelpdeskUtils from "../../../../../utils/HelpdeskUtils";
export function createEphemeralIndication(a0) {
if (a0.hasFlag(MessageFlags.EPHEMERAL)) {
if (a0.interactionMetadata?.ephemerality_reason != null) {
return {
content: intl.formatToParts(t.xgCMRQ, {
handleDelete: {
action: "bindDismissMessage",
message: a0
},
reason: getEphemeralReasonMessage(a0.interactionMetadata?.ephemerality_reason)
}),
helpArticleLink: HelpdeskUtils.getArticleURL(HelpdeskArticles.USING_APPS_FAQ),
helpButtonAccessibilityLabel: intl.string(t.OIWSJe)
};
}
const r25 = {
content: intl.formatToParts(t.uX3ecL, {
count: 1,
countMessages: 1,
handleDelete: {
action: "bindDismissMessage",
message: a0
}
}),
helpArticleLink: HelpdeskUtils.getAppsSupportURL(HelpdeskArticles.EPHEMERAL_MESSAGES),
helpButtonAccessibilityLabel: intl.string(t.htHOrp)
};
if (GuildAutomodMessageStore.getMessage(a0.id) != null) {
r25.helpArticleLink = HelpdeskUtils.getArticleURL(HelpdeskArticles.GUILD_AUTOMOD_BLOCKED_MESSAGE);
r25.helpButtonAccessibilityLabel = intl.string(t.OiCBhP);
}
return r25;
}
}
@@ -0,0 +1,103 @@
// Metro module 7731 (f7732).
import { HelpdeskArticles } from "../../../../../Constants";
import { getAssetUriForEmbed } from "../EmbedUtils";
import Module4142 from "../../../../../_bundle/Module4142";
import Module7732 from "../../../../../_bundle/Module7732";
import SentryUtils_native from "../../../../../utils/SentryUtils.native";
import Module4134 from "../../../../../_bundle/Module4134";
import { intl, t } from "../../../../../intl/index.native";
import HelpdeskUtils from "../../../../../utils/HelpdeskUtils";
import Module7733 from "../../../../../_bundle/Module7733";
import Module7734 from "../../../../../_bundle/Module7734";
import * as _AccessibilityLabelOptimizationExperiment from "../../../../a11y/native/AccessibilityLabelOptimizationExperiment";
import AvatarUtils from "../../../../../utils/AvatarUtils";
import { getAccessibleEmojiDisplayName } from "../../../../reactions/ReactionUtils";
import EmojiUtils from "../../../../../utils/EmojiUtils";
export function createDefaultReaction(a0) {
let emoji;
L14: {
const { defaultReactionEmoji, customGuildEmoji } = a0;
const shouldSkipAccessibilityLabels = _AccessibilityLabelOptimizationExperiment.shouldSkipAccessibilityLabels();
const r2 = defaultReactionEmoji != null;
emoji = void 0;
if (r2) {
const { emojiId, emojiName } = defaultReactionEmoji;
if (emojiId != null && customGuildEmoji != null) {
let name = customGuildEmoji.name;
if (name == null) {
name = "";
}
emoji = {
id: emojiId,
name: void 0,
animated: customGuildEmoji.animated,
src: AvatarUtils.getEmojiURL({
id: emojiId,
animated: customGuildEmoji.animated,
size: 48
}),
displayName: shouldSkipAccessibilityLabels ? name : getAccessibleEmojiDisplayName(false, 0, {
id: emojiId,
name,
animated: customGuildEmoji.animated
})
};
break L14;
}
const r21 = emojiName != null;
emoji = void 0;
if (r21) {
let name2 = emojiName;
if (name2 == null) {
name2 = "";
}
emoji = {
id: void 0,
name: emojiName,
animated: false,
src: EmojiUtils.getURL(emojiName),
displayName: shouldSkipAccessibilityLabels ? name2 : getAccessibleEmojiDisplayName(false, 0, {
id: void 0,
name: name2,
animated: false
})
};
}
}
}
return emoji != null ? {
emoji,
me: false,
count: 0
} : void 0;
}
export function createForumPostActions({ isFollowing, hasReactions, defaultReaction, showMediaPostSharePrompt }) {
const followIcon = isFollowing ? getAssetUriForEmbed(Module4142) : getAssetUriForEmbed(Module7732);
if (followIcon == null) {
SentryUtils_native.captureMessage(`Forum follow is null. isFollowing: ${isFollowing} icon: ${isFollowing ? Module4142 : Module7732}`);
}
const assetUriForEmbed = getAssetUriForEmbed(Module4134);
const addReactLabel = hasReactions ? void 0 : defaultReaction?.emoji != null ? void 0 : intl.string(t.xpOyTO);
const sharePrompt = showMediaPostSharePrompt ? {
title: intl.string(t["5uAO7d"]),
subtitle: intl.formatToParts(t.YtCu5p, {
helpArticleUrl: {
url: HelpdeskUtils.getCreatorSupportArticleURL(HelpdeskArticles.MEDIA_CHANNEL)
}
}),
cta: intl.string(t.C5UQC9),
icon: getAssetUriForEmbed(Module7733),
closeIcon: getAssetUriForEmbed(Module7734)
} : void 0;
return {
numDisplayedReactions: 3,
isFollowing,
followIcon,
followLabel: isFollowing ? intl.string(t["OtF+lC"]) : intl.string(t["0rQinA"]),
shareIcon: assetUriForEmbed,
shareLabel: intl.string(t.Ej3B3Y),
defaultReaction,
addReactLabel,
sharePrompt
};
}
@@ -0,0 +1,24 @@
// Metro module 8009 (f8010).
import { NotificationTypes } from "../../../../push_notifications/PushNotificationConstants";
import { t, intl } from "../../../../../intl/index.native";
import { getAssetUriForEmbed } from "../EmbedUtils";
import { isThemeDark } from "../../../../../design/shared";
import Module8010 from "../../../../../_bundle/Module8010";
import Module8011 from "../../../../../_bundle/Module8011";
export function createSurveyIndication(a0, a1, a2) {
let notificationType = a2;
const r10 = a2 === NotificationTypes.TOP_MESSAGE_PUSH ? t.GwWhce : t["46+Iqc"];
if (a2 == null) {
notificationType = NotificationTypes.TOP_MESSAGE_PUSH;
}
return {
content: intl.formatToParts(r10, {
handleMessage: {
action: "bindUserSurvey",
message: a0,
notificationType
}
}),
feedbackIconUrl: getAssetUriForEmbed(isThemeDark(a1) ? Module8010 : Module8011)
};
}
@@ -0,0 +1,33 @@
// Metro module 8006 (f8007).
import { Image as Image2 } from "react-native";
import ChannelStore from "../../../../../stores/ChannelStore";
import PermissionStore from "../../../../../stores/PermissionStore";
import VoiceStateStore from "../../../../../stores/VoiceStateStore";
import { Permissions } from "../../../../../Constants";
import { getVoiceChannelBadgeExperiment } from "../../../../channel/VoiceChannelBadgeExperiment";
import { getChannelIcon } from "../../../../../utils/native/ChannelUtils";
import { shouldAgeVerifyForAgeGate, shouldShowAgeGateForChannelId } from "../../../../age_gate/AgeGateUtils";
export function createVoiceChannelBadge(a0, a1) {
if (getVoiceChannelBadgeExperiment({
guildId: a1 == null ? void 0 : a1,
location: "VoiceChannelBadgeNative"
}).enabled && a1 != null) {
const discoverableVoiceState = VoiceStateStore.getDiscoverableVoiceState(a1, a0);
if (discoverableVoiceState != null) {
const channel = ChannelStore.getChannel(discoverableVoiceState?.channelId);
if (channel != null) {
const uri = Image2.resolveAssetSource(getChannelIcon(channel))?.uri;
if (uri != null) {
const r34 = shouldAgeVerifyForAgeGate() && shouldShowAgeGateForChannelId(channel.id);
const r40 = channel.isPrivate() || PermissionStore.can(Permissions.VIEW_CHANNEL, channel) && PermissionStore.can(Permissions.CONNECT, channel);
if (!r34 && r40) {
return {
channelId: channel.id,
channelIconUrl: uri
};
}
}
}
}
}
}
@@ -0,0 +1,410 @@
// Metro module 12371 (f12372).
import ApplicationStore from "../../../../../applications/ApplicationStore";
import SpotifyStore from "../../../../../spotify/SpotifyStore";
import { SpotifyApplication } from "../../../../../../records/SpotifyApplicationRecord";
import UserRecord from "../../../../../../records/UserRecord";
import AuthenticationStore from "../../../../../../stores/AuthenticationStore";
import GamePartyStore from "../../../../../../stores/GamePartyStore";
import LocalActivityStore from "../../../../../../stores/LocalActivityStore";
import MessageStore from "../../../../../../stores/MessageStore";
import PresenceStore from "../../../../../../stores/PresenceStore";
import SelfPresenceStore from "../../../../../../stores/SelfPresenceStore";
import UserStore from "../../../../../../stores/UserStore";
import ActivityLauncherStore from "../../../../../../stores/views/ActivityLauncherStore";
import { ActivityActionStates, ActivityActionTypes, ActivityTypes } from "../../../../../../Constants";
import { SPOTIFY_PLATFORM_NAME, isSpotifyParty } from "../../../../../spotify/SpotifyConstants";
import { fetchApplication } from "../../../../../applications/ApplicationActionCreators";
import { getRemoteJoinFooterLabel } from "../../../../../activities/utils/getRemoteJoinFooterLabel";
import { intl, t } from "../../../../../../intl/index.native";
import { getContentClassificationVisibility, ContentClassificationVisibility } from "../../../../../content_classification/ContentClassificationVisibility";
import { getApplicationFromMessage } from "../../../../../activities/utils/getApplicationFromMessage";
import isInviteActive from "../../../../../activities/utils/isInviteActive";
import { getIsAskToJoin } from "../../../../../activities/utils/getIsAskToJoin";
import { getAssetImage } from "../../../../../../utils/ApplicationAssetUtils";
import { getRequestToStreamText, getHeaderText, getPartyText, getDeadGameInviteText } from "../../../../../activities/utils/InviteEmbedTextUtils";
import { getPartySize } from "../../../../../activities/utils/getPartySize";
import { getCurrentActivityGamePlatform } from "../../../../../activities/utils/isActivityJoinableOnCurrentPlatform";
import getCurrentUserPresenceActivity from "../../../../../activities/utils/getCurrentUserPresenceActivity";
import { getIsInParty } from "../../../../../activities/utils/getIsInParty";
import { getCanSendInvite } from "../../../../../activities/utils/getCanSendInvite";
import { canLaunchFrame } from "../../../../../frames/utils/canLaunchFrame";
import { isEmbeddedApp } from "../../../../../app_launcher/utils/AppLauncherUtils";
import { getCanJoin } from "../../../../../activities/utils/getCanJoin";
import { formatActiveTimestamp } from "../../../../../content_inventory/utils";
import { getAppIconSrc, getAppGradientColors } from "../../../../../applications/message_embed/native/utils/nativeAppMessageEmbedUtil";
import getCoverImageFromActivity from "../../../../../activities/utils/getCoverImageFromActivity";
import { isMostRecentDeadEndInvite } from "../../../../../activities/utils/isMostRecentDeadEndInvite";
import { getSupportsRemoteJoin } from "../../../../../activities/utils/getSupportsRemoteJoin";
import { getShouldShowAppAuthPrompt } from "../../../../../application_account_linking/native/getShouldShowAppAuthPrompt";
import { ACTIVITY_GAME_PLATFORM_TO_ICON_KEY, getJoinFromSupportedPlatformsIconKeys } from "../../../../../activities/utils/useJoinFromSupportedPlatformsIconKeys";
import { getPresenceActivityInviteCoverImageURL } from "../../../../../activities/utils/usePresenceActivityInviteCoverImageURL";
import getRequestToStreamCTAAndIsDisabled from "../../../../../request_to_stream/native/getRequestToStreamCTAAndIsDisabled";
import RequestToStream_messages from "../../../../../request_to_stream/RequestToStream.messages";
let $mk89734 = function() {
return (a0) => a0.type === ActivityTypes.LISTENING;
};
let c8542_20 = {
ACTIVE: "active",
DEAD: "dead",
DEAD_COMPACT: "dead_compact",
BLOCKED: "blocked"
};
export { c8542_20 as EmbedDisplayType };
export function createActivityRichPresenceInviteEmbed(a0, a1) {
let r7, r28, r359, r576, ctaButtonEnabled, ctaButtonIsLoading, ctaButtonText, detailsText, footerLabel2, headerText2, iconSrc, partyMemberAvatarURIs, partySizeText, platformIconKeys, presenceActivity, subtitle, title;
if (a0.author != null && a0.activity != null && a1 != null) {
const contentClassificationVisibility = getContentClassificationVisibility(a0.application?.content_classification, a1, UserStore.getCurrentUser()?.nsfwAllowed);
if (ContentClassificationVisibility.DISPLAY === contentClassificationVisibility) {
let c19810_0 = a1;
const applicationFromMessage = getApplicationFromMessage(a0);
const id = a0.application?.id;
let application = id != null ? ApplicationStore.getApplication(id) : null;
if (application == null && id != null && ApplicationStore.isFetchingApplication(id) === false) {
fetchApplication(id, false);
}
if (application == null) {
application = applicationFromMessage;
}
const id2 = AuthenticationStore.getId();
if (a0.application != null) {
const id3 = a0.author.id;
presenceActivity = PresenceStore.getApplicationActivity(a0.activity?.type === ActivityActionTypes.JOIN_REQUEST ? id3 === id2 ? a1.isPrivate() ? a1.getRecipientId() : id2 : id2 : a0.activity?.type === ActivityActionTypes.STREAM_REQUEST ? id2 : id3, a0.application.id);
} else {
presenceActivity = PresenceStore.findActivity(a0.author.id, $mk89734());
}
const r163 = application != null;
let r164 = void 0;
if (r163) {
if (a0.activity?.type === ActivityActionTypes.STREAM_REQUEST) {
const iconSrc2 = application.icon != null ? getAppIconSrc(application.id, application.icon, application.bot) : null;
let r564 = iconSrc2;
if (r564 == null) {
r564 = void 0;
}
const appGradientColors2 = getAppGradientColors(r564);
const id6 = AuthenticationStore.getId();
if (a0.application != null) {
const id7 = a0.author.id;
r576 = PresenceStore.getApplicationActivity(a0.activity?.type === ActivityActionTypes.JOIN_REQUEST ? id7 === id6 ? a1.isPrivate() ? a1.getRecipientId() : id6 : id6 : a0.activity?.type === ActivityActionTypes.STREAM_REQUEST ? id6 : id7, a0.application.id);
} else {
r576 = PresenceStore.findActivity(a0.author.id, $mk89734());
}
const isInviteActive3 = isInviteActive(r576, a0, application.id);
const requestToStreamText = getRequestToStreamText(a0, a1, AuthenticationStore.getId());
const requestToStreamCTAAndIsDisabled = getRequestToStreamCTAAndIsDisabled(a0);
r164 = {
displayType: isInviteActive3 ? c8542_20.ACTIVE : c8542_20.DEAD,
ctaButtonEnabled: !requestToStreamCTAAndIsDisabled.isDisabled,
ctaButtonText: requestToStreamCTAAndIsDisabled.text,
ctaButtonIsLoading: false,
footerLabel: null,
gradientColors: appGradientColors2,
headerText: intl.string(RequestToStream_messages.nAyuPp),
iconSrc: iconSrc2,
isSpotifyParty: false,
isPlatformSupported: true,
maxPartySize: 0,
partyMemberAvatarURIs: null,
partySizeText: null,
platformIconKeys: [],
coverImageUrl: null,
detailsText: null,
subtitle: requestToStreamText,
title: application.name
};
} else {
const isInviteActive2 = isInviteActive(presenceActivity, a0, application.id);
const r173 = !isInviteActive2;
const isAskToJoin = getIsAskToJoin(a0);
let appName = a0.activity?.name_override;
if (appName == null) {
appName = application.name;
}
let r43 = a0.activity?.icon_override != null ? getAssetImage(application.id, a0.activity.icon_override) : null;
const headerText = getHeaderText(appName, a0.activity?.type, r173);
if (presenceActivity != null && presenceActivity.party != null) {
const r195 = Array;
let r200 = GamePartyStore.getParty(presenceActivity.party.id);
if (r200 == null) {
r200 = [];
}
r28 = r195.from(r200);
} else {
r28 = [];
}
let maxPartySize = getPartySize(presenceActivity).maxPartySize;
const currentActivityGamePlatform = getCurrentActivityGamePlatform();
const currentUserPresenceActivity = getCurrentUserPresenceActivity(LocalActivityStore, SelfPresenceStore, application.id);
const isInParty = getIsInParty(currentUserPresenceActivity, presenceActivity);
const canSendInvite = getCanSendInvite(presenceActivity, a0, application, id2);
const r220 = Set;
let r222 = presenceActivity?.supported_platforms;
if (r222 == null) {
r222 = [];
}
const isGameLaunchable = new r220(r222).has(currentActivityGamePlatform);
const canLaunchFrame2 = canLaunchFrame(application);
const canJoin2 = getCanJoin({
presenceActivity,
currentUserPresenceActivity,
currentUserId: id2,
message: a0,
application,
isEmbeddedApplication: isEmbeddedApp(application),
isFrameApplication: canLaunchFrame2,
isGameLaunchable
});
const { canJoin, remoteJoinPlatform } = canJoin2;
const isSpotifyParty2 = isSpotifyParty(presenceActivity == null ? void 0 : presenceActivity.party?.id) || application.id === SpotifyApplication.id;
let start = presenceActivity == null ? void 0 : presenceActivity.timestamps?.start;
if (start == null) {
start = presenceActivity?.created_at;
}
const end = presenceActivity == null ? void 0 : presenceActivity.timestamps?.end;
const r40 = start != null ? formatActiveTimestamp({
start,
end
}, Date.now()) : "";
if (r43 == null) {
r43 = application.icon != null ? getAppIconSrc(application.id, application.icon, application.bot) : null;
}
L160: {
if (isSpotifyParty2) {
const r435 = presenceActivity != null && (presenceActivity.details != null && presenceActivity.state != null) ? intl.formatToPlainString(t.JCvHtx, {
track: presenceActivity.details,
artist: presenceActivity.state
}).replace("\n", " ") : application.name;
const r459 = intl.string(t.sTo7s3);
if (isInviteActive2) {
let r471 = getCoverImageFromActivity(presenceActivity, application.id);
if (r471 == null) {
r471 = void 0;
}
const author = a0.author;
const hasConnectedAccount = SpotifyStore.hasConnectedAccount();
const syncingWith = SpotifyStore.getSyncingWith();
const activity = SpotifyStore.getActivity();
const id4 = author.id;
const id5 = AuthenticationStore.getId();
const r485 = activity?.party != null && (presenceActivity == null ? void 0 : presenceActivity.party?.id) === activity.party.id;
const r8 = syncingWith?.userId != null && syncingWith?.userId === author.id;
const r505 = intl.string(t.VJlc0S);
const r516 = hasConnectedAccount ? (r8 ? r8 : r485) ? intl.string(t.KC26NR) : r505 : intl.formatToPlainString(t.XWSHTb, {
platform: SPOTIFY_PLATFORM_NAME
});
ctaButtonEnabled = !(id4 === id5 || r8 || r485);
r7 = false;
title = r435;
iconSrc = r471;
subtitle = r40;
detailsText = null;
partySizeText = "";
partyMemberAvatarURIs = null;
ctaButtonIsLoading = false;
headerText2 = headerText;
footerLabel2 = r459;
ctaButtonText = r516;
} else {
subtitle = intl.string(t["84qx9r"]);
title = application.name;
r7 = false;
iconSrc = r43;
detailsText = null;
partySizeText = "";
partyMemberAvatarURIs = null;
ctaButtonIsLoading = false;
ctaButtonEnabled = false;
headerText2 = headerText;
footerLabel2 = r459;
ctaButtonText = void 0;
}
} else if (isInviteActive2) {
const r330 = r28.map((item) => {
let r7 = UserStore.getUser(item);
if (r7 == null) {
r7 = new UserRecord({
discriminator: "0005"
});
}
return String(r7 == null ? void 0 : r7.getAvatarURL(c19810_0.guild_id, 64));
});
const partyText = getPartyText({
maxPartySize,
partySize: r28.length,
activityActionType: a0.activity?.type
});
const details = presenceActivity?.details;
const r341 = details != null && details !== "" ? details : null;
L122: {
const supportsRemoteJoin = getSupportsRemoteJoin(presenceActivity);
const shouldShowAppAuthPrompt = getShouldShowAppAuthPrompt(application);
if (canJoin) {
const footerLabel3 = remoteJoinPlatform != null ? getRemoteJoinFooterLabel(remoteJoinPlatform) : void 0;
r359 = {
label: intl.string(t.VJlc0S),
disabled: false,
footerLabel: footerLabel3
};
} else if (canSendInvite) {
r359 = {
label: intl.string(t["hC/Zey"]),
disabled: a0.author.id === id2,
footerLabel: void 0
};
} else if (isInParty) {
r359 = {
label: intl.string(t.KC26NR),
disabled: true,
footerLabel: void 0
};
} else if (isAskToJoin) {
r359 = {
label: void 0,
disabled: false,
footerLabel: intl.formatToPlainString(t.gYVkSW, {
username: a0.author.globalName,
appName
})
};
} else {
if (supportsRemoteJoin && shouldShowAppAuthPrompt) {
r359 = {
label: intl.string(t.lw71Nf),
disabled: false,
footerLabel: void 0
};
break L122;
}
r359 = {
label: void 0,
disabled: false,
footerLabel: intl.string(t.OAB5TK)
};
}
}
const label = r359.label;
const r423 = !r359.disabled;
const footerLabel = r359.footerLabel;
const r5 = presenceActivity != null && presenceActivity.application_id != null && ActivityLauncherStore.getState(presenceActivity.application_id, ActivityActionTypes.JOIN) === ActivityActionStates.LOADING;
r7 = false;
ctaButtonIsLoading = r5;
title = appName;
iconSrc = r43;
subtitle = r40;
detailsText = r341;
partySizeText = partyText;
partyMemberAvatarURIs = r330;
ctaButtonEnabled = r423;
headerText2 = headerText;
footerLabel2 = footerLabel;
ctaButtonText = label;
} else {
const r278 = application.deepLinkUri != null;
const r279 = r278 ? MessageStore.getMessages(a1.id) : void 0;
if (r278 && r279 != null && isMostRecentDeadEndInvite(a0.id, r279, application.id, presenceActivity)) {
subtitle = getDeadGameInviteText(a0, appName, a1, id2, true);
ctaButtonText = intl.string(t["s+J8Dl"]);
r7 = false;
title = appName;
iconSrc = r43;
detailsText = null;
partySizeText = "";
partyMemberAvatarURIs = null;
ctaButtonIsLoading = false;
ctaButtonEnabled = true;
headerText2 = headerText;
footerLabel2 = void 0;
break L160;
}
headerText2 = intl.string(t.pkq6Vq);
subtitle = intl.string(t["Sq/E1I"]);
ctaButtonIsLoading = false;
title = appName;
iconSrc = r43;
r7 = true;
detailsText = null;
partySizeText = "";
partyMemberAvatarURIs = null;
ctaButtonEnabled = false;
footerLabel2 = void 0;
ctaButtonText = void 0;
}
}
if (remoteJoinPlatform != null) {
const r534 = [];
const r538 = ACTIVITY_GAME_PLATFORM_TO_ICON_KEY[remoteJoinPlatform];
platformIconKeys = r534;
if (r538 != null) {
r534.push(r538);
platformIconKeys = r534;
}
} else {
platformIconKeys = getJoinFromSupportedPlatformsIconKeys({
platforms: presenceActivity?.supported_platforms,
currentPlatform: currentActivityGamePlatform,
isGameLaunchable
});
}
let r541 = iconSrc;
if (r541 == null) {
r541 = void 0;
}
const appGradientColors = getAppGradientColors(r541);
const presenceActivityInviteCoverImageURL = getPresenceActivityInviteCoverImageURL({
messageId: a0.id,
presenceActivity,
application
});
const displayType = r7 ? c8542_20.DEAD_COMPACT : isInviteActive2 ? c8542_20.ACTIVE : c8542_20.DEAD;
if (!(maxPartySize > 0)) {
maxPartySize = r28.length;
}
r164 = {
displayType,
ctaButtonEnabled,
ctaButtonText,
ctaButtonIsLoading,
footerLabel: footerLabel2,
gradientColors: appGradientColors,
headerText: headerText2,
iconSrc,
isPlatformSupported: isGameLaunchable,
isSpotifyParty: isSpotifyParty2,
maxPartySize,
partyMemberAvatarURIs,
partySizeText,
platformIconKeys,
coverImageUrl: presenceActivityInviteCoverImageURL,
detailsText,
subtitle,
title
};
}
}
return r164;
}
if (ContentClassificationVisibility.BLOCK_UNDERAGE !== contentClassificationVisibility && ContentClassificationVisibility.BLOCK_CHANNEL_RESTRICTION !== contentClassificationVisibility) {
return null;
}
return {
displayType: c8542_20.BLOCKED,
headerText: intl.string(t.pkq6Vq),
subtitle: contentClassificationVisibility === ContentClassificationVisibility.BLOCK_UNDERAGE ? intl.string(t.GhU4yl) : intl.string(t.B99UMJ),
ctaButtonEnabled: false,
ctaButtonText: void 0,
ctaButtonIsLoading: false,
footerLabel: void 0,
gradientColors: [],
iconSrc: void 0,
isPlatformSupported: false,
isSpotifyParty: false,
maxPartySize: 0,
partyMemberAvatarURIs: null,
partySizeText: void 0,
platformIconKeys: [],
coverImageUrl: void 0,
detailsText: void 0,
title: void 0
};
}
}
@@ -0,0 +1,157 @@
// Metro module 12369 (f12370).
import EmbeddedActivitiesStore from "../../../../../activities/EmbeddedActivitiesStore";
import ApplicationStore from "../../../../../applications/ApplicationStore";
import AuthenticationStore from "../../../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../../../stores/ChannelStore";
import PresenceStore from "../../../../../../stores/PresenceStore";
import UserStore from "../../../../../../stores/UserStore";
import { CodedLinkExtendedType } from "./coded_links/CodedLinksConstants";
import { getContentClassificationVisibility, ContentClassificationVisibility } from "../../../../../content_classification/ContentClassificationVisibility";
import { intl, t } from "../../../../../../intl/index.native";
import { AppMessageEmbedDisplayType } from "./coded_links/CodedLinksTypes";
import { getEmbeddedActivityParticipantAvatarUris } from "./coded_links/useEmbeddedActivityParticipantAvatarUris";
import { getJoinOrStartButtonState } from "../../../../EmbeddedApplicationInstanceUtils";
import { getPlayInContext } from "../../../../../applications/message_embed/utils/getPlayInContext";
import { getAppIconSrc, getAppGradientColors } from "../../../../../applications/message_embed/native/utils/nativeAppMessageEmbedUtil";
import { fetchApplication } from "../../../../../applications/ApplicationActionCreators";
import { getActivityLaunchURL } from "../../../../../applications/getApplicationInstallURL";
export function createActivityInstanceEmbed(a0) {
let header, participantsDescription;
const { application: application2, activityInstance } = a0;
const channel = ChannelStore.getChannel(a0.channel_id);
if (application2 != null && activityInstance?.id != null && channel != null) {
const contentClassificationVisibility = getContentClassificationVisibility(application2.content_classification, channel, UserStore.getCurrentUser()?.nsfwAllowed);
if (ContentClassificationVisibility.DISPLAY === contentClassificationVisibility) {
const id5 = activityInstance.id;
const application = application2;
const channel_id = a0.channel_id;
const guild_id = channel.guild_id;
let r92 = channel.isThread() ? channel.parent_id : channel_id;
if (r92 == null) {
r92 = "";
}
let id;
const activity = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannelIncludingHidden(r92).find((item) => item.applicationId === application.id);
const currentEmbeddedActivity = EmbeddedActivitiesStore.getCurrentEmbeddedActivity();
const embeddedActivityParticipantAvatarUris = getEmbeddedActivityParticipantAvatarUris({
activity,
applicationId: application.id,
guildId: guild_id,
channelId: channel_id
});
id = application.id;
const r109 = activity == null ? void 0 : activity.userIds.values().next().value;
let r116 = r109 == null ? null : PresenceStore.findActivity(r109, (a0) => a0.application_id === id)?.details;
const joinOrStartButtonState = getJoinOrStartButtonState({
embeddedActivity: activity,
currentEmbeddedActivity,
channel
});
if (activity != null) {
if (r116 == null) {
r116 = intl.string(t.oQn0h4);
}
participantsDescription = `${embeddedActivityParticipantAvatarUris.length} ${intl.string(t.BMTj28)}`;
header = r116;
} else {
const r136 = joinOrStartButtonState.disabled ? intl.string(t.JBnc7N) : intl.string(t.cX9uLZ);
header = r116 == null ? r136 : r116;
participantsDescription = null;
}
const playInContext = getPlayInContext(application.id, channel_id);
const instanceId = playInContext.instanceId;
let isCurrentlyInInstance = playInContext.isCurrentlyInInstance;
const canLaunchInChannel = playInContext.canLaunchInChannel;
let iconSrc = application.icon != null ? getAppIconSrc(application.id, application.icon, application.bot) : null;
const label = instanceId == null ? intl.string(t.RscU7I) : intl.string(t.VJlc0S);
if (!isCurrentlyInInstance) {
isCurrentlyInInstance = canLaunchInChannel === false;
}
const actions = [{
id: "play_in_channel",
label,
disabled: isCurrentlyInInstance
}];
if (ApplicationStore.getApplication(application.id) == null && ApplicationStore.isFetchingApplication(application.id) === false) {
fetchApplication(application.id);
}
const appMessageEmbedModel = {
displayType: AppMessageEmbedDisplayType.DISPLAY,
appId: application.id,
messageId: a0.id,
title: intl.string(t.pkq6Vq),
header: null,
info: null,
tagline: null,
staticBannerSrc: null,
iconSrc: null,
embedUrl: null,
bannerRatio: "bot",
actions: null,
extendedType: null,
gradientColors: null,
backgroundColor: 0,
borderColor: 0,
headerColor: 0,
headerText: null,
type: null
};
if (header == null) {
header = "";
}
appMessageEmbedModel.header = header;
appMessageEmbedModel.iconSrc = iconSrc;
appMessageEmbedModel.embedUrl = getActivityLaunchURL({
applicationId: application.id,
referrerId: AuthenticationStore.getId()
});
appMessageEmbedModel.actions = actions;
appMessageEmbedModel.extendedType = CodedLinkExtendedType.APP_MESSAGE_EMBED;
if (iconSrc == null) {
iconSrc = void 0;
}
appMessageEmbedModel.gradientColors = getAppGradientColors(iconSrc);
return {
applicationId: application.id,
instanceId: id5,
appMessageEmbedModel,
participantAvatarUris: embeddedActivityParticipantAvatarUris,
participantsDescription
};
}
if (ContentClassificationVisibility.BLOCK_UNDERAGE !== contentClassificationVisibility && ContentClassificationVisibility.BLOCK_CHANNEL_RESTRICTION !== contentClassificationVisibility) {
return void 0;
}
const id2 = application2.id;
const id3 = activityInstance.id;
const id4 = a0.id;
const info = contentClassificationVisibility === ContentClassificationVisibility.BLOCK_UNDERAGE ? intl.string(t.LPOzxB) : intl.string(t.NIZyKq);
return {
applicationId: id2,
instanceId: id3,
participantAvatarUris: [],
participantsDescription: null,
appMessageEmbedModel: {
displayType: AppMessageEmbedDisplayType.BLOCKED,
appId: id2,
messageId: id4,
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: [],
backgroundColor: 0,
borderColor: 0,
headerColor: 0,
headerText: null,
type: null
}
};
}
}
@@ -0,0 +1,282 @@
// Metro module 8031 (f8032).
import { Image as Image2, processColor } from "react-native";
import AuthenticationStore from "../../../../../../stores/AuthenticationStore";
import GiftCodeStore from "../../../../../../stores/GiftCodeStore";
import UserStore from "../../../../../../stores/UserStore";
import SKUStore from "../../../../../../stores/game_store/SKUStore";
import { AbortCodes, MessageTypes } from "../../../../../../Constants";
import { PremiumGiftStyles, PremiumSubscriptionSKUs } from "../../../../../premium/PremiumConstants";
import Module12334 from "../../../../../../_bundle/Module12334";
import Module12335 from "../../../../../../_bundle/Module12335";
import Module12336 from "../../../../../../_bundle/Module12336";
import Module12337 from "../../../../../../_bundle/Module12337";
import Module12338 from "../../../../../../_bundle/Module12338";
import Module12339 from "../../../../../../_bundle/Module12339";
import Module12340 from "../../../../../../_bundle/Module12340";
import Module12341 from "../../../../../../_bundle/Module12341";
import Module12342 from "../../../../../../_bundle/Module12342";
import Module12343 from "../../../../../../_bundle/Module12343";
import Module12344 from "../../../../../../_bundle/Module12344";
import Module11896 from "../../../../../../_bundle/Module11896";
import UserUtils from "../../../../../../utils/UserUtils";
import getEmbedThemeColors from "./getEmbedThemeColors";
import * as _shared from "../../../../../../design/shared";
import { getEmbedBackground } from "../../../../../client_themes/native/ClientThemesUtils";
import { intl, t } from "../../../../../../intl/index.native";
import Module10994 from "../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../_bundle/Module10995";
import Module712 from "../../../../../../_bundle/Module712";
import Module3771 from "../../../../../../_bundle/Module3771";
import { processColorOrThrow } from "../../RowGeneratorStyleSheet";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module12345 from "../../../../../../_bundle/Module12345";
import Module12346 from "../../../../../../_bundle/Module12346";
import Module12347 from "../../../../../../_bundle/Module12347";
import Module12348 from "../../../../../../_bundle/Module12348";
import Module12349 from "../../../../../../_bundle/Module12349";
import * as _SlayerStorefrontUtils from "../../../../../slayer_storefront/SlayerStorefrontUtils";
import { getGameItemThumbnailUrl } from "../../../../../slayer_storefront/SlayerStorefrontUtils";
import PremiumUtils from "../../../../../../utils/PremiumUtils";
import { HermesBuiltin } from "../../../../../../_hermes/prelude";
const getGiftStyleUrl = function getGiftStyleUrl(giftStyle) {
if (PremiumGiftStyles.BOX === giftStyle) {
return Module12334;
}
if (PremiumGiftStyles.CUP === giftStyle) {
return Module12335;
}
if (PremiumGiftStyles.SNOWGLOBE === giftStyle) {
return Module12336;
}
if (PremiumGiftStyles.STANDARD_BOX === giftStyle) {
return Module12337;
}
if (PremiumGiftStyles.COFFEE === giftStyle) {
return Module12338;
}
if (PremiumGiftStyles.CAKE === giftStyle) {
return Module12339;
}
if (PremiumGiftStyles.CHEST === giftStyle) {
return Module12340;
}
if (PremiumGiftStyles.SEASONAL_STANDARD_BOX === giftStyle) {
return Module12341;
}
if (PremiumGiftStyles.SEASONAL_CAKE === giftStyle) {
return Module12342;
}
if (PremiumGiftStyles.SEASONAL_CHEST === giftStyle) {
return Module12343;
}
if (PremiumGiftStyles.SEASONAL_COFFEE === giftStyle) {
return Module12344;
}
if (PremiumGiftStyles.NITROWEEN_STANDARD === giftStyle) {
return {
uri: Module11896
};
}
return Module12337;
};
export function createGiftCodeEmbed(a0, a1) {
let headerColor, titleColor, subtitleColor, bodyTextColor, resolvingGradientStart, resolvingGradientEnd, acceptLabelDisabledBackgroundColor, acceptLabelDisabledColor, thumbnailBackgroundColor, acceptLabelGreenColor, acceptBlurpleLabelBackgroundColor, c16195_13;
let c16195_0 = a0;
if (a0.author != null && a0.giftCodes.length !== 0) {
const colors = getEmbedThemeColors(a1).colors;
headerColor = colors.headerColor;
titleColor = colors.titleColor;
subtitleColor = colors.subtitleColor;
bodyTextColor = colors.bodyTextColor;
const { borderColor, backgroundColor } = colors;
resolvingGradientStart = colors.resolvingGradientStart;
resolvingGradientEnd = colors.resolvingGradientEnd;
acceptLabelDisabledBackgroundColor = colors.acceptLabelDisabledBackgroundColor;
acceptLabelDisabledColor = colors.acceptLabelDisabledColor;
thumbnailBackgroundColor = colors.thumbnailBackgroundColor;
acceptLabelGreenColor = colors.acceptLabelGreenColor;
acceptBlurpleLabelBackgroundColor = colors.acceptBlurpleLabelBackgroundColor;
const isThemeDark = _shared.isThemeDark(a1);
let backgroundColor2 = backgroundColor;
if (isThemeDark) {
let r41 = getEmbedBackground();
if (r41 == null) {
r41 = void 0;
}
let r42 = processColor(r41);
if (r42 == null) {
r42 = backgroundColor;
}
backgroundColor2 = r42;
}
c16195_13 = {
borderColor,
backgroundColor: backgroundColor2,
thumbnailCornerRadius: 3
};
return a0.giftCodes.map((a0) => {
let r220, r221, acceptLabelBackgroundColor, acceptLabelColor, acceptLabelText, headerText;
const r12 = GiftCodeStore.get(a0);
if (a0 != null) {
if (GiftCodeStore.getIsResolved(a0)) {
const id = AuthenticationStore.getId();
const r6 = r12 != null ? id === r12.userId : id === c16195_0.author.id;
if (r12 == null) {
const code = GiftCodeStore.getError(a0)?.code;
const INVALID_GIFT_REDEMPTION_CLIENT_UPDATE_REQUIRED = AbortCodes.INVALID_GIFT_REDEMPTION_CLIENT_UPDATE_REQUIRED;
const r420 = {
thumbnailUrl: Image2.resolveAssetSource(_shared.isThemeDark(a1) ? Module10994 : Module10995).uri,
headerText: (r6 ? intl.string(t.kzFKb6) : intl.string(t.jwCLTM)).toUpperCase(),
titleText: intl.string(t.SdKbX2),
titleColor: null,
headerColor: null,
thumbnailBackgroundColor: null,
subtitle: null,
subtitleColor: null
};
let titleColor2 = processColor(Module712.unsafe_rawColors.RED_400);
if (titleColor2 == null) {
titleColor2 = titleColor;
}
r420.titleColor = titleColor2;
r420.headerColor = headerColor;
r420.thumbnailBackgroundColor = thumbnailBackgroundColor;
r420.subtitle = code === INVALID_GIFT_REDEMPTION_CLIENT_UPDATE_REQUIRED ? intl.string(t.QXgO5w) : r6 ? intl.string(t.pBDXpb) : intl.string(t.TPamyd);
r420.subtitleColor = subtitleColor;
HermesBuiltin.copyDataProperties(r420, c16195_13);
return r420;
}
const r27 = SKUStore.get(r12.skuId);
const isAccepting = GiftCodeStore.getIsAccepting(a0);
const currentUser = UserStore.getCurrentUser();
const canBeAccepted = !!currentUser?.verified && !(r12.redeemed || r12.isClaimed);
const subtitle = canBeAccepted && r12.expiresAt != null ? intl.formatToPlainString(t.nZBvUR, {
hours: r12.expiresAt.diff(Module3771(), "h")
}) : void 0;
const bodyText = r12.redeemed ? intl.string(t["/cg57l"]) : r12.isClaimed ? intl.string(t.ARWFQX) : currentUser?.verified ? void 0 : intl.string(t["j+KPkX"]);
const r123 = r12.giftStyle != null || c16195_0.type === MessageTypes.CUSTOM_GIFT;
L42: {
if (canBeAccepted) {
const r188 = r123 ? intl.string(t.TiZFqX) : intl.string(t.bUvv1f);
acceptLabelBackgroundColor = acceptBlurpleLabelBackgroundColor;
acceptLabelColor = acceptLabelGreenColor;
acceptLabelText = r188;
} else if (isAccepting) {
acceptLabelText = intl.string(t.rTeOBK);
acceptLabelBackgroundColor = acceptLabelDisabledBackgroundColor;
acceptLabelColor = acceptLabelDisabledColor;
} else {
if (!r12.redeemed && !r12.isClaimed) {
const verified = currentUser?.verified;
acceptLabelColor = void 0;
acceptLabelBackgroundColor = void 0;
acceptLabelText = void 0;
if (verified) {
break L42;
}
acceptLabelText = intl.string(t.v740sh);
acceptLabelBackgroundColor = processColorOrThrow(Module712.unsafe_rawColors.BRAND_500);
acceptLabelColor = processColorOrThrow(Module712.unsafe_rawColors.WHITE);
break L42;
}
acceptLabelText = intl.string(t.BTihou);
acceptLabelBackgroundColor = acceptLabelDisabledBackgroundColor;
acceptLabelColor = acceptLabelDisabledColor;
}
}
L71: {
const skuId = r12.skuId;
if (PremiumSubscriptionSKUs.TIER_0 === skuId) {
const assetUriForEmbed5 = getAssetUriForEmbed(r123 ? getGiftStyleUrl(r12.giftStyle) : Module12345);
r220 = getAssetUriForEmbed(_shared.isThemeDark(a1) ? Module12346 : Module12347);
r221 = assetUriForEmbed5;
} else if (PremiumSubscriptionSKUs.TIER_1 === skuId) {
const assetUriForEmbed4 = getAssetUriForEmbed(r123 ? getGiftStyleUrl(r12.giftStyle) : Module12348);
r220 = getAssetUriForEmbed(_shared.isThemeDark(a1) ? Module12346 : Module12347);
r221 = assetUriForEmbed4;
} else {
if (PremiumSubscriptionSKUs.TIER_2 !== skuId && PremiumSubscriptionSKUs.LEGACY !== skuId) {
const assetUriForEmbed = getAssetUriForEmbed(_shared.isThemeDark(a1) ? Module12346 : Module12347);
const assetUriForEmbed2 = getAssetUriForEmbed(getGiftStyleUrl(r12.giftStyle));
r220 = assetUriForEmbed;
r221 = assetUriForEmbed2;
break L71;
}
const assetUriForEmbed3 = getAssetUriForEmbed(r123 ? getGiftStyleUrl(r12.giftStyle) : Module12349);
r220 = getAssetUriForEmbed(_shared.isThemeDark(a1) ? Module12346 : Module12347);
r221 = assetUriForEmbed3;
}
}
const isGameItemSKU = _SlayerStorefrontUtils.isGameItemSKU(r27);
let r308 = r221;
if (isGameItemSKU) {
const gameItemThumbnailUrl = getGameItemThumbnailUrl(r27);
let r314 = gameItemThumbnailUrl == null ? void 0 : gameItemThumbnailUrl.toString();
if (r314 == null) {
r314 = r221;
}
r308 = r314;
}
if (c16195_0.type === MessageTypes.CUSTOM_GIFT && !r6) {
const t1SOId = t.t1SOId;
let recipientDisplayName = UserUtils.getName(currentUser);
if (recipientDisplayName == null) {
recipientDisplayName = "";
}
headerText = intl.formatToPlainString(t1SOId, {
recipientDisplayName
}).toUpperCase();
} else {
headerText = (r6 ? intl.string(t.QLEMld) : intl.string(t.W4DBcy)).toUpperCase();
}
const r351 = r12 != null;
let titleText = void 0;
if (r351) {
if (c16195_0.type !== MessageTypes.CUSTOM_GIFT) {
titleText = r27 != null ? r27.name : void 0;
} else {
const user = UserStore.getUser(r12.userId);
const DDO4Wz = t.DDO4Wz;
let sender = UserUtils.getName(user);
if (sender == null) {
sender = "";
}
titleText = intl.formatToPlainString(DDO4Wz, {
sender
});
}
}
return {
...c16195_13,
headerText,
titleText,
subtitle,
bodyText,
headerColor,
titleColor,
subtitleColor,
bodyTextColor,
acceptLabelBackgroundColor,
acceptLabelColor,
acceptLabelText,
acceptLabelBorderColor: void 0,
canBeAccepted,
embedCanBeTapped: true,
giftCode: a0,
thumbnailUrl: r308 ?? void 0,
splashUrl: c16195_0.type !== MessageTypes.CUSTOM_GIFT ? r220 ?? void 0 : void 0,
splashHasRadialGradient: !PremiumUtils.isPremiumSku(r12.skuId),
splashOpacity: PremiumUtils.isPremiumSku(r12.skuId) ? 0.8 : 0.97
};
}
return {
headerText: intl.string(t["E+va0m"]).toUpperCase(),
headerColor,
resolvingGradientStart,
resolvingGradientEnd,
...c16195_13
};
}
});
}
}
@@ -0,0 +1,74 @@
// Metro module 7852 (f7853).
import PremiumGiftingIntentStore from "../../../../../premium/gifting/PremiumGiftingIntentStore";
import UserStore from "../../../../../../stores/UserStore";
import { GiftIntentType } from "../../../../../premium/PremiumConstants";
import { createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { intl, t } from "../../../../../../intl/index.native";
import { unhandledGiftIntent } from "../../../../../premium/PremiumGiftingUtils";
import UserUtils from "../../../../../../utils/UserUtils";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module4126 from "../../../../../../_bundle/Module4126";
import Module7858 from "../../../../../../_bundle/Module7858";
import Module7859 from "../../../../../../_bundle/Module7859";
const nativeStyleProperties = createNativeStyleProperties({
headerTextColor: Module712.colors.TEXT_STRONG,
subHeaderTextColor: Module712.colors.TEXT_SUBTLE,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderColor: Module712.colors.BORDER_MUTED
});
export function createGiftIntentEmbed({ giftingPrompt }, a1) {
let r29;
if (giftingPrompt == null) {
return null;
}
const { giftIntentType, recipientUserId } = giftingPrompt;
const user = UserStore.getUser(recipientUserId);
if (user == null) {
return null;
}
const name = UserUtils.getName(user);
const friendAnniversaryYears = PremiumGiftingIntentStore.getFriendAnniversaryYears(recipientUserId);
if (GiftIntentType.FRIEND_ANNIVERSARY === giftIntentType) {
r29 = {
headerText: intl.string(t.CeQIwZ),
subHeaderParts: [{
text: intl.formatToPlainString(t.PpG27s, {
numberOfYears: friendAnniversaryYears
})
}]
};
} else {
const UNSPECIFIED = GiftIntentType.UNSPECIFIED;
r29 = null;
if (UNSPECIFIED !== giftIntentType) {
unhandledGiftIntent(giftIntentType);
r29 = null;
}
}
if (r29 == null) {
return null;
}
const currentUser = UserStore.getCurrentUser();
const recipientAvatarUrl = `${user.getAvatarURL(void 0, 40)}`;
const currentUserAvatarUrl = currentUser != null ? `${currentUser.getAvatarURL(void 0, 40)}` : void 0;
const r69 = nativeStyleProperties(a1);
return {
recipientAvatarUrl,
currentUserAvatarUrl,
recipientName: name,
headerText: r29.headerText,
subHeaderParts: r29.subHeaderParts,
recipientUserId,
giftIntentType,
headerTextColor: r69.headerTextColor,
subHeaderTextColor: r69.subHeaderTextColor,
backgroundColor: r69.backgroundColor,
borderColor: r69.borderColor,
subHeaderIconUrl: getAssetUriForEmbed(Module4126),
primaryCtaLabel: intl.string(t.ilhtIa),
primaryCtaIconUrl: getAssetUriForEmbed(Module7858),
secondaryCtaIconUrl: getAssetUriForEmbed(Module7859),
secondaryCtaAccessibilityLabel: intl.string(t.I5gL2H)
};
}
@@ -0,0 +1,25 @@
// Metro module 12386 (f12387).
import { MessageEmbedTypes } from "../../../../../../Constants";
import createMediaPostPreviewEmbedContent from "../../../../../media_channel/native/createMediaPostPreviewEmbedContent";
export function createPostPreviewEmbeds(a0, c19818_1) {
let r5 = arguments[2];
if (r5 === void 0) {
r5 = false;
}
let c19818_2 = r5;
const r6 = [];
let c19818_3 = r6;
const embeds = a0.embeds;
if (embeds != null) {
embeds.forEach((embed) => {
if (embed.type === MessageEmbedTypes.POST_PREVIEW) {
const mediaPostPreviewEmbedContent = createMediaPostPreviewEmbedContent(a0, c19818_1, embed.url, c19818_2);
if (mediaPostPreviewEmbedContent == null) {
return void 0;
}
c19818_3.push(mediaPostPreviewEmbedContent);
}
});
}
return r6;
}
@@ -0,0 +1,53 @@
// Metro module 7829 (f7830).
import { HELP_CENTER_LINK, PremiumGroupInviteState } from "../../../../../premium/premium_group/PremiumGroupConstants";
import { createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module7830 from "../../../../../../_bundle/Module7830";
import { getPremiumGroupInviteEmbedText } from "../../../../../premium/premium_group/PremiumGroupUtils.native";
import { intl, t } from "../../../../../../intl/index.native";
import PremiumGroup_messages from "../../../../../premium/premium_group/PremiumGroup.messages";
export function createPremiumGroupInviteEmbed(a0, a1, a2, a3) {
if (a0.author != null) {
const r47 = createNativeStyleProperties({
headerTextColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
bodyTextColor: Module712.colors.TEXT_DEFAULT,
linkTextColor: Module712.colors.TEXT_LINK,
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL,
betaPillTextColor: Module712.colors.BLACK,
betaPillBackgroundColor: Module712.colors.WHITE
})(a1);
const { headerTextColor, bodyTextColor, linkTextColor, backgroundColor, betaPillTextColor, betaPillBackgroundColor } = r47;
const assetUriForEmbed = getAssetUriForEmbed(Module7830);
const author = a0.author;
const premiumGroupInviteEmbedText = getPremiumGroupInviteEmbedText({
sender: author,
channel: a3,
isSender: a2 === author.id,
inviteState: PremiumGroupInviteState.UNKNOWN
});
if (premiumGroupInviteEmbedText != null) {
const { header, body } = premiumGroupInviteEmbedText;
const learnMoreLink = intl.formatToParts(PremiumGroup_messages["9VTnfI"], {
learnMoreLinkOnClick: {
action: "bindOpenUrl",
url: HELP_CENTER_LINK,
linkColor: linkTextColor
}
});
return {
headerText: header,
headerColor: headerTextColor,
backgroundColor,
borderColor: backgroundColor,
headerImageUrl: assetUriForEmbed,
betaPillText: intl.string(t.oW0eUd).toUpperCase(),
betaPillTextColor,
betaPillBackgroundColor,
bodyText: body,
bodyTextColor,
learnMoreLink
};
}
}
}
@@ -0,0 +1,154 @@
// Metro module 7843 (f7844).
import ChannelStore from "../../../../../../stores/ChannelStore";
import UserStore from "../../../../../../stores/UserStore";
import SubscriptionStore from "../../../../../../stores/billing/SubscriptionStore";
import UserOfferStore from "../../../../../../stores/billing/UserOfferStore";
import IAPStore_android from "../../../../../../stores/native/IAPStore.android";
import { HelpdeskArticles } from "../../../../../../Constants";
import { PREMIUM_TIER_2_REFERRAL_TRIAL_ID } from "../../../../../premium/PremiumConstants";
import { createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { TrialIdToProductOfferId } from "../../../../../premium/native/ProductIds.android";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module6313 from "../../../../../../_bundle/Module6313";
import { intl, t } from "../../../../../../intl/index.native";
import Module7844 from "../../../../../../_bundle/Module7844";
import UserUtils from "../../../../../../utils/UserUtils";
import PremiumUtils, { formatIntervalDuration } from "../../../../../../utils/PremiumUtils";
import * as _useTrialOffer from "../../../../../premium/useTrialOffer";
import { getReferralTrialOfferExpirationCopy } from "../../../../../premium/referral_program/ReferralProgramUtils";
import HelpdeskUtils from "../../../../../../utils/HelpdeskUtils";
import { isMetaQuest } from "../../../../../device/MetaQuestUtils.android";
import Module6628 from "../../../../../../_bundle/Module6628";
export function createReferralTrialEmbedRedeemable(a0, a1, a2, a3) {
let r188, bodyText, structuredBodyText;
if (a0.author != null) {
const r65 = createNativeStyleProperties({
headerTextColor: Module712.colors.WHITE,
titleColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
bodyTextColor: Module712.colors.TEXT_DEFAULT,
footerTextColor: Module712.colors.TEXT_MUTED,
subTextColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL,
acceptLabelColor: Module712.colors.WHITE
})(a1);
const { headerTextColor, titleColor, bodyTextColor, footerTextColor, subTextColor, acceptLabelColor, backgroundColor } = r65;
const channel = ChannelStore.getChannel(a0.getChannelId());
if (channel != null && channel.isDM()) {
const r75 = {
backgroundColor,
borderColor: backgroundColor,
thumbnailCornerRadius: 3,
headerLogoUrl: getAssetUriForEmbed(Module6313),
headerText: intl.string(t.gtNqJQ).toLocaleLowerCase(),
headerColor: headerTextColor,
thumbnailUrl: getAssetUriForEmbed(Module7844)
};
const user = UserStore.getUser(a3?.user_id);
const user2 = UserStore.getUser(a3?.referrer_id);
if (user != null && user2 != null) {
const name2 = UserUtils.getName(user2);
const id = user2.id;
const name = UserUtils.getName(user);
const titleText = intl.formatToPlainString(t.IiWKwg, {
senderUserName: name2,
recipientUserName: name
});
if (a3 == null) {
return {
...r75,
titleText,
titleColor,
bodyText: intl.string(t.eEz1N5),
bodyTextColor,
canBeAccepted: false
};
}
const userTrialOffer = UserOfferStore.getUserTrialOffer(PREMIUM_TIER_2_REFERRAL_TRIAL_ID);
const offerIds = IAPStore_android.getOfferIds();
const r138 = Object.values(TrialIdToProductOfferId[PREMIUM_TIER_2_REFERRAL_TRIAL_ID]).every((item) => offerIds.has(item));
const r142 = a3.id === userTrialOffer?.id && r138;
const isPremium = PremiumUtils.isPremium(user);
const r148 = isPremium ? isPremium : user.id === a2 ? SubscriptionStore.getPremiumTypeSubscription() != null : isPremium;
const hasUserTrialOfferExpired = _useTrialOffer.hasUserTrialOfferExpired(a3);
const r158 = a3.redeemed_at != null;
const r160 = a3.expires_at == null || hasUserTrialOfferExpired || r148 || r158;
let footerText = void 0;
let subText = void 0;
if (!r160) {
const referralTrialOfferExpirationCopy = getReferralTrialOfferExpirationCopy(Date.parse(a3.expires_at));
footerText = intl.formatToPlainString(t.uj94C5, {
duration: formatIntervalDuration({
intervalType: a3.subscription_trial?.interval,
intervalCount: a3.subscription_trial?.interval_count
})
}).replace(/\*/g, "");
subText = referralTrialOfferExpirationCopy;
}
L48: {
r188 = id === a2;
if (r148 && (!r188 && !r158)) {
structuredBodyText = intl.formatToParts(t.LwCwT9, {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
}
});
bodyText = void 0;
} else if (r148) {
bodyText = intl.formatToPlainString(t["Mptau/"], {
username: name
});
structuredBodyText = void 0;
} else {
if (hasUserTrialOfferExpired && !r158) {
bodyText = intl.string(t["9SNdf4"]);
structuredBodyText = void 0;
break L48;
}
structuredBodyText = !r142 && (!r158 && !r188) ? intl.formatToParts(isMetaQuest() ? t.yqX4Dr : t["7O7Zg3"], {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
}
}) : intl.formatToParts(t.mVzEG8, {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
},
username: name2
});
bodyText = void 0;
}
}
const canBeAccepted = (hasUserTrialOfferExpired ? !hasUserTrialOfferExpired : !r148) && r142 && !r188;
const r262 = {
...r75,
titleText,
titleColor,
bodyText,
structuredBodyText,
bodyTextColor,
subText,
subTextColor,
canBeAccepted
};
return canBeAccepted ? {
...r262,
footerText,
footerTextColor,
canBeAccepted,
acceptLabelText: intl.string(t.bXTClc),
acceptLabelColor,
acceptLabelIconUrl: getAssetUriForEmbed(Module6628)
} : r262;
}
return {
...r75,
bodyText: intl.string(t.eEz1N5),
bodyTextColor,
canBeAccepted: false
};
}
}
}
@@ -0,0 +1,165 @@
// Metro module 7834 (f7835).
import ChannelStore from "../../../../../../stores/ChannelStore";
import UserStore from "../../../../../../stores/UserStore";
import SubscriptionStore from "../../../../../../stores/billing/SubscriptionStore";
import UserOfferStore from "../../../../../../stores/billing/UserOfferStore";
import IAPStore_android from "../../../../../../stores/native/IAPStore.android";
import { HelpdeskArticles } from "../../../../../../Constants";
import { PREMIUM_TIER_2_REFERRAL_TRIAL_ID } from "../../../../../premium/PremiumConstants";
import { createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../../_bundle/Module712";
import { TrialIdToProductOfferId } from "../../../../../premium/native/ProductIds.android";
import Module7835 from "../../../../../../_bundle/Module7835";
import { intl, t } from "../../../../../../intl/index.native";
import UserUtils from "../../../../../../utils/UserUtils";
import HelpdeskUtils from "../../../../../../utils/HelpdeskUtils";
import PremiumUtils, { formatIntervalDuration } from "../../../../../../utils/PremiumUtils";
import * as _useTrialOffer from "../../../../../premium/useTrialOffer";
import { getReferralTrialOfferExpirationCopy } from "../../../../../premium/referral_program/ReferralProgramUtils";
import { isMetaQuest } from "../../../../../device/MetaQuestUtils.android";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module6628 from "../../../../../../_bundle/Module6628";
export function createReferralTrialEmbedRedesign(a0, a1, a2, a3) {
let r203, bodyText, structuredBodyText;
if (a0.author != null) {
const r12 = createNativeStyleProperties({
titleColor: Module712.colors.TEXT_DEFAULT,
headerTextColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
bodyTextColor: Module712.colors.TEXT_SUBTLE,
footerTextColor: Module712.colors.TEXT_MUTED,
subTextColor: Module712.colors.TEXT_SUBTLE,
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL,
acceptLabelColor: Module712.colors.WHITE,
linkTextColor: Module712.colors.TEXT_LINK
})(a1);
const { titleColor, headerTextColor, bodyTextColor, footerTextColor, subTextColor, acceptLabelColor, backgroundColor, linkTextColor } = r12;
const channel = ChannelStore.getChannel(a0.getChannelId());
if (channel != null && channel.isDM()) {
const user = UserStore.getUser(a3?.user_id);
const user2 = UserStore.getUser(a3?.referrer_id);
if (user != null && user2 != null) {
const name = UserUtils.getName(user2);
const id = user2.id;
const titleText = intl.formatToPlainString(t.yisueA, {
sender: name,
helpdeskArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
});
const learnMoreLink = intl.formatToParts(t.yisueA, {
sender: name,
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM),
linkColor: linkTextColor
}
});
const r117 = {
titleText,
titleColor,
headerImageUrl: Module7835,
headerText: intl.string(t.HtTvXA),
headerColor: headerTextColor,
backgroundColor,
borderColor: backgroundColor,
learnMoreLink
};
if (a3 == null) {
return {
...r117,
bodyText: intl.string(t.eEz1N5),
bodyTextColor,
canBeAccepted: false
};
}
const userTrialOffer = UserOfferStore.getUserTrialOffer(PREMIUM_TIER_2_REFERRAL_TRIAL_ID);
const offerIds = IAPStore_android.getOfferIds();
const r147 = Object.values(TrialIdToProductOfferId[PREMIUM_TIER_2_REFERRAL_TRIAL_ID]).every((item) => offerIds.has(item));
const r151 = a3.id === userTrialOffer?.id && r147;
const isPremium = PremiumUtils.isPremium(user);
const r157 = isPremium ? isPremium : user.id === a2 ? SubscriptionStore.getPremiumTypeSubscription() != null : isPremium;
const hasUserTrialOfferExpired = _useTrialOffer.hasUserTrialOfferExpired(a3);
const name2 = UserUtils.getName(user);
const r171 = a3.redeemed_at != null;
const r173 = a3.expires_at == null || hasUserTrialOfferExpired || r157 || r171;
let footerText = void 0;
let subText = void 0;
if (!r173) {
const referralTrialOfferExpirationCopy = getReferralTrialOfferExpirationCopy(Date.parse(a3.expires_at));
footerText = intl.formatToPlainString(t.uj94C5, {
duration: formatIntervalDuration({
intervalType: a3.subscription_trial?.interval,
intervalCount: a3.subscription_trial?.interval_count
})
}).replace(/\*/g, "");
subText = referralTrialOfferExpirationCopy;
}
L48: {
r203 = id === a2;
if (r157 && (!r203 && !r171)) {
structuredBodyText = intl.formatToParts(t.LwCwT9, {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
}
});
bodyText = void 0;
} else if (r157) {
bodyText = intl.formatToPlainString(t["Mptau/"], {
username: name2
});
structuredBodyText = void 0;
} else {
if (hasUserTrialOfferExpired && !r171) {
bodyText = intl.string(t["9SNdf4"]);
structuredBodyText = void 0;
break L48;
}
structuredBodyText = !r151 && (!r171 && !r203) ? intl.formatToParts(isMetaQuest() ? t.yqX4Dr : t["7O7Zg3"], {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
}
}) : intl.formatToParts(t.mVzEG8, {
helpdeskArticle: {
action: "bindOpenUrl",
url: HelpdeskUtils.getArticleURL(HelpdeskArticles.REFERRAL_PROGRAM)
},
username: name
});
bodyText = void 0;
}
}
const canBeAccepted = (hasUserTrialOfferExpired ? !hasUserTrialOfferExpired : !r157) && r151 && !r203;
const r274 = {
...r117,
bodyText,
structuredBodyText,
bodyTextColor,
subText,
subTextColor,
canBeAccepted
};
return canBeAccepted ? {
...r274,
footerText,
footerTextColor,
canBeAccepted,
acceptLabelText: intl.string(t.bXTClc),
acceptLabelColor,
acceptLabelIconUrl: getAssetUriForEmbed(Module6628)
} : r274;
}
return {
titleText: "",
titleColor,
headerImageUrl: Module7835,
headerText: "",
headerColor: headerTextColor,
backgroundColor,
borderColor: backgroundColor,
bodyText: intl.string(t.eEz1N5),
bodyTextColor,
canBeAccepted: false
};
}
}
}
@@ -0,0 +1,44 @@
// Metro module 12389 (f12390).
import { Image as Image2 } from "react-native";
import { MessageEmbedTypes } from "../../../../../../Constants";
import { SafetyHubPolicyNoticeKeys } from "../../../../../safety_hub/SafetyHubConstants";
import Module3771 from "../../../../../../_bundle/Module3771";
import { intl, t } from "../../../../../../intl/index.native";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import Module7630 from "../../../../../../_bundle/Module7630";
export function createSafetyPolicyNoticeEmbed(a0) {
if (a0.embeds != null) {
if (a0.embeds[0]?.fields != null) {
if (a0.embeds[0]?.type === MessageEmbedTypes.SAFETY_POLICY_NOTICE) {
const r25 = a0.embeds[0];
const fields = r25.fields;
let r27 = fields == null ? void 0 : fields.find((field) => field.rawName === SafetyHubPolicyNoticeKeys.CLASSIFICATION_ID);
if (r27 == null) {
r27 = void 0;
}
let classificationId = r27?.rawValue;
if (classificationId == null) {
classificationId = void 0;
}
const fields2 = r25.fields;
let r33 = fields2 == null ? void 0 : fields2.find((item) => item.rawName === SafetyHubPolicyNoticeKeys.INCIDENT_TIMESTAMP);
if (r33 == null) {
r33 = void 0;
}
const r15 = r33 == null ? void 0 : r33.rawValue == null ? void 0 : parseFloat(r33.rawValue);
if (classificationId != null && r15 != null) {
return {
titleText: intl.string(t["4CxGXi"]),
titleIcon: getAssetUriForEmbed(Image2.resolveAssetSource(Module7630)),
subtitleText: intl.formatToPlainString(t.eevFb6, {
daysAgo: Module3771().diff(Module3771.unix(r15), "days")
}),
descriptionText: intl.string(t["5CLb0A"]),
ctaText: intl.string(t.zKnzwm),
classificationId
};
}
}
}
}
}
@@ -0,0 +1,66 @@
// Metro module 12390 (f12391).
import { Image as Image2 } from "react-native";
import { MessageEmbedTypes } from "../../../../../../Constants";
import Module3771 from "../../../../../../_bundle/Module3771";
import Module7630 from "../../../../../../_bundle/Module7630";
import Module4657 from "../../../../../../_bundle/Module4657";
import { parseMessageForProps, mapCtaToNativeData } from "../../../../../safety_hub/SafetyHubUtils";
import { getAssetUriForEmbed } from "../../EmbedUtils";
import { t, intl } from "../../../../../../intl/index.native";
export function createSafetySystemNotificationEmbed(a0) {
if (a0 != null && a0.embeds != null) {
if (a0.embeds[0]?.fields != null) {
if (a0.embeds[0]?.type === MessageEmbedTypes.SAFETY_SYSTEM_NOTIFICATION) {
const r28 = parseMessageForProps(a0);
if (r28 != null) {
const r31 = r28.ctas != null;
let r32 = void 0;
let r8 = void 0;
if (r31) {
const r36 = r28.ctas[0] != null ? mapCtaToNativeData(r28.ctas[0], r28.learn_more_link, r28.classification_id) : void 0;
r32 = r28.ctas[1] != null ? mapCtaToNativeData(r28.ctas[1], r28.learn_more_link, r28.classification_id) : void 0;
r8 = r36;
}
let header = r28.header;
if (header == null) {
header = "";
}
const r50 = {
titleText: header,
titleIcon: getAssetUriForEmbed(Image2.resolveAssetSource(r28.icon === "danger" ? Module7630 : Module4657)),
subtitleText: null,
descriptionText: null,
primaryCtaText: null,
primaryCtaType: null,
primaryCtaKey: null,
secondaryCtaText: null,
secondaryCtaType: null,
secondaryCtaKey: null,
footerTheme: null
};
const eevFb6 = t.eevFb6;
let timestamp = r28.timestamp;
if (timestamp == null) {
timestamp = 0;
}
r50.subtitleText = intl.formatToPlainString(eevFb6, {
daysAgo: Module3771().diff(Module3771.unix(timestamp), "days")
});
let body = r28.body;
if (body == null) {
body = "";
}
r50.descriptionText = body;
r50.primaryCtaText = r8?.text;
r50.primaryCtaType = r8?.type;
r50.primaryCtaKey = r8?.key;
r50.secondaryCtaText = r32?.text;
r50.secondaryCtaType = r32?.type;
r50.secondaryCtaKey = r32?.key;
r50.footerTheme = r28.theme;
return r50;
}
}
}
}
}
@@ -0,0 +1,82 @@
// Metro module 12364 (f12365).
import { Image as Image2 } from "react-native";
import BuildOverrideStore, { State } from "../../../../../../build_overrides/BuildOverrideStore";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { DEVICE_FIELD } from "../../../../../../build_overrides/native/BuildOverrideUtils";
import validateBuildOverride from "../../../../../../build_overrides/validateBuildOverride";
import { getConstants } from "../../../../../../../utils/native/ClientInfoUtils";
import { intl, t } from "../../../../../../../intl/index.native";
import { processColorOrThrow } from "../../../RowGeneratorStyleSheet";
import Module712 from "../../../../../../../_bundle/Module712";
import { isThemeDark } from "../../../../../../../design/shared";
import Module10994 from "../../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../../_bundle/Module10995";
import Module12363 from "../../../../../../../_bundle/Module12363";
export function createBuildOverrideEmbed(a0, a1) {
let r61;
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const currentBuildOverride = BuildOverrideStore.getCurrentBuildOverride();
const buildOverride = BuildOverrideStore.getBuildOverride(a0);
if (buildOverride.state === State.Resolving) {
return {
headerText: "RESOLVING",
resolvingGradientEnd: colors.resolvingGradientEnd,
resolvingGradientStart: colors.resolvingGradientStart,
type: InviteTypes.GUILD,
...baseColors
};
}
const override = buildOverride.override;
const r1 = override == null;
let subtitle = void 0;
if (!r1) {
const targetBuildOverride = override.targetBuildOverride;
subtitle = targetBuildOverride == null ? void 0 : targetBuildOverride[DEVICE_FIELD]?.id;
}
let r36 = subtitle != null;
if (r36) {
const overrides = currentBuildOverride.overrides;
r36 = subtitle === (overrides == null ? void 0 : overrides[DEVICE_FIELD]?.id);
}
const r54 = validateBuildOverride(buildOverride.override, ["discord_ios", "discord_android"], getConstants().Version);
if (currentBuildOverride.state !== State.Invalid && (buildOverride.state !== State.Invalid && (buildOverride.override != null && (subtitle != null && r54.valid)))) {
const r109 = {
...baseColors,
headerText: intl.string(t.Wj3LW4).toLocaleUpperCase(),
headerColor: colors.headerColor
};
const override2 = buildOverride.override;
const r131 = override2 == null;
let r132 = void 0;
if (!r131) {
const targetBuildOverride2 = override2.targetBuildOverride;
r132 = targetBuildOverride2 == null ? void 0 : targetBuildOverride2[DEVICE_FIELD]?.type;
}
r109.titleText = intl.string(r132 === "branch" ? t.p9TwTG : t.RCYGot);
r109.titleColor = colors.titleColor;
r109.subtitle = subtitle;
r109.subtitleColor = colors.subtitleColor;
r109.thumbnailUrl = Image2.resolveAssetSource(Module12363).uri;
r109.acceptButtonVariant = r36 ? "destructive" : "primary";
r109.acceptLabelText = r36 ? intl.string(t.tX4xrt) : intl.string(t.nOunHC);
r109.embedCanBeTapped = true;
r109.canBeAccepted = true;
r109.type = InviteTypes.GUILD;
r61 = r109;
} else {
r61 = {
...baseColors,
headerText: intl.string(t.d34xi4).toLocaleUpperCase(),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_400),
titleText: r54.valid ? intl.string(t.ODXApH) : r54.reason,
subtitle,
subtitleColor: subtitle != null ? colors.subtitleColor : void 0,
thumbnailUrl: Image2.resolveAssetSource(isThemeDark(a1) ? Module10994 : Module10995).uri,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
type: InviteTypes.GUILD
};
}
return r61;
}
@@ -0,0 +1,152 @@
// Metro module 12350 (f12351).
import _slicedToArray from "../../../../../../../_bundle/_slicedToArray";
import LurkingStore from "../../../../../../lurker_mode/LurkingStore";
import GuildStore from "../../../../../../../stores/GuildStore";
import UserStore from "../../../../../../../stores/UserStore";
import { isApplicationCodedLink, isApplicationCodedLinkMobileSupported, getApplicationCodedLinkData } from "../../../../../../coded_links/ApplicationCodedLink";
import { getAppLinkGateResult, createAppMessageEmbed } from "../../../../../../applications/message_embed/native/createAppMessageEmbed";
import { CodedLinkType } from "../../../../../../coded_links/CodedLink";
import { createActivityMessageEmbed } from "../../../../../../applications/message_embed/native/createActivityMessageEmbed";
import { createInviteEmbed } from "./InviteEmbed";
import { createGuildTemplateEmbed } from "./GuildTemplateEmbed";
import { createBuildOverrideEmbed } from "./BuildOverrideEmbed";
import { createGuildScheduledEventLinkEmbed } from "./GuildScheduledEventEmbed";
import { createVoiceChannelLinkEmbed } from "./VoiceChannelLinkEmbed";
import { createEmbeddedActivityInviteEmbed } from "./EmbeddedActivityInviteEmbed";
import { canSeeExperimentEmbeds } from "../../../../../../experiments/client_override_hooks/useCodedLinksExperimentEmbeds";
import { createExperimentEmbed } from "./ExperimentEmbed";
import { getIsEligibleForSocialLayerStorefrontMobilePurchasing } from "../../../../../../slayer_storefront/experiments/SocialLayerStorefrontMobilePurchasingExperiment";
import { createSocialLayerStorefrontProductDetailsEmbed } from "../../../../../../slayer_storefront/native/createSocialLayerStorefrontProductDetailsEmbed";
import { createQuestsEmbed } from "../../../../../../quests/native/QuestEmbed.native";
import { assertNever } from "../../../../../../../utils/GlobalUtils";
export function createCodedLinkEmbeds(a0, a1, channel, theme) {
let currentUser;
const message = a0;
if (a0.author != null && a1.codedLinks.length !== 0) {
currentUser = UserStore.getCurrentUser();
return a1.codedLinks.map(({ type, code, url }) => {
if (isApplicationCodedLink(type)) {
if (channel == null) {
return null;
}
if (isApplicationCodedLinkMobileSupported(type)) {
const applicationCodedLinkData = getApplicationCodedLinkData(type, code, url);
if (applicationCodedLinkData == null) {
return null;
}
const appLinkGateResult = getAppLinkGateResult({
appId: applicationCodedLinkData.applicationId,
channel,
message,
theme
});
if (appLinkGateResult.state === "unavailable") {
return null;
}
if (appLinkGateResult.state === "blocked") {
return appLinkGateResult.model;
}
const app = appLinkGateResult.app;
const type2 = applicationCodedLinkData.type;
if (CodedLinkType.ACTIVITY_BOOKMARK === type2) {
return createActivityMessageEmbed({
theme,
embedUrl: url,
message,
app,
params: applicationCodedLinkData.params
});
}
if (CodedLinkType.APP_DIRECTORY_PROFILE !== type2 && CodedLinkType.APP_OAUTH2_LINK !== type2) {
return null;
}
return createAppMessageEmbed({
theme,
embedUrl: url,
message,
app
});
}
return null;
}
if (CodedLinkType.INVITE === type) {
return createInviteEmbed(message, code, theme);
}
if (CodedLinkType.TEMPLATE === type) {
return createGuildTemplateEmbed(code, theme);
}
if (CodedLinkType.BUILD_OVERRIDE === type) {
return createBuildOverrideEmbed(code, theme);
}
if (CodedLinkType.MANUAL_BUILD_OVERRIDE === type) {
const currentUser2 = UserStore.getCurrentUser();
let r161 = currentUser2 == null ? void 0 : currentUser2.isStaff();
if (!r161) {
const currentUser3 = UserStore.getCurrentUser();
r161 = currentUser3 == null ? void 0 : currentUser3.isStaffPersonal();
}
if (!r161) {
r161 = GuildStore.getGuild("943265993613008967") != null && !LurkingStore.isLurking("943265993613008967");
}
return r161 ? createBuildOverrideEmbed(code, theme) : null;
}
if (CodedLinkType.EVENT === type) {
return createGuildScheduledEventLinkEmbed(code, theme);
}
if (CodedLinkType.CHANNEL_LINK === type) {
return createVoiceChannelLinkEmbed(code, theme);
}
if (CodedLinkType.EMBEDDED_ACTIVITY_INVITE === type) {
return createEmbeddedActivityInviteEmbed({
theme,
inviteCode: code
});
}
if (CodedLinkType.EXPERIMENT === type) {
return canSeeExperimentEmbeds() ? createExperimentEmbed(url, theme) : null;
}
if (CodedLinkType.GUILD_PRODUCT !== type && CodedLinkType.SERVER_SHOP !== type) {
if (CodedLinkType.SOCIAL_LAYER_STOREFRONT !== type && CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP !== type) {
if (CodedLinkType.QUESTS_EMBED === type) {
return createQuestsEmbed({
theme,
questId: code,
currentUser
});
}
if (CodedLinkType.COLLECTIBLES_SHOP !== type && CodedLinkType.GAME_PROFILE !== type && CodedLinkType.GAME_SERVER_SHARE !== type) {
return assertNever(type);
}
return null;
}
if (getIsEligibleForSocialLayerStorefrontMobilePurchasing({
location: "create_coded_link_embeds"
})) {
if (type === CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP) {
const r120 = _slicedToArray(code.split("-"), 2);
return createSocialLayerStorefrontProductDetailsEmbed({
skuId: r120[0],
guildOrApplication: {
type: "application",
applicationId: r120[1]
},
theme
});
}
const r106 = _slicedToArray(code.split("-"), 2);
return createSocialLayerStorefrontProductDetailsEmbed({
skuId: r106[0],
guildOrApplication: {
type: "guild",
guildId: r106[1]
},
theme
});
}
return null;
}
return null;
});
}
return [];
}
@@ -0,0 +1,18 @@
// Metro module 9500 (f9501).
const r9 = {
STAGE_INSTANCE: 0,
0: "STAGE_INSTANCE",
GUILD_SCHEDULED_EVENT: 1,
1: "GUILD_SCHEDULED_EVENT",
GUILD_INVITE_DISABLED: 2,
2: "GUILD_INVITE_DISABLED",
EMBEDDED_ACTIVITY_INVITE: 3,
3: "EMBEDDED_ACTIVITY_INVITE",
APP_MESSAGE_EMBED: 4,
4: "APP_MESSAGE_EMBED",
GUILD_PROFILE_INVITE: 5,
5: "GUILD_PROFILE_INVITE",
VOICE_CHANNEL_LIST_INVITE: 6,
6: "VOICE_CHANNEL_LIST_INVITE"
};
export { r9 as CodedLinkExtendedType };
@@ -0,0 +1,6 @@
// Metro module 11135 (f11136).
const r8 = {
DISPLAY: "display",
BLOCKED: "blocked"
};
export { r8 as AppMessageEmbedDisplayType };
@@ -0,0 +1,100 @@
// Metro module 12359 (f12360).
import { Image as Image2 } from "react-native";
import EmbeddedActivitiesStore from "../../../../../../activities/EmbeddedActivitiesStore";
import ApplicationAssetsStore, { FetchState } from "../../../../../../applications/ApplicationAssetsStore";
import ApplicationStore from "../../../../../../applications/ApplicationStore";
import AuthenticationStore from "../../../../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../../../../stores/ChannelStore";
import InviteStore from "../../../../../../../stores/InviteStore";
import RelationshipStore from "../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../stores/UserStore";
import { CodedLinkExtendedType } from "./CodedLinksConstants";
import { InviteTargetTypes } from "../../../../../../instant_invite/Constants";
import Dispatcher from "../../../../../../../Dispatcher";
import { fetchAssetIds, getAssetIds, getAssetImage } from "../../../../../../../utils/ApplicationAssetUtils";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { getSimpleChannelIcon } from "../../../../../../../utils/native/ChannelUtils";
import { intl, t } from "../../../../../../../intl/index.native";
import { computeChannelName } from "../../../../../../channel/useChannelName";
import { getEmbeddedActivityParticipantAvatarUris } from "./useEmbeddedActivityParticipantAvatarUris";
const _excluded = ["embedded_cover"];
export function createEmbeddedActivityInviteEmbed({ inviteCode, theme }) {
let id;
id = void 0;
const invite = InviteStore.getInvite(inviteCode);
if (invite == null) {
return null;
}
const { target_type, target_application } = invite;
if (target_type === InviteTargetTypes.EMBEDDED_APPLICATION && target_application != null) {
if (ApplicationStore.getApplication(target_application.id) == null) {
Dispatcher.dispatch({
type: "APPLICATION_UPDATE",
application: target_application
});
}
id = target_application.id;
if (ApplicationAssetsStore.getApplicationAssetFetchState(id) === FetchState.NOT_FETCHED) {
fetchAssetIds(id, _excluded);
}
const embedThemeColors = getEmbedThemeColors(theme);
const baseColors = embedThemeColors.baseColors;
const acceptLabelGreenBackgroundColor = embedThemeColors.colors.acceptLabelGreenBackgroundColor;
const name = invite.guild?.name;
const id3 = invite.channel?.id;
const id2 = invite.guild?.id;
const r26 = id3 != null ? ChannelStore.getChannel(id3) : null;
const r72 = r26 != null ? getSimpleChannelIcon(r26) : null;
const channelIcon = r72 != null ? Image2.resolveAssetSource(r72)?.uri : void 0;
let headerText = target_application?.name;
if (headerText == null) {
headerText = null;
}
const titleText = intl.string(t["1qHIZ4"]);
const structurableSubtitleText = r26 != null && name != null ? intl.formatToParts(t.omZR7L, {
channelName: computeChannelName(r26, UserStore, RelationshipStore),
guildName: name
}) : name != null ? intl.formatToParts(t.u0vaDE, {
guildName: name
}) : null;
let r114 = id3 != null;
if (r114) {
const r120 = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(id3).find((item) => item.applicationId === id);
const r121 = r120 == null;
let r122 = void 0;
if (!r121) {
const userIds = r120.userIds;
r122 = userIds == null ? void 0 : userIds.has(AuthenticationStore.getId());
}
r114 = r122;
}
const participantAvatarUris = id3 != null && id2 != null ? getEmbeddedActivityParticipantAvatarUris({
channelId: id3,
guildId: id2,
applicationId: id
}) : [];
const r142 = intl.string(t.VJlc0S);
const acceptLabelText = participantAvatarUris.length === 0 ? intl.string(t.I0v0Qv) : r114 ? intl.string(t.KC26NR) : r142;
let r165 = getAssetIds(id, _excluded);
if (r165 == null) {
r165 = [];
}
const [r169] = r165;
return {
...baseColors,
channelIcon,
headerText,
acceptLabelBackgroundColor: acceptLabelGreenBackgroundColor,
titleText,
structurableSubtitleText,
type: null,
extendedType: CodedLinkExtendedType.EMBEDDED_ACTIVITY_INVITE,
participantAvatarUris,
acceptLabelText,
splashUrl: r169 != null ? getAssetImage(id, r169, 1024) : void 0,
noParticipantsText: intl.string(t.PZLnuD),
ctaEnabled: !r114
};
}
return null;
}
@@ -0,0 +1,171 @@
// Metro module 10993 (f10994).
import { useMemo, useCallback } from "react";
import { Image as Image2 } from "react-native";
import AuthenticationStore from "../../../../../../../stores/AuthenticationStore";
import { ExperimentEmbedType } from "../../../../../../experiments/ExperimentConstants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { getExperimentFromEmbedURL, getExperimentTreatmentFromEmbedURL, getExperimentBuckets, getExperimentServerAssignmentLabel } from "../../../../../../experiments/ExperimentEmbedUtils";
import { useLegacyExperiments, getLegacyExperiments } from "../../../../../../experiments/client_override_hooks/useLegacyExperiments";
import { useApexExperiments, getApexExperiments } from "../../../../../../experiments/client_override_hooks/useApexExperiments";
import { isThemeDark } from "../../../../../../../design/utils/shared/themes";
import Module10994 from "../../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../../_bundle/Module10995";
import { getExperimentServerAssignment } from "../../../../../../experiments/client_override_hooks/useExperimentAssignments";
import { getAssetUriForEmbed } from "../../../EmbedUtils";
import Module10997 from "../../../../../../../_bundle/Module10997";
import { getExperimentVariantsForDevTools } from "../../../../../../experiments/devtools/ExperimentDevToolsUtils";
import ActionSheetActionCreators from "../../../../../../action_sheet/native/ActionSheetActionCreators";
import { overrideBucket } from "../../../../../../experiments/ExperimentManager";
import { BottomSheet } from "../../../../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { ExperimentDetails } from "../../../../../../devtools/native/components/screens/DevToolsExperimentsScreen";
import { useCanSeeExperimentEmbeds } from "../../../../../../experiments/client_override_hooks/useCodedLinksExperimentEmbeds";
const ExperimentOverrideActionSheet = function ExperimentOverrideActionSheet(props) {
const { id, experiment, override } = props;
const memo = useMemo(() => experiment != null ? getExperimentVariantsForDevTools(experiment) : [], [experiment]);
return <BottomSheet header={<BottomSheetTitleHeader title={experiment.title} subtitle={id} />}>
<ExperimentDetails experiment={experiment} override={override} id={id} options={useMemo(() => {
if (experiment == null) {
return [];
}
let c26901_1;
const map = new Map();
let c26901_0 = map;
memo.forEach((item) => {
c26901_0.set(item.id, item);
});
const r15 = [];
c26901_1 = r15;
map.forEach((item) => {
c26901_1.push({
label: item.label,
onPress: () => {
ActionSheetActionCreators.hideActionSheet("ExperimentOverrideSheet");
overrideBucket(experiment.system, id, item.id);
}
});
});
r15.push({
label: "Clear Override",
isDestructive: true,
onPress: () => {
ActionSheetActionCreators.hideActionSheet("ExperimentOverrideSheet");
overrideBucket(experiment.system, id, null);
}
});
return r15;
}, [id, experiment, memo])} onCopyLink={useCallback(() => {
ActionSheetActionCreators.hideActionSheet("ExperimentOverrideSheet");
}, [])} />
</BottomSheet>;
};
export default function ConnectedExperimentOverrideActionSheet(props) {
const id2 = props.id;
const legacyExperiments = useLegacyExperiments();
const { experiments, overridesInfo } = legacyExperiments;
const apexExperiments = useApexExperiments();
const { experiments: experiments2, overridesInfo: overridesInfo2 } = apexExperiments;
const memo2 = useMemo(() => {
let r4 = experiments[id2];
if (r4 == null) {
r4 = experiments2[id2];
}
if (r4 == null) {
r4 = null;
}
return r4;
}, [experiments, experiments2, id2]);
const memo3 = useMemo(() => {
let r4 = overridesInfo[id2];
if (r4 == null) {
r4 = overridesInfo2[id2];
}
if (r4 == null) {
r4 = null;
}
return r4;
}, [overridesInfo, overridesInfo2, id2]);
const canSeeExperimentEmbeds = useCanSeeExperimentEmbeds();
return memo2 != null ? canSeeExperimentEmbeds ? <ExperimentOverrideActionSheet id={id2} experiment={memo2} override={memo3} /> : null : null;
};
export function createExperimentEmbed(a0, a1) {
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const experimentFromEmbedURL = getExperimentFromEmbedURL(a0);
const experimentTreatmentFromEmbedURL = getExperimentTreatmentFromEmbedURL(a0);
const legacyExperiments = getLegacyExperiments();
const { experiments: experiments3, overridesInfo: overridesInfo3 } = legacyExperiments;
const apexExperiments = getApexExperiments();
const { experiments: experiments4, overridesInfo: overridesInfo4 } = apexExperiments;
const r0 = experimentFromEmbedURL != null;
let r20 = null;
if (r0) {
let r41 = experiments3[experimentFromEmbedURL];
if (r41 == null) {
r41 = experiments4[experimentFromEmbedURL];
}
r20 = r41;
}
if (experimentFromEmbedURL != null && r20 != null) {
let r42 = overridesInfo3[experimentFromEmbedURL];
if (r42 == null) {
r42 = overridesInfo4[experimentFromEmbedURL];
}
if (r42 == null) {
r42 = null;
}
const r49 = getExperimentBuckets(r20).find((item) => item.value === experimentTreatmentFromEmbedURL);
const r51 = r49 != null ? ExperimentEmbedType.EXPERIMENT_TREATMENT : ExperimentEmbedType.EXPERIMENT;
const experimentServerAssignmentLabel = getExperimentServerAssignmentLabel(r20, getExperimentServerAssignment(r20, AuthenticationStore.getId()));
if (r51 === ExperimentEmbedType.EXPERIMENT_TREATMENT) {
const subtitle = r49 != null ? r49.label : `Server Config: ${experimentServerAssignmentLabel}`;
const r97 = r42 != null && r49 != null && r42.variantId === r49.value;
const r100 = {
...baseColors,
headerText: "EXPERIMENT TREATMENT",
titleText: experimentFromEmbedURL,
titleColor: colors.titleColor,
subtitle,
subtitleColor: colors.subtitleColor,
thumbnailUrl: getAssetUriForEmbed(Module10997),
thumbnailBackgroundColor: colors.backgroundColor,
acceptLabelColor: r97 ? colors.clearLabelRedColor : colors.acceptLabelGreenColor,
acceptLabelBackgroundColor: r97 ? colors.clearLabelRedBackgroundColor : colors.acceptLabelGreenBackgroundColor
};
const concat = HermesInternal.concat;
r100.acceptLabelText = r97 ? concat.call("Clear Treatment ", experimentTreatmentFromEmbedURL) : concat.call("Apply Treatment ", experimentTreatmentFromEmbedURL);
r100.embedCanBeTapped = true;
r100.type = InviteTypes.GUILD;
return r100;
}
return {
...baseColors,
headerText: "EXPERIMENT",
titleText: experimentFromEmbedURL,
titleColor: colors.titleColor,
subtitle: r42 != null ? `Client Override Applied: Treatment ${r42.variantId}` : `Server Assignment: ${experimentServerAssignmentLabel}`,
subtitleColor: colors.subtitleColor,
thumbnailUrl: getAssetUriForEmbed(Module10997),
thumbnailBackgroundColor: colors.backgroundColor,
acceptLabelColor: colors.acceptLabelGreenColor,
acceptLabelBackgroundColor: colors.acceptLabelGreenBackgroundColor,
acceptLabelText: "View Experiment Details",
embedCanBeTapped: true,
type: InviteTypes.GUILD
};
}
return {
...baseColors,
headerText: "EXPERIMENT",
titleText: experimentFromEmbedURL == null ? "Unknown Experiment" : experimentFromEmbedURL,
titleColor: colors.titleColor,
subtitle: "Unknown Experiment",
subtitleColor: colors.subtitleColor,
bodyText: "This client is missing this experiment. You may need to open the surface where the experiment is used first.",
bodyTextColor: colors.bodyTextColor,
thumbnailUrl: Image2.resolveAssetSource(isThemeDark(a1) ? Module10994 : Module10995).uri,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
type: InviteTypes.GUILD
};
}
@@ -0,0 +1,222 @@
// Metro module 12357 (f12358).
import { processColor } from "react-native";
import GuildScheduledEventStore, { isGuildEventEnded, isGuildScheduledEventActive } from "../../../../../../guild_scheduled_events/GuildScheduledEventStore";
import { getGuildIconSource } from "../../../../../../../records/GuildRecord";
import ChannelStore from "../../../../../../../stores/ChannelStore";
import GuildStore from "../../../../../../../stores/GuildStore";
import RelationshipStore from "../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../stores/UserStore";
import { CodedLinkExtendedType } from "./CodedLinksConstants";
import { GuildScheduledEventEntityTypes } from "../../../../../../guild_scheduled_events/GuildScheduledEventsConstants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { getAssetUriForEmbed } from "../../../EmbedUtils";
import * as _useCanInviteForGuildEvent from "../../../../../../guild_scheduled_events/useCanInviteForGuildEvent";
import { getEventSchedule } from "../../../../../../guild_scheduled_events/useEventSchedule";
import { getEventTimeData, getNextRecurrenceIdInEvent } from "../../../../../../guild_scheduled_events/utils/ScheduleUtils";
import { getGuildScheduledEventHeaderProps } from "../../../../../../guild_scheduled_events/native/GuildScheduledEventHeaderUtils";
import { intl, t } from "../../../../../../../intl/index.native";
import Module7732 from "../../../../../../../_bundle/Module7732";
import Share from "../../../../../../icons/native/Share";
import { processColorOrThrow } from "../../../RowGeneratorStyleSheet";
import Module712 from "../../../../../../../_bundle/Module712";
import Module10356 from "../../../../../../../_bundle/Module10356";
import MarkupUtils from "../../../../../../markup/MarkupUtils";
import { getLocationFromEvent } from "../../../../../../guild_scheduled_events/utils/EntityUtils";
import { computeChannelName } from "../../../../../../channel/useChannelName";
import { getEventLocationIconSource } from "../../../../../../guild_scheduled_events/native/components/GuildEventUtils";
import GuildScheduledEventManager from "../../../../../../guild_scheduled_events/GuildScheduledEventManager";
import Module12358 from "../../../../../../../_bundle/Module12358";
import GuildScheduledEventsActionCreators from "../../../../../../guild_scheduled_events/GuildScheduledEventsActionCreators";
import { fromInviteGuild } from "../../../../../../../utils/GuildRecordUtils";
let c8531_17;
const createGuildScheduledEventEmbed = function createGuildScheduledEventEmbed({ channel, guildEvent, userCount, guild, theme, type, recurrenceId }) {
let acceptLabelBackgroundColor, acceptLabelGreenColor, acceptLabelIcon, acceptLabelText, headerTextColor, isRsvped, secondaryActionIcon;
const colors = getEmbedThemeColors(theme).colors;
const id = channel?.id;
const r9 = guild != null ? getGuildIconSource(guild, 128, false) : void 0;
const guildIcon = r9 != null ? getAssetUriForEmbed(r9) : void 0;
const isGuildEventInvitable = _useCanInviteForGuildEvent.isGuildEventInvitable(guildEvent);
const isGuildScheduledEventActive2 = isGuildScheduledEventActive(guildEvent);
const entity_type2 = guildEvent.entity_type;
const EXTERNAL = GuildScheduledEventEntityTypes.EXTERNAL;
const isInterestedInEventRecurrence = GuildScheduledEventStore.isInterestedInEventRecurrence(guildEvent.id, recurrenceId);
const { name, description, entity_type } = guildEvent;
const STAGE_INSTANCE = GuildScheduledEventEntityTypes.STAGE_INSTANCE;
const eventSchedule = getEventSchedule(guildEvent, recurrenceId);
const guildScheduledEventHeaderProps = getGuildScheduledEventHeaderProps({
eventTimeData: getEventTimeData(eventSchedule == null ? void 0 : eventSchedule.startTime.toISOString()),
isStage: entity_type === STAGE_INSTANCE,
theme,
event: guildEvent
});
const { color, icon, shouldChangeTextColor, text } = guildScheduledEventHeaderProps;
const embedCanBeTapped = guild != null;
const r31 = {
titleColor: colors.titleColor,
borderColor: colors.borderColor,
backgroundColor: colors.backgroundColor,
thumbnailCornerRadius: 15,
embedCanBeTapped
};
const r38 = intl.string(t.DlcqlU);
const assetUriForEmbed2 = getAssetUriForEmbed(Module7732);
const assetUriForEmbed = getAssetUriForEmbed(Share);
if (embedCanBeTapped) {
if (isGuildScheduledEventActive2) {
const acceptLabelActiveBackgroundColor = colors.acceptLabelActiveBackgroundColor;
const r135 = entity_type2 === EXTERNAL ? intl.string(t.GoCQxU) : intl.string(t.IaYdtW);
acceptLabelGreenColor = colors.acceptLabelGreenColor;
isRsvped = false;
acceptLabelText = r135;
secondaryActionIcon = assetUriForEmbed;
acceptLabelIcon = void 0;
acceptLabelBackgroundColor = acceptLabelActiveBackgroundColor;
} else if (isInterestedInEventRecurrence) {
acceptLabelBackgroundColor = colors.backgroundColor;
acceptLabelIcon = getAssetUriForEmbed(Module10356);
acceptLabelGreenColor = colors.acceptLabelDisabledTextColor;
secondaryActionIcon = assetUriForEmbed;
acceptLabelText = r38;
isRsvped = isInterestedInEventRecurrence;
} else {
acceptLabelBackgroundColor = colors.acceptLabelActiveBackgroundColor;
acceptLabelGreenColor = colors.acceptLabelGreenColor;
secondaryActionIcon = assetUriForEmbed;
acceptLabelIcon = assetUriForEmbed2;
acceptLabelText = r38;
isRsvped = isInterestedInEventRecurrence;
}
} else {
acceptLabelBackgroundColor = processColorOrThrow(Module712.unsafe_rawColors.GREEN_360);
acceptLabelText = intl.string(t.XpeFYr);
acceptLabelGreenColor = colors.acceptLabelGreenColor;
secondaryActionIcon = void 0;
acceptLabelIcon = void 0;
isRsvped = false;
}
if (!isGuildEventInvitable) {
secondaryActionIcon = void 0;
}
const content = description != null ? MarkupUtils.parseToAST(description, true, {
channelId: id,
allowLinks: true,
allowEmojiLinks: true,
allowHeading: true,
allowList: true
}) : void 0;
let channelName = getLocationFromEvent(guildEvent);
if (channelName == null) {
channelName = channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : void 0;
}
const eventLocationIconSource = getEventLocationIconSource(guildEvent, channel, embedCanBeTapped);
const user = UserStore.getUser(guildEvent.creator_id);
GuildScheduledEventManager.getGuildEventUserCounts(guildEvent.guild_id, guildEvent.id, recurrenceId != null ? [recurrenceId] : []);
GuildScheduledEventManager.getGuildEventsForCurrentUser(guildEvent.guild_id);
const r182 = {
...r31,
acceptLabelBackgroundColor,
acceptLabelBorderColor: isRsvped ? colors.acceptLabelDisabledBorderColor : void 0,
acceptLabelColor: acceptLabelGreenColor,
acceptLabelIcon,
acceptLabelText,
badgeCount: userCount == null ? void 0 : userCount.toLocaleString(),
badgeIcon: getAssetUriForEmbed(Module12358),
channelIcon: eventLocationIconSource != null ? getAssetUriForEmbed(eventLocationIconSource) : void 0
};
if (channelName == null) {
channelName = void 0;
}
r182.channelName = channelName;
r182.content = content;
r182.creatorAvatar = user != null ? getAssetUriForEmbed(user.getAvatarSource(guildEvent.guild_id)) : void 0;
r182.extendedType = CodedLinkExtendedType.GUILD_SCHEDULED_EVENT;
r182.guildIcon = guildIcon;
r182.guildName = guild?.name;
let headerColor = processColor(color);
if (headerColor == null) {
headerColor = colors.headerColor;
}
r182.headerColor = headerColor;
r182.headerIcon = getAssetUriForEmbed(icon);
r182.headerText = text;
if (shouldChangeTextColor) {
let r218 = processColor(color);
if (r218 == null) {
r218 = colors.headerColor;
}
headerTextColor = r218;
} else {
headerTextColor = colors.headerColor;
}
r182.headerTextColor = headerTextColor;
r182.isRsvped = isRsvped;
r182.secondaryActionIcon = secondaryActionIcon;
r182.titleText = name;
r182.type = type;
r182.guildEventId = guildEvent.id;
return r182;
};
c8531_17 = {};
export function createGuildScheduledEventInviteEmbed(a0, a1) {
let r49;
const channel = ChannelStore.getChannel(a0.channel?.id);
const guild_id = channel?.guild_id;
const guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(a0.guild_scheduled_event?.id);
const userCount = GuildScheduledEventStore.getUserCount(a0.guild_scheduled_event?.id, null);
if (guildScheduledEvent == null) {
const r50 = guild_id != null;
r49 = null;
if (r50) {
GuildScheduledEventsActionCreators.fetchGuildEventsForGuild(guild_id);
r49 = null;
}
} else {
if (guild_id != null) {
GuildScheduledEventManager.getGuildEventUserCounts(guild_id, guildScheduledEvent.id, []);
}
const guild = a0.guild != null ? fromInviteGuild(a0.guild) : GuildStore.getGuild(channel?.guild_id);
let type = a0.type;
if (type == null) {
type = InviteTypes.GUILD;
}
r49 = createGuildScheduledEventEmbed({
channel,
guildEvent: guildScheduledEvent,
userCount,
guild,
theme: a1,
type
});
}
return r49;
}
export function createGuildScheduledEventLinkEmbed(a0, a1) {
let [r19, r20, recurrenceId] = a0.split("-");
let c19802_0 = r19;
const guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(r20);
if (recurrenceId == null) {
recurrenceId = getNextRecurrenceIdInEvent(guildScheduledEvent);
}
if (recurrenceId == null) {
recurrenceId = void 0;
}
if (guildScheduledEvent != null && !isGuildEventEnded(guildScheduledEvent)) {
GuildScheduledEventManager.getGuildEventUserCounts(r19, guildScheduledEvent.id, recurrenceId != null ? [recurrenceId] : []);
const userCount = GuildScheduledEventStore.getUserCount(guildScheduledEvent.id, recurrenceId);
return createGuildScheduledEventEmbed({
channel: ChannelStore.getChannel(guildScheduledEvent?.channel_id),
guildEvent: guildScheduledEvent,
userCount,
guild: GuildStore.getGuild(r19),
theme: a1,
type: InviteTypes.GUILD,
recurrenceId
});
}
if (!c8531_17[r19]) {
GuildScheduledEventsActionCreators.fetchGuildEventsForGuild(r19).then(() => delete c8531_17[c19802_0]).catch(() => delete c8531_17[c19802_0]);
c8531_17[r19] = true;
}
return null;
}
@@ -0,0 +1,59 @@
// Metro module 12362 (f12363).
import { Image as Image2 } from "react-native";
import GuildTemplateStore from "../../../../../../guild_templates/GuildTemplateStore";
import { GuildTemplateStates } from "../../../../../../guild_templates/GuildTemplatesConstants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import { intl, t } from "../../../../../../../intl/index.native";
import { processColorOrThrow } from "../../../RowGeneratorStyleSheet";
import Module712 from "../../../../../../../_bundle/Module712";
import { isThemeDark } from "../../../../../../../design/shared";
import Module10994 from "../../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../../_bundle/Module10995";
import Module12363 from "../../../../../../../_bundle/Module12363";
export function createGuildTemplateEmbed(a0, a1) {
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const guildTemplate = GuildTemplateStore.getGuildTemplate(a0);
if (guildTemplate == null) {
return null;
}
if (guildTemplate.state === GuildTemplateStates.RESOLVING) {
return {
headerText: intl.string(t.Xj87Yf).toUpperCase(),
resolvingGradientEnd: colors.resolvingGradientEnd,
resolvingGradientStart: colors.resolvingGradientStart,
type: InviteTypes.GUILD,
...baseColors
};
}
if (guildTemplate.state === GuildTemplateStates.EXPIRED) {
return {
...baseColors,
headerText: intl.string(t.C7ZRNw).toUpperCase(),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_400),
titleText: intl.string(t.A6MwXE),
thumbnailUrl: Image2.resolveAssetSource(isThemeDark(a1) ? Module10994 : Module10995).uri,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
type: InviteTypes.GUILD
};
}
const subtitle = intl.formatToPlainString(t.L8Awgh, {
usageCount: guildTemplate.usageCount.toString()
});
return {
...baseColors,
headerText: intl.string(t.kAvFkO).toUpperCase(),
headerColor: colors.headerColor,
titleText: guildTemplate.name,
titleColor: colors.titleColor,
subtitle,
subtitleColor: colors.subtitleColor,
thumbnailUrl: Image2.resolveAssetSource(Module12363).uri,
acceptLabelColor: colors.acceptLabelGreenColor,
acceptLabelBackgroundColor: colors.acceptLabelGreenBackgroundColor,
acceptLabelText: intl.string(t["a3Gl+e"]),
embedCanBeTapped: true,
type: InviteTypes.GUILD
};
}
@@ -0,0 +1,67 @@
// Metro module 12352 (f12353).
import InviteStore from "../../../../../../../stores/InviteStore";
import UserStore from "../../../../../../../stores/UserStore";
import { AbortCodes, InviteStates } from "../../../../../../../Constants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import { createResolvingGuildInvite, createErroredGuildInvite, createDisabledGuildInvite, createGuildInvite, createExpiredGuildInvite } from "./invite/GuildInvite";
import { getInviteType, getGuildInviteExtendedType, GuildInviteExtendedType } from "../../../../../../instant_invite/InviteTypeUtils";
import { createGroupDMInvite } from "./invite/GroupDMInvite";
import { createFriendInvite } from "./invite/FriendInvite";
import { createGuildScheduledEventInviteEmbed } from "./GuildScheduledEventEmbed";
import { createEmbeddedActivityInviteEmbed } from "./EmbeddedActivityInviteEmbed";
import { createGuildProfileInvite } from "./invite/GuildProfileInvite";
import { getVoiceChannelListInviteExperiment } from "../../../../../VoiceChannelListInviteExperiment";
import { createVoiceChannelListInviteEmbed } from "./invite/VoiceChannelListInviteEmbed";
export function createInviteEmbed(a0, a1, a2) {
const invite = InviteStore.getInvite(a1);
if (invite == null) {
return null;
}
const id2 = UserStore.getCurrentUser()?.id;
const id = a0.author.id;
if (invite.state === InviteStates.RESOLVING) {
return createResolvingGuildInvite(a2);
}
const r27 = id2 === id;
if (invite.state !== InviteStates.EXPIRED && invite.state !== InviteStates.BANNED) {
if (invite.state === InviteStates.ERROR) {
const inviteError = InviteStore.getInviteError(a1);
return inviteError == null ? createErroredGuildInvite(a1, r27, a2) : inviteError.code === AbortCodes.INVITES_DISABLED ? createDisabledGuildInvite(invite, a2) : createErroredGuildInvite(a1, r27, a2);
}
const inviteType = getInviteType(invite);
if (InviteTypes.GROUP_DM === inviteType) {
return createGroupDMInvite(invite, r27, a2);
}
if (InviteTypes.FRIEND === inviteType) {
return createFriendInvite(invite, r27, id2, a2);
}
const guildInviteExtendedType = getGuildInviteExtendedType(invite);
if (GuildInviteExtendedType.EVENT === guildInviteExtendedType) {
return createGuildScheduledEventInviteEmbed(invite, a2);
}
if (GuildInviteExtendedType.APPLICATION === guildInviteExtendedType) {
return createEmbeddedActivityInviteEmbed({
inviteCode: invite.code,
theme: a2
});
}
if (GuildInviteExtendedType.PROFILE === guildInviteExtendedType) {
return createGuildProfileInvite(invite, a2);
}
if (GuildInviteExtendedType.VOICE_CHANNEL === guildInviteExtendedType) {
const id3 = invite.guild?.id;
if (id3 != null && getVoiceChannelListInviteExperiment({
guildId: id3,
location: "mobile_invite_embed"
}).enabled) {
const voiceChannelListInviteEmbed = createVoiceChannelListInviteEmbed(invite, a2);
if (voiceChannelListInviteEmbed != null) {
return voiceChannelListInviteEmbed;
}
}
return createGuildInvite(invite, r27, a2);
}
return createGuildInvite(invite, r27, a2);
}
return createExpiredGuildInvite(a0, r27, a2);
}
@@ -0,0 +1,66 @@
// Metro module 12366 (f12367).
import _slicedToArray from "../../../../../../../_bundle/_slicedToArray";
import { Image as Image2 } from "react-native";
import { getGuildAcronym } from "../../../../../../../records/GuildRecord";
import ChannelStore from "../../../../../../../stores/ChannelStore";
import GuildStore from "../../../../../../../stores/GuildStore";
import PermissionStore from "../../../../../../../stores/PermissionStore";
import RelationshipStore from "../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../stores/UserStore";
import { Permissions } from "../../../../../../../Constants";
import { InviteTypes } from "../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../getEmbedThemeColors";
import AvatarUtils from "../../../../../../../utils/AvatarUtils";
import { isAndroid } from "../../../../../../../utils/PlatformUtils";
import { intl, t } from "../../../../../../../intl/index.native";
import { getChannelIcon } from "../../../../../../../utils/native/ChannelUtils";
import { computeChannelName } from "../../../../../../channel/useChannelName";
export function createVoiceChannelLinkEmbed(a0, a1) {
let r12, thumbnailText;
const r22 = _slicedToArray(a0.split("/"), 2);
const r23 = r22[0];
const channel = ChannelStore.getChannel(r22[1]);
const guild = GuildStore.getGuild(r23);
if (channel != null && channel.isGuildVocal() && guild != null && PermissionStore.can(Permissions.VIEW_CHANNEL, channel) && PermissionStore.can(Permissions.CONNECT, channel)) {
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
if (guild?.icon != null) {
r12 = AvatarUtils.getGuildIconURL({
id: guild?.id,
icon: guild?.icon,
canAnimate: true,
size: 128
});
thumbnailText = void 0;
} else {
thumbnailText = guild != null ? getGuildAcronym(guild) : void 0;
r12 = void 0;
}
return {
...baseColors,
headerText: isAndroid() ? "" : void 0,
headerColor: colors.headerColor,
acceptLabelText: channel.isGuildStageVoice() ? intl.string(t["7vb2cc"]) : intl.string(t.gpqgah),
onlineText: void 0,
memberText: void 0,
channelIcon: Image2.resolveAssetSource(getChannelIcon(channel))?.uri,
titleText: computeChannelName(channel, UserStore, RelationshipStore),
titleColor: colors.titleColor,
thumbnailUrl: r12 ?? void 0,
thumbnailText,
subtitleColor: void 0,
acceptLabelBackgroundColor: colors.acceptLabelGreenBackgroundColor,
acceptLabelBorderColor: void 0,
acceptLabelColor: colors.acceptLabelGreenColor,
embedCanBeTapped: true,
canBeAccepted: true,
channelName: intl.formatToPlainString(t["2wimj5"], {
guildName: guild.name
}),
subtitle: "",
type: InviteTypes.GUILD,
inviteSplash: void 0
};
}
return null;
}
@@ -0,0 +1,68 @@
// Metro module 12356 (f12357).
import { Image as Image2 } from "react-native";
import RelationshipStore from "../../../../../../../../stores/RelationshipStore";
import { InviteTypes } from "../../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import { intl, t } from "../../../../../../../../intl/index.native";
import UserUtils from "../../../../../../../../utils/UserUtils";
import AvatarUtils from "../../../../../../../../utils/AvatarUtils";
export function createFriendInvite(a0, a1, a2, a3) {
let acceptLabelDisabledBackgroundColor, acceptLabelDisabledColor, acceptLabelText, canBeAccepted;
const embedThemeColors = getEmbedThemeColors(a3);
const { colors, baseColors } = embedThemeColors;
const r18 = a1 ? intl.string(t.eQyu1F) : intl.string(t.PYJHW6);
const titleText = a0.inviter != null ? a0.inviter.username : "";
const subtitle = a0.inviter != null ? UserUtils.getUserTag(a0.inviter) : "";
const r48 = a0.inviter != null && RelationshipStore.isFriend(a0.inviter?.id);
const r54 = a0.inviter != null ? Image2.resolveAssetSource(AvatarUtils.getUserAvatarSource(a0.inviter)).uri : "";
if (a0.inviter?.id === a2) {
acceptLabelDisabledColor = colors.acceptLabelDisabledColor;
acceptLabelDisabledBackgroundColor = colors.acceptLabelDisabledBackgroundColor;
acceptLabelText = intl.string(t.ib7Ng1);
canBeAccepted = false;
} else {
const { acceptLabelGreenColor, acceptLabelGreenBackgroundColor } = colors;
if (r48) {
acceptLabelText = intl.string(t.xhxnPn);
canBeAccepted = true;
acceptLabelDisabledBackgroundColor = acceptLabelGreenBackgroundColor;
acceptLabelDisabledColor = acceptLabelGreenColor;
} else {
acceptLabelText = intl.string(t.ib7Ng1);
canBeAccepted = true;
acceptLabelDisabledBackgroundColor = acceptLabelGreenBackgroundColor;
acceptLabelDisabledColor = acceptLabelGreenColor;
}
}
const headerText = r18 != null ? r18.toUpperCase() : void 0;
const thumbnailUrl = r54 ?? void 0;
const subtitleColor = subtitle !== "" ? colors.subtitleColor : void 0;
let channelName = a0.channel?.name;
if (channelName == null) {
channelName = void 0;
}
let type = a0.type;
if (type == null) {
type = InviteTypes.FRIEND;
}
return {
...baseColors,
thumbnailCornerRadius: 25,
headerText,
headerColor: colors.headerColor,
acceptLabelText,
channelIcon: void 0,
titleText,
titleColor: colors.titleColor,
thumbnailUrl,
subtitle,
subtitleColor,
acceptLabelBackgroundColor: acceptLabelDisabledBackgroundColor,
acceptLabelBorderColor: void 0,
acceptLabelColor: acceptLabelDisabledColor,
embedCanBeTapped: false,
canBeAccepted,
channelName,
type
};
}
@@ -0,0 +1,76 @@
// Metro module 12355 (f12356).
import ChannelStore from "../../../../../../../../stores/ChannelStore";
import RelationshipStore from "../../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../../stores/UserStore";
import { InviteTypes } from "../../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import getChannelAndRecipientsFromInvite from "./getChannelAndRecipientsFromInvite";
import { intl, t } from "../../../../../../../../intl/index.native";
import { getChannelIconSource } from "../../../../../../../channel/getChannelIcon";
import { ensureAvatarSource } from "../../../../../../../../utils/native/AvatarUtils";
import { computeChannelName } from "../../../../../../../channel/useChannelName";
export function createGroupDMInvite(a0, a1, a2) {
let acceptLabelDisabledBackgroundColor, acceptLabelDisabledColor, acceptLabelText;
const embedThemeColors = getEmbedThemeColors(a2);
const { colors, baseColors } = embedThemeColors;
const channelAndRecipientsFromInvite = getChannelAndRecipientsFromInvite(a0);
let channel = channelAndRecipientsFromInvite.channel;
const recipients_ = channelAndRecipientsFromInvite.recipients_;
const channel2 = ChannelStore.getChannel(channel?.id);
const r4 = channel2 != null;
let r36 = false;
if (r4) {
r36 = true;
channel = channel2;
}
const r20 = a1 ? intl.string(t.qmtuXE) : intl.string(t["3p3/BK"]);
if (r36) {
intl.string(t.cEnaWx);
} else {
intl.string(t.XpeFYr);
}
const memberText = recipients_.length > 0 ? intl.formatToPlainString(t.zRl6XR, {
count: recipients_.length
}) : void 0;
const r71 = channel != null ? getChannelIconSource(channel) : null;
const r76 = r71 != null ? ensureAvatarSource(r71).uri : null;
const titleText = (r36 ? channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : null : null) || a0.channel?.name || recipients_.map((item) => item.username).join(", ") || intl.string(t.LJpTRF);
if (r36) {
acceptLabelDisabledColor = colors.acceptLabelDisabledColor;
acceptLabelDisabledBackgroundColor = colors.acceptLabelDisabledBackgroundColor;
acceptLabelText = intl.string(t.cEnaWx);
} else {
acceptLabelDisabledColor = colors.acceptLabelGreenColor;
acceptLabelDisabledBackgroundColor = colors.acceptLabelGreenBackgroundColor;
acceptLabelText = intl.string(t.XpeFYr);
}
const headerText = r20 != null ? r20.toUpperCase() : void 0;
const thumbnailUrl = r76 ?? void 0;
const channelName = r36 ? channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : titleText : titleText;
let type = a0.type;
if (type == null) {
type = InviteTypes.GROUP_DM;
}
return {
...baseColors,
headerText,
headerColor: colors.headerColor,
acceptLabelText,
onlineText: void 0,
memberText,
channelIcon: void 0,
titleText,
titleColor: colors.titleColor,
thumbnailUrl,
thumbnailText: void 0,
subtitle: "",
subtitleColor: void 0,
acceptLabelBackgroundColor: acceptLabelDisabledBackgroundColor,
acceptLabelBorderColor: void 0,
acceptLabelColor: acceptLabelDisabledColor,
embedCanBeTapped: true,
canBeAccepted: !r36,
channelName,
type
};
}
@@ -0,0 +1,317 @@
// Metro module 12353 (f12354).
import { Image as Image2 } from "react-native";
import { getGuildAcronym, getGuildIconURL } from "../../../../../../../../records/GuildRecord";
import ApplicationStreamingStore from "../../../../../../../../stores/ApplicationStreamingStore";
import ChannelStore from "../../../../../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../../../../../stores/GuildMemberStore";
import GuildStore from "../../../../../../../../stores/GuildStore";
import InviteStore from "../../../../../../../../stores/InviteStore";
import RelationshipStore from "../../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../../stores/UserStore";
import { CodedLinkExtendedType } from "../CodedLinksConstants";
import { ChannelTypes, GuildFeatures, HelpdeskArticles } from "../../../../../../../../Constants";
import { InviteTargetTypes, InviteTypes } from "../../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import { intl, t } from "../../../../../../../../intl/index.native";
import { processColorOrThrow } from "../../../../RowGeneratorStyleSheet";
import Module712 from "../../../../../../../../_bundle/Module712";
import UserUtils from "../../../../../../../../utils/UserUtils";
import { isThemeDark } from "../../../../../../../../design/shared";
import Module10994 from "../../../../../../../../_bundle/Module10994";
import Module10995 from "../../../../../../../../_bundle/Module10995";
import { fromInviteGuild } from "../../../../../../../../utils/GuildRecordUtils";
import HelpdeskUtils from "../../../../../../../../utils/HelpdeskUtils";
import { getAssetUriForEmbed } from "../../../../EmbedUtils";
import Module11827 from "../../../../../../../../_bundle/Module11827";
import { getDescriptiveInviteError } from "../../../../../../../../utils/InviteErrorUtils";
import GuestUtils from "../../../../../../../guests/GuestUtils";
import getChannelAndRecipientsFromInvite from "./getChannelAndRecipientsFromInvite";
import { getHeaderTextForInvite } from "../../../../../../getHeaderTextForInvite";
import { hasFlag } from "../../../../../../../../_bundle/Module1384";
import { GuildInviteFlags } from "../../../../../../../../_bundle/Module6709";
import AvatarUtils from "../../../../../../../../utils/AvatarUtils";
import getDevicePixelRatio_native from "../../../../../../../../utils/getDevicePixelRatio.native";
import { getChannelIcon } from "../../../../../../../../utils/native/ChannelUtils";
import { getGuildBadgeImageSource } from "../../../../../../../guild_badge/native/GuildBadgeImageSource";
import { computeChannelName } from "../../../../../../../channel/useChannelName";
export function createResolvingGuildInvite(a0) {
const embedThemeColors = getEmbedThemeColors(a0);
const { colors, baseColors } = embedThemeColors;
return {
headerText: intl.string(t["N/g9Z4"]).toUpperCase(),
resolvingGradientEnd: colors.resolvingGradientEnd,
resolvingGradientStart: colors.resolvingGradientStart,
type: InviteTypes.GUILD,
...baseColors
};
}
export function createExpiredGuildInvite(a0, a1, a2) {
const embedThemeColors = getEmbedThemeColors(a2);
const colors = embedThemeColors.colors;
return {
...embedThemeColors.baseColors,
headerText: (a1 ? intl.string(t.C89OLE) : intl.string(t.YVub5y)).toUpperCase(),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_400),
subtitle: a1 ? intl.string(t["F/OLvL"]) : a0.author?.username != null ? intl.formatToPlainString(t["9Akp1s"], {
username: UserUtils.getFormattedName(a0.author)
}) : intl.string(t["SMJr+a"]),
titleText: intl.string(t["Jhx/ud"]),
thumbnailUrl: Image2.resolveAssetSource(isThemeDark(a2) ? Module10994 : Module10995).uri,
thumbnailBackgroundColor: colors.thumbnailBackgroundColor,
subtitleColor: colors.subtitleColor,
type: InviteTypes.GUILD
};
}
export function createDisabledGuildInvite(a0, a1) {
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const r27 = a0.guild != null ? fromInviteGuild(a0.guild) : GuildStore.getGuild(ChannelStore.getChannel(a0.channel?.id)?.guild_id);
const r34 = r27 != null ? getGuildIconURL(r27, 48, false) : void 0;
const r37 = {
...baseColors,
extendedType: CodedLinkExtendedType.GUILD_INVITE_DISABLED,
headerText: intl.string(t["Hyx2F/"]).toUpperCase(),
titleText: intl.string(t.tQ4AnN),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_345)
};
let guildName = r27?.name;
if (guildName == null) {
guildName = intl.string(t.wBceYP);
}
r37.guildName = guildName;
r37.subtitle = intl.string(t["x+XpjL"]);
r37.helpCenterArticleLabel = intl.string(t["4FlZqw"]);
r37.helpCenterArticleURL = HelpdeskUtils.getArticleURL(HelpdeskArticles.INVITE_DISABLED);
let guildIcon = r34;
if (guildIcon == null) {
guildIcon = void 0;
}
r37.guildIcon = guildIcon;
r37.thumbnailUrl = getAssetUriForEmbed(Module11827);
r37.thumbnailText = r34 != null ? void 0 : r27 != null ? getGuildAcronym(r27) : void 0;
r37.subtitleColor = colors.subtitleColor;
r37.type = InviteTypes.GUILD;
return r37;
}
export function createErroredGuildInvite(a0, a1, a2) {
const embedThemeColors = getEmbedThemeColors(a2);
const { colors, baseColors } = embedThemeColors;
const inviteError = InviteStore.getInviteError(a0);
const descriptiveInviteError = getDescriptiveInviteError(inviteError?.code);
const r26 = {
...baseColors,
headerText: (a1 ? intl.string(t.C89OLE) : intl.string(t.YVub5y)).toUpperCase(),
titleColor: processColorOrThrow(Module712.unsafe_rawColors.RED_400)
};
let subtitle = descriptiveInviteError?.description;
if (subtitle == null) {
subtitle = inviteError?.message;
}
r26.subtitle = subtitle;
let titleText = descriptiveInviteError?.title;
if (titleText == null) {
titleText = intl.string(t["Jhx/ud"]);
}
r26.titleText = titleText;
r26.thumbnailUrl = Image2.resolveAssetSource(isThemeDark(a2) ? Module10994 : Module10995).uri;
r26.thumbnailBackgroundColor = colors.thumbnailBackgroundColor;
r26.subtitleColor = colors.subtitleColor;
r26.type = InviteTypes.GUILD;
return r26;
}
export function createGuildInvite(a0, a1, a2) {
let r27, r33, r119, r121, acceptLabelBackgroundColor, acceptLabelColor, acceptLabelText, channelIcon, memberText, onlineText, subtitle, thumbnailText, titleText;
const embedThemeColors = getEmbedThemeColors(a2);
const { colors, baseColors } = embedThemeColors;
let r31 = a0.guild != null ? GuildStore.getGuild(a0.guild.id) : null;
const canAcceptInvite = GuestUtils.canAcceptInvite([GuildMemberStore], a0);
const channel = getChannelAndRecipientsFromInvite(a0).channel;
const isVoiceChannel = channel != null && channel.isGuildVocal();
let isStage = channel == null ? void 0 : channel.isGuildStageVoice();
if (isStage == null) {
isStage = false;
}
const { target_user, target_type } = a0;
let approximate_member_count = a0.approximate_member_count;
const approximate_presence_count = a0.approximate_presence_count;
const STREAM = InviteTargetTypes.STREAM;
const r2 = a0.guild != null && r31 == null;
let r4 = true;
if (r2) {
r31 = fromInviteGuild(a0.guild);
r4 = false;
}
let isHubGuild = r31 == null ? void 0 : r31.features.has(GuildFeatures.HUB);
if (isHubGuild == null) {
isHubGuild = false;
}
const isStream = target_type === STREAM;
let flags = a0.flags;
if (flags == null) {
flags = 0;
}
const headerTextForInvite = getHeaderTextForInvite({
isVoiceChannel,
isOwnInvite: a1,
isHubGuild,
isStream,
isStage,
isGuest: hasFlag(flags, GuildInviteFlags.IS_GUEST_INVITE)
});
const name = r31?.name;
if (r31?.icon != null) {
r27 = AvatarUtils.getGuildIconURL({
id: r31?.id,
icon: r31?.icon,
canAnimate: true,
size: 128
});
r33 = void 0;
} else {
r33 = r31 != null ? getGuildAcronym(r31) : void 0;
r27 = void 0;
}
const r100 = r31?.splash != null;
let inviteSplash = void 0;
if (r100) {
let r112 = AvatarUtils.getGuildSplashURL({
id: r31.id,
splash: r31.splash,
size: 400 * getDevicePixelRatio_native()
});
if (r112 == null) {
r112 = void 0;
}
inviteSplash = r112;
}
L63: {
if (isVoiceChannel) {
if (r4 && target_user != null && isStream) {
const uri3 = Image2.resolveAssetSource(AvatarUtils.getUserAvatarSource(target_user)).uri;
const r189 = intl.formatToPlainString(t.QmlLEq, {
name: UserUtils.getFormattedName(target_user)
});
subtitle = intl.formatToPlainString(t.u0vaDE, {
guildName: r31?.name
});
r119 = ApplicationStreamingStore.getActiveStreamForUser(target_user.id, channel.getGuildId()) != null;
thumbnailText = void 0;
r121 = uri3;
titleText = r189;
channelIcon = void 0;
memberText = void 0;
onlineText = void 0;
break L63;
}
const uri2 = Image2.resolveAssetSource(getChannelIcon(channel))?.uri;
subtitle = "";
channelIcon = uri2;
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
memberText = void 0;
onlineText = void 0;
} else {
if (channel != null && channel.type === ChannelTypes.GUILD_STAGE_VOICE) {
const uri = Image2.resolveAssetSource(getChannelIcon(channel))?.uri;
subtitle = "";
channelIcon = uri;
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
memberText = void 0;
onlineText = void 0;
break L63;
}
if (!(approximate_member_count != null && approximate_member_count >= 5) && !(approximate_presence_count != null && approximate_presence_count > 0)) {
const r6 = channel != null;
subtitle = "";
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
channelIcon = void 0;
memberText = void 0;
onlineText = void 0;
if (!r6) {
break L63;
}
channelIcon = Image2.resolveAssetSource(getChannelIcon(channel))?.uri;
subtitle = "";
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
memberText = void 0;
onlineText = void 0;
break L63;
}
const r140 = intl.formatToPlainString(t["LC+S+m"], {
membersOnline: approximate_presence_count
});
const zRl6XR = t.zRl6XR;
if (approximate_member_count == null) {
approximate_member_count = 0;
}
memberText = intl.formatToPlainString(zRl6XR, {
count: approximate_member_count
});
subtitle = "";
r119 = r4;
thumbnailText = r33;
r121 = r27;
titleText = name;
channelIcon = void 0;
onlineText = r140;
}
}
if (isVoiceChannel) {
const { acceptLabelGreenColor, acceptLabelGreenBackgroundColor } = colors;
acceptLabelText = isStage ? intl.string(t["7vb2cc"]) : intl.string(t.gpqgah);
acceptLabelBackgroundColor = acceptLabelGreenBackgroundColor;
acceptLabelColor = acceptLabelGreenColor;
} else if (r119) {
acceptLabelColor = colors.acceptLabelDisabledColor;
acceptLabelBackgroundColor = colors.acceptLabelDisabledBackgroundColor;
acceptLabelText = intl.string(t.cEnaWx);
} else {
acceptLabelColor = colors.acceptLabelGreenColor;
acceptLabelBackgroundColor = colors.acceptLabelGreenBackgroundColor;
acceptLabelText = intl.string(t.XpeFYr);
}
const r239 = r31 != null ? getGuildBadgeImageSource(r31, a2) : void 0;
const headerText = headerTextForInvite != null ? headerTextForInvite.toUpperCase() : void 0;
const thumbnailUrl = r121 ?? void 0;
const subtitleColor = subtitle !== "" ? colors.subtitleColor : void 0;
const channelName = channel != null ? computeChannelName(channel, UserStore, RelationshipStore) : void 0;
let type = a0.type;
if (type == null) {
type = InviteTypes.GUILD;
}
return {
...baseColors,
headerText,
headerColor: colors.headerColor,
acceptLabelText,
onlineText,
memberText,
channelIcon,
titleText,
titleColor: colors.titleColor,
thumbnailUrl,
thumbnailText,
subtitle,
subtitleColor,
acceptLabelBackgroundColor,
acceptLabelBorderColor: void 0,
acceptLabelColor,
embedCanBeTapped: true,
canBeAccepted: canAcceptInvite,
channelName,
type,
inviteSplash,
badgeIconUrl: r239 != null ? getAssetUriForEmbed(r239) : void 0
};
}
@@ -0,0 +1,210 @@
// Metro module 12361 (f12362).
import LocaleStore from "../../../../../../../user_settings/LocaleStore";
import { CodedLinkExtendedType } from "../CodedLinksConstants";
import { GuildFeatures } from "../../../../../../../../Constants";
import { InviteTypes } from "../../../../../../../instant_invite/Constants";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import { buildGuildProfileFromInvite } from "../../../../../../../guild_profile/GuildProfileBuilders";
import { isThemeDark } from "../../../../../../../../design/shared";
import Module712 from "../../../../../../../../_bundle/Module712";
import { fromGuildProfile } from "../../../../../../../../utils/GuildRecordUtils";
import { getProfilePrimaryColor } from "../../../../../../../guild_profile/native/GuildProfileUtils";
import { getBackgroundForProfile } from "../../../../../../../guild_profile/native/components/GuildProfileView";
import AvatarUtils from "../../../../../../../../utils/AvatarUtils";
import { getAcronym } from "../../../../../../../../_bundle/Module1857";
import getDevicePixelRatio_native from "../../../../../../../../utils/getDevicePixelRatio.native";
import { intl, t } from "../../../../../../../../intl/index.native";
import { getGuildProfileCTAType, CTATypes } from "../../../../../../../guild_profile/hooks/useGuildProfileCTA";
import { getGuildBadgeImageSource } from "../../../../../../../guild_badge/native/GuildBadgeImageSource";
import { getEstablishedDate } from "../../../../../../../guild_profile/GuildProfileUtils";
import SnowflakeUtils from "../../../../../../../../utils/SnowflakeUtils";
import { sortInviteRoles, inviteRoleToDisplayData } from "../../../../../../../../utils/GuildRoleUtils";
import { getRoleIconData } from "../../../../../../../guild_boosting/RoleIconUtils";
import { int2hex } from "../../../../../../../../_bundle/int2hslRaw";
import { processColorOrThrow } from "../../../../RowGeneratorStyleSheet";
import { getAssetUriForEmbed } from "../../../../EmbedUtils";
export function createGuildProfileInvite(a0, a1) {
let r22, acceptLabelText, thumbnailText;
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const r13 = buildGuildProfileFromInvite(a0);
const r15 = isThemeDark(a1) ? Module712.unsafe_rawColors.PRIMARY_660 : Module712.unsafe_rawColors.PRIMARY_160;
const r12 = r13 != null ? fromGuildProfile(r13) : null;
let r50 = getProfilePrimaryColor(r13);
if (r50 == null) {
r50 = r15;
}
const [r18, r17] = getBackgroundForProfile(a1, r50);
let count = r13?.memberCount;
if (count == null) {
count = a0.approximate_member_count;
}
let membersOnline = r13?.onlineCount;
if (membersOnline == null) {
membersOnline = a0.approximate_presence_count;
}
if (r13?.icon != null) {
r22 = AvatarUtils.getGuildIconURL({
id: r13.id,
icon: r13.icon,
canAnimate: true,
size: 128
});
thumbnailText = void 0;
} else {
let r64 = r13?.name;
if (r64 == null) {
r64 = "";
}
thumbnailText = getAcronym(r64);
r22 = void 0;
}
const r72 = r12 == null ? void 0 : r12.features.has(GuildFeatures.DISCOVERABLE);
let inviteSplash = void 0;
if (r72) {
const r80 = r13?.customBanner != null;
inviteSplash = void 0;
if (r80) {
let r91 = AvatarUtils.getGuildDiscoverySplashURL({
id: r13.id,
splash: r13.customBanner,
size: 400 * getDevicePixelRatio_native()
});
if (r91 == null) {
r91 = void 0;
}
inviteSplash = r91;
}
}
const r92 = count != null && count >= 5 || membersOnline != null && membersOnline > 0;
let memberText = void 0;
let onlineText = void 0;
if (r92) {
const r97 = membersOnline != null ? intl.formatToPlainString(t["LC+S+m"], {
membersOnline
}) : void 0;
memberText = count != null ? intl.formatToPlainString(t.zRl6XR, {
count
}) : void 0;
onlineText = r97;
}
const r117 = r13 != null ? getGuildProfileCTAType(r13, a0.code) : null;
if (CTATypes.IS_MEMBER === r117) {
acceptLabelText = intl.string(t.IRoQXr);
} else if (CTATypes.HAS_APPLICATION === r117) {
acceptLabelText = intl.string(t["4yfIDk"]);
} else if (CTATypes.APPLY_TO_JOIN === r117) {
acceptLabelText = intl.string(t["7XdMW2"]);
} else if (CTATypes.ACCEPT_ROLES === r117) {
acceptLabelText = intl.string(t.MMlhsr);
} else {
if (CTATypes.LURK_DISCOVERABLE !== r117) {
CTATypes.JOIN_VIA_INVITE;
}
acceptLabelText = intl.string(t.XpeFYr);
}
const r188 = r12 != null ? getGuildBadgeImageSource(r12, a1) : void 0;
const r192 = r13 == null;
let r193 = void 0;
if (!r192) {
const traits = r13.traits;
r193 = traits == null ? void 0 : traits.filter((trait) => trait != null && trait.label.trim().length > 0);
}
const establishedText = r13 != null ? intl.formatToPlainString(t.zb2Q56, {
createdAtDate: getEstablishedDate(SnowflakeUtils.extractTimestamp(r13.id), LocaleStore.locale)
}) : void 0;
const r221 = a0.roles != null;
let roles = void 0;
if (r221) {
const r226 = a0.roles.length > 0;
roles = void 0;
if (r226) {
const r228 = a0.guild != null;
roles = void 0;
if (r228) {
const id = a0.guild.id;
roles = [...a0.roles].sort(sortInviteRoles).map((item) => {
let r22 = getRoleIconData(inviteRoleToDisplayData(id, item), 16);
if (r22 == null) {
r22 = {};
}
const { customIconSrc, unicodeEmoji } = r22;
let color = item.color;
if (color == null) {
color = 0;
}
const r27 = int2hex(color);
const roleIcon = customIconSrc == null ? unicodeEmoji != null ? {
source: customIconSrc,
unicodeEmoji: unicodeEmoji?.surrogates,
name: item.name,
size: 16,
alt: intl.formatToPlainString(t["9+YWrE"], {
name: item.name
})
} : void 0 : {
source: customIconSrc,
unicodeEmoji: unicodeEmoji?.surrogates,
name: item.name,
size: 16,
alt: intl.formatToPlainString(t["9+YWrE"], {
name: item.name
})
};
return {
id: item.id,
name: item.name,
color: processColorOrThrow(r27),
roleIcon
};
});
}
}
}
const name = r13?.name;
const thumbnailUrl = r22 ?? void 0;
let bodyText = r13?.description;
if (bodyText == null) {
bodyText = "";
}
let type = a0.type;
if (type == null) {
type = InviteTypes.GUILD;
}
const r241 = {
...baseColors,
extendedType: CodedLinkExtendedType.GUILD_PROFILE_INVITE,
acceptLabelText,
onlineText,
memberText,
titleText: name,
thumbnailUrl,
thumbnailText,
bodyText,
embedCanBeTapped: true,
canBeAccepted: true,
type,
inviteSplash,
bannerColor: processColorOrThrow(r18),
bannerColorSecondary: processColorOrThrow(r17)
};
if (r193 == null) {
r193 = [];
}
let hasProfileOverflow = r193.length > 0;
if (!hasProfileOverflow) {
let r268 = r13?.gameApplicationIds;
if (r268 == null) {
r268 = [];
}
hasProfileOverflow = r268.length > 0;
}
r241.hasProfileOverflow = hasProfileOverflow;
r241.badgeIconUrl = r188 != null ? getAssetUriForEmbed(r188) : void 0;
r241.acceptLabelBackgroundColor = colors.acceptLabelGreenBackgroundColor;
r241.establishedText = establishedText;
r241.headerText = null;
r241.roles = roles;
r241.rolesHeadingText = roles != null ? roles.length > 0 ? intl.string(t.stcSfI) : void 0 : void 0;
return r241;
}
@@ -0,0 +1,174 @@
// Metro module 9498 (f9499).
import { processColor } from "react-native";
import AccessibilityStore from "../../../../../../../a11y/AccessibilityStore";
import VoiceChannelStartTimeStore from "../../../../../../../channel/VoiceChannelStartTimeStore";
import { getGuildIconSource } from "../../../../../../../../records/GuildRecord";
import ChannelStore from "../../../../../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../../../../../stores/GuildMemberStore";
import GuildStore from "../../../../../../../../stores/GuildStore";
import PermissionStore from "../../../../../../../../stores/PermissionStore";
import RelationshipStore from "../../../../../../../../stores/RelationshipStore";
import UserStore from "../../../../../../../../stores/UserStore";
import VoiceStateStore from "../../../../../../../../stores/VoiceStateStore";
import SortedVoiceStateStore from "../../../../../../../../stores/views/SortedVoiceStateStore";
import { CodedLinkExtendedType } from "../CodedLinksConstants";
import { BasicPermissions } from "../../../../../../../../Constants";
import { InviteTypes } from "../../../../../../../instant_invite/Constants";
import getChannelAndRecipientsFromInvite from "./getChannelAndRecipientsFromInvite";
import getEmbedThemeColors from "../../getEmbedThemeColors";
import { getAssetUriForEmbed } from "../../../../EmbedUtils";
import AvatarUtils from "../../../../../../../../utils/AvatarUtils";
import UserUtils from "../../../../../../../../utils/UserUtils";
import { getEmbedScrollGradientBackground } from "../../../../../../../client_themes/native/ClientThemesUtils";
import { computeChannelName } from "../../../../../../../channel/useChannelName";
import { intl, t } from "../../../../../../../../intl/index.native";
import GuestUtils from "../../../../../../../guests/GuestUtils";
export function canShowVoiceChannelListInviteEmbed(a0) {
const r1 = a0.guild == null;
let r9 = null;
if (!r1) {
const guild2 = GuildStore.getGuild(a0.guild.id);
const r12 = guild2 == null;
r9 = null;
if (!r12) {
const channel = getChannelAndRecipientsFromInvite(a0).channel;
const r20 = channel == null;
r9 = null;
if (!r20) {
const isGuildVocal = channel.isGuildVocal();
r9 = null;
if (isGuildVocal) {
let channel2 = ChannelStore.getChannel(channel.id);
if (channel2 == null) {
channel2 = channel;
}
r9 = PermissionStore.canBasicChannel(BasicPermissions.VIEW_CHANNEL, channel2) ? {
guild: guild2,
channel: channel2
} : null;
}
}
}
}
return r9 != null;
}
export function createVoiceChannelListInviteEmbed(a0, a1) {
const r2 = a0.guild == null;
let r7 = null;
if (!r2) {
const guild2 = GuildStore.getGuild(a0.guild.id);
const r31 = guild2 == null;
r7 = null;
if (!r31) {
const channel2 = getChannelAndRecipientsFromInvite(a0).channel;
const r39 = channel2 == null;
r7 = null;
if (!r39) {
const isGuildVocal = channel2.isGuildVocal();
r7 = null;
if (isGuildVocal) {
let channel3 = ChannelStore.getChannel(channel2.id);
if (channel3 == null) {
channel3 = channel2;
}
r7 = PermissionStore.canBasicChannel(BasicPermissions.VIEW_CHANNEL, channel3) ? {
guild: guild2,
channel: channel3
} : null;
}
}
}
}
if (r7 == null) {
return null;
}
let displayNameStylesEnabled;
const { guild, channel } = r7;
const embedThemeColors = getEmbedThemeColors(a1);
const { colors, baseColors } = embedThemeColors;
const guildIcon = guild.icon != null ? getAssetUriForEmbed(getGuildIconSource(guild, 128, false)) : void 0;
const voiceStatesForChannelAlt = SortedVoiceStateStore.getVoiceStatesForChannelAlt(channel.id, guild.id);
const r83 = [...voiceStatesForChannelAlt.filter((item) => item.voiceState.selfStream), ...voiceStatesForChannelAlt.filter((item) => !item.voiceState.selfStream)].slice(0, 10);
displayNameStylesEnabled = AccessibilityStore.displayNameStylesEnabled;
const voiceUsers = r83.map((item) => {
let member = item.member;
if (member == null) {
member = GuildMemberStore.getMember(guild.id, item.user.id);
}
const r24 = member?.avatar != null ? AvatarUtils.getGuildMemberAvatarURLSimple({
guildId: guild.id,
userId: item.user.id,
avatar: member.avatar,
size: 24
}) : AvatarUtils.getUserAvatarURL(item.user, false, 24);
let avatarUrl = r24;
if (typeof avatarUrl === "number") {
avatarUrl = getAssetUriForEmbed(r24);
}
let fontId = void 0;
if (displayNameStylesEnabled) {
let r46 = member == null ? void 0 : member.displayNameStyles?.fontId;
if (r46 == null) {
r46 = item.user.displayNameStyles?.fontId;
}
fontId = r46;
}
let nick = item.nick;
if (nick == null) {
nick = UserUtils.getName(item.user);
}
let selfStream = item.voiceState.selfStream;
if (selfStream == null) {
selfStream = false;
}
return {
userId: item.user.id,
displayName: nick,
avatarUrl,
isStreaming: selfStream,
fontId
};
});
let voiceStartTimestamp = VoiceChannelStartTimeStore.getStartTime(channel);
if (voiceStartTimestamp == null) {
voiceStartTimestamp = void 0;
}
const currentClientVoiceChannelId = VoiceStateStore.getCurrentClientVoiceChannelId(guild.id);
const id = channel.id;
let r101 = getEmbedScrollGradientBackground();
if (r101 == null) {
r101 = void 0;
}
let backgroundColor = processColor(r101);
if (backgroundColor == null) {
backgroundColor = baseColors.backgroundColor;
}
const r95 = {
...baseColors,
backgroundColor,
extendedType: CodedLinkExtendedType.VOICE_CHANNEL_LIST_INVITE,
headerColor: colors.headerColor,
guildName: guild.name,
guildIcon,
headerText: "",
titleText: computeChannelName(channel, UserStore, RelationshipStore)
};
const titleColor = voiceStatesForChannelAlt.length > 0 ? colors.voiceActiveColor : colors.voiceMutedColor;
const isConnected = currentClientVoiceChannelId === id;
r95.titleColor = titleColor;
r95.acceptLabelText = intl.string(t.gpqgah);
r95.acceptLabelColor = colors.acceptLabelGreenColor;
r95.acceptLabelBackgroundColor = colors.acceptLabelGreenBackgroundColor;
r95.canBeAccepted = GuestUtils.canAcceptInvite([GuildMemberStore], a0);
r95.embedCanBeTapped = true;
r95.type = InviteTypes.GUILD;
r95.voiceUsers = voiceUsers;
r95.voiceStartTimestamp = voiceStartTimestamp;
r95.emptyStateText = intl.string(t.zSqdrS);
r95.streamingLabel = intl.string(t.dI3q4h).toUpperCase();
r95.voiceHeaderBackgroundColor = colors.voiceHeaderBackgroundColor;
r95.reducedMotion = AccessibilityStore.useReducedMotion;
r95.isConnected = isConnected;
r95.privacyHintText = intl.string(t.fkg9mQ);
return r95;
}
@@ -0,0 +1,12 @@
// Metro module 9501 (f9502).
import { createChannelRecordFromInvite } from "../../../../../../../../records/ChannelRecord";
export default function getChannelAndRecipientsFromInvite(a0) {
const recipients_ = a0.channel != null && a0.channel.recipients != null ? a0.channel.recipients.slice() : [];
return {
recipients_,
channel: a0.channel != null ? createChannelRecordFromInvite({
...a0.channel,
recipients: recipients_
}) : null
};
};
@@ -0,0 +1,36 @@
// Metro module 12360 (f12361).
import { useMemo } from "react";
import EmbeddedActivitiesStore from "../../../../../../activities/EmbeddedActivitiesStore";
import UserStore from "../../../../../../../stores/UserStore";
import { isNotNullish } from "../../../../../../../utils/GlobalUtils";
import { useStateFromStoresArray } from "../../../../../../../_bundle/defaultAreStatesEqual";
export default function useEmbeddedActivityParticipantAvatarUris({ activity, guildId }) {
let stateFromStoresArray;
stateFromStoresArray = void 0;
const memo = useMemo(() => {
const r4 = Array;
let r7 = activity?.userIds;
if (r7 == null) {
r7 = [];
}
return r4.from(r7);
}, [activity]);
stateFromStoresArray = useStateFromStoresArray([UserStore], () => memo.map((item) => UserStore.getUser(item)), [memo]);
return useMemo(() => stateFromStoresArray.filter(isNotNullish).map((item) => `${item.getAvatarURL(guildId, 64)}`), [guildId, stateFromStoresArray]);
};
export function getEmbeddedActivityParticipantAvatarUris(a0) {
const { channelId, guildId: guildId2, applicationId } = a0;
let activity2 = a0.activity;
if (activity2 == null) {
activity2 = EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(channelId).find((item) => item.applicationId === applicationId);
}
const r16 = Array;
let r18 = activity2?.userIds;
if (r18 == null) {
r18 = [];
}
return r16.from(r18).map((item) => {
const user = UserStore.getUser(item);
return `${user == null ? void 0 : user.getAvatarURL(guildId2, 64)}`;
}).filter(isNotNullish);
}
@@ -0,0 +1,62 @@
// Metro module 7725 (f7726).
import { useMemo } from "react";
import { experimental_createToken, createNativeStyleProperties } from "../../../../../../design/components/Styles/native/createStyles";
import { isThemeDark } from "../../../../../../design/shared";
import Module712 from "../../../../../../_bundle/Module712";
import { hexWithOpacity } from "../../../../../../utils/ColorUtils";
let nativeStyleProperties;
const acceptLabelActiveBackgroundColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_500 : Module712.unsafe_rawColors.PRIMARY_400);
const acceptLabelDisabledBackgroundColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_600 : hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_500, 0.3));
const acceptLabelDisabledBorderColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_500 : Module712.unsafe_rawColors.PRIMARY_400);
const acceptLabelDisabledTextColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_500 : Module712.unsafe_rawColors.PRIMARY_400);
const acceptLabelDisabledColor = experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_500 : Module712.unsafe_rawColors.PRIMARY_100);
nativeStyleProperties = createNativeStyleProperties({
acceptBlurpleLabelBackgroundColor: Module712.colors.BACKGROUND_BRAND,
acceptLabelGreenBackgroundColor: Module712.colors.CONTROL_CONNECTED_BACKGROUND_DEFAULT,
acceptLabelGreenColor: Module712.unsafe_rawColors.WHITE,
backgroundColor: Module712.colors.MOBILE_EMBED_BACKGROUND_DEFAULT,
bodyTextColor: Module712.colors.TEXT_DEFAULT,
clearLabelRedBackgroundColor: Module712.unsafe_rawColors.RED_400,
clearLabelRedColor: Module712.unsafe_rawColors.WHITE,
headerColor: Module712.colors.TEXT_SUBTLE,
subtitleColor: Module712.colors.TEXT_SUBTLE,
titleColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
acceptLabelActiveBackgroundColor,
acceptLabelDisabledBackgroundColor,
acceptLabelDisabledBorderColor,
acceptLabelDisabledTextColor,
acceptLabelDisabledColor,
borderColor: experimental_createToken((a0) => isThemeDark(a0.theme) ? hexWithOpacity(Module712.unsafe_rawColors.WHITE, 0.06) : hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_860, 0.08)),
resolvingGradientEnd: experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_600 : Module712.unsafe_rawColors.PRIMARY_100),
resolvingGradientStart: experimental_createToken((a0) => isThemeDark(a0.theme) ? "#666b73" : Module712.unsafe_rawColors.PRIMARY_300),
thumbnailBackgroundColor: experimental_createToken((a0) => isThemeDark(a0.theme) ? Module712.unsafe_rawColors.PRIMARY_600 : hexWithOpacity(Module712.unsafe_rawColors.PRIMARY_200, 0.3)),
voiceActiveColor: Module712.colors.TEXT_FEEDBACK_POSITIVE,
voiceHeaderBackgroundColor: Module712.colors.BACKGROUND_MOD_MUTED,
voiceMutedColor: Module712.colors.TEXT_MUTED
});
export default function getEmbedThemeColors(a0) {
const colors = nativeStyleProperties(a0);
return {
colors,
baseColors: {
borderColor: colors.borderColor,
backgroundColor: colors.backgroundColor,
thumbnailCornerRadius: 15,
headerColor: colors.headerColor
}
};
};
export function useEmbedThemeColors(a0) {
return useMemo(() => {
const colors = nativeStyleProperties(a0);
return {
colors,
baseColors: {
borderColor: colors.borderColor,
backgroundColor: colors.backgroundColor,
thumbnailCornerRadius: 15,
headerColor: colors.headerColor
}
};
}, [a0]);
}
@@ -0,0 +1,193 @@
// Metro module 8012 (f8013).
import { processColor } from "react-native";
import UserRecord from "../../../../../../records/UserRecord";
import ChannelStore from "../../../../../../stores/ChannelStore";
import UserStore from "../../../../../../stores/UserStore";
import { MessageTypes } from "../../../../../../Constants";
import { ensureAvatarSource } from "../../../../../../utils/native/AvatarUtils";
import AvatarUtils2 from "../../../../../../utils/AvatarUtils";
import { getUserAuthor } from "../../../../useMessageAuthor";
import * as _ApplicationInteractionInfoUtils from "../../../../../applications/ApplicationInteractionInfoUtils";
import Module712 from "../../../../../../_bundle/Module712";
import { getInitialInteractionMetadata } from "../../../../../application_commands/ApplicationCommandUtils";
import { InteractionTypes } from "../../../../../../flow/Server";
import * as _EnhancedRoleColorUtils from "../../../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils";
import { processColorStrings } from "../../../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils";
import { isActivitiesInTextEnabled } from "../../../../../activities/ActivitiesInTextUtils";
import { intl, t } from "../../../../../../intl/index.native";
import { formatPrimaryEntryPointCommandName } from "../../../../../app_launcher/utils/AppLauncherUtils";
export function createExecutedCommand(a0, a1, a2, a3, a4) {
let r202, SSrolr, commandNameOnClick, content;
const r4 = a0.activityInstance != null && a0.activityInstance !== void 0;
L5: {
if (a0.interaction != null) {
if (a0.interaction.displayName === "" && !r4) {
break L5;
}
const user = UserStore.getUser(a0.interaction?.user?.id);
const r44 = user != null;
let avatarURL = void 0;
if (r44) {
const guildMemberAvatar = getUserAuthor(user, a1 == null ? ChannelStore.getChannel(a0.getChannelId()) : a1).guildMemberAvatar;
const guildId = a1 == null ? void 0 : a1.getGuildId();
avatarURL = ensureAvatarSource(guildMemberAvatar != null && guildId != null ? AvatarUtils2.getGuildMemberAvatarSource({
userId: user.id,
avatar: guildMemberAvatar,
guildId
}, user) : user.getAvatarSource(void 0)).uri;
}
const r3 = a0.type === MessageTypes.CHAT_INPUT_COMMAND || a0.type === MessageTypes.INTERACTION_PREMIUM_UPSELL;
const isPrimaryEntryPointCommandMessage = _ApplicationInteractionInfoUtils.isPrimaryEntryPointCommandMessage(a0);
const userAuthor = getUserAuthor(a0.interaction.user, a1);
const { colorString: colorString2, colorStrings: colorStrings2 } = userAuthor;
const displayName = a0.interaction.displayName;
const r94 = Module712.internal.resolveSemanticColor(a3, Module712.colors.MENTION_BACKGROUND);
const initialInteractionMetadata = getInitialInteractionMetadata(a0);
const r105 = initialInteractionMetadata?.type === InteractionTypes.APPLICATION_COMMAND ? initialInteractionMetadata.target_user != null ? new UserRecord(initialInteractionMetadata.target_user) : null : null;
const userAuthor2 = getUserAuthor(r105, a1);
const { colorString, colorStrings } = userAuthor2;
const r118 = a2 === "username";
let linkColor = a4;
if (r118) {
let r123 = processColor(colorString == null ? void 0 : colorString);
if (r123 == null) {
r123 = a4;
}
linkColor = r123;
}
let linkColor2 = a4;
if (r118) {
let r127 = processColor(colorString2 == null ? void 0 : colorString2);
if (r127 == null) {
r127 = a4;
}
linkColor2 = r127;
}
const r129 = a1 == null ? void 0 : a1.getGuildId();
const id = a0.interaction.user.id;
const isNativeMessageEligibleForEnhancedRoleColors = _EnhancedRoleColorUtils.isNativeMessageEligibleForEnhancedRoleColors(r129, id);
const isNativeMessageEligibleForEnhancedRoleColors2 = _EnhancedRoleColorUtils.isNativeMessageEligibleForEnhancedRoleColors(r129, r105?.id);
const roleColors = isNativeMessageEligibleForEnhancedRoleColors ? processColorStrings(colorStrings2) : null;
const roleColors2 = isNativeMessageEligibleForEnhancedRoleColors2 ? processColorStrings(colorStrings) : null;
const r157 = {
username: getUserAuthor(a0.interaction.user, a1).nick,
usernameOnClick: null
};
let r161 = colorString2;
if (r161 == null) {
r161 = void 0;
}
let roleColor = processColor(r161);
if (roleColor == null) {
roleColor = null;
}
const usernameOnClick = {
name: "usernameOnClick",
action: "bindUserMenu",
userId: id,
messageChannelId: a0.channel_id,
linkColor: linkColor2,
roleColor,
roleColors,
shouldShowRoleDot: null
};
let shouldShowRoleDot2 = a2 === "dot";
const shouldShowRoleDot = shouldShowRoleDot2 ? colorString2 != null : shouldShowRoleDot2;
L76: {
usernameOnClick.shouldShowRoleDot = shouldShowRoleDot;
r157.usernameOnClick = usernameOnClick;
if (r4 && !isPrimaryEntryPointCommandMessage) {
if (isActivitiesInTextEnabled(a1)) {
content = intl.formatToParts(t["R/mrBi"], {
...r157,
activityTextOnClick: {
action: "bindTapActivityText",
applicationUserId: a0.author.id,
messageChannelId: a0.channel_id
}
});
break L76;
}
content = intl.formatToParts(t.k964Wm, {
...r157
});
} else {
const commandName = isPrimaryEntryPointCommandMessage ? formatPrimaryEntryPointCommandName(displayName) : displayName;
L66: {
L64: {
SSrolr = t.SSrolr;
r202 = {
...r157,
commandName
};
if (a1 != null) {
if (!r3 && !isPrimaryEntryPointCommandMessage) {
break L64;
}
commandNameOnClick = {
name: "commandNameOnClick",
action: "bindTapCommandName",
userId: a0.interaction.user.id,
messageId: a0.id,
applicationUserId: a0.author.id,
messageType: a0.type,
messageChannelId: a0.channel_id
};
break L66;
}
}
commandNameOnClick = {};
}
r202.commandNameOnClick = commandNameOnClick;
content = intl.formatToParts(SSrolr, r202);
if (r105 != null) {
const mqKdCM = t.mqKdCM;
const r224 = {
...r157,
commandName,
commandNameOnClick: {},
targetUsername: getUserAuthor(r105, a1).nick
};
const id2 = r105?.id;
let r238 = colorString;
if (r238 == null) {
r238 = void 0;
}
let roleColor2 = processColor(r238);
if (roleColor2 == null) {
roleColor2 = null;
}
if (shouldShowRoleDot2) {
shouldShowRoleDot2 = colorString != null;
}
r224.targetUsernameOnClick = {
name: "targetUsernameOnClick",
action: "bindUserMenu",
userId: id2,
messageChannelId: a0.channel_id,
linkColor,
roleColor: roleColor2,
roleColors: roleColors2,
shouldShowRoleDot: shouldShowRoleDot2
};
content = intl.formatToParts(mqKdCM, r224);
}
}
}
return {
userId: a0.interaction.user.id,
username: r157.username,
usernameColor: linkColor2,
avatarURL,
targetUsernameColor: linkColor,
content,
commandNameBackgroundStyles: {
color: processColor(r94),
borderRadius: 4,
spaceAround: true
},
showAppsIcon: true
};
}
}
}
@@ -0,0 +1,50 @@
// Metro module 7992 (f7993).
import { getInteractionStatusViewState, InteractionStatusViewState } from "../../../../../interactions/InteractionUtils";
import { intl, t } from "../../../../../../intl/index.native";
let c5057_2 = {
LOADING: 0,
0: "LOADING",
FAILED: 1,
1: "FAILED",
EPHEMERAL_SUCCESS: 999,
999: "EPHEMERAL_SUCCESS"
};
export function createInteractionStatus(a0, a1) {
const interactionStatusViewState = getInteractionStatusViewState(a0, a1);
if (InteractionStatusViewState.SENDING === interactionStatusViewState) {
return {
text: intl.string(t.RiLfBY),
state: c5057_2.LOADING
};
}
if (InteractionStatusViewState.CREATED === interactionStatusViewState) {
return {
text: intl.formatToPlainString(t["7ePV4t"], {
applicationName: a0.author.username
}),
state: c5057_2.LOADING
};
}
if (InteractionStatusViewState.TIMED_OUT === interactionStatusViewState) {
return {
text: intl.string(t.h8hzPd),
state: c5057_2.FAILED
};
}
if (InteractionStatusViewState.FAILED === interactionStatusViewState) {
let interactionError = a0.interactionError;
if (interactionError == null) {
interactionError = intl.string(t.VCsUJu);
}
return {
text: interactionError,
state: c5057_2.FAILED
};
}
if (InteractionStatusViewState.EPHEMERAL_SUCCESS === interactionStatusViewState) {
return {
text: "",
state: c5057_2.EPHEMERAL_SUCCESS
};
}
}