@gamelearn/arcade-components 2.41.1 → 3.0.1
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/README.md +8 -5
- package/dist/arcade-components.cjs +91984 -0
- package/dist/arcade-components.js +91968 -0
- package/package.json +74 -73
- package/dist/components/animation-component/components/AnimationComponent.js +0 -98
- package/dist/components/animation-component/index.js +0 -10
- package/dist/components/animation-component/mocks/mockForStory.js +0 -26
- package/dist/components/auto-evaluation-component/components/AutoEvaluation.js +0 -215
- package/dist/components/auto-evaluation-component/components/EndScreen.js +0 -43
- package/dist/components/auto-evaluation-component/components/StartScreen.js +0 -32
- package/dist/components/auto-evaluation-component/index.js +0 -10
- package/dist/components/auto-evaluation-component/mocks/mockForStory.js +0 -38
- package/dist/components/cards-selector-puzzle-component/components/Board/index.js +0 -159
- package/dist/components/cards-selector-puzzle-component/components/Card/index.js +0 -115
- package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +0 -289
- package/dist/components/cards-selector-puzzle-component/index.js +0 -10
- package/dist/components/cards-selector-puzzle-component/mocks/mockForStory.js +0 -446
- package/dist/components/cartel-component/components/CartelComponent.js +0 -124
- package/dist/components/cartel-component/index.js +0 -10
- package/dist/components/chained-image-click-puzzle-component/components/ChainedImageClickPuzzleComponent.js +0 -80
- package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +0 -182
- package/dist/components/chained-image-click-puzzle-component/index.js +0 -10
- package/dist/components/chained-image-click-puzzle-component/mocks/mockForStory.js +0 -413
- package/dist/components/comic-component/components/ComicComponent.js +0 -201
- package/dist/components/comic-component/components/Slide.js +0 -31
- package/dist/components/comic-component/components/Vignette.js +0 -70
- package/dist/components/comic-component/index.js +0 -10
- package/dist/components/comic-component/mocks/mockForStory.js +0 -314
- package/dist/components/conversational-component/components/ConversationalComponent.js +0 -101
- package/dist/components/conversational-component/index.js +0 -10
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +0 -543
- package/dist/components/conversational-pro-component/components/Message.js +0 -37
- package/dist/components/conversational-pro-component/components/Slot.js +0 -92
- package/dist/components/conversational-pro-component/components/SlotList.js +0 -162
- package/dist/components/conversational-pro-component/components/scene/Panel.js +0 -179
- package/dist/components/conversational-pro-component/components/scene/Panels.js +0 -46
- package/dist/components/conversational-pro-component/components/scene/index.js +0 -77
- package/dist/components/conversational-pro-component/index.js +0 -10
- package/dist/components/conversational-pro-component/mocks/mockForStory.js +0 -1529
- package/dist/components/cracker-puzzle-component/components/CrackerPuzzleComponent.js +0 -261
- package/dist/components/cracker-puzzle-component/components/DrawGrid/index.js +0 -33
- package/dist/components/cracker-puzzle-component/components/DrawItem/index.js +0 -48
- package/dist/components/cracker-puzzle-component/components/DrawRow/index.js +0 -43
- package/dist/components/cracker-puzzle-component/components/colors.js +0 -12
- package/dist/components/cracker-puzzle-component/components/helpers.js +0 -133
- package/dist/components/cracker-puzzle-component/index.js +0 -10
- package/dist/components/cracker-puzzle-component/mocks/mockForStory.js +0 -277
- package/dist/components/decision-component/components/DecisionBody.js +0 -116
- package/dist/components/decision-component/components/DecisionComponent.js +0 -248
- package/dist/components/decision-component/components/Feedback.js +0 -40
- package/dist/components/decision-component/components/Options.js +0 -74
- package/dist/components/decision-component/index.js +0 -10
- package/dist/components/decision-component/mocks/mockForStory.js +0 -166
- package/dist/components/dialog-component/components/BubbleWrapper.js +0 -39
- package/dist/components/dialog-component/components/DialogComponent.js +0 -779
- package/dist/components/dialog-component/components/DialogDecision.js +0 -44
- package/dist/components/dialog-component/components/SpeechBubbleComponent.js +0 -66
- package/dist/components/dialog-component/index.js +0 -10
- package/dist/components/dialog-component/mocks/mockForStory.js +0 -550
- package/dist/components/drag-item-puzzle-component/components/DragItemPuzzleComponent.js +0 -361
- package/dist/components/drag-item-puzzle-component/index.js +0 -10
- package/dist/components/drag-item-puzzle-component/mocks/mockForStory.js +0 -74
- package/dist/components/feedback-component/components/FeedbackComponent.js +0 -126
- package/dist/components/feedback-component/index.js +0 -10
- package/dist/components/feedback-component/mocks/mockForStory.js +0 -52
- package/dist/components/frame-click-puzzle-component/components/Counter/index.js +0 -24
- package/dist/components/frame-click-puzzle-component/components/CurrentFramePuzzle.js +0 -196
- package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +0 -178
- package/dist/components/frame-click-puzzle-component/components/Tooltip/index.js +0 -23
- package/dist/components/frame-click-puzzle-component/index.js +0 -10
- package/dist/components/frame-click-puzzle-component/mocks/mockForStory.js +0 -717
- package/dist/components/hacker-puzzle-component/components/HackerPuzzleComponent.js +0 -255
- package/dist/components/hacker-puzzle-component/components/languages.js +0 -13
- package/dist/components/hacker-puzzle-component/index.js +0 -10
- package/dist/components/hacker-puzzle-component/mocks/mockForStory.js +0 -103
- package/dist/components/hanged-puzzle-component/components/HangedPuzzleComponent.js +0 -488
- package/dist/components/hanged-puzzle-component/index.js +0 -10
- package/dist/components/hanged-puzzle-component/mocks/mockForStory.js +0 -61
- package/dist/components/hanged-puzzle-component/utils.js +0 -64
- package/dist/components/image-click-puzzle-component/components/ImageClickPuzzleComponent.js +0 -40
- package/dist/components/image-click-puzzle-component/index.js +0 -10
- package/dist/components/image-click-puzzle-component/mocks/mockForStory.js +0 -427
- package/dist/components/image-click-wrapper-component/components/CountDown/index.js +0 -18
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +0 -472
- package/dist/components/image-click-wrapper-component/components/TimerDialog/index.js +0 -26
- package/dist/components/image-click-wrapper-component/index.js +0 -10
- package/dist/components/image-click-wrapper-component/mocks/mockForStory.js +0 -432
- package/dist/components/image-component/components/ImageComponent.js +0 -83
- package/dist/components/image-component/index.js +0 -10
- package/dist/components/image-component/mocks/mockForStory.js +0 -52
- package/dist/components/index.js +0 -260
- package/dist/components/inventory-item/components/InventoryItem.js +0 -120
- package/dist/components/inventory-item/index.js +0 -10
- package/dist/components/inventory-item/mocks/mockForStory.js +0 -29
- package/dist/components/keyboard-puzzle-component/components/KeyboardPuzzleComponent.js +0 -275
- package/dist/components/keyboard-puzzle-component/index.js +0 -10
- package/dist/components/keyboard-puzzle-component/mocks/mockForStory.js +0 -40
- package/dist/components/konva-components/Area/index.js +0 -170
- package/dist/components/konva-components/KonvaMapper.js +0 -185
- package/dist/components/lectures-component/components/LectureButtons.js +0 -40
- package/dist/components/lectures-component/components/LecturesComponent.js +0 -157
- package/dist/components/lectures-component/index.js +0 -10
- package/dist/components/lectures-component/mocks/mockForStory.js +0 -39
- package/dist/components/login-puzzle-component/components/LoginPuzzleComponent.js +0 -243
- package/dist/components/login-puzzle-component/index.js +0 -10
- package/dist/components/login-puzzle-component/mocks/mockForStory.js +0 -38
- package/dist/components/notice-component/components/NoticeComponent.js +0 -96
- package/dist/components/notice-component/index.js +0 -10
- package/dist/components/notice-component/mocks/mockForStory.js +0 -20
- package/dist/components/pattern-component/components/PatternComponent.js +0 -78
- package/dist/components/pattern-component/index.js +0 -10
- package/dist/components/pattern-component/mocks/mockForStory.js +0 -35
- package/dist/components/pdf-component/components/PdfComponent.js +0 -122
- package/dist/components/pdf-component/components/PdfVisor.js +0 -187
- package/dist/components/pdf-component/index.js +0 -20
- package/dist/components/pdf-component/mocks/mockForProps.js +0 -38
- package/dist/components/referral-component/components/EmailPill.js +0 -26
- package/dist/components/referral-component/components/ReferralComponent.js +0 -115
- package/dist/components/referral-component/components/StepOne.js +0 -170
- package/dist/components/referral-component/components/StepTwo.js +0 -57
- package/dist/components/referral-component/index.js +0 -10
- package/dist/components/referral-component/mocks/mockForStory.js +0 -40
- package/dist/components/survey-component/components/ApplicableBox.js +0 -49
- package/dist/components/survey-component/components/OpinionBox.js +0 -45
- package/dist/components/survey-component/components/SurveyComponent.js +0 -150
- package/dist/components/survey-component/components/TextBox.js +0 -40
- package/dist/components/survey-component/index.js +0 -10
- package/dist/components/survey-component/mocks/mockForStory.js +0 -14
- package/dist/components/terminal-puzzle-component/components/FilesGroup/Item.js +0 -28
- package/dist/components/terminal-puzzle-component/components/FilesGroup/index.js +0 -76
- package/dist/components/terminal-puzzle-component/components/Image/index.js +0 -22
- package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +0 -216
- package/dist/components/terminal-puzzle-component/components/Visor/index.js +0 -129
- package/dist/components/terminal-puzzle-component/components/utils/index.js +0 -26
- package/dist/components/terminal-puzzle-component/index.js +0 -10
- package/dist/components/terminal-puzzle-component/mocks/mockForStory.js +0 -188
- package/dist/components/test-component/components/Container.js +0 -211
- package/dist/components/test-component/components/Feedbacks.js +0 -48
- package/dist/components/test-component/components/Questions.js +0 -145
- package/dist/components/test-component/components/Results.js +0 -208
- package/dist/components/test-component/components/TestComponent.js +0 -302
- package/dist/components/test-component/index.js +0 -10
- package/dist/components/test-component/mocks/mockForStory.js +0 -113
- package/dist/components/text-click-puzzle-component/components/TextClickPuzzleComponent.js +0 -387
- package/dist/components/text-click-puzzle-component/index.js +0 -10
- package/dist/components/text-click-puzzle-component/mocks/mockForStory.js +0 -485
- package/dist/components/text-click-puzzle-component/utils/index.js +0 -76
- package/dist/components/url-component/components/UrlComponent.js +0 -88
- package/dist/components/url-component/index.js +0 -10
- package/dist/components/url-component/mocks/mockForProps.js +0 -20
- package/dist/components/video-component/components/VideoComponent.js +0 -73
- package/dist/components/video-component/index.js +0 -10
- package/dist/components/video-component/mocks/mockForStory.js +0 -94
- package/dist/components/video-visor/components/VideoControllers/BufferBar.js +0 -108
- package/dist/components/video-visor/components/VideoControllers/ControlButtons.js +0 -31
- package/dist/components/video-visor/components/VideoControllers/FinishedVideoButtons.js +0 -32
- package/dist/components/video-visor/components/VideoControllers/PlayInitButton.js +0 -37
- package/dist/components/video-visor/components/VideoControllers/SkipButton.js +0 -37
- package/dist/components/video-visor/components/VideoControllers/Timer.js +0 -37
- package/dist/components/video-visor/components/VideoControllers/VolumeBar.js +0 -92
- package/dist/components/video-visor/components/VideoControllers/index.js +0 -122
- package/dist/components/video-visor/components/VideoVisor.js +0 -271
- package/dist/components/video-visor/index.js +0 -10
- package/dist/components/video-visor/mocks/mockForStory.js +0 -42
- package/dist/components/web-builder-puzzle-component/Popups/PopupColorComponent/index.js +0 -87
- package/dist/components/web-builder-puzzle-component/Popups/PopupImageComponent/index.js +0 -94
- package/dist/components/web-builder-puzzle-component/Popups/PopupTextComponent/index.js +0 -114
- package/dist/components/web-builder-puzzle-component/Popups/index.js +0 -27
- package/dist/components/web-builder-puzzle-component/Templates/Bank.js +0 -98
- package/dist/components/web-builder-puzzle-component/Templates/Facebook.js +0 -37
- package/dist/components/web-builder-puzzle-component/Templates/resourcePath.js +0 -9
- package/dist/components/web-builder-puzzle-component/components/EditButton/index.js +0 -28
- package/dist/components/web-builder-puzzle-component/components/Feedback/index.js +0 -41
- package/dist/components/web-builder-puzzle-component/components/PublishButton/index.js +0 -29
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/BankBody.js +0 -118
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/FacebookBody.js +0 -149
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/index.js +0 -25
- package/dist/components/web-builder-puzzle-component/components/WebBuilderFront/index.js +0 -89
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/BankHeader.js +0 -84
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/FacebookHeader.js +0 -38
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/index.js +0 -40
- package/dist/components/web-builder-puzzle-component/components/WebBuilderPuzzleComponent.js +0 -302
- package/dist/components/web-builder-puzzle-component/components/WebBuilderTopBar/index.js +0 -30
- package/dist/components/web-builder-puzzle-component/index.js +0 -10
- package/dist/components/web-builder-puzzle-component/mocks/mockForStory.js +0 -27
- package/dist/components/writer-puzzle-component/components/ElectionComponent.js +0 -69
- package/dist/components/writer-puzzle-component/components/FeedbackComponent.js +0 -97
- package/dist/components/writer-puzzle-component/components/FeedbackElement.js +0 -32
- package/dist/components/writer-puzzle-component/components/FinishedTextComponent.js +0 -25
- package/dist/components/writer-puzzle-component/components/FixedComponent.js +0 -120
- package/dist/components/writer-puzzle-component/components/SingleElection.js +0 -85
- package/dist/components/writer-puzzle-component/components/WriterPuzzleComponent.js +0 -450
- package/dist/components/writer-puzzle-component/index.js +0 -10
- package/dist/components/writer-puzzle-component/mocks/mockForStory.js +0 -1194
- package/dist/components/zoom-test/components/ZoomTest.js +0 -73
- package/dist/components/zoom-test/index.js +0 -10
- package/dist/components/zoom-test/mocks/mockForStory.js +0 -21
- package/dist/helpers/LangIsRtl.js +0 -16
- package/dist/helpers/LightSet.js +0 -35
- package/dist/helpers/LodController.js +0 -28
- package/dist/helpers/deviceDetection.js +0 -21
- package/dist/helpers/drawLOD.js +0 -310
- package/dist/helpers/index.js +0 -268
- package/dist/helpers/lodStats.js +0 -55
- package/dist/helpers/mocker.js +0 -116
- package/dist/helpers/useEkho.js +0 -172
- package/dist/helpers/useGLB.js +0 -57
- package/dist/helpers/useStateMachine.js +0 -277
- package/dist/helpers/useTimeout.js +0 -32
- package/dist/helpers/useWindowSize.js +0 -44
- package/dist/index.js +0 -16
- package/dist/test/testSceneWrapper.js +0 -31
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _Container = _interopRequireDefault(require("./Container"));
|
|
10
|
-
var _Results = _interopRequireDefault(require("./Results"));
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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); }
|
|
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; }
|
|
14
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
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."); }
|
|
16
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
17
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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; }
|
|
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; }
|
|
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); }
|
|
23
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
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); }
|
|
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; } }
|
|
28
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
-
var TestComponent = function TestComponent(_ref) {
|
|
30
|
-
var test = _ref.test,
|
|
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;
|
|
41
|
-
var questions = test.questions;
|
|
42
|
-
var _useState = (0, _react.useState)({}),
|
|
43
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
result = _useState2[0],
|
|
45
|
-
setResult = _useState2[1];
|
|
46
|
-
var _useState3 = (0, _react.useState)(),
|
|
47
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
48
|
-
interval = _useState4[0],
|
|
49
|
-
saveInterval = _useState4[1];
|
|
50
|
-
var _useState5 = (0, _react.useState)(0),
|
|
51
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
52
|
-
tries = _useState6[0],
|
|
53
|
-
setTries = _useState6[1];
|
|
54
|
-
var _useState7 = (0, _react.useState)([]),
|
|
55
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
56
|
-
correctQuestions = _useState8[0],
|
|
57
|
-
setCorrectQuestions = _useState8[1];
|
|
58
|
-
var _useState9 = (0, _react.useState)(countdown.time),
|
|
59
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
60
|
-
time = _useState10[0],
|
|
61
|
-
setTime = _useState10[1];
|
|
62
|
-
var _useState11 = (0, _react.useState)(false),
|
|
63
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
64
|
-
answeredPage = _useState12[0],
|
|
65
|
-
answerPage = _useState12[1];
|
|
66
|
-
var _useState13 = (0, _react.useState)('test'),
|
|
67
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
68
|
-
view = _useState14[0],
|
|
69
|
-
changeView = _useState14[1];
|
|
70
|
-
var _useState15 = (0, _react.useState)(true),
|
|
71
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
72
|
-
isFirst = _useState16[0],
|
|
73
|
-
changeFirst = _useState16[1];
|
|
74
|
-
var _useState17 = (0, _react.useState)({}),
|
|
75
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
76
|
-
showingResult = _useState18[0],
|
|
77
|
-
setShowingResult = _useState18[1];
|
|
78
|
-
var _useState19 = (0, _react.useState)({}),
|
|
79
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
|
80
|
-
historicAnswers = _useState20[0],
|
|
81
|
-
setHistoric = _useState20[1];
|
|
82
|
-
var _useState21 = (0, _react.useState)(false),
|
|
83
|
-
_useState22 = _slicedToArray(_useState21, 2),
|
|
84
|
-
timeOver = _useState22[0],
|
|
85
|
-
setTimeOver = _useState22[1];
|
|
86
|
-
var isRequired = required || test.required || false;
|
|
87
|
-
var rewardedCorrectAnswers = (0, _react.useRef)({});
|
|
88
|
-
var _useState23 = (0, _react.useState)(),
|
|
89
|
-
_useState24 = _slicedToArray(_useState23, 2),
|
|
90
|
-
calculatedMinimum = _useState24[0],
|
|
91
|
-
setCalculateMinimum = _useState24[1];
|
|
92
|
-
var _soundActions = _slicedToArray(soundActions, 2),
|
|
93
|
-
playSound = _soundActions[0],
|
|
94
|
-
stop = _soundActions[1];
|
|
95
|
-
var updateForm = function updateForm(optionSelected, question, index, inputType, answerId) {
|
|
96
|
-
var actualAnswer = _objectSpread(_objectSpread({}, optionSelected), {}, {
|
|
97
|
-
index: index
|
|
98
|
-
});
|
|
99
|
-
if (tries > 0) {
|
|
100
|
-
actualAnswer.rewards = actualAnswer.rewards.filter(function (reward) {
|
|
101
|
-
return !historicAnswers[optionSelected.id] || reward.points < 0;
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
if (result[question]) {
|
|
105
|
-
// Check if any answer is checked in order to be able to unchecked it
|
|
106
|
-
var checkIfOptionExisted = result[question].find(function (element) {
|
|
107
|
-
return element.id === answerId;
|
|
108
|
-
});
|
|
109
|
-
if (checkIfOptionExisted) {
|
|
110
|
-
if (checkIfOptionExisted.id === optionSelected.id) {
|
|
111
|
-
var answerToUnCheck = result[question].find(function (element) {
|
|
112
|
-
return element.id === answerId;
|
|
113
|
-
});
|
|
114
|
-
var indexOfAnswerToUnCheck = result[question].indexOf(answerToUnCheck);
|
|
115
|
-
result[question].splice(indexOfAnswerToUnCheck, 1);
|
|
116
|
-
// no answers, no run
|
|
117
|
-
if (result[question].length === 0) {
|
|
118
|
-
answerPage(false);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// if there is already an option checked
|
|
124
|
-
else {
|
|
125
|
-
result[question].push(actualAnswer);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// if no option is checked
|
|
129
|
-
else {
|
|
130
|
-
result[question] = [actualAnswer];
|
|
131
|
-
}
|
|
132
|
-
var actualResult;
|
|
133
|
-
if (inputType === 'isRadio') {
|
|
134
|
-
actualResult = _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, question, [actualAnswer]));
|
|
135
|
-
} else {
|
|
136
|
-
actualResult = _objectSpread({}, result);
|
|
137
|
-
}
|
|
138
|
-
setResult(actualResult);
|
|
139
|
-
setShowingResult(actualResult);
|
|
140
|
-
setHistoric(_objectSpread(_objectSpread({}, historicAnswers), {}, _defineProperty({}, optionSelected.id, _objectSpread({}, optionSelected))));
|
|
141
|
-
answerPage(true);
|
|
142
|
-
};
|
|
143
|
-
(0, _react.useEffect)(function () {
|
|
144
|
-
if (audio !== null && audio !== void 0 && audio.url) {
|
|
145
|
-
playSound(audio.url, 'tts');
|
|
146
|
-
}
|
|
147
|
-
}, [playSound, audio]);
|
|
148
|
-
var getCorrectQuestions = questions.map(function (q) {
|
|
149
|
-
var allQuestionsWithHisCorrectAnswers = q.answers.filter(function (a) {
|
|
150
|
-
return a.isCorrect;
|
|
151
|
-
});
|
|
152
|
-
var correctAnswersPerQuestions = [];
|
|
153
|
-
allQuestionsWithHisCorrectAnswers.forEach(function (el) {
|
|
154
|
-
correctAnswersPerQuestions.push(el.id);
|
|
155
|
-
});
|
|
156
|
-
return {
|
|
157
|
-
question: q.id,
|
|
158
|
-
answers: correctAnswersPerQuestions
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
(0, _react.useEffect)(function () {
|
|
162
|
-
setCorrectQuestions(getCorrectQuestions);
|
|
163
|
-
}, [getCorrectQuestions]);
|
|
164
|
-
(0, _react.useEffect)(function () {
|
|
165
|
-
if (minimumPercentage) {
|
|
166
|
-
var calculateMinimum = Math.ceil(questions.length * minimumPercentage / 100);
|
|
167
|
-
setCalculateMinimum(calculateMinimum);
|
|
168
|
-
}
|
|
169
|
-
}, [questions.length, minimumPercentage]);
|
|
170
|
-
(0, _react.useEffect)(function () {
|
|
171
|
-
if (time === 0) {
|
|
172
|
-
clearInterval(interval);
|
|
173
|
-
answerPage(false);
|
|
174
|
-
setTimeOver(true);
|
|
175
|
-
changeView('results');
|
|
176
|
-
stop('tts');
|
|
177
|
-
}
|
|
178
|
-
}, [interval, stop, time]);
|
|
179
|
-
var showResults = function showResults() {
|
|
180
|
-
clearInterval(interval);
|
|
181
|
-
answerPage(false);
|
|
182
|
-
changeView('results');
|
|
183
|
-
var parsedShowingResult = _objectSpread({}, showingResult);
|
|
184
|
-
setShowingResult(parsedShowingResult);
|
|
185
|
-
stop('tts');
|
|
186
|
-
};
|
|
187
|
-
var finishTest = function finishTest() {
|
|
188
|
-
var actualResult = {
|
|
189
|
-
correctQuestions: correctQuestions.length,
|
|
190
|
-
result: result,
|
|
191
|
-
status: 'resolved'
|
|
192
|
-
};
|
|
193
|
-
var resultKeys = Object.keys(result);
|
|
194
|
-
resultKeys.forEach(function (k) {
|
|
195
|
-
result[k].forEach(function (option) {
|
|
196
|
-
if (rewardedCorrectAnswers.current[option.id]) {
|
|
197
|
-
option.rewards = [];
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
emitEvent({
|
|
202
|
-
type: 'saveTest',
|
|
203
|
-
payload: actualResult
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
var restartTest = function restartTest() {
|
|
207
|
-
var finishAddPoints = function finishAddPoints() {
|
|
208
|
-
setShowingResult({});
|
|
209
|
-
setHistoric({});
|
|
210
|
-
changeView('test');
|
|
211
|
-
setResult({});
|
|
212
|
-
setTime(countdown.time);
|
|
213
|
-
setTimeOver(false);
|
|
214
|
-
if (audio !== null && audio !== void 0 && audio.url) {
|
|
215
|
-
playSound(audio.url, 'tts');
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
var resultAnswers = Object.values(result);
|
|
219
|
-
resultAnswers.forEach(function (question) {
|
|
220
|
-
question.forEach(function (a) {
|
|
221
|
-
if (a.isCorrect) {
|
|
222
|
-
if (!rewardedCorrectAnswers.current[a.id]) {
|
|
223
|
-
rewardedCorrectAnswers.current[a.id] = true;
|
|
224
|
-
} else {
|
|
225
|
-
a.rewards = [];
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
var rewards = resultAnswers.reduce(function (acc, current) {
|
|
231
|
-
var valueToReturn = [];
|
|
232
|
-
current.forEach(function (answer) {
|
|
233
|
-
valueToReturn.push(answer.rewards);
|
|
234
|
-
});
|
|
235
|
-
return [].concat(_toConsumableArray(acc), _toConsumableArray(valueToReturn.flat()));
|
|
236
|
-
}, []);
|
|
237
|
-
if (timeOver && countdown.rewards) {
|
|
238
|
-
rewards = [].concat(_toConsumableArray(rewards), _toConsumableArray(countdown.rewards));
|
|
239
|
-
}
|
|
240
|
-
emitEvent({
|
|
241
|
-
type: 'addPoints',
|
|
242
|
-
payload: rewards,
|
|
243
|
-
complex: true,
|
|
244
|
-
finish: false,
|
|
245
|
-
onFinish: finishAddPoints
|
|
246
|
-
});
|
|
247
|
-
emitEvent({
|
|
248
|
-
type: 'failTest'
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
var translate = function translate(id, values) {
|
|
252
|
-
return emitEvent({
|
|
253
|
-
type: 'translate',
|
|
254
|
-
payload: id,
|
|
255
|
-
values: values
|
|
256
|
-
});
|
|
257
|
-
};
|
|
258
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
259
|
-
className: "test--container__overlay"
|
|
260
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
261
|
-
className: "test--container",
|
|
262
|
-
dir: "auto"
|
|
263
|
-
}, view !== 'results' ? /*#__PURE__*/_react.default.createElement(_Container.default, {
|
|
264
|
-
result: result,
|
|
265
|
-
time: time,
|
|
266
|
-
setTries: setTries,
|
|
267
|
-
tries: tries,
|
|
268
|
-
answerPage: answerPage,
|
|
269
|
-
setTime: setTime,
|
|
270
|
-
paused: pause,
|
|
271
|
-
saveInterval: saveInterval,
|
|
272
|
-
disabled: view !== 'test',
|
|
273
|
-
answered: answeredPage || view !== 'test',
|
|
274
|
-
questions: questions,
|
|
275
|
-
updateForm: updateForm,
|
|
276
|
-
showResults: showResults,
|
|
277
|
-
translate: translate,
|
|
278
|
-
soundActions: soundActions,
|
|
279
|
-
view: view,
|
|
280
|
-
correctQuestions: correctQuestions,
|
|
281
|
-
feedbacksOnlyWhenReview: feedbacksOnlyWhenReview
|
|
282
|
-
}) : /*#__PURE__*/_react.default.createElement(_Results.default, {
|
|
283
|
-
reviewTest: function reviewTest() {
|
|
284
|
-
changeFirst(false);
|
|
285
|
-
changeView('review');
|
|
286
|
-
},
|
|
287
|
-
isFirst: isFirst,
|
|
288
|
-
finishTest: finishTest,
|
|
289
|
-
time: time,
|
|
290
|
-
mandatory: isRequired,
|
|
291
|
-
restartTest: restartTest,
|
|
292
|
-
result: result,
|
|
293
|
-
correctQuestions: correctQuestions,
|
|
294
|
-
timeOver: timeOver,
|
|
295
|
-
timeOverText: countdown.text,
|
|
296
|
-
emitEvent: emitEvent,
|
|
297
|
-
soundActions: soundActions,
|
|
298
|
-
minimumPercentage: calculatedMinimum
|
|
299
|
-
})));
|
|
300
|
-
};
|
|
301
|
-
var _default = TestComponent;
|
|
302
|
-
exports.default = _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _TestComponent = _interopRequireDefault(require("./components/TestComponent"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _TestComponent.default;
|
|
10
|
-
exports.default = _default;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.mockProps2 = exports.default = void 0;
|
|
7
|
-
var _mocker = require("helpers/mocker");
|
|
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); }
|
|
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; }
|
|
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; }
|
|
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 */
|
|
14
|
-
var mockProps = {
|
|
15
|
-
emitEvent: _mocker.emitEvent,
|
|
16
|
-
soundActions: _mocker.soundActions,
|
|
17
|
-
audio: {
|
|
18
|
-
url: 'https://min.int.gamelearn.io/cooked.gl-lms-storage/clients/58dccfba26561500117caf53/documents/Cat-sound.mp3'
|
|
19
|
-
},
|
|
20
|
-
test: {
|
|
21
|
-
required: true,
|
|
22
|
-
questions: [{
|
|
23
|
-
id: 'q1',
|
|
24
|
-
text: 'q1',
|
|
25
|
-
answers: [{
|
|
26
|
-
id: 'q1a1',
|
|
27
|
-
text: 'q1text',
|
|
28
|
-
rewards: [{
|
|
29
|
-
id: 'id010001',
|
|
30
|
-
name: 'love',
|
|
31
|
-
points: -25,
|
|
32
|
-
type: 'score'
|
|
33
|
-
}],
|
|
34
|
-
isCorrect: false,
|
|
35
|
-
feedback: 'A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet. There were a couple of tools out there, but none of them met my standards and since I am a web designer I thought: why not do it myself and help others along the way? Character Count Online is a free online character and word counting tool. All resu'
|
|
36
|
-
}, {
|
|
37
|
-
id: 'q1a2',
|
|
38
|
-
text: 'q1text2',
|
|
39
|
-
rewards: [{
|
|
40
|
-
id: 'id010001',
|
|
41
|
-
name: 'love',
|
|
42
|
-
points: -25,
|
|
43
|
-
type: 'score'
|
|
44
|
-
}],
|
|
45
|
-
feedback: '222 A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet. There were a couple of tools out there, but none of them met my standards and since I am a web designer I thought: why not do it myself and help others along the way? Character Count Online is a free online character and word counting tool. All resu',
|
|
46
|
-
isCorrect: false
|
|
47
|
-
}, {
|
|
48
|
-
id: 'q1a3',
|
|
49
|
-
text: 'q1text3',
|
|
50
|
-
rewards: [{
|
|
51
|
-
id: 'id010001',
|
|
52
|
-
name: 'love',
|
|
53
|
-
points: 50,
|
|
54
|
-
type: 'score'
|
|
55
|
-
}],
|
|
56
|
-
feedback: 'okkk A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet. There were a couple of tools out there, but none of them met my standards and since I am a web designer I thought: why not do it myself and help others along the way? Character Count Online is a free online character and word counting tool. All resu',
|
|
57
|
-
isCorrect: true
|
|
58
|
-
}]
|
|
59
|
-
}, {
|
|
60
|
-
id: 'q2',
|
|
61
|
-
text: 'q2',
|
|
62
|
-
answers: [{
|
|
63
|
-
id: 'q2a1',
|
|
64
|
-
text: 'cebolla en tortilla',
|
|
65
|
-
rewards: [{
|
|
66
|
-
id: 'id010001',
|
|
67
|
-
name: 'love',
|
|
68
|
-
points: -25,
|
|
69
|
-
type: 'score'
|
|
70
|
-
}],
|
|
71
|
-
isCorrect: false,
|
|
72
|
-
feedback: 'A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet. There were a couple of tools out there, but none of them met my standards and since I am a web designer I thought: why not do it myself and help others along the way? Character Count Online is a free online character and word counting tool. All resu'
|
|
73
|
-
}, {
|
|
74
|
-
id: 'q2a2',
|
|
75
|
-
text: 'love',
|
|
76
|
-
rewards: [{
|
|
77
|
-
id: 'id010001',
|
|
78
|
-
name: 'love',
|
|
79
|
-
points: -25,
|
|
80
|
-
type: 'score'
|
|
81
|
-
}],
|
|
82
|
-
feedback: '222',
|
|
83
|
-
isCorrect: false
|
|
84
|
-
}, {
|
|
85
|
-
id: 'q2a3',
|
|
86
|
-
text: 'hate',
|
|
87
|
-
rewards: [{
|
|
88
|
-
id: 'id010001',
|
|
89
|
-
name: 'love',
|
|
90
|
-
points: 50,
|
|
91
|
-
type: 'score'
|
|
92
|
-
}],
|
|
93
|
-
feedback: 'okkk',
|
|
94
|
-
isCorrect: true
|
|
95
|
-
}]
|
|
96
|
-
}]
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
var mockProps2 = _objectSpread(_objectSpread({}, mockProps), {}, {
|
|
100
|
-
countdown: {
|
|
101
|
-
time: 5,
|
|
102
|
-
text: 'se te acabao el tiempo',
|
|
103
|
-
rewards: [{
|
|
104
|
-
id: 'id010001',
|
|
105
|
-
name: 'love',
|
|
106
|
-
points: -25,
|
|
107
|
-
type: 'score'
|
|
108
|
-
}]
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
exports.mockProps2 = mockProps2;
|
|
112
|
-
var _default = mockProps;
|
|
113
|
-
exports.default = _default;
|