To help your diagnosis, check out the video on the following post (there are steps available, but they're rather light on actual information).
[guide|128928|Troubleshooting iPhone X Face ID Not Working 'Move iPhone a Little Lower/Higher' - iFixit Repair Guide|new_window=true]
Unfortunately, the dot projector seems to be one of those parts that are particularly susceptible to water damage and ultimately non-repairable. Well, at least not for us average joes. There is one guy, Phyrne, that seems to be associated with the rework company REWA that has fixed one, but man, it's way beyond what most of us can do. Check it out.
[guide|137417|iPhone XS Max Face ID Not Working Fixed - Dot Projector Repair - iFixit Repair Guide|new_window=true]
From what I've seen, the only part of the Face ID system that can actually be replaced is the front camera itself, which requires disassembling the front camera assembly. That, while difficult, seems to be doable by us mere mortals. There's an iPhone 11 Pro guide to doing that, but once the front camera assembly is out of the phone, the process should be the same for your 12 mini.
[guide|143157|iPhone 11 Pro Front Camera Replacement Without Losing Face ID - iFixit Repair Guide|new_window=true]
The only other thing I've seen that offers any hope in situations like this is that malfunctioning rear cameras can apparently affect Face ID, but since they're not tied to the camera they can be replaced without issue. It's unclear exactly what the connection is between the rear cameras and Face ID is, though.