export declare const isNotDefined: (value: T | null | undefined) => value is null | undefined; export declare const isDefined: (value: T | null | undefined) => value is NonNullable; export declare const isEmpty: (value: string | undefined | null) => value is undefined; export declare const isNotEmpty: (value: string | undefined | null) => value is string; /** * Checks if the current tenant matches the target tenant * @param tenant - The current tenant identifier * @param targetTenant - The target tenant to check against * @returns true if tenant matches targetTenant, false otherwise */ export declare const isTenant: (tenant: string | undefined, targetTenant: string) => boolean; /** * Clears authentication data from localStorage * Used when 401 errors are detected or user logs out */ export declare const clearAuthenticationData: () => void; /** * Clears authentication data from localStorage * Used when 401 errors are detected or user logs out */ export declare const sendRequest: (params: string | { url: string; method: string; body?: Record | FormData | undefined; type?: string | undefined; headers?: Record | undefined; formData?: FormData | undefined; onRequest?: ((request: RequestInit) => Promise) | undefined; }) => Promise<{ data?: ResponseData | undefined; error?: Error | undefined; }>; export declare const setLocalStorageChatflow: (chatflowid: string, chatId: string, saveObj?: Record) => void; export declare const getLocalStorageChatflow: (chatflowid: string) => any; export declare const removeLocalStorageChatHistory: (chatflowid: string) => void; export declare const getBubbleButtonSize: (size: 'small' | 'medium' | 'large' | number | undefined) => number; export declare const setCookie: (cname: string, cvalue: string, exdays: number) => void; /** * Validates dataLogin from localStorage and maps user data to cmcts:userInfo * @returns true if successful mapping occurred, false otherwise */ /** * Type definitions for user info API response */ export type UserInfoApiResponse = { RESULT: { CODE: number; MSG: string; }; OBJRETURN: { data: { id: string; _id: number; loginname: string; fullname: string; fullnameen: string; email: string; code: string; mobile?: string; imageurl?: string; roleName: string[]; techGroup: Array<{ id: number; name: string; }>; permissions: Record; [key: string]: any; }; }; }; /** * Fetches user info from /api/user-info endpoint with cookies * @param apiHost - The API host URL * @param onRequest - Optional request interceptor * @returns Promise with user info data or error */ export declare const fetchUserInfo: (apiHost: string, onRequest?: ((request: RequestInit) => Promise) | undefined) => Promise<{ data?: UserInfoApiResponse; error?: Error; }>; /** * Maps API response to dataLogin format expected by the application * @param apiResponse - The API response from /api/user-info * @returns Mapped dataLogin object */ export declare const mapApiResponseToDataLogin: (apiResponse: UserInfoApiResponse) => any; /** * Validates dataLogin from localStorage and maps user data to cmcts:userInfo * @returns true if successful mapping occurred, false otherwise */ export declare const validateAndMapUserInfo: () => boolean; /** * Checks and initializes authentication for popup embedding * If dataLogin doesn't exist, fetches user info from API and creates it * @param apiHost - The API host URL * @param tenant - The tenant identifier * @param onRequest - Optional request interceptor * @param isFullPage - Whether the chatbot is in full page mode * @returns Promise - true if authentication is successful, false otherwise */ export declare const checkAndInitializeAuth: (apiHost?: string, tenant?: string, onRequest?: ((request: RequestInit) => Promise) | undefined, isFullPage?: boolean) => Promise; /** * Forces reload of user information from API and remaps to dataLogin * Used when popup opens to ensure fresh user data * @param apiHost - The API host URL * @param tenant - The tenant identifier * @param onRequest - Optional request interceptor * @param isFullPage - Whether the chatbot is in full page mode * @returns Promise - true if reload and mapping successful, false otherwise */ export declare const reloadAndMapUserInfo: (apiHost?: string, tenant?: string, onRequest?: ((request: RequestInit) => Promise) | undefined, isFullPage?: boolean) => Promise; /** * Type definitions for Co-op Bank user info API response */ export type CoopBankUserInfoApiResponse = { id: string; userName: string; fullName: string; firstName: string; mobile: string; mobileSigner: string | null; email: string; caNumber: string | null; caType: string | null; caSerial: string | null; positionId: string | null; deptId: string | null; birthDate: string | null; gender: string | null; idCard: string | null; staffCardNumber: string | null; passwordChanged: string | null; passwordExpireDate: string | null; isDelete: number; creatorId: string; creatorName: string; createTime: number; updatorId: string; updatorName: string; updateTime: number; status: string; address: string | null; iconPhoto: string | null; [key: string]: any; }; /** * Fetches user info from Co-op Bank /business-service/user endpoint * @param apiHost - The API host URL (kept for backward compatibility, not used for this endpoint) * @param businessServiceHost - Optional host for the business service API (defaults to window.location.origin) * @param onRequest - Optional request interceptor * @returns Promise with user info data or error */ export declare const fetchCoopBankUserInfo: (apiHost: string, businessServiceHost?: string, onRequest?: ((request: RequestInit) => Promise) | undefined) => Promise<{ data?: CoopBankUserInfoApiResponse; error?: Error; }>; /** * Maps Co-op Bank user info to cmcts:userInfo format * @param userInfo - The user info from Co-op Bank API * @returns Mapped userInfo object */ export declare const mapCoopBankUserInfo: (userInfo: CoopBankUserInfoApiResponse) => Record; /** * Checks and initializes authentication for Co-op Bank integration * Fetches user info from API and maps to cmcts:userInfo * @param apiHost - The API host URL * @param businessServiceHost - Optional host for the business service API * @param tenant - The tenant identifier * @param onRequest - Optional request interceptor * @param isFullPage - Whether the chatbot is in full page mode * @returns Promise - true if authentication is successful, false otherwise */ export declare const checkAndInitializeCoopBankAuth: (apiHost?: string, businessServiceHost?: string, tenant?: string, onRequest?: ((request: RequestInit) => Promise) | undefined, isFullPage?: boolean) => Promise; /** * Forces reload of user information from Co-op Bank API and remaps to cmcts:userInfo * Used when popup opens to ensure fresh user data * @param apiHost - The API host URL * @param businessServiceHost - Optional host for the business service API * @param tenant - The tenant identifier * @param onRequest - Optional request interceptor * @param isFullPage - Whether the chatbot is in full page mode * @returns Promise - true if reload and mapping successful, false otherwise */ export declare const reloadAndMapCoopBankUserInfo: (apiHost?: string, businessServiceHost?: string, tenant?: string, onRequest?: ((request: RequestInit) => Promise) | undefined, isFullPage?: boolean) => Promise; export declare const getCookie: (cname: string) => string; //# sourceMappingURL=index.d.ts.map