@coorpacademy/app-review 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/actions/api/fetch-skills.d.ts +5 -7
- package/es/actions/api/fetch-skills.js +12 -4
- package/es/actions/api/fetch-slide.d.ts +14 -7
- package/es/actions/api/fetch-slide.js +23 -18
- package/es/actions/api/post-answer.d.ts +10 -0
- package/es/actions/api/post-answer.js +25 -0
- package/es/actions/api/post-progression.d.ts +5 -7
- package/es/actions/api/post-progression.js +16 -8
- package/es/actions/api/test/fetch-skills.test.js +57 -0
- package/es/actions/api/test/fetch-slide.test.js +64 -0
- package/es/actions/api/test/post-answer.test.d.ts +1 -0
- package/es/actions/api/test/post-answer.test.js +82 -0
- package/es/actions/api/test/post-progression.test.d.ts +1 -0
- package/es/actions/api/test/post-progression.test.js +105 -0
- package/es/actions/data/test/token.test.d.ts +1 -0
- package/es/actions/data/test/token.test.js +25 -0
- package/es/actions/index.d.ts +1 -8
- package/es/actions/test/create-test-store.d.ts +5 -0
- package/es/actions/test/create-test-store.js +16 -0
- package/es/actions/ui/answers.d.ts +21 -0
- package/es/actions/ui/answers.js +43 -0
- package/es/actions/ui/slides.d.ts +0 -5
- package/es/actions/ui/slides.js +0 -4
- package/es/actions/ui/test/answers.test.d.ts +1 -0
- package/es/actions/ui/test/answers.test.js +90 -0
- package/es/actions/ui/test/slides.test.d.ts +1 -0
- package/es/actions/ui/test/slides.test.js +26 -0
- package/es/common/index.d.ts +0 -3
- package/es/common/index.js +0 -4
- package/es/index.js +11 -19
- package/es/reducers/data/index.d.ts +2 -2
- package/es/reducers/data/progression.d.ts +2 -3
- package/es/reducers/data/progression.js +0 -5
- package/es/reducers/data/slides.d.ts +3 -4
- package/es/reducers/data/slides.js +5 -1
- package/es/reducers/data/test/progression.test.d.ts +1 -0
- package/es/reducers/data/test/progression.test.js +38 -0
- package/es/reducers/data/test/skills.test.d.ts +1 -0
- package/es/reducers/data/test/skills.test.js +12 -0
- package/es/reducers/data/test/slides.test.d.ts +1 -0
- package/es/reducers/data/test/slides.test.js +20 -0
- package/es/reducers/data/test/token.test.d.ts +1 -0
- package/es/reducers/data/test/token.test.js +11 -0
- package/es/reducers/index.d.ts +3 -2
- package/es/reducers/ui/answers.d.ts +4 -0
- package/es/reducers/ui/answers.js +9 -0
- package/es/reducers/ui/index.d.ts +7 -4
- package/es/reducers/ui/index.js +4 -2
- package/es/reducers/ui/slide.d.ts +8 -0
- package/es/reducers/ui/slide.js +26 -0
- package/es/reducers/ui/test/answers.test.d.ts +1 -0
- package/es/reducers/ui/test/answers.test.js +27 -0
- package/es/reducers/ui/test/current-slide-ref.test.d.ts +1 -0
- package/es/reducers/ui/test/current-slide-ref.test.js +12 -0
- package/es/reducers/ui/test/navigation.test.d.ts +1 -0
- package/es/reducers/ui/test/navigation.test.js +15 -0
- package/es/reducers/ui/test/slide.test.d.ts +1 -0
- package/es/reducers/ui/test/slide.test.js +12 -0
- package/es/services/fetch-slide.js +1 -1
- package/es/services/index.js +3 -1
- package/es/services/post-answer.d.ts +2 -0
- package/es/services/post-answer.js +18 -0
- package/es/services/test/fetch-slide.test.d.ts +1 -0
- package/es/services/test/fetch-slide.test.js +22 -0
- package/es/services/test/post-answer.test.d.ts +1 -0
- package/es/services/test/post-answer.test.js +57 -0
- package/es/services/test/post-progression.test.js +9 -1
- package/es/test/util/services.mock.d.ts +2 -1
- package/es/test/util/services.mock.js +88 -44
- package/es/types/common.d.ts +22 -33
- package/es/views/skills/index.d.ts +1 -1
- package/es/views/skills/index.js +0 -3
- package/es/views/skills/test/skills.test.d.ts +1 -0
- package/es/views/skills/test/skills.test.js +94 -0
- package/es/views/slides/index.d.ts +89 -2
- package/es/views/slides/index.js +80 -10
- package/es/views/slides/map-api-slide-to-ui.d.ts +8 -0
- package/es/views/slides/map-api-slide-to-ui.js +165 -0
- package/es/{helpers → views/slides}/test/fixtures/free-text.d.ts +2 -1
- package/es/views/slides/test/fixtures/free-text.js +38 -0
- package/es/{helpers → views/slides}/test/fixtures/qcm-drag.d.ts +2 -1
- package/es/views/slides/test/fixtures/qcm-drag.js +108 -0
- package/es/{helpers → views/slides}/test/fixtures/qcm-graphic.d.ts +2 -1
- package/es/views/slides/test/fixtures/qcm-graphic.js +88 -0
- package/es/{helpers → views/slides}/test/fixtures/qcm.d.ts +2 -1
- package/es/{helpers → views/slides}/test/fixtures/qcm.js +5 -1
- package/es/{helpers → views/slides}/test/fixtures/select-template.d.ts +2 -1
- package/es/views/slides/test/fixtures/select-template.js +92 -0
- package/es/{helpers → views/slides}/test/fixtures/slider.d.ts +2 -1
- package/es/views/slides/test/fixtures/slider.js +36 -0
- package/es/{helpers → views/slides}/test/fixtures/text-template.d.ts +2 -1
- package/es/{helpers → views/slides}/test/fixtures/text-template.js +5 -1
- package/es/views/slides/test/index.test.d.ts +1 -0
- package/es/views/slides/test/index.test.js +234 -0
- package/es/views/slides/test/map-api-slide-to-ui.test.d.ts +1 -0
- package/es/{helpers → views/slides}/test/map-api-slide-to-ui.test.js +19 -9
- package/lib/actions/api/fetch-skills.d.ts +5 -7
- package/lib/actions/api/fetch-skills.js +58 -7
- package/lib/actions/api/fetch-slide.d.ts +14 -7
- package/lib/actions/api/fetch-slide.js +72 -20
- package/lib/actions/api/post-answer.d.ts +10 -0
- package/lib/actions/api/post-answer.js +75 -0
- package/lib/actions/api/post-progression.d.ts +5 -7
- package/lib/actions/api/post-progression.js +67 -10
- package/lib/actions/api/test/fetch-skills.test.d.ts +1 -0
- package/lib/actions/api/test/fetch-skills.test.js +116 -0
- package/lib/actions/api/test/fetch-slide.test.d.ts +1 -0
- package/lib/actions/api/test/fetch-slide.test.js +123 -0
- package/lib/actions/api/test/post-answer.test.d.ts +1 -0
- package/lib/actions/api/test/post-answer.test.js +145 -0
- package/lib/actions/api/test/post-progression.test.d.ts +1 -0
- package/lib/actions/api/test/post-progression.test.js +163 -0
- package/lib/actions/data/test/token.test.d.ts +1 -0
- package/lib/actions/data/test/token.test.js +70 -0
- package/lib/actions/index.d.ts +1 -8
- package/lib/actions/test/create-test-store.d.ts +5 -0
- package/lib/actions/test/create-test-store.js +18 -0
- package/lib/actions/ui/answers.d.ts +21 -0
- package/lib/actions/ui/answers.js +54 -0
- package/lib/actions/ui/slides.d.ts +0 -5
- package/lib/actions/ui/slides.js +0 -4
- package/lib/actions/ui/test/answers.test.d.ts +1 -0
- package/lib/actions/ui/test/answers.test.js +171 -0
- package/lib/actions/ui/test/slides.test.d.ts +1 -0
- package/lib/actions/ui/test/slides.test.js +71 -0
- package/lib/common/index.d.ts +0 -3
- package/lib/common/index.js +0 -4
- package/lib/index.js +22 -21
- package/lib/reducers/data/index.d.ts +2 -2
- package/lib/reducers/data/progression.d.ts +2 -3
- package/lib/reducers/data/progression.js +0 -5
- package/lib/reducers/data/slides.d.ts +3 -4
- package/lib/reducers/data/slides.js +5 -1
- package/lib/reducers/data/test/progression.test.d.ts +1 -0
- package/lib/reducers/data/test/progression.test.js +38 -0
- package/lib/reducers/data/test/skills.test.d.ts +1 -0
- package/lib/reducers/data/test/skills.test.js +12 -0
- package/lib/reducers/data/test/slides.test.d.ts +1 -0
- package/lib/reducers/data/test/slides.test.js +20 -0
- package/lib/reducers/data/test/token.test.d.ts +1 -0
- package/lib/reducers/data/test/token.test.js +11 -0
- package/lib/reducers/index.d.ts +3 -2
- package/lib/reducers/ui/answers.d.ts +4 -0
- package/lib/reducers/ui/answers.js +10 -0
- package/lib/reducers/ui/index.d.ts +7 -4
- package/lib/reducers/ui/index.js +4 -2
- package/lib/reducers/ui/slide.d.ts +8 -0
- package/lib/reducers/ui/slide.js +27 -0
- package/lib/reducers/ui/test/answers.test.d.ts +1 -0
- package/lib/reducers/ui/test/answers.test.js +27 -0
- package/lib/reducers/ui/test/current-slide-ref.test.d.ts +1 -0
- package/lib/reducers/ui/test/current-slide-ref.test.js +12 -0
- package/lib/reducers/ui/test/navigation.test.d.ts +1 -0
- package/lib/reducers/ui/test/navigation.test.js +15 -0
- package/lib/reducers/ui/test/slide.test.d.ts +1 -0
- package/lib/reducers/ui/test/slide.test.js +12 -0
- package/lib/services/fetch-slide.js +1 -1
- package/lib/services/index.js +3 -1
- package/lib/services/post-answer.d.ts +2 -0
- package/lib/services/post-answer.js +62 -0
- package/lib/services/test/fetch-slide.test.d.ts +1 -0
- package/lib/services/test/fetch-slide.test.js +76 -0
- package/lib/services/test/post-answer.test.d.ts +1 -0
- package/lib/services/test/post-answer.test.js +111 -0
- package/lib/services/test/post-progression.test.js +9 -1
- package/lib/test/util/services.mock.d.ts +2 -1
- package/lib/test/util/services.mock.js +88 -44
- package/lib/types/common.d.ts +22 -33
- package/lib/views/skills/index.d.ts +1 -1
- package/lib/views/skills/index.js +0 -3
- package/lib/views/skills/test/skills.test.d.ts +1 -0
- package/lib/views/skills/test/skills.test.js +94 -0
- package/lib/views/slides/index.d.ts +89 -2
- package/lib/views/slides/index.js +80 -10
- package/lib/views/slides/map-api-slide-to-ui.d.ts +8 -0
- package/lib/views/slides/map-api-slide-to-ui.js +179 -0
- package/lib/{helpers → views/slides}/test/fixtures/free-text.d.ts +2 -1
- package/lib/views/slides/test/fixtures/free-text.js +38 -0
- package/lib/{helpers → views/slides}/test/fixtures/qcm-drag.d.ts +2 -1
- package/lib/views/slides/test/fixtures/qcm-drag.js +108 -0
- package/lib/{helpers → views/slides}/test/fixtures/qcm-graphic.d.ts +2 -1
- package/lib/views/slides/test/fixtures/qcm-graphic.js +88 -0
- package/lib/{helpers → views/slides}/test/fixtures/qcm.d.ts +2 -1
- package/lib/{helpers → views/slides}/test/fixtures/qcm.js +5 -1
- package/lib/{helpers → views/slides}/test/fixtures/select-template.d.ts +2 -1
- package/lib/views/slides/test/fixtures/select-template.js +92 -0
- package/lib/{helpers → views/slides}/test/fixtures/slider.d.ts +2 -1
- package/lib/views/slides/test/fixtures/slider.js +36 -0
- package/lib/{helpers → views/slides}/test/fixtures/text-template.d.ts +2 -1
- package/lib/{helpers → views/slides}/test/fixtures/text-template.js +5 -1
- package/lib/views/slides/test/index.test.d.ts +1 -0
- package/lib/views/slides/test/index.test.js +234 -0
- package/lib/views/slides/test/map-api-slide-to-ui.test.d.ts +1 -0
- package/lib/{helpers → views/slides}/test/map-api-slide-to-ui.test.js +19 -9
- package/package.json +6 -5
- package/src/actions/api/fetch-skills.ts +19 -12
- package/src/actions/api/fetch-slide.ts +35 -29
- package/src/actions/api/post-answer.ts +39 -0
- package/src/actions/api/post-progression.ts +22 -22
- package/src/actions/api/test/fetch-skills.test.ts +73 -0
- package/src/actions/api/test/fetch-slide.test.ts +80 -0
- package/src/actions/api/test/post-answer.test.ts +101 -0
- package/src/actions/api/test/post-progression.test.ts +122 -0
- package/src/actions/data/test/token.test.ts +29 -0
- package/src/actions/index.ts +1 -17
- package/src/actions/test/create-test-store.ts +25 -0
- package/src/actions/ui/answers.ts +63 -0
- package/src/actions/ui/slides.ts +1 -8
- package/src/actions/ui/test/answers.test.ts +103 -0
- package/src/actions/ui/test/slides.test.ts +30 -0
- package/src/common/index.ts +0 -7
- package/src/index.tsx +15 -32
- package/src/reducers/data/index.ts +1 -1
- package/src/reducers/data/progression.ts +2 -7
- package/src/reducers/data/slides.ts +12 -4
- package/src/reducers/data/test/progression.test.ts +42 -0
- package/src/reducers/data/test/skills.test.ts +14 -0
- package/src/reducers/data/test/slides.test.ts +26 -0
- package/src/reducers/data/test/token.test.ts +13 -0
- package/src/reducers/ui/answers.ts +15 -0
- package/src/reducers/ui/index.ts +6 -3
- package/src/reducers/ui/slide.ts +43 -0
- package/src/reducers/ui/test/answers.test.ts +33 -0
- package/src/reducers/ui/test/current-slide-ref.test.ts +14 -0
- package/src/reducers/ui/test/navigation.test.ts +19 -0
- package/src/reducers/ui/test/slide.test.ts +15 -0
- package/src/services/fetch-slide.ts +1 -1
- package/src/services/index.ts +3 -1
- package/src/services/post-answer.ts +27 -0
- package/src/services/test/fetch-slide.test.ts +30 -0
- package/src/services/test/post-answer.test.ts +68 -0
- package/src/services/test/post-progression.test.ts +9 -1
- package/src/test/util/services.mock.ts +93 -45
- package/src/types/common.ts +34 -44
- package/src/views/skills/index.ts +1 -5
- package/src/views/skills/test/skills.test.ts +101 -0
- package/src/views/slides/index.ts +186 -12
- package/src/views/slides/map-api-slide-to-ui.ts +251 -0
- package/src/views/slides/test/fixtures/free-text.ts +44 -0
- package/src/views/slides/test/fixtures/qcm-drag.ts +112 -0
- package/src/views/slides/test/fixtures/qcm-graphic.ts +95 -0
- package/src/{helpers → views/slides}/test/fixtures/qcm.ts +7 -2
- package/src/views/slides/test/fixtures/select-template.ts +99 -0
- package/src/views/slides/test/fixtures/slider.ts +42 -0
- package/src/{helpers → views/slides}/test/fixtures/text-template.ts +7 -2
- package/src/views/slides/test/index.test.ts +240 -0
- package/src/{helpers → views/slides}/test/map-api-slide-to-ui.test.ts +22 -10
- package/es/fixtures/qcm-slide.d.ts +0 -2
- package/es/fixtures/qcm-slide.js +0 -33
- package/es/fixtures/temp-fixture.d.ts +0 -3
- package/es/fixtures/temp-fixture.js +0 -84
- package/es/helpers/map-api-slide-to-ui.d.ts +0 -11
- package/es/helpers/map-api-slide-to-ui.js +0 -193
- package/es/helpers/test/fixtures/free-text.js +0 -30
- package/es/helpers/test/fixtures/qcm-drag.js +0 -112
- package/es/helpers/test/fixtures/qcm-graphic.js +0 -76
- package/es/helpers/test/fixtures/select-template.js +0 -94
- package/es/helpers/test/fixtures/slider.js +0 -33
- package/es/reducers/ui/slides.d.ts +0 -9
- package/es/reducers/ui/slides.js +0 -42
- package/es/types/views/slides.d.ts +0 -74
- package/es/types/views/slides.js +0 -6
- package/lib/fixtures/qcm-slide.d.ts +0 -2
- package/lib/fixtures/qcm-slide.js +0 -33
- package/lib/fixtures/temp-fixture.d.ts +0 -3
- package/lib/fixtures/temp-fixture.js +0 -84
- package/lib/helpers/map-api-slide-to-ui.d.ts +0 -11
- package/lib/helpers/map-api-slide-to-ui.js +0 -201
- package/lib/helpers/test/fixtures/free-text.js +0 -30
- package/lib/helpers/test/fixtures/qcm-drag.js +0 -112
- package/lib/helpers/test/fixtures/qcm-graphic.js +0 -76
- package/lib/helpers/test/fixtures/select-template.js +0 -94
- package/lib/helpers/test/fixtures/slider.js +0 -33
- package/lib/reducers/ui/slides.d.ts +0 -9
- package/lib/reducers/ui/slides.js +0 -43
- package/lib/types/views/slides.d.ts +0 -74
- package/lib/types/views/slides.js +0 -6
- package/src/fixtures/qcm-slide.ts +0 -35
- package/src/fixtures/temp-fixture.ts +0 -94
- package/src/helpers/map-api-slide-to-ui.ts +0 -279
- package/src/helpers/test/fixtures/free-text.ts +0 -33
- package/src/helpers/test/fixtures/qcm-drag.ts +0 -115
- package/src/helpers/test/fixtures/qcm-graphic.ts +0 -79
- package/src/helpers/test/fixtures/select-template.ts +0 -97
- package/src/helpers/test/fixtures/slider.ts +0 -36
- package/src/reducers/ui/slides.ts +0 -58
- package/src/types/views/slides.ts +0 -90
- /package/es/{helpers/test/map-api-slide-to-ui.test.d.ts → actions/api/test/fetch-skills.test.d.ts} +0 -0
- /package/{lib/helpers/test/map-api-slide-to-ui.test.d.ts → es/actions/api/test/fetch-slide.test.d.ts} +0 -0
|
@@ -9,53 +9,97 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { qcmSlide } from '../../
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
12
|
+
import { qcmSlide } from '../../views/slides/test/fixtures/qcm';
|
|
13
|
+
import { qcmGraphicSlide } from '../../views/slides/test/fixtures/qcm-graphic';
|
|
14
|
+
import { freeTextSlide } from '../../views/slides/test/fixtures/free-text';
|
|
15
|
+
import { sliderSlide } from '../../views/slides/test/fixtures/slider';
|
|
16
|
+
var getSlideFixture = function (ref) {
|
|
17
|
+
switch (ref) {
|
|
18
|
+
case qcmSlide.universalRef:
|
|
19
|
+
return qcmSlide;
|
|
20
|
+
case qcmGraphicSlide.universalRef:
|
|
21
|
+
return qcmGraphicSlide;
|
|
22
|
+
case freeTextSlide.universalRef:
|
|
23
|
+
return freeTextSlide;
|
|
24
|
+
default:
|
|
25
|
+
return sliderSlide;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var fetchSkillsResponse = [
|
|
29
|
+
{
|
|
30
|
+
skillRef: '_skill-ref',
|
|
31
|
+
slidesToReview: 2,
|
|
32
|
+
name: 'skill-test',
|
|
33
|
+
custom: false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
skillRef: '_skill-ref-2',
|
|
37
|
+
slidesToReview: 2,
|
|
38
|
+
name: 'skill-test-2',
|
|
39
|
+
custom: true
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
var postProgressionResponse = {
|
|
43
|
+
_id: '62b1d1087aa12f00253f40ee',
|
|
44
|
+
content: {
|
|
45
|
+
ref: '_skill-ref',
|
|
46
|
+
type: 'skill'
|
|
32
47
|
},
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
engine: {
|
|
49
|
+
ref: 'review'
|
|
35
50
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
state: {
|
|
52
|
+
allAnswers: [],
|
|
53
|
+
isCorrect: true,
|
|
54
|
+
nextContent: {
|
|
55
|
+
ref: 'sli_VJYjJnJhg',
|
|
56
|
+
type: 'slide'
|
|
57
|
+
},
|
|
58
|
+
pendingSlides: [],
|
|
59
|
+
slides: [],
|
|
60
|
+
step: {
|
|
61
|
+
current: 1
|
|
62
|
+
},
|
|
63
|
+
stars: 0
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export var postAnswerResponse = {
|
|
67
|
+
_id: '62b1d1087aa12f00253f40ee',
|
|
68
|
+
content: {
|
|
69
|
+
ref: '_skill-ref',
|
|
70
|
+
type: 'skill'
|
|
71
|
+
},
|
|
72
|
+
engine: {
|
|
73
|
+
ref: 'review'
|
|
74
|
+
},
|
|
75
|
+
state: {
|
|
76
|
+
allAnswers: [
|
|
77
|
+
{
|
|
78
|
+
slideRef: 'sli_VJYjJnJhg',
|
|
48
79
|
isCorrect: true,
|
|
49
|
-
|
|
50
|
-
ref: 'sli_N1XACJobn',
|
|
51
|
-
type: 'slide'
|
|
52
|
-
},
|
|
53
|
-
pendingSlides: [],
|
|
54
|
-
slides: [],
|
|
55
|
-
step: {
|
|
56
|
-
current: 1
|
|
57
|
-
}
|
|
80
|
+
answer: ['Benchmark']
|
|
58
81
|
}
|
|
59
|
-
|
|
82
|
+
],
|
|
83
|
+
isCorrect: true,
|
|
84
|
+
nextContent: {
|
|
85
|
+
ref: 'sli_VkSQroQnx',
|
|
86
|
+
type: 'slide'
|
|
87
|
+
},
|
|
88
|
+
content: {
|
|
89
|
+
ref: 'sli_VJYjJnJhg',
|
|
90
|
+
type: 'slide'
|
|
91
|
+
},
|
|
92
|
+
pendingSlides: [],
|
|
93
|
+
slides: ['sli_VJYjJnJhg'],
|
|
94
|
+
step: {
|
|
95
|
+
current: 2
|
|
96
|
+
},
|
|
97
|
+
stars: 4
|
|
60
98
|
}
|
|
61
99
|
};
|
|
100
|
+
export var services = {
|
|
101
|
+
fetchSkills: function () { return Promise.resolve(fetchSkillsResponse); },
|
|
102
|
+
fetchSlide: function (ref) { return Promise.resolve(__assign(__assign({}, getSlideFixture(ref)), { universalRef: ref, id: ref })); },
|
|
103
|
+
postProgression: function () { return Promise.resolve(postProgressionResponse); },
|
|
104
|
+
postAnswer: function () { return Promise.resolve(postAnswerResponse); }
|
|
105
|
+
};
|
package/lib/types/common.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { SlideIndexes } from '../common';
|
|
2
|
-
import { AnswerUI } from './slides';
|
|
3
1
|
declare type TemplateContextValues = {
|
|
4
2
|
brandTheme?: unknown;
|
|
5
3
|
theme?: unknown;
|
|
@@ -23,21 +21,21 @@ declare type BaseContent = {
|
|
|
23
21
|
media?: unknown;
|
|
24
22
|
choices: ChoiceFromAPI[];
|
|
25
23
|
};
|
|
26
|
-
declare type
|
|
24
|
+
declare type BaseQuestion = {
|
|
27
25
|
header?: string;
|
|
28
26
|
content: BaseContent;
|
|
29
27
|
explanation?: string;
|
|
30
28
|
};
|
|
31
|
-
export declare type QcmQuestion =
|
|
29
|
+
export declare type QcmQuestion = BaseQuestion & {
|
|
32
30
|
type: 'qcm';
|
|
33
31
|
};
|
|
34
|
-
export declare type QcmGraphicQuestion =
|
|
32
|
+
export declare type QcmGraphicQuestion = BaseQuestion & {
|
|
35
33
|
type: 'qcmGraphic';
|
|
36
34
|
};
|
|
37
|
-
export declare type QcmDragQuestion =
|
|
35
|
+
export declare type QcmDragQuestion = BaseQuestion & {
|
|
38
36
|
type: 'qcmDrag';
|
|
39
37
|
};
|
|
40
|
-
export declare type BasicQuestion = Omit<
|
|
38
|
+
export declare type BasicQuestion = Omit<BaseQuestion, 'content'> & {
|
|
41
39
|
type: 'basic';
|
|
42
40
|
content: {
|
|
43
41
|
media?: unknown;
|
|
@@ -46,7 +44,7 @@ export declare type BasicQuestion = Omit<Question, 'content'> & {
|
|
|
46
44
|
id: string;
|
|
47
45
|
};
|
|
48
46
|
};
|
|
49
|
-
export declare type SliderQuestion = Omit<
|
|
47
|
+
export declare type SliderQuestion = Omit<BaseQuestion, 'content'> & {
|
|
50
48
|
content: {
|
|
51
49
|
media?: unknown;
|
|
52
50
|
unitLabel: string;
|
|
@@ -56,20 +54,25 @@ export declare type SliderQuestion = Omit<Question, 'content'> & {
|
|
|
56
54
|
};
|
|
57
55
|
type: 'slider';
|
|
58
56
|
};
|
|
59
|
-
export declare type TemplateQuestion = Omit<
|
|
57
|
+
export declare type TemplateQuestion = Omit<BaseQuestion, 'content'> & {
|
|
60
58
|
content: BaseContent & {
|
|
61
59
|
template: string;
|
|
62
60
|
};
|
|
63
61
|
type: 'template';
|
|
64
62
|
};
|
|
63
|
+
export declare type Question = QcmQuestion | QcmGraphicQuestion | QcmDragQuestion | BasicQuestion | SliderQuestion | TemplateQuestion;
|
|
65
64
|
export declare type SlideFromAPI = {
|
|
66
|
-
question:
|
|
65
|
+
question: Question;
|
|
67
66
|
klf: string;
|
|
68
67
|
universalRef: string;
|
|
69
68
|
tips?: string;
|
|
70
69
|
clue?: string;
|
|
71
70
|
hasClue?: boolean;
|
|
72
71
|
id: string;
|
|
72
|
+
parentContentTitle: {
|
|
73
|
+
title: string;
|
|
74
|
+
type: 'chapter' | 'course';
|
|
75
|
+
};
|
|
73
76
|
};
|
|
74
77
|
declare type ProgressionAnswerItem = {
|
|
75
78
|
isCorrect: boolean;
|
|
@@ -92,9 +95,17 @@ export declare type ProgressionState = {
|
|
|
92
95
|
step: {
|
|
93
96
|
current: number;
|
|
94
97
|
};
|
|
98
|
+
stars: number;
|
|
95
99
|
};
|
|
96
100
|
export declare type ProgressionFromAPI = {
|
|
97
101
|
_id: string;
|
|
102
|
+
content: {
|
|
103
|
+
type: 'skill';
|
|
104
|
+
ref: string;
|
|
105
|
+
};
|
|
106
|
+
engine: {
|
|
107
|
+
ref: 'review';
|
|
108
|
+
};
|
|
98
109
|
state: ProgressionState;
|
|
99
110
|
};
|
|
100
111
|
export declare type Skill = {
|
|
@@ -107,6 +118,7 @@ export declare type Services = {
|
|
|
107
118
|
fetchSkills(token: string): Promise<Skill[]>;
|
|
108
119
|
fetchSlide(slideRef: string, token: string): Promise<SlideFromAPI | void>;
|
|
109
120
|
postProgression(skillRef: string, token: string): Promise<ProgressionFromAPI>;
|
|
121
|
+
postAnswer(skillRef: string, token: string, progressionId: string, answer: string[]): Promise<ProgressionFromAPI>;
|
|
110
122
|
};
|
|
111
123
|
export declare type Options = {
|
|
112
124
|
services: Services;
|
|
@@ -128,29 +140,6 @@ export declare type JWT = {
|
|
|
128
140
|
usage: string;
|
|
129
141
|
host: string;
|
|
130
142
|
};
|
|
131
|
-
declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
132
|
-
export declare type NextUISlide = {
|
|
133
|
-
questionText?: string;
|
|
134
|
-
answerUI?: AnswerUI;
|
|
135
|
-
hidden?: boolean;
|
|
136
|
-
position?: number;
|
|
137
|
-
animationType?: SlideUIAnimations;
|
|
138
|
-
isCorrect?: boolean;
|
|
139
|
-
endReview?: boolean;
|
|
140
|
-
};
|
|
141
|
-
export declare type UISlide = {
|
|
142
|
-
questionText?: string;
|
|
143
|
-
answerUI?: AnswerUI;
|
|
144
|
-
hidden?: boolean;
|
|
145
|
-
position: number;
|
|
146
|
-
animationType?: SlideUIAnimations;
|
|
147
|
-
isCorrect?: boolean;
|
|
148
|
-
endReview?: boolean;
|
|
149
|
-
nextContent?: NextUISlide;
|
|
150
|
-
};
|
|
151
|
-
export declare type FinishedSlides = {
|
|
152
|
-
[key in SlideIndexes]?: true;
|
|
153
|
-
};
|
|
154
143
|
export declare type WithRequired<T, K extends keyof T> = T & {
|
|
155
144
|
[P in K]-?: T[P];
|
|
156
145
|
};
|
|
@@ -23,4 +23,4 @@ declare type SkillsProps = NoSkillsProps & {
|
|
|
23
23
|
listSkills: SkillCard[];
|
|
24
24
|
};
|
|
25
25
|
export { SkillsProps };
|
|
26
|
-
export declare const mapStateToSkillsProps: (state: StoreState) => SkillsProps
|
|
26
|
+
export declare const mapStateToSkillsProps: (state: StoreState) => SkillsProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import map from 'lodash/fp/map';
|
|
3
|
+
import omit from 'lodash/fp/omit';
|
|
4
|
+
import { mapStateToSkillsProps } from '..';
|
|
5
|
+
test('should create initial props when there are no skills on the state', function (t) {
|
|
6
|
+
var state = {
|
|
7
|
+
data: {
|
|
8
|
+
progression: null,
|
|
9
|
+
skills: [],
|
|
10
|
+
slides: {},
|
|
11
|
+
token: '1234'
|
|
12
|
+
},
|
|
13
|
+
ui: {
|
|
14
|
+
currentSlideRef: '',
|
|
15
|
+
navigation: ['loader', 'skills'],
|
|
16
|
+
answers: [],
|
|
17
|
+
slide: {
|
|
18
|
+
validateButton: false
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var props = mapStateToSkillsProps(state);
|
|
23
|
+
t.deepEqual(props, {
|
|
24
|
+
title: '@todo title',
|
|
25
|
+
titleNoSkills: '@todo titleNoSkills',
|
|
26
|
+
textNoSkills: '@todo textNoSkills',
|
|
27
|
+
iconSkillAriaLabel: '@todo iconSkillAriaLabel',
|
|
28
|
+
isLoading: false,
|
|
29
|
+
isLoadingAriaLabel: '@todo loading',
|
|
30
|
+
listSkills: []
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
test('should create initial props when skills on the state', function (t) {
|
|
34
|
+
var state = {
|
|
35
|
+
data: {
|
|
36
|
+
progression: null,
|
|
37
|
+
skills: [
|
|
38
|
+
{
|
|
39
|
+
skillRef: '_skill-ref',
|
|
40
|
+
slidesToReview: 2,
|
|
41
|
+
name: 'skill-test',
|
|
42
|
+
custom: false
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
skillRef: '_skill-ref-2',
|
|
46
|
+
slidesToReview: 5,
|
|
47
|
+
name: 'skill-test-2',
|
|
48
|
+
custom: true
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
slides: {},
|
|
52
|
+
token: '1234'
|
|
53
|
+
},
|
|
54
|
+
ui: {
|
|
55
|
+
currentSlideRef: '',
|
|
56
|
+
navigation: ['loader', 'skills'],
|
|
57
|
+
answers: [],
|
|
58
|
+
slide: {
|
|
59
|
+
validateButton: false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var props = mapStateToSkillsProps(state);
|
|
64
|
+
t.deepEqual(omit('listSkills', props), {
|
|
65
|
+
title: '@todo title',
|
|
66
|
+
titleNoSkills: '@todo titleNoSkills',
|
|
67
|
+
textNoSkills: '@todo textNoSkills',
|
|
68
|
+
iconSkillAriaLabel: '@todo iconSkillAriaLabel',
|
|
69
|
+
isLoading: false,
|
|
70
|
+
isLoadingAriaLabel: '@todo loading'
|
|
71
|
+
});
|
|
72
|
+
t.deepEqual(map(omit('onClick'), props.listSkills), [
|
|
73
|
+
{
|
|
74
|
+
'aria-label': '',
|
|
75
|
+
isCustom: false,
|
|
76
|
+
skillTitle: 'skill-test',
|
|
77
|
+
skillAriaLabel: '@todo skill aria label',
|
|
78
|
+
buttonLabel: '@todo button',
|
|
79
|
+
buttonAriaLabel: '@todo button aria label',
|
|
80
|
+
reviseLabel: '@todo revise',
|
|
81
|
+
reviseAriaLabel: '@todo revise aria label'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
'aria-label': '',
|
|
85
|
+
isCustom: true,
|
|
86
|
+
skillTitle: 'skill-test-2',
|
|
87
|
+
skillAriaLabel: '@todo skill aria label',
|
|
88
|
+
buttonLabel: '@todo button',
|
|
89
|
+
buttonAriaLabel: '@todo button aria label',
|
|
90
|
+
reviseLabel: '@todo revise',
|
|
91
|
+
reviseAriaLabel: '@todo revise aria label'
|
|
92
|
+
}
|
|
93
|
+
]);
|
|
94
|
+
});
|
|
@@ -1,3 +1,90 @@
|
|
|
1
|
+
import { Dispatch } from 'redux';
|
|
2
|
+
import { SlideIndexes } from '../../common';
|
|
1
3
|
import { StoreState } from '../../reducers';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
+
import { AnswerUI } from '../../types/slides';
|
|
5
|
+
declare const ICON_VALUES: {
|
|
6
|
+
readonly right: "right";
|
|
7
|
+
readonly wrong: "wrong";
|
|
8
|
+
readonly 'no-answer': "no-answer";
|
|
9
|
+
};
|
|
10
|
+
declare type IconValue = keyof typeof ICON_VALUES;
|
|
11
|
+
declare type StepItem = {
|
|
12
|
+
current: boolean;
|
|
13
|
+
icon: IconValue;
|
|
14
|
+
value: string;
|
|
15
|
+
};
|
|
16
|
+
declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
17
|
+
export declare type UISlide = {
|
|
18
|
+
questionText?: string;
|
|
19
|
+
answerUI?: AnswerUI;
|
|
20
|
+
hidden?: boolean;
|
|
21
|
+
position: number;
|
|
22
|
+
animationType?: SlideUIAnimations;
|
|
23
|
+
isCorrect?: boolean;
|
|
24
|
+
endReview?: boolean;
|
|
25
|
+
loading: boolean;
|
|
26
|
+
};
|
|
27
|
+
declare type SlidesStack = {
|
|
28
|
+
[key in SlideIndexes]: UISlide;
|
|
29
|
+
};
|
|
30
|
+
export declare type CorrectionPopinProps = {
|
|
31
|
+
klf: {
|
|
32
|
+
label: string;
|
|
33
|
+
onClick: Function;
|
|
34
|
+
tooltip: string;
|
|
35
|
+
};
|
|
36
|
+
information: {
|
|
37
|
+
label: string;
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
next: {
|
|
41
|
+
label: string;
|
|
42
|
+
ariaLabel: string;
|
|
43
|
+
};
|
|
44
|
+
successLabel: string;
|
|
45
|
+
failureLabel: string;
|
|
46
|
+
};
|
|
47
|
+
export declare type SlidesViewProps = {
|
|
48
|
+
header: {
|
|
49
|
+
mode: string;
|
|
50
|
+
skillName: string;
|
|
51
|
+
onQuitClick: Function;
|
|
52
|
+
'aria-label'?: string;
|
|
53
|
+
closeButtonAriaLabel: string;
|
|
54
|
+
steps: StepItem[];
|
|
55
|
+
};
|
|
56
|
+
stack: {
|
|
57
|
+
slides: SlidesStack;
|
|
58
|
+
validateButton: {
|
|
59
|
+
label: string;
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
onClick: Function;
|
|
62
|
+
};
|
|
63
|
+
correctionPopinProps?: CorrectionPopinProps;
|
|
64
|
+
endReview: boolean;
|
|
65
|
+
};
|
|
66
|
+
reviewBackgroundAriaLabel?: string;
|
|
67
|
+
congratsProps?: {
|
|
68
|
+
'aria-label'?: string;
|
|
69
|
+
'data-name'?: string;
|
|
70
|
+
animationLottie: unknown;
|
|
71
|
+
title: string;
|
|
72
|
+
cardCongratsStar: unknown;
|
|
73
|
+
cardCongratsRank: unknown;
|
|
74
|
+
buttonRevising: {
|
|
75
|
+
'aria-label'?: string;
|
|
76
|
+
label: string;
|
|
77
|
+
onClick: Function;
|
|
78
|
+
type: string;
|
|
79
|
+
};
|
|
80
|
+
buttonRevisingSkill: {
|
|
81
|
+
'aria-label'?: string;
|
|
82
|
+
label: string;
|
|
83
|
+
onClick: Function;
|
|
84
|
+
type: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export declare const initialState: SlidesStack;
|
|
89
|
+
export declare const mapStateToSlidesProps: (state: StoreState, dispatch: Dispatch) => SlidesViewProps;
|
|
90
|
+
export {};
|
|
@@ -9,8 +9,82 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
import concat from 'lodash/fp/concat';
|
|
13
|
+
import get from 'lodash/fp/get';
|
|
14
|
+
import getOr from 'lodash/fp/getOr';
|
|
12
15
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
13
|
-
|
|
16
|
+
import pipe from 'lodash/fp/pipe';
|
|
17
|
+
import reduce from 'lodash/fp/reduce';
|
|
18
|
+
import set from 'lodash/fp/set';
|
|
19
|
+
import slice from 'lodash/fp/slice';
|
|
20
|
+
import toInteger from 'lodash/fp/toInteger';
|
|
21
|
+
import { postAnswer } from '../../actions/api/post-answer';
|
|
22
|
+
import { mapApiSlideToUi } from './map-api-slide-to-ui';
|
|
23
|
+
var ICON_VALUES = {
|
|
24
|
+
right: 'right',
|
|
25
|
+
wrong: 'wrong',
|
|
26
|
+
'no-answer': 'no-answer'
|
|
27
|
+
};
|
|
28
|
+
export var initialState = {
|
|
29
|
+
'0': {
|
|
30
|
+
hidden: false,
|
|
31
|
+
position: 0,
|
|
32
|
+
loading: true
|
|
33
|
+
},
|
|
34
|
+
'1': {
|
|
35
|
+
hidden: false,
|
|
36
|
+
position: 1,
|
|
37
|
+
loading: true
|
|
38
|
+
},
|
|
39
|
+
'2': {
|
|
40
|
+
hidden: false,
|
|
41
|
+
position: 2,
|
|
42
|
+
loading: true
|
|
43
|
+
},
|
|
44
|
+
'3': {
|
|
45
|
+
hidden: false,
|
|
46
|
+
position: 3,
|
|
47
|
+
loading: true
|
|
48
|
+
},
|
|
49
|
+
'4': {
|
|
50
|
+
hidden: false,
|
|
51
|
+
position: 4,
|
|
52
|
+
loading: true
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var getProgressionSlidesRefs = function (progression) {
|
|
56
|
+
if (progression.state.step.current < 5) {
|
|
57
|
+
var slideRef = progression.state.nextContent.ref;
|
|
58
|
+
return concat([slideRef], progression.state.slides);
|
|
59
|
+
}
|
|
60
|
+
return slice(0, 5, progression.state.slides);
|
|
61
|
+
};
|
|
62
|
+
var buildStackSlides = function (state, dispatch) {
|
|
63
|
+
var currentSlideRef = state.ui.currentSlideRef;
|
|
64
|
+
var progression = state.data.progression;
|
|
65
|
+
if (!currentSlideRef || !progression)
|
|
66
|
+
return initialState;
|
|
67
|
+
var slideRefs = getProgressionSlidesRefs(progression);
|
|
68
|
+
// @ts-expect-error typescript does not support capped versions of lodash functions
|
|
69
|
+
var stack = reduce.convert({ cap: false })(function (acc, uiSlide, index) {
|
|
70
|
+
var slideRef = slideRefs[toInteger(index)];
|
|
71
|
+
if (!slideRef)
|
|
72
|
+
return set(index, uiSlide, acc);
|
|
73
|
+
var slideFromAPI = get(slideRef, state.data.slides);
|
|
74
|
+
if (!slideFromAPI)
|
|
75
|
+
return set(index, uiSlide, acc);
|
|
76
|
+
var answers = state.ui.answers;
|
|
77
|
+
var _a = mapApiSlideToUi(dispatch)(slideFromAPI, answers), questionText = _a.questionText, answerUI = _a.answerUI;
|
|
78
|
+
var parentContentTitle = getOr('', 'parentContentTitle.title', slideFromAPI);
|
|
79
|
+
var parentContentType = getOr('', 'parentContentTitle.type', slideFromAPI);
|
|
80
|
+
var updatedUiSlide = pipe(set('loading', false), set('questionText', questionText), set('answerUI', answerUI), set('parentContentTitle', "From \"".concat(parentContentTitle, "\" ").concat(parentContentType)) // TODO translate: -From- .... -Course/chapter-
|
|
81
|
+
// TODO: Set position according to currentSlideRef et slideRefs (or maybe a value on the state ui.slidePositions !!)
|
|
82
|
+
)(uiSlide);
|
|
83
|
+
return set(index, updatedUiSlide, acc);
|
|
84
|
+
}, initialState, initialState);
|
|
85
|
+
return stack;
|
|
86
|
+
};
|
|
87
|
+
var buildStepItems = function (state) {
|
|
14
88
|
var progression = state.data.progression;
|
|
15
89
|
var currentSlideRef = state.ui.currentSlideRef;
|
|
16
90
|
if (!progression)
|
|
@@ -55,10 +129,7 @@ var buildStepItemps = function (state) {
|
|
|
55
129
|
});
|
|
56
130
|
return steps;
|
|
57
131
|
};
|
|
58
|
-
export var mapStateToSlidesProps = function (state) {
|
|
59
|
-
if (!state.data.slides) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
132
|
+
export var mapStateToSlidesProps = function (state, dispatch) {
|
|
62
133
|
return {
|
|
63
134
|
header: {
|
|
64
135
|
mode: '__revision_mode',
|
|
@@ -69,16 +140,15 @@ export var mapStateToSlidesProps = function (state) {
|
|
|
69
140
|
},
|
|
70
141
|
'aria-label': 'aria-header-wrapper',
|
|
71
142
|
closeButtonAriaLabel: 'aria-close-button',
|
|
72
|
-
steps:
|
|
143
|
+
steps: buildStepItems(state)
|
|
73
144
|
},
|
|
74
145
|
stack: {
|
|
75
|
-
slides: state
|
|
146
|
+
slides: buildStackSlides(state, dispatch),
|
|
76
147
|
validateButton: {
|
|
77
148
|
label: '__validate',
|
|
78
|
-
disabled:
|
|
149
|
+
disabled: !get('ui.slide.validateButton', state),
|
|
79
150
|
onClick: function () {
|
|
80
|
-
|
|
81
|
-
console.log('TODO: validate question');
|
|
151
|
+
dispatch(postAnswer);
|
|
82
152
|
}
|
|
83
153
|
},
|
|
84
154
|
correctionPopinProps: undefined,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dispatch } from 'redux';
|
|
2
|
+
import { AnswerUI } from '../../types/slides';
|
|
3
|
+
import { Question, SlideFromAPI } from '../../types/common';
|
|
4
|
+
export declare const getQuestionType: (question: Question) => Question['type'];
|
|
5
|
+
export declare const mapApiSlideToUi: (dispatch: Dispatch) => (slide: SlideFromAPI, answers: string[]) => {
|
|
6
|
+
questionText: string;
|
|
7
|
+
answerUI: AnswerUI;
|
|
8
|
+
};
|