@24city/web-console 0.0.0-stage → 0.1.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +21 -0
  3. package/README.md +168 -2
  4. package/dist/account/account-api.d.ts +24 -0
  5. package/dist/account/account-center-links.d.ts +35 -0
  6. package/dist/account/account-center-page.d.ts +7 -0
  7. package/dist/account/account-center-ui.d.ts +19 -0
  8. package/dist/account/account-menu.d.ts +23 -0
  9. package/dist/account/auth-provider.d.ts +6 -0
  10. package/dist/account/auth-store.d.ts +25 -0
  11. package/dist/account/benefit-copy.d.ts +15 -0
  12. package/dist/account/customization.d.ts +62 -0
  13. package/dist/account/index.d.ts +34 -0
  14. package/dist/account/index.js +87 -0
  15. package/dist/account/login-page.d.ts +6 -0
  16. package/dist/account/logout-signal.d.ts +13 -0
  17. package/dist/account/personal-nav.d.ts +29 -0
  18. package/dist/account/plan-benefits.d.ts +16 -0
  19. package/dist/account/plan-cards.d.ts +10 -0
  20. package/dist/account/plan-display.d.ts +44 -0
  21. package/dist/account/plan-panel.d.ts +16 -0
  22. package/dist/account/points-section.d.ts +8 -0
  23. package/dist/account/profile-section.d.ts +9 -0
  24. package/dist/account/quota-pill.d.ts +10 -0
  25. package/dist/account/quota.d.ts +12 -0
  26. package/dist/account/route-guard.d.ts +5 -0
  27. package/dist/account/session-sync.d.ts +1 -0
  28. package/dist/account/space-label.d.ts +10 -0
  29. package/dist/account/subscription-section.d.ts +11 -0
  30. package/dist/account/team-promo.d.ts +9 -0
  31. package/dist/account/types.d.ts +120 -0
  32. package/dist/account/upgrade-entry.d.ts +6 -0
  33. package/dist/account/upgrade-modal.d.ts +14 -0
  34. package/dist/account/use-account-center.d.ts +27 -0
  35. package/dist/account/use-logout.d.ts +13 -0
  36. package/dist/account/use-membership.d.ts +48 -0
  37. package/dist/account/use-plan-catalog.d.ts +2 -0
  38. package/dist/account/use-space-switch.d.ts +8 -0
  39. package/dist/account/wallet-badge.d.ts +2 -0
  40. package/dist/assets/coin-BhUDKCPy.webp +0 -0
  41. package/dist/assets/crown-D5kKk5rW.webp +0 -0
  42. package/dist/assets/diamond-BuDSsnw-.webp +0 -0
  43. package/dist/assets/engine-hero-BaSSoV-3.webp +0 -0
  44. package/dist/assets/member-gem-DTY0gTzl.webp +0 -0
  45. package/dist/assets/team-BeZ_oZcL.webp +0 -0
  46. package/dist/assets/upgrade-crown-Ci1IFoXi.webp +0 -0
  47. package/dist/chunks/auth-provider-CqiyTeOt.js +62 -0
  48. package/dist/chunks/console-layout-BibioK5M.js +198 -0
  49. package/dist/chunks/context-CaVim6ZO.js +13 -0
  50. package/dist/chunks/error-boundary-D3qiD7ov.js +35 -0
  51. package/dist/chunks/http-B3mTs9KZ.js +8 -0
  52. package/dist/chunks/link-button-giJEcTmG.js +42 -0
  53. package/dist/chunks/logout-signal-CiD_zY5M.js +365 -0
  54. package/dist/chunks/page-BaitnD--.js +89 -0
  55. package/dist/chunks/stale-build-DUKkQHuu.js +57 -0
  56. package/dist/chunks/text-link-FTsBp_QU.js +54 -0
  57. package/dist/chunks/upgrade-modal-DzdKuEkJ.js +667 -0
  58. package/dist/chunks/use-media-query-DvyinWNg.js +12 -0
  59. package/dist/chunks/wallet-badge-CnyMLpUO.js +565 -0
  60. package/dist/index.d.ts +6 -0
  61. package/dist/index.js +159 -0
  62. package/dist/layout/console-layout.d.ts +35 -0
  63. package/dist/layout/console-nav.d.ts +30 -0
  64. package/dist/layout/index.d.ts +2 -0
  65. package/dist/layout/index.js +8 -0
  66. package/dist/page/error-boundary.d.ts +20 -0
  67. package/dist/page/index.d.ts +7 -0
  68. package/dist/page/index.js +21 -0
  69. package/dist/page/link-button.d.ts +29 -0
  70. package/dist/page/not-found-page.d.ts +1 -0
  71. package/dist/page/page.d.ts +34 -0
  72. package/dist/page/startup-error.d.ts +2 -0
  73. package/dist/page/status-result.d.ts +17 -0
  74. package/dist/page/text-link.d.ts +22 -0
  75. package/dist/runtime/context.d.ts +19 -0
  76. package/dist/runtime/error-summary.d.ts +5 -0
  77. package/dist/runtime/format.d.ts +10 -0
  78. package/dist/runtime/http.d.ts +11 -0
  79. package/dist/runtime/index.d.ts +11 -0
  80. package/dist/runtime/index.js +41 -0
  81. package/dist/runtime/internal-path.d.ts +4 -0
  82. package/dist/runtime/providers.d.ts +16 -0
  83. package/dist/runtime/query-keys.d.ts +6 -0
  84. package/dist/runtime/response.d.ts +6 -0
  85. package/dist/runtime/runtime-config.d.ts +19 -0
  86. package/dist/runtime/stale-build.d.ts +11 -0
  87. package/dist/runtime/use-media-query.d.ts +2 -0
  88. package/dist/semi.d.ts +10 -0
  89. package/dist/semi.js +12 -0
  90. package/dist/styles.css +3224 -0
  91. package/dist/testing/fixtures.d.ts +15 -0
  92. package/dist/testing/fixtures.js +142 -0
  93. package/dist/testing/guard.d.ts +32 -0
  94. package/dist/testing/guard.js +61 -0
  95. package/dist/testing/jsdom.d.ts +2 -0
  96. package/dist/testing/jsdom.js +116 -0
  97. package/dist/theme/index.d.ts +24 -0
  98. package/dist/theme/index.js +51 -0
  99. package/dist/theme/palette.d.ts +6 -0
  100. package/package.json +98 -3
package/dist/index.js ADDED
@@ -0,0 +1,159 @@
1
+ import { A as s, a as o, c as t, b as r, h as n, j as i, k as u, m as l, o as c, p, q as m, s as d, t as f, i as g, d as C, v as P, x as S, l as A, n as L, r as h, y as R, z as y, B as E, e as N, f as x, C as B, D as T, E as O, u as b, g as _, w as v } from "./chunks/logout-signal-CiD_zY5M.js";
2
+ import { A as U, C as I, L as D, P as M, a as k, b as q, Q as w, R as Q, S as z, c as K, T as H, U as G, d as V, p as W, e as j, f as Y, g as J, y as X } from "./chunks/upgrade-modal-DzdKuEkJ.js";
3
+ import { A as $, a as aa, b as ea, E as sa, F as oa, P as ta, c as ra, d as na, U as ia, e as ua, W as la, f as ca, g as pa, h as ma, i as da, j as fa, k as ga, l as Ca, m as Pa, n as Sa, o as Aa, p as La, q as ha, r as Ra, s as ya, t as Ea, u as Na, v as xa, w as Ba, x as Ta, y as Oa, z as ba, B as _a, C as va, D as Fa, G as Ua, H as Ia, I as Da, J as Ma, K as ka, L as qa, M as wa, N as Qa, O as za, Q as Ka } from "./chunks/wallet-badge-CnyMLpUO.js";
4
+ import { A as Ga } from "./chunks/auth-provider-CqiyTeOt.js";
5
+ import { ConsoleSemiProvider as Wa, MODAL_BUTTON_PROPS as ja, modalButtonProps as Ya } from "./semi.js";
6
+ import { B as Xa, C as Za, f as $a, a as ae, i as ee } from "./chunks/console-layout-BibioK5M.js";
7
+ import { E as oe, R as te } from "./chunks/error-boundary-D3qiD7ov.js";
8
+ import { L as ne } from "./chunks/link-button-giJEcTmG.js";
9
+ import { N as ue, S as le, T as ce } from "./chunks/text-link-FTsBp_QU.js";
10
+ import { E as me, a as de, F as fe, b as ge, L as Ce, P as Pe, S as Se, c as Ae, T as Le } from "./chunks/page-BaitnD--.js";
11
+ import { C as Re, u as ye, a as Ee, b as Ne } from "./chunks/context-CaVim6ZO.js";
12
+ import { c as Be } from "./chunks/http-B3mTs9KZ.js";
13
+ import { C as Oe, R as be, c as _e, e as ve, k as Fe, l as Ue, p as Ie, a as De, r as Me } from "./chunks/stale-build-DUKkQHuu.js";
14
+ import { u as qe } from "./chunks/use-media-query-DvyinWNg.js";
15
+ import { BRAND_VARIABLES as Qe, SEMI_BRAND_VARIABLES as ze, applyBrand as Ke, brandPalette as He } from "./theme/index.js";
16
+ import { notifyCustomerSessionChanged as Ve, subscribeCustomerSessionChanges as We } from "@24city/web-runtime/session-sync";
17
+ import { summarizeCustomerError as Ye } from "@24city/web-runtime/error-summary";
18
+ export {
19
+ $ as ACCOUNT_SECTIONS,
20
+ aa as AccountAvatar,
21
+ U as AccountCenterPage,
22
+ ea as AccountMenu,
23
+ Ga as AuthProvider,
24
+ s as AuthStoreProvider,
25
+ Qe as BRAND_VARIABLES,
26
+ Xa as BrandMark,
27
+ I as CenterLinkButton,
28
+ Oe as ConsoleApp,
29
+ Za as ConsoleLayout,
30
+ Re as ConsoleRuntimeProvider,
31
+ Wa as ConsoleSemiProvider,
32
+ sa as EXPIRING_SOON_DAYS,
33
+ me as EmptyCard,
34
+ oe as ErrorBoundary,
35
+ de as ErrorCard,
36
+ oa as FALLBACK_ACCOUNT_LABEL,
37
+ fe as FullPage,
38
+ ge as FullPageLoading,
39
+ ne as LinkButton,
40
+ Ce as LoadingCard,
41
+ D as LoginPage,
42
+ ja as MODAL_BUTTON_PROPS,
43
+ ue as NotFoundPage,
44
+ ta as PERSONAL_NAV_KEYS,
45
+ ra as PERSONAL_SPACE_LABEL,
46
+ M as PlanCards,
47
+ na as PlanPanel,
48
+ k as PointsSection,
49
+ Pe as ProductPage,
50
+ q as ProfileSection,
51
+ w as QuotaPill,
52
+ be as RUNTIME_CONFIG_URL,
53
+ te as RouteErrorPage,
54
+ Q as RouteGuard,
55
+ ze as SEMI_BRAND_VARIABLES,
56
+ Se as SessionUnavailable,
57
+ z as SettingRow,
58
+ le as StartupError,
59
+ Ae as StatusResult,
60
+ K as SubscriptionSection,
61
+ H as TeamPromo,
62
+ ce as TextLink,
63
+ Le as Toolbar,
64
+ ia as UNLIMITED_QUOTA,
65
+ ua as UpgradeEntry,
66
+ G as UpgradeModal,
67
+ la as WalletBadge,
68
+ V as accountCenterPageUrl,
69
+ ca as accountQueryKeys,
70
+ pa as accountSectionPath,
71
+ o as announceLogout,
72
+ Ke as applyBrand,
73
+ He as brandPalette,
74
+ ma as buildPersonalNavigation,
75
+ da as canBuyForSpace,
76
+ fa as catalogPlanOf,
77
+ t as createAccountApi,
78
+ r as createAuthStore,
79
+ _e as createConsoleQueryClient,
80
+ Be as createHttpRuntime,
81
+ ve as earlyRuntimeConfigFetcher,
82
+ ga as entryTeamPlan,
83
+ Ca as featureLines,
84
+ $a as findActiveModule,
85
+ ae as findActiveNavItem,
86
+ n as formatChargePoints,
87
+ i as formatClock,
88
+ u as formatDate,
89
+ l as formatDateTime,
90
+ c as formatDuration,
91
+ p as formatNumber,
92
+ Pa as formatPlanAmount,
93
+ Sa as formatPlanPrice,
94
+ m as formatPoints,
95
+ d as formatPrice,
96
+ f as hasHttpStatus,
97
+ Aa as isAccountCenterPath,
98
+ La as isAccountSection,
99
+ g as isLeavingForLogout,
100
+ C as isLoggedOutElsewhere,
101
+ ee as isPathUnder,
102
+ P as isPathWithin,
103
+ S as isSafeInternalPath,
104
+ ha as isTeamSpace,
105
+ Ra as isTeamSubscriptionRequired,
106
+ ya as isUnlimited,
107
+ Fe as keepLoadingOnStaleBuild,
108
+ A as leaveForLogout,
109
+ Ue as loadRuntimeConfig,
110
+ Ya as modalButtonProps,
111
+ L as noteLogoutElsewhere,
112
+ Ve as notifySessionChanged,
113
+ Ea as offerHighlights,
114
+ Ie as parseRuntimeConfig,
115
+ Na as personalNavKey,
116
+ W as planBenefitLines,
117
+ j as planCopy,
118
+ xa as planDaysLeft,
119
+ Ba as planFocusOf,
120
+ Ta as planFocusState,
121
+ Oa as planPeriodText,
122
+ ba as planTitle,
123
+ Y as plansUrl,
124
+ J as priceFor,
125
+ _a as productAccountSections,
126
+ De as productQueryKeys,
127
+ va as quotaCopy,
128
+ Fa as quotaFull,
129
+ Ua as quotaText,
130
+ h as releaseLogoutHold,
131
+ Me as reloadOnStaleBuild,
132
+ R as requireNonNegativeInteger,
133
+ y as requireRecord,
134
+ E as requireString,
135
+ N as resetLogoutSignalForTest,
136
+ x as restoreIdentityContext,
137
+ B as sanitizeReturnPath,
138
+ Ia as spaceDisplayName,
139
+ Da as spaceRoleLabel,
140
+ Ma as startingPrice,
141
+ We as subscribeSessionChanged,
142
+ Ye as summarizeCustomerError,
143
+ T as summarizeError,
144
+ O as unwrapApiResponse,
145
+ ka as upgradeOffer,
146
+ qa as useAccountCenter,
147
+ b as useAuthState,
148
+ _ as useAuthStore,
149
+ ye as useConsoleBrand,
150
+ Ee as useConsoleCustomization,
151
+ Ne as useConsoleRuntime,
152
+ wa as useLogout,
153
+ qe as useMediaQuery,
154
+ Qa as useMembership,
155
+ za as usePlanCatalog,
156
+ Ka as useSpaceSwitch,
157
+ v as withdrawLogout,
158
+ X as yearlyNote
159
+ };
@@ -0,0 +1,35 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type ConsoleModule, type ConsoleNavGroup, type ConsoleNavItem } from './console-nav';
3
+ /** 产品图标:runtime-config 的 brand.markUrl(SVG),没有时用 brand.mark 字标。读屏忽略。 */
4
+ export declare const BrandMark: ({ size, className }: {
5
+ size?: number;
6
+ className?: string;
7
+ }) => import("react").JSX.Element;
8
+ export interface ConsoleLayoutProps {
9
+ /** 顶栏的产品模块;不传时顶栏只有产品名。 */
10
+ modules?: ConsoleModule[];
11
+ /** 当前模块;不传时按模块地址的路径前缀匹配。 */
12
+ activeModuleKey?: string;
13
+ /** 点顶栏模块去的地址;默认 module.to。 */
14
+ moduleTarget?: (module: ConsoleModule) => string;
15
+ /** 侧栏分组;null 或空数组表示本页不显示侧栏。个人中心页面总是不显示。 */
16
+ sidebar?: ConsoleNavGroup[] | null;
17
+ /** 侧栏选中项;不传时按路径匹配。 */
18
+ selectedKey?: string;
19
+ /** 自定义菜单项的文字(例如带置顶按钮)。 */
20
+ renderItemLabel?: (item: ConsoleNavItem) => ReactNode;
21
+ /** 顶栏右侧;默认是开通入口、积分和账号菜单。 */
22
+ headerRight?: ReactNode;
23
+ /** 侧栏菜单的读屏名称。 */
24
+ menuLabel?: string;
25
+ /** 内容区;默认渲染当前路由的 `<Outlet />`。 */
26
+ children?: ReactNode;
27
+ /** 挂在外壳最外层的附加内容(例如上新弹窗)。 */
28
+ extra?: ReactNode;
29
+ }
30
+ /**
31
+ * 工作台外壳:60px 透明顶栏(产品图标与简称,点击回产品首页;产品模块;右侧开通入口、积分和头像,头像展开账号卡片,
32
+ * 空间在卡片里切换),232px 侧栏(白底圆角面板,内容随顶栏模块切换,分组固定展开,选中项浅主色底)。侧栏收起后只留 24px 窄条,
33
+ * 指针移上去或点开时浮出完整菜单;窄屏默认收起,点开时加遮罩。个人中心(<app>/account/…)不显示侧栏,内容整体居中。
34
+ */
35
+ export declare const ConsoleLayout: ({ modules, activeModuleKey, moduleTarget, sidebar, selectedKey, renderItemLabel, headerRight, menuLabel, children, extra, }: ConsoleLayoutProps) => import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import type { ComponentType } from 'react';
2
+ /** 侧栏的一个菜单项:每项是一页,只按路径定位;地址参数由页面自己管。 */
3
+ export interface ConsoleNavItem {
4
+ key: string;
5
+ label: string;
6
+ to: string;
7
+ icon?: ComponentType;
8
+ /** 产品附加信息(例如可置顶的行业),供 ConsoleLayout 的 renderItemLabel 使用。 */
9
+ meta?: unknown;
10
+ }
11
+ export interface ConsoleNavGroup {
12
+ key: string;
13
+ /** 分组标题;为空时菜单项直接排在侧栏里,不显示标题。 */
14
+ label: string;
15
+ items: ConsoleNavItem[];
16
+ }
17
+ /** 顶栏的一个产品模块:点击去 `to`,侧栏内容随模块切换。 */
18
+ export interface ConsoleModule {
19
+ key: string;
20
+ label: string;
21
+ to: string;
22
+ /** 文字前的图标(任何不接收属性的组件,例如平台图标)。 */
23
+ icon?: ComponentType;
24
+ }
25
+ /** 路径是否在某个根路径之下(含相等)。 */
26
+ export declare const isPathUnder: (pathname: string, base: string) => boolean;
27
+ /** 当前路径对应的菜单项:只比较路径,不比较地址参数。 */
28
+ export declare const findActiveNavItem: (groups: readonly ConsoleNavGroup[], pathname: string) => ConsoleNavItem | undefined;
29
+ /** 当前路径所属的顶栏模块:按模块地址的路径前缀匹配,最长的优先。 */
30
+ export declare const findActiveModule: (modules: readonly ConsoleModule[], pathname: string) => ConsoleModule | undefined;
@@ -0,0 +1,2 @@
1
+ export * from './console-layout';
2
+ export * from './console-nav';
@@ -0,0 +1,8 @@
1
+ import { B as s, C as i, f as o, a as t, i as d } from "../chunks/console-layout-BibioK5M.js";
2
+ export {
3
+ s as BrandMark,
4
+ i as ConsoleLayout,
5
+ o as findActiveModule,
6
+ t as findActiveNavItem,
7
+ d as isPathUnder
8
+ };
@@ -0,0 +1,20 @@
1
+ import { Component, type ErrorInfo, type ReactNode } from 'react';
2
+ /**
3
+ * 路由里的页面渲染或按需加载出错时显示(React Router 的 errorElement)。ErrorBoundary 在路由外层,接不到这些错误,
4
+ * 没有它时显示的是 React Router 自带的英文报错页。工作台外壳内的页面出错只替换内容区,顶栏和侧栏保留,换个菜单即可离开。
5
+ */
6
+ export declare const RouteErrorPage: ({ inLayout }: {
7
+ inLayout?: boolean;
8
+ }) => import("react").JSX.Element;
9
+ interface ErrorBoundaryState {
10
+ failed: boolean;
11
+ }
12
+ export declare class ErrorBoundary extends Component<{
13
+ children: ReactNode;
14
+ }, ErrorBoundaryState> {
15
+ state: ErrorBoundaryState;
16
+ static getDerivedStateFromError(): ErrorBoundaryState;
17
+ componentDidCatch(error: Error, info: ErrorInfo): void;
18
+ render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
19
+ }
20
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from './error-boundary';
2
+ export * from './link-button';
3
+ export * from './not-found-page';
4
+ export * from './page';
5
+ export * from './startup-error';
6
+ export * from './status-result';
7
+ export * from './text-link';
@@ -0,0 +1,21 @@
1
+ import { E as o, R as s } from "../chunks/error-boundary-D3qiD7ov.js";
2
+ import { L as e } from "../chunks/link-button-giJEcTmG.js";
3
+ import { N as n, S as d, T as l } from "../chunks/text-link-FTsBp_QU.js";
4
+ import { E, a as P, F as i, b as p, L, P as m, S as x, c as S, T as f } from "../chunks/page-BaitnD--.js";
5
+ export {
6
+ E as EmptyCard,
7
+ o as ErrorBoundary,
8
+ P as ErrorCard,
9
+ i as FullPage,
10
+ p as FullPageLoading,
11
+ e as LinkButton,
12
+ L as LoadingCard,
13
+ n as NotFoundPage,
14
+ m as ProductPage,
15
+ s as RouteErrorPage,
16
+ x as SessionUnavailable,
17
+ d as StartupError,
18
+ S as StatusResult,
19
+ l as TextLink,
20
+ f as Toolbar
21
+ };
@@ -0,0 +1,29 @@
1
+ import type { AnchorHTMLAttributes, MouseEventHandler, ReactNode } from 'react';
2
+ export type LinkButtonTheme = 'solid' | 'light' | 'borderless' | 'outline';
3
+ export type LinkButtonType = 'primary' | 'secondary' | 'tertiary' | 'warning' | 'danger';
4
+ export type LinkButtonSize = 'default' | 'small' | 'large';
5
+ export interface LinkButtonProps {
6
+ href: string;
7
+ /** `_blank` 时自动带 rel="noreferrer" */
8
+ target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];
9
+ rel?: string;
10
+ download?: string;
11
+ /** 与 Semi Button 相同:solid 实底、light 浅底、borderless 文字、outline 描边;默认 light */
12
+ theme?: LinkButtonTheme;
13
+ /** 与 Semi Button 相同;默认 tertiary(中性灰) */
14
+ type?: LinkButtonType;
15
+ size?: LinkButtonSize;
16
+ /** 占满一行 */
17
+ block?: boolean;
18
+ icon?: ReactNode;
19
+ iconPosition?: 'left' | 'right';
20
+ className?: string;
21
+ 'aria-label'?: string;
22
+ onClick?: MouseEventHandler<HTMLAnchorElement>;
23
+ children?: ReactNode;
24
+ }
25
+ /**
26
+ * 长得和 Semi 按钮一样的链接:Semi 的 Button 只渲染 button 元素,没有 href;去统一账号中心、下载安装包这类要新标签页打开、
27
+ * 能右键复制地址的入口用它。套用 Semi 按钮的类名,主题、尺寸与真正的按钮完全一致。
28
+ */
29
+ export declare const LinkButton: ({ href, target, rel, download, theme, type, size, block, icon, iconPosition, className, onClick, children, ...rest }: LinkButtonProps) => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const NotFoundPage: () => import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import type { PropsWithChildren, ReactNode } from 'react';
2
+ interface ProductPageProps {
3
+ title: ReactNode;
4
+ description?: ReactNode;
5
+ extra?: ReactNode;
6
+ testId?: string;
7
+ }
8
+ /** 登录后页面的统一骨架:页头(标题、说明、操作)直接落在灰底上,下面纵向排列内容卡片。多个操作按钮由调用方用 Space 包起来。 */
9
+ export declare const ProductPage: ({ title, description, extra, testId, children }: PropsWithChildren<ProductPageProps>) => import("react").JSX.Element;
10
+ /** 公开页、登录与异常页使用的整屏居中容器。 */
11
+ export declare const FullPage: ({ children }: PropsWithChildren) => import("react").JSX.Element;
12
+ export declare const FullPageLoading: () => import("react").JSX.Element;
13
+ /** 卡片内左右分布的操作栏,窄屏自动换行。 */
14
+ export declare const Toolbar: ({ children }: PropsWithChildren) => import("react").JSX.Element;
15
+ export declare const SessionUnavailable: ({ message }: {
16
+ message?: string;
17
+ }) => import("react").JSX.Element;
18
+ export declare const LoadingCard: ({ rows, image }: {
19
+ rows?: number;
20
+ image?: boolean;
21
+ }) => import("react").JSX.Element;
22
+ interface ErrorCardProps {
23
+ title: string;
24
+ message: string;
25
+ retryLabel?: string;
26
+ retrying?: boolean;
27
+ onRetry?: () => void;
28
+ }
29
+ export declare const ErrorCard: ({ title, message, retryLabel, retrying, onRetry }: ErrorCardProps) => import("react").JSX.Element;
30
+ export declare const EmptyCard: ({ description, action }: {
31
+ description: ReactNode;
32
+ action?: ReactNode;
33
+ }) => import("react").JSX.Element;
34
+ export {};
@@ -0,0 +1,2 @@
1
+ /** 运行时配置加载失败时的整屏提示;此时路由与账号服务都尚未就绪。 */
2
+ export declare const StartupError: () => import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from 'react';
2
+ /** 结果页的类型:出错、无权限、找不到、提示、成功、加载中。 */
3
+ export type StatusKind = 'error' | 'forbidden' | 'not-found' | 'info' | 'success' | 'loading';
4
+ export interface StatusResultProps {
5
+ status: StatusKind;
6
+ title: ReactNode;
7
+ description?: ReactNode;
8
+ /** 下方的操作;多个按钮用 Space 包起来 */
9
+ extra?: ReactNode;
10
+ /** 插画尺寸,默认 140 */
11
+ size?: number;
12
+ className?: string;
13
+ /** 与 extra 相同,写在标签里面的操作 */
14
+ children?: ReactNode;
15
+ }
16
+ /** 统一的结果区块:Semi 插画加标题、说明与操作。加载中显示转圈。 */
17
+ export declare const StatusResult: ({ status, title, description, extra, size, className, children }: StatusResultProps) => import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import type { MouseEvent, ReactNode } from 'react';
2
+ export interface TextLinkProps {
3
+ /** 没有 href 时是一个长得像链接的动作(例如“查看全部”),键盘可用 */
4
+ href?: string;
5
+ target?: string;
6
+ rel?: string;
7
+ download?: string;
8
+ onClick?: (event: MouseEvent<HTMLElement>) => void;
9
+ /** 文字前的图标 */
10
+ icon?: ReactNode;
11
+ /** danger 用危险色,warning 用警示色 */
12
+ status?: 'danger' | 'warning';
13
+ disabled?: boolean;
14
+ className?: string;
15
+ 'aria-label'?: string;
16
+ children?: ReactNode;
17
+ }
18
+ /**
19
+ * 文字链接:Semi 的 Typography 链接写法包一层,接受 href 或只接受 onClick(动作型链接,带键盘支持)。
20
+ * 页面里的“查看全部”“换一批”这类轻操作用它;要像按钮的链接用 LinkButton。
21
+ */
22
+ export declare const TextLink: ({ href, target, rel, download, onClick, icon, status, disabled, className, children, ...rest }: TextLinkProps) => import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ import type { AccountApi } from '../account/account-api';
3
+ import type { ConsoleCustomization } from '../account/customization';
4
+ import type { HttpRuntime } from './http';
5
+ import type { ConsoleRuntimeConfig } from './runtime-config';
6
+ /** 产品用户 Web 启动时装配好的运行时:运行时配置、同源 HTTP 客户端、统一账号接口,以及产品对账号页面的定制。 */
7
+ export interface ConsoleRuntime {
8
+ config: ConsoleRuntimeConfig;
9
+ http: HttpRuntime;
10
+ accountApi: AccountApi;
11
+ /** 产品对账号页面的定制(权益文案、积分明细等);没有时用通用文案。 */
12
+ customization?: ConsoleCustomization;
13
+ }
14
+ export declare const ConsoleRuntimeProvider: ({ runtime, children }: PropsWithChildren<{
15
+ runtime: ConsoleRuntime;
16
+ }>) => import("react").JSX.Element;
17
+ export declare const useConsoleRuntime: () => ConsoleRuntime;
18
+ export declare const useConsoleBrand: () => import("@24city/web-runtime/core/runtime-config").CustomerBrandConfig;
19
+ export declare const useConsoleCustomization: () => ConsoleCustomization;
@@ -0,0 +1,5 @@
1
+ import { summarizeCustomerError } from '@24city/web-runtime/error-summary';
2
+ export { summarizeCustomerError };
3
+ /** 给用户看的一句错误说明:有可读的错误信息就用它,否则用通用提示。 */
4
+ export declare const summarizeError: (error: unknown) => string;
5
+ export declare const hasHttpStatus: (error: unknown, status: number) => boolean;
@@ -0,0 +1,10 @@
1
+ export declare const formatNumber: (value: number | null | undefined) => string;
2
+ export declare const formatPoints: (value: number) => string;
3
+ /** 扣费明细的积分:一次模型调用常常不到 1 积分,保留两位小数;大于 0 但不到 0.01 显示“<0.01”,不显示成 0。 */
4
+ export declare const formatChargePoints: (value: number) => string;
5
+ export declare const formatPrice: (priceCents: number) => string;
6
+ /** 卡片角标使用的 m:ss 时长;没有时长时返回空字符串,不显示角标。 */
7
+ export declare const formatClock: (seconds?: number) => string;
8
+ export declare const formatDuration: (seconds?: number) => string;
9
+ export declare const formatDateTime: (value: string) => string;
10
+ export declare const formatDate: (value: string | null) => string;
@@ -0,0 +1,11 @@
1
+ import { type CustomerHttpRuntime } from '@24city/web-runtime/http';
2
+ export interface HttpRuntime extends CustomerHttpRuntime {
3
+ /** 与 `http` 相同的 axios 实例,产品代码里按习惯叫 client。 */
4
+ client: CustomerHttpRuntime['http'];
5
+ }
6
+ /**
7
+ * 同源 HTTP 客户端:相对路径、带 Cookie、写请求带 CSRF 头(由 AuthProvider 配置)。
8
+ * 账号中间件的 CSRF 校验要求带 Cookie 的写请求声明 JSON 或 multipart 的 Content-Type;axios 发没有请求体的
9
+ * DELETE、PUT、POST 时不带这个头,会被拒(403“请求 Content-Type 不受支持”)。这类请求统一补一个空 JSON 体。
10
+ */
11
+ export declare const createHttpRuntime: () => HttpRuntime;
@@ -0,0 +1,11 @@
1
+ export * from './context';
2
+ export * from './error-summary';
3
+ export * from './format';
4
+ export * from './http';
5
+ export * from './internal-path';
6
+ export * from './providers';
7
+ export * from './query-keys';
8
+ export * from './response';
9
+ export * from './runtime-config';
10
+ export * from './stale-build';
11
+ export * from './use-media-query';
@@ -0,0 +1,41 @@
1
+ import { C as r, u as s, a as o, b as t } from "../chunks/context-CaVim6ZO.js";
2
+ import { h as n, j as u, k as m, m as f, o as p, p as C, q as l, s as R, t as d, v as c, x as g, y as h, z as x, B as P, C as y, D as z, E as N } from "../chunks/logout-signal-CiD_zY5M.js";
3
+ import { c as k } from "../chunks/http-B3mTs9KZ.js";
4
+ import { C as B, R as D, c as E, e as I, k as v, l as O, p as Q, a as b, r as A } from "../chunks/stale-build-DUKkQHuu.js";
5
+ import { u as H } from "../chunks/use-media-query-DvyinWNg.js";
6
+ import { summarizeCustomerError as M } from "@24city/web-runtime/error-summary";
7
+ export {
8
+ B as ConsoleApp,
9
+ r as ConsoleRuntimeProvider,
10
+ D as RUNTIME_CONFIG_URL,
11
+ E as createConsoleQueryClient,
12
+ k as createHttpRuntime,
13
+ I as earlyRuntimeConfigFetcher,
14
+ n as formatChargePoints,
15
+ u as formatClock,
16
+ m as formatDate,
17
+ f as formatDateTime,
18
+ p as formatDuration,
19
+ C as formatNumber,
20
+ l as formatPoints,
21
+ R as formatPrice,
22
+ d as hasHttpStatus,
23
+ c as isPathWithin,
24
+ g as isSafeInternalPath,
25
+ v as keepLoadingOnStaleBuild,
26
+ O as loadRuntimeConfig,
27
+ Q as parseRuntimeConfig,
28
+ b as productQueryKeys,
29
+ A as reloadOnStaleBuild,
30
+ h as requireNonNegativeInteger,
31
+ x as requireRecord,
32
+ P as requireString,
33
+ y as sanitizeReturnPath,
34
+ M as summarizeCustomerError,
35
+ z as summarizeError,
36
+ N as unwrapApiResponse,
37
+ s as useConsoleBrand,
38
+ o as useConsoleCustomization,
39
+ t as useConsoleRuntime,
40
+ H as useMediaQuery
41
+ };
@@ -0,0 +1,4 @@
1
+ export declare const isSafeInternalPath: (value: string) => boolean;
2
+ export declare const isPathWithin: (value: string, basePath: string) => boolean;
3
+ /** 登录回跳地址只接受站内路径;缺失或可疑时回到 fallback(通常是工作台根路径)。 */
4
+ export declare const sanitizeReturnPath: (value: string | null | undefined, fallback: string) => string;
@@ -0,0 +1,16 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { type PropsWithChildren } from 'react';
3
+ import { type AuthStore } from '../account/auth-store';
4
+ import { type ConsoleRuntime } from './context';
5
+ /** 服务端状态的默认口径:30 秒内不重读、窗口聚焦不自动刷新、失败重试一次;写操作不重试。 */
6
+ export declare const createConsoleQueryClient: () => QueryClient;
7
+ export interface ConsoleAppProps {
8
+ runtime: ConsoleRuntime;
9
+ queryClient?: QueryClient;
10
+ authStore?: AuthStore;
11
+ }
12
+ /**
13
+ * 产品用户 Web 的 Provider 组装:错误边界、TanStack Query、运行时配置、控制台运行时、身份状态与会话恢复。
14
+ * children 通常是 `<RouterProvider router={…} />`。
15
+ */
16
+ export declare const ConsoleApp: ({ runtime, queryClient, authStore, children }: PropsWithChildren<ConsoleAppProps>) => import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /** 产品页面的 Query Key 工厂:受空间影响的数据一律带 activeSpaceId,切换空间后缓存自然失效。 */
2
+ export declare const productQueryKeys: {
3
+ all: readonly ["product-web"];
4
+ feature: (activeSpaceId: string, feature: string) => readonly ["product-web", string, string];
5
+ scope: <T extends readonly unknown[]>(activeSpaceId: string, feature: string, ...scope: T) => readonly ["product-web", string, string, ...T];
6
+ };
@@ -0,0 +1,6 @@
1
+ import type { AxiosResponse } from 'axios';
2
+ /** 产品服务端的统一响应信封:`{ code: 0, data }`;其他形状一律当作无效响应。 */
3
+ export declare const unwrapApiResponse: <T>(endpoint: string, response: AxiosResponse<unknown>) => T;
4
+ export declare const requireRecord: (value: unknown, endpoint: string, field: string) => Record<string, unknown>;
5
+ export declare const requireString: (record: Record<string, unknown>, key: string, endpoint: string) => string;
6
+ export declare const requireNonNegativeInteger: (record: Record<string, unknown>, key: string, endpoint: string) => number;
@@ -0,0 +1,19 @@
1
+ import { type CustomerRuntimeConfig } from '@24city/web-runtime/core/runtime-config';
2
+ export type { CustomerBrandConfig } from '@24city/web-runtime/core/runtime-config';
3
+ export type ConsoleRuntimeConfig = CustomerRuntimeConfig;
4
+ /** 运行时配置固定放在用户 Web 的 `public/runtime-config.json`(STD-CONFIG-001)。 */
5
+ export declare const RUNTIME_CONFIG_URL = "/runtime-config.json";
6
+ export declare const parseRuntimeConfig: (value: unknown) => CustomerRuntimeConfig;
7
+ export declare const loadRuntimeConfig: (fetcher?: typeof fetch) => Promise<ConsoleRuntimeConfig>;
8
+ declare global {
9
+ interface Window {
10
+ /** index.html 的内联脚本在入口代码下载时就发出的运行时配置请求(同源、不缓存,与 loadRuntimeConfig 相同)。 */
11
+ __24cityRuntimeConfig?: Promise<Response>;
12
+ }
13
+ }
14
+ /**
15
+ * 交给 loadRuntimeConfig 的取数方式:优先用 index.html 提前发出的那次请求,省掉入口执行完才去取的一轮等待。
16
+ * 响应只能读一次,取用后即清掉;没有提前请求(测试、UI 测试模式)或它网络失败时照常请求。
17
+ * index.html 里的写法见 README「首屏并行请求」。
18
+ */
19
+ export declare const earlyRuntimeConfigFetcher: (target?: Window) => typeof fetch;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 发布后仍开着的旧标签页会按旧构建去取懒加载页面,文件已不存在时 Vite 触发 `vite:preloadError`。
3
+ * 这里改为刷新拿到新构建;页面本身一分钟内刚刷新过的除外,那说明是真的加载失败,交给页面自己处理,不会循环刷新。
4
+ * 浏览器无法判断页面是怎么打开的时候不刷新。
5
+ */
6
+ export declare function reloadOnStaleBuild(target?: Window, reload?: () => void): void;
7
+ /**
8
+ * 每个懒加载的 `import()` 都包一层。reloadOnStaleBuild 接管失败时 Vite 不会 reject,而是 resolve 成空模块,
9
+ * 页面读导出会崩成报错页;这里让加载永不结束,页面停在加载态直到新构建替换它。
10
+ */
11
+ export declare function keepLoadingOnStaleBuild<M>(load: Promise<M>): Promise<M>;
@@ -0,0 +1,2 @@
1
+ /** 订阅 CSS 媒体查询,供只能用属性切换布局的组件(如 Steps 方向)使用。 */
2
+ export declare const useMediaQuery: (query: string) => boolean;
package/dist/semi.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import '@douyinfe/semi-ui/react19-adapter';
2
+ import type { ButtonProps } from '@douyinfe/semi-ui/lib/es/button';
3
+ import type { PropsWithChildren } from 'react';
4
+ export declare const MODAL_BUTTON_PROPS: {
5
+ readonly 'aria-label': undefined;
6
+ };
7
+ /** 给弹窗按钮属性补上本包的默认项(去掉英文 aria-label)。 */
8
+ export declare const modalButtonProps: (props?: ButtonProps) => ButtonProps;
9
+ /** Semi 的全局配置:中文文案。包在应用最外层。 */
10
+ export declare const ConsoleSemiProvider: ({ children }: PropsWithChildren) => import("react").JSX.Element;
package/dist/semi.js ADDED
@@ -0,0 +1,12 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import "@douyinfe/semi-ui/react19-adapter";
3
+ import { Modal as t, LocaleProvider as l } from "@douyinfe/semi-ui";
4
+ import a from "@douyinfe/semi-ui/lib/es/locale/source/zh_CN";
5
+ const r = { "aria-label": void 0 };
6
+ t.defaultProps = { ...t.defaultProps, okButtonProps: { ...r }, cancelButtonProps: { ...r } };
7
+ const P = (o) => ({ ...r, ...o }), n = ({ children: o }) => /* @__PURE__ */ e(l, { locale: a, children: o });
8
+ export {
9
+ n as ConsoleSemiProvider,
10
+ r as MODAL_BUTTON_PROPS,
11
+ P as modalButtonProps
12
+ };