225 lines
14 KiB
TypeScript
225 lines
14 KiB
TypeScript
/* Metro module 14340; source: modules/auth/native/components/RegisterAgeGate.tsx; dependencies: [57, 31, 27, 5078, 14304, 14305, 661, 33, 4501, 697, 3738, 14341, 3868, 1484, 14302, 566, 8986, 14320, 14303, 44, 9001, 1244, 7682, 8554, 14342, 4578, 8970, 9068, 4002, 2] */
|
|
import Module00044 from '../../../../by-id/module-00044.js'; /* Metro dependency 44 */
|
|
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import Native from '../../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
|
|
import Module03738 from '../../../../by-id/module-03738.js'; /* Metro dependency 3738 */
|
|
import ConsentStore from '../../../../stores/ConsentStore.tsx'; /* Metro dependency 5078 */
|
|
import GetError from '../getError.tsx'; /* Metro dependency 8986 */
|
|
import AuthFormView from './AuthFormView.tsx'; /* Metro dependency 9001 */
|
|
import UseAuthFlowBackHandler from './utils/useAuthFlowBackHandler.tsx'; /* Metro dependency 14320 */
|
|
import PrivacyHint from './PrivacyHint.tsx'; /* Metro dependency 14342 */
|
|
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 ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as UseNavigationNativeModule from '../../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
|
|
import * as NativeModule from '../../../../external/discord_common/js/packages/design/native.tsx'; /* Metro dependency 3868 */
|
|
import * as ButtonNativeModule from '../../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
|
|
import * as InputNativeModule from '../../../../design/components/Input/native/Input.native.tsx'; /* Metro dependency 7682 */
|
|
import * as NativeModule2 from '../../../../design/components/experimental/native.tsx'; /* Metro dependency 8554 */
|
|
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 _fun108525(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#108525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:6, offset: 0x02323f5e, size: 545 bytes, params: 8, frame: 22
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = RegistrationUIStoreModule;
|
|
const env0_7 = value.updateRegistrationOptions;
|
|
const env0_8 = value.useRegistrationUIStore;
|
|
value = require(14305) /* metro dependency 14305: RegistrationConstants */;
|
|
const env0_9 = value.RegisterTransitionSteps;
|
|
const env0_10 = value.RegistrationTransitionActionTypes;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_12 = value.jsx;
|
|
const env0_13 = value.jsxs;
|
|
const env0_14 = value.Fragment;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
const INTERACTIVE_TEXT_DEFAULT = (Native).colors.INTERACTIVE_TEXT_DEFAULT;
|
|
const env0_15 = Reflect.apply(createStyles, value, [{inputGroup: {'marginTop': 24, 'marginBottom': 24},
|
|
flexGrow: {flexGrow: 1}, button: {'flexGrow': 0, 'marginBottom': 4, 'marginTop': 16, 'flexDirection': 'column'},
|
|
datePickerButton: {color: INTERACTIVE_TEXT_DEFAULT}, page: {flex: 1}}]);
|
|
value = importDefault(3738) /* metro dependency 3738 */;
|
|
value = value.utc();
|
|
const env0_17 = value.toDate();
|
|
const env0_18 = value.clone().endOf('year').toDate();
|
|
value = value.clone();
|
|
value = value.subtract(100, 'years');
|
|
const env0_19 = value.toDate();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/auth/native/components/RegisterAgeGate.tsx');
|
|
exports.default = RegisterAgeGate;
|
|
function RegisterAgeGate() { // fn#108526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:788, offset: 0x0232417f, size: 1593 bytes, params: 1, frame: 42
|
|
const value2 = undefined;
|
|
const styles = useStyles();
|
|
const useThemeContext = NativeModule.useThemeContext;
|
|
const theme = Reflect.apply(useThemeContext, NativeModule, []).theme;
|
|
const env0_0 = (UseNavigationNativeModule).useNavigation();
|
|
const binding = property22;
|
|
const useContext = binding.useContext;
|
|
const TrackRegistrationContext = (AuthModule).TrackRegistrationContext;
|
|
const value3 = Reflect.apply(useContext, binding, [TrackRegistrationContext]);
|
|
let useState = binding.useState;
|
|
let getState = useRegistrationUIStore.getState;
|
|
const birthday = Reflect.apply(getState, useRegistrationUIStore, []).registrationOptions.birthday;
|
|
const value4 = null;
|
|
const value5 = Reflect.apply(useState, binding,
|
|
[value4 != birthday && (importDefault(14341) /* metro dependency 14341: isDateValidDateOfBirth */)(birthday) ? birthday : value4]);
|
|
const binding2 = env0_3;
|
|
const value6 = binding2(value5, 2);
|
|
const property = value6[0];
|
|
var env0_3 = value6[1];
|
|
useState = binding.useState;
|
|
getState = useRegistrationUIStore.getState;
|
|
const consent = Reflect.apply(getState, useRegistrationUIStore, []).registrationOptions.consent;
|
|
const value8 = binding2(Reflect.apply(useState, binding, [value4 != consent && consent]), 2);
|
|
const property2 = value8[0];
|
|
var property22 = property2;
|
|
const env0_5 = value8[1];
|
|
const value9 = binding.useMemo(_fun108527, [property]);
|
|
useState = binding.useState;
|
|
const value10 = binding2(Reflect.apply(useState, binding, [false]), 2);
|
|
const property3 = value10[0];
|
|
const env0_6 = value10[1];
|
|
const value11 = useRegistrationUIStore(function(a0) {
|
|
return a0.submitting;
|
|
});
|
|
const authenticationConsentRequired = (require(566) /* metro dependency 566: flux */).useStateFromStores([ConsentStore],
|
|
function() {
|
|
return ConsentStore.getAuthenticationConsentRequired();
|
|
});
|
|
const value12 = useRegistrationUIStore(function(a0) {
|
|
return a0.errors;
|
|
});
|
|
const value13 = (GetError)('consent', value12);
|
|
const r22 = value4 != value13 ? value13 : value12.message;
|
|
const defaultImport2 = UseAuthFlowBackHandler;
|
|
const getPreviousRegistrationTransitionStep = RegistrationStepsUtilsModule.getPreviousRegistrationTransitionStep;
|
|
const AGE_GATE = AuthStates.AGE_GATE;
|
|
defaultImport2(Reflect.apply(getPreviousRegistrationTransitionStep, RegistrationStepsUtilsModule, [AGE_GATE]));
|
|
property22.useEffect(_fun108531, [value3]);
|
|
const value14 = (importDefault(14341) /* metro dependency 14341: isDateValidDateOfBirth */)(property);
|
|
const jsxRuntimeEnv0_14Binding = jsxRuntimeEnv0_14;
|
|
const object2 = {};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const NgL2GX = (require(1244) /* metro dependency 1244: indexNative */).t.NgL2GX;
|
|
object2.headerText = Reflect.apply(string, intl, [NgL2GX]);
|
|
object2.contentStyle = styles.flexGrow;
|
|
const Input = (InputNativeModule).Input;
|
|
const inputProps = {label: intl.string((require(1244) /* metro dependency 1244: indexNative */).t.xNpFJ6),
|
|
errorMessage: value14 ? value4 : value4 != property ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.udnqh6) : value4};
|
|
const InputButton = (NativeModule2).InputButton;
|
|
const items2 = [
|
|
<View style={styles.inputGroup}>
|
|
<Input {...inputProps}>
|
|
<InputButton
|
|
value={value4 == property ? value2 : property.format('L')}
|
|
text={env0_16.format('L')}
|
|
onPress={onPress_108532}
|
|
accessibilityLabel={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.xNpFJ6)}
|
|
accessibilityHint={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['hZaF/O'])}
|
|
/>
|
|
</Input>
|
|
</View>,
|
|
];
|
|
const Boolean = global.Boolean;
|
|
items2[1] = (
|
|
<PrivacyHint
|
|
consentRequired={Boolean(authenticationConsentRequired)}
|
|
consent={property2}
|
|
onToggleConsent={onToggleConsent}
|
|
/>
|
|
);
|
|
const Button = (ButtonNativeModule).Button;
|
|
items2[2] = (
|
|
<View style={styles.button}>
|
|
<Button
|
|
size="lg"
|
|
loading={value11}
|
|
disabled={!value14}
|
|
onPress={onPress_108535}
|
|
text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['825cFy'])}
|
|
/>
|
|
</View>
|
|
);
|
|
items2[3] = (
|
|
value4 != r22
|
|
? (
|
|
r22 === ''
|
|
? value4
|
|
: ((Component) => <Component>{r22}</Component>)(importDefault(8970) /* metro dependency 8970: FreeFormErrorLabel */)
|
|
)
|
|
: value4
|
|
);
|
|
return (
|
|
<>
|
|
<View style={styles.page}>
|
|
<AuthFormView {...object2}>
|
|
{items2}
|
|
</AuthFormView>
|
|
</View>
|
|
{((Component) => <Component modal open={property3} title={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.xNpFJ6)} mode="date" theme={(require(4002) /* metro dependency 4002: shared */).isThemeLight(theme) ? 'light' : 'dark'} date={value4 != value9 ? value9 : env0_17} maximumDate={env0_18} minimumDate={env0_19} onConfirm={onConfirm_108536} onDateChange={onDateChange} onCancel={onCancel_108538} buttonColor={styles.datePickerButton.color} />)(importDefault(9068) /* metro dependency 9068 */)}
|
|
</>
|
|
);
|
|
function _fun108527() { // fn#108527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:1247, offset: 0x023247b8, size: 34 bytes, params: 1, frame: 10
|
|
return env0_2?.toDate();
|
|
}
|
|
|
|
function _fun108531() { // fn#108531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:1571, offset: 0x023247ed, size: 51 bytes, params: 1, frame: 12
|
|
const binding = env0_1;
|
|
const AGE_GATE = RegisterTransitionSteps.AGE_GATE;
|
|
const VIEWED = RegistrationTransitionActionTypes.VIEWED;
|
|
binding({step: AGE_GATE, actionType: VIEWED});
|
|
}
|
|
|
|
function RegisterAgeGateOnPress() { // fn#108532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:2050, owner: RegisterAgeGate.onPress, offset: 0x0225f36a, size: 18 bytes, params: 1, frame: 11
|
|
return env0_6(true);
|
|
}
|
|
|
|
function onToggleConsent() { // fn#108533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:2251, owner: RegisterAgeGate.onToggleConsent, offset: 0x02324820, size: 25 bytes, params: 1, frame: 11
|
|
return env0_5(function(a0) {
|
|
return !a0;
|
|
});
|
|
}
|
|
|
|
function RegisterAgeGateOnPress_108535() { // fn#108535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:2355, owner: RegisterAgeGate.onPress, offset: 0x02324839, size: 175 bytes, params: 1, frame: 17
|
|
const defaultImport = Module00044;
|
|
let binding = env0_2;
|
|
defaultImport(binding != null, 'birthday was not null');
|
|
updateRegistrationOptions({birthday: binding, consent: ReactModule || !authenticationConsentRequired});
|
|
binding = env0_1;
|
|
let AGE_GATE = RegisterTransitionSteps.AGE_GATE;
|
|
const SUBMITTED = RegistrationTransitionActionTypes.SUBMITTED;
|
|
binding({step: AGE_GATE, actionType: SUBMITTED});
|
|
const handleRegistrationSubmit = RegistrationStepsUtilsModule.handleRegistrationSubmit;
|
|
AGE_GATE = AuthStates.AGE_GATE;
|
|
Reflect.apply(handleRegistrationSubmit, RegistrationStepsUtilsModule, [AGE_GATE, env0_0, binding]);
|
|
}
|
|
|
|
function RegisterAgeGateOnConfirm(a0) { // fn#108536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:2842, owner: RegisterAgeGate.onConfirm, offset: 0x023248e8, size: 58 bytes, params: 2, frame: 13
|
|
env0_6(false);
|
|
const binding = env0_3;
|
|
const value = environment.__proto__;
|
|
binding((Module03738)(a0));
|
|
}
|
|
|
|
function onDateChange(a0) { // fn#108537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:2881, owner: RegisterAgeGate.onDateChange, offset: 0x02324922, size: 47 bytes, params: 2, frame: 12
|
|
const binding = env0_3;
|
|
const value = environment.__proto__;
|
|
binding((Module03738)(a0));
|
|
}
|
|
|
|
function RegisterAgeGateOnCancel() { // fn#108538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14537:2910, owner: RegisterAgeGate.onCancel, offset: 0x0225f37c, size: 18 bytes, params: 1, frame: 11
|
|
return env0_6(false);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun108525, 14340, [57, 31, 27, 5078, 14304, 14305, 661, 33, 4501, 697, 3738, 14341, 3868, 1484, 14302,
|
|
566, 8986, 14320, 14303, 44, 9001, 1244, 7682, 8554, 14342, 4578, 8970, 9068, 4002,
|
|
2]) /* metro module 14340, dependencies: [57, 31, 27, 5078, 14304, 14305, 661, 33, 4501, 697, 3738, 14341, 3868, 1484, 14302, 566, 8986, 14320, 14303, 44, 9001, 1244, 7682, 8554, 14342, 4578, 8970, 9068, 4002, 2] */;
|