@24city/web-console 0.3.12 → 0.3.14

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,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.14
4
+
5
+ **修复:离开页面前还在排队的访客来访和行为事件会丢**(`@24city/web-console/account`)
6
+
7
+ - 原先排队的上报只在攒满 2 秒或 20 条、或者 `pagehide` 时发出。手机上页面转入后台后可能被系统直接回收,不会再有
8
+ `pagehide`,看一眼就走的访客这一页(连同带来的推广来源)就丢了。现在页面一转入后台(`visibilitychange` 变为 hidden)
9
+ 就立即发出。在 Chrome 里模拟“转入后台约 0.2 秒后被回收”:改前 3 次全丢,改后 3 次全到;直接关标签页或跳去别的网站,
10
+ 改前改后都能送到。
11
+ - 页面关闭和转入后台时的这一批改用浏览器 fetch 的 keepalive 发出,页面关掉后请求仍会发完。请求照样经过产品 axios 客户端的
12
+ 拦截器(CSRF 头、基础路径),也不会带上 axios 自带 fetch 适配器加的 `User-Agent: axios/…`,统一中心记的浏览器和设备不受影响。
13
+ - `AccountApi.reportVisits`、`reportBehaviorEvents` 新增可选的第二个参数 `options?: ReportOptions`(`{ keepalive?: boolean }`),
14
+ `VisitorTracker.flush` 也接受它。自己实现 AccountApi 的产品不改也能编译,只是页面关闭时仍按原来的方式发送。
15
+ - 积压超过 20 条时各批同时发出,不再等上一批的回应。
16
+
17
+ ## 0.3.13
18
+
19
+ **新增:没登录访客的来访**(`@24city/web-console/account`,统一账号中心 API 1.27.0;运营在统一中心「访客运营」里看产品站点
20
+ 的访客从哪来、在哪一步流失,在产品里注册的账号也能对上来源渠道,统一中心 `docs/访客运营.md`)
21
+
22
+ - `useTrack()` 在确认没登录后不再把页面浏览丢掉:`page.viewed` 转为访客的来访,经产品自己的 `POST /api/account/visits`
23
+ (account-client 0.10.0 起由 ginaccount 提供)上报;其他事件仍只记已登录用户。会话恢复前记下的页面浏览,确认没登录后一并转过去。
24
+ - 这次打开网页的来源(链接上的 `utm_source` / `utm_medium` / `utm_campaign` 和外部来源网站的域名)在包加载时读一次,
25
+ 只随第一页上报;路径用路由模板,不带真实 ID。访客是谁由服务端读统一中心共用的访客 Cookie,浏览器不传。
26
+ - 新增 `useTrackPageView()`:产品自己的公开页面(价格页、文档页等)调用一次即可记浏览;`ConsoleLayout` 和 `@24city/web-home`
27
+ 的首页已自动记。
28
+ - `AccountApi.reportVisits`(可选方法,自己实现 AccountApi 的产品不写也能编译)、`VisitorPageViewInput`、
29
+ `createVisitorTracker`、`readVisitorLanding`、`PAGE_VIEWED`。
30
+ - `AccountApi.startLogin(returnPath, appBasePath, options?)` 新增可选的 `options.entry`(小写字母开头,如 `hero`),
31
+ `LoginPage` 把地址上的 `?entry=` 转给它:统一中心按它统计是哪个按钮带来了登录和注册。
32
+ - 2 秒或 20 条一批,失败不提示;产品后端还没有这个接口(404)时本次会话不再上报,所以先升级本包、后升级 account-client 也不会出错。
33
+
3
34
  ## 0.3.12
4
35
 
5
36
  **修复:发布期间恢复会话停在不可用页**(`AuthProvider`、`RouteGuard`、`LoginPage`)
package/README.md CHANGED
@@ -179,7 +179,20 @@ const customization: ConsoleCustomization = {
179
179
  生成完成这类关键动作以服务端为准,用 account-client 的 `Account.Track` 在业务成功后记。
180
180
 
181
181
  上报经产品自己的 `POST /api/account/events`(account-client 0.9.0 起由 ginaccount 提供,用户与空间按会话补上),
182
- 2 秒或 20 条一批;会话恢复前先排队,确认已登录才发,未登录不发;失败不提示,后端还没有这个接口(404)时本次会话不再上报。
182
+ 2 秒或 20 条一批;页面关闭或转入后台时,排队的立即用 keepalive 发出(页面关掉后请求仍会发完);会话恢复前先排队,
183
+ 确认已登录才发;失败不提示,后端还没有这个接口(404)时本次会话不再上报。没登录访客的来访按同样的方式发送。
184
+
185
+ ### 访客来访
186
+
187
+ 没登录的访客只记页面浏览,算统一中心「访客运营」里的来访(统一中心 `docs/访客运营.md`):运营能看到产品站点的访客从哪来、
188
+ 点了哪个登录按钮、最后有没有注册,在产品里注册的账号也能对上来源渠道。
189
+
190
+ - 确认没登录后,`page.viewed` 经产品自己的 `POST /api/account/visits`(account-client 0.10.0 起)上报,其他事件不记;
191
+ - 这次打开网页的来源(`utm_source` / `utm_medium` / `utm_campaign` 和外部来源网站)只随第一页上报一次;
192
+ - 访客是谁由产品服务端读统一中心共用的访客 Cookie(`.24.city` 下的 `gg_vid`),浏览器不传,也不存在本地;
193
+ - `ConsoleLayout` 和 `@24city/web-home` 的首页已自动记,产品自己的公开页面调用一次 `useTrackPageView()`;
194
+ - 自己做的首页按钮去登录时带上位置:跳到登录页并加上 `entry`(如 `/login?returnPath=/app&entry=hero`),`LoginPage` 会把它
195
+ 交给 `startLogin`。
183
196
 
184
197
  ### 退出登录
185
198
 
@@ -1,6 +1,29 @@
1
1
  import type { AxiosInstance } from 'axios';
2
2
  import type { ProductEntitlement, ProductIdentityContext, ProductPlan, ProductProfile, ProductSession, ProductSpacesResponse, ProductSubscription, ProductWallet } from './types';
3
3
  export type BehaviorPropValue = string | number | boolean;
4
+ /**
5
+ * 没登录访客看过的一页(统一中心 docs/访客运营.md):路径用路由模板;来源网站和推广参数只在这次打开网页的第一页带。
6
+ * 访客是谁由产品服务端读统一中心共用的访客 Cookie,浏览器不传。
7
+ */
8
+ export interface VisitorPageViewInput {
9
+ path: string;
10
+ referrerHost?: string;
11
+ utmSource?: string;
12
+ utmMedium?: string;
13
+ utmCampaign?: string;
14
+ occurredAt: string;
15
+ }
16
+ /** 发起登录的附加信息。entry 是点的哪个按钮(如 hero),统一中心按它统计登录入口。 */
17
+ export interface StartLoginOptions {
18
+ entry?: string;
19
+ }
20
+ /**
21
+ * 上报的发送方式。keepalive:页面正在关闭(关标签页、跳去别的网站、切到后台),请求要在页面关掉后继续发完
22
+ * (浏览器 fetch 的 keepalive);普通请求在页面关掉后可能被浏览器取消。
23
+ */
24
+ export interface ReportOptions {
25
+ keepalive?: boolean;
26
+ }
4
27
  /** 浏览器上报的一条行为事件;用户与空间由产品服务端按会话补上(统一中心 docs/用户行为事件.md)。 */
5
28
  export interface BehaviorEventInput {
6
29
  eventId: string;
@@ -11,7 +34,7 @@ export interface BehaviorEventInput {
11
34
  }
12
35
  /** 产品服务端账号接入模块(STD-ACCOUNT-001 `/api/account/*`)在浏览器侧的客户端。 */
13
36
  export interface AccountApi {
14
- startLogin: (returnPath: string, appBasePath: string) => string;
37
+ startLogin: (returnPath: string, appBasePath: string, options?: StartLoginOptions) => string;
15
38
  getSession: () => Promise<ProductSession>;
16
39
  getSpaces: () => Promise<ProductSpacesResponse>;
17
40
  switchSpace: (spaceId: string) => Promise<ProductSession>;
@@ -36,9 +59,15 @@ export interface AccountApi {
36
59
  claimShownPrompts?: (keys: readonly string[]) => Promise<string[]>;
37
60
  /**
38
61
  * 上报当前用户的行为事件(`POST /api/account/events`,account-client 0.9.0 起由 ginaccount 提供)。可选:
39
- * 自己实现 AccountApi 的产品不写也能编译,只是 `useTrack` 不上报。
62
+ * 自己实现 AccountApi 的产品不写也能编译,只是 `useTrack` 不上报。页面关闭时 `useTrack` 传 `{ keepalive: true }`,
63
+ * 自己实现的要让这次请求在页面关掉后仍能发完,否则离开前的最后一批会丢。
64
+ */
65
+ reportBehaviorEvents?: (events: BehaviorEventInput[], options?: ReportOptions) => Promise<void>;
66
+ /**
67
+ * 上报没登录访客看过的页面(`POST /api/account/visits`,account-client 0.10.0 起由 ginaccount 提供)。可选:
68
+ * 自己实现 AccountApi 的产品不写也能编译,只是没登录的浏览不记。`options.keepalive` 同 `reportBehaviorEvents`。
40
69
  */
41
- reportBehaviorEvents?: (events: BehaviorEventInput[]) => Promise<void>;
70
+ reportVisits?: (pageViews: VisitorPageViewInput[], options?: ReportOptions) => Promise<void>;
42
71
  }
43
72
  export declare const createAccountApi: (client: AxiosInstance, apiBaseUrl: string) => AccountApi;
44
73
  /** 会话与空间列表一起读;两边的当前空间不一致时重读一次会话,仍不一致则视为服务端状态异常。 */
@@ -1,92 +1,96 @@
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-qvHorCCF.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-Cwj5z_Lo.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-DnWl21es.js";
4
- import { A as _a } from "../chunks/auth-provider-Cwib6lRM.js";
5
- import { notifyCustomerSessionChanged as Ba, subscribeCustomerSessionChanges as Ia } from "@24city/web-runtime/session-sync";
1
+ import { A as s, a as t, c as o, b as r, i as n, 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-DtOS9Rse.js";
2
+ import { A as d, a as C, C as h, L as f, P as m, b as T, c as y, Q as E, R as N, S as O, d as b, T as w, U, e as _, p as v, f as F, g as R, h as x, u as B, y as I } from "../chunks/use-show-once-BMTl8DL7.js";
3
+ import { A as D, a as M, b as V, E as q, F as K, P as Q, c as G, d as H, e as W, U as Y, f as X, W as j, g as z, h as J, i as Z, j as $, k as aa, l as ea, m as sa, n as ta, o as oa, p as ra, q as na, r as ia, s as ua, 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 da, D as Ca, G as ha, H as fa, I as ma, J as Ta, K as ya, L as Ea, M as Na, N as Oa, O as ba, Q as wa, R as Ua, S as _a, T as va, V as Fa, X as Ra, Y as xa, Z as Ba } from "../chunks/wallet-badge-Cu2WL0RX.js";
4
+ import { A as ka } from "../chunks/auth-provider-BzxebTYE.js";
5
+ import { notifyCustomerSessionChanged as Ma, subscribeCustomerSessionChanges as Va } from "@24city/web-runtime/session-sync";
6
6
  export {
7
- q as ACCOUNT_SECTIONS,
8
- D as AccountAvatar,
9
- C as AccountCenterPage,
10
- K as AccountMenu,
11
- d as AllowanceMeter,
12
- _a as AuthProvider,
7
+ D as ACCOUNT_SECTIONS,
8
+ M as AccountAvatar,
9
+ d as AccountCenterPage,
10
+ V as AccountMenu,
11
+ C as AllowanceMeter,
12
+ ka as AuthProvider,
13
13
  s as AuthStoreProvider,
14
14
  h as CenterLinkButton,
15
- Q as EXPIRING_SOON_DAYS,
16
- k as FALLBACK_ACCOUNT_LABEL,
15
+ q as EXPIRING_SOON_DAYS,
16
+ K as FALLBACK_ACCOUNT_LABEL,
17
17
  f as LoginPage,
18
+ Q as PAGE_VIEWED,
18
19
  G as PERSONAL_NAV_KEYS,
19
20
  H as PERSONAL_SPACE_LABEL,
20
21
  m as PlanCards,
21
22
  W as PlanPanel,
22
23
  T as PointsSection,
23
24
  y as ProfileSection,
24
- N as QuotaPill,
25
- O as RouteGuard,
26
- b as SettingRow,
27
- E as SubscriptionSection,
28
- U as TeamPromo,
25
+ E as QuotaPill,
26
+ N as RouteGuard,
27
+ O as SettingRow,
28
+ b as SubscriptionSection,
29
+ w as TeamPromo,
29
30
  Y as UNLIMITED_QUOTA,
30
- j as UpgradeEntry,
31
- v as UpgradeModal,
32
- z as WalletBadge,
33
- w as accountCenterPageUrl,
34
- J as accountQueryKeys,
35
- V as accountSectionPath,
36
- o as announceLogout,
37
- X as behaviorRouteTemplate,
38
- Z as buildPersonalNavigation,
39
- $ as canBuyForSpace,
40
- aa as catalogPlanOf,
41
- t as createAccountApi,
42
- n as createAuthStore,
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,
50
- r as isLeavingForLogout,
51
- u as isLoggedOutElsewhere,
52
- ia as isTeamSpace,
53
- ca as isTeamSubscriptionRequired,
54
- la as isUnlimited,
55
- i as leaveForLogout,
31
+ X as UpgradeEntry,
32
+ U as UpgradeModal,
33
+ j as WalletBadge,
34
+ _ as accountCenterPageUrl,
35
+ z as accountQueryKeys,
36
+ J as accountSectionPath,
37
+ t as announceLogout,
38
+ Z as behaviorRouteTemplate,
39
+ $ as buildPersonalNavigation,
40
+ aa as canBuyForSpace,
41
+ ea as catalogPlanOf,
42
+ o as createAccountApi,
43
+ r as createAuthStore,
44
+ sa as createBehaviorTracker,
45
+ ta as createVisitorTracker,
46
+ oa as entryTeamPlan,
47
+ ra as featureLines,
48
+ na as formatPlanAmount,
49
+ ia as formatPlanPrice,
50
+ ua as isAccountCenterPath,
51
+ ca as isAccountSection,
52
+ n as isLeavingForLogout,
53
+ i as isLoggedOutElsewhere,
54
+ la as isTeamSpace,
55
+ ga as isTeamSubscriptionRequired,
56
+ pa as isUnlimited,
57
+ u as leaveForLogout,
56
58
  c as noteLogoutElsewhere,
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,
59
+ Ma as notifySessionChanged,
60
+ Aa as offerHighlights,
61
+ Sa as personalNavKey,
62
+ v as planBenefitLines,
63
+ F as planCopy,
64
+ Pa as planDaysLeft,
65
+ La as planFocusOf,
66
+ da as planFocusState,
67
+ Ca as planPeriodText,
68
+ ha as planTitle,
69
+ R as plansUrl,
68
70
  x as priceFor,
69
- da as productAccountSections,
70
- ha as quotaCopy,
71
- fa as quotaFull,
72
- ma as quotaText,
71
+ fa as productAccountSections,
72
+ ma as quotaCopy,
73
+ Ta as quotaFull,
74
+ ya as quotaText,
75
+ Ea as readVisitorLanding,
73
76
  l as releaseLogoutHold,
74
77
  g as resetLogoutSignalForTest,
75
78
  p as restoreIdentityContext,
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,
79
+ Na as spaceDisplayName,
80
+ Oa as spaceRoleLabel,
81
+ ba as startingPrice,
82
+ Va as subscribeSessionChanged,
83
+ wa as upgradeOffer,
84
+ Ua as useAccountCenter,
85
+ A as useAuthState,
86
+ S as useAuthStore,
87
+ _a as useLogout,
88
+ va as useMembership,
89
+ Fa as usePlanCatalog,
87
90
  B as useShowOnce,
88
- wa as useSpaceSwitch,
89
- Fa as useTrack,
91
+ Ra as useSpaceSwitch,
92
+ xa as useTrack,
93
+ Ba as useTrackPageView,
90
94
  P as withdrawLogout,
91
95
  I as yearlyNote
92
96
  };
@@ -0,0 +1,7 @@
1
+ import { type AxiosAdapter } from 'axios';
2
+ /**
3
+ * 页面正在关闭时用的发送方式:请求照常经过 axios 的拦截器(CSRF 头、基础路径),最后由浏览器的 fetch 以 keepalive 发出,
4
+ * 页面关掉后请求仍会发完。不用 axios 自带的 fetch 适配器,是因为它会加上 `User-Agent: axios/…`,部分浏览器照发,
5
+ * 统一中心就把访客的浏览器和设备记错了。
6
+ */
7
+ export declare const keepaliveAdapter: AxiosAdapter;
@@ -1,4 +1,4 @@
1
- import type { BehaviorEventInput, BehaviorPropValue } from './account-api';
1
+ import type { BehaviorEventInput, BehaviorPropValue, ReportOptions, VisitorPageViewInput } from './account-api';
2
2
  export interface TrackOptions {
3
3
  /** 低基数的作用对象:页面路由模板、套餐编码、弹窗名等;不放用户输入和真实 ID。 */
4
4
  target?: string;
@@ -7,23 +7,52 @@ export interface TrackOptions {
7
7
  }
8
8
  /** `track('works.exported', { target: '/works/:id', props: { format: 'mp4' } })`;事件名为「对象.过去式动作」。 */
9
9
  export type Track = (name: string, options?: TrackOptions) => void;
10
+ /** 页面浏览的事件名:登录用户记为行为事件,没登录的访客记为来访。 */
11
+ export declare const PAGE_VIEWED = "page.viewed";
10
12
  interface Tracker {
11
13
  track: Track;
12
- flush: () => Promise<void>;
13
- /** 登录状态:未知时事件先排队不发;确认已登录后照常发送,确认未登录则丢掉队列。 */
14
+ flush: (options?: ReportOptions) => Promise<void>;
15
+ /** 登录状态:未知时事件先排队不发;确认已登录后照常发送,确认未登录则页面浏览转给访客队列、其他事件丢掉。 */
14
16
  setSignedIn: (signedIn: boolean | undefined) => void;
15
17
  }
18
+ /** 没登录访客的页面浏览队列。 */
19
+ export interface VisitorTracker {
20
+ pageView: (path: string, occurredAt?: string) => void;
21
+ /** 立即发出排队的页面浏览;`{ keepalive: true }` 用在页面马上要关的时候(例如跳去外部支付页之前)。 */
22
+ flush: (options?: ReportOptions) => Promise<void>;
23
+ }
24
+ /** 这次打开网页时的来源:外部来源网站和推广参数。 */
25
+ export type VisitorLanding = Omit<VisitorPageViewInput, 'path' | 'occurredAt'>;
26
+ /**
27
+ * 读这次打开网页时的来源:链接上的 utm_source / utm_medium / utm_campaign 和外部来源网站的域名。只取一次,
28
+ * 在模块加载时读,前端路由还没改写地址;同站内跳转不算来源。
29
+ */
30
+ export declare const readVisitorLanding: (href: string, referrer: string) => VisitorLanding | undefined;
16
31
  /**
17
- * 一个账号接口一份队列:2 秒或满 20 条发一次;产品后端没有转发接口(404)时本次会话不再上报。
18
- * 不传 signedIn 时视为已登录(直接用队列的场景);useTrack 按会话恢复的结果设置。
32
+ * 没登录访客的页面浏览:2 秒或满 20 条发一次;这次打开网页的第一页带上来源;页面关闭时把排队的用 keepalive 发出;
33
+ * 产品后端还没有转发接口(404)时本次会话不再上报。
19
34
  */
20
- export declare const createBehaviorTracker: (report: (events: BehaviorEventInput[]) => Promise<void>, signedIn?: boolean | undefined) => Tracker;
35
+ export declare const createVisitorTracker: (report: (pageViews: VisitorPageViewInput[], options?: ReportOptions) => Promise<void>,
36
+ /** 第一页带的来源;不传时用这次打开网页时读到的,传 null 表示没有。 */
37
+ landing?: VisitorLanding | null) => VisitorTracker;
21
38
  /**
22
- * 记录当前用户的行为。只在已登录时上报;自己实现 AccountApi 且没有 `reportBehaviorEvents` 的产品什么也不发。
39
+ * 一个账号接口一份队列:2 秒或满 20 条发一次;页面关闭时把排队的用 keepalive 发出;产品后端没有转发接口(404)时
40
+ * 本次会话不再上报。不传 signedIn 时视为已登录(直接用队列的场景);useTrack 按会话恢复的结果设置。
41
+ * 没登录时页面浏览交给 visitor。
42
+ */
43
+ export declare const createBehaviorTracker: (report: (events: BehaviorEventInput[], options?: ReportOptions) => Promise<void>, signedIn?: boolean | undefined, visitor?: VisitorTracker) => Tracker;
44
+ /**
45
+ * 记录当前用户的行为。已登录时上报行为事件;没登录时只记页面浏览,算访客的来访。自己实现 AccountApi 且没有
46
+ * `reportBehaviorEvents`、`reportVisits` 的产品什么也不发。
23
47
  * 关键动作(导出成功、生成完成)以服务端为准,用 account-client 的 `Account.Track` 在业务成功后记;
24
48
  * 这里记页面和点击这类只有前端知道的事。
25
49
  */
26
50
  export declare const useTrack: () => Track;
51
+ /**
52
+ * 记录当前页面的浏览:登录用户记为行为事件,没登录的访客记为来访。工作台布局(ConsoleLayout)和产品首页
53
+ * (@24city/web-home)已经自动记;产品自己的公开页面(价格页、文档页等)在页面组件里调用一次即可。
54
+ */
55
+ export declare const useTrackPageView: () => void;
27
56
  /**
28
57
  * 页面的路由模板:像 ID 的路径段(数字、UUID、长十六进制、16 位以上含数字的串)和含其他字符的段(中文、编码后的关键词)
29
58
  * 都换成 `:id`,去掉末尾斜杠。
@@ -2,7 +2,7 @@ import { jsx as U, Fragment as L } from "react/jsx-runtime";
2
2
  import { useEffect as T } from "react";
3
3
  import { useQueryClient as I } from "@tanstack/react-query";
4
4
  import { b as R } from "./context-CaVim6ZO.js";
5
- import { g as A, n as y, i as c, v as k, f as S, r as x, y as P, t as h } from "./logout-signal-qvHorCCF.js";
5
+ import { g as A, n as y, i as c, v as k, f as S, r as x, y as P, t as h } from "./logout-signal-DtOS9Rse.js";
6
6
  import { subscribeCustomerSessionChanges as _ } from "@24city/web-runtime/session-sync";
7
7
  const z = (e) => !h(e, 401) && !h(e, 403) && !h(e, 404), F = (e, i) => (e == null ? void 0 : e.purpose) === i.purpose && e.globalUserId === i.globalUserId && e.activeSpaceId === i.activeSpaceId, H = [1e3, 2e3, 4e3], Q = 15e3, B = (e) => new Promise((i) => setTimeout(i, e)), D = ({ children: e }) => {
8
8
  const i = I(), o = A(), { accountApi: f, config: r, http: d } = R();
@@ -1,13 +1,13 @@
1
1
  import { jsx as t, jsxs as c, Fragment as O } from "react/jsx-runtime";
2
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";
3
+ import { Layout as v, Button as f, Typography as Y, Space as F, Nav as $ } from "@douyinfe/semi-ui";
4
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-DnWl21es.js";
5
+ import { useLocation as Q, useNavigate as q, Outlet as D } from "react-router";
6
+ import { Y as J, i as V, j as X, H as Z, s as ee, f as te, W as ne, b as ae } from "./wallet-badge-Cu2WL0RX.js";
7
7
  import { u as R, b as oe, a as se } from "./context-CaVim6ZO.js";
8
8
  import { u as le } from "./use-media-query-DvyinWNg.js";
9
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 = {
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", Be = "_menuGroupTitle_1vz0g_285", Le = "_menuList_1vz0g_296", Te = "_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
11
  layout: ce,
12
12
  header: ie,
13
13
  headerLeft: de,
@@ -29,9 +29,9 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
29
29
  menu: xe,
30
30
  menuGroup: Ce,
31
31
  menuGroupPlain: Me,
32
- menuGroupTitle: Te,
33
- menuList: Be,
34
- collapseButton: Le,
32
+ menuGroupTitle: Be,
33
+ menuList: Le,
34
+ collapseButton: Te,
35
35
  mask: Ge,
36
36
  content: Se,
37
37
  contentCentered: $e,
@@ -46,7 +46,7 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
46
46
  const o = () => l(window.scrollY > 0);
47
47
  return o(), window.addEventListener("scroll", o, { passive: !0 }), () => window.removeEventListener("scroll", o);
48
48
  }, []), a;
49
- }, We = ({ size: a = 30, className: l }) => {
49
+ }, je = ({ size: a = 30, className: l }) => {
50
50
  const o = R(), r = (u) => l ? `${u} ${l}` : u;
51
51
  return o.markUrl ? /* @__PURE__ */ t(
52
52
  "span",
@@ -69,11 +69,11 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
69
69
  extra: K
70
70
  }) => {
71
71
  var S;
72
- const { config: w } = oe(), x = R(), p = F(), C = J();
72
+ const { config: w } = oe(), x = R(), p = Q(), C = J();
73
73
  z(() => {
74
74
  C("page.viewed", { target: V(p.pathname) });
75
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])));
76
+ const k = q(), M = w.routes.app, h = X(M, Z(se())), B = ee(M, p.pathname), g = B ? [] : r ?? [], L = g.length > 0, j = l ?? ((S = Ee(a, p.pathname)) == null ? void 0 : S.key), m = Ae([...g, h], p.pathname), T = u ?? (m == null ? void 0 : m.key), i = le(re("desktop")), W = Ke(), [_, y] = b(!i), [N, d] = b(!1), H = new Map([...g, h].flatMap((n) => n.items.map((s) => [s.key, s])));
77
77
  z(() => {
78
78
  y(!i), d(!1);
79
79
  }, [i]);
@@ -82,7 +82,7 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
82
82
  s && k(s.to), d(!1);
83
83
  };
84
84
  return /* @__PURE__ */ c(v, { className: e.layout, children: [
85
- /* @__PURE__ */ c(v.Header, { className: e.header, "data-scrolled": j ? "true" : "false", children: [
85
+ /* @__PURE__ */ c(v.Header, { className: e.header, "data-scrolled": W ? "true" : "false", children: [
86
86
  /* @__PURE__ */ c("div", { className: e.headerLeft, children: [
87
87
  /* @__PURE__ */ c(
88
88
  f,
@@ -93,8 +93,8 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
93
93
  "aria-label": `${x.shortName} 首页`,
94
94
  onClick: () => k(w.routes.publicHome),
95
95
  children: [
96
- /* @__PURE__ */ t(We, {}),
97
- /* @__PURE__ */ t(q.Text, { className: e.logoText, children: x.shortName })
96
+ /* @__PURE__ */ t(je, {}),
97
+ /* @__PURE__ */ t(Y.Text, { className: e.logoText, children: x.shortName })
98
98
  ]
99
99
  }
100
100
  ),
@@ -104,7 +104,7 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
104
104
  theme: "borderless",
105
105
  type: "tertiary",
106
106
  className: e.module,
107
- "aria-current": W === n.key ? "page" : void 0,
107
+ "aria-current": j === n.key ? "page" : void 0,
108
108
  onClick: () => k(o ? o(n) : n.to),
109
109
  children: [
110
110
  /* @__PURE__ */ c("span", { className: e.moduleText, children: [
@@ -117,14 +117,14 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
117
117
  n.key
118
118
  )) }) : null
119
119
  ] }),
120
- /* @__PURE__ */ t(D, { spacing: 10, className: e.headerRight, children: U ?? /* @__PURE__ */ c(O, { children: [
120
+ /* @__PURE__ */ t(F, { spacing: 10, className: e.headerRight, children: U ?? /* @__PURE__ */ c(O, { children: [
121
121
  /* @__PURE__ */ t(te, {}),
122
122
  /* @__PURE__ */ t("span", { className: e.walletSlot, children: /* @__PURE__ */ t(ne, {}) }),
123
123
  /* @__PURE__ */ t(ae, { personal: h, selectedKey: m && h.items.includes(m) ? m.key : void 0, onOpen: G })
124
124
  ] }) })
125
125
  ] }),
126
126
  /* @__PURE__ */ c(v, { className: e.body, children: [
127
- B ? /* @__PURE__ */ t("aside", { className: e.sider, "data-collapsed": _ ? "true" : "false", children: /* @__PURE__ */ c(
127
+ L ? /* @__PURE__ */ t("aside", { className: e.sider, "data-collapsed": _ ? "true" : "false", children: /* @__PURE__ */ c(
128
128
  "div",
129
129
  {
130
130
  className: e.siderInner,
@@ -165,7 +165,7 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
165
165
  {
166
166
  mode: "vertical",
167
167
  className: e.menuList,
168
- selectedKeys: L ? [L] : [],
168
+ selectedKeys: T ? [T] : [],
169
169
  onSelect: ({ itemKey: s }) => G(String(s)),
170
170
  children: n.items.map((s) => /* @__PURE__ */ t(
171
171
  $.Item,
@@ -199,14 +199,14 @@ const ce = "_layout_1vz0g_6", ie = "_header_1vz0g_13", de = "_headerLeft_1vz0g_3
199
199
  ]
200
200
  }
201
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, {}) }) })
202
+ N && !i && L ? /* @__PURE__ */ t("div", { className: e.mask, "aria-hidden": "true", onClick: () => d(!1) }) : null,
203
+ /* @__PURE__ */ t(v.Content, { className: B ? `${e.content} ${e.contentCentered}` : e.content, children: /* @__PURE__ */ t("div", { className: e.contentInner, children: E ?? /* @__PURE__ */ t(D, {}) }) })
204
204
  ] }),
205
205
  K
206
206
  ] });
207
207
  };
208
208
  export {
209
- We as B,
209
+ je as B,
210
210
  Ve as C,
211
211
  Ae as a,
212
212
  Ee as f,