import * as createRavenMiddleware from 'raven-for-redux' ; import Redux , { applyMiddleware , createStore } from 'redux' ; import { composeWithDevTools } from 'redux-devtools-extension' ; import { getMultiplayerConnection } from './multiplayer/Connection' ; import { createMiddleware } from './multiplayer/Middleware' ; import expeditionApp from './reducers/CombinedReducers' ; import { AppStateWithHistory } from './reducers/StateTypes' ; declare const require ; declare const module ; let store ; export function installStore ( createdStore ) { store = createdStore ; } export function createAppStore ( raven = null ) { const middleware = [ createMiddleware ( getMultiplayerConnection ( ) ) ] ; if ( raven ) { middleware . push ( createRavenMiddleware ( raven , { stateTransformer : ( state ) : AppStateWithHistory => { return { ... state , _history : ( 'hidden' as any ) , _committed : ( 'hidden' as any ) , quest : { ... state . quest , node : ( 'hidden' as any ) } , } ; } , } ) ) ; } const composeEnhancers = composeWithDevTools ( { actionsBlacklist : [ 'MULTIPLAYER_CLIENT_STATUS' ] , } ) ; installStore ( createStore ( expeditionApp , composeEnhancers ( applyMiddleware ( ... middleware ) ) ) ) ; if ( module && module . hot ) { module . hot . accept ( './reducers/CombinedReducers' , ( ) => { const updated = require ( './reducers/CombinedReducers' ) . default ; store . replaceReducer ( updated ) ; } ) ; } } export function getStore ( ) { if ( store !== undefined ) { return store ; } createAppStore ( ) ; return store ; }