@coorpacademy/app-review 0.1.13 → 0.1.15
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/api/fetch-slide.d.ts +3 -3
- package/es/actions/api/fetch-slide.js +22 -2
- package/es/actions/api/post-progression.js +1 -2
- package/es/actions/index.d.ts +1 -10
- package/es/actions/ui/is-fetching.js +0 -2
- package/es/actions/ui/slides.d.ts +26 -0
- package/es/actions/ui/slides.js +9 -0
- package/es/common/index.d.ts +3 -1
- package/es/common/index.js +3 -1
- package/es/fixtures/qcm-slide.d.ts +2 -2
- package/es/fixtures/temp-fixture.d.ts +2 -2
- package/es/helpers/map-api-slide-to-ui.d.ts +4 -1
- package/es/helpers/map-api-slide-to-ui.js +33 -15
- package/es/helpers/test/fixtures/free-text.d.ts +2 -3
- package/es/helpers/test/fixtures/free-text.js +10 -4
- package/es/helpers/test/fixtures/qcm-drag.d.ts +2 -3
- package/es/helpers/test/fixtures/qcm-drag.js +38 -32
- package/es/helpers/test/fixtures/qcm-graphic.d.ts +2 -3
- package/es/helpers/test/fixtures/qcm-graphic.js +20 -14
- package/es/helpers/test/fixtures/qcm.d.ts +2 -3
- package/es/helpers/test/fixtures/qcm.js +32 -26
- package/es/helpers/test/fixtures/select-template.d.ts +2 -3
- package/es/helpers/test/fixtures/select-template.js +38 -32
- package/es/helpers/test/fixtures/slider.d.ts +2 -3
- package/es/helpers/test/fixtures/slider.js +13 -7
- package/es/helpers/test/fixtures/text-template.d.ts +2 -3
- package/es/helpers/test/fixtures/text-template.js +16 -10
- package/es/index.js +14 -78
- package/es/reducers/data/index.d.ts +1 -1
- package/es/reducers/data/progression.d.ts +3 -16
- package/es/reducers/data/progression.js +3 -22
- package/es/reducers/data/slides.d.ts +5 -6
- package/es/reducers/data/slides.js +4 -107
- package/es/reducers/index.d.ts +3 -4
- package/es/reducers/ui/current-slide-ref.d.ts +4 -0
- package/es/reducers/ui/{review-status.js → current-slide-ref.js} +4 -4
- package/es/reducers/ui/index.d.ts +7 -10
- package/es/reducers/ui/index.js +4 -6
- package/es/reducers/ui/slides.d.ts +9 -0
- package/es/reducers/ui/slides.js +42 -0
- package/es/services/test/post-progression.test.js +6 -4
- package/es/test/util/services.mock.js +17 -5
- package/es/types/common.d.ts +40 -23
- package/es/types/common.js +0 -5
- package/es/types/slides.d.ts +0 -4
- package/es/types/views/slides.d.ts +41 -27
- package/es/types/views/slides.js +5 -0
- package/{lib/types/views/skills.d.ts → es/views/skills/index.d.ts} +2 -0
- package/es/views/skills/index.js +25 -0
- package/es/views/slides/index.d.ts +3 -0
- package/es/views/slides/index.js +85 -0
- package/lib/actions/api/fetch-slide.d.ts +3 -3
- package/lib/actions/api/fetch-slide.js +20 -2
- package/lib/actions/api/post-progression.js +1 -2
- package/lib/actions/index.d.ts +1 -10
- package/lib/actions/ui/is-fetching.js +0 -2
- package/lib/actions/ui/slides.d.ts +26 -0
- package/lib/actions/ui/slides.js +9 -0
- package/lib/common/index.d.ts +3 -1
- package/lib/common/index.js +3 -1
- package/lib/fixtures/qcm-slide.d.ts +2 -2
- package/lib/fixtures/temp-fixture.d.ts +2 -2
- package/lib/helpers/map-api-slide-to-ui.d.ts +4 -1
- package/lib/helpers/map-api-slide-to-ui.js +34 -14
- package/lib/helpers/test/fixtures/free-text.d.ts +2 -3
- package/lib/helpers/test/fixtures/free-text.js +10 -4
- package/lib/helpers/test/fixtures/qcm-drag.d.ts +2 -3
- package/lib/helpers/test/fixtures/qcm-drag.js +38 -32
- package/lib/helpers/test/fixtures/qcm-graphic.d.ts +2 -3
- package/lib/helpers/test/fixtures/qcm-graphic.js +20 -14
- package/lib/helpers/test/fixtures/qcm.d.ts +2 -3
- package/lib/helpers/test/fixtures/qcm.js +32 -26
- package/lib/helpers/test/fixtures/select-template.d.ts +2 -3
- package/lib/helpers/test/fixtures/select-template.js +38 -32
- package/lib/helpers/test/fixtures/slider.d.ts +2 -3
- package/lib/helpers/test/fixtures/slider.js +13 -7
- package/lib/helpers/test/fixtures/text-template.d.ts +2 -3
- package/lib/helpers/test/fixtures/text-template.js +16 -10
- package/lib/index.js +14 -78
- package/lib/reducers/data/index.d.ts +1 -1
- package/lib/reducers/data/progression.d.ts +3 -16
- package/lib/reducers/data/progression.js +3 -22
- package/lib/reducers/data/slides.d.ts +5 -6
- package/lib/reducers/data/slides.js +4 -113
- package/lib/reducers/index.d.ts +3 -4
- package/lib/reducers/ui/current-slide-ref.d.ts +4 -0
- package/lib/reducers/ui/{review-status.js → current-slide-ref.js} +4 -4
- package/lib/reducers/ui/index.d.ts +7 -10
- package/lib/reducers/ui/index.js +4 -6
- package/lib/reducers/ui/slides.d.ts +9 -0
- package/lib/reducers/ui/slides.js +43 -0
- package/lib/services/test/post-progression.test.js +6 -4
- package/lib/test/util/services.mock.js +17 -5
- package/lib/types/common.d.ts +40 -23
- package/lib/types/common.js +0 -5
- package/lib/types/slides.d.ts +0 -4
- package/lib/types/views/slides.d.ts +41 -27
- package/lib/types/views/slides.js +5 -0
- package/{es/types/views/skills.d.ts → lib/views/skills/index.d.ts} +2 -0
- package/lib/views/skills/index.js +25 -0
- package/lib/views/slides/index.d.ts +3 -0
- package/lib/views/slides/index.js +89 -0
- package/package.json +3 -3
- package/src/actions/api/fetch-slide.ts +26 -5
- package/src/actions/api/post-progression.ts +1 -2
- package/src/actions/index.ts +1 -10
- package/src/actions/ui/is-fetching.ts +0 -6
- package/src/actions/ui/slides.ts +35 -0
- package/src/common/index.ts +7 -1
- package/src/fixtures/qcm-slide.ts +2 -2
- package/src/fixtures/temp-fixture.ts +2 -2
- package/src/helpers/map-api-slide-to-ui.ts +43 -17
- package/src/helpers/test/fixtures/free-text.ts +12 -7
- package/src/helpers/test/fixtures/qcm-drag.ts +40 -35
- package/src/helpers/test/fixtures/qcm-graphic.ts +22 -17
- package/src/helpers/test/fixtures/qcm.ts +38 -32
- package/src/helpers/test/fixtures/select-template.ts +40 -35
- package/src/helpers/test/fixtures/slider.ts +15 -10
- package/src/helpers/test/fixtures/text-template.ts +18 -13
- package/src/helpers/test/map-api-slide-to-ui.test.ts +2 -11
- package/src/index.tsx +15 -84
- package/src/reducers/data/progression.ts +5 -40
- package/src/reducers/data/slides.ts +9 -126
- package/src/reducers/ui/current-slide-ref.ts +19 -0
- package/src/reducers/ui/index.ts +6 -9
- package/src/reducers/ui/slides.ts +58 -0
- package/src/services/test/post-progression.test.ts +6 -4
- package/src/test/util/services.mock.ts +17 -5
- package/src/types/common.ts +44 -27
- package/src/types/slides.ts +0 -5
- package/src/types/views/slides.ts +52 -27
- package/src/views/skills/index.ts +56 -0
- package/src/views/slides/index.ts +92 -0
- package/es/actions/data/slides.d.ts +0 -37
- package/es/actions/data/slides.js +0 -16
- package/es/actions/ui/finished-slides.d.ts +0 -10
- package/es/actions/ui/finished-slides.js +0 -8
- package/es/actions/ui/review-status.d.ts +0 -7
- package/es/actions/ui/review-status.js +0 -7
- package/es/actions/ui/step-items.d.ts +0 -24
- package/es/actions/ui/step-items.js +0 -11
- package/es/reducers/ui/finished-slides.d.ts +0 -7
- package/es/reducers/ui/finished-slides.js +0 -33
- package/es/reducers/ui/review-status.d.ts +0 -4
- package/es/reducers/ui/step-items.d.ts +0 -14
- package/es/reducers/ui/step-items.js +0 -74
- package/es/types/ui-progression.d.ts +0 -10
- package/es/types/ui-progression.js +0 -1
- package/es/types/views/skills.js +0 -1
- package/lib/actions/data/slides.d.ts +0 -37
- package/lib/actions/data/slides.js +0 -16
- package/lib/actions/ui/finished-slides.d.ts +0 -10
- package/lib/actions/ui/finished-slides.js +0 -8
- package/lib/actions/ui/review-status.d.ts +0 -7
- package/lib/actions/ui/review-status.js +0 -7
- package/lib/actions/ui/step-items.d.ts +0 -24
- package/lib/actions/ui/step-items.js +0 -11
- package/lib/reducers/ui/finished-slides.d.ts +0 -7
- package/lib/reducers/ui/finished-slides.js +0 -45
- package/lib/reducers/ui/review-status.d.ts +0 -4
- package/lib/reducers/ui/step-items.d.ts +0 -14
- package/lib/reducers/ui/step-items.js +0 -86
- package/lib/types/ui-progression.d.ts +0 -10
- package/lib/types/ui-progression.js +0 -1
- package/lib/types/views/skills.js +0 -1
- package/src/actions/data/slides.ts +0 -65
- package/src/actions/ui/finished-slides.ts +0 -21
- package/src/actions/ui/review-status.ts +0 -19
- package/src/actions/ui/step-items.ts +0 -45
- package/src/reducers/ui/finished-slides.ts +0 -52
- package/src/reducers/ui/review-status.ts +0 -19
- package/src/reducers/ui/step-items.ts +0 -116
- package/src/types/ui-progression.ts +0 -25
- package/src/types/views/skills.ts +0 -27
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnyAction } from 'redux';
|
|
2
2
|
import type { ThunkAction } from 'redux-thunk';
|
|
3
3
|
import type { StoreState } from '../../reducers';
|
|
4
|
-
import { Options, SlideFromAPI } from '../../types/common';
|
|
4
|
+
import type { Options, ProgressionFromAPI, SlideFromAPI } from '../../types/common';
|
|
5
5
|
export declare const SLIDE_FETCH_REQUEST: "@@slides/FETCH_REQUEST";
|
|
6
6
|
export declare const SLIDE_FETCH_SUCCESS: "@@slides/FETCH_SUCCESS";
|
|
7
7
|
export declare const SLIDE_FETCH_FAILURE: "@@slides/FETCH_FAILURE";
|
|
@@ -9,5 +9,5 @@ export interface ReceivedSlide extends AnyAction {
|
|
|
9
9
|
type: typeof SLIDE_FETCH_SUCCESS;
|
|
10
10
|
payload: SlideFromAPI;
|
|
11
11
|
}
|
|
12
|
-
export declare type FetchSlideAction = ThunkAction<Promise<
|
|
13
|
-
export declare const fetchSlide: (
|
|
12
|
+
export declare type FetchSlideAction = ThunkAction<Promise<SlideFromAPI>, StoreState, Options, AnyAction>;
|
|
13
|
+
export declare const fetchSlide: (progressionFromAPI: ProgressionFromAPI, token: string) => FetchSlideAction;
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import buildTask from '@coorpacademy/redux-task';
|
|
2
|
+
import get from 'lodash/fp/get';
|
|
3
|
+
import has from 'lodash/fp/has';
|
|
4
|
+
import isEmpty from 'lodash/fp/isEmpty';
|
|
5
|
+
import { setCurrentSlide } from '../ui/slides';
|
|
2
6
|
export const SLIDE_FETCH_REQUEST = '@@slides/FETCH_REQUEST';
|
|
3
7
|
export const SLIDE_FETCH_SUCCESS = '@@slides/FETCH_SUCCESS';
|
|
4
8
|
export const SLIDE_FETCH_FAILURE = '@@slides/FETCH_FAILURE';
|
|
5
|
-
export const fetchSlide = (
|
|
9
|
+
export const fetchSlide = (progressionFromAPI, token) => buildTask({
|
|
6
10
|
types: [SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS, SLIDE_FETCH_FAILURE],
|
|
7
|
-
|
|
11
|
+
bailout: (state) => {
|
|
12
|
+
const { ref: slideRef } = get('state.nextContent', progressionFromAPI);
|
|
13
|
+
return has(`data.slide.${slideRef}`, state);
|
|
14
|
+
},
|
|
15
|
+
task: (dispatch, getState, { services }) => {
|
|
16
|
+
const { ref: slideRef } = get('state.nextContent', progressionFromAPI);
|
|
17
|
+
return services.fetchSlide(slideRef, token).then((slideFromAPI) => {
|
|
18
|
+
if (!slideFromAPI)
|
|
19
|
+
throw new Error('Slide not found');
|
|
20
|
+
const state = getState();
|
|
21
|
+
const slides = get('data.progression.state.slides', state);
|
|
22
|
+
if (isEmpty(slides)) {
|
|
23
|
+
dispatch(setCurrentSlide(slideFromAPI));
|
|
24
|
+
}
|
|
25
|
+
return slideFromAPI;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
8
28
|
});
|
|
@@ -7,8 +7,7 @@ export const postProgression = (skillRef, token) => buildTask({
|
|
|
7
7
|
types: [POST_PROGRESSION_REQUEST, POST_PROGRESSION_SUCCESS, POST_PROGRESSION_FAILURE],
|
|
8
8
|
task: (dispatch, getState, { services }) => {
|
|
9
9
|
return services.postProgression(skillRef, token).then((progression) => {
|
|
10
|
-
|
|
11
|
-
dispatch(fetchSlide(ref, token));
|
|
10
|
+
dispatch(fetchSlide(progression, token));
|
|
12
11
|
return progression;
|
|
13
12
|
});
|
|
14
13
|
}
|
package/es/actions/index.d.ts
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import { updateSlidesOnValidation, updateSlidesOnNext, validateSlide } from './data/slides';
|
|
2
1
|
import { StoreToken } from './data/token';
|
|
3
|
-
import { updateFinishedSlides } from './ui/finished-slides';
|
|
4
2
|
import { navigateBack, navigateTo, NavigateBack, NavigateTo, StartApp } from './ui/navigation';
|
|
5
|
-
import { updateReviewStatus } from './ui/review-status';
|
|
6
|
-
import { updateStepItemsOnValidation, updateStepItemsOnNext } from './ui/step-items';
|
|
7
3
|
import { ReceivedSlide } from './api/fetch-slide';
|
|
8
4
|
import { ReceiveProgression } from './api/post-progression';
|
|
9
5
|
import { ReceivedSkills } from './api/fetch-skills';
|
|
6
|
+
import { validateSlide } from './ui/slides';
|
|
10
7
|
export declare type Action = NavigateBack | NavigateTo | ReceivedSkills | StartApp | ReceivedSlide | StoreToken | ReceiveProgression;
|
|
11
8
|
export declare type Dispatchers = {
|
|
12
9
|
navigateTo: typeof navigateTo;
|
|
13
10
|
navigateBack: typeof navigateBack;
|
|
14
11
|
validateSlide: typeof validateSlide;
|
|
15
|
-
updateSlidesOnValidation: typeof updateSlidesOnValidation;
|
|
16
|
-
updateSlidesOnNext: typeof updateSlidesOnNext;
|
|
17
|
-
updateReviewStatus: typeof updateReviewStatus;
|
|
18
|
-
updateStepItemsOnValidation: typeof updateStepItemsOnValidation;
|
|
19
|
-
updateStepItemsOnNext: typeof updateStepItemsOnNext;
|
|
20
|
-
updateFinishedSlides: typeof updateFinishedSlides;
|
|
21
12
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
// -----------------------------------------------------------------------------
|
|
2
1
|
export const START_FETCHING = '@@ui/START_FETCHING';
|
|
3
2
|
export const STOP_FETCHING = '@@ui/STOP_FETCHING';
|
|
4
|
-
// -----------------------------------------------------------------------------
|
|
5
3
|
export const startFetching = () => ({ type: START_FETCHING });
|
|
6
4
|
export const stopFetching = () => ({ type: STOP_FETCHING });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SlideFromAPI } from '../../types/common';
|
|
2
|
+
import { AnswerUI } from '../../types/slides';
|
|
3
|
+
declare type SlideUIAnimations = 'unstack' | 'restack';
|
|
4
|
+
export declare type Slide = {
|
|
5
|
+
questionText?: string;
|
|
6
|
+
answerUI?: AnswerUI;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
position: number;
|
|
9
|
+
animationType?: SlideUIAnimations;
|
|
10
|
+
isCorrect?: boolean;
|
|
11
|
+
endReview?: boolean;
|
|
12
|
+
nextContent?: Omit<Slide, 'endReview' | 'hidden' | 'position' | 'nextContent'>;
|
|
13
|
+
};
|
|
14
|
+
export declare const SET_CURRENT_SLIDE: "@@slide/SET_CURRENT_SLIDE";
|
|
15
|
+
export declare type SetCurrentSlide = {
|
|
16
|
+
type: typeof SET_CURRENT_SLIDE;
|
|
17
|
+
payload: SlideFromAPI;
|
|
18
|
+
};
|
|
19
|
+
export declare const setCurrentSlide: (payload: SlideFromAPI) => SetCurrentSlide;
|
|
20
|
+
export declare const VALIDATE_SLIDE = "@@slide/VALIDATE";
|
|
21
|
+
export declare type ValidateSlide = {
|
|
22
|
+
type: typeof VALIDATE_SLIDE;
|
|
23
|
+
};
|
|
24
|
+
export declare const validateSlide: () => ValidateSlide;
|
|
25
|
+
export declare type UISlidesAction = SetCurrentSlide;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const SET_CURRENT_SLIDE = '@@slide/SET_CURRENT_SLIDE';
|
|
2
|
+
export const setCurrentSlide = (payload) => ({
|
|
3
|
+
type: SET_CURRENT_SLIDE,
|
|
4
|
+
payload
|
|
5
|
+
});
|
|
6
|
+
export const VALIDATE_SLIDE = '@@slide/VALIDATE';
|
|
7
|
+
export const validateSlide = () => ({
|
|
8
|
+
type: VALIDATE_SLIDE
|
|
9
|
+
});
|
package/es/common/index.d.ts
CHANGED
|
@@ -5,4 +5,6 @@ export declare const VIEWS: {
|
|
|
5
5
|
readonly onboarding: 'onboarding';
|
|
6
6
|
readonly slides: 'slides';
|
|
7
7
|
};
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const slideIndexes: readonly ["0", "1", "2", "3", "4"];
|
|
9
|
+
export declare type SlideIndexes = typeof slideIndexes[number];
|
|
10
|
+
export declare const indexToString: (index: number) => SlideIndexes;
|
package/es/common/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toString from 'lodash/fp/toString';
|
|
1
2
|
export const TOTAL_SLIDES_STACK = 5;
|
|
2
3
|
export const HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;
|
|
3
4
|
export const VIEWS = {
|
|
@@ -5,4 +6,5 @@ export const VIEWS = {
|
|
|
5
6
|
onboarding: 'onboarding',
|
|
6
7
|
slides: 'slides'
|
|
7
8
|
};
|
|
8
|
-
export const
|
|
9
|
+
export const slideIndexes = ['0', '1', '2', '3', '4'];
|
|
10
|
+
export const indexToString = (index) => _toString(index);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UISlide } from '../types/
|
|
2
|
-
export declare const slide: UISlide
|
|
1
|
+
import { UISlide } from '../types/common';
|
|
2
|
+
export declare const slide: Pick<UISlide, 'questionText' | 'answerUI'>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SlidesViewProps } from '../types/views/slides';
|
|
2
|
-
export declare const correctionPopinProps:
|
|
1
|
+
import { SlidesViewProps, CorrectionPopinProps } from '../types/views/slides';
|
|
2
|
+
export declare const correctionPopinProps: CorrectionPopinProps;
|
|
3
3
|
export declare const congratsProps: SlidesViewProps['congratsProps'];
|
|
@@ -4,5 +4,8 @@ declare type UiUtils = {
|
|
|
4
4
|
translate: (text: string) => string;
|
|
5
5
|
};
|
|
6
6
|
export declare const getQuestionType: (slide: SlideFromAPI) => SlideFromAPI['question']['type'];
|
|
7
|
-
export declare const mapApiSlideToUi: (uiUtils: UiUtils) => (slide: SlideFromAPI) =>
|
|
7
|
+
export declare const mapApiSlideToUi: (uiUtils: UiUtils) => (slide: SlideFromAPI) => {
|
|
8
|
+
questionText: string;
|
|
9
|
+
answerUI: AnswerUI;
|
|
10
|
+
};
|
|
8
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { concat, divide, get, getOr, head, includes, indexOf, isEmpty, map,
|
|
1
|
+
import { concat, divide, get, getOr, head, includes, indexOf, isEmpty, map, pipe, rangeStep, size, toInteger } from 'lodash/fp';
|
|
2
2
|
const qcmProps = (question) => {
|
|
3
3
|
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
4
4
|
const answers = [];
|
|
@@ -8,7 +8,8 @@ const qcmProps = (question) => {
|
|
|
8
8
|
title: choice.label,
|
|
9
9
|
selected: includes(choice.label, answers),
|
|
10
10
|
// TODO: EDIT_CHOICES
|
|
11
|
-
|
|
11
|
+
// eslint-disable-next-line no-console
|
|
12
|
+
onClick: () => console.log('TODO: on choice click'),
|
|
12
13
|
ariaLabel: choice.label
|
|
13
14
|
}),
|
|
14
15
|
// TODO: EDIT_CHOICES -> getChoices
|
|
@@ -16,7 +17,6 @@ const qcmProps = (question) => {
|
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
const qcmDragProps = (question) => {
|
|
19
|
-
// mock the answers
|
|
20
20
|
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
21
21
|
const answers = [];
|
|
22
22
|
return {
|
|
@@ -28,7 +28,8 @@ const qcmDragProps = (question) => {
|
|
|
28
28
|
selected: indexInAnswer !== -1,
|
|
29
29
|
order: indexInAnswer,
|
|
30
30
|
// TODO: EDIT_CHOICES
|
|
31
|
-
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
onClick: () => console.log('TODO: on choice click')
|
|
32
33
|
};
|
|
33
34
|
// TODO: EDIT_CHOICES -> getChoices
|
|
34
35
|
}, question.content.choices)
|
|
@@ -45,7 +46,8 @@ const qcmGraphicProps = (question) => {
|
|
|
45
46
|
image: get('media.src.0.url', choice),
|
|
46
47
|
selected: includes(choice.label, answers),
|
|
47
48
|
// TODO: EDIT_CHOICES
|
|
48
|
-
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
onClick: () => console.log('TODO: on choice click')
|
|
49
51
|
}),
|
|
50
52
|
// TODO: EDIT_CHOICES -> getChoices
|
|
51
53
|
question.content.choices)
|
|
@@ -61,7 +63,8 @@ const templateTextProps = (uiUtils) => (choice, index) => {
|
|
|
61
63
|
placeholder: translate('Type here'),
|
|
62
64
|
value: get(index, answers),
|
|
63
65
|
// TODO: EDIT_CHOICES
|
|
64
|
-
|
|
66
|
+
// eslint-disable-next-line no-console
|
|
67
|
+
onChange: () => console.log('TODO: on choice change')
|
|
65
68
|
};
|
|
66
69
|
};
|
|
67
70
|
// const getItemText = (item: ChoiceFromAPI['items'][0]): item['text'] is string =>
|
|
@@ -90,7 +93,8 @@ const templateSelectProps = (uiUtils) => {
|
|
|
90
93
|
type: 'select',
|
|
91
94
|
name: getOr('', 'name', choice),
|
|
92
95
|
// TODO: EDIT_CHOICES
|
|
93
|
-
|
|
96
|
+
// eslint-disable-next-line no-console
|
|
97
|
+
onChange: () => console.log('TODO: on choice change'),
|
|
94
98
|
options: isEmpty(answer) ? concat([temporaryOption], selectOptions) : selectOptions
|
|
95
99
|
};
|
|
96
100
|
};
|
|
@@ -120,13 +124,14 @@ const basicProps = (uiUtils) => {
|
|
|
120
124
|
placeholder: translate('Type here'),
|
|
121
125
|
value: head(answers),
|
|
122
126
|
// TODO: EDIT_CHOICES
|
|
123
|
-
|
|
127
|
+
// eslint-disable-next-line no-console
|
|
128
|
+
onChange: () => console.log('TODO: on choice change')
|
|
124
129
|
};
|
|
125
130
|
};
|
|
126
131
|
};
|
|
127
132
|
const sliderProps = (question) => {
|
|
128
133
|
const values = rangeStep(getOr(1, 'content.step', question), getOr(Number.NaN, 'content.min', question), getOr(Number.NaN, 'content.max', question) + 1
|
|
129
|
-
// Lodash doesn't
|
|
134
|
+
// Lodash doesn't infer the type very well here
|
|
130
135
|
);
|
|
131
136
|
// TODO: EDIT_CHOICES -> getAnswerValues
|
|
132
137
|
const answers = [];
|
|
@@ -143,17 +148,19 @@ const sliderProps = (question) => {
|
|
|
143
148
|
title: `${currentValue} ${question.content.unitLabel}`,
|
|
144
149
|
value: sliderPosition,
|
|
145
150
|
// TODO: EDIT_CHOICES
|
|
146
|
-
|
|
151
|
+
// eslint-disable-next-line no-console
|
|
152
|
+
onChange: () => console.log('TODO: on choice change')
|
|
147
153
|
};
|
|
148
154
|
};
|
|
149
155
|
export const getQuestionType = (slide) => slide.question.type;
|
|
150
|
-
|
|
156
|
+
const getHelp = (uiUtils) => (slide) => {
|
|
157
|
+
const { translate } = uiUtils;
|
|
158
|
+
return get('question.explanation', slide) || translate('Select something below');
|
|
159
|
+
};
|
|
160
|
+
const getAnswerUIModel = (uiUtils) => {
|
|
151
161
|
const basicProps_ = basicProps(uiUtils);
|
|
152
162
|
const templateProps_ = templateProps(uiUtils);
|
|
153
|
-
return
|
|
154
|
-
if (!slide) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
163
|
+
return slide => {
|
|
157
164
|
const type = getQuestionType(slide);
|
|
158
165
|
switch (type) {
|
|
159
166
|
case 'qcm':
|
|
@@ -173,3 +180,14 @@ export const mapApiSlideToUi = (uiUtils) => {
|
|
|
173
180
|
}
|
|
174
181
|
};
|
|
175
182
|
};
|
|
183
|
+
export const mapApiSlideToUi = (uiUtils) => {
|
|
184
|
+
const getAnswerUIModel_ = getAnswerUIModel(uiUtils);
|
|
185
|
+
const getHelp_ = getHelp(uiUtils);
|
|
186
|
+
return slide => {
|
|
187
|
+
if (!slide) {
|
|
188
|
+
throw new Error('no slide was found');
|
|
189
|
+
}
|
|
190
|
+
const questionText = pipe(getOr('', 'question.header'), uiUtils.translate)(slide);
|
|
191
|
+
return { questionText, answerUI: { model: getAnswerUIModel_(slide), help: getHelp_(slide) } };
|
|
192
|
+
};
|
|
193
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SlideFromAPI } from '../../../types/common';
|
|
1
|
+
import { SlideFromAPI, UISlide } from '../../../types/common';
|
|
3
2
|
export declare const freeTextSlide: SlideFromAPI;
|
|
4
|
-
export declare const freeTextUISlide:
|
|
3
|
+
export declare const freeTextUISlide: Partial<UISlide>;
|
|
@@ -17,8 +17,14 @@ export const freeTextSlide = {
|
|
|
17
17
|
tips: 'sli_E1Pcl-XAYbi.tips'
|
|
18
18
|
};
|
|
19
19
|
export const freeTextUISlide = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
answerUI: {
|
|
21
|
+
help: 'sli_E1Pcl-XAYbi.explanation',
|
|
22
|
+
model: {
|
|
23
|
+
type: 'freeText',
|
|
24
|
+
placeholder: 'Type here',
|
|
25
|
+
value: undefined,
|
|
26
|
+
onChange: noop
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
questionText: 'sli_E1Pcl-XAYbi.header'
|
|
24
30
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SlideFromAPI } from '../../../types/common';
|
|
1
|
+
import { SlideFromAPI, UISlide } from '../../../types/common';
|
|
3
2
|
export declare const qcmDragSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmDragUISlide:
|
|
3
|
+
export declare const qcmDragUISlide: Partial<UISlide>;
|
|
@@ -70,37 +70,43 @@ export const qcmDragSlide = {
|
|
|
70
70
|
tips: 'sli_419IlQQnf.tips'
|
|
71
71
|
};
|
|
72
72
|
export const qcmDragUISlide = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
73
|
+
questionText: 'sli_419IlQQnf.header',
|
|
74
|
+
answerUI: {
|
|
75
|
+
help: 'sli_419IlQQnf.explanation',
|
|
76
|
+
model: {
|
|
77
|
+
type: 'qcmDrag',
|
|
78
|
+
answers: [
|
|
79
|
+
{
|
|
80
|
+
title: 'sli_419IlQQnf.choice_4kWwlQXhG',
|
|
81
|
+
selected: false,
|
|
82
|
+
order: -1,
|
|
83
|
+
onClick: noop
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
title: 'sli_419IlQQnf.choice_NJxbwgXm2G',
|
|
87
|
+
selected: false,
|
|
88
|
+
order: -1,
|
|
89
|
+
onClick: noop
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: 'sli_419IlQQnf.choice_41fwgQXnf',
|
|
93
|
+
selected: false,
|
|
94
|
+
order: -1,
|
|
95
|
+
onClick: noop
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
title: 'sli_419IlQQnf.choice_VJmweQ7nz',
|
|
99
|
+
selected: false,
|
|
100
|
+
order: -1,
|
|
101
|
+
onClick: noop
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
title: 'sli_419IlQQnf.choice_4kDDgXQhz',
|
|
105
|
+
selected: false,
|
|
106
|
+
order: -1,
|
|
107
|
+
onClick: noop
|
|
108
|
+
}
|
|
109
|
+
]
|
|
104
110
|
}
|
|
105
|
-
|
|
111
|
+
}
|
|
106
112
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SlideFromAPI } from '../../../types/common';
|
|
1
|
+
import { SlideFromAPI, UISlide } from '../../../types/common';
|
|
3
2
|
export declare const qcmGraphicSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmGraphicUISlide:
|
|
3
|
+
export declare const qcmGraphicUISlide: Partial<UISlide>;
|
|
@@ -52,19 +52,25 @@ export const qcmGraphicSlide = {
|
|
|
52
52
|
tips: 'sli_41~RSVclH.tips'
|
|
53
53
|
};
|
|
54
54
|
export const qcmGraphicUISlide = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
questionText: 'sli_41~RSVclH.header',
|
|
56
|
+
answerUI: {
|
|
57
|
+
help: 'sli_41~RSVclH.explanation',
|
|
58
|
+
model: {
|
|
59
|
+
type: 'qcmGraphic',
|
|
60
|
+
answers: [
|
|
61
|
+
{
|
|
62
|
+
title: 'sli_41~RSVclH.choice_V1gN0r4qgS',
|
|
63
|
+
image: 'med_4JVRrE5gH.mediaUrl_VkBtUV9gB',
|
|
64
|
+
selected: false,
|
|
65
|
+
onClick: noop
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: 'sli_41~RSVclH.choice_4JlLeLE5lS',
|
|
69
|
+
image: 'med_Ek8gIEqxB.mediaUrl_EkcFUEclH',
|
|
70
|
+
selected: false,
|
|
71
|
+
onClick: noop
|
|
72
|
+
}
|
|
73
|
+
]
|
|
68
74
|
}
|
|
69
|
-
|
|
75
|
+
}
|
|
70
76
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SlideFromAPI } from '../../../types/common';
|
|
1
|
+
import { SlideFromAPI, UISlide } from '../../../types/common';
|
|
3
2
|
export declare const qcmSlide: SlideFromAPI;
|
|
4
|
-
export declare const qcmUISlide:
|
|
3
|
+
export declare const qcmUISlide: Partial<UISlide>;
|
|
@@ -69,31 +69,37 @@ export const qcmSlide = {
|
|
|
69
69
|
id: 'sli_N1XACJobn'
|
|
70
70
|
};
|
|
71
71
|
export const qcmUISlide = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
72
|
+
questionText: "Après la vente d'un NFT, son créateur peut-il toucher de l'argent ?",
|
|
73
|
+
answerUI: {
|
|
74
|
+
help: 'Sélectionnez la bonne réponse.',
|
|
75
|
+
model: {
|
|
76
|
+
type: 'qcm',
|
|
77
|
+
answers: [
|
|
78
|
+
{
|
|
79
|
+
title: 'Le créateur peut fixer un pourcentage pour chaque transaction future',
|
|
80
|
+
selected: false,
|
|
81
|
+
onClick: noop,
|
|
82
|
+
ariaLabel: 'Le créateur peut fixer un pourcentage pour chaque transaction future'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
title: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente",
|
|
86
|
+
selected: false,
|
|
87
|
+
onClick: noop,
|
|
88
|
+
ariaLabel: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
title: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT",
|
|
92
|
+
selected: false,
|
|
93
|
+
onClick: noop,
|
|
94
|
+
ariaLabel: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
title: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission",
|
|
98
|
+
selected: false,
|
|
99
|
+
onClick: noop,
|
|
100
|
+
ariaLabel: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission"
|
|
101
|
+
}
|
|
102
|
+
]
|
|
97
103
|
}
|
|
98
|
-
|
|
104
|
+
}
|
|
99
105
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SlideFromAPI } from '../../../types/common';
|
|
1
|
+
import { SlideFromAPI, UISlide } from '../../../types/common';
|
|
3
2
|
export declare const selectTemplateSlide: SlideFromAPI;
|
|
4
|
-
export declare const selectTemplateUISlide:
|
|
3
|
+
export declare const selectTemplateUISlide: Partial<UISlide>;
|
|
@@ -49,40 +49,46 @@ export const selectTemplateSlide = {
|
|
|
49
49
|
tips: 'sli_410xZQxrZ.tips'
|
|
50
50
|
};
|
|
51
51
|
export const selectTemplateUISlide = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
type: '
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
options: [
|
|
60
|
-
{ name: 'Select an answer', value: '', validOption: false, selected: true },
|
|
61
|
-
{
|
|
62
|
-
name: 'sli_410xZQxrZ.choice_4yeA4Z7lr~',
|
|
63
|
-
value: 'sli_410xZQxrZ.choice_4yeA4Z7lr~',
|
|
64
|
-
validOption: true,
|
|
65
|
-
selected: false
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: 'sli_410xZQxrZ.choice_VJWCN~mgB~',
|
|
69
|
-
value: 'sli_410xZQxrZ.choice_VJWCN~mgB~',
|
|
70
|
-
validOption: true,
|
|
71
|
-
selected: false
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: 'sli_410xZQxrZ.choice_VkaH~XgBb',
|
|
75
|
-
value: 'sli_410xZQxrZ.choice_VkaH~XgBb',
|
|
76
|
-
validOption: true,
|
|
77
|
-
selected: false
|
|
78
|
-
},
|
|
52
|
+
questionText: 'sli_410xZQxrZ.header',
|
|
53
|
+
answerUI: {
|
|
54
|
+
help: 'sli_410xZQxrZ.explanation',
|
|
55
|
+
model: {
|
|
56
|
+
type: 'template',
|
|
57
|
+
template: 'sli_410xZQxrZ.template',
|
|
58
|
+
answers: [
|
|
79
59
|
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
60
|
+
type: 'select',
|
|
61
|
+
name: 'sel36665',
|
|
62
|
+
onChange: noop,
|
|
63
|
+
options: [
|
|
64
|
+
{ name: 'Select an answer', value: '', validOption: false, selected: true },
|
|
65
|
+
{
|
|
66
|
+
name: 'sli_410xZQxrZ.choice_4yeA4Z7lr~',
|
|
67
|
+
value: 'sli_410xZQxrZ.choice_4yeA4Z7lr~',
|
|
68
|
+
validOption: true,
|
|
69
|
+
selected: false
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'sli_410xZQxrZ.choice_VJWCN~mgB~',
|
|
73
|
+
value: 'sli_410xZQxrZ.choice_VJWCN~mgB~',
|
|
74
|
+
validOption: true,
|
|
75
|
+
selected: false
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'sli_410xZQxrZ.choice_VkaH~XgBb',
|
|
79
|
+
value: 'sli_410xZQxrZ.choice_VkaH~XgBb',
|
|
80
|
+
validOption: true,
|
|
81
|
+
selected: false
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'sli_410xZQxrZ.choice_E1uUWXeBb',
|
|
85
|
+
value: 'sli_410xZQxrZ.choice_E1uUWXeBb',
|
|
86
|
+
validOption: true,
|
|
87
|
+
selected: false
|
|
88
|
+
}
|
|
89
|
+
]
|
|
84
90
|
}
|
|
85
91
|
]
|
|
86
92
|
}
|
|
87
|
-
|
|
93
|
+
}
|
|
88
94
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SlideFromAPI } from '../../../types/common';
|
|
1
|
+
import { SlideFromAPI, UISlide } from '../../../types/common';
|
|
3
2
|
export declare const sliderSlide: SlideFromAPI;
|
|
4
|
-
export declare const sliderUISlide:
|
|
3
|
+
export declare const sliderUISlide: Partial<UISlide>;
|