281 lines
15 KiB
TypeScript
281 lines
15 KiB
TypeScript
/* Metro module 14313; source: modules/auth/native/components/RegisterIdentity.tsx; dependencies: [5, 57, 31, 27, 14304, 14305, 33, 4501, 4584, 8973, 1484, 14314, 676, 14302, 14319, 14320, 14303, 4594, 8993, 9001, 14321, 4578, 1244, 8970, 5467, 14323, 14324, 8853, 9221, 2] */
|
|
function _fun108322(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#108322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:6, offset: 0x0231c912, size: 342 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
const env0_4 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_5 = importAll(31) /* metro dependency 31 */;
|
|
let value = require(27) /* metro dependency 27 */;
|
|
const env0_6 = value.View;
|
|
const env0_7 = value.ScrollView;
|
|
value = require(14304) /* metro dependency 14304: RegistrationUIStore */;
|
|
const env0_8 = value.clearRegistrationErrorMessage;
|
|
const env0_9 = value.setRegistrationErrors;
|
|
const env0_10 = value.updateRegistrationOptions;
|
|
const env0_11 = value.useRegistrationUIStore;
|
|
value = require(14305) /* metro dependency 14305: RegistrationConstants */;
|
|
const env0_12 = value.RegisterTransitionSteps;
|
|
const env0_13 = value.RegistrationTransitionActionTypes;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_14 = value.jsx;
|
|
const env0_15 = value.jsxs;
|
|
const env0_16 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(function(a0) {
|
|
return {container: {'marginTop': 24, 'flex': 1}, page: {flex: 1}, button: {'width': '100%', 'marginTop': 24},
|
|
errors: {marginTop: 4}, segmentedControl: {minHeight: a0, marginBottom: 24},
|
|
scrollContent: {paddingBottom: 128}};
|
|
});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/auth/native/components/RegisterIdentity.tsx');
|
|
exports.RegisterIdentity = RegisterIdentity;
|
|
}
|
|
|
|
function RegisterIdentityBase({inputMode, setInputMode, headerText, controlComponent, subheader}) { // fn#108323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:606, offset: 0x0231ca68, size: 1015 bytes, params: 2, frame: 35
|
|
var r0;
|
|
const closure = function() {
|
|
return RegisterIdentityBase_handleSubmit.apply(this, arguments);
|
|
};
|
|
const Math = global.Math;
|
|
const min = Math.min;
|
|
var value;
|
|
const styles = useStyles(45 * Reflect.apply(min, Math, [2,
|
|
(require(4584) /* metro dependency 4584: useFontScale */).useFontScale()]));
|
|
const value4 = (importDefault(8973) /* metro dependency 8973: useWideAuthView */)();
|
|
const env0_2 = (require(1484) /* metro dependency 1484: useNavigationNative */).useNavigation();
|
|
const value5 = useRegistrationUIStore(function(a0) {
|
|
return a0.errors;
|
|
});
|
|
const useIdentityRegistrationStepModule = require(14314) /* metro dependency 14314: useIdentityRegistrationStep */;
|
|
const useIdentityRegistrationStep = useIdentityRegistrationStepModule.useIdentityRegistrationStep;
|
|
const AuthStates = (require(676) /* metro dependency 676: ConstantsIOS */).AuthStates;
|
|
let REGISTER_IDENTITY = AuthStates.REGISTER_IDENTITY;
|
|
const value6 = Reflect.apply(useIdentityRegistrationStep, useIdentityRegistrationStepModule, [REGISTER_IDENTITY,
|
|
inputMode]);
|
|
const loginEmail = value6.loginEmail;
|
|
const env0_4 = loginEmail;
|
|
const setLoginEmail = value6.setLoginEmail;
|
|
const loginPhone = value6.loginPhone;
|
|
const updateLoginPhone = value6.updateLoginPhone;
|
|
const identityErrorMessage = value6.identityErrorMessage;
|
|
const env0_5 = identityErrorMessage;
|
|
const env0_6 = value6.registerAndVerifyPhone;
|
|
const preventSubmitIdentity = value6.preventSubmitIdentity;
|
|
const identityError = value6.identityError;
|
|
const env0_7 = value6.validateEmail;
|
|
let binding = env0_5;
|
|
const [property, env0_8] = env0_4(binding.useState(false), 2);
|
|
binding = env0_5;
|
|
const useContext = binding.useContext;
|
|
const TrackRegistrationContext = (require(14302) /* metro dependency 14302: Auth */).TrackRegistrationContext;
|
|
const env0_9 = Reflect.apply(useContext, binding, [TrackRegistrationContext]);
|
|
const value9 = env0_5.useMemo(_fun108330, [value5.message, identityErrorMessage]);
|
|
const defaultImport = importDefault(14319) /* metro dependency 14319: useInitialRegistrationStep */;
|
|
REGISTER_IDENTITY = AuthStates.REGISTER_IDENTITY;
|
|
defaultImport(REGISTER_IDENTITY);
|
|
const defaultImport2 = importDefault(14320) /* metro dependency 14320: useAuthFlowBackHandler */;
|
|
const registrationStepsUtilsModule = require(14303) /* metro dependency 14303: RegistrationStepsUtils */;
|
|
const getPreviousRegistrationTransitionStep = registrationStepsUtilsModule.getPreviousRegistrationTransitionStep;
|
|
REGISTER_IDENTITY = AuthStates.REGISTER_IDENTITY;
|
|
defaultImport2(Reflect.apply(getPreviousRegistrationTransitionStep, registrationStepsUtilsModule,
|
|
[REGISTER_IDENTITY]));
|
|
(importDefault(4594) /* metro dependency 4594: useMountEffect */)(_fun108331);
|
|
const AuthFormView = importDefault(9001) /* metro dependency 9001: AuthFormView */;
|
|
const items2 = [controlComponent];
|
|
const RegisterPhoneOrEmailInput = (require(14321) /* metro dependency 14321: RegisterPhoneOrEmailInput */).RegisterPhoneOrEmailInput;
|
|
items2[1] = <RegisterPhoneOrEmailInput loginPhone={loginPhone} loginEmail={loginEmail} setLoginPhone={updateLoginPhone} setLoginEmail={setLoginEmail} inputMode={inputMode} onSubmit={closure} inputError={identityError} autoFocus />;
|
|
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const PDTjLN = (require(1244) /* metro dependency 1244: indexNative */).t.PDTjLN;
|
|
items2[2] = <View style={styles.button}><Button loading={property} size="lg" text={Reflect.apply(string, intl,
|
|
[PDTjLN])} onPress={closure} disabled={preventSubmitIdentity} /></View>;
|
|
items2[3] = value9 != null ? value9 === '' ? null : ((Component) => <Component style={styles.errors}>{value9}</Component>)(importDefault(8970) /* metro dependency 8970: FreeFormErrorLabel */) : null;
|
|
const authFormView = <AuthFormView headerText={headerText} subHeader={subheader}><ScrollView style={styles.container} contentContainerStyle={styles.scrollContent} keyboardShouldPersistTaps="handled">{items2}</ScrollView></AuthFormView>;
|
|
if (value4) {
|
|
r0 = authFormView;
|
|
} else {
|
|
value = importDefault(5467) /* metro dependency 5467: KeyboardAwareView */;
|
|
value = ((Component) => <Component style={styles.page}>{authFormView}</Component>)(value);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function RegisterIdentity() { // fn#108333, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:2715, offset: 0x0231d114, size: 534 bytes, params: 1, frame: 22
|
|
var object2;
|
|
const Math = global.Math;
|
|
const styles = useStyles(45 * Math.min(2, (require(4584) /* metro dependency 4584: useFontScale */).useFontScale()));
|
|
const deviceCountry = (require(14323) /* metro dependency 14323: getDeviceCountry */).getDeviceCountry();
|
|
const r1 = deviceCountry != null && (require(14324) /* metro dependency 14324: emailFirstCountries */).EMAIL_FIRST_COUNTRIES.has(deviceCountry);
|
|
let binding = env0_5;
|
|
const value7 = binding.useMemo(_fun108334, [r1]);
|
|
binding = env0_5;
|
|
const useState = binding.useState;
|
|
const value9 = env0_4(Reflect.apply(useState, binding, [value7[0].mode]), 2);
|
|
const property = value9[0];
|
|
const value10 = env0_5.useCallback(_fun108335, [value9[1], value7]);
|
|
const segmentedControlStateNativeModule = require(8853) /* metro dependency 8853: SegmentedControlStateNative */;
|
|
const useSegmentedControlState = segmentedControlStateNativeModule.useSegmentedControlState;
|
|
object2 = {'pageWidth': 0, 'defaultIndex': 0};
|
|
object2.onSetActiveIndex = value10;
|
|
object2.items = value7.map(function({descriptor}) {
|
|
var object = {};
|
|
object.id = require(dependencyMap[22]).intl.string(descriptor);
|
|
object.label = require(dependencyMap[22]).intl.string(descriptor);
|
|
object.page = null;
|
|
return object;
|
|
});
|
|
const value11 = Reflect.apply(useSegmentedControlState, segmentedControlStateNativeModule, [object2]);
|
|
object2 = {inputMode: property, setInputMode: env0_5.useCallback(_fun108337, [value11, value7])};
|
|
const SegmentedControl = (require(9221) /* metro dependency 9221: SegmentedControlNative */).SegmentedControl;
|
|
object2.controlComponent = <View style={styles.segmentedControl}><SegmentedControl state={value11} keyboardShouldPersistTaps="handled" /></View>;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const WEdDgv = (require(1244) /* metro dependency 1244: indexNative */).t.WEdDgv;
|
|
object2.headerText = Reflect.apply(string, intl, [WEdDgv]);
|
|
return <RegisterIdentityBase {...object2} />;
|
|
}
|
|
|
|
function RegisterIdentityBase_handleSubmit() { // fn#108325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:1292, owner: RegisterIdentityBase._handleSubmit, offset: 0x0231ce5f, size: 53 bytes, params: 1, frame: 13
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
return env1_3(_fun108327).apply(this, arguments);
|
|
}
|
|
|
|
function _fun108330() { // fn#108330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:1185, offset: 0x0231d059, size: 30 bytes, params: 1, frame: 3
|
|
return identityErrorMessage ?? env0_3.message;
|
|
}
|
|
|
|
function _fun108331() { // fn#108331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:1970, offset: 0x0231d077, size: 51 bytes, params: 1, frame: 12
|
|
const binding = env0_9;
|
|
const ACCOUNT_IDENTITY = RegisterTransitionSteps.ACCOUNT_IDENTITY;
|
|
const VIEWED = RegistrationTransitionActionTypes.VIEWED;
|
|
binding({step: ACCOUNT_IDENTITY, actionType: VIEWED});
|
|
}
|
|
|
|
function _fun108334() { // fn#108334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:2886, offset: 0x0231d32a, size: 255 bytes, params: 1, frame: 18
|
|
var items;
|
|
const PhoneOrEmailSelectorForceMode = (require(8993) /* metro dependency 8993: PhoneOrEmailUtils */).PhoneOrEmailSelectorForceMode;
|
|
const binding = env0_0;
|
|
const object2 = {};
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
if (binding) {
|
|
object2.descriptor = t['w/qqKK'];
|
|
object2.mode = PhoneOrEmailSelectorForceMode.EMAIL;
|
|
items = [object2, {descriptor: t.dEYpSt, mode: PhoneOrEmailSelectorForceMode.PHONE}];
|
|
} else {
|
|
object2.descriptor = t.dEYpSt;
|
|
object2.mode = PhoneOrEmailSelectorForceMode.PHONE;
|
|
items = [object2, {descriptor: t['w/qqKK'], mode: PhoneOrEmailSelectorForceMode.EMAIL}];
|
|
}
|
|
return items;
|
|
}
|
|
|
|
function _fun108335(a0) { // fn#108335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:3296, offset: 0x0231d429, size: 43 bytes, params: 2, frame: 12
|
|
clearRegistrationErrorMessage();
|
|
env0_2(env0_1[a0].mode);
|
|
}
|
|
|
|
function _fun108337(a0) { // fn#108337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:3532, offset: 0x0231d4b0, size: 66 bytes, params: 2, frame: 13
|
|
const env0_0 = a0;
|
|
const index = env0_1.findIndex(_fun108338);
|
|
if (index !== -1) {
|
|
env0_3.setActiveIndex(index, false);
|
|
}
|
|
}
|
|
|
|
function* _fun108327() { // fn#108327, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:1341, offset: 0x0231ce9f, size: 380 bytes, params: 1, frame: 20
|
|
var environment;
|
|
var clearRegistrationErrorMessageBinding;
|
|
var closure;
|
|
var value4;
|
|
var error;
|
|
var value5;
|
|
var binding2;
|
|
if (true) {
|
|
value = environment.__proto__.__proto__.__proto__;
|
|
var binding = env3_9;
|
|
binding({});
|
|
var setRegistrationErrorsBinding = setRegistrationErrors;
|
|
var ACCOUNT_IDENTITY = env3_12.ACCOUNT_IDENTITY;
|
|
var SUBMITTED = env3_13.SUBMITTED;
|
|
setRegistrationErrorsBinding({step: ACCOUNT_IDENTITY, actionType: SUBMITTED});
|
|
var PhoneOrEmailSelectorForceMode = env3_0(env3_2[18]).PhoneOrEmailSelectorForceMode;
|
|
var EMAIL = PhoneOrEmailSelectorForceMode.EMAIL;
|
|
if (require === EMAIL) {
|
|
binding = env3_10;
|
|
binding({email: env2_4, phoneToken: undefined});
|
|
value5 = ScrollView();
|
|
if (value5 != null) {
|
|
env3_9({email: value5});
|
|
setRegistrationErrors({step: env3_12.ACCOUNT_IDENTITY, actionType: env3_13.INPUT_ERROR,
|
|
details: ['email']});
|
|
} else {
|
|
binding = env3_0;
|
|
binding2 = env3_2;
|
|
value = binding(binding2[16]);
|
|
value.handleNextOrSubmitRegistration(binding(binding2[12]).AuthStates.REGISTER_IDENTITY, dependencyMap,
|
|
setRegistrationErrors);
|
|
}
|
|
} else {
|
|
try {
|
|
clearRegistrationErrorMessageBinding = clearRegistrationErrorMessage;
|
|
} catch (error) {
|
|
clearRegistrationErrorMessage(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
clearRegistrationErrorMessageBinding(true);
|
|
} catch (error) {
|
|
clearRegistrationErrorMessage(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
} catch (error) {
|
|
clearRegistrationErrorMessage(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
} catch (error) {
|
|
clearRegistrationErrorMessage(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
closure = _fun108328;
|
|
} catch (error) {
|
|
clearRegistrationErrorMessage(false);
|
|
throw error;
|
|
}
|
|
try {
|
|
value = View(closure);
|
|
} catch (error) {
|
|
clearRegistrationErrorMessage(false);
|
|
throw error;
|
|
}
|
|
yield value;
|
|
try {
|
|
value = undefined;
|
|
value4 = false;
|
|
} catch (error) {
|
|
clearRegistrationErrorMessage(false);
|
|
throw error;
|
|
}
|
|
if (value4) {
|
|
clearRegistrationErrorMessage(false);
|
|
return value;
|
|
}
|
|
clearRegistrationErrorMessage(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun108338({mode}) { // fn#108338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:3555, offset: 0x0231d4f2, size: 21 bytes, params: 2, frame: 2
|
|
return mode === env0_0;
|
|
}
|
|
|
|
function _fun108328() { // fn#108328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14510:1719, offset: 0x0231d01b, size: 51 bytes, params: 1, frame: 12
|
|
const PhoneOrEmailSelectorForceMode = env4_0(env4_2[18]).PhoneOrEmailSelectorForceMode;
|
|
const EMAIL = PhoneOrEmailSelectorForceMode.EMAIL;
|
|
importDefault(EMAIL);
|
|
}
|
|
|