98 lines
3.7 KiB
TypeScript
98 lines
3.7 KiB
TypeScript
// Metro module 9184 (f9185).
|
|
import { useState, useRef, useEffect, useCallback } from "react";
|
|
import { View } from "react-native";
|
|
import UserRequiredActionStore from "../../../../stores/UserRequiredActionStore";
|
|
import UserStore from "../../../../stores/UserStore";
|
|
import { VerificationModalScenes } 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 Module38 from "../../../../_bundle/Module38";
|
|
import VerificationUtils from "../../VerificationUtils";
|
|
import EmailVerificationModalActionCreators from "../../../../actions/native/EmailVerificationModalActionCreators";
|
|
import { EnvelopeOpenSpotIllustration } from "../../../../design/assets/native";
|
|
import { Text } from "../../../../design/components/Text/native/Text";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { Button } from "../../../../design/components/Button/native/Button.native";
|
|
import AuthenticationActionCreators from "../../../../actions/AuthenticationActionCreators";
|
|
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
|
|
const useStyles = createStyles({
|
|
container: {
|
|
flex: 1,
|
|
padding: 16,
|
|
justifyContent: "center",
|
|
alignItems: "center"
|
|
},
|
|
title: {
|
|
marginTop: 16,
|
|
textAlign: "center"
|
|
},
|
|
body: {
|
|
marginTop: 8,
|
|
lineHeight: 18,
|
|
textAlign: "center"
|
|
},
|
|
resend: {
|
|
marginTop: 16,
|
|
width: "100%"
|
|
},
|
|
change: {
|
|
marginTop: 8,
|
|
width: "100%"
|
|
}
|
|
});
|
|
export default function ResendEmail() {
|
|
let verified, ref;
|
|
const styles = useStyles();
|
|
const navigation = useNavigation();
|
|
const stateFromStores = useStateFromStores([UserStore], () => {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
Module38(currentUser != null, "ResendEmail: user cannot be undefined");
|
|
return currentUser;
|
|
});
|
|
const email = stateFromStores.email;
|
|
verified = stateFromStores.verified;
|
|
const isEmailReverification = VerificationUtils.isEmailReverification(useStateFromStores([UserRequiredActionStore], () => UserRequiredActionStore.getAction()));
|
|
let r42 = !isEmailReverification;
|
|
const [state, setState] = useState(false);
|
|
ref = useRef(verified);
|
|
useEffect(() => {
|
|
let r1 = verified;
|
|
if (verified) {
|
|
r1 = ref.current === false;
|
|
}
|
|
if (r1) {
|
|
EmailVerificationModalActionCreators.close();
|
|
}
|
|
}, [verified]);
|
|
useEffect(() => {
|
|
ref.current = verified;
|
|
});
|
|
const callback = useCallback(() => {
|
|
navigation.push(VerificationModalScenes.ENTER_EMAIL);
|
|
}, [navigation]);
|
|
const r70 = [<EnvelopeOpenSpotIllustration scale={0.75} />, <Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
|
|
{intl.string(t.fUtddV)}
|
|
</Text>, <Text style={styles.body} variant="text-sm/medium" color="text-default">
|
|
{state ? intl.format(t.JqLgQL, {
|
|
email
|
|
}) : intl.string(t.tSXg8O)}
|
|
</Text>, <View style={styles.resend}>
|
|
<Button text={intl.string(t.WnX4J2)} variant="primary" onPress={function onPress() {
|
|
setState(true);
|
|
AuthenticationActionCreators.verifyResend();
|
|
ToastActionCreators.open({
|
|
key: "USER_SETTINGS_ACCOUNT_CHANGE_EMAIL_CONFIRM_CODE_SENT",
|
|
content: intl.string(t["84yeoz"])
|
|
});
|
|
}} grow />
|
|
</View>, ,];
|
|
if (!isEmailReverification) {
|
|
r42 = <View style={styles.change}>
|
|
<Button text={intl.string(t.Vm8akB)} variant="secondary" onPress={callback} grow />
|
|
</View>;
|
|
}
|
|
r70[4] = r42;
|
|
return <View style={styles.container}>{r70}</View>;
|
|
};
|