@gamelearn/arcade-components 1.29.0 → 1.29.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.
@@ -113,10 +113,8 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
113
113
 
114
114
  if (specificFeedbacks !== null && specificFeedbacks !== void 0 && (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length && !currentImageProps.hasClickOnce && !finish) {
115
115
  correctClicked.current += 1;
116
- setSelected(selected + 1);
117
116
  } else {
118
117
  correctClicked.current += currentImageProps.areas.length;
119
- setSelected(selected + currentImageProps.areas.length);
120
118
  }
121
119
 
122
120
  if (correctClicked.current === currentImageProps.areas.length) {
@@ -163,13 +161,19 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
163
161
  setInfo(_objectSpread(_objectSpread({}, info), {}, {
164
162
  hintId: puzzleId
165
163
  }));
166
- }, [info, setInfo, puzzleId]);
164
+ }, [info, puzzleId, setInfo]);
167
165
  (0, _react.useEffect)(function () {
168
166
  if (currentPuzzleStatus && !resolvedItems.current[puzzleId]) {
169
167
  onComplete([], true, true);
170
168
  resolvedItems.current[puzzleId] = true;
171
169
  }
172
170
  }, [onComplete, puzzleId, currentPuzzleStatus]);
171
+
172
+ var checkSelectedAreas = function checkSelectedAreas() {
173
+ var areasSelected = currentImageProps.hasClickOnce ? currentImageProps.areas.length : 1;
174
+ setSelected(selected + areasSelected);
175
+ };
176
+
173
177
  return /*#__PURE__*/_react.default.createElement(_imageClickWrapperComponent.default, _extends({
174
178
  key: index
175
179
  }, currentImageProps, {
@@ -184,6 +188,7 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
184
188
  isLast: index + 1 === list.length,
185
189
  defaultCompleted: currentPuzzleStatus,
186
190
  hideContinue: !(index + 1 === list.length),
191
+ handleClick: checkSelectedAreas,
187
192
  emitEvent: emitEvent,
188
193
  disableExit: disableExit,
189
194
  soundActions: soundActions,
@@ -94,10 +94,8 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
94
94
 
95
95
  if (specificFeedbacks !== null && specificFeedbacks !== void 0 && (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co !== void 0 && _specificFeedbacks$co.length && !props.hasClickOnce && !finish) {
96
96
  correctClicked.current += 1;
97
- setSelected(selected + 1);
98
97
  } else {
99
98
  correctClicked.current += props.areas.length;
100
- setSelected(selected + props.areas.length);
101
99
  }
102
100
 
103
101
  if (correctClicked.current === props.areas.length) {
@@ -155,6 +153,12 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
155
153
  onComplete([], true, true);
156
154
  }
157
155
  }, [framesCompleted, loadPuzzleStatus, onComplete]);
156
+
157
+ var checkSelectedAreas = function checkSelectedAreas() {
158
+ var areasSelected = props.hasClickOnce ? props.areas.length : 1;
159
+ setSelected(selected + areasSelected);
160
+ };
161
+
158
162
  return /*#__PURE__*/_react.default.createElement(_imageClickWrapperComponent.default, _extends({
159
163
  key: index
160
164
  }, _objectSpread({}, props), {
@@ -175,6 +179,7 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
175
179
  translateFromParent: translateFromParent,
176
180
  emitEvent: emitEvent,
177
181
  slideNumber: index,
182
+ handleClick: checkSelectedAreas,
178
183
  emitResetPuzzle: handleResetPuzzle,
179
184
  firstTryForFrame: firstTryForFrame,
180
185
  puzzlesAutoCompleted: puzzlesAutoCompleted,
@@ -66,6 +66,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
66
66
  // Common config
67
67
  var soundActions = props.soundActions,
68
68
  emitEvent = props.emitEvent,
69
+ handleClick = props.handleClick,
69
70
  disableExit = props.disableExit,
70
71
  setResolveAction = props.setResolveAction,
71
72
  info = props.info,
@@ -382,6 +383,8 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
382
383
  if (hasClickOrder && area.index === clickedZones.length || !hasClickOrder) {
383
384
  var _specificFeedbacks$co2;
384
385
 
386
+ handleClick();
387
+
385
388
  if (specificFeedbacks !== null && specificFeedbacks !== void 0 && (_specificFeedbacks$co2 = specificFeedbacks.correctFeedbacks) !== null && _specificFeedbacks$co2 !== void 0 && _specificFeedbacks$co2.length) {
386
389
  var _specificFeedbacks$co3;
387
390
 
@@ -490,7 +493,8 @@ ImageClickWrapperComponent.defaultProps = {
490
493
  hasImageReview: false,
491
494
  defaultCompleted: false,
492
495
  hideContinue: false,
493
- emitAreaClick: function emitAreaClick() {}
496
+ emitAreaClick: function emitAreaClick() {},
497
+ handleClick: function handleClick() {}
494
498
  };
495
499
  var _default = ImageClickWrapperComponent;
496
500
  exports.default = _default;
@@ -382,8 +382,8 @@ var WriterPuzzleComponent = function WriterPuzzleComponent(_ref) {
382
382
  };
383
383
 
384
384
  var onIsWriting = function onIsWriting() {
385
- if (automaticScroll.current.querySelector('.Typist').offsetHeight > automaticScroll.current.offsetHeight) {
386
- var scrollToAdd = automaticScroll.current.querySelector('.Typist').offsetHeight;
385
+ if (automaticScroll.current.querySelector('.wrapfixed').offsetHeight > automaticScroll.current.offsetHeight) {
386
+ var scrollToAdd = automaticScroll.current.querySelector('.wrapfixed').offsetHeight;
387
387
  automaticScroll.current.scrollTo({
388
388
  top: scrollToAdd,
389
389
  behavior: 'smooth'
@@ -492,9 +492,11 @@ var WriterPuzzleComponent = function WriterPuzzleComponent(_ref) {
492
492
  height: '95%'
493
493
  },
494
494
  ref: automaticScroll
495
+ }, /*#__PURE__*/_react.default.createElement("div", {
496
+ className: "wrapfixed"
495
497
  }, isActive && !reviewDone && Object.values(textHolder).map(function (text, i) {
496
498
  return handleText(text, Object.values(textHolder).length - 1, i);
497
- }), reviewDone && Object.values(textHolder).map(function (text, i) {
499
+ })), reviewDone && Object.values(textHolder).map(function (text, i) {
498
500
  return handleShownText(text, i);
499
501
  }))), finished && /*#__PURE__*/_react.default.createElement("div", {
500
502
  className: "writer-puzzle__footer"
@@ -32,8 +32,6 @@ var messages = {
32
32
  fullText11: '<p>sdfsdfsdf</p>',
33
33
  fullText12: ' <p>Mucho Texto aqui a desglosar bla bla bla bla</p>',
34
34
  fullText13: ' <p>Mucho Texto aqui a desglosar bla bla bla bla</p>',
35
- fullTextXXL: // eslint-disable-next-line max-len
36
- '<p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que carnero, salpicón las más noches, duelos y quebrantos los sábados, lantejas los viernes, algún palomino de añadidura los domingos, consumían las tres partes de su hacienda.</p><p><br></p><p>asfd asdf</p><p><br></p><p>adsfasf</p><p><br></p><p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que carnero, salpicón las más noches, duelos y quebrantos los sábados, lantejas los viernes, algún palomino de añadidura</p><p><br></p><p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que carnero, salpicón las más noches, duelos y quebrantos los sábados, lantejas los viernes, algún palomino de añadidura los domingos, consumían las tres partes de su hacienda.</p><p><br></p><p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que carnero, salpicón las más noches, duelos y quebrantos los sábados, lantejas los viernes, algún palomino de añadidura los domingos, consumían las tres partes de su hacienda.</p><p><br></p><p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que carnero, salpicón las más noches, duelos y quebrantos los sábados, lantejas los viernes, algún palomino de añadidura los domingos, consumían las tres partes de su hacienda.</p><p><br></p><p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que carnero, salpicón las más noches, duelos y quebrantos los sábados, lantejas los viernes, algún palomino de añadidura los domingos, consumían las tres partes de su hacienda.</p><p><br></p><p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que carnero, salpicón las más noches, duelos y quebrantos los sábados, lantejas los viernes, algún palomino de añadidura los domingos, consumían las tres partes de su hacienda fin.</p>',
37
35
  previewText1: 'Preview Text 1',
38
36
  previewText2: 'este pinta bien ;)',
39
37
  previewText3: 'correcto este',
@@ -1036,8 +1034,103 @@ var mock9 = {
1036
1034
  emitEvent: _mocker.emitEvent,
1037
1035
  soundActions: _mocker.soundActions,
1038
1036
  texts: [{
1039
- type: 'fixed',
1040
- fullText: messages.fullTextXXL
1037
+ fullText: // eslint-disable-next-line max-len
1038
+ '<p><strong>SHARON B:</strong>&nbsp;<br>Hola Joanna. Soy Sharon B.<br><br><strong>JOANNA:&nbsp;<br></strong>Ya claro, ¡y yo soy una Spice Girl!<br><br></p>',
1039
+ fullText_labelId: 'fullText_0_2gMZwWlK',
1040
+ type: 'fixed'
1041
+ }, {
1042
+ electionTexts: [{
1043
+ correct: true,
1044
+ feedback: {
1045
+ body: '¡Bien! Te estás metiendo en la piel de Sharon B.. ',
1046
+ body_labelId: 'body_1_0_2gMZw4CT',
1047
+ rewards: [],
1048
+ title: null,
1049
+ title_labelId: 'title_1_0_2gMZwxk1'
1050
+ },
1051
+ fullText: // eslint-disable-next-line max-len
1052
+ '<p><strong>SHARON B:&nbsp;<br></strong>Soy yo y éste es mi perfil personal. Sólo lo uso para comunicarme con mis fans más importantes.</p>',
1053
+ fullText_labelId: 'fullText_1_0_2gMZwaDp',
1054
+ previewText: 'Soy yo',
1055
+ previewText_labelId: 'previewText_1_0_2gMZwq0y'
1056
+ }, {
1057
+ correct: true,
1058
+ feedback: {
1059
+ body: '¡Bien! Te estás metiendo en la piel de Sharon B.. ',
1060
+ body_labelId: 'body_1_1_2gMZxTbh',
1061
+ title: null,
1062
+ title_labelId: 'title_1_1_2gMZxSPT'
1063
+ },
1064
+ fullText: // eslint-disable-next-line max-len
1065
+ '<p><strong>SHARON B:&nbsp;<br></strong>Jaja… Muy graciosa. La diferencia entre tú y yo es que yo sí soy la&nbsp;verdadera Sharon B.</p>',
1066
+ fullText_labelId: 'fullText_1_1_2gMZx1HK',
1067
+ previewText: 'Muy graciosa',
1068
+ previewText_labelId: 'previewText_1_1_2gMZxqfn'
1069
+ }, {
1070
+ correct: true,
1071
+ feedback: {
1072
+ body: '¡Bien! Te estás metiendo en la piel de Sharon B.. ',
1073
+ body_labelId: 'body_1_2_2gMZyT39',
1074
+ title: null,
1075
+ title_labelId: 'title_1_2_2gMZygwn'
1076
+ },
1077
+ fullText: // eslint-disable-next-line max-len
1078
+ '<p><strong>SHARON B:&nbsp;<br></strong>Yo que tú no sería tan borde. No todo el mundo puede hablar con Sharon B.</p>',
1079
+ fullText_labelId: 'fullText_1_2_2gMZxpzh',
1080
+ previewText: 'Tranquila',
1081
+ previewText_labelId: 'previewText_1_2_2gMZx0VN'
1082
+ }],
1083
+ fullText_labelId: 'fullText_1_2gMZw34m',
1084
+ type: 'election'
1085
+ }, {
1086
+ fullText: // eslint-disable-next-line max-len
1087
+ '<p><br><br><strong>JOANNA:<br></strong>¿Me lo dices en serio? ¿De verdad eres Sharon B.?<br><br><strong>SHARON B:&nbsp;<br></strong>¿Qué iba a conseguir mintiéndote?<br><br><strong>JOANNA:&nbsp;<br></strong>…<br><br><strong>SHARON B:</strong>&nbsp;<br>¿Joanna?<br><br><strong>JOANNA:&nbsp;<br></strong>¡¡¡¡NO ME LO PUEDO CREER!!!! ¡¡Estoy chateando con SHARON B!<br><br><strong>SHARON B:</strong>&nbsp;<br>Jajaja. Verás, te escribo porque estoy interesada en conocer y hablar con mis fans más exclusivas. Necesito sus opiniones para incluirlas en mi nuevo libro sobre Mastermind. ¿Te interesa participar?<br><br><strong>JOANNA:</strong>&nbsp;<br>¡Oh, wow… claro que sí! ¡Qué emoción!<br><br><strong>SHARON B:</strong>&nbsp;<br>¿Puedes quedar ahora?&nbsp;<br><br><strong>JOANNA:&nbsp;<br></strong>¿Ahora?<br><br><strong>SHARON B:</strong>&nbsp;<br>Sí, salgo en dos horas al aeropuerto. ¿No me irás a decir que no?<br><br><strong>JOANNA:</strong>&nbsp;<br>¡Dios! ¡Hago lo que sea por conocerte!<br><br></p>',
1088
+ fullText_labelId: 'fullText_2_2gMZyEbj',
1089
+ type: 'fixed'
1090
+ }, {
1091
+ electionTexts: [{
1092
+ correct: true,
1093
+ feedback: {
1094
+ body: '¡Bien! Has atraído con un falso pretexto a Joanna. ',
1095
+ body_labelId: 'body_3_0_2gMZzKgD',
1096
+ title: null,
1097
+ title_labelId: 'title_3_0_2gMZyTXZ'
1098
+ },
1099
+ fullText: '<p><strong>SHARON B:&nbsp;<br></strong>¡Súper! Te espero en el Oxford Vintage Cafe. ¿Sabes cuál es, verdad?</p>',
1100
+ fullText_labelId: 'fullText_3_0_2gMZyI3C',
1101
+ previewText: 'Quedamos en: Cafetería',
1102
+ previewText_labelId: 'previewText_3_0_2gMZy5Ai'
1103
+ }, {
1104
+ correct: true,
1105
+ feedback: {
1106
+ body: '¡Bien! Has atraído con un falso pretexto a Joanna. ',
1107
+ body_labelId: 'body_3_1_2gMZ0a7m',
1108
+ title: null,
1109
+ title_labelId: 'title_3_1_2gMZzTFL'
1110
+ },
1111
+ fullText: '<p><strong>SHARON B:&nbsp;<br></strong>¡Genial! ¿Te apetece tomar una pinta en el Candem Pub?</p>',
1112
+ fullText_labelId: 'fullText_3_1_2gMZzWvV',
1113
+ previewText: 'Quedamos en: Un pub',
1114
+ previewText_labelId: 'previewText_3_1_2gMZzjyc'
1115
+ }, {
1116
+ correct: true,
1117
+ feedback: {
1118
+ body: '¡Bien! Has atraído con un falso pretexto a Joanna. ',
1119
+ body_labelId: 'body_3_2_2gMZ21Cz',
1120
+ title: null,
1121
+ title_labelId: 'title_3_2_2gMZ2uAH'
1122
+ },
1123
+ fullText: '<p><strong>SHARON B:&nbsp;<br></strong>¡Estupendo! ¿Comemos algo en el&nbsp;Trafalgar Burger?</p>',
1124
+ fullText_labelId: 'fullText_3_2_2gMZ1pfM',
1125
+ previewText: 'Quedamos en: Burger',
1126
+ previewText_labelId: 'previewText_3_2_2gMZ1NW0'
1127
+ }],
1128
+ fullText_labelId: 'fullText_3_2gMZyFZU',
1129
+ type: 'election'
1130
+ }, {
1131
+ fullText: '<p><br><br><strong>JOANNA:<br></strong>Enseguida salgo para allá. ¡Qué emoción!<br></p>',
1132
+ fullText_labelId: 'fullText_4_2gMZ2MWR',
1133
+ type: 'fixed'
1041
1134
  }],
1042
1135
  info: {
1043
1136
  solution: {
@@ -167,8 +167,6 @@ var useEkho = function useEkho(_ref) {
167
167
  }
168
168
  }, [noAudio, stopCurrentAudio]);
169
169
  (0, _react.useEffect)(function () {
170
- stopCurrentAudio();
171
-
172
170
  if (isMounted && started) {
173
171
  if (audioType === 'voice' && voice !== null && voice !== void 0 && voice.id) {
174
172
  var voiceId = getVoice(voice);
@@ -182,7 +180,7 @@ var useEkho = function useEkho(_ref) {
182
180
  onError();
183
181
  }
184
182
  }
185
- }, [getVoice, playSpeech, isMounted, voice, text, audioType, audio === null || audio === void 0 ? void 0 : audio.url, audio, setCurrentPlaying, onError, started, stopCurrentAudio]);
183
+ }, [getVoice, playSpeech, isMounted, voice, text, audioType, audio === null || audio === void 0 ? void 0 : audio.url, audio, setCurrentPlaying, onError, started]);
186
184
  return stopCurrentAudio;
187
185
  };
188
186
 
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.29.0",
5
+ "version": "1.29.2",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",
@@ -13,7 +13,7 @@
13
13
  "url": "https://github.com/gamelearn/arcade-components"
14
14
  },
15
15
  "dependencies": {
16
- "@gamelearn/arcade-styles": "0.14.1",
16
+ "@gamelearn/arcade-styles": "0.14.2",
17
17
  "@gamelearn/arcade-three-core": "1.14.5",
18
18
  "@react-three/drei": "9.4.3",
19
19
  "@react-three/fiber": "8.0.17",