@huyooo/ui 0.4.22 → 0.4.24

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.
Files changed (34) hide show
  1. package/dist/{AuthkitAppSetting-MYrqMZAf.js → AuthkitAppSetting-BFCdC1j2.js} +114 -88
  2. package/dist/{AuthkitAuthorize-CCSa1q9E.js → AuthkitAuthorize-p0mbjzzG.js} +6 -5
  3. package/dist/Clipboard-Bful1lNJ.js +558 -0
  4. package/dist/{FeedbackItem-DKowiTJj.js → FeedbackItem-MY9mxyf6.js} +1 -1
  5. package/dist/FeedbackModal-CMmvJOi1.js +1164 -0
  6. package/dist/{Menu-MZJINp6f.js → Menu-Cxo8Rpu3.js} +11 -11
  7. package/dist/{MessageHandle-BLiqnTvy.js → MessageHandle-DN_JsQb2.js} +1 -1
  8. package/dist/{MessageMenu-x26lfAeK.js → MessageMenu-_RZJ9Mbi.js} +15 -15
  9. package/dist/ReferrerReferees-BZqtRuiP.js +186 -0
  10. package/dist/{UserPanel-BOg71izt.js → UserPanel-BL8qPaxq.js} +17 -16
  11. package/dist/authkit.js +12 -11
  12. package/dist/common/referrerOptions.d.ts +0 -4
  13. package/dist/common.js +4 -4
  14. package/dist/components/User/UserPanel.vue.d.ts +45 -45
  15. package/dist/composables/Authkit/useAuthkitAuth.d.ts +1 -0
  16. package/dist/composables/Authkit/useAuthkitUsersProfile.d.ts +0 -6
  17. package/dist/composables.js +20 -19
  18. package/dist/feedback.d.ts +1 -1
  19. package/dist/feedback.js +13 -12
  20. package/dist/index.js +130 -128
  21. package/dist/message.js +2 -2
  22. package/dist/referrer.js +1 -1
  23. package/dist/style.css +1 -1
  24. package/dist/styles.d.ts +1 -1
  25. package/dist/styles.js +1 -4
  26. package/dist/types/api.d.ts +1 -2
  27. package/dist/useAuthkitProps-CW3Jem_o.js +160 -0
  28. package/dist/useAuthkitUsersProfile-Diituvy1.js +227 -0
  29. package/dist/user.js +1 -1
  30. package/package.json +1 -1
  31. package/dist/FeedbackModal-BvIlQ5Qe.js +0 -1712
  32. package/dist/ReferrerReferees-E5Sq9dVw.js +0 -185
  33. package/dist/useAuthkitProps-BM6B7mZP.js +0 -384
  34. /package/dist/components/{Feedback/FeedbackClipboard.vue.d.ts → Clipboard.vue.d.ts} +0 -0
package/dist/styles.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const stylePath = "~/styles/var.css";
1
+ export {};
package/dist/styles.js CHANGED
@@ -1,4 +1 @@
1
- const s = "~/styles/var.css";
2
- export {
3
- s as stylePath
4
- };
1
+
@@ -49,8 +49,7 @@ export interface SignUpParams {
49
49
  password: string;
50
50
  userToken: string;
51
51
  emailVerifyId: string;
52
- source?: string;
53
- isRecommend?: boolean;
52
+ referrerId?: string;
54
53
  }
55
54
  export interface ResetPasswordParams {
56
55
  email: string;
@@ -0,0 +1,160 @@
1
+ import { ref as n, computed as s } from "vue";
2
+ import { api as f } from "@huyooo/api";
3
+ function m(i, a) {
4
+ return f({
5
+ url: `${i}/restfulApi/apps/findOne`,
6
+ method: "post",
7
+ data: a
8
+ });
9
+ }
10
+ function v() {
11
+ return f({
12
+ url: "/restfulApi/apps/authPageInfo",
13
+ method: "post"
14
+ });
15
+ }
16
+ const o = n({
17
+ id: "",
18
+ appKey: "",
19
+ name: "",
20
+ description: "",
21
+ homePageUrl: "",
22
+ applicationLogo: "",
23
+ applicationLogoUrl: "",
24
+ oauth: {
25
+ google: {
26
+ // redirectURI: '',
27
+ // clientID: '',
28
+ // clientSecret: '',
29
+ enabled: !1
30
+ },
31
+ microsoft: {
32
+ // redirectURI: '',
33
+ // clientID: '',
34
+ // clientSecret: '',
35
+ enabled: !1
36
+ },
37
+ github: {
38
+ // redirectURI: '',
39
+ // clientID: '',
40
+ // clientSecret: '',
41
+ enabled: !1
42
+ },
43
+ wechat: {
44
+ // redirectURI: '',
45
+ // clientID: '',
46
+ // clientSecret: '',
47
+ enabled: !1
48
+ }
49
+ },
50
+ authorizationCallback: "",
51
+ aboutUs: {
52
+ // 个人信息收集清单
53
+ personalInformationCollectionList: {
54
+ type: "doc",
55
+ content: []
56
+ },
57
+ // 第三方信息共享清单
58
+ thirdPartyInformationSharingList: {
59
+ type: "doc",
60
+ content: []
61
+ },
62
+ // 用户服务协议
63
+ userServiceAgreement: {
64
+ type: "doc",
65
+ content: []
66
+ },
67
+ // 隐私协议
68
+ privacyPolicy: {
69
+ type: "doc",
70
+ content: []
71
+ },
72
+ // 证照信息
73
+ licenseInformation: {
74
+ type: "doc",
75
+ content: []
76
+ }
77
+ },
78
+ brand: {
79
+ theme: "dark",
80
+ logo: "",
81
+ favicon: "",
82
+ backgroundType: "image",
83
+ backgroundColor: "",
84
+ backgroundImageUrl: "",
85
+ backgroundImage: "/66a0d5b35203890887f0e1a4/6714e2458fe86895bf3da8ae/1ef8ed72-1731-6e00-93d1-fa24165f1a3e.webp"
86
+ }
87
+ });
88
+ function I() {
89
+ function i(a) {
90
+ v().then(({
91
+ data: e
92
+ }) => {
93
+ o.value.id = e.id, o.value.appKey = e.appKey, o.value.name = e.name, o.value.description = e.description, o.value.homePageUrl = e.homePageUrl, o.value.applicationLogo = e.applicationLogo, o.value.applicationLogoUrl = e.applicationLogoUrl, o.value.oauth = e.oauth, o.value.authorizationCallback = e.authorizationCallback, o.value.aboutUs = e.aboutUs, o.value.brand = e.brand, a && a();
94
+ }).catch((e) => {
95
+ console.error("获取应用认证页面信息失败:", e);
96
+ });
97
+ }
98
+ return {
99
+ appsData: o,
100
+ appsAuthPageInfoApi: i
101
+ };
102
+ }
103
+ const b = n(!1);
104
+ function A() {
105
+ return {
106
+ show: b
107
+ };
108
+ }
109
+ const u = n(""), p = n("/api"), l = n(""), r = n(""), c = n("ap-beijing");
110
+ function d() {
111
+ const i = [], a = [];
112
+ return u.value || (i.push("appId"), a.push("appId is required for Authkit")), r.value || (i.push("bucketId"), a.push("bucketId is required for Authkit")), l.value || (i.push("bucket"), a.push("bucket is required for Authkit")), u.value && !/^[a-zA-Z0-9]{24}$/.test(u.value) && a.push("appId format is invalid (should be 24 character alphanumeric)"), r.value && !/^[a-zA-Z0-9]{24}$/.test(r.value) && a.push("bucketId format is invalid (should be 24 character alphanumeric)"), {
113
+ isValid: i.length === 0 && a.length === 0,
114
+ missingFields: i,
115
+ errors: a
116
+ };
117
+ }
118
+ function U() {
119
+ const i = s(() => d()), a = s(() => ({
120
+ appId: u.value,
121
+ prefixUrl: p.value,
122
+ bucket: l.value,
123
+ bucketId: r.value,
124
+ region: c.value
125
+ }));
126
+ function e(t) {
127
+ t.appId !== void 0 && (u.value = t.appId), t.prefixUrl !== void 0 && (p.value = t.prefixUrl), t.bucket !== void 0 && (l.value = t.bucket), t.bucketId !== void 0 && (r.value = t.bucketId), t.region !== void 0 && (c.value = t.region);
128
+ }
129
+ function h() {
130
+ const t = d();
131
+ if (!t.isValid)
132
+ throw new Error(`Authkit configuration incomplete: ${t.errors.join(", ")}`);
133
+ return {
134
+ appId: u.value,
135
+ prefixUrl: p.value,
136
+ bucket: l.value,
137
+ bucketId: r.value,
138
+ region: c.value
139
+ };
140
+ }
141
+ return {
142
+ // 原有的 ref 访问方式(向后兼容)
143
+ appId: u,
144
+ prefixUrl: p,
145
+ bucket: l,
146
+ bucketId: r,
147
+ region: c,
148
+ // 新增的类型安全功能
149
+ config: a,
150
+ validation: i,
151
+ setConfig: e,
152
+ getRequiredConfig: h
153
+ };
154
+ }
155
+ export {
156
+ I as U,
157
+ U as a,
158
+ m as b,
159
+ A as u
160
+ };
@@ -0,0 +1,227 @@
1
+ import { ref as u, readonly as A, computed as U } from "vue";
2
+ import { api as r } from "@huyooo/api";
3
+ function P(e) {
4
+ return r({
5
+ url: "/restfulApi/auth/signIn",
6
+ method: "post",
7
+ data: e
8
+ });
9
+ }
10
+ function T(e) {
11
+ return r({
12
+ url: "/restfulApi/auth/resetPassword",
13
+ method: "post",
14
+ data: e
15
+ });
16
+ }
17
+ function b(e) {
18
+ return r({
19
+ url: "/restfulApi/auth/signUp",
20
+ method: "post",
21
+ data: e
22
+ });
23
+ }
24
+ function D(e) {
25
+ return r({
26
+ url: "/restfulApi/oauth2/authorize",
27
+ method: "post",
28
+ data: e
29
+ });
30
+ }
31
+ const i = u("signIn"), p = [], g = [], m = [], l = u(null);
32
+ function y() {
33
+ try {
34
+ const e = localStorage.getItem("jwtToken");
35
+ if (e)
36
+ return l.value = e, !0;
37
+ } catch (e) {
38
+ console.warn("Failed to access localStorage:", e);
39
+ }
40
+ return !1;
41
+ }
42
+ function j() {
43
+ if (l.value)
44
+ return l.value;
45
+ try {
46
+ const e = localStorage.getItem("jwtToken");
47
+ return e && (l.value = e), e;
48
+ } catch (e) {
49
+ return console.warn("Failed to access localStorage:", e), null;
50
+ }
51
+ }
52
+ function h(e) {
53
+ l.value = e;
54
+ try {
55
+ localStorage.setItem("jwtToken", e);
56
+ } catch (a) {
57
+ console.warn("Failed to save token to localStorage:", a);
58
+ }
59
+ }
60
+ function C() {
61
+ l.value = null;
62
+ try {
63
+ localStorage.removeItem("jwtToken");
64
+ } catch (e) {
65
+ console.warn("Failed to clear localStorage:", e);
66
+ }
67
+ }
68
+ function E(e) {
69
+ p.push(e);
70
+ }
71
+ function V(e) {
72
+ g.push(e);
73
+ }
74
+ function F(e) {
75
+ m.push(e);
76
+ }
77
+ function L() {
78
+ const e = u(!1), a = u(!1), c = u(!1);
79
+ function f(n) {
80
+ e.value = !0, P({
81
+ email: n.email,
82
+ password: n.password
83
+ }).then(({
84
+ data: t
85
+ }) => {
86
+ e.value = !1, h(t.jwtToken), p.forEach((S) => S(t));
87
+ }).catch((t) => {
88
+ e.value = !1, console.error("登录失败:", t);
89
+ });
90
+ }
91
+ function o(n) {
92
+ a.value = !0, b({
93
+ email: n.email,
94
+ userToken: n.userToken,
95
+ emailVerifyId: n.emailVerifyId,
96
+ password: n.password,
97
+ referrerId: n.referrerId
98
+ }).then(() => {
99
+ a.value = !1, i.value = "signIn", g.forEach((t) => t());
100
+ }).catch((t) => {
101
+ a.value = !1, console.error("注册失败:", t);
102
+ });
103
+ }
104
+ function w(n) {
105
+ c.value = !0, T({
106
+ email: n.email,
107
+ userToken: n.userToken,
108
+ emailVerifyId: n.emailVerifyId,
109
+ password: n.password
110
+ }).then(() => {
111
+ c.value = !1, i.value = "signIn", m.forEach((t) => t());
112
+ }).catch((t) => {
113
+ c.value = !1, console.error("重置密码失败:", t);
114
+ });
115
+ }
116
+ function v() {
117
+ i.value = "signUp";
118
+ }
119
+ function k() {
120
+ i.value = "resetPassword";
121
+ }
122
+ function I() {
123
+ i.value = "signIn";
124
+ }
125
+ return {
126
+ signInSubmit: f,
127
+ signUpSubmit: o,
128
+ resetPasswordSubmit: w,
129
+ currentView: i,
130
+ authSignInLoading: e,
131
+ authSignUpLoading: a,
132
+ resetPasswordLoading: c,
133
+ switchSignUp: v,
134
+ switchResetPassword: k,
135
+ switchSignIn: I,
136
+ addSignInCallback: E,
137
+ addSignUpCallback: V,
138
+ addResetPasswordCallback: F,
139
+ // 简化的token管理
140
+ jwtToken: A(l),
141
+ getToken: j,
142
+ setToken: h,
143
+ initializeAuth: y,
144
+ clearAuth: C
145
+ };
146
+ }
147
+ function z(e) {
148
+ return r({
149
+ url: "/restfulApi/users/profile",
150
+ method: "post",
151
+ data: e
152
+ });
153
+ }
154
+ function G(e) {
155
+ return r({
156
+ url: "/restfulApi/users/update/baseInfo",
157
+ method: "post",
158
+ data: e
159
+ });
160
+ }
161
+ function H(e) {
162
+ return r({
163
+ url: "/restfulApi/users/update/email",
164
+ method: "post",
165
+ data: e
166
+ });
167
+ }
168
+ function J(e) {
169
+ return r({
170
+ url: "/restfulApi/users/update/password",
171
+ method: "post",
172
+ data: e
173
+ });
174
+ }
175
+ function K() {
176
+ return r({
177
+ url: "/restfulApi/users//unbind/email",
178
+ method: "post"
179
+ });
180
+ }
181
+ const s = u(null), d = u(!1), R = U(() => !!s.value);
182
+ async function x() {
183
+ var f;
184
+ const {
185
+ getToken: e,
186
+ clearAuth: a
187
+ } = L();
188
+ if (!e()) {
189
+ console.warn("No authentication token found"), s.value = null;
190
+ return;
191
+ }
192
+ d.value = !0;
193
+ try {
194
+ const {
195
+ data: o
196
+ } = await z();
197
+ o ? s.value = o : (console.warn("获取用户资料返回空数据"), s.value = null);
198
+ } catch (o) {
199
+ console.error("获取用户资料失败:", o), ((f = o == null ? void 0 : o.response) == null ? void 0 : f.status) === 401 && (console.warn("认证已过期,清除认证状态"), a()), s.value = null;
200
+ } finally {
201
+ d.value = !1;
202
+ }
203
+ }
204
+ function B() {
205
+ s.value = null;
206
+ }
207
+ function M() {
208
+ return {
209
+ userProfile: s,
210
+ loading: d,
211
+ isLoggedIn: R,
212
+ // 新增:基于userProfile的登录状态
213
+ fetchUserProfile: x,
214
+ clearUserProfile: B
215
+ // 新增:清除用户信息的方法
216
+ };
217
+ }
218
+ export {
219
+ M as a,
220
+ z as b,
221
+ G as c,
222
+ J as d,
223
+ H as e,
224
+ K as f,
225
+ D as o,
226
+ L as u
227
+ };
package/dist/user.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as r, c as e, a as o, U as n, S as t } from "./UserPanel-BOg71izt.js";
1
+ import { b as r, c as e, a as o, U as n, S as t } from "./UserPanel-BL8qPaxq.js";
2
2
  import { u as i } from "./useUserPanelProps-C5W72fZJ.js";
3
3
  export {
4
4
  r as UserAvatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/ui",
3
- "version": "0.4.22",
3
+ "version": "0.4.24",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [