Files
2026-07-28 01:06:53 +03:00

153 lines
8.7 KiB
TypeScript

/* Metro module 14312; source: modules/auth/native/RegistrationUtils.tsx; dependencies: [31, 4097, 9156, 14304, 14305, 661, 33, 683, 14302, 5287, 2] */
import AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import InviteStore from '../../../stores/InviteStore.tsx'; /* Metro dependency 4097 */
import DisplayedInviteStore from '../../../stores/native/DisplayedInviteStore.tsx'; /* Metro dependency 9156 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
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 ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as Module05287Module from '../../../by-id/module-05287.js'; /* Metro dependency 5287 */
import * as AuthModule from './components/Auth.tsx'; /* Metro dependency 14302 */
import * as RegistrationUIStoreModule from './RegistrationUIStore.tsx'; /* Metro dependency 14304 */
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 trackRegTransition2 = trackRegTransition;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = RegistrationUIStoreModule;
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;
(FileImportTrackerModule).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 = trackRegTransition2;
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 = 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 _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 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 useContext = ReactModule.useContext;
const TrackRegistrationContext = (AuthModule).TrackRegistrationContext;
const env0_0 = Reflect.apply(useContext, ReactModule, [TrackRegistrationContext]);
const env0_1 = a0.destinationStep;
const env0_2 = a0.onPress;
const HeaderBackButton = (Module05287Module).HeaderBackButton;
return <HeaderBackButton {...a0} {...{['onPress']: BackButtonWithTrackingOnPress}} />;
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();
}
}
}
}
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();
}
global.__d(_fun108314, 14312, [31, 4097, 9156, 14304, 14305, 661, 33, 683, 14302, 5287,
2]) /* metro module 14312, dependencies: [31, 4097, 9156, 14304, 14305, 661, 33, 683, 14302, 5287, 2] */;