import { useCallback, useEffect, useState } from 'react';
import AdEngine from '../../core/engines/AdEngine';
import { isAmityAd } from './useCustomRankingGlobalFeed';
export const useCommentAdImpression = () => {
  const [commentsView, setCommentsView] = useState([]);
  const handleViewChange = useCallback(({
    viewableItems
  }) => {
    setCommentsView([...viewableItems]);
  }, []);
  useEffect(() => {
    if (commentsView.length > 0) {
      for (const viewableComment of commentsView) {
        if (isAmityAd(viewableComment.item)) {
          AdEngine.instance.markSeen(viewableComment.item, 'comment');
        }
      }
    }
  }, [commentsView]);
  return {
    handleViewChange
  };
};
//# sourceMappingURL=useCommentAdImpression.js.map