# give/4.18.0/src/Views/Components/AdminDetailsPage/store/index.ts

GiveWP – Donation Plugin and Fundraising Platform, version 4.18.0. 35 lines.

- Page: https://pluginprobe.com/plugins/give/4.18.0/code/src/Views/Components/AdminDetailsPage/store/index.ts
- Raw: https://pluginprobe.com/plugins/give/4.18.0/raw/src/Views/Components/AdminDetailsPage/store/index.ts
- Modified: 2025-06-18T15:01:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.18.0/code/src/Views/Components/AdminDetailsPage/store/index.ts#L10-L20`.

```typescript
import {createReduxStore, register} from '@wordpress/data';
import * as actions from './actions';
import * as selectors from './selectors';

export type Notification = {
    id: string;
    notificationType: 'notice' | 'snackbar';
    type: 'error' | 'warning' | 'info' | 'success';
    isDismissible?: boolean;
    duration: number,
    content: string;
}

export const store = createReduxStore('givewp/admin-details-page-notifications', {
    reducer(state = [], action) {
        switch (action.type) {
            case 'ADD_NOTIFICATION':
                const notificationExist = state.filter((notification: { id: string }) => notification.id === action.notification.id);
                if (!notificationExist.length) {
                    return [...state, action.notification];
                }
                return state;

            case 'DISMISS_NOTIFICATION':
                return state.filter((notification: Notification) => notification.id !== action.id);
        }

        return state;
    },
    actions,
    selectors,
});

register(store);

```
