"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useAdvancedTour = void 0;
var _react = require("react");
var _context = require("../context");
/**
 * useAdvancedTour is required to add AdvancedTour on the page where you need it. * */
const useAdvancedTour = ({
  tourId = '',
  isShowTour = false,
  isTourEnabled = false,
  isHighlighted = false
}) => {
  const {
    setAdvancedTourId,
    setAdvancedTourEnabled,
    setAdvancedTourStepId,
    setShowAdvancedTour,
    setIsHighlighted,
    advancedTourStepId,
    advancedTourEnabled,
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    stepId,
    ...rest
  } = (0, _react.useContext)(_context.TourContext);
  (0, _react.useEffect)(() => {
    setAdvancedTourEnabled(isTourEnabled);
    setShowAdvancedTour(isShowTour);
    setAdvancedTourId(tourId);
    setIsHighlighted(isHighlighted);
    return () => {
      setAdvancedTourEnabled(false);
      setShowAdvancedTour(false);
      setAdvancedTourId('');
      setAdvancedTourStepId(0);
      setIsHighlighted(false);
    };
  }, [isShowTour, tourId, isTourEnabled, isHighlighted]);
  return (0, _react.useMemo)(() => ({
    setAdvancedTourEnabled,
    setAdvancedTourId,
    setAdvancedTourStepId,
    setShowAdvancedTour,
    advancedTourStepId,
    setIsHighlighted,
    advancedTourEnabled,
    ...rest
  }), [tourId, advancedTourStepId, advancedTourEnabled]);
};
exports.useAdvancedTour = useAdvancedTour;