@coorpacademy/app-review 0.0.21-alpha.8 → 0.1.2

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 (232) hide show
  1. package/es/actions/courses.d.ts +0 -1
  2. package/es/actions/{api → data}/is-fetching.d.ts +0 -1
  3. package/{lib/actions/api → es/actions/data}/validate-slide.d.ts +0 -1
  4. package/es/actions/finished-slides.d.ts +0 -1
  5. package/es/actions/index.d.ts +0 -1
  6. package/es/actions/navigation.d.ts +0 -1
  7. package/es/actions/review-status.d.ts +0 -1
  8. package/es/actions/slides.d.ts +0 -1
  9. package/es/actions/step-items.d.ts +0 -1
  10. package/es/actions/token.d.ts +0 -1
  11. package/es/common/index.d.ts +1 -1
  12. package/es/common/index.js +1 -0
  13. package/es/configure-store.d.ts +2 -3
  14. package/es/configure-store.js +3 -9
  15. package/es/fixtures/qcm-slide.d.ts +2 -0
  16. package/es/fixtures/qcm-slide.js +29 -0
  17. package/es/{temp-fixture.d.ts → fixtures/temp-fixture.d.ts} +1 -2
  18. package/es/helpers/css-register.js +2 -0
  19. package/es/index.d.ts +1 -3
  20. package/es/index.js +43 -27
  21. package/es/index.test.js +52 -0
  22. package/es/middlewares/on-start-app.d.ts +0 -1
  23. package/es/middlewares/on-start-app.js +2 -0
  24. package/es/reducers/courses.d.ts +0 -1
  25. package/es/reducers/data.d.ts +7 -0
  26. package/es/reducers/{api.js → data.js} +15 -8
  27. package/es/reducers/finished-slides.d.ts +1 -2
  28. package/es/reducers/finished-slides.js +17 -7
  29. package/es/reducers/index.d.ts +9 -14
  30. package/es/reducers/index.js +7 -6
  31. package/es/reducers/navigation.d.ts +0 -1
  32. package/es/reducers/navigation.js +1 -1
  33. package/es/reducers/review-status.d.ts +0 -1
  34. package/es/reducers/slides.d.ts +1 -2
  35. package/es/reducers/slides.js +37 -25
  36. package/es/reducers/step-items.d.ts +1 -2
  37. package/es/reducers/step-items.js +19 -12
  38. package/es/reducers/token.d.ts +4 -7
  39. package/es/reducers/token.js +3 -14
  40. package/es/services/fetch-demo.d.ts +0 -1
  41. package/es/services/fetch-demo.test.d.ts +0 -1
  42. package/es/services/fetch-responses.d.ts +0 -1
  43. package/es/services/fetch.mocks.d.ts +0 -1
  44. package/es/types/common.d.ts +0 -1
  45. package/es/types/data/index.d.ts +14 -0
  46. package/es/types/data/index.js +1 -0
  47. package/es/types/dispatchers.d.ts +1 -2
  48. package/es/types/finished-slides.d.ts +4 -2
  49. package/es/types/review-status.d.ts +0 -1
  50. package/es/types/slides.d.ts +4 -2
  51. package/es/types/states.d.ts +1 -3
  52. package/es/types/step-items.d.ts +4 -2
  53. package/es/types/store-state.d.ts +10 -10
  54. package/es/types/utils.d.ts +0 -1
  55. package/es/types/views.d.ts +9 -3
  56. package/lib/actions/courses.d.ts +0 -1
  57. package/lib/actions/{api → data}/is-fetching.d.ts +0 -1
  58. package/{es/actions/api → lib/actions/data}/validate-slide.d.ts +0 -1
  59. package/lib/actions/finished-slides.d.ts +0 -1
  60. package/lib/actions/index.d.ts +0 -1
  61. package/lib/actions/navigation.d.ts +0 -1
  62. package/lib/actions/review-status.d.ts +0 -1
  63. package/lib/actions/slides.d.ts +0 -1
  64. package/lib/actions/step-items.d.ts +0 -1
  65. package/lib/actions/token.d.ts +0 -1
  66. package/lib/common/index.d.ts +1 -1
  67. package/lib/common/index.js +1 -0
  68. package/lib/configure-store.d.ts +2 -3
  69. package/lib/configure-store.js +10 -66
  70. package/lib/fixtures/qcm-slide.d.ts +2 -0
  71. package/lib/fixtures/qcm-slide.js +29 -0
  72. package/lib/{temp-fixture.d.ts → fixtures/temp-fixture.d.ts} +1 -2
  73. package/lib/helpers/css-register.d.ts +1 -0
  74. package/lib/helpers/css-register.js +2 -0
  75. package/lib/index.d.ts +1 -3
  76. package/lib/index.js +52 -52
  77. package/lib/index.test.d.ts +1 -0
  78. package/lib/index.test.js +160 -0
  79. package/lib/middlewares/on-start-app.d.ts +0 -1
  80. package/lib/middlewares/on-start-app.js +2 -0
  81. package/lib/reducers/courses.d.ts +0 -1
  82. package/lib/reducers/courses.js +1 -17
  83. package/lib/reducers/data.d.ts +7 -0
  84. package/lib/reducers/{api.js → data.js} +15 -8
  85. package/lib/reducers/finished-slides.d.ts +1 -2
  86. package/lib/reducers/finished-slides.js +28 -45
  87. package/lib/reducers/index.d.ts +9 -14
  88. package/lib/reducers/index.js +7 -6
  89. package/lib/reducers/navigation.d.ts +0 -1
  90. package/lib/reducers/navigation.js +3 -19
  91. package/lib/reducers/review-status.d.ts +0 -1
  92. package/lib/reducers/slides.d.ts +1 -2
  93. package/lib/reducers/slides.js +58 -106
  94. package/lib/reducers/step-items.d.ts +1 -2
  95. package/lib/reducers/step-items.js +21 -52
  96. package/lib/reducers/token.d.ts +4 -7
  97. package/lib/reducers/token.js +3 -15
  98. package/lib/services/fetch-demo.d.ts +0 -1
  99. package/lib/services/fetch-demo.test.d.ts +0 -1
  100. package/lib/services/fetch-responses.d.ts +0 -1
  101. package/lib/services/fetch.mocks.d.ts +0 -1
  102. package/lib/types/common.d.ts +0 -1
  103. package/lib/types/data/index.d.ts +14 -0
  104. package/lib/types/data/index.js +1 -0
  105. package/lib/types/dispatchers.d.ts +1 -2
  106. package/lib/types/finished-slides.d.ts +4 -2
  107. package/lib/types/review-status.d.ts +0 -1
  108. package/lib/types/slides.d.ts +4 -2
  109. package/lib/types/states.d.ts +1 -3
  110. package/lib/types/step-items.d.ts +4 -2
  111. package/lib/types/store-state.d.ts +10 -10
  112. package/lib/types/utils.d.ts +0 -1
  113. package/lib/types/views.d.ts +9 -3
  114. package/package.json +10 -7
  115. package/src/common/index.ts +2 -0
  116. package/src/configure-store.ts +10 -20
  117. package/src/fixtures/qcm-slide.ts +31 -0
  118. package/src/{temp-fixture.ts → fixtures/temp-fixture.ts} +1 -1
  119. package/src/helpers/css-modules-require-hook.d.ts +4 -0
  120. package/src/helpers/css-register.ts +3 -0
  121. package/src/index.test.tsx +82 -0
  122. package/src/index.tsx +48 -34
  123. package/src/middlewares/on-start-app.ts +2 -0
  124. package/src/reducers/{api.ts → data.ts} +17 -14
  125. package/src/reducers/finished-slides.ts +22 -7
  126. package/src/reducers/index.ts +8 -6
  127. package/src/reducers/navigation.ts +1 -1
  128. package/src/reducers/slides.ts +38 -25
  129. package/src/reducers/step-items.ts +22 -12
  130. package/src/reducers/token.ts +5 -17
  131. package/src/types/data/index.ts +16 -0
  132. package/src/types/dispatchers.ts +1 -1
  133. package/src/types/finished-slides.ts +5 -2
  134. package/src/types/globals.d.ts +6 -0
  135. package/src/types/slides.ts +6 -3
  136. package/src/types/states.ts +1 -2
  137. package/src/types/step-items.ts +4 -1
  138. package/src/types/store-state.ts +11 -11
  139. package/src/types/views.tsx +9 -2
  140. package/es/actions/api/is-fetching.d.ts.map +0 -1
  141. package/es/actions/api/validate-slide.d.ts.map +0 -1
  142. package/es/actions/courses.d.ts.map +0 -1
  143. package/es/actions/finished-slides.d.ts.map +0 -1
  144. package/es/actions/index.d.ts.map +0 -1
  145. package/es/actions/navigation.d.ts.map +0 -1
  146. package/es/actions/review-status.d.ts.map +0 -1
  147. package/es/actions/slides.d.ts.map +0 -1
  148. package/es/actions/step-items.d.ts.map +0 -1
  149. package/es/actions/token.d.ts.map +0 -1
  150. package/es/common/index.d.ts.map +0 -1
  151. package/es/configure-store.d.ts.map +0 -1
  152. package/es/index.d.ts.map +0 -1
  153. package/es/middlewares/on-start-app.d.ts.map +0 -1
  154. package/es/reducers/api.d.ts +0 -12
  155. package/es/reducers/api.d.ts.map +0 -1
  156. package/es/reducers/courses.d.ts.map +0 -1
  157. package/es/reducers/finished-slides.d.ts.map +0 -1
  158. package/es/reducers/index.d.ts.map +0 -1
  159. package/es/reducers/navigation.d.ts.map +0 -1
  160. package/es/reducers/review-status.d.ts.map +0 -1
  161. package/es/reducers/slides.d.ts.map +0 -1
  162. package/es/reducers/step-items.d.ts.map +0 -1
  163. package/es/reducers/token.d.ts.map +0 -1
  164. package/es/services/fetch-demo.d.ts.map +0 -1
  165. package/es/services/fetch-demo.test.d.ts.map +0 -1
  166. package/es/services/fetch-responses.d.ts.map +0 -1
  167. package/es/services/fetch.mocks.d.ts.map +0 -1
  168. package/es/temp-fixture.d.ts.map +0 -1
  169. package/es/types/api/index.d.ts +0 -16
  170. package/es/types/api/index.d.ts.map +0 -1
  171. package/es/types/common.d.ts.map +0 -1
  172. package/es/types/dispatchers.d.ts.map +0 -1
  173. package/es/types/finished-slides.d.ts.map +0 -1
  174. package/es/types/review-status.d.ts.map +0 -1
  175. package/es/types/slides.d.ts.map +0 -1
  176. package/es/types/states.d.ts.map +0 -1
  177. package/es/types/step-items.d.ts.map +0 -1
  178. package/es/types/store-state.d.ts.map +0 -1
  179. package/es/types/utils.d.ts.map +0 -1
  180. package/es/types/views.d.ts.map +0 -1
  181. package/lib/actions/api/is-fetching.d.ts.map +0 -1
  182. package/lib/actions/api/validate-slide.d.ts.map +0 -1
  183. package/lib/actions/courses.d.ts.map +0 -1
  184. package/lib/actions/finished-slides.d.ts.map +0 -1
  185. package/lib/actions/index.d.ts.map +0 -1
  186. package/lib/actions/navigation.d.ts.map +0 -1
  187. package/lib/actions/review-status.d.ts.map +0 -1
  188. package/lib/actions/slides.d.ts.map +0 -1
  189. package/lib/actions/step-items.d.ts.map +0 -1
  190. package/lib/actions/token.d.ts.map +0 -1
  191. package/lib/common/index.d.ts.map +0 -1
  192. package/lib/configure-store.d.ts.map +0 -1
  193. package/lib/index.d.ts.map +0 -1
  194. package/lib/middlewares/on-start-app.d.ts.map +0 -1
  195. package/lib/reducers/api.d.ts +0 -12
  196. package/lib/reducers/api.d.ts.map +0 -1
  197. package/lib/reducers/courses.d.ts.map +0 -1
  198. package/lib/reducers/finished-slides.d.ts.map +0 -1
  199. package/lib/reducers/index.d.ts.map +0 -1
  200. package/lib/reducers/navigation.d.ts.map +0 -1
  201. package/lib/reducers/review-status.d.ts.map +0 -1
  202. package/lib/reducers/slides.d.ts.map +0 -1
  203. package/lib/reducers/step-items.d.ts.map +0 -1
  204. package/lib/reducers/token.d.ts.map +0 -1
  205. package/lib/services/fetch-demo.d.ts.map +0 -1
  206. package/lib/services/fetch-demo.test.d.ts.map +0 -1
  207. package/lib/services/fetch-responses.d.ts.map +0 -1
  208. package/lib/services/fetch.mocks.d.ts.map +0 -1
  209. package/lib/temp-fixture.d.ts.map +0 -1
  210. package/lib/types/api/index.d.ts +0 -16
  211. package/lib/types/api/index.d.ts.map +0 -1
  212. package/lib/types/common.d.ts.map +0 -1
  213. package/lib/types/dispatchers.d.ts.map +0 -1
  214. package/lib/types/finished-slides.d.ts.map +0 -1
  215. package/lib/types/review-status.d.ts.map +0 -1
  216. package/lib/types/slides.d.ts.map +0 -1
  217. package/lib/types/states.d.ts.map +0 -1
  218. package/lib/types/step-items.d.ts.map +0 -1
  219. package/lib/types/store-state.d.ts.map +0 -1
  220. package/lib/types/utils.d.ts.map +0 -1
  221. package/lib/types/views.d.ts.map +0 -1
  222. package/src/types/api/index.ts +0 -16
  223. /package/es/actions/{api → data}/is-fetching.js +0 -0
  224. /package/es/actions/{api → data}/validate-slide.js +0 -0
  225. /package/es/{temp-fixture.js → fixtures/temp-fixture.js} +0 -0
  226. /package/es/{types/api/index.js → helpers/css-register.d.ts} +0 -0
  227. /package/{lib/types/api/index.js → es/index.test.d.ts} +0 -0
  228. /package/lib/actions/{api → data}/is-fetching.js +0 -0
  229. /package/lib/actions/{api → data}/validate-slide.js +0 -0
  230. /package/lib/{temp-fixture.js → fixtures/temp-fixture.js} +0 -0
  231. /package/src/actions/{api → data}/is-fetching.ts +0 -0
  232. /package/src/actions/{api → data}/validate-slide.ts +0 -0
@@ -1,82 +1,94 @@
1
+ import map from 'lodash/fp/map';
1
2
  import { STORE_FIRST_SLIDE, UPDATE_SLIDES_ON_NEXT, UPDATE_SLIDES_ON_VALIDATION } from '../actions/slides';
2
- import { HIGHEST_INDEX, TOTAL_SLIDES_STACK } from '../common';
3
+ import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '../common';
3
4
  const getInitialState = () => {
4
- const state = new Map();
5
+ const state = {
6
+ slideNumbers
7
+ };
5
8
  // eslint-disable-next-line fp/no-loops
6
9
  for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
7
- state.set(index, { hidden: false, position: index });
10
+ state[index] = { hidden: false, position: index };
8
11
  }
9
12
  return state;
10
13
  };
11
14
  export const initialState = getInitialState();
12
15
  // -----------------------------------------------------------------------------
13
16
  const setFirstSlide = (state, slide) => {
14
- const _state = new Map();
15
- // eslint-disable-next-line fp/no-loops
16
- for (const [index, previousValue] of state) {
17
+ const _state = {
18
+ slideNumbers
19
+ };
20
+ // eslint-disable-next-line lodash-fp/no-unused-result
21
+ map(index => {
22
+ const previousValue = state[index];
17
23
  // Only update the 1st one
18
24
  const content = index === 0 ? { ...previousValue, ...slide } : { ...previousValue };
19
- _state.set(index, { ...content });
20
- }
25
+ _state[index] = { ...content };
26
+ }, state.slideNumbers);
21
27
  return _state;
22
28
  };
23
29
  // ||-------> Handles the updates of a given slide on validation,
24
30
  // & then updates de remaining slides if this given change should impact their content
25
31
  const stateUpdateOnValidation = (state, payload) => {
26
32
  const { slideNumber, newSlideContent, numberOfFinishedSlides, nextSlide } = payload;
27
- const _state = new Map();
28
- // eslint-disable-next-line fp/no-loops
29
- for (const [index, previousValue] of state) {
33
+ const _state = {
34
+ slideNumbers
35
+ };
36
+ // eslint-disable-next-line lodash-fp/no-unused-result
37
+ map(index => {
38
+ const previousValue = state[index];
30
39
  // the current slide
31
40
  if (index === slideNumber) {
32
41
  // only one slide remaining, presets the next value
33
42
  if (numberOfFinishedSlides === HIGHEST_INDEX) {
34
- _state.set(index, {
43
+ _state[index] = {
35
44
  ...previousValue,
36
45
  nextSlide,
37
46
  position: newSlideContent.position,
38
47
  validationResult: newSlideContent.validationResult
39
- });
48
+ };
40
49
  }
41
50
  else
42
- _state.set(slideNumber, newSlideContent);
51
+ _state[slideNumber] = { ...previousValue, ...newSlideContent };
43
52
  }
44
53
  else {
45
54
  // updates the rest of the slides here
46
55
  const { hidden, position } = previousValue;
47
- _state.set(index, { ...nextSlide, endReview: newSlideContent.endReview, hidden, position });
56
+ _state[index] = { ...nextSlide, endReview: newSlideContent.endReview, hidden, position };
48
57
  }
49
- }
58
+ }, state.slideNumbers);
50
59
  return _state;
51
60
  };
52
61
  // ||-------> Handles the updates of a given slide on correction popin's next click,
53
62
  // & then updates de remaining slides (updates position to trigger animations)
54
63
  const stateUpdateOnNext = (state, payload) => {
55
64
  const { slideNumber, newSlideContent, numberOfFinishedSlides } = payload;
56
- const _state = new Map();
57
- // eslint-disable-next-line fp/no-loops
58
- for (const [index, previousValue] of state) {
65
+ const _state = {
66
+ slideNumbers
67
+ };
68
+ // eslint-disable-next-line lodash-fp/no-unused-result
69
+ map(index => {
70
+ const previousValue = state[index];
59
71
  // the current slide
60
72
  if (index === slideNumber) {
61
73
  // when there is only one slide remaining, updates the slide value
62
- if (numberOfFinishedSlides === HIGHEST_INDEX) {
63
- _state.set(index, { ...previousValue.nextSlide, position: previousValue.position });
74
+ if (numberOfFinishedSlides === HIGHEST_INDEX && previousValue.nextSlide) {
75
+ _state[index] = { ...previousValue.nextSlide, position: previousValue.position };
64
76
  }
65
77
  else
66
- _state.set(slideNumber, newSlideContent);
78
+ _state[slideNumber] = newSlideContent;
67
79
  }
68
80
  else {
69
81
  // updates the rest of the slides here
70
82
  const { hidden, position, answerUI, questionText } = previousValue;
71
- _state.set(index, {
83
+ _state[index] = {
72
84
  hidden,
73
85
  position: position - 1,
74
86
  answerUI,
75
87
  questionText,
76
88
  endReview: newSlideContent.endReview
77
- });
89
+ };
78
90
  }
79
- }
91
+ }, state.slideNumbers);
80
92
  return _state;
81
93
  };
82
94
  // -----------------------------------------------------------------------------
@@ -2,6 +2,5 @@ import { StepItemsAction } from '../actions/step-items';
2
2
  import { StepItems } from '../types/step-items';
3
3
  export declare type State = StepItems;
4
4
  export declare const initialState: State;
5
- declare const reducer: (state: StepItems, action: StepItemsAction) => StepItems;
5
+ declare const reducer: (state: State, action: StepItemsAction) => State;
6
6
  export default reducer;
7
- //# sourceMappingURL=step-items.d.ts.map
@@ -1,13 +1,17 @@
1
1
  import isNil from 'lodash/fp/isNil';
2
2
  import get from 'lodash/fp/get';
3
+ import has from 'lodash/fp/has';
4
+ import map from 'lodash/fp/map';
3
5
  import { UPDATE_STEP_ITEMS_ON_NEXT, UPDATE_STEP_ITEMS_ON_VALIDATION } from '../actions/step-items';
4
- import { HIGHEST_INDEX, TOTAL_SLIDES_STACK } from '../common';
6
+ import { HIGHEST_INDEX, slideNumbers, TOTAL_SLIDES_STACK } from '../common';
5
7
  const getInitialState = () => {
6
- const state = new Map();
8
+ const state = {
9
+ slideNumbers
10
+ };
7
11
  // eslint-disable-next-line fp/no-loops
8
12
  for (let index = 0; index < TOTAL_SLIDES_STACK; index++) {
9
13
  const current = index === 0;
10
- state.set(index, { current, value: `${index + 1}`, icon: null });
14
+ state[index] = { current, value: `${index + 1}`, icon: null };
11
15
  }
12
16
  return state;
13
17
  };
@@ -25,26 +29,29 @@ const calculateNextStepIndex = (currentStepNumber, finishedSlides, lastVisitedIn
25
29
  }
26
30
  const indexToVisit = getNextIndex(isNil(lastVisitedIndex) ? currentStepNumber : lastVisitedIndex);
27
31
  // if the index is already included in the correctly answered (finished) slides, then we proceed to check for the next one
28
- return finishedSlides.has(indexToVisit)
32
+ return has(indexToVisit, finishedSlides)
29
33
  ? calculateNextStepIndex(currentStepNumber, finishedSlides, indexToVisit)
30
34
  : indexToVisit;
31
35
  };
32
36
  const recalculateStepItemsState = (state, stepNumber, stepItemToUpdateProps) => {
33
37
  const nextIndex = get('nextIndex', stepItemToUpdateProps);
34
- const _state = new Map();
35
- // eslint-disable-next-line fp/no-loops
36
- for (const [index, previousValue] of state) {
38
+ const _state = {
39
+ slideNumbers
40
+ };
41
+ // eslint-disable-next-line lodash-fp/no-unused-result
42
+ map(index => {
43
+ const previousValue = state[index];
37
44
  if (stepNumber === index)
38
- _state.set(stepNumber, {
45
+ _state[stepNumber] = {
39
46
  ...previousValue,
40
47
  ...stepItemToUpdateProps
41
- });
48
+ };
42
49
  /* only for UPDATE_STEP_ITEMS_ON_NEXT -> */ else if (nextIndex === index) {
43
- _state.set(index, { ...previousValue, current: true });
50
+ _state[index] = { ...previousValue, current: true };
44
51
  }
45
52
  else
46
- _state.set(index, previousValue);
47
- }
53
+ _state[index] = previousValue;
54
+ }, state.slideNumbers);
48
55
  return _state;
49
56
  };
50
57
  // -----------------------------------------------------------------------------
@@ -1,8 +1,5 @@
1
- import { StoreToken } from '../actions/token';
2
1
  import { StoreState } from '../types/store-state';
3
- import { TokenState as State } from '../types/states';
4
- export declare const initialState: State;
5
- declare const reducer: (state: State, action: StoreToken) => State;
6
- export declare const getToken: (appState: StoreState) => StoreState['token'];
7
- export default reducer;
8
- //# sourceMappingURL=token.d.ts.map
2
+ import { DataState } from '../types/data';
3
+ export declare const initialState: DataState['token'];
4
+ export declare const setToken: (token: string, state: DataState) => DataState;
5
+ export declare const getToken: (appState: StoreState) => StoreState['data']['token'];
@@ -1,19 +1,8 @@
1
- import { STORE_TOKEN } from '../actions/token';
1
+ import set from 'lodash/fp/set';
2
2
  // -----------------------------------------------------------------------------
3
- // export type State = string;
4
3
  export const initialState = null;
5
4
  // -----------------------------------------------------------------------------
6
- // eslint-disable-next-line default-param-last
7
- const reducer = (state = initialState, action) => {
8
- switch (action.type) {
9
- case STORE_TOKEN: {
10
- return action.payload;
11
- }
12
- default:
13
- return state;
14
- }
15
- };
5
+ export const setToken = (token, state) => set('token', token, state);
16
6
  // -----------------------------------------------------------------------------
17
- export const getToken = (appState) => appState.token;
7
+ export const getToken = (appState) => appState.data.token;
18
8
  // -----------------------------------------------------------------------------
19
- export default reducer;
@@ -9,4 +9,3 @@ export declare type CatalogHits = {
9
9
  export { fetchCourse };
10
10
  declare const _default: (token: any, language: any, universalRef: any) => Promise<Course>;
11
11
  export default _default;
12
- //# sourceMappingURL=fetch-demo.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=fetch-demo.test.d.ts.map
@@ -17,4 +17,3 @@ export declare class ResponseError extends Error {
17
17
  export declare const toJSON: (response: _Response) => Promise<unknown>;
18
18
  export declare const toText: (response: _Response) => Promise<string>;
19
19
  export declare const toVoid: (response: _Response) => Promise<void>;
20
- //# sourceMappingURL=fetch-responses.d.ts.map
@@ -7,4 +7,3 @@ export declare const notFoundJSONResponse: (body: unknown) => FetchFunction;
7
7
  export declare const okTextResponse: (body: string) => FetchFunction;
8
8
  export declare const internalServerErrorTextResponse: (body: string) => FetchFunction;
9
9
  export {};
10
- //# sourceMappingURL=fetch.mocks.d.ts.map
@@ -5,4 +5,3 @@ export declare type AppOptions = {
5
5
  translations?: unknown;
6
6
  slide?: Slide;
7
7
  };
8
- //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { AnswerUI } from '../slides';
2
+ export declare type DataState = {
3
+ isFetching?: boolean;
4
+ slideValidationResult?: {
5
+ slideNumber: number;
6
+ result: 'success' | 'failure';
7
+ exitNode?: 'successExitNode' | 'failExitNode';
8
+ nextSlide: {
9
+ questionText?: string;
10
+ answerUI?: AnswerUI;
11
+ };
12
+ };
13
+ token?: string;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { validateSlide } from '../actions/api/validate-slide';
1
+ import { validateSlide } from '../actions/data/validate-slide';
2
2
  import { updateFinishedSlides } from '../actions/finished-slides';
3
3
  import { navigateBack, navigateTo } from '../actions/navigation';
4
4
  import { updateReviewStatus } from '../actions/review-status';
@@ -15,4 +15,3 @@ export declare type Dispatchers = {
15
15
  updateStepItemsOnNext: typeof updateStepItemsOnNext;
16
16
  updateFinishedSlides: typeof updateFinishedSlides;
17
17
  };
18
- //# sourceMappingURL=dispatchers.d.ts.map
@@ -1,7 +1,9 @@
1
1
  import { SlideNumber } from './slides';
2
- export declare type FinishedSlides = Map<SlideNumber, true>;
2
+ export declare type FinishedSlides = {
3
+ slideNumbers: SlideNumber[];
4
+ [key: SlideNumber]: true;
5
+ };
3
6
  export declare type UpdateFinishedSlidesPayload = {
4
7
  slideNumber: SlideNumber;
5
8
  value: true;
6
9
  };
7
- //# sourceMappingURL=finished-slides.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare type UpdateReviewStatusPayload = 'finished';
2
- //# sourceMappingURL=review-status.d.ts.map
@@ -74,7 +74,10 @@ export declare type Slide = {
74
74
  answerUI?: AnswerUI;
75
75
  nextSlide?: Omit<Slide, 'endReview' | 'hidden' | 'position' | 'nextSlide'>;
76
76
  };
77
- export declare type Slides = Map<SlideNumber, Slide>;
77
+ export declare type Slides = {
78
+ slideNumbers: SlideNumber[];
79
+ [key: SlideNumber]: Slide;
80
+ };
78
81
  export declare type UpdateSlidesOnValidationPayload = {
79
82
  slideNumber: SlideNumber;
80
83
  newSlideContent: Slide;
@@ -82,4 +85,3 @@ export declare type UpdateSlidesOnValidationPayload = {
82
85
  nextSlide: WithRequired<Slide['nextSlide'], 'answerUI' | 'questionText'>;
83
86
  };
84
87
  export declare type UpdateSlidesOnNextPayload = Omit<UpdateSlidesOnValidationPayload, 'nextSlide'>;
85
- //# sourceMappingURL=slides.d.ts.map
@@ -1,8 +1,6 @@
1
1
  export { Slides as SlidesState } from './slides';
2
- export { ApiState } from './api';
2
+ export { DataState } from './data';
3
3
  export { StepItems as StepItemsState } from './step-items';
4
4
  export { FinishedSlides as FinishedSlidesState } from './finished-slides';
5
5
  export { State as ReviewStatusState } from '../reducers/review-status';
6
- export declare type TokenState = string;
7
6
  export declare type NavigationState = Array<'home' | 'onboarding' | 'slides'>;
8
- //# sourceMappingURL=states.d.ts.map
@@ -10,7 +10,10 @@ export declare type StepItem = {
10
10
  icon: IconValue;
11
11
  value: string;
12
12
  };
13
- export declare type StepItems = Map<SlideNumber, StepItem>;
13
+ export declare type StepItems = {
14
+ slideNumbers: SlideNumber[];
15
+ [key: SlideNumber]: StepItem;
16
+ };
14
17
  export declare type UpdateStepItemsOnValidationClickPayload = {
15
18
  stepNumber: SlideNumber;
16
19
  icon: IconValue;
@@ -21,4 +24,3 @@ export declare type UpdateStepItemsOnNextClickPayload = {
21
24
  current: boolean;
22
25
  };
23
26
  export {};
24
- //# sourceMappingURL=step-items.d.ts.map
@@ -1,12 +1,12 @@
1
- import { ApiState, FinishedSlidesState, NavigationState, ReviewStatusState, SlidesState, StepItemsState, TokenState } from './states';
1
+ import { DataState, FinishedSlidesState, NavigationState, ReviewStatusState, SlidesState, StepItemsState } from './states';
2
2
  export declare type StoreState = {
3
- courses: unknown;
4
- navigation: NavigationState;
5
- slides: SlidesState;
6
- stepItems: StepItemsState;
7
- finishedSlides: FinishedSlidesState;
8
- reviewStatus: ReviewStatusState;
9
- token: TokenState;
10
- api: ApiState;
3
+ ui: {
4
+ courses: unknown;
5
+ navigation: NavigationState;
6
+ slides: SlidesState;
7
+ stepItems: StepItemsState;
8
+ finishedSlides: FinishedSlidesState;
9
+ reviewStatus: ReviewStatusState;
10
+ };
11
+ data: DataState;
11
12
  };
12
- //# sourceMappingURL=store-state.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export declare type WithRequired<T, K extends keyof T> = T & {
2
2
  [P in K]-?: T[P];
3
3
  };
4
- //# sourceMappingURL=utils.d.ts.map
@@ -1,11 +1,18 @@
1
1
  import { State as ReviewStatus } from '../reducers/review-status';
2
- import { ApiState } from './api';
2
+ import { DataState } from './data';
3
3
  import { Dispatchers } from './dispatchers';
4
4
  import { FinishedSlides } from './finished-slides';
5
5
  import { Slides } from './slides';
6
6
  import { StepItems } from './step-items';
7
7
  declare type SlidesViewStaticProps = {
8
8
  slides: Slides;
9
+ headerProps: {
10
+ mode: string;
11
+ skillName: string;
12
+ onQuitClick: Function;
13
+ 'aria-label'?: string;
14
+ closeButtonAriaLabel: string;
15
+ };
9
16
  finishedSlides: FinishedSlides;
10
17
  stepItems: StepItems;
11
18
  reviewStatus: ReviewStatus;
@@ -50,9 +57,8 @@ declare type SlidesViewStaticProps = {
50
57
  failureLabel: string;
51
58
  };
52
59
  reviewBackgroundAriaLabel?: string;
53
- slideValidationResult: ApiState['entities']['slideValidationResult'];
60
+ slideValidationResult: DataState['slideValidationResult'];
54
61
  };
55
62
  declare type SlidesViewDispatcherProps = Omit<Dispatchers, 'navigateTo' | 'navigateBack'>;
56
63
  declare type SlidesViewProps = SlidesViewStaticProps & SlidesViewDispatcherProps;
57
64
  export { SlidesViewStaticProps, SlidesViewDispatcherProps, SlidesViewProps };
58
- //# sourceMappingURL=views.d.ts.map
@@ -4,4 +4,3 @@ export declare type ReceivedCourse = {
4
4
  payload: unknown;
5
5
  };
6
6
  export declare const receivedCourse: (course: unknown) => ReceivedCourse;
7
- //# sourceMappingURL=courses.d.ts.map
@@ -3,4 +3,3 @@ export declare type IsFetching = {
3
3
  type: typeof IS_FETCHING_TRUE;
4
4
  };
5
5
  export declare const setIsFetching: () => IsFetching;
6
- //# sourceMappingURL=is-fetching.d.ts.map
@@ -3,4 +3,3 @@ export declare type ValidateSlide = {
3
3
  type: typeof VALIDATE_SLIDE;
4
4
  };
5
5
  export declare const validateSlide: () => ValidateSlide;
6
- //# sourceMappingURL=validate-slide.d.ts.map
@@ -5,4 +5,3 @@ export declare type UpdateFinishedSlides = {
5
5
  payload: UpdateFinishedSlidesPayload;
6
6
  };
7
7
  export declare const updateFinishedSlides: (payload: UpdateFinishedSlidesPayload) => UpdateFinishedSlides;
8
- //# sourceMappingURL=finished-slides.d.ts.map
@@ -3,4 +3,3 @@ import { NavigateBack, NavigateTo, StartApp } from './navigation';
3
3
  import { StoreToken } from './token';
4
4
  import { StoreFirstSlide } from './slides';
5
5
  export declare type Action = NavigateBack | NavigateTo | ReceivedCourse | StartApp | StoreFirstSlide | StoreToken;
6
- //# sourceMappingURL=index.d.ts.map
@@ -17,4 +17,3 @@ export declare type StartApp = {
17
17
  export declare const navigateTo: (newPath: ViewPath) => NavigateTo;
18
18
  export declare const navigateBack: () => NavigateBack;
19
19
  export declare const startApp: (options: AppOptions) => StartApp;
20
- //# sourceMappingURL=navigation.d.ts.map
@@ -5,4 +5,3 @@ export declare type UpdateReviewStatus = {
5
5
  payload: UpdateReviewStatusPayload;
6
6
  };
7
7
  export declare const updateReviewStatus: (payload: UpdateReviewStatusPayload) => UpdateReviewStatus;
8
- //# sourceMappingURL=review-status.d.ts.map
@@ -18,4 +18,3 @@ export declare type SlidesAction = StoreFirstSlide | UpdateSlidesOnValidation |
18
18
  export declare const storeFirstSlide: (slide: Slide) => StoreFirstSlide;
19
19
  export declare const updateSlidesOnValidation: (payload: UpdateSlidesOnValidationPayload) => UpdateSlidesOnValidation;
20
20
  export declare const updateSlidesOnNext: (payload: UpdateSlidesOnNextPayload) => UpdateSlidesOnNext;
21
- //# sourceMappingURL=slides.d.ts.map
@@ -12,4 +12,3 @@ export declare type UpdateStepItemsOnNext = {
12
12
  export declare type StepItemsAction = UpdateStepItemsOnValidation | UpdateStepItemsOnNext;
13
13
  export declare const updateStepItemsOnValidation: (payload: UpdateStepItemsOnValidationClickPayload) => UpdateStepItemsOnValidation;
14
14
  export declare const updateStepItemsOnNext: (payload: UpdateStepItemsOnNextClickPayload) => UpdateStepItemsOnNext;
15
- //# sourceMappingURL=step-items.d.ts.map
@@ -4,4 +4,3 @@ export declare type StoreToken = {
4
4
  payload: string;
5
5
  };
6
6
  export declare const storeToken: (token: string) => StoreToken;
7
- //# sourceMappingURL=token.d.ts.map
@@ -5,4 +5,4 @@ export declare const VIEWS: {
5
5
  readonly onboarding: 'onboarding';
6
6
  readonly slides: 'slides';
7
7
  };
8
- //# sourceMappingURL=index.d.ts.map
8
+ export declare const slideNumbers: number[];
@@ -5,3 +5,4 @@ export var VIEWS = {
5
5
  onboarding: 'onboarding',
6
6
  slides: 'slides'
7
7
  };
8
+ export var slideNumbers = [0, 1, 2, 3, 4];
@@ -1,6 +1,5 @@
1
1
  import { AnyAction, EmptyObject, Store } from 'redux';
2
2
  import { StoreState } from './types/store-state';
3
- export default function configureStore(): Promise<Store<EmptyObject & StoreState, AnyAction> & {
3
+ export default function configureStore(): Store<EmptyObject & StoreState, AnyAction> & {
4
4
  dispatch: {};
5
- }>;
6
- //# sourceMappingURL=configure-store.d.ts.map
5
+ };
@@ -1,39 +1,3 @@
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
1
  import { applyMiddleware, compose, createStore } from 'redux';
38
2
  import thunk from 'redux-thunk';
39
3
  import rootReducer from './reducers';
@@ -41,34 +5,14 @@ import onStartApp from './middlewares/on-start-app';
41
5
  var preloadedState = undefined;
42
6
  // -----------------------------------------------------------------------------
43
7
  export default function configureStore() {
44
- return __awaiter(this, void 0, void 0, function () {
45
- var isExtensionEnabled, isProd, composeWithDevTools, _a, _compose, enhancer, store;
46
- return __generator(this, function (_b) {
47
- switch (_b.label) {
48
- case 0:
49
- isExtensionEnabled = typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__;
50
- isProd = process.env.NODE_ENV !== 'production';
51
- if (!isProd) return [3 /*break*/, 1];
52
- _a = { composeWithDevTools: null };
53
- return [3 /*break*/, 3];
54
- case 1: // eslint-disable-next-line node/no-unsupported-features/es-syntax, import/dynamic-import-chunkname
55
- return [4 /*yield*/, import('redux-devtools-extension')];
56
- case 2:
57
- _a = _b.sent();
58
- _b.label = 3;
59
- case 3:
60
- composeWithDevTools = (_a).composeWithDevTools;
61
- _compose = !isProd && isExtensionEnabled
62
- ? composeWithDevTools({
63
- name: 'app-review',
64
- trace: true,
65
- traceLimit: 25
66
- })
67
- : compose;
68
- enhancer = _compose(applyMiddleware(thunk, onStartApp));
69
- store = createStore(rootReducer, preloadedState, enhancer);
70
- return [2 /*return*/, store];
71
- }
72
- });
73
- });
8
+ var _compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
9
+ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
10
+ name: 'app-review',
11
+ trace: true,
12
+ traceLimit: 25
13
+ })
14
+ : compose;
15
+ var enhancer = _compose(applyMiddleware(thunk, onStartApp));
16
+ var store = createStore(rootReducer, preloadedState, enhancer);
17
+ return store;
74
18
  }
@@ -0,0 +1,2 @@
1
+ import { Slide } from '../types/slides';
2
+ export declare const slide: Slide;
@@ -0,0 +1,29 @@
1
+ export var slide = {
2
+ questionText: 'QCM',
3
+ answerUI: {
4
+ help: '__help',
5
+ model: {
6
+ type: 'qcm',
7
+ choices: [
8
+ {
9
+ selected: false,
10
+ title: 'choix1',
11
+ help: '(help choix1)',
12
+ ariaLabel: '__ariaLabel1'
13
+ },
14
+ {
15
+ selected: false,
16
+ title: 'choix2',
17
+ help: '(help choix2)',
18
+ ariaLabel: '__ariaLabel2'
19
+ },
20
+ {
21
+ selected: false,
22
+ title: 'choix3',
23
+ help: '(help choix3)',
24
+ ariaLabel: '__ariaLabel3'
25
+ }
26
+ ]
27
+ }
28
+ }
29
+ };
@@ -1,4 +1,3 @@
1
- import { SlidesViewProps } from './types/views';
1
+ import { SlidesViewProps } from '../types/views';
2
2
  export declare const correctionPopinProps: SlidesViewProps['correctionPopinProps'];
3
3
  export declare const congratsProps: SlidesViewProps['congratsProps'];
4
- //# sourceMappingURL=temp-fixture.d.ts.map
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import cssRegister from '@coorpacademy/css-modules-require-hook';
2
+ cssRegister();