If an Artillerist casts a spell through their arcane firearm, how is the d8 bonus damage applied?

The Artillerist Artificer’s Arcane Firearm feature says:

When you cast an Artificer spell through the firearm, roll a d8, and you gain a bonus to one of the spell’s damage rolls equal to the number rolled. [ERLW, pg. 60]

How does this affect spells with multiple rays? Just add d8 to a single ray? E.g. Scorching Ray: "Make a ranged spell attack for each ray. On a hit, the target takes 2d6 fire damage." So one ray of the player’s choice does 2d6+1d8 and the rest do 2d6?

And what about Area of Effect spells? Does it add d8 to every creature’s damage (before any halving from successful saves)? E.g. Fireball: "Each creature in a 20-foot-radius sphere centered on that point must make a Dexterity saving throw. A target takes 8d6 fire damage on a failed save, or half as much damage on a successful one." So all creatures take 8d6+1d8 (or half of that)?