"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useTour = void 0;
var _react = require("react");
var _context = require("./context");
const useTour = ({
  isShowTour = false,
  tourId = ''
}) => {
  const {
    setTourId,
    setShowTour,
    setStepId,
    stepId,
    ...rest
  } = (0, _react.useContext)(_context.TourContext);
  (0, _react.useEffect)(() => {
    setShowTour(isShowTour);
    setTourId(tourId);
    return () => {
      setShowTour(false);
      setTourId('');
      setStepId(0);
    };
  }, [isShowTour, tourId]);
  return (0, _react.useMemo)(() => ({
    setShowTour,
    setTourId,
    setStepId,
    stepId,
    ...rest
  }), [tourId, stepId]);
};
exports.useTour = useTour;