@micromag/screen-quiz 0.3.241 → 0.3.246
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/es/index.js +17 -31
- package/lib/index.js +16 -30
- package/package.json +13 -13
package/es/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import PropTypes$1 from 'prop-types';
|
|
6
6
|
import React, { useMemo, useState, useEffect, useCallback, useRef } from 'react';
|
|
7
7
|
import { PropTypes } from '@micromag/core';
|
|
8
|
-
import { useScreenRenderContext, useScreenSize, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef,
|
|
8
|
+
import { useScreenRenderContext, useScreenSize, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef, useScreenState } from '@micromag/core/contexts';
|
|
9
9
|
import { useDimensionObserver, useTrackScreenEvent } from '@micromag/core/hooks';
|
|
10
10
|
import { useQuizCreate } from '@micromag/data';
|
|
11
11
|
import Background from '@micromag/element-background';
|
|
@@ -586,15 +586,8 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
586
586
|
userAnswerIndex = _useState2[0],
|
|
587
587
|
setUserAnswerIndex = _useState2[1];
|
|
588
588
|
|
|
589
|
-
var visitor = useVisitor();
|
|
590
|
-
|
|
591
|
-
var _ref3 = visitor || {},
|
|
592
|
-
_ref3$id = _ref3.id,
|
|
593
|
-
visitorId = _ref3$id === void 0 ? null : _ref3$id;
|
|
594
|
-
|
|
595
589
|
var _useQuizCreate = useQuizCreate({
|
|
596
|
-
screenId: screenId
|
|
597
|
-
visitorId: visitorId
|
|
590
|
+
screenId: screenId
|
|
598
591
|
}),
|
|
599
592
|
submitQuiz = _useQuizCreate.create;
|
|
600
593
|
|
|
@@ -616,15 +609,15 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
616
609
|
}, [isEdit, current, userAnswerIndex, setUserAnswerIndex]);
|
|
617
610
|
useEffect(function () {
|
|
618
611
|
if (userAnswerIndex !== null) {
|
|
619
|
-
var
|
|
620
|
-
|
|
621
|
-
isGood =
|
|
622
|
-
|
|
623
|
-
label =
|
|
612
|
+
var _ref3 = userAnswerIndex !== null && answers ? answers[userAnswerIndex] : {},
|
|
613
|
+
_ref3$good = _ref3.good,
|
|
614
|
+
isGood = _ref3$good === void 0 ? false : _ref3$good,
|
|
615
|
+
_ref3$label = _ref3.label,
|
|
616
|
+
label = _ref3$label === void 0 ? {} : _ref3$label;
|
|
624
617
|
|
|
625
|
-
var
|
|
626
|
-
|
|
627
|
-
body =
|
|
618
|
+
var _ref4 = label || {},
|
|
619
|
+
_ref4$body = _ref4.body,
|
|
620
|
+
body = _ref4$body === void 0 ? '' : _ref4$body;
|
|
628
621
|
|
|
629
622
|
submitQuiz({
|
|
630
623
|
choice: body || userAnswerIndex,
|
|
@@ -639,8 +632,8 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
639
632
|
scrolledBottom = _useState4[0],
|
|
640
633
|
setScrolledBottom = _useState4[1];
|
|
641
634
|
|
|
642
|
-
var onScrolledBottom = useCallback(function (
|
|
643
|
-
var initial =
|
|
635
|
+
var onScrolledBottom = useCallback(function (_ref5) {
|
|
636
|
+
var initial = _ref5.initial;
|
|
644
637
|
|
|
645
638
|
if (initial) {
|
|
646
639
|
trackScreenEvent('scroll', 'Screen');
|
|
@@ -1016,7 +1009,7 @@ var defaultProps = {
|
|
|
1016
1009
|
};
|
|
1017
1010
|
|
|
1018
1011
|
var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
1019
|
-
var
|
|
1012
|
+
var _ref12;
|
|
1020
1013
|
|
|
1021
1014
|
var id = _ref.id,
|
|
1022
1015
|
layout = _ref.layout,
|
|
@@ -1214,15 +1207,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1214
1207
|
_ref10$layout = _ref10.layout,
|
|
1215
1208
|
resultLayout = _ref10$layout === void 0 ? null : _ref10$layout;
|
|
1216
1209
|
|
|
1217
|
-
var visitor = useVisitor();
|
|
1218
|
-
|
|
1219
|
-
var _ref11 = visitor || {},
|
|
1220
|
-
_ref11$id = _ref11.id,
|
|
1221
|
-
visitorId = _ref11$id === void 0 ? null : _ref11$id;
|
|
1222
|
-
|
|
1223
1210
|
var _useQuizCreate = useQuizCreate({
|
|
1224
|
-
screenId: screenId
|
|
1225
|
-
visitorId: visitorId
|
|
1211
|
+
screenId: screenId
|
|
1226
1212
|
}),
|
|
1227
1213
|
submitQuiz = _useQuizCreate.create;
|
|
1228
1214
|
|
|
@@ -1288,8 +1274,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1288
1274
|
scrolledBottom = _useState6[0],
|
|
1289
1275
|
setScrolledBottom = _useState6[1];
|
|
1290
1276
|
|
|
1291
|
-
var onScrolledBottom = useCallback(function (
|
|
1292
|
-
var initial =
|
|
1277
|
+
var onScrolledBottom = useCallback(function (_ref11) {
|
|
1278
|
+
var initial = _ref11.initial;
|
|
1293
1279
|
|
|
1294
1280
|
if (initial) {
|
|
1295
1281
|
trackScreenEvent('scroll', 'Screen');
|
|
@@ -1311,7 +1297,7 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1311
1297
|
}
|
|
1312
1298
|
|
|
1313
1299
|
return /*#__PURE__*/React.createElement("div", {
|
|
1314
|
-
className: classNames([styles$2.container, (
|
|
1300
|
+
className: classNames([styles$2.container, (_ref12 = {}, _defineProperty(_ref12, styles$2[direction], direction !== null), _defineProperty(_ref12, className, className !== null), _ref12)]),
|
|
1315
1301
|
"data-screen-ready": true
|
|
1316
1302
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
1317
1303
|
width: width,
|
package/lib/index.js
CHANGED
|
@@ -608,15 +608,8 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
608
608
|
userAnswerIndex = _useState2[0],
|
|
609
609
|
setUserAnswerIndex = _useState2[1];
|
|
610
610
|
|
|
611
|
-
var visitor = contexts.useVisitor();
|
|
612
|
-
|
|
613
|
-
var _ref3 = visitor || {},
|
|
614
|
-
_ref3$id = _ref3.id,
|
|
615
|
-
visitorId = _ref3$id === void 0 ? null : _ref3$id;
|
|
616
|
-
|
|
617
611
|
var _useQuizCreate = data.useQuizCreate({
|
|
618
|
-
screenId: screenId
|
|
619
|
-
visitorId: visitorId
|
|
612
|
+
screenId: screenId
|
|
620
613
|
}),
|
|
621
614
|
submitQuiz = _useQuizCreate.create;
|
|
622
615
|
|
|
@@ -638,15 +631,15 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
638
631
|
}, [isEdit, current, userAnswerIndex, setUserAnswerIndex]);
|
|
639
632
|
React.useEffect(function () {
|
|
640
633
|
if (userAnswerIndex !== null) {
|
|
641
|
-
var
|
|
642
|
-
|
|
643
|
-
isGood =
|
|
644
|
-
|
|
645
|
-
label =
|
|
634
|
+
var _ref3 = userAnswerIndex !== null && answers ? answers[userAnswerIndex] : {},
|
|
635
|
+
_ref3$good = _ref3.good,
|
|
636
|
+
isGood = _ref3$good === void 0 ? false : _ref3$good,
|
|
637
|
+
_ref3$label = _ref3.label,
|
|
638
|
+
label = _ref3$label === void 0 ? {} : _ref3$label;
|
|
646
639
|
|
|
647
|
-
var
|
|
648
|
-
|
|
649
|
-
body =
|
|
640
|
+
var _ref4 = label || {},
|
|
641
|
+
_ref4$body = _ref4.body,
|
|
642
|
+
body = _ref4$body === void 0 ? '' : _ref4$body;
|
|
650
643
|
|
|
651
644
|
submitQuiz({
|
|
652
645
|
choice: body || userAnswerIndex,
|
|
@@ -661,8 +654,8 @@ var QuizScreen = function QuizScreen(_ref) {
|
|
|
661
654
|
scrolledBottom = _useState4[0],
|
|
662
655
|
setScrolledBottom = _useState4[1];
|
|
663
656
|
|
|
664
|
-
var onScrolledBottom = React.useCallback(function (
|
|
665
|
-
var initial =
|
|
657
|
+
var onScrolledBottom = React.useCallback(function (_ref5) {
|
|
658
|
+
var initial = _ref5.initial;
|
|
666
659
|
|
|
667
660
|
if (initial) {
|
|
668
661
|
trackScreenEvent('scroll', 'Screen');
|
|
@@ -1038,7 +1031,7 @@ var defaultProps = {
|
|
|
1038
1031
|
};
|
|
1039
1032
|
|
|
1040
1033
|
var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
1041
|
-
var
|
|
1034
|
+
var _ref12;
|
|
1042
1035
|
|
|
1043
1036
|
var id = _ref.id,
|
|
1044
1037
|
layout = _ref.layout,
|
|
@@ -1236,15 +1229,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1236
1229
|
_ref10$layout = _ref10.layout,
|
|
1237
1230
|
resultLayout = _ref10$layout === void 0 ? null : _ref10$layout;
|
|
1238
1231
|
|
|
1239
|
-
var visitor = contexts.useVisitor();
|
|
1240
|
-
|
|
1241
|
-
var _ref11 = visitor || {},
|
|
1242
|
-
_ref11$id = _ref11.id,
|
|
1243
|
-
visitorId = _ref11$id === void 0 ? null : _ref11$id;
|
|
1244
|
-
|
|
1245
1232
|
var _useQuizCreate = data.useQuizCreate({
|
|
1246
|
-
screenId: screenId
|
|
1247
|
-
visitorId: visitorId
|
|
1233
|
+
screenId: screenId
|
|
1248
1234
|
}),
|
|
1249
1235
|
submitQuiz = _useQuizCreate.create;
|
|
1250
1236
|
|
|
@@ -1310,8 +1296,8 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1310
1296
|
scrolledBottom = _useState6[0],
|
|
1311
1297
|
setScrolledBottom = _useState6[1];
|
|
1312
1298
|
|
|
1313
|
-
var onScrolledBottom = React.useCallback(function (
|
|
1314
|
-
var initial =
|
|
1299
|
+
var onScrolledBottom = React.useCallback(function (_ref11) {
|
|
1300
|
+
var initial = _ref11.initial;
|
|
1315
1301
|
|
|
1316
1302
|
if (initial) {
|
|
1317
1303
|
trackScreenEvent('scroll', 'Screen');
|
|
@@ -1333,7 +1319,7 @@ var QuizMultipleScreen = function QuizMultipleScreen(_ref) {
|
|
|
1333
1319
|
}
|
|
1334
1320
|
|
|
1335
1321
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1336
|
-
className: classNames__default["default"]([styles$2.container, (
|
|
1322
|
+
className: classNames__default["default"]([styles$2.container, (_ref12 = {}, _defineProperty__default["default"](_ref12, styles$2[direction], direction !== null), _defineProperty__default["default"](_ref12, className, className !== null), _ref12)]),
|
|
1337
1323
|
"data-screen-ready": true
|
|
1338
1324
|
}, /*#__PURE__*/React__default["default"].createElement(Container__default["default"], {
|
|
1339
1325
|
width: width,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-quiz",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.246",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
53
53
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
54
54
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
55
|
-
"@micromag/core": "^0.3.
|
|
56
|
-
"@micromag/data": "^0.3.
|
|
57
|
-
"@micromag/element-background": "^0.3.
|
|
58
|
-
"@micromag/element-button": "^0.3.
|
|
59
|
-
"@micromag/element-call-to-action": "^0.3.
|
|
60
|
-
"@micromag/element-container": "^0.3.
|
|
61
|
-
"@micromag/element-heading": "^0.3.
|
|
62
|
-
"@micromag/element-layout": "^0.3.
|
|
63
|
-
"@micromag/element-scroll": "^0.3.
|
|
64
|
-
"@micromag/element-text": "^0.3.
|
|
65
|
-
"@micromag/transforms": "^0.3.
|
|
55
|
+
"@micromag/core": "^0.3.246",
|
|
56
|
+
"@micromag/data": "^0.3.246",
|
|
57
|
+
"@micromag/element-background": "^0.3.246",
|
|
58
|
+
"@micromag/element-button": "^0.3.246",
|
|
59
|
+
"@micromag/element-call-to-action": "^0.3.246",
|
|
60
|
+
"@micromag/element-container": "^0.3.246",
|
|
61
|
+
"@micromag/element-heading": "^0.3.246",
|
|
62
|
+
"@micromag/element-layout": "^0.3.246",
|
|
63
|
+
"@micromag/element-scroll": "^0.3.246",
|
|
64
|
+
"@micromag/element-text": "^0.3.246",
|
|
65
|
+
"@micromag/transforms": "^0.3.246",
|
|
66
66
|
"classnames": "^2.2.6",
|
|
67
67
|
"lodash": "^4.17.21",
|
|
68
68
|
"prop-types": "^15.7.2",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "473a4ad55684e54d3f1e62e760792ed6e003f8e7"
|
|
77
77
|
}
|