Donald Trump and his allies had lobbied aggressively all week for a clean renewal of the controversial surveillance program used by U.S. spy agencies.