@24city/web-console 0.3.0 → 0.3.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.0
3
+ ## 0.3.1
4
+
5
+ - 账号菜单给产品留了一块额度:`customization.AccountAllowance` 是一个组件,排在套餐区之后、个人中心之前,收到当前空间和用户
6
+ (与 `PointsDetail` 相同),卡片展开时才挂载、自己读数据;返回 null 时这一块不出现,不留空白。不给时账号菜单和 0.3.0 一样。
7
+ 用于本产品按天或按月发放的额度,例如 AdFlow 每天的免费视频时长。
8
+ - `/account` 新增 `AllowanceMeter`:一条额度的统一样子。名称和“已用 80/120 秒”一行,下面是进度条和一句说明;用满或先用不了时
9
+ (`exhausted`,例如全站名额先发完)变橙色,不限(`UNLIMITED_QUOTA` 及以上)只写已用多少,读取中显示“…”,读不到显示“暂不可用”。
10
+ - 组件总览页新增「额度条」,账号菜单的示例带上一条额度。
4
11
 
5
12
  **暗色模式**
6
13
 
package/GUIDELINES.md CHANGED
@@ -152,6 +152,7 @@
152
152
  | 多步骤工作台(制作流程) | `ProductPage`(`back`、`titleAfter`)→ `StepTabs`(步骤与每步状态)→ `SummaryBar`(这一步的总体进度与主操作)→ `WorkCanvas`(白底工作区:`toolbar` 放 `SubTabs` 和小号 `FilterCapsules`,`aside` 放参数,主区用 `WorkSection` 分节);旁边自成一体的内容用 `WorkPanel`,还没开始或没有结果用 `WorkPlaceholder` |
153
153
  | 表单与设置 | `ProductPage width="narrow"` → 一张 `Card`:`FormSection`(按含义分节)→ `Field`(标签、说明、出错信息)→ `FormActions`(一个主按钮,靠左)。用 Semi `Form` 管状态时写 `labelPosition="top"`,外观相同 |
154
154
  | 个人中心 | 用本包的 `AccountCenterPage`;产品只能追加分区(`customization.accountSections`) |
155
+ | 账号菜单里的产品额度 | `customization.AccountAllowance` 里放一个或几个 `AllowanceMeter`(每天的免费时长、每月的免费次数这类按周期发放的额度);数量上限(已有几个产品)仍用列表页的 `QuotaPill`,不放进账号菜单 |
155
156
  | 结果与异常 | 整页用 `NotFoundPage`、`StartupError`、`RouteErrorPage`;页面内用 `ErrorCard`、`EmptyCard`、`SessionUnavailable` |
156
157
 
157
158
  工作台的层级只有三层:步骤(`StepTabs`)→ 步骤内的视图(`SubTabs`)→ 列表筛选(`FilterCapsules`),不再往下套页签。
package/README.md CHANGED
@@ -88,7 +88,7 @@ initColorMode({ dark: true }) // 首屏渲染前调用:读出用户上次的
88
88
  | `/semi` | `ConsoleSemiProvider`(中文文案,含 React 19 适配)、`modalButtonProps`(弹窗按钮属性,去掉 Semi 默认的英文 aria-label) |
89
89
  | `/theme` | `applyBrand`、`brandPalette`、`brandDarkPalette`、`BRAND_VARIABLES`、`BRAND_SOURCE_VARIABLES`、`SEMI_BRAND_VARIABLES`;颜色模式 `initColorMode`、`setColorModePreference`、`useColorMode`、`getColorMode`;设计阶梯 `FONT_SIZE_SCALE`、`DISPLAY_SIZES`、`BREAKPOINTS`、`breakpointUp`、`breakpointDown` |
90
90
  | `/runtime` | `ConsoleApp`、`supportsCascadeLayers`、`ConsoleRuntimeProvider`、`useConsoleRuntime`、`createHttpRuntime`、`loadRuntimeConfig`、`earlyRuntimeConfigFetcher`、`productQueryKeys`、格式化函数、`reloadOnStaleBuild` |
91
- | `/account` | `createAccountApi`、`AuthProvider`、`RouteGuard`、`LoginPage`、`useAuthState`、`useLogout`、`useSpaceSwitch`、`useMembership`、`AccountMenu`、`WalletBadge`、`UpgradeEntry`、`UpgradeModal`、`QuotaPill`、`AccountCenterPage`、`plansUrl`、`ConsoleCustomization` |
91
+ | `/account` | `createAccountApi`、`AuthProvider`、`RouteGuard`、`LoginPage`、`useAuthState`、`useLogout`、`useSpaceSwitch`、`useMembership`、`AccountMenu`、`WalletBadge`、`UpgradeEntry`、`UpgradeModal`、`QuotaPill`、`AllowanceMeter`、`AccountCenterPage`、`plansUrl`、`ConsoleCustomization` |
92
92
  | `/layout` | `ConsoleLayout`、`BrandMark`、导航类型 |
93
93
  | `/page` | `ProductPage`(`back`、`titleAfter`、`width`)、`FullPage`、`Toolbar`、`LoadingCard`、`ErrorCard`、`EmptyCard`、`EmptyBlock`、`LoadingBlock`、`StatusResult`、`LinkButton`、`TextLink`、`SelectLabel`、`ColorModeSwitch`、`SessionUnavailable`、`ErrorBoundary`、`RouteErrorPage`、`StartupError`、`NotFoundPage`、`UnsupportedBrowser` |
94
94
  | `/list` | 列表页:`ListToolbar`、`SelectionBar`、`TableScroll`;`FilterPanel`(`FilterRow`、`FilterOptions`、`FilterSelected`、`FilterSelectText`、`FilterRangeText`、`FilterCapsules`、`SortBar`)、`FilterDropdown`、`ChoiceCards`、`Waterfall`、`ContentSquare`(`SquareSearch`、`SquareAccent`、`SquareFooter`) |
@@ -128,8 +128,25 @@ root.render(
128
128
  `account/:section` 的 `AccountCenterPage`。`ConsoleLayout` 接产品的顶栏模块和侧栏分组;个人中心页面自动不显示侧栏。
129
129
 
130
130
  `customization` 是产品对账号页面的定制(都可选):套餐目录里本产品功能键的白话(`benefitCopy`)、按套餐编码的权益卡文案
131
- (`planCopy`、`teamPlanCopy`)、开通团队版引导的要点(`teamPromoHighlights`)、「积分与明细」里的扣费明细组件(`PointsDetail`),
132
- 以及产品追加的个人中心分区(`accountSections`)。
131
+ (`planCopy`、`teamPlanCopy`)、开通团队版引导的要点(`teamPromoHighlights`)、「积分与明细」里的扣费明细组件(`PointsDetail`)、
132
+ 账号菜单里的本产品额度(`AccountAllowance`),以及产品追加的个人中心分区(`accountSections`)。
133
+
134
+ ### 账号菜单里的额度
135
+
136
+ 本产品按天或按月发放的额度(每天的免费时长、每月的免费次数)可以放进账号菜单,排在套餐区之后、个人中心之前:
137
+
138
+ ```tsx
139
+ const FreeTime = ({ activeSpaceId }: AccountAllowanceProps) => {
140
+ const { data } = useQuery({ queryKey: productQueryKeys.scope(activeSpaceId, 'free-time'), queryFn: readFreeTime })
141
+ if (!data) return null
142
+ return <AllowanceMeter label="今日免费时长" unit="秒" used={data.used} total={data.total} note={`还剩 ${data.left} 秒 · 每天 0 点重置`} />
143
+ }
144
+
145
+ const customization: ConsoleCustomization = { AccountAllowance: FreeTime }
146
+ ```
147
+
148
+ 组件在卡片展开时才挂载,收到当前空间和用户,自己读数据;额度按空间算时用空间做查询键。没有可显示的额度时返回 null,
149
+ 卡片里就没有这一块。画额度一律用 `AllowanceMeter`,各产品在账号菜单里是同一个样子。
133
150
 
134
151
  ### 个人中心
135
152
 
@@ -18,6 +18,6 @@ export interface AccountMenuProps {
18
18
  /**
19
19
  * 右上角账号入口:顶栏只放头像,指针移上去或点一下展开账号卡片。卡片从上到下是
20
20
  * 头像、昵称和套餐标签、当前空间(多个空间时可展开切换);套餐区(免费版是带起步价的升级引导,会员是黑金会员卡);
21
- * 个人中心三个分区;退出登录。回首页点左上角的产品名称。
21
+ * 产品的额度(customization.AccountAllowance,可选);个人中心三个分区;退出登录。回首页点左上角的产品名称。
22
22
  */
23
23
  export declare const AccountMenu: ({ personal, selectedKey, onOpen }: AccountMenuProps) => import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ export interface AllowanceMeterProps {
2
+ /** 额度的名称,例如“今日免费视频时长” */
3
+ label: string;
4
+ /** 单位,例如“秒”“次” */
5
+ unit: string;
6
+ /** 已用多少(含正在用的);和 total 一起在读到之后给 */
7
+ used?: number;
8
+ /** 一共多少,大于 0;UNLIMITED_QUOTA 及以上是不限,不画进度条 */
9
+ total?: number;
10
+ /** 进度条下面的一句话,例如“还剩 40 秒 · 北京时间每天 0 点重置” */
11
+ note?: string;
12
+ /** 已经用不了:进度条和数字变橙色。不给时按已用达到总量判断;没用满却先用不了时(例如全站名额先发完)给 true */
13
+ exhausted?: boolean;
14
+ /** 读取中显示“…”,读不到显示“暂不可用”,都不画进度条 */
15
+ status?: 'loading' | 'error';
16
+ }
17
+ /**
18
+ * 账号卡片里的一条额度:名称和“已用 80/120 秒”一行,下面是进度条和一句说明(还剩多少、什么时候重置)。
19
+ * 产品在 `customization.AccountAllowance` 里用它,各产品的额度在账号卡片里是同一个样子。
20
+ */
21
+ export declare const AllowanceMeter: (props: AllowanceMeterProps) => import("react").JSX.Element;
@@ -24,6 +24,10 @@ export interface PointsDetailProps {
24
24
  activeSpaceId: string;
25
25
  globalUserId: string;
26
26
  }
27
+ export interface AccountAllowanceProps {
28
+ activeSpaceId: string;
29
+ globalUserId: string;
30
+ }
27
31
  export interface AccountSectionProps {
28
32
  /** 与内置分区相同的数据:会话、当前空间、昵称、钱包、当前套餐 */
29
33
  data: AccountCenterData;
@@ -57,6 +61,11 @@ export interface ConsoleCustomization {
57
61
  teamPromoHighlights?: string[];
58
62
  /** 「积分与明细」里本产品的扣费明细;不给时只显示余额和去账号中心的入口 */
59
63
  PointsDetail?: ComponentType<PointsDetailProps>;
64
+ /**
65
+ * 账号卡片里套餐区下面的本产品额度,例如每天的免费时长:卡片展开时才挂载,组件自己读数据,用本包的 `AllowanceMeter` 画;
66
+ * 没有可显示的额度时返回 null,卡片里就没有这一块。
67
+ */
68
+ AccountAllowance?: ComponentType<AccountAllowanceProps>;
60
69
  /** 产品追加的个人中心分区,排在内置三项之后 */
61
70
  accountSections?: ProductAccountSection[];
62
71
  }
@@ -3,6 +3,7 @@ export * from './account-center-links';
3
3
  export * from './account-center-page';
4
4
  export * from './account-center-ui';
5
5
  export * from './account-menu';
6
+ export * from './allowance-meter';
6
7
  export * from './auth-provider';
7
8
  export * from './auth-store';
8
9
  export * from './benefit-copy';
@@ -1,87 +1,88 @@
1
1
  import { A as e, a as t, c as o, b as n, i as r, d as i, l as u, n as c, r as l, e as g, f as p, u as A, g as S, w as P } from "../chunks/logout-signal-CiD_zY5M.js";
2
- import { A as C, C as d, L as f, P as h, a as m, b as y, Q as N, R as T, S as E, c as O, T as b, U, d as F, p as _, e as x, f as v, g as w, y as B } from "../chunks/upgrade-modal-DIINHIt0.js";
3
- import { A as I, a as q, b as D, E as K, F as M, P as Q, c as G, d as H, U as k, e as W, W as Y, f as j, g as z, h as J, i as V, j as X, k as Z, l as $, m as aa, n as sa, o as ea, p as ta, q as oa, r as na, s as ra, t as ia, u as ua, v as ca, w as la, x as ga, y as pa, z as Aa, B as Sa, C as Pa, D as La, G as Ca, H as da, I as fa, J as ha, K as ma, L as ya, M as Na, N as Ta, O as Ea, Q as Oa } from "../chunks/wallet-badge-n1ASGYJY.js";
4
- import { A as Ua } from "../chunks/auth-provider-CqiyTeOt.js";
5
- import { notifyCustomerSessionChanged as _a, subscribeCustomerSessionChanges as xa } from "@24city/web-runtime/session-sync";
2
+ import { A as C, a as d, C as f, L as h, P as m, b as y, c as N, Q as T, R as E, S as O, d as b, T as U, U as F, e as _, p as w, f as x, g as v, h as B, y as R } from "../chunks/upgrade-modal-BWnNve0z.js";
3
+ import { A as M, a as q, b as D, E as K, F as Q, P as G, c as H, d as k, U as W, e as Y, W as j, f as z, g as J, h as V, i as X, j as Z, k as $, l as aa, m as sa, n as ea, o as ta, p as oa, q as na, r as ra, s as ia, t as ua, u as ca, v as la, w as ga, x as pa, y as Aa, z as Sa, B as Pa, C as La, D as Ca, G as da, H as fa, I as ha, J as ma, K as ya, L as Na, M as Ta, N as Ea, O as Oa, Q as ba } from "../chunks/wallet-badge-Dt8fv-Du.js";
4
+ import { A as Fa } from "../chunks/auth-provider-CqiyTeOt.js";
5
+ import { notifyCustomerSessionChanged as wa, subscribeCustomerSessionChanges as xa } from "@24city/web-runtime/session-sync";
6
6
  export {
7
- I as ACCOUNT_SECTIONS,
7
+ M as ACCOUNT_SECTIONS,
8
8
  q as AccountAvatar,
9
9
  C as AccountCenterPage,
10
10
  D as AccountMenu,
11
- Ua as AuthProvider,
11
+ d as AllowanceMeter,
12
+ Fa as AuthProvider,
12
13
  e as AuthStoreProvider,
13
- d as CenterLinkButton,
14
+ f as CenterLinkButton,
14
15
  K as EXPIRING_SOON_DAYS,
15
- M as FALLBACK_ACCOUNT_LABEL,
16
- f as LoginPage,
17
- Q as PERSONAL_NAV_KEYS,
18
- G as PERSONAL_SPACE_LABEL,
19
- h as PlanCards,
20
- H as PlanPanel,
21
- m as PointsSection,
22
- y as ProfileSection,
23
- N as QuotaPill,
24
- T as RouteGuard,
25
- E as SettingRow,
26
- O as SubscriptionSection,
27
- b as TeamPromo,
28
- k as UNLIMITED_QUOTA,
29
- W as UpgradeEntry,
30
- U as UpgradeModal,
31
- Y as WalletBadge,
32
- F as accountCenterPageUrl,
33
- j as accountQueryKeys,
34
- z as accountSectionPath,
16
+ Q as FALLBACK_ACCOUNT_LABEL,
17
+ h as LoginPage,
18
+ G as PERSONAL_NAV_KEYS,
19
+ H as PERSONAL_SPACE_LABEL,
20
+ m as PlanCards,
21
+ k as PlanPanel,
22
+ y as PointsSection,
23
+ N as ProfileSection,
24
+ T as QuotaPill,
25
+ E as RouteGuard,
26
+ O as SettingRow,
27
+ b as SubscriptionSection,
28
+ U as TeamPromo,
29
+ W as UNLIMITED_QUOTA,
30
+ Y as UpgradeEntry,
31
+ F as UpgradeModal,
32
+ j as WalletBadge,
33
+ _ as accountCenterPageUrl,
34
+ z as accountQueryKeys,
35
+ J as accountSectionPath,
35
36
  t as announceLogout,
36
- J as buildPersonalNavigation,
37
- V as canBuyForSpace,
38
- X as catalogPlanOf,
37
+ V as buildPersonalNavigation,
38
+ X as canBuyForSpace,
39
+ Z as catalogPlanOf,
39
40
  o as createAccountApi,
40
41
  n as createAuthStore,
41
- Z as entryTeamPlan,
42
- $ as featureLines,
43
- aa as formatPlanAmount,
44
- sa as formatPlanPrice,
45
- ea as isAccountCenterPath,
46
- ta as isAccountSection,
42
+ $ as entryTeamPlan,
43
+ aa as featureLines,
44
+ sa as formatPlanAmount,
45
+ ea as formatPlanPrice,
46
+ ta as isAccountCenterPath,
47
+ oa as isAccountSection,
47
48
  r as isLeavingForLogout,
48
49
  i as isLoggedOutElsewhere,
49
- oa as isTeamSpace,
50
- na as isTeamSubscriptionRequired,
51
- ra as isUnlimited,
50
+ na as isTeamSpace,
51
+ ra as isTeamSubscriptionRequired,
52
+ ia as isUnlimited,
52
53
  u as leaveForLogout,
53
54
  c as noteLogoutElsewhere,
54
- _a as notifySessionChanged,
55
- ia as offerHighlights,
56
- ua as personalNavKey,
57
- _ as planBenefitLines,
55
+ wa as notifySessionChanged,
56
+ ua as offerHighlights,
57
+ ca as personalNavKey,
58
+ w as planBenefitLines,
58
59
  x as planCopy,
59
- ca as planDaysLeft,
60
- la as planFocusOf,
61
- ga as planFocusState,
62
- pa as planPeriodText,
63
- Aa as planTitle,
60
+ la as planDaysLeft,
61
+ ga as planFocusOf,
62
+ pa as planFocusState,
63
+ Aa as planPeriodText,
64
+ Sa as planTitle,
64
65
  v as plansUrl,
65
- w as priceFor,
66
- Sa as productAccountSections,
67
- Pa as quotaCopy,
68
- La as quotaFull,
69
- Ca as quotaText,
66
+ B as priceFor,
67
+ Pa as productAccountSections,
68
+ La as quotaCopy,
69
+ Ca as quotaFull,
70
+ da as quotaText,
70
71
  l as releaseLogoutHold,
71
72
  g as resetLogoutSignalForTest,
72
73
  p as restoreIdentityContext,
73
- da as spaceDisplayName,
74
- fa as spaceRoleLabel,
75
- ha as startingPrice,
74
+ fa as spaceDisplayName,
75
+ ha as spaceRoleLabel,
76
+ ma as startingPrice,
76
77
  xa as subscribeSessionChanged,
77
- ma as upgradeOffer,
78
- ya as useAccountCenter,
78
+ ya as upgradeOffer,
79
+ Na as useAccountCenter,
79
80
  A as useAuthState,
80
81
  S as useAuthStore,
81
- Na as useLogout,
82
- Ta as useMembership,
83
- Ea as usePlanCatalog,
84
- Oa as useSpaceSwitch,
82
+ Ta as useLogout,
83
+ Ea as useMembership,
84
+ Oa as usePlanCatalog,
85
+ ba as useSpaceSwitch,
85
86
  P as withdrawLogout,
86
- B as yearlyNote
87
+ R as yearlyNote
87
88
  };
@@ -3,7 +3,7 @@ import { useState as z, useEffect as $ } from "react";
3
3
  import { Layout as g, Button as v, Typography as O, Space as F, Nav as S } from "@douyinfe/semi-ui";
4
4
  import { IconSidebar as T } from "@douyinfe/semi-icons";
5
5
  import { useLocation as Q, useNavigate as Y, Outlet as q } from "react-router";
6
- import { h as D, B as J, o as V, e as X, W as Z, b as ee } from "./wallet-badge-n1ASGYJY.js";
6
+ import { h as D, B as J, o as V, e as X, W as Z, b as ee } from "./wallet-badge-Dt8fv-Du.js";
7
7
  import { u as P, b as te, a as ne } from "./context-CaVim6ZO.js";
8
8
  import { u as ae } from "./use-media-query-DvyinWNg.js";
9
9
  import { a as oe } from "./scale-smFifpMm.js";