import * as react_jsx_runtime from 'react/jsx-runtime'; import { ReactNode } from 'react'; import { I as InitialContext, A as AppConfig, U as UserContext, P as PermissionsHook, c as TranslationHook, a as SessionHook, R as RouteContext, b as StreamingHook } from '../index-Cs_xWkhC.cjs'; export { L as LocaleContext, S as SessionContext, T as TenantContext } from '../index-Cs_xWkhC.cjs'; import { b as AppletRPCSchema } from '../rpc-fh942_dj.cjs'; interface AppletProviderProps { children: ReactNode; windowKey: string; context?: InitialContext; } /** * AppletProvider reads context from window global and provides it to hooks. * * Usage: * * * */ declare function AppletProvider({ children, windowKey, context }: AppletProviderProps): react_jsx_runtime.JSX.Element; /** * useAppletContext provides access to the full applet context. * Use specialized hooks (useUser, useConfig, etc.) for specific context parts. */ declare function useAppletContext$1(): T; interface ConfigProviderProps { children: ReactNode; config: InitialContext; } /** * ConfigProvider accepts context configuration via props. * * Usage: * * * */ declare function ConfigProvider({ children, config }: ConfigProviderProps): react_jsx_runtime.JSX.Element; /** * useConfigContext provides access to the applet context when using ConfigProvider. */ declare function useConfigContext(): T; /** * useAppletContext provides direct access to the window global context. * This is a standalone version that doesn't require AppletProvider. * * Usage: * const context = useAppletContext('__APPLET_CONTEXT__') * * Note: Prefer using AppletProvider + context hooks for better type safety * and testability. Use this hook only when provider setup is not possible. */ declare function useAppletContext(windowKey: string): T; declare function useAppletExtensions = Record>(): TExtensions; interface UseAppletRPCClientOptions { endpoint?: string; timeoutMs?: number; fetcher?: typeof fetch; } declare function useAppletRPCClient(options?: UseAppletRPCClientOptions): { call: (method: string, params: TParams) => Promise; callTyped: (method: TMethod, params: TRouter_1[TMethod]["params"]) => Promise; } & { callTyped(method: TMethod, params: TRouter[TMethod]["params"]): Promise; }; /** * useConfig provides access to applet configuration (endpoints, etc.) * * Usage: * const { graphQLEndpoint, streamEndpoint } = useConfig() */ declare function useConfig(): AppConfig; /** * useUser provides access to current user information. * * Usage: * const { id, email, firstName, lastName, permissions } = useUser() */ declare function useUser(): UserContext; /** * usePermissions provides permission checking utilities. * All user permissions are automatically passed from backend. * * Usage: * const { hasPermission, hasAnyPermission } = usePermissions() * * if (hasPermission('BiChat.Access')) { * // User has bichat access * } * * if (hasAnyPermission('finance.view', 'finance.edit')) { * // User has at least one of these permissions * } */ declare function usePermissions(): PermissionsHook; /** * useTranslation provides i18n translation utilities. * All translations are automatically passed from backend locale bundle. * * Usage: * const { t, language } = useTranslation() * * // Simple translation * t('BiChat.Title') // Returns translated text * * // Translation with interpolation * t('Common.WelcomeMessage', { name: 'John' }) * // If translation is "Welcome {name}!" -> Returns "Welcome John!" * * React uses same keys as Go backend: * Go: pageCtx.T("BiChat.Title") * React: t("BiChat.Title") */ declare function useTranslation(): TranslationHook; interface UseSessionOptions { loginPath?: string; } /** * useSession provides session and authentication handling utilities. * * Usage: * const { isExpiringSoon, refreshSession, csrfToken } = useSession() * * // Check if session is expiring soon (5 min buffer) * if (isExpiringSoon) { * await refreshSession() * } * * // Include CSRF token in requests * fetch('/api/endpoint', { * headers: { 'X-CSRF-Token': csrfToken } * }) */ declare function useSession(options?: UseSessionOptions): SessionHook; /** * useRoute provides access to the current route context. * Route context is initialized from the backend and includes path, params, and query. * * Usage: * const { path, params, query } = useRoute() * * // Example values: * // path: "/sessions/123" * // params: { id: "123" } * // query: { tab: "history" } */ declare function useRoute(): RouteContext; /** * useStreaming provides SSE (Server-Sent Events) streaming utilities with cancellation support. * * Usage: * const { isStreaming, processStream, cancel, reset } = useStreaming() * * // Process async generator stream * await processStream(messageStream, (chunk) => { * console.log('Received:', chunk) * }) * * // Cancel ongoing stream * cancel() * * // Reset state after stream completion * reset() */ declare function useStreaming(): StreamingHook; type ShellMode = 'embedded' | 'standalone'; interface AppletRuntime { basePath: string; assetsBasePath: string; rpcEndpoint?: string; shellMode?: ShellMode; } declare function useAppletRuntime(): AppletRuntime; export { AppConfig, AppletProvider, ConfigProvider, InitialContext, PermissionsHook, RouteContext, SessionHook, StreamingHook, TranslationHook, type UseAppletRPCClientOptions, UserContext, useAppletContext$1 as useAppletContext, useAppletContext as useAppletContextDirect, useAppletExtensions, useAppletRPCClient, useAppletRuntime, useConfig, useConfigContext, usePermissions, useRoute, useSession, useStreaming, useTranslation, useUser };