This commit prepares the frontend code to be consumed by webpack.
It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.
However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.
So we expose the modules by setting window.varName = varName; as
needed in the js files.
A "zform" knows how to render data that follows our
schema for widget messages with form elements like
buttons and choices.
This code won't be triggered until a subsequent
server-side commit takes widget_content from
API callers such as the trivial chat bot and
creates submessages for us.
We can have this scenario:
- somebody else creates a widget-ready message
- message arrives in storage
- (message is not yet in view, so no message.widget)
- new submessage event arrives
We want to just ignore submessage events in that case.
(There's a more complete fix coming for this scenario, where
we at least update message.submessages for the eventuality
that we do render the message later.)
We could get submessage events for messages that weren't
in our message store if somebody played with a widget
that was on an "old" message for somebody else.