We review the topological gauge theory of Josephson junction arrays and thin film superconductors, stressing the role of the usually forgotten quantum phase slips, and we derive their quantum phase structure. A quantum phase transition from a superconducting to the dual, superinsulating phase with infinite resistance (even at finite temperatures) is either direct or goes through an intermediate bosonic topological insulator phase, which is typically also called Bose metal. We show how, contrary to a widely held opinion, disorder is not relevant for the electric response in these quantum phases because excitations in the spectrum are either symmetry-protected or neutral due to confinement. The quantum phase transitions are driven only by the electric interaction growing ever stronger. First, this prevents Bose condensation, upon which out-of-condensate charges and vortices form a topological quantum state owing to mutual statistics interactions. Then, at even stronger couplings, an electric flux tube dual to Abrikosov vortices induces a linearly confining potential between charges, giving rise to superinsulation.