@gamelearn/arcade-components 1.4.21 → 1.4.23

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.
@@ -125,11 +125,19 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
125
125
  setFeedbackResult(true);
126
126
  setFeedbackIsShown(true);
127
127
  } else {
128
+ var _info$solution, _specificFeedbacks$co;
129
+
128
130
  setFeedbackResult(true);
129
131
  setFeedbackIsShown(true);
130
132
  setFinished(true);
131
- var rewards = info.solution.right.rewards;
132
- var rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(rewards));
133
+
134
+ var _info$solution$right = info === null || info === void 0 ? void 0 : (_info$solution = info.solution) === null || _info$solution === void 0 ? void 0 : _info$solution.right,
135
+ rewards = _info$solution$right.rewards;
136
+
137
+ var specificRewards = (specificFeedbacks === null || specificFeedbacks === void 0 ? void 0 : (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) === null || _specificFeedbacks$co === void 0 ? void 0 : _specificFeedbacks$co.map(function (spReward) {
138
+ return spReward.rewards;
139
+ }).flat()) || [];
140
+ var rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(rewards), _toConsumableArray(specificRewards));
133
141
  setTimeout(function () {
134
142
  playSound('score');
135
143
  closeFeedbackAndShowPoints(rewardsData);
@@ -178,7 +186,6 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
178
186
 
179
187
  setRightPick(true);
180
188
  setFeedbackIsShown(true);
181
- setRewards([].concat(_toConsumableArray(accRewards), [pickedCard === null || pickedCard === void 0 ? void 0 : pickedCard.rewards]));
182
189
  emitEvent({
183
190
  type: 'hidePuzzleButtons',
184
191
  payload: true
@@ -188,16 +195,17 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
188
195
 
189
196
  var handleError = function handleError(cardId) {
190
197
  // si hay feedback específico
198
+ setRightPick(false);
199
+
191
200
  if (specificFeedbacks !== null && specificFeedbacks !== void 0 && specificFeedbacks.specificWrongFeedbacks) {
192
201
  var failedCard = specificFeedbacks.wrongFeedbacks.find(function (redCard) {
193
202
  return redCard.id === cardId;
194
203
  });
195
- setRightPick(false);
196
204
 
197
205
  if (failedCard !== null && failedCard !== void 0 && failedCard.desc) {
198
206
  setFeedBackText(failedCard.desc);
199
207
  setFeedbackIsShown(true);
200
- setRewards([].concat(_toConsumableArray(accRewards), [failedCard === null || failedCard === void 0 ? void 0 : failedCard.rewards]));
208
+ setRewards([].concat(_toConsumableArray(accRewards), _toConsumableArray(failedCard === null || failedCard === void 0 ? void 0 : failedCard.rewards)));
201
209
  } else {
202
210
  setFeedbackIsShown(true);
203
211
  setTimeout(function () {
@@ -244,12 +252,14 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
244
252
  }, [disableExit, finished]);
245
253
  (0, _react.useEffect)(function () {
246
254
  setResolveAction(function () {
255
+ var _info$resolve;
256
+
247
257
  emitEvent({
248
258
  type: 'hidePuzzleButtons',
249
259
  payload: true
250
260
  });
251
261
  setResolvePuzzle(true);
252
- var rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(info.resolve.rewards));
262
+ var rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(info === null || info === void 0 ? void 0 : (_info$resolve = info.resolve) === null || _info$resolve === void 0 ? void 0 : _info$resolve.rewards));
253
263
  setTimeout(function () {
254
264
  closeFeedbackAndShowPoints(rewardsData);
255
265
  }, 2000);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "author": "Gamelearn",
4
4
  "license": "unlicense",
5
- "version": "1.4.21",
5
+ "version": "1.4.23",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",