@gamelearn/arcade-components 1.22.16 → 1.23.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/comic-component/components/ComicComponent.js +1 -4
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +5 -7
- package/dist/components/dialog-component/components/DialogComponent.js +3 -0
- package/dist/components/video-visor/components/VideoControllers/BufferBar.js +10 -5
- package/dist/components/video-visor/components/VideoControllers/SkipButton.js +3 -2
- package/dist/components/video-visor/components/VideoControllers/index.js +9 -3
- package/dist/components/video-visor/components/VideoVisor.js +36 -26
- package/dist/components/video-visor/mocks/mockForStory.js +4 -0
- package/dist/helpers/useEkho.js +7 -10
- package/package.json +2 -2
|
@@ -120,7 +120,7 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
120
120
|
goToPreviousSlide();
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
(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,9 +137,6 @@ var ComicComponent = function ComicComponent(_ref) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
|
-
(0, _react.useEffect)(function () {
|
|
141
|
-
stopEkho();
|
|
142
|
-
}, [slideCount, stopEkho]);
|
|
143
140
|
(0, _react.useEffect)(function () {
|
|
144
141
|
if (automatic && ((slide === null || slide === void 0 ? void 0 : slide.audioType) === 'none' || audioFailed)) {
|
|
145
142
|
var _slide$vignettes$, _slide$vignettes$$tex;
|
package/dist/components/conversational-pro-component/components/ConversationalProComponent.js
CHANGED
|
@@ -86,8 +86,9 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
86
86
|
currentLine = _useState10[0],
|
|
87
87
|
setCurrentLine = _useState10[1];
|
|
88
88
|
|
|
89
|
-
var _soundActions = _slicedToArray(soundActions,
|
|
90
|
-
playSound = _soundActions[0]
|
|
89
|
+
var _soundActions = _slicedToArray(soundActions, 2),
|
|
90
|
+
playSound = _soundActions[0],
|
|
91
|
+
stopSound = _soundActions[1];
|
|
91
92
|
|
|
92
93
|
var _useTimeout = (0, _useTimeout2.default)(),
|
|
93
94
|
start = _useTimeout.start,
|
|
@@ -313,7 +314,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
313
314
|
|
|
314
315
|
var autoplayCond = automatic && !isDecision;
|
|
315
316
|
var disableBackButton = currentLine === 0 || previousLineWasDecision || currentLine > 0 && (lastLine === null || lastLine === void 0 ? void 0 : lastLine.decision);
|
|
316
|
-
|
|
317
|
+
(0, _useEkho.default)({
|
|
317
318
|
audioType: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType,
|
|
318
319
|
voice: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.voice,
|
|
319
320
|
started: started,
|
|
@@ -329,10 +330,7 @@ var ConversationProViewer = function ConversationProViewer(_ref) {
|
|
|
329
330
|
handleClickNext();
|
|
330
331
|
}
|
|
331
332
|
}
|
|
332
|
-
});
|
|
333
|
-
(0, _react.useEffect)(function () {
|
|
334
|
-
stopEkho();
|
|
335
|
-
}, [currentLine, stopEkho]); // Autoplay logic
|
|
333
|
+
}); // Autoplay logic
|
|
336
334
|
|
|
337
335
|
(0, _react.useEffect)(function () {
|
|
338
336
|
if (autoplayCond && ((currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType) === 'none' || audioFailed)) {
|
|
@@ -559,6 +559,9 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
559
559
|
});
|
|
560
560
|
(0, _react.useEffect)(function () {
|
|
561
561
|
stopEkho();
|
|
562
|
+
return function () {
|
|
563
|
+
stopEkho();
|
|
564
|
+
};
|
|
562
565
|
}, [line, stopEkho]); // Autoplay logic
|
|
563
566
|
|
|
564
567
|
(0, _react.useEffect)(function () {
|
|
@@ -31,7 +31,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
31
31
|
|
|
32
32
|
var BufferBar = function BufferBar(_ref) {
|
|
33
33
|
var time = _ref.time,
|
|
34
|
-
setTimePoint = _ref.setTimePoint
|
|
34
|
+
setTimePoint = _ref.setTimePoint,
|
|
35
|
+
mandatory = _ref.mandatory,
|
|
36
|
+
mandatoryHasBeenViewed = _ref.mandatoryHasBeenViewed,
|
|
37
|
+
viewed = _ref.viewed;
|
|
35
38
|
var barPercentage = Math.trunc(time.current * 1000 / time.duration) / 10;
|
|
36
39
|
|
|
37
40
|
var barRef = /*#__PURE__*/_react.default.createRef();
|
|
@@ -76,10 +79,12 @@ var BufferBar = function BufferBar(_ref) {
|
|
|
76
79
|
};
|
|
77
80
|
|
|
78
81
|
var _onMouseDown = function onMouseDown(event, buffer) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
if (!mandatory || mandatory && mandatoryHasBeenViewed || viewed) {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
setTimePoint(event.clientX, buffer.offsetWidth, buffer.offsetLeft);
|
|
85
|
+
windowMove(buffer);
|
|
86
|
+
move(true);
|
|
87
|
+
}
|
|
83
88
|
};
|
|
84
89
|
|
|
85
90
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -13,8 +13,9 @@ var skipButton = function skipButton(_ref) {
|
|
|
13
13
|
var viewed = _ref.viewed,
|
|
14
14
|
mandatory = _ref.mandatory,
|
|
15
15
|
finished = _ref.finished,
|
|
16
|
-
skip = _ref.skip
|
|
17
|
-
|
|
16
|
+
skip = _ref.skip,
|
|
17
|
+
mandatoryHasBeenViewed = _ref.mandatoryHasBeenViewed;
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, mandatory && viewed || !mandatory || finished || mandatoryHasBeenViewed ? /*#__PURE__*/_react.default.createElement("div", {
|
|
18
19
|
className: "position--absolute right top z-index1"
|
|
19
20
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
20
21
|
className: "gat--btn__round",
|
|
@@ -40,7 +40,8 @@ var VideoControllers = function VideoControllers(_ref) {
|
|
|
40
40
|
mute = _ref.mute,
|
|
41
41
|
setVolume = _ref.setVolume,
|
|
42
42
|
setTimePoint = _ref.setTimePoint,
|
|
43
|
-
audioAnimation = _ref.audioAnimation
|
|
43
|
+
audioAnimation = _ref.audioAnimation,
|
|
44
|
+
mandatoryHasBeenViewed = _ref.mandatoryHasBeenViewed;
|
|
44
45
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, audioAnimation ? null : /*#__PURE__*/_react.default.createElement(_PlayInitButton.default, {
|
|
45
46
|
play: pause,
|
|
46
47
|
paused: paused,
|
|
@@ -53,12 +54,17 @@ var VideoControllers = function VideoControllers(_ref) {
|
|
|
53
54
|
finished: finished,
|
|
54
55
|
viewed: viewed,
|
|
55
56
|
skip: skip,
|
|
56
|
-
rewind: rewind
|
|
57
|
+
rewind: rewind,
|
|
58
|
+
mandatoryHasBeenViewed: mandatoryHasBeenViewed
|
|
57
59
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
58
60
|
className: "video--controls"
|
|
59
61
|
}, /*#__PURE__*/_react.default.createElement(_BufferBar.default, {
|
|
62
|
+
mandatory: mandatory,
|
|
63
|
+
mandatoryHasBeenViewed: mandatoryHasBeenViewed,
|
|
60
64
|
time: time,
|
|
61
|
-
setTimePoint: setTimePoint
|
|
65
|
+
setTimePoint: setTimePoint,
|
|
66
|
+
finished: finished,
|
|
67
|
+
viewed: viewed
|
|
62
68
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
63
69
|
className: "video--controls__actions"
|
|
64
70
|
}, /*#__PURE__*/_react.default.createElement(_Timer.default, {
|
|
@@ -44,48 +44,53 @@ var VideoVisor = function VideoVisor(_ref) {
|
|
|
44
44
|
soundActions = _ref.soundActions,
|
|
45
45
|
endVideo = _ref.endVideo;
|
|
46
46
|
|
|
47
|
+
var _useState = (0, _react.useState)(false),
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
mandatoryHasBeenViewed = _useState2[0],
|
|
50
|
+
setmandatoryHasBeenViewed = _useState2[1];
|
|
51
|
+
|
|
47
52
|
var _soundActions = _slicedToArray(soundActions, 1),
|
|
48
53
|
playSound = _soundActions[0];
|
|
49
54
|
|
|
50
|
-
var _useState = (0, _react.useState)(0),
|
|
51
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
-
duration = _useState2[0],
|
|
53
|
-
setDuration = _useState2[1];
|
|
54
|
-
|
|
55
55
|
var _useState3 = (0, _react.useState)(0),
|
|
56
56
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
duration = _useState4[0],
|
|
58
|
+
setDuration = _useState4[1];
|
|
59
59
|
|
|
60
|
-
var _useState5 = (0, _react.useState)(
|
|
60
|
+
var _useState5 = (0, _react.useState)(0),
|
|
61
61
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
loadedPercentage = _useState6[0],
|
|
63
|
+
setLoadedPercentage = _useState6[1];
|
|
64
64
|
|
|
65
|
-
var _useState7 = (0, _react.useState)(
|
|
65
|
+
var _useState7 = (0, _react.useState)(false),
|
|
66
66
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
loading = _useState8[0],
|
|
68
|
+
setLoading = _useState8[1];
|
|
69
69
|
|
|
70
|
-
var _useState9 = (0, _react.useState)(
|
|
70
|
+
var _useState9 = (0, _react.useState)(true),
|
|
71
71
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
paused = _useState10[0],
|
|
73
|
+
setPaused = _useState10[1];
|
|
74
74
|
|
|
75
|
-
var _useState11 = (0, _react.useState)(),
|
|
75
|
+
var _useState11 = (0, _react.useState)(false),
|
|
76
76
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
isFinish = _useState12[0],
|
|
78
|
+
setIsFinish = _useState12[1];
|
|
79
79
|
|
|
80
|
-
var _useState13 = (0, _react.useState)(
|
|
80
|
+
var _useState13 = (0, _react.useState)(),
|
|
81
81
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
videoPlayer = _useState14[0],
|
|
83
|
+
setVideo = _useState14[1];
|
|
84
84
|
|
|
85
|
-
var _useState15 = (0, _react.useState)(
|
|
85
|
+
var _useState15 = (0, _react.useState)(0),
|
|
86
86
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
volume = _useState16[0],
|
|
88
|
+
setVolume = _useState16[1];
|
|
89
|
+
|
|
90
|
+
var _useState17 = (0, _react.useState)(false),
|
|
91
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
92
|
+
hiddenControls = _useState18[0],
|
|
93
|
+
hideControls = _useState18[1];
|
|
89
94
|
|
|
90
95
|
var isHls = url && url.match(/\.m3u8(\?.+=.+)*$/i) && _hls.default.isSupported();
|
|
91
96
|
|
|
@@ -103,6 +108,10 @@ var VideoVisor = function VideoVisor(_ref) {
|
|
|
103
108
|
};
|
|
104
109
|
|
|
105
110
|
var onEnded = function onEnded() {
|
|
111
|
+
if (required) {
|
|
112
|
+
setmandatoryHasBeenViewed(true);
|
|
113
|
+
}
|
|
114
|
+
|
|
106
115
|
setLoading(false);
|
|
107
116
|
videoPlayer.pause();
|
|
108
117
|
setPaused(true);
|
|
@@ -230,9 +239,10 @@ var VideoVisor = function VideoVisor(_ref) {
|
|
|
230
239
|
backgroundPosition: 'center center'
|
|
231
240
|
};
|
|
232
241
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
233
|
-
className: "video",
|
|
242
|
+
className: "video ".concat(required && !mandatoryHasBeenViewed && !viewed ? 'forward-disabled' : ''),
|
|
234
243
|
style: isAudio ? configForAudio : null
|
|
235
244
|
}, !isEmbeddedVideo ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !hiddenControls && /*#__PURE__*/_react.default.createElement(_VideoControllers.default, {
|
|
245
|
+
mandatoryHasBeenViewed: mandatoryHasBeenViewed,
|
|
236
246
|
audioAnimation: !!isAudio,
|
|
237
247
|
skip: endVideo,
|
|
238
248
|
mandatory: required,
|
|
@@ -33,6 +33,10 @@ var mockProps = [{
|
|
|
33
33
|
imgId: 'https://min.int.gamelearn.io/cooked.gl-lms-storage/clients/58dccfba26561500117caf53/image/60224b7a901f3e0012350158/vista-vertical-torre-eiffel-paris-francia_1258-3169.jpg',
|
|
34
34
|
soundActions: _mocker.soundActions,
|
|
35
35
|
url: 'https://min.int.gamelearn.io/cooked.gl-lms-storage/clients/58dccfba26561500117caf53/documents/Cat-sound.mp3'
|
|
36
|
+
}, {
|
|
37
|
+
url: "".concat(path, "/triskelion-statics/videos/ada_hack.mp4"),
|
|
38
|
+
soundActions: _mocker.soundActions,
|
|
39
|
+
required: true
|
|
36
40
|
}];
|
|
37
41
|
exports.mockProps = mockProps;
|
|
38
42
|
var _default = mockProps;
|
package/dist/helpers/useEkho.js
CHANGED
|
@@ -7,12 +7,6 @@ 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
|
-
|
|
16
10
|
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); } }
|
|
17
11
|
|
|
18
12
|
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); }); }; }
|
|
@@ -163,9 +157,10 @@ var useEkho = function useEkho(_ref) {
|
|
|
163
157
|
}(), [emitEvent, onError, setCurrentPlaying]);
|
|
164
158
|
var stopCurrentAudio = (0, _react.useCallback)(function () {
|
|
165
159
|
if (currentPlaying.current.url) {
|
|
166
|
-
currentPlaying.current =
|
|
167
|
-
url: ''
|
|
168
|
-
|
|
160
|
+
currentPlaying.current = {
|
|
161
|
+
url: '',
|
|
162
|
+
cc: 'tts'
|
|
163
|
+
};
|
|
169
164
|
stop(currentPlaying.current.cc);
|
|
170
165
|
}
|
|
171
166
|
}, [stop]);
|
|
@@ -176,6 +171,8 @@ var useEkho = function useEkho(_ref) {
|
|
|
176
171
|
}, [noAudio, stopCurrentAudio]);
|
|
177
172
|
(0, _react.useEffect)(function () {
|
|
178
173
|
if (isMounted && started) {
|
|
174
|
+
stopCurrentAudio();
|
|
175
|
+
|
|
179
176
|
if (audioType === 'voice' && voice !== null && voice !== void 0 && voice.id) {
|
|
180
177
|
var voiceId = getVoice(voice);
|
|
181
178
|
playSpeech({
|
|
@@ -188,7 +185,7 @@ var useEkho = function useEkho(_ref) {
|
|
|
188
185
|
onError();
|
|
189
186
|
}
|
|
190
187
|
}
|
|
191
|
-
}, [getVoice, playSpeech, isMounted, voice, text, audioType, audio === null || audio === void 0 ? void 0 : audio.url, audio, setCurrentPlaying, onError, started]);
|
|
188
|
+
}, [getVoice, playSpeech, isMounted, voice, text, audioType, audio === null || audio === void 0 ? void 0 : audio.url, audio, setCurrentPlaying, onError, started, stopCurrentAudio]);
|
|
192
189
|
return stopCurrentAudio;
|
|
193
190
|
};
|
|
194
191
|
|
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.
|
|
5
|
+
"version": "1.23.0",
|
|
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.
|
|
16
|
+
"@gamelearn/arcade-styles": "0.11.10",
|
|
17
17
|
"@gamelearn/arcade-three-core": "1.1.15",
|
|
18
18
|
"@react-three/drei": "8.8.1",
|
|
19
19
|
"@react-three/fiber": "7.0.25",
|