@strands.gg/accui 2.17.66 → 2.19.1
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-5AOCDOcM.cjs.js +143 -0
- package/dist/StrandsUIPlugin-B0HUf-tm.es.js +20437 -0
- package/dist/StrandsUIPlugin-B98LOdrQ.cjs.js +143 -0
- package/dist/StrandsUIPlugin-BbeOau1G.cjs.js +143 -0
- package/dist/StrandsUIPlugin-BcARSDQF.cjs.js +143 -0
- package/dist/StrandsUIPlugin-CCRrewS9.es.js +20587 -0
- package/dist/StrandsUIPlugin-CMTkJfQt.cjs.js +143 -0
- package/dist/StrandsUIPlugin-CQONZWOX.es.js +20714 -0
- package/dist/StrandsUIPlugin-CQk56uZ2.es.js +19805 -0
- package/dist/StrandsUIPlugin-Cgmu6cTA.es.js +20440 -0
- package/dist/StrandsUIPlugin-CpBH0QFc.cjs.js +272 -0
- package/dist/StrandsUIPlugin-Ct91SLTy.es.js +20587 -0
- package/dist/StrandsUIPlugin-DHhawL07.cjs.js +143 -0
- package/dist/StrandsUIPlugin-DY7VCw7G.es.js +20437 -0
- package/dist/StrandsUIPlugin-Tpi8IoJc.cjs.js +143 -0
- package/dist/StrandsUIPlugin-lRGsfjf5.es.js +20440 -0
- package/dist/accui.css +1 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.es.js +5841 -5646
- package/dist/nuxt/module.cjs.js +6 -6
- package/dist/nuxt/module.es.js +22 -21
- package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +7 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +24 -19
- package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
- package/dist/nuxt/runtime/plugin.client.es.js +9 -12
- package/dist/nuxt/runtime/plugin.server.cjs.js +1 -1
- package/dist/nuxt/runtime/plugin.server.es.js +1 -1
- package/dist/types/composables.d.ts +6 -2
- package/dist/types/index.d.ts +21 -0
- package/dist/useDarkMode-Cew-NWjS.cjs.js +1 -0
- package/dist/useDarkMode-CvinMR9O.es.js +102 -0
- package/dist/useDarkMode-OZ_A8-6H.es.js +102 -0
- package/dist/useStrandsAuth-B7Fqq-Qp.es.js +717 -0
- package/dist/useStrandsAuth-BDTnh_c_.es.js +702 -0
- package/dist/useStrandsAuth-CEQ4UsKz.cjs.js +1 -0
- package/dist/useStrandsAuth-CboHAkjH.es.js +717 -0
- package/dist/useStrandsAuth-CetpoBNk.cjs.js +1 -0
- package/dist/useStrandsAuth-D2HvStMt.es.js +787 -0
- package/dist/useStrandsAuth-DSLFMDTj.es.js +717 -0
- package/dist/useStrandsAuth-Db5ZGvxL.cjs.js +1 -0
- package/dist/useStrandsAuth-Dz3Grglt.cjs.js +1 -0
- package/dist/useStrandsAuth-FVoni53L.es.js +666 -0
- package/dist/useStrandsAuth-Yp5OpRHU.cjs.js +1 -0
- package/dist/useStrandsConfig-48gZP9xV.es.js +209 -0
- package/dist/useStrandsConfig-B8h5hDy7.es.js +219 -0
- package/dist/useStrandsConfig-BGJg1LlC.es.js +213 -0
- package/dist/useStrandsConfig-BY_IIwK8.cjs.js +1 -0
- package/dist/useStrandsConfig-DRGldIzy.cjs.js +1 -0
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.es.js +2 -2
- package/dist/vue/components/SignedIn.vue.d.ts +3 -1
- package/dist/vue/components/index.d.ts +1 -1
- package/dist/vue/composables/useKnownAccounts.d.ts +33 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/ui/UiBunnyFontPicker.vue.d.ts +23 -0
- package/dist/vue/ui/UiCheckboxGroup.vue.d.ts +1 -0
- package/dist/vue/ui/UiInput/UiInput.Select.vue.d.ts +806 -0
- package/dist/vue/ui/UiMegaMenu.vue.d.ts +28 -1
- package/dist/vue/ui/UiRadioGroup.vue.d.ts +1 -0
- package/dist/vue/ui/UiTabs.vue.d.ts +2 -0
- package/dist/vue/ui/VirtualList.vue.d.ts +36 -0
- package/dist/webcomponents/define-element.d.ts +1 -1
- package/dist/webcomponents/entries/sl-alert.d.ts +2 -0
- package/dist/webcomponents/entries/sl-avatar-editor.d.ts +2 -0
- package/dist/webcomponents/entries/sl-button.d.ts +2 -0
- package/dist/webcomponents/entries/sl-card.d.ts +2 -0
- package/dist/webcomponents/entries/sl-checkbox-group.d.ts +2 -0
- package/dist/webcomponents/entries/sl-color-picker.d.ts +2 -0
- package/dist/webcomponents/entries/sl-datetime-picker.d.ts +2 -0
- package/dist/webcomponents/entries/sl-divider.d.ts +2 -0
- package/dist/webcomponents/entries/sl-font-picker.d.ts +2 -0
- package/dist/webcomponents/entries/sl-hero.d.ts +2 -0
- package/dist/webcomponents/entries/sl-input.d.ts +2 -0
- package/dist/webcomponents/entries/sl-level-progress.d.ts +2 -0
- package/dist/webcomponents/entries/sl-link.d.ts +2 -0
- package/dist/webcomponents/entries/sl-loader-spinner.d.ts +2 -0
- package/dist/webcomponents/entries/sl-mega-menu.d.ts +5 -0
- package/dist/webcomponents/entries/sl-modal.d.ts +2 -0
- package/dist/webcomponents/entries/sl-pill.d.ts +2 -0
- package/dist/webcomponents/entries/sl-radio-group.d.ts +2 -0
- package/dist/webcomponents/entries/sl-slider.d.ts +2 -0
- package/dist/webcomponents/entries/sl-table.d.ts +2 -0
- package/dist/webcomponents/entries/sl-tabs.d.ts +2 -0
- package/dist/webcomponents/entries/sl-theme-toggle.d.ts +2 -0
- package/dist/webcomponents/entries/sl-toggle.d.ts +2 -0
- package/dist/webcomponents/entries/sl-tooltip.d.ts +2 -0
- package/dist/webcomponents/loader.d.ts +3 -3
- package/dist/webcomponents/registry.d.ts +1 -1
- package/package.json +16 -16
package/dist/nuxt/module.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const o=require("@nuxt/kit");var n=typeof document<"u"?document.currentScript:null;const h={baseUrl:"https://your-api.example.com",accentColor:"#EA00A8",redirectUrl:"/",onSignOutUrl:"/",autoRefresh:!0,refreshInterval:4,protectedRoutes:[],guestOnlyRoutes:["/auth","/login","/register"],devMode:!1,styles:!0,supportEmail:"",oauth2RedirectUrl:"",theme:"system"},g=o.defineNuxtModule({meta:{name:"@strands.gg/accui/nuxt",configKey:"strandsAuth",compatibility:{nuxt:"^3.0.0 || ^4.0.0"}},defaults:h,async setup(a,
|
|
1
|
+
"use strict";const o=require("@nuxt/kit");var n=typeof document<"u"?document.currentScript:null;const h={mode:"direct",baseUrl:"https://your-api.example.com",accentColor:"#EA00A8",redirectUrl:"/",onSignOutUrl:"/",autoRefresh:!0,refreshInterval:4,protectedRoutes:[],guestOnlyRoutes:["/auth","/login","/register"],devMode:!1,styles:!0,supportEmail:"",oauth2RedirectUrl:"",theme:"system"},g=o.defineNuxtModule({meta:{name:"@strands.gg/accui/nuxt",configKey:"strandsAuth",compatibility:{nuxt:"^3.0.0 || ^4.0.0"}},defaults:h,async setup(a,s){const t=o.createResolver(typeof document>"u"?require("url").pathToFileURL(__filename).href:n&&n.tagName.toUpperCase()==="SCRIPT"&&n.src||new URL("nuxt/module.cjs.js",document.baseURI).href);s.options.runtimeConfig.public=s.options.runtimeConfig.public||{};const i={...a,styles:a.styles!==!1};if(s.options.runtimeConfig.public.strandsAuth=i,s.options.appConfig&&(s.options.appConfig.strandsAuth=i),a.styles!==!1&&s.options.css.push(t.resolve("../accui.css")),a.accentColor&&a.accentColor!=="#EA00A8"){const e=a.accentColor,p=`
|
|
2
2
|
:root {
|
|
3
3
|
--strands-custom-accent: ${e};
|
|
4
4
|
--strands-custom-50: color-mix(in srgb, ${e} 10%, white);
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
--strands-custom-900: color-mix(in srgb, ${e} 40%, black);
|
|
14
14
|
--strands-custom-950: color-mix(in srgb, ${e} 25%, black);
|
|
15
15
|
}
|
|
16
|
-
`;
|
|
16
|
+
`;s.options.app.head=s.options.app.head||{},s.options.app.head.style=s.options.app.head.style||[],s.options.app.head.style.unshift({innerHTML:p,key:"strands-accent-override"})}const r="es.js",u=t.resolve(`./runtime/plugin.client.${r}`),d=t.resolve(`./runtime/plugin.server.${r}`),c=t.resolve(`./runtime/middleware/auth.global.${r}`),l=t.resolve(`./runtime/plugins/auth-interceptor.client.${r}`);o.addPlugin({src:u,mode:"client"}),o.addPlugin({src:d,mode:"server"}),a.mode!=="oauth2"&&(o.addPlugin({src:l,mode:"client"}),o.addRouteMiddleware({name:"auth",path:c,global:!0})),s.hook("pages:extend",()=>{}),o.addImports([{name:"useStrandsAuth",as:"useStrandsAuth",from:t.resolve(`./runtime/composables/useStrandsAuth.${r}`)},{name:"useAuthUser",as:"useAuthUser",from:t.resolve(`./runtime/composables/useStrandsAuth.${r}`)},{name:"useAuthState",as:"useAuthState",from:t.resolve(`./runtime/composables/useStrandsAuth.${r}`)},{name:"useAuthenticatedFetch",as:"useAuthenticatedFetch",from:t.resolve(`./runtime/composables/useAuthenticatedFetch.${r}`)},{name:"useStrandsOAuth",as:"useStrandsOAuth",from:t.resolve(`./runtime/composables/useStrandsOAuth.${r}`)}]);const m=["StrandsAuth","StrandsSignIn","StrandsSignUp","StrandsCompleteSignUp","StrandsUserProfile","StrandsUserButton","StrandsPasswordReset","StrandsMFASetup","StrandsMfaVerification","StrandsMfaModal","StrandsBackupCodesModal","StrandsConfirmModal","StrandsEmailMfaSetupModal","StrandsHardwareKeySetupModal","StrandsSessionsModal","StrandsSettingsModal","StrandsTotpSetupModal","StrandsConfigProvider","SignedIn","StrandsLogo","StrandsSecuredFooter","StrandsNav","StrandsNavItem","StrandsOAuthButton","StrandsOAuthCallback","UiAlert","UiApp","UiAvatarEditor","UiBunnyFontPicker","UiButton","UiCard","UiCheckboxGroup","UiColorPicker","UiDateTimePicker","UiDivider","UiHero","UiInput","UiLevelProgress","UiLink","UiLoader","UiMegaMenu","UiMegaMenuItem","UiMegaMenuPanel","UiMegaMenuGroup","UiModal","UiPill","UiRadioGroup","UiSlider","UiTable","UiTabs","UiThemeToggle","UiToggle","UiTooltip","VirtualList","SvgIcon","IconGithub","IconGoogle"];for(const e of m)o.addComponent({name:e,export:e,filePath:"@strands.gg/accui"});s.hook("prepare:types",e=>{e.references.push({types:"@strands.gg/auth-nuxt"}),e.declarations&&e.declarations.push(`
|
|
17
17
|
declare global {
|
|
18
|
-
const useStrandsAuth: typeof import('${
|
|
19
|
-
const useAuthUser: typeof import('${
|
|
20
|
-
const useAuthState: typeof import('${
|
|
21
|
-
const useAuthenticatedFetch: typeof import('${
|
|
18
|
+
const useStrandsAuth: typeof import('${t.resolve("./runtime/composables/useStrandsAuth.d.ts")}')['useStrandsAuth']
|
|
19
|
+
const useAuthUser: typeof import('${t.resolve("./runtime/composables/useStrandsAuth.d.ts")}')['useAuthUser']
|
|
20
|
+
const useAuthState: typeof import('${t.resolve("./runtime/composables/useStrandsAuth.d.ts")}')['useAuthState']
|
|
21
|
+
const useAuthenticatedFetch: typeof import('${t.resolve("./runtime/composables/useAuthenticatedFetch.d.ts")}')['useAuthenticatedFetch']
|
|
22
22
|
}
|
|
23
23
|
`)})}});module.exports=g;
|
package/dist/nuxt/module.es.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineNuxtModule as p, createResolver as h, addPlugin as a, addRouteMiddleware as g, addImports as S, addComponent as f } from "@nuxt/kit";
|
|
2
2
|
const A = {
|
|
3
|
+
mode: "direct",
|
|
3
4
|
baseUrl: "https://your-api.example.com",
|
|
4
5
|
accentColor: "#EA00A8",
|
|
5
6
|
redirectUrl: "/",
|
|
@@ -22,14 +23,14 @@ const A = {
|
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
defaults: A,
|
|
25
|
-
async setup(r,
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
async setup(r, s) {
|
|
27
|
+
const t = h(import.meta.url);
|
|
28
|
+
s.options.runtimeConfig.public = s.options.runtimeConfig.public || {};
|
|
28
29
|
const n = {
|
|
29
30
|
...r,
|
|
30
31
|
styles: r.styles !== !1
|
|
31
32
|
};
|
|
32
|
-
if (
|
|
33
|
+
if (s.options.runtimeConfig.public.strandsAuth = n, s.options.appConfig && (s.options.appConfig.strandsAuth = n), r.styles !== !1 && s.options.css.push(t.resolve("../accui.css")), r.accentColor && r.accentColor !== "#EA00A8") {
|
|
33
34
|
const e = r.accentColor, m = `
|
|
34
35
|
:root {
|
|
35
36
|
--strands-custom-accent: ${e};
|
|
@@ -46,54 +47,54 @@ const A = {
|
|
|
46
47
|
--strands-custom-950: color-mix(in srgb, ${e} 25%, black);
|
|
47
48
|
}
|
|
48
49
|
`;
|
|
49
|
-
|
|
50
|
+
s.options.app.head = s.options.app.head || {}, s.options.app.head.style = s.options.app.head.style || [], s.options.app.head.style.unshift({
|
|
50
51
|
innerHTML: m,
|
|
51
52
|
key: "strands-accent-override"
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
|
-
const o = "es.js", i =
|
|
55
|
+
const o = "es.js", i = t.resolve(`./runtime/plugin.client.${o}`), u = t.resolve(`./runtime/plugin.server.${o}`), d = t.resolve(`./runtime/middleware/auth.global.${o}`), c = t.resolve(`./runtime/plugins/auth-interceptor.client.${o}`);
|
|
55
56
|
a({
|
|
56
57
|
src: i,
|
|
57
58
|
mode: "client"
|
|
58
59
|
}), a({
|
|
59
60
|
src: u,
|
|
60
61
|
mode: "server"
|
|
61
|
-
}), a({
|
|
62
|
+
}), r.mode !== "oauth2" && (a({
|
|
62
63
|
src: c,
|
|
63
64
|
mode: "client"
|
|
64
65
|
}), g({
|
|
65
66
|
name: "auth",
|
|
66
|
-
path:
|
|
67
|
+
path: d,
|
|
67
68
|
global: !0
|
|
68
|
-
}),
|
|
69
|
+
})), s.hook("pages:extend", () => {
|
|
69
70
|
}), S([
|
|
70
71
|
{
|
|
71
72
|
name: "useStrandsAuth",
|
|
72
73
|
as: "useStrandsAuth",
|
|
73
|
-
from:
|
|
74
|
+
from: t.resolve(`./runtime/composables/useStrandsAuth.${o}`)
|
|
74
75
|
},
|
|
75
76
|
{
|
|
76
77
|
name: "useAuthUser",
|
|
77
78
|
as: "useAuthUser",
|
|
78
|
-
from:
|
|
79
|
+
from: t.resolve(`./runtime/composables/useStrandsAuth.${o}`)
|
|
79
80
|
},
|
|
80
81
|
{
|
|
81
82
|
name: "useAuthState",
|
|
82
83
|
as: "useAuthState",
|
|
83
|
-
from:
|
|
84
|
+
from: t.resolve(`./runtime/composables/useStrandsAuth.${o}`)
|
|
84
85
|
},
|
|
85
86
|
{
|
|
86
87
|
name: "useAuthenticatedFetch",
|
|
87
88
|
as: "useAuthenticatedFetch",
|
|
88
|
-
from:
|
|
89
|
+
from: t.resolve(`./runtime/composables/useAuthenticatedFetch.${o}`)
|
|
89
90
|
},
|
|
90
91
|
{
|
|
91
92
|
name: "useStrandsOAuth",
|
|
92
93
|
as: "useStrandsOAuth",
|
|
93
|
-
from:
|
|
94
|
+
from: t.resolve(`./runtime/composables/useStrandsOAuth.${o}`)
|
|
94
95
|
}
|
|
95
96
|
]);
|
|
96
|
-
const
|
|
97
|
+
const l = [
|
|
97
98
|
// Strands Auth Components
|
|
98
99
|
"StrandsAuth",
|
|
99
100
|
"StrandsSignIn",
|
|
@@ -157,21 +158,21 @@ const A = {
|
|
|
157
158
|
"IconGithub",
|
|
158
159
|
"IconGoogle"
|
|
159
160
|
];
|
|
160
|
-
for (const e of
|
|
161
|
+
for (const e of l)
|
|
161
162
|
f({
|
|
162
163
|
name: e,
|
|
163
164
|
export: e,
|
|
164
165
|
filePath: "@strands.gg/accui"
|
|
165
166
|
});
|
|
166
|
-
|
|
167
|
+
s.hook("prepare:types", (e) => {
|
|
167
168
|
e.references.push({
|
|
168
169
|
types: "@strands.gg/auth-nuxt"
|
|
169
170
|
}), e.declarations && e.declarations.push(`
|
|
170
171
|
declare global {
|
|
171
|
-
const useStrandsAuth: typeof import('${
|
|
172
|
-
const useAuthUser: typeof import('${
|
|
173
|
-
const useAuthState: typeof import('${
|
|
174
|
-
const useAuthenticatedFetch: typeof import('${
|
|
172
|
+
const useStrandsAuth: typeof import('${t.resolve("./runtime/composables/useStrandsAuth.d.ts")}')['useStrandsAuth']
|
|
173
|
+
const useAuthUser: typeof import('${t.resolve("./runtime/composables/useStrandsAuth.d.ts")}')['useAuthUser']
|
|
174
|
+
const useAuthState: typeof import('${t.resolve("./runtime/composables/useStrandsAuth.d.ts")}')['useAuthState']
|
|
175
|
+
const useAuthenticatedFetch: typeof import('${t.resolve("./runtime/composables/useAuthenticatedFetch.d.ts")}')['useAuthenticatedFetch']
|
|
175
176
|
}
|
|
176
177
|
`);
|
|
177
178
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),a=require("nuxt/app"),u=require("../../../useStrandsAuth-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),a=require("nuxt/app"),u=require("../../../useStrandsAuth-Yp5OpRHU.cjs.js");const i=()=>{let e;try{const n=a.useRuntimeConfig();n&&n.public&&(e=n.public.strandsAuth)}catch{}const s=u.useStrandsAuth();return{...s,initialize:async()=>{await s.initialize()},signIn:async n=>{const t=await s.signIn(n);return t&&e?.onSignInUrl&&!s.mfaRequired.value&&await a.navigateTo(e.onSignInUrl),t},signUp:async n=>await s.signUp({email:n.email,password:"",firstName:"",lastName:""}),signOut:async n=>{await s.signOut(n),e?.onSignOutUrl&&await a.navigateTo(e.onSignOutUrl)}}},c=()=>{const{user:e}=i();return{user:e}},r=()=>{const{isAuthenticated:e,isLoading:s}=i();return{isAuthenticated:e,isLoading:s}};exports.useAuthState=r;exports.useAuthUser=c;exports.useStrandsAuth=i;
|
|
@@ -41,6 +41,8 @@ export declare const useStrandsAuth: () => {
|
|
|
41
41
|
getMfaWebAuthnChallenge: () => Promise<null>;
|
|
42
42
|
registerHardwareKey: () => Promise<null>;
|
|
43
43
|
completeHardwareKeyRegistration: () => Promise<null>;
|
|
44
|
+
switchAccount: () => Promise<never>;
|
|
45
|
+
removeKnownAccount: () => Promise<void>;
|
|
44
46
|
startTokenRefreshTimer: () => void;
|
|
45
47
|
stopTokenRefreshTimer: () => void;
|
|
46
48
|
getAuthHeaders: () => Record<string, string>;
|
|
@@ -54,7 +56,9 @@ export declare const useStrandsAuth: () => {
|
|
|
54
56
|
signUp: (userData: {
|
|
55
57
|
email: string;
|
|
56
58
|
}) => Promise<void>;
|
|
57
|
-
signOut: (
|
|
59
|
+
signOut: (options?: {
|
|
60
|
+
all?: boolean;
|
|
61
|
+
}) => Promise<void>;
|
|
58
62
|
user: ComputedRef<User | null>;
|
|
59
63
|
currentUser: ComputedRef<User | null>;
|
|
60
64
|
currentSession: ComputedRef<import('../../..').Session | null>;
|
|
@@ -98,6 +102,8 @@ export declare const useStrandsAuth: () => {
|
|
|
98
102
|
getMfaWebAuthnChallenge: (deviceId: string) => Promise<any>;
|
|
99
103
|
registerHardwareKey: (deviceName: string, accessToken: string, deviceType?: "hardware" | "passkey") => Promise<any>;
|
|
100
104
|
completeHardwareKeyRegistration: (deviceId: string, credential: any, accessToken: string) => Promise<any>;
|
|
105
|
+
switchAccount: (userId: string) => Promise<import('../../..').AuthResponse>;
|
|
106
|
+
removeKnownAccount: (userId: string) => Promise<void>;
|
|
101
107
|
startTokenRefreshTimer: () => void;
|
|
102
108
|
stopTokenRefreshTimer: () => void;
|
|
103
109
|
getAuthHeaders: () => Record<string, string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed as n } from "vue";
|
|
2
|
-
import { useRuntimeConfig as
|
|
3
|
-
import { u } from "../../../useStrandsAuth-
|
|
2
|
+
import { useRuntimeConfig as l, navigateTo as t } from "nuxt/app";
|
|
3
|
+
import { u } from "../../../useStrandsAuth-D2HvStMt.es.js";
|
|
4
4
|
const o = () => ({
|
|
5
5
|
user: n(() => null),
|
|
6
6
|
currentUser: n(() => null),
|
|
@@ -45,6 +45,11 @@ const o = () => ({
|
|
|
45
45
|
getMfaWebAuthnChallenge: async () => null,
|
|
46
46
|
registerHardwareKey: async () => null,
|
|
47
47
|
completeHardwareKeyRegistration: async () => null,
|
|
48
|
+
switchAccount: async () => {
|
|
49
|
+
throw new Error("SSR stub");
|
|
50
|
+
},
|
|
51
|
+
removeKnownAccount: async () => {
|
|
52
|
+
},
|
|
48
53
|
startTokenRefreshTimer: () => {
|
|
49
54
|
},
|
|
50
55
|
stopTokenRefreshTimer: () => {
|
|
@@ -52,49 +57,49 @@ const o = () => ({
|
|
|
52
57
|
getAuthHeaders: () => ({ "Content-Type": "application/json" }),
|
|
53
58
|
forceReInit: () => {
|
|
54
59
|
}
|
|
55
|
-
}),
|
|
60
|
+
}), r = () => {
|
|
56
61
|
if (import.meta.server)
|
|
57
62
|
return o();
|
|
58
63
|
let e;
|
|
59
64
|
try {
|
|
60
|
-
const
|
|
61
|
-
|
|
65
|
+
const s = l();
|
|
66
|
+
s && s.public && (e = s.public.strandsAuth);
|
|
62
67
|
} catch {
|
|
63
68
|
}
|
|
64
|
-
const
|
|
69
|
+
const a = u();
|
|
65
70
|
return {
|
|
66
71
|
// Re-export Vue composable state and methods
|
|
67
|
-
...
|
|
72
|
+
...a,
|
|
68
73
|
// Add initialize function
|
|
69
74
|
initialize: async () => {
|
|
70
|
-
await
|
|
75
|
+
await a.initialize();
|
|
71
76
|
},
|
|
72
77
|
// Override methods with Nuxt-specific navigation
|
|
73
|
-
signIn: async (
|
|
74
|
-
const
|
|
75
|
-
return
|
|
78
|
+
signIn: async (s) => {
|
|
79
|
+
const i = await a.signIn(s);
|
|
80
|
+
return i && e?.onSignInUrl && !a.mfaRequired.value && await t(e.onSignInUrl), i;
|
|
76
81
|
},
|
|
77
|
-
signUp: async (
|
|
78
|
-
email:
|
|
82
|
+
signUp: async (s) => await a.signUp({
|
|
83
|
+
email: s.email,
|
|
79
84
|
password: "",
|
|
80
85
|
// Empty password for magic link
|
|
81
86
|
firstName: "",
|
|
82
87
|
// Will be filled later in the magic link flow
|
|
83
88
|
lastName: ""
|
|
84
89
|
}),
|
|
85
|
-
signOut: async () => {
|
|
86
|
-
await
|
|
90
|
+
signOut: async (s) => {
|
|
91
|
+
await a.signOut(s), e?.onSignOutUrl && await t(e.onSignOutUrl);
|
|
87
92
|
}
|
|
88
93
|
};
|
|
89
94
|
}, S = () => {
|
|
90
|
-
const { user: e } =
|
|
95
|
+
const { user: e } = r();
|
|
91
96
|
return { user: e };
|
|
92
97
|
}, p = () => {
|
|
93
|
-
const { isAuthenticated: e, isLoading:
|
|
94
|
-
return { isAuthenticated: e, isLoading:
|
|
98
|
+
const { isAuthenticated: e, isLoading: a } = r();
|
|
99
|
+
return { isAuthenticated: e, isLoading: a };
|
|
95
100
|
};
|
|
96
101
|
export {
|
|
97
102
|
p as useAuthState,
|
|
98
103
|
S as useAuthUser,
|
|
99
|
-
|
|
104
|
+
r as useStrandsAuth
|
|
100
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e=require("nuxt/app"),t=require("../../useStrandsConfig-BY_IIwK8.cjs.js"),c=e.defineNuxtPlugin({name:"strands-auth-client",async setup(){const i=e.useRuntimeConfig().public.strandsAuth,n={...t.STRANDS_AUTH_DEFAULTS,...i};if(t.setStrandsConfig(n),typeof window<"u"&&(window.__STRANDS_CONFIG__=n),n?.accentColor&&typeof window<"u"&&document.documentElement.style.setProperty("--strands-accent",n.accentColor),n?.mode!=="oauth2"){const{useStrandsAuth:o}=await Promise.resolve().then(()=>require("./composables/useStrandsAuth.cjs.js")),{initialize:s}=o();await s()}}});module.exports=c;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { defineNuxtPlugin as
|
|
2
|
-
import { s as
|
|
3
|
-
|
|
4
|
-
const g = s({
|
|
1
|
+
import { defineNuxtPlugin as i, useRuntimeConfig as s } from "nuxt/app";
|
|
2
|
+
import { s as a, S as c } from "../../useStrandsConfig-B8h5hDy7.es.js";
|
|
3
|
+
const u = i({
|
|
5
4
|
name: "strands-auth-client",
|
|
6
5
|
async setup() {
|
|
7
|
-
const
|
|
6
|
+
const n = s().public.strandsAuth, t = {
|
|
8
7
|
...c,
|
|
9
|
-
...
|
|
8
|
+
...n
|
|
10
9
|
};
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
|
|
10
|
+
if (a(t), typeof window < "u" && (window.__STRANDS_CONFIG__ = t), t?.accentColor && typeof window < "u" && document.documentElement.style.setProperty("--strands-accent", t.accentColor), t?.mode !== "oauth2") {
|
|
11
|
+
const { useStrandsAuth: e } = await import("./composables/useStrandsAuth.es.js"), { initialize: o } = e();
|
|
12
|
+
await o();
|
|
14
13
|
}
|
|
15
|
-
const { useStrandsAuth: n } = await import("./composables/useStrandsAuth.es.js"), { initialize: o } = n();
|
|
16
|
-
await o();
|
|
17
14
|
}
|
|
18
15
|
});
|
|
19
16
|
export {
|
|
20
|
-
|
|
17
|
+
u as default
|
|
21
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("nuxt/app"),s=require("../../useStrandsConfig-
|
|
1
|
+
"use strict";const n=require("nuxt/app"),s=require("../../useStrandsConfig-BY_IIwK8.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,5 +1,5 @@
|
|
|
1
1
|
import { defineNuxtPlugin as t, useRuntimeConfig as e } from "nuxt/app";
|
|
2
|
-
import { s as o, S as r } from "../../useStrandsConfig-
|
|
2
|
+
import { s as o, S as r } from "../../useStrandsConfig-B8h5hDy7.es.js";
|
|
3
3
|
const u = t({
|
|
4
4
|
name: "strands-auth-server",
|
|
5
5
|
setup() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComputedRef, Ref } from 'vue';
|
|
2
|
-
import { User, Session, SignInCredentials, SignUpData, SessionInfo, SessionStats, MfaDevice, StrandsAuthConfig, StrandsAuthEndpoints, AuthenticatedFetchOptions } from './index';
|
|
2
|
+
import { User, Session, SignInCredentials, SignUpData, SessionInfo, SessionStats, MfaDevice, AuthResponse, StrandsAuthConfig, StrandsAuthEndpoints, AuthenticatedFetchOptions } from './index';
|
|
3
3
|
export interface UseStrandsAuthReturn {
|
|
4
4
|
user: ComputedRef<User | null>;
|
|
5
5
|
currentUser: ComputedRef<User | null>;
|
|
@@ -21,7 +21,9 @@ export interface UseStrandsAuthReturn {
|
|
|
21
21
|
availableMfaMethods: ComputedRef<MfaDevice[]>;
|
|
22
22
|
signIn: (credentials: SignInCredentials) => Promise<any>;
|
|
23
23
|
signUp: (userData: SignUpData) => Promise<void>;
|
|
24
|
-
signOut: (
|
|
24
|
+
signOut: (options?: {
|
|
25
|
+
all?: boolean;
|
|
26
|
+
}) => Promise<void>;
|
|
25
27
|
refreshToken: () => Promise<boolean>;
|
|
26
28
|
fetchProfile: () => Promise<User>;
|
|
27
29
|
updateProfile: (updates: Partial<User>) => Promise<User>;
|
|
@@ -48,6 +50,8 @@ export interface UseStrandsAuthReturn {
|
|
|
48
50
|
getMfaWebAuthnChallenge: (deviceId: string) => Promise<any>;
|
|
49
51
|
registerHardwareKey: (deviceName: string, accessToken: string, deviceType?: 'hardware' | 'passkey') => Promise<any>;
|
|
50
52
|
completeHardwareKeyRegistration: (deviceId: string, credential: any, accessToken: string) => Promise<any>;
|
|
53
|
+
switchAccount: (userId: string) => Promise<AuthResponse>;
|
|
54
|
+
removeKnownAccount: (userId: string) => Promise<void>;
|
|
51
55
|
startTokenRefreshTimer: () => void;
|
|
52
56
|
stopTokenRefreshTimer: () => void;
|
|
53
57
|
getAuthHeaders: () => Record<string, string>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -85,6 +85,13 @@ export interface OAuthProvider {
|
|
|
85
85
|
scopes?: string[];
|
|
86
86
|
}
|
|
87
87
|
export interface StrandsAuthConfig {
|
|
88
|
+
/**
|
|
89
|
+
* Authentication mode for the Nuxt module
|
|
90
|
+
* - 'direct': First-party mode — uses HttpOnly cookies, auth interceptor, and auto-initialises useStrandsAuth (default)
|
|
91
|
+
* - 'oauth2': Third-party mode — skips auth interceptor, auto-init, and route middleware. Use this for apps on a different domain that authenticate via OAuth2.
|
|
92
|
+
* @default 'direct'
|
|
93
|
+
*/
|
|
94
|
+
mode?: 'direct' | 'oauth2';
|
|
88
95
|
/**
|
|
89
96
|
* Base URL for the Strands Auth API
|
|
90
97
|
* @default 'https://your-api.example.com'
|
|
@@ -216,6 +223,8 @@ export interface StrandsAuthEndpoints {
|
|
|
216
223
|
sessionsStats: string;
|
|
217
224
|
sessionRevoke: string;
|
|
218
225
|
sessionsRevokeAll: string;
|
|
226
|
+
switchAccount: string;
|
|
227
|
+
removeKnownAccount: string;
|
|
219
228
|
}
|
|
220
229
|
export interface AuthResponse {
|
|
221
230
|
access_token: string;
|
|
@@ -230,6 +239,18 @@ export interface AuthStatusResponse {
|
|
|
230
239
|
user: User | null;
|
|
231
240
|
/** Unix timestamp (seconds) when the access token expires */
|
|
232
241
|
expires_at?: number;
|
|
242
|
+
/** Known accounts with session status (multi-account support) */
|
|
243
|
+
known_accounts?: KnownAccountStatus[];
|
|
244
|
+
}
|
|
245
|
+
export interface KnownAccount {
|
|
246
|
+
id: string;
|
|
247
|
+
email: string;
|
|
248
|
+
name: string;
|
|
249
|
+
avatar?: string;
|
|
250
|
+
active: boolean;
|
|
251
|
+
}
|
|
252
|
+
export interface KnownAccountStatus extends KnownAccount {
|
|
253
|
+
has_valid_session: boolean;
|
|
233
254
|
}
|
|
234
255
|
export type MfaDeviceType = 'totp' | 'email' | 'hardware' | 'passkey';
|
|
235
256
|
export interface MfaDevice {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("vue"),n=r.ref("system"),u=r.ref(!1),l="strands-ui-theme";function g(){return typeof window>"u"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function k(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(l);if(e&&["light","dark","system"].includes(e))return e}catch(e){console.warn("Failed to read theme preference from localStorage:",e)}return"system"}function v(e){if(!(typeof window>"u"))try{localStorage.setItem(l,e)}catch(s){console.warn("Failed to save theme preference to localStorage:",s)}}function m(e){typeof document>"u"||(e?(document.documentElement.setAttribute("data-theme","dark"),document.documentElement.classList.add("dark")):(document.documentElement.setAttribute("data-theme","light"),document.documentElement.classList.remove("dark")))}function w(){const e=r.computed(()=>n.value==="dark"?!0:n.value==="light"?!1:u.value),s=r.computed(()=>{switch(n.value){case"light":return"Light";case"dark":return"Dark";case"system":return"System";default:return"System"}});function a(t){n.value=t,v(t)}function f(){const t=e.value?"light":"dark";a(t)}function h(){switch(n.value){case"light":a("dark");break;case"dark":a("system");break;case"system":a("light");break;default:a("light");break}}function c(){if(typeof window>"u")return;u.value=g();const t=window.matchMedia("(prefers-color-scheme: dark)"),d=i=>{u.value=i.matches};t.addEventListener?t.addEventListener("change",d):t.addListener(d);const y=k();n.value=y,m(e.value),r.watch(e,i=>{m(i)},{immediate:!1})}return r.onMounted(()=>{c()}),{currentTheme:r.computed(()=>n.value),isDark:e,themeLabel:s,setTheme:a,toggle:f,cycleTheme:h,initialize:c,themeOptions:[{value:"light",label:"Light",icon:"sun"},{value:"dark",label:"Dark",icon:"moon"},{value:"system",label:"System",icon:"monitor"}]}}let o=null;function p(){return o||(o=w(),typeof window<"u"&&(localStorage.getItem(l)===null&&(n.value="system"),o.initialize())),o}exports.useGlobalDarkMode=p;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ref as f, computed as i, onMounted as k, watch as v } from "vue";
|
|
2
|
+
const n = f("system"), l = f(!1), u = "strands-ui-theme";
|
|
3
|
+
function w() {
|
|
4
|
+
return typeof window > "u" ? !1 : window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
5
|
+
}
|
|
6
|
+
function p() {
|
|
7
|
+
if (typeof window > "u") return "system";
|
|
8
|
+
try {
|
|
9
|
+
const e = localStorage.getItem(u);
|
|
10
|
+
if (e && ["light", "dark", "system"].includes(e))
|
|
11
|
+
return e;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.warn("Failed to read theme preference from localStorage:", e);
|
|
14
|
+
}
|
|
15
|
+
return "system";
|
|
16
|
+
}
|
|
17
|
+
function S(e) {
|
|
18
|
+
if (!(typeof window > "u"))
|
|
19
|
+
try {
|
|
20
|
+
localStorage.setItem(u, e);
|
|
21
|
+
} catch (o) {
|
|
22
|
+
console.warn("Failed to save theme preference to localStorage:", o);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function m(e) {
|
|
26
|
+
typeof document > "u" || (e ? (document.documentElement.setAttribute("data-theme", "dark"), document.documentElement.classList.add("dark")) : (document.documentElement.setAttribute("data-theme", "light"), document.documentElement.classList.remove("dark")));
|
|
27
|
+
}
|
|
28
|
+
function b() {
|
|
29
|
+
const e = i(() => n.value === "dark" ? !0 : n.value === "light" ? !1 : l.value), o = i(() => {
|
|
30
|
+
switch (n.value) {
|
|
31
|
+
case "light":
|
|
32
|
+
return "Light";
|
|
33
|
+
case "dark":
|
|
34
|
+
return "Dark";
|
|
35
|
+
case "system":
|
|
36
|
+
return "System";
|
|
37
|
+
default:
|
|
38
|
+
return "System";
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
function r(t) {
|
|
42
|
+
n.value = t, S(t);
|
|
43
|
+
}
|
|
44
|
+
function h() {
|
|
45
|
+
const t = e.value ? "light" : "dark";
|
|
46
|
+
r(t);
|
|
47
|
+
}
|
|
48
|
+
function y() {
|
|
49
|
+
switch (n.value) {
|
|
50
|
+
case "light":
|
|
51
|
+
r("dark");
|
|
52
|
+
break;
|
|
53
|
+
case "dark":
|
|
54
|
+
r("system");
|
|
55
|
+
break;
|
|
56
|
+
case "system":
|
|
57
|
+
r("light");
|
|
58
|
+
break;
|
|
59
|
+
default:
|
|
60
|
+
r("light");
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function c() {
|
|
65
|
+
if (typeof window > "u") return;
|
|
66
|
+
l.value = w();
|
|
67
|
+
const t = window.matchMedia("(prefers-color-scheme: dark)"), d = (s) => {
|
|
68
|
+
l.value = s.matches;
|
|
69
|
+
};
|
|
70
|
+
t.addEventListener ? t.addEventListener("change", d) : t.addListener(d);
|
|
71
|
+
const g = p();
|
|
72
|
+
n.value = g, m(e.value), v(e, (s) => {
|
|
73
|
+
m(s);
|
|
74
|
+
}, { immediate: !1 });
|
|
75
|
+
}
|
|
76
|
+
return k(() => {
|
|
77
|
+
c();
|
|
78
|
+
}), {
|
|
79
|
+
// State
|
|
80
|
+
currentTheme: i(() => n.value),
|
|
81
|
+
isDark: e,
|
|
82
|
+
themeLabel: o,
|
|
83
|
+
// Actions
|
|
84
|
+
setTheme: r,
|
|
85
|
+
toggle: h,
|
|
86
|
+
cycleTheme: y,
|
|
87
|
+
initialize: c,
|
|
88
|
+
// Theme options for UI
|
|
89
|
+
themeOptions: [
|
|
90
|
+
{ value: "light", label: "Light", icon: "sun" },
|
|
91
|
+
{ value: "dark", label: "Dark", icon: "moon" },
|
|
92
|
+
{ value: "system", label: "System", icon: "monitor" }
|
|
93
|
+
]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
let a = null;
|
|
97
|
+
function E() {
|
|
98
|
+
return a || (a = b(), typeof window < "u" && (localStorage.getItem(u) === null && (n.value = "system"), a.initialize())), a;
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
E as u
|
|
102
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ref as h, computed as u, getCurrentInstance as w, onMounted as p, watch as S } from "vue";
|
|
2
|
+
const n = h("system"), l = h(!1), c = "strands-ui-theme";
|
|
3
|
+
function b() {
|
|
4
|
+
return typeof window > "u" ? !1 : window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
5
|
+
}
|
|
6
|
+
function T() {
|
|
7
|
+
if (typeof window > "u") return "system";
|
|
8
|
+
try {
|
|
9
|
+
const e = localStorage.getItem(c);
|
|
10
|
+
if (e && ["light", "dark", "system"].includes(e))
|
|
11
|
+
return e;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.warn("Failed to read theme preference from localStorage:", e);
|
|
14
|
+
}
|
|
15
|
+
return "system";
|
|
16
|
+
}
|
|
17
|
+
function E(e) {
|
|
18
|
+
if (!(typeof window > "u"))
|
|
19
|
+
try {
|
|
20
|
+
localStorage.setItem(c, e);
|
|
21
|
+
} catch (s) {
|
|
22
|
+
console.warn("Failed to save theme preference to localStorage:", s);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function f(e) {
|
|
26
|
+
typeof document > "u" || (e ? (document.documentElement.setAttribute("data-theme", "dark"), document.documentElement.classList.add("dark")) : (document.documentElement.setAttribute("data-theme", "light"), document.documentElement.classList.remove("dark")));
|
|
27
|
+
}
|
|
28
|
+
function L(e = {}) {
|
|
29
|
+
const { skipAutoInit: s = !1 } = e, a = u(() => n.value === "dark" ? !0 : n.value === "light" ? !1 : l.value), g = u(() => {
|
|
30
|
+
switch (n.value) {
|
|
31
|
+
case "light":
|
|
32
|
+
return "Light";
|
|
33
|
+
case "dark":
|
|
34
|
+
return "Dark";
|
|
35
|
+
case "system":
|
|
36
|
+
return "System";
|
|
37
|
+
default:
|
|
38
|
+
return "System";
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
function r(t) {
|
|
42
|
+
n.value = t, E(t);
|
|
43
|
+
}
|
|
44
|
+
function y() {
|
|
45
|
+
const t = a.value ? "light" : "dark";
|
|
46
|
+
r(t);
|
|
47
|
+
}
|
|
48
|
+
function k() {
|
|
49
|
+
switch (n.value) {
|
|
50
|
+
case "light":
|
|
51
|
+
r("dark");
|
|
52
|
+
break;
|
|
53
|
+
case "dark":
|
|
54
|
+
r("system");
|
|
55
|
+
break;
|
|
56
|
+
case "system":
|
|
57
|
+
r("light");
|
|
58
|
+
break;
|
|
59
|
+
default:
|
|
60
|
+
r("light");
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function d() {
|
|
65
|
+
if (typeof window > "u") return;
|
|
66
|
+
l.value = b();
|
|
67
|
+
const t = window.matchMedia("(prefers-color-scheme: dark)"), m = (i) => {
|
|
68
|
+
l.value = i.matches;
|
|
69
|
+
};
|
|
70
|
+
t.addEventListener ? t.addEventListener("change", m) : t.addListener(m);
|
|
71
|
+
const v = T();
|
|
72
|
+
n.value = v, f(a.value), S(a, (i) => {
|
|
73
|
+
f(i);
|
|
74
|
+
}, { immediate: !1 });
|
|
75
|
+
}
|
|
76
|
+
return !s && w() && p(() => {
|
|
77
|
+
d();
|
|
78
|
+
}), {
|
|
79
|
+
// State
|
|
80
|
+
currentTheme: u(() => n.value),
|
|
81
|
+
isDark: a,
|
|
82
|
+
themeLabel: g,
|
|
83
|
+
// Actions
|
|
84
|
+
setTheme: r,
|
|
85
|
+
toggle: y,
|
|
86
|
+
cycleTheme: k,
|
|
87
|
+
initialize: d,
|
|
88
|
+
// Theme options for UI
|
|
89
|
+
themeOptions: [
|
|
90
|
+
{ value: "light", label: "Light", icon: "sun" },
|
|
91
|
+
{ value: "dark", label: "Dark", icon: "moon" },
|
|
92
|
+
{ value: "system", label: "System", icon: "monitor" }
|
|
93
|
+
]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
let o = null;
|
|
97
|
+
function D() {
|
|
98
|
+
return o || (o = L({ skipAutoInit: !0 }), typeof window < "u" && (localStorage.getItem(c) === null && (n.value = "system"), o.initialize())), o;
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
D as u
|
|
102
|
+
};
|