@gamelearn/arcade-components 2.10.0 → 2.11.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.
Files changed (52) hide show
  1. package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +4 -2
  2. package/dist/components/cards-selector-puzzle-component/mocks/mockForStory.js +4 -0
  3. package/dist/components/cartel-component/components/CartelComponent.js +4 -1
  4. package/dist/components/chained-image-click-puzzle-component/components/ChainedImageClickPuzzleComponent.js +4 -2
  5. package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +4 -3
  6. package/dist/components/chained-image-click-puzzle-component/mocks/mockForStory.js +2 -0
  7. package/dist/components/comic-component/components/ComicComponent.js +3 -1
  8. package/dist/components/comic-component/mocks/mockForStory.js +4 -0
  9. package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +4 -1
  10. package/dist/components/conversational-pro-component/mocks/mockForStory.js +7 -0
  11. package/dist/components/cracker-puzzle-component/mocks/mockForStory.js +5 -0
  12. package/dist/components/decision-component/components/DecisionComponent.js +86 -77
  13. package/dist/components/decision-component/mocks/mockForStory.js +2 -0
  14. package/dist/components/dialog-component/components/DialogComponent.js +5 -2
  15. package/dist/components/dialog-component/mocks/mockForStory.js +2 -0
  16. package/dist/components/drag-item-puzzle-component/components/DragItemPuzzleComponent.js +4 -2
  17. package/dist/components/drag-item-puzzle-component/mocks/mockForStory.js +1 -0
  18. package/dist/components/feedback-component/components/FeedbackComponent.js +3 -1
  19. package/dist/components/feedback-component/mocks/mockForStory.js +8 -2
  20. package/dist/components/frame-click-puzzle-component/components/CurrentFramePuzzle.js +4 -2
  21. package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +5 -3
  22. package/dist/components/frame-click-puzzle-component/mocks/mockForStory.js +4 -0
  23. package/dist/components/hacker-puzzle-component/mocks/mockForStory.js +3 -0
  24. package/dist/components/hanged-puzzle-component/components/HangedPuzzleComponent.js +4 -2
  25. package/dist/components/hanged-puzzle-component/mocks/mockForStory.js +1 -0
  26. package/dist/components/image-click-puzzle-component/mocks/mockForStory.js +4 -0
  27. package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +4 -2
  28. package/dist/components/image-click-wrapper-component/mocks/mockForStory.js +5 -0
  29. package/dist/components/image-component/components/ImageComponent.js +3 -1
  30. package/dist/components/image-component/mocks/mockForStory.js +3 -0
  31. package/dist/components/keyboard-puzzle-component/components/KeyboardPuzzleComponent.js +4 -2
  32. package/dist/components/keyboard-puzzle-component/mocks/mockForStory.js +1 -0
  33. package/dist/components/lectures-component/components/LecturesComponent.js +4 -3
  34. package/dist/components/lectures-component/mocks/mockForStory.js +1 -0
  35. package/dist/components/login-puzzle-component/mocks/mockForStory.js +1 -0
  36. package/dist/components/pattern-component/components/PatternComponent.js +3 -1
  37. package/dist/components/pattern-component/mocks/mockForStory.js +2 -0
  38. package/dist/components/pdf-component/components/PdfComponent.js +18 -4
  39. package/dist/components/pdf-component/components/PdfVisor.js +19 -5
  40. package/dist/components/pdf-component/mocks/mockForProps.js +1 -0
  41. package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +4 -2
  42. package/dist/components/terminal-puzzle-component/components/Visor/index.js +4 -2
  43. package/dist/components/terminal-puzzle-component/mocks/mockForStory.js +1 -0
  44. package/dist/components/text-click-puzzle-component/components/TextClickPuzzleComponent.js +4 -2
  45. package/dist/components/text-click-puzzle-component/mocks/mockForStory.js +2 -0
  46. package/dist/components/video-component/components/VideoComponent.js +3 -1
  47. package/dist/components/video-component/mocks/mockForStory.js +6 -0
  48. package/dist/components/web-builder-puzzle-component/components/WebBuilderPuzzleComponent.js +4 -1
  49. package/dist/components/web-builder-puzzle-component/mocks/mockForStory.js +1 -0
  50. package/dist/components/writer-puzzle-component/mocks/mockForStory.js +9 -0
  51. package/dist/helpers/mocker.js +6 -2
  52. package/package.json +2 -2
@@ -50,7 +50,8 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
50
50
  setResolveAction = _ref.setResolveAction,
51
51
  soundActions = _ref.soundActions,
52
52
  backgroundImage = _ref.backgroundImage,
53
- nodeId = _ref.nodeId;
53
+ nodeId = _ref.nodeId,
54
+ keyboardControl = _ref.keyboardControl;
54
55
 
55
56
  var _useState = (0, _react.useState)(false),
56
57
  _useState2 = _slicedToArray(_useState, 2),
@@ -304,7 +305,8 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
304
305
  text: feedBackText,
305
306
  hasTimeout: !feedBackText,
306
307
  translate: translate,
307
- functionOnClose: handleFeedbackFuncionOnClose
308
+ functionOnClose: handleFeedbackFuncionOnClose,
309
+ keyboardControl: keyboardControl
308
310
  }));
309
311
  };
310
312
 
@@ -16,6 +16,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
16
16
  var mockProps = {
17
17
  emitEvent: _mocker.emitEvent,
18
18
  soundActions: _mocker.soundActions,
19
+ keyboardControl: _mocker.keyboardControl,
19
20
  disableExit: function disableExit() {},
20
21
  setResolveAction: function setResolveAction() {},
21
22
  cards: [{
@@ -92,6 +93,7 @@ exports.mockProps = mockProps;
92
93
  var mockProps2 = {
93
94
  emitEvent: _mocker.emitEvent,
94
95
  soundActions: _mocker.soundActions,
96
+ keyboardControl: _mocker.keyboardControl,
95
97
  disableExit: function disableExit() {},
96
98
  setResolveAction: function setResolveAction() {},
97
99
  cards: [{
@@ -168,6 +170,7 @@ exports.mockProps2 = mockProps2;
168
170
  var mockProps3 = {
169
171
  emitEvent: _mocker.emitEvent,
170
172
  soundActions: _mocker.soundActions,
173
+ keyboardControl: _mocker.keyboardControl,
171
174
  disableExit: function disableExit() {},
172
175
  setResolveAction: function setResolveAction() {},
173
176
  cards: [{
@@ -272,6 +275,7 @@ exports.mockProps3 = mockProps3;
272
275
  var mockProps4 = {
273
276
  emitEvent: _mocker.emitEvent,
274
277
  soundActions: _mocker.soundActions,
278
+ keyboardControl: _mocker.keyboardControl,
275
279
  disableExit: function disableExit() {},
276
280
  setResolveAction: function setResolveAction() {},
277
281
  cards: [{
@@ -38,7 +38,8 @@ var CartelComponent = function CartelComponent(_ref) {
38
38
  emitEvent = _ref.emitEvent,
39
39
  soundActions = _ref.soundActions,
40
40
  audioVolume = _ref.audioVolume,
41
- pause = _ref.pause;
41
+ pause = _ref.pause,
42
+ keyboardControl = _ref.keyboardControl;
42
43
  var resourceUrl = (img === null || img === void 0 ? void 0 : img.url) || 'https://min.gamelearn.io/css-resources/gamelearn/resources/conversation.jpg';
43
44
  var textBox = (0, _react.useRef)();
44
45
  var picture = (0, _react.useRef)();
@@ -64,6 +65,8 @@ var CartelComponent = function CartelComponent(_ref) {
64
65
  });
65
66
  };
66
67
 
68
+ keyboardControl(null, close, close);
69
+
67
70
  var assignValueByMediaQuery = function assignValueByMediaQuery(valueMobile, valueDesktop) {
68
71
  if (window.matchMedia('(min-width: 1280px)').matches) {
69
72
  /* Screen >= 1200 */
@@ -38,7 +38,8 @@ var ChainedImageClickPuzzleComponent = function ChainedImageClickPuzzleComponent
38
38
  soundActions = props.soundActions,
39
39
  showFrames = props.showFrames,
40
40
  disableExit = props.disableExit,
41
- setResolveAction = props.setResolveAction;
41
+ setResolveAction = props.setResolveAction,
42
+ keyboardControl = props.keyboardControl;
42
43
 
43
44
  var _useState = (0, _react.useState)(0),
44
45
  _useState2 = _slicedToArray(_useState, 2),
@@ -77,7 +78,8 @@ var ChainedImageClickPuzzleComponent = function ChainedImageClickPuzzleComponent
77
78
  setIndex: setIndex,
78
79
  slidesCompleted: slidesCompleted,
79
80
  setSlidesCompleted: setSlidesCompleted,
80
- loadPuzzleStatus: loadPuzzleStatus
81
+ loadPuzzleStatus: loadPuzzleStatus,
82
+ keyboardControl: keyboardControl
81
83
  };
82
84
  var totalCorrects = list.reduce(function (acc, current) {
83
85
  return acc + current.areas.length;
@@ -61,7 +61,8 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
61
61
  index = _ref.index,
62
62
  setIndex = _ref.setIndex,
63
63
  slidesCompleted = _ref.slidesCompleted,
64
- setSlidesCompleted = _ref.setSlidesCompleted;
64
+ setSlidesCompleted = _ref.setSlidesCompleted,
65
+ keyboardControl = _ref.keyboardControl;
65
66
  var accRewards = (0, _react.useRef)([]);
66
67
  var correctClicked = (0, _react.useRef)(0);
67
68
  var currentSelected = (0, _react.useRef)(0);
@@ -185,7 +186,6 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
185
186
  var checkSelectedAreas = function checkSelectedAreas() {
186
187
  var areasSelected = currentImageProps.hasClickOnce ? currentImageProps.areas.length : 1;
187
188
  currentSelected.current += areasSelected;
188
- console.info('checkSelectedAreas', currentSelected.current);
189
189
  setSelected(selected + areasSelected);
190
190
  };
191
191
 
@@ -208,7 +208,8 @@ var CurrentImageClickPuzzle = function CurrentImageClickPuzzle(_ref) {
208
208
  disableExit: disableExit,
209
209
  soundActions: soundActions,
210
210
  setResolveAction: setResolveAction,
211
- pause: pause
211
+ pause: pause,
212
+ keyboardControl: keyboardControl
212
213
  }));
213
214
  };
214
215
 
@@ -15,6 +15,7 @@ var mockProps = {
15
15
  setInfo: function setInfo() {},
16
16
  emitEvent: _mocker.emitEvent,
17
17
  soundActions: _mocker.soundActions,
18
+ keyboardControl: _mocker.keyboardControl,
18
19
  disableExit: function disableExit() {},
19
20
  setResolveAction: function setResolveAction() {},
20
21
  list: [{
@@ -167,6 +168,7 @@ var mockProps2 = {
167
168
  setInfo: function setInfo() {},
168
169
  emitEvent: _mocker.emitEvent,
169
170
  soundActions: _mocker.soundActions,
171
+ keyboardControl: _mocker.keyboardControl,
170
172
  disableExit: function disableExit() {},
171
173
  setResolveAction: function setResolveAction() {},
172
174
  list: [{
@@ -45,7 +45,8 @@ var ComicComponent = function ComicComponent(_ref) {
45
45
  _ref$soundActions = _ref.soundActions,
46
46
  soundActions = _ref$soundActions === void 0 ? [function () {}, function () {}] : _ref$soundActions,
47
47
  autoPlay = _ref.autoPlay,
48
- pause = _ref.pause;
48
+ pause = _ref.pause,
49
+ keyboardControl = _ref.keyboardControl;
49
50
 
50
51
  var _useState = (0, _react.useState)(true),
51
52
  _useState2 = _slicedToArray(_useState, 2),
@@ -120,6 +121,7 @@ var ComicComponent = function ComicComponent(_ref) {
120
121
  goToPreviousSlide();
121
122
  };
122
123
 
124
+ keyboardControl(slideCount > 0 ? handleManualBack : null, slideCount + 1 >= slides.length && close || (slideCount + 1 < slides.length ? handleManualNext : null), slideCount + 1 >= slides.length ? close : null);
123
125
  (0, _useEkho.default)({
124
126
  audioType: slides === null || slides === void 0 ? void 0 : (_slides$slideCount = slides[slideCount]) === null || _slides$slideCount === void 0 ? void 0 : _slides$slideCount.audioType,
125
127
  voice: slides === null || slides === void 0 ? void 0 : (_slides$slideCount2 = slides[slideCount]) === null || _slides$slideCount2 === void 0 ? void 0 : _slides$slideCount2.voice,
@@ -11,6 +11,7 @@ var _mocker = require("helpers/mocker");
11
11
  var comicProps = {
12
12
  emitEvent: _mocker.emitEvent,
13
13
  soundActions: _mocker.soundActions,
14
+ keyboardControl: _mocker.keyboardControl,
14
15
  slides: [{
15
16
  slideOrder: 1,
16
17
  transitionEffects: null,
@@ -85,6 +86,7 @@ exports.comicProps = comicProps;
85
86
  var comicNoImageProps = {
86
87
  emitEvent: _mocker.emitEvent,
87
88
  soundActions: _mocker.soundActions,
89
+ keyboardControl: _mocker.keyboardControl,
88
90
  slides: [{
89
91
  alias_labelId: 'alias_0_WU81OYcP',
90
92
  audioId: '',
@@ -171,6 +173,7 @@ exports.comicNoImageProps = comicNoImageProps;
171
173
  var comicWithTTS = {
172
174
  emitEvent: _mocker.emitEvent,
173
175
  soundActions: _mocker.soundActions,
176
+ keyboardControl: _mocker.keyboardControl,
174
177
  slides: [{
175
178
  slideOrder: 1,
176
179
  transitionEffects: null,
@@ -231,6 +234,7 @@ exports.comicWithTTS = comicWithTTS;
231
234
  var comicWithAlias = {
232
235
  emitEvent: _mocker.emitEvent,
233
236
  soundActions: _mocker.soundActions,
237
+ keyboardControl: _mocker.keyboardControl,
234
238
  slides: [{
235
239
  slideOrder: 1,
236
240
  transitionEffects: null,
@@ -61,7 +61,8 @@ var minMs = 1400;
61
61
  var ConversationProViewer = function ConversationProViewer(_ref) {
62
62
  var _background$img, _currentLineData$slot3, _currentMessage$text;
63
63
 
64
- var emitEvent = _ref.emitEvent,
64
+ var keyboardControl = _ref.keyboardControl,
65
+ emitEvent = _ref.emitEvent,
65
66
  pause = _ref.pause,
66
67
  lines = _ref.lines,
67
68
  edges = _ref.edges,
@@ -469,11 +470,13 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
469
470
  }
470
471
  }
471
472
  }, [edges, isBranched, lines, mounted]);
473
+ keyboardControl(isDecision || disableBackButton ? null : manualClickBack, isDecision ? null : manualClickNext);
472
474
 
473
475
  var decisionPayload = _objectSpread(_objectSpread({}, currentLineData.payload), {}, {
474
476
  required: !isBranched,
475
477
  branched: isBranched,
476
478
  onFinish: handleClickNext,
479
+ keyboardControl: keyboardControl,
477
480
  emitEvent: emitEvent,
478
481
  soundActions: soundActions,
479
482
  inheritProps: {
@@ -22,6 +22,7 @@ var animations = {
22
22
  var branchedConver = {
23
23
  emitEvent: _mocker.emitEvent,
24
24
  soundActions: _mocker.soundActions,
25
+ keyboardControl: _mocker.keyboardControl,
25
26
  lines: [{
26
27
  id: 'line1',
27
28
  type: 'conversationalPhrase',
@@ -316,6 +317,7 @@ exports.branchedConver = branchedConver;
316
317
  var converOld = {
317
318
  emitEvent: _mocker.emitEvent,
318
319
  soundActions: _mocker.soundActions,
320
+ keyboardControl: _mocker.keyboardControl,
319
321
  messages: [{
320
322
  character: 'Puerta',
321
323
  emotion: 'neutral',
@@ -370,6 +372,7 @@ exports.converOld = converOld;
370
372
  var conversationProps = {
371
373
  emitEvent: _mocker.emitEvent,
372
374
  soundActions: _mocker.soundActions,
375
+ keyboardControl: _mocker.keyboardControl,
373
376
  lines: [{
374
377
  flex: true,
375
378
  slots: [{
@@ -636,6 +639,7 @@ exports.conversationProps = conversationProps;
636
639
  var voiceOverProps = {
637
640
  emitEvent: _mocker.emitEvent,
638
641
  soundActions: _mocker.soundActions,
642
+ keyboardControl: _mocker.keyboardControl,
639
643
  lines: [{
640
644
  flex: false,
641
645
  slots: [{
@@ -769,6 +773,7 @@ exports.voiceOverProps = voiceOverProps;
769
773
  var withoutBackground = {
770
774
  emitEvent: _mocker.emitEvent,
771
775
  soundActions: _mocker.soundActions,
776
+ keyboardControl: _mocker.keyboardControl,
772
777
  lines: [{
773
778
  flex: false,
774
779
  slots: [{
@@ -898,6 +903,7 @@ exports.withoutBackground = withoutBackground;
898
903
  var conversationPropsNoFeedbackNoRewards = {
899
904
  emitEvent: _mocker.emitEvent,
900
905
  soundActions: _mocker.soundActions,
906
+ keyboardControl: _mocker.keyboardControl,
901
907
  lines: [{
902
908
  flex: true,
903
909
  slots: [{
@@ -1158,6 +1164,7 @@ exports.conversationPropsNoFeedbackNoRewards = conversationPropsNoFeedbackNoRewa
1158
1164
  var conversationPropsLodSettings = {
1159
1165
  emitEvent: _mocker.emitEvent,
1160
1166
  soundActions: _mocker.soundActions,
1167
+ keyboardControl: _mocker.keyboardControl,
1161
1168
  lodSettings: {
1162
1169
  currentLOD: 'original',
1163
1170
  rgbSimulation: true,
@@ -10,6 +10,7 @@ var _mocker = require("helpers/mocker");
10
10
  var mockProps = {
11
11
  emitEvent: _mocker.emitEvent,
12
12
  soundActions: _mocker.soundActions,
13
+ keyboardControl: _mocker.keyboardControl,
13
14
  disableExit: function disableExit() {},
14
15
  setResolveAction: function setResolveAction() {},
15
16
  velocity: 'slow',
@@ -63,6 +64,7 @@ exports.mockProps = mockProps;
63
64
  var mockProps2 = {
64
65
  emitEvent: _mocker.emitEvent,
65
66
  soundActions: _mocker.soundActions,
67
+ keyboardControl: _mocker.keyboardControl,
66
68
  disableExit: function disableExit() {},
67
69
  setResolveAction: function setResolveAction() {},
68
70
  velocity: 'fast',
@@ -116,6 +118,7 @@ exports.mockProps2 = mockProps2;
116
118
  var mockProps3 = {
117
119
  emitEvent: _mocker.emitEvent,
118
120
  soundActions: _mocker.soundActions,
121
+ keyboardControl: _mocker.keyboardControl,
119
122
  disableExit: function disableExit() {},
120
123
  setResolveAction: function setResolveAction() {},
121
124
  velocity: 'fastest',
@@ -169,6 +172,7 @@ exports.mockProps3 = mockProps3;
169
172
  var mockProps4 = {
170
173
  emitEvent: _mocker.emitEvent,
171
174
  soundActions: _mocker.soundActions,
175
+ keyboardControl: _mocker.keyboardControl,
172
176
  disableExit: function disableExit() {},
173
177
  setResolveAction: function setResolveAction() {},
174
178
  velocity: 'fastest',
@@ -222,6 +226,7 @@ exports.mockProps4 = mockProps4;
222
226
  var mockProps5 = {
223
227
  emitEvent: _mocker.emitEvent,
224
228
  soundActions: _mocker.soundActions,
229
+ keyboardControl: _mocker.keyboardControl,
225
230
  disableExit: function disableExit() {},
226
231
  setResolveAction: function setResolveAction() {},
227
232
  velocity: 'slow',
@@ -15,7 +15,7 @@ var _DecisionBody = _interopRequireDefault(require("./DecisionBody"));
15
15
 
16
16
  var _Feedback = _interopRequireDefault(require("./Feedback"));
17
17
 
18
- var _excluded = ["emitEvent", "soundActions", "inScene"];
18
+ var _excluded = ["emitEvent", "soundActions", "keyboardControl", "inScene"];
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
@@ -48,6 +48,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
48
48
  var DecisionComponent = function DecisionComponent(_ref) {
49
49
  var emitEvent = _ref.emitEvent,
50
50
  soundActions = _ref.soundActions,
51
+ keyboardControl = _ref.keyboardControl,
51
52
  inScene = _ref.inScene,
52
53
  props = _objectWithoutProperties(_ref, _excluded);
53
54
 
@@ -102,6 +103,85 @@ var DecisionComponent = function DecisionComponent(_ref) {
102
103
  }
103
104
  }
104
105
 
106
+ var onNext = function onNext(choice) {
107
+ if (!failed && selectedView === 'results') {
108
+ playSound('click-ui');
109
+
110
+ if (inherited) {
111
+ if (simplifiedOptions) {
112
+ if (_onFinish) {
113
+ _onFinish(choice, function () {
114
+ setResultChoice({});
115
+ selectView('options');
116
+ });
117
+ }
118
+ } else {
119
+ emitEvent({
120
+ type: 'addPoints',
121
+ payload: choice.rewards,
122
+ finish: true,
123
+ complex: true,
124
+ onFinish: function onFinish() {
125
+ if (_onFinish) {
126
+ _onFinish(choice, function () {
127
+ setResultChoice({});
128
+ selectView('options');
129
+ });
130
+ } else {
131
+ emitEvent({
132
+ type: 'success'
133
+ });
134
+ }
135
+
136
+ setResultChoice({});
137
+ selectView('options');
138
+ }
139
+ });
140
+ }
141
+ } else {
142
+ emitEvent({
143
+ type: 'addPoints',
144
+ payload: choice.rewards,
145
+ finish: true,
146
+ complex: true
147
+ });
148
+ }
149
+ } else if (Object.keys(choice).length > 0) {
150
+ playSound('click-ui');
151
+
152
+ if (!simplifiedOptions) {
153
+ if (choice.right) {
154
+ playSound('score');
155
+ } else {
156
+ playSound('fail');
157
+
158
+ if (!branched) {
159
+ if (inherited || required) {
160
+ emitEvent({
161
+ type: 'addPoints',
162
+ payload: choice.rewards,
163
+ finish: false,
164
+ complex: true
165
+ });
166
+ } else if (!required) {
167
+ setResultChoice({});
168
+ selectView('options');
169
+ }
170
+ }
171
+ }
172
+
173
+ setResultChoice(choice);
174
+ playCurrentAudio(choice);
175
+ selectView('results');
176
+ } else {
177
+ _onFinish(choice, function () {
178
+ setResultChoice({});
179
+ selectView('options');
180
+ });
181
+ }
182
+ }
183
+ };
184
+
105
185
  var bodyProps = _objectSpread(_objectSpread({}, props), {}, {
106
186
  selectView: selectView,
107
187
  selectedView: selectedView,
@@ -121,82 +201,7 @@ var DecisionComponent = function DecisionComponent(_ref) {
121
201
  setResultChoice(option);
122
202
  selectView('options');
123
203
  },
124
- onNext: function onNext(choice) {
125
- playSound('click-ui');
126
-
127
- if (!failed && selectedView === 'results') {
128
- if (inherited) {
129
- if (simplifiedOptions) {
130
- if (_onFinish) {
131
- _onFinish(choice, function () {
132
- setResultChoice({});
133
- selectView('options');
134
- });
135
- }
136
- } else {
137
- emitEvent({
138
- type: 'addPoints',
139
- payload: choice.rewards,
140
- finish: true,
141
- complex: true,
142
- onFinish: function onFinish() {
143
- if (_onFinish) {
144
- _onFinish(choice, function () {
145
- setResultChoice({});
146
- selectView('options');
147
- });
148
- } else {
149
- emitEvent({
150
- type: 'success'
151
- });
152
- }
153
-
154
- setResultChoice({});
155
- selectView('options');
156
- }
157
- });
158
- }
159
- } else {
160
- emitEvent({
161
- type: 'addPoints',
162
- payload: choice.rewards,
163
- finish: true,
164
- complex: true
165
- });
166
- }
167
- } else if (Object.keys(choice).length > 0) {
168
- if (!simplifiedOptions) {
169
- if (choice.right) {
170
- playSound('score');
171
- } else {
172
- playSound('fail');
173
-
174
- if (!branched) {
175
- if (inherited || required) {
176
- emitEvent({
177
- type: 'addPoints',
178
- payload: choice.rewards,
179
- finish: false,
180
- complex: true
181
- });
182
- } else if (!required) {
183
- setResultChoice({});
184
- selectView('options');
185
- }
186
- }
187
- }
188
-
189
- setResultChoice(choice);
190
- playCurrentAudio(choice);
191
- selectView('results');
192
- } else {
193
- _onFinish(choice, function () {
194
- setResultChoice({});
195
- selectView('options');
196
- });
197
- }
198
- }
199
- },
204
+ onNext: onNext,
200
205
  translate: function translate(id) {
201
206
  return emitEvent({
202
207
  type: 'translate',
@@ -205,6 +210,10 @@ var DecisionComponent = function DecisionComponent(_ref) {
205
210
  }
206
211
  });
207
212
 
213
+ keyboardControl(null, selectedView === 'results' ? function () {
214
+ onNext(resultChoice);
215
+ } : null);
216
+
208
217
  var BackgroundWrapper = function BackgroundWrapper(_ref2) {
209
218
  var children = _ref2.children;
210
219
 
@@ -10,6 +10,7 @@ var _mocker = require("helpers/mocker");
10
10
  var decisionProps = {
11
11
  emitEvent: _mocker.emitEvent,
12
12
  soundActions: _mocker.soundActions,
13
+ keyboardControl: _mocker.keyboardControl,
13
14
  onFinish: function onFinish() {
14
15
  return (0, _mocker.onFinish)('decision-component');
15
16
  },
@@ -128,6 +129,7 @@ exports.decisionProps = decisionProps;
128
129
  var decisionPropsWithRadios = {
129
130
  emitEvent: _mocker.emitEvent,
130
131
  soundActions: _mocker.soundActions,
132
+ keyboardControl: _mocker.keyboardControl,
131
133
  options: [{
132
134
  id: 0,
133
135
  right: false,
@@ -76,7 +76,8 @@ raycast.firstHitOnly = true;
76
76
  var DialogComponent = function DialogComponent(_ref) {
77
77
  var _currentLineData$slot;
78
78
 
79
- var emitEvent = _ref.emitEvent,
79
+ var keyboardControl = _ref.keyboardControl,
80
+ emitEvent = _ref.emitEvent,
80
81
  lines = _ref.lines,
81
82
  actors = _ref.actors,
82
83
  edges = _ref.edges,
@@ -750,6 +751,7 @@ var DialogComponent = function DialogComponent(_ref) {
750
751
  var disabled = line === 0 || previousLineWasDecision();
751
752
  return disabled;
752
753
  }, [line, previousLineWasDecision]);
754
+ keyboardControl(disableBackButton || animationRunning ? null : manualBackLine, animationRunning ? null : manualNextLine);
753
755
 
754
756
  if (isDecision) {
755
757
  var decisionPayload = _objectSpread(_objectSpread({}, currentLineData.payload), {}, {
@@ -762,7 +764,8 @@ var DialogComponent = function DialogComponent(_ref) {
762
764
  onFinish: nextLine,
763
765
  emitEvent: emitEvent,
764
766
  pause: pause,
765
- soundActions: soundActions
767
+ soundActions: soundActions,
768
+ keyboardControl: keyboardControl
766
769
  });
767
770
 
768
771
  return /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.HtmlPro, {
@@ -28,6 +28,7 @@ var animations = {
28
28
  var mockProps = {
29
29
  emitEvent: _mocker.emitEvent,
30
30
  soundActions: _mocker.soundActions,
31
+ keyboardControl: _mocker.keyboardControl,
31
32
  autoPlay: false,
32
33
  zoomInActor: true,
33
34
  lines: [{
@@ -279,6 +280,7 @@ exports.mockProps = mockProps;
279
280
  var branchedMockProps = {
280
281
  emitEvent: _mocker.emitEvent,
281
282
  soundActions: _mocker.soundActions,
283
+ keyboardControl: _mocker.keyboardControl,
282
284
  autoPlay: false,
283
285
  lines: [{
284
286
  id: 'line1',
@@ -62,7 +62,8 @@ var DragItemPuzzleComponent = function DragItemPuzzleComponent(_ref) {
62
62
  consume = _ref.consume,
63
63
  disableExit = _ref.disableExit,
64
64
  emitEvent = _ref.emitEvent,
65
- soundActions = _ref.soundActions;
65
+ soundActions = _ref.soundActions,
66
+ keyboardControl = _ref.keyboardControl;
66
67
  var solution = info.solution;
67
68
  var areaRef = (0, _react.useRef)();
68
69
  var areaTextRef = (0, _react.useRef)();
@@ -413,7 +414,8 @@ var DragItemPuzzleComponent = function DragItemPuzzleComponent(_ref) {
413
414
  success: resolvedClass === 'success',
414
415
  translate: translate,
415
416
  playSound: playSound,
416
- functionOnClose: handleFeedbackFuncionOnClose
417
+ functionOnClose: handleFeedbackFuncionOnClose,
418
+ keyboardControl: keyboardControl
417
419
  }) : null);
418
420
  };
419
421
 
@@ -11,6 +11,7 @@ var _mocker = require("helpers/mocker");
11
11
  var mockProps = {
12
12
  emitEvent: _mocker.emitEvent,
13
13
  soundActions: _mocker.soundActions,
14
+ keyboardControl: _mocker.keyboardControl,
14
15
  disableExit: function disableExit() {},
15
16
  resolveObject: {
16
17
  uid: '123',
@@ -36,7 +36,8 @@ var FeedbackComponent = function FeedbackComponent(_ref) {
36
36
  shortText = _ref.shortText,
37
37
  hasTimeout = _ref.hasTimeout,
38
38
  delay = _ref.delay,
39
- timeExpired = _ref.timeExpired;
39
+ timeExpired = _ref.timeExpired,
40
+ keyboardControl = _ref.keyboardControl;
40
41
 
41
42
  var _useState = (0, _react.useState)(),
42
43
  _useState2 = _slicedToArray(_useState, 2),
@@ -92,6 +93,7 @@ var FeedbackComponent = function FeedbackComponent(_ref) {
92
93
  return 'icon-error-circle-black';
93
94
  };
94
95
 
96
+ keyboardControl(null, text && functionOnClose && explain || functionOnClose && shortText ? functionOnClose : null, text && functionOnClose && explain || functionOnClose && shortText ? functionOnClose : null);
95
97
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
96
98
  className: "feedback-layer ".concat(explain ? 'feedback-layer--withexplain' : '')
97
99
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -11,6 +11,7 @@ var _mocker = require("helpers/mocker");
11
11
  var mockProps = {
12
12
  functionOnClose: _mocker.functionOnClose,
13
13
  playSound: _mocker.soundActions[0],
14
+ keyboardControl: _mocker.keyboardControl,
14
15
  success: true,
15
16
  translate: _mocker.translate,
16
17
  text: '500A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits)asd asdf sdf A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits)asd asdf sdf A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits)asd asdf sdf A while back I needed to count thea sf as'
@@ -19,6 +20,7 @@ exports.mockProps = mockProps;
19
20
  var mockProps2 = {
20
21
  functionOnClose: _mocker.functionOnClose,
21
22
  playSound: _mocker.soundActions[0],
23
+ keyboardControl: _mocker.keyboardControl,
22
24
  translate: _mocker.translate,
23
25
  text: '500A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits)asd asdf sdf A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits)asd asdf sdf A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits)asd asdf sdf A while back I needed to count thea sf as'
24
26
  };
@@ -26,22 +28,26 @@ exports.mockProps2 = mockProps2;
26
28
  var mockProps3 = {
27
29
  success: true,
28
30
  playSound: _mocker.soundActions[0],
31
+ keyboardControl: _mocker.keyboardControl,
29
32
  translate: _mocker.translate
30
33
  };
31
34
  exports.mockProps3 = mockProps3;
32
35
  var mockProps4 = {
33
36
  playSound: _mocker.soundActions[0],
37
+ keyboardControl: _mocker.keyboardControl,
34
38
  translate: _mocker.translate
35
39
  };
36
40
  exports.mockProps4 = mockProps4;
37
41
  var mockProps5 = {
38
42
  translate: _mocker.translate,
39
- timeExpired: true
43
+ timeExpired: true,
44
+ keyboardControl: _mocker.keyboardControl
40
45
  };
41
46
  exports.mockProps5 = mockProps5;
42
47
  var mockProps6 = {
43
48
  translate: _mocker.translate,
44
49
  text: 'story with timer finish feedback',
45
- timeExpired: true
50
+ timeExpired: true,
51
+ keyboardControl: _mocker.keyboardControl
46
52
  };
47
53
  exports.mockProps6 = mockProps6;
@@ -66,7 +66,8 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
66
66
  emitOpenPopupCounterInfo = _ref.emitOpenPopupCounterInfo,
67
67
  resetValues = _ref.resetValues,
68
68
  setResetValues = _ref.setResetValues,
69
- pause = _ref.pause;
69
+ pause = _ref.pause,
70
+ keyboardControl = _ref.keyboardControl;
70
71
 
71
72
  var _soundActions = _slicedToArray(soundActions, 1),
72
73
  playSound = _soundActions[0];
@@ -213,7 +214,8 @@ var CurrentFramePuzzle = function CurrentFramePuzzle(_ref) {
213
214
  firstTryForFrame: firstTryForFrame,
214
215
  puzzlesAutoCompleted: puzzlesAutoCompleted,
215
216
  emitOpenPopupCounterInfo: emitOpenPopupCounterInfo,
216
- pause: pause
217
+ pause: pause,
218
+ keyboardControl: keyboardControl
217
219
  }));
218
220
  };
219
221