You can attend a social event, not freak out, or conjure up a BS excuse to decline. You can enjoy yourself and still make progress towards your goals. It may take time and practice to get there and here are some strategies may help you.
You can minimize eating out but it’s not realistic to totally eliminate it for the rest of your life. Learn how to eat healthy at restaurants rather than turning down invites or sitting awkwardly at the table drinking lemony water while everyone else is eating.