@coorpacademy/app-review 0.5.7-alpha.0 → 0.6.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/sandbox/index.d.ts +9 -0
- package/es/sandbox/index.js +41 -0
- package/es/{actions → src/actions}/api/fetch-correction.d.ts +2 -2
- package/{lib → es/src}/actions/api/fetch-rank.d.ts +3 -3
- package/{lib → es/src}/actions/api/fetch-skills.d.ts +2 -2
- package/{lib → es/src}/actions/api/fetch-slide.d.ts +2 -2
- package/{lib → es/src}/actions/api/post-answer.d.ts +2 -2
- package/es/{actions → src/actions}/api/post-progression.d.ts +2 -2
- package/es/{actions → src/actions}/test/create-test-store.d.ts +2 -2
- package/es/{actions → src/actions}/test/create-test-store.js +2 -2
- package/es/src/actions/ui/navigation.d.ts +19 -0
- package/es/src/actions/ui/navigation.js +26 -0
- package/{lib → es/src}/common/index.d.ts +0 -5
- package/es/{common → src/common}/index.js +0 -5
- package/es/{configure-store.js → src/configure-store.js} +5 -1
- package/es/{index.js → src/index.js} +3 -3
- package/{lib → es/src}/reducers/index.d.ts +1 -1
- package/es/{reducers → src/reducers}/ui/index.d.ts +1 -1
- package/{lib → es/src}/reducers/ui/navigation.d.ts +2 -2
- package/es/{reducers → src/reducers}/ui/navigation.js +1 -1
- package/{lib → es/src}/types/common.d.ts +7 -4
- package/{lib → es/src}/views/skills/index.d.ts +1 -3
- package/es/{views → src/views}/skills/index.js +0 -2
- package/es/src/views/slides/index.d.ts +34 -0
- package/es/{views → src/views}/slides/index.js +6 -4
- package/lib/sandbox/index.d.ts +9 -0
- package/lib/sandbox/index.js +43 -0
- package/lib/{actions → src/actions}/api/fetch-correction.d.ts +2 -2
- package/{es → lib/src}/actions/api/fetch-rank.d.ts +3 -3
- package/{es → lib/src}/actions/api/fetch-skills.d.ts +2 -2
- package/{es → lib/src}/actions/api/fetch-slide.d.ts +2 -2
- package/{es → lib/src}/actions/api/post-answer.d.ts +2 -2
- package/lib/{actions → src/actions}/api/post-progression.d.ts +2 -2
- package/lib/{actions → src/actions}/test/create-test-store.d.ts +2 -2
- package/lib/{actions → src/actions}/test/create-test-store.js +2 -2
- package/lib/src/actions/ui/navigation.d.ts +19 -0
- package/lib/src/actions/ui/navigation.js +86 -0
- package/{es → lib/src}/common/index.d.ts +0 -5
- package/lib/{common → src/common}/index.js +0 -5
- package/lib/{configure-store.js → src/configure-store.js} +5 -1
- package/lib/{index.js → src/index.js} +3 -3
- package/{es → lib/src}/reducers/index.d.ts +1 -1
- package/lib/{reducers → src/reducers}/ui/index.d.ts +1 -1
- package/{es → lib/src}/reducers/ui/navigation.d.ts +2 -2
- package/lib/{reducers → src/reducers}/ui/navigation.js +1 -1
- package/{es → lib/src}/types/common.d.ts +7 -4
- package/{es → lib/src}/views/skills/index.d.ts +1 -3
- package/lib/{views → src/views}/skills/index.js +0 -2
- package/lib/src/views/slides/index.d.ts +34 -0
- package/lib/{views → src/views}/slides/index.js +6 -4
- package/package.json +3 -3
- package/src/actions/api/fetch-correction.ts +2 -2
- package/src/actions/api/fetch-rank.ts +3 -3
- package/src/actions/api/fetch-skills.ts +2 -2
- package/src/actions/api/fetch-slide.ts +6 -2
- package/src/actions/api/post-answer.ts +2 -2
- package/src/actions/api/post-progression.ts +6 -2
- package/src/actions/api/test/fetch-correction.test.ts +2 -2
- package/src/actions/api/test/fetch-rank.test.ts +4 -4
- package/src/actions/api/test/fetch-skills.test.ts +2 -2
- package/src/actions/api/test/fetch-slide.test.ts +2 -2
- package/src/actions/api/test/post-answer.test.ts +11 -7
- package/src/actions/api/test/post-progression.test.ts +2 -2
- package/src/actions/data/test/token.test.ts +1 -1
- package/src/actions/test/create-test-store.ts +3 -3
- package/src/actions/ui/navigation.ts +49 -17
- package/src/actions/ui/test/answers.test.ts +8 -8
- package/src/actions/ui/test/navigation.test.ts +95 -0
- package/src/actions/ui/test/next-slide.test.ts +2 -2
- package/src/actions/ui/test/quit-popin.test.ts +2 -2
- package/src/actions/ui/test/slides.test.ts +1 -1
- package/src/common/index.ts +0 -10
- package/src/configure-store.ts +8 -2
- package/src/index.tsx +8 -6
- package/src/reducers/ui/navigation.ts +5 -5
- package/src/reducers/ui/test/navigation.test.ts +5 -5
- package/src/types/common.ts +9 -5
- package/src/views/skills/index.ts +1 -5
- package/src/views/skills/test/skills.test.ts +0 -4
- package/src/views/slides/index.ts +20 -132
- package/src/views/slides/test/header.on-click.test.ts +1 -1
- package/src/views/slides/test/index.test.ts +21 -6
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +6 -5
- package/src/views/slides/test/slide.free-text.on-change.test.ts +3 -4
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +7 -5
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +1 -1
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +1 -1
- package/src/views/slides/test/slide.qcm.on-click.test.ts +1 -1
- package/src/views/slides/test/slide.slider.on-change.test.ts +1 -1
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +1 -1
- package/src/views/slides/test/slide.template.on-change.test.ts +2 -2
- package/es/actions/index.d.ts +0 -5
- package/es/actions/index.js +0 -1
- package/es/actions/ui/navigation.d.ts +0 -18
- package/es/actions/ui/navigation.js +0 -10
- package/es/views/slides/index.d.ts +0 -142
- package/lib/actions/index.d.ts +0 -5
- package/lib/actions/index.js +0 -1
- package/lib/actions/ui/navigation.d.ts +0 -18
- package/lib/actions/ui/navigation.js +0 -10
- package/lib/views/slides/index.d.ts +0 -142
- package/src/actions/index.ts +0 -6
- /package/es/{actions → src/actions}/api/fetch-correction.js +0 -0
- /package/es/{actions → src/actions}/api/fetch-rank.js +0 -0
- /package/es/{actions → src/actions}/api/fetch-skills.js +0 -0
- /package/es/{actions → src/actions}/api/fetch-slide.js +0 -0
- /package/es/{actions → src/actions}/api/post-answer.js +0 -0
- /package/es/{actions → src/actions}/api/post-progression.js +0 -0
- /package/es/{actions → src/actions}/data/token.d.ts +0 -0
- /package/es/{actions → src/actions}/data/token.js +0 -0
- /package/es/{actions → src/actions}/ui/answers.d.ts +0 -0
- /package/es/{actions → src/actions}/ui/answers.js +0 -0
- /package/es/{actions → src/actions}/ui/next-slide.d.ts +0 -0
- /package/es/{actions → src/actions}/ui/next-slide.js +0 -0
- /package/es/{actions → src/actions}/ui/quit-popin.d.ts +0 -0
- /package/es/{actions → src/actions}/ui/quit-popin.js +0 -0
- /package/es/{actions → src/actions}/ui/slides.d.ts +0 -0
- /package/es/{actions → src/actions}/ui/slides.js +0 -0
- /package/es/{configure-store.d.ts → src/configure-store.d.ts} +0 -0
- /package/es/{helpers → src/helpers}/css-register.d.ts +0 -0
- /package/es/{helpers → src/helpers}/css-register.js +0 -0
- /package/es/{index.d.ts → src/index.d.ts} +0 -0
- /package/es/{reducers → src/reducers}/data/corrections.d.ts +0 -0
- /package/es/{reducers → src/reducers}/data/corrections.js +0 -0
- /package/es/{reducers → src/reducers}/data/index.d.ts +0 -0
- /package/es/{reducers → src/reducers}/data/index.js +0 -0
- /package/es/{reducers → src/reducers}/data/progression.d.ts +0 -0
- /package/es/{reducers → src/reducers}/data/progression.js +0 -0
- /package/es/{reducers → src/reducers}/data/rank.d.ts +0 -0
- /package/es/{reducers → src/reducers}/data/rank.js +0 -0
- /package/es/{reducers → src/reducers}/data/skills.d.ts +0 -0
- /package/es/{reducers → src/reducers}/data/skills.js +0 -0
- /package/es/{reducers → src/reducers}/data/slides.d.ts +0 -0
- /package/es/{reducers → src/reducers}/data/slides.js +0 -0
- /package/es/{reducers → src/reducers}/data/token.d.ts +0 -0
- /package/es/{reducers → src/reducers}/data/token.js +0 -0
- /package/es/{reducers → src/reducers}/index.js +0 -0
- /package/es/{reducers → src/reducers}/ui/answers.d.ts +0 -0
- /package/es/{reducers → src/reducers}/ui/answers.js +0 -0
- /package/es/{reducers → src/reducers}/ui/current-slide-ref.d.ts +0 -0
- /package/es/{reducers → src/reducers}/ui/current-slide-ref.js +0 -0
- /package/es/{reducers → src/reducers}/ui/index.js +0 -0
- /package/es/{reducers → src/reducers}/ui/positions.d.ts +0 -0
- /package/es/{reducers → src/reducers}/ui/positions.js +0 -0
- /package/es/{reducers → src/reducers}/ui/quit-popin.d.ts +0 -0
- /package/es/{reducers → src/reducers}/ui/quit-popin.js +0 -0
- /package/es/{reducers → src/reducers}/ui/show-congrats.d.ts +0 -0
- /package/es/{reducers → src/reducers}/ui/show-congrats.js +0 -0
- /package/es/{reducers → src/reducers}/ui/slide.d.ts +0 -0
- /package/es/{reducers → src/reducers}/ui/slide.js +0 -0
- /package/es/{services → src/services}/fetch-correction.d.ts +0 -0
- /package/es/{services → src/services}/fetch-correction.js +0 -0
- /package/es/{services → src/services}/fetch-rank.d.ts +0 -0
- /package/es/{services → src/services}/fetch-rank.js +0 -0
- /package/es/{services → src/services}/fetch-skills.d.ts +0 -0
- /package/es/{services → src/services}/fetch-skills.js +0 -0
- /package/es/{services → src/services}/fetch-slide.d.ts +0 -0
- /package/es/{services → src/services}/fetch-slide.js +0 -0
- /package/es/{services → src/services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
- /package/es/{services → src/services}/fetch-slides-to-review-by-skill-ref.js +0 -0
- /package/es/{services → src/services}/index.d.ts +0 -0
- /package/es/{services → src/services}/index.js +0 -0
- /package/es/{services → src/services}/post-answer.d.ts +0 -0
- /package/es/{services → src/services}/post-answer.js +0 -0
- /package/es/{services → src/services}/post-progression.d.ts +0 -0
- /package/es/{services → src/services}/post-progression.js +0 -0
- /package/es/{services → src/services}/tools/fetch-responses.d.ts +0 -0
- /package/es/{services → src/services}/tools/fetch-responses.js +0 -0
- /package/es/{services → src/services}/tools/sleep.d.ts +0 -0
- /package/es/{services → src/services}/tools/sleep.js +0 -0
- /package/es/{test → src/test}/index.test.d.ts +0 -0
- /package/es/{test → src/test}/index.test.js +0 -0
- /package/es/{test → src/test}/util/services.mock.d.ts +0 -0
- /package/es/{test → src/test}/util/services.mock.js +0 -0
- /package/es/{types → src/types}/common.js +0 -0
- /package/es/{types → src/types}/slides.d.ts +0 -0
- /package/es/{types → src/types}/slides.js +0 -0
- /package/es/{views → src/views}/slides/map-api-slide-to-ui.d.ts +0 -0
- /package/es/{views → src/views}/slides/map-api-slide-to-ui.js +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/free-text.d.ts +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/free-text.js +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/qcm-drag.d.ts +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/qcm-drag.js +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/qcm-graphic.d.ts +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/qcm-graphic.js +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/qcm.d.ts +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/qcm.js +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/slider.d.ts +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/slider.js +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/template.d.ts +0 -0
- /package/es/{views → src/views}/slides/test/fixtures/template.js +0 -0
- /package/lib/{actions → src/actions}/api/fetch-correction.js +0 -0
- /package/lib/{actions → src/actions}/api/fetch-rank.js +0 -0
- /package/lib/{actions → src/actions}/api/fetch-skills.js +0 -0
- /package/lib/{actions → src/actions}/api/fetch-slide.js +0 -0
- /package/lib/{actions → src/actions}/api/post-answer.js +0 -0
- /package/lib/{actions → src/actions}/api/post-progression.js +0 -0
- /package/lib/{actions → src/actions}/data/token.d.ts +0 -0
- /package/lib/{actions → src/actions}/data/token.js +0 -0
- /package/lib/{actions → src/actions}/ui/answers.d.ts +0 -0
- /package/lib/{actions → src/actions}/ui/answers.js +0 -0
- /package/lib/{actions → src/actions}/ui/next-slide.d.ts +0 -0
- /package/lib/{actions → src/actions}/ui/next-slide.js +0 -0
- /package/lib/{actions → src/actions}/ui/quit-popin.d.ts +0 -0
- /package/lib/{actions → src/actions}/ui/quit-popin.js +0 -0
- /package/lib/{actions → src/actions}/ui/slides.d.ts +0 -0
- /package/lib/{actions → src/actions}/ui/slides.js +0 -0
- /package/lib/{configure-store.d.ts → src/configure-store.d.ts} +0 -0
- /package/lib/{helpers → src/helpers}/css-register.d.ts +0 -0
- /package/lib/{helpers → src/helpers}/css-register.js +0 -0
- /package/lib/{index.d.ts → src/index.d.ts} +0 -0
- /package/lib/{reducers → src/reducers}/data/corrections.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/data/corrections.js +0 -0
- /package/lib/{reducers → src/reducers}/data/index.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/data/index.js +0 -0
- /package/lib/{reducers → src/reducers}/data/progression.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/data/progression.js +0 -0
- /package/lib/{reducers → src/reducers}/data/rank.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/data/rank.js +0 -0
- /package/lib/{reducers → src/reducers}/data/skills.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/data/skills.js +0 -0
- /package/lib/{reducers → src/reducers}/data/slides.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/data/slides.js +0 -0
- /package/lib/{reducers → src/reducers}/data/token.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/data/token.js +0 -0
- /package/lib/{reducers → src/reducers}/index.js +0 -0
- /package/lib/{reducers → src/reducers}/ui/answers.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/ui/answers.js +0 -0
- /package/lib/{reducers → src/reducers}/ui/current-slide-ref.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/ui/current-slide-ref.js +0 -0
- /package/lib/{reducers → src/reducers}/ui/index.js +0 -0
- /package/lib/{reducers → src/reducers}/ui/positions.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/ui/positions.js +0 -0
- /package/lib/{reducers → src/reducers}/ui/quit-popin.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/ui/quit-popin.js +0 -0
- /package/lib/{reducers → src/reducers}/ui/show-congrats.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/ui/show-congrats.js +0 -0
- /package/lib/{reducers → src/reducers}/ui/slide.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/ui/slide.js +0 -0
- /package/lib/{services → src/services}/fetch-correction.d.ts +0 -0
- /package/lib/{services → src/services}/fetch-correction.js +0 -0
- /package/lib/{services → src/services}/fetch-rank.d.ts +0 -0
- /package/lib/{services → src/services}/fetch-rank.js +0 -0
- /package/lib/{services → src/services}/fetch-skills.d.ts +0 -0
- /package/lib/{services → src/services}/fetch-skills.js +0 -0
- /package/lib/{services → src/services}/fetch-slide.d.ts +0 -0
- /package/lib/{services → src/services}/fetch-slide.js +0 -0
- /package/lib/{services → src/services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
- /package/lib/{services → src/services}/fetch-slides-to-review-by-skill-ref.js +0 -0
- /package/lib/{services → src/services}/index.d.ts +0 -0
- /package/lib/{services → src/services}/index.js +0 -0
- /package/lib/{services → src/services}/post-answer.d.ts +0 -0
- /package/lib/{services → src/services}/post-answer.js +0 -0
- /package/lib/{services → src/services}/post-progression.d.ts +0 -0
- /package/lib/{services → src/services}/post-progression.js +0 -0
- /package/lib/{services → src/services}/tools/fetch-responses.d.ts +0 -0
- /package/lib/{services → src/services}/tools/fetch-responses.js +0 -0
- /package/lib/{services → src/services}/tools/sleep.d.ts +0 -0
- /package/lib/{services → src/services}/tools/sleep.js +0 -0
- /package/lib/{test → src/test}/index.test.d.ts +0 -0
- /package/lib/{test → src/test}/index.test.js +0 -0
- /package/lib/{test → src/test}/util/services.mock.d.ts +0 -0
- /package/lib/{test → src/test}/util/services.mock.js +0 -0
- /package/lib/{types → src/types}/common.js +0 -0
- /package/lib/{types → src/types}/slides.d.ts +0 -0
- /package/lib/{types → src/types}/slides.js +0 -0
- /package/lib/{views → src/views}/slides/map-api-slide-to-ui.d.ts +0 -0
- /package/lib/{views → src/views}/slides/map-api-slide-to-ui.js +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/free-text.d.ts +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/free-text.js +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/qcm-drag.d.ts +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/qcm-drag.js +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/qcm-graphic.d.ts +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/qcm-graphic.js +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/qcm.d.ts +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/qcm.js +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/slider.d.ts +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/slider.js +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/template.d.ts +0 -0
- /package/lib/{views → src/views}/slides/test/fixtures/template.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Dispatch } from 'redux';
|
|
2
|
+
import type { StoreState } from '../../reducers';
|
|
3
|
+
import { ThunkOptions, AppOptions, ViewName } from '../../types/common';
|
|
4
|
+
export declare type NavigateToAction = {
|
|
5
|
+
type: '@@navigation/NAVIGATE_TO';
|
|
6
|
+
payload: ViewName;
|
|
7
|
+
};
|
|
8
|
+
export declare type NavigateBackAction = {
|
|
9
|
+
type: '@@navigation/NAVIGATE_BACK';
|
|
10
|
+
};
|
|
11
|
+
export declare type StartApp = {
|
|
12
|
+
type: '@@navigation/START_APP';
|
|
13
|
+
payload: AppOptions;
|
|
14
|
+
};
|
|
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>;
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
export var NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
|
|
38
|
+
export var NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
|
|
39
|
+
export var START_APP = '@@navigation/START_APP';
|
|
40
|
+
export var navigateTo = function (newViewName) {
|
|
41
|
+
return function (dispatch, getState, _a) {
|
|
42
|
+
var callbackOnViewChanged = _a.callbackOnViewChanged;
|
|
43
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var action, res;
|
|
45
|
+
return __generator(this, function (_b) {
|
|
46
|
+
switch (_b.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
action = {
|
|
49
|
+
type: NAVIGATE_TO,
|
|
50
|
+
payload: newViewName
|
|
51
|
+
};
|
|
52
|
+
return [4 /*yield*/, dispatch(action)];
|
|
53
|
+
case 1:
|
|
54
|
+
res = _b.sent();
|
|
55
|
+
if (callbackOnViewChanged) {
|
|
56
|
+
callbackOnViewChanged(newViewName);
|
|
57
|
+
}
|
|
58
|
+
return [2 /*return*/, res];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export var navigateBack = function (dispatch, getState, _a) {
|
|
65
|
+
var callbackOnViewChanged = _a.callbackOnViewChanged;
|
|
66
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var action, res, storeState, viewName;
|
|
68
|
+
return __generator(this, function (_b) {
|
|
69
|
+
switch (_b.label) {
|
|
70
|
+
case 0:
|
|
71
|
+
action = {
|
|
72
|
+
type: NAVIGATE_BACK
|
|
73
|
+
};
|
|
74
|
+
return [4 /*yield*/, dispatch(action)];
|
|
75
|
+
case 1:
|
|
76
|
+
res = _b.sent();
|
|
77
|
+
if (callbackOnViewChanged) {
|
|
78
|
+
storeState = getState();
|
|
79
|
+
viewName = storeState.ui.navigation[storeState.ui.navigation.length - 1];
|
|
80
|
+
callbackOnViewChanged(viewName);
|
|
81
|
+
}
|
|
82
|
+
return [2 /*return*/, res];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
@@ -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[];
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import concat from 'lodash/fp/concat';
|
|
2
2
|
import slice from 'lodash/fp/slice';
|
|
3
|
-
export var VIEWS = {
|
|
4
|
-
skills: 'skills',
|
|
5
|
-
onboarding: 'onboarding',
|
|
6
|
-
slides: 'slides'
|
|
7
|
-
};
|
|
8
3
|
export var slideIndexes = ['0', '1', '2', '3', '4'];
|
|
9
4
|
export var getProgressionSlidesRefs = function (progression) {
|
|
10
5
|
if (progression.state.step.current <= 5) {
|
|
@@ -10,7 +10,11 @@ export default function configureStore(options) {
|
|
|
10
10
|
traceLimit: 25
|
|
11
11
|
})
|
|
12
12
|
: compose;
|
|
13
|
-
var
|
|
13
|
+
var thunkOptions = {
|
|
14
|
+
services: options.services || getServices(),
|
|
15
|
+
callbackOnViewChanged: options.callbackOnViewChanged
|
|
16
|
+
};
|
|
17
|
+
var thunkMiddleware = thunk.withExtraArgument(thunkOptions);
|
|
14
18
|
var enhancer = _compose(applyMiddleware(thunkMiddleware));
|
|
15
19
|
var store = createStore(rootReducer, undefined, enhancer);
|
|
16
20
|
return store;
|
|
@@ -15,17 +15,17 @@ import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
|
|
|
15
15
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
16
16
|
import get from 'lodash/fp/get';
|
|
17
17
|
import configureStore from './configure-store';
|
|
18
|
-
import { navigateTo } from './actions/ui/navigation';
|
|
18
|
+
import { navigateBack, navigateTo } from './actions/ui/navigation';
|
|
19
19
|
import { storeToken } from './actions/data/token';
|
|
20
20
|
import { fetchSkills } from './actions/api/fetch-skills';
|
|
21
21
|
import { postProgression } from './actions/api/post-progression';
|
|
22
|
-
import { VIEWS } from './common';
|
|
23
22
|
import { mapStateToSlidesProps } from './views/slides';
|
|
24
23
|
import { mapStateToSkillsProps } from './views/skills';
|
|
25
24
|
var ConnectedApp = function (_a) {
|
|
26
25
|
var onQuitClick = _a.onQuitClick;
|
|
27
26
|
var dispatch = useDispatch();
|
|
28
27
|
var props = {
|
|
28
|
+
navigateBack: function () { return dispatch(navigateBack); },
|
|
29
29
|
viewName: useSelector(function (state) { return state.ui.navigation[state.ui.navigation.length - 1]; }),
|
|
30
30
|
slides: useSelector(function (state) { return mapStateToSlidesProps(state, dispatch, onQuitClick); }),
|
|
31
31
|
skills: useSelector(function (state) { return mapStateToSkillsProps(state); }),
|
|
@@ -75,7 +75,7 @@ var AppReview = function (_a) {
|
|
|
75
75
|
store.dispatch(navigateTo('loader')); // use loader while posting progression
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
var initialView = skillRef ?
|
|
78
|
+
var initialView = skillRef ? 'slides' : 'skills';
|
|
79
79
|
store.dispatch(navigateTo(initialView));
|
|
80
80
|
}, [isProgressionCreated, options, store]);
|
|
81
81
|
if (!store)
|
|
@@ -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;
|
|
@@ -7,7 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { NAVIGATE_TO, NAVIGATE_BACK } from '../../actions/ui/navigation';
|
|
11
11
|
var reducer = function (
|
|
12
12
|
// eslint-disable-next-line default-param-last
|
|
13
13
|
state, action) {
|
|
@@ -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 & {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export var mapStateToSkillsProps = function (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',
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Dispatch } from 'redux';
|
|
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';
|
|
4
|
+
import type { StoreState } from '../../reducers';
|
|
5
|
+
import type { AnswerUI } from '../../types/slides';
|
|
6
|
+
declare const ICON_VALUES: {
|
|
7
|
+
readonly right: "right";
|
|
8
|
+
readonly wrong: "wrong";
|
|
9
|
+
readonly 'no-answer': "no-answer";
|
|
10
|
+
};
|
|
11
|
+
declare type IconValue = keyof typeof ICON_VALUES;
|
|
12
|
+
declare type StepItem = {
|
|
13
|
+
current: boolean;
|
|
14
|
+
icon: IconValue;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
18
|
+
export declare type ReviewSlide = {
|
|
19
|
+
position: number;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
showCorrectionPopin?: boolean;
|
|
22
|
+
animateCorrectionPopin?: boolean;
|
|
23
|
+
parentContentTitle?: string;
|
|
24
|
+
questionText?: string;
|
|
25
|
+
answerUI?: AnswerUI;
|
|
26
|
+
animationType?: SlideUIAnimations;
|
|
27
|
+
};
|
|
28
|
+
declare type SlidesStack = {
|
|
29
|
+
[key: string]: SlideProps;
|
|
30
|
+
};
|
|
31
|
+
export declare const initialState: SlidesStack;
|
|
32
|
+
export declare const buildStepItems: (state: StoreState) => StepItem[];
|
|
33
|
+
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch, onQuitClick: () => void) => ReviewPlayerProps;
|
|
34
|
+
export {};
|
|
@@ -175,7 +175,7 @@ var getCorrectionPopinProps = function (dispatch) {
|
|
|
175
175
|
message: isCorrect ? klf : join(',', correctAnswer)
|
|
176
176
|
},
|
|
177
177
|
next: {
|
|
178
|
-
|
|
178
|
+
'aria-label': '_correctionNextAriaLabel',
|
|
179
179
|
label: '_correctionNextLabel',
|
|
180
180
|
onClick: function () {
|
|
181
181
|
dispatch(nextSlide);
|
|
@@ -199,7 +199,7 @@ var buildQuitPopinProps = function (dispatch) {
|
|
|
199
199
|
color: '#ED3436'
|
|
200
200
|
},
|
|
201
201
|
handleOnclick: onQuitClick,
|
|
202
|
-
|
|
202
|
+
'aria-label': 'Stop session'
|
|
203
203
|
},
|
|
204
204
|
secondButton: {
|
|
205
205
|
label: "Continuer d'apprendre",
|
|
@@ -207,7 +207,7 @@ var buildQuitPopinProps = function (dispatch) {
|
|
|
207
207
|
handleOnclick: function () {
|
|
208
208
|
dispatch(closeQuitPopin);
|
|
209
209
|
},
|
|
210
|
-
|
|
210
|
+
'aria-label': 'Continue review'
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
213
|
};
|
|
@@ -286,6 +286,7 @@ export var mapStateToSlidesProps = function (state, dispatch, onQuitClick) {
|
|
|
286
286
|
var isCorrect = get(['data', 'progression', 'state', 'isCorrect'], state);
|
|
287
287
|
var klf = getOr('', ['data', 'slides', currentSlideRef, 'klf'], state);
|
|
288
288
|
var showQuitPopin = get(['ui', 'showQuitPopin'], state);
|
|
289
|
+
var showCongrats = get(['ui', 'showCongrats'], state);
|
|
289
290
|
return {
|
|
290
291
|
header: {
|
|
291
292
|
mode: '__revision_mode',
|
|
@@ -293,7 +294,8 @@ export var mapStateToSlidesProps = function (state, dispatch, onQuitClick) {
|
|
|
293
294
|
onQuitClick: function () { return dispatch(openQuitPopin); },
|
|
294
295
|
'aria-label': 'aria-header-wrapper',
|
|
295
296
|
closeButtonAriaLabel: 'aria-close-button',
|
|
296
|
-
steps: buildStepItems(state)
|
|
297
|
+
steps: buildStepItems(state),
|
|
298
|
+
hiddenSteps: showCongrats
|
|
297
299
|
},
|
|
298
300
|
stack: {
|
|
299
301
|
slides: buildStackSlides(state, dispatch),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"./package.json": "./package.json"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@coorpacademy/components": "10.
|
|
45
|
+
"@coorpacademy/components": "10.25.0",
|
|
46
46
|
"@coorpacademy/redux-task": "1.1.6",
|
|
47
47
|
"cross-fetch": "^3.1.5",
|
|
48
48
|
"jwt-decode": "^3.1.2",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"webpack-cli": "^4.10.0",
|
|
78
78
|
"webpack-dev-server": "^4.11.1"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "c588893546b513a06e95efcc4dd7c5ce31b27a3f"
|
|
81
81
|
}
|
|
@@ -2,7 +2,7 @@ import type {Dispatch} from 'redux';
|
|
|
2
2
|
import buildTask from '@coorpacademy/redux-task';
|
|
3
3
|
import get from 'lodash/fp/get';
|
|
4
4
|
import type {StoreState} from '../../reducers';
|
|
5
|
-
import type {CorrectionFromAPI,
|
|
5
|
+
import type {CorrectionFromAPI, ThunkOptions} from '../../types/common';
|
|
6
6
|
|
|
7
7
|
export const CORRECTION_FETCH_REQUEST = '@@correction/FETCH_REQUEST' as const;
|
|
8
8
|
export const CORRECTION_FETCH_SUCCESS = '@@correction/FETCH_SUCCESS' as const;
|
|
@@ -22,7 +22,7 @@ export type ReceivedCorrection = {
|
|
|
22
22
|
export const fetchCorrection = (
|
|
23
23
|
dispatch: Dispatch,
|
|
24
24
|
getState: () => StoreState,
|
|
25
|
-
{services}:
|
|
25
|
+
{services}: ThunkOptions
|
|
26
26
|
): ReceivedCorrection => {
|
|
27
27
|
const state = getState();
|
|
28
28
|
const slideRef = get(['ui', 'currentSlideRef'], state);
|
|
@@ -2,7 +2,7 @@ import buildTask from '@coorpacademy/redux-task';
|
|
|
2
2
|
import get from 'lodash/fp/get';
|
|
3
3
|
import type {Dispatch} from 'redux';
|
|
4
4
|
import type {StoreState} from '../../reducers';
|
|
5
|
-
import type {Rank, Services,
|
|
5
|
+
import type {Rank, Services, ThunkOptions} from '../../types/common';
|
|
6
6
|
|
|
7
7
|
export const RANK_FETCH_START_REQUEST = '@@rank/FETCH_START_REQUEST' as const;
|
|
8
8
|
export const RANK_FETCH_START_SUCCESS = '@@rank/FETCH_START_SUCCESS' as const;
|
|
@@ -67,7 +67,7 @@ export const fetchRank = (
|
|
|
67
67
|
export const fetchStartRank = (
|
|
68
68
|
dispatch: Dispatch,
|
|
69
69
|
getState: () => StoreState,
|
|
70
|
-
{services}:
|
|
70
|
+
{services}: ThunkOptions
|
|
71
71
|
): RankAction => {
|
|
72
72
|
return fetchRank(
|
|
73
73
|
dispatch,
|
|
@@ -81,7 +81,7 @@ export const fetchStartRank = (
|
|
|
81
81
|
export const fetchEndRank = (
|
|
82
82
|
dispatch: Dispatch,
|
|
83
83
|
getState: () => StoreState,
|
|
84
|
-
{services}:
|
|
84
|
+
{services}: ThunkOptions
|
|
85
85
|
): RankAction => {
|
|
86
86
|
return fetchRank(dispatch, getState, services, [
|
|
87
87
|
RANK_FETCH_END_REQUEST,
|
|
@@ -2,7 +2,7 @@ import buildTask from '@coorpacademy/redux-task';
|
|
|
2
2
|
import get from 'lodash/fp/get';
|
|
3
3
|
import type {Dispatch} from 'redux';
|
|
4
4
|
import type {StoreState} from '../../reducers';
|
|
5
|
-
import type {
|
|
5
|
+
import type {ThunkOptions, Skill} from '../../types/common';
|
|
6
6
|
|
|
7
7
|
export const SKILLS_FETCH_REQUEST = '@@skills/FETCH_REQUEST' as const;
|
|
8
8
|
export const SKILLS_FETCH_SUCCESS = '@@skills/FETCH_SUCCESS' as const;
|
|
@@ -16,7 +16,7 @@ export type ReceivedSkills = {
|
|
|
16
16
|
export const fetchSkills = (
|
|
17
17
|
dispatch: Dispatch,
|
|
18
18
|
getState: () => StoreState,
|
|
19
|
-
{services}:
|
|
19
|
+
{services}: ThunkOptions
|
|
20
20
|
): ReceivedSkills => {
|
|
21
21
|
const action = buildTask({
|
|
22
22
|
types: [SKILLS_FETCH_REQUEST, SKILLS_FETCH_SUCCESS, SKILLS_FETCH_FAILURE],
|
|
@@ -4,7 +4,7 @@ import get from 'lodash/fp/get';
|
|
|
4
4
|
import has from 'lodash/fp/has';
|
|
5
5
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
6
6
|
import type {StoreState} from '../../reducers';
|
|
7
|
-
import type {
|
|
7
|
+
import type {ThunkOptions, SlideFromAPI} from '../../types/common';
|
|
8
8
|
import {setCurrentSlide} from '../ui/slides';
|
|
9
9
|
|
|
10
10
|
export const SLIDE_FETCH_REQUEST = '@@slides/FETCH_REQUEST' as const;
|
|
@@ -24,7 +24,11 @@ export type ReceivedSlide = {
|
|
|
24
24
|
|
|
25
25
|
export const fetchSlide =
|
|
26
26
|
(slideRef: string) =>
|
|
27
|
-
async (
|
|
27
|
+
async (
|
|
28
|
+
dispatch: Dispatch,
|
|
29
|
+
getState: () => StoreState,
|
|
30
|
+
{services}: ThunkOptions
|
|
31
|
+
): Promise<void> => {
|
|
28
32
|
const action = buildTask({
|
|
29
33
|
types: [SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS, SLIDE_FETCH_FAILURE],
|
|
30
34
|
bailout: (state: StoreState): boolean => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {Dispatch} from 'redux';
|
|
2
2
|
import buildTask from '@coorpacademy/redux-task';
|
|
3
3
|
import get from 'lodash/fp/get';
|
|
4
|
-
import type {
|
|
4
|
+
import type {ThunkOptions, ProgressionFromAPI} from '../../types/common';
|
|
5
5
|
import type {StoreState} from '../../reducers';
|
|
6
6
|
import {fetchCorrection} from './fetch-correction';
|
|
7
7
|
import {fetchSlide} from './fetch-slide';
|
|
@@ -25,7 +25,7 @@ export type PostAnswerSuccessAction = {
|
|
|
25
25
|
export const postAnswer = async (
|
|
26
26
|
dispatch: Dispatch,
|
|
27
27
|
getState: () => StoreState,
|
|
28
|
-
{services}:
|
|
28
|
+
{services}: ThunkOptions
|
|
29
29
|
): Promise<void> => {
|
|
30
30
|
const state = getState();
|
|
31
31
|
const currentSlideRef = get(['ui', 'currentSlideRef'], state);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {Dispatch} from 'redux';
|
|
2
2
|
import buildTask from '@coorpacademy/redux-task';
|
|
3
3
|
import get from 'lodash/fp/get';
|
|
4
|
-
import type {
|
|
4
|
+
import type {ThunkOptions, ProgressionFromAPI} from '../../types/common';
|
|
5
5
|
import type {StoreState} from '../../reducers';
|
|
6
6
|
import {fetchSlide} from './fetch-slide';
|
|
7
7
|
|
|
@@ -16,7 +16,11 @@ export type ReceivedProgression = {
|
|
|
16
16
|
|
|
17
17
|
export const postProgression =
|
|
18
18
|
(skillRef: string) =>
|
|
19
|
-
async (
|
|
19
|
+
async (
|
|
20
|
+
dispatch: Dispatch,
|
|
21
|
+
getState: () => StoreState,
|
|
22
|
+
{services}: ThunkOptions
|
|
23
|
+
): Promise<void> => {
|
|
20
24
|
const state = getState();
|
|
21
25
|
const token = get(['data', 'token'], state);
|
|
22
26
|
const action = buildTask({
|
|
@@ -78,7 +78,7 @@ test('should dispatch CORRECTION_FETCH_SUCCESS actions when fetchCorrection retu
|
|
|
78
78
|
}
|
|
79
79
|
];
|
|
80
80
|
|
|
81
|
-
const {dispatch} = createTestStore(t, initialState, services, expectedActions);
|
|
81
|
+
const {dispatch} = createTestStore(t, initialState, {services}, expectedActions);
|
|
82
82
|
|
|
83
83
|
await dispatch(fetchCorrection);
|
|
84
84
|
});
|
|
@@ -113,7 +113,7 @@ test('should dispatch CORRECTION_FETCH_FAILURE action when fetchCorrection fails
|
|
|
113
113
|
}
|
|
114
114
|
];
|
|
115
115
|
|
|
116
|
-
const {dispatch} = createTestStore(t, initialState, services, expectedActions);
|
|
116
|
+
const {dispatch} = createTestStore(t, initialState, {services}, expectedActions);
|
|
117
117
|
|
|
118
118
|
await dispatch(fetchCorrection);
|
|
119
119
|
});
|
|
@@ -53,7 +53,7 @@ test('should dispatch FETCH_START_SUCCESS action when fetchStartRank returns the
|
|
|
53
53
|
}
|
|
54
54
|
];
|
|
55
55
|
|
|
56
|
-
const {dispatch, getState} = createTestStore(t, initialState, services, expectedActions);
|
|
56
|
+
const {dispatch, getState} = createTestStore(t, initialState, {services}, expectedActions);
|
|
57
57
|
await dispatch(fetchStartRank);
|
|
58
58
|
|
|
59
59
|
const newState = getState();
|
|
@@ -80,7 +80,7 @@ test('should dispatch FETCH_START_FAILURE action when fetchStartRank fails', asy
|
|
|
80
80
|
}
|
|
81
81
|
];
|
|
82
82
|
|
|
83
|
-
const {dispatch} = createTestStore(t, initialState, services, expectedActions);
|
|
83
|
+
const {dispatch} = createTestStore(t, initialState, {services}, expectedActions);
|
|
84
84
|
|
|
85
85
|
await dispatch(fetchStartRank);
|
|
86
86
|
});
|
|
@@ -105,7 +105,7 @@ test('should dispatch FETCH_END_SUCCESS action when fetchEndRank returns the end
|
|
|
105
105
|
];
|
|
106
106
|
|
|
107
107
|
const _initialState = set('data.rank.start', 93, initialState);
|
|
108
|
-
const {dispatch, getState} = createTestStore(t, _initialState, services, expectedActions);
|
|
108
|
+
const {dispatch, getState} = createTestStore(t, _initialState, {services}, expectedActions);
|
|
109
109
|
|
|
110
110
|
await dispatch(fetchEndRank);
|
|
111
111
|
const newState = getState();
|
|
@@ -132,7 +132,7 @@ test('should dispatch FETCH_END_FAILURE action when fetchEndRank fails', async t
|
|
|
132
132
|
}
|
|
133
133
|
];
|
|
134
134
|
|
|
135
|
-
const {dispatch} = createTestStore(t, initialState, services, expectedActions);
|
|
135
|
+
const {dispatch} = createTestStore(t, initialState, {services}, expectedActions);
|
|
136
136
|
|
|
137
137
|
await dispatch(fetchEndRank);
|
|
138
138
|
});
|
|
@@ -48,7 +48,7 @@ test('should dispatch SKILLS_FETCH_SUCCESS actions when fetchSkills returns a li
|
|
|
48
48
|
}
|
|
49
49
|
];
|
|
50
50
|
|
|
51
|
-
const {dispatch} = createTestStore(t, initialState, services, expectedActions);
|
|
51
|
+
const {dispatch} = createTestStore(t, initialState, {services}, expectedActions);
|
|
52
52
|
|
|
53
53
|
await dispatch(fetchSkills);
|
|
54
54
|
});
|
|
@@ -72,7 +72,7 @@ test('should dispatch SKILLS_FETCH_FAILURE action when fetchSkills fails', async
|
|
|
72
72
|
}
|
|
73
73
|
];
|
|
74
74
|
|
|
75
|
-
const {dispatch} = createTestStore(t, initialState, services, expectedActions);
|
|
75
|
+
const {dispatch} = createTestStore(t, initialState, {services}, expectedActions);
|
|
76
76
|
|
|
77
77
|
await dispatch(fetchSkills);
|
|
78
78
|
});
|
|
@@ -53,7 +53,7 @@ test('should dispatch FETCH_SUCCESS and SET_CURRENT_SLIDE actions when fetchSlid
|
|
|
53
53
|
{type: SET_CURRENT_SLIDE, payload: freeTextSlide}
|
|
54
54
|
];
|
|
55
55
|
|
|
56
|
-
const {dispatch} = createTestStore(t, initialState, services, expectedActions);
|
|
56
|
+
const {dispatch} = createTestStore(t, initialState, {services}, expectedActions);
|
|
57
57
|
|
|
58
58
|
await dispatch(fetchSlide('sli_VJYjJnJhg'));
|
|
59
59
|
});
|
|
@@ -79,7 +79,7 @@ test('should dispatch SLIDE_FETCH_FAILURE action when fetchSlide fails', async t
|
|
|
79
79
|
}
|
|
80
80
|
];
|
|
81
81
|
|
|
82
|
-
const {dispatch} = createTestStore(t, initialState, services, expectedActions);
|
|
82
|
+
const {dispatch} = createTestStore(t, initialState, {services}, expectedActions);
|
|
83
83
|
|
|
84
84
|
await dispatch(fetchSlide('slide_ref'));
|
|
85
85
|
});
|
|
@@ -113,7 +113,7 @@ test('should dispatch post-answer, fetch-slide and fetch-correction and fetch-st
|
|
|
113
113
|
}
|
|
114
114
|
];
|
|
115
115
|
|
|
116
|
-
const {dispatch, getState} = createTestStore(t, initialState, services, expectedActions);
|
|
116
|
+
const {dispatch, getState} = createTestStore(t, initialState, {services}, expectedActions);
|
|
117
117
|
|
|
118
118
|
await dispatch(postAnswer);
|
|
119
119
|
|
|
@@ -202,7 +202,7 @@ test('should dispatch post-answer, fetch-correction and fetch-end-rank actions w
|
|
|
202
202
|
}
|
|
203
203
|
];
|
|
204
204
|
|
|
205
|
-
const {dispatch, getState} = createTestStore(t, stateBeforeExitNode, services, expectedActions);
|
|
205
|
+
const {dispatch, getState} = createTestStore(t, stateBeforeExitNode, {services}, expectedActions);
|
|
206
206
|
|
|
207
207
|
await dispatch(postAnswer);
|
|
208
208
|
|
|
@@ -231,10 +231,12 @@ test('should dispatch POST_ANSWER_REQUEST, then POST_ANSWER_FAILURE on error', a
|
|
|
231
231
|
t,
|
|
232
232
|
initialState,
|
|
233
233
|
{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
services: {
|
|
235
|
+
...services,
|
|
236
|
+
postAnswer: () => {
|
|
237
|
+
t.pass();
|
|
238
|
+
return Promise.reject(new Error('unexpected'));
|
|
239
|
+
}
|
|
238
240
|
}
|
|
239
241
|
},
|
|
240
242
|
expectedActions
|
|
@@ -250,7 +252,9 @@ test('should not dispatch any action && throw an error if progression does not e
|
|
|
250
252
|
const {dispatch} = createTestStore(
|
|
251
253
|
t,
|
|
252
254
|
{...initialState, data: {...initialState.data, progression: null}},
|
|
253
|
-
|
|
255
|
+
{
|
|
256
|
+
services
|
|
257
|
+
},
|
|
254
258
|
expectedActions
|
|
255
259
|
);
|
|
256
260
|
|