@coorpacademy/app-review 0.5.6-alpha.8 → 0.5.6
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/{lib/src → es}/index.d.ts +1 -0
- package/es/{src/index.js → index.js} +4 -4
- package/es/{src/test → test}/index.test.js +0 -1
- package/{lib/src → es}/test/util/services.mock.d.ts +0 -1
- package/es/{src/test → test}/util/services.mock.js +0 -1
- package/{lib/src → es}/types/common.d.ts +2 -5
- package/{lib/src → es}/views/slides/index.d.ts +1 -2
- package/es/{src/views → views}/slides/index.js +18 -20
- package/{es/src → lib}/index.d.ts +1 -0
- package/lib/{src/index.js → index.js} +5 -4
- package/lib/{src/test → test}/index.test.js +0 -1
- package/{es/src → lib}/test/util/services.mock.d.ts +0 -1
- package/lib/{src/test → test}/util/services.mock.js +0 -1
- package/{es/src → lib}/types/common.d.ts +2 -5
- package/{es/src → lib}/views/slides/index.d.ts +1 -2
- package/lib/{src/views → views}/slides/index.js +18 -20
- package/package.json +3 -5
- package/src/index.tsx +6 -5
- package/src/test/index.test.tsx +0 -1
- package/src/test/util/services.mock.ts +0 -2
- package/src/types/common.ts +2 -6
- package/src/types/globals.d.ts +0 -1
- package/src/views/slides/index.ts +19 -43
- package/src/views/slides/test/header.on-click.test.ts +3 -10
- package/src/views/slides/test/index.test.ts +55 -58
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +3 -12
- package/src/views/slides/test/slide.free-text.on-change.test.ts +2 -4
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +3 -6
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +2 -3
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +2 -3
- package/src/views/slides/test/slide.qcm.on-click.test.ts +2 -3
- package/src/views/slides/test/slide.slider.on-change.test.ts +2 -3
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +2 -3
- package/src/views/slides/test/slide.template.on-change.test.ts +4 -5
- package/es/locales/en/review.json +0 -14
- package/es/sandbox/index.d.ts +0 -9
- package/es/sandbox/index.js +0 -56
- package/lib/locales/en/review.json +0 -14
- package/lib/sandbox/index.d.ts +0 -9
- package/lib/sandbox/index.js +0 -67
- package/locales/en/review.json +0 -14
- /package/es/{src/actions → actions}/api/fetch-correction.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-correction.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-rank.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-rank.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-skills.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-skills.js +0 -0
- /package/es/{src/actions → actions}/api/fetch-slide.d.ts +0 -0
- /package/es/{src/actions → actions}/api/fetch-slide.js +0 -0
- /package/es/{src/actions → actions}/api/post-answer.d.ts +0 -0
- /package/es/{src/actions → actions}/api/post-answer.js +0 -0
- /package/es/{src/actions → actions}/api/post-progression.d.ts +0 -0
- /package/es/{src/actions → actions}/api/post-progression.js +0 -0
- /package/es/{src/actions → actions}/data/token.d.ts +0 -0
- /package/es/{src/actions → actions}/data/token.js +0 -0
- /package/es/{src/actions → actions}/index.d.ts +0 -0
- /package/es/{src/actions → actions}/index.js +0 -0
- /package/es/{src/actions → actions}/test/create-test-store.d.ts +0 -0
- /package/es/{src/actions → actions}/test/create-test-store.js +0 -0
- /package/es/{src/actions → actions}/ui/answers.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/answers.js +0 -0
- /package/es/{src/actions → actions}/ui/navigation.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/navigation.js +0 -0
- /package/es/{src/actions → actions}/ui/next-slide.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/next-slide.js +0 -0
- /package/es/{src/actions → actions}/ui/quit-popin.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/quit-popin.js +0 -0
- /package/es/{src/actions → actions}/ui/slides.d.ts +0 -0
- /package/es/{src/actions → actions}/ui/slides.js +0 -0
- /package/es/{src/common → common}/index.d.ts +0 -0
- /package/es/{src/common → common}/index.js +0 -0
- /package/es/{src/configure-store.d.ts → configure-store.d.ts} +0 -0
- /package/es/{src/configure-store.js → configure-store.js} +0 -0
- /package/es/{src/helpers → helpers}/css-register.d.ts +0 -0
- /package/es/{src/helpers → helpers}/css-register.js +0 -0
- /package/es/{src/reducers → reducers}/data/corrections.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/corrections.js +0 -0
- /package/es/{src/reducers → reducers}/data/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/index.js +0 -0
- /package/es/{src/reducers → reducers}/data/progression.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/progression.js +0 -0
- /package/es/{src/reducers → reducers}/data/rank.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/rank.js +0 -0
- /package/es/{src/reducers → reducers}/data/skills.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/skills.js +0 -0
- /package/es/{src/reducers → reducers}/data/slides.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/slides.js +0 -0
- /package/es/{src/reducers → reducers}/data/token.d.ts +0 -0
- /package/es/{src/reducers → reducers}/data/token.js +0 -0
- /package/es/{src/reducers → reducers}/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/index.js +0 -0
- /package/es/{src/reducers → reducers}/ui/answers.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/answers.js +0 -0
- /package/es/{src/reducers → reducers}/ui/current-slide-ref.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/current-slide-ref.js +0 -0
- /package/es/{src/reducers → reducers}/ui/index.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/index.js +0 -0
- /package/es/{src/reducers → reducers}/ui/navigation.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/navigation.js +0 -0
- /package/es/{src/reducers → reducers}/ui/positions.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/positions.js +0 -0
- /package/es/{src/reducers → reducers}/ui/quit-popin.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/quit-popin.js +0 -0
- /package/es/{src/reducers → reducers}/ui/show-congrats.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/show-congrats.js +0 -0
- /package/es/{src/reducers → reducers}/ui/slide.d.ts +0 -0
- /package/es/{src/reducers → reducers}/ui/slide.js +0 -0
- /package/es/{src/services → services}/fetch-correction.d.ts +0 -0
- /package/es/{src/services → services}/fetch-correction.js +0 -0
- /package/es/{src/services → services}/fetch-rank.d.ts +0 -0
- /package/es/{src/services → services}/fetch-rank.js +0 -0
- /package/es/{src/services → services}/fetch-skills.d.ts +0 -0
- /package/es/{src/services → services}/fetch-skills.js +0 -0
- /package/es/{src/services → services}/fetch-slide.d.ts +0 -0
- /package/es/{src/services → services}/fetch-slide.js +0 -0
- /package/es/{src/services → services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
- /package/es/{src/services → services}/fetch-slides-to-review-by-skill-ref.js +0 -0
- /package/es/{src/services → services}/index.d.ts +0 -0
- /package/es/{src/services → services}/index.js +0 -0
- /package/es/{src/services → services}/post-answer.d.ts +0 -0
- /package/es/{src/services → services}/post-answer.js +0 -0
- /package/es/{src/services → services}/post-progression.d.ts +0 -0
- /package/es/{src/services → services}/post-progression.js +0 -0
- /package/es/{src/services → services}/tools/fetch-responses.d.ts +0 -0
- /package/es/{src/services → services}/tools/fetch-responses.js +0 -0
- /package/es/{src/services → services}/tools/sleep.d.ts +0 -0
- /package/es/{src/services → services}/tools/sleep.js +0 -0
- /package/es/{src/test → test}/index.test.d.ts +0 -0
- /package/es/{src/types → types}/common.js +0 -0
- /package/es/{src/types → types}/slides.d.ts +0 -0
- /package/es/{src/types → types}/slides.js +0 -0
- /package/es/{src/views → views}/skills/index.d.ts +0 -0
- /package/es/{src/views → views}/skills/index.js +0 -0
- /package/es/{src/views → views}/slides/map-api-slide-to-ui.d.ts +0 -0
- /package/es/{src/views → views}/slides/map-api-slide-to-ui.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/free-text.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/free-text.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm-drag.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm-drag.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm-graphic.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm-graphic.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/qcm.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/slider.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/slider.js +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/template.d.ts +0 -0
- /package/es/{src/views → views}/slides/test/fixtures/template.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-correction.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-correction.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-rank.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-rank.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-skills.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-skills.js +0 -0
- /package/lib/{src/actions → actions}/api/fetch-slide.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/fetch-slide.js +0 -0
- /package/lib/{src/actions → actions}/api/post-answer.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/post-answer.js +0 -0
- /package/lib/{src/actions → actions}/api/post-progression.d.ts +0 -0
- /package/lib/{src/actions → actions}/api/post-progression.js +0 -0
- /package/lib/{src/actions → actions}/data/token.d.ts +0 -0
- /package/lib/{src/actions → actions}/data/token.js +0 -0
- /package/lib/{src/actions → actions}/index.d.ts +0 -0
- /package/lib/{src/actions → actions}/index.js +0 -0
- /package/lib/{src/actions → actions}/test/create-test-store.d.ts +0 -0
- /package/lib/{src/actions → actions}/test/create-test-store.js +0 -0
- /package/lib/{src/actions → actions}/ui/answers.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/answers.js +0 -0
- /package/lib/{src/actions → actions}/ui/navigation.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/navigation.js +0 -0
- /package/lib/{src/actions → actions}/ui/next-slide.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/next-slide.js +0 -0
- /package/lib/{src/actions → actions}/ui/quit-popin.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/quit-popin.js +0 -0
- /package/lib/{src/actions → actions}/ui/slides.d.ts +0 -0
- /package/lib/{src/actions → actions}/ui/slides.js +0 -0
- /package/lib/{src/common → common}/index.d.ts +0 -0
- /package/lib/{src/common → common}/index.js +0 -0
- /package/lib/{src/configure-store.d.ts → configure-store.d.ts} +0 -0
- /package/lib/{src/configure-store.js → configure-store.js} +0 -0
- /package/lib/{src/helpers → helpers}/css-register.d.ts +0 -0
- /package/lib/{src/helpers → helpers}/css-register.js +0 -0
- /package/lib/{src/reducers → reducers}/data/corrections.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/corrections.js +0 -0
- /package/lib/{src/reducers → reducers}/data/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/index.js +0 -0
- /package/lib/{src/reducers → reducers}/data/progression.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/progression.js +0 -0
- /package/lib/{src/reducers → reducers}/data/rank.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/rank.js +0 -0
- /package/lib/{src/reducers → reducers}/data/skills.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/skills.js +0 -0
- /package/lib/{src/reducers → reducers}/data/slides.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/slides.js +0 -0
- /package/lib/{src/reducers → reducers}/data/token.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/data/token.js +0 -0
- /package/lib/{src/reducers → reducers}/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/index.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/answers.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/answers.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/current-slide-ref.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/current-slide-ref.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/index.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/index.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/navigation.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/navigation.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/positions.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/positions.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/quit-popin.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/quit-popin.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/show-congrats.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/show-congrats.js +0 -0
- /package/lib/{src/reducers → reducers}/ui/slide.d.ts +0 -0
- /package/lib/{src/reducers → reducers}/ui/slide.js +0 -0
- /package/lib/{src/services → services}/fetch-correction.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-correction.js +0 -0
- /package/lib/{src/services → services}/fetch-rank.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-rank.js +0 -0
- /package/lib/{src/services → services}/fetch-skills.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-skills.js +0 -0
- /package/lib/{src/services → services}/fetch-slide.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-slide.js +0 -0
- /package/lib/{src/services → services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
- /package/lib/{src/services → services}/fetch-slides-to-review-by-skill-ref.js +0 -0
- /package/lib/{src/services → services}/index.d.ts +0 -0
- /package/lib/{src/services → services}/index.js +0 -0
- /package/lib/{src/services → services}/post-answer.d.ts +0 -0
- /package/lib/{src/services → services}/post-answer.js +0 -0
- /package/lib/{src/services → services}/post-progression.d.ts +0 -0
- /package/lib/{src/services → services}/post-progression.js +0 -0
- /package/lib/{src/services → services}/tools/fetch-responses.d.ts +0 -0
- /package/lib/{src/services → services}/tools/fetch-responses.js +0 -0
- /package/lib/{src/services → services}/tools/sleep.d.ts +0 -0
- /package/lib/{src/services → services}/tools/sleep.js +0 -0
- /package/lib/{src/test → test}/index.test.d.ts +0 -0
- /package/lib/{src/types → types}/common.js +0 -0
- /package/lib/{src/types → types}/slides.d.ts +0 -0
- /package/lib/{src/types → types}/slides.js +0 -0
- /package/lib/{src/views → views}/skills/index.d.ts +0 -0
- /package/lib/{src/views → views}/skills/index.js +0 -0
- /package/lib/{src/views → views}/slides/map-api-slide-to-ui.d.ts +0 -0
- /package/lib/{src/views → views}/slides/map-api-slide-to-ui.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/free-text.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/free-text.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm-drag.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm-drag.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm-graphic.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm-graphic.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/qcm.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/slider.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/slider.js +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/template.d.ts +0 -0
- /package/lib/{src/views → views}/slides/test/fixtures/template.js +0 -0
|
@@ -11,11 +11,11 @@ import { postProgression } from './actions/api/post-progression';
|
|
|
11
11
|
import { VIEWS } from './common';
|
|
12
12
|
import { mapStateToSlidesProps } from './views/slides';
|
|
13
13
|
import { mapStateToSkillsProps } from './views/skills';
|
|
14
|
-
const ConnectedApp = (
|
|
14
|
+
const ConnectedApp = ({ onQuitClick }) => {
|
|
15
15
|
const dispatch = useDispatch();
|
|
16
16
|
const props = {
|
|
17
17
|
viewName: useSelector((state) => state.ui.navigation[state.ui.navigation.length - 1]),
|
|
18
|
-
slides: useSelector((state) => mapStateToSlidesProps(state, dispatch,
|
|
18
|
+
slides: useSelector((state) => mapStateToSlidesProps(state, dispatch, onQuitClick)),
|
|
19
19
|
skills: useSelector((state) => mapStateToSkillsProps(state)),
|
|
20
20
|
onboarding: {}
|
|
21
21
|
};
|
|
@@ -24,7 +24,7 @@ const ConnectedApp = (options) => {
|
|
|
24
24
|
const AppReview = ({ options }) => {
|
|
25
25
|
const [store, setStore] = useState(null);
|
|
26
26
|
const [isProgressionCreated, setIsProgressionCreated] = useState(false);
|
|
27
|
-
const
|
|
27
|
+
const onQuitClick = options.onQuitClick;
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
if (store)
|
|
30
30
|
return;
|
|
@@ -68,6 +68,6 @@ const AppReview = ({ options }) => {
|
|
|
68
68
|
if (!store)
|
|
69
69
|
return null;
|
|
70
70
|
return (React.createElement(Provider, { store: store },
|
|
71
|
-
React.createElement(ConnectedApp, { onQuitClick: onQuitClick
|
|
71
|
+
React.createElement(ConnectedApp, { onQuitClick: onQuitClick })));
|
|
72
72
|
};
|
|
73
73
|
export default AppReview;
|
|
@@ -40,7 +40,6 @@ const appOptions = {
|
|
|
40
40
|
skillRef: 'skill_NJC0jFKoH',
|
|
41
41
|
services,
|
|
42
42
|
onQuitClick: identity,
|
|
43
|
-
translate: key => key,
|
|
44
43
|
url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
|
|
45
44
|
};
|
|
46
45
|
test('should show the loader while the app is fetching the data', async (t) => {
|
|
@@ -5,4 +5,3 @@ export declare const incorrectFreeTextPostAnswerResponse: ProgressionFromAPI;
|
|
|
5
5
|
export declare const progressionSlideWithPendingSlide: ProgressionFromAPI;
|
|
6
6
|
export declare const getChoicesCorrection: (ref: string, wrongChoice?: boolean) => CorrectionFromAPI;
|
|
7
7
|
export declare const services: Services;
|
|
8
|
-
export declare const translate: (key: string) => string;
|
|
@@ -139,14 +139,11 @@ export declare type Services = {
|
|
|
139
139
|
export declare type Options = {
|
|
140
140
|
services: Services;
|
|
141
141
|
};
|
|
142
|
-
export declare type
|
|
143
|
-
translate: (key: string, data?: unknown) => string;
|
|
144
|
-
onQuitClick: Function;
|
|
145
|
-
};
|
|
146
|
-
export declare type AppOptions = ConnectedOptions & {
|
|
142
|
+
export declare type AppOptions = {
|
|
147
143
|
token: string;
|
|
148
144
|
skillRef?: string;
|
|
149
145
|
services: Services;
|
|
146
|
+
onQuitClick: Function;
|
|
150
147
|
url: string;
|
|
151
148
|
};
|
|
152
149
|
export declare type JWT = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
|
-
import type { ConnectedOptions } from '../../types/common';
|
|
3
2
|
import { type SlideIndexes } from '../../common';
|
|
4
3
|
import type { StoreState } from '../../reducers';
|
|
5
4
|
import type { AnswerUI } from '../../types/slides';
|
|
@@ -139,5 +138,5 @@ export declare type CongratsProps = {
|
|
|
139
138
|
};
|
|
140
139
|
export declare const initialState: SlidesStack;
|
|
141
140
|
export declare const buildStepItems: (state: StoreState) => StepItem[];
|
|
142
|
-
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch,
|
|
141
|
+
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch, onQuitClick: Function) => SlidesViewProps;
|
|
143
142
|
export {};
|
|
@@ -166,22 +166,22 @@ export const buildStepItems = (state) => {
|
|
|
166
166
|
});
|
|
167
167
|
return steps;
|
|
168
168
|
};
|
|
169
|
-
const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf
|
|
169
|
+
const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf) => {
|
|
170
170
|
return {
|
|
171
171
|
klf: isCorrect
|
|
172
172
|
? undefined
|
|
173
173
|
: {
|
|
174
|
-
label:
|
|
174
|
+
label: '_klf',
|
|
175
175
|
tooltip: klf
|
|
176
176
|
},
|
|
177
|
-
resultLabel: isCorrect ?
|
|
177
|
+
resultLabel: isCorrect ? '_right' : '_wrong',
|
|
178
178
|
information: {
|
|
179
|
-
label: isCorrect ?
|
|
179
|
+
label: isCorrect ? '_klf' : '_correctAnswer',
|
|
180
180
|
message: isCorrect ? klf : join(',', correctAnswer)
|
|
181
181
|
},
|
|
182
182
|
next: {
|
|
183
|
-
ariaLabel:
|
|
184
|
-
label:
|
|
183
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
184
|
+
label: '_correctionNextLabel',
|
|
185
185
|
onClick: () => {
|
|
186
186
|
dispatch(nextSlide);
|
|
187
187
|
}
|
|
@@ -214,7 +214,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick) => {
|
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
};
|
|
217
|
-
const buildRankCard = (rank
|
|
217
|
+
const buildRankCard = (rank) => {
|
|
218
218
|
return {
|
|
219
219
|
'aria-label': 'Review Card Congrats Container',
|
|
220
220
|
'data-name': 'card-rank',
|
|
@@ -229,13 +229,13 @@ const buildRankCard = (rank, translate) => {
|
|
|
229
229
|
cardType: 'card-rank',
|
|
230
230
|
iconAriaLabel: 'Image without information',
|
|
231
231
|
className: undefined,
|
|
232
|
-
reviewCardTitle:
|
|
232
|
+
reviewCardTitle: 'You are now',
|
|
233
233
|
reviewCardValue: `${rank}`,
|
|
234
234
|
rankSuffix: 'th',
|
|
235
235
|
timerAnimation: 200
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
|
-
const buildCongratsProps = (state
|
|
238
|
+
const buildCongratsProps = (state) => {
|
|
239
239
|
if (!state.ui.showCongrats)
|
|
240
240
|
return;
|
|
241
241
|
const progression = state.data.progression;
|
|
@@ -258,18 +258,18 @@ const buildCongratsProps = (state, translate) => {
|
|
|
258
258
|
iconAriaLabel: 'Image without information',
|
|
259
259
|
className: undefined,
|
|
260
260
|
cardType: 'card-star',
|
|
261
|
-
reviewCardTitle:
|
|
261
|
+
reviewCardTitle: 'You have won',
|
|
262
262
|
reviewCardValue: `${stars}`,
|
|
263
263
|
timerAnimation: 200
|
|
264
264
|
};
|
|
265
265
|
const { start, end } = state.data.rank;
|
|
266
266
|
const newRank = start - end;
|
|
267
|
-
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end
|
|
267
|
+
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end) : undefined;
|
|
268
268
|
return {
|
|
269
269
|
'aria-label': 'Review Congratulations',
|
|
270
270
|
'data-name': 'review-congrats',
|
|
271
271
|
animationLottie: confettiAnimation,
|
|
272
|
-
title:
|
|
272
|
+
title: 'Congratulations!',
|
|
273
273
|
cardCongratsStar,
|
|
274
274
|
cardCongratsRank,
|
|
275
275
|
buttonRevising: undefined,
|
|
@@ -281,8 +281,7 @@ const isEndOfProgression = (progression) => {
|
|
|
281
281
|
return false;
|
|
282
282
|
return progression.state.nextContent.ref === 'successExitNode';
|
|
283
283
|
};
|
|
284
|
-
export const mapStateToSlidesProps = (state, dispatch,
|
|
285
|
-
const { translate, onQuitClick } = options;
|
|
284
|
+
export const mapStateToSlidesProps = (state, dispatch, onQuitClick) => {
|
|
286
285
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
287
286
|
const endReview = isEndOfProgression(state.data.progression);
|
|
288
287
|
const correction = get(['data', 'corrections', currentSlideRef], state);
|
|
@@ -291,8 +290,8 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
291
290
|
const showQuitPopin = get(['ui', 'showQuitPopin'], state);
|
|
292
291
|
return {
|
|
293
292
|
header: {
|
|
294
|
-
mode:
|
|
295
|
-
skillName:
|
|
293
|
+
mode: '__revision_mode',
|
|
294
|
+
skillName: '__agility',
|
|
296
295
|
onQuitClick: () => dispatch(openQuitPopin),
|
|
297
296
|
'aria-label': 'aria-header-wrapper',
|
|
298
297
|
closeButtonAriaLabel: 'aria-close-button',
|
|
@@ -301,17 +300,16 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
301
300
|
stack: {
|
|
302
301
|
slides: buildStackSlides(state, dispatch),
|
|
303
302
|
validateButton: {
|
|
304
|
-
label:
|
|
303
|
+
label: '__validate',
|
|
305
304
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
306
305
|
onClick: () => {
|
|
307
306
|
dispatch(postAnswer);
|
|
308
307
|
}
|
|
309
308
|
},
|
|
310
|
-
correctionPopinProps: correction &&
|
|
311
|
-
getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf, options.translate),
|
|
309
|
+
correctionPopinProps: correction && getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf),
|
|
312
310
|
endReview: endReview && state.ui.showCongrats
|
|
313
311
|
},
|
|
314
|
-
congrats: buildCongratsProps(state
|
|
312
|
+
congrats: buildCongratsProps(state),
|
|
315
313
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick) : undefined
|
|
316
314
|
};
|
|
317
315
|
};
|
|
@@ -22,11 +22,12 @@ import { postProgression } from './actions/api/post-progression';
|
|
|
22
22
|
import { VIEWS } from './common';
|
|
23
23
|
import { mapStateToSlidesProps } from './views/slides';
|
|
24
24
|
import { mapStateToSkillsProps } from './views/skills';
|
|
25
|
-
var ConnectedApp = function (
|
|
25
|
+
var ConnectedApp = function (_a) {
|
|
26
|
+
var onQuitClick = _a.onQuitClick;
|
|
26
27
|
var dispatch = useDispatch();
|
|
27
28
|
var props = {
|
|
28
29
|
viewName: useSelector(function (state) { return state.ui.navigation[state.ui.navigation.length - 1]; }),
|
|
29
|
-
slides: useSelector(function (state) { return mapStateToSlidesProps(state, dispatch,
|
|
30
|
+
slides: useSelector(function (state) { return mapStateToSlidesProps(state, dispatch, onQuitClick); }),
|
|
30
31
|
skills: useSelector(function (state) { return mapStateToSkillsProps(state); }),
|
|
31
32
|
onboarding: {}
|
|
32
33
|
};
|
|
@@ -36,7 +37,7 @@ var AppReview = function (_a) {
|
|
|
36
37
|
var options = _a.options;
|
|
37
38
|
var _b = useState(null), store = _b[0], setStore = _b[1];
|
|
38
39
|
var _c = useState(false), isProgressionCreated = _c[0], setIsProgressionCreated = _c[1];
|
|
39
|
-
var
|
|
40
|
+
var onQuitClick = options.onQuitClick;
|
|
40
41
|
useEffect(function () {
|
|
41
42
|
if (store)
|
|
42
43
|
return;
|
|
@@ -80,6 +81,6 @@ var AppReview = function (_a) {
|
|
|
80
81
|
if (!store)
|
|
81
82
|
return null;
|
|
82
83
|
return (React.createElement(Provider, { store: store },
|
|
83
|
-
React.createElement(ConnectedApp, { onQuitClick: onQuitClick
|
|
84
|
+
React.createElement(ConnectedApp, { onQuitClick: onQuitClick })));
|
|
84
85
|
};
|
|
85
86
|
export default AppReview;
|
|
@@ -135,7 +135,6 @@ var appOptions = {
|
|
|
135
135
|
skillRef: 'skill_NJC0jFKoH',
|
|
136
136
|
services: services,
|
|
137
137
|
onQuitClick: identity,
|
|
138
|
-
translate: function (key) { return key; },
|
|
139
138
|
url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
|
|
140
139
|
};
|
|
141
140
|
test('should show the loader while the app is fetching the data', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -5,4 +5,3 @@ export declare const incorrectFreeTextPostAnswerResponse: ProgressionFromAPI;
|
|
|
5
5
|
export declare const progressionSlideWithPendingSlide: ProgressionFromAPI;
|
|
6
6
|
export declare const getChoicesCorrection: (ref: string, wrongChoice?: boolean) => CorrectionFromAPI;
|
|
7
7
|
export declare const services: Services;
|
|
8
|
-
export declare const translate: (key: string) => string;
|
|
@@ -446,4 +446,3 @@ export var services = {
|
|
|
446
446
|
fetchRank: function () { return Promise.resolve(fetchRankResponse); },
|
|
447
447
|
fetchSlidesToReviewBySkillRef: function () { return Promise.resolve(fetchSlidesToReviewBySkillRefResponse); }
|
|
448
448
|
};
|
|
449
|
-
export var translate = function (key) { return "___".concat(key); };
|
|
@@ -139,14 +139,11 @@ export declare type Services = {
|
|
|
139
139
|
export declare type Options = {
|
|
140
140
|
services: Services;
|
|
141
141
|
};
|
|
142
|
-
export declare type
|
|
143
|
-
translate: (key: string, data?: unknown) => string;
|
|
144
|
-
onQuitClick: Function;
|
|
145
|
-
};
|
|
146
|
-
export declare type AppOptions = ConnectedOptions & {
|
|
142
|
+
export declare type AppOptions = {
|
|
147
143
|
token: string;
|
|
148
144
|
skillRef?: string;
|
|
149
145
|
services: Services;
|
|
146
|
+
onQuitClick: Function;
|
|
150
147
|
url: string;
|
|
151
148
|
};
|
|
152
149
|
export declare type JWT = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
|
-
import type { ConnectedOptions } from '../../types/common';
|
|
3
2
|
import { type SlideIndexes } from '../../common';
|
|
4
3
|
import type { StoreState } from '../../reducers';
|
|
5
4
|
import type { AnswerUI } from '../../types/slides';
|
|
@@ -139,5 +138,5 @@ export declare type CongratsProps = {
|
|
|
139
138
|
};
|
|
140
139
|
export declare const initialState: SlidesStack;
|
|
141
140
|
export declare const buildStepItems: (state: StoreState) => StepItem[];
|
|
142
|
-
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch,
|
|
141
|
+
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch, onQuitClick: Function) => SlidesViewProps;
|
|
143
142
|
export {};
|
|
@@ -161,22 +161,22 @@ export var buildStepItems = function (state) {
|
|
|
161
161
|
return steps;
|
|
162
162
|
};
|
|
163
163
|
var getCorrectionPopinProps = function (dispatch) {
|
|
164
|
-
return function (isCorrect, correctAnswer, klf
|
|
164
|
+
return function (isCorrect, correctAnswer, klf) {
|
|
165
165
|
return {
|
|
166
166
|
klf: isCorrect
|
|
167
167
|
? undefined
|
|
168
168
|
: {
|
|
169
|
-
label:
|
|
169
|
+
label: '_klf',
|
|
170
170
|
tooltip: klf
|
|
171
171
|
},
|
|
172
|
-
resultLabel: isCorrect ?
|
|
172
|
+
resultLabel: isCorrect ? '_right' : '_wrong',
|
|
173
173
|
information: {
|
|
174
|
-
label: isCorrect ?
|
|
174
|
+
label: isCorrect ? '_klf' : '_correctAnswer',
|
|
175
175
|
message: isCorrect ? klf : join(',', correctAnswer)
|
|
176
176
|
},
|
|
177
177
|
next: {
|
|
178
|
-
ariaLabel:
|
|
179
|
-
label:
|
|
178
|
+
ariaLabel: '_correctionNextAriaLabel',
|
|
179
|
+
label: '_correctionNextLabel',
|
|
180
180
|
onClick: function () {
|
|
181
181
|
dispatch(nextSlide);
|
|
182
182
|
}
|
|
@@ -212,7 +212,7 @@ var buildQuitPopinProps = function (dispatch) {
|
|
|
212
212
|
};
|
|
213
213
|
};
|
|
214
214
|
};
|
|
215
|
-
var buildRankCard = function (rank
|
|
215
|
+
var buildRankCard = function (rank) {
|
|
216
216
|
return {
|
|
217
217
|
'aria-label': 'Review Card Congrats Container',
|
|
218
218
|
'data-name': 'card-rank',
|
|
@@ -227,13 +227,13 @@ var buildRankCard = function (rank, translate) {
|
|
|
227
227
|
cardType: 'card-rank',
|
|
228
228
|
iconAriaLabel: 'Image without information',
|
|
229
229
|
className: undefined,
|
|
230
|
-
reviewCardTitle:
|
|
230
|
+
reviewCardTitle: 'You are now',
|
|
231
231
|
reviewCardValue: "".concat(rank),
|
|
232
232
|
rankSuffix: 'th',
|
|
233
233
|
timerAnimation: 200
|
|
234
234
|
};
|
|
235
235
|
};
|
|
236
|
-
var buildCongratsProps = function (state
|
|
236
|
+
var buildCongratsProps = function (state) {
|
|
237
237
|
if (!state.ui.showCongrats)
|
|
238
238
|
return;
|
|
239
239
|
var progression = state.data.progression;
|
|
@@ -256,18 +256,18 @@ var buildCongratsProps = function (state, translate) {
|
|
|
256
256
|
iconAriaLabel: 'Image without information',
|
|
257
257
|
className: undefined,
|
|
258
258
|
cardType: 'card-star',
|
|
259
|
-
reviewCardTitle:
|
|
259
|
+
reviewCardTitle: 'You have won',
|
|
260
260
|
reviewCardValue: "".concat(stars),
|
|
261
261
|
timerAnimation: 200
|
|
262
262
|
};
|
|
263
263
|
var _a = state.data.rank, start = _a.start, end = _a.end;
|
|
264
264
|
var newRank = start - end;
|
|
265
|
-
var cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end
|
|
265
|
+
var cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end) : undefined;
|
|
266
266
|
return {
|
|
267
267
|
'aria-label': 'Review Congratulations',
|
|
268
268
|
'data-name': 'review-congrats',
|
|
269
269
|
animationLottie: confettiAnimation,
|
|
270
|
-
title:
|
|
270
|
+
title: 'Congratulations!',
|
|
271
271
|
cardCongratsStar: cardCongratsStar,
|
|
272
272
|
cardCongratsRank: cardCongratsRank,
|
|
273
273
|
buttonRevising: undefined,
|
|
@@ -279,8 +279,7 @@ var isEndOfProgression = function (progression) {
|
|
|
279
279
|
return false;
|
|
280
280
|
return progression.state.nextContent.ref === 'successExitNode';
|
|
281
281
|
};
|
|
282
|
-
export var mapStateToSlidesProps = function (state, dispatch,
|
|
283
|
-
var translate = options.translate, onQuitClick = options.onQuitClick;
|
|
282
|
+
export var mapStateToSlidesProps = function (state, dispatch, onQuitClick) {
|
|
284
283
|
var currentSlideRef = getCurrentSlideRef(state);
|
|
285
284
|
var endReview = isEndOfProgression(state.data.progression);
|
|
286
285
|
var correction = get(['data', 'corrections', currentSlideRef], state);
|
|
@@ -289,8 +288,8 @@ export var mapStateToSlidesProps = function (state, dispatch, options) {
|
|
|
289
288
|
var showQuitPopin = get(['ui', 'showQuitPopin'], state);
|
|
290
289
|
return {
|
|
291
290
|
header: {
|
|
292
|
-
mode:
|
|
293
|
-
skillName:
|
|
291
|
+
mode: '__revision_mode',
|
|
292
|
+
skillName: '__agility',
|
|
294
293
|
onQuitClick: function () { return dispatch(openQuitPopin); },
|
|
295
294
|
'aria-label': 'aria-header-wrapper',
|
|
296
295
|
closeButtonAriaLabel: 'aria-close-button',
|
|
@@ -299,17 +298,16 @@ export var mapStateToSlidesProps = function (state, dispatch, options) {
|
|
|
299
298
|
stack: {
|
|
300
299
|
slides: buildStackSlides(state, dispatch),
|
|
301
300
|
validateButton: {
|
|
302
|
-
label:
|
|
301
|
+
label: '__validate',
|
|
303
302
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
304
303
|
onClick: function () {
|
|
305
304
|
dispatch(postAnswer);
|
|
306
305
|
}
|
|
307
306
|
},
|
|
308
|
-
correctionPopinProps: correction &&
|
|
309
|
-
getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf, options.translate),
|
|
307
|
+
correctionPopinProps: correction && getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf),
|
|
310
308
|
endReview: endReview && state.ui.showCongrats
|
|
311
309
|
},
|
|
312
|
-
congrats: buildCongratsProps(state
|
|
310
|
+
congrats: buildCongratsProps(state),
|
|
313
311
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick) : undefined
|
|
314
312
|
};
|
|
315
313
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.5.6
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"lib",
|
|
31
31
|
"es",
|
|
32
32
|
"src",
|
|
33
|
-
"locales",
|
|
34
33
|
"readme.md"
|
|
35
34
|
],
|
|
36
35
|
"main": "./es/index.js",
|
|
@@ -43,9 +42,8 @@
|
|
|
43
42
|
"./package.json": "./package.json"
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
|
-
"@coorpacademy/components": "10.24.
|
|
45
|
+
"@coorpacademy/components": "10.24.5",
|
|
47
46
|
"@coorpacademy/redux-task": "1.1.6",
|
|
48
|
-
"@coorpacademy/translate": "6.1.5",
|
|
49
47
|
"cross-fetch": "^3.1.5",
|
|
50
48
|
"jwt-decode": "^3.1.2",
|
|
51
49
|
"react-redux": "^7.2.9",
|
|
@@ -79,5 +77,5 @@
|
|
|
79
77
|
"webpack-cli": "^4.10.0",
|
|
80
78
|
"webpack-dev-server": "^4.11.1"
|
|
81
79
|
},
|
|
82
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "56b61ee3e78d9670cb28ab04d0a912779a265a78"
|
|
83
81
|
}
|
package/src/index.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import isEmpty from 'lodash/fp/isEmpty';
|
|
|
8
8
|
import get from 'lodash/fp/get';
|
|
9
9
|
import configureStore from './configure-store';
|
|
10
10
|
|
|
11
|
-
import type {AppOptions
|
|
11
|
+
import type {AppOptions} from './types/common';
|
|
12
12
|
import type {StoreState} from './reducers';
|
|
13
13
|
|
|
14
14
|
import {navigateTo, ViewPath} from './actions/ui/navigation';
|
|
@@ -19,13 +19,14 @@ import {VIEWS} from './common';
|
|
|
19
19
|
import {mapStateToSlidesProps} from './views/slides';
|
|
20
20
|
import {mapStateToSkillsProps} from './views/skills';
|
|
21
21
|
|
|
22
|
-
const ConnectedApp = (
|
|
22
|
+
const ConnectedApp = ({onQuitClick}: {onQuitClick: Function}): JSX.Element => {
|
|
23
23
|
const dispatch = useDispatch();
|
|
24
|
+
|
|
24
25
|
const props = {
|
|
25
26
|
viewName: useSelector(
|
|
26
27
|
(state: StoreState) => state.ui.navigation[state.ui.navigation.length - 1]
|
|
27
28
|
),
|
|
28
|
-
slides: useSelector((state: StoreState) => mapStateToSlidesProps(state, dispatch,
|
|
29
|
+
slides: useSelector((state: StoreState) => mapStateToSlidesProps(state, dispatch, onQuitClick)),
|
|
29
30
|
skills: useSelector((state: StoreState) => mapStateToSkillsProps(state)),
|
|
30
31
|
onboarding: {}
|
|
31
32
|
};
|
|
@@ -36,7 +37,7 @@ const AppReview = ({options}: {options: AppOptions}): JSX.Element | null => {
|
|
|
36
37
|
const [store, setStore] = useState<Store<StoreState, AnyAction> | null>(null);
|
|
37
38
|
const [isProgressionCreated, setIsProgressionCreated] = useState(false);
|
|
38
39
|
|
|
39
|
-
const
|
|
40
|
+
const onQuitClick = options.onQuitClick;
|
|
40
41
|
|
|
41
42
|
useEffect(() => {
|
|
42
43
|
if (store) return;
|
|
@@ -89,7 +90,7 @@ const AppReview = ({options}: {options: AppOptions}): JSX.Element | null => {
|
|
|
89
90
|
|
|
90
91
|
return (
|
|
91
92
|
<Provider store={store}>
|
|
92
|
-
<ConnectedApp onQuitClick={onQuitClick}
|
|
93
|
+
<ConnectedApp onQuitClick={onQuitClick} />
|
|
93
94
|
</Provider>
|
|
94
95
|
);
|
|
95
96
|
};
|
package/src/test/index.test.tsx
CHANGED
|
@@ -463,5 +463,3 @@ export const services: Services = {
|
|
|
463
463
|
fetchRank: () => Promise.resolve(fetchRankResponse),
|
|
464
464
|
fetchSlidesToReviewBySkillRef: () => Promise.resolve(fetchSlidesToReviewBySkillRefResponse)
|
|
465
465
|
};
|
|
466
|
-
|
|
467
|
-
export const translate = (key: string): string => `___${key}`;
|
package/src/types/common.ts
CHANGED
|
@@ -179,15 +179,11 @@ export type Options = {
|
|
|
179
179
|
services: Services;
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
export type
|
|
183
|
-
translate: (key: string, data?: unknown) => string;
|
|
184
|
-
onQuitClick: Function;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export type AppOptions = ConnectedOptions & {
|
|
182
|
+
export type AppOptions = {
|
|
188
183
|
token: string;
|
|
189
184
|
skillRef?: string;
|
|
190
185
|
services: Services;
|
|
186
|
+
onQuitClick: Function;
|
|
191
187
|
url: string;
|
|
192
188
|
};
|
|
193
189
|
|
package/src/types/globals.d.ts
CHANGED