Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
widgets: Move Event to widget_data.ts.
Steve Howell9e1d223c8d0c
diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex 6fd0584d870..8f39be74331 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -315,6 +315,7 @@ EXEMPT_FILES = make_set("web/src/user_topics.ts","web/src/user_topics_ui.ts","web/src/views_util.ts",+ "web/src/widget_data.ts","web/src/widget_modal.ts","web/src/zcommand.ts","web/src/zform.ts",diff --git a/web/src/poll_widget.ts b/web/src/poll_widget.tsindex 137c1393b1f..461f506c283 100644--- a/web/src/poll_widget.ts+++ b/web/src/poll_widget.ts@@ -10,12 +10,11 @@ import * as keydown_util from "./keydown_util.ts";import * as message_lists from "./message_lists.ts";import type {Message} from "./message_store.ts";import * as people from "./people.ts";-import type {InboundData, PollWidgetOutboundData} from "./poll_data.ts";+import type {PollWidgetOutboundData} from "./poll_data.ts";import {PollData, poll_widget_extra_data_schema} from "./poll_data.ts";+import type {Event} from "./widget_data.ts";import type {WidgetExtraData} from "./widgetize.ts";-export type Event = {sender_id: number; data: InboundData};-export function activate({$elem,callback,diff --git a/web/src/todo_widget.ts b/web/src/todo_widget.tsindex d34764e7e2f..c3b632bab80 100644--- a/web/src/todo_widget.ts+++ b/web/src/todo_widget.ts@@ -13,7 +13,7 @@ import * as message_lists from "./message_lists.ts";import type {Message} from "./message_store.ts";import {page_params} from "./page_params.ts";import * as people from "./people.ts";-import type {Event} from "./poll_widget.ts";+import type {Event} from "./widget_data.ts";// Any single user should send add a finite number of tasks// to a todo list. We arbitrarily pick this value.diff --git a/web/src/widget_data.ts b/web/src/widget_data.tsnew file mode 100644index 00000000000..18aef8333e3--- /dev/null+++ b/web/src/widget_data.ts@@ -0,0 +1,9 @@+export type Event = {sender_id: number; data: unknown};++/*+ We can evenutally move things like WidgetExtraData+ and WidgetOutboundData to here.++ It requires splitting out a new todo_data.ts module+ to avoid circular dependency hell.+*/diff --git a/web/src/widgetize.ts b/web/src/widgetize.tsindex 2a3bfcf7c2d..83140773c0d 100644--- a/web/src/widgetize.ts+++ b/web/src/widgetize.ts@@ -4,8 +4,8 @@ import * as blueslip from "./blueslip.ts";import * as message_lists from "./message_lists.ts";import type {Message} from "./message_store.ts";import type {PollWidgetExtraData, PollWidgetOutboundData} from "./poll_data.ts";-import type {Event} from "./poll_widget.ts";import type {TodoWidgetExtraData, TodoWidgetOutboundData} from "./todo_widget.ts";+import type {Event} from "./widget_data.ts";import type {ZFormExtraData} from "./zform.ts";export type WidgetExtraData = PollWidgetExtraData | TodoWidgetExtraData | ZFormExtraData | null;diff --git a/web/src/zform.ts b/web/src/zform.tsindex 2558e166386..97635fccbbf 100644--- a/web/src/zform.ts+++ b/web/src/zform.ts@@ -5,9 +5,9 @@ import render_widgets_zform_choices from "../templates/widgets/zform_choices.hbsimport * as blueslip from "./blueslip.ts";import type {Message} from "./message_store.ts";-import type {Event} from "./poll_widget.ts";import {zform_widget_extra_data_schema} from "./submessage.ts";import * as transmit from "./transmit.ts";+import type {Event} from "./widget_data.ts";import type {WidgetExtraData} from "./widgetize.ts";export type ZFormExtraData = z.infer<typeof zform_widget_extra_data_schema>;