@carlonicora/nextjs-jsonapi 4.2.3 → 5.0.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/{BlockNoteEditor-J533UMWG.js → BlockNoteEditor-IU4IZBF3.js} +9 -9
- package/dist/{BlockNoteEditor-J533UMWG.js.map → BlockNoteEditor-IU4IZBF3.js.map} +1 -1
- package/dist/{BlockNoteEditor-NTKPWYWW.mjs → BlockNoteEditor-MLOWVEWH.mjs} +2 -2
- package/dist/billing/index.js +371 -371
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-NCWCC56Q.mjs → chunk-7F5Q3QQV.mjs} +30 -13
- package/dist/chunk-7F5Q3QQV.mjs.map +1 -0
- package/dist/{chunk-4EGA5UP5.js → chunk-ZPXXZRS2.js} +205 -188
- package/dist/chunk-ZPXXZRS2.js.map +1 -0
- package/dist/client/index.d.mts +7 -2
- package/dist/client/index.d.ts +7 -2
- package/dist/client/index.js +4 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +3 -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 +44 -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-MLOWVEWH.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-MLOWVEWH.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,10 +15229,26 @@ 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");
|
|
15251
|
+
var usePushNotifications_default = usePushNotifications;
|
|
15237
15252
|
|
|
15238
15253
|
// src/hooks/useSocket.ts
|
|
15239
15254
|
import { useEffect as useEffect38, useRef as useRef27, useState as useState47 } from "react";
|
|
@@ -25212,7 +25227,8 @@ __name(NotificationModal, "NotificationModal");
|
|
|
25212
25227
|
// src/features/notification/components/notifications/PushNotificationProvider.tsx
|
|
25213
25228
|
import { Fragment as Fragment59, jsx as jsx284 } from "react/jsx-runtime";
|
|
25214
25229
|
function PushNotificationProvider({ children }) {
|
|
25215
|
-
|
|
25230
|
+
const { currentUser, hasRole } = useCurrentUserContext();
|
|
25231
|
+
usePushNotifications_default({ currentUser: currentUser ?? void 0, canSubscribe: !hasRole(getRoleId().Administrator) });
|
|
25216
25232
|
return /* @__PURE__ */ jsx284(Fragment59, { children });
|
|
25217
25233
|
}
|
|
25218
25234
|
__name(PushNotificationProvider, "PushNotificationProvider");
|
|
@@ -28213,6 +28229,7 @@ export {
|
|
|
28213
28229
|
NotificationsList,
|
|
28214
28230
|
NotificationsListContainer,
|
|
28215
28231
|
NotificationModal,
|
|
28232
|
+
usePushNotifications,
|
|
28216
28233
|
PushNotificationProvider,
|
|
28217
28234
|
OnboardingCard,
|
|
28218
28235
|
ReferralCodeCapture,
|
|
@@ -28288,4 +28305,4 @@ export {
|
|
|
28288
28305
|
useOAuthClients,
|
|
28289
28306
|
useOAuthClient
|
|
28290
28307
|
};
|
|
28291
|
-
//# sourceMappingURL=chunk-
|
|
28308
|
+
//# sourceMappingURL=chunk-7F5Q3QQV.mjs.map
|