@schoolio/player 1.4.6 → 1.4.8
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/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +322 -170
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +322 -170
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1864,7 +1864,9 @@ function QuizPlayer({
|
|
|
1864
1864
|
onGenerateMoreQuestions,
|
|
1865
1865
|
className,
|
|
1866
1866
|
forceNewAttempt = true,
|
|
1867
|
-
hideScore = false
|
|
1867
|
+
hideScore = false,
|
|
1868
|
+
completionVideoUrl,
|
|
1869
|
+
perfectScoreVideoUrl
|
|
1868
1870
|
}) {
|
|
1869
1871
|
const [quiz, setQuiz] = useState3(null);
|
|
1870
1872
|
const [attempt, setAttempt] = useState3(null);
|
|
@@ -2451,8 +2453,41 @@ function QuizPlayer({
|
|
|
2451
2453
|
}
|
|
2452
2454
|
}
|
|
2453
2455
|
` }),
|
|
2454
|
-
/* @__PURE__ */ jsxs4("div", { style:
|
|
2455
|
-
|
|
2456
|
+
/* @__PURE__ */ jsxs4("div", { style: {
|
|
2457
|
+
...defaultStyles.results,
|
|
2458
|
+
position: "relative",
|
|
2459
|
+
overflow: "hidden"
|
|
2460
|
+
}, children: [
|
|
2461
|
+
(() => {
|
|
2462
|
+
const videoUrl = percentage === 100 && perfectScoreVideoUrl ? perfectScoreVideoUrl : completionVideoUrl;
|
|
2463
|
+
if (videoUrl) {
|
|
2464
|
+
return /* @__PURE__ */ jsx4(
|
|
2465
|
+
"video",
|
|
2466
|
+
{
|
|
2467
|
+
autoPlay: true,
|
|
2468
|
+
playsInline: true,
|
|
2469
|
+
preload: "auto",
|
|
2470
|
+
onEnded: (e) => {
|
|
2471
|
+
e.currentTarget.currentTime = 0;
|
|
2472
|
+
e.currentTarget.pause();
|
|
2473
|
+
},
|
|
2474
|
+
style: {
|
|
2475
|
+
position: "absolute",
|
|
2476
|
+
top: 0,
|
|
2477
|
+
left: 0,
|
|
2478
|
+
width: "100%",
|
|
2479
|
+
height: "100%",
|
|
2480
|
+
objectFit: "cover",
|
|
2481
|
+
zIndex: 0
|
|
2482
|
+
},
|
|
2483
|
+
children: /* @__PURE__ */ jsx4("source", { src: videoUrl, type: "video/webm" })
|
|
2484
|
+
},
|
|
2485
|
+
videoUrl
|
|
2486
|
+
);
|
|
2487
|
+
}
|
|
2488
|
+
return /* @__PURE__ */ jsx4("div", { style: { ...defaultStyles.resultsBackground, background: theme.bgGradient } });
|
|
2489
|
+
})(),
|
|
2490
|
+
percentage >= 60 && /* @__PURE__ */ jsx4("div", { style: { ...defaultStyles.confettiContainer, zIndex: 1 }, children: confettiPieces.map((piece) => /* @__PURE__ */ jsx4(
|
|
2456
2491
|
"div",
|
|
2457
2492
|
{
|
|
2458
2493
|
style: {
|
|
@@ -2469,173 +2504,279 @@ function QuizPlayer({
|
|
|
2469
2504
|
},
|
|
2470
2505
|
piece.id
|
|
2471
2506
|
)) }),
|
|
2472
|
-
/* @__PURE__ */ jsx4(
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2507
|
+
/* @__PURE__ */ jsx4(
|
|
2508
|
+
"div",
|
|
2509
|
+
{
|
|
2510
|
+
style: {
|
|
2511
|
+
position: "absolute",
|
|
2512
|
+
top: "16px",
|
|
2513
|
+
left: "50%",
|
|
2514
|
+
transform: "translateX(-50%)",
|
|
2515
|
+
zIndex: 2,
|
|
2516
|
+
display: "flex",
|
|
2517
|
+
justifyContent: "center"
|
|
2518
|
+
},
|
|
2519
|
+
children: /* @__PURE__ */ jsx4(
|
|
2520
|
+
"div",
|
|
2521
|
+
{
|
|
2522
|
+
style: {
|
|
2523
|
+
background: "rgba(255, 255, 255, 0.5)",
|
|
2524
|
+
backdropFilter: "blur(8px)",
|
|
2525
|
+
borderRadius: "16px",
|
|
2526
|
+
padding: "12px 20px",
|
|
2527
|
+
display: "flex",
|
|
2528
|
+
flexDirection: "row",
|
|
2529
|
+
alignItems: "center",
|
|
2530
|
+
justifyContent: "center",
|
|
2531
|
+
gap: "16px",
|
|
2532
|
+
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
2533
|
+
animation: "scoreSlideIn 0.5s ease-out forwards",
|
|
2534
|
+
whiteSpace: "nowrap"
|
|
2535
|
+
},
|
|
2536
|
+
children: hideScore ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
2537
|
+
/* @__PURE__ */ jsxs4(
|
|
2538
|
+
"div",
|
|
2539
|
+
{
|
|
2540
|
+
style: {
|
|
2541
|
+
display: "flex",
|
|
2542
|
+
flexDirection: "column",
|
|
2543
|
+
alignItems: "center",
|
|
2544
|
+
gap: "8px"
|
|
2545
|
+
},
|
|
2546
|
+
children: [
|
|
2547
|
+
/* @__PURE__ */ jsx4(
|
|
2548
|
+
"div",
|
|
2549
|
+
{
|
|
2550
|
+
style: {
|
|
2551
|
+
fontSize: "24px",
|
|
2552
|
+
fontWeight: "700",
|
|
2553
|
+
color: "#22c55e"
|
|
2554
|
+
},
|
|
2555
|
+
children: "All Done!"
|
|
2556
|
+
}
|
|
2557
|
+
),
|
|
2558
|
+
/* @__PURE__ */ jsx4(
|
|
2559
|
+
"div",
|
|
2560
|
+
{
|
|
2561
|
+
style: {
|
|
2562
|
+
fontSize: "16px",
|
|
2563
|
+
color: "#6b7280"
|
|
2564
|
+
},
|
|
2565
|
+
children: "Quiz submitted successfully"
|
|
2566
|
+
}
|
|
2567
|
+
)
|
|
2568
|
+
]
|
|
2569
|
+
}
|
|
2570
|
+
),
|
|
2571
|
+
/* @__PURE__ */ jsx4(
|
|
2572
|
+
"div",
|
|
2573
|
+
{
|
|
2574
|
+
style: {
|
|
2575
|
+
width: "1px",
|
|
2576
|
+
height: "48px",
|
|
2577
|
+
background: "rgba(0, 0, 0, 0.1)"
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
),
|
|
2581
|
+
/* @__PURE__ */ jsxs4(
|
|
2582
|
+
"div",
|
|
2583
|
+
{
|
|
2584
|
+
style: {
|
|
2585
|
+
display: "flex",
|
|
2586
|
+
flexDirection: "column",
|
|
2587
|
+
alignItems: "center"
|
|
2588
|
+
},
|
|
2589
|
+
children: [
|
|
2590
|
+
/* @__PURE__ */ jsx4(
|
|
2591
|
+
"div",
|
|
2592
|
+
{
|
|
2593
|
+
style: {
|
|
2594
|
+
fontSize: "14px",
|
|
2595
|
+
fontWeight: "500",
|
|
2596
|
+
color: "#6b7280",
|
|
2597
|
+
marginBottom: "4px"
|
|
2598
|
+
},
|
|
2599
|
+
children: "Time"
|
|
2600
|
+
}
|
|
2601
|
+
),
|
|
2602
|
+
/* @__PURE__ */ jsx4(
|
|
2603
|
+
"div",
|
|
2604
|
+
{
|
|
2605
|
+
style: {
|
|
2606
|
+
fontSize: "24px",
|
|
2607
|
+
fontWeight: "700",
|
|
2608
|
+
color: "#1f2937"
|
|
2609
|
+
},
|
|
2610
|
+
children: formatTime(result.timeSpentSeconds)
|
|
2611
|
+
}
|
|
2612
|
+
)
|
|
2613
|
+
]
|
|
2614
|
+
}
|
|
2615
|
+
)
|
|
2616
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
2617
|
+
/* @__PURE__ */ jsx4(
|
|
2618
|
+
"div",
|
|
2619
|
+
{
|
|
2620
|
+
style: {
|
|
2621
|
+
background: theme.badgeBg,
|
|
2622
|
+
padding: "8px 16px",
|
|
2623
|
+
borderRadius: "20px",
|
|
2624
|
+
animation: "badgePop 0.5s ease-out 0.3s forwards",
|
|
2625
|
+
opacity: 0,
|
|
2626
|
+
transform: "scale(0.8)"
|
|
2627
|
+
},
|
|
2628
|
+
children: /* @__PURE__ */ jsx4(
|
|
2629
|
+
"span",
|
|
2630
|
+
{
|
|
2631
|
+
style: {
|
|
2632
|
+
fontSize: "14px",
|
|
2633
|
+
fontWeight: "700",
|
|
2634
|
+
color: theme.badgeColor
|
|
2635
|
+
},
|
|
2636
|
+
children: theme.badge
|
|
2637
|
+
}
|
|
2638
|
+
)
|
|
2639
|
+
}
|
|
2640
|
+
),
|
|
2641
|
+
/* @__PURE__ */ jsx4(
|
|
2642
|
+
"div",
|
|
2643
|
+
{
|
|
2644
|
+
style: {
|
|
2645
|
+
width: "1px",
|
|
2646
|
+
height: "40px",
|
|
2647
|
+
background: "rgba(0, 0, 0, 0.1)"
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
),
|
|
2651
|
+
/* @__PURE__ */ jsxs4(
|
|
2652
|
+
"div",
|
|
2653
|
+
{
|
|
2654
|
+
style: {
|
|
2655
|
+
display: "flex",
|
|
2656
|
+
flexDirection: "column",
|
|
2657
|
+
alignItems: "center"
|
|
2658
|
+
},
|
|
2659
|
+
children: [
|
|
2660
|
+
/* @__PURE__ */ jsx4(
|
|
2661
|
+
"div",
|
|
2662
|
+
{
|
|
2663
|
+
style: {
|
|
2664
|
+
fontSize: "12px",
|
|
2665
|
+
fontWeight: "500",
|
|
2666
|
+
color: "#6b7280",
|
|
2667
|
+
marginBottom: "2px"
|
|
2668
|
+
},
|
|
2669
|
+
children: "Correct Answers"
|
|
2670
|
+
}
|
|
2671
|
+
),
|
|
2672
|
+
/* @__PURE__ */ jsxs4(
|
|
2673
|
+
"div",
|
|
2674
|
+
{
|
|
2675
|
+
style: {
|
|
2676
|
+
fontSize: "24px",
|
|
2677
|
+
fontWeight: "800",
|
|
2678
|
+
color: theme.color
|
|
2679
|
+
},
|
|
2680
|
+
children: [
|
|
2681
|
+
result.correctAnswers,
|
|
2682
|
+
" / ",
|
|
2683
|
+
result.totalQuestions
|
|
2684
|
+
]
|
|
2685
|
+
}
|
|
2686
|
+
)
|
|
2687
|
+
]
|
|
2688
|
+
}
|
|
2689
|
+
),
|
|
2690
|
+
/* @__PURE__ */ jsx4(
|
|
2691
|
+
"div",
|
|
2692
|
+
{
|
|
2693
|
+
style: {
|
|
2694
|
+
width: "1px",
|
|
2695
|
+
height: "40px",
|
|
2696
|
+
background: "rgba(0, 0, 0, 0.1)"
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
),
|
|
2700
|
+
/* @__PURE__ */ jsxs4(
|
|
2701
|
+
"div",
|
|
2702
|
+
{
|
|
2703
|
+
style: {
|
|
2704
|
+
display: "flex",
|
|
2705
|
+
flexDirection: "column",
|
|
2706
|
+
alignItems: "center"
|
|
2707
|
+
},
|
|
2708
|
+
children: [
|
|
2709
|
+
/* @__PURE__ */ jsx4(
|
|
2710
|
+
"div",
|
|
2711
|
+
{
|
|
2712
|
+
style: {
|
|
2713
|
+
fontSize: "12px",
|
|
2714
|
+
fontWeight: "500",
|
|
2715
|
+
color: "#6b7280",
|
|
2716
|
+
marginBottom: "2px"
|
|
2717
|
+
},
|
|
2718
|
+
children: "Time"
|
|
2719
|
+
}
|
|
2720
|
+
),
|
|
2721
|
+
/* @__PURE__ */ jsx4(
|
|
2722
|
+
"div",
|
|
2723
|
+
{
|
|
2724
|
+
style: {
|
|
2725
|
+
fontSize: "20px",
|
|
2726
|
+
fontWeight: "700",
|
|
2727
|
+
color: "#1f2937"
|
|
2728
|
+
},
|
|
2729
|
+
children: formatTime(result.timeSpentSeconds)
|
|
2730
|
+
}
|
|
2731
|
+
)
|
|
2732
|
+
]
|
|
2733
|
+
}
|
|
2734
|
+
),
|
|
2735
|
+
/* @__PURE__ */ jsx4(
|
|
2736
|
+
"div",
|
|
2737
|
+
{
|
|
2738
|
+
style: {
|
|
2739
|
+
width: "1px",
|
|
2740
|
+
height: "40px",
|
|
2741
|
+
background: "rgba(0, 0, 0, 0.1)"
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
),
|
|
2745
|
+
/* @__PURE__ */ jsx4(
|
|
2746
|
+
"button",
|
|
2747
|
+
{
|
|
2748
|
+
style: {
|
|
2749
|
+
padding: "10px 20px",
|
|
2750
|
+
fontSize: "14px",
|
|
2751
|
+
fontWeight: "600",
|
|
2752
|
+
color: "white",
|
|
2753
|
+
background: "#7c3aed",
|
|
2754
|
+
border: "none",
|
|
2755
|
+
borderRadius: "12px",
|
|
2756
|
+
cursor: "pointer",
|
|
2757
|
+
transition: "all 0.2s ease",
|
|
2758
|
+
boxShadow: "0 4px 12px rgba(124, 58, 237, 0.3)"
|
|
2759
|
+
},
|
|
2760
|
+
onClick: handleRetryQuiz,
|
|
2761
|
+
onMouseOver: (e) => {
|
|
2762
|
+
e.currentTarget.style.background = "#6d28d9";
|
|
2763
|
+
e.currentTarget.style.transform = "translateY(-2px)";
|
|
2764
|
+
e.currentTarget.style.boxShadow = "0 6px 16px rgba(124, 58, 237, 0.4)";
|
|
2765
|
+
},
|
|
2766
|
+
onMouseOut: (e) => {
|
|
2767
|
+
e.currentTarget.style.background = "#7c3aed";
|
|
2768
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
2769
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(124, 58, 237, 0.3)";
|
|
2770
|
+
},
|
|
2771
|
+
"data-testid": "button-retry-quiz",
|
|
2772
|
+
children: "Try Again"
|
|
2773
|
+
}
|
|
2774
|
+
)
|
|
2775
|
+
] })
|
|
2776
|
+
}
|
|
2777
|
+
)
|
|
2778
|
+
}
|
|
2779
|
+
)
|
|
2639
2780
|
] })
|
|
2640
2781
|
] });
|
|
2641
2782
|
}
|
|
@@ -2763,6 +2904,17 @@ function QuizPlayer({
|
|
|
2763
2904
|
] }),
|
|
2764
2905
|
/* @__PURE__ */ jsxs4("div", { style: { ...defaultStyles.question, position: "relative", paddingBottom: "40px" }, children: [
|
|
2765
2906
|
/* @__PURE__ */ jsx4("div", { style: defaultStyles.questionText, children: /* @__PURE__ */ jsx4(TextToSpeech, { text: currentQuestion.question, inline: true, size: "md" }) }),
|
|
2907
|
+
currentQuestion.type === "multiple" && /* @__PURE__ */ jsx4("div", { style: {
|
|
2908
|
+
marginTop: "8px",
|
|
2909
|
+
marginBottom: "12px",
|
|
2910
|
+
display: "inline-block",
|
|
2911
|
+
padding: "4px 10px",
|
|
2912
|
+
backgroundColor: "rgba(139, 92, 246, 0.1)",
|
|
2913
|
+
color: "#7c3aed",
|
|
2914
|
+
fontSize: "13px",
|
|
2915
|
+
fontStyle: "italic",
|
|
2916
|
+
borderRadius: "4px"
|
|
2917
|
+
}, children: "Select all that apply" }),
|
|
2766
2918
|
isExtraQuestion && /* @__PURE__ */ jsxs4(
|
|
2767
2919
|
"button",
|
|
2768
2920
|
{
|