@mcy2015/pi-web 0.14.4 → 0.15.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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +16 -16
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +4 -4
- package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/api/app-update/route.js +1 -1
- package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
- package/.next/server/app/api/auth/providers/route.js +1 -1
- package/.next/server/app/api/channels/route.js +1 -1
- package/.next/server/app/api/models/enabled/route.js +1 -1
- package/.next/server/app/api/models/refresh/route.js +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js +1 -54
- package/.next/server/app/files/page_client-reference-manifest.js +1 -1
- package/.next/server/app/files.html +1 -1
- package/.next/server/app/files.rsc +6 -6
- package/.next/server/app/files.segments/_full.segment.rsc +6 -6
- package/.next/server/app/files.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/files.segments/files/__PAGE__.segment.rsc +6 -6
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +9 -9
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +9 -9
- package/.next/server/app/index.segments/_full.segment.rsc +9 -9
- package/.next/server/app/index.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +5 -5
- package/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/.next/server/app/login.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/.next/server/app/page.js +5 -5
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/share/[code]/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +16 -16
- package/.next/server/chunks/1795.js +1 -1
- package/.next/server/chunks/1975.js +1 -1
- package/.next/server/chunks/210.js +4 -4
- package/.next/server/chunks/2243.js +1 -1
- package/.next/server/chunks/27.js +1 -1
- package/.next/server/chunks/3757.js +1 -1
- package/.next/server/chunks/3824.js +1 -1
- package/.next/server/chunks/6277.js +1 -1
- package/.next/server/chunks/6429.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/1278-af0c1d3a3b296aca.js +1 -0
- package/.next/static/chunks/8646-8131bc4913418a3d.js +1 -0
- package/.next/static/chunks/{9176-6acf7fc42d79436d.js → 9176-91a933328be48cb8.js} +3 -3
- package/.next/static/chunks/app/{layout-395bf7faaeb179d9.js → layout-f4e5293b80bb23b9.js} +1 -1
- package/.next/static/chunks/app/page-445764fdb52ada7f.js +1075 -0
- package/.next/static/css/0d24ca7ab5ce5f23.css +1 -0
- package/.next/static/css/1c235f9240d931ae.css +1 -0
- package/.next/trace +206 -37
- package/.next/trace-build +1 -1
- package/package.json +1 -1
- package/public/sw.js +31 -7
- package/public/sw.test.mjs +49 -2
- package/.next/static/chunks/1278-15a5c269570dd91e.js +0 -1
- package/.next/static/chunks/8646-03a3bf39da5f3a89.js +0 -1
- package/.next/static/chunks/app/page-4d29ccc33c8c0519.js +0 -1075
- package/.next/static/css/9c377785ffe703ad.css +0 -1
- package/.next/static/css/a1dfc45432090309.css +0 -1
- /package/.next/static/{NORH1QmfDOihd6mx4MJ8X → QEAOCtEajdXYAGZPJ3OG_}/_buildManifest.js +0 -0
- /package/.next/static/{NORH1QmfDOihd6mx4MJ8X → QEAOCtEajdXYAGZPJ3OG_}/_ssgManifest.js +0 -0
package/.next/trace-build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"name":"run-webpack","duration":
|
|
1
|
+
[{"name":"run-webpack","duration":11218032,"timestamp":1077509608957,"id":14,"parentId":1,"tags":{},"startTime":1793753598527,"traceId":"bf7fefc2a50b3c7b"},{"name":"run-typescript","duration":6447256,"timestamp":1077520829873,"id":9458,"parentId":1,"tags":{},"startTime":1793753609748,"traceId":"bf7fefc2a50b3c7b"},{"name":"static-check","duration":1022392,"timestamp":1077527285779,"id":9461,"parentId":1,"tags":{},"startTime":1793753616204,"traceId":"bf7fefc2a50b3c7b"},{"name":"static-generation","duration":1962027,"timestamp":1077528319834,"id":9629,"parentId":1,"tags":{},"startTime":1793753617238,"traceId":"bf7fefc2a50b3c7b"},{"name":"collect-build-traces","duration":9226396,"timestamp":1077528309482,"id":9626,"parentId":1,"tags":{},"startTime":1793753617228,"traceId":"bf7fefc2a50b3c7b"},{"name":"telemetry-flush","duration":13,"timestamp":1077537537393,"id":9638,"parentId":1,"tags":{},"startTime":1793753626456,"traceId":"bf7fefc2a50b3c7b"},{"name":"next-build","duration":28679884,"timestamp":1077508857527,"id":1,"tags":{"buildMode":"default","version":"16.4.4","bundler":"webpack","has-custom-webpack-config":"true","use-build-worker":"false"},"startTime":1793753597776,"traceId":"bf7fefc2a50b3c7b"}]
|
package/package.json
CHANGED
package/public/sw.js
CHANGED
|
@@ -87,15 +87,39 @@ self.addEventListener("push", (event) => {
|
|
|
87
87
|
// subscription in the background-delivery case. Notifications sharing a tag
|
|
88
88
|
// replace each other instead of stacking, so a visible window merely sees
|
|
89
89
|
// the completion notification re-appear.
|
|
90
|
-
event.waitUntil(
|
|
91
|
-
self.registration.showNotification(title, {
|
|
92
|
-
body,
|
|
93
|
-
data: { url: typeof url === "string" && url ? url : "/" },
|
|
94
|
-
...(typeof tag === "string" && tag ? { tag, renotify: true } : {}),
|
|
95
|
-
}),
|
|
96
|
-
);
|
|
90
|
+
event.waitUntil(showPushNotification(title, body, url, tag));
|
|
97
91
|
});
|
|
98
92
|
|
|
93
|
+
// An open page announces a completion itself from its event stream, and the
|
|
94
|
+
// push for the same completion lands a moment later. Both carry the session's
|
|
95
|
+
// tag; with renotify the push replaced the page's notification and alerted a
|
|
96
|
+
// second time (#1515). A same-tag notification shown this recently is that
|
|
97
|
+
// completion's, so the push replaces it quietly. An older one belongs to an
|
|
98
|
+
// earlier task and the push alerts again (#701).
|
|
99
|
+
const RECENT_NOTIFICATION_MS = 10000;
|
|
100
|
+
|
|
101
|
+
async function showPushNotification(title, body, url, tag) {
|
|
102
|
+
const shownAt = Date.now();
|
|
103
|
+
const data = { url: typeof url === "string" && url ? url : "/", shownAt };
|
|
104
|
+
if (typeof tag !== "string" || !tag) {
|
|
105
|
+
return self.registration.showNotification(title, { body, data });
|
|
106
|
+
}
|
|
107
|
+
const renotify = !(await hasRecentNotification(tag, shownAt));
|
|
108
|
+
return self.registration.showNotification(title, { body, data, tag, renotify });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function hasRecentNotification(tag, now) {
|
|
112
|
+
try {
|
|
113
|
+
const notifications = await self.registration.getNotifications({ tag });
|
|
114
|
+
return notifications.some((notification) => {
|
|
115
|
+
const shownAt = notification.data?.shownAt;
|
|
116
|
+
return typeof shownAt === "number" && now - shownAt >= 0 && now - shownAt < RECENT_NOTIFICATION_MS;
|
|
117
|
+
});
|
|
118
|
+
} catch {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
99
123
|
self.addEventListener("notificationclick", (event) => {
|
|
100
124
|
event.notification.close();
|
|
101
125
|
|
package/public/sw.test.mjs
CHANGED
|
@@ -26,7 +26,7 @@ function dispatchNotificationClick(data) {
|
|
|
26
26
|
return { pending, wasClosed: () => closed };
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function dispatchPush(payload, clients) {
|
|
29
|
+
function dispatchPush(payload, clients, getNotifications = async () => []) {
|
|
30
30
|
let pending;
|
|
31
31
|
const shown = [];
|
|
32
32
|
self.clients = {
|
|
@@ -35,6 +35,7 @@ function dispatchPush(payload, clients) {
|
|
|
35
35
|
};
|
|
36
36
|
self.registration = {
|
|
37
37
|
showNotification: async (title, options) => { shown.push({ title, options }); },
|
|
38
|
+
getNotifications,
|
|
38
39
|
};
|
|
39
40
|
listeners.get("push")({
|
|
40
41
|
data: { json: () => payload },
|
|
@@ -60,17 +61,63 @@ test("push always shows a notification, even when a window is visible", async ()
|
|
|
60
61
|
|
|
61
62
|
// iOS revokes the push subscription when a push is handled without a
|
|
62
63
|
// notification, so the notification must never be suppressed.
|
|
64
|
+
assert.equal(event.shown.length, 1);
|
|
65
|
+
const shownAt = event.shown[0].options.data.shownAt;
|
|
66
|
+
assert.equal(typeof shownAt, "number");
|
|
63
67
|
assert.deepEqual(event.shown, [{
|
|
64
68
|
title: "Session complete",
|
|
65
69
|
options: {
|
|
66
70
|
body: "Task finished.",
|
|
67
|
-
data: { url: "/?session=session-1" },
|
|
71
|
+
data: { url: "/?session=session-1", shownAt },
|
|
68
72
|
tag: "pi-session-complete:session-1",
|
|
69
73
|
renotify: true,
|
|
70
74
|
},
|
|
71
75
|
}]);
|
|
72
76
|
});
|
|
73
77
|
|
|
78
|
+
const completionPush = {
|
|
79
|
+
title: "Session complete",
|
|
80
|
+
body: "Task finished.",
|
|
81
|
+
url: "/?session=session-1",
|
|
82
|
+
tag: "pi-session-complete:session-1",
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
function existingNotifications(list) {
|
|
86
|
+
return async ({ tag }) => list.filter((notification) => notification.tag === tag);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
test("push quietly replaces the page's notification of the same completion (#1515)", async () => {
|
|
90
|
+
const event = dispatchPush(completionPush, [], existingNotifications([
|
|
91
|
+
{ tag: "pi-session-complete:session-1", data: { url: "/?session=session-1", shownAt: Date.now() - 600 } },
|
|
92
|
+
]));
|
|
93
|
+
await event.pending;
|
|
94
|
+
|
|
95
|
+
// Still shown, which iOS requires, but without a second alert.
|
|
96
|
+
assert.equal(event.shown.length, 1);
|
|
97
|
+
assert.equal(event.shown[0].options.tag, "pi-session-complete:session-1");
|
|
98
|
+
assert.equal(event.shown[0].options.renotify, false);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test("push alerts again over an earlier task's notification (#701)", async () => {
|
|
102
|
+
const event = dispatchPush(completionPush, [], existingNotifications([
|
|
103
|
+
{ tag: "pi-session-complete:session-1", data: { url: "/?session=session-1", shownAt: Date.now() - 60_000 } },
|
|
104
|
+
{ tag: "pi-session-complete:session-1", data: { url: "/?session=session-1" } },
|
|
105
|
+
{ tag: "pi-session-complete:session-2", data: { url: "/?session=session-2", shownAt: Date.now() } },
|
|
106
|
+
]));
|
|
107
|
+
await event.pending;
|
|
108
|
+
|
|
109
|
+
assert.equal(event.shown.length, 1);
|
|
110
|
+
assert.equal(event.shown[0].options.renotify, true);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("push alerts when the browser cannot list notifications", async () => {
|
|
114
|
+
const event = dispatchPush(completionPush, [], async () => { throw new Error("unsupported"); });
|
|
115
|
+
await event.pending;
|
|
116
|
+
|
|
117
|
+
assert.equal(event.shown.length, 1);
|
|
118
|
+
assert.equal(event.shown[0].options.renotify, true);
|
|
119
|
+
});
|
|
120
|
+
|
|
74
121
|
test("push ignores malformed payloads", async () => {
|
|
75
122
|
const event = dispatchPush(
|
|
76
123
|
{ title: "", body: 42 },
|