eat-js-sdk 1.0.16 → 1.0.18

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.
@@ -4437,17 +4437,23 @@
4437
4437
  };
4438
4438
  }
4439
4439
  function create_default_slot(ctx) {
4440
- let t2;
4441
- let if_block1_anchor;
4442
- let current;
4443
- let if_block0 = (
4440
+ let show_if = (
4444
4441
  /*correctAnswersLength*/
4445
4442
  ctx[6] === 1 && /*isFinished*/
4446
4443
  ctx[1] && (!/*isPreviewMode*/
4447
4444
  ctx[2] || /*isPreviewMode*/
4448
4445
  ctx[2] && /*isPreviewModeInteractive*/
4449
- ctx[3]) && create_if_block_82(ctx)
4446
+ ctx[3]) && !/*selectedOptions*/
4447
+ (ctx[4].length === 1 && /*correctAnswerIds*/
4448
+ ctx[7].includes(
4449
+ /*selectedOptions*/
4450
+ ctx[4][0]
4451
+ ))
4450
4452
  );
4453
+ let t2;
4454
+ let if_block1_anchor;
4455
+ let current;
4456
+ let if_block0 = show_if && create_if_block_82(ctx);
4451
4457
  let if_block1 = (
4452
4458
  /*options*/
4453
4459
  ctx[11] && create_if_block5(ctx)
@@ -4471,18 +4477,24 @@
4471
4477
  current = true;
4472
4478
  },
4473
4479
  p(ctx2, dirty) {
4474
- if (
4475
- /*correctAnswersLength*/
4480
+ if (dirty & /*correctAnswersLength, isFinished, isPreviewMode, isPreviewModeInteractive, selectedOptions, correctAnswerIds*/
4481
+ 222)
4482
+ show_if = /*correctAnswersLength*/
4476
4483
  ctx2[6] === 1 && /*isFinished*/
4477
4484
  ctx2[1] && (!/*isPreviewMode*/
4478
4485
  ctx2[2] || /*isPreviewMode*/
4479
4486
  ctx2[2] && /*isPreviewModeInteractive*/
4480
- ctx2[3])
4481
- ) {
4487
+ ctx2[3]) && !/*selectedOptions*/
4488
+ (ctx2[4].length === 1 && /*correctAnswerIds*/
4489
+ ctx2[7].includes(
4490
+ /*selectedOptions*/
4491
+ ctx2[4][0]
4492
+ ));
4493
+ if (show_if) {
4482
4494
  if (if_block0) {
4483
4495
  if_block0.p(ctx2, dirty);
4484
- if (dirty & /*correctAnswersLength, isFinished, isPreviewMode, isPreviewModeInteractive*/
4485
- 78) {
4496
+ if (dirty & /*correctAnswersLength, isFinished, isPreviewMode, isPreviewModeInteractive, selectedOptions, correctAnswerIds*/
4497
+ 222) {
4486
4498
  transition_in(if_block0, 1);
4487
4499
  }
4488
4500
  } else {
@@ -5118,7 +5130,7 @@
5118
5130
  child_ctx[63] = i;
5119
5131
  return child_ctx;
5120
5132
  }
5121
- function create_else_block_4(ctx) {
5133
+ function create_else_block_3(ctx) {
5122
5134
  let textarea;
5123
5135
  let textarea_class_value;
5124
5136
  let autosize_action;
@@ -5255,7 +5267,7 @@
5255
5267
  }
5256
5268
  };
5257
5269
  }
5258
- function create_if_block_92(ctx) {
5270
+ function create_if_block_102(ctx) {
5259
5271
  let input;
5260
5272
  let input_class_value;
5261
5273
  let mounted;
@@ -5372,12 +5384,12 @@
5372
5384
  }
5373
5385
  };
5374
5386
  }
5375
- function create_if_block_73(ctx) {
5387
+ function create_if_block_83(ctx) {
5376
5388
  let current_block_type_index;
5377
5389
  let if_block;
5378
5390
  let if_block_anchor;
5379
5391
  let current;
5380
- const if_block_creators = [create_if_block_83, create_else_block_3];
5392
+ const if_block_creators = [create_if_block_92, create_else_block_2];
5381
5393
  const if_blocks = [];
5382
5394
  function select_block_type_1(ctx2, dirty) {
5383
5395
  if (
@@ -5439,7 +5451,7 @@
5439
5451
  }
5440
5452
  };
5441
5453
  }
5442
- function create_else_block_3(ctx) {
5454
+ function create_else_block_2(ctx) {
5443
5455
  let invalidbanner;
5444
5456
  let current;
5445
5457
  invalidbanner = new InvalidBanner_default({
@@ -5471,7 +5483,7 @@
5471
5483
  }
5472
5484
  };
5473
5485
  }
5474
- function create_if_block_83(ctx) {
5486
+ function create_if_block_92(ctx) {
5475
5487
  let div0;
5476
5488
  let commonstringtohtml;
5477
5489
  let t0;
@@ -5555,17 +5567,21 @@
5555
5567
  let if_block2_anchor;
5556
5568
  let current;
5557
5569
  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];
5570
+ ctx[24] && create_if_block_63(ctx);
5571
+ const if_block_creators = [create_if_block_43, create_if_block_53];
5560
5572
  const if_blocks = [];
5561
5573
  function select_block_type_3(ctx2, dirty) {
5562
5574
  if (!/*isInlineTypein*/
5563
5575
  ctx2[24])
5564
5576
  return 0;
5565
- return 1;
5577
+ if (!/*isResultCorrect*/
5578
+ ctx2[1])
5579
+ return 1;
5580
+ return -1;
5581
+ }
5582
+ if (~(current_block_type_index = select_block_type_3(ctx, [-1, -1, -1]))) {
5583
+ if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
5566
5584
  }
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
5585
  let if_block2 = (
5570
5586
  /*isInlineTypein*/
5571
5587
  ctx[24] && (!/*isPreviewMode*/
@@ -5577,7 +5593,8 @@
5577
5593
  if (if_block0)
5578
5594
  if_block0.c();
5579
5595
  t0 = space();
5580
- if_block1.c();
5596
+ if (if_block1)
5597
+ if_block1.c();
5581
5598
  t1 = space();
5582
5599
  if (if_block2)
5583
5600
  if_block2.c();
@@ -5587,7 +5604,9 @@
5587
5604
  if (if_block0)
5588
5605
  if_block0.m(target, anchor);
5589
5606
  insert(target, t0, anchor);
5590
- if_blocks[current_block_type_index].m(target, anchor);
5607
+ if (~current_block_type_index) {
5608
+ if_blocks[current_block_type_index].m(target, anchor);
5609
+ }
5591
5610
  insert(target, t1, anchor);
5592
5611
  if (if_block2)
5593
5612
  if_block2.m(target, anchor);
@@ -5598,7 +5617,34 @@
5598
5617
  if (!/*isInlineTypein*/
5599
5618
  ctx2[24])
5600
5619
  if_block0.p(ctx2, dirty);
5601
- if_block1.p(ctx2, dirty);
5620
+ let previous_block_index = current_block_type_index;
5621
+ current_block_type_index = select_block_type_3(ctx2, dirty);
5622
+ if (current_block_type_index === previous_block_index) {
5623
+ if (~current_block_type_index) {
5624
+ if_blocks[current_block_type_index].p(ctx2, dirty);
5625
+ }
5626
+ } else {
5627
+ if (if_block1) {
5628
+ group_outros();
5629
+ transition_out(if_blocks[previous_block_index], 1, 1, () => {
5630
+ if_blocks[previous_block_index] = null;
5631
+ });
5632
+ check_outros();
5633
+ }
5634
+ if (~current_block_type_index) {
5635
+ if_block1 = if_blocks[current_block_type_index];
5636
+ if (!if_block1) {
5637
+ if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
5638
+ if_block1.c();
5639
+ } else {
5640
+ if_block1.p(ctx2, dirty);
5641
+ }
5642
+ transition_in(if_block1, 1);
5643
+ if_block1.m(t1.parentNode, t1);
5644
+ } else {
5645
+ if_block1 = null;
5646
+ }
5647
+ }
5602
5648
  if (
5603
5649
  /*isInlineTypein*/
5604
5650
  ctx2[24] && (!/*isPreviewMode*/
@@ -5647,13 +5693,15 @@
5647
5693
  }
5648
5694
  if (if_block0)
5649
5695
  if_block0.d(detaching);
5650
- if_blocks[current_block_type_index].d(detaching);
5696
+ if (~current_block_type_index) {
5697
+ if_blocks[current_block_type_index].d(detaching);
5698
+ }
5651
5699
  if (if_block2)
5652
5700
  if_block2.d(detaching);
5653
5701
  }
5654
5702
  };
5655
5703
  }
5656
- function create_if_block_53(ctx) {
5704
+ function create_if_block_63(ctx) {
5657
5705
  let div;
5658
5706
  let span0;
5659
5707
  let current_block_type_index;
@@ -5664,7 +5712,7 @@
5664
5712
  let t1;
5665
5713
  let div_class_value;
5666
5714
  let current;
5667
- const if_block_creators = [create_if_block_63, create_else_block_2];
5715
+ const if_block_creators = [create_if_block_73, create_else_block_1];
5668
5716
  const if_blocks = [];
5669
5717
  function select_block_type_2(ctx2, dirty) {
5670
5718
  if (
@@ -5752,7 +5800,7 @@
5752
5800
  }
5753
5801
  };
5754
5802
  }
5755
- function create_else_block_2(ctx) {
5803
+ function create_else_block_1(ctx) {
5756
5804
  let errorsolid;
5757
5805
  let current;
5758
5806
  errorsolid = new ErrorSolid_default({});
@@ -5779,7 +5827,7 @@
5779
5827
  }
5780
5828
  };
5781
5829
  }
5782
- function create_if_block_63(ctx) {
5830
+ function create_if_block_73(ctx) {
5783
5831
  let successsolid;
5784
5832
  let current;
5785
5833
  successsolid = new SuccessSolid_default({});
@@ -5806,7 +5854,7 @@
5806
5854
  }
5807
5855
  };
5808
5856
  }
5809
- function create_else_block_1(ctx) {
5857
+ function create_if_block_53(ctx) {
5810
5858
  let promptresultv2;
5811
5859
  let current;
5812
5860
  promptresultv2 = new PromptResultFeedbackv2_default({
@@ -6623,7 +6671,7 @@
6623
6671
  let t2;
6624
6672
  let if_block1_anchor;
6625
6673
  let current;
6626
- const if_block_creators = [create_if_block_73, create_if_block_92, create_else_block_4];
6674
+ const if_block_creators = [create_if_block_83, create_if_block_102, create_else_block_3];
6627
6675
  const if_blocks = [];
6628
6676
  function select_block_type(ctx2, dirty) {
6629
6677
  if (
@@ -6854,14 +6902,15 @@
6854
6902
  }
6855
6903
  if (allAnswered || isInteractiveTriggeredResult) {
6856
6904
  $$invalidate(1, isResultCorrect = false);
6857
- const { is_single_mark: isSingleMark, allow_non_macrons_as_correct_answer: allowNonMacrons, ignore_punctuation: ignorePunctuation } = interaction;
6905
+ const { allow_non_macrons_as_correct_answer: allowNonMacrons, ignore_punctuation: ignorePunctuation } = interaction;
6858
6906
  const { answer: previewCorrectAnswer } = scoringMetadata;
6859
6907
  $$invalidate(15, inlineAnswerResult = checkInlineAnswer(previewCorrectAnswer, inlineTypeinAnswer, allowNonMacrons, ignorePunctuation));
6860
- $$invalidate(1, isResultCorrect = isSingleMark ? !inlineAnswerResult.includes(false) : inlineAnswerResult.includes(true));
6908
+ $$invalidate(1, isResultCorrect = !inlineAnswerResult.includes(false));
6861
6909
  $$invalidate(0, isFinished = true);
6862
6910
  $$invalidate(16, correctAnswerData = previewCorrectAnswer);
6863
6911
  $$invalidate(17, correctAnswerDataLength = previewCorrectAnswer.length);
6864
- getFeedback();
6912
+ if (!isResultCorrect)
6913
+ getFeedback();
6865
6914
  buildInlinePrompt();
6866
6915
  setTimeout(
6867
6916
  () => {
@@ -6910,6 +6959,8 @@
6910
6959
  inlineTypeinAnswer = answer.map((data) => data[0]);
6911
6960
  metadataAnswer = inlineTypeinAnswer;
6912
6961
  }
6962
+ if (!isResultCorrect)
6963
+ getFeedback();
6913
6964
  correctAnswerData = correctAnswer;
6914
6965
  correctAnswerDataLength = correctAnswer.length;
6915
6966
  inlineAnswerResult = checkInlineAnswer(correctAnswer, metadataAnswer, allowNonMacrons, ignorePunctuation);
@@ -15024,6 +15075,7 @@
15024
15075
  const { data } = await useGet(`sessions/${sessionId}/score${skipUserValidationStr}`);
15025
15076
  if (data) {
15026
15077
  const { metadata, scoring } = data[0];
15078
+ const { score_earned, score_total } = scoring;
15027
15079
  const { answer, has_answer: hasAnswer, correct_answer_id } = metadata;
15028
15080
  let scoringMetadata = { hasAnswer };
15029
15081
  switch (interactionType) {
@@ -15046,7 +15098,8 @@
15046
15098
  };
15047
15099
  }
15048
15100
  $$invalidate(0, sessionData = { ...sessionData, scoringMetadata });
15049
- $$invalidate(5, isResultCorrect = scoring.score_earned);
15101
+ if (score_earned === score_total)
15102
+ $$invalidate(5, isResultCorrect = !isResultCorrect);
15050
15103
  }
15051
15104
  } catch (error) {
15052
15105
  } 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.18",
4
4
  "change version": "1.0.3",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [