This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,106 @@
// Metro module 7626 (f7627).
import { useState, useEffect, useMemo } from "react";
import AgeVerificationStore from "../AgeVerificationStore";
import { VERIFICATION_METHOD_TITLE_MAP, VerificationMethod } from "../AgeVerificationConstants";
import { useStateFromStoresObject } from "../../../_bundle/Module589";
import { useInitiateAgeVerification } from "../AgeVerificationUtils";
import { AgeVerificationModalEntryPoint, AgeVerificationModalVersion, AgeVerificationModalCta, trackAgeVerificationModalClicked } from "../AgeVerificationAnalyticsUtils";
import { checkGoogleWalletAvailable } from "../GoogleWalletActionCreators.native";
import MonitoringAgent from "../../monitoring/MonitoringAgent";
import { MetricEvents } from "../../../_bundle/Module5872";
import { isGoogleWalletEnabled } from "../GoogleWalletExperiment";
import { getAgeVerificationMethods } from "../AgeVerificationURLActionCreators";
import { intl } from "../../../intl/index.native";
export default function useAgeVerificationMethods({ onClose, classificationId, onGoogleWalletSelect }) {
let methods, initiateAgeVerification, state, setState;
methods = void 0;
initiateAgeVerification = void 0;
state = void 0;
setState = void 0;
const stateFromStoresObject = useStateFromStoresObject([AgeVerificationStore], () => ({
methods: AgeVerificationStore.methods,
loading: AgeVerificationStore.loading
}));
methods = stateFromStoresObject.methods;
const loading = stateFromStoresObject.loading;
initiateAgeVerification = useInitiateAgeVerification({
onComplete: onClose,
entryPoint: AgeVerificationModalEntryPoint.EXPRESSIVE_GET_STARTED,
shouldShowExpressiveModal: true,
classificationId
}).initiateAgeVerification;
[state, setState] = useState(false);
useEffect(() => {
let c26011_0 = false;
checkGoogleWalletAvailable().then((result) => {
if (!c26011_0) {
let r9 = result;
MonitoringAgent.increment({
name: MetricEvents.GOOGLE_WALLET_AVAILABILITY_CHECK,
tags: [`available:${result}`]
});
if (result) {
r9 = isGoogleWalletEnabled("age_verification_methods");
}
setState(r9);
}
});
return () => {
c26011_0 = true;
};
}, []);
useEffect(() => {
if (methods == null) {
getAgeVerificationMethods();
}
}, [methods]);
return {
ageVerificationMethods: useMemo(() => {
let r6 = methods == null ? void 0 : methods.filter((method) => method !== VerificationMethod.GOOGLE_WALLET).map((item) => {
const r11 = VERIFICATION_METHOD_TITLE_MAP[item];
if (r11 == null) {
return null;
}
const { title, description } = r11;
const r21 = {
id: item,
title: intl.string(title),
description: intl.string(description),
onClick: null
};
let c29844_1 = async (c31439_0) => {
const EXPRESSIVE_PRIMARY = AgeVerificationModalVersion.EXPRESSIVE_PRIMARY;
const METHOD_SELECT = AgeVerificationModalCta.METHOD_SELECT;
trackAgeVerificationModalClicked(c31439_0, EXPRESSIVE_PRIMARY, METHOD_SELECT, item);
await initiateAgeVerification(item);
};
r21.onClick = function() {
return c29844_1.apply(this, arguments);
};
return r21;
}).filter((item) => item != null);
if (r6 == null) {
r6 = [];
}
if (state && onGoogleWalletSelect != null) {
const r28 = VERIFICATION_METHOD_TITLE_MAP[VerificationMethod.GOOGLE_WALLET];
if (r28 != null) {
return [...r6, {
id: VerificationMethod.GOOGLE_WALLET,
title: intl.string(r28.title),
description: intl.string(r28.description),
onClick: (a0) => {
MonitoringAgent.increment({
name: MetricEvents.GOOGLE_WALLET_METHOD_SELECTED
});
trackAgeVerificationModalClicked(a0, AgeVerificationModalVersion.EXPRESSIVE_PRIMARY, AgeVerificationModalCta.METHOD_SELECT, VerificationMethod.GOOGLE_WALLET);
onGoogleWalletSelect();
}
}];
}
}
return r6;
}, [methods, state, onGoogleWalletSelect, initiateAgeVerification]),
loading
};
};