import { type ReactElement } from 'react'; import { Core } from '../../init/CoreInitializer'; import { ApiClientService } from '../../services/ApiClientService'; import { CoreEventManager } from '../../events/CoreEventManager'; import type { CoreAppContext, CoreAppEnvironment, CorePlyazContextValue, CorePlyazProviderProps as PlyazProviderProps, CoreDomainServiceInstance } from '@plyaz/types/core'; /** * Implementation-specific context value. * Extends CorePlyazContextValue with concrete implementation references. */ interface PlyazContextValue extends Omit { /** API client for making HTTP requests */ api: typeof ApiClientService | null; /** Event manager for pub/sub */ events: typeof CoreEventManager; /** Core initializer reference */ core: typeof Core; } declare const PlyazContext: import("react").Context; export declare function PlyazProvider({ children, store, config, loading, error: errorComponent, onReady, onError, skipLoadingState, }: PlyazProviderProps): ReactElement; /** * Access all Plyaz services * * @example * ```tsx * function MyComponent() { * const { api, events, isReady, featureFlags } = usePlyaz(); * * if (!isReady) return ; * * const handleClick = async () => { * const response = await api.getClient().get('/data'); * events.emit('data:fetched', { data: response.data }); * }; * * return ; * } * ``` */ export declare function usePlyaz(): PlyazContextValue; /** * Access API client directly * * @example * ```tsx * function UserList() { * const api = useApi(); * const [users, setUsers] = useState([]); * * useEffect(() => { * api.getClient().get('/users').then(res => setUsers(res.data)); * }, [api]); * * return
    {users.map(u =>
  • {u.name}
  • )}
; * } * ``` */ export declare function useApi(): typeof ApiClientService; /** * Access API client safely (returns null if not ready) */ export declare function useApiSafe(): typeof ApiClientService | null; /** * Access event manager * * @example * ```tsx * function NotificationListener() { * const events = useEvents(); * * useEffect(() => { * const unsubscribe = events.on('notification:received', (event) => { * toast.show(event.data.message); * }); * return unsubscribe; * }, [events]); * * return null; * } * ``` */ export declare function useEvents(): typeof CoreEventManager; /** * Check if a feature flag is enabled * * @example * ```tsx * function FeatureComponent() { * const isEnabled = useFlag('NEW_DASHBOARD'); * * if (!isEnabled) return null; * return ; * } * ``` */ export declare function useFlag(key: string, defaultValue?: boolean): boolean; /** * Access feature flag utilities * * @example * ```tsx * function FlagManager() { * const flags = useFeatureFlags(); * const allFlags = flags.getAll(); * * return ( *
*
{JSON.stringify(allFlags, null, 2)}
* *
* ); * } * ``` */ export declare function useFeatureFlags(): PlyazContextValue['featureFlags']; /** * Check if Plyaz services are ready * * @example * ```tsx * function LoadingAwareComponent() { * const isReady = usePlyazReady(); * * if (!isReady) return ; * return ; * } * ``` */ export declare function usePlyazReady(): boolean; /** * Get current app context */ export declare function useAppContext(): CoreAppContext; /** * Get current environment */ export declare function useEnvironment(): CoreAppEnvironment; /** * Get a domain service by key. * Services must be registered in the `services` config. * * @param key - Service key (e.g., 'featureFlags', 'example') * @returns The service instance * @throws If service is not initialized or not found * * @example * ```tsx * function MyComponent() { * const flagService = useService('featureFlags'); * * useEffect(() => { * flagService.isEnabled('my-flag').then(console.log); * }, [flagService]); * * return
...
; * } * ``` */ export declare function useService(key: string): T; /** * Get a domain service by key with loading state. * Useful for lazy-initialized services. * * @param key - Service key * @returns Object with service, loading state, and error * * @example * ```tsx * function MyComponent() { * const { service, isLoading, error } = useServiceAsync('example'); * * if (isLoading) return ; * if (error) return ; * * return
{service?.serviceName}
; * } * ``` */ export declare function useServiceAsync(key: string): { service: T | null; isLoading: boolean; error: Error | null; }; /** * Check if a service is registered and available * * @example * ```tsx * function MyComponent() { * const hasFlags = useHasService('featureFlags'); * * if (!hasFlags) { * return
Feature flags not configured
; * } * * return ; * } * ``` */ export declare function useHasService(key: string): boolean; /** * Get all initialized service keys * * @example * ```tsx * function DebugPanel() { * const serviceKeys = useServiceKeys(); * * return ( *
*

Loaded Services:

*
    * {serviceKeys.map(key =>
  • {key}
  • )} *
*
* ); * } * ``` */ export declare function useServiceKeys(): string[]; export { PlyazContext }; export { Core }; //# sourceMappingURL=PlyazProvider.d.ts.map