Consider that if this is a new 50A circuit then per the 2017 revision of the NEC the circuit breaker needs to be a 50A GFCI breaker (~$100)
For less than what the JuiceBox 40A EVSE will cost you could purchase the Tesla Wall Connector ($500). When you hard wire you don't need to use a GFCI circuit breaker (saves you $100.) The Wall Connector can be used on any of 15/20/30/40/50/60 amp circuits. If you perform a load calculation you may be able to install a 60A breaker, then the Wall Connector can enable charging at up to 48A. When used with a 50A circuit the Wall Connector enables charging at up to 40A (same as the JuiceBox 40.)
This is what I would do as well.