@strands.gg/accui 2.6.8 → 2.6.9
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/package.json +11 -11
- package/dist/accui.css +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/nuxt/module.cjs.js +0 -1
- package/dist/nuxt/module.d.ts +0 -1
- package/dist/nuxt/module.es.js +0 -193
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.cjs.js +0 -1
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.d.ts +0 -1
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.es.js +0 -134
- package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +0 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +0 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +0 -56
- package/dist/nuxt/runtime/middleware/auth.global.cjs.js +0 -1
- package/dist/nuxt/runtime/middleware/auth.global.d.ts +0 -1
- package/dist/nuxt/runtime/middleware/auth.global.es.js +0 -54
- package/dist/nuxt/runtime/plugin.client.cjs.js +0 -1
- package/dist/nuxt/runtime/plugin.client.d.ts +0 -1
- package/dist/nuxt/runtime/plugin.client.es.js +0 -26
- package/dist/nuxt/runtime/plugin.server.cjs.js +0 -1
- package/dist/nuxt/runtime/plugin.server.d.ts +0 -1
- package/dist/nuxt/runtime/plugin.server.es.js +0 -17
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.cjs.js +0 -1
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.d.ts +0 -1
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.es.js +0 -77
- package/dist/nuxt.cjs.js +0 -1
- package/dist/nuxt.d.ts +0 -1
- package/dist/nuxt.es.js +0 -11
- package/dist/strands-auth-ui.cjs.js +0 -1
- package/dist/strands-auth-ui.es.js +0 -40821
- package/dist/useStrandsAuth-BqNW7g0R.cjs.js +0 -1
- package/dist/useStrandsAuth-GX6lPddh.es.js +0 -913
- package/dist/useStrandsConfig-BUmt8HfH.cjs.js +0 -1
- package/dist/useStrandsConfig-f200kXFG.es.js +0 -238
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),i={baseUrl:"https://your-api.example.com",accentColor:"#EA00A8",redirectUrl:"/",onSignInUrl:"/dashboard",onSignOutUrl:"/",autoRefresh:1,refreshInterval:4,protectedRoutes:[],guestOnlyRoutes:["/auth","/login","/register"],devMode:0,styles:1,endpoints:{},useSquircle:1},a=Symbol("strands-config"),s=e.ref(null);function t(e){if("undefined"==typeof window||!document.documentElement)return;if("undefined"!=typeof CSS&&CSS.registerProperty)try{CSS.registerProperty({name:"--strands-accent",syntax:"<color>",inherits:1,initialValue:e})}catch(a){}document.documentElement.style.setProperty("--strands-accent",e),document.documentElement.style.setProperty("--accui-strands-accent",e);const i={"--accui-strands-50":`color-mix(in srgb, ${e} 10%, white)`,"--accui-strands-100":`color-mix(in srgb, ${e} 20%, white)`,"--accui-strands-200":`color-mix(in srgb, ${e} 30%, white)`,"--accui-strands-300":`color-mix(in srgb, ${e} 40%, white)`,"--accui-strands-400":`color-mix(in srgb, ${e} 70%, white)`,"--accui-strands-500":e,"--accui-strands-600":`color-mix(in srgb, ${e} 85%, black)`,"--accui-strands-700":`color-mix(in srgb, ${e} 70%, black)`,"--accui-strands-800":`color-mix(in srgb, ${e} 55%, black)`,"--accui-strands-900":`color-mix(in srgb, ${e} 40%, black)`,"--accui-strands-950":`color-mix(in srgb, ${e} 25%, black)`};for(const[s,t]of Object.entries(i))document.documentElement.style.setProperty(s,t)}exports.STRANDS_AUTH_DEFAULTS=i,exports.provideStrandsConfig=function(i){if(s.value=i,"undefined"!=typeof window&&document.documentElement){const e=void 0!==i.useSquircle?i.useSquircle:1;document.documentElement.style.setProperty("--strands-allow-squircle",e?"1":"0"),i.accentColor&&t(i.accentColor)}try{e.provide(a,i)}catch(n){}},exports.setStrandsConfig=function(e){if(s.value=e,"undefined"!=typeof window&&document.documentElement){const i=void 0!==e.useSquircle?e.useSquircle:1;document.documentElement.style.setProperty("--strands-allow-squircle",i?"1":"0"),e.accentColor&&t(e.accentColor)}},exports.useStrandsConfig=function(t){let n=null;try{n=e.inject(a,null)}catch(u){n=null}let r=null;try{if("undefined"!=typeof window)if(window.__STRANDS_CONFIG__)r=window.__STRANDS_CONFIG__;else if(window.__NUXT__){const e=window.__NUXT__;r=e?.config?.public?.strandsAuth||e?.public?.strandsAuth||e?.strandsAuth}}catch(u){}const o=e.computed(()=>{const e={...i,...t||{},...n||{},...s.value||{},...r||{}};if(e.baseUrl,"undefined"!=typeof window&&document.documentElement){const i=void 0!==e.useSquircle?e.useSquircle:1;document.documentElement.style.setProperty("--strands-allow-squircle",i?"1":"0"),e.accentColor&&document.documentElement.style.setProperty("--strands-accent",e.accentColor)}return e}),c=e.computed(()=>{const e=o.value.endpoints||{};return{signIn:e.signIn||"/api/v1/auth/sign-in",signUp:e.signUp||"/api/v1/auth/sign-up",signOut:e.signOut||"/api/v1/auth/sign-out",refresh:e.refresh||"/api/v1/auth/refresh",passwordReset:e.passwordReset||"/api/v1/auth/password-reset",passwordResetConfirm:e.passwordResetConfirm||"/api/v1/auth/password-reset/confirm",completeRegistration:e.completeRegistration||"/api/v1/auth/complete-registration",profile:e.profile||"/api/v1/user/profile",verifyEmail:e.verifyEmail||"/api/v1/auth/verify-email",oauthProviders:e.oauthProviders||"/api/v1/oauth/providers",oauthProvider:e.oauthProvider||"/api/v1/oauth/providers/{provider_id}",changeEmail:e.changeEmail||"/api/v1/user/change-email",avatar:e.avatar||"/api/v1/user/avatar",settings:e.settings||"/api/v1/user/settings",changeUsername:e.changeUsername||"/api/v1/user/username",usernameCooldown:e.usernameCooldown||"/api/v1/user/username/cooldown",checkUsernameAvailability:e.checkUsernameAvailability||"/api/v1/username/{username}/available",mfaDevices:e.mfaDevices||"/api/v1/mfa/devices",mfaTotpSetup:e.mfaTotpSetup||"/api/v1/mfa/totp/setup",mfaTotpVerify:e.mfaTotpVerify||"/api/v1/mfa/totp/verify",mfaEmailSetup:e.mfaEmailSetup||"/api/v1/mfa/email/setup",mfaEmailSend:e.mfaEmailSend||"/api/v1/mfa/email/send",mfaEmailVerify:e.mfaEmailVerify||"/api/v1/mfa/email/verify",mfaDeviceDisable:e.mfaDeviceDisable||"/api/v1/mfa/device/disable",mfaBackupCodes:e.mfaBackupCodes||"/api/v1/mfa/backup-codes/regenerate",mfaHardwareStartRegistration:e.mfaHardwareStartRegistration||"/api/v1/mfa/hardware/start-registration",mfaHardwareCompleteRegistration:e.mfaHardwareCompleteRegistration||"/api/v1/mfa/hardware/complete-registration",mfaSigninSendEmail:e.mfaSigninSendEmail||"/api/v1/auth/mfa/email/send",mfaSigninVerify:e.mfaSigninVerify||"/api/v1/auth/mfa/verify",mfaBackupCodeVerify:e.mfaBackupCodeVerify||"/api/v1/auth/mfa/backup-code/verify",mfaWebAuthnChallenge:e.mfaWebAuthnChallenge||"/api/v1/auth/mfa/webauthn/challenge",sessions:e.sessions||"/api/v1/sessions",sessionsStats:e.sessionsStats||"/api/v1/sessions/stats",sessionRevoke:e.sessionRevoke||"/api/v1/sessions/{session_id}/revoke",sessionsRevokeAll:e.sessionsRevokeAll||"/api/v1/sessions/revoke-all"}});return{config:o,endpoints:c,getUrl:e=>{const i=o.value;if(!i.baseUrl)throw new Error("Base URL is required in configuration");let a;return a="string"==typeof e&&e in c.value?c.value[e]:"string"==typeof e?e:c.value[e],`${i.baseUrl.replace(/\/$/,"")}${a.startsWith("/")?a:`/${a}`}`},getSupportEmail:()=>o.value.supportEmail||null}};
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { ref, inject, computed, provide } from "vue";
|
|
2
|
-
const STRANDS_AUTH_DEFAULTS = {
|
|
3
|
-
baseUrl: "https://your-api.example.com",
|
|
4
|
-
accentColor: "#EA00A8",
|
|
5
|
-
redirectUrl: "/",
|
|
6
|
-
onSignInUrl: "/dashboard",
|
|
7
|
-
onSignOutUrl: "/",
|
|
8
|
-
autoRefresh: true,
|
|
9
|
-
refreshInterval: 4,
|
|
10
|
-
protectedRoutes: [],
|
|
11
|
-
guestOnlyRoutes: ["/auth", "/login", "/register"],
|
|
12
|
-
devMode: false,
|
|
13
|
-
styles: true,
|
|
14
|
-
endpoints: {},
|
|
15
|
-
useSquircle: true
|
|
16
|
-
};
|
|
17
|
-
const DEFAULT_ENDPOINTS = {
|
|
18
|
-
signIn: "/api/v1/auth/sign-in",
|
|
19
|
-
signUp: "/api/v1/auth/sign-up",
|
|
20
|
-
signOut: "/api/v1/auth/sign-out",
|
|
21
|
-
refresh: "/api/v1/auth/refresh",
|
|
22
|
-
passwordReset: "/api/v1/auth/password-reset",
|
|
23
|
-
passwordResetConfirm: "/api/v1/auth/password-reset/confirm",
|
|
24
|
-
completeRegistration: "/api/v1/auth/complete-registration",
|
|
25
|
-
profile: "/api/v1/user/profile",
|
|
26
|
-
verifyEmail: "/api/v1/auth/verify-email",
|
|
27
|
-
oauthProviders: "/api/v1/oauth/providers",
|
|
28
|
-
oauthProvider: "/api/v1/oauth/providers/{provider_id}",
|
|
29
|
-
changeEmail: "/api/v1/user/change-email",
|
|
30
|
-
avatar: "/api/v1/user/avatar",
|
|
31
|
-
settings: "/api/v1/user/settings",
|
|
32
|
-
// Username endpoints
|
|
33
|
-
changeUsername: "/api/v1/user/username",
|
|
34
|
-
usernameCooldown: "/api/v1/user/username/cooldown",
|
|
35
|
-
checkUsernameAvailability: "/api/v1/username/{username}/available",
|
|
36
|
-
// MFA endpoints
|
|
37
|
-
mfaDevices: "/api/v1/mfa/devices",
|
|
38
|
-
mfaTotpSetup: "/api/v1/mfa/totp/setup",
|
|
39
|
-
mfaTotpVerify: "/api/v1/mfa/totp/verify",
|
|
40
|
-
mfaEmailSetup: "/api/v1/mfa/email/setup",
|
|
41
|
-
mfaEmailSend: "/api/v1/mfa/email/send",
|
|
42
|
-
mfaEmailVerify: "/api/v1/mfa/email/verify",
|
|
43
|
-
mfaDeviceDisable: "/api/v1/mfa/device/disable",
|
|
44
|
-
mfaBackupCodes: "/api/v1/mfa/backup-codes/regenerate",
|
|
45
|
-
// Hardware key endpoints
|
|
46
|
-
mfaHardwareStartRegistration: "/api/v1/mfa/hardware/start-registration",
|
|
47
|
-
mfaHardwareCompleteRegistration: "/api/v1/mfa/hardware/complete-registration",
|
|
48
|
-
// MFA sign-in specific endpoints
|
|
49
|
-
mfaSigninSendEmail: "/api/v1/auth/mfa/email/send",
|
|
50
|
-
mfaSigninVerify: "/api/v1/auth/mfa/verify",
|
|
51
|
-
mfaBackupCodeVerify: "/api/v1/auth/mfa/backup-code/verify",
|
|
52
|
-
mfaWebAuthnChallenge: "/api/v1/auth/mfa/webauthn/challenge",
|
|
53
|
-
// Session management endpoints
|
|
54
|
-
sessions: "/api/v1/sessions",
|
|
55
|
-
sessionsStats: "/api/v1/sessions/stats",
|
|
56
|
-
sessionRevoke: "/api/v1/sessions/{session_id}/revoke",
|
|
57
|
-
sessionsRevokeAll: "/api/v1/sessions/revoke-all"
|
|
58
|
-
};
|
|
59
|
-
const STRANDS_CONFIG_KEY = Symbol("strands-config");
|
|
60
|
-
const globalConfig = ref(null);
|
|
61
|
-
function generateColorShades(accentColor) {
|
|
62
|
-
if (typeof window === "undefined" || !document.documentElement) return;
|
|
63
|
-
if (typeof CSS !== "undefined" && CSS.registerProperty) {
|
|
64
|
-
try {
|
|
65
|
-
CSS.registerProperty({
|
|
66
|
-
name: "--strands-accent",
|
|
67
|
-
syntax: "<color>",
|
|
68
|
-
inherits: true,
|
|
69
|
-
initialValue: accentColor
|
|
70
|
-
});
|
|
71
|
-
} catch (e) {
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
document.documentElement.style.setProperty("--strands-accent", accentColor);
|
|
75
|
-
document.documentElement.style.setProperty("--accui-strands-accent", accentColor);
|
|
76
|
-
const shades = {
|
|
77
|
-
"--accui-strands-50": `color-mix(in srgb, ${accentColor} 10%, white)`,
|
|
78
|
-
"--accui-strands-100": `color-mix(in srgb, ${accentColor} 20%, white)`,
|
|
79
|
-
"--accui-strands-200": `color-mix(in srgb, ${accentColor} 30%, white)`,
|
|
80
|
-
"--accui-strands-300": `color-mix(in srgb, ${accentColor} 40%, white)`,
|
|
81
|
-
"--accui-strands-400": `color-mix(in srgb, ${accentColor} 70%, white)`,
|
|
82
|
-
"--accui-strands-500": accentColor,
|
|
83
|
-
"--accui-strands-600": `color-mix(in srgb, ${accentColor} 85%, black)`,
|
|
84
|
-
"--accui-strands-700": `color-mix(in srgb, ${accentColor} 70%, black)`,
|
|
85
|
-
"--accui-strands-800": `color-mix(in srgb, ${accentColor} 55%, black)`,
|
|
86
|
-
"--accui-strands-900": `color-mix(in srgb, ${accentColor} 40%, black)`,
|
|
87
|
-
"--accui-strands-950": `color-mix(in srgb, ${accentColor} 25%, black)`
|
|
88
|
-
};
|
|
89
|
-
for (const [property, value] of Object.entries(shades)) {
|
|
90
|
-
document.documentElement.style.setProperty(property, value);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function provideStrandsConfig(config) {
|
|
94
|
-
globalConfig.value = config;
|
|
95
|
-
if (typeof window !== "undefined" && document.documentElement) {
|
|
96
|
-
const useSquircle = config.useSquircle !== void 0 ? config.useSquircle : true;
|
|
97
|
-
document.documentElement.style.setProperty("--strands-allow-squircle", useSquircle ? "1" : "0");
|
|
98
|
-
if (config.accentColor) {
|
|
99
|
-
generateColorShades(config.accentColor);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
try {
|
|
103
|
-
provide(STRANDS_CONFIG_KEY, config);
|
|
104
|
-
} catch (error) {
|
|
105
|
-
console.warn("[Strands Auth] Could not provide config via Vue provide/inject. Config available via global state only.", error);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function useStrandsConfig(fallbackConfig) {
|
|
109
|
-
let injectedConfig = null;
|
|
110
|
-
try {
|
|
111
|
-
injectedConfig = inject(STRANDS_CONFIG_KEY, null);
|
|
112
|
-
} catch (error) {
|
|
113
|
-
injectedConfig = null;
|
|
114
|
-
}
|
|
115
|
-
let nuxtConfig = null;
|
|
116
|
-
try {
|
|
117
|
-
if (typeof window !== "undefined") {
|
|
118
|
-
if (window.__STRANDS_CONFIG__) {
|
|
119
|
-
nuxtConfig = window.__STRANDS_CONFIG__;
|
|
120
|
-
} else if (window.__NUXT__) {
|
|
121
|
-
const nuxtData = window.__NUXT__;
|
|
122
|
-
nuxtConfig = nuxtData?.config?.public?.strandsAuth || nuxtData?.public?.strandsAuth || nuxtData?.strandsAuth;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
} catch (error) {
|
|
126
|
-
console.error("[Strands Auth] Error accessing runtime configuration:", error);
|
|
127
|
-
}
|
|
128
|
-
const activeConfig = computed(() => {
|
|
129
|
-
const config = {
|
|
130
|
-
...STRANDS_AUTH_DEFAULTS,
|
|
131
|
-
...fallbackConfig || {},
|
|
132
|
-
...injectedConfig || {},
|
|
133
|
-
...globalConfig.value || {},
|
|
134
|
-
...nuxtConfig || {}
|
|
135
|
-
};
|
|
136
|
-
if (config.baseUrl === STRANDS_AUTH_DEFAULTS.baseUrl && typeof window === "undefined") {
|
|
137
|
-
console.warn("[Strands Auth] No baseUrl configured for SSR. Please provide a baseUrl in your strandsAuth configuration.");
|
|
138
|
-
}
|
|
139
|
-
if (typeof window !== "undefined" && document.documentElement) {
|
|
140
|
-
const useSquircle = config.useSquircle !== void 0 ? config.useSquircle : true;
|
|
141
|
-
document.documentElement.style.setProperty("--strands-allow-squircle", useSquircle ? "1" : "0");
|
|
142
|
-
if (config.accentColor) {
|
|
143
|
-
document.documentElement.style.setProperty("--strands-accent", config.accentColor);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return config;
|
|
147
|
-
});
|
|
148
|
-
const endpoints = computed(() => {
|
|
149
|
-
const config = activeConfig.value;
|
|
150
|
-
const customEndpoints = config.endpoints || {};
|
|
151
|
-
return {
|
|
152
|
-
signIn: customEndpoints.signIn || DEFAULT_ENDPOINTS.signIn,
|
|
153
|
-
signUp: customEndpoints.signUp || DEFAULT_ENDPOINTS.signUp,
|
|
154
|
-
signOut: customEndpoints.signOut || DEFAULT_ENDPOINTS.signOut,
|
|
155
|
-
refresh: customEndpoints.refresh || DEFAULT_ENDPOINTS.refresh,
|
|
156
|
-
passwordReset: customEndpoints.passwordReset || DEFAULT_ENDPOINTS.passwordReset,
|
|
157
|
-
passwordResetConfirm: customEndpoints.passwordResetConfirm || DEFAULT_ENDPOINTS.passwordResetConfirm,
|
|
158
|
-
completeRegistration: customEndpoints.completeRegistration || DEFAULT_ENDPOINTS.completeRegistration,
|
|
159
|
-
profile: customEndpoints.profile || DEFAULT_ENDPOINTS.profile,
|
|
160
|
-
verifyEmail: customEndpoints.verifyEmail || DEFAULT_ENDPOINTS.verifyEmail,
|
|
161
|
-
oauthProviders: customEndpoints.oauthProviders || DEFAULT_ENDPOINTS.oauthProviders,
|
|
162
|
-
oauthProvider: customEndpoints.oauthProvider || DEFAULT_ENDPOINTS.oauthProvider,
|
|
163
|
-
changeEmail: customEndpoints.changeEmail || DEFAULT_ENDPOINTS.changeEmail,
|
|
164
|
-
avatar: customEndpoints.avatar || DEFAULT_ENDPOINTS.avatar,
|
|
165
|
-
settings: customEndpoints.settings || DEFAULT_ENDPOINTS.settings,
|
|
166
|
-
// Username endpoints
|
|
167
|
-
changeUsername: customEndpoints.changeUsername || DEFAULT_ENDPOINTS.changeUsername,
|
|
168
|
-
usernameCooldown: customEndpoints.usernameCooldown || DEFAULT_ENDPOINTS.usernameCooldown,
|
|
169
|
-
checkUsernameAvailability: customEndpoints.checkUsernameAvailability || DEFAULT_ENDPOINTS.checkUsernameAvailability,
|
|
170
|
-
// MFA endpoints
|
|
171
|
-
mfaDevices: customEndpoints.mfaDevices || DEFAULT_ENDPOINTS.mfaDevices,
|
|
172
|
-
mfaTotpSetup: customEndpoints.mfaTotpSetup || DEFAULT_ENDPOINTS.mfaTotpSetup,
|
|
173
|
-
mfaTotpVerify: customEndpoints.mfaTotpVerify || DEFAULT_ENDPOINTS.mfaTotpVerify,
|
|
174
|
-
mfaEmailSetup: customEndpoints.mfaEmailSetup || DEFAULT_ENDPOINTS.mfaEmailSetup,
|
|
175
|
-
mfaEmailSend: customEndpoints.mfaEmailSend || DEFAULT_ENDPOINTS.mfaEmailSend,
|
|
176
|
-
mfaEmailVerify: customEndpoints.mfaEmailVerify || DEFAULT_ENDPOINTS.mfaEmailVerify,
|
|
177
|
-
mfaDeviceDisable: customEndpoints.mfaDeviceDisable || DEFAULT_ENDPOINTS.mfaDeviceDisable,
|
|
178
|
-
mfaBackupCodes: customEndpoints.mfaBackupCodes || DEFAULT_ENDPOINTS.mfaBackupCodes,
|
|
179
|
-
// Hardware key endpoints
|
|
180
|
-
mfaHardwareStartRegistration: customEndpoints.mfaHardwareStartRegistration || DEFAULT_ENDPOINTS.mfaHardwareStartRegistration,
|
|
181
|
-
mfaHardwareCompleteRegistration: customEndpoints.mfaHardwareCompleteRegistration || DEFAULT_ENDPOINTS.mfaHardwareCompleteRegistration,
|
|
182
|
-
// MFA sign-in specific endpoints
|
|
183
|
-
mfaSigninSendEmail: customEndpoints.mfaSigninSendEmail || DEFAULT_ENDPOINTS.mfaSigninSendEmail,
|
|
184
|
-
mfaSigninVerify: customEndpoints.mfaSigninVerify || DEFAULT_ENDPOINTS.mfaSigninVerify,
|
|
185
|
-
mfaBackupCodeVerify: customEndpoints.mfaBackupCodeVerify || DEFAULT_ENDPOINTS.mfaBackupCodeVerify,
|
|
186
|
-
mfaWebAuthnChallenge: customEndpoints.mfaWebAuthnChallenge || DEFAULT_ENDPOINTS.mfaWebAuthnChallenge,
|
|
187
|
-
// Session management endpoints
|
|
188
|
-
sessions: customEndpoints.sessions || DEFAULT_ENDPOINTS.sessions,
|
|
189
|
-
sessionsStats: customEndpoints.sessionsStats || DEFAULT_ENDPOINTS.sessionsStats,
|
|
190
|
-
sessionRevoke: customEndpoints.sessionRevoke || DEFAULT_ENDPOINTS.sessionRevoke,
|
|
191
|
-
sessionsRevokeAll: customEndpoints.sessionsRevokeAll || DEFAULT_ENDPOINTS.sessionsRevokeAll
|
|
192
|
-
};
|
|
193
|
-
});
|
|
194
|
-
const getUrl = (endpoint) => {
|
|
195
|
-
const config = activeConfig.value;
|
|
196
|
-
if (!config.baseUrl) {
|
|
197
|
-
throw new Error("Base URL is required in configuration");
|
|
198
|
-
}
|
|
199
|
-
let endpointPath;
|
|
200
|
-
if (typeof endpoint === "string" && endpoint in endpoints.value) {
|
|
201
|
-
endpointPath = endpoints.value[endpoint];
|
|
202
|
-
} else if (typeof endpoint === "string") {
|
|
203
|
-
endpointPath = endpoint;
|
|
204
|
-
} else {
|
|
205
|
-
endpointPath = endpoints.value[endpoint];
|
|
206
|
-
}
|
|
207
|
-
const baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
208
|
-
const path = endpointPath.startsWith("/") ? endpointPath : `/${endpointPath}`;
|
|
209
|
-
console.debug(`[Strands Auth] Constructing URL for endpoint "${endpoint}": ${baseUrl}${path}`);
|
|
210
|
-
return `${baseUrl}${path}`;
|
|
211
|
-
};
|
|
212
|
-
const getSupportEmail = () => {
|
|
213
|
-
const config = activeConfig.value;
|
|
214
|
-
return config.supportEmail || null;
|
|
215
|
-
};
|
|
216
|
-
return {
|
|
217
|
-
config: activeConfig,
|
|
218
|
-
endpoints,
|
|
219
|
-
getUrl,
|
|
220
|
-
getSupportEmail
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function setStrandsConfig(config) {
|
|
224
|
-
globalConfig.value = config;
|
|
225
|
-
if (typeof window !== "undefined" && document.documentElement) {
|
|
226
|
-
const useSquircle = config.useSquircle !== void 0 ? config.useSquircle : true;
|
|
227
|
-
document.documentElement.style.setProperty("--strands-allow-squircle", useSquircle ? "1" : "0");
|
|
228
|
-
if (config.accentColor) {
|
|
229
|
-
generateColorShades(config.accentColor);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
export {
|
|
234
|
-
STRANDS_AUTH_DEFAULTS as S,
|
|
235
|
-
provideStrandsConfig as p,
|
|
236
|
-
setStrandsConfig as s,
|
|
237
|
-
useStrandsConfig as u
|
|
238
|
-
};
|