import { AppState } from '@/store' ; import { mergeState } from '@/common/utils/store' ; import { SnackbarType , SnackbarMessage } from './overlay.constants' ; import { OverlayState } from '@/modules/overlay/overlay.state' ; const merge = mergeState < OverlayState > ( 'overlay' ) ; export const overlayActions = { hideSnackbar ( appState , messageId ) { return merge ( { snackbarMessages : appState . overlay . snackbarMessages . filter ( ( message ) => message . id !== messageId ) , } ) ; } , showSnackbar ( appState , messageKey , type ) { return merge ( { snackbarMessages : [ ... appState . overlay . snackbarMessages , { id : Date . now ( ) , messageKey , type , } , ] , } ) ; } , showGlobalLoader ( ) { return merge ( { isGlobalLoaderVisible : true } ) ; } , hideGlobalLoader ( ) { return merge ( { isGlobalLoaderVisible : false } ) ; } , } as const ;