@carlonicora/nextjs-jsonapi 4.2.3 → 5.0.0
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/{BlockNoteEditor-NTKPWYWW.mjs → BlockNoteEditor-7BKKGFH3.mjs} +2 -2
- package/dist/{BlockNoteEditor-J533UMWG.js → BlockNoteEditor-E6HJD4HB.js} +9 -9
- package/dist/{BlockNoteEditor-J533UMWG.js.map → BlockNoteEditor-E6HJD4HB.js.map} +1 -1
- package/dist/billing/index.js +371 -371
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-NCWCC56Q.mjs → chunk-MELHUPVN.mjs} +28 -13
- package/dist/chunk-MELHUPVN.mjs.map +1 -0
- package/dist/{chunk-4EGA5UP5.js → chunk-TPGXNPGY.js} +202 -187
- package/dist/chunk-TPGXNPGY.js.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/features/analytics/index.js +88 -88
- package/dist/features/analytics/index.mjs +1 -1
- package/dist/features/help/index.js +31 -31
- package/dist/features/help/index.mjs +1 -1
- package/dist/features/tokenusage/index.js +75 -75
- package/dist/features/tokenusage/index.mjs +1 -1
- package/dist/next-config/index.d.mts +0 -1
- package/dist/next-config/index.d.ts +0 -1
- package/dist/next-config/index.js +0 -6
- package/dist/next-config/index.js.map +1 -1
- package/dist/next-config/index.mjs +0 -6
- package/dist/next-config/index.mjs.map +1 -1
- package/package.json +4 -2
- package/pwa/offline.template.html +138 -0
- package/pwa/sw.js +175 -0
- package/src/features/notification/components/notifications/PushNotificationProvider.tsx +5 -1
- package/src/features/notification/components/notifications/__tests__/PushNotificationProvider.spec.tsx +51 -0
- package/src/hooks/__tests__/usePushNotifications.spec.tsx +87 -34
- package/src/hooks/usePushNotifications.ts +42 -18
- package/src/next-config/__tests__/createNextConfig.spec.ts +7 -5
- package/src/next-config/index.ts +1 -8
- package/src/pwa/__tests__/offline.template.spec.ts +246 -0
- package/src/pwa/__tests__/sw.spec.ts +309 -0
- package/dist/chunk-4EGA5UP5.js.map +0 -1
- package/dist/chunk-NCWCC56Q.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-NTKPWYWW.mjs.map → BlockNoteEditor-7BKKGFH3.mjs.map} +0 -0
package/dist/billing/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ACTION_TYPES,
|
|
3
3
|
RbacService,
|
|
4
|
-
getAppUrl,
|
|
5
4
|
getPublicApiUrl,
|
|
6
5
|
getReferralConfig,
|
|
7
6
|
getRegistrationMode,
|
|
@@ -10684,7 +10683,7 @@ import { useRef as useRef18 } from "react";
|
|
|
10684
10683
|
import dynamic from "next/dynamic";
|
|
10685
10684
|
import React18 from "react";
|
|
10686
10685
|
import { jsx as jsx90 } from "react/jsx-runtime";
|
|
10687
|
-
var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-
|
|
10686
|
+
var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-7BKKGFH3.mjs"), {
|
|
10688
10687
|
ssr: false
|
|
10689
10688
|
});
|
|
10690
10689
|
var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
|
|
@@ -15185,16 +15184,16 @@ function urlBase64ToUint8Array(base64String) {
|
|
|
15185
15184
|
return outputArray;
|
|
15186
15185
|
}
|
|
15187
15186
|
__name(urlBase64ToUint8Array, "urlBase64ToUint8Array");
|
|
15188
|
-
function usePushNotifications() {
|
|
15189
|
-
const { currentUser,
|
|
15187
|
+
function usePushNotifications(params) {
|
|
15188
|
+
const { currentUser, canSubscribe } = params;
|
|
15189
|
+
const userId = currentUser?.id;
|
|
15190
15190
|
useEffect37(() => {
|
|
15191
|
+
if (!userId || !canSubscribe) return;
|
|
15191
15192
|
const register = /* @__PURE__ */ __name(async () => {
|
|
15192
15193
|
if ("serviceWorker" in navigator && "PushManager" in window) {
|
|
15193
15194
|
try {
|
|
15194
|
-
const sessionKey = `push_registered_${
|
|
15195
|
-
const
|
|
15196
|
-
const swUrl = ENV.IS_PRODUCTION ? `${getAppUrl()}/sw.js` : `${getAppUrl()}/sw-dev.js`;
|
|
15197
|
-
const registration = await navigator.serviceWorker.register(swUrl);
|
|
15195
|
+
const sessionKey = `push_registered_${userId}`;
|
|
15196
|
+
const registration = await navigator.serviceWorker.register("/sw.js", { updateViaCache: "none" });
|
|
15198
15197
|
let permission = Notification.permission;
|
|
15199
15198
|
if (permission === "default") {
|
|
15200
15199
|
permission = await Notification.requestPermission();
|
|
@@ -15221,7 +15220,7 @@ function usePushNotifications() {
|
|
|
15221
15220
|
keys: subscription.toJSON().keys
|
|
15222
15221
|
};
|
|
15223
15222
|
const subscriptionHash = btoa(JSON.stringify(plainSubscription));
|
|
15224
|
-
if (
|
|
15223
|
+
if (sessionStorage.getItem(sessionKey) !== subscriptionHash) {
|
|
15225
15224
|
await PushService.register({ data: plainSubscription });
|
|
15226
15225
|
sessionStorage.setItem(sessionKey, subscriptionHash);
|
|
15227
15226
|
}
|
|
@@ -15230,8 +15229,23 @@ function usePushNotifications() {
|
|
|
15230
15229
|
}
|
|
15231
15230
|
}
|
|
15232
15231
|
}, "register");
|
|
15233
|
-
|
|
15234
|
-
}, [
|
|
15232
|
+
register();
|
|
15233
|
+
}, [userId, canSubscribe]);
|
|
15234
|
+
useEffect37(() => {
|
|
15235
|
+
if (!userId || !canSubscribe) return;
|
|
15236
|
+
if (!("serviceWorker" in navigator)) return;
|
|
15237
|
+
const sessionKey = `push_registered_${userId}`;
|
|
15238
|
+
const onMessage = /* @__PURE__ */ __name((event) => {
|
|
15239
|
+
if (event.data?.type !== "PUSH_RESUBSCRIBED" || !event.data.subscription) return;
|
|
15240
|
+
const subscription = event.data.subscription;
|
|
15241
|
+
const subscriptionHash = btoa(JSON.stringify(subscription));
|
|
15242
|
+
if (sessionStorage.getItem(sessionKey) === subscriptionHash) return;
|
|
15243
|
+
void PushService.register({ data: subscription }).then(() => sessionStorage.setItem(sessionKey, subscriptionHash)).catch((error) => console.error("Error re-registering rotated push subscription:", error));
|
|
15244
|
+
}, "onMessage");
|
|
15245
|
+
const container = navigator.serviceWorker;
|
|
15246
|
+
container.addEventListener("message", onMessage);
|
|
15247
|
+
return () => container.removeEventListener("message", onMessage);
|
|
15248
|
+
}, [userId, canSubscribe]);
|
|
15235
15249
|
}
|
|
15236
15250
|
__name(usePushNotifications, "usePushNotifications");
|
|
15237
15251
|
|
|
@@ -25212,7 +25226,8 @@ __name(NotificationModal, "NotificationModal");
|
|
|
25212
25226
|
// src/features/notification/components/notifications/PushNotificationProvider.tsx
|
|
25213
25227
|
import { Fragment as Fragment59, jsx as jsx284 } from "react/jsx-runtime";
|
|
25214
25228
|
function PushNotificationProvider({ children }) {
|
|
25215
|
-
|
|
25229
|
+
const { currentUser, hasRole } = useCurrentUserContext();
|
|
25230
|
+
usePushNotifications({ currentUser: currentUser ?? void 0, canSubscribe: !hasRole(getRoleId().Administrator) });
|
|
25216
25231
|
return /* @__PURE__ */ jsx284(Fragment59, { children });
|
|
25217
25232
|
}
|
|
25218
25233
|
__name(PushNotificationProvider, "PushNotificationProvider");
|
|
@@ -28288,4 +28303,4 @@ export {
|
|
|
28288
28303
|
useOAuthClients,
|
|
28289
28304
|
useOAuthClient
|
|
28290
28305
|
};
|
|
28291
|
-
//# sourceMappingURL=chunk-
|
|
28306
|
+
//# sourceMappingURL=chunk-MELHUPVN.mjs.map
|