@coorpacademy/app-review 0.8.1-alpha.0 → 0.8.1-alpha.3
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/views/slides/index.js
CHANGED
|
@@ -60,6 +60,9 @@ const getCurrentSlideRef = (state) => {
|
|
|
60
60
|
const content = progression.state.content;
|
|
61
61
|
return content.ref;
|
|
62
62
|
};
|
|
63
|
+
const isLastSlideAnswered = (slidesRef, slideRef) => {
|
|
64
|
+
return last(slidesRef) === slideRef;
|
|
65
|
+
};
|
|
63
66
|
const buildStackSlides = (state, dispatch, options) => {
|
|
64
67
|
const { translate } = options;
|
|
65
68
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
@@ -70,9 +73,12 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
70
73
|
// @ts-expect-error typescript does not support capped versions of lodash functions
|
|
71
74
|
const stack = reduce.convert({ cap: false })((acc, uiSlide, _index) => {
|
|
72
75
|
const index = toInteger(_index);
|
|
73
|
-
const positions = state.ui.positions;
|
|
74
|
-
const position = positions[index];
|
|
75
76
|
const slideRef = slideRefs[index];
|
|
77
|
+
const lastAnsweredSlideRef = isLastSlideAnswered(progression.state.slides, slideRef);
|
|
78
|
+
const positions = state.ui.positions;
|
|
79
|
+
// when unstack the last answered slide (position -1), we set the position to 0 only during the animation
|
|
80
|
+
// to avoid to hide the slide (caused by the position -1).
|
|
81
|
+
const position = lastAnsweredSlideRef && positions[index] === -1 ? 0 : positions[index];
|
|
76
82
|
if (!slideRef)
|
|
77
83
|
return set(index, { ...uiSlide, position }, acc);
|
|
78
84
|
const slideFromAPI = get(slideRef, state.data.slides);
|
|
@@ -85,7 +91,7 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
85
91
|
const slideUI = get(['ui', 'slide', slideRef], state);
|
|
86
92
|
const animateCorrectionPopin = isCurrentSlideRef && slideUI.animateCorrectionPopin;
|
|
87
93
|
const showCorrectionPopin = isCurrentSlideRef && slideUI.showCorrectionPopin;
|
|
88
|
-
const animationType = slideUI.animationType;
|
|
94
|
+
const animationType = lastAnsweredSlideRef ? slideUI.animationType : undefined;
|
|
89
95
|
const updatedUiSlide = {
|
|
90
96
|
...uiSlide,
|
|
91
97
|
position,
|
|
@@ -66,6 +66,9 @@ const getCurrentSlideRef = (state) => {
|
|
|
66
66
|
const content = progression.state.content;
|
|
67
67
|
return content.ref;
|
|
68
68
|
};
|
|
69
|
+
const isLastSlideAnswered = (slidesRef, slideRef) => {
|
|
70
|
+
return (0, last_1.default)(slidesRef) === slideRef;
|
|
71
|
+
};
|
|
69
72
|
const buildStackSlides = (state, dispatch, options) => {
|
|
70
73
|
const { translate } = options;
|
|
71
74
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
@@ -76,9 +79,12 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
76
79
|
// @ts-expect-error typescript does not support capped versions of lodash functions
|
|
77
80
|
const stack = reduce_1.default.convert({ cap: false })((acc, uiSlide, _index) => {
|
|
78
81
|
const index = (0, toInteger_1.default)(_index);
|
|
79
|
-
const positions = state.ui.positions;
|
|
80
|
-
const position = positions[index];
|
|
81
82
|
const slideRef = slideRefs[index];
|
|
83
|
+
const lastAnsweredSlideRef = isLastSlideAnswered(progression.state.slides, slideRef);
|
|
84
|
+
const positions = state.ui.positions;
|
|
85
|
+
// when unstack the last answered slide (position -1), we set the position to 0 only during the animation
|
|
86
|
+
// to avoid to hide the slide (caused by the position -1).
|
|
87
|
+
const position = lastAnsweredSlideRef && positions[index] === -1 ? 0 : positions[index];
|
|
82
88
|
if (!slideRef)
|
|
83
89
|
return (0, set_1.default)(index, { ...uiSlide, position }, acc);
|
|
84
90
|
const slideFromAPI = (0, get_1.default)(slideRef, state.data.slides);
|
|
@@ -91,7 +97,7 @@ const buildStackSlides = (state, dispatch, options) => {
|
|
|
91
97
|
const slideUI = (0, get_1.default)(['ui', 'slide', slideRef], state);
|
|
92
98
|
const animateCorrectionPopin = isCurrentSlideRef && slideUI.animateCorrectionPopin;
|
|
93
99
|
const showCorrectionPopin = isCurrentSlideRef && slideUI.showCorrectionPopin;
|
|
94
|
-
const animationType = slideUI.animationType;
|
|
100
|
+
const animationType = lastAnsweredSlideRef ? slideUI.animationType : undefined;
|
|
95
101
|
const updatedUiSlide = {
|
|
96
102
|
...uiSlide,
|
|
97
103
|
position,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.8.1-alpha.
|
|
3
|
+
"version": "0.8.1-alpha.3+db8ebf908",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"main": "lib/index.js",
|
|
36
36
|
"module": "es/index.js",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@coorpacademy/components": "10.28.1-alpha.
|
|
38
|
+
"@coorpacademy/components": "10.28.1-alpha.3+db8ebf908",
|
|
39
39
|
"@coorpacademy/redux-task": "1.1.6",
|
|
40
40
|
"@coorpacademy/translate": "6.1.5",
|
|
41
41
|
"cross-fetch": "^3.1.5",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"webpack-cli": "^4.10.0",
|
|
72
72
|
"webpack-dev-server": "^4.11.1"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "db8ebf908a93696a7f98439354e1710aef50ea82"
|
|
75
75
|
}
|