@coorpacademy/app-review 0.6.0 → 0.6.1-alpha.0

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 (379) hide show
  1. package/lib/actions/api/fetch-correction.js +25 -0
  2. package/lib/actions/api/fetch-rank.js +43 -0
  3. package/lib/actions/api/fetch-skills.js +23 -0
  4. package/lib/actions/api/fetch-slide.js +38 -0
  5. package/lib/actions/api/post-answer.js +43 -0
  6. package/lib/actions/api/post-progression.js +27 -0
  7. package/lib/actions/data/token.js +9 -0
  8. package/lib/actions/ui/answers.js +61 -0
  9. package/lib/actions/ui/navigation.js +31 -0
  10. package/lib/actions/ui/next-slide.js +28 -0
  11. package/lib/actions/ui/quit-popin.js +11 -0
  12. package/lib/actions/ui/slides.js +9 -0
  13. package/lib/common/index.js +17 -0
  14. package/lib/configure-store.js +27 -0
  15. package/lib/helpers/css-register.js +7 -0
  16. package/lib/index.js +101 -0
  17. package/lib/reducers/data/corrections.js +26 -0
  18. package/lib/reducers/data/index.js +13 -0
  19. package/lib/reducers/data/progression.js +18 -0
  20. package/lib/reducers/data/rank.js +32 -0
  21. package/lib/reducers/data/skills.js +13 -0
  22. package/lib/reducers/data/slides.js +25 -0
  23. package/lib/reducers/data/token.js +13 -0
  24. package/lib/reducers/index.js +12 -0
  25. package/lib/reducers/ui/answers.js +27 -0
  26. package/lib/reducers/ui/current-slide-ref.js +18 -0
  27. package/lib/reducers/ui/index.js +22 -0
  28. package/lib/reducers/ui/navigation.js +20 -0
  29. package/lib/reducers/ui/positions.js +32 -0
  30. package/lib/reducers/ui/quit-popin.js +18 -0
  31. package/lib/reducers/ui/show-congrats.js +22 -0
  32. package/lib/reducers/ui/slide.js +53 -0
  33. package/lib/services/fetch-correction.js +21 -0
  34. package/lib/services/fetch-rank.js +17 -0
  35. package/lib/services/fetch-skills.js +17 -0
  36. package/lib/services/fetch-slide.js +17 -0
  37. package/lib/services/fetch-slides-to-review-by-skill-ref.js +15 -0
  38. package/lib/services/index.js +20 -0
  39. package/lib/services/post-answer.js +27 -0
  40. package/lib/services/post-progression.js +28 -0
  41. package/lib/services/tools/fetch-responses.js +40 -0
  42. package/lib/services/tools/sleep.js +7 -0
  43. package/lib/types/common.js +2 -0
  44. package/lib/types/slides.js +2 -0
  45. package/lib/{src/views → views}/skills/index.js +8 -4
  46. package/lib/views/slides/index.js +325 -0
  47. package/lib/views/slides/map-api-slide-to-ui.js +177 -0
  48. package/package.json +5 -13
  49. package/es/sandbox/index.d.ts +0 -9
  50. package/es/sandbox/index.js +0 -41
  51. package/es/src/actions/test/create-test-store.d.ts +0 -5
  52. package/es/src/actions/test/create-test-store.js +0 -16
  53. package/es/src/test/index.test.d.ts +0 -1
  54. package/es/src/test/index.test.js +0 -66
  55. package/es/src/test/util/services.mock.d.ts +0 -7
  56. package/es/src/test/util/services.mock.js +0 -444
  57. package/es/src/views/slides/test/fixtures/free-text.d.ts +0 -4
  58. package/es/src/views/slides/test/fixtures/free-text.js +0 -38
  59. package/es/src/views/slides/test/fixtures/qcm-drag.d.ts +0 -4
  60. package/es/src/views/slides/test/fixtures/qcm-drag.js +0 -108
  61. package/es/src/views/slides/test/fixtures/qcm-graphic.d.ts +0 -4
  62. package/es/src/views/slides/test/fixtures/qcm-graphic.js +0 -252
  63. package/es/src/views/slides/test/fixtures/qcm.d.ts +0 -4
  64. package/es/src/views/slides/test/fixtures/qcm.js +0 -109
  65. package/es/src/views/slides/test/fixtures/slider.d.ts +0 -4
  66. package/es/src/views/slides/test/fixtures/slider.js +0 -37
  67. package/es/src/views/slides/test/fixtures/template.d.ts +0 -4
  68. package/es/src/views/slides/test/fixtures/template.js +0 -170
  69. package/lib/sandbox/index.d.ts +0 -9
  70. package/lib/sandbox/index.js +0 -43
  71. package/lib/src/actions/api/fetch-correction.js +0 -19
  72. package/lib/src/actions/api/fetch-rank.js +0 -38
  73. package/lib/src/actions/api/fetch-skills.js +0 -17
  74. package/lib/src/actions/api/fetch-slide.js +0 -81
  75. package/lib/src/actions/api/post-answer.js +0 -92
  76. package/lib/src/actions/api/post-progression.js +0 -72
  77. package/lib/src/actions/data/token.js +0 -5
  78. package/lib/src/actions/test/create-test-store.d.ts +0 -5
  79. package/lib/src/actions/test/create-test-store.js +0 -18
  80. package/lib/src/actions/ui/answers.js +0 -65
  81. package/lib/src/actions/ui/navigation.js +0 -86
  82. package/lib/src/actions/ui/next-slide.js +0 -21
  83. package/lib/src/actions/ui/quit-popin.js +0 -8
  84. package/lib/src/actions/ui/slides.js +0 -5
  85. package/lib/src/common/index.js +0 -10
  86. package/lib/src/configure-store.js +0 -21
  87. package/lib/src/helpers/css-register.js +0 -2
  88. package/lib/src/index.js +0 -86
  89. package/lib/src/reducers/data/corrections.js +0 -22
  90. package/lib/src/reducers/data/index.js +0 -8
  91. package/lib/src/reducers/data/progression.js +0 -17
  92. package/lib/src/reducers/data/rank.js +0 -28
  93. package/lib/src/reducers/data/skills.js +0 -12
  94. package/lib/src/reducers/data/slides.js +0 -20
  95. package/lib/src/reducers/data/token.js +0 -12
  96. package/lib/src/reducers/index.js +0 -7
  97. package/lib/src/reducers/ui/answers.js +0 -25
  98. package/lib/src/reducers/ui/current-slide-ref.js +0 -17
  99. package/lib/src/reducers/ui/index.js +0 -17
  100. package/lib/src/reducers/ui/navigation.js +0 -28
  101. package/lib/src/reducers/ui/positions.js +0 -28
  102. package/lib/src/reducers/ui/quit-popin.js +0 -17
  103. package/lib/src/reducers/ui/show-congrats.js +0 -21
  104. package/lib/src/reducers/ui/slide.js +0 -48
  105. package/lib/src/services/fetch-correction.js +0 -58
  106. package/lib/src/services/fetch-rank.js +0 -54
  107. package/lib/src/services/fetch-skills.js +0 -54
  108. package/lib/src/services/fetch-slide.js +0 -54
  109. package/lib/src/services/fetch-slides-to-review-by-skill-ref.js +0 -52
  110. package/lib/src/services/index.js +0 -16
  111. package/lib/src/services/post-answer.js +0 -64
  112. package/lib/src/services/post-progression.js +0 -65
  113. package/lib/src/services/tools/fetch-responses.js +0 -112
  114. package/lib/src/services/tools/sleep.js +0 -5
  115. package/lib/src/test/index.test.d.ts +0 -1
  116. package/lib/src/test/index.test.js +0 -170
  117. package/lib/src/test/util/services.mock.d.ts +0 -7
  118. package/lib/src/test/util/services.mock.js +0 -448
  119. package/lib/src/types/common.js +0 -1
  120. package/lib/src/types/slides.js +0 -1
  121. package/lib/src/views/slides/index.js +0 -315
  122. package/lib/src/views/slides/map-api-slide-to-ui.js +0 -188
  123. package/lib/src/views/slides/test/fixtures/free-text.d.ts +0 -4
  124. package/lib/src/views/slides/test/fixtures/free-text.js +0 -38
  125. package/lib/src/views/slides/test/fixtures/qcm-drag.d.ts +0 -4
  126. package/lib/src/views/slides/test/fixtures/qcm-drag.js +0 -108
  127. package/lib/src/views/slides/test/fixtures/qcm-graphic.d.ts +0 -4
  128. package/lib/src/views/slides/test/fixtures/qcm-graphic.js +0 -252
  129. package/lib/src/views/slides/test/fixtures/qcm.d.ts +0 -4
  130. package/lib/src/views/slides/test/fixtures/qcm.js +0 -109
  131. package/lib/src/views/slides/test/fixtures/slider.d.ts +0 -4
  132. package/lib/src/views/slides/test/fixtures/slider.js +0 -37
  133. package/lib/src/views/slides/test/fixtures/template.d.ts +0 -4
  134. package/lib/src/views/slides/test/fixtures/template.js +0 -170
  135. package/src/actions/api/fetch-correction.ts +0 -39
  136. package/src/actions/api/fetch-rank.ts +0 -91
  137. package/src/actions/api/fetch-skills.ts +0 -31
  138. package/src/actions/api/fetch-slide.ts +0 -54
  139. package/src/actions/api/post-answer.ts +0 -55
  140. package/src/actions/api/post-progression.ts +0 -37
  141. package/src/actions/api/test/fetch-correction.test.ts +0 -119
  142. package/src/actions/api/test/fetch-rank.test.ts +0 -138
  143. package/src/actions/api/test/fetch-skills.test.ts +0 -78
  144. package/src/actions/api/test/fetch-slide.test.ts +0 -85
  145. package/src/actions/api/test/post-answer.test.ts +0 -266
  146. package/src/actions/api/test/post-progression.test.ts +0 -127
  147. package/src/actions/data/test/token.test.ts +0 -32
  148. package/src/actions/data/token.ts +0 -11
  149. package/src/actions/test/create-test-store.ts +0 -25
  150. package/src/actions/ui/answers.ts +0 -77
  151. package/src/actions/ui/navigation.ts +0 -62
  152. package/src/actions/ui/next-slide.ts +0 -44
  153. package/src/actions/ui/quit-popin.ts +0 -10
  154. package/src/actions/ui/slides.ts +0 -26
  155. package/src/actions/ui/test/answers.test.ts +0 -174
  156. package/src/actions/ui/test/navigation.test.ts +0 -95
  157. package/src/actions/ui/test/next-slide.test.ts +0 -87
  158. package/src/actions/ui/test/quit-popin.test.ts +0 -39
  159. package/src/actions/ui/test/slides.test.ts +0 -33
  160. package/src/common/index.ts +0 -15
  161. package/src/common/test/get-progression-slide-ref.test.ts +0 -35
  162. package/src/configure-store.ts +0 -28
  163. package/src/helpers/css-modules-require-hook.d.ts +0 -4
  164. package/src/helpers/css-register.ts +0 -3
  165. package/src/index.tsx +0 -107
  166. package/src/reducers/data/corrections.ts +0 -36
  167. package/src/reducers/data/index.ts +0 -19
  168. package/src/reducers/data/progression.ts +0 -23
  169. package/src/reducers/data/rank.ts +0 -44
  170. package/src/reducers/data/skills.ts +0 -16
  171. package/src/reducers/data/slides.ts +0 -31
  172. package/src/reducers/data/test/corrections.test.ts +0 -36
  173. package/src/reducers/data/test/progression.test.ts +0 -28
  174. package/src/reducers/data/test/rank.test.ts +0 -59
  175. package/src/reducers/data/test/skills.test.ts +0 -14
  176. package/src/reducers/data/test/slides.test.ts +0 -27
  177. package/src/reducers/data/test/token.test.ts +0 -13
  178. package/src/reducers/data/token.ts +0 -15
  179. package/src/reducers/index.ts +0 -14
  180. package/src/reducers/ui/answers.ts +0 -41
  181. package/src/reducers/ui/current-slide-ref.ts +0 -22
  182. package/src/reducers/ui/index.ts +0 -29
  183. package/src/reducers/ui/navigation.ts +0 -29
  184. package/src/reducers/ui/positions.ts +0 -34
  185. package/src/reducers/ui/quit-popin.ts +0 -22
  186. package/src/reducers/ui/show-congrats.ts +0 -26
  187. package/src/reducers/ui/slide.ts +0 -87
  188. package/src/reducers/ui/test/answers.test.ts +0 -105
  189. package/src/reducers/ui/test/current-slide-ref.test.ts +0 -14
  190. package/src/reducers/ui/test/navigation.test.ts +0 -19
  191. package/src/reducers/ui/test/positions.test.ts +0 -82
  192. package/src/reducers/ui/test/quit-popin.test.ts +0 -24
  193. package/src/reducers/ui/test/show-congrats.test.ts +0 -40
  194. package/src/reducers/ui/test/slide.test.ts +0 -110
  195. package/src/services/fetch-correction.ts +0 -26
  196. package/src/services/fetch-rank.ts +0 -14
  197. package/src/services/fetch-skills.ts +0 -14
  198. package/src/services/fetch-slide.ts +0 -14
  199. package/src/services/fetch-slides-to-review-by-skill-ref.ts +0 -18
  200. package/src/services/index.ts +0 -18
  201. package/src/services/post-answer.ts +0 -28
  202. package/src/services/post-progression.ts +0 -28
  203. package/src/services/test/fetch-correction.test.ts +0 -55
  204. package/src/services/test/fetch-rank.test.ts +0 -34
  205. package/src/services/test/fetch-skills.test.ts +0 -39
  206. package/src/services/test/fetch-slide.test.ts +0 -30
  207. package/src/services/test/fetch-slides-to-review-by-skill-ref.test.ts +0 -51
  208. package/src/services/test/post-answer.test.ts +0 -100
  209. package/src/services/test/post-progression.test.ts +0 -66
  210. package/src/services/tools/fetch-responses.ts +0 -40
  211. package/src/services/tools/sleep.ts +0 -4
  212. package/src/test/index.test.tsx +0 -99
  213. package/src/test/util/services.mock.ts +0 -465
  214. package/src/types/common.ts +0 -207
  215. package/src/types/globals.d.ts +0 -4
  216. package/src/types/slides.ts +0 -98
  217. package/src/views/skills/index.ts +0 -48
  218. package/src/views/skills/test/skills.test.ts +0 -104
  219. package/src/views/slides/index.ts +0 -398
  220. package/src/views/slides/map-api-slide-to-ui.ts +0 -287
  221. package/src/views/slides/test/fixtures/free-text.ts +0 -44
  222. package/src/views/slides/test/fixtures/qcm-drag.ts +0 -112
  223. package/src/views/slides/test/fixtures/qcm-graphic.ts +0 -264
  224. package/src/views/slides/test/fixtures/qcm.ts +0 -120
  225. package/src/views/slides/test/fixtures/slider.ts +0 -43
  226. package/src/views/slides/test/fixtures/template.ts +0 -177
  227. package/src/views/slides/test/header.on-click.test.ts +0 -46
  228. package/src/views/slides/test/index.test.ts +0 -1515
  229. package/src/views/slides/test/map-api-slide-to-ui.test.ts +0 -52
  230. package/src/views/slides/test/on-quit-popin.on-click.test.ts +0 -66
  231. package/src/views/slides/test/slide.free-text.on-change.test.ts +0 -116
  232. package/src/views/slides/test/slide.next-slide.on-click.test.ts +0 -178
  233. package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +0 -90
  234. package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +0 -90
  235. package/src/views/slides/test/slide.qcm.on-click.test.ts +0 -92
  236. package/src/views/slides/test/slide.slider.on-change.test.ts +0 -92
  237. package/src/views/slides/test/slide.slider.on-slider-change.test.ts +0 -91
  238. package/src/views/slides/test/slide.template.on-change.test.ts +0 -126
  239. /package/es/{src/actions → actions}/api/fetch-correction.d.ts +0 -0
  240. /package/es/{src/actions → actions}/api/fetch-correction.js +0 -0
  241. /package/es/{src/actions → actions}/api/fetch-rank.d.ts +0 -0
  242. /package/es/{src/actions → actions}/api/fetch-rank.js +0 -0
  243. /package/es/{src/actions → actions}/api/fetch-skills.d.ts +0 -0
  244. /package/es/{src/actions → actions}/api/fetch-skills.js +0 -0
  245. /package/es/{src/actions → actions}/api/fetch-slide.d.ts +0 -0
  246. /package/es/{src/actions → actions}/api/fetch-slide.js +0 -0
  247. /package/es/{src/actions → actions}/api/post-answer.d.ts +0 -0
  248. /package/es/{src/actions → actions}/api/post-answer.js +0 -0
  249. /package/es/{src/actions → actions}/api/post-progression.d.ts +0 -0
  250. /package/es/{src/actions → actions}/api/post-progression.js +0 -0
  251. /package/es/{src/actions → actions}/data/token.d.ts +0 -0
  252. /package/es/{src/actions → actions}/data/token.js +0 -0
  253. /package/es/{src/actions → actions}/ui/answers.d.ts +0 -0
  254. /package/es/{src/actions → actions}/ui/answers.js +0 -0
  255. /package/es/{src/actions → actions}/ui/navigation.d.ts +0 -0
  256. /package/es/{src/actions → actions}/ui/navigation.js +0 -0
  257. /package/es/{src/actions → actions}/ui/next-slide.d.ts +0 -0
  258. /package/es/{src/actions → actions}/ui/next-slide.js +0 -0
  259. /package/es/{src/actions → actions}/ui/quit-popin.d.ts +0 -0
  260. /package/es/{src/actions → actions}/ui/quit-popin.js +0 -0
  261. /package/es/{src/actions → actions}/ui/slides.d.ts +0 -0
  262. /package/es/{src/actions → actions}/ui/slides.js +0 -0
  263. /package/es/{src/common → common}/index.d.ts +0 -0
  264. /package/es/{src/common → common}/index.js +0 -0
  265. /package/es/{src/configure-store.d.ts → configure-store.d.ts} +0 -0
  266. /package/es/{src/configure-store.js → configure-store.js} +0 -0
  267. /package/es/{src/helpers → helpers}/css-register.d.ts +0 -0
  268. /package/es/{src/helpers → helpers}/css-register.js +0 -0
  269. /package/es/{src/index.d.ts → index.d.ts} +0 -0
  270. /package/es/{src/index.js → index.js} +0 -0
  271. /package/es/{src/reducers → reducers}/data/corrections.d.ts +0 -0
  272. /package/es/{src/reducers → reducers}/data/corrections.js +0 -0
  273. /package/es/{src/reducers → reducers}/data/index.d.ts +0 -0
  274. /package/es/{src/reducers → reducers}/data/index.js +0 -0
  275. /package/es/{src/reducers → reducers}/data/progression.d.ts +0 -0
  276. /package/es/{src/reducers → reducers}/data/progression.js +0 -0
  277. /package/es/{src/reducers → reducers}/data/rank.d.ts +0 -0
  278. /package/es/{src/reducers → reducers}/data/rank.js +0 -0
  279. /package/es/{src/reducers → reducers}/data/skills.d.ts +0 -0
  280. /package/es/{src/reducers → reducers}/data/skills.js +0 -0
  281. /package/es/{src/reducers → reducers}/data/slides.d.ts +0 -0
  282. /package/es/{src/reducers → reducers}/data/slides.js +0 -0
  283. /package/es/{src/reducers → reducers}/data/token.d.ts +0 -0
  284. /package/es/{src/reducers → reducers}/data/token.js +0 -0
  285. /package/es/{src/reducers → reducers}/index.d.ts +0 -0
  286. /package/es/{src/reducers → reducers}/index.js +0 -0
  287. /package/es/{src/reducers → reducers}/ui/answers.d.ts +0 -0
  288. /package/es/{src/reducers → reducers}/ui/answers.js +0 -0
  289. /package/es/{src/reducers → reducers}/ui/current-slide-ref.d.ts +0 -0
  290. /package/es/{src/reducers → reducers}/ui/current-slide-ref.js +0 -0
  291. /package/es/{src/reducers → reducers}/ui/index.d.ts +0 -0
  292. /package/es/{src/reducers → reducers}/ui/index.js +0 -0
  293. /package/es/{src/reducers → reducers}/ui/navigation.d.ts +0 -0
  294. /package/es/{src/reducers → reducers}/ui/navigation.js +0 -0
  295. /package/es/{src/reducers → reducers}/ui/positions.d.ts +0 -0
  296. /package/es/{src/reducers → reducers}/ui/positions.js +0 -0
  297. /package/es/{src/reducers → reducers}/ui/quit-popin.d.ts +0 -0
  298. /package/es/{src/reducers → reducers}/ui/quit-popin.js +0 -0
  299. /package/es/{src/reducers → reducers}/ui/show-congrats.d.ts +0 -0
  300. /package/es/{src/reducers → reducers}/ui/show-congrats.js +0 -0
  301. /package/es/{src/reducers → reducers}/ui/slide.d.ts +0 -0
  302. /package/es/{src/reducers → reducers}/ui/slide.js +0 -0
  303. /package/es/{src/services → services}/fetch-correction.d.ts +0 -0
  304. /package/es/{src/services → services}/fetch-correction.js +0 -0
  305. /package/es/{src/services → services}/fetch-rank.d.ts +0 -0
  306. /package/es/{src/services → services}/fetch-rank.js +0 -0
  307. /package/es/{src/services → services}/fetch-skills.d.ts +0 -0
  308. /package/es/{src/services → services}/fetch-skills.js +0 -0
  309. /package/es/{src/services → services}/fetch-slide.d.ts +0 -0
  310. /package/es/{src/services → services}/fetch-slide.js +0 -0
  311. /package/es/{src/services → services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
  312. /package/es/{src/services → services}/fetch-slides-to-review-by-skill-ref.js +0 -0
  313. /package/es/{src/services → services}/index.d.ts +0 -0
  314. /package/es/{src/services → services}/index.js +0 -0
  315. /package/es/{src/services → services}/post-answer.d.ts +0 -0
  316. /package/es/{src/services → services}/post-answer.js +0 -0
  317. /package/es/{src/services → services}/post-progression.d.ts +0 -0
  318. /package/es/{src/services → services}/post-progression.js +0 -0
  319. /package/es/{src/services → services}/tools/fetch-responses.d.ts +0 -0
  320. /package/es/{src/services → services}/tools/fetch-responses.js +0 -0
  321. /package/es/{src/services → services}/tools/sleep.d.ts +0 -0
  322. /package/es/{src/services → services}/tools/sleep.js +0 -0
  323. /package/es/{src/types → types}/common.d.ts +0 -0
  324. /package/es/{src/types → types}/common.js +0 -0
  325. /package/es/{src/types → types}/slides.d.ts +0 -0
  326. /package/es/{src/types → types}/slides.js +0 -0
  327. /package/es/{src/views → views}/skills/index.d.ts +0 -0
  328. /package/es/{src/views → views}/skills/index.js +0 -0
  329. /package/es/{src/views → views}/slides/index.d.ts +0 -0
  330. /package/es/{src/views → views}/slides/index.js +0 -0
  331. /package/es/{src/views → views}/slides/map-api-slide-to-ui.d.ts +0 -0
  332. /package/es/{src/views → views}/slides/map-api-slide-to-ui.js +0 -0
  333. /package/lib/{src/actions → actions}/api/fetch-correction.d.ts +0 -0
  334. /package/lib/{src/actions → actions}/api/fetch-rank.d.ts +0 -0
  335. /package/lib/{src/actions → actions}/api/fetch-skills.d.ts +0 -0
  336. /package/lib/{src/actions → actions}/api/fetch-slide.d.ts +0 -0
  337. /package/lib/{src/actions → actions}/api/post-answer.d.ts +0 -0
  338. /package/lib/{src/actions → actions}/api/post-progression.d.ts +0 -0
  339. /package/lib/{src/actions → actions}/data/token.d.ts +0 -0
  340. /package/lib/{src/actions → actions}/ui/answers.d.ts +0 -0
  341. /package/lib/{src/actions → actions}/ui/navigation.d.ts +0 -0
  342. /package/lib/{src/actions → actions}/ui/next-slide.d.ts +0 -0
  343. /package/lib/{src/actions → actions}/ui/quit-popin.d.ts +0 -0
  344. /package/lib/{src/actions → actions}/ui/slides.d.ts +0 -0
  345. /package/lib/{src/common → common}/index.d.ts +0 -0
  346. /package/lib/{src/configure-store.d.ts → configure-store.d.ts} +0 -0
  347. /package/lib/{src/helpers → helpers}/css-register.d.ts +0 -0
  348. /package/lib/{src/index.d.ts → index.d.ts} +0 -0
  349. /package/lib/{src/reducers → reducers}/data/corrections.d.ts +0 -0
  350. /package/lib/{src/reducers → reducers}/data/index.d.ts +0 -0
  351. /package/lib/{src/reducers → reducers}/data/progression.d.ts +0 -0
  352. /package/lib/{src/reducers → reducers}/data/rank.d.ts +0 -0
  353. /package/lib/{src/reducers → reducers}/data/skills.d.ts +0 -0
  354. /package/lib/{src/reducers → reducers}/data/slides.d.ts +0 -0
  355. /package/lib/{src/reducers → reducers}/data/token.d.ts +0 -0
  356. /package/lib/{src/reducers → reducers}/index.d.ts +0 -0
  357. /package/lib/{src/reducers → reducers}/ui/answers.d.ts +0 -0
  358. /package/lib/{src/reducers → reducers}/ui/current-slide-ref.d.ts +0 -0
  359. /package/lib/{src/reducers → reducers}/ui/index.d.ts +0 -0
  360. /package/lib/{src/reducers → reducers}/ui/navigation.d.ts +0 -0
  361. /package/lib/{src/reducers → reducers}/ui/positions.d.ts +0 -0
  362. /package/lib/{src/reducers → reducers}/ui/quit-popin.d.ts +0 -0
  363. /package/lib/{src/reducers → reducers}/ui/show-congrats.d.ts +0 -0
  364. /package/lib/{src/reducers → reducers}/ui/slide.d.ts +0 -0
  365. /package/lib/{src/services → services}/fetch-correction.d.ts +0 -0
  366. /package/lib/{src/services → services}/fetch-rank.d.ts +0 -0
  367. /package/lib/{src/services → services}/fetch-skills.d.ts +0 -0
  368. /package/lib/{src/services → services}/fetch-slide.d.ts +0 -0
  369. /package/lib/{src/services → services}/fetch-slides-to-review-by-skill-ref.d.ts +0 -0
  370. /package/lib/{src/services → services}/index.d.ts +0 -0
  371. /package/lib/{src/services → services}/post-answer.d.ts +0 -0
  372. /package/lib/{src/services → services}/post-progression.d.ts +0 -0
  373. /package/lib/{src/services → services}/tools/fetch-responses.d.ts +0 -0
  374. /package/lib/{src/services → services}/tools/sleep.d.ts +0 -0
  375. /package/lib/{src/types → types}/common.d.ts +0 -0
  376. /package/lib/{src/types → types}/slides.d.ts +0 -0
  377. /package/lib/{src/views → views}/skills/index.d.ts +0 -0
  378. /package/lib/{src/views → views}/slides/index.d.ts +0 -0
  379. /package/lib/{src/views → views}/slides/map-api-slide-to-ui.d.ts +0 -0
@@ -0,0 +1,325 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mapStateToSlidesProps = exports.buildStepItems = exports.initialState = void 0;
7
+ const findLast_1 = __importDefault(require("lodash/fp/findLast"));
8
+ const get_1 = __importDefault(require("lodash/fp/get"));
9
+ const getOr_1 = __importDefault(require("lodash/fp/getOr"));
10
+ const last_1 = __importDefault(require("lodash/fp/last"));
11
+ const reduce_1 = __importDefault(require("lodash/fp/reduce"));
12
+ const set_1 = __importDefault(require("lodash/fp/set"));
13
+ const toInteger_1 = __importDefault(require("lodash/fp/toInteger"));
14
+ const join_1 = __importDefault(require("lodash/fp/join"));
15
+ const quit_popin_1 = require("../../actions/ui/quit-popin");
16
+ const common_1 = require("../../common");
17
+ const post_answer_1 = require("../../actions/api/post-answer");
18
+ const next_slide_1 = require("../../actions/ui/next-slide");
19
+ const map_api_slide_to_ui_1 = require("./map-api-slide-to-ui");
20
+ const ICON_VALUES = {
21
+ right: 'right',
22
+ wrong: 'wrong',
23
+ 'no-answer': 'no-answer'
24
+ };
25
+ const confettiAnimation = {
26
+ 'aria-label': 'aria lottie',
27
+ 'data-name': 'default-lottie',
28
+ className: undefined,
29
+ animationSrc: 'https://static-staging.coorpacademy.com/animations/review/confetti.json',
30
+ loop: undefined,
31
+ autoplay: true,
32
+ rendererSettings: {
33
+ hideOnTransparent: false
34
+ },
35
+ ie11ImageBackup: 'https://static-staging.coorpacademy.com/animations/review/conffeti_congrats.svg'
36
+ };
37
+ exports.initialState = {
38
+ '0': {
39
+ position: 0,
40
+ loading: true
41
+ },
42
+ '1': {
43
+ position: 1,
44
+ loading: true
45
+ },
46
+ '2': {
47
+ position: 2,
48
+ loading: true
49
+ },
50
+ '3': {
51
+ position: 3,
52
+ loading: true
53
+ },
54
+ '4': {
55
+ position: 4,
56
+ loading: true
57
+ }
58
+ };
59
+ const getCurrentSlideRef = (state) => {
60
+ const currentSlideRef = (0, get_1.default)(['ui', 'currentSlideRef'], state);
61
+ const endReview = currentSlideRef === 'successExitNode';
62
+ if (!endReview)
63
+ return currentSlideRef;
64
+ const progression = state.data.progression;
65
+ const content = progression.state.content;
66
+ return content.ref;
67
+ };
68
+ const buildStackSlides = (state, dispatch) => {
69
+ const currentSlideRef = getCurrentSlideRef(state);
70
+ const progression = state.data.progression;
71
+ if (!currentSlideRef || !progression)
72
+ return exports.initialState;
73
+ const slideRefs = (0, common_1.getProgressionSlidesRefs)(progression);
74
+ // @ts-expect-error typescript does not support capped versions of lodash functions
75
+ const stack = reduce_1.default.convert({ cap: false })((acc, uiSlide, _index) => {
76
+ const index = (0, toInteger_1.default)(_index);
77
+ const positions = state.ui.positions;
78
+ const position = positions[index];
79
+ const slideRef = slideRefs[index];
80
+ if (!slideRef)
81
+ return (0, set_1.default)(index, { ...uiSlide, position }, acc);
82
+ const slideFromAPI = (0, get_1.default)(slideRef, state.data.slides);
83
+ if (!slideFromAPI)
84
+ return (0, set_1.default)(index, { ...uiSlide, position }, acc);
85
+ const answers = (0, getOr_1.default)([], ['ui', 'answers', slideRef], state);
86
+ const { questionText, answerUI } = (0, map_api_slide_to_ui_1.mapApiSlideToUi)(dispatch)(slideFromAPI, answers);
87
+ const { title: parentContentTitle, type: parentContentType } = slideFromAPI.parentContentTitle;
88
+ const isCurrentSlideRef = currentSlideRef === slideRef;
89
+ const slideUI = (0, get_1.default)(['ui', 'slide', slideRef], state);
90
+ const animateCorrectionPopin = isCurrentSlideRef && slideUI.animateCorrectionPopin;
91
+ const showCorrectionPopin = isCurrentSlideRef && slideUI.showCorrectionPopin;
92
+ const animationType = slideUI.animationType;
93
+ const updatedUiSlide = {
94
+ ...uiSlide,
95
+ position,
96
+ showCorrectionPopin,
97
+ animateCorrectionPopin,
98
+ loading: false,
99
+ questionText,
100
+ answerUI,
101
+ parentContentTitle: `From "${parentContentTitle}" ${parentContentType}`,
102
+ animationType
103
+ };
104
+ return (0, set_1.default)(index, updatedUiSlide, acc);
105
+ }, exports.initialState, exports.initialState);
106
+ return stack;
107
+ };
108
+ const getIconForCurrentStep = (slideRef, lastGivenAnswerForSlide, currentSlideRef, lastGivenAnswer) => {
109
+ if (slideRef !== currentSlideRef)
110
+ return lastGivenAnswerForSlide.isCorrect ? 'right' : 'wrong';
111
+ if (lastGivenAnswer.slideRef !== slideRef)
112
+ return 'no-answer';
113
+ return lastGivenAnswerForSlide.isCorrect ? 'right' : 'wrong';
114
+ };
115
+ const buildStepItems = (state) => {
116
+ const { progression } = state.data;
117
+ const { currentSlideRef } = state.ui;
118
+ if (!progression)
119
+ return [];
120
+ const defaultProps = [
121
+ {
122
+ icon: 'no-answer',
123
+ current: true,
124
+ value: '1'
125
+ },
126
+ {
127
+ icon: 'no-answer',
128
+ current: false,
129
+ value: '2'
130
+ },
131
+ {
132
+ icon: 'no-answer',
133
+ current: false,
134
+ value: '3'
135
+ },
136
+ {
137
+ icon: 'no-answer',
138
+ current: false,
139
+ value: '4'
140
+ },
141
+ {
142
+ icon: 'no-answer',
143
+ current: false,
144
+ value: '5'
145
+ }
146
+ ];
147
+ const slideRefs = (0, common_1.getProgressionSlidesRefs)(progression);
148
+ const allAnswers = progression.state.allAnswers;
149
+ const step = progression.state.step;
150
+ const nextContentRef = progression.state.nextContent.ref;
151
+ const lastGivenAnswer = (0, last_1.default)(allAnswers);
152
+ if (!lastGivenAnswer)
153
+ return defaultProps;
154
+ const steps = defaultProps.map((stepItem, index) => {
155
+ const slideRef = slideRefs[index];
156
+ if (!slideRef)
157
+ return stepItem; // non fecthed slide pour given index
158
+ const lastGivenAnswerForSlide = (0, findLast_1.default)(answer => answer.slideRef === slideRef, allAnswers);
159
+ // never answered slide
160
+ if (!lastGivenAnswerForSlide) {
161
+ return {
162
+ ...stepItem,
163
+ current: nextContentRef === currentSlideRef && step.current === index + 1
164
+ };
165
+ }
166
+ // already answered slide, we computed based on the lastGivenAnswer
167
+ return {
168
+ ...stepItem,
169
+ icon: getIconForCurrentStep(slideRef, lastGivenAnswerForSlide, currentSlideRef, lastGivenAnswer),
170
+ current: lastGivenAnswerForSlide.slideRef === currentSlideRef
171
+ };
172
+ });
173
+ return steps;
174
+ };
175
+ exports.buildStepItems = buildStepItems;
176
+ const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf) => {
177
+ return {
178
+ klf: isCorrect
179
+ ? undefined
180
+ : {
181
+ label: '_klf',
182
+ tooltip: klf
183
+ },
184
+ resultLabel: isCorrect ? '_right' : '_wrong',
185
+ information: {
186
+ label: isCorrect ? '_klf' : '_correctAnswer',
187
+ message: isCorrect ? klf : (0, join_1.default)(',', correctAnswer)
188
+ },
189
+ next: {
190
+ 'aria-label': '_correctionNextAriaLabel',
191
+ label: '_correctionNextLabel',
192
+ onClick: () => {
193
+ dispatch(next_slide_1.nextSlide);
194
+ }
195
+ },
196
+ type: isCorrect ? 'right' : 'wrong'
197
+ };
198
+ };
199
+ const buildQuitPopinProps = (dispatch) => (onQuitClick) => {
200
+ return {
201
+ content: `Tu t'en vas déjà ?`,
202
+ icon: `MoonRocket`,
203
+ mode: 'alert',
204
+ descriptionText: `Tu vas t'en sortir ! Si tu arrêtes maintenant, tu vas perdre ta progression.`,
205
+ firstButton: {
206
+ label: 'Arrêter ma session',
207
+ type: 'tertiary',
208
+ customStyle: {
209
+ color: '#ED3436'
210
+ },
211
+ handleOnclick: onQuitClick,
212
+ 'aria-label': 'Stop session'
213
+ },
214
+ secondButton: {
215
+ label: `Continuer d'apprendre`,
216
+ type: 'primary',
217
+ handleOnclick: () => {
218
+ dispatch(quit_popin_1.closeQuitPopin);
219
+ },
220
+ 'aria-label': 'Continue review'
221
+ }
222
+ };
223
+ };
224
+ const buildRankCard = (rank) => {
225
+ return {
226
+ 'aria-label': 'Review Card Congrats Container',
227
+ 'data-name': 'card-rank',
228
+ animationLottie: {
229
+ 'aria-label': 'aria lottie',
230
+ 'data-name': 'default-lottie',
231
+ animationSrc: 'https://static-staging.coorpacademy.com/animations/review/rank.json',
232
+ loop: true,
233
+ autoplay: true,
234
+ ie11ImageBackup: 'https://static-staging.coorpacademy.com/animations/review/rank_icon_congrats.svg'
235
+ },
236
+ cardType: 'card-rank',
237
+ iconAriaLabel: 'Image without information',
238
+ className: undefined,
239
+ reviewCardTitle: 'You are now',
240
+ reviewCardValue: `${rank}`,
241
+ rankSuffix: 'th',
242
+ timerAnimation: 200
243
+ };
244
+ };
245
+ const buildCongratsProps = (state) => {
246
+ if (!state.ui.showCongrats)
247
+ return;
248
+ const progression = state.data.progression;
249
+ const stars = progression.state.stars;
250
+ const cardCongratsStar = {
251
+ 'aria-label': 'Review Card Congrats Container',
252
+ 'data-name': 'card-star',
253
+ animationLottie: {
254
+ 'aria-label': 'aria lottie',
255
+ 'data-name': 'default-lottie',
256
+ className: undefined,
257
+ animationSrc: 'https://static-staging.coorpacademy.com/animations/review/star.json',
258
+ loop: false,
259
+ autoplay: undefined,
260
+ rendererSettings: {
261
+ hideOnTransparent: false
262
+ },
263
+ ie11ImageBackup: 'https://static-staging.coorpacademy.com/animations/review/stars_icon_congrats.svg'
264
+ },
265
+ iconAriaLabel: 'Image without information',
266
+ className: undefined,
267
+ cardType: 'card-star',
268
+ reviewCardTitle: 'You have won',
269
+ reviewCardValue: `${stars}`,
270
+ timerAnimation: 200
271
+ };
272
+ const { start, end } = state.data.rank;
273
+ const newRank = start - end;
274
+ const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end) : undefined;
275
+ return {
276
+ 'aria-label': 'Review Congratulations',
277
+ 'data-name': 'review-congrats',
278
+ animationLottie: confettiAnimation,
279
+ title: 'Congratulations!',
280
+ cardCongratsStar,
281
+ cardCongratsRank,
282
+ buttonRevising: undefined,
283
+ buttonRevisingSkill: undefined // TODO make boutons and actions
284
+ };
285
+ };
286
+ const isEndOfProgression = (progression) => {
287
+ if (!progression)
288
+ return false;
289
+ return progression.state.nextContent.ref === 'successExitNode';
290
+ };
291
+ const mapStateToSlidesProps = (state, dispatch, onQuitClick) => {
292
+ const currentSlideRef = getCurrentSlideRef(state);
293
+ const endReview = isEndOfProgression(state.data.progression);
294
+ const correction = (0, get_1.default)(['data', 'corrections', currentSlideRef], state);
295
+ const isCorrect = (0, get_1.default)(['data', 'progression', 'state', 'isCorrect'], state);
296
+ const klf = (0, getOr_1.default)('', ['data', 'slides', currentSlideRef, 'klf'], state);
297
+ const showQuitPopin = (0, get_1.default)(['ui', 'showQuitPopin'], state);
298
+ const showCongrats = (0, get_1.default)(['ui', 'showCongrats'], state);
299
+ return {
300
+ header: {
301
+ mode: '__revision_mode',
302
+ skillName: '__agility',
303
+ onQuitClick: () => dispatch(quit_popin_1.openQuitPopin),
304
+ 'aria-label': 'aria-header-wrapper',
305
+ closeButtonAriaLabel: 'aria-close-button',
306
+ steps: (0, exports.buildStepItems)(state),
307
+ hiddenSteps: showCongrats
308
+ },
309
+ stack: {
310
+ slides: buildStackSlides(state, dispatch),
311
+ validateButton: {
312
+ label: '__validate',
313
+ disabled: !(0, get_1.default)(['ui', 'slide', currentSlideRef, 'validateButton'], state),
314
+ onClick: () => {
315
+ dispatch(post_answer_1.postAnswer);
316
+ }
317
+ },
318
+ correctionPopinProps: correction && getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf),
319
+ endReview: endReview && state.ui.showCongrats
320
+ },
321
+ congrats: buildCongratsProps(state),
322
+ quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick) : undefined
323
+ };
324
+ };
325
+ exports.mapStateToSlidesProps = mapStateToSlidesProps;
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapApiSlideToUi = exports.getQuestionType = void 0;
4
+ const fp_1 = require("lodash/fp");
5
+ const answers_1 = require("../../actions/ui/answers");
6
+ const qcmProps = (dispatch) => (answers, question) => {
7
+ return {
8
+ type: 'qcm',
9
+ answers: (0, fp_1.map)(choice => {
10
+ const label = (0, fp_1.getOr)('', 'label', choice);
11
+ return {
12
+ title: label,
13
+ selected: (0, fp_1.includes)(label, answers),
14
+ onClick: () => {
15
+ dispatch((0, answers_1.editAnswer)([label]));
16
+ },
17
+ 'aria-label': label
18
+ };
19
+ }, question.content.choices)
20
+ };
21
+ };
22
+ const qcmDragProps = (dispatch) => (answers, question) => {
23
+ return {
24
+ type: 'qcmDrag',
25
+ answers: (0, fp_1.map)(choice => {
26
+ const label = (0, fp_1.getOr)('', 'label', choice);
27
+ const indexInAnswer = (0, fp_1.indexOf)(label, answers);
28
+ return {
29
+ title: label,
30
+ selected: (0, fp_1.includes)(label, answers),
31
+ order: indexInAnswer,
32
+ onClick: () => {
33
+ dispatch((0, answers_1.editAnswer)([label]));
34
+ }
35
+ };
36
+ }, question.content.choices)
37
+ };
38
+ };
39
+ const qcmGraphicProps = (dispatch) => (answers, question) => {
40
+ return {
41
+ type: 'qcmGraphic',
42
+ answers: (0, fp_1.map)(choice => {
43
+ const label = (0, fp_1.getOr)('', 'label', choice);
44
+ return {
45
+ title: label,
46
+ image: (0, fp_1.get)('media.src.0.url', choice),
47
+ selected: (0, fp_1.includes)(label, answers),
48
+ onClick: () => {
49
+ dispatch((0, answers_1.editAnswer)([label]));
50
+ },
51
+ ariaLabel: label
52
+ };
53
+ }, question.content.choices)
54
+ };
55
+ };
56
+ const updateTemplateAnswer = (text, _answers, index, max) => {
57
+ const answers = (0, fp_1.isEmpty)(_answers) ? (0, fp_1.times)((0, fp_1.constant)(undefined), max) : _answers;
58
+ return (0, fp_1.map)(a => ((0, fp_1.isNil)(a) ? '' : a), (0, fp_1.set)(index, text, answers));
59
+ };
60
+ const templateTextProps = (dispatch, answers, choice, index, maxLength) => {
61
+ return {
62
+ type: 'text',
63
+ name: (0, fp_1.getOr)('', 'name', choice),
64
+ placeholder: 'Type here',
65
+ value: (0, fp_1.get)(index, answers),
66
+ onChange: (text) => {
67
+ const newAnswers = updateTemplateAnswer(text, answers, index, maxLength);
68
+ dispatch((0, answers_1.editAnswer)(newAnswers));
69
+ }
70
+ };
71
+ };
72
+ const templateSelectProps = (dispatch, answers, choice, index, maxLength) => {
73
+ const answer = (0, fp_1.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 = (0, fp_1.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: (0, fp_1.getOr)('', 'name', choice),
92
+ onChange: (text) => {
93
+ const newAnswers = updateTemplateAnswer(text, answers, index, maxLength);
94
+ dispatch((0, answers_1.editAnswer)(newAnswers));
95
+ },
96
+ options: (0, fp_1.isEmpty)(answer) ? (0, fp_1.concat)([temporaryOption], selectOptions) : selectOptions
97
+ };
98
+ };
99
+ const templateProps = (dispatch) => (answers, question) => {
100
+ const choices = question.content.choices;
101
+ const maxLength = (0, fp_1.size)(choices);
102
+ return {
103
+ type: 'template',
104
+ template: (0, fp_1.get)('content.template', question),
105
+ answers: choices.map((choice, index) => choice.type === 'text'
106
+ ? templateTextProps(dispatch, answers, choice, index, maxLength)
107
+ : templateSelectProps(dispatch, answers, choice, index, maxLength))
108
+ };
109
+ };
110
+ const basicProps = (dispatch) => (answers, question) => {
111
+ return {
112
+ type: 'freeText',
113
+ placeholder: (0, fp_1.getOr)('', 'content.placeholder', question),
114
+ value: (0, fp_1.getOr)('', '0', answers),
115
+ onChange: (text) => {
116
+ dispatch((0, answers_1.editAnswer)([text]));
117
+ }
118
+ };
119
+ };
120
+ const sliderProps = (dispatch) => (answers, question) => {
121
+ const values = (0, fp_1.rangeStep)((0, fp_1.getOr)(1, 'content.step', question), (0, fp_1.get)('content.min', question), (0, fp_1.get)('content.max', question) + 1
122
+ // Lodash doesn't infer the type very well here
123
+ );
124
+ const stateValue = (0, fp_1.head)(answers) || question.content.min;
125
+ const currentValue = (0, fp_1.toInteger)(stateValue);
126
+ const indexValue = (0, fp_1.indexOf)(currentValue, values);
127
+ const maxValue = (0, fp_1.size)(values) - 1;
128
+ const sliderPosition = (0, fp_1.divide)(indexValue, maxValue);
129
+ const unitLabel = (0, fp_1.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
+ onChange: (position) => {
138
+ // atom/range handler
139
+ const newValue = (0, fp_1.pipe)((0, fp_1.multiply)(maxValue), fp_1.round, (0, fp_1.get)(fp_1.__, values), fp_1.toString)(position);
140
+ dispatch((0, answers_1.editAnswer)([newValue]));
141
+ },
142
+ onSliderChange: (newValue) => {
143
+ // mobile/slider handler
144
+ dispatch((0, answers_1.editAnswer)([`${newValue}`]));
145
+ }
146
+ };
147
+ };
148
+ const getQuestionType = (question) => question.type;
149
+ exports.getQuestionType = getQuestionType;
150
+ const getHelp = (slide) => (0, fp_1.get)('question.explanation', slide);
151
+ const getAnswerUIModel = (question, answers, dispatch) => {
152
+ const type = (0, exports.getQuestionType)(question);
153
+ switch (type) {
154
+ case 'qcm':
155
+ return qcmProps(dispatch)(answers, question);
156
+ case 'qcmGraphic':
157
+ return qcmGraphicProps(dispatch)(answers, question);
158
+ case 'qcmDrag':
159
+ return qcmDragProps(dispatch)(answers, question);
160
+ case 'basic':
161
+ return basicProps(dispatch)(answers, question);
162
+ case 'template':
163
+ return templateProps(dispatch)(answers, question);
164
+ case 'slider':
165
+ return sliderProps(dispatch)(answers, question);
166
+ default:
167
+ throw new Error(`${type} is not an handled question.type`);
168
+ }
169
+ };
170
+ const mapApiSlideToUi = (dispatch) => (slide, answers) => {
171
+ const questionText = (0, fp_1.getOr)('', 'question.header', slide);
172
+ return {
173
+ questionText,
174
+ answerUI: { model: getAnswerUIModel(slide.question, answers, dispatch), help: getHelp(slide) }
175
+ };
176
+ };
177
+ exports.mapApiSlideToUi = mapApiSlideToUi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.6.0",
3
+ "version": "0.6.1-alpha.0+397b6bc37",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -29,20 +29,12 @@
29
29
  "files": [
30
30
  "lib",
31
31
  "es",
32
- "src",
33
32
  "readme.md"
34
33
  ],
35
- "main": "./es/index.js",
36
- "exports": {
37
- ".": {
38
- "import": "./es/index.js",
39
- "commonjs": "./lib/index.js",
40
- "types": "./es/index.d.ts"
41
- },
42
- "./package.json": "./package.json"
43
- },
34
+ "main": "lib/index.js",
35
+ "module": "es/index.js",
44
36
  "dependencies": {
45
- "@coorpacademy/components": "10.25.0",
37
+ "@coorpacademy/components": "10.25.1-alpha.0+397b6bc37",
46
38
  "@coorpacademy/redux-task": "1.1.6",
47
39
  "cross-fetch": "^3.1.5",
48
40
  "jwt-decode": "^3.1.2",
@@ -77,5 +69,5 @@
77
69
  "webpack-cli": "^4.10.0",
78
70
  "webpack-dev-server": "^4.11.1"
79
71
  },
80
- "gitHead": "c588893546b513a06e95efcc4dd7c5ce31b27a3f"
72
+ "gitHead": "397b6bc37e3ee081c19b8f246647a87f0648e1e6"
81
73
  }
@@ -1,9 +0,0 @@
1
- declare type SandboxOptions = {
2
- container: string;
3
- };
4
- declare global {
5
- interface Window {
6
- createSandbox?: (sandboxOptions: SandboxOptions) => void;
7
- }
8
- }
9
- export {};
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import { render } from 'react-dom';
3
- import isNil from 'lodash/fp/isNil';
4
- import get from 'lodash/fp/get';
5
- import pipe from 'lodash/fp/pipe';
6
- import { WebContext } from '@coorpacademy/components/es/atom/provider';
7
- import { identity } from 'lodash/fp';
8
- import AppReview from '../src';
9
- import { services } from '../src/test/util/services.mock';
10
- const isContainerAvailable = (options) => !pipe(get('container'), isNil)(options);
11
- const createSandbox = (options) => {
12
- if (!isContainerAvailable(options)) {
13
- // eslint-disable-next-line no-console
14
- console.error('[AppReview sandbox] Requires a container.');
15
- }
16
- else {
17
- const container = document.getElementById(options.container);
18
- // mode mobile/web
19
- const appOptions = {
20
- token: process.env.API_TEST_TOKEN || '',
21
- skillRef: '123',
22
- services,
23
- onQuitClick: () => {
24
- location.reload();
25
- },
26
- url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
27
- };
28
- const skin = {
29
- common: {
30
- primary: '#248e59'
31
- }
32
- };
33
- render(React.createElement(WebContext, { skin: skin, translate: identity },
34
- React.createElement(AppReview, { options: appOptions })), container);
35
- }
36
- };
37
- // -----------------------------------------------------------------------------
38
- if (window && !window.createSandbox) {
39
- window.createSandbox = createSandbox;
40
- }
41
- createSandbox({ container: 'root' });
@@ -1,5 +0,0 @@
1
- import type { ExecutionContext } from 'ava';
2
- import { AnyAction, Store } from 'redux';
3
- import { ThunkOptions } from '../../types/common';
4
- import { StoreState } from '../../reducers';
5
- export declare const createTestStore: (t: ExecutionContext, initialState: StoreState, thunkOptions: ThunkOptions, actions: AnyAction[]) => Store<StoreState, AnyAction>;
@@ -1,16 +0,0 @@
1
- import constant from 'lodash/fp/constant';
2
- import { applyMiddleware, compose, createStore } from 'redux';
3
- import thunk from 'redux-thunk';
4
- import rootReducer from '../../reducers';
5
- const assertActionsMiddleware = (t, ACTIONS) => constant((next) => (action) => {
6
- const expectedAction = ACTIONS.shift();
7
- if (!expectedAction)
8
- throw new Error(`Missing {type: "${action.type}"} action`);
9
- t.deepEqual(action, expectedAction);
10
- return next(action);
11
- });
12
- export const createTestStore = (t, initialState, thunkOptions, actions) => {
13
- const thunkMiddleware = thunk.withExtraArgument(thunkOptions);
14
- const enhancer = compose(applyMiddleware(thunkMiddleware, assertActionsMiddleware(t, actions)));
15
- return createStore(rootReducer, initialState, enhancer);
16
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,66 +0,0 @@
1
- import browserEnv from 'browser-env';
2
- import identity from 'lodash/fp/identity';
3
- import test from 'ava';
4
- import React from 'react';
5
- import { render, fireEvent, act } from '@testing-library/react';
6
- import { sleep } from '../services/tools/sleep';
7
- import AppReview from '..';
8
- import { services } from './util/services.mock';
9
- browserEnv({ pretendToBeVisual: true });
10
- const elementExists = (foundElements) => foundElements && foundElements[0];
11
- const waitForChanges = async (msToWait = 3000) => {
12
- await act(async () => {
13
- await sleep(msToWait); // wait *just* a little longer than the timeout in the component
14
- });
15
- };
16
- const LIMIT = 5;
17
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
- const clickAllSlides = async (t, container, accumulator = 0) => {
19
- if (accumulator === LIMIT)
20
- return;
21
- // last one needs to wait for more calculations && components updates
22
- if (accumulator === 4)
23
- await act(async () => {
24
- await sleep(1000);
25
- });
26
- const validateButton = container.querySelectorAll(`[data-name="slide-validate-button-${accumulator}"]`);
27
- t.truthy(elementExists(validateButton));
28
- await act(async () => {
29
- await fireEvent.click(validateButton[0]);
30
- });
31
- const nextButton = container.querySelectorAll(`[data-name="next-question-button-${accumulator}"]`);
32
- t.truthy(elementExists(nextButton));
33
- await act(async () => {
34
- await fireEvent.click(nextButton[0]);
35
- });
36
- await clickAllSlides(t, container, accumulator + 1);
37
- };
38
- const appOptions = {
39
- token: process.env.API_TEST_TOKEN || '',
40
- skillRef: 'skill_NJC0jFKoH',
41
- services,
42
- onQuitClick: identity,
43
- url: process.env.LAMBDA_API_REVIEW_GET_SLIDES_URL || 'http://localhost:7006'
44
- };
45
- test('should show the loader while the app is fetching the data', async (t) => {
46
- t.plan(2);
47
- const { container } = render(React.createElement(AppReview, { options: appOptions }));
48
- await waitForChanges(1000);
49
- const loader = container.querySelector('[data-name="loader"]');
50
- t.truthy(loader);
51
- // await waitFor(async () => {
52
- // // await sleep(500);
53
- // const result = await t.try(tt => {
54
- // // rerender(<AppReview options={appOptions} />);
55
- // const slidesContainer = container.querySelector('[data-name="slides-revision-container"]');
56
- // tt.truthy(slidesContainer);
57
- // });
58
- // if (result.passed) return result.commit();
59
- // result.discard();
60
- // throw result.errors;
61
- // });
62
- // const stackedSlidesContainer = container.querySelector('[data-name="stacked-slides-container"]');
63
- // t.truthy(stackedSlidesContainer);
64
- // await clickAllSlides(t, container);
65
- t.pass();
66
- });