@coorpacademy/app-review 0.20.3-alpha.34 → 0.21.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-slides-to-review-by-skill-ref.d.ts +1 -1
- package/es/actions/api/fetch-slides-to-review-by-skill-ref.js +15 -4
- package/es/actions/ui/show-button-revising.d.ts +6 -0
- package/es/actions/ui/show-button-revising.js +6 -0
- package/es/reducers/index.d.ts +1 -1
- package/es/reducers/ui/index.d.ts +1 -1
- package/es/reducers/ui/show-button-revising.d.ts +2 -2
- package/es/reducers/ui/show-button-revising.js +3 -3
- package/lib/actions/api/fetch-slides-to-review-by-skill-ref.d.ts +1 -1
- package/lib/actions/api/fetch-slides-to-review-by-skill-ref.js +15 -4
- package/lib/actions/ui/show-button-revising.d.ts +6 -0
- package/lib/actions/ui/show-button-revising.js +10 -0
- package/lib/reducers/index.d.ts +1 -1
- package/lib/reducers/ui/index.d.ts +1 -1
- package/lib/reducers/ui/show-button-revising.d.ts +2 -2
- package/lib/reducers/ui/show-button-revising.js +3 -3
- package/locales/.mtslconfig.json +1 -0
- package/package.json +5 -5
|
@@ -9,4 +9,4 @@ export declare type ReceivedSlidesToReviewBySkillRef = {
|
|
|
9
9
|
type: typeof SLIDES_TO_REVIEW_FETCH_SUCCESS;
|
|
10
10
|
payload: SlideIdFromAPI[];
|
|
11
11
|
};
|
|
12
|
-
export declare const fetchSlidesToReviewBySkillRef: (dispatch: Dispatch, getState: () => StoreState, { services }: Options) =>
|
|
12
|
+
export declare const fetchSlidesToReviewBySkillRef: (dispatch: Dispatch, getState: () => StoreState, { services }: Options) => Promise<void>;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import buildTask from '@coorpacademy/redux-task';
|
|
2
|
+
import difference from 'lodash/fp/difference';
|
|
3
|
+
import map from 'lodash/fp/map';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import { showButtonRevising } from '../ui/show-button-revising';
|
|
2
6
|
export const SLIDES_TO_REVIEW_FETCH_REQUEST = '@@slidesToReview/FETCH_REQUEST';
|
|
3
7
|
export const SLIDES_TO_REVIEW_FETCH_SUCCESS = '@@slidesToReview/FETCH_SUCCESS';
|
|
4
8
|
export const SLIDES_TO_REVIEW_FETCH_FAILURE = '@@slidesToReview/FETCH_FAILURE';
|
|
5
|
-
export const fetchSlidesToReviewBySkillRef = (dispatch, getState, { services }) => {
|
|
9
|
+
export const fetchSlidesToReviewBySkillRef = async (dispatch, getState, { services }) => {
|
|
10
|
+
const state = getState();
|
|
6
11
|
const action = buildTask({
|
|
7
12
|
types: [
|
|
8
13
|
SLIDES_TO_REVIEW_FETCH_REQUEST,
|
|
@@ -10,12 +15,18 @@ export const fetchSlidesToReviewBySkillRef = (dispatch, getState, { services })
|
|
|
10
15
|
SLIDES_TO_REVIEW_FETCH_FAILURE
|
|
11
16
|
],
|
|
12
17
|
task: () => {
|
|
13
|
-
const state = getState();
|
|
14
18
|
const token = state.data.token;
|
|
15
19
|
const progression = state.data.progression;
|
|
16
20
|
const skillRef = progression.content.ref;
|
|
17
|
-
return services.fetchSlidesToReviewBySkillRef(token, skillRef);
|
|
21
|
+
return services.fetchSlidesToReviewBySkillRef(token, skillRef, 10);
|
|
18
22
|
}
|
|
19
23
|
});
|
|
20
|
-
|
|
24
|
+
const response = await dispatch(action);
|
|
25
|
+
if (response.type === SLIDES_TO_REVIEW_FETCH_SUCCESS) {
|
|
26
|
+
const answeredSlidesRef = get(['data', 'progression', 'state', 'slides'], state);
|
|
27
|
+
const slidesToReview = map(({ slideId }) => slideId, response.payload);
|
|
28
|
+
if (difference(slidesToReview, answeredSlidesRef).length >= 5) {
|
|
29
|
+
dispatch(showButtonRevising);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
21
32
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Dispatch } from 'redux';
|
|
2
|
+
export declare const SHOW_BUTTON_REVISING: "@@button/SHOW_BUTTON_REVISING";
|
|
3
|
+
export declare type ShowButtonRevisingAction = {
|
|
4
|
+
type: typeof SHOW_BUTTON_REVISING;
|
|
5
|
+
};
|
|
6
|
+
export declare const showButtonRevising: (dispatch: Dispatch) => ShowButtonRevisingAction;
|
package/es/reducers/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
24
24
|
showButtonRevising: boolean;
|
|
25
25
|
showCongrats: boolean;
|
|
26
26
|
}>;
|
|
27
|
-
}>, import("../actions/api/fetch-video-props").SetVideoPropsAction | import("../actions/api/fetch-video-props").ShowVideoAction | import("../actions/ui/slides").SetCurrentSlideAction | import("../actions/api/fetch-skill").ReceivedSkill | import("../actions/api/post-progression").FetchProgression | import("../actions/api/post-progression").ReceivedProgression | import("./data/corrections").CorrectionsAction | import("../actions/api/fetch-rank").RankAction | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/
|
|
27
|
+
}>, import("../actions/api/fetch-video-props").SetVideoPropsAction | import("../actions/api/fetch-video-props").ShowVideoAction | import("../actions/ui/slides").SetCurrentSlideAction | import("../actions/api/fetch-skill").ReceivedSkill | import("../actions/api/post-progression").FetchProgression | import("../actions/api/post-progression").ReceivedProgression | import("./data/corrections").CorrectionsAction | import("../actions/api/fetch-rank").RankAction | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/show-button-revising").ShowButtonRevisingAction | import("../actions/ui/next-slide").NextSlideAction | import("../actions/ui/navigation").NavigateToAction | import("../actions/ui/navigation").NavigateBackAction | import("../actions/ui/answers").EditAnswerAction | {
|
|
28
28
|
type: "@@ui/OPEN_POPIN";
|
|
29
29
|
} | {
|
|
30
30
|
type: "@@ui/CLOSE_POPIN";
|
|
@@ -25,7 +25,7 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
25
25
|
showQuitPopin: boolean;
|
|
26
26
|
showButtonRevising: boolean;
|
|
27
27
|
showCongrats: boolean;
|
|
28
|
-
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-progression").FetchProgression | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/
|
|
28
|
+
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-progression").FetchProgression | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/ui/show-button-revising").ShowButtonRevisingAction | import("../../actions/ui/next-slide").NextSlideAction | import("../../actions/ui/navigation").NavigateToAction | import("../../actions/ui/navigation").NavigateBackAction | import("../../actions/ui/answers").EditAnswerAction | {
|
|
29
29
|
type: "@@ui/OPEN_POPIN";
|
|
30
30
|
} | {
|
|
31
31
|
type: "@@ui/CLOSE_POPIN";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ShowButtonRevisingAction } from '../../actions/ui/show-button-revising';
|
|
2
2
|
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
3
|
export declare type UIShowButtonRevisingState = boolean;
|
|
4
|
-
declare const reducer: (state: boolean | undefined, action:
|
|
4
|
+
declare const reducer: (state: boolean | undefined, action: ShowButtonRevisingAction | FetchProgression) => UIShowButtonRevisingState;
|
|
5
5
|
export default reducer;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SHOW_BUTTON_REVISING } from '../../actions/ui/show-button-revising';
|
|
2
2
|
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
3
3
|
const reducer = (
|
|
4
4
|
// eslint-disable-next-line default-param-last
|
|
5
5
|
state = false, action) => {
|
|
6
6
|
switch (action.type) {
|
|
7
|
-
case
|
|
8
|
-
return
|
|
7
|
+
case SHOW_BUTTON_REVISING: {
|
|
8
|
+
return true;
|
|
9
9
|
}
|
|
10
10
|
case POST_PROGRESSION_REQUEST: {
|
|
11
11
|
return false;
|
|
@@ -9,4 +9,4 @@ export declare type ReceivedSlidesToReviewBySkillRef = {
|
|
|
9
9
|
type: typeof SLIDES_TO_REVIEW_FETCH_SUCCESS;
|
|
10
10
|
payload: SlideIdFromAPI[];
|
|
11
11
|
};
|
|
12
|
-
export declare const fetchSlidesToReviewBySkillRef: (dispatch: Dispatch, getState: () => StoreState, { services }: Options) =>
|
|
12
|
+
export declare const fetchSlidesToReviewBySkillRef: (dispatch: Dispatch, getState: () => StoreState, { services }: Options) => Promise<void>;
|
|
@@ -5,10 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchSlidesToReviewBySkillRef = exports.SLIDES_TO_REVIEW_FETCH_FAILURE = exports.SLIDES_TO_REVIEW_FETCH_SUCCESS = exports.SLIDES_TO_REVIEW_FETCH_REQUEST = void 0;
|
|
7
7
|
const redux_task_1 = __importDefault(require("@coorpacademy/redux-task"));
|
|
8
|
+
const difference_1 = __importDefault(require("lodash/fp/difference"));
|
|
9
|
+
const map_1 = __importDefault(require("lodash/fp/map"));
|
|
10
|
+
const get_1 = __importDefault(require("lodash/fp/get"));
|
|
11
|
+
const show_button_revising_1 = require("../ui/show-button-revising");
|
|
8
12
|
exports.SLIDES_TO_REVIEW_FETCH_REQUEST = '@@slidesToReview/FETCH_REQUEST';
|
|
9
13
|
exports.SLIDES_TO_REVIEW_FETCH_SUCCESS = '@@slidesToReview/FETCH_SUCCESS';
|
|
10
14
|
exports.SLIDES_TO_REVIEW_FETCH_FAILURE = '@@slidesToReview/FETCH_FAILURE';
|
|
11
|
-
const fetchSlidesToReviewBySkillRef = (dispatch, getState, { services }) => {
|
|
15
|
+
const fetchSlidesToReviewBySkillRef = async (dispatch, getState, { services }) => {
|
|
16
|
+
const state = getState();
|
|
12
17
|
const action = (0, redux_task_1.default)({
|
|
13
18
|
types: [
|
|
14
19
|
exports.SLIDES_TO_REVIEW_FETCH_REQUEST,
|
|
@@ -16,13 +21,19 @@ const fetchSlidesToReviewBySkillRef = (dispatch, getState, { services }) => {
|
|
|
16
21
|
exports.SLIDES_TO_REVIEW_FETCH_FAILURE
|
|
17
22
|
],
|
|
18
23
|
task: () => {
|
|
19
|
-
const state = getState();
|
|
20
24
|
const token = state.data.token;
|
|
21
25
|
const progression = state.data.progression;
|
|
22
26
|
const skillRef = progression.content.ref;
|
|
23
|
-
return services.fetchSlidesToReviewBySkillRef(token, skillRef);
|
|
27
|
+
return services.fetchSlidesToReviewBySkillRef(token, skillRef, 10);
|
|
24
28
|
}
|
|
25
29
|
});
|
|
26
|
-
|
|
30
|
+
const response = await dispatch(action);
|
|
31
|
+
if (response.type === exports.SLIDES_TO_REVIEW_FETCH_SUCCESS) {
|
|
32
|
+
const answeredSlidesRef = (0, get_1.default)(['data', 'progression', 'state', 'slides'], state);
|
|
33
|
+
const slidesToReview = (0, map_1.default)(({ slideId }) => slideId, response.payload);
|
|
34
|
+
if ((0, difference_1.default)(slidesToReview, answeredSlidesRef).length >= 5) {
|
|
35
|
+
dispatch(show_button_revising_1.showButtonRevising);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
27
38
|
};
|
|
28
39
|
exports.fetchSlidesToReviewBySkillRef = fetchSlidesToReviewBySkillRef;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Dispatch } from 'redux';
|
|
2
|
+
export declare const SHOW_BUTTON_REVISING: "@@button/SHOW_BUTTON_REVISING";
|
|
3
|
+
export declare type ShowButtonRevisingAction = {
|
|
4
|
+
type: typeof SHOW_BUTTON_REVISING;
|
|
5
|
+
};
|
|
6
|
+
export declare const showButtonRevising: (dispatch: Dispatch) => ShowButtonRevisingAction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showButtonRevising = exports.SHOW_BUTTON_REVISING = void 0;
|
|
4
|
+
exports.SHOW_BUTTON_REVISING = '@@button/SHOW_BUTTON_REVISING';
|
|
5
|
+
const showButtonRevising = (dispatch) => {
|
|
6
|
+
return dispatch({
|
|
7
|
+
type: exports.SHOW_BUTTON_REVISING
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
exports.showButtonRevising = showButtonRevising;
|
package/lib/reducers/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
24
24
|
showButtonRevising: boolean;
|
|
25
25
|
showCongrats: boolean;
|
|
26
26
|
}>;
|
|
27
|
-
}>, import("../actions/api/fetch-video-props").SetVideoPropsAction | import("../actions/api/fetch-video-props").ShowVideoAction | import("../actions/ui/slides").SetCurrentSlideAction | import("../actions/api/fetch-skill").ReceivedSkill | import("../actions/api/post-progression").FetchProgression | import("../actions/api/post-progression").ReceivedProgression | import("./data/corrections").CorrectionsAction | import("../actions/api/fetch-rank").RankAction | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/
|
|
27
|
+
}>, import("../actions/api/fetch-video-props").SetVideoPropsAction | import("../actions/api/fetch-video-props").ShowVideoAction | import("../actions/ui/slides").SetCurrentSlideAction | import("../actions/api/fetch-skill").ReceivedSkill | import("../actions/api/post-progression").FetchProgression | import("../actions/api/post-progression").ReceivedProgression | import("./data/corrections").CorrectionsAction | import("../actions/api/fetch-rank").RankAction | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/show-button-revising").ShowButtonRevisingAction | import("../actions/ui/next-slide").NextSlideAction | import("../actions/ui/navigation").NavigateToAction | import("../actions/ui/navigation").NavigateBackAction | import("../actions/ui/answers").EditAnswerAction | {
|
|
28
28
|
type: "@@ui/OPEN_POPIN";
|
|
29
29
|
} | {
|
|
30
30
|
type: "@@ui/CLOSE_POPIN";
|
|
@@ -25,7 +25,7 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
25
25
|
showQuitPopin: boolean;
|
|
26
26
|
showButtonRevising: boolean;
|
|
27
27
|
showCongrats: boolean;
|
|
28
|
-
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-progression").FetchProgression | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/
|
|
28
|
+
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-progression").FetchProgression | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/ui/show-button-revising").ShowButtonRevisingAction | import("../../actions/ui/next-slide").NextSlideAction | import("../../actions/ui/navigation").NavigateToAction | import("../../actions/ui/navigation").NavigateBackAction | import("../../actions/ui/answers").EditAnswerAction | {
|
|
29
29
|
type: "@@ui/OPEN_POPIN";
|
|
30
30
|
} | {
|
|
31
31
|
type: "@@ui/CLOSE_POPIN";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ShowButtonRevisingAction } from '../../actions/ui/show-button-revising';
|
|
2
2
|
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
3
|
export declare type UIShowButtonRevisingState = boolean;
|
|
4
|
-
declare const reducer: (state: boolean | undefined, action:
|
|
4
|
+
declare const reducer: (state: boolean | undefined, action: ShowButtonRevisingAction | FetchProgression) => UIShowButtonRevisingState;
|
|
5
5
|
export default reducer;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const show_button_revising_1 = require("../../actions/ui/show-button-revising");
|
|
4
4
|
const post_progression_1 = require("../../actions/api/post-progression");
|
|
5
5
|
const reducer = (
|
|
6
6
|
// eslint-disable-next-line default-param-last
|
|
7
7
|
state = false, action) => {
|
|
8
8
|
switch (action.type) {
|
|
9
|
-
case
|
|
10
|
-
return
|
|
9
|
+
case show_button_revising_1.SHOW_BUTTON_REVISING: {
|
|
10
|
+
return true;
|
|
11
11
|
}
|
|
12
12
|
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
13
13
|
return false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ignore_dirs":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"main": "lib/index.js",
|
|
36
36
|
"module": "es/index.js",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@coorpacademy/components": "11.
|
|
38
|
+
"@coorpacademy/components": "11.10.0",
|
|
39
39
|
"@coorpacademy/progression-engine": "11.5.3",
|
|
40
40
|
"@coorpacademy/redux-task": "1.1.6",
|
|
41
|
-
"@coorpacademy/review-services": "1.
|
|
42
|
-
"@coorpacademy/review-services-mocks": "1.
|
|
41
|
+
"@coorpacademy/review-services": "1.4.0",
|
|
42
|
+
"@coorpacademy/review-services-mocks": "1.4.0",
|
|
43
43
|
"@coorpacademy/translate": "6.2.0",
|
|
44
44
|
"cross-fetch": "^3.1.5",
|
|
45
45
|
"jwt-decode": "^3.1.2",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"webpack-cli": "^4.10.0",
|
|
75
75
|
"webpack-dev-server": "^4.11.1"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "6ece27388a30f36620cd858a34cc5857b8414f93"
|
|
78
78
|
}
|