@gamelearn/arcade-components 2.41.0 → 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 -359
- 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,359 +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 _interactjs = _interopRequireDefault(require("interactjs"));
|
|
10
|
-
var _reactKonva = require("react-konva");
|
|
11
|
-
var _reactKonvaUtils = require("react-konva-utils");
|
|
12
|
-
var _feedbackComponent = _interopRequireDefault(require("../../feedback-component"));
|
|
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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
18
|
-
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."); }
|
|
19
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
-
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; }
|
|
22
|
-
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; }
|
|
23
|
-
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; }
|
|
24
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
25
|
-
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); }
|
|
26
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
-
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."); }
|
|
28
|
-
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); }
|
|
29
|
-
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; }
|
|
30
|
-
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; } }
|
|
31
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
-
var DragItemPuzzleComponent = function DragItemPuzzleComponent(_ref) {
|
|
33
|
-
var area = _ref.area,
|
|
34
|
-
image = _ref.image,
|
|
35
|
-
resolveObject = _ref.resolveObject,
|
|
36
|
-
info = _ref.info,
|
|
37
|
-
hasHighlights = _ref.hasHighlights,
|
|
38
|
-
consume = _ref.consume,
|
|
39
|
-
disableExit = _ref.disableExit,
|
|
40
|
-
emitEvent = _ref.emitEvent,
|
|
41
|
-
soundActions = _ref.soundActions,
|
|
42
|
-
keyboardControl = _ref.keyboardControl;
|
|
43
|
-
var solution = info.solution;
|
|
44
|
-
var areaRef = (0, _react.useRef)();
|
|
45
|
-
var areaTextRef = (0, _react.useRef)();
|
|
46
|
-
var stageRef = (0, _react.useRef)();
|
|
47
|
-
var canvas = (0, _react.useRef)();
|
|
48
|
-
var layerConfig = (0, _react.useRef)({});
|
|
49
|
-
var _useState = (0, _react.useState)(''),
|
|
50
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
-
resolvedClass = _useState2[0],
|
|
52
|
-
setResolveClass = _useState2[1];
|
|
53
|
-
var _useState3 = (0, _react.useState)(false),
|
|
54
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
-
imageLoaded = _useState4[0],
|
|
56
|
-
setImageLoaded = _useState4[1];
|
|
57
|
-
var _useState5 = (0, _react.useState)(false),
|
|
58
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
59
|
-
inventoryAutoOpen = _useState6[0],
|
|
60
|
-
setInventoryAutoOpen = _useState6[1];
|
|
61
|
-
var _useState7 = (0, _react.useState)(),
|
|
62
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
63
|
-
projectionConfig = _useState8[0],
|
|
64
|
-
setProjectionConfig = _useState8[1];
|
|
65
|
-
var _useState9 = (0, _react.useState)(new window.Image()),
|
|
66
|
-
_useState10 = _slicedToArray(_useState9, 1),
|
|
67
|
-
currentImage = _useState10[0];
|
|
68
|
-
var accRewards = (0, _react.useRef)([]);
|
|
69
|
-
var _soundActions = _slicedToArray(soundActions, 1),
|
|
70
|
-
playSound = _soundActions[0];
|
|
71
|
-
var translate = function translate(id) {
|
|
72
|
-
return emitEvent({
|
|
73
|
-
type: 'translate',
|
|
74
|
-
payload: id
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
(0, _react.useEffect)(function () {
|
|
78
|
-
disableExit(resolvedClass !== '');
|
|
79
|
-
}, [resolvedClass, disableExit]);
|
|
80
|
-
var intersectRect = function intersectRect(a, b) {
|
|
81
|
-
return (a.x + a.width > b.x && a.x + a.width <= b.x + b.width || b.x + b.width > a.x && b.x + b.width <= a.x + a.width) && (a.y + a.height > b.y && a.y + a.height <= b.y + b.height || b.y + b.height > a.y && b.y + b.height <= a.y + a.height);
|
|
82
|
-
};
|
|
83
|
-
var mouseEnterArea = function mouseEnterArea() {
|
|
84
|
-
if (areaRef && hasHighlights) {
|
|
85
|
-
areaRef.current.to({
|
|
86
|
-
duration: 0.25,
|
|
87
|
-
opacity: 0.75
|
|
88
|
-
});
|
|
89
|
-
areaTextRef.current.to({
|
|
90
|
-
duration: 0.25,
|
|
91
|
-
opacity: 0.4
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
var mouseLeaveArea = function mouseLeaveArea() {
|
|
96
|
-
if (areaRef && hasHighlights) {
|
|
97
|
-
areaRef.current.to({
|
|
98
|
-
duration: 0.25,
|
|
99
|
-
opacity: 0
|
|
100
|
-
});
|
|
101
|
-
areaTextRef.current.to({
|
|
102
|
-
duration: 0.25,
|
|
103
|
-
opacity: 0
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
var calculateOverArea = (0, _react.useCallback)(function (e) {
|
|
108
|
-
var over = false;
|
|
109
|
-
if (e) {
|
|
110
|
-
var stage = stageRef.current;
|
|
111
|
-
var lastMousePos = JSON.parse(e.relatedTarget.getAttribute('data-lastEvent'));
|
|
112
|
-
stage.setPointersPositions(lastMousePos);
|
|
113
|
-
var mousePos = stage.getPointerPosition();
|
|
114
|
-
var areaPos = areaRef.current.getClientRect({
|
|
115
|
-
relativeTo: stage
|
|
116
|
-
});
|
|
117
|
-
over = intersectRect(_objectSpread(_objectSpread({}, mousePos), {}, {
|
|
118
|
-
width: 1,
|
|
119
|
-
height: 1
|
|
120
|
-
}), areaPos);
|
|
121
|
-
}
|
|
122
|
-
return over;
|
|
123
|
-
}, []);
|
|
124
|
-
var checkCorrectObject = (0, _react.useCallback)(function (object) {
|
|
125
|
-
return object && resolveObject.uid === JSON.parse(object).uid;
|
|
126
|
-
}, [resolveObject.uid]);
|
|
127
|
-
var handleFinish = (0, _react.useCallback)(function () {
|
|
128
|
-
setResolveClass('');
|
|
129
|
-
emitEvent({
|
|
130
|
-
type: 'hidePuzzleButtons',
|
|
131
|
-
payload: false
|
|
132
|
-
});
|
|
133
|
-
emitEvent({
|
|
134
|
-
type: 'addPoints',
|
|
135
|
-
complex: true,
|
|
136
|
-
finish: true,
|
|
137
|
-
payload: accRewards.current
|
|
138
|
-
});
|
|
139
|
-
emitEvent({
|
|
140
|
-
type: 'passPuzzle'
|
|
141
|
-
});
|
|
142
|
-
if (consume) {
|
|
143
|
-
emitEvent({
|
|
144
|
-
type: 'consumeItem',
|
|
145
|
-
payload: {
|
|
146
|
-
uid: resolveObject.uid,
|
|
147
|
-
targetId: resolveObject.uid,
|
|
148
|
-
name: resolveObject.name
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
emitEvent({
|
|
153
|
-
type: 'closeUI',
|
|
154
|
-
ui: 'inventory'
|
|
155
|
-
});
|
|
156
|
-
}, [consume, emitEvent, resolveObject.name, resolveObject.uid]);
|
|
157
|
-
var handleClose = (0, _react.useCallback)(function () {
|
|
158
|
-
setResolveClass('success');
|
|
159
|
-
emitEvent({
|
|
160
|
-
type: 'hidePuzzleButtons',
|
|
161
|
-
payload: true
|
|
162
|
-
});
|
|
163
|
-
accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(solution.right.rewards));
|
|
164
|
-
setTimeout(function () {
|
|
165
|
-
handleFinish();
|
|
166
|
-
}, 2000);
|
|
167
|
-
}, [emitEvent, handleFinish, solution.right.rewards]);
|
|
168
|
-
var handleFail = (0, _react.useCallback)(function () {
|
|
169
|
-
emitEvent({
|
|
170
|
-
type: 'closeUI',
|
|
171
|
-
ui: 'inventory'
|
|
172
|
-
});
|
|
173
|
-
setResolveClass('');
|
|
174
|
-
emitEvent({
|
|
175
|
-
type: 'hidePuzzleButtons',
|
|
176
|
-
payload: false
|
|
177
|
-
});
|
|
178
|
-
emitEvent({
|
|
179
|
-
type: 'failPuzzle'
|
|
180
|
-
});
|
|
181
|
-
accRewards.current = [].concat(_toConsumableArray(accRewards.current), _toConsumableArray(solution.wrong.rewards));
|
|
182
|
-
}, [emitEvent, solution.wrong.rewards]);
|
|
183
|
-
var handleDrop = (0, _react.useCallback)(function (e) {
|
|
184
|
-
e.dragEvent.stopPropagation();
|
|
185
|
-
e.dragEvent.preventDefault();
|
|
186
|
-
var over = calculateOverArea(e.dragEvent);
|
|
187
|
-
var object = e.relatedTarget.getAttribute('data-item');
|
|
188
|
-
emitEvent({
|
|
189
|
-
type: 'hidePuzzleButtons',
|
|
190
|
-
payload: true
|
|
191
|
-
});
|
|
192
|
-
if (over && checkCorrectObject(object)) {
|
|
193
|
-
setResolveClass('success');
|
|
194
|
-
emitEvent({
|
|
195
|
-
type: 'closeUI',
|
|
196
|
-
ui: 'inventory'
|
|
197
|
-
});
|
|
198
|
-
if (info.solution.right.desc === '') {
|
|
199
|
-
handleClose();
|
|
200
|
-
}
|
|
201
|
-
} else {
|
|
202
|
-
emitEvent({
|
|
203
|
-
type: 'closeUI',
|
|
204
|
-
ui: 'inventory'
|
|
205
|
-
});
|
|
206
|
-
setResolveClass('failed');
|
|
207
|
-
if (info.solution.wrong.desc === '') {
|
|
208
|
-
setTimeout(function () {
|
|
209
|
-
handleFail();
|
|
210
|
-
}, 2000);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}, [calculateOverArea, checkCorrectObject, emitEvent, handleClose, handleFail, info.solution.right.desc, info.solution.wrong.desc]);
|
|
214
|
-
var handleFeedbackFuncionOnClose = function handleFeedbackFuncionOnClose() {
|
|
215
|
-
if (resolvedClass === 'success') {
|
|
216
|
-
handleClose();
|
|
217
|
-
} else {
|
|
218
|
-
handleFail();
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
(0, _react.useEffect)(function () {
|
|
222
|
-
var imageUrl = image.img.url || '';
|
|
223
|
-
currentImage.src = imageUrl;
|
|
224
|
-
currentImage.onload = function () {
|
|
225
|
-
if (canvas.current) {
|
|
226
|
-
layerConfig.current = {
|
|
227
|
-
x: canvas.current.clientWidth / 2,
|
|
228
|
-
y: canvas.current.clientHeight / 2,
|
|
229
|
-
width: currentImage.width,
|
|
230
|
-
height: currentImage.height,
|
|
231
|
-
offsetX: currentImage.width / 2,
|
|
232
|
-
offsetY: currentImage.height / 2,
|
|
233
|
-
scale: {
|
|
234
|
-
x: Math.min(canvas.current.clientWidth / currentImage.width, canvas.current.clientHeight / currentImage.height),
|
|
235
|
-
y: Math.min(canvas.current.clientWidth / currentImage.width, canvas.current.clientHeight / currentImage.height)
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
setImageLoaded(true);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}, [currentImage, image.img.url]);
|
|
242
|
-
(0, _react.useEffect)(function () {
|
|
243
|
-
if (!inventoryAutoOpen) {
|
|
244
|
-
emitEvent({
|
|
245
|
-
type: 'openUI',
|
|
246
|
-
ui: 'inventory'
|
|
247
|
-
});
|
|
248
|
-
setInventoryAutoOpen(true);
|
|
249
|
-
}
|
|
250
|
-
}, [inventoryAutoOpen, emitEvent]);
|
|
251
|
-
var handleStageRef = (0, _react.useCallback)(function (node) {
|
|
252
|
-
if (node !== null) {
|
|
253
|
-
stageRef.current = node;
|
|
254
|
-
node.container().addEventListener('mousemove', function (e) {
|
|
255
|
-
node.setPointersPositions(e);
|
|
256
|
-
});
|
|
257
|
-
(0, _interactjs.default)(node.container()).dropzone({
|
|
258
|
-
listeners: {
|
|
259
|
-
drop: handleDrop
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}, [handleDrop]);
|
|
264
|
-
var handleAreaRef = function handleAreaRef(node) {
|
|
265
|
-
if (node !== null) {
|
|
266
|
-
areaRef.current = node;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
var handleAreaTextRef = function handleAreaTextRef(node) {
|
|
270
|
-
if (node !== null) {
|
|
271
|
-
areaTextRef.current = node;
|
|
272
|
-
if (areaRef.current) {
|
|
273
|
-
var _areaRef$current$getC = areaRef.current.getClientRect(),
|
|
274
|
-
x = _areaRef$current$getC.x,
|
|
275
|
-
y = _areaRef$current$getC.y,
|
|
276
|
-
areaWidth = _areaRef$current$getC.width,
|
|
277
|
-
areaHeight = _areaRef$current$getC.height;
|
|
278
|
-
node.setAttr('x', x);
|
|
279
|
-
node.setAttr('y', y);
|
|
280
|
-
node.setAttr('height', areaHeight);
|
|
281
|
-
node.setAttr('width', areaWidth);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
(0, _react.useLayoutEffect)(function () {
|
|
286
|
-
if (areaRef.current && imageLoaded) {
|
|
287
|
-
var rect = areaRef.current.getClientRect({
|
|
288
|
-
relativeTo: areaRef.current.getParent()
|
|
289
|
-
});
|
|
290
|
-
setProjectionConfig({
|
|
291
|
-
x: rect.x + rect.width / 2,
|
|
292
|
-
y: rect.y + rect.height / 2
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}, [imageLoaded]);
|
|
296
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
297
|
-
className: "puzzle--drag__mask100"
|
|
298
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
299
|
-
className: "puzzle--drag__mask"
|
|
300
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
301
|
-
ref: canvas,
|
|
302
|
-
"data-testid": "mask_canvas",
|
|
303
|
-
className: "puzzle--drag__mask--canvas"
|
|
304
|
-
}, imageLoaded ? /*#__PURE__*/_react.default.createElement(_reactKonva.Stage, {
|
|
305
|
-
ref: handleStageRef,
|
|
306
|
-
width: canvas.current.clientWidth,
|
|
307
|
-
height: canvas.current.clientHeight
|
|
308
|
-
}, /*#__PURE__*/_react.default.createElement(_reactKonva.Layer, null, /*#__PURE__*/_react.default.createElement(_reactKonva.Image, _extends({
|
|
309
|
-
image: currentImage
|
|
310
|
-
}, layerConfig.current)), /*#__PURE__*/_react.default.createElement(_reactKonva.Group, layerConfig.current, projectionConfig ? /*#__PURE__*/_react.default.createElement(_reactKonvaUtils.Html, {
|
|
311
|
-
transform: true,
|
|
312
|
-
groupProps: _objectSpread({
|
|
313
|
-
id: 'projection'
|
|
314
|
-
}, projectionConfig),
|
|
315
|
-
divProps: {
|
|
316
|
-
style: {
|
|
317
|
-
pointerEvents: 'none'
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
321
|
-
style: {
|
|
322
|
-
width: '50px',
|
|
323
|
-
height: '50px',
|
|
324
|
-
pointerEvents: 'none'
|
|
325
|
-
},
|
|
326
|
-
id: "object-area-projection"
|
|
327
|
-
})) : null, /*#__PURE__*/_react.default.createElement(_reactKonva.Line, _extends({
|
|
328
|
-
onMouseEnter: mouseEnterArea,
|
|
329
|
-
onMouseLeave: mouseLeaveArea,
|
|
330
|
-
ref: handleAreaRef
|
|
331
|
-
}, area, {
|
|
332
|
-
shape: "poly",
|
|
333
|
-
fill: "#262a31d9",
|
|
334
|
-
stroke: "white",
|
|
335
|
-
strokeWidth: 1,
|
|
336
|
-
opacity: 0,
|
|
337
|
-
dash: [3, 2],
|
|
338
|
-
closed: true
|
|
339
|
-
}))), /*#__PURE__*/_react.default.createElement(_reactKonva.Text, {
|
|
340
|
-
onMouseEnter: mouseEnterArea,
|
|
341
|
-
onMouseLeave: mouseLeaveArea,
|
|
342
|
-
ref: handleAreaTextRef,
|
|
343
|
-
text: translate('puzzle.drag.dropzone'),
|
|
344
|
-
fontSize: 12,
|
|
345
|
-
align: "center",
|
|
346
|
-
verticalAlign: "middle",
|
|
347
|
-
fill: "#ffffff",
|
|
348
|
-
opacity: 0
|
|
349
|
-
}))) : null)), resolvedClass !== '' ? /*#__PURE__*/_react.default.createElement(_feedbackComponent.default, {
|
|
350
|
-
text: info.solution[resolvedClass === 'success' ? 'right' : 'wrong'].desc,
|
|
351
|
-
success: resolvedClass === 'success',
|
|
352
|
-
translate: translate,
|
|
353
|
-
playSound: playSound,
|
|
354
|
-
functionOnClose: handleFeedbackFuncionOnClose,
|
|
355
|
-
keyboardControl: keyboardControl
|
|
356
|
-
}) : null);
|
|
357
|
-
};
|
|
358
|
-
var _default = DragItemPuzzleComponent;
|
|
359
|
-
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 _DragItemPuzzleComponent = _interopRequireDefault(require("./components/DragItemPuzzleComponent"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _DragItemPuzzleComponent.default;
|
|
10
|
-
exports.default = _default;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.mockProps = exports.default = void 0;
|
|
7
|
-
var _mocker = require("helpers/mocker");
|
|
8
|
-
/* eslint-disable max-len */
|
|
9
|
-
|
|
10
|
-
var mockProps = {
|
|
11
|
-
emitEvent: _mocker.emitEvent,
|
|
12
|
-
soundActions: _mocker.soundActions,
|
|
13
|
-
keyboardControl: _mocker.keyboardControl,
|
|
14
|
-
disableExit: function disableExit() {},
|
|
15
|
-
resolveObject: {
|
|
16
|
-
uid: '123',
|
|
17
|
-
name: 'cube',
|
|
18
|
-
type: 'object'
|
|
19
|
-
},
|
|
20
|
-
area: {
|
|
21
|
-
closed: true,
|
|
22
|
-
draggable: true,
|
|
23
|
-
fill: 'rgba(63, 65, 70, 0.65)',
|
|
24
|
-
name: 'DefaultArea',
|
|
25
|
-
offsetX: 0,
|
|
26
|
-
offsetY: 0,
|
|
27
|
-
points: [552.3175, 277.64966809839905, 481.945, 522.7914096056227, 1356.27, 601.6631003514252, 1260.3075, 192.38297540023427],
|
|
28
|
-
rotation: 0,
|
|
29
|
-
scaleX: 1,
|
|
30
|
-
scaleY: 1,
|
|
31
|
-
skewX: 0,
|
|
32
|
-
skewY: 0,
|
|
33
|
-
stroke: '#007eff',
|
|
34
|
-
strokeWidth: 2,
|
|
35
|
-
x: 0,
|
|
36
|
-
y: 0
|
|
37
|
-
},
|
|
38
|
-
hasHighlights: true,
|
|
39
|
-
consume: true,
|
|
40
|
-
image: {
|
|
41
|
-
height: 1280,
|
|
42
|
-
img: {
|
|
43
|
-
name: 'perro_grande.jpg',
|
|
44
|
-
resourceId: '60b0b2096deb7a0011206029',
|
|
45
|
-
url: 'https://min.int.gamelearn.io/cooked.gl-lms-storage/clients/58dccfba26561500117caf53/image/60b0b2096deb7a0011206029/perro_grande.jpg'
|
|
46
|
-
},
|
|
47
|
-
imgName: 'perro_grande.jpg'
|
|
48
|
-
},
|
|
49
|
-
info: {
|
|
50
|
-
hint: {
|
|
51
|
-
active: false,
|
|
52
|
-
desc: 'hint',
|
|
53
|
-
rewards: []
|
|
54
|
-
},
|
|
55
|
-
resolve: {
|
|
56
|
-
rewards: []
|
|
57
|
-
},
|
|
58
|
-
solution: {
|
|
59
|
-
right: {
|
|
60
|
-
desc: 'correctSolution',
|
|
61
|
-
rewards: []
|
|
62
|
-
},
|
|
63
|
-
wrong: {
|
|
64
|
-
desc: 'wrongSolution',
|
|
65
|
-
rewards: []
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
instructions: 'instructions',
|
|
69
|
-
description: 'description'
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
exports.mockProps = mockProps;
|
|
73
|
-
var _default = mockProps;
|
|
74
|
-
exports.default = _default;
|
|
@@ -1,126 +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 _LangIsRtl = _interopRequireDefault(require("../../../helpers/LangIsRtl"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
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); }
|
|
12
|
-
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; }
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
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."); }
|
|
15
|
-
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); }
|
|
16
|
-
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; }
|
|
17
|
-
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; } }
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
var FeedbackComponent = function FeedbackComponent(_ref) {
|
|
20
|
-
var text = _ref.text,
|
|
21
|
-
success = _ref.success,
|
|
22
|
-
playSound = _ref.playSound,
|
|
23
|
-
additionalStyle = _ref.additionalStyle,
|
|
24
|
-
functionOnClose = _ref.functionOnClose,
|
|
25
|
-
secondText = _ref.secondText,
|
|
26
|
-
translate = _ref.translate,
|
|
27
|
-
shortText = _ref.shortText,
|
|
28
|
-
hasTimeout = _ref.hasTimeout,
|
|
29
|
-
delay = _ref.delay,
|
|
30
|
-
timeExpired = _ref.timeExpired,
|
|
31
|
-
keyboardControl = _ref.keyboardControl;
|
|
32
|
-
var _useState = (0, _react.useState)(),
|
|
33
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
-
explain = _useState2[0],
|
|
35
|
-
setExplain = _useState2[1];
|
|
36
|
-
(0, _react.useEffect)(function () {
|
|
37
|
-
var timerForShowExplain;
|
|
38
|
-
if (playSound) {
|
|
39
|
-
playSound(success ? 'score' : 'fail');
|
|
40
|
-
}
|
|
41
|
-
if (text && !shortText) {
|
|
42
|
-
timerForShowExplain = setTimeout(function () {
|
|
43
|
-
setExplain(true);
|
|
44
|
-
}, 1000);
|
|
45
|
-
}
|
|
46
|
-
return function () {
|
|
47
|
-
if (timerForShowExplain) clearTimeout(timerForShowExplain);
|
|
48
|
-
};
|
|
49
|
-
}, [playSound, success, shortText, text]);
|
|
50
|
-
(0, _react.useEffect)(function () {
|
|
51
|
-
var timeout;
|
|
52
|
-
if (hasTimeout && functionOnClose) {
|
|
53
|
-
timeout = setTimeout(functionOnClose, delay);
|
|
54
|
-
}
|
|
55
|
-
return function () {
|
|
56
|
-
if (timeout) clearTimeout(timeout);
|
|
57
|
-
};
|
|
58
|
-
}, [delay, functionOnClose, hasTimeout]);
|
|
59
|
-
var statusColor = function statusColor() {
|
|
60
|
-
if (success) {
|
|
61
|
-
return 'success';
|
|
62
|
-
}
|
|
63
|
-
return 'failed';
|
|
64
|
-
};
|
|
65
|
-
var statusIcon = function statusIcon() {
|
|
66
|
-
if (success) {
|
|
67
|
-
return 'icon-correct-thumb';
|
|
68
|
-
}
|
|
69
|
-
if (timeExpired) {
|
|
70
|
-
return 'icon-times-up';
|
|
71
|
-
}
|
|
72
|
-
return 'icon-incorrect-thumb';
|
|
73
|
-
};
|
|
74
|
-
keyboardControl(null, text && functionOnClose && explain ? functionOnClose : null, text && functionOnClose && explain || functionOnClose && shortText ? functionOnClose : null);
|
|
75
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
-
className: "feedback-layer ".concat(explain ? 'feedback-layer--withexplain' : '')
|
|
77
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
-
className: "feedback-layer__header ".concat(shortText ? 'feedback-layer__header--in-shortText' : '', " ").concat(additionalStyle || '', " ").concat(statusColor())
|
|
79
|
-
}, secondText && /*#__PURE__*/_react.default.createElement("span", {
|
|
80
|
-
className: "puzzle--terminal__visor--file"
|
|
81
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
82
|
-
className: "puzzle--terminal__icon ".concat(additionalStyle || '')
|
|
83
|
-
}), /*#__PURE__*/_react.default.createElement("span", null, secondText)), /*#__PURE__*/_react.default.createElement("span", {
|
|
84
|
-
className: "feedback-layer__maintitle"
|
|
85
|
-
}, !text || !shortText ? /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
-
title: translate("tooltip.".concat(success ? 'correct' : 'incorrect')),
|
|
87
|
-
className: "".concat(statusIcon())
|
|
88
|
-
}) : text), shortText && /*#__PURE__*/_react.default.createElement("button", {
|
|
89
|
-
type: "button",
|
|
90
|
-
className: "feedback-layer__closeX",
|
|
91
|
-
onClick: function onClick() {
|
|
92
|
-
return functionOnClose();
|
|
93
|
-
},
|
|
94
|
-
"aria-label": translate('storylines.misc.closePiece')
|
|
95
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
96
|
-
className: "icon-close"
|
|
97
|
-
}))), !shortText && text !== '' && /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
-
className: "feedback-layer__explainwrap"
|
|
99
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
-
className: "feedback-layer__explain"
|
|
101
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
-
dir: "auto"
|
|
103
|
-
}, text), text && functionOnClose && explain && /*#__PURE__*/_react.default.createElement("button", {
|
|
104
|
-
type: "button",
|
|
105
|
-
className: "gat--btn__navigation",
|
|
106
|
-
onClick: function onClick() {
|
|
107
|
-
return functionOnClose();
|
|
108
|
-
},
|
|
109
|
-
"aria-label": translate('storylines.misc.closePiece'),
|
|
110
|
-
style: {
|
|
111
|
-
display: 'flex',
|
|
112
|
-
margin: 'auto',
|
|
113
|
-
marginTop: '24px'
|
|
114
|
-
}
|
|
115
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
116
|
-
className: (0, _LangIsRtl.default)() ? 'icon-back' : 'icon-next'
|
|
117
|
-
}))))));
|
|
118
|
-
};
|
|
119
|
-
FeedbackComponent.defaultProps = {
|
|
120
|
-
text: '',
|
|
121
|
-
hasTimeout: false,
|
|
122
|
-
delay: 3000,
|
|
123
|
-
success: false
|
|
124
|
-
};
|
|
125
|
-
var _default = FeedbackComponent;
|
|
126
|
-
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 _FeedbackComponent = _interopRequireDefault(require("./components/FeedbackComponent"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
var _default = _FeedbackComponent.default;
|
|
10
|
-
exports.default = _default;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.mockProps6 = exports.mockProps5 = exports.mockProps4 = exports.mockProps3 = exports.mockProps2 = exports.mockProps = void 0;
|
|
7
|
-
var _mocker = require("helpers/mocker");
|
|
8
|
-
/* eslint-disable max-len */
|
|
9
|
-
|
|
10
|
-
var mockProps = {
|
|
11
|
-
functionOnClose: _mocker.functionOnClose,
|
|
12
|
-
playSound: _mocker.soundActions[0],
|
|
13
|
-
keyboardControl: _mocker.keyboardControl,
|
|
14
|
-
success: true,
|
|
15
|
-
translate: _mocker.translate,
|
|
16
|
-
text: '500A 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)asd asdf sdf 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)asd asdf sdf 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)asd asdf sdf A while back I needed to count thea sf as'
|
|
17
|
-
};
|
|
18
|
-
exports.mockProps = mockProps;
|
|
19
|
-
var mockProps2 = {
|
|
20
|
-
functionOnClose: _mocker.functionOnClose,
|
|
21
|
-
playSound: _mocker.soundActions[0],
|
|
22
|
-
keyboardControl: _mocker.keyboardControl,
|
|
23
|
-
translate: _mocker.translate,
|
|
24
|
-
text: '500A 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)asd asdf sdf 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)asd asdf sdf 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)asd asdf sdf A while back I needed to count thea sf as'
|
|
25
|
-
};
|
|
26
|
-
exports.mockProps2 = mockProps2;
|
|
27
|
-
var mockProps3 = {
|
|
28
|
-
success: true,
|
|
29
|
-
playSound: _mocker.soundActions[0],
|
|
30
|
-
keyboardControl: _mocker.keyboardControl,
|
|
31
|
-
translate: _mocker.translate
|
|
32
|
-
};
|
|
33
|
-
exports.mockProps3 = mockProps3;
|
|
34
|
-
var mockProps4 = {
|
|
35
|
-
playSound: _mocker.soundActions[0],
|
|
36
|
-
keyboardControl: _mocker.keyboardControl,
|
|
37
|
-
translate: _mocker.translate
|
|
38
|
-
};
|
|
39
|
-
exports.mockProps4 = mockProps4;
|
|
40
|
-
var mockProps5 = {
|
|
41
|
-
translate: _mocker.translate,
|
|
42
|
-
timeExpired: true,
|
|
43
|
-
keyboardControl: _mocker.keyboardControl
|
|
44
|
-
};
|
|
45
|
-
exports.mockProps5 = mockProps5;
|
|
46
|
-
var mockProps6 = {
|
|
47
|
-
translate: _mocker.translate,
|
|
48
|
-
text: 'story with timer finish feedback',
|
|
49
|
-
timeExpired: true,
|
|
50
|
-
keyboardControl: _mocker.keyboardControl
|
|
51
|
-
};
|
|
52
|
-
exports.mockProps6 = mockProps6;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _Tooltip = _interopRequireDefault(require("../Tooltip"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
var Counter = function Counter(_ref) {
|
|
11
|
-
var current = _ref.current,
|
|
12
|
-
total = _ref.total,
|
|
13
|
-
tooltip = _ref.tooltip,
|
|
14
|
-
emitEvent = _ref.emitEvent;
|
|
15
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltip ? /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
16
|
-
emitEvent: emitEvent
|
|
17
|
-
}) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
18
|
-
className: "puzzle-frame__info--frames"
|
|
19
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
20
|
-
className: "info-circle"
|
|
21
|
-
}), /*#__PURE__*/_react.default.createElement("span", null, current, " / ", total)));
|
|
22
|
-
};
|
|
23
|
-
var _default = Counter;
|
|
24
|
-
exports.default = _default;
|