// 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 {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} {intl.format(t["6kzaqs"], { onClick: () => { ActionSheetActionCreators.openLazy(import("./HubEmailConnectionDescriptionActionsheet"), "HubEmailConnectionDescriptionActionsheet"); } })} { setTimeout(() => { const current = ref.current; if (current != null) { current.scrollToEnd(); } }, 100); }} onBlur={() => { setTimeout(() => { const current = ref.current; if (current != null) { current.scrollToEnd(); } }, 100); }} />