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