@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,790 @@
|
|
|
1
|
+
import { useTr as e } from "../shared/hooks/useTr.js";
|
|
2
|
+
import { isPermissionError as t } from "../utils/index.js";
|
|
3
|
+
import { NOTIFICATION_PERMISSIONS as n } from "../constants/permissions.js";
|
|
4
|
+
import { useNotificationTemplate as r, useNotificationTemplates as i } from "../hooks/useNotificationTemplates.js";
|
|
5
|
+
import { TemplatePreview as ee } from "../components/TemplatePreview.js";
|
|
6
|
+
import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
7
|
+
import { AlertCircle as u, ArrowLeft as te, Code as ne, Eye as re, EyeOff as ie, Loader2 as d, Plus as ae, Save as f, Trash2 as oe, Type as se, Variable as ce } from "lucide-react";
|
|
8
|
+
import { useNavigate as le, useParams as ue } from "react-router-dom";
|
|
9
|
+
import { useGlobalUi as de, usePermissions as fe } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
import { useI18n as pe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
12
|
+
//#region src/pages/TemplateEditorPage.tsx
|
|
13
|
+
var me = [
|
|
14
|
+
{
|
|
15
|
+
value: "TRANSACTIONAL",
|
|
16
|
+
label: "Transactional",
|
|
17
|
+
description: "Triggered by user actions (e.g., order confirmation)"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: "MARKETING",
|
|
21
|
+
label: "Marketing",
|
|
22
|
+
description: "Promotional and campaign messages"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "SYSTEM",
|
|
26
|
+
label: "System",
|
|
27
|
+
description: "System-level notifications (e.g., maintenance)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "ALERT",
|
|
31
|
+
label: "Alert",
|
|
32
|
+
description: "Urgent alerts and warnings"
|
|
33
|
+
}
|
|
34
|
+
], he = [
|
|
35
|
+
{
|
|
36
|
+
value: "EMAIL",
|
|
37
|
+
label: "Email"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
value: "SMS",
|
|
41
|
+
label: "SMS"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: "PUSH",
|
|
45
|
+
label: "Push"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: "SLACK",
|
|
49
|
+
label: "Slack"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: "TEAMS",
|
|
53
|
+
label: "Teams"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
value: "DISCORD",
|
|
57
|
+
label: "Discord"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: "WEBHOOK",
|
|
61
|
+
label: "Webhook"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: "WHATSAPP",
|
|
65
|
+
label: "WhatsApp"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: "TELEGRAM",
|
|
69
|
+
label: "Telegram"
|
|
70
|
+
}
|
|
71
|
+
], ge = [
|
|
72
|
+
{
|
|
73
|
+
value: "string",
|
|
74
|
+
label: "String"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
value: "number",
|
|
78
|
+
label: "Number"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
value: "boolean",
|
|
82
|
+
label: "Boolean"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
value: "date",
|
|
86
|
+
label: "Date"
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
function _e(e) {
|
|
90
|
+
return e.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
91
|
+
}
|
|
92
|
+
function h(e, t, n) {
|
|
93
|
+
return e ? e.replace(/\{\{(\w+)\}\}/g, (e, r) => {
|
|
94
|
+
let i = t.find((e) => e.name === r);
|
|
95
|
+
if (!i) return e;
|
|
96
|
+
if (i.defaultValue) return i.defaultValue;
|
|
97
|
+
switch (i.type) {
|
|
98
|
+
case "number": return "42";
|
|
99
|
+
case "boolean": return "true";
|
|
100
|
+
case "date": return (/* @__PURE__ */ new Date()).toLocaleDateString(n || "en-US");
|
|
101
|
+
default: return `[${r}]`;
|
|
102
|
+
}
|
|
103
|
+
}) : "";
|
|
104
|
+
}
|
|
105
|
+
function ve(e) {
|
|
106
|
+
let t = {};
|
|
107
|
+
for (let n of e) {
|
|
108
|
+
let e = n.name.trim();
|
|
109
|
+
e && (t[e] = {
|
|
110
|
+
type: n.type,
|
|
111
|
+
required: !0,
|
|
112
|
+
...n.defaultValue ? { defaultValue: n.defaultValue } : {}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return t;
|
|
116
|
+
}
|
|
117
|
+
function ye(e) {
|
|
118
|
+
return e ? Array.isArray(e) ? e.map((e) => ({
|
|
119
|
+
name: e.name || "",
|
|
120
|
+
type: e.type || "string",
|
|
121
|
+
defaultValue: e.defaultValue || ""
|
|
122
|
+
})) : typeof e == "object" ? Object.entries(e).map(([e, t]) => ({
|
|
123
|
+
name: e,
|
|
124
|
+
type: t?.type || "string",
|
|
125
|
+
defaultValue: t?.defaultValue || ""
|
|
126
|
+
})) : [] : [];
|
|
127
|
+
}
|
|
128
|
+
function g() {
|
|
129
|
+
let g = le(), _ = e(), { locale: v } = pe(), { templateId: y } = ue(), b = !!y, { hasPermission: be, isLoading: xe, refreshPermissions: Se } = fe(), { showToast: Ce } = de(), { createTemplate: we, updateTemplate: Te, isCreating: Ee, isUpdating: De } = i(), { template: x, isLoading: Oe, error: S } = r(b ? y : void 0), [C, w] = l(""), [T, E] = l(""), [D, O] = l(!1), [k, A] = l(""), [j, M] = l("TRANSACTIONAL"), [N, ke] = l(""), [P, F] = l("en"), [I, L] = l(""), [R, z] = l(""), [B, V] = l(""), [H, U] = l([]), [W, G] = l("text"), K = c(null), q = c(null), [J, Y] = l(null), [Ae, X] = l(null), [Z, je] = l(!0), [Me, Ne] = l("email");
|
|
130
|
+
o(() => {
|
|
131
|
+
x && (w(x.name), E(x.slug), O(!0), A(x.description || ""), M(x.type), F(x.locale || "en"), L(x.subject || ""), z(x.bodyTemplate || ""), V(x.htmlTemplate || ""), U(ye(x.variables)), x.htmlTemplate && G("html"));
|
|
132
|
+
}, [x]), o(() => {
|
|
133
|
+
!D && C && E(_e(C));
|
|
134
|
+
}, [C, D]);
|
|
135
|
+
let Pe = s(() => h(I, H, v), [
|
|
136
|
+
v,
|
|
137
|
+
I,
|
|
138
|
+
H
|
|
139
|
+
]), Fe = s(() => h(R, H, v), [
|
|
140
|
+
R,
|
|
141
|
+
v,
|
|
142
|
+
H
|
|
143
|
+
]), Ie = s(() => h(B, H, v), [
|
|
144
|
+
v,
|
|
145
|
+
B,
|
|
146
|
+
H
|
|
147
|
+
]), Le = a(() => {
|
|
148
|
+
U((e) => [...e, {
|
|
149
|
+
name: "",
|
|
150
|
+
type: "string",
|
|
151
|
+
defaultValue: ""
|
|
152
|
+
}]);
|
|
153
|
+
}, []), Re = a((e) => {
|
|
154
|
+
U((t) => t.filter((t, n) => n !== e));
|
|
155
|
+
}, []), Q = a((e, t, n) => {
|
|
156
|
+
U((r) => r.map((r, i) => i === e ? {
|
|
157
|
+
...r,
|
|
158
|
+
[t]: n
|
|
159
|
+
} : r));
|
|
160
|
+
}, []), ze = a((e) => {
|
|
161
|
+
let t = `{{${e}}}`, n = W === "html", r = n ? q.current : K.current, i = n ? V : z;
|
|
162
|
+
if (r) {
|
|
163
|
+
let e = r.selectionStart, n = r.selectionEnd;
|
|
164
|
+
i((r) => r.substring(0, e) + t + r.substring(n)), requestAnimationFrame(() => {
|
|
165
|
+
r.focus();
|
|
166
|
+
let n = e + t.length;
|
|
167
|
+
r.selectionStart = n, r.selectionEnd = n;
|
|
168
|
+
});
|
|
169
|
+
} else i((e) => e + t);
|
|
170
|
+
}, [W]), Be = async (e) => {
|
|
171
|
+
if (e.preventDefault(), Y(null), X(null), !C.trim()) {
|
|
172
|
+
Y(_("notifTemplates.nameRequired", "Template name is required"));
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (!T.trim()) {
|
|
176
|
+
Y(_("notifTemplates.slugRequired", "Template slug is required"));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (!R.trim()) {
|
|
180
|
+
Y(_("notifTemplates.bodyRequired", "Body template is required"));
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (H.filter((e) => !e.name.trim()).length > 0) {
|
|
184
|
+
Y(_("notifTemplates.variablesNeedName", "All variables must have a name"));
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
let n = H.map((e) => e.name.trim()), r = n.filter((e, t) => n.indexOf(e) !== t);
|
|
188
|
+
if (r.length > 0) {
|
|
189
|
+
Y(`${_("notifTemplates.duplicateVariableName", "Duplicate variable name")}: ${r[0]}`);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
if (b && x) {
|
|
194
|
+
let e = {
|
|
195
|
+
name: C.trim(),
|
|
196
|
+
description: k.trim() || void 0,
|
|
197
|
+
subject: I.trim() || void 0,
|
|
198
|
+
bodyTemplate: R.trim(),
|
|
199
|
+
htmlTemplate: B.trim() || void 0,
|
|
200
|
+
variables: ve(H)
|
|
201
|
+
};
|
|
202
|
+
await Te(x.id, e), X(_("notifTemplates.updateSuccess", "Template updated successfully"));
|
|
203
|
+
} else await we({
|
|
204
|
+
slug: T.trim(),
|
|
205
|
+
name: C.trim(),
|
|
206
|
+
description: k.trim() || void 0,
|
|
207
|
+
type: j,
|
|
208
|
+
locale: P || "en",
|
|
209
|
+
subject: I.trim() || void 0,
|
|
210
|
+
bodyTemplate: R.trim(),
|
|
211
|
+
htmlTemplate: B.trim() || void 0,
|
|
212
|
+
variables: ve(H),
|
|
213
|
+
...N ? { channel: N } : {}
|
|
214
|
+
}), X(_("notifTemplates.createSuccess", "Template created successfully")), setTimeout(() => g("..", { relative: "path" }), 1200);
|
|
215
|
+
} catch (e) {
|
|
216
|
+
if (t(e)) {
|
|
217
|
+
Ce(_("notifTemplates.permissionDeniedOnSave", "You don't have permission to save this template. Refreshing access…"), "warning"), Se().catch((e) => console.warn("[permissions] refresh failed after template save denial:", e));
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
Y(e instanceof Error ? e.message : _("notifTemplates.saveFailed", "Failed to save template"));
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
if (xe) return /* @__PURE__ */ p("div", {
|
|
224
|
+
className: "flex h-64 items-center justify-center",
|
|
225
|
+
children: /* @__PURE__ */ p("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
226
|
+
});
|
|
227
|
+
if (!be(b ? n.TEMPLATE_UPDATE : n.TEMPLATE_CREATE)) return /* @__PURE__ */ p("div", {
|
|
228
|
+
className: "p-8 text-center text-text-secondary",
|
|
229
|
+
children: b ? _("notifTemplates.noPermissionEdit", "You don't have permission to edit notification templates.") : _("notifTemplates.noPermissionCreate", "You don't have permission to create notification templates.")
|
|
230
|
+
});
|
|
231
|
+
if (b && Oe) return /* @__PURE__ */ m("div", {
|
|
232
|
+
className: "flex flex-col items-center justify-center h-64 gap-3",
|
|
233
|
+
children: [/* @__PURE__ */ p(d, {
|
|
234
|
+
size: 28,
|
|
235
|
+
className: "animate-spin text-accent-primary"
|
|
236
|
+
}), /* @__PURE__ */ p("p", {
|
|
237
|
+
className: "text-sm text-secondary",
|
|
238
|
+
children: _("notifTemplates.loadingTemplate", "Loading template...")
|
|
239
|
+
})]
|
|
240
|
+
});
|
|
241
|
+
if (b && S) return /* @__PURE__ */ m("div", {
|
|
242
|
+
className: "flex flex-col items-center justify-center h-64 gap-4",
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ p(u, {
|
|
245
|
+
size: 28,
|
|
246
|
+
className: "text-error"
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ p("p", {
|
|
249
|
+
className: "text-sm text-error",
|
|
250
|
+
children: S
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ p("button", {
|
|
253
|
+
onClick: () => g("..", { relative: "path" }),
|
|
254
|
+
className: "px-4 py-2 text-sm text-secondary hover:text-primary border border-default rounded-lg transition-all",
|
|
255
|
+
children: _("notifTemplates.backToTemplates", "Back to Templates")
|
|
256
|
+
})
|
|
257
|
+
]
|
|
258
|
+
});
|
|
259
|
+
let $ = Ee || De;
|
|
260
|
+
return /* @__PURE__ */ m("div", {
|
|
261
|
+
className: "animate-in fade-in duration-300 h-full flex flex-col",
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ m("div", {
|
|
264
|
+
className: "flex items-center justify-between p-3 sm:px-6 sm:py-4 border-b border-default bg-surface/50 shrink-0",
|
|
265
|
+
children: [/* @__PURE__ */ m("div", {
|
|
266
|
+
className: "flex items-center gap-3",
|
|
267
|
+
children: [/* @__PURE__ */ p("button", {
|
|
268
|
+
onClick: () => g("..", { relative: "path" }),
|
|
269
|
+
className: "p-2 hover:bg-muted rounded-lg transition-all duration-150",
|
|
270
|
+
children: /* @__PURE__ */ p(te, {
|
|
271
|
+
size: 20,
|
|
272
|
+
className: "text-primary"
|
|
273
|
+
})
|
|
274
|
+
}), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
|
|
275
|
+
className: "text-lg font-bold text-primary",
|
|
276
|
+
children: b ? _("notifTemplates.editTemplate", "Edit Template") : _("notifTemplates.createTemplate", "Create Template")
|
|
277
|
+
}), b && x && /* @__PURE__ */ m("p", {
|
|
278
|
+
className: "text-xs text-tertiary",
|
|
279
|
+
children: [
|
|
280
|
+
/* @__PURE__ */ p("code", { children: x.slug }),
|
|
281
|
+
" · v",
|
|
282
|
+
x.version
|
|
283
|
+
]
|
|
284
|
+
})] })]
|
|
285
|
+
}), /* @__PURE__ */ m("button", {
|
|
286
|
+
onClick: Be,
|
|
287
|
+
disabled: $,
|
|
288
|
+
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-accent-primary hover:bg-accent-primary/90 rounded-lg transition-all duration-150 hover:shadow-md disabled:opacity-50 disabled:cursor-not-allowed",
|
|
289
|
+
children: [$ ? /* @__PURE__ */ p(d, {
|
|
290
|
+
size: 16,
|
|
291
|
+
className: "animate-spin"
|
|
292
|
+
}) : /* @__PURE__ */ p(f, { size: 16 }), b ? _("notifTemplates.saveChanges", "Save Changes") : _("notifTemplates.createTemplate", "Create Template")]
|
|
293
|
+
})]
|
|
294
|
+
}),
|
|
295
|
+
J && /* @__PURE__ */ m("div", {
|
|
296
|
+
className: "mx-3 sm:mx-6 mt-3 flex items-center gap-3 p-3 bg-error/10 border border-error/30 rounded-lg",
|
|
297
|
+
children: [/* @__PURE__ */ p(u, {
|
|
298
|
+
size: 16,
|
|
299
|
+
className: "text-error shrink-0"
|
|
300
|
+
}), /* @__PURE__ */ p("p", {
|
|
301
|
+
className: "text-sm text-error",
|
|
302
|
+
children: J
|
|
303
|
+
})]
|
|
304
|
+
}),
|
|
305
|
+
Ae && /* @__PURE__ */ m("div", {
|
|
306
|
+
className: "mx-3 sm:mx-6 mt-3 flex items-center gap-3 p-3 bg-success/10 border border-success/30 rounded-lg",
|
|
307
|
+
children: [/* @__PURE__ */ p(f, {
|
|
308
|
+
size: 16,
|
|
309
|
+
className: "text-success shrink-0"
|
|
310
|
+
}), /* @__PURE__ */ p("p", {
|
|
311
|
+
className: "text-sm text-success",
|
|
312
|
+
children: Ae
|
|
313
|
+
})]
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ m("div", {
|
|
316
|
+
className: "flex-1 overflow-hidden flex flex-col lg:flex-row",
|
|
317
|
+
children: [/* @__PURE__ */ p("div", {
|
|
318
|
+
className: "flex-1 overflow-y-auto p-3 sm:p-5 lg:border-r lg:border-default",
|
|
319
|
+
children: /* @__PURE__ */ m("form", {
|
|
320
|
+
onSubmit: Be,
|
|
321
|
+
className: "space-y-5",
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ m("section", {
|
|
324
|
+
className: "p-4 bg-surface border border-default rounded-lg space-y-4",
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ p("h2", {
|
|
327
|
+
className: "text-sm font-semibold text-primary uppercase tracking-wider",
|
|
328
|
+
children: _("notifTemplates.basicInformation", "Basic Information")
|
|
329
|
+
}),
|
|
330
|
+
/* @__PURE__ */ m("div", {
|
|
331
|
+
className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
|
|
332
|
+
children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ m("label", {
|
|
333
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
334
|
+
children: [
|
|
335
|
+
_("notifTemplates.nameLabel", "Name"),
|
|
336
|
+
" ",
|
|
337
|
+
/* @__PURE__ */ p("span", {
|
|
338
|
+
className: "text-error",
|
|
339
|
+
children: "*"
|
|
340
|
+
})
|
|
341
|
+
]
|
|
342
|
+
}), /* @__PURE__ */ p("input", {
|
|
343
|
+
type: "text",
|
|
344
|
+
value: C,
|
|
345
|
+
onChange: (e) => w(e.target.value),
|
|
346
|
+
placeholder: _("notifTemplates.namePlaceholder", "e.g., Welcome Email"),
|
|
347
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150"
|
|
348
|
+
})] }), /* @__PURE__ */ m("div", { children: [
|
|
349
|
+
/* @__PURE__ */ m("label", {
|
|
350
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
351
|
+
children: [
|
|
352
|
+
_("notifTemplates.slugLabel", "Slug"),
|
|
353
|
+
" ",
|
|
354
|
+
/* @__PURE__ */ p("span", {
|
|
355
|
+
className: "text-error",
|
|
356
|
+
children: "*"
|
|
357
|
+
})
|
|
358
|
+
]
|
|
359
|
+
}),
|
|
360
|
+
/* @__PURE__ */ p("input", {
|
|
361
|
+
type: "text",
|
|
362
|
+
value: T,
|
|
363
|
+
onChange: (e) => {
|
|
364
|
+
E(e.target.value), O(!0);
|
|
365
|
+
},
|
|
366
|
+
placeholder: _("notifTemplates.slugPlaceholder", "e.g., welcome-email"),
|
|
367
|
+
disabled: b,
|
|
368
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono disabled:opacity-60 disabled:cursor-not-allowed"
|
|
369
|
+
}),
|
|
370
|
+
!b && /* @__PURE__ */ p("p", {
|
|
371
|
+
className: "mt-1 text-[11px] text-tertiary",
|
|
372
|
+
children: _("notifTemplates.autoGeneratedFromName", "Auto-generated from name.")
|
|
373
|
+
})
|
|
374
|
+
] })]
|
|
375
|
+
}),
|
|
376
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
|
|
377
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
378
|
+
children: _("notifTemplates.descriptionLabel", "Description")
|
|
379
|
+
}), /* @__PURE__ */ p("textarea", {
|
|
380
|
+
value: k,
|
|
381
|
+
onChange: (e) => A(e.target.value),
|
|
382
|
+
rows: 2,
|
|
383
|
+
placeholder: _("notifTemplates.descriptionPlaceholder", "Brief description of this template"),
|
|
384
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 resize-none"
|
|
385
|
+
})] }),
|
|
386
|
+
/* @__PURE__ */ m("div", {
|
|
387
|
+
className: "grid grid-cols-1 sm:grid-cols-3 gap-4",
|
|
388
|
+
children: [
|
|
389
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ m("label", {
|
|
390
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
391
|
+
children: [
|
|
392
|
+
_("notifTemplates.typeLabel", "Type"),
|
|
393
|
+
" ",
|
|
394
|
+
/* @__PURE__ */ p("span", {
|
|
395
|
+
className: "text-error",
|
|
396
|
+
children: "*"
|
|
397
|
+
})
|
|
398
|
+
]
|
|
399
|
+
}), /* @__PURE__ */ p("select", {
|
|
400
|
+
value: j,
|
|
401
|
+
onChange: (e) => M(e.target.value),
|
|
402
|
+
disabled: b,
|
|
403
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 disabled:opacity-60",
|
|
404
|
+
children: me.map((e) => /* @__PURE__ */ p("option", {
|
|
405
|
+
value: e.value,
|
|
406
|
+
children: _(`notifTemplates.type.${e.value}`, e.label)
|
|
407
|
+
}, e.value))
|
|
408
|
+
})] }),
|
|
409
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
|
|
410
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
411
|
+
children: _("notifTemplates.defaultChannel", "Default Channel")
|
|
412
|
+
}), /* @__PURE__ */ m("select", {
|
|
413
|
+
value: N,
|
|
414
|
+
onChange: (e) => ke(e.target.value),
|
|
415
|
+
disabled: b,
|
|
416
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 disabled:opacity-60",
|
|
417
|
+
children: [/* @__PURE__ */ p("option", {
|
|
418
|
+
value: "",
|
|
419
|
+
children: _("notifTemplates.none", "None")
|
|
420
|
+
}), he.map((e) => /* @__PURE__ */ p("option", {
|
|
421
|
+
value: e.value,
|
|
422
|
+
children: _(`notifTemplates.channel.${e.value}`, e.label)
|
|
423
|
+
}, e.value))]
|
|
424
|
+
})] }),
|
|
425
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
|
|
426
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
427
|
+
children: _("notifTemplates.localeLabel", "Locale")
|
|
428
|
+
}), /* @__PURE__ */ p("input", {
|
|
429
|
+
type: "text",
|
|
430
|
+
value: P,
|
|
431
|
+
onChange: (e) => F(e.target.value),
|
|
432
|
+
placeholder: "en",
|
|
433
|
+
disabled: b,
|
|
434
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono disabled:opacity-60"
|
|
435
|
+
})] })
|
|
436
|
+
]
|
|
437
|
+
})
|
|
438
|
+
]
|
|
439
|
+
}),
|
|
440
|
+
/* @__PURE__ */ m("section", {
|
|
441
|
+
className: "p-4 bg-surface border border-default rounded-lg space-y-4",
|
|
442
|
+
children: [
|
|
443
|
+
/* @__PURE__ */ m("div", {
|
|
444
|
+
className: "flex items-center justify-between",
|
|
445
|
+
children: [/* @__PURE__ */ p("h2", {
|
|
446
|
+
className: "text-sm font-semibold text-primary uppercase tracking-wider",
|
|
447
|
+
children: _("notifTemplates.templateContent", "Template Content")
|
|
448
|
+
}), /* @__PURE__ */ m("div", {
|
|
449
|
+
className: "flex items-center bg-muted rounded-lg p-0.5",
|
|
450
|
+
children: [/* @__PURE__ */ m("button", {
|
|
451
|
+
type: "button",
|
|
452
|
+
onClick: () => G("text"),
|
|
453
|
+
className: `flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-all duration-150 ${W === "text" ? "bg-surface text-primary shadow-sm" : "text-tertiary hover:text-primary"}`,
|
|
454
|
+
children: [/* @__PURE__ */ p(se, { size: 12 }), _("notifTemplates.contentMode.text", "Text")]
|
|
455
|
+
}), /* @__PURE__ */ m("button", {
|
|
456
|
+
type: "button",
|
|
457
|
+
onClick: () => G("html"),
|
|
458
|
+
className: `flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-all duration-150 ${W === "html" ? "bg-surface text-primary shadow-sm" : "text-tertiary hover:text-primary"}`,
|
|
459
|
+
children: [/* @__PURE__ */ p(ne, { size: 12 }), _("notifTemplates.contentMode.html", "HTML")]
|
|
460
|
+
})]
|
|
461
|
+
})]
|
|
462
|
+
}),
|
|
463
|
+
/* @__PURE__ */ m("div", { children: [
|
|
464
|
+
/* @__PURE__ */ p("label", {
|
|
465
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
466
|
+
children: _("notifTemplates.subjectLabel", "Subject")
|
|
467
|
+
}),
|
|
468
|
+
/* @__PURE__ */ p("input", {
|
|
469
|
+
type: "text",
|
|
470
|
+
value: I,
|
|
471
|
+
onChange: (e) => L(e.target.value),
|
|
472
|
+
placeholder: _("notifTemplates.subjectPlaceholder", "e.g., Welcome to {{appName}}, {{userName}}!"),
|
|
473
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono"
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ p("p", {
|
|
476
|
+
className: "mt-1 text-[11px] text-tertiary",
|
|
477
|
+
children: _("notifTemplates.subjectHint", "Used for email subject lines. Supports {{variables}}.")
|
|
478
|
+
})
|
|
479
|
+
] }),
|
|
480
|
+
W === "text" && /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ m("label", {
|
|
481
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
482
|
+
children: [
|
|
483
|
+
_("notifTemplates.bodyTemplateLabel", "Body Template"),
|
|
484
|
+
" ",
|
|
485
|
+
/* @__PURE__ */ p("span", {
|
|
486
|
+
className: "text-error",
|
|
487
|
+
children: "*"
|
|
488
|
+
})
|
|
489
|
+
]
|
|
490
|
+
}), /* @__PURE__ */ p("textarea", {
|
|
491
|
+
ref: K,
|
|
492
|
+
value: R,
|
|
493
|
+
onChange: (e) => z(e.target.value),
|
|
494
|
+
rows: 8,
|
|
495
|
+
placeholder: _("notifTemplates.bodyPlaceholder", "Hello {{userName}},\n\nWelcome to {{appName}}! Your account has been created.\n\nBest regards,\nThe Team"),
|
|
496
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono resize-y"
|
|
497
|
+
})] }),
|
|
498
|
+
W === "html" && /* @__PURE__ */ m("div", { children: [
|
|
499
|
+
/* @__PURE__ */ p("label", {
|
|
500
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
501
|
+
children: _("notifTemplates.htmlTemplateLabel", "HTML Template")
|
|
502
|
+
}),
|
|
503
|
+
/* @__PURE__ */ p("textarea", {
|
|
504
|
+
ref: q,
|
|
505
|
+
value: B,
|
|
506
|
+
onChange: (e) => V(e.target.value),
|
|
507
|
+
rows: 12,
|
|
508
|
+
placeholder: _("notifTemplates.htmlPlaceholder", "<div style=\"font-family: sans-serif; max-width: 600px; margin: 0 auto;\">\n <h1>Welcome, {{userName}}!</h1>\n <p>Thank you for joining {{appName}}.</p>\n</div>"),
|
|
509
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono resize-y"
|
|
510
|
+
}),
|
|
511
|
+
/* @__PURE__ */ p("p", {
|
|
512
|
+
className: "mt-1 text-[11px] text-tertiary",
|
|
513
|
+
children: _("notifTemplates.htmlHint", "HTML content for email. Falls back to text body if not provided.")
|
|
514
|
+
})
|
|
515
|
+
] }),
|
|
516
|
+
H.length > 0 && /* @__PURE__ */ m("div", {
|
|
517
|
+
className: "flex items-center gap-2 flex-wrap",
|
|
518
|
+
children: [/* @__PURE__ */ m("span", {
|
|
519
|
+
className: "text-[11px] text-tertiary font-medium",
|
|
520
|
+
children: [_("notifTemplates.insert", "Insert"), ":"]
|
|
521
|
+
}), H.filter((e) => e.name.trim()).map((e, t) => /* @__PURE__ */ p("button", {
|
|
522
|
+
type: "button",
|
|
523
|
+
onClick: () => ze(e.name),
|
|
524
|
+
className: "px-2 py-1 text-[11px] font-mono text-primary bg-muted border border-default rounded hover:bg-muted/80 transition-colors",
|
|
525
|
+
children: `{{${e.name}}}`
|
|
526
|
+
}, t))]
|
|
527
|
+
})
|
|
528
|
+
]
|
|
529
|
+
}),
|
|
530
|
+
/* @__PURE__ */ m("section", {
|
|
531
|
+
className: "p-4 bg-surface border border-default rounded-lg space-y-4",
|
|
532
|
+
children: [
|
|
533
|
+
/* @__PURE__ */ m("div", {
|
|
534
|
+
className: "flex items-center justify-between",
|
|
535
|
+
children: [/* @__PURE__ */ m("div", {
|
|
536
|
+
className: "flex items-center gap-2",
|
|
537
|
+
children: [
|
|
538
|
+
/* @__PURE__ */ p(ce, {
|
|
539
|
+
size: 16,
|
|
540
|
+
className: "text-accent-primary"
|
|
541
|
+
}),
|
|
542
|
+
/* @__PURE__ */ p("h2", {
|
|
543
|
+
className: "text-sm font-semibold text-primary uppercase tracking-wider",
|
|
544
|
+
children: _("notifTemplates.variables", "Variables")
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ m("span", {
|
|
547
|
+
className: "text-[11px] text-tertiary",
|
|
548
|
+
children: [
|
|
549
|
+
"(",
|
|
550
|
+
H.length,
|
|
551
|
+
")"
|
|
552
|
+
]
|
|
553
|
+
})
|
|
554
|
+
]
|
|
555
|
+
}), /* @__PURE__ */ m("button", {
|
|
556
|
+
type: "button",
|
|
557
|
+
onClick: Le,
|
|
558
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-accent-primary bg-accent-primary/10 border border-accent-primary/20 rounded-lg hover:bg-accent-primary/20 transition-colors",
|
|
559
|
+
children: [/* @__PURE__ */ p(ae, { size: 12 }), _("notifTemplates.addVariable", "Add Variable")]
|
|
560
|
+
})]
|
|
561
|
+
}),
|
|
562
|
+
H.length === 0 && /* @__PURE__ */ m("p", {
|
|
563
|
+
className: "text-sm text-tertiary text-center py-4",
|
|
564
|
+
children: [
|
|
565
|
+
_("notifTemplates.noVariables", "No variables defined. Add variables to use dynamic content like"),
|
|
566
|
+
" ",
|
|
567
|
+
/* @__PURE__ */ p("code", {
|
|
568
|
+
className: "px-1.5 py-0.5 bg-muted rounded text-[11px] font-mono",
|
|
569
|
+
children: "{{userName}}"
|
|
570
|
+
})
|
|
571
|
+
]
|
|
572
|
+
}),
|
|
573
|
+
H.map((e, t) => /* @__PURE__ */ m("div", {
|
|
574
|
+
className: "flex items-start gap-3 p-3 bg-muted/50 rounded-lg border border-default/50",
|
|
575
|
+
children: [
|
|
576
|
+
/* @__PURE__ */ m("div", {
|
|
577
|
+
className: "flex-1",
|
|
578
|
+
children: [/* @__PURE__ */ p("label", {
|
|
579
|
+
className: "block text-[11px] font-medium text-tertiary mb-1",
|
|
580
|
+
children: _("notifTemplates.variableName", "Name")
|
|
581
|
+
}), /* @__PURE__ */ p("input", {
|
|
582
|
+
type: "text",
|
|
583
|
+
value: e.name,
|
|
584
|
+
onChange: (e) => Q(t, "name", e.target.value.replace(/[^a-zA-Z0-9_]/g, "")),
|
|
585
|
+
placeholder: _("notifTemplates.variableNamePlaceholder", "e.g., userName"),
|
|
586
|
+
className: "w-full px-2.5 py-1.5 text-xs text-primary bg-surface border border-default rounded-md focus:outline-none focus:ring-2 focus:ring-accent font-mono"
|
|
587
|
+
})]
|
|
588
|
+
}),
|
|
589
|
+
/* @__PURE__ */ m("div", {
|
|
590
|
+
className: "w-28",
|
|
591
|
+
children: [/* @__PURE__ */ p("label", {
|
|
592
|
+
className: "block text-[11px] font-medium text-tertiary mb-1",
|
|
593
|
+
children: _("notifTemplates.variableType", "Type")
|
|
594
|
+
}), /* @__PURE__ */ p("select", {
|
|
595
|
+
value: e.type,
|
|
596
|
+
onChange: (e) => Q(t, "type", e.target.value),
|
|
597
|
+
className: "w-full px-2.5 py-1.5 text-xs text-primary bg-surface border border-default rounded-md focus:outline-none focus:ring-2 focus:ring-accent",
|
|
598
|
+
children: ge.map((e) => /* @__PURE__ */ p("option", {
|
|
599
|
+
value: e.value,
|
|
600
|
+
children: _(`notifTemplates.variableType.${e.value}`, e.label)
|
|
601
|
+
}, e.value))
|
|
602
|
+
})]
|
|
603
|
+
}),
|
|
604
|
+
/* @__PURE__ */ m("div", {
|
|
605
|
+
className: "flex-1",
|
|
606
|
+
children: [/* @__PURE__ */ p("label", {
|
|
607
|
+
className: "block text-[11px] font-medium text-tertiary mb-1",
|
|
608
|
+
children: _("notifTemplates.sampleValue", "Sample Value")
|
|
609
|
+
}), /* @__PURE__ */ p("input", {
|
|
610
|
+
type: "text",
|
|
611
|
+
value: e.defaultValue,
|
|
612
|
+
onChange: (e) => Q(t, "defaultValue", e.target.value),
|
|
613
|
+
placeholder: _("notifTemplates.previewValue", "Preview value"),
|
|
614
|
+
className: "w-full px-2.5 py-1.5 text-xs text-primary bg-surface border border-default rounded-md focus:outline-none focus:ring-2 focus:ring-accent"
|
|
615
|
+
})]
|
|
616
|
+
}),
|
|
617
|
+
/* @__PURE__ */ p("button", {
|
|
618
|
+
type: "button",
|
|
619
|
+
onClick: () => Re(t),
|
|
620
|
+
className: "mt-5 p-1.5 text-tertiary hover:text-error rounded transition-colors",
|
|
621
|
+
children: /* @__PURE__ */ p(oe, { size: 14 })
|
|
622
|
+
})
|
|
623
|
+
]
|
|
624
|
+
}, t))
|
|
625
|
+
]
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ m("div", {
|
|
628
|
+
className: "flex justify-end gap-3 lg:hidden pb-4",
|
|
629
|
+
children: [/* @__PURE__ */ p("button", {
|
|
630
|
+
type: "button",
|
|
631
|
+
onClick: () => g("..", { relative: "path" }),
|
|
632
|
+
className: "px-4 py-2 text-sm font-medium text-tertiary hover:text-primary border border-default rounded-lg transition-all duration-150",
|
|
633
|
+
children: _("notifTemplates.cancel", "Cancel")
|
|
634
|
+
}), /* @__PURE__ */ m("button", {
|
|
635
|
+
type: "submit",
|
|
636
|
+
disabled: $,
|
|
637
|
+
className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-accent-primary hover:bg-accent-primary/90 rounded-lg transition-all duration-150 disabled:opacity-50",
|
|
638
|
+
children: [$ ? /* @__PURE__ */ p(d, {
|
|
639
|
+
size: 16,
|
|
640
|
+
className: "animate-spin"
|
|
641
|
+
}) : /* @__PURE__ */ p(f, { size: 16 }), b ? _("notifTemplates.saveChanges", "Save Changes") : _("notifTemplates.createTemplate", "Create Template")]
|
|
642
|
+
})]
|
|
643
|
+
})
|
|
644
|
+
]
|
|
645
|
+
})
|
|
646
|
+
}), /* @__PURE__ */ m("div", {
|
|
647
|
+
className: "hidden lg:flex lg:flex-col lg:w-[440px] xl:w-[500px] bg-muted/30",
|
|
648
|
+
children: [/* @__PURE__ */ m("div", {
|
|
649
|
+
className: "flex items-center gap-2 px-4 py-3 border-b border-default bg-surface/50 shrink-0",
|
|
650
|
+
children: [
|
|
651
|
+
/* @__PURE__ */ p(re, {
|
|
652
|
+
size: 16,
|
|
653
|
+
className: "text-primary"
|
|
654
|
+
}),
|
|
655
|
+
/* @__PURE__ */ p("span", {
|
|
656
|
+
className: "text-sm font-semibold text-primary",
|
|
657
|
+
children: _("notifTemplates.livePreview", "Live Preview")
|
|
658
|
+
}),
|
|
659
|
+
/* @__PURE__ */ m("button", {
|
|
660
|
+
type: "button",
|
|
661
|
+
onClick: () => je((e) => !e),
|
|
662
|
+
className: `ml-auto flex items-center gap-1.5 px-2.5 py-1 text-[11px] font-medium rounded-md transition-all duration-150 ${Z ? "bg-accent-primary/10 text-accent-primary" : "bg-muted text-tertiary hover:text-primary"}`,
|
|
663
|
+
children: [p(Z ? re : ie, { size: 12 }), Z ? _("notifTemplates.previewOn", "On") : _("notifTemplates.previewOffShort", "Off")]
|
|
664
|
+
})
|
|
665
|
+
]
|
|
666
|
+
}), Z ? /* @__PURE__ */ m("div", {
|
|
667
|
+
className: "flex-1 flex flex-col overflow-hidden",
|
|
668
|
+
children: [/* @__PURE__ */ p(ee, {
|
|
669
|
+
channel: Me,
|
|
670
|
+
subject: Pe,
|
|
671
|
+
body: Fe,
|
|
672
|
+
html: W === "html" && B ? Ie : "",
|
|
673
|
+
appName: H.find((e) => e.name === "appName")?.defaultValue || "Burdenoff",
|
|
674
|
+
onChannelChange: Ne
|
|
675
|
+
}), /* @__PURE__ */ m("div", {
|
|
676
|
+
className: "shrink-0 border-t border-default overflow-y-auto max-h-[240px]",
|
|
677
|
+
children: [H.length > 0 && /* @__PURE__ */ m("div", {
|
|
678
|
+
className: "p-3 border-b border-default/50",
|
|
679
|
+
children: [/* @__PURE__ */ m("p", {
|
|
680
|
+
className: "text-[10px] font-medium text-tertiary uppercase tracking-wider mb-2",
|
|
681
|
+
children: [
|
|
682
|
+
_("notifTemplates.variables", "Variables"),
|
|
683
|
+
" (",
|
|
684
|
+
H.length,
|
|
685
|
+
")"
|
|
686
|
+
]
|
|
687
|
+
}), /* @__PURE__ */ p("div", {
|
|
688
|
+
className: "space-y-1.5",
|
|
689
|
+
children: H.map((e, t) => /* @__PURE__ */ m("div", {
|
|
690
|
+
className: "flex items-center justify-between text-xs",
|
|
691
|
+
children: [/* @__PURE__ */ p("code", {
|
|
692
|
+
className: "text-primary font-mono",
|
|
693
|
+
children: `{{${e.name || "..."}}}`
|
|
694
|
+
}), /* @__PURE__ */ m("span", {
|
|
695
|
+
className: "text-tertiary",
|
|
696
|
+
children: [
|
|
697
|
+
e.type,
|
|
698
|
+
" =",
|
|
699
|
+
" ",
|
|
700
|
+
e.defaultValue || /* @__PURE__ */ p("em", { children: _("notifTemplates.noDefault", "no default") })
|
|
701
|
+
]
|
|
702
|
+
})]
|
|
703
|
+
}, t))
|
|
704
|
+
})]
|
|
705
|
+
}), b && x && /* @__PURE__ */ m("div", {
|
|
706
|
+
className: "p-3",
|
|
707
|
+
children: [/* @__PURE__ */ p("p", {
|
|
708
|
+
className: "text-[10px] font-medium text-tertiary uppercase tracking-wider mb-1",
|
|
709
|
+
children: _("notifTemplates.metadata", "Metadata")
|
|
710
|
+
}), /* @__PURE__ */ m("div", {
|
|
711
|
+
className: "text-[11px] text-tertiary space-y-1",
|
|
712
|
+
children: [
|
|
713
|
+
/* @__PURE__ */ m("p", { children: [
|
|
714
|
+
/* @__PURE__ */ m("span", {
|
|
715
|
+
className: "font-medium",
|
|
716
|
+
children: [_("notifTemplates.metaId", "ID"), ":"]
|
|
717
|
+
}),
|
|
718
|
+
" ",
|
|
719
|
+
/* @__PURE__ */ p("code", {
|
|
720
|
+
className: "text-[10px]",
|
|
721
|
+
children: x.id
|
|
722
|
+
})
|
|
723
|
+
] }),
|
|
724
|
+
/* @__PURE__ */ m("p", { children: [
|
|
725
|
+
/* @__PURE__ */ m("span", {
|
|
726
|
+
className: "font-medium",
|
|
727
|
+
children: [_("notifTemplates.metaVersion", "Version"), ":"]
|
|
728
|
+
}),
|
|
729
|
+
" ",
|
|
730
|
+
x.version
|
|
731
|
+
] }),
|
|
732
|
+
/* @__PURE__ */ m("p", { children: [
|
|
733
|
+
/* @__PURE__ */ m("span", {
|
|
734
|
+
className: "font-medium",
|
|
735
|
+
children: [_("notifTemplates.metaCreated", "Created"), ":"]
|
|
736
|
+
}),
|
|
737
|
+
" ",
|
|
738
|
+
new Date(x.createdAt).toLocaleString(v || "en-US")
|
|
739
|
+
] }),
|
|
740
|
+
/* @__PURE__ */ m("p", { children: [
|
|
741
|
+
/* @__PURE__ */ m("span", {
|
|
742
|
+
className: "font-medium",
|
|
743
|
+
children: [_("notifTemplates.metaUpdated", "Updated"), ":"]
|
|
744
|
+
}),
|
|
745
|
+
" ",
|
|
746
|
+
new Date(x.updatedAt).toLocaleString(v || "en-US")
|
|
747
|
+
] }),
|
|
748
|
+
/* @__PURE__ */ m("p", { children: [
|
|
749
|
+
/* @__PURE__ */ m("span", {
|
|
750
|
+
className: "font-medium",
|
|
751
|
+
children: [_("notifTemplates.metaEnabled", "Enabled"), ":"]
|
|
752
|
+
}),
|
|
753
|
+
" ",
|
|
754
|
+
x.enabled ? _("notifTemplates.yes", "Yes") : _("notifTemplates.no", "No")
|
|
755
|
+
] })
|
|
756
|
+
]
|
|
757
|
+
})]
|
|
758
|
+
})]
|
|
759
|
+
})]
|
|
760
|
+
}) : /* @__PURE__ */ p("div", {
|
|
761
|
+
className: "flex-1 flex items-center justify-center",
|
|
762
|
+
children: /* @__PURE__ */ m("div", {
|
|
763
|
+
className: "text-center",
|
|
764
|
+
children: [
|
|
765
|
+
/* @__PURE__ */ p(ie, {
|
|
766
|
+
size: 32,
|
|
767
|
+
className: "mx-auto text-tertiary mb-3"
|
|
768
|
+
}),
|
|
769
|
+
/* @__PURE__ */ p("p", {
|
|
770
|
+
className: "text-sm text-tertiary",
|
|
771
|
+
children: _("notifTemplates.previewOff", "Preview is off")
|
|
772
|
+
}),
|
|
773
|
+
/* @__PURE__ */ p("button", {
|
|
774
|
+
type: "button",
|
|
775
|
+
onClick: () => je(!0),
|
|
776
|
+
className: "mt-2 text-xs text-accent-primary hover:underline",
|
|
777
|
+
children: _("notifTemplates.turnOn", "Turn on")
|
|
778
|
+
})
|
|
779
|
+
]
|
|
780
|
+
})
|
|
781
|
+
})]
|
|
782
|
+
})]
|
|
783
|
+
})
|
|
784
|
+
]
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
//#endregion
|
|
788
|
+
export { g as TemplateEditorPage };
|
|
789
|
+
|
|
790
|
+
//# sourceMappingURL=TemplateEditorPage.js.map
|