@webx-ui/module-notifications 0.3.0 → 0.3.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/{ChannelPage-DB6cyt1W.js → ChannelPage-vxVhttk3.js} +2 -2
- package/dist/{ChannelPage-DB6cyt1W.js.map → ChannelPage-vxVhttk3.js.map} +1 -1
- package/dist/{NotificationsPage-CtP9bFgU.js → NotificationsPage-BkTBIV0B.js} +2 -2
- package/dist/{NotificationsPage-CtP9bFgU.js.map → NotificationsPage-BkTBIV0B.js.map} +1 -1
- package/dist/{index-Bki9dkMd.js → index-P5vFp-2X.js} +544 -542
- package/dist/index-P5vFp-2X.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/dist/index-Bki9dkMd.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { WxLink as
|
|
4
|
-
import { useAdmin as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as P, useModel as K, computed as m, openBlock as p, createElementBlock as w, createVNode as g, unref as s, createBlock as _, withCtx as f, createTextVNode as y, toDisplayString as h, createCommentVNode as j, mergeModels as G, provide as Ce, inject as Se, ref as A, onMounted as ae, isRef as Ae, Fragment as F, renderList as L, createElementVNode as D, mergeProps as fe, watch as je, onBeforeUnmount as We, normalizeStyle as Ne, defineAsyncComponent as me } from "vue";
|
|
2
|
+
import { useRouter as Ve } from "vue-router";
|
|
3
|
+
import { WxLink as Oe, useModal as ze, WxDialog as Fe, WxSkeleton as Ee, WxAlert as H, WxEmpty as Me, WxCheckbox as Le, WxText as W, WxBadge as le, WxSpace as se, WxButton as O, createModal as Pe, WxInput as J, WxAction as he, WxIcon as q, toast as Y, WxSelect as Re, useLocales as ve, mustacheCompletions as Ue, mustacheProblems as Be, WxCodeEditor as Ie, WxTooltip as De, confirm as He, localizedValue as oe, WxCard as qe } from "@webx-ui/core";
|
|
4
|
+
import { useAdmin as Q, useTranslate as R, WxRelationsField as Ke, useErrorText as Ge, useRemoveConfirm as be } from "@webx-ui/module-admin";
|
|
5
|
+
import Qe from "mustache";
|
|
6
|
+
const Xe = {
|
|
7
7
|
module: {
|
|
8
8
|
title: "Notifications",
|
|
9
9
|
channel: "Channel",
|
|
@@ -168,18 +168,18 @@ const Ke = {
|
|
|
168
168
|
"template-delimiters": "Changing the delimiters ({{=<% %>=}}) is not available in a message template.",
|
|
169
169
|
"template-pragma": "Pragmas and blocks ({{%…}}, {{$…}}) are not available in a message template."
|
|
170
170
|
}
|
|
171
|
-
},
|
|
172
|
-
function
|
|
171
|
+
}, re = /* @__PURE__ */ new WeakSet();
|
|
172
|
+
function U() {
|
|
173
173
|
try {
|
|
174
|
-
const { i18n: t } =
|
|
175
|
-
|
|
174
|
+
const { i18n: t } = Q();
|
|
175
|
+
re.has(t) || (t.defaults("webx-notifications", Xe), re.add(t));
|
|
176
176
|
} catch {
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const Ze = { class: "wx-notification-channels" }, Je = /* @__PURE__ */ P({
|
|
180
180
|
name: "WxNotificationChannelsField",
|
|
181
181
|
__name: "ChannelsField",
|
|
182
|
-
props: /* @__PURE__ */
|
|
182
|
+
props: /* @__PURE__ */ G({
|
|
183
183
|
event: {},
|
|
184
184
|
disabled: { type: Boolean, default: !1 },
|
|
185
185
|
base: { default: "/notifications" },
|
|
@@ -191,90 +191,90 @@ const Ge = { class: "wx-notification-channels" }, Qe = /* @__PURE__ */ L({
|
|
|
191
191
|
}),
|
|
192
192
|
emits: ["update:modelValue"],
|
|
193
193
|
setup(t) {
|
|
194
|
-
const e = t, a =
|
|
195
|
-
|
|
196
|
-
const l =
|
|
197
|
-
function
|
|
198
|
-
|
|
194
|
+
const e = t, a = K(t, "modelValue");
|
|
195
|
+
U();
|
|
196
|
+
const l = Q(), n = R("webx-notifications"), i = m(() => `notify-${e.event.replace(/[._]/g, "-")}`), r = m(() => l.can("notifications.manage")), u = Ve(), b = m(() => `${l.basePath}${e.base}`.replace(/\/{2,}/g, "/"));
|
|
197
|
+
function k(v) {
|
|
198
|
+
v.metaKey || v.ctrlKey || v.shiftKey || v.button !== 0 || (v.preventDefault(), u.push(e.base));
|
|
199
199
|
}
|
|
200
|
-
return (
|
|
201
|
-
g(s(
|
|
200
|
+
return (v, x) => (p(), w("div", Ze, [
|
|
201
|
+
g(s(Ke), {
|
|
202
202
|
modelValue: a.value,
|
|
203
|
-
"onUpdate:modelValue":
|
|
203
|
+
"onUpdate:modelValue": x[0] || (x[0] = (C) => a.value = C),
|
|
204
204
|
target: i.value,
|
|
205
205
|
sortable: !1,
|
|
206
206
|
disabled: e.disabled,
|
|
207
207
|
"add-text": e.addText ?? s(n)("panel.pick-channels"),
|
|
208
208
|
"empty-text": e.emptyText
|
|
209
209
|
}, null, 8, ["modelValue", "target", "disabled", "add-text", "empty-text"]),
|
|
210
|
-
|
|
210
|
+
r.value ? (p(), _(s(Oe), {
|
|
211
211
|
key: 0,
|
|
212
|
-
href:
|
|
212
|
+
href: b.value,
|
|
213
213
|
size: "sm",
|
|
214
|
-
onClick:
|
|
214
|
+
onClick: k
|
|
215
215
|
}, {
|
|
216
|
-
default:
|
|
217
|
-
y(
|
|
216
|
+
default: f(() => [
|
|
217
|
+
y(h(s(n)("panel.set-up-channels")), 1)
|
|
218
218
|
]),
|
|
219
219
|
_: 1
|
|
220
|
-
}, 8, ["href"])) :
|
|
220
|
+
}, 8, ["href"])) : j("", !0)
|
|
221
221
|
]));
|
|
222
222
|
}
|
|
223
|
-
}),
|
|
223
|
+
}), B = (t, e) => {
|
|
224
224
|
const a = t.__vccOpts || t;
|
|
225
225
|
for (const [l, n] of e)
|
|
226
226
|
a[l] = n;
|
|
227
227
|
return a;
|
|
228
|
-
},
|
|
229
|
-
function
|
|
230
|
-
const t =
|
|
228
|
+
}, Ye = /* @__PURE__ */ B(Je, [["__scopeId", "data-v-e0a57880"]]);
|
|
229
|
+
function ge() {
|
|
230
|
+
const t = A(null), e = /* @__PURE__ */ new Map();
|
|
231
231
|
return {
|
|
232
232
|
focused: t,
|
|
233
233
|
inserters: e,
|
|
234
234
|
insert: (a) => (e.get(t.value ?? "") ?? e.get("template"))?.(a)
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
-
const
|
|
238
|
-
function
|
|
237
|
+
const we = /* @__PURE__ */ Symbol("wx-notifications-channel");
|
|
238
|
+
function Zt(t, e, a) {
|
|
239
239
|
const l = {
|
|
240
240
|
meta: t,
|
|
241
241
|
values: e,
|
|
242
242
|
id: a,
|
|
243
|
-
provider:
|
|
243
|
+
provider: m(
|
|
244
244
|
() => t.value?.providers.find((n) => n.key === e.value.provider) ?? null
|
|
245
245
|
),
|
|
246
|
-
event:
|
|
247
|
-
...
|
|
246
|
+
event: m(() => t.value?.events.find((n) => n.key === e.value.event) ?? null),
|
|
247
|
+
...ge()
|
|
248
248
|
};
|
|
249
|
-
return
|
|
249
|
+
return Ce(we, l), l;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
return
|
|
253
|
-
meta:
|
|
254
|
-
values:
|
|
255
|
-
id:
|
|
256
|
-
provider:
|
|
257
|
-
event:
|
|
258
|
-
...
|
|
251
|
+
function X() {
|
|
252
|
+
return Se(we, null) ?? {
|
|
253
|
+
meta: A(null),
|
|
254
|
+
values: A({}),
|
|
255
|
+
id: A(null),
|
|
256
|
+
provider: m(() => null),
|
|
257
|
+
event: m(() => null),
|
|
258
|
+
...ge()
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
const
|
|
262
|
-
function
|
|
261
|
+
const et = "notifications";
|
|
262
|
+
function tt(t) {
|
|
263
263
|
const e = new URLSearchParams();
|
|
264
264
|
for (const [l, n] of Object.entries(t))
|
|
265
265
|
n == null || n === "" || e.set(l, typeof n == "boolean" ? n ? "1" : "0" : String(n));
|
|
266
266
|
const a = e.toString();
|
|
267
267
|
return a === "" ? "" : `?${a}`;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
const e = `${t.apiPath}/${
|
|
269
|
+
function ye(t) {
|
|
270
|
+
const e = `${t.apiPath}/${et}`, a = (n) => n.data, l = (n) => n === null ? e : `${e}/channels/${n}`;
|
|
271
271
|
return {
|
|
272
272
|
meta: () => t.http.get(`${e}/meta`).then(a),
|
|
273
273
|
channels: (n = {}) => {
|
|
274
274
|
const i = new URLSearchParams();
|
|
275
275
|
n.trashed && i.set("trashed", "1"), n.event && i.set("event", n.event);
|
|
276
|
-
const
|
|
277
|
-
return t.http.get(`${e}/channels${
|
|
276
|
+
const r = i.toString();
|
|
277
|
+
return t.http.get(`${e}/channels${r === "" ? "" : `?${r}`}`);
|
|
278
278
|
},
|
|
279
279
|
get: (n) => t.http.get(`${e}/channels/${n}`).then(a),
|
|
280
280
|
create: (n) => t.http.post(`${e}/channels`, { values: n }).then(a),
|
|
@@ -285,25 +285,25 @@ function be(t) {
|
|
|
285
285
|
purge: (n) => t.http.delete(`${e}/channels/${n}/purge`).then(() => {
|
|
286
286
|
}),
|
|
287
287
|
copy: (n, i) => t.http.post(`${e}/channels/${n}/copy`, i ? { name: i } : {}).then(a),
|
|
288
|
-
test: (n, i,
|
|
288
|
+
test: (n, i, r) => t.http.post(`${l(n)}/test`, {
|
|
289
289
|
values: i,
|
|
290
|
-
...
|
|
291
|
-
}).then((
|
|
292
|
-
preview: (n, i,
|
|
290
|
+
...r ? { recipient: r } : {}
|
|
291
|
+
}).then((u) => u.data.results),
|
|
292
|
+
preview: (n, i, r) => t.http.post(`${l(n)}/preview`, { values: i, locale: r }).then(a),
|
|
293
293
|
check: (n, i) => t.http.post(`${e}/check`, { values: i, ...n ? { channel: n } : {} }).then(a),
|
|
294
|
-
findRecipients: ({ provider: n, channel: i, token:
|
|
294
|
+
findRecipients: ({ provider: n, channel: i, token: r }) => t.http.post(
|
|
295
295
|
`${e}/find-recipients`,
|
|
296
|
-
{ provider: n, ...i ? { channel: i } : {}, ...
|
|
296
|
+
{ provider: n, ...i ? { channel: i } : {}, ...r ? { token: r } : {} }
|
|
297
297
|
).then(a),
|
|
298
298
|
administrators: () => t.http.get(`${e}/administrators`).then(a),
|
|
299
|
-
deliveries: (n = {}) => t.http.get(`${e}/deliveries${
|
|
299
|
+
deliveries: (n = {}) => t.http.get(`${e}/deliveries${tt(n)}`),
|
|
300
300
|
retry: (n) => t.http.post(`${e}/deliveries/${n}/retry`, {}).then(a)
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
const
|
|
303
|
+
const nt = {
|
|
304
304
|
key: 3,
|
|
305
305
|
class: "wx-notifications-found"
|
|
306
|
-
},
|
|
306
|
+
}, at = { class: "wx-notifications-found__text" }, lt = /* @__PURE__ */ P({
|
|
307
307
|
name: "WxNotificationsFindChats",
|
|
308
308
|
__name: "FindChatsDialog",
|
|
309
309
|
props: {
|
|
@@ -312,70 +312,70 @@ const Ye = {
|
|
|
312
312
|
chosen: { default: () => [] }
|
|
313
313
|
},
|
|
314
314
|
setup(t) {
|
|
315
|
-
const e = t, { open: a, resolve: l, dismiss: n } =
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
async function
|
|
319
|
-
|
|
315
|
+
const e = t, { open: a, resolve: l, dismiss: n } = ze(), i = ye(Q());
|
|
316
|
+
U();
|
|
317
|
+
const r = R("webx-notifications"), u = Ge(), b = A([]), k = A(null), v = A(null), x = A(!0), C = A(/* @__PURE__ */ new Set());
|
|
318
|
+
async function N() {
|
|
319
|
+
x.value = !0, v.value = null;
|
|
320
320
|
try {
|
|
321
|
-
const
|
|
321
|
+
const o = await i.findRecipients({
|
|
322
322
|
provider: "telegram",
|
|
323
323
|
channel: e.channel,
|
|
324
324
|
token: e.token.trim() === "" ? void 0 : e.token.trim()
|
|
325
325
|
});
|
|
326
|
-
|
|
327
|
-
} catch (
|
|
328
|
-
|
|
326
|
+
b.value = o.recipients, k.value = o.hint;
|
|
327
|
+
} catch (o) {
|
|
328
|
+
v.value = u(o);
|
|
329
329
|
} finally {
|
|
330
|
-
|
|
330
|
+
x.value = !1;
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
ae(() => {
|
|
334
|
+
N();
|
|
335
335
|
});
|
|
336
|
-
const
|
|
337
|
-
function
|
|
338
|
-
const
|
|
339
|
-
|
|
336
|
+
const S = m(() => b.value.filter((o) => !e.chosen.includes(o.id)));
|
|
337
|
+
function $(o, d) {
|
|
338
|
+
const c = new Set(C.value);
|
|
339
|
+
d ? c.add(o) : c.delete(o), C.value = c;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
l(
|
|
341
|
+
function V() {
|
|
342
|
+
l(S.value.filter((o) => C.value.has(o.id)));
|
|
343
343
|
}
|
|
344
|
-
return (
|
|
344
|
+
return (o, d) => (p(), _(s(Fe), {
|
|
345
345
|
open: s(a),
|
|
346
|
-
"onUpdate:open":
|
|
347
|
-
title: s(
|
|
346
|
+
"onUpdate:open": d[1] || (d[1] = (c) => Ae(a) ? a.value = c : null),
|
|
347
|
+
title: s(r)("panel.find-title"),
|
|
348
348
|
width: 480
|
|
349
349
|
}, {
|
|
350
|
-
footer:
|
|
351
|
-
g(s(
|
|
352
|
-
default:
|
|
353
|
-
g(s(
|
|
350
|
+
footer: f(() => [
|
|
351
|
+
g(s(se), { size: "sm" }, {
|
|
352
|
+
default: f(() => [
|
|
353
|
+
g(s(O), {
|
|
354
354
|
variant: "outline",
|
|
355
|
-
disabled:
|
|
356
|
-
onClick:
|
|
355
|
+
disabled: x.value,
|
|
356
|
+
onClick: N
|
|
357
357
|
}, {
|
|
358
|
-
default:
|
|
359
|
-
y(
|
|
358
|
+
default: f(() => [
|
|
359
|
+
y(h(s(r)("panel.find-chats")), 1)
|
|
360
360
|
]),
|
|
361
361
|
_: 1
|
|
362
362
|
}, 8, ["disabled"]),
|
|
363
|
-
g(s(
|
|
363
|
+
g(s(O), {
|
|
364
364
|
variant: "outline",
|
|
365
|
-
onClick:
|
|
365
|
+
onClick: d[0] || (d[0] = (c) => s(n)())
|
|
366
366
|
}, {
|
|
367
|
-
default:
|
|
368
|
-
y(
|
|
367
|
+
default: f(() => [
|
|
368
|
+
y(h(s(r)("panel.cancel")), 1)
|
|
369
369
|
]),
|
|
370
370
|
_: 1
|
|
371
371
|
}),
|
|
372
|
-
g(s(
|
|
372
|
+
g(s(O), {
|
|
373
373
|
type: "primary",
|
|
374
374
|
disabled: C.value.size === 0,
|
|
375
|
-
onClick:
|
|
375
|
+
onClick: V
|
|
376
376
|
}, {
|
|
377
|
-
default:
|
|
378
|
-
y(
|
|
377
|
+
default: f(() => [
|
|
378
|
+
y(h(s(r)("panel.find-add")), 1)
|
|
379
379
|
]),
|
|
380
380
|
_: 1
|
|
381
381
|
}, 8, ["disabled"])
|
|
@@ -383,45 +383,45 @@ const Ye = {
|
|
|
383
383
|
_: 1
|
|
384
384
|
})
|
|
385
385
|
]),
|
|
386
|
-
default:
|
|
387
|
-
|
|
386
|
+
default: f(() => [
|
|
387
|
+
x.value ? (p(), _(s(Ee), {
|
|
388
388
|
key: 0,
|
|
389
389
|
rows: 3
|
|
390
|
-
})) :
|
|
390
|
+
})) : v.value ? (p(), _(s(H), {
|
|
391
391
|
key: 1,
|
|
392
392
|
type: "danger",
|
|
393
393
|
variant: "soft",
|
|
394
|
-
description:
|
|
395
|
-
}, null, 8, ["description"])) :
|
|
394
|
+
description: v.value
|
|
395
|
+
}, null, 8, ["description"])) : b.value.length === 0 ? (p(), _(s(Me), {
|
|
396
396
|
key: 2,
|
|
397
|
-
title: s(
|
|
398
|
-
description:
|
|
399
|
-
}, null, 8, ["title", "description"])) : (p(), w("ul",
|
|
400
|
-
(p(!0), w(
|
|
401
|
-
key:
|
|
397
|
+
title: s(r)("panel.find-title"),
|
|
398
|
+
description: k.value ?? s(r)("panel.find-help")
|
|
399
|
+
}, null, 8, ["title", "description"])) : (p(), w("ul", nt, [
|
|
400
|
+
(p(!0), w(F, null, L(b.value, (c) => (p(), w("li", {
|
|
401
|
+
key: c.id,
|
|
402
402
|
class: "wx-notifications-found__row"
|
|
403
403
|
}, [
|
|
404
|
-
g(s(
|
|
405
|
-
"model-value": e.chosen.includes(
|
|
406
|
-
disabled: e.chosen.includes(
|
|
407
|
-
"onUpdate:modelValue": (
|
|
404
|
+
g(s(Le), {
|
|
405
|
+
"model-value": e.chosen.includes(c.id) || C.value.has(c.id),
|
|
406
|
+
disabled: e.chosen.includes(c.id),
|
|
407
|
+
"onUpdate:modelValue": (T) => $(c.id, T)
|
|
408
408
|
}, {
|
|
409
|
-
default:
|
|
410
|
-
|
|
411
|
-
g(s(
|
|
412
|
-
default:
|
|
413
|
-
y(
|
|
409
|
+
default: f(() => [
|
|
410
|
+
D("span", at, [
|
|
411
|
+
g(s(W), { truncate: "" }, {
|
|
412
|
+
default: f(() => [
|
|
413
|
+
y(h(c.title), 1)
|
|
414
414
|
]),
|
|
415
415
|
_: 2
|
|
416
416
|
}, 1024),
|
|
417
|
-
g(s(
|
|
417
|
+
g(s(W), {
|
|
418
418
|
size: "sm",
|
|
419
419
|
tone: "muted",
|
|
420
420
|
mono: "",
|
|
421
421
|
truncate: ""
|
|
422
422
|
}, {
|
|
423
|
-
default:
|
|
424
|
-
y(
|
|
423
|
+
default: f(() => [
|
|
424
|
+
y(h([c.id, c.username].filter(Boolean).join(" · ")), 1)
|
|
425
425
|
]),
|
|
426
426
|
_: 2
|
|
427
427
|
}, 1024)
|
|
@@ -429,9 +429,9 @@ const Ye = {
|
|
|
429
429
|
]),
|
|
430
430
|
_: 2
|
|
431
431
|
}, 1032, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
432
|
-
g(s(
|
|
433
|
-
default:
|
|
434
|
-
y(
|
|
432
|
+
g(s(le), null, {
|
|
433
|
+
default: f(() => [
|
|
434
|
+
y(h(s(r)(`panel.chat-${c.type}`)), 1)
|
|
435
435
|
]),
|
|
436
436
|
_: 2
|
|
437
437
|
}, 1024)
|
|
@@ -441,8 +441,8 @@ const Ye = {
|
|
|
441
441
|
_: 1
|
|
442
442
|
}, 8, ["open", "title"]));
|
|
443
443
|
}
|
|
444
|
-
}),
|
|
445
|
-
function
|
|
444
|
+
}), st = /* @__PURE__ */ B(lt, [["__scopeId", "data-v-71616d40"]]);
|
|
445
|
+
function it(t) {
|
|
446
446
|
return (t?.variables ?? []).map((e) => ({
|
|
447
447
|
name: e.name,
|
|
448
448
|
label: e.label,
|
|
@@ -450,7 +450,7 @@ function at(t) {
|
|
|
450
450
|
fields: e.fields.length > 0 ? e.fields : void 0
|
|
451
451
|
}));
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function ot(t, e = "value") {
|
|
454
454
|
const a = t.name.endsWith(".*") ? `${t.name.slice(0, -2)}.name` : t.name;
|
|
455
455
|
if ((t.fields?.length ?? 0) > 0) {
|
|
456
456
|
const l = (t.fields ?? []).map((n) => `{{${n.name}}}`).join(" ");
|
|
@@ -460,13 +460,13 @@ ${l}
|
|
|
460
460
|
}
|
|
461
461
|
return e === "has" ? `{{#${a}}}{{${a}}}{{/${a}}}` : e === "empty" ? `{{^${a}}}{{/${a}}}` : `{{${a}}}`;
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function _e(t, e) {
|
|
464
464
|
return (t?.variables ?? []).filter((a) => a.address === e);
|
|
465
465
|
}
|
|
466
|
-
const
|
|
466
|
+
const rt = { class: "wx-notifications-recipients" }, ct = /* @__PURE__ */ P({
|
|
467
467
|
name: "WxNotificationsChatsField",
|
|
468
468
|
__name: "ChatsField",
|
|
469
|
-
props: /* @__PURE__ */
|
|
469
|
+
props: /* @__PURE__ */ G({
|
|
470
470
|
disabled: { type: Boolean, default: !1 }
|
|
471
471
|
}, {
|
|
472
472
|
modelValue: { default: () => [] },
|
|
@@ -474,132 +474,133 @@ const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
|
|
|
474
474
|
}),
|
|
475
475
|
emits: ["update:modelValue"],
|
|
476
476
|
setup(t) {
|
|
477
|
-
const e = t, a =
|
|
478
|
-
|
|
479
|
-
const l =
|
|
480
|
-
() =>
|
|
477
|
+
const e = t, a = K(t, "modelValue");
|
|
478
|
+
U();
|
|
479
|
+
const l = R("webx-notifications"), n = be(), i = X(), r = Pe(st), u = m(() => Array.isArray(a.value) ? a.value : []), b = m(() => _e(i.event.value, "telegram")), k = m(
|
|
480
|
+
() => b.value.filter((o) => !u.value.some((d) => d.variable === o.name))
|
|
481
481
|
);
|
|
482
|
-
function
|
|
483
|
-
return
|
|
482
|
+
function v(o) {
|
|
483
|
+
return b.value.find((d) => d.name === o)?.label ?? `{{${o}}}`;
|
|
484
484
|
}
|
|
485
|
-
function
|
|
486
|
-
a.value =
|
|
485
|
+
function x(o, d) {
|
|
486
|
+
a.value = u.value.map((c, T) => T === o ? { ...c, ...d } : c);
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
a.value = [...
|
|
488
|
+
function C(o) {
|
|
489
|
+
a.value = [...u.value, o];
|
|
490
490
|
}
|
|
491
|
-
function
|
|
492
|
-
a.value =
|
|
491
|
+
function N(o) {
|
|
492
|
+
a.value = u.value.filter((d, c) => c !== o);
|
|
493
493
|
}
|
|
494
|
-
const S =
|
|
495
|
-
const
|
|
496
|
-
return typeof
|
|
497
|
-
}),
|
|
498
|
-
() => S.value.trim() !== "" ||
|
|
494
|
+
const S = m(() => {
|
|
495
|
+
const o = i.values.value.token;
|
|
496
|
+
return typeof o == "string" ? o : "";
|
|
497
|
+
}), $ = m(
|
|
498
|
+
() => S.value.trim() !== "" || i.id.value !== null && i.values.value.provider === "telegram"
|
|
499
499
|
);
|
|
500
|
-
async function
|
|
501
|
-
if (
|
|
502
|
-
|
|
500
|
+
async function V() {
|
|
501
|
+
if (!$.value) {
|
|
502
|
+
Y.warning(l("panel.find-token"));
|
|
503
503
|
return;
|
|
504
504
|
}
|
|
505
|
-
const
|
|
506
|
-
channel:
|
|
505
|
+
const o = await r({
|
|
506
|
+
channel: i.id.value,
|
|
507
507
|
token: S.value,
|
|
508
|
-
chosen:
|
|
508
|
+
chosen: u.value.map((d) => d.chat_id ?? "").filter(Boolean)
|
|
509
509
|
});
|
|
510
|
-
!
|
|
510
|
+
!o || o.length === 0 || (a.value = [...u.value, ...o.map((d) => ({ chat_id: d.id, label: d.title }))], Y.success(l("panel.find-added", { count: String(o.length) })));
|
|
511
511
|
}
|
|
512
|
-
return (
|
|
513
|
-
|
|
512
|
+
return (o, d) => (p(), w("div", rt, [
|
|
513
|
+
u.value.length === 0 ? (p(), _(s(W), {
|
|
514
514
|
key: 0,
|
|
515
515
|
size: "sm",
|
|
516
516
|
tone: "placeholder"
|
|
517
517
|
}, {
|
|
518
|
-
default:
|
|
519
|
-
y(
|
|
518
|
+
default: f(() => [
|
|
519
|
+
y(h(s(l)("panel.no-recipients")), 1)
|
|
520
520
|
]),
|
|
521
521
|
_: 1
|
|
522
|
-
})) :
|
|
523
|
-
(p(!0), w(
|
|
524
|
-
key:
|
|
522
|
+
})) : j("", !0),
|
|
523
|
+
(p(!0), w(F, null, L(u.value, (c, T) => (p(), w("div", {
|
|
524
|
+
key: T,
|
|
525
525
|
class: "wx-notifications-recipients__row"
|
|
526
526
|
}, [
|
|
527
|
-
c.variable ? (p(),
|
|
527
|
+
c.variable ? (p(), _(s(le), {
|
|
528
528
|
key: 0,
|
|
529
529
|
type: "primary",
|
|
530
530
|
class: "wx-notifications-recipients__addressee"
|
|
531
531
|
}, {
|
|
532
|
-
default:
|
|
533
|
-
y(
|
|
532
|
+
default: f(() => [
|
|
533
|
+
y(h(s(l)("panel.addressee", { label: v(c.variable) })), 1)
|
|
534
534
|
]),
|
|
535
535
|
_: 2
|
|
536
|
-
}, 1024)) : (p(), w(
|
|
537
|
-
g(s(
|
|
536
|
+
}, 1024)) : (p(), w(F, { key: 1 }, [
|
|
537
|
+
g(s(J), {
|
|
538
538
|
class: "wx-notifications-recipients__id",
|
|
539
539
|
"model-value": c.chat_id ?? "",
|
|
540
540
|
placeholder: s(l)("panel.chat-id"),
|
|
541
541
|
"aria-label": s(l)("panel.chat-id"),
|
|
542
542
|
disabled: e.disabled,
|
|
543
543
|
inputmode: "text",
|
|
544
|
-
"onUpdate:modelValue": (
|
|
544
|
+
"onUpdate:modelValue": (z) => x(T, { chat_id: String(z ?? "") })
|
|
545
545
|
}, null, 8, ["model-value", "placeholder", "aria-label", "disabled", "onUpdate:modelValue"]),
|
|
546
|
-
g(s(
|
|
546
|
+
g(s(J), {
|
|
547
547
|
class: "wx-notifications-recipients__label",
|
|
548
548
|
"model-value": c.label ?? "",
|
|
549
549
|
placeholder: s(l)("panel.chat-label"),
|
|
550
550
|
"aria-label": s(l)("panel.chat-label"),
|
|
551
551
|
disabled: e.disabled,
|
|
552
|
-
"onUpdate:modelValue": (
|
|
552
|
+
"onUpdate:modelValue": (z) => x(T, { label: String(z ?? "") })
|
|
553
553
|
}, null, 8, ["model-value", "placeholder", "aria-label", "disabled", "onUpdate:modelValue"])
|
|
554
554
|
], 64)),
|
|
555
|
-
e.disabled ?
|
|
555
|
+
e.disabled ? j("", !0) : (p(), _(s(he), fe({
|
|
556
556
|
key: 2,
|
|
557
557
|
icon: "trash",
|
|
558
558
|
tone: "danger",
|
|
559
|
-
title: s(l)("panel.remove")
|
|
560
|
-
|
|
561
|
-
|
|
559
|
+
title: s(l)("panel.remove")
|
|
560
|
+
}, { ref_for: !0 }, s(n), {
|
|
561
|
+
onClick: (z) => N(T)
|
|
562
|
+
}), null, 16, ["title", "onClick"]))
|
|
562
563
|
]))), 128)),
|
|
563
|
-
e.disabled ?
|
|
564
|
+
e.disabled ? j("", !0) : (p(), _(s(se), {
|
|
564
565
|
key: 1,
|
|
565
566
|
size: "sm",
|
|
566
567
|
wrap: ""
|
|
567
568
|
}, {
|
|
568
|
-
default:
|
|
569
|
-
g(s(
|
|
569
|
+
default: f(() => [
|
|
570
|
+
g(s(O), {
|
|
570
571
|
variant: "outline",
|
|
571
572
|
size: "sm",
|
|
572
|
-
onClick:
|
|
573
|
+
onClick: d[0] || (d[0] = (c) => C({ chat_id: "", label: "" }))
|
|
573
574
|
}, {
|
|
574
|
-
icon:
|
|
575
|
-
g(s(
|
|
575
|
+
icon: f(() => [
|
|
576
|
+
g(s(q), { name: "plus" })
|
|
576
577
|
]),
|
|
577
|
-
default:
|
|
578
|
-
y(" " +
|
|
578
|
+
default: f(() => [
|
|
579
|
+
y(" " + h(s(l)("panel.add-chat")), 1)
|
|
579
580
|
]),
|
|
580
581
|
_: 1
|
|
581
582
|
}),
|
|
582
|
-
g(s(
|
|
583
|
+
g(s(O), {
|
|
583
584
|
variant: "outline",
|
|
584
585
|
size: "sm",
|
|
585
|
-
onClick:
|
|
586
|
+
onClick: V
|
|
586
587
|
}, {
|
|
587
|
-
icon:
|
|
588
|
-
g(s(
|
|
588
|
+
icon: f(() => [
|
|
589
|
+
g(s(q), { name: "search" })
|
|
589
590
|
]),
|
|
590
|
-
default:
|
|
591
|
-
y(" " +
|
|
591
|
+
default: f(() => [
|
|
592
|
+
y(" " + h(s(l)("panel.find-chats")), 1)
|
|
592
593
|
]),
|
|
593
594
|
_: 1
|
|
594
595
|
}),
|
|
595
|
-
(p(!0), w(
|
|
596
|
+
(p(!0), w(F, null, L(k.value, (c) => (p(), _(s(O), {
|
|
596
597
|
key: c.name,
|
|
597
598
|
variant: "outline",
|
|
598
599
|
size: "sm",
|
|
599
|
-
onClick: (
|
|
600
|
+
onClick: (T) => C({ variable: c.name })
|
|
600
601
|
}, {
|
|
601
|
-
default:
|
|
602
|
-
y(
|
|
602
|
+
default: f(() => [
|
|
603
|
+
y(h(s(l)("panel.addressee", { label: c.label })), 1)
|
|
603
604
|
]),
|
|
604
605
|
_: 2
|
|
605
606
|
}, 1032, ["onClick"]))), 128))
|
|
@@ -608,10 +609,10 @@ const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
|
|
|
608
609
|
}))
|
|
609
610
|
]));
|
|
610
611
|
}
|
|
611
|
-
}),
|
|
612
|
+
}), dt = /* @__PURE__ */ B(ct, [["__scopeId", "data-v-22102841"]]), ut = { class: "wx-notifications-recipients" }, pt = /* @__PURE__ */ P({
|
|
612
613
|
name: "WxNotificationsEmailsField",
|
|
613
614
|
__name: "EmailsField",
|
|
614
|
-
props: /* @__PURE__ */
|
|
615
|
+
props: /* @__PURE__ */ G({
|
|
615
616
|
disabled: { type: Boolean, default: !1 }
|
|
616
617
|
}, {
|
|
617
618
|
modelValue: { default: () => [] },
|
|
@@ -619,124 +620,125 @@ const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
|
|
|
619
620
|
}),
|
|
620
621
|
emits: ["update:modelValue"],
|
|
621
622
|
setup(t) {
|
|
622
|
-
const e = t, a =
|
|
623
|
-
|
|
624
|
-
const l =
|
|
625
|
-
|
|
623
|
+
const e = t, a = K(t, "modelValue");
|
|
624
|
+
U();
|
|
625
|
+
const l = R("webx-notifications"), n = be(), i = X(), r = Q(), u = A([]);
|
|
626
|
+
ae(async () => {
|
|
626
627
|
try {
|
|
627
|
-
|
|
628
|
+
u.value = await ye(r).administrators();
|
|
628
629
|
} catch {
|
|
629
630
|
}
|
|
630
631
|
});
|
|
631
|
-
const
|
|
632
|
-
() =>
|
|
633
|
-
),
|
|
634
|
-
() =>
|
|
632
|
+
const b = m(() => Array.isArray(a.value) ? a.value : []), k = m(
|
|
633
|
+
() => u.value.map((o) => ({ value: o.id, label: `${o.name} · ${o.email}` }))
|
|
634
|
+
), v = m(() => _e(i.event.value, "email")), x = m(
|
|
635
|
+
() => v.value.filter((o) => !b.value.some((d) => d.variable === o.name))
|
|
635
636
|
);
|
|
636
|
-
function
|
|
637
|
-
return
|
|
637
|
+
function C(o) {
|
|
638
|
+
return v.value.find((d) => d.name === o)?.label ?? `{{${o}}}`;
|
|
638
639
|
}
|
|
639
|
-
function
|
|
640
|
-
a.value =
|
|
640
|
+
function N(o, d) {
|
|
641
|
+
a.value = b.value.map((c, T) => T === o ? d : c);
|
|
641
642
|
}
|
|
642
|
-
function S(
|
|
643
|
-
a.value = [...
|
|
643
|
+
function S(o) {
|
|
644
|
+
a.value = [...b.value, o];
|
|
644
645
|
}
|
|
645
|
-
function
|
|
646
|
-
a.value =
|
|
646
|
+
function $(o) {
|
|
647
|
+
a.value = b.value.filter((d, c) => c !== o);
|
|
647
648
|
}
|
|
648
|
-
function
|
|
649
|
-
return
|
|
649
|
+
function V(o) {
|
|
650
|
+
return k.value.some((d) => d.value === o) ? k.value : [...k.value, { value: o, label: l("panel.admin-unknown", { id: String(o) }) }];
|
|
650
651
|
}
|
|
651
|
-
return (
|
|
652
|
-
|
|
652
|
+
return (o, d) => (p(), w("div", ut, [
|
|
653
|
+
b.value.length === 0 ? (p(), _(s(W), {
|
|
653
654
|
key: 0,
|
|
654
655
|
size: "sm",
|
|
655
656
|
tone: "placeholder"
|
|
656
657
|
}, {
|
|
657
|
-
default:
|
|
658
|
-
y(
|
|
658
|
+
default: f(() => [
|
|
659
|
+
y(h(s(l)("panel.no-recipients")), 1)
|
|
659
660
|
]),
|
|
660
661
|
_: 1
|
|
661
|
-
})) :
|
|
662
|
-
(p(!0), w(
|
|
663
|
-
key:
|
|
662
|
+
})) : j("", !0),
|
|
663
|
+
(p(!0), w(F, null, L(b.value, (c, T) => (p(), w("div", {
|
|
664
|
+
key: T,
|
|
664
665
|
class: "wx-notifications-recipients__row"
|
|
665
666
|
}, [
|
|
666
|
-
c.variable ? (p(),
|
|
667
|
+
c.variable ? (p(), _(s(le), {
|
|
667
668
|
key: 0,
|
|
668
669
|
type: "primary",
|
|
669
670
|
class: "wx-notifications-recipients__wide"
|
|
670
671
|
}, {
|
|
671
|
-
default:
|
|
672
|
-
y(
|
|
672
|
+
default: f(() => [
|
|
673
|
+
y(h(s(l)("panel.addressee", { label: C(c.variable) })), 1)
|
|
673
674
|
]),
|
|
674
675
|
_: 2
|
|
675
|
-
}, 1024)) : c.admin_id !== void 0 ? (p(),
|
|
676
|
+
}, 1024)) : c.admin_id !== void 0 ? (p(), _(s(Re), {
|
|
676
677
|
key: 1,
|
|
677
678
|
class: "wx-notifications-recipients__wide",
|
|
678
679
|
"model-value": c.admin_id,
|
|
679
|
-
options:
|
|
680
|
+
options: V(c.admin_id),
|
|
680
681
|
disabled: e.disabled,
|
|
681
|
-
"onUpdate:modelValue": (
|
|
682
|
-
}, null, 8, ["model-value", "options", "disabled", "onUpdate:modelValue"])) : (p(),
|
|
682
|
+
"onUpdate:modelValue": (z) => N(T, { admin_id: Number(z) })
|
|
683
|
+
}, null, 8, ["model-value", "options", "disabled", "onUpdate:modelValue"])) : (p(), _(s(J), {
|
|
683
684
|
key: 2,
|
|
684
685
|
class: "wx-notifications-recipients__wide",
|
|
685
686
|
type: "email",
|
|
686
687
|
"model-value": c.email ?? "",
|
|
687
688
|
placeholder: "manager@site.test",
|
|
688
689
|
disabled: e.disabled,
|
|
689
|
-
"onUpdate:modelValue": (
|
|
690
|
+
"onUpdate:modelValue": (z) => N(T, { email: String(z ?? "") })
|
|
690
691
|
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])),
|
|
691
|
-
e.disabled ?
|
|
692
|
+
e.disabled ? j("", !0) : (p(), _(s(he), fe({
|
|
692
693
|
key: 3,
|
|
693
694
|
icon: "trash",
|
|
694
695
|
tone: "danger",
|
|
695
|
-
title: s(l)("panel.remove")
|
|
696
|
-
|
|
697
|
-
|
|
696
|
+
title: s(l)("panel.remove")
|
|
697
|
+
}, { ref_for: !0 }, s(n), {
|
|
698
|
+
onClick: (z) => $(T)
|
|
699
|
+
}), null, 16, ["title", "onClick"]))
|
|
698
700
|
]))), 128)),
|
|
699
|
-
e.disabled ?
|
|
701
|
+
e.disabled ? j("", !0) : (p(), _(s(se), {
|
|
700
702
|
key: 1,
|
|
701
703
|
size: "sm",
|
|
702
704
|
wrap: ""
|
|
703
705
|
}, {
|
|
704
|
-
default:
|
|
705
|
-
g(s(
|
|
706
|
+
default: f(() => [
|
|
707
|
+
g(s(O), {
|
|
706
708
|
variant: "outline",
|
|
707
709
|
size: "sm",
|
|
708
|
-
disabled:
|
|
709
|
-
onClick:
|
|
710
|
+
disabled: k.value.length === 0,
|
|
711
|
+
onClick: d[0] || (d[0] = (c) => S({ admin_id: Number(k.value[0]?.value) }))
|
|
710
712
|
}, {
|
|
711
|
-
icon:
|
|
712
|
-
g(s(
|
|
713
|
+
icon: f(() => [
|
|
714
|
+
g(s(q), { name: "user" })
|
|
713
715
|
]),
|
|
714
|
-
default:
|
|
715
|
-
y(" " +
|
|
716
|
+
default: f(() => [
|
|
717
|
+
y(" " + h(s(l)("panel.add-admin")), 1)
|
|
716
718
|
]),
|
|
717
719
|
_: 1
|
|
718
720
|
}, 8, ["disabled"]),
|
|
719
|
-
g(s(
|
|
721
|
+
g(s(O), {
|
|
720
722
|
variant: "outline",
|
|
721
723
|
size: "sm",
|
|
722
|
-
onClick:
|
|
724
|
+
onClick: d[1] || (d[1] = (c) => S({ email: "" }))
|
|
723
725
|
}, {
|
|
724
|
-
icon:
|
|
725
|
-
g(s(
|
|
726
|
+
icon: f(() => [
|
|
727
|
+
g(s(q), { name: "mail" })
|
|
726
728
|
]),
|
|
727
|
-
default:
|
|
728
|
-
y(" " +
|
|
729
|
+
default: f(() => [
|
|
730
|
+
y(" " + h(s(l)("panel.add-email")), 1)
|
|
729
731
|
]),
|
|
730
732
|
_: 1
|
|
731
733
|
}),
|
|
732
|
-
(p(!0), w(
|
|
734
|
+
(p(!0), w(F, null, L(x.value, (c) => (p(), _(s(O), {
|
|
733
735
|
key: c.name,
|
|
734
736
|
variant: "outline",
|
|
735
737
|
size: "sm",
|
|
736
|
-
onClick: (
|
|
738
|
+
onClick: (T) => S({ variable: c.name })
|
|
737
739
|
}, {
|
|
738
|
-
default:
|
|
739
|
-
y(
|
|
740
|
+
default: f(() => [
|
|
741
|
+
y(h(s(l)("panel.addressee", { label: c.label })), 1)
|
|
740
742
|
]),
|
|
741
743
|
_: 2
|
|
742
744
|
}, 1032, ["onClick"]))), 128))
|
|
@@ -745,194 +747,194 @@ const st = { class: "wx-notifications-recipients" }, it = /* @__PURE__ */ L({
|
|
|
745
747
|
}))
|
|
746
748
|
]));
|
|
747
749
|
}
|
|
748
|
-
}),
|
|
749
|
-
function
|
|
750
|
+
}), ft = /* @__PURE__ */ B(pt, [["__scopeId", "data-v-6ed21265"]]);
|
|
751
|
+
function ke(t, e) {
|
|
750
752
|
return !t || !e ? null : t.sample[e] ?? t.sample["*"] ?? null;
|
|
751
753
|
}
|
|
752
|
-
function
|
|
753
|
-
return t == null ? !0 : typeof t == "string" ? t.trim() === "" : typeof t == "object" ? Object.values(t).every((e) =>
|
|
754
|
+
function I(t) {
|
|
755
|
+
return t == null ? !0 : typeof t == "string" ? t.trim() === "" : typeof t == "object" ? Object.values(t).every((e) => I(e)) : !1;
|
|
754
756
|
}
|
|
755
|
-
function
|
|
757
|
+
function xe(t, e, a) {
|
|
756
758
|
return {
|
|
757
759
|
...t,
|
|
758
760
|
template: { ...e.template },
|
|
759
761
|
...a && e.subject !== null ? { subject: { ...e.subject } } : {}
|
|
760
762
|
};
|
|
761
763
|
}
|
|
762
|
-
function
|
|
763
|
-
|
|
764
|
+
function Jt(t, e, a) {
|
|
765
|
+
je(
|
|
764
766
|
() => t.values.value.event,
|
|
765
767
|
(l, n) => {
|
|
766
768
|
if (e.value || l === n) return;
|
|
767
|
-
const i =
|
|
768
|
-
i === null || !
|
|
769
|
+
const i = ke(t.event.value, t.provider.value?.key), r = t.provider.value?.subject ?? !1, u = t.values.value;
|
|
770
|
+
i === null || !I(u.template) || r && !I(u.subject) || (t.values.value = xe(u, i, r), a());
|
|
769
771
|
},
|
|
770
772
|
{ flush: "sync" }
|
|
771
773
|
);
|
|
772
774
|
}
|
|
773
|
-
class
|
|
775
|
+
class M extends Error {
|
|
774
776
|
constructor(e, a = {}) {
|
|
775
777
|
super(e), this.key = e, this.replace = a, this.name = "TemplateRefusal";
|
|
776
778
|
}
|
|
777
779
|
key;
|
|
778
780
|
replace;
|
|
779
781
|
}
|
|
780
|
-
const
|
|
781
|
-
function
|
|
782
|
+
const mt = /^[a-z0-9_]+(\.[a-z0-9_]+)?$/;
|
|
783
|
+
function $e(t) {
|
|
782
784
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
783
785
|
}
|
|
784
|
-
function
|
|
786
|
+
function ce(t) {
|
|
785
787
|
return t.replace(/[\r\n]+/g, " ");
|
|
786
788
|
}
|
|
787
|
-
function
|
|
788
|
-
return
|
|
789
|
+
function ht(t, e = "") {
|
|
790
|
+
return ie(t, e) ? vt : t === "telegram" ? $e : (a) => a;
|
|
789
791
|
}
|
|
790
|
-
function
|
|
792
|
+
function ie(t, e) {
|
|
791
793
|
return t === "email" && /^\s*<[a-zA-Z]/.test(e);
|
|
792
794
|
}
|
|
793
|
-
function
|
|
794
|
-
return
|
|
795
|
+
function vt(t) {
|
|
796
|
+
return $e(t).replace(/\r\n|\r|\n/g, "<br>");
|
|
795
797
|
}
|
|
796
|
-
function
|
|
798
|
+
function Z(t) {
|
|
797
799
|
const e = document.createElement("textarea");
|
|
798
800
|
return e.innerHTML = t, e.value;
|
|
799
801
|
}
|
|
800
|
-
const
|
|
801
|
-
function
|
|
802
|
+
const bt = "p|h[1-6]|table|ul|ol|blockquote|pre", gt = "tr|div";
|
|
803
|
+
function wt(t) {
|
|
802
804
|
let e = t.replace(/[ \t\r\n\f]+/g, " ");
|
|
803
805
|
return e = e.replace(
|
|
804
806
|
/<a\b[^>]*?\bhref\s*=\s*"([^"]*)"[^>]*>([\s\S]*?)<\/a\s*>/gi,
|
|
805
807
|
(l, n, i) => {
|
|
806
|
-
const
|
|
807
|
-
return
|
|
808
|
+
const r = Z(n), u = Z(i.replace(/<[^>]*>/g, "")).trim();
|
|
809
|
+
return u === "" || u === r ? r : /^(https?:|mailto:)/i.test(r) ? `${i} (${n})` : i;
|
|
808
810
|
}
|
|
809
811
|
), e = e.replace(/<br\s*\/?>/gi, `
|
|
810
812
|
`), e = e.replace(/<\/t[dh]\s*>\s*(?=<t[dh][\s>])/gi, ": "), e = e.replace(/<li\b[^>]*>/gi, `
|
|
811
|
-
- `), e = e.replace(new RegExp(`<hr\\b[^>]*>|</?(?:${
|
|
813
|
+
- `), e = e.replace(new RegExp(`<hr\\b[^>]*>|</?(?:${bt})\\b[^>]*>`, "gi"), `
|
|
812
814
|
|
|
813
|
-
`), e = e.replace(new RegExp(`<div\\b[^>]*>|</(?:${
|
|
814
|
-
`), e =
|
|
815
|
+
`), e = e.replace(new RegExp(`<div\\b[^>]*>|</(?:${gt})\\s*>`, "gi"), `
|
|
816
|
+
`), e = Z(e.replace(/<[^>]*>/g, "")), e.split(`
|
|
815
817
|
`).map((l) => l.replace(/ {2,}/g, " ").trim()).join(`
|
|
816
818
|
`).replace(/\n{3,}/g, `
|
|
817
819
|
|
|
818
820
|
`).trim();
|
|
819
821
|
}
|
|
820
|
-
function
|
|
822
|
+
function yt(t) {
|
|
821
823
|
try {
|
|
822
|
-
return
|
|
824
|
+
return Qe.parse(t, ["{{", "}}"]);
|
|
823
825
|
} catch (e) {
|
|
824
826
|
const a = e instanceof Error ? e.message : String(e), l = /section "([^"]*)"/.exec(a)?.[1] ?? "";
|
|
825
827
|
if (a.startsWith("Unopened section"))
|
|
826
|
-
throw new
|
|
828
|
+
throw new M("template-unexpected", { section: l });
|
|
827
829
|
if (a.startsWith("Unclosed section"))
|
|
828
|
-
throw new
|
|
830
|
+
throw new M("template-unclosed", { section: l });
|
|
829
831
|
const n = Number(/at (\d+)/.exec(a)?.[1] ?? t.lastIndexOf("{{")), i = t.slice(n).replace(/^\{\{\{?[#^/!&>=]?/, "").trim();
|
|
830
|
-
throw new
|
|
832
|
+
throw new M("template-tag", { tag: i });
|
|
831
833
|
}
|
|
832
834
|
}
|
|
833
|
-
function
|
|
835
|
+
function Te(t) {
|
|
834
836
|
for (const e of t) {
|
|
835
837
|
const [a, l] = e;
|
|
836
|
-
if (a === ">") throw new
|
|
837
|
-
if (a === "=") throw new
|
|
838
|
+
if (a === ">") throw new M("template-partial");
|
|
839
|
+
if (a === "=") throw new M("template-delimiters");
|
|
838
840
|
if (a === "text" || a === "!") continue;
|
|
839
841
|
const n = l.trim();
|
|
840
|
-
if (n.startsWith("<")) throw new
|
|
841
|
-
if (n.startsWith("%") || n.startsWith("$")) throw new
|
|
842
|
-
if (!
|
|
843
|
-
e[4] &&
|
|
842
|
+
if (n.startsWith("<")) throw new M("template-partial");
|
|
843
|
+
if (n.startsWith("%") || n.startsWith("$")) throw new M("template-pragma");
|
|
844
|
+
if (!mt.test(n)) throw new M("template-name", { name: n });
|
|
845
|
+
e[4] && Te(e[4]);
|
|
844
846
|
}
|
|
845
847
|
}
|
|
846
|
-
function
|
|
848
|
+
function _t(t) {
|
|
847
849
|
const e = {};
|
|
848
850
|
for (const [a, l] of Object.entries(t)) {
|
|
849
851
|
if (!a.includes(".")) {
|
|
850
852
|
e[a] = l;
|
|
851
853
|
continue;
|
|
852
854
|
}
|
|
853
|
-
const [n, ...i] = a.split("."),
|
|
854
|
-
(
|
|
855
|
+
const [n, ...i] = a.split("."), r = n, u = e[r];
|
|
856
|
+
(u === void 0 || E(u)) && (e[r] = { ...E(u) ? u : {}, [i.join(".")]: l });
|
|
855
857
|
}
|
|
856
858
|
return e;
|
|
857
859
|
}
|
|
858
|
-
function
|
|
860
|
+
function E(t) {
|
|
859
861
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
860
862
|
}
|
|
861
|
-
function
|
|
862
|
-
return t == null || t === !1 || t === "" || t === "0" || t === 0 ? !0 : Array.isArray(t) ? t.length === 0 :
|
|
863
|
+
function de(t) {
|
|
864
|
+
return t == null || t === !1 || t === "" || t === "0" || t === 0 ? !0 : Array.isArray(t) ? t.length === 0 : E(t) ? Object.keys(t).length === 0 : !1;
|
|
863
865
|
}
|
|
864
|
-
function
|
|
866
|
+
function kt(t, e) {
|
|
865
867
|
const [a, ...l] = e.split(".");
|
|
866
868
|
let n;
|
|
867
869
|
for (let i = t.length - 1; i >= 0; i--) {
|
|
868
|
-
const
|
|
869
|
-
if (
|
|
870
|
-
n =
|
|
870
|
+
const r = t[i];
|
|
871
|
+
if (E(r) && Object.prototype.hasOwnProperty.call(r, a)) {
|
|
872
|
+
n = r[a];
|
|
871
873
|
break;
|
|
872
874
|
}
|
|
873
875
|
}
|
|
874
876
|
for (const i of l) {
|
|
875
877
|
if (n === "" || n === void 0) return n;
|
|
876
|
-
n =
|
|
878
|
+
n = E(n) && Object.prototype.hasOwnProperty.call(n, i) ? n[i] : "";
|
|
877
879
|
}
|
|
878
880
|
return n;
|
|
879
881
|
}
|
|
880
|
-
function
|
|
882
|
+
function xt(t) {
|
|
881
883
|
return typeof t == "string" ? t : typeof t == "number" ? String(t) : t === !0 ? "1" : "";
|
|
882
884
|
}
|
|
883
|
-
function
|
|
885
|
+
function ee(t, e, a) {
|
|
884
886
|
let l = "";
|
|
885
887
|
for (const n of t) {
|
|
886
|
-
const [i,
|
|
888
|
+
const [i, r] = n;
|
|
887
889
|
if (i === "text") {
|
|
888
|
-
l +=
|
|
890
|
+
l += r;
|
|
889
891
|
continue;
|
|
890
892
|
}
|
|
891
893
|
if (i === "!") continue;
|
|
892
|
-
const
|
|
894
|
+
const u = kt(e, r.trim());
|
|
893
895
|
if (i === "name" || i === "&") {
|
|
894
|
-
l +=
|
|
896
|
+
l += E(u) || Array.isArray(u) ? "" : a(xt(u));
|
|
895
897
|
continue;
|
|
896
898
|
}
|
|
897
|
-
const
|
|
898
|
-
if (i === "#" && !
|
|
899
|
-
for (const
|
|
900
|
-
l +=
|
|
901
|
-
i === "^" &&
|
|
899
|
+
const b = n[4] ?? [];
|
|
900
|
+
if (i === "#" && !de(u))
|
|
901
|
+
for (const k of Array.isArray(u) ? u : [u])
|
|
902
|
+
l += ee(b, [...e, k], a);
|
|
903
|
+
i === "^" && de(u) && (l += ee(b, e, a));
|
|
902
904
|
}
|
|
903
905
|
return l;
|
|
904
906
|
}
|
|
905
|
-
function
|
|
907
|
+
function te(t, e = [], a = []) {
|
|
906
908
|
for (const l of t) {
|
|
907
909
|
const [n, i] = l;
|
|
908
910
|
if (n === "text" || n === "!") continue;
|
|
909
|
-
const
|
|
910
|
-
a.push({ name:
|
|
911
|
+
const r = i.trim();
|
|
912
|
+
a.push({ name: r, sections: e }), n === "#" && te(l[4] ?? [], [...e, r], a), n === "^" && te(l[4] ?? [], e, a);
|
|
911
913
|
}
|
|
912
914
|
return a;
|
|
913
915
|
}
|
|
914
|
-
function
|
|
916
|
+
function ue(t, e) {
|
|
915
917
|
const [a, ...l] = e.split(".");
|
|
916
918
|
for (const n of [...t].reverse()) {
|
|
917
|
-
if (!
|
|
919
|
+
if (!E(n) || !Object.prototype.hasOwnProperty.call(n, a)) continue;
|
|
918
920
|
let i = n[a];
|
|
919
|
-
for (const
|
|
920
|
-
if (!
|
|
921
|
-
i = i[
|
|
921
|
+
for (const r of l) {
|
|
922
|
+
if (!E(i) || !Object.prototype.hasOwnProperty.call(i, r)) return null;
|
|
923
|
+
i = i[r];
|
|
922
924
|
}
|
|
923
925
|
return i ?? null;
|
|
924
926
|
}
|
|
925
927
|
return null;
|
|
926
928
|
}
|
|
927
|
-
function
|
|
929
|
+
function $t(t, e, a) {
|
|
928
930
|
const l = [t];
|
|
929
931
|
for (const n of a) {
|
|
930
|
-
const i =
|
|
931
|
-
Array.isArray(i) ? l.push(Object.assign({}, ...i.filter(
|
|
932
|
+
const i = ue(l, n);
|
|
933
|
+
Array.isArray(i) ? l.push(Object.assign({}, ...i.filter(E))) : E(i) && l.push(i);
|
|
932
934
|
}
|
|
933
|
-
return
|
|
935
|
+
return ue(l, e) !== null;
|
|
934
936
|
}
|
|
935
|
-
function
|
|
937
|
+
function Tt(t, e, a) {
|
|
936
938
|
for (const l of [...a].reverse()) {
|
|
937
939
|
const n = t.variables.find((i) => i.name === l);
|
|
938
940
|
if (n && n.fields.length > 0 && n.fields.some((i) => i.name === e))
|
|
@@ -942,47 +944,47 @@ function kt(t, e, a) {
|
|
|
942
944
|
(l) => l.name === e || l.name.endsWith(".*") && e.startsWith(l.name.slice(0, -1))
|
|
943
945
|
);
|
|
944
946
|
}
|
|
945
|
-
function
|
|
946
|
-
const n =
|
|
947
|
-
|
|
948
|
-
const i =
|
|
949
|
-
for (const
|
|
950
|
-
|
|
951
|
-
return { text:
|
|
947
|
+
function pe(t, e, a, l) {
|
|
948
|
+
const n = yt(t);
|
|
949
|
+
Te(n);
|
|
950
|
+
const i = _t(e), r = /* @__PURE__ */ new Set();
|
|
951
|
+
for (const u of te(n))
|
|
952
|
+
!$t(i, u.name, u.sections) && !l?.(u.name, u.sections) && r.add(u.name);
|
|
953
|
+
return { text: ee(n, [i], a), unknown: [...r] };
|
|
952
954
|
}
|
|
953
|
-
function
|
|
955
|
+
function Ct(t) {
|
|
954
956
|
const e = {};
|
|
955
957
|
for (const a of t?.variables ?? [])
|
|
956
958
|
a.name.endsWith(".*") || (e[a.name] = a.example);
|
|
957
959
|
return e;
|
|
958
960
|
}
|
|
959
|
-
function
|
|
961
|
+
function St(t) {
|
|
960
962
|
return new DOMParser().parseFromString(`<body>${t}</body>`, "text/html").body.textContent ?? "";
|
|
961
963
|
}
|
|
962
|
-
function
|
|
963
|
-
const e =
|
|
964
|
-
let
|
|
964
|
+
function At(t) {
|
|
965
|
+
const e = ie(t.provider, t.template), a = ht(t.provider, t.template), l = t.event ?? null, n = l === null ? void 0 : (v, x) => Tt(l, v, x), i = pe(t.template, t.values, a, n);
|
|
966
|
+
let r = null, u = i.unknown;
|
|
965
967
|
if (t.hasSubject) {
|
|
966
|
-
const
|
|
967
|
-
|
|
968
|
+
const v = pe(t.subject ?? "", t.values, ce, n);
|
|
969
|
+
r = ce(v.text).trim(), u = [.../* @__PURE__ */ new Set([...u, ...v.unknown])];
|
|
968
970
|
}
|
|
969
|
-
const
|
|
970
|
-
if (
|
|
971
|
-
const
|
|
972
|
-
return { subject:
|
|
971
|
+
const b = e ? wt(i.text) : t.provider === "telegram" ? St(i.text) : i.text, k = t.limit ?? null;
|
|
972
|
+
if (k !== null && [...b].length > k) {
|
|
973
|
+
const v = `${[...b].slice(0, k - 1).join("")}…`;
|
|
974
|
+
return { subject: r, body: a(v), plain: v, truncated: !0, unknown: u, html: e };
|
|
973
975
|
}
|
|
974
|
-
return { subject:
|
|
976
|
+
return { subject: r, body: i.text, plain: b, truncated: !1, unknown: u, html: e };
|
|
975
977
|
}
|
|
976
|
-
const
|
|
978
|
+
const jt = { class: "wx-notifications-template" }, Wt = {
|
|
977
979
|
key: 0,
|
|
978
980
|
class: "wx-notifications-template__variables"
|
|
979
|
-
},
|
|
981
|
+
}, Nt = { class: "wx-notifications-template__chips" }, Vt = { class: "wx-notifications-template__name" }, Ot = {
|
|
980
982
|
key: 2,
|
|
981
983
|
class: "wx-notifications-template__default"
|
|
982
|
-
},
|
|
984
|
+
}, zt = /* @__PURE__ */ P({
|
|
983
985
|
name: "WxNotificationsTemplateField",
|
|
984
986
|
__name: "TemplateField",
|
|
985
|
-
props: /* @__PURE__ */
|
|
987
|
+
props: /* @__PURE__ */ G({
|
|
986
988
|
localized: { type: Boolean, default: !1 },
|
|
987
989
|
disabled: { type: Boolean, default: void 0 },
|
|
988
990
|
minHeight: { default: "200px" },
|
|
@@ -995,10 +997,10 @@ const Ct = { class: "wx-notifications-template" }, St = {
|
|
|
995
997
|
}),
|
|
996
998
|
emits: ["update:modelValue"],
|
|
997
999
|
setup(t) {
|
|
998
|
-
const e = t, a =
|
|
999
|
-
|
|
1000
|
-
const l =
|
|
1001
|
-
() =>
|
|
1000
|
+
const e = t, a = K(t, "modelValue");
|
|
1001
|
+
U();
|
|
1002
|
+
const l = R("webx-notifications"), n = X(), i = ve(), r = A(null), u = m(() => it(n.event.value)), b = m(
|
|
1003
|
+
() => Ue(u.value, {
|
|
1002
1004
|
variable: l("panel.hint-variable"),
|
|
1003
1005
|
list: l("panel.hint-list"),
|
|
1004
1006
|
field: l("panel.hint-field"),
|
|
@@ -1008,131 +1010,131 @@ const Ct = { class: "wx-notifications-template" }, St = {
|
|
|
1008
1010
|
comment: l("panel.hint-comment"),
|
|
1009
1011
|
example: l("panel.hint-example")
|
|
1010
1012
|
})
|
|
1011
|
-
),
|
|
1012
|
-
const
|
|
1013
|
-
if (
|
|
1014
|
-
if (typeof
|
|
1015
|
-
const
|
|
1016
|
-
return
|
|
1017
|
-
}),
|
|
1013
|
+
), k = m(() => {
|
|
1014
|
+
const o = a.value;
|
|
1015
|
+
if (o == null) return "";
|
|
1016
|
+
if (typeof o == "string") return o;
|
|
1017
|
+
const d = i.active.value || i.list.value[0]?.code || "";
|
|
1018
|
+
return o[d] ?? "";
|
|
1019
|
+
}), v = m(() => {
|
|
1018
1020
|
if (e.singleLine) return "mustache";
|
|
1019
|
-
const
|
|
1020
|
-
return
|
|
1021
|
-
}),
|
|
1022
|
-
() =>
|
|
1023
|
-
), C =
|
|
1024
|
-
const
|
|
1021
|
+
const o = n.provider.value?.key ?? "";
|
|
1022
|
+
return o === "telegram" || ie(o, k.value) ? "mustache-html" : "mustache";
|
|
1023
|
+
}), x = m(
|
|
1024
|
+
() => Be(k.value, n.event.value === null ? void 0 : u.value)
|
|
1025
|
+
), C = m(() => {
|
|
1026
|
+
const o = x.value;
|
|
1025
1027
|
return [
|
|
1026
|
-
...
|
|
1027
|
-
...
|
|
1028
|
-
...
|
|
1029
|
-
...
|
|
1030
|
-
...
|
|
1028
|
+
...o.unclosed.map((d) => l("panel.problem-unclosed", { name: d })),
|
|
1029
|
+
...o.stray.map((d) => l("panel.problem-stray", { name: d })),
|
|
1030
|
+
...o.refused.map((d) => l("panel.problem-refused", { tag: d })),
|
|
1031
|
+
...o.broken ? [l("panel.problem-broken")] : [],
|
|
1032
|
+
...o.unknown.length > 0 ? [
|
|
1031
1033
|
l("panel.problem-unknown", {
|
|
1032
|
-
names:
|
|
1034
|
+
names: o.unknown.map((d) => `{{${d}}}`).join(", ")
|
|
1033
1035
|
})
|
|
1034
1036
|
] : []
|
|
1035
1037
|
];
|
|
1036
1038
|
});
|
|
1037
|
-
function
|
|
1038
|
-
if ((
|
|
1039
|
+
function N(o) {
|
|
1040
|
+
if ((o.fields?.length ?? 0) > 0)
|
|
1039
1041
|
return l("panel.variable-list", {
|
|
1040
|
-
fields: (
|
|
1042
|
+
fields: (o.fields ?? []).map((c) => c.name).join(", ")
|
|
1041
1043
|
});
|
|
1042
|
-
const
|
|
1043
|
-
return typeof
|
|
1044
|
+
const d = o.example;
|
|
1045
|
+
return typeof d == "string" || typeof d == "number" ? String(d) : "";
|
|
1044
1046
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const
|
|
1047
|
-
if (!
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
changes: { from:
|
|
1051
|
-
selection: { anchor:
|
|
1047
|
+
function S(o) {
|
|
1048
|
+
const d = r.value?.view;
|
|
1049
|
+
if (!d) return;
|
|
1050
|
+
const c = d.state.selection.main;
|
|
1051
|
+
d.dispatch({
|
|
1052
|
+
changes: { from: c.from, to: c.to, insert: o },
|
|
1053
|
+
selection: { anchor: c.from + o.length },
|
|
1052
1054
|
scrollIntoView: !0
|
|
1053
|
-
}),
|
|
1055
|
+
}), d.focus();
|
|
1054
1056
|
}
|
|
1055
|
-
|
|
1056
|
-
n.inserters.get(e.part) ===
|
|
1057
|
+
ae(() => n.inserters.set(e.part, S)), We(() => {
|
|
1058
|
+
n.inserters.get(e.part) === S && n.inserters.delete(e.part);
|
|
1057
1059
|
});
|
|
1058
|
-
const
|
|
1059
|
-
async function
|
|
1060
|
-
const
|
|
1061
|
-
if (
|
|
1062
|
-
const
|
|
1063
|
-
(!
|
|
1060
|
+
const $ = m(() => ke(n.event.value, n.provider.value?.key));
|
|
1061
|
+
async function V() {
|
|
1062
|
+
const o = $.value;
|
|
1063
|
+
if (o === null) return;
|
|
1064
|
+
const d = n.values.value, c = n.provider.value?.subject ?? !1;
|
|
1065
|
+
(!I(d.template) || c && !I(d.subject)) && !await He({
|
|
1064
1066
|
title: l("panel.default-title"),
|
|
1065
1067
|
message: l("panel.default-text"),
|
|
1066
1068
|
confirmText: l("panel.default-replace"),
|
|
1067
1069
|
cancelText: l("panel.cancel")
|
|
1068
|
-
}) || (n.values.value =
|
|
1070
|
+
}) || (n.values.value = xe(n.values.value, o, c), Y.info(l("panel.default-inserted")));
|
|
1069
1071
|
}
|
|
1070
|
-
return (
|
|
1071
|
-
g(s(
|
|
1072
|
+
return (o, d) => (p(), w("div", jt, [
|
|
1073
|
+
g(s(Ie), {
|
|
1072
1074
|
ref_key: "editor",
|
|
1073
|
-
ref:
|
|
1075
|
+
ref: r,
|
|
1074
1076
|
modelValue: a.value,
|
|
1075
|
-
"onUpdate:modelValue":
|
|
1076
|
-
language:
|
|
1077
|
-
completions:
|
|
1077
|
+
"onUpdate:modelValue": d[0] || (d[0] = (c) => a.value = c),
|
|
1078
|
+
language: v.value,
|
|
1079
|
+
completions: b.value,
|
|
1078
1080
|
localized: e.localized,
|
|
1079
1081
|
disabled: e.disabled,
|
|
1080
1082
|
"line-numbers": !1,
|
|
1081
1083
|
"line-wrapping": !e.singleLine,
|
|
1082
1084
|
"single-line": e.singleLine,
|
|
1083
1085
|
"min-height": e.singleLine ? void 0 : e.minHeight,
|
|
1084
|
-
onFocus:
|
|
1086
|
+
onFocus: d[1] || (d[1] = (c) => s(n).focused.value = e.part)
|
|
1085
1087
|
}, null, 8, ["modelValue", "language", "completions", "localized", "disabled", "line-wrapping", "single-line", "min-height"]),
|
|
1086
|
-
(p(!0), w(
|
|
1087
|
-
key:
|
|
1088
|
+
(p(!0), w(F, null, L(C.value, (c) => (p(), _(s(H), {
|
|
1089
|
+
key: c,
|
|
1088
1090
|
type: "warning",
|
|
1089
1091
|
variant: "soft",
|
|
1090
|
-
description:
|
|
1092
|
+
description: c
|
|
1091
1093
|
}, null, 8, ["description"]))), 128)),
|
|
1092
|
-
e.chips ? (p(), w("div",
|
|
1093
|
-
g(s(
|
|
1094
|
+
e.chips ? (p(), w("div", Wt, [
|
|
1095
|
+
g(s(W), {
|
|
1094
1096
|
size: "sm",
|
|
1095
1097
|
weight: "medium"
|
|
1096
1098
|
}, {
|
|
1097
|
-
default:
|
|
1098
|
-
y(
|
|
1099
|
+
default: f(() => [
|
|
1100
|
+
y(h(s(l)("panel.variables")), 1)
|
|
1099
1101
|
]),
|
|
1100
1102
|
_: 1
|
|
1101
1103
|
}),
|
|
1102
|
-
|
|
1104
|
+
u.value.length === 0 ? (p(), _(s(W), {
|
|
1103
1105
|
key: 0,
|
|
1104
1106
|
size: "sm",
|
|
1105
1107
|
tone: "muted"
|
|
1106
1108
|
}, {
|
|
1107
|
-
default:
|
|
1108
|
-
y(
|
|
1109
|
+
default: f(() => [
|
|
1110
|
+
y(h(s(l)("panel.variables-none")), 1)
|
|
1109
1111
|
]),
|
|
1110
1112
|
_: 1
|
|
1111
|
-
})) : (p(), w(
|
|
1112
|
-
g(s(
|
|
1113
|
+
})) : (p(), w(F, { key: 1 }, [
|
|
1114
|
+
g(s(W), {
|
|
1113
1115
|
size: "sm",
|
|
1114
1116
|
tone: "muted"
|
|
1115
1117
|
}, {
|
|
1116
|
-
default:
|
|
1117
|
-
y(
|
|
1118
|
+
default: f(() => [
|
|
1119
|
+
y(h(s(l)("panel.variables-help")), 1)
|
|
1118
1120
|
]),
|
|
1119
1121
|
_: 1
|
|
1120
1122
|
}),
|
|
1121
|
-
|
|
1122
|
-
(p(!0), w(
|
|
1123
|
-
key:
|
|
1124
|
-
content: [
|
|
1123
|
+
D("div", Nt, [
|
|
1124
|
+
(p(!0), w(F, null, L(u.value, (c) => (p(), _(s(De), {
|
|
1125
|
+
key: c.name,
|
|
1126
|
+
content: [c.label, N(c)].filter(Boolean).join(" — ")
|
|
1125
1127
|
}, {
|
|
1126
|
-
default:
|
|
1127
|
-
g(s(
|
|
1128
|
+
default: f(() => [
|
|
1129
|
+
g(s(O), {
|
|
1128
1130
|
size: "sm",
|
|
1129
1131
|
variant: "outline",
|
|
1130
1132
|
class: "wx-notifications-template__chip",
|
|
1131
1133
|
disabled: e.disabled,
|
|
1132
|
-
onClick: (
|
|
1134
|
+
onClick: (T) => s(n).insert(s(ot)(c))
|
|
1133
1135
|
}, {
|
|
1134
|
-
default:
|
|
1135
|
-
|
|
1136
|
+
default: f(() => [
|
|
1137
|
+
D("span", Vt, h((c.fields?.length ?? 0) > 0 ? `#${c.name}` : c.name), 1)
|
|
1136
1138
|
]),
|
|
1137
1139
|
_: 2
|
|
1138
1140
|
}, 1032, ["disabled", "onClick"])
|
|
@@ -1141,25 +1143,25 @@ const Ct = { class: "wx-notifications-template" }, St = {
|
|
|
1141
1143
|
}, 1032, ["content"]))), 128))
|
|
1142
1144
|
])
|
|
1143
1145
|
], 64)),
|
|
1144
|
-
|
|
1145
|
-
g(s(
|
|
1146
|
+
$.value ? (p(), w("div", Ot, [
|
|
1147
|
+
g(s(O), {
|
|
1146
1148
|
size: "sm",
|
|
1147
1149
|
variant: "text",
|
|
1148
1150
|
icon: "file-text",
|
|
1149
1151
|
disabled: e.disabled,
|
|
1150
|
-
onClick:
|
|
1152
|
+
onClick: V
|
|
1151
1153
|
}, {
|
|
1152
|
-
default:
|
|
1153
|
-
y(
|
|
1154
|
+
default: f(() => [
|
|
1155
|
+
y(h(s(l)("panel.default-insert")), 1)
|
|
1154
1156
|
]),
|
|
1155
1157
|
_: 1
|
|
1156
1158
|
}, 8, ["disabled"])
|
|
1157
|
-
])) :
|
|
1158
|
-
])) :
|
|
1159
|
+
])) : j("", !0)
|
|
1160
|
+
])) : j("", !0)
|
|
1159
1161
|
]));
|
|
1160
1162
|
}
|
|
1161
|
-
}),
|
|
1162
|
-
function
|
|
1163
|
+
}), Ft = /* @__PURE__ */ B(zt, [["__scopeId", "data-v-d491fffa"]]);
|
|
1164
|
+
function Yt(t = {}) {
|
|
1163
1165
|
const e = t.path ?? "/notifications";
|
|
1164
1166
|
return {
|
|
1165
1167
|
id: "notifications",
|
|
@@ -1168,35 +1170,35 @@ function Zt(t = {}) {
|
|
|
1168
1170
|
{
|
|
1169
1171
|
path: e,
|
|
1170
1172
|
name: "webx.notifications",
|
|
1171
|
-
component: () => import("./NotificationsPage-
|
|
1173
|
+
component: () => import("./NotificationsPage-BkTBIV0B.js"),
|
|
1172
1174
|
props: { base: e }
|
|
1173
1175
|
},
|
|
1174
1176
|
{
|
|
1175
1177
|
path: `${e}/channels/new`,
|
|
1176
1178
|
name: "webx.notifications.new",
|
|
1177
|
-
component: () => import("./ChannelPage-
|
|
1179
|
+
component: () => import("./ChannelPage-vxVhttk3.js"),
|
|
1178
1180
|
props: { base: e }
|
|
1179
1181
|
},
|
|
1180
1182
|
{
|
|
1181
1183
|
path: `${e}/channels/:id(\\d+)`,
|
|
1182
1184
|
name: "webx.notifications.channel",
|
|
1183
|
-
component: () => import("./ChannelPage-
|
|
1185
|
+
component: () => import("./ChannelPage-vxVhttk3.js"),
|
|
1184
1186
|
props: { base: e }
|
|
1185
1187
|
}
|
|
1186
1188
|
],
|
|
1187
1189
|
types: {
|
|
1188
|
-
"wx-notifications-template": { component:
|
|
1189
|
-
"wx-notifications-chats": { component:
|
|
1190
|
-
"wx-notifications-emails": { component:
|
|
1190
|
+
"wx-notifications-template": { component: Ft, kind: "field", wide: !0 },
|
|
1191
|
+
"wx-notifications-chats": { component: dt, kind: "field" },
|
|
1192
|
+
"wx-notifications-emails": { component: ft, kind: "field" },
|
|
1191
1193
|
"wx-notifications-channels": {
|
|
1192
|
-
component:
|
|
1194
|
+
component: Ye,
|
|
1193
1195
|
kind: "field",
|
|
1194
1196
|
bind: (a) => ({ event: a.props?.event, base: e })
|
|
1195
1197
|
}
|
|
1196
1198
|
}
|
|
1197
1199
|
};
|
|
1198
1200
|
}
|
|
1199
|
-
const
|
|
1201
|
+
const Et = /* @__PURE__ */ new Set([
|
|
1200
1202
|
"b",
|
|
1201
1203
|
"strong",
|
|
1202
1204
|
"i",
|
|
@@ -1213,7 +1215,7 @@ const Ot = /* @__PURE__ */ new Set([
|
|
|
1213
1215
|
"tg-spoiler",
|
|
1214
1216
|
"span"
|
|
1215
1217
|
]);
|
|
1216
|
-
function
|
|
1218
|
+
function ne(t, e, a) {
|
|
1217
1219
|
for (const l of Array.from(t.childNodes)) {
|
|
1218
1220
|
if (l.nodeType === Node.TEXT_NODE) {
|
|
1219
1221
|
e.appendChild(a.createTextNode(l.textContent ?? ""));
|
|
@@ -1221,194 +1223,194 @@ function te(t, e, a) {
|
|
|
1221
1223
|
}
|
|
1222
1224
|
if (!(l instanceof Element)) continue;
|
|
1223
1225
|
const n = l.tagName.toLowerCase();
|
|
1224
|
-
if (!
|
|
1225
|
-
|
|
1226
|
+
if (!Et.has(n) || n === "span" && !l.classList.contains("tg-spoiler")) {
|
|
1227
|
+
ne(l, e, a);
|
|
1226
1228
|
continue;
|
|
1227
1229
|
}
|
|
1228
1230
|
const i = a.createElement(n === "tg-spoiler" ? "span" : n);
|
|
1229
1231
|
if ((n === "tg-spoiler" || n === "span") && (i.className = "tg-spoiler"), n === "a") {
|
|
1230
|
-
const
|
|
1231
|
-
/^(https?:|tg:)/i.test(
|
|
1232
|
+
const r = l.getAttribute("href") ?? "";
|
|
1233
|
+
/^(https?:|tg:)/i.test(r) && (i.setAttribute("href", r), i.setAttribute("target", "_blank"), i.setAttribute("rel", "noopener noreferrer"));
|
|
1232
1234
|
}
|
|
1233
|
-
|
|
1235
|
+
ne(l, i, a), e.appendChild(i);
|
|
1234
1236
|
}
|
|
1235
1237
|
}
|
|
1236
|
-
function
|
|
1238
|
+
function Mt(t) {
|
|
1237
1239
|
const e = new DOMParser().parseFromString(`<body>${t}</body>`, "text/html"), a = document.implementation.createHTMLDocument(""), l = a.createElement("div");
|
|
1238
|
-
return
|
|
1240
|
+
return ne(e.body, l, a), l.innerHTML;
|
|
1239
1241
|
}
|
|
1240
|
-
const
|
|
1242
|
+
const Lt = {
|
|
1241
1243
|
key: 0,
|
|
1242
1244
|
class: "wx-notifications-preview__chat"
|
|
1243
|
-
},
|
|
1245
|
+
}, Pt = ["innerHTML"], Rt = {
|
|
1244
1246
|
key: 1,
|
|
1245
1247
|
class: "wx-notifications-preview__bubble"
|
|
1246
|
-
},
|
|
1248
|
+
}, Ut = {
|
|
1247
1249
|
key: 1,
|
|
1248
1250
|
class: "wx-notifications-preview__letter"
|
|
1249
|
-
},
|
|
1251
|
+
}, Bt = { class: "wx-notifications-preview__subject" }, It = ["title", "srcdoc"], Dt = {
|
|
1250
1252
|
key: 1,
|
|
1251
1253
|
class: "wx-notifications-preview__body"
|
|
1252
|
-
},
|
|
1254
|
+
}, Ht = /* @__PURE__ */ P({
|
|
1253
1255
|
name: "WxNotificationsPreview",
|
|
1254
1256
|
__name: "MessagePreview",
|
|
1255
1257
|
setup(t) {
|
|
1256
|
-
|
|
1257
|
-
const e =
|
|
1258
|
-
const
|
|
1259
|
-
if (
|
|
1260
|
-
const
|
|
1258
|
+
U();
|
|
1259
|
+
const e = R("webx-notifications"), a = X(), l = ve(), n = m(() => l.active.value || l.list.value[0]?.code || ""), i = m(() => {
|
|
1260
|
+
const $ = a.provider.value;
|
|
1261
|
+
if ($ === null) return null;
|
|
1262
|
+
const V = a.values.value;
|
|
1261
1263
|
try {
|
|
1262
1264
|
return {
|
|
1263
|
-
message:
|
|
1264
|
-
provider:
|
|
1265
|
-
template:
|
|
1266
|
-
subject:
|
|
1267
|
-
hasSubject:
|
|
1268
|
-
limit:
|
|
1269
|
-
values:
|
|
1265
|
+
message: At({
|
|
1266
|
+
provider: $.key,
|
|
1267
|
+
template: oe(V.template, n.value),
|
|
1268
|
+
subject: oe(V.subject, n.value),
|
|
1269
|
+
hasSubject: $.subject,
|
|
1270
|
+
limit: $.limit,
|
|
1271
|
+
values: Ct(a.event.value),
|
|
1270
1272
|
event: a.event.value
|
|
1271
1273
|
})
|
|
1272
1274
|
};
|
|
1273
|
-
} catch (
|
|
1274
|
-
if (
|
|
1275
|
-
return { refusal: e(`errors.${
|
|
1276
|
-
throw
|
|
1275
|
+
} catch (o) {
|
|
1276
|
+
if (o instanceof M)
|
|
1277
|
+
return { refusal: e(`errors.${o.key}`, o.replace) };
|
|
1278
|
+
throw o;
|
|
1277
1279
|
}
|
|
1278
|
-
}),
|
|
1280
|
+
}), r = m(
|
|
1279
1281
|
() => i.value !== null && "message" in i.value ? i.value.message : null
|
|
1280
|
-
),
|
|
1282
|
+
), u = m(
|
|
1281
1283
|
() => i.value !== null && "refusal" in i.value ? i.value.refusal : null
|
|
1282
|
-
),
|
|
1284
|
+
), b = m(
|
|
1283
1285
|
() => e("panel.preview-unknown", {
|
|
1284
|
-
names: (
|
|
1286
|
+
names: (r.value?.unknown ?? []).map(($) => "{{" + $ + "}}").join(", ")
|
|
1285
1287
|
})
|
|
1286
|
-
),
|
|
1287
|
-
() =>
|
|
1288
|
-
),
|
|
1289
|
-
function
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1288
|
+
), k = m(() => a.provider.value?.key === "telegram"), v = m(
|
|
1289
|
+
() => r.value?.html ? `<!doctype html><html><head><meta charset="utf-8"><style>body{margin:0;padding:16px;background:#fff;color:#111827;font:14px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Arial,sans-serif;}</style></head><body>` + r.value.body + "</body></html>" : ""
|
|
1290
|
+
), x = A(null), C = A(240);
|
|
1291
|
+
function N() {
|
|
1292
|
+
const $ = x.value?.contentDocument?.body;
|
|
1293
|
+
$ && (C.value = Math.max(80, Math.ceil($.scrollHeight)));
|
|
1292
1294
|
}
|
|
1293
|
-
const
|
|
1294
|
-
() =>
|
|
1295
|
+
const S = m(
|
|
1296
|
+
() => r.value === null || r.value.truncated ? "" : Mt(r.value.body)
|
|
1295
1297
|
);
|
|
1296
|
-
return (
|
|
1298
|
+
return ($, V) => (p(), _(s(qe), {
|
|
1297
1299
|
title: s(e)("panel.preview"),
|
|
1298
1300
|
class: "wx-notifications-preview"
|
|
1299
1301
|
}, {
|
|
1300
|
-
default:
|
|
1301
|
-
g(s(
|
|
1302
|
+
default: f(() => [
|
|
1303
|
+
g(s(W), {
|
|
1302
1304
|
size: "sm",
|
|
1303
1305
|
tone: "muted"
|
|
1304
1306
|
}, {
|
|
1305
|
-
default:
|
|
1306
|
-
y(
|
|
1307
|
+
default: f(() => [
|
|
1308
|
+
y(h(s(a).event.value ? s(e)("panel.preview-help") : s(e)("panel.preview-no-event")), 1)
|
|
1307
1309
|
]),
|
|
1308
1310
|
_: 1
|
|
1309
1311
|
}),
|
|
1310
|
-
|
|
1312
|
+
u.value ? (p(), _(s(H), {
|
|
1311
1313
|
key: 0,
|
|
1312
1314
|
type: "danger",
|
|
1313
1315
|
variant: "soft",
|
|
1314
1316
|
title: s(e)("panel.preview-refused"),
|
|
1315
|
-
description:
|
|
1316
|
-
}, null, 8, ["title", "description"])) :
|
|
1317
|
-
|
|
1318
|
-
|
|
1317
|
+
description: u.value
|
|
1318
|
+
}, null, 8, ["title", "description"])) : r.value ? (p(), w(F, { key: 1 }, [
|
|
1319
|
+
k.value ? (p(), w("div", Lt, [
|
|
1320
|
+
r.value.truncated ? (p(), w("div", Rt, h(r.value.plain), 1)) : (p(), w("div", {
|
|
1319
1321
|
key: 0,
|
|
1320
1322
|
class: "wx-notifications-preview__bubble",
|
|
1321
|
-
innerHTML:
|
|
1322
|
-
}, null, 8,
|
|
1323
|
-
])) : (p(), w("div",
|
|
1324
|
-
|
|
1325
|
-
g(s(
|
|
1323
|
+
innerHTML: S.value
|
|
1324
|
+
}, null, 8, Pt))
|
|
1325
|
+
])) : (p(), w("div", Ut, [
|
|
1326
|
+
D("div", Bt, [
|
|
1327
|
+
g(s(W), {
|
|
1326
1328
|
size: "sm",
|
|
1327
1329
|
tone: "muted"
|
|
1328
1330
|
}, {
|
|
1329
|
-
default:
|
|
1330
|
-
y(
|
|
1331
|
+
default: f(() => [
|
|
1332
|
+
y(h(s(e)("panel.preview-subject")), 1)
|
|
1331
1333
|
]),
|
|
1332
1334
|
_: 1
|
|
1333
1335
|
}),
|
|
1334
|
-
g(s(
|
|
1335
|
-
default:
|
|
1336
|
-
y(
|
|
1336
|
+
g(s(W), { weight: "medium" }, {
|
|
1337
|
+
default: f(() => [
|
|
1338
|
+
y(h(r.value.subject || "—"), 1)
|
|
1337
1339
|
]),
|
|
1338
1340
|
_: 1
|
|
1339
1341
|
})
|
|
1340
1342
|
]),
|
|
1341
|
-
|
|
1343
|
+
r.value.html ? (p(), w("iframe", {
|
|
1342
1344
|
key: 0,
|
|
1343
1345
|
ref_key: "frame",
|
|
1344
|
-
ref:
|
|
1346
|
+
ref: x,
|
|
1345
1347
|
class: "wx-notifications-preview__frame",
|
|
1346
1348
|
sandbox: "allow-same-origin",
|
|
1347
1349
|
title: s(e)("panel.preview"),
|
|
1348
|
-
srcdoc:
|
|
1349
|
-
style:
|
|
1350
|
-
onLoad:
|
|
1351
|
-
}, null, 44,
|
|
1350
|
+
srcdoc: v.value,
|
|
1351
|
+
style: Ne({ height: `${C.value}px` }),
|
|
1352
|
+
onLoad: N
|
|
1353
|
+
}, null, 44, It)) : (p(), w("div", Dt, h(r.value.body), 1))
|
|
1352
1354
|
])),
|
|
1353
|
-
|
|
1355
|
+
r.value.plain.trim() === "" ? (p(), _(s(W), {
|
|
1354
1356
|
key: 2,
|
|
1355
1357
|
size: "sm",
|
|
1356
1358
|
tone: "muted"
|
|
1357
1359
|
}, {
|
|
1358
|
-
default:
|
|
1359
|
-
y(
|
|
1360
|
+
default: f(() => [
|
|
1361
|
+
y(h(s(e)("panel.preview-empty")), 1)
|
|
1360
1362
|
]),
|
|
1361
1363
|
_: 1
|
|
1362
|
-
})) :
|
|
1363
|
-
|
|
1364
|
+
})) : j("", !0),
|
|
1365
|
+
r.value.truncated ? (p(), _(s(H), {
|
|
1364
1366
|
key: 3,
|
|
1365
1367
|
type: "warning",
|
|
1366
1368
|
variant: "soft",
|
|
1367
1369
|
description: s(e)("panel.preview-truncated", { limit: String(s(a).provider.value?.limit ?? "") })
|
|
1368
|
-
}, null, 8, ["description"])) :
|
|
1369
|
-
|
|
1370
|
+
}, null, 8, ["description"])) : j("", !0),
|
|
1371
|
+
r.value.unknown.length > 0 && s(a).event.value ? (p(), _(s(W), {
|
|
1370
1372
|
key: 4,
|
|
1371
1373
|
size: "sm",
|
|
1372
1374
|
tone: "muted"
|
|
1373
1375
|
}, {
|
|
1374
|
-
default:
|
|
1375
|
-
y(
|
|
1376
|
+
default: f(() => [
|
|
1377
|
+
y(h(b.value), 1)
|
|
1376
1378
|
]),
|
|
1377
1379
|
_: 1
|
|
1378
|
-
})) :
|
|
1379
|
-
], 64)) :
|
|
1380
|
+
})) : j("", !0)
|
|
1381
|
+
], 64)) : j("", !0)
|
|
1380
1382
|
]),
|
|
1381
1383
|
_: 1
|
|
1382
1384
|
}, 8, ["title"]));
|
|
1383
1385
|
}
|
|
1384
|
-
}),
|
|
1386
|
+
}), en = /* @__PURE__ */ B(Ht, [["__scopeId", "data-v-2e2a2dc3"]]), tn = me(() => import("./NotificationsPage-BkTBIV0B.js")), nn = me(() => import("./ChannelPage-vxVhttk3.js"));
|
|
1385
1387
|
export {
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1388
|
+
Ye as C,
|
|
1389
|
+
ft as E,
|
|
1390
|
+
en as M,
|
|
1391
|
+
et as N,
|
|
1392
|
+
M as T,
|
|
1393
|
+
nn as W,
|
|
1394
|
+
B as _,
|
|
1395
|
+
dt as a,
|
|
1396
|
+
tn as b,
|
|
1397
|
+
ye as c,
|
|
1398
|
+
Ft as d,
|
|
1399
|
+
_e as e,
|
|
1400
|
+
Jt as f,
|
|
1401
|
+
ht as g,
|
|
1402
|
+
$e as h,
|
|
1403
|
+
Ct as i,
|
|
1404
|
+
Xe as j,
|
|
1405
|
+
pe as k,
|
|
1406
|
+
ot as l,
|
|
1407
|
+
X as m,
|
|
1408
|
+
Yt as n,
|
|
1409
|
+
Zt as p,
|
|
1410
|
+
At as r,
|
|
1411
|
+
ke as s,
|
|
1412
|
+
Mt as t,
|
|
1413
|
+
U as u,
|
|
1414
|
+
it as v
|
|
1413
1415
|
};
|
|
1414
|
-
//# sourceMappingURL=index-
|
|
1416
|
+
//# sourceMappingURL=index-P5vFp-2X.js.map
|