@huyooo/ui 0.5.54 → 0.5.58
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/AuthkitAuthModal-BVXtE_sP.js +2133 -0
- package/dist/{FeedbackItem-kqVGcZQy.js → FeedbackItem-BZ3zskgs.js} +1 -1
- package/dist/{FeedbackModal-Dc9Pd_rr.js → FeedbackModal-CLRw0hmp.js} +1 -1
- package/dist/Menu-BjWB9hre.js +121 -0
- package/dist/{MessageHandle-CVjGWgUL.js → MessageHandle-cK3Z3tfe.js} +1 -1
- package/dist/{ReferrerReferees-CGyMFl-K.js → ReferrerReferees-DBOVVD_R.js} +1 -1
- package/dist/{UserAccountMenu-Dkqy4wJf.js → UserAccountMenu-BbHFa60w.js} +5 -5
- package/dist/{WidthContainer-CWpKoYZn.js → WidthContainer-VdifT6ZJ.js} +4 -4
- package/dist/api/Authkit/OAuth.d.ts +7 -1
- package/dist/api/Authkit/Users.d.ts +9 -0
- package/dist/authkit.js +2 -2
- package/dist/common.js +2 -2
- package/dist/components/Authkit/AppSetting/AuthkitAccountDelete.vue.d.ts +20 -0
- package/dist/composables/Authkit/useAuthkitOAuth.d.ts +2 -1
- package/dist/composables.js +2 -2
- package/dist/feedback.js +2 -2
- package/dist/index.js +11 -11
- package/dist/message.js +1 -1
- package/dist/referrer.js +1 -1
- package/dist/style.css +1 -1
- package/dist/useAuthkitUsersProfile-B_uMdnat.js +212 -0
- package/dist/{useSEO-DaonfWWD.js → useSEO-D5sci2ek.js} +1 -1
- package/dist/user.js +1 -1
- package/package.json +1 -1
- package/dist/AuthkitAuthModal-BvKac_TP.js +0 -1820
- package/dist/Menu-ejsosUdV.js +0 -118
- package/dist/useAuthkitUsersProfile-KZgGxBAW.js +0 -197
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { ref as t, readonly as b, computed as A } from "vue";
|
|
2
|
+
import { d as T, e as y, f as x, g as l, c as i } from "./auth-CDARHcht.js";
|
|
3
|
+
const c = t("signIn"), v = [], m = [], w = [], u = t(null);
|
|
4
|
+
function C() {
|
|
5
|
+
try {
|
|
6
|
+
const e = localStorage.getItem("jwtToken");
|
|
7
|
+
if (e)
|
|
8
|
+
return u.value = e, !0;
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.warn("Failed to access localStorage:", e);
|
|
11
|
+
}
|
|
12
|
+
return !1;
|
|
13
|
+
}
|
|
14
|
+
function j() {
|
|
15
|
+
if (u.value)
|
|
16
|
+
return u.value;
|
|
17
|
+
try {
|
|
18
|
+
const e = localStorage.getItem("jwtToken");
|
|
19
|
+
return e && (u.value = e), e;
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return console.warn("Failed to access localStorage:", e), null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function g(e) {
|
|
25
|
+
u.value = e;
|
|
26
|
+
try {
|
|
27
|
+
localStorage.setItem("jwtToken", e);
|
|
28
|
+
} catch (s) {
|
|
29
|
+
console.warn("Failed to save token to localStorage:", s);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function $() {
|
|
33
|
+
u.value = null;
|
|
34
|
+
try {
|
|
35
|
+
localStorage.removeItem("jwtToken");
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.warn("Failed to clear localStorage:", e);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function E(e) {
|
|
41
|
+
v.push(e);
|
|
42
|
+
}
|
|
43
|
+
function V(e) {
|
|
44
|
+
m.push(e);
|
|
45
|
+
}
|
|
46
|
+
function F(e) {
|
|
47
|
+
w.push(e);
|
|
48
|
+
}
|
|
49
|
+
function L() {
|
|
50
|
+
const e = t(!1), s = t(!1), f = t(!1);
|
|
51
|
+
function h(r) {
|
|
52
|
+
e.value = !0, x({
|
|
53
|
+
email: r.email,
|
|
54
|
+
password: r.password
|
|
55
|
+
}).then(({
|
|
56
|
+
data: n
|
|
57
|
+
}) => {
|
|
58
|
+
e.value = !1, g(n.jwtToken), v.forEach((S) => S(n));
|
|
59
|
+
}).catch((n) => {
|
|
60
|
+
e.value = !1, console.error("登录失败:", n);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function a(r) {
|
|
64
|
+
s.value = !0, y({
|
|
65
|
+
email: r.email,
|
|
66
|
+
userToken: r.userToken,
|
|
67
|
+
emailVerifyId: r.emailVerifyId,
|
|
68
|
+
password: r.password,
|
|
69
|
+
referrerId: r.referrerId
|
|
70
|
+
}).then(() => {
|
|
71
|
+
s.value = !1, c.value = "signIn", m.forEach((n) => n());
|
|
72
|
+
}).catch((n) => {
|
|
73
|
+
s.value = !1, console.error("注册失败:", n);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function k(r) {
|
|
77
|
+
f.value = !0, T({
|
|
78
|
+
email: r.email,
|
|
79
|
+
userToken: r.userToken,
|
|
80
|
+
emailVerifyId: r.emailVerifyId,
|
|
81
|
+
password: r.password
|
|
82
|
+
}).then(() => {
|
|
83
|
+
f.value = !1, c.value = "signIn", w.forEach((n) => n());
|
|
84
|
+
}).catch((n) => {
|
|
85
|
+
f.value = !1, console.error("重置密码失败:", n);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function I() {
|
|
89
|
+
c.value = "signUp";
|
|
90
|
+
}
|
|
91
|
+
function U() {
|
|
92
|
+
c.value = "resetPassword";
|
|
93
|
+
}
|
|
94
|
+
function P() {
|
|
95
|
+
c.value = "signIn";
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
signInSubmit: h,
|
|
99
|
+
signUpSubmit: a,
|
|
100
|
+
resetPasswordSubmit: k,
|
|
101
|
+
currentView: c,
|
|
102
|
+
authSignInLoading: e,
|
|
103
|
+
authSignUpLoading: s,
|
|
104
|
+
resetPasswordLoading: f,
|
|
105
|
+
switchSignUp: I,
|
|
106
|
+
switchResetPassword: U,
|
|
107
|
+
switchSignIn: P,
|
|
108
|
+
addSignInCallback: E,
|
|
109
|
+
addSignUpCallback: V,
|
|
110
|
+
addResetPasswordCallback: F,
|
|
111
|
+
// 简化的token管理
|
|
112
|
+
jwtToken: b(u),
|
|
113
|
+
getToken: j,
|
|
114
|
+
setToken: g,
|
|
115
|
+
initializeAuth: C,
|
|
116
|
+
clearAuth: $
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function D(e) {
|
|
120
|
+
return console.log(l.authPrefixUrl, "globalConfig.authPrefixUrl"), i({
|
|
121
|
+
url: `${l.authPrefixUrl}/restfulApi/users/profile`,
|
|
122
|
+
method: "post",
|
|
123
|
+
data: e
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function q(e) {
|
|
127
|
+
return i({
|
|
128
|
+
url: `${l.authPrefixUrl}/restfulApi/users/update/baseInfo`,
|
|
129
|
+
method: "post",
|
|
130
|
+
data: e
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function G(e) {
|
|
134
|
+
return i({
|
|
135
|
+
url: `${l.authPrefixUrl}/restfulApi/users/update/email`,
|
|
136
|
+
method: "post",
|
|
137
|
+
data: e
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function H(e) {
|
|
141
|
+
return i({
|
|
142
|
+
url: `${l.authPrefixUrl}/restfulApi/users/update/password`,
|
|
143
|
+
method: "post",
|
|
144
|
+
data: e
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function J() {
|
|
148
|
+
return i({
|
|
149
|
+
url: `${l.authPrefixUrl}/restfulApi/users//unbind/email`,
|
|
150
|
+
method: "post"
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function K() {
|
|
154
|
+
return i({
|
|
155
|
+
url: `${l.prefixUrl}/restfulApi/users/myDependencies`,
|
|
156
|
+
method: "post"
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function O(e) {
|
|
160
|
+
return i({
|
|
161
|
+
url: `${l.authPrefixUrl}/restfulApi/users/deleteAccount`,
|
|
162
|
+
method: "post",
|
|
163
|
+
data: e
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const o = t(null), p = t(!1), d = t(!1), R = A(() => !!o.value);
|
|
167
|
+
async function z() {
|
|
168
|
+
var h;
|
|
169
|
+
const {
|
|
170
|
+
getToken: e,
|
|
171
|
+
clearAuth: s
|
|
172
|
+
} = L();
|
|
173
|
+
if (!e()) {
|
|
174
|
+
console.warn("No authentication token found"), o.value = null;
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
p.value = !0, d.value = !1;
|
|
178
|
+
try {
|
|
179
|
+
const {
|
|
180
|
+
data: a
|
|
181
|
+
} = await D();
|
|
182
|
+
p.value = !1, a ? (o.value = a, d.value = !0) : (console.warn("获取用户资料返回空数据"), o.value = null, d.value = !1);
|
|
183
|
+
} catch (a) {
|
|
184
|
+
p.value = !1, d.value = !1, console.error("获取用户资料失败:", a), ((h = a == null ? void 0 : a.response) == null ? void 0 : h.status) === 401 && (console.warn("认证已过期,清除认证状态"), s()), o.value = null;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function B() {
|
|
188
|
+
o.value = null;
|
|
189
|
+
}
|
|
190
|
+
function Q() {
|
|
191
|
+
return {
|
|
192
|
+
userProfile: o,
|
|
193
|
+
loading: p,
|
|
194
|
+
usersProfileSuccess: d,
|
|
195
|
+
isLoggedIn: R,
|
|
196
|
+
// 新增:基于userProfile的登录状态
|
|
197
|
+
fetchUserProfile: z,
|
|
198
|
+
clearUserProfile: B
|
|
199
|
+
// 新增:清除用户信息的方法
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export {
|
|
203
|
+
Q as a,
|
|
204
|
+
D as b,
|
|
205
|
+
q as c,
|
|
206
|
+
H as d,
|
|
207
|
+
G as e,
|
|
208
|
+
J as f,
|
|
209
|
+
K as g,
|
|
210
|
+
O as h,
|
|
211
|
+
L as u
|
|
212
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref as I, computed as d, watch as V, toValue as G, isRef as B, hasInjectionContext as F, inject as J, watchEffect as Q, getCurrentInstance as Z, onBeforeUnmount as X, onDeactivated as Y, onActivated as ee } from "vue";
|
|
2
2
|
import { useRouter as x, useRoute as R } from "vue-router";
|
|
3
3
|
import { u as U } from "./useAuthkitAppsAuthPageInfo-h9CL-MmH.js";
|
|
4
|
-
import { a as D } from "./useAuthkitUsersProfile-
|
|
4
|
+
import { a as D } from "./useAuthkitUsersProfile-B_uMdnat.js";
|
|
5
5
|
const v = I({
|
|
6
6
|
key: "",
|
|
7
7
|
name: ""
|
package/dist/user.js
CHANGED