Thank you, this is exactly what I was looking for!
And yes, my keyboard did work fine on wired mode for a while (using ZMK), but because I had to constantly plug and unplug the USB C cable while transporting the keyboard over several months, the port became loose over time. Having a magnetic USB adapter could solve that problem next time.