@coorpacademy/app-review 0.2.8 → 0.2.9

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 (98) hide show
  1. package/es/actions/api/fetch-rank.d.ts +32 -0
  2. package/es/actions/api/fetch-rank.js +30 -0
  3. package/es/actions/api/test/fetch-correction.test.js +2 -1
  4. package/es/actions/api/test/fetch-rank.test.d.ts +1 -0
  5. package/es/actions/api/test/fetch-rank.test.js +100 -0
  6. package/es/actions/api/test/fetch-skills.test.js +2 -1
  7. package/es/actions/api/test/fetch-slide.test.js +2 -1
  8. package/es/actions/api/test/post-answer.test.js +2 -1
  9. package/es/actions/api/test/post-progression.test.js +2 -1
  10. package/es/actions/data/test/token.test.js +2 -1
  11. package/es/actions/ui/test/answers.test.js +2 -1
  12. package/es/actions/ui/test/slides.test.js +2 -1
  13. package/es/reducers/data/corrections.d.ts +1 -1
  14. package/es/reducers/data/index.d.ts +4 -1
  15. package/es/reducers/data/index.js +2 -1
  16. package/es/reducers/data/rank.d.ts +7 -0
  17. package/es/reducers/data/rank.js +36 -0
  18. package/es/reducers/data/test/rank.test.d.ts +1 -0
  19. package/es/reducers/data/test/rank.test.js +59 -0
  20. package/es/reducers/index.d.ts +4 -3
  21. package/es/reducers/ui/slide.d.ts +1 -0
  22. package/es/reducers/ui/slide.js +1 -1
  23. package/es/test/util/services.mock.d.ts +1 -0
  24. package/es/test/util/services.mock.js +16 -0
  25. package/es/views/skills/test/skills.test.js +4 -2
  26. package/es/views/slides/index.d.ts +21 -19
  27. package/es/views/slides/index.js +29 -3
  28. package/es/views/slides/test/fixtures/qcm-graphic.js +190 -28
  29. package/es/views/slides/test/index.test.js +200 -19
  30. package/es/views/slides/test/slide.free-text.on-change.test.js +4 -1
  31. package/es/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
  32. package/es/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
  33. package/es/views/slides/test/slide.qcm.on-click.test.js +4 -1
  34. package/es/views/slides/test/slide.slider.on-change.test.js +4 -1
  35. package/es/views/slides/test/slide.template.on-change.test.js +6 -1
  36. package/lib/actions/api/fetch-rank.d.ts +32 -0
  37. package/lib/actions/api/fetch-rank.js +32 -0
  38. package/lib/actions/api/test/fetch-correction.test.js +2 -1
  39. package/lib/actions/api/test/fetch-rank.test.d.ts +1 -0
  40. package/lib/actions/api/test/fetch-rank.test.js +171 -0
  41. package/lib/actions/api/test/fetch-skills.test.js +2 -1
  42. package/lib/actions/api/test/fetch-slide.test.js +2 -1
  43. package/lib/actions/api/test/post-answer.test.js +2 -1
  44. package/lib/actions/api/test/post-progression.test.js +2 -1
  45. package/lib/actions/data/test/token.test.js +2 -1
  46. package/lib/actions/ui/test/answers.test.js +2 -1
  47. package/lib/actions/ui/test/slides.test.js +2 -1
  48. package/lib/reducers/data/corrections.d.ts +1 -1
  49. package/lib/reducers/data/index.d.ts +4 -1
  50. package/lib/reducers/data/index.js +2 -1
  51. package/lib/reducers/data/rank.d.ts +7 -0
  52. package/lib/reducers/data/rank.js +37 -0
  53. package/lib/reducers/data/test/rank.test.d.ts +1 -0
  54. package/lib/reducers/data/test/rank.test.js +59 -0
  55. package/lib/reducers/index.d.ts +4 -3
  56. package/lib/reducers/ui/slide.d.ts +1 -0
  57. package/lib/reducers/ui/slide.js +1 -1
  58. package/lib/test/util/services.mock.d.ts +1 -0
  59. package/lib/test/util/services.mock.js +7 -0
  60. package/lib/views/skills/test/skills.test.js +4 -2
  61. package/lib/views/slides/index.d.ts +21 -19
  62. package/lib/views/slides/index.js +29 -3
  63. package/lib/views/slides/test/fixtures/qcm-graphic.js +190 -28
  64. package/lib/views/slides/test/index.test.js +211 -22
  65. package/lib/views/slides/test/slide.free-text.on-change.test.js +4 -1
  66. package/lib/views/slides/test/slide.qcm-drag.on-click.test.js +4 -1
  67. package/lib/views/slides/test/slide.qcm-graphic.on-click.test.js +6 -3
  68. package/lib/views/slides/test/slide.qcm.on-click.test.js +4 -1
  69. package/lib/views/slides/test/slide.slider.on-change.test.js +4 -1
  70. package/lib/views/slides/test/slide.template.on-change.test.js +6 -1
  71. package/package.json +3 -3
  72. package/src/actions/api/fetch-rank.ts +84 -0
  73. package/src/actions/api/test/fetch-correction.test.ts +2 -1
  74. package/src/actions/api/test/fetch-rank.test.ts +130 -0
  75. package/src/actions/api/test/fetch-skills.test.ts +2 -1
  76. package/src/actions/api/test/fetch-slide.test.ts +2 -1
  77. package/src/actions/api/test/post-answer.test.ts +2 -1
  78. package/src/actions/api/test/post-progression.test.ts +2 -1
  79. package/src/actions/data/test/token.test.ts +2 -1
  80. package/src/actions/ui/test/answers.test.ts +2 -1
  81. package/src/actions/ui/test/slides.test.ts +2 -1
  82. package/src/reducers/data/corrections.ts +1 -1
  83. package/src/reducers/data/index.ts +3 -1
  84. package/src/reducers/data/rank.ts +60 -0
  85. package/src/reducers/data/test/rank.test.ts +78 -0
  86. package/src/reducers/index.ts +2 -2
  87. package/src/reducers/ui/slide.ts +2 -1
  88. package/src/test/util/services.mock.ts +17 -0
  89. package/src/views/skills/test/skills.test.ts +4 -2
  90. package/src/views/slides/index.ts +65 -22
  91. package/src/views/slides/test/fixtures/qcm-graphic.ts +196 -29
  92. package/src/views/slides/test/index.test.ts +210 -21
  93. package/src/views/slides/test/slide.free-text.on-change.test.ts +4 -1
  94. package/src/views/slides/test/slide.qcm-drag.on-click.test.ts +4 -1
  95. package/src/views/slides/test/slide.qcm-graphic.on-click.test.ts +6 -4
  96. package/src/views/slides/test/slide.qcm.on-click.test.ts +4 -1
  97. package/src/views/slides/test/slide.slider.on-change.test.ts +4 -1
  98. package/src/views/slides/test/slide.template.on-change.test.ts +6 -1
@@ -1,14 +1,45 @@
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
+ };
1
12
  import test from 'ava';
2
13
  import identity from 'lodash/fp/identity';
3
14
  import omit from 'lodash/fp/omit';
4
15
  import set from 'lodash/fp/set';
5
- import { postProgressionResponse as createdProgression, postAnswerResponses, progressionSlideWithPendingSlide } from '../../../test/util/services.mock';
16
+ import { postProgressionResponse as createdProgression, postAnswerResponses, progressionSlideWithPendingSlide, getChoicesCorrection, incorrectFreeTextPostAnswerResponse } from '../../../test/util/services.mock';
6
17
  import { mapStateToSlidesProps } from '..';
7
18
  import { freeTextSlide } from './fixtures/free-text';
8
19
  import { qcmGraphicSlide } from './fixtures/qcm-graphic';
9
20
  import { templateSlide } from './fixtures/template';
10
21
  import { qcmSlide } from './fixtures/qcm';
11
22
  import { sliderSlide } from './fixtures/slider';
23
+ var popinPropsRightAnswer = {
24
+ resultLabel: '_right',
25
+ information: {
26
+ label: '_klf',
27
+ message: 'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.'
28
+ },
29
+ klf: undefined,
30
+ next: {
31
+ ariaLabel: '_correctionNextAriaLabel',
32
+ label: '_correctionNextLabel'
33
+ },
34
+ type: 'right'
35
+ };
36
+ var popinPropsWrongAnswer = __assign(__assign({}, popinPropsRightAnswer), { klf: {
37
+ label: '_klf',
38
+ tooltip: 'To negotiate your salary when being hired, you have to establish a benchmark beforehand. In other words, you should assess the salary to which you aspire by enquiring about the remuneration paid in the same industry, the same region and the same position.'
39
+ }, type: 'wrong', resultLabel: '_wrong', information: {
40
+ label: '_correctAnswer',
41
+ message: 'Benchmark'
42
+ } });
12
43
  test('should create initial props when fetched slide is not still received', function (t) {
13
44
  // SCENARIO : @@progression/POST_SUCCESS ok and @@slides/FETCH_REQUEST, (the slide is being fetched)
14
45
  var state = {
@@ -19,7 +50,8 @@ test('should create initial props when fetched slide is not still received', fun
19
50
  sli_N1XACJobn: null
20
51
  },
21
52
  token: '1234',
22
- corrections: {}
53
+ corrections: {},
54
+ rank: {}
23
55
  },
24
56
  ui: {
25
57
  currentSlideRef: '',
@@ -107,7 +139,8 @@ test('should create props when first slide is on the state', function (t) {
107
139
  sli_VJYjJnJhg: freeTextSlide
108
140
  },
109
141
  token: '1234',
110
- corrections: {}
142
+ corrections: {},
143
+ rank: {}
111
144
  },
112
145
  ui: {
113
146
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -158,6 +191,8 @@ test('should create props when first slide is on the state', function (t) {
158
191
  endReview: false
159
192
  });
160
193
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
194
+ animateCorrectionPopin: false,
195
+ showCorrectionPopin: false,
161
196
  hidden: false,
162
197
  position: 0,
163
198
  loading: false,
@@ -206,7 +241,8 @@ test('should create props when slide is on the state and user has selected answe
206
241
  sli_VJYjJnJhg: freeTextSlide
207
242
  },
208
243
  token: '1234',
209
- corrections: {}
244
+ corrections: {},
245
+ rank: {}
210
246
  },
211
247
  ui: {
212
248
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -257,6 +293,8 @@ test('should create props when slide is on the state and user has selected answe
257
293
  endReview: false
258
294
  });
259
295
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
296
+ animateCorrectionPopin: false,
297
+ showCorrectionPopin: false,
260
298
  hidden: false,
261
299
  position: 0,
262
300
  loading: false,
@@ -306,7 +344,8 @@ test('should verify props when first slide was answered correctly and next slide
306
344
  sli_VkSQroQnx: null
307
345
  },
308
346
  token: '1234',
309
- corrections: {}
347
+ corrections: {},
348
+ rank: {}
310
349
  },
311
350
  ui: {
312
351
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -357,6 +396,8 @@ test('should verify props when first slide was answered correctly and next slide
357
396
  endReview: false
358
397
  });
359
398
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
399
+ animateCorrectionPopin: false,
400
+ showCorrectionPopin: false,
360
401
  hidden: false,
361
402
  position: 0,
362
403
  loading: false,
@@ -406,7 +447,8 @@ test('should verify props when first slide was answered with error and next slid
406
447
  sli_VkSQroQnx: null
407
448
  },
408
449
  token: '1234',
409
- corrections: {}
450
+ corrections: {},
451
+ rank: {}
410
452
  },
411
453
  ui: {
412
454
  currentSlideRef: 'sli_VJYjJnJhg',
@@ -453,7 +495,8 @@ test('should verify props when first slide was answered with error and next slid
453
495
  ]
454
496
  });
455
497
  });
456
- test('should verify props when first slide was answered and next slide is fecthed', function (t) {
498
+ test('should verify props when first slide was answered, next slide is fetched & correction is fetched', function (t) {
499
+ var _a;
457
500
  // Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
458
501
  var state = {
459
502
  data: {
@@ -464,14 +507,19 @@ test('should verify props when first slide was answered and next slide is fecthe
464
507
  sli_VkSQroQnx: qcmGraphicSlide
465
508
  },
466
509
  token: '1234',
467
- corrections: {}
510
+ corrections: (_a = {},
511
+ _a[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
512
+ _a),
513
+ rank: {}
468
514
  },
469
515
  ui: {
470
516
  currentSlideRef: 'sli_VJYjJnJhg',
471
517
  navigation: ['loader', 'slides'],
472
518
  answers: ['My value'],
473
519
  slide: {
474
- validateButton: false
520
+ validateButton: false,
521
+ animateCorrectionPopin: true,
522
+ showCorrectionPopin: true
475
523
  }
476
524
  }
477
525
  };
@@ -510,11 +558,13 @@ test('should verify props when first slide was answered and next slide is fecthe
510
558
  }
511
559
  ]
512
560
  });
513
- t.deepEqual(omit(['validateButton', 'slides'], props.stack), {
514
- correctionPopinProps: undefined,
561
+ t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
562
+ correctionPopinProps: popinPropsRightAnswer,
515
563
  endReview: false
516
564
  });
517
565
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
566
+ animateCorrectionPopin: true,
567
+ showCorrectionPopin: true,
518
568
  hidden: false,
519
569
  position: 0,
520
570
  loading: false,
@@ -530,11 +580,13 @@ test('should verify props when first slide was answered and next slide is fecthe
530
580
  }
531
581
  });
532
582
  t.deepEqual(omit('answerUI', props.stack.slides['1']), {
583
+ animateCorrectionPopin: false,
584
+ showCorrectionPopin: false,
533
585
  hidden: false,
534
586
  position: 1,
535
587
  loading: false,
536
588
  parentContentTitle: 'From "Developing the review app" course',
537
- questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?'
589
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
538
590
  });
539
591
  t.is(props.stack.validateButton.disabled, true);
540
592
  t.deepEqual(omit(['0', '1'], props.stack.slides), {
@@ -555,7 +607,120 @@ test('should verify props when first slide was answered and next slide is fecthe
555
607
  }
556
608
  });
557
609
  });
558
- test('should verify props when currentSlideRef has changed to nextContent of progression after first asnwered question', function (t) {
610
+ test('should verify props when first slide was answered incorrectly, next slide is fetched & correction is fetched', function (t) {
611
+ var _a;
612
+ // Scenario: after POST_ANSWER_SUCCESS and SLIDE_FETCH_SUCCESS for the nextContent.ref slide
613
+ var state = {
614
+ data: {
615
+ progression: incorrectFreeTextPostAnswerResponse,
616
+ skills: [],
617
+ slides: {
618
+ sli_VJYjJnJhg: freeTextSlide,
619
+ sli_VkSQroQnx: qcmGraphicSlide
620
+ },
621
+ token: '1234',
622
+ corrections: (_a = {},
623
+ _a[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id, true),
624
+ _a),
625
+ rank: {}
626
+ },
627
+ ui: {
628
+ currentSlideRef: 'sli_VJYjJnJhg',
629
+ navigation: ['loader', 'slides'],
630
+ answers: ['My value'],
631
+ slide: {
632
+ validateButton: false,
633
+ animateCorrectionPopin: true,
634
+ showCorrectionPopin: true
635
+ }
636
+ }
637
+ };
638
+ var props = mapStateToSlidesProps(state, identity);
639
+ t.is(props.congratsProps, undefined);
640
+ t.deepEqual(omit(['onQuitClick'], props.header), {
641
+ 'aria-label': 'aria-header-wrapper',
642
+ closeButtonAriaLabel: 'aria-close-button',
643
+ mode: '__revision_mode',
644
+ skillName: '__agility',
645
+ steps: [
646
+ {
647
+ current: true,
648
+ icon: 'wrong',
649
+ value: '1'
650
+ },
651
+ {
652
+ current: false,
653
+ icon: 'no-answer',
654
+ value: '2'
655
+ },
656
+ {
657
+ current: false,
658
+ icon: 'no-answer',
659
+ value: '3'
660
+ },
661
+ {
662
+ current: false,
663
+ icon: 'no-answer',
664
+ value: '4'
665
+ },
666
+ {
667
+ current: false,
668
+ icon: 'no-answer',
669
+ value: '5'
670
+ }
671
+ ]
672
+ });
673
+ t.deepEqual(omit(['validateButton', 'slides', 'correctionPopinProps.klf.onClick'], props.stack), {
674
+ correctionPopinProps: popinPropsWrongAnswer,
675
+ endReview: false
676
+ });
677
+ t.deepEqual(omit('answerUI', props.stack.slides['0']), {
678
+ animateCorrectionPopin: true,
679
+ showCorrectionPopin: true,
680
+ hidden: false,
681
+ position: 0,
682
+ loading: false,
683
+ parentContentTitle: 'From "Developing the review app" course',
684
+ questionText: 'Which term is used to describe the act of asking what the usual salary is for the position you are applying for?'
685
+ });
686
+ t.deepEqual(omit('model.onChange', props.stack.slides['0'].answerUI), {
687
+ help: 'Type your answer.',
688
+ model: {
689
+ placeholder: 'Type here',
690
+ type: 'freeText',
691
+ value: 'My value'
692
+ }
693
+ });
694
+ t.deepEqual(omit('answerUI', props.stack.slides['1']), {
695
+ animateCorrectionPopin: false,
696
+ showCorrectionPopin: false,
697
+ hidden: false,
698
+ position: 1,
699
+ loading: false,
700
+ parentContentTitle: 'From "Developing the review app" course',
701
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
702
+ });
703
+ t.is(props.stack.validateButton.disabled, true);
704
+ t.deepEqual(omit(['0', '1'], props.stack.slides), {
705
+ '2': {
706
+ hidden: false,
707
+ position: 2,
708
+ loading: true
709
+ },
710
+ '3': {
711
+ hidden: false,
712
+ position: 3,
713
+ loading: true
714
+ },
715
+ '4': {
716
+ hidden: false,
717
+ position: 4,
718
+ loading: true
719
+ }
720
+ });
721
+ });
722
+ test('should verify props when currentSlideRef has changed to nextContent of progression after first answered question', function (t) {
723
+ var _a;
559
724
  // state after click on NEXT_SLIDE
560
725
  var state = {
561
726
  data: {
@@ -566,7 +731,10 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
566
731
  sli_VkSQroQnx: qcmGraphicSlide
567
732
  },
568
733
  token: '1234',
569
- corrections: {}
734
+ corrections: (_a = {},
735
+ _a[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
736
+ _a),
737
+ rank: {}
570
738
  },
571
739
  ui: {
572
740
  currentSlideRef: 'sli_VkSQroQnx',
@@ -615,7 +783,7 @@ test('should verify props when currentSlideRef has changed to nextContent of pro
615
783
  // TODO update test with props.stack validations when NEXT_SLIDE implemented
616
784
  });
617
785
  test('should verify props when progression is in success', function (t) {
618
- var _a;
786
+ var _a, _b;
619
787
  // state after receive last POST_ANSWER_SUCCESS and before last NEXT_SLIDE
620
788
  var state = {
621
789
  data: {
@@ -629,7 +797,14 @@ test('should verify props when progression is in success', function (t) {
629
797
  _a[templateSlide.universalRef] = templateSlide,
630
798
  _a),
631
799
  token: '1234',
632
- corrections: {}
800
+ corrections: (_b = {},
801
+ _b[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
802
+ _b[qcmGraphicSlide.universalRef] = getChoicesCorrection(qcmGraphicSlide._id),
803
+ _b[qcmSlide.universalRef] = getChoicesCorrection(qcmSlide._id),
804
+ _b[sliderSlide.universalRef] = getChoicesCorrection(sliderSlide._id),
805
+ _b[templateSlide.universalRef] = getChoicesCorrection(templateSlide._id),
806
+ _b),
807
+ rank: {}
633
808
  },
634
809
  ui: {
635
810
  currentSlideRef: templateSlide.universalRef,
@@ -677,8 +852,8 @@ test('should verify props when progression is in success', function (t) {
677
852
  });
678
853
  // TODO update test with props.stack validations when NEXT_SLIDE implemented
679
854
  });
680
- test('should verify props when progression has answered a current pendingslide', function (t) {
681
- var _a;
855
+ test('should verify props when progression has answered a current pendingSlide', function (t) {
856
+ var _a, _b;
682
857
  // Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains but not yet the currentSlideRef
683
858
  var state = {
684
859
  data: {
@@ -692,7 +867,14 @@ test('should verify props when progression has answered a current pendingslide',
692
867
  _a[templateSlide.universalRef] = templateSlide,
693
868
  _a),
694
869
  token: '1234',
695
- corrections: {}
870
+ corrections: (_b = {},
871
+ _b[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
872
+ _b[qcmGraphicSlide.universalRef] = getChoicesCorrection(qcmGraphicSlide._id),
873
+ _b[qcmSlide.universalRef] = getChoicesCorrection(qcmSlide._id, true),
874
+ _b[sliderSlide.universalRef] = getChoicesCorrection(sliderSlide._id),
875
+ _b[templateSlide.universalRef] = getChoicesCorrection(templateSlide._id),
876
+ _b),
877
+ rank: {}
696
878
  },
697
879
  ui: {
698
880
  currentSlideRef: freeTextSlide.universalRef,
@@ -738,8 +920,8 @@ test('should verify props when progression has answered a current pendingslide',
738
920
  ]
739
921
  });
740
922
  });
741
- test('should verify props when progression has still pendingslide', function (t) {
742
- var _a;
923
+ test('should verify props when progression still has a pendingSlide', function (t) {
924
+ var _a, _b;
743
925
  // Scenario, freeTextSlide and qcmSlide are pending slides, freeTextSlide was answered correctly, qcmSlide remains and it is the currentSlideRef
744
926
  var state = {
745
927
  data: {
@@ -753,7 +935,14 @@ test('should verify props when progression has still pendingslide', function (t)
753
935
  _a[templateSlide.universalRef] = templateSlide,
754
936
  _a),
755
937
  token: '1234',
756
- corrections: {}
938
+ corrections: (_b = {},
939
+ _b[freeTextSlide._id] = getChoicesCorrection(freeTextSlide._id),
940
+ _b[qcmGraphicSlide.universalRef] = getChoicesCorrection(qcmGraphicSlide._id),
941
+ _b[qcmSlide.universalRef] = getChoicesCorrection(qcmSlide._id, true),
942
+ _b[sliderSlide.universalRef] = getChoicesCorrection(sliderSlide._id),
943
+ _b[templateSlide.universalRef] = getChoicesCorrection(templateSlide._id),
944
+ _b),
945
+ rank: {}
757
946
  },
758
947
  ui: {
759
948
  currentSlideRef: qcmSlide.universalRef,
@@ -36,7 +36,8 @@ var initialState = {
36
36
  _a),
37
37
  skills: [],
38
38
  token: '1234',
39
- corrections: {}
39
+ corrections: {},
40
+ rank: {}
40
41
  },
41
42
  ui: {
42
43
  currentSlideRef: freeTextSlide._id,
@@ -59,6 +60,8 @@ test('should dispatch EDIT_BASIC action via the property onChange of a Free Text
59
60
  var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
60
61
  var props = mapStateToSlidesProps(getState(), dispatch);
61
62
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
63
+ animateCorrectionPopin: false,
64
+ showCorrectionPopin: false,
62
65
  hidden: false,
63
66
  position: 0,
64
67
  loading: false,
@@ -36,7 +36,8 @@ var initialState = {
36
36
  _a),
37
37
  skills: [],
38
38
  token: '1234',
39
- corrections: {}
39
+ corrections: {},
40
+ rank: {}
40
41
  },
41
42
  ui: {
42
43
  currentSlideRef: qcmDragSlide._id,
@@ -59,6 +60,8 @@ test('should dispatch EDIT_QCM_DRAG action via the property onClick of a QCM Dra
59
60
  var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
60
61
  var props = mapStateToSlidesProps(getState(), dispatch);
61
62
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
63
+ animateCorrectionPopin: false,
64
+ showCorrectionPopin: false,
62
65
  hidden: false,
63
66
  position: 0,
64
67
  loading: false,
@@ -36,7 +36,8 @@ var initialState = {
36
36
  _a),
37
37
  skills: [],
38
38
  token: '1234',
39
- corrections: {}
39
+ corrections: {},
40
+ rank: {}
40
41
  },
41
42
  ui: {
42
43
  currentSlideRef: qcmGraphicSlide._id,
@@ -53,17 +54,19 @@ test('should dispatch EDIT_QCM_GRAPHIC action via the property onClick of a QCM
53
54
  var expectedActions = [
54
55
  {
55
56
  type: EDIT_QCM_GRAPHIC,
56
- payload: ['Faux']
57
+ payload: ['Le retour d’information']
57
58
  }
58
59
  ];
59
60
  var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
60
61
  var props = mapStateToSlidesProps(getState(), dispatch);
61
62
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
63
+ animateCorrectionPopin: false,
64
+ showCorrectionPopin: false,
62
65
  hidden: false,
63
66
  position: 0,
64
67
  loading: false,
65
68
  parentContentTitle: 'From "Developing the review app" course',
66
- questionText: 'Pour mener une bonne négociation, il ne faut ressentir aucune émotion. Vrai ou faux ?'
69
+ questionText: 'Quels sont les 4 piliers de l’apprentissage ?'
67
70
  });
68
71
  var SlideProps = (_a = props.stack.slides['0'].answerUI) === null || _a === void 0 ? void 0 : _a.model;
69
72
  var onClick = get(['1', 'onClick'], SlideProps.answers);
@@ -36,7 +36,8 @@ var initialState = {
36
36
  _a),
37
37
  skills: [],
38
38
  token: '1234',
39
- corrections: {}
39
+ corrections: {},
40
+ rank: {}
40
41
  },
41
42
  ui: {
42
43
  currentSlideRef: qcmSlide._id,
@@ -61,6 +62,8 @@ test('should dispatch EDIT_QCM action via the property onClick of a QCM slide',
61
62
  var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
62
63
  var props = mapStateToSlidesProps(getState(), dispatch);
63
64
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
65
+ animateCorrectionPopin: false,
66
+ showCorrectionPopin: false,
64
67
  hidden: false,
65
68
  position: 0,
66
69
  loading: false,
@@ -36,7 +36,8 @@ var initialState = {
36
36
  _a),
37
37
  skills: [],
38
38
  token: '1234',
39
- corrections: {}
39
+ corrections: {},
40
+ rank: {}
40
41
  },
41
42
  ui: {
42
43
  currentSlideRef: sliderSlide._id,
@@ -59,6 +60,8 @@ test('should dispatch EDIT_SLIDER action via the property onChange of a Slider s
59
60
  var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
60
61
  var props = mapStateToSlidesProps(getState(), dispatch);
61
62
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
63
+ animateCorrectionPopin: false,
64
+ showCorrectionPopin: false,
62
65
  hidden: false,
63
66
  position: 0,
64
67
  loading: false,
@@ -36,7 +36,8 @@ var initialState = {
36
36
  _a),
37
37
  skills: [],
38
38
  token: '1234',
39
- corrections: {}
39
+ corrections: {},
40
+ rank: {}
40
41
  },
41
42
  ui: {
42
43
  currentSlideRef: templateSlide._id,
@@ -54,6 +55,8 @@ test('should dispatch EDIT_TEMPLATE action via the property onChange of a Templa
54
55
  var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
55
56
  var props = mapStateToSlidesProps(getState(), dispatch);
56
57
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
58
+ animateCorrectionPopin: false,
59
+ showCorrectionPopin: false,
57
60
  hidden: false,
58
61
  position: 0,
59
62
  loading: false,
@@ -71,6 +74,8 @@ test('should dispatch EDIT_TEMPLATE action via the property onChange of a Templa
71
74
  var _b = createTestStore(t, initialState, services, expectedActions), dispatch = _b.dispatch, getState = _b.getState;
72
75
  var props = mapStateToSlidesProps(getState(), dispatch);
73
76
  t.deepEqual(omit('answerUI', props.stack.slides['0']), {
77
+ animateCorrectionPopin: false,
78
+ showCorrectionPopin: false,
74
79
  hidden: false,
75
80
  position: 0,
76
81
  loading: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=16.15.0"
@@ -41,7 +41,7 @@
41
41
  "./package.json": "./package.json"
42
42
  },
43
43
  "dependencies": {
44
- "@coorpacademy/components": "10.22.23",
44
+ "@coorpacademy/components": "10.22.24",
45
45
  "@coorpacademy/redux-task": "^1.1.5",
46
46
  "cross-fetch": "^3.1.5",
47
47
  "jwt-decode": "^3.1.2",
@@ -78,5 +78,5 @@
78
78
  "ts-node": "^10.9.1",
79
79
  "typescript": "^4.7.4"
80
80
  },
81
- "gitHead": "31b40916b16bd71f9e2717ef10fdb00f4404f5c4"
81
+ "gitHead": "3b2b9c0d9d47e93f89c09351c1f79a20c07cefc3"
82
82
  }
@@ -0,0 +1,84 @@
1
+ import buildTask from '@coorpacademy/redux-task';
2
+ import get from 'lodash/fp/get';
3
+ import type {Dispatch} from 'redux';
4
+ import type {StoreState} from '../../reducers';
5
+ import type {Rank, Services, Options} from '../../types/common';
6
+
7
+ export const RANK_FETCH_START_REQUEST = '@@rank/FETCH_START_REQUEST' as const;
8
+ export const RANK_FETCH_START_SUCCESS = '@@rank/FETCH_START_SUCCESS' as const;
9
+ export const RANK_FETCH_START_FAILURE = '@@rank/FETCH_START_FAILURE' as const;
10
+
11
+ export const RANK_FETCH_END_REQUEST = '@@rank/FETCH_END_REQUEST' as const;
12
+ export const RANK_FETCH_END_SUCCESS = '@@rank/FETCH_END_SUCCESS' as const;
13
+ export const RANK_FETCH_END_FAILURE = '@@rank/FETCH_END_FAILURE' as const;
14
+
15
+ type RankFetchStartRequestType = typeof RANK_FETCH_START_REQUEST;
16
+ type RankFetchStartSuccessType = typeof RANK_FETCH_START_SUCCESS;
17
+ type RankFetchStartFailureType = typeof RANK_FETCH_START_FAILURE;
18
+ type RankFetchEndRequestType = typeof RANK_FETCH_END_REQUEST;
19
+ type RankFetchEndSuccessType = typeof RANK_FETCH_END_SUCCESS;
20
+ type RankFetchEndFailureType = typeof RANK_FETCH_END_FAILURE;
21
+
22
+ export type RankRequestAction = {
23
+ type: RankFetchStartRequestType | RankFetchEndRequestType;
24
+ };
25
+
26
+ export type RankSuccessAction = {
27
+ type: RankFetchStartSuccessType | RankFetchEndSuccessType;
28
+ payload: Rank;
29
+ };
30
+
31
+ export type RankFailureAction = {
32
+ type: RankFetchStartFailureType | RankFetchEndFailureType;
33
+ };
34
+
35
+ export type RankAction = RankRequestAction | RankSuccessAction | RankFailureAction;
36
+
37
+ type RankStart = [RankFetchStartRequestType, RankFetchStartSuccessType, RankFetchStartFailureType];
38
+ type RankEnd = [RankFetchEndRequestType, RankFetchEndSuccessType, RankFetchEndFailureType];
39
+
40
+ export const fetchRank = (
41
+ dispatch: Dispatch,
42
+ getState: () => StoreState,
43
+ services: Services,
44
+ types: RankStart | RankEnd,
45
+ path?: string
46
+ ): RankAction => {
47
+ const action = buildTask({
48
+ types,
49
+ task: () => {
50
+ const state = getState();
51
+ const token = get(['data', 'token'], state);
52
+ return services.fetchRank(token);
53
+ },
54
+ bailout: path ? (state: StoreState): boolean => !!get(path, state) : undefined
55
+ });
56
+
57
+ return dispatch(action);
58
+ };
59
+
60
+ export const fetchStartRank = (
61
+ dispatch: Dispatch,
62
+ getState: () => StoreState,
63
+ {services}: Options
64
+ ): RankAction => {
65
+ return fetchRank(
66
+ dispatch,
67
+ getState,
68
+ services,
69
+ [RANK_FETCH_START_REQUEST, RANK_FETCH_START_SUCCESS, RANK_FETCH_START_FAILURE],
70
+ 'data.rank.start'
71
+ );
72
+ };
73
+
74
+ export const fetchEndRank = (
75
+ dispatch: Dispatch,
76
+ getState: () => StoreState,
77
+ {services}: Options
78
+ ): RankAction => {
79
+ return fetchRank(dispatch, getState, services, [
80
+ RANK_FETCH_END_REQUEST,
81
+ RANK_FETCH_END_SUCCESS,
82
+ RANK_FETCH_END_FAILURE
83
+ ]);
84
+ };
@@ -29,7 +29,8 @@ const initialState: StoreState = {
29
29
  },
30
30
  skills: [{skillRef, custom: false, name: skillRef, slidesToReview: 5}],
31
31
  token: '1234',
32
- corrections: {}
32
+ corrections: {},
33
+ rank: {}
33
34
  },
34
35
  ui: {
35
36
  currentSlideRef: freeTextSlide._id,