Re-merged changes from Webinos-Platform.

The modularised code is based on a snapshot before updates to the widget server were made.

Jira issue: wp-951