@coorpacademy/app-review 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/es/actions/api/fetch-skills.d.ts +5 -7
  2. package/es/actions/api/fetch-skills.js +12 -4
  3. package/es/actions/api/fetch-slide.d.ts +14 -7
  4. package/es/actions/api/fetch-slide.js +23 -18
  5. package/es/actions/api/post-answer.d.ts +10 -0
  6. package/es/actions/api/post-answer.js +25 -0
  7. package/es/actions/api/post-progression.d.ts +5 -7
  8. package/es/actions/api/post-progression.js +16 -8
  9. package/es/actions/api/test/fetch-skills.test.js +57 -0
  10. package/es/actions/api/test/fetch-slide.test.js +64 -0
  11. package/es/actions/api/test/post-answer.test.d.ts +1 -0
  12. package/es/actions/api/test/post-answer.test.js +82 -0
  13. package/es/actions/api/test/post-progression.test.d.ts +1 -0
  14. package/es/actions/api/test/post-progression.test.js +105 -0
  15. package/es/actions/data/test/token.test.d.ts +1 -0
  16. package/es/actions/data/test/token.test.js +25 -0
  17. package/es/actions/index.d.ts +1 -8
  18. package/es/actions/test/create-test-store.d.ts +5 -0
  19. package/es/actions/test/create-test-store.js +16 -0
  20. package/es/actions/ui/answers.d.ts +21 -0
  21. package/es/actions/ui/answers.js +43 -0
  22. package/es/actions/ui/slides.d.ts +0 -5
  23. package/es/actions/ui/slides.js +0 -4
  24. package/es/actions/ui/test/answers.test.d.ts +1 -0
  25. package/es/actions/ui/test/answers.test.js +90 -0
  26. package/es/actions/ui/test/slides.test.d.ts +1 -0
  27. package/es/actions/ui/test/slides.test.js +26 -0
  28. package/es/common/index.d.ts +0 -3
  29. package/es/common/index.js +0 -4
  30. package/es/index.js +11 -19
  31. package/es/reducers/data/index.d.ts +2 -2
  32. package/es/reducers/data/progression.d.ts +2 -3
  33. package/es/reducers/data/progression.js +0 -5
  34. package/es/reducers/data/slides.d.ts +3 -4
  35. package/es/reducers/data/slides.js +5 -1
  36. package/es/reducers/data/test/progression.test.d.ts +1 -0
  37. package/es/reducers/data/test/progression.test.js +38 -0
  38. package/es/reducers/data/test/skills.test.d.ts +1 -0
  39. package/es/reducers/data/test/skills.test.js +12 -0
  40. package/es/reducers/data/test/slides.test.d.ts +1 -0
  41. package/es/reducers/data/test/slides.test.js +20 -0
  42. package/es/reducers/data/test/token.test.d.ts +1 -0
  43. package/es/reducers/data/test/token.test.js +11 -0
  44. package/es/reducers/index.d.ts +3 -2
  45. package/es/reducers/ui/answers.d.ts +4 -0
  46. package/es/reducers/ui/answers.js +9 -0
  47. package/es/reducers/ui/index.d.ts +7 -4
  48. package/es/reducers/ui/index.js +4 -2
  49. package/es/reducers/ui/slide.d.ts +8 -0
  50. package/es/reducers/ui/slide.js +26 -0
  51. package/es/reducers/ui/test/answers.test.d.ts +1 -0
  52. package/es/reducers/ui/test/answers.test.js +27 -0
  53. package/es/reducers/ui/test/current-slide-ref.test.d.ts +1 -0
  54. package/es/reducers/ui/test/current-slide-ref.test.js +12 -0
  55. package/es/reducers/ui/test/navigation.test.d.ts +1 -0
  56. package/es/reducers/ui/test/navigation.test.js +15 -0
  57. package/es/reducers/ui/test/slide.test.d.ts +1 -0
  58. package/es/reducers/ui/test/slide.test.js +12 -0
  59. package/es/services/fetch-slide.js +1 -1
  60. package/es/services/index.js +3 -1
  61. package/es/services/post-answer.d.ts +2 -0
  62. package/es/services/post-answer.js +18 -0
  63. package/es/services/test/fetch-slide.test.d.ts +1 -0
  64. package/es/services/test/fetch-slide.test.js +22 -0
  65. package/es/services/test/post-answer.test.d.ts +1 -0
  66. package/es/services/test/post-answer.test.js +57 -0
  67. package/es/services/test/post-progression.test.js +9 -1
  68. package/es/test/util/services.mock.d.ts +2 -1
  69. package/es/test/util/services.mock.js +88 -44
  70. package/es/types/common.d.ts +22 -33
  71. package/es/views/skills/index.d.ts +1 -1
  72. package/es/views/skills/index.js +0 -3
  73. package/es/views/skills/test/skills.test.d.ts +1 -0
  74. package/es/views/skills/test/skills.test.js +94 -0
  75. package/es/views/slides/index.d.ts +89 -2
  76. package/es/views/slides/index.js +80 -10
  77. package/es/views/slides/map-api-slide-to-ui.d.ts +8 -0
  78. package/es/views/slides/map-api-slide-to-ui.js +165 -0
  79. package/es/{helpers → views/slides}/test/fixtures/free-text.d.ts +2 -1
  80. package/es/views/slides/test/fixtures/free-text.js +38 -0
  81. package/es/{helpers → views/slides}/test/fixtures/qcm-drag.d.ts +2 -1
  82. package/es/views/slides/test/fixtures/qcm-drag.js +108 -0
  83. package/es/{helpers → views/slides}/test/fixtures/qcm-graphic.d.ts +2 -1
  84. package/es/views/slides/test/fixtures/qcm-graphic.js +88 -0
  85. package/es/{helpers → views/slides}/test/fixtures/qcm.d.ts +2 -1
  86. package/es/{helpers → views/slides}/test/fixtures/qcm.js +5 -1
  87. package/es/{helpers → views/slides}/test/fixtures/select-template.d.ts +2 -1
  88. package/es/views/slides/test/fixtures/select-template.js +92 -0
  89. package/es/{helpers → views/slides}/test/fixtures/slider.d.ts +2 -1
  90. package/es/views/slides/test/fixtures/slider.js +36 -0
  91. package/es/{helpers → views/slides}/test/fixtures/text-template.d.ts +2 -1
  92. package/es/{helpers → views/slides}/test/fixtures/text-template.js +5 -1
  93. package/es/views/slides/test/index.test.d.ts +1 -0
  94. package/es/views/slides/test/index.test.js +234 -0
  95. package/es/views/slides/test/map-api-slide-to-ui.test.d.ts +1 -0
  96. package/es/{helpers → views/slides}/test/map-api-slide-to-ui.test.js +19 -9
  97. package/lib/actions/api/fetch-skills.d.ts +5 -7
  98. package/lib/actions/api/fetch-skills.js +58 -7
  99. package/lib/actions/api/fetch-slide.d.ts +14 -7
  100. package/lib/actions/api/fetch-slide.js +72 -20
  101. package/lib/actions/api/post-answer.d.ts +10 -0
  102. package/lib/actions/api/post-answer.js +75 -0
  103. package/lib/actions/api/post-progression.d.ts +5 -7
  104. package/lib/actions/api/post-progression.js +67 -10
  105. package/lib/actions/api/test/fetch-skills.test.d.ts +1 -0
  106. package/lib/actions/api/test/fetch-skills.test.js +116 -0
  107. package/lib/actions/api/test/fetch-slide.test.d.ts +1 -0
  108. package/lib/actions/api/test/fetch-slide.test.js +123 -0
  109. package/lib/actions/api/test/post-answer.test.d.ts +1 -0
  110. package/lib/actions/api/test/post-answer.test.js +145 -0
  111. package/lib/actions/api/test/post-progression.test.d.ts +1 -0
  112. package/lib/actions/api/test/post-progression.test.js +163 -0
  113. package/lib/actions/data/test/token.test.d.ts +1 -0
  114. package/lib/actions/data/test/token.test.js +70 -0
  115. package/lib/actions/index.d.ts +1 -8
  116. package/lib/actions/test/create-test-store.d.ts +5 -0
  117. package/lib/actions/test/create-test-store.js +18 -0
  118. package/lib/actions/ui/answers.d.ts +21 -0
  119. package/lib/actions/ui/answers.js +54 -0
  120. package/lib/actions/ui/slides.d.ts +0 -5
  121. package/lib/actions/ui/slides.js +0 -4
  122. package/lib/actions/ui/test/answers.test.d.ts +1 -0
  123. package/lib/actions/ui/test/answers.test.js +171 -0
  124. package/lib/actions/ui/test/slides.test.d.ts +1 -0
  125. package/lib/actions/ui/test/slides.test.js +71 -0
  126. package/lib/common/index.d.ts +0 -3
  127. package/lib/common/index.js +0 -4
  128. package/lib/index.js +22 -21
  129. package/lib/reducers/data/index.d.ts +2 -2
  130. package/lib/reducers/data/progression.d.ts +2 -3
  131. package/lib/reducers/data/progression.js +0 -5
  132. package/lib/reducers/data/slides.d.ts +3 -4
  133. package/lib/reducers/data/slides.js +5 -1
  134. package/lib/reducers/data/test/progression.test.d.ts +1 -0
  135. package/lib/reducers/data/test/progression.test.js +38 -0
  136. package/lib/reducers/data/test/skills.test.d.ts +1 -0
  137. package/lib/reducers/data/test/skills.test.js +12 -0
  138. package/lib/reducers/data/test/slides.test.d.ts +1 -0
  139. package/lib/reducers/data/test/slides.test.js +20 -0
  140. package/lib/reducers/data/test/token.test.d.ts +1 -0
  141. package/lib/reducers/data/test/token.test.js +11 -0
  142. package/lib/reducers/index.d.ts +3 -2
  143. package/lib/reducers/ui/answers.d.ts +4 -0
  144. package/lib/reducers/ui/answers.js +10 -0
  145. package/lib/reducers/ui/index.d.ts +7 -4
  146. package/lib/reducers/ui/index.js +4 -2
  147. package/lib/reducers/ui/slide.d.ts +8 -0
  148. package/lib/reducers/ui/slide.js +27 -0
  149. package/lib/reducers/ui/test/answers.test.d.ts +1 -0
  150. package/lib/reducers/ui/test/answers.test.js +27 -0
  151. package/lib/reducers/ui/test/current-slide-ref.test.d.ts +1 -0
  152. package/lib/reducers/ui/test/current-slide-ref.test.js +12 -0
  153. package/lib/reducers/ui/test/navigation.test.d.ts +1 -0
  154. package/lib/reducers/ui/test/navigation.test.js +15 -0
  155. package/lib/reducers/ui/test/slide.test.d.ts +1 -0
  156. package/lib/reducers/ui/test/slide.test.js +12 -0
  157. package/lib/services/fetch-slide.js +1 -1
  158. package/lib/services/index.js +3 -1
  159. package/lib/services/post-answer.d.ts +2 -0
  160. package/lib/services/post-answer.js +62 -0
  161. package/lib/services/test/fetch-slide.test.d.ts +1 -0
  162. package/lib/services/test/fetch-slide.test.js +76 -0
  163. package/lib/services/test/post-answer.test.d.ts +1 -0
  164. package/lib/services/test/post-answer.test.js +111 -0
  165. package/lib/services/test/post-progression.test.js +9 -1
  166. package/lib/test/util/services.mock.d.ts +2 -1
  167. package/lib/test/util/services.mock.js +88 -44
  168. package/lib/types/common.d.ts +22 -33
  169. package/lib/views/skills/index.d.ts +1 -1
  170. package/lib/views/skills/index.js +0 -3
  171. package/lib/views/skills/test/skills.test.d.ts +1 -0
  172. package/lib/views/skills/test/skills.test.js +94 -0
  173. package/lib/views/slides/index.d.ts +89 -2
  174. package/lib/views/slides/index.js +80 -10
  175. package/lib/views/slides/map-api-slide-to-ui.d.ts +8 -0
  176. package/lib/views/slides/map-api-slide-to-ui.js +179 -0
  177. package/lib/{helpers → views/slides}/test/fixtures/free-text.d.ts +2 -1
  178. package/lib/views/slides/test/fixtures/free-text.js +38 -0
  179. package/lib/{helpers → views/slides}/test/fixtures/qcm-drag.d.ts +2 -1
  180. package/lib/views/slides/test/fixtures/qcm-drag.js +108 -0
  181. package/lib/{helpers → views/slides}/test/fixtures/qcm-graphic.d.ts +2 -1
  182. package/lib/views/slides/test/fixtures/qcm-graphic.js +88 -0
  183. package/lib/{helpers → views/slides}/test/fixtures/qcm.d.ts +2 -1
  184. package/lib/{helpers → views/slides}/test/fixtures/qcm.js +5 -1
  185. package/lib/{helpers → views/slides}/test/fixtures/select-template.d.ts +2 -1
  186. package/lib/views/slides/test/fixtures/select-template.js +92 -0
  187. package/lib/{helpers → views/slides}/test/fixtures/slider.d.ts +2 -1
  188. package/lib/views/slides/test/fixtures/slider.js +36 -0
  189. package/lib/{helpers → views/slides}/test/fixtures/text-template.d.ts +2 -1
  190. package/lib/{helpers → views/slides}/test/fixtures/text-template.js +5 -1
  191. package/lib/views/slides/test/index.test.d.ts +1 -0
  192. package/lib/views/slides/test/index.test.js +234 -0
  193. package/lib/views/slides/test/map-api-slide-to-ui.test.d.ts +1 -0
  194. package/lib/{helpers → views/slides}/test/map-api-slide-to-ui.test.js +19 -9
  195. package/package.json +6 -5
  196. package/src/actions/api/fetch-skills.ts +19 -12
  197. package/src/actions/api/fetch-slide.ts +35 -29
  198. package/src/actions/api/post-answer.ts +39 -0
  199. package/src/actions/api/post-progression.ts +22 -22
  200. package/src/actions/api/test/fetch-skills.test.ts +73 -0
  201. package/src/actions/api/test/fetch-slide.test.ts +80 -0
  202. package/src/actions/api/test/post-answer.test.ts +101 -0
  203. package/src/actions/api/test/post-progression.test.ts +122 -0
  204. package/src/actions/data/test/token.test.ts +29 -0
  205. package/src/actions/index.ts +1 -17
  206. package/src/actions/test/create-test-store.ts +25 -0
  207. package/src/actions/ui/answers.ts +63 -0
  208. package/src/actions/ui/slides.ts +1 -8
  209. package/src/actions/ui/test/answers.test.ts +103 -0
  210. package/src/actions/ui/test/slides.test.ts +30 -0
  211. package/src/common/index.ts +0 -7
  212. package/src/index.tsx +15 -32
  213. package/src/reducers/data/index.ts +1 -1
  214. package/src/reducers/data/progression.ts +2 -7
  215. package/src/reducers/data/slides.ts +12 -4
  216. package/src/reducers/data/test/progression.test.ts +42 -0
  217. package/src/reducers/data/test/skills.test.ts +14 -0
  218. package/src/reducers/data/test/slides.test.ts +26 -0
  219. package/src/reducers/data/test/token.test.ts +13 -0
  220. package/src/reducers/ui/answers.ts +15 -0
  221. package/src/reducers/ui/index.ts +6 -3
  222. package/src/reducers/ui/slide.ts +43 -0
  223. package/src/reducers/ui/test/answers.test.ts +33 -0
  224. package/src/reducers/ui/test/current-slide-ref.test.ts +14 -0
  225. package/src/reducers/ui/test/navigation.test.ts +19 -0
  226. package/src/reducers/ui/test/slide.test.ts +15 -0
  227. package/src/services/fetch-slide.ts +1 -1
  228. package/src/services/index.ts +3 -1
  229. package/src/services/post-answer.ts +27 -0
  230. package/src/services/test/fetch-slide.test.ts +30 -0
  231. package/src/services/test/post-answer.test.ts +68 -0
  232. package/src/services/test/post-progression.test.ts +9 -1
  233. package/src/test/util/services.mock.ts +93 -45
  234. package/src/types/common.ts +34 -44
  235. package/src/views/skills/index.ts +1 -5
  236. package/src/views/skills/test/skills.test.ts +101 -0
  237. package/src/views/slides/index.ts +186 -12
  238. package/src/views/slides/map-api-slide-to-ui.ts +251 -0
  239. package/src/views/slides/test/fixtures/free-text.ts +44 -0
  240. package/src/views/slides/test/fixtures/qcm-drag.ts +112 -0
  241. package/src/views/slides/test/fixtures/qcm-graphic.ts +95 -0
  242. package/src/{helpers → views/slides}/test/fixtures/qcm.ts +7 -2
  243. package/src/views/slides/test/fixtures/select-template.ts +99 -0
  244. package/src/views/slides/test/fixtures/slider.ts +42 -0
  245. package/src/{helpers → views/slides}/test/fixtures/text-template.ts +7 -2
  246. package/src/views/slides/test/index.test.ts +240 -0
  247. package/src/{helpers → views/slides}/test/map-api-slide-to-ui.test.ts +22 -10
  248. package/es/fixtures/qcm-slide.d.ts +0 -2
  249. package/es/fixtures/qcm-slide.js +0 -33
  250. package/es/fixtures/temp-fixture.d.ts +0 -3
  251. package/es/fixtures/temp-fixture.js +0 -84
  252. package/es/helpers/map-api-slide-to-ui.d.ts +0 -11
  253. package/es/helpers/map-api-slide-to-ui.js +0 -193
  254. package/es/helpers/test/fixtures/free-text.js +0 -30
  255. package/es/helpers/test/fixtures/qcm-drag.js +0 -112
  256. package/es/helpers/test/fixtures/qcm-graphic.js +0 -76
  257. package/es/helpers/test/fixtures/select-template.js +0 -94
  258. package/es/helpers/test/fixtures/slider.js +0 -33
  259. package/es/reducers/ui/slides.d.ts +0 -9
  260. package/es/reducers/ui/slides.js +0 -42
  261. package/es/types/views/slides.d.ts +0 -74
  262. package/es/types/views/slides.js +0 -6
  263. package/lib/fixtures/qcm-slide.d.ts +0 -2
  264. package/lib/fixtures/qcm-slide.js +0 -33
  265. package/lib/fixtures/temp-fixture.d.ts +0 -3
  266. package/lib/fixtures/temp-fixture.js +0 -84
  267. package/lib/helpers/map-api-slide-to-ui.d.ts +0 -11
  268. package/lib/helpers/map-api-slide-to-ui.js +0 -201
  269. package/lib/helpers/test/fixtures/free-text.js +0 -30
  270. package/lib/helpers/test/fixtures/qcm-drag.js +0 -112
  271. package/lib/helpers/test/fixtures/qcm-graphic.js +0 -76
  272. package/lib/helpers/test/fixtures/select-template.js +0 -94
  273. package/lib/helpers/test/fixtures/slider.js +0 -33
  274. package/lib/reducers/ui/slides.d.ts +0 -9
  275. package/lib/reducers/ui/slides.js +0 -43
  276. package/lib/types/views/slides.d.ts +0 -74
  277. package/lib/types/views/slides.js +0 -6
  278. package/src/fixtures/qcm-slide.ts +0 -35
  279. package/src/fixtures/temp-fixture.ts +0 -94
  280. package/src/helpers/map-api-slide-to-ui.ts +0 -279
  281. package/src/helpers/test/fixtures/free-text.ts +0 -33
  282. package/src/helpers/test/fixtures/qcm-drag.ts +0 -115
  283. package/src/helpers/test/fixtures/qcm-graphic.ts +0 -79
  284. package/src/helpers/test/fixtures/select-template.ts +0 -97
  285. package/src/helpers/test/fixtures/slider.ts +0 -36
  286. package/src/reducers/ui/slides.ts +0 -58
  287. package/src/types/views/slides.ts +0 -90
  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/{lib/helpers/test/map-api-slide-to-ui.test.d.ts → es/actions/api/test/fetch-slide.test.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import test from 'ava';
38
+ import { createTestStore } from '../../test/create-test-store';
39
+ import { services } from '../../../test/util/services.mock';
40
+ import { storeToken, STORE_TOKEN } from '../token';
41
+ var initialState = {
42
+ data: {
43
+ progression: null,
44
+ slides: {},
45
+ skills: [],
46
+ token: '1234'
47
+ },
48
+ ui: {
49
+ currentSlideRef: '',
50
+ navigation: [],
51
+ answers: [],
52
+ slide: {
53
+ validateButton: false
54
+ }
55
+ }
56
+ };
57
+ test('should dispatch STORE_TOKEN action when storeToken is called', function (t) { return __awaiter(void 0, void 0, void 0, function () {
58
+ var expectedActions, dispatch;
59
+ return __generator(this, function (_a) {
60
+ switch (_a.label) {
61
+ case 0:
62
+ expectedActions = [{ type: STORE_TOKEN, payload: 'JWT.token' }];
63
+ dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
64
+ return [4 /*yield*/, dispatch(storeToken('JWT.token'))];
65
+ case 1:
66
+ _a.sent();
67
+ return [2 /*return*/];
68
+ }
69
+ });
70
+ }); });
@@ -1,12 +1,5 @@
1
- import { StoreToken } from './data/token';
2
- import { navigateBack, navigateTo, NavigateBack, NavigateTo, StartApp } from './ui/navigation';
3
- import { ReceivedSlide } from './api/fetch-slide';
4
- import { ReceiveProgression } from './api/post-progression';
5
- import { ReceivedSkills } from './api/fetch-skills';
6
- import { validateSlide } from './ui/slides';
7
- export declare type Action = NavigateBack | NavigateTo | ReceivedSkills | StartApp | ReceivedSlide | StoreToken | ReceiveProgression;
1
+ import { navigateBack, navigateTo } from './ui/navigation';
8
2
  export declare type Dispatchers = {
9
3
  navigateTo: typeof navigateTo;
10
4
  navigateBack: typeof navigateBack;
11
- validateSlide: typeof validateSlide;
12
5
  };
@@ -0,0 +1,5 @@
1
+ import type { ExecutionContext } from 'ava';
2
+ import { AnyAction, Store } from 'redux';
3
+ import { StoreState } from '../../reducers';
4
+ import { Services } from '../../types/common';
5
+ export declare const createTestStore: (t: ExecutionContext, initialState: StoreState, services: Services, actions: AnyAction[]) => Store;
@@ -0,0 +1,18 @@
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
+ var assertActionsMiddleware = function (t, ACTIONS) {
6
+ return constant(function (next) { return function (action) {
7
+ var expectedAction = ACTIONS.shift();
8
+ if (!expectedAction)
9
+ throw new Error("Missing {type: \"".concat(action.type, "\"} action"));
10
+ t.deepEqual(action, expectedAction);
11
+ return next(action);
12
+ }; });
13
+ };
14
+ export var createTestStore = function (t, initialState, services, actions) {
15
+ var thunkMiddleware = thunk.withExtraArgument({ services: services });
16
+ var enhancer = compose(applyMiddleware(thunkMiddleware, assertActionsMiddleware(t, actions)));
17
+ return createStore(rootReducer, initialState, enhancer);
18
+ };
@@ -0,0 +1,21 @@
1
+ import { Dispatch } from 'redux';
2
+ import type { StoreState } from '../../reducers';
3
+ export declare const EDIT_QCM: "@@answer/EDIT_QCM";
4
+ export declare const EDIT_QCM_GRAPHIC: "@@answer/EDIT_QCM_GRAPHIC";
5
+ export declare const EDIT_QCM_DRAG: "@@answer/EDIT_QCM_DRAG";
6
+ export declare const EDIT_TEMPLATE: "@@answer/EDIT_TEMPLATE";
7
+ export declare const EDIT_BASIC: "@@answer/EDIT_BASIC";
8
+ export declare const EDIT_SLIDER: "@@answer/EDIT_SLIDER";
9
+ export declare const ANSWER_EDIT: {
10
+ readonly qcm: "@@answer/EDIT_QCM";
11
+ readonly qcmGraphic: "@@answer/EDIT_QCM_GRAPHIC";
12
+ readonly qcmDrag: "@@answer/EDIT_QCM_DRAG";
13
+ readonly template: "@@answer/EDIT_TEMPLATE";
14
+ readonly basic: "@@answer/EDIT_BASIC";
15
+ readonly slider: "@@answer/EDIT_SLIDER";
16
+ };
17
+ export declare type EditAnswerAction = {
18
+ type: typeof EDIT_QCM | typeof EDIT_QCM_GRAPHIC | typeof EDIT_QCM_DRAG | typeof EDIT_TEMPLATE | typeof EDIT_BASIC | typeof EDIT_SLIDER;
19
+ payload: string[];
20
+ };
21
+ export declare const editAnswer: (answer: string) => (dispatch: Dispatch, getState: () => StoreState) => EditAnswerAction;
@@ -0,0 +1,54 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import { flatten, get, includes, pull } from 'lodash/fp';
11
+ export var EDIT_QCM = '@@answer/EDIT_QCM';
12
+ export var EDIT_QCM_GRAPHIC = '@@answer/EDIT_QCM_GRAPHIC';
13
+ export var EDIT_QCM_DRAG = '@@answer/EDIT_QCM_DRAG';
14
+ export var EDIT_TEMPLATE = '@@answer/EDIT_TEMPLATE';
15
+ export var EDIT_BASIC = '@@answer/EDIT_BASIC';
16
+ export var EDIT_SLIDER = '@@answer/EDIT_SLIDER';
17
+ export var ANSWER_EDIT = {
18
+ qcm: EDIT_QCM,
19
+ qcmGraphic: EDIT_QCM_GRAPHIC,
20
+ qcmDrag: EDIT_QCM_DRAG,
21
+ template: EDIT_TEMPLATE,
22
+ basic: EDIT_BASIC,
23
+ slider: EDIT_SLIDER
24
+ };
25
+ var buildAnswer = function (userAnswers, questionType, newValue) {
26
+ switch (questionType) {
27
+ case 'qcm':
28
+ case 'qcmGraphic':
29
+ case 'qcmDrag': {
30
+ return includes(newValue, userAnswers)
31
+ ? pull(newValue, userAnswers)
32
+ : flatten(__spreadArray(__spreadArray([], userAnswers, true), [newValue], false));
33
+ }
34
+ case 'basic':
35
+ case 'slider':
36
+ return [newValue];
37
+ default:
38
+ return [];
39
+ }
40
+ };
41
+ export var editAnswer = function (answer) {
42
+ return function (dispatch, getState) {
43
+ var state = getState();
44
+ var currentSlideRef = get(['ui', 'currentSlideRef'])(state);
45
+ var userAnswers = get(['ui', 'answers'])(state);
46
+ var slide = get(['data', 'slides', currentSlideRef])(state);
47
+ var questionType = get(['question', 'type'])(slide);
48
+ var type = get(questionType, ANSWER_EDIT);
49
+ return dispatch({
50
+ type: type,
51
+ payload: buildAnswer(userAnswers, questionType, answer)
52
+ });
53
+ };
54
+ };
@@ -17,10 +17,5 @@ export declare type SetCurrentSlide = {
17
17
  payload: SlideFromAPI;
18
18
  };
19
19
  export declare const setCurrentSlide: (payload: SlideFromAPI) => SetCurrentSlide;
20
- export declare const VALIDATE_SLIDE = "@@slide/VALIDATE";
21
- export declare type ValidateSlide = {
22
- type: typeof VALIDATE_SLIDE;
23
- };
24
- export declare const validateSlide: () => ValidateSlide;
25
20
  export declare type UISlidesAction = SetCurrentSlide;
26
21
  export {};
@@ -3,7 +3,3 @@ export var setCurrentSlide = function (payload) { return ({
3
3
  type: SET_CURRENT_SLIDE,
4
4
  payload: payload
5
5
  }); };
6
- export var VALIDATE_SLIDE = '@@slide/VALIDATE';
7
- export var validateSlide = function () { return ({
8
- type: VALIDATE_SLIDE
9
- }); };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,171 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import test from 'ava';
38
+ import pipe from 'lodash/fp/pipe';
39
+ import set from 'lodash/fp/set';
40
+ import { createTestStore } from '../../test/create-test-store';
41
+ import { services } from '../../../test/util/services.mock';
42
+ import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
43
+ import { qcmDragSlide } from '../../../views/slides/test/fixtures/qcm-drag';
44
+ import { qcmSlide } from '../../../views/slides/test/fixtures/qcm';
45
+ import { qcmGraphicSlide } from '../../../views/slides/test/fixtures/qcm-graphic';
46
+ import { sliderSlide } from '../../../views/slides/test/fixtures/slider';
47
+ import { editAnswer, ANSWER_EDIT } from '../answers';
48
+ var initialState = {
49
+ data: {
50
+ progression: {
51
+ _id: '62b1d1087aa12f00253f40ee',
52
+ content: {
53
+ ref: '_skill-ref',
54
+ type: 'skill'
55
+ },
56
+ engine: {
57
+ ref: 'review'
58
+ },
59
+ state: {
60
+ allAnswers: [],
61
+ isCorrect: true,
62
+ nextContent: {
63
+ ref: '',
64
+ type: 'slide'
65
+ },
66
+ pendingSlides: [],
67
+ slides: [],
68
+ step: {
69
+ current: 1
70
+ },
71
+ stars: 0
72
+ }
73
+ },
74
+ slides: {},
75
+ skills: [],
76
+ token: '1234'
77
+ },
78
+ ui: {
79
+ currentSlideRef: '',
80
+ navigation: [],
81
+ answers: [],
82
+ slide: {
83
+ validateButton: false
84
+ }
85
+ }
86
+ };
87
+ var buildInitialState = function (state, question) {
88
+ return pipe(set(['data', 'progression', 'state', 'nextContent', 'ref'], question.id), set(['data', 'slides', question.id], question), set(['ui', 'currentSlideRef'], question.id))(state);
89
+ };
90
+ test('should dispatch EDIT_BASIC action when editAnswer is called', function (t) { return __awaiter(void 0, void 0, void 0, function () {
91
+ var state, expectedActions, dispatch;
92
+ return __generator(this, function (_a) {
93
+ switch (_a.label) {
94
+ case 0:
95
+ state = buildInitialState(initialState, freeTextSlide);
96
+ expectedActions = [{ type: ANSWER_EDIT.basic, payload: ['My Answer'] }];
97
+ dispatch = createTestStore(t, state, services, expectedActions).dispatch;
98
+ return [4 /*yield*/, dispatch(editAnswer('My Answer'))];
99
+ case 1:
100
+ _a.sent();
101
+ return [2 /*return*/];
102
+ }
103
+ });
104
+ }); });
105
+ test('should dispatch EDIT_QCM action when editAnswer is called', function (t) { return __awaiter(void 0, void 0, void 0, function () {
106
+ var state, expectedActions, dispatch;
107
+ return __generator(this, function (_a) {
108
+ switch (_a.label) {
109
+ case 0:
110
+ state = buildInitialState(initialState, qcmSlide);
111
+ state = set(['ui', 'answers'], ['My First Answer', 'My Second Answer'], state);
112
+ expectedActions = [{ type: ANSWER_EDIT.qcm, payload: ['My First Answer'] }];
113
+ dispatch = createTestStore(t, state, services, expectedActions).dispatch;
114
+ return [4 /*yield*/, dispatch(editAnswer('My Second Answer'))];
115
+ case 1:
116
+ _a.sent();
117
+ return [2 /*return*/];
118
+ }
119
+ });
120
+ }); });
121
+ test('should dispatch EDIT_QCM_GRAPHIC action when editAnswer is called', function (t) { return __awaiter(void 0, void 0, void 0, function () {
122
+ var state, expectedActions, dispatch;
123
+ return __generator(this, function (_a) {
124
+ switch (_a.label) {
125
+ case 0:
126
+ state = buildInitialState(initialState, qcmGraphicSlide);
127
+ state = set(['ui', 'answers'], ['My First Answer', 'My Second Answer', 'My Third Answer'], state);
128
+ expectedActions = [
129
+ { type: ANSWER_EDIT.qcmGraphic, payload: ['My First Answer', 'My Third Answer'] }
130
+ ];
131
+ dispatch = createTestStore(t, state, services, expectedActions).dispatch;
132
+ return [4 /*yield*/, dispatch(editAnswer('My Second Answer'))];
133
+ case 1:
134
+ _a.sent();
135
+ return [2 /*return*/];
136
+ }
137
+ });
138
+ }); });
139
+ test('should dispatch EDIT_QCM_DRAG action when editAnswer is called', function (t) { return __awaiter(void 0, void 0, void 0, function () {
140
+ var state, expectedActions, dispatch;
141
+ return __generator(this, function (_a) {
142
+ switch (_a.label) {
143
+ case 0:
144
+ state = buildInitialState(initialState, qcmDragSlide);
145
+ state = set(['ui', 'answers'], ['My First Answer', 'My Second Answer'], state);
146
+ expectedActions = [
147
+ { type: ANSWER_EDIT.qcmDrag, payload: ['My First Answer', 'My Second Answer', 'My Third Answer'] }
148
+ ];
149
+ dispatch = createTestStore(t, state, services, expectedActions).dispatch;
150
+ return [4 /*yield*/, dispatch(editAnswer('My Third Answer'))];
151
+ case 1:
152
+ _a.sent();
153
+ return [2 /*return*/];
154
+ }
155
+ });
156
+ }); });
157
+ test('should dispatch EDIT_SLIDER action when editAnswer is called', function (t) { return __awaiter(void 0, void 0, void 0, function () {
158
+ var state, expectedActions, dispatch;
159
+ return __generator(this, function (_a) {
160
+ switch (_a.label) {
161
+ case 0:
162
+ state = buildInitialState(initialState, sliderSlide);
163
+ expectedActions = [{ type: ANSWER_EDIT.slider, payload: ['5'] }];
164
+ dispatch = createTestStore(t, state, services, expectedActions).dispatch;
165
+ return [4 /*yield*/, dispatch(editAnswer('5'))];
166
+ case 1:
167
+ _a.sent();
168
+ return [2 /*return*/];
169
+ }
170
+ });
171
+ }); });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import test from 'ava';
38
+ import { createTestStore } from '../../test/create-test-store';
39
+ import { services } from '../../../test/util/services.mock';
40
+ import { freeTextSlide } from '../../../views/slides/test/fixtures/free-text';
41
+ import { setCurrentSlide, SET_CURRENT_SLIDE } from '../slides';
42
+ var initialState = {
43
+ data: {
44
+ progression: null,
45
+ slides: {},
46
+ skills: [],
47
+ token: '1234'
48
+ },
49
+ ui: {
50
+ currentSlideRef: '',
51
+ navigation: [],
52
+ answers: [],
53
+ slide: {
54
+ validateButton: false
55
+ }
56
+ }
57
+ };
58
+ test('should dispatch SET_CURRENT_SLIDE action when setCurrentSlide is called', function (t) { return __awaiter(void 0, void 0, void 0, function () {
59
+ var expectedActions, dispatch;
60
+ return __generator(this, function (_a) {
61
+ switch (_a.label) {
62
+ case 0:
63
+ expectedActions = [{ type: SET_CURRENT_SLIDE, payload: freeTextSlide }];
64
+ dispatch = createTestStore(t, initialState, services, expectedActions).dispatch;
65
+ return [4 /*yield*/, dispatch(setCurrentSlide(freeTextSlide))];
66
+ case 1:
67
+ _a.sent();
68
+ return [2 /*return*/];
69
+ }
70
+ });
71
+ }); });
@@ -1,5 +1,3 @@
1
- export declare const TOTAL_SLIDES_STACK = 5;
2
- export declare const HIGHEST_INDEX: number;
3
1
  export declare const VIEWS: {
4
2
  readonly skills: 'skills';
5
3
  readonly onboarding: 'onboarding';
@@ -7,4 +5,3 @@ export declare const VIEWS: {
7
5
  };
8
6
  export declare const slideIndexes: readonly ["0", "1", "2", "3", "4"];
9
7
  export declare type SlideIndexes = typeof slideIndexes[number];
10
- export declare const indexToString: (index: number) => SlideIndexes;
@@ -1,10 +1,6 @@
1
- import _toString from 'lodash/fp/toString';
2
- export var TOTAL_SLIDES_STACK = 5;
3
- export var HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;
4
1
  export var VIEWS = {
5
2
  skills: 'skills',
6
3
  onboarding: 'onboarding',
7
4
  slides: 'slides'
8
5
  };
9
6
  export var slideIndexes = ['0', '1', '2', '3', '4'];
10
- export var indexToString = function (index) { return _toString(index); };
package/lib/index.js CHANGED
@@ -1,34 +1,37 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import React, { useEffect, useState } from 'react';
2
- import { connect, Provider } from 'react-redux';
13
+ import { useSelector, useDispatch, Provider } from 'react-redux';
3
14
  import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
4
15
  import { TemplateContext } from '@coorpacademy/components/es/template/app-review/template-context';
5
16
  import isEmpty from 'lodash/fp/isEmpty';
6
17
  import get from 'lodash/fp/get';
7
18
  import configureStore from './configure-store';
8
- import { validateSlide } from './actions/ui/slides';
9
- import { navigateTo, navigateBack } from './actions/ui/navigation';
19
+ import { navigateTo } from './actions/ui/navigation';
10
20
  import { storeToken } from './actions/data/token';
11
21
  import { fetchSkills } from './actions/api/fetch-skills';
12
22
  import { postProgression } from './actions/api/post-progression';
13
23
  import { VIEWS } from './common';
14
24
  import { mapStateToSlidesProps } from './views/slides';
15
25
  import { mapStateToSkillsProps } from './views/skills';
16
- var mapDispatchToProps = {
17
- navigateTo: navigateTo,
18
- navigateBack: navigateBack,
19
- validateSlide: validateSlide
20
- };
21
- var getCurrentViewName = function (storeState) {
22
- return storeState.ui.navigation[storeState.ui.navigation.length - 1];
23
- };
24
- var mapStateToProps = function (state) {
25
- return {
26
- viewName: getCurrentViewName(state),
27
- slides: mapStateToSlidesProps(state),
28
- skills: mapStateToSkillsProps(state)
26
+ var ConnectedApp = function () {
27
+ var dispatch = useDispatch();
28
+ var props = {
29
+ viewName: useSelector(function (state) { return state.ui.navigation[state.ui.navigation.length - 1]; }),
30
+ slides: useSelector(function (state) { return mapStateToSlidesProps(state, dispatch); }),
31
+ skills: useSelector(function (state) { return mapStateToSkillsProps(state); })
29
32
  };
33
+ return React.createElement(AppReviewTemplate, __assign({}, props));
30
34
  };
31
- var App = connect(mapStateToProps, mapDispatchToProps)(AppReviewTemplate);
32
35
  var AppReview = function (_a) {
33
36
  var options = _a.options;
34
37
  var _b = useState(null), store = _b[0], setStore = _b[1];
@@ -60,9 +63,7 @@ var AppReview = function (_a) {
60
63
  var skillRef = get('skillRef', options);
61
64
  /* ThunkAction is not assignable to parameter of type 'AnyAction'
62
65
  ts problem is described here = https://github.com/reduxjs/redux-thunk/issues/333 */
63
- skillRef
64
- ? store.dispatch(postProgression(skillRef, token))
65
- : store.dispatch(fetchSkills(token));
66
+ skillRef ? store.dispatch(postProgression(skillRef)) : store.dispatch(fetchSkills);
66
67
  }, [options, store]);
67
68
  useEffect(function () {
68
69
  if (store === null)
@@ -80,6 +81,6 @@ var AppReview = function (_a) {
80
81
  var values = options.templateContext;
81
82
  return (React.createElement(Provider, { store: store },
82
83
  React.createElement(TemplateContext, { values: values },
83
- React.createElement(App, null))));
84
+ React.createElement(ConnectedApp, null))));
84
85
  };
85
86
  export default AppReview;
@@ -4,7 +4,7 @@ import { SlidesState } from './slides';
4
4
  import { TokenState } from './token';
5
5
  export declare type DataState = {
6
6
  isFetching?: boolean;
7
- progression?: ProgressionState;
7
+ progression: ProgressionState;
8
8
  skills: SkillsState;
9
9
  slides: SlidesState;
10
10
  token?: TokenState;
@@ -14,5 +14,5 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
14
14
  skills: SkillsState;
15
15
  slides: SlidesState;
16
16
  token: TokenState;
17
- }>, import("../../actions/api/post-progression").ReceiveProgression | import("../../actions/api/fetch-skills").ReceivedSkills | import("./slides").SlidesAction | import("../../actions/data/token").StoreToken>;
17
+ }>, import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/fetch-skills").ReceivedSkills | import("./slides").SlidesAction | import("../../actions/data/token").StoreToken>;
18
18
  export default _default;
@@ -1,6 +1,5 @@
1
- import { ValidateSlide } from '../../actions/ui/slides';
2
- import { ReceiveProgression } from '../../actions/api/post-progression';
1
+ import { ReceivedProgression } from '../../actions/api/post-progression';
3
2
  import { ProgressionFromAPI } from '../../types/common';
4
3
  export declare type ProgressionState = ProgressionFromAPI | null;
5
- declare const reducer: (state: ProgressionState | undefined, action: ValidateSlide | ReceiveProgression) => ProgressionState;
4
+ declare const reducer: (state: ProgressionState | undefined, action: ReceivedProgression) => ProgressionState;
6
5
  export default reducer;
@@ -1,14 +1,9 @@
1
- import { VALIDATE_SLIDE } from '../../actions/ui/slides';
2
1
  import { POST_PROGRESSION_SUCCESS } from '../../actions/api/post-progression';
3
2
  var reducer = function (
4
3
  // eslint-disable-next-line default-param-last
5
4
  state, action) {
6
5
  if (state === void 0) { state = null; }
7
6
  switch (action.type) {
8
- case VALIDATE_SLIDE: {
9
- // TODO: fix on VALIDATE ticket -> launch a POST PROGRESSION
10
- return state;
11
- }
12
7
  case POST_PROGRESSION_SUCCESS: {
13
8
  var progression = action.payload;
14
9
  return progression;
@@ -1,8 +1,7 @@
1
- import { ValidateSlide } from '../../actions/ui/slides';
2
- import { ReceivedSlide } from '../../actions/api/fetch-slide';
1
+ import { ReceivedSlide, FetchSlide } from '../../actions/api/fetch-slide';
3
2
  import { SlideFromAPI } from '../../types/common';
4
- export declare type SlidesAction = ReceivedSlide | ValidateSlide;
5
- export declare type SlidesState = Record<string, SlideFromAPI>;
3
+ export declare type SlidesAction = FetchSlide | ReceivedSlide;
4
+ export declare type SlidesState = Record<string, SlideFromAPI | null>;
6
5
  export declare const initialState: SlidesState;
7
6
  declare const reducer: (state: SlidesState | undefined, action: SlidesAction) => SlidesState;
8
7
  export default reducer;
@@ -1,10 +1,14 @@
1
1
  import set from 'lodash/fp/set';
2
- import { SLIDE_FETCH_SUCCESS } from '../../actions/api/fetch-slide';
2
+ import { SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS } from '../../actions/api/fetch-slide';
3
3
  export var initialState = {};
4
4
  // eslint-disable-next-line default-param-last
5
5
  var reducer = function (state, action) {
6
6
  if (state === void 0) { state = initialState; }
7
7
  switch (action.type) {
8
+ case SLIDE_FETCH_REQUEST: {
9
+ var meta = action.meta;
10
+ return set(meta.slideRef, null, state);
11
+ }
8
12
  case SLIDE_FETCH_SUCCESS: {
9
13
  var slide = action.payload;
10
14
  return set(slide.id, slide, state);
@@ -0,0 +1 @@
1
+ export {};