@gamelearn/arcade-components 0.24.0 → 0.24.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 (38) hide show
  1. package/dist/components/arcade-render/mocks/index.js +20 -2
  2. package/dist/components/auto-evaluation-component/mocks/mockForStory.js +3 -12
  3. package/dist/components/cards-selector-puzzle-component/mocks/mockForStory.js +13 -17
  4. package/dist/components/chained-image-click-puzzle-component/mocks/mockForStory.js +7 -18
  5. package/dist/components/comic-component/mocks/mockForStory.js +6 -0
  6. package/dist/components/conversational-pro-component/mocks/mockForStory.js +21 -0
  7. package/dist/components/cracker-puzzle-component/mocks/mockForStory.js +16 -19
  8. package/dist/components/decision-component/mocks/mockForStory.js +10 -70
  9. package/dist/components/dialog-component/mocks/mockForStory.js +294 -6
  10. package/dist/components/drag-item-puzzle-component/mocks/mockForStory.js +3 -12
  11. package/dist/components/feedback-component/mocks/mockForStory.js +11 -16
  12. package/dist/components/frame-click-puzzle-component/mocks/mockForStory.js +10 -17
  13. package/dist/components/hacker-puzzle-component/mocks/mockForStory.js +10 -15
  14. package/dist/components/hanged-puzzle-component/mocks/mockForStory.js +16 -17
  15. package/dist/components/image-click-puzzle-component/mocks/mockForStory.js +13 -20
  16. package/dist/components/image-click-wrapper-component/mocks/mockForStory.js +14 -28
  17. package/dist/components/image-component/mocks/mockForStory.js +7 -15
  18. package/dist/components/inventory-item/mocks/mockForStory.js +6 -4
  19. package/dist/components/keyboard-puzzle-component/mocks/mockForStory.js +4 -11
  20. package/dist/components/lectures-component/mocks/mockForStory.js +3 -11
  21. package/dist/components/login-puzzle-component/mocks/mockForStory.js +4 -11
  22. package/dist/components/notice-component/mocks/mockForStory.js +3 -5
  23. package/dist/components/pattern-component/mocks/mockForStory.js +5 -5
  24. package/dist/components/pdf-component/mocks/mockForProps.js +5 -11
  25. package/dist/components/rewards-component/mocks/mockForStory.js +11 -76
  26. package/dist/components/survey-component/mocks/mockForStory.js +3 -12
  27. package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +3 -1
  28. package/dist/components/terminal-puzzle-component/mocks/mockForStory.js +10 -14
  29. package/dist/components/test-component/mocks/mockForStory.js +5 -72
  30. package/dist/components/text-click-puzzle-component/mocks/mockForStory.js +7 -18
  31. package/dist/components/url-component/mocks/mockForProps.js +19 -1
  32. package/dist/components/video-component/mocks/mockForStory.js +13 -9
  33. package/dist/components/video-visor/mocks/mockForStory.js +13 -4
  34. package/dist/components/web-builder-puzzle-component/mocks/mockForStory.js +4 -9
  35. package/dist/components/writer-puzzle-component/components/WriterPuzzleComponent.js +4 -4
  36. package/dist/components/writer-puzzle-component/mocks/mockForStory.js +28 -48
  37. package/dist/helpers/mocker.js +121 -0
  38. package/package.json +4 -2
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mockProps = void 0;
7
+
8
+ var _mocker = require("helpers/mocker");
9
+
7
10
  var path = 'https://min.gamelearn.io/statics.triskelion';
8
11
  var cloudfront = 'https://dszv2c8p7i9xo.cloudfront.net/';
9
12
  var mockProps = [{
@@ -11,17 +14,23 @@ var mockProps = [{
11
14
  required: true,
12
15
  documentType: 'document',
13
16
  url: "".concat(cloudfront, "10fdf3ba-8bcb-49ef-b6fd-2cdd083b8e0d/hls/radio.m3u8"),
14
- viewed: false
17
+ viewed: false,
18
+ soundActions: _mocker.soundActions
15
19
  }, {
16
- url: "".concat(path, "/triskelion-statics/videos/ada_hack.mp4")
20
+ url: "".concat(path, "/triskelion-statics/videos/ada_hack.mp4"),
21
+ soundActions: _mocker.soundActions
17
22
  }, {
18
- url: "https://www.youtube.com/embed/5KcuphEhO8Q"
23
+ url: "https://www.youtube.com/embed/5KcuphEhO8Q",
24
+ soundActions: _mocker.soundActions
19
25
  }, {
20
- url: 'https://player.vimeo.com/video/144094036'
26
+ url: 'https://player.vimeo.com/video/144094036',
27
+ soundActions: _mocker.soundActions
21
28
  }, {
29
+ soundActions: _mocker.soundActions,
22
30
  url: 'https://min.int.gamelearn.io/cooked.gl-lms-storage/clients/58dccfba26561500117caf53/documents/Cat-sound.mp3'
23
31
  }, {
24
32
  imgId: 'https://min.int.gamelearn.io/cooked.gl-lms-storage/clients/58dccfba26561500117caf53/image/60224b7a901f3e0012350158/vista-vertical-torre-eiffel-paris-francia_1258-3169.jpg',
33
+ soundActions: _mocker.soundActions,
25
34
  url: 'https://min.int.gamelearn.io/cooked.gl-lms-storage/clients/58dccfba26561500117caf53/documents/Cat-sound.mp3'
26
35
  }];
27
36
  exports.mockProps = mockProps;
@@ -5,13 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.mockProps = void 0;
7
7
 
8
- var emitEvent = function emitEvent(action) {
9
- console.log('Emit event called');
10
-
11
- if (action.type === 'translate') {
12
- return action.payload;
13
- }
14
- };
8
+ var _mocker = require("helpers/mocker");
15
9
 
16
10
  var noop = function noop() {};
17
11
 
@@ -22,8 +16,9 @@ var mockProps = {
22
16
  wrong: {}
23
17
  }
24
18
  },
25
- soundActions: [function () {}, function () {}],
26
- emitEvent: emitEvent,
19
+ emitEvent: _mocker.emitEvent,
20
+ soundActions: _mocker.soundActions,
21
+ setShowPoints: _mocker.setShowPoints,
27
22
  setResolveAction: noop,
28
23
  disableExit: noop
29
24
  };
@@ -409,12 +409,12 @@ var WriterPuzzleComponent = function WriterPuzzleComponent(_ref) {
409
409
  });
410
410
  };
411
411
 
412
- var handleShownText = function handleShownText(text) {
412
+ var handleShownText = function handleShownText(text, i) {
413
413
  var textToPrint = text.fullText;
414
414
  return /*#__PURE__*/_react.default.createElement(_FinishedTextComponent.default, {
415
415
  textToPrint: textToPrint,
416
416
  correct: text.correct,
417
- key: textToPrint
417
+ key: i
418
418
  });
419
419
  };
420
420
 
@@ -494,8 +494,8 @@ var WriterPuzzleComponent = function WriterPuzzleComponent(_ref) {
494
494
  ref: automaticScroll
495
495
  }, isActive && !reviewDone && Object.values(textHolder).map(function (text, i) {
496
496
  return handleText(text, Object.values(textHolder).length - 1, i);
497
- }), reviewDone && Object.values(textHolder).map(function (text) {
498
- return handleShownText(text);
497
+ }), reviewDone && Object.values(textHolder).map(function (text, i) {
498
+ return handleShownText(text, i);
499
499
  }))), finished && /*#__PURE__*/_react.default.createElement("div", {
500
500
  className: "writer-puzzle__footer"
501
501
  }, /*#__PURE__*/_react.default.createElement("button", {
@@ -5,35 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.mock8 = exports.mock7 = exports.mock6 = exports.mock5 = exports.mock4 = exports.mock3 = exports.mock2 = exports.mock = exports.messages = void 0;
7
7
 
8
- var emitEvent = function emitEvent(_ref) {
9
- var type = _ref.type,
10
- payload = _ref.payload;
11
-
12
- if (type === 'translate') {
13
- return payload;
14
- }
15
-
16
- if (type === 'loadIndicators') {
17
- return {
18
- score: [{
19
- type: 'score',
20
- points: 187300,
21
- origName: 'Title 1',
22
- name: '1a3b2d40',
23
- description: '88878788',
24
- id: 'k2koxnkq',
25
- icon: 'font-indicator-chincheta',
26
- records: [{
27
- id: 'k2koxnkq',
28
- name: '1a3b2d40',
29
- icon: 'font-indicator-chincheta'
30
- }]
31
- }],
32
- skill: [],
33
- grade: {}
34
- };
35
- }
36
- };
8
+ var _mocker = require("helpers/mocker");
37
9
 
38
10
  var messages = {
39
11
  'puzzles.reference': 'Información de referencia',
@@ -53,10 +25,10 @@ var messages = {
53
25
  fullText4: ' <p>Cuarto Párrafo </p>',
54
26
  fullText5: ' <p>Quinto Párrafo</p>',
55
27
  fullText6: ' <p>ipsum dolor Lorem sit amet, consectetur adipisicing </p>',
56
- fullText7: ' <p>Mucho Texto aqui a desglosar bla bla bla bla</p>',
57
- fullText8: ' <p>Mucho Texto aqui a desglosar bla bla bla bla</p>',
28
+ fullText7: ' <p>Mucho Texto aqui a desglosar bla bla blsa bla</p>',
29
+ fullText8: ' <p>Mucho Texto aqui a desglosar bla bla bla pbla</p>',
58
30
  fullText9: ' <p>Cuarto Párrafo jasndjkasbndfajksb,dfakjsbhjksabkjasbgjdsfbgsdfasfgsdgsd </p>',
59
- fullText10: ' <p>Mucho Texto aqui a desglosar bla bla bla bla</p>',
31
+ fullText10: ' <p>Mucho Texto aqui a desglosar bla bla blax bla</p>',
60
32
  fullText11: '<p>sdfsdfsdf</p>',
61
33
  fullText12: ' <p>Mucho Texto aqui a desglosar bla bla bla bla</p>',
62
34
  fullText13: ' <p>Mucho Texto aqui a desglosar bla bla bla bla</p>',
@@ -82,8 +54,9 @@ var messages = {
82
54
  };
83
55
  exports.messages = messages;
84
56
  var mock = {
85
- emitEvent: emitEvent,
86
- soundActions: [function () {}, function () {}],
57
+ emitEvent: _mocker.emitEvent,
58
+ soundActions: _mocker.soundActions,
59
+ setShowPoints: _mocker.setShowPoints,
87
60
  texts: [{
88
61
  type: 'fixed',
89
62
  fullText: messages.fullText1
@@ -190,8 +163,9 @@ var mock = {
190
163
  };
191
164
  exports.mock = mock;
192
165
  var mock2 = {
193
- emitEvent: emitEvent,
194
- soundActions: [function () {}, function () {}],
166
+ emitEvent: _mocker.emitEvent,
167
+ soundActions: _mocker.soundActions,
168
+ setShowPoints: _mocker.setShowPoints,
195
169
  texts: [{
196
170
  type: 'fixed',
197
171
  fullText: messages.fullText1
@@ -375,8 +349,9 @@ var mock2 = {
375
349
  };
376
350
  exports.mock2 = mock2;
377
351
  var mock3 = {
378
- emitEvent: emitEvent,
379
- soundActions: [function () {}, function () {}],
352
+ emitEvent: _mocker.emitEvent,
353
+ soundActions: _mocker.soundActions,
354
+ setShowPoints: _mocker.setShowPoints,
380
355
  texts: [{
381
356
  type: 'fixed',
382
357
  fullText: messages.fullText1
@@ -530,8 +505,9 @@ var mock3 = {
530
505
  };
531
506
  exports.mock3 = mock3;
532
507
  var mock4 = {
533
- emitEvent: emitEvent,
534
- soundActions: [function () {}, function () {}],
508
+ emitEvent: _mocker.emitEvent,
509
+ soundActions: _mocker.soundActions,
510
+ setShowPoints: _mocker.setShowPoints,
535
511
  texts: [{
536
512
  type: 'fixed',
537
513
  fullText: messages.fullText1
@@ -715,8 +691,9 @@ var mock4 = {
715
691
  };
716
692
  exports.mock4 = mock4;
717
693
  var mock5 = {
718
- emitEvent: emitEvent,
719
- soundActions: [function () {}, function () {}],
694
+ emitEvent: _mocker.emitEvent,
695
+ soundActions: _mocker.soundActions,
696
+ setShowPoints: _mocker.setShowPoints,
720
697
  texts: [{
721
698
  type: 'fixed',
722
699
  fullText: messages.fullText11
@@ -801,8 +778,9 @@ var mock5 = {
801
778
  };
802
779
  exports.mock5 = mock5;
803
780
  var mock6 = {
804
- emitEvent: emitEvent,
805
- soundActions: [function () {}, function () {}],
781
+ emitEvent: _mocker.emitEvent,
782
+ soundActions: _mocker.soundActions,
783
+ setShowPoints: _mocker.setShowPoints,
806
784
  texts: [{
807
785
  type: 'fixed',
808
786
  fullText: messages.fullText11
@@ -887,8 +865,9 @@ var mock6 = {
887
865
  };
888
866
  exports.mock6 = mock6;
889
867
  var mock7 = {
890
- emitEvent: emitEvent,
891
- soundActions: [function () {}, function () {}],
868
+ emitEvent: _mocker.emitEvent,
869
+ soundActions: _mocker.soundActions,
870
+ setShowPoints: _mocker.setShowPoints,
892
871
  texts: [{
893
872
  type: 'fixed',
894
873
  fullText: messages.fullText11
@@ -973,8 +952,9 @@ var mock7 = {
973
952
  };
974
953
  exports.mock7 = mock7;
975
954
  var mock8 = {
976
- emitEvent: emitEvent,
977
- soundActions: [function () {}, function () {}],
955
+ emitEvent: _mocker.emitEvent,
956
+ soundActions: _mocker.soundActions,
957
+ setShowPoints: _mocker.setShowPoints,
978
958
  texts: [{
979
959
  type: 'fixed',
980
960
  fullText: messages.fullText11
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.translate = exports.soundActions = exports.noopSoundActions = exports.onFinish = exports.functionOnClose = exports.emitEvent = exports.setShowPoints = void 0;
7
+
8
+ var emitEvent = function emitEvent(_ref) {
9
+ var type = _ref.type,
10
+ payload = _ref.payload;
11
+
12
+ if (type === 'translate') {
13
+ return payload;
14
+ }
15
+
16
+ if (type === 'loadIndicators') {
17
+ return {
18
+ score: [{
19
+ color: '#4e469e',
20
+ description: 'description_0_dY5ms0vf',
21
+ description_labelId: 'description_0_dY5ms0vf',
22
+ icon: 'font-indicator-bolsa',
23
+ id: 'ki4qrkam',
24
+ name: 'Indicator1',
25
+ name_labelId: 'name_0_dY5ms9T1',
26
+ points: 295,
27
+ type: 'score'
28
+ }, {
29
+ color: '#4e469e',
30
+ description: 'description_0_dY5ms0vf',
31
+ description_labelId: 'description_0_dY5ms0vf',
32
+ icon: 'font-indicator-bolsa',
33
+ id: 'ki4qrop',
34
+ name: 'Indicator1',
35
+ name_labelId: 'name_0_dY5ms9T1',
36
+ points: 300,
37
+ type: 'score'
38
+ }, {
39
+ color: '#4e469e',
40
+ description: 'description_0_dY5ms0vf',
41
+ description_labelId: 'description_0_dY5ms0vf',
42
+ icon: 'font-indicator-bolsa',
43
+ id: 'ki4qiuyi',
44
+ name: 'Indicator1',
45
+ name_labelId: 'name_0_dY5ms9T1',
46
+ points: 300,
47
+ type: 'score'
48
+ }],
49
+ skill: [{
50
+ color: '#559cac',
51
+ description: 'description_0_dY5msi7o',
52
+ description_labelId: 'description_0_dY5msi7o',
53
+ icon: 'font-indicator-microfono-2',
54
+ id: 'ki4qrkas',
55
+ name: 'competency2',
56
+ name_labelId: 'name_0_dY5mslgV',
57
+ points: 295,
58
+ type: 'skill'
59
+ }, {
60
+ color: '#559cac',
61
+ description: 'description_0_dY5msi7o',
62
+ description_labelId: 'description_0_dY5msi7o',
63
+ icon: 'font-indicator-microfono-2',
64
+ id: 'ki4qropi',
65
+ name: 'competency2',
66
+ name_labelId: 'name_0_dY5mslgV',
67
+ points: 295,
68
+ type: 'skill'
69
+ }],
70
+ grade: undefined
71
+ };
72
+ }
73
+
74
+ console.log('Emit event called:', type, 'payload:', payload);
75
+ };
76
+
77
+ exports.emitEvent = emitEvent;
78
+ var noopSoundActions = [function () {}, function () {}];
79
+ exports.noopSoundActions = noopSoundActions;
80
+ var audio = {
81
+ fail: new Audio('https://www.soundjay.com/buttons/button-10.mp3'),
82
+ 'click-ui': new Audio('https://www.soundjay.com/buttons/button-16.mp3'),
83
+ score: new Audio('https://www.soundjay.com/mechanical/camera-shutter-click-01.mp3')
84
+ };
85
+ var soundActions = [function (sound) {
86
+ console.log('PlaySound called :', sound);
87
+
88
+ if (sound && audio.hasOwnProperty(sound)) {
89
+ audio[sound].play();
90
+ } else if (sound && sound.includes('http')) {
91
+ var exSound = new Audio(sound);
92
+ exSound.play();
93
+ }
94
+ }, function () {}];
95
+ exports.soundActions = soundActions;
96
+
97
+ var setShowPoints = function setShowPoints() {
98
+ var score = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
99
+ console.log('score', score);
100
+ };
101
+
102
+ exports.setShowPoints = setShowPoints;
103
+
104
+ var translate = function translate(payload) {
105
+ return payload;
106
+ };
107
+
108
+ exports.translate = translate;
109
+
110
+ var functionOnClose = function functionOnClose() {
111
+ console.log('closing this');
112
+ };
113
+
114
+ exports.functionOnClose = functionOnClose;
115
+
116
+ var onFinish = function onFinish() {
117
+ var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "a component";
118
+ console.log('you just called onfinish from...', component);
119
+ };
120
+
121
+ exports.onFinish = onFinish;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "license": "Gamelearn",
4
- "version": "0.24.0",
4
+ "version": "0.24.2",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist",
@@ -36,7 +36,7 @@
36
36
  "test": "react-scripts test --transformIgnorePatterns 'node_modules/(?!(three)/)'",
37
37
  "eject": "react-scripts eject",
38
38
  "storybook": "start-storybook -p 6006 -s public",
39
- "build-storybook": "build-storybook -s public",
39
+ "build-storybook": "build-storybook -o build",
40
40
  "generate": "plop"
41
41
  },
42
42
  "browserslist": {
@@ -60,9 +60,11 @@
60
60
  "@storybook/addon-actions": "6.1.11",
61
61
  "@storybook/addon-essentials": "6.1.11",
62
62
  "@storybook/addon-links": "6.1.11",
63
+ "@storybook/addons": "^6.3.8",
63
64
  "@storybook/node-logger": "6.1.11",
64
65
  "@storybook/preset-create-react-app": "3.1.5",
65
66
  "@storybook/react": "6.1.11",
67
+ "@storybook/theming": "^6.3.8",
66
68
  "babel-loader": "8.2.2",
67
69
  "cross-env": "7.0.3",
68
70
  "plop": "^2.7.4",