Update js to use new v2 api