import { useState, useEffect } from 'react';
import { u as useTrackingContext } from './useTrackingContext-C522P4sv.js';

const useTrackingId = ({
  name,
  data,
  hasOverride
}) => {
  const [trackingId, setTrackingId] = useState(void 0);
  const { getTrackingId, optOut } = useTrackingContext();
  useEffect(() => {
    if (hasOverride || optOut) {
      return;
    }
    getTrackingId(JSON.stringify(data), name).then(
      (result) => setTrackingId(result)
    );
  }, [hasOverride, data, name, optOut, getTrackingId]);
  return trackingId;
};

export { useTrackingId };
//# sourceMappingURL=useTrackingId.js.map
