@coorpacademy/app-review 0.1.15 → 0.1.16
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 +4 -6
- package/es/actions/api/fetch-skills.js +7 -4
- package/es/actions/api/fetch-slide.d.ts +14 -7
- package/es/actions/api/fetch-slide.js +22 -19
- package/es/actions/api/post-progression.d.ts +4 -6
- package/es/actions/api/post-progression.js +13 -8
- package/es/actions/api/test/create-test-store.d.ts +5 -0
- package/es/actions/api/test/create-test-store.js +16 -0
- package/es/actions/api/test/fetch-skills.test.js +54 -0
- package/es/actions/api/test/fetch-slide.test.js +61 -0
- package/es/actions/api/test/post-progression.test.d.ts +1 -0
- package/es/actions/api/test/post-progression.test.js +102 -0
- package/es/actions/ui/answers.d.ts +7 -0
- package/es/actions/ui/answers.js +7 -0
- package/es/fixtures/temp-fixture.d.ts +1 -1
- package/es/index.js +10 -16
- package/es/reducers/data/index.d.ts +1 -1
- package/es/reducers/data/slides.d.ts +2 -2
- 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 +2 -2
- package/es/reducers/ui/answers.d.ts +4 -0
- package/es/reducers/ui/answers.js +13 -0
- package/es/reducers/ui/index.d.ts +4 -4
- package/es/reducers/ui/index.js +2 -2
- package/es/reducers/ui/test/answers.test.d.ts +1 -0
- package/es/reducers/ui/test/answers.test.js +11 -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/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.js +37 -7
- package/es/types/common.d.ts +22 -8
- package/es/views/slides/index.d.ts +78 -2
- package/es/views/slides/index.js +70 -4
- package/es/views/slides/map-api-slide-to-ui.d.ts +8 -0
- package/es/views/slides/map-api-slide-to-ui.js +172 -0
- package/{lib/helpers → es/views/slides}/test/fixtures/free-text.d.ts +1 -1
- package/es/views/slides/test/fixtures/free-text.js +38 -0
- package/es/{helpers → views/slides}/test/fixtures/qcm-drag.d.ts +1 -1
- package/es/views/slides/test/fixtures/qcm-drag.js +108 -0
- package/es/{helpers → views/slides}/test/fixtures/qcm-graphic.d.ts +1 -1
- package/es/views/slides/test/fixtures/qcm-graphic.js +88 -0
- package/es/{helpers → views/slides}/test/fixtures/qcm.d.ts +1 -1
- package/es/{helpers → views/slides}/test/fixtures/qcm.js +5 -1
- package/es/{helpers → views/slides}/test/fixtures/select-template.d.ts +1 -1
- package/es/views/slides/test/fixtures/select-template.js +92 -0
- package/es/{helpers → views/slides}/test/fixtures/slider.d.ts +1 -1
- package/es/views/slides/test/fixtures/slider.js +36 -0
- package/es/{helpers → views/slides}/test/fixtures/text-template.d.ts +1 -1
- package/es/{helpers → views/slides}/test/fixtures/text-template.js +5 -1
- 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 +4 -6
- package/lib/actions/api/fetch-skills.js +55 -7
- package/lib/actions/api/fetch-slide.d.ts +14 -7
- package/lib/actions/api/fetch-slide.js +70 -20
- package/lib/actions/api/post-progression.d.ts +4 -6
- package/lib/actions/api/post-progression.js +63 -9
- package/lib/actions/api/test/create-test-store.d.ts +5 -0
- package/lib/actions/api/test/create-test-store.js +18 -0
- package/lib/actions/api/test/fetch-skills.test.d.ts +1 -0
- package/lib/actions/api/test/fetch-skills.test.js +113 -0
- package/lib/actions/api/test/fetch-slide.test.d.ts +1 -0
- package/lib/actions/api/test/fetch-slide.test.js +120 -0
- package/lib/actions/api/test/post-progression.test.d.ts +1 -0
- package/lib/actions/api/test/post-progression.test.js +160 -0
- package/lib/actions/ui/answers.d.ts +7 -0
- package/lib/actions/ui/answers.js +9 -0
- package/lib/fixtures/temp-fixture.d.ts +1 -1
- package/lib/index.js +21 -18
- package/lib/reducers/data/index.d.ts +1 -1
- package/lib/reducers/data/slides.d.ts +2 -2
- 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 +2 -2
- package/lib/reducers/ui/answers.d.ts +4 -0
- package/lib/reducers/ui/answers.js +14 -0
- package/lib/reducers/ui/index.d.ts +4 -4
- package/lib/reducers/ui/index.js +2 -2
- package/lib/reducers/ui/test/answers.test.d.ts +1 -0
- package/lib/reducers/ui/test/answers.test.js +11 -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/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.js +37 -7
- package/lib/types/common.d.ts +22 -8
- package/lib/views/slides/index.d.ts +78 -2
- package/lib/views/slides/index.js +70 -4
- package/lib/views/slides/map-api-slide-to-ui.d.ts +8 -0
- package/lib/views/slides/map-api-slide-to-ui.js +178 -0
- package/{es/helpers → lib/views/slides}/test/fixtures/free-text.d.ts +1 -1
- package/lib/views/slides/test/fixtures/free-text.js +38 -0
- package/lib/{helpers → views/slides}/test/fixtures/qcm-drag.d.ts +1 -1
- package/lib/views/slides/test/fixtures/qcm-drag.js +108 -0
- package/lib/{helpers → views/slides}/test/fixtures/qcm-graphic.d.ts +1 -1
- package/lib/views/slides/test/fixtures/qcm-graphic.js +88 -0
- package/lib/{helpers → views/slides}/test/fixtures/qcm.d.ts +1 -1
- package/lib/{helpers → views/slides}/test/fixtures/qcm.js +5 -1
- package/lib/{helpers → views/slides}/test/fixtures/select-template.d.ts +1 -1
- package/lib/views/slides/test/fixtures/select-template.js +92 -0
- package/lib/{helpers → views/slides}/test/fixtures/slider.d.ts +1 -1
- package/lib/views/slides/test/fixtures/slider.js +36 -0
- package/lib/{helpers → views/slides}/test/fixtures/text-template.d.ts +1 -1
- package/lib/{helpers → views/slides}/test/fixtures/text-template.js +5 -1
- 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 +3 -3
- package/src/actions/api/fetch-skills.ts +12 -12
- package/src/actions/api/fetch-slide.ts +33 -29
- package/src/actions/api/post-progression.ts +18 -21
- package/src/actions/api/test/create-test-store.ts +25 -0
- package/src/actions/api/test/fetch-skills.test.ts +70 -0
- package/src/actions/api/test/fetch-slide.test.ts +77 -0
- package/src/actions/api/test/post-progression.test.ts +119 -0
- package/src/actions/ui/answers.ts +16 -0
- package/src/fixtures/temp-fixture.ts +1 -1
- package/src/index.tsx +14 -29
- package/src/reducers/data/index.ts +1 -1
- package/src/reducers/data/slides.ts +11 -2
- 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 +19 -0
- package/src/reducers/ui/index.ts +3 -3
- package/src/reducers/ui/test/answers.test.ts +13 -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/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 +37 -7
- package/src/types/common.ts +34 -14
- package/src/views/slides/index.ts +164 -5
- package/src/views/slides/map-api-slide-to-ui.ts +251 -0
- package/src/views/slides/test/fixtures/free-text.ts +43 -0
- package/src/views/slides/test/fixtures/qcm-drag.ts +111 -0
- package/src/views/slides/test/fixtures/qcm-graphic.ts +94 -0
- package/src/{helpers → views/slides}/test/fixtures/qcm.ts +6 -2
- package/src/views/slides/test/fixtures/select-template.ts +98 -0
- package/src/views/slides/test/fixtures/slider.ts +41 -0
- package/src/{helpers → views/slides}/test/fixtures/text-template.ts +6 -2
- package/src/{helpers → views/slides}/test/map-api-slide-to-ui.test.ts +21 -10
- 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/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/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
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import noop from 'lodash/fp/noop';
|
|
2
|
-
export const selectTemplateSlide = {
|
|
3
|
-
id: 'sli_410xZQxrZ',
|
|
4
|
-
universalRef: 'sli_410xZQxrZ',
|
|
5
|
-
question: {
|
|
6
|
-
type: 'template',
|
|
7
|
-
header: 'sli_410xZQxrZ.header',
|
|
8
|
-
explanation: 'sli_410xZQxrZ.explanation',
|
|
9
|
-
content: {
|
|
10
|
-
template: 'sli_410xZQxrZ.template',
|
|
11
|
-
choices: [
|
|
12
|
-
{
|
|
13
|
-
media: {
|
|
14
|
-
src: [],
|
|
15
|
-
posters: [],
|
|
16
|
-
subtitles: []
|
|
17
|
-
},
|
|
18
|
-
_id: '5fdce726359bf4003ee66967',
|
|
19
|
-
type: 'select',
|
|
20
|
-
name: 'sel36665',
|
|
21
|
-
items: [
|
|
22
|
-
{
|
|
23
|
-
_id: '5fdce726359bf4003ee66968',
|
|
24
|
-
text: 'sli_410xZQxrZ.choice_4yeA4Z7lr~',
|
|
25
|
-
value: 'sli_410xZQxrZ.choice_4yeA4Z7lr~'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
_id: '5fdce726359bf4003ee66969',
|
|
29
|
-
text: 'sli_410xZQxrZ.choice_VJWCN~mgB~',
|
|
30
|
-
value: 'sli_410xZQxrZ.choice_VJWCN~mgB~'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
_id: '5fdce726359bf4003ee6696a',
|
|
34
|
-
text: 'sli_410xZQxrZ.choice_VkaH~XgBb',
|
|
35
|
-
value: 'sli_410xZQxrZ.choice_VkaH~XgBb'
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
_id: '5fdce726359bf4003ee6696b',
|
|
39
|
-
text: 'sli_410xZQxrZ.choice_E1uUWXeBb',
|
|
40
|
-
value: 'sli_410xZQxrZ.choice_E1uUWXeBb'
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
clue: 'sli_410xZQxrZ.clue',
|
|
48
|
-
klf: 'sli_410xZQxrZ.klf',
|
|
49
|
-
tips: 'sli_410xZQxrZ.tips'
|
|
50
|
-
};
|
|
51
|
-
export const selectTemplateUISlide = {
|
|
52
|
-
questionText: 'sli_410xZQxrZ.header',
|
|
53
|
-
answerUI: {
|
|
54
|
-
help: 'sli_410xZQxrZ.explanation',
|
|
55
|
-
model: {
|
|
56
|
-
type: 'template',
|
|
57
|
-
template: 'sli_410xZQxrZ.template',
|
|
58
|
-
answers: [
|
|
59
|
-
{
|
|
60
|
-
type: 'select',
|
|
61
|
-
name: 'sel36665',
|
|
62
|
-
onChange: noop,
|
|
63
|
-
options: [
|
|
64
|
-
{ name: 'Select an answer', value: '', validOption: false, selected: true },
|
|
65
|
-
{
|
|
66
|
-
name: 'sli_410xZQxrZ.choice_4yeA4Z7lr~',
|
|
67
|
-
value: 'sli_410xZQxrZ.choice_4yeA4Z7lr~',
|
|
68
|
-
validOption: true,
|
|
69
|
-
selected: false
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: 'sli_410xZQxrZ.choice_VJWCN~mgB~',
|
|
73
|
-
value: 'sli_410xZQxrZ.choice_VJWCN~mgB~',
|
|
74
|
-
validOption: true,
|
|
75
|
-
selected: false
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: 'sli_410xZQxrZ.choice_VkaH~XgBb',
|
|
79
|
-
value: 'sli_410xZQxrZ.choice_VkaH~XgBb',
|
|
80
|
-
validOption: true,
|
|
81
|
-
selected: false
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 'sli_410xZQxrZ.choice_E1uUWXeBb',
|
|
85
|
-
value: 'sli_410xZQxrZ.choice_E1uUWXeBb',
|
|
86
|
-
validOption: true,
|
|
87
|
-
selected: false
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import noop from 'lodash/fp/noop';
|
|
2
|
-
export const sliderSlide = {
|
|
3
|
-
id: 'sli_41D5AovN~',
|
|
4
|
-
universalRef: 'sli_41D5AovN~',
|
|
5
|
-
question: {
|
|
6
|
-
type: 'slider',
|
|
7
|
-
header: 'sli_41D5AovN~.header',
|
|
8
|
-
explanation: 'sli_41D5AovN~.explanation',
|
|
9
|
-
content: {
|
|
10
|
-
min: 1,
|
|
11
|
-
max: 10,
|
|
12
|
-
unitLabel: 'sli_41D5AovN~.unitLabel'
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
clue: 'sli_41D5AovN~.clue',
|
|
16
|
-
klf: 'sli_41D5AovN~.klf',
|
|
17
|
-
tips: 'sli_41D5AovN~.tips'
|
|
18
|
-
};
|
|
19
|
-
export const sliderUISlide = {
|
|
20
|
-
questionText: 'sli_41D5AovN~.header',
|
|
21
|
-
answerUI: {
|
|
22
|
-
help: 'sli_41D5AovN~.explanation',
|
|
23
|
-
model: {
|
|
24
|
-
type: 'slider',
|
|
25
|
-
placeholder: 'sli_41D5AovN~.explanation',
|
|
26
|
-
minLabel: '1 undefined',
|
|
27
|
-
maxLabel: '10 undefined',
|
|
28
|
-
title: '0 sli_41D5AovN~.unitLabel',
|
|
29
|
-
value: -0.1111111111111111,
|
|
30
|
-
onChange: noop
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { UISlide } from '../../types/common';
|
|
2
|
-
import { SlideIndexes } from '../../common';
|
|
3
|
-
import { UISlidesAction } from '../../actions/ui/slides';
|
|
4
|
-
export declare type UISlidesState = {
|
|
5
|
-
[key in SlideIndexes]: UISlide;
|
|
6
|
-
};
|
|
7
|
-
export declare const initialState: UISlidesState;
|
|
8
|
-
declare const reducer: (state: UISlidesState | undefined, action: UISlidesAction) => UISlidesState;
|
|
9
|
-
export default reducer;
|
package/es/reducers/ui/slides.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import pipe from 'lodash/fp/pipe';
|
|
2
|
-
import set from 'lodash/fp/set';
|
|
3
|
-
import { mapApiSlideToUi } from '../../helpers/map-api-slide-to-ui';
|
|
4
|
-
import { SET_CURRENT_SLIDE } from '../../actions/ui/slides';
|
|
5
|
-
export const initialState = {
|
|
6
|
-
'0': {
|
|
7
|
-
hidden: false,
|
|
8
|
-
position: 0
|
|
9
|
-
},
|
|
10
|
-
'1': {
|
|
11
|
-
hidden: false,
|
|
12
|
-
position: 1
|
|
13
|
-
},
|
|
14
|
-
'2': {
|
|
15
|
-
hidden: false,
|
|
16
|
-
position: 2
|
|
17
|
-
},
|
|
18
|
-
'3': {
|
|
19
|
-
hidden: false,
|
|
20
|
-
position: 3
|
|
21
|
-
},
|
|
22
|
-
'4': {
|
|
23
|
-
hidden: false,
|
|
24
|
-
position: 4
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const setFirstSlide = (state, slideFromAPI) => {
|
|
28
|
-
const { questionText, answerUI } = mapApiSlideToUi({ translate: (text) => text })(slideFromAPI);
|
|
29
|
-
return pipe(set(['0', 'questionText'], questionText), set(['0', 'answerUI'], answerUI), set(['0', 'parentContentTitle'], 'Parent Title') // TODO parentContentTitle + translate
|
|
30
|
-
)(state);
|
|
31
|
-
};
|
|
32
|
-
// eslint-disable-next-line default-param-last
|
|
33
|
-
const reducer = (state = initialState, action) => {
|
|
34
|
-
switch (action.type) {
|
|
35
|
-
case SET_CURRENT_SLIDE: {
|
|
36
|
-
return setFirstSlide(state, action.payload);
|
|
37
|
-
}
|
|
38
|
-
default:
|
|
39
|
-
return state;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
export default reducer;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { StoreState } from '../../reducers';
|
|
2
|
-
import { Dispatchers } from '../../actions';
|
|
3
|
-
declare const ICON_VALUES: {
|
|
4
|
-
readonly right: "right";
|
|
5
|
-
readonly wrong: "wrong";
|
|
6
|
-
readonly 'no-answer': "no-answer";
|
|
7
|
-
};
|
|
8
|
-
declare type IconValue = keyof typeof ICON_VALUES;
|
|
9
|
-
declare type StepItem = {
|
|
10
|
-
current: boolean;
|
|
11
|
-
icon: IconValue;
|
|
12
|
-
value: string;
|
|
13
|
-
};
|
|
14
|
-
declare type CorrectionPopinProps = {
|
|
15
|
-
klf: {
|
|
16
|
-
label: string;
|
|
17
|
-
onClick: Function;
|
|
18
|
-
tooltip: string;
|
|
19
|
-
};
|
|
20
|
-
information: {
|
|
21
|
-
label: string;
|
|
22
|
-
message: string;
|
|
23
|
-
};
|
|
24
|
-
next: {
|
|
25
|
-
label: string;
|
|
26
|
-
ariaLabel: string;
|
|
27
|
-
};
|
|
28
|
-
successLabel: string;
|
|
29
|
-
failureLabel: string;
|
|
30
|
-
};
|
|
31
|
-
declare type SlidesViewStaticProps = {
|
|
32
|
-
header: {
|
|
33
|
-
mode: string;
|
|
34
|
-
skillName: string;
|
|
35
|
-
onQuitClick: Function;
|
|
36
|
-
'aria-label'?: string;
|
|
37
|
-
closeButtonAriaLabel: string;
|
|
38
|
-
steps: StepItem[];
|
|
39
|
-
};
|
|
40
|
-
stack: {
|
|
41
|
-
slides: StoreState['ui']['slides'];
|
|
42
|
-
validateButton: {
|
|
43
|
-
label: string;
|
|
44
|
-
disabled: boolean;
|
|
45
|
-
onClick: Function;
|
|
46
|
-
};
|
|
47
|
-
correctionPopinProps?: CorrectionPopinProps;
|
|
48
|
-
endReview: boolean;
|
|
49
|
-
};
|
|
50
|
-
reviewBackgroundAriaLabel?: string;
|
|
51
|
-
congratsProps?: {
|
|
52
|
-
'aria-label'?: string;
|
|
53
|
-
'data-name'?: string;
|
|
54
|
-
animationLottie: any;
|
|
55
|
-
title: string;
|
|
56
|
-
cardCongratsStar: any;
|
|
57
|
-
cardCongratsRank: any;
|
|
58
|
-
buttonRevising: {
|
|
59
|
-
'aria-label'?: string;
|
|
60
|
-
label: string;
|
|
61
|
-
onClick: Function;
|
|
62
|
-
type: string;
|
|
63
|
-
};
|
|
64
|
-
buttonRevisingSkill: {
|
|
65
|
-
'aria-label'?: string;
|
|
66
|
-
label: string;
|
|
67
|
-
onClick: Function;
|
|
68
|
-
type: string;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
declare type SlidesViewDispatcherProps = Omit<Dispatchers, 'navigateTo' | 'navigateBack'>;
|
|
73
|
-
declare type SlidesViewProps = SlidesViewStaticProps & SlidesViewDispatcherProps;
|
|
74
|
-
export { CorrectionPopinProps, IconValue, SlidesViewStaticProps, SlidesViewDispatcherProps, SlidesViewProps, StepItem };
|
package/es/types/views/slides.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AnswerUI } from '../types/slides';
|
|
2
|
-
import { SlideFromAPI } from '../types/common';
|
|
3
|
-
declare type UiUtils = {
|
|
4
|
-
translate: (text: string) => string;
|
|
5
|
-
};
|
|
6
|
-
export declare const getQuestionType: (slide: SlideFromAPI) => SlideFromAPI['question']['type'];
|
|
7
|
-
export declare const mapApiSlideToUi: (uiUtils: UiUtils) => (slide: SlideFromAPI) => {
|
|
8
|
-
questionText: string;
|
|
9
|
-
answerUI: AnswerUI;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { concat, divide, get, getOr, head, includes, indexOf, isEmpty, map, pipe, rangeStep, size, toInteger } from 'lodash/fp';
|
|
2
|
-
var qcmProps = function (question) {
|
|
3
|
-
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
4
|
-
var answers = [];
|
|
5
|
-
return {
|
|
6
|
-
type: 'qcm',
|
|
7
|
-
answers: map(function (choice) { return ({
|
|
8
|
-
title: choice.label,
|
|
9
|
-
selected: includes(choice.label, answers),
|
|
10
|
-
// TODO: EDIT_CHOICES
|
|
11
|
-
// eslint-disable-next-line no-console
|
|
12
|
-
onClick: function () { return console.log('TODO: on choice click'); },
|
|
13
|
-
ariaLabel: choice.label
|
|
14
|
-
}); },
|
|
15
|
-
// TODO: EDIT_CHOICES -> getChoices
|
|
16
|
-
question.content.choices)
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
var qcmDragProps = function (question) {
|
|
20
|
-
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
21
|
-
var answers = [];
|
|
22
|
-
return {
|
|
23
|
-
type: 'qcmDrag',
|
|
24
|
-
answers: map(function (choice) {
|
|
25
|
-
var indexInAnswer = indexOf(choice.label, answers);
|
|
26
|
-
return {
|
|
27
|
-
title: choice.label,
|
|
28
|
-
selected: indexInAnswer !== -1,
|
|
29
|
-
order: indexInAnswer,
|
|
30
|
-
// TODO: EDIT_CHOICES
|
|
31
|
-
// eslint-disable-next-line no-console
|
|
32
|
-
onClick: function () { return console.log('TODO: on choice click'); }
|
|
33
|
-
};
|
|
34
|
-
// TODO: EDIT_CHOICES -> getChoices
|
|
35
|
-
}, question.content.choices)
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
var qcmGraphicProps = function (question) {
|
|
39
|
-
// mock the answers
|
|
40
|
-
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
41
|
-
var answers = [];
|
|
42
|
-
return {
|
|
43
|
-
type: 'qcmGraphic',
|
|
44
|
-
answers: map(function (choice) { return ({
|
|
45
|
-
title: choice.label,
|
|
46
|
-
image: get('media.src.0.url', choice),
|
|
47
|
-
selected: includes(choice.label, answers),
|
|
48
|
-
// TODO: EDIT_CHOICES
|
|
49
|
-
// eslint-disable-next-line no-console
|
|
50
|
-
onClick: function () { return console.log('TODO: on choice click'); }
|
|
51
|
-
}); },
|
|
52
|
-
// TODO: EDIT_CHOICES -> getChoices
|
|
53
|
-
question.content.choices)
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
var templateTextProps = function (uiUtils) {
|
|
57
|
-
return function (choice, index) {
|
|
58
|
-
var translate = uiUtils.translate;
|
|
59
|
-
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
60
|
-
var answers = [];
|
|
61
|
-
return {
|
|
62
|
-
type: 'text',
|
|
63
|
-
name: getOr('', 'name', choice),
|
|
64
|
-
placeholder: translate('Type here'),
|
|
65
|
-
value: get(index, answers),
|
|
66
|
-
// TODO: EDIT_CHOICES
|
|
67
|
-
// eslint-disable-next-line no-console
|
|
68
|
-
onChange: function () { return console.log('TODO: on choice change'); }
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
// const getItemText = (item: ChoiceFromAPI['items'][0]): item['text'] is string =>
|
|
73
|
-
var templateSelectProps = function (uiUtils) {
|
|
74
|
-
return function (choice, index) {
|
|
75
|
-
var translate = uiUtils.translate;
|
|
76
|
-
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
77
|
-
var answers = [];
|
|
78
|
-
var answer = get(index, answers);
|
|
79
|
-
var temporaryOption = {
|
|
80
|
-
name: translate('Select an answer'),
|
|
81
|
-
value: '',
|
|
82
|
-
validOption: false,
|
|
83
|
-
selected: true
|
|
84
|
-
};
|
|
85
|
-
var selectOptions = choice.items.map(function (item) {
|
|
86
|
-
var itemText = getOr('', 'text', item);
|
|
87
|
-
return {
|
|
88
|
-
name: itemText,
|
|
89
|
-
value: itemText,
|
|
90
|
-
validOption: true,
|
|
91
|
-
selected: itemText === answer
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
return {
|
|
95
|
-
type: 'select',
|
|
96
|
-
name: getOr('', 'name', choice),
|
|
97
|
-
// TODO: EDIT_CHOICES
|
|
98
|
-
// eslint-disable-next-line no-console
|
|
99
|
-
onChange: function () { return console.log('TODO: on choice change'); },
|
|
100
|
-
options: isEmpty(answer) ? concat([temporaryOption], selectOptions) : selectOptions
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
var templateProps = function (uiUtils) {
|
|
105
|
-
var templateTextProps_ = templateTextProps(uiUtils);
|
|
106
|
-
var templateSelectProps_ = templateSelectProps(uiUtils);
|
|
107
|
-
return function (question) {
|
|
108
|
-
// TODO: EDIT_CHOICES -> getChoices
|
|
109
|
-
var choices = question.content.choices;
|
|
110
|
-
return {
|
|
111
|
-
type: 'template',
|
|
112
|
-
template: get('content.template', question),
|
|
113
|
-
answers: choices.map(function (choice, index) {
|
|
114
|
-
return choice.type === 'text'
|
|
115
|
-
? templateTextProps_(choice, index)
|
|
116
|
-
: templateSelectProps_(choice, index);
|
|
117
|
-
})
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
var basicProps = function (uiUtils) {
|
|
122
|
-
var translate = uiUtils.translate;
|
|
123
|
-
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
124
|
-
var answers = [];
|
|
125
|
-
return function () {
|
|
126
|
-
return {
|
|
127
|
-
type: 'freeText',
|
|
128
|
-
placeholder: translate('Type here'),
|
|
129
|
-
value: head(answers),
|
|
130
|
-
// TODO: EDIT_CHOICES
|
|
131
|
-
// eslint-disable-next-line no-console
|
|
132
|
-
onChange: function () { return console.log('TODO: on choice change'); }
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
var sliderProps = function (question) {
|
|
137
|
-
var values = rangeStep(getOr(1, 'content.step', question), getOr(Number.NaN, 'content.min', question), getOr(Number.NaN, 'content.max', question) + 1
|
|
138
|
-
// Lodash doesn't infer the type very well here
|
|
139
|
-
);
|
|
140
|
-
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
141
|
-
var answers = [];
|
|
142
|
-
var stateValue = head(answers);
|
|
143
|
-
var currentValue = toInteger(stateValue);
|
|
144
|
-
var indexValue = indexOf(currentValue, values);
|
|
145
|
-
var sliderPosition = divide(indexValue, size(values) - 1);
|
|
146
|
-
var unitLabel = get('question.content.unitLabel', question);
|
|
147
|
-
return {
|
|
148
|
-
type: 'slider',
|
|
149
|
-
placeholder: question.explanation,
|
|
150
|
-
minLabel: "".concat(question.content.min, " ").concat(unitLabel),
|
|
151
|
-
maxLabel: "".concat(question.content.max, " ").concat(unitLabel),
|
|
152
|
-
title: "".concat(currentValue, " ").concat(question.content.unitLabel),
|
|
153
|
-
value: sliderPosition,
|
|
154
|
-
// TODO: EDIT_CHOICES
|
|
155
|
-
// eslint-disable-next-line no-console
|
|
156
|
-
onChange: function () { return console.log('TODO: on choice change'); }
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
export var getQuestionType = function (slide) {
|
|
160
|
-
return slide.question.type;
|
|
161
|
-
};
|
|
162
|
-
var getHelp = function (uiUtils) {
|
|
163
|
-
return function (slide) {
|
|
164
|
-
var translate = uiUtils.translate;
|
|
165
|
-
return get('question.explanation', slide) || translate('Select something below');
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
var getAnswerUIModel = function (uiUtils) {
|
|
169
|
-
var basicProps_ = basicProps(uiUtils);
|
|
170
|
-
var templateProps_ = templateProps(uiUtils);
|
|
171
|
-
return function (slide) {
|
|
172
|
-
var type = getQuestionType(slide);
|
|
173
|
-
switch (type) {
|
|
174
|
-
case 'qcm':
|
|
175
|
-
return pipe(get('question'), qcmProps)(slide);
|
|
176
|
-
case 'qcmGraphic':
|
|
177
|
-
return pipe(get('question'), qcmGraphicProps)(slide);
|
|
178
|
-
case 'qcmDrag':
|
|
179
|
-
return pipe(get('question'), qcmDragProps)(slide);
|
|
180
|
-
case 'basic':
|
|
181
|
-
return basicProps_();
|
|
182
|
-
case 'template':
|
|
183
|
-
return pipe(get('question'), templateProps_)(slide);
|
|
184
|
-
case 'slider':
|
|
185
|
-
return pipe(get('question'), sliderProps)(slide);
|
|
186
|
-
default:
|
|
187
|
-
throw new Error("".concat(type, " is not an handled question.type"));
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
export var mapApiSlideToUi = function (uiUtils) {
|
|
192
|
-
var getAnswerUIModel_ = getAnswerUIModel(uiUtils);
|
|
193
|
-
var getHelp_ = getHelp(uiUtils);
|
|
194
|
-
return function (slide) {
|
|
195
|
-
if (!slide) {
|
|
196
|
-
throw new Error('no slide was found');
|
|
197
|
-
}
|
|
198
|
-
var questionText = pipe(getOr('', 'question.header'), uiUtils.translate)(slide);
|
|
199
|
-
return { questionText: questionText, answerUI: { model: getAnswerUIModel_(slide), help: getHelp_(slide) } };
|
|
200
|
-
};
|
|
201
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import noop from 'lodash/fp/noop';
|
|
2
|
-
export var freeTextSlide = {
|
|
3
|
-
id: 'sli_E1Pcl-XAYbi',
|
|
4
|
-
universalRef: 'sli_E1Pcl-XAYbi',
|
|
5
|
-
question: {
|
|
6
|
-
type: 'basic',
|
|
7
|
-
header: 'sli_E1Pcl-XAYbi.header',
|
|
8
|
-
explanation: 'sli_E1Pcl-XAYbi.explanation',
|
|
9
|
-
content: {
|
|
10
|
-
label: 'sli_E1Pcl-XAYbi.label',
|
|
11
|
-
placeholder: 'sli_E1Pcl-XAYbi.placeholder',
|
|
12
|
-
id: 'sli_E1Pcl-XAYbi.choice_1'
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
clue: 'sli_E1Pcl-XAYbi.clue',
|
|
16
|
-
klf: 'sli_E1Pcl-XAYbi.klf',
|
|
17
|
-
tips: 'sli_E1Pcl-XAYbi.tips'
|
|
18
|
-
};
|
|
19
|
-
export var freeTextUISlide = {
|
|
20
|
-
answerUI: {
|
|
21
|
-
help: 'sli_E1Pcl-XAYbi.explanation',
|
|
22
|
-
model: {
|
|
23
|
-
type: 'freeText',
|
|
24
|
-
placeholder: 'Type here',
|
|
25
|
-
value: undefined,
|
|
26
|
-
onChange: noop
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
questionText: 'sli_E1Pcl-XAYbi.header'
|
|
30
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import noop from 'lodash/fp/noop';
|
|
2
|
-
export var qcmDragSlide = {
|
|
3
|
-
id: 'sli_419IlQQnf',
|
|
4
|
-
universalRef: 'sli_419IlQQnf',
|
|
5
|
-
question: {
|
|
6
|
-
type: 'qcmDrag',
|
|
7
|
-
header: 'sli_419IlQQnf.header',
|
|
8
|
-
explanation: 'sli_419IlQQnf.explanation',
|
|
9
|
-
content: {
|
|
10
|
-
choices: [
|
|
11
|
-
{
|
|
12
|
-
media: {
|
|
13
|
-
src: [],
|
|
14
|
-
posters: [],
|
|
15
|
-
subtitles: []
|
|
16
|
-
},
|
|
17
|
-
_id: '62b1ba3ec4f4015504212571',
|
|
18
|
-
label: 'sli_419IlQQnf.choice_4kWwlQXhG',
|
|
19
|
-
value: 'sli_419IlQQnf.choice_4kWwlQXhG',
|
|
20
|
-
items: []
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
media: {
|
|
24
|
-
src: [],
|
|
25
|
-
posters: [],
|
|
26
|
-
subtitles: []
|
|
27
|
-
},
|
|
28
|
-
_id: '62b1ba3ec4f4015504212572',
|
|
29
|
-
label: 'sli_419IlQQnf.choice_NJxbwgXm2G',
|
|
30
|
-
value: 'sli_419IlQQnf.choice_NJxbwgXm2G',
|
|
31
|
-
items: []
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
media: {
|
|
35
|
-
src: [],
|
|
36
|
-
posters: [],
|
|
37
|
-
subtitles: []
|
|
38
|
-
},
|
|
39
|
-
_id: '62b1ba3ec4f4015504212573',
|
|
40
|
-
label: 'sli_419IlQQnf.choice_41fwgQXnf',
|
|
41
|
-
value: 'sli_419IlQQnf.choice_41fwgQXnf',
|
|
42
|
-
items: []
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
media: {
|
|
46
|
-
src: [],
|
|
47
|
-
posters: [],
|
|
48
|
-
subtitles: []
|
|
49
|
-
},
|
|
50
|
-
_id: '62b1ba3ec4f4015504212574',
|
|
51
|
-
label: 'sli_419IlQQnf.choice_VJmweQ7nz',
|
|
52
|
-
value: 'sli_419IlQQnf.choice_VJmweQ7nz',
|
|
53
|
-
items: []
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
media: {
|
|
57
|
-
src: [],
|
|
58
|
-
posters: [],
|
|
59
|
-
subtitles: []
|
|
60
|
-
},
|
|
61
|
-
_id: '62b1ba3ec4f4015504212575',
|
|
62
|
-
label: 'sli_419IlQQnf.choice_4kDDgXQhz',
|
|
63
|
-
value: 'sli_419IlQQnf.choice_4kDDgXQhz',
|
|
64
|
-
items: []
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
klf: 'sli_419IlQQnf.klf',
|
|
70
|
-
tips: 'sli_419IlQQnf.tips'
|
|
71
|
-
};
|
|
72
|
-
export var qcmDragUISlide = {
|
|
73
|
-
questionText: 'sli_419IlQQnf.header',
|
|
74
|
-
answerUI: {
|
|
75
|
-
help: 'sli_419IlQQnf.explanation',
|
|
76
|
-
model: {
|
|
77
|
-
type: 'qcmDrag',
|
|
78
|
-
answers: [
|
|
79
|
-
{
|
|
80
|
-
title: 'sli_419IlQQnf.choice_4kWwlQXhG',
|
|
81
|
-
selected: false,
|
|
82
|
-
order: -1,
|
|
83
|
-
onClick: noop
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
title: 'sli_419IlQQnf.choice_NJxbwgXm2G',
|
|
87
|
-
selected: false,
|
|
88
|
-
order: -1,
|
|
89
|
-
onClick: noop
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
title: 'sli_419IlQQnf.choice_41fwgQXnf',
|
|
93
|
-
selected: false,
|
|
94
|
-
order: -1,
|
|
95
|
-
onClick: noop
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
title: 'sli_419IlQQnf.choice_VJmweQ7nz',
|
|
99
|
-
selected: false,
|
|
100
|
-
order: -1,
|
|
101
|
-
onClick: noop
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
title: 'sli_419IlQQnf.choice_4kDDgXQhz',
|
|
105
|
-
selected: false,
|
|
106
|
-
order: -1,
|
|
107
|
-
onClick: noop
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|