import { cloneElement } from 'react';
import { useSuggestionsContext } from './SuggestionsContext';
/**
 * Wrapper component that adds automatic CTA click reporting to the dealer BI service.
 *
 * Note: The child component must be clickable (accept an onClick prop).
 */
export const SuggestionCtaWrapper = ({ offerId, referredUrl, children, }) => {
    const { onOfferClicked } = useSuggestionsContext();
    return cloneElement(children, {
        onClick: (e) => {
            onOfferClicked(offerId, referredUrl);
            children.props.onClick?.(e);
        },
    });
};
//# sourceMappingURL=SuggestionCtaWrapper.js.map