@coorpacademy/app-review 0.1.14 → 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.
Files changed (295) hide show
  1. package/es/actions/api/fetch-skills.d.ts +4 -6
  2. package/es/actions/api/fetch-skills.js +7 -4
  3. package/es/actions/api/fetch-slide.d.ts +14 -7
  4. package/es/actions/api/fetch-slide.js +27 -4
  5. package/es/actions/api/post-progression.d.ts +4 -6
  6. package/es/actions/api/post-progression.js +13 -9
  7. package/es/actions/api/test/create-test-store.d.ts +5 -0
  8. package/es/actions/api/test/create-test-store.js +16 -0
  9. package/es/actions/api/test/fetch-skills.test.js +54 -0
  10. package/es/actions/api/test/fetch-slide.test.js +61 -0
  11. package/es/actions/api/test/post-progression.test.js +102 -0
  12. package/es/actions/index.d.ts +1 -10
  13. package/es/actions/ui/answers.d.ts +7 -0
  14. package/es/actions/ui/answers.js +7 -0
  15. package/es/actions/ui/is-fetching.js +0 -2
  16. package/es/actions/ui/slides.d.ts +26 -0
  17. package/es/actions/ui/slides.js +9 -0
  18. package/es/common/index.d.ts +3 -1
  19. package/es/common/index.js +3 -1
  20. package/es/fixtures/qcm-slide.d.ts +2 -2
  21. package/es/fixtures/temp-fixture.d.ts +2 -2
  22. package/es/index.js +22 -92
  23. package/es/reducers/data/index.d.ts +2 -2
  24. package/es/reducers/data/progression.d.ts +3 -16
  25. package/es/reducers/data/progression.js +3 -22
  26. package/es/reducers/data/slides.d.ts +5 -6
  27. package/es/reducers/data/slides.js +9 -108
  28. package/es/reducers/data/test/progression.test.js +38 -0
  29. package/es/reducers/data/test/skills.test.js +12 -0
  30. package/es/reducers/data/test/slides.test.js +20 -0
  31. package/es/reducers/data/test/token.test.js +11 -0
  32. package/es/reducers/index.d.ts +3 -4
  33. package/es/reducers/ui/answers.d.ts +4 -0
  34. package/es/reducers/ui/{review-status.js → answers.js} +3 -3
  35. package/es/reducers/ui/current-slide-ref.d.ts +4 -0
  36. package/es/reducers/ui/current-slide-ref.js +13 -0
  37. package/es/reducers/ui/index.d.ts +7 -10
  38. package/es/reducers/ui/index.js +4 -6
  39. package/es/reducers/ui/test/answers.test.js +11 -0
  40. package/es/reducers/ui/test/current-slide-ref.test.d.ts +1 -0
  41. package/es/reducers/ui/test/current-slide-ref.test.js +12 -0
  42. package/es/reducers/ui/test/navigation.test.d.ts +1 -0
  43. package/es/reducers/ui/test/navigation.test.js +15 -0
  44. package/es/services/fetch-slide.js +1 -1
  45. package/es/services/index.js +3 -1
  46. package/es/services/post-answer.d.ts +2 -0
  47. package/es/services/post-answer.js +18 -0
  48. package/es/services/test/fetch-slide.test.d.ts +1 -0
  49. package/es/services/test/fetch-slide.test.js +22 -0
  50. package/es/services/test/post-answer.test.d.ts +1 -0
  51. package/es/services/test/post-answer.test.js +57 -0
  52. package/es/services/test/post-progression.test.js +14 -4
  53. package/es/test/util/services.mock.js +46 -4
  54. package/es/types/common.d.ts +61 -30
  55. package/es/types/common.js +0 -5
  56. package/es/types/slides.d.ts +0 -4
  57. package/{lib/types/views/skills.d.ts → es/views/skills/index.d.ts} +2 -0
  58. package/es/views/skills/index.js +25 -0
  59. package/es/views/slides/index.d.ts +79 -0
  60. package/es/views/slides/index.js +151 -0
  61. package/es/views/slides/map-api-slide-to-ui.d.ts +8 -0
  62. package/es/views/slides/map-api-slide-to-ui.js +172 -0
  63. package/es/views/slides/test/fixtures/free-text.d.ts +3 -0
  64. package/es/views/slides/test/fixtures/free-text.js +38 -0
  65. package/es/views/slides/test/fixtures/qcm-drag.d.ts +3 -0
  66. package/es/views/slides/test/fixtures/qcm-drag.js +108 -0
  67. package/es/views/slides/test/fixtures/qcm-graphic.d.ts +3 -0
  68. package/es/views/slides/test/fixtures/qcm-graphic.js +88 -0
  69. package/es/views/slides/test/fixtures/qcm.d.ts +3 -0
  70. package/es/{helpers → views/slides}/test/fixtures/qcm.js +37 -27
  71. package/es/views/slides/test/fixtures/select-template.d.ts +3 -0
  72. package/es/views/slides/test/fixtures/select-template.js +92 -0
  73. package/es/views/slides/test/fixtures/slider.d.ts +3 -0
  74. package/es/views/slides/test/fixtures/slider.js +36 -0
  75. package/es/views/slides/test/fixtures/text-template.d.ts +3 -0
  76. package/es/{helpers → views/slides}/test/fixtures/text-template.js +21 -11
  77. package/es/views/slides/test/map-api-slide-to-ui.test.d.ts +1 -0
  78. package/es/{helpers → views/slides}/test/map-api-slide-to-ui.test.js +19 -9
  79. package/lib/actions/api/fetch-skills.d.ts +4 -6
  80. package/lib/actions/api/fetch-skills.js +55 -7
  81. package/lib/actions/api/fetch-slide.d.ts +14 -7
  82. package/lib/actions/api/fetch-slide.js +75 -7
  83. package/lib/actions/api/post-progression.d.ts +4 -6
  84. package/lib/actions/api/post-progression.js +63 -10
  85. package/lib/actions/api/test/create-test-store.d.ts +5 -0
  86. package/lib/actions/api/test/create-test-store.js +18 -0
  87. package/lib/actions/api/test/fetch-skills.test.d.ts +1 -0
  88. package/lib/actions/api/test/fetch-skills.test.js +113 -0
  89. package/lib/actions/api/test/fetch-slide.test.d.ts +1 -0
  90. package/lib/actions/api/test/fetch-slide.test.js +120 -0
  91. package/lib/actions/api/test/post-progression.test.d.ts +1 -0
  92. package/lib/actions/api/test/post-progression.test.js +160 -0
  93. package/lib/actions/index.d.ts +1 -10
  94. package/lib/actions/ui/answers.d.ts +7 -0
  95. package/lib/actions/ui/answers.js +9 -0
  96. package/lib/actions/ui/is-fetching.js +0 -2
  97. package/lib/actions/ui/slides.d.ts +26 -0
  98. package/lib/actions/ui/slides.js +9 -0
  99. package/lib/common/index.d.ts +3 -1
  100. package/lib/common/index.js +3 -1
  101. package/lib/fixtures/qcm-slide.d.ts +2 -2
  102. package/lib/fixtures/temp-fixture.d.ts +2 -2
  103. package/lib/index.js +33 -94
  104. package/lib/reducers/data/index.d.ts +2 -2
  105. package/lib/reducers/data/progression.d.ts +3 -16
  106. package/lib/reducers/data/progression.js +3 -22
  107. package/lib/reducers/data/slides.d.ts +5 -6
  108. package/lib/reducers/data/slides.js +9 -114
  109. package/lib/reducers/data/test/progression.test.d.ts +1 -0
  110. package/lib/reducers/data/test/progression.test.js +38 -0
  111. package/lib/reducers/data/test/skills.test.d.ts +1 -0
  112. package/lib/reducers/data/test/skills.test.js +12 -0
  113. package/lib/reducers/data/test/slides.test.d.ts +1 -0
  114. package/lib/reducers/data/test/slides.test.js +20 -0
  115. package/lib/reducers/data/test/token.test.d.ts +1 -0
  116. package/lib/reducers/data/test/token.test.js +11 -0
  117. package/lib/reducers/index.d.ts +3 -4
  118. package/lib/reducers/ui/answers.d.ts +4 -0
  119. package/lib/reducers/ui/{review-status.js → answers.js} +3 -3
  120. package/lib/reducers/ui/current-slide-ref.d.ts +4 -0
  121. package/lib/reducers/ui/current-slide-ref.js +14 -0
  122. package/lib/reducers/ui/index.d.ts +7 -10
  123. package/lib/reducers/ui/index.js +4 -6
  124. package/lib/reducers/ui/test/answers.test.d.ts +1 -0
  125. package/lib/reducers/ui/test/answers.test.js +11 -0
  126. package/lib/reducers/ui/test/current-slide-ref.test.d.ts +1 -0
  127. package/lib/reducers/ui/test/current-slide-ref.test.js +12 -0
  128. package/lib/reducers/ui/test/navigation.test.d.ts +1 -0
  129. package/lib/reducers/ui/test/navigation.test.js +15 -0
  130. package/lib/services/fetch-slide.js +1 -1
  131. package/lib/services/index.js +3 -1
  132. package/lib/services/post-answer.d.ts +2 -0
  133. package/lib/services/post-answer.js +62 -0
  134. package/lib/services/test/fetch-slide.test.d.ts +1 -0
  135. package/lib/services/test/fetch-slide.test.js +76 -0
  136. package/lib/services/test/post-answer.test.d.ts +1 -0
  137. package/lib/services/test/post-answer.test.js +111 -0
  138. package/lib/services/test/post-progression.test.js +14 -4
  139. package/lib/test/util/services.mock.js +46 -4
  140. package/lib/types/common.d.ts +61 -30
  141. package/lib/types/common.js +0 -5
  142. package/lib/types/slides.d.ts +0 -4
  143. package/{es/types/views/skills.d.ts → lib/views/skills/index.d.ts} +2 -0
  144. package/lib/views/skills/index.js +25 -0
  145. package/lib/views/slides/index.d.ts +79 -0
  146. package/lib/views/slides/index.js +155 -0
  147. package/lib/views/slides/map-api-slide-to-ui.d.ts +8 -0
  148. package/lib/views/slides/map-api-slide-to-ui.js +178 -0
  149. package/lib/views/slides/test/fixtures/free-text.d.ts +3 -0
  150. package/lib/views/slides/test/fixtures/free-text.js +38 -0
  151. package/lib/views/slides/test/fixtures/qcm-drag.d.ts +3 -0
  152. package/lib/views/slides/test/fixtures/qcm-drag.js +108 -0
  153. package/lib/views/slides/test/fixtures/qcm-graphic.d.ts +3 -0
  154. package/lib/views/slides/test/fixtures/qcm-graphic.js +88 -0
  155. package/lib/views/slides/test/fixtures/qcm.d.ts +3 -0
  156. package/lib/{helpers → views/slides}/test/fixtures/qcm.js +37 -27
  157. package/lib/views/slides/test/fixtures/select-template.d.ts +3 -0
  158. package/lib/views/slides/test/fixtures/select-template.js +92 -0
  159. package/lib/views/slides/test/fixtures/slider.d.ts +3 -0
  160. package/lib/views/slides/test/fixtures/slider.js +36 -0
  161. package/lib/views/slides/test/fixtures/text-template.d.ts +3 -0
  162. package/lib/{helpers → views/slides}/test/fixtures/text-template.js +21 -11
  163. package/lib/views/slides/test/map-api-slide-to-ui.test.d.ts +1 -0
  164. package/lib/{helpers → views/slides}/test/map-api-slide-to-ui.test.js +19 -9
  165. package/package.json +4 -3
  166. package/src/actions/api/fetch-skills.ts +12 -12
  167. package/src/actions/api/fetch-slide.ts +38 -13
  168. package/src/actions/api/post-progression.ts +18 -22
  169. package/src/actions/api/test/create-test-store.ts +25 -0
  170. package/src/actions/api/test/fetch-skills.test.ts +70 -0
  171. package/src/actions/api/test/fetch-slide.test.ts +77 -0
  172. package/src/actions/api/test/post-progression.test.ts +119 -0
  173. package/src/actions/index.ts +1 -10
  174. package/src/actions/ui/answers.ts +16 -0
  175. package/src/actions/ui/is-fetching.ts +0 -6
  176. package/src/actions/ui/slides.ts +35 -0
  177. package/src/common/index.ts +7 -1
  178. package/src/fixtures/qcm-slide.ts +2 -2
  179. package/src/fixtures/temp-fixture.ts +2 -2
  180. package/src/index.tsx +26 -110
  181. package/src/reducers/data/index.ts +1 -1
  182. package/src/reducers/data/progression.ts +5 -40
  183. package/src/reducers/data/slides.ts +17 -125
  184. package/src/reducers/data/test/progression.test.ts +42 -0
  185. package/src/reducers/data/test/skills.test.ts +14 -0
  186. package/src/reducers/data/test/slides.test.ts +26 -0
  187. package/src/reducers/data/test/token.test.ts +13 -0
  188. package/src/reducers/ui/answers.ts +19 -0
  189. package/src/reducers/ui/current-slide-ref.ts +19 -0
  190. package/src/reducers/ui/index.ts +6 -9
  191. package/src/reducers/ui/test/answers.test.ts +13 -0
  192. package/src/reducers/ui/test/current-slide-ref.test.ts +14 -0
  193. package/src/reducers/ui/test/navigation.test.ts +19 -0
  194. package/src/services/fetch-slide.ts +1 -1
  195. package/src/services/index.ts +3 -1
  196. package/src/services/post-answer.ts +27 -0
  197. package/src/services/test/fetch-slide.test.ts +30 -0
  198. package/src/services/test/post-answer.test.ts +68 -0
  199. package/src/services/test/post-progression.test.ts +14 -4
  200. package/src/test/util/services.mock.ts +46 -4
  201. package/src/types/common.ts +77 -40
  202. package/src/types/slides.ts +0 -5
  203. package/src/views/skills/index.ts +56 -0
  204. package/src/views/slides/index.ts +251 -0
  205. package/src/views/slides/map-api-slide-to-ui.ts +251 -0
  206. package/src/views/slides/test/fixtures/free-text.ts +43 -0
  207. package/src/views/slides/test/fixtures/qcm-drag.ts +111 -0
  208. package/src/views/slides/test/fixtures/qcm-graphic.ts +94 -0
  209. package/src/{helpers → views/slides}/test/fixtures/qcm.ts +43 -33
  210. package/src/views/slides/test/fixtures/select-template.ts +98 -0
  211. package/src/views/slides/test/fixtures/slider.ts +41 -0
  212. package/src/{helpers → views/slides}/test/fixtures/text-template.ts +23 -14
  213. package/src/{helpers → views/slides}/test/map-api-slide-to-ui.test.ts +22 -20
  214. package/es/actions/data/slides.d.ts +0 -37
  215. package/es/actions/data/slides.js +0 -16
  216. package/es/actions/ui/finished-slides.d.ts +0 -10
  217. package/es/actions/ui/finished-slides.js +0 -8
  218. package/es/actions/ui/review-status.d.ts +0 -7
  219. package/es/actions/ui/review-status.js +0 -7
  220. package/es/actions/ui/step-items.d.ts +0 -24
  221. package/es/actions/ui/step-items.js +0 -11
  222. package/es/helpers/map-api-slide-to-ui.d.ts +0 -8
  223. package/es/helpers/map-api-slide-to-ui.js +0 -175
  224. package/es/helpers/test/fixtures/free-text.d.ts +0 -4
  225. package/es/helpers/test/fixtures/free-text.js +0 -24
  226. package/es/helpers/test/fixtures/qcm-drag.d.ts +0 -4
  227. package/es/helpers/test/fixtures/qcm-drag.js +0 -106
  228. package/es/helpers/test/fixtures/qcm-graphic.d.ts +0 -4
  229. package/es/helpers/test/fixtures/qcm-graphic.js +0 -70
  230. package/es/helpers/test/fixtures/qcm.d.ts +0 -4
  231. package/es/helpers/test/fixtures/select-template.d.ts +0 -4
  232. package/es/helpers/test/fixtures/select-template.js +0 -88
  233. package/es/helpers/test/fixtures/slider.d.ts +0 -4
  234. package/es/helpers/test/fixtures/slider.js +0 -27
  235. package/es/helpers/test/fixtures/text-template.d.ts +0 -4
  236. package/es/reducers/ui/finished-slides.d.ts +0 -7
  237. package/es/reducers/ui/finished-slides.js +0 -33
  238. package/es/reducers/ui/review-status.d.ts +0 -4
  239. package/es/reducers/ui/step-items.d.ts +0 -14
  240. package/es/reducers/ui/step-items.js +0 -74
  241. package/es/types/ui-progression.d.ts +0 -10
  242. package/es/types/views/slides.d.ts +0 -60
  243. package/lib/actions/data/slides.d.ts +0 -37
  244. package/lib/actions/data/slides.js +0 -16
  245. package/lib/actions/ui/finished-slides.d.ts +0 -10
  246. package/lib/actions/ui/finished-slides.js +0 -8
  247. package/lib/actions/ui/review-status.d.ts +0 -7
  248. package/lib/actions/ui/review-status.js +0 -7
  249. package/lib/actions/ui/step-items.d.ts +0 -24
  250. package/lib/actions/ui/step-items.js +0 -11
  251. package/lib/helpers/map-api-slide-to-ui.d.ts +0 -8
  252. package/lib/helpers/map-api-slide-to-ui.js +0 -181
  253. package/lib/helpers/test/fixtures/free-text.d.ts +0 -4
  254. package/lib/helpers/test/fixtures/free-text.js +0 -24
  255. package/lib/helpers/test/fixtures/qcm-drag.d.ts +0 -4
  256. package/lib/helpers/test/fixtures/qcm-drag.js +0 -106
  257. package/lib/helpers/test/fixtures/qcm-graphic.d.ts +0 -4
  258. package/lib/helpers/test/fixtures/qcm-graphic.js +0 -70
  259. package/lib/helpers/test/fixtures/qcm.d.ts +0 -4
  260. package/lib/helpers/test/fixtures/select-template.d.ts +0 -4
  261. package/lib/helpers/test/fixtures/select-template.js +0 -88
  262. package/lib/helpers/test/fixtures/slider.d.ts +0 -4
  263. package/lib/helpers/test/fixtures/slider.js +0 -27
  264. package/lib/helpers/test/fixtures/text-template.d.ts +0 -4
  265. package/lib/reducers/ui/finished-slides.d.ts +0 -7
  266. package/lib/reducers/ui/finished-slides.js +0 -45
  267. package/lib/reducers/ui/review-status.d.ts +0 -4
  268. package/lib/reducers/ui/step-items.d.ts +0 -14
  269. package/lib/reducers/ui/step-items.js +0 -86
  270. package/lib/types/ui-progression.d.ts +0 -10
  271. package/lib/types/views/slides.d.ts +0 -60
  272. package/src/actions/data/slides.ts +0 -65
  273. package/src/actions/ui/finished-slides.ts +0 -21
  274. package/src/actions/ui/review-status.ts +0 -19
  275. package/src/actions/ui/step-items.ts +0 -45
  276. package/src/helpers/map-api-slide-to-ui.ts +0 -253
  277. package/src/helpers/test/fixtures/free-text.ts +0 -28
  278. package/src/helpers/test/fixtures/qcm-drag.ts +0 -110
  279. package/src/helpers/test/fixtures/qcm-graphic.ts +0 -74
  280. package/src/helpers/test/fixtures/select-template.ts +0 -92
  281. package/src/helpers/test/fixtures/slider.ts +0 -31
  282. package/src/reducers/ui/finished-slides.ts +0 -52
  283. package/src/reducers/ui/review-status.ts +0 -19
  284. package/src/reducers/ui/step-items.ts +0 -116
  285. package/src/types/ui-progression.ts +0 -25
  286. package/src/types/views/skills.ts +0 -27
  287. package/src/types/views/slides.ts +0 -65
  288. /package/es/{helpers/test/map-api-slide-to-ui.test.d.ts → actions/api/test/fetch-skills.test.d.ts} +0 -0
  289. /package/es/{types/ui-progression.js → actions/api/test/fetch-slide.test.d.ts} +0 -0
  290. /package/es/{types/views/skills.js → actions/api/test/post-progression.test.d.ts} +0 -0
  291. /package/es/{types/views/slides.js → reducers/data/test/progression.test.d.ts} +0 -0
  292. /package/{lib/helpers/test/map-api-slide-to-ui.test.d.ts → es/reducers/data/test/skills.test.d.ts} +0 -0
  293. /package/{lib/types/ui-progression.js → es/reducers/data/test/slides.test.d.ts} +0 -0
  294. /package/{lib/types/views/skills.js → es/reducers/data/test/token.test.d.ts} +0 -0
  295. /package/{lib/types/views/slides.js → es/reducers/ui/test/answers.test.d.ts} +0 -0
@@ -0,0 +1,172 @@
1
+ import { concat, divide, get, getOr, head, includes, indexOf, isEmpty, map, rangeStep, size, toInteger } from 'lodash/fp';
2
+ import { editAnswer } from '../../actions/ui/answers';
3
+ const qcmProps = (question) => {
4
+ // TODO: EDIT_CHOICES -> getAnswerValues
5
+ const answers = [];
6
+ return {
7
+ type: 'qcm',
8
+ answers: map(choice => ({
9
+ title: choice.label,
10
+ selected: includes(choice.label, answers),
11
+ // TODO: EDIT_CHOICES
12
+ // eslint-disable-next-line no-console
13
+ onClick: () => console.log('TODO: on choice click'),
14
+ ariaLabel: choice.label
15
+ }),
16
+ // TODO: EDIT_CHOICES -> getChoices
17
+ question.content.choices)
18
+ };
19
+ };
20
+ const qcmDragProps = (question) => {
21
+ // TODO: EDIT_CHOICES -> getAnswerValues
22
+ const answers = [];
23
+ return {
24
+ type: 'qcmDrag',
25
+ answers: map(choice => {
26
+ const indexInAnswer = indexOf(choice.label, answers);
27
+ return {
28
+ title: choice.label,
29
+ selected: includes(choice.label, answers),
30
+ order: indexInAnswer,
31
+ // TODO: EDIT_CHOICES
32
+ // eslint-disable-next-line no-console
33
+ onClick: () => console.log('TODO: on choice click')
34
+ };
35
+ // TODO: EDIT_CHOICES -> getChoices
36
+ }, question.content.choices)
37
+ };
38
+ };
39
+ const qcmGraphicProps = (question) => {
40
+ // mock the answers
41
+ // TODO: EDIT_CHOICES -> getAnswerValues
42
+ const answers = [];
43
+ return {
44
+ type: 'qcmGraphic',
45
+ answers: map(choice => ({
46
+ title: choice.label,
47
+ image: get('media.src.0.url', choice),
48
+ selected: includes(choice.label, answers),
49
+ // TODO: EDIT_CHOICES
50
+ // eslint-disable-next-line no-console
51
+ onClick: () => console.log('TODO: on choice click')
52
+ }),
53
+ // TODO: EDIT_CHOICES -> getChoices
54
+ question.content.choices)
55
+ };
56
+ };
57
+ const templateTextProps = (choice, index) => {
58
+ // TODO: EDIT_CHOICES -> getAnswerValues
59
+ const answers = [];
60
+ return {
61
+ type: 'text',
62
+ name: getOr('', 'name', choice),
63
+ placeholder: 'Type here',
64
+ value: get(index, answers),
65
+ // TODO: EDIT_CHOICES
66
+ // eslint-disable-next-line no-console
67
+ onChange: () => console.log('TODO: on choice change')
68
+ };
69
+ };
70
+ const templateSelectProps = (choice, index) => {
71
+ // TODO: EDIT_CHOICES -> getAnswerValues
72
+ const answers = [];
73
+ const answer = get(index, answers);
74
+ const temporaryOption = {
75
+ name: 'Select an answer',
76
+ value: '',
77
+ validOption: false,
78
+ selected: true
79
+ };
80
+ const selectOptions = choice.items.map(item => {
81
+ const itemText = getOr('', 'text', item);
82
+ return {
83
+ name: itemText,
84
+ value: itemText,
85
+ validOption: true,
86
+ selected: itemText === answer
87
+ };
88
+ });
89
+ return {
90
+ type: 'select',
91
+ name: getOr('', 'name', choice),
92
+ // TODO: EDIT_CHOICES
93
+ // eslint-disable-next-line no-console
94
+ onChange: () => console.log('TODO: on choice change'),
95
+ options: isEmpty(answer) ? concat([temporaryOption], selectOptions) : selectOptions
96
+ };
97
+ };
98
+ const templateProps = (question) => {
99
+ // TODO: EDIT_CHOICES -> getChoices
100
+ const choices = question.content.choices;
101
+ return {
102
+ type: 'template',
103
+ template: get('content.template', question),
104
+ answers: choices.map((choice, index) => choice.type === 'text' ? templateTextProps(choice, index) : templateSelectProps(choice, index))
105
+ };
106
+ };
107
+ const basicProps = (dispatch) => (answers, question) => {
108
+ return {
109
+ type: 'freeText',
110
+ placeholder: question.content.placeholder || '',
111
+ value: answers[0] || '',
112
+ onChange: (text) => {
113
+ // eslint-disable-next-line no-console
114
+ console.log(text);
115
+ dispatch(editAnswer(text));
116
+ }
117
+ };
118
+ };
119
+ const sliderProps = (question) => {
120
+ const values = rangeStep(getOr(1, 'content.step', question), get('content.min', question), get('content.max', question) + 1
121
+ // Lodash doesn't infer the type very well here
122
+ );
123
+ // TODO: EDIT_CHOICES -> getAnswerValues
124
+ const answers = [];
125
+ const stateValue = head(answers) || question.content.min;
126
+ const currentValue = toInteger(stateValue);
127
+ const indexValue = indexOf(currentValue, values);
128
+ const sliderPosition = divide(indexValue, size(values) - 1);
129
+ const unitLabel = get('content.unitLabel', question);
130
+ return {
131
+ type: 'slider',
132
+ placeholder: question.explanation,
133
+ minLabel: `${question.content.min} ${unitLabel}`,
134
+ maxLabel: `${question.content.max} ${unitLabel}`,
135
+ title: `${currentValue} ${question.content.unitLabel}`,
136
+ value: sliderPosition,
137
+ // TODO: EDIT_CHOICES
138
+ // eslint-disable-next-line no-console
139
+ onChange: () => console.log('TODO: on choice change')
140
+ };
141
+ };
142
+ export const getQuestionType = (question) => question.type;
143
+ const getHelp = (slide) => get('question.explanation', slide);
144
+ const getAnswerUIModel = (question, answers, dispatch) => {
145
+ const type = getQuestionType(question);
146
+ switch (type) {
147
+ case 'qcm':
148
+ return qcmProps(question);
149
+ case 'qcmGraphic':
150
+ return qcmGraphicProps(question);
151
+ case 'qcmDrag':
152
+ return qcmDragProps(question);
153
+ case 'basic':
154
+ return basicProps(dispatch)(answers, question);
155
+ case 'template':
156
+ return templateProps(question);
157
+ case 'slider':
158
+ return sliderProps(question);
159
+ default:
160
+ throw new Error(`${type} is not an handled question.type`);
161
+ }
162
+ };
163
+ export const mapApiSlideToUi = (dispatch) => (slide, answers) => {
164
+ if (!slide) {
165
+ throw new Error('no slide was found');
166
+ }
167
+ const questionText = getOr('', 'question.header', slide);
168
+ return {
169
+ questionText,
170
+ answerUI: { model: getAnswerUIModel(slide.question, answers, dispatch), help: getHelp(slide) }
171
+ };
172
+ };
@@ -0,0 +1,3 @@
1
+ import { SlideFromAPI, UISlide } from '../../../../types/common';
2
+ export declare const freeTextSlide: SlideFromAPI;
3
+ export declare const freeTextUISlide: Partial<UISlide>;
@@ -0,0 +1,38 @@
1
+ import noop from 'lodash/fp/noop';
2
+ export const freeTextSlide = {
3
+ question: {
4
+ content: {
5
+ media: {
6
+ src: [],
7
+ posters: [],
8
+ subtitles: []
9
+ },
10
+ label: '',
11
+ placeholder: 'Type here',
12
+ id: 'sli_VJYjJnJhg.choice_1'
13
+ },
14
+ type: 'basic',
15
+ header: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?',
16
+ explanation: 'Type your answer.'
17
+ },
18
+ klf: 'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.',
19
+ tips: 'According to Insee, Paris salaries are 20-25% higher compared with those of the provinces in 2015.',
20
+ universalRef: 'sli_VJYjJnJhg',
21
+ id: 'sli_VJYjJnJhg',
22
+ parentContentTitle: {
23
+ title: 'Developing the review app',
24
+ type: 'course'
25
+ }
26
+ };
27
+ export const freeTextUISlide = {
28
+ answerUI: {
29
+ help: 'Type your answer.',
30
+ model: {
31
+ type: 'freeText',
32
+ placeholder: 'Type here',
33
+ value: '',
34
+ onChange: noop
35
+ }
36
+ },
37
+ questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
38
+ };
@@ -0,0 +1,3 @@
1
+ import { SlideFromAPI, UISlide } from '../../../../types/common';
2
+ export declare const qcmDragSlide: SlideFromAPI;
3
+ export declare const qcmDragUISlide: Partial<UISlide>;
@@ -0,0 +1,108 @@
1
+ import noop from 'lodash/fp/noop';
2
+ export const qcmDragSlide = {
3
+ question: {
4
+ content: {
5
+ media: {
6
+ src: [],
7
+ posters: [],
8
+ subtitles: []
9
+ },
10
+ choices: [
11
+ {
12
+ media: {
13
+ src: [],
14
+ posters: [],
15
+ subtitles: []
16
+ },
17
+ items: [],
18
+ _id: '624f01970a234b0333bc7ce8',
19
+ label: 'La démoralisation',
20
+ value: 'sli_4yGBq-mCg.choice_4kRL5uQCg',
21
+ id: '624f01970a234b0333bc7ce8'
22
+ },
23
+ {
24
+ media: {
25
+ src: [],
26
+ posters: [],
27
+ subtitles: []
28
+ },
29
+ items: [],
30
+ _id: '624f01970a234b0333bc7ce9',
31
+ label: 'La stagnation',
32
+ value: 'sli_4yGBq-mCg.choice_E11v9OXAx',
33
+ id: '624f01970a234b0333bc7ce9'
34
+ },
35
+ {
36
+ media: {
37
+ src: [],
38
+ posters: [],
39
+ subtitles: []
40
+ },
41
+ items: [],
42
+ _id: '624f01970a234b0333bc7cea',
43
+ label: 'La frustration',
44
+ value: 'sli_4yGBq-mCg.choice_N1lP9dmRg',
45
+ id: '624f01970a234b0333bc7cea'
46
+ },
47
+ {
48
+ media: {
49
+ src: [],
50
+ posters: [],
51
+ subtitles: []
52
+ },
53
+ items: [],
54
+ _id: '624f01970a234b0333bc7ceb',
55
+ label: "L'implication",
56
+ value: 'sli_4yGBq-mCg.choice_Eybw5dQCx',
57
+ id: '624f01970a234b0333bc7ceb'
58
+ }
59
+ ]
60
+ },
61
+ type: 'qcmDrag',
62
+ header: "Remettez dans l'ordre les quatre étapes du burn out.",
63
+ explanation: 'Sélectionnez les réponses ci-dessous dans le bon ordre.'
64
+ },
65
+ klf: "Le burn out s'installe en quatre étapes : tout d'abord, l'implication (investissement émotionnel et/ou affectif, sacrifice de sa vie privée) ; en second, la stagnation (premières déceptions, signes de fatigue) ; ensuite, la frustration (efforts non reconnus) ; et enfin, la démoralisation (problèmes de concentration, sentiment d'inutilité, désespoir).",
66
+ tips: "Encadré par la loi, l'entretien professionnel a pour but d'aider le collaborateur à verbaliser ses difficultés et à construire son projet professionnel.",
67
+ universalRef: 'sli_4yGBq-mCg',
68
+ id: 'sli_4yGBq-mCg',
69
+ parentContentTitle: {
70
+ title: 'Using redux',
71
+ type: 'chapter'
72
+ }
73
+ };
74
+ export const qcmDragUISlide = {
75
+ questionText: "Remettez dans l'ordre les quatre étapes du burn out.",
76
+ answerUI: {
77
+ help: 'Sélectionnez les réponses ci-dessous dans le bon ordre.',
78
+ model: {
79
+ type: 'qcmDrag',
80
+ answers: [
81
+ {
82
+ title: 'La démoralisation',
83
+ selected: false,
84
+ order: -1,
85
+ onClick: noop
86
+ },
87
+ {
88
+ title: 'La stagnation',
89
+ selected: false,
90
+ order: -1,
91
+ onClick: noop
92
+ },
93
+ {
94
+ title: 'La frustration',
95
+ selected: false,
96
+ order: -1,
97
+ onClick: noop
98
+ },
99
+ {
100
+ title: "L'implication",
101
+ selected: false,
102
+ order: -1,
103
+ onClick: noop
104
+ }
105
+ ]
106
+ }
107
+ }
108
+ };
@@ -0,0 +1,3 @@
1
+ import { SlideFromAPI, UISlide } from '../../../../types/common';
2
+ export declare const qcmGraphicSlide: SlideFromAPI;
3
+ export declare const qcmGraphicUISlide: Partial<UISlide>;
@@ -0,0 +1,88 @@
1
+ import noop from 'lodash/fp/noop';
2
+ export const qcmGraphicSlide = {
3
+ question: {
4
+ content: {
5
+ media: {
6
+ src: [],
7
+ posters: [],
8
+ subtitles: []
9
+ },
10
+ choices: [
11
+ {
12
+ media: {
13
+ src: [
14
+ {
15
+ _id: '624efd915948a7013083e986',
16
+ mimeType: 'image/jpeg',
17
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
18
+ id: '624efd915948a7013083e986'
19
+ }
20
+ ],
21
+ posters: [],
22
+ subtitles: [],
23
+ type: 'img'
24
+ },
25
+ items: [],
26
+ _id: '624efd915948a7013083e985',
27
+ label: 'Vrai',
28
+ value: 'sli_VkSQroQnx.choice_NJesyUo7nx',
29
+ id: '624efd915948a7013083e985'
30
+ },
31
+ {
32
+ media: {
33
+ src: [
34
+ {
35
+ _id: '624efd915948a7013083e988',
36
+ mimeType: 'image/jpeg',
37
+ url: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
38
+ id: '624efd915948a7013083e988'
39
+ }
40
+ ],
41
+ posters: [],
42
+ subtitles: [],
43
+ type: 'img'
44
+ },
45
+ items: [],
46
+ _id: '624efd915948a7013083e987',
47
+ label: 'Faux',
48
+ value: 'sli_VkSQroQnx.choice_VkgayLjX3e',
49
+ id: '624efd915948a7013083e987'
50
+ }
51
+ ]
52
+ },
53
+ 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.'
56
+ },
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.",
59
+ universalRef: 'sli_VkSQroQnx',
60
+ id: 'sli_VkSQroQnx',
61
+ parentContentTitle: {
62
+ title: 'Developing the review app',
63
+ type: 'course'
64
+ }
65
+ };
66
+ export const qcmGraphicUISlide = {
67
+ questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?',
68
+ answerUI: {
69
+ help: 'Sélectionnez la bonne réponse.',
70
+ model: {
71
+ type: 'qcmGraphic',
72
+ answers: [
73
+ {
74
+ title: 'Vrai',
75
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/true-1512554153232.jpg',
76
+ selected: false,
77
+ onClick: noop
78
+ },
79
+ {
80
+ title: 'Faux',
81
+ image: '//static.coorpacademy.com/content/CoorpAcademy/content-partnerships/cockpit-partner-au-feminin/default/false-1512554160848.jpg',
82
+ selected: false,
83
+ onClick: noop
84
+ }
85
+ ]
86
+ }
87
+ }
88
+ };
@@ -0,0 +1,3 @@
1
+ import { SlideFromAPI, UISlide } from '../../../../types/common';
2
+ export declare const qcmSlide: SlideFromAPI;
3
+ export declare const qcmUISlide: Partial<UISlide>;
@@ -66,34 +66,44 @@ export const qcmSlide = {
66
66
  tips: 'En 2021, le média en ligne Numerama a créé un NFT vendu aux enchères sur OpenSea. Sur cette plateforme, il est obligatoire de mettre un prix de réserve, autrement dit un prix minimum au-dessous duquel la vente ne sera pas automatiquement acceptée. Sur OpenSea il ne peut être inférieur à 1 ETH. Si le prix de réserve est atteint, pas de problème, les "gas fees" (les frais de gaz) sont couverts par OpenSea. Mais, si ce n’est pas le cas, c’est au vendeur de s’en acquitter. <br/>Le NFT en question est parti à 0,021 ETH, soit 40€ au cours de l\'époque, un prix inférieur au prix de réserve. Numerama a dû acquitter des frais de gaz, et payer 190 €. <br/>Avec les NFT, on ne gagne pas à tous les coups.',
67
67
  universalRef: 'sli_N1XACJobn',
68
68
  hasClue: true,
69
- id: 'sli_N1XACJobn'
69
+ id: 'sli_N1XACJobn',
70
+ parentContentTitle: {
71
+ title: 'Developing the review app',
72
+ type: 'course'
73
+ }
70
74
  };
71
75
  export const qcmUISlide = {
72
- type: 'qcm',
73
- answers: [
74
- {
75
- title: 'Le créateur peut fixer un pourcentage pour chaque transaction future',
76
- selected: false,
77
- onClick: noop,
78
- ariaLabel: 'Le créateur peut fixer un pourcentage pour chaque transaction future'
79
- },
80
- {
81
- title: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente",
82
- selected: false,
83
- onClick: noop,
84
- ariaLabel: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente"
85
- },
86
- {
87
- title: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT",
88
- selected: false,
89
- onClick: noop,
90
- ariaLabel: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT"
91
- },
92
- {
93
- title: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission",
94
- selected: false,
95
- onClick: noop,
96
- ariaLabel: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission"
76
+ questionText: "Après la vente d'un NFT, son créateur peut-il toucher de l'argent ?",
77
+ answerUI: {
78
+ help: 'Sélectionnez la bonne réponse.',
79
+ model: {
80
+ type: 'qcm',
81
+ answers: [
82
+ {
83
+ title: 'Le créateur peut fixer un pourcentage pour chaque transaction future',
84
+ selected: false,
85
+ onClick: noop,
86
+ ariaLabel: 'Le créateur peut fixer un pourcentage pour chaque transaction future'
87
+ },
88
+ {
89
+ title: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente",
90
+ selected: false,
91
+ onClick: noop,
92
+ ariaLabel: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente"
93
+ },
94
+ {
95
+ title: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT",
96
+ selected: false,
97
+ onClick: noop,
98
+ ariaLabel: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT"
99
+ },
100
+ {
101
+ title: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission",
102
+ selected: false,
103
+ onClick: noop,
104
+ ariaLabel: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission"
105
+ }
106
+ ]
97
107
  }
98
- ]
108
+ }
99
109
  };
@@ -0,0 +1,3 @@
1
+ import { SlideFromAPI, UISlide } from '../../../../types/common';
2
+ export declare const selectTemplateSlide: SlideFromAPI;
3
+ export declare const selectTemplateUISlide: Partial<UISlide>;
@@ -0,0 +1,92 @@
1
+ import noop from 'lodash/fp/noop';
2
+ export const selectTemplateSlide = {
3
+ question: {
4
+ content: {
5
+ template: 'La vue {{sel80495}} présente la liste des utilisateurs ayant le plus grand nombre d’étoiles cumulées.',
6
+ choices: [
7
+ {
8
+ items: [
9
+ {
10
+ _id: '5b57464e3b594d002e8829f7',
11
+ value: 'sli_N13-hG3kX.choice_NJgC3aznJm',
12
+ text: 'Catalogue'
13
+ },
14
+ {
15
+ _id: '5b57464e3b594d002e8829f6',
16
+ value: 'sli_N13-hG3kX.choice_EJZ02aMny7',
17
+ text: 'Leaderboard'
18
+ },
19
+ {
20
+ _id: '5b57464e3b594d002e8829f5',
21
+ value: 'sli_N13-hG3kX.choice_4keCaf21Q',
22
+ text: 'Activité'
23
+ },
24
+ {
25
+ _id: '5b57464e3b594d002e8829f4',
26
+ value: 'sli_N13-hG3kX.choice_NkbJAMn17',
27
+ text: 'Slides'
28
+ }
29
+ ],
30
+ _id: '5b57464e3b594d002e8829f3',
31
+ name: 'sel80495',
32
+ type: 'select'
33
+ }
34
+ ]
35
+ },
36
+ type: 'template',
37
+ header: 'Complétez la phrase ci-dessous.',
38
+ explanation: 'Saisissez votre réponse ou sélectionnez la bonne réponse dans le(s) menu(s) déroulant(s).'
39
+ },
40
+ klf: 'L’apprenant peut aussi évaluer sa performance grâce à un classement disponible sur la vue leaderboard. Elle compare sa position par rapport à celle des autres apprenants de la plateforme.',
41
+ tips: "La position d'un apprenant peut être aussi consultée depuis le header ou en-tête de la page. Elle se met à jour à chaque fois qu'un apprenant obtient des étoiles.",
42
+ universalRef: 'sli_N13-hG3kX',
43
+ id: 'sli_N13-hG3kX',
44
+ parentContentTitle: {
45
+ title: 'Developing the review app',
46
+ type: 'course'
47
+ }
48
+ };
49
+ export const selectTemplateUISlide = {
50
+ questionText: 'Complétez la phrase ci-dessous.',
51
+ answerUI: {
52
+ help: 'Saisissez votre réponse ou sélectionnez la bonne réponse dans le(s) menu(s) déroulant(s).',
53
+ model: {
54
+ type: 'template',
55
+ template: 'La vue {{sel80495}} présente la liste des utilisateurs ayant le plus grand nombre d’étoiles cumulées.',
56
+ answers: [
57
+ {
58
+ type: 'select',
59
+ name: 'sel80495',
60
+ onChange: noop,
61
+ options: [
62
+ { name: 'Select an answer', value: '', validOption: false, selected: true },
63
+ {
64
+ name: 'Catalogue',
65
+ value: 'Catalogue',
66
+ validOption: true,
67
+ selected: false
68
+ },
69
+ {
70
+ name: 'Leaderboard',
71
+ value: 'Leaderboard',
72
+ validOption: true,
73
+ selected: false
74
+ },
75
+ {
76
+ name: 'Activité',
77
+ value: 'Activité',
78
+ validOption: true,
79
+ selected: false
80
+ },
81
+ {
82
+ name: 'Slides',
83
+ value: 'Slides',
84
+ validOption: true,
85
+ selected: false
86
+ }
87
+ ]
88
+ }
89
+ ]
90
+ }
91
+ }
92
+ };
@@ -0,0 +1,3 @@
1
+ import { SlideFromAPI, UISlide } from '../../../../types/common';
2
+ export declare const sliderSlide: SlideFromAPI;
3
+ export declare const sliderUISlide: Partial<UISlide>;
@@ -0,0 +1,36 @@
1
+ import noop from 'lodash/fp/noop';
2
+ export const sliderSlide = {
3
+ question: {
4
+ content: {
5
+ min: 1,
6
+ max: 15,
7
+ unitLabel: 'an(s)'
8
+ },
9
+ type: 'slider',
10
+ header: 'En combien d’années la communauté de communes du Thouarsais est-elle passée de zéro à un tiers d’énergies renouvelables ?',
11
+ explanation: 'Déplacez le curseur.'
12
+ },
13
+ klf: 'Dans le cadre d’un projet local, la communauté de communes du Thouarsais, dans le Poitou (ouest de la France), a développé un parc diversifié d’énergies renouvelables : éolien, biomasse, solaire… En sept ans seulement, entre 2007 et 2014, la part d’énergies renouvelables est passée de zéro à un tiers !',
14
+ tips: 'En 2014, le Thouarsais a reçu la médaille de bronze du championnat européen des énergies renouvelables.',
15
+ universalRef: 'sli_VkAzsCLKb',
16
+ id: 'sli_VkAzsCLKb',
17
+ parentContentTitle: {
18
+ title: 'Developing the review app',
19
+ type: 'course'
20
+ }
21
+ };
22
+ export const sliderUISlide = {
23
+ questionText: 'En combien d’années la communauté de communes du Thouarsais est-elle passée de zéro à un tiers d’énergies renouvelables ?',
24
+ answerUI: {
25
+ help: 'Déplacez le curseur.',
26
+ model: {
27
+ type: 'slider',
28
+ placeholder: 'Déplacez le curseur.',
29
+ minLabel: '1 an(s)',
30
+ maxLabel: '15 an(s)',
31
+ title: '1 an(s)',
32
+ value: 0,
33
+ onChange: noop
34
+ }
35
+ }
36
+ };
@@ -0,0 +1,3 @@
1
+ import { SlideFromAPI, UISlide } from '../../../../types/common';
2
+ export declare const textTemplateSlide: SlideFromAPI;
3
+ export declare const textTemplateUISlide: Partial<UISlide>;