"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ResetPasswordNav=void 0;var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _stack=require("@react-navigation/stack");var _native=require("@react-navigation/native");var _ResetPassword=require("../../subScreens/ResetPassword");var _ResetPasswordSent=require("../../subScreens/ResetPasswordSent");var _reactNativePaper=require("react-native-paper");var _reactAuthShared=require("@brightlayer-ui/react-auth-shared");var _CloseHeader=require("../../components/CloseHeader");var _jsxFileName="/home/circleci/login-workflow/login-workflow/src/screens/ResetPassword/ResetPasswordNav.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var Stack=(0,_stack.createStackNavigator)();var ResetPasswordNav=function ResetPasswordNav(props){var _routeParams$contactP;var theme=(0,_reactNativePaper.useTheme)(props.theme);var accountUIState=(0,_reactAuthShared.useAccountUIState)();var accountUIActions=(0,_reactAuthShared.useAccountUIActions)();var navigation=(0,_native.useNavigation)();var route=(0,_native.useRoute)();var _useLanguageLocale=(0,_reactAuthShared.useLanguageLocale)(),t=_useLanguageLocale.t;React.useEffect(function(){return function(){accountUIActions.dispatch(_reactAuthShared.AccountActions.resetPasswordReset());};},[]);var resetPassword=function resetPassword(emailInput){void accountUIActions.actions.forgotPassword(emailInput);};var routeParams=route.params;var contactPhone=(_routeParams$contactP=routeParams===null||routeParams===void 0?void 0:routeParams.contactPhone)!==null&&_routeParams$contactP!==void 0?_routeParams$contactP:'';React.useEffect(function(){var onBackPress=function onBackPress(){navigation.navigate('Login');return true;};_reactNative.BackHandler.addEventListener('hardwareBackPress',onBackPress);return function(){return _reactNative.BackHandler.removeEventListener('hardwareBackPress',onBackPress);};});return React.createElement(Stack.Navigator,{screenOptions:{cardStyle:{backgroundColor:theme.colors.surface},header:function header(){return React.createElement(_CloseHeader.CloseHeader,{title:t('blui:FORMS.RESET_PASSWORD'),backAction:function backAction(){navigation.navigate('Login');},__source:{fileName:_jsxFileName,lineNumber:90,columnNumber:21}});}},__source:{fileName:_jsxFileName,lineNumber:86,columnNumber:9}},accountUIState.forgotPassword.transitSuccess!==true?React.createElement(Stack.Screen,{name:"ResetPassword",component:_ResetPassword.ResetPassword,initialParams:{onResetPasswordPress:resetPassword,contactPhone:contactPhone},__source:{fileName:_jsxFileName,lineNumber:100,columnNumber:17}}):React.createElement(Stack.Screen,{name:"ResetPasswordSent",component:_ResetPasswordSent.ResetPasswordSent,initialParams:{email:accountUIState.forgotPassword.email},__source:{fileName:_jsxFileName,lineNumber:106,columnNumber:17}}));};exports.ResetPasswordNav=ResetPasswordNav;
//# sourceMappingURL=ResetPasswordNav.js.map