Files
discord-decomp/sources/modules/mfa/native/screens/SmsScreen.tsx
T
2026-07-28 01:06:53 +03:00

701 lines
31 KiB
TypeScript

/* Metro module 14222; source: modules/mfa/native/screens/SmsScreen.tsx; dependencies: [5, 57, 31, 27, 661, 33, 8973, 14215, 1244, 507, 14219, 14214, 7981, 4578, 14217, 2] */
import Module00005 from '../../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import UseWideAuthView from '../../../auth/native/useWideAuthView.tsx'; /* Metro dependency 8973 */
import MfaOptionScreen from './MfaOptionScreen.tsx'; /* Metro dependency 14214 */
import MfaScreenUtils from '../MfaScreenUtils.tsx'; /* Metro dependency 14215 */
import Button2 from '../components/button.tsx'; /* Metro dependency 14217 */
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as HTTPUtilsModule from '../../../../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */
import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as ButtonNativeModule from '../../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as TextInputNativeModule from '../../../../design/components/TextInput/native/TextInput.native.tsx'; /* Metro dependency 7981 */
function _fun107551(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:6, offset: 0x02300618, size: 226 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/mfa/native/screens/SmsScreen.tsx');
exports.default = SmsScreen;
function SmsScreen({mfaChallenge, finish}) { // fn#107552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:281, offset: 0x023006fa, size: 972 bytes, params: 2, frame: 35
const value3 = (MfaScreenUtils).useScreenStyles((UseWideAuthView)());
const binding = env0_5;
let useState = binding.useState;
const value4 = Reflect.apply(useState, binding, [null]);
const value5 = Module00057(value4, 2);
const property = value5[0];
const env0_2 = value5[1];
useState = binding.useState;
const value6 = Module00057(Reflect.apply(useState, binding, [false]), 2);
const property2 = value6[0];
const env0_3 = value6[1];
useState = binding.useState;
const value7 = Module00057(Reflect.apply(useState, binding, ['']), 2);
const property3 = value7[0];
var env0_5 = value7[1];
useState = binding.useState;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
const LQdCQE = (require(1244) /* metro dependency 1244: indexNative */).t.LQdCQE;
const value8 = Module00057(Reflect.apply(useState, binding, [Reflect.apply(string, intl, [LQdCQE])]), 2);
const property4 = value8[0];
const env0_6 = value8[1];
useState = binding.useState;
const value9 = Module00057(Reflect.apply(useState, binding, [false]), 2);
const property5 = value9[0];
const env0_7 = value9[1];
binding.useEffect(_fun107553, [mfaChallenge.ticket]);
const value10 = _fun107556();
const value11 = _fun107560();
const mfaOptionScreenProps = {headerText: intl.string((require(1244) /* metro dependency 1244: indexNative */).t.o4JNrO),
subtitle: property4};
const inputContainer = value3.inputContainer;
const TextInput = (TextInputNativeModule).TextInput;
const object = {'autoFocus': true, 'autoCapitalize': 'characters', 'maxLength': null, 'autoComplete': 'sms-otp',
'textContentType': 'oneTimeCode', 'keyboardType': 'number-pad'};
const SMS_CODE_LENGTH = (require(14219) /* metro dependency 14219: MFA */).SMS_CODE_LENGTH;
object.maxLength = SMS_CODE_LENGTH;
object.onChange = value10;
object.label = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['/sHnXc']);
string = intl.string;
const HZPBOd = (require(1244) /* metro dependency 1244: indexNative */).t.HZPBOd;
object.accessibilityLabel = Reflect.apply(string, intl, [HZPBOd]);
object.placeholder = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.tARzgo);
object.errorMessage = property;
const textInput = <TextInput {...object} />;
const Button = (ButtonNativeModule).Button;
string = intl.string;
const WbaP3r = (require(1244) /* metro dependency 1244: indexNative */).t.WbaP3r;
mfaOptionScreenProps.input = (
<View style={inputContainer}>
{textInput}
<Button
text={Reflect.apply(string, intl, [WbaP3r])}
variant="secondary"
size="sm"
onPress={value11}
/>
</View>
);
const defaultImport3 = Button2;
const defaultImport3Props = {variant: 'primary',
text: intl.string((require(1244) /* metro dependency 1244: indexNative */).t.geKm7t),
loading: property2 || property5, onPress: onPress_107564};
let r8 = property2 || property5;
r8 = !r8 ? property3.length !== (require(14219) /* metro dependency 14219: MFA */).SMS_CODE_LENGTH : r8;
defaultImport3Props.disabled = r8;
mfaOptionScreenProps.submit = ((Component) => <Component {...defaultImport3Props} />)(defaultImport3);
mfaOptionScreenProps.screenProps = {mfaChallenge: mfaChallenge, finish: finish};
mfaOptionScreenProps.mfaMethod = 'sms';
return <MfaOptionScreen {...mfaOptionScreenProps} />;
function _fun107553() { // fn#107553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:624, offset: 0x02300ac6, size: 144 bytes, params: 1, frame: 15
env0_2(null);
const HTTP = (HTTPUtilsModule).HTTP;
const post = HTTP.post;
const LOGIN_SMS_SEND = Endpoints.LOGIN_SMS_SEND;
let value = Reflect.apply(post, HTTP, [{url: LOGIN_SMS_SEND, body: {ticket: mfaChallenge.ticket},
oldFormErrors: true, rejectWithError: false}]);
value = value.then(_fun107554);
value.catch(_fun107555);
function _fun107554({body}) { // fn#107554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:745, offset: 0x02300b56, size: 96 bytes, params: 2, frame: 16
const binding = env1_6;
const intl = (IndexNativeModule).intl;
binding(intl.formatToPlainString((IndexNativeModule).t['8r6h7+'],
{phoneNumber: body.phone}));
}
function _fun107555(a0) { // fn#107555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:845, offset: 0x02300bb6, size: 58 bytes, params: 2, frame: 16
const binding = env1_2;
const body = a0.body;
const value2 = undefined;
let message = body == null ? value2 : body.message;
message = message ?? a0.message;
binding(message);
env1_6(value2);
return value2;
}
}
function _fun107556() { // fn#107556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:949, offset: 0x02300bf0, size: 36 bytes, params: 1, frame: 12
const env0_0 = env1_3(_fun107558);
return _fun107559;
function* _fun107558(a0) { // fn#107558, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:969, offset: 0x02300c1f, size: 215 bytes, params: 2, frame: 20
var message;
var r3;
var object;
var defaultImport;
var value5;
var value6;
var error;
var body;
let value = undefined;
if (true) {
value = undefined;
env2_5(a0);
var length = a0.length;
var SMS_CODE_LENGTH = env3_0(env3_2[10]).SMS_CODE_LENGTH;
if (length === SMS_CODE_LENGTH) {
dependencyMap(null);
env2_3(true);
reducibleJoin4: while (true) {
reduciblePort20: while (true) {
exceptionLanding15: while (true) {
try {
} catch (error) {
break exceptionLanding15;
}
break reducibleJoin4;
}
body = error.body;
reducibleJoin17: while (true) {
if (body == null) {
message = value;
break reducibleJoin17;
}
message = body.message;
break reducibleJoin17;
}
reducibleJoin19: while (true) {
if (message != null) {
r3 = message;
break reducibleJoin19;
}
message = error.message;
r3 = message;
break reducibleJoin19;
}
dependencyMap(r3);
break reduciblePort20;
}
env2_3(false);
return value;
}
try {
object = {};
} catch (error) {
break exceptionLanding15;
}
try {
object.mfaType = 'sms';
} catch (error) {
break exceptionLanding15;
}
try {
object.data = a0;
} catch (error) {
break exceptionLanding15;
}
try {
defaultImport = importDefault(object);
} catch (error) {
break exceptionLanding15;
}
yield defaultImport;
try {
value5 = undefined;
value6 = false;
} catch (error) {
break exceptionLanding15;
}
if (value6) {
return value5;
}
try {
} catch (error) {
break exceptionLanding15;
}
try {
Endpoints(true);
} catch (error) {
break exceptionLanding15;
}
env2_3(false);
}
}
return value;
}
function _fun107559() { // fn#107559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:1177, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
}
function _fun107560() { // fn#107560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:1225, offset: 0x02300cf6, size: 36 bytes, params: 1, frame: 12
const env0_0 = env1_3(_fun107562);
return _fun107563;
function* _fun107562() { // fn#107562, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:1245, offset: 0x02300d25, size: 390 bytes, params: 1, frame: 24
var message;
var r1;
var value;
var value2;
var value3;
var value4;
var binding;
var binding2;
var intl;
var string;
var t;
var LQdCQE;
var binding3;
var property;
var value5;
var HTTP;
var post;
var object;
var LOGIN_SMS_SEND;
var object2;
var ticket;
var value6;
var value7;
var value8;
var binding4;
var value9;
var formatToPlainString;
var value10;
var body;
var phone;
var value11;
var error;
var value12;
var value13;
exceptionLanding61: while (true) {
value = undefined;
value2 = false;
if (value2) {
return value;
}
value = undefined;
value3 = environment.__proto__.__proto__;
dependencyMap(null);
env2_3(true);
value4 = environment.__proto__.__proto__.__proto__;
binding = env3_0;
binding2 = env3_2;
intl = binding(binding2[8]).intl;
string = intl.string;
t = binding(binding2[8]).t;
LQdCQE = t.LQdCQE;
View(Reflect.apply(string, intl, [LQdCQE]));
reducibleJoin3: while (true) {
reduciblePort60: while (true) {
exceptionLanding44: while (true) {
try {
try {
binding = env3_0;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
break reducibleJoin3;
}
try {
} catch (error) {
break exceptionLanding61;
}
try {
message = error.message;
} catch (error) {
break exceptionLanding61;
}
try {
value12 = message != null;
} catch (error) {
break exceptionLanding61;
}
if (value12) {
r1 = message;
} else {
try {
body = error.body;
} catch (error) {
break exceptionLanding61;
}
try {
value13 = body == null;
} catch (error) {
break exceptionLanding61;
}
reducibleJoin55: while (true) {
if (value13) {
message = value;
break reducibleJoin55;
}
try {
message = body.message;
} catch (error) {
break exceptionLanding61;
}
break reducibleJoin55;
}
r1 = message;
}
try {
dependencyMap(r1);
} catch (error) {
break exceptionLanding61;
}
try {
} catch (error) {
break exceptionLanding61;
}
try {
View(value);
} catch (error) {
break exceptionLanding61;
}
break reduciblePort60;
}
env2_3(false);
return value;
}
try {
try {
binding3 = env3_2;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
property = binding3[9];
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
value5 = binding(property);
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
HTTP = value5.HTTP;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
post = HTTP.post;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object = {};
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
binding = env3_7;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
LOGIN_SMS_SEND = binding.LOGIN_SMS_SEND;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object.url = LOGIN_SMS_SEND;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object2 = {};
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
ticket = require.ticket;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object2.ticket = ticket;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object.body = object2;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object.oldFormErrors = true;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object.rejectWithError = false;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
value6 = Reflect.apply(post, HTTP, [object]);
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
yield value6;
try {
try {
value7 = undefined;
value8 = false;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
if (value8) {
env2_3(false);
return value7;
}
try {
try {
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
binding = env3_0;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
binding4 = env3_2;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
property = binding4[8];
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
value9 = binding(property);
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
intl = value9.intl;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
formatToPlainString = intl.formatToPlainString;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
property = binding4[8];
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
value10 = binding(property);
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
t = value10.t;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
property = t['8r6h7+'];
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object = {};
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
body = value7.body;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
phone = body.phone;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
object.phoneNumber = phone;
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
value11 = Reflect.apply(formatToPlainString, intl, [property, object]);
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
try {
try {
View(value11);
} catch (error) {
break exceptionLanding44;
}
} catch (error) {
break exceptionLanding61;
}
env2_3(false);
return value;
}
env2_3(false);
throw error;
}
function _fun107563() { // fn#107563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:1629, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
}
function SmsScreenOnPress() { // fn#107564, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14419:2380, owner: SmsScreen.onPress, offset: 0x02300eab, size: 20 bytes, params: 1, frame: 11
(0, JsxRuntimeModule.jsx)(Module00057);
}
}
}
global.__d(_fun107551, 14222, [5, 57, 31, 27, 661, 33, 8973, 14215, 1244, 507, 14219, 14214, 7981, 4578, 14217,
2]) /* metro module 14222, dependencies: [5, 57, 31, 27, 661, 33, 8973, 14215, 1244, 507, 14219, 14214, 7981, 4578, 14217, 2] */;