@gamelearn/arcade-components 2.2.13 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/auto-evaluation-component/components/AutoEvaluation.js +84 -26
- package/dist/components/decision-component/components/DecisionBody.js +7 -11
- package/dist/components/decision-component/components/DecisionComponent.js +8 -8
- package/dist/components/dialog-component/components/BubbleWrapper.js +11 -22
- package/dist/components/dialog-component/components/DialogComponent.js +10 -74
- package/dist/components/dialog-component/components/SpeechBubbleComponent.js +14 -13
- package/dist/components/survey-component/components/ApplicableBox.js +6 -28
- package/dist/components/survey-component/components/OpinionBox.js +6 -28
- package/dist/components/survey-component/components/SurveyComponent.js +40 -37
- package/dist/components/survey-component/components/TextBox.js +0 -2
- package/package.json +2 -2
|
@@ -21,6 +21,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
21
21
|
|
|
22
22
|
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; }
|
|
23
23
|
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
31
|
+
|
|
32
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
33
|
+
|
|
34
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
35
|
+
|
|
36
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
37
|
+
|
|
24
38
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
39
|
|
|
26
40
|
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."); }
|
|
@@ -34,7 +48,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
34
48
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
49
|
|
|
36
50
|
var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
37
|
-
var _questions$currentQue;
|
|
51
|
+
var _questions$currentQue, _surveyData$current$q3, _surveyData$current$q4;
|
|
38
52
|
|
|
39
53
|
var description = _ref.description,
|
|
40
54
|
questions = _ref.questions,
|
|
@@ -57,15 +71,15 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
57
71
|
currentQuestion = _useState6[0],
|
|
58
72
|
setCurrentQuestion = _useState6[1];
|
|
59
73
|
|
|
60
|
-
var _useState7 = (0, _react.useState)(
|
|
74
|
+
var _useState7 = (0, _react.useState)({
|
|
75
|
+
current: {
|
|
76
|
+
questions: [],
|
|
77
|
+
type: type
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
61
80
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var surveyData = (0, _react.useRef)({
|
|
66
|
-
questions: [],
|
|
67
|
-
type: type
|
|
68
|
-
});
|
|
81
|
+
surveyData = _useState8[0],
|
|
82
|
+
setSurveyData = _useState8[1];
|
|
69
83
|
|
|
70
84
|
var _soundActions = _slicedToArray(soundActions, 1),
|
|
71
85
|
play = _soundActions[0];
|
|
@@ -91,18 +105,49 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
91
105
|
}
|
|
92
106
|
}, [questions, phase]);
|
|
93
107
|
|
|
94
|
-
var handleNextQuestion = function handleNextQuestion() {
|
|
108
|
+
var handleNextQuestion = function handleNextQuestion(optionSelected) {
|
|
109
|
+
var _surveyData$current$q;
|
|
110
|
+
|
|
111
|
+
var backward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
112
|
+
var answer = optionSelected !== null ? optionSelected : (_surveyData$current$q = surveyData.current.questions.find(function (q) {
|
|
113
|
+
return q.id === questions[currentQuestion].id;
|
|
114
|
+
})) === null || _surveyData$current$q === void 0 ? void 0 : _surveyData$current$q.answer;
|
|
95
115
|
play('click-ui');
|
|
96
|
-
surveyData.current.questions.push({
|
|
97
|
-
id: questions[currentQuestion].id,
|
|
98
|
-
answer: optionSelected
|
|
99
|
-
});
|
|
100
116
|
|
|
101
|
-
if (
|
|
102
|
-
|
|
117
|
+
if (!backward) {
|
|
118
|
+
var questionIndex = surveyData.current.questions.findIndex(function (q) {
|
|
119
|
+
return q.id === questions[currentQuestion].id;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
var updatedQuestions = _toConsumableArray(surveyData.current.questions);
|
|
123
|
+
|
|
124
|
+
if (questionIndex > -1) {
|
|
125
|
+
updatedQuestions.splice(questionIndex, 1, {
|
|
126
|
+
id: questions[currentQuestion].id,
|
|
127
|
+
answer: answer
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
updatedQuestions.push({
|
|
131
|
+
id: questions[currentQuestion].id,
|
|
132
|
+
answer: answer
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
setSurveyData(_objectSpread(_objectSpread({}, surveyData), {}, {
|
|
137
|
+
current: _objectSpread(_objectSpread({}, surveyData.current), {}, {
|
|
138
|
+
questions: updatedQuestions
|
|
139
|
+
})
|
|
140
|
+
}));
|
|
141
|
+
|
|
142
|
+
if (currentQuestion === questions.length - 1) {
|
|
143
|
+
setFinish(true);
|
|
144
|
+
} else {
|
|
145
|
+
setCurrentQuestion(currentQuestion + 1);
|
|
146
|
+
setFinish(false);
|
|
147
|
+
}
|
|
103
148
|
} else {
|
|
104
|
-
|
|
105
|
-
|
|
149
|
+
setCurrentQuestion(currentQuestion - 1);
|
|
150
|
+
setFinish(false);
|
|
106
151
|
}
|
|
107
152
|
};
|
|
108
153
|
|
|
@@ -133,27 +178,40 @@ var AutoEvaluation = function AutoEvaluation(_ref) {
|
|
|
133
178
|
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
134
179
|
className: "survey--points"
|
|
135
180
|
}, Array(11).fill(0).map(function (_, i) {
|
|
181
|
+
var _surveyData$current$q2;
|
|
182
|
+
|
|
136
183
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
137
184
|
key: "".concat(0 + i),
|
|
138
185
|
onClick: function onClick() {
|
|
139
|
-
|
|
186
|
+
handleNextQuestion(i, false);
|
|
140
187
|
},
|
|
141
|
-
className: "survey--points__item ".concat(
|
|
188
|
+
className: "survey--points__item ".concat(((_surveyData$current$q2 = surveyData.current.questions[currentQuestion]) === null || _surveyData$current$q2 === void 0 ? void 0 : _surveyData$current$q2.answer) === i ? 'selected' : '')
|
|
142
189
|
}, i);
|
|
143
190
|
}))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
144
191
|
className: "test--buttons next"
|
|
145
|
-
},
|
|
192
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
193
|
+
type: "button",
|
|
194
|
+
disabled: currentQuestion === 0,
|
|
195
|
+
onClick: function onClick() {
|
|
196
|
+
return handleNextQuestion(null, true);
|
|
197
|
+
},
|
|
198
|
+
className: "gat--btn__navigation ".concat(currentQuestion === 0 ? 'disabled' : '')
|
|
199
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
200
|
+
className: (0, _LangIsRtl.default)() ? 'icon-next' : 'icon-back'
|
|
201
|
+
})), finish ? /*#__PURE__*/_react.default.createElement("button", {
|
|
146
202
|
type: "button",
|
|
147
|
-
className: "gat--btn gat--btn__primary auto-evaluation__button not-transition",
|
|
148
203
|
onClick: function onClick() {
|
|
149
204
|
setPhase('end');
|
|
150
205
|
play('click-ui');
|
|
151
|
-
}
|
|
206
|
+
},
|
|
207
|
+
className: "gat--btn gat--btn__primary auto-evaluation__button not-transition"
|
|
152
208
|
}, /*#__PURE__*/_react.default.createElement("span", null, translate('auto-evaluation.end'))) : /*#__PURE__*/_react.default.createElement("button", {
|
|
153
|
-
onClick: handleNextQuestion,
|
|
154
209
|
type: "button",
|
|
155
|
-
|
|
156
|
-
|
|
210
|
+
onClick: function onClick() {
|
|
211
|
+
return handleNextQuestion(null, false);
|
|
212
|
+
},
|
|
213
|
+
disabled: ((_surveyData$current$q3 = surveyData.current.questions[currentQuestion]) === null || _surveyData$current$q3 === void 0 ? void 0 : _surveyData$current$q3.answer) === undefined,
|
|
214
|
+
className: "gat--btn__navigation ".concat(((_surveyData$current$q4 = surveyData.current.questions[currentQuestion]) === null || _surveyData$current$q4 === void 0 ? void 0 : _surveyData$current$q4.answer) === undefined ? 'disabled' : '')
|
|
157
215
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
158
216
|
className: (0, _LangIsRtl.default)() ? 'icon-back' : 'icon-next'
|
|
159
217
|
})))), phase === 'end' && /*#__PURE__*/_react.default.createElement(_EndScreen.default, {
|
|
@@ -57,16 +57,18 @@ var DecisionBody = function DecisionBody(_ref) {
|
|
|
57
57
|
var choose = function choose(option) {
|
|
58
58
|
selectChoice(option);
|
|
59
59
|
|
|
60
|
-
if (
|
|
60
|
+
if (showingResults && failed) {
|
|
61
61
|
changeOption(option);
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
onNext(option);
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
var canNext = !showingResults && selectedChoice.id !== undefined || !failed;
|
|
66
68
|
var optionsProps = {
|
|
67
69
|
inherited: inherited,
|
|
68
70
|
selectedChoice: selectedChoice,
|
|
69
|
-
selectChoice:
|
|
71
|
+
selectChoice: failed ? choose : noop,
|
|
70
72
|
options: options,
|
|
71
73
|
showingResults: showingResults
|
|
72
74
|
};
|
|
@@ -88,19 +90,13 @@ var DecisionBody = function DecisionBody(_ref) {
|
|
|
88
90
|
dir: "auto"
|
|
89
91
|
}, /*#__PURE__*/_react.default.createElement(_Options.default, optionsProps)), /*#__PURE__*/_react.default.createElement("div", {
|
|
90
92
|
className: "popup--buttons"
|
|
91
|
-
},
|
|
92
|
-
type: "button",
|
|
93
|
-
className: "gat--btn gat--btn__primary ".concat(selectedChoice.id !== undefined ? '' : 'disabled'),
|
|
94
|
-
onClick: function onClick() {
|
|
95
|
-
return canNext ? onNext(selectedChoice) : onBack(selectedChoice);
|
|
96
|
-
}
|
|
97
|
-
}, canNext || selectedChoice.id === undefined ? translate('screens.continue') : translate('tests.retry')) : /*#__PURE__*/_react.default.createElement("button", {
|
|
93
|
+
}, !failed ? /*#__PURE__*/_react.default.createElement("button", {
|
|
98
94
|
type: "button",
|
|
99
95
|
className: "gat--btn gat--btn__primary ".concat(selectedChoice.id !== undefined ? '' : 'disabled'),
|
|
100
96
|
onClick: function onClick() {
|
|
101
|
-
return onNext(selectedChoice);
|
|
97
|
+
return required && canNext ? onNext(selectedChoice) : onBack(selectedChoice);
|
|
102
98
|
}
|
|
103
|
-
}, translate('screens.continue'))));
|
|
99
|
+
}, translate('screens.continue')) : null));
|
|
104
100
|
};
|
|
105
101
|
|
|
106
102
|
var ComplexDecision = function ComplexDecision() {
|
|
@@ -186,14 +186,14 @@ var DecisionComponent = function DecisionComponent(_ref) {
|
|
|
186
186
|
playSound('fail');
|
|
187
187
|
|
|
188
188
|
if (!branched) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
189
|
+
emitEvent({
|
|
190
|
+
type: 'addPoints',
|
|
191
|
+
payload: choice.rewards,
|
|
192
|
+
finish: false,
|
|
193
|
+
complex: true
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
if (!required) {
|
|
197
197
|
setResultChoice({});
|
|
198
198
|
selectView('options');
|
|
199
199
|
}
|
|
@@ -19,41 +19,30 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
22
|
-
var cleanStyle = {
|
|
23
|
-
width: '100vw',
|
|
24
|
-
height: '100vh',
|
|
25
|
-
position: 'static'
|
|
26
|
-
};
|
|
27
|
-
|
|
28
22
|
var BubbleWrapper = function BubbleWrapper(_ref) {
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
currentMessage = _ref.currentMessage;
|
|
23
|
+
var currentMessage = _ref.currentMessage,
|
|
24
|
+
translate = _ref.translate;
|
|
32
25
|
var group = (0, _react.useRef)();
|
|
33
26
|
var bubble = (0, _react.useRef)();
|
|
34
|
-
|
|
35
|
-
var onBubbleBuild = function onBubbleBuild() {
|
|
36
|
-
onLoad(group, bubble);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
27
|
var container = document.querySelector('.screens--container');
|
|
40
28
|
return /*#__PURE__*/_react.default.createElement("group", {
|
|
41
|
-
ref: group
|
|
42
|
-
position: position
|
|
29
|
+
ref: group
|
|
43
30
|
}, /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.HtmlPro, {
|
|
44
31
|
zIndexRange: [5, 5],
|
|
45
|
-
calculatePosition: currentMessage.inScene ? undefined : function () {
|
|
46
|
-
return [0, 0];
|
|
47
|
-
},
|
|
48
32
|
portal: container ? {
|
|
49
33
|
current: container
|
|
50
34
|
} : undefined,
|
|
51
|
-
style:
|
|
35
|
+
style: {
|
|
36
|
+
width: '100vw',
|
|
37
|
+
height: '100vh',
|
|
52
38
|
position: 'static'
|
|
53
|
-
}
|
|
39
|
+
},
|
|
40
|
+
calculatePosition: function calculatePosition() {
|
|
41
|
+
return [0, 0];
|
|
42
|
+
}
|
|
54
43
|
}, /*#__PURE__*/_react.default.createElement(_SpeechBubbleComponent.default, {
|
|
44
|
+
translate: translate,
|
|
55
45
|
ref: bubble,
|
|
56
|
-
onLoad: onBubbleBuild,
|
|
57
46
|
message: currentMessage
|
|
58
47
|
})));
|
|
59
48
|
};
|
|
@@ -23,8 +23,6 @@ var _decisionComponent = _interopRequireDefault(require("../../decision-componen
|
|
|
23
23
|
|
|
24
24
|
var _helpers = require("../../../helpers");
|
|
25
25
|
|
|
26
|
-
var _deviceDetection = require("../../../helpers/deviceDetection");
|
|
27
|
-
|
|
28
26
|
var _useTimeout2 = _interopRequireDefault(require("../../../helpers/useTimeout"));
|
|
29
27
|
|
|
30
28
|
var _useEkho = _interopRequireDefault(require("../../../helpers/useEkho"));
|
|
@@ -67,8 +65,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
67
65
|
|
|
68
66
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
69
67
|
|
|
68
|
+
// import { DeviceDetection } from '../../../helpers/deviceDetection';
|
|
70
69
|
// Global
|
|
71
|
-
|
|
70
|
+
// const isMobile = DeviceDetection();
|
|
72
71
|
var crossFadeDuration = 0.2;
|
|
73
72
|
var characterMs = 75;
|
|
74
73
|
var minMs = 1400;
|
|
@@ -128,8 +127,6 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
128
127
|
start = _useTimeout.start,
|
|
129
128
|
stop = _useTimeout.stop;
|
|
130
129
|
|
|
131
|
-
var bubbleRef = (0, _react.useRef)();
|
|
132
|
-
var groupRef = (0, _react.useRef)();
|
|
133
130
|
var loader = (0, _react.useMemo)(function () {
|
|
134
131
|
return new _GLTFLoader.GLTFLoader();
|
|
135
132
|
}, []);
|
|
@@ -168,8 +165,6 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
168
165
|
var _useState13 = (0, _react.useState)({
|
|
169
166
|
text: '',
|
|
170
167
|
name: '',
|
|
171
|
-
left: false,
|
|
172
|
-
top: false,
|
|
173
168
|
inScene: false,
|
|
174
169
|
thinkful: false,
|
|
175
170
|
voiceOver: false,
|
|
@@ -244,13 +239,13 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
244
239
|
var _slot$character, _slot$character$resou;
|
|
245
240
|
|
|
246
241
|
var object = actors.find(function (element) {
|
|
247
|
-
if (element.uid === slot.uid) {
|
|
242
|
+
if ((element === null || element === void 0 ? void 0 : element.uid) === (slot === null || slot === void 0 ? void 0 : slot.uid)) {
|
|
248
243
|
return element;
|
|
249
244
|
}
|
|
250
245
|
|
|
251
246
|
return '';
|
|
252
247
|
});
|
|
253
|
-
return ((_slot$character = slot.character) === null || _slot$character === void 0 ? void 0 : (_slot$character$resou = _slot$character.resource) === null || _slot$character$resou === void 0 ? void 0 : _slot$character$resou.url) || (object === null || object === void 0 ? void 0 : object.completeUrl) || '';
|
|
248
|
+
return (slot === null || slot === void 0 ? void 0 : (_slot$character = slot.character) === null || _slot$character === void 0 ? void 0 : (_slot$character$resou = _slot$character.resource) === null || _slot$character$resou === void 0 ? void 0 : _slot$character$resou.url) || (object === null || object === void 0 ? void 0 : object.completeUrl) || '';
|
|
254
249
|
}, [actors]); // Move to three core?
|
|
255
250
|
|
|
256
251
|
var loadEmotion = (0, _react.useCallback)(function (slot, element) {
|
|
@@ -527,12 +522,11 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
527
522
|
setCurrentMessage({
|
|
528
523
|
text: currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.text,
|
|
529
524
|
name: (currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.alias) || (currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.name) || "[ ".concat(translate('storylines.misc.voiceOver'), " ]"),
|
|
530
|
-
left: false,
|
|
531
525
|
inScene: false,
|
|
532
526
|
voiceOver: true,
|
|
533
527
|
thinkful: false,
|
|
534
528
|
top: false,
|
|
535
|
-
avatar:
|
|
529
|
+
avatar: getAvatarURL(talkingCharacter),
|
|
536
530
|
show: true
|
|
537
531
|
});
|
|
538
532
|
} else if (!lastSet.current) {
|
|
@@ -591,17 +585,12 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
591
585
|
setTimeout(function () {
|
|
592
586
|
var _talkingCharacter$cha5;
|
|
593
587
|
|
|
594
|
-
var _moveBubble = moveBubble(element, showArrowTop),
|
|
595
|
-
distance = _moveBubble.distance;
|
|
596
|
-
|
|
597
588
|
setCurrentMessage({
|
|
598
589
|
text: talkingCharacter.text,
|
|
599
590
|
name: talkingCharacter.alias || ((_talkingCharacter$cha5 = talkingCharacter.character) === null || _talkingCharacter$cha5 === void 0 ? void 0 : _talkingCharacter$cha5.name),
|
|
600
|
-
left: true,
|
|
601
|
-
top: showArrowTop || distance > 70,
|
|
602
591
|
inScene: true,
|
|
603
592
|
thinkful: talkingCharacter.emotion === 'thinkful',
|
|
604
|
-
avatar:
|
|
593
|
+
avatar: getAvatarURL(talkingCharacter),
|
|
605
594
|
show: true
|
|
606
595
|
});
|
|
607
596
|
}, zoomInActor ? 1200 : 0);
|
|
@@ -691,53 +680,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
691
680
|
return function () {
|
|
692
681
|
stop();
|
|
693
682
|
};
|
|
694
|
-
}, [currentMessage, nextLine, start, stop, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType, autoPlayCond, audio, voice, audioFailed]);
|
|
695
|
-
|
|
696
|
-
var checkBubbleBounds = (0, _react.useCallback)(function (group, bubble) {
|
|
697
|
-
groupRef.current = group === null || group === void 0 ? void 0 : group.current;
|
|
698
|
-
bubbleRef.current = bubble === null || bubble === void 0 ? void 0 : bubble.current;
|
|
699
|
-
|
|
700
|
-
if (currentLineData !== null && currentLineData !== void 0 && currentLineData.slots && currentMessage.show && bubble !== null && bubble !== void 0 && bubble.current) {
|
|
701
|
-
var bubbleRect = bubble.current.getBoundingClientRect();
|
|
702
|
-
var x = bubbleRect.x + bubbleRect.width;
|
|
703
|
-
var y = bubbleRect.y - bubbleRect.height;
|
|
704
|
-
|
|
705
|
-
if (!messagePosition.current.isLeft && zoomInActor || (x < 0 || x > window.innerWidth) && currentMessage.inScene) {
|
|
706
|
-
var child = messagePosition.current.child;
|
|
707
|
-
|
|
708
|
-
if (child) {
|
|
709
|
-
var target = new _three.Object3D();
|
|
710
|
-
child.getWorldPosition(target.position);
|
|
711
|
-
group.current.position.copy(target.position);
|
|
712
|
-
group.current.updateMatrixWorld();
|
|
713
|
-
var dividerWidth = bubbleRect.width > 250 ? 4 : 2.75;
|
|
714
|
-
var divider = isMobile ? 10 : dividerWidth;
|
|
715
|
-
var distanceX = bubbleRect.width + bubbleRect.width / divider;
|
|
716
|
-
bubble.current.parentNode.style.transform = "translate3d(-".concat(distanceX, "px, -").concat(bubbleRect.height, "px, 0px)");
|
|
717
|
-
bubbleRect = bubble.current.getBoundingClientRect();
|
|
718
|
-
var completeOutside = x > window.innerWidth + bubbleRect.width || y < -bubbleRect.height || y > window.innerHeight || x < -bubbleRect.width || bubbleRect.x < 10;
|
|
719
|
-
|
|
720
|
-
if (completeOutside) {
|
|
721
|
-
bubble.current.parentNode.style.transform = '';
|
|
722
|
-
messagePosition.current.child = null;
|
|
723
|
-
messagePosition.current.parent = null;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
setCurrentMessage(function (old) {
|
|
727
|
-
return _objectSpread(_objectSpread({}, old), {}, {
|
|
728
|
-
left: false,
|
|
729
|
-
top: false,
|
|
730
|
-
inScene: !completeOutside,
|
|
731
|
-
avatar: getAvatarURL(talkingCharacter),
|
|
732
|
-
show: true
|
|
733
|
-
});
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
} else {
|
|
737
|
-
bubble.current.parentNode.style.transform = '';
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}, [camera.quaternion, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.slots, currentMessage.inScene, getAvatarURL]);
|
|
683
|
+
}, [currentMessage, nextLine, start, stop, currentLineData === null || currentLineData === void 0 ? void 0 : currentLineData.audioType, autoPlayCond, audio, voice, audioFailed]);
|
|
741
684
|
(0, _react.useEffect)(function () {
|
|
742
685
|
if (animationRunning) {
|
|
743
686
|
var cam = camera;
|
|
@@ -750,9 +693,7 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
750
693
|
}
|
|
751
694
|
|
|
752
695
|
var mult = messagePosition.current.isLeft ? -1 : 1;
|
|
753
|
-
var headSpace = headSize * mult;
|
|
754
|
-
|
|
755
|
-
messagePosition.current.pos[0] -= headSpace;
|
|
696
|
+
var headSpace = headSize * mult;
|
|
756
697
|
animationTarget.current.translateX(-10 * mult + headSpace);
|
|
757
698
|
animationTarget.current.translateY(-2);
|
|
758
699
|
animationTarget.current.translateZ(30);
|
|
@@ -796,10 +737,6 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
796
737
|
object.material.visible = true;
|
|
797
738
|
});
|
|
798
739
|
}
|
|
799
|
-
|
|
800
|
-
if (bubbleRef.current && groupRef.current) {
|
|
801
|
-
checkBubbleBounds(groupRef, bubbleRef);
|
|
802
|
-
}
|
|
803
740
|
}
|
|
804
741
|
});
|
|
805
742
|
var container = document.querySelector('.screens--container');
|
|
@@ -843,9 +780,8 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
843
780
|
}
|
|
844
781
|
|
|
845
782
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, currentMessage.text ? /*#__PURE__*/_react.default.createElement(_BubbleWrapper.default, {
|
|
846
|
-
|
|
847
|
-
currentMessage: currentMessage
|
|
848
|
-
onLoad: checkBubbleBounds
|
|
783
|
+
translate: translate,
|
|
784
|
+
currentMessage: currentMessage
|
|
849
785
|
}) : null, /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.HtmlPro, {
|
|
850
786
|
style: {
|
|
851
787
|
width: '100vw',
|
|
@@ -27,7 +27,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
27
27
|
|
|
28
28
|
var SpeechBubbleComponent = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
29
29
|
var message = _ref.message,
|
|
30
|
-
|
|
30
|
+
translate = _ref.translate;
|
|
31
31
|
|
|
32
32
|
var _useState = (0, _react.useState)(false),
|
|
33
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -51,32 +51,33 @@ var SpeechBubbleComponent = /*#__PURE__*/_react.default.forwardRef(function (_re
|
|
|
51
51
|
|
|
52
52
|
(0, _react.useLayoutEffect)(function () {
|
|
53
53
|
if (!mounted) {
|
|
54
|
-
onLoad();
|
|
55
54
|
setMounted(true);
|
|
56
55
|
}
|
|
57
|
-
}, [
|
|
56
|
+
}, [mounted]);
|
|
58
57
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
59
58
|
dir: "auto",
|
|
60
59
|
ref: ref,
|
|
61
|
-
className: "\n speech-bubble\n ".concat(message.
|
|
60
|
+
className: "\n speech-bubble\n ".concat(!message.inScene || message.voiceOver ? 'speech-bubble--outOfScene' : '', "\n ").concat(message.thinkful ? 'speech-bubble--italic' : '', "\n ")
|
|
62
61
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
-
className: "speech-
|
|
64
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
|
-
className: "speech-bubble__header"
|
|
62
|
+
className: "speech-bubble__header ".concat(message.thinkful ? 'speech-bubble__header--thinking' : '')
|
|
66
63
|
}, message.thinkful ? /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
+
className: "thinking-icon-wrap"
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
67
66
|
className: "icon-bubble-thinkful-black"
|
|
68
|
-
}) : null, message.
|
|
69
|
-
className: "icon-narrator"
|
|
70
|
-
}) : null, !message.inScene && message.avatar ? /*#__PURE__*/_react.default.createElement("div", {
|
|
67
|
+
})) : null, message.avatar ? /*#__PURE__*/_react.default.createElement("div", {
|
|
71
68
|
className: "speech-bubble__avatar"
|
|
72
69
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
73
70
|
src: getAvatar(),
|
|
74
71
|
alt: message.name
|
|
72
|
+
})) : null, message.voiceOver ? /*#__PURE__*/_react.default.createElement("div", {
|
|
73
|
+
className: "speech-bubble__avatar"
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
+
className: "icon-narrator"
|
|
75
76
|
})) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
76
|
-
className: "speech-
|
|
77
|
-
}, message.name)), message.text ? /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
+
className: "speech-bubble__name"
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, message.name), message.thinkful ? /*#__PURE__*/_react.default.createElement("span", null, "[ ", translate('emotion.thinking'), " ]") : null)), message.text ? /*#__PURE__*/_react.default.createElement("div", {
|
|
78
79
|
className: "speech-bubble__text"
|
|
79
|
-
}, message.text) : null)
|
|
80
|
+
}, message.text) : null);
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
var _default = SpeechBubbleComponent;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
11
|
-
|
|
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); }
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
9
|
|
|
14
|
-
function
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
11
|
|
|
16
12
|
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; }
|
|
17
13
|
|
|
@@ -19,18 +15,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
19
15
|
|
|
20
16
|
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
17
|
|
|
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 == null ? null : 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
18
|
var OPTIONS = ['yes', 'no'];
|
|
35
19
|
var LETTERS = ['A', 'B'];
|
|
36
20
|
|
|
@@ -38,18 +22,12 @@ var ApplicableBox = function ApplicableBox(_ref) {
|
|
|
38
22
|
var setSurveyData = _ref.setSurveyData,
|
|
39
23
|
survey = _ref.survey,
|
|
40
24
|
id = _ref.id,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _useState = (0, _react.useState)(),
|
|
45
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
-
optionSelected = _useState2[0],
|
|
47
|
-
selectOption = _useState2[1];
|
|
25
|
+
translate = _ref.translate,
|
|
26
|
+
changePage = _ref.changePage;
|
|
48
27
|
|
|
49
28
|
var select = function select(option) {
|
|
50
|
-
enable(true);
|
|
51
|
-
selectOption(option);
|
|
52
29
|
setSurveyData(_objectSpread(_objectSpread({}, survey), {}, _defineProperty({}, id, option)));
|
|
30
|
+
changePage();
|
|
53
31
|
};
|
|
54
32
|
|
|
55
33
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -60,7 +38,7 @@ var ApplicableBox = function ApplicableBox(_ref) {
|
|
|
60
38
|
onClick: function onClick() {
|
|
61
39
|
return select(option);
|
|
62
40
|
},
|
|
63
|
-
className: "survey--response__item ".concat(
|
|
41
|
+
className: "survey--response__item ".concat(survey[id] === option ? 'selected' : '')
|
|
64
42
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
43
|
className: "survey--response__index"
|
|
66
44
|
}, LETTERS[i]), /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.default = void 0;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
11
|
-
|
|
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); }
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
9
|
|
|
14
|
-
function
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
11
|
|
|
16
12
|
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; }
|
|
17
13
|
|
|
@@ -19,36 +15,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
19
15
|
|
|
20
16
|
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
17
|
|
|
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 == null ? null : 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
18
|
var OPINION_OPTIONS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
35
19
|
|
|
36
20
|
var OpinionBox = function OpinionBox(_ref) {
|
|
37
21
|
var setSurveyData = _ref.setSurveyData,
|
|
38
22
|
survey = _ref.survey,
|
|
39
|
-
enable = _ref.enable,
|
|
40
23
|
id = _ref.id,
|
|
41
|
-
translate = _ref.translate
|
|
42
|
-
|
|
43
|
-
var _useState = (0, _react.useState)(),
|
|
44
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
-
optionSelected = _useState2[0],
|
|
46
|
-
selectOption = _useState2[1];
|
|
24
|
+
translate = _ref.translate,
|
|
25
|
+
changePage = _ref.changePage;
|
|
47
26
|
|
|
48
27
|
var select = function select(option) {
|
|
49
|
-
enable(true);
|
|
50
|
-
selectOption(option);
|
|
51
28
|
setSurveyData(_objectSpread(_objectSpread({}, survey), {}, _defineProperty({}, id, option)));
|
|
29
|
+
changePage();
|
|
52
30
|
};
|
|
53
31
|
|
|
54
32
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -61,7 +39,7 @@ var OpinionBox = function OpinionBox(_ref) {
|
|
|
61
39
|
onClick: function onClick() {
|
|
62
40
|
return select(option);
|
|
63
41
|
},
|
|
64
|
-
className: "survey--points__item ".concat(
|
|
42
|
+
className: "survey--points__item ".concat(survey[id] === option ? 'selected' : '')
|
|
65
43
|
}, option);
|
|
66
44
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
67
45
|
className: "survey--points__labels"
|
|
@@ -43,20 +43,16 @@ var INIT_SURVEY = {
|
|
|
43
43
|
};
|
|
44
44
|
var PAGES = [{
|
|
45
45
|
component: _ApplicableBox.default,
|
|
46
|
-
id: 'applicable'
|
|
47
|
-
disableContinue: true
|
|
46
|
+
id: 'applicable'
|
|
48
47
|
}, {
|
|
49
48
|
component: _OpinionBox.default,
|
|
50
|
-
id: 'opinion'
|
|
51
|
-
disableContinue: true
|
|
49
|
+
id: 'opinion'
|
|
52
50
|
}, {
|
|
53
51
|
component: _TextBox.default,
|
|
54
|
-
id: 'comments'
|
|
55
|
-
disableContinue: true
|
|
52
|
+
id: 'comments'
|
|
56
53
|
}, {
|
|
57
54
|
component: _TextBox.default,
|
|
58
|
-
id: 'suggestions'
|
|
59
|
-
disableContinue: true
|
|
55
|
+
id: 'suggestions'
|
|
60
56
|
}];
|
|
61
57
|
|
|
62
58
|
var SurveyComponent = function SurveyComponent(_ref) {
|
|
@@ -73,15 +69,10 @@ var SurveyComponent = function SurveyComponent(_ref) {
|
|
|
73
69
|
page = _useState4[0],
|
|
74
70
|
setPage = _useState4[1];
|
|
75
71
|
|
|
76
|
-
var _useState5 = (0, _react.useState)(
|
|
72
|
+
var _useState5 = (0, _react.useState)(false),
|
|
77
73
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var _useState7 = (0, _react.useState)(false),
|
|
82
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
83
|
-
finished = _useState8[0],
|
|
84
|
-
finish = _useState8[1];
|
|
74
|
+
finished = _useState6[0],
|
|
75
|
+
finish = _useState6[1];
|
|
85
76
|
|
|
86
77
|
var _soundActions = _slicedToArray(soundActions, 1),
|
|
87
78
|
play = _soundActions[0];
|
|
@@ -94,15 +85,15 @@ var SurveyComponent = function SurveyComponent(_ref) {
|
|
|
94
85
|
});
|
|
95
86
|
};
|
|
96
87
|
|
|
97
|
-
var
|
|
88
|
+
var _changePage = function changePage() {
|
|
89
|
+
var backward = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
98
90
|
play('click-ui');
|
|
99
91
|
|
|
100
|
-
if (page + 1 >= PAGES.length) {
|
|
92
|
+
if (!backward && page + 1 >= PAGES.length) {
|
|
101
93
|
finish(true);
|
|
102
94
|
} else {
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
setPage(page + 1);
|
|
95
|
+
var destinationPage = backward ? page - 1 : page + 1;
|
|
96
|
+
setPage(destinationPage);
|
|
106
97
|
}
|
|
107
98
|
};
|
|
108
99
|
|
|
@@ -127,26 +118,18 @@ var SurveyComponent = function SurveyComponent(_ref) {
|
|
|
127
118
|
ordinal: page + 1
|
|
128
119
|
})), /*#__PURE__*/_react.default.createElement(View, {
|
|
129
120
|
setSurveyData: setSurveyData,
|
|
130
|
-
enable: function enable(boolean) {
|
|
131
|
-
return disable(!boolean);
|
|
132
|
-
},
|
|
133
121
|
id: PAGES[page].id,
|
|
134
122
|
survey: survey,
|
|
135
|
-
translate: translate
|
|
123
|
+
translate: translate,
|
|
124
|
+
changePage: function changePage() {
|
|
125
|
+
return _changePage(false);
|
|
126
|
+
}
|
|
136
127
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
137
128
|
className: "test--buttons next"
|
|
138
|
-
},
|
|
129
|
+
}, finished ? /*#__PURE__*/_react.default.createElement("button", {
|
|
139
130
|
id: "survey-button",
|
|
140
131
|
type: "button",
|
|
141
|
-
disabled:
|
|
142
|
-
onClick: changePage,
|
|
143
|
-
className: "gat--btn__navigation ".concat(disabled ? 'disabled' : '')
|
|
144
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
145
|
-
className: (0, _LangIsRtl.default)() ? 'icon-back' : 'icon-next'
|
|
146
|
-
})) : /*#__PURE__*/_react.default.createElement("button", {
|
|
147
|
-
id: "survey-button",
|
|
148
|
-
type: "button",
|
|
149
|
-
disabled: disabled,
|
|
132
|
+
disabled: !survey[PAGES[page].id],
|
|
150
133
|
onClick: function onClick() {
|
|
151
134
|
play('click-ui');
|
|
152
135
|
emitEvent({
|
|
@@ -154,8 +137,28 @@ var SurveyComponent = function SurveyComponent(_ref) {
|
|
|
154
137
|
payload: survey
|
|
155
138
|
});
|
|
156
139
|
},
|
|
157
|
-
className: "gat--btn gat--btn__primary ".concat(
|
|
158
|
-
}, translate('survey.finish'))
|
|
140
|
+
className: "gat--btn gat--btn__primary ".concat(!survey[PAGES[page].id] ? 'disabled' : '', " not-transition")
|
|
141
|
+
}, translate('survey.finish')) : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("button", {
|
|
142
|
+
id: "survey-button-back",
|
|
143
|
+
type: "button",
|
|
144
|
+
disabled: page === 0,
|
|
145
|
+
onClick: function onClick() {
|
|
146
|
+
return _changePage(true);
|
|
147
|
+
},
|
|
148
|
+
className: "gat--btn__navigation ".concat(page === 0 ? 'disabled' : '')
|
|
149
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
150
|
+
className: (0, _LangIsRtl.default)() ? 'icon-next' : 'icon-back'
|
|
151
|
+
})), /*#__PURE__*/_react.default.createElement("button", {
|
|
152
|
+
id: "survey-button",
|
|
153
|
+
type: "button",
|
|
154
|
+
disabled: !survey[PAGES[page].id],
|
|
155
|
+
onClick: function onClick() {
|
|
156
|
+
return _changePage(false);
|
|
157
|
+
},
|
|
158
|
+
className: "gat--btn__navigation ".concat(!survey[PAGES[page].id] ? 'disabled' : '')
|
|
159
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
160
|
+
className: (0, _LangIsRtl.default)() ? 'icon-back' : 'icon-next'
|
|
161
|
+
})))))));
|
|
159
162
|
};
|
|
160
163
|
|
|
161
164
|
var _default = SurveyComponent;
|
|
@@ -18,11 +18,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
18
18
|
var TextBox = function TextBox(_ref) {
|
|
19
19
|
var setSurveyData = _ref.setSurveyData,
|
|
20
20
|
survey = _ref.survey,
|
|
21
|
-
enable = _ref.enable,
|
|
22
21
|
id = _ref.id;
|
|
23
22
|
|
|
24
23
|
var writeText = function writeText(text) {
|
|
25
|
-
enable(Boolean(text));
|
|
26
24
|
setSurveyData(_objectSpread(_objectSpread({}, survey), {}, _defineProperty({}, id, text)));
|
|
27
25
|
};
|
|
28
26
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gamelearn/arcade-components",
|
|
3
3
|
"author": "Gamelearn",
|
|
4
4
|
"license": "unlicense",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.4.1",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.18.6",
|
|
17
|
-
"@gamelearn/arcade-styles": "2.
|
|
17
|
+
"@gamelearn/arcade-styles": "2.5.1",
|
|
18
18
|
"@gamelearn/arcade-three-core": "1.17.1",
|
|
19
19
|
"@react-three/drei": "9.4.3",
|
|
20
20
|
"@react-three/fiber": "8.0.17",
|