@coorpacademy/app-review 0.5.7-alpha.0 → 0.6.1-alpha.0
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-correction.d.ts +2 -2
- package/es/actions/api/fetch-rank.d.ts +3 -3
- package/es/actions/api/fetch-skills.d.ts +2 -2
- package/es/actions/api/fetch-slide.d.ts +2 -2
- package/es/actions/api/post-answer.d.ts +2 -2
- package/es/actions/api/post-progression.d.ts +2 -2
- package/es/actions/ui/navigation.d.ts +11 -10
- package/es/actions/ui/navigation.js +23 -7
- package/es/common/index.d.ts +0 -5
- package/es/common/index.js +0 -5
- package/es/configure-store.js +5 -1
- package/es/index.js +3 -3
- package/es/reducers/index.d.ts +1 -1
- package/es/reducers/ui/index.d.ts +1 -1
- package/es/reducers/ui/navigation.d.ts +2 -2
- package/es/reducers/ui/navigation.js +1 -1
- package/es/types/common.d.ts +7 -4
- package/es/views/skills/index.d.ts +1 -3
- package/es/views/skills/index.js +0 -2
- package/es/views/slides/index.d.ts +4 -112
- package/es/views/slides/index.js +6 -4
- package/lib/actions/api/fetch-correction.d.ts +2 -2
- package/lib/actions/api/fetch-correction.js +22 -16
- package/lib/actions/api/fetch-rank.d.ts +3 -3
- package/lib/actions/api/fetch-rank.js +33 -28
- package/lib/actions/api/fetch-skills.d.ts +2 -2
- package/lib/actions/api/fetch-skills.js +18 -12
- package/lib/actions/api/fetch-slide.d.ts +2 -2
- package/lib/actions/api/fetch-slide.js +35 -78
- package/lib/actions/api/post-answer.d.ts +2 -2
- package/lib/actions/api/post-answer.js +40 -89
- package/lib/actions/api/post-progression.d.ts +2 -2
- package/lib/actions/api/post-progression.js +24 -69
- package/lib/actions/data/token.js +8 -4
- package/lib/actions/ui/answers.js +45 -49
- package/lib/actions/ui/navigation.d.ts +11 -10
- package/lib/actions/ui/navigation.js +31 -10
- package/lib/actions/ui/next-slide.js +21 -14
- package/lib/actions/ui/quit-popin.js +9 -6
- package/lib/actions/ui/slides.js +9 -5
- package/lib/common/index.d.ts +0 -5
- package/lib/common/index.js +13 -11
- package/lib/configure-store.js +20 -10
- package/lib/helpers/css-register.js +7 -2
- package/lib/index.js +73 -58
- package/lib/reducers/data/corrections.js +18 -14
- package/lib/reducers/data/index.js +13 -8
- package/lib/reducers/data/progression.js +10 -9
- package/lib/reducers/data/rank.js +19 -15
- package/lib/reducers/data/skills.js +6 -5
- package/lib/reducers/data/slides.js +17 -12
- package/lib/reducers/data/token.js +6 -5
- package/lib/reducers/index.d.ts +1 -1
- package/lib/reducers/index.js +11 -6
- package/lib/reducers/ui/answers.js +19 -17
- package/lib/reducers/ui/current-slide-ref.js +9 -8
- package/lib/reducers/ui/index.d.ts +1 -1
- package/lib/reducers/ui/index.js +21 -16
- package/lib/reducers/ui/navigation.d.ts +2 -2
- package/lib/reducers/ui/navigation.js +10 -18
- package/lib/reducers/ui/positions.js +21 -17
- package/lib/reducers/ui/quit-popin.js +8 -7
- package/lib/reducers/ui/show-congrats.js +10 -9
- package/lib/reducers/ui/slide.js +36 -31
- package/lib/services/fetch-correction.js +19 -56
- package/lib/services/fetch-rank.js +15 -52
- package/lib/services/fetch-skills.js +15 -52
- package/lib/services/fetch-slide.js +15 -52
- package/lib/services/fetch-slides-to-review-by-skill-ref.js +13 -50
- package/lib/services/index.js +20 -16
- package/lib/services/post-answer.js +25 -62
- package/lib/services/post-progression.js +25 -62
- package/lib/services/tools/fetch-responses.js +36 -108
- package/lib/services/tools/sleep.js +7 -5
- package/lib/types/common.d.ts +7 -4
- package/lib/types/common.js +2 -1
- package/lib/types/slides.js +2 -1
- package/lib/views/skills/index.d.ts +1 -3
- package/lib/views/skills/index.js +8 -6
- package/lib/views/slides/index.d.ts +4 -112
- package/lib/views/slides/index.js +153 -141
- package/lib/views/slides/map-api-slide-to-ui.js +123 -134
- package/package.json +5 -13
- package/es/actions/index.d.ts +0 -5
- package/es/actions/index.js +0 -1
- package/es/actions/test/create-test-store.d.ts +0 -5
- package/es/actions/test/create-test-store.js +0 -16
- package/es/test/index.test.d.ts +0 -1
- package/es/test/index.test.js +0 -66
- package/es/test/util/services.mock.d.ts +0 -7
- package/es/test/util/services.mock.js +0 -444
- package/es/views/slides/test/fixtures/free-text.d.ts +0 -4
- package/es/views/slides/test/fixtures/free-text.js +0 -38
- package/es/views/slides/test/fixtures/qcm-drag.d.ts +0 -4
- package/es/views/slides/test/fixtures/qcm-drag.js +0 -108
- package/es/views/slides/test/fixtures/qcm-graphic.d.ts +0 -4
- package/es/views/slides/test/fixtures/qcm-graphic.js +0 -252
- package/es/views/slides/test/fixtures/qcm.d.ts +0 -4
- package/es/views/slides/test/fixtures/qcm.js +0 -109
- package/es/views/slides/test/fixtures/slider.d.ts +0 -4
- package/es/views/slides/test/fixtures/slider.js +0 -37
- package/es/views/slides/test/fixtures/template.d.ts +0 -4
- package/es/views/slides/test/fixtures/template.js +0 -170
- package/lib/actions/index.d.ts +0 -5
- package/lib/actions/index.js +0 -1
- package/lib/actions/test/create-test-store.d.ts +0 -5
- package/lib/actions/test/create-test-store.js +0 -18
- package/lib/test/index.test.d.ts +0 -1
- package/lib/test/index.test.js +0 -170
- package/lib/test/util/services.mock.d.ts +0 -7
- package/lib/test/util/services.mock.js +0 -448
- package/lib/views/slides/test/fixtures/free-text.d.ts +0 -4
- package/lib/views/slides/test/fixtures/free-text.js +0 -38
- package/lib/views/slides/test/fixtures/qcm-drag.d.ts +0 -4
- package/lib/views/slides/test/fixtures/qcm-drag.js +0 -108
- package/lib/views/slides/test/fixtures/qcm-graphic.d.ts +0 -4
- package/lib/views/slides/test/fixtures/qcm-graphic.js +0 -252
- package/lib/views/slides/test/fixtures/qcm.d.ts +0 -4
- package/lib/views/slides/test/fixtures/qcm.js +0 -109
- package/lib/views/slides/test/fixtures/slider.d.ts +0 -4
- package/lib/views/slides/test/fixtures/slider.js +0 -37
- package/lib/views/slides/test/fixtures/template.d.ts +0 -4
- package/lib/views/slides/test/fixtures/template.js +0 -170
- package/src/actions/api/fetch-correction.ts +0 -39
- package/src/actions/api/fetch-rank.ts +0 -91
- package/src/actions/api/fetch-skills.ts +0 -31
- package/src/actions/api/fetch-slide.ts +0 -50
- package/src/actions/api/post-answer.ts +0 -55
- package/src/actions/api/post-progression.ts +0 -33
- package/src/actions/api/test/fetch-correction.test.ts +0 -119
- package/src/actions/api/test/fetch-rank.test.ts +0 -138
- package/src/actions/api/test/fetch-skills.test.ts +0 -78
- package/src/actions/api/test/fetch-slide.test.ts +0 -85
- package/src/actions/api/test/post-answer.test.ts +0 -262
- package/src/actions/api/test/post-progression.test.ts +0 -127
- package/src/actions/data/test/token.test.ts +0 -32
- package/src/actions/data/token.ts +0 -11
- package/src/actions/index.ts +0 -6
- package/src/actions/test/create-test-store.ts +0 -25
- package/src/actions/ui/answers.ts +0 -77
- package/src/actions/ui/navigation.ts +0 -30
- package/src/actions/ui/next-slide.ts +0 -44
- package/src/actions/ui/quit-popin.ts +0 -10
- package/src/actions/ui/slides.ts +0 -26
- package/src/actions/ui/test/answers.test.ts +0 -174
- package/src/actions/ui/test/next-slide.test.ts +0 -87
- package/src/actions/ui/test/quit-popin.test.ts +0 -39
- package/src/actions/ui/test/slides.test.ts +0 -33
- package/src/common/index.ts +0 -25
- package/src/common/test/get-progression-slide-ref.test.ts +0 -35
- package/src/configure-store.ts +0 -22
- package/src/helpers/css-modules-require-hook.d.ts +0 -4
- package/src/helpers/css-register.ts +0 -3
- package/src/index.tsx +0 -105
- package/src/reducers/data/corrections.ts +0 -36
- package/src/reducers/data/index.ts +0 -19
- package/src/reducers/data/progression.ts +0 -23
- package/src/reducers/data/rank.ts +0 -44
- package/src/reducers/data/skills.ts +0 -16
- package/src/reducers/data/slides.ts +0 -31
- package/src/reducers/data/test/corrections.test.ts +0 -36
- package/src/reducers/data/test/progression.test.ts +0 -28
- package/src/reducers/data/test/rank.test.ts +0 -59
- package/src/reducers/data/test/skills.test.ts +0 -14
- package/src/reducers/data/test/slides.test.ts +0 -27
- package/src/reducers/data/test/token.test.ts +0 -13
- package/src/reducers/data/token.ts +0 -15
- package/src/reducers/index.ts +0 -14
- package/src/reducers/ui/answers.ts +0 -41
- package/src/reducers/ui/current-slide-ref.ts +0 -22
- package/src/reducers/ui/index.ts +0 -29
- package/src/reducers/ui/navigation.ts +0 -29
- package/src/reducers/ui/positions.ts +0 -34
- package/src/reducers/ui/quit-popin.ts +0 -22
- package/src/reducers/ui/show-congrats.ts +0 -26
- package/src/reducers/ui/slide.ts +0 -87
- package/src/reducers/ui/test/answers.test.ts +0 -105
- package/src/reducers/ui/test/current-slide-ref.test.ts +0 -14
- package/src/reducers/ui/test/navigation.test.ts +0 -19
- package/src/reducers/ui/test/positions.test.ts +0 -82
- package/src/reducers/ui/test/quit-popin.test.ts +0 -24
- package/src/reducers/ui/test/show-congrats.test.ts +0 -40
- package/src/reducers/ui/test/slide.test.ts +0 -110
- package/src/services/fetch-correction.ts +0 -26
- package/src/services/fetch-rank.ts +0 -14
- package/src/services/fetch-skills.ts +0 -14
- package/src/services/fetch-slide.ts +0 -14
- package/src/services/fetch-slides-to-review-by-skill-ref.ts +0 -18
- package/src/services/index.ts +0 -18
- package/src/services/post-answer.ts +0 -28
- package/src/services/post-progression.ts +0 -28
- package/src/services/test/fetch-correction.test.ts +0 -55
- package/src/services/test/fetch-rank.test.ts +0 -34
- package/src/services/test/fetch-skills.test.ts +0 -39
- package/src/services/test/fetch-slide.test.ts +0 -30
- package/src/services/test/fetch-slides-to-review-by-skill-ref.test.ts +0 -51
- package/src/services/test/post-answer.test.ts +0 -100
- package/src/services/test/post-progression.test.ts +0 -66
- package/src/services/tools/fetch-responses.ts +0 -40
- package/src/services/tools/sleep.ts +0 -4
- package/src/test/index.test.tsx +0 -99
- package/src/test/util/services.mock.ts +0 -465
- package/src/types/common.ts +0 -203
- package/src/types/globals.d.ts +0 -4
- package/src/types/slides.ts +0 -98
- package/src/views/skills/index.ts +0 -52
- package/src/views/skills/test/skills.test.ts +0 -108
- package/src/views/slides/index.ts +0 -510
- package/src/views/slides/map-api-slide-to-ui.ts +0 -287
- package/src/views/slides/test/fixtures/free-text.ts +0 -44
- package/src/views/slides/test/fixtures/qcm-drag.ts +0 -112
- package/src/views/slides/test/fixtures/qcm-graphic.ts +0 -264
- package/src/views/slides/test/fixtures/qcm.ts +0 -120
- package/src/views/slides/test/fixtures/slider.ts +0 -43
- package/src/views/slides/test/fixtures/template.ts +0 -177
- package/src/views/slides/test/header.on-click.test.ts +0 -46
- package/src/views/slides/test/index.test.ts +0 -1500
- package/src/views/slides/test/map-api-slide-to-ui.test.ts +0 -52
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +0 -65
- package/src/views/slides/test/slide.free-text.on-change.test.ts +0 -117
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +0 -176
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +0 -90
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +0 -90
- package/src/views/slides/test/slide.qcm.on-click.test.ts +0 -92
- package/src/views/slides/test/slide.slider.on-change.test.ts +0 -92
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +0 -91
- package/src/views/slides/test/slide.template.on-change.test.ts +0 -126
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
2
|
import type { StoreState } from '../../reducers';
|
|
3
|
-
import type { CorrectionFromAPI,
|
|
3
|
+
import type { CorrectionFromAPI, ThunkOptions } from '../../types/common';
|
|
4
4
|
export declare const CORRECTION_FETCH_REQUEST: "@@correction/FETCH_REQUEST";
|
|
5
5
|
export declare const CORRECTION_FETCH_SUCCESS: "@@correction/FETCH_SUCCESS";
|
|
6
6
|
export declare const CORRECTION_FETCH_FAILURE: "@@correction/FETCH_FAILURE";
|
|
@@ -17,4 +17,4 @@ export declare type ReceivedCorrection = {
|
|
|
17
17
|
slideRef: string;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export declare const fetchCorrection: (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
20
|
+
export declare const fetchCorrection: (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => ReceivedCorrection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
2
|
import type { StoreState } from '../../reducers';
|
|
3
|
-
import type { Rank, Services,
|
|
3
|
+
import type { Rank, Services, ThunkOptions } from '../../types/common';
|
|
4
4
|
export declare const RANK_FETCH_START_REQUEST: "@@rank/FETCH_START_REQUEST";
|
|
5
5
|
export declare const RANK_FETCH_START_SUCCESS: "@@rank/FETCH_START_SUCCESS";
|
|
6
6
|
export declare const RANK_FETCH_START_FAILURE: "@@rank/FETCH_START_FAILURE";
|
|
@@ -27,6 +27,6 @@ export declare type RankAction = RankRequestAction | RankSuccessAction | RankFai
|
|
|
27
27
|
declare type RankStart = [RankFetchStartRequestType, RankFetchStartSuccessType, RankFetchStartFailureType];
|
|
28
28
|
declare type RankEnd = [RankFetchEndRequestType, RankFetchEndSuccessType, RankFetchEndFailureType];
|
|
29
29
|
export declare const fetchRank: (dispatch: Dispatch, getState: () => StoreState, services: Services, types: RankStart | RankEnd, path?: string) => RankAction;
|
|
30
|
-
export declare const fetchStartRank: (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
31
|
-
export declare const fetchEndRank: (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
30
|
+
export declare const fetchStartRank: (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => RankAction;
|
|
31
|
+
export declare const fetchEndRank: (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => RankAction;
|
|
32
32
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
2
|
import type { StoreState } from '../../reducers';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ThunkOptions, Skill } from '../../types/common';
|
|
4
4
|
export declare const SKILLS_FETCH_REQUEST: "@@skills/FETCH_REQUEST";
|
|
5
5
|
export declare const SKILLS_FETCH_SUCCESS: "@@skills/FETCH_SUCCESS";
|
|
6
6
|
export declare const SKILLS_FETCH_FAILURE: "@@skills/FETCH_FAILURE";
|
|
@@ -8,4 +8,4 @@ export declare type ReceivedSkills = {
|
|
|
8
8
|
type: typeof SKILLS_FETCH_SUCCESS;
|
|
9
9
|
payload: Skill[];
|
|
10
10
|
};
|
|
11
|
-
export declare const fetchSkills: (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
11
|
+
export declare const fetchSkills: (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => ReceivedSkills;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
2
|
import type { StoreState } from '../../reducers';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ThunkOptions, SlideFromAPI } from '../../types/common';
|
|
4
4
|
export declare const SLIDE_FETCH_REQUEST: "@@slides/FETCH_REQUEST";
|
|
5
5
|
export declare const SLIDE_FETCH_SUCCESS: "@@slides/FETCH_SUCCESS";
|
|
6
6
|
export declare const SLIDE_FETCH_FAILURE: "@@slides/FETCH_FAILURE";
|
|
@@ -17,4 +17,4 @@ export declare type ReceivedSlide = {
|
|
|
17
17
|
slideRef: string;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export declare const fetchSlide: (slideRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
20
|
+
export declare const fetchSlide: (slideRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThunkOptions, ProgressionFromAPI } from '../../types/common';
|
|
3
3
|
import type { StoreState } from '../../reducers';
|
|
4
4
|
export declare const POST_ANSWER_REQUEST: "@@answer/POST_REQUEST";
|
|
5
5
|
export declare const POST_ANSWER_SUCCESS: "@@answer/POST_SUCCESS";
|
|
@@ -17,4 +17,4 @@ export declare type PostAnswerSuccessAction = {
|
|
|
17
17
|
};
|
|
18
18
|
payload: ProgressionFromAPI;
|
|
19
19
|
};
|
|
20
|
-
export declare const postAnswer: (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
20
|
+
export declare const postAnswer: (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThunkOptions, ProgressionFromAPI } from '../../types/common';
|
|
3
3
|
import type { StoreState } from '../../reducers';
|
|
4
4
|
export declare const POST_PROGRESSION_REQUEST: "@@progression/POST_REQUEST";
|
|
5
5
|
export declare const POST_PROGRESSION_SUCCESS: "@@progression/POST_SUCCESS";
|
|
@@ -8,4 +8,4 @@ export declare type ReceivedProgression = {
|
|
|
8
8
|
type: typeof POST_PROGRESSION_SUCCESS;
|
|
9
9
|
payload: ProgressionFromAPI;
|
|
10
10
|
};
|
|
11
|
-
export declare const postProgression: (skillRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
11
|
+
export declare const postProgression: (skillRef: string) => (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => Promise<void>;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
export declare type ViewPath = 'skills' | 'onboarding' | 'slides' | 'loader';
|
|
6
|
-
export declare type NavigateTo = {
|
|
1
|
+
import { Dispatch } from 'redux';
|
|
2
|
+
import type { StoreState } from '../../reducers';
|
|
3
|
+
import { ThunkOptions, AppOptions, ViewName } from '../../types/common';
|
|
4
|
+
export declare type NavigateToAction = {
|
|
7
5
|
type: '@@navigation/NAVIGATE_TO';
|
|
8
|
-
payload:
|
|
6
|
+
payload: ViewName;
|
|
9
7
|
};
|
|
10
|
-
export declare type
|
|
8
|
+
export declare type NavigateBackAction = {
|
|
11
9
|
type: '@@navigation/NAVIGATE_BACK';
|
|
12
10
|
};
|
|
13
11
|
export declare type StartApp = {
|
|
14
12
|
type: '@@navigation/START_APP';
|
|
15
13
|
payload: AppOptions;
|
|
16
14
|
};
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
15
|
+
export declare const NAVIGATE_TO = "@@navigation/NAVIGATE_TO";
|
|
16
|
+
export declare const NAVIGATE_BACK = "@@navigation/NAVIGATE_BACK";
|
|
17
|
+
export declare const START_APP = "@@navigation/START_APP";
|
|
18
|
+
export declare const navigateTo: (newViewName: ViewName) => (dispatch: Dispatch, getState: () => StoreState, { callbackOnViewChanged }: ThunkOptions) => Promise<NavigateToAction>;
|
|
19
|
+
export declare const navigateBack: (dispatch: Dispatch, getState: () => StoreState, { callbackOnViewChanged }: ThunkOptions) => Promise<NavigateBackAction>;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
export const NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
|
|
2
2
|
export const NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
|
|
3
3
|
export const START_APP = '@@navigation/START_APP';
|
|
4
|
-
export const navigateTo = (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export const navigateTo = (newViewName) => async (dispatch, getState, { callbackOnViewChanged }) => {
|
|
5
|
+
const action = {
|
|
6
|
+
type: NAVIGATE_TO,
|
|
7
|
+
payload: newViewName
|
|
8
|
+
};
|
|
9
|
+
const res = await dispatch(action);
|
|
10
|
+
if (callbackOnViewChanged) {
|
|
11
|
+
callbackOnViewChanged(newViewName);
|
|
12
|
+
}
|
|
13
|
+
return res;
|
|
14
|
+
};
|
|
15
|
+
export const navigateBack = async (dispatch, getState, { callbackOnViewChanged }) => {
|
|
16
|
+
const action = {
|
|
17
|
+
type: NAVIGATE_BACK
|
|
18
|
+
};
|
|
19
|
+
const res = await dispatch(action);
|
|
20
|
+
if (callbackOnViewChanged) {
|
|
21
|
+
const storeState = getState();
|
|
22
|
+
const viewName = storeState.ui.navigation[storeState.ui.navigation.length - 1];
|
|
23
|
+
callbackOnViewChanged(viewName);
|
|
24
|
+
}
|
|
25
|
+
return res;
|
|
26
|
+
};
|
package/es/common/index.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { ProgressionFromAPI } from '../types/common';
|
|
2
|
-
export declare const VIEWS: {
|
|
3
|
-
readonly skills: 'skills';
|
|
4
|
-
readonly onboarding: 'onboarding';
|
|
5
|
-
readonly slides: 'slides';
|
|
6
|
-
};
|
|
7
2
|
export declare const slideIndexes: readonly ["0", "1", "2", "3", "4"];
|
|
8
3
|
export declare type SlideIndexes = typeof slideIndexes[number];
|
|
9
4
|
export declare const getProgressionSlidesRefs: (progression: ProgressionFromAPI) => string[];
|
package/es/common/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import concat from 'lodash/fp/concat';
|
|
2
2
|
import slice from 'lodash/fp/slice';
|
|
3
|
-
export const VIEWS = {
|
|
4
|
-
skills: 'skills',
|
|
5
|
-
onboarding: 'onboarding',
|
|
6
|
-
slides: 'slides'
|
|
7
|
-
};
|
|
8
3
|
export const slideIndexes = ['0', '1', '2', '3', '4'];
|
|
9
4
|
export const getProgressionSlidesRefs = (progression) => {
|
|
10
5
|
if (progression.state.step.current <= 5) {
|
package/es/configure-store.js
CHANGED
|
@@ -10,7 +10,11 @@ export default function configureStore(options) {
|
|
|
10
10
|
traceLimit: 25
|
|
11
11
|
})
|
|
12
12
|
: compose;
|
|
13
|
-
const
|
|
13
|
+
const thunkOptions = {
|
|
14
|
+
services: options.services || getServices(),
|
|
15
|
+
callbackOnViewChanged: options.callbackOnViewChanged
|
|
16
|
+
};
|
|
17
|
+
const thunkMiddleware = thunk.withExtraArgument(thunkOptions);
|
|
14
18
|
const enhancer = _compose(applyMiddleware(thunkMiddleware));
|
|
15
19
|
const store = createStore(rootReducer, undefined, enhancer);
|
|
16
20
|
return store;
|
package/es/index.js
CHANGED
|
@@ -4,16 +4,16 @@ import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
|
|
|
4
4
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
5
5
|
import get from 'lodash/fp/get';
|
|
6
6
|
import configureStore from './configure-store';
|
|
7
|
-
import { navigateTo } from './actions/ui/navigation';
|
|
7
|
+
import { navigateBack, navigateTo } from './actions/ui/navigation';
|
|
8
8
|
import { storeToken } from './actions/data/token';
|
|
9
9
|
import { fetchSkills } from './actions/api/fetch-skills';
|
|
10
10
|
import { postProgression } from './actions/api/post-progression';
|
|
11
|
-
import { VIEWS } from './common';
|
|
12
11
|
import { mapStateToSlidesProps } from './views/slides';
|
|
13
12
|
import { mapStateToSkillsProps } from './views/skills';
|
|
14
13
|
const ConnectedApp = ({ onQuitClick }) => {
|
|
15
14
|
const dispatch = useDispatch();
|
|
16
15
|
const props = {
|
|
16
|
+
navigateBack: () => dispatch(navigateBack),
|
|
17
17
|
viewName: useSelector((state) => state.ui.navigation[state.ui.navigation.length - 1]),
|
|
18
18
|
slides: useSelector((state) => mapStateToSlidesProps(state, dispatch, onQuitClick)),
|
|
19
19
|
skills: useSelector((state) => mapStateToSkillsProps(state)),
|
|
@@ -62,7 +62,7 @@ const AppReview = ({ options }) => {
|
|
|
62
62
|
store.dispatch(navigateTo('loader')); // use loader while posting progression
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
const initialView = skillRef ?
|
|
65
|
+
const initialView = skillRef ? 'slides' : 'skills';
|
|
66
66
|
store.dispatch(navigateTo(initialView));
|
|
67
67
|
}, [isProgressionCreated, options, store]);
|
|
68
68
|
if (!store)
|
package/es/reducers/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
22
22
|
showQuitPopin: boolean;
|
|
23
23
|
showCongrats: boolean;
|
|
24
24
|
}>;
|
|
25
|
-
}>, import("./data/corrections").CorrectionsAction | import("../actions/ui/slides").SetCurrentSlideAction | import("../actions/api/fetch-rank").RankAction | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("../actions/api/post-progression").ReceivedProgression | import("../actions/api/fetch-skills").ReceivedSkills | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/next-slide").NextSlideAction | import("../actions/ui/navigation").
|
|
25
|
+
}>, import("./data/corrections").CorrectionsAction | import("../actions/ui/slides").SetCurrentSlideAction | import("../actions/api/fetch-rank").RankAction | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("../actions/api/post-progression").ReceivedProgression | import("../actions/api/fetch-skills").ReceivedSkills | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/next-slide").NextSlideAction | import("../actions/ui/navigation").NavigateToAction | import("../actions/ui/navigation").NavigateBackAction | import("../actions/ui/answers").EditAnswerAction | {
|
|
26
26
|
type: "@@ui/OPEN_POPIN";
|
|
27
27
|
} | {
|
|
28
28
|
type: "@@ui/CLOSE_POPIN";
|
|
@@ -22,7 +22,7 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
22
22
|
positions: UIPositionState;
|
|
23
23
|
showQuitPopin: boolean;
|
|
24
24
|
showCongrats: boolean;
|
|
25
|
-
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/ui/next-slide").NextSlideAction | import("../../actions/ui/navigation").
|
|
25
|
+
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/ui/next-slide").NextSlideAction | import("../../actions/ui/navigation").NavigateToAction | import("../../actions/ui/navigation").NavigateBackAction | import("../../actions/ui/answers").EditAnswerAction | {
|
|
26
26
|
type: "@@ui/OPEN_POPIN";
|
|
27
27
|
} | {
|
|
28
28
|
type: "@@ui/CLOSE_POPIN";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavigateToAction, NavigateBackAction } from '../../actions/ui/navigation';
|
|
2
2
|
export declare type NavigationState = Array<'skills' | 'onboarding' | 'slides' | 'loader'>;
|
|
3
|
-
declare const reducer: (state: NavigationState | undefined, action:
|
|
3
|
+
declare const reducer: (state: NavigationState | undefined, action: NavigateToAction | NavigateBackAction) => NavigationState;
|
|
4
4
|
export default reducer;
|
package/es/types/common.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare type ViewName = 'skills' | 'onboarding' | 'slides' | 'loader';
|
|
1
2
|
export declare type ChoiceFromAPI = {
|
|
2
3
|
_id: string;
|
|
3
4
|
id?: string;
|
|
@@ -136,15 +137,17 @@ export declare type Services = {
|
|
|
136
137
|
fetchRank(token: string): Promise<Rank>;
|
|
137
138
|
fetchSlidesToReviewBySkillRef(url: string, token: string, skillRef: string): Promise<SlideIdFromAPI[]>;
|
|
138
139
|
};
|
|
139
|
-
export declare type Options = {
|
|
140
|
-
services: Services;
|
|
141
|
-
};
|
|
142
140
|
export declare type AppOptions = {
|
|
143
141
|
token: string;
|
|
144
142
|
skillRef?: string;
|
|
145
143
|
services: Services;
|
|
146
|
-
onQuitClick:
|
|
144
|
+
onQuitClick: () => void;
|
|
147
145
|
url: string;
|
|
146
|
+
callbackOnViewChanged?: (viewName: ViewName) => void;
|
|
147
|
+
};
|
|
148
|
+
export declare type ThunkOptions = {
|
|
149
|
+
callbackOnViewChanged?: AppOptions['callbackOnViewChanged'];
|
|
150
|
+
services: Services;
|
|
148
151
|
};
|
|
149
152
|
export declare type JWT = {
|
|
150
153
|
exp: number;
|
|
@@ -8,11 +8,9 @@ declare type SkillCard = {
|
|
|
8
8
|
reviseLabel: string;
|
|
9
9
|
reviseAriaLabel: string;
|
|
10
10
|
isCustom: boolean;
|
|
11
|
-
onClick:
|
|
11
|
+
onClick: () => void;
|
|
12
12
|
};
|
|
13
13
|
declare type NoSkillsProps = {
|
|
14
|
-
titleNoSkills: string;
|
|
15
|
-
textNoSkills: string;
|
|
16
14
|
iconSkillAriaLabel: string;
|
|
17
15
|
};
|
|
18
16
|
declare type SkillsProps = NoSkillsProps & {
|
package/es/views/skills/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export const mapStateToSkillsProps = (state) => {
|
|
2
2
|
return {
|
|
3
3
|
title: '@todo title',
|
|
4
|
-
titleNoSkills: '@todo titleNoSkills',
|
|
5
|
-
textNoSkills: '@todo textNoSkills',
|
|
6
4
|
iconSkillAriaLabel: '@todo iconSkillAriaLabel',
|
|
7
5
|
isLoading: false,
|
|
8
6
|
isLoadingAriaLabel: '@todo loading',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
|
-
import {
|
|
2
|
+
import { ReviewPlayerProps } from '@coorpacademy/components/es/template/app-review/player/prop-types';
|
|
3
|
+
import { SlideProps } from '@coorpacademy/components/es/organism/review-slide/prop-types';
|
|
3
4
|
import type { StoreState } from '../../reducers';
|
|
4
5
|
import type { AnswerUI } from '../../types/slides';
|
|
5
6
|
declare const ICON_VALUES: {
|
|
@@ -25,118 +26,9 @@ export declare type ReviewSlide = {
|
|
|
25
26
|
animationType?: SlideUIAnimations;
|
|
26
27
|
};
|
|
27
28
|
declare type SlidesStack = {
|
|
28
|
-
[key
|
|
29
|
-
};
|
|
30
|
-
declare type CorrectionPopinInformation = {
|
|
31
|
-
label: string;
|
|
32
|
-
message: string;
|
|
33
|
-
};
|
|
34
|
-
declare type CorrectionPopinKlf = {
|
|
35
|
-
label: string;
|
|
36
|
-
tooltip: string;
|
|
37
|
-
};
|
|
38
|
-
declare type CorrectionPopinNext = {
|
|
39
|
-
label: string;
|
|
40
|
-
ariaLabel: string;
|
|
41
|
-
onClick: Function;
|
|
42
|
-
};
|
|
43
|
-
declare type QuitPopinButton = {
|
|
44
|
-
label: string;
|
|
45
|
-
type: string;
|
|
46
|
-
customStyle?: {
|
|
47
|
-
color: string;
|
|
48
|
-
};
|
|
49
|
-
handleOnclick: Function;
|
|
50
|
-
ariaLabel: string;
|
|
51
|
-
};
|
|
52
|
-
export declare type CorrectionPopinProps = {
|
|
53
|
-
klf?: CorrectionPopinKlf;
|
|
54
|
-
information: CorrectionPopinInformation;
|
|
55
|
-
next: CorrectionPopinNext;
|
|
56
|
-
resultLabel: string;
|
|
57
|
-
type: 'right' | 'wrong';
|
|
58
|
-
};
|
|
59
|
-
export declare type QuitPopinProps = {
|
|
60
|
-
content: string;
|
|
61
|
-
icon: string;
|
|
62
|
-
mode: string;
|
|
63
|
-
descriptionText: string;
|
|
64
|
-
firstButton: QuitPopinButton;
|
|
65
|
-
secondButton: QuitPopinButton;
|
|
66
|
-
};
|
|
67
|
-
export declare type SlidesViewProps = {
|
|
68
|
-
header: {
|
|
69
|
-
mode: string;
|
|
70
|
-
skillName: string;
|
|
71
|
-
onQuitClick: Function;
|
|
72
|
-
'aria-label'?: string;
|
|
73
|
-
closeButtonAriaLabel: string;
|
|
74
|
-
steps: StepItem[];
|
|
75
|
-
};
|
|
76
|
-
stack: {
|
|
77
|
-
slides: SlidesStack;
|
|
78
|
-
validateButton: {
|
|
79
|
-
label: string;
|
|
80
|
-
disabled: boolean;
|
|
81
|
-
onClick: Function;
|
|
82
|
-
};
|
|
83
|
-
correctionPopinProps?: CorrectionPopinProps;
|
|
84
|
-
endReview: boolean;
|
|
85
|
-
};
|
|
86
|
-
reviewBackgroundAriaLabel?: string;
|
|
87
|
-
congrats?: CongratsProps;
|
|
88
|
-
quitPopin?: QuitPopinProps;
|
|
89
|
-
};
|
|
90
|
-
declare type LottieAnimationProps = {
|
|
91
|
-
'aria-label': string;
|
|
92
|
-
'data-name'?: string;
|
|
93
|
-
animationSrc: string;
|
|
94
|
-
loop?: boolean;
|
|
95
|
-
rendererSettings?: {
|
|
96
|
-
hideOnTransparent?: boolean;
|
|
97
|
-
className?: string;
|
|
98
|
-
};
|
|
99
|
-
height?: number;
|
|
100
|
-
width?: number;
|
|
101
|
-
className?: number;
|
|
102
|
-
ie11ImageBackup: string;
|
|
103
|
-
backupImageClassName?: string;
|
|
104
|
-
autoplay?: boolean;
|
|
105
|
-
animationControl?: 'play' | 'pause' | 'stop' | 'loading';
|
|
106
|
-
};
|
|
107
|
-
export declare type CongratsCardProps = {
|
|
108
|
-
'aria-label': string;
|
|
109
|
-
'data-name': string;
|
|
110
|
-
animationLottie: LottieAnimationProps;
|
|
111
|
-
iconAriaLabel: string;
|
|
112
|
-
className?: string;
|
|
113
|
-
cardType: string;
|
|
114
|
-
reviewCardTitle: string;
|
|
115
|
-
reviewCardValue: string;
|
|
116
|
-
rankSuffix?: string;
|
|
117
|
-
timerAnimation: number;
|
|
118
|
-
};
|
|
119
|
-
export declare type CongratsProps = {
|
|
120
|
-
'aria-label': string;
|
|
121
|
-
'data-name': 'review-congrats';
|
|
122
|
-
animationLottie: LottieAnimationProps;
|
|
123
|
-
title: string;
|
|
124
|
-
cardCongratsStar: CongratsCardProps;
|
|
125
|
-
cardCongratsRank?: CongratsCardProps;
|
|
126
|
-
buttonRevising?: {
|
|
127
|
-
'aria-label': string;
|
|
128
|
-
label: string;
|
|
129
|
-
onClick: Function;
|
|
130
|
-
type: string;
|
|
131
|
-
};
|
|
132
|
-
buttonRevisingSkill?: {
|
|
133
|
-
label: string;
|
|
134
|
-
'aria-label': string;
|
|
135
|
-
onClick: Function;
|
|
136
|
-
type: string;
|
|
137
|
-
};
|
|
29
|
+
[key: string]: SlideProps;
|
|
138
30
|
};
|
|
139
31
|
export declare const initialState: SlidesStack;
|
|
140
32
|
export declare const buildStepItems: (state: StoreState) => StepItem[];
|
|
141
|
-
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch, onQuitClick:
|
|
33
|
+
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch, onQuitClick: () => void) => ReviewPlayerProps;
|
|
142
34
|
export {};
|
package/es/views/slides/index.js
CHANGED
|
@@ -180,7 +180,7 @@ const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf) =>
|
|
|
180
180
|
message: isCorrect ? klf : join(',', correctAnswer)
|
|
181
181
|
},
|
|
182
182
|
next: {
|
|
183
|
-
|
|
183
|
+
'aria-label': '_correctionNextAriaLabel',
|
|
184
184
|
label: '_correctionNextLabel',
|
|
185
185
|
onClick: () => {
|
|
186
186
|
dispatch(nextSlide);
|
|
@@ -202,7 +202,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick) => {
|
|
|
202
202
|
color: '#ED3436'
|
|
203
203
|
},
|
|
204
204
|
handleOnclick: onQuitClick,
|
|
205
|
-
|
|
205
|
+
'aria-label': 'Stop session'
|
|
206
206
|
},
|
|
207
207
|
secondButton: {
|
|
208
208
|
label: `Continuer d'apprendre`,
|
|
@@ -210,7 +210,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick) => {
|
|
|
210
210
|
handleOnclick: () => {
|
|
211
211
|
dispatch(closeQuitPopin);
|
|
212
212
|
},
|
|
213
|
-
|
|
213
|
+
'aria-label': 'Continue review'
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
};
|
|
@@ -288,6 +288,7 @@ export const mapStateToSlidesProps = (state, dispatch, onQuitClick) => {
|
|
|
288
288
|
const isCorrect = get(['data', 'progression', 'state', 'isCorrect'], state);
|
|
289
289
|
const klf = getOr('', ['data', 'slides', currentSlideRef, 'klf'], state);
|
|
290
290
|
const showQuitPopin = get(['ui', 'showQuitPopin'], state);
|
|
291
|
+
const showCongrats = get(['ui', 'showCongrats'], state);
|
|
291
292
|
return {
|
|
292
293
|
header: {
|
|
293
294
|
mode: '__revision_mode',
|
|
@@ -295,7 +296,8 @@ export const mapStateToSlidesProps = (state, dispatch, onQuitClick) => {
|
|
|
295
296
|
onQuitClick: () => dispatch(openQuitPopin),
|
|
296
297
|
'aria-label': 'aria-header-wrapper',
|
|
297
298
|
closeButtonAriaLabel: 'aria-close-button',
|
|
298
|
-
steps: buildStepItems(state)
|
|
299
|
+
steps: buildStepItems(state),
|
|
300
|
+
hiddenSteps: showCongrats
|
|
299
301
|
},
|
|
300
302
|
stack: {
|
|
301
303
|
slides: buildStackSlides(state, dispatch),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
2
|
import type { StoreState } from '../../reducers';
|
|
3
|
-
import type { CorrectionFromAPI,
|
|
3
|
+
import type { CorrectionFromAPI, ThunkOptions } from '../../types/common';
|
|
4
4
|
export declare const CORRECTION_FETCH_REQUEST: "@@correction/FETCH_REQUEST";
|
|
5
5
|
export declare const CORRECTION_FETCH_SUCCESS: "@@correction/FETCH_SUCCESS";
|
|
6
6
|
export declare const CORRECTION_FETCH_FAILURE: "@@correction/FETCH_FAILURE";
|
|
@@ -17,4 +17,4 @@ export declare type ReceivedCorrection = {
|
|
|
17
17
|
slideRef: string;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export declare const fetchCorrection: (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
20
|
+
export declare const fetchCorrection: (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => ReceivedCorrection;
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchCorrection = exports.CORRECTION_FETCH_FAILURE = exports.CORRECTION_FETCH_SUCCESS = exports.CORRECTION_FETCH_REQUEST = void 0;
|
|
7
|
+
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
exports.CORRECTION_FETCH_REQUEST = '@@correction/FETCH_REQUEST';
|
|
10
|
+
exports.CORRECTION_FETCH_SUCCESS = '@@correction/FETCH_SUCCESS';
|
|
11
|
+
exports.CORRECTION_FETCH_FAILURE = '@@correction/FETCH_FAILURE';
|
|
12
|
+
const fetchCorrection = (dispatch, getState, { services }) => {
|
|
13
|
+
const state = getState();
|
|
14
|
+
const slideRef = (0, get_1.default)(['ui', 'currentSlideRef'], state);
|
|
15
|
+
const token = (0, get_1.default)(['data', 'token'], state);
|
|
16
|
+
const progressionId = (0, get_1.default)(['data', 'progression', '_id'], state);
|
|
17
|
+
const answer = (0, get_1.default)(['ui', 'answers', slideRef], state);
|
|
18
|
+
const action = (0, redux_task_1.default)({
|
|
19
|
+
types: [exports.CORRECTION_FETCH_REQUEST, exports.CORRECTION_FETCH_SUCCESS, exports.CORRECTION_FETCH_FAILURE],
|
|
20
|
+
meta: { slideRef },
|
|
21
|
+
task: () => services.fetchCorrection(slideRef, token, progressionId, answer)
|
|
17
22
|
});
|
|
18
23
|
return dispatch(action);
|
|
19
24
|
};
|
|
25
|
+
exports.fetchCorrection = fetchCorrection;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
2
|
import type { StoreState } from '../../reducers';
|
|
3
|
-
import type { Rank, Services,
|
|
3
|
+
import type { Rank, Services, ThunkOptions } from '../../types/common';
|
|
4
4
|
export declare const RANK_FETCH_START_REQUEST: "@@rank/FETCH_START_REQUEST";
|
|
5
5
|
export declare const RANK_FETCH_START_SUCCESS: "@@rank/FETCH_START_SUCCESS";
|
|
6
6
|
export declare const RANK_FETCH_START_FAILURE: "@@rank/FETCH_START_FAILURE";
|
|
@@ -27,6 +27,6 @@ export declare type RankAction = RankRequestAction | RankSuccessAction | RankFai
|
|
|
27
27
|
declare type RankStart = [RankFetchStartRequestType, RankFetchStartSuccessType, RankFetchStartFailureType];
|
|
28
28
|
declare type RankEnd = [RankFetchEndRequestType, RankFetchEndSuccessType, RankFetchEndFailureType];
|
|
29
29
|
export declare const fetchRank: (dispatch: Dispatch, getState: () => StoreState, services: Services, types: RankStart | RankEnd, path?: string) => RankAction;
|
|
30
|
-
export declare const fetchStartRank: (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
31
|
-
export declare const fetchEndRank: (dispatch: Dispatch, getState: () => StoreState, { services }:
|
|
30
|
+
export declare const fetchStartRank: (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => RankAction;
|
|
31
|
+
export declare const fetchEndRank: (dispatch: Dispatch, getState: () => StoreState, { services }: ThunkOptions) => RankAction;
|
|
32
32
|
export {};
|
|
@@ -1,38 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export var RANK_FETCH_START_SUCCESS = '@@rank/FETCH_START_SUCCESS';
|
|
5
|
-
export var RANK_FETCH_START_FAILURE = '@@rank/FETCH_START_FAILURE';
|
|
6
|
-
export var RANK_FETCH_END_REQUEST = '@@rank/FETCH_END_REQUEST';
|
|
7
|
-
export var RANK_FETCH_END_SUCCESS = '@@rank/FETCH_END_SUCCESS';
|
|
8
|
-
export var RANK_FETCH_END_FAILURE = '@@rank/FETCH_END_FAILURE';
|
|
9
|
-
var bailout = function (path) {
|
|
10
|
-
return function (state) {
|
|
11
|
-
var value = get(path, state);
|
|
12
|
-
return !Number.isNaN(value);
|
|
13
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
4
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchEndRank = exports.fetchStartRank = exports.fetchRank = exports.RANK_FETCH_END_FAILURE = exports.RANK_FETCH_END_SUCCESS = exports.RANK_FETCH_END_REQUEST = exports.RANK_FETCH_START_FAILURE = exports.RANK_FETCH_START_SUCCESS = exports.RANK_FETCH_START_REQUEST = void 0;
|
|
7
|
+
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
9
|
+
exports.RANK_FETCH_START_REQUEST = '@@rank/FETCH_START_REQUEST';
|
|
10
|
+
exports.RANK_FETCH_START_SUCCESS = '@@rank/FETCH_START_SUCCESS';
|
|
11
|
+
exports.RANK_FETCH_START_FAILURE = '@@rank/FETCH_START_FAILURE';
|
|
12
|
+
exports.RANK_FETCH_END_REQUEST = '@@rank/FETCH_END_REQUEST';
|
|
13
|
+
exports.RANK_FETCH_END_SUCCESS = '@@rank/FETCH_END_SUCCESS';
|
|
14
|
+
exports.RANK_FETCH_END_FAILURE = '@@rank/FETCH_END_FAILURE';
|
|
15
|
+
const bailout = (path) => (state) => {
|
|
16
|
+
const value = (0, get_1.default)(path, state);
|
|
17
|
+
return !Number.isNaN(value);
|
|
18
|
+
};
|
|
19
|
+
const fetchRank = (dispatch, getState, services, types, path) => {
|
|
20
|
+
const action = (0, redux_task_1.default)({
|
|
21
|
+
types,
|
|
22
|
+
task: () => {
|
|
23
|
+
const state = getState();
|
|
24
|
+
const token = (0, get_1.default)(['data', 'token'], state);
|
|
21
25
|
return services.fetchRank(token);
|
|
22
26
|
},
|
|
23
27
|
bailout: path ? bailout(path) : undefined
|
|
24
28
|
});
|
|
25
29
|
return dispatch(action);
|
|
26
30
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return fetchRank(dispatch, getState, services, [RANK_FETCH_START_REQUEST, RANK_FETCH_START_SUCCESS, RANK_FETCH_START_FAILURE], 'data.rank.start');
|
|
31
|
+
exports.fetchRank = fetchRank;
|
|
32
|
+
const fetchStartRank = (dispatch, getState, { services }) => {
|
|
33
|
+
return (0, exports.fetchRank)(dispatch, getState, services, [exports.RANK_FETCH_START_REQUEST, exports.RANK_FETCH_START_SUCCESS, exports.RANK_FETCH_START_FAILURE], 'data.rank.start');
|
|
30
34
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return fetchRank(dispatch, getState, services, [
|
|
34
|
-
RANK_FETCH_END_REQUEST,
|
|
35
|
-
RANK_FETCH_END_SUCCESS,
|
|
36
|
-
RANK_FETCH_END_FAILURE
|
|
35
|
+
exports.fetchStartRank = fetchStartRank;
|
|
36
|
+
const fetchEndRank = (dispatch, getState, { services }) => {
|
|
37
|
+
return (0, exports.fetchRank)(dispatch, getState, services, [
|
|
38
|
+
exports.RANK_FETCH_END_REQUEST,
|
|
39
|
+
exports.RANK_FETCH_END_SUCCESS,
|
|
40
|
+
exports.RANK_FETCH_END_FAILURE
|
|
37
41
|
]);
|
|
38
42
|
};
|
|
43
|
+
exports.fetchEndRank = fetchEndRank;
|