To make the jam, finely grate the orange zest into a pan and squeeze in the juice, then simmer with the remaining ingredients, until thickened, stirring occasionally. Taste; if it’s too sour, stir in a little more sugar. Cool, then remove the star anise.
Roll out the pastry to line a greased, 23cm loose-bottomed tart tin. Chill in the fridge for an hour.
Meanwhile, split and scrape the seeds from the vanilla pod (if using), then combine all the frangipane ingredients in a food processor until smooth. Wrap in clingfilm and chill in the fridge with the pastry for 30 minutes.
Preheat the oven to 180ºC/gas 4.
Once the pastry case is chilled, line it with greaseproof paper and fill with dried beans or rice, and bake for 10 minutes. Remove the beans and paper and bake for another 15 minutes, or until the pastry is golden and firm to touch. Remove from the oven.
Once cool, spread the pastry with the jam, then evenly dollop over the frangipane and sprinkle with the cranberries, pushing in a little, then scatter with flaked almonds.
Bake in the oven for 50 to 55 minutes, or until golden brown. Allow the tart to cool while you make your icing (if using).
For the icing, finely grate the orange zest into a small bowl, add the icing sugar, and squeeze in enough orange juice to give a drizzling consistency.
Serve the tart slightly warm with crème fraîche, or at room temperature, drizzled with icing.