@elice/material-survey 1.240718.0-trasncript.2 → 1.240718.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/markdown-editor/index.d.ts +2 -1
- package/cjs/components/markdown-editor/index.js +10 -19
- package/cjs/components/material-survey/MaterialSurvey.js +57 -82
- package/cjs/components/material-survey/MaterialSurveyInfo.js +59 -69
- package/cjs/components/material-survey/MaterialSurveySelectMultiple.js +90 -131
- package/cjs/components/material-survey/MaterialSurveySelectOne.js +86 -125
- package/cjs/components/material-survey/MaterialSurveyShimmer.js +40 -47
- package/cjs/components/material-survey/MaterialSurveyText.js +75 -114
- package/cjs/components/material-survey/SurveyResultBadge.js +10 -17
- package/cjs/components/material-survey/SurveySubmitStatusText.js +16 -21
- package/cjs/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
- package/cjs/components/material-survey/context/MaterialSurveyContext.js +74 -115
- package/cjs/components/material-survey-edit/MaterialSurveyEdit.js +36 -49
- package/cjs/components/material-survey-edit/MaterialSurveyEditContent.js +91 -113
- package/cjs/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +87 -100
- package/cjs/components/material-survey-edit/context.js +2 -8
- package/cjs/components/material-survey-edit/utils/editValue.js +11 -17
- package/cjs/components/shared/StyledMarkdown.js +1 -5
- package/cjs/components/shared/SurveyContentBox.js +74 -85
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +7 -13
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -24
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +89 -66
- package/cjs/components/shared/question-radio/QuestionRadio.js +7 -13
- package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/cjs/components/shared/question-radio/QuestionRadioContext.js +17 -24
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +80 -59
- package/es/components/markdown-editor/index.d.ts +2 -1
- package/es/components/markdown-editor/index.js +10 -15
- package/es/components/material-survey/MaterialSurvey.js +57 -77
- package/es/components/material-survey/MaterialSurveyInfo.js +59 -65
- package/es/components/material-survey/MaterialSurveySelectMultiple.js +90 -127
- package/es/components/material-survey/MaterialSurveySelectOne.js +86 -121
- package/es/components/material-survey/MaterialSurveyShimmer.js +40 -43
- package/es/components/material-survey/MaterialSurveyText.js +75 -109
- package/es/components/material-survey/SurveyResultBadge.js +10 -13
- package/es/components/material-survey/SurveySubmitStatusText.js +16 -17
- package/es/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
- package/es/components/material-survey/context/MaterialSurveyContext.js +75 -112
- package/es/components/material-survey-edit/MaterialSurveyEdit.js +36 -45
- package/es/components/material-survey-edit/MaterialSurveyEditContent.js +90 -107
- package/es/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +87 -96
- package/es/components/material-survey-edit/context.js +2 -4
- package/es/components/material-survey-edit/utils/editValue.js +11 -17
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/SurveyContentBox.js +74 -81
- package/es/components/shared/question-checkbox/QuestionCheckbox.js +7 -9
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -20
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +89 -61
- package/es/components/shared/question-radio/QuestionRadio.js +7 -9
- package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/es/components/shared/question-radio/QuestionRadioContext.js +17 -20
- package/es/components/shared/question-radio/QuestionRadioOption.js +80 -54
- package/package.json +12 -9
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -399
- package/cjs/components/material-survey/index.js +0 -9
- package/cjs/components/material-survey/locales/index.js +0 -13
- package/cjs/components/material-survey-edit/index.js +0 -7
- package/cjs/components/material-survey-edit/locales/index.js +0 -13
- package/cjs/components/shared/index.js +0 -13
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -386
- package/es/components/material-survey/index.js +0 -2
- package/es/components/material-survey/locales/index.js +0 -4
- package/es/components/material-survey-edit/index.js +0 -1
- package/es/components/material-survey-edit/locales/index.js +0 -4
- package/es/components/shared/index.js +0 -4
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
5
|
var React = require('react');
|
|
8
6
|
var apiClient = require('@elice/api-client');
|
|
9
7
|
var intl = require('@elice/intl');
|
|
@@ -18,61 +16,52 @@ var MaterialSurveyContext = require('./context/MaterialSurveyContext.js');
|
|
|
18
16
|
var SurveyResultBadge = require('./SurveyResultBadge.js');
|
|
19
17
|
var SurveySubmitStatusText = require('./SurveySubmitStatusText.js');
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
24
|
-
|
|
25
|
-
var MaterialSurveySelectMultiple = function MaterialSurveySelectMultiple() {
|
|
19
|
+
const MaterialSurveySelectMultiple = () => {
|
|
26
20
|
var _a;
|
|
27
21
|
// context
|
|
28
|
-
|
|
29
|
-
course
|
|
30
|
-
lecture
|
|
31
|
-
materialSurvey
|
|
32
|
-
userId
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
const {
|
|
23
|
+
course,
|
|
24
|
+
lecture,
|
|
25
|
+
materialSurvey,
|
|
26
|
+
userId
|
|
27
|
+
} = MaterialSurveyContext.useMaterialSurveyState();
|
|
28
|
+
const {
|
|
29
|
+
onSubmit,
|
|
30
|
+
onNext,
|
|
31
|
+
refreshOrgMaterialSurvey
|
|
32
|
+
} = MaterialSurveyContext.useMaterialSurveyDispatch();
|
|
37
33
|
// state
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
setSelectedAnswer = _React$useState2[1];
|
|
43
|
-
var _React$useState3 = React__default.default.useState(),
|
|
44
|
-
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
45
|
-
materialSurveyResponse = _React$useState4[0],
|
|
46
|
-
setMaterialSurveyResponse = _React$useState4[1];
|
|
47
|
-
var _React$useState5 = React__default.default.useState('idle'),
|
|
48
|
-
_React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
|
|
49
|
-
submitStatus = _React$useState6[0],
|
|
50
|
-
setSubmitStatus = _React$useState6[1];
|
|
34
|
+
const intl$1 = intl.useRawEliceIntl();
|
|
35
|
+
const [selectedAnswer, setSelectedAnswer] = React.useState([]);
|
|
36
|
+
const [materialSurveyResponse, setMaterialSurveyResponse] = React.useState();
|
|
37
|
+
const [submitStatus, setSubmitStatus] = React.useState('idle');
|
|
51
38
|
// survey response fetcher
|
|
52
|
-
|
|
39
|
+
React.useEffect(() => {
|
|
53
40
|
if (!userId && (materialSurvey === null || materialSurvey === void 0 ? void 0 : materialSurvey.lastSurveyResponseId)) {
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
const controller = new AbortController();
|
|
42
|
+
const {
|
|
43
|
+
signal
|
|
44
|
+
} = controller;
|
|
56
45
|
apiClient.getOrgMaterialSurveyResponseGet({
|
|
57
46
|
surveyResponseId: materialSurvey.lastSurveyResponseId
|
|
58
47
|
}, {
|
|
59
|
-
signal
|
|
60
|
-
}).then(
|
|
48
|
+
signal
|
|
49
|
+
}).then(response => {
|
|
61
50
|
setMaterialSurveyResponse(response.surveyResponse);
|
|
62
51
|
setSelectedAnswer(response.surveyResponse.answers[0]);
|
|
63
|
-
}).catch(
|
|
52
|
+
}).catch(error => {
|
|
64
53
|
console.error(error);
|
|
65
54
|
});
|
|
66
|
-
return
|
|
67
|
-
return controller.abort();
|
|
68
|
-
};
|
|
55
|
+
return () => controller.abort();
|
|
69
56
|
}
|
|
70
57
|
}, [materialSurvey, userId]);
|
|
71
58
|
// survey response fetcher
|
|
72
|
-
|
|
59
|
+
React.useEffect(() => {
|
|
73
60
|
if (userId && materialSurvey) {
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
const controller = new AbortController();
|
|
62
|
+
const {
|
|
63
|
+
signal
|
|
64
|
+
} = controller;
|
|
76
65
|
apiClient.getOrgMaterialSurveyResponseList({
|
|
77
66
|
materialSurveyId: materialSurvey.id,
|
|
78
67
|
filterUserIds: [userId],
|
|
@@ -81,10 +70,10 @@ var MaterialSurveySelectMultiple = function MaterialSurveySelectMultiple() {
|
|
|
81
70
|
offset: 0,
|
|
82
71
|
count: 1
|
|
83
72
|
}, {
|
|
84
|
-
signal
|
|
85
|
-
}).then(
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
signal
|
|
74
|
+
}).then(response => {
|
|
75
|
+
const surveyResponse = response.surveyResponses[0];
|
|
76
|
+
const getAnswer = () => {
|
|
88
77
|
if (!surveyResponse) {
|
|
89
78
|
return [];
|
|
90
79
|
}
|
|
@@ -98,75 +87,49 @@ var MaterialSurveySelectMultiple = function MaterialSurveySelectMultiple() {
|
|
|
98
87
|
};
|
|
99
88
|
setMaterialSurveyResponse(surveyResponse);
|
|
100
89
|
setSelectedAnswer(getAnswer());
|
|
101
|
-
}).catch(
|
|
90
|
+
}).catch(error => {
|
|
102
91
|
console.error(error);
|
|
103
92
|
});
|
|
104
|
-
return
|
|
105
|
-
return controller.abort();
|
|
106
|
-
};
|
|
93
|
+
return () => controller.abort();
|
|
107
94
|
}
|
|
108
95
|
}, [materialSurvey, userId]);
|
|
109
96
|
// submit handler
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
surveyResponse = _yield$getOrgMaterial.surveyResponse;
|
|
139
|
-
setMaterialSurveyResponse(surveyResponse);
|
|
140
|
-
void refreshOrgMaterialSurvey();
|
|
141
|
-
onSubmit(true);
|
|
142
|
-
setSubmitStatus('resolved');
|
|
143
|
-
_context.next = 23;
|
|
144
|
-
break;
|
|
145
|
-
case 18:
|
|
146
|
-
_context.prev = 18;
|
|
147
|
-
_context.t0 = _context["catch"](3);
|
|
148
|
-
console.error(_context.t0);
|
|
149
|
-
onSubmit(false);
|
|
150
|
-
setSubmitStatus('rejected');
|
|
151
|
-
case 23:
|
|
152
|
-
case "end":
|
|
153
|
-
return _context.stop();
|
|
154
|
-
}
|
|
155
|
-
}, _callee, null, [[3, 18]]);
|
|
156
|
-
}));
|
|
157
|
-
return function handleSubmit() {
|
|
158
|
-
return _ref.apply(this, arguments);
|
|
159
|
-
};
|
|
160
|
-
}();
|
|
161
|
-
return jsxRuntime.jsx(SurveyContentBox.default, {
|
|
97
|
+
const handleSubmit = async () => {
|
|
98
|
+
if (!materialSurvey) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
setSubmitStatus('pending');
|
|
102
|
+
try {
|
|
103
|
+
const {
|
|
104
|
+
surveyResponseId
|
|
105
|
+
} = await apiClient.postOrgMaterialSurveyResponseAdd({
|
|
106
|
+
materialSurveyId: materialSurvey.id,
|
|
107
|
+
answers: [selectedAnswer]
|
|
108
|
+
});
|
|
109
|
+
const {
|
|
110
|
+
surveyResponse
|
|
111
|
+
} = await apiClient.getOrgMaterialSurveyResponseGet({
|
|
112
|
+
surveyResponseId
|
|
113
|
+
});
|
|
114
|
+
setMaterialSurveyResponse(surveyResponse);
|
|
115
|
+
void refreshOrgMaterialSurvey();
|
|
116
|
+
onSubmit(true);
|
|
117
|
+
setSubmitStatus('resolved');
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error(error);
|
|
120
|
+
onSubmit(false);
|
|
121
|
+
setSubmitStatus('rejected');
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
return React.createElement(SurveyContentBox.default, {
|
|
162
125
|
title: intl$1.formatMessage({
|
|
163
126
|
id: 'materialSurvey.myAnswer'
|
|
164
127
|
}),
|
|
165
128
|
onNext: onNext,
|
|
166
|
-
submitResult:
|
|
129
|
+
submitResult: React.createElement(SurveyResultBadge.default, {
|
|
167
130
|
materialSurveyResponse: materialSurveyResponse
|
|
168
131
|
}),
|
|
169
|
-
submitStatus:
|
|
132
|
+
submitStatus: React.createElement(SurveySubmitStatusText.default, {
|
|
170
133
|
status: submitStatus
|
|
171
134
|
}),
|
|
172
135
|
footerActions: [{
|
|
@@ -180,34 +143,30 @@ var MaterialSurveySelectMultiple = function MaterialSurveySelectMultiple() {
|
|
|
180
143
|
children: intl$1.formatMessage({
|
|
181
144
|
id: 'materialSurvey.submit'
|
|
182
145
|
})
|
|
183
|
-
}]
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}, index);
|
|
208
|
-
}) : null
|
|
209
|
-
})
|
|
210
|
-
});
|
|
146
|
+
}]
|
|
147
|
+
}, React.createElement(QuestionCheckbox.default, {
|
|
148
|
+
onSelect: index$1 => {
|
|
149
|
+
if (index.checkUserLectureTestEnded(lecture) || !!userId) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
setSelectedAnswer(prevState => {
|
|
153
|
+
const newState = prevState.includes(index$1) ? prevState.filter(ident => ident !== index$1) : [...prevState, index$1];
|
|
154
|
+
return newState;
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
selectedOptions: selectedAnswer,
|
|
158
|
+
disabled: submitStatus === 'pending' || index.checkUserLectureTestEnded(lecture) || !!userId
|
|
159
|
+
}, (materialSurvey === null || materialSurvey === void 0 ? void 0 : materialSurvey.questionInfoList[0]) ? (_a = materialSurvey.questionInfoList[0].optionInfo) === null || _a === void 0 ? void 0 : _a.map((option, index) => {
|
|
160
|
+
return React.createElement(QuestionCheckboxOption.default, {
|
|
161
|
+
key: index,
|
|
162
|
+
value: index
|
|
163
|
+
}, (course === null || course === void 0 ? void 0 : course.preference.renderMarkdownInSurveyOptions) ? React.createElement(StyledMarkdown.default, {
|
|
164
|
+
dark: false,
|
|
165
|
+
children: option,
|
|
166
|
+
paddingx: 0,
|
|
167
|
+
paddingy: 0
|
|
168
|
+
}) : option);
|
|
169
|
+
}) : null));
|
|
211
170
|
};
|
|
212
171
|
|
|
213
172
|
exports.default = MaterialSurveySelectMultiple;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
5
|
var React = require('react');
|
|
8
6
|
var apiClient = require('@elice/api-client');
|
|
9
7
|
var intl = require('@elice/intl');
|
|
@@ -18,60 +16,51 @@ var MaterialSurveyContext = require('./context/MaterialSurveyContext.js');
|
|
|
18
16
|
var SurveyResultBadge = require('./SurveyResultBadge.js');
|
|
19
17
|
var SurveySubmitStatusText = require('./SurveySubmitStatusText.js');
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
24
|
-
|
|
25
|
-
var MaterialSurveySelectOne = function MaterialSurveySelectOne() {
|
|
19
|
+
const MaterialSurveySelectOne = () => {
|
|
26
20
|
// context
|
|
27
|
-
|
|
28
|
-
course
|
|
29
|
-
lecture
|
|
30
|
-
materialSurvey
|
|
31
|
-
userId
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
const {
|
|
22
|
+
course,
|
|
23
|
+
lecture,
|
|
24
|
+
materialSurvey,
|
|
25
|
+
userId
|
|
26
|
+
} = MaterialSurveyContext.useMaterialSurveyState();
|
|
27
|
+
const {
|
|
28
|
+
onSubmit,
|
|
29
|
+
onNext,
|
|
30
|
+
refreshOrgMaterialSurvey
|
|
31
|
+
} = MaterialSurveyContext.useMaterialSurveyDispatch();
|
|
36
32
|
// state
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
setSelectedAnswer = _React$useState2[1];
|
|
42
|
-
var _React$useState3 = React__default.default.useState(),
|
|
43
|
-
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
44
|
-
materialSurveyResponse = _React$useState4[0],
|
|
45
|
-
setMaterialSurveyResponse = _React$useState4[1];
|
|
46
|
-
var _React$useState5 = React__default.default.useState('idle'),
|
|
47
|
-
_React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
|
|
48
|
-
submitStatus = _React$useState6[0],
|
|
49
|
-
setSubmitStatus = _React$useState6[1];
|
|
33
|
+
const intl$1 = intl.useRawEliceIntl();
|
|
34
|
+
const [selectedAnswer, setSelectedAnswer] = React.useState();
|
|
35
|
+
const [materialSurveyResponse, setMaterialSurveyResponse] = React.useState();
|
|
36
|
+
const [submitStatus, setSubmitStatus] = React.useState('idle');
|
|
50
37
|
// survey response fetcher
|
|
51
|
-
|
|
38
|
+
React.useEffect(() => {
|
|
52
39
|
if (!userId && (materialSurvey === null || materialSurvey === void 0 ? void 0 : materialSurvey.lastSurveyResponseId)) {
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
const controller = new AbortController();
|
|
41
|
+
const {
|
|
42
|
+
signal
|
|
43
|
+
} = controller;
|
|
55
44
|
apiClient.getOrgMaterialSurveyResponseGet({
|
|
56
45
|
surveyResponseId: materialSurvey.lastSurveyResponseId
|
|
57
46
|
}, {
|
|
58
|
-
signal
|
|
59
|
-
}).then(
|
|
47
|
+
signal
|
|
48
|
+
}).then(response => {
|
|
60
49
|
setMaterialSurveyResponse(response.surveyResponse);
|
|
61
50
|
setSelectedAnswer(typeof response.surveyResponse.answers[0] === 'string' ? undefined : response.surveyResponse.answers[0][0]);
|
|
62
|
-
}).catch(
|
|
51
|
+
}).catch(error => {
|
|
63
52
|
console.error(error);
|
|
64
53
|
});
|
|
65
|
-
return
|
|
66
|
-
return controller.abort();
|
|
67
|
-
};
|
|
54
|
+
return () => controller.abort();
|
|
68
55
|
}
|
|
69
56
|
}, [materialSurvey, userId]);
|
|
70
57
|
// survey response fetcher
|
|
71
|
-
|
|
58
|
+
React.useEffect(() => {
|
|
72
59
|
if (userId && materialSurvey) {
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
const controller = new AbortController();
|
|
61
|
+
const {
|
|
62
|
+
signal
|
|
63
|
+
} = controller;
|
|
75
64
|
apiClient.getOrgMaterialSurveyResponseList({
|
|
76
65
|
materialSurveyId: materialSurvey.id,
|
|
77
66
|
filterUserIds: [userId],
|
|
@@ -80,81 +69,55 @@ var MaterialSurveySelectOne = function MaterialSurveySelectOne() {
|
|
|
80
69
|
offset: 0,
|
|
81
70
|
count: 1
|
|
82
71
|
}, {
|
|
83
|
-
signal
|
|
84
|
-
}).then(
|
|
72
|
+
signal
|
|
73
|
+
}).then(response => {
|
|
85
74
|
var _a;
|
|
86
|
-
|
|
75
|
+
const surveyResponse = response.surveyResponses[0];
|
|
87
76
|
setMaterialSurveyResponse(surveyResponse);
|
|
88
77
|
setSelectedAnswer(typeof (surveyResponse === null || surveyResponse === void 0 ? void 0 : surveyResponse.answers[0]) === 'string' ? undefined : (_a = surveyResponse === null || surveyResponse === void 0 ? void 0 : surveyResponse.answers[0][0]) !== null && _a !== void 0 ? _a : undefined);
|
|
89
|
-
}).catch(
|
|
78
|
+
}).catch(error => {
|
|
90
79
|
console.error(error);
|
|
91
80
|
});
|
|
92
|
-
return
|
|
93
|
-
return controller.abort();
|
|
94
|
-
};
|
|
81
|
+
return () => controller.abort();
|
|
95
82
|
}
|
|
96
83
|
}, [materialSurvey, userId]);
|
|
97
84
|
// submit handler
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
surveyResponse = _yield$getOrgMaterial.surveyResponse;
|
|
127
|
-
setMaterialSurveyResponse(surveyResponse);
|
|
128
|
-
void refreshOrgMaterialSurvey();
|
|
129
|
-
onSubmit(true);
|
|
130
|
-
setSubmitStatus('resolved');
|
|
131
|
-
_context.next = 23;
|
|
132
|
-
break;
|
|
133
|
-
case 18:
|
|
134
|
-
_context.prev = 18;
|
|
135
|
-
_context.t0 = _context["catch"](3);
|
|
136
|
-
console.error(_context.t0);
|
|
137
|
-
onSubmit(false);
|
|
138
|
-
setSubmitStatus('rejected');
|
|
139
|
-
case 23:
|
|
140
|
-
case "end":
|
|
141
|
-
return _context.stop();
|
|
142
|
-
}
|
|
143
|
-
}, _callee, null, [[3, 18]]);
|
|
144
|
-
}));
|
|
145
|
-
return function handleSubmit() {
|
|
146
|
-
return _ref.apply(this, arguments);
|
|
147
|
-
};
|
|
148
|
-
}();
|
|
149
|
-
return jsxRuntime.jsx(SurveyContentBox.default, {
|
|
85
|
+
const handleSubmit = async () => {
|
|
86
|
+
if (!materialSurvey || selectedAnswer === undefined) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
setSubmitStatus('pending');
|
|
90
|
+
try {
|
|
91
|
+
const {
|
|
92
|
+
surveyResponseId
|
|
93
|
+
} = await apiClient.postOrgMaterialSurveyResponseAdd({
|
|
94
|
+
materialSurveyId: materialSurvey.id,
|
|
95
|
+
answers: [[selectedAnswer]]
|
|
96
|
+
});
|
|
97
|
+
const {
|
|
98
|
+
surveyResponse
|
|
99
|
+
} = await apiClient.getOrgMaterialSurveyResponseGet({
|
|
100
|
+
surveyResponseId
|
|
101
|
+
});
|
|
102
|
+
setMaterialSurveyResponse(surveyResponse);
|
|
103
|
+
void refreshOrgMaterialSurvey();
|
|
104
|
+
onSubmit(true);
|
|
105
|
+
setSubmitStatus('resolved');
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error(error);
|
|
108
|
+
onSubmit(false);
|
|
109
|
+
setSubmitStatus('rejected');
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
return React.createElement(SurveyContentBox.default, {
|
|
150
113
|
title: intl$1.formatMessage({
|
|
151
114
|
id: 'materialSurvey.myAnswer'
|
|
152
115
|
}),
|
|
153
116
|
onNext: onNext,
|
|
154
|
-
submitStatus:
|
|
117
|
+
submitStatus: React.createElement(SurveySubmitStatusText.default, {
|
|
155
118
|
status: submitStatus
|
|
156
119
|
}),
|
|
157
|
-
submitResult:
|
|
120
|
+
submitResult: React.createElement(SurveyResultBadge.default, {
|
|
158
121
|
materialSurveyResponse: materialSurveyResponse
|
|
159
122
|
}),
|
|
160
123
|
footerActions: [{
|
|
@@ -168,29 +131,27 @@ var MaterialSurveySelectOne = function MaterialSurveySelectOne() {
|
|
|
168
131
|
children: intl$1.formatMessage({
|
|
169
132
|
id: 'materialSurvey.submit'
|
|
170
133
|
})
|
|
171
|
-
}]
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
})
|
|
193
|
-
});
|
|
134
|
+
}]
|
|
135
|
+
}, React.createElement(QuestionRadio.default, {
|
|
136
|
+
selectedValue: selectedAnswer,
|
|
137
|
+
onSelect: index$1 => {
|
|
138
|
+
if (index.checkUserLectureTestEnded(lecture) || !!userId) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
setSelectedAnswer(index$1);
|
|
142
|
+
},
|
|
143
|
+
disabled: submitStatus === 'pending' || index.checkUserLectureTestEnded(lecture) || !!userId
|
|
144
|
+
}, (materialSurvey === null || materialSurvey === void 0 ? void 0 : materialSurvey.questionInfoList[0].optionInfo) ? materialSurvey.questionInfoList[0].optionInfo.map((option, index) => {
|
|
145
|
+
return React.createElement(QuestionRadioOption.default, {
|
|
146
|
+
key: index,
|
|
147
|
+
value: index
|
|
148
|
+
}, (course === null || course === void 0 ? void 0 : course.preference.renderMarkdownInSurveyOptions) ? React.createElement(StyledMarkdown.default, {
|
|
149
|
+
dark: false,
|
|
150
|
+
children: option,
|
|
151
|
+
paddingx: 0,
|
|
152
|
+
paddingy: 0
|
|
153
|
+
}) : option);
|
|
154
|
+
}) : null));
|
|
194
155
|
};
|
|
195
156
|
|
|
196
157
|
exports.default = MaterialSurveySelectOne;
|
|
@@ -2,63 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var blocks = require('@elice/blocks');
|
|
7
7
|
var designTokens = require('@elice/design-tokens');
|
|
8
8
|
var styled = require('styled-components');
|
|
9
9
|
var MaterialSurveyContext = require('./context/MaterialSurveyContext.js');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
14
|
-
|
|
15
|
-
var StyledShimmer = styled__default.default.div.withConfig({
|
|
11
|
+
const StyledShimmer = styled.div.withConfig({
|
|
16
12
|
componentId: "sc-1gtcofd-0"
|
|
17
|
-
})(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var StyledShimmerHeader = styled__default.default.div.withConfig({
|
|
13
|
+
})(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"], ({
|
|
14
|
+
vertical
|
|
15
|
+
}) => vertical ? '0' : '8px');
|
|
16
|
+
const StyledShimmerHeader = styled.div.withConfig({
|
|
22
17
|
componentId: "sc-1gtcofd-1"
|
|
23
18
|
})(["display:flex;justify-content:space-between;background-color:", ";padding:1rem 1.5rem;height:3.5rem;"], designTokens.base.color.navy6);
|
|
24
|
-
|
|
19
|
+
const StyledShimmerBody = styled.div.withConfig({
|
|
25
20
|
componentId: "sc-1gtcofd-2"
|
|
26
21
|
})(["padding:1.5rem;background-color:", ";overflow-y:auto;height:100%;"], designTokens.base.color.navy7);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
vertical
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})]
|
|
61
|
-
});
|
|
22
|
+
const MaterialSurveyShimmer = () => {
|
|
23
|
+
const {
|
|
24
|
+
vertical
|
|
25
|
+
} = MaterialSurveyContext.useMaterialSurveyState();
|
|
26
|
+
return React.createElement(StyledShimmer, {
|
|
27
|
+
vertical: vertical
|
|
28
|
+
}, React.createElement(StyledShimmerHeader, null), React.createElement(StyledShimmerBody, null, React.createElement(blocks.Shimmer, {
|
|
29
|
+
dark: true,
|
|
30
|
+
borderRadius: '4px',
|
|
31
|
+
width: "80%",
|
|
32
|
+
height: '40px'
|
|
33
|
+
}), React.createElement(blocks.Vspace, {
|
|
34
|
+
height: 1
|
|
35
|
+
}), React.createElement(blocks.Shimmer, {
|
|
36
|
+
dark: true,
|
|
37
|
+
borderRadius: '4px',
|
|
38
|
+
width: "100%",
|
|
39
|
+
height: '40px'
|
|
40
|
+
}), React.createElement(blocks.Vspace, {
|
|
41
|
+
height: 1
|
|
42
|
+
}), React.createElement(blocks.Shimmer, {
|
|
43
|
+
dark: true,
|
|
44
|
+
borderRadius: '4px',
|
|
45
|
+
width: "100%",
|
|
46
|
+
height: '40px'
|
|
47
|
+
}), React.createElement(blocks.Vspace, {
|
|
48
|
+
height: 1
|
|
49
|
+
}), React.createElement(blocks.Shimmer, {
|
|
50
|
+
dark: true,
|
|
51
|
+
borderRadius: '4px',
|
|
52
|
+
width: "100%",
|
|
53
|
+
height: '40px'
|
|
54
|
+
})));
|
|
62
55
|
};
|
|
63
56
|
|
|
64
57
|
exports.default = MaterialSurveyShimmer;
|