@gamelearn/arcade-components 0.7.1 → 0.10.0
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/dist/components/decision-component/components/DecisionComponent.js +4 -2
- package/dist/components/decision-component/components/Feedback.js +6 -4
- package/dist/components/decision-component/mocks/mockForStory.js +140 -1
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +1 -2
- package/dist/components/index.js +16 -0
- package/dist/components/{image-click-wrapper-component/components → konva-components}/Area/index.js +0 -20
- package/dist/components/{hacker-puzzle-component/components/KonvaMapper/index.js → konva-components/KonvaMapper.js} +3 -27
- package/dist/components/lectures-component/components/LecturesComponent.js +1 -0
- package/dist/components/rewards-component/components/RewardItem.js +88 -0
- package/dist/components/{decision-component/components/Rewards.js → rewards-component/components/RewardsComponent.js} +98 -111
- package/dist/components/rewards-component/index.js +13 -0
- package/dist/components/rewards-component/mocks/mockForStory.js +264 -0
- package/dist/components/survey-component/components/ApplicableBox.js +73 -0
- package/dist/components/survey-component/components/OpinionBox.js +72 -0
- package/dist/components/survey-component/components/SurveyComponent.js +144 -0
- package/dist/components/survey-component/components/TextBox.js +41 -0
- package/dist/components/survey-component/index.js +13 -0
- package/dist/components/survey-component/mocks/mockForStory.js +20 -0
- package/dist/components/test-component/components/Container.js +162 -0
- package/dist/components/test-component/components/Feedback.js +51 -0
- package/dist/components/test-component/components/Questions.js +71 -0
- package/dist/components/test-component/components/Results.js +164 -0
- package/dist/components/test-component/components/TestComponent.js +278 -0
- package/dist/components/test-component/index.js +13 -0
- package/dist/components/test-component/mocks/mockForStory.js +162 -0
- package/dist/components/writer-puzzle-component/components/FeedbackComponent.js +4 -3
- package/dist/components/writer-puzzle-component/mocks/mockForStory.js +21 -0
- package/package.json +1 -1
- package/dist/components/hacker-puzzle-component/components/Area/index.js +0 -150
- package/dist/components/image-click-wrapper-component/components/KonvaMapper/index.js +0 -230
|
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
|
|
14
|
+
var _RewardItem = _interopRequireDefault(require("./RewardItem"));
|
|
15
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
18
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
@@ -35,46 +37,66 @@ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "und
|
|
|
35
37
|
|
|
36
38
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
39
|
|
|
38
|
-
var
|
|
40
|
+
var RewardsComponent = function RewardsComponent(_ref) {
|
|
39
41
|
var rewards = _ref.rewards,
|
|
40
42
|
addPoints = _ref.addPoints,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
43
|
+
emitEvent = _ref.emitEvent;
|
|
44
|
+
var carouselRef = (0, _react.useRef)();
|
|
45
|
+
var indicators = emitEvent({
|
|
46
|
+
type: 'loadIndicators'
|
|
47
|
+
});
|
|
45
48
|
|
|
46
49
|
var _useState = (0, _react.useState)(0),
|
|
47
50
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
offset = _useState2[0],
|
|
52
|
+
setOffset = _useState2[1];
|
|
53
|
+
|
|
54
|
+
var rewardsSize = (0, _react.useRef)({});
|
|
50
55
|
|
|
51
56
|
var _useState3 = (0, _react.useState)(0),
|
|
52
57
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
leftAmount = _useState4[0],
|
|
59
|
+
setLeftAmount = _useState4[1];
|
|
55
60
|
|
|
56
|
-
var _useState5 = (0, _react.useState)(
|
|
61
|
+
var _useState5 = (0, _react.useState)(),
|
|
57
62
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
rightAmount = _useState6[0],
|
|
64
|
+
setRightAmount = _useState6[1];
|
|
60
65
|
|
|
61
|
-
var _useState7 = (0, _react.useState)(
|
|
66
|
+
var _useState7 = (0, _react.useState)(0),
|
|
62
67
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
totalItems = _useState8[0],
|
|
69
|
+
setTotalItems = _useState8[1];
|
|
65
70
|
|
|
66
|
-
var _useState9 = (0, _react.useState)(0),
|
|
67
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
68
|
-
itemsLeft = _useState10[0],
|
|
69
|
-
setItemsLeft = _useState10[1];
|
|
70
|
-
|
|
71
|
-
var onlyGrade = rewards.filter(function (reward) {
|
|
72
|
-
return reward.type === 'grade';
|
|
73
|
-
}).length === rewards.length;
|
|
74
71
|
var filteredRewards = rewards.filter(function (reward) {
|
|
75
72
|
return reward.type !== 'grade';
|
|
76
73
|
});
|
|
77
74
|
var rewardsUnified = [];
|
|
75
|
+
var displayingItems = 4;
|
|
76
|
+
|
|
77
|
+
var getIndicator = function getIndicator(element) {
|
|
78
|
+
var group = indicators[element.type];
|
|
79
|
+
|
|
80
|
+
if (group) {
|
|
81
|
+
var indicator = group.find(function (r) {
|
|
82
|
+
return r.id === element.id;
|
|
83
|
+
});
|
|
84
|
+
return indicator || null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return null;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var getLabel = function getLabel(element) {
|
|
91
|
+
var indicator = getIndicator(element);
|
|
92
|
+
return indicator ? indicator.name : null;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var _getIcon = function getIcon(element) {
|
|
96
|
+
var indicator = getIndicator(element);
|
|
97
|
+
return indicator ? indicator.icon : null;
|
|
98
|
+
};
|
|
99
|
+
|
|
78
100
|
filteredRewards.forEach(function (currentReward) {
|
|
79
101
|
var found = rewardsUnified.findIndex(function (reward) {
|
|
80
102
|
return currentReward.id === reward.id;
|
|
@@ -83,121 +105,86 @@ var Rewards = function Rewards(_ref) {
|
|
|
83
105
|
if (found >= 0) {
|
|
84
106
|
rewardsUnified[found].points += currentReward.points;
|
|
85
107
|
} else {
|
|
86
|
-
rewardsUnified.push(_objectSpread({}, currentReward)
|
|
108
|
+
rewardsUnified.push(_objectSpread(_objectSpread({}, currentReward), {}, {
|
|
109
|
+
label: getLabel(currentReward)
|
|
110
|
+
}));
|
|
87
111
|
}
|
|
88
112
|
});
|
|
89
|
-
var filteredRewardsUnified = rewardsUnified.filter(function (reward) {
|
|
90
|
-
return reward.points !== 0;
|
|
91
|
-
});
|
|
92
|
-
var noRewards = filteredRewardsUnified.length === 0;
|
|
93
|
-
(0, _react.useEffect)(function () {
|
|
94
|
-
if (onlyGrade) {
|
|
95
|
-
addPoints();
|
|
96
|
-
}
|
|
97
|
-
}, [onlyGrade, addPoints]);
|
|
98
|
-
(0, _react.useEffect)(function () {
|
|
99
|
-
if (carouselContentRef.current) {
|
|
100
|
-
setCarouselContentWidth(carouselContentRef.current.offsetWidth);
|
|
101
|
-
}
|
|
102
|
-
}, [carouselContentRef]);
|
|
103
|
-
(0, _react.useEffect)(function () {
|
|
104
|
-
var itemInScreen = Math.floor(carouselContentWidth / itemWidth);
|
|
105
|
-
var currentItemsLeft = filteredRewardsUnified.length - itemInScreen - offset;
|
|
106
|
-
setItemsLeft(currentItemsLeft);
|
|
107
|
-
}, [carouselContentWidth, itemWidth, offset, filteredRewardsUnified.length]);
|
|
108
|
-
(0, _react.useEffect)(function () {
|
|
109
|
-
setTransform("translateX(-".concat(itemWidth * offset, "px)"));
|
|
110
|
-
}, [itemWidth, offset]);
|
|
111
|
-
(0, _react.useEffect)(function () {
|
|
112
|
-
if (itemRef.current) {
|
|
113
|
-
var separatorWidth = Number.parseInt(window.getComputedStyle(itemRef.current).getPropertyValue('margin-right').split('px')[0], 0);
|
|
114
|
-
var iWidth = Number.parseInt(itemRef.current.offsetWidth, 0);
|
|
115
|
-
setItemWidth(separatorWidth + iWidth);
|
|
116
|
-
}
|
|
117
|
-
}, [carouselContentRef, itemRef]);
|
|
118
113
|
|
|
119
114
|
var onClickPrev = function onClickPrev() {
|
|
120
|
-
if (offset
|
|
115
|
+
if (offset - 1 < 0) return;
|
|
121
116
|
setOffset(offset - 1);
|
|
117
|
+
var nextSize = Object.values(rewardsSize.current)[offset - 1];
|
|
118
|
+
setRightAmount(null);
|
|
119
|
+
setLeftAmount(leftAmount + nextSize);
|
|
122
120
|
};
|
|
123
121
|
|
|
124
122
|
var onClickNext = function onClickNext() {
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
123
|
+
if (offset + displayingItems >= totalItems) return;
|
|
124
|
+
setRightAmount(offset + displayingItems === totalItems - 1 ? 0 : null);
|
|
129
125
|
setOffset(offset + 1);
|
|
126
|
+
var nextSize = Object.values(rewardsSize.current)[offset];
|
|
127
|
+
setLeftAmount(leftAmount - nextSize);
|
|
130
128
|
};
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
130
|
+
(0, _react.useEffect)(function () {
|
|
131
|
+
setTotalItems(Object.values(rewardsSize.current).length);
|
|
132
|
+
}, []);
|
|
136
133
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
137
134
|
className: "test--results__rewards"
|
|
138
135
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
139
136
|
onClick: onClickPrev,
|
|
140
|
-
className: "icon-back ".concat(
|
|
137
|
+
className: "icon-back ".concat(rewardsUnified.length <= displayingItems ? 'visibility--hidden' : '', " ").concat(offset <= 0 ? 'disabled' : '')
|
|
141
138
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
142
|
-
ref: carouselContentRef,
|
|
143
139
|
className: "test--results__carrousel"
|
|
144
140
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
145
141
|
className: "test--results__carrousel--list test--results__centered",
|
|
146
142
|
style: {
|
|
147
|
-
|
|
143
|
+
position: 'relative',
|
|
144
|
+
height: '100%',
|
|
145
|
+
overflow: 'hidden'
|
|
148
146
|
}
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
148
|
+
ref: carouselRef,
|
|
149
|
+
style: {
|
|
150
|
+
display: 'flex',
|
|
151
|
+
position: 'absolute',
|
|
152
|
+
left: rewardsUnified.length >= displayingItems && leftAmount !== null && rightAmount == null ? "".concat(leftAmount, "px") : 'auto',
|
|
153
|
+
right: rightAmount !== null ? "".concat(rightAmount) : 'auto',
|
|
154
|
+
transition: 'all .2s linear'
|
|
156
155
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
}, rewardsUnified && Object.values(rewardsUnified).map(function (reward) {
|
|
157
|
+
return /*#__PURE__*/_react.default.createElement(_RewardItem.default, {
|
|
158
|
+
key: reward.id,
|
|
159
|
+
ref: function ref(node) {
|
|
160
|
+
if (node) {
|
|
161
|
+
var computedStyle = window.getComputedStyle(node);
|
|
162
|
+
var marginString = computedStyle.marginLeft.split('px')[0];
|
|
163
|
+
var marginLeft = parseInt(marginString, 10);
|
|
164
|
+
rewardsSize.current[reward.id] = node.clientWidth + marginLeft * 2;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
emitEvent: emitEvent,
|
|
168
|
+
elementReward: reward,
|
|
169
|
+
getIcon: function getIcon(icon) {
|
|
170
|
+
return _getIcon(icon);
|
|
171
|
+
}
|
|
160
172
|
});
|
|
161
|
-
|
|
162
|
-
if (!indicator) {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
167
|
-
key: indicator.name,
|
|
168
|
-
ref: itemRef,
|
|
169
|
-
className: "test--results__carrousel--item"
|
|
170
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
171
|
-
className: "test--rewards__icons"
|
|
172
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
173
|
-
className: indicator.icon
|
|
174
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
175
|
-
className: "test--rewards__indicator\n ".concat(reward.points > 0 ? 'success' : 'failed')
|
|
176
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
177
|
-
className: "".concat(reward.points > 0 ? 'icon-up' : 'icon-down')
|
|
178
|
-
}))), /*#__PURE__*/_react.default.createElement("span", {
|
|
179
|
-
className: "test--rewards__text"
|
|
180
|
-
}, /*#__PURE__*/_react.default.createElement("b", null, reward.points > 0 ? '+' : '', reward.points), ":", indicator.name));
|
|
181
|
-
}))), /*#__PURE__*/_react.default.createElement("span", {
|
|
173
|
+
})))), /*#__PURE__*/_react.default.createElement("span", {
|
|
182
174
|
onClick: onClickNext,
|
|
183
|
-
className: "icon-next ".concat(
|
|
175
|
+
className: "icon-next ".concat(rewardsUnified.length <= displayingItems ? 'visibility--hidden' : '', " ").concat(offset + displayingItems >= totalItems ? 'disabled' : '')
|
|
184
176
|
}));
|
|
185
177
|
};
|
|
186
178
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
179
|
+
RewardsComponent.propTypes = {
|
|
180
|
+
nodeId: _propTypes.default.string,
|
|
181
|
+
context: _propTypes.default.shape({}),
|
|
182
|
+
rewards: _propTypes.default.arrayOf({})
|
|
191
183
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
id: _propTypes.default.string,
|
|
197
|
-
name: _propTypes.default.string,
|
|
198
|
-
points: _propTypes.default.number
|
|
199
|
-
})),
|
|
200
|
-
addPoints: _propTypes.default.func
|
|
184
|
+
RewardsComponent.defaultProps = {
|
|
185
|
+
nodeId: 0,
|
|
186
|
+
context: {},
|
|
187
|
+
rewards: []
|
|
201
188
|
};
|
|
202
|
-
var _default =
|
|
189
|
+
var _default = RewardsComponent;
|
|
203
190
|
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _RewardsComponent = _interopRequireDefault(require("./components/RewardsComponent"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _RewardsComponent.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mockProps5 = exports.mockProps4 = exports.mockProps3 = exports.mockProps2 = exports.mockProps1 = 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
|
+
|
|
75
|
+
var mockProps1 = {
|
|
76
|
+
emitEvent: emitEvent,
|
|
77
|
+
rewards: [{
|
|
78
|
+
id: 'ki4qrkam',
|
|
79
|
+
name: 'Power',
|
|
80
|
+
points: -22,
|
|
81
|
+
type: 'score'
|
|
82
|
+
}]
|
|
83
|
+
};
|
|
84
|
+
exports.mockProps1 = mockProps1;
|
|
85
|
+
var mockProps2 = {
|
|
86
|
+
emitEvent: emitEvent,
|
|
87
|
+
rewards: [{
|
|
88
|
+
id: 'ki4qrkam',
|
|
89
|
+
name: 'Power',
|
|
90
|
+
points: -22,
|
|
91
|
+
type: 'score'
|
|
92
|
+
}, {
|
|
93
|
+
id: 'ki4qrop',
|
|
94
|
+
name: 'BananaSplit3jndflgndjkfh',
|
|
95
|
+
points: -299453433433434,
|
|
96
|
+
type: 'score'
|
|
97
|
+
}]
|
|
98
|
+
};
|
|
99
|
+
exports.mockProps2 = mockProps2;
|
|
100
|
+
var mockProps3 = {
|
|
101
|
+
emitEvent: emitEvent,
|
|
102
|
+
rewards: [{
|
|
103
|
+
id: 'ki4qrkam',
|
|
104
|
+
name: 'Power',
|
|
105
|
+
points: -22,
|
|
106
|
+
type: 'score'
|
|
107
|
+
}, {
|
|
108
|
+
id: 'ki4qrop',
|
|
109
|
+
name: 'BananaSplit3jndflgndjkfh',
|
|
110
|
+
points: -299453433433434,
|
|
111
|
+
type: 'score'
|
|
112
|
+
}, {
|
|
113
|
+
id: 'ki4qiuyi',
|
|
114
|
+
name: 'BananaSplit4',
|
|
115
|
+
points: 87,
|
|
116
|
+
type: 'score'
|
|
117
|
+
}]
|
|
118
|
+
};
|
|
119
|
+
exports.mockProps3 = mockProps3;
|
|
120
|
+
var mockProps4 = {
|
|
121
|
+
emitEvent: emitEvent,
|
|
122
|
+
rewards: [{
|
|
123
|
+
id: 'ki4qrkam',
|
|
124
|
+
name: 'Power',
|
|
125
|
+
points: -22,
|
|
126
|
+
type: 'score'
|
|
127
|
+
}, {
|
|
128
|
+
id: 'ki4qrkam',
|
|
129
|
+
name: 'BananaSplit',
|
|
130
|
+
points: -2,
|
|
131
|
+
type: 'score'
|
|
132
|
+
}, {
|
|
133
|
+
id: 'ki4qrkam',
|
|
134
|
+
name: 'BananaSplit2',
|
|
135
|
+
points: -2,
|
|
136
|
+
type: 'score'
|
|
137
|
+
}, {
|
|
138
|
+
id: 'ki4qrop',
|
|
139
|
+
name: 'BananaSplit3jndflgndjkfh',
|
|
140
|
+
points: -299453433433434,
|
|
141
|
+
type: 'score'
|
|
142
|
+
}, {
|
|
143
|
+
id: 'ki4qiuyi',
|
|
144
|
+
name: 'BananaSplit4',
|
|
145
|
+
points: 87,
|
|
146
|
+
type: 'score'
|
|
147
|
+
}, {
|
|
148
|
+
id: 'ki4qrkam',
|
|
149
|
+
name: 'BananaSplit5',
|
|
150
|
+
points: 552,
|
|
151
|
+
type: 'score'
|
|
152
|
+
}, {
|
|
153
|
+
id: 'ki4qrkas',
|
|
154
|
+
name: 'BananaSplit46',
|
|
155
|
+
points: 87,
|
|
156
|
+
type: 'skill'
|
|
157
|
+
}, {
|
|
158
|
+
id: 'ki4qrkas',
|
|
159
|
+
name: 'BananaSplit57',
|
|
160
|
+
points: 552,
|
|
161
|
+
type: 'skill'
|
|
162
|
+
}, {
|
|
163
|
+
id: 'ki4qrkas',
|
|
164
|
+
name: 'BananaSplit8',
|
|
165
|
+
points: 87,
|
|
166
|
+
type: 'skill'
|
|
167
|
+
}, {
|
|
168
|
+
id: 'ki4qrkas',
|
|
169
|
+
name: 'BananaSplit9',
|
|
170
|
+
points: 552,
|
|
171
|
+
type: 'skill'
|
|
172
|
+
}, {
|
|
173
|
+
id: 'ki4qrkas',
|
|
174
|
+
name: 'BananaSplit10',
|
|
175
|
+
points: 87,
|
|
176
|
+
type: 'skill'
|
|
177
|
+
}, {
|
|
178
|
+
id: 'ki4qrkas',
|
|
179
|
+
name: 'BananaSplit11',
|
|
180
|
+
points: 552,
|
|
181
|
+
type: 'skill'
|
|
182
|
+
}, {
|
|
183
|
+
id: 'ki4qrkas',
|
|
184
|
+
name: 'BananaSplit12',
|
|
185
|
+
points: 87,
|
|
186
|
+
type: 'skill'
|
|
187
|
+
}]
|
|
188
|
+
};
|
|
189
|
+
exports.mockProps4 = mockProps4;
|
|
190
|
+
var mockProps5 = {
|
|
191
|
+
emitEvent: emitEvent,
|
|
192
|
+
rewards: [{
|
|
193
|
+
id: 'ki4qrkam',
|
|
194
|
+
name: 'Power',
|
|
195
|
+
points: -22,
|
|
196
|
+
type: 'score'
|
|
197
|
+
}, {
|
|
198
|
+
id: 'ki4qrkam',
|
|
199
|
+
name: 'BananaSplit',
|
|
200
|
+
points: -2,
|
|
201
|
+
type: 'score'
|
|
202
|
+
}, {
|
|
203
|
+
id: 'ki4qrkam',
|
|
204
|
+
name: 'BananaSplit2',
|
|
205
|
+
points: -2,
|
|
206
|
+
type: 'score'
|
|
207
|
+
}, {
|
|
208
|
+
id: 'ki4qrop',
|
|
209
|
+
name: 'BananaSplit3jndflgndjkfh',
|
|
210
|
+
points: -299453433433434,
|
|
211
|
+
type: 'score'
|
|
212
|
+
}, {
|
|
213
|
+
id: 'ki4qiuyi',
|
|
214
|
+
name: 'BananaSplit4',
|
|
215
|
+
points: 87,
|
|
216
|
+
type: 'score'
|
|
217
|
+
}, {
|
|
218
|
+
id: 'ki4qrkam',
|
|
219
|
+
name: 'BananaSplit5',
|
|
220
|
+
points: 552,
|
|
221
|
+
type: 'score'
|
|
222
|
+
}, {
|
|
223
|
+
id: 'ki4qrkas',
|
|
224
|
+
name: 'BananaSplit46',
|
|
225
|
+
points: 87,
|
|
226
|
+
type: 'skill'
|
|
227
|
+
}, {
|
|
228
|
+
id: 'ki4qrkas',
|
|
229
|
+
name: 'BananaSplit57',
|
|
230
|
+
points: 552,
|
|
231
|
+
type: 'skill'
|
|
232
|
+
}, {
|
|
233
|
+
id: 'ki4qrkas',
|
|
234
|
+
name: 'BananaSplit8',
|
|
235
|
+
points: 87,
|
|
236
|
+
type: 'skill'
|
|
237
|
+
}, {
|
|
238
|
+
id: 'ki4qrkas',
|
|
239
|
+
name: 'BananaSplit9',
|
|
240
|
+
points: 552,
|
|
241
|
+
type: 'skill'
|
|
242
|
+
}, {
|
|
243
|
+
id: 'ki4qrkas',
|
|
244
|
+
name: 'BananaSplit10',
|
|
245
|
+
points: 87,
|
|
246
|
+
type: 'skill'
|
|
247
|
+
}, {
|
|
248
|
+
id: 'ki4qrkas',
|
|
249
|
+
name: 'BananaSplit11',
|
|
250
|
+
points: 552,
|
|
251
|
+
type: 'skill'
|
|
252
|
+
}, {
|
|
253
|
+
id: 'ki4qrkas',
|
|
254
|
+
name: 'BananaSplit12',
|
|
255
|
+
points: 87,
|
|
256
|
+
type: 'skill'
|
|
257
|
+
}, {
|
|
258
|
+
id: 'ki4qropi',
|
|
259
|
+
name: 'BananaSplit13',
|
|
260
|
+
points: 552,
|
|
261
|
+
type: 'skill'
|
|
262
|
+
}]
|
|
263
|
+
};
|
|
264
|
+
exports.mockProps5 = mockProps5;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
+
|
|
20
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
|
|
24
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
|
+
|
|
30
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
31
|
+
|
|
32
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
|
+
|
|
34
|
+
var OPTIONS = ['yes', 'no'];
|
|
35
|
+
var LETTERS = ['A', 'B'];
|
|
36
|
+
|
|
37
|
+
var ApplicableBox = function ApplicableBox(_ref) {
|
|
38
|
+
var setSurveyData = _ref.setSurveyData,
|
|
39
|
+
survey = _ref.survey,
|
|
40
|
+
id = _ref.id,
|
|
41
|
+
enable = _ref.enable,
|
|
42
|
+
translate = _ref.translate;
|
|
43
|
+
|
|
44
|
+
var _useState = (0, _react.useState)(),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
optionSelected = _useState2[0],
|
|
47
|
+
selectOption = _useState2[1];
|
|
48
|
+
|
|
49
|
+
var select = function select(option) {
|
|
50
|
+
enable();
|
|
51
|
+
selectOption(option);
|
|
52
|
+
setSurveyData(_objectSpread(_objectSpread({}, survey), {}, _defineProperty({}, id, option)));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
56
|
+
className: "survey--page__item"
|
|
57
|
+
}, OPTIONS.map(function (option, i) {
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
+
key: option,
|
|
60
|
+
onClick: function onClick() {
|
|
61
|
+
return select(option);
|
|
62
|
+
},
|
|
63
|
+
className: "survey--response__item ".concat(optionSelected === option ? 'selected' : '')
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
+
className: "survey--response__index"
|
|
66
|
+
}, LETTERS[i]), /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
className: "survey--response__text"
|
|
68
|
+
}, translate("survey.".concat(option))));
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var _default = ApplicableBox;
|
|
73
|
+
exports.default = _default;
|