| 1 |
import type {Notification} from '@givewp/campaigns/types'; |
| 2 |
|
| 3 |
export function addSnackbarNotice(notification: Notification) { |
| 4 |
return { |
| 5 |
type: 'ADD_NOTIFICATION', |
| 6 |
notification: { |
| 7 |
...notification, |
| 8 |
autoHide: notification?.autoHide ?? true, |
| 9 |
isDismissible: notification?.isDismissible ?? true, |
| 10 |
duration: notification?.duration ?? 5000, |
| 11 |
type: notification.type ?? 'info', |
| 12 |
notificationType: 'snackbar', |
| 13 |
}, |
| 14 |
}; |
| 15 |
} |
| 16 |
|
| 17 |
export function addNotice(notification: Notification) { |
| 18 |
return { |
| 19 |
type: 'ADD_NOTIFICATION', |
| 20 |
notification: { |
| 21 |
...notification, |
| 22 |
autoHide: notification?.autoHide ?? false, |
| 23 |
isDismissible: notification?.isDismissible ?? true, |
| 24 |
duration: notification?.duration ?? 5000, |
| 25 |
type: notification.type ?? 'info', |
| 26 |
notificationType: 'notice', |
| 27 |
}, |
| 28 |
}; |
| 29 |
} |
| 30 |
|
| 31 |
export function dismissNotification(id: string) { |
| 32 |
return { |
| 33 |
type: 'DISMISS_NOTIFICATION', |
| 34 |
id, |
| 35 |
}; |
| 36 |
} |
| 37 |
|