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

+14
View File
@@ -0,0 +1,14 @@
// Metro module 11821 (f11822).
const r8 = {
STUDENT_PROMPT: "STUDENT_PROMPT",
VERIFY_EMAIL: "VERIFY_EMAIL",
VERIFY_PIN: "VERIFY_PIN",
SELECT_SCHOOL: "SELECT_SCHOOL",
SELECT_SCHOOL_SEARCH: "SELECT_SCHOOL_SEARCH",
SUBMIT_SCHOOL: "SUBMIT_SCHOOL",
EMAIL_CONFIRMATION: "EMAIL_CONFIRMATION",
EMAIL_WAITLIST: "EMAIL_WAITLIST"
};
export { r8 as HubEmailConnectionSteps };
export const INVITE_ROUTING_HUB_GUILD_ID = "884924873015689226";
export const HUBS_IN_ONBOARDING_COUNTRIES = ["US", "CA", "PH", "GB", "MX", "ES", "JP", "BR", "FR", "DE", "AU", "IT", "PL"];
+32
View File
@@ -0,0 +1,32 @@
// Metro module 11842 (f11843).
import GuildStore from "../../stores/GuildStore";
import { GuildFeatures } from "../../Constants";
import LifecycleManager from "../../lib/LifecycleManager";
import Dispatcher from "../../Dispatcher";
import { transitionToGuild } from "../routing/transitionToGuild.native";
class HubJoinManager extends LifecycleManager {
handleGuildCreate = (a0) => {
const guild = GuildStore.getGuild(a0.guild.id);
let r12 = guild != null;
if (r12) {
const features = guild.features;
r12 = features == null ? void 0 : features.has(GuildFeatures.HUB);
}
if (r12) {
const onClose = this.onClose;
if (onClose != null) {
onClose.call(this);
}
transitionToGuild(guild.id);
}
};
_initialize(a0) {
this.onClose = a0;
Dispatcher.subscribe("GUILD_CREATE", this.handleGuildCreate);
}
_terminate() {
Dispatcher.unsubscribe("GUILD_CREATE", this.handleGuildCreate);
}
}
const hubJoinManager = new HubJoinManager();
export default hubJoinManager;
+60
View File
@@ -0,0 +1,60 @@
// Metro module 10095 (f10096).
import GuildStore from "../../stores/GuildStore";
import { HUB_PROGRESS_STEP_ORDER } from "./HubProgressBarConstants";
import { GuildFeatures } from "../../Constants";
import { UserSettingsDelay, updateUserGuildSettings } from "../user_settings/UserSettingsProtoActionCreators";
function $mk83915($env) {
return (a0) => {
let r25;
let r0 = false;
let r2 = $env[0][Symbol.iterator]();
const next = r2.next;
const r28 = $env.$parent;
while (true) {
const r13 = r2 === void 0 ? void 0 : (r25 = next.call(r2)).done ? r2 = void 0 : r25.value;
if (r2 === void 0) {
return r0;
}
try {
const r9 = r28[0];
const r31 = r28[1];
if (!r9(r31[4]).hasFlag(a0.hubProgress, r13)) {
a0.hubProgress = r9(r31[4]).addFlag(a0.hubProgress, r13);
r0 = true;
}
} catch (r40) {
if (r2 !== void 0 && typeof r2.return === "function") {
try {
r2.return();
} catch {}
}
throw r40;
}
}
};
}
let env6717 = {};
export function setHubProgressActionComplete(a0, a1) {
if (a0 != null) {
const guild = GuildStore.getGuild(a0);
if (guild != null && guild.features.has(GuildFeatures.HUB)) {
let env17680;
const r12 = [a1];
const r13 = env17680 = {
$parent: env6717
};
env17680[0] = r12;
const INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION;
updateUserGuildSettings(a0, $mk83915(r13), INFREQUENT_USER_ACTION);
}
}
}
export function skipHubProgress(a0) {
let env17681;
const r1 = env17681 = {
$parent: env6717
};
env17681[0] = HUB_PROGRESS_STEP_ORDER;
const INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION;
updateUserGuildSettings(a0, $mk83915(r1), INFREQUENT_USER_ACTION);
}
+7
View File
@@ -0,0 +1,7 @@
// Metro module 10096 (f10097).
import { HubProgressStep } from "../../_bundle/Module1306";
const r14 = [HubProgressStep.JOIN_GUILD, HubProgressStep.INVITE_USER, HubProgressStep.CONTACT_SYNC];
const length = r14.length;
export { r14 as HUB_PROGRESS_STEP_ORDER };
export { length as HUB_PROGRESS_NUM_TOTAL_STEPS };
export const HUB_PROGRESS_ACTION_SHEET_ID = "hub-progress";
+71
View File
@@ -0,0 +1,71 @@
// Metro module 11760 (f11761).
import { useMemo } from "react";
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
import ConnectedAccountsStore from "../../stores/ConnectedAccountsStore";
import { HUB_PROGRESS_STEP_ORDER } from "./HubProgressBarConstants";
import { PlatformTypes } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
import { HubProgressStep } from "../../_bundle/Module1306";
import { intl, t } from "../../intl/index.native";
import { assertNever } from "../../utils/GlobalUtils";
import { hasFlag } from "../../_bundle/Module1384";
export function getHubProgressTitleForStep(a0) {
if (HubProgressStep.JOIN_GUILD === a0) {
return intl.string(t.iNR25n);
}
if (HubProgressStep.INVITE_USER === a0) {
return intl.string(t["3NlTYU"]);
}
if (HubProgressStep.CONTACT_SYNC === a0) {
return intl.string(t.HFvFte);
}
if (HubProgressStep.NO_PROGRESS === a0) {
return null;
}
assertNever(a0);
}
export function useHubProgressBarCompletedSteps(a0) {
const id2 = a0?.id;
let memo, stateFromStores;
const id = id2;
const stateFromStores2 = useStateFromStores([UserSettingsProtoStore], () => {
const r3 = id == null;
let r8 = 0;
if (!r3) {
const guilds = UserSettingsProtoStore.settings.guilds;
let r12 = guilds == null ? void 0 : guilds.guilds[id]?.hubProgress;
if (r12 == null) {
r12 = 0;
}
r8 = r12;
}
return r8;
});
memo = useMemo(() => (function convertHubProgressFlagSetToSet(a0) {
const set = new Set();
for (const item of HUB_PROGRESS_STEP_ORDER) {
if (hasFlag(a0, item)) {
set.add(item);
}
}
return set;
})(stateFromStores2), [stateFromStores2]);
stateFromStores = useStateFromStores([ConnectedAccountsStore], () => ConnectedAccountsStore.getLocalAccount(PlatformTypes.CONTACTS) != null);
return useMemo(() => {
if (stateFromStores) {
const set = new Set(memo);
set.add(HubProgressStep.CONTACT_SYNC);
return set;
}
return memo;
}, [memo, stateFromStores]);
}
export function getNextHubProgressStep(a0) {
for (const item of HUB_PROGRESS_STEP_ORDER) {
if (a0.has(item)) {
continue;
}
return item;
}
return null;
}
+24
View File
@@ -0,0 +1,24 @@
// Metro module 15179 (f15180).
import GuildDirectoryStore from "../directory_channels/GuildDirectoryStore";
import ReadStateStore from "../../stores/ReadStateStore";
import { useStateFromStores } from "../../_bundle/Module589";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { MAX_CATEGORY_SERVERS } from "../directory_channels/GuildDirectoryUtils";
export function useHubUnreadCount(a0) {
return useStateFromStores([GuildDirectoryStore, ReadStateStore], () => {
if (a0 == null) {
return 0;
}
const r11 = ReadStateStore.ackMessageId(a0.id);
let c27959_0 = r11;
if (r11 == null) {
return 0;
}
const r13 = Object;
let r16 = GuildDirectoryStore.getDirectoryEntries(a0.id);
if (r16 == null) {
r16 = {};
}
return Math.min(MAX_CATEGORY_SERVERS, r13.values(r16).filter((item) => new Date(item.createdAt).getTime() > SnowflakeUtils.extractTimestamp(c27959_0)).length);
}, [a0]);
}
+21
View File
@@ -0,0 +1,21 @@
// Metro module 12424 (f12425).
import InviteStore from "../../stores/InviteStore";
import Module12 from "../../_bundle/Module12";
import HubEmailConnectionModalActionCreators from "./native/components/HubEmailConnectionModalActionCreators";
let c8593_3 = Module12.throttle((a0) => {
let invite = InviteStore.getInvite(a0.code);
if (invite == null) {
invite = void 0;
}
HubEmailConnectionModalActionCreators.open({
invite
});
}, 1000, {
trailing: false
});
const r21 = {
onOpenHubInvite: (a0) => {
c8593_3(a0);
}
};
export default r21;
@@ -0,0 +1,228 @@
// Metro module 11833 (f11834).
import { useState, useRef } from "react";
import { ScrollView, View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import { HubEmailConnectionSteps, INVITE_ROUTING_HUB_GUILD_ID } from "../../HubConstants";
import { MarketingURLs } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import HubActionCreators from "../../../../actions/HubActionCreators";
import { APIError } from "../../../../errors/index";
import { intl, t } from "../../../../intl/index.native";
import { HubEmailConnectionScreen } from "./HubEmailConnectionModal";
import { StudyGroupsSpotIllustration } from "../../../../design/assets/native";
import { Text } from "../../../../design/components/Text/native/Text";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import FreeFormInputGroup from "../../../../design/void/Form/native/FreeFormInputGroup";
import { ClearButtonVisibility } from "../../../../design/void/native";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
paddingHorizontal: 16
},
header: {
marginTop: 16,
marginBottom: 16,
alignSelf: "center"
},
scrollViewContainer: {
flexGrow: 2
},
title: {
textAlign: "center",
marginBottom: 8
},
description: {
textAlign: "center",
marginBottom: 24
},
input: {
marginBottom: 32
},
textInput: {
borderRadius: Module712.radii.lg
},
growSpacing: {
flexGrow: 2,
minHeight: Module712.space.PX_24
},
buttonContainer: {
paddingHorizontal: Module712.space.PX_16
}
});
export default function HubEmailConnectionContent(props) {
let navigation, state, setState, setState2, ref;
const { onClose, invite } = props;
navigation = void 0;
state = void 0;
setState = void 0;
setState2 = void 0;
ref = void 0;
let _signup2 = function _signup() {
const r9 = async () => {
let id, id2, c30461_4;
let c30461_5 = 0;
let c31643_0, c31643_1, c31643_2, c31643_3;
L28: {
try {
c31643_0 = void 0;
c31643_1 = void 0;
c31643_2 = void 0;
setState2(null);
setState(true);
c30461_5 = 2;
id2 = invite == null ? void 0 : invite.guild?.id;
if (id2 == null) {
const channel = ChannelStore.getChannel(invite == null ? void 0 : invite.channel?.id);
id2 = channel == null ? void 0 : channel.getGuildId();
}
id = id2;
if (id == null) {
id = void 0;
}
let r53 = id;
c31643_0 = id;
if (id === INVITE_ROUTING_HUB_GUILD_ID) {
c31643_0 = void 0;
r53 = void 0;
}
c31643_1 = await HubActionCreators.sendVerificationEmail(state, true, r53);
c31643_2 = c31643_1.guilds_info;
if (c31643_1.has_matching_guild && c31643_0 != null) {
navigation.push(HubEmailConnectionSteps.VERIFY_PIN, {
email: state,
onClose,
guildId: c31643_0
});
} else if (c31643_2.length === 0) {
navigation.push(HubEmailConnectionSteps.SUBMIT_SCHOOL, {
email: state,
onClose
});
} else if (c31643_2.length === 1) {
await HubActionCreators.sendVerificationEmail(state, true, c31643_2[0].id);
navigation.push(HubEmailConnectionSteps.VERIFY_PIN, {
email: state,
onClose,
guildId: c31643_2[0].id
});
} else {
navigation.push(HubEmailConnectionSteps.SELECT_SCHOOL, {
email: state,
onClose,
guildsInfo: c31643_2
});
}
c30461_5 = 1;
c30461_5 = 0;
(0, setState)(false);
} catch ($e) {
const r34 = $e;
let r7 = r34;
c30461_4 = r34;
let r35 = c30461_5;
if (r35 !== 0) {
while (true) {
if (r35 === 1) {
try {
const r205 = c30461_4;
c30461_5 = 0;
(0, setState)(false);
throw r205;
} catch (r203) {
r7 = r203;
c30461_4 = r203;
r35 = c30461_5;
if (r35 === 0) {
break;
}
}
} else {
try {
const r184 = c30461_4;
c30461_5 = 1;
c31643_3 = r184;
setState2(new APIError(c31643_3));
c30461_5 = 0;
(0, setState)(false);
break L28;
} catch (r181) {
r7 = r181;
c30461_4 = r181;
r35 = c30461_5;
if (r35 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
_signup2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
navigation = useNavigation();
let onChangeText;
[state, onChangeText] = useState("");
let loading;
[loading, setState] = useState(false);
let state2;
[state2, setState2] = useState(null);
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
ref = useRef(null);
const r61 = intl.string(t.H1jCHH);
return <HubEmailConnectionScreen>
<ScrollView ref={ref} contentContainerStyle={[styles.scrollViewContainer, {
paddingBottom: insets.bottom + Module712.space.PX_16
}]}>
<View style={styles.container}>
<View style={styles.header}>
<StudyGroupsSpotIllustration scale={0.75} />
</View>
<Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles.title} accessibilityRole="header">
{invite?.guild != null ? invite.guild.id !== INVITE_ROUTING_HUB_GUILD_ID ? invite?.approximate_member_count != null ? intl.formatToPlainString(t["4T4+p1"], {
guildName: invite.guild.name,
count: invite.approximate_member_count
}) : r61 : r61 : r61}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.format(t["6kzaqs"], {
onClick: () => {
ActionSheetActionCreators.openLazy(import("./HubEmailConnectionDescriptionActionsheet"), "HubEmailConnectionDescriptionActionsheet");
}
})}
</Text>
<FreeFormInputGroup label={intl.string(t["K/7rLI"])} placeholder={intl.string(t.ImAOh5)} value={state} textContentType="emailAddress" autoCapitalize="none" keyboardType="email-address" hint={intl.format(t.RPT0vj, {
termsURL: MarketingURLs.TERMS,
privacyURL: MarketingURLs.PRIVACY
})} textStyle={styles.textInput} onChangeText={onChangeText} style={styles.input} clearButtonVisibility={ClearButtonVisibility.WITH_CONTENT} error={state2 == null ? void 0 : state2.getAnyErrorMessage()} onFocus={() => {
setTimeout(() => {
const current = ref.current;
if (current != null) {
current.scrollToEnd();
}
}, 100);
}} onBlur={() => {
setTimeout(() => {
const current = ref.current;
if (current != null) {
current.scrollToEnd();
}
}, 100);
}} />
</View>
<View style={styles.growSpacing} />
<View style={styles.buttonContainer}>
<Button size="lg" text={intl.string(t["8vmKO0"])} onPress={function signup() {
return _signup2.apply(this, arguments);
}} loading={loading} />
</View>
</ScrollView>
</HubEmailConnectionScreen>;
};
@@ -0,0 +1,23 @@
// Metro module 11835 (f11836).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
description: {
marginBottom: 8
}
});
export default function HubEmailConnectionDescriptionActionsheet() {
const styles = useStyles();
return <BottomSheet>
<BottomSheetTitleHeader title={intl.string(t["48kg+O"])} />
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.O1k9XX)}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.FV5dvh)}
</Text>
</BottomSheet>;
};
@@ -0,0 +1,194 @@
// Metro module 11839 (f11840).
import { useLayoutEffect, useCallback, useState } from "react";
import { FlatList, View } from "react-native";
import { HubEmailConnectionSteps } from "../../HubConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { FormRow } from "../../../../design/void/Form/native/index";
import GuildIcon from "../../../guild/native/GuildIcon";
import { fromGuildBasic } from "../../../../utils/GuildRecordUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { LegacyText } from "../../../../design/void/native";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { HeaderActionButton } from "../../../../design/components/Navigator/native/HeaderActionButton.native";
import { MagnifyingGlassIcon } from "../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import HubActionCreators from "../../../../actions/HubActionCreators";
import { APIError } from "../../../../errors/index";
import { HubEmailConnectionScreen } from "./HubEmailConnectionModal";
let useStyles, HubEmailConnectionGuildSelectHeader, HubEmailConnectionGuildSelectFooter;
const HubEmailConnectionGuildSelectRow = function HubEmailConnectionGuildSelectRow(props) {
const { guildInfo, signup, loading } = props;
const styles2 = useStyles();
return <FormRow onPress={signup} disabled={loading} DEPRECATED_style={styles2.rowContainer} label={guildInfo.name} leading={<GuildIcon style={styles2.guildIcon} guild={fromGuildBasic({
...guildInfo,
features: []
})} />} trailing={<FormRow.Arrow />} />;
};
HubEmailConnectionGuildSelectHeader = function HubEmailConnectionGuildSelectHeader() {
const styles2 = useStyles();
return <View style={styles2.header}>
<Text style={styles2.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.string(t.mOMeiR)}
</Text>
</View>;
};
HubEmailConnectionGuildSelectFooter = function HubEmailConnectionGuildSelectFooter(props) {
const { errors, loading, onFooterButtonPressed } = props;
const styles2 = useStyles();
return <View style={[styles2.footerSafeAreaContainer, {
paddingBottom: useSafeAreaInsets_native().bottom
}]}>
<View style={styles2.footerContainer}>
<Button variant="secondary" loading={loading} disabled={loading} grow text={intl.string(t.G3Zk7V)} onPress={onFooterButtonPressed} />
{errors != null && <LegacyText style={styles2.error}>
{errors == null ? void 0 : errors.getAnyErrorMessage()}
</LegacyText>}
</View>
</View>;
};
useStyles = createStyles({
rowContainer: {
marginHorizontal: 16,
borderRadius: Module712.radii.sm,
padding: 12,
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL
},
guildIcon: {
borderRadius: Module712.radii.sm
},
separator: {
height: 8
},
header: {
padding: 16,
alignItems: "center",
justifyContent: "center"
},
title: {
marginBottom: 8,
textAlign: "center"
},
footerSafeAreaContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
position: "absolute",
bottom: 0,
width: "100%"
},
footerContainer: {
paddingHorizontal: 16,
height: 110,
justifyContent: "center",
alignItems: "center"
},
error: {
color: Module712.unsafe_rawColors.RED_400,
alignSelf: "center",
fontSize: 14,
marginVertical: 8
}
});
export default function HubEmailConnectionGuildSelect(props) {
let setState, state, setState2;
const { onClose, email, guildsInfo } = props;
setState = void 0;
state = void 0;
setState2 = void 0;
const styles = useStyles();
const navigation = useNavigation();
useLayoutEffect(() => {
navigation.setOptions({
headerRight: () => <HeaderActionButton IconComponent={MagnifyingGlassIcon} onPress={() => {
navigation.push(HubEmailConnectionSteps.SELECT_SCHOOL_SEARCH, {
email,
onClose,
guildsInfo
});
}} accessibilityLabel={intl.string(t["5h0QOP"])} />
});
}, [email, guildsInfo, navigation, onClose]);
const callback = useCallback(() => {
navigation.push(HubEmailConnectionSteps.SUBMIT_SCHOOL, {
email,
onClose
});
}, [email, navigation, onClose]);
const bottom = useSafeAreaInsets_native().bottom;
let errors;
[errors, setState] = useState(null);
[state, setState2] = useState(false);
return <HubEmailConnectionScreen>
<FlatList data={guildsInfo} ListHeaderComponent={() => <HubEmailConnectionGuildSelectHeader />} renderItem={({ item }) => {
const id = item.id;
return <HubEmailConnectionGuildSelectRow guildInfo={item} signup={async () => {
let c30465_2;
let c30465_3 = 0;
let c31645_0;
L10: {
try {
setState(null);
setState2(true);
c30465_3 = 2;
await HubActionCreators.sendVerificationEmail(email, true, id);
navigation.push(HubEmailConnectionSteps.VERIFY_PIN, {
email,
onClose,
guildId: id
});
c30465_3 = 1;
c30465_3 = 0;
(0, setState2)(false);
} catch ($e) {
const r33 = $e;
let r7 = r33;
c30465_2 = r33;
let r34 = c30465_3;
if (r34 !== 0) {
while (true) {
if (r34 === 1) {
try {
const r108 = c30465_2;
c30465_3 = 0;
(0, setState2)(false);
throw r108;
} catch (r106) {
r7 = r106;
c30465_2 = r106;
r34 = c30465_3;
if (r34 === 0) {
break;
}
}
} else {
try {
const r85 = c30465_2;
c30465_3 = 1;
c31645_0 = r85;
setState(new APIError(c31645_0));
c30465_3 = 0;
(0, setState2)(false);
break L10;
} catch (r82) {
r7 = r82;
c30465_2 = r82;
r34 = c30465_3;
if (r34 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
}} loading={state} />;
}} ItemSeparatorComponent={() => <View style={styles.separator} />} contentContainerStyle={{
paddingBottom: 110 + bottom + 8
}} />
<HubEmailConnectionGuildSelectFooter errors={errors} loading={state} onFooterButtonPressed={callback} />
</HubEmailConnectionScreen>;
};
export { HubEmailConnectionGuildSelectRow };
@@ -0,0 +1,149 @@
// Metro module 11844 (f11845).
import { useState } from "react";
import { FlatList, Image as Image2, View } from "react-native";
import { HubEmailConnectionSteps } from "../../HubConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import Module11845 from "../../../../_bundle/Module11845";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import fuzzysearch from "../../../../_bundle/fuzzysearch";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import HubActionCreators from "../../../../actions/HubActionCreators";
import { APIError } from "../../../../errors/index";
import { FauxHeader } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import SearchBarNav from "../../../main_tabs_v2/native/shared_components/SearchBarNav";
import { LegacyText } from "../../../../design/void/native";
import { HubEmailConnectionGuildSelectRow } from "./HubEmailConnectionGuildSelect";
let useStyles;
const EmptyState = function EmptyState() {
const styles2 = useStyles();
return <View style={styles2.emptyWrapper}>
<Image2 style={styles2.emptyStateImage} source={Module11845} />
<Text style={styles2.emptyStateTitle} variant="text-sm/semibold" color="mobile-text-heading-primary">
{intl.string(t["6HXiuE"])}
</Text>
</View>;
};
useStyles = createStyles({
scrollContainer: {
flex: 1,
width: "100%",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
fauxHeader: {
paddingHorizontal: 0
},
emptyWrapper: {
flex: 1,
alignItems: "center",
justifyContent: "center",
marginTop: 64,
paddingHorizontal: 16
},
emptyStateImage: {
marginBottom: 24
},
emptyStateTitle: {
marginBottom: 4,
textAlign: "center"
},
error: {
color: Module712.unsafe_rawColors.RED_400,
alignSelf: "center",
fontSize: 14,
marginBottom: 8
}
});
export default function HubEmailConnectionGuildSelectSearch(props) {
let anyErrorMessage;
const { guildsInfo, email, onClose: onClose2 } = props;
anyErrorMessage = void 0;
const styles = useStyles();
const navigation = useNavigation();
const [state, onChange] = useState("");
const [state3, setState] = useState(null);
const [state2, setState2] = useState(false);
const data = guildsInfo.filter((item) => fuzzysearch(state.toLowerCase(), item.name.toLowerCase()));
const bottom = useSafeAreaInsets_native().bottom;
anyErrorMessage = state3 == null ? void 0 : state3.getAnyErrorMessage();
return <>
<FauxHeader style={styles.fauxHeader}>
<SearchBarNav placeholder={intl.string(t.nL2wKD)} onChange={onChange} onClose={() => {
navigation.pop();
}} />
</FauxHeader>
<FlatList keyboardShouldPersistTaps="always" data={data} ListHeaderComponent={() => anyErrorMessage != null ? anyErrorMessage !== "" ? <LegacyText style={styles.error}>{anyErrorMessage}</LegacyText> : null : null} renderItem={({ item }) => {
const id = item.id;
return <HubEmailConnectionGuildSelectRow signup={async () => {
let c30468_2;
let c30468_3 = 0;
let c31647_0;
L10: {
try {
setState(null);
setState2(true);
c30468_3 = 2;
await HubActionCreators.sendVerificationEmail(email, true, id);
navigation.push(HubEmailConnectionSteps.VERIFY_PIN, {
email,
onClose: onClose2,
guildId: id
});
c30468_3 = 1;
c30468_3 = 0;
(0, setState2)(false);
} catch ($e) {
const r33 = $e;
let r7 = r33;
c30468_2 = r33;
let r34 = c30468_3;
if (r34 !== 0) {
while (true) {
if (r34 === 1) {
try {
const r108 = c30468_2;
c30468_3 = 0;
(0, setState2)(false);
throw r108;
} catch (r106) {
r7 = r106;
c30468_2 = r106;
r34 = c30468_3;
if (r34 === 0) {
break;
}
}
} else {
try {
const r85 = c30468_2;
c30468_3 = 1;
c31647_0 = r85;
setState(new APIError(c31647_0));
c30468_3 = 0;
(0, setState2)(false);
break L10;
} catch (r82) {
r7 = r82;
c30468_2 = r82;
r34 = c30468_3;
if (r34 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
}} guildInfo={item} loading={state2} />;
}} keyExtractor={(item) => item.id} ListEmptyComponent={() => <EmptyState />} ItemSeparatorComponent={() => <View style={{
height: 8
}} />} style={styles.scrollContainer} contentContainerStyle={{
paddingBottom: bottom + 16,
paddingTop: 16
}} />
</>;
};
@@ -0,0 +1,112 @@
// Metro module 11829 (f11830).
import { HubEmailConnectionSteps } from "../../HubConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { NAV_BAR_HEIGHT } from "../../../../design/components/Navigator/native/NavigatorConstants.native";
import { getHeaderBackButton, getHeaderCloseButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import HubEmailConnectionStudentPrompt from "./HubEmailConnectionStudentPrompt";
import { ImpressionNames } from "../../../../_bundle/Module503";
import HubEmailConnectionContent from "./HubEmailConnectionContent";
import HubEmailConnectionWaitlist from "./HubEmailConnectionWaitlist";
import HubEmailConnectionSubmitSchool from "./HubEmailConnectionSubmitSchool";
import HubEmailConnectionGuildSelect from "./HubEmailConnectionGuildSelect";
import HubEmailConnectionPinVerify from "./HubEmailConnectionPinVerify";
import HubEmailConnectionGuildSelectSearch from "./HubEmailConnectionGuildSelectSearch";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import useInitialValue from "../../../../hooks/useInitialValue";
import HubEmailConnectionModalActionCreators from "./HubEmailConnectionModalActionCreators";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
safeArea: {
marginTop: NAV_BAR_HEIGHT,
flex: 1
}
});
export default function HubEmailConnectionModal(props) {
const { isNestedNavigator, onCloseExtra, invite, displayStudentPrompt } = props;
const navigation = useNavigation();
const initialValue = useInitialValue(() => {
const handleClose = function handleClose(r4 = false) {
if (onCloseExtra != null) {
onCloseExtra(r4 === true);
}
if (isNestedNavigator) {
navigation.goBack();
} else {
HubEmailConnectionModalActionCreators.close();
}
};
const initialRouteStack = [];
const r3 = {
name: null,
params: null
};
if (displayStudentPrompt) {
r3.name = HubEmailConnectionSteps.STUDENT_PROMPT;
r3.params = {
onClose: handleClose
};
initialRouteStack.push(r3);
} else {
r3.name = HubEmailConnectionSteps.VERIFY_EMAIL;
r3.params = {
invite,
onClose: handleClose
};
initialRouteStack.push(r3);
}
const headerLeft = isNestedNavigator ? getHeaderBackButton(handleClose) : getHeaderCloseButton(handleClose);
const screens = {};
screens[HubEmailConnectionSteps.STUDENT_PROMPT] = {
fullscreen: true,
headerLeft,
headerTitle: () => null,
render: (a0) => <HubEmailConnectionStudentPrompt {...a0} />
};
screens[HubEmailConnectionSteps.VERIFY_EMAIL] = {
impressionName: ImpressionNames.HUB_EMAIL_SIGNUP,
impressionProperties: (a0) => ({
has_invite: a0.invite != null
}),
fullscreen: true,
headerLeft,
headerTitle: () => null,
render: (a0) => <HubEmailConnectionContent {...a0} />
};
screens[HubEmailConnectionSteps.EMAIL_WAITLIST] = {
fullscreen: true,
headerTitle: () => null,
render: (a0) => <HubEmailConnectionWaitlist {...a0} />
};
screens[HubEmailConnectionSteps.SUBMIT_SCHOOL] = {
fullscreen: true,
headerTitle: () => null,
render: (a0) => <HubEmailConnectionSubmitSchool {...a0} />
};
screens[HubEmailConnectionSteps.SELECT_SCHOOL] = {
fullscreen: true,
headerTitle: () => null,
render: (a0) => <HubEmailConnectionGuildSelect {...a0} />
};
screens[HubEmailConnectionSteps.VERIFY_PIN] = {
fullscreen: true,
headerTitle: () => null,
render: (a0) => <HubEmailConnectionPinVerify {...a0} />
};
screens[HubEmailConnectionSteps.SELECT_SCHOOL_SEARCH] = {
fullscreen: true,
headerShown: false,
render: (a0) => <HubEmailConnectionGuildSelectSearch {...a0} />
};
return {
screens,
initialRouteStack
};
});
return <Navigator screens={initialValue.screens} initialRouteStack={initialValue.initialRouteStack} headerBackTitle={intl.string(t["13/7kX"])} />;
};
export function HubEmailConnectionScreen(props) {
const children = props.children;
return <SafeAreaPaddingView top style={useStyles().safeArea}>{children}</SafeAreaPaddingView>;
}
@@ -0,0 +1,22 @@
// Metro module 11846 (f11847).
import ModalActionCreators from "../../../../actions/ModalActionCreators";
let c8122_4 = "HUB_EMAIL_CONNECTION_MODAL_KEY";
const r17 = {
open: (a0, c19212_0) => {
ModalActionCreators.pushLazy(async () => {
let c27194_1;
c27194_1 = void 0;
let c30469_0 = (await import("./HubEmailConnectionModal")).default;
if (c19212_0 != null) {
c30469_0.modalConfig = {
animation: c19212_0
};
}
return c30469_0;
}, a0, c8122_4);
},
close: () => {
ModalActionCreators.popWithKey(c8122_4);
}
};
export default r17;
@@ -0,0 +1,173 @@
// Metro module 11840 (f11841).
import { useEffect, useState } from "react";
import { Image as Image2, View } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import Module11841 from "../../../../_bundle/Module11841";
import HubJoinManager from "../../HubJoinManager";
import navigateToLastChannel from "../../../main_tabs_v2/native/navigateToLastChannel";
import Module12 from "../../../../_bundle/Module12";
import HubActionCreators from "../../../../actions/HubActionCreators";
import { intl, t } from "../../../../intl/index.native";
import { APIError } from "../../../../errors/index";
import { transitionToGuild } from "../../../routing/transitionToGuild.native";
import { HubEmailConnectionScreen } from "./HubEmailConnectionModal";
import Module11843 from "../../../../_bundle/Module11843";
import { Text } from "../../../../design/components/Text/native/Text";
import { CodeBlocks, CodeType } from "../../../phone/native/CodeField";
let useStyles;
const presentResendToast = function presentResendToast(anyErrorMessage) {
ToastActionCreators.open({
key: "HUB_EMAIL_RESET",
content: anyErrorMessage,
icon: Module11841
});
};
useStyles = createStyles({
container: {
alignItems: "center"
},
title: {
marginBottom: 8,
textAlign: "center"
},
description: {
textAlign: "center",
marginBottom: 24
},
label: {
textAlign: "center",
marginBottom: 12
},
error: {
alignSelf: "center",
marginVertical: 8
}
});
export default function HubEmailConnectionPinVerify(props) {
let setState;
const { email, guildId, onClose } = props;
setState = void 0;
let _handleCodeEntered2 = function _handleCodeEntered() {
const r9 = async (c30466_0) => {
let c30466_3;
let c30466_4 = 0;
let c31646_0, c31646_1;
L12: {
try {
c31646_0 = void 0;
c30466_4 = 1;
await HubActionCreators.verifyCode(c30466_0, guildId, email);
c31646_0 = GuildStore.getGuild(guildId);
if (c31646_0 != null) {
(0, onClose)(true);
transitionToGuild(c31646_0.id);
}
c30466_4 = 0;
} catch ($e) {
const r29 = $e;
let r7 = r29;
c30466_3 = r29;
if (c30466_4 !== 0) {
while (true) {
try {
const r84 = c30466_3;
c30466_4 = 0;
c31646_1 = r84;
setState(new APIError(c31646_1));
break L12;
} catch (r80) {
r7 = r80;
c30466_3 = r80;
if (c30466_4 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
_handleCodeEntered2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
useEffect(() => {
HubJoinManager.initialize(() => {
onClose(true);
navigateToLastChannel();
});
return () => {
HubJoinManager.terminate();
};
}, [onClose]);
const onClick = Module12.throttle(async () => {
let anyErrorMessage, c27192_3;
let c27192_4 = 0;
let c30467_0, c30467_1;
L10: {
try {
c30467_0 = void 0;
c27192_4 = 1;
await HubActionCreators.sendVerificationEmail(email, true, guildId);
(0, presentResendToast)(intl.string(t["2bO4dz"]));
c27192_4 = 0;
} catch ($e) {
const r29 = $e;
let r7 = r29;
c27192_3 = r29;
if (c27192_4 !== 0) {
while (true) {
try {
const r79 = c27192_3;
c27192_4 = 0;
c30467_1 = r79;
c30467_0 = new APIError(c30467_1);
const r91 = c30467_0;
anyErrorMessage = r91 == null ? void 0 : r91.getAnyErrorMessage();
if (anyErrorMessage == null) {
anyErrorMessage = intl.string(t.FPzC5z);
}
presentResendToast(anyErrorMessage);
break L10;
} catch (r75) {
r7 = r75;
c27192_3 = r75;
if (c27192_4 === 0) {
break;
}
}
}
}
throw r7;
}
}
}, 1000);
let state;
[state, setState] = useState(null);
return <HubEmailConnectionScreen>
<View style={styles.container}>
<Image2 source={Module11843} />
<Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.string(t.SJ3Lxc)}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.format(t["b+W0oq"], {
onClick,
email
})}
</Text>
<Text style={styles.label} variant="text-sm/semibold" color="text-muted">
{intl.string(t.rpWT1s)}
</Text>
<CodeBlocks hasError={false} count={8} onCodeEntered={function handleCodeEntered(event) {
return _handleCodeEntered2.apply(this, arguments);
}} codeType={CodeType.ALPHANUMERIC} />
{state != null && <Text variant="text-sm/medium" color="text-feedback-critical" style={styles.error}>
{state.getAnyErrorMessage()}
</Text>}
</View>
</HubEmailConnectionScreen>;
};
@@ -0,0 +1,53 @@
// Metro module 11830 (f11831).
import { Image as Image2, View } from "react-native";
import { HubEmailConnectionSteps } from "../../HubConstants";
import { AnalyticEvents, Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import TextStyles from "../../../rebrand/native/TextStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { HubEmailConnectionScreen } from "./HubEmailConnectionModal";
import { LegacyText } from "../../../../design/void/native";
import { intl, t } from "../../../../intl/index.native";
import FormRow from "../../../../design/void/Form/native/FormRow";
import Module11831 from "../../../../_bundle/Module11831";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import Module11832 from "../../../../_bundle/Module11832";
const useStyles = createStyles({
container: {
display: "flex",
alignItems: "center",
justifyContent: "center",
padding: 16
},
header: {
...TextStyles(Fonts.PRIMARY_BOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 24),
textAlign: "center",
marginBottom: 24
},
row: {
borderRadius: Module712.radii.sm,
marginBottom: 8,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
}
});
export default function HubEmailConnectionStudentPrompt(props) {
const { onClose, invite } = props;
const styles = useStyles();
const navigation = useNavigation();
return <HubEmailConnectionScreen>
<View style={styles.container}>
<LegacyText style={styles.header}>
{intl.string(t["+/Pv0h"])}
</LegacyText>
<FormRow DEPRECATED_style={styles.row} leading={<Image2 source={Module11831} />} trailing={FormRow.Arrow} label={intl.string(t["a7a/D+"])} subLabel={intl.string(t.Gsegk8)} onPress={function onPress() {
AnalyticsUtils.track(AnalyticEvents.HUB_STUDENT_PROMPT_CLICKED);
navigation.push(HubEmailConnectionSteps.VERIFY_EMAIL, {
onClose,
invite
});
}} />
<FormRow DEPRECATED_style={styles.row} leading={<Image2 source={Module11832} />} trailing={FormRow.Arrow} label={intl.string(t.GLG9n4)} onPress={onClose} />
</View>
</HubEmailConnectionScreen>;
};
@@ -0,0 +1,169 @@
// Metro module 11838 (f11839).
import { useState, useRef } from "react";
import { ScrollView, View } from "react-native";
import { HubEmailConnectionSteps } from "../../HubConstants";
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import HubActionCreators from "../../../../actions/HubActionCreators";
import { APIError } from "../../../../errors/index";
import { HubEmailConnectionScreen } from "./HubEmailConnectionModal";
import { LegacyText, ClearButtonVisibility } from "../../../../design/void/native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import FreeFormInputGroup from "../../../../design/void/Form/native/FreeFormInputGroup";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
paddingHorizontal: 16
},
title: {
fontFamily: Fonts.PRIMARY_BOLD,
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
fontSize: 24,
textAlign: "center",
marginBottom: 8
},
description: {
textAlign: "center",
marginBottom: 24
},
scrollViewContainer: {
flexGrow: 2
},
input: {
marginBottom: 8
},
redesignTextInput: {
borderRadius: Module712.radii.lg
},
redesignGrowSpacing: {
flexGrow: 2,
minHeight: Module712.space.PX_24
},
redesignSubmit: {
paddingHorizontal: Module712.space.PX_16
}
});
export default function HubEmailConnectionSubmitSchool(props) {
let navigation, setState, setState2, ref, state;
const { onClose, email } = props;
navigation = void 0;
setState = void 0;
setState2 = void 0;
ref = void 0;
state = void 0;
let _submitWaitlist2 = function _submitWaitlist() {
const r9 = async () => {
let c30464_2;
let c30464_3 = 0;
let c31644_0;
L10: {
try {
setState2(null);
c30464_3 = 2;
setState(true);
await HubActionCreators.signup(email, state);
navigation.push(HubEmailConnectionSteps.EMAIL_WAITLIST, {
school: state,
onClose
});
c30464_3 = 1;
c30464_3 = 0;
(0, setState)(false);
} catch ($e) {
const r30 = $e;
let r7 = r30;
c30464_2 = r30;
let r31 = c30464_3;
if (r31 !== 0) {
while (true) {
if (r31 === 1) {
try {
const r100 = c30464_2;
c30464_3 = 0;
(0, setState)(false);
throw r100;
} catch (r98) {
r7 = r98;
c30464_2 = r98;
r31 = c30464_3;
if (r31 === 0) {
break;
}
}
} else {
try {
const r79 = c30464_2;
c30464_3 = 1;
c31644_0 = r79;
setState2(new APIError(c31644_0));
c30464_3 = 0;
(0, setState)(false);
break L10;
} catch (r76) {
r7 = r76;
c30464_2 = r76;
r31 = c30464_3;
if (r31 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
_submitWaitlist2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
navigation = useNavigation();
let loading;
[loading, setState] = useState(false);
let state2;
[state2, setState2] = useState(null);
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
ref = useRef(null);
let onChangeText;
[state, onChangeText] = useState("");
return <HubEmailConnectionScreen>
<ScrollView ref={ref} contentContainerStyle={[styles.scrollViewContainer, {
paddingBottom: insets.bottom + Module712.space.PX_16
}]}>
<View style={styles.container}>
<LegacyText style={styles.title} accessibilityRole="header">
{intl.string(t["2FNWBG"])}
</LegacyText>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t["/4y6ox"])}
</Text>
<FreeFormInputGroup label={intl.string(t["L+AfJr"])} placeholder={intl.string(t.Y1btJd)} value={state} onChangeText={onChangeText} style={styles.input} textStyle={styles.redesignTextInput} clearButtonVisibility={ClearButtonVisibility.WITH_CONTENT} error={state2 == null ? void 0 : state2.getAnyErrorMessage()} onFocus={() => {
setTimeout(() => {
const current = ref.current;
if (current != null) {
current.scrollToEnd();
}
}, 100);
}} onBlur={() => {
setTimeout(() => {
const current = ref.current;
if (current != null) {
current.scrollToEnd();
}
}, 100);
}} />
</View>
<View style={styles.redesignGrowSpacing} />
<View style={styles.redesignSubmit}>
<Button size="lg" loading={loading} text={intl.string(t.PDsYAo)} onPress={function submitWaitlist() {
return _submitWaitlist2.apply(this, arguments);
}} />
</View>
</ScrollView>
</HubEmailConnectionScreen>;
};
@@ -0,0 +1,62 @@
// Metro module 11836 (f11837).
import { useLayoutEffect } from "react";
import { Image as Image2, View } from "react-native";
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { HeaderActionButton } from "../../../../design/components/Navigator/native/HeaderActionButton.native";
import { intl, t } from "../../../../intl/index.native";
import Module11837 from "../../../../_bundle/Module11837";
import { LegacyText } from "../../../../design/void/native";
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"
},
header: {
marginBottom: 16
},
title: {
fontFamily: Fonts.PRIMARY_BOLD,
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
fontSize: 24,
textAlign: "center",
marginBottom: 8
},
description: {
textAlign: "center",
marginBottom: 16
},
redesignButton: {
paddingHorizontal: 16,
width: "100%"
}
});
export default function HubEmailConnectionWaitlist(props) {
const { school, onClose } = props;
const styles = useStyles();
const navigation = useNavigation();
useLayoutEffect(() => {
navigation.setOptions({
headerLeft: () => <HeaderActionButton text={intl.string(t.cpT0Cq)} onPress={onClose} />
});
}, [navigation, onClose]);
return <View style={styles.container}>
<Image2 source={Module11837} style={styles.header} />
<LegacyText style={styles.title} accessibilityRole="header">
{intl.string(t.OaloU5)}
</LegacyText>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.format(t.Rs7MXJ, {
school
})}
</Text>
<View style={styles.redesignButton}>
<Button size="lg" text={intl.string(t.i4jeWR)} onPress={onClose} />
</View>
</View>;
};
@@ -0,0 +1,61 @@
// Metro module 15178 (f15179).
import { View } from "react-native";
import GuildChannelStore from "../../../../stores/GuildChannelStore";
import SelectedChannelStore from "../../../../stores/SelectedChannelStore";
import { InstantInviteSources } from "../../../../Constants";
import { CHANNEL_MARGIN_VERTICAL } from "../../../channel_list_v2/native/RedesignChannelListConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import BaseChannelItem, { ChannelModes, BaseChannelName, BaseChannelIcon } from "../../../guild_sidebar/native/BaseChannelItem";
import { Badge } from "../../../../design/void/native";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import { useHubUnreadCount } from "../../HubUnreadUtils";
import HubSideBarProgressOverview from "./progress_bar/HubSideBarProgressOverview";
import { CompassIcon } from "../../../../design/components/Icon/native/redesign/generated/CompassIcon";
import { intl, t } from "../../../../intl/index.native";
import { transitionToChannel } from "../../../routing/transitionToChannel";
import { PlusMediumIcon } from "../../../../design/components/Icon/native/redesign/generated/PlusMediumIcon";
import GuildDirectoryAddModalActionCreators from "../../../directory_channels/native/components/GuildDirectoryAddModalActionCreators";
import { UserPlusIcon } from "../../../../design/components/Icon/native/redesign/generated/UserPlusIcon";
import { handleOpenInviteActionsheet } from "../../../instant_invite/native/InstantInviteUtils";
let useStyles;
const HubItem = function HubItem(props) {
const { IconComponent, label, handleItemClick: handleItemClick2, active, unreadCount } = props;
const styles = useStyles();
const mode = active ? ChannelModes.SELECTED : ChannelModes.DEFAULT;
return <BaseChannelItem style={styles.container} accessibilityLabel={label} accessibilityRole="menuitem" onPress={handleItemClick2} disableHighlightOnPress mode={mode} name={<BaseChannelName name={label} mode={mode} />} icon={<BaseChannelIcon mode={mode} IconComponent={IconComponent} />} channelInfo={unreadCount != null ? <Badge value={unreadCount} /> : null} />;
};
useStyles = createStyles({
container: {
marginVertical: CHANNEL_MARGIN_VERTICAL,
marginHorizontal: 8,
borderRadius: Module712.radii.md
},
row: {
flex: 1
}
});
export default function HubSidebar(props) {
let stateFromStoresObject;
const { guild, flashList } = props;
stateFromStoresObject = void 0;
const stateFromStores = useStateFromStores([GuildChannelStore], () => GuildChannelStore.getDefaultChannel(guild.id), [guild.id]);
const styles = useStyles();
stateFromStoresObject = useStateFromStoresObject([GuildChannelStore], () => GuildChannelStore.getChannels(guild.id));
const stateFromStores2 = useStateFromStores([SelectedChannelStore], () => stateFromStores != null && SelectedChannelStore.getChannelId() === stateFromStores.id);
const hubUnreadCount = useHubUnreadCount(stateFromStores);
return stateFromStores == null ? null : <View style={flashList ? styles.row : null}>
<HubSideBarProgressOverview guild={guild} />
<HubItem active={stateFromStores2} IconComponent={CompassIcon} label={intl.string(t.K50GHd)} handleItemClick={() => {
transitionToChannel(stateFromStores.id);
}} unreadCount={hubUnreadCount} />
<HubItem IconComponent={PlusMediumIcon} label={intl.string(t.emRpdS)} handleItemClick={() => GuildDirectoryAddModalActionCreators.open({
directoryGuildName: guild.name,
directoryGuildId: guild.id,
directoryChannelId: stateFromStores.id
})} />
<HubItem IconComponent={UserPlusIcon} label={intl.string(t.MJQOuJ)} handleItemClick={() => {
handleOpenInviteActionsheet(guild, stateFromStores.id, stateFromStoresObject, InstantInviteSources.GUILD_HEADER);
}} />
</View>;
};
@@ -0,0 +1,109 @@
// Metro module 11764 (f11765).
import { useRef, useEffect } from "react";
import { View } from "react-native";
import GuildChannelStore from "../../../../../stores/GuildChannelStore";
import { HUB_PROGRESS_ACTION_SHEET_ID, HUB_PROGRESS_NUM_TOTAL_STEPS } from "../../../HubProgressBarConstants";
import { AnalyticEvents, AnalyticsLocations, InstantInviteSources, Routes } from "../../../../../Constants";
import { DirectoryChannelScrollBehavior } from "../../../../directory_channels/native/GuildDirectoryConstants";
import { AnalyticsActions, AnalyticsSetupTypes } from "../../../../guild_progress/GuildProgressConstants";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { useHubProgressBarCompletedSteps } from "../../../HubProgressBarUtils";
import { MIN_PROGRESS_PERCENT } from "../../../../guild_progress/native/GuildProgressUtils";
import AnalyticsUtils from "../../../../../utils/AnalyticsUtils";
import { skipHubProgress } from "../../../HubProgressActionCreators";
import { intl, t } from "../../../../../intl/index.native";
import { GuildProgressHeader } from "../../../../guild_progress/native/action_sheet/GuildProgressActionSheet";
import { Text } from "../../../../../design/components/Text/native/Text";
import ProgressItem from "../../../../guild_progress/native/components/ProgressItem";
import { transitionTo } from "../../../../routing/router_utils";
import Module11765 from "../../../../../_bundle/Module11765";
import { HubProgressStep } from "../../../../../_bundle/Module1306";
import { handleOpenInviteActionsheet } from "../../../../instant_invite/native/InstantInviteUtils";
import Module11766 from "../../../../../_bundle/Module11766";
import { openContactSyncModal } from "../../../../contact_sync/native/ContactSyncModalActionCreators";
import Module11854 from "../../../../../_bundle/Module11854";
import { Button } from "../../../../../design/components/Button/native/Button.native";
import { PressableOpacity } from "../../../../../design/void/Pressables/native/Pressables";
import { BottomSheet } from "../../../../../design/components/Sheet/native/BottomSheet.native";
const useStyles = createStyles({
container: {
padding: 16
},
footer: {
marginTop: 12,
display: "flex",
alignItems: "center"
}
});
export default function HubProgressActionSheet(props) {
const { guild, analyticsSource } = props;
const styles = useStyles();
const hubProgressBarCompletedSteps = useHubProgressBarCompletedSteps(guild);
const size = hubProgressBarCompletedSteps.size;
const r3 = Math.max(MIN_PROGRESS_PERCENT, 100 * size / HUB_PROGRESS_NUM_TOTAL_STEPS) === 100;
const ref = useRef(analyticsSource);
useEffect(() => {
ref.current = analyticsSource;
});
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: "Hub Progress Action Sheet",
guild_id: guild.id,
source: ref.current
});
}, [guild.id]);
const title = r3 ? intl.string(t.zQ4gGo) : intl.string(t.hRVjpT);
const handleFinishPress = function handleFinishPress() {
AnalyticsUtils.track(AnalyticEvents.SERVER_SETUP_CTA_CLICKED, {
setup_type: AnalyticsSetupTypes.HUB_PROGRESS,
action: AnalyticsActions.DISMISS,
num_total_actions: HUB_PROGRESS_NUM_TOTAL_STEPS,
num_actions_completed: size
});
skipHubProgress(guild.id);
ActionSheetActionCreators.hideActionSheet(HUB_PROGRESS_ACTION_SHEET_ID);
};
return <BottomSheet startExpanded>
<View style={styles.container}>
<GuildProgressHeader title={title} subtitle={intl.format(t.l6iRLs, {
numFinished: size,
total: HUB_PROGRESS_NUM_TOTAL_STEPS,
stepsHook: (a0, a1) => <Text key={a1} variant="text-sm/medium" color="mobile-text-heading-primary">
{a0}
</Text>
})} />
<ProgressItem onPress={function onPress() {
const defaultChannel = GuildChannelStore.getDefaultChannel(guild.id);
if (defaultChannel != null) {
transitionTo(Routes.CHANNEL(guild.id, defaultChannel.id), {
state: {
scrollBehavior: DirectoryChannelScrollBehavior.GUILD_LIST_TOP
}
});
ActionSheetActionCreators.hideActionSheet(HUB_PROGRESS_ACTION_SHEET_ID);
}
}} source={Module11765} title={intl.string(t.iNR25n)} isCompleted={hubProgressBarCompletedSteps.has(HubProgressStep.JOIN_GUILD)} analyticsSetupType={AnalyticsSetupTypes.HUB_PROGRESS} analyticsAction={AnalyticsActions.JOIN_GUILD} />
<ProgressItem onPress={function onPress() {
const defaultChannel = GuildChannelStore.getDefaultChannel(guild.id);
const channels = GuildChannelStore.getChannels(guild.id);
if (defaultChannel != null && channels != null) {
handleOpenInviteActionsheet(guild, defaultChannel.id, channels, InstantInviteSources.HUB_PROGRESS);
}
}} source={Module11766} title={intl.string(t["3NlTYU"])} isCompleted={hubProgressBarCompletedSteps.has(HubProgressStep.INVITE_USER)} analyticsSetupType={AnalyticsSetupTypes.HUB_PROGRESS} analyticsAction={AnalyticsActions.INVITE} />
<ProgressItem onPress={function onPress() {
if (!hubProgressBarCompletedSteps.has(HubProgressStep.CONTACT_SYNC)) {
openContactSyncModal({}, AnalyticsLocations.HUB_PROGRESS);
ActionSheetActionCreators.hideActionSheet(HUB_PROGRESS_ACTION_SHEET_ID);
}
}} source={Module11854} title={intl.string(t.HFvFte)} isCompleted={hubProgressBarCompletedSteps.has(HubProgressStep.CONTACT_SYNC)} analyticsSetupType={AnalyticsSetupTypes.HUB_PROGRESS} analyticsAction={AnalyticsActions.CONTACT_SYNC} />
<View style={[styles.footer]}>
{r3 ? <Button text={intl.string(t["0/5zhg"])} onPress={handleFinishPress} /> : <PressableOpacity accessibilityRole="button" onPress={handleFinishPress}>
<Text variant="text-sm/medium" color="text-default">
{intl.string(t["9E36wf"])}
</Text>
</PressableOpacity>}
</View>
</View>
</BottomSheet>;
};
@@ -0,0 +1,60 @@
// Metro module 11763 (f11764).
import { View } from "react-native";
import { HUB_PROGRESS_ACTION_SHEET_ID, HUB_PROGRESS_NUM_TOTAL_STEPS } from "../../../HubProgressBarConstants";
import { GUILD_DIRECTORY_PROGRESS_BAR_HEIGHT } from "../../../../directory_channels/native/GuildDirectoryConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useHubProgressBarCompletedSteps, getNextHubProgressStep, getHubProgressTitleForStep } from "../../../HubProgressBarUtils";
import { HubProgressStep } from "../../../../../_bundle/Module1306";
import { intl, t } from "../../../../../intl/index.native";
import { FormCTA } from "../../../../../design/void/Form/native/index";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import Module11855 from "../../../../../_bundle/Module11855";
const useStyles = createStyles({
container: {
overflow: "hidden",
height: GUILD_DIRECTORY_PROGRESS_BAR_HEIGHT,
padding: 16
},
icon: {
width: 48,
height: 48
},
innerContainer: {
paddingVertical: 8,
paddingLeft: 8,
paddingRight: 12,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
}
});
export default function HubProgressHeader(props) {
const guild = props.guild;
let onDirectoryPage = props.onDirectoryPage;
if (onDirectoryPage === void 0) {
onDirectoryPage = false;
}
let c19138_1 = onDirectoryPage;
const styles = useStyles();
const hubProgressBarCompletedSteps = useHubProgressBarCompletedSteps(guild);
const nextHubProgressStep = getNextHubProgressStep(hubProgressBarCompletedSteps);
if (nextHubProgressStep == null) {
return null;
}
const size = hubProgressBarCompletedSteps.size;
if (onDirectoryPage) {
onDirectoryPage = nextHubProgressStep === HubProgressStep.JOIN_GUILD;
}
return <View style={styles.container}>
<FormCTA style={styles.innerContainer} iconStyle={styles.icon} onPress={function onPress() {
if (!(c19138_1 && nextHubProgressStep === HubProgressStep.JOIN_GUILD)) {
ActionSheetActionCreators.openLazy(import("./HubProgressActionSheet"), HUB_PROGRESS_ACTION_SHEET_ID, {
guild,
analyticsSource: "Directory Channel Header"
});
}
}} iconSource={Module11855} title={getHubProgressTitleForStep(nextHubProgressStep)} subtitle={size < HUB_PROGRESS_NUM_TOTAL_STEPS ? intl.formatToPlainString(t["9j7xDu"], {
number: `${size}`,
total: HUB_PROGRESS_NUM_TOTAL_STEPS
}) : intl.string(t["+Gyklt"])} trailing={onDirectoryPage ? <View /> : void 0} />
</View>;
};
@@ -0,0 +1,25 @@
// Metro module 15180 (f15181).
import { HUB_PROGRESS_ACTION_SHEET_ID, HUB_PROGRESS_NUM_TOTAL_STEPS } from "../../../HubProgressBarConstants";
import { useHubProgressBarCompletedSteps, getNextHubProgressStep, getHubProgressTitleForStep } from "../../../HubProgressBarUtils";
import { intl, t } from "../../../../../intl/index.native";
import { MIN_PROGRESS_PERCENT } from "../../../../guild_progress/native/GuildProgressUtils";
import { GuildProgressOverviewView } from "../../../../guild_progress/native/components/GuildProgressOverview";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
export default function HubSidebarProgressOverview(props) {
const guild = props.guild;
const hubProgressBarCompletedSteps = useHubProgressBarCompletedSteps(guild);
const nextHubProgressStep = getNextHubProgressStep(hubProgressBarCompletedSteps);
if (nextHubProgressStep == null) {
return null;
}
const size = hubProgressBarCompletedSteps.size;
return <GuildProgressOverviewView onPress={function onPress() {
ActionSheetActionCreators.openLazy(import("./HubProgressActionSheet"), HUB_PROGRESS_ACTION_SHEET_ID, {
guild,
analyticsSource: "Channels Sidebar"
});
}} title={getHubProgressTitleForStep(nextHubProgressStep)} subtitle={size < HUB_PROGRESS_NUM_TOTAL_STEPS ? intl.formatToPlainString(t["9j7xDu"], {
number: `${size}`,
total: HUB_PROGRESS_NUM_TOTAL_STEPS
}) : intl.string(t["+Gyklt"])} percentComplete={Math.max(MIN_PROGRESS_PERCENT, 100 * size / HUB_PROGRESS_NUM_TOTAL_STEPS)} />;
};
+17
View File
@@ -0,0 +1,17 @@
// Metro module 11472 (f11473).
import GuildStore from "../../stores/GuildStore";
import { GuildFeatures } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
export default function useIsHubForGuild(a0) {
return useStateFromStores([GuildStore], () => {
if (a0 == null) {
return false;
}
const guild = GuildStore.getGuild(a0);
let r8 = guild == null ? void 0 : guild.features.has(GuildFeatures.HUB);
if (r8 == null) {
r8 = false;
}
return r8;
}, [a0]);
};
@@ -0,0 +1,32 @@
// Metro module 11743 (f11744).
import { useEffect } from "react";
import GuildPromptsStore from "../guild/GuildPromptsStore";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildStore from "../../stores/GuildStore";
import UserStore from "../../stores/UserStore";
import { GuildFeatures } from "../../Constants";
import { GuildPrompts } from "../guild/Constants";
import { useStateFromStores } from "../../_bundle/Module589";
import GuildPromptsActionCreators from "../guild/GuildPromptsActionCreators";
export default function useIsHubRealNamePromptShowing(a0) {
const stateFromStores = useStateFromStores([GuildStore, GuildPromptsStore, UserStore, GuildMemberStore], () => {
const guild = GuildStore.getGuild(a0);
if ((guild == null ? void 0 : guild.features.has(GuildFeatures.HUB)) !== true) {
return null;
}
if (GuildPromptsStore.hasViewedPrompt(GuildPrompts.REAL_NAME_PROMPT, guild.id) === true) {
return null;
}
const currentUser = UserStore.getCurrentUser();
if (currentUser == null) {
return null;
}
return GuildMemberStore.getMember(guild.id, currentUser?.id)?.nick == null;
});
useEffect(() => {
if (a0 != null && stateFromStores != null && !stateFromStores) {
GuildPromptsActionCreators.viewPrompt(GuildPrompts.REAL_NAME_PROMPT, a0);
}
}, [stateFromStores, a0]);
return stateFromStores === true;
};