@huyooo/ui 0.5.10 → 0.5.13

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/main.d.ts CHANGED
@@ -11,3 +11,4 @@ export * from './user';
11
11
  export * from './download';
12
12
  export * from './privateCom';
13
13
  export { createHead } from '@unhead/vue/client';
14
+ export { default as request } from './utils/request';
package/dist/referrer.js CHANGED
@@ -1,4 +1,4 @@
1
- import { R as f } from "./ReferrerReferees-D3qUZ62t.js";
1
+ import { R as f } from "./ReferrerReferees-Bn3bKc0N.js";
2
2
  export {
3
3
  f as ReferrerReferees
4
4
  };
@@ -1,35 +1,44 @@
1
- import { ref as u, readonly as S, computed as A } from "vue";
2
- import { api as a } from "@huyooo/api";
1
+ import { ref as l, readonly as S, computed as A } from "vue";
2
+ import { api as o } from "@huyooo/api";
3
3
  import { g as n } from "./globalConfig-C1YOJcxa.js";
4
- function b(e) {
5
- return a({
4
+ function T(e) {
5
+ return o({
6
6
  url: `${n.authPrefixUrl}/restfulApi/auth/signIn`,
7
7
  method: "post",
8
8
  data: e
9
9
  });
10
10
  }
11
- function T(e) {
12
- return a({
11
+ function b(e) {
12
+ return o({
13
13
  url: `${n.authPrefixUrl}/restfulApi/auth/resetPassword`,
14
14
  method: "post",
15
15
  data: e
16
16
  });
17
17
  }
18
18
  function x(e) {
19
- return a({
19
+ return o({
20
20
  url: `${n.authPrefixUrl}/restfulApi/auth/signUp`,
21
21
  method: "post",
22
22
  data: e
23
23
  });
24
24
  }
25
25
  function G(e) {
26
- return a({
26
+ return o({
27
27
  url: `${n.authPrefixUrl}/restfulApi/oauth2/authorize`,
28
28
  method: "post",
29
29
  data: e
30
30
  });
31
31
  }
32
- const c = u("signIn"), g = [], m = [], w = [], i = u(null);
32
+ function H(e) {
33
+ return o({
34
+ url: "/restfulApi/auth/refresh",
35
+ method: "post",
36
+ data: {
37
+ refreshToken: e
38
+ }
39
+ });
40
+ }
41
+ const c = l("signIn"), g = [], m = [], w = [], i = l(null);
33
42
  function y() {
34
43
  try {
35
44
  const e = localStorage.getItem("jwtToken");
@@ -54,8 +63,8 @@ function p(e) {
54
63
  i.value = e;
55
64
  try {
56
65
  localStorage.setItem("jwtToken", e);
57
- } catch (l) {
58
- console.warn("Failed to save token to localStorage:", l);
66
+ } catch (s) {
67
+ console.warn("Failed to save token to localStorage:", s);
59
68
  }
60
69
  }
61
70
  function C() {
@@ -76,9 +85,9 @@ function V(e) {
76
85
  w.push(e);
77
86
  }
78
87
  function F() {
79
- const e = u(!1), l = u(!1), f = u(!1);
88
+ const e = l(!1), s = l(!1), f = l(!1);
80
89
  function h(r) {
81
- e.value = !0, b({
90
+ e.value = !0, T({
82
91
  email: r.email,
83
92
  password: r.password
84
93
  }).then(({
@@ -89,21 +98,21 @@ function F() {
89
98
  e.value = !1, console.error("登录失败:", t);
90
99
  });
91
100
  }
92
- function o(r) {
93
- l.value = !0, x({
101
+ function a(r) {
102
+ s.value = !0, x({
94
103
  email: r.email,
95
104
  userToken: r.userToken,
96
105
  emailVerifyId: r.emailVerifyId,
97
106
  password: r.password,
98
107
  referrerId: r.referrerId
99
108
  }).then(() => {
100
- l.value = !1, c.value = "signIn", m.forEach((t) => t());
109
+ s.value = !1, c.value = "signIn", m.forEach((t) => t());
101
110
  }).catch((t) => {
102
- l.value = !1, console.error("注册失败:", t);
111
+ s.value = !1, console.error("注册失败:", t);
103
112
  });
104
113
  }
105
114
  function v(r) {
106
- f.value = !0, T({
115
+ f.value = !0, b({
107
116
  email: r.email,
108
117
  userToken: r.userToken,
109
118
  emailVerifyId: r.emailVerifyId,
@@ -125,11 +134,11 @@ function F() {
125
134
  }
126
135
  return {
127
136
  signInSubmit: h,
128
- signUpSubmit: o,
137
+ signUpSubmit: a,
129
138
  resetPasswordSubmit: v,
130
139
  currentView: c,
131
140
  authSignInLoading: e,
132
- authSignUpLoading: l,
141
+ authSignUpLoading: s,
133
142
  resetPasswordLoading: f,
134
143
  switchSignUp: k,
135
144
  switchResetPassword: U,
@@ -146,68 +155,68 @@ function F() {
146
155
  };
147
156
  }
148
157
  function L(e) {
149
- return console.log(n.authPrefixUrl, "globalConfig.authPrefixUrl"), a({
158
+ return console.log(n.authPrefixUrl, "globalConfig.authPrefixUrl"), o({
150
159
  url: `${n.authPrefixUrl}/restfulApi/users/profile`,
151
160
  method: "post",
152
161
  data: e
153
162
  });
154
163
  }
155
- function H(e) {
156
- return a({
164
+ function J(e) {
165
+ return o({
157
166
  url: `${n.authPrefixUrl}/restfulApi/users/update/baseInfo`,
158
167
  method: "post",
159
168
  data: e
160
169
  });
161
170
  }
162
- function J(e) {
163
- return a({
171
+ function K(e) {
172
+ return o({
164
173
  url: `${n.authPrefixUrl}/restfulApi/users/update/email`,
165
174
  method: "post",
166
175
  data: e
167
176
  });
168
177
  }
169
- function K(e) {
170
- return a({
178
+ function M(e) {
179
+ return o({
171
180
  url: `${n.authPrefixUrl}/restfulApi/users/update/password`,
172
181
  method: "post",
173
182
  data: e
174
183
  });
175
184
  }
176
- function M() {
177
- return a({
185
+ function O() {
186
+ return o({
178
187
  url: `${n.authPrefixUrl}/restfulApi/users//unbind/email`,
179
188
  method: "post"
180
189
  });
181
190
  }
182
- const s = u(null), d = u(!1), z = A(() => !!s.value);
191
+ const u = l(null), d = l(!1), z = A(() => !!u.value);
183
192
  async function R() {
184
193
  var h;
185
194
  const {
186
195
  getToken: e,
187
- clearAuth: l
196
+ clearAuth: s
188
197
  } = F();
189
198
  if (!e()) {
190
- console.warn("No authentication token found"), s.value = null;
199
+ console.warn("No authentication token found"), u.value = null;
191
200
  return;
192
201
  }
193
202
  d.value = !0;
194
203
  try {
195
204
  const {
196
- data: o
205
+ data: a
197
206
  } = await L();
198
- o ? s.value = o : (console.warn("获取用户资料返回空数据"), s.value = null);
199
- } catch (o) {
200
- console.error("获取用户资料失败:", o), ((h = o == null ? void 0 : o.response) == null ? void 0 : h.status) === 401 && (console.warn("认证已过期,清除认证状态"), l()), s.value = null;
207
+ a ? u.value = a : (console.warn("获取用户资料返回空数据"), u.value = null);
208
+ } catch (a) {
209
+ console.error("获取用户资料失败:", a), ((h = a == null ? void 0 : a.response) == null ? void 0 : h.status) === 401 && (console.warn("认证已过期,清除认证状态"), s()), u.value = null;
201
210
  } finally {
202
211
  d.value = !1;
203
212
  }
204
213
  }
205
214
  function B() {
206
- s.value = null;
215
+ u.value = null;
207
216
  }
208
- function O() {
217
+ function Q() {
209
218
  return {
210
- userProfile: s,
219
+ userProfile: u,
211
220
  loading: d,
212
221
  isLoggedIn: z,
213
222
  // 新增:基于userProfile的登录状态
@@ -217,12 +226,13 @@ function O() {
217
226
  };
218
227
  }
219
228
  export {
220
- O as a,
229
+ Q as a,
221
230
  L as b,
222
- H as c,
223
- K as d,
224
- J as e,
225
- M as f,
231
+ J as c,
232
+ M as d,
233
+ K as e,
234
+ O as f,
226
235
  G as o,
236
+ H as r,
227
237
  F as u
228
238
  };
@@ -9,7 +9,7 @@ import "@arco-design/web-vue";
9
9
  import "./useUploadCos-D5k1YLb7.js";
10
10
  import "@huyooo/api";
11
11
  import "./AuthkitAuthModal.vue_vue_type_style_index_1_lang-BpOmabWi.js";
12
- import { a as E } from "./useAuthkitUsersProfile-Bi_zM2qG.js";
12
+ import { a as E } from "./useAuthkitUsersProfile-C0ZRUQ3T.js";
13
13
  import "@iconify/vue";
14
14
  /* empty css */
15
15
  import { u as O } from "./useAuthkitAppsAuthPageInfo-Dfj4byB5.js";
package/dist/user.js CHANGED
@@ -1,5 +1,5 @@
1
- import { U as r, a as e, b as o, c as n, S as t } from "./UserPanel-DHXkFUTF.js";
2
- import { U as c } from "./UserAccountMenu-50CxuyL3.js";
1
+ import { U as r, a as e, b as o, c as n, S as t } from "./UserPanel-DzSB8_xh.js";
2
+ import { U as c } from "./UserAccountMenu-CjajHECj.js";
3
3
  export {
4
4
  c as UserAccountMenu,
5
5
  r as UserAvatar,
@@ -6,3 +6,10 @@ export declare function findLabel(options: Array<{
6
6
  label: string;
7
7
  } | undefined;
8
8
  export declare function hideEmail(email: string, prefixLength?: number): string;
9
+ export declare function clearAuth(): void;
10
+ export declare function setAuth(tokens: {
11
+ jwtToken: string;
12
+ refreshToken: string;
13
+ }): void;
14
+ export declare function getRefreshToken(): string | null;
15
+ export declare function updateJwtToken(jwtToken: string): void;
@@ -0,0 +1,2 @@
1
+ import { api } from '@huyooo/api';
2
+ export default api;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ui",
3
- "version": "0.5.10",
3
+ "version": "0.5.13",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [