North Carolina, the first state to sue electronic cigarette maker Juul Labs Inc., has reached a $40 million settlement on the eve of a scheduled trial.

The proposed consent decree, announced in court Monday, comes as trial in the case was set for July 12. The deal includes payments that Juul plans to make over six years.