@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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import noop from 'lodash/fp/noop';
|
|
2
|
+
export var qcmDragSlide = {
|
|
3
|
+
id: 'sli_419IlQQnf',
|
|
4
|
+
universalRef: 'sli_419IlQQnf',
|
|
5
|
+
question: {
|
|
6
|
+
type: 'qcmDrag',
|
|
7
|
+
header: 'sli_419IlQQnf.header',
|
|
8
|
+
explanation: 'sli_419IlQQnf.explanation',
|
|
9
|
+
content: {
|
|
10
|
+
choices: [
|
|
11
|
+
{
|
|
12
|
+
media: {
|
|
13
|
+
src: [],
|
|
14
|
+
posters: [],
|
|
15
|
+
subtitles: []
|
|
16
|
+
},
|
|
17
|
+
_id: '62b1ba3ec4f4015504212571',
|
|
18
|
+
label: 'sli_419IlQQnf.choice_4kWwlQXhG',
|
|
19
|
+
value: 'sli_419IlQQnf.choice_4kWwlQXhG',
|
|
20
|
+
items: []
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
media: {
|
|
24
|
+
src: [],
|
|
25
|
+
posters: [],
|
|
26
|
+
subtitles: []
|
|
27
|
+
},
|
|
28
|
+
_id: '62b1ba3ec4f4015504212572',
|
|
29
|
+
label: 'sli_419IlQQnf.choice_NJxbwgXm2G',
|
|
30
|
+
value: 'sli_419IlQQnf.choice_NJxbwgXm2G',
|
|
31
|
+
items: []
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
media: {
|
|
35
|
+
src: [],
|
|
36
|
+
posters: [],
|
|
37
|
+
subtitles: []
|
|
38
|
+
},
|
|
39
|
+
_id: '62b1ba3ec4f4015504212573',
|
|
40
|
+
label: 'sli_419IlQQnf.choice_41fwgQXnf',
|
|
41
|
+
value: 'sli_419IlQQnf.choice_41fwgQXnf',
|
|
42
|
+
items: []
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
media: {
|
|
46
|
+
src: [],
|
|
47
|
+
posters: [],
|
|
48
|
+
subtitles: []
|
|
49
|
+
},
|
|
50
|
+
_id: '62b1ba3ec4f4015504212574',
|
|
51
|
+
label: 'sli_419IlQQnf.choice_VJmweQ7nz',
|
|
52
|
+
value: 'sli_419IlQQnf.choice_VJmweQ7nz',
|
|
53
|
+
items: []
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
media: {
|
|
57
|
+
src: [],
|
|
58
|
+
posters: [],
|
|
59
|
+
subtitles: []
|
|
60
|
+
},
|
|
61
|
+
_id: '62b1ba3ec4f4015504212575',
|
|
62
|
+
label: 'sli_419IlQQnf.choice_4kDDgXQhz',
|
|
63
|
+
value: 'sli_419IlQQnf.choice_4kDDgXQhz',
|
|
64
|
+
items: []
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
klf: 'sli_419IlQQnf.klf',
|
|
70
|
+
tips: 'sli_419IlQQnf.tips'
|
|
71
|
+
};
|
|
72
|
+
export var qcmDragUISlide = {
|
|
73
|
+
type: 'qcmDrag',
|
|
74
|
+
answers: [
|
|
75
|
+
{
|
|
76
|
+
title: 'sli_419IlQQnf.choice_4kWwlQXhG',
|
|
77
|
+
selected: false,
|
|
78
|
+
order: -1,
|
|
79
|
+
onClick: noop
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: 'sli_419IlQQnf.choice_NJxbwgXm2G',
|
|
83
|
+
selected: false,
|
|
84
|
+
order: -1,
|
|
85
|
+
onClick: noop
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: 'sli_419IlQQnf.choice_41fwgQXnf',
|
|
89
|
+
selected: false,
|
|
90
|
+
order: -1,
|
|
91
|
+
onClick: noop
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
title: 'sli_419IlQQnf.choice_VJmweQ7nz',
|
|
95
|
+
selected: false,
|
|
96
|
+
order: -1,
|
|
97
|
+
onClick: noop
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: 'sli_419IlQQnf.choice_4kDDgXQhz',
|
|
101
|
+
selected: false,
|
|
102
|
+
order: -1,
|
|
103
|
+
onClick: noop
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import noop from 'lodash/fp/noop';
|
|
2
|
+
export var qcmGraphicSlide = {
|
|
3
|
+
id: 'sli_41~RSVclH',
|
|
4
|
+
universalRef: 'sli_41~RSVclH',
|
|
5
|
+
question: {
|
|
6
|
+
type: 'qcmGraphic',
|
|
7
|
+
header: 'sli_41~RSVclH.header',
|
|
8
|
+
explanation: 'sli_41~RSVclH.explanation',
|
|
9
|
+
content: {
|
|
10
|
+
choices: [
|
|
11
|
+
{
|
|
12
|
+
media: {
|
|
13
|
+
type: 'img',
|
|
14
|
+
src: [
|
|
15
|
+
{
|
|
16
|
+
_id: '5fdce726359bf4003ee66997',
|
|
17
|
+
mimeType: 'image/png',
|
|
18
|
+
url: 'med_4JVRrE5gH.mediaUrl_VkBtUV9gB'
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
posters: [],
|
|
22
|
+
subtitles: []
|
|
23
|
+
},
|
|
24
|
+
_id: '5fdce726359bf4003ee66996',
|
|
25
|
+
label: 'sli_41~RSVclH.choice_V1gN0r4qgS',
|
|
26
|
+
value: 'sli_41~RSVclH.choice_V1gN0r4qgS',
|
|
27
|
+
items: []
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
media: {
|
|
31
|
+
type: 'img',
|
|
32
|
+
src: [
|
|
33
|
+
{
|
|
34
|
+
_id: '5fdce726359bf4003ee66999',
|
|
35
|
+
mimeType: 'image/png',
|
|
36
|
+
url: 'med_Ek8gIEqxB.mediaUrl_EkcFUEclH'
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
posters: [],
|
|
40
|
+
subtitles: []
|
|
41
|
+
},
|
|
42
|
+
_id: '5fdce726359bf4003ee66998',
|
|
43
|
+
label: 'sli_41~RSVclH.choice_4JlLeLE5lS',
|
|
44
|
+
value: 'sli_41~RSVclH.choice_4JlLeLE5lS',
|
|
45
|
+
items: []
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
clue: 'sli_41~RSVclH.clue',
|
|
51
|
+
klf: 'sli_41~RSVclH.klf',
|
|
52
|
+
tips: 'sli_41~RSVclH.tips'
|
|
53
|
+
};
|
|
54
|
+
export var qcmGraphicUISlide = {
|
|
55
|
+
type: 'qcmGraphic',
|
|
56
|
+
answers: [
|
|
57
|
+
{
|
|
58
|
+
title: 'sli_41~RSVclH.choice_V1gN0r4qgS',
|
|
59
|
+
image: 'med_4JVRrE5gH.mediaUrl_VkBtUV9gB',
|
|
60
|
+
selected: false,
|
|
61
|
+
onClick: noop
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: 'sli_41~RSVclH.choice_4JlLeLE5lS',
|
|
65
|
+
image: 'med_Ek8gIEqxB.mediaUrl_EkcFUEclH',
|
|
66
|
+
selected: false,
|
|
67
|
+
onClick: noop
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import noop from 'lodash/fp/noop';
|
|
2
|
+
export var qcmSlide = {
|
|
3
|
+
question: {
|
|
4
|
+
content: {
|
|
5
|
+
media: {
|
|
6
|
+
src: [],
|
|
7
|
+
posters: [],
|
|
8
|
+
subtitles: []
|
|
9
|
+
},
|
|
10
|
+
choices: [
|
|
11
|
+
{
|
|
12
|
+
media: {
|
|
13
|
+
src: [],
|
|
14
|
+
posters: [],
|
|
15
|
+
subtitles: []
|
|
16
|
+
},
|
|
17
|
+
items: [],
|
|
18
|
+
_id: '62c853412d0f9b088718e759',
|
|
19
|
+
label: 'Le créateur peut fixer un pourcentage pour chaque transaction future',
|
|
20
|
+
value: 'sli_N1XACJobn.choice_4JjaSesZh',
|
|
21
|
+
id: '62c853412d0f9b088718e759'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
media: {
|
|
25
|
+
src: [],
|
|
26
|
+
posters: [],
|
|
27
|
+
subtitles: []
|
|
28
|
+
},
|
|
29
|
+
items: [],
|
|
30
|
+
_id: '62c853412d0f9b088718e75a',
|
|
31
|
+
label: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente",
|
|
32
|
+
value: 'sli_N1XACJobn.choice_Ny78UlsWh',
|
|
33
|
+
id: '62c853412d0f9b088718e75a'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
media: {
|
|
37
|
+
src: [],
|
|
38
|
+
posters: [],
|
|
39
|
+
subtitles: []
|
|
40
|
+
},
|
|
41
|
+
items: [],
|
|
42
|
+
_id: '62c853412d0f9b088718e75b',
|
|
43
|
+
label: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT",
|
|
44
|
+
value: 'sli_N1XACJobn.choice_Eypt8esW2',
|
|
45
|
+
id: '62c853412d0f9b088718e75b'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
media: {
|
|
49
|
+
src: [],
|
|
50
|
+
posters: [],
|
|
51
|
+
subtitles: []
|
|
52
|
+
},
|
|
53
|
+
items: [],
|
|
54
|
+
_id: '62c853412d0f9b088718e75c',
|
|
55
|
+
label: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission",
|
|
56
|
+
value: 'sli_N1XACJobn.choice_VyS3LxjZh',
|
|
57
|
+
id: '62c853412d0f9b088718e75c'
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
type: 'qcm',
|
|
62
|
+
header: "Après la vente d'un NFT, son créateur peut-il toucher de l'argent ?",
|
|
63
|
+
explanation: 'Sélectionnez la bonne réponse.'
|
|
64
|
+
},
|
|
65
|
+
klf: 'Si vous êtes le créateur d’un NFT, vous pouvez choisir le pourcentage de commission pour chaque transaction de votre NFT. Certains choisissent de ne rien toucher pour fluidifier le marché.',
|
|
66
|
+
tips: 'En 2021, le média en ligne Numerama a créé un NFT vendu aux enchères sur OpenSea. Sur cette plateforme, il est obligatoire de mettre un prix de réserve, autrement dit un prix minimum au-dessous duquel la vente ne sera pas automatiquement acceptée. Sur OpenSea il ne peut être inférieur à 1 ETH. Si le prix de réserve est atteint, pas de problème, les "gas fees" (les frais de gaz) sont couverts par OpenSea. Mais, si ce n’est pas le cas, c’est au vendeur de s’en acquitter. <br/>Le NFT en question est parti à 0,021 ETH, soit 40€ au cours de l\'époque, un prix inférieur au prix de réserve. Numerama a dû acquitter des frais de gaz, et payer 190 €. <br/>Avec les NFT, on ne gagne pas à tous les coups.',
|
|
67
|
+
universalRef: 'sli_N1XACJobn',
|
|
68
|
+
hasClue: true,
|
|
69
|
+
id: 'sli_N1XACJobn'
|
|
70
|
+
};
|
|
71
|
+
export var qcmUISlide = {
|
|
72
|
+
type: 'qcm',
|
|
73
|
+
answers: [
|
|
74
|
+
{
|
|
75
|
+
title: 'Le créateur peut fixer un pourcentage pour chaque transaction future',
|
|
76
|
+
selected: false,
|
|
77
|
+
onClick: noop,
|
|
78
|
+
ariaLabel: 'Le créateur peut fixer un pourcentage pour chaque transaction future'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente",
|
|
82
|
+
selected: false,
|
|
83
|
+
onClick: noop,
|
|
84
|
+
ariaLabel: "Pour chaque transaction il existe un pourcentage fixe déterminé par le droit d'auteur du pays où se tient la vente"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT",
|
|
88
|
+
selected: false,
|
|
89
|
+
onClick: noop,
|
|
90
|
+
ariaLabel: "Seule la galerie ou la plateforme peut toucher une commission sur la vente d'un NFT"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission",
|
|
94
|
+
selected: false,
|
|
95
|
+
onClick: noop,
|
|
96
|
+
ariaLabel: "Les NFT payés en ETH ne peuvent pas être soumis au paiement d'une commission"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import noop from 'lodash/fp/noop';
|
|
2
|
+
export var selectTemplateSlide = {
|
|
3
|
+
id: 'sli_410xZQxrZ',
|
|
4
|
+
universalRef: 'sli_410xZQxrZ',
|
|
5
|
+
question: {
|
|
6
|
+
type: 'template',
|
|
7
|
+
header: 'sli_410xZQxrZ.header',
|
|
8
|
+
explanation: 'sli_410xZQxrZ.explanation',
|
|
9
|
+
content: {
|
|
10
|
+
template: 'sli_410xZQxrZ.template',
|
|
11
|
+
choices: [
|
|
12
|
+
{
|
|
13
|
+
media: {
|
|
14
|
+
src: [],
|
|
15
|
+
posters: [],
|
|
16
|
+
subtitles: []
|
|
17
|
+
},
|
|
18
|
+
_id: '5fdce726359bf4003ee66967',
|
|
19
|
+
type: 'select',
|
|
20
|
+
name: 'sel36665',
|
|
21
|
+
items: [
|
|
22
|
+
{
|
|
23
|
+
_id: '5fdce726359bf4003ee66968',
|
|
24
|
+
text: 'sli_410xZQxrZ.choice_4yeA4Z7lr~',
|
|
25
|
+
value: 'sli_410xZQxrZ.choice_4yeA4Z7lr~'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
_id: '5fdce726359bf4003ee66969',
|
|
29
|
+
text: 'sli_410xZQxrZ.choice_VJWCN~mgB~',
|
|
30
|
+
value: 'sli_410xZQxrZ.choice_VJWCN~mgB~'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
_id: '5fdce726359bf4003ee6696a',
|
|
34
|
+
text: 'sli_410xZQxrZ.choice_VkaH~XgBb',
|
|
35
|
+
value: 'sli_410xZQxrZ.choice_VkaH~XgBb'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
_id: '5fdce726359bf4003ee6696b',
|
|
39
|
+
text: 'sli_410xZQxrZ.choice_E1uUWXeBb',
|
|
40
|
+
value: 'sli_410xZQxrZ.choice_E1uUWXeBb'
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
clue: 'sli_410xZQxrZ.clue',
|
|
48
|
+
klf: 'sli_410xZQxrZ.klf',
|
|
49
|
+
tips: 'sli_410xZQxrZ.tips'
|
|
50
|
+
};
|
|
51
|
+
export var selectTemplateUISlide = {
|
|
52
|
+
type: 'template',
|
|
53
|
+
template: 'sli_410xZQxrZ.template',
|
|
54
|
+
answers: [
|
|
55
|
+
{
|
|
56
|
+
type: 'select',
|
|
57
|
+
name: 'sel36665',
|
|
58
|
+
onChange: noop,
|
|
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
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'sli_410xZQxrZ.choice_E1uUWXeBb',
|
|
81
|
+
value: 'sli_410xZQxrZ.choice_E1uUWXeBb',
|
|
82
|
+
validOption: true,
|
|
83
|
+
selected: false
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import noop from 'lodash/fp/noop';
|
|
2
|
+
export var sliderSlide = {
|
|
3
|
+
id: 'sli_41D5AovN~',
|
|
4
|
+
universalRef: 'sli_41D5AovN~',
|
|
5
|
+
question: {
|
|
6
|
+
type: 'slider',
|
|
7
|
+
header: 'sli_41D5AovN~.header',
|
|
8
|
+
explanation: 'sli_41D5AovN~.explanation',
|
|
9
|
+
content: {
|
|
10
|
+
min: 1,
|
|
11
|
+
max: 10,
|
|
12
|
+
unitLabel: 'sli_41D5AovN~.unitLabel'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
clue: 'sli_41D5AovN~.clue',
|
|
16
|
+
klf: 'sli_41D5AovN~.klf',
|
|
17
|
+
tips: 'sli_41D5AovN~.tips'
|
|
18
|
+
};
|
|
19
|
+
export var sliderUISlide = {
|
|
20
|
+
type: 'slider',
|
|
21
|
+
placeholder: 'sli_41D5AovN~.explanation',
|
|
22
|
+
minLabel: '1 undefined',
|
|
23
|
+
maxLabel: '10 undefined',
|
|
24
|
+
title: '0 sli_41D5AovN~.unitLabel',
|
|
25
|
+
value: -0.1111111111111111,
|
|
26
|
+
onChange: noop
|
|
27
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import noop from 'lodash/fp/noop';
|
|
2
|
+
export var textTemplateSlide = {
|
|
3
|
+
question: {
|
|
4
|
+
content: {
|
|
5
|
+
media: {
|
|
6
|
+
src: [],
|
|
7
|
+
posters: [],
|
|
8
|
+
subtitles: []
|
|
9
|
+
},
|
|
10
|
+
template: 'Un {{inp58402}} model.',
|
|
11
|
+
choices: [
|
|
12
|
+
{
|
|
13
|
+
media: {
|
|
14
|
+
src: [],
|
|
15
|
+
posters: [],
|
|
16
|
+
subtitles: []
|
|
17
|
+
},
|
|
18
|
+
items: [],
|
|
19
|
+
_id: '62433c2c58920f02c4950de0',
|
|
20
|
+
type: 'text',
|
|
21
|
+
name: 'inp58402',
|
|
22
|
+
id: '62433c2c58920f02c4950de0'
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
type: 'template',
|
|
27
|
+
header: 'Comment le protégé doit-il percevoir son mentor ?',
|
|
28
|
+
explanation: 'Saisissez votre réponse (en anglais).'
|
|
29
|
+
},
|
|
30
|
+
klf: "Le mentoré voit dans son mentor un <i>role model</i>, c'est-à-dire un exemple inspirant qui lui permet de se projeter dans un poste à responsabilité.",
|
|
31
|
+
tips: "L'origine de l'expression <i>role model</i> est attribué au sociologue Robert K. Merton.",
|
|
32
|
+
universalRef: 'sli_VJKQonm2g',
|
|
33
|
+
hasClue: true,
|
|
34
|
+
id: 'sli_VJKQonm2g'
|
|
35
|
+
};
|
|
36
|
+
export var textTemplateUISlide = {
|
|
37
|
+
type: 'template',
|
|
38
|
+
template: 'Un {{inp58402}} model.',
|
|
39
|
+
answers: [
|
|
40
|
+
{
|
|
41
|
+
type: 'text',
|
|
42
|
+
name: 'inp58402',
|
|
43
|
+
placeholder: 'Type here',
|
|
44
|
+
value: undefined,
|
|
45
|
+
onChange: noop
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import test from 'ava';
|
|
13
|
+
import { mapApiSlideToUi } from '../map-api-slide-to-ui';
|
|
14
|
+
import { qcmUISlide, qcmSlide } from './fixtures/qcm';
|
|
15
|
+
import { qcmDragUISlide, qcmDragSlide } from './fixtures/qcm-drag';
|
|
16
|
+
import { freeTextSlide, freeTextUISlide } from './fixtures/free-text';
|
|
17
|
+
import { qcmGraphicUISlide, qcmGraphicSlide } from './fixtures/qcm-graphic';
|
|
18
|
+
import { textTemplateSlide, textTemplateUISlide } from './fixtures/text-template';
|
|
19
|
+
import { selectTemplateSlide, selectTemplateUISlide } from './fixtures/select-template';
|
|
20
|
+
import { sliderSlide, sliderUISlide } from './fixtures/slider';
|
|
21
|
+
var _mapApiSlideToUi = mapApiSlideToUi({ translate: function (text) { return text; } });
|
|
22
|
+
var macro = test.macro({
|
|
23
|
+
title: function (providedTitle) {
|
|
24
|
+
return "should handle ".concat(providedTitle, " conversion").trim();
|
|
25
|
+
},
|
|
26
|
+
exec: function (t, arg) {
|
|
27
|
+
t.deepEqual(JSON.parse(JSON.stringify(_mapApiSlideToUi(arg.slide))), JSON.parse(JSON.stringify(arg.expectedUiSlide)));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
test('qcm', macro, { slide: qcmSlide, expectedUiSlide: qcmUISlide });
|
|
31
|
+
test('qcm drag', macro, { slide: qcmDragSlide, expectedUiSlide: qcmDragUISlide });
|
|
32
|
+
test('qcm graphic', macro, { slide: qcmGraphicSlide, expectedUiSlide: qcmGraphicUISlide });
|
|
33
|
+
test('text template', macro, { slide: textTemplateSlide, expectedUiSlide: textTemplateUISlide });
|
|
34
|
+
test('select template', macro, {
|
|
35
|
+
slide: selectTemplateSlide,
|
|
36
|
+
expectedUiSlide: selectTemplateUISlide
|
|
37
|
+
});
|
|
38
|
+
test('free text', macro, { slide: freeTextSlide, expectedUiSlide: freeTextUISlide });
|
|
39
|
+
test('slider', macro, { slide: sliderSlide, expectedUiSlide: sliderUISlide });
|
|
40
|
+
test('should throw an error if the question type can not be handled', function (t) {
|
|
41
|
+
var faultySlide = __assign(__assign({}, qcmSlide), { question: { type: 'lol' } });
|
|
42
|
+
t.throws(function () { return _mapApiSlideToUi(faultySlide); });
|
|
43
|
+
});
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import React, { useEffect, useState } from 'react';
|
|
|
2
2
|
import { connect, Provider } from 'react-redux';
|
|
3
3
|
import AppReviewTemplate from '@coorpacademy/components/es/template/app-review';
|
|
4
4
|
import { TemplateContext } from '@coorpacademy/components/es/template/app-review/template-context';
|
|
5
|
+
import isEmpty from 'lodash/fp/isEmpty';
|
|
6
|
+
import get from 'lodash/fp/get';
|
|
5
7
|
import configureStore from './configure-store';
|
|
6
8
|
import { congratsProps, correctionPopinProps } from './fixtures/temp-fixture';
|
|
7
9
|
import { updateSlidesOnNext, updateSlidesOnValidation, validateSlide } from './actions/data/slides';
|
|
@@ -90,6 +92,7 @@ var App = connect(mapStateToProps, mapDispatchToProps)(AppReviewTemplate);
|
|
|
90
92
|
var AppReview = function (_a) {
|
|
91
93
|
var options = _a.options;
|
|
92
94
|
var _b = useState(null), store = _b[0], setStore = _b[1];
|
|
95
|
+
var _c = useState(false), isSlideFetched = _c[0], setIsSlideFetched = _c[1];
|
|
93
96
|
useEffect(function () {
|
|
94
97
|
if (store)
|
|
95
98
|
return;
|
|
@@ -97,28 +100,45 @@ var AppReview = function (_a) {
|
|
|
97
100
|
setStore(newStore);
|
|
98
101
|
}, [options, store]);
|
|
99
102
|
useEffect(function () {
|
|
100
|
-
if (store
|
|
103
|
+
if (!store || isSlideFetched)
|
|
101
104
|
return;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
return store.subscribe(function () {
|
|
106
|
+
var isSlidePresent = !isEmpty(store.getState().data.slides[0].questionText);
|
|
107
|
+
return isSlidePresent && setIsSlideFetched(isSlidePresent);
|
|
108
|
+
}); // using the first slide questionText for now, should only check for a slide's presence
|
|
109
|
+
// when the refactor is done (slides will be feed one by one on api's side)
|
|
110
|
+
}, [isSlideFetched, options, store]);
|
|
106
111
|
useEffect(function () {
|
|
107
|
-
|
|
112
|
+
var token = get('token', options);
|
|
113
|
+
if (store === null || isEmpty(token))
|
|
108
114
|
return;
|
|
109
|
-
var token = options.token;
|
|
110
115
|
store.dispatch(storeToken(token));
|
|
111
116
|
}, [options, store]);
|
|
112
117
|
useEffect(function () {
|
|
113
|
-
|
|
118
|
+
var token = get('token', options);
|
|
119
|
+
if (store === null || isEmpty(token))
|
|
114
120
|
return;
|
|
115
|
-
var skillRef =
|
|
121
|
+
var skillRef = get('skillRef', options);
|
|
116
122
|
// ThunkAction is not assignable to parameter of type 'AnyAction'
|
|
117
123
|
// ts problem describre here = https://github.com/reduxjs/redux-thunk/issues/333
|
|
118
124
|
skillRef
|
|
119
125
|
? store.dispatch(postProgression(skillRef, token))
|
|
120
126
|
: store.dispatch(fetchSkills(token));
|
|
121
127
|
}, [options, store]);
|
|
128
|
+
useEffect(function () {
|
|
129
|
+
if (store === null)
|
|
130
|
+
return;
|
|
131
|
+
var skillRef = options.skillRef;
|
|
132
|
+
if (skillRef && !isSlideFetched) {
|
|
133
|
+
store.dispatch(navigateTo('loader')); // use loader while posting progression
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
// TODO: when slides state is refactored (data + mapping),
|
|
137
|
+
// use loader in case a skillRef is found && no slides from the API
|
|
138
|
+
// are found
|
|
139
|
+
var initialView = skillRef ? VIEWS.slides : VIEWS.skills;
|
|
140
|
+
store.dispatch(navigateTo(initialView));
|
|
141
|
+
}, [isSlideFetched, options, store]);
|
|
122
142
|
if (!store)
|
|
123
143
|
return null;
|
|
124
144
|
var values = options.templateContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type NavigateTo, type NavigateBack } from '../../actions/ui/navigation';
|
|
2
|
-
export declare type NavigationState = Array<'skills' | 'onboarding' | 'slides'>;
|
|
2
|
+
export declare type NavigationState = Array<'skills' | 'onboarding' | 'slides' | 'loader'>;
|
|
3
3
|
declare const reducer: (state: NavigationState | undefined, action: NavigateTo | NavigateBack) => NavigationState;
|
|
4
4
|
export default reducer;
|
package/lib/test/index.test.js
CHANGED
|
@@ -138,29 +138,32 @@ var appOptions = {
|
|
|
138
138
|
skillRef: 'skill_NJC0jFKoH',
|
|
139
139
|
services: services
|
|
140
140
|
};
|
|
141
|
-
test('should
|
|
142
|
-
var container,
|
|
141
|
+
test('should show the loader while the app is fetching the data', function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
142
|
+
var container, loader;
|
|
143
143
|
return __generator(this, function (_a) {
|
|
144
144
|
switch (_a.label) {
|
|
145
145
|
case 0:
|
|
146
|
-
// t.plan(13);
|
|
147
146
|
t.plan(2);
|
|
148
|
-
container = render(React.createElement(AppReview, { options: appOptions
|
|
147
|
+
container = render(React.createElement(AppReview, { options: appOptions })).container;
|
|
149
148
|
return [4 /*yield*/, waitForChanges(1000)];
|
|
150
149
|
case 1:
|
|
151
150
|
_a.sent();
|
|
152
|
-
|
|
153
|
-
t.truthy(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
t.
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
loader = container.querySelector('[data-name="loader"]');
|
|
152
|
+
t.truthy(loader);
|
|
153
|
+
// await waitFor(async () => {
|
|
154
|
+
// // await sleep(500);
|
|
155
|
+
// const result = await t.try(tt => {
|
|
156
|
+
// // rerender(<AppReview options={appOptions} />);
|
|
157
|
+
// const slidesContainer = container.querySelector('[data-name="slides-revision-container"]');
|
|
158
|
+
// tt.truthy(slidesContainer);
|
|
159
|
+
// });
|
|
160
|
+
// if (result.passed) return result.commit();
|
|
161
|
+
// result.discard();
|
|
162
|
+
// throw result.errors;
|
|
163
|
+
// });
|
|
164
|
+
// const stackedSlidesContainer = container.querySelector('[data-name="stacked-slides-container"]');
|
|
165
|
+
// t.truthy(stackedSlidesContainer);
|
|
166
|
+
// await clickAllSlides(t, container);
|
|
164
167
|
t.pass();
|
|
165
168
|
return [2 /*return*/];
|
|
166
169
|
}
|