@coorpacademy/app-review 0.1.9 → 0.1.11
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/ui/navigation.d.ts +1 -1
- package/es/fixtures/qcm-slide.js +1 -1
- package/es/helpers/map-api-slide-to-ui.d.ts +8 -0
- package/es/helpers/map-api-slide-to-ui.js +175 -0
- package/es/helpers/test/fixtures/free-text.d.ts +4 -0
- package/es/helpers/test/fixtures/free-text.js +24 -0
- package/es/helpers/test/fixtures/qcm-drag.d.ts +4 -0
- package/es/helpers/test/fixtures/qcm-drag.js +106 -0
- package/es/helpers/test/fixtures/qcm-graphic.d.ts +4 -0
- package/es/helpers/test/fixtures/qcm-graphic.js +70 -0
- package/es/helpers/test/fixtures/qcm.d.ts +4 -0
- package/es/helpers/test/fixtures/qcm.js +99 -0
- package/es/helpers/test/fixtures/select-template.d.ts +4 -0
- package/es/helpers/test/fixtures/select-template.js +88 -0
- package/es/helpers/test/fixtures/slider.d.ts +4 -0
- package/es/helpers/test/fixtures/slider.js +27 -0
- package/es/helpers/test/fixtures/text-template.d.ts +4 -0
- package/es/helpers/test/fixtures/text-template.js +48 -0
- package/es/helpers/test/map-api-slide-to-ui.test.d.ts +1 -0
- package/es/helpers/test/map-api-slide-to-ui.test.js +32 -0
- package/es/index.js +29 -9
- package/es/reducers/ui/navigation.d.ts +1 -1
- package/es/test/index.test.js +18 -15
- package/es/test/util/services.mock.js +2 -32
- package/es/types/common.d.ts +62 -5
- package/es/types/slides.d.ts +27 -16
- package/lib/actions/ui/navigation.d.ts +1 -1
- package/lib/fixtures/qcm-slide.js +1 -1
- package/lib/helpers/map-api-slide-to-ui.d.ts +8 -0
- package/lib/helpers/map-api-slide-to-ui.js +181 -0
- package/lib/helpers/test/fixtures/free-text.d.ts +4 -0
- package/lib/helpers/test/fixtures/free-text.js +24 -0
- package/lib/helpers/test/fixtures/qcm-drag.d.ts +4 -0
- package/lib/helpers/test/fixtures/qcm-drag.js +106 -0
- package/lib/helpers/test/fixtures/qcm-graphic.d.ts +4 -0
- package/lib/helpers/test/fixtures/qcm-graphic.js +70 -0
- package/lib/helpers/test/fixtures/qcm.d.ts +4 -0
- package/lib/helpers/test/fixtures/qcm.js +99 -0
- package/lib/helpers/test/fixtures/select-template.d.ts +4 -0
- package/lib/helpers/test/fixtures/select-template.js +88 -0
- package/lib/helpers/test/fixtures/slider.d.ts +4 -0
- package/lib/helpers/test/fixtures/slider.js +27 -0
- package/lib/helpers/test/fixtures/text-template.d.ts +4 -0
- package/lib/helpers/test/fixtures/text-template.js +48 -0
- package/lib/helpers/test/map-api-slide-to-ui.test.d.ts +1 -0
- package/lib/helpers/test/map-api-slide-to-ui.test.js +43 -0
- package/lib/index.js +29 -9
- package/lib/reducers/ui/navigation.d.ts +1 -1
- package/lib/test/index.test.js +19 -16
- package/lib/test/util/services.mock.js +13 -32
- package/lib/types/common.d.ts +62 -5
- package/lib/types/slides.d.ts +27 -16
- package/package.json +4 -3
- package/src/actions/ui/navigation.ts +1 -1
- package/src/fixtures/qcm-slide.ts +1 -1
- package/src/helpers/map-api-slide-to-ui.ts +253 -0
- package/src/helpers/test/fixtures/free-text.ts +28 -0
- package/src/helpers/test/fixtures/qcm-drag.ts +110 -0
- package/src/helpers/test/fixtures/qcm-graphic.ts +74 -0
- package/src/helpers/test/fixtures/qcm.ts +108 -0
- package/src/helpers/test/fixtures/select-template.ts +92 -0
- package/src/helpers/test/fixtures/slider.ts +31 -0
- package/src/helpers/test/fixtures/text-template.ts +52 -0
- package/src/helpers/test/map-api-slide-to-ui.test.ts +55 -0
- package/src/index.tsx +35 -11
- package/src/reducers/ui/navigation.ts +1 -1
- package/src/test/index.test.tsx +23 -12
- package/src/test/util/services.mock.ts +2 -32
- package/src/types/common.ts +74 -5
- package/src/types/slides.ts +29 -12
package/src/types/common.ts
CHANGED
|
@@ -7,14 +7,83 @@ type TemplateContextValues = {
|
|
|
7
7
|
translations?: unknown; // TODO type Translations
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
// TODO: EDIT_CHOICES -> specify typing
|
|
11
|
+
export type ChoiceFromAPI = {
|
|
12
|
+
_id: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
type?: 'text' | 'select';
|
|
17
|
+
label?: string;
|
|
18
|
+
items: {text: string; value: string; _id: string}[];
|
|
19
|
+
media?: unknown;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type BaseContent = {
|
|
23
|
+
media?: unknown;
|
|
24
|
+
choices: ChoiceFromAPI[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type Question = {
|
|
28
|
+
header?: string;
|
|
29
|
+
content: BaseContent;
|
|
30
|
+
explanation?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type QcmQuestion = Question & {
|
|
34
|
+
type: 'qcm';
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type QcmGraphicQuestion = Question & {
|
|
38
|
+
type: 'qcmGraphic';
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type QcmDragQuestion = Question & {
|
|
42
|
+
type: 'qcmDrag';
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type BasicQuestion = Omit<Question, 'content'> & {
|
|
46
|
+
type: 'basic';
|
|
47
|
+
content: {
|
|
48
|
+
media?: unknown;
|
|
49
|
+
label?: string;
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
id: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type SliderQuestion = Omit<Question, 'content'> & {
|
|
56
|
+
content: {
|
|
57
|
+
media?: unknown;
|
|
58
|
+
unitLabel: string;
|
|
59
|
+
min: number;
|
|
60
|
+
max: number;
|
|
61
|
+
step?: number;
|
|
15
62
|
};
|
|
63
|
+
type: 'slider';
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type TemplateQuestion = Omit<Question, 'content'> & {
|
|
67
|
+
content: BaseContent & {
|
|
68
|
+
template: string;
|
|
69
|
+
};
|
|
70
|
+
type: 'template';
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type SlideFromAPI = {
|
|
74
|
+
question:
|
|
75
|
+
| QcmQuestion
|
|
76
|
+
| QcmGraphicQuestion
|
|
77
|
+
| QcmDragQuestion
|
|
78
|
+
| BasicQuestion
|
|
79
|
+
| SliderQuestion
|
|
80
|
+
| TemplateQuestion;
|
|
16
81
|
klf: string;
|
|
17
82
|
universalRef: string;
|
|
83
|
+
tips?: string;
|
|
84
|
+
clue?: string;
|
|
85
|
+
hasClue?: boolean;
|
|
86
|
+
id?: string;
|
|
18
87
|
};
|
|
19
88
|
|
|
20
89
|
export type ProgressionFromAPI = {
|
package/src/types/slides.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export type Choice = {
|
|
2
2
|
order?: number;
|
|
3
3
|
selected: boolean;
|
|
4
|
-
title
|
|
5
|
-
help
|
|
4
|
+
title?: string;
|
|
5
|
+
help?: string;
|
|
6
6
|
onClick: Function;
|
|
7
|
+
ariaLabel?: string;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
export type QcmDrag = {
|
|
@@ -14,20 +15,20 @@ export type QcmDrag = {
|
|
|
14
15
|
|
|
15
16
|
export type Qcm = {
|
|
16
17
|
type: 'qcm';
|
|
17
|
-
|
|
18
|
+
answers: Choice[];
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export type QcmGraphic = {
|
|
21
22
|
type: 'qcmGraphic';
|
|
22
|
-
|
|
23
|
+
answers: (Choice & {image: string})[];
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
export type FreeText = {
|
|
26
27
|
type: 'freeText';
|
|
27
28
|
placeholder: string;
|
|
28
|
-
value
|
|
29
|
+
value?: string;
|
|
29
30
|
onChange: Function;
|
|
30
|
-
ariaLabel
|
|
31
|
+
ariaLabel?: string;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
export type DropDownOption = {
|
|
@@ -39,9 +40,9 @@ export type DropDownOption = {
|
|
|
39
40
|
|
|
40
41
|
export type DropDown = {
|
|
41
42
|
type: 'dropDown';
|
|
42
|
-
onChange
|
|
43
|
+
onChange?: Function;
|
|
43
44
|
options: DropDownOption[];
|
|
44
|
-
theme
|
|
45
|
+
theme?:
|
|
45
46
|
| 'filter'
|
|
46
47
|
| 'invalid'
|
|
47
48
|
| 'header'
|
|
@@ -56,19 +57,35 @@ export type DropDown = {
|
|
|
56
57
|
|
|
57
58
|
export type QuestionRange = {
|
|
58
59
|
type: 'slider';
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
onChange?: Function;
|
|
62
|
+
onChangeEnd?: Function;
|
|
63
|
+
multi?: boolean;
|
|
62
64
|
value: number | number[];
|
|
63
65
|
title: string;
|
|
64
66
|
minLabel: string;
|
|
65
67
|
maxLabel: string;
|
|
66
68
|
};
|
|
67
69
|
|
|
70
|
+
export type TextTemplate = {
|
|
71
|
+
type: 'text';
|
|
72
|
+
name: string;
|
|
73
|
+
placeholder: string;
|
|
74
|
+
value?: string;
|
|
75
|
+
onChange: Function;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type SelectionTemplate = {
|
|
79
|
+
type: 'select';
|
|
80
|
+
name: string;
|
|
81
|
+
onChange?: Function;
|
|
82
|
+
options?: DropDownOption[];
|
|
83
|
+
};
|
|
84
|
+
|
|
68
85
|
export type Template = {
|
|
69
86
|
type: 'template';
|
|
70
87
|
template: string;
|
|
71
|
-
|
|
88
|
+
answers: (TextTemplate | SelectionTemplate)[];
|
|
72
89
|
};
|
|
73
90
|
|
|
74
91
|
export type AnswerUI = {
|