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

+10
View File
@@ -0,0 +1,10 @@
// Metro module 14765 (f14766).
import { SELECT_NAMES } from "./MFAConstants";
import * as _MFAModal from "./native/MFAModal";
import { trySubmit } from "../../_bundle/finishMFACheck";
export function openMFAModal(a0, c21325_0, a2) {
a0.methods = a0.methods.filter((method) => Object.hasOwn(SELECT_NAMES, method.type));
_MFAModal.openMFAModal(a0, function(a0) {
return trySubmit(a0, c21325_0);
}, a2);
}
+44
View File
@@ -0,0 +1,44 @@
// Metro module 14766 (f14767).
import { intl, t } from "../../intl/index.native";
const r11 = {};
Object.defineProperty(r11, "webauthn", {
get: function() {
return intl.string(t.gTH4Dp);
},
set: void 0,
enumerable: true,
configurable: true
});
Object.defineProperty(r11, "totp", {
get: function() {
return intl.string(t.nXKmyf);
},
set: void 0,
enumerable: true,
configurable: true
});
Object.defineProperty(r11, "sms", {
get: function() {
return intl.string(t.ZbVwZW);
},
set: void 0,
enumerable: true,
configurable: true
});
Object.defineProperty(r11, "password", {
get: function() {
return intl.string(t["8F6hKS"]);
},
set: void 0,
enumerable: true,
configurable: true
});
Object.defineProperty(r11, "backup", {
get: function() {
return intl.string(t.vhSRKf);
},
set: void 0,
enumerable: true,
configurable: true
});
export { r11 as SELECT_NAMES };
+158
View File
@@ -0,0 +1,158 @@
// Metro module 14767 (f14768).
import { useMemo, useCallback } from "react";
import { LogBox, Keyboard } from "react-native";
import { hasWebAuthn } from "../../../utils/MFAUtils";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { intl, t } from "../../../intl/index.native";
import { MfaScreens } from "./MfaStepsTypes";
import { HeaderActionButton } from "../../../design/components/Navigator/native/HeaderActionButton.native";
import Module7699 from "../../../_bundle/Module7699";
import { getHeaderBackButton, getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import SelectScreen from "./screens/SelectScreen";
import WebAuthnScreen from "./screens/WebAuthnScreen";
import TotpScreen from "./screens/TotpScreen";
import BackupScreen from "./screens/BackupScreen";
import SmsScreen from "./screens/SmsScreen";
import PasswordScreen from "./screens/PasswordScreen";
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
let c10414_7;
let env10414 = {};
export function MFAModal(props) {
let env21326 = {
$parent: env10414
};
const { mfaChallenge, finish, cancel, handleOnClose, ignoreKeyboard: _ignoreKeyboard, ...props2 } = props;
env21326[0] = mfaChallenge;
env21326[1] = finish;
env21326[2] = cancel;
env21326[3] = handleOnClose;
let ignoreKeyboard = props.ignoreKeyboard;
if (ignoreKeyboard === void 0) {
ignoreKeyboard = false;
}
let c21327_0;
env21326[4] = ignoreKeyboard;
env21326[5] = void 0;
env21326[6] = void 0;
env21326[7] = void 0;
const memo = useMemo(() => {
const r13 = env21326[0];
return hasWebAuthn ? r13 : {
...r13,
methods: r13.methods.filter((method) => method.type !== "webauthn")
};
}, [mfaChallenge]);
env21326[5] = memo;
c21327_0 = void 0;
c21327_0 = async (c30766_0) => {
let c30766_2;
c30766_2 = void 0;
let c31730_0 = c30766_0.mfaType;
let c31730_1 = c30766_0.data;
await void 0;
const r42 = c30766_2.$parent;
await (0, r42[1])({
mfaType: c31730_0,
data: c31730_1,
ticket: r42[5].ticket
});
ModalActionCreators.popWithKey(c10414_7);
};
const callback = useCallback(function() {
return c21327_0.apply(this, arguments);
}, [finish, memo.ticket]);
env21326[6] = callback;
const callback2 = useCallback(() => {
const r2 = env21326[3];
if (r2 == null) {
ModalActionCreators.popWithKey(c10414_7);
const r16 = env21326[2];
if (r16 != null) {
r16(new Error(intl.string(t.N2yb9a)));
}
} else {
r2();
}
}, [cancel, handleOnClose]);
env21326[7] = callback2;
const memo2 = useMemo(() => {
const mfaChallenge = env21326[5];
const finish = env21326[6];
const r4 = {
name: MfaScreens.SELECT,
params: {
mfaChallenge,
finish
}
};
const type = mfaChallenge.methods[0]?.type;
return type === void 0 ? [r4] : [{
name: type,
params: {
mfaChallenge,
finish
}
}];
}, [memo, callback]);
return <Navigator screens={useMemo(() => {
const headerRight = function headerRight() {
return <HeaderActionButton accessibilityLabel={intl.string(t.cpT0Cq)} onPress={env21326[7]} source={Module7699} />;
};
const r9 = {
fullscreen: true,
ignoreKeyboard: env21326[4],
headerTitle: ""
};
const r20 = {};
r20[MfaScreens.SELECT] = {
...r9,
headerLeft: getHeaderBackButton(),
headerRight,
render: (a0) => <SelectScreen {...a0} />
};
const WEBAUTHN = MfaScreens.WEBAUTHN;
const r36 = env21326[5];
r20[WEBAUTHN] = {
...r9,
headerLeft: r36.methods[0]?.type === "webauthn" ? getHeaderCloseButton(env21326[7]) : getHeaderBackButton(),
headerRight: r36.methods[0]?.type !== "webauthn" ? headerRight : void 0,
render: (a0) => <WebAuthnScreen {...a0} />
};
r20[MfaScreens.TOTP] = {
...r9,
headerLeft: r36.methods[0]?.type === "totp" ? getHeaderCloseButton(env21326[7]) : getHeaderBackButton(),
headerRight: r36.methods[0]?.type !== "totp" ? headerRight : void 0,
render: (a0) => <TotpScreen {...a0} />
};
r20[MfaScreens.BACKUP] = {
...r9,
headerLeft: r36.methods[0]?.type === "backup" ? getHeaderCloseButton(env21326[7]) : getHeaderBackButton(),
headerRight: r36.methods[0]?.type !== "backup" ? headerRight : void 0,
render: (a0) => <BackupScreen {...a0} />
};
r20[MfaScreens.SMS] = {
...r9,
headerLeft: r36.methods[0]?.type === "sms" ? getHeaderCloseButton(env21326[7]) : getHeaderBackButton(),
headerRight: r36.methods[0]?.type !== "sms" ? headerRight : void 0,
render: (a0) => <SmsScreen {...a0} />
};
r20[MfaScreens.PASSWORD] = {
...r9,
headerLeft: r36.methods[0]?.type === "password" ? getHeaderCloseButton(env21326[7]) : getHeaderBackButton(),
headerRight: r36.methods[0]?.type !== "password" ? headerRight : void 0,
render: (a0) => <PasswordScreen {...a0} />
};
return r20;
}, [callback2, memo.methods, ignoreKeyboard])} initialRouteStack={memo2} onWillFocus={Keyboard.dismiss} {...props2} />;
}
LogBox.ignoreLogs(["Non-serializable values were found in the navigation state"]);
c10414_7 = "MFA_MODAL_KEY";
export function openMFAModal(a0, a1, a2) {
ModalActionCreators.push(MFAModal, {
mfaChallenge: a0,
finish: a1,
cancel: a2
}, c10414_7);
AlertActionCreators.close();
}
+48
View File
@@ -0,0 +1,48 @@
// Metro module 14772 (f14773).
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { NAV_BAR_HEIGHT, STATUS_BAR_HEIGHT } from "../../../design/components/Navigator/native/NavigatorConstants.native";
import Module712 from "../../../_bundle/Module712";
const r17 = {
useScreenStyles: createStyles((a0) => ({
contentContainer: {
marginTop: a0 ? NAV_BAR_HEIGHT : NAV_BAR_HEIGHT - STATUS_BAR_HEIGHT,
marginLeft: a0 ? Module712.space.PX_24 : Module712.space.PX_16,
marginRight: a0 ? Module712.space.PX_24 : Module712.space.PX_16,
paddingBottom: a0 ? Module712.space.PX_24 : Module712.space.PX_16,
flex: 1,
flexDirection: "column",
justifyContent: "space-between",
alignItems: "stretch"
},
mfaContainerHeader: {
flexDirection: "column",
alignItems: "center",
paddingBottom: Module712.space.PX_24
},
mfaContainerHeaderText: {
marginHorizontal: a0 ? 0 : Module712.space.PX_32,
marginTop: a0 ? 0 : Module712.space.PX_12,
textAlign: "center"
},
inputContainer: {
flexDirection: "column",
alignSelf: "stretch"
},
smsContainer: {
flexDirection: "column",
alignSelf: "stretch"
},
smsInput: {
flexDirection: "row",
alignSelf: "stretch"
},
radioItem: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.md
},
submit: {
paddingTop: Module712.space.PX_24
}
}))
};
export default r17;
+10
View File
@@ -0,0 +1,10 @@
// Metro module 14768 (f14769).
const r8 = {
BACKUP: "backup",
PASSWORD: "password",
SELECT: "select",
SMS: "sms",
TOTP: "totp",
WEBAUTHN: "webauthn"
};
export { r8 as MfaScreens };
@@ -0,0 +1,12 @@
// Metro module 14773 (f14774).
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import MFAButton from "./button";
import { intl, t } from "../../../../intl/index.native";
import { MfaScreens } from "../MfaStepsTypes";
export default function BackButton(props2) {
const props = props2.props;
const navigation = useNavigation();
return <MFAButton variant="secondary" text={intl.string(t.Tot4EC)} onPress={() => {
navigation.push(MfaScreens.SELECT, props);
}} />;
};
@@ -0,0 +1,69 @@
// Metro module 14777 (f14778).
import { useRef, useEffect } from "react";
import { View } from "react-native";
import AppStateStore from "../../../../stores/native/AppStateStore";
import { AppStates } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useStableCallback from "../../../../hooks/useStableCallback";
import { runAfterInteractions } from "../../../../utils/native/RunAfterInteractionsUtils";
import { getString } from "../../../../utils/ClipboardUtils.native";
import { TextInput } from "../../../../design/components/TextInput/native/TextInput.native";
function $mk118922($env) {
return (a0) => runAfterInteractions(a0);
}
let env10423 = {};
const useStyles = createStyles({
inputContainer: {
flexDirection: "column",
alignSelf: "stretch"
}
});
export default function ClipboardCopyInput(props) {
const { label, placeholder, isValidClipboardCode, maxLength, onChangeCode, error, textContentType, autoComplete, keyboardType, isDisabled, autoFocus = true } = props;
let c21334_3;
c21334_3 = void 0;
const styles = useStyles();
const ref = useRef(null);
const ref2 = useRef(null);
const stateFromStores = useStateFromStores([AppStateStore], () => AppStateStore.getState());
const stableCallback = useStableCallback(onChangeCode);
const stableCallback2 = useStableCallback(isValidClipboardCode);
c21334_3 = stableCallback2;
useEffect(() => {
let _run2 = function _run() {
const r9 = async () => {
let c31733_1;
let env32060;
c31733_1 = void 0;
const r27 = env32060 = {
$parent: env10423
};
let c31733_0 = r27;
env32060[0] = void 0;
await new Promise((resolve) => setTimeout(resolve, 500));
await new Promise($mk118922(env10423));
env32060[0] = (await getString()).trim();
if (env32060[0] !== ref.current) {
ref.current = env32060[0];
if ((0, c21334_3)(env32060[0])) {
const current = ref2.current;
if (current != null) {
current.setText(env32060[0]);
}
}
}
};
_run2 = r9;
return r9.apply(this, arguments);
};
if (stateFromStores === AppStates.ACTIVE) {
(function run() {
return _run2.apply(this, arguments);
})();
}
}, [stateFromStores, stableCallback2, stableCallback]);
return <View style={styles.inputContainer}>
<TextInput ref={ref2} autoFocus={autoFocus} autoCorrect={false} autoCapitalize="none" errorMessage={error} maxLength={maxLength} onChange={onChangeCode} label={label} accessibilityLabel={label} placeholder={placeholder} isClearable textContentType={textContentType} autoComplete={autoComplete} keyboardType={keyboardType} isDisabled={isDisabled} />
</View>;
};
@@ -0,0 +1,14 @@
// Metro module 13770 (f13771).
import { Image as Image2 } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module13771 from "../../../../_bundle/Module13771";
const useStyles = createStyles({
icon: {
width: 128,
height: 128,
marginBottom: 8
}
});
export function KeyImage() {
return <Image2 source={Module13771} style={useStyles().icon} />;
}
+5
View File
@@ -0,0 +1,5 @@
// Metro module 14774 (f14775).
import { Button } from "../../../../design/components/Button/native/Button.native";
export default function MFAButton(props) {
return <Button size="lg" {...props} />;
};
+150
View File
@@ -0,0 +1,150 @@
// Metro module 14778 (f14779).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useState, useEffect, useCallback } from "react";
import { BACKUP_CODE_MIN_LENGTH, BACKUP_CODE_MAX_LENGTH } from "../../../../_bundle/finishMFACheck";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import useWideAuthView from "../../../auth/native/useWideAuthView";
import MfaOptionScreen from "./MfaOptionScreen";
import ClipboardCopyInput from "../components/ClipboardCopyInput";
import MFAButton from "../components/button";
const isValidClipboardCode = function isValidClipboardCode(a0) {
return a0.length >= BACKUP_CODE_MIN_LENGTH && a0.length <= BACKUP_CODE_MAX_LENGTH;
};
export default function BackupScreen(props) {
let c21336_0;
let env21335 = {};
const { mfaChallenge, finish } = props;
env21335[0] = finish;
env21335[1] = void 0;
env21335[2] = void 0;
env21335[3] = void 0;
env21335[4] = void 0;
env21335[5] = void 0;
env21335[6] = void 0;
env21335[7] = void 0;
env21335[8] = void 0;
const wideAuthView = useWideAuthView();
const r34 = _slicedToArray(useState(false), 2);
let disabled = r34[0];
env21335[1] = r34[1];
const r38 = _slicedToArray(useState(""), 2);
const r14 = r38[0];
env21335[2] = r14;
env21335[3] = r38[1];
const r42 = _slicedToArray(useState(void 0), 2);
const error = r42[0];
env21335[4] = r42[1];
const r46 = _slicedToArray(useState(false), 2);
const r16 = r46[0];
env21335[5] = r46[1];
const r50 = _slicedToArray(useState(10), 2);
const countdown = r50[0];
env21335[6] = countdown;
env21335[7] = r50[1];
useEffect(() => {
if (env21335[6] <= 0) {
return void 0;
}
let c27801_0 = setTimeout(() => {
(0, env21335[7])((a0) => a0 - 1);
}, 1000);
return () => clearTimeout(c27801_0);
}, [countdown]);
c21336_0 = void 0;
c21336_0 = async (data) => {
let message, c30770_4;
let c30770_5 = 0;
let c31734_0;
L10: {
try {
(0, env21335[4])(void 0);
(0, env21335[1])(true);
c30770_5 = 1;
await (0, env21335[0])({
mfaType: "backup",
data
});
(0, env21335[5])(true);
c30770_5 = 0;
(0, env21335[1])(false);
} catch ($e) {
const r26 = $e;
let r7 = r26;
c30770_4 = r26;
if (c30770_5 !== 0) {
while (true) {
try {
const r70 = c30770_4;
c30770_5 = 0;
c31734_0 = r70;
const r73 = env21335[4];
const r74 = c31734_0;
message = r74 == null ? void 0 : r74.body?.message;
if (message == null) {
message = c31734_0.message;
}
r73(message);
(0, env21335[1])(false);
break L10;
} catch (r66) {
r7 = r66;
c30770_4 = r66;
if (c30770_5 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
env21335[8] = useCallback(function() {
return c21336_0.apply(this, arguments);
}, [finish]);
const props2 = {
headerText: intl.string(t.B2T1HD),
subtitle: intl.string(t.c5J7O0),
input: <>
{[<Text {...countdown > 0 ? {
variant: "text-md/normal",
children: [intl.string(t.RRtlLg), intl.format(t.tsWkAE, {
countdown
})]
} : {
variant: "text-md/normal",
children: [intl.string(t.RRtlLg), intl.string(t.v3a6Pd)]
}} />, <ClipboardCopyInput label={intl.string(t["C/ZAw/"])} placeholder={intl.string(t.fZSi1D)} isValidClipboardCode={isValidClipboardCode} maxLength={BACKUP_CODE_MAX_LENGTH} onChangeCode={function onChangeCode(event) {
(0, env21335[3])(event);
(0, env21335[4])(void 0);
}} error={error} isDisabled={disabled ? disabled : r16} autoFocus={!wideAuthView} />]}
</>,
submit: null,
screenProps: null,
mfaMethod: "backup"
};
const props3 = {
variant: "primary",
text: intl.string(t.geKm7t),
loading: disabled ? disabled : r16,
onPress: () => (0, env21335[8])(env21335[2]),
disabled: null
};
if (!disabled) {
disabled = r16;
}
if (!disabled) {
disabled = r14.length < BACKUP_CODE_MIN_LENGTH;
}
if (!disabled) {
disabled = countdown > 0;
}
props3.disabled = disabled;
props2.submit = <MFAButton {...props3} />;
props2.screenProps = {
mfaChallenge,
finish
};
return <MfaOptionScreen {...props2} />;
};
@@ -0,0 +1,34 @@
// Metro module 14771 (f14772).
import { ScrollView } from "react-native";
import useWideAuthView from "../../../auth/native/useWideAuthView";
import MfaScreenUtils from "../MfaScreenUtils";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { Stack } from "../../../../design/components/Stack/native/Stack.native";
import { Text } from "../../../../design/components/Text/native/Text";
import BackButton from "../components/BackButton";
import BackgroundImage from "../../../auth/native/components/atoms/BackgroundImage";
export default function MFAOptionScreen(props) {
const { headerText, headerImage, subtitle, input, submit, screenProps, mfaMethod, error, content } = props;
const wideAuthView = useWideAuthView();
const styles = MfaScreenUtils.useScreenStyles(wideAuthView);
const type = screenProps.mfaChallenge.methods[0]?.type;
const r48 = [headerImage != null && headerImage, <Text variant="heading-xl/extrabold" style={styles.mfaContainerHeaderText}>{headerText}</Text>, subtitle != null && <Text variant="heading-sm/normal" color="text-default">{subtitle}</Text>, ,];
const r58 = error != null && <Text variant="text-sm/normal" color="text-feedback-critical">{error}</Text>;
let r63 = type === mfaMethod;
r48[3] = r58;
const r68 = [<Stack>
<Stack style={styles.mfaContainerHeader} spacing={4}>{r48}</Stack>
{input}
</Stack>, content, ,];
const r74 = [submit, ,];
if (r63) {
r63 = <BackButton props={screenProps} />;
}
r74[1] = r63;
r68[2] = <Stack style={styles.submit}>{r74}</Stack>;
const r79 = <SafeAreaPaddingView bottom={!wideAuthView} top={!wideAuthView} style={styles.contentContainer}>{r68}</SafeAreaPaddingView>;
return <>
<BackgroundImage backgroundImageCover={false} />
{wideAuthView ? <ScrollView keyboardShouldPersistTaps="handled">{r79}</ScrollView> : r79}
</>;
};
@@ -0,0 +1,106 @@
// Metro module 14780 (f14781).
import { useState } from "react";
import { View } from "react-native";
import useWideAuthView from "../../../auth/native/useWideAuthView";
import MfaScreenUtils from "../MfaScreenUtils";
import MfaOptionScreen from "./MfaOptionScreen";
import { intl, t } from "../../../../intl/index.native";
import { TextInput } from "../../../../design/components/TextInput/native/TextInput.native";
import MFAButton from "../components/button";
export default function PasswordScreen(props) {
let setState, state, setState2, setState3, _sendPassword2;
const { mfaChallenge, finish } = props;
setState = void 0;
state = void 0;
setState2 = void 0;
setState3 = void 0;
const sendPassword = function sendPassword() {
return _sendPassword2.apply(this, arguments);
};
_sendPassword2 = function _sendPassword() {
const r9 = async () => {
let message, c30773_3;
let c30773_4 = 0;
let c31737_0;
L10: {
try {
setState(null);
setState2(true);
c30773_4 = 1;
await finish({
mfaType: "password",
data: state
});
(0, setState3)(true);
c30773_4 = 0;
(0, setState2)(false);
} catch ($e) {
const r25 = $e;
let r7 = r25;
c30773_3 = r25;
if (c30773_4 !== 0) {
while (true) {
try {
const r66 = c30773_3;
c30773_4 = 0;
c31737_0 = r66;
const message2 = c31737_0.body?.message;
message = message2;
if (message2 == null) {
message = c31737_0.message;
}
setState(message);
(0, setState2)(false);
break L10;
} catch (r62) {
r7 = r62;
c30773_3 = r62;
if (c30773_4 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
_sendPassword2 = r9;
return r9.apply(this, arguments);
};
const styles = MfaScreenUtils.useScreenStyles(useWideAuthView());
let errorMessage;
[errorMessage, setState] = useState(null);
let onChange;
[state, onChange] = useState("");
let loading;
[loading, setState2] = useState(false);
let state2;
[state2, setState3] = useState(false);
const props2 = {
headerText: intl.string(t.Rw1XuM),
input: <View style={styles.inputContainer}>
<TextInput autoFocus required textContentType="password" label={intl.string(t["CIGa+7"])} placeholder={intl.string(t["CIGa+7"])} autoComplete="current-password" errorMessage={errorMessage} returnKeyType="done" onChange={onChange} onSubmitEditing={sendPassword} isDisabled={loading ? loading : state2} isClearable secureTextEntry />
</View>,
submit: null,
screenProps: null,
mfaMethod: "password"
};
const props3 = {
text: intl.string(t.geKm7t),
disabled: (loading ? loading : state2) || state.length === 0,
loading: null,
onPress: null
};
if (!loading) {
loading = state2;
}
props3.loading = loading;
props3.onPress = sendPassword;
props2.submit = <MFAButton {...props3} />;
props2.screenProps = {
mfaChallenge,
finish
};
return <MfaOptionScreen {...props2} />;
};
@@ -0,0 +1,52 @@
// Metro module 14769 (f14770).
import { View } from "react-native";
import { SELECT_NAMES } from "../../MFAConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { NAV_BAR_HEIGHT, STATUS_BAR_HEIGHT } from "../../../../design/components/Navigator/native/NavigatorConstants.native";
import { RowButton } from "../../../../design/components/TableRow/native/RowButton.native";
import useWideAuthView from "../../../auth/native/useWideAuthView";
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";
const useStyles = createStyles((a0) => ({
container: {
marginLeft: 16,
marginRight: 16
},
selectContainer: {
marginTop: a0 ? NAV_BAR_HEIGHT : NAV_BAR_HEIGHT - STATUS_BAR_HEIGHT,
marginLeft: 16,
marginRight: 16,
display: "flex",
alignItems: "center"
}
}));
export default function SelectScreen(props) {
let c21328_0 = props;
const wideAuthView = useWideAuthView();
const styles = useStyles(wideAuthView);
const navigation = useNavigation();
return <SafeAreaPaddingView top={!wideAuthView} style={styles.container}>
<View style={styles.selectContainer}>
<Text variant="heading-xl/extrabold">
{intl.string(t.S9b9bX)}
</Text>
<Text variant="text-sm/medium">
{intl.string(t.Jz1lXO)}
</Text>
</View>
<View style={{
marginTop: 16,
gap: 8
}}>
{props.mfaChallenge.methods.map((method) => {
let c27797_0 = c21328_0;
const navigation2 = navigation;
return <RowButton key={method.type} label={SELECT_NAMES[method.type]} onPress={() => {
navigation2.push(method.type, c27797_0);
}} />;
})}
</View>
</SafeAreaPaddingView>;
};
+229
View File
@@ -0,0 +1,229 @@
// Metro module 14779 (f14780).
import { useState, useEffect } from "react";
import { View } from "react-native";
import { Endpoints } from "../../../../Constants";
import useWideAuthView from "../../../auth/native/useWideAuthView";
import MfaScreenUtils from "../MfaScreenUtils";
import { intl, t } from "../../../../intl/index.native";
import { HTTP } from "../../../../_bundle/sendRequest";
import { SMS_CODE_LENGTH } from "../../../../_bundle/finishMFACheck";
import MfaOptionScreen from "./MfaOptionScreen";
import { TextInput } from "../../../../design/components/TextInput/native/TextInput.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import MFAButton from "../components/button";
export default function SmsScreen(props) {
let setState, setState2, state, setState3, setState4, setState5, _handleChange2, _handleResend2;
const { mfaChallenge, finish } = props;
setState = void 0;
setState2 = void 0;
state = void 0;
setState3 = void 0;
setState4 = void 0;
setState5 = void 0;
const handleChange2 = function handleChange(a0) {
return _handleChange2.apply(this, arguments);
};
_handleChange2 = function _handleChange() {
const r9 = async (data) => {
let message, c30771_4;
let c30771_5 = 0;
let c31735_0;
L14: {
try {
setState3(data);
if (data.length === SMS_CODE_LENGTH) {
setState(null);
setState2(true);
c30771_5 = 1;
await finish({
mfaType: "sms",
data
});
(0, setState5)(true);
c30771_5 = 0;
(0, setState2)(false);
break L14;
}
} catch ($e) {
const r26 = $e;
let r7 = r26;
c30771_4 = r26;
if (c30771_5 !== 0) {
while (true) {
try {
const r76 = c30771_4;
c30771_5 = 0;
c31735_0 = r76;
const message3 = c31735_0.body?.message;
message = message3;
if (message3 == null) {
message = c31735_0.message;
}
setState(message);
(0, setState2)(false);
break L14;
} catch (r72) {
r7 = r72;
c30771_4 = r72;
if (c30771_5 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
};
_handleChange2 = r9;
return r9.apply(this, arguments);
};
_handleResend2 = function _handleResend() {
const r9 = async () => {
let message2, c30772_3;
let c30772_4 = 0;
let c31736_0, c31736_1;
L10: {
try {
c31736_0 = void 0;
setState(null);
setState2(true);
setState4(intl.string(t.LQdCQE));
c30772_4 = 2;
c31736_0 = await HTTP.post({
url: Endpoints.LOGIN_SMS_SEND,
body: {
ticket: mfaChallenge.ticket
},
oldFormErrors: true,
rejectWithError: false
});
setState4(intl.formatToPlainString(t["8r6h7+"], {
phoneNumber: c31736_0.body.phone
}));
c30772_4 = 1;
c30772_4 = 0;
(0, setState2)(false);
} catch ($e) {
const r29 = $e;
let r7 = r29;
c30772_3 = r29;
let r30 = c30772_4;
if (r30 !== 0) {
while (true) {
if (r30 === 1) {
try {
const r133 = c30772_3;
c30772_4 = 0;
(0, setState2)(false);
throw r133;
} catch (r131) {
r7 = r131;
c30772_3 = r131;
r30 = c30772_4;
if (r30 === 0) {
break;
}
}
} else {
try {
const r110 = c30772_3;
c30772_4 = 1;
c31736_1 = r110;
const message3 = c31736_1.message;
message2 = message3;
if (message3 == null) {
message2 = c31736_1.body?.message;
}
setState(message2);
(0, setState4)(void 0);
c30772_4 = 0;
(0, setState2)(false);
break L10;
} catch (r107) {
r7 = r107;
c30772_3 = r107;
r30 = c30772_4;
if (r30 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
_handleResend2 = r9;
return r9.apply(this, arguments);
};
const styles = MfaScreenUtils.useScreenStyles(useWideAuthView());
let errorMessage;
[errorMessage, setState] = useState(null);
let disabled;
[disabled, setState2] = useState(false);
[state, setState3] = useState("");
let subtitle;
[subtitle, setState4] = useState(intl.string(t.LQdCQE));
let state2;
[state2, setState5] = useState(false);
useEffect(() => {
setState(null);
HTTP.post({
url: Endpoints.LOGIN_SMS_SEND,
body: {
ticket: mfaChallenge.ticket
},
oldFormErrors: true,
rejectWithError: false
}).then((result) => {
setState4(intl.formatToPlainString(t["8r6h7+"], {
phoneNumber: result.body.phone
}));
}).catch((error) => {
let r4 = error.body?.message;
if (r4 == null) {
r4 = error.message;
}
setState(r4);
setState4(void 0);
});
}, [mfaChallenge.ticket]);
const props2 = {
headerText: intl.string(t.o4JNrO),
subtitle,
input: <View style={styles.inputContainer}>
<TextInput autoFocus autoCapitalize="characters" maxLength={SMS_CODE_LENGTH} autoComplete="sms-otp" textContentType="oneTimeCode" keyboardType="number-pad" onChange={handleChange2} label={intl.string(t["/sHnXc"])} accessibilityLabel={intl.string(t.HZPBOd)} placeholder={intl.string(t.tARzgo)} errorMessage={errorMessage} />
<Button text={intl.string(t.WbaP3r)} variant="secondary" size="sm" onPress={function handleResend() {
return _handleResend2.apply(this, arguments);
}} />
</View>,
submit: null,
screenProps: null,
mfaMethod: "sms"
};
const props3 = {
variant: "primary",
text: intl.string(t.geKm7t),
loading: disabled ? disabled : state2,
onPress: () => {
handleChange2(state);
},
disabled: null
};
if (!disabled) {
disabled = state2;
}
if (!disabled) {
disabled = state.length !== SMS_CODE_LENGTH;
}
props3.disabled = disabled;
props2.submit = <MFAButton {...props3} />;
props2.screenProps = {
mfaChallenge,
finish
};
return <MfaOptionScreen {...props2} />;
};
+124
View File
@@ -0,0 +1,124 @@
// Metro module 14775 (f14776).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useState, useCallback } from "react";
import { TOTP_CODE_LENGTH } from "../../../../_bundle/finishMFACheck";
import MfaOptionScreen from "./MfaOptionScreen";
import { intl, t } from "../../../../intl/index.native";
import ClipboardCopyInput from "../components/ClipboardCopyInput";
import MFAButton from "../components/button";
let env10421 = {};
const isValidClipboardCode = function isValidClipboardCode(a0) {
return a0.length === TOTP_CODE_LENGTH && /^\d+$/.test(a0);
};
export default function TotpScreen(props) {
let env21332 = {
$parent: env10421
};
const { mfaChallenge, finish } = props;
env21332[0] = finish;
env21332[1] = void 0;
env21332[2] = void 0;
env21332[3] = void 0;
env21332[4] = void 0;
env21332[5] = void 0;
env21332[6] = void 0;
const r25 = _slicedToArray(useState(false), 2);
let disabled = r25[0];
env21332[1] = r25[1];
const r29 = _slicedToArray(useState(""), 2);
const r12 = r29[0];
env21332[2] = r12;
env21332[3] = r29[1];
const r33 = _slicedToArray(useState(void 0), 2);
const error = r33[0];
env21332[4] = r33[1];
const r37 = _slicedToArray(useState(false), 2);
const r14 = r37[0];
env21332[5] = r37[1];
let c21333_0 = async (data) => {
let message, c30767_4;
let c30767_5 = 0;
let c31731_0;
L14: {
try {
(0, env21332[3])(data);
if (isValidClipboardCode(data)) {
(0, env21332[4])(void 0);
(0, env21332[1])(true);
c30767_5 = 1;
await (0, env21332[0])({
mfaType: "totp",
data
});
(0, env21332[5])(true);
c30767_5 = 0;
(0, env21332[1])(false);
break L14;
}
} catch ($e) {
const r27 = $e;
let r7 = r27;
c30767_4 = r27;
if (c30767_5 !== 0) {
while (true) {
try {
const r77 = c30767_4;
c30767_5 = 0;
c31731_0 = r77;
const r80 = env21332[4];
const r81 = c31731_0;
message = r81 == null ? void 0 : r81.body?.message;
if (message == null) {
message = c31731_0.message;
}
r80(message);
(0, env21332[1])(false);
break L14;
} catch (r73) {
r7 = r73;
c30767_4 = r73;
if (c30767_5 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
};
const callback = useCallback(function() {
return c21333_0.apply(this, arguments);
}, [finish]);
env21332[6] = callback;
const props2 = {
headerText: intl.string(t.uc00u5),
input: <ClipboardCopyInput label={intl.string(t.HZPBOd)} placeholder={intl.string(t.tARzgo)} isValidClipboardCode={isValidClipboardCode} maxLength={TOTP_CODE_LENGTH} onChangeCode={callback} error={error} isDisabled={disabled ? disabled : r14} textContentType="oneTimeCode" autoComplete="one-time-code" keyboardType="number-pad" />,
submit: null,
screenProps: null,
mfaMethod: "totp"
};
const props3 = {
variant: "primary",
text: intl.string(t.geKm7t),
loading: disabled ? disabled : r14,
onPress: () => {
(0, env21332[6])(env21332[2]);
},
disabled: null
};
if (!disabled) {
disabled = r14;
}
if (!disabled) {
disabled = r12.length !== TOTP_CODE_LENGTH;
}
props3.disabled = disabled;
props2.submit = <MFAButton {...props3} />;
props2.screenProps = {
mfaChallenge,
finish
};
return <MfaOptionScreen {...props2} />;
};
@@ -0,0 +1,97 @@
// Metro module 14770 (f14771).
import { useState, useMemo, useCallback } from "react";
import { NativeModules } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import { RadioGroup } from "../../../../design/void/native";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { HTTPResponseError } from "../../../../_bundle/sendRequest";
import { captureWebAuthnException } from "../../../../utils/MFAUtils";
import MfaOptionScreen from "./MfaOptionScreen";
import { KeyImage } from "../components/KeyImage";
import NativeCeremonies from "../../../webauthn/native/NativeCeremonies";
import MFAButton from "../components/button";
let useStyles, c10416_7, c10416_8;
const AndroidAuthRadioGroup = function AndroidAuthRadioGroup(props) {
const { authenticatorSelection, setAuthenticator, inProgress } = props;
return <RadioGroup style={useStyles().radioItem} options={[{
value: c10416_7.ANDROID_PASSKEY,
name: intl.string(t.PVVXRI)
}, {
value: c10416_7.AUTHENTICATE,
name: intl.string(t.TKop3X)
}]} onChange={(event) => setAuthenticator(event.value)} value={authenticatorSelection} disabled={inProgress} withSpacing />;
};
useStyles = createStyles({
radioItem: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.md
}
});
c10416_7 = {
AUTHENTICATE: 0,
0: "AUTHENTICATE",
ANDROID_PASSKEY: 1,
1: "ANDROID_PASSKEY"
};
const r43 = {};
r43[c10416_7.AUTHENTICATE] = NativeModules.DCDSecurityKeyManager.authenticate;
r43[c10416_7.ANDROID_PASSKEY] = NativeModules.DCDSecurityKeyManager.authenticatePasskey;
c10416_8 = r43;
export default function WebAuthnScreen(props) {
let memo;
const { mfaChallenge, finish } = props;
memo = void 0;
let [disabled, setState] = useState(false);
const [error, setState2] = useState(void 0);
const [state, setAuthenticator2] = useState(isAndroid() ? c10416_7.ANDROID_PASSKEY : c10416_7.AUTHENTICATE);
const [state2, setState3] = useState(false);
const challenge = mfaChallenge.methods.find((method) => method.type === "webauthn").challenge;
memo = useMemo(() => c10416_8[state], [state]);
const callback = useCallback(() => {
setState2(void 0);
setState(true);
memo(challenge).then((result) => finish({
mfaType: "webauthn",
data: result
})).then(() => setState3(true)).catch((error) => {
if (error instanceof HTTPResponseError) {
setState2(intl.string(t.xSCvBf));
} else {
captureWebAuthnException(error, {});
setState2(error.message);
}
}).finally(() => setState(false));
}, [memo, challenge, finish]);
const props2 = {
headerText: intl.string(t.saHocI),
subtitle: intl.string(t.YpMrqM),
headerImage: <KeyImage />,
content: NativeCeremonies.shouldDisplayAndroidFidoSelector && <AndroidAuthRadioGroup authenticatorSelection={state} setAuthenticator={setAuthenticator2} inProgress={disabled ? disabled : state2} />,
submit: null,
screenProps: null,
mfaMethod: "webauthn",
error: null
};
const props3 = {
variant: "primary",
text: intl.string(t.Xr3Eks),
loading: disabled ? disabled : state2,
disabled: null,
onPress: null
};
if (!disabled) {
disabled = state2;
}
props3.disabled = disabled;
props3.onPress = callback;
props2.submit = <MFAButton {...props3} />;
props2.screenProps = {
mfaChallenge,
finish
};
props2.error = error;
return <MfaOptionScreen {...props2} />;
};
export { c10416_7 as AuthenticatorOption };