11"use strict" ;
22var _types_1 = require ( './_types' ) ;
33var alert_1 = require ( './alert' ) ;
4+ var test_1 = require ( './test' ) ;
45function progressPagePositionLoad ( ) {
56 return function ( dispatch , getState ) {
67 var progress = getState ( ) . progress ;
@@ -13,29 +14,37 @@ function progressLoad() {
1314 var tutorial = getState ( ) . tutorial ;
1415 dispatch ( { type : _types_1 . PROGRESS_LOAD , payload : { tutorial : tutorial } } ) ;
1516 dispatch ( progressPagePositionLoad ( ) ) ;
17+ dispatch ( test_1 . testRun ( ) ) ;
1618 } ;
1719}
1820exports . progressLoad = progressLoad ;
19- function completePage ( ) {
21+ function completePage ( completed ) {
22+ if ( completed === void 0 ) { completed = true ; }
2023 return function ( dispatch , getState ) {
2124 var _a = getState ( ) , pagePosition = _a . pagePosition , progress = _a . progress , tutorial = _a . tutorial ;
22- dispatch ( { type : _types_1 . COMPLETE_PAGE , payload : { pagePosition : pagePosition , tutorial : tutorial } } ) ;
23- if ( progress . pages . every ( function ( x ) { return x . completed ; } ) ) {
24- dispatch ( completeTutorial ( ) ) ;
25+ dispatch ( { type : _types_1 . COMPLETE_PAGE , payload : { pagePosition : pagePosition , tutorial : tutorial , completed : completed } } ) ;
26+ if ( completed ) {
27+ if ( progress . pages . every ( function ( x ) { return x . completed ; } ) ) {
28+ dispatch ( completeTutorial ( ) ) ;
29+ }
30+ else {
31+ dispatch ( alert_1 . alertToggle ( {
32+ message : "Page " + ( pagePosition + 1 ) + " Complete" ,
33+ action : 'pass' ,
34+ } ) ) ;
35+ }
2536 }
26- else {
27- dispatch ( alert_1 . alertToggle ( {
28- message : "Page " + ( pagePosition + 1 ) + " Complete" ,
29- action : 'pass' ,
30- } ) ) ;
37+ else if ( progress . completed ) {
38+ dispatch ( completeTutorial ( false ) ) ;
3139 }
3240 } ;
3341}
3442exports . completePage = completePage ;
35- function completeTutorial ( ) {
43+ function completeTutorial ( completed ) {
44+ if ( completed === void 0 ) { completed = true ; }
3645 return function ( dispatch , getState ) {
3746 var tutorial = getState ( ) . tutorial ;
38- dispatch ( { type : _types_1 . COMPLETE_TUTORIAL , payload : { tutorial : tutorial } } ) ;
47+ dispatch ( { type : _types_1 . COMPLETE_TUTORIAL , payload : { tutorial : tutorial , completed : completed } } ) ;
3948 dispatch ( alert_1 . alertToggle ( {
4049 message : 'Tutorial Complete' ,
4150 action : 'pass' ,
0 commit comments