import { take , put } from "@redux-saga/core/effects" ; import { select } from "typed-redux-saga" ; import { PlayerActions } from "@creature-chess/gamemode" ; import { AppState } from "../../../store" ; import { Overlay } from "../../ui/overlay" ; import { closeOverlay } from "../../ui/actions" ; export const closeShopOnFirstBuySaga = function * ( ) { yield take ( PlayerActions . buyCardPlayerAction . toString ( ) ) ; const shopIsOpen = yield * select ( ( state ) => state . game . ui . currentOverlay === Overlay . SHOP ) ; if ( ! shopIsOpen ) { return ; } yield put ( closeOverlay ( ) ) ; } ;