@gamelearn/arcade-components 1.24.1 → 1.24.3

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.
@@ -80,6 +80,7 @@ var ComicComponent = function ComicComponent(_ref) {
80
80
 
81
81
  var slide = slides === null || slides === void 0 ? void 0 : slides[slideCount];
82
82
  var close = (0, _react.useCallback)(function () {
83
+ setStarted(false);
83
84
  emitEvent({
84
85
  type: 'success'
85
86
  });
@@ -262,6 +262,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
262
262
  }
263
263
  }, [currentLineData.id, edges, finishConversation, lines]);
264
264
  var handleClickNext = (0, _react.useCallback)(function (choice, reset) {
265
+ var isLast = false;
265
266
  setPreviousLineWasDecision(currentLineData.decision);
266
267
  setStarted(false);
267
268
  setAudioFailed(false);
@@ -279,11 +280,14 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
279
280
  if (line + 1 <= maxLine) {
280
281
  setCurrentLine(line + 1);
281
282
  } else {
283
+ isLast = true;
282
284
  finishConversation();
283
285
  }
284
286
  }
285
287
 
286
- setStarted(true);
288
+ if (!isLast) {
289
+ setStarted(true);
290
+ }
287
291
  }, [currentLine, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.decision, finishConversation, handleBranchDirection, handleDecisionBranch, isBranched, lines.length]);
288
292
 
289
293
  var handleClickBack = function handleClickBack() {
@@ -65,14 +65,7 @@ var useEkho = function useEkho(_ref) {
65
65
  type: 'translate',
66
66
  payload: id
67
67
  });
68
- }, [emitEvent]); // Setted when is mounted
69
-
70
- (0, _react.useEffect)(function () {
71
- setIsMounted(true);
72
- return function () {
73
- setIsMounted(false);
74
- };
75
- }, []); // Get translated voices, todo: translate this in arcade translateProps i18n.helper.js
68
+ }, [emitEvent]); // Get translated voices, todo: translate this in arcade translateProps i18n.helper.js
76
69
 
77
70
  var getVoice = (0, _react.useCallback)(function (_ref2) {
78
71
  var id = _ref2.id,
@@ -117,7 +110,7 @@ var useEkho = function useEkho(_ref) {
117
110
  while (1) {
118
111
  switch (_context.prev = _context.next) {
119
112
  case 0:
120
- if (!(payload.voiceId && payload.text)) {
113
+ if (!(isMounted && payload.voiceId && payload.text)) {
121
114
  _context.next = 7;
122
115
  break;
123
116
  }
@@ -154,7 +147,7 @@ var useEkho = function useEkho(_ref) {
154
147
  return function (_x) {
155
148
  return _ref3.apply(this, arguments);
156
149
  };
157
- }(), [emitEvent, onError, setCurrentPlaying]);
150
+ }(), [emitEvent, isMounted, onError, setCurrentPlaying]);
158
151
  var stopCurrentAudio = (0, _react.useCallback)(function () {
159
152
  if (currentPlaying.current.url) {
160
153
  currentPlaying.current = {
@@ -163,16 +156,24 @@ var useEkho = function useEkho(_ref) {
163
156
  };
164
157
  stop(currentPlaying.current.cc);
165
158
  }
166
- }, [stop]);
159
+ }, [stop]); // Setted when is mounted
160
+
161
+ (0, _react.useEffect)(function () {
162
+ setIsMounted(true);
163
+ return function () {
164
+ setIsMounted(false);
165
+ stopCurrentAudio();
166
+ };
167
+ }, [stopCurrentAudio]);
167
168
  (0, _react.useEffect)(function () {
168
169
  if (noAudio) {
169
170
  stopCurrentAudio();
170
171
  }
171
172
  }, [noAudio, stopCurrentAudio]);
172
173
  (0, _react.useEffect)(function () {
173
- if (isMounted && started) {
174
- stopCurrentAudio();
174
+ stopCurrentAudio();
175
175
 
176
+ if (isMounted && started) {
176
177
  if (audioType === 'voice' && voice !== null && voice !== void 0 && voice.id) {
177
178
  var voiceId = getVoice(voice);
178
179
  playSpeech({
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.24.1",
5
+ "version": "1.24.3",
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.11.10",
16
+ "@gamelearn/arcade-styles": "0.12.0",
17
17
  "@gamelearn/arcade-three-core": "1.10.4",
18
18
  "@react-three/drei": "9.4.3",
19
19
  "@react-three/fiber": "8.0.10",