open-vault/ui/app/machines/tutorial-machine.js
madalynrose 7f430bba8f
UI: onboarding wizard progress bar (#5516)
Onboarding will now display your progress through the chosen tutorials
2018-10-18 15:19:50 -04:00

113 lines
3.4 KiB
JavaScript

export default {
key: 'tutorial',
initial: 'idle',
on: {
DISMISS: 'dismissed',
DONE: 'complete',
PAUSE: 'paused',
},
states: {
init: {
key: 'init',
initial: 'idle',
on: { INITDONE: 'active.select' },
onEntry: [
'showTutorialAlways',
{ type: 'render', level: 'tutorial', component: 'wizard/tutorial-idle' },
{ type: 'render', level: 'feature', component: null },
],
onExit: ['showTutorialWhenAuthenticated', 'clearFeatureData'],
states: {
idle: {
on: {
START: 'active.setup',
SAVE: 'active.save',
UNSEAL: 'active.unseal',
LOGIN: 'active.login',
},
},
active: {
onEntry: { type: 'render', level: 'tutorial', component: 'wizard/tutorial-active' },
states: {
setup: {
on: { TOSAVE: 'save' },
onEntry: { type: 'render', level: 'feature', component: 'wizard/init-setup' },
},
save: {
on: {
TOUNSEAL: 'unseal',
TOLOGIN: 'login',
},
onEntry: { type: 'render', level: 'feature', component: 'wizard/init-save-keys' },
},
unseal: {
on: { TOLOGIN: 'login' },
onEntry: { type: 'render', level: 'feature', component: 'wizard/init-unseal' },
},
login: {
onEntry: { type: 'render', level: 'feature', component: 'wizard/init-login' },
},
},
},
},
},
active: {
key: 'feature',
initial: 'select',
onEntry: { type: 'render', level: 'tutorial', component: 'wizard/tutorial-active' },
states: {
select: {
on: {
CONTINUE: 'feature',
},
onEntry: { type: 'render', level: 'feature', component: 'wizard/features-selection' },
},
feature: {},
},
},
idle: {
on: {
INIT: 'init.idle',
AUTH: 'active.select',
CONTINUE: 'active',
},
onEntry: [
{ type: 'render', level: 'feature', component: null },
{ type: 'render', level: 'step', component: null },
{ type: 'render', level: 'detail', component: null },
{ type: 'render', level: 'tutorial', component: 'wizard/tutorial-idle' },
],
},
dismissed: {
onEntry: [
{ type: 'render', level: 'tutorial', component: null },
{ type: 'render', level: 'feature', component: null },
{ type: 'render', level: 'step', component: null },
{ type: 'render', level: 'detail', component: null },
'handleDismissed',
],
},
paused: {
on: {
CONTINUE: 'active.feature',
},
onEntry: [
{ type: 'render', level: 'feature', component: null },
{ type: 'render', level: 'step', component: null },
{ type: 'render', level: 'detail', component: null },
{ type: 'render', level: 'tutorial', component: 'wizard/tutorial-paused' },
'handlePaused',
],
onExit: ['handleResume'],
},
complete: {
onEntry: [
{ type: 'render', level: 'feature', component: null },
{ type: 'render', level: 'step', component: null },
{ type: 'render', level: 'detail', component: null },
{ type: 'render', level: 'tutorial', component: 'wizard/tutorial-complete' },
],
},
},
};