import { useMutation } from '@tanstack/react-query';
import { NullSeamClientError, useSeamClient } from '../../../lib/seam/use-seam-client.js';
export function useCreateConnectWebview({ willNavigateToWebview = false, } = {}) {
    const { client } = useSeamClient();
    return useMutation({
        mutationFn: async (mutationParams) => {
            if (client === null)
                throw new NullSeamClientError();
            return await client.connectWebviews.create(mutationParams);
        },
        onSuccess: ({ url }) => {
            if (willNavigateToWebview && url != null) {
                globalThis.location.href = url;
            }
        },
    });
}
//# sourceMappingURL=use-create-connect-webview.js.map