@micromag/screen-quiz 0.2.412 → 0.3.3
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/assets/css/styles.css +5 -1
- package/es/index.js +1307 -291
- package/lib/index.js +1292 -276
- package/package.json +13 -12
package/es/index.js
CHANGED
|
@@ -1,54 +1,476 @@
|
|
|
1
1
|
import { FormattedMessage, defineMessage } from 'react-intl';
|
|
2
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
3
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { useScreenSize, useViewer,
|
|
11
|
-
import {
|
|
12
|
-
import { isTextFilled, getStyleFromButton, getStyleFromColor } from '@micromag/core/utils';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import PropTypes$1 from 'prop-types';
|
|
6
|
+
import React, { useMemo, useState, useEffect, useCallback, useRef } from 'react';
|
|
7
|
+
import { PropTypes } from '@micromag/core';
|
|
8
|
+
import { useScreenRenderContext, useScreenSize, useViewer, useScreenState } from '@micromag/core/contexts';
|
|
9
|
+
import { useResizeObserver, useTrackScreenEvent } from '@micromag/core/hooks';
|
|
13
10
|
import { useQuizCreate } from '@micromag/data';
|
|
14
11
|
import Background from '@micromag/element-background';
|
|
15
|
-
import Button from '@micromag/element-button';
|
|
16
12
|
import CallToAction from '@micromag/element-call-to-action';
|
|
17
13
|
import Container from '@micromag/element-container';
|
|
14
|
+
import { ScreenElement, Transitions } from '@micromag/core/components';
|
|
15
|
+
import { isTextFilled, getStyleFromBox, getStyleFromColor } from '@micromag/core/utils';
|
|
18
16
|
import Heading from '@micromag/element-heading';
|
|
19
17
|
import Layout, { Spacer } from '@micromag/element-layout';
|
|
20
18
|
import Text from '@micromag/element-text';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
19
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
20
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
21
|
+
import { faCheck, faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
22
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
23
|
+
import Button from '@micromag/element-button';
|
|
24
|
+
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
24
25
|
|
|
25
|
-
var styles = {"
|
|
26
|
+
var styles$4 = {"emptyAnswer":"micromag-screen-quiz-answers-emptyAnswer","button":"micromag-screen-quiz-answers-button","container":"micromag-screen-quiz-answers-container","items":"micromag-screen-quiz-answers-items","item":"micromag-screen-quiz-answers-item","rightAnswer":"micromag-screen-quiz-answers-rightAnswer","answered":"micromag-screen-quiz-answers-answered","userAnswer":"micromag-screen-quiz-answers-userAnswer","willCollapse":"micromag-screen-quiz-answers-willCollapse","didCollapsed":"micromag-screen-quiz-answers-didCollapsed","withoutGoodAnswer":"micromag-screen-quiz-answers-withoutGoodAnswer","isPlaceholder":"micromag-screen-quiz-answers-isPlaceholder","withGoodAnswer":"micromag-screen-quiz-answers-withGoodAnswer","resultIcon":"micromag-screen-quiz-answers-resultIcon","itemContent":"micromag-screen-quiz-answers-itemContent"};
|
|
26
27
|
|
|
27
|
-
var propTypes = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
var propTypes$5 = {
|
|
29
|
+
items: PropTypes.quizAnswers.isRequired,
|
|
30
|
+
answeredIndex: PropTypes$1.number,
|
|
31
|
+
answersCollapseDelay: PropTypes$1.number,
|
|
32
|
+
buttonsStyle: PropTypes.boxStyle,
|
|
33
|
+
goodAnswerColor: PropTypes.color,
|
|
34
|
+
badAnswerColor: PropTypes.color,
|
|
35
|
+
withoutGoodAnswer: PropTypes$1.bool,
|
|
36
|
+
focusable: PropTypes$1.bool,
|
|
37
|
+
collapsed: PropTypes$1.bool,
|
|
38
|
+
transitions: PropTypes.transitions,
|
|
39
|
+
transitionPlaying: PropTypes$1.bool,
|
|
40
|
+
transitionStagger: PropTypes$1.number,
|
|
41
|
+
transitionDisabled: PropTypes$1.bool,
|
|
42
|
+
onClick: PropTypes$1.func,
|
|
43
|
+
onCollapse: PropTypes$1.func,
|
|
44
|
+
onCollapsed: PropTypes$1.func,
|
|
45
|
+
onTransitionEnd: PropTypes$1.func,
|
|
46
|
+
className: PropTypes$1.string
|
|
47
|
+
};
|
|
48
|
+
var defaultProps$5 = {
|
|
49
|
+
answeredIndex: null,
|
|
50
|
+
answersCollapseDelay: 2000,
|
|
51
|
+
buttonsStyle: null,
|
|
52
|
+
goodAnswerColor: null,
|
|
53
|
+
badAnswerColor: null,
|
|
54
|
+
withoutGoodAnswer: false,
|
|
55
|
+
focusable: false,
|
|
56
|
+
collapsed: false,
|
|
57
|
+
transitions: null,
|
|
58
|
+
transitionPlaying: false,
|
|
59
|
+
transitionStagger: 100,
|
|
60
|
+
transitionDisabled: false,
|
|
61
|
+
onClick: null,
|
|
62
|
+
onCollapse: null,
|
|
63
|
+
onCollapsed: null,
|
|
64
|
+
onTransitionEnd: null,
|
|
65
|
+
className: null
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var Answers = function Answers(_ref) {
|
|
69
|
+
var _ref5;
|
|
70
|
+
|
|
71
|
+
var items = _ref.items,
|
|
72
|
+
answeredIndex = _ref.answeredIndex,
|
|
73
|
+
answersCollapseDelay = _ref.answersCollapseDelay,
|
|
74
|
+
buttonsStyle = _ref.buttonsStyle,
|
|
75
|
+
goodAnswerColor = _ref.goodAnswerColor,
|
|
76
|
+
badAnswerColor = _ref.badAnswerColor,
|
|
77
|
+
withoutGoodAnswer = _ref.withoutGoodAnswer,
|
|
78
|
+
focusable = _ref.focusable,
|
|
79
|
+
initialCollapsed = _ref.collapsed,
|
|
80
|
+
transitions = _ref.transitions,
|
|
81
|
+
transitionPlaying = _ref.transitionPlaying,
|
|
82
|
+
transitionStagger = _ref.transitionStagger,
|
|
83
|
+
transitionDisabled = _ref.transitionDisabled,
|
|
84
|
+
_onClick = _ref.onClick,
|
|
85
|
+
onCollapse = _ref.onCollapse,
|
|
86
|
+
onCollapsed = _ref.onCollapsed,
|
|
87
|
+
onTransitionEnd = _ref.onTransitionEnd,
|
|
88
|
+
className = _ref.className;
|
|
89
|
+
|
|
90
|
+
var _useScreenRenderConte = useScreenRenderContext(),
|
|
91
|
+
isView = _useScreenRenderConte.isView,
|
|
92
|
+
isPreview = _useScreenRenderConte.isPreview,
|
|
93
|
+
isPlaceholder = _useScreenRenderConte.isPlaceholder,
|
|
94
|
+
isEdit = _useScreenRenderConte.isEdit;
|
|
95
|
+
|
|
96
|
+
var answered = answeredIndex !== null;
|
|
97
|
+
|
|
98
|
+
var _ref2 = answeredIndex !== null ? items[answeredIndex] : {},
|
|
99
|
+
_ref2$good = _ref2.good,
|
|
100
|
+
hasAnsweredRight = _ref2$good === void 0 ? false : _ref2$good; // we get .answer's current and future height to animate its height
|
|
101
|
+
// we also get the right answer's Y to animate its position
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
var _useResizeObserver = useResizeObserver(),
|
|
105
|
+
answerRef = _useResizeObserver.ref,
|
|
106
|
+
answerContentRect = _useResizeObserver.entry.contentRect;
|
|
107
|
+
|
|
108
|
+
var _ref3 = answerContentRect || {},
|
|
109
|
+
answerHeight = _ref3.height;
|
|
110
|
+
|
|
111
|
+
var _useResizeObserver2 = useResizeObserver(),
|
|
112
|
+
rightAnswerRef = _useResizeObserver2.ref,
|
|
113
|
+
rightAnswerContentRect = _useResizeObserver2.entry.contentRect;
|
|
114
|
+
|
|
115
|
+
var _ref4 = rightAnswerContentRect || {},
|
|
116
|
+
rightAnswerHeight = _ref4.height;
|
|
117
|
+
|
|
118
|
+
var rightAnswerTop = useMemo(function () {
|
|
119
|
+
return rightAnswerRef.current !== null ? rightAnswerRef.current.offsetTop : 0;
|
|
120
|
+
}, [rightAnswerHeight]);
|
|
121
|
+
var shouldCollapse = !withoutGoodAnswer;
|
|
122
|
+
|
|
123
|
+
var _useState = useState(answeredIndex !== null),
|
|
124
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
125
|
+
answersCollapsed = _useState2[0],
|
|
126
|
+
setAnswersCollapsed = _useState2[1];
|
|
127
|
+
|
|
128
|
+
var _useState3 = useState(initialCollapsed || answeredIndex !== null),
|
|
129
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
130
|
+
answersDidCollapsed = _useState4[0],
|
|
131
|
+
setAnswersDidCollapsed = _useState4[1];
|
|
132
|
+
|
|
133
|
+
useEffect(function () {
|
|
134
|
+
var timeout = null;
|
|
135
|
+
|
|
136
|
+
if (answeredIndex !== null && shouldCollapse) {
|
|
137
|
+
timeout = setTimeout(function () {
|
|
138
|
+
setAnswersCollapsed(true);
|
|
139
|
+
|
|
140
|
+
if (onCollapse !== null) {
|
|
141
|
+
onCollapse();
|
|
142
|
+
}
|
|
143
|
+
}, hasAnsweredRight ? 500 : answersCollapseDelay);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return function () {
|
|
147
|
+
if (timeout !== null) {
|
|
148
|
+
clearTimeout(timeout);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}, [answeredIndex, withoutGoodAnswer, setAnswersCollapsed, onCollapse, answersCollapseDelay, hasAnsweredRight]);
|
|
152
|
+
var onAnswerTransitionEnd = useCallback(function () {
|
|
153
|
+
if (onTransitionEnd !== null) {
|
|
154
|
+
onTransitionEnd();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (shouldCollapse && answersCollapsed && !answersDidCollapsed) {
|
|
158
|
+
setAnswersDidCollapsed(true);
|
|
159
|
+
|
|
160
|
+
if (onCollapsed !== null) {
|
|
161
|
+
onCollapsed();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, [shouldCollapse, answersCollapsed, answersDidCollapsed, setAnswersCollapsed, onCollapsed, onTransitionEnd]);
|
|
165
|
+
console.log(items);
|
|
166
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: classNames([styles$4.container, (_ref5 = {}, _defineProperty(_ref5, styles$4.answered, answered), _defineProperty(_ref5, styles$4.withoutGoodAnswer, withoutGoodAnswer), _defineProperty(_ref5, styles$4.withGoodAnswer, !withoutGoodAnswer), _defineProperty(_ref5, styles$4.willCollapse, shouldCollapse && answersCollapsed), _defineProperty(_ref5, styles$4.didCollapsed, shouldCollapse && answersDidCollapsed), _defineProperty(_ref5, styles$4.isPlaceholder, isPlaceholder), _defineProperty(_ref5, className, className !== null), _ref5)]),
|
|
168
|
+
ref: answerRef,
|
|
169
|
+
style: answered && !answersDidCollapsed && (isView || isEdit) && shouldCollapse ? {
|
|
170
|
+
height: answersCollapsed ? rightAnswerHeight : answerHeight
|
|
171
|
+
} : null
|
|
172
|
+
}, items !== null || isPlaceholder ? /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: styles$4.items
|
|
174
|
+
}, (isPlaceholder || isEdit && items.length === 0 ? _toConsumableArray(new Array(2)) : items).map(function (answer, answerI) {
|
|
175
|
+
var _ref7;
|
|
176
|
+
|
|
177
|
+
var userAnswer = answerI === answeredIndex;
|
|
178
|
+
|
|
179
|
+
var _ref6 = answer || {},
|
|
180
|
+
_ref6$good = _ref6.good,
|
|
181
|
+
rightAnswer = _ref6$good === void 0 ? false : _ref6$good,
|
|
182
|
+
_ref6$label = _ref6.label,
|
|
183
|
+
label = _ref6$label === void 0 ? null : _ref6$label,
|
|
184
|
+
_ref6$buttonStyle = _ref6.buttonStyle,
|
|
185
|
+
answerButtonStyle = _ref6$buttonStyle === void 0 ? null : _ref6$buttonStyle;
|
|
186
|
+
|
|
187
|
+
var hasAnswer = isTextFilled(label);
|
|
188
|
+
|
|
189
|
+
if (answersDidCollapsed && !rightAnswer) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
194
|
+
key: "answer-".concat(answerI),
|
|
195
|
+
ref: rightAnswer ? rightAnswerRef : null,
|
|
196
|
+
className: classNames([styles$4.item, (_ref7 = {}, _defineProperty(_ref7, styles$4.rightAnswer, rightAnswer && !withoutGoodAnswer), _defineProperty(_ref7, styles$4.userAnswer, userAnswer), _ref7)]),
|
|
197
|
+
style: answersCollapsed && rightAnswer && !answersDidCollapsed && shouldCollapse ? {
|
|
198
|
+
transform: "translateY(".concat(-rightAnswerTop, "px)")
|
|
199
|
+
} : null,
|
|
200
|
+
onTransitionEnd: rightAnswer || withoutGoodAnswer && userAnswer ? onAnswerTransitionEnd : null
|
|
201
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
202
|
+
className: styles$4.itemContent
|
|
203
|
+
}, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
204
|
+
placeholder: "quizAnswer",
|
|
205
|
+
placeholderProps: {
|
|
206
|
+
good: answerI === 0
|
|
207
|
+
},
|
|
208
|
+
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
209
|
+
id: "+Ok+7S",
|
|
210
|
+
defaultMessage: [{
|
|
211
|
+
"type": 0,
|
|
212
|
+
"value": "Answer"
|
|
213
|
+
}]
|
|
214
|
+
}),
|
|
215
|
+
emptyClassName: styles$4.emptyAnswer,
|
|
216
|
+
isEmpty: !hasAnswer
|
|
217
|
+
}, hasAnswer ? /*#__PURE__*/React.createElement(Transitions, {
|
|
218
|
+
transitions: transitions,
|
|
219
|
+
playing: transitionPlaying,
|
|
220
|
+
delay: (answerI + 1) * transitionStagger,
|
|
221
|
+
disabled: transitionDisabled
|
|
222
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
223
|
+
className: styles$4.button,
|
|
224
|
+
onClick: function onClick() {
|
|
225
|
+
return _onClick(answer, answerI);
|
|
226
|
+
},
|
|
227
|
+
disabled: isPreview || answered,
|
|
228
|
+
focusable: focusable,
|
|
229
|
+
buttonStyle: _objectSpread(_objectSpread({}, getStyleFromBox(buttonsStyle)), getStyleFromBox(answerButtonStyle))
|
|
230
|
+
}, !withoutGoodAnswer && rightAnswer ? /*#__PURE__*/React.createElement("span", {
|
|
231
|
+
className: styles$4.resultIcon,
|
|
232
|
+
style: getStyleFromColor(goodAnswerColor, 'backgroundColor')
|
|
233
|
+
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
234
|
+
className: styles$4.faIcon,
|
|
235
|
+
icon: faCheck
|
|
236
|
+
})) : null, !withoutGoodAnswer && answered && !hasAnsweredRight && userAnswer ? /*#__PURE__*/React.createElement("span", {
|
|
237
|
+
className: styles$4.resultIcon,
|
|
238
|
+
style: getStyleFromColor(badAnswerColor, 'backgroundColor')
|
|
239
|
+
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
240
|
+
className: styles$4.faIcon,
|
|
241
|
+
icon: faTimes
|
|
242
|
+
})) : null, /*#__PURE__*/React.createElement(Text, Object.assign({}, label, {
|
|
243
|
+
className: styles$4.optionLabel
|
|
244
|
+
})))) : null)));
|
|
245
|
+
})) : null);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
Answers.propTypes = propTypes$5;
|
|
249
|
+
Answers.defaultProps = defaultProps$5;
|
|
250
|
+
|
|
251
|
+
var styles$3 = {"container":"micromag-screen-quiz-question-container","emptyQuestion":"micromag-screen-quiz-question-emptyQuestion","emptyResult":"micromag-screen-quiz-question-emptyResult","question":"micromag-screen-quiz-question-question","index":"micromag-screen-quiz-question-index","result":"micromag-screen-quiz-question-result","resultContent":"micromag-screen-quiz-question-resultContent","resultVisible":"micromag-screen-quiz-question-resultVisible","isPlaceholder":"micromag-screen-quiz-question-isPlaceholder"};
|
|
252
|
+
|
|
253
|
+
var propTypes$4 = {
|
|
254
|
+
question: PropTypes.textElement,
|
|
255
|
+
answers: PropTypes.quizAnswers,
|
|
256
|
+
result: PropTypes$1.shape({
|
|
257
|
+
image: PropTypes.imageElement,
|
|
258
|
+
text: PropTypes.textElement
|
|
35
259
|
}),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
260
|
+
index: PropTypes$1.number,
|
|
261
|
+
totalCount: PropTypes$1.number,
|
|
262
|
+
answeredIndex: PropTypes$1.number,
|
|
263
|
+
buttonsStyle: PropTypes.boxStyle,
|
|
264
|
+
goodAnswerColor: PropTypes.color,
|
|
265
|
+
badAnswerColor: PropTypes.color,
|
|
266
|
+
focusable: PropTypes$1.bool,
|
|
267
|
+
layout: PropTypes$1.string,
|
|
268
|
+
callToActionHeight: PropTypes$1.number,
|
|
269
|
+
showInstantAnswer: PropTypes$1.bool,
|
|
270
|
+
withResult: PropTypes$1.bool,
|
|
271
|
+
withoutGoodAnswer: PropTypes$1.bool,
|
|
272
|
+
withoutIndex: PropTypes$1.bool,
|
|
273
|
+
transitions: PropTypes.transitions,
|
|
274
|
+
transitionPlaying: PropTypes$1.bool,
|
|
275
|
+
transitionStagger: PropTypes$1.number,
|
|
276
|
+
transitionDisabled: PropTypes$1.bool,
|
|
277
|
+
onAnswerClick: PropTypes$1.func,
|
|
278
|
+
onAnswerTransitionEnd: PropTypes$1.func,
|
|
279
|
+
className: PropTypes$1.string,
|
|
280
|
+
style: PropTypes$1.objectOf(PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]))
|
|
50
281
|
};
|
|
51
|
-
var defaultProps = {
|
|
282
|
+
var defaultProps$4 = {
|
|
283
|
+
question: null,
|
|
284
|
+
answers: null,
|
|
285
|
+
result: null,
|
|
286
|
+
index: null,
|
|
287
|
+
totalCount: null,
|
|
288
|
+
answeredIndex: null,
|
|
289
|
+
buttonsStyle: null,
|
|
290
|
+
goodAnswerColor: null,
|
|
291
|
+
badAnswerColor: null,
|
|
292
|
+
focusable: false,
|
|
293
|
+
layout: null,
|
|
294
|
+
callToActionHeight: null,
|
|
295
|
+
showInstantAnswer: false,
|
|
296
|
+
withResult: false,
|
|
297
|
+
withoutGoodAnswer: false,
|
|
298
|
+
withoutIndex: false,
|
|
299
|
+
transitions: null,
|
|
300
|
+
transitionPlaying: false,
|
|
301
|
+
transitionStagger: 100,
|
|
302
|
+
transitionDisabled: false,
|
|
303
|
+
onAnswerClick: null,
|
|
304
|
+
onAnswerTransitionEnd: null,
|
|
305
|
+
className: null,
|
|
306
|
+
style: null
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
var Question = function Question(_ref) {
|
|
310
|
+
var _ref3;
|
|
311
|
+
|
|
312
|
+
var question = _ref.question,
|
|
313
|
+
answers = _ref.answers,
|
|
314
|
+
result = _ref.result,
|
|
315
|
+
index = _ref.index,
|
|
316
|
+
totalCount = _ref.totalCount,
|
|
317
|
+
answeredIndex = _ref.answeredIndex,
|
|
318
|
+
buttonsStyle = _ref.buttonsStyle,
|
|
319
|
+
goodAnswerColor = _ref.goodAnswerColor,
|
|
320
|
+
badAnswerColor = _ref.badAnswerColor,
|
|
321
|
+
focusable = _ref.focusable,
|
|
322
|
+
showInstantAnswer = _ref.showInstantAnswer,
|
|
323
|
+
withResult = _ref.withResult,
|
|
324
|
+
withoutGoodAnswer = _ref.withoutGoodAnswer,
|
|
325
|
+
withoutIndex = _ref.withoutIndex,
|
|
326
|
+
layout = _ref.layout,
|
|
327
|
+
callToActionHeight = _ref.callToActionHeight,
|
|
328
|
+
transitions = _ref.transitions,
|
|
329
|
+
transitionPlaying = _ref.transitionPlaying,
|
|
330
|
+
transitionStagger = _ref.transitionStagger,
|
|
331
|
+
transitionDisabled = _ref.transitionDisabled,
|
|
332
|
+
onAnswerClick = _ref.onAnswerClick,
|
|
333
|
+
onAnswerTransitionEnd = _ref.onAnswerTransitionEnd,
|
|
334
|
+
className = _ref.className,
|
|
335
|
+
style = _ref.style;
|
|
336
|
+
|
|
337
|
+
var _useScreenRenderConte = useScreenRenderContext(),
|
|
338
|
+
isPlaceholder = _useScreenRenderConte.isPlaceholder;
|
|
339
|
+
|
|
340
|
+
var isSplitted = layout === 'split';
|
|
341
|
+
var verticalAlign = isSplitted ? null : layout;
|
|
342
|
+
var hasQuestion = isTextFilled(question);
|
|
343
|
+
var hasResult = isTextFilled(result);
|
|
344
|
+
|
|
345
|
+
var _useState = useState(showInstantAnswer),
|
|
346
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
347
|
+
resultVisible = _useState2[0],
|
|
348
|
+
setResultVisible = _useState2[1];
|
|
349
|
+
|
|
350
|
+
var answered = answeredIndex !== null;
|
|
351
|
+
|
|
352
|
+
var _useResizeObserver = useResizeObserver(),
|
|
353
|
+
resultRef = _useResizeObserver.ref,
|
|
354
|
+
resultContentRect = _useResizeObserver.entry.contentRect;
|
|
355
|
+
|
|
356
|
+
var _ref2 = resultContentRect || {};
|
|
357
|
+
_ref2.height; // eslint-disable-line
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
var onAnswersCollapse = useCallback(function () {
|
|
361
|
+
setResultVisible(true);
|
|
362
|
+
}, [setResultVisible]);
|
|
363
|
+
var hasIndex = index !== null && totalCount !== null;
|
|
364
|
+
return /*#__PURE__*/React.createElement(Layout, {
|
|
365
|
+
className: classNames([styles$3.container, (_ref3 = {}, _defineProperty(_ref3, styles$3.isPlaceholder, isPlaceholder), _defineProperty(_ref3, styles$3.resultVisible, resultVisible), _defineProperty(_ref3, className, className !== null), _ref3)]),
|
|
366
|
+
fullscreen: true,
|
|
367
|
+
verticalAlign: verticalAlign,
|
|
368
|
+
style: style
|
|
369
|
+
}, [!withoutIndex && hasIndex ? /*#__PURE__*/React.createElement(ScreenElement, {
|
|
370
|
+
key: "stats",
|
|
371
|
+
placeholder: /*#__PURE__*/React.createElement("div", {
|
|
372
|
+
className: styles$3.index
|
|
373
|
+
}, "1 / 10")
|
|
374
|
+
}, /*#__PURE__*/React.createElement(Transitions, {
|
|
375
|
+
transitions: transitions,
|
|
376
|
+
playing: transitionPlaying,
|
|
377
|
+
disabled: transitionDisabled
|
|
378
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
379
|
+
className: styles$3.index
|
|
380
|
+
}, index + 1, " / ", totalCount))) : null, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
381
|
+
key: "question",
|
|
382
|
+
placeholder: "title",
|
|
383
|
+
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
384
|
+
id: "FOmgqv",
|
|
385
|
+
defaultMessage: [{
|
|
386
|
+
"type": 0,
|
|
387
|
+
"value": "Question"
|
|
388
|
+
}]
|
|
389
|
+
}),
|
|
390
|
+
emptyClassName: styles$3.emptyQuestion,
|
|
391
|
+
isEmpty: !hasQuestion
|
|
392
|
+
}, hasQuestion ? /*#__PURE__*/React.createElement(Transitions, {
|
|
393
|
+
transitions: transitions,
|
|
394
|
+
playing: transitionPlaying,
|
|
395
|
+
disabled: transitionDisabled
|
|
396
|
+
}, /*#__PURE__*/React.createElement(Heading, Object.assign({}, question, {
|
|
397
|
+
className: styles$3.question
|
|
398
|
+
}))) : null), isSplitted ? /*#__PURE__*/React.createElement(Spacer, {
|
|
399
|
+
key: "spacer"
|
|
400
|
+
}) : null, /*#__PURE__*/React.createElement(Answers, {
|
|
401
|
+
key: "answers",
|
|
402
|
+
items: answers || [],
|
|
403
|
+
answeredIndex: answeredIndex,
|
|
404
|
+
goodAnswerColor: goodAnswerColor,
|
|
405
|
+
badAnswerColor: badAnswerColor,
|
|
406
|
+
withoutGoodAnswer: withoutGoodAnswer,
|
|
407
|
+
buttonsStyle: buttonsStyle,
|
|
408
|
+
focusable: focusable,
|
|
409
|
+
transitions: transitions,
|
|
410
|
+
transitionStagger: transitionStagger,
|
|
411
|
+
transitionPlaying: transitionPlaying,
|
|
412
|
+
transitionDisabled: transitionDisabled,
|
|
413
|
+
onClick: onAnswerClick,
|
|
414
|
+
onCollapse: onAnswersCollapse,
|
|
415
|
+
onTransitionEnd: onAnswerTransitionEnd
|
|
416
|
+
}), withResult ? /*#__PURE__*/React.createElement("div", {
|
|
417
|
+
className: styles$3.result,
|
|
418
|
+
key: "results",
|
|
419
|
+
ref: resultRef
|
|
420
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
421
|
+
className: styles$3.resultContent
|
|
422
|
+
}, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
423
|
+
emptyLabel: answered ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
424
|
+
id: "li7ADr",
|
|
425
|
+
defaultMessage: [{
|
|
426
|
+
"type": 0,
|
|
427
|
+
"value": "Result"
|
|
428
|
+
}]
|
|
429
|
+
}) : null,
|
|
430
|
+
isEmpty: answered && !hasResult,
|
|
431
|
+
emptyClassName: styles$3.emptyResult
|
|
432
|
+
}, hasResult && answers !== null ? /*#__PURE__*/React.createElement(Transitions, {
|
|
433
|
+
transitions: transitions,
|
|
434
|
+
playing: transitionPlaying,
|
|
435
|
+
delay: (1 + answers.length) * transitionStagger,
|
|
436
|
+
disabled: transitionDisabled
|
|
437
|
+
}, /*#__PURE__*/React.createElement(Text, Object.assign({}, result, {
|
|
438
|
+
className: styles$3.resultText
|
|
439
|
+
})), callToActionHeight !== null ? /*#__PURE__*/React.createElement("div", {
|
|
440
|
+
style: {
|
|
441
|
+
height: callToActionHeight
|
|
442
|
+
}
|
|
443
|
+
}) : null) : null))) : null]);
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
Question.propTypes = propTypes$4;
|
|
447
|
+
Question.defaultProps = defaultProps$4;
|
|
448
|
+
|
|
449
|
+
var styles$2 = {"container":"micromag-screen-quiz-container","disabled":"micromag-screen-quiz-disabled","hidden":"micromag-screen-quiz-hidden","placeholder":"micromag-screen-quiz-placeholder","content":"micromag-screen-quiz-content","layout":"micromag-screen-quiz-layout","callToAction":"micromag-screen-quiz-callToAction","transition":"micromag-screen-quiz-transition","intro":"micromag-screen-quiz-intro","question":"micromag-screen-quiz-question","results":"micromag-screen-quiz-results","enter":"micromag-screen-quiz-enter","left":"micromag-screen-quiz-left","enterActive":"micromag-screen-quiz-enterActive","exit":"micromag-screen-quiz-exit","exitActive":"micromag-screen-quiz-exitActive","background":"micromag-screen-quiz-background"};
|
|
450
|
+
|
|
451
|
+
var propTypes$3 = {
|
|
452
|
+
id: PropTypes$1.string,
|
|
453
|
+
layout: PropTypes$1.oneOf(['top', 'middle', 'bottom', 'split']),
|
|
454
|
+
question: PropTypes.textElement,
|
|
455
|
+
answers: PropTypes.quizAnswers,
|
|
456
|
+
result: PropTypes$1.shape({
|
|
457
|
+
image: PropTypes.imageElement,
|
|
458
|
+
text: PropTypes.textElement
|
|
459
|
+
}),
|
|
460
|
+
buttonsStyle: PropTypes.boxStyle,
|
|
461
|
+
goodAnswerColor: PropTypes.color,
|
|
462
|
+
badAnswerColor: PropTypes.color,
|
|
463
|
+
spacing: PropTypes$1.number,
|
|
464
|
+
background: PropTypes.backgroundElement,
|
|
465
|
+
callToAction: PropTypes.callToAction,
|
|
466
|
+
current: PropTypes$1.bool,
|
|
467
|
+
active: PropTypes$1.bool,
|
|
468
|
+
transitions: PropTypes.transitions,
|
|
469
|
+
transitionStagger: PropTypes$1.number,
|
|
470
|
+
type: PropTypes$1.string,
|
|
471
|
+
className: PropTypes$1.string
|
|
472
|
+
};
|
|
473
|
+
var defaultProps$3 = {
|
|
52
474
|
id: null,
|
|
53
475
|
layout: 'middle',
|
|
54
476
|
question: null,
|
|
@@ -58,21 +480,17 @@ var defaultProps = {
|
|
|
58
480
|
goodAnswerColor: null,
|
|
59
481
|
badAnswerColor: null,
|
|
60
482
|
spacing: 20,
|
|
61
|
-
showResultsDelay: 750,
|
|
62
483
|
background: null,
|
|
63
484
|
callToAction: null,
|
|
64
485
|
current: true,
|
|
65
486
|
active: true,
|
|
66
487
|
transitions: null,
|
|
67
488
|
transitionStagger: 100,
|
|
68
|
-
resultsTransitionDuration: 500,
|
|
69
489
|
type: null,
|
|
70
490
|
className: null
|
|
71
491
|
};
|
|
72
492
|
|
|
73
493
|
var QuizScreen = function QuizScreen(_ref) {
|
|
74
|
-
var _ref13;
|
|
75
|
-
|
|
76
494
|
var id = _ref.id,
|
|
77
495
|
layout = _ref.layout,
|
|
78
496
|
question = _ref.question,
|
|
@@ -82,14 +500,12 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
82
500
|
goodAnswerColor = _ref.goodAnswerColor,
|
|
83
501
|
badAnswerColor = _ref.badAnswerColor,
|
|
84
502
|
spacing = _ref.spacing,
|
|
85
|
-
showResultsDelay = _ref.showResultsDelay,
|
|
86
503
|
background = _ref.background,
|
|
87
504
|
callToAction = _ref.callToAction,
|
|
88
505
|
current = _ref.current,
|
|
89
506
|
active = _ref.active,
|
|
90
507
|
transitions = _ref.transitions,
|
|
91
508
|
transitionStagger = _ref.transitionStagger,
|
|
92
|
-
resultsTransitionDuration = _ref.resultsTransitionDuration,
|
|
93
509
|
type = _ref.type,
|
|
94
510
|
className = _ref.className;
|
|
95
511
|
var screenId = id || 'screen-id';
|
|
@@ -111,37 +527,6 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
111
527
|
isStatic = _useScreenRenderConte.isStatic,
|
|
112
528
|
isCapture = _useScreenRenderConte.isCapture;
|
|
113
529
|
|
|
114
|
-
var hasQuestion = isTextFilled(question);
|
|
115
|
-
var hasResult = isTextFilled(result);
|
|
116
|
-
var showInstantAnswer = isStatic || isCapture;
|
|
117
|
-
var goodAnswerIndex = answers !== null ? answers.findIndex(function (answer) {
|
|
118
|
-
return answer !== null && answer.good;
|
|
119
|
-
}) : null;
|
|
120
|
-
|
|
121
|
-
var _useState = useState(showInstantAnswer ? goodAnswerIndex : null),
|
|
122
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
123
|
-
userAnswerIndex = _useState2[0],
|
|
124
|
-
setUserAnswerIndex = _useState2[1];
|
|
125
|
-
|
|
126
|
-
var _useState3 = useState(showInstantAnswer),
|
|
127
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
128
|
-
showResults = _useState4[0],
|
|
129
|
-
setShowResults = _useState4[1]; // const [answerTransitionProps, setAnswerTransitionProps] = useState(null);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var _useState5 = useState(showInstantAnswer),
|
|
133
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
134
|
-
answerTransitionComplete = _useState6[0],
|
|
135
|
-
setAnswerTransitionComplete = _useState6[1];
|
|
136
|
-
|
|
137
|
-
var answered = userAnswerIndex !== null;
|
|
138
|
-
|
|
139
|
-
var _ref2 = userAnswerIndex !== null && answers ? answers[userAnswerIndex] : {},
|
|
140
|
-
_ref2$good = _ref2.good,
|
|
141
|
-
hasUserAnsweredRight = _ref2$good === void 0 ? false : _ref2$good;
|
|
142
|
-
|
|
143
|
-
var isSplitted = layout === 'split';
|
|
144
|
-
var verticalAlign = isSplitted ? null : layout;
|
|
145
530
|
var transitionPlaying = current;
|
|
146
531
|
var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
|
|
147
532
|
var backgroundPlaying = current && (isView || isEdit);
|
|
@@ -153,285 +538,664 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
153
538
|
callToActionRef = _useResizeObserver.ref,
|
|
154
539
|
callToActionRect = _useResizeObserver.entry.contentRect;
|
|
155
540
|
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
callToActionHeight =
|
|
541
|
+
var _ref2 = callToActionRect || {},
|
|
542
|
+
_ref2$height = _ref2.height,
|
|
543
|
+
callToActionHeight = _ref2$height === void 0 ? 0 : _ref2$height;
|
|
544
|
+
|
|
545
|
+
var showInstantAnswer = isStatic || isCapture;
|
|
546
|
+
var goodAnswerIndex = answers !== null ? answers.findIndex(function (answer) {
|
|
547
|
+
return answer !== null && answer.good;
|
|
548
|
+
}) : null;
|
|
549
|
+
|
|
550
|
+
var _useState = useState(showInstantAnswer ? goodAnswerIndex : null),
|
|
551
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
552
|
+
userAnswerIndex = _useState2[0],
|
|
553
|
+
setUserAnswerIndex = _useState2[1];
|
|
159
554
|
|
|
160
555
|
var _useQuizCreate = useQuizCreate({
|
|
161
556
|
screenId: screenId
|
|
162
557
|
}),
|
|
163
558
|
submitQuiz = _useQuizCreate.create;
|
|
164
559
|
|
|
165
|
-
var onAnswerClick = useCallback(function (answerI) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (userAnswerIndex === null) {
|
|
169
|
-
setUserAnswerIndex(answerI);
|
|
170
|
-
timeout = setTimeout(setShowResults, showResultsDelay, true);
|
|
171
|
-
var answer = answers[answerI];
|
|
172
|
-
trackScreenEvent('click_answer', "".concat(userAnswerIndex + 1, ": ").concat(answer.label.body), {
|
|
173
|
-
answer: answer,
|
|
174
|
-
answerIndex: answerI
|
|
175
|
-
});
|
|
560
|
+
var onAnswerClick = useCallback(function (answer, answerI) {
|
|
561
|
+
if (userAnswerIndex !== null) {
|
|
562
|
+
return;
|
|
176
563
|
}
|
|
177
564
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
};
|
|
183
|
-
}, [userAnswerIndex, setUserAnswerIndex,
|
|
565
|
+
setUserAnswerIndex(answerI);
|
|
566
|
+
trackScreenEvent('click_answer', "".concat(userAnswerIndex + 1, ": ").concat(answer.label.body), {
|
|
567
|
+
answer: answer,
|
|
568
|
+
answerIndex: answerI
|
|
569
|
+
});
|
|
570
|
+
}, [userAnswerIndex, setUserAnswerIndex, trackScreenEvent, answers]);
|
|
184
571
|
useEffect(function () {
|
|
185
572
|
if (!current && isEdit && userAnswerIndex !== null) {
|
|
186
573
|
setUserAnswerIndex(null);
|
|
187
|
-
setShowResults(false);
|
|
188
|
-
setAnswerTransitionComplete(false);
|
|
189
|
-
}
|
|
190
|
-
}, [isEdit, current, userAnswerIndex, setUserAnswerIndex, setShowResults, setAnswerTransitionComplete]); // we get .answer's current and future height to animate its height
|
|
191
|
-
// we also get the right answer's Y to animate its position
|
|
192
|
-
|
|
193
|
-
var _useResizeObserver2 = useResizeObserver(),
|
|
194
|
-
answerRef = _useResizeObserver2.ref,
|
|
195
|
-
answerContentRect = _useResizeObserver2.entry.contentRect;
|
|
196
|
-
|
|
197
|
-
var _ref4 = answerContentRect || {},
|
|
198
|
-
answerHeight = _ref4.height;
|
|
199
|
-
|
|
200
|
-
var _useResizeObserver3 = useResizeObserver(),
|
|
201
|
-
rightAnswerRef = _useResizeObserver3.ref,
|
|
202
|
-
rightAnswerContentRect = _useResizeObserver3.entry.contentRect;
|
|
203
|
-
|
|
204
|
-
var _ref5 = rightAnswerContentRect || {},
|
|
205
|
-
rightAnswerHeight = _ref5.height;
|
|
206
|
-
|
|
207
|
-
var _useResizeObserver4 = useResizeObserver(),
|
|
208
|
-
resultRef = _useResizeObserver4.ref,
|
|
209
|
-
resultContentRect = _useResizeObserver4.entry.contentRect;
|
|
210
|
-
|
|
211
|
-
var _ref6 = resultContentRect || {},
|
|
212
|
-
resultHeight = _ref6.height;
|
|
213
|
-
|
|
214
|
-
var _useState7 = useState(0),
|
|
215
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
216
|
-
rightAnswerTop = _useState8[0],
|
|
217
|
-
setRightAnswerTop = _useState8[1];
|
|
218
|
-
|
|
219
|
-
useEffect(function () {
|
|
220
|
-
if (rightAnswerRef.current !== null) {
|
|
221
|
-
setRightAnswerTop(rightAnswerRef.current.offsetTop);
|
|
222
574
|
}
|
|
223
|
-
}, [
|
|
224
|
-
// .results' position changes from absolute to relative
|
|
225
|
-
// the wrong answers are removed from DOM
|
|
226
|
-
|
|
227
|
-
useEffect(function () {
|
|
228
|
-
var timeout = null;
|
|
229
|
-
|
|
230
|
-
if (!showInstantAnswer && showResults) {
|
|
231
|
-
timeout = setTimeout(setAnswerTransitionComplete, resultsTransitionDuration, true);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return function () {
|
|
235
|
-
if (timeout) {
|
|
236
|
-
clearTimeout(timeout);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
}, [showResults, resultsTransitionDuration, setAnswerTransitionComplete, showInstantAnswer]);
|
|
575
|
+
}, [isEdit, current, userAnswerIndex, setUserAnswerIndex]);
|
|
240
576
|
useEffect(function () {
|
|
241
577
|
if (userAnswerIndex !== null) {
|
|
242
|
-
var
|
|
243
|
-
|
|
244
|
-
isGood =
|
|
245
|
-
|
|
246
|
-
label =
|
|
578
|
+
var _ref3 = userAnswerIndex !== null && answers ? answers[userAnswerIndex] : {},
|
|
579
|
+
_ref3$good = _ref3.good,
|
|
580
|
+
isGood = _ref3$good === void 0 ? false : _ref3$good,
|
|
581
|
+
_ref3$label = _ref3.label,
|
|
582
|
+
label = _ref3$label === void 0 ? {} : _ref3$label;
|
|
247
583
|
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
body =
|
|
584
|
+
var _ref4 = label || {},
|
|
585
|
+
_ref4$body = _ref4.body,
|
|
586
|
+
body = _ref4$body === void 0 ? '' : _ref4$body;
|
|
251
587
|
|
|
252
588
|
submitQuiz({
|
|
253
589
|
choice: body || userAnswerIndex,
|
|
254
590
|
value: isGood ? 1 : 0
|
|
255
591
|
});
|
|
256
592
|
}
|
|
257
|
-
}, [userAnswerIndex, answers, submitQuiz]);
|
|
593
|
+
}, [userAnswerIndex, answers, submitQuiz]);
|
|
594
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
595
|
+
className: classNames([styles$2.container, _defineProperty({}, className, className !== null)]),
|
|
596
|
+
"data-screen-ready": true
|
|
597
|
+
}, !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
598
|
+
background: background,
|
|
599
|
+
width: width,
|
|
600
|
+
height: height,
|
|
601
|
+
playing: backgroundPlaying,
|
|
602
|
+
shouldLoad: backgroundShouldLoad
|
|
603
|
+
}) : null, /*#__PURE__*/React.createElement(Container, {
|
|
604
|
+
width: width,
|
|
605
|
+
height: height
|
|
606
|
+
}, /*#__PURE__*/React.createElement(Question, {
|
|
607
|
+
question: question,
|
|
608
|
+
answers: answers,
|
|
609
|
+
result: result,
|
|
610
|
+
answeredIndex: userAnswerIndex,
|
|
611
|
+
buttonsStyle: buttonsStyle,
|
|
612
|
+
goodAnswerColor: goodAnswerColor,
|
|
613
|
+
badAnswerColor: badAnswerColor,
|
|
614
|
+
focusable: current && isView,
|
|
615
|
+
showInstantAnswer: showInstantAnswer,
|
|
616
|
+
withResult: true,
|
|
617
|
+
layout: layout,
|
|
618
|
+
callToActionHeight: callToActionHeight,
|
|
619
|
+
transitions: transitions,
|
|
620
|
+
transitionPlaying: transitionPlaying,
|
|
621
|
+
transitionStagger: transitionStagger,
|
|
622
|
+
transitionDisabled: transitionDisabled,
|
|
623
|
+
onAnswerClick: onAnswerClick,
|
|
624
|
+
className: styles$2.question,
|
|
625
|
+
style: !isPlaceholder ? {
|
|
626
|
+
padding: spacing,
|
|
627
|
+
paddingTop: (menuOverScreen && !isPreview ? menuSize : 0) + spacing
|
|
628
|
+
} : null
|
|
629
|
+
}), !isPlaceholder && hasCallToAction ? /*#__PURE__*/React.createElement(CallToAction, {
|
|
630
|
+
ref: callToActionRef,
|
|
631
|
+
className: styles$2.callToAction,
|
|
632
|
+
callToAction: callToAction,
|
|
633
|
+
animationDisabled: isPreview,
|
|
634
|
+
focusable: current && isView
|
|
635
|
+
}) : null));
|
|
636
|
+
};
|
|
258
637
|
|
|
259
|
-
|
|
260
|
-
|
|
638
|
+
QuizScreen.propTypes = propTypes$3;
|
|
639
|
+
QuizScreen.defaultProps = defaultProps$3;
|
|
640
|
+
|
|
641
|
+
var styles$1 = {"container":"micromag-screen-quiz-title-container","emptyDescription":"micromag-screen-quiz-title-emptyDescription","emptyTitle":"micromag-screen-quiz-title-emptyTitle","title":"micromag-screen-quiz-title-title","isPlaceholder":"micromag-screen-quiz-title-isPlaceholder"};
|
|
642
|
+
|
|
643
|
+
var propTypes$2 = {
|
|
644
|
+
title: PropTypes.textElement,
|
|
645
|
+
description: PropTypes.textElement,
|
|
646
|
+
layout: PropTypes$1.string,
|
|
647
|
+
transitions: PropTypes.transitions,
|
|
648
|
+
transitionPlaying: PropTypes$1.bool,
|
|
649
|
+
transitionStagger: PropTypes$1.number,
|
|
650
|
+
transitionDisabled: PropTypes$1.bool,
|
|
651
|
+
className: PropTypes$1.string,
|
|
652
|
+
style: PropTypes$1.objectOf(PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]))
|
|
653
|
+
};
|
|
654
|
+
var defaultProps$2 = {
|
|
655
|
+
title: null,
|
|
656
|
+
description: null,
|
|
657
|
+
layout: null,
|
|
658
|
+
transitions: null,
|
|
659
|
+
transitionPlaying: false,
|
|
660
|
+
transitionStagger: 100,
|
|
661
|
+
transitionDisabled: false,
|
|
662
|
+
className: null,
|
|
663
|
+
style: null
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
var Title = function Title(_ref) {
|
|
667
|
+
var layout = _ref.layout,
|
|
668
|
+
title = _ref.title,
|
|
669
|
+
description = _ref.description,
|
|
670
|
+
transitions = _ref.transitions,
|
|
671
|
+
transitionPlaying = _ref.transitionPlaying,
|
|
672
|
+
transitionStagger = _ref.transitionStagger,
|
|
673
|
+
transitionDisabled = _ref.transitionDisabled,
|
|
674
|
+
className = _ref.className,
|
|
675
|
+
style = _ref.style;
|
|
676
|
+
var isSplitted = layout === 'split';
|
|
677
|
+
var verticalAlign = isSplitted ? null : layout;
|
|
678
|
+
var hasTitle = isTextFilled(title);
|
|
679
|
+
var hasDescription = isTextFilled(description);
|
|
680
|
+
return /*#__PURE__*/React.createElement(Layout, {
|
|
681
|
+
className: classNames([styles$1.container, _defineProperty({}, className, className !== null)]),
|
|
682
|
+
fullscreen: true,
|
|
683
|
+
verticalAlign: verticalAlign,
|
|
684
|
+
style: style
|
|
685
|
+
}, [/*#__PURE__*/React.createElement(ScreenElement, {
|
|
686
|
+
key: "title",
|
|
261
687
|
placeholder: "title",
|
|
262
688
|
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
263
|
-
id: "
|
|
689
|
+
id: "BSTWf8",
|
|
264
690
|
defaultMessage: [{
|
|
265
691
|
"type": 0,
|
|
266
|
-
"value": "
|
|
692
|
+
"value": "Title"
|
|
693
|
+
}]
|
|
694
|
+
}),
|
|
695
|
+
emptyClassName: styles$1.emptyTitle,
|
|
696
|
+
isEmpty: !hasTitle
|
|
697
|
+
}, hasTitle ? /*#__PURE__*/React.createElement(Transitions, {
|
|
698
|
+
transitions: transitions,
|
|
699
|
+
playing: transitionPlaying,
|
|
700
|
+
disabled: transitionDisabled
|
|
701
|
+
}, /*#__PURE__*/React.createElement(Heading, Object.assign({}, title, {
|
|
702
|
+
className: styles$1.title
|
|
703
|
+
}))) : null), isSplitted ? /*#__PURE__*/React.createElement(Spacer, {
|
|
704
|
+
key: "spacer"
|
|
705
|
+
}) : null, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
706
|
+
key: "description",
|
|
707
|
+
placeholder: "text",
|
|
708
|
+
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
709
|
+
id: "hoDz0O",
|
|
710
|
+
defaultMessage: [{
|
|
711
|
+
"type": 0,
|
|
712
|
+
"value": "Description"
|
|
713
|
+
}]
|
|
714
|
+
}),
|
|
715
|
+
emptyClassName: styles$1.emptyDescription,
|
|
716
|
+
isEmpty: !hasDescription
|
|
717
|
+
}, hasTitle ? /*#__PURE__*/React.createElement(Transitions, {
|
|
718
|
+
transitions: transitions,
|
|
719
|
+
playing: transitionPlaying,
|
|
720
|
+
disabled: transitionDisabled,
|
|
721
|
+
delay: transitionStagger
|
|
722
|
+
}, /*#__PURE__*/React.createElement(Text, Object.assign({}, description, {
|
|
723
|
+
className: styles$1.description
|
|
724
|
+
}))) : null)]);
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
Title.propTypes = propTypes$2;
|
|
728
|
+
Title.defaultProps = defaultProps$2;
|
|
729
|
+
|
|
730
|
+
var styles = {"container":"micromag-screen-quiz-results-container","emptyDescription":"micromag-screen-quiz-results-emptyDescription","emptyTitle":"micromag-screen-quiz-results-emptyTitle","title":"micromag-screen-quiz-results-title","isPlaceholder":"micromag-screen-quiz-results-isPlaceholder"};
|
|
731
|
+
|
|
732
|
+
var propTypes$1 = {
|
|
733
|
+
title: PropTypes.textElement,
|
|
734
|
+
description: PropTypes.textElement,
|
|
735
|
+
layout: PropTypes$1.string,
|
|
736
|
+
transitions: PropTypes.transitions,
|
|
737
|
+
transitionPlaying: PropTypes$1.bool,
|
|
738
|
+
transitionStagger: PropTypes$1.number,
|
|
739
|
+
transitionDisabled: PropTypes$1.bool,
|
|
740
|
+
className: PropTypes$1.string,
|
|
741
|
+
style: PropTypes$1.objectOf(PropTypes$1.oneOfType([PropTypes$1.string, PropTypes$1.number]))
|
|
742
|
+
};
|
|
743
|
+
var defaultProps$1 = {
|
|
744
|
+
title: null,
|
|
745
|
+
description: null,
|
|
746
|
+
layout: null,
|
|
747
|
+
transitions: null,
|
|
748
|
+
transitionPlaying: false,
|
|
749
|
+
transitionStagger: 100,
|
|
750
|
+
transitionDisabled: false,
|
|
751
|
+
className: null,
|
|
752
|
+
style: null
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
var Results = function Results(_ref) {
|
|
756
|
+
var layout = _ref.layout,
|
|
757
|
+
title = _ref.title,
|
|
758
|
+
description = _ref.description,
|
|
759
|
+
transitions = _ref.transitions,
|
|
760
|
+
transitionPlaying = _ref.transitionPlaying,
|
|
761
|
+
transitionStagger = _ref.transitionStagger,
|
|
762
|
+
transitionDisabled = _ref.transitionDisabled,
|
|
763
|
+
className = _ref.className,
|
|
764
|
+
style = _ref.style;
|
|
765
|
+
var isSplitted = layout === 'split';
|
|
766
|
+
var verticalAlign = isSplitted ? null : layout;
|
|
767
|
+
var hasTitle = isTextFilled(title);
|
|
768
|
+
var hasDescription = isTextFilled(description);
|
|
769
|
+
return /*#__PURE__*/React.createElement(Layout, {
|
|
770
|
+
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
771
|
+
fullscreen: true,
|
|
772
|
+
verticalAlign: verticalAlign,
|
|
773
|
+
style: style
|
|
774
|
+
}, [/*#__PURE__*/React.createElement(ScreenElement, {
|
|
775
|
+
key: "title",
|
|
776
|
+
placeholder: "title",
|
|
777
|
+
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
778
|
+
id: "BSTWf8",
|
|
779
|
+
defaultMessage: [{
|
|
780
|
+
"type": 0,
|
|
781
|
+
"value": "Title"
|
|
267
782
|
}]
|
|
268
783
|
}),
|
|
269
784
|
emptyClassName: styles.emptyTitle,
|
|
270
|
-
isEmpty: !
|
|
271
|
-
},
|
|
785
|
+
isEmpty: !hasTitle
|
|
786
|
+
}, hasTitle ? /*#__PURE__*/React.createElement(Transitions, {
|
|
272
787
|
transitions: transitions,
|
|
273
788
|
playing: transitionPlaying,
|
|
274
789
|
disabled: transitionDisabled
|
|
275
|
-
}, /*#__PURE__*/React.createElement(Heading, Object.assign({},
|
|
276
|
-
className: styles.
|
|
277
|
-
}))) : null)
|
|
790
|
+
}, /*#__PURE__*/React.createElement(Heading, Object.assign({}, title, {
|
|
791
|
+
className: styles.title
|
|
792
|
+
}))) : null), isSplitted ? /*#__PURE__*/React.createElement(Spacer, {
|
|
793
|
+
key: "spacer"
|
|
794
|
+
}) : null, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
795
|
+
key: "description",
|
|
796
|
+
placeholder: "text",
|
|
797
|
+
emptyLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
798
|
+
id: "hoDz0O",
|
|
799
|
+
defaultMessage: [{
|
|
800
|
+
"type": 0,
|
|
801
|
+
"value": "Description"
|
|
802
|
+
}]
|
|
803
|
+
}),
|
|
804
|
+
emptyClassName: styles.emptyDescription,
|
|
805
|
+
isEmpty: !hasDescription
|
|
806
|
+
}, hasTitle ? /*#__PURE__*/React.createElement(Transitions, {
|
|
807
|
+
transitions: transitions,
|
|
808
|
+
playing: transitionPlaying,
|
|
809
|
+
disabled: transitionDisabled,
|
|
810
|
+
delay: transitionStagger
|
|
811
|
+
}, /*#__PURE__*/React.createElement(Text, Object.assign({}, description, {
|
|
812
|
+
className: styles.description
|
|
813
|
+
}))) : null)]);
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
Results.propTypes = propTypes$1;
|
|
817
|
+
Results.defaultProps = defaultProps$1;
|
|
818
|
+
|
|
819
|
+
var propTypes = {
|
|
820
|
+
id: PropTypes$1.string,
|
|
821
|
+
layout: PropTypes$1.oneOf(['top', 'middle', 'bottom', 'split']),
|
|
822
|
+
introLayout: PropTypes$1.oneOf(['top', 'middle', 'bottom', 'split']),
|
|
823
|
+
title: PropTypes.textElement,
|
|
824
|
+
description: PropTypes.textElement,
|
|
825
|
+
questions: PropTypes$1.arrayOf(PropTypes$1.shape({
|
|
826
|
+
text: PropTypes.textElement,
|
|
827
|
+
answers: PropTypes.quizAnswers
|
|
828
|
+
})),
|
|
829
|
+
results: PropTypes$1.arrayOf(PropTypes$1.shape({
|
|
830
|
+
title: PropTypes.textElement,
|
|
831
|
+
description: PropTypes.textElement
|
|
832
|
+
})),
|
|
833
|
+
buttonsStyle: PropTypes.boxStyle,
|
|
834
|
+
goodAnswerColor: PropTypes.color,
|
|
835
|
+
badAnswerColor: PropTypes.color,
|
|
836
|
+
spacing: PropTypes$1.number,
|
|
837
|
+
background: PropTypes.backgroundElement,
|
|
838
|
+
introBackground: PropTypes.backgroundElement,
|
|
839
|
+
callToAction: PropTypes.callToAction,
|
|
840
|
+
current: PropTypes$1.bool,
|
|
841
|
+
active: PropTypes$1.bool,
|
|
842
|
+
transitions: PropTypes.transitions,
|
|
843
|
+
transitionStagger: PropTypes$1.number,
|
|
844
|
+
type: PropTypes$1.string,
|
|
845
|
+
className: PropTypes$1.string
|
|
846
|
+
};
|
|
847
|
+
var defaultProps = {
|
|
848
|
+
id: null,
|
|
849
|
+
layout: 'middle',
|
|
850
|
+
introLayout: null,
|
|
851
|
+
title: null,
|
|
852
|
+
description: null,
|
|
853
|
+
questions: null,
|
|
854
|
+
results: null,
|
|
855
|
+
buttonsStyle: null,
|
|
856
|
+
goodAnswerColor: null,
|
|
857
|
+
badAnswerColor: null,
|
|
858
|
+
spacing: 20,
|
|
859
|
+
background: null,
|
|
860
|
+
introBackground: null,
|
|
861
|
+
callToAction: null,
|
|
862
|
+
current: true,
|
|
863
|
+
active: true,
|
|
864
|
+
transitions: null,
|
|
865
|
+
transitionStagger: 100,
|
|
866
|
+
type: null,
|
|
867
|
+
className: null
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
871
|
+
var _ref12;
|
|
872
|
+
|
|
873
|
+
var id = _ref.id,
|
|
874
|
+
layout = _ref.layout,
|
|
875
|
+
introLayout = _ref.introLayout,
|
|
876
|
+
title = _ref.title,
|
|
877
|
+
description = _ref.description,
|
|
878
|
+
questions = _ref.questions,
|
|
879
|
+
results = _ref.results,
|
|
880
|
+
buttonsStyle = _ref.buttonsStyle,
|
|
881
|
+
goodAnswerColor = _ref.goodAnswerColor,
|
|
882
|
+
badAnswerColor = _ref.badAnswerColor,
|
|
883
|
+
spacing = _ref.spacing,
|
|
884
|
+
background = _ref.background,
|
|
885
|
+
introBackground = _ref.introBackground,
|
|
886
|
+
callToAction = _ref.callToAction,
|
|
887
|
+
current = _ref.current,
|
|
888
|
+
active = _ref.active,
|
|
889
|
+
transitions = _ref.transitions,
|
|
890
|
+
transitionStagger = _ref.transitionStagger,
|
|
891
|
+
type = _ref.type,
|
|
892
|
+
className = _ref.className;
|
|
893
|
+
var screenId = id || 'screen-id';
|
|
894
|
+
var trackScreenEvent = useTrackScreenEvent(type);
|
|
895
|
+
|
|
896
|
+
var _useScreenSize = useScreenSize(),
|
|
897
|
+
width = _useScreenSize.width,
|
|
898
|
+
height = _useScreenSize.height,
|
|
899
|
+
menuOverScreen = _useScreenSize.menuOverScreen;
|
|
900
|
+
|
|
901
|
+
var _useViewer = useViewer(),
|
|
902
|
+
menuSize = _useViewer.menuSize;
|
|
903
|
+
|
|
904
|
+
var _useScreenRenderConte = useScreenRenderContext(),
|
|
905
|
+
isView = _useScreenRenderConte.isView,
|
|
906
|
+
isPreview = _useScreenRenderConte.isPreview,
|
|
907
|
+
isPlaceholder = _useScreenRenderConte.isPlaceholder,
|
|
908
|
+
isEdit = _useScreenRenderConte.isEdit,
|
|
909
|
+
isStatic = _useScreenRenderConte.isStatic,
|
|
910
|
+
isCapture = _useScreenRenderConte.isCapture;
|
|
911
|
+
|
|
912
|
+
var screenState = useScreenState();
|
|
913
|
+
|
|
914
|
+
var _ref2 = screenState !== null ? screenState.split('.') : [],
|
|
915
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
916
|
+
_ref3$ = _ref3[0],
|
|
917
|
+
stateId = _ref3$ === void 0 ? null : _ref3$,
|
|
918
|
+
_ref3$2 = _ref3[1],
|
|
919
|
+
stateIndex = _ref3$2 === void 0 ? 0 : _ref3$2;
|
|
920
|
+
|
|
921
|
+
var transitionPlaying = current;
|
|
922
|
+
var transitionDisabled = isStatic || isCapture || isPlaceholder || isPreview || isEdit;
|
|
923
|
+
var backgroundPlaying = current && (isView || isEdit);
|
|
924
|
+
var backgroundShouldLoad = current || active || !isView; // Call to Action
|
|
925
|
+
|
|
926
|
+
var hasCallToAction = callToAction !== null && callToAction.active === true;
|
|
927
|
+
|
|
928
|
+
var _useResizeObserver = useResizeObserver(),
|
|
929
|
+
callToActionRef = _useResizeObserver.ref,
|
|
930
|
+
callToActionRect = _useResizeObserver.entry.contentRect;
|
|
931
|
+
|
|
932
|
+
var _ref4 = callToActionRect || {},
|
|
933
|
+
_ref4$height = _ref4.height,
|
|
934
|
+
callToActionHeight = _ref4$height === void 0 ? 0 : _ref4$height;
|
|
935
|
+
|
|
936
|
+
var showInstantAnswer = isStatic || isCapture;
|
|
937
|
+
var hasIntro = title !== null || description !== null || isEdit || stateId === 'intro';
|
|
938
|
+
|
|
939
|
+
var _useState = useState(null),
|
|
940
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
941
|
+
userAnswers = _useState2[0],
|
|
942
|
+
setUserAnswers = _useState2[1];
|
|
943
|
+
|
|
944
|
+
var initialQuestionIndex = stateId === 'questions' ? parseInt(stateIndex, 10) : stateId;
|
|
945
|
+
|
|
946
|
+
var _useState3 = useState(initialQuestionIndex !== null || !hasIntro || isPlaceholder ? initialQuestionIndex || 0 : 'intro'),
|
|
947
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
948
|
+
questionIndex = _useState4[0],
|
|
949
|
+
setQuestionIndex = _useState4[1];
|
|
950
|
+
|
|
951
|
+
var onAnswerClick = useCallback(function (answer, answerIndex) {
|
|
952
|
+
setUserAnswers(_objectSpread(_objectSpread({}, userAnswers), {}, _defineProperty({}, questionIndex, answerIndex)));
|
|
953
|
+
trackScreenEvent('click_answer', "Question #".concat(questionIndex + 1, " ").concat(answerIndex + 1, ": ").concat(answer.label.body), {
|
|
954
|
+
question: questions[questionIndex],
|
|
955
|
+
questionIndex: questionIndex,
|
|
956
|
+
answer: answer,
|
|
957
|
+
answerIndex: answerIndex
|
|
958
|
+
});
|
|
959
|
+
}, [userAnswers, setUserAnswers, trackScreenEvent, questions, questionIndex]);
|
|
960
|
+
var onAnswerTransitionEnd = useCallback(function () {
|
|
961
|
+
var nextIndex = questionIndex + 1;
|
|
962
|
+
var questionsCount = questions.length;
|
|
963
|
+
|
|
964
|
+
if (nextIndex < questionsCount) {
|
|
965
|
+
setQuestionIndex(nextIndex);
|
|
966
|
+
} else if (nextIndex === questionsCount) {
|
|
967
|
+
setQuestionIndex('results');
|
|
968
|
+
}
|
|
969
|
+
}, [questions, questionIndex, setQuestionIndex]);
|
|
970
|
+
useEffect(function () {
|
|
971
|
+
if (!current && isEdit && userAnswers !== null) {
|
|
972
|
+
setUserAnswers(null);
|
|
973
|
+
}
|
|
974
|
+
}, [isEdit, current, userAnswers, setUserAnswers]);
|
|
975
|
+
var hasQuestions = questions !== null && questions.length > 0;
|
|
976
|
+
var currentQuestion = hasQuestions ? questions[questionIndex] || {} : {};
|
|
977
|
+
var _currentQuestion$text = currentQuestion.text,
|
|
978
|
+
text = _currentQuestion$text === void 0 ? null : _currentQuestion$text,
|
|
979
|
+
_currentQuestion$answ = currentQuestion.answers,
|
|
980
|
+
answers = _currentQuestion$answ === void 0 ? [] : _currentQuestion$answ,
|
|
981
|
+
_currentQuestion$back = currentQuestion.background,
|
|
982
|
+
questionBackground = _currentQuestion$back === void 0 ? null : _currentQuestion$back,
|
|
983
|
+
_currentQuestion$layo = currentQuestion.layout,
|
|
984
|
+
questionLayout = _currentQuestion$layo === void 0 ? null : _currentQuestion$layo;
|
|
985
|
+
var currentAnsweredIndex = userAnswers !== null && typeof userAnswers[questionIndex] !== 'undefined' ? userAnswers[questionIndex] : null;
|
|
986
|
+
var currentPoints = useMemo(function () {
|
|
987
|
+
return userAnswers !== null ? Object.keys(userAnswers).reduce(function (totalPoints, answerQuestionIndex) {
|
|
988
|
+
var _ref5 = questions !== null ? questions[answerQuestionIndex] || {} : {},
|
|
989
|
+
_ref5$answers = _ref5.answers,
|
|
990
|
+
questionAnswers = _ref5$answers === void 0 ? [] : _ref5$answers;
|
|
991
|
+
|
|
992
|
+
var answerIndex = userAnswers[answerQuestionIndex];
|
|
993
|
+
|
|
994
|
+
var _ref6 = questionAnswers[answerIndex] || {},
|
|
995
|
+
_ref6$points = _ref6.points,
|
|
996
|
+
points = _ref6$points === void 0 ? 0 : _ref6$points;
|
|
997
|
+
|
|
998
|
+
return points + totalPoints;
|
|
999
|
+
}, 0) : 0;
|
|
1000
|
+
}, [userAnswers, questions]);
|
|
1001
|
+
var isIntro = hasIntro && questionIndex === 'intro';
|
|
1002
|
+
var isResults = questionIndex === 'results';
|
|
1003
|
+
var isQuestion = !isIntro && !isResults;
|
|
1004
|
+
var currentResult = useMemo(function () {
|
|
1005
|
+
if (!isResults) {
|
|
1006
|
+
return null;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
if (stateId === 'results') {
|
|
1010
|
+
return (results || [])[parseInt(stateIndex, 10)] || null;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
return (results || []).sort(function (_ref7, _ref8) {
|
|
1014
|
+
var _ref7$points = _ref7.points,
|
|
1015
|
+
pointsA = _ref7$points === void 0 ? 0 : _ref7$points;
|
|
1016
|
+
var _ref8$points = _ref8.points,
|
|
1017
|
+
pointsB = _ref8$points === void 0 ? 0 : _ref8$points;
|
|
1018
|
+
|
|
1019
|
+
if (pointsA === pointsB) {
|
|
1020
|
+
return 0;
|
|
1021
|
+
}
|
|
278
1022
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
1023
|
+
return pointsA > pointsB ? 1 : -1;
|
|
1024
|
+
}).reduce(function (lastResult, result) {
|
|
1025
|
+
var _ref9 = lastResult || {},
|
|
1026
|
+
_ref9$points = _ref9.points,
|
|
1027
|
+
lastPoints = _ref9$points === void 0 ? 0 : _ref9$points;
|
|
284
1028
|
|
|
1029
|
+
var _ref10 = result || {},
|
|
1030
|
+
_ref10$points = _ref10.points,
|
|
1031
|
+
points = _ref10$points === void 0 ? 0 : _ref10$points;
|
|
285
1032
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
ref: answerRef,
|
|
290
|
-
style: answered && !answerTransitionComplete && (isView || isEdit) ? {
|
|
291
|
-
transitionDuration: "".concat(resultsTransitionDuration, "ms"),
|
|
292
|
-
height: !showResults ? answerHeight : rightAnswerHeight + resultHeight
|
|
293
|
-
} : null
|
|
294
|
-
}, answers !== null || isPlaceholder ? /*#__PURE__*/React.createElement("div", {
|
|
295
|
-
className: styles.items
|
|
296
|
-
}, (isPlaceholder ? _toConsumableArray(new Array(2)) : answers).map(function (answer, answerI) {
|
|
297
|
-
var _ref12;
|
|
1033
|
+
return currentPoints >= lastPoints && currentPoints <= points ? result : lastResult;
|
|
1034
|
+
}, null);
|
|
1035
|
+
}, [isResults, results, currentPoints, stateId, stateIndex]);
|
|
298
1036
|
|
|
299
|
-
|
|
1037
|
+
var _ref11 = currentResult || {},
|
|
1038
|
+
_ref11$background = _ref11.background,
|
|
1039
|
+
resultBackground = _ref11$background === void 0 ? null : _ref11$background,
|
|
1040
|
+
_ref11$layout = _ref11.layout,
|
|
1041
|
+
resultLayout = _ref11$layout === void 0 ? null : _ref11$layout;
|
|
300
1042
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
label = _ref9$label === void 0 ? null : _ref9$label,
|
|
306
|
-
_ref9$buttonStyle = _ref9.buttonStyle,
|
|
307
|
-
answerButtonStyle = _ref9$buttonStyle === void 0 ? null : _ref9$buttonStyle;
|
|
1043
|
+
var _useQuizCreate = useQuizCreate({
|
|
1044
|
+
screenId: screenId
|
|
1045
|
+
}),
|
|
1046
|
+
submitQuiz = _useQuizCreate.create;
|
|
308
1047
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
1048
|
+
useEffect(function () {
|
|
1049
|
+
if (!isResults || isEdit) {
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
312
1052
|
|
|
313
|
-
|
|
314
|
-
|
|
1053
|
+
submitQuiz({
|
|
1054
|
+
choice: userAnswers,
|
|
1055
|
+
value: currentPoints
|
|
1056
|
+
});
|
|
1057
|
+
}, [isResults, userAnswers, submitQuiz]); // Switch state
|
|
315
1058
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
className: styles.resultIcon,
|
|
356
|
-
style: getStyleFromColor(goodAnswerColor, 'backgroundColor')
|
|
357
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
358
|
-
className: styles.faIcon,
|
|
359
|
-
icon: faCheck
|
|
360
|
-
})) : null, answered && !hasUserAnsweredRight && userAnswer ? /*#__PURE__*/React.createElement("span", {
|
|
361
|
-
className: styles.resultIcon,
|
|
362
|
-
style: getStyleFromColor(badAnswerColor, 'backgroundColor')
|
|
363
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
364
|
-
className: styles.faIcon,
|
|
365
|
-
icon: faTimes
|
|
366
|
-
})) : null, /*#__PURE__*/React.createElement(Text, Object.assign({}, label, {
|
|
367
|
-
className: styles.optionLabel
|
|
368
|
-
})))) : null)));
|
|
369
|
-
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
370
|
-
className: styles.result,
|
|
371
|
-
ref: resultRef
|
|
372
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
373
|
-
className: styles.resultContent
|
|
374
|
-
}, /*#__PURE__*/React.createElement(ScreenElement, {
|
|
375
|
-
emptyLabel: answered ? /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
376
|
-
id: "li7ADr",
|
|
377
|
-
defaultMessage: [{
|
|
378
|
-
"type": 0,
|
|
379
|
-
"value": "Result"
|
|
380
|
-
}]
|
|
381
|
-
}) : null,
|
|
382
|
-
isEmpty: answered && !hasResult,
|
|
383
|
-
emptyClassName: styles.emptyResult
|
|
384
|
-
}, hasResult && answers !== null ? /*#__PURE__*/React.createElement(Transitions, {
|
|
385
|
-
transitions: transitions,
|
|
386
|
-
playing: transitionPlaying,
|
|
387
|
-
delay: (1 + answers.length) * transitionStagger,
|
|
388
|
-
disabled: transitionDisabled
|
|
389
|
-
}, /*#__PURE__*/React.createElement(Text, Object.assign({}, result, {
|
|
390
|
-
className: styles.resultText
|
|
391
|
-
})), hasCallToAction ? /*#__PURE__*/React.createElement("div", {
|
|
392
|
-
style: {
|
|
393
|
-
height: callToActionHeight
|
|
1059
|
+
useEffect(function () {
|
|
1060
|
+
if (!isEdit && !isPreview) {
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
if (stateId === 'questions') {
|
|
1065
|
+
setQuestionIndex(parseInt(stateIndex, 10));
|
|
1066
|
+
} else if (stateId === 'results') {
|
|
1067
|
+
setQuestionIndex('results');
|
|
1068
|
+
} else if (stateId === 'intro') {
|
|
1069
|
+
setQuestionIndex('intro');
|
|
1070
|
+
}
|
|
1071
|
+
}, [stateId, stateIndex, isEdit, setQuestionIndex]);
|
|
1072
|
+
var finalBackground = background;
|
|
1073
|
+
var backgroundKey = 'background';
|
|
1074
|
+
|
|
1075
|
+
if (isIntro && introBackground !== null) {
|
|
1076
|
+
finalBackground = introBackground;
|
|
1077
|
+
backgroundKey = 'results';
|
|
1078
|
+
} else if (isResults && resultBackground !== null) {
|
|
1079
|
+
finalBackground = resultBackground;
|
|
1080
|
+
backgroundKey = 'results';
|
|
1081
|
+
} else if (isQuestion && questionBackground !== null) {
|
|
1082
|
+
finalBackground = questionBackground;
|
|
1083
|
+
backgroundKey = "question_".concat(questionIndex);
|
|
1084
|
+
} // Transition direction
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
var lastQuestionIndexRef = useRef(questionIndex);
|
|
1088
|
+
var direction = useMemo(function () {
|
|
1089
|
+
if (questionIndex === lastQuestionIndexRef.current) {
|
|
1090
|
+
return null;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
var lastQuestionIndex = lastQuestionIndexRef.current;
|
|
1094
|
+
lastQuestionIndexRef.current = questionIndex;
|
|
1095
|
+
|
|
1096
|
+
if (questionIndex === 'intro' || lastQuestionIndex === 'results' || lastQuestionIndex > questionIndex) {
|
|
1097
|
+
return 'left';
|
|
394
1098
|
}
|
|
395
|
-
|
|
1099
|
+
|
|
1100
|
+
lastQuestionIndexRef.current = questionIndex;
|
|
1101
|
+
return 'right';
|
|
1102
|
+
}, [questionIndex]);
|
|
396
1103
|
return /*#__PURE__*/React.createElement("div", {
|
|
397
|
-
className: classNames([styles.container, (
|
|
1104
|
+
className: classNames([styles$2.container, (_ref12 = {}, _defineProperty(_ref12, styles$2[direction], direction !== null), _defineProperty(_ref12, className, className !== null), _ref12)]),
|
|
398
1105
|
"data-screen-ready": true
|
|
399
|
-
}, !isPlaceholder ? /*#__PURE__*/React.createElement(
|
|
400
|
-
|
|
1106
|
+
}, !isPlaceholder ? /*#__PURE__*/React.createElement(TransitionGroup, null, /*#__PURE__*/React.createElement(CSSTransition, {
|
|
1107
|
+
key: backgroundKey,
|
|
1108
|
+
classNames: styles$2,
|
|
1109
|
+
timeout: 1000
|
|
1110
|
+
}, /*#__PURE__*/React.createElement(Background, {
|
|
1111
|
+
background: finalBackground,
|
|
401
1112
|
width: width,
|
|
402
1113
|
height: height,
|
|
403
1114
|
playing: backgroundPlaying,
|
|
404
|
-
shouldLoad: backgroundShouldLoad
|
|
405
|
-
|
|
1115
|
+
shouldLoad: backgroundShouldLoad,
|
|
1116
|
+
className: styles$2.background
|
|
1117
|
+
}))) : null, /*#__PURE__*/React.createElement(Container, {
|
|
406
1118
|
width: width,
|
|
407
1119
|
height: height
|
|
408
|
-
}, /*#__PURE__*/React.createElement(
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
1120
|
+
}, /*#__PURE__*/React.createElement(TransitionGroup, null, [isIntro ? /*#__PURE__*/React.createElement(CSSTransition, {
|
|
1121
|
+
key: "intro",
|
|
1122
|
+
classNames: styles$2,
|
|
1123
|
+
timeout: 1000
|
|
1124
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
1125
|
+
title: title,
|
|
1126
|
+
description: description,
|
|
1127
|
+
layout: introLayout || layout,
|
|
1128
|
+
transitions: transitions,
|
|
1129
|
+
transitionPlaying: transitionPlaying,
|
|
1130
|
+
transitionStagger: transitionStagger,
|
|
1131
|
+
transitionDisabled: transitionDisabled,
|
|
1132
|
+
className: styles$2.intro,
|
|
412
1133
|
style: !isPlaceholder ? {
|
|
413
1134
|
padding: spacing,
|
|
414
1135
|
paddingTop: (menuOverScreen && !isPreview ? menuSize : 0) + spacing
|
|
415
1136
|
} : null
|
|
416
|
-
}
|
|
1137
|
+
})) : null, isQuestion ? /*#__PURE__*/React.createElement(CSSTransition, {
|
|
1138
|
+
key: "question-".concat(questionIndex),
|
|
1139
|
+
classNames: styles$2,
|
|
1140
|
+
timeout: 1000
|
|
1141
|
+
}, /*#__PURE__*/React.createElement(Question, {
|
|
1142
|
+
index: questionIndex,
|
|
1143
|
+
totalCount: (questions || []).length,
|
|
1144
|
+
question: text,
|
|
1145
|
+
answers: answers,
|
|
1146
|
+
answeredIndex: currentAnsweredIndex,
|
|
1147
|
+
buttonsStyle: buttonsStyle,
|
|
1148
|
+
goodAnswerColor: goodAnswerColor,
|
|
1149
|
+
badAnswerColor: badAnswerColor,
|
|
1150
|
+
focusable: current && isView,
|
|
1151
|
+
showInstantAnswer: showInstantAnswer,
|
|
1152
|
+
layout: questionLayout || layout,
|
|
1153
|
+
withoutGoodAnswer: true,
|
|
1154
|
+
callToActionHeight: callToActionHeight,
|
|
1155
|
+
transitions: transitions,
|
|
1156
|
+
transitionPlaying: transitionPlaying,
|
|
1157
|
+
transitionStagger: transitionStagger,
|
|
1158
|
+
transitionDisabled: transitionDisabled,
|
|
1159
|
+
onAnswerClick: onAnswerClick,
|
|
1160
|
+
onAnswerTransitionEnd: onAnswerTransitionEnd,
|
|
1161
|
+
className: styles$2.question,
|
|
1162
|
+
style: !isPlaceholder ? {
|
|
1163
|
+
padding: spacing,
|
|
1164
|
+
paddingTop: (menuOverScreen && !isPreview ? menuSize : 0) + spacing
|
|
1165
|
+
} : null
|
|
1166
|
+
})) : null, isResults ? /*#__PURE__*/React.createElement(CSSTransition, {
|
|
1167
|
+
key: "results",
|
|
1168
|
+
classNames: styles$2,
|
|
1169
|
+
timeout: 2000
|
|
1170
|
+
}, /*#__PURE__*/React.createElement(Results, Object.assign({}, currentResult, {
|
|
1171
|
+
layout: resultLayout || layout,
|
|
1172
|
+
transitions: transitions,
|
|
1173
|
+
transitionPlaying: transitionPlaying,
|
|
1174
|
+
transitionStagger: transitionStagger,
|
|
1175
|
+
transitionDisabled: transitionDisabled,
|
|
1176
|
+
className: styles$2.results,
|
|
1177
|
+
style: !isPlaceholder ? {
|
|
1178
|
+
padding: spacing,
|
|
1179
|
+
paddingTop: (menuOverScreen && !isPreview ? menuSize : 0) + spacing
|
|
1180
|
+
} : null
|
|
1181
|
+
}))) : null]), !isPlaceholder && hasCallToAction ? /*#__PURE__*/React.createElement(CallToAction, {
|
|
417
1182
|
ref: callToActionRef,
|
|
418
|
-
className: styles.callToAction,
|
|
1183
|
+
className: styles$2.callToAction,
|
|
419
1184
|
callToAction: callToAction,
|
|
420
|
-
disabled: !answerTransitionComplete,
|
|
421
1185
|
animationDisabled: isPreview,
|
|
422
1186
|
focusable: current && isView
|
|
423
1187
|
}) : null));
|
|
424
1188
|
};
|
|
425
1189
|
|
|
426
|
-
|
|
427
|
-
|
|
1190
|
+
QuizMultipleScreen.propTypes = propTypes;
|
|
1191
|
+
QuizMultipleScreen.defaultProps = defaultProps;
|
|
428
1192
|
|
|
429
|
-
var definition = {
|
|
1193
|
+
var definition = [{
|
|
430
1194
|
id: 'quiz',
|
|
431
1195
|
type: 'screen',
|
|
432
1196
|
group: {
|
|
433
1197
|
label: defineMessage({
|
|
434
|
-
id: "
|
|
1198
|
+
id: "ZiWlL6",
|
|
435
1199
|
defaultMessage: [{
|
|
436
1200
|
"type": 0,
|
|
437
1201
|
"value": "Questions"
|
|
@@ -528,7 +1292,7 @@ var definition = {
|
|
|
528
1292
|
}]
|
|
529
1293
|
}),
|
|
530
1294
|
field: {
|
|
531
|
-
type: '
|
|
1295
|
+
type: 'box-style'
|
|
532
1296
|
}
|
|
533
1297
|
}, {
|
|
534
1298
|
name: 'goodAnswerColor',
|
|
@@ -570,6 +1334,258 @@ var definition = {
|
|
|
570
1334
|
}
|
|
571
1335
|
}
|
|
572
1336
|
}]
|
|
573
|
-
}
|
|
1337
|
+
}, {
|
|
1338
|
+
id: 'quiz-multiple',
|
|
1339
|
+
type: 'screen',
|
|
1340
|
+
group: {
|
|
1341
|
+
label: defineMessage({
|
|
1342
|
+
id: "ZiWlL6",
|
|
1343
|
+
defaultMessage: [{
|
|
1344
|
+
"type": 0,
|
|
1345
|
+
"value": "Questions"
|
|
1346
|
+
}]
|
|
1347
|
+
}),
|
|
1348
|
+
order: 7
|
|
1349
|
+
},
|
|
1350
|
+
title: defineMessage({
|
|
1351
|
+
id: "ACkeH6",
|
|
1352
|
+
defaultMessage: [{
|
|
1353
|
+
"type": 0,
|
|
1354
|
+
"value": "Quiz with multiple questions"
|
|
1355
|
+
}]
|
|
1356
|
+
}),
|
|
1357
|
+
component: QuizMultipleScreen,
|
|
1358
|
+
layouts: ['top', 'middle', 'bottom', 'split'],
|
|
1359
|
+
states: [{
|
|
1360
|
+
id: 'intro',
|
|
1361
|
+
label: defineMessage({
|
|
1362
|
+
id: "BgrRxZ",
|
|
1363
|
+
defaultMessage: [{
|
|
1364
|
+
"type": 0,
|
|
1365
|
+
"value": "Intro"
|
|
1366
|
+
}]
|
|
1367
|
+
}),
|
|
1368
|
+
fields: [{
|
|
1369
|
+
name: 'introLayout',
|
|
1370
|
+
type: 'screen-layout',
|
|
1371
|
+
defaultValue: 'middle',
|
|
1372
|
+
screenState: 'intro',
|
|
1373
|
+
label: defineMessage({
|
|
1374
|
+
id: "4iBXj2",
|
|
1375
|
+
defaultMessage: [{
|
|
1376
|
+
"type": 0,
|
|
1377
|
+
"value": "Layout"
|
|
1378
|
+
}]
|
|
1379
|
+
})
|
|
1380
|
+
}, {
|
|
1381
|
+
name: 'title',
|
|
1382
|
+
type: 'heading-element',
|
|
1383
|
+
theme: {
|
|
1384
|
+
textStyle: 'heading2'
|
|
1385
|
+
},
|
|
1386
|
+
label: defineMessage({
|
|
1387
|
+
id: "+AEVbJ",
|
|
1388
|
+
defaultMessage: [{
|
|
1389
|
+
"type": 0,
|
|
1390
|
+
"value": "Title"
|
|
1391
|
+
}]
|
|
1392
|
+
})
|
|
1393
|
+
}, {
|
|
1394
|
+
name: 'description',
|
|
1395
|
+
type: 'text-element',
|
|
1396
|
+
theme: {
|
|
1397
|
+
textStyle: 'text'
|
|
1398
|
+
},
|
|
1399
|
+
label: defineMessage({
|
|
1400
|
+
id: "ZCe0r4",
|
|
1401
|
+
defaultMessage: [{
|
|
1402
|
+
"type": 0,
|
|
1403
|
+
"value": "Description"
|
|
1404
|
+
}]
|
|
1405
|
+
})
|
|
1406
|
+
}, {
|
|
1407
|
+
name: 'introBackground',
|
|
1408
|
+
type: 'background',
|
|
1409
|
+
label: defineMessage({
|
|
1410
|
+
id: "cDj1mZ",
|
|
1411
|
+
defaultMessage: [{
|
|
1412
|
+
"type": 0,
|
|
1413
|
+
"value": "Background"
|
|
1414
|
+
}]
|
|
1415
|
+
})
|
|
1416
|
+
}]
|
|
1417
|
+
}, {
|
|
1418
|
+
id: 'questions',
|
|
1419
|
+
label: defineMessage({
|
|
1420
|
+
id: "VMd1oG",
|
|
1421
|
+
defaultMessage: [{
|
|
1422
|
+
"type": 0,
|
|
1423
|
+
"value": "Questions"
|
|
1424
|
+
}]
|
|
1425
|
+
}),
|
|
1426
|
+
repeatable: true,
|
|
1427
|
+
fieldName: 'questions',
|
|
1428
|
+
fields: [{
|
|
1429
|
+
name: 'text',
|
|
1430
|
+
type: 'heading-element',
|
|
1431
|
+
theme: {
|
|
1432
|
+
textStyle: 'heading2'
|
|
1433
|
+
},
|
|
1434
|
+
label: defineMessage({
|
|
1435
|
+
id: "hVE7TA",
|
|
1436
|
+
defaultMessage: [{
|
|
1437
|
+
"type": 0,
|
|
1438
|
+
"value": "Question"
|
|
1439
|
+
}]
|
|
1440
|
+
})
|
|
1441
|
+
}, {
|
|
1442
|
+
name: 'answers',
|
|
1443
|
+
type: 'quiz-points-answers',
|
|
1444
|
+
theme: {
|
|
1445
|
+
label: {
|
|
1446
|
+
textStyle: 'button'
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
label: defineMessage({
|
|
1450
|
+
id: "KHWeV7",
|
|
1451
|
+
defaultMessage: [{
|
|
1452
|
+
"type": 0,
|
|
1453
|
+
"value": "Answers"
|
|
1454
|
+
}]
|
|
1455
|
+
})
|
|
1456
|
+
}, {
|
|
1457
|
+
name: 'background',
|
|
1458
|
+
type: 'background',
|
|
1459
|
+
label: defineMessage({
|
|
1460
|
+
id: "cDj1mZ",
|
|
1461
|
+
defaultMessage: [{
|
|
1462
|
+
"type": 0,
|
|
1463
|
+
"value": "Background"
|
|
1464
|
+
}]
|
|
1465
|
+
})
|
|
1466
|
+
}]
|
|
1467
|
+
}, {
|
|
1468
|
+
id: 'results',
|
|
1469
|
+
label: defineMessage({
|
|
1470
|
+
id: "uiTxd7",
|
|
1471
|
+
defaultMessage: [{
|
|
1472
|
+
"type": 0,
|
|
1473
|
+
"value": "Results"
|
|
1474
|
+
}]
|
|
1475
|
+
}),
|
|
1476
|
+
repeatable: true,
|
|
1477
|
+
fields: [{
|
|
1478
|
+
name: 'layout',
|
|
1479
|
+
type: 'screen-layout',
|
|
1480
|
+
defaultValue: 'top',
|
|
1481
|
+
screenState: 'results',
|
|
1482
|
+
label: defineMessage({
|
|
1483
|
+
id: "4iBXj2",
|
|
1484
|
+
defaultMessage: [{
|
|
1485
|
+
"type": 0,
|
|
1486
|
+
"value": "Layout"
|
|
1487
|
+
}]
|
|
1488
|
+
})
|
|
1489
|
+
}, {
|
|
1490
|
+
name: 'title',
|
|
1491
|
+
type: 'heading-element',
|
|
1492
|
+
theme: {
|
|
1493
|
+
textStyle: 'heading2'
|
|
1494
|
+
},
|
|
1495
|
+
label: defineMessage({
|
|
1496
|
+
id: "+AEVbJ",
|
|
1497
|
+
defaultMessage: [{
|
|
1498
|
+
"type": 0,
|
|
1499
|
+
"value": "Title"
|
|
1500
|
+
}]
|
|
1501
|
+
})
|
|
1502
|
+
}, {
|
|
1503
|
+
name: 'description',
|
|
1504
|
+
type: 'text-element',
|
|
1505
|
+
theme: {
|
|
1506
|
+
textStyle: 'text'
|
|
1507
|
+
},
|
|
1508
|
+
label: defineMessage({
|
|
1509
|
+
id: "ZCe0r4",
|
|
1510
|
+
defaultMessage: [{
|
|
1511
|
+
"type": 0,
|
|
1512
|
+
"value": "Description"
|
|
1513
|
+
}]
|
|
1514
|
+
})
|
|
1515
|
+
}, {
|
|
1516
|
+
name: 'points',
|
|
1517
|
+
type: 'number',
|
|
1518
|
+
isHorizontal: true,
|
|
1519
|
+
label: defineMessage({
|
|
1520
|
+
id: "jWAJW4",
|
|
1521
|
+
defaultMessage: [{
|
|
1522
|
+
"type": 0,
|
|
1523
|
+
"value": "Points"
|
|
1524
|
+
}]
|
|
1525
|
+
})
|
|
1526
|
+
}, {
|
|
1527
|
+
name: 'background',
|
|
1528
|
+
type: 'background',
|
|
1529
|
+
label: defineMessage({
|
|
1530
|
+
id: "cDj1mZ",
|
|
1531
|
+
defaultMessage: [{
|
|
1532
|
+
"type": 0,
|
|
1533
|
+
"value": "Background"
|
|
1534
|
+
}]
|
|
1535
|
+
})
|
|
1536
|
+
}]
|
|
1537
|
+
}],
|
|
1538
|
+
fields: [{
|
|
1539
|
+
name: 'layout',
|
|
1540
|
+
type: 'screen-layout',
|
|
1541
|
+
defaultValue: 'top',
|
|
1542
|
+
label: defineMessage({
|
|
1543
|
+
id: "OPxJx/",
|
|
1544
|
+
defaultMessage: [{
|
|
1545
|
+
"type": 0,
|
|
1546
|
+
"value": "Layout"
|
|
1547
|
+
}]
|
|
1548
|
+
})
|
|
1549
|
+
}, {
|
|
1550
|
+
type: 'fields',
|
|
1551
|
+
label: defineMessage({
|
|
1552
|
+
id: "LOknw0",
|
|
1553
|
+
defaultMessage: [{
|
|
1554
|
+
"type": 0,
|
|
1555
|
+
"value": "Styles"
|
|
1556
|
+
}]
|
|
1557
|
+
}),
|
|
1558
|
+
isList: true,
|
|
1559
|
+
fields: [{
|
|
1560
|
+
name: 'buttonsStyle',
|
|
1561
|
+
type: 'box-style',
|
|
1562
|
+
label: defineMessage({
|
|
1563
|
+
id: "l5uLMd",
|
|
1564
|
+
defaultMessage: [{
|
|
1565
|
+
"type": 0,
|
|
1566
|
+
"value": "Buttons"
|
|
1567
|
+
}]
|
|
1568
|
+
})
|
|
1569
|
+
}]
|
|
1570
|
+
}, {
|
|
1571
|
+
name: 'background',
|
|
1572
|
+
type: 'background',
|
|
1573
|
+
label: defineMessage({
|
|
1574
|
+
id: "cDj1mZ",
|
|
1575
|
+
defaultMessage: [{
|
|
1576
|
+
"type": 0,
|
|
1577
|
+
"value": "Background"
|
|
1578
|
+
}]
|
|
1579
|
+
})
|
|
1580
|
+
}, {
|
|
1581
|
+
name: 'callToAction',
|
|
1582
|
+
type: 'call-to-action',
|
|
1583
|
+
theme: {
|
|
1584
|
+
label: {
|
|
1585
|
+
textStyle: 'heading2'
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}]
|
|
1589
|
+
}];
|
|
574
1590
|
|
|
575
1591
|
export { QuizScreen, definition as default };
|