Turns out a lot of the typescript warnings about improper warnings were correct. TypeScript appears to be pulling in two copies of the js-sdk when we do this, which can lead to type conflicts (or worse: the wrong code entirely). We fix this at the webpack level by explicitly importing from `src`, but some alternative build structures have broken tests because of this - jest ends up pulling in the "wrong" js-sdk, breaking things.
Just a minor thing that is bothersome. Renaming classes and functions is a bit more of an impact than is worth right now, so have settled for littering TODO comments all over the place.
We use `export default` begrudgingly here. Ideally we'd use just `export`, though this entire SDK expects things to be exported as a default. Instead of breaking everything, we'll sacrifice our export pattern for a smaller diff - a later commit can always do the default export -> regular export conversion.
This allows the configuration for `integrations_ui_url` to be more flexible. In
particular, it no longer matters whether you include a trailing slash after the
port, for example.
Split logic out of setWidget & re-use it when we add jitsi widgets.
Also fix the detection of existing jitsi widgets and make that use
getRoomWidgets() too.
Add error message when a jitsi call is already in process.
Widgets would sometimes briefly re-appear after having been deleted.
This was because of the following race:
* User presses delete, send POST req, we set `deleting`. Widget hides.
* POST request completes, we unset `deleting` so widget unhides.
* State event comes down sync so widget hides again.
This fixes this by introducing `waitForRoomWidget` and using it to
wait until the state event comes down the sync until clearing the
`deleting` flag.
Since we now have `waitForRoomWidget`, this also uses it when adding
a widget so the 'widget saved' appears at the same time the widget
does.
* ScalarMessaging onMessage was getting the current room ID by listening
for view_and remembering the room id or alias, and so having to look up
the alias if it was alias. We have RoomViewStore for this.
* Move waitForUserWidget into WidgetUtils
* s/require/import/