@pie-element/explicit-constructed-response 10.1.1-next.4 → 10.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [10.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@10.1.1-next.5...@pie-element/explicit-constructed-response@10.2.0-next.0) (2026-03-18)
7
+
8
+ ### Bug Fixes
9
+
10
+ - test snapshots ([27e730e](https://github.com/pie-framework/pie-elements/commit/27e730e2f5a597270abe1f85e7cb17758a49013d))
11
+
12
+ ### Features
13
+
14
+ - **explicit-constructed-response:** add scoring trace in outcome function result PD-5449. Fix some rendering issues in player ([8cdcc8f](https://github.com/pie-framework/pie-elements/commit/8cdcc8f691aa58a815949026cf5d228f3ee5470f))
15
+
16
+ ## [10.1.1-next.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@10.1.1-next.4...@pie-element/explicit-constructed-response@10.1.1-next.5) (2026-03-12)
17
+
18
+ ### Bug Fixes
19
+
20
+ - bump libs, update mathquill, switch interface PD-5791 ([686a7c0](https://github.com/pie-framework/pie-elements/commit/686a7c0d41ff82f5ddad7cecd93cc0c18324a81b))
21
+
6
22
  ## [10.1.1-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@10.1.1-next.3...@pie-element/explicit-constructed-response@10.1.1-next.4) (2026-03-09)
7
23
 
8
24
  **Note:** Version bump only for package @pie-element/explicit-constructed-response
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [9.1.1-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@9.1.1-next.3...@pie-element/explicit-constructed-response-configure@9.1.1-next.4) (2026-03-12)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump libs, update mathquill, switch interface PD-5791 ([686a7c0](https://github.com/pie-framework/pie-elements/commit/686a7c0d41ff82f5ddad7cecd93cc0c18324a81b))
11
+
6
12
  ## [9.1.1-next.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@9.1.1-next.2...@pie-element/explicit-constructed-response-configure@9.1.1-next.3) (2026-03-06)
7
13
 
8
14
  **Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/explicit-constructed-response-configure",
3
- "version": "9.1.1-next.3",
3
+ "version": "9.1.1-next.4",
4
4
  "private": true,
5
5
  "main": "lib/index.js",
6
6
  "modue": "src/index.js",
@@ -10,8 +10,8 @@
10
10
  "@mui/icons-material": "^7.3.4",
11
11
  "@mui/material": "^7.3.4",
12
12
  "@pie-framework/pie-configure-events": "^1.3.0",
13
- "@pie-lib/config-ui": "12.2.0-next.13",
14
- "@pie-lib/editable-html-tip-tap": "1.2.0-next.13",
13
+ "@pie-lib/config-ui": "12.2.0-next.17",
14
+ "@pie-lib/editable-html-tip-tap": "1.2.0-next.16",
15
15
  "classnames": "^2.2.6",
16
16
  "debug": "^4.1.1",
17
17
  "lodash-es": "^4.17.23",
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [7.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-controller@7.1.1-next.1...@pie-element/explicit-constructed-response-controller@7.2.0-next.0) (2026-03-18)
7
+
8
+ ### Features
9
+
10
+ - **explicit-constructed-response:** add scoring trace in outcome function result PD-5449. Fix some rendering issues in player ([8cdcc8f](https://github.com/pie-framework/pie-elements/commit/8cdcc8f691aa58a815949026cf5d228f3ee5470f))
11
+
6
12
  ## [7.1.1-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-controller@7.1.0-next.2...@pie-element/explicit-constructed-response-controller@7.1.1-next.1) (2026-02-26)
7
13
 
8
14
  **Note:** Version bump only for package @pie-element/explicit-constructed-response-controller
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.getScore = exports.createCorrectResponseSession = void 0;
7
+ exports.getScore = exports.getLogTrace = exports.createCorrectResponseSession = void 0;
8
8
  exports.model = model;
9
9
  exports.normalize = void 0;
10
10
  exports.outcome = outcome;
@@ -184,6 +184,69 @@ const getScore = (config, session) => {
184
184
  return parseFloat(str);
185
185
  };
186
186
 
187
+ /**
188
+ * Generates detailed trace log for scoring evaluation
189
+ * @param {Object} model - the question model
190
+ * @param {Object} session - the student session
191
+ * @param {Object} env - the environment
192
+ * @returns {Array} traceLog - array of trace messages
193
+ */
194
+ exports.getScore = getScore;
195
+ const getLogTrace = (model, session, env) => {
196
+ const traceLog = [];
197
+ const {
198
+ value
199
+ } = session || {};
200
+ const {
201
+ choices,
202
+ markup
203
+ } = model || {};
204
+ const responseAreas = markup ? markup.match(/\{\{(.+?)\}\}/g) : [];
205
+ const totalAreas = responseAreas ? responseAreas.length : 0;
206
+ traceLog.push(`${totalAreas} response area(s) defined in this question.`);
207
+ if (value && Object.keys(value).length > 0) {
208
+ const filledAreas = Object.entries(value).filter(([key, val]) => val && val.trim()).length;
209
+ traceLog.push(`Student filled ${filledAreas} out of ${totalAreas} response area(s).`);
210
+ Object.keys(choices || {}).forEach(areaKey => {
211
+ const studentAnswer = value && value[areaKey] || '';
212
+ const correctOptions = choices[areaKey] || [];
213
+ const isCorrect = !(0, _lodashEs.isEmpty)(studentAnswer.trim()) && correctOptions.some(option => prepareVal(option.label) === prepareVal(studentAnswer));
214
+ if (studentAnswer.trim()) {
215
+ traceLog.push(`Response area ${parseInt(areaKey) + 1}: ${isCorrect ? 'CORRECT' : 'INCORRECT'}.`);
216
+ } else {
217
+ traceLog.push(`Response area ${parseInt(areaKey) + 1}: left empty.`);
218
+ }
219
+ });
220
+ } else {
221
+ traceLog.push('Student did not fill any response areas.');
222
+ }
223
+ const hasAlternates = Object.values(choices || {}).some(optionArray => optionArray.length > 1);
224
+ if (hasAlternates) {
225
+ traceLog.push(`Alternate answers are accepted for some response areas.`);
226
+ }
227
+ const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
228
+ if (partialScoringEnabled) {
229
+ traceLog.push(`Score calculated using partial scoring.`);
230
+ traceLog.push(`Student receives credit for each correctly filled response area.`);
231
+ if (value && Object.keys(value).length > 0) {
232
+ let correctCount = 0;
233
+ Object.keys(choices || {}).forEach(areaKey => {
234
+ const studentAnswer = value && value[areaKey] || '';
235
+ const correctOptions = choices[areaKey] || [];
236
+ const isCorrect = !(0, _lodashEs.isEmpty)(studentAnswer.trim()) && correctOptions.some(option => prepareVal(option.label) === prepareVal(studentAnswer));
237
+ if (isCorrect) correctCount++;
238
+ });
239
+ traceLog.push(`Partial scoring: ${correctCount} correct out of ${totalAreas} response areas.`);
240
+ }
241
+ } else {
242
+ traceLog.push(`Score calculated using all-or-nothing scoring.`);
243
+ traceLog.push(`Student must fill all response areas correctly to receive full credit.`);
244
+ }
245
+ const score = getScore(model, session);
246
+ traceLog.push(`Score: ${score}.`);
247
+ return traceLog;
248
+ };
249
+
187
250
  /**
188
251
  * The score is partial by default for checkbox mode, allOrNothing for radio mode.
189
252
  * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =
@@ -195,15 +258,25 @@ const getScore = (config, session) => {
195
258
  * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides
196
259
  * `model.partialScoring`.
197
260
  */
198
- exports.getScore = getScore;
261
+ exports.getLogTrace = getLogTrace;
199
262
  function outcome(model, session, env = {}) {
200
263
  return new Promise(resolve => {
201
- const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
202
- const score = getScore(model, session);
203
- resolve({
204
- score: partialScoringEnabled ? score : score === 1 ? 1 : 0,
205
- empty: (0, _lodashEs.isEmpty)(session)
206
- });
264
+ if (!session || (0, _lodashEs.isEmpty)(session)) {
265
+ resolve({
266
+ score: 0,
267
+ empty: true,
268
+ traceLog: ['Student did not fill any response areas. Score: 0.']
269
+ });
270
+ } else {
271
+ const traceLog = getLogTrace(model, session, env);
272
+ const partialScoringEnabled = _controllerUtils.partialScoring.enabled(model, env);
273
+ const score = getScore(model, session);
274
+ resolve({
275
+ score: partialScoringEnabled ? score : score === 1 ? 1 : 0,
276
+ empty: false,
277
+ traceLog
278
+ });
279
+ }
207
280
  });
208
281
  }
209
282
  const createCorrectResponseSession = (question, env) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_debug","_interopRequireDefault","require","_lodashEs","_he","_controllerUtils","_translator","_defaults","translator","Translator","log","debug","prepareChoice","mode","defaultFeedback","choice","out","label","value","correct","feedbackType","feedback","type","exports","getFeedback","getAdjustedLength","length","Math","abs","Infinity","decodeHtmlEntities","str","replace","normalize","question","defaults","model","session","env","choices","Object","keys","forEach","key","map","item","index","normalizedQuestion","assign","incorrect","prepareChoiceFn","reduce","obj","area","respArea","chosenValue","val","isEmpty","find","c","prepareVal","showNote","values","some","note","t","lng","language","maxLengthPerChoice","maxLengthPerChoiceEnabled","undefinedLengths","labelLengthsArr","max","disabled","displayType","role","markup","playerSpellCheckEnabled","prompt","promptEnabled","rationale","responseCorrect","getScore","undefined","teacherInstructions","responseAreaInputConfiguration","extraCSSRules","rationaleEnabled","teacherInstructionsEnabled","html","decodeHTML","getInnerText","trim","config","responseAreas","match","maxScore","correctCount","total","toFixed","parseFloat","outcome","Promise","resolve","partialScoringEnabled","partialScoring","enabled","score","empty","createCorrectResponseSession","i","id","replaceAll","decode","getContent","validate","maxResponseAreas","allChoicesErrors","errors","field","required","entries","reversedChoices","reverse","choicesErrors","identicalAnswer","slice","nbOfResponseAreas"],"sources":["../src/index.js"],"sourcesContent":["import debug from 'debug';\nimport { find, isEmpty, map, reduce } from 'lodash-es';\nimport { decode } from 'he';\nimport { partialScoring } from '@pie-lib/controller-utils';\nimport Translator from '@pie-lib/translator';\nimport defaults from './defaults';\n\nconst { translator } = Translator;\n\nconst log = debug('explicit-constructed-response:controller');\n\nexport const prepareChoice = (mode, defaultFeedback) => (choice) => {\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (mode === 'evaluate') {\n out.correct = true;\n\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback['correct'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n\n return out;\n};\n\nconst getFeedback = (value) => {\n if (value) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\n// also used in configure/src/markupUtils.js\nconst getAdjustedLength = (length) => {\n if (Math.abs(length) === Infinity) {\n return 2;\n }\n\n if (length <= 2) {\n return length + 2;\n }\n\n if (length <= 4) {\n return length + 3;\n }\n\n if (length <= 6) {\n return length + 4;\n }\n\n return length + 5;\n};\n\n// we can't use the dom parser here because it is not available in the node environment\nconst decodeHtmlEntities = (str) => {\n if (!str) return '';\n return str\n .replace(/&lt;/g, '<')\n .replace(/&gt;/g, '>')\n .replace(/&quot;/g, '\"')\n .replace(/&#x27;|&#39;/g, \"'\")\n .replace(/&amp;/g, '&');\n};\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n // this was added to treat an exception, when the model has choices without\n // the \"value\" property like: { label: 'test' }\n if (question.choices) {\n Object.keys(question.choices).forEach((key) => {\n question.choices[key] = (question.choices[key] || []).map((item, index) => {\n if (!item.value) {\n log('Choice does not contain \"value\" property, which is required.', item);\n return { value: `${index}`, ...item };\n }\n\n return item;\n });\n });\n }\n\n const normalizedQuestion = normalize(question);\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n const prepareChoiceFn = prepareChoice(env.mode, defaultFeedback);\n const choices = reduce(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, prepareChoiceFn);\n\n return obj;\n },\n {},\n );\n\n const { value = {} } = session || {};\n const feedback =\n env.mode === 'evaluate'\n ? reduce(\n normalizedQuestion.choices,\n (obj, respArea, key) => {\n const chosenValue = value && value[key];\n const val = !isEmpty(chosenValue) && find(respArea, (c) => prepareVal(c.label) === prepareVal(chosenValue));\n\n obj[key] = getFeedback(val);\n\n return obj;\n },\n {},\n )\n : {};\n\n // check if at least one choice has an alternate\n const showNote = Object.values(choices).some((choice) => choice?.length > 1);\n const note =\n normalizedQuestion.note ||\n translator.t('common:commonCorrectAnswerWithAlternates', { lng: normalizedQuestion.language });\n\n const { maxLengthPerChoice = [], maxLengthPerChoiceEnabled } = normalizedQuestion;\n const undefinedLengths = !maxLengthPerChoice.length;\n\n // calculate maxLengthPerChoice array if it is not defined or defined incorrectly\n Object.values(choices).forEach((choice, index) => {\n const labelLengthsArr = (choice || []).map((choice) => decodeHtmlEntities(choice.label || '').length);\n const length = Math.max(...labelLengthsArr);\n\n if (\n undefinedLengths ||\n !maxLengthPerChoice[index] ||\n maxLengthPerChoice[index] < length ||\n maxLengthPerChoice[index] > length + 10\n ) {\n maxLengthPerChoice[index] = getAdjustedLength(length);\n }\n });\n\n const out = {\n choices,\n disabled: env.mode !== 'gather',\n displayType: normalizedQuestion.displayType,\n mode: env.mode,\n role: env.role,\n feedback,\n language: normalizedQuestion.language,\n markup: normalizedQuestion.markup,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n note,\n playerSpellCheckEnabled: normalizedQuestion.playerSpellCheckEnabled,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : defaults.prompt,\n rationale: defaults.rationale,\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n showNote,\n teacherInstructions: defaults.teacherInstructions,\n responseAreaInputConfiguration: normalizedQuestion.responseAreaInputConfiguration,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : defaults.rationale;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : defaults.teacherInstructions;\n }\n\n return out;\n}\n\nexport const prepareVal = (html) => {\n return decodeHTML(getInnerText(html).trim());\n};\n\nexport const getScore = (config, session) => {\n const { value } = session || {};\n\n if (!session || isEmpty(session) || !value) {\n return 0;\n }\n\n const responseAreas = config.markup && config.markup.match(/\\{\\{(.+?)\\}\\}/g);\n const maxScore = responseAreas ? responseAreas.length : 0;\n const correctCount = reduce(\n config.choices,\n (total, respArea, key) => {\n const chosenValue = value && value[key];\n\n if (isEmpty(chosenValue) || !find(respArea, (c) => prepareVal(c.label) === prepareVal(chosenValue))) {\n return total;\n }\n\n return total + 1;\n },\n 0,\n );\n\n const str = maxScore ? (correctCount / maxScore).toFixed(2) : 0;\n\n return parseFloat(str);\n};\n\n/**\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const score = getScore(model, session);\n\n resolve({ score: partialScoringEnabled ? score : score === 1 ? 1 : 0, empty: isEmpty(session) });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value = {};\n\n Object.keys(choices).forEach((key, i) => {\n value[i] = choices[key][0].label;\n });\n\n resolve({ id: '1', value });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\n// const getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\nconst getInnerText = (html) => {\n if (typeof html !== 'string') {\n return '';\n }\n if (typeof html.replaceAll === 'function') {\n return html.replaceAll(/<[^>]*>/g, '');\n } else {\n // Polyfill for replaceAll using replace and a global regex\n return html.replace(/<[^>]*>/g, '');\n }\n};\n\nconst decodeHTML = (html) => decode(html);\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices, markup } = model;\n const { maxResponseAreas } = config;\n const allChoicesErrors = {};\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n Object.entries(choices || {}).forEach(([key, values]) => {\n const reversedChoices = [...(values || [])].reverse();\n const choicesErrors = {};\n\n reversedChoices.forEach((choice, index) => {\n const { value, label } = choice;\n\n if (label === '' || label === '<div></div>') {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n });\n\n if (!isEmpty(choicesErrors)) {\n allChoicesErrors[key] = choicesErrors;\n }\n });\n\n const nbOfResponseAreas = (markup.match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreas = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreas = 'There should be at least 1 response area defined.';\n }\n\n if (!isEmpty(allChoicesErrors)) {\n errors.choices = allCho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C;EAEA,OAAOC,MAAM;AACf,CAAC;AAAC/F,OAAA,CAAA4F,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_debug","_interopRequireDefault","require","_lodashEs","_he","_controllerUtils","_translator","_defaults","translator","Translator","log","debug","prepareChoice","mode","defaultFeedback","choice","out","label","value","correct","feedbackType","feedback","type","exports","getFeedback","getAdjustedLength","length","Math","abs","Infinity","decodeHtmlEntities","str","replace","normalize","question","defaults","model","session","env","choices","Object","keys","forEach","key","map","item","index","normalizedQuestion","assign","incorrect","prepareChoiceFn","reduce","obj","area","respArea","chosenValue","val","isEmpty","find","c","prepareVal","showNote","values","some","note","t","lng","language","maxLengthPerChoice","maxLengthPerChoiceEnabled","undefinedLengths","labelLengthsArr","max","disabled","displayType","role","markup","playerSpellCheckEnabled","prompt","promptEnabled","rationale","responseCorrect","getScore","undefined","teacherInstructions","responseAreaInputConfiguration","extraCSSRules","rationaleEnabled","teacherInstructionsEnabled","html","decodeHTML","getInnerText","trim","config","responseAreas","match","maxScore","correctCount","total","toFixed","parseFloat","getLogTrace","traceLog","totalAreas","push","filledAreas","entries","filter","areaKey","studentAnswer","correctOptions","isCorrect","option","parseInt","hasAlternates","optionArray","partialScoringEnabled","partialScoring","enabled","score","outcome","Promise","resolve","empty","createCorrectResponseSession","i","id","replaceAll","decode","getContent","validate","maxResponseAreas","allChoicesErrors","errors","field","required","reversedChoices","reverse","choicesErrors","identicalAnswer","slice","nbOfResponseAreas"],"sources":["../src/index.js"],"sourcesContent":["import debug from 'debug';\nimport { find, isEmpty, map, reduce } from 'lodash-es';\nimport { decode } from 'he';\nimport { partialScoring } from '@pie-lib/controller-utils';\nimport Translator from '@pie-lib/translator';\nimport defaults from './defaults';\n\nconst { translator } = Translator;\n\nconst log = debug('explicit-constructed-response:controller');\n\nexport const prepareChoice = (mode, defaultFeedback) => (choice) => {\n const out = {\n label: choice.label,\n value: choice.value,\n };\n\n if (mode === 'evaluate') {\n out.correct = true;\n\n const feedbackType = (choice.feedback && choice.feedback.type) || 'none';\n\n if (feedbackType === 'default') {\n out.feedback = defaultFeedback['correct'];\n } else if (feedbackType === 'custom') {\n out.feedback = choice.feedback.value;\n }\n }\n\n return out;\n};\n\nconst getFeedback = (value) => {\n if (value) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\n// also used in configure/src/markupUtils.js\nconst getAdjustedLength = (length) => {\n if (Math.abs(length) === Infinity) {\n return 2;\n }\n\n if (length <= 2) {\n return length + 2;\n }\n\n if (length <= 4) {\n return length + 3;\n }\n\n if (length <= 6) {\n return length + 4;\n }\n\n return length + 5;\n};\n\n// we can't use the dom parser here because it is not available in the node environment\nconst decodeHtmlEntities = (str) => {\n if (!str) return '';\n return str\n .replace(/&lt;/g, '<')\n .replace(/&gt;/g, '>')\n .replace(/&quot;/g, '\"')\n .replace(/&#x27;|&#39;/g, \"'\")\n .replace(/&amp;/g, '&');\n};\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n // this was added to treat an exception, when the model has choices without\n // the \"value\" property like: { label: 'test' }\n if (question.choices) {\n Object.keys(question.choices).forEach((key) => {\n question.choices[key] = (question.choices[key] || []).map((item, index) => {\n if (!item.value) {\n log('Choice does not contain \"value\" property, which is required.', item);\n return { value: `${index}`, ...item };\n }\n\n return item;\n });\n });\n }\n\n const normalizedQuestion = normalize(question);\n const defaultFeedback = Object.assign(\n { correct: 'Correct', incorrect: 'Incorrect' },\n normalizedQuestion.defaultFeedback,\n );\n const prepareChoiceFn = prepareChoice(env.mode, defaultFeedback);\n const choices = reduce(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, prepareChoiceFn);\n\n return obj;\n },\n {},\n );\n\n const { value = {} } = session || {};\n const feedback =\n env.mode === 'evaluate'\n ? reduce(\n normalizedQuestion.choices,\n (obj, respArea, key) => {\n const chosenValue = value && value[key];\n const val = !isEmpty(chosenValue) && find(respArea, (c) => prepareVal(c.label) === prepareVal(chosenValue));\n\n obj[key] = getFeedback(val);\n\n return obj;\n },\n {},\n )\n : {};\n\n // check if at least one choice has an alternate\n const showNote = Object.values(choices).some((choice) => choice?.length > 1);\n const note =\n normalizedQuestion.note ||\n translator.t('common:commonCorrectAnswerWithAlternates', { lng: normalizedQuestion.language });\n\n const { maxLengthPerChoice = [], maxLengthPerChoiceEnabled } = normalizedQuestion;\n const undefinedLengths = !maxLengthPerChoice.length;\n\n // calculate maxLengthPerChoice array if it is not defined or defined incorrectly\n Object.values(choices).forEach((choice, index) => {\n const labelLengthsArr = (choice || []).map((choice) => decodeHtmlEntities(choice.label || '').length);\n const length = Math.max(...labelLengthsArr);\n\n if (\n undefinedLengths ||\n !maxLengthPerChoice[index] ||\n maxLengthPerChoice[index] < length ||\n maxLengthPerChoice[index] > length + 10\n ) {\n maxLengthPerChoice[index] = getAdjustedLength(length);\n }\n });\n\n const out = {\n choices,\n disabled: env.mode !== 'gather',\n displayType: normalizedQuestion.displayType,\n mode: env.mode,\n role: env.role,\n feedback,\n language: normalizedQuestion.language,\n markup: normalizedQuestion.markup,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n note,\n playerSpellCheckEnabled: normalizedQuestion.playerSpellCheckEnabled,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : defaults.prompt,\n rationale: defaults.rationale,\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n showNote,\n teacherInstructions: defaults.teacherInstructions,\n responseAreaInputConfiguration: normalizedQuestion.responseAreaInputConfiguration,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : defaults.rationale;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : defaults.teacherInstructions;\n }\n\n return out;\n}\n\nexport const prepareVal = (html) => {\n return decodeHTML(getInnerText(html).trim());\n};\n\nexport const getScore = (config, session) => {\n const { value } = session || {};\n\n if (!session || isEmpty(session) || !value) {\n return 0;\n }\n\n const responseAreas = config.markup && config.markup.match(/\\{\\{(.+?)\\}\\}/g);\n const maxScore = responseAreas ? responseAreas.length : 0;\n const correctCount = reduce(\n config.choices,\n (total, respArea, key) => {\n const chosenValue = value && value[key];\n\n if (isEmpty(chosenValue) || !find(respArea, (c) => prepareVal(c.label) === prepareVal(chosenValue))) {\n return total;\n }\n\n return total + 1;\n },\n 0,\n );\n\n const str = maxScore ? (correctCount / maxScore).toFixed(2) : 0;\n\n return parseFloat(str);\n};\n\n /**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (model, session, env) => {\n const traceLog = [];\n const { value } = session || {};\n const { choices, markup } = model || {};\n \n const responseAreas = markup ? markup.match(/\\{\\{(.+?)\\}\\}/g) : [];\n const totalAreas = responseAreas ? responseAreas.length : 0;\n \n traceLog.push(`${totalAreas} response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const filledAreas = Object.entries(value).filter(([key, val]) => val && val.trim()).length;\n traceLog.push(`Student filled ${filledAreas} out of ${totalAreas} response area(s).`);\n \n Object.keys(choices || {}).forEach((areaKey) => {\n const studentAnswer = (value && value[areaKey]) || '';\n const correctOptions = choices[areaKey] || [];\n const isCorrect = !isEmpty(studentAnswer.trim()) && \n correctOptions.some(option => prepareVal(option.label) === prepareVal(studentAnswer));\n \n if (studentAnswer.trim()) {\n traceLog.push(`Response area ${parseInt(areaKey) + 1}: ${isCorrect ? 'CORRECT' : 'INCORRECT'}.`);\n } else {\n traceLog.push(`Response area ${parseInt(areaKey) + 1}: left empty.`);\n }\n });\n } else {\n traceLog.push('Student did not fill any response areas.');\n }\n\n const hasAlternates = Object.values(choices || {}).some(optionArray => optionArray.length > 1);\n if (hasAlternates) {\n traceLog.push(`Alternate answers are accepted for some response areas.`);\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n \n if (partialScoringEnabled) {\n traceLog.push(`Score calculated using partial scoring.`);\n traceLog.push(`Student receives credit for each correctly filled response area.`);\n \n if (value && Object.keys(value).length > 0) {\n let correctCount = 0;\n Object.keys(choices || {}).forEach((areaKey) => {\n const studentAnswer = (value && value[areaKey]) || '';\n const correctOptions = choices[areaKey] || [];\n const isCorrect = !isEmpty(studentAnswer.trim()) && \n correctOptions.some(option => prepareVal(option.label) === prepareVal(studentAnswer));\n if (isCorrect) correctCount++;\n });\n \n traceLog.push(`Partial scoring: ${correctCount} correct out of ${totalAreas} response areas.`);\n }\n } else {\n traceLog.push(`Score calculated using all-or-nothing scoring.`);\n traceLog.push(`Student must fill all response areas correctly to receive full credit.`);\n }\n\n const score = getScore(model, session);\n traceLog.push(`Score: ${score}.`);\n\n return traceLog;\n};\n\n/**\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(model, session, env = {}) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not fill any response areas. Score: 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n const score = getScore(model, session);\n\n resolve({ \n score: partialScoringEnabled ? score : score === 1 ? 1 : 0, \n empty: false,\n traceLog \n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value = {};\n\n Object.keys(choices).forEach((key, i) => {\n value[i] = choices[key][0].label;\n });\n\n resolve({ id: '1', value });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\n// const getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\nconst getInnerText = (html) => {\n if (typeof html !== 'string') {\n return '';\n }\n if (typeof html.replaceAll === 'function') {\n return html.replaceAll(/<[^>]*>/g, '');\n } else {\n // Polyfill for replaceAll using replace and a global regex\n return html.replace(/<[^>]*>/g, '');\n }\n};\n\nconst decodeHTML = (html) => decode(html);\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { choices, markup } = model;\n const { maxResponseAreas } = config;\n const allChoicesErrors = {};\n const errors = {};\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n Object.entries(choices || {}).forEach(([key, values]) => {\n const reversedChoices = [...(values || [])].reverse();\n const choicesErrors = {};\n\n reversedChoices.forEach((choice, index) => {\n const { value, label } = choice;\n\n if (label === '' || label === '<div></div>') {\n choicesErrors[value] = 'Content should not be empty.';\n } else {\n const identicalAnswer = reversedChoices.slice(index + 1).some((c) => c.label === label);\n\n if (identicalAnswer) {\n choicesErrors[value] = 'Content should be unique.';\n }\n }\n });\n\n if (!isEmpty(choicesErrors)) {\n allChoicesErrors[key] = choicesErrors;\n }\n });\n\n const nbOfResponseAreas = (markup.match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreas = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreas = 'There should be at least 1 response area defined.';\n }\n\n if (!isEmpty(allChoicesErrors)) {\n errors.choices = allChoicesErrors;\n }\n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AC,CAAC3B,MAAM,EAAE+B,KAAK,KAAK;MACzC,MAAM;QAAE5B,KAAK;QAAED;MAAM,CAAC,GAAGF,MAAM;MAE/B,IAAIE,KAAK,KAAK,EAAE,IAAIA,KAAK,KAAK,aAAa,EAAE;QAC3CyH,aAAa,CAACxH,KAAK,CAAC,GAAG,8BAA8B;MACvD,CAAC,MAAM;QACL,MAAMyH,eAAe,GAAGH,eAAe,CAACI,KAAK,CAAC9F,KAAK,GAAG,CAAC,CAAC,CAACiB,IAAI,CAAEJ,CAAC,IAAKA,CAAC,CAAC1C,KAAK,KAAKA,KAAK,CAAC;QAEvF,IAAI0H,eAAe,EAAE;UACnBD,aAAa,CAACxH,KAAK,CAAC,GAAG,2BAA2B;QACpD;MACF;IACF,CAAC,CAAC;IAEF,IAAI,CAAC,IAAAuC,iBAAO,EAACiF,aAAa,CAAC,EAAE;MAC3BN,gBAAgB,CAACzF,GAAG,CAAC,GAAG+F,aAAa;IACvC;EACF,CAAC,CAAC;EAEF,MAAMG,iBAAiB,GAAG,CAACjE,MAAM,CAACmB,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAErE,MAAM;EAEvE,IAAImH,iBAAiB,GAAGV,gBAAgB,EAAE;IACxCE,MAAM,CAACvC,aAAa,GAAG,gBAAgBqC,gBAAgB,oCAAoC;EAC7F,CAAC,MAAM,IAAIU,iBAAiB,GAAG,CAAC,EAAE;IAChCR,MAAM,CAACvC,aAAa,GAAG,mDAAmD;EAC5E;EAEA,IAAI,CAAC,IAAArC,iBAAO,EAAC2E,gBAAgB,CAAC,EAAE;IAC9BC,MAAM,CAAC9F,OAAO,GAAG6F,gBAAgB;EACnC;EAEA,OAAOC,MAAM;AACf,CAAC;AAAC9G,OAAA,CAAA2G,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/explicit-constructed-response-controller",
3
3
  "private": true,
4
- "version": "7.1.1-next.1",
4
+ "version": "7.2.0-next.0",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
package/lib/main.js CHANGED
@@ -149,8 +149,8 @@ class Main extends _react.default.Component {
149
149
  }
150
150
  }, teacherInstructionsDiv) : teacherInstructionsDiv), prompt && /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
151
151
  prompt: prompt
152
- }), !alwaysShowCorrect && /*#__PURE__*/_react.default.createElement(_correctAnswerToggle.default, {
153
- show: mode === 'evaluate',
152
+ }), !alwaysShowCorrect && mode === 'evaluate' && /*#__PURE__*/_react.default.createElement(_correctAnswerToggle.default, {
153
+ show: true,
154
154
  toggled: showCorrectAnswer,
155
155
  onToggle: this.toggleShowCorrect,
156
156
  language: language
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_lodashEs","_correctAnswerToggle","_maskMarkup","_renderUi","_styles","_translator","translator","Translator","MainContainer","styled","UiLayout","alwaysShowCorrect","color","text","backgroundColor","background","borderColor","NoteContainer","theme","marginBottom","spacing","CollapsibleContainer","SrOnly","position","left","top","width","height","overflow","Main","React","Component","constructor","args","_defineProperty2","default","showCorrectAnswer","props","maxLengthPerChoice","every","val","_i","arr","onChange","debounce","maxWait","setState","state","getChangeSession","value","changeSession","UNSAFE_componentWillReceiveProps","nextProps","language","note","isEmpty","feedback","isEqual","t","lng","render","animationsDisabled","mode","displayType","role","maxLengthPerChoiceEnabled","playerSpellCheckEnabled","prompt","rationale","showNote","teacherInstructions","responseAreaInputConfiguration","model","extraCSSRules","displayNote","teacherInstructionsDiv","createElement","PreviewPrompt","defaultClassName","rationaleDiv","showRationale","hasText","hasMedia","showTeacherInstructions","style","display","Collapsible","labels","hidden","visible","show","toggled","onToggle","toggleShowCorrect","ConstructedResponse","_extends2","maxLength","adjustedLimit","spellCheck","pluginProps","dangerouslySetInnerHTML","__html","exports","PropTypes","bool","disabled","string","object","markup","array","func","isRequired","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { isEmpty, isEqual, debounce } from 'lodash-es';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { styled } from '@mui/material/styles';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst MainContainer = styled(UiLayout)(({ alwaysShowCorrect }) => ({\n color: color.text(),\n backgroundColor: color.background(),\n ...(alwaysShowCorrect && {\n '& *': {\n borderColor: `${color.text()} !important`,\n },\n }),\n}));\n\nconst NoteContainer = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst CollapsibleContainer = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst SrOnly = styled('h2')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n disabled: PropTypes.bool,\n displayType: PropTypes.string,\n feedback: PropTypes.object,\n language: PropTypes.string,\n markup: PropTypes.string,\n maxLengthPerChoice: PropTypes.array,\n maxLengthPerChoiceEnabled: PropTypes.bool,\n mode: PropTypes.string,\n note: PropTypes.string,\n onChange: PropTypes.func,\n playerSpellCheckEnabled: PropTypes.bool,\n prompt: PropTypes.string,\n rationale: PropTypes.string,\n role: PropTypes.string,\n showNote: PropTypes.bool,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n responseAreaInputConfiguration: PropTypes.object,\n model: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = (maxLengthPerChoice) =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, _i, arr) => val === arr[0] && val === 1)\n ? this.props.onChange\n : debounce(this.props.onChange, 200, { maxWait: 200 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice, language } = this.props;\n let { note } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n note &&\n language &&\n language !== nextProps.language &&\n note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: language })\n ) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextProps.language });\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = (value) => {\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const {\n alwaysShowCorrect,\n animationsDisabled,\n mode,\n displayType,\n role,\n language,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n note,\n playerSpellCheckEnabled,\n prompt,\n rationale,\n showNote,\n teacherInstructions,\n responseAreaInputConfiguration,\n model,\n value,\n } = this.props;\n\n const { extraCSSRules } = model || {};\n const displayNote = (showCorrectAnswer || (mode === 'view' && role === 'instructor')) && showNote && note;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\n );\n\n const rationaleDiv = <PreviewPrompt prompt={rationale} />;\n\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n return (\n <MainContainer\n extraCSSRules={extraCSSRules}\n alwaysShowCorrect={alwaysShowCorrect}\n style={{ display: `${displayType}` }}\n >\n {mode === 'gather' && <SrOnly>Fill in the Blank Question</SrOnly>}\n\n {showTeacherInstructions && (\n <CollapsibleContainer>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </CollapsibleContainer>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n )}\n\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n adjustedLimit={maxLengthPerChoiceEnabled}\n spellCheck={playerSpellCheckEnabled}\n pluginProps={responseAreaInputConfiguration}\n />\n\n {displayNote && <NoteContainer dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <CollapsibleContainer>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>{rationaleDiv}</Collapsible>\n ) : (\n rationaleDiv\n )}\n </CollapsibleContainer>\n )}\n </MainContainer>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,O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AACM,KAAK;EACnC5C,yBAAyB,EAAEsC,kBAAS,CAACC,IAAI;EACzC1C,IAAI,EAAEyC,kBAAS,CAACG,MAAM;EACtBpD,IAAI,EAAEiD,kBAAS,CAACG,MAAM;EACtB/D,QAAQ,EAAE4D,kBAAS,CAACO,IAAI;EACxB5C,uBAAuB,EAAEqC,kBAAS,CAACC,IAAI;EACvCrC,MAAM,EAAEoC,kBAAS,CAACG,MAAM;EACxBtC,SAAS,EAAEmC,kBAAS,CAACG,MAAM;EAC3B1C,IAAI,EAAEuC,kBAAS,CAACG,MAAM;EACtBrC,QAAQ,EAAEkC,kBAAS,CAACC,IAAI;EACxBlC,mBAAmB,EAAEiC,kBAAS,CAACG,MAAM;EACrCzD,KAAK,EAAEsD,kBAAS,CAACI,MAAM;EACvBpC,8BAA8B,EAAEgC,kBAAS,CAACI,MAAM;EAChDnC,KAAK,EAAE+B,kBAAS,CAACI,MAAM,CAACI;AAC1B,CAAC;AAAA,IAAA7E,gBAAA,CAAAC,OAAA,EAvBUN,IAAI,kBAyBO;EACpBoB,KAAK,EAAE,CAAC;AACV,CAAC;AAAA,IAAA+D,QAAA,GAAAV,OAAA,CAAAnE,OAAA,GAgJYN,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_lodashEs","_correctAnswerToggle","_maskMarkup","_renderUi","_styles","_translator","translator","Translator","MainContainer","styled","UiLayout","alwaysShowCorrect","color","text","backgroundColor","background","borderColor","NoteContainer","theme","marginBottom","spacing","CollapsibleContainer","SrOnly","position","left","top","width","height","overflow","Main","React","Component","constructor","args","_defineProperty2","default","showCorrectAnswer","props","maxLengthPerChoice","every","val","_i","arr","onChange","debounce","maxWait","setState","state","getChangeSession","value","changeSession","UNSAFE_componentWillReceiveProps","nextProps","language","note","isEmpty","feedback","isEqual","t","lng","render","animationsDisabled","mode","displayType","role","maxLengthPerChoiceEnabled","playerSpellCheckEnabled","prompt","rationale","showNote","teacherInstructions","responseAreaInputConfiguration","model","extraCSSRules","displayNote","teacherInstructionsDiv","createElement","PreviewPrompt","defaultClassName","rationaleDiv","showRationale","hasText","hasMedia","showTeacherInstructions","style","display","Collapsible","labels","hidden","visible","show","toggled","onToggle","toggleShowCorrect","ConstructedResponse","_extends2","maxLength","adjustedLimit","spellCheck","pluginProps","dangerouslySetInnerHTML","__html","exports","PropTypes","bool","disabled","string","object","markup","array","func","isRequired","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { isEmpty, isEqual, debounce } from 'lodash-es';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { styled } from '@mui/material/styles';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst MainContainer = styled(UiLayout)(({ alwaysShowCorrect }) => ({\n color: color.text(),\n backgroundColor: color.background(),\n ...(alwaysShowCorrect && {\n '& *': {\n borderColor: `${color.text()} !important`,\n },\n }),\n}));\n\nconst NoteContainer = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst CollapsibleContainer = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst SrOnly = styled('h2')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n disabled: PropTypes.bool,\n displayType: PropTypes.string,\n feedback: PropTypes.object,\n language: PropTypes.string,\n markup: PropTypes.string,\n maxLengthPerChoice: PropTypes.array,\n maxLengthPerChoiceEnabled: PropTypes.bool,\n mode: PropTypes.string,\n note: PropTypes.string,\n onChange: PropTypes.func,\n playerSpellCheckEnabled: PropTypes.bool,\n prompt: PropTypes.string,\n rationale: PropTypes.string,\n role: PropTypes.string,\n showNote: PropTypes.bool,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n responseAreaInputConfiguration: PropTypes.object,\n model: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = (maxLengthPerChoice) =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, _i, arr) => val === arr[0] && val === 1)\n ? this.props.onChange\n : debounce(this.props.onChange, 200, { maxWait: 200 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice, language } = this.props;\n let { note } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n note &&\n language &&\n language !== nextProps.language &&\n note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: language })\n ) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextProps.language });\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = (value) => {\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const {\n alwaysShowCorrect,\n animationsDisabled,\n mode,\n displayType,\n role,\n language,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n note,\n playerSpellCheckEnabled,\n prompt,\n rationale,\n showNote,\n teacherInstructions,\n responseAreaInputConfiguration,\n model,\n value,\n } = this.props;\n\n const { extraCSSRules } = model || {};\n const displayNote = (showCorrectAnswer || (mode === 'view' && role === 'instructor')) && showNote && note;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\n );\n\n const rationaleDiv = <PreviewPrompt prompt={rationale} />;\n\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n return (\n <MainContainer\n extraCSSRules={extraCSSRules}\n alwaysShowCorrect={alwaysShowCorrect}\n style={{ display: `${displayType}` }}\n >\n {mode === 'gather' && <SrOnly>Fill in the Blank Question</SrOnly>}\n\n {showTeacherInstructions && (\n <CollapsibleContainer>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </CollapsibleContainer>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n {!alwaysShowCorrect && mode === 'evaluate' && (\n <CorrectAnswerToggle\n show\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n )}\n\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n adjustedLimit={maxLengthPerChoiceEnabled}\n spellCheck={playerSpellCheckEnabled}\n pluginProps={responseAreaInputConfiguration}\n />\n\n {displayNote && <NoteContainer dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <CollapsibleContainer>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>{rationaleDiv}</Collapsible>\n ) : (\n rationaleDiv\n )}\n </CollapsibleContainer>\n )}\n </MainContainer>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA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E0C,kBAAS,CAACC,IAAI;EAClCC,QAAQ,EAAEF,kBAAS,CAACC,IAAI;EACxBzC,WAAW,EAAEwC,kBAAS,CAACG,MAAM;EAC7BlD,QAAQ,EAAE+C,kBAAS,CAACI,MAAM;EAC1BtD,QAAQ,EAAEkD,kBAAS,CAACG,MAAM;EAC1BE,MAAM,EAAEL,kBAAS,CAACG,MAAM;EACxBpE,kBAAkB,EAAEiE,kBAAS,CAACM,KAAK;EACnC5C,yBAAyB,EAAEsC,kBAAS,CAACC,IAAI;EACzC1C,IAAI,EAAEyC,kBAAS,CAACG,MAAM;EACtBpD,IAAI,EAAEiD,kBAAS,CAACG,MAAM;EACtB/D,QAAQ,EAAE4D,kBAAS,CAACO,IAAI;EACxB5C,uBAAuB,EAAEqC,kBAAS,CAACC,IAAI;EACvCrC,MAAM,EAAEoC,kBAAS,CAACG,MAAM;EACxBtC,SAAS,EAAEmC,kBAAS,CAACG,MAAM;EAC3B1C,IAAI,EAAEuC,kBAAS,CAACG,MAAM;EACtBrC,QAAQ,EAAEkC,kBAAS,CAACC,IAAI;EACxBlC,mBAAmB,EAAEiC,kBAAS,CAACG,MAAM;EACrCzD,KAAK,EAAEsD,kBAAS,CAACI,MAAM;EACvBpC,8BAA8B,EAAEgC,kBAAS,CAACI,MAAM;EAChDnC,KAAK,EAAE+B,kBAAS,CAACI,MAAM,CAACI;AAC1B,CAAC;AAAA,IAAA7E,gBAAA,CAAAC,OAAA,EAvBUN,IAAI,kBAyBO;EACpBoB,KAAK,EAAE,CAAC;AACV,CAAC;AAAA,IAAA+D,QAAA,GAAAV,OAAA,CAAAnE,OAAA,GAgJYN,IAAI","ignoreList":[]}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "10.1.1-next.4",
7
+ "version": "10.2.0-next.0",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "postpublish": "../../scripts/postpublish"
@@ -16,7 +16,7 @@
16
16
  "@mui/material": "^7.3.4",
17
17
  "@pie-framework/pie-player-events": "^0.1.0",
18
18
  "@pie-lib/correct-answer-toggle": "3.2.0-next.4",
19
- "@pie-lib/mask-markup": "2.2.0-next.14",
19
+ "@pie-lib/mask-markup": "2.2.0-next.17",
20
20
  "@pie-lib/math-rendering": "4.2.0-next.3",
21
21
  "@pie-lib/render-ui": "5.2.0-next.4",
22
22
  "@pie-lib/translator": "3.2.0-next.3",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "author": "",
31
31
  "license": "ISC",
32
- "gitHead": "16828e25ce0918527cd6082e58e3852038996ec2",
32
+ "gitHead": "d73b4baeb204e75095024baab5dc99182023301e",
33
33
  "main": "lib/index.js",
34
34
  "module": "src/index.js",
35
35
  "exports": {