// Metro module 6747 (f6748). import _asyncToGenerator from "../../_bundle/_asyncToGenerator"; import UserStore from "../../stores/UserStore"; import { AGE_VERIFICATION_MODAL_KEY, AGE_VERIFICATION_QUEST_UNSUPPORTED_ALERT_KEY, VerificationVendorName, AGE_VERIFICATION_GET_STARTED_MODAL_KEY } from "./AgeVerificationConstants"; import { AGE_VERIFICATION_INCODE_PATH } from "./AgeVerificationIncodeWebViewConstants"; import { NativePermissionTypes } from "../native_permissions/NativePermissionConstants"; import { SafetyToastType } from "../safety_common/Constants"; import { jsx } from "react/jsx-runtime"; import NativePermissionUtils from "../native_permissions/NativePermissionUtils"; import ModalActionCreators from "../../actions/ModalActionCreators"; import SafetyToastsActionCreators_native from "../safety_common/SafetyToastsActionCreators.native"; import { isMetaQuest } from "../device/MetaQuestUtils.android"; import { openAlert } from "../../design/components/AlertModal/native/useAlertStore.native"; import AgeVerificationQuestUnsupportedAlertModal from "./native/AgeVerificationQuestUnsupportedAlertModal"; import { isAgeVerificationIncodeEnabled } from "./AgeVerificationIncodeExperiment"; import { isAgeVerified } from "./AgeVerificationUtils"; import { hasAgeGatedFeatures } from "../regional_feature_config/RegionalFeatureConfigUtils"; import Dispatcher from "../../Dispatcher"; import { isExpressiveModalV2Enabled } from "./ExpressiveModalV2Experiment"; import { isAgeVerificationExpressiveModalEverywhereEnabled } from "./AgeVerificationExpressiveModalEverywhereExperiment"; import Linking from "../../lib/native/Linking"; function $mk115026($env) { return function*() { let env31436 = { $parent: $env }; env31436[1] = 0; env31436[2] = 0; let env31969; const r22 = void 0; const r9 = env31969 = { $parent: r22 }; env31436[0] = r9; env31969[0] = void 0; const r35 = yield import("./native/AgeVerificationIncodeModal"); const r43 = env31436[0]; r43[0] = r35.default; return $mk118783(r43); }; } function $mk115027($env) { return () => { const Component = $env[0]; const r4 = $env.$parent; return ; }; } function $mk115028($env) { return () => { const Component = $env[0]; const r4 = $env.$parent; return ; }; } function $mk115029($env) { return () => { const Component = $env[0]; const r4 = $env.$parent; return ; }; } function $mk118018($env) { return () => { const r3 = $env[1]; return r3 == null ? void 0 : r3(); }; } function $mk118783($env) { return () => { const r3 = $env.$parent.$parent[12]; const r2 = $env[0]; const r4 = $env.$parent; return r3(r2, { webviewUrl: r4[2], onClose: r4[0], onComplete: r4[1] }); }; } let env4334 = {}; const openIncodeAgeVerificationModal = function openIncodeAgeVerificationModal({ onClose: onClose2, onComplete: onComplete2 }) { const WEBAPP_ENDPOINT = window.GLOBAL_ENV?.WEBAPP_ENDPOINT; const r21 = WEBAPP_ENDPOINT == null; let r22 = null; if (!r21) { r22 = null; if (WEBAPP_ENDPOINT !== "") { const r12 = URL; const concat = HermesInternal.concat; let r8 = "https:"; const hostname = new r12(concat.call("https:", WEBAPP_ENDPOINT)).hostname; if (!(hostname !== "localhost" && (hostname !== "127.0.0.1" && !/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(hostname)))) { r8 = "http:"; } r22 = `${r8}${WEBAPP_ENDPOINT}${AGE_VERIFICATION_INCODE_PATH}`; } } let c15892_2 = r22; let r35 = r22 != null; if (r35) { (async () => { let c25979_0, c25979_1; let c25979_2 = 0; const r11 = void 0; L12: { try { c25979_1 = r11; c25979_0 = r11; c25979_2 = 1; await NativePermissionUtils.requestPermission(NativePermissionTypes.CAMERA, { showAuthorizationError: true }); await ModalActionCreators.pushLazy((0, _asyncToGenerator)($mk115026(c25979_0)), {}, AGE_VERIFICATION_MODAL_KEY); c25979_2 = 0; } catch ($e) { let r27 = $e; if (c25979_2 !== 0) { while (true) { try { c25979_2 = 0; SafetyToastsActionCreators_native.showFailedToast(SafetyToastType.TIGGER_PAWTECT_ERROR); (0, onClose2)(); break L12; } catch ($e) { r27 = $e; if (c25979_2 === 0) { break; } } } } throw r27; } } })(); r35 = true; } return r35; }; const r36 = { showAgeVerification: function showAgeVerification(a0) { let r29; let onClose3 = a0.onClose; if (onClose3 === void 0) { onClose3 = () => {}; } let env15893; L11: { env15893 = { $parent: env4334 }; env15893[0] = onClose3; a0.shouldShowExpressiveModal; const { webviewUrl, onClose, shouldShowExpressiveModal, verificationVendorName, incodeParameters, ...rest } = a0; env15893[1] = webviewUrl; a0.incodeParameters; env15893[2] = rest; if (isMetaQuest()) { openAlert(AGE_VERIFICATION_QUEST_UNSUPPORTED_ALERT_KEY, (0, jsx)(AgeVerificationQuestUnsupportedAlertModal, {}), onClose3); r29 = true; } else { if (verificationVendorName === VerificationVendorName.INCODE && isAgeVerificationIncodeEnabled(rest.entryPoint)) { r29 = openIncodeAgeVerificationModal({ onClose: onClose3, onComplete: rest.onComplete }); break L11; } r29 = webviewUrl != null; if (r29) { ModalActionCreators.pushLazy(async () => { let env29832; const r9 = env29832 = { $parent: env15893 }; let c25980_0 = r9; env29832[0] = void 0; const r35 = await import("./native/AgeVerificationModal"); env29832[0] = r35.default; return $mk115027(c25980_0); }, {}, AGE_VERIFICATION_MODAL_KEY); r29 = true; } } } return r29; }, showAgeVerificationGetStartedModal: function showAgeVerificationGetStartedModal(a0) { let env15894 = { $parent: env4334 }; const entryPoint = a0.entryPoint; env15894[0] = entryPoint; const onClose3 = a0.onClose; env15894[1] = onClose3; env15894[2] = void 0; env15894[3] = void 0; env15894[4] = void 0; if (isMetaQuest()) { openAlert(AGE_VERIFICATION_QUEST_UNSUPPORTED_ALERT_KEY, (0, jsx)(AgeVerificationQuestUnsupportedAlertModal, {}), onClose3); } else { env15894[2] = isAgeVerified() && hasAgeGatedFeatures(); if (isAgeVerificationIncodeEnabled(entryPoint)) { const ageVerificationStatus = UserStore.getCurrentUser()?.ageVerificationStatus; const handleClose = function handleClose() { Dispatcher.dispatch({ type: "CLOSE_AGE_VERIFICATION_MODAL", status: env15894[3] }); const r12 = env15894[1]; if (r12 != null) { r12(); } }; env15894[3] = ageVerificationStatus; Dispatcher.dispatch({ type: "INITIATE_AGE_VERIFICATION" }); if (!openIncodeAgeVerificationModal({ onClose: handleClose, onComplete: () => {} })) { Dispatcher.dispatch({ type: "CLOSE_AGE_VERIFICATION_MODAL", status: ageVerificationStatus }); if (onClose3 != null) { onClose3(); } } return void 0; } if (isExpressiveModalV2Enabled(entryPoint)) { ModalActionCreators.pushLazy(async () => { let env29833; const r9 = env29833 = { $parent: env15894 }; let c25981_0 = r9; env29833[0] = void 0; const r35 = await import("./native/AgeVerificationExpressiveV2Modal"); env29833[0] = r35.default; return $mk115028(c25981_0); }, {}, AGE_VERIFICATION_GET_STARTED_MODAL_KEY); } else { env15894[4] = isAgeVerificationExpressiveModalEverywhereEnabled(entryPoint); ModalActionCreators.pushLazy(async () => { let env29834; const r9 = env29834 = { $parent: env15894 }; let c25982_0 = r9; env29834[0] = void 0; const r35 = await import("./native/AgeVerificationGetStartedModal"); env29834[0] = r35.default; return $mk115029(c25982_0); }, {}, AGE_VERIFICATION_GET_STARTED_MODAL_KEY); } } }, openUrl: function openUrl(a0) { Linking.openURL(a0); } }; export default r36;