decord/beta/source/modules/auth/native/RegistrationUtils.tsx
github-actions e7a050048e chore: update source for beta 347.7
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4943.js (118.4 MB)
2026-09-21 19:31:18 +00:00

235 lines
7.5 KiB
TypeScript

// Module ID: 16288
// Function ID: 16289
// Name: RegistrationUtils
// Dependencies: [19, 4742, 9017, 16280, 16281, 1078, 21, 1245, 558, 568, 16277, 5848, 2]
// Exports: getCommonErrorDetails, getTrackRegTransition, hasAllRegistrationFieldsCompleted
// Module 16288 (RegistrationUtils)
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1245 */;
import noop from "module_19" /* 19 */;
import InviteStore from "InviteStore" /* 4742 */;
import DisplayedInviteStore from "DisplayedInviteStore" /* 9017 */;
const require = globalThis.__r;
const require = fn;
function trackRegTransition(overrideRegistrationOptions) {
let registrationOptions = overrideRegistrationOptions.overrideRegistrationOptions;
({ step, fromStep, toStep, actionType, details } = overrideRegistrationOptions);
const displayedInviteCode = DisplayedInviteStore.getDisplayedInviteCode();
if (registrationOptions == null) {
registrationOptions = state.getState().registrationOptions;
}
let invite = null;
if (null != displayedInviteCode) {
invite = InviteStore.getInvite(displayedInviteCode);
}
let str = null;
if (null != invite) {
str = "invite";
}
let email;
if (registrationOptions != null) {
email = registrationOptions.email;
}
let str2 = "email";
if (null == email) {
let phone;
if (registrationOptions != null) {
phone = registrationOptions.phone;
}
str2 = null;
if (null != phone) {
str2 = "phone";
}
}
const obj2 = { step, identity_type: str2, action_type: actionType, action_details: details, registration_source: str, invite_code: null, invite_channel_id: null, invite_channel_type: null, invite_guild_id: null, invite_inviter_id: null, from_step: null, to_step: null };
let code;
if (invite != null) {
code = invite.code;
}
obj2.invite_code = code;
let id;
if (invite != null) {
const channel = invite.channel;
if (channel != null) {
id = channel.id;
}
}
obj2.invite_channel_id = id;
let type;
if (invite != null) {
const channel2 = invite.channel;
if (channel2 != null) {
type = channel2.type;
}
}
obj2.invite_channel_type = type;
let id1;
if (invite != null) {
guild = invite.guild;
if (guild != null) {
id1 = guild.id;
}
}
obj2.invite_guild_id = id1;
let id2;
if (invite != null) {
const inviter = invite.inviter;
if (inviter != null) {
id2 = inviter.id;
}
}
obj2.invite_inviter_id = id2;
obj2.from_step = fromStep;
obj2.to_step = toStep;
AnalyticsUtilsDefault.track(AnalyticEvents.REGISTER_TRANSITION, obj2);
}
const RegistrationUIStore = fn(16280);
({ clearRegistrationErrorMessage: metroRequire, useRegistrationUIStore: closure_7 } = RegistrationUIStore);
const RegistrationConstants = fn(16281);
({ RegisterTransitionSteps: closure_8, RegistrationTransitionActionTypes: closure_9 } = RegistrationConstants);
const AnalyticEvents = fn(1078).AnalyticEvents;
const jsx = fn(21).jsx;
const ReactCompilerGating = fn(558);
const size = fn(2);
const result = size.fileFinishedImporting("modules/auth/native/RegistrationUtils.tsx");
export const hasAllRegistrationFieldsCompleted = function hasAllRegistrationFieldsCompleted(email, isConsentRequired) {
isConsentRequired = isConsentRequired.isConsentRequired;
let tmp = null != email.email || null != email.phoneToken;
if (tmp) {
let tmp2 = null != email.username;
if (tmp2) {
let tmp3 = null != email.password;
if (tmp3) {
let tmp4 = null != email.birthday;
if (tmp4) {
let tmp5 = null != email.consent;
if (tmp5) {
let tmp6 = !isConsentRequired;
if (isConsentRequired) {
tmp6 = true === email.consent;
}
tmp5 = tmp6;
}
tmp4 = tmp5;
}
tmp3 = tmp4;
}
tmp2 = tmp3;
}
tmp = tmp2;
}
return tmp;
};
export { trackRegTransition };
export function getTrackRegTransition(arg0) {
return (arg0) => {
({ step, actionType, toStep, details, overrideRegistrationOptions } = arg0);
if (actionType === constants2.VIEWED) {
if (step === constants.CAPTCHA) {
const obj = { step, fromStep: ref.current, actionType };
trackRegTransition(obj);
}
}
if (actionType === constants2.VIEWED) {
if (null != step) {
const obj2 = { step, fromStep: ref.current, actionType };
trackRegTransition(obj2);
}
ref.current = step;
} else if (null != step) {
const obj3 = { step, toStep, actionType, details, overrideRegistrationOptions };
trackRegTransition(obj3);
}
return tmp9;
};
}
export const BackButtonWithTracking = ReactCompilerGating.isReactCompilerEnabled() ? ((destinationStep) => {
const cResult = context(onPress[9]).c(7);
context = noop.useContext(context(onPress[10]).TrackRegistrationContext);
destinationStep = destinationStep.destinationStep;
onPress = destinationStep.onPress;
if (cResult[0] === destinationStep) {
if (cResult[1] === onPress) {
if (cResult[2] === context) {
let tmp5 = cResult[3];
}
if (cResult[4] === tmp5) {
if (cResult[5] === destinationStep) {
let tmp6 = cResult[6];
}
return tmp6;
}
const obj2 = {};
const merged = Object.assign(destinationStep);
obj2.onPress = tmp5;
const tmp11 = jsx(context(onPress[11]).HeaderBackButton, {});
cResult[4] = tmp5;
cResult[5] = destinationStep;
cResult[6] = tmp11;
tmp6 = tmp11;
}
}
const fn = function o() {
if (null != onPress) {
timestampProducer();
const obj = { step: destinationStep, actionType: constants2.VIEWED };
context(obj);
tmp();
}
};
cResult[0] = destinationStep;
cResult[1] = onPress;
cResult[2] = context;
cResult[3] = fn;
tmp5 = fn;
}) : ((arg0) => {
_require = noop.useContext(require("Auth").TrackRegistrationContext);
({ destinationStep: importDefault, onPress: dependencyMap } = arg0);
let obj = {};
const merged = Object.assign(arg0);
obj.onPress = function onPress() {
if (null != dependencyMap) {
timestampProducer();
const obj = { step, actionType: constants2.VIEWED };
closure_0(obj);
tmp();
}
};
return jsx(require("module_5848").HeaderBackButton, {});
});
export const getCommonErrorDetails = function getCommonErrorDetails(error_code) {
if (-1 === error_code) {
const _HermesInternal7 = HermesInternal;
return "" + error_code + ": Captcha was not completed";
} else if (0 === error_code) {
const _HermesInternal6 = HermesInternal;
return "" + error_code + ": Internal server error";
} else if (40333 === error_code) {
const _HermesInternal5 = HermesInternal;
return "" + error_code + ": Blocked by proxy";
} else if (50022 === error_code) {
const _HermesInternal4 = HermesInternal;
return "" + error_code + ": Phone number invalid";
} else if (70005 === error_code) {
const _HermesInternal3 = HermesInternal;
return "" + error_code + ": Phone number not mobile";
} else if (70003 === error_code) {
const _HermesInternal2 = HermesInternal;
return "" + error_code + ": Unable to send sms to phone number";
} else {
if (70008 !== error_code) {
if (70011 !== error_code) {
if (undefined === error_code) {
return "No error code";
} else {
return error_code.toString();
}
}
}
const _HermesInternal = HermesInternal;
return "" + error_code + ": Phone number already associated with an account";
}
};