diff --git a/web/src/plugin/component/index.tsx b/web/src/plugin/component/index.tsx index 690a6e34..246f7f01 100644 --- a/web/src/plugin/component/index.tsx +++ b/web/src/plugin/component/index.tsx @@ -10,6 +10,7 @@ export { Table, Switch, Tooltip, + notification, } from 'antd'; export { Avatar } from 'tailchat-design'; export const TextArea = Input.TextArea; @@ -46,3 +47,4 @@ export { GroupPanelSelector } from '@/components/GroupPanelSelector'; export { Emoji } from '@/components/Emoji'; export { PortalAdd, PortalRemove } from '@/components/Portal'; export { ErrorBoundary } from '@/components/ErrorBoundary'; +export { UserName } from '@/components/UserName'; diff --git a/web/src/utils/jwt-helper.ts b/web/src/utils/jwt-helper.ts index a8932e29..10b20220 100644 --- a/web/src/utils/jwt-helper.ts +++ b/web/src/utils/jwt-helper.ts @@ -46,8 +46,9 @@ export async function getUserJWT(): Promise { } export interface JWTUserInfoData { + _id?: string; nickname?: string; - uuid?: string; + email?: string; avatar?: string; } /** diff --git a/web/tailchat.d.ts b/web/tailchat.d.ts index 879a292a..cc4badf7 100644 --- a/web/tailchat.d.ts +++ b/web/tailchat.d.ts @@ -51,7 +51,12 @@ declare module '@capital/common' { export const getGlobalState: any; - export const getJWTUserInfo: any; + export const getJWTUserInfo: () => Promise<{ + _id?: string; + nickname?: string; + email?: string; + avatar?: string; + }>; export const dataUrlToFile: any; @@ -65,7 +70,17 @@ declare module '@capital/common' { export const getServiceUrl: () => string; - export const getCachedUserInfo: any; + export const getCachedUserInfo: ( + userId: string, + refetch?: boolean + ) => Promise<{ + _id: string; + email: string; + nickname: string; + discriminator: string; + avatar: string | null; + temporary: boolean; + }>; export const getCachedConverseInfo: any; @@ -107,7 +122,10 @@ declare module '@capital/common' { export const useCurrentUserInfo: any; - export const createPluginRequest: any; + export const createPluginRequest: (pluginName: string) => { + get: (actionName: string, config?: any) => Promise; + post: (actionName: string, data?: any, config?: any) => Promise; + }; export const postRequest: any; @@ -137,7 +155,10 @@ declare module '@capital/common' { export const regChatInputAction: any; - export const regSocketEventListener: any; + export const regSocketEventListener: (item: { + eventName: string; + eventFn: (...args: any[]) => void; + }) => void; export const pluginColorScheme: any; @@ -182,6 +203,11 @@ declare module '@capital/component' { export const Tooltip: any; + /** + * @link https://ant.design/components/notification-cn/ + */ + export const notification: any; + export const Avatar: any; export const TextArea: any; @@ -237,4 +263,9 @@ declare module '@capital/component' { export const PortalRemove: any; export const ErrorBoundary: any; + + export const UserName: React.FC<{ + userId: string; + className?: string; + }>; }