eat-js-sdk 2.0.53 → 2.0.55

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.
@@ -5956,20 +5956,20 @@ function useMCQFeedback(isResultCorrect, isSkipped, resultFeedback) {
5956
5956
  if (isSkipped) {
5957
5957
  return {
5958
5958
  type: "skipped",
5959
- message: resultFeedback || "No answer provided",
5959
+ message: resultFeedback,
5960
5960
  showIcon: true
5961
5961
  };
5962
5962
  }
5963
5963
  if (isResultCorrect) {
5964
5964
  return {
5965
5965
  type: "correct",
5966
- message: resultFeedback || "Correct answer!",
5966
+ message: resultFeedback,
5967
5967
  showIcon: true
5968
5968
  };
5969
5969
  }
5970
5970
  return {
5971
5971
  type: "incorrect",
5972
- message: resultFeedback || "Incorrect answer",
5972
+ message: resultFeedback,
5973
5973
  showIcon: true
5974
5974
  };
5975
5975
  }
@@ -9680,9 +9680,9 @@ const createMCQInteraction = (config, sessionData) => {
9680
9680
  const generateMCQFeedback = (selected, correct) => {
9681
9681
  const { correct: correctCount, incorrect: incorrectCount, total } = calculateMCQScore(selected, correct);
9682
9682
  if (correctCount === total && incorrectCount === 0) {
9683
- return config.feedback.correct || "Excellent! All correct answers selected.";
9683
+ return config.feedback.correct;
9684
9684
  }
9685
- return config.feedback.incorrect || "Please review your selections and try again.";
9685
+ return config.feedback.incorrect;
9686
9686
  };
9687
9687
  return {
9688
9688
  type: "mcq",
@@ -11513,12 +11513,12 @@ const createTypeInInteraction = (config, sessionData) => {
11513
11513
  const allEmpty = safeAnswers.every((a) => !a || a.trim() === "");
11514
11514
  const isSkipped = allEmpty;
11515
11515
  if (isSkipped) {
11516
- return "No answer provided";
11516
+ return "";
11517
11517
  }
11518
11518
  if (validation.isValid) {
11519
- return config.feedback.correct || "Correct answer";
11519
+ return config.feedback.correct;
11520
11520
  }
11521
- return config.feedback.incorrect || "Incorrect answer";
11521
+ return config.feedback.incorrect;
11522
11522
  };
11523
11523
  return {
11524
11524
  type: "typein",
@@ -17183,18 +17183,18 @@ function useDropdownPosition(config) {
17183
17183
  };
17184
17184
  }
17185
17185
  var root_1$3 = /* @__PURE__ */ from_html(`<div class="absolute inset-0 bg-transparent z-10"></div>`);
17186
- var root_2 = /* @__PURE__ */ from_html(`<div class="bg-black bg-opacity-5 h-full flex flex-none justify-center items-center"><div class="font-semibold text-base leading-[19px] text-charcoal px-3 flex items-center"> </div></div>`);
17186
+ var root_2 = /* @__PURE__ */ from_html(`<div class="bg-black bg-opacity-5 h-full flex flex-none justify-center items-center"><div class="font-semibold text-base leading-[19px] text-charcoal px-3 flex items-center" aria-hidden="true"> </div></div>`);
17187
17187
  var root_3$1 = /* @__PURE__ */ from_html(`<span class="text-green-900 mr-2"><span aria-hidden="true"><!></span> <span class="sr-only">Correct</span></span>`);
17188
17188
  var root_6 = /* @__PURE__ */ from_html(`<span class="text-green-900 mr-2"><span aria-hidden="true"><!></span> <span class="sr-only">Correct</span></span>`);
17189
17189
  var root_7 = /* @__PURE__ */ from_html(`<span class="text-red-900 mr-2"><span aria-hidden="true"><!></span> <span class="sr-only">Incorrect</span></span>`);
17190
- var root_8 = /* @__PURE__ */ from_html(`<span class="flex items-center justify-center text-blue-1000"><span aria-hidden="true"><!></span> <span class="sr-only">Close dropdown</span></span>`);
17191
- var root_9 = /* @__PURE__ */ from_html(`<span class="flex items-center justify-center text-blue-1000"><span aria-hidden="true"><!></span> <span class="sr-only">Open dropdown</span></span>`);
17190
+ var root_8 = /* @__PURE__ */ from_html(`<span class="flex items-center justify-center text-blue-1000"><span aria-hidden="true"><!></span></span>`);
17191
+ var root_9 = /* @__PURE__ */ from_html(`<span class="flex items-center justify-center text-blue-1000"><span aria-hidden="true"><!></span></span>`);
17192
17192
  var root_12 = /* @__PURE__ */ from_html(`<span class="flex items-center text-green-900" aria-hidden="true"><!></span>`);
17193
17193
  var root_14 = /* @__PURE__ */ from_html(`<span class="flex items-center text-red-900" aria-hidden="true"><!></span>`);
17194
17194
  var root_16 = /* @__PURE__ */ from_html(`<span class="flex items-center text-blue-850" aria-hidden="true"><!></span>`);
17195
17195
  var root_11 = /* @__PURE__ */ from_html(`<li role="option" tabindex="-1"><div class="p-0.5 flex justify-between w-full text-base whitespace-normal"><!> <!></div></li>`);
17196
17196
  var root_10 = /* @__PURE__ */ from_html(`<ul class="dropdown-menu block" role="listbox" tabindex="-1"></ul>`);
17197
- var root$1 = /* @__PURE__ */ from_html(`<span class="dropdown inline-block relative align-middle"><span class="sr-only"> </span> <!> <button type="button" aria-haspopup="listbox"><!> <div class="px-4 flex flex-1 min-w-0 align-middle truncate items-center justify-between w-full"><span><!></span> <div class="flex items-center"><!> <!></div></div></button> <!></span>`);
17197
+ var root$1 = /* @__PURE__ */ from_html(`<span class="dropdown inline-block relative align-middle"><span class="sr-only"> </span> <!> <div role="combobox" aria-haspopup="listbox" tabindex="0"><!> <div class="px-4 flex flex-1 min-w-0 align-middle truncate items-center justify-between w-full"><span><!></span> <div class="flex items-center"><!> <!></div></div></div> <!></span>`);
17198
17198
  function DropdownContainer($$anchor, $$props) {
17199
17199
  push($$props, true);
17200
17200
  let dropdownId = prop($$props, "dropdownId", 7), dropdownNumber = prop($$props, "dropdownNumber", 7), options = prop($$props, "options", 7), selected = prop($$props, "selected", 7), correctAnswers = prop($$props, "correctAnswers", 23, () => []), isCorrect = prop($$props, "isCorrect", 7, false), isFinished = prop($$props, "isFinished", 7, false), isLocked = prop($$props, "isLocked", 7, false), isDataSaving = prop($$props, "isDataSaving", 7, false), mode = prop($$props, "mode", 7), showFeedback = prop($$props, "showFeedback", 7, false), showNumbering = prop($$props, "showNumbering", 7, true), onselect = prop($$props, "onselect", 7), viewportBuffer = prop($$props, "viewportBuffer", 7, 60);
@@ -17414,7 +17414,7 @@ function DropdownContainer($$anchor, $$props) {
17414
17414
  }
17415
17415
  removePageExtension();
17416
17416
  });
17417
- const buttonId = `dropdown-button-${dropdownId()}`;
17417
+ const comboId = `dropdown-combo-${dropdownId()}`;
17418
17418
  const listId = `dropdown-list-${dropdownId()}`;
17419
17419
  const labelId = `dropdown-label-${dropdownId()}`;
17420
17420
  const containerClasses = /* @__PURE__ */ user_derived(() => {
@@ -17435,23 +17435,19 @@ function DropdownContainer($$anchor, $$props) {
17435
17435
  return classes.join(" ");
17436
17436
  });
17437
17437
  const ariaLabel = /* @__PURE__ */ user_derived(() => {
17438
- const cleanSelected = useRemoveRichTextHtmlTags(get$1(state$1).selected);
17439
17438
  if (mode() === MODES.PREVIEW) {
17440
17439
  const parts2 = ["Correct answer"];
17441
17440
  if (showNumbering()) parts2.push(`Item number ${dropdownNumber()}`);
17442
- parts2.push(cleanSelected);
17443
17441
  return parts2.filter(Boolean).join(", ");
17444
17442
  }
17445
17443
  if (mode() === MODES.SESSION && isFinished()) {
17446
17444
  const correctness = isCorrect() ? "Correct" : "Incorrect";
17447
17445
  const parts2 = [`Student's answer (${correctness})`];
17448
17446
  if (showNumbering()) parts2.push(`Item number ${dropdownNumber()}`);
17449
- parts2.push(cleanSelected);
17450
17447
  return parts2.filter(Boolean).join(", ");
17451
17448
  }
17452
17449
  const parts = [];
17453
17450
  if (showNumbering()) parts.push(`Item number ${dropdownNumber()}`);
17454
- parts.push(cleanSelected);
17455
17451
  return parts.filter(Boolean).join(", ");
17456
17452
  });
17457
17453
  const getOptionAriaLabel = (option, index2) => {
@@ -17585,35 +17581,35 @@ function DropdownContainer($$anchor, $$props) {
17585
17581
  if (isDataSaving()) $$render(consequent);
17586
17582
  });
17587
17583
  }
17588
- var button = sibling(node, 2);
17589
- button.__keydown = handleKeydown;
17590
- button.__click = () => {
17584
+ var div_1 = sibling(node, 2);
17585
+ div_1.__keydown = handleKeydown;
17586
+ div_1.__click = () => {
17591
17587
  if (isDataSaving() || !get$1(canToggleAccordion)) return;
17592
17588
  get$1(state$1).isOpen ? handleCloseMenu() : handleOpenMenu();
17593
17589
  };
17594
- button.__focusout = handleFocusOut;
17595
- var node_1 = child(button);
17590
+ div_1.__focusout = handleFocusOut;
17591
+ var node_1 = child(div_1);
17596
17592
  {
17597
17593
  var consequent_1 = ($$anchor2) => {
17598
- var div_1 = root_2();
17599
- var div_2 = child(div_1);
17600
- var text_1 = child(div_2, true);
17594
+ var div_2 = root_2();
17595
+ var div_3 = child(div_2);
17596
+ var text_1 = child(div_3, true);
17597
+ reset(div_3);
17601
17598
  reset(div_2);
17602
- reset(div_1);
17603
17599
  template_effect(() => set_text(text_1, dropdownNumber()));
17604
- append($$anchor2, div_1);
17600
+ append($$anchor2, div_2);
17605
17601
  };
17606
17602
  if_block(node_1, ($$render) => {
17607
17603
  if (showNumbering()) $$render(consequent_1);
17608
17604
  });
17609
17605
  }
17610
- var div_3 = sibling(node_1, 2);
17611
- var span_2 = child(div_3);
17606
+ var div_4 = sibling(node_1, 2);
17607
+ var span_2 = child(div_4);
17612
17608
  var node_2 = child(span_2);
17613
17609
  html(node_2, () => get$1(state$1).selected === "" ? DROPDOWN_INTERACTION.PLACEHOLDER : get$1(state$1).selected);
17614
17610
  reset(span_2);
17615
- var div_4 = sibling(span_2, 2);
17616
- var node_3 = child(div_4);
17611
+ var div_5 = sibling(span_2, 2);
17612
+ var node_3 = child(div_5);
17617
17613
  {
17618
17614
  var consequent_2 = ($$anchor2) => {
17619
17615
  var span_3 = root_3$1();
@@ -17688,7 +17684,6 @@ function DropdownContainer($$anchor, $$props) {
17688
17684
  height: 7
17689
17685
  });
17690
17686
  reset(span_10);
17691
- next$1(2);
17692
17687
  reset(span_9);
17693
17688
  append($$anchor2, span_9);
17694
17689
  };
@@ -17703,7 +17698,6 @@ function DropdownContainer($$anchor, $$props) {
17703
17698
  height: 7
17704
17699
  });
17705
17700
  reset(span_12);
17706
- next$1(2);
17707
17701
  reset(span_11);
17708
17702
  append($$anchor2, span_11);
17709
17703
  };
@@ -17712,11 +17706,11 @@ function DropdownContainer($$anchor, $$props) {
17712
17706
  else $$render(alternate_2, false);
17713
17707
  });
17714
17708
  }
17709
+ reset(div_5);
17715
17710
  reset(div_4);
17716
- reset(div_3);
17717
- reset(button);
17718
- bind_this(button, ($$value) => set(buttonRef, $$value), () => get$1(buttonRef));
17719
- var node_12 = sibling(button, 2);
17711
+ reset(div_1);
17712
+ bind_this(div_1, ($$value) => set(buttonRef, $$value), () => get$1(buttonRef));
17713
+ var node_12 = sibling(div_1, 2);
17720
17714
  {
17721
17715
  var consequent_9 = ($$anchor2) => {
17722
17716
  var ul = root_10();
@@ -17732,8 +17726,8 @@ function DropdownContainer($$anchor, $$props) {
17732
17726
  e2.stopPropagation();
17733
17727
  await handleSelect(get$1(option));
17734
17728
  };
17735
- var div_5 = child(li);
17736
- var node_13 = child(div_5);
17729
+ var div_6 = child(li);
17730
+ var node_13 = child(div_6);
17737
17731
  {
17738
17732
  let $0 = /* @__PURE__ */ user_derived(() => get$1(showHoverOption) && get$1(canInteract) ? "hover-option" : "");
17739
17733
  let $1 = /* @__PURE__ */ user_derived(() => get$1(showCurrentOption) ? "current-option" : "");
@@ -17805,7 +17799,7 @@ function DropdownContainer($$anchor, $$props) {
17805
17799
  else $$render(alternate_4, false);
17806
17800
  });
17807
17801
  }
17808
- reset(div_5);
17802
+ reset(div_6);
17809
17803
  reset(li);
17810
17804
  template_effect(() => {
17811
17805
  set_attribute(li, "id", `${listId}-option-${index2}`);
@@ -17822,7 +17816,7 @@ function DropdownContainer($$anchor, $$props) {
17822
17816
  bind_this(ul, ($$value) => set(listRef, $$value), () => get$1(listRef));
17823
17817
  template_effect(() => {
17824
17818
  set_attribute(ul, "id", listId);
17825
- set_attribute(ul, "aria-labelledby", buttonId);
17819
+ set_attribute(ul, "aria-labelledby", comboId);
17826
17820
  });
17827
17821
  append($$anchor2, ul);
17828
17822
  };
@@ -17835,12 +17829,12 @@ function DropdownContainer($$anchor, $$props) {
17835
17829
  template_effect(() => {
17836
17830
  set_attribute(span_1, "id", labelId);
17837
17831
  set_text(text, get$1(ariaLabel));
17838
- set_attribute(button, "id", buttonId);
17839
- set_class(button, 1, clsx(get$1(containerClasses)));
17840
- set_attribute(button, "aria-expanded", get$1(state$1).isOpen);
17841
- set_attribute(button, "aria-labelledby", labelId);
17842
- set_attribute(button, "aria-controls", listId);
17843
- set_attribute(button, "aria-activedescendant", get$1(state$1).activeIndex !== null ? `${listId}-option-${get$1(state$1).activeIndex}` : void 0);
17832
+ set_attribute(div_1, "id", comboId);
17833
+ set_class(div_1, 1, clsx(get$1(containerClasses)));
17834
+ set_attribute(div_1, "aria-expanded", get$1(state$1).isOpen);
17835
+ set_attribute(div_1, "aria-labelledby", labelId);
17836
+ set_attribute(div_1, "aria-controls", listId);
17837
+ set_attribute(div_1, "aria-activedescendant", get$1(state$1).activeIndex !== null ? `${listId}-option-${get$1(state$1).activeIndex}` : void 0);
17844
17838
  set_class(span_2, 1, `truncate mr-2 text-base ${get$1(state$1).selected === DROPDOWN_INTERACTION.PLACEHOLDER || get$1(state$1).selected === "" ? "text-gray-860" : "text-charcoal"}`);
17845
17839
  });
17846
17840
  append($$anchor, span);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eat-js-sdk",
3
- "version": "2.0.53",
4
- "change version": "2.0.0",
3
+ "version": "2.0.55",
4
+ "change version": "2.0.1",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [
7
7
  {