When we cut a power supply's DC output tips we need to be careful how we feed the circuit since one side is negative one side is positive. But why doesn't the same apply when we plug for example a laptop charge, mobile phone charger to a wall outlet? Is that because alternating current has no one sided direction? What about the rectifier's input after the transformer? Or is there a preventing circuit inside?
Note that you can imagine the AC from wall outlet as as 2 stages DC power supply (that is a huge simplifcation but you may understand it better). Imagine that in a given moment the 2 holes in the wall give us a voltage difference of 120VDC between them, like a DC power supply of 120v (if exists). But in the next moment things get inverted. Now there is a voltage difference of -120VDC (minus) between the same 2 holes.
Now imagine that you took out your electronic device from the wall and inverted its plug in the wall (upside down). The only difference is that now in the first moment you will get -120v and in the second moment you will now get +120v. (changes in signal). But since this signal reversing is always happening many times per second, it doesn't matter if the first cycle is positive or negative. They will be switching forever.
As I said, this is a simple way to imagine things, because in the real world its a sinusoidal signal comming from the wall. But the main idea is that the voltage sometimes is negative and sometimes is positive in respect to earth. So you can imagine that the only difference that will exist when you change polarity of your electronic device plug will be a phase shift. But since we do not have an absolute notion of time, it doesn't matter (I mean, you can't make sure that always when you plug something in the wall, the first cycle will be positive or negative).
A rectifier may be built in many ways. But taking an example of a full bridge rectifier:
Note that in each cycle the current always goes from the top to the bottom of the resistor. So it does not matter if it's a positive or negative cycle comming from the wall, the main function of the rectifier bridge is precisely guarantee that the output signal preserve its polarity (DC) regardless of the AC polarity.
Just note that some electronic devices may damage if AC polarity is inverted. But this is a special case where you have a third wire (of ground) involved. Then you have a signal reference and maybe it's necessary that the AC polarity is correct so the device knows for sure which wire is neutral (ideally the same voltage of earth wire) and which wire is the phase.
Without that third wire, working with only neutral+phase (common AC outlet), your device cannot know which wire is which. It does only "see" that you are giving a voltage difference in its pins which vary from +120v to -120v. But it could be a pair of +240v and +120v (in respect to earth) or a pair of +120v and 0v (also in respect to earth). In both cases the difference is 120v and this is only thing your device "sees".
You said it. Standard AC supplies around the world alternate positive and negative at 50 or 60 times per second (hertz or Hz). This makes it suitable for a transformer and what comes out of a transformer is also AC but at a lower voltage and this is suitable for a bridge rectifier. Some bridge rectifiers can also be connected directly to the AC supply.
Both bridge rectifiers and transformers don't care about incoming supply polarity therefore the wires can be swapped.