import { useMaintenanceGamesStore, useGameToastStore } from '#lib/stores' /** * @ignore * Reactive references to manage the visibility of various toast messages and modals * related to game status and maintenance. These references are used to control * whether specific UI elements should be shown to the user. */ /** * Provides functions and reactive references for showing various toast messages and modals * related to game status and maintenance. This composable allows for managing the visibility * of UI elements that inform users about the status of games, including maintenance and promotions. * * @returns {Object} An object containing reactive references and functions for handling * game-related messages and modals. * @namespace */ export const useGameToast = () => { const { setShowCommingSoon, setShowPromotionPrevent, setShowNotEnoughBalance, setShowMaintainGame, setShowMaintainAthenaGames, setShowMaintainProvider, setOpenModeGameVersion, } = useGameToastStore() const { startTime, endTime } = useMaintenanceGamesStore() /** * Sets the 'coming soon' toast message to visible. * This function is typically called when a game is marked as coming soon. */ const onShowCommingSoon = () => { setShowCommingSoon(true) } /** * Sets the 'promotion prevent' toast message to visible. * This function is typically called when a promotion is not applicable for a game. */ const onShowPromotionPrevent = () => { setShowPromotionPrevent(true) } /** * Sets the 'not enough balance' toast message to visible. * This function is typically called when a user does not have enough balance to play a game. */ const onShowNotEnoughBalance = () => { setShowNotEnoughBalance(true) } /** * Sets the 'maintain game' toast message to visible. * This function is typically called when a game is under maintenance. */ const onShowMaintainGame = () => { setShowMaintainGame(true) } /** * Sets the 'maintain Athena games' modal to visible. * This function is typically called when the user needs to be informed about maintenance * related to Athena games. */ const openModalMaintainAthenaGames = () => { setShowMaintainAthenaGames(true) } /** * Sets the 'maintain provider' modal to visible. * This function is typically called when the user needs to be informed about maintenance * related to a specific game provider. */ const openMaintainProvider = () => { setShowMaintainProvider(true) } /** * Sets the 'mode game' modal to visible. * This function is typically called when the user needs to be informed about mode game * related to a specific game. */ const openModeGameVersion = () => { setOpenModeGameVersion(true) } /** * Resets all toast messages to hidden. */ const resetToasts = () => { setShowCommingSoon(false) setShowPromotionPrevent(false) setShowNotEnoughBalance(false) setShowMaintainGame(false) setShowMaintainAthenaGames(false) setShowMaintainProvider(false) setOpenModeGameVersion(false) } return { maintainStartTime: startTime, maintainEndTime: endTime, onShowCommingSoon, onShowPromotionPrevent, onShowNotEnoughBalance, onShowMaintainGame, openModalMaintainAthenaGames, openMaintainProvider, resetToasts, openModeGameVersion, } }