Files
discord-decomp/sources/modules/auth/native/components/RegisterDisplayName.tsx
T
2026-07-28 01:06:53 +03:00

281 lines
16 KiB
TypeScript

/* Metro module 14325; source: modules/auth/native/components/RegisterDisplayName.tsx; dependencies: [5, 57, 31, 27, 13285, 14304, 14305, 33, 4501, 697, 1244, 8973, 1484, 14302, 14320, 14303, 676, 14319, 14322, 13286, 5277, 8986, 9001, 7981, 4578, 5467, 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 '../useWideAuthView.tsx'; /* Metro dependency 8973 */
import AuthFormView from './AuthFormView.tsx'; /* Metro dependency 9001 */
import UniqueUsernamesStore from '../../../unique_usernames/UniqueUsernamesStore.tsx'; /* Metro dependency 13285 */
import UseInitialRegistrationStep from '../useInitialRegistrationStep.tsx'; /* Metro dependency 14319 */
import UseAuthFlowBackHandler from './utils/useAuthFlowBackHandler.tsx'; /* Metro dependency 14320 */
import UseFocusRefOnNavigation from '../../../../design/components/Navigator/native/useFocusRefOnNavigation.tsx'; /* Metro dependency 14322 */
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 ConstantsIOSModule from '../../../../ConstantsIOS.tsx'; /* Metro dependency 676 */
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as UseNavigationNativeModule from '../../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
import * as ButtonNativeModule from '../../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as HeaderActionButtonNativeModule from '../../../../design/components/Navigator/native/HeaderActionButton.native.tsx'; /* Metro dependency 5277 */
import * as TextInputNativeModule from '../../../../design/components/TextInput/native/TextInput.native.tsx'; /* Metro dependency 7981 */
import * as AuthModule from './Auth.tsx'; /* Metro dependency 14302 */
import * as RegistrationStepsUtilsModule from '../RegistrationStepsUtils.tsx'; /* Metro dependency 14303 */
import * as RegistrationUIStoreModule from '../RegistrationUIStore.tsx'; /* Metro dependency 14304 */
function _fun108411(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#108411, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:6, offset: 0x0231f937, size: 416 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = RegistrationUIStoreModule;
const env0_8 = value.updateRegistrationOptions;
const env0_9 = value.useRegistrationUIStore;
value = require(14305) /* metro dependency 14305: RegistrationConstants */;
const env0_10 = value.RegisterTransitionSteps;
const env0_11 = value.RegistrationTransitionActionTypes;
value = require(33) /* metro dependency 33 */;
const env0_12 = value.jsx;
const env0_13 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.globalName = {marginTop: PX_24};
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.button = {marginTop: PX_24};
object.page = {flex: 1};
const env0_14 = Reflect.apply(createStyles, value, [object]);
const env0_15 = ['discord', 'hypesquad', 'snowsgiving', 'system message', 'system mesage', 'sustem mesage',
'sustem message'];
const env0_16 = ['everyone', 'here'];
(FileImportTrackerModule).fileFinishedImporting('modules/auth/native/components/RegisterDisplayName.tsx');
exports.default = _default_108412;
function _default_108412() { // fn#108412, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:580, offset: 0x0231fad7, size: 1226 bytes, params: 1, frame: 32
var r12;
var r14;
var r0;
var binding4;
var length;
var property3;
var toLowerCase;
var value10;
var value11;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var string;
var t;
var WeJZyy;
var value12;
var value;
const value2 = undefined;
const styles = useStyles();
const value3 = (UseWideAuthView)();
const value4 = (UseNavigationNativeModule).useNavigation();
let useState = ReactModule.useState;
const value5 = Reflect.apply(useState, ReactModule, [false]);
const value6 = Module00057(value5, 2);
const value7 = 0;
const property = value6[value7];
const env0_1 = value6[1];
const value8 = useRegistrationUIStore(function(a0) {
return a0.errors;
});
useState = ReactModule.useState;
const value9 = Module00057(Reflect.apply(useState, ReactModule, [_fun108414]), 2);
const property2 = value9[value7];
const env0_3 = value9[1];
const binding3 = env0_16;
let includes = binding3.includes;
if (Reflect.apply(includes, binding3, [property2])) {
r14 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.WeJZyy);
} else {
binding4 = env0_15;
length = binding4.length;
if (value7 < length) {
r12 = value7;
loopExit2: while (true) {
property3 = binding4[r12];
toLowerCase = property2.toLowerCase;
value10 = Reflect.apply(toLowerCase, property2, []);
includes = value10.includes;
if (Reflect.apply(includes, value10, [property3])) {
string = intl.string;
t = (require(1244) /* metro dependency 1244: indexNative */).t;
WeJZyy = t.WeJZyy;
value12 = Reflect.apply(string, intl, [WeJZyy]);
r14 = value12;
break loopExit2;
}
value11 = typeof r12 === 'bigint' ? r12 + 1n : +r12 + 1;
length = binding4.length;
if (value11 < length) {
r12 = value11;
continue;
}
r14 = value2;
break loopExit2;
}
} else {
r14 = value2;
}
}
const useContext = ReactModule.useContext;
const TrackRegistrationContext = (AuthModule).TrackRegistrationContext;
const value14 = Reflect.apply(useContext, ReactModule, [TrackRegistrationContext]);
const defaultImport = UseAuthFlowBackHandler;
const getPreviousRegistrationTransitionStep = RegistrationStepsUtilsModule.getPreviousRegistrationTransitionStep;
const AuthStates = (ConstantsIOSModule).AuthStates;
let REGISTER_DISPLAY_NAME = AuthStates.REGISTER_DISPLAY_NAME;
defaultImport(Reflect.apply(getPreviousRegistrationTransitionStep, RegistrationStepsUtilsModule,
[REGISTER_DISPLAY_NAME]));
const defaultImport2 = UseInitialRegistrationStep;
REGISTER_DISPLAY_NAME = AuthStates.REGISTER_DISPLAY_NAME;
defaultImport2(REGISTER_DISPLAY_NAME);
ReactModule.useEffect(_fun108415, [value14]);
const value15 = ReactModule.useRef(null);
(UseFocusRefOnNavigation)({inputRef: value15});
ReactModule.useLayoutEffect(_fun108420, [ReactModule.useCallback(_fun108416(), [value4, value14]), value4]);
r12 = (importDefault(8986) /* metro dependency 8986: getError */)('global_name', value8) ?? r14;
object = {};
string = intl.string;
const LYIh7j = (require(1244) /* metro dependency 1244: indexNative */).t.LYIh7j;
object.headerText = Reflect.apply(string, intl, [LYIh7j]);
const TextInput = (TextInputNativeModule).TextInput;
const textInputProps = {ref: value15, value: property2, onChange: onChange_108423, returnKeyType: 'next',
onSubmitEditing: onSubmitEditing_108424, textContentType: 'nickname', errorMessage: r12,
label: intl.string((require(1244) /* metro dependency 1244: indexNative */).t['9AjdkD'])};
r12 = r12 == null ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.fbKwSs) : value2;
textInputProps.description = r12;
textInputProps.isClearable = true;
const view = (
<View style={styles.globalName}>
<TextInput {...textInputProps} />
</View>
);
const Button = (ButtonNativeModule).Button;
string = intl.string;
const PDTjLN = (require(1244) /* metro dependency 1244: indexNative */).t.PDTjLN;
const authFormView = (
<AuthFormView {...object}>
{view}
<View style={styles.button}>
<Button
size="lg"
loading={property}
text={Reflect.apply(string, intl, [PDTjLN])}
onPress={onPress_108425}
disabled={r14 != null || property2.trim() === ''}
/>
</View>
</AuthFormView>
);
if (value3) {
r0 = authFormView;
} else {
value = importDefault(5467) /* metro dependency 5467: KeyboardAwareView */;
value = ((Component) => <Component style={styles.page}>{authFormView}</Component>)(value);
r0 = value;
}
return r0;
function _fun108414() { // fn#108414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:710, offset: 0x0231ffa1, size: 47 bytes, params: 1, frame: 10
const value = environment.__proto__;
const getState = useRegistrationUIStore.getState;
return Reflect.apply(getState, useRegistrationUIStore, []).registrationOptions.globalName ?? '';
}
function _fun108415() { // fn#108415, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:1226, offset: 0x0231ffd0, size: 51 bytes, params: 1, frame: 12
const ACCOUNT_DISPLAY_NAME = RegisterTransitionSteps.ACCOUNT_DISPLAY_NAME;
const VIEWED = RegistrationTransitionActionTypes.VIEWED;
Module00057({step: ACCOUNT_DISPLAY_NAME, actionType: VIEWED});
}
function _fun108416() { // fn#108416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:1355, offset: 0x02320003, size: 36 bytes, params: 1, frame: 12
const env0_0 = env1_3(_fun108418);
return _fun108419;
function* _fun108418(a0) { // fn#108418, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:1375, offset: 0x02320032, size: 287 bytes, params: 2, frame: 19
var binding2;
if (true) {
value = environment.__proto__.__proto__.__proto__;
var binding = env3_8;
binding({globalName: a0});
binding = env3_9;
var getState = binding.getState;
var registrationOptions = Reflect.apply(getState, binding, []).registrationOptions;
binding = env2_4;
var ACCOUNT_DISPLAY_NAME = env3_10.ACCOUNT_DISPLAY_NAME;
var SUBMITTED = env3_11.SUBMITTED;
binding({step: ACCOUNT_DISPLAY_NAME, actionType: SUBMITTED});
var username = registrationOptions.username;
if (!(username != null && registrationOptions.username !== '')) {
importDefault(true);
binding = env3_7;
if (binding.wasRegistrationSuggestionFetched(a0)) {
importDefault(false);
binding = env3_0;
binding2 = env3_2;
value = binding(binding2[15]);
value.handleNextOrSubmitRegistration(binding(binding2[16]).AuthStates.REGISTER_DISPLAY_NAME, require,
env2_4);
return undefined;
}
binding = env3_1;
var value6 = binding(env3_2[19]);
yield value6.fetchSuggestionsRegistration(a0);
if (false) {
return undefined;
}
importDefault(false);
}
binding = env3_0;
binding2 = env3_2;
value = binding(binding2[15]);
value.handleNextOrSubmitRegistration(binding(binding2[16]).AuthStates.REGISTER_DISPLAY_NAME, require, env2_4);
}
}
function _fun108419() { // fn#108419, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:1735, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
}
function _fun108420() { // fn#108420, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:1807, offset: 0x02320151, size: 38 bytes, params: 1, frame: 12
const binding = env0_0;
binding.setOptions({headerRight: headerRight_108421});
function headerRight_108421() { // fn#108421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:1838, offset: 0x02320177, size: 109 bytes, params: 1, frame: 18
const HeaderActionButton = (HeaderActionButtonNativeModule).HeaderActionButton;
const intl = (IndexNativeModule).intl;
return (
<HeaderActionButton
text={intl.string((IndexNativeModule).t['5Wxrcd'])}
onPress={onPress_108422}
/>
);
function headerRight_108421OnPress() { // fn#108422, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:1929, owner: headerRight_108421.onPress, offset: 0x023201e4, size: 18 bytes, params: 1, frame: 11
return env2_5(null);
}
}
}
function _default_108412OnChange(a0) { // fn#108423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:2153, owner: _default_108412.onChange, offset: 0x023201f6, size: 40 bytes, params: 2, frame: 12
const value = a0;
const binding = env0_3;
const value3 = value.trim();
const value4 = '';
binding(value4 === value3 ? value4 : value);
}
function _default_108412OnSubmitEditing() { // fn#108424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:2217, owner: _default_108412.onSubmitEditing, offset: 0x0232021e, size: 20 bytes, params: 1, frame: 11
return ReactModule(env0_2);
}
function _default_108412OnPress() { // fn#108425, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14522:2524, owner: _default_108412.onPress, offset: 0x0232021e, size: 20 bytes, params: 1, frame: 11
return ReactModule(env0_2);
}
}
}
global.__d(_fun108411, 14325, [5, 57, 31, 27, 13285, 14304, 14305, 33, 4501, 697, 1244, 8973, 1484, 14302, 14320,
14303, 676, 14319, 14322, 13286, 5277, 8986, 9001, 7981, 4578, 5467,
2]) /* metro module 14325, dependencies: [5, 57, 31, 27, 13285, 14304, 14305, 33, 4501, 697, 1244, 8973, 1484, 14302, 14320, 14303, 676, 14319, 14322, 13286, 5277, 8986, 9001, 7981, 4578, 5467, 2] */;