@gamelearn/arcade-components 2.35.1 → 2.37.0
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/cards-selector-puzzle-component/components/Board/index.js +4 -1
- package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +18 -3
- package/dist/components/comic-component/components/ComicComponent.js +4 -1
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +6 -3
- package/dist/components/dialog-component/components/DialogComponent.js +5 -3
- package/package.json +1 -1
|
@@ -26,7 +26,8 @@ var Board = function Board(_ref) {
|
|
|
26
26
|
soundActions = _ref.soundActions,
|
|
27
27
|
onFinish = _ref.onFinish,
|
|
28
28
|
handleSuccess = _ref.handleSuccess,
|
|
29
|
-
resolveWithAnyCard = _ref.resolveWithAnyCard
|
|
29
|
+
resolveWithAnyCard = _ref.resolveWithAnyCard,
|
|
30
|
+
selectCard = _ref.selectCard;
|
|
30
31
|
var _useState = (0, _react.useState)(Array(cards.length).fill(false)),
|
|
31
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
33
|
flipped = _useState2[0],
|
|
@@ -97,6 +98,7 @@ var Board = function Board(_ref) {
|
|
|
97
98
|
if (finished) return;
|
|
98
99
|
if (!feedbackIsShown) {
|
|
99
100
|
play('click-ui');
|
|
101
|
+
selectCard(cards[index]);
|
|
100
102
|
if (cards[index].correct && !isOrderBased) {
|
|
101
103
|
handleCorrect(index);
|
|
102
104
|
} else if (isOrderBased) {
|
|
@@ -145,6 +147,7 @@ Board.defaultProps = {
|
|
|
145
147
|
handleError: function handleError() {},
|
|
146
148
|
onFinish: function onFinish() {},
|
|
147
149
|
handleSuccess: function handleSuccess() {},
|
|
150
|
+
selectCard: function selectCard() {},
|
|
148
151
|
documentsDict: {},
|
|
149
152
|
cards: [],
|
|
150
153
|
currentOrder: 1,
|
package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js
CHANGED
|
@@ -66,6 +66,10 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
|
|
|
66
66
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
67
67
|
feedBackText = _useState16[0],
|
|
68
68
|
setFeedBackText = _useState16[1];
|
|
69
|
+
var _useState17 = (0, _react.useState)(),
|
|
70
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
71
|
+
cardSelected = _useState18[0],
|
|
72
|
+
selectCard = _useState18[1];
|
|
69
73
|
var _soundActions = _slicedToArray(soundActions, 1),
|
|
70
74
|
playSound = _soundActions[0];
|
|
71
75
|
var translate = function translate(id) {
|
|
@@ -104,10 +108,20 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
|
|
|
104
108
|
var specificRewards = (specificFeedbacks === null || specificFeedbacks === void 0 ? void 0 : (_specificFeedbacks$co = specificFeedbacks.correctFeedbacks) === null || _specificFeedbacks$co === void 0 ? void 0 : _specificFeedbacks$co.map(function (spReward) {
|
|
105
109
|
return spReward.rewards;
|
|
106
110
|
}).flat()) || [];
|
|
107
|
-
var rewardsData = []
|
|
111
|
+
var rewardsData = [];
|
|
108
112
|
playSound('score');
|
|
113
|
+
if (resolveWithAnyCard) {
|
|
114
|
+
rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(rewards), _toConsumableArray(specificRewards));
|
|
115
|
+
} else {
|
|
116
|
+
var _specificRewards$corr;
|
|
117
|
+
var cardFeedback = (specificRewards === null || specificRewards === void 0 ? void 0 : (_specificRewards$corr = specificRewards.correctFeedbacks) === null || _specificRewards$corr === void 0 ? void 0 : _specificRewards$corr.find(function (feedback) {
|
|
118
|
+
return cardSelected.id === feedback.id;
|
|
119
|
+
})) || {};
|
|
120
|
+
var cardReward = cardFeedback && cardFeedback.rewards ? cardFeedback.rewards : [];
|
|
121
|
+
rewardsData = [].concat(_toConsumableArray(accRewards), _toConsumableArray(rewards), _toConsumableArray(cardReward));
|
|
122
|
+
}
|
|
109
123
|
closeFeedbackAndShowPoints(rewardsData);
|
|
110
|
-
}, [accRewards, closeFeedbackAndShowPoints, emitEvent, info === null || info === void 0 ? void 0 : (_info$solution2 = info.solution) === null || _info$solution2 === void 0 ? void 0 : _info$solution2.right, playSound, specificFeedbacks === null || specificFeedbacks === void 0 ? void 0 : specificFeedbacks.correctFeedbacks]);
|
|
124
|
+
}, [accRewards, closeFeedbackAndShowPoints, emitEvent, info === null || info === void 0 ? void 0 : (_info$solution2 = info.solution) === null || _info$solution2 === void 0 ? void 0 : _info$solution2.right, playSound, specificFeedbacks === null || specificFeedbacks === void 0 ? void 0 : specificFeedbacks.correctFeedbacks, resolveWithAnyCard, cardSelected]);
|
|
111
125
|
var onFinish = function onFinish() {
|
|
112
126
|
setFinished(true);
|
|
113
127
|
if (info.solution.right.desc && !(specificFeedbacks !== null && specificFeedbacks !== void 0 && specificFeedbacks.specificCorrectFeedbacks)) {
|
|
@@ -251,7 +265,8 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
|
|
|
251
265
|
feedbackIsShown: feedbackIsShown,
|
|
252
266
|
resolvePuzzle: resolvePuzzle,
|
|
253
267
|
soundActions: soundActions,
|
|
254
|
-
handleSuccess: handleSuccessPick
|
|
268
|
+
handleSuccess: handleSuccessPick,
|
|
269
|
+
selectCard: selectCard
|
|
255
270
|
})), feedbackIsShown && /*#__PURE__*/_react.default.createElement(_feedbackComponent.default, {
|
|
256
271
|
success: feedbackResult || rightPick,
|
|
257
272
|
text: feedBackText,
|
|
@@ -27,6 +27,7 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
27
27
|
_ref$soundActions = _ref.soundActions,
|
|
28
28
|
soundActions = _ref$soundActions === void 0 ? [function () {}, function () {}] : _ref$soundActions,
|
|
29
29
|
autoPlay = _ref.autoPlay,
|
|
30
|
+
autoEnd = _ref.autoEnd,
|
|
30
31
|
pause = _ref.pause,
|
|
31
32
|
progress = _ref.progress,
|
|
32
33
|
keyboardControl = _ref.keyboardControl;
|
|
@@ -83,8 +84,10 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
83
84
|
slide: next
|
|
84
85
|
}
|
|
85
86
|
});
|
|
87
|
+
} else if (autoEnd && !pause) {
|
|
88
|
+
close();
|
|
86
89
|
}
|
|
87
|
-
}, [
|
|
90
|
+
}, [slideCount, slides.length, pause, autoEnd, emitEvent, close]);
|
|
88
91
|
var goToPreviousSlide = (0, _react.useCallback)(function () {
|
|
89
92
|
setStarted(false);
|
|
90
93
|
setAudioFailed(false);
|
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -46,6 +46,7 @@ var ConversationalProComponent = function ConversationalProComponent(_ref) {
|
|
|
46
46
|
soundActions = _ref.soundActions,
|
|
47
47
|
lodSettings = _ref.lodSettings,
|
|
48
48
|
autoPlay = _ref.autoPlay,
|
|
49
|
+
autoEnd = _ref.autoEnd,
|
|
49
50
|
progress = _ref.progress;
|
|
50
51
|
var defaultLine = (progress === null || progress === void 0 ? void 0 : progress.line) || 0;
|
|
51
52
|
var _useState = (0, _react.useState)(false),
|
|
@@ -342,6 +343,8 @@ var ConversationalProComponent = function ConversationalProComponent(_ref) {
|
|
|
342
343
|
line: next
|
|
343
344
|
}
|
|
344
345
|
});
|
|
346
|
+
} else if (autoEnd) {
|
|
347
|
+
finishConversation();
|
|
345
348
|
} else if (currentLineData.decision) {
|
|
346
349
|
finishConversation();
|
|
347
350
|
} else {
|
|
@@ -350,7 +353,7 @@ var ConversationalProComponent = function ConversationalProComponent(_ref) {
|
|
|
350
353
|
if (!isLast) {
|
|
351
354
|
setStarted(true);
|
|
352
355
|
}
|
|
353
|
-
}, [emitEvent, currentLine, currentLineData.decision, currentLineData.id, finishConversation, handleBranchDirection, handleDecisionBranch, isBranched, lines.length, edgesHistory]);
|
|
356
|
+
}, [autoEnd, emitEvent, currentLine, currentLineData.decision, currentLineData.id, finishConversation, handleBranchDirection, handleDecisionBranch, isBranched, lines.length, edgesHistory]);
|
|
354
357
|
var handleClickBack = function handleClickBack() {
|
|
355
358
|
setStarted(false);
|
|
356
359
|
setTTsStart(false);
|
|
@@ -440,14 +443,14 @@ var ConversationalProComponent = function ConversationalProComponent(_ref) {
|
|
|
440
443
|
(0, _react.useEffect)(function () {
|
|
441
444
|
if (autoplayCond && ((currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType) === 'none' || audioFailed)) {
|
|
442
445
|
// if it's not last node
|
|
443
|
-
if (!isEndNode()) {
|
|
446
|
+
if (!isEndNode() || isEndNode() && autoEnd) {
|
|
444
447
|
start(handleClickNext, autoPlayTime < minMs ? minMs : autoPlayTime);
|
|
445
448
|
}
|
|
446
449
|
}
|
|
447
450
|
return function () {
|
|
448
451
|
stop();
|
|
449
452
|
};
|
|
450
|
-
}, [currentMessage, start, stop, handleClickNext, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType, autoplayCond, audioFailed, lines, isEndNode, autoPlayTime]);
|
|
453
|
+
}, [currentMessage, start, stop, handleClickNext, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType, autoplayCond, audioFailed, autoEnd, lines, isEndNode, autoPlayTime]);
|
|
451
454
|
|
|
452
455
|
// Calculate start node
|
|
453
456
|
(0, _react.useEffect)(function () {
|
|
@@ -51,6 +51,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
51
51
|
soundActions = _ref.soundActions,
|
|
52
52
|
zoomInActor = _ref.zoomInActor,
|
|
53
53
|
autoPlay = _ref.autoPlay,
|
|
54
|
+
autoEnd = _ref.autoEnd,
|
|
54
55
|
pause = _ref.pause,
|
|
55
56
|
progress = _ref.progress;
|
|
56
57
|
var defaultLine = (progress === null || progress === void 0 ? void 0 : progress.line) || 0;
|
|
@@ -463,6 +464,8 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
463
464
|
line: next
|
|
464
465
|
}
|
|
465
466
|
});
|
|
467
|
+
} else if (autoEnd) {
|
|
468
|
+
finishConversation();
|
|
466
469
|
} else if (currentLineData.decision) {
|
|
467
470
|
finishConversation();
|
|
468
471
|
}
|
|
@@ -683,15 +686,14 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
683
686
|
if (autoPlayCond && currentMessage.show && ((currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType) === 'none' || audioFailed) && !pause) {
|
|
684
687
|
var _currentMessage$text2;
|
|
685
688
|
var time = characterMs * ((currentMessage === null || currentMessage === void 0 ? void 0 : (_currentMessage$text2 = currentMessage.text) === null || _currentMessage$text2 === void 0 ? void 0 : _currentMessage$text2.length) || 0);
|
|
686
|
-
|
|
687
|
-
if (!isEndNode()) {
|
|
689
|
+
if (!isEndNode() || isEndNode() && autoEnd) {
|
|
688
690
|
start(nextLine, time < minMs ? minMs : time);
|
|
689
691
|
}
|
|
690
692
|
}
|
|
691
693
|
return function () {
|
|
692
694
|
stop();
|
|
693
695
|
};
|
|
694
|
-
}, [currentMessage, nextLine, start, stop, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType, autoPlayCond, audio, voice, audioFailed]);
|
|
696
|
+
}, [currentMessage, nextLine, start, autoEnd, stop, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType, autoPlayCond, audio, voice, audioFailed]);
|
|
695
697
|
var disableBackButton = (0, _react.useMemo)(function () {
|
|
696
698
|
var disabled = line === 0 || previousLineWasDecision();
|
|
697
699
|
return disabled;
|