import * as React from 'react';
import { translate as _t } from '@assets/js-shop/ShopUtils';
import { useContext, useEffect } from 'react';
import { DataContext } from '@assets/js-shop/context';


export function AlsoBought() {
   const context = useContext(DataContext)

   useEffect(() => {
      if(context.alsoBought && typeof window?.wpj?.tracking !== "undefined") {
         window.wpj.tracking.handleImpressions();
      }
   }, [context.alsoBought]);

   return <div className="cartbox-alsobought custom-scrollbar">
      <p className="title-default">{_t('alsoboughtTitle')}</p>
      <div dangerouslySetInnerHTML={{ __html: context.alsoBought }}/>
   </div>;
}
