refactor(store): externalize state in store lib