const fetchMachine = Machine({ id: 'contacts', initial: 'add_contacts_button', states: { add_contacts_button: { on: { ADDED: 'permission_screen' } }, permission_screen: { on: { APPROVED: 'selection_screen', REJECTED: 'add_contacts_button' } }, selection_screen: { onEntry: 'deselectConflicts', on: { CONTACT_SELECTED: 'selection_screen', CONTACT_DESELECTED: 'selection_screen', SELECT_ALL: 'selection_screen', DESELECT_ALL: 'selection_screen', ADD_CONTACTS: 'add_contacts_button', }, initial: 'entireSelection', states: { entireSelection: { TOGGLE_FILTER: 'justTheConflicts' }, justTheConflicts: { on: { SELECTED_FIELD_TO_OVERWRITE:'justTheConflicts', SELECTED_FIELD_FOR_ALL_OVERWRITES:'justTheConflicts', TOGGLE_FILTER: 'entireSelection' } }, } } } });