Your sitch is SO much like mine was it's almost scary.
Right along with Detachment is Boundaries. What you tried to do in confronting her was about Boundaries. What you need to work on is making the boundary about you not her. You can't stop her from texting the OM in front of you. What you can do (carefully) is to state your position(boundary) and what YOU will do if she violates it. But you have to be prepared to follow thru with the consequences of your boundary, whatever that might be:
"W, I feel _____ when you _____, and if you continue to _____, I will ______."
"W, I feel disrespected when you text OM in front of me, so if you continue to do so, I will leave the room. And take the boys if we are busy doing something."
See the difference? You are not telling her what to do. It's how YOU feel, and what YOU do.
Again, I agree with letting this one sit with her awhile. You caught her off guard with confronting her, which by the way, I agree with you doing.
Be prepared with her switching up her strategy now, and be ready for when she challenges you in a new way.
Lots of good material on here ( and elsewhere) about Boundaries. Let me see if I can dig up some threads.
Everybody hurts. It's part of life. Don't miss the good stuff.