74 lines
3.1 KiB
TypeScript
74 lines
3.1 KiB
TypeScript
// Metro module 6769 (f6770).
|
|
import { useCallback, useMemo } from "react";
|
|
import { AGE_VERIFICATION_MODAL_KEY } from "../AgeVerificationConstants";
|
|
import { useIsSuspendedUser } from "../../safety_hub/SafetyHubUtils";
|
|
import { isModalOpen } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
|
|
import { useWatchAgeVerificationStatusChange } from "../AgeVerificationUtils";
|
|
import Module6759 from "../../../_bundle/Module6759";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
import { HeaderActionButton } from "../../../design/components/Navigator/native/HeaderActionButton.native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
|
|
let c4351_6, useStyles;
|
|
const AgeVerifyScreen = function AgeVerifyScreen(props) {
|
|
const { webviewUrl: webviewUrl3, onComplete, onClose } = props;
|
|
const isSuspendedUser = useIsSuspendedUser();
|
|
const callback = useCallback(() => {
|
|
onComplete();
|
|
onClose();
|
|
}, [onComplete, onClose]);
|
|
useWatchAgeVerificationStatusChange(useCallback(() => {
|
|
if (isModalOpen(AGE_VERIFICATION_MODAL_KEY)) {
|
|
callback();
|
|
}
|
|
}, [callback]));
|
|
return <Module6759 allowsInlineMediaPlayback javaScriptEnabled source={{
|
|
uri: webviewUrl3
|
|
}} onMessage={useCallback((a0) => {
|
|
if (a0.nativeEvent.data != null) {
|
|
try {
|
|
const r16 = typeof a0.nativeEvent.data === "string" ? JSON.parse(a0.nativeEvent.data) : a0.nativeEvent.data;
|
|
let r17 = isSuspendedUser;
|
|
if (isSuspendedUser) {
|
|
r17 = r16?.eventType === "Verification.Result";
|
|
}
|
|
if (r17) {
|
|
callback();
|
|
}
|
|
} catch ($e) {}
|
|
}
|
|
}, [callback, isSuspendedUser])} injectedJavaScript={"\n window.addEventListener('message', function(event) {\n window.ReactNativeWebView.postMessage(event.data);\n }, true);\n"} />;
|
|
};
|
|
c4351_6 = {
|
|
VERIFY_AGE: "VERIFY_AGE"
|
|
};
|
|
useStyles = createStyles({
|
|
headerStyle: {
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
|
|
}
|
|
});
|
|
export default function AgeVerificationModal(props) {
|
|
const { webviewUrl, onComplete: onComplete2, onClose: onClose2 } = props;
|
|
const styles = useStyles();
|
|
const headerTitle = intl.string(t.wJVyYR);
|
|
return <Navigator screens={useMemo(() => {
|
|
const webviewUrl2 = webviewUrl;
|
|
const onComplete3 = onComplete2;
|
|
const onClose3 = onClose2;
|
|
const handleClose2 = function handleClose() {
|
|
onClose3();
|
|
ModalActionCreators.pop();
|
|
};
|
|
const r9 = {};
|
|
r9[c4351_6.VERIFY_AGE] = {
|
|
headerStyle: styles.headerStyle,
|
|
headerTitle,
|
|
headerLeft: () => <HeaderActionButton onPress={handleClose2} text={intl.string(t.cpT0Cq)} />,
|
|
render: () => <AgeVerifyScreen webviewUrl={webviewUrl2} onComplete={onComplete3} onClose={handleClose2} />
|
|
};
|
|
return r9;
|
|
}, [styles, webviewUrl, onComplete2, onClose2, headerTitle])} initialRouteName={c4351_6.VERIFY_AGE} headerBackTitle={intl.string(t["13/7kX"])} />;
|
|
};
|