[Upg] js refactoring