@coorpacademy/app-review 0.5.6-alpha.2 → 0.5.6-alpha.7
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/locales/en/review.json +14 -0
- package/es/sandbox/index.d.ts +9 -0
- package/es/sandbox/index.js +56 -0
- package/es/{index.js → src/index.js} +4 -4
- package/es/{test → src/test}/index.test.js +1 -0
- package/{lib → es/src}/test/util/services.mock.d.ts +1 -0
- package/es/{test → src/test}/util/services.mock.js +1 -0
- package/{lib → es/src}/types/common.d.ts +5 -2
- package/{lib → es/src}/views/slides/index.d.ts +2 -1
- package/es/{views → src/views}/slides/index.js +20 -18
- package/lib/locales/en/review.json +14 -0
- package/lib/sandbox/index.d.ts +9 -0
- package/lib/sandbox/index.js +67 -0
- package/lib/{index.js → src/index.js} +4 -5
- package/lib/{test → src/test}/index.test.js +1 -0
- package/{es → lib/src}/test/util/services.mock.d.ts +1 -0
- package/lib/{test → src/test}/util/services.mock.js +1 -0
- package/{es → lib/src}/types/common.d.ts +5 -2
- package/{es → lib/src}/views/slides/index.d.ts +2 -1
- package/lib/{views → src/views}/slides/index.js +20 -18
- package/package.json +6 -4
- package/src/index.tsx +5 -6
- package/src/test/index.test.tsx +1 -0
- package/src/test/util/services.mock.ts +2 -0
- package/src/types/common.ts +6 -2
- package/src/types/globals.d.ts +1 -0
- package/src/views/slides/index.ts +43 -19
- package/src/views/slides/test/header.on-click.test.ts +10 -3
- package/src/views/slides/test/index.test.ts +58 -55
- package/src/views/slides/test/on-quit-popin.on-click.test.ts +12 -3
- package/src/views/slides/test/slide.free-text.on-change.test.ts +4 -2
- package/src/views/slides/test/slide.next-slide.on-click.test.ts +6 -3
- package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.qcm.on-click.test.ts +3 -2
- package/src/views/slides/test/slide.slider.on-change.test.ts +3 -2
- package/src/views/slides/test/slide.slider.on-slider-change.test.ts +3 -2
- package/src/views/slides/test/slide.template.on-change.test.ts +5 -4
- /package/es/{actions → src/actions}/api/fetch-correction.d.ts +0 -0
- /package/es/{actions → src/actions}/api/fetch-correction.js +0 -0
- /package/es/{actions → src/actions}/api/fetch-rank.d.ts +0 -0
- /package/es/{actions → src/actions}/api/fetch-rank.js +0 -0
- /package/es/{actions → src/actions}/api/fetch-skills.d.ts +0 -0
- /package/es/{actions → src/actions}/api/fetch-skills.js +0 -0
- /package/es/{actions → src/actions}/api/fetch-slide.d.ts +0 -0
- /package/es/{actions → src/actions}/api/fetch-slide.js +0 -0
- /package/es/{actions → src/actions}/api/post-answer.d.ts +0 -0
- /package/es/{actions → src/actions}/api/post-answer.js +0 -0
- /package/es/{actions → src/actions}/api/post-progression.d.ts +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}/index.d.ts +0 -0
- /package/es/{actions → src/actions}/index.js +0 -0
- /package/es/{actions → src/actions}/test/create-test-store.d.ts +0 -0
- /package/es/{actions → src/actions}/test/create-test-store.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/navigation.d.ts +0 -0
- /package/es/{actions → src/actions}/ui/navigation.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/{common → src/common}/index.d.ts +0 -0
- /package/es/{common → src/common}/index.js +0 -0
- /package/es/{configure-store.d.ts → src/configure-store.d.ts} +0 -0
- /package/es/{configure-store.js → src/configure-store.js} +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.d.ts +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.d.ts +0 -0
- /package/es/{reducers → src/reducers}/ui/index.js +0 -0
- /package/es/{reducers → src/reducers}/ui/navigation.d.ts +0 -0
- /package/es/{reducers → src/reducers}/ui/navigation.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/{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}/skills/index.d.ts +0 -0
- /package/es/{views → src/views}/skills/index.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.d.ts +0 -0
- /package/lib/{actions → src/actions}/api/fetch-correction.js +0 -0
- /package/lib/{actions → src/actions}/api/fetch-rank.d.ts +0 -0
- /package/lib/{actions → src/actions}/api/fetch-rank.js +0 -0
- /package/lib/{actions → src/actions}/api/fetch-skills.d.ts +0 -0
- /package/lib/{actions → src/actions}/api/fetch-skills.js +0 -0
- /package/lib/{actions → src/actions}/api/fetch-slide.d.ts +0 -0
- /package/lib/{actions → src/actions}/api/fetch-slide.js +0 -0
- /package/lib/{actions → src/actions}/api/post-answer.d.ts +0 -0
- /package/lib/{actions → src/actions}/api/post-answer.js +0 -0
- /package/lib/{actions → src/actions}/api/post-progression.d.ts +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}/index.d.ts +0 -0
- /package/lib/{actions → src/actions}/index.js +0 -0
- /package/lib/{actions → src/actions}/test/create-test-store.d.ts +0 -0
- /package/lib/{actions → src/actions}/test/create-test-store.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/navigation.d.ts +0 -0
- /package/lib/{actions → src/actions}/ui/navigation.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/{common → src/common}/index.d.ts +0 -0
- /package/lib/{common → src/common}/index.js +0 -0
- /package/lib/{configure-store.d.ts → src/configure-store.d.ts} +0 -0
- /package/lib/{configure-store.js → src/configure-store.js} +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.d.ts +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.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/ui/index.js +0 -0
- /package/lib/{reducers → src/reducers}/ui/navigation.d.ts +0 -0
- /package/lib/{reducers → src/reducers}/ui/navigation.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/{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}/skills/index.d.ts +0 -0
- /package/lib/{views → src/views}/skills/index.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,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Review Title": "Review Mode",
|
|
3
|
+
"Content Parent Title": "From `{{contentTitle}}` `{{contentType}}`",
|
|
4
|
+
"Validate": "Validate",
|
|
5
|
+
"Next Question": "Next Question",
|
|
6
|
+
"KLF": "Key Learning Factor",
|
|
7
|
+
"Correct Answer": "Correct Answer",
|
|
8
|
+
"Wrong Answer": "Wrong Answer",
|
|
9
|
+
"You have won": "You have won",
|
|
10
|
+
"You are now": "You are now",
|
|
11
|
+
"Revise another skill": "Revise another skill",
|
|
12
|
+
"Continue reviewing": "Continue reviewing",
|
|
13
|
+
"Congratulations!": "Congratulations!"
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 createTranslate from '@coorpacademy/translate';
|
|
7
|
+
import { WebContext } from '@coorpacademy/components/es/atom/provider';
|
|
8
|
+
import localesComponents from '@coorpacademy/components/locales/en/global.json';
|
|
9
|
+
import localesAppReview from '../locales/en/review.json';
|
|
10
|
+
import AppReview from '../src';
|
|
11
|
+
import { services } from '../src/test/util/services.mock';
|
|
12
|
+
const translate = (key, data) => {
|
|
13
|
+
try {
|
|
14
|
+
return createTranslate({
|
|
15
|
+
...localesAppReview,
|
|
16
|
+
...localesComponents
|
|
17
|
+
})(key, data);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.error(err);
|
|
22
|
+
return createTranslate({ [key]: key })(key, data);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const isContainerAvailable = (options) => !pipe(get('container'), isNil)(options);
|
|
26
|
+
const createSandbox = (options) => {
|
|
27
|
+
if (!isContainerAvailable(options)) {
|
|
28
|
+
// eslint-disable-next-line no-console
|
|
29
|
+
console.error('[AppReview sandbox] Requires a container.');
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const container = document.getElementById(options.container);
|
|
33
|
+
// mode mobile/web
|
|
34
|
+
const appOptions = {
|
|
35
|
+
token: process.env.API_TEST_TOKEN || '',
|
|
36
|
+
skillRef: '123',
|
|
37
|
+
services,
|
|
38
|
+
translate,
|
|
39
|
+
onQuitClick: () => {
|
|
40
|
+
location.reload();
|
|
41
|
+
},
|
|
42
|
+
url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
|
|
43
|
+
};
|
|
44
|
+
const skin = {
|
|
45
|
+
common: {
|
|
46
|
+
primary: '#248e59'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
render(React.createElement(WebContext, { skin: skin, translate: translate },
|
|
50
|
+
React.createElement(AppReview, { options: appOptions })), container);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
if (window && !window.createSandbox) {
|
|
54
|
+
window.createSandbox = createSandbox;
|
|
55
|
+
}
|
|
56
|
+
createSandbox({ container: 'root' });
|
|
@@ -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 = (options) => {
|
|
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, options)),
|
|
19
19
|
skills: useSelector((state) => mapStateToSkillsProps(state)),
|
|
20
20
|
onboarding: {}
|
|
21
21
|
};
|
|
@@ -24,7 +24,7 @@ const ConnectedApp = ({ onQuitClick }) => {
|
|
|
24
24
|
const AppReview = ({ options }) => {
|
|
25
25
|
const [store, setStore] = useState(null);
|
|
26
26
|
const [isProgressionCreated, setIsProgressionCreated] = useState(false);
|
|
27
|
-
const onQuitClick = options
|
|
27
|
+
const { translate, onQuitClick } = options;
|
|
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, translate: translate })));
|
|
72
72
|
};
|
|
73
73
|
export default AppReview;
|
|
@@ -40,6 +40,7 @@ const appOptions = {
|
|
|
40
40
|
skillRef: 'skill_NJC0jFKoH',
|
|
41
41
|
services,
|
|
42
42
|
onQuitClick: identity,
|
|
43
|
+
translate: key => key,
|
|
43
44
|
url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
|
|
44
45
|
};
|
|
45
46
|
test('should show the loader while the app is fetching the data', async (t) => {
|
|
@@ -5,3 +5,4 @@ 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,11 +139,14 @@ export declare type Services = {
|
|
|
139
139
|
export declare type Options = {
|
|
140
140
|
services: Services;
|
|
141
141
|
};
|
|
142
|
-
export declare type
|
|
142
|
+
export declare type ConnectedOptions = {
|
|
143
|
+
translate: (key: string, data?: unknown) => string;
|
|
144
|
+
onQuitClick: Function;
|
|
145
|
+
};
|
|
146
|
+
export declare type AppOptions = ConnectedOptions & {
|
|
143
147
|
token: string;
|
|
144
148
|
skillRef?: string;
|
|
145
149
|
services: Services;
|
|
146
|
-
onQuitClick: Function;
|
|
147
150
|
url: string;
|
|
148
151
|
};
|
|
149
152
|
export declare type JWT = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
|
+
import type { ConnectedOptions } from '../../types/common';
|
|
2
3
|
import { type SlideIndexes } from '../../common';
|
|
3
4
|
import type { StoreState } from '../../reducers';
|
|
4
5
|
import type { AnswerUI } from '../../types/slides';
|
|
@@ -138,5 +139,5 @@ export declare type CongratsProps = {
|
|
|
138
139
|
};
|
|
139
140
|
export declare const initialState: SlidesStack;
|
|
140
141
|
export declare const buildStepItems: (state: StoreState) => StepItem[];
|
|
141
|
-
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch,
|
|
142
|
+
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch, options: ConnectedOptions) => SlidesViewProps;
|
|
142
143
|
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, translate) => {
|
|
170
170
|
return {
|
|
171
171
|
klf: isCorrect
|
|
172
172
|
? undefined
|
|
173
173
|
: {
|
|
174
|
-
label: '
|
|
174
|
+
label: translate('KLF'),
|
|
175
175
|
tooltip: klf
|
|
176
176
|
},
|
|
177
|
-
resultLabel: isCorrect ? '
|
|
177
|
+
resultLabel: isCorrect ? translate('Correct Answer') : translate('Wrong Answer'),
|
|
178
178
|
information: {
|
|
179
|
-
label: isCorrect ? '
|
|
179
|
+
label: isCorrect ? translate('KLF') : translate('Correct Answer'),
|
|
180
180
|
message: isCorrect ? klf : join(',', correctAnswer)
|
|
181
181
|
},
|
|
182
182
|
next: {
|
|
183
|
-
ariaLabel: '
|
|
184
|
-
label: '
|
|
183
|
+
ariaLabel: translate('Next Question'),
|
|
184
|
+
label: translate('Next Question'),
|
|
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, translate) => {
|
|
218
218
|
return {
|
|
219
219
|
'aria-label': 'Review Card Congrats Container',
|
|
220
220
|
'data-name': 'card-rank',
|
|
@@ -229,13 +229,13 @@ const buildRankCard = (rank) => {
|
|
|
229
229
|
cardType: 'card-rank',
|
|
230
230
|
iconAriaLabel: 'Image without information',
|
|
231
231
|
className: undefined,
|
|
232
|
-
reviewCardTitle: 'You are now',
|
|
232
|
+
reviewCardTitle: translate('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, translate) => {
|
|
239
239
|
if (!state.ui.showCongrats)
|
|
240
240
|
return;
|
|
241
241
|
const progression = state.data.progression;
|
|
@@ -258,18 +258,18 @@ const buildCongratsProps = (state) => {
|
|
|
258
258
|
iconAriaLabel: 'Image without information',
|
|
259
259
|
className: undefined,
|
|
260
260
|
cardType: 'card-star',
|
|
261
|
-
reviewCardTitle: 'You have won',
|
|
261
|
+
reviewCardTitle: translate('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) : undefined;
|
|
267
|
+
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end, translate) : undefined;
|
|
268
268
|
return {
|
|
269
269
|
'aria-label': 'Review Congratulations',
|
|
270
270
|
'data-name': 'review-congrats',
|
|
271
271
|
animationLottie: confettiAnimation,
|
|
272
|
-
title: 'Congratulations!',
|
|
272
|
+
title: translate('Congratulations!'),
|
|
273
273
|
cardCongratsStar,
|
|
274
274
|
cardCongratsRank,
|
|
275
275
|
buttonRevising: undefined,
|
|
@@ -281,7 +281,8 @@ const isEndOfProgression = (progression) => {
|
|
|
281
281
|
return false;
|
|
282
282
|
return progression.state.nextContent.ref === 'successExitNode';
|
|
283
283
|
};
|
|
284
|
-
export const mapStateToSlidesProps = (state, dispatch,
|
|
284
|
+
export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
285
|
+
const { translate, onQuitClick } = options;
|
|
285
286
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
286
287
|
const endReview = isEndOfProgression(state.data.progression);
|
|
287
288
|
const correction = get(['data', 'corrections', currentSlideRef], state);
|
|
@@ -290,8 +291,8 @@ export const mapStateToSlidesProps = (state, dispatch, onQuitClick) => {
|
|
|
290
291
|
const showQuitPopin = get(['ui', 'showQuitPopin'], state);
|
|
291
292
|
return {
|
|
292
293
|
header: {
|
|
293
|
-
mode: '
|
|
294
|
-
skillName: '
|
|
294
|
+
mode: translate('Review Title'),
|
|
295
|
+
skillName: translate('Content Parent Title'),
|
|
295
296
|
onQuitClick: () => dispatch(openQuitPopin),
|
|
296
297
|
'aria-label': 'aria-header-wrapper',
|
|
297
298
|
closeButtonAriaLabel: 'aria-close-button',
|
|
@@ -300,16 +301,17 @@ export const mapStateToSlidesProps = (state, dispatch, onQuitClick) => {
|
|
|
300
301
|
stack: {
|
|
301
302
|
slides: buildStackSlides(state, dispatch),
|
|
302
303
|
validateButton: {
|
|
303
|
-
label: '
|
|
304
|
+
label: translate('Validate'),
|
|
304
305
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
305
306
|
onClick: () => {
|
|
306
307
|
dispatch(postAnswer);
|
|
307
308
|
}
|
|
308
309
|
},
|
|
309
|
-
correctionPopinProps: correction &&
|
|
310
|
+
correctionPopinProps: correction &&
|
|
311
|
+
getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf, options.translate),
|
|
310
312
|
endReview: endReview && state.ui.showCongrats
|
|
311
313
|
},
|
|
312
|
-
congrats: buildCongratsProps(state),
|
|
314
|
+
congrats: buildCongratsProps(state, options.translate),
|
|
313
315
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick) : undefined
|
|
314
316
|
};
|
|
315
317
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Review Title": "Review Mode",
|
|
3
|
+
"Content Parent Title": "From `{{contentTitle}}` `{{contentType}}`",
|
|
4
|
+
"Validate": "Validate",
|
|
5
|
+
"Next Question": "Next Question",
|
|
6
|
+
"KLF": "Key Learning Factor",
|
|
7
|
+
"Correct Answer": "Correct Answer",
|
|
8
|
+
"Wrong Answer": "Wrong Answer",
|
|
9
|
+
"You have won": "You have won",
|
|
10
|
+
"You are now": "You are now",
|
|
11
|
+
"Revise another skill": "Revise another skill",
|
|
12
|
+
"Continue reviewing": "Continue reviewing",
|
|
13
|
+
"Congratulations!": "Congratulations!"
|
|
14
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { render } from 'react-dom';
|
|
14
|
+
import isNil from 'lodash/fp/isNil';
|
|
15
|
+
import get from 'lodash/fp/get';
|
|
16
|
+
import pipe from 'lodash/fp/pipe';
|
|
17
|
+
import createTranslate from '@coorpacademy/translate';
|
|
18
|
+
import { WebContext } from '@coorpacademy/components/es/atom/provider';
|
|
19
|
+
import localesComponents from '@coorpacademy/components/locales/en/global.json';
|
|
20
|
+
import localesAppReview from '../locales/en/review.json';
|
|
21
|
+
import AppReview from '../src';
|
|
22
|
+
import { services } from '../src/test/util/services.mock';
|
|
23
|
+
var translate = function (key, data) {
|
|
24
|
+
var _a;
|
|
25
|
+
try {
|
|
26
|
+
return createTranslate(__assign(__assign({}, localesAppReview), localesComponents))(key, data);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
// eslint-disable-next-line no-console
|
|
30
|
+
console.error(err);
|
|
31
|
+
return createTranslate((_a = {}, _a[key] = key, _a))(key, data);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var isContainerAvailable = function (options) {
|
|
35
|
+
return !pipe(get('container'), isNil)(options);
|
|
36
|
+
};
|
|
37
|
+
var createSandbox = function (options) {
|
|
38
|
+
if (!isContainerAvailable(options)) {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.error('[AppReview sandbox] Requires a container.');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
var container = document.getElementById(options.container);
|
|
44
|
+
// mode mobile/web
|
|
45
|
+
var appOptions = {
|
|
46
|
+
token: process.env.API_TEST_TOKEN || '',
|
|
47
|
+
skillRef: '123',
|
|
48
|
+
services: services,
|
|
49
|
+
translate: translate,
|
|
50
|
+
onQuitClick: function () {
|
|
51
|
+
location.reload();
|
|
52
|
+
},
|
|
53
|
+
url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
|
|
54
|
+
};
|
|
55
|
+
var skin = {
|
|
56
|
+
common: {
|
|
57
|
+
primary: '#248e59'
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
render(React.createElement(WebContext, { skin: skin, translate: translate },
|
|
61
|
+
React.createElement(AppReview, { options: appOptions })), container);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
if (window && !window.createSandbox) {
|
|
65
|
+
window.createSandbox = createSandbox;
|
|
66
|
+
}
|
|
67
|
+
createSandbox({ container: 'root' });
|
|
@@ -22,12 +22,11 @@ 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 (
|
|
26
|
-
var onQuitClick = _a.onQuitClick;
|
|
25
|
+
var ConnectedApp = function (options) {
|
|
27
26
|
var dispatch = useDispatch();
|
|
28
27
|
var props = {
|
|
29
28
|
viewName: useSelector(function (state) { return state.ui.navigation[state.ui.navigation.length - 1]; }),
|
|
30
|
-
slides: useSelector(function (state) { return mapStateToSlidesProps(state, dispatch,
|
|
29
|
+
slides: useSelector(function (state) { return mapStateToSlidesProps(state, dispatch, options); }),
|
|
31
30
|
skills: useSelector(function (state) { return mapStateToSkillsProps(state); }),
|
|
32
31
|
onboarding: {}
|
|
33
32
|
};
|
|
@@ -37,7 +36,7 @@ var AppReview = function (_a) {
|
|
|
37
36
|
var options = _a.options;
|
|
38
37
|
var _b = useState(null), store = _b[0], setStore = _b[1];
|
|
39
38
|
var _c = useState(false), isProgressionCreated = _c[0], setIsProgressionCreated = _c[1];
|
|
40
|
-
var onQuitClick = options.onQuitClick;
|
|
39
|
+
var translate = options.translate, onQuitClick = options.onQuitClick;
|
|
41
40
|
useEffect(function () {
|
|
42
41
|
if (store)
|
|
43
42
|
return;
|
|
@@ -81,6 +80,6 @@ var AppReview = function (_a) {
|
|
|
81
80
|
if (!store)
|
|
82
81
|
return null;
|
|
83
82
|
return (React.createElement(Provider, { store: store },
|
|
84
|
-
React.createElement(ConnectedApp, { onQuitClick: onQuitClick })));
|
|
83
|
+
React.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate })));
|
|
85
84
|
};
|
|
86
85
|
export default AppReview;
|
|
@@ -135,6 +135,7 @@ var appOptions = {
|
|
|
135
135
|
skillRef: 'skill_NJC0jFKoH',
|
|
136
136
|
services: services,
|
|
137
137
|
onQuitClick: identity,
|
|
138
|
+
translate: function (key) { return key; },
|
|
138
139
|
url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
|
|
139
140
|
};
|
|
140
141
|
test('should show the loader while the app is fetching the data', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -5,3 +5,4 @@ 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,3 +446,4 @@ 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,11 +139,14 @@ export declare type Services = {
|
|
|
139
139
|
export declare type Options = {
|
|
140
140
|
services: Services;
|
|
141
141
|
};
|
|
142
|
-
export declare type
|
|
142
|
+
export declare type ConnectedOptions = {
|
|
143
|
+
translate: (key: string, data?: unknown) => string;
|
|
144
|
+
onQuitClick: Function;
|
|
145
|
+
};
|
|
146
|
+
export declare type AppOptions = ConnectedOptions & {
|
|
143
147
|
token: string;
|
|
144
148
|
skillRef?: string;
|
|
145
149
|
services: Services;
|
|
146
|
-
onQuitClick: Function;
|
|
147
150
|
url: string;
|
|
148
151
|
};
|
|
149
152
|
export declare type JWT = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Dispatch } from 'redux';
|
|
2
|
+
import type { ConnectedOptions } from '../../types/common';
|
|
2
3
|
import { type SlideIndexes } from '../../common';
|
|
3
4
|
import type { StoreState } from '../../reducers';
|
|
4
5
|
import type { AnswerUI } from '../../types/slides';
|
|
@@ -138,5 +139,5 @@ export declare type CongratsProps = {
|
|
|
138
139
|
};
|
|
139
140
|
export declare const initialState: SlidesStack;
|
|
140
141
|
export declare const buildStepItems: (state: StoreState) => StepItem[];
|
|
141
|
-
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch,
|
|
142
|
+
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch, options: ConnectedOptions) => SlidesViewProps;
|
|
142
143
|
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, translate) {
|
|
165
165
|
return {
|
|
166
166
|
klf: isCorrect
|
|
167
167
|
? undefined
|
|
168
168
|
: {
|
|
169
|
-
label: '
|
|
169
|
+
label: translate('KLF'),
|
|
170
170
|
tooltip: klf
|
|
171
171
|
},
|
|
172
|
-
resultLabel: isCorrect ? '
|
|
172
|
+
resultLabel: isCorrect ? translate('Correct Answer') : translate('Wrong Answer'),
|
|
173
173
|
information: {
|
|
174
|
-
label: isCorrect ? '
|
|
174
|
+
label: isCorrect ? translate('KLF') : translate('Correct Answer'),
|
|
175
175
|
message: isCorrect ? klf : join(',', correctAnswer)
|
|
176
176
|
},
|
|
177
177
|
next: {
|
|
178
|
-
ariaLabel: '
|
|
179
|
-
label: '
|
|
178
|
+
ariaLabel: translate('Next Question'),
|
|
179
|
+
label: translate('Next Question'),
|
|
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, translate) {
|
|
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) {
|
|
|
227
227
|
cardType: 'card-rank',
|
|
228
228
|
iconAriaLabel: 'Image without information',
|
|
229
229
|
className: undefined,
|
|
230
|
-
reviewCardTitle: 'You are now',
|
|
230
|
+
reviewCardTitle: translate('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, translate) {
|
|
237
237
|
if (!state.ui.showCongrats)
|
|
238
238
|
return;
|
|
239
239
|
var progression = state.data.progression;
|
|
@@ -256,18 +256,18 @@ var buildCongratsProps = function (state) {
|
|
|
256
256
|
iconAriaLabel: 'Image without information',
|
|
257
257
|
className: undefined,
|
|
258
258
|
cardType: 'card-star',
|
|
259
|
-
reviewCardTitle: 'You have won',
|
|
259
|
+
reviewCardTitle: translate('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) : undefined;
|
|
265
|
+
var cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end, translate) : undefined;
|
|
266
266
|
return {
|
|
267
267
|
'aria-label': 'Review Congratulations',
|
|
268
268
|
'data-name': 'review-congrats',
|
|
269
269
|
animationLottie: confettiAnimation,
|
|
270
|
-
title: 'Congratulations!',
|
|
270
|
+
title: translate('Congratulations!'),
|
|
271
271
|
cardCongratsStar: cardCongratsStar,
|
|
272
272
|
cardCongratsRank: cardCongratsRank,
|
|
273
273
|
buttonRevising: undefined,
|
|
@@ -279,7 +279,8 @@ 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,
|
|
282
|
+
export var mapStateToSlidesProps = function (state, dispatch, options) {
|
|
283
|
+
var translate = options.translate, onQuitClick = options.onQuitClick;
|
|
283
284
|
var currentSlideRef = getCurrentSlideRef(state);
|
|
284
285
|
var endReview = isEndOfProgression(state.data.progression);
|
|
285
286
|
var correction = get(['data', 'corrections', currentSlideRef], state);
|
|
@@ -288,8 +289,8 @@ export var mapStateToSlidesProps = function (state, dispatch, onQuitClick) {
|
|
|
288
289
|
var showQuitPopin = get(['ui', 'showQuitPopin'], state);
|
|
289
290
|
return {
|
|
290
291
|
header: {
|
|
291
|
-
mode: '
|
|
292
|
-
skillName: '
|
|
292
|
+
mode: translate('Review Title'),
|
|
293
|
+
skillName: translate('Content Parent Title'),
|
|
293
294
|
onQuitClick: function () { return dispatch(openQuitPopin); },
|
|
294
295
|
'aria-label': 'aria-header-wrapper',
|
|
295
296
|
closeButtonAriaLabel: 'aria-close-button',
|
|
@@ -298,16 +299,17 @@ export var mapStateToSlidesProps = function (state, dispatch, onQuitClick) {
|
|
|
298
299
|
stack: {
|
|
299
300
|
slides: buildStackSlides(state, dispatch),
|
|
300
301
|
validateButton: {
|
|
301
|
-
label: '
|
|
302
|
+
label: translate('Validate'),
|
|
302
303
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
303
304
|
onClick: function () {
|
|
304
305
|
dispatch(postAnswer);
|
|
305
306
|
}
|
|
306
307
|
},
|
|
307
|
-
correctionPopinProps: correction &&
|
|
308
|
+
correctionPopinProps: correction &&
|
|
309
|
+
getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf, options.translate),
|
|
308
310
|
endReview: endReview && state.ui.showCongrats
|
|
309
311
|
},
|
|
310
|
-
congrats: buildCongratsProps(state),
|
|
312
|
+
congrats: buildCongratsProps(state, options.translate),
|
|
311
313
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick) : undefined
|
|
312
314
|
};
|
|
313
315
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.5.6-alpha.
|
|
3
|
+
"version": "0.5.6-alpha.7+49d2be10a",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -39,11 +39,13 @@
|
|
|
39
39
|
"commonjs": "./lib/index.js",
|
|
40
40
|
"types": "./es/index.d.ts"
|
|
41
41
|
},
|
|
42
|
-
"./package.json": "./package.json"
|
|
42
|
+
"./package.json": "./package.json",
|
|
43
|
+
"./locales/en/review": "./locales/en/review"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@coorpacademy/components": "10.24.
|
|
46
|
+
"@coorpacademy/components": "10.24.4",
|
|
46
47
|
"@coorpacademy/redux-task": "1.1.6",
|
|
48
|
+
"@coorpacademy/translate": "6.1.5",
|
|
47
49
|
"cross-fetch": "^3.1.5",
|
|
48
50
|
"jwt-decode": "^3.1.2",
|
|
49
51
|
"react-redux": "^7.2.9",
|
|
@@ -77,5 +79,5 @@
|
|
|
77
79
|
"webpack-cli": "^4.10.0",
|
|
78
80
|
"webpack-dev-server": "^4.11.1"
|
|
79
81
|
},
|
|
80
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "49d2be10ad80f85c2e67cb259cd9be0ff8f7f7b0"
|
|
81
83
|
}
|
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} from './types/common';
|
|
11
|
+
import type {AppOptions, ConnectedOptions} from './types/common';
|
|
12
12
|
import type {StoreState} from './reducers';
|
|
13
13
|
|
|
14
14
|
import {navigateTo, ViewPath} from './actions/ui/navigation';
|
|
@@ -19,14 +19,13 @@ 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 = (options: ConnectedOptions): JSX.Element => {
|
|
23
23
|
const dispatch = useDispatch();
|
|
24
|
-
|
|
25
24
|
const props = {
|
|
26
25
|
viewName: useSelector(
|
|
27
26
|
(state: StoreState) => state.ui.navigation[state.ui.navigation.length - 1]
|
|
28
27
|
),
|
|
29
|
-
slides: useSelector((state: StoreState) => mapStateToSlidesProps(state, dispatch,
|
|
28
|
+
slides: useSelector((state: StoreState) => mapStateToSlidesProps(state, dispatch, options)),
|
|
30
29
|
skills: useSelector((state: StoreState) => mapStateToSkillsProps(state)),
|
|
31
30
|
onboarding: {}
|
|
32
31
|
};
|
|
@@ -37,7 +36,7 @@ const AppReview = ({options}: {options: AppOptions}): JSX.Element | null => {
|
|
|
37
36
|
const [store, setStore] = useState<Store<StoreState, AnyAction> | null>(null);
|
|
38
37
|
const [isProgressionCreated, setIsProgressionCreated] = useState(false);
|
|
39
38
|
|
|
40
|
-
const onQuitClick = options
|
|
39
|
+
const {translate, onQuitClick} = options;
|
|
41
40
|
|
|
42
41
|
useEffect(() => {
|
|
43
42
|
if (store) return;
|
|
@@ -90,7 +89,7 @@ const AppReview = ({options}: {options: AppOptions}): JSX.Element | null => {
|
|
|
90
89
|
|
|
91
90
|
return (
|
|
92
91
|
<Provider store={store}>
|
|
93
|
-
<ConnectedApp onQuitClick={onQuitClick} />
|
|
92
|
+
<ConnectedApp onQuitClick={onQuitClick} translate={translate} />
|
|
94
93
|
</Provider>
|
|
95
94
|
);
|
|
96
95
|
};
|