@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,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from 'react-dom';
|
|
3
|
+
import isNil from 'lodash/fp/isNil';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import pipe from 'lodash/fp/pipe';
|
|
6
|
+
import { WebContext } from '@coorpacademy/components/es/atom/provider';
|
|
7
|
+
import { identity } from 'lodash/fp';
|
|
8
|
+
import AppReview from '../src';
|
|
9
|
+
import { services } from '../src/test/util/services.mock';
|
|
10
|
+
const isContainerAvailable = (options) => !pipe(get('container'), isNil)(options);
|
|
11
|
+
const createSandbox = (options) => {
|
|
12
|
+
if (!isContainerAvailable(options)) {
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.error('[AppReview sandbox] Requires a container.');
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const container = document.getElementById(options.container);
|
|
18
|
+
// mode mobile/web
|
|
19
|
+
const appOptions = {
|
|
20
|
+
token: process.env.API_TEST_TOKEN || '',
|
|
21
|
+
skillRef: '123',
|
|
22
|
+
services,
|
|
23
|
+
onQuitClick: () => {
|
|
24
|
+
location.reload();
|
|
25
|
+
},
|
|
26
|
+
url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
|
|
27
|
+
};
|
|
28
|
+
const skin = {
|
|
29
|
+
common: {
|
|
30
|
+
primary: '#248e59'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
render(React.createElement(WebContext, { skin: skin, translate: identity },
|
|
34
|
+
React.createElement(AppReview, { options: appOptions })), container);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
// -----------------------------------------------------------------------------
|
|
38
|
+
if (window && !window.createSandbox) {
|
|
39
|
+
window.createSandbox = createSandbox;
|
|
40
|
+
}
|
|
41
|
+
createSandbox({ container: 'root' });
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import type { ExecutionContext } from 'ava';
|
|
2
2
|
import { AnyAction, Store } from 'redux';
|
|
3
|
+
import { ThunkOptions } from '../../types/common';
|
|
3
4
|
import { StoreState } from '../../reducers';
|
|
4
|
-
|
|
5
|
-
export declare const createTestStore: (t: ExecutionContext, initialState: StoreState, services: Services, actions: AnyAction[]) => Store<StoreState, AnyAction>;
|
|
5
|
+
export declare const createTestStore: (t: ExecutionContext, initialState: StoreState, thunkOptions: ThunkOptions, actions: AnyAction[]) => Store<StoreState, AnyAction>;
|
|
@@ -9,8 +9,8 @@ const assertActionsMiddleware = (t, ACTIONS) => constant((next) => (action) => {
|
|
|
9
9
|
t.deepEqual(action, expectedAction);
|
|
10
10
|
return next(action);
|
|
11
11
|
});
|
|
12
|
-
export const createTestStore = (t, initialState,
|
|
13
|
-
const thunkMiddleware = thunk.withExtraArgument(
|
|
12
|
+
export const createTestStore = (t, initialState, thunkOptions, actions) => {
|
|
13
|
+
const thunkMiddleware = thunk.withExtraArgument(thunkOptions);
|
|
14
14
|
const enhancer = compose(applyMiddleware(thunkMiddleware, assertActionsMiddleware(t, actions)));
|
|
15
15
|
return createStore(rootReducer, initialState, enhancer);
|
|
16
16
|
};
|
|
@@ -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,26 @@
|
|
|
1
|
+
export const NAVIGATE_TO = '@@navigation/NAVIGATE_TO';
|
|
2
|
+
export const NAVIGATE_BACK = '@@navigation/NAVIGATE_BACK';
|
|
3
|
+
export const START_APP = '@@navigation/START_APP';
|
|
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
|
+
};
|
|
@@ -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 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) {
|
|
@@ -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;
|
|
@@ -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)
|
|
@@ -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;
|
|
@@ -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 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',
|
|
@@ -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 {};
|
|
@@ -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),
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from 'react-dom';
|
|
3
|
+
import isNil from 'lodash/fp/isNil';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import pipe from 'lodash/fp/pipe';
|
|
6
|
+
import { WebContext } from '@coorpacademy/components/es/atom/provider';
|
|
7
|
+
import { identity } from 'lodash/fp';
|
|
8
|
+
import AppReview from '../src';
|
|
9
|
+
import { services } from '../src/test/util/services.mock';
|
|
10
|
+
var isContainerAvailable = function (options) {
|
|
11
|
+
return !pipe(get('container'), isNil)(options);
|
|
12
|
+
};
|
|
13
|
+
var createSandbox = function (options) {
|
|
14
|
+
if (!isContainerAvailable(options)) {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.error('[AppReview sandbox] Requires a container.');
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
var container = document.getElementById(options.container);
|
|
20
|
+
// mode mobile/web
|
|
21
|
+
var appOptions = {
|
|
22
|
+
token: process.env.API_TEST_TOKEN || '',
|
|
23
|
+
skillRef: '123',
|
|
24
|
+
services: services,
|
|
25
|
+
onQuitClick: function () {
|
|
26
|
+
location.reload();
|
|
27
|
+
},
|
|
28
|
+
url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
|
|
29
|
+
};
|
|
30
|
+
var skin = {
|
|
31
|
+
common: {
|
|
32
|
+
primary: '#248e59'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
render(React.createElement(WebContext, { skin: skin, translate: identity },
|
|
36
|
+
React.createElement(AppReview, { options: appOptions })), container);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// -----------------------------------------------------------------------------
|
|
40
|
+
if (window && !window.createSandbox) {
|
|
41
|
+
window.createSandbox = createSandbox;
|
|
42
|
+
}
|
|
43
|
+
createSandbox({ container: 'root' });
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import type { ExecutionContext } from 'ava';
|
|
2
2
|
import { AnyAction, Store } from 'redux';
|
|
3
|
+
import { ThunkOptions } from '../../types/common';
|
|
3
4
|
import { StoreState } from '../../reducers';
|
|
4
|
-
|
|
5
|
-
export declare const createTestStore: (t: ExecutionContext, initialState: StoreState, services: Services, actions: AnyAction[]) => Store<StoreState, AnyAction>;
|
|
5
|
+
export declare const createTestStore: (t: ExecutionContext, initialState: StoreState, thunkOptions: ThunkOptions, actions: AnyAction[]) => Store<StoreState, AnyAction>;
|
|
@@ -11,8 +11,8 @@ var assertActionsMiddleware = function (t, ACTIONS) {
|
|
|
11
11
|
return next(action);
|
|
12
12
|
}; });
|
|
13
13
|
};
|
|
14
|
-
export var createTestStore = function (t, initialState,
|
|
15
|
-
var thunkMiddleware = thunk.withExtraArgument(
|
|
14
|
+
export var createTestStore = function (t, initialState, thunkOptions, actions) {
|
|
15
|
+
var thunkMiddleware = thunk.withExtraArgument(thunkOptions);
|
|
16
16
|
var enhancer = compose(applyMiddleware(thunkMiddleware, assertActionsMiddleware(t, actions)));
|
|
17
17
|
return createStore(rootReducer, initialState, enhancer);
|
|
18
18
|
};
|