eat-js-sdk 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eat-prompt-builder.mjs +11 -4
- package/package.json +1 -1
|
@@ -6100,10 +6100,17 @@
|
|
|
6100
6100
|
$$invalidate(16, textAriaLabel = `Submitted response is ${resultLabel.toLocaleLowerCase()}`);
|
|
6101
6101
|
$$invalidate(9, placeholder = isResultCorrect ? placeholder : "No answer provided");
|
|
6102
6102
|
};
|
|
6103
|
-
const checkInlineAnswer = (correctAnswer, answer) => {
|
|
6103
|
+
const checkInlineAnswer = (correctAnswer, answer, isAllowMacron, isIgnorePunctuation) => {
|
|
6104
6104
|
const transformedAnswerList = correctAnswer.map((item) => item.map((data) => data.toLowerCase()));
|
|
6105
6105
|
return answer?.map((item, index) => {
|
|
6106
|
-
|
|
6106
|
+
let inlineAnswer = item;
|
|
6107
|
+
if (isAllowMacron) {
|
|
6108
|
+
inlineAnswer = useRemoveDiacritics(inlineAnswer);
|
|
6109
|
+
}
|
|
6110
|
+
if (isIgnorePunctuation) {
|
|
6111
|
+
inlineAnswer = useRemovePunctuation(inlineAnswer);
|
|
6112
|
+
}
|
|
6113
|
+
return transformedAnswerList[index].includes(inlineAnswer.toLowerCase());
|
|
6107
6114
|
});
|
|
6108
6115
|
};
|
|
6109
6116
|
if (isFinished) {
|
|
@@ -6111,14 +6118,14 @@
|
|
|
6111
6118
|
isSkippedAnswer = !hasAnswer;
|
|
6112
6119
|
if (isInlineTypein) {
|
|
6113
6120
|
let metadataAnswer = answer;
|
|
6114
|
-
const { correct_answer: correctAnswer } = interaction;
|
|
6121
|
+
const { correct_answer: correctAnswer, allow_non_macrons_as_correct_answer: allowNonMacrons, ignore_punctuation: ignorePunctuation } = interaction;
|
|
6115
6122
|
if (isPreviewMode) {
|
|
6116
6123
|
inlineTypeinAnswer = answer.map((data) => data[0]);
|
|
6117
6124
|
metadataAnswer = inlineTypeinAnswer;
|
|
6118
6125
|
}
|
|
6119
6126
|
correctAnswerData = correctAnswer;
|
|
6120
6127
|
correctAnswerDataLength = correctAnswer.length;
|
|
6121
|
-
inlineAnswerResult = checkInlineAnswer(correctAnswer, metadataAnswer);
|
|
6128
|
+
inlineAnswerResult = checkInlineAnswer(correctAnswer, metadataAnswer, allowNonMacrons, ignorePunctuation);
|
|
6122
6129
|
} else {
|
|
6123
6130
|
typeinAnswer = answer && hasAnswer ? answer : typeinAnswer;
|
|
6124
6131
|
}
|