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