@coorpacademy/app-review 0.2.7 → 0.2.9-alpha.5

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.
Files changed (104) hide show
  1. package/es/actions/api/fetch-rank.d.ts +32 -0
  2. package/es/actions/api/fetch-rank.js +30 -0
  3. package/es/actions/api/test/fetch-correction.test.js +2 -1
  4. package/es/actions/api/test/fetch-rank.test.d.ts +1 -0
  5. package/es/actions/api/test/fetch-rank.test.js +100 -0
  6. package/es/actions/api/test/fetch-skills.test.js +2 -1
  7. package/es/actions/api/test/fetch-slide.test.js +2 -1
  8. package/es/actions/api/test/post-answer.test.js +2 -1
  9. package/es/actions/api/test/post-progression.test.js +2 -1
  10. package/es/actions/data/test/token.test.js +2 -1
  11. package/es/actions/ui/test/answers.test.js +2 -1
  12. package/es/actions/ui/test/slides.test.js +2 -1
  13. package/es/reducers/data/corrections.d.ts +1 -1
  14. package/es/reducers/data/index.d.ts +4 -1
  15. package/es/reducers/data/index.js +2 -1
  16. package/es/reducers/data/rank.d.ts +7 -0
  17. package/es/reducers/data/rank.js +36 -0
  18. package/es/reducers/data/test/rank.test.d.ts +1 -0
  19. package/es/reducers/data/test/rank.test.js +59 -0
  20. package/es/reducers/index.d.ts +4 -3
  21. package/es/reducers/ui/slide.d.ts +1 -0
  22. package/es/reducers/ui/slide.js +1 -1
  23. package/es/services/index.js +2 -0
  24. package/es/test/util/services.mock.d.ts +1 -0
  25. package/es/test/util/services.mock.js +21 -1
  26. package/es/types/common.d.ts +1 -0
  27. package/es/views/skills/test/skills.test.js +4 -2
  28. package/es/views/slides/index.d.ts +21 -19
  29. package/es/views/slides/index.js +29 -3
  30. package/es/views/slides/test/fixtures/qcm-graphic.js +190 -28
  31. package/es/views/slides/test/index.test.js +200 -19
  32. package/es/views/slides/test/slide.free-text.on-change.test.js +4 -1
  33. package/es/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
  34. package/es/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
  35. package/es/views/slides/test/slide.qcm.on-click.test.js +4 -1
  36. package/es/views/slides/test/slide.slider.on-change.test.js +4 -1
  37. package/es/views/slides/test/slide.template.on-change.test.js +6 -1
  38. package/lib/actions/api/fetch-rank.d.ts +32 -0
  39. package/lib/actions/api/fetch-rank.js +32 -0
  40. package/lib/actions/api/test/fetch-correction.test.js +2 -1
  41. package/lib/actions/api/test/fetch-rank.test.d.ts +1 -0
  42. package/lib/actions/api/test/fetch-rank.test.js +171 -0
  43. package/lib/actions/api/test/fetch-skills.test.js +2 -1
  44. package/lib/actions/api/test/fetch-slide.test.js +2 -1
  45. package/lib/actions/api/test/post-answer.test.js +2 -1
  46. package/lib/actions/api/test/post-progression.test.js +2 -1
  47. package/lib/actions/data/test/token.test.js +2 -1
  48. package/lib/actions/ui/test/answers.test.js +2 -1
  49. package/lib/actions/ui/test/slides.test.js +2 -1
  50. package/lib/reducers/data/corrections.d.ts +1 -1
  51. package/lib/reducers/data/index.d.ts +4 -1
  52. package/lib/reducers/data/index.js +2 -1
  53. package/lib/reducers/data/rank.d.ts +7 -0
  54. package/lib/reducers/data/rank.js +37 -0
  55. package/lib/reducers/data/test/rank.test.d.ts +1 -0
  56. package/lib/reducers/data/test/rank.test.js +59 -0
  57. package/lib/reducers/index.d.ts +4 -3
  58. package/lib/reducers/ui/slide.d.ts +1 -0
  59. package/lib/reducers/ui/slide.js +1 -1
  60. package/lib/services/index.js +2 -0
  61. package/lib/test/util/services.mock.d.ts +1 -0
  62. package/lib/test/util/services.mock.js +12 -1
  63. package/lib/types/common.d.ts +1 -0
  64. package/lib/views/skills/test/skills.test.js +4 -2
  65. package/lib/views/slides/index.d.ts +21 -19
  66. package/lib/views/slides/index.js +29 -3
  67. package/lib/views/slides/test/fixtures/qcm-graphic.js +190 -28
  68. package/lib/views/slides/test/index.test.js +211 -22
  69. package/lib/views/slides/test/slide.free-text.on-change.test.js +4 -1
  70. package/lib/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
  71. package/lib/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
  72. package/lib/views/slides/test/slide.qcm.on-click.test.js +4 -1
  73. package/lib/views/slides/test/slide.slider.on-change.test.js +4 -1
  74. package/lib/views/slides/test/slide.template.on-change.test.js +6 -1
  75. package/package.json +4 -4
  76. package/src/actions/api/fetch-rank.ts +84 -0
  77. package/src/actions/api/test/fetch-correction.test.ts +2 -1
  78. package/src/actions/api/test/fetch-rank.test.ts +130 -0
  79. package/src/actions/api/test/fetch-skills.test.ts +2 -1
  80. package/src/actions/api/test/fetch-slide.test.ts +2 -1
  81. package/src/actions/api/test/post-answer.test.ts +2 -1
  82. package/src/actions/api/test/post-progression.test.ts +2 -1
  83. package/src/actions/data/test/token.test.ts +2 -1
  84. package/src/actions/ui/test/answers.test.ts +2 -1
  85. package/src/actions/ui/test/slides.test.ts +2 -1
  86. package/src/reducers/data/corrections.ts +1 -1
  87. package/src/reducers/data/index.ts +3 -1
  88. package/src/reducers/data/rank.ts +60 -0
  89. package/src/reducers/data/test/rank.test.ts +78 -0
  90. package/src/reducers/index.ts +2 -2
  91. package/src/reducers/ui/slide.ts +2 -1
  92. package/src/services/index.ts +2 -0
  93. package/src/test/util/services.mock.ts +23 -1
  94. package/src/types/common.ts +1 -0
  95. package/src/views/skills/test/skills.test.ts +4 -2
  96. package/src/views/slides/index.ts +65 -22
  97. package/src/views/slides/test/fixtures/qcm-graphic.ts +196 -29
  98. package/src/views/slides/test/index.test.ts +210 -21
  99. package/src/views/slides/test/slide.free-text.on-change.test.ts +4 -1
  100. package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +4 -1
  101. package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +6 -4
  102. package/src/views/slides/test/slide.qcm.on-click.test.ts +4 -1
  103. package/src/views/slides/test/slide.slider.on-change.test.ts +4 -1
  104. package/src/views/slides/test/slide.template.on-change.test.ts +6 -1
@@ -8,6 +8,7 @@ import reduce from 'lodash/fp/reduce';
8
8
  import set from 'lodash/fp/set';
9
9
  import slice from 'lodash/fp/slice';
10
10
  import toInteger from 'lodash/fp/toInteger';
11
+ import join from 'lodash/fp/join';
11
12
  import { postAnswer } from '../../actions/api/post-answer';
12
13
  import { mapApiSlideToUi } from './map-api-slide-to-ui';
13
14
  const ICON_VALUES = {
@@ -67,7 +68,10 @@ const buildStackSlides = (state, dispatch) => {
67
68
  const { questionText, answerUI } = mapApiSlideToUi(dispatch)(slideFromAPI, answers);
68
69
  const parentContentTitle = getOr('', 'parentContentTitle.title', slideFromAPI);
69
70
  const parentContentType = getOr('', 'parentContentTitle.type', slideFromAPI);
70
- const updatedUiSlide = pipe(set('loading', false), set('questionText', questionText), set('answerUI', answerUI), set('parentContentTitle', `From "${parentContentTitle}" ${parentContentType}`) // TODO translate: -From- .... -Course/chapter-
71
+ const isCurrentSlideRef = currentSlideRef === slideRef;
72
+ const animateCorrectionPopin = isCurrentSlideRef && getOr(false, ['ui', 'slide', 'animateCorrectionPopin'], state);
73
+ const showCorrectionPopin = isCurrentSlideRef && getOr(false, ['ui', 'slide', 'showCorrectionPopin'], state);
74
+ const updatedUiSlide = pipe(set('showCorrectionPopin', showCorrectionPopin), set('animateCorrectionPopin', animateCorrectionPopin), set('loading', false), set('questionText', questionText), set('answerUI', answerUI), set('parentContentTitle', `From "${parentContentTitle}" ${parentContentType}`) // TODO translate: -From- .... -Course/chapter-
71
75
  // TODO: Set position according to currentSlideRef et slideRefs (or maybe a value on the state ui.slidePositions !!)
72
76
  )(uiSlide);
73
77
  return set(index, updatedUiSlide, acc);
@@ -141,7 +145,29 @@ export const buildStepItems = (state) => {
141
145
  });
142
146
  return steps;
143
147
  };
148
+ const getCorrectionPopinProps = (isCorrect, correctAnswer, klf) => ({
149
+ klf: isCorrect
150
+ ? undefined
151
+ : {
152
+ label: '_klf',
153
+ tooltip: klf
154
+ },
155
+ resultLabel: isCorrect ? '_right' : '_wrong',
156
+ information: {
157
+ label: isCorrect ? '_klf' : '_correctAnswer',
158
+ message: isCorrect ? klf : join(',', correctAnswer)
159
+ },
160
+ next: {
161
+ ariaLabel: '_correctionNextAriaLabel',
162
+ label: '_correctionNextLabel'
163
+ },
164
+ type: isCorrect ? 'right' : 'wrong'
165
+ });
144
166
  export const mapStateToSlidesProps = (state, dispatch) => {
167
+ const currentSlideRef = get(['ui', 'currentSlideRef'], state);
168
+ const correction = get(['data', 'corrections', currentSlideRef], state);
169
+ const isCorrect = get(['data', 'progression', 'state', 'isCorrect'], state);
170
+ const klf = getOr('', ['data', 'slides', currentSlideRef, 'klf'], state);
145
171
  return {
146
172
  header: {
147
173
  mode: '__revision_mode',
@@ -159,11 +185,11 @@ export const mapStateToSlidesProps = (state, dispatch) => {
159
185
  validateButton: {
160
186
  label: '__validate',
161
187
  disabled: !get('ui.slide.validateButton', state),
162
- onClick: () => {
188
+ onClick: /* istanbul ignore next */ () => {
163
189
  dispatch(postAnswer);
164
190
  }
165
191
  },
166
- correctionPopinProps: undefined,
192
+ correctionPopinProps: correction && getCorrectionPopinProps(isCorrect, correction.correctAnswer, klf),
167
193
  endReview: false
168
194
  },
169
195
  congratsProps: undefined
@@ -12,10 +12,10 @@ export const qcmGraphicSlide = {
12
12
  media: {
13
13
  src: [
14
14
  {
15
- _id: '624efd915948a7013083e986',
15
+ _id: '616dbbb61a50f8051c1971ba',
16
16
  mimeType: 'image/jpeg',
17
- url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
18
- id: '624efd915948a7013083e986'
17
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_180530003-1618999931321.jpg',
18
+ id: '616dbbb61a50f8051c1971ba'
19
19
  }
20
20
  ],
21
21
  posters: [],
@@ -23,19 +23,19 @@ export const qcmGraphicSlide = {
23
23
  type: 'img'
24
24
  },
25
25
  items: [],
26
- _id: '624efd915948a7013083e985',
27
- label: 'Vrai',
28
- value: 'sli_VkSQroQnx.choice_NJesyUo7nx',
29
- id: '624efd915948a7013083e985'
26
+ _id: '616dbbb61a50f8051c1971b9',
27
+ label: 'La consolidation des acquis',
28
+ value: 'sli_4k5O3zaN5.choice_E1ebZYyF8q',
29
+ id: '616dbbb61a50f8051c1971b9'
30
30
  },
31
31
  {
32
32
  media: {
33
33
  src: [
34
34
  {
35
- _id: '624efd915948a7013083e988',
35
+ _id: '616dbbb61a50f8051c1971bc',
36
36
  mimeType: 'image/jpeg',
37
- url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
38
- id: '624efd915948a7013083e988'
37
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_1170951868-1618999931510.jpg',
38
+ id: '616dbbb61a50f8051c1971bc'
39
39
  }
40
40
  ],
41
41
  posters: [],
@@ -43,19 +43,139 @@ export const qcmGraphicSlide = {
43
43
  type: 'img'
44
44
  },
45
45
  items: [],
46
- _id: '624efd915948a7013083e987',
47
- label: 'Faux',
48
- value: 'sli_VkSQroQnx.choice_VkgayLjX3e',
49
- id: '624efd915948a7013083e987'
46
+ _id: '616dbbb61a50f8051c1971bb',
47
+ label: 'Le retour d’information',
48
+ value: 'sli_4k5O3zaN5.choice_NygF~FJFIc',
49
+ id: '616dbbb61a50f8051c1971bb'
50
+ },
51
+ {
52
+ media: {
53
+ src: [
54
+ {
55
+ _id: '616dbbb61a50f8051c1971be',
56
+ mimeType: 'image/jpeg',
57
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_439207960-1618999931642.jpg',
58
+ id: '616dbbb61a50f8051c1971be'
59
+ }
60
+ ],
61
+ posters: [],
62
+ subtitles: [],
63
+ type: 'img'
64
+ },
65
+ items: [],
66
+ _id: '616dbbb61a50f8051c1971bd',
67
+ label: 'L’engagement actif',
68
+ value: 'sli_4k5O3zaN5.choice_4yx5bKJKIc',
69
+ id: '616dbbb61a50f8051c1971bd'
70
+ },
71
+ {
72
+ media: {
73
+ src: [
74
+ {
75
+ _id: '616dbbb61a50f8051c1971c0',
76
+ mimeType: 'image/jpeg',
77
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_538654849-1618999935091.jpg',
78
+ id: '616dbbb61a50f8051c1971c0'
79
+ }
80
+ ],
81
+ posters: [],
82
+ subtitles: [],
83
+ type: 'img'
84
+ },
85
+ items: [],
86
+ _id: '616dbbb61a50f8051c1971bf',
87
+ label: 'La motivation',
88
+ value: 'sli_4k5O3zaN5.choice_VkzcZY1F8q',
89
+ id: '616dbbb61a50f8051c1971bf'
90
+ },
91
+ {
92
+ media: {
93
+ src: [
94
+ {
95
+ _id: '616dbbb61a50f8051c1971c2',
96
+ mimeType: 'image/jpeg',
97
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_485162803-1618999941454.jpg',
98
+ id: '616dbbb61a50f8051c1971c2'
99
+ }
100
+ ],
101
+ posters: [],
102
+ subtitles: [],
103
+ type: 'img'
104
+ },
105
+ items: [],
106
+ _id: '616dbbb61a50f8051c1971c1',
107
+ label: 'L’attention',
108
+ value: 'sli_4k5O3zaN5.choice_Vken~YJFI5',
109
+ id: '616dbbb61a50f8051c1971c1'
110
+ },
111
+ {
112
+ media: {
113
+ src: [
114
+ {
115
+ _id: '616dbbb61a50f8051c1971c4',
116
+ mimeType: 'image/jpeg',
117
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_374136655-1619000050478.jpg',
118
+ id: '616dbbb61a50f8051c1971c4'
119
+ }
120
+ ],
121
+ posters: [],
122
+ subtitles: [],
123
+ type: 'img'
124
+ },
125
+ items: [],
126
+ _id: '616dbbb61a50f8051c1971c3',
127
+ label: 'La confiance en soi',
128
+ value: 'sli_4k5O3zaN5.choice_4JgpWKkFLq',
129
+ id: '616dbbb61a50f8051c1971c3'
130
+ },
131
+ {
132
+ media: {
133
+ src: [
134
+ {
135
+ _id: '616dbbb61a50f8051c1971c6',
136
+ mimeType: 'image/jpeg',
137
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_142530529-1618999997389.jpg',
138
+ id: '616dbbb61a50f8051c1971c6'
139
+ }
140
+ ],
141
+ posters: [],
142
+ subtitles: [],
143
+ type: 'img'
144
+ },
145
+ items: [],
146
+ _id: '616dbbb61a50f8051c1971c5',
147
+ label: 'La capacité d’abstraction',
148
+ value: 'sli_4k5O3zaN5.choice_NJfabKkK8q',
149
+ id: '616dbbb61a50f8051c1971c5'
150
+ },
151
+ {
152
+ media: {
153
+ src: [
154
+ {
155
+ _id: '616dbbb61a50f8051c1971c8',
156
+ mimeType: 'image/jpeg',
157
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_5948041-1618999993222.jpg',
158
+ id: '616dbbb61a50f8051c1971c8'
159
+ }
160
+ ],
161
+ posters: [],
162
+ subtitles: [],
163
+ type: 'img'
164
+ },
165
+ items: [],
166
+ _id: '616dbbb61a50f8051c1971c7',
167
+ label: 'L’abnégation',
168
+ value: 'sli_4k5O3zaN5.choice_41xAWYJYI9',
169
+ id: '616dbbb61a50f8051c1971c7'
50
170
  }
51
171
  ]
52
172
  },
53
173
  type: 'qcmGraphic',
54
- header: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
55
- explanation: 'Sélectionnez la bonne réponse.'
174
+ header: 'Quels sont les 4 piliers de l’apprentissage ?',
175
+ explanation: 'Sélectionnez les 4 bonnes réponses.'
56
176
  },
57
- klf: "Il ne faut pas prendre la négociation comme une affaire personnelle, afin de rester centré sur son sujet. Mais cela ne signifie pas être dépourvu de toute émotion, car celles-ci peuvent être de vrais atouts. À condition de réussir à les exprimer sans accuser l'autre d'en être à l'origine.",
58
- tips: "Pour gérer ses émotions, il faut d'abord les identifier, notamment en analysant ses ressentis physiques et en trouvant l'élément déclencheur.",
177
+ klf: 'Avec l’engagement actif, le retour d’information et la consolidation des acquis, l’attention est le premier des quatre piliers de l’apprentissage, identifiés par les chercheurs en neuroscience, spécialistes de l’éducation.',
178
+ tips: 'Une configuration idéale pour l’apprentissage, mettant en œuvre ces 4 piliers : présenter à un apprenant un contenu de durée raisonnable, qui respecte le temps d’attention qu’il peut lui accorder ; proposer ensuite un exercice sur le contenu qui vient d’être expliqué ; puis donner à l’apprenant un retour en direct sur sa production.',
59
179
  universalRef: 'sli_VkSQroQnx',
60
180
  _id: 'sli_VkSQroQnx',
61
181
  parentContentTitle: {
@@ -64,25 +184,67 @@ export const qcmGraphicSlide = {
64
184
  }
65
185
  };
66
186
  export const qcmGraphicUISlide = {
67
- questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
187
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?',
68
188
  answerUI: {
69
- help: 'Sélectionnez la bonne réponse.',
189
+ help: 'Sélectionnez les 4 bonnes réponses.',
70
190
  model: {
71
191
  type: 'qcmGraphic',
72
192
  answers: [
73
193
  {
74
- title: 'Vrai',
75
- image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
194
+ title: 'La consolidation des acquis',
195
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_180530003-1618999931321.jpg',
196
+ selected: false,
197
+ ariaLabel: 'La consolidation des acquis',
198
+ onClick: noop
199
+ },
200
+ {
201
+ title: 'Le retour d’information',
202
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_1170951868-1618999931510.jpg',
203
+ selected: false,
204
+ ariaLabel: 'Le retour d’information',
205
+ onClick: noop
206
+ },
207
+ {
208
+ title: 'L’engagement actif',
209
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_439207960-1618999931642.jpg',
210
+ selected: false,
211
+ ariaLabel: 'L’engagement actif',
212
+ onClick: noop
213
+ },
214
+ {
215
+ title: 'La motivation',
216
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_538654849-1618999935091.jpg',
217
+ selected: false,
218
+ ariaLabel: 'La motivation',
219
+ onClick: noop
220
+ },
221
+ {
222
+ title: 'L’attention',
223
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_485162803-1618999941454.jpg',
224
+ selected: false,
225
+ ariaLabel: 'L’attention',
226
+ onClick: noop
227
+ },
228
+ {
229
+ title: 'La confiance en soi',
230
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_374136655-1619000050478.jpg',
231
+ selected: false,
232
+ ariaLabel: 'La confiance en soi',
233
+ onClick: noop
234
+ },
235
+ {
236
+ title: 'La capacité d’abstraction',
237
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_142530529-1618999997389.jpg',
76
238
  selected: false,
77
- onClick: noop,
78
- ariaLabel: 'Vrai'
239
+ ariaLabel: 'La capacité d’abstraction',
240
+ onClick: noop
79
241
  },
80
242
  {
81
- title: 'Faux',
82
- image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
243
+ title: 'L’abnégation',
244
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-science-et-vie/cockpit-science-et-vie/default/shutterstock_5948041-1618999993222.jpg',
83
245
  selected: false,
84
- onClick: noop,
85
- ariaLabel: 'Faux'
246
+ ariaLabel: 'L’abnégation',
247
+ onClick: noop
86
248
  }
87
249
  ]
88
250
  }