eat-js-sdk 1.0.16 → 1.0.17

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.
@@ -5118,7 +5118,7 @@
5118
5118
  child_ctx[63] = i;
5119
5119
  return child_ctx;
5120
5120
  }
5121
- function create_else_block_4(ctx) {
5121
+ function create_else_block_3(ctx) {
5122
5122
  let textarea;
5123
5123
  let textarea_class_value;
5124
5124
  let autosize_action;
@@ -5255,7 +5255,7 @@
5255
5255
  }
5256
5256
  };
5257
5257
  }
5258
- function create_if_block_92(ctx) {
5258
+ function create_if_block_102(ctx) {
5259
5259
  let input;
5260
5260
  let input_class_value;
5261
5261
  let mounted;
@@ -5372,12 +5372,12 @@
5372
5372
  }
5373
5373
  };
5374
5374
  }
5375
- function create_if_block_73(ctx) {
5375
+ function create_if_block_83(ctx) {
5376
5376
  let current_block_type_index;
5377
5377
  let if_block;
5378
5378
  let if_block_anchor;
5379
5379
  let current;
5380
- const if_block_creators = [create_if_block_83, create_else_block_3];
5380
+ const if_block_creators = [create_if_block_92, create_else_block_2];
5381
5381
  const if_blocks = [];
5382
5382
  function select_block_type_1(ctx2, dirty) {
5383
5383
  if (
@@ -5439,7 +5439,7 @@
5439
5439
  }
5440
5440
  };
5441
5441
  }
5442
- function create_else_block_3(ctx) {
5442
+ function create_else_block_2(ctx) {
5443
5443
  let invalidbanner;
5444
5444
  let current;
5445
5445
  invalidbanner = new InvalidBanner_default({
@@ -5471,7 +5471,7 @@
5471
5471
  }
5472
5472
  };
5473
5473
  }
5474
- function create_if_block_83(ctx) {
5474
+ function create_if_block_92(ctx) {
5475
5475
  let div0;
5476
5476
  let commonstringtohtml;
5477
5477
  let t0;
@@ -5555,17 +5555,21 @@
5555
5555
  let if_block2_anchor;
5556
5556
  let current;
5557
5557
  let if_block0 = !/*isInlineTypein*/
5558
- ctx[24] && create_if_block_53(ctx);
5559
- const if_block_creators = [create_if_block_43, create_else_block_1];
5558
+ ctx[24] && create_if_block_63(ctx);
5559
+ const if_block_creators = [create_if_block_43, create_if_block_53];
5560
5560
  const if_blocks = [];
5561
5561
  function select_block_type_3(ctx2, dirty) {
5562
5562
  if (!/*isInlineTypein*/
5563
5563
  ctx2[24])
5564
5564
  return 0;
5565
- return 1;
5565
+ if (!/*isResultCorrect*/
5566
+ ctx2[1])
5567
+ return 1;
5568
+ return -1;
5569
+ }
5570
+ if (~(current_block_type_index = select_block_type_3(ctx, [-1, -1, -1]))) {
5571
+ if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
5566
5572
  }
5567
- current_block_type_index = select_block_type_3(ctx, [-1, -1, -1]);
5568
- if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
5569
5573
  let if_block2 = (
5570
5574
  /*isInlineTypein*/
5571
5575
  ctx[24] && (!/*isPreviewMode*/
@@ -5577,7 +5581,8 @@
5577
5581
  if (if_block0)
5578
5582
  if_block0.c();
5579
5583
  t0 = space();
5580
- if_block1.c();
5584
+ if (if_block1)
5585
+ if_block1.c();
5581
5586
  t1 = space();
5582
5587
  if (if_block2)
5583
5588
  if_block2.c();
@@ -5587,7 +5592,9 @@
5587
5592
  if (if_block0)
5588
5593
  if_block0.m(target, anchor);
5589
5594
  insert(target, t0, anchor);
5590
- if_blocks[current_block_type_index].m(target, anchor);
5595
+ if (~current_block_type_index) {
5596
+ if_blocks[current_block_type_index].m(target, anchor);
5597
+ }
5591
5598
  insert(target, t1, anchor);
5592
5599
  if (if_block2)
5593
5600
  if_block2.m(target, anchor);
@@ -5598,7 +5605,34 @@
5598
5605
  if (!/*isInlineTypein*/
5599
5606
  ctx2[24])
5600
5607
  if_block0.p(ctx2, dirty);
5601
- if_block1.p(ctx2, dirty);
5608
+ let previous_block_index = current_block_type_index;
5609
+ current_block_type_index = select_block_type_3(ctx2, dirty);
5610
+ if (current_block_type_index === previous_block_index) {
5611
+ if (~current_block_type_index) {
5612
+ if_blocks[current_block_type_index].p(ctx2, dirty);
5613
+ }
5614
+ } else {
5615
+ if (if_block1) {
5616
+ group_outros();
5617
+ transition_out(if_blocks[previous_block_index], 1, 1, () => {
5618
+ if_blocks[previous_block_index] = null;
5619
+ });
5620
+ check_outros();
5621
+ }
5622
+ if (~current_block_type_index) {
5623
+ if_block1 = if_blocks[current_block_type_index];
5624
+ if (!if_block1) {
5625
+ if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
5626
+ if_block1.c();
5627
+ } else {
5628
+ if_block1.p(ctx2, dirty);
5629
+ }
5630
+ transition_in(if_block1, 1);
5631
+ if_block1.m(t1.parentNode, t1);
5632
+ } else {
5633
+ if_block1 = null;
5634
+ }
5635
+ }
5602
5636
  if (
5603
5637
  /*isInlineTypein*/
5604
5638
  ctx2[24] && (!/*isPreviewMode*/
@@ -5647,13 +5681,15 @@
5647
5681
  }
5648
5682
  if (if_block0)
5649
5683
  if_block0.d(detaching);
5650
- if_blocks[current_block_type_index].d(detaching);
5684
+ if (~current_block_type_index) {
5685
+ if_blocks[current_block_type_index].d(detaching);
5686
+ }
5651
5687
  if (if_block2)
5652
5688
  if_block2.d(detaching);
5653
5689
  }
5654
5690
  };
5655
5691
  }
5656
- function create_if_block_53(ctx) {
5692
+ function create_if_block_63(ctx) {
5657
5693
  let div;
5658
5694
  let span0;
5659
5695
  let current_block_type_index;
@@ -5664,7 +5700,7 @@
5664
5700
  let t1;
5665
5701
  let div_class_value;
5666
5702
  let current;
5667
- const if_block_creators = [create_if_block_63, create_else_block_2];
5703
+ const if_block_creators = [create_if_block_73, create_else_block_1];
5668
5704
  const if_blocks = [];
5669
5705
  function select_block_type_2(ctx2, dirty) {
5670
5706
  if (
@@ -5752,7 +5788,7 @@
5752
5788
  }
5753
5789
  };
5754
5790
  }
5755
- function create_else_block_2(ctx) {
5791
+ function create_else_block_1(ctx) {
5756
5792
  let errorsolid;
5757
5793
  let current;
5758
5794
  errorsolid = new ErrorSolid_default({});
@@ -5779,7 +5815,7 @@
5779
5815
  }
5780
5816
  };
5781
5817
  }
5782
- function create_if_block_63(ctx) {
5818
+ function create_if_block_73(ctx) {
5783
5819
  let successsolid;
5784
5820
  let current;
5785
5821
  successsolid = new SuccessSolid_default({});
@@ -5806,7 +5842,7 @@
5806
5842
  }
5807
5843
  };
5808
5844
  }
5809
- function create_else_block_1(ctx) {
5845
+ function create_if_block_53(ctx) {
5810
5846
  let promptresultv2;
5811
5847
  let current;
5812
5848
  promptresultv2 = new PromptResultFeedbackv2_default({
@@ -6623,7 +6659,7 @@
6623
6659
  let t2;
6624
6660
  let if_block1_anchor;
6625
6661
  let current;
6626
- const if_block_creators = [create_if_block_73, create_if_block_92, create_else_block_4];
6662
+ const if_block_creators = [create_if_block_83, create_if_block_102, create_else_block_3];
6627
6663
  const if_blocks = [];
6628
6664
  function select_block_type(ctx2, dirty) {
6629
6665
  if (
@@ -6854,14 +6890,15 @@
6854
6890
  }
6855
6891
  if (allAnswered || isInteractiveTriggeredResult) {
6856
6892
  $$invalidate(1, isResultCorrect = false);
6857
- const { is_single_mark: isSingleMark, allow_non_macrons_as_correct_answer: allowNonMacrons, ignore_punctuation: ignorePunctuation } = interaction;
6893
+ const { allow_non_macrons_as_correct_answer: allowNonMacrons, ignore_punctuation: ignorePunctuation } = interaction;
6858
6894
  const { answer: previewCorrectAnswer } = scoringMetadata;
6859
6895
  $$invalidate(15, inlineAnswerResult = checkInlineAnswer(previewCorrectAnswer, inlineTypeinAnswer, allowNonMacrons, ignorePunctuation));
6860
- $$invalidate(1, isResultCorrect = isSingleMark ? !inlineAnswerResult.includes(false) : inlineAnswerResult.includes(true));
6896
+ $$invalidate(1, isResultCorrect = !inlineAnswerResult.includes(false));
6861
6897
  $$invalidate(0, isFinished = true);
6862
6898
  $$invalidate(16, correctAnswerData = previewCorrectAnswer);
6863
6899
  $$invalidate(17, correctAnswerDataLength = previewCorrectAnswer.length);
6864
- getFeedback();
6900
+ if (!isResultCorrect)
6901
+ getFeedback();
6865
6902
  buildInlinePrompt();
6866
6903
  setTimeout(
6867
6904
  () => {
@@ -6910,6 +6947,8 @@
6910
6947
  inlineTypeinAnswer = answer.map((data) => data[0]);
6911
6948
  metadataAnswer = inlineTypeinAnswer;
6912
6949
  }
6950
+ if (!isResultCorrect)
6951
+ getFeedback();
6913
6952
  correctAnswerData = correctAnswer;
6914
6953
  correctAnswerDataLength = correctAnswer.length;
6915
6954
  inlineAnswerResult = checkInlineAnswer(correctAnswer, metadataAnswer, allowNonMacrons, ignorePunctuation);
@@ -15024,6 +15063,7 @@
15024
15063
  const { data } = await useGet(`sessions/${sessionId}/score${skipUserValidationStr}`);
15025
15064
  if (data) {
15026
15065
  const { metadata, scoring } = data[0];
15066
+ const { score_earned, score_total } = scoring;
15027
15067
  const { answer, has_answer: hasAnswer, correct_answer_id } = metadata;
15028
15068
  let scoringMetadata = { hasAnswer };
15029
15069
  switch (interactionType) {
@@ -15046,7 +15086,8 @@
15046
15086
  };
15047
15087
  }
15048
15088
  $$invalidate(0, sessionData = { ...sessionData, scoringMetadata });
15049
- $$invalidate(5, isResultCorrect = scoring.score_earned);
15089
+ if (score_earned === score_total)
15090
+ $$invalidate(5, isResultCorrect = !isResultCorrect);
15050
15091
  }
15051
15092
  } catch (error) {
15052
15093
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eat-js-sdk",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "change version": "1.0.3",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [