Support possibility to deprecate an in-app tutorial step (#4653)

Do not show in changelog
This commit is contained in:
AlexandreS
2022-12-09 16:25:48 +01:00
committed by GitHub
parent c1bed2ebb2
commit 70380dc056
2 changed files with 11 additions and 3 deletions

View File

@@ -52,6 +52,7 @@ export type InAppTutorialFlowStep = {|
id?: string,
isTriggerFlickering?: true,
isCheckpoint?: true,
deprecated?: true,
nextStepTrigger?: InAppTutorialFlowStepTrigger,
shortcuts?: Array<{|
stepId: string,

View File

@@ -454,10 +454,16 @@ const InAppTutorialOrchestrator = React.forwardRef<
let nextStepIndex = stepIndex;
// Check if we can go directly to next mandatory (not-skippable) step.
while (flow[nextStepIndex].skippable && nextStepIndex < stepCount - 1) {
// Check if we can go directly to next mandatory (not-skippable) and not deprecated step.
while (nextStepIndex < stepCount - 1) {
if (
isDomBasedTriggerComplete(flow[nextStepIndex].nextStepTrigger, data)
flow[nextStepIndex] &&
(flow[nextStepIndex].deprecated ||
(flow[nextStepIndex].skippable &&
isDomBasedTriggerComplete(
flow[nextStepIndex].nextStepTrigger,
data
)))
)
nextStepIndex += 1;
else break;
@@ -646,6 +652,7 @@ const InAppTutorialOrchestrator = React.forwardRef<
[handleDomMutation]
);
// Methods to run on each step change.
React.useEffect(
() => {
if (!currentStep) return;