@coorpacademy/app-review 0.0.21-alpha.4 → 0.1.1
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/courses.d.ts +2 -3
- package/es/actions/data/is-fetching.d.ts +5 -0
- package/es/actions/data/is-fetching.js +4 -0
- package/es/actions/data/validate-slide.d.ts +5 -0
- package/es/actions/data/validate-slide.js +6 -0
- package/es/actions/finished-slides.d.ts +7 -0
- package/es/actions/finished-slides.js +7 -0
- package/es/actions/index.d.ts +2 -5
- package/es/actions/index.js +1 -3
- package/es/actions/navigation.d.ts +5 -6
- package/es/actions/review-status.d.ts +7 -0
- package/es/actions/review-status.js +7 -0
- package/es/actions/slides.d.ts +20 -0
- package/es/actions/slides.js +17 -0
- package/es/actions/step-items.d.ts +14 -0
- package/es/actions/step-items.js +12 -0
- package/es/actions/token.d.ts +0 -1
- package/es/common/index.d.ts +8 -0
- package/es/common/index.js +8 -0
- package/es/configure-store.d.ts +3 -12
- package/es/configure-store.js +5 -7
- package/es/fixtures/qcm-slide.d.ts +2 -0
- package/es/fixtures/qcm-slide.js +29 -0
- package/es/fixtures/temp-fixture.d.ts +3 -0
- package/es/fixtures/temp-fixture.js +84 -0
- package/es/helpers/css-register.d.ts +1 -0
- package/es/helpers/css-register.js +2 -0
- package/es/index.d.ts +5 -12
- package/es/index.js +62 -14
- package/es/index.test.d.ts +1 -0
- package/es/index.test.js +52 -0
- package/es/middlewares/on-start-app.d.ts +1 -2
- package/es/middlewares/on-start-app.js +20 -9
- package/es/reducers/courses.d.ts +2 -3
- package/es/reducers/courses.js +2 -1
- package/es/reducers/data.d.ts +7 -0
- package/es/reducers/data.js +76 -0
- package/es/reducers/finished-slides.d.ts +6 -0
- package/es/reducers/finished-slides.js +32 -0
- package/es/reducers/index.d.ts +11 -6
- package/es/reducers/index.js +14 -4
- package/es/reducers/navigation.d.ts +4 -3
- package/es/reducers/navigation.js +4 -1
- package/es/reducers/review-status.d.ts +5 -0
- package/es/reducers/review-status.js +15 -0
- package/es/reducers/slides.d.ts +6 -0
- package/es/reducers/slides.js +112 -0
- package/es/reducers/step-items.d.ts +6 -0
- package/es/reducers/step-items.js +75 -0
- package/es/reducers/token.d.ts +5 -7
- package/es/reducers/token.js +4 -12
- package/es/services/fetch-demo.d.ts +0 -1
- package/es/services/fetch-demo.test.d.ts +0 -1
- package/es/services/fetch-responses.d.ts +6 -7
- package/es/services/fetch-responses.js +2 -2
- package/es/services/fetch.mocks.d.ts +3 -4
- package/es/services/fetch.mocks.js +3 -3
- package/es/types/common.d.ts +7 -0
- package/es/types/common.js +1 -0
- package/es/types/data/index.d.ts +14 -0
- package/es/types/data/index.js +1 -0
- package/es/types/dispatchers.d.ts +17 -0
- package/es/types/dispatchers.js +1 -0
- package/es/types/finished-slides.d.ts +9 -0
- package/es/types/finished-slides.js +1 -0
- package/es/types/review-status.d.ts +1 -0
- package/es/types/review-status.js +1 -0
- package/es/types/slides.d.ts +87 -0
- package/es/types/slides.js +1 -0
- package/es/types/states.d.ts +6 -0
- package/es/types/states.js +1 -0
- package/es/types/step-items.d.ts +26 -0
- package/es/types/step-items.js +5 -0
- package/es/types/store-state.d.ts +12 -0
- package/es/types/store-state.js +1 -0
- package/es/types/utils.d.ts +3 -0
- package/es/types/utils.js +1 -0
- package/es/types/views.d.ts +64 -0
- package/es/types/views.js +1 -0
- package/lib/actions/courses.d.ts +2 -3
- package/lib/actions/data/is-fetching.d.ts +5 -0
- package/lib/actions/data/is-fetching.js +4 -0
- package/lib/actions/data/validate-slide.d.ts +5 -0
- package/lib/actions/data/validate-slide.js +6 -0
- package/lib/actions/finished-slides.d.ts +7 -0
- package/lib/actions/finished-slides.js +7 -0
- package/lib/actions/index.d.ts +2 -5
- package/lib/actions/index.js +1 -3
- package/lib/actions/navigation.d.ts +5 -6
- package/lib/actions/review-status.d.ts +7 -0
- package/lib/actions/review-status.js +7 -0
- package/lib/actions/slides.d.ts +20 -0
- package/lib/actions/slides.js +17 -0
- package/lib/actions/step-items.d.ts +14 -0
- package/lib/actions/step-items.js +12 -0
- package/lib/actions/token.d.ts +0 -1
- package/lib/common/index.d.ts +8 -0
- package/lib/common/index.js +8 -0
- package/lib/configure-store.d.ts +3 -12
- package/lib/configure-store.js +10 -59
- package/lib/fixtures/qcm-slide.d.ts +2 -0
- package/lib/fixtures/qcm-slide.js +29 -0
- package/lib/fixtures/temp-fixture.d.ts +3 -0
- package/lib/fixtures/temp-fixture.js +84 -0
- package/lib/helpers/css-register.d.ts +1 -0
- package/lib/helpers/css-register.js +2 -0
- package/lib/index.d.ts +5 -12
- package/lib/index.js +71 -34
- package/lib/index.test.d.ts +1 -0
- package/lib/index.test.js +160 -0
- package/lib/middlewares/on-start-app.d.ts +1 -2
- package/lib/middlewares/on-start-app.js +29 -16
- package/lib/reducers/courses.d.ts +2 -3
- package/lib/reducers/courses.js +2 -1
- package/lib/reducers/data.d.ts +7 -0
- package/lib/reducers/data.js +77 -0
- package/lib/reducers/finished-slides.d.ts +6 -0
- package/lib/reducers/finished-slides.js +44 -0
- package/lib/reducers/index.d.ts +11 -6
- package/lib/reducers/index.js +14 -4
- package/lib/reducers/navigation.d.ts +4 -3
- package/lib/reducers/navigation.js +6 -1
- package/lib/reducers/review-status.d.ts +5 -0
- package/lib/reducers/review-status.js +16 -0
- package/lib/reducers/slides.d.ts +6 -0
- package/lib/reducers/slides.js +119 -0
- package/lib/reducers/step-items.d.ts +6 -0
- package/lib/reducers/step-items.js +87 -0
- package/lib/reducers/token.d.ts +5 -7
- package/lib/reducers/token.js +4 -13
- package/lib/services/fetch-demo.d.ts +0 -1
- package/lib/services/fetch-demo.js +25 -23
- package/lib/services/fetch-demo.test.d.ts +0 -1
- package/lib/services/fetch-responses.d.ts +6 -7
- package/lib/services/fetch-responses.js +2 -2
- package/lib/services/fetch.mocks.d.ts +3 -4
- package/lib/services/fetch.mocks.js +28 -16
- package/lib/types/common.d.ts +7 -0
- package/lib/types/common.js +1 -0
- package/lib/types/data/index.d.ts +14 -0
- package/lib/types/data/index.js +1 -0
- package/lib/types/dispatchers.d.ts +17 -0
- package/lib/types/dispatchers.js +1 -0
- package/lib/types/finished-slides.d.ts +9 -0
- package/lib/types/finished-slides.js +1 -0
- package/lib/types/review-status.d.ts +1 -0
- package/lib/types/review-status.js +1 -0
- package/lib/types/slides.d.ts +87 -0
- package/lib/types/slides.js +1 -0
- package/lib/types/states.d.ts +6 -0
- package/lib/types/states.js +1 -0
- package/lib/types/step-items.d.ts +26 -0
- package/lib/types/step-items.js +5 -0
- package/lib/types/store-state.d.ts +12 -0
- package/lib/types/store-state.js +1 -0
- package/lib/types/utils.d.ts +3 -0
- package/lib/types/utils.js +1 -0
- package/lib/types/views.d.ts +64 -0
- package/lib/types/views.js +1 -0
- package/package.json +21 -7
- package/src/actions/courses.ts +2 -2
- package/src/actions/data/is-fetching.ts +12 -0
- package/src/actions/data/validate-slide.ts +15 -0
- package/src/actions/finished-slides.ts +21 -0
- package/src/actions/index.ts +8 -5
- package/src/actions/navigation.ts +6 -5
- package/src/actions/review-status.ts +19 -0
- package/src/actions/slides.ts +45 -0
- package/src/actions/step-items.ts +39 -0
- package/src/common/index.ts +14 -0
- package/src/configure-store.ts +14 -22
- package/src/fixtures/qcm-slide.ts +31 -0
- package/src/fixtures/temp-fixture.ts +94 -0
- package/src/helpers/css-modules-require-hook.d.ts +4 -0
- package/src/helpers/css-register.ts +3 -0
- package/src/index.test.tsx +82 -0
- package/src/index.tsx +75 -22
- package/src/middlewares/on-start-app.ts +35 -20
- package/src/reducers/courses.ts +3 -2
- package/src/reducers/data.ts +88 -0
- package/src/reducers/finished-slides.ts +48 -0
- package/src/reducers/index.ts +14 -4
- package/src/reducers/navigation.ts +7 -3
- package/src/reducers/review-status.ts +23 -0
- package/src/reducers/slides.ts +136 -0
- package/src/reducers/step-items.ts +112 -0
- package/src/reducers/token.ts +6 -15
- package/src/services/fetch-demo.ts +17 -15
- package/src/services/fetch-responses.ts +7 -7
- package/src/services/fetch.mocks.ts +29 -14
- package/src/types/common.ts +8 -0
- package/src/types/data/index.ts +16 -0
- package/src/types/dispatchers.ts +18 -0
- package/src/types/finished-slides.ts +9 -0
- package/src/types/globals.d.ts +6 -0
- package/src/types/review-status.ts +1 -0
- package/src/types/slides.ts +107 -0
- package/src/types/states.ts +6 -0
- package/src/types/step-items.ts +31 -0
- package/src/types/store-state.ts +20 -0
- package/src/types/utils.ts +4 -0
- package/src/types/views.tsx +69 -0
- package/es/actions/courses.d.ts.map +0 -1
- package/es/actions/index.d.ts.map +0 -1
- package/es/actions/navigation.d.ts.map +0 -1
- package/es/actions/token.d.ts.map +0 -1
- package/es/components/__tmp-backup-vues-mobile/revision-home.d.ts +0 -10
- package/es/components/__tmp-backup-vues-mobile/revision-home.d.ts.map +0 -1
- package/es/components/__tmp-backup-vues-mobile/revision-home.js +0 -83
- package/es/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts +0 -1
- package/es/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts.map +0 -1
- package/es/components/__tmp-backup-vues-mobile/revision-home.stories.js +0 -14
- package/es/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts +0 -4
- package/es/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts.map +0 -1
- package/es/components/__tmp-backup-vues-mobile/revision-onboarding.js +0 -57
- package/es/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts +0 -19
- package/es/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts.map +0 -1
- package/es/components/__tmp-backup-vues-mobile/revision-quizzer.js +0 -120
- package/es/configure-store.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/es/middlewares/on-start-app.d.ts.map +0 -1
- package/es/reducers/courses.d.ts.map +0 -1
- package/es/reducers/index.d.ts.map +0 -1
- package/es/reducers/navigation.d.ts.map +0 -1
- package/es/reducers/token.d.ts.map +0 -1
- package/es/services/fetch-demo.d.ts.map +0 -1
- package/es/services/fetch-demo.test.d.ts.map +0 -1
- package/es/services/fetch-responses.d.ts.map +0 -1
- package/es/services/fetch.mocks.d.ts.map +0 -1
- package/lib/actions/courses.d.ts.map +0 -1
- package/lib/actions/index.d.ts.map +0 -1
- package/lib/actions/navigation.d.ts.map +0 -1
- package/lib/actions/token.d.ts.map +0 -1
- package/lib/components/__tmp-backup-vues-mobile/revision-home.d.ts +0 -10
- package/lib/components/__tmp-backup-vues-mobile/revision-home.d.ts.map +0 -1
- package/lib/components/__tmp-backup-vues-mobile/revision-home.js +0 -98
- package/lib/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts +0 -1
- package/lib/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts.map +0 -1
- package/lib/components/__tmp-backup-vues-mobile/revision-home.stories.js +0 -14
- package/lib/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts +0 -4
- package/lib/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts.map +0 -1
- package/lib/components/__tmp-backup-vues-mobile/revision-onboarding.js +0 -60
- package/lib/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts +0 -19
- package/lib/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts.map +0 -1
- package/lib/components/__tmp-backup-vues-mobile/revision-quizzer.js +0 -128
- package/lib/configure-store.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/middlewares/on-start-app.d.ts.map +0 -1
- package/lib/reducers/courses.d.ts.map +0 -1
- package/lib/reducers/index.d.ts.map +0 -1
- package/lib/reducers/navigation.d.ts.map +0 -1
- package/lib/reducers/token.d.ts.map +0 -1
- package/lib/services/fetch-demo.d.ts.map +0 -1
- package/lib/services/fetch-demo.test.d.ts.map +0 -1
- package/lib/services/fetch-responses.d.ts.map +0 -1
- package/lib/services/fetch.mocks.d.ts.map +0 -1
- package/src/components/__tmp-backup-vues-mobile/revision-home.stories.tsx +0 -16
- package/src/components/__tmp-backup-vues-mobile/revision-home.tsx +0 -125
- package/src/components/__tmp-backup-vues-mobile/revision-onboarding.tsx +0 -84
- package/src/components/__tmp-backup-vues-mobile/revision-quizzer.tsx +0 -176
package/es/actions/courses.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare const RECEIVED_COURSE = "@@api/RECEIVED_COURSE";
|
|
2
2
|
export declare type ReceivedCourse = {
|
|
3
3
|
type: '@@api/RECEIVED_COURSE';
|
|
4
|
-
payload:
|
|
4
|
+
payload: unknown;
|
|
5
5
|
};
|
|
6
|
-
export declare const receivedCourse: (course:
|
|
7
|
-
//# sourceMappingURL=courses.d.ts.map
|
|
6
|
+
export declare const receivedCourse: (course: unknown) => ReceivedCourse;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// -----------------------------------------------------------------------------
|
|
2
|
+
export const IS_FETCHING_TRUE = '@@is-fetching/TRUE';
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
export const setIsFetching = () => ({ type: IS_FETCHING_TRUE });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// -----------------------------------------------------------------------------
|
|
2
|
+
export const VALIDATE_SLIDE = '@@api/VALIDATE_SLIDE';
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
export const validateSlide = () => ({
|
|
5
|
+
type: VALIDATE_SLIDE
|
|
6
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// -----------------------------------------------------------------------------
|
|
2
|
+
export const UPDATE_FINISHED_SLIDES = '@@finished-slides/UPDATE_FINISHED_SLIDES';
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
export const updateFinishedSlides = (payload) => ({
|
|
5
|
+
type: UPDATE_FINISHED_SLIDES,
|
|
6
|
+
payload
|
|
7
|
+
});
|
package/es/actions/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { ReceivedCourse } from './courses';
|
|
2
2
|
import { NavigateBack, NavigateTo, StartApp } from './navigation';
|
|
3
3
|
import { StoreToken } from './token';
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export * from './token';
|
|
7
|
-
export declare type Action = StartApp | StoreToken | NavigateBack | NavigateTo | ReceivedCourse;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
4
|
+
import { StoreFirstSlide } from './slides';
|
|
5
|
+
export declare type Action = NavigateBack | NavigateTo | ReceivedCourse | StartApp | StoreFirstSlide | StoreToken;
|
package/es/actions/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AppOptions } from '..';
|
|
1
|
+
import { AppOptions } from '../types/common';
|
|
3
2
|
export declare const NAVIGATE_TO = "@@navigation/NAVIGATE_TO";
|
|
4
3
|
export declare const NAVIGATE_BACK = "@@navigation/NAVIGATE_BACK";
|
|
5
4
|
export declare const START_APP = "@@navigation/START_APP";
|
|
5
|
+
export declare type ViewPath = 'home' | 'onboarding' | 'slides';
|
|
6
6
|
export declare type NavigateTo = {
|
|
7
7
|
type: '@@navigation/NAVIGATE_TO';
|
|
8
|
-
payload:
|
|
8
|
+
payload: ViewPath;
|
|
9
9
|
};
|
|
10
10
|
export declare type NavigateBack = {
|
|
11
11
|
type: '@@navigation/NAVIGATE_BACK';
|
|
@@ -14,7 +14,6 @@ export declare type StartApp = {
|
|
|
14
14
|
type: '@@navigation/START_APP';
|
|
15
15
|
payload: AppOptions;
|
|
16
16
|
};
|
|
17
|
-
export declare const navigateTo:
|
|
18
|
-
export declare const navigateBack:
|
|
17
|
+
export declare const navigateTo: (newPath: ViewPath) => NavigateTo;
|
|
18
|
+
export declare const navigateBack: () => NavigateBack;
|
|
19
19
|
export declare const startApp: (options: AppOptions) => StartApp;
|
|
20
|
-
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// -----------------------------------------------------------------------------
|
|
2
|
+
export const UPDATE_REVIEW_STATUS = '@@review-status/UPDATE_REVIEW_STATUS';
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
export const updateReviewStatus = (payload) => ({
|
|
5
|
+
type: UPDATE_REVIEW_STATUS,
|
|
6
|
+
payload
|
|
7
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
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;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// -----------------------------------------------------------------------------
|
|
2
|
+
export const STORE_FIRST_SLIDE = '@@slide/STORE_FIRST_SLIDE';
|
|
3
|
+
export const UPDATE_SLIDES_ON_VALIDATION = '@@slide/UPDATE_SLIDES_ON_VALIDATION';
|
|
4
|
+
export const UPDATE_SLIDES_ON_NEXT = '@@slide/UPDATE_SLIDES_ON_NEXT';
|
|
5
|
+
// -----------------------------------------------------------------------------
|
|
6
|
+
export const storeFirstSlide = (slide) => ({
|
|
7
|
+
type: STORE_FIRST_SLIDE,
|
|
8
|
+
payload: slide
|
|
9
|
+
});
|
|
10
|
+
export const updateSlidesOnValidation = (payload) => ({
|
|
11
|
+
type: UPDATE_SLIDES_ON_VALIDATION,
|
|
12
|
+
payload
|
|
13
|
+
});
|
|
14
|
+
export const updateSlidesOnNext = (payload) => ({
|
|
15
|
+
type: UPDATE_SLIDES_ON_NEXT,
|
|
16
|
+
payload
|
|
17
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UpdateStepItemsOnNextClickPayload, UpdateStepItemsOnValidationClickPayload } from '../types/step-items';
|
|
2
|
+
export declare const UPDATE_STEP_ITEMS_ON_VALIDATION = "@@step-items/UPDATE_STEP_ITEMS_ON_VALIDATION";
|
|
3
|
+
export declare const UPDATE_STEP_ITEMS_ON_NEXT = "@@step-items/UPDATE_STEP_ITEMS_ON_NEXT";
|
|
4
|
+
export declare type UpdateStepItemsOnValidation = {
|
|
5
|
+
type: typeof UPDATE_STEP_ITEMS_ON_VALIDATION;
|
|
6
|
+
payload: UpdateStepItemsOnValidationClickPayload;
|
|
7
|
+
};
|
|
8
|
+
export declare type UpdateStepItemsOnNext = {
|
|
9
|
+
type: typeof UPDATE_STEP_ITEMS_ON_NEXT;
|
|
10
|
+
payload: UpdateStepItemsOnNextClickPayload;
|
|
11
|
+
};
|
|
12
|
+
export declare type StepItemsAction = UpdateStepItemsOnValidation | UpdateStepItemsOnNext;
|
|
13
|
+
export declare const updateStepItemsOnValidation: (payload: UpdateStepItemsOnValidationClickPayload) => UpdateStepItemsOnValidation;
|
|
14
|
+
export declare const updateStepItemsOnNext: (payload: UpdateStepItemsOnNextClickPayload) => UpdateStepItemsOnNext;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// -----------------------------------------------------------------------------
|
|
2
|
+
export const UPDATE_STEP_ITEMS_ON_VALIDATION = '@@step-items/UPDATE_STEP_ITEMS_ON_VALIDATION';
|
|
3
|
+
export const UPDATE_STEP_ITEMS_ON_NEXT = '@@step-items/UPDATE_STEP_ITEMS_ON_NEXT';
|
|
4
|
+
// -----------------------------------------------------------------------------
|
|
5
|
+
export const updateStepItemsOnValidation = (payload) => ({
|
|
6
|
+
type: UPDATE_STEP_ITEMS_ON_VALIDATION,
|
|
7
|
+
payload
|
|
8
|
+
});
|
|
9
|
+
export const updateStepItemsOnNext = (payload) => ({
|
|
10
|
+
type: UPDATE_STEP_ITEMS_ON_NEXT,
|
|
11
|
+
payload
|
|
12
|
+
});
|
package/es/actions/token.d.ts
CHANGED
package/es/configure-store.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export default function configureStore():
|
|
4
|
-
courses: import("./reducers/courses").State;
|
|
5
|
-
navigation: NavigationState;
|
|
6
|
-
token: string;
|
|
7
|
-
}, import("redux").AnyAction> & {
|
|
1
|
+
import { AnyAction, EmptyObject, Store } from 'redux';
|
|
2
|
+
import { StoreState } from './types/store-state';
|
|
3
|
+
export default function configureStore(): Store<EmptyObject & StoreState, AnyAction> & {
|
|
8
4
|
dispatch: {};
|
|
9
|
-
}>;
|
|
10
|
-
export declare type StoreState = {
|
|
11
|
-
navigation: NavigationState;
|
|
12
|
-
token: TokenState;
|
|
13
5
|
};
|
|
14
|
-
//# sourceMappingURL=configure-store.d.ts.map
|
package/es/configure-store.js
CHANGED
|
@@ -4,16 +4,14 @@ import rootReducer from './reducers';
|
|
|
4
4
|
import onStartApp from './middlewares/on-start-app';
|
|
5
5
|
const preloadedState = undefined;
|
|
6
6
|
// -----------------------------------------------------------------------------
|
|
7
|
-
export default
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { composeWithDevTools } = await import('redux-devtools-extension');
|
|
11
|
-
_compose = composeWithDevTools({
|
|
7
|
+
export default function configureStore() {
|
|
8
|
+
const _compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
9
|
+
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
|
12
10
|
name: 'app-review',
|
|
13
11
|
trace: true,
|
|
14
12
|
traceLimit: 25
|
|
15
|
-
})
|
|
16
|
-
|
|
13
|
+
})
|
|
14
|
+
: compose;
|
|
17
15
|
const enhancer = _compose(applyMiddleware(thunk, onStartApp));
|
|
18
16
|
const store = createStore(rootReducer, preloadedState, enhancer);
|
|
19
17
|
return store;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const 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
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export const correctionPopinProps = {
|
|
2
|
+
klf: {
|
|
3
|
+
label: 'Key learning factor',
|
|
4
|
+
tooltip: 'Some tooltip info.',
|
|
5
|
+
onClick: () => {
|
|
6
|
+
console.log('klf onClick');
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
information: {
|
|
10
|
+
label: 'Key learning factor',
|
|
11
|
+
message: 'info msg'
|
|
12
|
+
},
|
|
13
|
+
next: {
|
|
14
|
+
label: 'Next',
|
|
15
|
+
ariaLabel: 'Next'
|
|
16
|
+
},
|
|
17
|
+
successLabel: 'CORRECT ANSWER',
|
|
18
|
+
failureLabel: 'WRONG ANSWER'
|
|
19
|
+
};
|
|
20
|
+
const confettiAnimationProps = {
|
|
21
|
+
'aria-label': 'aria lottie',
|
|
22
|
+
'data-name': 'default-lottie',
|
|
23
|
+
className: undefined,
|
|
24
|
+
animationSrc: 'https://static-staging.coorpacademy.com/animations/review/confetti.json',
|
|
25
|
+
loop: undefined,
|
|
26
|
+
autoplay: true,
|
|
27
|
+
rendererSettings: {
|
|
28
|
+
hideOnTransparent: false,
|
|
29
|
+
animationClassName: ''
|
|
30
|
+
},
|
|
31
|
+
ie11ImageBackup: 'https://static-staging.coorpacademy.com/animations/review/conffeti_congrats.svg',
|
|
32
|
+
animationControl: undefined
|
|
33
|
+
};
|
|
34
|
+
const starAnimationProps = {
|
|
35
|
+
'aria-label': 'Review Card Congrats Container',
|
|
36
|
+
'data-name': 'card-star',
|
|
37
|
+
animationLottie: {
|
|
38
|
+
'aria-label': 'aria lottie',
|
|
39
|
+
'data-name': 'default-lottie',
|
|
40
|
+
animationSrc: 'https://static-staging.coorpacademy.com/animations/review/star.json',
|
|
41
|
+
ie11ImageBackup: 'https://static-staging.coorpacademy.com/animations/review/stars_icon_congrats.svg'
|
|
42
|
+
},
|
|
43
|
+
iconAriaLabel: 'Image without information',
|
|
44
|
+
cardType: 'card-star',
|
|
45
|
+
reviewCardTitle: 'You have won',
|
|
46
|
+
reviewCardValue: '100',
|
|
47
|
+
timerAnimation: 200
|
|
48
|
+
};
|
|
49
|
+
const rankAnimationProps = {
|
|
50
|
+
'aria-label': 'Review Card Congrats Container',
|
|
51
|
+
'data-name': 'card-rank',
|
|
52
|
+
animationLottie: {
|
|
53
|
+
'aria-label': 'aria lottie',
|
|
54
|
+
'data-name': 'default-lottie',
|
|
55
|
+
animationSrc: 'https://static-staging.coorpacademy.com/animations/review/rank.json',
|
|
56
|
+
ie11ImageBackup: 'https://static-staging.coorpacademy.com/animations/review/rank_icon_congrats.svg'
|
|
57
|
+
},
|
|
58
|
+
cardType: 'card-rank',
|
|
59
|
+
iconAriaLabel: 'Image without information',
|
|
60
|
+
reviewCardTitle: 'You are now',
|
|
61
|
+
reviewCardValue: '14',
|
|
62
|
+
rankSuffix: 'th',
|
|
63
|
+
timerAnimation: 200
|
|
64
|
+
};
|
|
65
|
+
export const congratsProps = {
|
|
66
|
+
'aria-label': 'Review Congratulations',
|
|
67
|
+
'data-name': 'review-congrats',
|
|
68
|
+
animationLottie: confettiAnimationProps,
|
|
69
|
+
title: 'Congratulations!',
|
|
70
|
+
cardCongratsStar: starAnimationProps,
|
|
71
|
+
cardCongratsRank: rankAnimationProps,
|
|
72
|
+
buttonRevising: {
|
|
73
|
+
'aria-label': 'Continue revising button',
|
|
74
|
+
label: 'Continue revising',
|
|
75
|
+
onClick: () => console.log('Continue revising'),
|
|
76
|
+
type: 'tertiary'
|
|
77
|
+
},
|
|
78
|
+
buttonRevisingSkill: {
|
|
79
|
+
label: 'Revise another skill',
|
|
80
|
+
'aria-label': 'Revise another skill button',
|
|
81
|
+
onClick: () => console.log('Revise another skill'),
|
|
82
|
+
type: 'primary'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/index.d.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
declare const
|
|
1
|
+
import type { AppOptions } from './types/common';
|
|
2
|
+
declare const AppReview: ({ options }: {
|
|
3
|
+
options: AppOptions;
|
|
4
|
+
}) => JSX.Element;
|
|
3
5
|
declare global {
|
|
4
6
|
interface Window {
|
|
5
7
|
__REDUX_DEVTOOLS_EXTENSION__?: boolean;
|
|
6
8
|
}
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
options: AppOptions;
|
|
10
|
-
};
|
|
11
|
-
export declare type AppOptions = {
|
|
12
|
-
token: string;
|
|
13
|
-
theme?: any;
|
|
14
|
-
translations?: any;
|
|
15
|
-
};
|
|
16
|
-
export default AppRevision;
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
10
|
+
export default AppReview;
|
package/es/index.js
CHANGED
|
@@ -1,29 +1,77 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { connect, Provider } from 'react-redux';
|
|
3
|
-
import
|
|
3
|
+
import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
|
|
4
4
|
import configureStore from './configure-store';
|
|
5
5
|
import { navigateTo, navigateBack, startApp } from './actions/navigation';
|
|
6
|
+
import { updateSlidesOnNext, updateSlidesOnValidation } from './actions/slides';
|
|
6
7
|
import { getCurrentViewName } from './reducers/navigation';
|
|
8
|
+
import { congratsProps, correctionPopinProps } from './fixtures/temp-fixture';
|
|
9
|
+
import { updateFinishedSlides } from './actions/finished-slides';
|
|
10
|
+
import { updateReviewStatus } from './actions/review-status';
|
|
11
|
+
import { updateStepItemsOnValidation, updateStepItemsOnNext } from './actions/step-items';
|
|
12
|
+
import { validateSlide } from './actions/data/validate-slide';
|
|
7
13
|
// -----------------------------------------------------------------------------
|
|
8
|
-
const
|
|
9
|
-
|
|
14
|
+
const mapDispatchToProps = {
|
|
15
|
+
navigateTo,
|
|
16
|
+
navigateBack,
|
|
17
|
+
validateSlide,
|
|
18
|
+
updateSlidesOnValidation,
|
|
19
|
+
updateSlidesOnNext,
|
|
20
|
+
updateReviewStatus,
|
|
21
|
+
updateStepItemsOnValidation,
|
|
22
|
+
updateStepItemsOnNext,
|
|
23
|
+
updateFinishedSlides
|
|
10
24
|
};
|
|
11
|
-
const
|
|
12
|
-
|
|
25
|
+
const mapStateToProps = (state) => {
|
|
26
|
+
return {
|
|
27
|
+
viewName: getCurrentViewName(state),
|
|
28
|
+
slides: {
|
|
29
|
+
headerProps: {
|
|
30
|
+
mode: '__revision_mode',
|
|
31
|
+
skillName: '__agility',
|
|
32
|
+
onQuitClick: () => {
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log('onQuitClick');
|
|
35
|
+
},
|
|
36
|
+
'aria-label': 'aria-header-wrapper',
|
|
37
|
+
closeButtonAriaLabel: 'aria-close-button'
|
|
38
|
+
},
|
|
39
|
+
slides: state.ui.slides,
|
|
40
|
+
validate: {
|
|
41
|
+
label: '__validate'
|
|
42
|
+
},
|
|
43
|
+
finishedSlides: state.ui.finishedSlides,
|
|
44
|
+
stepItems: state.ui.stepItems,
|
|
45
|
+
reviewStatus: state.ui.reviewStatus,
|
|
46
|
+
correctionPopinProps,
|
|
47
|
+
congratsProps,
|
|
48
|
+
slideValidationResult: state.data.slideValidationResult
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
// Props = StaticProps && Dispatchers
|
|
53
|
+
const App = connect(mapStateToProps, mapDispatchToProps)(AppReviewTemplate);
|
|
13
54
|
// -----------------------------------------------------------------------------
|
|
14
|
-
const
|
|
55
|
+
const AppReview = ({ options }) => {
|
|
15
56
|
const [store, setStore] = useState(null);
|
|
57
|
+
const [appStarted, setAppStarted] = useState(false);
|
|
16
58
|
useEffect(() => {
|
|
17
|
-
|
|
18
|
-
const store = await configureStore();
|
|
59
|
+
if (store) {
|
|
19
60
|
store.dispatch(startApp(options));
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
61
|
+
setAppStarted(true);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const _configure = async () => {
|
|
65
|
+
const _store = await configureStore();
|
|
66
|
+
setStore(_store);
|
|
67
|
+
};
|
|
68
|
+
_configure();
|
|
69
|
+
}
|
|
70
|
+
}, [options, store]);
|
|
71
|
+
if (!store || !appStarted)
|
|
25
72
|
return null;
|
|
26
73
|
return (React.createElement(Provider, { store: store },
|
|
27
74
|
React.createElement(App, null)));
|
|
28
75
|
};
|
|
29
|
-
|
|
76
|
+
// -----------------------------------------------------------------------------
|
|
77
|
+
export default AppReview;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/index.test.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import browserEnv from 'browser-env';
|
|
2
|
+
import test from 'ava';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { render, fireEvent, act } from '@testing-library/react';
|
|
5
|
+
import { slide } from './fixtures/qcm-slide';
|
|
6
|
+
import AppReview from '.';
|
|
7
|
+
browserEnv({ pretendToBeVisual: true });
|
|
8
|
+
const elementExists = (foundElements) => foundElements && foundElements[0];
|
|
9
|
+
const sleep = (msToSleep) => new Promise(resolve => {
|
|
10
|
+
setTimeout(resolve, msToSleep);
|
|
11
|
+
});
|
|
12
|
+
const waitForChanges = async (msToWait = 3000) => {
|
|
13
|
+
await act(async () => {
|
|
14
|
+
await sleep(msToWait); // wait *just* a little longer than the timeout in the component
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const LIMIT = 5;
|
|
18
|
+
const clickAllSlides = async (t, container, accumulator = 0) => {
|
|
19
|
+
if (accumulator === LIMIT)
|
|
20
|
+
return;
|
|
21
|
+
// last one needs to wait for more calculations && components updates
|
|
22
|
+
if (accumulator === 4)
|
|
23
|
+
await act(async () => {
|
|
24
|
+
await sleep(1000);
|
|
25
|
+
});
|
|
26
|
+
const validateButton = container.querySelectorAll(`[data-name="slide-validate-button-${accumulator}"]`);
|
|
27
|
+
t.truthy(elementExists(validateButton));
|
|
28
|
+
await act(async () => {
|
|
29
|
+
await fireEvent.click(validateButton[0]);
|
|
30
|
+
});
|
|
31
|
+
const nextButton = container.querySelectorAll(`[data-name="next-question-button-${accumulator}"]`);
|
|
32
|
+
t.truthy(elementExists(nextButton));
|
|
33
|
+
await act(async () => {
|
|
34
|
+
await fireEvent.click(nextButton[0]);
|
|
35
|
+
});
|
|
36
|
+
await clickAllSlides(t, container, accumulator + 1);
|
|
37
|
+
};
|
|
38
|
+
const appOptions = {
|
|
39
|
+
token: process.env.API_TEST_TOKEN || '',
|
|
40
|
+
slide
|
|
41
|
+
};
|
|
42
|
+
test('should validate all the slides (all correct scenario)', async (t) => {
|
|
43
|
+
t.plan(13);
|
|
44
|
+
const { container } = render(React.createElement(AppReview, { options: appOptions, key: 0 }));
|
|
45
|
+
await waitForChanges(1000);
|
|
46
|
+
const wrapper = container.querySelector('[data-name="slides-revision-container"]');
|
|
47
|
+
t.truthy(wrapper);
|
|
48
|
+
const stackedSlidesContainer = wrapper.querySelector('[data-name="stacked-slides-container"]');
|
|
49
|
+
t.truthy(stackedSlidesContainer);
|
|
50
|
+
await clickAllSlides(t, container);
|
|
51
|
+
t.pass();
|
|
52
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Middleware } from 'redux';
|
|
2
2
|
import { Dispatch } from 'redux';
|
|
3
3
|
import { Action } from '../actions';
|
|
4
|
-
import { StoreState } from '../
|
|
4
|
+
import { StoreState } from '../types/store-state';
|
|
5
5
|
declare const onStartApp: Middleware<{}, StoreState, Dispatch<Action>>;
|
|
6
6
|
export default onStartApp;
|
|
7
|
-
//# sourceMappingURL=on-start-app.d.ts.map
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
// import fetchCourse from '../services/fetch-demo';
|
|
2
|
+
import { VIEWS } from '../common';
|
|
3
|
+
import { navigateTo, START_APP } from '../actions/navigation';
|
|
4
|
+
import { storeToken } from '../actions/token';
|
|
5
|
+
import { storeFirstSlide } from '../actions/slides';
|
|
3
6
|
const onStartApp = ({ dispatch }) => next => (action) => {
|
|
4
7
|
if (action.type === START_APP) {
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
// eslint-disable-next-line no-warning-comments
|
|
9
|
+
// TODO: fetchProgression + fetchSlide à partir de la progression passée dans les options de l'app
|
|
10
|
+
const { slide } = action.payload;
|
|
11
|
+
if (slide) {
|
|
12
|
+
const { token } = action.payload;
|
|
13
|
+
dispatch(storeToken(token));
|
|
14
|
+
dispatch(storeFirstSlide(slide));
|
|
15
|
+
}
|
|
16
|
+
const initialView = slide ? VIEWS.slides : VIEWS.onboarding;
|
|
17
|
+
dispatch(navigateTo(initialView));
|
|
7
18
|
// --------------
|
|
8
19
|
// demo service
|
|
9
|
-
const language = 'fr';
|
|
10
|
-
const universalRef = 'dis_xxx15';
|
|
11
|
-
fetchCourse(token, language, universalRef).then(course => {
|
|
12
|
-
|
|
13
|
-
});
|
|
20
|
+
// const language = 'fr';
|
|
21
|
+
// const universalRef = 'dis_xxx15';
|
|
22
|
+
// fetchCourse(token, language, universalRef).then(course => {
|
|
23
|
+
// dispatch(receivedCourse(course));
|
|
24
|
+
// });
|
|
14
25
|
}
|
|
15
26
|
return next(action);
|
|
16
27
|
};
|
package/es/reducers/courses.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ReceivedCourse } from '../actions';
|
|
2
|
-
export declare type State = Array<
|
|
1
|
+
import { ReceivedCourse } from '../actions/courses';
|
|
2
|
+
export declare type State = Array<unknown>;
|
|
3
3
|
export declare const initialState: State;
|
|
4
4
|
declare const reducer: (state: State, action: ReceivedCourse) => State;
|
|
5
5
|
export default reducer;
|
|
6
|
-
//# sourceMappingURL=courses.d.ts.map
|
package/es/reducers/courses.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { RECEIVED_COURSE } from '../actions';
|
|
1
|
+
import { RECEIVED_COURSE } from '../actions/courses';
|
|
2
2
|
export const initialState = [];
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
+
// eslint-disable-next-line default-param-last
|
|
4
5
|
const reducer = (state = initialState, action) => {
|
|
5
6
|
switch (action.type) {
|
|
6
7
|
case RECEIVED_COURSE: {
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|