@flavoai/fastfold
Version:
Flavo frontend package
74 lines • 2.65 kB
TypeScript
import React from 'react';
import { QueryClient } from '@tanstack/react-query';
import { ObservabilityConfig } from './observability';
import { FlavoAuthConfig } from './auth';
/**
* Create a pre-configured QueryClient optimized for Fastfold
*/
export declare function createFastfoldQueryClient(options?: {
staleTime?: number;
gcTime?: number;
refetchOnWindowFocus?: boolean;
retry?: number;
retryDelay?: number;
}): QueryClient;
interface FastfoldProviderProps {
children: React.ReactNode;
queryClient?: QueryClient;
showDevtools?: boolean;
devtoolsOptions?: {
initialIsOpen?: boolean;
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
};
/** Enable DevTools bridge for parent window communication (auto-detected) */
enableBridge?: boolean;
/**
* Parent-window origins the DevTools bridge will trust for incoming
* postMessages and target with outgoing responses. Defaults to Flavo's
* known production and local-development origins. Override only if you
* know what you're doing — a wildcard or malformed origin exposes the
* embedded app's data to any third-party page that iframes it.
*/
allowedParentOrigins?: string[];
/** Base URL for API calls (defaults to /api parent path) */
baseUrl?: string;
/** Observability configuration for analytics and error tracking */
observability?: Omit<ObservabilityConfig, 'enabled'> & {
enabled?: boolean;
};
/** Flavo auth configuration. Pass { enabled: true } to enable delegated Flavo OAuth. */
flavoAuth?: Partial<FlavoAuthConfig>;
}
/**
* 🚀 FASTFOLD PROVIDER - Wrap your app with this to enable Fastfold hooks
*
* @example
* function App() {
* return (
* <FastfoldProvider>
* <YourApp />
* </FastfoldProvider>
* );
* }
*
* @example With custom configuration and devtools
* const queryClient = createFastfoldQueryClient({
* staleTime: 10 * 60 * 1000, // 10 minutes
* refetchOnWindowFocus: true
* });
*
* function App() {
* return (
* <FastfoldProvider
* queryClient={queryClient}
* showDevtools={true} // Opt-in to show devtools
* >
* <YourApp />
* </FastfoldProvider>
* );
* }
*/
export declare function FastfoldProvider({ children, queryClient, showDevtools, // Disabled by default
devtoolsOptions, enableBridge, allowedParentOrigins, baseUrl, observability: observabilityConfig, flavoAuth, }: FastfoldProviderProps): import("react/jsx-runtime").JSX.Element;
export { useQueryClient } from '@tanstack/react-query';
//# sourceMappingURL=provider.d.ts.map