| 1 | import { store as chatsStore } from "/components/sidebar/chats/chats-store.js"; |
| 2 | import { callJsonApi } from "/js/api.js"; |
| 3 | import * as modals from "/js/modals.js"; |
| 4 | import { |
| 5 | NotificationType, |
| 6 | NotificationPriority, |
| 7 | store as notificationStore, |
| 8 | } from "/components/notifications/notification-store.js"; |
| 9 | |
| 10 | // shortcuts utils for convenience |
| 11 | |
| 12 | // api |
| 13 | export { callJsonApi }; |
| 14 | |
| 15 | // notifications |
| 16 | export { NotificationType, NotificationPriority }; |
| 17 | export const frontendNotification = |
| 18 | notificationStore.frontendNotification.bind(notificationStore); |
| 19 | |
| 20 | // chat context |
| 21 | export function getCurrentContextId() { |
| 22 | return chatsStore.getSelectedChatId(); |
| 23 | } |
| 24 | |
| 25 | export function getCurrentContext(){ |
| 26 | return chatsStore.getSelectedContext(); |
| 27 | } |
| 28 | |
| 29 | // modals |
| 30 | export function openModal(modalPath) { |
| 31 | return modals.openModal(modalPath); |
| 32 | } |
| 33 | |
| 34 | export function closeModal(modalPath = null) { |
| 35 | return modals.closeModal(modalPath); |
| 36 | } |