@gamelearn/arcade-components 2.33.2 → 2.34.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.
@@ -25,7 +25,8 @@ var Board = function Board(_ref) {
25
25
  resolvePuzzle = _ref.resolvePuzzle,
26
26
  soundActions = _ref.soundActions,
27
27
  onFinish = _ref.onFinish,
28
- handleSuccess = _ref.handleSuccess;
28
+ handleSuccess = _ref.handleSuccess,
29
+ resolveWithAnyCard = _ref.resolveWithAnyCard;
29
30
  var _useState = (0, _react.useState)(Array(cards.length).fill(false)),
30
31
  _useState2 = _slicedToArray(_useState, 2),
31
32
  flipped = _useState2[0],
@@ -81,12 +82,12 @@ var Board = function Board(_ref) {
81
82
  }
82
83
  }, [flipAllCorrect, resolvePuzzle]);
83
84
  (0, _react.useEffect)(function () {
84
- if (correctCards === numberOfCorrectCards && numberOfCorrectCards > 0) {
85
+ if (resolveWithAnyCard && correctCards || correctCards === numberOfCorrectCards && numberOfCorrectCards > 0) {
85
86
  onFinish();
86
87
  setFinished(true);
87
88
  setCorrectCards(0);
88
89
  }
89
- }, [correctCards, onFinish, numberOfCorrectCards]);
90
+ }, [correctCards, onFinish, numberOfCorrectCards, resolveWithAnyCard]);
90
91
  var handleCorrect = function handleCorrect(index) {
91
92
  flipACard(index);
92
93
  handleSuccess(cards[index].id || null);
@@ -148,7 +149,8 @@ Board.defaultProps = {
148
149
  cards: [],
149
150
  currentOrder: 1,
150
151
  resolvePuzzle: false,
151
- feedbackIsShown: false
152
+ feedbackIsShown: false,
153
+ resolveWithAnyCard: false
152
154
  };
153
155
  var _default = Board;
154
156
  exports.default = _default;
@@ -26,6 +26,7 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
26
26
  var emitEvent = _ref.emitEvent,
27
27
  info = _ref.info,
28
28
  cards = _ref.cards,
29
+ resolveWithAnyCard = _ref.resolveWithAnyCard,
29
30
  specificFeedbacks = _ref.specificFeedbacks,
30
31
  disableExit = _ref.disableExit,
31
32
  setResolveAction = _ref.setResolveAction,
@@ -245,6 +246,7 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
245
246
  currentOrder: currentOrder,
246
247
  cards: cards,
247
248
  onFinish: onFinish,
249
+ resolveWithAnyCard: resolveWithAnyCard,
248
250
  handleError: handleError,
249
251
  feedbackIsShown: feedbackIsShown,
250
252
  resolvePuzzle: resolvePuzzle,
@@ -262,6 +264,7 @@ var CardsSelectorPuzzleComponent = function CardsSelectorPuzzleComponent(_ref) {
262
264
  CardsSelectorPuzzleComponent.defaultProps = {
263
265
  cards: [],
264
266
  info: {},
267
+ resolveWithAnyCard: false,
265
268
  backgroundImage: {
266
269
  url: ''
267
270
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "author": "Gamelearn",
4
4
  "license": "unlicense",
5
- "version": "2.33.2",
5
+ "version": "2.34.0",
6
6
  "main": "dist/index.js",
7
7
  "files": [
8
8
  "dist",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/runtime": "^7.18.6",
17
- "@gamelearn/arcade-styles": "2.18.3",
17
+ "@gamelearn/arcade-styles": "2.18.4",
18
18
  "@gamelearn/arcade-three-core": "1.24.3",
19
19
  "@react-three/a11y": "^3.0.0",
20
20
  "@react-three/drei": "9.4.3",