@gamelearn/arcade-components 2.27.0 → 2.28.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/animation-component/components/AnimationComponent.js +10 -28
- package/dist/components/animation-component/index.js +0 -3
- package/dist/components/animation-component/mocks/mockForStory.js +0 -3
- package/dist/components/auto-evaluation-component/components/AutoEvaluation.js +30 -71
- package/dist/components/auto-evaluation-component/components/EndScreen.js +1 -9
- package/dist/components/auto-evaluation-component/components/StartScreen.js +2 -6
- package/dist/components/auto-evaluation-component/index.js +0 -3
- package/dist/components/auto-evaluation-component/mocks/mockForStory.js +0 -2
- package/dist/components/cards-selector-puzzle-component/components/Board/index.js +23 -55
- package/dist/components/cards-selector-puzzle-component/components/Card/index.js +4 -23
- package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +41 -92
- package/dist/components/cards-selector-puzzle-component/index.js +0 -3
- package/dist/components/cards-selector-puzzle-component/mocks/mockForStory.js +4 -10
- package/dist/components/cartel-component/components/CartelComponent.js +12 -39
- package/dist/components/cartel-component/index.js +0 -3
- package/dist/components/chained-image-click-puzzle-component/components/ChainedImageClickPuzzleComponent.js +20 -38
- package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +25 -64
- package/dist/components/chained-image-click-puzzle-component/index.js +0 -3
- package/dist/components/chained-image-click-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/comic-component/components/ComicComponent.js +27 -62
- package/dist/components/comic-component/components/Slide.js +2 -7
- package/dist/components/comic-component/components/Vignette.js +7 -23
- package/dist/components/comic-component/index.js +0 -3
- package/dist/components/comic-component/mocks/mockForStory.js +1 -2
- package/dist/components/conversational-component/components/ConversationalComponent.js +15 -39
- package/dist/components/conversational-component/index.js +0 -3
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +54 -137
- package/dist/components/conversational-pro-component/components/Message.js +1 -9
- package/dist/components/conversational-pro-component/components/Slot.js +3 -20
- package/dist/components/conversational-pro-component/components/SlotList.js +16 -40
- package/dist/components/conversational-pro-component/components/scene/Panel.js +12 -54
- package/dist/components/conversational-pro-component/components/scene/Panels.js +10 -17
- package/dist/components/conversational-pro-component/components/scene/index.js +11 -30
- package/dist/components/conversational-pro-component/index.js +0 -3
- package/dist/components/conversational-pro-component/mocks/mockForStory.js +1 -2
- package/dist/components/cracker-puzzle-component/components/CrackerPuzzleComponent.js +35 -89
- package/dist/components/cracker-puzzle-component/components/DrawGrid/index.js +3 -7
- package/dist/components/cracker-puzzle-component/components/DrawItem/index.js +4 -9
- package/dist/components/cracker-puzzle-component/components/DrawRow/index.js +4 -9
- package/dist/components/cracker-puzzle-component/components/helpers.js +15 -55
- package/dist/components/cracker-puzzle-component/index.js +0 -3
- package/dist/components/cracker-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/decision-component/components/DecisionBody.js +19 -44
- package/dist/components/decision-component/components/DecisionComponent.js +22 -70
- package/dist/components/decision-component/components/Feedback.js +2 -11
- package/dist/components/decision-component/components/Options.js +12 -31
- package/dist/components/decision-component/index.js +0 -3
- package/dist/components/decision-component/mocks/mockForStory.js +0 -2
- package/dist/components/dialog-component/components/BubbleWrapper.js +1 -7
- package/dist/components/dialog-component/components/DialogComponent.js +118 -338
- package/dist/components/dialog-component/components/DialogDecision.js +3 -13
- package/dist/components/dialog-component/components/SpeechBubbleComponent.js +6 -24
- package/dist/components/dialog-component/index.js +0 -3
- package/dist/components/dialog-component/mocks/mockForStory.js +1 -5
- package/dist/components/drag-item-puzzle-component/components/DragItemPuzzleComponent.js +34 -90
- package/dist/components/drag-item-puzzle-component/components/Messages.js +0 -4
- package/dist/components/drag-item-puzzle-component/index.js +0 -3
- package/dist/components/drag-item-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/feedback-component/components/FeedbackComponent.js +16 -41
- package/dist/components/feedback-component/index.js +0 -3
- package/dist/components/feedback-component/mocks/mockForStory.js +1 -2
- package/dist/components/frame-click-puzzle-component/components/Counter/index.js +3 -8
- package/dist/components/frame-click-puzzle-component/components/CurrentFramePuzzle.js +36 -68
- package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +33 -68
- package/dist/components/frame-click-puzzle-component/components/Tooltip/index.js +0 -6
- package/dist/components/frame-click-puzzle-component/index.js +0 -3
- package/dist/components/frame-click-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/hacker-puzzle-component/components/HackerPuzzleComponent.js +29 -69
- package/dist/components/hacker-puzzle-component/index.js +0 -3
- package/dist/components/hacker-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/hanged-puzzle-component/components/HangedPuzzleComponent.js +48 -123
- package/dist/components/hanged-puzzle-component/index.js +0 -3
- package/dist/components/hanged-puzzle-component/mocks/mockForStory.js +0 -3
- package/dist/components/hanged-puzzle-component/utils.js +0 -20
- package/dist/components/image-click-puzzle-component/components/ImageClickPuzzleComponent.js +1 -8
- package/dist/components/image-click-puzzle-component/index.js +0 -3
- package/dist/components/image-click-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/image-click-wrapper-component/components/CountDown/index.js +0 -4
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +67 -134
- package/dist/components/image-click-wrapper-component/components/TimerDialog/index.js +2 -6
- package/dist/components/image-click-wrapper-component/index.js +0 -3
- package/dist/components/image-click-wrapper-component/mocks/mockForStory.js +0 -2
- package/dist/components/image-component/components/ImageComponent.js +14 -33
- package/dist/components/image-component/index.js +0 -3
- package/dist/components/image-component/mocks/mockForStory.js +0 -2
- package/dist/components/index.js +0 -39
- package/dist/components/inventory-item/components/InventoryItem.js +9 -35
- package/dist/components/inventory-item/index.js +0 -3
- package/dist/components/inventory-item/mocks/mockForStory.js +0 -3
- package/dist/components/keyboard-puzzle-component/components/KeyboardPuzzleComponent.js +33 -75
- package/dist/components/keyboard-puzzle-component/index.js +0 -3
- package/dist/components/keyboard-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/konva-components/Area/index.js +15 -44
- package/dist/components/konva-components/KonvaMapper.js +19 -42
- package/dist/components/lectures-component/components/LectureButtons.js +4 -8
- package/dist/components/lectures-component/components/LecturesComponent.js +29 -55
- package/dist/components/lectures-component/index.js +0 -3
- package/dist/components/lectures-component/mocks/mockForStory.js +6 -9
- package/dist/components/login-puzzle-component/components/LoginPuzzleComponent.js +38 -80
- package/dist/components/login-puzzle-component/index.js +0 -3
- package/dist/components/login-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/notice-component/components/NoticeComponent.js +8 -21
- package/dist/components/notice-component/index.js +0 -3
- package/dist/components/notice-component/mocks/mockForStory.js +0 -2
- package/dist/components/pattern-component/components/PatternComponent.js +8 -24
- package/dist/components/pattern-component/index.js +0 -3
- package/dist/components/pattern-component/mocks/mockForStory.js +0 -2
- package/dist/components/pdf-component/components/PdfComponent.js +23 -55
- package/dist/components/pdf-component/components/PdfVisor.js +22 -58
- package/dist/components/pdf-component/index.js +0 -3
- package/dist/components/pdf-component/mocks/mockForProps.js +1 -2
- package/dist/components/referral-component/components/EmailPill.js +2 -6
- package/dist/components/referral-component/components/ReferralComponent.js +30 -59
- package/dist/components/referral-component/components/StepOne.js +14 -48
- package/dist/components/referral-component/components/StepTwo.js +8 -23
- package/dist/components/referral-component/index.js +0 -3
- package/dist/components/referral-component/mocks/mockForStory.js +0 -2
- package/dist/components/survey-component/components/ApplicableBox.js +8 -15
- package/dist/components/survey-component/components/OpinionBox.js +8 -15
- package/dist/components/survey-component/components/SurveyComponent.js +13 -40
- package/dist/components/survey-component/components/TextBox.js +7 -13
- package/dist/components/survey-component/index.js +0 -3
- package/dist/components/survey-component/mocks/mockForStory.js +0 -2
- package/dist/components/terminal-puzzle-component/components/FilesGroup/Item.js +1 -6
- package/dist/components/terminal-puzzle-component/components/FilesGroup/index.js +4 -10
- package/dist/components/terminal-puzzle-component/components/Image/index.js +2 -6
- package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +26 -65
- package/dist/components/terminal-puzzle-component/components/Visor/index.js +15 -35
- package/dist/components/terminal-puzzle-component/components/utils/index.js +0 -3
- package/dist/components/terminal-puzzle-component/index.js +0 -3
- package/dist/components/terminal-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/test-component/components/Container.js +26 -60
- package/dist/components/test-component/components/Feedbacks.js +3 -13
- package/dist/components/test-component/components/Questions.js +11 -45
- package/dist/components/test-component/components/Results.js +28 -52
- package/dist/components/test-component/components/TestComponent.js +59 -110
- package/dist/components/test-component/index.js +0 -3
- package/dist/components/test-component/mocks/mockForStory.js +4 -8
- package/dist/components/text-click-puzzle-component/components/TextClickPuzzleComponent.js +58 -95
- package/dist/components/text-click-puzzle-component/index.js +0 -3
- package/dist/components/text-click-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/text-click-puzzle-component/utils/index.js +6 -31
- package/dist/components/url-component/components/UrlComponent.js +16 -34
- package/dist/components/url-component/index.js +0 -3
- package/dist/components/url-component/mocks/mockForProps.js +0 -2
- package/dist/components/video-component/components/VideoComponent.js +11 -25
- package/dist/components/video-component/index.js +0 -3
- package/dist/components/video-component/mocks/mockForStory.js +0 -2
- package/dist/components/video-visor/components/VideoControllers/BufferBar.js +10 -37
- package/dist/components/video-visor/components/VideoControllers/ControlButtons.js +2 -6
- package/dist/components/video-visor/components/VideoControllers/FinishedVideoButtons.js +1 -5
- package/dist/components/video-visor/components/VideoControllers/PlayInitButton.js +2 -8
- package/dist/components/video-visor/components/VideoControllers/SkipButton.js +5 -9
- package/dist/components/video-visor/components/VideoControllers/Timer.js +0 -5
- package/dist/components/video-visor/components/VideoControllers/VolumeBar.js +4 -20
- package/dist/components/video-visor/components/VideoControllers/index.js +17 -29
- package/dist/components/video-visor/components/VideoVisor.js +38 -92
- package/dist/components/video-visor/index.js +0 -3
- package/dist/components/video-visor/mocks/mockForStory.js +1 -2
- package/dist/components/web-builder-puzzle-component/Popups/PopupColorComponent/index.js +11 -28
- package/dist/components/web-builder-puzzle-component/Popups/PopupImageComponent/index.js +10 -27
- package/dist/components/web-builder-puzzle-component/Popups/PopupTextComponent/index.js +13 -36
- package/dist/components/web-builder-puzzle-component/Popups/index.js +0 -4
- package/dist/components/web-builder-puzzle-component/Templates/Facebook.js +0 -2
- package/dist/components/web-builder-puzzle-component/components/EditButton/index.js +1 -5
- package/dist/components/web-builder-puzzle-component/components/Feedback/index.js +3 -7
- package/dist/components/web-builder-puzzle-component/components/PublishButton/index.js +1 -5
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/BankBody.js +5 -12
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/FacebookBody.js +5 -11
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/index.js +0 -7
- package/dist/components/web-builder-puzzle-component/components/WebBuilderFront/index.js +5 -14
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/BankHeader.js +5 -13
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/FacebookHeader.js +3 -8
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/index.js +3 -10
- package/dist/components/web-builder-puzzle-component/components/WebBuilderPuzzleComponent.js +47 -112
- package/dist/components/web-builder-puzzle-component/components/WebBuilderTopBar/index.js +3 -9
- package/dist/components/web-builder-puzzle-component/index.js +0 -3
- package/dist/components/web-builder-puzzle-component/mocks/mockForStory.js +0 -3
- package/dist/components/writer-puzzle-component/components/ElectionComponent.js +13 -30
- package/dist/components/writer-puzzle-component/components/FeedbackComponent.js +14 -30
- package/dist/components/writer-puzzle-component/components/FeedbackElement.js +2 -6
- package/dist/components/writer-puzzle-component/components/FinishedTextComponent.js +1 -6
- package/dist/components/writer-puzzle-component/components/FixedComponent.js +17 -52
- package/dist/components/writer-puzzle-component/components/SingleElection.js +13 -41
- package/dist/components/writer-puzzle-component/components/WriterPuzzleComponent.js +63 -145
- package/dist/components/writer-puzzle-component/index.js +0 -3
- package/dist/components/writer-puzzle-component/mocks/mockForStory.js +10 -7
- package/dist/components/zoom-test/components/ZoomTest.js +7 -25
- package/dist/components/zoom-test/index.js +0 -3
- package/dist/components/zoom-test/mocks/mockForStory.js +0 -4
- package/dist/helpers/LangIsRtl.js +0 -4
- package/dist/helpers/LightSet.js +0 -4
- package/dist/helpers/LodController.js +1 -10
- package/dist/helpers/deviceDetection.js +2 -5
- package/dist/helpers/drawLOD.js +11 -53
- package/dist/helpers/index.js +73 -102
- package/dist/helpers/lodStats.js +2 -10
- package/dist/helpers/mocker.js +1 -20
- package/dist/helpers/useEkho.js +64 -91
- package/dist/helpers/useGLB.js +5 -13
- package/dist/helpers/useStateMachine.js +254 -0
- package/dist/helpers/useTimeout.js +0 -6
- package/dist/helpers/useWindowSize.js +8 -22
- package/dist/index.js +0 -2
- package/dist/test/testSceneWrapper.js +0 -8
- package/package.json +3 -2
|
@@ -1,184 +1,145 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _Container = _interopRequireDefault(require("./Container"));
|
|
13
|
-
|
|
14
10
|
var _Results = _interopRequireDefault(require("./Results"));
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
14
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
-
|
|
24
15
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
-
|
|
26
16
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
27
|
-
|
|
28
17
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
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; }
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
36
23
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
|
-
|
|
38
24
|
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."); }
|
|
39
|
-
|
|
40
25
|
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); }
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
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; }
|
|
45
|
-
|
|
26
|
+
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; }
|
|
27
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
46
28
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
|
-
|
|
48
29
|
var TestComponent = function TestComponent(_ref) {
|
|
49
30
|
var test = _ref.test,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
31
|
+
_ref$countdown = _ref.countdown,
|
|
32
|
+
countdown = _ref$countdown === void 0 ? {} : _ref$countdown,
|
|
33
|
+
emitEvent = _ref.emitEvent,
|
|
34
|
+
soundActions = _ref.soundActions,
|
|
35
|
+
audio = _ref.audio,
|
|
36
|
+
required = _ref.required,
|
|
37
|
+
pause = _ref.pause,
|
|
38
|
+
_ref$minimumPercentag = _ref.minimumPercentage,
|
|
39
|
+
minimumPercentage = _ref$minimumPercentag === void 0 ? 100 : _ref$minimumPercentag,
|
|
40
|
+
feedbacksOnlyWhenReview = _ref.feedbacksOnlyWhenReview;
|
|
60
41
|
var questions = test.questions;
|
|
61
|
-
|
|
62
42
|
var _useState = (0, _react.useState)({}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
result = _useState2[0],
|
|
45
|
+
setResult = _useState2[1];
|
|
67
46
|
var _useState3 = (0, _react.useState)(),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
47
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
+
interval = _useState4[0],
|
|
49
|
+
saveInterval = _useState4[1];
|
|
72
50
|
var _useState5 = (0, _react.useState)(0),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
51
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
+
tries = _useState6[0],
|
|
53
|
+
setTries = _useState6[1];
|
|
77
54
|
var _useState7 = (0, _react.useState)([]),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
55
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
56
|
+
correctQuestions = _useState8[0],
|
|
57
|
+
setCorrectQuestions = _useState8[1];
|
|
82
58
|
var _useState9 = (0, _react.useState)(countdown.time),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
59
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
60
|
+
time = _useState10[0],
|
|
61
|
+
setTime = _useState10[1];
|
|
87
62
|
var _useState11 = (0, _react.useState)(false),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
63
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
64
|
+
answeredPage = _useState12[0],
|
|
65
|
+
answerPage = _useState12[1];
|
|
92
66
|
var _useState13 = (0, _react.useState)('test'),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
67
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
68
|
+
view = _useState14[0],
|
|
69
|
+
changeView = _useState14[1];
|
|
97
70
|
var _useState15 = (0, _react.useState)(true),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
71
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
72
|
+
isFirst = _useState16[0],
|
|
73
|
+
changeFirst = _useState16[1];
|
|
102
74
|
var _useState17 = (0, _react.useState)({}),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
75
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
76
|
+
showingResult = _useState18[0],
|
|
77
|
+
setShowingResult = _useState18[1];
|
|
107
78
|
var _useState19 = (0, _react.useState)({}),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
79
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
80
|
+
historicAnswers = _useState20[0],
|
|
81
|
+
setHistoric = _useState20[1];
|
|
112
82
|
var _useState21 = (0, _react.useState)(false),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
83
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
84
|
+
timeOver = _useState22[0],
|
|
85
|
+
setTimeOver = _useState22[1];
|
|
117
86
|
var isRequired = required || test.required || false;
|
|
118
87
|
var rewardedCorrectAnswers = (0, _react.useRef)({});
|
|
119
|
-
|
|
120
88
|
var _useState23 = (0, _react.useState)(),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
89
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
90
|
+
calculatedMinimum = _useState24[0],
|
|
91
|
+
setCalculateMinimum = _useState24[1];
|
|
125
92
|
var _soundActions = _slicedToArray(soundActions, 2),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
93
|
+
playSound = _soundActions[0],
|
|
94
|
+
stop = _soundActions[1];
|
|
129
95
|
var updateForm = function updateForm(optionSelected, question, index, inputType, answerId) {
|
|
130
96
|
var actualAnswer = _objectSpread(_objectSpread({}, optionSelected), {}, {
|
|
131
97
|
index: index
|
|
132
98
|
});
|
|
133
|
-
|
|
134
99
|
if (tries > 0) {
|
|
135
100
|
actualAnswer.rewards = actualAnswer.rewards.filter(function (reward) {
|
|
136
101
|
return !historicAnswers[optionSelected.id] || reward.points < 0;
|
|
137
102
|
});
|
|
138
103
|
}
|
|
139
|
-
|
|
140
104
|
if (result[question]) {
|
|
141
105
|
// Check if any answer is checked in order to be able to unchecked it
|
|
142
106
|
var checkIfOptionExisted = result[question].find(function (element) {
|
|
143
107
|
return element.id === answerId;
|
|
144
108
|
});
|
|
145
|
-
|
|
146
109
|
if (checkIfOptionExisted) {
|
|
147
110
|
if (checkIfOptionExisted.id === optionSelected.id) {
|
|
148
111
|
var answerToUnCheck = result[question].find(function (element) {
|
|
149
112
|
return element.id === answerId;
|
|
150
113
|
});
|
|
151
114
|
var indexOfAnswerToUnCheck = result[question].indexOf(answerToUnCheck);
|
|
152
|
-
result[question].splice(indexOfAnswerToUnCheck, 1);
|
|
153
|
-
|
|
115
|
+
result[question].splice(indexOfAnswerToUnCheck, 1);
|
|
116
|
+
// no answers, no run
|
|
154
117
|
if (result[question].length === 0) {
|
|
155
118
|
answerPage(false);
|
|
156
119
|
return;
|
|
157
120
|
}
|
|
158
121
|
}
|
|
159
|
-
}
|
|
122
|
+
}
|
|
123
|
+
// if there is already an option checked
|
|
160
124
|
else {
|
|
161
125
|
result[question].push(actualAnswer);
|
|
162
126
|
}
|
|
163
|
-
}
|
|
127
|
+
}
|
|
128
|
+
// if no option is checked
|
|
164
129
|
else {
|
|
165
130
|
result[question] = [actualAnswer];
|
|
166
131
|
}
|
|
167
|
-
|
|
168
132
|
var actualResult;
|
|
169
|
-
|
|
170
133
|
if (inputType === 'isRadio') {
|
|
171
134
|
actualResult = _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, question, [actualAnswer]));
|
|
172
135
|
} else {
|
|
173
136
|
actualResult = _objectSpread({}, result);
|
|
174
137
|
}
|
|
175
|
-
|
|
176
138
|
setResult(actualResult);
|
|
177
139
|
setShowingResult(actualResult);
|
|
178
140
|
setHistoric(_objectSpread(_objectSpread({}, historicAnswers), {}, _defineProperty({}, optionSelected.id, _objectSpread({}, optionSelected))));
|
|
179
141
|
answerPage(true);
|
|
180
142
|
};
|
|
181
|
-
|
|
182
143
|
(0, _react.useEffect)(function () {
|
|
183
144
|
if (audio !== null && audio !== void 0 && audio.url) {
|
|
184
145
|
playSound(audio.url, 'tts');
|
|
@@ -215,18 +176,14 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
215
176
|
stop('tts');
|
|
216
177
|
}
|
|
217
178
|
}, [interval, stop, time]);
|
|
218
|
-
|
|
219
179
|
var showResults = function showResults() {
|
|
220
180
|
clearInterval(interval);
|
|
221
181
|
answerPage(false);
|
|
222
182
|
changeView('results');
|
|
223
|
-
|
|
224
183
|
var parsedShowingResult = _objectSpread({}, showingResult);
|
|
225
|
-
|
|
226
184
|
setShowingResult(parsedShowingResult);
|
|
227
185
|
stop('tts');
|
|
228
186
|
};
|
|
229
|
-
|
|
230
187
|
var finishTest = function finishTest() {
|
|
231
188
|
var actualResult = {
|
|
232
189
|
correctQuestions: correctQuestions.length,
|
|
@@ -246,7 +203,6 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
246
203
|
payload: actualResult
|
|
247
204
|
});
|
|
248
205
|
};
|
|
249
|
-
|
|
250
206
|
var restartTest = function restartTest() {
|
|
251
207
|
var finishAddPoints = function finishAddPoints() {
|
|
252
208
|
setShowingResult({});
|
|
@@ -255,12 +211,10 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
255
211
|
setResult({});
|
|
256
212
|
setTime(countdown.time);
|
|
257
213
|
setTimeOver(false);
|
|
258
|
-
|
|
259
214
|
if (audio !== null && audio !== void 0 && audio.url) {
|
|
260
215
|
playSound(audio.url, 'tts');
|
|
261
216
|
}
|
|
262
217
|
};
|
|
263
|
-
|
|
264
218
|
var resultAnswers = Object.values(result);
|
|
265
219
|
resultAnswers.forEach(function (question) {
|
|
266
220
|
question.forEach(function (a) {
|
|
@@ -280,11 +234,9 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
280
234
|
});
|
|
281
235
|
return [].concat(_toConsumableArray(acc), _toConsumableArray(valueToReturn.flat()));
|
|
282
236
|
}, []);
|
|
283
|
-
|
|
284
237
|
if (timeOver && countdown.rewards) {
|
|
285
238
|
rewards = [].concat(_toConsumableArray(rewards), _toConsumableArray(countdown.rewards));
|
|
286
239
|
}
|
|
287
|
-
|
|
288
240
|
emitEvent({
|
|
289
241
|
type: 'addPoints',
|
|
290
242
|
payload: rewards,
|
|
@@ -296,7 +248,6 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
296
248
|
type: 'failTest'
|
|
297
249
|
});
|
|
298
250
|
};
|
|
299
|
-
|
|
300
251
|
var translate = function translate(id, values) {
|
|
301
252
|
return emitEvent({
|
|
302
253
|
type: 'translate',
|
|
@@ -304,7 +255,6 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
304
255
|
values: values
|
|
305
256
|
});
|
|
306
257
|
};
|
|
307
|
-
|
|
308
258
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
309
259
|
className: "test--container__overlay"
|
|
310
260
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -348,6 +298,5 @@ var TestComponent = function TestComponent(_ref) {
|
|
|
348
298
|
minimumPercentage: calculatedMinimum
|
|
349
299
|
})));
|
|
350
300
|
};
|
|
351
|
-
|
|
352
301
|
var _default = TestComponent;
|
|
353
302
|
exports.default = _default;
|
|
@@ -4,10 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _TestComponent = _interopRequireDefault(require("./components/TestComponent"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
var _default = _TestComponent.default;
|
|
13
10
|
exports.default = _default;
|
|
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.mockProps2 = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _mocker = require("helpers/mocker");
|
|
9
|
-
|
|
8
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
9
|
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
10
|
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
|
|
15
|
-
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable max-len */
|
|
16
14
|
var mockProps = {
|
|
17
15
|
emitEvent: _mocker.emitEvent,
|
|
18
16
|
soundActions: _mocker.soundActions,
|
|
@@ -98,7 +96,6 @@ var mockProps = {
|
|
|
98
96
|
}]
|
|
99
97
|
}
|
|
100
98
|
};
|
|
101
|
-
|
|
102
99
|
var mockProps2 = _objectSpread(_objectSpread({}, mockProps), {}, {
|
|
103
100
|
countdown: {
|
|
104
101
|
time: 5,
|
|
@@ -111,7 +108,6 @@ var mockProps2 = _objectSpread(_objectSpread({}, mockProps), {}, {
|
|
|
111
108
|
}]
|
|
112
109
|
}
|
|
113
110
|
});
|
|
114
|
-
|
|
115
111
|
exports.mockProps2 = mockProps2;
|
|
116
112
|
var _default = mockProps;
|
|
117
113
|
exports.default = _default;
|