@coorpacademy/app-review 0.1.3 → 0.1.4
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/data/skills.d.ts +13 -0
- package/es/actions/data/skills.js +10 -0
- package/es/actions/data/slides.d.ts +54 -0
- package/es/actions/{slides.js → data/slides.js} +5 -0
- package/es/actions/index.d.ts +19 -5
- package/es/actions/ui/finished-slides.d.ts +10 -0
- package/es/actions/{finished-slides.js → ui/finished-slides.js} +1 -0
- package/es/actions/ui/is-fetching.d.ts +10 -0
- package/es/actions/ui/is-fetching.js +6 -0
- package/{lib/actions → es/actions/ui}/navigation.d.ts +2 -2
- package/es/actions/ui/review-status.d.ts +7 -0
- package/{lib/actions → es/actions/ui}/step-items.d.ts +17 -1
- package/es/actions/{step-items.js → ui/step-items.js} +5 -0
- package/es/common/index.d.ts +1 -1
- package/es/common/index.js +1 -1
- package/es/configure-store.d.ts +34 -4
- package/es/configure-store.js +1 -2
- package/es/fixtures/qcm-slide.js +7 -3
- package/es/fixtures/temp-fixture.d.ts +1 -1
- package/es/index.js +54 -36
- package/es/index.test.js +1 -1
- package/es/middlewares/on-start-app.d.ts +2 -3
- package/es/middlewares/on-start-app.js +18 -17
- package/es/reducers/data/index.d.ts +7 -0
- package/es/reducers/data/index.js +11 -0
- package/es/reducers/data/progression.d.ts +14 -0
- package/es/reducers/data/progression.js +78 -0
- package/es/reducers/data/skills.d.ts +6 -0
- package/es/reducers/{courses.js → data/skills.js} +3 -4
- package/es/reducers/data/slides.d.ts +8 -0
- package/es/reducers/{slides.js → data/slides.js} +4 -3
- package/es/reducers/data/token.d.ts +5 -0
- package/es/reducers/data/token.js +15 -0
- package/es/reducers/index.d.ts +11 -8
- package/es/reducers/index.js +3 -16
- package/es/reducers/ui/finished-slides.d.ts +8 -0
- package/es/reducers/{finished-slides.js → ui/finished-slides.js} +9 -6
- package/es/reducers/ui/index.d.ts +7 -0
- package/es/reducers/ui/index.js +11 -0
- package/es/reducers/ui/navigation.d.ts +5 -0
- package/es/reducers/{navigation.js → ui/navigation.js} +4 -7
- package/es/reducers/ui/review-status.d.ts +5 -0
- package/es/reducers/{review-status.js → ui/review-status.js} +3 -2
- package/es/reducers/ui/step-items.d.ts +14 -0
- package/es/reducers/{step-items.js → ui/step-items.js} +7 -7
- package/es/services/fetch-skills.d.ts +8 -0
- package/es/services/fetch-skills.js +23 -0
- package/es/services/fetch-skills.mock.d.ts +3 -0
- package/es/services/fetch-skills.mock.js +17 -0
- package/es/services/fetch-skills.test.js +22 -0
- package/es/services/tools/fetch-responses.d.ts +7 -0
- package/es/services/tools/fetch.mocks.d.ts +8 -0
- package/es/services/{fetch.mocks.js → tools/fetch.mocks.js} +1 -0
- package/es/types/common.d.ts +12 -0
- package/es/types/skills.d.ts +7 -0
- package/es/types/slides.d.ts +3 -21
- package/es/types/views/skills.d.ts +24 -0
- package/{lib/types/views.d.ts → es/types/views/slides.d.ts} +7 -11
- package/lib/actions/data/skills.d.ts +13 -0
- package/lib/actions/data/skills.js +10 -0
- package/lib/actions/data/slides.d.ts +54 -0
- package/lib/actions/{slides.js → data/slides.js} +5 -0
- package/lib/actions/index.d.ts +19 -5
- package/lib/actions/ui/finished-slides.d.ts +10 -0
- package/lib/actions/{finished-slides.js → ui/finished-slides.js} +1 -0
- package/lib/actions/ui/is-fetching.d.ts +10 -0
- package/lib/actions/ui/is-fetching.js +6 -0
- package/{es/actions → lib/actions/ui}/navigation.d.ts +2 -2
- package/lib/actions/ui/review-status.d.ts +7 -0
- package/{es/actions → lib/actions/ui}/step-items.d.ts +17 -1
- package/lib/actions/{step-items.js → ui/step-items.js} +5 -0
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js +1 -1
- package/lib/configure-store.d.ts +34 -4
- package/lib/configure-store.js +1 -2
- package/lib/fixtures/qcm-slide.js +7 -3
- package/lib/fixtures/temp-fixture.d.ts +1 -1
- package/lib/index.js +57 -37
- package/lib/index.test.js +1 -1
- package/lib/middlewares/on-start-app.d.ts +2 -3
- package/lib/middlewares/on-start-app.js +18 -17
- package/lib/reducers/data/index.d.ts +7 -0
- package/lib/reducers/data/index.js +11 -0
- package/lib/reducers/data/progression.d.ts +14 -0
- package/lib/reducers/data/progression.js +79 -0
- package/lib/reducers/data/skills.d.ts +6 -0
- package/lib/reducers/data/skills.js +15 -0
- package/lib/reducers/data/slides.d.ts +8 -0
- package/lib/reducers/{slides.js → data/slides.js} +4 -3
- package/lib/reducers/data/token.d.ts +5 -0
- package/lib/reducers/data/token.js +16 -0
- package/lib/reducers/index.d.ts +11 -8
- package/lib/reducers/index.js +3 -16
- package/lib/reducers/ui/finished-slides.d.ts +8 -0
- package/lib/reducers/{finished-slides.js → ui/finished-slides.js} +9 -6
- package/lib/reducers/ui/index.d.ts +7 -0
- package/lib/reducers/ui/index.js +11 -0
- package/lib/reducers/ui/navigation.d.ts +5 -0
- package/lib/reducers/{courses.js → ui/navigation.js} +9 -3
- package/lib/reducers/ui/review-status.d.ts +5 -0
- package/lib/reducers/{review-status.js → ui/review-status.js} +3 -2
- package/lib/reducers/ui/step-items.d.ts +14 -0
- package/lib/reducers/{step-items.js → ui/step-items.js} +7 -7
- package/lib/services/fetch-skills.d.ts +8 -0
- package/lib/services/{fetch-demo.js → fetch-skills.js} +28 -35
- package/lib/services/fetch-skills.mock.d.ts +3 -0
- package/lib/services/fetch-skills.mock.js +17 -0
- package/lib/services/{fetch-demo.test.js → fetch-skills.test.js} +31 -12
- package/lib/services/tools/fetch-responses.d.ts +7 -0
- package/lib/services/tools/fetch.mocks.d.ts +8 -0
- package/lib/services/{fetch.mocks.js → tools/fetch.mocks.js} +1 -0
- package/lib/types/common.d.ts +12 -0
- package/lib/types/skills.d.ts +7 -0
- package/lib/types/slides.d.ts +3 -21
- package/lib/types/views/skills.d.ts +24 -0
- package/{es/types/views.d.ts → lib/types/views/slides.d.ts} +7 -11
- package/package.json +3 -3
- package/src/actions/data/skills.ts +24 -0
- package/src/actions/data/slides.ts +89 -0
- package/src/actions/index.ts +27 -5
- package/src/actions/{finished-slides.ts → ui/finished-slides.ts} +5 -5
- package/src/actions/ui/is-fetching.ts +19 -0
- package/src/actions/{navigation.ts → ui/navigation.ts} +2 -2
- package/src/actions/{review-status.ts → ui/review-status.ts} +4 -4
- package/src/actions/{step-items.ts → ui/step-items.ts} +22 -4
- package/src/common/index.ts +2 -2
- package/src/configure-store.ts +40 -8
- package/src/fixtures/qcm-slide.ts +7 -3
- package/src/fixtures/temp-fixture.ts +1 -1
- package/src/index.test.tsx +1 -1
- package/src/index.tsx +69 -44
- package/src/middlewares/on-start-app.ts +23 -26
- package/src/reducers/data/index.ts +13 -0
- package/src/reducers/data/progression.ts +106 -0
- package/src/reducers/data/skills.ts +21 -0
- package/src/reducers/{slides.ts → data/slides.ts} +24 -21
- package/src/reducers/{review-status.ts → data/token.ts} +8 -6
- package/src/reducers/index.ts +3 -17
- package/src/reducers/{finished-slides.ts → ui/finished-slides.ts} +24 -14
- package/src/reducers/ui/index.ts +13 -0
- package/src/reducers/ui/navigation.ts +36 -0
- package/src/reducers/ui/review-status.ts +26 -0
- package/src/reducers/{step-items.ts → ui/step-items.ts} +34 -21
- package/src/services/fetch-skills.mock.ts +21 -0
- package/src/services/fetch-skills.test.ts +32 -0
- package/src/services/fetch-skills.ts +40 -0
- package/src/services/{fetch-responses.ts → tools/fetch-responses.ts} +3 -16
- package/src/services/{fetch.mocks.ts → tools/fetch.mocks.ts} +10 -10
- package/src/types/common.ts +15 -0
- package/src/types/globals.d.ts +2 -0
- package/src/types/skills.ts +8 -0
- package/src/types/slides.ts +3 -26
- package/src/types/views/skills.ts +27 -0
- package/src/types/{views.tsx → views/slides.ts} +7 -11
- package/es/actions/courses.d.ts +0 -6
- package/es/actions/courses.js +0 -5
- package/es/actions/data/is-fetching.d.ts +0 -5
- package/es/actions/data/is-fetching.js +0 -4
- package/es/actions/data/validate-slide.d.ts +0 -5
- package/es/actions/data/validate-slide.js +0 -6
- package/es/actions/finished-slides.d.ts +0 -7
- package/es/actions/review-status.d.ts +0 -7
- package/es/actions/slides.d.ts +0 -20
- package/es/reducers/courses.d.ts +0 -5
- package/es/reducers/data.d.ts +0 -7
- package/es/reducers/data.js +0 -76
- package/es/reducers/finished-slides.d.ts +0 -6
- package/es/reducers/navigation.d.ts +0 -8
- package/es/reducers/review-status.d.ts +0 -5
- package/es/reducers/slides.d.ts +0 -6
- package/es/reducers/step-items.d.ts +0 -6
- package/es/reducers/token.d.ts +0 -5
- package/es/reducers/token.js +0 -8
- package/es/services/fetch-demo.d.ts +0 -11
- package/es/services/fetch-demo.js +0 -26
- package/es/services/fetch-demo.test.js +0 -12
- package/es/services/fetch-responses.d.ts +0 -19
- package/es/services/fetch.mocks.d.ts +0 -9
- package/es/types/data/index.d.ts +0 -14
- package/es/types/dispatchers.d.ts +0 -17
- package/es/types/finished-slides.d.ts +0 -9
- package/es/types/review-status.d.ts +0 -1
- package/es/types/states.d.ts +0 -6
- package/es/types/step-items.d.ts +0 -26
- package/es/types/step-items.js +0 -5
- package/es/types/store-state.d.ts +0 -12
- package/es/types/utils.d.ts +0 -3
- package/es/types/views.js +0 -1
- package/lib/actions/courses.d.ts +0 -6
- package/lib/actions/courses.js +0 -5
- package/lib/actions/data/is-fetching.d.ts +0 -5
- package/lib/actions/data/is-fetching.js +0 -4
- package/lib/actions/data/validate-slide.d.ts +0 -5
- package/lib/actions/data/validate-slide.js +0 -6
- package/lib/actions/finished-slides.d.ts +0 -7
- package/lib/actions/review-status.d.ts +0 -7
- package/lib/actions/slides.d.ts +0 -20
- package/lib/reducers/courses.d.ts +0 -5
- package/lib/reducers/data.d.ts +0 -7
- package/lib/reducers/data.js +0 -77
- package/lib/reducers/finished-slides.d.ts +0 -6
- package/lib/reducers/navigation.d.ts +0 -8
- package/lib/reducers/navigation.js +0 -36
- package/lib/reducers/review-status.d.ts +0 -5
- package/lib/reducers/slides.d.ts +0 -6
- package/lib/reducers/step-items.d.ts +0 -6
- package/lib/reducers/token.d.ts +0 -5
- package/lib/reducers/token.js +0 -8
- package/lib/services/fetch-demo.d.ts +0 -11
- package/lib/services/fetch-demo.test.d.ts +0 -1
- package/lib/services/fetch-responses.d.ts +0 -19
- package/lib/services/fetch.mocks.d.ts +0 -9
- package/lib/types/data/index.d.ts +0 -14
- package/lib/types/data/index.js +0 -1
- package/lib/types/dispatchers.d.ts +0 -17
- package/lib/types/dispatchers.js +0 -1
- package/lib/types/finished-slides.d.ts +0 -9
- package/lib/types/finished-slides.js +0 -1
- package/lib/types/review-status.d.ts +0 -1
- package/lib/types/review-status.js +0 -1
- package/lib/types/states.d.ts +0 -6
- package/lib/types/states.js +0 -1
- package/lib/types/step-items.d.ts +0 -26
- package/lib/types/step-items.js +0 -5
- package/lib/types/store-state.d.ts +0 -12
- package/lib/types/store-state.js +0 -1
- package/lib/types/utils.d.ts +0 -3
- package/lib/types/utils.js +0 -1
- package/lib/types/views.js +0 -1
- package/src/actions/courses.ts +0 -11
- package/src/actions/data/is-fetching.ts +0 -12
- package/src/actions/data/validate-slide.ts +0 -15
- package/src/actions/slides.ts +0 -45
- package/src/reducers/courses.ts +0 -23
- package/src/reducers/data.ts +0 -88
- package/src/reducers/navigation.ts +0 -36
- package/src/reducers/token.ts +0 -17
- package/src/services/fetch-demo.test.ts +0 -16
- package/src/services/fetch-demo.ts +0 -57
- package/src/types/data/index.ts +0 -16
- package/src/types/dispatchers.ts +0 -18
- package/src/types/finished-slides.ts +0 -9
- package/src/types/review-status.ts +0 -1
- package/src/types/states.ts +0 -6
- package/src/types/step-items.ts +0 -31
- package/src/types/store-state.ts +0 -20
- package/src/types/utils.ts +0 -4
- /package/es/actions/{token.d.ts → data/token.d.ts} +0 -0
- /package/es/actions/{token.js → data/token.js} +0 -0
- /package/es/actions/{navigation.js → ui/navigation.js} +0 -0
- /package/es/actions/{review-status.js → ui/review-status.js} +0 -0
- /package/es/services/{fetch-demo.test.d.ts → fetch-skills.test.d.ts} +0 -0
- /package/es/services/{fetch-responses.js → tools/fetch-responses.js} +0 -0
- /package/es/types/{data/index.js → skills.js} +0 -0
- /package/es/types/{dispatchers.js → views/skills.js} +0 -0
- /package/es/types/{finished-slides.js → views/slides.js} +0 -0
- /package/lib/actions/{token.d.ts → data/token.d.ts} +0 -0
- /package/lib/actions/{token.js → data/token.js} +0 -0
- /package/lib/actions/{navigation.js → ui/navigation.js} +0 -0
- /package/lib/actions/{review-status.js → ui/review-status.js} +0 -0
- /package/{es/types/review-status.js → lib/services/fetch-skills.test.d.ts} +0 -0
- /package/lib/services/{fetch-responses.js → tools/fetch-responses.js} +0 -0
- /package/{es/types/states.js → lib/types/skills.js} +0 -0
- /package/{es/types/store-state.js → lib/types/views/skills.js} +0 -0
- /package/{es/types/utils.js → lib/types/views/slides.js} +0 -0
- /package/src/actions/{token.ts → data/token.ts} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReceivedSkills } from '../../actions/data/skills';
|
|
2
|
+
import { Skills } from '../../types/skills';
|
|
3
|
+
export declare type SkillsState = Skills;
|
|
4
|
+
export declare const initialState: SkillsState;
|
|
5
|
+
declare const reducer: (state: Skills | undefined, action: ReceivedSkills) => Skills;
|
|
6
|
+
export default reducer;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RECEIVED_SKILLS } from '../../actions/data/skills';
|
|
2
2
|
export const initialState = [];
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
4
|
// eslint-disable-next-line default-param-last
|
|
5
5
|
const reducer = (state = initialState, action) => {
|
|
6
6
|
switch (action.type) {
|
|
7
|
-
case
|
|
8
|
-
return
|
|
9
|
-
}
|
|
7
|
+
case RECEIVED_SKILLS:
|
|
8
|
+
return action.payload;
|
|
10
9
|
default:
|
|
11
10
|
return state;
|
|
12
11
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Slide, SlidesAction } from '../../actions/data/slides';
|
|
2
|
+
export declare type SlidesState = {
|
|
3
|
+
slideNumbers: number[];
|
|
4
|
+
[key: number]: Slide;
|
|
5
|
+
};
|
|
6
|
+
export declare const initialState: SlidesState;
|
|
7
|
+
declare const reducer: (state: SlidesState | undefined, action: SlidesAction) => SlidesState;
|
|
8
|
+
export default reducer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import map from 'lodash/fp/map';
|
|
2
|
-
import { STORE_FIRST_SLIDE, UPDATE_SLIDES_ON_NEXT, UPDATE_SLIDES_ON_VALIDATION } from '
|
|
3
|
-
import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '
|
|
2
|
+
import { STORE_FIRST_SLIDE, UPDATE_SLIDES_ON_NEXT, UPDATE_SLIDES_ON_VALIDATION } from '../../actions/data/slides';
|
|
3
|
+
import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '../../common';
|
|
4
|
+
// -----------------------------------------------------------------------------
|
|
4
5
|
const getInitialState = () => {
|
|
5
6
|
const state = {
|
|
6
7
|
slideNumbers
|
|
@@ -44,7 +45,7 @@ const stateUpdateOnValidation = (state, payload) => {
|
|
|
44
45
|
...previousValue,
|
|
45
46
|
nextSlide,
|
|
46
47
|
position: newSlideContent.position,
|
|
47
|
-
|
|
48
|
+
isCorrect: newSlideContent.isCorrect
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
else
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { STORE_TOKEN } from '../../actions/data/token';
|
|
2
|
+
// -----------------------------------------------------------------------------
|
|
3
|
+
export const initialState = null;
|
|
4
|
+
// -----------------------------------------------------------------------------
|
|
5
|
+
// eslint-disable-next-line default-param-last
|
|
6
|
+
const reducer = (state = initialState, action) => {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case STORE_TOKEN:
|
|
9
|
+
return action.payload;
|
|
10
|
+
default:
|
|
11
|
+
return state;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
// -----------------------------------------------------------------------------
|
|
15
|
+
export default reducer;
|
package/es/reducers/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
2
|
+
data: import("redux").CombinedState<{
|
|
3
|
+
progression: import("./data/progression").ProgressionState;
|
|
4
|
+
skills: import("../types/skills").Skills;
|
|
5
|
+
slides: import("./data/slides").SlidesState;
|
|
6
|
+
token: import("./data/token").TokenState;
|
|
7
|
+
}>;
|
|
2
8
|
ui: import("redux").CombinedState<{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
slides: import("../types/slides").Slides;
|
|
8
|
-
stepItems: import("../types/step-items").StepItems;
|
|
9
|
+
finishedSlides: import("./ui/finished-slides").FinishedSlidesState;
|
|
10
|
+
navigation: import("./ui/navigation").NavigationState;
|
|
11
|
+
reviewStatus: import("./ui/review-status").ReviewStatusState;
|
|
12
|
+
stepItems: import("./ui/step-items").StepItems;
|
|
9
13
|
}>;
|
|
10
|
-
|
|
11
|
-
}>, import("redux").AnyAction>;
|
|
14
|
+
}>, import("../actions/data/slides").ValidateSlide | import("../actions/data/slides").SlidesAction | import("../actions/data/skills").ReceivedSkills | import("../actions/data/token").StoreToken | import("../actions/ui/finished-slides").UpdateFinishedSlides | import("../actions/ui/navigation").NavigateTo | import("../actions/ui/navigation").NavigateBack | import("../actions/ui/review-status").UpdateReviewStatus | import("../actions/ui/step-items").StepItemsAction>;
|
|
12
15
|
export default _default;
|
package/es/reducers/index.js
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import { combineReducers } from 'redux';
|
|
2
2
|
import data from './data';
|
|
3
|
-
import
|
|
4
|
-
import finishedSlides from './finished-slides';
|
|
5
|
-
import navigation from './navigation';
|
|
6
|
-
import reviewStatus from './review-status';
|
|
7
|
-
import slides from './slides';
|
|
8
|
-
import stepItems from './step-items';
|
|
9
|
-
const ui = combineReducers({
|
|
10
|
-
courses,
|
|
11
|
-
finishedSlides,
|
|
12
|
-
navigation,
|
|
13
|
-
reviewStatus,
|
|
14
|
-
slides,
|
|
15
|
-
stepItems
|
|
16
|
-
});
|
|
3
|
+
import ui from './ui';
|
|
17
4
|
export default combineReducers({
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
data,
|
|
6
|
+
ui
|
|
20
7
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UpdateFinishedSlides } from '../../actions/ui/finished-slides';
|
|
2
|
+
export declare type FinishedSlidesState = {
|
|
3
|
+
slideNumbers: number[];
|
|
4
|
+
[key: number]: true;
|
|
5
|
+
};
|
|
6
|
+
export declare const initialState: FinishedSlidesState;
|
|
7
|
+
declare const reducer: (state: FinishedSlidesState | undefined, action: UpdateFinishedSlides) => FinishedSlidesState;
|
|
8
|
+
export default reducer;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import forEach from 'lodash/fp/forEach';
|
|
2
|
-
import { UPDATE_FINISHED_SLIDES } from '
|
|
3
|
-
import { slideNumbers } from '
|
|
4
|
-
|
|
5
|
-
cap: false
|
|
6
|
-
});
|
|
2
|
+
import { UPDATE_FINISHED_SLIDES } from '../../actions/ui/finished-slides';
|
|
3
|
+
import { slideNumbers } from '../../common';
|
|
4
|
+
// -----------------------------------------------------------------------------
|
|
7
5
|
export const initialState = {
|
|
8
6
|
slideNumbers
|
|
9
7
|
};
|
|
10
8
|
// -----------------------------------------------------------------------------
|
|
9
|
+
const _forEach = forEach.convert({
|
|
10
|
+
cap: false
|
|
11
|
+
});
|
|
12
|
+
// -----------------------------------------------------------------------------
|
|
13
|
+
const reducer = (
|
|
11
14
|
// eslint-disable-next-line default-param-last
|
|
12
|
-
|
|
15
|
+
state = initialState, action) => {
|
|
13
16
|
switch (action.type) {
|
|
14
17
|
case UPDATE_FINISHED_SLIDES: {
|
|
15
18
|
const { slideNumbers: _slideNumbers, ...rest } = state;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
2
|
+
finishedSlides: import("./finished-slides").FinishedSlidesState;
|
|
3
|
+
navigation: import("./navigation").NavigationState;
|
|
4
|
+
reviewStatus: import("./review-status").ReviewStatusState;
|
|
5
|
+
stepItems: import("./step-items").StepItems;
|
|
6
|
+
}>, import("../../actions/ui/finished-slides").UpdateFinishedSlides | import("../../actions/ui/navigation").NavigateTo | import("../../actions/ui/navigation").NavigateBack | import("../../actions/ui/review-status").UpdateReviewStatus | import("../../actions/ui/step-items").StepItemsAction>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { combineReducers } from 'redux';
|
|
2
|
+
import finishedSlides from './finished-slides';
|
|
3
|
+
import navigation from './navigation';
|
|
4
|
+
import reviewStatus from './review-status';
|
|
5
|
+
import stepItems from './step-items';
|
|
6
|
+
export default combineReducers({
|
|
7
|
+
finishedSlides,
|
|
8
|
+
navigation,
|
|
9
|
+
reviewStatus,
|
|
10
|
+
stepItems
|
|
11
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type NavigateTo, type NavigateBack } from '../../actions/ui/navigation';
|
|
2
|
+
export declare type NavigationState = Array<'skills' | 'onboarding' | 'slides'>;
|
|
3
|
+
export declare const initialState: NavigationState;
|
|
4
|
+
declare const reducer: (state: NavigationState | undefined, action: NavigateTo | NavigateBack) => NavigationState;
|
|
5
|
+
export default reducer;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { NAVIGATE_BACK, NAVIGATE_TO } from '
|
|
2
|
-
|
|
3
|
-
// export type State = Array<string>;
|
|
4
|
-
export const initialState = ['home'];
|
|
1
|
+
import { NAVIGATE_BACK, NAVIGATE_TO } from '../../actions/ui/navigation';
|
|
2
|
+
export const initialState = [];
|
|
5
3
|
// -----------------------------------------------------------------------------
|
|
4
|
+
const reducer = (
|
|
6
5
|
// eslint-disable-next-line default-param-last
|
|
7
|
-
|
|
6
|
+
state = initialState, action) => {
|
|
8
7
|
switch (action.type) {
|
|
9
8
|
case NAVIGATE_TO: {
|
|
10
9
|
return [...state, action.payload];
|
|
@@ -19,6 +18,4 @@ const reducer = (state = initialState, action) => {
|
|
|
19
18
|
}
|
|
20
19
|
};
|
|
21
20
|
// -----------------------------------------------------------------------------
|
|
22
|
-
export const getCurrentViewName = (appState) => appState.ui.navigation[appState.ui.navigation.length - 1];
|
|
23
|
-
// -----------------------------------------------------------------------------
|
|
24
21
|
export default reducer;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UpdateReviewStatus } from '../../actions/ui/review-status';
|
|
2
|
+
export declare type ReviewStatusState = 'finished' | 'ongoing';
|
|
3
|
+
export declare const initialState: ReviewStatusState;
|
|
4
|
+
declare const reducer: (state: ReviewStatusState | undefined, action: UpdateReviewStatus) => ReviewStatusState;
|
|
5
|
+
export default reducer;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { UPDATE_REVIEW_STATUS } from '
|
|
1
|
+
import { UPDATE_REVIEW_STATUS } from '../../actions/ui/review-status';
|
|
2
2
|
export const initialState = 'ongoing';
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
+
const reducer = (
|
|
4
5
|
// eslint-disable-next-line default-param-last
|
|
5
|
-
|
|
6
|
+
state = initialState, action) => {
|
|
6
7
|
switch (action.type) {
|
|
7
8
|
case UPDATE_REVIEW_STATUS: {
|
|
8
9
|
return action.payload;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconValue, StepItemsAction } from '../../actions/ui/step-items';
|
|
2
|
+
declare type StepItem = {
|
|
3
|
+
current: boolean;
|
|
4
|
+
icon: IconValue;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type StepItems = {
|
|
8
|
+
slideNumbers: number[];
|
|
9
|
+
[key: number]: StepItem;
|
|
10
|
+
};
|
|
11
|
+
export declare type StepItemsState = StepItems;
|
|
12
|
+
export declare const initialState: StepItemsState;
|
|
13
|
+
declare const reducer: (state: StepItems | undefined, action: StepItemsAction) => StepItemsState;
|
|
14
|
+
export default reducer;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import isNil from 'lodash/fp/isNil';
|
|
2
1
|
import get from 'lodash/fp/get';
|
|
3
2
|
import has from 'lodash/fp/has';
|
|
4
3
|
import map from 'lodash/fp/map';
|
|
5
|
-
import { UPDATE_STEP_ITEMS_ON_NEXT, UPDATE_STEP_ITEMS_ON_VALIDATION } from '
|
|
6
|
-
import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '
|
|
4
|
+
import { UPDATE_STEP_ITEMS_ON_NEXT, UPDATE_STEP_ITEMS_ON_VALIDATION } from '../../actions/ui/step-items';
|
|
5
|
+
import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '../../common';
|
|
6
|
+
// -----------------------------------------------------------------------------
|
|
7
7
|
const getInitialState = () => {
|
|
8
8
|
const state = {
|
|
9
9
|
slideNumbers
|
|
@@ -11,7 +11,7 @@ const getInitialState = () => {
|
|
|
11
11
|
// eslint-disable-next-line fp/no-loops
|
|
12
12
|
for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
|
|
13
13
|
const current = index === 0;
|
|
14
|
-
state[index] = { current, value: `${index + 1}`, icon:
|
|
14
|
+
state[index] = { current, value: `${index + 1}`, icon: 'no-answer' };
|
|
15
15
|
}
|
|
16
16
|
return state;
|
|
17
17
|
};
|
|
@@ -22,12 +22,12 @@ export const initialState = getInitialState();
|
|
|
22
22
|
const getNextIndex = (currentIndex) => currentIndex === HIGHEST_INDEX ? 0 : currentIndex + 1;
|
|
23
23
|
// ||-------> calculates which should be the next step to visit (as there can be already answered slides &&
|
|
24
24
|
// they have to be skipped)
|
|
25
|
-
const calculateNextStepIndex = (currentStepNumber, finishedSlides, lastVisitedIndex =
|
|
25
|
+
const calculateNextStepIndex = (currentStepNumber, finishedSlides, lastVisitedIndex = -1) => {
|
|
26
26
|
// only one slide remaining, the step should stay on the same number
|
|
27
27
|
if (lastVisitedIndex === currentStepNumber) {
|
|
28
28
|
return currentStepNumber;
|
|
29
29
|
}
|
|
30
|
-
const indexToVisit = getNextIndex(
|
|
30
|
+
const indexToVisit = getNextIndex(lastVisitedIndex === -1 ? currentStepNumber : lastVisitedIndex);
|
|
31
31
|
// if the index is already included in the correctly answered (finished) slides, then we proceed to check for the next one
|
|
32
32
|
return has(indexToVisit, finishedSlides)
|
|
33
33
|
? calculateNextStepIndex(currentStepNumber, finishedSlides, indexToVisit)
|
|
@@ -64,7 +64,7 @@ const reducer = (state = initialState, action) => {
|
|
|
64
64
|
}
|
|
65
65
|
case UPDATE_STEP_ITEMS_ON_NEXT: {
|
|
66
66
|
const { stepNumber, finishedSlides, current } = action.payload;
|
|
67
|
-
const nextIndex = !current ? calculateNextStepIndex(stepNumber, finishedSlides) :
|
|
67
|
+
const nextIndex = !current ? calculateNextStepIndex(stepNumber, finishedSlides) : -1;
|
|
68
68
|
return recalculateStepItemsState(state, stepNumber, { current, nextIndex });
|
|
69
69
|
}
|
|
70
70
|
default:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import crossFetch from 'cross-fetch';
|
|
2
|
+
import { Skills } from '../types/skills';
|
|
3
|
+
declare type FetchSkills = (token: string) => Promise<Skills>;
|
|
4
|
+
declare type CreateFetchSkills = (fetch: typeof crossFetch) => FetchSkills;
|
|
5
|
+
declare const fetchSkills: CreateFetchSkills;
|
|
6
|
+
export { fetchSkills };
|
|
7
|
+
declare const _default: FetchSkills;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import crossFetch from 'cross-fetch';
|
|
2
|
+
import decode from 'jwt-decode';
|
|
3
|
+
import { toJSON } from './tools/fetch-responses';
|
|
4
|
+
import mockFetchSkills from './fetch-skills.mock';
|
|
5
|
+
// -----------------------------------------------------------------------------
|
|
6
|
+
const fetchSkills = fetch => async (token) => {
|
|
7
|
+
const { user: userId, host } = decode(token);
|
|
8
|
+
const response = await fetch(`${host}/api/v2/skills/review/user/${userId}`, {
|
|
9
|
+
headers: { authorization: token }
|
|
10
|
+
});
|
|
11
|
+
const skills = (await toJSON(response));
|
|
12
|
+
return skills;
|
|
13
|
+
};
|
|
14
|
+
// -----------------------------------------------------------------------------
|
|
15
|
+
const createFetchSkills = () => {
|
|
16
|
+
if (process.env.SERVICES !== 'mocks') {
|
|
17
|
+
return fetchSkills(crossFetch);
|
|
18
|
+
}
|
|
19
|
+
return fetchSkills(mockFetchSkills);
|
|
20
|
+
};
|
|
21
|
+
// -----------------------------------------------------------------------------
|
|
22
|
+
export { fetchSkills };
|
|
23
|
+
export default createFetchSkills();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { okJSONResponse } from './tools/fetch.mocks';
|
|
2
|
+
const result = [
|
|
3
|
+
{
|
|
4
|
+
skillRef: '_skill-ref',
|
|
5
|
+
slidesToReview: 2,
|
|
6
|
+
name: 'skill-test',
|
|
7
|
+
custom: false
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
skillRef: '_skill-ref-2',
|
|
11
|
+
slidesToReview: 2,
|
|
12
|
+
name: 'skill-test-2',
|
|
13
|
+
custom: true
|
|
14
|
+
}
|
|
15
|
+
];
|
|
16
|
+
const mockFetchSkills = okJSONResponse(result);
|
|
17
|
+
export default mockFetchSkills;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import { fetchSkills } from './fetch-skills';
|
|
3
|
+
import { okJSONResponse, token } from './tools/fetch.mocks';
|
|
4
|
+
test('should fetch skills with success', async (t) => {
|
|
5
|
+
const result = [
|
|
6
|
+
{
|
|
7
|
+
slidesToReview: 1,
|
|
8
|
+
name: 'skill-test',
|
|
9
|
+
custom: false,
|
|
10
|
+
skillRef: '_skill-ref'
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
const mockedFetchSkills = fetchSkills(okJSONResponse(result));
|
|
14
|
+
const skills = await mockedFetchSkills(token);
|
|
15
|
+
t.deepEqual(result, skills);
|
|
16
|
+
});
|
|
17
|
+
test('should reject bad token', async (t) => {
|
|
18
|
+
const badToken = 'token is not a jwt';
|
|
19
|
+
const mockedFetchSkills = fetchSkills(okJSONResponse([]));
|
|
20
|
+
const error = await t.throwsAsync(() => mockedFetchSkills(badToken));
|
|
21
|
+
t.is(error?.message, "Invalid token specified: Cannot read properties of undefined (reading 'replace')");
|
|
22
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class ResponseError extends Error {
|
|
2
|
+
statusCode: number;
|
|
3
|
+
constructor(statusCode: number, statusText: string, body?: string);
|
|
4
|
+
}
|
|
5
|
+
export declare const toJSON: (response: Response) => Promise<unknown>;
|
|
6
|
+
export declare const toText: (response: Response) => Promise<string>;
|
|
7
|
+
export declare const toVoid: (response: Response) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import crossFetch from 'cross-fetch';
|
|
2
|
+
export declare const toResponse: (statusCode: number, statusText: string, body: string) => Promise<Response>;
|
|
3
|
+
export declare const okJSONResponse: (body: unknown) => typeof crossFetch;
|
|
4
|
+
export declare const internalServerErrorJSONResponse: (body: unknown) => typeof crossFetch;
|
|
5
|
+
export declare const notFoundJSONResponse: (body: unknown) => typeof crossFetch;
|
|
6
|
+
export declare const okTextResponse: (body: string) => typeof crossFetch;
|
|
7
|
+
export declare const internalServerErrorTextResponse: (body: string) => typeof crossFetch;
|
|
8
|
+
export declare const token: string;
|
|
@@ -10,3 +10,4 @@ export const internalServerErrorJSONResponse = (body) => () => toResponse(500, '
|
|
|
10
10
|
export const notFoundJSONResponse = (body) => () => toResponse(404, 'Not Found', JSON.stringify(body));
|
|
11
11
|
export const okTextResponse = (body) => () => toResponse(200, 'OK', body);
|
|
12
12
|
export const internalServerErrorTextResponse = (body) => () => toResponse(500, 'InternalServerError', body);
|
|
13
|
+
export const token = process.env.API_TEST_TOKEN || 'no-API_TEST_TOKEN';
|
package/es/types/common.d.ts
CHANGED
|
@@ -5,3 +5,15 @@ export declare type AppOptions = {
|
|
|
5
5
|
translations?: unknown;
|
|
6
6
|
slide?: Slide;
|
|
7
7
|
};
|
|
8
|
+
export declare type JWT = {
|
|
9
|
+
exp: number;
|
|
10
|
+
iat: number;
|
|
11
|
+
grants: unknown;
|
|
12
|
+
iss: string;
|
|
13
|
+
user: string;
|
|
14
|
+
usage: string;
|
|
15
|
+
host: string;
|
|
16
|
+
};
|
|
17
|
+
export declare type WithRequired<T, K extends keyof T> = T & {
|
|
18
|
+
[P in K]-?: T[P];
|
|
19
|
+
};
|
package/es/types/slides.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { WithRequired } from './utils';
|
|
2
1
|
export declare type Choice = {
|
|
3
2
|
order?: number;
|
|
4
3
|
selected: boolean;
|
|
5
4
|
title: string;
|
|
6
5
|
help: string;
|
|
6
|
+
onClick: Function;
|
|
7
7
|
};
|
|
8
8
|
export declare type QcmDrag = {
|
|
9
9
|
type: 'qcmDrag';
|
|
10
|
-
|
|
11
|
-
help
|
|
10
|
+
answers: Choice[];
|
|
11
|
+
help?: string;
|
|
12
12
|
};
|
|
13
13
|
export declare type Qcm = {
|
|
14
14
|
type: 'qcm';
|
|
@@ -62,26 +62,8 @@ export declare type AnswerUI = {
|
|
|
62
62
|
model: QcmDrag | Qcm | QcmGraphic | FreeText | DropDown | QuestionRange | Template;
|
|
63
63
|
help: string;
|
|
64
64
|
};
|
|
65
|
-
export declare type SlideNumber = number;
|
|
66
65
|
export declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
67
66
|
export declare type Slide = {
|
|
68
|
-
hidden?: boolean;
|
|
69
|
-
position?: number;
|
|
70
|
-
animationType?: SlideUIAnimations;
|
|
71
|
-
validationResult?: 'success' | 'failure';
|
|
72
|
-
endReview?: boolean;
|
|
73
67
|
questionText?: string;
|
|
74
68
|
answerUI?: AnswerUI;
|
|
75
|
-
nextSlide?: Omit<Slide, 'endReview' | 'hidden' | 'position' | 'nextSlide'>;
|
|
76
|
-
};
|
|
77
|
-
export declare type Slides = {
|
|
78
|
-
slideNumbers: SlideNumber[];
|
|
79
|
-
[key: SlideNumber]: Slide;
|
|
80
|
-
};
|
|
81
|
-
export declare type UpdateSlidesOnValidationPayload = {
|
|
82
|
-
slideNumber: SlideNumber;
|
|
83
|
-
newSlideContent: Slide;
|
|
84
|
-
numberOfFinishedSlides: number;
|
|
85
|
-
nextSlide: WithRequired<Slide['nextSlide'], 'answerUI' | 'questionText'>;
|
|
86
69
|
};
|
|
87
|
-
export declare type UpdateSlidesOnNextPayload = Omit<UpdateSlidesOnValidationPayload, 'nextSlide'>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare type SkillCard = {
|
|
2
|
+
'aria-label': string;
|
|
3
|
+
skillTitle: string;
|
|
4
|
+
skillAriaLabel: string;
|
|
5
|
+
buttonLabel: string;
|
|
6
|
+
buttonAriaLabel: string;
|
|
7
|
+
reviseLabel: string;
|
|
8
|
+
reviseAriaLabel: string;
|
|
9
|
+
isCustom: boolean;
|
|
10
|
+
onClick: Function;
|
|
11
|
+
};
|
|
12
|
+
declare type NoSkillsProps = {
|
|
13
|
+
titleNoSkills: string;
|
|
14
|
+
textNoSkills: string;
|
|
15
|
+
iconSkillAriaLabel: string;
|
|
16
|
+
};
|
|
17
|
+
declare type SkillsProps = NoSkillsProps & {
|
|
18
|
+
'aria-label'?: string;
|
|
19
|
+
title: string;
|
|
20
|
+
isLoading?: boolean;
|
|
21
|
+
isLoadingAriaLabel: string;
|
|
22
|
+
listSkills: SkillCard[];
|
|
23
|
+
};
|
|
24
|
+
export { SkillsProps };
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Dispatchers } from './dispatchers';
|
|
4
|
-
import { FinishedSlides } from './finished-slides';
|
|
5
|
-
import { Slides } from './slides';
|
|
6
|
-
import { StepItems } from './step-items';
|
|
1
|
+
import { Dispatchers } from '../../actions';
|
|
2
|
+
import { StoreState } from '../../configure-store';
|
|
7
3
|
declare type SlidesViewStaticProps = {
|
|
8
|
-
slides:
|
|
4
|
+
slides: StoreState['data']['slides'];
|
|
9
5
|
headerProps: {
|
|
10
6
|
mode: string;
|
|
11
7
|
skillName: string;
|
|
@@ -13,9 +9,9 @@ declare type SlidesViewStaticProps = {
|
|
|
13
9
|
'aria-label'?: string;
|
|
14
10
|
closeButtonAriaLabel: string;
|
|
15
11
|
};
|
|
16
|
-
finishedSlides:
|
|
17
|
-
stepItems:
|
|
18
|
-
reviewStatus:
|
|
12
|
+
finishedSlides: StoreState['ui']['finishedSlides'];
|
|
13
|
+
stepItems: StoreState['ui']['stepItems'];
|
|
14
|
+
reviewStatus: StoreState['ui']['reviewStatus'];
|
|
19
15
|
validate: {
|
|
20
16
|
label: string;
|
|
21
17
|
};
|
|
@@ -57,7 +53,7 @@ declare type SlidesViewStaticProps = {
|
|
|
57
53
|
failureLabel: string;
|
|
58
54
|
};
|
|
59
55
|
reviewBackgroundAriaLabel?: string;
|
|
60
|
-
|
|
56
|
+
progression: StoreState['data']['progression'];
|
|
61
57
|
};
|
|
62
58
|
declare type SlidesViewDispatcherProps = Omit<Dispatchers, 'navigateTo' | 'navigateBack'>;
|
|
63
59
|
declare type SlidesViewProps = SlidesViewStaticProps & SlidesViewDispatcherProps;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Skills } from '../../types/skills';
|
|
2
|
+
export declare const RECEIVED_SKILLS = "@@data/skills/RECEIVED_SKILLS";
|
|
3
|
+
export declare const ERROR_FETCHING_SKILLS = "@@data/skills/ERROR_FETCHING_SKILLS";
|
|
4
|
+
export declare type ReceivedSkills = {
|
|
5
|
+
type: '@@data/skills/RECEIVED_SKILLS';
|
|
6
|
+
payload: Skills;
|
|
7
|
+
};
|
|
8
|
+
export declare type ErrorFetchingSkills = {
|
|
9
|
+
type: '@@data/skills/ERROR_FETCHING_SKILLS';
|
|
10
|
+
payload: Error;
|
|
11
|
+
};
|
|
12
|
+
export declare const receivedSkills: (skills: Skills) => ReceivedSkills;
|
|
13
|
+
export declare const errorFetchingSkills: (error: Error) => ErrorFetchingSkills;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var RECEIVED_SKILLS = '@@data/skills/RECEIVED_SKILLS';
|
|
2
|
+
export var ERROR_FETCHING_SKILLS = '@@data/skills/ERROR_FETCHING_SKILLS';
|
|
3
|
+
export var receivedSkills = function (skills) { return ({
|
|
4
|
+
type: RECEIVED_SKILLS,
|
|
5
|
+
payload: skills
|
|
6
|
+
}); };
|
|
7
|
+
export var errorFetchingSkills = function (error) { return ({
|
|
8
|
+
type: ERROR_FETCHING_SKILLS,
|
|
9
|
+
payload: error
|
|
10
|
+
}); };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Slide as SlideFromAPI } from '../../types/slides';
|
|
2
|
+
export declare const STORE_FIRST_SLIDE = "@@slide/STORE_FIRST_SLIDE";
|
|
3
|
+
export declare const UPDATE_SLIDES_ON_VALIDATION = "@@slide/UPDATE_SLIDES_ON_VALIDATION";
|
|
4
|
+
export declare const UPDATE_SLIDES_ON_NEXT = "@@slide/UPDATE_SLIDES_ON_NEXT";
|
|
5
|
+
export declare const VALIDATE_SLIDE = "@@slide/VALIDATE";
|
|
6
|
+
export declare const FETCH_NEXT_CONTENT = "@@slide/FETCH_NEXT_CONTENT";
|
|
7
|
+
declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
8
|
+
export declare type Slide = SlideFromAPI & {
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
position: number;
|
|
11
|
+
animationType?: SlideUIAnimations;
|
|
12
|
+
isCorrect?: boolean;
|
|
13
|
+
endReview?: boolean;
|
|
14
|
+
nextSlide?: Omit<Slide, 'endReview' | 'hidden' | 'position' | 'nextSlide'>;
|
|
15
|
+
};
|
|
16
|
+
export declare type ValidationPayload = {
|
|
17
|
+
slideNumber: number;
|
|
18
|
+
newSlideContent: Slide;
|
|
19
|
+
numberOfFinishedSlides: number;
|
|
20
|
+
nextSlide: Slide;
|
|
21
|
+
};
|
|
22
|
+
export declare type OnNextPayload = Omit<ValidationPayload, 'nextSlide'>;
|
|
23
|
+
export declare type FetchNextPayload = {
|
|
24
|
+
answer: string[];
|
|
25
|
+
content: {
|
|
26
|
+
ref: string;
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare type StoreFirstSlide = {
|
|
31
|
+
type: typeof STORE_FIRST_SLIDE;
|
|
32
|
+
payload: SlideFromAPI;
|
|
33
|
+
};
|
|
34
|
+
export declare type UpdateSlidesOnValidation = {
|
|
35
|
+
type: typeof UPDATE_SLIDES_ON_VALIDATION;
|
|
36
|
+
payload: ValidationPayload;
|
|
37
|
+
};
|
|
38
|
+
export declare type UpdateSlidesOnNext = {
|
|
39
|
+
type: typeof UPDATE_SLIDES_ON_NEXT;
|
|
40
|
+
payload: OnNextPayload;
|
|
41
|
+
};
|
|
42
|
+
export declare type ValidateSlide = {
|
|
43
|
+
type: typeof VALIDATE_SLIDE;
|
|
44
|
+
};
|
|
45
|
+
export declare type FetchNextContent = {
|
|
46
|
+
type: typeof FETCH_NEXT_CONTENT;
|
|
47
|
+
payload: FetchNextPayload;
|
|
48
|
+
};
|
|
49
|
+
export declare type SlidesAction = StoreFirstSlide | UpdateSlidesOnValidation | UpdateSlidesOnNext;
|
|
50
|
+
export declare const storeFirstSlide: (slide: SlideFromAPI) => StoreFirstSlide;
|
|
51
|
+
export declare const updateSlidesOnValidation: (payload: ValidationPayload) => UpdateSlidesOnValidation;
|
|
52
|
+
export declare const updateSlidesOnNext: (payload: OnNextPayload) => UpdateSlidesOnNext;
|
|
53
|
+
export declare const validateSlide: () => ValidateSlide;
|
|
54
|
+
export {};
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export var STORE_FIRST_SLIDE = '@@slide/STORE_FIRST_SLIDE';
|
|
3
3
|
export var UPDATE_SLIDES_ON_VALIDATION = '@@slide/UPDATE_SLIDES_ON_VALIDATION';
|
|
4
4
|
export var UPDATE_SLIDES_ON_NEXT = '@@slide/UPDATE_SLIDES_ON_NEXT';
|
|
5
|
+
export var VALIDATE_SLIDE = '@@slide/VALIDATE';
|
|
6
|
+
export var FETCH_NEXT_CONTENT = '@@slide/FETCH_NEXT_CONTENT';
|
|
5
7
|
// -----------------------------------------------------------------------------
|
|
6
8
|
export var storeFirstSlide = function (slide) { return ({
|
|
7
9
|
type: STORE_FIRST_SLIDE,
|
|
@@ -15,3 +17,6 @@ export var updateSlidesOnNext = function (payload) { return ({
|
|
|
15
17
|
type: UPDATE_SLIDES_ON_NEXT,
|
|
16
18
|
payload: payload
|
|
17
19
|
}); };
|
|
20
|
+
export var validateSlide = function () { return ({
|
|
21
|
+
type: VALIDATE_SLIDE
|
|
22
|
+
}); };
|