@auditauth/next 0.1.3 → 0.1.5

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/guard.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SessionUser } from "./types";
2
2
  type AuthContextValue = {
3
- user: SessionUser | null;
3
+ user: SessionUser;
4
4
  };
5
5
  declare const useAuditAuth: () => AuthContextValue;
6
6
  type AuditAuthGuardProps = {
package/dist/guard.js CHANGED
@@ -11,7 +11,7 @@ const useAuditAuth = () => {
11
11
  return ctx;
12
12
  };
13
13
  const AuditAuthGuard = (props) => {
14
- const [user, setUser] = useState(null);
14
+ const [user, setUser] = useState({});
15
15
  useEffect(() => {
16
16
  let cancelled = false;
17
17
  const checkSession = async () => {
package/dist/sdk.js CHANGED
@@ -194,15 +194,11 @@ class AuditAuthNext {
194
194
  /* ------------------------------------------------------------------------ */
195
195
  pushMetric(payload) {
196
196
  let sid = this.cookies.get(SETTINGS.cookies.session_id.name);
197
- if (!sid) {
198
- sid = 's_' + crypto.randomUUID();
199
- this.cookies.set(SETTINGS.cookies.session_id.name, sid, SETTINGS.cookies.session_id.config);
200
- }
201
197
  queueMicrotask(() => {
202
198
  fetch(`${this.config.baseUrl}${SETTINGS.bff.paths.metrics}`, {
203
199
  method: 'POST',
204
200
  headers: { 'Content-Type': 'application/json' },
205
- body: JSON.stringify({ ...payload, session_id: sid }),
201
+ body: JSON.stringify({ ...payload, session_id: sid ?? crypto.randomUUID() }),
206
202
  }).catch(() => { });
207
203
  });
208
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auditauth/next",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Official AuditAuth SDK for Next.js",
5
5
  "license": "MIT",
6
6
  "author": "Nimibyte",