@morehao/ark-iam-react 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @morehao/ark-iam-react might be problematic. Click here for more details.

Files changed (66) hide show
  1. package/README.md +83 -2
  2. package/dist/_types/api/index.d.ts +5 -0
  3. package/dist/_types/api/index.js +185 -0
  4. package/dist/_types/api/index.js.map +1 -0
  5. package/dist/_types/api/request.d.ts +34 -0
  6. package/dist/_types/api/resources/auth.d.ts +13 -0
  7. package/dist/_types/api/resources/platform.d.ts +80 -0
  8. package/dist/_types/api/sessionProbe.d.ts +13 -0
  9. package/dist/_types/auth/AuthProvider.d.ts +27 -0
  10. package/dist/_types/auth/config.d.ts +23 -0
  11. package/dist/_types/auth/guards.d.ts +1 -0
  12. package/dist/_types/auth/hooks.d.ts +11 -0
  13. package/dist/_types/auth/index.d.ts +8 -0
  14. package/dist/_types/auth/index.js +190 -0
  15. package/dist/_types/auth/index.js.map +1 -0
  16. package/dist/_types/auth/tenant.d.ts +3 -0
  17. package/dist/_types/types/auth.d.ts +62 -0
  18. package/dist/_types/types/department.d.ts +52 -0
  19. package/dist/_types/types/index.d.ts +5 -0
  20. package/dist/_types/types/index.js +14 -0
  21. package/dist/_types/types/index.js.map +1 -0
  22. package/dist/_types/types/platform.d.ts +347 -0
  23. package/dist/_types/types/response.d.ts +14 -0
  24. package/dist/_types/types/tenant.d.ts +243 -0
  25. package/dist/_types/ui/AppShell.d.ts +16 -0
  26. package/dist/_types/ui/EllipsisCell.d.ts +16 -0
  27. package/dist/_types/ui/IDCell.d.ts +14 -0
  28. package/dist/_types/ui/InitialPasswordModal.d.ts +18 -0
  29. package/dist/_types/ui/LoginPage.d.ts +6 -0
  30. package/dist/_types/ui/MainLayout.d.ts +14 -0
  31. package/dist/_types/ui/NameLink.d.ts +18 -0
  32. package/dist/_types/ui/PageContainer.d.ts +15 -0
  33. package/dist/_types/ui/ProfileCenter.d.ts +6 -0
  34. package/dist/_types/ui/RemoteSelect.d.ts +57 -0
  35. package/dist/_types/ui/RowActions.d.ts +36 -0
  36. package/dist/_types/ui/TenantSwitcher.d.ts +1 -0
  37. package/dist/_types/ui/TimeCell.d.ts +53 -0
  38. package/dist/_types/ui/columns.d.ts +116 -0
  39. package/dist/_types/ui/format.d.ts +20 -0
  40. package/dist/_types/ui/index.d.ts +25 -0
  41. package/dist/_types/ui/index.js +1233 -0
  42. package/dist/_types/ui/index.js.map +1 -0
  43. package/dist/_types/ui/status.d.ts +38 -0
  44. package/dist/_types/ui/theme.d.ts +49 -0
  45. package/dist/api.d.ts +1 -0
  46. package/dist/api.js +50 -0
  47. package/dist/api.js.map +1 -0
  48. package/dist/auth.d.ts +1 -0
  49. package/dist/auth.js +17 -0
  50. package/dist/auth.js.map +1 -0
  51. package/dist/index-BQuRl5A6.js +185 -0
  52. package/dist/index-BQuRl5A6.js.map +1 -0
  53. package/dist/index-D3uUqZ5c.js +190 -0
  54. package/dist/index-D3uUqZ5c.js.map +1 -0
  55. package/dist/index-DnhMUOxg.js +1233 -0
  56. package/dist/index-DnhMUOxg.js.map +1 -0
  57. package/dist/index.d.ts +4 -0
  58. package/dist/index.js +109 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/types.d.ts +1 -0
  61. package/dist/types.js +14 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/ui.d.ts +1 -0
  64. package/dist/ui.js +46 -0
  65. package/dist/ui.js.map +1 -0
  66. package/package.json +80 -3
@@ -0,0 +1,347 @@
1
+ export type SysAdminType = 'admin' | 'normal';
2
+ /**
3
+ * 应用/客户端来源(后端 model.AppSource / model.ApplicationClientSource):
4
+ * builtin-内置(平台随产品交付的控制台应用:平台管理后台 / 租户管理后台,受删除保护)、
5
+ * first_party-第一方受控应用(平台自建但非内置,当前由运维产生)、third_party-第三方接入。
6
+ * 控制台创建的资源恒为 third_party;builtin / first_party 只能由种子与运维产生。
7
+ */
8
+ export type AppSource = 'builtin' | 'first_party' | 'third_party';
9
+ /**
10
+ * 启停状态(后端具名类型 model.AppStatus / ApplicationClientStatus / TenantApplicationStatus)。
11
+ * 取值与后端常量一一对应,禁止在页面里裸写字面量。
12
+ */
13
+ export type AppStatus = 'enable' | 'disable';
14
+ export type ApplicationClientStatus = 'enable' | 'disable';
15
+ export type TenantApplicationStatus = 'enable' | 'disable';
16
+ /** 连接器状态(后端具名类型 model.ConnectorStatus):全局启停语义 enable/disable */
17
+ export type ConnectorStatus = 'enable' | 'disable';
18
+ /**
19
+ * 应用策略开关(后端具名类型,取值 enable/disable;语义等价旧 bool:true=enable / false=disable):
20
+ * - AppPersonCreateTenantPolicy:application.allow_person_create_tenant(个人自助创建租户)
21
+ * - AppJoinByInvitePolicy:application.allow_join_by_invite(凭邀请码加入租户)
22
+ */
23
+ export type AppPersonCreateTenantPolicy = 'enable' | 'disable';
24
+ export type AppJoinByInvitePolicy = 'enable' | 'disable';
25
+ /** 客户端协议开关(后端具名类型):requirePKCE / requireAuthTime,取值 enable/disable。 */
26
+ export type ClientPKCEPolicy = 'enable' | 'disable';
27
+ export type ClientAuthTimeClaimPolicy = 'enable' | 'disable';
28
+ /**
29
+ * 应用角色模板项:本应用对外提供的一个跨系统授权契约值。
30
+ * 下游按「claim_prefix + code」认策略名(策略在下游是全局命名实体、全租户共用一条),
31
+ * 故 code 由应用方在这里定义一次,租户只能"授权"、不能造值(后端 model.RoleTemplateItem)。
32
+ */
33
+ export interface ApplicationRoleTemplateItem {
34
+ /** 契约值(= OIDC ID token 的 groups 取值):小写字母开头,仅含小写字母、数字与下划线,模板内唯一 */
35
+ code: string;
36
+ /** 展示名:物化为租户角色的名称,非空且不超过 128 字符 */
37
+ name: string;
38
+ }
39
+ export interface ApplicationItem {
40
+ appID: string;
41
+ code: string;
42
+ name: string;
43
+ description: string;
44
+ logoUrl: string;
45
+ homepageUrl: string;
46
+ source: AppSource;
47
+ status: AppStatus;
48
+ sort: number;
49
+ allowPersonCreateTenant?: AppPersonCreateTenantPolicy;
50
+ allowJoinByInvite?: AppJoinByInvitePolicy;
51
+ /** 应用角色模板:本应用对外的契约值清单,开通应用时物化到各租户(后端 model.ApplicationEntity.RoleTemplate)。 */
52
+ roleTemplate?: ApplicationRoleTemplateItem[];
53
+ createdAt?: number;
54
+ updatedAt?: number;
55
+ }
56
+ export interface ApplicationCreateReq {
57
+ code: string;
58
+ name: string;
59
+ description?: string;
60
+ logoUrl?: string;
61
+ homepageUrl?: string;
62
+ sort?: number;
63
+ allowPersonCreateTenant?: AppPersonCreateTenantPolicy;
64
+ allowJoinByInvite?: AppJoinByInvitePolicy;
65
+ /** 应用角色模板:见 ApplicationItem.roleTemplate,留空表示无。 */
66
+ roleTemplate?: ApplicationRoleTemplateItem[];
67
+ }
68
+ export interface ApplicationUpdateReq {
69
+ appID: string;
70
+ /** 应用编码(自建应用可改,留空不修改;内置应用 source=builtin 恒只读):小写字母开头,仅含小写字母、数字与下划线(后端 model.AppCodePattern)。 */
71
+ code?: string;
72
+ name?: string;
73
+ description?: string;
74
+ logoUrl?: string;
75
+ homepageUrl?: string;
76
+ status?: AppStatus;
77
+ sort?: number;
78
+ allowPersonCreateTenant?: AppPersonCreateTenantPolicy;
79
+ allowJoinByInvite?: AppJoinByInvitePolicy;
80
+ /** 应用角色模板:不传表示不修改,传 [] 表示清空,传值即全量替换(移除项会在各租户撤下该角色及其授权)。 */
81
+ roleTemplate?: ApplicationRoleTemplateItem[];
82
+ }
83
+ /** 授权类型(后端具名类型 model.GrantType,RFC 6749 标准字面量)。 */
84
+ export type GrantType = 'authorization_code' | 'client_credentials' | 'refresh_token';
85
+ /** 令牌端点认证方式(后端具名类型 model.TokenEndpointAuthMethod,RFC 8414 标准字面量)。 */
86
+ export type TokenEndpointAuthMethod = 'client_secret_basic' | 'client_secret_post' | 'none';
87
+ export interface OAuthClientItem {
88
+ applicationClientID: string;
89
+ appID: string;
90
+ /** 所属应用名称(后端列表/详情回填,避免前端只拿到 appID) */
91
+ appName: string;
92
+ /** 客户端编码 = OIDC client_id(后端 model.ApplicationClientEntity.Code,全局唯一;允许连字符) */
93
+ code: string;
94
+ name: string;
95
+ source: AppSource;
96
+ status: ApplicationClientStatus;
97
+ grantTypes: GrantType[];
98
+ tokenEndpointAuthMethod: TokenEndpointAuthMethod;
99
+ createdAt?: number;
100
+ updatedAt?: number;
101
+ }
102
+ export interface OAuthClientDetail extends OAuthClientItem {
103
+ tenantID: string;
104
+ redirectURIs: string[];
105
+ postLogoutRedirectURIs: string[];
106
+ backChannelLogoutURI: string;
107
+ responseTypes: string[];
108
+ allowedOrigins: string[];
109
+ /** 是否强制 PKCE(后端 model.ClientPKCEPolicy):enable/disable。 */
110
+ requirePKCE: ClientPKCEPolicy;
111
+ /** 是否要求 id_token 带 auth_time(后端 model.ClientAuthTimeClaimPolicy):enable/disable。 */
112
+ requireAuthTime: ClientAuthTimeClaimPolicy;
113
+ defaultScopes: string[];
114
+ accessTokenTTL: number;
115
+ refreshTokenTTL: number;
116
+ }
117
+ export interface OAuthClientCreateReq {
118
+ appID: string;
119
+ /** 客户端编码(= OIDC client_id):小写字母开头,仅含小写字母与下划线(后端 model.ClientCodePattern)。 */
120
+ code: string;
121
+ name: string;
122
+ redirectURIs?: string[];
123
+ postLogoutRedirectURIs?: string[];
124
+ backChannelLogoutURI?: string;
125
+ grantTypes?: GrantType[];
126
+ responseTypes?: string[];
127
+ tokenEndpointAuthMethod?: TokenEndpointAuthMethod;
128
+ allowedOrigins?: string[];
129
+ /** 规则开关(后端具名类型 ClientPKCEPolicy):enable/disable */
130
+ requirePKCE?: ClientPKCEPolicy;
131
+ requireAuthTime?: ClientAuthTimeClaimPolicy;
132
+ defaultScopes?: string[];
133
+ accessTokenTTL?: number;
134
+ refreshTokenTTL?: number;
135
+ }
136
+ export interface OAuthClientUpdateReq {
137
+ applicationClientID: string;
138
+ /** 客户端编码(= OIDC client_id,可改,留空不修改):仅小写字母与下划线;内置客户端拒改。 */
139
+ code?: string;
140
+ name?: string;
141
+ status?: ApplicationClientStatus;
142
+ redirectURIs?: string[];
143
+ postLogoutRedirectURIs?: string[];
144
+ backChannelLogoutURI?: string;
145
+ grantTypes?: GrantType[];
146
+ responseTypes?: string[];
147
+ tokenEndpointAuthMethod?: TokenEndpointAuthMethod;
148
+ allowedOrigins?: string[];
149
+ /** 规则开关(后端具名类型 ClientPKCEPolicy):enable/disable */
150
+ requirePKCE?: ClientPKCEPolicy;
151
+ requireAuthTime?: ClientAuthTimeClaimPolicy;
152
+ defaultScopes?: string[];
153
+ accessTokenTTL?: number;
154
+ refreshTokenTTL?: number;
155
+ }
156
+ export interface OAuthSecretItem {
157
+ id: string;
158
+ applicationClientID: string;
159
+ name: string;
160
+ valuePrefix: string;
161
+ expiresAt: number | null;
162
+ createdAt: number;
163
+ }
164
+ export interface OAuthSecretCreateResp {
165
+ id: string;
166
+ name: string;
167
+ valuePrefix: string;
168
+ secret: string;
169
+ }
170
+ export type TenantStatus = 'active' | 'suspended';
171
+ /**
172
+ * 租户类型(后端具名类型 model.TenantType):
173
+ * customer-客户租户 / platform-平台租户(分类标识,不参与隔离判定)。
174
+ */
175
+ export type TenantType = 'customer' | 'platform';
176
+ export interface TenantItem {
177
+ tenantID: string;
178
+ code: string;
179
+ dbUser: string;
180
+ name: string;
181
+ status: TenantStatus;
182
+ tag: string;
183
+ type: TenantType;
184
+ createdAt?: number;
185
+ updatedAt?: number;
186
+ }
187
+ /**
188
+ * 建租户时的内置管理员(必填):建租户即产出可登录的租户管理员。
189
+ * 不含密码——初始临时密码由服务端生成并仅在创建响应返回一次(见
190
+ * docs/design/system-design.md §5.8)。
191
+ */
192
+ export interface TenantAdminCreateReq {
193
+ name: string;
194
+ username?: string;
195
+ primaryEmail?: string;
196
+ primaryPhone?: string;
197
+ }
198
+ export interface TenantCreateReq {
199
+ name: string;
200
+ dbUser?: string;
201
+ status?: TenantStatus;
202
+ tag?: string;
203
+ type?: TenantType;
204
+ admin: TenantAdminCreateReq;
205
+ }
206
+ /**
207
+ * 建租户响应。adminInitialPassword 为空表示该管理员的邮箱/手机命中了已存在的自然人
208
+ * (其密码未被改动),此时不会回显任何凭据。
209
+ */
210
+ export interface TenantCreateResp {
211
+ tenantID: string;
212
+ adminUserID: string;
213
+ adminInitialPassword: string;
214
+ }
215
+ /** 重置租户内置管理员密码响应:新临时密码仅此一次返回,该管理员下次登录必须改密。 */
216
+ export interface TenantAdminResetPasswordResp {
217
+ userID: string;
218
+ initialPassword: string;
219
+ }
220
+ export interface TenantUpdateReq {
221
+ tenantID: string;
222
+ name?: string;
223
+ dbUser?: string;
224
+ status?: TenantStatus;
225
+ tag?: string;
226
+ type?: TenantType;
227
+ }
228
+ export interface TenantApplicationItem {
229
+ tenantAppID: string;
230
+ tenantID: string;
231
+ tenantName?: string;
232
+ appID: string;
233
+ appName?: string;
234
+ /**
235
+ * 所属应用来源(后端 model.AppSource)。builtin=订阅的是内置应用(平台管理后台/租户管理后台),
236
+ * 该订阅由系统开通(种子 / ProvisionTenantAdmin),不可删除——前端据此隐藏「删除」。
237
+ */
238
+ appSource?: AppSource;
239
+ status: TenantApplicationStatus;
240
+ /**
241
+ * 该租户下已准入(user_application.status=enable)本应用的成员数。
242
+ * 停用/删除订阅会让这些成员失去本应用访问,故用于确认文案回显「影响人数」。
243
+ */
244
+ grantedUserCount?: number;
245
+ createdAt?: number;
246
+ updatedAt?: number;
247
+ }
248
+ export interface TenantApplicationCreateReq {
249
+ tenantID: string;
250
+ appID: string;
251
+ status?: TenantApplicationStatus;
252
+ }
253
+ export interface TenantApplicationUpdateReq {
254
+ tenantAppID: string;
255
+ status?: TenantApplicationStatus;
256
+ }
257
+ export type MenuType = 'directory' | 'menu' | 'button';
258
+ export type MenuStatus = 'enable' | 'disable';
259
+ export type MenuVisibility = 'public' | 'member' | 'admin';
260
+ /**
261
+ * 菜单展示开关(后端具名类型,取值 enable/disable;语义等价旧 0/1:1=enable / 0=disable):
262
+ * MenuHiddenFlag / MenuExternalLinkFlag / MenuKeepAliveFlag。
263
+ */
264
+ export type MenuHiddenFlag = 'enable' | 'disable';
265
+ export type MenuExternalLinkFlag = 'enable' | 'disable';
266
+ export type MenuKeepAliveFlag = 'enable' | 'disable';
267
+ export interface MenuItem {
268
+ menuID: string;
269
+ appID: string;
270
+ parentID: string;
271
+ name: string;
272
+ code: string;
273
+ path: string;
274
+ icon: string;
275
+ sort: number;
276
+ type: MenuType;
277
+ visibility?: MenuVisibility;
278
+ component: string;
279
+ redirect: string;
280
+ /** 是否隐藏(后端 model.MenuHiddenFlag):enable/disable */
281
+ hidden: MenuHiddenFlag;
282
+ /** 是否外链(后端 model.MenuExternalLinkFlag):enable/disable */
283
+ externalLink: MenuExternalLinkFlag;
284
+ /** 是否缓存(后端 model.MenuKeepAliveFlag):enable/disable */
285
+ keepAlive: MenuKeepAliveFlag;
286
+ status: MenuStatus;
287
+ createdAt?: number;
288
+ updatedAt?: number;
289
+ children?: MenuItem[];
290
+ }
291
+ export interface MenuTreeResp {
292
+ list: MenuItem[];
293
+ }
294
+ export interface MenuMyTreeResp {
295
+ list: MenuItem[];
296
+ }
297
+ /** 域名验证状态(后端具名类型 model.DomainVerificationStatus):unverified/verified。 */
298
+ export type DomainVerificationStatus = 'unverified' | 'verified';
299
+ export interface DomainItem {
300
+ id: string;
301
+ domain: string;
302
+ /** 验证状态(后端 domain.verification_status);后端 verified_at 已下线,不再回传验证时间。 */
303
+ verificationStatus: DomainVerificationStatus;
304
+ createdAt: number;
305
+ updatedAt: number;
306
+ }
307
+ /** 连接器协议(后端具名类型 model.ConnectorProtocol)。 */
308
+ export type ConnectorProtocol = 'oidc' | 'oauth2';
309
+ /** 连接器身份提供商(后端具名类型 model.ConnectorProvider)。 */
310
+ export type ConnectorProvider = 'google' | 'github' | 'microsoft' | 'wechat';
311
+ /** 连接器能力(后端具名类型 model.ConnectorCapability)。 */
312
+ export type ConnectorCapability = 'authorize' | 'callback' | 'claim_mapping' | 'domain_policy' | 'profile_sync';
313
+ /**
314
+ * 连接器开关(后端具名类型,取值 enable/disable;语义等价旧 bool:true=enable / false=disable):
315
+ * ConnectorAutoCreateUserFlag / ConnectorAccountLinkFlag / ConnectorSyncProfileFlag / ConnectorTokenStorageFlag。
316
+ */
317
+ export type ConnectorAutoCreateUserFlag = 'enable' | 'disable';
318
+ export type ConnectorAccountLinkFlag = 'enable' | 'disable';
319
+ export type ConnectorSyncProfileFlag = 'enable' | 'disable';
320
+ export type ConnectorTokenStorageFlag = 'enable' | 'disable';
321
+ export interface ConnectorItem {
322
+ connectorID: string;
323
+ tenantID: string;
324
+ name: string;
325
+ displayName: string;
326
+ protocol: ConnectorProtocol;
327
+ provider: ConnectorProvider;
328
+ status: ConnectorStatus;
329
+ allowAutoCreateUser: ConnectorAutoCreateUserFlag;
330
+ allowAccountLink: ConnectorAccountLinkFlag;
331
+ syncProfile: ConnectorSyncProfileFlag;
332
+ enableTokenStorage: ConnectorTokenStorageFlag;
333
+ config?: unknown;
334
+ claimMapping?: unknown;
335
+ domainPolicy?: unknown;
336
+ createdAt?: number;
337
+ }
338
+ export interface ConnectorFactoryItem {
339
+ factoryID: string;
340
+ protocol: ConnectorProtocol;
341
+ provider: ConnectorProvider;
342
+ displayName: string;
343
+ isStandard: boolean;
344
+ defaultScopes: string[];
345
+ capabilities: ConnectorCapability[];
346
+ configSchema?: unknown;
347
+ }
@@ -0,0 +1,14 @@
1
+ export interface ApiResponse<T> {
2
+ code: number;
3
+ msg: string;
4
+ data: T;
5
+ }
6
+ export declare enum BizCode {
7
+ Success = 0,
8
+ Unauthorized = 110000,
9
+ Forbidden = 110001,
10
+ TokenInvalid = 110002,
11
+ TokenExpired = 110003,
12
+ PermissionDenied = 110004,
13
+ ParamInvalid = 100104
14
+ }
@@ -0,0 +1,243 @@
1
+ import type { UserDepartmentItem } from './department';
2
+ import type { AppStatus, MenuItem, SysAdminType } from './platform';
3
+ /**
4
+ * 租户成员可用性(后端具名类型 model.UserStatus):active-正常 / suspended-已挂起。
5
+ * 与 person 的 PersonStatus(auth.ts)刻意分列:两者是不同实体的生命周期。
6
+ */
7
+ export type UserStatus = 'active' | 'suspended';
8
+ /** 租户拥有者类型(后端具名类型 model.OwnerType):owner-租户拥有者 / normal-普通成员。 */
9
+ export type OwnerType = 'owner' | 'normal';
10
+ export interface TenantUserItem {
11
+ userID: string;
12
+ tenantID: string;
13
+ username: string;
14
+ primaryEmail: string;
15
+ primaryPhone: string;
16
+ name: string;
17
+ avatar: string;
18
+ status: UserStatus;
19
+ primaryDepartmentName: string;
20
+ roleCount: number;
21
+ createdAt?: number;
22
+ updatedAt?: number;
23
+ }
24
+ /**
25
+ * 建成员入参。不含密码:初始临时密码由服务端生成、仅在创建响应返回一次,
26
+ * 且该成员首次登录必须改密(见 docs/design/system-design.md §5.8)。
27
+ */
28
+ export interface TenantUserCreateReq {
29
+ personID?: string;
30
+ username?: string;
31
+ primaryEmail?: string;
32
+ primaryPhone?: string;
33
+ name: string;
34
+ avatar?: string;
35
+ /** 初始状态(后端 model.UserStatus):缺省/空串按 active 落库。 */
36
+ status?: UserStatus;
37
+ primaryDepartmentID: string;
38
+ secondaryDepartmentIDs?: string[];
39
+ leaderDepartmentIDs?: string[];
40
+ }
41
+ /**
42
+ * 建成员响应。initialPassword 为空表示邮箱/手机命中了已存在的自然人(其密码未被改动),
43
+ * 此时不会回显任何凭据。
44
+ */
45
+ export interface TenantUserCreateResp {
46
+ userID: string;
47
+ initialPassword: string;
48
+ }
49
+ /** 重置成员密码响应:新临时密码仅此一次返回,成员下次登录必须改密。 */
50
+ export interface TenantUserResetPasswordResp {
51
+ userID: string;
52
+ initialPassword: string;
53
+ }
54
+ export interface TenantUserDepartmentUpdate {
55
+ username?: string;
56
+ primaryEmail?: string;
57
+ primaryPhone?: string;
58
+ primaryDepartmentID?: string;
59
+ secondaryDepartmentIDs?: string[];
60
+ leaderDepartmentIDs?: string[];
61
+ }
62
+ export interface TenantUserDetail extends TenantUserItem {
63
+ departments: UserDepartmentItem[];
64
+ roles: TenantUserRoleItem[];
65
+ }
66
+ export interface TenantUserRoleItem {
67
+ roleID: string;
68
+ appID: string;
69
+ appName: string;
70
+ name: string;
71
+ description: string;
72
+ }
73
+ export interface TenantUserIdentityItem {
74
+ userIdentityID: string;
75
+ issuer: string;
76
+ identityID: string;
77
+ detail?: unknown;
78
+ createdAt: number;
79
+ updatedAt: number;
80
+ }
81
+ export interface TenantUserIdentityCreateReq {
82
+ userID: string;
83
+ issuer: string;
84
+ identityID: string;
85
+ detail?: unknown;
86
+ }
87
+ export interface TenantUserLoginLogItem {
88
+ userLoginLogID: string;
89
+ loginIP: string;
90
+ userAgent: string;
91
+ loginTime: number;
92
+ }
93
+ /**
94
+ * 租户已订阅且启用的应用(角色归属 / 菜单授权 / 应用准入的应用候选)。
95
+ * 接口:`GET /v1/tenant/applications`(原 `/tenant/apps` 已下线)。
96
+ */
97
+ export interface TenantSubscribedApplicationItem {
98
+ appID: string;
99
+ code: string;
100
+ name: string;
101
+ }
102
+ /** 准入状态(后端具名类型 model.UserApplicationStatus):撤销用 disable,行保留以备审计 */
103
+ export type UserApplicationStatus = 'enable' | 'disable';
104
+ /** 准入来源(后端具名类型 model.UserApplicationSource):manual-手工分配 / role-角色授予自动补 / provision-引导写入 */
105
+ export type UserApplicationSource = 'manual' | 'role' | 'provision';
106
+ /**
107
+ * 用户视角的单个应用准入行。清单是「本租户订阅行 ∪ 该成员准入行」的并集:
108
+ * `subscribed`(租户已订阅且启用)/ `granted`(该成员已准入且启用)是两道门槛,
109
+ * 二者为真且 `appStatus === 'enable'` 才真正可用(后端判定式 CanUseApp)。
110
+ */
111
+ export interface TenantUserApplicationItem {
112
+ appID: string;
113
+ code: string;
114
+ name: string;
115
+ appStatus: AppStatus;
116
+ subscribed: boolean;
117
+ granted: boolean;
118
+ /** 无准入行时为空串 */
119
+ status: UserApplicationStatus | '';
120
+ /** 无准入行时为空串 */
121
+ source: UserApplicationSource | '';
122
+ /** 该成员在此应用下的角色数:撤销准入会级联撤销这些角色绑定,用于二次确认文案 */
123
+ roleCount: number;
124
+ updatedAt: number;
125
+ }
126
+ /** 用户应用准入清单(含未准入的订阅应用,供 UI 呈现全集与选中态) */
127
+ export interface TenantUserApplicationsListResp {
128
+ list: TenantUserApplicationItem[];
129
+ }
130
+ /** 应用视角的被准入成员行(仅含已准入成员) */
131
+ export interface TenantApplicationUserItem {
132
+ userID: string;
133
+ /** 账号类型(后端具名类型 model.UserType):member-真实用户 / machine-服务账号 */
134
+ userType: 'member' | 'machine';
135
+ name: string;
136
+ username: string;
137
+ primaryEmail: string;
138
+ status: UserStatus;
139
+ source: UserApplicationSource;
140
+ roleCount: number;
141
+ updatedAt: number;
142
+ }
143
+ export interface TenantApplicationUsersListResp {
144
+ list: TenantApplicationUserItem[];
145
+ total: number;
146
+ }
147
+ export type RoleSource = 'builtin' | 'custom';
148
+ export interface TenantRoleItem {
149
+ roleID: string;
150
+ appID: string;
151
+ appName: string;
152
+ /**
153
+ * 角色编码(后端具名类型 model.RoleCode):跨系统授权契约值,即 OIDC ID token 的 `groups` 声明,
154
+ * 下游系统按「前缀 + 编码」认策略名,形状 `^[a-z][a-z0-9_]*$`。
155
+ *
156
+ * **只读**:取值来自应用角色模板(开通应用时物化到本租户,见 `ApplicationItem.roleTemplate`)或产品锚点;
157
+ * 租户自建角色不参与跨系统契约,该字段为空串。
158
+ */
159
+ code: string;
160
+ name: string;
161
+ description: string;
162
+ source?: RoleSource;
163
+ adminType: SysAdminType;
164
+ memberCount: number;
165
+ menuCount: number;
166
+ createdAt?: number;
167
+ updatedAt?: number;
168
+ }
169
+ export interface TenantRoleCreateReq {
170
+ appID: string;
171
+ name: string;
172
+ description?: string;
173
+ }
174
+ /** 角色全量更新入参(PUT,body 不含 roleID,path 是 ID 唯一来源)。 */
175
+ export interface TenantRoleUpdateReq {
176
+ roleID: string;
177
+ name: string;
178
+ description?: string;
179
+ }
180
+ export interface TenantRoleMenuResp {
181
+ list: MenuItem[];
182
+ menuIDs: string[];
183
+ }
184
+ export interface TenantMachineUserItem {
185
+ machineUserID: string;
186
+ tenantID: string;
187
+ name: string;
188
+ description: string;
189
+ primaryDepartmentID: string;
190
+ primaryDepartmentName: string;
191
+ status: UserStatus;
192
+ createdAt?: number;
193
+ updatedAt?: number;
194
+ }
195
+ export interface TenantMachineUserDepartment {
196
+ departmentID: string;
197
+ departmentName: string;
198
+ relationType: 'primary' | 'secondary';
199
+ }
200
+ export interface TenantMachineUserDetail extends TenantMachineUserItem {
201
+ departments: TenantMachineUserDepartment[];
202
+ roles: TenantUserRoleItem[];
203
+ }
204
+ export interface TenantMachineUserCreateReq {
205
+ name: string;
206
+ description?: string;
207
+ primaryDepartmentID: string;
208
+ secondaryDepartmentIDs?: string[];
209
+ }
210
+ export interface TenantMachineUserUpdateReq {
211
+ machineUserID: string;
212
+ name: string;
213
+ description?: string;
214
+ primaryDepartmentID?: string | null;
215
+ secondaryDepartmentIDs?: string[] | null;
216
+ }
217
+ export type TenantApiKeyOwnerType = 'member' | 'machine';
218
+ export interface TenantApiKeyItem {
219
+ keyID: string;
220
+ name: string;
221
+ keyPrefix: string;
222
+ ownerUserID: string;
223
+ ownerType: TenantApiKeyOwnerType;
224
+ ownerName: string;
225
+ createdBy: string;
226
+ creatorName: string;
227
+ expiredAt: number | null;
228
+ revokedAt: number | null;
229
+ createdAt: number;
230
+ updatedAt: number;
231
+ }
232
+ export interface TenantApiKeyCreateReq {
233
+ name: string;
234
+ machineUserID: string;
235
+ expiredAt?: number;
236
+ }
237
+ export interface TenantApiKeyCreateResp {
238
+ id: string;
239
+ name: string;
240
+ key: string;
241
+ keyPrefix: string;
242
+ expiredAt: number;
243
+ }
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ import 'dayjs/locale/zh-cn';
3
+ interface Props {
4
+ children: ReactNode;
5
+ }
6
+ /**
7
+ * 应用外壳:注入 Ant Design 全局主题(中文语言包 + 设计令牌)。
8
+ * 每个前端 app 的 main.tsx 用 <AppShell> 包裹。
9
+ * 根容器开启 tabular-nums,让 ID/时间/数字等宽对齐(Stripe 数据细节,见 DESIGN.md)。
10
+ *
11
+ * 全局 antd「结构级」微修正也集中在此:AppShell 是各 app 唯一公共挂载点,
12
+ * 而这类修正针对 antd 内部 DOM / portal 渲染的下拉等,无法用组件 inline style 表达
13
+ * (约定与清单见 DESIGN.md §7.1)。禁止各 app 新增 css 文件或在页面散落重复 <style>。
14
+ */
15
+ export declare function AppShell({ children }: Props): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,16 @@
1
+ export interface EllipsisCellProps {
2
+ /** 文本内容;空值展示为 placeholder */
3
+ value?: string | number | null;
4
+ /** 展示前先截断到该字符数(仅影响展示,悬浮提示仍为完整内容) */
5
+ limit?: number;
6
+ /** 使用等宽字体 */
7
+ monospace?: boolean;
8
+ /** 空值占位文案,默认 `-` */
9
+ placeholder?: string;
10
+ }
11
+ /**
12
+ * 可能展示不全的文本单元格:
13
+ * - 超出单元格宽度即省略号截断
14
+ * - 鼠标悬浮展示完整内容(可拖选直接复制)
15
+ */
16
+ export declare function EllipsisCell({ value, limit, monospace, placeholder }: EllipsisCellProps): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ export interface IDCellProps {
2
+ /** ID 值;空值展示为 - */
3
+ value?: string | number | null;
4
+ /** 保留的前缀长度,默认 8 */
5
+ prefix?: number;
6
+ /** 保留的后缀长度,默认 4 */
7
+ suffix?: number;
8
+ }
9
+ /**
10
+ * 长 ID 单元格(UUID v7 等):
11
+ * - 默认仅展示首尾片段,如 `0190e2a4…c3d4`
12
+ * - 鼠标悬浮展示完整 ID(可拖选直接复制,无独立复制按钮)
13
+ */
14
+ export declare function IDCell({ value, prefix, suffix }: IDCellProps): import("react").JSX.Element;
@@ -0,0 +1,18 @@
1
+ export interface InitialPasswordModalProps {
2
+ /**
3
+ * 一次性初始/临时密码明文。为空表示未生成(如复用了既有自然人,其密码未被改动),
4
+ * 此时 Modal 不展示。
5
+ */
6
+ password: string;
7
+ /** 弹窗标题,默认「初始密码已生成」。 */
8
+ title?: string;
9
+ /** 密码上方的补充说明(如「该成员首次登录必须修改密码」)。 */
10
+ description?: string;
11
+ onClose: () => void;
12
+ }
13
+ /**
14
+ * 一次性初始密码展示 Modal:密码由服务端生成、仅在本次响应返回一次,关闭后不可再查。
15
+ * 平台侧(建租户/重置内置管理员密码)与租户侧(建成员/重置成员密码)共用同一交互,
16
+ * 保证两边"密码相关交互一致"(见 docs/design/system-design.md §5.8)。
17
+ */
18
+ export declare function InitialPasswordModal({ password, title, description, onClose }: InitialPasswordModalProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ title: string;
3
+ subtitle?: string;
4
+ }
5
+ export declare function LoginPage({ title, subtitle }: Props): import("react").JSX.Element;
6
+ export {};