@wssto2/vue-core 0.5.0 → 0.5.2
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/CHANGELOG.md +27 -0
- package/dist/{AccessGate.vue_vue_type_script_setup_true_lang-Nw1IsB8N.js → AccessGate.vue_vue_type_script_setup_true_lang-DZ9GcLC1.js} +1 -1
- package/dist/{Activity-CoGI2_GL.js → Activity-dpY2kIs2.js} +2 -2
- package/dist/{Changes-Cwfe6wbX.js → Changes-CL8F1w8q.js} +2 -2
- package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-CtvHtFLy.js → CollectionPage.vue_vue_type_script_setup_true_lang-l-e-6WeS.js} +1 -1
- package/dist/{DeadLetters-DyA5Dqn0.js → DeadLetters-DopyRRx0.js} +4 -4
- package/dist/{General-DTEfxWls.js → General-mrVzi-5R.js} +2 -2
- package/dist/{NewRolePage-CRZoUajV.js → NewRolePage-sfr7tQs5.js} +2 -2
- package/dist/{ProfilePage-DLY81mvN.js → ProfilePage-EiTIYzZ5.js} +2 -2
- package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-gXbxXG2R.js → RoleEditor.vue_vue_type_script_setup_true_lang-BGtyOyWL.js} +6 -5
- package/dist/{RolePage-B9t586Q8.js → RolePage-ByUr3v_H.js} +3 -3
- package/dist/{RolesPage-BRdG-OSL.js → RolesPage-CvHrY9ZC.js} +2 -2
- package/dist/{SectionNavigator.vue_vue_type_script_setup_true_lang-Cy9Oi0ts.js → SectionNavigator.vue_vue_type_script_setup_true_lang-Ci04hApd.js} +1 -1
- package/dist/{Sessions-vGyUOnPG.js → Sessions-CHLokZ9e.js} +2 -2
- package/dist/{SettingsPage-V8WeADZZ.js → SettingsPage-DvOGJz9L.js} +2 -2
- package/dist/{SignIn-C-3i8RG6.js → SignIn-ypRvdmjg.js} +2 -2
- package/dist/{SignInPage-D2NA3VKU.js → SignInPage-CbPeKlAo.js} +2 -2
- package/dist/{SignIns-eoYPB6kB.js → SignIns-BApzbGq-.js} +2 -2
- package/dist/{UserRecord-BaQl2zzQ.js → UserRecord-BCTaBajE.js} +5 -5
- package/dist/{UsersList-BfXWgH5K.js → UsersList-CqSK3cQL.js} +4 -4
- package/dist/access/api.d.ts +8 -7
- package/dist/access/context.d.ts +7 -0
- package/dist/access/feature.d.ts +8 -0
- package/dist/access/index.js +1 -1
- package/dist/access/labels.d.ts +5 -0
- package/dist/app/index.js +117 -115
- package/dist/app/keepAlive.d.ts +4 -8
- package/dist/collection/index.js +3 -3
- package/dist/{contributions-DVQPcjJz.js → contributions-fx5q5n1u.js} +1 -1
- package/dist/{guards-DRh4zmxO.js → guards-D4mXf_2X.js} +1 -1
- package/dist/{http-D_pBg22D.js → http-CdQowFlW.js} +1 -1
- package/dist/identity/index.d.ts +1 -1
- package/dist/identity/index.js +6 -7
- package/dist/identity/session.d.ts +10 -7
- package/dist/{index-g-qbUeTk.js → index-BPwfLD7i.js} +261 -239
- package/dist/index-BVlbcaKs.js +763 -0
- package/dist/{index-kqk7Mclb.js → index-auJqVMWC.js} +90 -92
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/keepAlive-z3IRFkQq.js +46 -0
- package/dist/{navigation-DuQwti76.js → navigation-Bc5EQ_Si.js} +1 -1
- package/dist/{neighbors-IMRQ4rkm.js → neighbors-Bv6vnWlW.js} +1 -1
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +5 -4
- package/dist/notifications/push/pushState.d.ts +27 -0
- package/dist/page/index.js +1 -1
- package/dist/platform/index.js +3 -3
- package/dist/platform/platform.d.ts +7 -2
- package/dist/platform/session.d.ts +17 -0
- package/dist/platform-Dx6STiwY.js +283 -0
- package/dist/router/index.js +3 -3
- package/dist/{sections-D5rgQ4YB.js → sections-B0HxIOC2.js} +1 -1
- package/dist/shell/index.js +3 -3
- package/dist/{status-C2gHqkj6.js → status-BUFELJz2.js} +2 -2
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/index-WkbzC_ee.js +0 -745
- package/dist/keepAlive-CDvMQlcJ.js +0 -49
- package/dist/platform-Dl1fbScN.js +0 -268
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { route as
|
|
2
|
-
import { d as
|
|
3
|
-
import { ref as
|
|
1
|
+
import { route as v } from "./client/index.js";
|
|
2
|
+
import { d as ve, p as me } from "./feature-DdUAfyi4.js";
|
|
3
|
+
import { ref as C, readonly as $, defineComponent as q, openBlock as _, createBlock as U, unref as s, shallowRef as z, withCtx as A, createTextVNode as X, toDisplayString as L, mergeProps as Z, computed as N, createElementBlock as S, createElementVNode as P, createCommentVNode as R, createVNode as T, Fragment as G, renderList as be, normalizeClass as H, useTemplateRef as he, createSlots as ye } from "vue";
|
|
4
4
|
import { d as ge } from "./context-Ch1r4fdN.js";
|
|
5
|
-
import { u as
|
|
6
|
-
import { d as
|
|
7
|
-
import { useI18n as
|
|
5
|
+
import { u as ee } from "./platform-Dx6STiwY.js";
|
|
6
|
+
import { d as te } from "./defineRoutes-BGAdiIrt.js";
|
|
7
|
+
import { useI18n as I } from "vue-i18n";
|
|
8
8
|
import { _ as _e } from "./AccountMenuItem.vue_vue_type_script_setup_true_lang-CPeNxh5K.js";
|
|
9
9
|
import { f as xe } from "./client-BHPFfBj3.js";
|
|
10
10
|
import { u as we } from "./mediaQuery-CygcXmFW.js";
|
|
@@ -12,44 +12,44 @@ import { _ as ke } from "./Sheet.vue_vue_type_script_setup_true_lang-DgOFV4fa.js
|
|
|
12
12
|
import { _ as Se } from "./Popover.vue_vue_type_script_setup_true_lang-C70GrCP7.js";
|
|
13
13
|
import { _ as J } from "./HeaderAction.vue_vue_type_script_setup_true_lang-Cgji-Jrr.js";
|
|
14
14
|
import { useRouter as Te } from "vue-router";
|
|
15
|
-
import { _ as
|
|
15
|
+
import { _ as K } from "./Button.vue_vue_type_script_setup_true_lang-CL9Qh5yq.js";
|
|
16
16
|
import { u as Ee } from "./format-D8X4zsx6.js";
|
|
17
|
-
import { _ as
|
|
18
|
-
import { _ as
|
|
17
|
+
import { _ as Pe } from "./Icon.vue_vue_type_script_lang-D7oC-d-S.js";
|
|
18
|
+
import { _ as Ce } from "./AsyncSection.vue_vue_type_script_setup_true_lang-B0NfvG3B.js";
|
|
19
19
|
const E = {
|
|
20
|
-
list:
|
|
21
|
-
unread:
|
|
22
|
-
read:
|
|
23
|
-
readAll:
|
|
24
|
-
stream:
|
|
25
|
-
test:
|
|
26
|
-
preferences:
|
|
27
|
-
preferencesSetEmail:
|
|
28
|
-
quietHours:
|
|
29
|
-
preferencesSetPush:
|
|
30
|
-
push:
|
|
31
|
-
devices:
|
|
32
|
-
deviceSubscribe:
|
|
33
|
-
deviceUnsubscribe:
|
|
34
|
-
deviceRename:
|
|
35
|
-
deviceRemove:
|
|
36
|
-
deviceTest:
|
|
37
|
-
},
|
|
38
|
-
deadLettersList:
|
|
39
|
-
deadLettersRetry:
|
|
40
|
-
deadLettersRetryAll:
|
|
41
|
-
consumers:
|
|
42
|
-
}, [Le,
|
|
43
|
-
function
|
|
20
|
+
list: v("GET", "/v1/notifications"),
|
|
21
|
+
unread: v("GET", "/v1/notifications/unread"),
|
|
22
|
+
read: v("POST", "/v1/notifications/:id/read"),
|
|
23
|
+
readAll: v("POST", "/v1/notifications/read"),
|
|
24
|
+
stream: v.raw("GET", "/v1/notifications/stream"),
|
|
25
|
+
test: v("POST", "/v1/notifications/test"),
|
|
26
|
+
preferences: v("GET", "/v1/notifications/preferences"),
|
|
27
|
+
preferencesSetEmail: v("PUT", "/v1/notifications/preferences/:category"),
|
|
28
|
+
quietHours: v("PUT", "/v1/notifications/quiet-hours"),
|
|
29
|
+
preferencesSetPush: v("PUT", "/v1/notifications/preferences/:category/push"),
|
|
30
|
+
push: v("GET", "/v1/notifications/push"),
|
|
31
|
+
devices: v("GET", "/v1/notifications/devices"),
|
|
32
|
+
deviceSubscribe: v("POST", "/v1/notifications/devices"),
|
|
33
|
+
deviceUnsubscribe: v("POST", "/v1/notifications/devices/unsubscribe"),
|
|
34
|
+
deviceRename: v("PATCH", "/v1/notifications/devices/:id"),
|
|
35
|
+
deviceRemove: v("DELETE", "/v1/notifications/devices/:id"),
|
|
36
|
+
deviceTest: v("POST", "/v1/notifications/devices/:id/test")
|
|
37
|
+
}, Rt = {
|
|
38
|
+
deadLettersList: v("GET", "/v1/events/dead-letters", { permission: "events.deadletter:view" }),
|
|
39
|
+
deadLettersRetry: v("POST", "/v1/events/dead-letters/:event/:consumer/retry", { permission: "events.deadletter:retry" }),
|
|
40
|
+
deadLettersRetryAll: v("POST", "/v1/events/dead-letters/retry", { permission: "events.deadletter:retry" }),
|
|
41
|
+
consumers: v("GET", "/v1/events/consumers", { permission: "events.deadletter:view" })
|
|
42
|
+
}, [Le, ne] = ge("vue-core.notifications");
|
|
43
|
+
function ie(n) {
|
|
44
44
|
const t = (n + "=".repeat((4 - n.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), e = atob(t), i = new Uint8Array(new ArrayBuffer(e.length));
|
|
45
|
-
for (let
|
|
45
|
+
for (let a = 0; a < e.length; a++) i[a] = e.charCodeAt(a);
|
|
46
46
|
return i;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function ae(n, t) {
|
|
49
49
|
const e = n.options?.applicationServerKey;
|
|
50
50
|
if (!e) return !0;
|
|
51
|
-
const i =
|
|
52
|
-
return
|
|
51
|
+
const i = ie(t), a = new Uint8Array(e);
|
|
52
|
+
return a.length === i.length && a.every((c, u) => c === i[u]);
|
|
53
53
|
}
|
|
54
54
|
function Re(n) {
|
|
55
55
|
const t = n.toJSON();
|
|
@@ -62,7 +62,7 @@ async function oe(n) {
|
|
|
62
62
|
function $e(n) {
|
|
63
63
|
return (/iPhone|iPad|iPod/.test(n.userAgent) || /Macintosh/.test(n.userAgent) && n.maxTouchPoints > 1) && !n.standalone ? "ios-browser" : n.hasPushManager && n.hasNotification && n.hasServiceWorker ? "supported" : "unsupported";
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function W() {
|
|
66
66
|
const n = async () => "serviceWorker" in navigator && await navigator.serviceWorker.getRegistration() ? navigator.serviceWorker.ready : null;
|
|
67
67
|
return {
|
|
68
68
|
support: () => $e({
|
|
@@ -76,14 +76,14 @@ function K() {
|
|
|
76
76
|
permission: () => "Notification" in window ? Notification.permission : "unknown",
|
|
77
77
|
requestPermission: () => Notification.requestPermission(),
|
|
78
78
|
subscription: async () => (await n())?.pushManager.getSubscription() ?? null,
|
|
79
|
-
subscribe: async (t) => (await n())?.pushManager.subscribe({ userVisibleOnly: !0, applicationServerKey:
|
|
79
|
+
subscribe: async (t) => (await n())?.pushManager.subscribe({ userVisibleOnly: !0, applicationServerKey: ie(t) }) ?? null
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
async function
|
|
82
|
+
async function se(n, t, e) {
|
|
83
83
|
const i = Re(t);
|
|
84
84
|
return i ? (await n.request(E.deviceSubscribe, i, e ? { signal: e } : void 0), oe(i.endpoint)) : null;
|
|
85
85
|
}
|
|
86
|
-
async function
|
|
86
|
+
async function re(n, t = W(), e) {
|
|
87
87
|
const i = await t.subscription();
|
|
88
88
|
i && (await n.request(E.deviceUnsubscribe, { endpoint: i.endpoint }, e ? { signal: e } : void 0).catch(() => {
|
|
89
89
|
}), await i.unsubscribe().catch(() => !1));
|
|
@@ -96,53 +96,53 @@ async function Ae(n, t, e) {
|
|
|
96
96
|
await i.unsubscribe().catch(() => !1);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
const { data:
|
|
100
|
-
|
|
99
|
+
const { data: a } = await n.request(E.push, void 0, e ? { signal: e } : void 0);
|
|
100
|
+
a.enabled && (ae(i, a.public_key) || (await i.unsubscribe(), i = await t.subscribe(a.public_key)), i && await se(n, i, e));
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
const e =
|
|
102
|
+
function Me(n = ee().http, t = W()) {
|
|
103
|
+
const e = C("loading"), i = C(null), a = C(!1);
|
|
104
104
|
async function c() {
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
e.value =
|
|
105
|
+
const o = t.support();
|
|
106
|
+
if (o !== "supported") {
|
|
107
|
+
e.value = o;
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
const r = await t.subscription().catch(() => null);
|
|
111
111
|
i.value = r ? await oe(r.endpoint) : null, e.value = t.permission() === "denied" ? "denied" : r && t.permission() === "granted" ? "on" : "off";
|
|
112
112
|
}
|
|
113
|
-
async function
|
|
113
|
+
async function u() {
|
|
114
114
|
if (t.support() !== "supported") return e.value;
|
|
115
|
-
|
|
115
|
+
a.value = !0;
|
|
116
116
|
try {
|
|
117
|
-
const { data:
|
|
118
|
-
if (!
|
|
117
|
+
const { data: o } = await n.request(E.push, void 0);
|
|
118
|
+
if (!o.enabled) return e.value;
|
|
119
119
|
if (await t.requestPermission() !== "granted")
|
|
120
120
|
return e.value = t.permission() === "denied" ? "denied" : "off", e.value;
|
|
121
121
|
let r = await t.subscription();
|
|
122
|
-
return r && !
|
|
122
|
+
return r && !ae(r, o.public_key) && (await r.unsubscribe(), r = null), r ?? (r = await t.subscribe(o.public_key)), r && (i.value = await se(n, r), e.value = "on"), e.value;
|
|
123
123
|
} finally {
|
|
124
|
-
|
|
124
|
+
a.value = !1;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
async function
|
|
128
|
-
|
|
127
|
+
async function g() {
|
|
128
|
+
a.value = !0;
|
|
129
129
|
try {
|
|
130
|
-
await
|
|
130
|
+
await re(n, t), i.value = null, e.value = "off";
|
|
131
131
|
} finally {
|
|
132
|
-
|
|
132
|
+
a.value = !1;
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
return { state:
|
|
135
|
+
return { state: $(e), hash: $(i), busy: $(a), inspect: c, enable: u, disable: g };
|
|
136
136
|
}
|
|
137
|
-
const
|
|
138
|
-
index: { name: "events.deadletters", path: "/events/dead-letters", component: () => import("./DeadLetters-
|
|
139
|
-
}), j =
|
|
140
|
-
index: { name: "notifications.settings", path: "/profile/notifications", component: () => import("./SettingsPage-
|
|
141
|
-
}),
|
|
137
|
+
const Ne = "events.deadletter:view", $t = "events.deadletter:retry", Y = te({
|
|
138
|
+
index: { name: "events.deadletters", path: "/events/dead-letters", component: () => import("./DeadLetters-DopyRRx0.js"), meta: { access: Ne, titleKey: "core.notifications.dead_letters.title" } }
|
|
139
|
+
}), j = te({
|
|
140
|
+
index: { name: "notifications.settings", path: "/profile/notifications", component: () => import("./SettingsPage-DvOGJz9L.js"), meta: { titleKey: "core.notifications.settings.title" } }
|
|
141
|
+
}), Oe = /* @__PURE__ */ q({
|
|
142
142
|
__name: "SettingsMenuItem",
|
|
143
143
|
setup(n) {
|
|
144
|
-
const { t } =
|
|
145
|
-
return (e, i) => (
|
|
144
|
+
const { t } = I();
|
|
145
|
+
return (e, i) => (_(), U(_e, {
|
|
146
146
|
label: s(t)("core.notifications.settings.title"),
|
|
147
147
|
icon: "notification3Line",
|
|
148
148
|
to: s(j).index,
|
|
@@ -150,36 +150,36 @@ const Me = "events.deadletter:view", $t = "events.deadletter:retry", Y = ee({
|
|
|
150
150
|
}, null, 8, ["label", "to"]));
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
|
-
function
|
|
153
|
+
function ce(n) {
|
|
154
154
|
return n.reduce((t, e) => Math.max(t, e.id), 0);
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function qe(n, t, e) {
|
|
157
157
|
return n.map((i) => i.id === t && i.read_at === null ? { ...i, read_at: e } : i);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function Ue(n, t, e) {
|
|
160
160
|
return n.map((i) => i.read_at === null && i.id <= t ? { ...i, read_at: e } : i);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const e =
|
|
162
|
+
function Ie(n, t) {
|
|
163
|
+
const e = ce(n);
|
|
164
164
|
return [...t.filter((i) => i.id > e), ...n];
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function Be(n, t) {
|
|
167
167
|
const e = new Set(n.map((i) => i.id));
|
|
168
168
|
return [...n, ...t.filter((i) => !e.has(i.id))];
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function De(n, t, e) {
|
|
171
171
|
let i = n.items;
|
|
172
|
-
if (t.type === "created" && t.notification && !i.some((
|
|
173
|
-
const
|
|
174
|
-
i = i.map((
|
|
172
|
+
if (t.type === "created" && t.notification && !i.some((a) => a.id === t.notification?.id) && (i = [t.notification, ...i]), t.type === "read") {
|
|
173
|
+
const a = new Set(t.read_ids ?? []), c = t.read_up_to_id ?? 0;
|
|
174
|
+
i = i.map((u) => u.read_at === null && (t.all_read ? u.id <= c : a.has(u.id)) ? { ...u, read_at: e } : u);
|
|
175
175
|
}
|
|
176
176
|
return { items: i, unreadCount: Math.max(0, t.unread_count) };
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function We(n) {
|
|
179
179
|
return n > 99 ? "99+" : String(n);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
182
|
-
function
|
|
181
|
+
const ze = ["created", "read", "unread"];
|
|
182
|
+
function Ge(n) {
|
|
183
183
|
const t = n.split(`
|
|
184
184
|
`).filter((e) => e.startsWith("data:")).map((e) => e.slice(5).replace(/^ /, "")).join(`
|
|
185
185
|
`);
|
|
@@ -187,59 +187,59 @@ function ze(n) {
|
|
|
187
187
|
try {
|
|
188
188
|
const e = JSON.parse(t);
|
|
189
189
|
if (typeof e != "object" || e === null) return null;
|
|
190
|
-
const { type: i, unread_count:
|
|
191
|
-
return typeof i == "string" &&
|
|
190
|
+
const { type: i, unread_count: a } = e;
|
|
191
|
+
return typeof i == "string" && ze.includes(i) && typeof a == "number" ? e : null;
|
|
192
192
|
} catch {
|
|
193
193
|
return null;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
async function
|
|
196
|
+
async function Ke({ url: n, transport: t, signal: e, onEvent: i, idleTimeout: a }) {
|
|
197
197
|
if (e.aborted) return "aborted";
|
|
198
198
|
const c = new AbortController();
|
|
199
|
-
let
|
|
199
|
+
let u = null, g = !1, o;
|
|
200
200
|
const r = () => {
|
|
201
|
-
c.abort(),
|
|
201
|
+
c.abort(), u?.cancel().catch(() => {
|
|
202
202
|
});
|
|
203
203
|
}, h = () => {
|
|
204
|
-
clearTimeout(
|
|
205
|
-
|
|
206
|
-
},
|
|
204
|
+
clearTimeout(o), o = setTimeout(() => {
|
|
205
|
+
g = !0, r();
|
|
206
|
+
}, a);
|
|
207
207
|
};
|
|
208
208
|
e.addEventListener("abort", r, { once: !0 }), h();
|
|
209
209
|
try {
|
|
210
210
|
const d = await t(n, { method: "GET", headers: { Accept: "text/event-stream" }, credentials: "include", signal: c.signal });
|
|
211
211
|
if (d.status === 401) return "unauthorized";
|
|
212
212
|
if (!d.ok || !d.body) return "failed";
|
|
213
|
-
|
|
213
|
+
u = d.body.getReader();
|
|
214
214
|
const x = new TextDecoder();
|
|
215
215
|
let w = "";
|
|
216
216
|
for (; ; ) {
|
|
217
|
-
const { done: b, value:
|
|
217
|
+
const { done: b, value: l } = await u.read();
|
|
218
218
|
if (e.aborted) return "aborted";
|
|
219
|
-
if (
|
|
219
|
+
if (g) return "stalled";
|
|
220
220
|
if (b) return "closed";
|
|
221
|
-
h(), w += x.decode(
|
|
221
|
+
h(), w += x.decode(l, { stream: !0 }).replace(/\r\n/g, `
|
|
222
222
|
`);
|
|
223
223
|
const k = w.split(`
|
|
224
224
|
|
|
225
225
|
`);
|
|
226
226
|
w = k.pop() ?? "";
|
|
227
|
-
for (const
|
|
228
|
-
const
|
|
229
|
-
|
|
227
|
+
for (const y of k) {
|
|
228
|
+
const O = Ge(y);
|
|
229
|
+
O && i(O);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
} catch (d) {
|
|
233
|
-
return e.aborted ? "aborted" :
|
|
233
|
+
return e.aborted ? "aborted" : g ? "stalled" : d instanceof Error && d.name === "AbortError" ? "aborted" : "failed";
|
|
234
234
|
} finally {
|
|
235
|
-
clearTimeout(
|
|
235
|
+
clearTimeout(o), e.removeEventListener("abort", r);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
const { http: t, signal: e, pageSize: i = 20, backoff:
|
|
238
|
+
function je(n) {
|
|
239
|
+
const { http: t, signal: e, pageSize: i = 20, backoff: a = { min: 1e3, max: 3e4 }, idleTimeout: c = 5e4, transport: u = xe, now: g = () => /* @__PURE__ */ new Date() } = n, o = z([]), r = C(0), h = C(!1), d = z({ status: "idle" }), x = C("idle");
|
|
240
240
|
let w = 0;
|
|
241
|
-
const b = () =>
|
|
242
|
-
async function
|
|
241
|
+
const b = () => g().toISOString();
|
|
242
|
+
async function l() {
|
|
243
243
|
try {
|
|
244
244
|
const { data: f } = await t.request(E.unread, void 0, { signal: e });
|
|
245
245
|
e.aborted || (r.value = f.unread_count);
|
|
@@ -252,79 +252,79 @@ function Ke(n) {
|
|
|
252
252
|
try {
|
|
253
253
|
const { data: p } = await t.request(E.list, { limit: i }, { signal: e });
|
|
254
254
|
if (e.aborted || f !== w) return;
|
|
255
|
-
|
|
255
|
+
o.value = Ie(p.items, o.value), h.value = p.has_more, d.value = { status: "loaded" };
|
|
256
256
|
} catch (p) {
|
|
257
257
|
if (e.aborted || f !== w) return;
|
|
258
258
|
d.value = { status: "failed", error: p };
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
async function
|
|
262
|
-
const f =
|
|
261
|
+
async function y() {
|
|
262
|
+
const f = o.value[o.value.length - 1]?.id;
|
|
263
263
|
if (!h.value || x.value === "loading" || f === void 0) return;
|
|
264
264
|
const p = w;
|
|
265
265
|
x.value = "loading";
|
|
266
266
|
try {
|
|
267
|
-
const { data:
|
|
267
|
+
const { data: m } = await t.request(E.list, { before_id: f, limit: i }, { signal: e });
|
|
268
268
|
if (e.aborted || p !== w) return;
|
|
269
|
-
|
|
269
|
+
o.value = Be(o.value, m.items), h.value = m.has_more, x.value = "idle";
|
|
270
270
|
} catch {
|
|
271
271
|
!e.aborted && p === w && (x.value = "failed");
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
async function
|
|
275
|
-
if (!(f.read_at !== null ||
|
|
276
|
-
|
|
274
|
+
async function O(f) {
|
|
275
|
+
if (!(f.read_at !== null || o.value.find((p) => p.id === f.id)?.read_at)) {
|
|
276
|
+
o.value = qe(o.value, f.id, b()), r.value = Math.max(0, r.value - 1);
|
|
277
277
|
try {
|
|
278
278
|
const { data: p } = await t.request(E.read, { id: f.id }, { signal: e });
|
|
279
279
|
e.aborted || (r.value = p.unread_count);
|
|
280
280
|
} catch {
|
|
281
281
|
if (e.aborted) return;
|
|
282
|
-
|
|
282
|
+
o.value = o.value.map((p) => p.id === f.id ? { ...p, read_at: null } : p), await l();
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
async function
|
|
287
|
-
const f =
|
|
286
|
+
async function de() {
|
|
287
|
+
const f = ce(o.value);
|
|
288
288
|
if (f === 0) return;
|
|
289
|
-
const p = new Set(
|
|
290
|
-
|
|
289
|
+
const p = new Set(o.value.filter((m) => m.read_at === null && m.id <= f).map((m) => m.id));
|
|
290
|
+
o.value = Ue(o.value, f, b()), r.value = Math.max(0, r.value - p.size);
|
|
291
291
|
try {
|
|
292
|
-
const { data:
|
|
293
|
-
e.aborted || (r.value =
|
|
292
|
+
const { data: m } = await t.request(E.readAll, { up_to_id: f }, { signal: e });
|
|
293
|
+
e.aborted || (r.value = m.unread_count);
|
|
294
294
|
} catch {
|
|
295
295
|
if (e.aborted) return;
|
|
296
|
-
|
|
296
|
+
o.value = o.value.map((m) => p.has(m.id) ? { ...m, read_at: null } : m), await l();
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
let
|
|
300
|
-
const
|
|
301
|
-
const
|
|
302
|
-
clearTimeout(
|
|
303
|
-
},
|
|
304
|
-
e.addEventListener("abort",
|
|
299
|
+
let M = a.min, B = null;
|
|
300
|
+
const fe = (f) => new Promise((p) => {
|
|
301
|
+
const m = () => {
|
|
302
|
+
clearTimeout(D), e.removeEventListener("abort", m), B = null, p();
|
|
303
|
+
}, D = setTimeout(m, f);
|
|
304
|
+
e.addEventListener("abort", m, { once: !0 }), B = m;
|
|
305
305
|
});
|
|
306
|
-
async function
|
|
306
|
+
async function pe() {
|
|
307
307
|
for (let f = !1; !e.aborted; f = !0) {
|
|
308
|
-
if (f && await
|
|
308
|
+
if (f && await l(), e.aborted) return;
|
|
309
309
|
let p = !1;
|
|
310
|
-
if (await
|
|
310
|
+
if (await Ke({
|
|
311
311
|
url: n.streamUrl,
|
|
312
|
-
transport:
|
|
312
|
+
transport: u,
|
|
313
313
|
signal: e,
|
|
314
314
|
idleTimeout: c,
|
|
315
|
-
onEvent(
|
|
315
|
+
onEvent(m) {
|
|
316
316
|
p = !0;
|
|
317
|
-
const
|
|
318
|
-
|
|
317
|
+
const D = De({ items: o.value, unreadCount: r.value }, m, b());
|
|
318
|
+
o.value = D.items, r.value = D.unreadCount;
|
|
319
319
|
}
|
|
320
320
|
}), e.aborted) return;
|
|
321
|
-
p && (
|
|
321
|
+
p && (M = a.min), await fe(M), M = Math.min(M * 2, a.max);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
const F = () => {
|
|
325
|
-
document.visibilityState === "visible" && (
|
|
325
|
+
document.visibilityState === "visible" && (l(), M = a.min, B?.());
|
|
326
326
|
}, V = () => {
|
|
327
|
-
|
|
327
|
+
l(), M = a.min, B?.();
|
|
328
328
|
};
|
|
329
329
|
return document.addEventListener("visibilitychange", F), window.addEventListener("online", V), e.addEventListener(
|
|
330
330
|
"abort",
|
|
@@ -332,69 +332,69 @@ function Ke(n) {
|
|
|
332
332
|
document.removeEventListener("visibilitychange", F), window.removeEventListener("online", V);
|
|
333
333
|
},
|
|
334
334
|
{ once: !0 }
|
|
335
|
-
), e.aborted ||
|
|
335
|
+
), e.aborted || pe(), { items: $(o), unreadCount: $(r), hasMore: $(h), list: $(d), more: $(x), load: k, loadMore: y, markRead: O, markAllRead: de };
|
|
336
336
|
}
|
|
337
|
-
const
|
|
337
|
+
const ue = /* @__PURE__ */ q({
|
|
338
338
|
__name: "MarkAllRead",
|
|
339
339
|
props: {
|
|
340
340
|
inbox: {}
|
|
341
341
|
},
|
|
342
342
|
setup(n) {
|
|
343
|
-
const { t } =
|
|
344
|
-
return (e, i) => (
|
|
343
|
+
const { t } = I();
|
|
344
|
+
return (e, i) => (_(), U(s(K), {
|
|
345
345
|
prominence: "plain",
|
|
346
346
|
size: "sm",
|
|
347
347
|
icon: "checkDoubleLine",
|
|
348
348
|
"data-notification-mark-all": "",
|
|
349
349
|
disabled: n.inbox.unreadCount.value === 0,
|
|
350
|
-
onClick: i[0] || (i[0] = (
|
|
350
|
+
onClick: i[0] || (i[0] = (a) => n.inbox.markAllRead())
|
|
351
351
|
}, {
|
|
352
|
-
default:
|
|
353
|
-
X(
|
|
352
|
+
default: A(() => [
|
|
353
|
+
X(L(s(t)("core.notifications.mark_all_read")), 1)
|
|
354
354
|
]),
|
|
355
355
|
_: 1
|
|
356
356
|
}, 8, ["disabled"]));
|
|
357
357
|
}
|
|
358
|
-
}),
|
|
358
|
+
}), le = /* @__PURE__ */ q({
|
|
359
359
|
__name: "SettingsLink",
|
|
360
360
|
emits: ["click"],
|
|
361
361
|
setup(n, { emit: t }) {
|
|
362
|
-
const e = t, { t: i } =
|
|
363
|
-
return (
|
|
362
|
+
const e = t, { t: i } = I();
|
|
363
|
+
return (a, c) => (_(), U(s(K), Z({
|
|
364
364
|
prominence: "plain",
|
|
365
365
|
size: "sm",
|
|
366
366
|
icon: "settings3Line",
|
|
367
367
|
to: s(j).index
|
|
368
368
|
}, { "aria-label": s(i)("core.notifications.settings.open"), title: s(i)("core.notifications.settings.open") }, {
|
|
369
369
|
"data-notification-settings": "",
|
|
370
|
-
onClick: c[0] || (c[0] = (
|
|
370
|
+
onClick: c[0] || (c[0] = (u) => e("click"))
|
|
371
371
|
}), null, 16, ["to"]));
|
|
372
372
|
}
|
|
373
|
-
}),
|
|
373
|
+
}), Fe = {
|
|
374
374
|
"data-notification-inbox": "",
|
|
375
375
|
class: "w-full min-w-0 sm:w-96"
|
|
376
|
-
},
|
|
376
|
+
}, Ve = {
|
|
377
377
|
key: 0,
|
|
378
378
|
class: "mb-1 flex items-center justify-between gap-2"
|
|
379
|
-
},
|
|
379
|
+
}, He = { class: "px-1 text-headline font-semibold" }, Je = { class: "flex items-center gap-1" }, Ye = { class: "-mx-1 max-h-[min(28rem,60dvh)] overflow-y-auto overscroll-contain" }, Qe = ["data-unread", "onClick"], Xe = { class: "min-w-0 flex-1" }, Ze = {
|
|
380
380
|
key: 0,
|
|
381
381
|
class: "mt-0.5 line-clamp-2 block text-footnote text-content-muted"
|
|
382
|
-
},
|
|
382
|
+
}, et = ["datetime"], tt = {
|
|
383
383
|
key: 0,
|
|
384
384
|
class: "mt-2 size-2 shrink-0 rounded-full bg-content-link",
|
|
385
385
|
"aria-hidden": "true"
|
|
386
|
-
},
|
|
386
|
+
}, nt = {
|
|
387
387
|
key: 1,
|
|
388
388
|
class: "sr-only"
|
|
389
|
-
},
|
|
389
|
+
}, it = {
|
|
390
390
|
key: 0,
|
|
391
391
|
class: "mt-2 flex flex-col items-center gap-1",
|
|
392
392
|
"data-notification-more": ""
|
|
393
|
-
},
|
|
393
|
+
}, at = {
|
|
394
394
|
key: 0,
|
|
395
395
|
class: "text-footnote text-status-danger-content",
|
|
396
396
|
role: "alert"
|
|
397
|
-
}, ot = "bg-fill text-content-muted", Q = /* @__PURE__ */
|
|
397
|
+
}, ot = "bg-fill text-content-muted", Q = /* @__PURE__ */ q({
|
|
398
398
|
__name: "InboxPanel",
|
|
399
399
|
props: {
|
|
400
400
|
inbox: {},
|
|
@@ -402,7 +402,7 @@ const ce = /* @__PURE__ */ O({
|
|
|
402
402
|
},
|
|
403
403
|
emits: ["close"],
|
|
404
404
|
setup(n, { emit: t }) {
|
|
405
|
-
const e = n, i = t, { t:
|
|
405
|
+
const e = n, i = t, { t: a } = I(), c = Te(), u = Ee(), { categories: g, settings: o } = ne(), r = {
|
|
406
406
|
amber: "bg-category-amber-surface text-category-amber-content",
|
|
407
407
|
lime: "bg-category-lime-surface text-category-lime-content",
|
|
408
408
|
teal: "bg-category-teal-surface text-category-teal-content",
|
|
@@ -412,103 +412,103 @@ const ce = /* @__PURE__ */ O({
|
|
|
412
412
|
violet: "bg-category-violet-surface text-category-violet-content",
|
|
413
413
|
fuchsia: "bg-category-fuchsia-surface text-category-fuchsia-content",
|
|
414
414
|
pink: "bg-category-pink-surface text-category-pink-content"
|
|
415
|
-
}, h =
|
|
416
|
-
const { list: b, items:
|
|
415
|
+
}, h = N(() => {
|
|
416
|
+
const { list: b, items: l } = e.inbox;
|
|
417
417
|
if (b.value.status === "failed") {
|
|
418
|
-
const k =
|
|
419
|
-
return
|
|
418
|
+
const k = a("core.notifications.load_error");
|
|
419
|
+
return l.value.length > 0 ? { status: "stale", value: l.value, error: k } : { status: "failed", error: k };
|
|
420
420
|
}
|
|
421
|
-
return b.value.status === "loaded" ? { status: "loaded", value:
|
|
421
|
+
return b.value.status === "loaded" ? { status: "loaded", value: l.value } : l.value.length > 0 ? { status: "refreshing", value: l.value } : { status: "loading" };
|
|
422
422
|
}), d = (b) => {
|
|
423
|
-
const
|
|
424
|
-
return { icon:
|
|
423
|
+
const l = g[b.category];
|
|
424
|
+
return { icon: l?.icon ?? "notification3Line", classes: l?.hue ? r[l.hue] : ot };
|
|
425
425
|
}, x = (b) => b.startsWith("/") && !b.startsWith("//");
|
|
426
426
|
function w(b) {
|
|
427
427
|
e.inbox.markRead(b), !(b.link === "" || !x(b.link)) && (i("close"), c.push(b.link));
|
|
428
428
|
}
|
|
429
|
-
return (b,
|
|
430
|
-
n.appearance === "popover" ? (
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
s(
|
|
429
|
+
return (b, l) => (_(), S("div", Fe, [
|
|
430
|
+
n.appearance === "popover" ? (_(), S("div", Ve, [
|
|
431
|
+
P("h2", He, L(s(a)("core.notifications.title")), 1),
|
|
432
|
+
P("div", Je, [
|
|
433
|
+
s(o) ? (_(), U(le, {
|
|
434
434
|
key: 0,
|
|
435
|
-
onClick:
|
|
436
|
-
})) :
|
|
437
|
-
T(
|
|
435
|
+
onClick: l[0] || (l[0] = (k) => i("close"))
|
|
436
|
+
})) : R("", !0),
|
|
437
|
+
T(ue, { inbox: n.inbox }, null, 8, ["inbox"])
|
|
438
438
|
])
|
|
439
|
-
])) :
|
|
440
|
-
T(s(
|
|
439
|
+
])) : R("", !0),
|
|
440
|
+
T(s(Ce), {
|
|
441
441
|
state: h.value,
|
|
442
|
-
"empty-title": s(
|
|
443
|
-
"empty-description": s(
|
|
442
|
+
"empty-title": s(a)("core.notifications.empty_title"),
|
|
443
|
+
"empty-description": s(a)("core.notifications.empty_description"),
|
|
444
444
|
"empty-icon": "notification3Line",
|
|
445
|
-
onRetry:
|
|
445
|
+
onRetry: l[2] || (l[2] = (k) => n.inbox.load())
|
|
446
446
|
}, {
|
|
447
|
-
default:
|
|
448
|
-
|
|
449
|
-
(
|
|
450
|
-
key:
|
|
447
|
+
default: A(({ value: k }) => [
|
|
448
|
+
P("ul", Ye, [
|
|
449
|
+
(_(!0), S(G, null, be(k, (y) => (_(), S("li", {
|
|
450
|
+
key: y.id
|
|
451
451
|
}, [
|
|
452
|
-
|
|
452
|
+
P("button", {
|
|
453
453
|
type: "button",
|
|
454
454
|
"data-notification-item": "",
|
|
455
|
-
"data-unread":
|
|
455
|
+
"data-unread": y.read_at === null ? "true" : void 0,
|
|
456
456
|
class: "flex w-full cursor-pointer items-start gap-3 rounded-control px-2 py-2.5 text-left transition-colors duration-motion-fast hover:bg-fill focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
457
|
-
onClick: (
|
|
457
|
+
onClick: (O) => w(y)
|
|
458
458
|
}, [
|
|
459
|
-
|
|
460
|
-
class: H(["flex size-9 shrink-0 items-center justify-center rounded-full", d(
|
|
459
|
+
P("span", {
|
|
460
|
+
class: H(["flex size-9 shrink-0 items-center justify-center rounded-full", d(y).classes]),
|
|
461
461
|
"aria-hidden": "true"
|
|
462
462
|
}, [
|
|
463
|
-
T(s(
|
|
464
|
-
name: d(
|
|
463
|
+
T(s(Pe), {
|
|
464
|
+
name: d(y).icon,
|
|
465
465
|
size: 18
|
|
466
466
|
}, null, 8, ["name"])
|
|
467
467
|
], 2),
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
class: H(["block text-subheadline",
|
|
471
|
-
},
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
datetime:
|
|
468
|
+
P("span", Xe, [
|
|
469
|
+
P("span", {
|
|
470
|
+
class: H(["block text-subheadline", y.read_at === null ? "font-semibold text-content-strong" : "font-medium text-content"])
|
|
471
|
+
}, L(y.title), 3),
|
|
472
|
+
y.body ? (_(), S("span", Ze, L(y.body), 1)) : R("", !0),
|
|
473
|
+
P("time", {
|
|
474
|
+
datetime: y.created_at,
|
|
475
475
|
class: "mt-0.5 block text-footnote text-content-muted"
|
|
476
|
-
},
|
|
476
|
+
}, L(s(u).relative(y.created_at)), 9, et)
|
|
477
477
|
]),
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
], 8,
|
|
478
|
+
y.read_at === null ? (_(), S("span", tt)) : R("", !0),
|
|
479
|
+
y.read_at === null ? (_(), S("span", nt, L(s(a)("core.notifications.unread")), 1)) : R("", !0)
|
|
480
|
+
], 8, Qe)
|
|
481
481
|
]))), 128))
|
|
482
482
|
]),
|
|
483
|
-
n.inbox.hasMore.value ? (
|
|
484
|
-
n.inbox.more.value === "failed" ? (
|
|
485
|
-
T(s(
|
|
483
|
+
n.inbox.hasMore.value ? (_(), S("div", it, [
|
|
484
|
+
n.inbox.more.value === "failed" ? (_(), S("p", at, L(s(a)("core.notifications.load_more_error")), 1)) : R("", !0),
|
|
485
|
+
T(s(K), {
|
|
486
486
|
prominence: "plain",
|
|
487
487
|
size: "sm",
|
|
488
488
|
processing: n.inbox.more.value === "loading",
|
|
489
|
-
onClick:
|
|
489
|
+
onClick: l[1] || (l[1] = (y) => n.inbox.loadMore())
|
|
490
490
|
}, {
|
|
491
|
-
default:
|
|
492
|
-
X(
|
|
491
|
+
default: A(() => [
|
|
492
|
+
X(L(s(a)("core.notifications.load_more")), 1)
|
|
493
493
|
]),
|
|
494
494
|
_: 1
|
|
495
495
|
}, 8, ["processing"])
|
|
496
|
-
])) :
|
|
496
|
+
])) : R("", !0)
|
|
497
497
|
]),
|
|
498
498
|
_: 1
|
|
499
499
|
}, 8, ["state", "empty-title", "empty-description"])
|
|
500
500
|
]));
|
|
501
501
|
}
|
|
502
|
-
}),
|
|
502
|
+
}), st = { class: "flex items-center justify-center" }, rt = /* @__PURE__ */ q({
|
|
503
503
|
__name: "NotificationBell",
|
|
504
504
|
setup(n) {
|
|
505
|
-
const { t } =
|
|
506
|
-
return (r, h) => s(e) ? (
|
|
507
|
-
s(
|
|
505
|
+
const { t } = I(), { inbox: e, settings: i } = ne(), a = we(), c = he("sheet"), u = N(() => e.value?.unreadCount.value ?? 0), g = N(() => u.value > 0 ? t("core.notifications.open_unread", { count: u.value }) : t("core.notifications.open")), o = N(() => u.value > 0 ? We(u.value) : void 0);
|
|
506
|
+
return (r, h) => s(e) ? (_(), S(G, { key: 0 }, [
|
|
507
|
+
s(a) ? (_(), S(G, { key: 1 }, [
|
|
508
508
|
T(J, {
|
|
509
509
|
icon: "notification3Line",
|
|
510
|
-
label:
|
|
511
|
-
badge:
|
|
510
|
+
label: g.value,
|
|
511
|
+
badge: o.value,
|
|
512
512
|
"data-notification-bell": "",
|
|
513
513
|
onClick: h[1] || (h[1] = (d) => {
|
|
514
514
|
c.value?.present(), s(e).load();
|
|
@@ -518,13 +518,13 @@ const ce = /* @__PURE__ */ O({
|
|
|
518
518
|
ref_key: "sheet",
|
|
519
519
|
ref: c,
|
|
520
520
|
title: s(t)("core.notifications.title")
|
|
521
|
-
},
|
|
522
|
-
footer:
|
|
523
|
-
|
|
524
|
-
T(
|
|
521
|
+
}, ye({
|
|
522
|
+
footer: A(() => [
|
|
523
|
+
P("div", st, [
|
|
524
|
+
T(ue, { inbox: s(e) }, null, 8, ["inbox"])
|
|
525
525
|
])
|
|
526
526
|
]),
|
|
527
|
-
default:
|
|
527
|
+
default: A(() => [
|
|
528
528
|
T(Q, {
|
|
529
529
|
inbox: s(e),
|
|
530
530
|
appearance: "sheet",
|
|
@@ -535,15 +535,15 @@ const ce = /* @__PURE__ */ O({
|
|
|
535
535
|
}, [
|
|
536
536
|
s(i) ? {
|
|
537
537
|
name: "actions",
|
|
538
|
-
fn:
|
|
539
|
-
T(
|
|
538
|
+
fn: A(() => [
|
|
539
|
+
T(le, {
|
|
540
540
|
onClick: h[2] || (h[2] = (d) => c.value?.dismiss())
|
|
541
541
|
})
|
|
542
542
|
]),
|
|
543
543
|
key: "0"
|
|
544
544
|
} : void 0
|
|
545
545
|
]), 1032, ["title"])
|
|
546
|
-
], 64)) : (
|
|
546
|
+
], 64)) : (_(), U(s(Se), {
|
|
547
547
|
key: 0,
|
|
548
548
|
placement: "bottom-start",
|
|
549
549
|
width: "auto",
|
|
@@ -551,16 +551,16 @@ const ce = /* @__PURE__ */ O({
|
|
|
551
551
|
label: s(t)("core.notifications.title"),
|
|
552
552
|
onPresented: h[0] || (h[0] = (d) => s(e).load())
|
|
553
553
|
}, {
|
|
554
|
-
trigger:
|
|
554
|
+
trigger: A(({ toggle: d, attrs: x }) => [
|
|
555
555
|
T(J, Z(x, {
|
|
556
556
|
icon: "notification3Line",
|
|
557
|
-
label:
|
|
558
|
-
badge:
|
|
557
|
+
label: g.value,
|
|
558
|
+
badge: o.value,
|
|
559
559
|
"data-notification-bell": "",
|
|
560
560
|
onClick: d
|
|
561
561
|
}), null, 16, ["label", "badge", "onClick"])
|
|
562
562
|
]),
|
|
563
|
-
default:
|
|
563
|
+
default: A(({ dismiss: d }) => [
|
|
564
564
|
T(Q, {
|
|
565
565
|
inbox: s(e),
|
|
566
566
|
appearance: "popover",
|
|
@@ -569,62 +569,84 @@ const ce = /* @__PURE__ */ O({
|
|
|
569
569
|
]),
|
|
570
570
|
_: 1
|
|
571
571
|
}, 8, ["label"]))
|
|
572
|
-
], 64)) :
|
|
572
|
+
], 64)) : R("", !0);
|
|
573
573
|
}
|
|
574
|
-
}),
|
|
575
|
-
function
|
|
576
|
-
const t = new Set(
|
|
574
|
+
}), ct = ["channels", "quiet", "device", "devices"];
|
|
575
|
+
function ut(n) {
|
|
576
|
+
const t = new Set(ct);
|
|
577
577
|
for (const e of n) {
|
|
578
578
|
if (t.has(e.id)) throw new Error(`notificationsFeature: the settings section "${e.id}" is a built-in id or is given twice.`);
|
|
579
579
|
t.add(e.id);
|
|
580
580
|
}
|
|
581
581
|
return n;
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function lt() {
|
|
584
584
|
return {
|
|
585
585
|
id: "notifications.push",
|
|
586
586
|
scope: "session",
|
|
587
587
|
start({ signal: n, platform: t, report: e }) {
|
|
588
|
-
const i =
|
|
589
|
-
return Ae(t.http, i, n).catch((
|
|
590
|
-
n.aborted || e(
|
|
591
|
-
}), t.session.onBeforeSignOut((
|
|
588
|
+
const i = W();
|
|
589
|
+
return Ae(t.http, i, n).catch((a) => {
|
|
590
|
+
n.aborted || e(a);
|
|
591
|
+
}), t.session.onBeforeSignOut((a, c) => re(t.http, i, c));
|
|
592
592
|
}
|
|
593
593
|
};
|
|
594
594
|
}
|
|
595
|
-
function
|
|
595
|
+
function dt(n) {
|
|
596
596
|
return {
|
|
597
597
|
id: "notifications.inbox",
|
|
598
598
|
scope: "session",
|
|
599
599
|
start({ signal: t, platform: e }) {
|
|
600
600
|
const i = e.config.apiBase.replace(/\/+$/, "");
|
|
601
|
-
return n.value =
|
|
601
|
+
return n.value = je({ http: e.http, streamUrl: `${i}/${E.stream.path.replace(/^\/+/, "")}`, signal: t }), () => {
|
|
602
602
|
n.value = null;
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
607
|
function At(n = {}) {
|
|
608
|
-
const t =
|
|
609
|
-
return
|
|
608
|
+
const t = z(null), e = n.deadLetters ?? {}, i = n.settings ?? !0, a = n.push ?? !0, c = ut(n.settingsSections ?? []);
|
|
609
|
+
return ve({
|
|
610
610
|
id: "notifications",
|
|
611
611
|
routes: [...e === !1 ? [] : Y.records, ...i ? j.records : []],
|
|
612
612
|
navigation: e !== !1 && e.destination ? [{ destination: e.destination, to: Y.index }] : [],
|
|
613
|
-
context: me(Le, { inbox: t, categories: n.categories ?? {}, settings: i, push:
|
|
613
|
+
context: me(Le, { inbox: t, categories: n.categories ?? {}, settings: i, push: a, sections: c }),
|
|
614
614
|
contributions: [
|
|
615
|
-
{ id: "notifications.bell", slot: "headerActions", component:
|
|
616
|
-
...i ? [{ id: "notifications.settings", slot: "accountMenu", component:
|
|
615
|
+
{ id: "notifications.bell", slot: "headerActions", component: rt, scope: "authenticated" },
|
|
616
|
+
...i ? [{ id: "notifications.settings", slot: "accountMenu", component: Oe, scope: "authenticated", optional: !0, order: -9 }] : []
|
|
617
617
|
],
|
|
618
|
-
effects: [
|
|
618
|
+
effects: [dt(t), ...a ? [lt()] : []]
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
|
+
function Mt(n = ee().http, t = W()) {
|
|
622
|
+
const e = Me(n, t), i = C(!1), a = C(!1), c = C("unknown"), u = async () => {
|
|
623
|
+
await e.inspect(), c.value = t.permission();
|
|
624
|
+
};
|
|
625
|
+
return Promise.all([
|
|
626
|
+
u(),
|
|
627
|
+
n.request(E.push, void 0).then(({ data: g }) => void (a.value = g.enabled), () => {
|
|
628
|
+
})
|
|
629
|
+
]).finally(() => void (i.value = !0)), {
|
|
630
|
+
ready: i,
|
|
631
|
+
available: N(() => a.value && (e.state.value === "off" || e.state.value === "on" || e.state.value === "denied")),
|
|
632
|
+
permission: c,
|
|
633
|
+
subscribed: N(() => e.state.value === "on"),
|
|
634
|
+
busy: e.busy,
|
|
635
|
+
enable: async () => {
|
|
636
|
+
const g = await e.enable();
|
|
637
|
+
return c.value = t.permission(), g === "on";
|
|
638
|
+
},
|
|
639
|
+
disable: e.disable
|
|
640
|
+
};
|
|
641
|
+
}
|
|
621
642
|
export {
|
|
622
643
|
$t as R,
|
|
623
|
-
|
|
644
|
+
Me as a,
|
|
624
645
|
j as b,
|
|
625
646
|
At as c,
|
|
626
647
|
Y as d,
|
|
627
|
-
|
|
648
|
+
Rt as e,
|
|
649
|
+
Mt as f,
|
|
628
650
|
E as n,
|
|
629
|
-
|
|
651
|
+
ne as u
|
|
630
652
|
};
|