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,37 @@
// Metro module 1361 (f1362).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c1131_0 = {
DC_SHOWN: 0,
0: "DC_SHOWN",
DC_SHOW_REQUEST: 1,
1: "DC_SHOW_REQUEST",
DC_DISMISSED: 2,
2: "DC_DISMISSED"
};
let c1131_1 = [];
class DCFEventStore extends Module589.Store {
static displayName = "DCFEventStore";
getDCFEvents() {
return c1131_1;
}
}
const dCFEventStore = new DCFEventStore(Dispatcher, {
LOGOUT: function reset() {
c1131_1 = [];
},
DCF_EVENT_LOGGED: function handleGenericEvent(a0) {
a0.eventType;
a0.dismissibleContent;
},
DCF_HANDLE_DC_DISMISSED: function handleDCDismissed(a0) {
a0.dismissibleContent;
c1131_0.DC_DISMISSED;
},
DCF_HANDLE_DC_SHOWN: function handleDCShownToUser(a0) {
a0.dismissibleContent;
c1131_0.DC_SHOWN;
}
});
export default dCFEventStore;
export { c1131_0 as DCFEventTypes };
@@ -0,0 +1,35 @@
// Metro module 1369 (f1370).
const r9 = {
PRIMARY: "primary",
SECONDARY: "secondary",
DISMISS: "dismiss",
AUTO: "auto",
AUTO_DISMISS: "auto_dismiss",
TAKE_ACTION: "take_action",
USER_DISMISS: "user_dismiss",
USER_DISMISS_ALL: "user_dismiss_all",
INDIRECT_ACTION: "indirect_action",
UNKNOWN: "unknown"
};
const r20 = {
GUILD_HEADER_TOOLTIPS: "GUILD_HEADER_TOOLTIPS",
CHANNEL_NOTICES: "CHANNEL_NOTICES",
CALL_CHAT_BUTTON: "CALL_CHAT_BUTTON",
GUILD_FEED_TOP: "GUILD_FEED_TOP",
MAIN_VIEW_TOOLTIPS: "MAIN_VIEW_TOOLTIPS",
CHANNEL_HEADER_CALL_BUTTON_TOOLTIPS: "CHANNEL_HEADER_CALL_BUTTON_TOOLTIPS",
YOU_TAB_ONBOARDING: "YOU_TAB_ONBOARDING",
SUPER_REACTIONS_SPARKLES: "SUPER_REACTIONS_SPARKLES",
NOTICE_BAR: "NOTICE_BAR",
PROFILE_DRAWER_HEADER: "PROFILE_DRAWER_HEADER",
SIDEBAR: "SIDEBAR",
MEMBER_LIST_HEADER: "MEMBER_LIST_HEADER",
APP_LAUNCHER_ONBOARDING: "APP_LAUNCHER_ONBOARDING",
VIRTUAL_CURRENCY_ONBOARDING: "VIRTUAL_CURRENCY_ONBOARDING",
ACCOUNT_NAME_ZONE: "ACCOUNT_NAME_ZONE",
VIRTUAL_CURRENCY_MOBILE_ONBOARDING: "VIRTUAL_CURRENCY_MOBILE_ONBOARDING",
PRIVATE_CHANNELS_LIST: "PRIVATE_CHANNELS_LIST",
GUILD_THEME_NUX: "GUILD_THEME_NUX"
};
export { r9 as ContentDismissActionType };
export { r20 as DismissibleContentGroupName };
@@ -0,0 +1,4 @@
// Metro module 1363 (f1364).
import { DismissibleContent } from "../../_bundle/Module1358";
const set = new Set([DismissibleContent.APPLICATION_COMMAND_TOOLTIP, DismissibleContent.NOW_PLAYING_CONSENT_CARD, DismissibleContent.GUILD_INSIGHTS_ACCESS_RATE_NEW, DismissibleContent.FORUM_CHANNEL_UPSELL_MODAL, DismissibleContent.COMMANDS_MIGRATION_UPSELL_MODAL, DismissibleContent.CHANNEL_BROWSER_NUX, DismissibleContent.BLACK_FRIDAY_2022_BOGO_ANNOUNCEMENT_MODAL, DismissibleContent.GG_ANNOUNCEMENT, DismissibleContent.GUILD_ONBOARDING_UPSELL_MODAL, DismissibleContent.CLIENT_THEMES_SPARKLE_PREVIEW, DismissibleContent.CLIENT_THEMES_APPEARANCE_SETTINGS_NEW_BADGE, DismissibleContent.QUEST_1_COMPLETION_TOOLTIP, DismissibleContent.GUEST_VOICE_INVITES_MENU_ITEM_NEW_BADGE, DismissibleContent.CUSTOM_CALL_SOUNDS_PICKER_UPSELL, DismissibleContent.CLIPS_ONBOARDING_CLIP_BUTTON_COACHMARK, DismissibleContent.CUSTOM_APP_ICONS_NEW_BADGE, DismissibleContent.RECURRING_CONTACT_SYNC_PROMPT, DismissibleContent.NUX_GUILD_CHANNEL_EXPLAINER, DismissibleContent.SUPER_REACTION_TOGGLE_EDUCATION_MOBILE, DismissibleContent.SUPER_REACTION_TOGGLE_EDUCATION_DESKTOP, DismissibleContent.FRIEND_FINDER_CONTACTS_IN_NOTIFICATIONS, DismissibleContent.VOICE_CALL_BG_PICKER_NEW_BADGE, DismissibleContent.WHATS_NEW_TENURE_BADGE_REWARD, DismissibleContent.APP_LAUNCHER_ONBOARDING_ACTIVITIES_BANNER, DismissibleContent.APP_LAUNCHER_ONBOARDING_APPS_BANNER, DismissibleContent.APP_LAUNCHER_ONBOARDING_BOTS_BANNER, DismissibleContent.CHANNEL_LIST_CLAN_ADMIN_UPSELL, DismissibleContent.GUILD_LIST_CLAN_ADMIN_UPSELL, DismissibleContent.BRAND_REFRESH_NEW_BADGE, DismissibleContent.BRAND_REFRESH_CLIENT_THEME_BADGE, DismissibleContent.APP_LAUNCHER_USER_APP_BETA_NOTICE, DismissibleContent.QUEST_HOME_FRIENDS_LIST_NEW_BADGE, DismissibleContent.QUEST_HOME_ENTRYPOINT_TAKEOVER_BADGE, DismissibleContent.WHATS_NEW_APP_STYLES_JUNE_2024_FLIP, DismissibleContent.WHATS_NEW_REFERRAL_PROGRAM_FLIP, DismissibleContent.WHATS_NEW_APP_STYLES_JUNE_2024_NITRO_BADGE, DismissibleContent.WHATS_NEW_REFERRAL_PROGRAM_NITRO_BADGE, DismissibleContent.WHATS_NEW_SERVER_PROFILE_FLIP, DismissibleContent.WHATS_NEW_SERVER_PROFILE_BADGE, DismissibleContent.ICYMI_ALPHA_UPSELL, DismissibleContent.PASSWORDLESS_UPSELL, DismissibleContent.CHANNEL_LINKED_LOBBY_EDUCATION_TOOLTIP, DismissibleContent.REVERSE_TRIAL_NITRO_TAB_BADGE, DismissibleContent.REVERSE_TRIAL_STREAM_POPOUT, DismissibleContent.REVERSE_TRIAL_EMOJI_BUTTON, DismissibleContent.REVERSE_TRIAL_EMOJI_PICKER, DismissibleContent.TRIAL_FOR_ALL_INITIAL_UPSELL, DismissibleContent.TRIAL_FOR_ALL_MOBILE_SETTINGS_NOTICE, DismissibleContent.USER_PROFILE_PREMIUM_AND_SHOP_ENTRY_POINTS, DismissibleContent.FRACTIONAL_NITRO_DURATION_LEFT_PILL, DismissibleContent.RESTRICTED_ACCOUNTS_SETTING_NOTICE, DismissibleContent.SOUNDMOJI_BADGE, DismissibleContent.TRIAL_NUX_EMOJI_BUTTON, DismissibleContent.TRIAL_NUX_EMOJI_PICKER, DismissibleContent.TRIAL_NUX_STREAM_COACH_MARK, DismissibleContent.VIRTUAL_CURRENCY_ONBOARDING_ANNOUNCEMENT_MODAL, DismissibleContent.VIRTUAL_CURRENCY_DISCOVERY_ONBOARDING_COACHMARK, DismissibleContent.VIRTUAL_CURRENCY_SHOP_ONBOARDING_COACHMARK, DismissibleContent.GUILD_POWERUPS_OVERVIEW_SIDEBAR_COACHMARK, DismissibleContent.GUILD_POWERUPS_OVERVIEW_SIDEBAR_VIDEO_CARD, DismissibleContent.GUILD_POWERUP_NEW_PERK_AVAILABLE_BADGE, DismissibleContent.RECENT_AVATARS_SETTINGS_PROFILE_PAGE_NEW_BADGE, DismissibleContent.REPORT_TO_MOD_NEW_TAG, DismissibleContent.VIRTUAL_CURRENCY_MOBILE_ONBOARDING_PILL, DismissibleContent.OVERLAY_OOP_SETTINGS_NUX, DismissibleContent.OVERLAY_OOP_WELCOME_BACKGROUND_NUX, DismissibleContent.OVERLAY_OOP_WELCOME_BACKGROUND_SWITCH_FROM_IP_NUX, DismissibleContent.OVERLAY_OOP_WELCOME_NUX, DismissibleContent.OVERLAY_OOP_WELCOME_SWITCH_FROM_IP_NUX, DismissibleContent.REVERSE_TRIAL_NITRO_TAB_BADGE_V2, DismissibleContent.ML_REVERSE_TRIAL_UPSELL_MODAL, DismissibleContent.ML_REVERSE_TRIAL_FOLLOWUP_UPSELL_MODAL, DismissibleContent.RING_USER_TO_VC_NEW_BADGE, DismissibleContent.DESKTOP_REFRESH_ONBOARDING_MODAL, DismissibleContent.CUSTOM_THEME_ENTRYPOINT_NEW_BADGE, DismissibleContent.GUILD_SETTINGS_GUILD_THEME_NEW_BADGE, DismissibleContent.CUSTOM_THEME_ENTRYPOINT_GRADIENT, DismissibleContent.MOBILE_BOGO_PROMOTION_ACTION_SHEET, DismissibleContent.GOOGLE_PLAY_PRICE_CHANGE_ACTION_SHEET, DismissibleContent.RECENT_AVATARS_SETTINGS_MENU_NEW_BADGE, DismissibleContent.DISPLAY_NAME_STYLES_FLYWHEEL_MOBILE_NEW_BADGE_PROFILE_PAGE, DismissibleContent.DISPLAY_NAME_STYLES_FLYWHEEL_NEW_BADGE_PROFILE_PAGE, DismissibleContent.BOGO_2025_NITRO_TAB_BADGE, DismissibleContent.BOGO_2025_ANNOUNCEMENT_MODAL, DismissibleContent.COLLECTIBLES_SHOP_ENTRY_MARKETING, DismissibleContent.SHOP_THIS_LOOK_WEB_MARKETING, DismissibleContent.NAGBAR_NOTICE_OFFER_EXPIRING, DismissibleContent.CLOUD_PLAY_NEW_BADGE, DismissibleContent.VANITY_URL_POWERUP_ROLLBACK_NOTIFICATION, DismissibleContent.CUSTOM_THEMES_NITRO_HOME_TILE, DismissibleContent.CHURN_DISCOUNT_PREMIUM_TAB_BADGE, DismissibleContent.CHURN_DISCOUNT_PREMIUM_TAB_COACHMARK, DismissibleContent.DOUBLE_TAP_TO_REACT_UPSELL, DismissibleConLine truncated
export { set as CONTENT_TYPES_WITH_BYPASS_FATIGUE };
@@ -0,0 +1,40 @@
// Metro module 13127 (f13128).
import Dispatcher from "../../Dispatcher";
export function handleDCShownToUser(a0, a1) {
Dispatcher.dispatch({
type: "DCF_HANDLE_DC_SHOWN",
dismissibleContent: a0,
guildId: a1
});
}
export function handleDCDismissed(a0, a1) {
Dispatcher.dispatch({
type: "DCF_HANDLE_DC_DISMISSED",
dismissibleContent: a0,
guildId: a1
});
}
export function resetDismissibleContentFrameworkStore() {
Dispatcher.dispatch({
type: "DCF_RESET"
});
}
export function overrideDismissibleContentFramework(a0) {
Dispatcher.dispatch({
type: "DCF_DAILY_CAP_OVERRIDE",
value: a0
});
}
export function overrideNewUserMinAgeRequired(a0) {
Dispatcher.dispatch({
type: "DCF_NEW_USER_MIN_AGE_REQUIRED_OVERRIDE",
value: a0
});
}
export function overrideDCFLastDCDismissed(a0, a1) {
Dispatcher.dispatch({
type: "DCF_OVERRIDE_LAST_DC_DISMISSED",
dismissibleContent: a0,
guildId: a1
});
}
@@ -0,0 +1,170 @@
// Metro module 1362 (f1363).
import { AnalyticEvents } from "../../Constants";
import { CONTENT_TYPES_WITH_BYPASS_FATIGUE } from "./DismissibleContentFatigueConfig";
import { isGuildDismissibleContent } from "./DismissibleContentTypes";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c1132_4 = {
numberOfDCsShownToday: 0,
dailyCapPeriodStart: null,
dismissibleContentSeenDuringSession: new Set(),
dailyCapOverridden: false,
newUserMinAgeRequiredOverridden: false,
renderedAtTimestamps: new Map(),
lastDismissed: null,
seenForGuildId: new Map()
};
class DismissibleContentFrameworkStore extends Module589.PersistedStore {
static displayName = "DismissibleContentFrameworkStore";
static persistKey = "DismissibleContentFrameworkStore";
static migrations = [(a0) => ({
...a0
})];
initialize(a0) {
if (a0 != null) {
let numberOfDCsShownToday = a0.numberOfDCsShownToday;
if (numberOfDCsShownToday == null) {
numberOfDCsShownToday = 0;
}
c1132_4.numberOfDCsShownToday = numberOfDCsShownToday;
c1132_4.dailyCapPeriodStart = a0.dailyCapPeriodStart;
let dailyCapOverridden2 = a0.dailyCapOverridden;
if (dailyCapOverridden2 == null) {
dailyCapOverridden2 = false;
}
c1132_4.dailyCapOverridden = dailyCapOverridden2;
let newUserMinAgeRequiredOverridden2 = a0.newUserMinAgeRequiredOverridden;
if (newUserMinAgeRequiredOverridden2 == null) {
newUserMinAgeRequiredOverridden2 = false;
}
c1132_4.newUserMinAgeRequiredOverridden = newUserMinAgeRequiredOverridden2;
}
c1132_4.dismissibleContentSeenDuringSession = new Set();
c1132_4.seenForGuildId = new Map();
c1132_4.lastDismissed = null;
}
getState() {
return c1132_4;
}
get dailyCapOverridden() {
return c1132_4.dailyCapOverridden;
}
get newUserMinAgeRequiredOverridden() {
return c1132_4.newUserMinAgeRequiredOverridden;
}
get lastDismissed() {
return c1132_4.lastDismissed;
}
getRenderedAtTimestamp(a0) {
return c1132_4.renderedAtTimestamps.get(a0);
}
hasUserHitDCCap(a0, a1) {
L3: {
if (a0 != null) {
if (!CONTENT_TYPES_WITH_BYPASS_FATIGUE.has(a0) && !c1132_4.dailyCapOverridden) {
break L3;
}
return false;
}
}
if (a0 != null) {
const r22 = a1 != null && isGuildDismissibleContent(a0);
if (r22 && a1 != null) {
const r31 = c1132_4.seenForGuildId.get(a1);
if (r31 != null && r31.has(a0)) {
return false;
}
}
if (!r22 && c1132_4.dismissibleContentSeenDuringSession.has(a0)) {
return false;
}
}
const date = new Date();
date.setHours(0, 0, 0, 0);
if (c1132_4.dailyCapPeriodStart != null && c1132_4.dailyCapPeriodStart < date.getTime()) {
c1132_4.numberOfDCsShownToday = 0;
c1132_4.dailyCapPeriodStart = null;
}
return c1132_4.numberOfDCsShownToday >= 3;
}
}
const dismissibleContentFrameworkStore = new DismissibleContentFrameworkStore(Dispatcher, {
LOGOUT: function handleLogout() {
c1132_4 = {
...c1132_4,
dismissibleContentSeenDuringSession: new Set(),
renderedAtTimestamps: new Map(),
seenForGuildId: new Map()
};
},
DCF_DAILY_CAP_OVERRIDE: function handleDailyCapOverride(a0) {
c1132_4.dailyCapOverridden = a0.value;
},
DCF_NEW_USER_MIN_AGE_REQUIRED_OVERRIDE: function handleNewUserMinAgeRequiredOverride(a0) {
c1132_4.newUserMinAgeRequiredOverridden = a0.value;
},
DCF_HANDLE_DC_SHOWN: function handleDCShownToUser(a0) {
L19: {
const { dismissibleContent, guildId } = a0;
c1132_4.renderedAtTimestamps.set(dismissibleContent, new Date().getTime());
if (!CONTENT_TYPES_WITH_BYPASS_FATIGUE.has(dismissibleContent) && !c1132_4.dailyCapOverridden) {
const r36 = isGuildDismissibleContent(dismissibleContent) && guildId != null;
if (!r36 && c1132_4.dismissibleContentSeenDuringSession.has(dismissibleContent)) {
break L19;
}
if (r36) {
const r11 = c1132_4.seenForGuildId.get(guildId);
if (r11 != null && r11.has(dismissibleContent)) {
break L19;
}
}
if (r36) {
let r53 = c1132_4.seenForGuildId.get(guildId);
if (r53 == null) {
r53 = new Set();
}
r53.add(dismissibleContent);
c1132_4.seenForGuildId.set(guildId, r53);
} else {
c1132_4.dismissibleContentSeenDuringSession.add(dismissibleContent);
}
if (c1132_4.dailyCapPeriodStart == null) {
const date = new Date();
date.setHours(0, 0, 0, 0);
c1132_4.dailyCapPeriodStart = date.getTime();
}
c1132_4.numberOfDCsShownToday = c1132_4.numberOfDCsShownToday + 1;
if (c1132_4.numberOfDCsShownToday > 3) {
AnalyticsUtils.track(AnalyticEvents.DCF_CAP_EXCEEDED, {
cap_type: "daily_cap",
dismissible_content: dismissibleContent,
shown_dcs: c1132_4.numberOfDCsShownToday
});
}
}
}
},
DCF_HANDLE_DC_DISMISSED: function handleDCDismissed(a0) {
const dismissibleContent = a0.dismissibleContent;
c1132_4.lastDismissed = {
content: dismissibleContent,
guildId: a0.guildId
};
c1132_4.renderedAtTimestamps.delete(dismissibleContent);
},
DCF_OVERRIDE_LAST_DC_DISMISSED: function handleResetLastDCDismissed({ dismissibleContent, guildId }) {
c1132_4.lastDismissed = dismissibleContent != null ? {
content: dismissibleContent,
guildId
} : null;
},
DCF_RESET: function resetStore() {
c1132_4.dailyCapPeriodStart = null;
c1132_4.numberOfDCsShownToday = 0;
c1132_4.dismissibleContentSeenDuringSession = new Set();
c1132_4.seenForGuildId = new Map();
c1132_4.lastDismissed = null;
}
});
export default dismissibleContentFrameworkStore;
@@ -0,0 +1,272 @@
// Metro module 1364 (f1365).
import LoginRequiredActionStore from "../auth/LoginRequiredActionStore";
import UserRequiredActionStore from "../../stores/UserRequiredActionStore";
import { TaskRunner } from "./TaskRunner";
import { createWithEqualityFn } from "../../_bundle/identity_700";
import { CONTENT_TYPES_WITH_BYPASS_FATIGUE } from "./DismissibleContentFatigueConfig";
import { batchUpdates } from "../../_bundle/Module705";
import Module589 from "../../_bundle/Module589";
import isActionRequired from "../core/isActionRequired";
import Dispatcher from "../../Dispatcher";
let c1133_5, withEqualityFn, c1133_7, withUpdateWinner, $mk69091 = function() {
return () => {
withEqualityFn.setState(() => ({
candidates: new Map(),
shownFatigableCandidate: null,
prevFatigableCandidate: null,
recentlyShown: [],
currentlyShown: new Set(),
currentlyShownGroup: new Set(),
lastWinnerTime: 0,
postConnectionOpen: true
}));
};
};
const withContent = function withContent(a0, a1) {
if (a1 == null) {
return a0;
}
a0.currentlyShown.add(a1.content);
const recentlyShown = a0.recentlyShown.filter((item) => item !== a1.content);
recentlyShown.unshift(a1.content);
recentlyShown.splice(5);
a0.recentlyShown = recentlyShown;
if (a1.groupName != null) {
a0.currentlyShownGroup.add(a1.groupName);
}
if (!CONTENT_TYPES_WITH_BYPASS_FATIGUE.has(a1.content)) {
a0.shownFatigableCandidate = a1;
if (a0.prevFatigableCandidate?.content !== a1.content) {
a0.prevFatigableCandidate = a1;
a0.lastWinnerTime = new Date().getTime();
}
}
const onAdded = a1.onAdded;
if (onAdded != null) {
onAdded.call(a1);
}
return a0;
};
withUpdateWinner = function withUpdateWinner(a0) {
if (a0.candidates.size === 0) {
return a0;
}
const r8 = new Date().getTime() - a0.lastWinnerTime;
const r26 = a0.prevFatigableCandidate != null && a0.candidates.has(a0.prevFatigableCandidate.content) && a0.shownFatigableCandidate == null;
const r4 = r8 > 300000;
if (r26 && !r4) {
c1133_5.unschedule();
const r35 = a0.prevFatigableCandidate != null ? a0.candidates.get(a0.prevFatigableCandidate.content) : void 0;
const shownFatigableCandidate = a0.shownFatigableCandidate;
if (shownFatigableCandidate != null) {
if (shownFatigableCandidate.content != null) {
a0.currentlyShown.delete(shownFatigableCandidate.content);
}
if (shownFatigableCandidate.groupName != null) {
a0.currentlyShownGroup.delete(shownFatigableCandidate.groupName);
}
if (a0.shownFatigableCandidate?.content === shownFatigableCandidate.content) {
a0.shownFatigableCandidate = null;
}
}
withContent(a0, r35);
} else if (!(a0.shownFatigableCandidate != null && !r4)) {
let r57 = c1133_5.scheduled();
if (!r57) {
const time = new Date().getTime();
r57 = a0.shownFatigableCandidate == null && time - a0.lastWinnerTime < 3600000;
}
if (!r57) {
c1133_5.schedule(() => {
batchUpdates(() => {
withEqualityFn.setState((state) => {
const r4 = {
...state,
candidates: new Map(state.candidates),
currentlyShown: new Set(state.currentlyShown),
currentlyShownGroup: new Set(state.currentlyShownGroup)
};
let c31235_0 = r4;
const r36 = [...r4.candidates.keys()];
const r45 = r4.prevFatigableCandidate !== null && r4.candidates.has(r4.prevFatigableCandidate.content) && r4.candidates.size > 1 ? r36.filter((item) => item !== c31235_0.prevFatigableCandidate?.content) : r36;
const r59 = r4.candidates.get(r45[Math.floor(Math.random() * r45.length)]);
const shownFatigableCandidate = r4.shownFatigableCandidate;
if (shownFatigableCandidate != null) {
if (shownFatigableCandidate.content != null) {
r4.currentlyShown.delete(shownFatigableCandidate.content);
}
if (shownFatigableCandidate.groupName != null) {
r4.currentlyShownGroup.delete(shownFatigableCandidate.groupName);
}
if (r4.shownFatigableCandidate?.content === shownFatigableCandidate.content) {
r4.shownFatigableCandidate = null;
}
}
withContent(r4, r59);
return r4;
});
});
}, 250);
}
}
return a0;
};
c1133_5 = new TaskRunner();
withEqualityFn = createWithEqualityFn(function initState() {
return {
candidates: new Map(),
shownFatigableCandidate: null,
prevFatigableCandidate: null,
recentlyShown: [],
currentlyShown: new Set(),
currentlyShownGroup: new Set(),
lastWinnerTime: 0,
postConnectionOpen: false
};
});
c1133_7 = false;
class DismissibleContentShownStateStore extends Module589.Store {
static displayName = "DismissibleContentShownStateStore";
initialize() {
this.waitFor(LoginRequiredActionStore, UserRequiredActionStore);
this.syncWith([LoginRequiredActionStore, UserRequiredActionStore], () => this.setHasRequiredAction());
}
setHasRequiredAction() {
c1133_7 = isActionRequired(LoginRequiredActionStore, UserRequiredActionStore);
}
}
export const dismissibleContentShownStateStore = new DismissibleContentShownStateStore(Dispatcher, {
CONNECTION_OPEN: () => {
batchUpdates($mk69091());
c1133_5.unschedule();
},
LOGOUT: () => {
batchUpdates($mk69091());
c1133_5.unschedule();
}
});
export default function useDismissibleContentShownStateStore(a0, a1) {
return withEqualityFn(a0, a1);
};
export function isInCooldown() {
const state = withEqualityFn.getState();
const time = new Date().getTime();
return state.shownFatigableCandidate == null && time - state.lastWinnerTime < 3600000;
}
export function isStateInCooldown(a0) {
const time = new Date().getTime();
return a0.shownFatigableCandidate == null && time - a0.lastWinnerTime < 3600000;
}
export function addCandidateContent(a0) {
let c12984_1 = CONTENT_TYPES_WITH_BYPASS_FATIGUE.has(a0.content);
batchUpdates(() => {
withEqualityFn.setState((state) => {
const r1 = {
...state,
candidates: new Map(state.candidates),
currentlyShown: new Set(state.currentlyShown),
currentlyShownGroup: new Set(state.currentlyShownGroup)
};
if (!c1133_7) {
if (c12984_1) {
withContent(r1, a0);
} else {
r1.candidates.set(a0.content, a0);
withUpdateWinner(r1);
}
}
return r1;
});
});
}
export function removeCandidateContent(c12985_0, c12985_1) {
batchUpdates(() => {
withEqualityFn.setState((state) => {
const r3 = {
...state,
candidates: new Map(state.candidates),
currentlyShown: new Set(state.currentlyShown),
currentlyShownGroup: new Set(state.currentlyShownGroup)
};
if (c12985_1) {
r3.candidates.delete(c12985_0.content);
if (c12985_0 != null) {
if (c12985_0.content != null) {
r3.currentlyShown.delete(c12985_0.content);
}
if (c12985_0.groupName != null) {
r3.currentlyShownGroup.delete(c12985_0.groupName);
}
if (r3.shownFatigableCandidate?.content === c12985_0.content) {
r3.shownFatigableCandidate = null;
}
}
withUpdateWinner(r3);
} else {
r3.candidates.delete(c12985_0.content);
if (c12985_0 != null) {
if (c12985_0.content != null) {
r3.currentlyShown.delete(c12985_0.content);
}
if (c12985_0.groupName != null) {
r3.currentlyShownGroup.delete(c12985_0.groupName);
}
if (r3.shownFatigableCandidate?.content === c12985_0.content) {
r3.shownFatigableCandidate = null;
}
}
}
return r3;
});
});
}
export function getLastShownDismissibleContent() {
let r6 = withEqualityFn.getState().recentlyShown[0];
if (r6 == null) {
r6 = null;
}
return r6;
}
export function getCurrentFatigableWinner() {
let r7 = withEqualityFn.getState().shownFatigableCandidate?.content;
if (r7 == null) {
r7 = null;
}
return r7;
}
export function isContentShown(a0) {
return withEqualityFn.getState().currentlyShown.has(a0);
}
export function useIsContentShown(c12986_0) {
return withEqualityFn((a0) => a0.currentlyShown.has(c12986_0));
}
export function useIsAnyContentShown(c12987_0) {
return withEqualityFn((c24398_0) => c12987_0.some((item) => c24398_0.currentlyShown.has(item)));
}
export function isAnyContentShown(a0) {
const currentlyShown = withEqualityFn.getState().currentlyShown;
return a0.find((item) => currentlyShown.has(item));
}
export function getCurrentlyShownCounts() {
const length = [...withEqualityFn.getState().currentlyShown].filter((item) => !CONTENT_TYPES_WITH_BYPASS_FATIGUE.has(item)).length;
return [withEqualityFn.getState().currentlyShown.size, length];
}
export function reset() {
batchUpdates($mk69091());
c1133_5.unschedule();
}
export function resetFatigueCooldown() {
batchUpdates(() => {
withEqualityFn.setState((state) => ({
...state,
candidates: new Map(state.candidates),
currentlyShown: new Set(state.currentlyShown),
currentlyShownGroup: new Set(state.currentlyShownGroup),
prevFatigableCandidate: null,
lastWinnerTime: 0
}));
});
}
export function isPostConnectionOpen() {
return withEqualityFn.getState().postConnectionOpen;
}
@@ -0,0 +1,46 @@
// Metro module 1359 (f1360).
import { DismissibleContent } from "../../_bundle/Module1358";
let c1129_0, c1129_1, c1129_2, c1129_3, c1129_4, c1129_5;
export function isSingleUseDismissibleContent(a0) {
return !(c1129_1.includes(a0) || c1129_0.includes(a0) || c1129_2.includes(a0));
}
c1129_0 = [DismissibleContent.COLLECTIBLES_SHOP_ENTRY_MARKETING, DismissibleContent.ACTIVITIES_VOICE_LAUNCHER_BADGE, DismissibleContent.GUILD_POWERUP_NEW_PERK_AVAILABLE_COACHMARK, DismissibleContent.GUILD_POWERUP_NEW_PERK_AVAILABLE_BADGE, DismissibleContent.COLLECTIBLES_SHOP_WIDE_BANNER, DismissibleContent.GAME_SHOP_ANNOUNCEMENT_MODAL, DismissibleContent.SLAYER_STOREFRONT_VC_GIFTING_STREAM_HEADER_NEW_BADGE, DismissibleContent.SLAYER_STOREFRONT_VC_GIFTING_PANEL_APP_WIDGET_CTA, DismissibleContent.COLLECTIBLES_SHOP_SLAYER_STOREFRONT_PROMOTIONAL_BANNER, DismissibleContent.COLLECTIBLES_SHOP_GAME_SERVER_HOSTING_BANNER];
c1129_1 = [DismissibleContent.GIFTING_INTENT_FRIENDS_TAB_BADGE, DismissibleContent.FRACTIONAL_NITRO_DURATION_LEFT_PILL, DismissibleContent.GUILD_TAG_AVAILABLE_COACHMARK, DismissibleContent.GUILD_POWERUP_NOTIFICATION, DismissibleContent.THIRD_PARTY_OUTBOUND_PROMO_NAGBAR, DismissibleContent.NAGBAR_NOTICE_IGNORE_USER_FEEDBACK, DismissibleContent.NITRO_TENURE_BADGE_LEVEL_UP, DismissibleContent.CHANNEL_REORDER_MODAL_DISMISS_SETTING, DismissibleContent.GOOGLE_PLAY_PRICE_CHANGE_ACTION_SHEET, DismissibleContent.NAGBAR_NOTICE_OFFER_EXPIRING, DismissibleContent.NOTIFICATION_NUDGE_DM_HOME_BANNER, DismissibleContent.NOTIFICATION_NUDGE_CHAT_BOTTOM_BANNER, DismissibleContent.NOTIFICATION_NUDGE_NOTIFICATION_CENTER_BANNER, DismissibleContent.NOTIFICATION_NUDGE_POST_REACTION_BANNER, DismissibleContent.GUILD_TAG_UPDATED_COACHMARK, DismissibleContent.GAME_ACCOUNT_LINK_RECURRING_UPSELL, DismissibleContent.USER_PROFILE_WISHLIST_RECOMMENDATIONS, DismissibleContent.FIRST_BOOSTER_UPSELL_OVERSEER, DismissibleContent.QUEST_HOME_NEW_QUEST_BADGE, DismissibleContent.RIOT_CONNECTION_DEPRECATION, DismissibleContent.RIOT_CONNECTION_DEPRECATION_ADMIN, DismissibleContent.NOTIFICATION_NUDGE_POST_CALL_DISCONNECT, DismissibleContent.REFERRAL_PROGRAM_ENTRYPOINT_NITRO_BUTTON_NOTIFICATION, DismissibleContent.APP_WIDGET_V2_PROFILE_UPSELL_COACHMARK, DismissibleContent.APP_WIDGET_V2_PROFILE_UPSELL_SUGGESTED, DismissibleContent.MONTHLY_TO_YEARLY_UPSELL_STICKY_BAR, DismissibleContent.PARENTAL_CONSENT_GRACE_WARNING, DismissibleContent.AUTOCLIPPING_ACCOUNT_PANEL_COACHMARK, DismissibleContent.BOUNTIES_RECURRING_SWIPE_UP_NUX, DismissibleContent.BATTLENET_CONNECTION_DEPRECATION, DismissibleContent.BATTLENET_CONNECTION_DEPRECATION_LINKED_ROLES];
c1129_2 = [DismissibleContent.GIFTING_PROMOTION_ICON, DismissibleContent.THIRD_PARTY_OUTBOUND_PROMO_NAGBAR, DismissibleContent.GOOGLE_PLAY_PRICE_CHANGE_ACTION_SHEET, DismissibleContent.PREMIUM_MARKETING_MOMENT_ANNOUNCEMENT_UPSELL, DismissibleContent.PREMIUM_MARKETING_MOMENT_DESKTOP_ANNOUNCEMENT_MODAL, DismissibleContent.PREMIUM_MARKETING_MOMENT_REMINDER_UPSELL, DismissibleContent.PREMIUM_TAB_MARKETING_MOMENT_OFFER_BADGE, DismissibleContent.DISCOUNT_OFFER_ACTION_SHEET, DismissibleContent.MOBILE_PREMIUM_TRIAL_OFFER_ACTION_SHEET, DismissibleContent.PREMIUM_ORBS_REWARDS_DROP_POPOVER, DismissibleContent.QUEST_HOME_ENTRYPOINT_TAKEOVER_BADGE, DismissibleContent.REFERRAL_PROGRAM_POPOVER_V2, DismissibleContent.ML_REVERSE_TRIAL_UPSELL_MODAL, DismissibleContent.ML_REVERSE_TRIAL_FOLLOWUP_UPSELL_MODAL, DismissibleContent.PREMIUM_MARKETING_MOMENT_NAGBAR_UPSELL, DismissibleContent.PREMIUM_MARKETING_MOMENT_USER_SETTINGS_OFFER_BADGE, DismissibleContent.GIFTING_PROMOTION_DESKTOP_FIRST_TIME_COACHMARK, DismissibleContent.GIFTING_PROMOTION_MOBILE_FIRST_TIME_HALFSHEET, DismissibleContent.GIFTING_PROMOTION_REMINDER, DismissibleContent.PREMIUM_GROUP_PRIMARY_REMINDER_NAGBAR, DismissibleContent.GAME_SERVER_NEW_GAMES_COACHMARK, DismissibleContent.PREMIUM_OFFER_TAB_BADGE_POPOVER, DismissibleContent.MONTHLY_TO_YEARLY_UPSELL_STICKY_BAR, DismissibleContent.MONTHLY_TO_YEARLY_UPSELL_NITRO_TAB_POPOVER];
c1129_3 = [DismissibleContent.GAME_SHOP_NEW_BADGE, DismissibleContent.GAME_SHOP_NEW_DROP_POPOVER];
c1129_4 = [DismissibleContent.VANITY_URL_POWERUP_ROLLBACK_NOTIFICATION, DismissibleContent.GAME_SERVER_HOSTING_NEW_BADGE, DismissibleContent.GAME_SERVER_HOSTING_NEW_COACHMARK, DismissibleContent.GUILD_TAG_AVAILABLE_COACHMARK_V2, DismissibleContent.GAME_CLAIM_COACHMARK, DismissibleContent.FIRST_BOOSTER_UPSELL, DismissibleContent.MOBILE_ACCOUNT_LINKING_BANNER, DismissibleContent.FILE_UPLOAD_POWERUP_ROLLBACK_NOTIFICATION];
c1129_5 = [DismissibleContent.BOOST_TO_UNLOCK_COACHMARK, DismissibleContent.EXPIRING_POWERUP_COACHMARK, DismissibleContent.NOTIFICATION_NUDGE_GUILD_OPEN_PER_GUILD];
const r341 = Object.keys(DismissibleContent).map((item) => parseInt(item)).filter((item) => !isNaN(item));
const r343 = r341.filter(isSingleUseDismissibleContent);
export { c1129_0 as versionedDismissibleContents };
export { c1129_1 as timeRecurringDismissibleContents };
export { c1129_2 as snowflakeBoundDismissibleContents };
export { c1129_3 as snowflakeBoundGuildDismissibleContents };
export { c1129_4 as singleUseGuildDismissibleContents };
export { c1129_5 as timeRecurringGuildDismissibleContents };
export function isTimeRecurringDismissibleContent(a0) {
return c1129_1.includes(a0);
}
export function isVersionedDismissibleContent(a0) {
return c1129_0.includes(a0);
}
export function isSnowflakeBoundDismissibleContent(a0) {
return c1129_2.includes(a0);
}
export function isRecurringDismissibleContent(a0) {
return c1129_1.includes(a0) || c1129_0.includes(a0) || c1129_2.includes(a0);
}
export function isSingleUseGuildDismissibleContent(a0) {
return c1129_4.includes(a0);
}
export function isTimeRecurringGuildDismissibleContent(a0) {
return c1129_5.includes(a0);
}
export function isSnowflakeBoundGuildDismissibleContent(a0) {
return c1129_3.includes(a0);
}
export function isGuildDismissibleContent(a0) {
return c1129_4.includes(a0) || c1129_5.includes(a0) || c1129_3.includes(a0);
}
export { r341 as ALL_DISMISSIBLE_CONTENT };
export { r343 as ALL_SINGLE_USE_DISMISSIBLE_CONTENT };
@@ -0,0 +1,129 @@
// Metro module 4005 (f4006).
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import Durations from "../../utils/Durations";
import { disableNewUserDismissibleContent } from "./NewUserDismissibleContentRegistry";
import { isVersionedDismissibleContent, isSnowflakeBoundDismissibleContent, isTimeRecurringDismissibleContent, isSingleUseGuildDismissibleContent, isTimeRecurringGuildDismissibleContent, isSnowflakeBoundGuildDismissibleContent } from "./DismissibleContentTypes";
import { isVersionedDismissibleContentDismissed, isTimeRecurringDismissibleContentDismissed, UNSAFE_isSingleUseGuildDismissibleContentDismissed, UNSAFE_isTimeRecurringGuildDismissibleContentDismissed, UNSAFE_isSnowflakeBoundGuildDismissibleContentDismissed, markDismissibleContentAsDismissedPreProcessing, markDismissibleContentAsDismissedPostProcessing, UNSAFE_addGuildDismissedContent, getGuildNextNumTimesDismissed, UNSAFE_addTimeRecurringGuildDismissedContent, UNSAFE_addSnowflakeBoundGuildDismissedContent } from "./DismissibleContentUtils";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { hasBit } from "../../utils/Uint8ArrayUtils";
import { useStateFromStores } from "../../_bundle/Module589";
import { addDismissedContent } from "../user_settings/UserSettingsProtoActionCreators";
const UNSAFE_isDismissibleContentDismissed = function UNSAFE_isDismissibleContentDismissed(id, r5 = {}) {
let r101;
const { bypassNewUserCheck = false, cooldownDurationMs = Durations.Millis.WEEK, guildId } = r5;
if (!bypassNewUserCheck && disableNewUserDismissibleContent(id)) {
return true;
}
if (isVersionedDismissibleContent(id)) {
return isVersionedDismissibleContentDismissed(id).isDismissed;
}
if (isSnowflakeBoundDismissibleContent(id)) {
const r82 = SnowflakeUtils.fromTimestamp(Date.now());
if (disableNewUserDismissibleContent(id)) {
r101 = {
isDismissed: true,
lastDismissedSnowflakeId: null
};
} else {
const userContent = UserSettingsProtoStore.settings.userContent;
const lastDismissedSnowflakeId = userContent == null ? void 0 : userContent.recurringDismissibleContentStates[id]?.lastDismissedObjectId;
r101 = {
isDismissed: lastDismissedSnowflakeId != null && SnowflakeUtils.compare(r82, lastDismissedSnowflakeId) !== 1,
lastDismissedSnowflakeId
};
}
return r101.isDismissed;
}
if (isTimeRecurringDismissibleContent(id)) {
return isTimeRecurringDismissibleContentDismissed(id, {
cooldownDurationMs
}).isDismissed;
}
if (isSingleUseGuildDismissibleContent(id)) {
return UNSAFE_isSingleUseGuildDismissibleContentDismissed(id, guildId);
}
if (isTimeRecurringGuildDismissibleContent(id)) {
return UNSAFE_isTimeRecurringGuildDismissibleContentDismissed(id, guildId);
}
if (isSnowflakeBoundGuildDismissibleContent(id)) {
return UNSAFE_isSnowflakeBoundGuildDismissibleContentDismissed(id, guildId);
}
const dismissedContents = UserSettingsProtoStore.settings.userContent?.dismissedContents;
return dismissedContents != null && hasBit(dismissedContents, id);
};
export { UNSAFE_isDismissibleContentDismissed };
export function useIsDismissibleContentDismissed_UNSAFE(c13775_0, r7 = {}) {
let c13775_1 = r7;
return useStateFromStores([UserSettingsProtoStore, SelectedGuildStore], () => UNSAFE_isDismissibleContentDismissed(c13775_0, c13775_1));
}
export async function UNSAFE_markDismissibleContentAsDismissed(c24903_0, c24903_1) {
let c24903_3;
c24903_3 = void 0;
let c29250_0 = c24903_0;
let r30 = c24903_1;
if (r30 === void 0) {
r30 = {};
}
let c29250_1 = r30;
await void 0;
if (!(0, UNSAFE_isDismissibleContentDismissed)(c29250_0, {
bypassNewUserCheck: true
})) {
markDismissibleContentAsDismissedPreProcessing(c29250_0, c29250_1);
await addDismissedContent(c29250_0);
markDismissibleContentAsDismissedPostProcessing(c29250_0, c29250_1);
}
}
export function UNSAFE_isSnowflakeBoundDismissibleContentDismissed(a0, a1) {
if (disableNewUserDismissibleContent(a0)) {
return {
isDismissed: true,
lastDismissedSnowflakeId: null
};
}
const userContent = UserSettingsProtoStore.settings.userContent;
const lastDismissedSnowflakeId = userContent == null ? void 0 : userContent.recurringDismissibleContentStates[a0]?.lastDismissedObjectId;
return {
isDismissed: lastDismissedSnowflakeId != null && SnowflakeUtils.compare(a1, lastDismissedSnowflakeId) !== 1,
lastDismissedSnowflakeId
};
}
export async function UNSAFE_markSingleUseGuildDismissibleContentAsDismissed(c24904_0, c24904_1, c24904_2) {
let c24904_4;
c24904_4 = void 0;
let c29251_0 = c24904_0;
let c29251_1 = c24904_1;
let r32 = c24904_2;
if (r32 === void 0) {
r32 = {};
}
let c29251_2 = r32;
await void 0;
markDismissibleContentAsDismissedPreProcessing(c29251_0, c29251_2);
await UNSAFE_addGuildDismissedContent(c29251_0, c29251_1, 1);
markDismissibleContentAsDismissedPostProcessing(c29251_0, c29251_2);
}
export async function UNSAFE_markTimeRecurringGuildDismissibleContentAsDismissed(c24905_0, c24905_1, c24905_2) {
let c24905_4;
c24905_4 = void 0;
let c29252_0 = c24905_0;
let c29252_1 = c24905_2;
const guildNextNumTimesDismissed = getGuildNextNumTimesDismissed(c24905_0, c24905_1);
markDismissibleContentAsDismissedPreProcessing(c24905_0, c24905_2);
await UNSAFE_addTimeRecurringGuildDismissedContent(c24905_0, c24905_1, guildNextNumTimesDismissed);
markDismissibleContentAsDismissedPostProcessing(c29252_0, c29252_1);
}
export async function UNSAFE_markSnowflakeBoundGuildDismissibleContentAsDismissed(c24906_0, snowflakeId, c24906_2, c24906_3) {
let c24906_5;
c24906_5 = void 0;
let c29253_0 = c24906_0;
let c29253_1 = c24906_3;
const guildNextNumTimesDismissed = getGuildNextNumTimesDismissed(c24906_0, c24906_2);
markDismissibleContentAsDismissedPreProcessing(c24906_0, {
...c24906_3,
snowflakeId
});
await UNSAFE_addSnowflakeBoundGuildDismissedContent(c24906_0, snowflakeId, c24906_2, guildNextNumTimesDismissed);
markDismissibleContentAsDismissedPostProcessing(c29253_0, c29253_1);
}
@@ -0,0 +1,387 @@
// Metro module 1360 (f1361).
import _slicedToArray from "../../_bundle/_slicedToArray";
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
import { DCFEventTypes } from "./DCFEventStore";
import DismissibleContentFrameworkStore from "./DismissibleContentFrameworkStore";
import { addCandidateContent, getCurrentlyShownCounts, isContentShown, removeCandidateContent } from "./DismissibleContentShownStateStore";
import { ContentDismissActionType } from "./DismissibleContentConstants";
import { AnalyticEvents } from "../../Constants";
import { isVersionedDismissibleContent, isSnowflakeBoundDismissibleContent } from "./DismissibleContentTypes";
import { getVersionedDismissibleContentCurrentVersion } from "./VersionedDismissibleContentUtils";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { updateRecurringDismissibleContentState, updateGuildDismissedContent } from "../user_settings/UserSettingsProtoActionCreators";
import { disableNewUserDismissibleContent } from "./NewUserDismissibleContentRegistry";
import { useStateFromStores } from "../../_bundle/Module589";
import { DismissibleContent } from "../../_bundle/Module1358";
import Dispatcher from "../../Dispatcher";
import { handleDCDismissed, handleDCShownToUser } from "./DismissibleContentFrameworkActionCreators";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { CONTENT_TYPES_WITH_BYPASS_FATIGUE } from "./DismissibleContentFatigueConfig";
let c1130_14, addTimeRecurringDismissedContent, addSnowflakeBoundDismissedContent, c1130_18, markDismissibleContentAsDismissedPreProcessing, markDismissibleContentAsDismissedPostProcessing, getNextNumTimesDismissed, markVersionedDismissibleContentAsDismissed, trackDismissibleContentShown, trackDismissibleContentDismissed;
const addVersionedDismissedContent = function addVersionedDismissedContent(a0, versionedDismissibleContentCurrentVersion, a2) {
return updateRecurringDismissibleContentState(a0, {
lastDismissedVersion: versionedDismissibleContentCurrentVersion,
lastDismissedAtMs: Date.now().toString(),
lastDismissedObjectId: "0",
numTimesDismissed: a2
});
};
addTimeRecurringDismissedContent = function addTimeRecurringDismissedContent(a0, nextNumTimesDismissed) {
return updateRecurringDismissibleContentState(a0, {
lastDismissedVersion: 0,
lastDismissedAtMs: Date.now().toString(),
lastDismissedObjectId: "0",
numTimesDismissed: nextNumTimesDismissed
});
};
addSnowflakeBoundDismissedContent = function addSnowflakeBoundDismissedContent(a0, snowflakeId, nextNumTimesDismissed) {
return updateRecurringDismissibleContentState(a0, {
lastDismissedVersion: 0,
lastDismissedAtMs: Date.now().toString(),
lastDismissedObjectId: snowflakeId,
numTimesDismissed: nextNumTimesDismissed
});
};
markDismissibleContentAsDismissedPreProcessing = function markDismissibleContentAsDismissedPreProcessing(a0, a1) {
if (isContentShown(a0) || a1.forceTrack) {
trackDismissibleContentDismissed(a0, a1);
}
let guildId = a1.guildId;
if (guildId == null) {
guildId = void 0;
}
handleDCDismissed(a0, guildId);
};
markDismissibleContentAsDismissedPostProcessing = function markDismissibleContentAsDismissedPostProcessing(a0, a1) {
removeCandidateContent({
content: a0,
groupName: a1?.groupName
}, !DismissibleContentFrameworkStore.hasUserHitDCCap());
};
getNextNumTimesDismissed = function getNextNumTimesDismissed(a0, a1) {
if (a1.numTimesDismissed != null) {
return a1.numTimesDismissed;
}
const userContent = UserSettingsProtoStore.settings.userContent;
let r13 = (userContent == null ? void 0 : userContent.recurringDismissibleContentStates[a0])?.numTimesDismissed;
if (r13 == null) {
r13 = 0;
}
return r13 + 1;
};
markVersionedDismissibleContentAsDismissed = async function markVersionedDismissibleContentAsDismissed(c24395_0, c24395_1, c24395_2) {
let c24395_4;
c24395_4 = void 0;
let c28879_0 = c24395_0;
let c28879_1 = c24395_2;
const nextNumTimesDismissed = getNextNumTimesDismissed(c24395_0, c24395_2);
markDismissibleContentAsDismissedPreProcessing(c24395_0, c24395_2);
await addVersionedDismissedContent(c24395_0, c24395_1, nextNumTimesDismissed);
(0, markDismissibleContentAsDismissedPostProcessing)(c28879_0, c28879_1);
};
trackDismissibleContentShown = function trackDismissibleContentShown(a0, a1) {
const r16 = _slicedToArray(getCurrentlyShownCounts(), 2);
AnalyticsUtils.track(AnalyticEvents.DISMISSIBLE_CONTENT_SHOWN, {
type: DismissibleContent[a0],
content_count: r16[0],
fatigable_content_count: r16[1],
group_name: a1?.groupName,
bypass_fatigue: CONTENT_TYPES_WITH_BYPASS_FATIGUE.has(a0),
guild_id: a1?.guildId,
version: a1?.version,
snowflake_id: a1?.snowflakeId
});
};
trackDismissibleContentDismissed = function trackDismissibleContentDismissed(a0, a1) {
let num_times_dismissed;
const [content_count] = getCurrentlyShownCounts();
const renderedAtTimestamp = DismissibleContentFrameworkStore.getRenderedAtTimestamp(a0);
const date = new Date();
const shown_duration = renderedAtTimestamp == null ? null : date.getTime() - renderedAtTimestamp;
if (a1?.guildId != null) {
const guildDismissedContentState = UserSettingsProtoStore.getGuildDismissedContentState(a1.guildId);
let r52 = (guildDismissedContentState == null ? void 0 : guildDismissedContentState[a0])?.numTimesDismissed;
if (r52 == null) {
r52 = 0;
}
num_times_dismissed = r52 + 1;
} else {
const r35 = a1 == null ? {} : a1;
if (r35.numTimesDismissed != null) {
num_times_dismissed = r35.numTimesDismissed;
} else {
const userContent = UserSettingsProtoStore.settings.userContent;
let r44 = (userContent == null ? void 0 : userContent.recurringDismissibleContentStates[a0])?.numTimesDismissed;
if (r44 == null) {
r44 = 0;
}
num_times_dismissed = r44 + 1;
}
}
const DISMISSIBLE_CONTENT_DISMISSED = AnalyticEvents.DISMISSIBLE_CONTENT_DISMISSED;
let action = a1?.dismissAction;
if (action == null) {
action = ContentDismissActionType.UNKNOWN;
}
AnalyticsUtils.track(DISMISSIBLE_CONTENT_DISMISSED, {
type: DismissibleContent[a0],
action,
content_count,
group_name: a1?.groupName,
bypass_fatigue: CONTENT_TYPES_WITH_BYPASS_FATIGUE.has(a0),
guild_id: a1?.guildId,
shown_duration,
version: a1?.version,
num_times_dismissed,
snowflake_id: a1?.snowflakeId
});
};
c1130_14 = 2592000000;
c1130_18 = new Set([DismissibleContent.ACCOUNT_LINK_INVITE_FRIENDS, DismissibleContent.ACCOUNT_LINK_PROMPT, DismissibleContent.AUTOCLIPPING_ACCOUNT_PANEL_COACHMARK]);
export const SNOWFLAKE_BOUND_DISMISSIBLE_CONTENT_DURATION_MS = 2592000000;
export function getDismissedRecurringDismissibleContentState(a0) {
const userContent = UserSettingsProtoStore.settings.userContent;
const r6 = userContent == null ? void 0 : userContent.recurringDismissibleContentStates[a0];
const r24 = {
lastDismissedVersion: isVersionedDismissibleContent(a0) ? getVersionedDismissibleContentCurrentVersion(a0) : 0,
lastDismissedAtMs: new Date().getTime().toString(),
lastDismissedObjectId: isSnowflakeBoundDismissibleContent(a0) ? SnowflakeUtils.fromTimestamp(Date.now() + c1130_14) : "0",
numTimesDismissed: null
};
let numTimesDismissed = r6?.numTimesDismissed;
if (numTimesDismissed == null) {
numTimesDismissed = 0;
}
r24.numTimesDismissed = numTimesDismissed;
return r24;
}
export { addVersionedDismissedContent };
export { addTimeRecurringDismissedContent };
export { addSnowflakeBoundDismissedContent };
export function UNSAFE_addGuildDismissedContent(a0, a1, a2) {
return updateGuildDismissedContent(a0, a1, {
dismissed: true,
lastDismissedVersion: 0,
lastDismissedAtMs: Date.now().toString(),
lastDismissedObjectId: "0",
numTimesDismissed: a2
});
}
export function UNSAFE_removeGuildDismissedContent(a0, a1, a2) {
return updateGuildDismissedContent(a0, a1, {
dismissed: false,
lastDismissedVersion: 0,
lastDismissedAtMs: Date.now().toString(),
lastDismissedObjectId: "0",
numTimesDismissed: a2
});
}
export function UNSAFE_addTimeRecurringGuildDismissedContent(a0, a1, a2) {
return updateGuildDismissedContent(a0, a1, {
dismissed: false,
lastDismissedVersion: 0,
lastDismissedAtMs: Date.now().toString(),
lastDismissedObjectId: "0",
numTimesDismissed: a2
});
}
export function UNSAFE_removeTimeRecurringGuildDismissedContent(a0, a1, a2) {
return updateGuildDismissedContent(a0, a1, {
dismissed: false,
lastDismissedVersion: 0,
lastDismissedAtMs: "0",
lastDismissedObjectId: "0",
numTimesDismissed: a2
});
}
export function UNSAFE_addSnowflakeBoundGuildDismissedContent(a0, a1, a2, a3) {
return updateGuildDismissedContent(a0, a2, {
dismissed: false,
lastDismissedVersion: 0,
lastDismissedAtMs: Date.now().toString(),
lastDismissedObjectId: a1,
numTimesDismissed: a3
});
}
export function UNSAFE_removeSnowflakeBoundGuildDismissedContent(a0, a1, a2) {
return updateGuildDismissedContent(a0, a1, {
dismissed: false,
lastDismissedVersion: 0,
lastDismissedAtMs: "0",
lastDismissedObjectId: "0",
numTimesDismissed: a2
});
}
export function isVersionedDismissibleContentDismissed(a0, a1) {
if (disableNewUserDismissibleContent(a0)) {
return {
isDismissed: true,
lastDismissedVersion: null
};
}
const userContent = UserSettingsProtoStore.settings.userContent;
const lastDismissedVersion = userContent == null ? void 0 : userContent.recurringDismissibleContentStates[a0]?.lastDismissedVersion;
const r18 = a1 == null ? getVersionedDismissibleContentCurrentVersion(a0) : a1;
return {
isDismissed: lastDismissedVersion != null && lastDismissedVersion >= r18,
lastDismissedVersion
};
}
export function isTimeRecurringDismissibleContentDismissed(a0, a1) {
if (disableNewUserDismissibleContent(a0)) {
return {
isDismissed: true,
lastDismissedAtMs: null
};
}
const userContent = UserSettingsProtoStore.settings.userContent;
const r17 = userContent == null ? void 0 : userContent.recurringDismissibleContentStates[a0]?.lastDismissedAtMs;
const lastDismissedAtMs = r17 != null ? r17 !== "0" ? Number.isNaN(Number(r17)) ? void 0 : Number(r17) : void 0 : void 0;
if (lastDismissedAtMs === void 0) {
return {
isDismissed: false,
lastDismissedAtMs: void 0
};
}
const r31 = a1 != null;
let isDismissed = true;
if (r31) {
const r34 = lastDismissedAtMs + a1.cooldownDurationMs;
const r38 = Date.now();
const r40 = a1.showAfterTimestamp == null || r38 >= a1.showAfterTimestamp && lastDismissedAtMs <= a1.showAfterTimestamp;
isDismissed = r38 < r34 || !r40;
}
return {
isDismissed,
lastDismissedAtMs
};
}
export function isTimeRecurringSnowflakeBoundDismissibleContentDismissed(a0, a1, a2) {
if (disableNewUserDismissibleContent(a0)) {
return true;
}
const userContent = UserSettingsProtoStore.settings.userContent;
const r21 = userContent == null ? void 0 : userContent.recurringDismissibleContentStates[a0]?.lastDismissedObjectId;
const userContent2 = UserSettingsProtoStore.settings.userContent;
const r28 = userContent2 == null ? void 0 : userContent2.recurringDismissibleContentStates[a0]?.lastDismissedAtMs;
const r13 = r28 != null ? r28 !== "0" ? Number.isNaN(Number(r28)) ? void 0 : Number(r28) : void 0 : void 0;
const r3 = a2 != null;
let r41 = false;
if (r3) {
const r42 = r13 != null;
r41 = false;
if (r42) {
const r44 = r13 + a2.cooldownDurationMs;
const r48 = Date.now();
const r4 = a2.showAfterTimestamp == null || r48 >= a2.showAfterTimestamp && r13 <= a2.showAfterTimestamp;
r41 = r48 < r44 || !r4;
}
}
const r54 = r21 != null && SnowflakeUtils.compare(a1, r21) !== 1;
if (r41) {
r41 = r54;
}
return r41;
}
export function UNSAFE_isSingleUseGuildDismissibleContentDismissed(a0, a1) {
if (disableNewUserDismissibleContent(a0)) {
return true;
}
const guildDismissedContentState = UserSettingsProtoStore.getGuildDismissedContentState(a1);
return guildDismissedContentState != null && guildDismissedContentState[a0] != null && guildDismissedContentState[a0].dismissed === true;
}
export function useIsSingleUseGuildDismissibleContentDismissed(c12980_0, c12980_1) {
return useStateFromStores([UserSettingsProtoStore], () => {
let r1 = c12980_0 != null;
if (r1) {
const r14 = disableNewUserDismissibleContent(c12980_0);
let r15 = true;
if (!r14) {
const guildDismissedContentState = UserSettingsProtoStore.getGuildDismissedContentState(c12980_1);
r15 = guildDismissedContentState != null && guildDismissedContentState[c12980_0] != null && guildDismissedContentState[c12980_0].dismissed === true;
}
r1 = r15;
}
return r1;
});
}
export function UNSAFE_isTimeRecurringGuildDismissibleContentDismissed(a0, a1) {
if (disableNewUserDismissibleContent(a0)) {
return true;
}
const guildDismissedContentState = UserSettingsProtoStore.getGuildDismissedContentState(a1);
return guildDismissedContentState != null && guildDismissedContentState[a0] != null && guildDismissedContentState[a0].lastDismissedAtMs != null && guildDismissedContentState[a0].lastDismissedAtMs !== "0";
}
export function UNSAFE_isSnowflakeBoundGuildDismissibleContentDismissed(a0, a1) {
if (disableNewUserDismissibleContent(a0)) {
return true;
}
const guildDismissedContentState = UserSettingsProtoStore.getGuildDismissedContentState(a1);
return guildDismissedContentState != null && guildDismissedContentState[a0] != null && guildDismissedContentState[a0].lastDismissedObjectId != null && guildDismissedContentState[a0].lastDismissedObjectId !== "0";
}
export function requestMarkDismissibleContentAsShown(a0, a1, a2, a3) {
if (!isContentShown(a0) && !DismissibleContentFrameworkStore.hasUserHitDCCap(a0, a1?.guildId)) {
const r15 = a3 == null && c1130_18.has(a0);
if (!(a2 ? !r15 : a2)) {
Dispatcher.dispatch({
type: "DCF_EVENT_LOGGED",
eventType: DCFEventTypes.DC_SHOW_REQUEST,
dismissibleContent: a0
});
addCandidateContent({
content: a0,
groupName: a1?.groupName,
onAdded: () => {
handleDCShownToUser(a0, a1?.guildId);
trackDismissibleContentShown(a0, a1);
if (a1 != null) {
const onShown = a1.onShown;
if (onShown != null) {
onShown.call(a1);
}
}
}
});
}
}
}
export { markDismissibleContentAsDismissedPreProcessing };
export { markDismissibleContentAsDismissedPostProcessing };
export async function markLatestVersionDismissibleContentAsDismissed(c24394_0, c24394_1) {
await markVersionedDismissibleContentAsDismissed(c24394_0, getVersionedDismissibleContentCurrentVersion(c24394_0), c24394_1);
}
export function getGuildNextNumTimesDismissed(a0, a1) {
const guildDismissedContentState = UserSettingsProtoStore.getGuildDismissedContentState(a1);
let r11 = (guildDismissedContentState == null ? void 0 : guildDismissedContentState[a0])?.numTimesDismissed;
if (r11 == null) {
r11 = 0;
}
return r11 + 1;
}
export { getNextNumTimesDismissed };
export { markVersionedDismissibleContentAsDismissed };
export async function markSnowflakeBoundDismissibleContentAsDismissed(c24396_0, snowflakeId, c24396_2) {
let c24396_4;
c24396_4 = void 0;
let c28880_0 = c24396_0;
let c28880_1 = c24396_2;
const nextNumTimesDismissed = getNextNumTimesDismissed(c24396_0, c24396_2);
markDismissibleContentAsDismissedPreProcessing(c24396_0, {
...c24396_2,
snowflakeId
});
await addSnowflakeBoundDismissedContent(c24396_0, snowflakeId, nextNumTimesDismissed);
(0, markDismissibleContentAsDismissedPostProcessing)(c28880_0, c28880_1);
}
export async function markTimeRecurringDismissibleContentAsDismissed(c24397_0, c24397_1) {
let c24397_3;
c24397_3 = void 0;
let c28881_0 = c24397_0;
let c28881_1 = c24397_1;
const nextNumTimesDismissed = getNextNumTimesDismissed(c24397_0, c24397_1);
markDismissibleContentAsDismissedPreProcessing(c24397_0, c24397_1);
await addTimeRecurringDismissedContent(c24397_0, nextNumTimesDismissed);
(0, markDismissibleContentAsDismissedPostProcessing)(c28881_0, c28881_1);
}
export { trackDismissibleContentShown };
export { trackDismissibleContentDismissed };
@@ -0,0 +1,87 @@
// Metro module 4027 (f4028).
import AuthenticationStore from "../../stores/AuthenticationStore";
import DismissibleContentFrameworkStore from "./DismissibleContentFrameworkStore";
import { DismissibleContent } from "../../_bundle/Module1358";
import Durations from "../../utils/Durations";
import { useStateFromStoresObject } from "../../_bundle/defaultAreStatesEqual";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
const r17 = {};
r17[DismissibleContent.MJ_NEW_USER_CHAT_BAR] = 0;
r17[DismissibleContent.NUX_GUILD_CHANNEL_EXPLAINER] = 0;
r17[DismissibleContent.SEEN_LAUNCH_WELCOME] = 0;
r17[DismissibleContent.SEEN_OLD_DESIGN] = 0;
r17[DismissibleContent.REFERRAL_PROGRAM_PROGRESS_BAR_TOGGLE] = 0;
r17[DismissibleContent.WHATS_NEW_APP_STYLES_JUNE_2024_FLIP] = 0;
r17[DismissibleContent.WHATS_NEW_REFERRAL_PROGRAM_FLIP] = 0;
r17[DismissibleContent.WHATS_NEW_APP_STYLES_JUNE_2024_NITRO_BADGE] = 0;
r17[DismissibleContent.WHATS_NEW_REFERRAL_PROGRAM_NITRO_BADGE] = 0;
r17[DismissibleContent.WHATS_NEW_SERVER_PROFILE_FLIP] = 0;
r17[DismissibleContent.WHATS_NEW_SERVER_PROFILE_BADGE] = 0;
r17[DismissibleContent.WHATS_NEW_TENURE_BADGE_REWARD] = 0;
r17[DismissibleContent.FRACTIONAL_NITRO_DURATION_LEFT_PILL] = 0;
r17[DismissibleContent.TRIAL_NUX_EMOJI_BUTTON] = 0;
r17[DismissibleContent.TRIAL_NUX_EMOJI_PICKER] = 0;
r17[DismissibleContent.TRIAL_NUX_STREAM_COACH_MARK] = 0;
r17[DismissibleContent.OVERLAY_OOP_SETTINGS_NUX] = 0;
r17[DismissibleContent.OVERLAY_OOP_WELCOME_NUX] = 0;
r17[DismissibleContent.OVERLAY_OOP_WELCOME_BACKGROUND_NUX] = 0;
r17[DismissibleContent.OVERLAY_OOP_WELCOME_SWITCH_FROM_IP_NUX] = 0;
r17[DismissibleContent.OVERLAY_OOP_WELCOME_BACKGROUND_SWITCH_FROM_IP_NUX] = 0;
r17[DismissibleContent.REVERSE_TRIAL_NITRO_TAB_BADGE_V2] = 0;
r17[DismissibleContent.PERMADECOS_NITRO_TAB_NEW_BADGE] = 0;
r17[DismissibleContent.PERMADECOS_NITRO_HOME_CARD_NEW_BADGE] = 0;
r17[DismissibleContent.PROFILE_FRAMES_NITRO_TAB_NEW_BADGE] = 0;
r17[DismissibleContent.BOGO_2025_ANNOUNCEMENT_MODAL] = 0;
r17[DismissibleContent.NITRO_DROP_REWARD] = 0;
r17[DismissibleContent.BOUNTIES_SWIPE_UP_NUX] = 0;
let c2305_5 = r17;
const DAY = Durations.Millis.DAY;
export function useNewUserDismissibleContent(a0) {
let userId;
const stateFromStoresObject = useStateFromStoresObject([AuthenticationStore, DismissibleContentFrameworkStore], () => ({
userId: AuthenticationStore.getId(),
newUserMinAgeRequiredOverridden: DismissibleContentFrameworkStore.newUserMinAgeRequiredOverridden
}));
userId = stateFromStoresObject.userId;
return stateFromStoresObject.newUserMinAgeRequiredOverridden ? a0 : a0.filter((item) => {
let r0 = userId != null;
if (r0) {
const r12 = SnowflakeUtils.age(userId);
let r14 = c2305_5[item];
if (r14 == null) {
r14 = DAY;
}
r0 = r12 >= r14;
}
return r0;
});
}
export function disableNewUserDismissibleContent(a0) {
let r0 = !DismissibleContentFrameworkStore.newUserMinAgeRequiredOverridden;
if (!DismissibleContentFrameworkStore.newUserMinAgeRequiredOverridden) {
const id = AuthenticationStore.getId();
let r1 = id != null;
if (r1) {
const r16 = SnowflakeUtils.age(id);
let r18 = c2305_5[a0];
if (r18 == null) {
r18 = DAY;
}
r1 = r16 >= r18;
}
r0 = !r1;
}
return r0;
}
export function isUserAccountOldEnough(a0, a1) {
let r0 = a0 != null;
if (r0) {
const r11 = SnowflakeUtils.age(a0);
let r13 = c2305_5[a1];
if (r13 == null) {
r13 = DAY;
}
r0 = r11 >= r13;
}
return r0;
}
@@ -0,0 +1,25 @@
// Metro module 1367 (f1368).
export class TaskRunner {
constructor() {
return {
__proto__: new.target.prototype,
timeoutId: null
};
}
schedule(c12990_0, a1) {
this.unschedule();
this.timeoutId = setTimeout(() => {
this.timeoutId = null;
c12990_0();
}, a1);
}
unschedule() {
if (this.scheduled()) {
clearTimeout(this.timeoutId);
this.timeoutId = null;
}
}
scheduled() {
return this.timeoutId !== null;
}
}
@@ -0,0 +1,40 @@
// Metro module 1370 (f1371).
import EmbeddedActivitiesStore from "../activities/EmbeddedActivitiesStore";
import CollectiblesMarketingsStore from "../collectibles/CollectiblesMarketingsStore";
import { DismissibleContent } from "../../_bundle/Module1358";
import { CollectiblesMarketingSurface } from "../../_bundle/Module13124";
import { getNewestBadgeableVersion } from "../app_launcher/utils/AppLauncherBadgeUtils";
import { EmbeddedActivitySurfaces } from "../../flow/Server";
import { getWideBannerDismissibleContentVersion } from "../collectibles/utils/WideBannerDismissibleContentVersion";
import { assertUnreachable } from "../../_bundle/Module1385";
export function getVersionedDismissibleContentCurrentVersion(a0) {
if (DismissibleContent.COLLECTIBLES_SHOP_ENTRY_MARKETING === a0) {
let r79 = CollectiblesMarketingsStore.getMarketingBySurface(CollectiblesMarketingSurface.MOBILE_SHOP_BUTTON)?.version;
if (r79 == null) {
r79 = 0;
}
return r79;
}
if (DismissibleContent.ACTIVITIES_VOICE_LAUNCHER_BADGE === a0) {
return getNewestBadgeableVersion({
storeState: EmbeddedActivitiesStore.getState(),
surface: EmbeddedActivitySurfaces.VOICE_LAUNCHER
});
}
if (DismissibleContent.GUILD_POWERUP_NEW_PERK_AVAILABLE_COACHMARK !== a0 && DismissibleContent.GUILD_POWERUP_NEW_PERK_AVAILABLE_BADGE !== a0) {
if (DismissibleContent.COLLECTIBLES_SHOP_WIDE_BANNER === a0) {
return getWideBannerDismissibleContentVersion();
}
if (DismissibleContent.GAME_SHOP_ANNOUNCEMENT_MODAL !== a0 && DismissibleContent.SLAYER_STOREFRONT_VC_GIFTING_STREAM_HEADER_NEW_BADGE !== a0 && DismissibleContent.SLAYER_STOREFRONT_VC_GIFTING_PANEL_APP_WIDGET_CTA !== a0 && DismissibleContent.COLLECTIBLES_SHOP_SLAYER_STOREFRONT_PROMOTIONAL_BANNER !== a0) {
if (DismissibleContent.COLLECTIBLES_SHOP_GAME_SERVER_HOSTING_BANNER === a0) {
return 0;
}
assertUnreachable(a0, {
andFail: false
});
return 0;
}
return 1;
}
return 0;
}
@@ -0,0 +1,43 @@
// Metro module 8441 (f8442).
import { useGetDismissibleContent, useGetSingleUseGuildDismissibleContent_UNSAFE, useGetVersionedDismissibleContent, useGetTimeRecurringDismissibleContent, useGetSnowflakeBoundDismissibleContent, useGetSnowflakeBoundGuildDismissibleContent_UNSAFE, useGetTimeRecurringSnowflakeBoundDismissibleContent, useGetTimeRecurringGuildDismissibleContent_UNSAFE } from "../useGetDismissibleContent";
import { useSelectedDismissibleContentShared } from "../useSelectedDismissibleContentShared";
export function useSelectedDismissibleContent(a0, a1, r7 = false) {
const [r15, r16] = useGetDismissibleContent(a0, a1);
useSelectedDismissibleContentShared(r15, r16, r7);
return [r15, r16];
}
export function useSelectedSingleUseGuildDismissibleContent(a0, a1, a2, r8 = false) {
const [r21, r22] = useGetSingleUseGuildDismissibleContent_UNSAFE(a0, a1, a2);
useSelectedDismissibleContentShared(r21, r22, r8, a1);
return [r21, r22];
}
export function useSelectedVersionedDismissibleContent(a0, a1, a2, r7 = false) {
const [r16, r17] = useGetVersionedDismissibleContent(a0, a1, a2);
useSelectedDismissibleContentShared(r16, r17, r7);
return [r16, r17];
}
export function useSelectedTimeRecurringDismissibleContent(a0, a1, a2, r7 = false) {
const [r16, r17] = useGetTimeRecurringDismissibleContent(a0, a1, a2);
useSelectedDismissibleContentShared(r16, r17, r7);
return [r16, r17];
}
export function useSelectedSnowflakeBoundDismissibleContent(a0, a1, a2, r7 = false) {
const [r16, r17] = useGetSnowflakeBoundDismissibleContent(a0, a1, a2);
useSelectedDismissibleContentShared(r16, r17, r7);
return [r16, r17];
}
export function useSelectedSnowflakeBoundGuildDismissibleContent(a0, a1, a2, a3, r8 = false) {
const [r22, r23] = useGetSnowflakeBoundGuildDismissibleContent_UNSAFE(a0, a2, a1, a3);
useSelectedDismissibleContentShared(r22, r23, r8, a1);
return [r22, r23];
}
export function useSelectedTimeRecurringSnowflakeBoundDismissibleContent(a0, a1, a2, a3, r7 = false) {
const [r22, r23] = useGetTimeRecurringSnowflakeBoundDismissibleContent(a0, a2, a1, a3);
useSelectedDismissibleContentShared(r22, r23, r7);
return [r22, r23];
}
export function useSelectedTimeRecurringGuildDismissibleContent(a0, a1, a2, a3) {
const [r19, r20] = useGetTimeRecurringGuildDismissibleContent_UNSAFE(a0, a1, a2, a3);
useSelectedDismissibleContentShared(r19, r20, false, a1);
return [r19, r20];
}
@@ -0,0 +1,22 @@
// Metro module 9665 (f9666).
import { useEffect } from "react";
import useMountEffect from "../../../hooks/useMountEffect";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
export function DismissibleActionSheet(a0) {
let c17384_0 = a0;
useMountEffect(() => {
ActionSheetActionCreators.openLazy(c17384_0.importer(), c17384_0.actionSheetKey, {
...c17384_0,
markAsDismissed: function markAsDismissed(a0) {
ActionSheetActionCreators.hideActionSheet(c17384_0.actionSheetKey);
c17384_0.markAsDismissed(a0);
}
});
});
useEffect(() => () => {
if (c17384_0.hideSheetOnUnmount != null && c17384_0.hideSheetOnUnmount) {
ActionSheetActionCreators.hideActionSheet(c17384_0.actionSheetKey);
}
}, [a0.actionSheetKey, a0.hideSheetOnUnmount]);
return null;
}
@@ -0,0 +1,48 @@
// Metro module 14484 (f14485).
import { Gradients } from "../../colors/native/ColorConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import SelectedDismissibleContent from "./SelectedDismissibleContent";
import { isAndroid } from "../../../utils/PlatformUtils";
import { NewTag } from "../../../design/void/native";
import Module4611 from "../../../_bundle/Module4611";
import { HorizontalGradient } from "../../../ConstantsIOS";
const useStyles = createStyles({
newTag: {
backgroundColor: "transparent"
},
newTagContainer: {
borderRadius: Module712.radii.sm,
marginLeft: Module712.space.PX_4
}
});
export default function DismissibleNewTag(props) {
const { dismissibleContent, containerStyle, noGradient, newPremiumStyle, colors, variantOverride } = props;
const styles = useStyles();
return <SelectedDismissibleContent contentTypes={[dismissibleContent]}>
{(a0) => {
let r60;
if (a0.visibleContent !== dismissibleContent) {
return null;
}
let variant = variantOverride;
if (variantOverride == null) {
variant = isAndroid() ? "text-xxs/bold" : "text-xs/bold";
}
if (noGradient) {
r60 = <NewTag variant={variant} containerStyle={[styles.newTagContainer, containerStyle]} />;
} else if (newPremiumStyle) {
r60 = <NewTag variant={variant} containerStyle={styles.newTag} gradient colors={Gradients.PREMIUM_TIER_2_TRI_COLOR} />;
} else {
let colors2 = colors;
if (colors == null) {
colors2 = [Module712.unsafe_rawColors.PREMIUM_TIER_2_PURPLE, Module712.unsafe_rawColors.PREMIUM_TIER_2_PINK];
}
r60 = <Module4611 style={styles.newTagContainer} start={HorizontalGradient.START} end={HorizontalGradient.END} colors={colors2}>
<NewTag containerStyle={styles.newTag} variant={variant} />
</Module4611>;
}
return r60;
}}
</SelectedDismissibleContent>;
};
@@ -0,0 +1,53 @@
// Metro module 9664 (f9665).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useSelectedDismissibleContent, useSelectedVersionedDismissibleContent, useSelectedTimeRecurringDismissibleContent, useSelectedSnowflakeBoundDismissibleContent, useSelectedTimeRecurringSnowflakeBoundDismissibleContent } from "../hooks/useSelectedDismissibleContent";
export default function SelectedDismissibleContent(props) {
const { contentTypes, children } = props;
const r15 = _slicedToArray(useSelectedDismissibleContent(contentTypes, props.groupName, props.bypassAutoDismiss), 2);
return <>
{children({
visibleContent: r15[0],
markAsDismissed: r15[1]
})}
</>;
};
export function SelectedVersionedDismissibleContent(props) {
const { contentType, latestVersion, groupName, bypassAutoDismiss, children } = props;
const r21 = _slicedToArray(useSelectedVersionedDismissibleContent(contentType, latestVersion, groupName, bypassAutoDismiss), 2);
return <>
{children({
visibleContent: r21[0],
markAsDismissed: r21[1]
})}
</>;
}
export function SelectedTimeRecurringDismissibleContent(props) {
const { contentType, timeRecurringConfig, groupName, bypassAutoDismiss, children } = props;
const r21 = _slicedToArray(useSelectedTimeRecurringDismissibleContent(contentType, timeRecurringConfig, groupName, bypassAutoDismiss), 2);
return <>
{children({
visibleContent: r21[0],
markAsDismissed: r21[1]
})}
</>;
}
export function SelectedSnowflakeBoundDismissibleContent(props) {
const { contentType, newSnowflakeId, groupName, bypassAutoDismiss, children } = props;
const r21 = _slicedToArray(useSelectedSnowflakeBoundDismissibleContent(contentType, newSnowflakeId, groupName, bypassAutoDismiss), 2);
return <>
{children({
visibleContent: r21[0],
markAsDismissed: r21[1]
})}
</>;
}
export function SelectedTimeReccuringSnowflakeBoundDismissibleContent(props) {
const { contentType, newSnowflakeId, timeRecurringConfig, groupName, bypassAutoDismiss, children } = props;
const r23 = _slicedToArray(useSelectedTimeRecurringSnowflakeBoundDismissibleContent(contentType, newSnowflakeId, timeRecurringConfig, groupName, bypassAutoDismiss), 2);
return <>
{children({
visibleContent: r23[0],
markAsDismissed: r23[1]
})}
</>;
}
@@ -0,0 +1,581 @@
// Metro module 8442 (f8443).
import { useRef, useEffect, useCallback } from "react";
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import DismissibleContentFrameworkStore from "./DismissibleContentFrameworkStore";
import DismissibleContentShownStateStore from "./DismissibleContentShownStateStore";
import "../../Constants";
import { UserSettingsTypes } from "../user_settings/UserSettingsConstants";
import { useAnyOverlayRenderingLocked } from "../overlay/OverlayTrackingUtils.native";
import { useStateFromStores } from "../../_bundle/Module589";
import { markVersionedDismissibleContentAsDismissed, markTimeRecurringDismissibleContentAsDismissed, markSnowflakeBoundDismissibleContentAsDismissed, isTimeRecurringSnowflakeBoundDismissibleContentDismissed } from "./DismissibleContentUtils";
import { useNewUserDismissibleContent, disableNewUserDismissibleContent } from "./NewUserDismissibleContentRegistry";
import { hasBit } from "../../utils/Uint8ArrayUtils";
import { UNSAFE_markDismissibleContentAsDismissed, UNSAFE_markSnowflakeBoundGuildDismissibleContentAsDismissed, UNSAFE_markSingleUseGuildDismissibleContentAsDismissed, UNSAFE_markTimeRecurringGuildDismissibleContentAsDismissed } from "./DismissibleContentUnsafeUtils";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
function $mk80638($env) {
return (a0) => {
const r4 = $env[0];
return r4 != null && a0.currentlyShown.has(r4);
};
}
function $mk80639() {
return () => {};
}
function $mk80640($env) {
return () => {
const r2 = $env;
const r5 = r2[0];
return r5 != null && $env.$parent[6].hasUserHitDCCap(r5, r2[1]);
};
}
function $mk80641($env) {
return () => {
const r2 = $env;
const r8 = r2[0];
if (r8 != null) {
const r3 = $env.$parent;
if (!r3[4].hasLoaded(r3[10].PRELOADED_USER_SETTINGS)) {
let current = r2[7].current;
let group_name = r2[2];
let latest_version = r2[3];
let snowflake_id = r2[4];
const r23 = r3[1];
const r13 = r3[2];
const r7 = r23(r13[7]);
const DISMISSIBLE_CONTENT_SHOWN_BEFORE_CONNECTION_OPEN = r3[9].DISMISSIBLE_CONTENT_SHOWN_BEFORE_CONNECTION_OPEN;
const r33 = {
content_type: (0, r3[0])(r13[8]).DismissibleContent[r8],
group_name: null,
latest_version: null,
guild_id: null,
snowflake_id: null
};
if (group_name == null) {
group_name = null;
}
r33.group_name = group_name;
if (latest_version == null) {
latest_version = null;
}
r33.latest_version = latest_version;
if (current == null) {
current = null;
}
r33.guild_id = current;
if (snowflake_id == null) {
snowflake_id = null;
}
r33.snowflake_id = snowflake_id;
r7.track(DISMISSIBLE_CONTENT_SHOWN_BEFORE_CONNECTION_OPEN, r33);
}
(0, r3[0])(r3[2][11]).requestMarkDismissibleContentAsShown(r8, {
groupName: r2[2],
guildId: r2[7].current,
version: r2[3],
snowflakeId: r2[4]
}, r2[5], r2[6]);
return $mk105884(r2);
}
};
}
function $mk80642($env) {
return () => {
const r6 = $env[0];
let r7 = null;
if (r6 !== null) {
const userContent = $env.$parent[4].settings.userContent;
const r2 = userContent == null;
let r10 = void 0;
if (!r2) {
const recurringDismissibleContentStates = userContent.recurringDismissibleContentStates;
r10 = recurringDismissibleContentStates == null ? void 0 : recurringDismissibleContentStates[r6];
}
r7 = r10;
}
if (r7 == null) {
r7 = $env.$parent[11];
}
return r7;
};
}
function $mk105884($env) {
return () => {
const r4 = $env;
const content = r4[0];
if (content != null) {
const r2 = $env.$parent;
(0, r2[8])({
content,
groupName: r4[2]
}, !r2[6].hasUserHitDCCap());
}
};
}
let c5407_11;
let env5407 = {};
const canShowTimeRecurringContent = function canShowTimeRecurringContent(a0, a1, a2, a3) {
const r9 = a1 != null ? Number.isNaN(Number(a1)) ? void 0 : Number(a1) : void 0;
const r18 = r9 !== void 0 ? r9 + a3.cooldownDurationMs : 0;
const r23 = Date.now();
let r25 = a3.showAfterTimestamp == null;
if (!r25) {
let r27 = r23 >= a3.showAfterTimestamp;
if (r27) {
let r28 = r9;
if (r28 == null) {
r28 = 0;
}
r27 = r28 <= a3.showAfterTimestamp;
}
r25 = r27;
}
const r31 = a3.numTimesToRecur == null || a3.numTimesToRecur === 0 || a2 == null || a2 < a3.numTimesToRecur;
return (UserSettingsProtoStore.hasLoaded(UserSettingsTypes.PRELOADED_USER_SETTINGS) || r9 != null && a2 != null) && a0 && r25 && (r9 == null || r23 >= r18) && r31;
};
c5407_11 = {};
export function useGetDismissibleContent(a0, a1) {
let r34;
let stateFromStores2, c16577_3;
const groupName = a1;
const stateFromStores = useStateFromStores([UserSettingsProtoStore], () => UserSettingsProtoStore.settings.userContent?.dismissedContents);
stateFromStores2 = useStateFromStores([SelectedGuildStore], () => SelectedGuildStore.getGuildId());
const newUserDismissibleContent = useNewUserDismissibleContent(a0);
c16577_3 = null;
if (UserSettingsProtoStore.hasLoaded(UserSettingsTypes.PRELOADED_USER_SETTINGS)) {
const r40 = newUserDismissibleContent.find((item) => stateFromStores == null || !hasBit(stateFromStores, item));
c16577_3 = r40;
r34 = r40;
} else {
const r2 = stateFromStores != null;
r34 = null;
if (r2) {
const r37 = newUserDismissibleContent.find((item) => !hasBit(stateFromStores, item));
c16577_3 = r37;
r34 = r37;
}
}
let env16578;
const r41 = env16578 = {
$parent: env5407
};
env16578[0] = r34;
env16578[1] = stateFromStores2;
env16578[2] = a1;
const r44 = DismissibleContentShownStateStore($mk80638(r41));
const anyOverlayRenderingLocked = useAnyOverlayRenderingLocked();
env16578[5] = anyOverlayRenderingLocked;
const stateFromStores9 = useStateFromStores([], $mk80639());
env16578[6] = stateFromStores9;
const stateFromStores10 = useStateFromStores([DismissibleContentFrameworkStore], $mk80640(r41));
const ref = useRef(stateFromStores2);
env16578[7] = ref;
ref.current = stateFromStores2;
useEffect($mk80641(r41), [r34, a1, stateFromStores10, anyOverlayRenderingLocked, void 0, stateFromStores9, void 0]);
return [r44 ? r34 ?? null : null, useCallback((a0, a1) => {
if (c16577_3 != null) {
UNSAFE_markDismissibleContentAsDismissed(c16577_3, {
dismissAction: a0,
groupName,
guildId: stateFromStores2,
forceTrack: a1
});
}
}, [r34, a1, stateFromStores2])];
}
export function useGetVersionedDismissibleContent(a0, a1, a2) {
let r40;
let c16579_3;
let env16580;
const version = a1;
const groupName2 = a2;
const r3 = env16580 = {
$parent: env5407
};
env16580[0] = a0;
const lastDismissedVersion = useStateFromStores([UserSettingsProtoStore], $mk80642(r3)).lastDismissedVersion;
const stateFromStores3 = useStateFromStores([SelectedGuildStore], () => SelectedGuildStore.getGuildId());
c16579_3 = null;
const r2 = a0 != null;
let r28 = null;
if (r2) {
const r32 = disableNewUserDismissibleContent(a0);
if (UserSettingsProtoStore.hasLoaded(UserSettingsTypes.PRELOADED_USER_SETTINGS)) {
L11: {
r40 = null;
if (!r32) {
if (lastDismissedVersion != null) {
const r41 = lastDismissedVersion < a1;
r40 = null;
if (!r41) {
break L11;
}
}
r40 = a0;
}
}
c16579_3 = r40;
r28 = r40;
} else {
const r37 = lastDismissedVersion != null;
r28 = null;
if (r37) {
const r38 = r32 ? null : lastDismissedVersion < a1 ? a0 : null;
c16579_3 = r38;
r28 = r38;
}
}
}
let env16581;
const r42 = env16581 = {
$parent: env5407
};
env16581[0] = r28;
env16581[1] = stateFromStores3;
env16581[2] = a2;
env16581[3] = a1;
const r45 = DismissibleContentShownStateStore($mk80638(r42));
const anyOverlayRenderingLocked = useAnyOverlayRenderingLocked();
env16581[5] = anyOverlayRenderingLocked;
const stateFromStores9 = useStateFromStores([], $mk80639());
env16581[6] = stateFromStores9;
const stateFromStores10 = useStateFromStores([DismissibleContentFrameworkStore], $mk80640(r42));
const ref = useRef(stateFromStores3);
env16581[7] = ref;
ref.current = stateFromStores3;
useEffect($mk80641(r42), [r28, a2, stateFromStores10, anyOverlayRenderingLocked, a1, stateFromStores9, void 0]);
return [r45 ? r28 ?? null : null, useCallback((a0, a1) => {
if (c16579_3 != null) {
markVersionedDismissibleContentAsDismissed(c16579_3, version, {
dismissAction: a0,
groupName: groupName2,
guildId: stateFromStores3,
forceTrack: a1,
version
});
}
}, [r28, a2, stateFromStores3, a1])];
}
export function useGetTimeRecurringDismissibleContent(a0, a1, a2) {
let c16582_2;
let env16583;
const groupName3 = a2;
const r4 = env16583 = {
$parent: env5407
};
env16583[0] = a0;
const stateFromStores9 = useStateFromStores([UserSettingsProtoStore], $mk80642(r4));
const { lastDismissedAtMs, numTimesDismissed } = stateFromStores9;
const stateFromStores4 = useStateFromStores([SelectedGuildStore], () => SelectedGuildStore.getGuildId());
c16582_2 = null;
const r3 = a0 != null;
let r34 = null;
if (r3) {
const r40 = canShowTimeRecurringContent(!disableNewUserDismissibleContent(a0), lastDismissedAtMs, numTimesDismissed, a1) ? a0 : null;
c16582_2 = r40;
r34 = r40;
}
let env16584;
const r41 = env16584 = {
$parent: env5407
};
env16584[0] = r34;
env16584[1] = stateFromStores4;
env16584[2] = a2;
const r44 = DismissibleContentShownStateStore($mk80638(r41));
const anyOverlayRenderingLocked = useAnyOverlayRenderingLocked();
env16584[5] = anyOverlayRenderingLocked;
const stateFromStores10 = useStateFromStores([], $mk80639());
env16584[6] = stateFromStores10;
const stateFromStores11 = useStateFromStores([DismissibleContentFrameworkStore], $mk80640(r41));
const ref = useRef(stateFromStores4);
env16584[7] = ref;
ref.current = stateFromStores4;
useEffect($mk80641(r41), [r34, a2, stateFromStores11, anyOverlayRenderingLocked, void 0, stateFromStores10, void 0]);
return [r44 ? r34 ?? null : null, useCallback((a0, a1) => {
if (c16582_2 != null) {
markTimeRecurringDismissibleContentAsDismissed(c16582_2, {
dismissAction: a0,
groupName: groupName3,
guildId: stateFromStores4,
forceTrack: a1
});
}
}, [r34, a2, stateFromStores4])];
}
export function useGetSnowflakeBoundDismissibleContent(a0, a1, a2) {
let r45;
let c16585_3;
let env16586;
let c16585_0 = a1;
const groupName4 = a2;
const r4 = env16586 = {
$parent: env5407
};
env16586[0] = a0;
const lastDismissedObjectId = useStateFromStores([UserSettingsProtoStore], $mk80642(r4)).lastDismissedObjectId;
const stateFromStores5 = useStateFromStores([SelectedGuildStore], () => SelectedGuildStore.getGuildId());
c16585_3 = null;
const r3 = a0 != null;
let r29 = null;
if (r3) {
const r33 = disableNewUserDismissibleContent(a0);
if (UserSettingsProtoStore.hasLoaded(UserSettingsTypes.PRELOADED_USER_SETTINGS)) {
L11: {
r45 = null;
if (!r33) {
if (lastDismissedObjectId != null) {
const r50 = SnowflakeUtils.compare(a1, lastDismissedObjectId);
r45 = null;
if (r50 !== 1) {
break L11;
}
}
r45 = a0;
}
}
c16585_3 = r45;
r29 = r45;
} else {
const r38 = lastDismissedObjectId != null;
r29 = null;
if (r38) {
const r39 = r33 ? null : SnowflakeUtils.compare(a1, lastDismissedObjectId) === 1 ? a0 : null;
c16585_3 = r39;
r29 = r39;
}
}
}
let env16587;
const r52 = env16587 = {
$parent: env5407
};
env16587[0] = r29;
env16587[1] = stateFromStores5;
env16587[2] = a2;
env16587[4] = a1;
const r55 = DismissibleContentShownStateStore($mk80638(r52));
const anyOverlayRenderingLocked = useAnyOverlayRenderingLocked();
env16587[5] = anyOverlayRenderingLocked;
const stateFromStores9 = useStateFromStores([], $mk80639());
env16587[6] = stateFromStores9;
const stateFromStores10 = useStateFromStores([DismissibleContentFrameworkStore], $mk80640(r52));
const ref = useRef(stateFromStores5);
env16587[7] = ref;
ref.current = stateFromStores5;
useEffect($mk80641(r52), [r29, a2, stateFromStores10, anyOverlayRenderingLocked, void 0, stateFromStores9, a1]);
return [r55 ? r29 ?? null : null, useCallback((a0, a1) => {
if (c16585_3 != null) {
markSnowflakeBoundDismissibleContentAsDismissed(c16585_3, c16585_0, {
dismissAction: a0,
groupName: groupName4,
guildId: stateFromStores5,
forceTrack: a1
});
}
}, [r29, a2, stateFromStores5, a1])];
}
export function useGetSnowflakeBoundGuildDismissibleContent_UNSAFE(a0, a1, a2, a3) {
let r45;
let c16588_3;
let c16588_0 = a1;
const guildId = a2;
const groupName5 = a3;
const stateFromStores9 = useStateFromStores([UserSettingsProtoStore], () => UserSettingsProtoStore.getGuildDismissedContentState(guildId));
const lastDismissedObjectId = (a0 != null ? stateFromStores9 == null ? null : stateFromStores9 == null ? void 0 : stateFromStores9[a0] : null)?.lastDismissedObjectId;
c16588_3 = null;
const r27 = a0 != null;
let r28 = null;
if (r27) {
const r32 = disableNewUserDismissibleContent(a0);
if (UserSettingsProtoStore.hasLoaded(UserSettingsTypes.PRELOADED_USER_SETTINGS)) {
L19: {
r45 = null;
if (!r32) {
if (lastDismissedObjectId != null) {
const r50 = SnowflakeUtils.compare(a1, lastDismissedObjectId);
r45 = null;
if (r50 !== 1) {
break L19;
}
}
r45 = a0;
}
}
c16588_3 = r45;
r28 = r45;
} else {
const r38 = lastDismissedObjectId != null;
r28 = null;
if (r38) {
const r39 = r32 ? null : SnowflakeUtils.compare(a1, lastDismissedObjectId) === 1 ? a0 : null;
c16588_3 = r39;
r28 = r39;
}
}
}
let env16589;
const r52 = env16589 = {
$parent: env5407
};
env16589[0] = r28;
env16589[1] = a2;
env16589[2] = a3;
env16589[4] = a1;
const r55 = DismissibleContentShownStateStore($mk80638(r52));
const anyOverlayRenderingLocked = useAnyOverlayRenderingLocked();
env16589[5] = anyOverlayRenderingLocked;
const stateFromStores10 = useStateFromStores([], $mk80639());
env16589[6] = stateFromStores10;
const stateFromStores11 = useStateFromStores([DismissibleContentFrameworkStore], $mk80640(r52));
const ref = useRef(a2);
env16589[7] = ref;
ref.current = a2;
useEffect($mk80641(r52), [r28, a3, stateFromStores11, anyOverlayRenderingLocked, void 0, stateFromStores10, a1]);
return [r55 ? r28 ?? null : null, useCallback((a0, a1) => {
if (c16588_3 != null) {
UNSAFE_markSnowflakeBoundGuildDismissibleContentAsDismissed(c16588_3, c16588_0, guildId, {
dismissAction: a0,
groupName: groupName5,
guildId,
forceTrack: a1
});
}
}, [r28, a3, a2, a1])];
}
export function useGetTimeRecurringSnowflakeBoundDismissibleContent(a0, a1, a2, a3) {
let c16590_3;
const groupName6 = a3;
const stateFromStores6 = useStateFromStores([SelectedGuildStore], () => SelectedGuildStore.getGuildId());
c16590_3 = null;
const r20 = a0 == null || isTimeRecurringSnowflakeBoundDismissibleContentDismissed(a0, a2, a1);
let r24 = null;
if (!r20) {
c16590_3 = a0;
r24 = a0;
}
let env16591;
const r25 = env16591 = {
$parent: env5407
};
env16591[0] = r24;
env16591[1] = stateFromStores6;
env16591[2] = a3;
env16591[4] = a2;
const r28 = DismissibleContentShownStateStore($mk80638(r25));
const anyOverlayRenderingLocked = useAnyOverlayRenderingLocked();
env16591[5] = anyOverlayRenderingLocked;
const stateFromStores9 = useStateFromStores([], $mk80639());
env16591[6] = stateFromStores9;
const stateFromStores10 = useStateFromStores([DismissibleContentFrameworkStore], $mk80640(r25));
const ref = useRef(stateFromStores6);
env16591[7] = ref;
ref.current = stateFromStores6;
useEffect($mk80641(r25), [r24, a3, stateFromStores10, anyOverlayRenderingLocked, void 0, stateFromStores9, a2]);
return [r28 ? r24 ?? null : null, useCallback((a0, a1) => {
if (c16590_3 != null) {
markSnowflakeBoundDismissibleContentAsDismissed(c16590_3, a2, {
dismissAction: a0,
groupName: groupName6,
guildId: stateFromStores6,
forceTrack: a1
});
}
}, [r24, a3, stateFromStores6, a2])];
}
export function useGetSingleUseGuildDismissibleContent_UNSAFE(a0, a1, a2) {
let r28;
let c16592_3;
const guildId2 = a1;
const groupName7 = a2;
const stateFromStores7 = useStateFromStores([UserSettingsProtoStore], () => UserSettingsProtoStore.getGuildDismissedContentState(guildId2));
const newUserDismissibleContent = useNewUserDismissibleContent(a0);
c16592_3 = null;
if (UserSettingsProtoStore.hasLoaded(UserSettingsTypes.PRELOADED_USER_SETTINGS)) {
const r34 = newUserDismissibleContent.find((item) => stateFromStores7 == null || stateFromStores7[item] == null || stateFromStores7[item].dismissed === false);
c16592_3 = r34;
r28 = r34;
} else {
const r2 = stateFromStores7 != null;
r28 = null;
if (r2) {
const r31 = newUserDismissibleContent.find((item) => stateFromStores7[item] == null || stateFromStores7[item].dismissed === false);
c16592_3 = r31;
r28 = r31;
}
}
let env16593;
const r35 = env16593 = {
$parent: env5407
};
env16593[0] = r28;
env16593[1] = a1;
env16593[2] = a2;
const r38 = DismissibleContentShownStateStore($mk80638(r35));
const anyOverlayRenderingLocked = useAnyOverlayRenderingLocked();
env16593[5] = anyOverlayRenderingLocked;
const stateFromStores9 = useStateFromStores([], $mk80639());
env16593[6] = stateFromStores9;
const stateFromStores10 = useStateFromStores([DismissibleContentFrameworkStore], $mk80640(r35));
const ref = useRef(a1);
env16593[7] = ref;
ref.current = a1;
useEffect($mk80641(r35), [r28, a2, stateFromStores10, anyOverlayRenderingLocked, void 0, stateFromStores9, void 0]);
return [r38 ? r28 ?? null : null, useCallback((a0, a1) => {
if (c16592_3 != null) {
UNSAFE_markSingleUseGuildDismissibleContentAsDismissed(c16592_3, guildId2, {
dismissAction: a0,
groupName: groupName7,
guildId: guildId2,
forceTrack: a1
});
}
}, [r28, a2, a1])];
}
export function useGetTimeRecurringGuildDismissibleContent_UNSAFE(a0, a1, a2, a3) {
let c16594_2;
const guildId3 = a1;
const groupName8 = a3;
const stateFromStores9 = useStateFromStores([UserSettingsProtoStore], () => UserSettingsProtoStore.getGuildDismissedContentState(guildId3));
const r27 = a0 != null ? stateFromStores9 == null ? null : stateFromStores9 == null ? void 0 : stateFromStores9[a0] : null;
const numTimesDismissed = r27?.numTimesDismissed;
c16594_2 = null;
const r33 = a0 != null;
let r34 = null;
if (r33) {
const r43 = canShowTimeRecurringContent(!disableNewUserDismissibleContent(a0), r27?.lastDismissedAtMs, numTimesDismissed, a2) ? a0 : null;
c16594_2 = r43;
r34 = r43;
}
let env16595;
const r44 = env16595 = {
$parent: env5407
};
env16595[0] = r34;
env16595[1] = a1;
env16595[2] = a3;
const r47 = DismissibleContentShownStateStore($mk80638(r44));
const anyOverlayRenderingLocked = useAnyOverlayRenderingLocked();
env16595[5] = anyOverlayRenderingLocked;
const stateFromStores10 = useStateFromStores([], $mk80639());
env16595[6] = stateFromStores10;
const stateFromStores11 = useStateFromStores([DismissibleContentFrameworkStore], $mk80640(r44));
const ref = useRef(a1);
env16595[7] = ref;
ref.current = a1;
useEffect($mk80641(r44), [r34, a3, stateFromStores11, anyOverlayRenderingLocked, void 0, stateFromStores10, void 0]);
return [r47 ? r34 ?? null : null, useCallback((a0, a1) => {
if (c16594_2 != null) {
UNSAFE_markTimeRecurringGuildDismissibleContentAsDismissed(c16594_2, guildId3, {
dismissAction: a0,
groupName: groupName8,
guildId: guildId3,
forceTrack: a1
});
}
}, [r34, a3, a1])];
}
export function useDangerouslyPeekDismissibleContents(a0) {
const stateFromStores8 = useStateFromStores([UserSettingsProtoStore], () => UserSettingsProtoStore.settings.userContent?.dismissedContents);
return a0.filter((item) => stateFromStores8 != null && !hasBit(stateFromStores8, item));
}
@@ -0,0 +1,26 @@
// Metro module 8444 (f8445).
import { useEffect } from "react";
import DismissibleContentFrameworkStore from "./DismissibleContentFrameworkStore";
import { ContentDismissActionType } from "./DismissibleContentConstants";
import { CONTENT_TYPES_WITH_BYPASS_FATIGUE } from "./DismissibleContentFatigueConfig";
import { isGuildDismissibleContent } from "./DismissibleContentTypes";
export function useSelectedDismissibleContentShared(a0, a1) {
let r4 = arguments[2];
if (r4 === void 0) {
r4 = false;
}
const r7 = arguments[3];
let c16597_2 = r7;
const r10 = a0 != null && !r4 && !CONTENT_TYPES_WITH_BYPASS_FATIGUE.has(a0);
let c16597_3 = r10;
useEffect(() => () => {
let r4 = c16597_3;
if (r4) {
const content = DismissibleContentFrameworkStore.lastDismissed?.content;
r4 = content !== a0 || isGuildDismissibleContent(a0) && DismissibleContentFrameworkStore.lastDismissed?.guildId !== c16597_2;
}
if (r4) {
a1(ContentDismissActionType.AUTO_DISMISS, true);
}
}, [r10, a1, a0, r7]);
}
@@ -0,0 +1,118 @@
// Metro module 14716 (f14717).
import { useCallback } from "react";
import SelectedGuildStore from "../../../stores/SelectedGuildStore";
import { overrideDCFLastDCDismissed } from "../DismissibleContentFrameworkActionCreators";
import { getVersionedDismissibleContentCurrentVersion } from "../VersionedDismissibleContentUtils";
import { getNextNumTimesDismissed, addVersionedDismissedContent, addSnowflakeBoundDismissedContent, SNOWFLAKE_BOUND_DISMISSIBLE_CONTENT_DURATION_MS, addTimeRecurringDismissedContent, getGuildNextNumTimesDismissed, UNSAFE_removeGuildDismissedContent, UNSAFE_addGuildDismissedContent, UNSAFE_removeTimeRecurringGuildDismissedContent, UNSAFE_addTimeRecurringGuildDismissedContent, UNSAFE_removeSnowflakeBoundGuildDismissedContent, UNSAFE_addSnowflakeBoundGuildDismissedContent } from "../DismissibleContentUtils";
import { removeDismissedRecurringContent, removeDismissedContent, addDismissedContent } from "../../user_settings/UserSettingsProtoActionCreators";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useIsDismissibleContentDismissed_UNSAFE } from "../DismissibleContentUnsafeUtils";
import Durations from "../../../utils/Durations";
import { isVersionedDismissibleContent, isSnowflakeBoundDismissibleContent, isTimeRecurringDismissibleContent, isSingleUseGuildDismissibleContent, isTimeRecurringGuildDismissibleContent, isSnowflakeBoundGuildDismissibleContent } from "../DismissibleContentTypes";
export default function useToggleDismissibleContentDismissState(a0) {
let isDismissibleContentDismissed_UNSAFE;
const stateFromStores = useStateFromStores([SelectedGuildStore], () => SelectedGuildStore.getGuildId());
isDismissibleContentDismissed_UNSAFE = useIsDismissibleContentDismissed_UNSAFE(a0, {
cooldownDurationMs: Durations.Millis.WEEK,
guildId: stateFromStores
});
return {
isDismissed: isDismissibleContentDismissed_UNSAFE,
handleToggleDismissState: useCallback(() => {
let r1, r81, r105, r129, r148, r181, r205;
if (isVersionedDismissibleContent(a0)) {
const versionedDismissibleContentCurrentVersion = getVersionedDismissibleContentCurrentVersion(a0);
const nextNumTimesDismissed2 = getNextNumTimesDismissed(a0, {});
overrideDCFLastDCDismissed(isDismissibleContentDismissed_UNSAFE ? null : a0, void 0);
if (isDismissibleContentDismissed_UNSAFE) {
removeDismissedRecurringContent(a0);
r205 = false;
} else {
addVersionedDismissedContent(a0, versionedDismissibleContentCurrentVersion, nextNumTimesDismissed2);
r205 = true;
}
r1 = r205;
} else if (isSnowflakeBoundDismissibleContent(a0)) {
const nextNumTimesDismissed = getNextNumTimesDismissed(a0, {});
overrideDCFLastDCDismissed(isDismissibleContentDismissed_UNSAFE ? null : a0, void 0);
if (isDismissibleContentDismissed_UNSAFE) {
removeDismissedRecurringContent(a0);
r181 = false;
} else {
addSnowflakeBoundDismissedContent(a0, SnowflakeUtils.fromTimestamp(Date.now() + SNOWFLAKE_BOUND_DISMISSIBLE_CONTENT_DURATION_MS), nextNumTimesDismissed);
r181 = true;
}
r1 = r181;
} else if (isTimeRecurringDismissibleContent(a0)) {
overrideDCFLastDCDismissed(isDismissibleContentDismissed_UNSAFE ? null : a0, void 0);
if (isDismissibleContentDismissed_UNSAFE) {
removeDismissedRecurringContent(a0);
r148 = false;
} else {
addTimeRecurringDismissedContent(a0, getNextNumTimesDismissed(a0, {}));
r148 = true;
}
r1 = r148;
} else if (isSingleUseGuildDismissibleContent(a0)) {
const r112 = stateFromStores == null;
let r113 = false;
if (!r112) {
const r116 = stateFromStores != null ? getGuildNextNumTimesDismissed(a0, stateFromStores) : 1;
overrideDCFLastDCDismissed(isDismissibleContentDismissed_UNSAFE ? null : a0, stateFromStores);
if (isDismissibleContentDismissed_UNSAFE) {
UNSAFE_removeGuildDismissedContent(a0, stateFromStores, r116 - 1);
r129 = false;
} else {
UNSAFE_addGuildDismissedContent(a0, stateFromStores, r116);
r129 = true;
}
r113 = r129;
}
r1 = r113;
} else if (isTimeRecurringGuildDismissibleContent(a0)) {
const r88 = stateFromStores == null;
let r89 = false;
if (!r88) {
const r92 = stateFromStores != null ? getGuildNextNumTimesDismissed(a0, stateFromStores) : 1;
overrideDCFLastDCDismissed(isDismissibleContentDismissed_UNSAFE ? null : a0, stateFromStores);
if (isDismissibleContentDismissed_UNSAFE) {
UNSAFE_removeTimeRecurringGuildDismissedContent(a0, stateFromStores, r92 - 1);
r105 = false;
} else {
UNSAFE_addTimeRecurringGuildDismissedContent(a0, stateFromStores, r92);
r105 = true;
}
r89 = r105;
}
r1 = r89;
} else if (isSnowflakeBoundGuildDismissibleContent(a0)) {
const r4 = stateFromStores == null;
let r2 = false;
if (!r4) {
const r59 = stateFromStores != null ? getGuildNextNumTimesDismissed(a0, stateFromStores) : 1;
overrideDCFLastDCDismissed(isDismissibleContentDismissed_UNSAFE ? null : a0, stateFromStores);
if (isDismissibleContentDismissed_UNSAFE) {
UNSAFE_removeSnowflakeBoundGuildDismissedContent(a0, stateFromStores, r59 - 1);
r81 = false;
} else {
UNSAFE_addSnowflakeBoundGuildDismissedContent(a0, SnowflakeUtils.fromTimestamp(Date.now() + SNOWFLAKE_BOUND_DISMISSIBLE_CONTENT_DURATION_MS), stateFromStores, r59);
r81 = true;
}
r2 = r81;
}
r1 = r2;
} else {
overrideDCFLastDCDismissed(isDismissibleContentDismissed_UNSAFE ? null : a0, void 0);
if (isDismissibleContentDismissed_UNSAFE) {
removeDismissedContent(a0);
r1 = false;
} else {
addDismissedContent(a0);
r1 = true;
}
}
return r1;
}, [a0, stateFromStores, isDismissibleContentDismissed_UNSAFE])
};
};