@burdenoff/microfe-notification 2026.424.101
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.
- package/README.md +376 -0
- package/dist/AdminNotificationRoot.d.ts +35 -0
- package/dist/AdminNotificationRoot.d.ts.map +1 -0
- package/dist/AdminNotificationRoot.js +81 -0
- package/dist/AdminNotificationRoot.js.map +1 -0
- package/dist/AdminNotificationRoutes.d.ts +2 -0
- package/dist/AdminNotificationRoutes.d.ts.map +1 -0
- package/dist/AdminNotificationRoutes.js +108 -0
- package/dist/AdminNotificationRoutes.js.map +1 -0
- package/dist/NotificationRoot.d.ts +31 -0
- package/dist/NotificationRoot.d.ts.map +1 -0
- package/dist/NotificationRoot.js +81 -0
- package/dist/NotificationRoot.js.map +1 -0
- package/dist/NotificationRoutes.d.ts +17 -0
- package/dist/NotificationRoutes.d.ts.map +1 -0
- package/dist/NotificationRoutes.js +67 -0
- package/dist/NotificationRoutes.js.map +1 -0
- package/dist/UserNotificationRoot.d.ts +34 -0
- package/dist/UserNotificationRoot.d.ts.map +1 -0
- package/dist/UserNotificationRoot.js +64 -0
- package/dist/UserNotificationRoot.js.map +1 -0
- package/dist/UserNotificationRoutes.d.ts +15 -0
- package/dist/UserNotificationRoutes.d.ts.map +1 -0
- package/dist/UserNotificationRoutes.js +52 -0
- package/dist/UserNotificationRoutes.js.map +1 -0
- package/dist/__tests__/setup.d.ts +2 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/components/NotificationBell.d.ts +14 -0
- package/dist/components/NotificationBell.d.ts.map +1 -0
- package/dist/components/NotificationBell.js +47 -0
- package/dist/components/NotificationBell.js.map +1 -0
- package/dist/components/NotificationCard.d.ts +19 -0
- package/dist/components/NotificationCard.d.ts.map +1 -0
- package/dist/components/NotificationCard.js +112 -0
- package/dist/components/NotificationCard.js.map +1 -0
- package/dist/components/NotificationPanel.d.ts +11 -0
- package/dist/components/NotificationPanel.d.ts.map +1 -0
- package/dist/components/NotificationPanel.js +100 -0
- package/dist/components/NotificationPanel.js.map +1 -0
- package/dist/components/RecipientSelector.d.ts +34 -0
- package/dist/components/RecipientSelector.d.ts.map +1 -0
- package/dist/components/RecipientSelector.js +212 -0
- package/dist/components/RecipientSelector.js.map +1 -0
- package/dist/components/TemplatePreview.d.ts +22 -0
- package/dist/components/TemplatePreview.d.ts.map +1 -0
- package/dist/components/TemplatePreview.js +425 -0
- package/dist/components/TemplatePreview.js.map +1 -0
- package/dist/components/VariableInserter.d.ts +12 -0
- package/dist/components/VariableInserter.d.ts.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3 -0
- package/dist/constants/permissions.d.ts +24 -0
- package/dist/constants/permissions.d.ts.map +1 -0
- package/dist/constants/permissions.js +17 -0
- package/dist/constants/permissions.js.map +1 -0
- package/dist/dev/main.d.ts +2 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/generated/global-operations.d.ts +1408 -0
- package/dist/generated/global-operations.d.ts.map +1 -0
- package/dist/generated/global-operations.js +514 -0
- package/dist/generated/global-operations.js.map +1 -0
- package/dist/generated/global-types.d.ts +20773 -0
- package/dist/generated/global-types.d.ts.map +1 -0
- package/dist/generated/wspace-operations.d.ts +2 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -0
- package/dist/generated/wspace-types.d.ts +53363 -0
- package/dist/generated/wspace-types.d.ts.map +1 -0
- package/dist/graphql/global-client.d.ts +19 -0
- package/dist/graphql/global-client.d.ts.map +1 -0
- package/dist/graphql/global-client.js +57 -0
- package/dist/graphql/global-client.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/useNotificationAdmin.d.ts +51 -0
- package/dist/hooks/useNotificationAdmin.d.ts.map +1 -0
- package/dist/hooks/useNotificationAdmin.js +203 -0
- package/dist/hooks/useNotificationAdmin.js.map +1 -0
- package/dist/hooks/useNotificationTemplates.d.ts +136 -0
- package/dist/hooks/useNotificationTemplates.d.ts.map +1 -0
- package/dist/hooks/useNotificationTemplates.js +168 -0
- package/dist/hooks/useNotificationTemplates.js.map +1 -0
- package/dist/hooks/useNotificationTopics.d.ts +36 -0
- package/dist/hooks/useNotificationTopics.d.ts.map +1 -0
- package/dist/hooks/useNotificationTopics.js +127 -0
- package/dist/hooks/useNotificationTopics.js.map +1 -0
- package/dist/hooks/useNotifications.d.ts +36 -0
- package/dist/hooks/useNotifications.d.ts.map +1 -0
- package/dist/hooks/useNotifications.js +289 -0
- package/dist/hooks/useNotifications.js.map +1 -0
- package/dist/hooks/useSendNotification.d.ts +159 -0
- package/dist/hooks/useSendNotification.d.ts.map +1 -0
- package/dist/hooks/useSendNotification.js +123 -0
- package/dist/hooks/useSendNotification.js.map +1 -0
- package/dist/hooks/useUserSearch.d.ts +27 -0
- package/dist/hooks/useUserSearch.d.ts.map +1 -0
- package/dist/hooks/useUserSearch.js +76 -0
- package/dist/hooks/useUserSearch.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/pages/CreateNotificationPage.d.ts +6 -0
- package/dist/pages/CreateNotificationPage.d.ts.map +1 -0
- package/dist/pages/CreateNotificationPage.js +1366 -0
- package/dist/pages/CreateNotificationPage.js.map +1 -0
- package/dist/pages/NotificationCenterPage.d.ts +7 -0
- package/dist/pages/NotificationCenterPage.d.ts.map +1 -0
- package/dist/pages/NotificationCenterPage.js +203 -0
- package/dist/pages/NotificationCenterPage.js.map +1 -0
- package/dist/pages/NotificationHistoryAdminPage.d.ts +3 -0
- package/dist/pages/NotificationHistoryAdminPage.d.ts.map +1 -0
- package/dist/pages/NotificationHistoryAdminPage.js +484 -0
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -0
- package/dist/pages/NotificationHistoryPage.d.ts +3 -0
- package/dist/pages/NotificationHistoryPage.d.ts.map +1 -0
- package/dist/pages/NotificationHistoryPage.js +136 -0
- package/dist/pages/NotificationHistoryPage.js.map +1 -0
- package/dist/pages/NotificationLandingPage.d.ts +11 -0
- package/dist/pages/NotificationLandingPage.d.ts.map +1 -0
- package/dist/pages/NotificationLandingPage.js +85 -0
- package/dist/pages/NotificationLandingPage.js.map +1 -0
- package/dist/pages/NotificationPreferencesPage.d.ts +2 -0
- package/dist/pages/NotificationPreferencesPage.d.ts.map +1 -0
- package/dist/pages/NotificationPreferencesPage.js +108 -0
- package/dist/pages/NotificationPreferencesPage.js.map +1 -0
- package/dist/pages/NotificationTemplatesPage.d.ts +8 -0
- package/dist/pages/NotificationTemplatesPage.d.ts.map +1 -0
- package/dist/pages/NotificationTemplatesPage.js +310 -0
- package/dist/pages/NotificationTemplatesPage.js.map +1 -0
- package/dist/pages/NotificationTopicsPage.d.ts +2 -0
- package/dist/pages/NotificationTopicsPage.d.ts.map +1 -0
- package/dist/pages/NotificationTopicsPage.js +254 -0
- package/dist/pages/NotificationTopicsPage.js.map +1 -0
- package/dist/pages/TemplateEditorPage.d.ts +13 -0
- package/dist/pages/TemplateEditorPage.d.ts.map +1 -0
- package/dist/pages/TemplateEditorPage.js +790 -0
- package/dist/pages/TemplateEditorPage.js.map +1 -0
- package/dist/providers/NotificationProvider.d.ts +19 -0
- package/dist/providers/NotificationProvider.d.ts.map +1 -0
- package/dist/providers/NotificationProvider.js +35 -0
- package/dist/providers/NotificationProvider.js.map +1 -0
- package/dist/shared/hooks/useTr.d.ts +14 -0
- package/dist/shared/hooks/useTr.d.ts.map +1 -0
- package/dist/shared/hooks/useTr.js +14 -0
- package/dist/shared/hooks/useTr.js.map +1 -0
- package/dist/store/notificationStore.d.ts +32 -0
- package/dist/store/notificationStore.d.ts.map +1 -0
- package/dist/store/notificationStore.js +124 -0
- package/dist/store/notificationStore.js.map +1 -0
- package/dist/types/index.d.ts +215 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/index.d.ts +68 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +122 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/notificationHistoryExport.d.ts +13 -0
- package/dist/utils/notificationHistoryExport.d.ts.map +1 -0
- package/dist/utils/notificationHistoryExport.js +29 -0
- package/dist/utils/notificationHistoryExport.js.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,1366 @@
|
|
|
1
|
+
import { useNotificationTopics as e } from "../hooks/useNotificationTopics.js";
|
|
2
|
+
import { useTr as t } from "../shared/hooks/useTr.js";
|
|
3
|
+
import { isPermissionError as n } from "../utils/index.js";
|
|
4
|
+
import { NOTIFICATION_PERMISSIONS as r } from "../constants/permissions.js";
|
|
5
|
+
import { useSendNotification as ee } from "../hooks/useSendNotification.js";
|
|
6
|
+
import { useNotificationTemplates as te } from "../hooks/useNotificationTemplates.js";
|
|
7
|
+
import { useUserSearch as ne } from "../hooks/useUserSearch.js";
|
|
8
|
+
import { RecipientSelector as re } from "../components/RecipientSelector.js";
|
|
9
|
+
import { useMemo as i, useState as a } from "react";
|
|
10
|
+
import { AlertCircle as ie, ArrowLeft as ae, Bell as oe, CheckCircle2 as o, Eye as se, EyeOff as ce, FileText as le, ImagePlus as ue, Link2 as de, Loader2 as s, Mail as fe, MessageSquare as c, Send as pe, Smartphone as l, User as u, Users as me, X as he } from "lucide-react";
|
|
11
|
+
import { useNavigate as ge } from "react-router-dom";
|
|
12
|
+
import { useGlobalUi as _e, usePermissions as ve } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
13
|
+
import { Fragment as ye, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
14
|
+
//#region src/pages/CreateNotificationPage.tsx
|
|
15
|
+
var be = [
|
|
16
|
+
{
|
|
17
|
+
value: "EMAIL",
|
|
18
|
+
label: "Email",
|
|
19
|
+
icon: fe,
|
|
20
|
+
description: "Send via email"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: "SMS",
|
|
24
|
+
label: "SMS",
|
|
25
|
+
icon: c,
|
|
26
|
+
description: "Send text message"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "PUSH",
|
|
30
|
+
label: "Push",
|
|
31
|
+
icon: l,
|
|
32
|
+
description: "Mobile push notification"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: "WEBHOOK",
|
|
36
|
+
label: "Webhook",
|
|
37
|
+
icon: de,
|
|
38
|
+
description: "POST to a webhook URL"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "WHATSAPP",
|
|
42
|
+
label: "WhatsApp",
|
|
43
|
+
icon: c,
|
|
44
|
+
description: "Send via WhatsApp"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "SLACK",
|
|
48
|
+
label: "Slack",
|
|
49
|
+
icon: c,
|
|
50
|
+
description: "Send to Slack"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "TEAMS",
|
|
54
|
+
label: "Teams",
|
|
55
|
+
icon: c,
|
|
56
|
+
description: "Send to Microsoft Teams"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: "TELEGRAM",
|
|
60
|
+
label: "Telegram",
|
|
61
|
+
icon: c,
|
|
62
|
+
description: "Send to Telegram"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: "DISCORD",
|
|
66
|
+
label: "Discord",
|
|
67
|
+
icon: c,
|
|
68
|
+
description: "Send to Discord"
|
|
69
|
+
}
|
|
70
|
+
], xe = [
|
|
71
|
+
{
|
|
72
|
+
value: "TRANSACTIONAL",
|
|
73
|
+
label: "Transactional",
|
|
74
|
+
description: "Account-related notifications"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
value: "MARKETING",
|
|
78
|
+
label: "Marketing",
|
|
79
|
+
description: "Promotional content"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
value: "SYSTEM",
|
|
83
|
+
label: "System",
|
|
84
|
+
description: "System updates and announcements"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
value: "ALERT",
|
|
88
|
+
label: "Alert",
|
|
89
|
+
description: "Important alerts and warnings"
|
|
90
|
+
}
|
|
91
|
+
], Se = [
|
|
92
|
+
{
|
|
93
|
+
value: "LOW",
|
|
94
|
+
label: "Low",
|
|
95
|
+
color: "bg-bg-sunken text-text-secondary"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
value: "MEDIUM",
|
|
99
|
+
label: "Medium",
|
|
100
|
+
color: "bg-status-info-bg-subtle text-status-info-text"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: "HIGH",
|
|
104
|
+
label: "High",
|
|
105
|
+
color: "bg-status-warning-bg-subtle text-status-warning-text"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
value: "URGENT",
|
|
109
|
+
label: "Urgent",
|
|
110
|
+
color: "bg-status-error-bg-subtle text-status-error-text"
|
|
111
|
+
}
|
|
112
|
+
], Ce = [
|
|
113
|
+
{
|
|
114
|
+
value: "",
|
|
115
|
+
label: "All Roles"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
value: "SUPER_ADMIN",
|
|
119
|
+
label: "Super Admin"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
value: "TENANT_ADMIN",
|
|
123
|
+
label: "Tenant Admin"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
value: "ORG_ADMIN",
|
|
127
|
+
label: "Org Admin"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
value: "WORKSPACE_ADMIN",
|
|
131
|
+
label: "Workspace Admin"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
value: "MEMBER",
|
|
135
|
+
label: "Member"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
value: "GUEST",
|
|
139
|
+
label: "Guest"
|
|
140
|
+
}
|
|
141
|
+
], we = [
|
|
142
|
+
{
|
|
143
|
+
value: "",
|
|
144
|
+
label: "All Statuses"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
value: "ACTIVE",
|
|
148
|
+
label: "Active"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
value: "INVITED",
|
|
152
|
+
label: "Invited"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: "SUSPENDED",
|
|
156
|
+
label: "Suspended"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
value: "INACTIVE",
|
|
160
|
+
label: "Inactive"
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
function Te() {
|
|
164
|
+
let fe = ge(), c = t(), { hasPermission: l, isLoading: Te, refreshPermissions: Ee } = ve(), { showToast: De } = _e(), { sendNotification: Oe, sendBatch: ke, sendWithTemplate: Ae, isSending: p, error: je, lastResult: Me, clearError: Ne, clearResult: Pe } = ee(), { templates: m, isLoading: Fe } = te(), { searchUsers: h, fetchAllUsers: Ie, results: g, isLoading: Le, error: _ } = ne(), { topics: Re } = e({ isActive: !0 }), [v, ze] = a("compose"), [y, Be] = a("EMAIL"), [b, Ve] = a("MARKETING"), [x, He] = a("MEDIUM"), [S, Ue] = a([]), [C, w] = a("manual"), [T, E] = a([]), [D, We] = a(!1), [O, Ge] = a(""), [k, Ke] = a(""), [A, qe] = a(""), [j, Je] = a(""), [Ye, Xe] = a(""), [Ze, Qe] = a(!1), [M, $e] = a(""), [N, P] = a([{
|
|
165
|
+
url: "",
|
|
166
|
+
label: "",
|
|
167
|
+
kind: "image"
|
|
168
|
+
}]), [F, I] = a([{
|
|
169
|
+
id: "primary-action",
|
|
170
|
+
label: "",
|
|
171
|
+
url: "",
|
|
172
|
+
style: "primary"
|
|
173
|
+
}]), [L, et] = a(!1), [R, z] = a([]), [B, V] = a(""), [H, tt] = a(""), [U, nt] = a({}), [W, rt] = a(!1), [G, it] = a(""), [K, at] = a(!0), [ot, q] = a(null), [J, Y] = a(!1), X = i(() => m.find((e) => e.slug === H), [m, H]), Z = i(() => {
|
|
174
|
+
if (!X?.variables) return null;
|
|
175
|
+
try {
|
|
176
|
+
return typeof X.variables == "string" ? JSON.parse(X.variables) : X.variables;
|
|
177
|
+
} catch {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
}, [X]), st = i(() => Z ? Array.isArray(Z) ? Z.filter((e) => e && typeof e.name == "string").map((e) => ({
|
|
181
|
+
key: e.name,
|
|
182
|
+
type: e.type || "string",
|
|
183
|
+
required: !!e.required,
|
|
184
|
+
description: e.description || "",
|
|
185
|
+
defaultValue: e.defaultValue || ""
|
|
186
|
+
})) : typeof Z == "object" && Z ? Object.entries(Z).map(([e, t]) => ({
|
|
187
|
+
key: e,
|
|
188
|
+
type: typeof t == "string" ? t : "string",
|
|
189
|
+
required: !1,
|
|
190
|
+
description: "",
|
|
191
|
+
defaultValue: ""
|
|
192
|
+
})) : [] : [], [Z]), ct = (e) => {
|
|
193
|
+
let t = e;
|
|
194
|
+
for (let [e, n] of Object.entries(U)) t = t.replace(RegExp(`\\{\\{${e}\\}\\}`, "g"), n || `{{${e}}}`);
|
|
195
|
+
return t;
|
|
196
|
+
}, lt = i(() => v === "template" && X ? ct(X.bodyTemplate || "") : j, [
|
|
197
|
+
v,
|
|
198
|
+
X,
|
|
199
|
+
U,
|
|
200
|
+
j
|
|
201
|
+
]), ut = i(() => v === "template" && X?.subject ? ct(X.subject) : A, [
|
|
202
|
+
v,
|
|
203
|
+
X,
|
|
204
|
+
U,
|
|
205
|
+
A
|
|
206
|
+
]), dt = [
|
|
207
|
+
"EMAIL",
|
|
208
|
+
"SMS",
|
|
209
|
+
"WHATSAPP"
|
|
210
|
+
].includes(y), Q = i(() => F.filter((e) => e.label.trim() && e.url.trim()).map((e) => ({
|
|
211
|
+
id: e.id,
|
|
212
|
+
label: e.label.trim(),
|
|
213
|
+
url: e.url.trim(),
|
|
214
|
+
style: e.style
|
|
215
|
+
})), [F]), $ = i(() => N.filter((e) => e.url.trim()).map((e) => ({
|
|
216
|
+
url: e.url.trim(),
|
|
217
|
+
label: e.label.trim() || void 0,
|
|
218
|
+
kind: e.kind
|
|
219
|
+
})), [N]);
|
|
220
|
+
if (Te) return /* @__PURE__ */ d("div", {
|
|
221
|
+
className: "flex h-64 items-center justify-center",
|
|
222
|
+
children: /* @__PURE__ */ d("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
223
|
+
});
|
|
224
|
+
let ft = l(r.NOTIFICATION_CREATE), pt = l(r.NOTIFICATION_SEND);
|
|
225
|
+
if (!ft || !pt) return /* @__PURE__ */ d("div", {
|
|
226
|
+
className: "p-8 text-center text-text-secondary",
|
|
227
|
+
children: c("notifications.noPermissionCreateAndSend", "You don't have permission to create and send notifications.")
|
|
228
|
+
});
|
|
229
|
+
let mt = (e) => y === "EMAIL" ? {
|
|
230
|
+
userId: e.id,
|
|
231
|
+
email: e.email
|
|
232
|
+
} : y === "SMS" ? e.phoneNumber ? {
|
|
233
|
+
userId: e.id,
|
|
234
|
+
phoneNumber: e.phoneNumber
|
|
235
|
+
} : null : y === "WHATSAPP" ? e.phoneNumber ? {
|
|
236
|
+
userId: e.id,
|
|
237
|
+
whatsappNumber: e.phoneNumber
|
|
238
|
+
} : null : {
|
|
239
|
+
userId: e.id,
|
|
240
|
+
email: e.email
|
|
241
|
+
}, ht = async () => (D ? await Ie({
|
|
242
|
+
search: B,
|
|
243
|
+
role: O || void 0,
|
|
244
|
+
status: k || void 0
|
|
245
|
+
}) : T).map((e) => mt(e)).filter((e) => !!e), gt = () => S.map((e) => ({
|
|
246
|
+
email: e.email,
|
|
247
|
+
phoneNumber: e.phoneNumber,
|
|
248
|
+
pushToken: e.pushToken,
|
|
249
|
+
whatsappNumber: e.whatsappNumber,
|
|
250
|
+
slackUserId: e.slackUserId,
|
|
251
|
+
teamsUserId: e.teamsUserId,
|
|
252
|
+
webhookUrl: e.webhookUrl,
|
|
253
|
+
userId: e.userId
|
|
254
|
+
})), _t = () => {
|
|
255
|
+
if (q(null), C === "manual" && S.length === 0) return q(c("notifications.addRecipientRequired", "Please add at least one recipient")), !1;
|
|
256
|
+
if (C === "directory" && T.length === 0 && !D) return q(c("notifications.selectDirectoryUsersRequired", "Please select at least one user")), !1;
|
|
257
|
+
if (L && R.length === 0) return q(c("notifications.selectUsersRequired", "Please select users for in-app notifications")), !1;
|
|
258
|
+
if (b === "MARKETING" && !M) return q(c("notifications.selectTopicRequired", "Please choose a topic for promotional notifications")), !1;
|
|
259
|
+
if (v === "compose") {
|
|
260
|
+
if (!j.trim()) return q(c("notifications.bodyRequired", "Message body is required")), !1;
|
|
261
|
+
if (y === "EMAIL" && !A.trim()) return q(c("notifications.subjectRequired", "Subject is required for email notifications")), !1;
|
|
262
|
+
} else if (!H) return q(c("notifications.selectTemplateRequired", "Please select a template")), !1;
|
|
263
|
+
return !0;
|
|
264
|
+
}, vt = async () => {
|
|
265
|
+
if (_t()) {
|
|
266
|
+
Ne(), Pe(), Y(!1);
|
|
267
|
+
try {
|
|
268
|
+
let e = C === "directory" ? await ht() : gt();
|
|
269
|
+
if (e.length === 0) {
|
|
270
|
+
q(c("notifications.noDeliverableRecipients", "No valid recipients matched the selected channel and filters"));
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (v === "template") {
|
|
274
|
+
let t = await Ae({
|
|
275
|
+
templateSlug: H,
|
|
276
|
+
variables: U,
|
|
277
|
+
recipients: e,
|
|
278
|
+
platform: y,
|
|
279
|
+
priority: x,
|
|
280
|
+
topicId: M || void 0,
|
|
281
|
+
actions: Q,
|
|
282
|
+
media: $,
|
|
283
|
+
redirectUrl: Q[0]?.url,
|
|
284
|
+
...L && {
|
|
285
|
+
includeInApp: L,
|
|
286
|
+
userIds: R.map((e) => e.id)
|
|
287
|
+
},
|
|
288
|
+
...W && G && {
|
|
289
|
+
scheduledFor: new Date(G).toISOString(),
|
|
290
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
t && t.totalTriggered > 0 && Y(!0);
|
|
294
|
+
} else {
|
|
295
|
+
let t = e.map((e) => ({
|
|
296
|
+
body: j,
|
|
297
|
+
channel: y,
|
|
298
|
+
recipient: e,
|
|
299
|
+
subject: y === "EMAIL" ? A : void 0,
|
|
300
|
+
htmlBody: Ze && Ye ? Ye : void 0,
|
|
301
|
+
type: b,
|
|
302
|
+
priority: x,
|
|
303
|
+
topicId: M || void 0,
|
|
304
|
+
redirectUrl: Q[0]?.url,
|
|
305
|
+
actions: Q,
|
|
306
|
+
media: $
|
|
307
|
+
}));
|
|
308
|
+
if (W || t.length > 1) {
|
|
309
|
+
let e = await ke({
|
|
310
|
+
notifications: t,
|
|
311
|
+
...W && G && {
|
|
312
|
+
scheduledFor: new Date(G).toISOString(),
|
|
313
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
e && (e.successCount > 0 || e.totalRequested > 0) && Y(!0);
|
|
317
|
+
} else (await Oe({
|
|
318
|
+
notification: t[0],
|
|
319
|
+
platform: y,
|
|
320
|
+
...L && {
|
|
321
|
+
includeInApp: L,
|
|
322
|
+
userIds: R.map((e) => e.id)
|
|
323
|
+
}
|
|
324
|
+
}))?.status && Y(!0);
|
|
325
|
+
}
|
|
326
|
+
} catch (e) {
|
|
327
|
+
if (n(e)) {
|
|
328
|
+
Ne(), De(c("notifications.permissionDeniedOnSend", "You don't have permission to send that notification. Refreshing access…"), "warning"), Ee().catch((e) => console.warn("[permissions] refresh failed after send denial:", e));
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
console.error("Failed to send notification:", e);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}, yt = () => {
|
|
335
|
+
Ue([]), w("manual"), E([]), We(!1), Ge(""), Ke(""), qe(""), Je(""), Xe(""), $e(""), P([{
|
|
336
|
+
url: "",
|
|
337
|
+
label: "",
|
|
338
|
+
kind: "image"
|
|
339
|
+
}]), I([{
|
|
340
|
+
id: "primary-action",
|
|
341
|
+
label: "",
|
|
342
|
+
url: "",
|
|
343
|
+
style: "primary"
|
|
344
|
+
}]), tt(""), nt({}), et(!1), z([]), V(""), rt(!1), it(""), Y(!1), Ne(), Pe();
|
|
345
|
+
}, bt = ot || je;
|
|
346
|
+
return /* @__PURE__ */ f("div", {
|
|
347
|
+
className: "min-h-screen bg-bg-canvas",
|
|
348
|
+
children: [
|
|
349
|
+
/* @__PURE__ */ f("div", {
|
|
350
|
+
className: "sticky top-0 z-10 flex items-center justify-between px-6 py-4 bg-bg-surface border-b border-border-subtle",
|
|
351
|
+
children: [/* @__PURE__ */ f("div", {
|
|
352
|
+
className: "flex items-center gap-4",
|
|
353
|
+
children: [/* @__PURE__ */ d("button", {
|
|
354
|
+
onClick: () => fe("/notifications/center"),
|
|
355
|
+
className: "p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors",
|
|
356
|
+
children: /* @__PURE__ */ d(ae, { size: 20 })
|
|
357
|
+
}), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h1", {
|
|
358
|
+
className: "text-xl font-semibold text-text-primary",
|
|
359
|
+
children: c("notifications.sendTitle", "Send Notification")
|
|
360
|
+
}), /* @__PURE__ */ d("p", {
|
|
361
|
+
className: "text-sm text-text-secondary",
|
|
362
|
+
children: c("notifications.sendSubtitle", "Compose and send notifications to users")
|
|
363
|
+
})] })]
|
|
364
|
+
}), /* @__PURE__ */ f("div", {
|
|
365
|
+
className: "flex items-center gap-3",
|
|
366
|
+
children: [/* @__PURE__ */ f("button", {
|
|
367
|
+
onClick: () => at(!K),
|
|
368
|
+
className: `flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg transition-colors ${K ? "bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300" : "text-text-secondary hover:bg-bg-sunken"}`,
|
|
369
|
+
children: [d(K ? ce : se, { size: 16 }), c("notifications.preview", "Preview")]
|
|
370
|
+
}), /* @__PURE__ */ f("button", {
|
|
371
|
+
onClick: vt,
|
|
372
|
+
disabled: p || J,
|
|
373
|
+
className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-primary-600 hover:bg-primary-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
374
|
+
children: [p ? /* @__PURE__ */ d(s, {
|
|
375
|
+
size: 16,
|
|
376
|
+
className: "animate-spin"
|
|
377
|
+
}) : d(J ? o : pe, { size: 16 }), p ? c("notifications.sending", "Sending...") : J ? c("notifications.sent", "Sent!") : W ? c("notifications.schedule", "Schedule") : c("notifications.sendNotification", "Send Notification")]
|
|
378
|
+
})]
|
|
379
|
+
})]
|
|
380
|
+
}),
|
|
381
|
+
J && /* @__PURE__ */ f("div", {
|
|
382
|
+
className: "mx-6 mt-4 flex items-center justify-between p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg",
|
|
383
|
+
children: [/* @__PURE__ */ f("div", {
|
|
384
|
+
className: "flex items-center gap-3",
|
|
385
|
+
children: [/* @__PURE__ */ d(o, {
|
|
386
|
+
size: 20,
|
|
387
|
+
className: "text-status-success-text"
|
|
388
|
+
}), /* @__PURE__ */ f("p", {
|
|
389
|
+
className: "text-sm text-status-success-text",
|
|
390
|
+
children: [
|
|
391
|
+
c("notifications.sentSuccessfully", "Notification sent successfully to"),
|
|
392
|
+
" ",
|
|
393
|
+
S.length,
|
|
394
|
+
" ",
|
|
395
|
+
c("notifications.recipientCount", "recipient"),
|
|
396
|
+
S.length === 1 ? "" : "s",
|
|
397
|
+
"!"
|
|
398
|
+
]
|
|
399
|
+
})]
|
|
400
|
+
}), /* @__PURE__ */ d("button", {
|
|
401
|
+
onClick: yt,
|
|
402
|
+
className: "px-3 py-1.5 text-sm font-medium text-status-success-text hover:bg-status-success-bg-subtle rounded-lg transition-colors",
|
|
403
|
+
children: c("notifications.sendAnother", "Send Another")
|
|
404
|
+
})]
|
|
405
|
+
}),
|
|
406
|
+
bt && /* @__PURE__ */ f("div", {
|
|
407
|
+
className: "mx-6 mt-4 flex items-center gap-3 p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
|
|
408
|
+
children: [/* @__PURE__ */ d(ie, {
|
|
409
|
+
size: 20,
|
|
410
|
+
className: "text-status-error-text flex-shrink-0"
|
|
411
|
+
}), /* @__PURE__ */ d("p", {
|
|
412
|
+
className: "text-sm text-status-error-text",
|
|
413
|
+
children: bt
|
|
414
|
+
})]
|
|
415
|
+
}),
|
|
416
|
+
/* @__PURE__ */ f("div", {
|
|
417
|
+
className: "flex gap-6 p-6",
|
|
418
|
+
children: [/* @__PURE__ */ f("div", {
|
|
419
|
+
className: `flex-1 space-y-6 ${K ? "max-w-2xl" : ""}`,
|
|
420
|
+
children: [
|
|
421
|
+
/* @__PURE__ */ f("div", {
|
|
422
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
423
|
+
children: [/* @__PURE__ */ f("div", {
|
|
424
|
+
className: "flex items-center gap-2 mb-4",
|
|
425
|
+
children: [/* @__PURE__ */ d(le, {
|
|
426
|
+
size: 18,
|
|
427
|
+
className: "text-text-secondary"
|
|
428
|
+
}), /* @__PURE__ */ d("h2", {
|
|
429
|
+
className: "text-sm font-medium text-text-primary",
|
|
430
|
+
children: c("notifications.sendMode", "Send Mode")
|
|
431
|
+
})]
|
|
432
|
+
}), /* @__PURE__ */ f("div", {
|
|
433
|
+
className: "flex gap-2",
|
|
434
|
+
children: [/* @__PURE__ */ d("button", {
|
|
435
|
+
onClick: () => ze("compose"),
|
|
436
|
+
className: `flex-1 px-4 py-3 text-sm font-medium rounded-lg border transition-colors ${v === "compose" ? "bg-primary-50 dark:bg-primary-900/30 border-primary-500 text-primary-700 dark:text-primary-300" : "bg-bg-canvas border-border-subtle text-text-secondary hover:bg-bg-sunken"}`,
|
|
437
|
+
children: c("notifications.composeMessage", "Compose Message")
|
|
438
|
+
}), /* @__PURE__ */ d("button", {
|
|
439
|
+
onClick: () => ze("template"),
|
|
440
|
+
className: `flex-1 px-4 py-3 text-sm font-medium rounded-lg border transition-colors ${v === "template" ? "bg-primary-50 dark:bg-primary-900/30 border-primary-500 text-primary-700 dark:text-primary-300" : "bg-bg-canvas border-border-subtle text-text-secondary hover:bg-bg-sunken"}`,
|
|
441
|
+
children: c("notifications.useTemplate", "Use Template")
|
|
442
|
+
})]
|
|
443
|
+
})]
|
|
444
|
+
}),
|
|
445
|
+
/* @__PURE__ */ f("div", {
|
|
446
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ d("h2", {
|
|
449
|
+
className: "text-sm font-medium text-text-primary mb-4",
|
|
450
|
+
children: c("notifications.channel", "Channel")
|
|
451
|
+
}),
|
|
452
|
+
/* @__PURE__ */ d("div", {
|
|
453
|
+
className: "grid grid-cols-2 sm:grid-cols-4 gap-2",
|
|
454
|
+
children: be.map((e) => {
|
|
455
|
+
let t = e.icon;
|
|
456
|
+
return /* @__PURE__ */ f("button", {
|
|
457
|
+
onClick: () => {
|
|
458
|
+
Be(e.value), Ue([]), E([]), [
|
|
459
|
+
"EMAIL",
|
|
460
|
+
"SMS",
|
|
461
|
+
"WHATSAPP"
|
|
462
|
+
].includes(e.value) || (w("manual"), We(!1));
|
|
463
|
+
},
|
|
464
|
+
className: `flex flex-col items-center gap-2 p-3 rounded-lg border transition-colors ${y === e.value ? "bg-primary-50 dark:bg-primary-900/30 border-primary-500 text-primary-700 dark:text-primary-300" : "bg-bg-canvas border-border-subtle text-text-secondary hover:bg-bg-sunken"}`,
|
|
465
|
+
children: [/* @__PURE__ */ d(t, { size: 20 }), /* @__PURE__ */ d("span", {
|
|
466
|
+
className: "text-xs font-medium",
|
|
467
|
+
children: c(`notifications.channel.${e.value}`, e.label)
|
|
468
|
+
})]
|
|
469
|
+
}, e.value);
|
|
470
|
+
})
|
|
471
|
+
}),
|
|
472
|
+
/* @__PURE__ */ f("div", {
|
|
473
|
+
className: "mt-4 pt-4 border-t border-border-subtle",
|
|
474
|
+
children: [/* @__PURE__ */ f("label", {
|
|
475
|
+
className: "flex items-center gap-3 cursor-pointer",
|
|
476
|
+
children: [/* @__PURE__ */ d("input", {
|
|
477
|
+
type: "checkbox",
|
|
478
|
+
checked: L,
|
|
479
|
+
onChange: (e) => {
|
|
480
|
+
et(e.target.checked), e.target.checked || (z([]), V(""));
|
|
481
|
+
},
|
|
482
|
+
className: "w-4 h-4 rounded border-border-default text-primary-600 focus:ring-primary-500"
|
|
483
|
+
}), /* @__PURE__ */ f("div", {
|
|
484
|
+
className: "flex items-center gap-2",
|
|
485
|
+
children: [/* @__PURE__ */ d(oe, {
|
|
486
|
+
size: 16,
|
|
487
|
+
className: "text-primary-500"
|
|
488
|
+
}), /* @__PURE__ */ d("span", {
|
|
489
|
+
className: "text-sm font-medium text-text-primary",
|
|
490
|
+
children: c("notifications.alsoSendInApp", "Also send as In-App notification")
|
|
491
|
+
})]
|
|
492
|
+
})]
|
|
493
|
+
}), /* @__PURE__ */ d("p", {
|
|
494
|
+
className: "text-xs text-text-secondary ml-7 mt-1",
|
|
495
|
+
children: c("notifications.inAppDescription", "Show this notification in the app's notification center alongside the selected channel")
|
|
496
|
+
})]
|
|
497
|
+
})
|
|
498
|
+
]
|
|
499
|
+
}),
|
|
500
|
+
/* @__PURE__ */ f("div", {
|
|
501
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
502
|
+
children: [/* @__PURE__ */ f("label", {
|
|
503
|
+
className: "flex items-center gap-3 cursor-pointer",
|
|
504
|
+
children: [/* @__PURE__ */ d("input", {
|
|
505
|
+
type: "checkbox",
|
|
506
|
+
checked: W,
|
|
507
|
+
onChange: (e) => {
|
|
508
|
+
rt(e.target.checked), e.target.checked || it("");
|
|
509
|
+
},
|
|
510
|
+
className: "w-4 h-4 rounded border-border-default text-primary-600 focus:ring-primary-500"
|
|
511
|
+
}), /* @__PURE__ */ d("span", {
|
|
512
|
+
className: "text-sm font-medium text-text-primary",
|
|
513
|
+
children: c("notifications.scheduleForLater", "Schedule for later")
|
|
514
|
+
})]
|
|
515
|
+
}), W && /* @__PURE__ */ f("div", {
|
|
516
|
+
className: "mt-3 ml-7",
|
|
517
|
+
children: [/* @__PURE__ */ d("input", {
|
|
518
|
+
type: "datetime-local",
|
|
519
|
+
value: G,
|
|
520
|
+
min: (/* @__PURE__ */ new Date()).toISOString().slice(0, 16),
|
|
521
|
+
onChange: (e) => it(e.target.value),
|
|
522
|
+
className: "px-4 py-2 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"
|
|
523
|
+
}), /* @__PURE__ */ f("p", {
|
|
524
|
+
className: "text-xs text-text-tertiary mt-1",
|
|
525
|
+
children: [
|
|
526
|
+
c("notifications.timezone", "Timezone"),
|
|
527
|
+
":",
|
|
528
|
+
" ",
|
|
529
|
+
Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
530
|
+
]
|
|
531
|
+
})]
|
|
532
|
+
})]
|
|
533
|
+
}),
|
|
534
|
+
/* @__PURE__ */ f("div", {
|
|
535
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ f("label", {
|
|
538
|
+
className: "block text-sm font-medium text-text-primary mb-2",
|
|
539
|
+
children: [c("notifications.topic", "Topic"), b === "MARKETING" && /* @__PURE__ */ d("span", {
|
|
540
|
+
className: "text-status-error-text ml-1",
|
|
541
|
+
children: "*"
|
|
542
|
+
})]
|
|
543
|
+
}),
|
|
544
|
+
/* @__PURE__ */ f("select", {
|
|
545
|
+
value: M,
|
|
546
|
+
onChange: (e) => $e(e.target.value),
|
|
547
|
+
className: "w-full rounded-lg border border-border-subtle bg-bg-canvas px-4 py-3 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
548
|
+
children: [/* @__PURE__ */ d("option", {
|
|
549
|
+
value: "",
|
|
550
|
+
children: c("notifications.selectTopic", "Select a topic")
|
|
551
|
+
}), Re.map((e) => /* @__PURE__ */ f("option", {
|
|
552
|
+
value: e.id,
|
|
553
|
+
children: [
|
|
554
|
+
e.name,
|
|
555
|
+
" (",
|
|
556
|
+
e.type,
|
|
557
|
+
")"
|
|
558
|
+
]
|
|
559
|
+
}, e.id))]
|
|
560
|
+
}),
|
|
561
|
+
/* @__PURE__ */ d("p", {
|
|
562
|
+
className: "mt-2 text-xs text-text-secondary",
|
|
563
|
+
children: c("notifications.topicHelper", "Topics help users unsubscribe from promotional content they do not want.")
|
|
564
|
+
})
|
|
565
|
+
]
|
|
566
|
+
}),
|
|
567
|
+
/* @__PURE__ */ f("div", {
|
|
568
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
569
|
+
children: [
|
|
570
|
+
/* @__PURE__ */ f("div", {
|
|
571
|
+
className: "flex items-center gap-2 mb-4",
|
|
572
|
+
children: [/* @__PURE__ */ d(me, {
|
|
573
|
+
size: 18,
|
|
574
|
+
className: "text-text-secondary"
|
|
575
|
+
}), /* @__PURE__ */ f("h2", {
|
|
576
|
+
className: "text-sm font-medium text-text-primary",
|
|
577
|
+
children: [
|
|
578
|
+
c("notifications.recipients", "Recipients"),
|
|
579
|
+
" ",
|
|
580
|
+
/* @__PURE__ */ d("span", {
|
|
581
|
+
className: "text-status-error-text",
|
|
582
|
+
children: "*"
|
|
583
|
+
})
|
|
584
|
+
]
|
|
585
|
+
})]
|
|
586
|
+
}),
|
|
587
|
+
dt && /* @__PURE__ */ f("div", {
|
|
588
|
+
className: "mb-4 flex gap-2",
|
|
589
|
+
children: [/* @__PURE__ */ d("button", {
|
|
590
|
+
onClick: () => w("manual"),
|
|
591
|
+
className: `flex-1 rounded-lg border px-4 py-2 text-sm font-medium ${C === "manual" ? "border-primary-500 bg-primary-50 text-primary-700 dark:bg-primary-900/30 dark:text-primary-300" : "border-border-subtle bg-bg-canvas text-text-secondary hover:bg-bg-sunken"}`,
|
|
592
|
+
children: c("notifications.manualRecipients", "Manual recipients")
|
|
593
|
+
}), /* @__PURE__ */ d("button", {
|
|
594
|
+
onClick: () => w("directory"),
|
|
595
|
+
className: `flex-1 rounded-lg border px-4 py-2 text-sm font-medium ${C === "directory" ? "border-primary-500 bg-primary-50 text-primary-700 dark:bg-primary-900/30 dark:text-primary-300" : "border-border-subtle bg-bg-canvas text-text-secondary hover:bg-bg-sunken"}`,
|
|
596
|
+
children: c("notifications.userDirectory", "User directory")
|
|
597
|
+
})]
|
|
598
|
+
}),
|
|
599
|
+
C === "manual" || !dt ? /* @__PURE__ */ d(re, {
|
|
600
|
+
recipients: S,
|
|
601
|
+
onChange: Ue,
|
|
602
|
+
channel: y,
|
|
603
|
+
disabled: p || J
|
|
604
|
+
}) : /* @__PURE__ */ f("div", {
|
|
605
|
+
className: "space-y-4",
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ f("div", {
|
|
608
|
+
className: "grid gap-3 md:grid-cols-[minmax(0,1fr),180px,180px]",
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ f("div", {
|
|
611
|
+
className: "relative",
|
|
612
|
+
children: [/* @__PURE__ */ d("input", {
|
|
613
|
+
type: "text",
|
|
614
|
+
value: B,
|
|
615
|
+
onChange: (e) => {
|
|
616
|
+
V(e.target.value), h(e.target.value, {
|
|
617
|
+
role: O || void 0,
|
|
618
|
+
status: k || void 0
|
|
619
|
+
});
|
|
620
|
+
},
|
|
621
|
+
placeholder: c("notifications.searchUsersPlaceholder", "Search users by email or name..."),
|
|
622
|
+
className: "w-full px-4 py-3 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"
|
|
623
|
+
}), Le && /* @__PURE__ */ d("div", {
|
|
624
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2",
|
|
625
|
+
children: /* @__PURE__ */ d(s, {
|
|
626
|
+
size: 16,
|
|
627
|
+
className: "animate-spin text-text-tertiary"
|
|
628
|
+
})
|
|
629
|
+
})]
|
|
630
|
+
}),
|
|
631
|
+
/* @__PURE__ */ d("select", {
|
|
632
|
+
value: O,
|
|
633
|
+
onChange: (e) => {
|
|
634
|
+
Ge(e.target.value), h(B, {
|
|
635
|
+
role: e.target.value || void 0,
|
|
636
|
+
status: k || void 0
|
|
637
|
+
});
|
|
638
|
+
},
|
|
639
|
+
className: "rounded-lg border border-border-subtle bg-bg-canvas px-4 py-3 text-sm text-text-primary",
|
|
640
|
+
children: Ce.map((e) => /* @__PURE__ */ d("option", {
|
|
641
|
+
value: e.value,
|
|
642
|
+
children: e.label
|
|
643
|
+
}, e.value))
|
|
644
|
+
}),
|
|
645
|
+
/* @__PURE__ */ d("select", {
|
|
646
|
+
value: k,
|
|
647
|
+
onChange: (e) => {
|
|
648
|
+
Ke(e.target.value), h(B, {
|
|
649
|
+
role: O || void 0,
|
|
650
|
+
status: e.target.value || void 0
|
|
651
|
+
});
|
|
652
|
+
},
|
|
653
|
+
className: "rounded-lg border border-border-subtle bg-bg-canvas px-4 py-3 text-sm text-text-primary",
|
|
654
|
+
children: we.map((e) => /* @__PURE__ */ d("option", {
|
|
655
|
+
value: e.value,
|
|
656
|
+
children: e.label
|
|
657
|
+
}, e.value))
|
|
658
|
+
})
|
|
659
|
+
]
|
|
660
|
+
}),
|
|
661
|
+
/* @__PURE__ */ f("label", {
|
|
662
|
+
className: "flex items-center gap-3 text-sm text-text-secondary",
|
|
663
|
+
children: [/* @__PURE__ */ d("input", {
|
|
664
|
+
type: "checkbox",
|
|
665
|
+
checked: D,
|
|
666
|
+
onChange: (e) => We(e.target.checked),
|
|
667
|
+
className: "h-4 w-4 rounded border-border-default text-primary-600 focus:ring-primary-500"
|
|
668
|
+
}), /* @__PURE__ */ d("span", { children: c("notifications.sendToAllMatchingUsers", "Send to all users matching the current search and filters") })]
|
|
669
|
+
}),
|
|
670
|
+
B && /* @__PURE__ */ d("div", {
|
|
671
|
+
className: "max-h-56 overflow-y-auto rounded-lg border border-border-subtle",
|
|
672
|
+
children: g.length > 0 ? g.map((e) => {
|
|
673
|
+
let t = T.some((t) => t.id === e.id), n = y === "EMAIL" ? !!e.email : y === "SMS" || y === "WHATSAPP" ? !!e.phoneNumber : !0;
|
|
674
|
+
return /* @__PURE__ */ f("button", {
|
|
675
|
+
type: "button",
|
|
676
|
+
disabled: !n,
|
|
677
|
+
onClick: () => {
|
|
678
|
+
E(t ? (t) => t.filter((t) => t.id !== e.id) : (t) => [...t, e]);
|
|
679
|
+
},
|
|
680
|
+
className: `flex w-full items-center gap-3 p-3 text-left transition-colors ${t ? "bg-primary-50 dark:bg-primary-900/30" : "hover:bg-bg-canvas"} ${n ? "" : "cursor-not-allowed opacity-50"}`,
|
|
681
|
+
children: [
|
|
682
|
+
/* @__PURE__ */ d(u, {
|
|
683
|
+
size: 16,
|
|
684
|
+
className: t ? "text-primary-500" : "text-text-tertiary"
|
|
685
|
+
}),
|
|
686
|
+
/* @__PURE__ */ f("div", {
|
|
687
|
+
className: "flex-1",
|
|
688
|
+
children: [
|
|
689
|
+
/* @__PURE__ */ d("div", {
|
|
690
|
+
className: "text-sm font-medium text-text-primary",
|
|
691
|
+
children: e.name
|
|
692
|
+
}),
|
|
693
|
+
/* @__PURE__ */ d("div", {
|
|
694
|
+
className: "text-xs text-text-secondary",
|
|
695
|
+
children: e.email
|
|
696
|
+
}),
|
|
697
|
+
e.phoneNumber && /* @__PURE__ */ d("div", {
|
|
698
|
+
className: "text-xs text-text-tertiary",
|
|
699
|
+
children: e.phoneNumber
|
|
700
|
+
})
|
|
701
|
+
]
|
|
702
|
+
}),
|
|
703
|
+
!n && /* @__PURE__ */ d("span", {
|
|
704
|
+
className: "text-xs text-status-error-text",
|
|
705
|
+
children: c("notifications.missingChannelTarget", "Missing channel target")
|
|
706
|
+
}),
|
|
707
|
+
t && /* @__PURE__ */ d(o, {
|
|
708
|
+
size: 16,
|
|
709
|
+
className: "text-primary-500"
|
|
710
|
+
})
|
|
711
|
+
]
|
|
712
|
+
}, e.id);
|
|
713
|
+
}) : /* @__PURE__ */ d("div", {
|
|
714
|
+
className: "p-4 text-center text-sm text-text-secondary",
|
|
715
|
+
children: _ ? `${c("notifications.error", "Error")}: ${_}` : c("notifications.noUsersFound", "No users found")
|
|
716
|
+
})
|
|
717
|
+
}),
|
|
718
|
+
T.length > 0 && /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("h3", {
|
|
719
|
+
className: "mb-2 text-sm font-medium text-text-secondary",
|
|
720
|
+
children: [
|
|
721
|
+
c("notifications.selectedUsers", "Selected Users"),
|
|
722
|
+
" (",
|
|
723
|
+
T.length,
|
|
724
|
+
")"
|
|
725
|
+
]
|
|
726
|
+
}), /* @__PURE__ */ d("div", {
|
|
727
|
+
className: "flex flex-wrap gap-2",
|
|
728
|
+
children: T.map((e) => /* @__PURE__ */ f("div", {
|
|
729
|
+
className: "flex items-center gap-2 rounded-full border border-primary-200 bg-primary-50 px-3 py-1.5 text-sm dark:border-primary-800 dark:bg-primary-900/30",
|
|
730
|
+
children: [
|
|
731
|
+
/* @__PURE__ */ d(u, {
|
|
732
|
+
size: 12,
|
|
733
|
+
className: "text-primary-500"
|
|
734
|
+
}),
|
|
735
|
+
/* @__PURE__ */ d("span", {
|
|
736
|
+
className: "text-primary-700 dark:text-primary-300",
|
|
737
|
+
children: e.name
|
|
738
|
+
}),
|
|
739
|
+
/* @__PURE__ */ d("button", {
|
|
740
|
+
type: "button",
|
|
741
|
+
onClick: () => E((t) => t.filter((t) => t.id !== e.id)),
|
|
742
|
+
className: "rounded-full p-0.5 hover:bg-primary-100 dark:hover:bg-primary-800",
|
|
743
|
+
children: /* @__PURE__ */ d(he, {
|
|
744
|
+
size: 12,
|
|
745
|
+
className: "text-primary-500"
|
|
746
|
+
})
|
|
747
|
+
})
|
|
748
|
+
]
|
|
749
|
+
}, e.id))
|
|
750
|
+
})] })
|
|
751
|
+
]
|
|
752
|
+
})
|
|
753
|
+
]
|
|
754
|
+
}),
|
|
755
|
+
L && /* @__PURE__ */ f("div", {
|
|
756
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
757
|
+
children: [
|
|
758
|
+
/* @__PURE__ */ f("div", {
|
|
759
|
+
className: "flex items-center gap-2 mb-4",
|
|
760
|
+
children: [/* @__PURE__ */ d(oe, {
|
|
761
|
+
size: 18,
|
|
762
|
+
className: "text-primary-500"
|
|
763
|
+
}), /* @__PURE__ */ f("h2", {
|
|
764
|
+
className: "text-sm font-medium text-text-primary",
|
|
765
|
+
children: [
|
|
766
|
+
c("notifications.inAppUsers", "In-App Notification Users"),
|
|
767
|
+
" ",
|
|
768
|
+
/* @__PURE__ */ d("span", {
|
|
769
|
+
className: "text-status-error-text",
|
|
770
|
+
children: "*"
|
|
771
|
+
})
|
|
772
|
+
]
|
|
773
|
+
})]
|
|
774
|
+
}),
|
|
775
|
+
/* @__PURE__ */ f("div", {
|
|
776
|
+
className: "relative mb-4",
|
|
777
|
+
children: [/* @__PURE__ */ d("input", {
|
|
778
|
+
type: "text",
|
|
779
|
+
value: B,
|
|
780
|
+
onChange: (e) => {
|
|
781
|
+
V(e.target.value), h(e.target.value, {
|
|
782
|
+
role: O || void 0,
|
|
783
|
+
status: k || void 0
|
|
784
|
+
});
|
|
785
|
+
},
|
|
786
|
+
placeholder: c("notifications.searchUsersPlaceholder", "Search users by email or name..."),
|
|
787
|
+
className: "w-full px-4 py-3 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"
|
|
788
|
+
}), Le && /* @__PURE__ */ d("div", {
|
|
789
|
+
className: "absolute right-3 top-1/2 transform -translate-y-1/2",
|
|
790
|
+
children: /* @__PURE__ */ d(s, {
|
|
791
|
+
size: 16,
|
|
792
|
+
className: "animate-spin text-text-tertiary"
|
|
793
|
+
})
|
|
794
|
+
})]
|
|
795
|
+
}),
|
|
796
|
+
B && /* @__PURE__ */ d("div", {
|
|
797
|
+
className: "mb-4",
|
|
798
|
+
children: g.length > 0 ? /* @__PURE__ */ d("div", {
|
|
799
|
+
className: "max-h-48 overflow-y-auto border border-border-subtle rounded-lg",
|
|
800
|
+
children: g.map((e) => {
|
|
801
|
+
let t = R.some((t) => t.id === e.id);
|
|
802
|
+
return /* @__PURE__ */ f("button", {
|
|
803
|
+
type: "button",
|
|
804
|
+
onClick: () => {
|
|
805
|
+
z(t ? (t) => t.filter((t) => t.id !== e.id) : (t) => [...t, e]);
|
|
806
|
+
},
|
|
807
|
+
className: `w-full flex items-center gap-3 p-3 text-left hover:bg-bg-canvas transition-colors ${t ? "bg-primary-50 dark:bg-primary-900/30" : ""}`,
|
|
808
|
+
children: [
|
|
809
|
+
/* @__PURE__ */ d(u, {
|
|
810
|
+
size: 16,
|
|
811
|
+
className: t ? "text-primary-500" : "text-text-tertiary"
|
|
812
|
+
}),
|
|
813
|
+
/* @__PURE__ */ f("div", {
|
|
814
|
+
className: "flex-1",
|
|
815
|
+
children: [/* @__PURE__ */ d("div", {
|
|
816
|
+
className: "text-sm font-medium text-text-primary",
|
|
817
|
+
children: e.name
|
|
818
|
+
}), /* @__PURE__ */ d("div", {
|
|
819
|
+
className: "text-xs text-text-secondary",
|
|
820
|
+
children: e.email
|
|
821
|
+
})]
|
|
822
|
+
}),
|
|
823
|
+
t && /* @__PURE__ */ d(o, {
|
|
824
|
+
size: 16,
|
|
825
|
+
className: "text-primary-500"
|
|
826
|
+
})
|
|
827
|
+
]
|
|
828
|
+
}, e.id);
|
|
829
|
+
})
|
|
830
|
+
}) : /* @__PURE__ */ d("div", {
|
|
831
|
+
className: "text-center py-4 text-sm text-text-secondary",
|
|
832
|
+
children: _ ? `${c("notifications.error", "Error")}: ${_}` : c("notifications.noUsersFound", "No users found")
|
|
833
|
+
})
|
|
834
|
+
}),
|
|
835
|
+
R.length > 0 && /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ f("h3", {
|
|
836
|
+
className: "text-sm font-medium text-text-secondary mb-2",
|
|
837
|
+
children: [
|
|
838
|
+
c("notifications.selectedUsers", "Selected Users"),
|
|
839
|
+
" (",
|
|
840
|
+
R.length,
|
|
841
|
+
")"
|
|
842
|
+
]
|
|
843
|
+
}), /* @__PURE__ */ d("div", {
|
|
844
|
+
className: "flex flex-wrap gap-2",
|
|
845
|
+
children: R.map((e) => /* @__PURE__ */ f("div", {
|
|
846
|
+
className: "flex items-center gap-2 px-3 py-1.5 bg-primary-50 dark:bg-primary-900/30 border border-primary-200 dark:border-primary-800 rounded-full text-sm",
|
|
847
|
+
children: [
|
|
848
|
+
/* @__PURE__ */ d(u, {
|
|
849
|
+
size: 12,
|
|
850
|
+
className: "text-primary-500"
|
|
851
|
+
}),
|
|
852
|
+
/* @__PURE__ */ d("span", {
|
|
853
|
+
className: "text-primary-700 dark:text-primary-300",
|
|
854
|
+
children: e.name
|
|
855
|
+
}),
|
|
856
|
+
/* @__PURE__ */ d("button", {
|
|
857
|
+
type: "button",
|
|
858
|
+
onClick: () => z((t) => t.filter((t) => t.id !== e.id)),
|
|
859
|
+
className: "p-0.5 hover:bg-primary-100 dark:hover:bg-primary-800 rounded-full transition-colors",
|
|
860
|
+
children: /* @__PURE__ */ d(he, {
|
|
861
|
+
size: 12,
|
|
862
|
+
className: "text-primary-500"
|
|
863
|
+
})
|
|
864
|
+
})
|
|
865
|
+
]
|
|
866
|
+
}, e.id))
|
|
867
|
+
})] })
|
|
868
|
+
]
|
|
869
|
+
}),
|
|
870
|
+
v === "template" && /* @__PURE__ */ f("div", {
|
|
871
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
872
|
+
children: [
|
|
873
|
+
/* @__PURE__ */ f("h2", {
|
|
874
|
+
className: "text-sm font-medium text-text-primary mb-4",
|
|
875
|
+
children: [
|
|
876
|
+
c("notifications.selectTemplate", "Select Template"),
|
|
877
|
+
" ",
|
|
878
|
+
/* @__PURE__ */ d("span", {
|
|
879
|
+
className: "text-status-error-text",
|
|
880
|
+
children: "*"
|
|
881
|
+
})
|
|
882
|
+
]
|
|
883
|
+
}),
|
|
884
|
+
Fe ? /* @__PURE__ */ d("div", {
|
|
885
|
+
className: "flex items-center justify-center py-8",
|
|
886
|
+
children: /* @__PURE__ */ d(s, {
|
|
887
|
+
size: 24,
|
|
888
|
+
className: "animate-spin text-text-tertiary"
|
|
889
|
+
})
|
|
890
|
+
}) : m.length === 0 ? /* @__PURE__ */ f("div", {
|
|
891
|
+
className: "text-center py-8",
|
|
892
|
+
children: [
|
|
893
|
+
/* @__PURE__ */ d(le, {
|
|
894
|
+
size: 32,
|
|
895
|
+
className: "mx-auto text-text-tertiary mb-2"
|
|
896
|
+
}),
|
|
897
|
+
/* @__PURE__ */ d("p", {
|
|
898
|
+
className: "text-sm text-text-secondary",
|
|
899
|
+
children: c("notifications.noTemplatesAvailable", "No templates available")
|
|
900
|
+
}),
|
|
901
|
+
/* @__PURE__ */ d("button", {
|
|
902
|
+
onClick: () => fe("/notifications/templates/new"),
|
|
903
|
+
className: "mt-2 text-sm text-primary-600 hover:text-primary-700",
|
|
904
|
+
children: c("notifications.createATemplate", "Create a template")
|
|
905
|
+
})
|
|
906
|
+
]
|
|
907
|
+
}) : /* @__PURE__ */ f("select", {
|
|
908
|
+
value: H,
|
|
909
|
+
onChange: (e) => {
|
|
910
|
+
tt(e.target.value), nt({});
|
|
911
|
+
},
|
|
912
|
+
className: "w-full px-4 py-3 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
913
|
+
children: [/* @__PURE__ */ d("option", {
|
|
914
|
+
value: "",
|
|
915
|
+
children: c("notifications.selectATemplate", "Select a template...")
|
|
916
|
+
}), m.filter((e) => e.enabled).map((e) => /* @__PURE__ */ f("option", {
|
|
917
|
+
value: e.slug,
|
|
918
|
+
children: [
|
|
919
|
+
e.name,
|
|
920
|
+
" (",
|
|
921
|
+
c(`notifications.type.${e.type}`, e.type),
|
|
922
|
+
")"
|
|
923
|
+
]
|
|
924
|
+
}, e.id))]
|
|
925
|
+
}),
|
|
926
|
+
X && st.length > 0 && /* @__PURE__ */ f("div", {
|
|
927
|
+
className: "mt-4 space-y-3",
|
|
928
|
+
children: [/* @__PURE__ */ d("h3", {
|
|
929
|
+
className: "text-sm font-medium text-text-secondary",
|
|
930
|
+
children: c("notifications.templateVariables", "Template Variables")
|
|
931
|
+
}), st.map((e) => /* @__PURE__ */ f("div", { children: [
|
|
932
|
+
/* @__PURE__ */ f("label", {
|
|
933
|
+
className: "block text-xs text-text-secondary mb-1",
|
|
934
|
+
children: [
|
|
935
|
+
e.key,
|
|
936
|
+
e.required && /* @__PURE__ */ d("span", {
|
|
937
|
+
className: "text-status-error-text ml-0.5",
|
|
938
|
+
children: "*"
|
|
939
|
+
}),
|
|
940
|
+
/* @__PURE__ */ f("span", {
|
|
941
|
+
className: "text-text-tertiary ml-1",
|
|
942
|
+
children: [
|
|
943
|
+
"(",
|
|
944
|
+
e.type,
|
|
945
|
+
")"
|
|
946
|
+
]
|
|
947
|
+
})
|
|
948
|
+
]
|
|
949
|
+
}),
|
|
950
|
+
e.description && /* @__PURE__ */ d("p", {
|
|
951
|
+
className: "text-xs text-text-tertiary mb-1",
|
|
952
|
+
children: e.description
|
|
953
|
+
}),
|
|
954
|
+
/* @__PURE__ */ d("input", {
|
|
955
|
+
type: "text",
|
|
956
|
+
value: U[e.key] || "",
|
|
957
|
+
onChange: (t) => nt((n) => ({
|
|
958
|
+
...n,
|
|
959
|
+
[e.key]: t.target.value
|
|
960
|
+
})),
|
|
961
|
+
placeholder: e.defaultValue || `${c("notifications.enterVariablePrefix", "Enter")} ${e.key}...`,
|
|
962
|
+
className: "w-full px-3 py-2 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"
|
|
963
|
+
})
|
|
964
|
+
] }, e.key))]
|
|
965
|
+
})
|
|
966
|
+
]
|
|
967
|
+
}),
|
|
968
|
+
v === "compose" && /* @__PURE__ */ f(ye, { children: [
|
|
969
|
+
/* @__PURE__ */ d("div", {
|
|
970
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
971
|
+
children: /* @__PURE__ */ f("div", {
|
|
972
|
+
className: "grid grid-cols-2 gap-4",
|
|
973
|
+
children: [/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
|
|
974
|
+
className: "block text-sm font-medium text-text-primary mb-2",
|
|
975
|
+
children: c("notifications.typeLabel", "Type")
|
|
976
|
+
}), /* @__PURE__ */ d("select", {
|
|
977
|
+
value: b,
|
|
978
|
+
onChange: (e) => Ve(e.target.value),
|
|
979
|
+
className: "w-full px-4 py-3 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
980
|
+
children: xe.map((e) => /* @__PURE__ */ d("option", {
|
|
981
|
+
value: e.value,
|
|
982
|
+
children: c(`notifications.type.${e.value}`, e.label)
|
|
983
|
+
}, e.value))
|
|
984
|
+
})] }), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("label", {
|
|
985
|
+
className: "block text-sm font-medium text-text-primary mb-2",
|
|
986
|
+
children: c("notifications.priorityLabel", "Priority")
|
|
987
|
+
}), /* @__PURE__ */ d("select", {
|
|
988
|
+
value: x,
|
|
989
|
+
onChange: (e) => He(e.target.value),
|
|
990
|
+
className: "w-full px-4 py-3 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
|
991
|
+
children: Se.map((e) => /* @__PURE__ */ d("option", {
|
|
992
|
+
value: e.value,
|
|
993
|
+
children: c(`notifications.priority.${e.value}`, e.label)
|
|
994
|
+
}, e.value))
|
|
995
|
+
})] })]
|
|
996
|
+
})
|
|
997
|
+
}),
|
|
998
|
+
y === "EMAIL" && /* @__PURE__ */ f("div", {
|
|
999
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
1000
|
+
children: [/* @__PURE__ */ f("label", {
|
|
1001
|
+
className: "block text-sm font-medium text-text-primary mb-2",
|
|
1002
|
+
children: [
|
|
1003
|
+
c("notifications.subjectLabel", "Subject"),
|
|
1004
|
+
" ",
|
|
1005
|
+
/* @__PURE__ */ d("span", {
|
|
1006
|
+
className: "text-status-error-text",
|
|
1007
|
+
children: "*"
|
|
1008
|
+
})
|
|
1009
|
+
]
|
|
1010
|
+
}), /* @__PURE__ */ d("input", {
|
|
1011
|
+
type: "text",
|
|
1012
|
+
value: A,
|
|
1013
|
+
onChange: (e) => qe(e.target.value),
|
|
1014
|
+
placeholder: c("notifications.enterSubjectPlaceholder", "Enter email subject..."),
|
|
1015
|
+
className: "w-full px-4 py-3 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"
|
|
1016
|
+
})]
|
|
1017
|
+
}),
|
|
1018
|
+
/* @__PURE__ */ f("div", {
|
|
1019
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
1020
|
+
children: [
|
|
1021
|
+
/* @__PURE__ */ f("div", {
|
|
1022
|
+
className: "flex items-center justify-between mb-2",
|
|
1023
|
+
children: [/* @__PURE__ */ f("label", {
|
|
1024
|
+
className: "block text-sm font-medium text-text-primary",
|
|
1025
|
+
children: [
|
|
1026
|
+
c("notifications.messageLabel", "Message"),
|
|
1027
|
+
" ",
|
|
1028
|
+
/* @__PURE__ */ d("span", {
|
|
1029
|
+
className: "text-status-error-text",
|
|
1030
|
+
children: "*"
|
|
1031
|
+
})
|
|
1032
|
+
]
|
|
1033
|
+
}), y === "EMAIL" && /* @__PURE__ */ f("label", {
|
|
1034
|
+
className: "flex items-center gap-2 text-sm text-text-secondary cursor-pointer",
|
|
1035
|
+
children: [/* @__PURE__ */ d("input", {
|
|
1036
|
+
type: "checkbox",
|
|
1037
|
+
checked: Ze,
|
|
1038
|
+
onChange: (e) => Qe(e.target.checked),
|
|
1039
|
+
className: "w-4 h-4 rounded border-border-default text-primary-600 focus:ring-primary-500"
|
|
1040
|
+
}), c("notifications.includeHtmlVersion", "Include HTML version")]
|
|
1041
|
+
})]
|
|
1042
|
+
}),
|
|
1043
|
+
/* @__PURE__ */ d("textarea", {
|
|
1044
|
+
rows: 6,
|
|
1045
|
+
value: j,
|
|
1046
|
+
onChange: (e) => Je(e.target.value),
|
|
1047
|
+
placeholder: c("notifications.enterMessagePlaceholder", "Enter your message..."),
|
|
1048
|
+
className: "w-full px-4 py-3 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 resize-none"
|
|
1049
|
+
}),
|
|
1050
|
+
y === "EMAIL" && Ze && /* @__PURE__ */ f("div", {
|
|
1051
|
+
className: "mt-4",
|
|
1052
|
+
children: [/* @__PURE__ */ d("label", {
|
|
1053
|
+
className: "block text-sm font-medium text-text-secondary mb-2",
|
|
1054
|
+
children: c("notifications.htmlContent", "HTML Content")
|
|
1055
|
+
}), /* @__PURE__ */ d("textarea", {
|
|
1056
|
+
rows: 8,
|
|
1057
|
+
value: Ye,
|
|
1058
|
+
onChange: (e) => Xe(e.target.value),
|
|
1059
|
+
placeholder: c("notifications.htmlPlaceholder", "<html>...</html>"),
|
|
1060
|
+
className: "w-full px-4 py-3 text-sm bg-bg-canvas border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 resize-none font-mono"
|
|
1061
|
+
})]
|
|
1062
|
+
})
|
|
1063
|
+
]
|
|
1064
|
+
})
|
|
1065
|
+
] }),
|
|
1066
|
+
/* @__PURE__ */ f("div", {
|
|
1067
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
1068
|
+
children: [/* @__PURE__ */ f("div", {
|
|
1069
|
+
className: "mb-4 flex items-center gap-2",
|
|
1070
|
+
children: [/* @__PURE__ */ d(de, {
|
|
1071
|
+
size: 18,
|
|
1072
|
+
className: "text-text-secondary"
|
|
1073
|
+
}), /* @__PURE__ */ d("h2", {
|
|
1074
|
+
className: "text-sm font-medium text-text-primary",
|
|
1075
|
+
children: c("notifications.actions", "Actions")
|
|
1076
|
+
})]
|
|
1077
|
+
}), /* @__PURE__ */ f("div", {
|
|
1078
|
+
className: "space-y-3",
|
|
1079
|
+
children: [F.map((e, t) => /* @__PURE__ */ f("div", {
|
|
1080
|
+
className: "grid gap-3 rounded-lg border border-border-subtle bg-bg-canvas p-3 md:grid-cols-[1fr,1fr,160px,auto]",
|
|
1081
|
+
children: [
|
|
1082
|
+
/* @__PURE__ */ d("input", {
|
|
1083
|
+
type: "text",
|
|
1084
|
+
value: e.label,
|
|
1085
|
+
onChange: (e) => I((n) => n.map((n, r) => r === t ? {
|
|
1086
|
+
...n,
|
|
1087
|
+
label: e.target.value
|
|
1088
|
+
} : n)),
|
|
1089
|
+
placeholder: c("notifications.actionLabel", "Action label"),
|
|
1090
|
+
className: "rounded-md border border-border-subtle bg-surface px-3 py-2 text-sm text-text-primary"
|
|
1091
|
+
}),
|
|
1092
|
+
/* @__PURE__ */ d("input", {
|
|
1093
|
+
type: "url",
|
|
1094
|
+
value: e.url,
|
|
1095
|
+
onChange: (e) => I((n) => n.map((n, r) => r === t ? {
|
|
1096
|
+
...n,
|
|
1097
|
+
url: e.target.value
|
|
1098
|
+
} : n)),
|
|
1099
|
+
placeholder: c("notifications.actionUrl", "https://..."),
|
|
1100
|
+
className: "rounded-md border border-border-subtle bg-surface px-3 py-2 text-sm text-text-primary"
|
|
1101
|
+
}),
|
|
1102
|
+
/* @__PURE__ */ f("select", {
|
|
1103
|
+
value: e.style,
|
|
1104
|
+
onChange: (e) => I((n) => n.map((n, r) => r === t ? {
|
|
1105
|
+
...n,
|
|
1106
|
+
style: e.target.value
|
|
1107
|
+
} : n)),
|
|
1108
|
+
className: "rounded-md border border-border-subtle bg-surface px-3 py-2 text-sm text-text-primary",
|
|
1109
|
+
children: [
|
|
1110
|
+
/* @__PURE__ */ d("option", {
|
|
1111
|
+
value: "primary",
|
|
1112
|
+
children: "Primary"
|
|
1113
|
+
}),
|
|
1114
|
+
/* @__PURE__ */ d("option", {
|
|
1115
|
+
value: "secondary",
|
|
1116
|
+
children: "Secondary"
|
|
1117
|
+
}),
|
|
1118
|
+
/* @__PURE__ */ d("option", {
|
|
1119
|
+
value: "danger",
|
|
1120
|
+
children: "Danger"
|
|
1121
|
+
})
|
|
1122
|
+
]
|
|
1123
|
+
}),
|
|
1124
|
+
/* @__PURE__ */ d("button", {
|
|
1125
|
+
type: "button",
|
|
1126
|
+
onClick: () => I((e) => e.length === 1 ? [{
|
|
1127
|
+
id: "primary-action",
|
|
1128
|
+
label: "",
|
|
1129
|
+
url: "",
|
|
1130
|
+
style: "primary"
|
|
1131
|
+
}] : e.filter((e, n) => n !== t)),
|
|
1132
|
+
className: "rounded-md border border-border-subtle px-3 py-2 text-sm text-text-secondary hover:bg-bg-sunken",
|
|
1133
|
+
children: c("notifications.remove", "Remove")
|
|
1134
|
+
})
|
|
1135
|
+
]
|
|
1136
|
+
}, e.id)), /* @__PURE__ */ d("button", {
|
|
1137
|
+
type: "button",
|
|
1138
|
+
onClick: () => I((e) => [...e, {
|
|
1139
|
+
id: `action-${e.length + 1}`,
|
|
1140
|
+
label: "",
|
|
1141
|
+
url: "",
|
|
1142
|
+
style: "secondary"
|
|
1143
|
+
}]),
|
|
1144
|
+
className: "rounded-md border border-border-subtle px-3 py-2 text-sm text-text-secondary hover:bg-bg-sunken",
|
|
1145
|
+
children: c("notifications.addAction", "Add action")
|
|
1146
|
+
})]
|
|
1147
|
+
})]
|
|
1148
|
+
}),
|
|
1149
|
+
/* @__PURE__ */ f("div", {
|
|
1150
|
+
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
1151
|
+
children: [/* @__PURE__ */ f("div", {
|
|
1152
|
+
className: "mb-4 flex items-center gap-2",
|
|
1153
|
+
children: [/* @__PURE__ */ d(ue, {
|
|
1154
|
+
size: 18,
|
|
1155
|
+
className: "text-text-secondary"
|
|
1156
|
+
}), /* @__PURE__ */ d("h2", {
|
|
1157
|
+
className: "text-sm font-medium text-text-primary",
|
|
1158
|
+
children: c("notifications.media", "Media")
|
|
1159
|
+
})]
|
|
1160
|
+
}), /* @__PURE__ */ f("div", {
|
|
1161
|
+
className: "space-y-3",
|
|
1162
|
+
children: [N.map((e, t) => /* @__PURE__ */ f("div", {
|
|
1163
|
+
className: "grid gap-3 rounded-lg border border-border-subtle bg-bg-canvas p-3 md:grid-cols-[1fr,220px,140px,auto]",
|
|
1164
|
+
children: [
|
|
1165
|
+
/* @__PURE__ */ d("input", {
|
|
1166
|
+
type: "url",
|
|
1167
|
+
value: e.url,
|
|
1168
|
+
onChange: (e) => P((n) => n.map((n, r) => r === t ? {
|
|
1169
|
+
...n,
|
|
1170
|
+
url: e.target.value
|
|
1171
|
+
} : n)),
|
|
1172
|
+
placeholder: c("notifications.mediaUrl", "Media URL"),
|
|
1173
|
+
className: "rounded-md border border-border-subtle bg-surface px-3 py-2 text-sm text-text-primary"
|
|
1174
|
+
}),
|
|
1175
|
+
/* @__PURE__ */ d("input", {
|
|
1176
|
+
type: "text",
|
|
1177
|
+
value: e.label,
|
|
1178
|
+
onChange: (e) => P((n) => n.map((n, r) => r === t ? {
|
|
1179
|
+
...n,
|
|
1180
|
+
label: e.target.value
|
|
1181
|
+
} : n)),
|
|
1182
|
+
placeholder: c("notifications.mediaLabel", "Caption / label"),
|
|
1183
|
+
className: "rounded-md border border-border-subtle bg-surface px-3 py-2 text-sm text-text-primary"
|
|
1184
|
+
}),
|
|
1185
|
+
/* @__PURE__ */ f("select", {
|
|
1186
|
+
value: e.kind,
|
|
1187
|
+
onChange: (e) => P((n) => n.map((n, r) => r === t ? {
|
|
1188
|
+
...n,
|
|
1189
|
+
kind: e.target.value
|
|
1190
|
+
} : n)),
|
|
1191
|
+
className: "rounded-md border border-border-subtle bg-surface px-3 py-2 text-sm text-text-primary",
|
|
1192
|
+
children: [
|
|
1193
|
+
/* @__PURE__ */ d("option", {
|
|
1194
|
+
value: "image",
|
|
1195
|
+
children: "Image"
|
|
1196
|
+
}),
|
|
1197
|
+
/* @__PURE__ */ d("option", {
|
|
1198
|
+
value: "video",
|
|
1199
|
+
children: "Video"
|
|
1200
|
+
}),
|
|
1201
|
+
/* @__PURE__ */ d("option", {
|
|
1202
|
+
value: "file",
|
|
1203
|
+
children: "File"
|
|
1204
|
+
})
|
|
1205
|
+
]
|
|
1206
|
+
}),
|
|
1207
|
+
/* @__PURE__ */ d("button", {
|
|
1208
|
+
type: "button",
|
|
1209
|
+
onClick: () => P((e) => e.length === 1 ? [{
|
|
1210
|
+
url: "",
|
|
1211
|
+
label: "",
|
|
1212
|
+
kind: "image"
|
|
1213
|
+
}] : e.filter((e, n) => n !== t)),
|
|
1214
|
+
className: "rounded-md border border-border-subtle px-3 py-2 text-sm text-text-secondary hover:bg-bg-sunken",
|
|
1215
|
+
children: c("notifications.remove", "Remove")
|
|
1216
|
+
})
|
|
1217
|
+
]
|
|
1218
|
+
}, `${e.kind}-${t}`)), /* @__PURE__ */ d("button", {
|
|
1219
|
+
type: "button",
|
|
1220
|
+
onClick: () => P((e) => [...e, {
|
|
1221
|
+
url: "",
|
|
1222
|
+
label: "",
|
|
1223
|
+
kind: "image"
|
|
1224
|
+
}]),
|
|
1225
|
+
className: "rounded-md border border-border-subtle px-3 py-2 text-sm text-text-secondary hover:bg-bg-sunken",
|
|
1226
|
+
children: c("notifications.addMedia", "Add media")
|
|
1227
|
+
})]
|
|
1228
|
+
})]
|
|
1229
|
+
})
|
|
1230
|
+
]
|
|
1231
|
+
}), K && /* @__PURE__ */ d("div", {
|
|
1232
|
+
className: "w-96 flex-shrink-0",
|
|
1233
|
+
children: /* @__PURE__ */ f("div", {
|
|
1234
|
+
className: "sticky top-24 bg-bg-surface rounded-lg border border-border-subtle overflow-hidden",
|
|
1235
|
+
children: [/* @__PURE__ */ d("div", {
|
|
1236
|
+
className: "px-4 py-3 bg-bg-canvas border-b border-border-subtle",
|
|
1237
|
+
children: /* @__PURE__ */ d("h3", {
|
|
1238
|
+
className: "text-sm font-medium text-text-primary",
|
|
1239
|
+
children: c("notifications.preview", "Preview")
|
|
1240
|
+
})
|
|
1241
|
+
}), /* @__PURE__ */ f("div", {
|
|
1242
|
+
className: "p-4",
|
|
1243
|
+
children: [
|
|
1244
|
+
/* @__PURE__ */ f("div", {
|
|
1245
|
+
className: "flex items-center gap-2 mb-4",
|
|
1246
|
+
children: [
|
|
1247
|
+
/* @__PURE__ */ d("span", {
|
|
1248
|
+
className: "px-2 py-1 text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300 rounded",
|
|
1249
|
+
children: c(`notifications.channel.${y}`, y)
|
|
1250
|
+
}),
|
|
1251
|
+
/* @__PURE__ */ d("span", {
|
|
1252
|
+
className: "px-2 py-1 text-xs font-medium bg-bg-sunken text-text-secondary rounded",
|
|
1253
|
+
children: c(`notifications.type.${b}`, b)
|
|
1254
|
+
}),
|
|
1255
|
+
/* @__PURE__ */ d("span", {
|
|
1256
|
+
className: `px-2 py-1 text-xs font-medium rounded ${Se.find((e) => e.value === x)?.color || ""}`,
|
|
1257
|
+
children: c(`notifications.priority.${x}`, x)
|
|
1258
|
+
})
|
|
1259
|
+
]
|
|
1260
|
+
}),
|
|
1261
|
+
/* @__PURE__ */ f("div", {
|
|
1262
|
+
className: "mb-4",
|
|
1263
|
+
children: [/* @__PURE__ */ d("p", {
|
|
1264
|
+
className: "text-xs text-text-secondary mb-1",
|
|
1265
|
+
children: c("notifications.recipients", "Recipients")
|
|
1266
|
+
}), S.length === 0 ? C === "directory" ? /* @__PURE__ */ d("p", {
|
|
1267
|
+
className: "text-sm text-text-primary",
|
|
1268
|
+
children: D ? c("notifications.allMatchingUsers", "All matching directory users") : `${T.length} ${c("notifications.recipientCount", "recipient")}${T.length === 1 ? "" : "s"}`
|
|
1269
|
+
}) : /* @__PURE__ */ d("p", {
|
|
1270
|
+
className: "text-sm text-text-tertiary italic",
|
|
1271
|
+
children: c("notifications.noRecipientsSelected", "No recipients selected")
|
|
1272
|
+
}) : /* @__PURE__ */ f("p", {
|
|
1273
|
+
className: "text-sm text-text-primary",
|
|
1274
|
+
children: [
|
|
1275
|
+
S.length,
|
|
1276
|
+
" ",
|
|
1277
|
+
c("notifications.recipientCount", "recipient"),
|
|
1278
|
+
S.length === 1 ? "" : "s"
|
|
1279
|
+
]
|
|
1280
|
+
})]
|
|
1281
|
+
}),
|
|
1282
|
+
y === "EMAIL" && ut && /* @__PURE__ */ f("div", {
|
|
1283
|
+
className: "mb-4",
|
|
1284
|
+
children: [/* @__PURE__ */ d("p", {
|
|
1285
|
+
className: "text-xs text-text-secondary mb-1",
|
|
1286
|
+
children: c("notifications.subjectLabel", "Subject")
|
|
1287
|
+
}), /* @__PURE__ */ d("p", {
|
|
1288
|
+
className: "text-sm font-medium text-text-primary",
|
|
1289
|
+
children: ut
|
|
1290
|
+
})]
|
|
1291
|
+
}),
|
|
1292
|
+
/* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("p", {
|
|
1293
|
+
className: "text-xs text-text-secondary mb-1",
|
|
1294
|
+
children: c("notifications.messageLabel", "Message")
|
|
1295
|
+
}), lt ? /* @__PURE__ */ d("div", {
|
|
1296
|
+
className: "p-3 bg-bg-canvas rounded-lg",
|
|
1297
|
+
children: /* @__PURE__ */ d("p", {
|
|
1298
|
+
className: "text-sm text-text-secondary whitespace-pre-wrap",
|
|
1299
|
+
children: lt
|
|
1300
|
+
})
|
|
1301
|
+
}) : /* @__PURE__ */ d("p", {
|
|
1302
|
+
className: "text-sm text-text-tertiary italic",
|
|
1303
|
+
children: c("notifications.noMessageContent", "No message content")
|
|
1304
|
+
})] }),
|
|
1305
|
+
M && /* @__PURE__ */ f("div", {
|
|
1306
|
+
className: "mt-4",
|
|
1307
|
+
children: [/* @__PURE__ */ d("p", {
|
|
1308
|
+
className: "text-xs text-text-secondary mb-1",
|
|
1309
|
+
children: c("notifications.topic", "Topic")
|
|
1310
|
+
}), /* @__PURE__ */ d("p", {
|
|
1311
|
+
className: "text-sm text-text-primary",
|
|
1312
|
+
children: Re.find((e) => e.id === M)?.name || M
|
|
1313
|
+
})]
|
|
1314
|
+
}),
|
|
1315
|
+
Q.length > 0 && /* @__PURE__ */ f("div", {
|
|
1316
|
+
className: "mt-4",
|
|
1317
|
+
children: [/* @__PURE__ */ d("p", {
|
|
1318
|
+
className: "text-xs text-text-secondary mb-1",
|
|
1319
|
+
children: c("notifications.actions", "Actions")
|
|
1320
|
+
}), /* @__PURE__ */ d("div", {
|
|
1321
|
+
className: "flex flex-wrap gap-2",
|
|
1322
|
+
children: Q.map((e) => /* @__PURE__ */ d("span", {
|
|
1323
|
+
className: "rounded-full bg-muted px-2 py-1 text-xs text-secondary",
|
|
1324
|
+
children: e.label
|
|
1325
|
+
}, e.id))
|
|
1326
|
+
})]
|
|
1327
|
+
}),
|
|
1328
|
+
$.length > 0 && /* @__PURE__ */ f("div", {
|
|
1329
|
+
className: "mt-4 space-y-2",
|
|
1330
|
+
children: [/* @__PURE__ */ d("p", {
|
|
1331
|
+
className: "text-xs text-text-secondary",
|
|
1332
|
+
children: c("notifications.media", "Media")
|
|
1333
|
+
}), $.map((e) => /* @__PURE__ */ d("div", {
|
|
1334
|
+
className: "rounded-lg border border-border-subtle bg-bg-canvas p-2 text-xs text-text-secondary",
|
|
1335
|
+
children: e.label || e.url
|
|
1336
|
+
}, e.url))]
|
|
1337
|
+
}),
|
|
1338
|
+
v === "template" && X && /* @__PURE__ */ f("div", {
|
|
1339
|
+
className: "mt-4 pt-4 border-t border-border-subtle",
|
|
1340
|
+
children: [
|
|
1341
|
+
/* @__PURE__ */ d("p", {
|
|
1342
|
+
className: "text-xs text-text-secondary mb-1",
|
|
1343
|
+
children: c("notifications.usingTemplate", "Using Template")
|
|
1344
|
+
}),
|
|
1345
|
+
/* @__PURE__ */ d("p", {
|
|
1346
|
+
className: "text-sm font-medium text-text-primary",
|
|
1347
|
+
children: X.name
|
|
1348
|
+
}),
|
|
1349
|
+
/* @__PURE__ */ d("p", {
|
|
1350
|
+
className: "text-xs text-text-secondary font-mono",
|
|
1351
|
+
children: X.slug
|
|
1352
|
+
})
|
|
1353
|
+
]
|
|
1354
|
+
})
|
|
1355
|
+
]
|
|
1356
|
+
})]
|
|
1357
|
+
})
|
|
1358
|
+
})]
|
|
1359
|
+
})
|
|
1360
|
+
]
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
//#endregion
|
|
1364
|
+
export { Te as CreateNotificationPage };
|
|
1365
|
+
|
|
1366
|
+
//# sourceMappingURL=CreateNotificationPage.js.map
|