Sort cards by pinned, then newer, then card ID. Will also removed cards with invalid BrazeActions
This is used by Braze code to handle clicks. Clients should not call this directly.