/** * @fileoverview Sync Context Hook - Automatically sync context with Vowel client * * This hook automatically updates the Vowel client's context whenever the provided * context value changes. It's useful for keeping the AI aware of dynamic app state * without manually calling updateContext. * * @example * ```tsx * function ProductPage({ productId }: { productId: string }) { * const product = useProduct(productId); * * // Automatically sync product context to Vowel * useSyncContext({ * page: 'product', * productId: product.id, * productName: product.name, * price: product.price, * }); * * return
{product.name}
; * } * ``` * * @example * ```tsx * function CheckoutPage() { * const cart = useCart(); * * // Sync cart context, clear on unmount * useSyncContext({ * page: 'checkout', * cartTotal: cart.total, * itemCount: cart.items.length, * }); * * return
Checkout
; * } * ``` * * @module @vowel.to/client/hooks * @author vowel.to * @license MIT */ /** * Hook that automatically syncs context to the Vowel client * * Updates the Vowel client's context whenever the provided context value changes. * The context is automatically sent to the AI via session.update if a session is active. * * @param context - Context object to sync with Vowel client. Use null to clear context. * Changes are detected via deep comparison of JSON.stringify result. * * @example * ```tsx * function MyComponent() { * const [user, setUser] = useState(null); * * // Automatically sync user context * useSyncContext(user ? { userId: user.id, userName: user.name } : null); * * return
Hello {user?.name}
; * } * ``` */ export declare function useSyncContext(context: Record | null): void; //# sourceMappingURL=useSyncContext.d.ts.map