How to list post categories if category has children and posts if it has not

Hello,

I have post category “Product” - with custom taxonomy “product categories” like:

Category A
Category B
-category B1
-category B2
etc…

I would like a condition/template to display categories (terms) if the current term has children , and to display “products” (posts) belonging to term if the term is childless.

How to achieve it in Bricks?

Cheers