Files
discord-decomp/sources/modules/auth/native/RegistrationUtils.tsx
T
2026-07-27 16:20:00 +03:00

146 lines
7.6 KiB
TypeScript

/* Metro module 14312; source: modules/auth/native/RegistrationUtils.tsx; dependencies: [31, 4097, 9156, 14304, 14305, 661, 33, 683, 14302, 5287, 2] */
function _fun108314(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#108314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14509:6, offset: 0x0231c2a0, size: 316 bytes, params: 8, frame: 20
let env0_0 = require;
const closure = trackRegTransition;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importAll(31) /* metro dependency 31 */;
const inviteStore = importDefault(4097) /* metro dependency 4097: InviteStore */;
const displayedInviteStore = importDefault(9156) /* metro dependency 9156: DisplayedInviteStore */;
let value = require(14304) /* metro dependency 14304: RegistrationUIStore */;
const env0_6 = value.clearRegistrationErrorMessage;
const env0_7 = value.useRegistrationUIStore;
value = require(14305) /* metro dependency 14305: RegistrationConstants */;
const env0_8 = value.RegisterTransitionSteps;
const env0_9 = value.RegistrationTransitionActionTypes;
const env0_10 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
const env0_11 = (require(33) /* metro dependency 33 */).jsx;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/auth/native/RegistrationUtils.tsx');
exports.hasAllRegistrationFieldsCompleted = function(a0, {isConsentRequired}) {
return (a0.email != null || a0.phoneToken != null) && (a0.username != null && (a0.password != null && (a0.birthday != null && (a0.consent != null && (isConsentRequired ? a0.consent === true : !isConsentRequired)))));
};
exports.trackRegTransition = closure;
exports.getTrackRegTransition = function(a0) {
var env0_0 = a0;
return _fun108318;
};
exports.BackButtonWithTracking = BackButtonWithTracking;
exports.getCommonErrorDetails = getCommonErrorDetails;
}
function trackRegTransition({step, fromStep, toStep, actionType, details, overrideRegistrationOptions}) { // fn#108315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14509:312, offset: 0x0231c3dc, size: 413 bytes, params: 2, frame: 23
const displayedInviteCode = DisplayedInviteStore.getDisplayedInviteCode();
const r3 = overrideRegistrationOptions ?? useRegistrationUIStore.getState().registrationOptions;
const r8 = displayedInviteCode != null ? InviteStore.getInvite(displayedInviteCode) : null;
const r7 = r8 != null ? 'invite' : null;
const r12 = r3?.email != null ? 'email' : r3?.phone != null ? 'phone' : null;
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
const track = defaultImport.track;
const REGISTER_TRANSITION = AnalyticEvents.REGISTER_TRANSITION;
Reflect.apply(track, defaultImport, [REGISTER_TRANSITION, {step: step, identity_type: r12, action_type: actionType,
action_details: details, registration_source: r7, invite_code: r8?.code,
invite_channel_id: r8 == null || r8.channel == null ? undefined : r8.channel.id,
invite_channel_type: r8 == null || r8.channel == null ? undefined : r8.channel.type,
invite_guild_id: r8 == null || r8.guild == null ? undefined : r8.guild.id,
invite_inviter_id: r8 == null || r8.inviter == null ? undefined : r8.inviter.id, from_step: fromStep,
to_step: toStep}]);
}
function getTrackRegTransition(a0) { // fn#108317, offset: 0x0231c5f8, size: 18 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun108318;
}
function BackButtonWithTracking(a0) { // fn#108319, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14509:1900, offset: 0x0231c6f6, size: 134 bytes, params: 2, frame: 18
const binding = env0_3;
const useContext = binding.useContext;
const TrackRegistrationContext = (require(14302) /* metro dependency 14302: Auth */).TrackRegistrationContext;
const env0_0 = Reflect.apply(useContext, binding, [TrackRegistrationContext]);
const env0_1 = a0.destinationStep;
const env0_2 = a0.onPress;
const HeaderBackButton = (require(5287) /* metro dependency 5287 */).HeaderBackButton;
return <HeaderBackButton {...a0} {...{['onPress']: BackButtonWithTrackingOnPress}} />;
}
function getCommonErrorDetails(a0) { // fn#108321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14509:2127, offset: 0x0231c7c5, size: 333 bytes, params: 2, frame: 13
if (a0 === -1) {
return '' + a0 + ': Captcha was not completed';
}
if (a0 === 0) {
return '' + a0 + ': Internal server error';
}
if (a0 === 40333) {
return '' + a0 + ': Blocked by proxy';
}
if (a0 === 50022) {
return '' + a0 + ': Phone number invalid';
}
if (a0 === 70005) {
return '' + a0 + ': Phone number not mobile';
}
if (a0 === 70003) {
return '' + a0 + ': Unable to send sms to phone number';
}
if (a0 === 70008) {
return '' + a0 + ': Phone number already associated with an account';
}
if (a0 === 70011) {
return '' + a0 + ': Phone number already associated with an account';
}
if (a0 === undefined) {
return 'No error code';
}
return a0.toString();
}
function _fun108318({step, toStep, actionType, details, overrideRegistrationOptions}) { // fn#108318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14509:1490, offset: 0x0231c60a, size: 236 bytes, params: 2, frame: 18
var r0;
const value = environment.__proto__;
const VIEWED = RegistrationTransitionActionTypes.VIEWED;
if (actionType !== VIEWED) {
if (actionType === RegistrationTransitionActionTypes.VIEWED) {
if (step != null) {
trackRegTransition({step: step, fromStep: env0_0.current, actionType: actionType});
}
env0_0.current = step;
r0 = undefined;
} else {
if (step != null) {
trackRegTransition({step: step, toStep: toStep, actionType: actionType, details: details,
overrideRegistrationOptions: overrideRegistrationOptions});
}
r0 = undefined;
}
return r0;
}
const CAPTCHA = RegisterTransitionSteps.CAPTCHA;
if (step !== CAPTCHA) {
if (actionType === RegistrationTransitionActionTypes.VIEWED) {
if (step != null) {
trackRegTransition({step: step, fromStep: env0_0.current, actionType: actionType});
}
env0_0.current = step;
r0 = undefined;
} else {
if (step != null) {
trackRegTransition({step: step, toStep: toStep, actionType: actionType, details: details,
overrideRegistrationOptions: overrideRegistrationOptions});
}
r0 = undefined;
}
return r0;
}
trackRegTransition({step: step, fromStep: env0_0.current, actionType: actionType});
}
function BackButtonWithTrackingOnPress() { // fn#108320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14509:2037, owner: BackButtonWithTracking.onPress, offset: 0x0231c77c, size: 73 bytes, params: 1, frame: 14
var value2;
if (onPress != null) {
value2 = environment.__proto__;
clearRegistrationErrorMessage();
env0_0({step: destinationStep, actionType: RegistrationTransitionActionTypes.VIEWED});
onPress();
}
}