@coorpacademy/app-review 0.1.3 → 0.1.4

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 (266) hide show
  1. package/es/actions/data/skills.d.ts +13 -0
  2. package/es/actions/data/skills.js +10 -0
  3. package/es/actions/data/slides.d.ts +54 -0
  4. package/es/actions/{slides.js → data/slides.js} +5 -0
  5. package/es/actions/index.d.ts +19 -5
  6. package/es/actions/ui/finished-slides.d.ts +10 -0
  7. package/es/actions/{finished-slides.js → ui/finished-slides.js} +1 -0
  8. package/es/actions/ui/is-fetching.d.ts +10 -0
  9. package/es/actions/ui/is-fetching.js +6 -0
  10. package/{lib/actions → es/actions/ui}/navigation.d.ts +2 -2
  11. package/es/actions/ui/review-status.d.ts +7 -0
  12. package/{lib/actions → es/actions/ui}/step-items.d.ts +17 -1
  13. package/es/actions/{step-items.js → ui/step-items.js} +5 -0
  14. package/es/common/index.d.ts +1 -1
  15. package/es/common/index.js +1 -1
  16. package/es/configure-store.d.ts +34 -4
  17. package/es/configure-store.js +1 -2
  18. package/es/fixtures/qcm-slide.js +7 -3
  19. package/es/fixtures/temp-fixture.d.ts +1 -1
  20. package/es/index.js +54 -36
  21. package/es/index.test.js +1 -1
  22. package/es/middlewares/on-start-app.d.ts +2 -3
  23. package/es/middlewares/on-start-app.js +18 -17
  24. package/es/reducers/data/index.d.ts +7 -0
  25. package/es/reducers/data/index.js +11 -0
  26. package/es/reducers/data/progression.d.ts +14 -0
  27. package/es/reducers/data/progression.js +78 -0
  28. package/es/reducers/data/skills.d.ts +6 -0
  29. package/es/reducers/{courses.js → data/skills.js} +3 -4
  30. package/es/reducers/data/slides.d.ts +8 -0
  31. package/es/reducers/{slides.js → data/slides.js} +4 -3
  32. package/es/reducers/data/token.d.ts +5 -0
  33. package/es/reducers/data/token.js +15 -0
  34. package/es/reducers/index.d.ts +11 -8
  35. package/es/reducers/index.js +3 -16
  36. package/es/reducers/ui/finished-slides.d.ts +8 -0
  37. package/es/reducers/{finished-slides.js → ui/finished-slides.js} +9 -6
  38. package/es/reducers/ui/index.d.ts +7 -0
  39. package/es/reducers/ui/index.js +11 -0
  40. package/es/reducers/ui/navigation.d.ts +5 -0
  41. package/es/reducers/{navigation.js → ui/navigation.js} +4 -7
  42. package/es/reducers/ui/review-status.d.ts +5 -0
  43. package/es/reducers/{review-status.js → ui/review-status.js} +3 -2
  44. package/es/reducers/ui/step-items.d.ts +14 -0
  45. package/es/reducers/{step-items.js → ui/step-items.js} +7 -7
  46. package/es/services/fetch-skills.d.ts +8 -0
  47. package/es/services/fetch-skills.js +23 -0
  48. package/es/services/fetch-skills.mock.d.ts +3 -0
  49. package/es/services/fetch-skills.mock.js +17 -0
  50. package/es/services/fetch-skills.test.js +22 -0
  51. package/es/services/tools/fetch-responses.d.ts +7 -0
  52. package/es/services/tools/fetch.mocks.d.ts +8 -0
  53. package/es/services/{fetch.mocks.js → tools/fetch.mocks.js} +1 -0
  54. package/es/types/common.d.ts +12 -0
  55. package/es/types/skills.d.ts +7 -0
  56. package/es/types/slides.d.ts +3 -21
  57. package/es/types/views/skills.d.ts +24 -0
  58. package/{lib/types/views.d.ts → es/types/views/slides.d.ts} +7 -11
  59. package/lib/actions/data/skills.d.ts +13 -0
  60. package/lib/actions/data/skills.js +10 -0
  61. package/lib/actions/data/slides.d.ts +54 -0
  62. package/lib/actions/{slides.js → data/slides.js} +5 -0
  63. package/lib/actions/index.d.ts +19 -5
  64. package/lib/actions/ui/finished-slides.d.ts +10 -0
  65. package/lib/actions/{finished-slides.js → ui/finished-slides.js} +1 -0
  66. package/lib/actions/ui/is-fetching.d.ts +10 -0
  67. package/lib/actions/ui/is-fetching.js +6 -0
  68. package/{es/actions → lib/actions/ui}/navigation.d.ts +2 -2
  69. package/lib/actions/ui/review-status.d.ts +7 -0
  70. package/{es/actions → lib/actions/ui}/step-items.d.ts +17 -1
  71. package/lib/actions/{step-items.js → ui/step-items.js} +5 -0
  72. package/lib/common/index.d.ts +1 -1
  73. package/lib/common/index.js +1 -1
  74. package/lib/configure-store.d.ts +34 -4
  75. package/lib/configure-store.js +1 -2
  76. package/lib/fixtures/qcm-slide.js +7 -3
  77. package/lib/fixtures/temp-fixture.d.ts +1 -1
  78. package/lib/index.js +57 -37
  79. package/lib/index.test.js +1 -1
  80. package/lib/middlewares/on-start-app.d.ts +2 -3
  81. package/lib/middlewares/on-start-app.js +18 -17
  82. package/lib/reducers/data/index.d.ts +7 -0
  83. package/lib/reducers/data/index.js +11 -0
  84. package/lib/reducers/data/progression.d.ts +14 -0
  85. package/lib/reducers/data/progression.js +79 -0
  86. package/lib/reducers/data/skills.d.ts +6 -0
  87. package/lib/reducers/data/skills.js +15 -0
  88. package/lib/reducers/data/slides.d.ts +8 -0
  89. package/lib/reducers/{slides.js → data/slides.js} +4 -3
  90. package/lib/reducers/data/token.d.ts +5 -0
  91. package/lib/reducers/data/token.js +16 -0
  92. package/lib/reducers/index.d.ts +11 -8
  93. package/lib/reducers/index.js +3 -16
  94. package/lib/reducers/ui/finished-slides.d.ts +8 -0
  95. package/lib/reducers/{finished-slides.js → ui/finished-slides.js} +9 -6
  96. package/lib/reducers/ui/index.d.ts +7 -0
  97. package/lib/reducers/ui/index.js +11 -0
  98. package/lib/reducers/ui/navigation.d.ts +5 -0
  99. package/lib/reducers/{courses.js → ui/navigation.js} +9 -3
  100. package/lib/reducers/ui/review-status.d.ts +5 -0
  101. package/lib/reducers/{review-status.js → ui/review-status.js} +3 -2
  102. package/lib/reducers/ui/step-items.d.ts +14 -0
  103. package/lib/reducers/{step-items.js → ui/step-items.js} +7 -7
  104. package/lib/services/fetch-skills.d.ts +8 -0
  105. package/lib/services/{fetch-demo.js → fetch-skills.js} +28 -35
  106. package/lib/services/fetch-skills.mock.d.ts +3 -0
  107. package/lib/services/fetch-skills.mock.js +17 -0
  108. package/lib/services/{fetch-demo.test.js → fetch-skills.test.js} +31 -12
  109. package/lib/services/tools/fetch-responses.d.ts +7 -0
  110. package/lib/services/tools/fetch.mocks.d.ts +8 -0
  111. package/lib/services/{fetch.mocks.js → tools/fetch.mocks.js} +1 -0
  112. package/lib/types/common.d.ts +12 -0
  113. package/lib/types/skills.d.ts +7 -0
  114. package/lib/types/slides.d.ts +3 -21
  115. package/lib/types/views/skills.d.ts +24 -0
  116. package/{es/types/views.d.ts → lib/types/views/slides.d.ts} +7 -11
  117. package/package.json +3 -3
  118. package/src/actions/data/skills.ts +24 -0
  119. package/src/actions/data/slides.ts +89 -0
  120. package/src/actions/index.ts +27 -5
  121. package/src/actions/{finished-slides.ts → ui/finished-slides.ts} +5 -5
  122. package/src/actions/ui/is-fetching.ts +19 -0
  123. package/src/actions/{navigation.ts → ui/navigation.ts} +2 -2
  124. package/src/actions/{review-status.ts → ui/review-status.ts} +4 -4
  125. package/src/actions/{step-items.ts → ui/step-items.ts} +22 -4
  126. package/src/common/index.ts +2 -2
  127. package/src/configure-store.ts +40 -8
  128. package/src/fixtures/qcm-slide.ts +7 -3
  129. package/src/fixtures/temp-fixture.ts +1 -1
  130. package/src/index.test.tsx +1 -1
  131. package/src/index.tsx +69 -44
  132. package/src/middlewares/on-start-app.ts +23 -26
  133. package/src/reducers/data/index.ts +13 -0
  134. package/src/reducers/data/progression.ts +106 -0
  135. package/src/reducers/data/skills.ts +21 -0
  136. package/src/reducers/{slides.ts → data/slides.ts} +24 -21
  137. package/src/reducers/{review-status.ts → data/token.ts} +8 -6
  138. package/src/reducers/index.ts +3 -17
  139. package/src/reducers/{finished-slides.ts → ui/finished-slides.ts} +24 -14
  140. package/src/reducers/ui/index.ts +13 -0
  141. package/src/reducers/ui/navigation.ts +36 -0
  142. package/src/reducers/ui/review-status.ts +26 -0
  143. package/src/reducers/{step-items.ts → ui/step-items.ts} +34 -21
  144. package/src/services/fetch-skills.mock.ts +21 -0
  145. package/src/services/fetch-skills.test.ts +32 -0
  146. package/src/services/fetch-skills.ts +40 -0
  147. package/src/services/{fetch-responses.ts → tools/fetch-responses.ts} +3 -16
  148. package/src/services/{fetch.mocks.ts → tools/fetch.mocks.ts} +10 -10
  149. package/src/types/common.ts +15 -0
  150. package/src/types/globals.d.ts +2 -0
  151. package/src/types/skills.ts +8 -0
  152. package/src/types/slides.ts +3 -26
  153. package/src/types/views/skills.ts +27 -0
  154. package/src/types/{views.tsx → views/slides.ts} +7 -11
  155. package/es/actions/courses.d.ts +0 -6
  156. package/es/actions/courses.js +0 -5
  157. package/es/actions/data/is-fetching.d.ts +0 -5
  158. package/es/actions/data/is-fetching.js +0 -4
  159. package/es/actions/data/validate-slide.d.ts +0 -5
  160. package/es/actions/data/validate-slide.js +0 -6
  161. package/es/actions/finished-slides.d.ts +0 -7
  162. package/es/actions/review-status.d.ts +0 -7
  163. package/es/actions/slides.d.ts +0 -20
  164. package/es/reducers/courses.d.ts +0 -5
  165. package/es/reducers/data.d.ts +0 -7
  166. package/es/reducers/data.js +0 -76
  167. package/es/reducers/finished-slides.d.ts +0 -6
  168. package/es/reducers/navigation.d.ts +0 -8
  169. package/es/reducers/review-status.d.ts +0 -5
  170. package/es/reducers/slides.d.ts +0 -6
  171. package/es/reducers/step-items.d.ts +0 -6
  172. package/es/reducers/token.d.ts +0 -5
  173. package/es/reducers/token.js +0 -8
  174. package/es/services/fetch-demo.d.ts +0 -11
  175. package/es/services/fetch-demo.js +0 -26
  176. package/es/services/fetch-demo.test.js +0 -12
  177. package/es/services/fetch-responses.d.ts +0 -19
  178. package/es/services/fetch.mocks.d.ts +0 -9
  179. package/es/types/data/index.d.ts +0 -14
  180. package/es/types/dispatchers.d.ts +0 -17
  181. package/es/types/finished-slides.d.ts +0 -9
  182. package/es/types/review-status.d.ts +0 -1
  183. package/es/types/states.d.ts +0 -6
  184. package/es/types/step-items.d.ts +0 -26
  185. package/es/types/step-items.js +0 -5
  186. package/es/types/store-state.d.ts +0 -12
  187. package/es/types/utils.d.ts +0 -3
  188. package/es/types/views.js +0 -1
  189. package/lib/actions/courses.d.ts +0 -6
  190. package/lib/actions/courses.js +0 -5
  191. package/lib/actions/data/is-fetching.d.ts +0 -5
  192. package/lib/actions/data/is-fetching.js +0 -4
  193. package/lib/actions/data/validate-slide.d.ts +0 -5
  194. package/lib/actions/data/validate-slide.js +0 -6
  195. package/lib/actions/finished-slides.d.ts +0 -7
  196. package/lib/actions/review-status.d.ts +0 -7
  197. package/lib/actions/slides.d.ts +0 -20
  198. package/lib/reducers/courses.d.ts +0 -5
  199. package/lib/reducers/data.d.ts +0 -7
  200. package/lib/reducers/data.js +0 -77
  201. package/lib/reducers/finished-slides.d.ts +0 -6
  202. package/lib/reducers/navigation.d.ts +0 -8
  203. package/lib/reducers/navigation.js +0 -36
  204. package/lib/reducers/review-status.d.ts +0 -5
  205. package/lib/reducers/slides.d.ts +0 -6
  206. package/lib/reducers/step-items.d.ts +0 -6
  207. package/lib/reducers/token.d.ts +0 -5
  208. package/lib/reducers/token.js +0 -8
  209. package/lib/services/fetch-demo.d.ts +0 -11
  210. package/lib/services/fetch-demo.test.d.ts +0 -1
  211. package/lib/services/fetch-responses.d.ts +0 -19
  212. package/lib/services/fetch.mocks.d.ts +0 -9
  213. package/lib/types/data/index.d.ts +0 -14
  214. package/lib/types/data/index.js +0 -1
  215. package/lib/types/dispatchers.d.ts +0 -17
  216. package/lib/types/dispatchers.js +0 -1
  217. package/lib/types/finished-slides.d.ts +0 -9
  218. package/lib/types/finished-slides.js +0 -1
  219. package/lib/types/review-status.d.ts +0 -1
  220. package/lib/types/review-status.js +0 -1
  221. package/lib/types/states.d.ts +0 -6
  222. package/lib/types/states.js +0 -1
  223. package/lib/types/step-items.d.ts +0 -26
  224. package/lib/types/step-items.js +0 -5
  225. package/lib/types/store-state.d.ts +0 -12
  226. package/lib/types/store-state.js +0 -1
  227. package/lib/types/utils.d.ts +0 -3
  228. package/lib/types/utils.js +0 -1
  229. package/lib/types/views.js +0 -1
  230. package/src/actions/courses.ts +0 -11
  231. package/src/actions/data/is-fetching.ts +0 -12
  232. package/src/actions/data/validate-slide.ts +0 -15
  233. package/src/actions/slides.ts +0 -45
  234. package/src/reducers/courses.ts +0 -23
  235. package/src/reducers/data.ts +0 -88
  236. package/src/reducers/navigation.ts +0 -36
  237. package/src/reducers/token.ts +0 -17
  238. package/src/services/fetch-demo.test.ts +0 -16
  239. package/src/services/fetch-demo.ts +0 -57
  240. package/src/types/data/index.ts +0 -16
  241. package/src/types/dispatchers.ts +0 -18
  242. package/src/types/finished-slides.ts +0 -9
  243. package/src/types/review-status.ts +0 -1
  244. package/src/types/states.ts +0 -6
  245. package/src/types/step-items.ts +0 -31
  246. package/src/types/store-state.ts +0 -20
  247. package/src/types/utils.ts +0 -4
  248. /package/es/actions/{token.d.ts → data/token.d.ts} +0 -0
  249. /package/es/actions/{token.js → data/token.js} +0 -0
  250. /package/es/actions/{navigation.js → ui/navigation.js} +0 -0
  251. /package/es/actions/{review-status.js → ui/review-status.js} +0 -0
  252. /package/es/services/{fetch-demo.test.d.ts → fetch-skills.test.d.ts} +0 -0
  253. /package/es/services/{fetch-responses.js → tools/fetch-responses.js} +0 -0
  254. /package/es/types/{data/index.js → skills.js} +0 -0
  255. /package/es/types/{dispatchers.js → views/skills.js} +0 -0
  256. /package/es/types/{finished-slides.js → views/slides.js} +0 -0
  257. /package/lib/actions/{token.d.ts → data/token.d.ts} +0 -0
  258. /package/lib/actions/{token.js → data/token.js} +0 -0
  259. /package/lib/actions/{navigation.js → ui/navigation.js} +0 -0
  260. /package/lib/actions/{review-status.js → ui/review-status.js} +0 -0
  261. /package/{es/types/review-status.js → lib/services/fetch-skills.test.d.ts} +0 -0
  262. /package/lib/services/{fetch-responses.js → tools/fetch-responses.js} +0 -0
  263. /package/{es/types/states.js → lib/types/skills.js} +0 -0
  264. /package/{es/types/store-state.js → lib/types/views/skills.js} +0 -0
  265. /package/{es/types/utils.js → lib/types/views/slides.js} +0 -0
  266. /package/src/actions/{token.ts → data/token.ts} +0 -0
@@ -1,5 +0,0 @@
1
- export var RECEIVED_COURSE = '@@api/RECEIVED_COURSE';
2
- export var receivedCourse = function (course) { return ({
3
- type: RECEIVED_COURSE,
4
- payload: course
5
- }); };
@@ -1,5 +0,0 @@
1
- export declare const IS_FETCHING_TRUE = "@@is-fetching/TRUE";
2
- export declare type IsFetching = {
3
- type: typeof IS_FETCHING_TRUE;
4
- };
5
- export declare const setIsFetching: () => IsFetching;
@@ -1,4 +0,0 @@
1
- // -----------------------------------------------------------------------------
2
- export var IS_FETCHING_TRUE = '@@is-fetching/TRUE';
3
- // -----------------------------------------------------------------------------
4
- export var setIsFetching = function () { return ({ type: IS_FETCHING_TRUE }); };
@@ -1,5 +0,0 @@
1
- export declare const VALIDATE_SLIDE = "@@api/VALIDATE_SLIDE";
2
- export declare type ValidateSlide = {
3
- type: typeof VALIDATE_SLIDE;
4
- };
5
- export declare const validateSlide: () => ValidateSlide;
@@ -1,6 +0,0 @@
1
- // -----------------------------------------------------------------------------
2
- export var VALIDATE_SLIDE = '@@api/VALIDATE_SLIDE';
3
- // -----------------------------------------------------------------------------
4
- export var validateSlide = function () { return ({
5
- type: VALIDATE_SLIDE
6
- }); };
@@ -1,7 +0,0 @@
1
- import { UpdateFinishedSlidesPayload } from '../types/finished-slides';
2
- export declare const UPDATE_FINISHED_SLIDES = "@@finished-slides/UPDATE_FINISHED_SLIDES";
3
- export declare type UpdateFinishedSlides = {
4
- type: typeof UPDATE_FINISHED_SLIDES;
5
- payload: UpdateFinishedSlidesPayload;
6
- };
7
- export declare const updateFinishedSlides: (payload: UpdateFinishedSlidesPayload) => UpdateFinishedSlides;
@@ -1,7 +0,0 @@
1
- import { UpdateReviewStatusPayload } from '../types/review-status';
2
- export declare const UPDATE_REVIEW_STATUS = "@@review-status/UPDATE_REVIEW_STATUS";
3
- export declare type UpdateReviewStatus = {
4
- type: typeof UPDATE_REVIEW_STATUS;
5
- payload: UpdateReviewStatusPayload;
6
- };
7
- export declare const updateReviewStatus: (payload: UpdateReviewStatusPayload) => UpdateReviewStatus;
@@ -1,20 +0,0 @@
1
- import { Slide, UpdateSlidesOnNextPayload, UpdateSlidesOnValidationPayload } from '../types/slides';
2
- export declare const STORE_FIRST_SLIDE = "@@slide/STORE_FIRST_SLIDE";
3
- export declare const UPDATE_SLIDES_ON_VALIDATION = "@@slide/UPDATE_SLIDES_ON_VALIDATION";
4
- export declare const UPDATE_SLIDES_ON_NEXT = "@@slide/UPDATE_SLIDES_ON_NEXT";
5
- export declare type StoreFirstSlide = {
6
- type: typeof STORE_FIRST_SLIDE;
7
- payload: Slide;
8
- };
9
- export declare type UpdateSlidesOnValidation = {
10
- type: typeof UPDATE_SLIDES_ON_VALIDATION;
11
- payload: UpdateSlidesOnValidationPayload;
12
- };
13
- export declare type UpdateSlidesOnNext = {
14
- type: typeof UPDATE_SLIDES_ON_NEXT;
15
- payload: UpdateSlidesOnNextPayload;
16
- };
17
- export declare type SlidesAction = StoreFirstSlide | UpdateSlidesOnValidation | UpdateSlidesOnNext;
18
- export declare const storeFirstSlide: (slide: Slide) => StoreFirstSlide;
19
- export declare const updateSlidesOnValidation: (payload: UpdateSlidesOnValidationPayload) => UpdateSlidesOnValidation;
20
- export declare const updateSlidesOnNext: (payload: UpdateSlidesOnNextPayload) => UpdateSlidesOnNext;
@@ -1,5 +0,0 @@
1
- import { ReceivedCourse } from '../actions/courses';
2
- export declare type State = Array<unknown>;
3
- export declare const initialState: State;
4
- declare const reducer: (state: State, action: ReceivedCourse) => State;
5
- export default reducer;
@@ -1,7 +0,0 @@
1
- import { StoreToken } from '../actions/token';
2
- import { IsFetching } from '../actions/data/is-fetching';
3
- import { ValidateSlide } from '../actions/data/validate-slide';
4
- import { DataState } from '../types/data';
5
- declare type ApiActions = IsFetching | ValidateSlide | StoreToken;
6
- declare const data: (state: DataState, action: ApiActions) => DataState;
7
- export default data;
@@ -1,77 +0,0 @@
1
- import getOr from 'lodash/fp/getOr';
2
- import noop from 'lodash/fp/noop';
3
- import set from 'lodash/fp/set';
4
- import { STORE_TOKEN } from '../actions/token';
5
- import { IS_FETCHING_TRUE } from '../actions/data/is-fetching';
6
- import { VALIDATE_SLIDE } from '../actions/data/validate-slide';
7
- import { setToken } from './token';
8
- var defaultState = {
9
- isFetching: true,
10
- slideValidationResult: null,
11
- token: null
12
- };
13
- // eslint-disable-next-line default-param-last
14
- var data = function (state, action) {
15
- if (state === void 0) { state = defaultState; }
16
- switch (action.type) {
17
- case STORE_TOKEN: {
18
- return setToken(action.payload, state);
19
- }
20
- case VALIDATE_SLIDE: {
21
- var previousSlideNumber = getOr(-1, 'slideValidationResult.slideNumber', state);
22
- // hard coded for now
23
- return set('slideValidationResult', {
24
- slideNumber: previousSlideNumber + 1,
25
- result: 'success',
26
- // exitNode
27
- nextSlide: {
28
- questionText: 'Test',
29
- answerUI: {
30
- model: {
31
- answers: [
32
- {
33
- title: 'There is no need for a password',
34
- onClick: noop,
35
- selected: false
36
- },
37
- {
38
- title: 'Lorem ipsum',
39
- onClick: noop,
40
- selected: false
41
- },
42
- {
43
- title: 'Lorem',
44
- onClick: noop,
45
- selected: true,
46
- order: 1
47
- },
48
- {
49
- title: 'You need to have a password',
50
- onClick: noop,
51
- selected: false
52
- },
53
- {
54
- title: 'Pouet',
55
- onClick: noop,
56
- selected: true,
57
- order: 0
58
- }
59
- ],
60
- type: 'qcmDrag'
61
- },
62
- help: 'Help text will appear here'
63
- }
64
- }
65
- }, state);
66
- }
67
- case IS_FETCHING_TRUE: {
68
- return set('isFetching', true, state);
69
- }
70
- // case VALIDATE_SLIDE_FAILURE: {
71
- // return set('entities.isFetching', false, state);
72
- // }
73
- default:
74
- return state;
75
- }
76
- };
77
- export default data;
@@ -1,6 +0,0 @@
1
- import { UpdateFinishedSlides } from '../actions/finished-slides';
2
- import { FinishedSlides } from '../types/finished-slides';
3
- export declare type State = FinishedSlides;
4
- export declare const initialState: State;
5
- declare const reducer: (state: State, action: UpdateFinishedSlides) => State;
6
- export default reducer;
@@ -1,8 +0,0 @@
1
- import { ViewPath } from '../actions/navigation';
2
- import type { NavigateTo, NavigateBack } from '../actions/navigation';
3
- import { StoreState } from '../types/store-state';
4
- import { NavigationState as State } from '../types/states';
5
- export declare const initialState: State;
6
- declare const reducer: (state: State, action: NavigateTo | NavigateBack) => State;
7
- export declare const getCurrentViewName: (appState: StoreState) => ViewPath;
8
- export default reducer;
@@ -1,36 +0,0 @@
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 { NAVIGATE_BACK, NAVIGATE_TO } from '../actions/navigation';
11
- // -----------------------------------------------------------------------------
12
- // export type State = Array<string>;
13
- export var initialState = ['home'];
14
- // -----------------------------------------------------------------------------
15
- // eslint-disable-next-line default-param-last
16
- var reducer = function (state, action) {
17
- if (state === void 0) { state = initialState; }
18
- switch (action.type) {
19
- case NAVIGATE_TO: {
20
- return __spreadArray(__spreadArray([], state, true), [action.payload], false);
21
- }
22
- case NAVIGATE_BACK: {
23
- var newState = __spreadArray([], state, true);
24
- newState.pop();
25
- return newState;
26
- }
27
- default:
28
- return state;
29
- }
30
- };
31
- // -----------------------------------------------------------------------------
32
- export var getCurrentViewName = function (appState) {
33
- return appState.ui.navigation[appState.ui.navigation.length - 1];
34
- };
35
- // -----------------------------------------------------------------------------
36
- export default reducer;
@@ -1,5 +0,0 @@
1
- import { UpdateReviewStatus } from '../actions/review-status';
2
- export declare type State = 'finished' | 'ongoing';
3
- export declare const initialState: State;
4
- declare const reducer: (state: State, action: UpdateReviewStatus) => State;
5
- export default reducer;
@@ -1,6 +0,0 @@
1
- import { SlidesAction } from '../actions/slides';
2
- import { Slides } from '../types/slides';
3
- export declare type State = Slides;
4
- export declare const initialState: State;
5
- declare const reducer: (state: State, action: SlidesAction) => State;
6
- export default reducer;
@@ -1,6 +0,0 @@
1
- import { StepItemsAction } from '../actions/step-items';
2
- import { StepItems } from '../types/step-items';
3
- export declare type State = StepItems;
4
- export declare const initialState: State;
5
- declare const reducer: (state: State, action: StepItemsAction) => State;
6
- export default reducer;
@@ -1,5 +0,0 @@
1
- import { StoreState } from '../types/store-state';
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,8 +0,0 @@
1
- import set from 'lodash/fp/set';
2
- // -----------------------------------------------------------------------------
3
- export var initialState = null;
4
- // -----------------------------------------------------------------------------
5
- export var setToken = function (token, state) { return set('token', token, state); };
6
- // -----------------------------------------------------------------------------
7
- export var getToken = function (appState) { return appState.data.token; };
8
- // -----------------------------------------------------------------------------
@@ -1,11 +0,0 @@
1
- import { Fetch } from './fetch-responses';
2
- declare const fetchCourse: (fetch: Fetch) => (token: any, language: any, universalRef: any) => Promise<Course>;
3
- export declare type Course = {
4
- title: any;
5
- };
6
- export declare type CatalogHits = {
7
- hits: Course[];
8
- };
9
- export { fetchCourse };
10
- declare const _default: (token: any, language: any, universalRef: any) => Promise<Course>;
11
- export default _default;
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- export declare type _Response = {
2
- ok: boolean;
3
- status: number;
4
- statusText: string;
5
- json: () => Promise<unknown>;
6
- text: () => Promise<string>;
7
- };
8
- export declare type Fetch = (url?: string, options?: {
9
- headers: {
10
- authorization: string;
11
- };
12
- }) => Promise<_Response>;
13
- export declare class ResponseError extends Error {
14
- statusCode: number;
15
- constructor(statusCode: number, statusText: string, body?: string);
16
- }
17
- export declare const toJSON: (response: _Response) => Promise<unknown>;
18
- export declare const toText: (response: _Response) => Promise<string>;
19
- export declare const toVoid: (response: _Response) => Promise<void>;
@@ -1,9 +0,0 @@
1
- import { _Response } from './fetch-responses';
2
- export declare const toResponse: (statusCode: number, statusText: string, body: string) => Promise<_Response>;
3
- declare type FetchFunction = () => Promise<_Response>;
4
- export declare const okJSONResponse: (body: unknown) => FetchFunction;
5
- export declare const internalServerErrorJSONResponse: (body: unknown) => FetchFunction;
6
- export declare const notFoundJSONResponse: (body: unknown) => FetchFunction;
7
- export declare const okTextResponse: (body: string) => FetchFunction;
8
- export declare const internalServerErrorTextResponse: (body: string) => FetchFunction;
9
- export {};
@@ -1,14 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- import { validateSlide } from '../actions/data/validate-slide';
2
- import { updateFinishedSlides } from '../actions/finished-slides';
3
- import { navigateBack, navigateTo } from '../actions/navigation';
4
- import { updateReviewStatus } from '../actions/review-status';
5
- import { updateSlidesOnValidation, updateSlidesOnNext } from '../actions/slides';
6
- import { updateStepItemsOnValidation, updateStepItemsOnNext } from '../actions/step-items';
7
- export declare type Dispatchers = {
8
- navigateTo: typeof navigateTo;
9
- navigateBack: typeof navigateBack;
10
- validateSlide: typeof validateSlide;
11
- updateSlidesOnValidation: typeof updateSlidesOnValidation;
12
- updateSlidesOnNext: typeof updateSlidesOnNext;
13
- updateReviewStatus: typeof updateReviewStatus;
14
- updateStepItemsOnValidation: typeof updateStepItemsOnValidation;
15
- updateStepItemsOnNext: typeof updateStepItemsOnNext;
16
- updateFinishedSlides: typeof updateFinishedSlides;
17
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { SlideNumber } from './slides';
2
- export declare type FinishedSlides = {
3
- slideNumbers: SlideNumber[];
4
- [key: SlideNumber]: true;
5
- };
6
- export declare type UpdateFinishedSlidesPayload = {
7
- slideNumber: SlideNumber;
8
- value: true;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare type UpdateReviewStatusPayload = 'finished';
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export { Slides as SlidesState } from './slides';
2
- export { DataState } from './data';
3
- export { StepItems as StepItemsState } from './step-items';
4
- export { FinishedSlides as FinishedSlidesState } from './finished-slides';
5
- export { State as ReviewStatusState } from '../reducers/review-status';
6
- export declare type NavigationState = Array<'home' | 'onboarding' | 'slides'>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import { SlideNumber } from './slides';
2
- import { FinishedSlides } from './finished-slides';
3
- declare const ICON_VALUES: {
4
- readonly right: "right";
5
- readonly wrong: "wrong";
6
- };
7
- declare type IconValue = keyof typeof ICON_VALUES;
8
- export declare type StepItem = {
9
- current: boolean;
10
- icon: IconValue;
11
- value: string;
12
- };
13
- export declare type StepItems = {
14
- slideNumbers: SlideNumber[];
15
- [key: SlideNumber]: StepItem;
16
- };
17
- export declare type UpdateStepItemsOnValidationClickPayload = {
18
- stepNumber: SlideNumber;
19
- icon: IconValue;
20
- };
21
- export declare type UpdateStepItemsOnNextClickPayload = {
22
- stepNumber: SlideNumber;
23
- finishedSlides: FinishedSlides;
24
- current: boolean;
25
- };
26
- export {};
@@ -1,5 +0,0 @@
1
- var ICON_VALUES = {
2
- right: 'right',
3
- wrong: 'wrong'
4
- };
5
- export {};
@@ -1,12 +0,0 @@
1
- import { DataState, FinishedSlidesState, NavigationState, ReviewStatusState, SlidesState, StepItemsState } from './states';
2
- export declare type StoreState = {
3
- ui: {
4
- courses: unknown;
5
- navigation: NavigationState;
6
- slides: SlidesState;
7
- stepItems: StepItemsState;
8
- finishedSlides: FinishedSlidesState;
9
- reviewStatus: ReviewStatusState;
10
- };
11
- data: DataState;
12
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export declare type WithRequired<T, K extends keyof T> = T & {
2
- [P in K]-?: T[P];
3
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- export const RECEIVED_COURSE = '@@api/RECEIVED_COURSE';
2
-
3
- export type ReceivedCourse = {
4
- type: '@@api/RECEIVED_COURSE';
5
- payload: unknown;
6
- };
7
-
8
- export const receivedCourse = (course: unknown): ReceivedCourse => ({
9
- type: RECEIVED_COURSE,
10
- payload: course
11
- });
@@ -1,12 +0,0 @@
1
- // -----------------------------------------------------------------------------
2
-
3
- export const IS_FETCHING_TRUE = '@@is-fetching/TRUE';
4
-
5
- // -----------------------------------------------------------------------------
6
-
7
- export type IsFetching = {
8
- type: typeof IS_FETCHING_TRUE;
9
- };
10
-
11
- // -----------------------------------------------------------------------------
12
- export const setIsFetching = (): IsFetching => ({type: IS_FETCHING_TRUE});
@@ -1,15 +0,0 @@
1
- // -----------------------------------------------------------------------------
2
-
3
- export const VALIDATE_SLIDE = '@@api/VALIDATE_SLIDE';
4
-
5
- // -----------------------------------------------------------------------------
6
-
7
- export type ValidateSlide = {
8
- type: typeof VALIDATE_SLIDE;
9
- };
10
-
11
- // -----------------------------------------------------------------------------
12
-
13
- export const validateSlide = (): ValidateSlide => ({
14
- type: VALIDATE_SLIDE
15
- });
@@ -1,45 +0,0 @@
1
- import {Slide, UpdateSlidesOnNextPayload, UpdateSlidesOnValidationPayload} from '../types/slides';
2
-
3
- // -----------------------------------------------------------------------------
4
-
5
- export const STORE_FIRST_SLIDE = '@@slide/STORE_FIRST_SLIDE';
6
- export const UPDATE_SLIDES_ON_VALIDATION = '@@slide/UPDATE_SLIDES_ON_VALIDATION';
7
- export const UPDATE_SLIDES_ON_NEXT = '@@slide/UPDATE_SLIDES_ON_NEXT';
8
-
9
- // -----------------------------------------------------------------------------
10
-
11
- export type StoreFirstSlide = {
12
- type: typeof STORE_FIRST_SLIDE;
13
- payload: Slide;
14
- };
15
-
16
- export type UpdateSlidesOnValidation = {
17
- type: typeof UPDATE_SLIDES_ON_VALIDATION;
18
- payload: UpdateSlidesOnValidationPayload;
19
- };
20
-
21
- export type UpdateSlidesOnNext = {
22
- type: typeof UPDATE_SLIDES_ON_NEXT;
23
- payload: UpdateSlidesOnNextPayload;
24
- };
25
-
26
- export type SlidesAction = StoreFirstSlide | UpdateSlidesOnValidation | UpdateSlidesOnNext;
27
-
28
- // -----------------------------------------------------------------------------
29
-
30
- export const storeFirstSlide = (slide: Slide): StoreFirstSlide => ({
31
- type: STORE_FIRST_SLIDE,
32
- payload: slide
33
- });
34
-
35
- export const updateSlidesOnValidation = (
36
- payload: UpdateSlidesOnValidationPayload
37
- ): UpdateSlidesOnValidation => ({
38
- type: UPDATE_SLIDES_ON_VALIDATION,
39
- payload
40
- });
41
-
42
- export const updateSlidesOnNext = (payload: UpdateSlidesOnNextPayload): UpdateSlidesOnNext => ({
43
- type: UPDATE_SLIDES_ON_NEXT,
44
- payload
45
- });
@@ -1,23 +0,0 @@
1
- import {ReceivedCourse, RECEIVED_COURSE} from '../actions/courses';
2
-
3
- // -----------------------------------------------------------------------------
4
-
5
- export type State = Array<unknown>;
6
- export const initialState: State = [];
7
-
8
- // -----------------------------------------------------------------------------
9
-
10
- // eslint-disable-next-line default-param-last
11
- const reducer = (state: State = initialState, action: ReceivedCourse): State => {
12
- switch (action.type) {
13
- case RECEIVED_COURSE: {
14
- return [...state, action.payload];
15
- }
16
- default:
17
- return state;
18
- }
19
- };
20
-
21
- // -----------------------------------------------------------------------------
22
-
23
- export default reducer;
@@ -1,88 +0,0 @@
1
- import getOr from 'lodash/fp/getOr';
2
- import noop from 'lodash/fp/noop';
3
- import set from 'lodash/fp/set';
4
- import {StoreToken, STORE_TOKEN} from '../actions/token';
5
- import {IsFetching, IS_FETCHING_TRUE} from '../actions/data/is-fetching';
6
- import {ValidateSlide, VALIDATE_SLIDE} from '../actions/data/validate-slide';
7
- import {DataState} from '../types/data';
8
- import {setToken} from './token';
9
-
10
- const defaultState = {
11
- isFetching: true,
12
- slideValidationResult: null,
13
- token: null
14
- };
15
-
16
- type ApiActions = IsFetching | ValidateSlide | StoreToken;
17
-
18
- // eslint-disable-next-line default-param-last
19
- const data = (state: DataState = defaultState, action: ApiActions): DataState => {
20
- switch (action.type) {
21
- case STORE_TOKEN: {
22
- return setToken(action.payload, state);
23
- }
24
- case VALIDATE_SLIDE: {
25
- const previousSlideNumber: number = getOr(-1, 'slideValidationResult.slideNumber', state);
26
- // hard coded for now
27
- return set(
28
- 'slideValidationResult',
29
- {
30
- slideNumber: previousSlideNumber + 1,
31
- result: 'success',
32
- // exitNode
33
- nextSlide: {
34
- questionText: 'Test',
35
- answerUI: {
36
- model: {
37
- answers: [
38
- {
39
- title: 'There is no need for a password',
40
- onClick: noop,
41
- selected: false
42
- },
43
- {
44
- title: 'Lorem ipsum',
45
- onClick: noop,
46
- selected: false
47
- },
48
- {
49
- title: 'Lorem',
50
- onClick: noop,
51
- selected: true,
52
- order: 1
53
- },
54
- {
55
- title: 'You need to have a password',
56
- onClick: noop,
57
- selected: false
58
- },
59
- {
60
- title: 'Pouet',
61
- onClick: noop,
62
- selected: true,
63
- order: 0
64
- }
65
- ],
66
- type: 'qcmDrag'
67
- },
68
- help: 'Help text will appear here'
69
- }
70
- }
71
- },
72
- state
73
- );
74
- }
75
- case IS_FETCHING_TRUE: {
76
- return set('isFetching', true, state);
77
- }
78
-
79
- // case VALIDATE_SLIDE_FAILURE: {
80
- // return set('entities.isFetching', false, state);
81
- // }
82
-
83
- default:
84
- return state;
85
- }
86
- };
87
-
88
- export default data;