@strands.gg/accui 2.6.6 → 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.
- package/dist/accui.css +1 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +1 -1
- package/dist/nuxt/runtime/middleware/auth.global.cjs.js +1 -1
- package/dist/nuxt/runtime/middleware/auth.global.es.js +13 -1
- package/dist/strands-auth-ui.cjs.js +1 -1
- package/dist/strands-auth-ui.es.js +9 -4
- package/dist/useStrandsAuth-BqNW7g0R.cjs.js +1 -0
- package/dist/{useStrandsAuth-B0jI8Gbq.es.js → useStrandsAuth-GX6lPddh.es.js} +45 -11
- package/package.json +1 -1
- package/dist/useStrandsAuth-Dt4KTg73.cjs.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("nuxt/app"),s=require("../../../useStrandsAuth-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("nuxt/app"),s=require("../../../useStrandsAuth-BqNW7g0R.cjs.js"),a=()=>{const a=t.useRuntimeConfig().public.strandsAuth,e=s.useStrandsAuth();return{...e,initialize:async()=>{await e.initialize()},signIn:async s=>{const i=await e.signIn(s);return i&&a.onSignInUrl&&await t.navigateTo(a.onSignInUrl),i},signUp:async t=>await e.signUp({email:t.email,password:"",firstName:"",lastName:""}),signOut:async()=>{await e.signOut(),a.onSignOutUrl&&await t.navigateTo(a.onSignOutUrl)}}};exports.useAuthState=()=>{const{isAuthenticated:t,isLoading:s}=a();return{isAuthenticated:t,isLoading:s}},exports.useAuthUser=()=>{const{user:t}=a();return{user:t}},exports.useStrandsAuth=a;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRuntimeConfig, navigateTo } from "nuxt/app";
|
|
2
|
-
import { u as useStrandsAuth$1 } from "../../../useStrandsAuth-
|
|
2
|
+
import { u as useStrandsAuth$1 } from "../../../useStrandsAuth-GX6lPddh.es.js";
|
|
3
3
|
const useStrandsAuth = () => {
|
|
4
4
|
const config = useRuntimeConfig().public["strandsAuth"];
|
|
5
5
|
const vueAuth = useStrandsAuth$1();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("nuxt/app"),
|
|
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
|
-
|
|
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");
|