@huyooo/ui 2.2.4 → 3.0.0

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 (45) hide show
  1. package/dist/{AuthkitAppSetting-ZopA9Gjq.js → AuthkitAppSetting-DhLRYlL_.js} +97 -91
  2. package/dist/{Contact-BdBQ_FA4.js → Contact-CNLjyOCR.js} +3 -3
  3. package/dist/{FeedbackModal.vue_vue_type_script_setup_true_lang-C7vaGD4R.js → FeedbackModal.vue_vue_type_script_setup_true_lang-BXqxUXuu.js} +2 -2
  4. package/dist/{LegalDocViewer-wbdoeWU9.js → LegalDocViewer-DkVW9tCh.js} +622 -625
  5. package/dist/{PaySubscriptions-OZ6OFeQJ.js → PaySubscriptions-tJSQUmhE.js} +1 -1
  6. package/dist/{PricingPlans-Wf4QkUIz.js → PricingPlans-BhcDv8uk.js} +3 -3
  7. package/dist/{ReferrerReferees-DNE-htF1.js → ReferrerReferees-QTZnOCJB.js} +1 -1
  8. package/dist/{Upload.vue_vue_type_script_setup_true_lang-DtciAodp.js → Upload.vue_vue_type_script_setup_true_lang-CZjNlns_.js} +1 -1
  9. package/dist/{UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-ELHt9JGf.js → UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-BQgy_CeZ.js} +5 -5
  10. package/dist/WidthContainer-BEeYYOat.js +688 -0
  11. package/dist/authkit.js +8 -8
  12. package/dist/common/globalConfig.d.ts +5 -0
  13. package/dist/common.js +1 -1
  14. package/dist/components/SvgIcon.vue.d.ts +1 -1
  15. package/dist/composables/Authkit/oauthCallback.d.ts +1 -1
  16. package/dist/composables/Authkit/resolveRoutePermission.d.ts +10 -1
  17. package/dist/composables/Authkit/useAuthkitAppsAuthPageInfo.d.ts +2 -0
  18. package/dist/composables/Authkit/useAuthkitAuth.d.ts +14 -3
  19. package/dist/composables/Authkit/useRoutePermission.d.ts +12 -1
  20. package/dist/composables.d.ts +1 -0
  21. package/dist/composables.js +49 -44
  22. package/dist/feedback.js +1 -1
  23. package/dist/{fetchAuthPageAboutUs-D5w21LkF.js → fetchAuthPageAboutUs--dArFYk6.js} +2 -2
  24. package/dist/main.js +284 -279
  25. package/dist/pay.js +3 -3
  26. package/dist/privateCom.js +1 -1
  27. package/dist/referrer.js +1 -1
  28. package/dist/{runtime-B_xhJ3i8.js → runtime-CDEl4QQl.js} +129 -128
  29. package/dist/style.css +1 -1
  30. package/dist/types/api/auth.generated.d.ts +23 -0
  31. package/dist/types/app.d.ts +4 -0
  32. package/dist/upload.js +2 -2
  33. package/dist/{useAuthkitAppsAuthPageInfo-KHO1mJvF.js → useAuthkitAppsAuthPageInfo-mv7hOnhi.js} +1 -1
  34. package/dist/useAuthkitAuth-CO61XogP.js +295 -0
  35. package/dist/{useAuthkitUsersProfile-BvldvaRx.js → useAuthkitUsersProfile-CF7t2Y7T.js} +1 -1
  36. package/dist/{useEnsureAuthenticated-BdXJDqVv.js → useEnsureAuthenticated-Q7EHguY4.js} +1 -1
  37. package/dist/{useLegalDocs-BCWvu1ft.js → useLegalDocs-DUbab5R9.js} +2 -2
  38. package/dist/{usePageSEO-D7eyLr8d.js → usePageSEO-D8CocvOJ.js} +1 -1
  39. package/dist/useRoutePermission-Bvn-J8bp.js +249 -0
  40. package/dist/{useSubscriptionCheckout-BHI3y7Cx.js → useSubscriptionCheckout-Bic8vKgm.js} +1 -1
  41. package/dist/user.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/WidthContainer-PjmYnZwk.js +0 -706
  44. package/dist/useAuthkitAuth-C0fVP17l.js +0 -273
  45. package/dist/useRoutePermission-BuKMkOTK.js +0 -247
@@ -29,6 +29,8 @@ export interface HuyoooUIConfig {
29
29
  pricingUrl: string;
30
30
  /** 自定义打开价格页逻辑(可选;例如桌面端切换到内置订阅页) */
31
31
  openPricing?: () => void;
32
+ /** 路由无权限时的回退地址(默认 `/`;有定价的产品可自行设为 /Pricing) */
33
+ accessDeniedUrl: string;
32
34
  avatarBucketId: string;
33
35
  feedbackBucketId: string;
34
36
  /** 默认存储桶名称 */
@@ -70,6 +72,8 @@ export interface CreateHuyoooUIOptions {
70
72
  pricingUrl?: string;
71
73
  /** 自定义打开价格页逻辑;优先级高于 pricingUrl */
72
74
  openPricing?: () => void;
75
+ /** 路由无权限时的回退地址(可选,默认 `/`) */
76
+ accessDeniedUrl?: string;
73
77
  avatarBucketId?: string;
74
78
  feedbackBucketId?: string;
75
79
  /** 默认存储桶名称 */
@@ -95,6 +99,7 @@ export declare function createHuyoooRuntimeConfig(options: CreateHuyoooUIOptions
95
99
  webhookPrefixUrl: string;
96
100
  pricingUrl: string;
97
101
  openPricing: (() => void) | undefined;
102
+ accessDeniedUrl: string;
98
103
  avatarBucketId: string;
99
104
  feedbackBucketId: string;
100
105
  bucket: string;
package/dist/common.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as s, a as o, C as r, D as t, G as p, H as n, b as l, S as m, W as u } from "./WidthContainer-PjmYnZwk.js";
1
+ import { A as s, a as o, C as r, D as t, G as p, H as n, b as l, S as m, W as u } from "./WidthContainer-BEeYYOat.js";
2
2
  import { C as d, a as f } from "./CollapseItem-DUzZA6tx.js";
3
3
  import { C as x, E as b } from "./CustomTable-B1KjkixL.js";
4
4
  import { L } from "./Logo-B9DFBxDU.js";
@@ -29,7 +29,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
29
29
  default: string;
30
30
  };
31
31
  }>> & Readonly<{}>, {
32
- color: string;
33
32
  prefix: string;
33
+ color: string;
34
34
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
35
35
  export default _default;
@@ -1,5 +1,5 @@
1
1
  /** 社交登录 OAuth 回调 URL 上可能出现的 query 参数 */
2
- export declare const OAUTH_CALLBACK_QUERY_KEYS: readonly ["token", "refreshToken", "userId", "appId", "error", "needBindIdentity", "bindSuccess", "provider", "expiresIn"];
2
+ export declare const OAUTH_CALLBACK_QUERY_KEYS: readonly ["loginCode", "error", "bindSuccess", "provider"];
3
3
  export declare function hasOAuthCallbackParams(url: URL): boolean;
4
4
  /** 清除 OAuth 回调参数并返回清理后的站内路径 */
5
5
  export declare function cleanOAuthCallbackParams(url: URL): string;
@@ -1,6 +1,15 @@
1
+ import { PublicRoute } from '../../types/app';
1
2
  /** 生成当前路由可匹配的权限 key 候选(含父级) */
2
3
  export declare function resolveRoutePermissionCandidates(path: string): string[];
3
- /** 用户权限是否覆盖该路由(精确或父级) */
4
+ /** 用户权限是否覆盖该路由(精确或父级)——与角色 permissionKey 约定一致 */
4
5
  export declare function hasRoutePermission(path: string, permissionKeys: string[]): boolean;
6
+ /** 从 publicRoutes 取出仅精确匹配的公开 key(由服务端 publicMatch 声明) */
7
+ export declare function resolvePublicExactMatchKeys(publicRoutes: PublicRoute[]): string[];
8
+ /**
9
+ * 是否可按公开权限访问。
10
+ * - prefix(默认):公开 key 可覆盖子路径(如 /Blog → /Blog/xxx)
11
+ * - exact:仅精确匹配(由 authPageInfo.publicRoutes[].publicMatch 声明)
12
+ */
13
+ export declare function isPublicRouteAccess(path: string, publicRoutes: PublicRoute[]): boolean;
5
14
  /** 菜单权限:路由本身或其任一子路由权限均可展示 */
6
15
  export declare function hasMenuPermission(menuPath: string, permissionKeys: string[]): boolean;
@@ -12,6 +12,7 @@ export declare function useAuthkitAppsAuthPageInfo(): {
12
12
  name: string;
13
13
  permissionKey: string;
14
14
  description: string;
15
+ publicMatch?: import('../../types/app').PublicRouteMatch | undefined;
15
16
  }[];
16
17
  oauth: {
17
18
  google: {
@@ -99,6 +100,7 @@ export declare function useAuthkitAppsAuthPageInfo(): {
99
100
  name: string;
100
101
  permissionKey: string;
101
102
  description: string;
103
+ publicMatch?: import('../../types/app').PublicRouteMatch | undefined;
102
104
  }[];
103
105
  oauth: {
104
106
  google: {
@@ -1,24 +1,33 @@
1
1
  /**
2
2
  * 登录成功后触发的数据负载
3
3
  * - signIn 成功:来自接口返回的 data
4
- * - OAuth 回调成功:来自 URL 参数 + token
4
+ * - OAuth 回调成功:来自 loginCode 兑换结果
5
5
  */
6
6
  export interface SignInResult {
7
7
  jwtToken: string;
8
8
  refreshToken?: string | null;
9
9
  userId?: string | null;
10
10
  appId?: string | null;
11
+ needBindIdentity?: boolean;
11
12
  /** 接口返回的其他字段透传 */
12
13
  [key: string]: unknown;
13
14
  }
14
15
  type SignInListener = (data: SignInResult) => void | Promise<void>;
15
16
  type VoidListener = () => void | Promise<void>;
16
17
  type Cleanup = () => void;
18
+ /** 是否已开始消费 OAuth 登录回调(用于 URL 被提前清理后仍能完成跳转) */
19
+ declare function hasOAuthLoginConsumeStarted(): boolean;
17
20
  /**
18
- * 恢复一次会话:先尝试 OAuth 回调(一次性),再尝试 localStorage token。
21
+ * 消费 OAuth 登录回调(loginCode POST exchange)。
22
+ * 成功返回 SignInResult;无 loginCode / 失败返回 null。
23
+ * error、bindSuccess 等非登录态参数不在此处理。
24
+ */
25
+ declare function consumeOAuthLoginCallback(): Promise<SignInResult | null>;
26
+ /**
27
+ * 恢复一次会话:先尝试 OAuth 回调(一次性),再尝试本地 token。
19
28
  * 任一路径成功返回 true,宿主据此判断是否需要拉取 userProfile。
20
29
  */
21
- declare function restoreSession(): boolean;
30
+ declare function restoreSession(): Promise<boolean>;
22
31
  declare function getToken(): string | null;
23
32
  declare function setToken(token: string): void;
24
33
  declare function completeSignIn(data: SignInResult): void;
@@ -79,6 +88,8 @@ export declare function useAuthkitAuth(): {
79
88
  setToken: typeof setToken;
80
89
  completeSignIn: typeof completeSignIn;
81
90
  restoreSession: typeof restoreSession;
91
+ consumeOAuthLoginCallback: typeof consumeOAuthLoginCallback;
92
+ hasOAuthLoginConsumeStarted: typeof hasOAuthLoginConsumeStarted;
82
93
  clearAuth: typeof clearAuth;
83
94
  signOut: typeof signOut;
84
95
  };
@@ -1,5 +1,16 @@
1
+ /**
2
+ * 路由访问控制(对齐 auth-server,不阻塞渲染):
3
+ *
4
+ * 真相源:
5
+ * - authPageInfo.publicRoutes ← permissions(isPublic=true),含 publicMatch
6
+ * - profile.permissions ← 用户角色绑定的 permissionKey(≈ 路由 path)
7
+ *
8
+ * 规则:
9
+ * 1. 命中公开路由 → 放行(publicMatch=exact 不级联子路径)
10
+ * 2. 应用配置或会话未就绪 → 先渲染,就绪后再判
11
+ * 3. 否则需登录且 hasRoutePermission;不满足 → accessDeniedUrl(默认 `/`)
12
+ */
1
13
  export declare function useRoutePermission(): {
2
- isChecking: import('vue').Ref<boolean, boolean>;
3
14
  isRoutePublic: (path: string) => boolean;
4
15
  hasPermission: (path: string) => boolean;
5
16
  };
@@ -17,6 +17,7 @@ export { withViewTransition } from './composables/viewTransitions';
17
17
  export { useDownloads } from './composables/useDownloads';
18
18
  export { useAuthMenu, findMenuPath, findActiveMenuPath, getPathOnly } from './composables/Authkit/useAuthMenu';
19
19
  export { useRoutePermission } from './composables/Authkit/useRoutePermission';
20
+ export { isPublicRouteAccess, hasRoutePermission, hasMenuPermission, resolveRoutePermissionCandidates, resolvePublicExactMatchKeys, } from './composables/Authkit/resolveRoutePermission';
20
21
  export { useAppSEO } from './composables/SEO/useAppSEO';
21
22
  export { usePageSEO } from './composables/SEO/usePageSEO';
22
23
  export type { AppSEOConfig, PageSEOConfig } from './types/seo';
@@ -1,56 +1,61 @@
1
- import { u as a } from "./useAuthkitAuth-C0fVP17l.js";
1
+ import { u as a } from "./useAuthkitAuth-CO61XogP.js";
2
2
  import { u as t } from "./apiClients-8_c5cDW5.js";
3
- import { L as r, a as i, b as n, i as p, o as f, r as l, c as m, u as c } from "./useLegalDocs-BCWvu1ft.js";
4
- import { f as A } from "./fetchAuthPageAboutUs-D5w21LkF.js";
5
- import { u as d } from "./useAuthkitUsersProfile-BvldvaRx.js";
6
- import { u as L } from "./useAuthkitAppsAuthPageInfo-KHO1mJvF.js";
7
- import { f as P, a as b, g as O, u as S, b as C, c as U, d as k, w as M } from "./useRoutePermission-BuKMkOTK.js";
8
- import { u as T } from "./useAuthkitCreateAndUpdate-CYIcEuub.js";
9
- import { u as E } from "./useMessageNotifications-BXimltcx.js";
10
- import { c as y, g as B, a as H, s as I, u as _ } from "./runtime-B_xhJ3i8.js";
11
- import { u as F, a as K, b as N, c as V, d as Y } from "./usePageSEO-D7eyLr8d.js";
12
- import { u as q } from "./useUserMenu-ClPBlvaM.js";
13
- import { u as J, a as Q } from "./useSubscriptionCheckout-BHI3y7Cx.js";
14
- import { c as X, u as Z, a as $, b as ee } from "./useBillingStatusOptions-C8fwW-AI.js";
3
+ import { L as r, a as i, b as n, i as p, o as l, r as c, c as f, u as m } from "./useLegalDocs-DUbab5R9.js";
4
+ import { f as A } from "./fetchAuthPageAboutUs--dArFYk6.js";
5
+ import { u as d } from "./useAuthkitUsersProfile-CF7t2Y7T.js";
6
+ import { u as P } from "./useAuthkitAppsAuthPageInfo-mv7hOnhi.js";
7
+ import { f as L, a as D, g as O, h as R, b as S, i as C, r as M, c as v, u as U, d as k, e as E, j as T, w as y } from "./useRoutePermission-Bvn-J8bp.js";
8
+ import { u as B } from "./useAuthkitCreateAndUpdate-CYIcEuub.js";
9
+ import { u as I } from "./useMessageNotifications-BXimltcx.js";
10
+ import { c as G, g as K, a as j, s as F, u as N } from "./runtime-CDEl4QQl.js";
11
+ import { u as Y, a as q, b as z, c as J, d as Q } from "./usePageSEO-D8CocvOJ.js";
12
+ import { u as X } from "./useUserMenu-ClPBlvaM.js";
13
+ import { u as $, a as ss } from "./useSubscriptionCheckout-Bic8vKgm.js";
14
+ import { c as as, u as os, a as ts, b as us } from "./useBillingStatusOptions-C8fwW-AI.js";
15
15
  export {
16
16
  r as LEGAL_DOCS,
17
17
  i as LEGAL_DOC_KEYS,
18
18
  n as buildBuiltinLegalDocUrl,
19
- X as createBillingStatusOptions,
20
- y as createHuyoooUI,
19
+ as as createBillingStatusOptions,
20
+ G as createHuyoooUI,
21
21
  A as fetchAuthPageAboutUs,
22
- P as findActiveMenuPath,
23
- b as findMenuPath,
24
- B as getHuyoooRuntime,
22
+ L as findActiveMenuPath,
23
+ D as findMenuPath,
24
+ K as getHuyoooRuntime,
25
25
  O as getPathOnly,
26
- H as globalThemeRef,
26
+ j as globalThemeRef,
27
+ R as hasMenuPermission,
28
+ S as hasRoutePermission,
27
29
  p as isLegalDocConfigured,
28
- f as openLegalDocTarget,
29
- l as resolveLegalAppId,
30
- m as resolveLegalDocTargetFromData,
31
- I as setTheme,
32
- S as useActiveDoc,
33
- C as useAppBrand,
34
- F as useAppSEO,
35
- U as useAuthMenu,
36
- L as useAuthkitAppsAuthPageInfo,
30
+ C as isPublicRouteAccess,
31
+ l as openLegalDocTarget,
32
+ c as resolveLegalAppId,
33
+ f as resolveLegalDocTargetFromData,
34
+ M as resolvePublicExactMatchKeys,
35
+ v as resolveRoutePermissionCandidates,
36
+ F as setTheme,
37
+ U as useActiveDoc,
38
+ k as useAppBrand,
39
+ Y as useAppSEO,
40
+ E as useAuthMenu,
41
+ P as useAuthkitAppsAuthPageInfo,
37
42
  a as useAuthkitAuth,
38
43
  t as useAuthkitAuthModal,
39
- T as useAuthkitCreateAndUpdate,
44
+ B as useAuthkitCreateAndUpdate,
40
45
  d as useAuthkitUsersProfile,
41
- J as useBillingPlans,
42
- K as useCommonCreateAndUpdate,
43
- N as useDownloads,
44
- _ as useHuyoooRuntime,
45
- Z as useInvoiceStatusOptions,
46
- c as useLegalDocs,
47
- E as useMessageNotifications,
48
- V as usePageSEO,
49
- $ as usePointsRechargeStatusOptions,
50
- ee as useRefundStatusOptions,
51
- k as useRoutePermission,
52
- Q as useSubscriptionCheckout,
53
- Y as useTableHandle,
54
- q as useUserMenu,
55
- M as withViewTransition
46
+ $ as useBillingPlans,
47
+ q as useCommonCreateAndUpdate,
48
+ z as useDownloads,
49
+ N as useHuyoooRuntime,
50
+ os as useInvoiceStatusOptions,
51
+ m as useLegalDocs,
52
+ I as useMessageNotifications,
53
+ J as usePageSEO,
54
+ ts as usePointsRechargeStatusOptions,
55
+ us as useRefundStatusOptions,
56
+ T as useRoutePermission,
57
+ ss as useSubscriptionCheckout,
58
+ Q as useTableHandle,
59
+ X as useUserMenu,
60
+ y as withViewTransition
56
61
  };
package/dist/feedback.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as b, a as s, F as d, b as F, _ as o, c, R as t, V as r } from "./FeedbackModal.vue_vue_type_script_setup_true_lang-C7vaGD4R.js";
1
+ import { B as b, a as s, F as d, b as F, _ as o, c, R as t, V as r } from "./FeedbackModal.vue_vue_type_script_setup_true_lang-BXqxUXuu.js";
2
2
  import { C as i } from "./index-D9YtlhTa.js";
3
3
  import { F as m, a as f, b as n, c as p } from "./FeedbackItem-BP-SiJ2u.js";
4
4
  export {
@@ -1,5 +1,5 @@
1
- import { n as i } from "./useAuthkitAppsAuthPageInfo-KHO1mJvF.js";
2
- import { g as a } from "./runtime-B_xhJ3i8.js";
1
+ import { n as i } from "./useAuthkitAppsAuthPageInfo-mv7hOnhi.js";
2
+ import { g as a } from "./runtime-CDEl4QQl.js";
3
3
  async function p(o) {
4
4
  if (!o)
5
5
  return null;