Heavy-flavour hadron decay leptons in Pb--Pb and Xe--Xe collisions at the LHC with ALICE