@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.
Files changed (212) hide show
  1. package/README.md +9 -6
  2. package/dist/arcade-components.cjs +274 -0
  3. package/dist/arcade-components.js +57929 -0
  4. package/package.json +74 -73
  5. package/dist/components/animation-component/components/AnimationComponent.js +0 -98
  6. package/dist/components/animation-component/index.js +0 -10
  7. package/dist/components/animation-component/mocks/mockForStory.js +0 -26
  8. package/dist/components/auto-evaluation-component/components/AutoEvaluation.js +0 -215
  9. package/dist/components/auto-evaluation-component/components/EndScreen.js +0 -43
  10. package/dist/components/auto-evaluation-component/components/StartScreen.js +0 -32
  11. package/dist/components/auto-evaluation-component/index.js +0 -10
  12. package/dist/components/auto-evaluation-component/mocks/mockForStory.js +0 -38
  13. package/dist/components/cards-selector-puzzle-component/components/Board/index.js +0 -159
  14. package/dist/components/cards-selector-puzzle-component/components/Card/index.js +0 -115
  15. package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +0 -289
  16. package/dist/components/cards-selector-puzzle-component/index.js +0 -10
  17. package/dist/components/cards-selector-puzzle-component/mocks/mockForStory.js +0 -446
  18. package/dist/components/cartel-component/components/CartelComponent.js +0 -124
  19. package/dist/components/cartel-component/index.js +0 -10
  20. package/dist/components/chained-image-click-puzzle-component/components/ChainedImageClickPuzzleComponent.js +0 -80
  21. package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +0 -182
  22. package/dist/components/chained-image-click-puzzle-component/index.js +0 -10
  23. package/dist/components/chained-image-click-puzzle-component/mocks/mockForStory.js +0 -413
  24. package/dist/components/comic-component/components/ComicComponent.js +0 -201
  25. package/dist/components/comic-component/components/Slide.js +0 -31
  26. package/dist/components/comic-component/components/Vignette.js +0 -70
  27. package/dist/components/comic-component/index.js +0 -10
  28. package/dist/components/comic-component/mocks/mockForStory.js +0 -314
  29. package/dist/components/conversational-component/components/ConversationalComponent.js +0 -101
  30. package/dist/components/conversational-component/index.js +0 -10
  31. package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +0 -543
  32. package/dist/components/conversational-pro-component/components/Message.js +0 -37
  33. package/dist/components/conversational-pro-component/components/Slot.js +0 -92
  34. package/dist/components/conversational-pro-component/components/SlotList.js +0 -162
  35. package/dist/components/conversational-pro-component/components/scene/Panel.js +0 -179
  36. package/dist/components/conversational-pro-component/components/scene/Panels.js +0 -46
  37. package/dist/components/conversational-pro-component/components/scene/index.js +0 -77
  38. package/dist/components/conversational-pro-component/index.js +0 -10
  39. package/dist/components/conversational-pro-component/mocks/mockForStory.js +0 -1529
  40. package/dist/components/cracker-puzzle-component/components/CrackerPuzzleComponent.js +0 -261
  41. package/dist/components/cracker-puzzle-component/components/DrawGrid/index.js +0 -33
  42. package/dist/components/cracker-puzzle-component/components/DrawItem/index.js +0 -48
  43. package/dist/components/cracker-puzzle-component/components/DrawRow/index.js +0 -43
  44. package/dist/components/cracker-puzzle-component/components/colors.js +0 -12
  45. package/dist/components/cracker-puzzle-component/components/helpers.js +0 -133
  46. package/dist/components/cracker-puzzle-component/index.js +0 -10
  47. package/dist/components/cracker-puzzle-component/mocks/mockForStory.js +0 -277
  48. package/dist/components/decision-component/components/DecisionBody.js +0 -116
  49. package/dist/components/decision-component/components/DecisionComponent.js +0 -248
  50. package/dist/components/decision-component/components/Feedback.js +0 -40
  51. package/dist/components/decision-component/components/Options.js +0 -74
  52. package/dist/components/decision-component/index.js +0 -10
  53. package/dist/components/decision-component/mocks/mockForStory.js +0 -166
  54. package/dist/components/dialog-component/components/BubbleWrapper.js +0 -39
  55. package/dist/components/dialog-component/components/DialogComponent.js +0 -779
  56. package/dist/components/dialog-component/components/DialogDecision.js +0 -44
  57. package/dist/components/dialog-component/components/SpeechBubbleComponent.js +0 -66
  58. package/dist/components/dialog-component/index.js +0 -10
  59. package/dist/components/dialog-component/mocks/mockForStory.js +0 -550
  60. package/dist/components/drag-item-puzzle-component/components/DragItemPuzzleComponent.js +0 -361
  61. package/dist/components/drag-item-puzzle-component/index.js +0 -10
  62. package/dist/components/drag-item-puzzle-component/mocks/mockForStory.js +0 -74
  63. package/dist/components/feedback-component/components/FeedbackComponent.js +0 -126
  64. package/dist/components/feedback-component/index.js +0 -10
  65. package/dist/components/feedback-component/mocks/mockForStory.js +0 -52
  66. package/dist/components/frame-click-puzzle-component/components/Counter/index.js +0 -24
  67. package/dist/components/frame-click-puzzle-component/components/CurrentFramePuzzle.js +0 -196
  68. package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +0 -178
  69. package/dist/components/frame-click-puzzle-component/components/Tooltip/index.js +0 -23
  70. package/dist/components/frame-click-puzzle-component/index.js +0 -10
  71. package/dist/components/frame-click-puzzle-component/mocks/mockForStory.js +0 -717
  72. package/dist/components/hacker-puzzle-component/components/HackerPuzzleComponent.js +0 -255
  73. package/dist/components/hacker-puzzle-component/components/languages.js +0 -13
  74. package/dist/components/hacker-puzzle-component/index.js +0 -10
  75. package/dist/components/hacker-puzzle-component/mocks/mockForStory.js +0 -103
  76. package/dist/components/hanged-puzzle-component/components/HangedPuzzleComponent.js +0 -488
  77. package/dist/components/hanged-puzzle-component/index.js +0 -10
  78. package/dist/components/hanged-puzzle-component/mocks/mockForStory.js +0 -61
  79. package/dist/components/hanged-puzzle-component/utils.js +0 -64
  80. package/dist/components/image-click-puzzle-component/components/ImageClickPuzzleComponent.js +0 -40
  81. package/dist/components/image-click-puzzle-component/index.js +0 -10
  82. package/dist/components/image-click-puzzle-component/mocks/mockForStory.js +0 -427
  83. package/dist/components/image-click-wrapper-component/components/CountDown/index.js +0 -18
  84. package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +0 -472
  85. package/dist/components/image-click-wrapper-component/components/TimerDialog/index.js +0 -26
  86. package/dist/components/image-click-wrapper-component/index.js +0 -10
  87. package/dist/components/image-click-wrapper-component/mocks/mockForStory.js +0 -432
  88. package/dist/components/image-component/components/ImageComponent.js +0 -83
  89. package/dist/components/image-component/index.js +0 -10
  90. package/dist/components/image-component/mocks/mockForStory.js +0 -52
  91. package/dist/components/index.js +0 -260
  92. package/dist/components/inventory-item/components/InventoryItem.js +0 -120
  93. package/dist/components/inventory-item/index.js +0 -10
  94. package/dist/components/inventory-item/mocks/mockForStory.js +0 -29
  95. package/dist/components/keyboard-puzzle-component/components/KeyboardPuzzleComponent.js +0 -275
  96. package/dist/components/keyboard-puzzle-component/index.js +0 -10
  97. package/dist/components/keyboard-puzzle-component/mocks/mockForStory.js +0 -40
  98. package/dist/components/konva-components/Area/index.js +0 -170
  99. package/dist/components/konva-components/KonvaMapper.js +0 -185
  100. package/dist/components/lectures-component/components/LectureButtons.js +0 -40
  101. package/dist/components/lectures-component/components/LecturesComponent.js +0 -157
  102. package/dist/components/lectures-component/index.js +0 -10
  103. package/dist/components/lectures-component/mocks/mockForStory.js +0 -39
  104. package/dist/components/login-puzzle-component/components/LoginPuzzleComponent.js +0 -243
  105. package/dist/components/login-puzzle-component/index.js +0 -10
  106. package/dist/components/login-puzzle-component/mocks/mockForStory.js +0 -38
  107. package/dist/components/notice-component/components/NoticeComponent.js +0 -96
  108. package/dist/components/notice-component/index.js +0 -10
  109. package/dist/components/notice-component/mocks/mockForStory.js +0 -20
  110. package/dist/components/pattern-component/components/PatternComponent.js +0 -78
  111. package/dist/components/pattern-component/index.js +0 -10
  112. package/dist/components/pattern-component/mocks/mockForStory.js +0 -35
  113. package/dist/components/pdf-component/components/PdfComponent.js +0 -122
  114. package/dist/components/pdf-component/components/PdfVisor.js +0 -187
  115. package/dist/components/pdf-component/index.js +0 -20
  116. package/dist/components/pdf-component/mocks/mockForProps.js +0 -38
  117. package/dist/components/referral-component/components/EmailPill.js +0 -26
  118. package/dist/components/referral-component/components/ReferralComponent.js +0 -115
  119. package/dist/components/referral-component/components/StepOne.js +0 -170
  120. package/dist/components/referral-component/components/StepTwo.js +0 -57
  121. package/dist/components/referral-component/index.js +0 -10
  122. package/dist/components/referral-component/mocks/mockForStory.js +0 -40
  123. package/dist/components/survey-component/components/ApplicableBox.js +0 -49
  124. package/dist/components/survey-component/components/OpinionBox.js +0 -45
  125. package/dist/components/survey-component/components/SurveyComponent.js +0 -150
  126. package/dist/components/survey-component/components/TextBox.js +0 -40
  127. package/dist/components/survey-component/index.js +0 -10
  128. package/dist/components/survey-component/mocks/mockForStory.js +0 -14
  129. package/dist/components/terminal-puzzle-component/components/FilesGroup/Item.js +0 -28
  130. package/dist/components/terminal-puzzle-component/components/FilesGroup/index.js +0 -76
  131. package/dist/components/terminal-puzzle-component/components/Image/index.js +0 -22
  132. package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +0 -216
  133. package/dist/components/terminal-puzzle-component/components/Visor/index.js +0 -129
  134. package/dist/components/terminal-puzzle-component/components/utils/index.js +0 -26
  135. package/dist/components/terminal-puzzle-component/index.js +0 -10
  136. package/dist/components/terminal-puzzle-component/mocks/mockForStory.js +0 -188
  137. package/dist/components/test-component/components/Container.js +0 -211
  138. package/dist/components/test-component/components/Feedbacks.js +0 -48
  139. package/dist/components/test-component/components/Questions.js +0 -145
  140. package/dist/components/test-component/components/Results.js +0 -208
  141. package/dist/components/test-component/components/TestComponent.js +0 -302
  142. package/dist/components/test-component/index.js +0 -10
  143. package/dist/components/test-component/mocks/mockForStory.js +0 -113
  144. package/dist/components/text-click-puzzle-component/components/TextClickPuzzleComponent.js +0 -387
  145. package/dist/components/text-click-puzzle-component/index.js +0 -10
  146. package/dist/components/text-click-puzzle-component/mocks/mockForStory.js +0 -485
  147. package/dist/components/text-click-puzzle-component/utils/index.js +0 -76
  148. package/dist/components/url-component/components/UrlComponent.js +0 -88
  149. package/dist/components/url-component/index.js +0 -10
  150. package/dist/components/url-component/mocks/mockForProps.js +0 -20
  151. package/dist/components/video-component/components/VideoComponent.js +0 -73
  152. package/dist/components/video-component/index.js +0 -10
  153. package/dist/components/video-component/mocks/mockForStory.js +0 -94
  154. package/dist/components/video-visor/components/VideoControllers/BufferBar.js +0 -108
  155. package/dist/components/video-visor/components/VideoControllers/ControlButtons.js +0 -31
  156. package/dist/components/video-visor/components/VideoControllers/FinishedVideoButtons.js +0 -32
  157. package/dist/components/video-visor/components/VideoControllers/PlayInitButton.js +0 -37
  158. package/dist/components/video-visor/components/VideoControllers/SkipButton.js +0 -37
  159. package/dist/components/video-visor/components/VideoControllers/Timer.js +0 -37
  160. package/dist/components/video-visor/components/VideoControllers/VolumeBar.js +0 -92
  161. package/dist/components/video-visor/components/VideoControllers/index.js +0 -122
  162. package/dist/components/video-visor/components/VideoVisor.js +0 -271
  163. package/dist/components/video-visor/index.js +0 -10
  164. package/dist/components/video-visor/mocks/mockForStory.js +0 -42
  165. package/dist/components/web-builder-puzzle-component/Popups/PopupColorComponent/index.js +0 -87
  166. package/dist/components/web-builder-puzzle-component/Popups/PopupImageComponent/index.js +0 -94
  167. package/dist/components/web-builder-puzzle-component/Popups/PopupTextComponent/index.js +0 -114
  168. package/dist/components/web-builder-puzzle-component/Popups/index.js +0 -27
  169. package/dist/components/web-builder-puzzle-component/Templates/Bank.js +0 -98
  170. package/dist/components/web-builder-puzzle-component/Templates/Facebook.js +0 -37
  171. package/dist/components/web-builder-puzzle-component/Templates/resourcePath.js +0 -9
  172. package/dist/components/web-builder-puzzle-component/components/EditButton/index.js +0 -28
  173. package/dist/components/web-builder-puzzle-component/components/Feedback/index.js +0 -41
  174. package/dist/components/web-builder-puzzle-component/components/PublishButton/index.js +0 -29
  175. package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/BankBody.js +0 -118
  176. package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/FacebookBody.js +0 -149
  177. package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/index.js +0 -25
  178. package/dist/components/web-builder-puzzle-component/components/WebBuilderFront/index.js +0 -89
  179. package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/BankHeader.js +0 -84
  180. package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/FacebookHeader.js +0 -38
  181. package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/index.js +0 -40
  182. package/dist/components/web-builder-puzzle-component/components/WebBuilderPuzzleComponent.js +0 -302
  183. package/dist/components/web-builder-puzzle-component/components/WebBuilderTopBar/index.js +0 -30
  184. package/dist/components/web-builder-puzzle-component/index.js +0 -10
  185. package/dist/components/web-builder-puzzle-component/mocks/mockForStory.js +0 -27
  186. package/dist/components/writer-puzzle-component/components/ElectionComponent.js +0 -69
  187. package/dist/components/writer-puzzle-component/components/FeedbackComponent.js +0 -97
  188. package/dist/components/writer-puzzle-component/components/FeedbackElement.js +0 -32
  189. package/dist/components/writer-puzzle-component/components/FinishedTextComponent.js +0 -25
  190. package/dist/components/writer-puzzle-component/components/FixedComponent.js +0 -120
  191. package/dist/components/writer-puzzle-component/components/SingleElection.js +0 -85
  192. package/dist/components/writer-puzzle-component/components/WriterPuzzleComponent.js +0 -450
  193. package/dist/components/writer-puzzle-component/index.js +0 -10
  194. package/dist/components/writer-puzzle-component/mocks/mockForStory.js +0 -1194
  195. package/dist/components/zoom-test/components/ZoomTest.js +0 -73
  196. package/dist/components/zoom-test/index.js +0 -10
  197. package/dist/components/zoom-test/mocks/mockForStory.js +0 -21
  198. package/dist/helpers/LangIsRtl.js +0 -16
  199. package/dist/helpers/LightSet.js +0 -35
  200. package/dist/helpers/LodController.js +0 -28
  201. package/dist/helpers/deviceDetection.js +0 -21
  202. package/dist/helpers/drawLOD.js +0 -310
  203. package/dist/helpers/index.js +0 -268
  204. package/dist/helpers/lodStats.js +0 -55
  205. package/dist/helpers/mocker.js +0 -116
  206. package/dist/helpers/useEkho.js +0 -172
  207. package/dist/helpers/useGLB.js +0 -57
  208. package/dist/helpers/useStateMachine.js +0 -277
  209. package/dist/helpers/useTimeout.js +0 -32
  210. package/dist/helpers/useWindowSize.js +0 -44
  211. package/dist/index.js +0 -16
  212. package/dist/test/testSceneWrapper.js +0 -31
@@ -1,185 +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 _reactKonva = require("react-konva");
10
- var _Area = _interopRequireDefault(require("./Area"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
- 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."); }
16
- 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); }
17
- 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; }
18
- 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; } }
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /* eslint-disable no-nested-ternary */ /* eslint-disable react/no-array-index-key */ /* eslint-disable jsx-a11y/no-noninteractive-tabindex */ /* eslint-disable prefer-template */ /* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/no-static-element-interactions */
20
- var useWindowSize = function useWindowSize() {
21
- var _useState = (0, _react.useState)([0, 0]),
22
- _useState2 = _slicedToArray(_useState, 2),
23
- size = _useState2[0],
24
- setSize = _useState2[1];
25
- (0, _react.useLayoutEffect)(function () {
26
- function updateSize() {
27
- setSize([window.innerWidth, window.innerHeight]);
28
- }
29
- window.addEventListener('resize', updateSize);
30
- updateSize();
31
- return function () {
32
- return window.removeEventListener('resize', updateSize);
33
- };
34
- }, []);
35
- return size;
36
- };
37
- var KonvaMapper = function KonvaMapper(_ref) {
38
- var areas = _ref.areas,
39
- badAreas = _ref.badAreas,
40
- imageUrl = _ref.imageUrl,
41
- completed = _ref.completed,
42
- onClick = _ref.onClick,
43
- onClickOutside = _ref.onClickOutside,
44
- hasHighlights = _ref.hasHighlights,
45
- clickedZones = _ref.clickedZones;
46
- var stageRef = (0, _react.useRef)();
47
- var areasStroke = (0, _react.useRef)();
48
- var badAreasStroke = (0, _react.useRef)();
49
- var goodAreasGroup = (0, _react.useRef)();
50
- var badAreasGroup = (0, _react.useRef)();
51
- var imageRef = (0, _react.useRef)();
52
- var overlay = (0, _react.useRef)();
53
- var _useState3 = (0, _react.useState)(new window.Image()),
54
- _useState4 = _slicedToArray(_useState3, 2),
55
- currentImage = _useState4[0],
56
- setImage = _useState4[1];
57
- var _useWindowSize = useWindowSize(),
58
- _useWindowSize2 = _slicedToArray(_useWindowSize, 2),
59
- width = _useWindowSize2[0],
60
- height = _useWindowSize2[1];
61
- var incorrectArea = badAreas.find(function (area) {
62
- return area.id === 'AllArea';
63
- }) || false;
64
- var badAreasList = badAreas.filter(function (area) {
65
- return area.id !== 'AllArea';
66
- });
67
- (0, _react.useEffect)(function () {
68
- if (overlay.current && areasStroke.current && completed) {
69
- overlay.current.to({
70
- duration: 0.25,
71
- opacity: 0.5
72
- });
73
- areasStroke.current.setAttr('visible', true);
74
- }
75
- }, [completed]);
76
- var handleStageClick = function handleStageClick(a) {
77
- if (incorrectArea && !a.target.attrs.shape) {
78
- onClickOutside(incorrectArea);
79
- }
80
- };
81
- (0, _react.useEffect)(function () {
82
- currentImage.src = imageUrl;
83
- currentImage.addEventListener('load', function () {
84
- if (stageRef.current) {
85
- var commonConfig = {
86
- x: width / 2,
87
- y: height / 2,
88
- width: currentImage.width,
89
- height: currentImage.height,
90
- offsetX: currentImage.width / 2,
91
- offsetY: currentImage.height / 2,
92
- scale: {
93
- x: Math.min(width / currentImage.width, height / currentImage.height),
94
- y: Math.min(width / currentImage.width, height / currentImage.height)
95
- }
96
- };
97
- if (goodAreasGroup.current) goodAreasGroup.current.setAttrs(commonConfig);
98
- if (badAreasGroup.current) badAreasGroup.current.setAttrs(commonConfig);
99
- if (areasStroke.current) areasStroke.current.setAttrs(commonConfig);
100
- if (badAreasStroke.current) badAreasStroke.current.setAttrs(commonConfig);
101
- if (imageRef.current) imageRef.current.setAttrs(commonConfig);
102
- stageRef.current.batchDraw();
103
- setImage(currentImage);
104
- stageRef.current.fire('stage-loaded');
105
- }
106
- });
107
- }, [currentImage, height, imageUrl, width]);
108
- return /*#__PURE__*/_react.default.createElement(_reactKonva.Stage, {
109
- ref: stageRef,
110
- width: width,
111
- height: height,
112
- onClick: handleStageClick,
113
- onTouchEnd: handleStageClick
114
- }, /*#__PURE__*/_react.default.createElement(_reactKonva.Layer, null, /*#__PURE__*/_react.default.createElement(_reactKonva.Image, {
115
- ref: imageRef,
116
- image: currentImage
117
- })), /*#__PURE__*/_react.default.createElement(_reactKonva.Layer, null, /*#__PURE__*/_react.default.createElement(_reactKonva.Rect, {
118
- ref: overlay,
119
- width: width,
120
- height: height,
121
- fill: "black",
122
- opacity: 0
123
- }), /*#__PURE__*/_react.default.createElement(_reactKonva.Group, {
124
- ref: badAreasGroup
125
- }, badAreasList.map(function (area, ind) {
126
- return /*#__PURE__*/_react.default.createElement(_Area.default, {
127
- hasHighlights: hasHighlights,
128
- completed: completed,
129
- onClick: onClick,
130
- onClickOutside: onClickOutside,
131
- key: area.name + '_' + ind,
132
- area: area,
133
- isBad: true
134
- });
135
- })), /*#__PURE__*/_react.default.createElement(_reactKonva.Group, {
136
- ref: goodAreasGroup
137
- }, areas.map(function (area, ind) {
138
- return /*#__PURE__*/_react.default.createElement(_Area.default, {
139
- hasHighlights: hasHighlights,
140
- completed: completed,
141
- onClick: onClick,
142
- onClickOutside: onClickOutside,
143
- key: area.name + '_' + ind,
144
- area: area,
145
- isClicked: clickedZones.some(function (c) {
146
- return c.index === area.index;
147
- })
148
- });
149
- })), /*#__PURE__*/_react.default.createElement(_reactKonva.Group, {
150
- ref: badAreasStroke,
151
- visible: false
152
- }, badAreasList.map(function (area, ind) {
153
- return /*#__PURE__*/_react.default.createElement(_Area.default, {
154
- hasHighlights: hasHighlights,
155
- completed: completed,
156
- onClick: onClick,
157
- onClickOutside: onClickOutside,
158
- key: area.name + '_' + ind,
159
- area: area,
160
- isBad: true,
161
- finished: true
162
- });
163
- })), /*#__PURE__*/_react.default.createElement(_reactKonva.Group, {
164
- ref: areasStroke,
165
- visible: false
166
- }, areas.map(function (area, ind) {
167
- return /*#__PURE__*/_react.default.createElement(_Area.default, {
168
- hasHighlights: hasHighlights,
169
- completed: completed,
170
- onClick: onClick,
171
- onClickOutside: onClickOutside,
172
- key: area.name + '_' + ind,
173
- area: area,
174
- finished: true
175
- });
176
- }))));
177
- };
178
- KonvaMapper.defaultProps = {
179
- hasHighlights: false,
180
- onClick: function onClick() {},
181
- completed: false,
182
- onClickOutside: function onClickOutside() {}
183
- };
184
- var _default = KonvaMapper;
185
- exports.default = _default;
@@ -1,40 +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 _LangIsRtl = _interopRequireDefault(require("../../../helpers/LangIsRtl"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- var LectureButtons = function LectureButtons(_ref) {
11
- var goToLecture = _ref.goToLecture,
12
- close = _ref.close,
13
- minutes = _ref.minutes,
14
- seconds = _ref.seconds,
15
- btnText = _ref.btnText;
16
- return /*#__PURE__*/_react.default.createElement("div", {
17
- className: "lectures--buttons"
18
- }, goToLecture ? /*#__PURE__*/_react.default.createElement("button", {
19
- type: "button",
20
- className: "gat--btn__navigation",
21
- onClick: function onClick() {
22
- return close();
23
- },
24
- "aria-label": btnText
25
- }, /*#__PURE__*/_react.default.createElement("span", {
26
- className: (0, _LangIsRtl.default)() ? 'icon-back' : 'icon-next'
27
- })) : /*#__PURE__*/_react.default.createElement("button", {
28
- type: "button",
29
- className: "gat--btn__count",
30
- "data-testid": "countdown"
31
- }, /*#__PURE__*/_react.default.createElement("span", null, minutes < 10 ? "0".concat(minutes) : minutes, ":", seconds < 10 ? "0".concat(seconds) : seconds)));
32
- };
33
- LectureButtons.defaultProps = {
34
- goToLecture: false,
35
- close: function close() {},
36
- minutes: 0,
37
- seconds: 0
38
- };
39
- var _default = LectureButtons;
40
- exports.default = _default;
@@ -1,157 +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 _LectureButtons = _interopRequireDefault(require("./LectureButtons"));
11
- var _useEkho = _interopRequireDefault(require("../../../helpers/useEkho"));
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- 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); }
14
- 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; }
15
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
- 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."); }
17
- 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); }
18
- 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; }
19
- 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; } }
20
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
- var READING_TIME = 0.2;
22
- var LecturesComponent = function LecturesComponent(_ref) {
23
- var emitEvent = _ref.emitEvent,
24
- name = _ref.name,
25
- nameLabel = _ref.name_labelId,
26
- required = _ref.required,
27
- text = _ref.text,
28
- textLabel = _ref.text_labelId,
29
- visible = _ref.visible,
30
- documentType = _ref.documentType,
31
- viewed = _ref.viewed,
32
- soundActions = _ref.soundActions,
33
- backgroundImage = _ref.backgroundImage,
34
- keyboardControl = _ref.keyboardControl,
35
- audio = _ref.audio,
36
- audioType = _ref.audioType,
37
- audioVolume = _ref.audioVolume,
38
- voice = _ref.voice,
39
- pause = _ref.pause,
40
- styles = _ref.styles;
41
- var _useState = (0, _react.useState)(),
42
- _useState2 = _slicedToArray(_useState, 2),
43
- interval = _useState2[0],
44
- saveInterval = _useState2[1];
45
- var _useState3 = (0, _react.useState)(false),
46
- _useState4 = _slicedToArray(_useState3, 2),
47
- saved = _useState4[0],
48
- save = _useState4[1];
49
- var _useState5 = (0, _react.useState)(0),
50
- _useState6 = _slicedToArray(_useState5, 2),
51
- time = _useState6[0],
52
- setTime = _useState6[1];
53
- var currentLecture = text;
54
- var limit = Math.trunc(currentLecture.split(' ').length * READING_TIME);
55
- var goToLecture = !required || required && time >= limit || required && !visible;
56
- var _soundActions = _slicedToArray(soundActions, 1),
57
- playSound = _soundActions[0];
58
-
59
- // Formateo de la prop 'text' para que Azure haga pausas después de cada tag que se requiera y para evitar que Azure lea los tags htmls
60
- var regexForClosingTags = /<\/p>|<\/h1>|<\/h2>|<\/h3>|<\/h4>|<\/h5>|<\/h6>|<\/li>/gi;
61
- var stringsToDelete = /&quot;|&#39;/gi;
62
- var textWithDotsBeforeClosingTags = text.replace(regexForClosingTags, '. </p>');
63
- var textWithoutStringsToDelete = textWithDotsBeforeClosingTags.replace(stringsToDelete, '');
64
- var textParsedForTTSwithoutHtmlTags = textWithoutStringsToDelete.replace(/(<([^>]+)>)/gi, '');
65
- var TitleAndTextParsedForTTSwithoutHtmlTags = "".concat(name, ". ").concat(textParsedForTTSwithoutHtmlTags);
66
- (0, _useEkho.default)({
67
- audioType: audioType,
68
- voice: voice,
69
- text: TitleAndTextParsedForTTSwithoutHtmlTags,
70
- audio: audio,
71
- soundActions: soundActions,
72
- emitEvent: emitEvent,
73
- volume: audioVolume,
74
- pauseTTS: pause
75
- });
76
- var translate = function translate(id) {
77
- return emitEvent({
78
- type: 'translate',
79
- payload: id
80
- });
81
- };
82
- var close = (0, _react.useCallback)(function () {
83
- if (goToLecture) {
84
- playSound('click-ui');
85
- emitEvent({
86
- type: 'finishMedia',
87
- payload: {
88
- name: nameLabel,
89
- type: 'text',
90
- text: textLabel,
91
- documentType: documentType
92
- }
93
- });
94
- }
95
- }, [documentType, emitEvent, goToLecture, nameLabel, textLabel, playSound]);
96
- keyboardControl(null, !viewed ? close : null, !viewed ? close : null);
97
- (0, _react.useEffect)(function () {
98
- if (!visible && !saved) {
99
- close();
100
- save(true);
101
- }
102
- if (required && visible) {
103
- var timeout = setInterval(function () {
104
- setTime(function (t) {
105
- return t + 1;
106
- });
107
- }, 1000);
108
- saveInterval(timeout);
109
- return function () {
110
- clearInterval(timeout);
111
- };
112
- }
113
- return undefined;
114
- }, [close, required, saved, visible]);
115
- (0, _react.useEffect)(function () {
116
- if (time === limit) {
117
- clearInterval(interval);
118
- }
119
- }, [interval, time, limit]);
120
- var formatTime = limit - time;
121
- var minutes = Math.floor(formatTime / 60);
122
- var seconds = formatTime % 60;
123
- return visible ? /*#__PURE__*/_react.default.createElement("div", {
124
- className: "".concat(viewed ? 'notes--results' : "lectures--container lectures--container--".concat(styles), " ").concat(!viewed && backgroundImage !== null && backgroundImage !== void 0 && backgroundImage.url ? 'lectures--container--with-custom-bg' : ''),
125
- style: !viewed && backgroundImage !== null && backgroundImage !== void 0 && backgroundImage.url ? {
126
- backgroundImage: "url('".concat(backgroundImage.url, "')")
127
- } : {}
128
- }, /*#__PURE__*/_react.default.createElement("div", {
129
- className: viewed ? '' : 'lectures__overlay'
130
- }, /*#__PURE__*/_react.default.createElement("div", {
131
- className: viewed ? 'notes--results__text' : "lectures lectures--".concat(styles)
132
- }, /*#__PURE__*/_react.default.createElement("div", {
133
- className: "lectures--title"
134
- }, name), /*#__PURE__*/_react.default.createElement("div", {
135
- className: "lectures--text",
136
- dir: "auto"
137
- }, /*#__PURE__*/_react.default.createElement("div", null, currentLecture ? (0, _htmlReactParser.default)(currentLecture) : null), !viewed ? /*#__PURE__*/_react.default.createElement(_LectureButtons.default, {
138
- goToLecture: goToLecture,
139
- close: close,
140
- minutes: minutes,
141
- seconds: seconds,
142
- btnText: translate('screens.continue')
143
- }) : null)))) : null;
144
- };
145
- LecturesComponent.defaultProps = {
146
- emitEvent: function emitEvent() {},
147
- name: '',
148
- text: '',
149
- visible: false,
150
- documentType: '',
151
- viewed: false,
152
- required: false,
153
- context: {},
154
- styles: ''
155
- };
156
- var _default = LecturesComponent;
157
- 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 _LecturesComponent = _interopRequireDefault(require("./components/LecturesComponent"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- var _default = _LecturesComponent.default;
10
- exports.default = _default;
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.mockProps2 = exports.mockProps = exports.default = void 0;
7
- var _mocker = require("helpers/mocker");
8
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
- var mockProps = {
15
- emitEvent: _mocker.emitEvent,
16
- soundActions: _mocker.soundActions,
17
- keyboardControl: _mocker.keyboardControl,
18
- name: 'lecture',
19
- required: true,
20
- text: '<p>hola</p><div>soy un hermoso trozo de hmtl</div><div>y yo otro</div>',
21
- visible: true,
22
- documentType: 'text',
23
- viewed: false,
24
- messages: {
25
- 'screens.continue': 'Continuar'
26
- }
27
- };
28
- exports.mockProps = mockProps;
29
- var mockProps2 = _objectSpread(_objectSpread({}, mockProps), {}, {
30
- backgroundImage: {
31
- url: 'https://i.imgur.com/DTFfovW.jpeg'
32
- },
33
- text:
34
- // eslint-disable-next-line max-len
35
- '<p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p><p>A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately, I could not think of a quick way to do so on my macbook and I therefore turned to the Internet.</p>'
36
- });
37
- exports.mockProps2 = mockProps2;
38
- var _default = mockProps;
39
- exports.default = _default;