@strands.gg/accui 2.16.0 → 2.17.10
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/StrandsUIPlugin-Bwc7jBcb.cjs.js +143 -0
- package/dist/StrandsUIPlugin-RTFzvRED.es.js +20536 -0
- package/dist/accui.css +1 -1
- package/dist/index.cjs.js +5 -1
- package/dist/index.es.js +8822 -12491
- package/dist/nuxt/module.cjs.js +23 -1
- package/dist/nuxt/module.es.js +58 -82
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.cjs.js +1 -1
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.es.js +82 -111
- package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +30 -46
- package/dist/nuxt/runtime/middleware/auth.global.cjs.js +1 -1
- package/dist/nuxt/runtime/middleware/auth.global.es.js +28 -44
- package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
- package/dist/nuxt/runtime/plugin.client.es.js +10 -19
- package/dist/nuxt/runtime/plugin.server.cjs.js +1 -1
- package/dist/nuxt/runtime/plugin.server.es.js +8 -10
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.cjs.js +1 -1
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.es.js +27 -48
- package/dist/nuxt/types.d.ts +1 -0
- package/dist/nuxt.cjs.js +1 -1
- package/dist/nuxt.es.js +9 -9
- package/dist/types/index.d.ts +5 -0
- package/dist/useStrandsAuth-DSBvF4ky.es.js +653 -0
- package/dist/useStrandsAuth-EqbzuNAn.cjs.js +1 -0
- package/dist/useStrandsConfig-B5kp4aF9.cjs.js +1 -0
- package/dist/useStrandsConfig-CMKVW1p3.es.js +210 -0
- package/dist/vite.cjs.js +29 -1
- package/dist/vite.es.js +58 -75
- package/dist/vue/utils/modalStack.d.ts +3 -0
- package/dist/webcomponents/define-element.d.ts +3 -2
- package/package.json +2 -2
- package/dist/StrandsUIPlugin-C9rrMU2i.cjs.js +0 -1
- package/dist/StrandsUIPlugin-tl7L52hZ.es.js +0 -26130
- package/dist/useStrandsAuth-BCnUxo-R.es.js +0 -915
- package/dist/useStrandsAuth-DoJxpNLb.cjs.js +0 -1
- package/dist/useStrandsConfig-Sr6NG90B.cjs.js +0 -1
- package/dist/useStrandsConfig-fRu-OG08.es.js +0 -248
|
@@ -1,51 +1,35 @@
|
|
|
1
|
-
import { defineNuxtRouteMiddleware, useRuntimeConfig, navigateTo } from "nuxt/app";
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
if (import.meta.server)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const currentPath = to.path;
|
|
14
|
-
const isProtectedRoute = config.protectedRoutes?.some((route) => {
|
|
15
|
-
if (route.endsWith("*")) {
|
|
16
|
-
return currentPath.startsWith(route.slice(0, -1));
|
|
1
|
+
import { defineNuxtRouteMiddleware as m, useRuntimeConfig as g, navigateTo as a } from "nuxt/app";
|
|
2
|
+
const w = m((u) => {
|
|
3
|
+
const n = g().public.strandsAuth;
|
|
4
|
+
if (!import.meta.server)
|
|
5
|
+
return new Promise((c) => {
|
|
6
|
+
import("../composables/useStrandsAuth.es.js").then(({ useStrandsAuth: d }) => {
|
|
7
|
+
const { isAuthenticated: r, isLoading: l } = d(), i = () => {
|
|
8
|
+
if (l.value) {
|
|
9
|
+
setTimeout(i, 50);
|
|
10
|
+
return;
|
|
17
11
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
return navigateTo(redirectUrl);
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.warn("[Strands Auth] navigateTo failed, using window.location:", error);
|
|
33
|
-
if (typeof window !== "undefined") {
|
|
34
|
-
window.location.href = redirectUrl;
|
|
35
|
-
return;
|
|
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)}`;
|
|
15
|
+
try {
|
|
16
|
+
return a(o);
|
|
17
|
+
} catch (s) {
|
|
18
|
+
if (console.warn("[Strands Auth] navigateTo failed, using window.location:", s), typeof window < "u") {
|
|
19
|
+
window.location.href = o;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
throw s;
|
|
36
23
|
}
|
|
37
|
-
throw error;
|
|
38
24
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
checkAuth();
|
|
25
|
+
if (f && r.value)
|
|
26
|
+
return a(n.onSignInUrl || "/dashboard");
|
|
27
|
+
c();
|
|
28
|
+
};
|
|
29
|
+
i();
|
|
30
|
+
});
|
|
46
31
|
});
|
|
47
|
-
});
|
|
48
32
|
});
|
|
49
33
|
export {
|
|
50
|
-
|
|
34
|
+
w as default
|
|
51
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("nuxt/app"),
|
|
1
|
+
"use strict";const e=require("nuxt/app"),t=require("../../useStrandsConfig-B5kp4aF9.cjs.js"),c=e.defineNuxtPlugin({name:"strands-auth-client",async setup(){const i=e.useRuntimeConfig().public.strandsAuth,n={...t.STRANDS_AUTH_DEFAULTS,...i};t.setStrandsConfig(n),typeof window<"u"&&(window.__STRANDS_CONFIG__=n),n?.accentColor&&typeof window<"u"&&document.documentElement.style.setProperty("--strands-accent",n.accentColor);const{useStrandsAuth:s}=await Promise.resolve().then(()=>require("./composables/useStrandsAuth.cjs.js")),{initialize:o}=s();await o()}});module.exports=c;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
|
|
2
|
-
import { s as
|
|
3
|
-
const
|
|
1
|
+
import { defineNuxtPlugin as i, useRuntimeConfig as s } from "nuxt/app";
|
|
2
|
+
import { s as a, S as c } from "../../useStrandsConfig-CMKVW1p3.es.js";
|
|
3
|
+
const u = i({
|
|
4
4
|
name: "strands-auth-client",
|
|
5
5
|
async setup() {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
...STRANDS_AUTH_DEFAULTS,
|
|
10
|
-
...strandsConfig
|
|
6
|
+
const t = s().public.strandsAuth, n = {
|
|
7
|
+
...c,
|
|
8
|
+
...t
|
|
11
9
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (mergedConfig?.accentColor && typeof window !== "undefined") {
|
|
17
|
-
document.documentElement.style.setProperty("--strands-accent", mergedConfig.accentColor);
|
|
18
|
-
}
|
|
19
|
-
const { useStrandsAuth } = await import("./composables/useStrandsAuth.es.js");
|
|
20
|
-
const { initialize } = useStrandsAuth();
|
|
21
|
-
await initialize();
|
|
10
|
+
a(n), typeof window < "u" && (window.__STRANDS_CONFIG__ = n), n?.accentColor && typeof window < "u" && document.documentElement.style.setProperty("--strands-accent", n.accentColor);
|
|
11
|
+
const { useStrandsAuth: e } = await import("./composables/useStrandsAuth.es.js"), { initialize: o } = e();
|
|
12
|
+
await o();
|
|
22
13
|
}
|
|
23
14
|
});
|
|
24
15
|
export {
|
|
25
|
-
|
|
16
|
+
u as default
|
|
26
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("nuxt/app"),s=require("../../useStrandsConfig-B5kp4aF9.cjs.js"),r=n.defineNuxtPlugin({name:"strands-auth-server",setup(){const e=n.useRuntimeConfig().public.strandsAuth,t={...s.STRANDS_AUTH_DEFAULTS,...e};s.setStrandsConfig(t)}});module.exports=r;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
|
|
2
|
-
import { s as
|
|
3
|
-
const
|
|
1
|
+
import { defineNuxtPlugin as t, useRuntimeConfig as e } from "nuxt/app";
|
|
2
|
+
import { s as o, S as r } from "../../useStrandsConfig-CMKVW1p3.es.js";
|
|
3
|
+
const u = t({
|
|
4
4
|
name: "strands-auth-server",
|
|
5
5
|
setup() {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
...STRANDS_AUTH_DEFAULTS,
|
|
10
|
-
...strandsConfig
|
|
6
|
+
const s = e().public.strandsAuth, n = {
|
|
7
|
+
...r,
|
|
8
|
+
...s
|
|
11
9
|
};
|
|
12
|
-
|
|
10
|
+
o(n);
|
|
13
11
|
}
|
|
14
12
|
});
|
|
15
13
|
export {
|
|
16
|
-
|
|
14
|
+
u as default
|
|
17
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const p=require("nuxt/app"),f=p.defineNuxtPlugin({name:"strands-auth-interceptor",setup(){if(process.server)return;const t=globalThis.fetch;globalThis.fetch=async(e,o)=>{try{const{useStrandsAuth:c}=await Promise.resolve().then(()=>require("../composables/useStrandsAuth.cjs.js")),{currentSession:n,getAuthHeaders:i}=c();let s;if(typeof e=="string"?s=e:e instanceof URL?s=e.toString():s=e.url,m(s)&&n.value?.accessToken)try{const a=i(),h=new Headers(o?.headers);Object.entries(a).forEach(([d,l])=>{h.set(d,l)});const u={...o,headers:h};return t(e,u)}catch(a){console.warn("[Strands Auth] Failed to inject auth headers:",a)}return t(e,o)}catch(c){return console.error("[Strands Auth] Error in fetch interceptor:",c),t(e,o)}}}});function m(t){if(!t.startsWith("http")||["googleapis.com","github.com/api","api.github.com","discord.com/api","graph.microsoft.com","api.stripe.com","api.twilio.com"].some(r=>t.includes(r)))return!1;const n=["/api/","/v1/","/v2/","/graphql","/trpc"].some(r=>t.includes(r)),s=[":3001",":8000",":8080",":5000",":4000"].some(r=>t.includes(r));return n||s}module.exports=f;
|
|
@@ -1,51 +1,36 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from "nuxt/app";
|
|
2
|
-
const
|
|
1
|
+
import { defineNuxtPlugin as p } from "nuxt/app";
|
|
2
|
+
const g = p({
|
|
3
3
|
name: "strands-auth-interceptor",
|
|
4
4
|
setup() {
|
|
5
5
|
if (process.server) return;
|
|
6
|
-
const
|
|
7
|
-
globalThis.fetch = async (
|
|
6
|
+
const e = globalThis.fetch;
|
|
7
|
+
globalThis.fetch = async (t, o) => {
|
|
8
8
|
try {
|
|
9
|
-
const { useStrandsAuth } = await import("../composables/useStrandsAuth.es.js");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (typeof input === "string") {
|
|
13
|
-
url = input;
|
|
14
|
-
} else if (input instanceof URL) {
|
|
15
|
-
url = input.toString();
|
|
16
|
-
} else {
|
|
17
|
-
url = input.url;
|
|
18
|
-
}
|
|
19
|
-
const shouldAddAuth = shouldInjectAuth(url);
|
|
20
|
-
if (shouldAddAuth && currentSession.value?.accessToken) {
|
|
9
|
+
const { useStrandsAuth: a } = await import("../composables/useStrandsAuth.es.js"), { currentSession: c, getAuthHeaders: i } = a();
|
|
10
|
+
let s;
|
|
11
|
+
if (typeof t == "string" ? s = t : t instanceof URL ? s = t.toString() : s = t.url, f(s) && c.value?.accessToken)
|
|
21
12
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
headers.set(key, value);
|
|
13
|
+
const n = i(), h = new Headers(o?.headers);
|
|
14
|
+
Object.entries(n).forEach(([d, l]) => {
|
|
15
|
+
h.set(d, l);
|
|
26
16
|
});
|
|
27
|
-
const
|
|
28
|
-
...
|
|
29
|
-
headers
|
|
17
|
+
const u = {
|
|
18
|
+
...o,
|
|
19
|
+
headers: h
|
|
30
20
|
};
|
|
31
|
-
return
|
|
32
|
-
} catch (
|
|
33
|
-
console.warn("[Strands Auth] Failed to inject auth headers:",
|
|
21
|
+
return e(t, u);
|
|
22
|
+
} catch (n) {
|
|
23
|
+
console.warn("[Strands Auth] Failed to inject auth headers:", n);
|
|
34
24
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
console.error("[Strands Auth] Error in fetch interceptor:", error);
|
|
39
|
-
return originalFetch(input, init);
|
|
25
|
+
return e(t, o);
|
|
26
|
+
} catch (a) {
|
|
27
|
+
return console.error("[Strands Auth] Error in fetch interceptor:", a), e(t, o);
|
|
40
28
|
}
|
|
41
29
|
};
|
|
42
30
|
}
|
|
43
31
|
});
|
|
44
|
-
function
|
|
45
|
-
if (!
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
const skipDomains = [
|
|
32
|
+
function f(e) {
|
|
33
|
+
if (!e.startsWith("http") || [
|
|
49
34
|
"googleapis.com",
|
|
50
35
|
"github.com/api",
|
|
51
36
|
"api.github.com",
|
|
@@ -54,23 +39,17 @@ function shouldInjectAuth(url) {
|
|
|
54
39
|
"api.stripe.com",
|
|
55
40
|
"api.twilio.com"
|
|
56
41
|
// Add other third-party APIs here
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
const apiPatterns = [
|
|
42
|
+
].some((r) => e.includes(r)))
|
|
43
|
+
return !1;
|
|
44
|
+
const c = [
|
|
63
45
|
"/api/",
|
|
64
46
|
"/v1/",
|
|
65
47
|
"/v2/",
|
|
66
48
|
"/graphql",
|
|
67
49
|
"/trpc"
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
const apiPorts = [":3001", ":8000", ":8080", ":5000", ":4000"];
|
|
71
|
-
const hasApiPort = apiPorts.some((port) => url.includes(port));
|
|
72
|
-
return isApiRequest || hasApiPort;
|
|
50
|
+
].some((r) => e.includes(r)), s = [":3001", ":8000", ":8080", ":5000", ":4000"].some((r) => e.includes(r));
|
|
51
|
+
return c || s;
|
|
73
52
|
}
|
|
74
53
|
export {
|
|
75
|
-
|
|
54
|
+
g as default
|
|
76
55
|
};
|
package/dist/nuxt/types.d.ts
CHANGED
package/dist/nuxt.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./nuxt/module.cjs.js"),e=require("./nuxt/runtime/composables/useStrandsAuth.cjs.js"),t=require("./nuxt/runtime/composables/useAuthenticatedFetch.cjs.js");exports.default=u;exports.useAuthState=e.useAuthState;exports.useAuthUser=e.useAuthUser;exports.useStrandsAuth=e.useStrandsAuth;exports.$authFetch=t.$authFetch;exports.useAuthenticatedFetch=t.useAuthenticatedFetch;
|
package/dist/nuxt.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { useAuthState, useAuthUser, useStrandsAuth } from "./nuxt/runtime/composables/useStrandsAuth.es.js";
|
|
3
|
-
import { $authFetch, useAuthenticatedFetch } from "./nuxt/runtime/composables/useAuthenticatedFetch.es.js";
|
|
1
|
+
import { default as u } from "./nuxt/module.es.js";
|
|
2
|
+
import { useAuthState as h, useAuthUser as o, useStrandsAuth as s } from "./nuxt/runtime/composables/useStrandsAuth.es.js";
|
|
3
|
+
import { $authFetch as f, useAuthenticatedFetch as A } from "./nuxt/runtime/composables/useAuthenticatedFetch.es.js";
|
|
4
4
|
export {
|
|
5
|
-
$authFetch,
|
|
6
|
-
|
|
7
|
-
useAuthState,
|
|
8
|
-
useAuthUser,
|
|
9
|
-
useAuthenticatedFetch,
|
|
10
|
-
useStrandsAuth
|
|
5
|
+
f as $authFetch,
|
|
6
|
+
u as default,
|
|
7
|
+
h as useAuthState,
|
|
8
|
+
o as useAuthUser,
|
|
9
|
+
A as useAuthenticatedFetch,
|
|
10
|
+
s as useStrandsAuth
|
|
11
11
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -114,6 +114,11 @@ export interface StrandsAuthConfig {
|
|
|
114
114
|
* @default '/'
|
|
115
115
|
*/
|
|
116
116
|
onSignOutUrl?: string;
|
|
117
|
+
/**
|
|
118
|
+
* URL of the authentication/login page (where unauthenticated users are redirected)
|
|
119
|
+
* @default '/auth'
|
|
120
|
+
*/
|
|
121
|
+
authUrl?: string;
|
|
117
122
|
/**
|
|
118
123
|
* Enable automatic token refresh
|
|
119
124
|
* @default true
|