@coorpacademy/app-review 0.0.21-alpha.8 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/actions/courses.d.ts +0 -1
- package/es/actions/{api → data}/is-fetching.d.ts +0 -1
- package/{lib/actions/api → es/actions/data}/validate-slide.d.ts +0 -1
- package/es/actions/finished-slides.d.ts +0 -1
- package/es/actions/index.d.ts +0 -1
- package/es/actions/navigation.d.ts +0 -1
- package/es/actions/review-status.d.ts +0 -1
- package/es/actions/slides.d.ts +0 -1
- package/es/actions/step-items.d.ts +0 -1
- package/es/actions/token.d.ts +0 -1
- package/es/common/index.d.ts +1 -1
- package/es/common/index.js +1 -0
- package/es/configure-store.d.ts +2 -3
- package/es/configure-store.js +3 -9
- package/es/fixtures/qcm-slide.d.ts +2 -0
- package/es/fixtures/qcm-slide.js +29 -0
- package/es/{temp-fixture.d.ts → fixtures/temp-fixture.d.ts} +1 -2
- package/es/helpers/css-register.js +2 -0
- package/es/index.d.ts +1 -3
- package/es/index.js +43 -27
- package/es/index.test.js +52 -0
- package/es/middlewares/on-start-app.d.ts +0 -1
- package/es/middlewares/on-start-app.js +2 -0
- package/es/reducers/courses.d.ts +0 -1
- package/es/reducers/data.d.ts +7 -0
- package/es/reducers/{api.js → data.js} +15 -8
- package/es/reducers/finished-slides.d.ts +1 -2
- package/es/reducers/finished-slides.js +17 -7
- package/es/reducers/index.d.ts +9 -14
- package/es/reducers/index.js +7 -6
- package/es/reducers/navigation.d.ts +0 -1
- package/es/reducers/navigation.js +1 -1
- package/es/reducers/review-status.d.ts +0 -1
- package/es/reducers/slides.d.ts +1 -2
- package/es/reducers/slides.js +37 -25
- package/es/reducers/step-items.d.ts +1 -2
- package/es/reducers/step-items.js +19 -12
- package/es/reducers/token.d.ts +4 -7
- package/es/reducers/token.js +3 -14
- package/es/services/fetch-demo.d.ts +0 -1
- package/es/services/fetch-demo.test.d.ts +0 -1
- package/es/services/fetch-responses.d.ts +0 -1
- package/es/services/fetch.mocks.d.ts +0 -1
- package/es/types/common.d.ts +0 -1
- package/es/types/data/index.d.ts +14 -0
- package/es/types/data/index.js +1 -0
- package/es/types/dispatchers.d.ts +1 -2
- package/es/types/finished-slides.d.ts +4 -2
- package/es/types/review-status.d.ts +0 -1
- package/es/types/slides.d.ts +4 -2
- package/es/types/states.d.ts +1 -3
- package/es/types/step-items.d.ts +4 -2
- package/es/types/store-state.d.ts +10 -10
- package/es/types/utils.d.ts +0 -1
- package/es/types/views.d.ts +9 -3
- package/lib/actions/courses.d.ts +0 -1
- package/lib/actions/{api → data}/is-fetching.d.ts +0 -1
- package/{es/actions/api → lib/actions/data}/validate-slide.d.ts +0 -1
- package/lib/actions/finished-slides.d.ts +0 -1
- package/lib/actions/index.d.ts +0 -1
- package/lib/actions/navigation.d.ts +0 -1
- package/lib/actions/review-status.d.ts +0 -1
- package/lib/actions/slides.d.ts +0 -1
- package/lib/actions/step-items.d.ts +0 -1
- package/lib/actions/token.d.ts +0 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js +1 -0
- package/lib/configure-store.d.ts +2 -3
- package/lib/configure-store.js +10 -66
- package/lib/fixtures/qcm-slide.d.ts +2 -0
- package/lib/fixtures/qcm-slide.js +29 -0
- package/lib/{temp-fixture.d.ts → fixtures/temp-fixture.d.ts} +1 -2
- package/lib/helpers/css-register.d.ts +1 -0
- package/lib/helpers/css-register.js +2 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.js +52 -52
- package/lib/index.test.d.ts +1 -0
- package/lib/index.test.js +160 -0
- package/lib/middlewares/on-start-app.d.ts +0 -1
- package/lib/middlewares/on-start-app.js +2 -0
- package/lib/reducers/courses.d.ts +0 -1
- package/lib/reducers/courses.js +1 -17
- package/lib/reducers/data.d.ts +7 -0
- package/lib/reducers/{api.js → data.js} +15 -8
- package/lib/reducers/finished-slides.d.ts +1 -2
- package/lib/reducers/finished-slides.js +28 -45
- package/lib/reducers/index.d.ts +9 -14
- package/lib/reducers/index.js +7 -6
- package/lib/reducers/navigation.d.ts +0 -1
- package/lib/reducers/navigation.js +3 -19
- package/lib/reducers/review-status.d.ts +0 -1
- package/lib/reducers/slides.d.ts +1 -2
- package/lib/reducers/slides.js +58 -106
- package/lib/reducers/step-items.d.ts +1 -2
- package/lib/reducers/step-items.js +21 -52
- package/lib/reducers/token.d.ts +4 -7
- package/lib/reducers/token.js +3 -15
- package/lib/services/fetch-demo.d.ts +0 -1
- package/lib/services/fetch-demo.test.d.ts +0 -1
- package/lib/services/fetch-responses.d.ts +0 -1
- package/lib/services/fetch.mocks.d.ts +0 -1
- package/lib/types/common.d.ts +0 -1
- package/lib/types/data/index.d.ts +14 -0
- package/lib/types/data/index.js +1 -0
- package/lib/types/dispatchers.d.ts +1 -2
- package/lib/types/finished-slides.d.ts +4 -2
- package/lib/types/review-status.d.ts +0 -1
- package/lib/types/slides.d.ts +4 -2
- package/lib/types/states.d.ts +1 -3
- package/lib/types/step-items.d.ts +4 -2
- package/lib/types/store-state.d.ts +10 -10
- package/lib/types/utils.d.ts +0 -1
- package/lib/types/views.d.ts +9 -3
- package/package.json +10 -7
- package/src/common/index.ts +2 -0
- package/src/configure-store.ts +10 -20
- package/src/fixtures/qcm-slide.ts +31 -0
- package/src/{temp-fixture.ts → fixtures/temp-fixture.ts} +1 -1
- package/src/helpers/css-modules-require-hook.d.ts +4 -0
- package/src/helpers/css-register.ts +3 -0
- package/src/index.test.tsx +82 -0
- package/src/index.tsx +48 -34
- package/src/middlewares/on-start-app.ts +2 -0
- package/src/reducers/{api.ts → data.ts} +17 -14
- package/src/reducers/finished-slides.ts +22 -7
- package/src/reducers/index.ts +8 -6
- package/src/reducers/navigation.ts +1 -1
- package/src/reducers/slides.ts +38 -25
- package/src/reducers/step-items.ts +22 -12
- package/src/reducers/token.ts +5 -17
- package/src/types/data/index.ts +16 -0
- package/src/types/dispatchers.ts +1 -1
- package/src/types/finished-slides.ts +5 -2
- package/src/types/globals.d.ts +6 -0
- package/src/types/slides.ts +6 -3
- package/src/types/states.ts +1 -2
- package/src/types/step-items.ts +4 -1
- package/src/types/store-state.ts +11 -11
- package/src/types/views.tsx +9 -2
- package/es/actions/api/is-fetching.d.ts.map +0 -1
- package/es/actions/api/validate-slide.d.ts.map +0 -1
- package/es/actions/courses.d.ts.map +0 -1
- package/es/actions/finished-slides.d.ts.map +0 -1
- package/es/actions/index.d.ts.map +0 -1
- package/es/actions/navigation.d.ts.map +0 -1
- package/es/actions/review-status.d.ts.map +0 -1
- package/es/actions/slides.d.ts.map +0 -1
- package/es/actions/step-items.d.ts.map +0 -1
- package/es/actions/token.d.ts.map +0 -1
- package/es/common/index.d.ts.map +0 -1
- package/es/configure-store.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/es/middlewares/on-start-app.d.ts.map +0 -1
- package/es/reducers/api.d.ts +0 -12
- package/es/reducers/api.d.ts.map +0 -1
- package/es/reducers/courses.d.ts.map +0 -1
- package/es/reducers/finished-slides.d.ts.map +0 -1
- package/es/reducers/index.d.ts.map +0 -1
- package/es/reducers/navigation.d.ts.map +0 -1
- package/es/reducers/review-status.d.ts.map +0 -1
- package/es/reducers/slides.d.ts.map +0 -1
- package/es/reducers/step-items.d.ts.map +0 -1
- package/es/reducers/token.d.ts.map +0 -1
- package/es/services/fetch-demo.d.ts.map +0 -1
- package/es/services/fetch-demo.test.d.ts.map +0 -1
- package/es/services/fetch-responses.d.ts.map +0 -1
- package/es/services/fetch.mocks.d.ts.map +0 -1
- package/es/temp-fixture.d.ts.map +0 -1
- package/es/types/api/index.d.ts +0 -16
- package/es/types/api/index.d.ts.map +0 -1
- package/es/types/common.d.ts.map +0 -1
- package/es/types/dispatchers.d.ts.map +0 -1
- package/es/types/finished-slides.d.ts.map +0 -1
- package/es/types/review-status.d.ts.map +0 -1
- package/es/types/slides.d.ts.map +0 -1
- package/es/types/states.d.ts.map +0 -1
- package/es/types/step-items.d.ts.map +0 -1
- package/es/types/store-state.d.ts.map +0 -1
- package/es/types/utils.d.ts.map +0 -1
- package/es/types/views.d.ts.map +0 -1
- package/lib/actions/api/is-fetching.d.ts.map +0 -1
- package/lib/actions/api/validate-slide.d.ts.map +0 -1
- package/lib/actions/courses.d.ts.map +0 -1
- package/lib/actions/finished-slides.d.ts.map +0 -1
- package/lib/actions/index.d.ts.map +0 -1
- package/lib/actions/navigation.d.ts.map +0 -1
- package/lib/actions/review-status.d.ts.map +0 -1
- package/lib/actions/slides.d.ts.map +0 -1
- package/lib/actions/step-items.d.ts.map +0 -1
- package/lib/actions/token.d.ts.map +0 -1
- package/lib/common/index.d.ts.map +0 -1
- package/lib/configure-store.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/middlewares/on-start-app.d.ts.map +0 -1
- package/lib/reducers/api.d.ts +0 -12
- package/lib/reducers/api.d.ts.map +0 -1
- package/lib/reducers/courses.d.ts.map +0 -1
- package/lib/reducers/finished-slides.d.ts.map +0 -1
- package/lib/reducers/index.d.ts.map +0 -1
- package/lib/reducers/navigation.d.ts.map +0 -1
- package/lib/reducers/review-status.d.ts.map +0 -1
- package/lib/reducers/slides.d.ts.map +0 -1
- package/lib/reducers/step-items.d.ts.map +0 -1
- package/lib/reducers/token.d.ts.map +0 -1
- package/lib/services/fetch-demo.d.ts.map +0 -1
- package/lib/services/fetch-demo.test.d.ts.map +0 -1
- package/lib/services/fetch-responses.d.ts.map +0 -1
- package/lib/services/fetch.mocks.d.ts.map +0 -1
- package/lib/temp-fixture.d.ts.map +0 -1
- package/lib/types/api/index.d.ts +0 -16
- package/lib/types/api/index.d.ts.map +0 -1
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/dispatchers.d.ts.map +0 -1
- package/lib/types/finished-slides.d.ts.map +0 -1
- package/lib/types/review-status.d.ts.map +0 -1
- package/lib/types/slides.d.ts.map +0 -1
- package/lib/types/states.d.ts.map +0 -1
- package/lib/types/step-items.d.ts.map +0 -1
- package/lib/types/store-state.d.ts.map +0 -1
- package/lib/types/utils.d.ts.map +0 -1
- package/lib/types/views.d.ts.map +0 -1
- package/src/types/api/index.ts +0 -16
- /package/es/actions/{api → data}/is-fetching.js +0 -0
- /package/es/actions/{api → data}/validate-slide.js +0 -0
- /package/es/{temp-fixture.js → fixtures/temp-fixture.js} +0 -0
- /package/es/{types/api/index.js → helpers/css-register.d.ts} +0 -0
- /package/{lib/types/api/index.js → es/index.test.d.ts} +0 -0
- /package/lib/actions/{api → data}/is-fetching.js +0 -0
- /package/lib/actions/{api → data}/validate-slide.js +0 -0
- /package/lib/{temp-fixture.js → fixtures/temp-fixture.js} +0 -0
- /package/src/actions/{api → data}/is-fetching.ts +0 -0
- /package/src/actions/{api → data}/validate-slide.ts +0 -0
package/es/reducers/slides.js
CHANGED
|
@@ -1,82 +1,94 @@
|
|
|
1
|
+
import map from 'lodash/fp/map';
|
|
1
2
|
import { STORE_FIRST_SLIDE, UPDATE_SLIDES_ON_NEXT, UPDATE_SLIDES_ON_VALIDATION } from '../actions/slides';
|
|
2
|
-
import { HIGHEST_INDEX, TOTAL_SLIDES_STACK } from '../common';
|
|
3
|
+
import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '../common';
|
|
3
4
|
const getInitialState = () => {
|
|
4
|
-
const state =
|
|
5
|
+
const state = {
|
|
6
|
+
slideNumbers
|
|
7
|
+
};
|
|
5
8
|
// eslint-disable-next-line fp/no-loops
|
|
6
9
|
for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
|
|
7
|
-
state
|
|
10
|
+
state[index] = { hidden: false, position: index };
|
|
8
11
|
}
|
|
9
12
|
return state;
|
|
10
13
|
};
|
|
11
14
|
export const initialState = getInitialState();
|
|
12
15
|
// -----------------------------------------------------------------------------
|
|
13
16
|
const setFirstSlide = (state, slide) => {
|
|
14
|
-
const _state =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const _state = {
|
|
18
|
+
slideNumbers
|
|
19
|
+
};
|
|
20
|
+
// eslint-disable-next-line lodash-fp/no-unused-result
|
|
21
|
+
map(index => {
|
|
22
|
+
const previousValue = state[index];
|
|
17
23
|
// Only update the 1st one
|
|
18
24
|
const content = index === 0 ? { ...previousValue, ...slide } : { ...previousValue };
|
|
19
|
-
_state
|
|
20
|
-
}
|
|
25
|
+
_state[index] = { ...content };
|
|
26
|
+
}, state.slideNumbers);
|
|
21
27
|
return _state;
|
|
22
28
|
};
|
|
23
29
|
// ||-------> Handles the updates of a given slide on validation,
|
|
24
30
|
// & then updates de remaining slides if this given change should impact their content
|
|
25
31
|
const stateUpdateOnValidation = (state, payload) => {
|
|
26
32
|
const { slideNumber, newSlideContent, numberOfFinishedSlides, nextSlide } = payload;
|
|
27
|
-
const _state =
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
const _state = {
|
|
34
|
+
slideNumbers
|
|
35
|
+
};
|
|
36
|
+
// eslint-disable-next-line lodash-fp/no-unused-result
|
|
37
|
+
map(index => {
|
|
38
|
+
const previousValue = state[index];
|
|
30
39
|
// the current slide
|
|
31
40
|
if (index === slideNumber) {
|
|
32
41
|
// only one slide remaining, presets the next value
|
|
33
42
|
if (numberOfFinishedSlides === HIGHEST_INDEX) {
|
|
34
|
-
_state
|
|
43
|
+
_state[index] = {
|
|
35
44
|
...previousValue,
|
|
36
45
|
nextSlide,
|
|
37
46
|
position: newSlideContent.position,
|
|
38
47
|
validationResult: newSlideContent.validationResult
|
|
39
|
-
}
|
|
48
|
+
};
|
|
40
49
|
}
|
|
41
50
|
else
|
|
42
|
-
_state
|
|
51
|
+
_state[slideNumber] = { ...previousValue, ...newSlideContent };
|
|
43
52
|
}
|
|
44
53
|
else {
|
|
45
54
|
// updates the rest of the slides here
|
|
46
55
|
const { hidden, position } = previousValue;
|
|
47
|
-
_state
|
|
56
|
+
_state[index] = { ...nextSlide, endReview: newSlideContent.endReview, hidden, position };
|
|
48
57
|
}
|
|
49
|
-
}
|
|
58
|
+
}, state.slideNumbers);
|
|
50
59
|
return _state;
|
|
51
60
|
};
|
|
52
61
|
// ||-------> Handles the updates of a given slide on correction popin's next click,
|
|
53
62
|
// & then updates de remaining slides (updates position to trigger animations)
|
|
54
63
|
const stateUpdateOnNext = (state, payload) => {
|
|
55
64
|
const { slideNumber, newSlideContent, numberOfFinishedSlides } = payload;
|
|
56
|
-
const _state =
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
const _state = {
|
|
66
|
+
slideNumbers
|
|
67
|
+
};
|
|
68
|
+
// eslint-disable-next-line lodash-fp/no-unused-result
|
|
69
|
+
map(index => {
|
|
70
|
+
const previousValue = state[index];
|
|
59
71
|
// the current slide
|
|
60
72
|
if (index === slideNumber) {
|
|
61
73
|
// when there is only one slide remaining, updates the slide value
|
|
62
|
-
if (numberOfFinishedSlides === HIGHEST_INDEX) {
|
|
63
|
-
_state
|
|
74
|
+
if (numberOfFinishedSlides === HIGHEST_INDEX && previousValue.nextSlide) {
|
|
75
|
+
_state[index] = { ...previousValue.nextSlide, position: previousValue.position };
|
|
64
76
|
}
|
|
65
77
|
else
|
|
66
|
-
_state
|
|
78
|
+
_state[slideNumber] = newSlideContent;
|
|
67
79
|
}
|
|
68
80
|
else {
|
|
69
81
|
// updates the rest of the slides here
|
|
70
82
|
const { hidden, position, answerUI, questionText } = previousValue;
|
|
71
|
-
_state
|
|
83
|
+
_state[index] = {
|
|
72
84
|
hidden,
|
|
73
85
|
position: position - 1,
|
|
74
86
|
answerUI,
|
|
75
87
|
questionText,
|
|
76
88
|
endReview: newSlideContent.endReview
|
|
77
|
-
}
|
|
89
|
+
};
|
|
78
90
|
}
|
|
79
|
-
}
|
|
91
|
+
}, state.slideNumbers);
|
|
80
92
|
return _state;
|
|
81
93
|
};
|
|
82
94
|
// -----------------------------------------------------------------------------
|
|
@@ -2,6 +2,5 @@ import { StepItemsAction } from '../actions/step-items';
|
|
|
2
2
|
import { StepItems } from '../types/step-items';
|
|
3
3
|
export declare type State = StepItems;
|
|
4
4
|
export declare const initialState: State;
|
|
5
|
-
declare const reducer: (state:
|
|
5
|
+
declare const reducer: (state: State, action: StepItemsAction) => State;
|
|
6
6
|
export default reducer;
|
|
7
|
-
//# sourceMappingURL=step-items.d.ts.map
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import isNil from 'lodash/fp/isNil';
|
|
2
2
|
import get from 'lodash/fp/get';
|
|
3
|
+
import has from 'lodash/fp/has';
|
|
4
|
+
import map from 'lodash/fp/map';
|
|
3
5
|
import { UPDATE_STEP_ITEMS_ON_NEXT, UPDATE_STEP_ITEMS_ON_VALIDATION } from '../actions/step-items';
|
|
4
|
-
import { HIGHEST_INDEX, TOTAL_SLIDES_STACK } from '../common';
|
|
6
|
+
import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '../common';
|
|
5
7
|
const getInitialState = () => {
|
|
6
|
-
const state =
|
|
8
|
+
const state = {
|
|
9
|
+
slideNumbers
|
|
10
|
+
};
|
|
7
11
|
// eslint-disable-next-line fp/no-loops
|
|
8
12
|
for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
|
|
9
13
|
const current = index === 0;
|
|
10
|
-
state
|
|
14
|
+
state[index] = { current, value: `${index + 1}`, icon: null };
|
|
11
15
|
}
|
|
12
16
|
return state;
|
|
13
17
|
};
|
|
@@ -25,26 +29,29 @@ const calculateNextStepIndex = (currentStepNumber, finishedSlides, lastVisitedIn
|
|
|
25
29
|
}
|
|
26
30
|
const indexToVisit = getNextIndex(isNil(lastVisitedIndex) ? currentStepNumber : lastVisitedIndex);
|
|
27
31
|
// if the index is already included in the correctly answered (finished) slides, then we proceed to check for the next one
|
|
28
|
-
return
|
|
32
|
+
return has(indexToVisit, finishedSlides)
|
|
29
33
|
? calculateNextStepIndex(currentStepNumber, finishedSlides, indexToVisit)
|
|
30
34
|
: indexToVisit;
|
|
31
35
|
};
|
|
32
36
|
const recalculateStepItemsState = (state, stepNumber, stepItemToUpdateProps) => {
|
|
33
37
|
const nextIndex = get('nextIndex', stepItemToUpdateProps);
|
|
34
|
-
const _state =
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
const _state = {
|
|
39
|
+
slideNumbers
|
|
40
|
+
};
|
|
41
|
+
// eslint-disable-next-line lodash-fp/no-unused-result
|
|
42
|
+
map(index => {
|
|
43
|
+
const previousValue = state[index];
|
|
37
44
|
if (stepNumber === index)
|
|
38
|
-
_state
|
|
45
|
+
_state[stepNumber] = {
|
|
39
46
|
...previousValue,
|
|
40
47
|
...stepItemToUpdateProps
|
|
41
|
-
}
|
|
48
|
+
};
|
|
42
49
|
/* only for UPDATE_STEP_ITEMS_ON_NEXT -> */ else if (nextIndex === index) {
|
|
43
|
-
_state
|
|
50
|
+
_state[index] = { ...previousValue, current: true };
|
|
44
51
|
}
|
|
45
52
|
else
|
|
46
|
-
_state
|
|
47
|
-
}
|
|
53
|
+
_state[index] = previousValue;
|
|
54
|
+
}, state.slideNumbers);
|
|
48
55
|
return _state;
|
|
49
56
|
};
|
|
50
57
|
// -----------------------------------------------------------------------------
|
package/es/reducers/token.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { StoreToken } from '../actions/token';
|
|
2
1
|
import { StoreState } from '../types/store-state';
|
|
3
|
-
import {
|
|
4
|
-
export declare const initialState:
|
|
5
|
-
declare const
|
|
6
|
-
export declare const getToken: (appState: StoreState) => StoreState['token'];
|
|
7
|
-
export default reducer;
|
|
8
|
-
//# sourceMappingURL=token.d.ts.map
|
|
2
|
+
import { DataState } from '../types/data';
|
|
3
|
+
export declare const initialState: DataState['token'];
|
|
4
|
+
export declare const setToken: (token: string, state: DataState) => DataState;
|
|
5
|
+
export declare const getToken: (appState: StoreState) => StoreState['data']['token'];
|
package/es/reducers/token.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import set from 'lodash/fp/set';
|
|
2
2
|
// -----------------------------------------------------------------------------
|
|
3
|
-
// export type State = string;
|
|
4
3
|
export const initialState = null;
|
|
5
4
|
// -----------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
const reducer = (state = initialState, action) => {
|
|
8
|
-
switch (action.type) {
|
|
9
|
-
case STORE_TOKEN: {
|
|
10
|
-
return action.payload;
|
|
11
|
-
}
|
|
12
|
-
default:
|
|
13
|
-
return state;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
5
|
+
export const setToken = (token, state) => set('token', token, state);
|
|
16
6
|
// -----------------------------------------------------------------------------
|
|
17
|
-
export const getToken = (appState) => appState.token;
|
|
7
|
+
export const getToken = (appState) => appState.data.token;
|
|
18
8
|
// -----------------------------------------------------------------------------
|
|
19
|
-
export default reducer;
|
|
@@ -17,4 +17,3 @@ export declare class ResponseError extends Error {
|
|
|
17
17
|
export declare const toJSON: (response: _Response) => Promise<unknown>;
|
|
18
18
|
export declare const toText: (response: _Response) => Promise<string>;
|
|
19
19
|
export declare const toVoid: (response: _Response) => Promise<void>;
|
|
20
|
-
//# sourceMappingURL=fetch-responses.d.ts.map
|
|
@@ -7,4 +7,3 @@ export declare const notFoundJSONResponse: (body: unknown) => FetchFunction;
|
|
|
7
7
|
export declare const okTextResponse: (body: string) => FetchFunction;
|
|
8
8
|
export declare const internalServerErrorTextResponse: (body: string) => FetchFunction;
|
|
9
9
|
export {};
|
|
10
|
-
//# sourceMappingURL=fetch.mocks.d.ts.map
|
package/es/types/common.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnswerUI } from '../slides';
|
|
2
|
+
export declare type DataState = {
|
|
3
|
+
isFetching?: boolean;
|
|
4
|
+
slideValidationResult?: {
|
|
5
|
+
slideNumber: number;
|
|
6
|
+
result: 'success' | 'failure';
|
|
7
|
+
exitNode?: 'successExitNode' | 'failExitNode';
|
|
8
|
+
nextSlide: {
|
|
9
|
+
questionText?: string;
|
|
10
|
+
answerUI?: AnswerUI;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
token?: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateSlide } from '../actions/
|
|
1
|
+
import { validateSlide } from '../actions/data/validate-slide';
|
|
2
2
|
import { updateFinishedSlides } from '../actions/finished-slides';
|
|
3
3
|
import { navigateBack, navigateTo } from '../actions/navigation';
|
|
4
4
|
import { updateReviewStatus } from '../actions/review-status';
|
|
@@ -15,4 +15,3 @@ export declare type Dispatchers = {
|
|
|
15
15
|
updateStepItemsOnNext: typeof updateStepItemsOnNext;
|
|
16
16
|
updateFinishedSlides: typeof updateFinishedSlides;
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=dispatchers.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SlideNumber } from './slides';
|
|
2
|
-
export declare type FinishedSlides =
|
|
2
|
+
export declare type FinishedSlides = {
|
|
3
|
+
slideNumbers: SlideNumber[];
|
|
4
|
+
[key: SlideNumber]: true;
|
|
5
|
+
};
|
|
3
6
|
export declare type UpdateFinishedSlidesPayload = {
|
|
4
7
|
slideNumber: SlideNumber;
|
|
5
8
|
value: true;
|
|
6
9
|
};
|
|
7
|
-
//# sourceMappingURL=finished-slides.d.ts.map
|
package/es/types/slides.d.ts
CHANGED
|
@@ -74,7 +74,10 @@ export declare type Slide = {
|
|
|
74
74
|
answerUI?: AnswerUI;
|
|
75
75
|
nextSlide?: Omit<Slide, 'endReview' | 'hidden' | 'position' | 'nextSlide'>;
|
|
76
76
|
};
|
|
77
|
-
export declare type Slides =
|
|
77
|
+
export declare type Slides = {
|
|
78
|
+
slideNumbers: SlideNumber[];
|
|
79
|
+
[key: SlideNumber]: Slide;
|
|
80
|
+
};
|
|
78
81
|
export declare type UpdateSlidesOnValidationPayload = {
|
|
79
82
|
slideNumber: SlideNumber;
|
|
80
83
|
newSlideContent: Slide;
|
|
@@ -82,4 +85,3 @@ export declare type UpdateSlidesOnValidationPayload = {
|
|
|
82
85
|
nextSlide: WithRequired<Slide['nextSlide'], 'answerUI' | 'questionText'>;
|
|
83
86
|
};
|
|
84
87
|
export declare type UpdateSlidesOnNextPayload = Omit<UpdateSlidesOnValidationPayload, 'nextSlide'>;
|
|
85
|
-
//# sourceMappingURL=slides.d.ts.map
|
package/es/types/states.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export { Slides as SlidesState } from './slides';
|
|
2
|
-
export {
|
|
2
|
+
export { DataState } from './data';
|
|
3
3
|
export { StepItems as StepItemsState } from './step-items';
|
|
4
4
|
export { FinishedSlides as FinishedSlidesState } from './finished-slides';
|
|
5
5
|
export { State as ReviewStatusState } from '../reducers/review-status';
|
|
6
|
-
export declare type TokenState = string;
|
|
7
6
|
export declare type NavigationState = Array<'home' | 'onboarding' | 'slides'>;
|
|
8
|
-
//# sourceMappingURL=states.d.ts.map
|
package/es/types/step-items.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ export declare type StepItem = {
|
|
|
10
10
|
icon: IconValue;
|
|
11
11
|
value: string;
|
|
12
12
|
};
|
|
13
|
-
export declare type StepItems =
|
|
13
|
+
export declare type StepItems = {
|
|
14
|
+
slideNumbers: SlideNumber[];
|
|
15
|
+
[key: SlideNumber]: StepItem;
|
|
16
|
+
};
|
|
14
17
|
export declare type UpdateStepItemsOnValidationClickPayload = {
|
|
15
18
|
stepNumber: SlideNumber;
|
|
16
19
|
icon: IconValue;
|
|
@@ -21,4 +24,3 @@ export declare type UpdateStepItemsOnNextClickPayload = {
|
|
|
21
24
|
current: boolean;
|
|
22
25
|
};
|
|
23
26
|
export {};
|
|
24
|
-
//# sourceMappingURL=step-items.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataState, FinishedSlidesState, NavigationState, ReviewStatusState, SlidesState, StepItemsState } from './states';
|
|
2
2
|
export declare type StoreState = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
ui: {
|
|
4
|
+
courses: unknown;
|
|
5
|
+
navigation: NavigationState;
|
|
6
|
+
slides: SlidesState;
|
|
7
|
+
stepItems: StepItemsState;
|
|
8
|
+
finishedSlides: FinishedSlidesState;
|
|
9
|
+
reviewStatus: ReviewStatusState;
|
|
10
|
+
};
|
|
11
|
+
data: DataState;
|
|
11
12
|
};
|
|
12
|
-
//# sourceMappingURL=store-state.d.ts.map
|
package/es/types/utils.d.ts
CHANGED
package/es/types/views.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { State as ReviewStatus } from '../reducers/review-status';
|
|
2
|
-
import {
|
|
2
|
+
import { DataState } from './data';
|
|
3
3
|
import { Dispatchers } from './dispatchers';
|
|
4
4
|
import { FinishedSlides } from './finished-slides';
|
|
5
5
|
import { Slides } from './slides';
|
|
6
6
|
import { StepItems } from './step-items';
|
|
7
7
|
declare type SlidesViewStaticProps = {
|
|
8
8
|
slides: Slides;
|
|
9
|
+
headerProps: {
|
|
10
|
+
mode: string;
|
|
11
|
+
skillName: string;
|
|
12
|
+
onQuitClick: Function;
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
closeButtonAriaLabel: string;
|
|
15
|
+
};
|
|
9
16
|
finishedSlides: FinishedSlides;
|
|
10
17
|
stepItems: StepItems;
|
|
11
18
|
reviewStatus: ReviewStatus;
|
|
@@ -50,9 +57,8 @@ declare type SlidesViewStaticProps = {
|
|
|
50
57
|
failureLabel: string;
|
|
51
58
|
};
|
|
52
59
|
reviewBackgroundAriaLabel?: string;
|
|
53
|
-
slideValidationResult:
|
|
60
|
+
slideValidationResult: DataState['slideValidationResult'];
|
|
54
61
|
};
|
|
55
62
|
declare type SlidesViewDispatcherProps = Omit<Dispatchers, 'navigateTo' | 'navigateBack'>;
|
|
56
63
|
declare type SlidesViewProps = SlidesViewStaticProps & SlidesViewDispatcherProps;
|
|
57
64
|
export { SlidesViewStaticProps, SlidesViewDispatcherProps, SlidesViewProps };
|
|
58
|
-
//# sourceMappingURL=views.d.ts.map
|
package/lib/actions/courses.d.ts
CHANGED
package/lib/actions/index.d.ts
CHANGED
|
@@ -3,4 +3,3 @@ import { NavigateBack, NavigateTo, StartApp } from './navigation';
|
|
|
3
3
|
import { StoreToken } from './token';
|
|
4
4
|
import { StoreFirstSlide } from './slides';
|
|
5
5
|
export declare type Action = NavigateBack | NavigateTo | ReceivedCourse | StartApp | StoreFirstSlide | StoreToken;
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -17,4 +17,3 @@ export declare type StartApp = {
|
|
|
17
17
|
export declare const navigateTo: (newPath: ViewPath) => NavigateTo;
|
|
18
18
|
export declare const navigateBack: () => NavigateBack;
|
|
19
19
|
export declare const startApp: (options: AppOptions) => StartApp;
|
|
20
|
-
//# sourceMappingURL=navigation.d.ts.map
|
package/lib/actions/slides.d.ts
CHANGED
|
@@ -18,4 +18,3 @@ export declare type SlidesAction = StoreFirstSlide | UpdateSlidesOnValidation |
|
|
|
18
18
|
export declare const storeFirstSlide: (slide: Slide) => StoreFirstSlide;
|
|
19
19
|
export declare const updateSlidesOnValidation: (payload: UpdateSlidesOnValidationPayload) => UpdateSlidesOnValidation;
|
|
20
20
|
export declare const updateSlidesOnNext: (payload: UpdateSlidesOnNextPayload) => UpdateSlidesOnNext;
|
|
21
|
-
//# sourceMappingURL=slides.d.ts.map
|
|
@@ -12,4 +12,3 @@ export declare type UpdateStepItemsOnNext = {
|
|
|
12
12
|
export declare type StepItemsAction = UpdateStepItemsOnValidation | UpdateStepItemsOnNext;
|
|
13
13
|
export declare const updateStepItemsOnValidation: (payload: UpdateStepItemsOnValidationClickPayload) => UpdateStepItemsOnValidation;
|
|
14
14
|
export declare const updateStepItemsOnNext: (payload: UpdateStepItemsOnNextClickPayload) => UpdateStepItemsOnNext;
|
|
15
|
-
//# sourceMappingURL=step-items.d.ts.map
|
package/lib/actions/token.d.ts
CHANGED
package/lib/common/index.d.ts
CHANGED
package/lib/common/index.js
CHANGED
package/lib/configure-store.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AnyAction, EmptyObject, Store } from 'redux';
|
|
2
2
|
import { StoreState } from './types/store-state';
|
|
3
|
-
export default function configureStore():
|
|
3
|
+
export default function configureStore(): Store<EmptyObject & StoreState, AnyAction> & {
|
|
4
4
|
dispatch: {};
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=configure-store.d.ts.map
|
|
5
|
+
};
|
package/lib/configure-store.js
CHANGED
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (_) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
1
|
import { applyMiddleware, compose, createStore } from 'redux';
|
|
38
2
|
import thunk from 'redux-thunk';
|
|
39
3
|
import rootReducer from './reducers';
|
|
@@ -41,34 +5,14 @@ import onStartApp from './middlewares/on-start-app';
|
|
|
41
5
|
var preloadedState = undefined;
|
|
42
6
|
// -----------------------------------------------------------------------------
|
|
43
7
|
export default function configureStore() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
case 1: // eslint-disable-next-line node/no-unsupported-features/es-syntax, import/dynamic-import-chunkname
|
|
55
|
-
return [4 /*yield*/, import('redux-devtools-extension')];
|
|
56
|
-
case 2:
|
|
57
|
-
_a = _b.sent();
|
|
58
|
-
_b.label = 3;
|
|
59
|
-
case 3:
|
|
60
|
-
composeWithDevTools = (_a).composeWithDevTools;
|
|
61
|
-
_compose = !isProd && isExtensionEnabled
|
|
62
|
-
? composeWithDevTools({
|
|
63
|
-
name: 'app-review',
|
|
64
|
-
trace: true,
|
|
65
|
-
traceLimit: 25
|
|
66
|
-
})
|
|
67
|
-
: compose;
|
|
68
|
-
enhancer = _compose(applyMiddleware(thunk, onStartApp));
|
|
69
|
-
store = createStore(rootReducer, preloadedState, enhancer);
|
|
70
|
-
return [2 /*return*/, store];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
8
|
+
var _compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
9
|
+
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
|
10
|
+
name: 'app-review',
|
|
11
|
+
trace: true,
|
|
12
|
+
traceLimit: 25
|
|
13
|
+
})
|
|
14
|
+
: compose;
|
|
15
|
+
var enhancer = _compose(applyMiddleware(thunk, onStartApp));
|
|
16
|
+
var store = createStore(rootReducer, preloadedState, enhancer);
|
|
17
|
+
return store;
|
|
74
18
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export var slide = {
|
|
2
|
+
questionText: 'QCM',
|
|
3
|
+
answerUI: {
|
|
4
|
+
help: '__help',
|
|
5
|
+
model: {
|
|
6
|
+
type: 'qcm',
|
|
7
|
+
choices: [
|
|
8
|
+
{
|
|
9
|
+
selected: false,
|
|
10
|
+
title: 'choix1',
|
|
11
|
+
help: '(help choix1)',
|
|
12
|
+
ariaLabel: '__ariaLabel1'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
selected: false,
|
|
16
|
+
title: 'choix2',
|
|
17
|
+
help: '(help choix2)',
|
|
18
|
+
ariaLabel: '__ariaLabel2'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
selected: false,
|
|
22
|
+
title: 'choix3',
|
|
23
|
+
help: '(help choix3)',
|
|
24
|
+
ariaLabel: '__ariaLabel3'
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SlidesViewProps } from '
|
|
1
|
+
import { SlidesViewProps } from '../types/views';
|
|
2
2
|
export declare const correctionPopinProps: SlidesViewProps['correctionPopinProps'];
|
|
3
3
|
export declare const congratsProps: SlidesViewProps['congratsProps'];
|
|
4
|
-
//# sourceMappingURL=temp-fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|