[chore] Refactored js to use global object

Split code into separate files

This refactoring makes this widget's structure very similar to the Spreadsheet Widget. @donnapep @stulees please review. Thanks.