@huyooo/ui 0.5.59 → 0.5.60

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.
@@ -63,7 +63,7 @@ const H = {
63
63
  } : {
64
64
  backgroundImage: `url(${r.backgroundImage})`
65
65
  });
66
- return (a, p) => (m(), f("div", {
66
+ return (o, p) => (m(), f("div", {
67
67
  class: "auth",
68
68
  style: C(t.value)
69
69
  }, [e("div", H, [r.name ? (m(), f("a", {
@@ -74,7 +74,7 @@ const H = {
74
74
  style: C({
75
75
  color: r.linkColor
76
76
  })
77
- }, " 返回主页 ", 12, j)) : T("", !0)]), e("div", K, [O(a.$slots, "default", {}, void 0, !0)])], 4));
77
+ }, " 返回主页 ", 12, j)) : T("", !0)]), e("div", K, [O(o.$slots, "default", {}, void 0, !0)])], 4));
78
78
  }
79
79
  }), _e = /* @__PURE__ */ q(G, [["__scopeId", "data-v-203946ff"]]), J = {
80
80
  class: "box"
@@ -138,7 +138,7 @@ const H = {
138
138
  }
139
139
  },
140
140
  setup(g) {
141
- const r = _(!1), t = g, a = _({
141
+ const r = _(!1), t = g, o = _({
142
142
  appKey: "",
143
143
  name: "",
144
144
  homePageUrl: "",
@@ -151,7 +151,7 @@ const H = {
151
151
  }).then(({
152
152
  data: l
153
153
  }) => {
154
- a.value = l;
154
+ o.value = l;
155
155
  }).catch((l) => {
156
156
  console.error("获取应用信息失败:", l);
157
157
  });
@@ -172,12 +172,12 @@ const H = {
172
172
  r.value = !1, console.error("授权失败:", l);
173
173
  });
174
174
  }
175
- return (l, u) => (m(), f("div", J, [e("div", Q, y(`授权 ${a.value.name}`), 1), e("div", W, [i(s(N), null, {
175
+ return (l, u) => (m(), f("div", J, [e("div", Q, y(`授权 ${o.value.name}`), 1), e("div", W, [i(s(N), null, {
176
176
  default: d(() => [i(s(w), null, {
177
177
  default: d(() => {
178
178
  var h;
179
179
  return [i(s(S), {
180
- title: a.value.name,
180
+ title: o.value.name,
181
181
  description: `想要使用您的${(h = t.userInfo) == null ? void 0 : h.nickname}账户`
182
182
  }, {
183
183
  avatar: d(() => {
@@ -240,7 +240,7 @@ const H = {
240
240
  color: "#888",
241
241
  "font-size": "12px"
242
242
  }
243
- }, "授权后将跳转至", -1)), e("div", Y, y(a.value.authorizationCallback), 1)])])]));
243
+ }, "授权后将跳转至", -1)), e("div", Y, y(o.value.authorizationCallback), 1)])])]));
244
244
  }
245
245
  }), ye = /* @__PURE__ */ q(Z, [["__scopeId", "data-v-cc821ddc"]]), ee = {
246
246
  class: "oauth-callback"
@@ -250,11 +250,11 @@ const H = {
250
250
  }, re = {
251
251
  key: 1,
252
252
  class: "callback-error"
253
- }, oe = {
253
+ }, ae = {
254
254
  key: 2,
255
255
  class: "callback-success"
256
- }, ae = /* @__PURE__ */ A({
257
- __name: "AuthkitOAuthCallback",
256
+ }, oe = /* @__PURE__ */ A({
257
+ __name: "AuthkitOauthCallback",
258
258
  props: {
259
259
  defaultRedirect: {},
260
260
  loadingText: {}
@@ -263,27 +263,27 @@ const H = {
263
263
  setup(g, {
264
264
  emit: r
265
265
  }) {
266
- const t = g, a = r, p = _(!0), n = _(""), {
266
+ const t = g, o = r, p = _(!0), n = _(""), {
267
267
  setToken: l,
268
268
  initializeAuth: u
269
269
  } = E(), {
270
270
  fetchUserProfile: h
271
271
  } = F();
272
272
  async function v() {
273
- const c = new URLSearchParams(window.location.search), o = c.get("error");
274
- if (o) {
275
- n.value = decodeURIComponent(o), p.value = !1, a("error", n.value);
273
+ const c = new URLSearchParams(window.location.search), a = c.get("error");
274
+ if (a) {
275
+ n.value = decodeURIComponent(a), p.value = !1, o("error", n.value);
276
276
  return;
277
277
  }
278
278
  const k = c.get("token"), $ = c.get("userId"), x = c.get("appId");
279
279
  if (!k) {
280
- n.value = "登录失败:未收到认证令牌", p.value = !1, a("error", n.value);
280
+ n.value = "登录失败:未收到认证令牌", p.value = !1, o("error", n.value);
281
281
  return;
282
282
  }
283
283
  try {
284
284
  l(k), await h();
285
285
  const b = window.location.pathname;
286
- window.history.replaceState({}, "", b), a("success", {
286
+ window.history.replaceState({}, "", b), o("success", {
287
287
  token: k,
288
288
  userId: $ || "",
289
289
  appId: x || ""
@@ -295,7 +295,7 @@ const H = {
295
295
  window.location.href = U;
296
296
  }, 500);
297
297
  } catch (b) {
298
- console.error("OAuth 回调处理失败:", b), n.value = "登录处理失败,请重试", p.value = !1, a("error", n.value);
298
+ console.error("OAuth 回调处理失败:", b), n.value = "登录处理失败,请重试", p.value = !1, o("error", n.value);
299
299
  }
300
300
  }
301
301
  function z() {
@@ -307,22 +307,22 @@ const H = {
307
307
  if (c.has("token") || c.has("error"))
308
308
  v();
309
309
  else if (u()) {
310
- const o = sessionStorage.getItem("auth_redirect");
311
- sessionStorage.removeItem("auth_redirect"), window.location.href = o || t.defaultRedirect || "/";
310
+ const a = sessionStorage.getItem("auth_redirect");
311
+ sessionStorage.removeItem("auth_redirect"), window.location.href = a || t.defaultRedirect || "/";
312
312
  } else
313
313
  n.value = "无效的访问", p.value = !1;
314
- }), (c, o) => (m(), f("div", ee, [p.value ? (m(), f("div", te, [o[0] || (o[0] = e("div", {
314
+ }), (c, a) => (m(), f("div", ee, [p.value ? (m(), f("div", te, [a[0] || (a[0] = e("div", {
315
315
  class: "spinner"
316
- }, null, -1)), e("p", null, y(g.loadingText), 1)])) : n.value ? (m(), f("div", re, [o[1] || (o[1] = e("div", {
316
+ }, null, -1)), e("p", null, y(g.loadingText), 1)])) : n.value ? (m(), f("div", re, [a[1] || (a[1] = e("div", {
317
317
  class: "error-icon"
318
- }, "✕", -1)), o[2] || (o[2] = e("h2", null, "登录失败", -1)), e("p", null, y(n.value), 1), e("button", {
318
+ }, "✕", -1)), a[2] || (a[2] = e("h2", null, "登录失败", -1)), e("p", null, y(n.value), 1), e("button", {
319
319
  class: "retry-btn",
320
320
  onClick: z
321
- }, "返回重试")])) : (m(), f("div", oe, [...o[3] || (o[3] = [e("div", {
321
+ }, "返回重试")])) : (m(), f("div", ae, [...a[3] || (a[3] = [e("div", {
322
322
  class: "success-icon"
323
323
  }, "✓", -1), e("p", null, "登录成功,正在跳转...", -1)])]))]));
324
324
  }
325
- }), ke = /* @__PURE__ */ q(ae, [["__scopeId", "data-v-930630e1"]]);
325
+ }), ke = /* @__PURE__ */ q(oe, [["__scopeId", "data-v-fa89973e"]]);
326
326
  export {
327
327
  _e as A,
328
328
  ye as a,
@@ -8,7 +8,7 @@ import { S as ze } from "./PaySubscriptions-Vj0KnZGv.js";
8
8
  import { R as Ne } from "./ReferrerReferees-D8hYkkAy.js";
9
9
  import { a as N, u as Le } from "./useAuthkitUsersProfile-hZ9L3rYe.js";
10
10
  import { u as je, g as oe } from "./auth-bwwc2iT8.js";
11
- import { c as He, A as Fe } from "./AuthkitAuthModal-BSvtvlyj.js";
11
+ import { c as He, A as Fe } from "./AuthkitAuthModal-DOJxOU01.js";
12
12
  import { d as qe } from "./FeedbackModal-DWJmFtvY.js";
13
13
  import { M as Ee } from "./MessageHandle-BlsLRmdj.js";
14
14
  /* empty css */
@@ -10,7 +10,7 @@ import "./useUploadCos-_xwV40NS.js";
10
10
  import { useRouter as j, useRoute as J } from "vue-router";
11
11
  /* empty css */
12
12
  /* empty css */
13
- import { d as re, c as Q } from "./UserAccountMenu-BWx4hX66.js";
13
+ import { d as re, c as Q } from "./UserAccountMenu-DgvdmbWH.js";
14
14
  /* empty css */
15
15
  /* empty css */
16
16
  /* empty css */
@@ -0,0 +1,12 @@
1
+ interface OauthLoginParams {
2
+ appId: string;
3
+ referrerId?: string;
4
+ redirectUri?: string;
5
+ }
6
+ /** 获取 GitHub OAuth 登录地址(多租户支持) */
7
+ export declare function githubLogin(params: OauthLoginParams): Promise<import('axios').AxiosResponse<any, any>>;
8
+ /** 获取 Google OAuth 登录地址(多租户支持) */
9
+ export declare function googleLogin(params: OauthLoginParams): Promise<import('axios').AxiosResponse<any, any>>;
10
+ /** 获取 Microsoft OAuth 登录地址(多租户支持) */
11
+ export declare function microsoftLogin(params: OauthLoginParams): Promise<import('axios').AxiosResponse<any, any>>;
12
+ export {};
package/dist/authkit.d.ts CHANGED
@@ -7,9 +7,9 @@ export { default as AuthkitSendVerifyCode } from './components/Authkit/AuthkitSe
7
7
  export { default as AuthkitSignIn } from './components/Authkit/Auth/AuthkitSignIn.vue';
8
8
  export { default as AuthkitSignUp } from './components/Authkit/Auth/AuthkitSignUp.vue';
9
9
  export { default as AuthkitAuthorize } from './components/Authkit/Auth/AuthkitAuthorize.vue';
10
- export { default as AuthkitOAuthItem } from './components/Authkit/Auth/AuthkitOAuthItem.vue';
11
- export { default as AuthkitOAuthList } from './components/Authkit/Auth/AuthkitOAuthList.vue';
12
- export { default as AuthkitOAuthCallback } from './components/Authkit/Auth/AuthkitOAuthCallback.vue';
10
+ export { default as AuthkitOauthItem } from './components/Authkit/Auth/AuthkitOauthItem.vue';
11
+ export { default as AuthkitOauthList } from './components/Authkit/Auth/AuthkitOauthList.vue';
12
+ export { default as AuthkitOauthCallback } from './components/Authkit/Auth/AuthkitOauthCallback.vue';
13
13
  export { default as AuthkitPasswordUpdateAndVerify } from './components/Authkit/Auth/AuthkitPasswordUpdateAndVerify.vue';
14
14
  export { default as AuthkitResetPassword } from './components/Authkit/Auth/AuthkitResetPassword.vue';
15
15
  export { default as AuthkitPasswordAuth } from './components/Authkit/Auth/AuthkitPasswordAuth.vue';
@@ -17,6 +17,9 @@ export { default as AuthkitSwitchSignIn } from './components/Authkit/Auth/Authki
17
17
  export { default as AuthkitSwitchSignUpOrResetPassword } from './components/Authkit/Auth/AuthkitSwitchSignUpOrResetPassword.vue';
18
18
  export { default as AuthkitEmailUpdate } from './components/Authkit/Auth/AuthkitEmailUpdate.vue';
19
19
  export { default as AuthkitServiceAgreementAndPrivacyProtection } from './components/Authkit/Auth/AuthkitServiceAgreementAndPrivacyProtection.vue';
20
+ export { default as AuthkitOAuthItem } from './components/Authkit/Auth/AuthkitOauthItem.vue';
21
+ export { default as AuthkitOAuthList } from './components/Authkit/Auth/AuthkitOauthList.vue';
22
+ export { default as AuthkitOAuthCallback } from './components/Authkit/Auth/AuthkitOauthCallback.vue';
20
23
  export { default as AuthkitPersonalInformation } from './components/Authkit/AppSetting/AuthkitPersonalInformation.vue';
21
24
  export { default as AuthkitEmailVerify } from './components/Authkit/AppSetting/AuthkitEmailVerify.vue';
22
25
  export { default as AuthkitGithubBinding } from './components/Authkit/AppSetting/AuthkitGithubBinding.vue';
@@ -28,6 +31,6 @@ export { useAuthkitAuth } from './composables/Authkit/useAuthkitAuth';
28
31
  export { useAuthkitAuthModal } from './composables/Authkit/useAuthkitAuthModal';
29
32
  export { useAuthkitUsersProfile } from './composables/Authkit/useAuthkitUsersProfile';
30
33
  export { useAuthkitCreateAndUpdate } from './composables/Authkit/useAuthkitCreateAndUpdate';
31
- export { useAuthkitOAuth } from './composables/Authkit/useAuthkitOAuth';
34
+ export { useOauth, useAuthkitOAuth } from './composables/Authkit/useOauth';
32
35
  export type * from './types/auth';
33
36
  export type { AppsData, PublicRoute } from './types/app';
package/dist/authkit.js CHANGED
@@ -1,39 +1,43 @@
1
- import { A as a, a as s, c as u, b as A, n as h, E as e, k, l as r, _ as o, O as n, f as d, o as p, P as f, j as m, R as P, S as l, i as S, m as g, d as w, e as c, g as U, h as x, u as O } from "./AuthkitAuthModal-BSvtvlyj.js";
2
- import { A as b, a as y, b as C } from "./AuthkitOAuthCallback-DQ1RAKyR.js";
3
- import { u as R } from "./useAuthkitAppsAuthPageInfo-CzZmhPMm.js";
4
- import { u as v, a as B } from "./useAuthkitUsersProfile-hZ9L3rYe.js";
5
- import { u as j } from "./auth-bwwc2iT8.js";
6
- import { u as G } from "./useAuthkitCreateAndUpdate-Co5wMbv7.js";
1
+ import { A as u, a as i, c as s, b as h, n as A, E as e, k, l as r, _ as o, O as n, _ as d, O as p, f as m, o as f, P as l, j as P, R as O, S, i as g, m as c, d as w, e as U, g as b, h as x, p as I, u as C } from "./AuthkitAuthModal-DOJxOU01.js";
2
+ import { A as E, a as R, b as V, b as v } from "./AuthkitOauthCallback-BnHgrReE.js";
3
+ import { u as L } from "./useAuthkitAppsAuthPageInfo-CzZmhPMm.js";
4
+ import { u as _, a as j } from "./useAuthkitUsersProfile-hZ9L3rYe.js";
5
+ import { u as G } from "./auth-bwwc2iT8.js";
6
+ import { u as q } from "./useAuthkitCreateAndUpdate-Co5wMbv7.js";
7
7
  export {
8
- a as AuthkitAppSetting,
9
- s as AuthkitAuth,
10
- b as AuthkitAuthContainer,
11
- u as AuthkitAuthModal,
12
- A as AuthkitAuthTitle,
13
- y as AuthkitAuthorize,
14
- h as AuthkitEmailBinding,
8
+ u as AuthkitAppSetting,
9
+ i as AuthkitAuth,
10
+ E as AuthkitAuthContainer,
11
+ s as AuthkitAuthModal,
12
+ h as AuthkitAuthTitle,
13
+ R as AuthkitAuthorize,
14
+ A as AuthkitEmailBinding,
15
15
  e as AuthkitEmailUpdate,
16
16
  k as AuthkitEmailVerify,
17
17
  r as AuthkitGithubBinding,
18
- C as AuthkitOAuthCallback,
18
+ V as AuthkitOAuthCallback,
19
19
  o as AuthkitOAuthItem,
20
20
  n as AuthkitOAuthList,
21
- d as AuthkitPasswordAuth,
22
- p as AuthkitPasswordUpdate,
23
- f as AuthkitPasswordUpdateAndVerify,
24
- m as AuthkitPersonalInformation,
25
- P as AuthkitResetPassword,
26
- l as AuthkitSendVerifyCode,
27
- S as AuthkitServiceAgreementAndPrivacyProtection,
28
- g as AuthkitSetPassword,
21
+ v as AuthkitOauthCallback,
22
+ d as AuthkitOauthItem,
23
+ p as AuthkitOauthList,
24
+ m as AuthkitPasswordAuth,
25
+ f as AuthkitPasswordUpdate,
26
+ l as AuthkitPasswordUpdateAndVerify,
27
+ P as AuthkitPersonalInformation,
28
+ O as AuthkitResetPassword,
29
+ S as AuthkitSendVerifyCode,
30
+ g as AuthkitServiceAgreementAndPrivacyProtection,
31
+ c as AuthkitSetPassword,
29
32
  w as AuthkitSignIn,
30
- c as AuthkitSignUp,
31
- U as AuthkitSwitchSignIn,
33
+ U as AuthkitSignUp,
34
+ b as AuthkitSwitchSignIn,
32
35
  x as AuthkitSwitchSignUpOrResetPassword,
33
- R as useAuthkitAppsAuthPageInfo,
34
- v as useAuthkitAuth,
35
- j as useAuthkitAuthModal,
36
- G as useAuthkitCreateAndUpdate,
37
- O as useAuthkitOAuth,
38
- B as useAuthkitUsersProfile
36
+ L as useAuthkitAppsAuthPageInfo,
37
+ _ as useAuthkitAuth,
38
+ G as useAuthkitAuthModal,
39
+ q as useAuthkitCreateAndUpdate,
40
+ I as useAuthkitOAuth,
41
+ j as useAuthkitUsersProfile,
42
+ C as useOauth
39
43
  };
package/dist/common.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as s, a as o, C as t, D as r, G as p, H as n, b as l, L as u, S as C, W as d } from "./WidthContainer-DiEkVFtH.js";
1
+ import { A as s, a as o, C as t, D as r, G as p, H as n, b as l, L as u, S as C, W as d } from "./WidthContainer-BoQWHreP.js";
2
2
  import { C as i, a as f } from "./CollapseItem-Cw1vcdLu.js";
3
3
  import { C as x, E as H } from "./CustomTable-B8i1SbFB.js";
4
4
  import { M, a as g } from "./Menu-BjWB9hre.js";
@@ -1,7 +1,7 @@
1
1
  /** 获取当前 OAuth 回调地址 */
2
- declare function getOAuthCallbackUrl(): string;
2
+ declare function getOauthCallbackUrl(): string;
3
3
  /** 发起 OAuth 登录(通用方法) */
4
- declare function startOAuth(provider: 'github' | 'google' | 'microsoft', options?: {
4
+ declare function startOauth(provider: 'github' | 'google' | 'microsoft', options?: {
5
5
  referrerId?: string;
6
6
  }): Promise<void>;
7
7
  /** GitHub OAuth 登录 */
@@ -10,11 +10,12 @@ declare function githubAuth(referrerId?: string): void;
10
10
  declare function googleAuth(referrerId?: string): void;
11
11
  /** Microsoft OAuth 登录 */
12
12
  declare function microsoftAuth(referrerId?: string): void;
13
- export declare function useAuthkitOAuth(): {
13
+ export declare function useOauth(): {
14
14
  githubAuth: typeof githubAuth;
15
15
  googleAuth: typeof googleAuth;
16
16
  microsoftAuth: typeof microsoftAuth;
17
- startOAuth: typeof startOAuth;
18
- getOAuthCallbackUrl: typeof getOAuthCallbackUrl;
17
+ startOauth: typeof startOauth;
18
+ getOauthCallbackUrl: typeof getOauthCallbackUrl;
19
19
  };
20
+ export declare const useAuthkitOAuth: typeof useOauth;
20
21
  export {};