If your rental or lease contract allows the manager access to your apartment in case of need (like working the breaker), then the manager has the right to enter your apartment at such time. That's part of what you've already accepted. It's quite reasonable that in cases of maintenance or emergency the manager should not have to wait until someone is home. Some people go away for days and weeks!
I can understand your being shocked and frightened, however - I sure would have been. No, don't punch her in the head. I'm assuming you haven't had any previous trouble with anyone trying to break in. If it were me, I'd contact the manager (in person, if possible) and explain to her how frightening the whole experience was. I'd ask her if there was a way she could leave a note somewhere or do something else so that I'd know she had been there and wouldn't have to be scared out of my wits. She may not have any obligation to do such a thing, but she might be willing to do it if you can work out a system.
BTW, I'm always embarrassed when anyone has to come into my house - a repairman or anybody. I always know they're going to see the mess and think ugly thoughts! But I've found out they are specifically trained not to take notice of household clutter. Even so, I apologize for it to them.