@24city/web-console 0.3.9 → 0.3.11

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,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.11
4
+
5
+ **新增:行为事件**(`@24city/web-console/account`,统一账号中心 API 1.24.0;运营在统一中心后台按行为圈人,
6
+ 例如「打开升级引导后没有付款」的用户)
7
+
8
+ - `useTrack()` 记录已登录用户的页面、点击;`AccountApi.reportBehaviorEvents` 发到产品自己的 `POST /api/account/events`
9
+ (account-client 0.9.0 的 ginaccount 提供),用户与空间由服务端按会话补上。可选:自己实现 AccountApi 的产品不写也能编译。
10
+ - 自动记录:`ConsoleLayout` 的页面浏览(`page.viewed`,路由模板去掉真实 ID 和非 ASCII 段)、`UpgradeModal` 的打开与关闭
11
+ (停留时长、是否点「立即升级」,新增可选属性 `trigger`)、`UpgradeEntry` 的点击、权益卡付款按钮的 `plan.selected`。
12
+ - 2 秒或 20 条一批;会话恢复前先排队,确认已登录才发,确认未登录则丢掉;失败不提示、不重试;后端没有转发接口(404)时
13
+ 本次会话停止上报,升级 web-console 而产品后端还没升级 account-client 不会报错。
14
+
15
+ ## 0.3.10
16
+
17
+ **新增:图文入口 `CoverTabs` 的说明行 `description`**(`@24city/web-console/list`,来自 AdFlow 素材页:2026-11-14 改成图文入口后,原来分类卡片上的副标题没有了,负责人要求加回来)
18
+
19
+ - `CoverTabOption` 加可选的 `description`:显示在名称下面,次级文字色、12px,**最多两行**;两行还放不下才省略,鼠标停在上面(`title`)能看全文,
20
+ 读屏名称是“名称,说明”。不传就和原来一样。
21
+ - 有 `unavailable` 时只显示 `unavailable` 那句(代替说明,读屏名称也只带它),其余项的说明照常。
22
+ - 为什么是两行而不是单行省略:入口按项数等分一行,五项(抖音分类)、七项(小红书榜单)时每项的文字栏只有 80–150px(1440 宽、侧栏展开)。
23
+ 单行省略会把“含爆量、潜力精选”这种信息量最大的后半句截掉(Stage 实测抖音五项里三项被截);两行下抖音五项全部完整,
24
+ 小红书七项里“营销诉求为……的内容榜单”这四条仍被截(说明本身 14 个字,文字栏一行只放得下 6 个),鼠标停上去看全文。
25
+ 侧栏收起、窗口更宽时都放得下。
26
+ - 各项名称在同一条线上:有说明时每项的文字块都留“名称 + 两行说明”的高度(根节点 `data-note-lines='2'`;只有 `unavailable` 时留一行,
27
+ 都没有时不留,名称在封面旁居中,和原来一样)。说明只有一行的项、没有说明的项,名称都不会往下掉。
28
+ - 手机(768px 以下)每项按内容宽度排、一行横滑:说明最宽 144px(每行 12 个字)、最多两行,一项不会比屏幕还宽
29
+ (390 宽实测:抖音五项 168–240px,小红书七项 204–240px,一屏能看到当前项和下一项的开头)。名称、封面和横滑不受影响。
30
+ - Semi 的按钮自带 `white-space: nowrap`,说明显式改回 `normal` 才会换行;`-webkit-line-clamp` 需要 `-webkit-box-orient: vertical`,
31
+ 打出来的 `dist/styles.css` 里都保留了(压缩器没有删)。
32
+ - 组件总览:“图文入口”展品和“内容广场 · 一块画布”整页预览的分类带上说明,新增“图文入口(五项以上)”展品(紧凑尺寸下说明省略的样子)。
33
+
34
+ **升级注意**
35
+
36
+ - 已经传了 `unavailable` 的入口:原因那一行的行高 20px → 18px,并且可以折成两行(原来是单行省略);只有部分项传了 `unavailable` 时,
37
+ 其余项的名称现在和它在同一条线上(原来别的项名称在封面旁居中,比它低约 9px)。都不传 `unavailable` 和 `description` 的入口完全不变。
38
+
3
39
  ## 0.3.9
4
40
 
5
41
  **外观修正:内容广场的大搜索框**(`@24city/web-console/list`,来自 AdFlow 抖音素材、小红书素材页的走查)
package/GUIDELINES.md CHANGED
@@ -259,8 +259,11 @@ Semi 把 `className` 挂在哪个元素上因组件而异,写样式前先对
259
259
  - **大标题版**(不传 `nav`):居中大标题、白底搜索框、带一行说明的分类卡片(`ChoiceCards`),各自是灰底上的一块白卡。
260
260
  - **一块画布**(传 `nav`):图文入口(`CoverTabs`)→ 大搜索框 → 筛选面板,合成同一块白底,是页面唯一的焦点;
261
261
  不显示大标题(`title` 仍要传,读屏靠它知道这是哪一页)。分类有真实画面可放(素材、笔记、商品)时用它。
262
- - `CoverTabs` 的封面放这一类里真实内容的封面(最多三张,按这一类的默认排序取前几条),不放示意图;名称旁不写说明。
263
- 当前没有内容的一项传 `unavailable`(写原因,如“该行业无数据”),点了由页面提示,不要直接隐藏。分类还没加载时用 `CoverTabsSkeleton`。
262
+ - `CoverTabs` 的封面放这一类里真实内容的封面(最多三张,按这一类的默认排序取前几条),不放示意图。名称下面可以带一句说明
263
+ (`description`:写这一类是什么、含什么,12px 次要色,一句话;最多两行,放不下才省略,鼠标停上去看全文):分类含义光看名称
264
+ 不一定明白时写(如“营销诉求为产品种草的内容榜单”),一眼就懂的可以不写;有的项带、有的项不带时名称仍在同一条线上。
265
+ 项数多(五项以上)时每项的文字栏很窄,说明写短,别把关键信息放在句尾。当前没有内容的一项传 `unavailable`(写原因,如“该行业无数据”,
266
+ 代替说明显示),点了由页面提示,不要直接隐藏。分类还没加载时用 `CoverTabsSkeleton`。
264
267
  - 大搜索框的主按钮用 `buttonText="搜索"`,框是细的中性描边,悬停深一档,聚焦换主色加浅色光圈。有两种以上匹配方式时才用 `modes`
265
268
  (页签贴在框上沿,不再放进框内的下拉),带页签的框换成深色描边,和深色的选中页签连成一体;只有一种匹配方式就不要页签。
266
269
  - `keyShortcut` 写进 `aria-keyshortcuts`,空输入时框内显示按键标,占位里只写要搜什么。按键标是个孤立的符号,用户看不出意思:
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`、`useShowOnce`(每个账号只弹一次)、`AccountMenu`、`WalletBadge`、`UpgradeEntry`、`UpgradeModal`、`QuotaPill`、`AllowanceMeter`、`AccountCenterPage`、`plansUrl`、`ConsoleCustomization` |
91
+ | `/account` | `createAccountApi`、`AuthProvider`、`RouteGuard`、`LoginPage`、`useAuthState`、`useLogout`、`useSpaceSwitch`、`useMembership`、`useShowOnce`(每个账号只弹一次)、`useTrack`(行为事件)、`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`、`GuideModal`(功能引导弹窗)、`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`) |
@@ -165,6 +165,22 @@ const customization: ConsoleCustomization = {
165
165
  `Component` 收到与内置分区相同的 `data`(会话、当前空间、昵称、钱包、当前套餐),只在会话可用时渲染,界面同样受守卫约束。
166
166
  `key` 只能是小写字母开头的小写字母、数字和连字符,不能与内置分区重名,否则在开发时直接抛错。
167
167
 
168
+ ### 行为事件
169
+
170
+ 已登录用户的关键页面和点击自动上报到统一账号中心(统一中心 `docs/用户行为事件.md`),运营在统一中心后台按行为圈人:
171
+
172
+ - `ConsoleLayout` 每到一个页面记一次 `page.viewed`,`target` 是路由模板(像 ID 的路径段换成 `:id`);
173
+ - `UpgradeModal` 记 `upgrade_modal.opened` / `upgrade_modal.closed`(停留时长、有没有点「立即升级」),`trigger` 属性写触发它的
174
+ 功能键(例如 `adflow.video_generate`),不传时用插画名;
175
+ - `UpgradeEntry` 记 `upgrade_entry.clicked`,权益卡的付款按钮记 `plan.selected`(`target` 是价格编码)。
176
+
177
+ 产品自己的点击用 `useTrack()`:`track('works.exported', { target: '/works/:id', props: { format: 'mp4' } })`。事件名为
178
+ 「对象.过去式动作」;`target` 只放低基数的值,`props` 最多 20 个短字符串、数字或布尔,不放手机号、邮箱和输入内容。导出成功、
179
+ 生成完成这类关键动作以服务端为准,用 account-client 的 `Account.Track` 在业务成功后记。
180
+
181
+ 上报经产品自己的 `POST /api/account/events`(account-client 0.9.0 起由 ginaccount 提供,用户与空间按会话补上),
182
+ 2 秒或 20 条一批;会话恢复前先排队,确认已登录才发,未登录不发;失败不提示,后端还没有这个接口(404)时本次会话不再上报。
183
+
168
184
  ### 退出登录
169
185
 
170
186
  退出同时结束产品会话和 24.city 统一登录,然后回产品首页;其他标签页收到信号后停在“已退出登录”,不自动重新登录。
@@ -1,5 +1,14 @@
1
1
  import type { AxiosInstance } from 'axios';
2
2
  import type { ProductEntitlement, ProductIdentityContext, ProductPlan, ProductProfile, ProductSession, ProductSpacesResponse, ProductSubscription, ProductWallet } from './types';
3
+ export type BehaviorPropValue = string | number | boolean;
4
+ /** 浏览器上报的一条行为事件;用户与空间由产品服务端按会话补上(统一中心 docs/用户行为事件.md)。 */
5
+ export interface BehaviorEventInput {
6
+ eventId: string;
7
+ name: string;
8
+ target?: string;
9
+ occurredAt: string;
10
+ props?: Record<string, BehaviorPropValue>;
11
+ }
3
12
  /** 产品服务端账号接入模块(STD-ACCOUNT-001 `/api/account/*`)在浏览器侧的客户端。 */
4
13
  export interface AccountApi {
5
14
  startLogin: (returnPath: string, appBasePath: string) => string;
@@ -25,6 +34,11 @@ export interface AccountApi {
25
34
  getShownPrompts?: (keys: readonly string[]) => Promise<string[]>;
26
35
  /** 记下这些提示已弹出,返回这次新记下的,只弹这些(`POST /api/account/shown-prompts`)。 */
27
36
  claimShownPrompts?: (keys: readonly string[]) => Promise<string[]>;
37
+ /**
38
+ * 上报当前用户的行为事件(`POST /api/account/events`,account-client 0.9.0 起由 ginaccount 提供)。可选:
39
+ * 自己实现 AccountApi 的产品不写也能编译,只是 `useTrack` 不上报。
40
+ */
41
+ reportBehaviorEvents?: (events: BehaviorEventInput[]) => Promise<void>;
28
42
  }
29
43
  export declare const createAccountApi: (client: AxiosInstance, apiBaseUrl: string) => AccountApi;
30
44
  /** 会话与空间列表一起读;两边的当前空间不一致时重读一次会话,仍不一致则视为服务端状态异常。 */
@@ -32,5 +32,6 @@ export * from './use-logout';
32
32
  export * from './use-membership';
33
33
  export * from './use-plan-catalog';
34
34
  export * from './use-show-once';
35
+ export * from './use-track';
35
36
  export * from './use-space-switch';
36
37
  export * from './wallet-badge';
@@ -1,89 +1,92 @@
1
- import { A as e, a as o, c as t, b as n, i as r, d as u, l as i, 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-CLdquzzn.js";
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 O, R as T, S as E, d as b, T as U, U as w, e as F, p as _, f as x, g as v, h as B, u as R, y as I } from "../chunks/use-show-once-Bz1ojVqb.js";
3
- import { A as q, a as D, b as K, E as Q, F as G, P as H, c as k, d as W, U as Y, e as j, W as z, f as J, g as V, h as X, i as Z, j as $, k as aa, l as sa, m as ea, n as oa, o as ta, p as na, q as ra, r as ua, s as ia, t as ca, u as la, v as ga, w as pa, x as Aa, y as Sa, z as Pa, B as La, C as Ca, D as da, G as fa, H as ha, I as ma, J as ya, K as Na, L as Oa, M as Ta, N as Ea, O as ba, Q as Ua } from "../chunks/wallet-badge-COpdEDYI.js";
4
- import { A as Fa } from "../chunks/auth-provider-7FOj7Y84.js";
5
- import { notifyCustomerSessionChanged as xa, subscribeCustomerSessionChanges as va } from "@24city/web-runtime/session-sync";
1
+ import { A as s, a as o, c as t, b as n, i as r, d as u, l as i, n as c, r as l, e as g, f as p, u as S, g as A, w as P } from "../chunks/logout-signal-CsnJzWTz.js";
2
+ import { A as C, a as d, C as h, L as f, P as m, b as T, c as y, Q as N, R as O, S as b, d as E, T as U, U as v, e as w, p as F, f as R, g as _, h as x, u as B, y as I } from "../chunks/use-show-once-mq5WGTrX.js";
3
+ import { A as q, a as D, b as K, E as Q, F as k, P as G, c as H, d as W, U as Y, e as j, W as z, f as J, g as V, h as X, i as Z, j as $, k as aa, l as ea, m as sa, n as oa, o as ta, p as na, q as ra, r as ua, s as ia, t as ca, u as la, v as ga, w as pa, x as Sa, y as Aa, z as Pa, B as La, C as Ca, D as da, G as ha, H as fa, I as ma, J as Ta, K as ya, L as Na, M as Oa, N as ba, O as Ea, Q as Ua, R as va, S as wa, T as Fa } from "../chunks/wallet-badge-3oCaCiNm.js";
4
+ import { A as _a } from "../chunks/auth-provider-3AIfwcdS.js";
5
+ import { notifyCustomerSessionChanged as Ba, subscribeCustomerSessionChanges as Ia } from "@24city/web-runtime/session-sync";
6
6
  export {
7
7
  q as ACCOUNT_SECTIONS,
8
8
  D as AccountAvatar,
9
9
  C as AccountCenterPage,
10
10
  K as AccountMenu,
11
11
  d as AllowanceMeter,
12
- Fa as AuthProvider,
13
- e as AuthStoreProvider,
14
- f as CenterLinkButton,
12
+ _a as AuthProvider,
13
+ s as AuthStoreProvider,
14
+ h as CenterLinkButton,
15
15
  Q as EXPIRING_SOON_DAYS,
16
- G as FALLBACK_ACCOUNT_LABEL,
17
- h as LoginPage,
18
- H as PERSONAL_NAV_KEYS,
19
- k as PERSONAL_SPACE_LABEL,
16
+ k as FALLBACK_ACCOUNT_LABEL,
17
+ f as LoginPage,
18
+ G as PERSONAL_NAV_KEYS,
19
+ H as PERSONAL_SPACE_LABEL,
20
20
  m as PlanCards,
21
21
  W as PlanPanel,
22
- y as PointsSection,
23
- N as ProfileSection,
24
- O as QuotaPill,
25
- T as RouteGuard,
26
- E as SettingRow,
27
- b as SubscriptionSection,
22
+ T as PointsSection,
23
+ y as ProfileSection,
24
+ N as QuotaPill,
25
+ O as RouteGuard,
26
+ b as SettingRow,
27
+ E as SubscriptionSection,
28
28
  U as TeamPromo,
29
29
  Y as UNLIMITED_QUOTA,
30
30
  j as UpgradeEntry,
31
- w as UpgradeModal,
31
+ v as UpgradeModal,
32
32
  z as WalletBadge,
33
- F as accountCenterPageUrl,
33
+ w as accountCenterPageUrl,
34
34
  J as accountQueryKeys,
35
35
  V as accountSectionPath,
36
36
  o as announceLogout,
37
- X as buildPersonalNavigation,
38
- Z as canBuyForSpace,
39
- $ as catalogPlanOf,
37
+ X as behaviorRouteTemplate,
38
+ Z as buildPersonalNavigation,
39
+ $ as canBuyForSpace,
40
+ aa as catalogPlanOf,
40
41
  t as createAccountApi,
41
42
  n as createAuthStore,
42
- aa as entryTeamPlan,
43
- sa as featureLines,
44
- ea as formatPlanAmount,
45
- oa as formatPlanPrice,
46
- ta as isAccountCenterPath,
47
- na as isAccountSection,
43
+ ea as createBehaviorTracker,
44
+ sa as entryTeamPlan,
45
+ oa as featureLines,
46
+ ta as formatPlanAmount,
47
+ na as formatPlanPrice,
48
+ ra as isAccountCenterPath,
49
+ ua as isAccountSection,
48
50
  r as isLeavingForLogout,
49
51
  u as isLoggedOutElsewhere,
50
- ra as isTeamSpace,
51
- ua as isTeamSubscriptionRequired,
52
- ia as isUnlimited,
52
+ ia as isTeamSpace,
53
+ ca as isTeamSubscriptionRequired,
54
+ la as isUnlimited,
53
55
  i as leaveForLogout,
54
56
  c as noteLogoutElsewhere,
55
- xa as notifySessionChanged,
56
- ca as offerHighlights,
57
- la as personalNavKey,
58
- _ as planBenefitLines,
59
- x as planCopy,
60
- ga as planDaysLeft,
61
- pa as planFocusOf,
62
- Aa as planFocusState,
63
- Sa as planPeriodText,
64
- Pa as planTitle,
65
- v as plansUrl,
66
- B as priceFor,
67
- La as productAccountSections,
68
- Ca as quotaCopy,
69
- da as quotaFull,
70
- fa as quotaText,
57
+ Ba as notifySessionChanged,
58
+ ga as offerHighlights,
59
+ pa as personalNavKey,
60
+ F as planBenefitLines,
61
+ R as planCopy,
62
+ Sa as planDaysLeft,
63
+ Aa as planFocusOf,
64
+ Pa as planFocusState,
65
+ La as planPeriodText,
66
+ Ca as planTitle,
67
+ _ as plansUrl,
68
+ x as priceFor,
69
+ da as productAccountSections,
70
+ ha as quotaCopy,
71
+ fa as quotaFull,
72
+ ma as quotaText,
71
73
  l as releaseLogoutHold,
72
74
  g as resetLogoutSignalForTest,
73
75
  p as restoreIdentityContext,
74
- ha as spaceDisplayName,
75
- ma as spaceRoleLabel,
76
- ya as startingPrice,
77
- va as subscribeSessionChanged,
78
- Na as upgradeOffer,
79
- Oa as useAccountCenter,
80
- A as useAuthState,
81
- S as useAuthStore,
82
- Ta as useLogout,
83
- Ea as useMembership,
84
- ba as usePlanCatalog,
85
- R as useShowOnce,
86
- Ua as useSpaceSwitch,
76
+ Ta as spaceDisplayName,
77
+ ya as spaceRoleLabel,
78
+ Na as startingPrice,
79
+ Ia as subscribeSessionChanged,
80
+ Oa as upgradeOffer,
81
+ ba as useAccountCenter,
82
+ S as useAuthState,
83
+ A as useAuthStore,
84
+ Ea as useLogout,
85
+ Ua as useMembership,
86
+ va as usePlanCatalog,
87
+ B as useShowOnce,
88
+ wa as useSpaceSwitch,
89
+ Fa as useTrack,
87
90
  P as withdrawLogout,
88
91
  I as yearlyNote
89
92
  };
@@ -6,9 +6,11 @@ export type UpgradeArt = 'engine' | 'crown';
6
6
  * 再从权益卡去统一账号中心付款,不直接跳账号中心。团队空间的非所有者看不到按钮,只说明请所有者升级。
7
7
  * 用在用户点了当前套餐不含的功能时。
8
8
  */
9
- export declare const UpgradeModal: ({ title, description, art, onClose, }: {
9
+ export declare const UpgradeModal: ({ title, description, art, trigger, onClose, }: {
10
10
  title: string;
11
11
  description: string;
12
12
  art?: UpgradeArt;
13
+ /** 为什么弹:触发它的功能键或场景(如 `adflow.video_generate`),记在行为事件的 target 上;不传时用插画名。 */
14
+ trigger?: string;
13
15
  onClose: () => void;
14
16
  }) => import("react").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import type { BehaviorEventInput, BehaviorPropValue } from './account-api';
2
+ export interface TrackOptions {
3
+ /** 低基数的作用对象:页面路由模板、套餐编码、弹窗名等;不放用户输入和真实 ID。 */
4
+ target?: string;
5
+ /** 最多 20 个短字符串、数字或布尔;不放手机号、邮箱、Token、输入内容。 */
6
+ props?: Record<string, BehaviorPropValue>;
7
+ }
8
+ /** `track('works.exported', { target: '/works/:id', props: { format: 'mp4' } })`;事件名为「对象.过去式动作」。 */
9
+ export type Track = (name: string, options?: TrackOptions) => void;
10
+ interface Tracker {
11
+ track: Track;
12
+ flush: () => Promise<void>;
13
+ /** 登录状态:未知时事件先排队不发;确认已登录后照常发送,确认未登录则丢掉队列。 */
14
+ setSignedIn: (signedIn: boolean | undefined) => void;
15
+ }
16
+ /**
17
+ * 一个账号接口一份队列:2 秒或满 20 条发一次;产品后端没有转发接口(404)时本次会话不再上报。
18
+ * 不传 signedIn 时视为已登录(直接用队列的场景);useTrack 按会话恢复的结果设置。
19
+ */
20
+ export declare const createBehaviorTracker: (report: (events: BehaviorEventInput[]) => Promise<void>, signedIn?: boolean | undefined) => Tracker;
21
+ /**
22
+ * 记录当前用户的行为。只在已登录时上报;自己实现 AccountApi 且没有 `reportBehaviorEvents` 的产品什么也不发。
23
+ * 关键动作(导出成功、生成完成)以服务端为准,用 account-client 的 `Account.Track` 在业务成功后记;
24
+ * 这里记页面和点击这类只有前端知道的事。
25
+ */
26
+ export declare const useTrack: () => Track;
27
+ /**
28
+ * 页面的路由模板:像 ID 的路径段(数字、UUID、长十六进制、16 位以上含数字的串)和含其他字符的段(中文、编码后的关键词)
29
+ * 都换成 `:id`,去掉末尾斜杠。
30
+ */
31
+ export declare const behaviorRouteTemplate: (pathname: string) => string;
32
+ export {};
@@ -2,7 +2,7 @@ import { jsx as y, Fragment as C } from "react/jsx-runtime";
2
2
  import { useEffect as S } from "react";
3
3
  import { useQueryClient as U } from "@tanstack/react-query";
4
4
  import { b as I } from "./context-CaVim6ZO.js";
5
- import { g as L, n as g, i as d, v as x, f as m, r as A, t as f } from "./logout-signal-CLdquzzn.js";
5
+ import { g as L, n as g, i as d, v as x, f as m, r as A, t as f } from "./logout-signal-CsnJzWTz.js";
6
6
  import { subscribeCustomerSessionChanges as E } from "@24city/web-runtime/session-sync";
7
7
  const P = (t) => !f(t, 401) && !f(t, 403) && !f(t, 404), k = (t, n) => (t == null ? void 0 : t.purpose) === n.purpose && t.globalUserId === n.globalUserId && t.activeSpaceId === n.activeSpaceId, $ = ({ children: t }) => {
8
8
  const n = U(), e = L(), { accountApi: u, config: s, http: l } = I();
@@ -0,0 +1,214 @@
1
+ import { jsx as t, jsxs as c, Fragment as O } from "react/jsx-runtime";
2
+ import { useEffect as z, useState as b } from "react";
3
+ import { Layout as v, Button as f, Typography as q, Space as D, Nav as $ } from "@douyinfe/semi-ui";
4
+ import { IconSidebar as P } from "@douyinfe/semi-icons";
5
+ import { useLocation as F, useNavigate as Q, Outlet as Y } from "react-router";
6
+ import { T as J, h as V, i as X, D as Z, q as ee, e as te, W as ne, b as ae } from "./wallet-badge-3oCaCiNm.js";
7
+ import { u as R, b as oe, a as se } from "./context-CaVim6ZO.js";
8
+ import { u as le } from "./use-media-query-DvyinWNg.js";
9
+ import { a as re } from "./scale-smFifpMm.js";
10
+ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_34", ue = "_logo_1vz0g_43", me = "_logoMark_1vz0g_58", pe = "_logoText_1vz0g_65", _e = "_modules_1vz0g_75", he = "_module_1vz0g_75", ge = "_moduleText_1vz0g_123", ve = "_moduleIcon_1vz0g_143", fe = "_moduleInk_1vz0g_147", ke = "_headerRight_1vz0g_167", ye = "_walletSlot_1vz0g_172", Ne = "_body_1vz0g_180", ze = "_sider_1vz0g_186", be = "_siderInner_1vz0g_200", Ie = "_panel_1vz0g_207", we = "_expandButton_1vz0g_244", xe = "_menu_1vz0g_260", Ce = "_menuGroup_1vz0g_271", Me = "_menuGroupPlain_1vz0g_280", Te = "_menuGroupTitle_1vz0g_285", Be = "_menuList_1vz0g_296", Le = "_collapseButton_1vz0g_419", Ge = "_mask_1vz0g_440", Se = "_content_1vz0g_449", $e = "_contentCentered_1vz0g_455", Pe = "_contentInner_1vz0g_467", Re = "_letterMark_1vz0g_520", e = {
11
+ layout: ce,
12
+ header: ie,
13
+ headerLeft: de,
14
+ logo: ue,
15
+ logoMark: me,
16
+ logoText: pe,
17
+ modules: _e,
18
+ module: he,
19
+ moduleText: ge,
20
+ moduleIcon: ve,
21
+ moduleInk: fe,
22
+ headerRight: ke,
23
+ walletSlot: ye,
24
+ body: Ne,
25
+ sider: ze,
26
+ siderInner: be,
27
+ panel: Ie,
28
+ expandButton: we,
29
+ menu: xe,
30
+ menuGroup: Ce,
31
+ menuGroupPlain: Me,
32
+ menuGroupTitle: Te,
33
+ menuList: Be,
34
+ collapseButton: Le,
35
+ mask: Ge,
36
+ content: Se,
37
+ contentCentered: $e,
38
+ contentInner: Pe,
39
+ letterMark: Re
40
+ }, Ue = (a, l) => a === l || a.startsWith(`${l}/`), Ae = (a, l) => a.flatMap((o) => o.items).find((o) => new URL(o.to, "http://console.local").pathname === l), Ee = (a, l) => {
41
+ var o;
42
+ return (o = [...a].map((r) => ({ module: r, path: new URL(r.to, "http://console.local").pathname })).filter(({ path: r }) => Ue(l, r)).sort((r, u) => u.path.length - r.path.length)[0]) == null ? void 0 : o.module;
43
+ }, Ke = () => {
44
+ const [a, l] = b(!1);
45
+ return z(() => {
46
+ const o = () => l(window.scrollY > 0);
47
+ return o(), window.addEventListener("scroll", o, { passive: !0 }), () => window.removeEventListener("scroll", o);
48
+ }, []), a;
49
+ }, We = ({ size: a = 30, className: l }) => {
50
+ const o = R(), r = (u) => l ? `${u} ${l}` : u;
51
+ return o.markUrl ? /* @__PURE__ */ t(
52
+ "span",
53
+ {
54
+ className: r(e.logoMark),
55
+ style: { width: a, height: a, backgroundImage: `url("${o.markUrl}")` },
56
+ "aria-hidden": "true"
57
+ }
58
+ ) : /* @__PURE__ */ t("span", { className: r(e.letterMark), style: { width: a, height: a }, "aria-hidden": "true", children: Array.from(o.mark).slice(0, 2).join("") });
59
+ }, Ve = ({
60
+ modules: a = [],
61
+ activeModuleKey: l,
62
+ moduleTarget: o,
63
+ sidebar: r = [],
64
+ selectedKey: u,
65
+ renderItemLabel: I,
66
+ headerRight: U,
67
+ menuLabel: A = "工作台菜单",
68
+ children: E,
69
+ extra: K
70
+ }) => {
71
+ var S;
72
+ const { config: w } = oe(), x = R(), p = F(), C = J();
73
+ z(() => {
74
+ C("page.viewed", { target: V(p.pathname) });
75
+ }, [p.pathname, C]);
76
+ const k = Q(), M = w.routes.app, h = X(M, Z(se())), T = ee(M, p.pathname), g = T ? [] : r ?? [], B = g.length > 0, W = l ?? ((S = Ee(a, p.pathname)) == null ? void 0 : S.key), m = Ae([...g, h], p.pathname), L = u ?? (m == null ? void 0 : m.key), i = le(re("desktop")), j = Ke(), [_, y] = b(!i), [N, d] = b(!1), H = new Map([...g, h].flatMap((n) => n.items.map((s) => [s.key, s])));
77
+ z(() => {
78
+ y(!i), d(!1);
79
+ }, [i]);
80
+ const G = (n) => {
81
+ const s = H.get(n);
82
+ s && k(s.to), d(!1);
83
+ };
84
+ return /* @__PURE__ */ c(v, { className: e.layout, children: [
85
+ /* @__PURE__ */ c(v.Header, { className: e.header, "data-scrolled": j ? "true" : "false", children: [
86
+ /* @__PURE__ */ c("div", { className: e.headerLeft, children: [
87
+ /* @__PURE__ */ c(
88
+ f,
89
+ {
90
+ theme: "borderless",
91
+ type: "tertiary",
92
+ className: e.logo,
93
+ "aria-label": `${x.shortName} 首页`,
94
+ onClick: () => k(w.routes.publicHome),
95
+ children: [
96
+ /* @__PURE__ */ t(We, {}),
97
+ /* @__PURE__ */ t(q.Text, { className: e.logoText, children: x.shortName })
98
+ ]
99
+ }
100
+ ),
101
+ a.length ? /* @__PURE__ */ t("div", { className: e.modules, role: "navigation", "aria-label": "产品模块", children: a.map((n) => /* @__PURE__ */ c(
102
+ f,
103
+ {
104
+ theme: "borderless",
105
+ type: "tertiary",
106
+ className: e.module,
107
+ "aria-current": W === n.key ? "page" : void 0,
108
+ onClick: () => k(o ? o(n) : n.to),
109
+ children: [
110
+ /* @__PURE__ */ c("span", { className: e.moduleText, children: [
111
+ n.icon ? /* @__PURE__ */ t("span", { className: e.moduleIcon, children: /* @__PURE__ */ t(n.icon, {}) }) : null,
112
+ n.label
113
+ ] }),
114
+ /* @__PURE__ */ t("span", { className: e.moduleInk, "aria-hidden": "true" })
115
+ ]
116
+ },
117
+ n.key
118
+ )) }) : null
119
+ ] }),
120
+ /* @__PURE__ */ t(D, { spacing: 10, className: e.headerRight, children: U ?? /* @__PURE__ */ c(O, { children: [
121
+ /* @__PURE__ */ t(te, {}),
122
+ /* @__PURE__ */ t("span", { className: e.walletSlot, children: /* @__PURE__ */ t(ne, {}) }),
123
+ /* @__PURE__ */ t(ae, { personal: h, selectedKey: m && h.items.includes(m) ? m.key : void 0, onOpen: G })
124
+ ] }) })
125
+ ] }),
126
+ /* @__PURE__ */ c(v, { className: e.body, children: [
127
+ B ? /* @__PURE__ */ t("aside", { className: e.sider, "data-collapsed": _ ? "true" : "false", children: /* @__PURE__ */ c(
128
+ "div",
129
+ {
130
+ className: e.siderInner,
131
+ "data-collapsed": _ ? "true" : "false",
132
+ "data-peek": N ? "true" : "false",
133
+ onMouseEnter: () => {
134
+ _ && i && d(!0);
135
+ },
136
+ onMouseLeave: () => {
137
+ i && d(!1);
138
+ },
139
+ children: [
140
+ _ ? /* @__PURE__ */ t(
141
+ f,
142
+ {
143
+ theme: "light",
144
+ type: "tertiary",
145
+ className: e.expandButton,
146
+ icon: /* @__PURE__ */ t(P, { "aria-hidden": "true" }),
147
+ "aria-label": "展开侧边栏",
148
+ "aria-expanded": N,
149
+ onClick: () => {
150
+ i ? (y(!1), d(!1)) : d((n) => !n);
151
+ }
152
+ }
153
+ ) : null,
154
+ /* @__PURE__ */ c("div", { className: e.panel, children: [
155
+ /* @__PURE__ */ t("nav", { className: e.menu, "aria-label": A, children: g.map((n) => /* @__PURE__ */ c(
156
+ "div",
157
+ {
158
+ className: n.label ? e.menuGroup : `${e.menuGroup} ${e.menuGroupPlain}`,
159
+ role: "group",
160
+ "aria-label": n.label || void 0,
161
+ children: [
162
+ n.label ? /* @__PURE__ */ t("div", { className: e.menuGroupTitle, children: n.label }) : null,
163
+ /* @__PURE__ */ t(
164
+ $,
165
+ {
166
+ mode: "vertical",
167
+ className: e.menuList,
168
+ selectedKeys: L ? [L] : [],
169
+ onSelect: ({ itemKey: s }) => G(String(s)),
170
+ children: n.items.map((s) => /* @__PURE__ */ t(
171
+ $.Item,
172
+ {
173
+ itemKey: s.key,
174
+ icon: s.icon ? /* @__PURE__ */ t(s.icon, {}) : void 0,
175
+ text: I ? I(s) : s.label
176
+ },
177
+ s.key
178
+ ))
179
+ }
180
+ )
181
+ ]
182
+ },
183
+ n.key
184
+ )) }),
185
+ i ? /* @__PURE__ */ t(
186
+ f,
187
+ {
188
+ theme: "borderless",
189
+ type: "tertiary",
190
+ className: e.collapseButton,
191
+ icon: /* @__PURE__ */ t(P, { "aria-hidden": "true" }),
192
+ onClick: () => {
193
+ y((n) => !n), d(!1);
194
+ },
195
+ children: _ ? "固定侧边栏" : "收起侧边栏"
196
+ }
197
+ ) : null
198
+ ] })
199
+ ]
200
+ }
201
+ ) }) : null,
202
+ N && !i && B ? /* @__PURE__ */ t("div", { className: e.mask, "aria-hidden": "true", onClick: () => d(!1) }) : null,
203
+ /* @__PURE__ */ t(v.Content, { className: T ? `${e.content} ${e.contentCentered}` : e.content, children: /* @__PURE__ */ t("div", { className: e.contentInner, children: E ?? /* @__PURE__ */ t(Y, {}) }) })
204
+ ] }),
205
+ K
206
+ ] });
207
+ };
208
+ export {
209
+ We as B,
210
+ Ve as C,
211
+ Ae as a,
212
+ Ee as f,
213
+ Ue as i
214
+ };