@strands.gg/accui 2.17.42 → 2.17.43

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.
@@ -1 +1 @@
1
- "use strict";const r=require("nuxt/app"),g=r.defineNuxtRouteMiddleware(a=>{const n=r.useRuntimeConfig().public.strandsAuth;return new Promise(c=>{Promise.resolve().then(()=>require("../composables/useStrandsAuth.cjs.js")).then(({useStrandsAuth:d})=>{const{isAuthenticated:i,isLoading:h}=d(),s=()=>{if(h.value){setTimeout(s,50);return}const e=a.path,l=n.protectedRoutes?.some(t=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t||e.startsWith(t+"/")),f=n.guestOnlyRoutes?.some(t=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t||e.startsWith(t+"/"));if(l&&!i.value){const t=n.authUrl||"/auth",o=t.includes("?")?`${t}&redirect=${encodeURIComponent(e)}`:`${t}?redirect=${encodeURIComponent(e)}`;try{return r.navigateTo(o)}catch(u){if(console.warn("[Strands Auth] navigateTo failed, using window.location:",u),typeof window<"u"){window.location.href=o;return}throw u}}if(f&&i.value)return r.navigateTo(n.onSignInUrl||"/dashboard");c()};s()})})});module.exports=g;
1
+ "use strict";const r=require("nuxt/app"),g=r.defineNuxtRouteMiddleware(c=>{const n=r.useRuntimeConfig().public.strandsAuth;return new Promise(a=>{Promise.resolve().then(()=>require("../composables/useStrandsAuth.cjs.js")).then(({useStrandsAuth:d})=>{const{isAuthenticated:i,isLoading:l}=d(),o=()=>{if(l.value){setTimeout(o,50);return}const e=c.path,h=n.protectedRoutes?.some(t=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t||e.startsWith(t+"/")),f=n.guestOnlyRoutes?.some(t=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t||e.startsWith(t+"/"));if(h&&!i.value&&n.authUrl){const t=n.authUrl,s=t.includes("?")?`${t}&redirect=${encodeURIComponent(e)}`:`${t}?redirect=${encodeURIComponent(e)}`;try{return r.navigateTo(s)}catch(u){if(console.warn("[Strands Auth] navigateTo failed, using window.location:",u),typeof window<"u"){window.location.href=s;return}throw u}}if(f&&i.value&&n.onSignInUrl)return r.navigateTo(n.onSignInUrl);a()};o()})})});module.exports=g;
@@ -1,5 +1,5 @@
1
- import { defineNuxtRouteMiddleware as m, useRuntimeConfig as g, navigateTo as a } from "nuxt/app";
2
- const w = m((u) => {
1
+ import { defineNuxtRouteMiddleware as m, useRuntimeConfig as g, navigateTo as u } from "nuxt/app";
2
+ const w = m((a) => {
3
3
  const n = g().public.strandsAuth;
4
4
  if (!import.meta.server)
5
5
  return new Promise((c) => {
@@ -9,11 +9,11 @@ const w = m((u) => {
9
9
  setTimeout(i, 50);
10
10
  return;
11
11
  }
12
- const e = u.path, h = n.protectedRoutes?.some((t) => t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : e === t || e.startsWith(t + "/")), f = n.guestOnlyRoutes?.some((t) => t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : e === t || e.startsWith(t + "/"));
13
- if (h && !r.value) {
14
- const t = n.authUrl || "/auth", o = t.includes("?") ? `${t}&redirect=${encodeURIComponent(e)}` : `${t}?redirect=${encodeURIComponent(e)}`;
12
+ const e = a.path, h = n.protectedRoutes?.some((t) => t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : e === t || e.startsWith(t + "/")), f = n.guestOnlyRoutes?.some((t) => t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : e === t || e.startsWith(t + "/"));
13
+ if (h && !r.value && n.authUrl) {
14
+ const t = n.authUrl, o = t.includes("?") ? `${t}&redirect=${encodeURIComponent(e)}` : `${t}?redirect=${encodeURIComponent(e)}`;
15
15
  try {
16
- return a(o);
16
+ return u(o);
17
17
  } catch (s) {
18
18
  if (console.warn("[Strands Auth] navigateTo failed, using window.location:", s), typeof window < "u") {
19
19
  window.location.href = o;
@@ -22,8 +22,8 @@ const w = m((u) => {
22
22
  throw s;
23
23
  }
24
24
  }
25
- if (f && r.value)
26
- return a(n.onSignInUrl || "/dashboard");
25
+ if (f && r.value && n.onSignInUrl)
26
+ return u(n.onSignInUrl);
27
27
  c();
28
28
  };
29
29
  i();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "2.17.42",
3
+ "version": "2.17.43",
4
4
  "description": "Strands Authentication UI Components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",