@gamelearn/arcade-components 1.4.32 → 1.4.33

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.
@@ -137,7 +137,7 @@ var Board = function Board(_ref) {
137
137
  var tempWrong = Array.from(wrongOrder);
138
138
  tempWrong[index] = index;
139
139
  setWrongOrder(tempWrong);
140
- handleError(((_cards$index = cards[index]) === null || _cards$index === void 0 ? void 0 : _cards$index.id) || null);
140
+ handleError(((_cards$index = cards[index]) === null || _cards$index === void 0 ? void 0 : _cards$index.id) || null, cards[index].correct);
141
141
  timedReset();
142
142
  }
143
143
 
@@ -179,10 +179,17 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
179
179
  };
180
180
 
181
181
  var handleError = function handleError(cardId) {
182
+ var incorrectOrder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
182
183
  // si hay feedback específico
183
184
  setRightPick(false);
184
185
 
185
- if (specificFeedbacks !== null && specificFeedbacks !== void 0 && specificFeedbacks.specificWrongFeedbacks) {
186
+ if (incorrectOrder) {
187
+ var _info$orderFeedback, _info$orderFeedback2;
188
+
189
+ setFeedBackText((_info$orderFeedback = info.orderFeedback) === null || _info$orderFeedback === void 0 ? void 0 : _info$orderFeedback.desc);
190
+ setFeedbackIsShown(true);
191
+ setRewards([].concat(_toConsumableArray(accRewards), _toConsumableArray(((_info$orderFeedback2 = info.orderFeedback) === null || _info$orderFeedback2 === void 0 ? void 0 : _info$orderFeedback2.rewards) || [])));
192
+ } else if (specificFeedbacks !== null && specificFeedbacks !== void 0 && specificFeedbacks.specificWrongFeedbacks) {
186
193
  var failedCard = specificFeedbacks.wrongFeedbacks.find(function (redCard) {
187
194
  return redCard.id === cardId;
188
195
  });
@@ -220,7 +227,7 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
220
227
 
221
228
  disableExit(true);
222
229
 
223
- if (!(specificFeedbacks !== null && specificFeedbacks !== void 0 && specificFeedbacks.specificWrongFeedbacks)) {
230
+ if (!(specificFeedbacks !== null && specificFeedbacks !== void 0 && specificFeedbacks.specificWrongFeedbacks) && !incorrectOrder) {
224
231
  setRewards([].concat(_toConsumableArray(accRewards), _toConsumableArray(info.solution.wrong.rewards)));
225
232
  }
226
233
 
@@ -264,19 +264,21 @@ var DragItemPuzzleComponent = function DragItemPuzzleComponent(_ref) {
264
264
  currentImage.src = imageUrl;
265
265
 
266
266
  currentImage.onload = function () {
267
- layerConfig.current = {
268
- x: canvas.current.clientWidth / 2,
269
- y: canvas.current.clientHeight / 2,
270
- width: currentImage.width,
271
- height: currentImage.height,
272
- offsetX: currentImage.width / 2,
273
- offsetY: currentImage.height / 2,
274
- scale: {
275
- x: Math.min(canvas.current.clientWidth / currentImage.width, canvas.current.clientHeight / currentImage.height),
276
- y: Math.min(canvas.current.clientWidth / currentImage.width, canvas.current.clientHeight / currentImage.height)
277
- }
278
- };
279
- setImageLoaded(true);
267
+ if (canvas.current) {
268
+ layerConfig.current = {
269
+ x: canvas.current.clientWidth / 2,
270
+ y: canvas.current.clientHeight / 2,
271
+ width: currentImage.width,
272
+ height: currentImage.height,
273
+ offsetX: currentImage.width / 2,
274
+ offsetY: currentImage.height / 2,
275
+ scale: {
276
+ x: Math.min(canvas.current.clientWidth / currentImage.width, canvas.current.clientHeight / currentImage.height),
277
+ y: Math.min(canvas.current.clientWidth / currentImage.width, canvas.current.clientHeight / currentImage.height)
278
+ }
279
+ };
280
+ setImageLoaded(true);
281
+ }
280
282
  };
281
283
 
282
284
  setShowTooltip(true);
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.32",
5
+ "version": "1.4.33",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",