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