@burdenoff/microfe-notification 2026.1129.2 → 2026.1129.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/NotificationRoutes.js +73 -72
  2. package/dist/NotificationRoutes.js.map +1 -1
  3. package/dist/hooks/useSendNotification.d.ts +1 -1
  4. package/dist/hooks/useSendNotification.js.map +1 -1
  5. package/dist/translations/en.d.ts +55 -0
  6. package/dist/v2/InboxPage.js +113 -97
  7. package/dist/v2/InboxPage.js.map +1 -1
  8. package/dist/v2/NotificationDetailPanel.d.ts +9 -5
  9. package/dist/v2/NotificationDetailPanel.js +66 -51
  10. package/dist/v2/NotificationDetailPanel.js.map +1 -1
  11. package/dist/v2/admin/TemplateFields.js +1 -1
  12. package/dist/v2/admin/TemplateFields.js.map +1 -1
  13. package/dist/v2/admin/templateText.js +22 -17
  14. package/dist/v2/admin/templateText.js.map +1 -1
  15. package/dist/v2/send/MessageTab.d.ts +4 -0
  16. package/dist/v2/send/MessageTab.js +152 -0
  17. package/dist/v2/send/MessageTab.js.map +1 -0
  18. package/dist/v2/send/PeopleTab.d.ts +4 -0
  19. package/dist/v2/send/PeopleTab.js +156 -0
  20. package/dist/v2/send/PeopleTab.js.map +1 -0
  21. package/dist/v2/send/SendNotificationDialog.d.ts +4 -0
  22. package/dist/v2/send/SendNotificationDialog.js +98 -0
  23. package/dist/v2/send/SendNotificationDialog.js.map +1 -0
  24. package/dist/v2/send/SendRedirect.d.ts +1 -0
  25. package/dist/v2/send/SendRedirect.js +20 -0
  26. package/dist/v2/send/SendRedirect.js.map +1 -0
  27. package/dist/v2/send/WhenTab.d.ts +4 -0
  28. package/dist/v2/send/WhenTab.js +64 -0
  29. package/dist/v2/send/WhenTab.js.map +1 -0
  30. package/dist/v2/send/sendModel.d.ts +47 -0
  31. package/dist/v2/send/sendModel.js +90 -0
  32. package/dist/v2/send/sendModel.js.map +1 -0
  33. package/dist/v2/send/useSendDraft.d.ts +24 -0
  34. package/dist/v2/send/useSendDraft.js +120 -0
  35. package/dist/v2/send/useSendDraft.js.map +1 -0
  36. package/package.json +1 -1
@@ -5,76 +5,77 @@ import { AdminPageV2 as r } from "./navigation-v2/AdminPageV2.js";
5
5
  import { DeliveryLogV2 as i, NotificationsV2Landing as a } from "./navigation-v2/NotificationsV2Landing.js";
6
6
  import { CompactMarkOr as o, SectionLoaderOr as s } from "./components/loadingSystem.js";
7
7
  import { ArchivedRedirect as c } from "./v2/ArchivedRedirect.js";
8
- import { Suspense as l, lazy as u } from "react";
9
- import { Navigate as d, Route as f, Routes as p } from "react-router";
10
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
11
- import { useAccountPagesV2 as g } from "@burdenoff/fe-libs/ui/account-pages-v2";
8
+ import { SendRedirect as l } from "./v2/send/SendRedirect.js";
9
+ import { Suspense as u, lazy as d } from "react";
10
+ import { Navigate as f, Route as p, Routes as m } from "react-router";
11
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
12
+ import { useAccountPagesV2 as _ } from "@burdenoff/fe-libs/ui/account-pages-v2";
12
13
  // src/NotificationRoutes.tsx
13
- var _ = u(() => import("./v2/InboxPage.js").then((e) => ({ default: e.InboxPage }))), v = u(() => import("./v2/PreferencesPage.js").then((e) => ({ default: e.PreferencesPage }))), y = u(() => import("./v2/admin/TemplatesPage.js").then((e) => ({ default: e.TemplatesPage }))), b = u(() => import("./v2/admin/TemplatePage.js").then((e) => ({ default: e.TemplatePage }))), x = u(() => import("./v2/admin/TopicsPage.js").then((e) => ({ default: e.TopicsPage }))), S = u(() => import("./v2/admin/DeliveryLogPage.js").then((e) => ({ default: e.DeliveryLogPage }))), C = u(() => import("./pages/NotificationHistoryPage.js").then((e) => ({ default: e.NotificationHistoryPage }))), w = u(() => import("./pages/NotificationTemplatesPage.js").then((e) => ({ default: e.NotificationTemplatesPage }))), T = u(() => import("./pages/TemplateEditorPage.js").then((e) => ({ default: e.TemplateEditorPage }))), E = u(() => import("./pages/CreateNotificationPage.js").then((e) => ({ default: e.CreateNotificationPage }))), D = u(() => import("./pages/NotificationTopicsPage.js").then((e) => ({ default: e.NotificationTopicsPage }))), O = u(() => import("./pages/NotificationPreferencesPage.js").then((e) => ({ default: e.NotificationPreferencesPage })));
14
- function k() {
15
- return /* @__PURE__ */ m(s, {
14
+ var v = d(() => import("./v2/InboxPage.js").then((e) => ({ default: e.InboxPage }))), y = d(() => import("./v2/PreferencesPage.js").then((e) => ({ default: e.PreferencesPage }))), b = d(() => import("./v2/admin/TemplatesPage.js").then((e) => ({ default: e.TemplatesPage }))), x = d(() => import("./v2/admin/TemplatePage.js").then((e) => ({ default: e.TemplatePage }))), S = d(() => import("./v2/admin/TopicsPage.js").then((e) => ({ default: e.TopicsPage }))), C = d(() => import("./v2/admin/DeliveryLogPage.js").then((e) => ({ default: e.DeliveryLogPage }))), w = d(() => import("./pages/NotificationHistoryPage.js").then((e) => ({ default: e.NotificationHistoryPage }))), T = d(() => import("./pages/NotificationTemplatesPage.js").then((e) => ({ default: e.NotificationTemplatesPage }))), E = d(() => import("./pages/TemplateEditorPage.js").then((e) => ({ default: e.TemplateEditorPage }))), D = d(() => import("./pages/CreateNotificationPage.js").then((e) => ({ default: e.CreateNotificationPage }))), O = d(() => import("./pages/NotificationTopicsPage.js").then((e) => ({ default: e.NotificationTopicsPage }))), k = d(() => import("./pages/NotificationPreferencesPage.js").then((e) => ({ default: e.NotificationPreferencesPage })));
15
+ function A() {
16
+ return /* @__PURE__ */ h(s, {
16
17
  route: !0,
17
18
  minHeight: "16rem",
18
- today: /* @__PURE__ */ m("div", {
19
+ today: /* @__PURE__ */ h("div", {
19
20
  className: "flex h-64 items-center justify-center",
20
- children: /* @__PURE__ */ m(o, {
21
+ children: /* @__PURE__ */ h(o, {
21
22
  className: "h-8 w-8",
22
- today: /* @__PURE__ */ m("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
23
+ today: /* @__PURE__ */ h("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
23
24
  })
24
25
  })
25
26
  });
26
27
  }
27
- function A() {
28
- let { basePath: r = "/", navigationV2: i } = e(), a = g(), o = `${r.endsWith("/") ? r.slice(0, -1) : r}/center`;
29
- return i ? /* @__PURE__ */ m(j, {
28
+ function j() {
29
+ let { basePath: r = "/", navigationV2: i } = e(), a = _(), o = `${r.endsWith("/") ? r.slice(0, -1) : r}/center`;
30
+ return i ? /* @__PURE__ */ h(M, {
30
31
  centerPath: o,
31
32
  v2: a
32
- }) : /* @__PURE__ */ m(l, {
33
- fallback: /* @__PURE__ */ m(k, {}),
34
- children: /* @__PURE__ */ h(p, { children: [
35
- /* @__PURE__ */ m(f, {
33
+ }) : /* @__PURE__ */ h(u, {
34
+ fallback: /* @__PURE__ */ h(A, {}),
35
+ children: /* @__PURE__ */ g(m, { children: [
36
+ /* @__PURE__ */ h(p, {
36
37
  index: !0,
37
- element: m(a ? _ : n, {})
38
+ element: h(a ? v : n, {})
38
39
  }),
39
- /* @__PURE__ */ m(f, {
40
+ /* @__PURE__ */ h(p, {
40
41
  path: "list",
41
- element: m(a ? _ : t, {})
42
+ element: h(a ? v : t, {})
42
43
  }),
43
- /* @__PURE__ */ m(f, {
44
+ /* @__PURE__ */ h(p, {
44
45
  path: "center",
45
- element: m(a ? _ : t, {})
46
+ element: h(a ? v : t, {})
46
47
  }),
47
- /* @__PURE__ */ m(f, {
48
+ /* @__PURE__ */ h(p, {
48
49
  path: "history",
49
- element: m(a ? c : C, {})
50
+ element: h(a ? c : w, {})
50
51
  }),
51
- /* @__PURE__ */ m(f, {
52
+ /* @__PURE__ */ h(p, {
52
53
  path: "templates",
53
- element: m(a ? y : w, {})
54
+ element: h(a ? b : T, {})
54
55
  }),
55
- /* @__PURE__ */ m(f, {
56
+ /* @__PURE__ */ h(p, {
56
57
  path: "templates/new",
57
- element: m(a ? b : T, {})
58
+ element: h(a ? x : E, {})
58
59
  }),
59
- /* @__PURE__ */ m(f, {
60
+ /* @__PURE__ */ h(p, {
60
61
  path: "templates/:templateId",
61
- element: m(a ? b : T, {})
62
+ element: h(a ? x : E, {})
62
63
  }),
63
- /* @__PURE__ */ m(f, {
64
+ /* @__PURE__ */ h(p, {
64
65
  path: "create",
65
- element: /* @__PURE__ */ m(E, {})
66
+ element: h(a ? l : D, {})
66
67
  }),
67
- /* @__PURE__ */ m(f, {
68
+ /* @__PURE__ */ h(p, {
68
69
  path: "topics",
69
- element: m(a ? x : D, {})
70
+ element: h(a ? S : O, {})
70
71
  }),
71
- /* @__PURE__ */ m(f, {
72
+ /* @__PURE__ */ h(p, {
72
73
  path: "preferences",
73
- element: m(a ? v : O, {})
74
+ element: h(a ? y : k, {})
74
75
  }),
75
- /* @__PURE__ */ m(f, {
76
+ /* @__PURE__ */ h(p, {
76
77
  path: "*",
77
- element: /* @__PURE__ */ m(d, {
78
+ element: /* @__PURE__ */ h(f, {
78
79
  to: o,
79
80
  replace: !0
80
81
  })
@@ -82,73 +83,73 @@ function A() {
82
83
  ] })
83
84
  });
84
85
  }
85
- function j({ centerPath: e, v2: n }) {
86
- return /* @__PURE__ */ m(l, {
87
- fallback: /* @__PURE__ */ m(k, {}),
88
- children: /* @__PURE__ */ h(p, { children: [
89
- /* @__PURE__ */ m(f, {
86
+ function M({ centerPath: e, v2: n }) {
87
+ return /* @__PURE__ */ h(u, {
88
+ fallback: /* @__PURE__ */ h(A, {}),
89
+ children: /* @__PURE__ */ g(m, { children: [
90
+ /* @__PURE__ */ h(p, {
90
91
  index: !0,
91
- element: m(n ? _ : a, {})
92
+ element: h(n ? v : a, {})
92
93
  }),
93
- /* @__PURE__ */ m(f, {
94
+ /* @__PURE__ */ h(p, {
94
95
  path: "list",
95
- element: m(n ? _ : t, {})
96
+ element: h(n ? v : t, {})
96
97
  }),
97
- /* @__PURE__ */ m(f, {
98
+ /* @__PURE__ */ h(p, {
98
99
  path: "center",
99
- element: m(n ? _ : t, {})
100
+ element: h(n ? v : t, {})
100
101
  }),
101
- /* @__PURE__ */ m(f, {
102
+ /* @__PURE__ */ h(p, {
102
103
  path: "history",
103
- element: m(n ? c : C, {})
104
+ element: h(n ? c : w, {})
104
105
  }),
105
- /* @__PURE__ */ m(f, {
106
+ /* @__PURE__ */ h(p, {
106
107
  path: "preferences",
107
- element: m(n ? v : O, {})
108
+ element: h(n ? y : k, {})
108
109
  }),
109
- /* @__PURE__ */ m(f, {
110
+ /* @__PURE__ */ h(p, {
110
111
  path: "templates",
111
- element: n ? /* @__PURE__ */ m(y, {}) : /* @__PURE__ */ m(r, {
112
+ element: n ? /* @__PURE__ */ h(b, {}) : /* @__PURE__ */ h(r, {
112
113
  tool: "templates",
113
- children: /* @__PURE__ */ m(w, {})
114
+ children: /* @__PURE__ */ h(T, {})
114
115
  })
115
116
  }),
116
- /* @__PURE__ */ m(f, {
117
+ /* @__PURE__ */ h(p, {
117
118
  path: "templates/new",
118
- element: n ? /* @__PURE__ */ m(b, {}) : /* @__PURE__ */ m(r, {
119
+ element: n ? /* @__PURE__ */ h(x, {}) : /* @__PURE__ */ h(r, {
119
120
  tool: "templates",
120
- children: /* @__PURE__ */ m(T, {})
121
+ children: /* @__PURE__ */ h(E, {})
121
122
  })
122
123
  }),
123
- /* @__PURE__ */ m(f, {
124
+ /* @__PURE__ */ h(p, {
124
125
  path: "templates/:templateId",
125
- element: n ? /* @__PURE__ */ m(b, {}) : /* @__PURE__ */ m(r, {
126
+ element: n ? /* @__PURE__ */ h(x, {}) : /* @__PURE__ */ h(r, {
126
127
  tool: "templates",
127
- children: /* @__PURE__ */ m(T, {})
128
+ children: /* @__PURE__ */ h(E, {})
128
129
  })
129
130
  }),
130
- /* @__PURE__ */ m(f, {
131
+ /* @__PURE__ */ h(p, {
131
132
  path: "create",
132
- element: /* @__PURE__ */ m(r, {
133
+ element: n ? /* @__PURE__ */ h(l, {}) : /* @__PURE__ */ h(r, {
133
134
  tool: "send",
134
135
  back: !1,
135
- children: /* @__PURE__ */ m(E, {})
136
+ children: /* @__PURE__ */ h(D, {})
136
137
  })
137
138
  }),
138
- /* @__PURE__ */ m(f, {
139
+ /* @__PURE__ */ h(p, {
139
140
  path: "topics",
140
- element: n ? /* @__PURE__ */ m(x, {}) : /* @__PURE__ */ m(r, {
141
+ element: n ? /* @__PURE__ */ h(S, {}) : /* @__PURE__ */ h(r, {
141
142
  tool: "topics",
142
- children: /* @__PURE__ */ m(D, {})
143
+ children: /* @__PURE__ */ h(O, {})
143
144
  })
144
145
  }),
145
- /* @__PURE__ */ m(f, {
146
+ /* @__PURE__ */ h(p, {
146
147
  path: "delivery-log",
147
- element: m(n ? S : i, {})
148
+ element: h(n ? C : i, {})
148
149
  }),
149
- /* @__PURE__ */ m(f, {
150
+ /* @__PURE__ */ h(p, {
150
151
  path: "*",
151
- element: /* @__PURE__ */ m(d, {
152
+ element: /* @__PURE__ */ h(f, {
152
153
  to: e,
153
154
  replace: !0
154
155
  })
@@ -156,6 +157,6 @@ function j({ centerPath: e, v2: n }) {
156
157
  ] })
157
158
  });
158
159
  }
159
- export { j as NavigationV2Routes, A as NotificationRoutes };
160
+ export { M as NavigationV2Routes, j as NotificationRoutes };
160
161
 
161
162
  //# sourceMappingURL=NotificationRoutes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationRoutes.js","names":["InboxPageV2","lazy","m","PreferencesPageV2","TemplatesPageV2","TemplatePageV2","TopicsPageV2","DeliveryLogPageV2","NotificationHistoryPage","NotificationTemplatesPage","TemplateEditorPage","CreateNotificationPage","NotificationTopicsPage","NotificationPreferencesPage","PageLoader","SectionLoaderOr","CompactMarkOr","NotificationRoutes","useNotification","v2","useAccountPagesV2","centerPath","basePath","navigationV2","NavigationV2Routes","Suspense","Routes","Route","jsx","NotificationLandingPage","NotificationCenterPage","ArchivedRedirect","Navigate","NotificationsV2Landing","AdminPageV2","DeliveryLogV2"],"sources":["../src/NotificationRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Navigate, Route, Routes } from 'react-router';\nimport { useNotification } from './providers/NotificationProvider';\n\n// Eager load - Primary landing page\nimport { NotificationCenterPage } from './pages/NotificationCenterPage';\nimport { NotificationLandingPage } from './pages/NotificationLandingPage';\nimport { AdminPageV2 } from './navigation-v2/AdminPageV2';\nimport { DeliveryLogV2, NotificationsV2Landing } from './navigation-v2/NotificationsV2Landing';\nimport { CompactMarkOr, SectionLoaderOr } from './components/loadingSystem';\nimport { useAccountPagesV2 } from '@burdenoff/fe-libs/ui/account-pages-v2';\nimport { ArchivedRedirect } from './v2/ArchivedRedirect';\n\n// Account & platform v2 (BOFF-16785, C1): FluidGrids' redesigned inbox and notification settings.\nconst InboxPageV2 = lazy(() => import('./v2/InboxPage').then((m) => ({ default: m.InboxPage })));\nconst PreferencesPageV2 = lazy(() =>\n import('./v2/PreferencesPage').then((m) => ({ default: m.PreferencesPage }))\n);\n// Account & platform v2 (BOFF-16785, C2): templates, a template, topics and the delivery log.\nconst TemplatesPageV2 = lazy(() =>\n import('./v2/admin/TemplatesPage').then((m) => ({ default: m.TemplatesPage }))\n);\nconst TemplatePageV2 = lazy(() =>\n import('./v2/admin/TemplatePage').then((m) => ({ default: m.TemplatePage }))\n);\nconst TopicsPageV2 = lazy(() =>\n import('./v2/admin/TopicsPage').then((m) => ({ default: m.TopicsPage }))\n);\nconst DeliveryLogPageV2 = lazy(() =>\n import('./v2/admin/DeliveryLogPage').then((m) => ({ default: m.DeliveryLogPage }))\n);\n\n// Lazy load - Secondary pages\nconst NotificationHistoryPage = lazy(() =>\n import('./pages/NotificationHistoryPage').then((m) => ({\n default: m.NotificationHistoryPage,\n }))\n);\nconst NotificationTemplatesPage = lazy(() =>\n import('./pages/NotificationTemplatesPage').then((m) => ({\n default: m.NotificationTemplatesPage,\n }))\n);\nconst TemplateEditorPage = lazy(() =>\n import('./pages/TemplateEditorPage').then((m) => ({ default: m.TemplateEditorPage }))\n);\nconst CreateNotificationPage = lazy(() =>\n import('./pages/CreateNotificationPage').then((m) => ({ default: m.CreateNotificationPage }))\n);\nconst NotificationTopicsPage = lazy(() =>\n import('./pages/NotificationTopicsPage').then((m) => ({ default: m.NotificationTopicsPage }))\n);\nconst NotificationPreferencesPage = lazy(() =>\n import('./pages/NotificationPreferencesPage').then((m) => ({\n default: m.NotificationPreferencesPage,\n }))\n);\n\n// Loading fallback component\nfunction PageLoader() {\n return (\n <SectionLoaderOr\n route\n minHeight=\"16rem\"\n today={\n <div className=\"flex h-64 items-center justify-center\">\n <CompactMarkOr\n className=\"h-8 w-8\"\n today={\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n }\n />\n </div>\n }\n />\n );\n}\n\n/**\n * Internal router for the Notification microfrontend.\n * This component handles routing within the microfrontend using React Router v7.\n *\n * Routes:\n * - / → Notification landing page\n * - /list → Notification center (canonical list alias used by shell nav homePath)\n * - /center → Notification center (in-app notifications)\n * - /history → Notification history and archive\n * - /templates → Notification templates list (admin)\n * - /templates/new → Create new template (admin)\n * - /templates/:templateId → Edit template (admin)\n * - /create → Create and send notification (admin)\n * - /topics → Manage topics (admin)\n * - /preferences → User topic preferences\n * - unmatched → Absolute redirect to /{basePath}/center (avoids relative redirect loops)\n */\nexport function NotificationRoutes() {\n const { basePath = '/', navigationV2 } = useNotification();\n // FluidGrids' Account & platform pages (BOFF-16785): every other host keeps the elements below.\n const v2 = useAccountPagesV2();\n const centerPath = `${basePath.endsWith('/') ? basePath.slice(0, -1) : basePath}/center`;\n\n if (navigationV2) return <NavigationV2Routes centerPath={centerPath} v2={v2} />;\n\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Tabbed landing - default route */}\n <Route index element={v2 ? <InboxPageV2 /> : <NotificationLandingPage />} />\n\n {/* Canonical list alias used by product-shell nav homePath */}\n <Route path=\"list\" element={v2 ? <InboxPageV2 /> : <NotificationCenterPage />} />\n\n {/* User-facing routes (all users) */}\n <Route path=\"center\" element={v2 ? <InboxPageV2 /> : <NotificationCenterPage />} />\n <Route path=\"history\" element={v2 ? <ArchivedRedirect /> : <NotificationHistoryPage />} />\n\n {/* Admin routes - Templates */}\n <Route\n path=\"templates\"\n element={v2 ? <TemplatesPageV2 /> : <NotificationTemplatesPage />}\n />\n <Route path=\"templates/new\" element={v2 ? <TemplatePageV2 /> : <TemplateEditorPage />} />\n <Route\n path=\"templates/:templateId\"\n element={v2 ? <TemplatePageV2 /> : <TemplateEditorPage />}\n />\n\n {/* Admin routes - Create/Send Notification */}\n <Route path=\"create\" element={<CreateNotificationPage />} />\n <Route path=\"topics\" element={v2 ? <TopicsPageV2 /> : <NotificationTopicsPage />} />\n <Route\n path=\"preferences\"\n element={v2 ? <PreferencesPageV2 /> : <NotificationPreferencesPage />}\n />\n\n {/* Catch-all route - absolute redirect so an unmatched path like /list\n cannot recursively append /center (e.g. /list/center/center/...) */}\n <Route path=\"*\" element={<Navigate to={centerPath} replace />} />\n </Routes>\n </Suspense>\n );\n}\n\n/**\n * FluidGrids' Navigation v2 routes (BOFF-11872). Every URL of the classic\n * routes keeps working: `/` opens straight on the inbox (old `?tab=` values\n * still open their page), and the admin pages get a route-level permission\n * gate and a way back to the inbox.\n */\nexport function NavigationV2Routes({ centerPath, v2 }: { centerPath: string; v2: boolean }) {\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={v2 ? <InboxPageV2 /> : <NotificationsV2Landing />} />\n <Route path=\"list\" element={v2 ? <InboxPageV2 /> : <NotificationCenterPage />} />\n <Route path=\"center\" element={v2 ? <InboxPageV2 /> : <NotificationCenterPage />} />\n <Route path=\"history\" element={v2 ? <ArchivedRedirect /> : <NotificationHistoryPage />} />\n <Route\n path=\"preferences\"\n element={v2 ? <PreferencesPageV2 /> : <NotificationPreferencesPage />}\n />\n <Route\n path=\"templates\"\n element={\n v2 ? (\n <TemplatesPageV2 />\n ) : (\n <AdminPageV2 tool=\"templates\">\n <NotificationTemplatesPage />\n </AdminPageV2>\n )\n }\n />\n <Route\n path=\"templates/new\"\n element={\n v2 ? (\n <TemplatePageV2 />\n ) : (\n <AdminPageV2 tool=\"templates\">\n <TemplateEditorPage />\n </AdminPageV2>\n )\n }\n />\n <Route\n path=\"templates/:templateId\"\n element={\n v2 ? (\n <TemplatePageV2 />\n ) : (\n <AdminPageV2 tool=\"templates\">\n <TemplateEditorPage />\n </AdminPageV2>\n )\n }\n />\n <Route\n path=\"create\"\n element={\n <AdminPageV2 tool=\"send\" back={false}>\n <CreateNotificationPage />\n </AdminPageV2>\n }\n />\n <Route\n path=\"topics\"\n element={\n v2 ? (\n <TopicsPageV2 />\n ) : (\n <AdminPageV2 tool=\"topics\">\n <NotificationTopicsPage />\n </AdminPageV2>\n )\n }\n />\n <Route path=\"delivery-log\" element={v2 ? <DeliveryLogPageV2 /> : <DeliveryLogV2 />} />\n <Route path=\"*\" element={<Navigate to={centerPath} replace />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAcA,IAAMA,IAAcC,QAAW,OAAO,oBAAiB,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,UAAU,EAAE,CAAC,GACzFC,IAAoBF,QACxB,OAAO,0BAAuB,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,gBAAgB,EAAE,CAC7E,GAEME,IAAkBH,QACtB,OAAO,8BAA2B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,cAAc,EAAE,CAC/E,GACMG,IAAiBJ,QACrB,OAAO,6BAA0B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,aAAa,EAAE,CAC7E,GACMI,IAAeL,QACnB,OAAO,2BAAwB,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,WAAW,EAAE,CACzE,GACMK,IAAoBN,QACxB,OAAO,gCAA6B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,gBAAgB,EAAE,CACnF,GAGMM,IAA0BP,QAC9B,OAAO,qCAAkC,CAAC,MAAM,OAAO,EACrD,SAASC,EAAE,wBACb,EAAE,CACJ,GACMO,IAA4BR,QAChC,OAAO,uC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AAD;IAAO,MAAK;IAAI,SAAS,kBAACK,GAAD;KAAU,IAAIX;KAAY,SAAA;IAAS,CAAA;GAAI,CAAA;EAC1D,EAAA,CAAA;CACA,CAAA;AAEd"}
1
+ {"version":3,"file":"NotificationRoutes.js","names":["InboxPageV2","lazy","m","PreferencesPageV2","TemplatesPageV2","TemplatePageV2","TopicsPageV2","DeliveryLogPageV2","NotificationHistoryPage","NotificationTemplatesPage","TemplateEditorPage","CreateNotificationPage","NotificationTopicsPage","NotificationPreferencesPage","PageLoader","SectionLoaderOr","CompactMarkOr","NotificationRoutes","useNotification","v2","useAccountPagesV2","centerPath","basePath","navigationV2","NavigationV2Routes","Suspense","Routes","Route","jsx","NotificationLandingPage","NotificationCenterPage","ArchivedRedirect","SendRedirect","Navigate","NotificationsV2Landing","AdminPageV2","DeliveryLogV2"],"sources":["../src/NotificationRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Navigate, Route, Routes } from 'react-router';\nimport { useNotification } from './providers/NotificationProvider';\n\n// Eager load - Primary landing page\nimport { NotificationCenterPage } from './pages/NotificationCenterPage';\nimport { NotificationLandingPage } from './pages/NotificationLandingPage';\nimport { AdminPageV2 } from './navigation-v2/AdminPageV2';\nimport { DeliveryLogV2, NotificationsV2Landing } from './navigation-v2/NotificationsV2Landing';\nimport { CompactMarkOr, SectionLoaderOr } from './components/loadingSystem';\nimport { useAccountPagesV2 } from '@burdenoff/fe-libs/ui/account-pages-v2';\nimport { ArchivedRedirect } from './v2/ArchivedRedirect';\nimport { SendRedirect } from './v2/send/SendRedirect';\n\n// Account & platform v2 (BOFF-16785, C1): FluidGrids' redesigned inbox and notification settings.\nconst InboxPageV2 = lazy(() => import('./v2/InboxPage').then((m) => ({ default: m.InboxPage })));\nconst PreferencesPageV2 = lazy(() =>\n import('./v2/PreferencesPage').then((m) => ({ default: m.PreferencesPage }))\n);\n// Account & platform v2 (BOFF-16785, C2): templates, a template, topics and the delivery log.\nconst TemplatesPageV2 = lazy(() =>\n import('./v2/admin/TemplatesPage').then((m) => ({ default: m.TemplatesPage }))\n);\nconst TemplatePageV2 = lazy(() =>\n import('./v2/admin/TemplatePage').then((m) => ({ default: m.TemplatePage }))\n);\nconst TopicsPageV2 = lazy(() =>\n import('./v2/admin/TopicsPage').then((m) => ({ default: m.TopicsPage }))\n);\nconst DeliveryLogPageV2 = lazy(() =>\n import('./v2/admin/DeliveryLogPage').then((m) => ({ default: m.DeliveryLogPage }))\n);\n\n// Lazy load - Secondary pages\nconst NotificationHistoryPage = lazy(() =>\n import('./pages/NotificationHistoryPage').then((m) => ({\n default: m.NotificationHistoryPage,\n }))\n);\nconst NotificationTemplatesPage = lazy(() =>\n import('./pages/NotificationTemplatesPage').then((m) => ({\n default: m.NotificationTemplatesPage,\n }))\n);\nconst TemplateEditorPage = lazy(() =>\n import('./pages/TemplateEditorPage').then((m) => ({ default: m.TemplateEditorPage }))\n);\nconst CreateNotificationPage = lazy(() =>\n import('./pages/CreateNotificationPage').then((m) => ({ default: m.CreateNotificationPage }))\n);\nconst NotificationTopicsPage = lazy(() =>\n import('./pages/NotificationTopicsPage').then((m) => ({ default: m.NotificationTopicsPage }))\n);\nconst NotificationPreferencesPage = lazy(() =>\n import('./pages/NotificationPreferencesPage').then((m) => ({\n default: m.NotificationPreferencesPage,\n }))\n);\n\n// Loading fallback component\nfunction PageLoader() {\n return (\n <SectionLoaderOr\n route\n minHeight=\"16rem\"\n today={\n <div className=\"flex h-64 items-center justify-center\">\n <CompactMarkOr\n className=\"h-8 w-8\"\n today={\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n }\n />\n </div>\n }\n />\n );\n}\n\n/**\n * Internal router for the Notification microfrontend.\n * This component handles routing within the microfrontend using React Router v7.\n *\n * Routes:\n * - / → Notification landing page\n * - /list → Notification center (canonical list alias used by shell nav homePath)\n * - /center → Notification center (in-app notifications)\n * - /history → Notification history and archive\n * - /templates → Notification templates list (admin)\n * - /templates/new → Create new template (admin)\n * - /templates/:templateId → Edit template (admin)\n * - /create → Create and send notification (admin)\n * - /topics → Manage topics (admin)\n * - /preferences → User topic preferences\n * - unmatched → Absolute redirect to /{basePath}/center (avoids relative redirect loops)\n */\nexport function NotificationRoutes() {\n const { basePath = '/', navigationV2 } = useNotification();\n // FluidGrids' Account & platform pages (BOFF-16785): every other host keeps the elements below.\n const v2 = useAccountPagesV2();\n const centerPath = `${basePath.endsWith('/') ? basePath.slice(0, -1) : basePath}/center`;\n\n if (navigationV2) return <NavigationV2Routes centerPath={centerPath} v2={v2} />;\n\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Tabbed landing - default route */}\n <Route index element={v2 ? <InboxPageV2 /> : <NotificationLandingPage />} />\n\n {/* Canonical list alias used by product-shell nav homePath */}\n <Route path=\"list\" element={v2 ? <InboxPageV2 /> : <NotificationCenterPage />} />\n\n {/* User-facing routes (all users) */}\n <Route path=\"center\" element={v2 ? <InboxPageV2 /> : <NotificationCenterPage />} />\n <Route path=\"history\" element={v2 ? <ArchivedRedirect /> : <NotificationHistoryPage />} />\n\n {/* Admin routes - Templates */}\n <Route\n path=\"templates\"\n element={v2 ? <TemplatesPageV2 /> : <NotificationTemplatesPage />}\n />\n <Route path=\"templates/new\" element={v2 ? <TemplatePageV2 /> : <TemplateEditorPage />} />\n <Route\n path=\"templates/:templateId\"\n element={v2 ? <TemplatePageV2 /> : <TemplateEditorPage />}\n />\n\n {/* Admin routes - Create/Send Notification */}\n <Route path=\"create\" element={v2 ? <SendRedirect /> : <CreateNotificationPage />} />\n <Route path=\"topics\" element={v2 ? <TopicsPageV2 /> : <NotificationTopicsPage />} />\n <Route\n path=\"preferences\"\n element={v2 ? <PreferencesPageV2 /> : <NotificationPreferencesPage />}\n />\n\n {/* Catch-all route - absolute redirect so an unmatched path like /list\n cannot recursively append /center (e.g. /list/center/center/...) */}\n <Route path=\"*\" element={<Navigate to={centerPath} replace />} />\n </Routes>\n </Suspense>\n );\n}\n\n/**\n * FluidGrids' Navigation v2 routes (BOFF-11872). Every URL of the classic\n * routes keeps working: `/` opens straight on the inbox (old `?tab=` values\n * still open their page), and the admin pages get a route-level permission\n * gate and a way back to the inbox.\n */\nexport function NavigationV2Routes({ centerPath, v2 }: { centerPath: string; v2: boolean }) {\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={v2 ? <InboxPageV2 /> : <NotificationsV2Landing />} />\n <Route path=\"list\" element={v2 ? <InboxPageV2 /> : <NotificationCenterPage />} />\n <Route path=\"center\" element={v2 ? <InboxPageV2 /> : <NotificationCenterPage />} />\n <Route path=\"history\" element={v2 ? <ArchivedRedirect /> : <NotificationHistoryPage />} />\n <Route\n path=\"preferences\"\n element={v2 ? <PreferencesPageV2 /> : <NotificationPreferencesPage />}\n />\n <Route\n path=\"templates\"\n element={\n v2 ? (\n <TemplatesPageV2 />\n ) : (\n <AdminPageV2 tool=\"templates\">\n <NotificationTemplatesPage />\n </AdminPageV2>\n )\n }\n />\n <Route\n path=\"templates/new\"\n element={\n v2 ? (\n <TemplatePageV2 />\n ) : (\n <AdminPageV2 tool=\"templates\">\n <TemplateEditorPage />\n </AdminPageV2>\n )\n }\n />\n <Route\n path=\"templates/:templateId\"\n element={\n v2 ? (\n <TemplatePageV2 />\n ) : (\n <AdminPageV2 tool=\"templates\">\n <TemplateEditorPage />\n </AdminPageV2>\n )\n }\n />\n <Route\n path=\"create\"\n element={\n v2 ? (\n <SendRedirect />\n ) : (\n <AdminPageV2 tool=\"send\" back={false}>\n <CreateNotificationPage />\n </AdminPageV2>\n )\n }\n />\n <Route\n path=\"topics\"\n element={\n v2 ? (\n <TopicsPageV2 />\n ) : (\n <AdminPageV2 tool=\"topics\">\n <NotificationTopicsPage />\n </AdminPageV2>\n )\n }\n />\n <Route path=\"delivery-log\" element={v2 ? <DeliveryLogPageV2 /> : <DeliveryLogV2 />} />\n <Route path=\"*\" element={<Navigate to={centerPath} replace />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":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iB,CAAA,IAEjB,kBAAC8B,GAAD;KAAa,MAAK;KAChB,UAAA,kBAACzB,GAAD,CAAqB,CAAA;IACV,CAAA;GAGlB,CAAA;GACD,kBAACiB,GAAD;IACE,MAAK;IACL,SACER,IACE,kBAACd,GAAD,CAAiB,CAAA,IAEjB,kBAAC8B,GAAD;KAAa,MAAK;KAChB,UAAA,kBAACzB,GAAD,CAAqB,CAAA;IACV,CAAA;GAGlB,CAAA;GACD,kBAACiB,GAAD;IACE,MAAK;IACL,SACER,IACE,kBAACa,GAAD,CAAe,CAAA,IAEf,kBAACG,GAAD;KAAa,MAAK;KAAO,MAAM;KAC7B,UAAA,kBAACxB,GAAD,CAAyB,CAAA;IACd,CAAA;GAGlB,CAAA;GACD,kBAACgB,GAAD;IACE,MAAK;IACL,SACER,IACE,kBAACb,GAAD,CAAe,CAAA,IAEf,kBAAC6B,GAAD;KAAa,MAAK;KAChB,UAAA,kBAACvB,GAAD,CAAyB,CAAA;IACd,CAAA;GAGlB,CAAA;GACD,kBAACe,GAAD;IAAO,MAAK;IAAe,SAAcC,EAALT,IAAMZ,IAAwB6B,GAAzB,CAAoB,CAAoB;GAAI,CAAA;GACrF,kBAACT,GAAD;IAAO,MAAK;IAAI,SAAS,kBAACM,GAAD;KAAU,IAAIZ;KAAY,SAAA;IAAS,CAAA;GAAI,CAAA;EAC1D,EAAA,CAAA;CACA,CAAA;AAEd"}
@@ -1,4 +1,4 @@
1
- export type NotificationChannelType = 'DISCORD' | 'EMAIL' | 'PUSH' | 'SLACK' | 'SMS' | 'TEAMS' | 'TELEGRAM' | 'WEBHOOK' | 'WHATSAPP';
1
+ export type NotificationChannelType = 'DISCORD' | 'EMAIL' | 'IN_APP' | 'PUSH' | 'SLACK' | 'SMS' | 'TEAMS' | 'TELEGRAM' | 'WEBHOOK' | 'WHATSAPP';
2
2
  export type NotificationTypeEnum = 'ALERT' | 'MARKETING' | 'SYSTEM' | 'TRANSACTIONAL';
3
3
  export type NotificationPriorityEnum = 'HIGH' | 'LOW' | 'MEDIUM' | 'URGENT';
4
4
  export type NotificationStatusEnum = 'CANCELLED' | 'DELIVERED' | 'DRAFT' | 'EXPIRED' | 'FAILED' | 'PENDING' | 'READ' | 'SCHEDULED' | 'SENT' | 'TRIGGERED';
@@ -1 +1 @@
1
- {"version":3,"file":"useSendNotification.js","names":["NotificationOps.TriggerNotificationDocument","NotificationOps.TriggerNotificationWithTemplateDocument","NotificationOps.TriggerBatchNotificationsDocument","useSendNotification","useNotification","isLoading","_setIsLoading","useState","isSending","setIsSending","error","setError","lastResult","setLastResult","getClient","useCallback","getGlobalNotificationClient","apiGatewayUrl","authToken","sendNotification","raw","TriggerNotificationDocument","notification","err","message","sendWithTemplate","TriggerNotificationWithTemplateDocument","templateResult","n","sendBatch","TriggerBatchNotificationsDocument","batchResult","params","notifications"],"sources":["../../src/hooks/useSendNotification.ts"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { getGlobalNotificationClient } from '../graphql/global-client';\nimport * as NotificationOps from '../generated/global-operations';\nimport type {\n TriggerNotificationMutation,\n TriggerNotificationWithTemplateMutation,\n TriggerBatchNotificationsMutation,\n} from '../generated/global-operations';\n\n// =============================================================================\n// Type Definitions (aligned with backend GraphQL schema)\n// =============================================================================\n\nexport type NotificationChannelType =\n 'DISCORD' | 'EMAIL' | 'PUSH' | 'SLACK' | 'SMS' | 'TEAMS' | 'TELEGRAM' | 'WEBHOOK' | 'WHATSAPP';\n\nexport type NotificationTypeEnum = 'ALERT' | 'MARKETING' | 'SYSTEM' | 'TRANSACTIONAL';\n\nexport type NotificationPriorityEnum = 'HIGH' | 'LOW' | 'MEDIUM' | 'URGENT';\n\nexport type NotificationStatusEnum =\n | 'CANCELLED'\n | 'DELIVERED'\n | 'DRAFT'\n | 'EXPIRED'\n | 'FAILED'\n | 'PENDING'\n | 'READ'\n | 'SCHEDULED'\n | 'SENT'\n | 'TRIGGERED';\n\nexport type NotificationDeliveryStatusEnum =\n | 'BOUNCED'\n | 'CLICKED'\n | 'COMPLAINED'\n | 'DELIVERED'\n | 'DELIVERING'\n | 'FAILED'\n | 'OPENED'\n | 'PENDING'\n | 'PROCESSING'\n | 'QUEUED'\n | 'RETRYING'\n | 'SENT'\n | 'UNSUBSCRIBED';\n\nexport type TriggerStatusEnum = 'CANCELLED' | 'FAILED' | 'PENDING' | 'TRIGGERED';\n\nexport interface RecipientInput {\n email?: string;\n locale?: string;\n name?: string;\n phoneNumber?: string;\n pushToken?: string;\n slackUserId?: string;\n teamsUserId?: string;\n timezone?: string;\n userId?: string;\n webhookUrl?: string;\n whatsappNumber?: string;\n}\n\nexport interface CreateNotificationInput {\n actions?: Array<{\n id?: string;\n label: string;\n url: string;\n style?: string;\n actionType?: string;\n metadata?: Record<string, unknown>;\n }>;\n appName?: string;\n body: string;\n channel: NotificationChannelType;\n data?: Record<string, unknown>;\n expiresAt?: string;\n htmlBody?: string;\n media?: Array<{\n url: string;\n label?: string;\n kind?: string;\n contentType?: string;\n thumbnailUrl?: string;\n }>;\n metadata?: Record<string, unknown>;\n priority?: NotificationPriorityEnum;\n recipient: RecipientInput;\n redirectUrl?: string;\n subject?: string;\n trackClicks?: boolean;\n trackOpens?: boolean;\n topicId?: string;\n type?: NotificationTypeEnum;\n}\n\nexport interface TriggerNotificationInput {\n notificationId?: string;\n notification?: CreateNotificationInput;\n channelId?: string;\n platform?: NotificationChannelType;\n includeInApp?: boolean;\n userIds?: string[];\n}\n\nexport interface TemplateNotificationResult {\n totalRequested: number;\n totalTriggered: number;\n totalFailed: number;\n notifications: TriggerNotificationResult[];\n}\n\nexport interface TriggerWithTemplateInput {\n actions?: Array<{\n id?: string;\n label: string;\n url: string;\n style?: string;\n actionType?: string;\n metadata?: Record<string, unknown>;\n }>;\n channelId?: string;\n platform?: NotificationChannelType;\n includeInApp?: boolean;\n userIds?: string[];\n expiresAt?: string;\n redirectUrl?: string;\n priority?: NotificationPriorityEnum;\n /** Single recipient (use this OR recipients, not both) */\n recipient?: RecipientInput;\n /** Multiple recipients for bulk delivery (use this OR recipient, not both) */\n recipients?: RecipientInput[];\n templateSlug: string;\n trackClicks?: boolean;\n trackOpens?: boolean;\n media?: Array<{\n url: string;\n label?: string;\n kind?: string;\n contentType?: string;\n thumbnailUrl?: string;\n }>;\n topicId?: string;\n variables: Record<string, unknown>;\n scheduledFor?: string;\n timezone?: string;\n}\n\nexport interface TriggerBatchInput {\n notificationIds?: string[];\n notifications?: CreateNotificationInput[];\n priority?: NotificationPriorityEnum;\n delayBetweenBatches?: number;\n batchSize?: number;\n scheduledFor?: string;\n timezone?: string;\n}\n\nexport interface TriggerNotificationResult {\n id: string;\n status: NotificationStatusEnum;\n deliveryStatus?: NotificationDeliveryStatusEnum;\n triggerStatus: TriggerStatusEnum;\n sentAt?: string;\n title: string;\n message: string;\n}\n\nexport interface BatchNotificationResult {\n batchId: string;\n totalRequested: number;\n totalTriggered: number;\n totalFailed: number;\n successCount: number;\n failureCount: number;\n results: Record<string, unknown>;\n}\n\n// =============================================================================\n\n/**\n * Hook to send notifications\n * Provides methods for triggering single, batch, and template-based notifications\n */\nexport function useSendNotification() {\n const { authToken, apiGatewayUrl } = useNotification();\n const [isLoading, _setIsLoading] = useState(false);\n const [isSending, setIsSending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [lastResult, setLastResult] = useState<\n TriggerNotificationResult | BatchNotificationResult | TemplateNotificationResult | null\n >(null);\n\n // Get global client — coerce null/undefined authToken to undefined\n const getClient = useCallback(() => {\n return getGlobalNotificationClient(apiGatewayUrl ?? undefined, authToken ?? undefined);\n }, [apiGatewayUrl, authToken]);\n\n /**\n * Send a single notification.\n * @throws the underlying GraphQL/network error after setting the hook's `error` state, so callers can inspect it (e.g. detect gateway FORBIDDEN via `isPermissionError`).\n */\n const sendNotification = useCallback(\n async (input: TriggerNotificationInput): Promise<TriggerNotificationResult | null> => {\n setIsSending(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.mutate<TriggerNotificationMutation>({\n mutation: NotificationOps.TriggerNotificationDocument,\n variables: { input },\n });\n\n const raw = result.data?.triggerNotification ?? null;\n if (!raw) return null;\n const notification: TriggerNotificationResult = {\n id: raw.id,\n status: raw.status as unknown as NotificationStatusEnum,\n deliveryStatus: (raw.deliveryStatus ?? undefined) as\n NotificationDeliveryStatusEnum | undefined,\n triggerStatus: raw.triggerStatus as unknown as TriggerStatusEnum,\n sentAt: raw.sentAt ?? undefined,\n title: raw.title,\n message: raw.message,\n };\n setLastResult(notification);\n return notification;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to send notification';\n console.error('[useSendNotification] Failed to send notification:', err);\n setError(message);\n // Re-throw so the caller's catch block can inspect the raw error (e.g.,\n // detect gateway FORBIDDEN via isPermissionError) — matches the\n // useNotificationTemplates pattern.\n throw err;\n } finally {\n setIsSending(false);\n }\n },\n [getClient]\n );\n\n /**\n * Send notification using a template. Supports single recipient (recipient) or bulk delivery (recipients).\n * @throws the underlying error after setting `error` state — same contract as `sendNotification`.\n */\n const sendWithTemplate = useCallback(\n async (input: TriggerWithTemplateInput): Promise<TemplateNotificationResult | null> => {\n setIsSending(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.mutate<TriggerNotificationWithTemplateMutation>({\n mutation: NotificationOps.TriggerNotificationWithTemplateDocument,\n variables: { input },\n });\n\n const raw = result.data?.triggerNotificationWithTemplate ?? null;\n if (!raw) return null;\n const templateResult: TemplateNotificationResult = {\n totalRequested: raw.totalRequested,\n totalTriggered: raw.totalTriggered,\n totalFailed: raw.totalFailed,\n notifications: raw.notifications.map((n) => ({\n id: n.id,\n status: n.status as unknown as NotificationStatusEnum,\n deliveryStatus: undefined,\n triggerStatus: 'TRIGGERED' as TriggerStatusEnum,\n sentAt: n.sentAt ?? undefined,\n title: n.title,\n message: n.message,\n })),\n };\n setLastResult(templateResult);\n return templateResult;\n } catch (err: unknown) {\n const message =\n err instanceof Error ? err.message : 'Failed to send notification with template';\n console.error('[useSendNotification] Failed to send notification with template:', err);\n setError(message);\n throw err;\n } finally {\n setIsSending(false);\n }\n },\n [getClient]\n );\n\n /**\n * Send notifications to multiple recipients.\n * @throws the underlying error after setting `error` state — same contract as `sendNotification`.\n */\n const sendBatch = useCallback(\n async (input: TriggerBatchInput): Promise<BatchNotificationResult | null> => {\n setIsSending(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.mutate<TriggerBatchNotificationsMutation>({\n mutation: NotificationOps.TriggerBatchNotificationsDocument,\n variables: { input },\n });\n\n const raw = result.data?.triggerBatchNotifications ?? null;\n if (!raw) return null;\n const batchResult: BatchNotificationResult = {\n batchId: raw.batchId,\n totalRequested: raw.totalRequested,\n totalTriggered: raw.totalTriggered,\n totalFailed: raw.totalFailed,\n successCount: raw.totalTriggered,\n failureCount: raw.totalFailed,\n results: raw.results,\n };\n setLastResult(batchResult);\n return batchResult;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to send batch notifications';\n console.error('[useSendNotification] Failed to send batch notifications:', err);\n setError(message);\n throw err;\n } finally {\n setIsSending(false);\n }\n },\n [getClient]\n );\n\n /**\n * Helper: Send a simple notification to one recipient\n * Simplified interface for common use case\n */\n const sendSimple = useCallback(\n async (params: {\n recipient: RecipientInput;\n channel: NotificationChannelType;\n body: string;\n subject?: string;\n type?: NotificationTypeEnum;\n priority?: NotificationPriorityEnum;\n }): Promise<TriggerNotificationResult | null> => {\n return sendNotification({\n notification: {\n body: params.body,\n channel: params.channel,\n recipient: params.recipient,\n subject: params.subject,\n type: params.type || 'TRANSACTIONAL',\n priority: params.priority || 'MEDIUM',\n },\n platform: params.channel,\n });\n },\n [sendNotification]\n );\n\n /**\n * Helper: Send to multiple recipients with same message\n */\n const sendToMultiple = useCallback(\n async (params: {\n recipients: RecipientInput[];\n channel: NotificationChannelType;\n body: string;\n subject?: string;\n type?: NotificationTypeEnum;\n priority?: NotificationPriorityEnum;\n }): Promise<BatchNotificationResult | null> => {\n const notifications: CreateNotificationInput[] = params.recipients.map((recipient) => ({\n body: params.body,\n channel: params.channel,\n recipient,\n subject: params.subject,\n type: params.type || 'MARKETING',\n priority: params.priority || 'MEDIUM',\n }));\n\n return sendBatch({ notifications });\n },\n [sendBatch]\n );\n\n /**\n * Clear error state\n */\n const clearError = useCallback(() => {\n setError(null);\n }, []);\n\n /**\n * Clear last result\n */\n const clearResult = useCallback(() => {\n setLastResult(null);\n }, []);\n\n return {\n // State\n isLoading,\n isSending,\n error,\n lastResult,\n\n // Core methods\n sendNotification,\n sendWithTemplate,\n sendBatch,\n\n // Helper methods\n sendSimple,\n sendToMultiple,\n\n // Utilities\n clearError,\n clearResult,\n };\n}\n"],"mappings":";;;;;AAyLA,SAAgBG,IAAsB;CACpC,IAAM,EAAE,cAAW,qBAAkBC,EAAgB,GAC/C,CAACC,GAAWC,KAAiBC,EAAS,EAAK,GAC3C,CAACC,GAAWC,KAAgBF,EAAS,EAAK,GAC1C,CAACG,GAAOC,KAAYJ,EAAwB,IAAI,GAChD,CAACK,GAAYC,KAAiBN,EAElC,IAAI,GAGAO,IAAYC,QACTC,EAA4BC,KAAiB,KAAA,GAAWC,KAAa,KAAA,CAAS,GACpF,CAACD,GAAeC,CAAS,CAAC,GAMvBC,IAAmBJ,EACvB,OAAO,MAA+E;EAEpF,AADAN,EAAa,EAAI,GACjBE,EAAS,IAAI;EAEb,IAAI;GAOF,IAAMS,KAAM,MANGN,EACM,CAAA,CAAO,OAAoC;IAC9D,UAAUd;IACV,WAAW,EAAE,SAAM;GACrB,CAAC,EAAA,CAEkB,MAAM,uBAAuB;GAChD,IAAI,CAACoB,GAAK,OAAO;GACjB,IAAME,IAA0C;IAC9C,IAAIF,EAAI;IACR,QAAQA,EAAI;IACZ,gBAAiBA,EAAI,kBAAkB,KAAA;IAEvC,eAAeA,EAAI;IACnB,QAAQA,EAAI,UAAU,KAAA;IACtB,OAAOA,EAAI;IACX,SAASA,EAAI;GACf;GAEA,OADAP,EAAcS,CAAY,GACnBA;EACT,SAAS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A,EAAI;IACpB,gBAAgBA,EAAI;IACpB,aAAaA,EAAI;IACjB,cAAcA,EAAI;IAClB,cAAcA,EAAI;IAClB,SAASA,EAAI;GACf;GAEA,OADAP,EAAckB,CAAW,GAClBA;EACT,SAASR,GAAc;GACrB,IAAMC,IAAUD,aAAe,QAAQA,EAAI,UAAU;GAGrD,MAFA,QAAQ,MAAM,6DAA6DA,CAAG,GAC9EZ,EAASa,CAAO,GACVD;EACR,UAAU;GACR,EAAa,EAAK;EACpB;CACF,GACA,CAACT,CAAS,CACZ;CAsEA,OAAO;EAEL;EACA;EACA;EACA;EAGA;EACA;EACA;EAGA,YA7EiBC,EACjB,OAAO,MAQEI,EAAiB;GACtB,cAAc;IACZ,MAAMa,EAAO;IACb,SAASA,EAAO;IAChB,WAAWA,EAAO;IAClB,SAASA,EAAO;IAChB,MAAMA,EAAO,QAAQ;IACrB,UAAUA,EAAO,YAAY;GAC/B;GACA,UAAUA,EAAO;EACnB,CAAC,GAEH,CAACb,CAAgB,CAwDjB;EACA,gBAnDqBJ,EACrB,OAAO,MAOwC;GAC7C,IAAMkB,IAA2CD,EAAO,WAAW,KAAK,OAAe;IACrF,MAAMA,EAAO;IACb,SAASA,EAAO;IAChB;IACA,SAASA,EAAO;IAChB,MAAMA,EAAO,QAAQ;IACrB,UAAUA,EAAO,YAAY;GAC/B,EAAE;GAEF,OAAOH,EAAU,EAAE,iBAAc,CAAC;EACpC,GACA,CAACA,CAAS,CA+BV;EAGA,YA5BiBd,QAAkB;GACnC,EAAS,IAAI;EACf,GAAG,CAAC,CA0BF;EACA,aAtBkBA,QAAkB;GACpC,EAAc,IAAI;EACpB,GAAG,CAAC,CAoBF;CACF;AACF"}
1
+ {"version":3,"file":"useSendNotification.js","names":["NotificationOps.TriggerNotificationDocument","NotificationOps.TriggerNotificationWithTemplateDocument","NotificationOps.TriggerBatchNotificationsDocument","useSendNotification","useNotification","isLoading","_setIsLoading","useState","isSending","setIsSending","error","setError","lastResult","setLastResult","getClient","useCallback","getGlobalNotificationClient","apiGatewayUrl","authToken","sendNotification","raw","TriggerNotificationDocument","notification","err","message","sendWithTemplate","TriggerNotificationWithTemplateDocument","templateResult","n","sendBatch","TriggerBatchNotificationsDocument","batchResult","params","notifications"],"sources":["../../src/hooks/useSendNotification.ts"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { getGlobalNotificationClient } from '../graphql/global-client';\nimport * as NotificationOps from '../generated/global-operations';\nimport type {\n TriggerNotificationMutation,\n TriggerNotificationWithTemplateMutation,\n TriggerBatchNotificationsMutation,\n} from '../generated/global-operations';\n\n// =============================================================================\n// Type Definitions (aligned with backend GraphQL schema)\n// =============================================================================\n\nexport type NotificationChannelType =\n | 'DISCORD'\n | 'EMAIL'\n | 'IN_APP'\n | 'PUSH'\n | 'SLACK'\n | 'SMS'\n | 'TEAMS'\n | 'TELEGRAM'\n | 'WEBHOOK'\n | 'WHATSAPP';\n\nexport type NotificationTypeEnum = 'ALERT' | 'MARKETING' | 'SYSTEM' | 'TRANSACTIONAL';\n\nexport type NotificationPriorityEnum = 'HIGH' | 'LOW' | 'MEDIUM' | 'URGENT';\n\nexport type NotificationStatusEnum =\n | 'CANCELLED'\n | 'DELIVERED'\n | 'DRAFT'\n | 'EXPIRED'\n | 'FAILED'\n | 'PENDING'\n | 'READ'\n | 'SCHEDULED'\n | 'SENT'\n | 'TRIGGERED';\n\nexport type NotificationDeliveryStatusEnum =\n | 'BOUNCED'\n | 'CLICKED'\n | 'COMPLAINED'\n | 'DELIVERED'\n | 'DELIVERING'\n | 'FAILED'\n | 'OPENED'\n | 'PENDING'\n | 'PROCESSING'\n | 'QUEUED'\n | 'RETRYING'\n | 'SENT'\n | 'UNSUBSCRIBED';\n\nexport type TriggerStatusEnum = 'CANCELLED' | 'FAILED' | 'PENDING' | 'TRIGGERED';\n\nexport interface RecipientInput {\n email?: string;\n locale?: string;\n name?: string;\n phoneNumber?: string;\n pushToken?: string;\n slackUserId?: string;\n teamsUserId?: string;\n timezone?: string;\n userId?: string;\n webhookUrl?: string;\n whatsappNumber?: string;\n}\n\nexport interface CreateNotificationInput {\n actions?: Array<{\n id?: string;\n label: string;\n url: string;\n style?: string;\n actionType?: string;\n metadata?: Record<string, unknown>;\n }>;\n appName?: string;\n body: string;\n channel: NotificationChannelType;\n data?: Record<string, unknown>;\n expiresAt?: string;\n htmlBody?: string;\n media?: Array<{\n url: string;\n label?: string;\n kind?: string;\n contentType?: string;\n thumbnailUrl?: string;\n }>;\n metadata?: Record<string, unknown>;\n priority?: NotificationPriorityEnum;\n recipient: RecipientInput;\n redirectUrl?: string;\n subject?: string;\n trackClicks?: boolean;\n trackOpens?: boolean;\n topicId?: string;\n type?: NotificationTypeEnum;\n}\n\nexport interface TriggerNotificationInput {\n notificationId?: string;\n notification?: CreateNotificationInput;\n channelId?: string;\n platform?: NotificationChannelType;\n includeInApp?: boolean;\n userIds?: string[];\n}\n\nexport interface TemplateNotificationResult {\n totalRequested: number;\n totalTriggered: number;\n totalFailed: number;\n notifications: TriggerNotificationResult[];\n}\n\nexport interface TriggerWithTemplateInput {\n actions?: Array<{\n id?: string;\n label: string;\n url: string;\n style?: string;\n actionType?: string;\n metadata?: Record<string, unknown>;\n }>;\n channelId?: string;\n platform?: NotificationChannelType;\n includeInApp?: boolean;\n userIds?: string[];\n expiresAt?: string;\n redirectUrl?: string;\n priority?: NotificationPriorityEnum;\n /** Single recipient (use this OR recipients, not both) */\n recipient?: RecipientInput;\n /** Multiple recipients for bulk delivery (use this OR recipient, not both) */\n recipients?: RecipientInput[];\n templateSlug: string;\n trackClicks?: boolean;\n trackOpens?: boolean;\n media?: Array<{\n url: string;\n label?: string;\n kind?: string;\n contentType?: string;\n thumbnailUrl?: string;\n }>;\n topicId?: string;\n variables: Record<string, unknown>;\n scheduledFor?: string;\n timezone?: string;\n}\n\nexport interface TriggerBatchInput {\n notificationIds?: string[];\n notifications?: CreateNotificationInput[];\n priority?: NotificationPriorityEnum;\n delayBetweenBatches?: number;\n batchSize?: number;\n scheduledFor?: string;\n timezone?: string;\n}\n\nexport interface TriggerNotificationResult {\n id: string;\n status: NotificationStatusEnum;\n deliveryStatus?: NotificationDeliveryStatusEnum;\n triggerStatus: TriggerStatusEnum;\n sentAt?: string;\n title: string;\n message: string;\n}\n\nexport interface BatchNotificationResult {\n batchId: string;\n totalRequested: number;\n totalTriggered: number;\n totalFailed: number;\n successCount: number;\n failureCount: number;\n results: Record<string, unknown>;\n}\n\n// =============================================================================\n\n/**\n * Hook to send notifications\n * Provides methods for triggering single, batch, and template-based notifications\n */\nexport function useSendNotification() {\n const { authToken, apiGatewayUrl } = useNotification();\n const [isLoading, _setIsLoading] = useState(false);\n const [isSending, setIsSending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [lastResult, setLastResult] = useState<\n TriggerNotificationResult | BatchNotificationResult | TemplateNotificationResult | null\n >(null);\n\n // Get global client — coerce null/undefined authToken to undefined\n const getClient = useCallback(() => {\n return getGlobalNotificationClient(apiGatewayUrl ?? undefined, authToken ?? undefined);\n }, [apiGatewayUrl, authToken]);\n\n /**\n * Send a single notification.\n * @throws the underlying GraphQL/network error after setting the hook's `error` state, so callers can inspect it (e.g. detect gateway FORBIDDEN via `isPermissionError`).\n */\n const sendNotification = useCallback(\n async (input: TriggerNotificationInput): Promise<TriggerNotificationResult | null> => {\n setIsSending(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.mutate<TriggerNotificationMutation>({\n mutation: NotificationOps.TriggerNotificationDocument,\n variables: { input },\n });\n\n const raw = result.data?.triggerNotification ?? null;\n if (!raw) return null;\n const notification: TriggerNotificationResult = {\n id: raw.id,\n status: raw.status as unknown as NotificationStatusEnum,\n deliveryStatus: (raw.deliveryStatus ?? undefined) as\n NotificationDeliveryStatusEnum | undefined,\n triggerStatus: raw.triggerStatus as unknown as TriggerStatusEnum,\n sentAt: raw.sentAt ?? undefined,\n title: raw.title,\n message: raw.message,\n };\n setLastResult(notification);\n return notification;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to send notification';\n console.error('[useSendNotification] Failed to send notification:', err);\n setError(message);\n // Re-throw so the caller's catch block can inspect the raw error (e.g.,\n // detect gateway FORBIDDEN via isPermissionError) — matches the\n // useNotificationTemplates pattern.\n throw err;\n } finally {\n setIsSending(false);\n }\n },\n [getClient]\n );\n\n /**\n * Send notification using a template. Supports single recipient (recipient) or bulk delivery (recipients).\n * @throws the underlying error after setting `error` state — same contract as `sendNotification`.\n */\n const sendWithTemplate = useCallback(\n async (input: TriggerWithTemplateInput): Promise<TemplateNotificationResult | null> => {\n setIsSending(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.mutate<TriggerNotificationWithTemplateMutation>({\n mutation: NotificationOps.TriggerNotificationWithTemplateDocument,\n variables: { input },\n });\n\n const raw = result.data?.triggerNotificationWithTemplate ?? null;\n if (!raw) return null;\n const templateResult: TemplateNotificationResult = {\n totalRequested: raw.totalRequested,\n totalTriggered: raw.totalTriggered,\n totalFailed: raw.totalFailed,\n notifications: raw.notifications.map((n) => ({\n id: n.id,\n status: n.status as unknown as NotificationStatusEnum,\n deliveryStatus: undefined,\n triggerStatus: 'TRIGGERED' as TriggerStatusEnum,\n sentAt: n.sentAt ?? undefined,\n title: n.title,\n message: n.message,\n })),\n };\n setLastResult(templateResult);\n return templateResult;\n } catch (err: unknown) {\n const message =\n err instanceof Error ? err.message : 'Failed to send notification with template';\n console.error('[useSendNotification] Failed to send notification with template:', err);\n setError(message);\n throw err;\n } finally {\n setIsSending(false);\n }\n },\n [getClient]\n );\n\n /**\n * Send notifications to multiple recipients.\n * @throws the underlying error after setting `error` state — same contract as `sendNotification`.\n */\n const sendBatch = useCallback(\n async (input: TriggerBatchInput): Promise<BatchNotificationResult | null> => {\n setIsSending(true);\n setError(null);\n\n try {\n const client = getClient();\n const result = await client.mutate<TriggerBatchNotificationsMutation>({\n mutation: NotificationOps.TriggerBatchNotificationsDocument,\n variables: { input },\n });\n\n const raw = result.data?.triggerBatchNotifications ?? null;\n if (!raw) return null;\n const batchResult: BatchNotificationResult = {\n batchId: raw.batchId,\n totalRequested: raw.totalRequested,\n totalTriggered: raw.totalTriggered,\n totalFailed: raw.totalFailed,\n successCount: raw.totalTriggered,\n failureCount: raw.totalFailed,\n results: raw.results,\n };\n setLastResult(batchResult);\n return batchResult;\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : 'Failed to send batch notifications';\n console.error('[useSendNotification] Failed to send batch notifications:', err);\n setError(message);\n throw err;\n } finally {\n setIsSending(false);\n }\n },\n [getClient]\n );\n\n /**\n * Helper: Send a simple notification to one recipient\n * Simplified interface for common use case\n */\n const sendSimple = useCallback(\n async (params: {\n recipient: RecipientInput;\n channel: NotificationChannelType;\n body: string;\n subject?: string;\n type?: NotificationTypeEnum;\n priority?: NotificationPriorityEnum;\n }): Promise<TriggerNotificationResult | null> => {\n return sendNotification({\n notification: {\n body: params.body,\n channel: params.channel,\n recipient: params.recipient,\n subject: params.subject,\n type: params.type || 'TRANSACTIONAL',\n priority: params.priority || 'MEDIUM',\n },\n platform: params.channel,\n });\n },\n [sendNotification]\n );\n\n /**\n * Helper: Send to multiple recipients with same message\n */\n const sendToMultiple = useCallback(\n async (params: {\n recipients: RecipientInput[];\n channel: NotificationChannelType;\n body: string;\n subject?: string;\n type?: NotificationTypeEnum;\n priority?: NotificationPriorityEnum;\n }): Promise<BatchNotificationResult | null> => {\n const notifications: CreateNotificationInput[] = params.recipients.map((recipient) => ({\n body: params.body,\n channel: params.channel,\n recipient,\n subject: params.subject,\n type: params.type || 'MARKETING',\n priority: params.priority || 'MEDIUM',\n }));\n\n return sendBatch({ notifications });\n },\n [sendBatch]\n );\n\n /**\n * Clear error state\n */\n const clearError = useCallback(() => {\n setError(null);\n }, []);\n\n /**\n * Clear last result\n */\n const clearResult = useCallback(() => {\n setLastResult(null);\n }, []);\n\n return {\n // State\n isLoading,\n isSending,\n error,\n lastResult,\n\n // Core methods\n sendNotification,\n sendWithTemplate,\n sendBatch,\n\n // Helper methods\n sendSimple,\n sendToMultiple,\n\n // Utilities\n clearError,\n clearResult,\n };\n}\n"],"mappings":";;;;;AAkMA,SAAgBG,IAAsB;CACpC,IAAM,EAAE,cAAW,qBAAkBC,EAAgB,GAC/C,CAACC,GAAWC,KAAiBC,EAAS,EAAK,GAC3C,CAACC,GAAWC,KAAgBF,EAAS,EAAK,GAC1C,CAACG,GAAOC,KAAYJ,EAAwB,IAAI,GAChD,CAACK,GAAYC,KAAiBN,EAElC,IAAI,GAGAO,IAAYC,QACTC,EAA4BC,KAAiB,KAAA,GAAWC,KAAa,KAAA,CAAS,GACpF,CAACD,GAAeC,CAAS,CAAC,GAMvBC,IAAmBJ,EACvB,OAAO,MAA+E;EAEpF,AADAN,EAAa,EAAI,GACjBE,EAAS,IAAI;EAEb,IAAI;GAOF,IAAMS,KAAM,MANGN,EACM,CAAA,CAAO,OAAoC;IAC9D,UAAUd;IACV,WAAW,EAAE,SAAM;GACrB,CAAC,EAAA,CAEkB,MAAM,uBAAuB;GAChD,IAAI,CAACoB,GAAK,OAAO;GACjB,IAAME,IAA0C;IAC9C,IAAIF,EAAI;IACR,QAAQA,EAAI;IACZ,gBAAiBA,EAAI,kBAAkB,KAAA;IAEvC,eAAeA,EAAI;IACnB,QAAQA,EAAI,UAAU,KAAA;IACtB,OAAOA,EAAI;IACX,SAASA,EAAI;GACf;GAEA,OADAP,EAAcS,CAAY,GACnBA;EACT,SAASC,GAAc;GACrB,IAAMC,IAAUD,aAAe,QAAQA,EAAI,UAAU;GAMrD,MALA,QAAQ,MAAM,sDAAsDA,CAAG,GACvEZ,EAASa,CAAO,GAIVD;EACR,UAAU;GACR,EAAa,EAAK;EACpB;CACF,GACA,CAACT,CAAS,CACZ,GAMMW,IAAmBV,EACvB,OAAO,MAAgF;EAErF,AADAN,EAAa,EAAI,GACjBE,EAAS,IAAI;EAEb,IAAI;GAOF,IAAMS,KAAM,MANGN,EACM,CAAA,CAAO,OAAgD;IAC1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S,CACZ;CAsEA,OAAO;EAEL;EACA;EACA;EACA;EAGA;EACA;EACA;EAGA,YA7EiBC,EACjB,OAAO,MAQEI,EAAiB;GACtB,cAAc;IACZ,MAAMa,EAAO;IACb,SAASA,EAAO;IAChB,WAAWA,EAAO;IAClB,SAASA,EAAO;IAChB,MAAMA,EAAO,QAAQ;IACrB,UAAUA,EAAO,YAAY;GAC/B;GACA,UAAUA,EAAO;EACnB,CAAC,GAEH,CAACb,CAAgB,CAwDjB;EACA,gBAnDqBJ,EACrB,OAAO,MAOwC;GAC7C,IAAMkB,IAA2CD,EAAO,WAAW,KAAK,OAAe;IACrF,MAAMA,EAAO;IACb,SAASA,EAAO;IAChB;IACA,SAASA,EAAO;IAChB,MAAMA,EAAO,QAAQ;IACrB,UAAUA,EAAO,YAAY;GAC/B,EAAE;GAEF,OAAOH,EAAU,EAAE,iBAAc,CAAC;EACpC,GACA,CAACA,CAAS,CA+BV;EAGA,YA5BiBd,QAAkB;GACnC,EAAS,IAAI;EACf,GAAG,CAAC,CA0BF;EACA,aAtBkBA,QAAkB;GACpC,EAAc,IAAI;EACpB,GAAG,CAAC,CAoBF;CACF;AACF"}
@@ -567,6 +567,61 @@ export declare const enTranslations: {
567
567
  restore: string;
568
568
  search: string;
569
569
  settings: string;
570
+ send: {
571
+ add: string;
572
+ added: string;
573
+ blank: string;
574
+ chosenMany: string;
575
+ chosenNone: string;
576
+ chosenOne: string;
577
+ day: string;
578
+ details: string;
579
+ detailsHelp: string;
580
+ failed: string;
581
+ failedWhy: string;
582
+ find: string;
583
+ findPlaceholder: string;
584
+ later: string;
585
+ messagePlaceholder: string;
586
+ needChannel: string;
587
+ needDetails: string;
588
+ needFuture: string;
589
+ needMessage: string;
590
+ needPeople: string;
591
+ needTitle: string;
592
+ needTopic: string;
593
+ needWhen: string;
594
+ noPermission: string;
595
+ noTopic: string;
596
+ nobody: string;
597
+ noneSent: string;
598
+ now: string;
599
+ nowHelp: string;
600
+ purpose: string;
601
+ remove: string;
602
+ schedule: string;
603
+ scheduled: string;
604
+ searchFailed: string;
605
+ send: string;
606
+ sentMany: string;
607
+ sentOne: string;
608
+ someSent: string;
609
+ startFrom: string;
610
+ tabMessage: string;
611
+ tabPeople: string;
612
+ tabWhen: string;
613
+ time: string;
614
+ title: string;
615
+ titlePlaceholder: string;
616
+ toMany: string;
617
+ toNobody: string;
618
+ toOne: string;
619
+ topic: string;
620
+ topicHelp: string;
621
+ topicOptional: string;
622
+ when: string;
623
+ zone: string;
624
+ };
570
625
  tab: {
571
626
  action: string;
572
627
  all: string;