@burdenoff/microfe-notification 2026.1109.1 → 2026.1114.1
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/dist/NotificationRoutes.js +108 -36
- package/dist/NotificationRoutes.js.map +1 -1
- package/dist/components/ConfirmDeleteDialog.d.ts +17 -0
- package/dist/components/ConfirmDeleteDialog.js +22 -0
- package/dist/components/ConfirmDeleteDialog.js.map +1 -0
- package/dist/components/NotificationCard.d.ts +10 -1
- package/dist/components/NotificationCard.js +103 -72
- package/dist/components/NotificationCard.js.map +1 -1
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/usePreferenceToggles.d.ts +27 -0
- package/dist/hooks/usePreferenceToggles.js +84 -0
- package/dist/hooks/usePreferenceToggles.js.map +1 -0
- package/dist/navigation-v2/AdminPageV2.d.ts +14 -0
- package/dist/navigation-v2/AdminPageV2.js +51 -0
- package/dist/navigation-v2/AdminPageV2.js.map +1 -0
- package/dist/navigation-v2/AdminToolsMenu.d.ts +6 -0
- package/dist/navigation-v2/AdminToolsMenu.js +32 -0
- package/dist/navigation-v2/AdminToolsMenu.js.map +1 -0
- package/dist/navigation-v2/BackToNotifications.d.ts +2 -0
- package/dist/navigation-v2/BackToNotifications.js +20 -0
- package/dist/navigation-v2/BackToNotifications.js.map +1 -0
- package/dist/navigation-v2/FilterControls.d.ts +25 -0
- package/dist/navigation-v2/FilterControls.js +64 -0
- package/dist/navigation-v2/FilterControls.js.map +1 -0
- package/dist/navigation-v2/NotificationArchivedV2.d.ts +9 -0
- package/dist/navigation-v2/NotificationArchivedV2.js +174 -0
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -0
- package/dist/navigation-v2/NotificationInboxV2.d.ts +9 -0
- package/dist/navigation-v2/NotificationInboxV2.js +309 -0
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -0
- package/dist/navigation-v2/NotificationSettingsV2.d.ts +9 -0
- package/dist/navigation-v2/NotificationSettingsV2.js +203 -0
- package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -0
- package/dist/navigation-v2/NotificationsV2Landing.d.ts +9 -0
- package/dist/navigation-v2/NotificationsV2Landing.js +37 -0
- package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -0
- package/dist/navigation-v2/__tests__/uiMocks.d.ts +71 -0
- package/dist/navigation-v2/inboxFilters.d.ts +8 -0
- package/dist/navigation-v2/inboxFilters.js +10 -0
- package/dist/navigation-v2/inboxFilters.js.map +1 -0
- package/dist/navigation-v2/paths.d.ts +24 -0
- package/dist/navigation-v2/paths.js +31 -0
- package/dist/navigation-v2/paths.js.map +1 -0
- package/dist/navigation-v2/settingsOptions.d.ts +12 -0
- package/dist/navigation-v2/settingsOptions.js +58 -0
- package/dist/navigation-v2/settingsOptions.js.map +1 -0
- package/dist/navigation-v2/useAdminTools.d.ts +22 -0
- package/dist/navigation-v2/useAdminTools.js +76 -0
- package/dist/navigation-v2/useAdminTools.js.map +1 -0
- package/dist/pages/CreateNotificationPage.js +577 -558
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.d.ts +3 -1
- package/dist/pages/NotificationCenterPage.js +79 -74
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.d.ts +5 -1
- package/dist/pages/NotificationHistoryPage.js +52 -47
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.d.ts +4 -0
- package/dist/pages/NotificationPreferencesPage.js +97 -158
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.js +184 -166
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.js +123 -108
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/pages/TemplateEditorPage.js +339 -308
- package/dist/pages/TemplateEditorPage.js.map +1 -1
- package/dist/providers/NotificationProvider.js +6 -5
- package/dist/providers/NotificationProvider.js.map +1 -1
- package/dist/types/index.d.ts +8 -0
- package/package.json +2 -2
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { useNavigationV2 as e } from "../navigation-v2/paths.js";
|
|
2
|
+
import { isPermissionError as t } from "../utils/index.js";
|
|
3
|
+
import { useNotificationTemplate as n, useNotificationTemplates as r } from "../hooks/useNotificationTemplates.js";
|
|
4
|
+
import { useNotificationAnalytics as i } from "../hooks/useNotificationAnalytics.js";
|
|
5
|
+
import { TemplatePreview as ee } from "../components/TemplatePreview.js";
|
|
6
|
+
import { NOTIFICATION_PERMISSIONS as te } from "../constants/permissions.js";
|
|
7
|
+
import { useTr as ne } from "../shared/hooks/useTr.js";
|
|
8
|
+
import { useCallback as a, useEffect as o, useMemo as s, useRef as re, useState as c } from "react";
|
|
9
|
+
import { useGlobalUi as ie, usePermissions as ae } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
|
+
import { AlertCircle as l, ArrowLeft as oe, Code as se, Eye as u, EyeOff as d, Loader2 as f, Plus as ce, Save as p, Trash2 as le, Type as m, Variable as ue } from "lucide-react";
|
|
11
|
+
import { useNavigate as de, useParams as fe } from "react-router";
|
|
12
|
+
import { Fragment as pe, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
13
|
+
import { Button as me, NextSteps as he, OptionalFields as ge, PagePurpose as _e } from "@burdenoff/fe-libs/ui";
|
|
14
|
+
import { useI18n as ve } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
14
15
|
// src/pages/TemplateEditorPage.tsx
|
|
15
|
-
var
|
|
16
|
+
var ye = [
|
|
16
17
|
{
|
|
17
18
|
value: "TRANSACTIONAL",
|
|
18
19
|
label: "Transactional",
|
|
@@ -33,7 +34,7 @@ var ge = [
|
|
|
33
34
|
label: "Alert",
|
|
34
35
|
description: "Urgent alerts and warnings"
|
|
35
36
|
}
|
|
36
|
-
],
|
|
37
|
+
], be = [
|
|
37
38
|
{
|
|
38
39
|
value: "EMAIL",
|
|
39
40
|
label: "Email"
|
|
@@ -70,7 +71,7 @@ var ge = [
|
|
|
70
71
|
value: "TELEGRAM",
|
|
71
72
|
label: "Telegram"
|
|
72
73
|
}
|
|
73
|
-
],
|
|
74
|
+
], xe = [
|
|
74
75
|
{
|
|
75
76
|
value: "string",
|
|
76
77
|
label: "String"
|
|
@@ -88,7 +89,7 @@ var ge = [
|
|
|
88
89
|
label: "Date"
|
|
89
90
|
}
|
|
90
91
|
];
|
|
91
|
-
function
|
|
92
|
+
function Se(e) {
|
|
92
93
|
return e.toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
93
94
|
}
|
|
94
95
|
function _(e, t, n) {
|
|
@@ -104,7 +105,7 @@ function _(e, t, n) {
|
|
|
104
105
|
}
|
|
105
106
|
}) : "";
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
+
function Ce(e) {
|
|
108
109
|
let t = {};
|
|
109
110
|
for (let n of e) {
|
|
110
111
|
let e = n.name.trim();
|
|
@@ -116,60 +117,60 @@ function v(e) {
|
|
|
116
117
|
}
|
|
117
118
|
return t;
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
+
function v(e) {
|
|
120
121
|
return typeof e == "object" && !!e;
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
+
function y(e) {
|
|
123
124
|
return e ? String(e) : "";
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function b(e) {
|
|
126
127
|
return e === "number" || e === "boolean" || e === "date" ? e : "string";
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
-
return e ? Array.isArray(e) ? e.filter(
|
|
129
|
+
function we(e) {
|
|
130
|
+
return e ? Array.isArray(e) ? e.filter(v).map((e) => ({
|
|
130
131
|
name: typeof e.name == "string" ? e.name : "",
|
|
131
|
-
type:
|
|
132
|
-
defaultValue:
|
|
133
|
-
})) :
|
|
132
|
+
type: b(e.type),
|
|
133
|
+
defaultValue: y(e.defaultValue)
|
|
134
|
+
})) : v(e) ? Object.entries(e).map(([e, t]) => ({
|
|
134
135
|
name: e,
|
|
135
|
-
type:
|
|
136
|
-
defaultValue:
|
|
136
|
+
type: b(v(t) ? t.type : void 0),
|
|
137
|
+
defaultValue: y(v(t) ? t.defaultValue : void 0)
|
|
137
138
|
})) : [] : [];
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
-
let
|
|
140
|
+
function x() {
|
|
141
|
+
let v = de(), y = ne(), { locale: b } = ve(), { templateId: x } = fe(), S = !!x, { hasPermission: Te, isLoading: Ee, refreshPermissions: De } = ae(), { showToast: Oe } = ie(), { createTemplate: ke, updateTemplate: Ae, isCreating: je, isUpdating: Me } = r(), { trackTemplateSaved: C } = i(), { template: w, isLoading: Ne, error: T } = n(S ? x : void 0), [E, D] = c(""), [O, k] = c(""), [A, j] = c(!1), M = e(), [Pe, Fe] = c(!1), [N, P] = c(""), [F, I] = c("TRANSACTIONAL"), [L, Ie] = c(""), [Le, Re] = c("en"), [R, ze] = c(""), [z, B] = c(""), [V, H] = c(""), [U, W] = c([]), [G, K] = c("text"), Be = re(null), Ve = re(null), [He, q] = c(null), [Ue, J] = c(null), [Y, X] = c(!0), [We, Ge] = c("email");
|
|
141
142
|
o(() => {
|
|
142
|
-
w && (D(w.name), k(w.slug),
|
|
143
|
+
w && (D(w.name), k(w.slug), j(!0), P(w.description || ""), I(w.type), Re(w.locale || "en"), ze(w.subject || ""), B(w.bodyTemplate || ""), H(w.htmlTemplate || ""), W(we(w.variables)), w.htmlTemplate && K("html"));
|
|
143
144
|
}, [w]), o(() => {
|
|
144
|
-
!
|
|
145
|
-
}, [E,
|
|
146
|
-
let
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
!A && E && k(Se(E));
|
|
146
|
+
}, [E, A]);
|
|
147
|
+
let Ke = s(() => _(R, U, b), [
|
|
148
|
+
b,
|
|
149
|
+
R,
|
|
149
150
|
U
|
|
150
|
-
]),
|
|
151
|
+
]), qe = s(() => _(z, U, b), [
|
|
151
152
|
z,
|
|
152
|
-
|
|
153
|
+
b,
|
|
153
154
|
U
|
|
154
|
-
]),
|
|
155
|
-
|
|
155
|
+
]), Je = s(() => _(V, U, b), [
|
|
156
|
+
b,
|
|
156
157
|
V,
|
|
157
158
|
U
|
|
158
|
-
]),
|
|
159
|
+
]), Ye = a(() => {
|
|
159
160
|
W((e) => [...e, {
|
|
160
161
|
name: "",
|
|
161
162
|
type: "string",
|
|
162
163
|
defaultValue: ""
|
|
163
164
|
}]);
|
|
164
|
-
}, []),
|
|
165
|
+
}, []), Xe = a((e) => {
|
|
165
166
|
W((t) => t.filter((t, n) => n !== e));
|
|
166
167
|
}, []), Z = a((e, t, n) => {
|
|
167
168
|
W((r) => r.map((r, i) => i === e ? {
|
|
168
169
|
...r,
|
|
169
170
|
[t]: n
|
|
170
171
|
} : r));
|
|
171
|
-
}, []),
|
|
172
|
-
let t = `{{${e}}}`, n = G === "html", r = n ?
|
|
172
|
+
}, []), Ze = a((e) => {
|
|
173
|
+
let t = `{{${e}}}`, n = G === "html", r = n ? Ve.current : Be.current, i = n ? H : B;
|
|
173
174
|
if (r) {
|
|
174
175
|
let e = r.selectionStart, n = r.selectionEnd;
|
|
175
176
|
i((r) => r.substring(0, e) + t + r.substring(n)), requestAnimationFrame(() => {
|
|
@@ -178,94 +179,94 @@ function S() {
|
|
|
178
179
|
r.selectionStart = n, r.selectionEnd = n;
|
|
179
180
|
});
|
|
180
181
|
} else i((e) => e + t);
|
|
181
|
-
}, [G]), Q = async (
|
|
182
|
-
if (
|
|
183
|
-
q(
|
|
182
|
+
}, [G]), Q = async (e) => {
|
|
183
|
+
if (e?.preventDefault(), q(null), J(null), !E.trim()) {
|
|
184
|
+
q(y("notifTemplates.nameRequired", "Template name is required"));
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
186
187
|
if (!O.trim()) {
|
|
187
|
-
q(
|
|
188
|
+
q(y("notifTemplates.slugRequired", "Template slug is required"));
|
|
188
189
|
return;
|
|
189
190
|
}
|
|
190
191
|
if (!z.trim()) {
|
|
191
|
-
q(
|
|
192
|
+
q(y("notifTemplates.bodyRequired", "Body template is required"));
|
|
192
193
|
return;
|
|
193
194
|
}
|
|
194
195
|
if (U.filter((e) => !e.name.trim()).length > 0) {
|
|
195
|
-
q(
|
|
196
|
+
q(y("notifTemplates.variablesNeedName", "All variables must have a name"));
|
|
196
197
|
return;
|
|
197
198
|
}
|
|
198
199
|
let n = U.map((e) => e.name.trim()), r = n.filter((e, t) => n.indexOf(e) !== t);
|
|
199
|
-
if (r.length > 0) q(`${
|
|
200
|
+
if (r.length > 0) q(`${y("notifTemplates.duplicateVariableName", "Duplicate variable name")}: ${r[0]}`);
|
|
200
201
|
else try {
|
|
201
|
-
if (
|
|
202
|
+
if (S && w) {
|
|
202
203
|
let e = {
|
|
203
204
|
name: E.trim(),
|
|
204
|
-
description:
|
|
205
|
-
subject:
|
|
205
|
+
description: N.trim() || void 0,
|
|
206
|
+
subject: R.trim() || void 0,
|
|
206
207
|
bodyTemplate: z.trim(),
|
|
207
208
|
htmlTemplate: V.trim() || void 0,
|
|
208
|
-
variables:
|
|
209
|
+
variables: Ce(U)
|
|
209
210
|
};
|
|
210
|
-
await
|
|
211
|
+
await Ae(w.id, e), C({
|
|
211
212
|
action: "update",
|
|
212
|
-
channel:
|
|
213
|
+
channel: L || void 0,
|
|
213
214
|
type: w.type,
|
|
214
215
|
variableCount: U.length,
|
|
215
216
|
hasHtml: !!V.trim()
|
|
216
|
-
}), J(
|
|
217
|
+
}), J(y("notifTemplates.updateSuccess", "Template updated successfully"));
|
|
217
218
|
} else {
|
|
218
219
|
let e = {
|
|
219
220
|
slug: O.trim(),
|
|
220
221
|
name: E.trim(),
|
|
221
|
-
description:
|
|
222
|
-
type:
|
|
223
|
-
locale:
|
|
224
|
-
subject:
|
|
222
|
+
description: N.trim() || void 0,
|
|
223
|
+
type: F,
|
|
224
|
+
locale: Le || "en",
|
|
225
|
+
subject: R.trim() || void 0,
|
|
225
226
|
bodyTemplate: z.trim(),
|
|
226
227
|
htmlTemplate: V.trim() || void 0,
|
|
227
|
-
variables:
|
|
228
|
-
...
|
|
228
|
+
variables: Ce(U),
|
|
229
|
+
...L ? { channel: L } : {}
|
|
229
230
|
};
|
|
230
|
-
await
|
|
231
|
+
await ke(e), C({
|
|
231
232
|
action: "create",
|
|
232
|
-
channel:
|
|
233
|
-
type:
|
|
233
|
+
channel: L || void 0,
|
|
234
|
+
type: F,
|
|
234
235
|
variableCount: U.length,
|
|
235
236
|
hasHtml: !!V.trim()
|
|
236
|
-
}), J(
|
|
237
|
+
}), J(y("notifTemplates.createSuccess", "Template created successfully")), setTimeout(() => v("..", { relative: "path" }), 1200);
|
|
237
238
|
}
|
|
238
|
-
} catch (
|
|
239
|
-
if (e
|
|
240
|
-
|
|
239
|
+
} catch (e) {
|
|
240
|
+
if (t(e)) {
|
|
241
|
+
Oe(y("notifTemplates.permissionDeniedOnSave", "You don't have permission to save this template. Refreshing access…"), "warning"), De().catch((e) => console.warn("[permissions] refresh failed after template save denial:", e));
|
|
241
242
|
return;
|
|
242
243
|
}
|
|
243
|
-
let n =
|
|
244
|
+
let n = e instanceof Error ? e.message : y("notifTemplates.saveFailed", "Failed to save template");
|
|
244
245
|
q(n);
|
|
245
246
|
}
|
|
246
247
|
};
|
|
247
|
-
if (
|
|
248
|
+
if (Ee) return /* @__PURE__ */ h("div", {
|
|
248
249
|
className: "flex h-64 items-center justify-center",
|
|
249
250
|
children: /* @__PURE__ */ h("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
250
251
|
});
|
|
251
|
-
if (!
|
|
252
|
+
if (!Te(S ? te.TEMPLATE_UPDATE : te.TEMPLATE_CREATE)) return /* @__PURE__ */ h("div", {
|
|
252
253
|
className: "p-8 text-center text-text-secondary",
|
|
253
|
-
children:
|
|
254
|
+
children: S ? y("notifTemplates.noPermissionEdit", "You don't have permission to edit notification templates.") : y("notifTemplates.noPermissionCreate", "You don't have permission to create notification templates.")
|
|
254
255
|
});
|
|
255
|
-
if (
|
|
256
|
+
if (S && Ne) return /* @__PURE__ */ g("div", {
|
|
256
257
|
className: "flex flex-col items-center justify-center h-64 gap-3",
|
|
257
|
-
children: [/* @__PURE__ */ h(
|
|
258
|
+
children: [/* @__PURE__ */ h(f, {
|
|
258
259
|
size: 28,
|
|
259
260
|
className: "animate-spin text-accent-primary"
|
|
260
261
|
}), /* @__PURE__ */ h("p", {
|
|
261
262
|
className: "text-sm text-secondary",
|
|
262
|
-
children:
|
|
263
|
+
children: y("notifTemplates.loadingTemplate", "Loading template...")
|
|
263
264
|
})]
|
|
264
265
|
});
|
|
265
|
-
if (
|
|
266
|
+
if (S && T) return /* @__PURE__ */ g("div", {
|
|
266
267
|
className: "flex flex-col items-center justify-center h-64 gap-4",
|
|
267
268
|
children: [
|
|
268
|
-
/* @__PURE__ */ h(
|
|
269
|
+
/* @__PURE__ */ h(l, {
|
|
269
270
|
size: 28,
|
|
270
271
|
className: "text-error"
|
|
271
272
|
}),
|
|
@@ -274,13 +275,96 @@ function S() {
|
|
|
274
275
|
children: T
|
|
275
276
|
}),
|
|
276
277
|
/* @__PURE__ */ h("button", {
|
|
277
|
-
onClick: () =>
|
|
278
|
+
onClick: () => v("..", { relative: "path" }),
|
|
278
279
|
className: "px-4 py-2 text-sm text-secondary hover:text-primary border border-default rounded-lg transition-all",
|
|
279
|
-
children:
|
|
280
|
+
children: y("notifTemplates.backToTemplates", "Back to Templates")
|
|
280
281
|
})
|
|
281
282
|
]
|
|
282
283
|
});
|
|
283
|
-
let $ =
|
|
284
|
+
let $ = je || Me, Qe = /* @__PURE__ */ h(pe, { children: /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
285
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
286
|
+
children: y("notifTemplates.descriptionLabel", "Description")
|
|
287
|
+
}), /* @__PURE__ */ h("textarea", {
|
|
288
|
+
value: N,
|
|
289
|
+
onChange: (e) => P(e.target.value),
|
|
290
|
+
rows: 2,
|
|
291
|
+
placeholder: y("notifTemplates.descriptionPlaceholder", "Brief description of this template"),
|
|
292
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 resize-none"
|
|
293
|
+
})] }) }), $e = /* @__PURE__ */ g(pe, { children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
294
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
295
|
+
children: y("notifTemplates.defaultChannel", "Default Channel")
|
|
296
|
+
}), /* @__PURE__ */ g("select", {
|
|
297
|
+
"aria-label": y("notifTemplates.defaultChannel", "Default Channel"),
|
|
298
|
+
value: L,
|
|
299
|
+
onChange: (e) => Ie(e.target.value),
|
|
300
|
+
disabled: S,
|
|
301
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 disabled:opacity-60 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
302
|
+
children: [/* @__PURE__ */ h("option", {
|
|
303
|
+
value: "",
|
|
304
|
+
children: y("notifTemplates.none", "None")
|
|
305
|
+
}), be.map((e) => /* @__PURE__ */ h("option", {
|
|
306
|
+
value: e.value,
|
|
307
|
+
children: y(`notifTemplates.channel.${e.value}`, e.label)
|
|
308
|
+
}, e.value))]
|
|
309
|
+
})] }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
310
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
311
|
+
children: y("notifTemplates.localeLabel", "Locale")
|
|
312
|
+
}), /* @__PURE__ */ h("input", {
|
|
313
|
+
type: "text",
|
|
314
|
+
"aria-label": y("notifTemplates.localeLabel", "Locale"),
|
|
315
|
+
value: Le,
|
|
316
|
+
onChange: (e) => Re(e.target.value),
|
|
317
|
+
placeholder: "en",
|
|
318
|
+
disabled: S,
|
|
319
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono disabled:opacity-60"
|
|
320
|
+
})] })] }), et = w ? /* @__PURE__ */ g("div", {
|
|
321
|
+
className: "text-[11px] text-tertiary space-y-1",
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ g("p", { children: [
|
|
324
|
+
/* @__PURE__ */ g("span", {
|
|
325
|
+
className: "font-medium",
|
|
326
|
+
children: [y("notifTemplates.metaId", "ID"), ":"]
|
|
327
|
+
}),
|
|
328
|
+
" ",
|
|
329
|
+
/* @__PURE__ */ h("code", {
|
|
330
|
+
className: "text-[10px]",
|
|
331
|
+
children: w.id
|
|
332
|
+
})
|
|
333
|
+
] }),
|
|
334
|
+
/* @__PURE__ */ g("p", { children: [
|
|
335
|
+
/* @__PURE__ */ g("span", {
|
|
336
|
+
className: "font-medium",
|
|
337
|
+
children: [y("notifTemplates.metaVersion", "Version"), ":"]
|
|
338
|
+
}),
|
|
339
|
+
" ",
|
|
340
|
+
w.version
|
|
341
|
+
] }),
|
|
342
|
+
/* @__PURE__ */ g("p", { children: [
|
|
343
|
+
/* @__PURE__ */ g("span", {
|
|
344
|
+
className: "font-medium",
|
|
345
|
+
children: [y("notifTemplates.metaCreated", "Created"), ":"]
|
|
346
|
+
}),
|
|
347
|
+
" ",
|
|
348
|
+
new Date(w.createdAt).toLocaleString(b || "en-US")
|
|
349
|
+
] }),
|
|
350
|
+
/* @__PURE__ */ g("p", { children: [
|
|
351
|
+
/* @__PURE__ */ g("span", {
|
|
352
|
+
className: "font-medium",
|
|
353
|
+
children: [y("notifTemplates.metaUpdated", "Updated"), ":"]
|
|
354
|
+
}),
|
|
355
|
+
" ",
|
|
356
|
+
new Date(w.updatedAt).toLocaleString(b || "en-US")
|
|
357
|
+
] }),
|
|
358
|
+
/* @__PURE__ */ g("p", { children: [
|
|
359
|
+
/* @__PURE__ */ g("span", {
|
|
360
|
+
className: "font-medium",
|
|
361
|
+
children: [y("notifTemplates.metaEnabled", "Enabled"), ":"]
|
|
362
|
+
}),
|
|
363
|
+
" ",
|
|
364
|
+
w.enabled ? y("notifTemplates.yes", "Yes") : y("notifTemplates.no", "No")
|
|
365
|
+
] })
|
|
366
|
+
]
|
|
367
|
+
}) : null;
|
|
284
368
|
return /* @__PURE__ */ g("div", {
|
|
285
369
|
className: "animate-in fade-in duration-200 h-full flex flex-col",
|
|
286
370
|
children: [
|
|
@@ -289,16 +373,16 @@ function S() {
|
|
|
289
373
|
children: [/* @__PURE__ */ g("div", {
|
|
290
374
|
className: "flex items-center gap-3",
|
|
291
375
|
children: [/* @__PURE__ */ h("button", {
|
|
292
|
-
onClick: () =>
|
|
376
|
+
onClick: () => v("..", { relative: "path" }),
|
|
293
377
|
className: "p-2 hover:bg-bg-sunken rounded-lg transition-all duration-150",
|
|
294
|
-
children: /* @__PURE__ */ h(
|
|
378
|
+
children: /* @__PURE__ */ h(oe, {
|
|
295
379
|
size: 20,
|
|
296
380
|
className: "text-primary"
|
|
297
381
|
})
|
|
298
382
|
}), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("h1", {
|
|
299
383
|
className: "text-lg font-bold text-primary",
|
|
300
|
-
children:
|
|
301
|
-
}),
|
|
384
|
+
children: S ? y("notifTemplates.editTemplate", "Edit Template") : y("notifTemplates.createTemplate", "Create Template")
|
|
385
|
+
}), S && w && /* @__PURE__ */ g("p", {
|
|
302
386
|
className: "text-xs text-tertiary",
|
|
303
387
|
children: [
|
|
304
388
|
/* @__PURE__ */ h("code", { children: w.slug }),
|
|
@@ -306,62 +390,62 @@ function S() {
|
|
|
306
390
|
w.version
|
|
307
391
|
]
|
|
308
392
|
})] })]
|
|
309
|
-
}), /* @__PURE__ */ g(
|
|
393
|
+
}), /* @__PURE__ */ g(me, {
|
|
310
394
|
onClick: Q,
|
|
311
395
|
disabled: $,
|
|
312
396
|
className: "gap-2",
|
|
313
|
-
children: [$ ? /* @__PURE__ */ h(
|
|
397
|
+
children: [$ ? /* @__PURE__ */ h(f, {
|
|
314
398
|
size: 16,
|
|
315
399
|
className: "animate-spin"
|
|
316
|
-
}) : /* @__PURE__ */ h(
|
|
400
|
+
}) : /* @__PURE__ */ h(p, { size: 16 }), S ? y("notifTemplates.saveChanges", "Save Changes") : y("notifTemplates.createTemplate", "Create Template")]
|
|
317
401
|
})]
|
|
318
402
|
}),
|
|
319
|
-
|
|
403
|
+
He && /* @__PURE__ */ g("div", {
|
|
320
404
|
className: "mx-3 sm:mx-6 mt-3 flex items-center gap-3 p-3 bg-error/10 border border-error/30 rounded-lg",
|
|
321
|
-
children: [/* @__PURE__ */ h(
|
|
405
|
+
children: [/* @__PURE__ */ h(l, {
|
|
322
406
|
size: 16,
|
|
323
407
|
className: "text-error shrink-0"
|
|
324
408
|
}), /* @__PURE__ */ h("p", {
|
|
325
409
|
className: "text-sm text-error",
|
|
326
|
-
children:
|
|
410
|
+
children: He
|
|
327
411
|
})]
|
|
328
412
|
}),
|
|
329
|
-
|
|
413
|
+
Ue && /* @__PURE__ */ g("div", {
|
|
330
414
|
className: "mx-3 sm:mx-6 mt-3 flex items-center gap-3 p-3 bg-success/10 border border-success/30 rounded-lg",
|
|
331
|
-
children: [/* @__PURE__ */ h(
|
|
415
|
+
children: [/* @__PURE__ */ h(p, {
|
|
332
416
|
size: 16,
|
|
333
417
|
className: "text-success shrink-0"
|
|
334
418
|
}), /* @__PURE__ */ h("p", {
|
|
335
419
|
className: "text-sm text-success",
|
|
336
|
-
children:
|
|
420
|
+
children: Ue
|
|
337
421
|
})]
|
|
338
422
|
}),
|
|
339
423
|
/* @__PURE__ */ g("div", {
|
|
340
424
|
className: "px-3 sm:px-6 pt-3 space-y-3 shrink-0",
|
|
341
|
-
children: [/* @__PURE__ */ h(
|
|
342
|
-
icon: /* @__PURE__ */ h(
|
|
343
|
-
children:
|
|
344
|
-
}), /* @__PURE__ */ h(
|
|
425
|
+
children: [/* @__PURE__ */ h(_e, {
|
|
426
|
+
icon: /* @__PURE__ */ h(m, { size: 16 }),
|
|
427
|
+
children: y("notifTemplates.editorPurpose", S ? "Refine this template’s content and {{variables}} placeholders. Switch the live preview between email, SMS and push to see how the same template renders per channel, then save a new version — existing scheduled sends keep using the version they were created with." : "Build a reusable message blueprint: write the subject and body with {{variables}} that get filled in at send time, define each variable with a type and default, and watch the live preview render it per channel. Once saved, anyone can pick this template from the Send page.")
|
|
428
|
+
}), /* @__PURE__ */ h(he, {
|
|
345
429
|
storageKey: "notification-template-editor",
|
|
346
430
|
steps: [
|
|
347
431
|
{
|
|
348
432
|
id: "add-variable",
|
|
349
|
-
label:
|
|
350
|
-
description:
|
|
351
|
-
onClick:
|
|
433
|
+
label: y("notifTemplates.nextAddVarLabel", "Add a variable"),
|
|
434
|
+
description: y("notifTemplates.nextAddVarDesc", "Define a {{placeholder}} (e.g. userName) so the same template personalises every send."),
|
|
435
|
+
onClick: Ye
|
|
352
436
|
},
|
|
353
437
|
{
|
|
354
438
|
id: "preview-channel",
|
|
355
|
-
label:
|
|
356
|
-
description:
|
|
439
|
+
label: y("notifTemplates.nextPreviewLabel", "Preview each channel"),
|
|
440
|
+
description: y("notifTemplates.nextPreviewDesc", "Flip the live preview to SMS or push to confirm the template reads well everywhere."),
|
|
357
441
|
onClick: () => {
|
|
358
|
-
X(!0),
|
|
442
|
+
X(!0), Ge("sms");
|
|
359
443
|
}
|
|
360
444
|
},
|
|
361
445
|
{
|
|
362
446
|
id: "save",
|
|
363
|
-
label:
|
|
364
|
-
description:
|
|
447
|
+
label: S ? y("notifTemplates.nextSaveLabel", "Save your changes") : y("notifTemplates.nextCreateLabel", "Create the template"),
|
|
448
|
+
description: y("notifTemplates.nextSaveDesc", "Persist the template so it becomes selectable on the Send page."),
|
|
365
449
|
onClick: () => Q()
|
|
366
450
|
}
|
|
367
451
|
]
|
|
@@ -380,14 +464,14 @@ function S() {
|
|
|
380
464
|
children: [
|
|
381
465
|
/* @__PURE__ */ h("h2", {
|
|
382
466
|
className: "text-sm font-semibold text-primary uppercase tracking-wider",
|
|
383
|
-
children:
|
|
467
|
+
children: y("notifTemplates.basicInformation", "Basic Information")
|
|
384
468
|
}),
|
|
385
469
|
/* @__PURE__ */ g("div", {
|
|
386
470
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
|
|
387
471
|
children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
|
|
388
472
|
className: "block text-sm font-medium text-primary mb-1.5",
|
|
389
473
|
children: [
|
|
390
|
-
|
|
474
|
+
y("notifTemplates.nameLabel", "Name"),
|
|
391
475
|
" ",
|
|
392
476
|
/* @__PURE__ */ h("span", {
|
|
393
477
|
className: "text-error",
|
|
@@ -398,13 +482,13 @@ function S() {
|
|
|
398
482
|
type: "text",
|
|
399
483
|
value: E,
|
|
400
484
|
onChange: (e) => D(e.target.value),
|
|
401
|
-
placeholder:
|
|
485
|
+
placeholder: y("notifTemplates.namePlaceholder", "e.g., Welcome Email"),
|
|
402
486
|
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150"
|
|
403
487
|
})] }), /* @__PURE__ */ g("div", { children: [
|
|
404
488
|
/* @__PURE__ */ g("label", {
|
|
405
489
|
className: "block text-sm font-medium text-primary mb-1.5",
|
|
406
490
|
children: [
|
|
407
|
-
|
|
491
|
+
y("notifTemplates.slugLabel", "Slug"),
|
|
408
492
|
" ",
|
|
409
493
|
/* @__PURE__ */ h("span", {
|
|
410
494
|
className: "text-error",
|
|
@@ -412,86 +496,69 @@ function S() {
|
|
|
412
496
|
})
|
|
413
497
|
]
|
|
414
498
|
}),
|
|
415
|
-
/* @__PURE__ */
|
|
499
|
+
M && !Pe ? /* @__PURE__ */ g("div", {
|
|
500
|
+
className: "flex min-h-9 items-center gap-2",
|
|
501
|
+
children: [/* @__PURE__ */ h("code", {
|
|
502
|
+
className: "truncate font-mono text-sm text-text-primary",
|
|
503
|
+
children: O || "—"
|
|
504
|
+
}), !S && /* @__PURE__ */ h("button", {
|
|
505
|
+
type: "button",
|
|
506
|
+
onClick: () => Fe(!0),
|
|
507
|
+
className: "text-sm font-medium text-accent-primary hover:underline",
|
|
508
|
+
children: y("notifTemplates.editSlug", "Edit")
|
|
509
|
+
})]
|
|
510
|
+
}) : /* @__PURE__ */ h("input", {
|
|
416
511
|
type: "text",
|
|
417
512
|
value: O,
|
|
418
513
|
onChange: (e) => {
|
|
419
|
-
k(e.target.value),
|
|
514
|
+
k(e.target.value), j(!0);
|
|
420
515
|
},
|
|
421
|
-
placeholder:
|
|
422
|
-
disabled:
|
|
516
|
+
placeholder: y("notifTemplates.slugPlaceholder", "e.g., welcome-email"),
|
|
517
|
+
disabled: S,
|
|
423
518
|
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono disabled:opacity-60 disabled:cursor-not-allowed"
|
|
424
519
|
}),
|
|
425
|
-
!
|
|
520
|
+
!S && /* @__PURE__ */ h("p", {
|
|
426
521
|
className: "mt-1 text-[11px] text-tertiary",
|
|
427
|
-
children:
|
|
522
|
+
children: y("notifTemplates.autoGeneratedFromName", "Auto-generated from name.")
|
|
428
523
|
})
|
|
429
524
|
] })]
|
|
430
525
|
}),
|
|
431
|
-
|
|
432
|
-
className: "block text-sm font-medium text-primary mb-1.5",
|
|
433
|
-
children: b("notifTemplates.descriptionLabel", "Description")
|
|
434
|
-
}), /* @__PURE__ */ h("textarea", {
|
|
435
|
-
value: A,
|
|
436
|
-
onChange: (e) => j(e.target.value),
|
|
437
|
-
rows: 2,
|
|
438
|
-
placeholder: b("notifTemplates.descriptionPlaceholder", "Brief description of this template"),
|
|
439
|
-
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 resize-none"
|
|
440
|
-
})] }),
|
|
526
|
+
!M && Qe,
|
|
441
527
|
/* @__PURE__ */ g("div", {
|
|
442
|
-
className:
|
|
443
|
-
children: [
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
})] }),
|
|
464
|
-
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
465
|
-
className: "block text-sm font-medium text-primary mb-1.5",
|
|
466
|
-
children: b("notifTemplates.defaultChannel", "Default Channel")
|
|
467
|
-
}), /* @__PURE__ */ g("select", {
|
|
468
|
-
value: P,
|
|
469
|
-
onChange: (e) => Ne(e.target.value),
|
|
470
|
-
disabled: C,
|
|
471
|
-
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 disabled:opacity-60 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
472
|
-
children: [/* @__PURE__ */ h("option", {
|
|
473
|
-
value: "",
|
|
474
|
-
children: b("notifTemplates.none", "None")
|
|
475
|
-
}), _e.map((e) => /* @__PURE__ */ h("option", {
|
|
476
|
-
value: e.value,
|
|
477
|
-
children: b(`notifTemplates.channel.${e.value}`, e.label)
|
|
478
|
-
}, e.value))]
|
|
479
|
-
})] }),
|
|
480
|
-
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
481
|
-
className: "block text-sm font-medium text-primary mb-1.5",
|
|
482
|
-
children: b("notifTemplates.localeLabel", "Locale")
|
|
483
|
-
}), /* @__PURE__ */ h("input", {
|
|
484
|
-
type: "text",
|
|
485
|
-
value: F,
|
|
486
|
-
onChange: (e) => I(e.target.value),
|
|
487
|
-
placeholder: "en",
|
|
488
|
-
disabled: C,
|
|
489
|
-
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono disabled:opacity-60"
|
|
490
|
-
})] })
|
|
491
|
-
]
|
|
528
|
+
className: `grid grid-cols-1 gap-4 ${M ? "sm:grid-cols-2" : "sm:grid-cols-3"}`,
|
|
529
|
+
children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
|
|
530
|
+
className: "block text-sm font-medium text-primary mb-1.5",
|
|
531
|
+
children: [
|
|
532
|
+
y("notifTemplates.typeLabel", "Type"),
|
|
533
|
+
" ",
|
|
534
|
+
/* @__PURE__ */ h("span", {
|
|
535
|
+
className: "text-error",
|
|
536
|
+
children: "*"
|
|
537
|
+
})
|
|
538
|
+
]
|
|
539
|
+
}), /* @__PURE__ */ h("select", {
|
|
540
|
+
value: F,
|
|
541
|
+
onChange: (e) => I(e.target.value),
|
|
542
|
+
disabled: S,
|
|
543
|
+
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 disabled:opacity-60 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
544
|
+
children: ye.map((e) => /* @__PURE__ */ h("option", {
|
|
545
|
+
value: e.value,
|
|
546
|
+
children: y(`notifTemplates.type.${e.value}`, e.label)
|
|
547
|
+
}, e.value))
|
|
548
|
+
})] }), !M && $e]
|
|
492
549
|
})
|
|
493
550
|
]
|
|
494
551
|
}),
|
|
552
|
+
M && /* @__PURE__ */ h(ge, {
|
|
553
|
+
storageKey: "notifications.templateEditor.more",
|
|
554
|
+
children: /* @__PURE__ */ g("div", {
|
|
555
|
+
className: "space-y-4",
|
|
556
|
+
children: [Qe, /* @__PURE__ */ h("div", {
|
|
557
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
558
|
+
children: $e
|
|
559
|
+
})]
|
|
560
|
+
})
|
|
561
|
+
}),
|
|
495
562
|
/* @__PURE__ */ g("section", {
|
|
496
563
|
className: "p-4 bg-gloss-card border border-border-seam rounded-lg space-y-4",
|
|
497
564
|
children: [
|
|
@@ -499,43 +566,43 @@ function S() {
|
|
|
499
566
|
className: "flex items-center justify-between",
|
|
500
567
|
children: [/* @__PURE__ */ h("h2", {
|
|
501
568
|
className: "text-sm font-semibold text-primary uppercase tracking-wider",
|
|
502
|
-
children:
|
|
569
|
+
children: y("notifTemplates.templateContent", "Template Content")
|
|
503
570
|
}), /* @__PURE__ */ g("div", {
|
|
504
571
|
className: "flex items-center bg-bg-sunken rounded-lg p-0.5",
|
|
505
572
|
children: [/* @__PURE__ */ g("button", {
|
|
506
573
|
type: "button",
|
|
507
574
|
onClick: () => K("text"),
|
|
508
575
|
className: `flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-all duration-150 ${G === "text" ? "bg-surface text-primary shadow-sm" : "text-tertiary hover:text-primary"}`,
|
|
509
|
-
children: [/* @__PURE__ */ h(
|
|
576
|
+
children: [/* @__PURE__ */ h(m, { size: 12 }), y("notifTemplates.contentMode.text", "Text")]
|
|
510
577
|
}), /* @__PURE__ */ g("button", {
|
|
511
578
|
type: "button",
|
|
512
579
|
onClick: () => K("html"),
|
|
513
580
|
className: `flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-all duration-150 ${G === "html" ? "bg-surface text-primary shadow-sm" : "text-tertiary hover:text-primary"}`,
|
|
514
|
-
children: [/* @__PURE__ */ h(
|
|
581
|
+
children: [/* @__PURE__ */ h(se, { size: 12 }), y("notifTemplates.contentMode.html", "HTML")]
|
|
515
582
|
})]
|
|
516
583
|
})]
|
|
517
584
|
}),
|
|
518
585
|
/* @__PURE__ */ g("div", { children: [
|
|
519
586
|
/* @__PURE__ */ h("label", {
|
|
520
587
|
className: "block text-sm font-medium text-primary mb-1.5",
|
|
521
|
-
children:
|
|
588
|
+
children: y("notifTemplates.subjectLabel", "Subject")
|
|
522
589
|
}),
|
|
523
590
|
/* @__PURE__ */ h("input", {
|
|
524
591
|
type: "text",
|
|
525
|
-
value:
|
|
526
|
-
onChange: (e) =>
|
|
527
|
-
placeholder:
|
|
592
|
+
value: R,
|
|
593
|
+
onChange: (e) => ze(e.target.value),
|
|
594
|
+
placeholder: y("notifTemplates.subjectPlaceholder", "e.g., Welcome to {{appName}}, {{userName}}!"),
|
|
528
595
|
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono"
|
|
529
596
|
}),
|
|
530
597
|
/* @__PURE__ */ h("p", {
|
|
531
598
|
className: "mt-1 text-[11px] text-tertiary",
|
|
532
|
-
children:
|
|
599
|
+
children: y("notifTemplates.subjectHint", "Used for email subject lines. Supports {{variables}}.")
|
|
533
600
|
})
|
|
534
601
|
] }),
|
|
535
602
|
G === "text" && /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("label", {
|
|
536
603
|
className: "block text-sm font-medium text-primary mb-1.5",
|
|
537
604
|
children: [
|
|
538
|
-
|
|
605
|
+
y("notifTemplates.bodyTemplateLabel", "Body Template"),
|
|
539
606
|
" ",
|
|
540
607
|
/* @__PURE__ */ h("span", {
|
|
541
608
|
className: "text-error",
|
|
@@ -543,39 +610,39 @@ function S() {
|
|
|
543
610
|
})
|
|
544
611
|
]
|
|
545
612
|
}), /* @__PURE__ */ h("textarea", {
|
|
546
|
-
ref:
|
|
613
|
+
ref: Be,
|
|
547
614
|
value: z,
|
|
548
615
|
onChange: (e) => B(e.target.value),
|
|
549
616
|
rows: 8,
|
|
550
|
-
placeholder:
|
|
617
|
+
placeholder: y("notifTemplates.bodyPlaceholder", "Hello {{userName}},\n\nWelcome to {{appName}}! Your account has been created.\n\nBest regards,\nThe Team"),
|
|
551
618
|
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono resize-y"
|
|
552
619
|
})] }),
|
|
553
620
|
G === "html" && /* @__PURE__ */ g("div", { children: [
|
|
554
621
|
/* @__PURE__ */ h("label", {
|
|
555
622
|
className: "block text-sm font-medium text-primary mb-1.5",
|
|
556
|
-
children:
|
|
623
|
+
children: y("notifTemplates.htmlTemplateLabel", "HTML Template")
|
|
557
624
|
}),
|
|
558
625
|
/* @__PURE__ */ h("textarea", {
|
|
559
|
-
ref:
|
|
626
|
+
ref: Ve,
|
|
560
627
|
value: V,
|
|
561
628
|
onChange: (e) => H(e.target.value),
|
|
562
629
|
rows: 12,
|
|
563
|
-
placeholder:
|
|
630
|
+
placeholder: y("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>"),
|
|
564
631
|
className: "w-full px-3 py-2 text-sm text-primary bg-gloss-card border border-border-seam rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 font-mono resize-y"
|
|
565
632
|
}),
|
|
566
633
|
/* @__PURE__ */ h("p", {
|
|
567
634
|
className: "mt-1 text-[11px] text-tertiary",
|
|
568
|
-
children:
|
|
635
|
+
children: y("notifTemplates.htmlHint", "HTML content for email. Falls back to text body if not provided.")
|
|
569
636
|
})
|
|
570
637
|
] }),
|
|
571
638
|
U.length > 0 && /* @__PURE__ */ g("div", {
|
|
572
639
|
className: "flex items-center gap-2 flex-wrap",
|
|
573
640
|
children: [/* @__PURE__ */ g("span", {
|
|
574
641
|
className: "text-[11px] text-tertiary font-medium",
|
|
575
|
-
children: [
|
|
642
|
+
children: [y("notifTemplates.insert", "Insert"), ":"]
|
|
576
643
|
}), U.filter((e) => e.name.trim()).map((e, t) => /* @__PURE__ */ h("button", {
|
|
577
644
|
type: "button",
|
|
578
|
-
onClick: () =>
|
|
645
|
+
onClick: () => Ze(e.name),
|
|
579
646
|
className: "px-2 py-1 text-[11px] font-mono text-primary bg-bg-sunken border border-default rounded hover:bg-bg-sunken/80 transition-colors",
|
|
580
647
|
children: `{{${e.name}}}`
|
|
581
648
|
}, t))]
|
|
@@ -590,13 +657,13 @@ function S() {
|
|
|
590
657
|
children: [/* @__PURE__ */ g("div", {
|
|
591
658
|
className: "flex items-center gap-2",
|
|
592
659
|
children: [
|
|
593
|
-
/* @__PURE__ */ h(
|
|
660
|
+
/* @__PURE__ */ h(ue, {
|
|
594
661
|
size: 16,
|
|
595
662
|
className: "text-accent-primary"
|
|
596
663
|
}),
|
|
597
664
|
/* @__PURE__ */ h("h2", {
|
|
598
665
|
className: "text-sm font-semibold text-primary uppercase tracking-wider",
|
|
599
|
-
children:
|
|
666
|
+
children: y("notifTemplates.variables", "Variables")
|
|
600
667
|
}),
|
|
601
668
|
/* @__PURE__ */ g("span", {
|
|
602
669
|
className: "text-[11px] text-tertiary",
|
|
@@ -609,15 +676,15 @@ function S() {
|
|
|
609
676
|
]
|
|
610
677
|
}), /* @__PURE__ */ g("button", {
|
|
611
678
|
type: "button",
|
|
612
|
-
onClick:
|
|
679
|
+
onClick: Ye,
|
|
613
680
|
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",
|
|
614
|
-
children: [/* @__PURE__ */ h(
|
|
681
|
+
children: [/* @__PURE__ */ h(ce, { size: 12 }), y("notifTemplates.addVariable", "Add Variable")]
|
|
615
682
|
})]
|
|
616
683
|
}),
|
|
617
684
|
U.length === 0 && /* @__PURE__ */ g("p", {
|
|
618
685
|
className: "text-sm text-tertiary text-center py-4",
|
|
619
686
|
children: [
|
|
620
|
-
|
|
687
|
+
y("notifTemplates.noVariables", "No variables defined. Add variables to use dynamic content like"),
|
|
621
688
|
" ",
|
|
622
689
|
/* @__PURE__ */ h("code", {
|
|
623
690
|
className: "px-1.5 py-0.5 bg-bg-sunken rounded text-[11px] font-mono",
|
|
@@ -632,12 +699,12 @@ function S() {
|
|
|
632
699
|
className: "flex-1",
|
|
633
700
|
children: [/* @__PURE__ */ h("label", {
|
|
634
701
|
className: "block text-[11px] font-medium text-tertiary mb-1",
|
|
635
|
-
children:
|
|
702
|
+
children: y("notifTemplates.variableName", "Name")
|
|
636
703
|
}), /* @__PURE__ */ h("input", {
|
|
637
704
|
type: "text",
|
|
638
705
|
value: e.name,
|
|
639
706
|
onChange: (e) => Z(t, "name", e.target.value.replace(/[^a-zA-Z0-9_]/g, "")),
|
|
640
|
-
placeholder:
|
|
707
|
+
placeholder: y("notifTemplates.variableNamePlaceholder", "e.g., userName"),
|
|
641
708
|
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"
|
|
642
709
|
})]
|
|
643
710
|
}),
|
|
@@ -645,14 +712,14 @@ function S() {
|
|
|
645
712
|
className: "w-28",
|
|
646
713
|
children: [/* @__PURE__ */ h("label", {
|
|
647
714
|
className: "block text-[11px] font-medium text-tertiary mb-1",
|
|
648
|
-
children:
|
|
715
|
+
children: y("notifTemplates.variableType", "Type")
|
|
649
716
|
}), /* @__PURE__ */ h("select", {
|
|
650
717
|
value: e.type,
|
|
651
718
|
onChange: (e) => Z(t, "type", e.target.value),
|
|
652
719
|
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 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
653
|
-
children:
|
|
720
|
+
children: xe.map((e) => /* @__PURE__ */ h("option", {
|
|
654
721
|
value: e.value,
|
|
655
|
-
children:
|
|
722
|
+
children: y(`notifTemplates.variableType.${e.value}`, e.label)
|
|
656
723
|
}, e.value))
|
|
657
724
|
})]
|
|
658
725
|
}),
|
|
@@ -660,20 +727,20 @@ function S() {
|
|
|
660
727
|
className: "flex-1",
|
|
661
728
|
children: [/* @__PURE__ */ h("label", {
|
|
662
729
|
className: "block text-[11px] font-medium text-tertiary mb-1",
|
|
663
|
-
children:
|
|
730
|
+
children: y("notifTemplates.sampleValue", "Sample Value")
|
|
664
731
|
}), /* @__PURE__ */ h("input", {
|
|
665
732
|
type: "text",
|
|
666
733
|
value: e.defaultValue,
|
|
667
734
|
onChange: (e) => Z(t, "defaultValue", e.target.value),
|
|
668
|
-
placeholder:
|
|
735
|
+
placeholder: y("notifTemplates.previewValue", "Preview value"),
|
|
669
736
|
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"
|
|
670
737
|
})]
|
|
671
738
|
}),
|
|
672
739
|
/* @__PURE__ */ h("button", {
|
|
673
740
|
type: "button",
|
|
674
|
-
onClick: () =>
|
|
741
|
+
onClick: () => Xe(t),
|
|
675
742
|
className: "mt-5 p-1.5 text-tertiary hover:text-error rounded transition-colors",
|
|
676
|
-
children: /* @__PURE__ */ h(
|
|
743
|
+
children: /* @__PURE__ */ h(le, { size: 14 })
|
|
677
744
|
})
|
|
678
745
|
]
|
|
679
746
|
}, t))
|
|
@@ -683,17 +750,17 @@ function S() {
|
|
|
683
750
|
className: "flex justify-end gap-3 lg:hidden pb-4",
|
|
684
751
|
children: [/* @__PURE__ */ h("button", {
|
|
685
752
|
type: "button",
|
|
686
|
-
onClick: () =>
|
|
753
|
+
onClick: () => v("..", { relative: "path" }),
|
|
687
754
|
className: "px-4 py-2 text-sm font-medium text-tertiary hover:text-primary border border-default rounded-lg transition-all duration-150",
|
|
688
|
-
children:
|
|
755
|
+
children: y("notifTemplates.cancel", "Cancel")
|
|
689
756
|
}), /* @__PURE__ */ g("button", {
|
|
690
757
|
type: "submit",
|
|
691
758
|
disabled: $,
|
|
692
759
|
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",
|
|
693
|
-
children: [$ ? /* @__PURE__ */ h(
|
|
760
|
+
children: [$ ? /* @__PURE__ */ h(f, {
|
|
694
761
|
size: 16,
|
|
695
762
|
className: "animate-spin"
|
|
696
|
-
}) : /* @__PURE__ */ h(
|
|
763
|
+
}) : /* @__PURE__ */ h(p, { size: 16 }), S ? y("notifTemplates.saveChanges", "Save Changes") : y("notifTemplates.createTemplate", "Create Template")]
|
|
697
764
|
})]
|
|
698
765
|
})
|
|
699
766
|
]
|
|
@@ -703,133 +770,97 @@ function S() {
|
|
|
703
770
|
children: [/* @__PURE__ */ g("div", {
|
|
704
771
|
className: "flex items-center gap-2 px-4 py-3 border-b border-border-seam bg-accent-wash shrink-0",
|
|
705
772
|
children: [
|
|
706
|
-
/* @__PURE__ */ h(
|
|
773
|
+
/* @__PURE__ */ h(u, {
|
|
707
774
|
size: 16,
|
|
708
775
|
className: "text-primary"
|
|
709
776
|
}),
|
|
710
777
|
/* @__PURE__ */ h("span", {
|
|
711
778
|
className: "text-sm font-semibold text-primary",
|
|
712
|
-
children:
|
|
779
|
+
children: y("notifTemplates.livePreview", "Live Preview")
|
|
713
780
|
}),
|
|
714
781
|
/* @__PURE__ */ g("button", {
|
|
715
782
|
type: "button",
|
|
716
783
|
onClick: () => X((e) => !e),
|
|
717
784
|
className: `ml-auto flex items-center gap-1.5 px-2.5 py-1 text-[11px] font-medium rounded-md transition-all duration-150 ${Y ? "bg-accent-primary/10 text-accent-primary" : "bg-bg-sunken text-tertiary hover:text-primary"}`,
|
|
718
|
-
children: [h(Y ?
|
|
785
|
+
children: [h(Y ? u : d, { size: 12 }), Y ? y("notifTemplates.previewOn", "On") : y("notifTemplates.previewOffShort", "Off")]
|
|
719
786
|
})
|
|
720
787
|
]
|
|
721
788
|
}), Y ? /* @__PURE__ */ g("div", {
|
|
722
789
|
className: "flex-1 flex flex-col overflow-hidden",
|
|
723
|
-
children: [/* @__PURE__ */ h(
|
|
724
|
-
channel:
|
|
725
|
-
subject:
|
|
726
|
-
body:
|
|
727
|
-
html: G === "html" && V ?
|
|
790
|
+
children: [/* @__PURE__ */ h(ee, {
|
|
791
|
+
channel: We,
|
|
792
|
+
subject: Ke,
|
|
793
|
+
body: qe,
|
|
794
|
+
html: G === "html" && V ? Je : "",
|
|
728
795
|
appName: U.find((e) => e.name === "appName")?.defaultValue || "Burdenoff",
|
|
729
|
-
onChannelChange:
|
|
796
|
+
onChannelChange: Ge
|
|
730
797
|
}), /* @__PURE__ */ g("div", {
|
|
731
798
|
className: "shrink-0 border-t border-default overflow-y-auto max-h-[240px]",
|
|
732
|
-
children: [
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
className: "
|
|
764
|
-
children:
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
] }),
|
|
779
|
-
/* @__PURE__ */ g("p", { children: [
|
|
780
|
-
/* @__PURE__ */ g("span", {
|
|
781
|
-
className: "font-medium",
|
|
782
|
-
children: [b("notifTemplates.metaVersion", "Version"), ":"]
|
|
783
|
-
}),
|
|
784
|
-
" ",
|
|
785
|
-
w.version
|
|
786
|
-
] }),
|
|
787
|
-
/* @__PURE__ */ g("p", { children: [
|
|
788
|
-
/* @__PURE__ */ g("span", {
|
|
789
|
-
className: "font-medium",
|
|
790
|
-
children: [b("notifTemplates.metaCreated", "Created"), ":"]
|
|
791
|
-
}),
|
|
792
|
-
" ",
|
|
793
|
-
new Date(w.createdAt).toLocaleString(x || "en-US")
|
|
794
|
-
] }),
|
|
795
|
-
/* @__PURE__ */ g("p", { children: [
|
|
796
|
-
/* @__PURE__ */ g("span", {
|
|
797
|
-
className: "font-medium",
|
|
798
|
-
children: [b("notifTemplates.metaUpdated", "Updated"), ":"]
|
|
799
|
-
}),
|
|
800
|
-
" ",
|
|
801
|
-
new Date(w.updatedAt).toLocaleString(x || "en-US")
|
|
802
|
-
] }),
|
|
803
|
-
/* @__PURE__ */ g("p", { children: [
|
|
804
|
-
/* @__PURE__ */ g("span", {
|
|
805
|
-
className: "font-medium",
|
|
806
|
-
children: [b("notifTemplates.metaEnabled", "Enabled"), ":"]
|
|
807
|
-
}),
|
|
808
|
-
" ",
|
|
809
|
-
w.enabled ? b("notifTemplates.yes", "Yes") : b("notifTemplates.no", "No")
|
|
810
|
-
] })
|
|
811
|
-
]
|
|
812
|
-
})]
|
|
813
|
-
})]
|
|
799
|
+
children: [
|
|
800
|
+
U.length > 0 && /* @__PURE__ */ g("div", {
|
|
801
|
+
className: "p-3 border-b border-default/50",
|
|
802
|
+
children: [/* @__PURE__ */ g("p", {
|
|
803
|
+
className: "text-[10px] font-medium text-tertiary uppercase tracking-wider mb-2",
|
|
804
|
+
children: [
|
|
805
|
+
y("notifTemplates.variables", "Variables"),
|
|
806
|
+
" (",
|
|
807
|
+
U.length,
|
|
808
|
+
")"
|
|
809
|
+
]
|
|
810
|
+
}), /* @__PURE__ */ h("div", {
|
|
811
|
+
className: "space-y-1.5",
|
|
812
|
+
children: U.map((e, t) => /* @__PURE__ */ g("div", {
|
|
813
|
+
className: "flex items-center justify-between text-xs",
|
|
814
|
+
children: [/* @__PURE__ */ h("code", {
|
|
815
|
+
className: "text-primary font-mono",
|
|
816
|
+
children: `{{${e.name || "..."}}}`
|
|
817
|
+
}), /* @__PURE__ */ g("span", {
|
|
818
|
+
className: "text-tertiary",
|
|
819
|
+
children: [
|
|
820
|
+
e.type,
|
|
821
|
+
" =",
|
|
822
|
+
" ",
|
|
823
|
+
e.defaultValue || /* @__PURE__ */ h("em", { children: y("notifTemplates.noDefault", "no default") })
|
|
824
|
+
]
|
|
825
|
+
})]
|
|
826
|
+
}, t))
|
|
827
|
+
})]
|
|
828
|
+
}),
|
|
829
|
+
S && w && M && /* @__PURE__ */ h("div", {
|
|
830
|
+
className: "p-3",
|
|
831
|
+
children: /* @__PURE__ */ h(ge, {
|
|
832
|
+
storageKey: "notifications.templateEditor.details",
|
|
833
|
+
label: y("notifTemplates.details", "Details"),
|
|
834
|
+
children: et
|
|
835
|
+
})
|
|
836
|
+
}),
|
|
837
|
+
S && w && !M && /* @__PURE__ */ g("div", {
|
|
838
|
+
className: "p-3",
|
|
839
|
+
children: [/* @__PURE__ */ h("p", {
|
|
840
|
+
className: "text-[10px] font-medium text-tertiary uppercase tracking-wider mb-1",
|
|
841
|
+
children: y("notifTemplates.metadata", "Metadata")
|
|
842
|
+
}), et]
|
|
843
|
+
})
|
|
844
|
+
]
|
|
814
845
|
})]
|
|
815
846
|
}) : /* @__PURE__ */ h("div", {
|
|
816
847
|
className: "flex-1 flex items-center justify-center",
|
|
817
848
|
children: /* @__PURE__ */ g("div", {
|
|
818
849
|
className: "text-center",
|
|
819
850
|
children: [
|
|
820
|
-
/* @__PURE__ */ h(
|
|
851
|
+
/* @__PURE__ */ h(d, {
|
|
821
852
|
size: 32,
|
|
822
853
|
className: "mx-auto text-tertiary mb-3"
|
|
823
854
|
}),
|
|
824
855
|
/* @__PURE__ */ h("p", {
|
|
825
856
|
className: "text-sm text-tertiary",
|
|
826
|
-
children:
|
|
857
|
+
children: y("notifTemplates.previewOff", "Preview is off")
|
|
827
858
|
}),
|
|
828
859
|
/* @__PURE__ */ h("button", {
|
|
829
860
|
type: "button",
|
|
830
861
|
onClick: () => X(!0),
|
|
831
862
|
className: "mt-2 text-xs text-accent-primary hover:underline",
|
|
832
|
-
children:
|
|
863
|
+
children: y("notifTemplates.turnOn", "Turn on")
|
|
833
864
|
})
|
|
834
865
|
]
|
|
835
866
|
})
|
|
@@ -839,6 +870,6 @@ function S() {
|
|
|
839
870
|
]
|
|
840
871
|
});
|
|
841
872
|
}
|
|
842
|
-
export {
|
|
873
|
+
export { x as TemplateEditorPage };
|
|
843
874
|
|
|
844
875
|
//# sourceMappingURL=TemplateEditorPage.js.map
|