@strands.gg/accui 2.17.58 → 2.17.60
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-B1Gl61ax.cjs.js +143 -0
- package/dist/StrandsUIPlugin-BNU_Ayly.es.js +20577 -0
- package/dist/accui.css +1 -0
- package/dist/index.cjs.js +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +12931 -0
- package/dist/nuxt/module.cjs.js +23 -0
- package/dist/nuxt/module.d.ts +4 -0
- package/dist/nuxt/module.es.js +182 -0
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.cjs.js +1 -0
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.d.ts +20 -0
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.es.js +103 -0
- package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -0
- package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +111 -0
- package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +100 -0
- package/dist/nuxt/runtime/composables/useStrandsOAuth.d.ts +8 -0
- package/dist/nuxt/runtime/middleware/auth.d.ts +6 -0
- package/dist/nuxt/runtime/middleware/auth.global.cjs.js +1 -0
- package/dist/nuxt/runtime/middleware/auth.global.d.ts +2 -0
- package/dist/nuxt/runtime/middleware/auth.global.es.js +35 -0
- package/dist/nuxt/runtime/middleware/guest.d.ts +6 -0
- package/dist/nuxt/runtime/plugin.client.cjs.js +1 -0
- package/dist/nuxt/runtime/plugin.client.d.ts +2 -0
- package/dist/nuxt/runtime/plugin.client.es.js +21 -0
- package/dist/nuxt/runtime/plugin.server.cjs.js +1 -0
- package/dist/nuxt/runtime/plugin.server.d.ts +2 -0
- package/dist/nuxt/runtime/plugin.server.es.js +15 -0
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.cjs.js +1 -0
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.d.ts +9 -0
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.es.js +46 -0
- package/dist/nuxt/types.d.ts +51 -0
- package/dist/nuxt.cjs.js +1 -0
- package/dist/nuxt.d.ts +4 -0
- package/dist/nuxt.es.js +11 -0
- package/dist/robots.txt +4 -0
- package/dist/shared/defaults.d.ts +2 -0
- package/dist/sitemap.xml +9 -0
- package/dist/types/composables.d.ts +97 -0
- package/dist/types/index.d.ts +263 -0
- package/dist/types/oauth.d.ts +420 -0
- package/dist/useDarkMode-BdG1G2mj.es.js +102 -0
- package/dist/useDarkMode-Dd0Q5Nnz.cjs.js +1 -0
- package/dist/useStrandsAuth-CetpoBNk.cjs.js +1 -0
- package/dist/useStrandsAuth-wzl2F9DE.es.js +702 -0
- package/dist/useStrandsConfig-B2UXxIbT.es.js +213 -0
- package/dist/useStrandsConfig-BYOAEt9d.cjs.js +1 -0
- package/dist/utils/colors.d.ts +10 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/slots.d.ts +1 -0
- package/dist/utils/validation.d.ts +12 -0
- package/dist/vite/index.d.ts +2 -0
- package/dist/vite/plugin.d.ts +68 -0
- package/dist/vite.cjs.js +29 -0
- package/dist/vite.d.ts +6 -0
- package/dist/vite.es.js +92 -0
- package/dist/vue/components/SignedIn.vue.d.ts +35 -0
- package/dist/vue/components/StrandsAuth.vue.d.ts +24 -0
- package/dist/vue/components/StrandsBackupCodesModal.vue.d.ts +11 -0
- package/dist/vue/components/StrandsCompleteSignUp.vue.d.ts +20 -0
- package/dist/vue/components/StrandsConfigProvider.vue.d.ts +21 -0
- package/dist/vue/components/StrandsConfirmModal.vue.d.ts +21 -0
- package/dist/vue/components/StrandsEmailMfaSetupModal.vue.d.ts +11 -0
- package/dist/vue/components/StrandsHardwareKeySetupModal.vue.d.ts +14 -0
- package/dist/vue/components/StrandsLogo.vue.d.ts +9 -0
- package/dist/vue/components/StrandsMFASetup.vue.d.ts +15 -0
- package/dist/vue/components/StrandsMfaModal.vue.d.ts +11 -0
- package/dist/vue/components/StrandsMfaVerification.vue.d.ts +16 -0
- package/dist/vue/components/StrandsNav/StrandsNav.vue.d.ts +43 -0
- package/dist/vue/components/StrandsNav/StrandsNavItem.vue.d.ts +26 -0
- package/dist/vue/components/StrandsNav/index.d.ts +8 -0
- package/dist/vue/components/StrandsNav/types.d.ts +12 -0
- package/dist/vue/components/StrandsOAuthButton.vue.d.ts +18 -0
- package/dist/vue/components/StrandsOAuthCallback.vue.d.ts +12 -0
- package/dist/vue/components/StrandsPasswordReset.vue.d.ts +14 -0
- package/dist/vue/components/StrandsSecuredFooter.vue.d.ts +21 -0
- package/dist/vue/components/StrandsSessionsModal.vue.d.ts +11 -0
- package/dist/vue/components/StrandsSettingsModal.vue.d.ts +32 -0
- package/dist/vue/components/StrandsSignIn.vue.d.ts +20 -0
- package/dist/vue/components/StrandsSignUp.vue.d.ts +18 -0
- package/dist/vue/components/StrandsTotpSetupModal.vue.d.ts +11 -0
- package/dist/vue/components/StrandsUserButton.vue.d.ts +54 -0
- package/dist/vue/components/StrandsUserProfile.vue.d.ts +25 -0
- package/dist/vue/components/SvgIcon.vue.d.ts +16 -0
- package/dist/vue/components/VirtualList.vue.d.ts +36 -0
- package/dist/vue/components/icons/IconGithub.vue.d.ts +2 -0
- package/dist/vue/components/icons/IconGoogle.vue.d.ts +2 -0
- package/dist/vue/components/icons/index.d.ts +2 -0
- package/dist/vue/components/index.d.ts +29 -0
- package/dist/vue/composables/useAuthenticatedFetch.d.ts +22 -0
- package/dist/vue/composables/useDarkMode.d.ts +53 -0
- package/dist/vue/composables/useFloatingPosition.d.ts +22 -0
- package/dist/vue/composables/useModalStack.d.ts +86 -0
- package/dist/vue/composables/useOAuthProviders.d.ts +73 -0
- package/dist/vue/composables/useStrandsAuth.d.ts +2 -0
- package/dist/vue/composables/useStrandsConfig.d.ts +5 -0
- package/dist/vue/composables/useStrandsMfa.d.ts +36 -0
- package/dist/vue/composables/useStrandsOAuth.d.ts +10 -0
- package/dist/vue/composables/useTheme.d.ts +18 -0
- package/dist/vue/index.d.ts +16 -0
- package/dist/vue/plugins/StrandsUIPlugin.d.ts +19 -0
- package/dist/vue/ui/UiAlert.vue.d.ts +30 -0
- package/dist/vue/ui/UiApp.vue.d.ts +26 -0
- package/dist/vue/ui/UiAvatarEditor.vue.d.ts +24 -0
- package/dist/vue/ui/UiButton/UiButton.Anchor.vue.d.ts +42 -0
- package/dist/vue/ui/UiButton/UiButton.Content.vue.d.ts +32 -0
- package/dist/vue/ui/UiButton/UiButton.Nuxt.vue.d.ts +39 -0
- package/dist/vue/ui/UiButton/index.d.ts +11 -0
- package/dist/vue/ui/UiButton.vue.d.ts +77 -0
- package/dist/vue/ui/UiCard.vue.d.ts +38 -0
- package/dist/vue/ui/UiCheckboxGroup.vue.d.ts +46 -0
- package/dist/vue/ui/UiColorPicker/UiColorPicker.Button.vue.d.ts +19 -0
- package/dist/vue/ui/UiColorPicker/UiColorPicker.Picker.vue.d.ts +31 -0
- package/dist/vue/ui/UiColorPicker.vue.d.ts +34 -0
- package/dist/vue/ui/UiDateTimePicker.vue.d.ts +36 -0
- package/dist/vue/ui/UiDivider.vue.d.ts +43 -0
- package/dist/vue/ui/UiHero.vue.d.ts +53 -0
- package/dist/vue/ui/UiInput/UiInput.Date.vue.d.ts +30 -0
- package/dist/vue/ui/UiInput/UiInput.DateTime.vue.d.ts +34 -0
- package/dist/vue/ui/UiInput/UiInput.File.vue.d.ts +59 -0
- package/dist/vue/ui/UiInput/UiInput.Pincode.vue.d.ts +58 -0
- package/dist/vue/ui/UiInput/UiInput.RichText.vue.d.ts +66 -0
- package/dist/vue/ui/UiInput/UiInput.Select.vue.d.ts +806 -0
- package/dist/vue/ui/UiInput/UiInput.Text.vue.d.ts +51 -0
- package/dist/vue/ui/UiInput/UiInput.Textarea.vue.d.ts +60 -0
- package/dist/vue/ui/UiInput/UiInput.Time.vue.d.ts +30 -0
- package/dist/vue/ui/UiInput.vue.d.ts +84 -0
- package/dist/vue/ui/UiLevelProgress.vue.d.ts +18 -0
- package/dist/vue/ui/UiLink.vue.d.ts +42 -0
- package/dist/vue/ui/UiLoader.vue.d.ts +18 -0
- package/dist/vue/ui/UiMegaMenu/UiMegaMenu.Group.vue.d.ts +20 -0
- package/dist/vue/ui/UiMegaMenu/UiMegaMenu.Item.vue.d.ts +35 -0
- package/dist/vue/ui/UiMegaMenu/UiMegaMenu.Panel.vue.d.ts +28 -0
- package/dist/vue/ui/UiMegaMenu/index.d.ts +4 -0
- package/dist/vue/ui/UiMegaMenu.vue.d.ts +48 -0
- package/dist/vue/ui/UiModal.vue.d.ts +71 -0
- package/dist/vue/ui/UiPill.vue.d.ts +43 -0
- package/dist/vue/ui/UiRadioGroup.vue.d.ts +40 -0
- package/dist/vue/ui/UiSlider.vue.d.ts +53 -0
- package/dist/vue/ui/UiTable.vue.d.ts +114 -0
- package/dist/vue/ui/UiTabs.vue.d.ts +87 -0
- package/dist/vue/ui/UiThemeToggle.vue.d.ts +13 -0
- package/dist/vue/ui/UiToggle.vue.d.ts +20 -0
- package/dist/vue/ui/UiTooltip.vue.d.ts +41 -0
- package/dist/vue/ui/index.d.ts +62 -0
- package/dist/vue/utils/contrast.d.ts +75 -0
- package/dist/vue/utils/debounce.d.ts +12 -0
- package/dist/vue/utils/fontPreloader.d.ts +11 -0
- package/dist/vue/utils/iconProps.d.ts +9 -0
- package/dist/vue/utils/lazyComponents.d.ts +4 -0
- package/dist/vue/utils/levels.d.ts +27 -0
- package/dist/vue/utils/modalStack.d.ts +34 -0
- package/dist/vue/utils/performanceInit.d.ts +40 -0
- package/dist/vue/utils/requestCache.d.ts +49 -0
- package/dist/vue/utils/slots.d.ts +9 -0
- package/dist/vue/utils/sounds.d.ts +57 -0
- package/dist/webcomponents/define-element.d.ts +19 -0
- package/dist/webcomponents/entries/strands-alert.d.ts +2 -0
- package/dist/webcomponents/entries/strands-button.d.ts +2 -0
- package/dist/webcomponents/entries/strands-card.d.ts +2 -0
- package/dist/webcomponents/entries/strands-checkbox-group.d.ts +2 -0
- package/dist/webcomponents/entries/strands-divider.d.ts +2 -0
- package/dist/webcomponents/entries/strands-input.d.ts +2 -0
- package/dist/webcomponents/entries/strands-link.d.ts +2 -0
- package/dist/webcomponents/entries/strands-loader-spinner.d.ts +2 -0
- package/dist/webcomponents/entries/strands-modal.d.ts +2 -0
- package/dist/webcomponents/entries/strands-pill.d.ts +2 -0
- package/dist/webcomponents/entries/strands-radio-group.d.ts +2 -0
- package/dist/webcomponents/entries/strands-slider.d.ts +2 -0
- package/dist/webcomponents/entries/strands-table.d.ts +2 -0
- package/dist/webcomponents/entries/strands-tabs.d.ts +2 -0
- package/dist/webcomponents/entries/strands-theme-toggle.d.ts +2 -0
- package/dist/webcomponents/entries/strands-toggle.d.ts +2 -0
- package/dist/webcomponents/entries/strands-tooltip.d.ts +2 -0
- package/dist/webcomponents/index.d.ts +8 -0
- package/dist/webcomponents/loader.d.ts +57 -0
- package/dist/webcomponents/registry.d.ts +41 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineNuxtPlugin as s, useRuntimeConfig as a } from "nuxt/app";
|
|
2
|
+
import { s as d, S as c } from "../../useStrandsConfig-B2UXxIbT.es.js";
|
|
3
|
+
import { u as r } from "../../useDarkMode-BdG1G2mj.es.js";
|
|
4
|
+
const g = s({
|
|
5
|
+
name: "strands-auth-client",
|
|
6
|
+
async setup() {
|
|
7
|
+
const e = a().public.strandsAuth, t = {
|
|
8
|
+
...c,
|
|
9
|
+
...e
|
|
10
|
+
};
|
|
11
|
+
if (d(t), typeof window < "u" && (window.__STRANDS_CONFIG__ = t), t?.accentColor && typeof window < "u" && document.documentElement.style.setProperty("--strands-accent", t.accentColor), typeof window < "u") {
|
|
12
|
+
const i = t?.theme || "system";
|
|
13
|
+
r().setTheme(i);
|
|
14
|
+
}
|
|
15
|
+
const { useStrandsAuth: n } = await import("./composables/useStrandsAuth.es.js"), { initialize: o } = n();
|
|
16
|
+
await o();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
g as default
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("nuxt/app"),s=require("../../useStrandsConfig-BYOAEt9d.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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineNuxtPlugin as t, useRuntimeConfig as e } from "nuxt/app";
|
|
2
|
+
import { s as o, S as r } from "../../useStrandsConfig-B2UXxIbT.es.js";
|
|
3
|
+
const u = t({
|
|
4
|
+
name: "strands-auth-server",
|
|
5
|
+
setup() {
|
|
6
|
+
const s = e().public.strandsAuth, n = {
|
|
7
|
+
...r,
|
|
8
|
+
...s
|
|
9
|
+
};
|
|
10
|
+
o(n);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
u as default
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("nuxt/app"),l=a.defineNuxtPlugin({name:"strands-auth-interceptor",setup(){if(process.server)return;const t=globalThis.fetch;globalThis.fetch=async(e,o)=>{try{let s;if(typeof e=="string"?s=e:e instanceof URL?s=e.toString():s=e.url,p(s)){const c={...o,credentials:"include"};return t(e,c)}return t(e,o)}catch(s){return console.error("[Strands Auth] Error in fetch interceptor:",s),t(e,o)}}}});function p(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 i=["/api/","/v1/","/v2/","/graphql","/trpc"].some(r=>t.includes(r)),n=[":3001",":8000",":8080",":5000",":4000"].some(r=>t.includes(r));return i||n}module.exports=l;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth interceptor plugin for Nuxt
|
|
3
|
+
*
|
|
4
|
+
* With HTTP-only cookies, we no longer need to inject Authorization headers.
|
|
5
|
+
* This interceptor now only adds `credentials: 'include'` to API requests
|
|
6
|
+
* so that cookies are sent automatically.
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: import('nuxt/app').Plugin<Record<string, unknown>> & import('nuxt/app').ObjectPlugin<Record<string, unknown>>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineNuxtPlugin as a } from "nuxt/app";
|
|
2
|
+
const h = a({
|
|
3
|
+
name: "strands-auth-interceptor",
|
|
4
|
+
setup() {
|
|
5
|
+
if (process.server) return;
|
|
6
|
+
const t = globalThis.fetch;
|
|
7
|
+
globalThis.fetch = async (e, o) => {
|
|
8
|
+
try {
|
|
9
|
+
let s;
|
|
10
|
+
if (typeof e == "string" ? s = e : e instanceof URL ? s = e.toString() : s = e.url, l(s)) {
|
|
11
|
+
const n = {
|
|
12
|
+
...o,
|
|
13
|
+
credentials: "include"
|
|
14
|
+
};
|
|
15
|
+
return t(e, n);
|
|
16
|
+
}
|
|
17
|
+
return t(e, o);
|
|
18
|
+
} catch (s) {
|
|
19
|
+
return console.error("[Strands Auth] Error in fetch interceptor:", s), t(e, o);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
function l(t) {
|
|
25
|
+
if (!t.startsWith("http") || [
|
|
26
|
+
"googleapis.com",
|
|
27
|
+
"github.com/api",
|
|
28
|
+
"api.github.com",
|
|
29
|
+
"discord.com/api",
|
|
30
|
+
"graph.microsoft.com",
|
|
31
|
+
"api.stripe.com",
|
|
32
|
+
"api.twilio.com"
|
|
33
|
+
].some((r) => t.includes(r)))
|
|
34
|
+
return !1;
|
|
35
|
+
const i = [
|
|
36
|
+
"/api/",
|
|
37
|
+
"/v1/",
|
|
38
|
+
"/v2/",
|
|
39
|
+
"/graphql",
|
|
40
|
+
"/trpc"
|
|
41
|
+
].some((r) => t.includes(r)), c = [":3001", ":8000", ":8080", ":5000", ":4000"].some((r) => t.includes(r));
|
|
42
|
+
return i || c;
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
h as default
|
|
46
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface StrandsUser {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
avatar?: string;
|
|
7
|
+
mfaEnabled: boolean;
|
|
8
|
+
emailVerified: boolean;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
}
|
|
12
|
+
export interface StrandsSession {
|
|
13
|
+
accessToken: string;
|
|
14
|
+
refreshToken: string;
|
|
15
|
+
expiresAt: Date;
|
|
16
|
+
user: StrandsUser;
|
|
17
|
+
}
|
|
18
|
+
declare module '@nuxt/schema' {
|
|
19
|
+
interface PublicRuntimeConfig {
|
|
20
|
+
strandsAuth?: {
|
|
21
|
+
baseUrl?: string;
|
|
22
|
+
applicationId?: string;
|
|
23
|
+
publicKey?: string;
|
|
24
|
+
accentColor?: string;
|
|
25
|
+
redirectUrl?: string;
|
|
26
|
+
onSignInUrl?: string;
|
|
27
|
+
onSignOutUrl?: string;
|
|
28
|
+
authUrl?: string;
|
|
29
|
+
/** @deprecated OAuth providers are now dynamically fetched from API */
|
|
30
|
+
oauthProviders?: string[];
|
|
31
|
+
autoRefresh?: boolean;
|
|
32
|
+
refreshInterval?: number;
|
|
33
|
+
protectedRoutes?: string[];
|
|
34
|
+
guestOnlyRoutes?: string[];
|
|
35
|
+
devMode?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Theme mode for the UI components
|
|
38
|
+
* @default 'system'
|
|
39
|
+
*/
|
|
40
|
+
theme?: 'light' | 'dark' | 'system';
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
declare module 'nuxt/app' {
|
|
45
|
+
interface NuxtApp {
|
|
46
|
+
$strandsAuth: {
|
|
47
|
+
accentColor: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export {};
|
package/dist/nuxt.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default } from './nuxt/module';
|
|
2
|
+
export type { StrandsAuthConfig, StrandsAuthEndpoints } from './types';
|
|
3
|
+
export { useStrandsAuth, useAuthUser, useAuthState } from './nuxt/runtime/composables/useStrandsAuth';
|
|
4
|
+
export { useAuthenticatedFetch, $authFetch } from './nuxt/runtime/composables/useAuthenticatedFetch';
|
package/dist/nuxt.es.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export {
|
|
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
|
+
};
|
package/dist/robots.txt
ADDED
package/dist/sitemap.xml
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { User, Session, SignInCredentials, SignUpData, SessionInfo, SessionStats, MfaDevice, StrandsAuthConfig, StrandsAuthEndpoints, AuthenticatedFetchOptions } from './index';
|
|
3
|
+
export interface UseStrandsAuthReturn {
|
|
4
|
+
user: ComputedRef<User | null>;
|
|
5
|
+
currentUser: ComputedRef<User | null>;
|
|
6
|
+
currentSession: ComputedRef<Session | null>;
|
|
7
|
+
isAuthenticated: ComputedRef<boolean>;
|
|
8
|
+
isLoading: ComputedRef<boolean>;
|
|
9
|
+
loading: ComputedRef<boolean>;
|
|
10
|
+
loadingMessage: ComputedRef<string>;
|
|
11
|
+
isInitializing: ComputedRef<boolean>;
|
|
12
|
+
isInitialized: ComputedRef<boolean>;
|
|
13
|
+
isSigningIn: ComputedRef<boolean>;
|
|
14
|
+
isSigningUp: ComputedRef<boolean>;
|
|
15
|
+
isSigningOut: ComputedRef<boolean>;
|
|
16
|
+
isRefreshingToken: ComputedRef<boolean>;
|
|
17
|
+
isSendingMfaEmail: ComputedRef<boolean>;
|
|
18
|
+
isVerifyingMfa: ComputedRef<boolean>;
|
|
19
|
+
mfaRequired: ComputedRef<boolean>;
|
|
20
|
+
mfaSessionId: ComputedRef<string | null>;
|
|
21
|
+
availableMfaMethods: ComputedRef<MfaDevice[]>;
|
|
22
|
+
signIn: (credentials: SignInCredentials) => Promise<any>;
|
|
23
|
+
signUp: (userData: SignUpData) => Promise<void>;
|
|
24
|
+
signOut: () => Promise<void>;
|
|
25
|
+
refreshToken: () => Promise<boolean>;
|
|
26
|
+
fetchProfile: () => Promise<User>;
|
|
27
|
+
updateProfile: (updates: Partial<User>) => Promise<User>;
|
|
28
|
+
updateUserSettings: (settings: any) => Promise<User>;
|
|
29
|
+
changeEmail: (newEmail: string, password: string) => Promise<void>;
|
|
30
|
+
changeUsername: (newUsername: string) => Promise<void>;
|
|
31
|
+
getUsernameCooldown: () => Promise<{
|
|
32
|
+
canChange: boolean;
|
|
33
|
+
cooldownEndsAt?: Date;
|
|
34
|
+
}>;
|
|
35
|
+
checkUsernameAvailability: (username: string) => Promise<{
|
|
36
|
+
available: boolean;
|
|
37
|
+
suggestion?: string;
|
|
38
|
+
}>;
|
|
39
|
+
getUserSessions: () => Promise<SessionInfo[]>;
|
|
40
|
+
getSessionStats: () => Promise<SessionStats>;
|
|
41
|
+
revokeSession: (sessionId: string) => Promise<boolean>;
|
|
42
|
+
revokeAllOtherSessions: () => Promise<boolean>;
|
|
43
|
+
initialize: () => Promise<void>;
|
|
44
|
+
forceReInit: () => void;
|
|
45
|
+
setAuthData: (authData: any) => Promise<void>;
|
|
46
|
+
verifyMfa: (code: string, method?: string) => Promise<any>;
|
|
47
|
+
sendMfaEmailCode: (deviceId: string) => Promise<any>;
|
|
48
|
+
getMfaWebAuthnChallenge: (deviceId: string) => Promise<any>;
|
|
49
|
+
registerHardwareKey: (deviceName: string, accessToken: string, deviceType?: 'hardware' | 'passkey') => Promise<any>;
|
|
50
|
+
completeHardwareKeyRegistration: (deviceId: string, credential: any, accessToken: string) => Promise<any>;
|
|
51
|
+
startTokenRefreshTimer: () => void;
|
|
52
|
+
stopTokenRefreshTimer: () => void;
|
|
53
|
+
getAuthHeaders: () => Record<string, string>;
|
|
54
|
+
}
|
|
55
|
+
export interface UseStrandsConfigReturn {
|
|
56
|
+
config: ComputedRef<StrandsAuthConfig>;
|
|
57
|
+
endpoints: ComputedRef<StrandsAuthEndpoints>;
|
|
58
|
+
getUrl: (endpoint: keyof StrandsAuthEndpoints | string) => string;
|
|
59
|
+
getSupportEmail: () => string | null;
|
|
60
|
+
}
|
|
61
|
+
export interface UseAuthenticatedFetchReturn {
|
|
62
|
+
$fetch: <T = any>(url: string, options?: AuthenticatedFetchOptions) => Promise<T>;
|
|
63
|
+
isLoading: Ref<boolean>;
|
|
64
|
+
error: Ref<Error | null>;
|
|
65
|
+
}
|
|
66
|
+
export interface UseOAuthProvidersReturn {
|
|
67
|
+
providers: ComputedRef<any[]>;
|
|
68
|
+
loading: Ref<boolean>;
|
|
69
|
+
fetchProviders: () => Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
export interface UseThemeReturn {
|
|
72
|
+
isDark: Ref<boolean>;
|
|
73
|
+
toggleTheme: () => void;
|
|
74
|
+
setTheme: (dark: boolean) => void;
|
|
75
|
+
}
|
|
76
|
+
export interface UseFloatingPositionReturn {
|
|
77
|
+
x: Ref<number>;
|
|
78
|
+
y: Ref<number>;
|
|
79
|
+
placement: Ref<string>;
|
|
80
|
+
update: () => void;
|
|
81
|
+
}
|
|
82
|
+
export interface UseModalStackReturn {
|
|
83
|
+
modalStack: Ref<string[]>;
|
|
84
|
+
pushModal: (id: string) => void;
|
|
85
|
+
popModal: () => void;
|
|
86
|
+
isTopModal: (id: string) => boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface UseModalTeleportReturn {
|
|
89
|
+
teleportTarget: Ref<string>;
|
|
90
|
+
updateTeleportTarget: () => void;
|
|
91
|
+
}
|
|
92
|
+
export interface UseGlobalModalStackReturn {
|
|
93
|
+
globalModalStack: Ref<string[]>;
|
|
94
|
+
addModal: (id: string) => void;
|
|
95
|
+
removeModal: (id: string) => void;
|
|
96
|
+
isTopModal: (id: string) => boolean;
|
|
97
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
export interface User {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
avatar?: string;
|
|
7
|
+
mfaEnabled: boolean;
|
|
8
|
+
emailVerified: boolean;
|
|
9
|
+
passwordUpdatedAt?: string | Date;
|
|
10
|
+
settings?: any;
|
|
11
|
+
xp: number;
|
|
12
|
+
level: number;
|
|
13
|
+
next_level_xp: number;
|
|
14
|
+
username?: string;
|
|
15
|
+
usernameLastChangedAt?: string | Date;
|
|
16
|
+
createdAt: string | Date;
|
|
17
|
+
updatedAt: string | Date;
|
|
18
|
+
}
|
|
19
|
+
export interface AuthenticatedFetchOptions extends RequestInit {
|
|
20
|
+
/**
|
|
21
|
+
* Whether to automatically refresh token if the request fails with 401
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
autoRefresh?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to throw an error if user is not authenticated
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
requireAuth?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Base URL for the API requests
|
|
32
|
+
* If not provided, will use the current origin
|
|
33
|
+
*/
|
|
34
|
+
baseURL?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface Session {
|
|
37
|
+
id?: string;
|
|
38
|
+
userId?: string;
|
|
39
|
+
accessToken: string;
|
|
40
|
+
refreshToken: string;
|
|
41
|
+
expiresAt: Date;
|
|
42
|
+
createdAt?: Date;
|
|
43
|
+
}
|
|
44
|
+
export interface SessionInfo {
|
|
45
|
+
id: string;
|
|
46
|
+
device_name?: string;
|
|
47
|
+
device_type?: string;
|
|
48
|
+
ip_address?: string;
|
|
49
|
+
country?: string;
|
|
50
|
+
city?: string;
|
|
51
|
+
application_domain?: string;
|
|
52
|
+
application_name?: string;
|
|
53
|
+
created_at: string | Date;
|
|
54
|
+
last_activity_at?: string | Date;
|
|
55
|
+
is_current: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface SessionStats {
|
|
58
|
+
total_sessions: number;
|
|
59
|
+
active_sessions: number;
|
|
60
|
+
devices_by_type: Record<string, number>;
|
|
61
|
+
unique_locations: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface AuthConfig {
|
|
64
|
+
apiUrl: string;
|
|
65
|
+
applicationId: string;
|
|
66
|
+
publicKey: string;
|
|
67
|
+
autoRefresh?: boolean;
|
|
68
|
+
redirectUrl?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface SignInCredentials {
|
|
71
|
+
email: string;
|
|
72
|
+
password: string;
|
|
73
|
+
}
|
|
74
|
+
export interface SignUpData {
|
|
75
|
+
email: string;
|
|
76
|
+
password: string;
|
|
77
|
+
firstName: string;
|
|
78
|
+
lastName: string;
|
|
79
|
+
}
|
|
80
|
+
export interface OAuthProvider {
|
|
81
|
+
id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
clientId?: string;
|
|
85
|
+
scopes?: string[];
|
|
86
|
+
}
|
|
87
|
+
export interface StrandsAuthConfig {
|
|
88
|
+
/**
|
|
89
|
+
* Base URL for the Strands Auth API
|
|
90
|
+
* @default 'https://your-api.example.com'
|
|
91
|
+
*/
|
|
92
|
+
baseUrl?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Client ID for authentication (optional - authentication is now based on domain)
|
|
95
|
+
*/
|
|
96
|
+
clientId?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Primary accent color for the auth components
|
|
99
|
+
* @default '#EA00A8'
|
|
100
|
+
*/
|
|
101
|
+
accentColor?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Default redirect URL after successful authentication
|
|
104
|
+
* @default '/'
|
|
105
|
+
*/
|
|
106
|
+
redirectUrl?: string;
|
|
107
|
+
/**
|
|
108
|
+
* URL to redirect to after successful sign in
|
|
109
|
+
* @default '/dashboard'
|
|
110
|
+
*/
|
|
111
|
+
onSignInUrl?: string;
|
|
112
|
+
/**
|
|
113
|
+
* URL to redirect to after successful sign out
|
|
114
|
+
* @default '/'
|
|
115
|
+
*/
|
|
116
|
+
onSignOutUrl?: string;
|
|
117
|
+
/**
|
|
118
|
+
* URL of the authentication/login page (where unauthenticated users are redirected)
|
|
119
|
+
* @default '/auth'
|
|
120
|
+
*/
|
|
121
|
+
authUrl?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Enable automatic token refresh
|
|
124
|
+
* @default true
|
|
125
|
+
*/
|
|
126
|
+
autoRefresh?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Token refresh interval in minutes
|
|
129
|
+
* @default 4
|
|
130
|
+
*/
|
|
131
|
+
refreshInterval?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Pages that should redirect to sign in if user is not authenticated
|
|
134
|
+
* @default []
|
|
135
|
+
*/
|
|
136
|
+
protectedRoutes?: string[];
|
|
137
|
+
/**
|
|
138
|
+
* Pages that should redirect away if user IS authenticated
|
|
139
|
+
* @default ['/auth', '/login', '/register']
|
|
140
|
+
*/
|
|
141
|
+
guestOnlyRoutes?: string[];
|
|
142
|
+
/**
|
|
143
|
+
* Enable development mode (shows debug info)
|
|
144
|
+
* @default false
|
|
145
|
+
*/
|
|
146
|
+
devMode?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Support email address for contact links
|
|
149
|
+
* @optional
|
|
150
|
+
*/
|
|
151
|
+
supportEmail?: string;
|
|
152
|
+
/**
|
|
153
|
+
* OAuth2 redirect URL for OAuth providers
|
|
154
|
+
* If not specified, will use {origin}/auth/callback
|
|
155
|
+
* @optional
|
|
156
|
+
*/
|
|
157
|
+
oauth2RedirectUrl?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Automatically import CSS styles
|
|
160
|
+
* Set to false if you want to manually import styles or use custom styling
|
|
161
|
+
* @default true
|
|
162
|
+
*/
|
|
163
|
+
styles?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Custom API endpoints
|
|
166
|
+
*/
|
|
167
|
+
endpoints?: Partial<StrandsAuthEndpoints>;
|
|
168
|
+
/**
|
|
169
|
+
* Enable squircle corners for UI components
|
|
170
|
+
* @default true
|
|
171
|
+
*/
|
|
172
|
+
useSquircle?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Theme mode for the UI components
|
|
175
|
+
* - 'light': Force light mode
|
|
176
|
+
* - 'dark': Force dark mode
|
|
177
|
+
* - 'system': Follow system preference (default)
|
|
178
|
+
* @default 'system'
|
|
179
|
+
*/
|
|
180
|
+
theme?: 'light' | 'dark' | 'system';
|
|
181
|
+
}
|
|
182
|
+
export interface StrandsAuthEndpoints {
|
|
183
|
+
signIn: string;
|
|
184
|
+
signUp: string;
|
|
185
|
+
signOut: string;
|
|
186
|
+
refresh: string;
|
|
187
|
+
authStatus: string;
|
|
188
|
+
passwordReset: string;
|
|
189
|
+
passwordResetConfirm: string;
|
|
190
|
+
completeRegistration: string;
|
|
191
|
+
profile: string;
|
|
192
|
+
verifyEmail: string;
|
|
193
|
+
oauthProviders: string;
|
|
194
|
+
oauthProvider: string;
|
|
195
|
+
changeEmail: string;
|
|
196
|
+
avatar: string;
|
|
197
|
+
settings: string;
|
|
198
|
+
changeUsername: string;
|
|
199
|
+
usernameCooldown: string;
|
|
200
|
+
checkUsernameAvailability: string;
|
|
201
|
+
mfaDevices: string;
|
|
202
|
+
mfaTotpSetup: string;
|
|
203
|
+
mfaTotpVerify: string;
|
|
204
|
+
mfaEmailSetup: string;
|
|
205
|
+
mfaEmailSend: string;
|
|
206
|
+
mfaEmailVerify: string;
|
|
207
|
+
mfaDeviceDisable: string;
|
|
208
|
+
mfaBackupCodes: string;
|
|
209
|
+
mfaHardwareStartRegistration: string;
|
|
210
|
+
mfaHardwareCompleteRegistration: string;
|
|
211
|
+
mfaSigninSendEmail: string;
|
|
212
|
+
mfaSigninVerify: string;
|
|
213
|
+
mfaBackupCodeVerify: string;
|
|
214
|
+
mfaWebAuthnChallenge: string;
|
|
215
|
+
sessions: string;
|
|
216
|
+
sessionsStats: string;
|
|
217
|
+
sessionRevoke: string;
|
|
218
|
+
sessionsRevokeAll: string;
|
|
219
|
+
}
|
|
220
|
+
export interface AuthResponse {
|
|
221
|
+
access_token: string;
|
|
222
|
+
refresh_token: string;
|
|
223
|
+
user: User;
|
|
224
|
+
mfa_required?: boolean;
|
|
225
|
+
mfa_session_id?: string;
|
|
226
|
+
available_mfa_methods?: MfaDevice[];
|
|
227
|
+
}
|
|
228
|
+
export interface AuthStatusResponse {
|
|
229
|
+
authenticated: boolean;
|
|
230
|
+
user: User | null;
|
|
231
|
+
/** Unix timestamp (seconds) when the access token expires */
|
|
232
|
+
expires_at?: number;
|
|
233
|
+
}
|
|
234
|
+
export type MfaDeviceType = 'totp' | 'email' | 'hardware' | 'passkey';
|
|
235
|
+
export interface MfaDevice {
|
|
236
|
+
id: string;
|
|
237
|
+
device_type: MfaDeviceType;
|
|
238
|
+
device_name: string;
|
|
239
|
+
is_active: boolean;
|
|
240
|
+
last_used_at?: string | Date;
|
|
241
|
+
created_at: string | Date;
|
|
242
|
+
}
|
|
243
|
+
export interface MfaDevicesResponse {
|
|
244
|
+
devices: MfaDevice[];
|
|
245
|
+
mfa_enabled: boolean;
|
|
246
|
+
}
|
|
247
|
+
export interface TotpSetupResponse {
|
|
248
|
+
device_id: string;
|
|
249
|
+
secret: string;
|
|
250
|
+
qr_code_url: string;
|
|
251
|
+
backup_codes: string[];
|
|
252
|
+
}
|
|
253
|
+
export interface BackupCodesResponse {
|
|
254
|
+
backup_codes: string[];
|
|
255
|
+
}
|
|
256
|
+
export interface MfaErrorResponse {
|
|
257
|
+
code: string;
|
|
258
|
+
message: string;
|
|
259
|
+
mfa_session_id?: string;
|
|
260
|
+
available_methods?: string[];
|
|
261
|
+
}
|
|
262
|
+
export type * from './composables';
|
|
263
|
+
export * from './oauth';
|