eat-js-sdk 2.2.11 → 2.2.12
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.
|
@@ -19339,6 +19339,7 @@ function useSelectableTextState(config, answer, contentfulSegmentIds = []) {
|
|
|
19339
19339
|
const selectedIds = answer.map((a) => a.id);
|
|
19340
19340
|
const isValidating = isInteractiveMode2 && maxSelections > 0 && selectedIds.length >= maxSelections || isSessionMode2 && config.isFinished === true;
|
|
19341
19341
|
const isAllCorrect = isValidating && selectedIds.length === correctAnswerIds.length && selectedIds.every((id) => correctAnswerIds.includes(id));
|
|
19342
|
+
const isSkipped = answer.length === 0;
|
|
19342
19343
|
return {
|
|
19343
19344
|
isPreviewMode: isPreviewMode2,
|
|
19344
19345
|
isInteractiveMode: isInteractiveMode2,
|
|
@@ -19346,13 +19347,14 @@ function useSelectableTextState(config, answer, contentfulSegmentIds = []) {
|
|
|
19346
19347
|
correctAnswerIds,
|
|
19347
19348
|
maxSelections,
|
|
19348
19349
|
isValidating,
|
|
19349
|
-
isAllCorrect
|
|
19350
|
+
isAllCorrect,
|
|
19351
|
+
isSkipped
|
|
19350
19352
|
};
|
|
19351
19353
|
}
|
|
19352
|
-
function useSelectableTextFeedback(isValidating, isAllCorrect, config) {
|
|
19354
|
+
function useSelectableTextFeedback(isValidating, isAllCorrect, isSkipped, config) {
|
|
19353
19355
|
const feedbackType = isAllCorrect ? "correct" : "incorrect";
|
|
19354
19356
|
const feedbackMessage = isValidating ? isAllCorrect ? config.feedback?.correct ?? "" : config.feedback?.incorrect ?? "" : "";
|
|
19355
|
-
const isFeedbackShown = isValidating && feedbackMessage.length > 0;
|
|
19357
|
+
const isFeedbackShown = isValidating && feedbackMessage.length > 0 && !isSkipped;
|
|
19356
19358
|
return { isFeedbackShown, feedbackType, feedbackMessage };
|
|
19357
19359
|
}
|
|
19358
19360
|
var read_methods = ["forEach", "isDisjointFrom", "isSubsetOf", "isSupersetOf"];
|
|
@@ -20077,7 +20079,7 @@ function SelectableTextComponent($$anchor, $$props) {
|
|
|
20077
20079
|
}
|
|
20078
20080
|
let interactionState = /* @__PURE__ */ state(proxy(initialState));
|
|
20079
20081
|
let sharedState = /* @__PURE__ */ user_derived(() => useSelectableTextState(config(), get$1(interactionState).data.answer, contentfulSegmentIds));
|
|
20080
|
-
let feedbackState = /* @__PURE__ */ user_derived(() => useSelectableTextFeedback(get$1(sharedState).isValidating, get$1(sharedState).isAllCorrect, config()));
|
|
20082
|
+
let feedbackState = /* @__PURE__ */ user_derived(() => useSelectableTextFeedback(get$1(sharedState).isValidating, get$1(sharedState).isAllCorrect, get$1(sharedState).isSkipped, config()));
|
|
20081
20083
|
const handleSelection = (event2) => {
|
|
20082
20084
|
const { segmentId } = event2.detail;
|
|
20083
20085
|
const currentAnswer = get$1(interactionState).data.answer;
|