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,13 @@
// Metro module 5860 (f5861).
export const CONVERSATION_COLORS = ["rgba(237, 66, 69, 0.12)", "rgba(230, 126, 34, 0.12)", "rgba(254, 231, 92, 0.12)", "rgba(87, 242, 135, 0.12)", "rgba(52, 152, 219, 0.12)", "rgba(88, 101, 242, 0.12)", "rgba(155, 89, 182, 0.12)"];
export const FETCH_LIMIT = 25;
export const MOBILE_FETCH_LIMIT = 10;
export const MIN_CONVERSATION_FETCH_BUFFER = 10;
export const MAX_CHANNELS_WITH_CONVERSATIONS = 10;
export const MAX_CONVERSATIONS_PER_CHANNEL = 50;
export const FETCH_BACKOFF_MIN_MS = 2000;
export const FETCH_BACKOFF_MAX_MS = 180000;
export const CONVERSATION_FEEDBACK_RATINGS_CACHE_MAX = 10;
export const PREVIEW_MESSAGE_COUNT = 4;
export const MOBILE_PREVIEW_MESSAGE_COUNT = 3;
export const CONVERSATION_HAS_MORE_EXPIRATION_MS = 3600000;
@@ -0,0 +1,181 @@
// Metro module 9268 (f9269).
import GuildStore from "../../stores/GuildStore";
import { GuildFeatures } from "../../Constants";
import { createApexExperiment } from "../experiments/apex/index";
import { useStateFromStores } from "../../_bundle/Module589";
function $mk82192($env) {
return () => {
const r4 = $env;
const r6 = r4[0];
let r2 = r6 != null;
if (r2) {
const guild = $env.$parent[2].getGuild(r6);
let r9 = guild == null ? void 0 : guild.features.has(r4[1]);
if (r9 == null) {
r9 = false;
}
r2 = r9;
}
return r2;
};
}
let env6098 = {};
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-03-conversation-highlighting-utility",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: false
},
2: {
enabled: true
}
}
});
const c6098_4 = apexExperiment;
const apexExperiment2 = createApexExperiment({
kind: "guild",
name: "2026-06-topical-navigation-guild",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const c6098_5 = apexExperiment2;
const apexExperiment3 = createApexExperiment({
kind: "user",
name: "2026-04-topical-navigation-staff-control",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const c6098_6 = apexExperiment3;
export { apexExperiment as ConversationHighlightingExperiment };
export { apexExperiment2 as TopicalNavGuildExperiment };
export { apexExperiment3 as TopicalNavUserGateExperiment };
export function isConversationDebugUXEnabled(a0, a1) {
const CONVERSATIONS_EXTRACTION_PROCESSING = GuildFeatures.CONVERSATIONS_EXTRACTION_PROCESSING;
let r8 = a0 != null;
if (r8) {
const guild = GuildStore.getGuild(a0);
let r10 = guild == null ? void 0 : guild.features.has(CONVERSATIONS_EXTRACTION_PROCESSING);
if (r10 == null) {
r10 = false;
}
r8 = r10;
}
return !!r8 && c6098_4.getConfig({
location: a1
}).enabled;
}
export function isTopicalNavEnabled(a0, a1) {
if (a0 == null) {
return false;
}
const CONVERSATIONS_EXTRACTION_PROCESSING = GuildFeatures.CONVERSATIONS_EXTRACTION_PROCESSING;
let r2 = a0 != null;
if (r2) {
const guild = GuildStore.getGuild(a0);
let r12 = guild == null ? void 0 : guild.features.has(CONVERSATIONS_EXTRACTION_PROCESSING);
if (r12 == null) {
r12 = false;
}
r2 = r12;
}
if (!!r2 && c6098_4.getConfig({
location: a1
}).enabled) {
return true;
}
if (c6098_6.getConfig({
location: a1
}).enabled) {
const guild2 = GuildStore.getGuild(a0);
return guild2 != null && !guild2.features.has(GuildFeatures.SUMMARIES_ENABLED_GA) && guild2.features.has(GuildFeatures.CONVERSATIONS_EXTRACTION_PROCESSING) && c6098_5.getConfig({
guildId: a0,
location: a1
}).enabled;
}
return false;
}
export function useIsConversationDebugUXEnabled(a0, a1) {
let env17105;
const enabled = c6098_4.useConfig({
location: a1
}).enabled;
const CONVERSATIONS_EXTRACTION_PROCESSING = GuildFeatures.CONVERSATIONS_EXTRACTION_PROCESSING;
const r12 = env17105 = {
$parent: env6098
};
env17105[0] = a0;
env17105[1] = CONVERSATIONS_EXTRACTION_PROCESSING;
return useStateFromStores([GuildStore], $mk82192(r12), [a0, CONVERSATIONS_EXTRACTION_PROCESSING]) && enabled;
}
export function useIsTopicalNavEnabled(a0, a1) {
let env17106;
const enabled = c6098_4.useConfig({
location: a1
}).enabled;
const CONVERSATIONS_EXTRACTION_PROCESSING = GuildFeatures.CONVERSATIONS_EXTRACTION_PROCESSING;
const r18 = env17106 = {
$parent: env6098
};
env17106[0] = a0;
env17106[1] = CONVERSATIONS_EXTRACTION_PROCESSING;
const r22 = useStateFromStores([GuildStore], $mk82192(r18), [a0, CONVERSATIONS_EXTRACTION_PROCESSING]) && enabled;
const enabled2 = c6098_6.useConfig({
location: a1
}).enabled;
const guildId = a0 == null ? "" : a0;
let env17107;
let env17108;
const enabled3 = c6098_5.useConfig({
guildId,
location: a1
}).enabled;
const CONVERSATIONS_EXTRACTION_PROCESSING2 = GuildFeatures.CONVERSATIONS_EXTRACTION_PROCESSING;
const r35 = env17107 = {
$parent: env6098
};
env17107[0] = a0;
env17107[1] = CONVERSATIONS_EXTRACTION_PROCESSING2;
let r42 = useStateFromStores([GuildStore], $mk82192(r35), [a0, CONVERSATIONS_EXTRACTION_PROCESSING2]);
const SUMMARIES_ENABLED_GA = GuildFeatures.SUMMARIES_ENABLED_GA;
const r44 = env17108 = {
$parent: env6098
};
env17108[0] = a0;
env17108[1] = SUMMARIES_ENABLED_GA;
const stateFromStores = useStateFromStores([GuildStore], $mk82192(r44), [a0, SUMMARIES_ENABLED_GA]);
let r52 = a0 != null;
if (r52) {
let r54 = !!r22;
if (!r54) {
let r56 = !!enabled2;
if (r56) {
if (r42) {
r42 = !stateFromStores;
}
if (r42) {
r42 = enabled3;
}
r56 = r42;
}
r54 = r56;
}
r52 = r54;
}
return r52;
}
@@ -0,0 +1,34 @@
// Metro module 5859 (f5860).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let highlightingEnabled = true;
class ConversationVisibilityStore extends Module589.DeviceSettingsStore {
static displayName = "ConversationVisibilityStore";
static persistKey = "ConversationVisibilityStore";
initialize(a0) {
let r4 = a0?.highlightingEnabled;
if (r4 == null) {
r4 = true;
}
highlightingEnabled = r4;
}
isHighlightingEnabled() {
return highlightingEnabled;
}
getState() {
return {
highlightingEnabled
};
}
getUserAgnosticState() {
return {
highlightingEnabled
};
}
}
const conversationVisibilityStore = new ConversationVisibilityStore(Dispatcher, {
CONVERSATIONS_TOGGLE_HIGHLIGHTING: function handleToggleHighlighting() {
highlightingEnabled = !highlightingEnabled;
}
});
export default conversationVisibilityStore;
@@ -0,0 +1,132 @@
// Metro module 3193 (f3194).
import { loadJsonAsset } from "../asset_json/native/AssetJsonUtils";
import * as _Module3194 from "../../_bundle/Module3194";
import * as _Module3195 from "../../_bundle/Module3195";
import * as _Module3196 from "../../_bundle/Module3196";
import * as _Module3197 from "../../_bundle/Module3197";
import * as _Module3198 from "../../_bundle/Module3198";
import * as _Module3199 from "../../_bundle/Module3199";
import * as _Module3200 from "../../_bundle/Module3200";
import * as _Module3201 from "../../_bundle/Module3201";
import * as _Module3202 from "../../_bundle/Module3202";
import * as _Module3203 from "../../_bundle/Module3203";
import * as _Module3204 from "../../_bundle/Module3204";
import * as _Module3205 from "../../_bundle/Module3205";
import * as _Module3206 from "../../_bundle/Module3206";
import * as _Module3207 from "../../_bundle/Module3207";
import * as _Module3208 from "../../_bundle/Module3208";
import * as _Module3209 from "../../_bundle/Module3209";
import * as _Module3210 from "../../_bundle/Module3210";
import * as _Module3211 from "../../_bundle/Module3211";
import * as _Module3212 from "../../_bundle/Module3212";
import * as _Module3213 from "../../_bundle/Module3213";
import * as _Module3214 from "../../_bundle/Module3214";
import * as _Module3215 from "../../_bundle/Module3215";
import * as _Module3216 from "../../_bundle/Module3216";
import * as _Module3217 from "../../_bundle/Module3217";
import * as _Module3218 from "../../_bundle/Module3218";
import * as _Module3219 from "../../_bundle/Module3219";
import * as _Module3220 from "../../_bundle/Module3220";
import * as _Module3221 from "../../_bundle/Module3221";
import * as _Module3222 from "../../_bundle/Module3222";
import * as _Module3223 from "../../_bundle/Module3223";
import * as _Module3224 from "../../_bundle/Module3224";
import { createLoader, makeMessagesProxy } from "../../_bundle/Module1274";
const loader = createLoader({
bg: () => loadJsonAsset(_Module3194).then((result) => ({
default: result
})),
cs: () => loadJsonAsset(_Module3195).then((result) => ({
default: result
})),
da: () => loadJsonAsset(_Module3196).then((result) => ({
default: result
})),
de: () => loadJsonAsset(_Module3197).then((result) => ({
default: result
})),
el: () => loadJsonAsset(_Module3198).then((result) => ({
default: result
})),
"en-GB": () => loadJsonAsset(_Module3199).then((result) => ({
default: result
})),
"es-419": () => loadJsonAsset(_Module3200).then((result) => ({
default: result
})),
"es-ES": () => loadJsonAsset(_Module3201).then((result) => ({
default: result
})),
fi: () => loadJsonAsset(_Module3202).then((result) => ({
default: result
})),
fr: () => loadJsonAsset(_Module3203).then((result) => ({
default: result
})),
hi: () => loadJsonAsset(_Module3204).then((result) => ({
default: result
})),
hr: () => loadJsonAsset(_Module3205).then((result) => ({
default: result
})),
hu: () => loadJsonAsset(_Module3206).then((result) => ({
default: result
})),
it: () => loadJsonAsset(_Module3207).then((result) => ({
default: result
})),
ja: () => loadJsonAsset(_Module3208).then((result) => ({
default: result
})),
ko: () => loadJsonAsset(_Module3209).then((result) => ({
default: result
})),
lt: () => loadJsonAsset(_Module3210).then((result) => ({
default: result
})),
nl: () => loadJsonAsset(_Module3211).then((result) => ({
default: result
})),
no: () => loadJsonAsset(_Module3212).then((result) => ({
default: result
})),
pl: () => loadJsonAsset(_Module3213).then((result) => ({
default: result
})),
"pt-BR": () => loadJsonAsset(_Module3214).then((result) => ({
default: result
})),
ro: () => loadJsonAsset(_Module3215).then((result) => ({
default: result
})),
ru: () => loadJsonAsset(_Module3216).then((result) => ({
default: result
})),
"sv-SE": () => loadJsonAsset(_Module3217).then((result) => ({
default: result
})),
th: () => loadJsonAsset(_Module3218).then((result) => ({
default: result
})),
tr: () => loadJsonAsset(_Module3219).then((result) => ({
default: result
})),
uk: () => loadJsonAsset(_Module3220).then((result) => ({
default: result
})),
vi: () => loadJsonAsset(_Module3221).then((result) => ({
default: result
})),
"zh-CN": () => loadJsonAsset(_Module3222).then((result) => ({
default: result
})),
"zh-TW": () => loadJsonAsset(_Module3223).then((result) => ({
default: result
})),
"en-US": () => loadJsonAsset(_Module3224).then((result) => ({
default: result
}))
}, "en-US");
const r51 = makeMessagesProxy(loader);
export default r51;
export { loader as messagesLoader };
@@ -0,0 +1,282 @@
// Metro module 9270 (f9271).
import ConversationsStore from "./ConversationsStore";
import TopicalNavigationSurveyStore from "./TopicalNavigationSurveyStore";
import { FETCH_LIMIT } from "./ConversationConstants";
import { Endpoints } from "../../Constants";
import { isTopicalNavEnabled } from "./ConversationExperiments";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
import MessageActionCreators from "../../actions/MessageActionCreators";
import { ConversationsAnalytics } from "./ConversationsAnalytics";
import QualtricsActionCreators from "../qualtrics/QualtricsActionCreators";
import { SurveyActionTypes } from "../../_bundle/Module9280";
const fetchConversationMessages = async function fetchConversationMessages(channelId, c26408_1, conversationId, c26408_3) {
let c26408_4;
let c26408_8 = 0;
let c30076_0, c30076_1, c30076_2, c30076_3;
L24: {
L21: {
try {
c30076_0 = channelId;
c30076_1 = conversationId;
c30076_2 = void 0;
c30076_3 = void 0;
if (!isTopicalNavEnabled(c26408_1, "fetch_conversation")) {
break L24;
}
c26408_4 = c26408_3;
if (c26408_3 == null) {
c26408_4 = {};
}
const r42 = c26408_4;
const { previewLimit, includeMessageReferences, includeReactions } = r42;
const full = previewLimit == null;
c30076_2 = full;
const conversationMetadata = ConversationsStore.getConversationMetadata(channelId, conversationId);
const r27 = conversationMetadata == null;
if (!(full ? (r27 ? void 0 : conversationMetadata.fullyHydrated) !== true : (r27 ? void 0 : conversationMetadata.hydratedMessages) == null)) {
break L24;
}
if (ConversationsStore.isConversationFetchPending(conversationId, full)) {
break L24;
}
Dispatcher.dispatch({
type: "CONVERSATION_FETCH_START",
channelId,
conversationId,
full
});
c26408_8 = 1;
c30076_3 = await HTTP.get({
url: Endpoints.CHANNEL_CONVERSATION_MESSAGES(channelId, conversationId),
query: {
limit: previewLimit,
include_ancestors: includeMessageReferences,
include_reactions: includeReactions
},
oldFormErrors: true,
rejectWithError: true
});
Dispatcher.dispatch({
type: "CONVERSATION_FETCH_SUCCESS",
channelId: c30076_0,
conversationId: c30076_1,
messages: c30076_3.body.messages,
messageReferences: c30076_3.body.ancestors,
fullyHydrated: c30076_2
});
c26408_8 = 0;
} catch ($e) {
let r8 = $e;
if (c26408_8 !== 0) {
while (true) {
try {
c26408_8 = 0;
Dispatcher.dispatch({
type: "CONVERSATION_FETCH_FAILURE",
channelId: c30076_0,
conversationId: c30076_1,
full: c30076_2
});
break L21;
} catch ($e) {
r8 = $e;
if (c26408_8 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
};
export async function fetchChannelConversations(c26407_0) {
let r198;
let isJump, limit, isJump2;
let c26407_6 = 0;
let c30075_0, c30075_1, c30075_2, c30075_3, c30075_4, c30075_5, c30075_6, c30075_7, c30075_8, c30075_9, c30075_10;
L36: {
try {
c30075_0 = void 0;
c30075_1 = void 0;
c30075_2 = void 0;
c30075_3 = void 0;
c30075_4 = void 0;
c30075_5 = void 0;
c30075_6 = void 0;
c30075_7 = void 0;
c30075_0 = c26407_0.channelId;
c30075_1 = c26407_0.guildId;
c30075_2 = c26407_0.direction;
c30075_3 = c26407_0.anchor;
let limit2 = c26407_0.limit;
if (limit2 === void 0) {
limit2 = FETCH_LIMIT;
}
c30075_4 = limit2;
c30075_5 = c26407_0.isJump;
const throwOnError = c26407_0.throwOnError;
if (throwOnError !== void 0) {
c30075_6 = throwOnError;
c30075_7 = c26407_0.hydrateMessages;
c30075_8 = void 0;
c30075_9 = void 0;
c30075_10 = void 0;
} else {
c30075_6 = false;
c30075_7 = c26407_0.hydrateMessages;
c30075_8 = void 0;
c30075_9 = void 0;
c30075_10 = void 0;
}
await void 0;
if (!isTopicalNavEnabled(c30075_1, "fetch_channel_conversations")) {
break L36;
}
c30075_8 = `${c30075_2}:${c30075_3}:${c30075_4}:${c30075_5 === true}`;
if (ConversationsStore.isListFetchPending(c30075_0, c30075_8)) {
break L36;
}
const r112 = c30075_5;
isJump = r112;
if (r112 == null) {
isJump = false;
}
Dispatcher.dispatch({
type: "CONVERSATIONS_FETCH_START",
channelId: c30075_0,
direction: c30075_2,
requestKey: c30075_8,
isJump
});
c30075_9 = {
limit: c30075_4
};
if (c30075_3 != null) {
if (c30075_2 === "before") {
c30075_9.before = c30075_3;
} else if (c30075_2 === "after") {
c30075_9.after = c30075_3;
} else {
c30075_9.around = c30075_3;
}
}
if (c30075_7 != null) {
c30075_9.include_messages = true;
const r146 = c30075_9;
limit = c30075_7.limit;
if (limit == null) {
limit = void 0;
}
r146.message_limit = limit;
}
c26407_6 = 1;
c30075_10 = (await HTTP.get({
url: Endpoints.CHANNEL_CONVERSATIONS(c30075_0),
query: c30075_9,
oldFormErrors: true,
rejectWithError: true
})).body.conversations;
const r189 = c30075_5;
isJump2 = r189;
if (r189 == null) {
isJump2 = false;
}
Dispatcher.dispatch({
type: "CONVERSATIONS_FETCH_SUCCESS",
channelId: c30075_0,
rawConversations: c30075_10,
direction: c30075_2,
requestKey: c30075_8,
anchor: c30075_3,
isJump: isJump2,
fullyHydrated: c30075_7?.limit == null
});
r198 = c30075_10;
c26407_6 = 0;
} catch ($e) {
let r44 = $e;
if (c26407_6 !== 0) {
while (true) {
try {
c26407_6 = 0;
Dispatcher.dispatch({
type: "CONVERSATIONS_FETCH_FAILURE",
channelId: c30075_0,
requestKey: c30075_8
});
if (!c30075_6) {
break L36;
}
throw new Error("Failed to fetch conversations");
} catch ($e) {
r44 = $e;
if (c26407_6 === 0) {
break;
}
}
}
}
throw r44;
}
return r198;
}
}
export function toggleConversationHighlighting() {
Dispatcher.dispatch({
type: "CONVERSATIONS_TOGGLE_HIGHLIGHTING"
});
}
export function setSelectedConversation(a0, a1, a2, r5 = true) {
Dispatcher.dispatch({
type: "SET_SELECTED_CONVERSATION",
channelId: a0,
conversationId: a2
});
fetchConversationMessages(a0, a1, a2, {
includeReactions: true,
includeMessageReferences: true
});
const conversationMetadata = ConversationsStore.getConversationMetadata(a0, a2);
if (r5) {
r5 = (conversationMetadata == null ? void 0 : conversationMetadata.conversation.startMessageId) != null;
}
if (r5) {
MessageActionCreators.jumpToMessage({
channelId: a0,
messageId: conversationMetadata.conversation.startMessageId,
flash: false
});
}
}
export function clearConversationSelection(a0, a1) {
Dispatcher.dispatch({
type: "CLEAR_CONVERSATION_SELECTION",
channelId: a0,
conversationId: a1
});
}
export function setConversationFeedbackRating(a0, a1, a2) {
Dispatcher.dispatch({
type: "SET_CONVERSATION_FEEDBACK_RATING",
channelId: a0,
conversationId: a1,
rating: a2
});
}
export { fetchConversationMessages };
export function trackTopicalNavigationEntrypointImpression(a0, a1) {
ConversationsAnalytics.trackEntrypointImpression({
channelId: a0,
conversationCount: a1
});
if (TopicalNavigationSurveyStore.shouldTriggerOnNextExposure()) {
QualtricsActionCreators.fireSurveyAction(SurveyActionTypes.TOPICAL_NAVIGATION_MULTIPLE_IMPRESSIONS);
}
Dispatcher.dispatch({
type: "TOPICAL_NAVIGATION_ENTRYPOINT_IMPRESSION"
});
}
@@ -0,0 +1,184 @@
// Metro module 9272 (f9273).
import ChannelStore from "../../stores/ChannelStore";
import { AnalyticEvents } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
const r18 = {
trackEntrypointImpression: (a0) => {
const TOPICAL_NAV_ENTRYPOINT_IMPRESSION = AnalyticEvents.TOPICAL_NAV_ENTRYPOINT_IMPRESSION;
const channelId = a0.channelId;
const channel = ChannelStore.getChannel(channelId);
let channel_type = channel?.type;
if (channel_type == null) {
channel_type = null;
}
let guild_id = channel?.guild_id;
if (guild_id == null) {
guild_id = null;
}
AnalyticsUtils.track(TOPICAL_NAV_ENTRYPOINT_IMPRESSION, {
...{
channel_id: channelId,
channel_type,
guild_id
},
conversation_count: a0.conversationCount
});
},
trackTopicsUnitImpression: (a0) => {
const TOPICAL_NAV_TOPICS_UNIT_IMPRESSION = AnalyticEvents.TOPICAL_NAV_TOPICS_UNIT_IMPRESSION;
const channelId = a0.channelId;
const channel = ChannelStore.getChannel(channelId);
let channel_type = channel?.type;
if (channel_type == null) {
channel_type = null;
}
let guild_id = channel?.guild_id;
if (guild_id == null) {
guild_id = null;
}
AnalyticsUtils.track(TOPICAL_NAV_TOPICS_UNIT_IMPRESSION, {
...{
channel_id: channelId,
channel_type,
guild_id
},
conversation_ids: a0.conversationIds,
is_focus_mode: a0.isFocusMode
});
},
trackPreviewImpression: (a0) => {
const TOPICAL_NAV_PREVIEW_IMPRESSION = AnalyticEvents.TOPICAL_NAV_PREVIEW_IMPRESSION;
const channelId = a0.channelId;
const channel = ChannelStore.getChannel(channelId);
let channel_type = channel?.type;
if (channel_type == null) {
channel_type = null;
}
let guild_id = channel?.guild_id;
if (guild_id == null) {
guild_id = null;
}
AnalyticsUtils.track(TOPICAL_NAV_PREVIEW_IMPRESSION, {
...{
channel_id: channelId,
channel_type,
guild_id
},
conversation_id: a0.conversationId,
is_focus_mode: a0.isFocusMode
});
},
trackTopicsUnitClicked: (a0) => {
const TOPICAL_NAV_TOPICS_UNIT_CLICKED = AnalyticEvents.TOPICAL_NAV_TOPICS_UNIT_CLICKED;
const channelId = a0.channelId;
const channel = ChannelStore.getChannel(channelId);
let channel_type = channel?.type;
if (channel_type == null) {
channel_type = null;
}
let guild_id = channel?.guild_id;
if (guild_id == null) {
guild_id = null;
}
AnalyticsUtils.track(TOPICAL_NAV_TOPICS_UNIT_CLICKED, {
...{
channel_id: channelId,
channel_type,
guild_id
},
conversation_id: a0.conversationId,
is_focus_mode: a0.isFocusMode
});
},
trackFocusModeImpression: (a0) => {
const TOPICAL_NAV_FOCUS_MODE_IMPRESSION = AnalyticEvents.TOPICAL_NAV_FOCUS_MODE_IMPRESSION;
const channelId = a0.channelId;
const channel = ChannelStore.getChannel(channelId);
let channel_type = channel?.type;
if (channel_type == null) {
channel_type = null;
}
let guild_id = channel?.guild_id;
if (guild_id == null) {
guild_id = null;
}
AnalyticsUtils.track(TOPICAL_NAV_FOCUS_MODE_IMPRESSION, {
...{
channel_id: channelId,
channel_type,
guild_id
},
conversation_id: a0.conversationId
});
},
trackFocusModeDismissed: (a0) => {
const TOPICAL_NAV_FOCUS_MODE_DISMISSED = AnalyticEvents.TOPICAL_NAV_FOCUS_MODE_DISMISSED;
const channelId = a0.channelId;
const channel = ChannelStore.getChannel(channelId);
let channel_type = channel?.type;
if (channel_type == null) {
channel_type = null;
}
let guild_id = channel?.guild_id;
if (guild_id == null) {
guild_id = null;
}
AnalyticsUtils.track(TOPICAL_NAV_FOCUS_MODE_DISMISSED, {
...{
channel_id: channelId,
channel_type,
guild_id
},
conversation_id: a0.conversationId,
dismiss_reason: a0.dismissReason
});
},
trackThumbsClicked: (a0) => {
const TOPICAL_NAV_THUMBS_CLICKED = AnalyticEvents.TOPICAL_NAV_THUMBS_CLICKED;
const channelId = a0.channelId;
const channel = ChannelStore.getChannel(channelId);
let channel_type = channel?.type;
if (channel_type == null) {
channel_type = null;
}
let guild_id = channel?.guild_id;
if (guild_id == null) {
guild_id = null;
}
AnalyticsUtils.track(TOPICAL_NAV_THUMBS_CLICKED, {
...{
channel_id: channelId,
channel_type,
guild_id
},
conversation_id: a0.conversationId,
is_thumbs_up: a0.isThumbsUp,
is_focus_mode: a0.isFocusMode
});
},
trackThumbsDownReasonSelected: (a0) => {
const TOPICAL_NAV_THUMBS_DOWN_REASON_SELECTED = AnalyticEvents.TOPICAL_NAV_THUMBS_DOWN_REASON_SELECTED;
const channelId = a0.channelId;
const channel = ChannelStore.getChannel(channelId);
let channel_type = channel?.type;
if (channel_type == null) {
channel_type = null;
}
let guild_id = channel?.guild_id;
if (guild_id == null) {
guild_id = null;
}
AnalyticsUtils.track(TOPICAL_NAV_THUMBS_DOWN_REASON_SELECTED, {
...{
channel_id: channelId,
channel_type,
guild_id
},
conversation_id: a0.conversationId,
is_focus_mode: a0.isFocusMode,
reasons: a0.reasons,
other_text: a0.otherText
});
}
};
export { r18 as ConversationsAnalytics };
@@ -0,0 +1,803 @@
// Metro module 5858 (f5859).
import AuthenticationStore from "../../stores/AuthenticationStore";
import ChannelStore from "../../stores/ChannelStore";
import RelationshipStore from "../../stores/RelationshipStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import UserStore from "../../stores/UserStore";
import ConversationVisibilityStore from "./ConversationVisibilityStore";
import { CONVERSATION_COLORS, CONVERSATION_FEEDBACK_RATINGS_CACHE_MAX, MAX_CONVERSATIONS_PER_CHANNEL, MAX_CHANNELS_WITH_CONVERSATIONS } from "./ConversationConstants";
import LRUCache from "../../_bundle/LRUCache";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { createMessageRecord, updateMessageRecord } from "../messages/MessageRecordUtils";
import { mapConversation } from "./ConversationsUtils";
import { isNotNullish } from "../../utils/GlobalUtils";
import { shouldApplyReaction } from "../reactions/ReactionUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
function $mk77240($env) {
return (a0) => a0.id === $env[0];
}
function $mk77241($env) {
return (a0) => a0.id !== $env[0];
}
let c3665_12, c3665_13, c3665_15, buildModerationLabel, processHydratedMessages, removeHydratedMessage, evictChannel;
const removePendingListFetch = function removePendingListFetch(channelId, requestKey) {
const r9 = c3665_13.get(channelId);
const r1 = r9 == null || !r9.has(requestKey);
let r11 = !r1;
if (!r1) {
r9.delete(requestKey);
const size = r9.size;
r11 = true;
if (size === 0) {
c3665_13.delete(channelId);
r11 = true;
}
}
return r11;
};
buildModerationLabel = function buildModerationLabel(a0) {
const r2 = a0[0];
const r8 = a0.map((item) => {
let category = item.category;
if (category == null) {
category = item.reason;
}
return category;
}).filter((item) => item != null);
let r7 = r2?.severity;
if (r7 == null) {
r7 = null;
}
let r15 = r2?.confidence;
if (r15 == null) {
r15 = null;
}
const r36 = [r7 != null ? `${r7} severity` : null, r15 != null ? `${r15} confidence` : null].filter(Boolean).join(", ");
const r50 = [r8.length > 0 ? r8.join(", ") : null, r36.length > 0 ? r36 : null].filter(Boolean).join(" · ");
return r50.length > 0 ? r50 : "Moderation Failed";
};
processHydratedMessages = function processHydratedMessages(channelId, a1, messages, fullyHydrated, r7 = []) {
L19: {
const r4 = c3665_12.peek(channelId);
if (r4 != null) {
const r35 = r4.conversationMetadataById.get(a1);
if (r35 != null) {
if (!fullyHydrated && r35.fullyHydrated) {
break L19;
}
const hydratedMessages = [];
for (const item of messages) {
const messageRecord = createMessageRecord(item);
const message2 = messageRecord;
hydratedMessages.push(messageRecord);
const r52 = r4.messageMetadataByMessageId.get(messageRecord.id);
if (r52 != null) {
r52.conversationId = a1;
r52.message = message2;
} else {
const messageMetadataByMessageId = r4.messageMetadataByMessageId;
const message = message2;
messageMetadataByMessageId.set(message.id, {
conversationId: a1,
moderationLabel: null,
message
});
}
}
r35.hydratedMessages = hydratedMessages;
r35.fullyHydrated = fullyHydrated;
for (const item2 of r7) {
if (r4.messageMetadataByMessageId.get(item2.id) == null) {
const messageMetadataByMessageId2 = r4.messageMetadataByMessageId;
messageMetadataByMessageId2.set(item2.id, {
conversationId: null,
moderationLabel: null,
message: createMessageRecord(item2)
});
}
}
}
}
}
};
const handleReaction = function handleReaction(a0) {
const { type, channelId, messageId, userId, emoji, reactionType } = a0;
const r20 = c3665_12.peek(channelId);
if (r20 == null) {
return false;
}
const r23 = r20.messageMetadataByMessageId.get(messageId);
if (r23?.message == null) {
return false;
}
if (shouldApplyReaction(a0)) {
const r34 = AuthenticationStore.getId() === userId;
const message = type === "MESSAGE_REACTION_ADD" ? r23.message.addReaction(emoji, r34, a0.colors, reactionType) : r23.message.removeReaction(emoji, r34, reactionType);
let env15212;
const r41 = env15212 = {};
env15212[0] = messageId;
r23.message = message;
const r44 = r23.conversationId != null ? r20.conversationMetadataById.get(r23.conversationId) : null;
if (r44?.hydratedMessages != null) {
const r53 = r44.hydratedMessages.findIndex($mk77240(r41));
if (r53 !== -1) {
const hydratedMessages = r44.hydratedMessages.slice();
hydratedMessages[r53] = message;
r44.hydratedMessages = hydratedMessages;
}
}
return true;
}
return false;
};
removeHydratedMessage = function removeHydratedMessage(channelId, item) {
let env15213;
const r3 = env15213 = {};
env15213[0] = item;
const r10 = c3665_12.peek(channelId);
if (r10 == null) {
return false;
}
const r13 = r10.messageMetadataByMessageId.get(item);
if (r13 != null) {
const r15 = r13.conversationId != null ? r10.conversationMetadataById.get(r13.conversationId) : null;
if (r15?.hydratedMessages != null) {
r15.hydratedMessages = r15.hydratedMessages.filter($mk77241(r3));
}
}
return r10.messageMetadataByMessageId.delete(item);
};
evictChannel = function evictChannel(item) {
let r5 = c3665_12.has(item);
c3665_12.del(item);
const r9 = c3665_13.delete(item);
if (!r5) {
r5 = r9;
}
return r5;
};
c3665_12 = new LRUCache({
max: MAX_CHANNELS_WITH_CONVERSATIONS,
dispose: function cleanupChannelSideState(a0) {
return c3665_13.delete(a0);
}
});
c3665_13 = new Map();
c3665_15 = new Map();
class ConversationsStore extends Module589.Store {
static displayName = "ConversationsStore";
initialize() {
this.waitFor(AuthenticationStore, ChannelStore, ConversationVisibilityStore, RelationshipStore, SelectedChannelStore, UserStore);
}
hasChannelData(a0) {
return c3665_12.has(a0);
}
getChannelConversations(a0) {
const r5 = c3665_12.peek(a0);
return r5 != null ? r5.conversations : null;
}
getConversationForMessage(a0, a1) {
const r8 = c3665_12.peek(a0);
let r9 = r8 == null ? void 0 : r8.messageMetadataByMessageId.get(a1)?.conversationId;
if (r9 == null) {
r9 = null;
}
return r9;
}
getMessageMetadata(a0, a1) {
const r7 = c3665_12.peek(a0);
let r8 = r7 == null ? void 0 : r7.messageMetadataByMessageId.get(a1);
if (r8 == null) {
r8 = null;
}
return r8;
}
getMessage(a0, a1) {
let r7 = this.getMessageMetadata(a0, a1)?.message;
if (r7 == null) {
r7 = null;
}
return r7;
}
getConversationMetadata(a0, a1) {
const r7 = c3665_12.peek(a0);
let r8 = r7 == null ? void 0 : r7.conversationMetadataById.get(a1);
if (r8 == null) {
r8 = null;
}
return r8;
}
getEdgeMarker(a0, a1) {
const r6 = c3665_12.peek(a0);
return r6 != null ? a1 === "before" ? r6.reachedOldest : r6.reachedNewest : null;
}
isPendingFetch(a0) {
return c3665_13.has(a0);
}
isListFetchPending(a0, a1) {
const r5 = c3665_13.get(a0);
let r7 = r5 == null ? void 0 : r5.has(a1);
if (r7 == null) {
r7 = false;
}
return r7;
}
getSelectedConversationId(a0) {
let r7 = c3665_12.peek(a0)?.selectedConversationId;
if (r7 == null) {
r7 = null;
}
return r7;
}
getSelectedConversation(a0) {
const r9 = c3665_12.peek(a0);
const selectedConversationId = r9?.selectedConversationId;
const r10 = selectedConversationId == null;
let r11 = null;
if (!r10) {
let r13 = r9 == null ? void 0 : r9.conversationMetadataById.get(selectedConversationId)?.conversation;
if (r13 == null) {
r13 = null;
}
r11 = r13;
}
return r11;
}
getConversationColor(a0, a1) {
const r7 = c3665_12.peek(a0);
const r1 = r7 == null;
let r8 = null;
if (!r1) {
let r13 = r7.conversationMetadataById.get(a1)?.color;
if (r13 == null) {
r13 = null;
}
r8 = r13;
}
return r8;
}
getHydratedMessages(a0, a1) {
const r8 = c3665_12.peek(a0);
let r9 = r8 == null ? void 0 : r8.conversationMetadataById.get(a1)?.hydratedMessages;
if (r9 == null) {
r9 = null;
}
return r9;
}
getHydratedMessageById(a0, a1) {
const r8 = c3665_12.peek(a0);
let r9 = r8 == null ? void 0 : r8.messageMetadataByMessageId.get(a1)?.message;
if (r9 == null) {
r9 = null;
}
return r9;
}
isConversationFetchPending(a0, a1) {
const r6 = c3665_15.get(a0);
return r6 != null && r6.size !== 0 && (a1 !== true || r6.has("full"));
}
getConversationFeedbackRating(a0, a1) {
const r7 = c3665_12.peek(a0);
let r8 = r7 == null ? void 0 : r7.recentFeedbackRatingsByConversationId.get(a1);
if (r8 == null) {
r8 = null;
}
return r8;
}
}
const conversationsStore = new ConversationsStore(Dispatcher, {
CONVERSATION_FETCH_START: function handleConversationFetchStart(a0) {
const conversationId = a0.conversationId;
const r3 = a0.full ? "full" : "preview";
const r2 = c3665_15.get(conversationId);
if (r2 != null) {
r2.add(r3);
} else {
c3665_15.set(conversationId, new Set([r3]));
}
},
CONVERSATION_FETCH_SUCCESS: function handleConversationFetchSuccess({ channelId, conversationId, messages, messageReferences, fullyHydrated }) {
const r11 = fullyHydrated ? "full" : "preview";
const r19 = c3665_15.get(conversationId);
if (r19 != null) {
r19.delete(r11);
if (r19.size === 0) {
c3665_15.delete(conversationId);
}
}
processHydratedMessages(channelId, conversationId, messages, fullyHydrated, messageReferences);
},
CONVERSATION_FETCH_FAILURE: function handleConversationFetchFailure(a0) {
const conversationId = a0.conversationId;
const r6 = a0.full ? "full" : "preview";
const r10 = c3665_15.get(conversationId);
if (r10 != null) {
r10.delete(r6);
if (r10.size === 0) {
c3665_15.delete(conversationId);
}
}
},
CONVERSATIONS_FETCH_START: function handleFetchStart(a0) {
const { channelId, requestKey } = a0;
if (a0.isJump) {
c3665_13.delete(channelId);
}
let r14 = c3665_13.get(channelId);
if (r14 == null) {
const set = new Set();
c3665_13.set(channelId, set);
r14 = set;
}
r14.add(requestKey);
},
CONVERSATIONS_FETCH_SUCCESS: function handleFetchSuccess({ channelId, rawConversations, direction, anchor, isJump, requestKey, fullyHydrated }) {
let r13, r81;
if (!removePendingListFetch(channelId, requestKey)) {
return false;
}
const r14 = rawConversations.map(mapConversation).filter(isNotNullish);
const r51 = c3665_12.peek(channelId);
const r53 = r51 == null;
if (isJump) {
const r18 = r53 ? void 0 : r51.selectedConversationId;
const r16 = r18 != null ? r51 == null ? void 0 : r51.conversationMetadataById.get(r18)?.conversation : null;
r13 = r16 != null ? [r16] : [];
} else {
r13 = r53 ? void 0 : r51.conversations;
if (r13 == null) {
r13 = [];
}
}
let r61 = null;
if (!isJump) {
let r63 = r51?.reachedOldest;
if (r63 == null) {
r63 = null;
}
r61 = r63;
}
let r64 = null;
if (!isJump) {
let r66 = r51?.reachedNewest;
if (r66 == null) {
r66 = null;
}
r64 = r66;
}
let c15214_0 = new Set(r13.map((item) => item.id));
const r76 = r14.some((item) => !c15214_0.has(item.id)) || anchor == null;
let r77 = r64;
let r78 = r61;
if (!r76) {
if (direction === "before") {
r61 = Date.now();
r81 = r64;
} else {
r81 = direction === "after" ? Date.now() : r64;
}
r77 = r81;
r78 = r61;
}
const r86 = direction === "before";
if (r86 && anchor == null) {
r77 = Date.now();
}
const r91 = (function mergeConversations(a0, a1) {
const map = new Map();
for (const item of a0) {
map.set(item.id, item);
}
for (const item2 of a1) {
map.set(item2.id, item2);
}
const r45 = Array.from(map.values());
r45.sort((a, b) => SnowflakeUtils.compare(a.startMessageId, b.startMessageId));
return r45;
})(r13, r14);
const length = r91.length;
let reachedNewest = r77;
let reachedOldest = r78;
let r96 = r91;
if (length > MAX_CONVERSATIONS_PER_CHANNEL) {
if (direction === "after") {
r96 = r91.slice(r91.length - MAX_CONVERSATIONS_PER_CHANNEL);
reachedNewest = r77;
reachedOldest = null;
} else if (r86) {
r96 = r91.slice(0, MAX_CONVERSATIONS_PER_CHANNEL);
reachedNewest = null;
reachedOldest = r78;
} else {
const r22 = (function clampAnchorWindowStart(a0, a1) {
if (a1 == null) {
return 0;
}
let r8 = a0.findIndex((item) => SnowflakeUtils.compare(item.startMessageId, a1) >= 0);
if (r8 === -1) {
r8 = a0.length;
}
return Math.max(0, Math.min(r8 - Math.floor(MAX_CONVERSATIONS_PER_CHANNEL / 2), a0.length - MAX_CONVERSATIONS_PER_CHANNEL));
})(r91, anchor);
const r99 = r22 > 0 ? null : r78;
const r102 = r22 + MAX_CONVERSATIONS_PER_CHANNEL < r91.length ? null : r77;
r96 = r91.slice(r22, r22 + MAX_CONVERSATIONS_PER_CHANNEL);
reachedNewest = r102;
reachedOldest = r99;
}
}
const r110 = (function buildChannelData(a0, a1, a2) {
let guildId = a2?.guildId;
if (guildId == null) {
guildId = a1[0]?.guildId;
}
if (guildId == null) {
guildId = ChannelStore.getChannel(a0)?.guild_id;
}
if (guildId == null) {
guildId = null;
}
const map = new Map();
const map2 = new Map();
let r63 = a2?.colorIndex;
if (r63 == null) {
r63 = 0;
}
let colorIndex = r63;
for (const item of a1) {
const r71 = a2 == null ? void 0 : a2.conversationMetadataById.get(item.id);
let r76 = r71?.color;
if (r76 == null) {
const r79 = +colorIndex;
colorIndex = r79 + 1;
r76 = CONVERSATION_COLORS[r79 % CONVERSATION_COLORS.length];
}
const color = r76;
let r85 = r71?.hydratedMessages;
if (r85 == null) {
r85 = null;
}
const hydratedMessages = r85;
const fullyHydrated = r85 != null && !!r71?.fullyHydrated;
const conversation = item;
map.set(conversation.id, {
conversation,
color,
hydratedMessages,
fullyHydrated
});
let r97 = null;
if (conversation.moderation != null) {
r97 = new Map();
for (const flaggedMessageDetail of item.moderation.flaggedMessageDetails) {
const r112 = flaggedMessageDetail;
const r116 = r97.get(flaggedMessageDetail.messageId);
if (r116 != null) {
r116.push(r112);
} else {
const r118 = r97;
r118.set(r112.messageId, [r112]);
}
}
}
for (const messageId of item.messageIds) {
const r138 = a2 == null ? void 0 : a2.messageMetadataByMessageId.get(messageId);
let r143 = null;
if (r138?.moderationLabel == null && item.moderation != null && item.moderation.flaggedMessageIds.includes(messageId) && r97 != null) {
let r159 = r97.get(messageId);
if (r159 == null) {
r159 = [];
}
r143 = buildModerationLabel(r159);
}
let moderationLabel = r138?.moderationLabel;
if (moderationLabel == null) {
moderationLabel = r143;
}
let message2 = r138?.message;
if (message2 == null) {
message2 = null;
}
map2.set(messageId, {
conversationId: item.id,
moderationLabel,
message: message2
});
const r172 = r138 == null;
let r173 = void 0;
if (!r172) {
const message = r138.message;
r173 = message == null ? void 0 : message.messageReference?.message_id;
}
const r178 = r173;
if (r173 != null) {
const r180 = a2 == null ? void 0 : a2.messageMetadataByMessageId.get(r178);
if (!(r180?.message == null || map2.has(r178))) {
map2.set(r178, r180);
}
}
}
}
let recentFeedbackRatingsByConversationId = a2?.recentFeedbackRatingsByConversationId;
if (recentFeedbackRatingsByConversationId == null) {
recentFeedbackRatingsByConversationId = new LRUCache({
max: CONVERSATION_FEEDBACK_RATINGS_CACHE_MAX
});
}
let r208 = a2?.selectedConversationId;
if (r208 == null) {
r208 = null;
}
let c25634_0 = r208;
const selectedConversationId = r208 != null ? a1.some((item) => item.id === c25634_0) ? r208 : null : null;
let reachedOldest = a2?.reachedOldest;
if (reachedOldest == null) {
reachedOldest = null;
}
let reachedNewest = a2?.reachedNewest;
if (reachedNewest == null) {
reachedNewest = null;
}
return {
guildId,
conversations: a1,
conversationMetadataById: map,
messageMetadataByMessageId: map2,
recentFeedbackRatingsByConversationId,
reachedOldest,
reachedNewest,
selectedConversationId,
colorIndex
};
})(channelId, r96, r51);
r110.reachedOldest = reachedOldest;
r110.reachedNewest = reachedNewest;
if (r51 != null) {
Object.assign(r51, r110);
} else {
c3665_12.set(channelId, r110);
}
for (const item of rawConversations) {
if (item.messages != null) {
processHydratedMessages(channelId, item.id, item.messages, fullyHydrated);
}
}
return true;
},
CONVERSATIONS_FETCH_FAILURE: function handleFetchFailure({ channelId, requestKey }) {
const r10 = c3665_13.get(channelId);
const r1 = r10 == null || !r10.has(requestKey);
let r12 = !r1;
if (!r1) {
r10.delete(requestKey);
const size = r10.size;
r12 = true;
if (size === 0) {
c3665_13.delete(channelId);
r12 = true;
}
}
return r12;
},
CHANNEL_SELECT: function handleChannelSelect({ channelId }) {
if (channelId != null && c3665_12.has(channelId)) {
c3665_12.get(channelId);
}
return false;
},
CHANNEL_DELETE: function handleChannelDelete(a0) {
const id = a0.channel.id;
let r7 = c3665_12.has(id);
c3665_12.del(id);
const r11 = c3665_13.delete(id);
if (!r7) {
r7 = r11;
}
return r7;
},
GUILD_DELETE: function handleGuildDelete({ guild }) {
if ("unavailable" in guild && guild.unavailable === true) {
return false;
}
let r27 = false;
for (const item of c3665_12.keys()) {
if (c3665_12.peek(item)?.guildId === guild.id && evictChannel(item)) {
r27 = true;
}
}
return r27;
},
LOAD_MESSAGES_SUCCESS: function handleLoadMessagesSuccess(a0) {
const channelId = a0.channelId;
if (a0.jump != null && SelectedChannelStore.getChannelId() === channelId) {
const r11 = c3665_12.peek(channelId);
let r0 = r11 != null;
if (r0) {
r11.reachedOldest = null;
r11.reachedNewest = null;
r0 = true;
}
return r0;
}
return false;
},
SET_SELECTED_CONVERSATION: function handleSetSelectedConversation({ channelId, conversationId }) {
if (channelId == null) {
return false;
}
const r8 = c3665_12.peek(channelId);
let r9 = r8 != null;
if (r9) {
r8.selectedConversationId = conversationId;
r9 = true;
}
return r9;
},
CLEAR_CONVERSATION_SELECTION: function handleClearConversationSelection({ channelId, conversationId }) {
const r10 = c3665_12.peek(channelId);
if (r10 == null) {
return false;
}
const selectedConversationId = r10.selectedConversationId;
let r0 = selectedConversationId != null && (conversationId == null || selectedConversationId === conversationId);
if (r0) {
r10.selectedConversationId = null;
r0 = true;
}
return r0;
},
SET_CONVERSATION_FEEDBACK_RATING: function handleSetConversationFeedbackRating({ channelId, conversationId, rating }) {
const r9 = c3665_12.peek(channelId);
let r10 = r9 != null;
if (r10) {
r9.recentFeedbackRatingsByConversationId.set(conversationId, rating);
r10 = true;
}
return r10;
},
MESSAGE_UPDATE: function handleMessageUpdate({ message }) {
const { channel_id, id } = message;
if (channel_id != null && id != null) {
const r13 = c3665_12.peek(channel_id);
if (r13 == null) {
return false;
}
const r16 = r13.messageMetadataByMessageId.get(id);
let r18 = r16?.message != null;
if (r18) {
let env15215;
const message2 = updateMessageRecord(r16.message, message);
const r25 = env15215 = {};
env15215[0] = id;
r16.message = message2;
const r27 = r16.conversationId != null ? r13.conversationMetadataById.get(r16.conversationId) : null;
const r33 = r27?.hydratedMessages != null;
r18 = true;
if (r33) {
const r37 = r27.hydratedMessages.findIndex($mk77240(r25));
r18 = true;
if (r37 !== -1) {
const hydratedMessages = r27.hydratedMessages.slice();
hydratedMessages[r37] = message2;
r27.hydratedMessages = hydratedMessages;
r18 = true;
}
}
}
return r18;
}
return false;
},
MESSAGE_REACTION_ADD: handleReaction,
MESSAGE_REACTION_REMOVE: handleReaction,
MESSAGE_REACTION_ADD_MANY: function handleReactionBatch({ channelId, messageId, reactions }) {
const r8 = c3665_12.peek(channelId);
if (r8 == null) {
return false;
}
const r15 = r8.messageMetadataByMessageId.get(messageId);
if (r15?.message == null) {
return false;
}
let env15216;
const message = r15.message.addReactionBatch(reactions, AuthenticationStore.getId());
const r21 = env15216 = {};
env15216[0] = messageId;
r15.message = message;
const r24 = r15.conversationId != null ? r8.conversationMetadataById.get(r15.conversationId) : null;
if (r24?.hydratedMessages != null) {
const r33 = r24.hydratedMessages.findIndex($mk77240(r21));
if (r33 !== -1) {
const hydratedMessages = r24.hydratedMessages.slice();
hydratedMessages[r33] = message;
r24.hydratedMessages = hydratedMessages;
}
}
return true;
},
MESSAGE_REACTION_REMOVE_ALL: function handleRemoveAllReactions({ channelId, messageId }) {
const r8 = c3665_12.peek(channelId);
if (r8 == null) {
return false;
}
const r7 = r8.messageMetadataByMessageId.get(messageId);
if (r7?.message == null) {
return false;
}
let env15217;
const message = r7.message.set("reactions", []);
const r19 = env15217 = {};
env15217[0] = messageId;
r7.message = message;
const r22 = r7.conversationId != null ? r8.conversationMetadataById.get(r7.conversationId) : null;
if (r22?.hydratedMessages != null) {
const r31 = r22.hydratedMessages.findIndex($mk77240(r19));
if (r31 !== -1) {
const hydratedMessages = r22.hydratedMessages.slice();
hydratedMessages[r31] = message;
r22.hydratedMessages = hydratedMessages;
}
}
return true;
},
MESSAGE_REACTION_REMOVE_EMOJI: function handleRemoveEmojiReactions({ channelId, messageId, emoji }) {
const r8 = c3665_12.peek(channelId);
if (r8 == null) {
return false;
}
const r7 = r8.messageMetadataByMessageId.get(messageId);
if (r7?.message == null) {
return false;
}
let env15218;
const message = r7.message.removeReactionsForEmoji(emoji);
const r18 = env15218 = {};
env15218[0] = messageId;
r7.message = message;
const r21 = r7.conversationId != null ? r8.conversationMetadataById.get(r7.conversationId) : null;
if (r21?.hydratedMessages != null) {
const r30 = r21.hydratedMessages.findIndex($mk77240(r18));
if (r30 !== -1) {
const hydratedMessages = r21.hydratedMessages.slice();
hydratedMessages[r30] = message;
r21.hydratedMessages = hydratedMessages;
}
}
return true;
},
MESSAGE_DELETE: function handleMessageDelete({ channelId, id }) {
let env15219;
const r4 = env15219 = {};
env15219[0] = id;
const r12 = c3665_12.peek(channelId);
const r1 = r12 == null;
let r13 = false;
if (!r1) {
const r15 = r12.messageMetadataByMessageId.get(id);
if (r15 != null) {
const r18 = r15.conversationId != null ? r12.conversationMetadataById.get(r15.conversationId) : null;
if (r18?.hydratedMessages != null) {
r18.hydratedMessages = r18.hydratedMessages.filter($mk77241(r4));
}
}
r13 = r12.messageMetadataByMessageId.delete(id);
}
return r13;
},
MESSAGE_DELETE_BULK: function handleMessageDeleteBulk({ channelId, ids }) {
let r0 = false;
for (const item of ids) {
if (removeHydratedMessage(channelId, item)) {
r0 = true;
}
}
return r0;
},
LOGOUT: function handleLogout() {
c3665_12.reset();
c3665_13.clear();
c3665_15.clear();
}
});
export default conversationsStore;
@@ -0,0 +1,96 @@
// Metro module 5861 (f5862).
import { upperFirst } from "../../_bundle/Module12";
export function mapConversation(a0) {
const summary_map = a0.summary_map;
const r4 = summary_map == null ? void 0 : summary_map.entries.find((entry) => entry.summary_type === "TOPIC_EXTRACTION_SUMMARY");
const r14 = r4 != null ? (function parseTopicExtractionSummary(a0) {
let r13;
try {
const r9 = JSON.parse(a0);
const title = r9?.title;
r13 = null;
if (typeof title === "string") {
const brief_summary = r9?.brief_summary;
r13 = null;
if (typeof brief_summary === "string") {
r13 = {
title: upperFirst(r9.title),
brief_summary: r9.brief_summary,
key_points: Array.isArray(r9.key_points) ? r9.key_points.map((key_point) => key_point?.text).filter((item) => typeof item === "string") : []
};
}
}
} catch ($e) {
return null;
}
return r13;
})(r4.content_json) : null;
const r20 = r14?.title == null;
let r21 = null;
if (!r20) {
const title = r14.title;
r21 = null;
if (title !== "") {
let brief_summary = r14.brief_summary;
if (brief_summary == null) {
brief_summary = null;
}
let keywords = a0.keywords;
if (keywords == null) {
keywords = [];
}
const summaryMap = a0.summary_map != null ? {
entries: a0.summary_map.entries.map((entry) => ({
summaryType: entry.summary_type,
contentJson: entry.content_json
}))
} : null;
const r48 = a0.moderation != null;
let moderation2 = null;
if (r48) {
const moderation = a0.moderation;
moderation2 = {
status: moderation.status,
statusReason: moderation.status_reason,
messageViolationRate: moderation.message_violation_rate,
flaggedMessageCount: moderation.flagged_message_count,
totalMessageCount: moderation.total_message_count,
flaggedMessageIds: moderation.flagged_message_ids,
flaggedMessageDetails: moderation.flagged_message_details.map((flagged_message_detail) => ({
messageId: flagged_message_detail.message_id,
category: flagged_message_detail.category,
severity: flagged_message_detail.severity,
confidence: flagged_message_detail.confidence,
reason: flagged_message_detail.reason
})),
flaggedSummaryDetails: moderation.flagged_summary_details,
flaggedTitle: moderation.flagged_title,
flaggedSummary: moderation.flagged_summary,
flaggedKeyPoints: moderation.flagged_key_points,
failedMessageIds: moderation.failed_message_ids
};
}
r21 = {
id: a0.id,
title: r14.title,
briefSummary: brief_summary,
keyPoints: r14.key_points,
channelId: a0.channel_id,
guildId: a0.guild_id,
messageIds: a0.message_ids,
userIds: a0.user_ids,
startMessageId: a0.start_message_id,
endMessageId: a0.end_message_id,
messageCount: a0.message_count,
userCount: a0.user_count,
keywords,
summaryMap,
engagement: a0.engagement,
substance: a0.substance,
dynamics: a0.dynamics,
moderation: moderation2
};
}
}
return r21;
}
@@ -0,0 +1,35 @@
// Metro module 9271 (f9272).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let channelsExposedCount = 0;
class TopicalNavigationSurveyStore extends Module589.DeviceSettingsStore {
static displayName = "TopicalNavigationSurveyStore";
static persistKey = "TopicalNavigationSurveyStore";
initialize(a0) {
let r5 = a0?.channelsExposedCount;
if (r5 == null) {
r5 = 0;
}
channelsExposedCount = r5;
}
shouldTriggerOnNextExposure() {
return channelsExposedCount >= 2;
}
getState() {
return {
channelsExposedCount
};
}
getUserAgnosticState() {
return {
channelsExposedCount
};
}
}
const topicalNavigationSurveyStore = new TopicalNavigationSurveyStore(Dispatcher, {
TOPICAL_NAVIGATION_ENTRYPOINT_IMPRESSION: function handleTopicalNavigationEntrypointImpression() {
channelsExposedCount = channelsExposedCount + 1;
}
});
export default topicalNavigationSurveyStore;
export const MIN_EXPOSURES_FOR_SURVEY = 3;
@@ -0,0 +1,57 @@
// Metro module 10124 (f10125).
import { useRef, useMemo, useCallback } from "react";
import { View } from "react-native";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { useSelectedDismissibleContent } from "../../../dismissible_content/hooks/useSelectedDismissibleContent";
import { useCoachmark } from "../../../../design/components/Coachmark/native/useCoachmark.native";
let TOPICAL_NAVIGATION_HEADER_COACHMARK, c6741_8, useStyles;
const NewBadge = function NewBadge() {
return <View style={useStyles().badge}>
<Text variant="text-sm/bold" color="text-default">
{intl.string(t.c2GSIl)}
</Text>
</View>;
};
TOPICAL_NAVIGATION_HEADER_COACHMARK = DismissibleContent.TOPICAL_NAVIGATION_HEADER_COACHMARK;
c6741_8 = [TOPICAL_NAVIGATION_HEADER_COACHMARK];
useStyles = createStyles({
badge: {
backgroundColor: Module712.colors.BACKGROUND_BRAND,
paddingVertical: 2,
paddingHorizontal: Module712.space.PX_8,
borderRadius: Module712.radii.round
},
coachmarkWrapper: {
marginRight: Module712.space.PX_12
}
});
export function ConversationCoachmark(props) {
const { children, isLast } = props;
const styles = useStyles();
const ref = useRef(null);
const [r23, r24] = useSelectedDismissibleContent(c6741_8);
let c17714_0 = r23;
let c17714_1 = r24;
useCoachmark(ref, useMemo(() => ({
title: intl.string(t.UcQjDe),
description: intl.string(t.QeJIbA),
position: "bottom",
visible: c17714_0 === TOPICAL_NAVIGATION_HEADER_COACHMARK,
onDismiss: () => {
c17714_1(ContentDismissActionType.USER_DISMISS);
},
renderImgComponent: () => <NewBadge />
}), [r24, r23]));
return <View style={isLast ? void 0 : styles.coachmarkWrapper}>
<View ref={ref}>
{children(useCallback(() => {
c17714_1(ContentDismissActionType.USER_DISMISS);
}, [r24]))}
</View>
</View>;
}
@@ -0,0 +1,83 @@
// Metro module 9305 (f9306).
import { useCallback, useMemo } from "react";
import { ActivityIndicator, ScrollView, View } from "react-native";
import ConversationsStore from "../../ConversationsStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useRoute } from "../../../../_bundle/Module1483";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import { ConversationsAnalytics } from "../../ConversationsAnalytics";
import { closeConversationsAndJumpToMessage } from "./ConversationNavigatorUtils";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { ChatPreview } from "../../../../components_native/common/ChatPreview";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
pendingContent: {
flex: 1,
paddingVertical: Module712.space.PX_24,
alignItems: "center",
gap: Module712.space.PX_32,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
export default function ConversationFocusScreen() {
let startMessageId, callback;
const styles = useStyles();
const params = useRoute().params;
const { channelId, conversationId } = params;
const stateFromStores = useStateFromStores([ConversationsStore], () => ConversationsStore.getHydratedMessages(channelId, conversationId), [channelId, conversationId]);
const stateFromStoresObject = useStateFromStoresObject([ConversationsStore], () => {
const conversationMetadata = ConversationsStore.getConversationMetadata(channelId, conversationId);
let fullyHydrated = conversationMetadata?.fullyHydrated;
if (fullyHydrated == null) {
fullyHydrated = false;
}
const r10 = {
fullyHydrated,
isFullFetchPending: ConversationsStore.isConversationFetchPending(conversationId, true),
startMessageId: null
};
let startMessageId2 = conversationMetadata == null ? void 0 : conversationMetadata.conversation.startMessageId;
if (startMessageId2 == null) {
startMessageId2 = null;
}
r10.startMessageId = startMessageId2;
return r10;
}, [channelId, conversationId]);
const { fullyHydrated, isFullFetchPending } = stateFromStoresObject;
startMessageId = stateFromStoresObject.startMessageId;
callback = useCallback((a0) => {
if (a0 === "footer_cta") {
ConversationsAnalytics.trackFocusModeDismissed({
channelId,
conversationId,
dismissReason: "jump_to_conversation"
});
}
}, [channelId, conversationId]);
const callback2 = useCallback(() => {
if (startMessageId != null) {
closeConversationsAndJumpToMessage(channelId, startMessageId);
}
}, [channelId, startMessageId]);
const memo = useMemo(() => ({
jumpToChatText: intl.string(t["bz/ik0"]),
jumpTargetId: startMessageId,
onBeforeJumpToMessage: callback
}), [startMessageId, callback]);
return !fullyHydrated && isFullFetchPending ? <View style={styles.pendingContent}>
<ActivityIndicator />
</View> : fullyHydrated ? <ScrollView horizontal scrollEnabled={false} bounces={false} contentContainerStyle={styles.container}>
<ChatPreview channelId={channelId} messages={stateFromStores} jumpToChatProps={memo} initialScrollToTop allowReactions />
</ScrollView> : <View style={styles.pendingContent}>
<Text variant="text-md/normal" color="text-muted">
{intl.string(t.eylmYW)}
</Text>
{startMessageId != null && <Button variant="tertiary" text={intl.string(t.aBNTxl)} onPress={callback2} />}
</View>;
};
@@ -0,0 +1,113 @@
// Metro module 9287 (f9288).
import * as Module19 from "react";
import { useMemo, useCallback } from "react";
import { View } from "react-native";
import ConversationsStore from "../../ConversationsStore";
import { MOBILE_PREVIEW_MESSAGE_COUNT } from "../../ConversationConstants";
import { VerticalGradient } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { useToken } from "../../../../design/tokens/native/useToken";
import Module689 from "../../../../_bundle/Module689";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { fetchConversationMessages } from "../../ConversationsActionCreators";
import { ConversationNavigatorScreens } from "./ConversationNavigatorUtils";
import { ConversationsAnalytics } from "../../ConversationsAnalytics";
import { Card } from "../../../../design/components/Card/native/Card.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import ConversationPreviewSkeleton from "./ConversationPreviewSkeleton";
import ConversationPreviewMessage from "./ConversationPreviewMessage";
import Module4611 from "../../../../_bundle/Module4611";
let locations, useStyles;
const ConversationListItemBase = function ConversationListItemBase(props) {
let stateFromStores;
const conversation = props.conversation;
stateFromStores = void 0;
const styles = useStyles();
const navigation = useNavigation();
const token = useToken(Module712.colors.BACKGROUND_SURFACE_HIGH);
const memo = useMemo(() => [Module689(token).alpha(0).hex(), token], [token]);
stateFromStores = useStateFromStores([ConversationsStore], () => ConversationsStore.getHydratedMessages(conversation.channelId, conversation.id), [conversation.channelId, conversation.id]);
const memo2 = useMemo(() => {
let r7 = stateFromStores == null ? void 0 : stateFromStores.slice(0, MOBILE_PREVIEW_MESSAGE_COUNT);
if (r7 == null) {
r7 = null;
}
return r7;
}, [stateFromStores]);
return <Card style={styles.card} onPress={useCallback(() => {
fetchConversationMessages(conversation.channelId, conversation.guildId, conversation.id, {
includeReactions: true,
includeMessageReferences: true
});
navigation.navigate(ConversationNavigatorScreens.FOCUS, {
channelId: conversation.channelId,
guildId: conversation.guildId,
conversationId: conversation.id,
title: conversation.title
});
ConversationsAnalytics.trackTopicsUnitClicked({
channelId: conversation.channelId,
conversationId: conversation.id,
isFocusMode: false
});
}, [navigation, conversation.channelId, conversation.guildId, conversation.id, conversation.title])} accessibilityLabel={conversation.title}>
<View style={styles.headerContainer}>
<Text variant="text-md/semibold" color="text-default" lineClamp={1} style={styles.title}>{conversation.title}</Text>
<Text variant="text-sm/medium" color="text-muted" lineClamp={1} style={styles.timestamp}>
{intl.formatToPlainString(t.poZZGL, {
count: conversation.messageCount
})}
</Text>
</View>
<View style={styles.previews}>
{memo2 == null ? <ConversationPreviewSkeleton /> : memo2.map((item) => <ConversationPreviewMessage key={item.id} message={item} guildId={conversation.guildId} channelId={conversation.channelId} />)}
</View>
<Module4611 style={styles.bottomFade} start={VerticalGradient.START} end={VerticalGradient.END} colors={memo} locations={locations} />
</Card>;
};
locations = [0, 0.8];
useStyles = createStyles({
card: {
marginBottom: Module712.space.PX_12,
borderWidth: 1,
borderColor: Module712.colors.BORDER_MUTED,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
height: 232,
overflow: "hidden"
},
title: {
flexShrink: 1,
minWidth: 0
},
timestamp: {
flexShrink: 0
},
headerContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
gap: Module712.space.PX_8,
paddingBottom: Module712.space.PX_8
},
previews: {
marginTop: Module712.space.PX_8,
gap: Module712.space.PX_16
},
bottomFade: {
position: "absolute",
left: 0,
right: 0,
bottom: -Module712.space.PX_4,
height: Module712.space.PX_64,
zIndex: 1
}
});
const r82 = Module19.memo(function ConversationListItem(props) {
const { channelId, conversationId } = props;
const stateFromStores2 = useStateFromStores([ConversationsStore], () => ConversationsStore.getConversationMetadata(channelId, conversationId)?.conversation, [channelId, conversationId]);
return stateFromStores2 != null ? <ConversationListItemBase conversation={stateFromStores2} /> : null;
});
export default r82;
@@ -0,0 +1,217 @@
// Metro module 9286 (f9287).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import * as Module19 from "react";
import { useState, useMemo, useCallback, useRef } from "react";
import { View, ActivityIndicator } from "react-native";
import ConversationsStore from "../../ConversationsStore";
import { MOBILE_FETCH_LIMIT, MOBILE_PREVIEW_MESSAGE_COUNT, MAX_CONVERSATIONS_PER_CHANNEL } from "../../ConversationConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import ConversationListItem from "./ConversationListItem";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { useRoute } from "../../../../_bundle/Module1483";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useConversationBackoffRef } from "../../useConversationBackoffRef";
import { useStateFromStoresArray, useStateFromStores } from "../../../../_bundle/Module589";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
import { fetchChannelConversations } from "../../ConversationsActionCreators";
import { ConversationsAnalytics } from "../../ConversationsAnalytics";
import { FlashList } from "../../../../_bundle/noop_6676";
let keyExtractor, c6111_13, useStyles, useStyles2, c6111_18;
let env6111 = {};
const renderItem = function renderItem({ item }) {
return (0, jsx)(ConversationListItem, {
channelId: item.channelId,
conversationId: item.conversationId
});
};
keyExtractor = function keyExtractor(a0) {
return a0.conversationId;
};
c6111_13 = {
waitForInteraction: false,
itemVisiblePercentThreshold: 50,
minimumViewTime: 1000
};
useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
content: {
paddingHorizontal: Module712.space.PX_16,
paddingTop: Module712.space.PX_16
},
spinner: {
paddingVertical: Module712.space.PX_16,
alignItems: "center"
}
});
useStyles2 = createStyles({
empty: {
paddingVertical: Module712.space.PX_24,
paddingHorizontal: Module712.space.PX_16
}
});
c6111_18 = Module19.memo(function() {
return <View style={useStyles2().empty}>
<Text variant="text-md/normal" color="text-muted">
{intl.string(t.LJuFRG)}
</Text>
</View>;
});
export default function ConversationListScreen() {
let c17115_0, _handleEndReached2;
let env17114 = {
$parent: env6111
};
const styles = useStyles();
env17114[0] = styles;
const params = useRoute().params;
const channelId = params.channelId;
env17114[1] = channelId;
const guildId = params.guildId;
env17114[2] = guildId;
const bottom = useSafeAreaInsets_native().bottom;
const conversationBackoffRef = useConversationBackoffRef();
env17114[3] = conversationBackoffRef;
const r36 = _slicedToArray(useState(false), 2);
const r37 = r36[0];
env17114[4] = r37;
env17114[5] = r36[1];
const stateFromStoresArray = useStateFromStoresArray([ConversationsStore], () => {
let r6 = ConversationsStore.getChannelConversations(env17114[1]);
if (r6 == null) {
r6 = [];
}
return r6.map((item) => item.id);
}, [channelId]);
env17114[6] = stateFromStoresArray;
const memo = useMemo(() => env17114[6].slice().sort((a, b) => SnowflakeUtils.compare(b, a)).map((item) => ({
channelId: env17114[1],
conversationId: item
})), [stateFromStoresArray, channelId]);
env17114[7] = memo;
let r51 = useStateFromStores([ConversationsStore], () => ConversationsStore.getEdgeMarker(env17114[1], "before") == null, [channelId]);
const stateFromStores = useStateFromStores([ConversationsStore], () => ConversationsStore.isPendingFetch(env17114[1]), [channelId]);
env17114[8] = stateFromStores;
c17115_0 = void 0;
_handleEndReached2 = function _handleEndReached() {
return c17115_0.apply(this, arguments);
};
c17115_0 = async () => {
let c30081_2 = 0;
L16: {
L15: {
try {
const channelId = env17114[1];
const channelConversations = ConversationsStore.getChannelConversations(channelId);
if (channelConversations != null && channelConversations.length > 0) {
const r39 = env17114[7];
if (r39.length > 0 && r39[0].conversationId === channelConversations[channelConversations.length - 1].id) {
const r49 = r39[r39.length - 1];
c30081_2 = 1;
await fetchChannelConversations({
channelId,
guildId: env17114[2],
direction: "before",
anchor: r49.conversationId,
limit: MOBILE_FETCH_LIMIT,
throwOnError: true,
hydrateMessages: {
limit: MOBILE_PREVIEW_MESSAGE_COUNT
}
});
c30081_2 = 0;
env17114[3].current.succeed();
(0, env17114[5])(false);
break L15;
}
}
env17114[3].current.succeed();
(0, env17114[5])(false);
break L16;
} catch ($e) {
let r27 = $e;
if (c30081_2 !== 0) {
while (true) {
try {
c30081_2 = 0;
env17114[3].current.fail(_handleEndReached2);
(0, env17114[5])(true);
} catch ($e) {
r27 = $e;
if (c30081_2 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r27;
}
}
return void 0;
}
};
const callback = useCallback(_handleEndReached2, [memo, channelId, guildId, conversationBackoffRef]);
const memo2 = useMemo(() => {
let r7, jsx2;
if (!env17114[8]) {
const r2 = env17114[4];
r7 = null;
if (r2) {
jsx2 = jsx;
r7 = jsx2(View, {
style: env17114[0].spinner,
children: jsx2(ActivityIndicator, {})
});
}
} else {
jsx2 = jsx;
r7 = jsx2(View, {
style: env17114[0].spinner,
children: jsx2(ActivityIndicator, {})
});
}
return r7;
}, [styles.spinner, stateFromStores, r37]);
if (r51) {
r51 = memo.length > 0;
}
if (r51) {
r51 = memo.length < MAX_CONVERSATIONS_PER_CHANNEL;
}
if (r51) {
r51 = !stateFromStores;
}
if (r51) {
r51 = !r37;
}
env17114[9] = useRef(void 0);
return <View style={[styles.container, {
paddingBottom: bottom
}]}>
<FlashList data={memo} renderItem={renderItem} keyExtractor={keyExtractor} contentContainerStyle={styles.content} onEndReached={r51 ? callback : void 0} ListEmptyComponent={c6111_18} ListFooterComponent={memo2} onViewableItemsChanged={useCallback(({ viewableItems }) => {
const r2 = env17114[9];
if (r2.current == null) {
r2.current = new Set();
}
for (const item of viewableItems) {
const conversationId = item.item.conversationId;
const r37 = env17114[9];
if (!r37.current.has(conversationId)) {
ConversationsAnalytics.trackPreviewImpression({
channelId: env17114[1],
conversationId,
isFocusMode: false
});
r37.current.add(conversationId);
}
}
}, [channelId])} viewabilityConfig={c6111_13} />
</View>;
};
@@ -0,0 +1,58 @@
// Metro module 9283 (f9284).
import { useToken } from "../../../../design/tokens/native/useToken";
import Module712 from "../../../../_bundle/Module712";
import { renderHeader, getRenderBackImage } from "../../../main_tabs_v2/native/shared_components/HeaderShared";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { createNativeStackNavigator } from "../../../../_bundle/Module9109";
import { useAccessibilityNativeStackOptions } from "../../../../design/components/Navigator/native/Navigator.native";
import { ConversationNavigatorScreens } from "./ConversationNavigatorUtils";
import ConversationNavigatorHeader from "./ConversationNavigatorHeader";
import { intl, t } from "../../../../intl/index.native";
import * as _ConversationListScreen from "./ConversationListScreen";
import ConversationNavigatorMoreMenu from "./ConversationNavigatorMoreMenu";
import * as _ConversationFocusScreen from "./ConversationFocusScreen";
import { getRootNavigationRef } from "../../../main_tabs_v2/RootNavigationRef.native";
let nativeStackNavigator;
const HeaderWithBorder = function HeaderWithBorder(a0) {
const token = useToken(Module712.colors.BORDER_SUBTLE);
return renderHeader({
...a0,
shouldHandleSafeArea: isAndroid(),
style: {
borderColor: token
}
});
};
nativeStackNavigator = createNativeStackNavigator();
export default function ConversationNavigator(props) {
const params = props.route.params;
const { channelId, guildId } = params;
return <nativeStackNavigator.Navigator id="conversation-navigator" screenOptions={useAccessibilityNativeStackOptions()}>
<nativeStackNavigator.Screen initialParams={{
channelId,
guildId
}} name={ConversationNavigatorScreens.LIST} options={(a0) => ({
header: (a0) => <HeaderWithBorder {...a0} />,
headerLeft: getRenderBackImage(a0.navigation),
headerTitle: () => <ConversationNavigatorHeader channelId={channelId} title={intl.string(t.T3WBRp)} />
})} getComponent={() => _ConversationListScreen.default} />
<nativeStackNavigator.Screen name={ConversationNavigatorScreens.FOCUS} options={(a0) => {
const route = a0.route;
return {
header: (a0) => <HeaderWithBorder {...a0} />,
headerLeft: getRenderBackImage(a0.navigation),
headerTitle: () => <ConversationNavigatorHeader channelId={route.params.channelId} title={route.params.title} hasRightAction />,
headerRight: () => <ConversationNavigatorMoreMenu channelId={route.params.channelId} conversationId={route.params.conversationId} />
};
}} getComponent={() => _ConversationFocusScreen.default} />
</nativeStackNavigator.Navigator>;
};
export function openConversationNavigator({ channelId: channelId2, guildId }) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
rootNavigationRef.navigate("conversations", {
channelId: channelId2,
guildId
});
}
}
@@ -0,0 +1,28 @@
// Metro module 9285 (f9286).
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useChannelName from "../../../channel/useChannelName";
import { GenericHeaderTitle } from "../../../main_tabs_v2/native/shared_components/HeaderShared";
const useStyles = createStyles((a0) => ({
container: {
flex: 1,
paddingVertical: Module712.space.PX_16,
paddingRight: a0 ? 0 : Module712.space.PX_64,
alignItems: "center",
justifyContent: "center"
}
}));
export default function ConversationNavigatorHeader(props) {
const { channelId, title, hasRightAction = false } = props;
const styles = useStyles(hasRightAction);
let subtitle = useChannelName(useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId), [channelId]), true);
if (subtitle == null) {
subtitle = void 0;
}
return <View style={styles.container}>
<GenericHeaderTitle title={title} subtitle={subtitle} variant="heading-lg/semibold" subtitleColor="text-muted" />
</View>;
};
@@ -0,0 +1,57 @@
// Metro module 9294 (f9295).
import { useMemo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import { ThumbsUpIcon } from "../../../../design/components/Icon/native/redesign/generated/ThumbsUpIcon";
import { setConversationFeedbackRating } from "../../ConversationsActionCreators";
import { ConversationsAnalytics } from "../../ConversationsAnalytics";
import { presentFeedbackSent } from "../../../toast/native/ToastUtils";
import { ThumbsDownIcon } from "../../../../design/components/Icon/native/redesign/generated/ThumbsDownIcon";
import { ContextMenu } from "../../../../design/components/ContextMenu/native/ContextMenu.native";
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
import { MoreHorizontalIcon } from "../../../../design/components/Icon/native/redesign/generated/MoreHorizontalIcon";
const useStyles = createStyles({
container: {
paddingHorizontal: Module712.space.PX_12
}
});
export default function ConversationNavigatorMoreMenu(props) {
const { channelId, conversationId } = props;
const styles = useStyles();
return <ContextMenu items={useMemo(() => [{
label: intl.string(t["7iRs51"]),
IconComponent: ThumbsUpIcon,
action: () => {
setConversationFeedbackRating(channelId, conversationId, "up");
ConversationsAnalytics.trackThumbsClicked({
channelId,
conversationId,
isThumbsUp: true,
isFocusMode: true
});
presentFeedbackSent();
}
}, {
label: intl.string(t.uNGhdg),
IconComponent: ThumbsDownIcon,
action: () => {
setConversationFeedbackRating(channelId, conversationId, "down");
ConversationsAnalytics.trackThumbsClicked({
channelId,
conversationId,
isThumbsUp: false,
isFocusMode: true
});
presentFeedbackSent();
}
}], [channelId, conversationId])}>
{(a0) => {
const { ref, ...rest } = a0;
return <View style={styles.container} ref={a0.ref}>
<IconButton {...rest} size="sm" variant="tertiary" accessibilityLabel={intl.string(t["6Ic4Ev"])} icon={<MoreHorizontalIcon size="sm" />} />
</View>;
}}
</ContextMenu>;
};
@@ -0,0 +1,17 @@
// Metro module 9284 (f9285).
import { getRootNavigationRef } from "../../../main_tabs_v2/RootNavigationRef.native";
import { transitionToMessage } from "../../../routing/transitionToChannel";
const r11 = {
LIST: "conversation_list",
FOCUS: "conversation_focus"
};
export function closeConversationsAndJumpToMessage(a0, a1) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.goBack();
}
transitionToMessage(a0, a1, {
navigationReplace: true
});
}
export { r11 as ConversationNavigatorScreens };
@@ -0,0 +1,73 @@
// Metro module 9289 (f9290).
import { useMemo } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import RowGenerator from "../../../messages/native/renderer/RowGenerator";
import { MessageContextType } from "../../../messages/native/renderer/RowGeneratorTypes";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useName } from "../../../../utils/NicknameUtils";
import { useProcessColorStringsArray, useIsRoleStyleAndRoleColorsEligibleForERC } from "../../../premium/enhanced_role_colors/native/EnhancedRoleColorUtils";
import { TimestampHourCycle } from "../../../user_settings/UserSettings";
import { calendarFormat } from "../../../../utils/DateUtils";
import { Avatar, AvatarSizes, RoleDot } from "../../../../design/void/native";
import { Text } from "../../../../design/components/Text/native/Text";
import ChatItem from "../../../../components_native/chat/ChatItem";
let rowGenerator, useStyles;
const modifyRow = function modifyRow(a0) {
a0.contextType = MessageContextType.SEARCH;
a0.renderContentOnly = true;
};
rowGenerator = new RowGenerator();
rowGenerator.setOptions({
renderReplies: false,
renderReactions: false
});
useStyles = createStyles({
container: {
gap: Module712.space.PX_4
},
header: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_8
},
authorRow: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4
},
headerTimestamp: {
flex: 1
}
});
export default function ConversationPreviewMessage(props) {
let setting;
const { message, guildId, channelId } = props;
setting = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.roleStyle);
const stateFromStores2 = useStateFromStores([GuildMemberStore], () => GuildMemberStore.getMember(guildId, message.author.id), [guildId, message.author.id]);
const name = useName(guildId, channelId, message.author);
const style = stateFromStores === "username" ? stateFromStores2?.colorString != null ? {
color: stateFromStores2.colorString
} : {} : {};
const processColorStringsArray = useProcessColorStringsArray(stateFromStores2?.colorStrings);
const isRoleStyleAndRoleColorsEligibleForERC = useIsRoleStyleAndRoleColorsEligibleForERC(guildId, message.author.id, stateFromStores, processColorStringsArray);
setting = TimestampHourCycle.useSetting();
return <View style={styles.container}>
<View style={styles.header}>
<Avatar user={message.author} guildId={guildId} size={AvatarSizes.XXSMALL} />
<View style={styles.authorRow}>
{stateFromStores === "dot" && stateFromStores2?.colorString != null && <RoleDot size="small" color={stateFromStores2.colorString} colors={stateFromStores2.colorStrings} />}
<Text variant="text-md/medium" lineClamp={1} style={style} gradientColors={isRoleStyleAndRoleColorsEligibleForERC ? processColorStringsArray : void 0}>{name}</Text>
</View>
<Text variant="text-xs/normal" color="text-muted" lineClamp={1} style={styles.headerTimestamp}>
{useMemo(() => calendarFormat(message.timestamp, true, setting), [message.timestamp, setting])}
</Text>
</View>
<ChatItem pointerEvents="none" horizontalOffset={0} modifyRow={modifyRow} message={message} rowGenerator={rowGenerator} />
</View>;
};
@@ -0,0 +1,71 @@
// Metro module 9288 (f9289).
import { useEffect } from "react";
import { View } from "react-native";
import { MOBILE_PREVIEW_MESSAGE_COUNT } from "../../ConversationConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import ReanimatedRexport, { useSharedValue, withRepeat, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../../design/animation/reanimated/timing/timing";
const useStyles = createStyles({
row: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_8,
marginTop: Module712.space.PX_4
},
rowSpacing: {
marginTop: Module712.space.PX_26
},
avatar: {
width: 24,
height: 24,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.BACKGROUND_MOD_STRONG
},
lines: {
flex: 1,
gap: Module712.space.PX_4
},
lineName: {
height: 10,
width: "35%",
borderRadius: Module712.radii.xs,
backgroundColor: Module712.colors.BACKGROUND_MOD_STRONG
},
lineText: {
height: 10,
borderRadius: Module712.radii.xs,
backgroundColor: Module712.colors.BACKGROUND_MOD_STRONG
}
});
const __initData = {
code: "function ConversationPreviewSkeletonTsx1(){const{opacity}=this.__closure;return{opacity:opacity.get()};}"
};
export default function ConversationPreviewSkeleton() {
const styles = useStyles();
const sharedValue = useSharedValue(0.4);
useEffect(() => {
sharedValue.set(withRepeat(withTiming(1, {
duration: 700
}), -1, true));
}, [sharedValue]);
const r20 = () => ({
opacity: sharedValue.get()
});
r20.__closure = {
opacity: sharedValue
};
r20.__workletHash = 11432452203963;
r20.__initData = __initData;
return <ReanimatedRexport.View style={useAnimatedStyle(r20)} aria-hidden>
{Array.from({
length: MOBILE_PREVIEW_MESSAGE_COUNT
}, (a0, a1) => <View key={a1} style={[styles.row, a1 > 0 && styles.rowSpacing]}>
<View style={styles.avatar} />
<View style={styles.lines}>
<View style={styles.lineName} />
<View style={styles.lineText} />
</View>
</View>)}
</ReanimatedRexport.View>;
};
@@ -0,0 +1,135 @@
// Metro module 9267 (f9268).
import { useCallback, useEffect, useRef, useMemo } from "react";
import ConversationsStore from "../../ConversationsStore";
import { MOBILE_FETCH_LIMIT, MOBILE_PREVIEW_MESSAGE_COUNT, CONVERSATION_HAS_MORE_EXPIRATION_MS } from "../../ConversationConstants";
import { useIsTopicalNavEnabled } from "../../ConversationExperiments";
import { ChannelTypes } from "../../../../_bundle/Module692";
import { useConversationBackoffRef } from "../../useConversationBackoffRef";
import { fetchChannelConversations, trackTopicalNavigationEntrypointImpression } from "../../ConversationsActionCreators";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { PaperIcon } from "../../../../design/components/Icon/native/redesign/generated/PaperIcon";
import { ConversationsAnalytics } from "../../ConversationsAnalytics";
import { openConversationNavigator } from "./ConversationNavigator";
import { intl, t } from "../../../../intl/index.native";
let env6097 = {};
export function useConversationsHeaderButton(a0) {
let env17103 = {
$parent: env6097
};
env17103[0] = a0;
let r18 = useIsTopicalNavEnabled(a0.guild_id, "channel_header") && a0.type === ChannelTypes.GUILD_TEXT;
let c17104_0;
env17103[1] = r18;
const conversationBackoffRef = useConversationBackoffRef([a0.id]);
env17103[2] = conversationBackoffRef;
c17104_0 = void 0;
const fetchPage2 = function fetchPage() {
return c17104_0.apply(this, arguments);
};
c17104_0 = async () => {
let c30074_2 = 0;
L13: {
try {
if (env17103[1]) {
c30074_2 = 1;
const r15 = env17103[0];
await fetchChannelConversations({
channelId: r15.id,
guildId: r15.guild_id,
direction: "before",
anchor: null,
limit: MOBILE_FETCH_LIMIT,
isJump: true,
throwOnError: true,
hydrateMessages: {
limit: MOBILE_PREVIEW_MESSAGE_COUNT
}
});
env17103[2].current.succeed();
c30074_2 = 0;
break L13;
}
} catch ($e) {
let r24 = $e;
if (c30074_2 !== 0) {
while (true) {
try {
c30074_2 = 0;
env17103[2].current.fail(fetchPage2);
break L13;
} catch ($e) {
r24 = $e;
if (c30074_2 === 0) {
break;
}
}
}
}
throw r24;
}
return void 0;
}
};
const callback = useCallback(fetchPage2, [a0.id, a0.guild_id, r18, conversationBackoffRef]);
env17103[3] = callback;
useEffect(() => {
const r3 = env17103[1];
if (!((r3 ? ConversationsStore.hasChannelData(env17103[0].id) : !r3) || ConversationsStore.isPendingFetch(env17103[0].id))) {
(0, env17103[3])();
}
}, [a0.id, a0.guild_id, r18, callback]);
const stateFromStores = useStateFromStores([ConversationsStore], () => ConversationsStore.getEdgeMarker(env17103[0].id, "after"), [a0.id]);
env17103[4] = stateFromStores;
useEffect(() => {
if (env17103[1]) {
const r4 = env17103[4];
if (r4 != null) {
const r12 = r4 + CONVERSATION_HAS_MORE_EXPIRATION_MS - Date.now();
if (r12 > 0) {
let c26405_0 = setTimeout(env17103[3], r12);
return () => clearTimeout(c26405_0);
}
(0, env17103[3])();
}
}
}, [stateFromStores, r18, callback]);
const stateFromStores2 = useStateFromStores([ConversationsStore], () => {
let r10 = ConversationsStore.getChannelConversations(env17103[0].id)?.length;
if (r10 == null) {
r10 = 0;
}
return r10;
}, [a0.id]);
env17103[5] = stateFromStores2;
if (r18) {
r18 = stateFromStores2 > 0;
}
env17103[6] = r18;
env17103[7] = useRef(null);
useEffect(() => {
if (env17103[6] && env17103[7].current !== env17103[0].id) {
const r7 = env17103[7];
const r8 = env17103[0];
r7.current = r8.id;
trackTopicalNavigationEntrypointImpression(r8.id, env17103[5]);
}
}, [r18, stateFromStores2, a0.id]);
return useMemo(() => env17103[6] ? {
source: null,
IconComponent: PaperIcon,
onPress: () => {
env17103[2].current.cancel();
const r14 = env17103[0];
ConversationsAnalytics.trackTopicsUnitImpression({
channelId: r14.id,
conversationIds: [],
isFocusMode: false
});
openConversationNavigator({
channelId: r14.id,
guildId: r14.guild_id
});
},
accessibilityLabel: intl.string(t.u54FxB)
} : null, [r18, conversationBackoffRef, a0.id, a0.guild_id]);
}
@@ -0,0 +1,14 @@
// Metro module 9269 (f9270).
import { useRef, useEffect } from "react";
import { FETCH_BACKOFF_MAX_MS, FETCH_BACKOFF_MIN_MS } from "./ConversationConstants";
import Backoff from "../../_bundle/Backoff";
export function useConversationBackoffRef(r5 = []) {
const ref = useRef(new Backoff(FETCH_BACKOFF_MIN_MS, FETCH_BACKOFF_MAX_MS));
useEffect(() => {
const current = ref.current;
return () => {
current.succeed();
};
}, r5);
return ref;
}