you need to use the .on or .watch in the editor.viewModel , there are 2 sub viewModels inside that too
editor.viewModel.featureTemplatesViewModel
editor.viewModel.featureSketchViewModel
this will trigger on all editor states, you can check which event you need to trigger your custom code
editor.viewModel.watch("state", function (state) {
console.log(state);
});
or you can be more specific like this:
editor.viewModel.featureTemplatesViewModel.on("select", (x) => {
console.log(x);
});