@gamelearn/arcade-components 2.41.1 → 3.0.2
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 +9 -6
- package/dist/arcade-components.cjs +274 -0
- package/dist/arcade-components.js +57929 -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,387 +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 _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
|
|
10
|
-
var _feedbackComponent = _interopRequireDefault(require("../../feedback-component"));
|
|
11
|
-
var _utils = require("../utils");
|
|
12
|
-
var _LangIsRtl = _interopRequireDefault(require("../../../helpers/LangIsRtl"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
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); }
|
|
15
|
-
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; }
|
|
16
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
17
|
-
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."); }
|
|
18
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
|
-
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; }
|
|
23
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
24
|
-
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); }
|
|
25
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
-
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."); }
|
|
27
|
-
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); }
|
|
28
|
-
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; }
|
|
29
|
-
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; } }
|
|
30
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
-
var TextClickPuzzleComponent = function TextClickPuzzleComponent(_ref) {
|
|
32
|
-
var emitEvent = _ref.emitEvent,
|
|
33
|
-
showFrames = _ref.showFrames,
|
|
34
|
-
styles = _ref.styles,
|
|
35
|
-
list = _ref.list,
|
|
36
|
-
soundActions = _ref.soundActions,
|
|
37
|
-
description = _ref.description,
|
|
38
|
-
setInfo = _ref.setInfo,
|
|
39
|
-
setResolveAction = _ref.setResolveAction,
|
|
40
|
-
keyboardControl = _ref.keyboardControl,
|
|
41
|
-
backgroundImage = _ref.backgroundImage;
|
|
42
|
-
var _useState = (0, _react.useState)({
|
|
43
|
-
result: null,
|
|
44
|
-
show: false,
|
|
45
|
-
text: '',
|
|
46
|
-
timeout: false
|
|
47
|
-
}),
|
|
48
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
-
feedbackData = _useState2[0],
|
|
50
|
-
setFeedbackData = _useState2[1];
|
|
51
|
-
var _soundActions = _slicedToArray(soundActions, 1),
|
|
52
|
-
playSound = _soundActions[0];
|
|
53
|
-
var _useState3 = (0, _react.useState)(0),
|
|
54
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
-
currentSlide = _useState4[0],
|
|
56
|
-
setCurrentSlide = _useState4[1];
|
|
57
|
-
var _useState5 = (0, _react.useState)(0),
|
|
58
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
59
|
-
numberAllCorrectFragments = _useState6[0],
|
|
60
|
-
setNumberAllCorrectFragments = _useState6[1];
|
|
61
|
-
var _useState7 = (0, _react.useState)(0),
|
|
62
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
63
|
-
correctTextFragmentsAccumulated = _useState8[0],
|
|
64
|
-
setCorrectTextFragmentsAccumulated = _useState8[1];
|
|
65
|
-
var correctTextFragmentsPartial = (0, _react.useRef)(0);
|
|
66
|
-
var accRewards = (0, _react.useRef)([]);
|
|
67
|
-
var _useState9 = (0, _react.useState)(0),
|
|
68
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
69
|
-
orderCounter = _useState10[0],
|
|
70
|
-
setOrderCounter = _useState10[1];
|
|
71
|
-
var _useState11 = (0, _react.useState)(),
|
|
72
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
73
|
-
transitionToNextSlide = _useState12[0],
|
|
74
|
-
setTransitionToNextSlide = _useState12[1];
|
|
75
|
-
var translate = (0, _react.useCallback)(function (id) {
|
|
76
|
-
return emitEvent({
|
|
77
|
-
type: 'translate',
|
|
78
|
-
payload: id
|
|
79
|
-
});
|
|
80
|
-
}, [emitEvent]);
|
|
81
|
-
var parsedText = (0, _react.useRef)(null);
|
|
82
|
-
var isCompleted = (0, _react.useCallback)(function () {
|
|
83
|
-
return correctTextFragmentsPartial.current === list[currentSlide].correctTexts.length || list[currentSlide].hasClickOnce && correctTextFragmentsPartial.current >= 1;
|
|
84
|
-
}, [currentSlide, list]);
|
|
85
|
-
var modifyFeedbackData = (0, _react.useCallback)(function (show, data) {
|
|
86
|
-
if (show) emitEvent({
|
|
87
|
-
type: 'hidePuzzleButtons',
|
|
88
|
-
payload: true
|
|
89
|
-
});
|
|
90
|
-
setFeedbackData(function (prevState) {
|
|
91
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
92
|
-
show: show
|
|
93
|
-
}, data);
|
|
94
|
-
});
|
|
95
|
-
}, [emitEvent]);
|
|
96
|
-
var goForward = (0, _react.useCallback)(function () {
|
|
97
|
-
if (isCompleted()) {
|
|
98
|
-
setFeedbackData(function (prevState) {
|
|
99
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
100
|
-
result: false
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
correctTextFragmentsPartial.current = 0;
|
|
104
|
-
if (correctTextFragmentsAccumulated === numberAllCorrectFragments) {
|
|
105
|
-
var totalRewards = accRewards.current.reduce(function (acc, current) {
|
|
106
|
-
var existing = acc.findIndex(function (r) {
|
|
107
|
-
return r.id === current.id;
|
|
108
|
-
});
|
|
109
|
-
if (existing >= 0) {
|
|
110
|
-
acc[existing].points += current.points;
|
|
111
|
-
} else {
|
|
112
|
-
acc.push(_objectSpread({}, current));
|
|
113
|
-
}
|
|
114
|
-
return acc;
|
|
115
|
-
}, []);
|
|
116
|
-
emitEvent({
|
|
117
|
-
type: 'addPoints',
|
|
118
|
-
complex: true,
|
|
119
|
-
finish: true,
|
|
120
|
-
payload: totalRewards
|
|
121
|
-
});
|
|
122
|
-
emitEvent({
|
|
123
|
-
type: 'passPuzzle'
|
|
124
|
-
});
|
|
125
|
-
} else {
|
|
126
|
-
parsedText.current = null;
|
|
127
|
-
setCurrentSlide(currentSlide + 1);
|
|
128
|
-
setOrderCounter(0);
|
|
129
|
-
setTransitionToNextSlide(true);
|
|
130
|
-
setTimeout(function () {
|
|
131
|
-
setTransitionToNextSlide(false);
|
|
132
|
-
}, 1200);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}, [isCompleted, correctTextFragmentsAccumulated, numberAllCorrectFragments, emitEvent, currentSlide]);
|
|
136
|
-
var handleFeedbackFuncionOnClose = (0, _react.useCallback)(function () {
|
|
137
|
-
emitEvent({
|
|
138
|
-
type: 'hidePuzzleButtons',
|
|
139
|
-
payload: false
|
|
140
|
-
});
|
|
141
|
-
goForward();
|
|
142
|
-
setFeedbackData(function (prevState) {
|
|
143
|
-
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
144
|
-
show: false,
|
|
145
|
-
text: ''
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
var allElementsWithClassTextClickFailed = document.querySelectorAll('.text-click__failed');
|
|
149
|
-
if (allElementsWithClassTextClickFailed.length > 0) {
|
|
150
|
-
allElementsWithClassTextClickFailed.forEach(function (el) {
|
|
151
|
-
return el.classList.remove('text-click__failed');
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
}, [emitEvent, goForward]);
|
|
155
|
-
var handleCorrectClick = (0, _react.useCallback)(function (allDataTextIds, specificFeedback) {
|
|
156
|
-
var _list$currentSlide$in;
|
|
157
|
-
allDataTextIds.forEach(function (el) {
|
|
158
|
-
return el.classList.add('text-click__success');
|
|
159
|
-
});
|
|
160
|
-
setCorrectTextFragmentsAccumulated(correctTextFragmentsAccumulated + 1);
|
|
161
|
-
correctTextFragmentsPartial.current += 1;
|
|
162
|
-
playSound('score');
|
|
163
|
-
// si tiene feedback general definido
|
|
164
|
-
if ((_list$currentSlide$in = list[currentSlide].info.solution.right) !== null && _list$currentSlide$in !== void 0 && _list$currentSlide$in.desc) {
|
|
165
|
-
// solo muestra la caja verde y suma puntos cuando resuelves todos los fragmentos correctos
|
|
166
|
-
if (isCompleted()) {
|
|
167
|
-
accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(list[currentSlide].info.solution.right.rewards));
|
|
168
|
-
modifyFeedbackData(true, {
|
|
169
|
-
result: true,
|
|
170
|
-
text: list[currentSlide].info.solution.right.desc,
|
|
171
|
-
timeout: false
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// si no tiene feedback general y tiene specificFeedbacks definido
|
|
176
|
-
else if (list[currentSlide].info.solution.right.desc === '' && specificFeedback !== null && specificFeedback !== void 0 && specificFeedback.desc) {
|
|
177
|
-
var _specificFeedback$rew;
|
|
178
|
-
accRewards.current = specificFeedback !== null && specificFeedback !== void 0 && (_specificFeedback$rew = specificFeedback.rewards) !== null && _specificFeedback$rew !== void 0 && _specificFeedback$rew.length ? [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(specificFeedback === null || specificFeedback === void 0 ? void 0 : specificFeedback.rewards)) : _toConsumableArray(accRewards.current);
|
|
179
|
-
modifyFeedbackData(true, {
|
|
180
|
-
result: true,
|
|
181
|
-
text: specificFeedback.desc,
|
|
182
|
-
timeout: false
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
// si no tiene feedback general ni specificFeedbacks,
|
|
186
|
-
// solo muestra la caja verde y suma puntos cuando resuelves todos los fragmentos correctos
|
|
187
|
-
else if (list[currentSlide].specificFeedbacks.specificCorrectFeedbacks) {
|
|
188
|
-
// si tiene puntos definidos por feedbacks correctos
|
|
189
|
-
accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(specificFeedback === null || specificFeedback === void 0 ? void 0 : specificFeedback.rewards));
|
|
190
|
-
if (isCompleted()) {
|
|
191
|
-
modifyFeedbackData(true, {
|
|
192
|
-
result: true,
|
|
193
|
-
timeout: true
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
// si tiene puntos generales
|
|
198
|
-
else if (isCompleted()) {
|
|
199
|
-
accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(list[currentSlide].info.solution.right.rewards));
|
|
200
|
-
modifyFeedbackData(true, {
|
|
201
|
-
result: true,
|
|
202
|
-
timeout: true
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}, [correctTextFragmentsAccumulated, playSound, list, currentSlide, isCompleted, modifyFeedbackData]);
|
|
206
|
-
var handleIncorrectClick = (0, _react.useCallback)(function (allDataTextIds, specificFeedback) {
|
|
207
|
-
allDataTextIds.forEach(function (el) {
|
|
208
|
-
return el.classList.add('text-click__failed');
|
|
209
|
-
});
|
|
210
|
-
playSound('fail');
|
|
211
|
-
emitEvent({
|
|
212
|
-
type: 'failPuzzle'
|
|
213
|
-
});
|
|
214
|
-
// si tiene feedback general definido
|
|
215
|
-
if (list[currentSlide].info.solution.wrong.desc !== '') {
|
|
216
|
-
accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(list[currentSlide].info.solution.wrong.rewards));
|
|
217
|
-
modifyFeedbackData(true, {
|
|
218
|
-
result: false,
|
|
219
|
-
text: list[currentSlide].info.solution.wrong.desc,
|
|
220
|
-
timeout: false
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
// si no tiene feedback general pero tiene specificFeedbacks definido
|
|
224
|
-
else if (list[currentSlide].info.solution.wrong.desc === '' && specificFeedback !== null && specificFeedback !== void 0 && specificFeedback.desc) {
|
|
225
|
-
var _specificFeedback$rew2;
|
|
226
|
-
accRewards.current = specificFeedback !== null && specificFeedback !== void 0 && (_specificFeedback$rew2 = specificFeedback.rewards) !== null && _specificFeedback$rew2 !== void 0 && _specificFeedback$rew2.length ? [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(specificFeedback === null || specificFeedback === void 0 ? void 0 : specificFeedback.rewards)) : _toConsumableArray(accRewards.current);
|
|
227
|
-
modifyFeedbackData(true, {
|
|
228
|
-
result: false,
|
|
229
|
-
text: specificFeedback.desc,
|
|
230
|
-
timeout: false
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
// si no tiene feedback general ni specificFeedbacks definido
|
|
234
|
-
else if (list[currentSlide].specificFeedbacks.specificWrongFeedbacks) {
|
|
235
|
-
// si tiene puntos definidos por feedbacks negativos
|
|
236
|
-
accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(specificFeedback === null || specificFeedback === void 0 ? void 0 : specificFeedback.rewards));
|
|
237
|
-
modifyFeedbackData(true, {
|
|
238
|
-
result: false,
|
|
239
|
-
timeout: true
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
// si tiene puntos generales definidos por feedbacks negativo
|
|
243
|
-
else {
|
|
244
|
-
accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(list[currentSlide].info.solution.wrong.rewards));
|
|
245
|
-
modifyFeedbackData(true, {
|
|
246
|
-
result: false,
|
|
247
|
-
timeout: true
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}, [playSound, emitEvent, list, currentSlide, modifyFeedbackData]);
|
|
251
|
-
var onClickMark = (0, _react.useCallback)(function (e, id) {
|
|
252
|
-
var _list$currentSlide, _list$currentSlide$sp, _list$currentSlide2, _list$currentSlide2$s;
|
|
253
|
-
e.stopPropagation();
|
|
254
|
-
var currentTextDom = document.querySelectorAll("[data-text-id=\"".concat(id, "\"]"));
|
|
255
|
-
var allDataTextIds = document.querySelectorAll("[data-text-id]");
|
|
256
|
-
var feedbackCorrect = list[currentSlide].correctTexts.find(function (element) {
|
|
257
|
-
return element.id === id;
|
|
258
|
-
});
|
|
259
|
-
var feedbackIncorrect = list[currentSlide].wrongTexts.find(function (element) {
|
|
260
|
-
return element.id === id;
|
|
261
|
-
});
|
|
262
|
-
var specificCorrectFeedback = (_list$currentSlide = list[currentSlide]) === null || _list$currentSlide === void 0 ? void 0 : (_list$currentSlide$sp = _list$currentSlide.specificFeedbacks) === null || _list$currentSlide$sp === void 0 ? void 0 : _list$currentSlide$sp.correctFeedbacks.find(function (fb) {
|
|
263
|
-
return fb.id === id;
|
|
264
|
-
});
|
|
265
|
-
var specificWrongFeedback = (_list$currentSlide2 = list[currentSlide]) === null || _list$currentSlide2 === void 0 ? void 0 : (_list$currentSlide2$s = _list$currentSlide2.specificFeedbacks) === null || _list$currentSlide2$s === void 0 ? void 0 : _list$currentSlide2$s.wrongFeedbacks.find(function (fb) {
|
|
266
|
-
return fb.id === id;
|
|
267
|
-
});
|
|
268
|
-
playSound('click-ui');
|
|
269
|
-
// si va en orden
|
|
270
|
-
if (list[currentSlide].hasClickOrder) {
|
|
271
|
-
// y lo has hecho bien
|
|
272
|
-
if (list[currentSlide].correctTexts[orderCounter].id === id) {
|
|
273
|
-
setOrderCounter(orderCounter + 1);
|
|
274
|
-
// hacer verde 🎉
|
|
275
|
-
handleCorrectClick(currentTextDom, specificCorrectFeedback);
|
|
276
|
-
} else if (list[currentSlide].correctTexts.find(function (c) {
|
|
277
|
-
return c.id === id;
|
|
278
|
-
}) && list[currentSlide].correctTexts[orderCounter].id !== id) {
|
|
279
|
-
// si has dado buena fuera de orden
|
|
280
|
-
allDataTextIds.forEach(function (el) {
|
|
281
|
-
return el.classList.remove('text-click__success');
|
|
282
|
-
});
|
|
283
|
-
setOrderCounter(0);
|
|
284
|
-
setCorrectTextFragmentsAccumulated(0);
|
|
285
|
-
correctTextFragmentsPartial.current = 0;
|
|
286
|
-
modifyFeedbackData(true, {
|
|
287
|
-
result: false,
|
|
288
|
-
text: list[currentSlide].info.orderFeedback.desc || translate('puzzles.incorrectOrder'),
|
|
289
|
-
timeout: false
|
|
290
|
-
});
|
|
291
|
-
setCurrentSlide(0);
|
|
292
|
-
} else {
|
|
293
|
-
// si has click en mala repuesta
|
|
294
|
-
handleIncorrectClick(currentTextDom, specificWrongFeedback);
|
|
295
|
-
}
|
|
296
|
-
} else if ((feedbackCorrect === null || feedbackCorrect === void 0 ? void 0 : feedbackCorrect.id) === id) {
|
|
297
|
-
// si no va en orden
|
|
298
|
-
// si la opción clickada es correcta
|
|
299
|
-
handleCorrectClick(currentTextDom, specificCorrectFeedback);
|
|
300
|
-
} else if ((feedbackIncorrect === null || feedbackIncorrect === void 0 ? void 0 : feedbackIncorrect.id) === id || id === 'allWrong') {
|
|
301
|
-
// si la opción clickada es incorrecta
|
|
302
|
-
handleIncorrectClick(currentTextDom, specificWrongFeedback);
|
|
303
|
-
}
|
|
304
|
-
}, [list, currentSlide, playSound, orderCounter, handleCorrectClick, modifyFeedbackData, translate, handleIncorrectClick]);
|
|
305
|
-
var recursiveStuff = (0, _react.useCallback)(function (jsx) {
|
|
306
|
-
return (0, _utils.getRecursiveJSX)(jsx, 0, list[currentSlide], onClickMark);
|
|
307
|
-
}, [currentSlide, list, onClickMark]);
|
|
308
|
-
var getnumberAllCorrectFragments = (0, _react.useCallback)(function () {
|
|
309
|
-
var counter = 0;
|
|
310
|
-
for (var i = 0; i < list.length; i += 1) {
|
|
311
|
-
if (list[i].hasClickOnce) {
|
|
312
|
-
counter += 1;
|
|
313
|
-
setNumberAllCorrectFragments(counter);
|
|
314
|
-
} else {
|
|
315
|
-
for (var j = 0; j < list[i].correctTexts.length; j += 1) {
|
|
316
|
-
counter += 1;
|
|
317
|
-
setNumberAllCorrectFragments(counter);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}, [list]);
|
|
322
|
-
(0, _react.useEffect)(function () {
|
|
323
|
-
var _list$currentSlide3;
|
|
324
|
-
if (list !== null && list !== void 0 && list[currentSlide]) {
|
|
325
|
-
setInfo(_objectSpread(_objectSpread({}, list[currentSlide].info), {}, {
|
|
326
|
-
description: description
|
|
327
|
-
}));
|
|
328
|
-
}
|
|
329
|
-
if ((_list$currentSlide3 = list[currentSlide]) !== null && _list$currentSlide3 !== void 0 && _list$currentSlide3.text) {
|
|
330
|
-
var jsx = (0, _htmlReactParser.default)(list[currentSlide].text);
|
|
331
|
-
parsedText.current = recursiveStuff(jsx);
|
|
332
|
-
getnumberAllCorrectFragments();
|
|
333
|
-
} else {
|
|
334
|
-
parsedText.current = '';
|
|
335
|
-
}
|
|
336
|
-
}, [currentSlide, description, getnumberAllCorrectFragments, list, recursiveStuff, setInfo]);
|
|
337
|
-
(0, _react.useEffect)(function () {
|
|
338
|
-
setResolveAction(function (callback) {
|
|
339
|
-
emitEvent({
|
|
340
|
-
type: 'hidePuzzleButtons',
|
|
341
|
-
payload: true
|
|
342
|
-
});
|
|
343
|
-
setTimeout(function () {
|
|
344
|
-
emitEvent({
|
|
345
|
-
type: 'hidePuzzleButtons',
|
|
346
|
-
payload: false
|
|
347
|
-
});
|
|
348
|
-
callback();
|
|
349
|
-
}, 2000);
|
|
350
|
-
});
|
|
351
|
-
}, [setResolveAction, emitEvent, list, currentSlide]);
|
|
352
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
353
|
-
className: "text-click text-click--".concat(styles),
|
|
354
|
-
style: (feedbackData.show ? {
|
|
355
|
-
pointerEvents: 'none'
|
|
356
|
-
} : null, backgroundImage !== null && backgroundImage !== void 0 && backgroundImage.url ? {
|
|
357
|
-
backgroundImage: "url(\"".concat(backgroundImage.url, "\")")
|
|
358
|
-
} : {})
|
|
359
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
360
|
-
className: "text-click__overlay"
|
|
361
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
362
|
-
className: "text-click__container ".concat(transitionToNextSlide ? 'slideInLeft' : '', " ")
|
|
363
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
364
|
-
className: "text-click__body"
|
|
365
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
366
|
-
className: "text-click__scroll",
|
|
367
|
-
dir: (0, _LangIsRtl.default)() ? 'rtl' : 'auto'
|
|
368
|
-
}, parsedText.current)))), showFrames && /*#__PURE__*/_react.default.createElement("div", {
|
|
369
|
-
className: "text-click__paginator"
|
|
370
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
371
|
-
className: "text-click__icon-check-circle-black"
|
|
372
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
373
|
-
className: "icon-check-circle-black"
|
|
374
|
-
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
375
|
-
className: "text-click__slide"
|
|
376
|
-
}, correctTextFragmentsAccumulated, " / ", numberAllCorrectFragments))), feedbackData.show && /*#__PURE__*/_react.default.createElement(_feedbackComponent.default, {
|
|
377
|
-
playSound: playSound,
|
|
378
|
-
success: feedbackData.result,
|
|
379
|
-
text: feedbackData.text,
|
|
380
|
-
translate: translate,
|
|
381
|
-
functionOnClose: handleFeedbackFuncionOnClose,
|
|
382
|
-
hasTimeout: feedbackData.timeout,
|
|
383
|
-
keyboardControl: keyboardControl
|
|
384
|
-
}));
|
|
385
|
-
};
|
|
386
|
-
var _default = TextClickPuzzleComponent;
|
|
387
|
-
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 _TextClickPuzzleComponent = _interopRequireDefault(require("./components/TextClickPuzzleComponent"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _TextClickPuzzleComponent.default;
|
|
10
|
-
exports.default = _default;
|