Files
discord-decomp/sources/modules/age_assurance/hooks/useAgeVerificationMethods.tsx
T
2026-07-28 01:06:53 +03:00

192 lines
12 KiB
TypeScript

/* Metro module 6253; source: modules/age_assurance/hooks/useAgeVerificationMethods.tsx; dependencies: [5, 57, 31, 5261, 5262, 566, 4813, 5074, 6254, 4826, 4831, 6256, 6257, 1244, 2] */
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import MonitoringAgent from '../../monitoring/MonitoringAgent.tsx'; /* Metro dependency 4826 */
import AgeVerificationStore from '../AgeVerificationStore.tsx'; /* Metro dependency 5261 */
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 IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as AgeVerificationUtilsModule from '../AgeVerificationUtils.tsx'; /* Metro dependency 4813 */
import * as MetricEventsModule from '../../../external/discord_common/js/shared/shared-constants/MetricEvents.tsx'; /* Metro dependency 4831 */
import * as AgeVerificationAnalyticsUtilsModule from '../AgeVerificationAnalyticsUtils.tsx'; /* Metro dependency 5074 */
import * as AgeVerificationConstantsModule from '../AgeVerificationConstants.tsx'; /* Metro dependency 5262 */
function _fun49367(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#49367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:6, offset: 0x011f7dbc, size: 199 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/age_assurance/hooks/useAgeVerificationMethods.tsx');
exports.default = useAgeVerificationMethods;
function useAgeVerificationMethods({onClose, classificationId, onGoogleWalletSelect}) { // fn#49368, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:209, offset: 0x011f7e83, size: 322 bytes, params: 2, frame: 22
const {methods,
loading} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([AgeVerificationStore],
function() {
var ageVerificationStoreBinding = AgeVerificationStore;
return {methods: ageVerificationStoreBinding.methods, loading: ageVerificationStoreBinding.loading};
});
const useInitiateAgeVerification = AgeVerificationUtilsModule.useInitiateAgeVerification;
object = {onComplete: onClose};
const AgeVerificationModalEntryPoint = (AgeVerificationAnalyticsUtilsModule).AgeVerificationModalEntryPoint;
const EXPRESSIVE_GET_STARTED = AgeVerificationModalEntryPoint.EXPRESSIVE_GET_STARTED;
object.entryPoint = EXPRESSIVE_GET_STARTED;
object.shouldShowExpressiveModal = true;
object.classificationId = classificationId;
const initiateAgeVerification = Reflect.apply(useInitiateAgeVerification, AgeVerificationUtilsModule,
[object]).initiateAgeVerification;
const [property, env0_4] = env0_4Binding(ReactModule.useState(false), 2);
ReactModule.useEffect(_fun49370, []);
ReactModule.useEffect(_fun49373, [methods]);
const useMemo = ReactModule.useMemo;
return {ageVerificationMethods: Reflect.apply(useMemo, ReactModule, [_fun49374, [methods, property,
onGoogleWalletSelect, initiateAgeVerification]]), loading: loading};
function _fun49370() { // fn#49370, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:664, offset: 0x011f7fe6, size: 65 bytes, params: 1, frame: 12
var environment;
let value = environment.__proto__;
value = require(6254) /* metro dependency 6254: GoogleWalletActionCreatorsNative */;
value = value.checkGoogleWalletAvailable();
value.then(_fun49371);
return function() {
env0_0 = true;
};
function _fun49371(a0) { // fn#49371, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:728, offset: 0x011f8027, size: 179 bytes, params: 2, frame: 17
var r0;
var value3;
var defaultImport;
var increment;
var object;
var value5;
var binding;
let value = a0;
if (!env0_0) {
value3 = environment.__proto__.__proto__;
defaultImport = importDefault(4826) /* metro dependency 4826: MonitoringAgent */;
increment = defaultImport.increment;
object = {};
object.name = (require(4831) /* metro dependency 4831: MetricEvents */).MetricEvents.GOOGLE_WALLET_AVAILABILITY_CHECK;
object.tags = ['available:' + value];
Reflect.apply(increment, defaultImport, [object]);
value5 = environment.__proto__;
binding = env1_4;
if (value) {
value = require(6256) /* metro dependency 6256: GoogleWalletExperiment */;
value = value.isGoogleWalletEnabled('age_verification_methods');
r0 = value;
} else {
r0 = value;
}
binding(r0);
}
}
}
function _fun49373() { // fn#49373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:940, offset: 0x011f80da, size: 52 bytes, params: 1, frame: 11
var value;
if (methods == null) {
value = environment.__proto__;
value = require(6257) /* metro dependency 6257: AgeVerificationURLActionCreators */;
value.getAgeVerificationMethods();
}
}
function _fun49374() { // fn#49374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:1015, offset: 0x011f810e, size: 254 bytes, params: 1, frame: 21
var environment;
var object;
var property;
var intl;
var items2;
var value;
let r3 = methods == null ? undefined : methods.filter(function(a0) {
return a0 !== VerificationMethod.GOOGLE_WALLET;
}).map(_fun49376).filter(_fun49380);
r3 = r3 ?? [];
if (Module00005) {
if (onGoogleWalletSelect == null) {
return r3;
}
value = environment.__proto__;
property = VERIFICATION_METHOD_TITLE_MAP[VerificationMethod.GOOGLE_WALLET];
if (property != null) {
object = {};
object.id = VerificationMethod.GOOGLE_WALLET;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object.title = intl.string(property.title);
object.description = (require(1244) /* metro dependency 1244: indexNative */).intl.string(property.description);
object.onClick = onClick_49381;
items2 = [];
value = arraySpread(items2, r3, 0, intl);
items2[value] = object;
value + 1;
return items2;
}
}
return r3;
function _fun49376(a0) { // fn#49376, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:1092, offset: 0x011f8222, size: 143 bytes, params: 2, frame: 20
const env0_0 = a0;
const property = VERIFICATION_METHOD_TITLE_MAP[a0];
if (property == null) {
return null;
}
const title = property.title;
const description = property.description;
const object = {id: a0};
const intl = (IndexNativeModule).intl;
object.title = intl.string(title);
object.description = intl.string(description);
const env0_1 = env2_3(_fun49378);
object.onClick = onClick_49379;
return object;
function* _fun49378(a0) { // fn#49378, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:1254, offset: 0x011f82ba, size: 131 bytes, params: 2, frame: 19
if (true) {
value = environment.__proto__.__proto__.__proto__.__proto__;
var binding = env4_0;
var binding2 = env4_2;
value = binding(binding2[7]);
var trackAgeVerificationModalClicked = value.trackAgeVerificationModalClicked;
var AgeVerificationModalVersion = binding(binding2[7]).AgeVerificationModalVersion;
var EXPRESSIVE_PRIMARY = AgeVerificationModalVersion.EXPRESSIVE_PRIMARY;
var AgeVerificationModalCta = binding(binding2[7]).AgeVerificationModalCta;
var METHOD_SELECT = AgeVerificationModalCta.METHOD_SELECT;
binding = env1_0;
Reflect.apply(trackAgeVerificationModalClicked, value, [a0, EXPRESSIVE_PRIMARY, METHOD_SELECT, binding]);
value = environment.__proto__.__proto__.__proto__;
yield dependencyMap(binding);
}
}
function onClick_49379() { // fn#49379, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:1428, offset: 0x00c3b2ba, size: 30 bytes, params: 1, frame: 13
return env0_1.apply(this, arguments);
}
}
function onClick_49381(a0) { // fn#49381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:1673, offset: 0x011f833d, size: 163 bytes, params: 2, frame: 19
const defaultImport = MonitoringAgent;
const increment = defaultImport.increment;
const MetricEvents = (MetricEventsModule).MetricEvents;
const GOOGLE_WALLET_METHOD_SELECTED = MetricEvents.GOOGLE_WALLET_METHOD_SELECTED;
Reflect.apply(increment, defaultImport, [{name: GOOGLE_WALLET_METHOD_SELECTED}]);
const trackAgeVerificationModalClicked = AgeVerificationAnalyticsUtilsModule.trackAgeVerificationModalClicked;
const AgeVerificationModalVersion = AgeVerificationAnalyticsUtilsModule.AgeVerificationModalVersion;
const EXPRESSIVE_PRIMARY = AgeVerificationModalVersion.EXPRESSIVE_PRIMARY;
const AgeVerificationModalCta = AgeVerificationAnalyticsUtilsModule.AgeVerificationModalCta;
const METHOD_SELECT = AgeVerificationModalCta.METHOD_SELECT;
const GOOGLE_WALLET = VerificationMethod.GOOGLE_WALLET;
Reflect.apply(trackAgeVerificationModalClicked, AgeVerificationAnalyticsUtilsModule, [a0, EXPRESSIVE_PRIMARY,
METHOD_SELECT, GOOGLE_WALLET]);
onGoogleWalletSelect();
}
}
}
}
function _fun49380(a0) { // fn#49380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6431:1484, offset: 0x00d0b2f0, size: 11 bytes, params: 2, frame: 2
return a0 != null;
}
global.__d(_fun49367, 6253, [5, 57, 31, 5261, 5262, 566, 4813, 5074, 6254, 4826, 4831, 6256, 6257, 1244,
2]) /* metro module 6253, dependencies: [5, 57, 31, 5261, 5262, 566, 4813, 5074, 6254, 4826, 4831, 6256, 6257, 1244, 2] */;