2021-01-21 12:20:06 +03:00
|
|
|
import Controller from '@ember/controller';
|
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
2021-01-28 17:25:05 +03:00
|
|
|
import {tracked} from '@glimmer/tracking';
|
2021-01-21 12:20:06 +03:00
|
|
|
|
|
|
|
export default class LaunchController extends Controller {
|
2021-01-28 17:25:05 +03:00
|
|
|
@service config;
|
2021-01-21 12:20:06 +03:00
|
|
|
@service router;
|
2021-01-28 17:25:05 +03:00
|
|
|
@service settings;
|
|
|
|
|
|
|
|
queryParams = ['step'];
|
|
|
|
|
|
|
|
@tracked previewGuid = (new Date()).valueOf();
|
|
|
|
@tracked previewSrc = '';
|
|
|
|
|
|
|
|
steps = {
|
|
|
|
'customise-design': {
|
|
|
|
title: 'Customise your site',
|
|
|
|
position: 'Step 1',
|
|
|
|
next: 'connect-stripe'
|
|
|
|
},
|
|
|
|
'connect-stripe': {
|
|
|
|
title: 'Connect to Stripe',
|
|
|
|
position: 'Step 2',
|
|
|
|
next: 'set-pricing',
|
|
|
|
back: 'customise-design',
|
|
|
|
skip: 'finalise'
|
|
|
|
},
|
|
|
|
'set-pricing': {
|
|
|
|
title: 'Set up subscriptions',
|
|
|
|
position: 'Step 3',
|
|
|
|
next: 'finalise',
|
|
|
|
back: 'connect-stripe'
|
|
|
|
},
|
|
|
|
finalise: {
|
|
|
|
title: 'Launch your site',
|
|
|
|
position: 'Final step',
|
|
|
|
back: 'set-pricing'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@tracked step = 'customise-design';
|
|
|
|
|
|
|
|
get currentStep() {
|
|
|
|
return this.steps[this.step];
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
goToStep(step) {
|
|
|
|
if (step) {
|
|
|
|
this.step = step;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
nextStep() {
|
|
|
|
this.step = this.currentStep.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
backStep() {
|
|
|
|
this.step = this.currentStep.back;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: remember when a step is skipped so "back" works as expected
|
|
|
|
@action
|
|
|
|
skipStep() {
|
|
|
|
this.step = this.currentStep.skip;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
refreshPreview() {
|
|
|
|
this.previewGuid = (new Date()).valueOf();
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
updatePreview(url) {
|
|
|
|
this.previewSrc = url;
|
|
|
|
}
|
2021-01-21 12:20:06 +03:00
|
|
|
|
|
|
|
@action
|
|
|
|
close() {
|
|
|
|
this.router.transitionTo('dashboard');
|
|
|
|
}
|
2021-01-28 17:25:05 +03:00
|
|
|
|
|
|
|
@action
|
|
|
|
reset() {
|
|
|
|
this.step = 'customise-design';
|
|
|
|
}
|
2021-01-21 12:20:06 +03:00
|
|
|
}
|