@gamelearn/arcade-components 1.22.10-hotfix-1 → 1.22.10
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/comic-component/components/ComicComponent.js +4 -1
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +5 -2
- package/dist/components/dialog-component/components/DialogComponent.js +0 -3
- package/dist/helpers/useEkho.js +10 -7
- package/package.json +1 -1
|
@@ -120,7 +120,7 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
120
120
|
goToPreviousSlide();
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
(0, _useEkho.default)({
|
|
123
|
+
var stopEkho = (0, _useEkho.default)({
|
|
124
124
|
audioType: slides === null || slides === void 0 ? void 0 : (_slides$slideCount = slides[slideCount]) === null || _slides$slideCount === void 0 ? void 0 : _slides$slideCount.audioType,
|
|
125
125
|
voice: slides === null || slides === void 0 ? void 0 : (_slides$slideCount2 = slides[slideCount]) === null || _slides$slideCount2 === void 0 ? void 0 : _slides$slideCount2.voice,
|
|
126
126
|
text: slides === null || slides === void 0 ? void 0 : (_slides$slideCount3 = slides[slideCount]) === null || _slides$slideCount3 === void 0 ? void 0 : (_slides$slideCount3$v = _slides$slideCount3.vignettes[0].textData) === null || _slides$slideCount3$v === void 0 ? void 0 : _slides$slideCount3$v.text,
|
|
@@ -137,6 +137,9 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
|
+
(0, _react.useEffect)(function () {
|
|
141
|
+
stopEkho();
|
|
142
|
+
}, [slideCount, stopEkho]);
|
|
140
143
|
(0, _react.useEffect)(function () {
|
|
141
144
|
if (automatic && ((slide === null || slide === void 0 ? void 0 : slide.audioType) === 'none' || audioFailed)) {
|
|
142
145
|
var _slide$vignettes$, _slide$vignettes$$tex;
|
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -313,7 +313,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
313
313
|
|
|
314
314
|
var autoplayCond = automatic && !isDecision;
|
|
315
315
|
var disableBackButton = currentLine === 0 || previousLineWasDecision || currentLine > 0 && (lastLine === null || lastLine === void 0 ? void 0 : lastLine.decision);
|
|
316
|
-
(0, _useEkho.default)({
|
|
316
|
+
var stopEkho = (0, _useEkho.default)({
|
|
317
317
|
audioType: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType,
|
|
318
318
|
voice: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.voice,
|
|
319
319
|
started: started,
|
|
@@ -329,7 +329,10 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
329
329
|
handleClickNext();
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
});
|
|
332
|
+
});
|
|
333
|
+
(0, _react.useEffect)(function () {
|
|
334
|
+
stopEkho();
|
|
335
|
+
}, [currentLine, stopEkho]); // Autoplay logic
|
|
333
336
|
|
|
334
337
|
(0, _react.useEffect)(function () {
|
|
335
338
|
if (autoplayCond && ((currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType) === 'none' || audioFailed)) {
|
|
@@ -540,9 +540,6 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
540
540
|
});
|
|
541
541
|
(0, _react.useEffect)(function () {
|
|
542
542
|
stopEkho();
|
|
543
|
-
return function () {
|
|
544
|
-
stopEkho();
|
|
545
|
-
};
|
|
546
543
|
}, [line, stopEkho]); // Autoplay logic
|
|
547
544
|
|
|
548
545
|
(0, _react.useEffect)(function () {
|
package/dist/helpers/useEkho.js
CHANGED
|
@@ -7,6 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
+
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
|
|
14
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
|
|
10
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
17
|
|
|
12
18
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -157,10 +163,9 @@ var useEkho = function useEkho(_ref) {
|
|
|
157
163
|
}(), [emitEvent, onError, setCurrentPlaying]);
|
|
158
164
|
var stopCurrentAudio = (0, _react.useCallback)(function () {
|
|
159
165
|
if (currentPlaying.current.url) {
|
|
160
|
-
currentPlaying.current = {
|
|
161
|
-
url: ''
|
|
162
|
-
|
|
163
|
-
};
|
|
166
|
+
currentPlaying.current = _objectSpread(_objectSpread({}, currentPlaying.current), {}, {
|
|
167
|
+
url: ''
|
|
168
|
+
});
|
|
164
169
|
stop(currentPlaying.current.cc);
|
|
165
170
|
}
|
|
166
171
|
}, [stop]);
|
|
@@ -171,8 +176,6 @@ var useEkho = function useEkho(_ref) {
|
|
|
171
176
|
}, [noAudio, stopCurrentAudio]);
|
|
172
177
|
(0, _react.useEffect)(function () {
|
|
173
178
|
if (isMounted && started) {
|
|
174
|
-
stopCurrentAudio();
|
|
175
|
-
|
|
176
179
|
if (audioType === 'voice' && voice !== null && voice !== void 0 && voice.id) {
|
|
177
180
|
var voiceId = getVoice(voice);
|
|
178
181
|
playSpeech({
|
|
@@ -185,7 +188,7 @@ var useEkho = function useEkho(_ref) {
|
|
|
185
188
|
onError();
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
|
-
}, [getVoice, playSpeech, isMounted, voice, text, audioType, audio === null || audio === void 0 ? void 0 : audio.url, audio, setCurrentPlaying, onError, started
|
|
191
|
+
}, [getVoice, playSpeech, isMounted, voice, text, audioType, audio === null || audio === void 0 ? void 0 : audio.url, audio, setCurrentPlaying, onError, started]);
|
|
189
192
|
return stopCurrentAudio;
|
|
190
193
|
};
|
|
191
194
|
|