@coorpacademy/app-review 0.1.5 → 0.1.8
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/api/fetch-skills.d.ts +10 -0
- package/es/actions/api/fetch-skills.js +8 -0
- package/es/actions/api/fetch-slide.d.ts +10 -0
- package/es/actions/api/fetch-slide.js +8 -0
- package/es/actions/api/post-progression.d.ts +10 -0
- package/es/actions/api/post-progression.js +15 -0
- package/es/actions/data/slides.d.ts +7 -24
- package/es/actions/data/slides.js +0 -6
- package/es/actions/data/token.d.ts +2 -2
- package/es/actions/data/token.js +1 -1
- package/es/actions/index.d.ts +5 -3
- package/es/actions/ui/navigation.d.ts +0 -1
- package/es/actions/ui/navigation.js +0 -4
- package/es/actions/ui/step-items.d.ts +2 -8
- package/es/actions/ui/step-items.js +0 -6
- package/es/configure-store.d.ts +3 -34
- package/es/configure-store.js +4 -4
- package/es/fixtures/qcm-slide.d.ts +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +78 -42
- package/es/reducers/data/index.d.ts +16 -5
- package/es/reducers/data/progression.d.ts +14 -9
- package/es/reducers/data/progression.js +18 -58
- package/es/reducers/data/skills.d.ts +4 -5
- package/es/reducers/data/skills.js +3 -6
- package/es/reducers/data/slides.d.ts +2 -1
- package/es/reducers/data/slides.js +14 -9
- package/es/reducers/data/token.d.ts +0 -1
- package/es/reducers/data/token.js +1 -5
- package/es/reducers/index.d.ts +9 -3
- package/es/reducers/ui/finished-slides.d.ts +0 -1
- package/es/reducers/ui/finished-slides.js +1 -3
- package/es/reducers/ui/index.d.ts +14 -4
- package/es/reducers/ui/navigation.d.ts +0 -1
- package/es/reducers/ui/navigation.js +1 -3
- package/es/reducers/ui/review-status.d.ts +0 -1
- package/es/reducers/ui/review-status.js +1 -4
- package/es/reducers/ui/step-items.d.ts +5 -5
- package/es/reducers/ui/step-items.js +0 -1
- package/es/services/fetch-skills.d.ts +2 -8
- package/es/services/fetch-skills.js +3 -16
- package/es/services/fetch-slide.d.ts +2 -0
- package/es/services/fetch-slide.js +11 -0
- package/es/services/index.d.ts +2 -0
- package/es/services/index.js +8 -0
- package/es/services/post-progression.d.ts +2 -0
- package/es/services/post-progression.js +21 -0
- package/es/services/test/fetch-skills.test.js +29 -0
- package/es/services/test/post-progression.test.js +35 -0
- package/es/services/tools/fetch-responses.d.ts +1 -1
- package/es/services/tools/sleep.d.ts +1 -0
- package/es/services/tools/sleep.js +3 -0
- package/es/{index.test.js → test/index.test.js} +18 -7
- package/es/test/util/services.mock.d.ts +2 -0
- package/es/test/util/services.mock.js +68 -0
- package/es/types/common.d.ts +66 -2
- package/es/types/common.js +5 -0
- package/es/types/slides.d.ts +1 -1
- package/es/types/ui-progression.d.ts +10 -0
- package/es/types/views/slides.d.ts +1 -1
- package/lib/actions/api/fetch-skills.d.ts +10 -0
- package/lib/actions/api/fetch-skills.js +13 -0
- package/lib/actions/api/fetch-slide.d.ts +10 -0
- package/lib/actions/api/fetch-slide.js +13 -0
- package/lib/actions/api/post-progression.d.ts +10 -0
- package/lib/actions/api/post-progression.js +18 -0
- package/lib/actions/data/slides.d.ts +7 -24
- package/lib/actions/data/slides.js +0 -6
- package/lib/actions/data/token.d.ts +2 -2
- package/lib/actions/data/token.js +1 -1
- package/lib/actions/index.d.ts +5 -3
- package/lib/actions/ui/navigation.d.ts +0 -1
- package/lib/actions/ui/navigation.js +0 -4
- package/lib/actions/ui/step-items.d.ts +2 -8
- package/lib/actions/ui/step-items.js +0 -6
- package/lib/configure-store.d.ts +3 -34
- package/lib/configure-store.js +4 -4
- package/lib/fixtures/qcm-slide.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +78 -86
- package/lib/reducers/data/index.d.ts +16 -5
- package/lib/reducers/data/progression.d.ts +14 -9
- package/lib/reducers/data/progression.js +18 -58
- package/lib/reducers/data/skills.d.ts +4 -5
- package/lib/reducers/data/skills.js +3 -6
- package/lib/reducers/data/slides.d.ts +2 -1
- package/lib/reducers/data/slides.js +14 -9
- package/lib/reducers/data/token.d.ts +0 -1
- package/lib/reducers/data/token.js +1 -5
- package/lib/reducers/index.d.ts +9 -3
- package/lib/reducers/ui/finished-slides.d.ts +0 -1
- package/lib/reducers/ui/finished-slides.js +1 -3
- package/lib/reducers/ui/index.d.ts +14 -4
- package/lib/reducers/ui/navigation.d.ts +0 -1
- package/lib/reducers/ui/navigation.js +1 -3
- package/lib/reducers/ui/review-status.d.ts +0 -1
- package/lib/reducers/ui/review-status.js +1 -4
- package/lib/reducers/ui/step-items.d.ts +5 -5
- package/lib/reducers/ui/step-items.js +0 -1
- package/lib/services/fetch-skills.d.ts +2 -8
- package/lib/services/fetch-skills.js +5 -20
- package/lib/services/fetch-slide.d.ts +2 -0
- package/lib/services/fetch-slide.js +57 -0
- package/lib/services/index.d.ts +2 -0
- package/lib/services/index.js +8 -0
- package/lib/services/post-progression.d.ts +2 -0
- package/lib/services/post-progression.js +65 -0
- package/lib/services/{fetch-skills.test.js → test/fetch-skills.test.js} +23 -16
- package/lib/services/test/post-progression.test.js +89 -0
- package/lib/services/tools/fetch-responses.d.ts +1 -1
- package/lib/services/tools/sleep.d.ts +1 -0
- package/lib/services/tools/sleep.js +5 -0
- package/lib/test/index.test.d.ts +1 -0
- package/lib/{index.test.js → test/index.test.js} +23 -15
- package/lib/test/util/services.mock.d.ts +2 -0
- package/lib/test/util/services.mock.js +68 -0
- package/lib/types/common.d.ts +66 -2
- package/lib/types/common.js +5 -0
- package/lib/types/slides.d.ts +1 -1
- package/lib/types/ui-progression.d.ts +10 -0
- package/lib/types/ui-progression.js +1 -0
- package/lib/types/views/slides.d.ts +1 -1
- package/package.json +6 -5
- package/readme.md +4 -5
- package/src/actions/api/fetch-skills.ts +20 -0
- package/src/actions/api/fetch-slide.ts +20 -0
- package/src/actions/api/post-progression.ts +26 -0
- package/src/actions/data/slides.ts +8 -32
- package/src/actions/data/token.ts +2 -2
- package/src/actions/index.ts +7 -10
- package/src/actions/ui/navigation.ts +0 -5
- package/src/actions/ui/step-items.ts +2 -14
- package/src/configure-store.ts +6 -45
- package/src/fixtures/qcm-slide.ts +2 -2
- package/src/index.tsx +94 -45
- package/src/reducers/data/index.ts +12 -4
- package/src/reducers/data/progression.ts +34 -79
- package/src/reducers/data/skills.ts +5 -10
- package/src/reducers/data/slides.ts +16 -15
- package/src/reducers/data/token.ts +1 -11
- package/src/reducers/index.ts +7 -2
- package/src/reducers/ui/finished-slides.ts +1 -7
- package/src/reducers/ui/index.ts +11 -4
- package/src/reducers/ui/navigation.ts +1 -6
- package/src/reducers/ui/review-status.ts +1 -8
- package/src/reducers/ui/step-items.ts +5 -14
- package/src/services/fetch-skills.ts +4 -30
- package/src/services/fetch-slide.ts +15 -0
- package/src/services/index.ts +10 -0
- package/src/services/post-progression.ts +28 -0
- package/src/services/test/fetch-skills.test.ts +39 -0
- package/src/services/test/post-progression.test.ts +45 -0
- package/src/services/tools/fetch-responses.ts +1 -1
- package/src/services/tools/sleep.ts +4 -0
- package/src/{index.test.tsx → test/index.test.tsx} +16 -10
- package/src/test/util/services.mock.ts +70 -0
- package/src/types/common.ts +78 -2
- package/src/types/globals.d.ts +2 -0
- package/src/types/slides.ts +1 -1
- package/src/types/ui-progression.ts +25 -0
- package/src/types/views/slides.ts +1 -1
- package/es/actions/data/skills.d.ts +0 -13
- package/es/actions/data/skills.js +0 -10
- package/es/middlewares/on-start-app.d.ts +0 -5
- package/es/middlewares/on-start-app.js +0 -29
- package/es/services/fetch-skills.mock.d.ts +0 -3
- package/es/services/fetch-skills.mock.js +0 -17
- package/es/services/fetch-skills.test.js +0 -22
- package/es/services/tools/fetch.mocks.d.ts +0 -8
- package/es/services/tools/fetch.mocks.js +0 -13
- package/es/types/skills.d.ts +0 -7
- package/lib/actions/data/skills.d.ts +0 -13
- package/lib/actions/data/skills.js +0 -10
- package/lib/middlewares/on-start-app.d.ts +0 -5
- package/lib/middlewares/on-start-app.js +0 -34
- package/lib/services/fetch-skills.mock.d.ts +0 -3
- package/lib/services/fetch-skills.mock.js +0 -17
- package/lib/services/tools/fetch.mocks.d.ts +0 -8
- package/lib/services/tools/fetch.mocks.js +0 -35
- package/lib/types/skills.d.ts +0 -7
- package/src/actions/data/skills.ts +0 -24
- package/src/middlewares/on-start-app.ts +0 -42
- package/src/services/fetch-skills.mock.ts +0 -21
- package/src/services/fetch-skills.test.ts +0 -32
- package/src/services/tools/fetch.mocks.ts +0 -41
- package/src/types/skills.ts +0 -8
- /package/es/services/{fetch-skills.test.d.ts → test/fetch-skills.test.d.ts} +0 -0
- /package/es/{index.test.d.ts → services/test/post-progression.test.d.ts} +0 -0
- /package/{lib → es/test}/index.test.d.ts +0 -0
- /package/es/types/{skills.js → ui-progression.js} +0 -0
- /package/lib/services/{fetch-skills.test.d.ts → test/fetch-skills.test.d.ts} +0 -0
- /package/lib/{types/skills.js → services/test/post-progression.test.d.ts} +0 -0
package/es/types/common.js
CHANGED
package/es/types/slides.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Action } from 'redux';
|
|
2
|
+
import { Skill } from '../../types/common';
|
|
3
|
+
export declare const SKILLS_FETCH_REQUEST: "@@skills/FETCH_REQUEST";
|
|
4
|
+
export declare const SKILLS_FETCH_SUCCESS: "@@skills/FETCH_SUCCESS";
|
|
5
|
+
export declare const SKILLS_FETCH_FAILURE: "@@skills/FETCH_FAILURE";
|
|
6
|
+
export declare type ReceivedSkills = {
|
|
7
|
+
type: '@@skills/FETCH_SUCCESS';
|
|
8
|
+
payload: Skill[];
|
|
9
|
+
};
|
|
10
|
+
export declare const fetchSkills: (token: string) => Action;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import buildTask from '@coorpacademy/redux-task';
|
|
2
|
+
export var SKILLS_FETCH_REQUEST = '@@skills/FETCH_REQUEST';
|
|
3
|
+
export var SKILLS_FETCH_SUCCESS = '@@skills/FETCH_SUCCESS';
|
|
4
|
+
export var SKILLS_FETCH_FAILURE = '@@skills/FETCH_FAILURE';
|
|
5
|
+
export var fetchSkills = function (token) {
|
|
6
|
+
return buildTask({
|
|
7
|
+
types: [SKILLS_FETCH_REQUEST, SKILLS_FETCH_SUCCESS, SKILLS_FETCH_FAILURE],
|
|
8
|
+
task: function (dispatch, getState, _a) {
|
|
9
|
+
var services = _a.services;
|
|
10
|
+
return services.fetchSkills(token);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Action } from 'redux';
|
|
2
|
+
import { SlideFromAPI } from '../../types/common';
|
|
3
|
+
export declare const SLIDE_FETCH_REQUEST: "@@slides/FETCH_REQUEST";
|
|
4
|
+
export declare const SLIDE_FETCH_SUCCESS: "@@slides/FETCH_SUCCESS";
|
|
5
|
+
export declare const SLIDE_FETCH_FAILURE: "@@slides/FETCH_FAILURE";
|
|
6
|
+
export declare type ReceivedSlide = {
|
|
7
|
+
type: typeof SLIDE_FETCH_SUCCESS;
|
|
8
|
+
payload: SlideFromAPI;
|
|
9
|
+
};
|
|
10
|
+
export declare const fetchSlide: (slideRef: string, token: string) => Action;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import buildTask from '@coorpacademy/redux-task';
|
|
2
|
+
export var SLIDE_FETCH_REQUEST = '@@slides/FETCH_REQUEST';
|
|
3
|
+
export var SLIDE_FETCH_SUCCESS = '@@slides/FETCH_SUCCESS';
|
|
4
|
+
export var SLIDE_FETCH_FAILURE = '@@slides/FETCH_FAILURE';
|
|
5
|
+
export var fetchSlide = function (slideRef, token) {
|
|
6
|
+
return buildTask({
|
|
7
|
+
types: [SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS, SLIDE_FETCH_FAILURE],
|
|
8
|
+
task: function (dispatch, getState, _a) {
|
|
9
|
+
var services = _a.services;
|
|
10
|
+
return services.fetchSlide(slideRef, token);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Action } from 'redux';
|
|
2
|
+
import { ProgressionFromAPI } from '../../types/common';
|
|
3
|
+
export declare const POST_PROGRESSION_REQUEST: "@@progression/POST_REQUEST";
|
|
4
|
+
export declare const POST_PROGRESSION_SUCCESS: "@@progression/POST_SUCCESS";
|
|
5
|
+
export declare const POST_PROGRESSION_FAILURE: "@@progression/POST_FAILURE";
|
|
6
|
+
export declare type ReceiveProgression = {
|
|
7
|
+
type: typeof POST_PROGRESSION_SUCCESS;
|
|
8
|
+
payload: ProgressionFromAPI;
|
|
9
|
+
};
|
|
10
|
+
export declare const postProgression: (skillRef: string, token: string) => Action;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import buildTask from '@coorpacademy/redux-task';
|
|
2
|
+
import { fetchSlide } from './fetch-slide';
|
|
3
|
+
export var POST_PROGRESSION_REQUEST = '@@progression/POST_REQUEST';
|
|
4
|
+
export var POST_PROGRESSION_SUCCESS = '@@progression/POST_SUCCESS';
|
|
5
|
+
export var POST_PROGRESSION_FAILURE = '@@progression/POST_FAILURE';
|
|
6
|
+
export var postProgression = function (skillRef, token) {
|
|
7
|
+
return buildTask({
|
|
8
|
+
types: [POST_PROGRESSION_REQUEST, POST_PROGRESSION_SUCCESS, POST_PROGRESSION_FAILURE],
|
|
9
|
+
task: function (dispatch, getState, _a) {
|
|
10
|
+
var services = _a.services;
|
|
11
|
+
return services.postProgression(skillRef, token).then(function (progression) {
|
|
12
|
+
var ref = progression.state.nextContent.ref;
|
|
13
|
+
dispatch(fetchSlide(ref, token));
|
|
14
|
+
return progression;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -1,36 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { UISlide } from '../../types/slides';
|
|
2
|
+
import { ReceivedSlide } from '../api/fetch-slide';
|
|
3
3
|
export declare const UPDATE_SLIDES_ON_VALIDATION = "@@slide/UPDATE_SLIDES_ON_VALIDATION";
|
|
4
4
|
export declare const UPDATE_SLIDES_ON_NEXT = "@@slide/UPDATE_SLIDES_ON_NEXT";
|
|
5
5
|
export declare const VALIDATE_SLIDE = "@@slide/VALIDATE";
|
|
6
|
-
export declare const FETCH_NEXT_CONTENT = "@@slide/FETCH_NEXT_CONTENT";
|
|
7
6
|
declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
8
|
-
export declare type Slide =
|
|
7
|
+
export declare type Slide = UISlide & {
|
|
9
8
|
hidden?: boolean;
|
|
10
9
|
position: number;
|
|
11
10
|
animationType?: SlideUIAnimations;
|
|
12
11
|
isCorrect?: boolean;
|
|
13
12
|
endReview?: boolean;
|
|
14
|
-
|
|
13
|
+
nextContent?: Omit<Slide, 'endReview' | 'hidden' | 'position' | 'nextContent'>;
|
|
15
14
|
};
|
|
16
15
|
export declare type ValidationPayload = {
|
|
17
16
|
slideNumber: number;
|
|
18
17
|
newSlideContent: Slide;
|
|
19
18
|
numberOfFinishedSlides: number;
|
|
20
|
-
|
|
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;
|
|
19
|
+
nextContent: Slide;
|
|
33
20
|
};
|
|
21
|
+
export declare type OnNextPayload = Omit<ValidationPayload, 'nextContent'>;
|
|
34
22
|
export declare type UpdateSlidesOnValidation = {
|
|
35
23
|
type: typeof UPDATE_SLIDES_ON_VALIDATION;
|
|
36
24
|
payload: ValidationPayload;
|
|
@@ -42,12 +30,7 @@ export declare type UpdateSlidesOnNext = {
|
|
|
42
30
|
export declare type ValidateSlide = {
|
|
43
31
|
type: typeof VALIDATE_SLIDE;
|
|
44
32
|
};
|
|
45
|
-
export declare type
|
|
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;
|
|
33
|
+
export declare type SlidesAction = ReceivedSlide | UpdateSlidesOnValidation | UpdateSlidesOnNext;
|
|
51
34
|
export declare const updateSlidesOnValidation: (payload: ValidationPayload) => UpdateSlidesOnValidation;
|
|
52
35
|
export declare const updateSlidesOnNext: (payload: OnNextPayload) => UpdateSlidesOnNext;
|
|
53
36
|
export declare const validateSlide: () => ValidateSlide;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
// -----------------------------------------------------------------------------
|
|
2
|
-
export var STORE_FIRST_SLIDE = '@@slide/STORE_FIRST_SLIDE';
|
|
3
2
|
export var UPDATE_SLIDES_ON_VALIDATION = '@@slide/UPDATE_SLIDES_ON_VALIDATION';
|
|
4
3
|
export var UPDATE_SLIDES_ON_NEXT = '@@slide/UPDATE_SLIDES_ON_NEXT';
|
|
5
4
|
export var VALIDATE_SLIDE = '@@slide/VALIDATE';
|
|
6
|
-
export var FETCH_NEXT_CONTENT = '@@slide/FETCH_NEXT_CONTENT';
|
|
7
5
|
// -----------------------------------------------------------------------------
|
|
8
|
-
export var storeFirstSlide = function (slide) { return ({
|
|
9
|
-
type: STORE_FIRST_SLIDE,
|
|
10
|
-
payload: slide
|
|
11
|
-
}); };
|
|
12
6
|
export var updateSlidesOnValidation = function (payload) { return ({
|
|
13
7
|
type: UPDATE_SLIDES_ON_VALIDATION,
|
|
14
8
|
payload: payload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const STORE_TOKEN = "@@token/STORE_TOKEN";
|
|
1
|
+
export declare const STORE_TOKEN = "@@data/token/STORE_TOKEN";
|
|
2
2
|
export declare type StoreToken = {
|
|
3
|
-
type:
|
|
3
|
+
type: typeof STORE_TOKEN;
|
|
4
4
|
payload: string;
|
|
5
5
|
};
|
|
6
6
|
export declare const storeToken: (token: string) => StoreToken;
|
package/lib/actions/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ErrorFetchingSkills, ReceivedSkills } from './data/skills';
|
|
1
|
+
import { updateSlidesOnValidation, updateSlidesOnNext, validateSlide } from './data/slides';
|
|
3
2
|
import { StoreToken } from './data/token';
|
|
4
3
|
import { updateFinishedSlides } from './ui/finished-slides';
|
|
5
4
|
import { navigateBack, navigateTo, NavigateBack, NavigateTo, StartApp } from './ui/navigation';
|
|
6
5
|
import { updateReviewStatus } from './ui/review-status';
|
|
7
6
|
import { updateStepItemsOnValidation, updateStepItemsOnNext } from './ui/step-items';
|
|
8
|
-
|
|
7
|
+
import { ReceivedSlide } from './api/fetch-slide';
|
|
8
|
+
import { ReceiveProgression } from './api/post-progression';
|
|
9
|
+
import { ReceivedSkills } from './api/fetch-skills';
|
|
10
|
+
export declare type Action = NavigateBack | NavigateTo | ReceivedSkills | StartApp | ReceivedSlide | StoreToken | ReceiveProgression;
|
|
9
11
|
export declare type Dispatchers = {
|
|
10
12
|
navigateTo: typeof navigateTo;
|
|
11
13
|
navigateBack: typeof navigateBack;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FinishedSlides, IconValue } from '../../types/common';
|
|
2
2
|
export declare const UPDATE_STEP_ITEMS_ON_VALIDATION = "@@step-items/UPDATE_STEP_ITEMS_ON_VALIDATION";
|
|
3
3
|
export declare const UPDATE_STEP_ITEMS_ON_NEXT = "@@step-items/UPDATE_STEP_ITEMS_ON_NEXT";
|
|
4
|
-
declare const ICON_VALUES: {
|
|
5
|
-
readonly right: "right";
|
|
6
|
-
readonly wrong: "wrong";
|
|
7
|
-
readonly 'no-answer': "no-answer";
|
|
8
|
-
};
|
|
9
|
-
export declare type IconValue = keyof typeof ICON_VALUES;
|
|
10
4
|
declare type UpdateStepItemsOnValidationClickPayload = {
|
|
11
5
|
stepNumber: number;
|
|
12
6
|
icon: IconValue;
|
|
13
7
|
};
|
|
14
8
|
declare type UpdateStepItemsOnNextClickPayload = {
|
|
15
9
|
stepNumber: number;
|
|
16
|
-
finishedSlides:
|
|
10
|
+
finishedSlides: FinishedSlides;
|
|
17
11
|
current: boolean;
|
|
18
12
|
};
|
|
19
13
|
export declare type UpdateStepItemsOnValidation = {
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
// -----------------------------------------------------------------------------
|
|
2
1
|
export var UPDATE_STEP_ITEMS_ON_VALIDATION = '@@step-items/UPDATE_STEP_ITEMS_ON_VALIDATION';
|
|
3
2
|
export var UPDATE_STEP_ITEMS_ON_NEXT = '@@step-items/UPDATE_STEP_ITEMS_ON_NEXT';
|
|
4
|
-
var ICON_VALUES = {
|
|
5
|
-
right: 'right',
|
|
6
|
-
wrong: 'wrong',
|
|
7
|
-
'no-answer': 'no-answer'
|
|
8
|
-
};
|
|
9
3
|
// -----------------------------------------------------------------------------
|
|
10
4
|
export var updateStepItemsOnValidation = function (payload) { return ({
|
|
11
5
|
type: UPDATE_STEP_ITEMS_ON_VALIDATION,
|
package/lib/configure-store.d.ts
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
import { AnyAction, Store } from 'redux';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { NavigationState } from './reducers/ui/navigation';
|
|
6
|
-
import { ReviewStatusState } from './reducers/ui/review-status';
|
|
7
|
-
import { StepItemsState } from './reducers/ui/step-items';
|
|
8
|
-
import { FinishedSlidesState } from './reducers/ui/finished-slides';
|
|
9
|
-
import { AnswerUI } from './types/slides';
|
|
10
|
-
declare type DataState = {
|
|
11
|
-
isFetching?: boolean;
|
|
12
|
-
progression?: {
|
|
13
|
-
slideNumber: number;
|
|
14
|
-
isCorrect?: boolean;
|
|
15
|
-
exitNode?: 'successExitNode' | 'failExitNode';
|
|
16
|
-
nextSlide?: {
|
|
17
|
-
questionText?: string;
|
|
18
|
-
answerUI?: AnswerUI;
|
|
19
|
-
};
|
|
20
|
-
} | null;
|
|
21
|
-
skills: SkillsState;
|
|
22
|
-
slides: SlidesState;
|
|
23
|
-
token?: TokenState;
|
|
24
|
-
};
|
|
25
|
-
export declare type StoreState = {
|
|
26
|
-
ui: {
|
|
27
|
-
navigation: NavigationState;
|
|
28
|
-
stepItems: StepItemsState;
|
|
29
|
-
finishedSlides: FinishedSlidesState;
|
|
30
|
-
reviewStatus: ReviewStatusState;
|
|
31
|
-
};
|
|
32
|
-
data: DataState;
|
|
33
|
-
};
|
|
34
|
-
export default function configureStore(): Store<StoreState, AnyAction>;
|
|
35
|
-
export {};
|
|
2
|
+
import { StoreState } from './reducers';
|
|
3
|
+
import { AppOptions } from './types/common';
|
|
4
|
+
export default function configureStore(options: AppOptions): Store<StoreState, AnyAction>;
|
package/lib/configure-store.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { applyMiddleware, compose, createStore } from 'redux';
|
|
2
2
|
import thunk from 'redux-thunk';
|
|
3
3
|
import rootReducer from './reducers';
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export default function configureStore() {
|
|
4
|
+
import { getServices } from './services';
|
|
5
|
+
export default function configureStore(options) {
|
|
7
6
|
var _compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
8
7
|
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
|
9
8
|
name: 'app-review',
|
|
@@ -11,7 +10,8 @@ export default function configureStore() {
|
|
|
11
10
|
traceLimit: 25
|
|
12
11
|
})
|
|
13
12
|
: compose;
|
|
14
|
-
var
|
|
13
|
+
var thunkMiddleware = thunk.withExtraArgument({ services: options.services || getServices() });
|
|
14
|
+
var enhancer = _compose(applyMiddleware(thunkMiddleware));
|
|
15
15
|
var store = createStore(rootReducer, undefined, enhancer);
|
|
16
16
|
return store;
|
|
17
17
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const slide:
|
|
1
|
+
import { UISlide } from '../types/slides';
|
|
2
|
+
export declare const slide: UISlide;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,49 +1,18 @@
|
|
|
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 React, { useEffect, useState } from 'react';
|
|
38
2
|
import { connect, Provider } from 'react-redux';
|
|
39
3
|
import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
|
|
4
|
+
import { TemplateContext } from '@coorpacademy/components/es/template/app-review/template-context';
|
|
40
5
|
import configureStore from './configure-store';
|
|
41
6
|
import { congratsProps, correctionPopinProps } from './fixtures/temp-fixture';
|
|
42
7
|
import { updateSlidesOnNext, updateSlidesOnValidation, validateSlide } from './actions/data/slides';
|
|
43
|
-
import { navigateTo, navigateBack
|
|
8
|
+
import { navigateTo, navigateBack } from './actions/ui/navigation';
|
|
9
|
+
import { storeToken } from './actions/data/token';
|
|
44
10
|
import { updateFinishedSlides } from './actions/ui/finished-slides';
|
|
45
11
|
import { updateReviewStatus } from './actions/ui/review-status';
|
|
46
12
|
import { updateStepItemsOnValidation, updateStepItemsOnNext } from './actions/ui/step-items';
|
|
13
|
+
import { fetchSkills } from './actions/api/fetch-skills';
|
|
14
|
+
import { postProgression } from './actions/api/post-progression';
|
|
15
|
+
import { VIEWS } from './common';
|
|
47
16
|
// -----------------------------------------------------------------------------
|
|
48
17
|
var mapDispatchToProps = {
|
|
49
18
|
navigateTo: navigateTo,
|
|
@@ -59,29 +28,38 @@ var mapDispatchToProps = {
|
|
|
59
28
|
var getCurrentViewName = function (storeState) {
|
|
60
29
|
return storeState.ui.navigation[storeState.ui.navigation.length - 1];
|
|
61
30
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
31
|
+
// -----------------------------------------------------------------------------
|
|
32
|
+
var mapStateToSkillsProps = function (state) {
|
|
33
|
+
if (!state.data.skills) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
title: '@todo title',
|
|
38
|
+
titleNoSkills: '@todo titleNoSkills',
|
|
39
|
+
textNoSkills: '@todo textNoSkills',
|
|
40
|
+
iconSkillAriaLabel: '@todo iconSkillAriaLabel',
|
|
41
|
+
isLoading: false,
|
|
42
|
+
isLoadingAriaLabel: '@todo loading',
|
|
43
|
+
listSkills: state.data.skills.map(function (skill) { return ({
|
|
44
|
+
'aria-label': '',
|
|
45
|
+
isCustom: skill.custom,
|
|
46
|
+
skillTitle: skill.name,
|
|
47
|
+
skillAriaLabel: '@todo skill aria label',
|
|
48
|
+
buttonLabel: '@todo button',
|
|
49
|
+
buttonAriaLabel: '@todo button aria label',
|
|
50
|
+
reviseLabel: '@todo revise',
|
|
51
|
+
reviseAriaLabel: '@todo revise aria label',
|
|
52
|
+
// eslint-disable-next-line no-console
|
|
53
|
+
onClick: function () { return console.log('@todo plug dispatcher select skill'); }
|
|
54
|
+
}); })
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
// -----------------------------------------------------------------------------
|
|
58
|
+
var mapStateToSlidesProps = function (state) {
|
|
59
|
+
if (!state.data.slides) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
85
63
|
headerProps: {
|
|
86
64
|
mode: '__revision_mode',
|
|
87
65
|
skillName: '__agility',
|
|
@@ -102,41 +80,55 @@ var mapStateToProps = function (state) { return ({
|
|
|
102
80
|
correctionPopinProps: correctionPopinProps,
|
|
103
81
|
congratsProps: congratsProps,
|
|
104
82
|
progression: state.data.progression
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
// -----------------------------------------------------------------------------
|
|
86
|
+
var mapStateToProps = function (state) {
|
|
87
|
+
return {
|
|
88
|
+
viewName: getCurrentViewName(state),
|
|
89
|
+
slides: mapStateToSlidesProps(state),
|
|
90
|
+
skills: mapStateToSkillsProps(state)
|
|
91
|
+
};
|
|
92
|
+
};
|
|
108
93
|
// Props = StaticProps && Dispatchers
|
|
109
94
|
var App = connect(mapStateToProps, mapDispatchToProps)(AppReviewTemplate);
|
|
110
95
|
// -----------------------------------------------------------------------------
|
|
111
96
|
var AppReview = function (_a) {
|
|
112
97
|
var options = _a.options;
|
|
113
98
|
var _b = useState(null), store = _b[0], setStore = _b[1];
|
|
114
|
-
var _c = useState(false), appStarted = _c[0], setAppStarted = _c[1];
|
|
115
99
|
useEffect(function () {
|
|
116
|
-
if (store)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
100
|
+
if (store)
|
|
101
|
+
return;
|
|
102
|
+
var newStore = configureStore(options);
|
|
103
|
+
setStore(newStore);
|
|
104
|
+
}, [options, store]);
|
|
105
|
+
useEffect(function () {
|
|
106
|
+
if (store === null)
|
|
107
|
+
return;
|
|
108
|
+
var skillRef = options.skillRef;
|
|
109
|
+
var initialView = skillRef ? VIEWS.slides : VIEWS.skills;
|
|
110
|
+
store.dispatch(navigateTo(initialView));
|
|
111
|
+
}, [options, store]);
|
|
112
|
+
useEffect(function () {
|
|
113
|
+
if (store === null)
|
|
114
|
+
return;
|
|
115
|
+
var token = options.token;
|
|
116
|
+
store.dispatch(storeToken(token));
|
|
117
|
+
}, [options, store]);
|
|
118
|
+
useEffect(function () {
|
|
119
|
+
if (store === null)
|
|
120
|
+
return;
|
|
121
|
+
var skillRef = options.skillRef, token = options.token;
|
|
122
|
+
skillRef
|
|
123
|
+
? store.dispatch(postProgression(skillRef, token))
|
|
124
|
+
: store.dispatch(fetchSkills(token));
|
|
135
125
|
}, [options, store]);
|
|
136
|
-
if (!store
|
|
137
|
-
return
|
|
126
|
+
if (!store)
|
|
127
|
+
return null;
|
|
128
|
+
var values = options.templateContext;
|
|
138
129
|
return (React.createElement(Provider, { store: store },
|
|
139
|
-
React.createElement(
|
|
130
|
+
React.createElement(TemplateContext, { values: values },
|
|
131
|
+
React.createElement(App, null))));
|
|
140
132
|
};
|
|
141
133
|
// -----------------------------------------------------------------------------
|
|
142
134
|
export default AppReview;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { ProgressionState } from './progression';
|
|
2
|
+
import { SkillsState } from './skills';
|
|
3
|
+
import { SlidesState } from './slides';
|
|
4
|
+
import { TokenState } from './token';
|
|
5
|
+
export declare type DataState = {
|
|
6
|
+
isFetching?: boolean;
|
|
7
|
+
progression?: ProgressionState;
|
|
8
|
+
skills: SkillsState;
|
|
9
|
+
slides: SlidesState;
|
|
10
|
+
token?: TokenState;
|
|
11
|
+
};
|
|
1
12
|
declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
2
|
-
progression:
|
|
3
|
-
skills:
|
|
4
|
-
slides:
|
|
5
|
-
token:
|
|
6
|
-
}>, import("../../actions/data/slides").ValidateSlide | import("../../actions/data/slides").SlidesAction | import("../../actions/
|
|
13
|
+
progression: ProgressionState;
|
|
14
|
+
skills: SkillsState;
|
|
15
|
+
slides: SlidesState;
|
|
16
|
+
token: TokenState;
|
|
17
|
+
}>, import("../../actions/data/slides").ValidateSlide | import("../../actions/data/slides").SlidesAction | import("../../actions/api/post-progression").ReceiveProgression | import("../../actions/api/fetch-skills").ReceivedSkills | import("../../actions/data/token").StoreToken>;
|
|
7
18
|
export default _default;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { ValidateSlide } from '../../actions/data/slides';
|
|
2
|
-
import {
|
|
2
|
+
import { ReceiveProgression } from '../../actions/api/post-progression';
|
|
3
3
|
export declare type ProgressionState = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
_id?: string;
|
|
5
|
+
state: {
|
|
6
|
+
isCorrect: boolean;
|
|
7
|
+
nextContent: {
|
|
8
|
+
ref: 'successExitNode' | string;
|
|
9
|
+
type: 'success' | 'slide';
|
|
10
|
+
};
|
|
11
|
+
pendingSlides: string[];
|
|
12
|
+
step: {
|
|
13
|
+
current: number;
|
|
14
|
+
};
|
|
10
15
|
};
|
|
16
|
+
slideNumber?: number;
|
|
11
17
|
} | null;
|
|
12
|
-
|
|
13
|
-
declare const reducer: (state: ProgressionState | undefined, action: ValidateSlide) => ProgressionState;
|
|
18
|
+
declare const reducer: (state: ProgressionState | undefined, action: ValidateSlide | ReceiveProgression) => ProgressionState;
|
|
14
19
|
export default reducer;
|