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,50 @@
// Metro module 14874 (f14875).
import { AgeGateAnalyticAction } from "./AgeGateConstants";
import { AnalyticEvents, Endpoints } from "../../Constants";
import trackAgeGateSubmitted from "../auth/experiment/trackAgeGateSubmitted";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { HTTP } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
export function submitDateOfBirth(a0, a1) {
const source = a1;
trackAgeGateSubmitted(a0, a1);
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source: a1,
action: AgeGateAnalyticAction.AGE_GATE_SUBMITTED
});
return HTTP.patch({
url: Endpoints.ME,
oldFormErrors: true,
body: {
date_of_birth: a0.format("YYYY-MM-DD")
},
rejectWithError: false
}).then((result) => {
Dispatcher.dispatch({
type: "CURRENT_USER_UPDATE",
user: result.body
});
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source,
action: AgeGateAnalyticAction.AGE_GATE_SUCCESS
});
});
}
export function preventUnderageRegistration(a0) {
Dispatcher.dispatch({
type: "AGE_GATE_PREVENT_UNDERAGE_REGISTRATION"
});
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source: a0,
action: AgeGateAnalyticAction.AGE_GATE_PREVENT_UNDERAGE_REGISTRATION
});
}
export function logoutUnderageNewUser(a0) {
Dispatcher.dispatch({
type: "AGE_GATE_LOGOUT_UNDERAGE_NEW_USER"
});
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source: a0,
action: AgeGateAnalyticAction.AGE_GATE_LOGOUT_UNDERAGE_NEW_USER
});
}
+37
View File
@@ -0,0 +1,37 @@
// Metro module 1221 (f1222).
import Durations from "../../utils/Durations";
const r20 = 2 * Durations.Millis.HOUR;
const r21 = {
AUTH: "Register Age Gate",
NEW_USER_FLOW: "NUF",
CLAIM_ACCOUNT: "Claim Age Gate",
NSFW_CHANNEL: "NSFW Channel",
NSFW_SERVER: "NSFW Server",
NSFW_SERVER_INVITE: "NSFW Server Invite",
NSFW_SERVER_INVITE_EMBED: "NSFW Server Invite Embed",
NSFW_VOICE_CHANNEL: "NSFW Voice Channel",
LARGE_GUILD: "Large Guild",
ACCESS_LARGE_GUILD_UNDERAGE: "Access Large Guild Access Underage",
JOIN_LARGE_GUILD_UNDERAGE: "Join Large Guild Underage",
FAMILY_CENTER: "Family Center",
REGISTER: "Register",
DEEP_LINK_PROMPT: "Deep Link Prompt",
UNSPECIFIED: "Unspecified"
};
const set = new Set([r21.NSFW_CHANNEL, r21.NSFW_VOICE_CHANNEL, r21.NSFW_SERVER]);
const r44 = {
AGE_GATE_OPEN: "AGE_GATE_OPEN",
AGE_GATE_CLOSE: "AGE_GATE_CLOSE",
AGE_GATE_SUBMITTED: "AGE_GATE_SUBMITTED",
AGE_GATE_SUCCESS: "AGE_GATE_SUCCESS",
AGE_GATE_FAILURE: "AGE_GATE_FAILURE",
AGE_GATE_UNDERAGE: "AGE_GATE_UNDERAGE",
AGE_GATE_PREVENT_UNDERAGE_REGISTRATION: "AGE_GATE_PREVENT_UNDERAGE_REGISTRATION",
AGE_GATE_LOGOUT_UNDERAGE_NEW_USER: "AGE_GATE_LOGOUT_UNDERAGE_NEW_USER"
};
export { r20 as AGE_GATE_REGISTER_TIMEOUT_MS };
export const NEW_USER_AGE_GATE_MODAL_KEY = "new-user-age-gate-modal";
export const EXISTING_USER_AGE_GATE_MODAL_KEY = "existing-user-age-gate-modal";
export { r21 as AgeGateSource };
export { set as REACTIVE_CHECK_AGE_GATE_SOURCES };
export { r44 as AgeGateAnalyticAction };
@@ -0,0 +1,59 @@
// Metro module 5640 (f5641).
import { AgeGateAnalyticAction } from "./AgeGateConstants";
import { AnalyticEvents, Routes } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import Dispatcher from "../../Dispatcher";
import AuthenticationActionCreators from "../../actions/AuthenticationActionCreators";
import { transitionTo } from "../routing/router_utils";
export function openAgeGateModal(a0) {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: "Enter Your Birthday",
source: {
section: a0
}
});
Dispatcher.dispatch({
type: "AGE_GATE_MODAL_OPEN",
source: a0
});
}
export function closeAgeGateModal(a0) {
Dispatcher.wait(() => Dispatcher.dispatch({
type: "AGE_GATE_MODAL_CLOSE"
}));
if (a0 !== void 0) {
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source: a0,
action: AgeGateAnalyticAction.AGE_GATE_CLOSE
});
}
}
export function openSuccessAgeGateModal(a0) {
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "AGE_GATE_SUCCESS_MODAL_OPEN"
});
});
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source: a0,
action: AgeGateAnalyticAction.AGE_GATE_SUCCESS
});
}
export function openFailureAgeGateModal(a0, underageMessage) {
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "AGE_GATE_FAILURE_MODAL_OPEN",
underageMessage
});
});
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source: a0,
action: AgeGateAnalyticAction.AGE_GATE_FAILURE
});
}
export function closeFailedAgeGate() {
AuthenticationActionCreators.logoutInternal();
transitionTo(Routes.LOGIN, {
source: "age_gate_modal"
});
}
+22
View File
@@ -0,0 +1,22 @@
// Metro module 14863 (f14864).
import { AGE_GATE_REGISTER_TIMEOUT_MS } from "./AgeGateConstants";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
AGE_GATE_REGISTER_TIMEOUT_MS;
let c10503_0 = false;
class AgeGateStore extends Module589.Store {
static displayName = "AgeGateStore";
isUnderageAnonymous() {
return c10503_0;
}
}
const ageGateStore = new AgeGateStore(Dispatcher, {
AGE_GATE_PREVENT_UNDERAGE_REGISTRATION: function handleMarkUnderageAnonymous() {
c10503_0 = true;
Date.now();
},
LOGIN_SUCCESS: function handleLogin() {
c10503_0 = false;
}
});
export default ageGateStore;
+347
View File
@@ -0,0 +1,347 @@
// Metro module 4403 (f4404).
import { isGuildNSFW } from "../../records/GuildRecord";
import ChannelStore from "../../stores/ChannelStore";
import GuildNSFWAgreeStore from "../../stores/GuildNSFWAgreeStore";
import GuildStore from "../../stores/GuildStore";
import UserStore from "../../stores/UserStore";
import { AgeGateSource } from "./AgeGateConstants";
import { HelpdeskArticles, GuildNSFWContentLevel } from "../../Constants";
import { intl, t } from "../../intl/index.native";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import * as _AgeVerificationUtils from "../age_assurance/AgeVerificationUtils";
import { useShouldShowTiggerPawtect, useIsAgeVerified } from "../age_assurance/AgeVerificationUtils";
import * as _RegionalFeatureConfigUtils from "../regional_feature_config/RegionalFeatureConfigUtils";
import { useIsFeatureAgeGated } from "../regional_feature_config/RegionalFeatureConfigUtils";
import { AgeGatedFeature } from "../../_bundle/Module5013";
import { useStateFromStores } from "../../_bundle/Module589";
import { NsfwSpaceWarningModalType } from "../age_assurance/AgeVerificationAnalyticsUtils";
import HelpdeskUtils from "../../utils/HelpdeskUtils";
import { openAgeGateModal } from "./AgeGateModalActionCreators";
import { useIsChannelSpoilerGated } from "../spoiler_channels/SpoilerChannelUtils";
let c2633_10, c2633_11, c2633_12, isChannelContentGated, useIsChannelContentGated;
const shouldShowAgeGateForVoiceChannel = function shouldShowAgeGateForVoiceChannel(channelId) {
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
let r19 = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES) && shouldShowTiggerPawtect;
if (r19) {
const currentUser = UserStore.getCurrentUser();
const r0 = currentUser == null;
let r23 = false;
if (!r0) {
const shouldShowTiggerPawtect2 = _AgeVerificationUtils.shouldShowTiggerPawtect();
const r33 = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES) && shouldShowTiggerPawtect2;
r23 = currentUser.nsfwAllowed !== true || r33;
}
const r38 = r23 ? channelId == null : !r23;
r19 = r38 ? !r38 : isChannelContentGated(ChannelStore.getChannel(channelId));
}
return r19;
};
isChannelContentGated = function isChannelContentGated(a0) {
if (a0 == null) {
return false;
}
let r8 = GuildNSFWAgreeStore.didAgree(a0.guild_id);
const nsfwAllowed = UserStore.getCurrentUser()?.nsfwAllowed;
const isFeatureAgeGated = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES);
let r26 = _AgeVerificationUtils.shouldShowTiggerPawtect();
if (r8) {
r8 = !(nsfwAllowed === false);
}
let r29 = !r8;
if (r8) {
if (r26) {
r26 = isFeatureAgeGated;
}
r29 = r26;
}
if (a0.isNSFW() && r29) {
return true;
}
const guild = GuildStore.getGuild(a0.guild_id);
return guild != null && (isGuildNSFW(guild) && r29);
};
useIsChannelContentGated = function useIsChannelContentGated(a0) {
const shouldShowTiggerPawtect = useShouldShowTiggerPawtect();
let r21 = useStateFromStores([GuildNSFWAgreeStore], () => GuildNSFWAgreeStore.didAgree(a0?.guild_id));
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser()?.nsfwAllowed === false);
let r35 = useIsFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES);
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(a0?.guild_id));
if (r21) {
r21 = !stateFromStores;
}
let r43 = !r21;
if (r21) {
if (r35) {
r35 = shouldShowTiggerPawtect;
}
r43 = r35;
}
let r3 = a0 != null;
if (r3) {
const isNSFW = a0.isNSFW();
const r2 = isNSFW ? !r43 : !isNSFW;
let r4 = !r2;
if (r2) {
let r46 = stateFromStores2 != null;
if (r46) {
const isGuildNSFW2 = isGuildNSFW(stateFromStores2);
r46 = !(isGuildNSFW2 ? !r43 : !isGuildNSFW2);
}
r4 = r46;
}
r3 = r4;
}
return r3;
};
c2633_10 = new Date("06/16/2020");
c2633_11 = [GuildNSFWContentLevel.AGE_RESTRICTED, GuildNSFWContentLevel.EXPLICIT];
c2633_12 = new Set([AgeGateSource.NSFW_SERVER, AgeGateSource.NSFW_SERVER_INVITE, AgeGateSource.NSFW_SERVER_INVITE_EMBED]);
export { c2633_12 as SERVER_AGE_GATE_SOURCES };
export function userNeedsAgeGate() {
const currentUser = UserStore.getCurrentUser();
return currentUser != null && SnowflakeUtils.extractTimestamp(currentUser.id) > c2633_10.getTime() && currentUser.nsfwAllowed == null;
}
export function guildNeedsAgeGate(a0) {
return c2633_11.includes(a0.nsfwLevel);
}
export function shouldAgeVerifyForAgeGate() {
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
return _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES) && shouldShowTiggerPawtect;
}
export function useShouldAgeVerifyForAgeGate() {
let r11 = useIsFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES);
const shouldShowTiggerPawtect = useShouldShowTiggerPawtect();
if (r11) {
r11 = shouldShowTiggerPawtect;
}
return r11;
}
export function useAgeGateVerifyContentForGuild(a0) {
let r66, r117;
const isAgeVerified = useIsAgeVerified();
const isGuildNSFW2 = isGuildNSFW(a0);
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser()?.nsfwAllowed === false);
const isFeatureAgeGated = useIsFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES);
const shouldShowTiggerPawtect = useShouldShowTiggerPawtect();
const r35 = isFeatureAgeGated && shouldShowTiggerPawtect;
const title = intl.string(isGuildNSFW2 ? t.xi46lg : t.ZmwvDc);
const r43 = {
title: null,
description: null,
agreement: null,
modalType: null
};
if (r35) {
r43.title = title;
if (isAgeVerified) {
r43.description = isGuildNSFW2 ? intl.format(t["8tk6bB"], {}) : intl.format(t.XQZvwn, {});
r43.agreement = intl.string(t.Zt4Mf4);
r43.modalType = NsfwSpaceWarningModalType.NSFW_CHANNEL_AGE_VERIFY;
r117 = r43;
} else {
r43.description = isGuildNSFW2 ? intl.string(t.V6Gmu9) : intl.string(t["5rygLk"]);
r43.agreement = intl.string(t.FDSSia);
r43.modalType = NsfwSpaceWarningModalType.NSFW_CHANNEL_AGE_VERIFY;
r117 = r43;
}
r66 = r117;
} else if (stateFromStores) {
r43.title = intl.string(isGuildNSFW2 ? t["H0SG/g"] : t.NEabBa);
r43.description = intl.format(isGuildNSFW2 ? t["6++3cX"] : t["2kHZes"], {
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.NSFW_AGE_GATING)
});
r43.modalType = NsfwSpaceWarningModalType.NSFW_CHANNEL_UNDERAGE;
r66 = r43;
} else {
r43.title = title;
r43.description = intl.string(isGuildNSFW2 ? t.ZtuRts : t.E4Cd5I);
r43.agreement = intl.string(t.wVq7uo);
r43.modalType = NsfwSpaceWarningModalType.NSFW_CHANNEL_VERIFIED;
r66 = r43;
}
return r66;
}
export function useAgeGateVerifyContent(a0) {
let r49;
const isAgeVerified = useIsAgeVerified();
const isFeatureAgeGated = useIsFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES);
const shouldShowTiggerPawtect = useShouldShowTiggerPawtect();
const r28 = isFeatureAgeGated && shouldShowTiggerPawtect;
const r1 = a0 === AgeGateSource.NSFW_SERVER || a0 === AgeGateSource.NSFW_SERVER_INVITE || a0 === AgeGateSource.NSFW_SERVER_INVITE_EMBED;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser()?.nsfwAllowed === false);
if (a0 !== AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE && a0 !== AgeGateSource.ACCESS_LARGE_GUILD_UNDERAGE) {
L31: {
if (isAgeVerified) {
r49 = {
verifyAgreementButtonText: intl.string(t.Zt4Mf4),
verifyGateDescription: r1 ? intl.format(t["8tk6bB"], {}) : intl.format(t.XQZvwn, {}),
verifyTitle: r1 ? intl.string(t.xi46lg) : intl.string(t.ZmwvDc)
};
} else if (a0 === AgeGateSource.LARGE_GUILD) {
r49 = {
verifyTitle: intl.string(t["7ymzsL"]),
verifyGateDescription: intl.string(t.SxY4IW),
verifyAgreementButtonText: intl.string(t.FDSSia)
};
} else {
if (stateFromStores && r1 && !r28) {
r49 = {
verifyTitle: intl.string(t["H0SG/g"]),
verifyGateDescription: intl.format(t["6++3cX"], {
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.AGE_GATE)
}),
verifyAgreementButtonText: null
};
break L31;
}
r49 = {
verifyAgreementButtonText: intl.string(t.FDSSia),
verifyGateDescription: r1 ? intl.string(t.V6Gmu9) : intl.string(t["5rygLk"]),
verifyTitle: r1 ? intl.string(t.xi46lg) : intl.string(t.ZmwvDc)
};
}
}
return r49;
}
const r159 = a0 === AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE ? t["u/xsK9"] : t.MjQbfi;
const verifyGateDescription = isAgeVerified ? intl.string(t.SAoMVJ) : intl.string(t.SxY4IW);
const verifyAgreementButtonText = isAgeVerified ? intl.string(t.Zt4Mf4) : intl.string(t.FDSSia);
return {
verifyTitle: intl.string(r159),
verifyGateDescription,
verifyAgreementButtonText
};
}
export function shouldShowAgeGateForCurrentUser() {
const currentUser = UserStore.getCurrentUser();
if (currentUser == null) {
return false;
}
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
const r19 = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES) && shouldShowTiggerPawtect;
return currentUser.nsfwAllowed !== true || r19;
}
export function shouldShowAgeGateForGuildContentLevel(a0) {
const currentUser = UserStore.getCurrentUser();
const r0 = currentUser == null;
let r12 = false;
if (!r0) {
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
const r22 = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES) && shouldShowTiggerPawtect;
r12 = currentUser.nsfwAllowed !== true || r22;
}
if (r12 && a0 != null) {
const guild = GuildStore.getGuild(a0);
return guild != null && isGuildNSFW(guild);
}
return false;
}
export function shouldShowAgeGateForChannelId(a0) {
const currentUser = UserStore.getCurrentUser();
const r0 = currentUser == null;
let r11 = false;
if (!r0) {
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
const r21 = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES) && shouldShowTiggerPawtect;
r11 = currentUser.nsfwAllowed !== true || r21;
}
const r26 = r11 ? a0 == null : !r11;
return r26 ? !r26 : isChannelContentGated(ChannelStore.getChannel(a0));
}
export { shouldShowAgeGateForVoiceChannel };
export function maybeOpenAgeGateForVoiceChannel(a0) {
let r6 = !!shouldShowAgeGateForVoiceChannel(a0);
if (r6) {
openAgeGateModal(AgeGateSource.NSFW_VOICE_CHANNEL);
r6 = true;
}
return r6;
}
export function maybeShowAgeGate(a0, a1, a2) {
const currentUser = UserStore.getCurrentUser();
const r0 = currentUser == null;
let r5 = false;
if (!r0) {
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
const r23 = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES) && shouldShowTiggerPawtect;
r5 = currentUser.nsfwAllowed !== true || r23;
}
let r27 = false;
if (r5) {
const r29 = a0 == null;
r27 = false;
if (!r29) {
const guild = GuildStore.getGuild(a0);
r27 = guild != null && isGuildNSFW(guild);
}
}
let r36 = a2;
if (r27) {
if (!(a2 != null && c2633_12.has(a2))) {
r36 = AgeGateSource.NSFW_SERVER;
}
openAgeGateModal(r36);
} else {
const currentUser2 = UserStore.getCurrentUser();
let r39 = currentUser2 != null && currentUser2.nsfwAllowed == null;
if (r39) {
const currentUser3 = UserStore.getCurrentUser();
const r43 = currentUser3 == null;
let r6 = false;
if (!r43) {
const shouldShowTiggerPawtect2 = _AgeVerificationUtils.shouldShowTiggerPawtect();
const r58 = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.AGE_GATED_SPACES) && shouldShowTiggerPawtect2;
r6 = currentUser3.nsfwAllowed !== true || r58;
}
const r63 = r6 ? a1 == null : !r6;
r39 = r63 ? !r63 : isChannelContentGated(ChannelStore.getChannel(a1));
}
if (r39) {
openAgeGateModal(a2 == null ? AgeGateSource.NSFW_CHANNEL : a2);
}
}
}
export function isChannelOrGuildNSFW(a0) {
return a0 != null && (a0.isNSFW() || isGuildNSFW(GuildStore.getGuild(a0.guild_id)));
}
export function isChannelAgeVerificationGated(a0) {
if (a0 == null) {
return false;
}
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
return a0 != null && (a0.isNSFW() || isGuildNSFW(GuildStore.getGuild(a0.guild_id))) && shouldShowTiggerPawtect;
}
export function userCannotSeeNSFWContent(a0) {
if (a0 == null) {
return false;
}
const nsfwAllowed = UserStore.getCurrentUser()?.nsfwAllowed;
return a0 != null && (a0.isNSFW() || isGuildNSFW(GuildStore.getGuild(a0.guild_id))) && !(nsfwAllowed === true);
}
export { isChannelContentGated };
export { useIsChannelContentGated };
export function useShouldHideChannelContent(a0) {
const isChannelContentGated2 = useIsChannelContentGated(a0);
const isChannelSpoilerGated = useIsChannelSpoilerGated(a0);
return isChannelContentGated2 || isChannelSpoilerGated;
}
export function isCurrentUserMissingDateOfBirth() {
const currentUser = UserStore.getCurrentUser();
return currentUser != null && currentUser.nsfwAllowed == null;
}
export function shouldAgeVerifyForSettingsToggles() {
let r11 = _RegionalFeatureConfigUtils.isFeatureAgeGated(AgeGatedFeature.COMMANDS_TOGGLE);
const shouldShowTiggerPawtect = _AgeVerificationUtils.shouldShowTiggerPawtect();
if (r11) {
r11 = shouldShowTiggerPawtect;
}
return r11;
}
export function useShouldAgeVerifyForSettingsToggles() {
let r11 = useIsFeatureAgeGated(AgeGatedFeature.COMMANDS_TOGGLE);
const shouldShowTiggerPawtect = useShouldShowTiggerPawtect();
if (r11) {
r11 = shouldShowTiggerPawtect;
}
return r11;
}
@@ -0,0 +1,20 @@
// Metro module 1860 (f1861).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2025-09-server-nsfw-level",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export { apexExperiment as ServerNSFWLevelExperiment };
export function isServerNSFWLevelEnabled(a0) {
return apexExperiment.getConfig({
location: a0
}).enabled;
}
@@ -0,0 +1,40 @@
// Metro module 12628 (f12629).
import NavigationHistoryStore, { CHANNEL_PREFIX, GUILD_PREFIX, getIdFromHistoryItem } from "../main_tabs_v2/native/NavigationHistoryStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildChannelStore from "../../stores/GuildChannelStore";
import { ME } from "../../Constants";
import { isChannelContentGated } from "./AgeGateUtils";
import { isChannelSpoilerGated } from "../spoiler_channels/SpoilerChannelUtils";
export default function getPreviousSafeRouteForNsfwReturn() {
const history2 = NavigationHistoryStore.getState().history;
let r0 = history2.length - 2;
while (0 <= r0) {
const r11 = history2[r0];
const idFromHistoryItem = getIdFromHistoryItem(r11);
const r20 = r11.startsWith(CHANNEL_PREFIX);
const r1 = r0;
if (r20) {
const channel = ChannelStore.getChannel(idFromHistoryItem);
if (channel != null && !isChannelContentGated(channel) && !isChannelSpoilerGated(channel)) {
let guild_id = channel.guild_id;
if (guild_id == null) {
guild_id = ME;
}
return {
guildId: guild_id,
channelId: idFromHistoryItem
};
}
} else if (r11.startsWith(GUILD_PREFIX)) {
const defaultChannel = GuildChannelStore.getDefaultChannel(idFromHistoryItem);
if (defaultChannel != null && !isChannelContentGated(defaultChannel) && !isChannelSpoilerGated(defaultChannel)) {
return {
guildId: idFromHistoryItem,
channelId: defaultChannel.id
};
}
}
r0 = r1 - 1;
}
return null;
};
@@ -0,0 +1,54 @@
// Metro module 16123 (f16124).
import ChannelStore from "../../../stores/ChannelStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import SelectedGuildStore from "../../../stores/SelectedGuildStore";
import { AgeGateSource, EXISTING_USER_AGE_GATE_MODAL_KEY } from "../AgeGateConstants";
import { ChannelTypes, GuildNSFWContentLevel } from "../../../Constants";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import { maybeShowAgeGate } from "../AgeGateUtils";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { ModalAnimation } from "../../../ConstantsIOS";
class AgeGateManager extends AutomaticLifecycleManager {
actions = {
POST_CONNECTION_OPEN: this.handlePostConnectionOpen,
CHANNEL_SELECT: this.handleChannelSelect,
AGE_GATE_MODAL_OPEN: this.handleAgeGateModalOpen,
AGE_GATE_MODAL_CLOSE: this.handleAgeGateModalClose,
GUILD_UPDATE: this.handleGuildUpdate
};
handlePostConnectionOpen() {
maybeShowAgeGate(SelectedGuildStore.getGuildId(), SelectedChannelStore.getChannelId());
}
handleChannelSelect({ guildId, channelId }) {
const channel = ChannelStore.getChannel(channelId);
if (guildId != null && channel?.type !== ChannelTypes.GUILD_VOICE) {
maybeShowAgeGate(guildId, channelId);
}
}
handleAgeGateModalOpen({ source }) {
ModalActionCreators.pushLazy(async () => {
let c28229_1;
c28229_1 = void 0;
let c30954_0 = (await import("./components/ExistingUserAgeGateModal")).default;
if (source === AgeGateSource.AUTH) {
c30954_0.modalConfig = {
animation: ModalAnimation.SLIDE_IN_OUT
};
}
return c30954_0;
}, {
source
}, EXISTING_USER_AGE_GATE_MODAL_KEY);
}
handleAgeGateModalClose() {
ModalActionCreators.popWithKey(EXISTING_USER_AGE_GATE_MODAL_KEY);
}
handleGuildUpdate({ guild }) {
const guildId = SelectedGuildStore.getGuildId();
if (guildId != null && guild.id === guildId && guild.owner_configured_content_level === GuildNSFWContentLevel.AGE_RESTRICTED) {
maybeShowAgeGate(guild.id, null);
}
}
}
const ageGateManager = new AgeGateManager();
export default ageGateManager;
+53
View File
@@ -0,0 +1,53 @@
// Metro module 9358 (f9359).
import GuildStore from "../../../stores/GuildStore";
import PermissionStore from "../../../stores/PermissionStore";
import UserStore from "../../../stores/UserStore";
import { GuildNSFWContentLevel, Permissions } from "../../../Constants";
import { isIOS } from "../../../utils/PlatformUtils";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { getViewNsfwGuildsOrDefault } from "../../user_settings/content_and_social/AgeRestrictedContentSettingsUtils";
let c6168_8 = new Set([GuildNSFWContentLevel.EXPLICIT, GuildNSFWContentLevel.AGE_RESTRICTED]);
export function isNSFWInvite(a0) {
let r3 = a0 == null ? void 0 : a0.guild?.nsfw_level;
if (r3 == null) {
r3 = GuildNSFWContentLevel.DEFAULT;
}
return c6168_8.has(r3);
}
export function handleNSFWGuildInvite(a0) {
if (isIOS()) {
let r17 = a0 == null ? void 0 : a0.guild?.nsfw_level;
if (r17 == null) {
r17 = GuildNSFWContentLevel.DEFAULT;
}
const r20 = c6168_8.has(r17);
const r27 = GuildStore.getGuild(a0 == null ? void 0 : a0.guild?.id) != null;
const r1 = r20 ? r27 : !r20;
let r28 = !r1;
if (!r1) {
ModalActionCreators.pushLazy(import("./components/NsfwGateGuild"), {
guildId: a0 == null ? void 0 : a0.guild?.id
});
r28 = true;
}
return r28;
}
return false;
}
export function shouldNSFWGateGuild(a0) {
if (isIOS()) {
const guild = GuildStore.getGuild(a0);
const currentUser = UserStore.getCurrentUser();
if (guild != null && currentUser != null) {
const r24 = PermissionStore.can(Permissions.ADMINISTRATOR, guild) || PermissionStore.can(Permissions.MANAGE_GUILD, guild) || PermissionStore.can(Permissions.KICK_MEMBERS, guild) || PermissionStore.can(Permissions.BAN_MEMBERS, guild);
const nsfwLevel = guild.nsfwLevel;
const AGE_RESTRICTED = GuildNSFWContentLevel.AGE_RESTRICTED;
const nsfwLevel2 = guild.nsfwLevel;
const EXPLICIT = GuildNSFWContentLevel.EXPLICIT;
const r35 = currentUser.nsfwAllowed && getViewNsfwGuildsOrDefault();
return r24 ? !r24 : !!(nsfwLevel2 === EXPLICIT) || nsfwLevel === AGE_RESTRICTED && !r35;
}
return false;
}
return false;
}
@@ -0,0 +1,10 @@
// Metro module 16125 (f16126).
const r8 = {
AgeGate: "AgeGate",
AgeGateConfirm: "AgeGateConfirm",
Blocked: "Blocked",
NSFWBlocked: "NSFWBlocked",
NSFWGateGuild: "NSFWGateGuild",
Pawtect: "Pawtect"
};
export { r8 as ExistingUserAgeGateScreens };
@@ -0,0 +1,93 @@
// Metro module 14900 (f14901).
import { useLayoutEffect } from "react";
import { View } from "react-native";
import { HelpdeskArticles } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useWideAuthView from "../../../auth/native/useWideAuthView";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { getHeaderBackButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import { useNavigatorBackPressHandler } from "../../../../design/components/Navigator/native/useNavigatorBackPressHandler.native";
import { intl, t } from "../../../../intl/index.native";
import BackgroundImage from "../../../auth/native/components/atoms/BackgroundImage";
import AuthNavbarPlaceholder from "../../../auth/native/components/atoms/AuthNavbarPlaceholder";
import { ShieldSpotIllustration } from "../../../../design/assets/native";
import AuthHeader from "../../../auth/native/components/atoms/AuthHeader";
import { Text } from "../../../../design/components/Text/native/Text";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles((a0) => ({
container: {
alignItems: "center",
justifyContent: "center",
flex: 1,
padding: 16,
paddingTop: 0,
paddingBottom: a0 ? 80 : 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
header: {
marginTop: 16
},
body: {
marginTop: 8,
lineHeight: 20,
textAlign: "center"
},
buttonWrapper: {
width: "100%",
marginTop: 24
}
}));
export default function AgeGateUnderage(props) {
let r96;
const onClose = props.onClose;
let underageMessage = props.underageMessage;
let existingUser = props.existingUser;
if (existingUser === void 0) {
existingUser = false;
}
let c21441_1 = existingUser;
const { fromRegister = false, disableSwipe = false } = props;
let c21441_2 = disableSwipe;
const wideAuthView = useWideAuthView();
const styles = useStyles(wideAuthView);
const navigation = useNavigation();
useLayoutEffect(() => {
navigation.setOptions({
headerLeft: c21441_1 ? () => null : getHeaderBackButton(onClose),
gestureEnabled: !c21441_2
});
}, [onClose, existingUser, navigation, disableSwipe]);
useNavigatorBackPressHandler(() => {
onClose();
return true;
});
const r56 = [wideAuthView ? null : <BackgroundImage />, <AuthNavbarPlaceholder />, <ShieldSpotIllustration />, <AuthHeader style={styles.header}>
{existingUser ? intl.string(t["NR/zrG"]) : intl.string(t.nCB6Ga)}
</AuthHeader>, , ,];
if (fromRegister) {
r96 = intl.string(t.GDQgHL);
} else {
const b0QzXe = t.b0QzXe;
if (underageMessage == null) {
underageMessage = intl.string(t.WqEH4D);
}
r96 = intl.format(b0QzXe, {
underageMessage,
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.AGE_GATE)
});
}
r56[4] = <Text style={styles.body} variant="text-md/medium" color="interactive-text-default">{r96}</Text>;
r56[5] = existingUser ? <>
<Text style={styles.body} variant="text-md/medium" color="interactive-text-default">
{intl.format(t["3axQdB"], {
days: 30
})}
</Text>
<View style={styles.buttonWrapper}>
<Button onPress={onClose} text={intl.string(t.JhDw5o)} grow />
</View>
</> : null;
return <View style={styles.container}>{r56}</View>;
};
@@ -0,0 +1,49 @@
// Metro module 16130 (f16131).
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useAgeGateVerifyContent } from "../../AgeGateUtils";
import { useMaybePerformReactiveCheckForSource } from "../../../age_assurance/AgeVerificationUtils";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { ShieldSpotIllustration } from "../../../../design/assets/native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import AgeVerificationActionCreators_native from "../../../age_assurance/AgeVerificationActionCreators.native";
import { AgeVerificationModalEntryPoint } from "../../../age_assurance/AgeVerificationAnalyticsUtils";
const useStyles = createStyles({
container: {
padding: Module712.space.PX_16,
flex: 1,
alignItems: "center",
justifyContent: "center",
gap: Module712.space.PX_16
},
header: {
textAlign: "center"
},
body: {
textAlign: "center"
},
buttonWrapper: {
width: "100%"
}
});
export default function AgeGateVerify(props) {
const source = props.source;
const styles = useStyles();
const ageGateVerifyContent = useAgeGateVerifyContent(source);
const { verifyAgreementButtonText, verifyGateDescription, verifyTitle } = ageGateVerifyContent;
useMaybePerformReactiveCheckForSource(source);
return <SafeAreaPaddingView top style={styles.container}>
<ShieldSpotIllustration />
<Text style={styles.header} variant="heading-xl/extrabold" color="mobile-text-heading-primary">{verifyTitle}</Text>
<Text style={styles.body} variant="text-md/medium" color="interactive-text-default">{verifyGateDescription}</Text>
{verifyAgreementButtonText != null && <View style={styles.buttonWrapper}>
<Button text={verifyAgreementButtonText} onPress={function onPress() {
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
entryPoint: AgeVerificationModalEntryPoint.NSFW_AGE_GATE
});
}} grow />
</View>}
</SafeAreaPaddingView>;
};
@@ -0,0 +1,8 @@
// Metro module 9360 (f9361).
const r9 = {
MODAL: 0,
0: "MODAL",
GUILD_SIDEBAR: 1,
1: "GUILD_SIDEBAR"
};
export { r9 as NsfwGateSource };
@@ -0,0 +1,57 @@
// Metro module 16128 (f16129).
import { forwardRef, useRef, useImperativeHandle } from "react";
import { Keyboard } from "react-native";
import Module3771 from "../../../../_bundle/Module3771";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import FreeFormInputGroup from "../../../../design/void/Form/native/FreeFormInputGroup";
import { ClearButtonVisibility } from "../../../../design/void/native";
const r23 = forwardRef(function({ date, onChangeDate, label, style, error }, a1) {
let ref, openDatePicker2;
ref = void 0;
const updateDate2 = function updateDate(a0) {
onChangeDate(a0);
const current = ref.current;
if (current != null) {
current.blur();
}
};
openDatePicker2 = function openDatePicker() {
Keyboard.dismiss();
const r21 = import("../../../../components_native/DatePickerActionSheet");
let startDate = date == null ? void 0 : date.toDate();
if (startDate == null) {
const r29 = Module3771();
r29.set("year", r29.year() - 10);
startDate = r29.toDate();
}
const r38 = Module3771();
r38.set("year", r38.year() - 3);
const r24 = {
onSubmit: updateDate2,
title: label,
startDate,
maximumDate: r38.toDate(),
minimumDate: null,
requireDateChanged: true
};
const r50 = Module3771();
r50.set("year", r50.year() - 100);
r24.minimumDate = r50.toDate();
ActionSheetActionCreators.openLazy(r21, "DatePicker", r24);
};
ref = useRef(null);
useImperativeHandle(a1, () => ({
focus: () => {
openDatePicker2();
}
}));
let r23 = date == null ? void 0 : date.format("L");
if (r23 == null) {
r23 = void 0;
}
const r31 = Module3771();
r31.set("year", r31.year() - 10);
const placeholder = Module3771(r31.toDate()).format("L");
return <FreeFormInputGroup style={style} ref={ref} value={r23 == null ? "" : r23} placeholder={placeholder} returnKeyType="next" textContentType="none" autoCapitalize="none" clearButtonVisibility={ClearButtonVisibility.NEVER} editable={false} forceAccessibleContainer accessibilityLabel={`${label}, ${r23 ?? placeholder}`} onPress={openDatePicker2} label={label} error={error} />;
});
export default r23;
@@ -0,0 +1,218 @@
// Metro module 16127 (f16128).
import { useState, useRef, useEffect } from "react";
import { View } from "react-native";
import UserRequiredActionStore from "../../../../stores/UserRequiredActionStore";
import UserStore from "../../../../stores/UserStore";
import { AgeGateAnalyticAction, AgeGateSource } from "../../AgeGateConstants";
import { ExistingUserAgeGateScreens } from "../ExistingUserAgeGateConstants";
import { AnalyticEvents, HelpdeskArticles } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { intl, t } from "../../../../intl/index.native";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
import Module38 from "../../../../_bundle/Module38";
import { submitDateOfBirth } from "../../AgeGateActionCreators";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import Module3771 from "../../../../_bundle/Module3771";
import isDateValidDateOfBirth from "../../../auth/native/experiment/isDateValidDateOfBirth";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { Text } from "../../../../design/components/Text/native/Text";
import DateInput from "./DateInput";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
flex: 1,
padding: 16,
alignItems: "center",
justifyContent: "center"
},
header: {
marginBottom: 8,
textAlign: "center"
},
body: {
textAlign: "center",
lineHeight: 20,
marginBottom: 16
},
inputGroup: {
marginBottom: 16,
width: "100%"
},
buttonWrapper: {
width: "100%"
}
});
export default function ExistingUserAgeGate(props) {
let r4, state2, r91, loading, onChangeDate, ref;
let navigation, stateFromStores, c22808_5, state, setState, setState2, stateFromStores2, _submitBirthday2, _submitBirthdayWithAgeConfirmation2;
const { onSuccess, onClose, source } = props;
navigation = void 0;
stateFromStores = void 0;
c22808_5 = void 0;
state = void 0;
setState = void 0;
setState2 = void 0;
stateFromStores2 = void 0;
const submitBirthday2 = function submitBirthday(a0) {
return _submitBirthday2.apply(this, arguments);
};
_submitBirthday2 = function _submitBirthday() {
const r9 = async (c30955_0) => {
let r71;
let c30955_3;
let c30955_4 = 0;
let c31788_0, c31788_1;
L10: {
try {
c31788_0 = void 0;
Module38(c30955_0 != null, "Cannot submit null birthday.");
c31788_0 = false;
c30955_4 = 1;
setState(null);
setState2(true);
await submitDateOfBirth(c30955_0, source);
c30955_4 = 0;
r71 = {
shouldShowError: c31788_0
};
} catch ($e) {
const r31 = $e;
let r7 = r31;
c30955_3 = r31;
if (c30955_4 !== 0) {
while (true) {
try {
const r79 = c30955_3;
c30955_4 = 0;
c31788_1 = r79;
if (c31788_1.body != null && c31788_1.body.date_of_birth != null) {
navigation.push(ExistingUserAgeGateScreens.Blocked, {
onClose: ModalActionCreators.pop,
underageMessage: c31788_1.body.date_of_birth,
existingUser: true
});
} else {
const r86 = c31788_1;
setState((r86 == null ? void 0 : r86.body?.username) != null ? intl.string(t["TGg/2k"]) : c31788_1.message);
(0, setState2)(false);
c31788_0 = true;
}
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source,
action: AgeGateAnalyticAction.AGE_GATE_FAILURE
});
r71 = {
shouldShowError: c31788_0
};
break L10;
} catch (r76) {
r7 = r76;
c30955_3 = r76;
if (c30955_4 === 0) {
break;
}
}
}
}
throw r7;
}
}
return r71;
};
_submitBirthday2 = r9;
return r9.apply(this, arguments);
};
_submitBirthdayWithAgeConfirmation2 = function _submitBirthdayWithAgeConfirmation() {
const r9 = async () => {
L12: {
Module38(state != null, "Cannot submit null birthday.");
const age = Module3771().diff(state, "years");
if (age < 18) {
navigation.push(ExistingUserAgeGateScreens.AgeGateConfirm, {
source,
onConfirm: () => submitBirthday2(state),
age
});
break L12;
}
await submitBirthday2(state);
return void 0;
}
};
_submitBirthdayWithAgeConfirmation2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
navigation = useNavigation();
stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const { NSFW_CHANNEL, NSFW_VOICE_CHANNEL, FAMILY_CENTER } = AgeGateSource;
const r2 = source === AgeGateSource.NSFW_SERVER || source === AgeGateSource.NSFW_SERVER_INVITE || source === AgeGateSource.NSFW_SERVER_INVITE_EMBED;
L12: {
r4 = source === FAMILY_CENTER;
c22808_5 = r2;
[state, onChangeDate] = useState(null);
let state2;
[state2, setState] = useState(null);
[loading, setState2] = useState(false);
ref = useRef(null);
stateFromStores2 = useStateFromStores([UserRequiredActionStore], () => UserRequiredActionStore.getAction());
useEffect(() => {
if (stateFromStores2 != null && onClose != null) {
onClose();
}
}, [stateFromStores2, onClose]);
useEffect(() => {
if (stateFromStores?.nsfwAllowed === false && c22808_5) {
navigation.push(ExistingUserAgeGateScreens.Pawtect);
} else if (stateFromStores?.nsfwAllowed != null) {
onSuccess();
}
}, [stateFromStores, onSuccess, r2, navigation]);
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source,
action: AgeGateAnalyticAction.AGE_GATE_OPEN
});
}, [source]);
if (source !== NSFW_CHANNEL && (source !== NSFW_VOICE_CHANNEL && !r2)) {
if (r4) {
r91 = intl.string(t.mhUrKS);
break L12;
}
r91 = intl.format(t.EcJBEI, {
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.AGE_GATE)
});
} else {
r91 = intl.format(t.n3QjDE, {
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.AGE_GATE)
});
}
}
const r121 = r2 ? intl.string(t["H0SG/g"]) : r4 ? intl.string(t.M7mt7m) : intl.string(t.F8otRo);
const isDateValidDateOfBirth2 = isDateValidDateOfBirth(state);
const r128 = !isDateValidDateOfBirth2;
const error = isDateValidDateOfBirth2 ? state2 : state != null ? intl.string(t.udnqh6) : state2;
const r151 = [<Text style={styles.header} variant="heading-xl/extrabold" color="mobile-text-heading-primary">{r121}</Text>, <Text style={styles.body} variant="text-md/medium" color="interactive-text-default">{r91}</Text>, <DateInput style={styles.inputGroup} ref={ref} label={intl.string(t.xNpFJ6)} date={state} onChangeDate={onChangeDate} error={error} />, ,];
const props2 = {
loading,
disabled: null,
text: null,
onPress: null,
grow: true
};
if (!loading) {
loading = r128;
}
props2.disabled = loading;
props2.text = intl.string(t.PDTjLN);
props2.onPress = function submitBirthdayWithAgeConfirmation() {
return _submitBirthdayWithAgeConfirmation2.apply(this, arguments);
};
r151[3] = <View style={styles.buttonWrapper}>
<Button {...props2} />
</View>;
return <SafeAreaPaddingView top style={styles.container}>{r151}</SafeAreaPaddingView>;
};
@@ -0,0 +1,94 @@
// Metro module 16129 (f16130).
import { useState } from "react";
import { View } from "react-native";
import { HelpdeskArticles } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
padding: 16,
flex: 1,
alignItems: "center",
justifyContent: "center"
},
header: {
textAlign: "center",
marginBottom: 8
},
body: {
textAlign: "center",
lineHeight: 20,
marginBottom: 16
},
buttonWrapper: {
width: "100%"
}
});
export default function ExistingUserAgeGateConfirm(props) {
let navigation, setState;
const { age, onConfirm } = props;
navigation = void 0;
setState = void 0;
let _handleConfirm2 = function _handleConfirm() {
const r9 = async () => {
let c30957_3 = 0;
L12: {
try {
setState(true);
c30957_3 = 1;
if ((await onConfirm()).shouldShowError) {
navigation.pop();
}
c30957_3 = 0;
(0, setState)(false);
} catch ($e) {
let r7 = $e;
if (c30957_3 !== 0) {
while (true) {
try {
c30957_3 = 0;
navigation.pop();
(0, setState)(false);
break L12;
} catch ($e) {
r7 = $e;
if (c30957_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
_handleConfirm2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
navigation = useNavigation();
let loading;
[loading, setState] = useState(false);
return <SafeAreaPaddingView top style={styles.container}>
<Text style={styles.header} variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.format(t.wumolR, {
age
})}
</Text>
<Text style={styles.body} variant="text-md/medium" color="interactive-text-default">
{intl.format(t.n3QjDE, {
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.AGE_GATE)
})}
</Text>
<View style={styles.buttonWrapper}>
<Button loading={loading} disabled={loading} text={intl.string(t["6tahin"])} onPress={function handleConfirm() {
return _handleConfirm2.apply(this, arguments);
}} grow />
</View>
</SafeAreaPaddingView>;
};
@@ -0,0 +1,149 @@
// Metro module 16124 (f16125).
import { useRef, useCallback, useMemo } from "react";
import SelectedGuildStore from "../../../../stores/SelectedGuildStore";
import { AgeGateAnalyticAction, AgeGateSource } from "../../AgeGateConstants";
import { ExistingUserAgeGateScreens } from "../ExistingUserAgeGateConstants";
import { AnalyticEvents } from "../../../../Constants";
import { isIOS } from "../../../../utils/PlatformUtils";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import Module16126 from "../../../../_bundle/Module16126";
import { intl, t } from "../../../../intl/index.native";
import { closeAgeGateModal } from "../../AgeGateModalActionCreators";
import GuildActionCreators from "../../../../actions/GuildActionCreators";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { ImpressionNames } from "../../../../_bundle/Module503";
import { getHeaderBackButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import ExistingUserAgeGate from "./ExistingUserAgeGate";
import ExistingUserAgeGateConfirm from "./ExistingUserAgeGateConfirm";
import AgeGateVerify from "./AgeGateVerify";
import AgeGateUnderage from "./AgeGateUnderage";
import NsfwGateGuild from "./NsfwGateGuild";
import { useShouldAgeVerifyForAgeGate } from "../../AgeGateUtils";
import { useWatchAgeVerificationStatusChange } from "../../../age_assurance/AgeVerificationUtils";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
let renderHeaderTitle;
const onClose = function onClose() {
closeAgeGateModal();
};
renderHeaderTitle = function renderHeaderTitle() {
return null;
};
export default function ExistingUserAgeGateModal(props) {
const source = props.source;
const shouldAgeVerifyForAgeGate = useShouldAgeVerifyForAgeGate();
const ref = useRef(shouldAgeVerifyForAgeGate);
useWatchAgeVerificationStatusChange(useCallback(() => {
if (ref.current) {
closeAgeGateModal(source);
}
}, [source]));
return <Navigator screens={useMemo(() => {
let r7;
let source2;
let source3;
L14: {
source2 = source;
source3 = source;
if (AgeGateSource.NSFW_SERVER_INVITE !== source && AgeGateSource.NSFW_SERVER_INVITE_EMBED !== source) {
if (AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE !== source && AgeGateSource.ACCESS_LARGE_GUILD_UNDERAGE !== source && AgeGateSource.LARGE_GUILD !== source && AgeGateSource.NSFW_SERVER !== source) {
if (AgeGateSource.NSFW_CHANNEL === source) {
r7 = () => {
const guildId = SelectedGuildStore.getGuildId();
if (guildId != null) {
GuildActionCreators.nsfwReturnToSafety(guildId);
}
closeAgeGateModal(source3);
};
break L14;
}
if (AgeGateSource.NSFW_VOICE_CHANNEL === source) {
r7 = () => {
ModalActionCreators.popAll();
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
source: source3,
action: AgeGateAnalyticAction.AGE_GATE_CLOSE
});
};
break L14;
}
const FAMILY_CENTER = AgeGateSource.FAMILY_CENTER;
r7 = void 0;
if (FAMILY_CENTER !== source) {
break L14;
}
r7 = () => {
closeAgeGateModal(source3);
};
break L14;
}
r7 = () => {
const guildId = SelectedGuildStore.getGuildId();
if (guildId != null) {
GuildActionCreators.nsfwReturnToSafety(guildId);
}
closeAgeGateModal(source3);
ModalActionCreators.popAll();
};
} else {
r7 = () => {
closeAgeGateModal(source3);
};
}
}
if (r7 == null) {
r7 = () => {};
}
const r23 = {};
r23[ExistingUserAgeGateScreens.AgeGate] = {
fullscreen: true,
impressionName: ImpressionNames.USER_AGE_GATE,
impressionProperties: {
existing_user: true
},
headerLeft: getHeaderBackButton(r7),
headerTitle: renderHeaderTitle,
render: (a0, c28230_0) => <ExistingUserAgeGate onSuccess={source2 === AgeGateSource.NSFW_SERVER_INVITE && isIOS() ? () => {
c28230_0.push(ExistingUserAgeGateScreens.NSFWGateGuild);
ToastActionCreators.open({
key: "AGE_GATE_AGE_VERIFIED",
icon: Module16126,
content: intl.string(t.gUiIGZ)
});
} : () => {
closeAgeGateModal();
ToastActionCreators.open({
key: "AGE_GATE_AGE_VERIFIED",
icon: Module16126,
content: intl.string(t.gUiIGZ)
});
}} onClose={onClose} source={source2} />
};
r23[ExistingUserAgeGateScreens.AgeGateConfirm] = {
fullscreen: true,
headerTitle: renderHeaderTitle,
render: (a0) => <ExistingUserAgeGateConfirm {...a0} source={source2} />
};
r23[ExistingUserAgeGateScreens.Pawtect] = {
fullscreen: true,
headerLeft: getHeaderBackButton(r7),
impressionName: ImpressionNames.USER_AGE_GATE_VERIFY,
headerTitle: renderHeaderTitle,
render: () => <AgeGateVerify source={source2} />
};
r23[ExistingUserAgeGateScreens.Blocked] = {
fullscreen: true,
headerTitle: renderHeaderTitle,
impressionProperties: {
existing_user: true
},
render: (a0) => <AgeGateUnderage {...a0} />
};
r23[ExistingUserAgeGateScreens.NSFWGateGuild] = {
headerTitle: renderHeaderTitle,
headerLeft: getHeaderBackButton(r7),
render: () => <NsfwGateGuild onClose={onClose} />
};
return r23;
}, [source])} initialRouteName={shouldAgeVerifyForAgeGate ? ExistingUserAgeGateScreens.Pawtect : ExistingUserAgeGateScreens.AgeGate} headerBackTitle={intl.string(t["13/7kX"])} />;
};
@@ -0,0 +1,35 @@
// Metro module 11757 (f11758).
import { Image as Image2, View, StyleSheet } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import Module11758 from "../../../../_bundle/Module11758";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
alignItems: "center",
justifyContent: "center"
},
border: {
height: StyleSheet.hairlineWidth,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
description: {
marginTop: 16,
textAlign: "center"
}
});
export default function NsfwGateChat() {
const styles = useStyles();
return <>
<View style={styles.border} />
<View style={styles.container}>
<Image2 source={Module11758} />
<Text style={styles.description} variant="text-md/medium" color="text-muted">
{intl.string(t.W4Qyxr)}
</Text>
</View>
</>;
};
@@ -0,0 +1,64 @@
// Metro module 9359 (f9360).
import { useEffect } from "react";
import { Image as Image2, View } from "react-native";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import UserStore from "../../../../stores/UserStore";
import { NsfwGateSource } from "./Constants";
import { AnalyticEvents, HelpdeskArticles } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { getViewNsfwGuildsOrDefault } from "../../../user_settings/content_and_social/AgeRestrictedContentSettingsUtils";
import BackgroundImage from "../../../auth/native/components/atoms/BackgroundImage";
import Module9361 from "../../../../_bundle/Module9361";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
padding: 16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
header: {
textAlign: "center",
marginBottom: 8
},
description: {
textAlign: "center",
marginBottom: 16
},
image: {
marginBottom: 16
}
});
export default function NsfwGateGuild(props) {
const { onClose, guildId } = props;
const styles = useStyles();
const r14 = intl.string(t.vAymlG);
const r13 = intl.string(t.Crj6eC);
const r44 = intl.format(t.Z12LNW, {
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.NSFW_GUILD_GUIDELINES)
});
const currentUser = UserStore.getCurrentUser();
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.GUILD_NSFW_GATE_VIEWED, {
guild_id: guildId,
user_id: currentUser?.id,
is_member: GuildMemberStore.isMember(guildId, currentUser?.id),
is_user_opted_in_to_age_restricted_servers: currentUser?.nsfwAllowed && getViewNsfwGuildsOrDefault(),
source: NsfwGateSource.MODAL
});
}, [guildId, currentUser]);
return <View style={styles.container}>
<BackgroundImage />
<Image2 source={Module9361} style={styles.image} />
<Text style={styles.header} variant="heading-xl/extrabold" color="mobile-text-heading-primary">{r14}</Text>
<Text style={styles.description} variant="text-md/normal" color="text-default">{r13}</Text>
<Text style={styles.description} variant="text-md/normal" color="text-default">{r44}</Text>
<Button onPress={onClose} size="md" text={intl.string(t.gRqiWV)} />
</View>;
};
@@ -0,0 +1,26 @@
// Metro module 13046 (f13047).
import { useMessageRequestPrivacyOption } from "../../../message_request/native/hooks/useMessageRequestPrivacyOption";
import { ActionSheet } from "../../../../design/components/Sheet/native/ActionSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { ActionSheetRow } from "../../../../design/components/Sheet/native/ActionSheetRow.native";
import { intl, t } from "../../../../intl/index.native";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import NotificationSettingsModalActionCreators from "../../../../actions/NotificationSettingsModalActionCreators";
import { RestrictedGuildPrivacyOption, handleLeaveServer } from "../../../guild_action_sheet/native/components/GuildActionSheetActions";
export default function NsfwGateGuildSettingsActionSheet(props) {
const guild = props.guild;
const messageRequestPrivacyOption = useMessageRequestPrivacyOption({
guild
});
return <ActionSheet header={<BottomSheetTitleHeader title={guild.name} />}>
<ActionSheetRow.Group hasIcons={false}>
<ActionSheetRow label={intl.string(t.h850Ss)} onPress={() => {
ActionSheetActionCreators.hideActionSheet();
NotificationSettingsModalActionCreators.open(guild.id);
}} />
<RestrictedGuildPrivacyOption guild={guild} />
{messageRequestPrivacyOption}
<ActionSheetRow variant="danger" label={intl.string(t.J2TBi3)} onPress={() => handleLeaveServer(guild)} />
</ActionSheetRow.Group>
</ActionSheet>;
};
@@ -0,0 +1,56 @@
// Metro module 15238 (f15239).
import { useEffect } from "react";
import { View } from "react-native";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildStore from "../../../../stores/GuildStore";
import UserStore from "../../../../stores/UserStore";
import { NsfwGateSource } from "./Constants";
import { AnalyticEvents, Fonts, HelpdeskArticles } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { getViewNsfwGuildsOrDefault } from "../../../user_settings/content_and_social/AgeRestrictedContentSettingsUtils";
import ChannelListStickyHeader from "../../../channel_list_v2/native/components/ChannelListStickyHeader";
import { RefreshEmptyState } from "../../../../design/void/native";
import TextStyles from "../../../rebrand/native/TextStyles";
import Module15239 from "../../../../_bundle/Module15239";
import { intl, t } from "../../../../intl/index.native";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.PANEL_BG
},
emptyStateContainer: {
flex: 1
},
emptyStateImageContainer: {
marginBottom: 16
}
});
export default function NsfwGateGuildSidebar(props) {
let currentUser;
const { style, guildId } = props;
currentUser = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
currentUser = UserStore.getCurrentUser();
useEffect(() => {
if (currentUser != null && stateFromStores != null) {
AnalyticsUtils.track(AnalyticEvents.GUILD_NSFW_GATE_VIEWED, {
guild_id: guildId,
user_id: currentUser.id,
is_member: GuildMemberStore.isMember(guildId, currentUser.id),
is_user_opted_in_to_age_restricted_servers: currentUser.nsfwAllowed && getViewNsfwGuildsOrDefault(),
source: NsfwGateSource.GUILD_SIDEBAR
});
}
}, [guildId, stateFromStores, currentUser]);
return stateFromStores != null ? <View style={[styles.container, style]}>
<ChannelListStickyHeader guild={stateFromStores} showExtraButtons={false} />
<RefreshEmptyState imageStyle={styles.emptyStateImageContainer} titleStyle={TextStyles(Fonts.DISPLAY_EXTRABOLD, void 0, 16)} containerStyle={styles.emptyStateContainer} source={Module15239} title={intl.string(t.bAVpRR)} body={intl.format(t.NQuXf0, {
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.NSFW_GUILD_GUIDELINES)
})} />
</View> : null;
};
+17
View File
@@ -0,0 +1,17 @@
// Metro module 9132 (f9133).
import GuildNSFWAgreeStore from "../../stores/GuildNSFWAgreeStore";
import UserStore from "../../stores/UserStore";
import { useStateFromStores } from "../../_bundle/Module589";
export default function useIsNsfwGated(a0) {
let nsfw = a0.nsfw;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser()?.nsfwAllowed);
const stateFromStores2 = useStateFromStores([GuildNSFWAgreeStore], () => GuildNSFWAgreeStore.didAgree(a0.guild_id));
let r22 = !stateFromStores2;
if (nsfw) {
if (stateFromStores2) {
r22 = stateFromStores === false;
}
nsfw = r22;
}
return nsfw;
};