@coorpacademy/app-review 0.1.2 → 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.
- package/es/actions/data/skills.d.ts +13 -0
- package/es/actions/data/skills.js +10 -0
- package/es/actions/data/slides.d.ts +54 -0
- package/es/actions/{slides.js → data/slides.js} +5 -0
- package/es/actions/index.d.ts +19 -5
- package/es/actions/ui/finished-slides.d.ts +10 -0
- package/es/actions/{finished-slides.js → ui/finished-slides.js} +1 -0
- package/es/actions/ui/is-fetching.d.ts +10 -0
- package/es/actions/ui/is-fetching.js +6 -0
- package/{lib/actions → es/actions/ui}/navigation.d.ts +2 -2
- package/es/actions/ui/review-status.d.ts +7 -0
- package/{lib/actions → es/actions/ui}/step-items.d.ts +17 -1
- package/es/actions/{step-items.js → ui/step-items.js} +5 -0
- package/es/common/index.d.ts +1 -1
- package/es/common/index.js +1 -1
- package/es/configure-store.d.ts +34 -4
- package/es/configure-store.js +1 -2
- package/es/fixtures/qcm-slide.js +7 -3
- package/es/fixtures/temp-fixture.d.ts +1 -1
- package/es/index.js +54 -36
- package/es/index.test.js +1 -1
- package/es/middlewares/on-start-app.d.ts +2 -3
- package/es/middlewares/on-start-app.js +18 -17
- package/es/reducers/data/index.d.ts +7 -0
- package/es/reducers/data/index.js +11 -0
- package/es/reducers/data/progression.d.ts +14 -0
- package/es/reducers/data/progression.js +78 -0
- package/es/reducers/data/skills.d.ts +6 -0
- package/es/reducers/{courses.js → data/skills.js} +3 -4
- package/es/reducers/data/slides.d.ts +8 -0
- package/es/reducers/{slides.js → data/slides.js} +4 -3
- package/es/reducers/data/token.d.ts +5 -0
- package/es/reducers/data/token.js +15 -0
- package/es/reducers/index.d.ts +11 -8
- package/es/reducers/index.js +3 -16
- package/es/reducers/ui/finished-slides.d.ts +8 -0
- package/es/reducers/{finished-slides.js → ui/finished-slides.js} +9 -6
- package/es/reducers/ui/index.d.ts +7 -0
- package/es/reducers/ui/index.js +11 -0
- package/es/reducers/ui/navigation.d.ts +5 -0
- package/es/reducers/{navigation.js → ui/navigation.js} +4 -7
- package/es/reducers/ui/review-status.d.ts +5 -0
- package/es/reducers/{review-status.js → ui/review-status.js} +3 -2
- package/es/reducers/ui/step-items.d.ts +14 -0
- package/es/reducers/{step-items.js → ui/step-items.js} +7 -7
- package/es/services/fetch-skills.d.ts +8 -0
- package/es/services/fetch-skills.js +23 -0
- package/es/services/fetch-skills.mock.d.ts +3 -0
- package/es/services/fetch-skills.mock.js +17 -0
- package/es/services/fetch-skills.test.js +22 -0
- package/es/services/tools/fetch-responses.d.ts +7 -0
- package/es/services/tools/fetch.mocks.d.ts +8 -0
- package/es/services/{fetch.mocks.js → tools/fetch.mocks.js} +1 -0
- package/es/types/common.d.ts +12 -0
- package/es/types/skills.d.ts +7 -0
- package/es/types/slides.d.ts +3 -21
- package/es/types/views/skills.d.ts +24 -0
- package/{lib/types/views.d.ts → es/types/views/slides.d.ts} +7 -11
- package/lib/actions/data/skills.d.ts +13 -0
- package/lib/actions/data/skills.js +10 -0
- package/lib/actions/data/slides.d.ts +54 -0
- package/lib/actions/{slides.js → data/slides.js} +5 -0
- package/lib/actions/index.d.ts +19 -5
- package/lib/actions/ui/finished-slides.d.ts +10 -0
- package/lib/actions/{finished-slides.js → ui/finished-slides.js} +1 -0
- package/lib/actions/ui/is-fetching.d.ts +10 -0
- package/lib/actions/ui/is-fetching.js +6 -0
- package/{es/actions → lib/actions/ui}/navigation.d.ts +2 -2
- package/lib/actions/ui/review-status.d.ts +7 -0
- package/{es/actions → lib/actions/ui}/step-items.d.ts +17 -1
- package/lib/actions/{step-items.js → ui/step-items.js} +5 -0
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js +1 -1
- package/lib/configure-store.d.ts +34 -4
- package/lib/configure-store.js +1 -2
- package/lib/fixtures/qcm-slide.js +7 -3
- package/lib/fixtures/temp-fixture.d.ts +1 -1
- package/lib/index.js +57 -37
- package/lib/index.test.js +1 -1
- package/lib/middlewares/on-start-app.d.ts +2 -3
- package/lib/middlewares/on-start-app.js +18 -17
- package/lib/reducers/data/index.d.ts +7 -0
- package/lib/reducers/data/index.js +11 -0
- package/lib/reducers/data/progression.d.ts +14 -0
- package/lib/reducers/data/progression.js +79 -0
- package/lib/reducers/data/skills.d.ts +6 -0
- package/lib/reducers/data/skills.js +15 -0
- package/lib/reducers/data/slides.d.ts +8 -0
- package/lib/reducers/{slides.js → data/slides.js} +4 -3
- package/lib/reducers/data/token.d.ts +5 -0
- package/lib/reducers/data/token.js +16 -0
- package/lib/reducers/index.d.ts +11 -8
- package/lib/reducers/index.js +3 -16
- package/lib/reducers/ui/finished-slides.d.ts +8 -0
- package/lib/reducers/{finished-slides.js → ui/finished-slides.js} +9 -6
- package/lib/reducers/ui/index.d.ts +7 -0
- package/lib/reducers/ui/index.js +11 -0
- package/lib/reducers/ui/navigation.d.ts +5 -0
- package/lib/reducers/{courses.js → ui/navigation.js} +9 -3
- package/lib/reducers/ui/review-status.d.ts +5 -0
- package/lib/reducers/{review-status.js → ui/review-status.js} +3 -2
- package/lib/reducers/ui/step-items.d.ts +14 -0
- package/lib/reducers/{step-items.js → ui/step-items.js} +7 -7
- package/lib/services/fetch-skills.d.ts +8 -0
- package/lib/services/{fetch-demo.js → fetch-skills.js} +28 -35
- package/lib/services/fetch-skills.mock.d.ts +3 -0
- package/lib/services/fetch-skills.mock.js +17 -0
- package/lib/services/{fetch-demo.test.js → fetch-skills.test.js} +31 -12
- package/lib/services/tools/fetch-responses.d.ts +7 -0
- package/lib/services/tools/fetch.mocks.d.ts +8 -0
- package/lib/services/{fetch.mocks.js → tools/fetch.mocks.js} +1 -0
- package/lib/types/common.d.ts +12 -0
- package/lib/types/skills.d.ts +7 -0
- package/lib/types/slides.d.ts +3 -21
- package/lib/types/views/skills.d.ts +24 -0
- package/{es/types/views.d.ts → lib/types/views/slides.d.ts} +7 -11
- package/package.json +3 -3
- package/src/actions/data/skills.ts +24 -0
- package/src/actions/data/slides.ts +89 -0
- package/src/actions/index.ts +27 -5
- package/src/actions/{finished-slides.ts → ui/finished-slides.ts} +5 -5
- package/src/actions/ui/is-fetching.ts +19 -0
- package/src/actions/{navigation.ts → ui/navigation.ts} +2 -2
- package/src/actions/{review-status.ts → ui/review-status.ts} +4 -4
- package/src/actions/{step-items.ts → ui/step-items.ts} +22 -4
- package/src/common/index.ts +2 -2
- package/src/configure-store.ts +40 -8
- package/src/fixtures/qcm-slide.ts +7 -3
- package/src/fixtures/temp-fixture.ts +1 -1
- package/src/index.test.tsx +1 -1
- package/src/index.tsx +69 -44
- package/src/middlewares/on-start-app.ts +23 -26
- package/src/reducers/data/index.ts +13 -0
- package/src/reducers/data/progression.ts +106 -0
- package/src/reducers/data/skills.ts +21 -0
- package/src/reducers/{slides.ts → data/slides.ts} +24 -21
- package/src/reducers/{review-status.ts → data/token.ts} +8 -6
- package/src/reducers/index.ts +3 -17
- package/src/reducers/{finished-slides.ts → ui/finished-slides.ts} +24 -14
- package/src/reducers/ui/index.ts +13 -0
- package/src/reducers/ui/navigation.ts +36 -0
- package/src/reducers/ui/review-status.ts +26 -0
- package/src/reducers/{step-items.ts → ui/step-items.ts} +34 -21
- package/src/services/fetch-skills.mock.ts +21 -0
- package/src/services/fetch-skills.test.ts +32 -0
- package/src/services/fetch-skills.ts +40 -0
- package/src/services/{fetch-responses.ts → tools/fetch-responses.ts} +3 -16
- package/src/services/{fetch.mocks.ts → tools/fetch.mocks.ts} +10 -10
- package/src/types/common.ts +15 -0
- package/src/types/globals.d.ts +2 -0
- package/src/types/skills.ts +8 -0
- package/src/types/slides.ts +3 -26
- package/src/types/views/skills.ts +27 -0
- package/src/types/{views.tsx → views/slides.ts} +7 -11
- package/es/actions/courses.d.ts +0 -6
- package/es/actions/courses.js +0 -5
- package/es/actions/data/is-fetching.d.ts +0 -5
- package/es/actions/data/is-fetching.js +0 -4
- package/es/actions/data/validate-slide.d.ts +0 -5
- package/es/actions/data/validate-slide.js +0 -6
- package/es/actions/finished-slides.d.ts +0 -7
- package/es/actions/review-status.d.ts +0 -7
- package/es/actions/slides.d.ts +0 -20
- package/es/reducers/courses.d.ts +0 -5
- package/es/reducers/data.d.ts +0 -7
- package/es/reducers/data.js +0 -76
- package/es/reducers/finished-slides.d.ts +0 -6
- package/es/reducers/navigation.d.ts +0 -8
- package/es/reducers/review-status.d.ts +0 -5
- package/es/reducers/slides.d.ts +0 -6
- package/es/reducers/step-items.d.ts +0 -6
- package/es/reducers/token.d.ts +0 -5
- package/es/reducers/token.js +0 -8
- package/es/services/fetch-demo.d.ts +0 -11
- package/es/services/fetch-demo.js +0 -26
- package/es/services/fetch-demo.test.js +0 -12
- package/es/services/fetch-responses.d.ts +0 -19
- package/es/services/fetch.mocks.d.ts +0 -9
- package/es/types/data/index.d.ts +0 -14
- package/es/types/dispatchers.d.ts +0 -17
- package/es/types/finished-slides.d.ts +0 -9
- package/es/types/review-status.d.ts +0 -1
- package/es/types/states.d.ts +0 -6
- package/es/types/step-items.d.ts +0 -26
- package/es/types/step-items.js +0 -5
- package/es/types/store-state.d.ts +0 -12
- package/es/types/utils.d.ts +0 -3
- package/es/types/views.js +0 -1
- package/lib/actions/courses.d.ts +0 -6
- package/lib/actions/courses.js +0 -5
- package/lib/actions/data/is-fetching.d.ts +0 -5
- package/lib/actions/data/is-fetching.js +0 -4
- package/lib/actions/data/validate-slide.d.ts +0 -5
- package/lib/actions/data/validate-slide.js +0 -6
- package/lib/actions/finished-slides.d.ts +0 -7
- package/lib/actions/review-status.d.ts +0 -7
- package/lib/actions/slides.d.ts +0 -20
- package/lib/reducers/courses.d.ts +0 -5
- package/lib/reducers/data.d.ts +0 -7
- package/lib/reducers/data.js +0 -77
- package/lib/reducers/finished-slides.d.ts +0 -6
- package/lib/reducers/navigation.d.ts +0 -8
- package/lib/reducers/navigation.js +0 -36
- package/lib/reducers/review-status.d.ts +0 -5
- package/lib/reducers/slides.d.ts +0 -6
- package/lib/reducers/step-items.d.ts +0 -6
- package/lib/reducers/token.d.ts +0 -5
- package/lib/reducers/token.js +0 -8
- package/lib/services/fetch-demo.d.ts +0 -11
- package/lib/services/fetch-demo.test.d.ts +0 -1
- package/lib/services/fetch-responses.d.ts +0 -19
- package/lib/services/fetch.mocks.d.ts +0 -9
- package/lib/types/data/index.d.ts +0 -14
- package/lib/types/data/index.js +0 -1
- package/lib/types/dispatchers.d.ts +0 -17
- package/lib/types/dispatchers.js +0 -1
- package/lib/types/finished-slides.d.ts +0 -9
- package/lib/types/finished-slides.js +0 -1
- package/lib/types/review-status.d.ts +0 -1
- package/lib/types/review-status.js +0 -1
- package/lib/types/states.d.ts +0 -6
- package/lib/types/states.js +0 -1
- package/lib/types/step-items.d.ts +0 -26
- package/lib/types/step-items.js +0 -5
- package/lib/types/store-state.d.ts +0 -12
- package/lib/types/store-state.js +0 -1
- package/lib/types/utils.d.ts +0 -3
- package/lib/types/utils.js +0 -1
- package/lib/types/views.js +0 -1
- package/src/actions/courses.ts +0 -11
- package/src/actions/data/is-fetching.ts +0 -12
- package/src/actions/data/validate-slide.ts +0 -15
- package/src/actions/slides.ts +0 -45
- package/src/reducers/courses.ts +0 -23
- package/src/reducers/data.ts +0 -88
- package/src/reducers/navigation.ts +0 -36
- package/src/reducers/token.ts +0 -17
- package/src/services/fetch-demo.test.ts +0 -16
- package/src/services/fetch-demo.ts +0 -57
- package/src/types/data/index.ts +0 -16
- package/src/types/dispatchers.ts +0 -18
- package/src/types/finished-slides.ts +0 -9
- package/src/types/review-status.ts +0 -1
- package/src/types/states.ts +0 -6
- package/src/types/step-items.ts +0 -31
- package/src/types/store-state.ts +0 -20
- package/src/types/utils.ts +0 -4
- /package/es/actions/{token.d.ts → data/token.d.ts} +0 -0
- /package/es/actions/{token.js → data/token.js} +0 -0
- /package/es/actions/{navigation.js → ui/navigation.js} +0 -0
- /package/es/actions/{review-status.js → ui/review-status.js} +0 -0
- /package/es/services/{fetch-demo.test.d.ts → fetch-skills.test.d.ts} +0 -0
- /package/es/services/{fetch-responses.js → tools/fetch-responses.js} +0 -0
- /package/es/types/{data/index.js → skills.js} +0 -0
- /package/es/types/{dispatchers.js → views/skills.js} +0 -0
- /package/es/types/{finished-slides.js → views/slides.js} +0 -0
- /package/lib/actions/{token.d.ts → data/token.d.ts} +0 -0
- /package/lib/actions/{token.js → data/token.js} +0 -0
- /package/lib/actions/{navigation.js → ui/navigation.js} +0 -0
- /package/lib/actions/{review-status.js → ui/review-status.js} +0 -0
- /package/{es/types/review-status.js → lib/services/fetch-skills.test.d.ts} +0 -0
- /package/lib/services/{fetch-responses.js → tools/fetch-responses.js} +0 -0
- /package/{es/types/states.js → lib/types/skills.js} +0 -0
- /package/{es/types/store-state.js → lib/types/views/skills.js} +0 -0
- /package/{es/types/utils.js → lib/types/views/slides.js} +0 -0
- /package/src/actions/{token.ts → data/token.ts} +0 -0
package/lib/actions/courses.js
DELETED
|
@@ -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,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;
|
package/lib/actions/slides.d.ts
DELETED
|
@@ -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;
|
package/lib/reducers/data.d.ts
DELETED
|
@@ -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;
|
package/lib/reducers/data.js
DELETED
|
@@ -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;
|
package/lib/reducers/slides.d.ts
DELETED
|
@@ -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;
|
package/lib/reducers/token.d.ts
DELETED
|
@@ -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'];
|
package/lib/reducers/token.js
DELETED
|
@@ -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
|
-
};
|
package/lib/types/data/index.js
DELETED
|
@@ -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
|
-
};
|
package/lib/types/dispatchers.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type UpdateReviewStatusPayload = 'finished';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/states.d.ts
DELETED
|
@@ -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'>;
|
package/lib/types/states.js
DELETED
|
@@ -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 {};
|
package/lib/types/step-items.js
DELETED
|
@@ -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
|
-
};
|
package/lib/types/store-state.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/utils.d.ts
DELETED
package/lib/types/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/views.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/actions/courses.ts
DELETED
|
@@ -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
|
-
});
|
package/src/actions/slides.ts
DELETED
|
@@ -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
|
-
});
|
package/src/reducers/courses.ts
DELETED
|
@@ -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;
|
package/src/reducers/data.ts
DELETED
|
@@ -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;
|