Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleCallback = data => {
const { index, type } = data;
if (type === EVENTS.TOUR_END && this.state.run) {
this.setState({ run: false });
} else if (type === EVENTS.TARGET_NOT_FOUND) {
this.setState({ run: false });
} else if (type === EVENTS.STEP_AFTER) {
const currentStep = this.state.steps[index].name;
setUserGuideStepStatus(currentStep);
this.setState({ stepIndex: index + 1 });
}
};
tourCallback = (tour) => {
const {action, index, type} = tour;
if (type === EVENTS.STEP_AFTER && index === 1) {
this.setState({run: false});
} else if ([EVENTS.STEP_AFTER, EVENTS.CLOSE, EVENTS.TARGET_NOT_FOUND].includes(type)) {
this.setState({stepIndex: index + (action === ACTIONS.PREV ? -1 : 1)});
}
};