@gamelearn/arcade-components 1.27.11 → 1.27.13

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.
@@ -195,7 +195,6 @@ var DragItemPuzzleComponent = function DragItemPuzzleComponent(_ref) {
195
195
  });
196
196
  }, [consume, emitEvent, resolveObject.name, resolveObject.uid]);
197
197
  var handleClose = (0, _react.useCallback)(function () {
198
- playSound('score');
199
198
  setResolveClass('success');
200
199
  emitEvent({
201
200
  type: 'hidePuzzleButtons',
@@ -205,13 +204,12 @@ var DragItemPuzzleComponent = function DragItemPuzzleComponent(_ref) {
205
204
  setTimeout(function () {
206
205
  handleFinish();
207
206
  }, 2000);
208
- }, [emitEvent, handleFinish, playSound, solution.right.rewards]);
207
+ }, [emitEvent, handleFinish, solution.right.rewards]);
209
208
  var handleFail = (0, _react.useCallback)(function () {
210
209
  emitEvent({
211
210
  type: 'closeUI',
212
211
  ui: 'inventory'
213
212
  });
214
- playSound('fail');
215
213
  setResolveClass('');
216
214
  emitEvent({
217
215
  type: 'hidePuzzleButtons',
@@ -221,7 +219,7 @@ var DragItemPuzzleComponent = function DragItemPuzzleComponent(_ref) {
221
219
  type: 'failPuzzle'
222
220
  });
223
221
  accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(solution.wrong.rewards));
224
- }, [emitEvent, playSound, solution.wrong.rewards]);
222
+ }, [emitEvent, solution.wrong.rewards]);
225
223
  var handleDrop = (0, _react.useCallback)(function (e) {
226
224
  e.dragEvent.stopPropagation();
227
225
  e.dragEvent.preventDefault();
@@ -414,6 +412,7 @@ var DragItemPuzzleComponent = function DragItemPuzzleComponent(_ref) {
414
412
  text: info.solution[resolvedClass === 'success' ? 'right' : 'wrong'].desc,
415
413
  success: resolvedClass === 'success',
416
414
  translate: translate,
415
+ playSound: playSound,
417
416
  functionOnClose: handleFeedbackFuncionOnClose
418
417
  }) : null);
419
418
  };
@@ -46,7 +46,7 @@ var FeedbackComponent = function FeedbackComponent(_ref) {
46
46
  (0, _react.useEffect)(function () {
47
47
  var timerForShowExplain;
48
48
 
49
- if (text && playSound) {
49
+ if (playSound) {
50
50
  playSound(success ? 'score' : 'fail');
51
51
  }
52
52
 
@@ -23,6 +23,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
23
23
 
24
24
  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; }
25
25
 
26
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
+
28
+ 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."); }
29
+
30
+ 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); }
31
+
32
+ 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; }
33
+
34
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : 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; }
35
+
36
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
+
26
38
  var ICONS = {
27
39
  image: 'image-icon',
28
40
  video: 'video-icon',
@@ -47,6 +59,10 @@ var Visor = function Visor(_ref) {
47
59
  soundActions = _ref.soundActions;
48
60
  var fileId = file.fileId;
49
61
  var url = ((_file$document = file.document) === null || _file$document === void 0 ? void 0 : _file$document.url) || '';
62
+
63
+ var _soundActions = _slicedToArray(soundActions, 1),
64
+ playSound = _soundActions[0];
65
+
50
66
  var COMPONENTS = {
51
67
  image: {
52
68
  component: _Image.default,
@@ -105,6 +121,7 @@ var Visor = function Visor(_ref) {
105
121
  className: "puzzle--terminal__visor"
106
122
  }, /*#__PURE__*/_react.default.createElement(_FeedbackComponent.default, {
107
123
  shortText: true,
124
+ playSound: playSound,
108
125
  success: fileId === solutionId,
109
126
  text: fileId === solutionId ? info.solution.right.desc : info.solution.wrong.desc,
110
127
  functionOnClose: fileId === solutionId ? resolvePuzzle : backFile,
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.27.11",
5
+ "version": "1.27.13",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",
@@ -14,9 +14,9 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@gamelearn/arcade-styles": "0.13.2",
17
- "@gamelearn/arcade-three-core": "1.13.0",
17
+ "@gamelearn/arcade-three-core": "1.14.5",
18
18
  "@react-three/drei": "9.4.3",
19
- "@react-three/fiber": "8.0.10",
19
+ "@react-three/fiber": "8.0.17",
20
20
  "@testing-library/jest-dom": "^5.16.4",
21
21
  "@testing-library/react": "^13.1.1",
22
22
  "@testing-library/user-event": "13.5.0",