Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else if (action === ACTIONS.PREV) {
t = this.state.steps[index - 1]
}
if(!t) return
const a = document.querySelector(t.target)
centerDiv(a)
}
// Update state to advance the tour
//this.setState({ stepIndex: index + (action === ACTIONS.PREV ? -1 : 1) });
}
else if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
// Need to set our running state to false, so we can restart if we click start again.
this.setState({ run: false });
}
console.groupCollapsed(type);
console.log(data); //eslint-disable-line no-console
console.groupEnd();
};
handleJoyrideCallback = data => {
const { action, index, status, type } = data;
if ([EVENTS.STEP_AFTER, EVENTS.TARGET_NOT_FOUND].includes(type)) {
// Update state to advance the tour
this.setState({ stepIndex: index + (action === ACTIONS.PREV ? -1 : 1) });
}
else if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
// Need to set our running state to false, so we can restart if we click start again.
this.setState({ run: false });
this.registerEvent(status)
}
console.groupCollapsed(type);
console.log(data); //eslint-disable-line no-console
console.groupEnd();
};
mutationObserver = new MutationObserver(mutationHandler);
mutationObserver.observe(document.body, {
childList: true,
attributes: true,
subtree: true
});
// call it once manually after the event was registered as the
// element might already be visible in the DOM at which point we're
// already done.
mutationHandler();
}
if (callbackProps.status === STATUS.SKIPPED || callbackProps.status === STATUS.FINISHED) {
try {
// FIXME?
// this.setState({ run: false, stepIndex: 0 });
switch (callbackProps.status) {
case STATUS.SKIPPED:
RendererAnalytics.event({category: 'tour-result', action: 'skipped'});
RendererAnalytics.event({category: 'tour-skip', action: 'skipped-at-step-' + callbackProps.index});
LifecycleToggle.mark(LifecycleEvents.TOUR_SKIPPED);
break;
case STATUS.FINISHED:
RendererAnalytics.event({category: 'tour-result', action: 'finished'});
callback={data => {
const { action, index, type, status, step } = data;
const { actions } = step || {};
const { prev, next } = actions || {};
if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
// Need to set our running state to false, so we can restart if we click start again.
handleStateChange({ open: false, stepIndex: 0, stepsKey: '' });
} else if (data.action === 'close' || data.type === 'tour:end') {
handleStateChange({
stepIndex: 0,
open: false
});
} else if (
[
EVENTS.STEP_AFTER,
EVENTS.TARGET_NOT_FOUND,
EVENTS.TOUR_START
].includes(type)
) {
const newStepIndex = index + (action === ACTIONS.PREV ? -1 : 1);
// Update state to advance the tour
// call it once manually after the event was registered as the
// element might already be visible in the DOM at which point we're
// already done.
mutationHandler();
}
if (callbackProps.status === STATUS.SKIPPED || callbackProps.status === STATUS.FINISHED) {
try {
// FIXME?
// this.setState({ run: false, stepIndex: 0 });
switch (callbackProps.status) {
case STATUS.SKIPPED:
RendererAnalytics.event({category: 'tour-result', action: 'skipped'});
RendererAnalytics.event({category: 'tour-skip', action: 'skipped-at-step-' + callbackProps.index});
LifecycleToggle.mark(LifecycleEvents.TOUR_SKIPPED);
break;
case STATUS.FINISHED:
RendererAnalytics.event({category: 'tour-result', action: 'finished'});
LifecycleToggle.mark(LifecycleEvents.TOUR_FINISHED);
break;
}
} finally {
LifecycleToggle.mark(LifecycleEvents.TOUR_TERMINATED);
}
onJoyrideCallback = data =>
[STATUS.FINISHED, STATUS.SKIPPED].includes(data.status) &&
this.setState({ runTour: false });
onSolutionChange = solution => this.setState({ solution });
private onCallback(callbackProps: CallBackProps): void {
RendererAnalytics.event({category: 'viewer-tour-steps', action: 'did-step-' + callbackProps.index});
if (callbackProps.status === STATUS.SKIPPED || callbackProps.status === STATUS.FINISHED) {
try {
switch (callbackProps.status) {
case STATUS.SKIPPED:
RendererAnalytics.event({category: 'viewer-tour-result', action: 'skipped'});
RendererAnalytics.event({category: 'viewer-tour-skip', action: 'skipped-at-step-' + callbackProps.index});
LifecycleToggle.mark(LifecycleEvents.VIEWER_TOUR_SKIPPED);
break;
case STATUS.FINISHED:
RendererAnalytics.event({category: 'viewer-tour-result', action: 'finished'});
LifecycleToggle.mark(LifecycleEvents.VIEWER_TOUR_FINISHED);
private onCallback(callbackProps: CallBackProps): void {
RendererAnalytics.event({category: 'viewer-tour-steps', action: 'did-step-' + callbackProps.index});
if (callbackProps.status === STATUS.SKIPPED || callbackProps.status === STATUS.FINISHED) {
try {
switch (callbackProps.status) {
case STATUS.SKIPPED:
RendererAnalytics.event({category: 'viewer-tour-result', action: 'skipped'});
RendererAnalytics.event({category: 'viewer-tour-skip', action: 'skipped-at-step-' + callbackProps.index});
LifecycleToggle.mark(LifecycleEvents.VIEWER_TOUR_SKIPPED);
break;
case STATUS.FINISHED:
RendererAnalytics.event({category: 'viewer-tour-result', action: 'finished'});
LifecycleToggle.mark(LifecycleEvents.VIEWER_TOUR_FINISHED);
break;
}
} finally {
LifecycleToggle.mark(LifecycleEvents.VIEWER_TOUR_TERMINATED);
}