@gamelearn/arcade-components 0.20.5 → 0.20.7
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.
- package/dist/components/auto-evaluation-component/components/AutoEvaluation.js +10 -2
- package/dist/components/auto-evaluation-component/mocks/mockForStory.js +1 -0
- package/dist/components/cards-selector-puzzle-component/components/Board/index.js +7 -1
- package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +3 -2
- package/dist/components/cartel-component/components/CartelComponent.js +1 -0
- package/dist/components/comic-component/components/ComicComponent.js +6 -0
- package/dist/components/conversational-component/components/ConversationalComponent.js +6 -0
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +3 -0
- package/dist/components/cracker-puzzle-component/components/CrackerPuzzleComponent.js +1 -1
- package/dist/components/decision-component/components/DecisionBody.js +2 -2
- package/dist/components/decision-component/components/DecisionComponent.js +16 -0
- package/dist/components/decision-component/components/Feedback.js +3 -1
- package/dist/components/feedback-component/components/FeedbackComponent.js +1 -2
- package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +9 -1
- package/dist/components/hacker-puzzle-component/components/HackerPuzzleComponent.js +2 -1
- package/dist/components/hanged-puzzle-component/components/HangedPuzzleComponent.js +4 -1
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +7 -2
- package/dist/components/image-component/components/ImageComponent.js +20 -2
- package/dist/components/image-component/mocks/mockForStory.js +3 -0
- package/dist/components/inventory-item/components/InventoryItem.js +21 -2
- package/dist/components/lectures-component/components/LectureButtons.js +0 -9
- package/dist/components/lectures-component/components/LecturesComponent.js +9 -14
- package/dist/components/lectures-component/mocks/mockForStory.js +1 -0
- package/dist/components/login-puzzle-component/components/LoginPuzzleComponent.js +1 -0
- package/dist/components/notice-component/components/NoticeComponent.js +18 -11
- package/dist/components/notice-component/mocks/mockForStory.js +1 -0
- package/dist/components/pattern-component/components/PatternComponent.js +18 -1
- package/dist/components/pdf-component/components/PdfComponent.js +10 -2
- package/dist/components/pdf-component/components/PdfVisor.js +7 -1
- package/dist/components/pdf-component/mocks/mockForProps.js +1 -0
- package/dist/components/rewards-component/components/RewardsComponent.js +8 -1
- package/dist/components/rewards-component/mocks/mockForStory.js +5 -0
- package/dist/components/survey-component/components/SurveyComponent.js +8 -1
- package/dist/components/survey-component/mocks/mockForStory.js +2 -1
- package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +4 -1
- package/dist/components/terminal-puzzle-component/components/Visor/index.js +10 -4
- package/dist/components/test-component/components/Container.js +14 -3
- package/dist/components/test-component/components/TestComponent.js +2 -1
- package/dist/components/text-click-puzzle-component/components/TextClickPuzzleComponent.js +3 -2
- package/dist/components/url-component/components/UrlComponent.js +7 -1
- package/dist/components/video-component/components/VideoComponent.js +2 -0
- package/dist/components/video-visor/components/VideoControllers/ControlButtons.js +0 -6
- package/dist/components/video-visor/components/VideoControllers/FinishedVideoButtons.js +0 -6
- package/dist/components/video-visor/components/VideoControllers/PlayInitButton.js +0 -7
- package/dist/components/video-visor/components/VideoControllers/SkipButton.js +0 -8
- package/dist/components/video-visor/components/VideoVisor.js +23 -12
- package/dist/components/web-builder-puzzle-component/Popups/PopupColorComponent/index.js +6 -1
- package/dist/components/web-builder-puzzle-component/Popups/PopupImageComponent/index.js +6 -11
- package/dist/components/web-builder-puzzle-component/Popups/PopupTextComponent/index.js +6 -1
- package/dist/components/web-builder-puzzle-component/components/WebBuilderPuzzleComponent.js +3 -0
- package/dist/components/writer-puzzle-component/components/ElectionComponent.js +6 -12
- package/dist/components/writer-puzzle-component/components/FeedbackComponent.js +19 -22
- package/dist/components/writer-puzzle-component/components/FeedbackElement.js +0 -10
- package/dist/components/writer-puzzle-component/components/FinishedTextComponent.js +0 -6
- package/dist/components/writer-puzzle-component/components/FixedComponent.js +0 -11
- package/dist/components/writer-puzzle-component/components/Rewards.js +0 -14
- package/dist/components/writer-puzzle-component/components/SingleElection.js +6 -14
- package/dist/components/writer-puzzle-component/components/WriterPuzzleComponent.js +1 -0
- package/package.json +1 -1
|
@@ -37,7 +37,8 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
37
37
|
var description = _ref.description,
|
|
38
38
|
questions = _ref.questions,
|
|
39
39
|
type = _ref.type,
|
|
40
|
-
emitEvent = _ref.emitEvent
|
|
40
|
+
emitEvent = _ref.emitEvent,
|
|
41
|
+
soundActions = _ref.soundActions;
|
|
41
42
|
|
|
42
43
|
var _useState = (0, _react.useState)('start'),
|
|
43
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -64,6 +65,9 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
64
65
|
type: type
|
|
65
66
|
});
|
|
66
67
|
|
|
68
|
+
var _soundActions = _slicedToArray(soundActions, 1),
|
|
69
|
+
play = _soundActions[0];
|
|
70
|
+
|
|
67
71
|
var translate = function translate(id) {
|
|
68
72
|
return emitEvent({
|
|
69
73
|
type: 'translate',
|
|
@@ -72,6 +76,7 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
72
76
|
};
|
|
73
77
|
|
|
74
78
|
var close = function close() {
|
|
79
|
+
play('click-ui');
|
|
75
80
|
emitEvent({
|
|
76
81
|
type: 'saveSurveyPrePos',
|
|
77
82
|
payload: surveyData.current
|
|
@@ -85,6 +90,7 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
85
90
|
}, [questions, phase]);
|
|
86
91
|
|
|
87
92
|
var handleNextQuestion = function handleNextQuestion() {
|
|
93
|
+
play('click-ui');
|
|
88
94
|
surveyData.current.questions.push({
|
|
89
95
|
id: questions[currentQuestion].id,
|
|
90
96
|
answer: optionSelected
|
|
@@ -103,7 +109,8 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
103
109
|
}, phase === 'start' && /*#__PURE__*/_react.default.createElement(_StartScreen.default, {
|
|
104
110
|
description: description,
|
|
105
111
|
onNext: function onNext() {
|
|
106
|
-
|
|
112
|
+
setPhase('questions');
|
|
113
|
+
play('click-ui');
|
|
107
114
|
},
|
|
108
115
|
translate: translate
|
|
109
116
|
}), phase === 'questions' && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -135,6 +142,7 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
135
142
|
className: "gat--btn gat--btn__primary auto-evaluation__button not-transition",
|
|
136
143
|
onClick: function onClick() {
|
|
137
144
|
setPhase('end');
|
|
145
|
+
play('click-ui');
|
|
138
146
|
}
|
|
139
147
|
}, /*#__PURE__*/_react.default.createElement("span", null, translate('auto-evaluation.end'))) : /*#__PURE__*/_react.default.createElement("button", {
|
|
140
148
|
onClick: handleNextQuestion,
|
|
@@ -18,6 +18,7 @@ var emitEvent = function emitEvent(_ref) {
|
|
|
18
18
|
|
|
19
19
|
var mockProps = {
|
|
20
20
|
emitEvent: emitEvent,
|
|
21
|
+
soundActions: [],
|
|
21
22
|
slug: 'auto-pre-component',
|
|
22
23
|
description: '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). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet. Character Count Online is a free online character',
|
|
23
24
|
questions: [{
|
|
@@ -48,7 +48,8 @@ var Board = function Board(_ref) {
|
|
|
48
48
|
handleError = _ref.handleError,
|
|
49
49
|
endPuzzle = _ref.endPuzzle,
|
|
50
50
|
feedbackIsShown = _ref.feedbackIsShown,
|
|
51
|
-
resolvePuzzle = _ref.resolvePuzzle
|
|
51
|
+
resolvePuzzle = _ref.resolvePuzzle,
|
|
52
|
+
soundActions = _ref.soundActions;
|
|
52
53
|
|
|
53
54
|
var _useState = (0, _react.useState)(_toConsumableArray(Array(cards.length)).fill(false)),
|
|
54
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -65,6 +66,9 @@ var Board = function Board(_ref) {
|
|
|
65
66
|
correctCards = _useState6[0],
|
|
66
67
|
setCorrectCards = _useState6[1];
|
|
67
68
|
|
|
69
|
+
var _soundActions = _slicedToArray(soundActions, 1),
|
|
70
|
+
play = _soundActions[0];
|
|
71
|
+
|
|
68
72
|
var numberOfCorrectCards = cards.filter(function (card) {
|
|
69
73
|
return card.correct === true;
|
|
70
74
|
}).length;
|
|
@@ -125,6 +129,8 @@ var Board = function Board(_ref) {
|
|
|
125
129
|
|
|
126
130
|
var _handleClick = function handleClick(index) {
|
|
127
131
|
if (!feedbackIsShown) {
|
|
132
|
+
play('click-ui');
|
|
133
|
+
|
|
128
134
|
if (cards[index].correct && !isOrderBased) {
|
|
129
135
|
handleCorrect(index);
|
|
130
136
|
} else if (isOrderBased) {
|
package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js
CHANGED
|
@@ -175,7 +175,7 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
|
|
|
175
175
|
}
|
|
176
176
|
}, [disableExit, finished]);
|
|
177
177
|
(0, _react.useEffect)(function () {
|
|
178
|
-
setResolveAction(function (
|
|
178
|
+
setResolveAction(function () {
|
|
179
179
|
emitEvent({
|
|
180
180
|
type: 'hidePuzzleButtons',
|
|
181
181
|
payload: true
|
|
@@ -203,7 +203,8 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
|
|
|
203
203
|
return _handleError();
|
|
204
204
|
},
|
|
205
205
|
feedbackIsShown: feedbackIsShown,
|
|
206
|
-
resolvePuzzle: resolvePuzzle
|
|
206
|
+
resolvePuzzle: resolvePuzzle,
|
|
207
|
+
soundActions: soundActions
|
|
207
208
|
})), feedbackIsShown && /*#__PURE__*/_react.default.createElement(_feedbackComponent.default, {
|
|
208
209
|
playSound: playSound,
|
|
209
210
|
success: feedbackResult,
|
|
@@ -45,18 +45,23 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
45
45
|
slideTransition = _useState4[0],
|
|
46
46
|
setTransition = _useState4[1];
|
|
47
47
|
|
|
48
|
+
var _soundActions = _slicedToArray(soundActions, 1),
|
|
49
|
+
play = _soundActions[0];
|
|
50
|
+
|
|
48
51
|
var classControls = slideCount === 0 ? 'comic--controls single' : 'comic--controls';
|
|
49
52
|
|
|
50
53
|
var close = function close() {
|
|
51
54
|
emitEvent({
|
|
52
55
|
type: 'success'
|
|
53
56
|
});
|
|
57
|
+
play('click-ui');
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
var goToNextSlide = function goToNextSlide() {
|
|
57
61
|
if (slideCount + 1 < slides.length) {
|
|
58
62
|
setTransition('slide-animation');
|
|
59
63
|
setCount(slideCount + 1);
|
|
64
|
+
play('click-ui');
|
|
60
65
|
}
|
|
61
66
|
};
|
|
62
67
|
|
|
@@ -64,6 +69,7 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
64
69
|
if (slideCount - 1 >= 0) {
|
|
65
70
|
setTransition('slide-animation');
|
|
66
71
|
setCount(slideCount - 1);
|
|
72
|
+
play('click-ui');
|
|
67
73
|
}
|
|
68
74
|
};
|
|
69
75
|
|
|
@@ -41,6 +41,7 @@ var ConversationalComponent = function ConversationalComponent(_ref) {
|
|
|
41
41
|
var _background$img;
|
|
42
42
|
|
|
43
43
|
var emitEvent = _ref.emitEvent,
|
|
44
|
+
soundActions = _ref.soundActions,
|
|
44
45
|
messages = _ref.messages,
|
|
45
46
|
characters = _ref.characters,
|
|
46
47
|
alias = _ref.alias,
|
|
@@ -52,6 +53,9 @@ var ConversationalComponent = function ConversationalComponent(_ref) {
|
|
|
52
53
|
messageIndex = _useState2[0],
|
|
53
54
|
setMessageIndex = _useState2[1];
|
|
54
55
|
|
|
56
|
+
var _soundActions = _slicedToArray(soundActions, 1),
|
|
57
|
+
play = _soundActions[0];
|
|
58
|
+
|
|
55
59
|
var backgroundImage = (background === null || background === void 0 ? void 0 : (_background$img = background.img) === null || _background$img === void 0 ? void 0 : _background$img.url) || null;
|
|
56
60
|
var currentMessage = messages[messageIndex];
|
|
57
61
|
var parsedCharacters = characters.map(function (c, index) {
|
|
@@ -63,6 +67,7 @@ var ConversationalComponent = function ConversationalComponent(_ref) {
|
|
|
63
67
|
|
|
64
68
|
var handleClickNext = function handleClickNext() {
|
|
65
69
|
var max = messages.length - 1;
|
|
70
|
+
play('click-ui');
|
|
66
71
|
|
|
67
72
|
if (messageIndex + 1 <= max) {
|
|
68
73
|
setMessageIndex(messageIndex + 1);
|
|
@@ -76,6 +81,7 @@ var ConversationalComponent = function ConversationalComponent(_ref) {
|
|
|
76
81
|
var handleClickBack = function handleClickBack() {
|
|
77
82
|
if (messageIndex > 0) {
|
|
78
83
|
setMessageIndex(messageIndex - 1);
|
|
84
|
+
play('click-ui');
|
|
79
85
|
}
|
|
80
86
|
};
|
|
81
87
|
|
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -136,6 +136,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
var handleClickNext = function handleClickNext() {
|
|
139
|
+
playSound('click-ui');
|
|
139
140
|
var line = currentLine;
|
|
140
141
|
var maxLine = lines.length - 1;
|
|
141
142
|
|
|
@@ -149,6 +150,8 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
149
150
|
};
|
|
150
151
|
|
|
151
152
|
var handleClickBack = function handleClickBack() {
|
|
153
|
+
playSound('click-ui');
|
|
154
|
+
|
|
152
155
|
if (currentLine > 0) {
|
|
153
156
|
setCurrentLine(currentLine - 1);
|
|
154
157
|
}
|
|
@@ -88,13 +88,13 @@ var DecisionBody = function DecisionBody(_ref) {
|
|
|
88
88
|
type: "button",
|
|
89
89
|
className: "gat--btn gat--btn__secondary",
|
|
90
90
|
onClick: onExit
|
|
91
|
-
}, translate(
|
|
91
|
+
}, translate('webbuilder.cancel')) : null, /*#__PURE__*/_react.default.createElement("button", {
|
|
92
92
|
type: "button",
|
|
93
93
|
className: "gat--btn gat--btn__primary ".concat(selectedChoice.id !== undefined ? '' : 'disabled'),
|
|
94
94
|
onClick: function onClick() {
|
|
95
95
|
return canNext ? onNext(selectedChoice) : onBack();
|
|
96
96
|
}
|
|
97
|
-
}, canNext || selectedChoice.id === undefined ? translate(
|
|
97
|
+
}, canNext || selectedChoice.id === undefined ? translate('screens.continue') : translate('tests.retry'))));
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
var ComplexDecision = function ComplexDecision() {
|
|
@@ -114,21 +114,27 @@ var DecisionComponent = function DecisionComponent(_ref) {
|
|
|
114
114
|
selectedView: selectedView,
|
|
115
115
|
emitEvent: emitEvent,
|
|
116
116
|
inherited: inherited,
|
|
117
|
+
soundActions: soundActions,
|
|
117
118
|
showingResults: selectedView === 'results',
|
|
118
119
|
currentSelectedChoice: resultChoice,
|
|
119
120
|
hasRewards: resultChoice.rewards || [],
|
|
120
121
|
failed: failed,
|
|
121
122
|
changeOption: function changeOption(option) {
|
|
123
|
+
playSound('click-ui');
|
|
122
124
|
setResultChoice(option);
|
|
123
125
|
selectView('options');
|
|
124
126
|
},
|
|
125
127
|
onBack: function onBack() {
|
|
128
|
+
playSound('click-ui');
|
|
129
|
+
|
|
126
130
|
if (failed) {
|
|
127
131
|
setResultChoice({});
|
|
128
132
|
selectView('options');
|
|
129
133
|
}
|
|
130
134
|
},
|
|
131
135
|
onNext: function onNext(choice) {
|
|
136
|
+
playSound('click-ui');
|
|
137
|
+
|
|
132
138
|
if (!failed && selectedView === 'results') {
|
|
133
139
|
emitEvent({
|
|
134
140
|
type: 'addPoints',
|
|
@@ -143,6 +149,13 @@ var DecisionComponent = function DecisionComponent(_ref) {
|
|
|
143
149
|
}
|
|
144
150
|
} else if (Object.keys(choice).length > 0) {
|
|
145
151
|
var currentRewards = [].concat(_toConsumableArray(rewards), _toConsumableArray(choice.rewards));
|
|
152
|
+
|
|
153
|
+
if (choice.right) {
|
|
154
|
+
playSound('score');
|
|
155
|
+
} else {
|
|
156
|
+
playSound('fail');
|
|
157
|
+
}
|
|
158
|
+
|
|
146
159
|
setResultChoice(choice);
|
|
147
160
|
addReward(currentRewards);
|
|
148
161
|
playCurrentAudio(choice);
|
|
@@ -150,6 +163,7 @@ var DecisionComponent = function DecisionComponent(_ref) {
|
|
|
150
163
|
}
|
|
151
164
|
},
|
|
152
165
|
onExit: function onExit() {
|
|
166
|
+
playSound('click-ui');
|
|
153
167
|
emitEvent({
|
|
154
168
|
type: 'success'
|
|
155
169
|
});
|
|
@@ -196,12 +210,14 @@ var DecisionComponent = function DecisionComponent(_ref) {
|
|
|
196
210
|
var Body = function Body() {
|
|
197
211
|
return inherited ? /*#__PURE__*/_react.default.createElement(CharactersWrapper, null, selectedView === 'results' ? /*#__PURE__*/_react.default.createElement(_Feedback.default, {
|
|
198
212
|
question: question,
|
|
213
|
+
soundActions: soundActions,
|
|
199
214
|
inherited: inherited,
|
|
200
215
|
choice: resultChoice,
|
|
201
216
|
rewards: resultChoice.rewards || [],
|
|
202
217
|
emitEvent: emitEvent
|
|
203
218
|
}) : null) : /*#__PURE__*/_react.default.createElement(PopupWrapper, null, /*#__PURE__*/_react.default.createElement(_DecisionBody.default, bodyProps, /*#__PURE__*/_react.default.createElement(_Feedback.default, {
|
|
204
219
|
question: question,
|
|
220
|
+
soundActions: soundActions,
|
|
205
221
|
inherited: inherited,
|
|
206
222
|
choice: resultChoice,
|
|
207
223
|
rewards: resultChoice.rewards || [],
|
|
@@ -15,7 +15,8 @@ var FeedBack = function FeedBack(_ref) {
|
|
|
15
15
|
var choice = _ref.choice,
|
|
16
16
|
inherited = _ref.inherited,
|
|
17
17
|
rewards = _ref.rewards,
|
|
18
|
-
emitEvent = _ref.emitEvent
|
|
18
|
+
emitEvent = _ref.emitEvent,
|
|
19
|
+
soundActions = _ref.soundActions;
|
|
19
20
|
|
|
20
21
|
var Wrapper = function Wrapper(_ref2) {
|
|
21
22
|
var children = _ref2.children;
|
|
@@ -39,6 +40,7 @@ var FeedBack = function FeedBack(_ref) {
|
|
|
39
40
|
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
40
41
|
className: "icon-error-circle-black color--error"
|
|
41
42
|
}), /*#__PURE__*/_react.default.createElement("p", null, choice.feedback))) : null, !noRewards ? /*#__PURE__*/_react.default.createElement(_RewardsComponent.default, {
|
|
43
|
+
soundActions: soundActions,
|
|
42
44
|
rewards: choice.right ? rewards : choice.rewards,
|
|
43
45
|
emitEvent: emitEvent
|
|
44
46
|
}) : null);
|
|
@@ -35,8 +35,7 @@ var FeedbackComponent = function FeedbackComponent(_ref) {
|
|
|
35
35
|
translate = _ref.translate,
|
|
36
36
|
shortText = _ref.shortText,
|
|
37
37
|
hasTimeout = _ref.hasTimeout,
|
|
38
|
-
delay = _ref.delay
|
|
39
|
-
simpleClose = _ref.simpleClose;
|
|
38
|
+
delay = _ref.delay;
|
|
40
39
|
|
|
41
40
|
var _useState = (0, _react.useState)(),
|
|
42
41
|
_useState2 = _slicedToArray(_useState, 2),
|
package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js
CHANGED
|
@@ -69,6 +69,10 @@ var FrameImageClickComponent = function FrameImageClickComponent(_ref) {
|
|
|
69
69
|
|
|
70
70
|
var puzzlesCompiledRef = (0, _react.useRef)(0);
|
|
71
71
|
var hideTooltipRef = (0, _react.useRef)(false);
|
|
72
|
+
|
|
73
|
+
var _soundActions = _slicedToArray(soundActions, 1),
|
|
74
|
+
playSound = _soundActions[0];
|
|
75
|
+
|
|
72
76
|
var totalCorrects = list.reduce(function (acc, current) {
|
|
73
77
|
return acc + current.areas.length;
|
|
74
78
|
}, 0);
|
|
@@ -92,17 +96,20 @@ var FrameImageClickComponent = function FrameImageClickComponent(_ref) {
|
|
|
92
96
|
|
|
93
97
|
var handleBack = function handleBack() {
|
|
94
98
|
if (index > 0) {
|
|
99
|
+
playSound('click-ui');
|
|
95
100
|
setIndex(index - 1);
|
|
96
101
|
}
|
|
97
102
|
};
|
|
98
103
|
|
|
99
104
|
var handleForw = function handleForw() {
|
|
100
105
|
if (index !== list.length - 1) {
|
|
106
|
+
playSound('click-ui');
|
|
101
107
|
setIndex(index + 1);
|
|
102
108
|
}
|
|
103
109
|
};
|
|
104
110
|
|
|
105
111
|
var handleResolve = (0, _react.useCallback)(function () {
|
|
112
|
+
playSound('score');
|
|
106
113
|
emitEvent({
|
|
107
114
|
type: 'hidePuzzleButtons',
|
|
108
115
|
payload: false
|
|
@@ -115,7 +122,7 @@ var FrameImageClickComponent = function FrameImageClickComponent(_ref) {
|
|
|
115
122
|
rewards: accRewards.current
|
|
116
123
|
}
|
|
117
124
|
});
|
|
118
|
-
}, [accRewards, emitEvent, puzzleId]);
|
|
125
|
+
}, [accRewards, emitEvent, puzzleId, playSound]);
|
|
119
126
|
|
|
120
127
|
var translateFromParent = function translateFromParent(id) {
|
|
121
128
|
return emitEvent({
|
|
@@ -165,6 +172,7 @@ var FrameImageClickComponent = function FrameImageClickComponent(_ref) {
|
|
|
165
172
|
canPlay: index < list.length - 1,
|
|
166
173
|
emitPlaying: handlePlaying,
|
|
167
174
|
onClick: function onClick() {
|
|
175
|
+
playSound('click-ui');
|
|
168
176
|
hideTooltipRef.current = true;
|
|
169
177
|
}
|
|
170
178
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -187,6 +187,7 @@ var HackerPuzzleComponent = function HackerPuzzleComponent(_ref) {
|
|
|
187
187
|
}, [finished]);
|
|
188
188
|
(0, _react.useEffect)(function () {
|
|
189
189
|
setResolveAction(function (resolve) {
|
|
190
|
+
playSound('score');
|
|
190
191
|
setFinished(true);
|
|
191
192
|
setTimeout(function () {
|
|
192
193
|
resolve();
|
|
@@ -214,7 +215,7 @@ var HackerPuzzleComponent = function HackerPuzzleComponent(_ref) {
|
|
|
214
215
|
|
|
215
216
|
if (currentTextEnd === letters.length) {
|
|
216
217
|
if (currentLine + 1 >= lines.length) {
|
|
217
|
-
playSound('
|
|
218
|
+
playSound('score');
|
|
218
219
|
setFinished(true);
|
|
219
220
|
} else {
|
|
220
221
|
setCurrentLine(currentLine + 1);
|
|
@@ -419,7 +419,10 @@ var HangedPuzzleComponent = function HangedPuzzleComponent(_ref4) {
|
|
|
419
419
|
key: index,
|
|
420
420
|
"data-testid": "key-".concat(letter.char),
|
|
421
421
|
onClick: function onClick() {
|
|
422
|
-
|
|
422
|
+
if (!letter.deleted && !resolvedClass && !disabled) {
|
|
423
|
+
addCharacter(letter.char, index);
|
|
424
|
+
playSound('click-ui');
|
|
425
|
+
}
|
|
423
426
|
},
|
|
424
427
|
className: "puzzle--hanged__keyboard--item ".concat(letter.deleted || disabled ? 'disabled' : '')
|
|
425
428
|
}, letter.char);
|
package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js
CHANGED
|
@@ -145,6 +145,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
145
145
|
var handleFinish = (0, _react.useCallback)(function () {
|
|
146
146
|
var rewards = solution.right.rewards;
|
|
147
147
|
var fullRewards = [].concat(_toConsumableArray(accRewards), _toConsumableArray(rewards));
|
|
148
|
+
playSound('score');
|
|
148
149
|
|
|
149
150
|
if (emitFinish) {
|
|
150
151
|
emitFinish(fullRewards);
|
|
@@ -154,7 +155,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
154
155
|
payload: fullRewards
|
|
155
156
|
});
|
|
156
157
|
}
|
|
157
|
-
}, [accRewards, emitEvent, emitFinish, solution.right]);
|
|
158
|
+
}, [accRewards, emitEvent, emitFinish, solution.right, playSound]);
|
|
158
159
|
(0, _react.useEffect)(function () {
|
|
159
160
|
if (completed) {
|
|
160
161
|
disableExit(true);
|
|
@@ -196,6 +197,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
196
197
|
(0, _react.useEffect)(function () {
|
|
197
198
|
//autoResolve
|
|
198
199
|
setResolveAction(function (resolve) {
|
|
200
|
+
playSound('score');
|
|
199
201
|
setCompleted(true);
|
|
200
202
|
setDisableClick(true);
|
|
201
203
|
setFinished(true);
|
|
@@ -203,7 +205,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
203
205
|
emitResolve ? emitResolve(resolve) : resolve();
|
|
204
206
|
}, 4000);
|
|
205
207
|
});
|
|
206
|
-
}, [setResolveAction, emitResolve]);
|
|
208
|
+
}, [setResolveAction, emitResolve, playSound]);
|
|
207
209
|
(0, _react.useEffect)(function () {
|
|
208
210
|
if (finished) {
|
|
209
211
|
disableExit(true);
|
|
@@ -226,6 +228,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
226
228
|
|
|
227
229
|
setShowWrongFeedback(true);
|
|
228
230
|
setResolveClass('wrong');
|
|
231
|
+
playSound('fail');
|
|
229
232
|
|
|
230
233
|
if (!feedback) {
|
|
231
234
|
setTimeout(function () {
|
|
@@ -250,6 +253,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
250
253
|
handleFinish();
|
|
251
254
|
}
|
|
252
255
|
|
|
256
|
+
playSound('click-ui');
|
|
253
257
|
emitEvent({
|
|
254
258
|
type: 'hidePuzzleButtons',
|
|
255
259
|
payload: false
|
|
@@ -263,6 +267,7 @@ var ImageClickWrapperComponent = function ImageClickWrapperComponent(props) {
|
|
|
263
267
|
return zone.index === area.index;
|
|
264
268
|
}) && !defaultCompleted && !showWrongFeedback && !disableClick) {
|
|
265
269
|
var updatedClickedZones = [].concat(_toConsumableArray(clickedZones), [area]);
|
|
270
|
+
playSound('click-ui');
|
|
266
271
|
|
|
267
272
|
if (hasClickOrder && area.index === clickedZones.length || !hasClickOrder) {
|
|
268
273
|
setClickedZones(updatedClickedZones);
|
|
@@ -13,6 +13,18 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
|
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
23
|
+
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
+
|
|
16
28
|
var ImageComponent = function ImageComponent(_ref) {
|
|
17
29
|
var emitEvent = _ref.emitEvent,
|
|
18
30
|
img = _ref.img,
|
|
@@ -20,9 +32,15 @@ var ImageComponent = function ImageComponent(_ref) {
|
|
|
20
32
|
documentType = _ref.documentType,
|
|
21
33
|
visible = _ref.visible,
|
|
22
34
|
viewed = _ref.viewed,
|
|
23
|
-
imgId_labelId = _ref.imgId_labelId
|
|
35
|
+
imgId_labelId = _ref.imgId_labelId,
|
|
36
|
+
soundActions = _ref.soundActions;
|
|
24
37
|
var imgUrl = img.url;
|
|
38
|
+
|
|
39
|
+
var _soundActions = _slicedToArray(soundActions, 1),
|
|
40
|
+
playSound = _soundActions[0];
|
|
41
|
+
|
|
25
42
|
var close = (0, _react.useCallback)(function () {
|
|
43
|
+
playSound('click-ui');
|
|
26
44
|
var item = {
|
|
27
45
|
imgId: imgId_labelId,
|
|
28
46
|
name: imgName,
|
|
@@ -34,7 +52,7 @@ var ImageComponent = function ImageComponent(_ref) {
|
|
|
34
52
|
type: 'finishMedia',
|
|
35
53
|
payload: item
|
|
36
54
|
});
|
|
37
|
-
}, [imgId_labelId, imgName,
|
|
55
|
+
}, [playSound, imgId_labelId, imgName, documentType, emitEvent]);
|
|
38
56
|
(0, _react.useEffect)(function () {
|
|
39
57
|
if (!visible) {
|
|
40
58
|
close();
|
|
@@ -16,6 +16,7 @@ var emitEvent = function emitEvent(_ref) {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
var mockProps = {
|
|
19
|
+
soundActions: [],
|
|
19
20
|
emitEvent: emitEvent,
|
|
20
21
|
img: {
|
|
21
22
|
imgId: 'alfalfa',
|
|
@@ -29,6 +30,7 @@ var mockProps = {
|
|
|
29
30
|
};
|
|
30
31
|
exports.mockProps = mockProps;
|
|
31
32
|
var mockWithNotVisible = {
|
|
33
|
+
soundActions: [],
|
|
32
34
|
emitEvent: emitEvent,
|
|
33
35
|
img: {
|
|
34
36
|
imgId: 'alfalfa2',
|
|
@@ -42,6 +44,7 @@ var mockWithNotVisible = {
|
|
|
42
44
|
};
|
|
43
45
|
exports.mockWithNotVisible = mockWithNotVisible;
|
|
44
46
|
var mockWithImageNotViewed = {
|
|
47
|
+
soundActions: [],
|
|
45
48
|
emitEvent: emitEvent,
|
|
46
49
|
img: {
|
|
47
50
|
imgId: 'alfalfa2',
|
|
@@ -27,14 +27,30 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
29
|
|
|
30
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
31
|
+
|
|
32
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
33
|
+
|
|
34
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
35
|
+
|
|
36
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37
|
+
|
|
38
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
39
|
+
|
|
40
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
|
+
|
|
30
42
|
var InventoryItem = function InventoryItem(_ref) {
|
|
31
43
|
var name = _ref.name,
|
|
32
44
|
description = _ref.description,
|
|
33
45
|
element = _ref.element,
|
|
34
46
|
onFinish = _ref.onFinish,
|
|
35
|
-
lodSettings = _ref.lodSettings
|
|
47
|
+
lodSettings = _ref.lodSettings,
|
|
48
|
+
soundActions = _ref.soundActions;
|
|
36
49
|
var orbit = (0, _react.useRef)();
|
|
37
50
|
|
|
51
|
+
var _soundActions = _slicedToArray(soundActions, 1),
|
|
52
|
+
playSound = _soundActions[0];
|
|
53
|
+
|
|
38
54
|
if (!element) {
|
|
39
55
|
onFinish();
|
|
40
56
|
return null;
|
|
@@ -63,7 +79,10 @@ var InventoryItem = function InventoryItem(_ref) {
|
|
|
63
79
|
className: "inventory--layer__info--popup fadeIn--animation"
|
|
64
80
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
81
|
className: "inventory--info__close",
|
|
66
|
-
onClick:
|
|
82
|
+
onClick: function onClick() {
|
|
83
|
+
playSound('click-ui');
|
|
84
|
+
onFinish();
|
|
85
|
+
}
|
|
67
86
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
68
87
|
className: "icon-close"
|
|
69
88
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
11
|
|
|
14
12
|
var LectureButtons = function LectureButtons(_ref) {
|
|
@@ -39,12 +37,5 @@ LectureButtons.defaultProps = {
|
|
|
39
37
|
seconds: 0,
|
|
40
38
|
btnText: 'continue'
|
|
41
39
|
};
|
|
42
|
-
LectureButtons.propTypes = {
|
|
43
|
-
goToLecture: _propTypes.default.bool,
|
|
44
|
-
close: _propTypes.default.func,
|
|
45
|
-
minutes: _propTypes.default.number,
|
|
46
|
-
seconds: _propTypes.default.number,
|
|
47
|
-
btnText: _propTypes.default.string
|
|
48
|
-
};
|
|
49
40
|
var _default = LectureButtons;
|
|
50
41
|
exports.default = _default;
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _LectureButtons = _interopRequireDefault(require("./LectureButtons"));
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -43,7 +41,8 @@ var LecturesComponent = function LecturesComponent(_ref) {
|
|
|
43
41
|
visible = _ref.visible,
|
|
44
42
|
documentType = _ref.documentType,
|
|
45
43
|
viewed = _ref.viewed,
|
|
46
|
-
btnText = _ref.btnText
|
|
44
|
+
btnText = _ref.btnText,
|
|
45
|
+
soundActions = _ref.soundActions;
|
|
47
46
|
|
|
48
47
|
var _useState = (0, _react.useState)(),
|
|
49
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -63,7 +62,13 @@ var LecturesComponent = function LecturesComponent(_ref) {
|
|
|
63
62
|
var currentLecture = text;
|
|
64
63
|
var limit = Math.trunc(currentLecture.split(' ').length * READING_TIME);
|
|
65
64
|
var goToLecture = !required || required && time >= limit || required && !visible;
|
|
65
|
+
|
|
66
|
+
var _soundActions = _slicedToArray(soundActions, 1),
|
|
67
|
+
playSound = _soundActions[0];
|
|
68
|
+
|
|
66
69
|
var close = (0, _react.useCallback)(function () {
|
|
70
|
+
playSound('click-ui');
|
|
71
|
+
|
|
67
72
|
if (goToLecture) {
|
|
68
73
|
emitEvent({
|
|
69
74
|
type: 'finishMedia',
|
|
@@ -75,7 +80,7 @@ var LecturesComponent = function LecturesComponent(_ref) {
|
|
|
75
80
|
}
|
|
76
81
|
});
|
|
77
82
|
}
|
|
78
|
-
}, [documentType, emitEvent, goToLecture, name_labelId, text_labelId]);
|
|
83
|
+
}, [documentType, emitEvent, goToLecture, name_labelId, text_labelId, playSound]);
|
|
79
84
|
(0, _react.useEffect)(function () {
|
|
80
85
|
if (!visible && !saved) {
|
|
81
86
|
close();
|
|
@@ -135,15 +140,5 @@ LecturesComponent.defaultProps = {
|
|
|
135
140
|
context: {},
|
|
136
141
|
btnText: 'continue'
|
|
137
142
|
};
|
|
138
|
-
LecturesComponent.propTypes = {
|
|
139
|
-
emitEvent: _propTypes.default.func,
|
|
140
|
-
name: _propTypes.default.string,
|
|
141
|
-
text: _propTypes.default.string,
|
|
142
|
-
documentType: _propTypes.default.string,
|
|
143
|
-
visible: _propTypes.default.bool,
|
|
144
|
-
required: _propTypes.default.bool,
|
|
145
|
-
viewed: _propTypes.default.bool,
|
|
146
|
-
btnText: _propTypes.default.string
|
|
147
|
-
};
|
|
148
143
|
var _default = LecturesComponent;
|
|
149
144
|
exports.default = _default;
|