@coorpacademy/app-review 0.1.3 → 0.1.5
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
package/lib/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/lib/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
|
-
var ui = combineReducers({
|
|
10
|
-
courses: courses,
|
|
11
|
-
finishedSlides: finishedSlides,
|
|
12
|
-
navigation: navigation,
|
|
13
|
-
reviewStatus: reviewStatus,
|
|
14
|
-
slides: slides,
|
|
15
|
-
stepItems: stepItems
|
|
16
|
-
});
|
|
3
|
+
import ui from './ui';
|
|
17
4
|
export default combineReducers({
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
data: data,
|
|
6
|
+
ui: 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;
|
|
@@ -10,17 +10,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import forEach from 'lodash/fp/forEach';
|
|
13
|
-
import { UPDATE_FINISHED_SLIDES } from '
|
|
14
|
-
import { slideNumbers } from '
|
|
15
|
-
|
|
16
|
-
cap: false
|
|
17
|
-
});
|
|
13
|
+
import { UPDATE_FINISHED_SLIDES } from '../../actions/ui/finished-slides';
|
|
14
|
+
import { slideNumbers } from '../../common';
|
|
15
|
+
// -----------------------------------------------------------------------------
|
|
18
16
|
export var initialState = {
|
|
19
17
|
slideNumbers: slideNumbers
|
|
20
18
|
};
|
|
21
19
|
// -----------------------------------------------------------------------------
|
|
20
|
+
var _forEach = forEach.convert({
|
|
21
|
+
cap: false
|
|
22
|
+
});
|
|
23
|
+
// -----------------------------------------------------------------------------
|
|
24
|
+
var reducer = function (
|
|
22
25
|
// eslint-disable-next-line default-param-last
|
|
23
|
-
|
|
26
|
+
state, action) {
|
|
24
27
|
if (state === void 0) { state = initialState; }
|
|
25
28
|
switch (action.type) {
|
|
26
29
|
case UPDATE_FINISHED_SLIDES: {
|
|
@@ -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: finishedSlides,
|
|
8
|
+
navigation: navigation,
|
|
9
|
+
reviewStatus: reviewStatus,
|
|
10
|
+
stepItems: 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;
|
|
@@ -7,16 +7,22 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { NAVIGATE_BACK, NAVIGATE_TO } from '../../actions/ui/navigation';
|
|
11
11
|
export var initialState = [];
|
|
12
12
|
// -----------------------------------------------------------------------------
|
|
13
|
+
var reducer = function (
|
|
13
14
|
// eslint-disable-next-line default-param-last
|
|
14
|
-
|
|
15
|
+
state, action) {
|
|
15
16
|
if (state === void 0) { state = initialState; }
|
|
16
17
|
switch (action.type) {
|
|
17
|
-
case
|
|
18
|
+
case NAVIGATE_TO: {
|
|
18
19
|
return __spreadArray(__spreadArray([], state, true), [action.payload], false);
|
|
19
20
|
}
|
|
21
|
+
case NAVIGATE_BACK: {
|
|
22
|
+
var newState = __spreadArray([], state, true);
|
|
23
|
+
newState.pop();
|
|
24
|
+
return newState;
|
|
25
|
+
}
|
|
20
26
|
default:
|
|
21
27
|
return state;
|
|
22
28
|
}
|
|
@@ -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 var initialState = 'ongoing';
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
+
var reducer = function (
|
|
4
5
|
// eslint-disable-next-line default-param-last
|
|
5
|
-
|
|
6
|
+
state, action) {
|
|
6
7
|
if (state === void 0) { state = initialState; }
|
|
7
8
|
switch (action.type) {
|
|
8
9
|
case UPDATE_REVIEW_STATUS: {
|
|
@@ -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;
|
|
@@ -9,12 +9,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import isNil from 'lodash/fp/isNil';
|
|
13
12
|
import get from 'lodash/fp/get';
|
|
14
13
|
import has from 'lodash/fp/has';
|
|
15
14
|
import map from 'lodash/fp/map';
|
|
16
|
-
import { UPDATE_STEP_ITEMS_ON_NEXT, UPDATE_STEP_ITEMS_ON_VALIDATION } from '
|
|
17
|
-
import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '
|
|
15
|
+
import { UPDATE_STEP_ITEMS_ON_NEXT, UPDATE_STEP_ITEMS_ON_VALIDATION } from '../../actions/ui/step-items';
|
|
16
|
+
import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '../../common';
|
|
17
|
+
// -----------------------------------------------------------------------------
|
|
18
18
|
var getInitialState = function () {
|
|
19
19
|
var state = {
|
|
20
20
|
slideNumbers: slideNumbers
|
|
@@ -22,7 +22,7 @@ var getInitialState = function () {
|
|
|
22
22
|
// eslint-disable-next-line fp/no-loops
|
|
23
23
|
for (var index = 0; index < TOTAL_SLIDES_STACK; index++) {
|
|
24
24
|
var current = index === 0;
|
|
25
|
-
state[index] = { current: current, value: "".concat(index + 1), icon:
|
|
25
|
+
state[index] = { current: current, value: "".concat(index + 1), icon: 'no-answer' };
|
|
26
26
|
}
|
|
27
27
|
return state;
|
|
28
28
|
};
|
|
@@ -36,12 +36,12 @@ var getNextIndex = function (currentIndex) {
|
|
|
36
36
|
// ||-------> calculates which should be the next step to visit (as there can be already answered slides &&
|
|
37
37
|
// they have to be skipped)
|
|
38
38
|
var calculateNextStepIndex = function (currentStepNumber, finishedSlides, lastVisitedIndex) {
|
|
39
|
-
if (lastVisitedIndex === void 0) { lastVisitedIndex =
|
|
39
|
+
if (lastVisitedIndex === void 0) { lastVisitedIndex = -1; }
|
|
40
40
|
// only one slide remaining, the step should stay on the same number
|
|
41
41
|
if (lastVisitedIndex === currentStepNumber) {
|
|
42
42
|
return currentStepNumber;
|
|
43
43
|
}
|
|
44
|
-
var indexToVisit = getNextIndex(
|
|
44
|
+
var indexToVisit = getNextIndex(lastVisitedIndex === -1 ? currentStepNumber : lastVisitedIndex);
|
|
45
45
|
// if the index is already included in the correctly answered (finished) slides, then we proceed to check for the next one
|
|
46
46
|
return has(indexToVisit, finishedSlides)
|
|
47
47
|
? calculateNextStepIndex(currentStepNumber, finishedSlides, indexToVisit)
|
|
@@ -76,7 +76,7 @@ var reducer = function (state, action) {
|
|
|
76
76
|
}
|
|
77
77
|
case UPDATE_STEP_ITEMS_ON_NEXT: {
|
|
78
78
|
var _b = action.payload, stepNumber = _b.stepNumber, finishedSlides = _b.finishedSlides, current = _b.current;
|
|
79
|
-
var nextIndex = !current ? calculateNextStepIndex(stepNumber, finishedSlides) :
|
|
79
|
+
var nextIndex = !current ? calculateNextStepIndex(stepNumber, finishedSlides) : -1;
|
|
80
80
|
return recalculateStepItemsState(state, stepNumber, { current: current, nextIndex: nextIndex });
|
|
81
81
|
}
|
|
82
82
|
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;
|
|
@@ -36,41 +36,34 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import crossFetch from 'cross-fetch';
|
|
38
38
|
import decode from 'jwt-decode';
|
|
39
|
-
import { toJSON } from './fetch-responses';
|
|
40
|
-
|
|
41
|
-
return Object.keys(params)
|
|
42
|
-
.map(function (key) {
|
|
43
|
-
var value = params[key].toString();
|
|
44
|
-
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
|
|
45
|
-
})
|
|
46
|
-
.join('&');
|
|
47
|
-
};
|
|
39
|
+
import { toJSON } from './tools/fetch-responses';
|
|
40
|
+
import mockFetchSkills from './fetch-skills.mock';
|
|
48
41
|
// -----------------------------------------------------------------------------
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
var fetchSkills = function (fetch) { return function (token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
var _a, userId, host, response, skills;
|
|
44
|
+
return __generator(this, function (_b) {
|
|
45
|
+
switch (_b.label) {
|
|
46
|
+
case 0:
|
|
47
|
+
_a = decode(token), userId = _a.user, host = _a.host;
|
|
48
|
+
return [4 /*yield*/, fetch("".concat(host, "/api/v2/skills/review/user/").concat(userId), {
|
|
49
|
+
headers: { authorization: token }
|
|
50
|
+
})];
|
|
51
|
+
case 1:
|
|
52
|
+
response = _b.sent();
|
|
53
|
+
return [4 /*yield*/, toJSON(response)];
|
|
54
|
+
case 2:
|
|
55
|
+
skills = (_b.sent());
|
|
56
|
+
return [2 /*return*/, skills];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}); }; };
|
|
60
|
+
// -----------------------------------------------------------------------------
|
|
61
|
+
var createFetchSkills = function () {
|
|
62
|
+
if (process.env.SERVICES !== 'mocks') {
|
|
63
|
+
return fetchSkills(crossFetch);
|
|
64
|
+
}
|
|
65
|
+
return fetchSkills(mockFetchSkills);
|
|
73
66
|
};
|
|
74
67
|
// -----------------------------------------------------------------------------
|
|
75
|
-
export {
|
|
76
|
-
export default
|
|
68
|
+
export { fetchSkills };
|
|
69
|
+
export default createFetchSkills();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { okJSONResponse } from './tools/fetch.mocks';
|
|
2
|
+
var 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
|
+
var mockFetchSkills = okJSONResponse(result);
|
|
17
|
+
export default mockFetchSkills;
|
|
@@ -35,22 +35,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import test from 'ava';
|
|
38
|
-
import {
|
|
39
|
-
import { okJSONResponse } from './fetch.mocks';
|
|
40
|
-
test('should fetch
|
|
41
|
-
var
|
|
38
|
+
import { fetchSkills } from './fetch-skills';
|
|
39
|
+
import { okJSONResponse, token } from './tools/fetch.mocks';
|
|
40
|
+
test('should fetch skills with success', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
+
var result, mockedFetchSkills, skills;
|
|
42
42
|
return __generator(this, function (_a) {
|
|
43
43
|
switch (_a.label) {
|
|
44
44
|
case 0:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
result = [
|
|
46
|
+
{
|
|
47
|
+
slidesToReview: 1,
|
|
48
|
+
name: 'skill-test',
|
|
49
|
+
custom: false,
|
|
50
|
+
skillRef: '_skill-ref'
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
mockedFetchSkills = fetchSkills(okJSONResponse(result));
|
|
54
|
+
return [4 /*yield*/, mockedFetchSkills(token)];
|
|
51
55
|
case 1:
|
|
52
|
-
|
|
53
|
-
t.
|
|
56
|
+
skills = _a.sent();
|
|
57
|
+
t.deepEqual(result, skills);
|
|
58
|
+
return [2 /*return*/];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}); });
|
|
62
|
+
test('should reject bad token', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
|
+
var badToken, mockedFetchSkills, error;
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
switch (_a.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
badToken = 'token is not a jwt';
|
|
68
|
+
mockedFetchSkills = fetchSkills(okJSONResponse([]));
|
|
69
|
+
return [4 /*yield*/, t.throwsAsync(function () { return mockedFetchSkills(badToken); })];
|
|
70
|
+
case 1:
|
|
71
|
+
error = _a.sent();
|
|
72
|
+
t.is(error === null || error === void 0 ? void 0 : error.message, "Invalid token specified: Cannot read properties of undefined (reading 'replace')");
|
|
54
73
|
return [2 /*return*/];
|
|
55
74
|
}
|
|
56
75
|
});
|
|
@@ -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;
|
package/lib/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/lib/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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@coorpacademy/components": "10.21.
|
|
43
|
+
"@coorpacademy/components": "10.21.4",
|
|
44
44
|
"cross-fetch": "^3.1.5",
|
|
45
45
|
"jwt-decode": "^3.1.2",
|
|
46
46
|
"react-redux": "^8.0.1",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"ts-node": "^10.8.1",
|
|
77
77
|
"typescript": "^4.7.4"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "aeb09b5a833e5f1a16c8ca15bf82fd2fcc9c3adb"
|
|
80
80
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {Skills} from '../../types/skills';
|
|
2
|
+
|
|
3
|
+
export const RECEIVED_SKILLS = '@@data/skills/RECEIVED_SKILLS';
|
|
4
|
+
export const ERROR_FETCHING_SKILLS = '@@data/skills/ERROR_FETCHING_SKILLS';
|
|
5
|
+
|
|
6
|
+
export type ReceivedSkills = {
|
|
7
|
+
type: '@@data/skills/RECEIVED_SKILLS';
|
|
8
|
+
payload: Skills;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type ErrorFetchingSkills = {
|
|
12
|
+
type: '@@data/skills/ERROR_FETCHING_SKILLS';
|
|
13
|
+
payload: Error;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const receivedSkills = (skills: Skills): ReceivedSkills => ({
|
|
17
|
+
type: RECEIVED_SKILLS,
|
|
18
|
+
payload: skills
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const errorFetchingSkills = (error: Error): ErrorFetchingSkills => ({
|
|
22
|
+
type: ERROR_FETCHING_SKILLS,
|
|
23
|
+
payload: error
|
|
24
|
+
});
|