@gamelearn/arcade-components 1.26.1-hotfix-3-hanged → 1.26.2

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.
@@ -392,13 +392,13 @@ var DialogComponent = function DialogComponent(_ref) {
392
392
  target.applyQuaternion(camera.quaternion);
393
393
  var distance = camera.position.distanceTo(target.position);
394
394
  var staticDisplay = distance > 70 && !zoomInActor && !showArrowTop;
395
- target.translateY(staticDisplay || showArrowTop ? -1 : 0); // Detectar posicion de personaje a izq o derecha de pantalla
395
+ target.translateY(staticDisplay || showArrowTop ? 0 : 2); // Detectar posicion de personaje a izq o derecha de pantalla
396
396
 
397
397
  var vector = new _three.Vector3();
398
398
  vector.setFromMatrixPosition(head.matrixWorld);
399
399
  var p = vector.project(defaultCamera);
400
+ target.translateX(headSize);
400
401
  var isLeft = p.x < 0;
401
- target.translateX(-1);
402
402
  messagePosition.current = {
403
403
  pos: target.position.toArray(),
404
404
  child: head,
@@ -570,7 +570,7 @@ var DialogComponent = function DialogComponent(_ref) {
570
570
  }, [currentMessage, nextLine, start, stop, currentLine === null || currentLine === void 0 ? void 0 : currentLine.audioType, autoPlayCond, audio, voice, audioFailed]); // Positioning Bubble Message logic
571
571
 
572
572
  var checkBubbleBounds = (0, _react.useCallback)(function (group, bubble) {
573
- if (currentLine !== null && currentLine !== void 0 && currentLine.slots && currentMessage.show && bubble !== null && bubble !== void 0 && bubble.current) {
573
+ if (currentLine !== null && currentLine !== void 0 && currentLine.slots && currentMessage.show) {
574
574
  var talkingCharacter = currentLine === null || currentLine === void 0 ? void 0 : currentLine.slots.find(function (slot) {
575
575
  return slot.talking;
576
576
  });
@@ -633,7 +633,7 @@ var DialogComponent = function DialogComponent(_ref) {
633
633
 
634
634
  messagePosition.current.pos[0] -= headSpace;
635
635
  animationTarget.current.translateX(-10 + headSpace);
636
- animationTarget.current.translateY(0);
636
+ animationTarget.current.translateY(-5);
637
637
  animationTarget.current.translateZ(30);
638
638
  }
639
639
 
@@ -52,8 +52,7 @@ var AnswerPanel = function AnswerPanel(_ref) {
52
52
  var answer = _ref.answer,
53
53
  flickerPosition = _ref.flickerPosition,
54
54
  _ref$show = _ref.show,
55
- show = _ref$show === void 0 ? false : _ref$show,
56
- showCorrectSolution = _ref.showCorrectSolution;
55
+ show = _ref$show === void 0 ? false : _ref$show;
57
56
  var words = [];
58
57
  var wordIndex = 0;
59
58
  answer.forEach(function (a) {
@@ -67,9 +66,7 @@ var AnswerPanel = function AnswerPanel(_ref) {
67
66
  wordIndex += 1;
68
67
  }
69
68
 
70
- if (!showCorrectSolution) {
71
- a.positionInitial = a.index;
72
- }
69
+ a.positionInitial = a.index;
73
70
  });
74
71
  return words.map(function (word, index) {
75
72
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -506,12 +503,10 @@ var HangedPuzzleComponent = function HangedPuzzleComponent(_ref4) {
506
503
  dir: "auto",
507
504
  className: "puzzle--hanged__solution ".concat(resolvedClass),
508
505
  "data-testid": "".concat(resolvedClass)
509
- }, showCorrectSolution ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(AnswerPanel, {
510
- showCorrectSolution: showCorrectSolution,
506
+ }, showCorrectSolution ? /*#__PURE__*/_react.default.createElement(AnswerPanel, {
511
507
  answer: answer.split(''),
512
508
  show: true
513
- })) : /*#__PURE__*/_react.default.createElement(AnswerPanel, {
514
- showCorrectSolution: showCorrectSolution,
509
+ }) : /*#__PURE__*/_react.default.createElement(AnswerPanel, {
515
510
  flickerPosition: flickerPosition,
516
511
  answer: resolvedAnswer
517
512
  })), /*#__PURE__*/_react.default.createElement("div", {
@@ -110,6 +110,17 @@ var TextClickPuzzleComponent = function TextClickPuzzleComponent(_ref) {
110
110
  var isCompleted = (0, _react.useCallback)(function () {
111
111
  return correctTextFragmentsPartial.current === list[currentSlide].correctTexts.length || list[currentSlide].hasClickOnce && correctTextFragmentsPartial.current >= 1;
112
112
  }, [currentSlide, list]);
113
+ var modifyFeedbackData = (0, _react.useCallback)(function (show, data) {
114
+ if (show) emitEvent({
115
+ type: 'hidePuzzleButtons',
116
+ payload: true
117
+ });
118
+ setFeedbackData(function (prevState) {
119
+ return _objectSpread(_objectSpread({}, prevState), {}, {
120
+ show: show
121
+ }, data);
122
+ });
123
+ }, [emitEvent]);
113
124
  var goForward = (0, _react.useCallback)(function () {
114
125
  if (isCompleted()) {
115
126
  setFeedbackData(function (prevState) {
@@ -177,23 +188,16 @@ var TextClickPuzzleComponent = function TextClickPuzzleComponent(_ref) {
177
188
  });
178
189
  setCorrectTextFragmentsAccumulated(correctTextFragmentsAccumulated + 1);
179
190
  correctTextFragmentsPartial.current += 1;
180
- emitEvent({
181
- type: 'hidePuzzleButtons',
182
- payload: true
183
- });
184
191
  playSound('score'); // si tiene feedback general definido
185
192
 
186
193
  if ((_list$currentSlide$in = list[currentSlide].info.solution.right) !== null && _list$currentSlide$in !== void 0 && _list$currentSlide$in.desc) {
187
194
  // solo muestra la caja verde y suma puntos cuando resuelves todos los fragmentos correctos
188
195
  if (isCompleted()) {
189
196
  accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(list[currentSlide].info.solution.right.rewards));
190
- setFeedbackData(function (prevState) {
191
- return _objectSpread(_objectSpread({}, prevState), {}, {
192
- show: true,
193
- result: true,
194
- text: list[currentSlide].info.solution.right.desc,
195
- timeout: false
196
- });
197
+ modifyFeedbackData(true, {
198
+ result: true,
199
+ text: list[currentSlide].info.solution.right.desc,
200
+ timeout: false
197
201
  });
198
202
  }
199
203
  } // si no tiene feedback general y tiene specificFeedbacks definido
@@ -201,13 +205,10 @@ var TextClickPuzzleComponent = function TextClickPuzzleComponent(_ref) {
201
205
  var _specificFeedback$rew;
202
206
 
203
207
  accRewards.current = specificFeedback !== null && specificFeedback !== void 0 && (_specificFeedback$rew = specificFeedback.rewards) !== null && _specificFeedback$rew !== void 0 && _specificFeedback$rew.length ? [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(specificFeedback === null || specificFeedback === void 0 ? void 0 : specificFeedback.rewards)) : _toConsumableArray(accRewards.current);
204
- setFeedbackData(function (prevState) {
205
- return _objectSpread(_objectSpread({}, prevState), {}, {
206
- show: true,
207
- result: true,
208
- text: specificFeedback.desc,
209
- timeout: false
210
- });
208
+ modifyFeedbackData(true, {
209
+ result: true,
210
+ text: specificFeedback.desc,
211
+ timeout: false
211
212
  });
212
213
  } // si no tiene feedback general ni specificFeedbacks,
213
214
  // solo muestra la caja verde y suma puntos cuando resuelves todos los fragmentos correctos
@@ -216,34 +217,24 @@ var TextClickPuzzleComponent = function TextClickPuzzleComponent(_ref) {
216
217
  accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(specificFeedback === null || specificFeedback === void 0 ? void 0 : specificFeedback.rewards));
217
218
 
218
219
  if (isCompleted()) {
219
- setFeedbackData(function (prevState) {
220
- return _objectSpread(_objectSpread({}, prevState), {}, {
221
- show: true,
222
- result: true,
223
- timeout: true
224
- });
220
+ modifyFeedbackData(true, {
221
+ result: true,
222
+ timeout: true
225
223
  });
226
224
  }
227
225
  } // si tiene puntos generales
228
226
  else if (isCompleted()) {
229
227
  accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(list[currentSlide].info.solution.right.rewards));
230
- setFeedbackData(function (prevState) {
231
- return _objectSpread(_objectSpread({}, prevState), {}, {
232
- show: true,
233
- result: true,
234
- timeout: true
235
- });
228
+ modifyFeedbackData(true, {
229
+ result: true,
230
+ timeout: true
236
231
  });
237
232
  }
238
- }, [correctTextFragmentsAccumulated, emitEvent, playSound, list, currentSlide, isCompleted]);
233
+ }, [correctTextFragmentsAccumulated, playSound, list, currentSlide, isCompleted, modifyFeedbackData]);
239
234
  var handleIncorrectClick = (0, _react.useCallback)(function (allDataTextIds, specificFeedback) {
240
235
  allDataTextIds.forEach(function (el) {
241
236
  return el.classList.add('text-click__failed');
242
237
  });
243
- emitEvent({
244
- type: 'hidePuzzleButtons',
245
- payload: true
246
- });
247
238
  playSound('fail');
248
239
  emitEvent({
249
240
  type: 'failPuzzle'
@@ -251,50 +242,38 @@ var TextClickPuzzleComponent = function TextClickPuzzleComponent(_ref) {
251
242
 
252
243
  if (list[currentSlide].info.solution.wrong.desc !== '') {
253
244
  accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(list[currentSlide].info.solution.wrong.rewards));
254
- setFeedbackData(function (prevState) {
255
- return _objectSpread(_objectSpread({}, prevState), {}, {
256
- show: true,
257
- result: false,
258
- text: list[currentSlide].info.solution.wrong.desc,
259
- timeout: false
260
- });
245
+ modifyFeedbackData(true, {
246
+ result: false,
247
+ text: list[currentSlide].info.solution.wrong.desc,
248
+ timeout: false
261
249
  });
262
250
  } // si no tiene feedback general pero tiene specificFeedbacks definido
263
251
  else if (list[currentSlide].info.solution.wrong.desc === '' && specificFeedback !== null && specificFeedback !== void 0 && specificFeedback.desc) {
264
252
  var _specificFeedback$rew2;
265
253
 
266
254
  accRewards.current = specificFeedback !== null && specificFeedback !== void 0 && (_specificFeedback$rew2 = specificFeedback.rewards) !== null && _specificFeedback$rew2 !== void 0 && _specificFeedback$rew2.length ? [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(specificFeedback === null || specificFeedback === void 0 ? void 0 : specificFeedback.rewards)) : _toConsumableArray(accRewards.current);
267
- setFeedbackData(function (prevState) {
268
- return _objectSpread(_objectSpread({}, prevState), {}, {
269
- show: true,
270
- result: false,
271
- text: specificFeedback.desc,
272
- timeout: false
273
- });
255
+ modifyFeedbackData(true, {
256
+ result: false,
257
+ text: specificFeedback.desc,
258
+ timeout: false
274
259
  });
275
260
  } // si no tiene feedback general ni specificFeedbacks definido
276
261
  else if (list[currentSlide].specificFeedbacks.specificWrongFeedbacks) {
277
262
  // si tiene puntos definidos por feedbacks negativos
278
263
  accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(specificFeedback === null || specificFeedback === void 0 ? void 0 : specificFeedback.rewards));
279
- setFeedbackData(function (prevState) {
280
- return _objectSpread(_objectSpread({}, prevState), {}, {
281
- show: true,
282
- result: false,
283
- timeout: true
284
- });
264
+ modifyFeedbackData(true, {
265
+ result: false,
266
+ timeout: true
285
267
  });
286
268
  } // si tiene puntos generales definidos por feedbacks negativo
287
269
  else {
288
270
  accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(list[currentSlide].info.solution.wrong.rewards));
289
- setFeedbackData(function (prevState) {
290
- return _objectSpread(_objectSpread({}, prevState), {}, {
291
- show: true,
292
- result: false,
293
- timeout: true
294
- });
271
+ modifyFeedbackData(true, {
272
+ result: false,
273
+ timeout: true
295
274
  });
296
275
  }
297
- }, [emitEvent, playSound, list, currentSlide]);
276
+ }, [playSound, emitEvent, list, currentSlide, modifyFeedbackData]);
298
277
  var onClickMark = (0, _react.useCallback)(function (e, id) {
299
278
  var _list$currentSlide, _list$currentSlide$sp, _list$currentSlide2, _list$currentSlide2$s;
300
279
 
@@ -331,17 +310,10 @@ var TextClickPuzzleComponent = function TextClickPuzzleComponent(_ref) {
331
310
  setOrderCounter(0);
332
311
  setCorrectTextFragmentsAccumulated(0);
333
312
  correctTextFragmentsPartial.current = 0;
334
- emitEvent({
335
- type: 'hidePuzzleButtons',
336
- payload: true
337
- });
338
- setFeedbackData(function (prevState) {
339
- return _objectSpread(_objectSpread({}, prevState), {}, {
340
- show: true,
341
- result: false,
342
- text: list[currentSlide].info.orderFeedback.desc || translate('puzzles.incorrectOrder'),
343
- timeout: false
344
- });
313
+ modifyFeedbackData(true, {
314
+ result: false,
315
+ text: list[currentSlide].info.orderFeedback.desc || translate('puzzles.incorrectOrder'),
316
+ timeout: false
345
317
  });
346
318
  } else {
347
319
  // si has click en mala repuesta
@@ -355,7 +327,7 @@ var TextClickPuzzleComponent = function TextClickPuzzleComponent(_ref) {
355
327
  // si la opción clickada es incorrecta
356
328
  handleIncorrectClick(currentTextDom, specificWrongFeedback);
357
329
  }
358
- }, [list, currentSlide, orderCounter, handleCorrectClick, emitEvent, translate, handleIncorrectClick, playSound]);
330
+ }, [list, currentSlide, playSound, orderCounter, handleCorrectClick, modifyFeedbackData, translate, handleIncorrectClick]);
359
331
  var recursiveStuff = (0, _react.useCallback)(function (jsx) {
360
332
  return (0, _utils.getRecursiveJSX)(jsx, 0, list[currentSlide], onClickMark);
361
333
  }, [currentSlide, list, onClickMark]);
@@ -274,7 +274,9 @@ var VideoVisor = function VideoVisor(_ref) {
274
274
  onEnded: onEnded,
275
275
  onError: onError,
276
276
  onPlaying: onPlaying
277
- }, videoProps)), loading ? /*#__PURE__*/_react.default.createElement("div", {
277
+ }, videoProps), /*#__PURE__*/_react.default.createElement("track", {
278
+ kind: "captions"
279
+ })), loading ? /*#__PURE__*/_react.default.createElement("div", {
278
280
  className: "video-loading-container",
279
281
  style: {
280
282
  top: 0,
@@ -158,7 +158,6 @@ var setWeight = function setWeight(action, weight) {
158
158
 
159
159
  var executeCrossFade = function executeCrossFade(startAction, endAction, duration) {
160
160
  if (startAction === endAction) return;
161
- if (!startAction || !endAction) return;
162
161
  startAction.play();
163
162
  startAction.reset();
164
163
  endAction.reset();
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.26.1-hotfix-3-hanged",
5
+ "version": "1.26.2",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",