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