TikTok's Chinese owner, ByteDance, has finalised a deal to establish a majority US-owned joint venture company to avoid a ban on the popular social media app used by more than 200 million Americans.