US and Iran have agreed a ceasefire framework in principle, but Donald Trump still holds final approval over the deal, officials say.