@strands.gg/accui 2.17.54 → 2.17.56
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-fvlbvZ-P.cjs.js → StrandsUIPlugin-CiAAY2sN.cjs.js} +3 -3
- package/dist/StrandsUIPlugin-Dar_Az2V.es.js +20430 -0
- package/dist/StrandsUIPlugin-fHS0GmiX.cjs.js +143 -0
- package/dist/{StrandsUIPlugin-CSsUxobq.es.js → StrandsUIPlugin-hYC1FxeG.es.js} +950 -931
- package/dist/accui.css +1 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.es.js +6574 -5585
- package/dist/nuxt/module.cjs.js +2 -2
- package/dist/nuxt/module.es.js +21 -9
- package/dist/nuxt/runtime/composables/useStrandsAuth.cjs.js +1 -1
- package/dist/nuxt/runtime/composables/useStrandsAuth.d.ts +45 -0
- package/dist/nuxt/runtime/composables/useStrandsAuth.es.js +79 -19
- package/dist/nuxt/runtime/composables/useStrandsOAuth.d.ts +8 -0
- package/dist/nuxt/runtime/plugin.client.cjs.js +1 -1
- package/dist/nuxt/runtime/plugin.client.es.js +2 -2
- package/dist/nuxt/runtime/plugin.server.cjs.js +1 -1
- package/dist/nuxt/runtime/plugin.server.es.js +1 -1
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.cjs.js +1 -1
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.d.ts +7 -0
- package/dist/nuxt/runtime/plugins/auth-interceptor.client.es.js +21 -30
- package/dist/types/index.d.ts +8 -0
- package/dist/types/oauth.d.ts +420 -0
- package/dist/useDarkMode-BdG1G2mj.es.js +102 -0
- package/dist/{useDarkMode-Cew-NWjS.cjs.js → useDarkMode-BvBnG5kF.cjs.js} +1 -1
- package/dist/useDarkMode-Dd0Q5Nnz.cjs.js +1 -0
- package/dist/{useDarkMode-CvinMR9O.es.js → useDarkMode-FTkHLBsX.es.js} +15 -15
- package/dist/useDarkMode-OZ_A8-6H.es.js +102 -0
- package/dist/useStrandsAuth-CetpoBNk.cjs.js +1 -0
- package/dist/useStrandsAuth-DEWj1bFC.cjs.js +1 -0
- package/dist/useStrandsAuth-DTJ5fn33.es.js +666 -0
- package/dist/useStrandsAuth-Z7P9ujqQ.es.js +666 -0
- package/dist/useStrandsAuth-wzl2F9DE.es.js +702 -0
- package/dist/{useStrandsConfig-CKLyNlSd.es.js → useStrandsConfig-B2UXxIbT.es.js} +46 -40
- package/dist/useStrandsConfig-BGJg1LlC.es.js +213 -0
- package/dist/useStrandsConfig-BYOAEt9d.cjs.js +1 -0
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.es.js +2 -2
- package/dist/vue/components/index.d.ts +2 -0
- package/dist/vue/composables/useAuthenticatedFetch.d.ts +3 -1
- package/dist/vue/composables/useDarkMode.d.ts +6 -1
- package/dist/vue/composables/useStrandsOAuth.d.ts +10 -0
- package/dist/vue/ui/UiMegaMenu/index.d.ts +4 -0
- package/dist/vue/ui/index.d.ts +8 -0
- package/package.json +1 -1
- package/dist/index.d.ts +0 -7
- package/dist/nuxt/module.d.ts +0 -4
- package/dist/nuxt/runtime/composables/useAuthenticatedFetch.d.ts +0 -20
- package/dist/nuxt/runtime/middleware/auth.d.ts +0 -6
- package/dist/nuxt/runtime/middleware/auth.global.d.ts +0 -2
- package/dist/nuxt/runtime/middleware/guest.d.ts +0 -6
- package/dist/nuxt/runtime/plugin.client.d.ts +0 -2
- package/dist/nuxt/runtime/plugin.server.d.ts +0 -2
- package/dist/nuxt.d.ts +0 -4
- package/dist/useStrandsAuth-CmAxFCQ_.cjs.js +0 -1
- package/dist/useStrandsAuth-DWsqp9WI.es.js +0 -661
- package/dist/useStrandsConfig-nOR0oGdb.cjs.js +0 -1
- package/dist/utils/colors.d.ts +0 -10
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/slots.d.ts +0 -1
- package/dist/utils/validation.d.ts +0 -12
- package/dist/vite/index.d.ts +0 -2
- package/dist/vite/plugin.d.ts +0 -68
- package/dist/vue/components/StrandsNav/index.d.ts +0 -8
- package/dist/vue/components/StrandsNav/types.d.ts +0 -12
- package/dist/vue/components/icons/index.d.ts +0 -2
- package/dist/vue/composables/useFloatingPosition.d.ts +0 -22
- package/dist/vue/composables/useModalStack.d.ts +0 -86
- package/dist/vue/composables/useOAuthProviders.d.ts +0 -73
- package/dist/vue/composables/useStrandsAuth.d.ts +0 -2
- package/dist/vue/composables/useStrandsConfig.d.ts +0 -5
- package/dist/vue/composables/useStrandsMfa.d.ts +0 -36
- package/dist/vue/composables/useTheme.d.ts +0 -18
- package/dist/vue/index.d.ts +0 -16
- package/dist/vue/plugins/StrandsUIPlugin.d.ts +0 -20
- package/dist/vue/utils/contrast.d.ts +0 -75
- package/dist/vue/utils/debounce.d.ts +0 -12
- package/dist/vue/utils/fontPreloader.d.ts +0 -11
- package/dist/vue/utils/iconProps.d.ts +0 -9
- package/dist/vue/utils/lazyComponents.d.ts +0 -4
- package/dist/vue/utils/levels.d.ts +0 -27
- package/dist/vue/utils/modalStack.d.ts +0 -34
- package/dist/vue/utils/performanceInit.d.ts +0 -40
- package/dist/vue/utils/requestCache.d.ts +0 -49
- package/dist/vue/utils/slots.d.ts +0 -9
- package/dist/vue/utils/sounds.d.ts +0 -57
- package/dist/webcomponents/define-element.d.ts +0 -25
- package/dist/webcomponents/entries/strands-alert.d.ts +0 -12
- package/dist/webcomponents/entries/strands-button.d.ts +0 -12
- package/dist/webcomponents/entries/strands-card.d.ts +0 -12
- package/dist/webcomponents/entries/strands-checkbox-group.d.ts +0 -11
- package/dist/webcomponents/entries/strands-divider.d.ts +0 -12
- package/dist/webcomponents/entries/strands-input.d.ts +0 -14
- package/dist/webcomponents/entries/strands-link.d.ts +0 -12
- package/dist/webcomponents/entries/strands-loader-spinner.d.ts +0 -10
- package/dist/webcomponents/entries/strands-modal.d.ts +0 -16
- package/dist/webcomponents/entries/strands-pill.d.ts +0 -11
- package/dist/webcomponents/entries/strands-radio-group.d.ts +0 -11
- package/dist/webcomponents/entries/strands-slider.d.ts +0 -10
- package/dist/webcomponents/entries/strands-table.d.ts +0 -13
- package/dist/webcomponents/entries/strands-tabs.d.ts +0 -12
- package/dist/webcomponents/entries/strands-theme-toggle.d.ts +0 -10
- package/dist/webcomponents/entries/strands-toggle.d.ts +0 -10
- package/dist/webcomponents/entries/strands-tooltip.d.ts +0 -12
- package/dist/webcomponents/index.d.ts +0 -8
- package/dist/webcomponents/loader.d.ts +0 -73
- package/dist/webcomponents/registry.d.ts +0 -41
|
@@ -1,661 +0,0 @@
|
|
|
1
|
-
import { computed as c, ref as m, getCurrentInstance as ye, onUnmounted as pe } from "vue";
|
|
2
|
-
import { u as Se } from "./useStrandsConfig-CKLyNlSd.es.js";
|
|
3
|
-
class _e {
|
|
4
|
-
cache = /* @__PURE__ */ new Map();
|
|
5
|
-
DEFAULT_TTL = 300 * 1e3;
|
|
6
|
-
// 5 minutes
|
|
7
|
-
/**
|
|
8
|
-
* Memoized fetch - prevents duplicate requests and caches results
|
|
9
|
-
*/
|
|
10
|
-
async fetch(f, v, g = this.DEFAULT_TTL) {
|
|
11
|
-
const P = Date.now(), i = this.cache.get(f);
|
|
12
|
-
if (i && P - i.timestamp < i.ttl)
|
|
13
|
-
return i.promise;
|
|
14
|
-
this.cleanExpired();
|
|
15
|
-
const o = v().finally(() => {
|
|
16
|
-
setTimeout(() => {
|
|
17
|
-
this.cache.delete(f);
|
|
18
|
-
}, g);
|
|
19
|
-
});
|
|
20
|
-
return this.cache.set(f, {
|
|
21
|
-
promise: o,
|
|
22
|
-
timestamp: P,
|
|
23
|
-
ttl: g
|
|
24
|
-
}), o;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Clear all cached entries
|
|
28
|
-
*/
|
|
29
|
-
clear() {
|
|
30
|
-
this.cache.clear();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Remove a specific cache entry
|
|
34
|
-
*/
|
|
35
|
-
invalidate(f) {
|
|
36
|
-
this.cache.delete(f);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Clean expired cache entries
|
|
40
|
-
*/
|
|
41
|
-
cleanExpired() {
|
|
42
|
-
const f = Date.now();
|
|
43
|
-
for (const [v, g] of this.cache.entries())
|
|
44
|
-
f - g.timestamp > g.ttl && this.cache.delete(v);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get cache statistics (for debugging)
|
|
48
|
-
*/
|
|
49
|
-
getStats() {
|
|
50
|
-
return {
|
|
51
|
-
size: this.cache.size,
|
|
52
|
-
entries: Array.from(this.cache.keys())
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const w = new _e();
|
|
57
|
-
function Te() {
|
|
58
|
-
return {
|
|
59
|
-
fetch: w.fetch.bind(w),
|
|
60
|
-
clear: w.clear.bind(w),
|
|
61
|
-
invalidate: w.invalidate.bind(w),
|
|
62
|
-
getStats: w.getStats.bind(w)
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function ke(n, f) {
|
|
66
|
-
let v = null;
|
|
67
|
-
return (...g) => {
|
|
68
|
-
v && clearTimeout(v), v = setTimeout(() => {
|
|
69
|
-
n(...g);
|
|
70
|
-
}, f);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const L = ke((n, f) => {
|
|
74
|
-
typeof window < "u" && localStorage.setItem(n, f);
|
|
75
|
-
}, 300), E = (n) => ({
|
|
76
|
-
id: n.id,
|
|
77
|
-
email: n.email,
|
|
78
|
-
firstName: n.first_name || n.firstName || "",
|
|
79
|
-
lastName: n.last_name || n.lastName || "",
|
|
80
|
-
avatar: n.avatar_url || n.avatar,
|
|
81
|
-
mfaEnabled: n.mfa_enabled ?? n.mfaEnabled ?? !1,
|
|
82
|
-
emailVerified: n.email_verified ?? n.emailVerified ?? !1,
|
|
83
|
-
passwordUpdatedAt: n.password_updated_at || n.passwordUpdatedAt,
|
|
84
|
-
settings: n.settings || {},
|
|
85
|
-
xp: n.xp || 0,
|
|
86
|
-
level: n.level || 1,
|
|
87
|
-
next_level_xp: n.next_level_xp || n.next_level_xp || 4,
|
|
88
|
-
username: n.username,
|
|
89
|
-
usernameLastChangedAt: n.username_last_changed_at || n.usernameLastChangedAt,
|
|
90
|
-
createdAt: n.created_at || n.createdAt,
|
|
91
|
-
updatedAt: n.updated_at || n.updatedAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
92
|
-
}), Ae = {
|
|
93
|
-
currentUser: m(null),
|
|
94
|
-
currentSession: m(null),
|
|
95
|
-
loadingStates: m({
|
|
96
|
-
initializing: !0,
|
|
97
|
-
signingIn: !1,
|
|
98
|
-
signingUp: !1,
|
|
99
|
-
signingOut: !1,
|
|
100
|
-
refreshingToken: !1,
|
|
101
|
-
sendingMfaEmail: !1,
|
|
102
|
-
verifyingMfa: !1,
|
|
103
|
-
loadingProfile: !1
|
|
104
|
-
}),
|
|
105
|
-
isInitialized: m(!1),
|
|
106
|
-
mfaRequired: m(!1),
|
|
107
|
-
mfaSessionId: m(null),
|
|
108
|
-
availableMfaMethods: m([])
|
|
109
|
-
};
|
|
110
|
-
let A = null, y = null, x = null, b = null;
|
|
111
|
-
function Ee() {
|
|
112
|
-
const { getUrl: n, config: f } = Se(), { fetch: v, clear: g, invalidate: P } = Te(), { currentUser: i, currentSession: o, loadingStates: s, isInitialized: p, mfaRequired: S, mfaSessionId: h, availableMfaMethods: _ } = Ae, T = () => {
|
|
113
|
-
if (i.value = null, o.value = null, S.value = !1, h.value = null, _.value = [], typeof window < "u" && (localStorage.removeItem("strands_auth_session"), localStorage.removeItem("strands_auth_user")), I(), M(), y = null, g(), typeof window < "u" && f.value?.onSignOutUrl) {
|
|
114
|
-
const e = window.location.pathname + window.location.search, t = f.value.onSignOutUrl;
|
|
115
|
-
e !== t && (window.location.href = t);
|
|
116
|
-
}
|
|
117
|
-
}, R = c(() => s.value.initializing), U = c(() => s.value.signingIn), B = c(() => s.value.signingUp), V = c(() => s.value.signingOut), q = c(() => s.value.refreshingToken), K = c(() => s.value.sendingMfaEmail), G = c(() => s.value.verifyingMfa);
|
|
118
|
-
c(() => s.value.loadingProfile);
|
|
119
|
-
const z = c(
|
|
120
|
-
() => s.value.signingIn || s.value.signingUp || s.value.signingOut || s.value.refreshingToken || s.value.sendingMfaEmail || s.value.verifyingMfa || s.value.loadingProfile
|
|
121
|
-
), H = c(() => s.value.initializing || z.value), W = c(() => {
|
|
122
|
-
const e = s.value;
|
|
123
|
-
return e.initializing ? "Checking authentication..." : e.signingIn ? "Signing you in..." : e.signingUp ? "Creating your account..." : e.signingOut ? "Signing you out..." : e.refreshingToken ? "Refreshing session..." : e.sendingMfaEmail ? "Sending verification code..." : e.verifyingMfa ? "Verifying code..." : e.loadingProfile ? "Loading profile..." : "Loading...";
|
|
124
|
-
}), O = () => {
|
|
125
|
-
const e = {};
|
|
126
|
-
return o.value?.accessToken && (e.Authorization = `Bearer ${o.value.accessToken}`), o.value?.refreshToken && (e["x-refresh-token"] = o.value.refreshToken), e;
|
|
127
|
-
}, Y = async (e, t, a) => {
|
|
128
|
-
const r = await fetch(n("mfaHardwareCompleteRegistration"), {
|
|
129
|
-
method: "POST",
|
|
130
|
-
headers: {
|
|
131
|
-
"Content-Type": "application/json",
|
|
132
|
-
Authorization: `Bearer ${o.value.accessToken}`
|
|
133
|
-
},
|
|
134
|
-
body: JSON.stringify({
|
|
135
|
-
device_id: e,
|
|
136
|
-
credential: t
|
|
137
|
-
})
|
|
138
|
-
});
|
|
139
|
-
if (!r.ok) {
|
|
140
|
-
const u = await r.text();
|
|
141
|
-
let l = "Failed to complete hardware key registration";
|
|
142
|
-
try {
|
|
143
|
-
const d = JSON.parse(u);
|
|
144
|
-
l = d.message || d.error || u;
|
|
145
|
-
} catch {
|
|
146
|
-
l = u || "Failed to complete hardware key registration";
|
|
147
|
-
}
|
|
148
|
-
throw new Error(l);
|
|
149
|
-
}
|
|
150
|
-
return r.json();
|
|
151
|
-
}, Q = async (e, t, a = "hardware") => {
|
|
152
|
-
const r = await fetch(n("mfaHardwareStartRegistration"), {
|
|
153
|
-
method: "POST",
|
|
154
|
-
headers: {
|
|
155
|
-
"Content-Type": "application/json",
|
|
156
|
-
Authorization: `Bearer ${o.value.accessToken}`
|
|
157
|
-
},
|
|
158
|
-
body: JSON.stringify({
|
|
159
|
-
device_name: e,
|
|
160
|
-
device_type: a
|
|
161
|
-
})
|
|
162
|
-
});
|
|
163
|
-
if (!r.ok) {
|
|
164
|
-
const u = await r.text();
|
|
165
|
-
let l = "Failed to start hardware key registration";
|
|
166
|
-
try {
|
|
167
|
-
const d = JSON.parse(u);
|
|
168
|
-
l = d.message || d.error || u;
|
|
169
|
-
} catch {
|
|
170
|
-
l = u || "Failed to start hardware key registration";
|
|
171
|
-
}
|
|
172
|
-
throw new Error(l);
|
|
173
|
-
}
|
|
174
|
-
return r.json();
|
|
175
|
-
}, X = c(() => i.value !== null), Z = async (e) => {
|
|
176
|
-
s.value.signingIn = !0;
|
|
177
|
-
try {
|
|
178
|
-
S.value = !1, h.value = null, _.value = [];
|
|
179
|
-
const t = {
|
|
180
|
-
"Content-Type": "application/json"
|
|
181
|
-
};
|
|
182
|
-
typeof window < "u" && window.location && (t.Origin = window.location.origin);
|
|
183
|
-
const a = await fetch(n("signIn"), {
|
|
184
|
-
method: "POST",
|
|
185
|
-
headers: t,
|
|
186
|
-
body: JSON.stringify(e)
|
|
187
|
-
});
|
|
188
|
-
if (!a.ok)
|
|
189
|
-
throw a.status === 401 ? new Error("Invalid email or password") : a.status === 403 ? new Error("Please verify your email address before signing in") : new Error(`Sign in failed: ${a.status} ${a.statusText}`);
|
|
190
|
-
const r = await a.json();
|
|
191
|
-
if (r.mfa_required) {
|
|
192
|
-
S.value = !0, h.value = r.mfa_session_id || null;
|
|
193
|
-
const u = (r.available_mfa_methods || []).map((l) => {
|
|
194
|
-
let d = `${l.device_type.charAt(0).toUpperCase() + l.device_type.slice(1)} Authentication`;
|
|
195
|
-
return l.device_type === "hardware" ? d = l.device_name || "Security Key" : l.device_type === "totp" ? d = l.device_name || "Authenticator App" : l.device_type === "email" && (d = l.device_name || "Email Verification"), {
|
|
196
|
-
id: l.device_id,
|
|
197
|
-
device_type: l.device_type,
|
|
198
|
-
device_name: l.device_name || d,
|
|
199
|
-
is_active: !0,
|
|
200
|
-
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
201
|
-
last_used_at: l.last_used_at,
|
|
202
|
-
// Pass through additional metadata if available
|
|
203
|
-
credential_id: l.credential_id,
|
|
204
|
-
device_info: l.device_info
|
|
205
|
-
};
|
|
206
|
-
});
|
|
207
|
-
return _.value = u, s.value.signingIn = !1, r;
|
|
208
|
-
}
|
|
209
|
-
return await N(r), r;
|
|
210
|
-
} catch (t) {
|
|
211
|
-
throw t;
|
|
212
|
-
} finally {
|
|
213
|
-
s.value.signingIn = !1;
|
|
214
|
-
}
|
|
215
|
-
}, ee = async (e) => {
|
|
216
|
-
s.value.signingUp = !0;
|
|
217
|
-
try {
|
|
218
|
-
throw new Error("Sign up not implemented - please integrate with auth SDK");
|
|
219
|
-
} finally {
|
|
220
|
-
s.value.signingUp = !1;
|
|
221
|
-
}
|
|
222
|
-
}, te = async () => {
|
|
223
|
-
s.value.signingOut = !0;
|
|
224
|
-
try {
|
|
225
|
-
I(), M(), y = null, g(), i.value = null, o.value = null, S.value = !1, h.value = null, _.value = [], typeof window < "u" && (localStorage.removeItem("strands_auth_session"), localStorage.removeItem("strands_auth_user")), typeof window < "u" && f.value?.onSignOutUrl && (window.location.href = f.value.onSignOutUrl);
|
|
226
|
-
} finally {
|
|
227
|
-
s.value.signingOut = !1;
|
|
228
|
-
}
|
|
229
|
-
}, $ = async () => {
|
|
230
|
-
if (!o.value?.refreshToken)
|
|
231
|
-
return !1;
|
|
232
|
-
if (y)
|
|
233
|
-
return await y;
|
|
234
|
-
y = (async () => {
|
|
235
|
-
s.value.refreshingToken = !0;
|
|
236
|
-
try {
|
|
237
|
-
const t = await fetch(n("refresh"), {
|
|
238
|
-
method: "POST",
|
|
239
|
-
headers: {
|
|
240
|
-
"Content-Type": "application/json"
|
|
241
|
-
},
|
|
242
|
-
body: JSON.stringify({
|
|
243
|
-
refresh_token: o.value.refreshToken
|
|
244
|
-
})
|
|
245
|
-
});
|
|
246
|
-
if (!t.ok) {
|
|
247
|
-
if (t.status === 401)
|
|
248
|
-
return T(), !1;
|
|
249
|
-
throw new Error(`Token refresh failed: ${t.status} ${t.statusText}`);
|
|
250
|
-
}
|
|
251
|
-
const a = await t.json();
|
|
252
|
-
a.user && (i.value = E(a.user), i.value && typeof window < "u" && localStorage.setItem("strands_auth_user", JSON.stringify(i.value)));
|
|
253
|
-
const r = {
|
|
254
|
-
accessToken: a.access_token,
|
|
255
|
-
refreshToken: a.refresh_token,
|
|
256
|
-
expiresAt: new Date(Date.now() + 300 * 1e3),
|
|
257
|
-
// 5 minutes from now
|
|
258
|
-
userId: a.user?.id || i.value?.id
|
|
259
|
-
};
|
|
260
|
-
return o.value = r, typeof window < "u" && localStorage.setItem("strands_auth_session", JSON.stringify(r)), k(), C(), P(`sessions:${o.value.accessToken.slice(0, 20)}`), !0;
|
|
261
|
-
} catch {
|
|
262
|
-
return T(), !1;
|
|
263
|
-
} finally {
|
|
264
|
-
s.value.refreshingToken = !1;
|
|
265
|
-
}
|
|
266
|
-
})();
|
|
267
|
-
const e = await y;
|
|
268
|
-
return y = null, e;
|
|
269
|
-
}, ae = async () => {
|
|
270
|
-
const e = `profile:${o.value.accessToken.slice(0, 20)}`;
|
|
271
|
-
s.value.loadingProfile = !0;
|
|
272
|
-
try {
|
|
273
|
-
return await v(e, async () => {
|
|
274
|
-
const t = await fetch(n("profile"), {
|
|
275
|
-
method: "GET",
|
|
276
|
-
headers: {
|
|
277
|
-
"Content-Type": "application/json",
|
|
278
|
-
Authorization: `Bearer ${o.value?.accessToken}`
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
if (!t.ok)
|
|
282
|
-
throw t.status === 401 ? new Error("Authentication expired. Please sign in again.") : new Error(`Failed to fetch profile: ${t.status} ${t.statusText}`);
|
|
283
|
-
const a = await t.json();
|
|
284
|
-
return i.value = E(a), i.value && typeof window < "u" && localStorage.setItem("strands_auth_user", JSON.stringify(i.value)), i.value;
|
|
285
|
-
});
|
|
286
|
-
} finally {
|
|
287
|
-
s.value.loadingProfile = !1;
|
|
288
|
-
}
|
|
289
|
-
}, ne = async (e) => {
|
|
290
|
-
s.value.loadingProfile = !0;
|
|
291
|
-
try {
|
|
292
|
-
const t = await fetch(n("profile"), {
|
|
293
|
-
method: "POST",
|
|
294
|
-
headers: {
|
|
295
|
-
"Content-Type": "application/json",
|
|
296
|
-
Authorization: `Bearer ${o.value.accessToken}`
|
|
297
|
-
},
|
|
298
|
-
body: JSON.stringify({
|
|
299
|
-
first_name: e.firstName,
|
|
300
|
-
last_name: e.lastName
|
|
301
|
-
})
|
|
302
|
-
});
|
|
303
|
-
if (!t.ok)
|
|
304
|
-
throw t.status === 401 ? new Error("Authentication expired. Please sign in again.") : new Error(`Profile update failed: ${t.status} ${t.statusText}`);
|
|
305
|
-
const a = await t.json();
|
|
306
|
-
return i.value = E(a), i.value && L("strands_auth_user", JSON.stringify(i.value)), i.value;
|
|
307
|
-
} finally {
|
|
308
|
-
s.value.loadingProfile = !1;
|
|
309
|
-
}
|
|
310
|
-
}, se = async (e) => {
|
|
311
|
-
s.value.loadingProfile = !0;
|
|
312
|
-
try {
|
|
313
|
-
const t = await fetch(n("settings"), {
|
|
314
|
-
method: "POST",
|
|
315
|
-
headers: {
|
|
316
|
-
"Content-Type": "application/json",
|
|
317
|
-
Authorization: `Bearer ${o.value.accessToken}`
|
|
318
|
-
},
|
|
319
|
-
body: JSON.stringify({
|
|
320
|
-
settings: e
|
|
321
|
-
})
|
|
322
|
-
});
|
|
323
|
-
if (!t.ok)
|
|
324
|
-
throw t.status === 401 ? new Error("Authentication expired. Please sign in again.") : new Error(`Settings update failed: ${t.status} ${t.statusText}`);
|
|
325
|
-
const a = await t.json();
|
|
326
|
-
return i.value = E(a), i.value && L("strands_auth_user", JSON.stringify(i.value)), i.value;
|
|
327
|
-
} finally {
|
|
328
|
-
s.value.loadingProfile = !1;
|
|
329
|
-
}
|
|
330
|
-
}, ie = async (e, t) => {
|
|
331
|
-
s.value.loadingProfile = !0;
|
|
332
|
-
try {
|
|
333
|
-
const a = await fetch(n("changeEmail"), {
|
|
334
|
-
method: "POST",
|
|
335
|
-
headers: {
|
|
336
|
-
"Content-Type": "application/json",
|
|
337
|
-
Authorization: `Bearer ${o.value.accessToken}`
|
|
338
|
-
},
|
|
339
|
-
body: JSON.stringify({
|
|
340
|
-
new_email: e,
|
|
341
|
-
password: t
|
|
342
|
-
})
|
|
343
|
-
});
|
|
344
|
-
if (!a.ok) {
|
|
345
|
-
if (a.status === 401)
|
|
346
|
-
throw new Error("Authentication expired. Please sign in again.");
|
|
347
|
-
{
|
|
348
|
-
const u = await a.json().catch(() => ({}));
|
|
349
|
-
throw new Error(u.message || `Email change failed: ${a.status} ${a.statusText}`);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
const r = await a.json();
|
|
353
|
-
return i.value && (i.value = {
|
|
354
|
-
...i.value,
|
|
355
|
-
email: e,
|
|
356
|
-
emailVerified: !1,
|
|
357
|
-
// Email needs to be verified again
|
|
358
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
359
|
-
}, typeof window < "u" && localStorage.setItem("strands_auth_user", JSON.stringify(i.value))), r;
|
|
360
|
-
} finally {
|
|
361
|
-
s.value.loadingProfile = !1;
|
|
362
|
-
}
|
|
363
|
-
}, re = async (e, t, a = !1) => {
|
|
364
|
-
if (!h.value)
|
|
365
|
-
throw new Error("No MFA session available");
|
|
366
|
-
s.value.verifyingMfa = !0;
|
|
367
|
-
try {
|
|
368
|
-
const r = n(a ? "mfaBackupCodeVerify" : "mfaSigninVerify"), u = a ? { mfa_session_id: h.value, backup_code: t } : { mfa_session_id: h.value, device_id: e, code: t }, l = await fetch(r, {
|
|
369
|
-
method: "POST",
|
|
370
|
-
headers: { "Content-Type": "application/json" },
|
|
371
|
-
body: JSON.stringify(u)
|
|
372
|
-
});
|
|
373
|
-
if (!l.ok) {
|
|
374
|
-
const j = await l.text();
|
|
375
|
-
let J = "MFA verification failed";
|
|
376
|
-
try {
|
|
377
|
-
const F = JSON.parse(j);
|
|
378
|
-
J = F.message || F.error || j;
|
|
379
|
-
} catch {
|
|
380
|
-
J = j || "MFA verification failed";
|
|
381
|
-
}
|
|
382
|
-
throw new Error(J);
|
|
383
|
-
}
|
|
384
|
-
const d = await l.json();
|
|
385
|
-
return S.value = !1, h.value = null, _.value = [], await N(d), d;
|
|
386
|
-
} finally {
|
|
387
|
-
s.value.verifyingMfa = !1;
|
|
388
|
-
}
|
|
389
|
-
}, oe = async (e) => {
|
|
390
|
-
if (!h.value)
|
|
391
|
-
throw new Error("No MFA session available");
|
|
392
|
-
s.value.sendingMfaEmail = !0;
|
|
393
|
-
try {
|
|
394
|
-
const t = await fetch(n("mfaSigninSendEmail"), {
|
|
395
|
-
method: "POST",
|
|
396
|
-
headers: { "Content-Type": "application/json" },
|
|
397
|
-
body: JSON.stringify({
|
|
398
|
-
mfa_session_id: h.value,
|
|
399
|
-
device_id: e
|
|
400
|
-
})
|
|
401
|
-
});
|
|
402
|
-
if (!t.ok) {
|
|
403
|
-
const r = await t.text();
|
|
404
|
-
let u = "Failed to send MFA email code";
|
|
405
|
-
try {
|
|
406
|
-
const l = JSON.parse(r);
|
|
407
|
-
u = l.message || l.error || r;
|
|
408
|
-
} catch {
|
|
409
|
-
u = r || "Failed to send MFA email code";
|
|
410
|
-
}
|
|
411
|
-
throw new Error(u);
|
|
412
|
-
}
|
|
413
|
-
return await t.json();
|
|
414
|
-
} finally {
|
|
415
|
-
s.value.sendingMfaEmail = !1;
|
|
416
|
-
}
|
|
417
|
-
}, le = async (e) => {
|
|
418
|
-
if (!h.value)
|
|
419
|
-
throw new Error("No MFA session available");
|
|
420
|
-
const t = await fetch(n("mfaWebAuthnChallenge"), {
|
|
421
|
-
method: "POST",
|
|
422
|
-
headers: { "Content-Type": "application/json" },
|
|
423
|
-
body: JSON.stringify({
|
|
424
|
-
mfa_session_id: h.value,
|
|
425
|
-
device_id: e
|
|
426
|
-
})
|
|
427
|
-
});
|
|
428
|
-
if (!t.ok) {
|
|
429
|
-
const a = await t.text();
|
|
430
|
-
let r = "Failed to get WebAuthn challenge";
|
|
431
|
-
try {
|
|
432
|
-
const u = JSON.parse(a);
|
|
433
|
-
r = u.message || u.error || a;
|
|
434
|
-
} catch {
|
|
435
|
-
r = a || r;
|
|
436
|
-
}
|
|
437
|
-
throw new Error(r);
|
|
438
|
-
}
|
|
439
|
-
return t.json();
|
|
440
|
-
}, N = async (e) => {
|
|
441
|
-
try {
|
|
442
|
-
e.user && (i.value = E(e.user));
|
|
443
|
-
const t = {
|
|
444
|
-
accessToken: e.access_token,
|
|
445
|
-
refreshToken: e.refresh_token,
|
|
446
|
-
expiresAt: new Date(Date.now() + 300 * 1e3),
|
|
447
|
-
// 5 minutes from now (matching API token expiry)
|
|
448
|
-
userId: i.value?.id || e.user?.id
|
|
449
|
-
};
|
|
450
|
-
o.value = t, typeof window < "u" && (localStorage.setItem("strands_auth_session", JSON.stringify(t)), i.value && localStorage.setItem("strands_auth_user", JSON.stringify(i.value))), k(), C();
|
|
451
|
-
} catch {
|
|
452
|
-
}
|
|
453
|
-
}, k = () => {
|
|
454
|
-
if (A && clearTimeout(A), !o.value || typeof document < "u" && document.visibilityState === "hidden")
|
|
455
|
-
return;
|
|
456
|
-
const e = /* @__PURE__ */ new Date(), a = o.value.expiresAt.getTime() - e.getTime() - 60 * 1e3;
|
|
457
|
-
if (a <= 0) {
|
|
458
|
-
$();
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
A = setTimeout(async () => {
|
|
462
|
-
(typeof document > "u" || document.visibilityState === "visible") && await $() && k();
|
|
463
|
-
}, a);
|
|
464
|
-
}, I = () => {
|
|
465
|
-
A && (clearTimeout(A), A = null);
|
|
466
|
-
}, C = () => {
|
|
467
|
-
x || typeof window > "u" || (x = setInterval(() => {
|
|
468
|
-
i.value && o.value && (localStorage.getItem("strands_auth_session") || (M(), T()));
|
|
469
|
-
}, 2e3));
|
|
470
|
-
}, M = () => {
|
|
471
|
-
x && (clearInterval(x), x = null);
|
|
472
|
-
}, D = async () => {
|
|
473
|
-
if (p.value) {
|
|
474
|
-
s.value.initializing = !1;
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
return b || (b = (async () => {
|
|
478
|
-
s.value.initializing = !0;
|
|
479
|
-
try {
|
|
480
|
-
if (typeof window < "u") {
|
|
481
|
-
const e = localStorage.getItem("strands_auth_session"), t = localStorage.getItem("strands_auth_user");
|
|
482
|
-
if (e && t)
|
|
483
|
-
try {
|
|
484
|
-
const a = JSON.parse(e), r = JSON.parse(t);
|
|
485
|
-
a.expiresAt = new Date(a.expiresAt), a.expiresAt <= /* @__PURE__ */ new Date() && a.refreshToken ? (o.value = a, i.value = r, await Promise.race([
|
|
486
|
-
$(),
|
|
487
|
-
new Promise((d) => setTimeout(() => d(!1), 5e3))
|
|
488
|
-
]) || T()) : a.expiresAt > /* @__PURE__ */ new Date() ? (o.value = a, i.value = r, k(), C()) : (localStorage.removeItem("strands_auth_session"), localStorage.removeItem("strands_auth_user"));
|
|
489
|
-
} catch {
|
|
490
|
-
localStorage.removeItem("strands_auth_session"), localStorage.removeItem("strands_auth_user");
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
p.value = !0, await new Promise((e) => setTimeout(e, 50));
|
|
494
|
-
} catch {
|
|
495
|
-
} finally {
|
|
496
|
-
s.value.initializing = !1, b = null;
|
|
497
|
-
}
|
|
498
|
-
})(), b);
|
|
499
|
-
}, ue = async (e) => {
|
|
500
|
-
s.value.loadingProfile = !0;
|
|
501
|
-
try {
|
|
502
|
-
const t = await fetch(n("changeUsername"), {
|
|
503
|
-
method: "POST",
|
|
504
|
-
headers: {
|
|
505
|
-
"Content-Type": "application/json",
|
|
506
|
-
Authorization: `Bearer ${o.value.accessToken}`
|
|
507
|
-
},
|
|
508
|
-
body: JSON.stringify({
|
|
509
|
-
username: e
|
|
510
|
-
})
|
|
511
|
-
});
|
|
512
|
-
if (!t.ok) {
|
|
513
|
-
const r = await t.json().catch(() => ({}));
|
|
514
|
-
throw t.status === 409 ? new Error("Username is already taken") : r.cooldown_end ? new Error(`You can only change your username once every 30 days. You can change it again on ${new Date(r.cooldown_end).toLocaleDateString()}`) : new Error(r.message || `Username change failed: ${t.status} ${t.statusText}`);
|
|
515
|
-
}
|
|
516
|
-
const a = await t.json();
|
|
517
|
-
return i.value && (i.value = {
|
|
518
|
-
...i.value,
|
|
519
|
-
username: e,
|
|
520
|
-
usernameLastChangedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
521
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
522
|
-
}, typeof window < "u" && localStorage.setItem("strands_auth_user", JSON.stringify(i.value))), a;
|
|
523
|
-
} finally {
|
|
524
|
-
s.value.loadingProfile = !1;
|
|
525
|
-
}
|
|
526
|
-
}, ce = async () => {
|
|
527
|
-
const e = await fetch(n("usernameCooldown"), {
|
|
528
|
-
method: "GET",
|
|
529
|
-
headers: {
|
|
530
|
-
Authorization: `Bearer ${o.value.accessToken}`
|
|
531
|
-
}
|
|
532
|
-
});
|
|
533
|
-
if (!e.ok)
|
|
534
|
-
throw new Error(`Failed to get username cooldown: ${e.status} ${e.statusText}`);
|
|
535
|
-
return e.json();
|
|
536
|
-
}, fe = async (e) => {
|
|
537
|
-
const t = n("checkUsernameAvailability").replace("{username}", encodeURIComponent(e)), a = await fetch(t, {
|
|
538
|
-
method: "GET",
|
|
539
|
-
headers: {
|
|
540
|
-
"Content-Type": "application/json"
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
if (!a.ok)
|
|
544
|
-
throw new Error(`Failed to check username availability: ${a.status} ${a.statusText}`);
|
|
545
|
-
return a.json();
|
|
546
|
-
}, de = async () => {
|
|
547
|
-
const e = `sessions:${o.value?.accessToken?.slice(0, 20) || "no-token"}`;
|
|
548
|
-
try {
|
|
549
|
-
return await v(e, async () => {
|
|
550
|
-
const t = O(), a = await fetch(n("sessions"), {
|
|
551
|
-
method: "GET",
|
|
552
|
-
headers: t
|
|
553
|
-
});
|
|
554
|
-
if (!a.ok)
|
|
555
|
-
throw await a.text(), new Error(`Failed to get user sessions: ${a.status} ${a.statusText}`);
|
|
556
|
-
return a.json();
|
|
557
|
-
}, 120 * 1e3);
|
|
558
|
-
} catch (t) {
|
|
559
|
-
throw t;
|
|
560
|
-
}
|
|
561
|
-
}, he = async () => {
|
|
562
|
-
const e = await fetch(n("sessionsStats"), {
|
|
563
|
-
method: "GET",
|
|
564
|
-
headers: O()
|
|
565
|
-
});
|
|
566
|
-
if (!e.ok)
|
|
567
|
-
throw new Error(`Failed to get session stats: ${e.status} ${e.statusText}`);
|
|
568
|
-
return e.json();
|
|
569
|
-
}, ge = async (e) => {
|
|
570
|
-
const t = n("sessionRevoke").replace("{session_id}", encodeURIComponent(e)), a = await fetch(t, {
|
|
571
|
-
method: "POST",
|
|
572
|
-
headers: O()
|
|
573
|
-
});
|
|
574
|
-
if (!a.ok)
|
|
575
|
-
throw new Error(`Failed to revoke session: ${a.status} ${a.statusText}`);
|
|
576
|
-
return a.status === 200;
|
|
577
|
-
}, ve = async () => {
|
|
578
|
-
const e = await fetch(n("sessionsRevokeAll"), {
|
|
579
|
-
method: "POST",
|
|
580
|
-
headers: O()
|
|
581
|
-
});
|
|
582
|
-
if (!e.ok)
|
|
583
|
-
throw new Error(`Failed to revoke all other sessions: ${e.status} ${e.statusText}`);
|
|
584
|
-
return e.status === 200;
|
|
585
|
-
};
|
|
586
|
-
typeof document < "u" && document.addEventListener("visibilitychange", () => {
|
|
587
|
-
document.visibilityState === "visible" && o.value ? (k(), we()) : document.visibilityState === "hidden" && I();
|
|
588
|
-
}), typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
589
|
-
(e.key === "strands_auth_session" || e.key === "strands_auth_user") && !e.newValue && i.value && T();
|
|
590
|
-
});
|
|
591
|
-
const we = () => {
|
|
592
|
-
if (!(typeof window > "u") && i.value && o.value) {
|
|
593
|
-
const e = localStorage.getItem("strands_auth_session"), t = localStorage.getItem("strands_auth_user");
|
|
594
|
-
(!e || !t) && T();
|
|
595
|
-
}
|
|
596
|
-
}, me = () => {
|
|
597
|
-
I(), M(), g();
|
|
598
|
-
};
|
|
599
|
-
try {
|
|
600
|
-
ye() && pe(me);
|
|
601
|
-
} catch {
|
|
602
|
-
}
|
|
603
|
-
return p.value || D(), {
|
|
604
|
-
// State
|
|
605
|
-
user: c(() => i.value),
|
|
606
|
-
currentUser: c(() => i.value),
|
|
607
|
-
currentSession: c(() => o.value),
|
|
608
|
-
isAuthenticated: X,
|
|
609
|
-
isLoading: c(() => H.value || !p.value),
|
|
610
|
-
loading: z,
|
|
611
|
-
loadingMessage: W,
|
|
612
|
-
// Specific loading states
|
|
613
|
-
isInitializing: R,
|
|
614
|
-
isInitialized: c(() => p.value),
|
|
615
|
-
isSigningIn: U,
|
|
616
|
-
isSigningUp: B,
|
|
617
|
-
isSigningOut: V,
|
|
618
|
-
isRefreshingToken: q,
|
|
619
|
-
isSendingMfaEmail: K,
|
|
620
|
-
isVerifyingMfa: G,
|
|
621
|
-
// MFA State
|
|
622
|
-
mfaRequired: c(() => S.value),
|
|
623
|
-
mfaSessionId: c(() => h.value),
|
|
624
|
-
availableMfaMethods: c(() => _.value),
|
|
625
|
-
// Methods
|
|
626
|
-
signIn: Z,
|
|
627
|
-
signUp: ee,
|
|
628
|
-
signOut: te,
|
|
629
|
-
refreshToken: $,
|
|
630
|
-
fetchProfile: ae,
|
|
631
|
-
updateProfile: ne,
|
|
632
|
-
updateUserSettings: se,
|
|
633
|
-
changeEmail: ie,
|
|
634
|
-
changeUsername: ue,
|
|
635
|
-
getUsernameCooldown: ce,
|
|
636
|
-
checkUsernameAvailability: fe,
|
|
637
|
-
// Session management
|
|
638
|
-
getUserSessions: de,
|
|
639
|
-
getSessionStats: he,
|
|
640
|
-
revokeSession: ge,
|
|
641
|
-
revokeAllOtherSessions: ve,
|
|
642
|
-
initialize: D,
|
|
643
|
-
setAuthData: N,
|
|
644
|
-
verifyMfa: re,
|
|
645
|
-
sendMfaEmailCode: oe,
|
|
646
|
-
getMfaWebAuthnChallenge: le,
|
|
647
|
-
registerHardwareKey: Q,
|
|
648
|
-
completeHardwareKeyRegistration: Y,
|
|
649
|
-
// Token management
|
|
650
|
-
startTokenRefreshTimer: k,
|
|
651
|
-
stopTokenRefreshTimer: I,
|
|
652
|
-
getAuthHeaders: O,
|
|
653
|
-
// Force re-initialization (useful for testing or navigation)
|
|
654
|
-
forceReInit: () => {
|
|
655
|
-
p.value = !1, s.value.initializing = !0, D();
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
export {
|
|
660
|
-
Ee as u
|
|
661
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("vue"),c={baseUrl:"https://your-api.example.com",accentColor:"#EA00A8",autoRefresh:!0,refreshInterval:4,protectedRoutes:[],guestOnlyRoutes:["/auth","/login","/register"],devMode:!1,styles:!0,endpoints:{},useSquircle:!0,theme:"system"},a={signIn:"/api/v1/auth/sign-in",signUp:"/api/v1/auth/sign-up",signOut:"/api/v1/auth/sign-out",refresh:"/api/v1/auth/refresh",passwordReset:"/api/v1/auth/password-reset",passwordResetConfirm:"/api/v1/auth/password-reset/confirm",completeRegistration:"/api/v1/auth/complete-registration",profile:"/api/v1/user/profile",verifyEmail:"/api/v1/auth/verify-email",oauthProviders:"/api/v1/oauth/providers",oauthProvider:"/api/v1/oauth/providers/{provider_id}",changeEmail:"/api/v1/user/change-email",avatar:"/api/v1/user/avatar",settings:"/api/v1/user/settings",changeUsername:"/api/v1/user/username",usernameCooldown:"/api/v1/user/username/cooldown",checkUsernameAvailability:"/api/v1/username/{username}/available",mfaDevices:"/api/v1/mfa/devices",mfaTotpSetup:"/api/v1/mfa/totp/setup",mfaTotpVerify:"/api/v1/mfa/totp/verify",mfaEmailSetup:"/api/v1/mfa/email/setup",mfaEmailSend:"/api/v1/mfa/email/send",mfaEmailVerify:"/api/v1/mfa/email/verify",mfaDeviceDisable:"/api/v1/mfa/device/disable",mfaBackupCodes:"/api/v1/mfa/backup-codes/regenerate",mfaHardwareStartRegistration:"/api/v1/mfa/hardware/start-registration",mfaHardwareCompleteRegistration:"/api/v1/mfa/hardware/complete-registration",mfaSigninSendEmail:"/api/v1/auth/mfa/email/send",mfaSigninVerify:"/api/v1/auth/mfa/verify",mfaBackupCodeVerify:"/api/v1/auth/mfa/backup-code/verify",mfaWebAuthnChallenge:"/api/v1/auth/mfa/webauthn/challenge",sessions:"/api/v1/sessions",sessionsStats:"/api/v1/sessions/stats",sessionRevoke:"/api/v1/sessions/{session_id}/revoke",sessionsRevokeAll:"/api/v1/sessions/revoke-all"},p=Symbol("strands-config"),m=u.ref(null);function v(s){if(typeof window>"u"||!document.documentElement)return;if(typeof CSS<"u"&&CSS.registerProperty)try{CSS.registerProperty({name:"--strands-accent",syntax:"<color>",inherits:!0,initialValue:s})}catch{}document.documentElement.style.setProperty("--strands-accent",s),document.documentElement.style.setProperty("--accui-strands-accent",s);const t={"--accui-strands-50":`color-mix(in srgb, ${s} 10%, white)`,"--accui-strands-100":`color-mix(in srgb, ${s} 20%, white)`,"--accui-strands-200":`color-mix(in srgb, ${s} 30%, white)`,"--accui-strands-300":`color-mix(in srgb, ${s} 40%, white)`,"--accui-strands-400":`color-mix(in srgb, ${s} 70%, white)`,"--accui-strands-500":s,"--accui-strands-600":`color-mix(in srgb, ${s} 85%, black)`,"--accui-strands-700":`color-mix(in srgb, ${s} 70%, black)`,"--accui-strands-800":`color-mix(in srgb, ${s} 55%, black)`,"--accui-strands-900":`color-mix(in srgb, ${s} 40%, black)`,"--accui-strands-950":`color-mix(in srgb, ${s} 25%, black)`};for(const[r,n]of Object.entries(t))document.documentElement.style.setProperty(r,n)}function g(s){if(m.value=s,typeof window<"u"&&document.documentElement){const t=s.useSquircle!==void 0?s.useSquircle:!0;document.documentElement.style.setProperty("--strands-allow-squircle",t?"1":"0"),s.accentColor&&v(s.accentColor)}try{u.provide(p,s)}catch(t){console.warn("[Strands Auth] Could not provide config via Vue provide/inject. Config available via global state only.",t)}}function h(s){let t=null;try{u.getCurrentInstance()&&(t=u.inject(p,null))}catch{t=null}let r=null;try{if(typeof window<"u"){if(window.__STRANDS_CONFIG__)r=window.__STRANDS_CONFIG__;else if(window.__NUXT__){const i=window.__NUXT__;r=i?.config?.public?.strandsAuth||i?.public?.strandsAuth||i?.strandsAuth}}}catch(i){console.error("[Strands Auth] Error accessing runtime configuration:",i)}const n=u.computed(()=>{const i={...c,...s||{},...t||{},...m.value||{},...r||{}};if(i.baseUrl===c.baseUrl&&typeof window>"u"&&console.warn("[Strands Auth] No baseUrl configured for SSR. Please provide a baseUrl in your strandsAuth configuration."),typeof window<"u"&&document.documentElement){const e=i.useSquircle!==void 0?i.useSquircle:!0;document.documentElement.style.setProperty("--strands-allow-squircle",e?"1":"0"),i.accentColor&&document.documentElement.style.setProperty("--strands-accent",i.accentColor)}return i}),l=u.computed(()=>{const e=n.value.endpoints||{};return{signIn:e.signIn||a.signIn,signUp:e.signUp||a.signUp,signOut:e.signOut||a.signOut,refresh:e.refresh||a.refresh,passwordReset:e.passwordReset||a.passwordReset,passwordResetConfirm:e.passwordResetConfirm||a.passwordResetConfirm,completeRegistration:e.completeRegistration||a.completeRegistration,profile:e.profile||a.profile,verifyEmail:e.verifyEmail||a.verifyEmail,oauthProviders:e.oauthProviders||a.oauthProviders,oauthProvider:e.oauthProvider||a.oauthProvider,changeEmail:e.changeEmail||a.changeEmail,avatar:e.avatar||a.avatar,settings:e.settings||a.settings,changeUsername:e.changeUsername||a.changeUsername,usernameCooldown:e.usernameCooldown||a.usernameCooldown,checkUsernameAvailability:e.checkUsernameAvailability||a.checkUsernameAvailability,mfaDevices:e.mfaDevices||a.mfaDevices,mfaTotpSetup:e.mfaTotpSetup||a.mfaTotpSetup,mfaTotpVerify:e.mfaTotpVerify||a.mfaTotpVerify,mfaEmailSetup:e.mfaEmailSetup||a.mfaEmailSetup,mfaEmailSend:e.mfaEmailSend||a.mfaEmailSend,mfaEmailVerify:e.mfaEmailVerify||a.mfaEmailVerify,mfaDeviceDisable:e.mfaDeviceDisable||a.mfaDeviceDisable,mfaBackupCodes:e.mfaBackupCodes||a.mfaBackupCodes,mfaHardwareStartRegistration:e.mfaHardwareStartRegistration||a.mfaHardwareStartRegistration,mfaHardwareCompleteRegistration:e.mfaHardwareCompleteRegistration||a.mfaHardwareCompleteRegistration,mfaSigninSendEmail:e.mfaSigninSendEmail||a.mfaSigninSendEmail,mfaSigninVerify:e.mfaSigninVerify||a.mfaSigninVerify,mfaBackupCodeVerify:e.mfaBackupCodeVerify||a.mfaBackupCodeVerify,mfaWebAuthnChallenge:e.mfaWebAuthnChallenge||a.mfaWebAuthnChallenge,sessions:e.sessions||a.sessions,sessionsStats:e.sessionsStats||a.sessionsStats,sessionRevoke:e.sessionRevoke||a.sessionRevoke,sessionsRevokeAll:e.sessionsRevokeAll||a.sessionsRevokeAll}});return{config:n,endpoints:l,getUrl:i=>{const e=n.value;if(!e.baseUrl)throw new Error("Base URL is required in configuration");let o;typeof i=="string"&&i in l.value?o=l.value[i]:typeof i=="string"?o=i:o=l.value[i];const f=e.baseUrl.replace(/\/$/,""),d=o.startsWith("/")?o:`/${o}`;return console.debug(`[Strands Auth] Constructing URL for endpoint "${i}": ${f}${d}`),`${f}${d}`},getSupportEmail:()=>n.value.supportEmail||null}}function S(s){if(m.value=s,typeof window<"u"&&document.documentElement){const t=s.useSquircle!==void 0?s.useSquircle:!0;document.documentElement.style.setProperty("--strands-allow-squircle",t?"1":"0"),s.accentColor&&v(s.accentColor)}}const y=Object.freeze(Object.defineProperty({__proto__:null,provideStrandsConfig:g,setStrandsConfig:S,useStrandsConfig:h},Symbol.toStringTag,{value:"Module"}));exports.STRANDS_AUTH_DEFAULTS=c;exports.provideStrandsConfig=g;exports.setStrandsConfig=S;exports.useStrandsConfig=h;exports.useStrandsConfig$1=y;
|
package/dist/utils/colors.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Complete Tailwind CSS color palette with shades
|
|
3
|
-
* Provides all 22 Tailwind colors with their full shade ranges (50-950)
|
|
4
|
-
*/
|
|
5
|
-
interface SwatchConfig {
|
|
6
|
-
label?: string;
|
|
7
|
-
shades?: string[];
|
|
8
|
-
}
|
|
9
|
-
export declare const tailwindColors: Record<string, SwatchConfig>;
|
|
10
|
-
export type { SwatchConfig };
|
package/dist/utils/index.d.ts
DELETED
package/dist/utils/slots.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const slotHasContent: (slotName: string, slots: any) => boolean;
|