Untitled
unknown
plain_text
a month ago
7.2 kB
1
Indexable
Never
import { createReducer } from "@reduxjs/toolkit"; import { SHOW_INITIAL_SCREEN, HIDE_INITIAL_SCREEN, SHOW_LOCKEDIN_SETUP_SCREEN, HIDE_LOCKEDIN_SETUP_SCREEN, SHOW_SECURITY_QUESTIONS_SCREEN, HIDE_SECURITY_QUESTIONS_SCREEN, SHOW_SECURITY_POPUP, SUCCESSFULLY_SETUP_SCREEN, LOCK_MODULES_SCREEN, PIN_AUTHORIZED_SCREEN, SHOW_PIN_ACCESS_LIMIT_POPUP, SHOW_TIMER_POPUP, FORGOT_MA_PIN_SCREEN, PASSWORD_MATCH_MODULE_STATE_FAIL, PASSWORD_MATCH_MODULE_STATE, PASSWORD_MATCH_FAILED, UPDATE_PASSWORD_MATCH_SUCCESS, UPDATE_PASSWORD_FAIL, CHANGE_PASSWORD_SCREEN_SHOW, HIDE_CHANGE_PASSWORD_SCREEN, CHECK_LOCKEDIN_START, CHECK_LOCKEDIN_END, SET_ATTEMPTS_NULL, CREATE_LOCKED_FAIL, CHECK_LOCKEDIN_CREATED_FAIL, EMOTIONAL_WILL_MODULE_STATE, ASSET_VAULT_MODULE_STATE, GET_MODULE_STATE_FAIL, EMOTIONAL_WILL_MODULE_STATE_CHANGE, ASSET_VAULT_MODULE_STATE_CHANGE, MODULE_STATE_CHANGE_FAIL, // RESET_PIN_SCREEN, // SHOW_RESET_PIN_POPUP, // RESET_PIN_LIMIT_SCREEN, HIDE_SECURITY_POPUP, HIDE_SUCCESSFULLY_SETUP_SCREEN, HIDE_LOCK_MODULES_SCREEN, HIDE_PIN_AUTHORIZED_SCREEN, HIDE_PIN_ACCESS_LIMIT_POPUP, HIDE_TIMER_POPUP, SHOW_SECURITY_QUESTIONS_SCREEN_FLOW, SHOW_UNDERSTOOD_POPUP, HIDE_UNDERSTOOD_POPUP, FORGOT_PASSWORD_CLICK, FORGOT_PASSWORD_UNCLICK, SHOW_TIMER_SCREEN, HIDE_TIMER_SCREEN, SHOW_RESET_PASSWORD_SCREEN, HIDE_RESET_PASSWORD_SCREEN, // HIDE_FORGOT_MA_PIN_SCREEN, // HIDE_RESET_PIN_SCREEN, // HIDE_RESET_PIN_POPUP, // HIDE_RESET_PIN_LIMIT_SCREEN, SHOW_LOCKEDIN_SCREEN, HIDE_LOCKEDIN_SCREEN, } from "../../constant/lockedInConstant"; const initialState = { initialScreen: true, lockedInpinSetupScreen: false, securityQuestionsScreen: false, showSecurityPopup: false, successFullySetupScreen: false, lockModulesScreen: false, pinAuthorizedScreen: false, showPinAccessLimitPopup: false, showTimerPopup: false, forgotLockedInPinScreen: false, resetPinScreen: false, showResetPinPopup: false, resetPinLimitScreen: false, securityQuestionsFlow: false, timerScreen:false, understoodPopup : false, passwordMatch : null, attemptsRemain : null, error : null }; export const lockedInReducer = createReducer(initialState, (builder) => { builder .addCase(SHOW_INITIAL_SCREEN, (state) => { state.initialScreen = true; }) .addCase(HIDE_INITIAL_SCREEN, (state) => { state.initialScreen = false; }) .addCase(SHOW_LOCKEDIN_SETUP_SCREEN, (state) => { state.lockedInpinSetupScreen = true; }) .addCase(HIDE_LOCKEDIN_SETUP_SCREEN, (state) => { state.lockedInpinSetupScreen = false; }) .addCase(SHOW_SECURITY_QUESTIONS_SCREEN, (state) => { state.securityQuestionsScreen = true; }) .addCase(HIDE_SECURITY_QUESTIONS_SCREEN, (state) => { state.securityQuestionsScreen = false; }) .addCase(SHOW_SECURITY_POPUP, (state) => { state.showSecurityPopup = true; }) .addCase(HIDE_SECURITY_POPUP, (state) => { state.showSecurityPopup = false; }) .addCase(SUCCESSFULLY_SETUP_SCREEN, (state) => { state.successFullySetupScreen = true; }) .addCase(HIDE_SUCCESSFULLY_SETUP_SCREEN, (state) => { state.successFullySetupScreen = false; }) .addCase(LOCK_MODULES_SCREEN, (state) => { state.loading = false; state.lockModulesScreen = true; }) .addCase(HIDE_LOCK_MODULES_SCREEN, (state) => { state.loading = false; state.lockModulesScreen = false; }) .addCase(PIN_AUTHORIZED_SCREEN, (state, action) => { state.pinAuthorizedScreen = true; state.moduleType = action.payload; }) .addCase(HIDE_PIN_AUTHORIZED_SCREEN, (state) => { state.pinAuthorizedScreen = false; }) .addCase(SHOW_PIN_ACCESS_LIMIT_POPUP, (state) => { state.showPinAccessLimitPopup = true; }) .addCase(HIDE_PIN_ACCESS_LIMIT_POPUP, (state) => { state.showPinAccessLimitPopup = false; }) .addCase(SHOW_TIMER_POPUP, (state) => { state.showTimerPopup = true; }) .addCase(HIDE_TIMER_POPUP, (state) => { state.showTimerPopup = false; }) .addCase(FORGOT_MA_PIN_SCREEN, (state) => { state.forgotLockedInPinScreen = true; }) .addCase(SHOW_SECURITY_QUESTIONS_SCREEN_FLOW, (state) => { state.securityQuestionsFlow=true }) .addCase(SHOW_UNDERSTOOD_POPUP, (state) => { state.understoodPopup = true; }) .addCase(HIDE_UNDERSTOOD_POPUP, (state) => { state.understoodPopup = false; }) .addCase(FORGOT_PASSWORD_CLICK, (state) => { state.forgotPassword = true; }) .addCase(FORGOT_PASSWORD_UNCLICK, (state) => { state.forgotPassword = false; }) .addCase(SHOW_TIMER_SCREEN, (state) => { state.timerScreen = true; }) .addCase(HIDE_TIMER_SCREEN, (state) => { state.timerScreen = false; }) .addCase(SHOW_RESET_PASSWORD_SCREEN, (state) => { state.resetPasswordScreen = true; }) .addCase(HIDE_RESET_PASSWORD_SCREEN,(state)=>{ state.resetPasswordScreen = false; }) .addCase(PASSWORD_MATCH_MODULE_STATE, (state , action) => { state.passwordMatch = action.payload.isMatch; }) .addCase(PASSWORD_MATCH_MODULE_STATE_FAIL, (state,action) => { state.attemptsRemain = action.payload.attemptsRemain; state.passwordMatch = action.payload.isMatch }) .addCase(PASSWORD_MATCH_FAILED, (state,action) => { state.error = action.payload }) .addCase(UPDATE_PASSWORD_MATCH_SUCCESS, (state, action)=> { state.isMatch = action.payload.isMatch }) .addCase(UPDATE_PASSWORD_FAIL, (state,action) => { state.error = action.payload }) .addCase(CHANGE_PASSWORD_SCREEN_SHOW, (state) => { state.showChangePassword = true; }) .addCase(HIDE_CHANGE_PASSWORD_SCREEN, (state) => { state.showChangePassword = false; }) .addCase(CHECK_LOCKEDIN_START,(state) => { state.loading = true; }) .addCase(CHECK_LOCKEDIN_END,(state) => { state.loading = false; }) .addCase(SET_ATTEMPTS_NULL, (state,action) => { state.attemptsRemain = action.payload }) .addCase(CREATE_LOCKED_FAIL,(state,action) => { state.error = action.payload }) .addCase(CHECK_LOCKEDIN_CREATED_FAIL,(state,action) => { state.error = action.payload }) .addCase( EMOTIONAL_WILL_MODULE_STATE,(state,action) => { state.emotionalState = action.payload; }) .addCase(ASSET_VAULT_MODULE_STATE,(state,action) => { state.assetState = action.payload; }) .addCase(GET_MODULE_STATE_FAIL,(state,action) => { state.error = action.payload }) .addCase(EMOTIONAL_WILL_MODULE_STATE_CHANGE,(state,action) => { state.emotionalState = action.payload }) .addCase(ASSET_VAULT_MODULE_STATE_CHANGE,(state,action) => { state.assetState = action.payload; }) .addCase(MODULE_STATE_CHANGE_FAIL, (state,action) => { state.error = action.payload }) .addCase(SHOW_LOCKEDIN_SCREEN, (state) => { state.forgotLockedInPinScreen = true; }) .addCase(HIDE_LOCKEDIN_SCREEN, (state) => { state.forgotLockedInPinScreen = false; }); });
Leave a Comment