@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.
Files changed (174) hide show
  1. package/es/actions/api/fetch-slide.d.ts +3 -3
  2. package/es/actions/api/fetch-slide.js +22 -2
  3. package/es/actions/api/post-progression.js +1 -2
  4. package/es/actions/index.d.ts +1 -10
  5. package/es/actions/ui/is-fetching.js +0 -2
  6. package/es/actions/ui/slides.d.ts +26 -0
  7. package/es/actions/ui/slides.js +9 -0
  8. package/es/common/index.d.ts +3 -1
  9. package/es/common/index.js +3 -1
  10. package/es/fixtures/qcm-slide.d.ts +2 -2
  11. package/es/fixtures/temp-fixture.d.ts +2 -2
  12. package/es/helpers/map-api-slide-to-ui.d.ts +4 -1
  13. package/es/helpers/map-api-slide-to-ui.js +33 -15
  14. package/es/helpers/test/fixtures/free-text.d.ts +2 -3
  15. package/es/helpers/test/fixtures/free-text.js +10 -4
  16. package/es/helpers/test/fixtures/qcm-drag.d.ts +2 -3
  17. package/es/helpers/test/fixtures/qcm-drag.js +38 -32
  18. package/es/helpers/test/fixtures/qcm-graphic.d.ts +2 -3
  19. package/es/helpers/test/fixtures/qcm-graphic.js +20 -14
  20. package/es/helpers/test/fixtures/qcm.d.ts +2 -3
  21. package/es/helpers/test/fixtures/qcm.js +32 -26
  22. package/es/helpers/test/fixtures/select-template.d.ts +2 -3
  23. package/es/helpers/test/fixtures/select-template.js +38 -32
  24. package/es/helpers/test/fixtures/slider.d.ts +2 -3
  25. package/es/helpers/test/fixtures/slider.js +13 -7
  26. package/es/helpers/test/fixtures/text-template.d.ts +2 -3
  27. package/es/helpers/test/fixtures/text-template.js +16 -10
  28. package/es/index.js +14 -78
  29. package/es/reducers/data/index.d.ts +1 -1
  30. package/es/reducers/data/progression.d.ts +3 -16
  31. package/es/reducers/data/progression.js +3 -22
  32. package/es/reducers/data/slides.d.ts +5 -6
  33. package/es/reducers/data/slides.js +4 -107
  34. package/es/reducers/index.d.ts +3 -4
  35. package/es/reducers/ui/current-slide-ref.d.ts +4 -0
  36. package/es/reducers/ui/{review-status.js → current-slide-ref.js} +4 -4
  37. package/es/reducers/ui/index.d.ts +7 -10
  38. package/es/reducers/ui/index.js +4 -6
  39. package/es/reducers/ui/slides.d.ts +9 -0
  40. package/es/reducers/ui/slides.js +42 -0
  41. package/es/services/test/post-progression.test.js +6 -4
  42. package/es/test/util/services.mock.js +17 -5
  43. package/es/types/common.d.ts +40 -23
  44. package/es/types/common.js +0 -5
  45. package/es/types/slides.d.ts +0 -4
  46. package/es/types/views/slides.d.ts +41 -27
  47. package/es/types/views/slides.js +5 -0
  48. package/{lib/types/views/skills.d.ts → es/views/skills/index.d.ts} +2 -0
  49. package/es/views/skills/index.js +25 -0
  50. package/es/views/slides/index.d.ts +3 -0
  51. package/es/views/slides/index.js +85 -0
  52. package/lib/actions/api/fetch-slide.d.ts +3 -3
  53. package/lib/actions/api/fetch-slide.js +20 -2
  54. package/lib/actions/api/post-progression.js +1 -2
  55. package/lib/actions/index.d.ts +1 -10
  56. package/lib/actions/ui/is-fetching.js +0 -2
  57. package/lib/actions/ui/slides.d.ts +26 -0
  58. package/lib/actions/ui/slides.js +9 -0
  59. package/lib/common/index.d.ts +3 -1
  60. package/lib/common/index.js +3 -1
  61. package/lib/fixtures/qcm-slide.d.ts +2 -2
  62. package/lib/fixtures/temp-fixture.d.ts +2 -2
  63. package/lib/helpers/map-api-slide-to-ui.d.ts +4 -1
  64. package/lib/helpers/map-api-slide-to-ui.js +34 -14
  65. package/lib/helpers/test/fixtures/free-text.d.ts +2 -3
  66. package/lib/helpers/test/fixtures/free-text.js +10 -4
  67. package/lib/helpers/test/fixtures/qcm-drag.d.ts +2 -3
  68. package/lib/helpers/test/fixtures/qcm-drag.js +38 -32
  69. package/lib/helpers/test/fixtures/qcm-graphic.d.ts +2 -3
  70. package/lib/helpers/test/fixtures/qcm-graphic.js +20 -14
  71. package/lib/helpers/test/fixtures/qcm.d.ts +2 -3
  72. package/lib/helpers/test/fixtures/qcm.js +32 -26
  73. package/lib/helpers/test/fixtures/select-template.d.ts +2 -3
  74. package/lib/helpers/test/fixtures/select-template.js +38 -32
  75. package/lib/helpers/test/fixtures/slider.d.ts +2 -3
  76. package/lib/helpers/test/fixtures/slider.js +13 -7
  77. package/lib/helpers/test/fixtures/text-template.d.ts +2 -3
  78. package/lib/helpers/test/fixtures/text-template.js +16 -10
  79. package/lib/index.js +14 -78
  80. package/lib/reducers/data/index.d.ts +1 -1
  81. package/lib/reducers/data/progression.d.ts +3 -16
  82. package/lib/reducers/data/progression.js +3 -22
  83. package/lib/reducers/data/slides.d.ts +5 -6
  84. package/lib/reducers/data/slides.js +4 -113
  85. package/lib/reducers/index.d.ts +3 -4
  86. package/lib/reducers/ui/current-slide-ref.d.ts +4 -0
  87. package/lib/reducers/ui/{review-status.js → current-slide-ref.js} +4 -4
  88. package/lib/reducers/ui/index.d.ts +7 -10
  89. package/lib/reducers/ui/index.js +4 -6
  90. package/lib/reducers/ui/slides.d.ts +9 -0
  91. package/lib/reducers/ui/slides.js +43 -0
  92. package/lib/services/test/post-progression.test.js +6 -4
  93. package/lib/test/util/services.mock.js +17 -5
  94. package/lib/types/common.d.ts +40 -23
  95. package/lib/types/common.js +0 -5
  96. package/lib/types/slides.d.ts +0 -4
  97. package/lib/types/views/slides.d.ts +41 -27
  98. package/lib/types/views/slides.js +5 -0
  99. package/{es/types/views/skills.d.ts → lib/views/skills/index.d.ts} +2 -0
  100. package/lib/views/skills/index.js +25 -0
  101. package/lib/views/slides/index.d.ts +3 -0
  102. package/lib/views/slides/index.js +89 -0
  103. package/package.json +3 -3
  104. package/src/actions/api/fetch-slide.ts +26 -5
  105. package/src/actions/api/post-progression.ts +1 -2
  106. package/src/actions/index.ts +1 -10
  107. package/src/actions/ui/is-fetching.ts +0 -6
  108. package/src/actions/ui/slides.ts +35 -0
  109. package/src/common/index.ts +7 -1
  110. package/src/fixtures/qcm-slide.ts +2 -2
  111. package/src/fixtures/temp-fixture.ts +2 -2
  112. package/src/helpers/map-api-slide-to-ui.ts +43 -17
  113. package/src/helpers/test/fixtures/free-text.ts +12 -7
  114. package/src/helpers/test/fixtures/qcm-drag.ts +40 -35
  115. package/src/helpers/test/fixtures/qcm-graphic.ts +22 -17
  116. package/src/helpers/test/fixtures/qcm.ts +38 -32
  117. package/src/helpers/test/fixtures/select-template.ts +40 -35
  118. package/src/helpers/test/fixtures/slider.ts +15 -10
  119. package/src/helpers/test/fixtures/text-template.ts +18 -13
  120. package/src/helpers/test/map-api-slide-to-ui.test.ts +2 -11
  121. package/src/index.tsx +15 -84
  122. package/src/reducers/data/progression.ts +5 -40
  123. package/src/reducers/data/slides.ts +9 -126
  124. package/src/reducers/ui/current-slide-ref.ts +19 -0
  125. package/src/reducers/ui/index.ts +6 -9
  126. package/src/reducers/ui/slides.ts +58 -0
  127. package/src/services/test/post-progression.test.ts +6 -4
  128. package/src/test/util/services.mock.ts +17 -5
  129. package/src/types/common.ts +44 -27
  130. package/src/types/slides.ts +0 -5
  131. package/src/types/views/slides.ts +52 -27
  132. package/src/views/skills/index.ts +56 -0
  133. package/src/views/slides/index.ts +92 -0
  134. package/es/actions/data/slides.d.ts +0 -37
  135. package/es/actions/data/slides.js +0 -16
  136. package/es/actions/ui/finished-slides.d.ts +0 -10
  137. package/es/actions/ui/finished-slides.js +0 -8
  138. package/es/actions/ui/review-status.d.ts +0 -7
  139. package/es/actions/ui/review-status.js +0 -7
  140. package/es/actions/ui/step-items.d.ts +0 -24
  141. package/es/actions/ui/step-items.js +0 -11
  142. package/es/reducers/ui/finished-slides.d.ts +0 -7
  143. package/es/reducers/ui/finished-slides.js +0 -33
  144. package/es/reducers/ui/review-status.d.ts +0 -4
  145. package/es/reducers/ui/step-items.d.ts +0 -14
  146. package/es/reducers/ui/step-items.js +0 -74
  147. package/es/types/ui-progression.d.ts +0 -10
  148. package/es/types/ui-progression.js +0 -1
  149. package/es/types/views/skills.js +0 -1
  150. package/lib/actions/data/slides.d.ts +0 -37
  151. package/lib/actions/data/slides.js +0 -16
  152. package/lib/actions/ui/finished-slides.d.ts +0 -10
  153. package/lib/actions/ui/finished-slides.js +0 -8
  154. package/lib/actions/ui/review-status.d.ts +0 -7
  155. package/lib/actions/ui/review-status.js +0 -7
  156. package/lib/actions/ui/step-items.d.ts +0 -24
  157. package/lib/actions/ui/step-items.js +0 -11
  158. package/lib/reducers/ui/finished-slides.d.ts +0 -7
  159. package/lib/reducers/ui/finished-slides.js +0 -45
  160. package/lib/reducers/ui/review-status.d.ts +0 -4
  161. package/lib/reducers/ui/step-items.d.ts +0 -14
  162. package/lib/reducers/ui/step-items.js +0 -86
  163. package/lib/types/ui-progression.d.ts +0 -10
  164. package/lib/types/ui-progression.js +0 -1
  165. package/lib/types/views/skills.js +0 -1
  166. package/src/actions/data/slides.ts +0 -65
  167. package/src/actions/ui/finished-slides.ts +0 -21
  168. package/src/actions/ui/review-status.ts +0 -19
  169. package/src/actions/ui/step-items.ts +0 -45
  170. package/src/reducers/ui/finished-slides.ts +0 -52
  171. package/src/reducers/ui/review-status.ts +0 -19
  172. package/src/reducers/ui/step-items.ts +0 -116
  173. package/src/types/ui-progression.ts +0 -25
  174. package/src/types/views/skills.ts +0 -27
@@ -1,4 +1,3 @@
1
- import { QcmDrag } from '../../../types/slides';
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: QcmDrag;
3
+ export declare const qcmDragUISlide: Partial<UISlide>;
@@ -70,37 +70,43 @@ export var qcmDragSlide = {
70
70
  tips: 'sli_419IlQQnf.tips'
71
71
  };
72
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
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 { QcmGraphic } from '../../../types/slides';
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: QcmGraphic;
3
+ export declare const qcmGraphicUISlide: Partial<UISlide>;
@@ -52,19 +52,25 @@ export var qcmGraphicSlide = {
52
52
  tips: 'sli_41~RSVclH.tips'
53
53
  };
54
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
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 { Qcm } from '../../../types/slides';
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: Qcm;
3
+ export declare const qcmUISlide: Partial<UISlide>;
@@ -69,31 +69,37 @@ export var qcmSlide = {
69
69
  id: 'sli_N1XACJobn'
70
70
  };
71
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"
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 { Template } from '../../../types/slides';
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: Template;
3
+ export declare const selectTemplateUISlide: Partial<UISlide>;
@@ -49,40 +49,46 @@ export var selectTemplateSlide = {
49
49
  tips: 'sli_410xZQxrZ.tips'
50
50
  };
51
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
- },
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
- name: 'sli_410xZQxrZ.choice_E1uUWXeBb',
81
- value: 'sli_410xZQxrZ.choice_E1uUWXeBb',
82
- validOption: true,
83
- selected: false
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 { QuestionRange } from '../../../types/slides';
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: QuestionRange;
3
+ export declare const sliderUISlide: Partial<UISlide>;
@@ -17,11 +17,17 @@ export var sliderSlide = {
17
17
  tips: 'sli_41D5AovN~.tips'
18
18
  };
19
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
20
+ questionText: 'sli_41D5AovN~.header',
21
+ answerUI: {
22
+ help: 'sli_41D5AovN~.explanation',
23
+ model: {
24
+ type: 'slider',
25
+ placeholder: 'sli_41D5AovN~.explanation',
26
+ minLabel: '1 undefined',
27
+ maxLabel: '10 undefined',
28
+ title: '0 sli_41D5AovN~.unitLabel',
29
+ value: -0.1111111111111111,
30
+ onChange: noop
31
+ }
32
+ }
27
33
  };
@@ -1,4 +1,3 @@
1
- import { Template } from '../../../types/slides';
2
- import { SlideFromAPI } from '../../../types/common';
1
+ import { SlideFromAPI, UISlide } from '../../../types/common';
3
2
  export declare const textTemplateSlide: SlideFromAPI;
4
- export declare const textTemplateUISlide: Template;
3
+ export declare const textTemplateUISlide: Partial<UISlide>;
@@ -34,15 +34,21 @@ export var textTemplateSlide = {
34
34
  id: 'sli_VJKQonm2g'
35
35
  };
36
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
37
+ questionText: 'Comment le protégé doit-il percevoir son mentor ?',
38
+ answerUI: {
39
+ help: 'Saisissez votre réponse (en anglais).',
40
+ model: {
41
+ type: 'template',
42
+ template: 'Un {{inp58402}} model.',
43
+ answers: [
44
+ {
45
+ type: 'text',
46
+ name: 'inp58402',
47
+ placeholder: 'Type here',
48
+ value: undefined,
49
+ onChange: noop
50
+ }
51
+ ]
46
52
  }
47
- ]
53
+ }
48
54
  };
package/lib/index.js CHANGED
@@ -5,82 +5,22 @@ import { TemplateContext } from '@coorpacademy/components/es/template/app-review
5
5
  import isEmpty from 'lodash/fp/isEmpty';
6
6
  import get from 'lodash/fp/get';
7
7
  import configureStore from './configure-store';
8
- import { congratsProps, correctionPopinProps } from './fixtures/temp-fixture';
9
- import { updateSlidesOnNext, updateSlidesOnValidation, validateSlide } from './actions/data/slides';
8
+ import { validateSlide } from './actions/ui/slides';
10
9
  import { navigateTo, navigateBack } from './actions/ui/navigation';
11
10
  import { storeToken } from './actions/data/token';
12
- import { updateFinishedSlides } from './actions/ui/finished-slides';
13
- import { updateReviewStatus } from './actions/ui/review-status';
14
- import { updateStepItemsOnValidation, updateStepItemsOnNext } from './actions/ui/step-items';
15
11
  import { fetchSkills } from './actions/api/fetch-skills';
16
12
  import { postProgression } from './actions/api/post-progression';
17
13
  import { VIEWS } from './common';
14
+ import { mapStateToSlidesProps } from './views/slides';
15
+ import { mapStateToSkillsProps } from './views/skills';
18
16
  var mapDispatchToProps = {
19
17
  navigateTo: navigateTo,
20
18
  navigateBack: navigateBack,
21
- validateSlide: validateSlide,
22
- updateSlidesOnValidation: updateSlidesOnValidation,
23
- updateSlidesOnNext: updateSlidesOnNext,
24
- updateReviewStatus: updateReviewStatus,
25
- updateStepItemsOnValidation: updateStepItemsOnValidation,
26
- updateStepItemsOnNext: updateStepItemsOnNext,
27
- updateFinishedSlides: updateFinishedSlides
19
+ validateSlide: validateSlide
28
20
  };
29
21
  var getCurrentViewName = function (storeState) {
30
22
  return storeState.ui.navigation[storeState.ui.navigation.length - 1];
31
23
  };
32
- var mapStateToSkillsProps = function (state) {
33
- if (!state.data.skills) {
34
- return null;
35
- }
36
- return {
37
- title: '@todo title',
38
- titleNoSkills: '@todo titleNoSkills',
39
- textNoSkills: '@todo textNoSkills',
40
- iconSkillAriaLabel: '@todo iconSkillAriaLabel',
41
- isLoading: false,
42
- isLoadingAriaLabel: '@todo loading',
43
- listSkills: state.data.skills.map(function (skill) { return ({
44
- 'aria-label': '',
45
- isCustom: skill.custom,
46
- skillTitle: skill.name,
47
- skillAriaLabel: '@todo skill aria label',
48
- buttonLabel: '@todo button',
49
- buttonAriaLabel: '@todo button aria label',
50
- reviseLabel: '@todo revise',
51
- reviseAriaLabel: '@todo revise aria label',
52
- // eslint-disable-next-line no-console
53
- onClick: function () { return console.log('@todo plug dispatcher select skill'); }
54
- }); })
55
- };
56
- };
57
- var mapStateToSlidesProps = function (state) {
58
- if (!state.data.slides) {
59
- return null;
60
- }
61
- return {
62
- headerProps: {
63
- mode: '__revision_mode',
64
- skillName: '__agility',
65
- onQuitClick: function () {
66
- // eslint-disable-next-line no-console
67
- console.log('onQuitClick');
68
- },
69
- 'aria-label': 'aria-header-wrapper',
70
- closeButtonAriaLabel: 'aria-close-button'
71
- },
72
- slides: state.data.slides,
73
- validate: {
74
- label: '__validate'
75
- },
76
- finishedSlides: state.ui.finishedSlides,
77
- stepItems: state.ui.stepItems,
78
- reviewStatus: state.ui.reviewStatus,
79
- correctionPopinProps: correctionPopinProps,
80
- congratsProps: congratsProps,
81
- progression: state.data.progression
82
- };
83
- };
84
24
  var mapStateToProps = function (state) {
85
25
  return {
86
26
  viewName: getCurrentViewName(state),
@@ -92,7 +32,7 @@ var App = connect(mapStateToProps, mapDispatchToProps)(AppReviewTemplate);
92
32
  var AppReview = function (_a) {
93
33
  var options = _a.options;
94
34
  var _b = useState(null), store = _b[0], setStore = _b[1];
95
- var _c = useState(false), isSlideFetched = _c[0], setIsSlideFetched = _c[1];
35
+ var _c = useState(false), isProgressionCreated = _c[0], setIsProgressionCreated = _c[1];
96
36
  useEffect(function () {
97
37
  if (store)
98
38
  return;
@@ -100,14 +40,13 @@ var AppReview = function (_a) {
100
40
  setStore(newStore);
101
41
  }, [options, store]);
102
42
  useEffect(function () {
103
- if (!store || isSlideFetched)
43
+ if (!store || isProgressionCreated)
104
44
  return;
105
45
  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]);
46
+ var isProgressionPresent = !isEmpty(store.getState().data.progression);
47
+ return isProgressionPresent && setIsProgressionCreated(isProgressionPresent);
48
+ });
49
+ }, [isProgressionCreated, options, store]);
111
50
  useEffect(function () {
112
51
  var token = get('token', options);
113
52
  if (store === null || isEmpty(token))
@@ -119,8 +58,8 @@ var AppReview = function (_a) {
119
58
  if (store === null || isEmpty(token))
120
59
  return;
121
60
  var skillRef = get('skillRef', options);
122
- // ThunkAction is not assignable to parameter of type 'AnyAction'
123
- // ts problem describre here = https://github.com/reduxjs/redux-thunk/issues/333
61
+ /* ThunkAction is not assignable to parameter of type 'AnyAction'
62
+ ts problem is described here = https://github.com/reduxjs/redux-thunk/issues/333 */
124
63
  skillRef
125
64
  ? store.dispatch(postProgression(skillRef, token))
126
65
  : store.dispatch(fetchSkills(token));
@@ -129,16 +68,13 @@ var AppReview = function (_a) {
129
68
  if (store === null)
130
69
  return;
131
70
  var skillRef = options.skillRef;
132
- if (skillRef && !isSlideFetched) {
71
+ if (skillRef && !isProgressionCreated) {
133
72
  store.dispatch(navigateTo('loader')); // use loader while posting progression
134
73
  return;
135
74
  }
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
75
  var initialView = skillRef ? VIEWS.slides : VIEWS.skills;
140
76
  store.dispatch(navigateTo(initialView));
141
- }, [isSlideFetched, options, store]);
77
+ }, [isProgressionCreated, options, store]);
142
78
  if (!store)
143
79
  return null;
144
80
  var values = options.templateContext;
@@ -14,5 +14,5 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
14
14
  skills: SkillsState;
15
15
  slides: SlidesState;
16
16
  token: TokenState;
17
- }>, import("../../actions/data/slides").ValidateSlide | import("../../actions/data/slides").SlidesAction | import("../../actions/api/post-progression").ReceiveProgression | import("../../actions/api/fetch-skills").ReceivedSkills | import("../../actions/data/token").StoreToken>;
17
+ }>, import("../../actions/api/post-progression").ReceiveProgression | import("../../actions/api/fetch-skills").ReceivedSkills | import("./slides").SlidesAction | import("../../actions/data/token").StoreToken>;
18
18
  export default _default;
@@ -1,19 +1,6 @@
1
- import { ValidateSlide } from '../../actions/data/slides';
1
+ import { ValidateSlide } from '../../actions/ui/slides';
2
2
  import { ReceiveProgression } from '../../actions/api/post-progression';
3
- export declare type ProgressionState = {
4
- _id?: string;
5
- state: {
6
- isCorrect: boolean;
7
- nextContent: {
8
- ref: 'successExitNode' | string;
9
- type: 'success' | 'slide';
10
- };
11
- pendingSlides: string[];
12
- step: {
13
- current: number;
14
- };
15
- };
16
- slideNumber?: number;
17
- } | null;
3
+ import { ProgressionFromAPI } from '../../types/common';
4
+ export declare type ProgressionState = ProgressionFromAPI | null;
18
5
  declare const reducer: (state: ProgressionState | undefined, action: ValidateSlide | ReceiveProgression) => ProgressionState;
19
6
  export default reducer;
@@ -1,5 +1,4 @@
1
- import { getOr } from 'lodash/fp';
2
- import { VALIDATE_SLIDE } from '../../actions/data/slides';
1
+ import { VALIDATE_SLIDE } from '../../actions/ui/slides';
3
2
  import { POST_PROGRESSION_SUCCESS } from '../../actions/api/post-progression';
4
3
  var reducer = function (
5
4
  // eslint-disable-next-line default-param-last
@@ -7,25 +6,8 @@ state, action) {
7
6
  if (state === void 0) { state = null; }
8
7
  switch (action.type) {
9
8
  case VALIDATE_SLIDE: {
10
- var previousSlideNumber = getOr(-1, 'slideNumber', state);
11
- // hard coded for now
12
- // TODO: fix on VALIDATE ticket
13
- return {
14
- _id: '1234',
15
- // virtual field
16
- slideNumber: previousSlideNumber + 1,
17
- state: {
18
- pendingSlides: [],
19
- step: {
20
- current: Number.NaN
21
- },
22
- isCorrect: true,
23
- nextContent: {
24
- ref: 'sli_V1gKpYYZ2',
25
- type: 'slide'
26
- }
27
- }
28
- };
9
+ // TODO: fix on VALIDATE ticket -> launch a POST PROGRESSION
10
+ return state;
29
11
  }
30
12
  case POST_PROGRESSION_SUCCESS: {
31
13
  var progression = action.payload;
@@ -35,5 +17,4 @@ state, action) {
35
17
  return state;
36
18
  }
37
19
  };
38
- // -----------------------------------------------------------------------------
39
20
  export default reducer;
@@ -1,9 +1,8 @@
1
- import { SlidesAction } from '../../actions/data/slides';
2
- import { Slide } from '../../types/common';
3
- export declare type SlidesState = {
4
- slideNumbers: number[];
5
- [key: number]: Slide;
6
- };
1
+ import { ValidateSlide } from '../../actions/ui/slides';
2
+ import { ReceivedSlide } from '../../actions/api/fetch-slide';
3
+ import { SlideFromAPI } from '../../types/common';
4
+ export declare type SlidesAction = ReceivedSlide | ValidateSlide;
5
+ export declare type SlidesState = Record<string, SlideFromAPI>;
7
6
  export declare const initialState: SlidesState;
8
7
  declare const reducer: (state: SlidesState | undefined, action: SlidesAction) => SlidesState;
9
8
  export default reducer;