import { createSelector } from 'reselect' ; import { AppState } from '@/store' ; import { PasswordListState } from './passwordList.state' ; import { PasswordEntityPayloadReferable } from '@/modules/passwordList/passwordList.constants' ; const selectPasswordList = ( state ) : PasswordListState => state . passwordList ; export const selectPasswords = createSelector ( selectPasswordList , ( passwordListState ) => passwordListState . passwords ) ; export const selectCurrentOptionPanelVariantName = createSelector ( selectPasswordList , ( passwordListState ) => passwordListState . currentOptionPanelVariantName ) ; export const selectSelectedAndDecryptedEntity = createSelector ( selectPasswordList , ( passwordListState ) => passwordListState . selectedAndDecryptedEntity ) ; export const selectIsInEditMode = createSelector ( selectSelectedAndDecryptedEntity , ( selectedAndDecryptedEntity ) => Object . keys ( selectedAndDecryptedEntity ) . length !== 0 ) ; export const selectSelectedAndDecryptedEntityByRefId = ( refId ) => createSelector ( selectSelectedAndDecryptedEntity , ( selectedAndDecryptedEntity ) => { if ( selectedAndDecryptedEntity . refId === refId ) { return selectedAndDecryptedEntity ; } return { } as PasswordEntityPayloadReferable ; } ) ;