From 01aa25311689db1ce2b5412017eede954ec1376e Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Wed, 6 Nov 2019 17:50:44 +0100
Subject: [PATCH] chore: added proper types to store chore: unitifed store
 export

---
 .../atlasViewer.apiService.service.ts         |   6 +-
 src/atlasViewer/atlasViewer.component.ts      |  11 +-
 .../atlasViewer.constantService.service.ts    |   8 +-
 .../atlasViewer.dataService.service.ts        | 126 +-----------------
 .../atlasViewer.pluginService.service.ts      |   6 +-
 .../atlasViewer.urlService.service.ts         |  12 +-
 src/main.module.ts                            |   3 +-
 src/services/effect/effect.ts                 |   8 +-
 src/services/localFile.service.ts             |   4 +-
 src/services/state/dataStore.store.ts         |   6 +-
 src/services/state/ngViewerState.store.ts     |  18 +--
 src/services/state/pluginState.store.ts       |  10 +-
 .../state/spatialSearchState.store.ts         |  35 -----
 src/services/state/uiState.store.ts           |   8 +-
 src/services/state/userConfigState.store.ts   |  19 ++-
 src/services/state/viewerConfig.store.ts      |  12 +-
 src/services/state/viewerState.store.ts       |  18 +--
 src/services/stateStore.service.spec.ts       |  91 -------------
 src/services/stateStore.service.ts            |  80 ++++++++---
 src/ui/config/config.component.ts             |   5 +-
 .../currentLayout/currentLayout.component.ts  |   5 +-
 .../databrowserModule/databrowser.service.ts  |   9 +-
 .../databrowser.useEffect.ts                  |   3 +-
 .../kgSingleDatasetService.service.ts         |   4 +-
 .../maximisePanelButton.component.ts          |   3 +-
 .../nehubaContainer.component.ts              |  32 +----
 .../nehubaViewer/nehubaViewer.component.ts    |   2 +-
 .../touchSideClass.directive.ts               |   3 +-
 src/ui/parcellationRegion/region.base.ts      |   5 +-
 .../regionListSimpleView.component.ts         |   5 +-
 .../regionMenu/regionMenu.component.ts        |   5 +-
 .../regionSimple/regionSimple.component.ts    |   5 +-
 .../searchSideNav/searchSideNav.component.ts  |   4 +-
 .../signinBanner/signinBanner.components.ts   |   4 +-
 .../regionSearch/regionSearch.component.ts    |   8 +-
 .../currentlySelectedRegions.component.ts     |   3 +-
 .../viewerStateController/viewerState.base.ts |   4 +-
 .../viewerState.useEffect.ts                  |   4 +-
 .../viewerStateCFull/viewerState.component.ts |   3 +-
 .../viewerStateMini.component.ts              |   3 +-
 src/util/directives/mouseOver.directive.ts    |   4 +-
 41 files changed, 192 insertions(+), 412 deletions(-)
 delete mode 100644 src/services/state/spatialSearchState.store.ts

diff --git a/src/atlasViewer/atlasViewer.apiService.service.ts b/src/atlasViewer/atlasViewer.apiService.service.ts
index 733368574..f3f7771b8 100644
--- a/src/atlasViewer/atlasViewer.apiService.service.ts
+++ b/src/atlasViewer/atlasViewer.apiService.service.ts
@@ -1,8 +1,8 @@
 import { Injectable } from "@angular/core";
 import { Store, select } from "@ngrx/store";
-import { ViewerStateInterface, safeFilter, getLabelIndexMap, isDefined, getMultiNgIdsRegionsLabelIndexMap } from "src/services/stateStore.service";
+import { safeFilter, getLabelIndexMap, getMultiNgIdsRegionsLabelIndexMap, IavRootStoreInterface } from "src/services/stateStore.service";
 import { Observable } from "rxjs";
-import { map, distinctUntilChanged, filter } from "rxjs/operators";
+import { map, distinctUntilChanged } from "rxjs/operators";
 import { ModalHandler } from "../util/pluginHandlerClasses/modalHandler";
 import { ToastHandler } from "../util/pluginHandlerClasses/toastHandler";
 import { PluginManifest } from "./atlasViewer.pluginService.service";
@@ -23,7 +23,7 @@ export class AtlasViewerAPIServices{
   public loadedLibraries : Map<string,{counter:number,src:HTMLElement|null}> = new Map()
 
   constructor(
-    private store : Store<ViewerStateInterface>,
+    private store: Store<IavRootStoreInterface>,
     private dialogService: DialogService,
   ){
 
diff --git a/src/atlasViewer/atlasViewer.component.ts b/src/atlasViewer/atlasViewer.component.ts
index 7efaac5ea..536a1760a 100644
--- a/src/atlasViewer/atlasViewer.component.ts
+++ b/src/atlasViewer/atlasViewer.component.ts
@@ -10,11 +10,10 @@ import {
 } from "@angular/core";
 import { Store, select, ActionsSubject } from "@ngrx/store";
 import {
-  ViewerStateInterface,
   isDefined,
   FETCHED_SPATIAL_DATA,
-  UPDATE_SPATIAL_DATA,
-  safeFilter
+  safeFilter,
+  IavRootStoreInterface
 } from "../services/stateStore.service";
 import {Observable, Subscription, combineLatest, interval, merge, of } from "rxjs";
 import {
@@ -120,7 +119,7 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
   regionToolsMenuVisible = false
 
   constructor(
-    private store: Store<ViewerStateInterface>,
+    private store: Store<IavRootStoreInterface>,
     public dataService: AtlasViewerDataService,
     private widgetServices: WidgetServices,
     private constantsService: AtlasViewerConstantsServices,
@@ -358,10 +357,6 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
           type : FETCHED_SPATIAL_DATA,
           fetchedDataEntries : []
         })
-        this.store.dispatch({
-          type : UPDATE_SPATIAL_DATA,
-          totalResults : 0
-        })
 
         this.widgetServices.clearAllWidgets()
       })
diff --git a/src/atlasViewer/atlasViewer.constantService.service.ts b/src/atlasViewer/atlasViewer.constantService.service.ts
index 41899d81d..43a0ae087 100644
--- a/src/atlasViewer/atlasViewer.constantService.service.ts
+++ b/src/atlasViewer/atlasViewer.constantService.service.ts
@@ -1,8 +1,8 @@
 import { Injectable, OnDestroy } from "@angular/core";
 import { Store, select } from "@ngrx/store";
-import { ViewerStateInterface } from "../services/stateStore.service";
-import { Subject, Observable, Subscription } from "rxjs";
-import { map, shareReplay, filter, tap } from "rxjs/operators";
+import { IavRootStoreInterface } from "../services/stateStore.service";
+import { Observable, Subscription } from "rxjs";
+import { map, shareReplay, filter } from "rxjs/operators";
 import { SNACKBAR_MESSAGE } from "src/services/state/uiState.store";
 
 export const CM_THRESHOLD = `0.05`
@@ -232,7 +232,7 @@ Send us an email: <a target = "_blank" href = "mailto:${this.supportEmailAddress
   private repoUrl = `https://github.com/HumanBrainProject/interactive-viewer`
 
   constructor(
-    private store$ : Store<ViewerStateInterface>
+    private store$: Store<IavRootStoreInterface>
   ){
 
     this.darktheme$ = this.store$.pipe(
diff --git a/src/atlasViewer/atlasViewer.dataService.service.ts b/src/atlasViewer/atlasViewer.dataService.service.ts
index a1abc3bf9..31d924891 100644
--- a/src/atlasViewer/atlasViewer.dataService.service.ts
+++ b/src/atlasViewer/atlasViewer.dataService.service.ts
@@ -1,6 +1,6 @@
 import { Injectable, OnDestroy } from "@angular/core";
 import { Store } from "@ngrx/store";
-import { ViewerStateInterface, FETCHED_TEMPLATE, FETCHED_SPATIAL_DATA, UPDATE_SPATIAL_DATA } from "../services/stateStore.service";
+import { FETCHED_TEMPLATE, IavRootStoreInterface } from "../services/stateStore.service";
 import { Subscription } from "rxjs";
 import { AtlasViewerConstantsServices } from "./atlasViewer.constantService.service";
 
@@ -16,7 +16,7 @@ export class AtlasViewerDataService implements OnDestroy{
   private subscriptions : Subscription[] = []
   
   constructor(
-    private store : Store<ViewerStateInterface>,
+    private store: Store<IavRootStoreInterface>,
     private constantService : AtlasViewerConstantsServices
   ){
     this.constantService.templateUrlsPr
@@ -56,128 +56,6 @@ export class AtlasViewerDataService implements OnDestroy{
     
   }
 
-  /**
-   * TODO
-   * DEPRECATED
-   */
-
-  /* all units in mm */
-  public spatialSearch(obj:any){
-    const {center,searchWidth,templateSpace,pageNo} = obj
-    const SOLR_C = `metadata/`
-    const SEARCH_PATH = `select`
-    const url = new URL(this.constantService.spatialSearchUrl+SOLR_C+SEARCH_PATH)
-    
-    /* do not set fl to get all params */
-    // url.searchParams.append('fl','geometry.coordinates_0___pdouble,geometry.coordinates_1___pdouble,geometry.coordinates_2___pdouble')
-
-    url.searchParams.append('q','*:*')
-    url.searchParams.append('wt','json')
-    url.searchParams.append('indent','on')
-
-    /* pagination on app level. if there are too many restuls, we could reintroduce pagination on search level */
-    url.searchParams.append('start',(pageNo*this.constantService.spatialResultsPerPage).toString())
-    url.searchParams.append('rows',this.constantService.spatialResultsPerPage.toString())
-    
-    /* TODO future for template space? */
-    const filterTemplateSpace = templateSpace == 'MNI Colin 27' ? 
-      'datapath:metadata/sEEG-sample.json' :
-        templateSpace == 'Waxholm Space rat brain MRI/DTI' ?
-        'datapath:metadata/OSLO_sp_data_rev.json' :
-          null
-    
-    if (templateSpace === 'MNI 152 ICBM 2009c Nonlinear Asymmetric'){
-      return Promise.all([
-        fetch('res/json/**removed**.json').then(res=>res.json()),
-        fetch('res/json/**removed**.json').then(res=>res.json())
-      ])
-        .then(arr => {
-          this.store.dispatch({
-            type : FETCHED_SPATIAL_DATA,
-            fetchedDataEntries: arr
-              .reduce((acc, curr) => acc.concat(curr), [])
-              .map((obj, idx) => {
-                return {
-                  ...obj,
-                  name: `Spatial landmark #${idx}`,
-                  properties: {}
-                }
-              })
-          })
-          this.store.dispatch({
-            type : UPDATE_SPATIAL_DATA,
-            totalResults : arr.reduce((acc,curr) => acc + curr.length, 0)
-          })
-        })
-        .catch(console.error)
-    }else if (templateSpace === 'Allen adult mouse brain reference atlas V3'){
-      return Promise.all([
-        // 'res/json/allen3DVolumeAggregated.json',
-        'res/json/allenTestPlane.json',
-        'res/json/allen3DReconAggregated.json'
-      ].map(url => fetch(url).then(res => res.json())))
-        .then(arr => arr.reduce((acc, curr) => acc.concat(curr), []))
-        .then(arr => {
-          this.store.dispatch({
-            type : FETCHED_SPATIAL_DATA,
-            fetchedDataEntries : arr.map(item => Object.assign({}, item, { properties : {} }))
-          })
-          this.store.dispatch({
-            type : UPDATE_SPATIAL_DATA,
-            totalResults : arr.length
-          })
-        })
-        .catch(console.error)
-    }else if (templateSpace === 'Waxholm Space rat brain MRI/DTI'){
-      return Promise.all([
-        // fetch('res/json/waxholmPlaneAggregatedData.json').then(res => res.json()),
-        fetch('res/json/camillaWaxholmPointsAggregatedData.json').then(res => res.json())
-      ])
-        .then(arr => arr.reduce((acc,curr) => acc.concat(curr) ,[]))
-        .then(arr => {
-          this.store.dispatch({
-            type : FETCHED_SPATIAL_DATA,
-            fetchedDataEntries : arr.map(item => Object.assign({}, item, { properties : {} }))
-          })
-          this.store.dispatch({
-            type : UPDATE_SPATIAL_DATA,
-            totalResults : arr.length
-          })
-        })
-        .catch(console.error)
-    }else{
-      return 
-    }
-    url.searchParams.append('fq',`geometry.coordinates:[${center.map(n=>n-searchWidth).join(',')}+TO+${center.map(n=>n+searchWidth).join(',')}]`)
-    const fetchUrl = url.toString().replace(/\%2B/gi,'+')
-
-    fetch(fetchUrl).then(r=>r.json())
-      .then((resp)=>{
-        const dataEntries = resp.response.docs.map(doc=>({
-          name : doc['OID'][0],
-          geometry : {
-            type : 'point',
-            position : doc['geometry.coordinates'][0].split(',').map(string=>Number(string)),
-          },
-          properties : {
-            description : doc['OID'][0],
-            publications : []
-          },
-          files:[]
-        }))
-        this.store.dispatch({
-          type : FETCHED_SPATIAL_DATA,
-          fetchedDataEntries : dataEntries
-        })
-        this.store.dispatch({
-          type : UPDATE_SPATIAL_DATA,
-          totalResults : resp.response.numFound
-        })
-      })
-      .catch(console.warn)
-
-  }
-
   ngOnDestroy(){
     this.subscriptions.forEach(s=>s.unsubscribe())
   }
diff --git a/src/atlasViewer/atlasViewer.pluginService.service.ts b/src/atlasViewer/atlasViewer.pluginService.service.ts
index 5a8f6a211..3165a3f11 100644
--- a/src/atlasViewer/atlasViewer.pluginService.service.ts
+++ b/src/atlasViewer/atlasViewer.pluginService.service.ts
@@ -1,7 +1,7 @@
 import { Injectable, ViewContainerRef, ComponentFactoryResolver, ComponentFactory } from "@angular/core";
-import { PluginInitManifestInterface, PLUGIN_STATE_ACTION_TYPES } from "src/services/state/pluginState.store";
+import { ACTION_TYPES as PLUGIN_STATE_ACTION_TYPES } from "src/services/state/pluginState.store";
 import { HttpClient } from '@angular/common/http'
-import { isDefined } from 'src/services/stateStore.service'
+import { isDefined, IavRootStoreInterface } from 'src/services/stateStore.service'
 import { AtlasViewerAPIServices } from "./atlasViewer.apiService.service";
 import { PluginUnit } from "./pluginUnit/pluginUnit.component";
 import { WidgetServices } from "./widgetUnit/widgetService.service";
@@ -36,7 +36,7 @@ export class PluginServices{
     private constantService : AtlasViewerConstantsServices,
     private widgetService : WidgetServices,
     private cfr : ComponentFactoryResolver,
-    private store : Store<PluginInitManifestInterface>,
+    private store: Store<IavRootStoreInterface>,
     private http: HttpClient
   ){
 
diff --git a/src/atlasViewer/atlasViewer.urlService.service.ts b/src/atlasViewer/atlasViewer.urlService.service.ts
index d51aaf3d8..f0ca872ce 100644
--- a/src/atlasViewer/atlasViewer.urlService.service.ts
+++ b/src/atlasViewer/atlasViewer.urlService.service.ts
@@ -1,7 +1,7 @@
 import { Injectable } from "@angular/core";
 import { Store, select } from "@ngrx/store";
 import { ViewerStateInterface, isDefined, NEWVIEWER, CHANGE_NAVIGATION, ADD_NG_LAYER } from "../services/stateStore.service";
-import { PluginInitManifestInterface } from 'src/services/state/pluginState.store'
+import { StateInterface as PluginStateInterface } from 'src/services/state/pluginState.store'
 import { Observable,combineLatest } from "rxjs";
 import { filter, map, scan, distinctUntilChanged, skipWhile, take } from "rxjs/operators";
 import { PluginServices } from "./atlasViewer.pluginService.service";
@@ -11,6 +11,10 @@ import { UIService } from "src/services/uiService.service";
 
 declare var window
 
+const parseQueryString = (searchparams: URLSearchParams) => {
+
+}
+
 @Injectable({
   providedIn : 'root'
 })
@@ -18,7 +22,7 @@ declare var window
 export class AtlasViewerURLService{
   private changeQueryObservable$ : Observable<any>
   private additionalNgLayers$ : Observable<any>
-  private pluginState$ : Observable<PluginInitManifestInterface>
+  private pluginState$ : Observable<PluginStateInterface>
 
   constructor(
     private store : Store<ViewerStateInterface>,
@@ -84,8 +88,8 @@ export class AtlasViewerURLService{
     /* parse search url to state */
     this.store.pipe(
       select('viewerState'),
-      filter(state=>isDefined(state)&&isDefined(state.fetchedTemplates)),
-      map(state=>state.fetchedTemplates),
+      select('fetchedTemplates'),
+      filter(_=> !!_),
       skipWhile(fetchedTemplates => fetchedTemplates.length !== this.constantService.templateUrls.length),
       take(1),
       map(ft => ft.filter(t => t !== null))
diff --git a/src/main.module.ts b/src/main.module.ts
index 1db540e32..076716937 100644
--- a/src/main.module.ts
+++ b/src/main.module.ts
@@ -5,7 +5,7 @@ import { UIModule } from "./ui/ui.module";
 import { LayoutModule } from "./layouts/layout.module";
 import { AtlasViewer } from "./atlasViewer/atlasViewer.component";
 import { StoreModule } from "@ngrx/store";
-import { viewerState, dataStore,spatialSearchState,uiState, ngViewerState, pluginState, viewerConfigState, userConfigState, UserConfigStateUseEffect } from "./services/stateStore.service";
+import { viewerState, dataStore, uiState, ngViewerState, pluginState, viewerConfigState, userConfigState, UserConfigStateUseEffect } from "./services/stateStore.service";
 import { GetNamesPipe } from "./util/pipes/getNames.pipe";
 import { CommonModule } from "@angular/common";
 import { GetNamePipe } from "./util/pipes/getName.pipe";
@@ -83,7 +83,6 @@ import {CaptureClickListenerDirective} from "src/util/directives/captureClickLis
       ngViewerState,
       viewerState,
       dataStore,
-      spatialSearchState,
       uiState,
       userConfigState
     }),
diff --git a/src/services/effect/effect.ts b/src/services/effect/effect.ts
index 0784fdb11..4354421de 100644
--- a/src/services/effect/effect.ts
+++ b/src/services/effect/effect.ts
@@ -1,11 +1,11 @@
 import { Injectable, OnDestroy } from "@angular/core";
 import { Effect, Actions, ofType } from "@ngrx/effects";
-import { Subscription, merge, fromEvent, combineLatest, Observable } from "rxjs";
-import { withLatestFrom, map, filter, shareReplay, tap, switchMap, take } from "rxjs/operators";
+import { Subscription, merge, fromEvent, Observable } from "rxjs";
+import { withLatestFrom, map, filter, shareReplay, switchMap, take } from "rxjs/operators";
 import { Store, select } from "@ngrx/store";
 import { SELECT_PARCELLATION, SELECT_REGIONS, NEWVIEWER, UPDATE_PARCELLATION, SELECT_REGIONS_WITH_ID, DESELECT_REGIONS, ADD_TO_REGIONS_SELECTION_WITH_IDS } from "../state/viewerState.store";
 import { worker } from 'src/atlasViewer/atlasViewer.workerService.service'
-import { getNgIdLabelIndexFromId, generateLabelIndexId, recursiveFindRegionWithLabelIndexId } from '../stateStore.service';
+import { getNgIdLabelIndexFromId, generateLabelIndexId, recursiveFindRegionWithLabelIndexId, IavRootStoreInterface } from '../stateStore.service';
 
 @Injectable({
   providedIn: 'root'
@@ -14,7 +14,7 @@ export class UseEffects implements OnDestroy{
 
   constructor(
     private actions$: Actions,
-    private store$: Store<any>
+    private store$: Store<IavRootStoreInterface>
   ){
     this.subscriptions.push(
       this.newParcellationSelected$.subscribe(parcellation => {
diff --git a/src/services/localFile.service.ts b/src/services/localFile.service.ts
index 10ece9c15..0333438d1 100644
--- a/src/services/localFile.service.ts
+++ b/src/services/localFile.service.ts
@@ -1,8 +1,8 @@
 import { Injectable } from "@angular/core";
-import { DatabrowserService } from "src/ui/databrowserModule/databrowser.service";
 import { Store } from "@ngrx/store";
 import { SNACKBAR_MESSAGE } from "./state/uiState.store";
 import { KgSingleDatasetService } from "src/ui/databrowserModule/kgSingleDatasetService.service";
+import { IavRootStoreInterface } from "./stateStore.service";
 
 /**
  * experimental service handling local user files such as nifti and gifti
@@ -17,7 +17,7 @@ export class LocalFileService {
   private supportedExtSet = new Set(SUPPORTED_EXT)
 
   constructor(
-    private store: Store<any>,
+    private store: Store<IavRootStoreInterface>,
     private singleDsService: KgSingleDatasetService
   ){
 
diff --git a/src/services/state/dataStore.store.ts b/src/services/state/dataStore.store.ts
index 8caf8630f..b4a13defd 100644
--- a/src/services/state/dataStore.store.ts
+++ b/src/services/state/dataStore.store.ts
@@ -4,7 +4,7 @@ import { Action } from '@ngrx/store'
  * TODO merge with databrowser.usereffect.ts
  */
 
-interface DataEntryState{
+export interface StateInterface{
   fetchedDataEntries: DataEntry[]
   favDataEntries: DataEntry[]
   fetchedSpatialData: DataEntry[]
@@ -16,7 +16,7 @@ const defaultState = {
   fetchedSpatialData: []
 }
 
-export function dataStore(state:DataEntryState = defaultState, action:Partial<DatasetAction>){
+export function stateStore(state:StateInterface = defaultState, action:Partial<ActionInterface>){
   switch (action.type){
     case FETCHED_DATAENTRIES: {
       return {
@@ -41,7 +41,7 @@ export function dataStore(state:DataEntryState = defaultState, action:Partial<Da
   }
 }
 
-export interface DatasetAction extends Action{
+export interface ActionInterface extends Action{
   favDataEntries: DataEntry[]
   fetchedDataEntries : DataEntry[]
   fetchedSpatialData : DataEntry[]
diff --git a/src/services/state/ngViewerState.store.ts b/src/services/state/ngViewerState.store.ts
index 935a36e33..2af420f1c 100644
--- a/src/services/state/ngViewerState.store.ts
+++ b/src/services/state/ngViewerState.store.ts
@@ -2,17 +2,17 @@ import { Action, Store, select } from '@ngrx/store'
 import { Injectable, OnDestroy } from '@angular/core';
 import { Observable, combineLatest, fromEvent, Subscription } from 'rxjs';
 import { Effect, Actions, ofType } from '@ngrx/effects';
-import { withLatestFrom, map, distinctUntilChanged, scan, shareReplay, filter, mapTo, tap, delay, switchMapTo, take } from 'rxjs/operators';
+import { withLatestFrom, map, distinctUntilChanged, scan, shareReplay, filter, mapTo } from 'rxjs/operators';
 import { AtlasViewerConstantsServices } from 'src/atlasViewer/atlasViewer.constantService.service';
 import { SNACKBAR_MESSAGE } from './uiState.store';
-import { getNgIds } from '../stateStore.service';
+import { getNgIds, IavRootStoreInterface } from '../stateStore.service';
 
 export const FOUR_PANEL = 'FOUR_PANEL'
 export const V_ONE_THREE = 'V_ONE_THREE'
 export const H_ONE_THREE = 'H_ONE_THREE'
 export const SINGLE_PANEL = 'SINGLE_PANEL'
 
-export interface NgViewerStateInterface{
+export interface StateInterface{
   layers : NgLayerInterface[]
   forceShowSegment : boolean | null
   nehubaReady: boolean
@@ -23,7 +23,7 @@ export interface NgViewerStateInterface{
   showZoomlevel: boolean
 }
 
-export interface NgViewerAction extends Action{
+export interface ActionInterface extends Action{
   layer : NgLayerInterface
   layers : NgLayerInterface[]
   forceShowSegment : boolean
@@ -31,7 +31,7 @@ export interface NgViewerAction extends Action{
   payload: any
 }
 
-const defaultState:NgViewerStateInterface = {
+const defaultState:StateInterface = {
   layers:[],
   forceShowSegment:null,
   nehubaReady: false,
@@ -42,7 +42,7 @@ const defaultState:NgViewerStateInterface = {
   showZoomlevel: null
 }
 
-export function ngViewerState(prevState:NgViewerStateInterface = defaultState, action:NgViewerAction):NgViewerStateInterface{
+export function stateStore(prevState:StateInterface = defaultState, action:ActionInterface):StateInterface{
   switch(action.type){
     case ACTION_TYPES.SET_PANEL_ORDER: {
       const { payload } = action
@@ -159,7 +159,7 @@ export class NgViewerUseEffect implements OnDestroy{
 
   constructor(
     private actions: Actions,
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private constantService: AtlasViewerConstantsServices
   ){
     const toggleMaxmimise$ = this.actions.pipe(
@@ -201,7 +201,7 @@ export class NgViewerUseEffect implements OnDestroy{
       ),
       filter(([_action, [_panelOrder, panelMode]]) => panelMode !== SINGLE_PANEL),
       map(([ action, [ oldPanelOrder ] ]) => {
-        const { payload } = action as NgViewerAction
+        const { payload } = action as ActionInterface
         const { index = 0 } = payload
 
         const panelOrder = [...oldPanelOrder.slice(index), ...oldPanelOrder.slice(0, index)].join('')
@@ -240,7 +240,7 @@ export class NgViewerUseEffect implements OnDestroy{
           panelOrders: panelOrdersPrev = null,
         } = arr[1] || {}
 
-        const { payload } = action as NgViewerAction
+        const { payload } = action as ActionInterface
         const { index = 0 } = payload
 
         const panelOrder = !!panelOrdersPrev
diff --git a/src/services/state/pluginState.store.ts b/src/services/state/pluginState.store.ts
index e9a80cc8d..f9e3cea64 100644
--- a/src/services/state/pluginState.store.ts
+++ b/src/services/state/pluginState.store.ts
@@ -1,24 +1,22 @@
 import { Action } from '@ngrx/store'
 
 
-export interface PluginInitManifestInterface{
+export interface StateInterface{
   initManifests : Map<string,string|null>
 }
 
-export interface PluginInitManifestActionInterface extends Action{
+export interface ActionInterface extends Action{
   manifest: {
     name : string,
     initManifestUrl : string | null
   }
 }
 
-const ACTION_TYPES = {
+export const ACTION_TYPES = {
   SET_INIT_PLUGIN: `SET_INIT_PLUGIN`
 }
 
-export const PLUGIN_STATE_ACTION_TYPES = ACTION_TYPES
-
-export function pluginState(prevState:PluginInitManifestInterface = {initManifests : new Map()}, action:PluginInitManifestActionInterface):PluginInitManifestInterface{
+export function stateStore(prevState:StateInterface = {initManifests : new Map()}, action:ActionInterface):StateInterface{
   switch(action.type){
     case ACTION_TYPES.SET_INIT_PLUGIN:
       const newMap = new Map(prevState.initManifests )
diff --git a/src/services/state/spatialSearchState.store.ts b/src/services/state/spatialSearchState.store.ts
deleted file mode 100644
index cdc34bf99..000000000
--- a/src/services/state/spatialSearchState.store.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { Action } from '@ngrx/store'
-
-export function spatialSearchState(state:SpatialDataStateInterface = initSpatialDataState, action:SpatialDataEntries){
-  switch (action.type){
-    case SPATIAL_GOTO_PAGE:
-      return Object.assign({},state,{
-        spatialSearchPagination : action.pageNo
-      })
-    case UPDATE_SPATIAL_DATA:
-      return Object.assign({},state,{
-        spatialSearchTotalResults : action.totalResults
-      })
-    default :
-      return state
-  }
-}
-
-export interface SpatialDataStateInterface{
-  spatialSearchPagination : number
-  spatialSearchTotalResults : number
-}
-
-const initSpatialDataState : SpatialDataStateInterface = {
-  spatialSearchPagination : 0, 
-  spatialSearchTotalResults : 0
-}
-
-export interface SpatialDataEntries extends Action{
-  pageNo? : number
-  totalResults? : number
-  visible? : boolean
-}
-
-export const SPATIAL_GOTO_PAGE = `SPATIAL_GOTO_PAGE`
-export const UPDATE_SPATIAL_DATA = `UPDATE_SPATIAL_DATA`
diff --git a/src/services/state/uiState.store.ts b/src/services/state/uiState.store.ts
index 396ebfe8e..ecf896187 100644
--- a/src/services/state/uiState.store.ts
+++ b/src/services/state/uiState.store.ts
@@ -3,7 +3,7 @@ import { TemplateRef } from '@angular/core';
 
 import { LOCAL_STORAGE_CONST, COOKIE_VERSION, KG_TOS_VERSION } from 'src/util/constants'
 
-const defaultState : UIStateInterface = {
+const defaultState: StateInterface = {
   mouseOverSegments: [],
   mouseOverSegment: null,
   
@@ -24,7 +24,7 @@ const defaultState : UIStateInterface = {
   agreedKgTos: localStorage.getItem(LOCAL_STORAGE_CONST.AGREE_KG_TOS) === KG_TOS_VERSION
 }
 
-export function uiState(state:UIStateInterface = defaultState,action:UIAction){
+export function stateStore(state:StateInterface = defaultState,action:ActionInterface){
   switch(action.type){
     case MOUSE_OVER_SEGMENTS:
       const { segments } = action
@@ -106,7 +106,7 @@ export function uiState(state:UIStateInterface = defaultState,action:UIAction){
   }
 }
 
-export interface UIStateInterface{
+export interface StateInterface{
   mouseOverSegments: {
     layer: {
       name: string
@@ -129,7 +129,7 @@ export interface UIStateInterface{
   bottomSheetTemplate: TemplateRef<any>
 }
 
-export interface UIAction extends Action{
+export interface ActionInterface extends Action{
   segment: any | number
   landmark: any
   focusedSidePanel?: string
diff --git a/src/services/state/userConfigState.store.ts b/src/services/state/userConfigState.store.ts
index ffbb5b214..3d0b33cc7 100644
--- a/src/services/state/userConfigState.store.ts
+++ b/src/services/state/userConfigState.store.ts
@@ -2,14 +2,14 @@ import { Action, Store, select } from "@ngrx/store";
 import { Injectable, OnDestroy } from "@angular/core";
 import { Actions, Effect, ofType } from "@ngrx/effects";
 import { Observable, combineLatest, Subscription, from, of } from "rxjs";
-import { shareReplay, withLatestFrom, map, distinctUntilChanged, filter, take, tap, switchMap, catchError, share } from "rxjs/operators";
-import { generateLabelIndexId, recursiveFindRegionWithLabelIndexId } from "../stateStore.service";
+import { shareReplay, withLatestFrom, map, distinctUntilChanged, filter, take, switchMap, catchError, share } from "rxjs/operators";
+import { generateLabelIndexId, recursiveFindRegionWithLabelIndexId, IavRootStoreInterface } from "../stateStore.service";
 import { SELECT_REGIONS, NEWVIEWER, SELECT_PARCELLATION } from "./viewerState.store";
 import { DialogService } from "../dialogService.service";
-import { VIEWER_CONFIG_ACTION_TYPES } from "./viewerConfig.store";
+import { ACTION_TYPES as VIEWER_CONFIG_ACTION_TYPES } from "./viewerConfig.store";
 import { LOCAL_STORAGE_CONST } from "src/util//constants";
 
-interface UserConfigState{
+export interface StateInterface{
   savedRegionsSelection: RegionSelection[]
 }
 
@@ -33,15 +33,15 @@ interface SimpleRegionSelection{
 }
 
 interface UserConfigAction extends Action{
-  config?: Partial<UserConfigState>
+  config?: Partial<StateInterface>
   payload?: any
 }
 
-const defaultUserConfigState: UserConfigState = {
+const defaultUserConfigState: StateInterface = {
   savedRegionsSelection: []
 }
 
-const ACTION_TYPES = {
+export const ACTION_TYPES = {
   UPDATE_REGIONS_SELECTIONS: `UPDATE_REGIONS_SELECTIONS`,
   UPDATE_REGIONS_SELECTION:'UPDATE_REGIONS_SELECTION',
   SAVE_REGIONS_SELECTION: `SAVE_REGIONS_SELECTIONN`,
@@ -50,9 +50,8 @@ const ACTION_TYPES = {
   LOAD_REGIONS_SELECTION: 'LOAD_REGIONS_SELECTION'
 }
 
-export const USER_CONFIG_ACTION_TYPES = ACTION_TYPES
 
-export function userConfigState(prevState: UserConfigState = defaultUserConfigState, action: UserConfigAction) {
+export function stateStore(prevState: StateInterface = defaultUserConfigState, action: UserConfigAction) {
   switch(action.type) {
     case ACTION_TYPES.UPDATE_REGIONS_SELECTIONS:
       const { config = {} } = action
@@ -77,7 +76,7 @@ export class UserConfigStateUseEffect implements OnDestroy{
 
   constructor(
     private actions$: Actions,
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private dialogService: DialogService
   ){
     const viewerState$ = this.store$.pipe(
diff --git a/src/services/state/viewerConfig.store.ts b/src/services/state/viewerConfig.store.ts
index 6f5579c39..598f7d372 100644
--- a/src/services/state/viewerConfig.store.ts
+++ b/src/services/state/viewerConfig.store.ts
@@ -1,14 +1,14 @@
 import { Action } from "@ngrx/store";
 import { LOCAL_STORAGE_CONST } from "src/util/constants";
 
-export interface ViewerConfiguration{
+export interface StateInterface{
   gpuLimit: number
   animation: boolean
   useMobileUI: boolean
 }
 
 interface ViewerConfigurationAction extends Action{
-  config: Partial<ViewerConfiguration>,
+  config: Partial<StateInterface>,
   payload: any
 }
 
@@ -22,7 +22,7 @@ export const CONFIG_CONSTANTS = {
   defaultAnimation: true
 }
 
-const ACTION_TYPES = {
+export const ACTION_TYPES = {
   SET_ANIMATION: `SET_ANIMATION`,
   UPDATE_CONFIG: `UPDATE_CONFIG`,
   CHANGE_GPU_LIMIT: `CHANGE_GPU_LIMIT`,
@@ -55,13 +55,13 @@ const getIsMobile = () => {
 }
 const useMobileUIStroageValue = window.localStorage.getItem(LOCAL_STORAGE_CONST.MOBILE_UI) 
 
-const onLoadViewerconfig: ViewerConfiguration = {
+const onLoadViewerconfig: StateInterface = {
   animation,
   gpuLimit,
   useMobileUI: (useMobileUIStroageValue && useMobileUIStroageValue === 'true') || getIsMobile()
 }
 
-export function viewerConfigState(prevState:ViewerConfiguration = onLoadViewerconfig, action:ViewerConfigurationAction) {
+export function stateStore(prevState:StateInterface = onLoadViewerconfig, action:ViewerConfigurationAction) {
   switch (action.type) {
     case ACTION_TYPES.SET_MOBILE_UI:
       const { payload } = action
@@ -89,5 +89,3 @@ export function viewerConfigState(prevState:ViewerConfiguration = onLoadViewerco
     default: return prevState
   }
 }
-
-export const VIEWER_CONFIG_ACTION_TYPES = ACTION_TYPES
\ No newline at end of file
diff --git a/src/services/state/viewerState.store.ts b/src/services/state/viewerState.store.ts
index 5bf19bbae..2b08a8b0c 100644
--- a/src/services/state/viewerState.store.ts
+++ b/src/services/state/viewerState.store.ts
@@ -6,9 +6,9 @@ import { Actions, Effect, ofType } from '@ngrx/effects';
 import { withLatestFrom, map, shareReplay, startWith, filter, distinctUntilChanged } from 'rxjs/operators';
 import { Observable } from 'rxjs';
 import { MOUSEOVER_USER_LANDMARK } from './uiState.store';
-import { generateLabelIndexId } from '../stateStore.service';
+import { generateLabelIndexId, IavRootStoreInterface } from '../stateStore.service';
 
-export interface ViewerStateInterface{
+export interface StateInterface{
   fetchedTemplates : any[]
 
   templateSelected : any | null
@@ -24,7 +24,7 @@ export interface ViewerStateInterface{
   loadedNgLayers: NgLayerInterface[]
 }
 
-export interface AtlasAction extends Action{
+export interface ActionInterface extends Action{
   fetchedTemplate? : any[]
 
   selectTemplate? : any
@@ -44,15 +44,15 @@ export interface AtlasAction extends Action{
   payload: any
 }
 
-export function viewerState(
-  state:Partial<ViewerStateInterface> = {
+export function stateStore(
+  state:Partial<StateInterface> = {
     landmarksSelected : [],
     fetchedTemplates : [],
     loadedNgLayers: [],
     regionsSelected: [],
     userLandmarks: []
   },
-  action:AtlasAction
+  action:ActionInterface
 ){
   switch(action.type){
     /**
@@ -202,7 +202,7 @@ export const NEHUBA_LAYER_CHANGED = `NEHUBA_LAYER_CHANGED`
 export class ViewerStateUseEffect{
   constructor(
     private actions$: Actions,
-    private store$: Store<any>
+    private store$: Store<IavRootStoreInterface>
   ){
     this.currentLandmarks$ = this.store$.pipe(
       select('viewerState'),
@@ -214,7 +214,7 @@ export class ViewerStateUseEffect{
       ofType(ACTION_TYPES.REMOVE_USER_LANDMARKS),
       withLatestFrom(this.currentLandmarks$),
       map(([action, currentLandmarks]) => {
-        const { landmarkIds } = (action as AtlasAction).payload
+        const { landmarkIds } = (action as ActionInterface).payload
         for ( const rmId of landmarkIds ){
           const idx = currentLandmarks.findIndex(({ id }) => id === rmId)
           if (idx < 0) console.warn(`remove userlandmark with id ${rmId} does not exist`)
@@ -231,7 +231,7 @@ export class ViewerStateUseEffect{
       ofType(ACTION_TYPES.ADD_USERLANDMARKS),
       withLatestFrom(this.currentLandmarks$),
       map(([action, currentLandmarks]) => {
-        const { landmarks } = action as AtlasAction
+        const { landmarks } = action as ActionInterface
         const landmarkMap = new Map()
         for (const landmark of currentLandmarks) {
           const { id } = landmark
diff --git a/src/services/stateStore.service.spec.ts b/src/services/stateStore.service.spec.ts
index 363d141f7..e69de29bb 100644
--- a/src/services/stateStore.service.spec.ts
+++ b/src/services/stateStore.service.spec.ts
@@ -1,91 +0,0 @@
-import { extractLabelIdx } from './stateStore.service'
-
-describe('extractLabelIdx funciton works as intended', () => {
-
-  const treeExtremity1 = {
-    name: 'e1',
-    labelIndex : 1,
-    children : []
-  }
-  
-  const treeExtremity2 = {
-    name : 'e2',
-    labelIndex : '2',
-    children : []
-  }
-  
-  const treeExtremity3 = {
-    name : 'e3',
-    labelIndex : 3,
-    children : null
-  }
-  const treeExtremityNull = {
-    name : 'eNull',
-    labelIndex : null,
-    children : null
-  }
-  const treeExtremityUndefined = {
-    name : 'eNull',
-    children : null
-  }
-  const treeExtremityUndefined2 = {
-    name : 'eNull',
-  }
-  
-  it('works on a tree extremity', () => {
-    expect(extractLabelIdx(treeExtremity1)).toEqual([1])
-    expect(extractLabelIdx(treeExtremity2)).toEqual([2])
-    expect(extractLabelIdx(treeExtremity3)).toEqual([3])
-    expect(extractLabelIdx(treeExtremityNull)).toEqual([])
-    expect(extractLabelIdx(treeExtremityUndefined)).toEqual([])
-    expect(extractLabelIdx(treeExtremityUndefined2)).toEqual([])
-  })
-
-  it('works on tree branch', () => {
-    const branch4 = {
-      name : 'b4',
-      children : [
-        treeExtremity1,
-        treeExtremity2
-      ],
-      labelIndex: 4
-    }
-
-    const branch5 = {
-      name : 'b5',
-      children : [
-        treeExtremity2,
-        treeExtremity3,
-        treeExtremityNull
-      ],
-      labelIndex : '5'
-    }
-
-    const branchNull = {
-      name : 'bNull',
-      children : [
-        treeExtremity1,
-        treeExtremity2,
-        treeExtremity3,
-        treeExtremityNull
-      ],
-      labelIndex : null
-    }
-
-    const branchUndefined = {
-      name : 'bNull',
-      children : [
-        treeExtremity1,
-        treeExtremity2,
-        treeExtremity3,
-        treeExtremityNull
-      ]
-    }
-
-    expect(extractLabelIdx(branch4)).toEqual([1,2,4])
-    expect(extractLabelIdx(branch5)).toEqual([2,3,5])
-    expect(extractLabelIdx(branchNull)).toEqual([1,2,3])
-    expect(extractLabelIdx(branchUndefined)).toEqual([1,2,3])
-
-  })
-})
\ No newline at end of file
diff --git a/src/services/stateStore.service.ts b/src/services/stateStore.service.ts
index 842499c18..c43fe0d67 100644
--- a/src/services/stateStore.service.ts
+++ b/src/services/stateStore.service.ts
@@ -1,35 +1,64 @@
 import { filter } from 'rxjs/operators';
 
-export { viewerConfigState } from './state/viewerConfig.store'
-export { pluginState } from './state/pluginState.store'
-export { NgViewerAction, NgViewerStateInterface, ngViewerState, ADD_NG_LAYER, FORCE_SHOW_SEGMENT, HIDE_NG_LAYER, REMOVE_NG_LAYER, SHOW_NG_LAYER } from './state/ngViewerState.store'
-export { CHANGE_NAVIGATION, AtlasAction, DESELECT_LANDMARKS, FETCHED_TEMPLATE, NEWVIEWER, SELECT_LANDMARKS, SELECT_PARCELLATION, SELECT_REGIONS, USER_LANDMARKS, ViewerStateInterface, viewerState } from './state/viewerState.store'
-export { DataEntry, ParcellationRegion, DataStateInterface, DatasetAction, FETCHED_DATAENTRIES, FETCHED_SPATIAL_DATA, Landmark, OtherLandmarkGeometry, PlaneLandmarkGeometry, PointLandmarkGeometry, Property, Publication, ReferenceSpace, dataStore, File, FileSupplementData } from './state/dataStore.store'
-export { CLOSE_SIDE_PANEL, MOUSE_OVER_LANDMARK, MOUSE_OVER_SEGMENT, OPEN_SIDE_PANEL, TOGGLE_SIDE_PANEL, UIAction, UIStateInterface, uiState } from './state/uiState.store'
-export { SPATIAL_GOTO_PAGE, SpatialDataEntries, SpatialDataStateInterface, UPDATE_SPATIAL_DATA, spatialSearchState } from './state/spatialSearchState.store'
-export { userConfigState, UserConfigStateUseEffect, USER_CONFIG_ACTION_TYPES } from './state/userConfigState.store'
+import { 
+  StateInterface as PluginStateInterface,
+  stateStore as pluginState
+} from './state/pluginState.store'
+import { 
+  StateInterface as ViewerConfigStateInterface,
+  stateStore as viewerConfigState
+} from './state/viewerConfig.store'
+import { 
+  StateInterface as NgViewerStateInterface,
+  ActionInterface as NgViewerActionInterface,
+  stateStore as ngViewerState
+} from './state/ngViewerState.store'
+import {
+  StateInterface as ViewerStateInterface,
+  ActionInterface as ViewerActionInterface,
+  stateStore as viewerState
+} from './state/viewerState.store'
+import {
+  StateInterface as DataStateInterface,
+  ActionInterface as DatasetAction,
+  stateStore as dataStore
+} from './state/dataStore.store'
+import {
+  StateInterface as UIStateInterface,
+  ActionInterface as UIActionInterface,
+  stateStore as uiState
+} from './state/uiState.store'
+import{
+  stateStore as userConfigState,
+  ACTION_TYPES as USER_CONFIG_ACTION_TYPES,
+  StateInterface as UserConfigStateInterface
+} from './state/userConfigState.store'
+
+export { pluginState }
+export { viewerConfigState }
+export { NgViewerStateInterface, NgViewerActionInterface, ngViewerState }
+export { ViewerStateInterface, ViewerActionInterface, viewerState }
+export { DataStateInterface, DatasetAction, dataStore }
+export { UIStateInterface, UIActionInterface, uiState }
+export { userConfigState,  USER_CONFIG_ACTION_TYPES}
+
+export { ADD_NG_LAYER, FORCE_SHOW_SEGMENT, HIDE_NG_LAYER, REMOVE_NG_LAYER, SHOW_NG_LAYER } from './state/ngViewerState.store'
+export { CHANGE_NAVIGATION, DESELECT_LANDMARKS, FETCHED_TEMPLATE, NEWVIEWER, SELECT_LANDMARKS, SELECT_PARCELLATION, SELECT_REGIONS, USER_LANDMARKS } from './state/viewerState.store'
+export { DataEntry, ParcellationRegion, FETCHED_DATAENTRIES, FETCHED_SPATIAL_DATA, Landmark, OtherLandmarkGeometry, PlaneLandmarkGeometry, PointLandmarkGeometry, Property, Publication, ReferenceSpace, File, FileSupplementData } from './state/dataStore.store'
+export { CLOSE_SIDE_PANEL, MOUSE_OVER_LANDMARK, MOUSE_OVER_SEGMENT, OPEN_SIDE_PANEL, TOGGLE_SIDE_PANEL } from './state/uiState.store'
+export { UserConfigStateUseEffect } from './state/userConfigState.store'
 
 export const GENERAL_ACTION_TYPES = {
   ERROR: 'ERROR'
 }
 
+// TODO deprecate
 export function safeFilter(key:string){
   return filter((state:any)=>
     (typeof state !== 'undefined' && state !== null) &&
     typeof state[key] !== 'undefined' && state[key] !== null) 
 }
 
-export function extractLabelIdx(region:any):number[]{
-  if(!region.children || region.children.constructor !== Array){
-    return isNaN(region.labelIndex) || region.labelIndex === null
-      ? []
-      : [Number(region.labelIndex)]
-  }
-  return region.children.reduce((acc,item)=>{
-    return acc.concat(extractLabelIdx(item))
-  },[]).concat( region.labelIndex ? Number(region.labelIndex) : [] )
-}
-
 const inheritNgId = (region:any) => {
   const {ngId = 'root', children = []} = region
   return {
@@ -86,6 +115,7 @@ export function getMultiNgIdsRegionsLabelIndexMap(parcellation: any = {}):Map<st
 
 /**
  * labelIndexMap maps label index to region
+ * @TODO deprecate
  */
 export function getLabelIndexMap(regions:any[]):Map<number,any>{
   const returnMap = new Map()
@@ -120,6 +150,8 @@ export interface DedicatedViewState{
   dedicatedView : string | null
 }
 
+
+// @TODO deprecate
 export function isDefined(obj){
   return typeof obj !== 'undefined' && obj !== null
 }
@@ -158,3 +190,13 @@ export function recursiveFindRegionWithLabelIndexId({ regions, labelIndexId, inh
   if (found) return found
   return null
 }
+
+export interface IavRootStoreInterface{
+  pluginState: PluginStateInterface
+  viewerConfigState: ViewerConfigStateInterface
+  ngViewerState: NgViewerStateInterface
+  viewerState: ViewerStateInterface
+  dataStore: DataStateInterface
+  uiState: UIStateInterface
+  userConfigState: UserConfigStateInterface
+}
\ No newline at end of file
diff --git a/src/ui/config/config.component.ts b/src/ui/config/config.component.ts
index d5378ffde..152129199 100644
--- a/src/ui/config/config.component.ts
+++ b/src/ui/config/config.component.ts
@@ -1,12 +1,13 @@
 import { Component, OnInit, OnDestroy } from '@angular/core'
 import { Store, select } from '@ngrx/store';
-import { ViewerConfiguration, VIEWER_CONFIG_ACTION_TYPES } from 'src/services/state/viewerConfig.store'
+import { StateInterface as ViewerConfiguration, ACTION_TYPES as VIEWER_CONFIG_ACTION_TYPES } from 'src/services/state/viewerConfig.store'
 import { Observable, Subscription, combineLatest } from 'rxjs';
 import { map, distinctUntilChanged, startWith, debounceTime, tap } from 'rxjs/operators';
 import { MatSlideToggleChange, MatSliderChange } from '@angular/material';
 import { NG_VIEWER_ACTION_TYPES, SUPPORTED_PANEL_MODES } from 'src/services/state/ngViewerState.store';
 import { isIdentityQuat } from '../nehubaContainer/util';
 import { AtlasViewerConstantsServices } from 'src/atlasViewer/atlasViewer.constantService.service';
+import { IavRootStoreInterface } from 'src/services/stateStore.service';
 
 const GPU_TOOLTIP = `Higher GPU usage can cause crashes on lower end machines`
 const ANIMATION_TOOLTIP = `Animation can cause slowdowns in lower end machines`
@@ -50,7 +51,7 @@ export class ConfigComponent implements OnInit, OnDestroy{
   private viewerObliqueRotated$: Observable<boolean>
 
   constructor(
-    private store: Store<ViewerConfiguration>,
+    private store: Store<IavRootStoreInterface>,
     private constantService: AtlasViewerConstantsServices  
   ) {
 
diff --git a/src/ui/config/currentLayout/currentLayout.component.ts b/src/ui/config/currentLayout/currentLayout.component.ts
index df40022f7..f8ed7f581 100644
--- a/src/ui/config/currentLayout/currentLayout.component.ts
+++ b/src/ui/config/currentLayout/currentLayout.component.ts
@@ -3,6 +3,7 @@ import { Store, select } from "@ngrx/store";
 import { Observable } from "rxjs";
 import { SUPPORTED_PANEL_MODES } from "src/services/state/ngViewerState.store";
 import { startWith } from "rxjs/operators";
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Component({
   selector: 'current-layout',
@@ -17,7 +18,9 @@ export class CurrentLayout{
   public supportedPanelModes = SUPPORTED_PANEL_MODES
   public panelMode$: Observable<string>
 
-  constructor(private store$: Store<any>){
+  constructor(
+    private store$: Store<IavRootStoreInterface>,
+  ){
     this.panelMode$ = this.store$.pipe(
       select('ngViewerState'),
       select('panelMode'),
diff --git a/src/ui/databrowserModule/databrowser.service.ts b/src/ui/databrowserModule/databrowser.service.ts
index 0393d0b92..97205dc8c 100644
--- a/src/ui/databrowserModule/databrowser.service.ts
+++ b/src/ui/databrowserModule/databrowser.service.ts
@@ -1,9 +1,8 @@
 import { Injectable, OnDestroy } from "@angular/core";
 import { Subscription, Observable, combineLatest, BehaviorSubject, fromEvent, from, of } from "rxjs";
-import { ViewerConfiguration } from "src/services/state/viewerConfig.store";
 import { select, Store } from "@ngrx/store";
 import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service";
-import { DataEntry, safeFilter, FETCHED_DATAENTRIES, FETCHED_SPATIAL_DATA, UPDATE_SPATIAL_DATA } from "src/services/stateStore.service";
+import { DataEntry, safeFilter, FETCHED_DATAENTRIES, FETCHED_SPATIAL_DATA, IavRootStoreInterface } from "src/services/stateStore.service";
 import { map, distinctUntilChanged, debounceTime, filter, tap, switchMap, catchError, shareReplay, withLatestFrom } from "rxjs/operators";
 import { AtlasWorkerService } from "src/atlasViewer/atlasViewer.workerService.service";
 import { FilterDataEntriesByRegion } from "./util/filterDataEntriesByRegion.pipe";
@@ -80,7 +79,7 @@ export class DatabrowserService implements OnDestroy{
   constructor(
     private workerService: AtlasWorkerService,
     private constantService: AtlasViewerConstantsServices,
-    private store: Store<ViewerConfiguration>,
+    private store: Store<IavRootStoreInterface>,
     private http: HttpClient
   ){
 
@@ -172,10 +171,6 @@ export class DatabrowserService implements OnDestroy{
           type: FETCHED_SPATIAL_DATA,
           fetchedDataEntries: arr
         })
-        this.store.dispatch({
-          type : UPDATE_SPATIAL_DATA,
-          totalResults : arr.length
-        })
       })
     )
 
diff --git a/src/ui/databrowserModule/databrowser.useEffect.ts b/src/ui/databrowserModule/databrowser.useEffect.ts
index 49b494918..8202064eb 100644
--- a/src/ui/databrowserModule/databrowser.useEffect.ts
+++ b/src/ui/databrowserModule/databrowser.useEffect.ts
@@ -7,6 +7,7 @@ import { withLatestFrom, map, catchError, filter, switchMap, scan } from "rxjs/o
 import { KgSingleDatasetService } from "./kgSingleDatasetService.service";
 import { getIdFromDataEntry } from "./databrowser.service";
 import { LOCAL_STORAGE_CONST } from "src/util/constants";
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 const savedFav$ = of(window.localStorage.getItem(LOCAL_STORAGE_CONST.FAV_DATASET)).pipe(
   map(string => JSON.parse(string)),
@@ -32,7 +33,7 @@ export class DataBrowserUseEffect implements OnDestroy{
   private subscriptions: Subscription[] = []
 
   constructor(
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private actions$: Actions<any>,
     private kgSingleDatasetService: KgSingleDatasetService
     
diff --git a/src/ui/databrowserModule/kgSingleDatasetService.service.ts b/src/ui/databrowserModule/kgSingleDatasetService.service.ts
index eb2d69f94..1d3e18a6b 100644
--- a/src/ui/databrowserModule/kgSingleDatasetService.service.ts
+++ b/src/ui/databrowserModule/kgSingleDatasetService.service.ts
@@ -6,7 +6,7 @@ import { ViewerPreviewFile, DataEntry } from "src/services/state/dataStore.store
 import { determinePreviewFileType, PREVIEW_FILE_TYPES } from "./preview/previewFileIcon.pipe";
 import { MatDialog, MatSnackBar } from "@angular/material";
 import { FileViewer } from "./fileviewer/fileviewer.component";
-import { ADD_NG_LAYER, REMOVE_NG_LAYER, CHANGE_NAVIGATION } from "src/services/stateStore.service";
+import { ADD_NG_LAYER, REMOVE_NG_LAYER, CHANGE_NAVIGATION, IavRootStoreInterface } from "src/services/stateStore.service";
 import { Subscription, Subject } from "rxjs";
 import { HttpClient } from "@angular/common/http";
 import { GetKgSchemaIdFromFullIdPipe } from "./util/getKgSchemaIdFromFullId.pipe";
@@ -23,7 +23,7 @@ export class KgSingleDatasetService implements OnDestroy{
 
   constructor(
     private constantService: AtlasViewerConstantsServices,
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private dialog: MatDialog,
     private http: HttpClient,
     private snackBar: MatSnackBar
diff --git a/src/ui/nehubaContainer/maximisePanelButton/maximisePanelButton.component.ts b/src/ui/nehubaContainer/maximisePanelButton/maximisePanelButton.component.ts
index f8cef8eca..61ff6805c 100644
--- a/src/ui/nehubaContainer/maximisePanelButton/maximisePanelButton.component.ts
+++ b/src/ui/nehubaContainer/maximisePanelButton/maximisePanelButton.component.ts
@@ -3,6 +3,7 @@ import { Store, select } from "@ngrx/store";
 import { Observable } from "rxjs";
 import { distinctUntilChanged, map } from "rxjs/operators";
 import { SINGLE_PANEL } from "src/services/state/ngViewerState.store";
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Component({
   selector: 'maximise-panel-button',
@@ -22,7 +23,7 @@ export class MaximmisePanelButton{
   public isMaximised$: Observable<boolean>
 
   constructor(
-    private store$: Store<any>
+    private store$: Store<IavRootStoreInterface>,
   ){
     this.panelMode$ = this.store$.pipe(
       select('ngViewerState'),
diff --git a/src/ui/nehubaContainer/nehubaContainer.component.ts b/src/ui/nehubaContainer/nehubaContainer.component.ts
index f0d671932..bebc992d6 100644
--- a/src/ui/nehubaContainer/nehubaContainer.component.ts
+++ b/src/ui/nehubaContainer/nehubaContainer.component.ts
@@ -7,7 +7,7 @@ import { filter,map, take, scan, debounceTime, distinctUntilChanged, switchMap,
 import { AtlasViewerAPIServices, UserLandmark } from "../../atlasViewer/atlasViewer.apiService.service";
 import { timedValues } from "../../util/generator";
 import { AtlasViewerConstantsServices } from "../../atlasViewer/atlasViewer.constantService.service";
-import { ViewerConfiguration } from "src/services/state/viewerConfig.store";
+import { StateInterface as ViewerConfigStateInterface } from "src/services/state/viewerConfig.store";
 import { pipeFromArray } from "rxjs/internal/util/pipe";
 import { NEHUBA_READY, H_ONE_THREE, V_ONE_THREE, FOUR_PANEL, SINGLE_PANEL, NG_VIEWER_ACTION_TYPES } from "src/services/state/ngViewerState.store";
 import { MOUSE_OVER_SEGMENTS } from "src/services/state/uiState.store";
@@ -91,7 +91,7 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy{
 
   public viewerLoaded : boolean = false
 
-  private viewerPerformanceConfig$: Observable<ViewerConfiguration>
+  private viewerPerformanceConfig$: Observable<ViewerConfigStateInterface>
 
   private sliceViewLoadingMain$: Observable<[boolean, boolean, boolean]>
   public sliceViewLoading0$: Observable<boolean>
@@ -142,7 +142,7 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy{
   private nehubaViewerSubscriptions : Subscription[] = []
 
   public nanometersToOffsetPixelsFn : Function[] = []
-  private viewerConfig : Partial<ViewerConfiguration> = {}
+  private viewerConfig : Partial<ViewerConfigStateInterface> = {}
 
   private viewPanels: [HTMLElement, HTMLElement, HTMLElement, HTMLElement] = [null, null, null, null]
   public panelMode$: Observable<string>
@@ -1020,14 +1020,7 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy{
         })
       })
     )
-
-    this.nehubaViewerSubscriptions.push(
-      this.nehubaViewer.debouncedViewerPositionChange.pipe(
-        distinctUntilChanged((a,b) => 
-          [0,1,2].every(idx => a.position[idx] === b.position[idx]) && a.zoom === b.zoom)
-      ).subscribe(this.handleNavigationPositionAndNavigationZoomChange.bind(this))
-    )
-
+    
     const accumulatorFn: (
       acc:Map<string, { segment: string | null, segmentId: number | null }>,
       arg: {layer: {name: string}, segmentId: number|null, segment: string | null}
@@ -1205,23 +1198,6 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy{
     }
   }
 
-  // TODO deprecate
-  handleNavigationPositionAndNavigationZoomChange(navigation){
-    if(!navigation.position){
-      return
-    }
-
-    const center = navigation.position.map(n=>n/1e6)
-    const searchWidth = this.constantService.spatialWidth / 4 * navigation.zoom / 1e6
-    const { selectedTemplate } = this
-    // this.atlasViewerDataService.spatialSearch({
-    //   center,
-    //   searchWidth,
-    //   selectedTemplate,
-    //   pageNo : 0
-    // })
-  }
-
   /* because the navigation can be changed from two sources, 
     either dynamically (e.g. navigation panel in the UI or plugins etc) 
     or actively (via user interaction with the viewer) 
diff --git a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
index 5a5ec2d04..28ecbe298 100644
--- a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
+++ b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
@@ -4,7 +4,7 @@ import { AtlasWorkerService } from "src/atlasViewer/atlasViewer.workerService.se
 import { map, filter, debounceTime, scan } from "rxjs/operators";
 import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service";
 import { takeOnePipe } from "../nehubaContainer.component";
-import { ViewerConfiguration } from "src/services/state/viewerConfig.store";
+import { StateInterface as ViewerConfiguration } from "src/services/state/viewerConfig.store";
 import { pipeFromArray } from "rxjs/internal/util/pipe";
 import { getNgIdLabelIndexFromId } from "src/services/stateStore.service";
 
diff --git a/src/ui/nehubaContainer/touchSideClass.directive.ts b/src/ui/nehubaContainer/touchSideClass.directive.ts
index 8d19fd677..b08d47eee 100644
--- a/src/ui/nehubaContainer/touchSideClass.directive.ts
+++ b/src/ui/nehubaContainer/touchSideClass.directive.ts
@@ -3,6 +3,7 @@ import { Store, select } from "@ngrx/store";
 import { Observable, Subscription } from "rxjs";
 import { distinctUntilChanged, tap } from "rxjs/operators";
 import { removeTouchSideClasses, addTouchSideClasses } from "./util";
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Directive({
   selector: '[touch-side-class]',
@@ -19,7 +20,7 @@ export class TouchSideClass implements OnDestroy, OnInit{
   private subscriptions: Subscription[] = []
 
   constructor(
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private el: ElementRef
   ){
 
diff --git a/src/ui/parcellationRegion/region.base.ts b/src/ui/parcellationRegion/region.base.ts
index fadac02aa..9e2163f8c 100644
--- a/src/ui/parcellationRegion/region.base.ts
+++ b/src/ui/parcellationRegion/region.base.ts
@@ -1,6 +1,7 @@
 import { Store } from "@ngrx/store";
 import { Input } from "@angular/core";
 import { VIEWERSTATE_CONTROLLER_ACTION_TYPES } from "../viewerStateController/viewerState.base";
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 export class RegionBase{
 
@@ -10,7 +11,9 @@ export class RegionBase{
   @Input()
   public isSelected: boolean = false
 
-  constructor(private store$: Store<any>){
+  constructor(
+    private store$: Store<IavRootStoreInterface>,
+  ){
     
   }
 
diff --git a/src/ui/parcellationRegion/regionListSimpleView/regionListSimpleView.component.ts b/src/ui/parcellationRegion/regionListSimpleView/regionListSimpleView.component.ts
index 6a4dd6923..693435f10 100644
--- a/src/ui/parcellationRegion/regionListSimpleView/regionListSimpleView.component.ts
+++ b/src/ui/parcellationRegion/regionListSimpleView/regionListSimpleView.component.ts
@@ -2,6 +2,7 @@ import { Component, Input } from "@angular/core";
 
 import { RegionBase } from '../region.base'
 import { Store } from "@ngrx/store";
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Component({
   selector: 'region-list-simple-view',
@@ -19,7 +20,9 @@ export class RegionListSimpleViewComponent extends RegionBase{
   @Input()
   showDesc: boolean = false
 
-  constructor(store$: Store<any>){
+  constructor(
+    store$: Store<IavRootStoreInterface>
+  ){
     super(store$)
   }
 }
\ No newline at end of file
diff --git a/src/ui/parcellationRegion/regionMenu/regionMenu.component.ts b/src/ui/parcellationRegion/regionMenu/regionMenu.component.ts
index 3d5ef2255..565d5081c 100644
--- a/src/ui/parcellationRegion/regionMenu/regionMenu.component.ts
+++ b/src/ui/parcellationRegion/regionMenu/regionMenu.component.ts
@@ -2,6 +2,7 @@ import { Component } from "@angular/core";
 import { Store } from "@ngrx/store";
 
 import { RegionBase } from '../region.base'
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Component({
   selector: 'region-menu',
@@ -10,7 +11,9 @@ import { RegionBase } from '../region.base'
 })
 export class RegionMenuComponent extends RegionBase {
 
-constructor(store$: Store<any>) {
+constructor(
+  store$: Store<IavRootStoreInterface>
+) {
   super(store$)
   }
 }
\ No newline at end of file
diff --git a/src/ui/parcellationRegion/regionSimple/regionSimple.component.ts b/src/ui/parcellationRegion/regionSimple/regionSimple.component.ts
index 05ea0b1e4..45a42c46c 100644
--- a/src/ui/parcellationRegion/regionSimple/regionSimple.component.ts
+++ b/src/ui/parcellationRegion/regionSimple/regionSimple.component.ts
@@ -2,6 +2,7 @@ import { Component } from '@angular/core'
 
 import { RegionBase } from '../region.base'
 import { Store } from '@ngrx/store'
+import { IavRootStoreInterface } from 'src/services/stateStore.service'
 
 @Component({
   selector: 'simple-region',
@@ -12,7 +13,9 @@ import { Store } from '@ngrx/store'
 })
 
 export class SimpleRegionComponent extends RegionBase{
-  constructor(store$: Store<any>){
+  constructor(
+    store$: Store<IavRootStoreInterface>,
+  ){
     super(store$)
   }
 }
\ No newline at end of file
diff --git a/src/ui/searchSideNav/searchSideNav.component.ts b/src/ui/searchSideNav/searchSideNav.component.ts
index 28441c050..fa91bf1fa 100644
--- a/src/ui/searchSideNav/searchSideNav.component.ts
+++ b/src/ui/searchSideNav/searchSideNav.component.ts
@@ -7,7 +7,7 @@ import { Store, select } from "@ngrx/store";
 import { map, startWith, scan, filter, mapTo } from "rxjs/operators";
 import { trackRegionBy } from '../viewerStateController/regionHierachy/regionHierarchy.component'
 import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service";
-import { SELECT_REGIONS } from "src/services/stateStore.service";
+import { SELECT_REGIONS, IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Component({
   selector: 'search-side-nav',
@@ -33,7 +33,7 @@ export class SearchSideNav implements OnInit, OnDestroy {
 
   constructor(
     public dialog: MatDialog,
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private snackBar: MatSnackBar,
     private constantService: AtlasViewerConstantsServices
   ){
diff --git a/src/ui/signinBanner/signinBanner.components.ts b/src/ui/signinBanner/signinBanner.components.ts
index 862e09043..c86c86403 100644
--- a/src/ui/signinBanner/signinBanner.components.ts
+++ b/src/ui/signinBanner/signinBanner.components.ts
@@ -3,7 +3,7 @@ import { AuthService, User } from "src/services/auth.service";
 import { MatDialog, MatDialogRef, MatBottomSheet } from "@angular/material";
 import { Observable } from "rxjs";
 import { map } from "rxjs/operators";
-import { DataEntry } from "src/services/stateStore.service";
+import { DataEntry, IavRootStoreInterface } from "src/services/stateStore.service";
 import { Store, select } from "@ngrx/store";
 
 
@@ -30,7 +30,7 @@ export class SigninBanner{
   public screenshotTooltipText: string = 'Take screenshot'
 
   constructor(
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private authService: AuthService,
     private dialog: MatDialog,
     public bottomSheet: MatBottomSheet
diff --git a/src/ui/viewerStateController/regionSearch/regionSearch.component.ts b/src/ui/viewerStateController/regionSearch/regionSearch.component.ts
index 64f545be4..305da063d 100644
--- a/src/ui/viewerStateController/regionSearch/regionSearch.component.ts
+++ b/src/ui/viewerStateController/regionSearch/regionSearch.component.ts
@@ -1,10 +1,10 @@
 import { Component, EventEmitter, Output, ViewChild, ElementRef, TemplateRef, Input, ChangeDetectionStrategy } from "@angular/core";
 import { Store, select } from "@ngrx/store";
 import { Observable, combineLatest } from "rxjs";
-import { map, distinctUntilChanged, startWith, withLatestFrom, debounceTime, shareReplay, take, tap } from "rxjs/operators";
-import { getMultiNgIdsRegionsLabelIndexMap, generateLabelIndexId } from "src/services/stateStore.service";
+import { map, distinctUntilChanged, startWith, debounceTime, shareReplay, take, tap } from "rxjs/operators";
+import { getMultiNgIdsRegionsLabelIndexMap, generateLabelIndexId, IavRootStoreInterface } from "src/services/stateStore.service";
 import { FormControl } from "@angular/forms";
-import { MatAutocompleteSelectedEvent, MatDialog, AUTOCOMPLETE_OPTION_HEIGHT, AUTOCOMPLETE_PANEL_HEIGHT } from "@angular/material";
+import { MatAutocompleteSelectedEvent, MatDialog } from "@angular/material";
 import { ADD_TO_REGIONS_SELECTION_WITH_IDS, SELECT_REGIONS, CHANGE_NAVIGATION } from "src/services/state/viewerState.store";
 import { VIEWERSTATE_CONTROLLER_ACTION_TYPES } from "../viewerState.base";
 import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service";
@@ -37,7 +37,7 @@ export class RegionTextSearchAutocomplete{
   public selectedRegionLabelIndexSet: Set<string> = new Set()
 
   constructor(
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private dialog: MatDialog,
     private constantService: AtlasViewerConstantsServices
   ){
diff --git a/src/ui/viewerStateController/regionsListView/currentlySelectedRegions/currentlySelectedRegions.component.ts b/src/ui/viewerStateController/regionsListView/currentlySelectedRegions/currentlySelectedRegions.component.ts
index 15dd45992..dfe221228 100644
--- a/src/ui/viewerStateController/regionsListView/currentlySelectedRegions/currentlySelectedRegions.component.ts
+++ b/src/ui/viewerStateController/regionsListView/currentlySelectedRegions/currentlySelectedRegions.component.ts
@@ -4,6 +4,7 @@ import { Observable } from "rxjs";
 import { distinctUntilChanged, startWith } from "rxjs/operators";
 import { DESELECT_REGIONS } from "src/services/state/viewerState.store";
 import { VIEWERSTATE_CONTROLLER_ACTION_TYPES } from "src/ui/viewerStateController/viewerState.base";
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Component({
   selector: 'currently-selected-regions',
@@ -19,7 +20,7 @@ export class CurrentlySelectedRegions {
   public regionSelected$: Observable<any[]>
   
   constructor(
-    private store$: Store<any>
+    private store$: Store<IavRootStoreInterface>
   ){
 
     this.regionSelected$ = this.store$.pipe(
diff --git a/src/ui/viewerStateController/viewerState.base.ts b/src/ui/viewerStateController/viewerState.base.ts
index 3920443e0..49d5eb512 100644
--- a/src/ui/viewerStateController/viewerState.base.ts
+++ b/src/ui/viewerStateController/viewerState.base.ts
@@ -2,7 +2,7 @@ import { ViewChild, TemplateRef, OnInit } from "@angular/core";
 import { Store, select } from "@ngrx/store";
 import { Observable, Subscription } from "rxjs";
 import { distinctUntilChanged, shareReplay, filter } from "rxjs/operators";
-import { SELECT_REGIONS, USER_CONFIG_ACTION_TYPES } from "src/services/stateStore.service";
+import { SELECT_REGIONS, USER_CONFIG_ACTION_TYPES, IavRootStoreInterface } from "src/services/stateStore.service";
 import { MatSelectChange, MatBottomSheet, MatBottomSheetRef } from "@angular/material";
 import { DialogService } from "src/services/dialogService.service";
 import { RegionSelection } from "src/services/state/userConfigState.store";
@@ -36,7 +36,7 @@ export class ViewerStateBase implements OnInit{
   private savedRegionBottomSheetRef: MatBottomSheetRef
 
   constructor(
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private dialogService: DialogService,
     private bottomSheet: MatBottomSheet
   ){
diff --git a/src/ui/viewerStateController/viewerState.useEffect.ts b/src/ui/viewerStateController/viewerState.useEffect.ts
index ea0ae792e..405d22b47 100644
--- a/src/ui/viewerStateController/viewerState.useEffect.ts
+++ b/src/ui/viewerStateController/viewerState.useEffect.ts
@@ -4,7 +4,7 @@ import { Actions, ofType, Effect } from "@ngrx/effects";
 import { Store, select, Action } from "@ngrx/store";
 import { shareReplay, distinctUntilChanged, map, withLatestFrom, filter } from "rxjs/operators";
 import { VIEWERSTATE_CONTROLLER_ACTION_TYPES } from "./viewerState.base";
-import { CHANGE_NAVIGATION, SELECT_REGIONS, NEWVIEWER, GENERAL_ACTION_TYPES, SELECT_PARCELLATION, isDefined } from "src/services/stateStore.service";
+import { CHANGE_NAVIGATION, SELECT_REGIONS, NEWVIEWER, GENERAL_ACTION_TYPES, SELECT_PARCELLATION, isDefined, IavRootStoreInterface } from "src/services/stateStore.service";
 import { regionFlattener } from "src/util/regionFlattener";
 import { UIService } from "src/services/uiService.service";
 
@@ -45,7 +45,7 @@ export class ViewerStateControllerUseEffect implements OnInit, OnDestroy{
 
   constructor(
     private actions$: Actions,
-    private store$: Store<any>,
+    private store$: Store<IavRootStoreInterface>,
     private uiService: UIService
   ){
     const viewerState$ = this.store$.pipe(
diff --git a/src/ui/viewerStateController/viewerStateCFull/viewerState.component.ts b/src/ui/viewerStateController/viewerStateCFull/viewerState.component.ts
index 3513dfae1..74ce39cb2 100644
--- a/src/ui/viewerStateController/viewerStateCFull/viewerState.component.ts
+++ b/src/ui/viewerStateController/viewerStateCFull/viewerState.component.ts
@@ -4,6 +4,7 @@ import { MatBottomSheet } from "@angular/material";
 import { DialogService } from "src/services/dialogService.service";
 
 import { ViewerStateBase } from '../viewerState.base'
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 const compareWith = (o, n) => !o || !n
   ? false
@@ -20,7 +21,7 @@ const compareWith = (o, n) => !o || !n
 export class ViewerStateController extends ViewerStateBase{
 
   constructor(
-    store$: Store<any>,
+    store$: Store<IavRootStoreInterface>,
     dialogService: DialogService,
     bottomSheet: MatBottomSheet
   ){
diff --git a/src/ui/viewerStateController/viewerStateCMini/viewerStateMini.component.ts b/src/ui/viewerStateController/viewerStateCMini/viewerStateMini.component.ts
index 6652e9800..4b49aa2a0 100644
--- a/src/ui/viewerStateController/viewerStateCMini/viewerStateMini.component.ts
+++ b/src/ui/viewerStateController/viewerStateCMini/viewerStateMini.component.ts
@@ -4,6 +4,7 @@ import { MatBottomSheet } from "@angular/material";
 import { DialogService } from "src/services/dialogService.service";
 
 import { ViewerStateBase } from '../viewerState.base'
+import { IavRootStoreInterface } from "src/services/stateStore.service";
 
 @Component({
   selector: 'viewer-state-mini',
@@ -16,7 +17,7 @@ import { ViewerStateBase } from '../viewerState.base'
 export class ViewerStateMini extends ViewerStateBase{
 
   constructor(
-    store$: Store<any>,
+    store$: Store<IavRootStoreInterface>,
     dialogService: DialogService,
     bottomSheet: MatBottomSheet
   ){
diff --git a/src/util/directives/mouseOver.directive.ts b/src/util/directives/mouseOver.directive.ts
index 4fa1fd26a..abdb28575 100644
--- a/src/util/directives/mouseOver.directive.ts
+++ b/src/util/directives/mouseOver.directive.ts
@@ -4,7 +4,7 @@ import { filter, distinctUntilChanged, map, shareReplay, scan, startWith, withLa
 import { merge, Observable, combineLatest } from "rxjs";
 import { TransformOnhoverSegmentPipe } from "src/atlasViewer/onhoverSegment.pipe";
 import { SafeHtml, DomSanitizer } from "@angular/platform-browser";
-import { getNgIdLabelIndexFromId } from "src/services/stateStore.service";
+import { getNgIdLabelIndexFromId, IavRootStoreInterface } from "src/services/stateStore.service";
 
 
 /**
@@ -38,7 +38,7 @@ export class MouseHoverDirective{
   public onHoverObs$: Observable<{segments:any, landmark:any, userLandmark: any}>
   public currentOnHoverObs$: Observable<{segments:any, landmark:any, userLandmark: any}>
 
-  constructor(private store$: Store<any>){
+  constructor(private store$: Store<IavRootStoreInterface>){
 
     const onHoverUserLandmark$ = this.store$.pipe(
       select('uiState'),
-- 
GitLab