@strands.gg/accui 2.6.7 → 2.6.8

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 e=require("nuxt/app"),s=e.defineNuxtRouteMiddleware(s=>{const t=e.useRuntimeConfig().public.strandsAuth;if(!process.server)return new Promise(r=>{Promise.resolve().then(()=>require("../composables/useStrandsAuth.cjs.js")).then(({useStrandsAuth:o})=>{const{isAuthenticated:n,isLoading:i}=o(),u=()=>{if(i.value)return void setTimeout(u,50);const o=s.path,c=t.protectedRoutes?.some(e=>e.endsWith("*")?o.startsWith(e.slice(0,-1)):o===e||o.startsWith(e+"/")),d=t.guestOnlyRoutes?.some(e=>e.endsWith("*")?o.startsWith(e.slice(0,-1)):o===e||o.startsWith(e+"/"));return c&&!n.value?e.navigateTo("/auth?redirect="+encodeURIComponent(o)):d&&n.value?e.navigateTo(t.onSignInUrl||"/dashboard"):void r()};u()})})});module.exports=s;
1
+ "use strict";const e=require("nuxt/app"),t=e.defineNuxtRouteMiddleware(t=>{const r=e.useRuntimeConfig().public.strandsAuth;if(!process.server)return new Promise(n=>{Promise.resolve().then(()=>require("../composables/useStrandsAuth.cjs.js")).then(({useStrandsAuth:o})=>{const{isAuthenticated:s,isLoading:i}=o(),u=()=>{if(i.value)return void setTimeout(u,50);const o=t.path,d=r.protectedRoutes?.some(e=>e.endsWith("*")?o.startsWith(e.slice(0,-1)):o===e||o.startsWith(e+"/")),c=r.guestOnlyRoutes?.some(e=>e.endsWith("*")?o.startsWith(e.slice(0,-1)):o===e||o.startsWith(e+"/"));if(d&&!s.value){const t=r.onSignOutUrl||"/auth",n=t.includes("?")?`${t}&redirect=${encodeURIComponent(o)}`:`${t}?redirect=${encodeURIComponent(o)}`;try{return e.navigateTo(n)}catch(a){if("undefined"!=typeof window)return void(window.location.href=n);throw a}}if(c&&s.value)return e.navigateTo(r.onSignInUrl||"/dashboard");n()};u()})})});module.exports=t;
@@ -25,7 +25,19 @@ const auth_global = defineNuxtRouteMiddleware((to) => {
25
25
  });
26
26
  if (isProtectedRoute && !isAuthenticated.value) {
27
27
  console.log("[Strands Auth] Protected route accessed without authentication, redirecting to auth");
28
- return navigateTo("/auth?redirect=" + encodeURIComponent(currentPath));
28
+ const authUrl = config.onSignOutUrl || "/auth";
29
+ const redirectUrl = authUrl.includes("?") ? `${authUrl}&redirect=${encodeURIComponent(currentPath)}` : `${authUrl}?redirect=${encodeURIComponent(currentPath)}`;
30
+ console.log("[Strands Auth] Redirecting to:", redirectUrl);
31
+ try {
32
+ return navigateTo(redirectUrl);
33
+ } catch (error) {
34
+ console.warn("[Strands Auth] navigateTo failed, using window.location:", error);
35
+ if (typeof window !== "undefined") {
36
+ window.location.href = redirectUrl;
37
+ return;
38
+ }
39
+ throw error;
40
+ }
29
41
  }
30
42
  if (isGuestOnlyRoute && isAuthenticated.value) {
31
43
  console.log("[Strands Auth] Guest-only route accessed while authenticated, redirecting");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "2.6.7",
3
+ "version": "2.6.8",
4
4
  "description": "Strands Authentication UI Components",
5
5
  "type": "module",
6
6
  "main": "./dist/strands-auth-ui.cjs.js",