Global shared space provider WeWork's second-quarter loss narrowed, revenue rose 37% and committed occupancy returned to a near pre-pandemic level as companies seek office flexibility amid a slow return-to-work pace, high inflation and a possible global economic downturn.