lido-player 0.0.2-beta-01 → 0.0.2-beta-03
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/cjs/{decode-DkmQvXwq.js → decode-CjtxAc2C.js} +1 -1
- package/dist/cjs/{index-DWfpvz_s.js → index-Bt9s5WYs.js} +174 -20
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +192 -49
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/canvas/lido-canvas.js +1 -1
- package/dist/collection/components/cell/lido-cell.js +1 -1
- package/dist/collection/components/column/lido-col.js +1 -1
- package/dist/collection/components/container/lido-container.js +1 -1
- package/dist/collection/components/flashCard/lido-flash-card.js +1 -1
- package/dist/collection/components/float/lido-float.js +1 -1
- package/dist/collection/components/home/lido-home.js +143 -12
- package/dist/collection/components/keyboard/lido-keyboard.js +2 -2
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +1 -1
- package/dist/collection/components/position/lido-pos.js +1 -1
- package/dist/collection/components/random/lido-random.js +1 -1
- package/dist/collection/components/root/lido-root.js +30 -6
- package/dist/collection/components/row/lido-row.js +1 -1
- package/dist/collection/components/scale/lido-balance.js +1 -1
- package/dist/collection/components/shape/lido-shape.js +2 -2
- package/dist/collection/components/slideFill/lido-slide-fill.css +1 -1
- package/dist/collection/components/slideFill/lido-slide-fill.js +5 -5
- package/dist/collection/components/text/lido-text.js +1 -1
- package/dist/collection/components/trace/lido-trace.css +1 -1
- package/dist/collection/components/trace/lido-trace.js +3 -2
- package/dist/collection/components/wrap/lido-wrap.js +1 -1
- package/dist/collection/utils/audioPlayer.js +86 -7
- package/dist/collection/utils/customEvents.js +29 -6
- package/dist/collection/utils/utils.js +48 -4
- package/dist/collection/utils/utilsHandlers/clickHandler.js +5 -1
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +1 -1
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +2 -2
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-balance.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-canvas.js +1 -1
- package/dist/components/lido-cell.js +1 -1
- package/dist/components/lido-col.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-flash-card.js +1 -1
- package/dist/components/lido-float.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-image.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-pos.js +1 -1
- package/dist/components/lido-random.js +1 -1
- package/dist/components/lido-root.js +1 -1
- package/dist/components/lido-row.js +1 -1
- package/dist/components/lido-shape.js +1 -1
- package/dist/components/lido-slide-fill.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/lido-trace.js +1 -1
- package/dist/components/lido-wrap.js +1 -1
- package/dist/components/{p-CusU-d3G.js → p-04xe3uUh.js} +1 -1
- package/dist/components/p-2ox8u4JO.js +1 -0
- package/dist/components/{p-WP-EeUIB.js → p-BHrmIag4.js} +1 -1
- package/dist/components/p-BHtfrGiU.js +12 -0
- package/dist/components/{p-1qOeKb23.js → p-BPsom7z0.js} +1 -1
- package/dist/components/{p-Cvme8ibO.js → p-B_jNkxEx.js} +1 -1
- package/dist/components/p-BfMfgi8h.js +1 -0
- package/dist/components/p-BsHyhW7k.js +1 -0
- package/dist/components/{p-Blfvc5ur.js → p-C5Gn0SKo.js} +1 -1
- package/dist/components/p-C7tEzlkQ.js +1 -0
- package/dist/components/p-C9eb2B-B.js +1 -0
- package/dist/components/p-COBnIJEZ.js +1 -0
- package/dist/components/{p-q6x112RN.js → p-CwDTdXe5.js} +1 -1
- package/dist/components/{p-CfdL3fZ9.js → p-D-B1groh.js} +1 -1
- package/dist/components/{p-D4JZI_JB.js → p-D0bKCljc.js} +1 -1
- package/dist/components/{p-5cqqnSZl.js → p-D23sDjqf.js} +1 -1
- package/dist/components/{p-Czy5pBTg.js → p-D62lkidF.js} +1 -1
- package/dist/components/{p-1PmJa9_u.js → p-DPAlnts-.js} +1 -1
- package/dist/components/{p-De6WHLEQ.js → p-DU-N8vrM.js} +1 -1
- package/dist/components/p-D_BBs_vA.js +1 -0
- package/dist/components/{p-DqskvXvD.js → p-JN426a_v.js} +1 -1
- package/dist/components/p-iNMFyxvU.js +1 -0
- package/dist/esm/{decode-Czc9ZfbM.js → decode-DN6duCrB.js} +1 -1
- package/dist/esm/{index-9UC_Eom9.js → index-Bfvjs1z9.js} +172 -21
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +192 -49
- package/dist/esm/lido-player.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-94ee3a4f.entry.js +12 -0
- package/dist/lido-player/p-DXsy15Ek.js +1 -0
- package/dist/lido-player/{p-C73A1Nfh.js → p-DngrRzrw.js} +1 -1
- package/dist/types/components/home/lido-home.d.ts +12 -0
- package/dist/types/components/root/lido-root.d.ts +4 -0
- package/dist/types/components.d.ts +22 -0
- package/dist/types/utils/audioPlayer.d.ts +13 -2
- package/dist/types/utils/customEvents.d.ts +16 -2
- package/dist/types/utils/utils.d.ts +4 -0
- package/package.json +2 -1
- package/dist/components/p-B97yn0-n.js +0 -1
- package/dist/components/p-BLx2hZ8d.js +0 -1
- package/dist/components/p-BOTEFjDY.js +0 -1
- package/dist/components/p-CtU7FitD.js +0 -1
- package/dist/components/p-DFnbzZUc.js +0 -1
- package/dist/components/p-DWnRy2OX.js +0 -1
- package/dist/components/p-Dr5sh_El.js +0 -1
- package/dist/components/p-PPkfANfe.js +0 -1
- package/dist/components/p-XacgbiAe.js +0 -1
- package/dist/lido-player/p-15e1c7db.entry.js +0 -1
- package/dist/lido-player/p-CRp3QJ0s.js +0 -1
|
@@ -110,15 +110,36 @@ const LANGUAGE_PROFILES = {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
function dispatchCustomEvent(eventName, detail) {
|
|
113
|
+
var _a;
|
|
113
114
|
console.log("👍Event Name : ", eventName, "Detail : ", detail.toString());
|
|
114
115
|
const event = new CustomEvent(eventName, { detail });
|
|
115
116
|
window.dispatchEvent(event);
|
|
117
|
+
if (eventName === ActivityEndKey || eventName === LessonEndKey || eventName === GameCompletedKey || eventName === GameExitKey) {
|
|
118
|
+
(_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
119
|
+
eventName,
|
|
120
|
+
detail: toSerializableDetail(detail),
|
|
121
|
+
}, "*");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function toSerializableDetail(detail) {
|
|
125
|
+
if (!detail || typeof detail !== 'object')
|
|
126
|
+
return detail;
|
|
127
|
+
return Object.fromEntries(Object.entries(detail).filter(([, value]) => {
|
|
128
|
+
return (value === null ||
|
|
129
|
+
['string', 'number', 'boolean', 'undefined'].includes(typeof value) ||
|
|
130
|
+
Array.isArray(value) ||
|
|
131
|
+
(typeof value === 'object' && value.constructor === Object));
|
|
132
|
+
}));
|
|
116
133
|
}
|
|
117
|
-
function dispatchActivityEndEvent(totalIndex, currentIndex, score, rightMoves, wrongMoves, timeSpentForActivity) {
|
|
118
|
-
dispatchCustomEvent(ActivityEndKey, { currentIndex, totalIndex, score, rightMoves, wrongMoves, timeSpentForActivity });
|
|
134
|
+
function dispatchActivityEndEvent(totalIndex, currentIndex, score, rightMoves, wrongMoves, timeSpentForActivity, lessonTrackingParams, gameCompleted) {
|
|
135
|
+
dispatchCustomEvent(ActivityEndKey, Object.assign(Object.assign({ currentIndex, totalIndex, score, rightMoves, wrongMoves, timeSpentForActivity }, lessonTrackingParams), { gameCompleted }));
|
|
119
136
|
}
|
|
120
|
-
function dispatchLessonEndEvent(totalIndex, rightMoves, wrongMoves, finalScore, timeSpendForLesson) {
|
|
121
|
-
|
|
137
|
+
function dispatchLessonEndEvent(totalIndex, rightMoves, wrongMoves, finalScore, timeSpendForLesson, lessonTrackingParams) {
|
|
138
|
+
if (getLessonTrackingParams().end === "blank" || getLessonTrackingParams().end === "complete" || getLessonTrackingParams().end === "completed") {
|
|
139
|
+
console.log("Lesson end event skipped. Reason: Lesson end type is set to 'blank' in lesson tracking parameters.");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
dispatchCustomEvent(LessonEndKey, Object.assign({ totalIndex, rightMoves, wrongMoves, finalScore, score: finalScore, timeSpendForLesson }, lessonTrackingParams));
|
|
122
143
|
}
|
|
123
144
|
function dispatchNextContainerEvent() {
|
|
124
145
|
dispatchCustomEvent(NextContainerKey, {});
|
|
@@ -141,6 +162,7 @@ function dispatchElementDropEvent(dragElement, dropElement, isCorrect) {
|
|
|
141
162
|
function dispatchClickEvent(element, isCorrect) {
|
|
142
163
|
dispatchCustomEvent(ElementClickKey, { element, isCorrect: isCorrect, createdAt: new Date().toISOString() });
|
|
143
164
|
}
|
|
165
|
+
// for nipun - to dispatch custom event
|
|
144
166
|
|
|
145
167
|
// rive-service.ts
|
|
146
168
|
class RiveService {
|
|
@@ -1062,7 +1084,7 @@ function handleDropElement(element) {
|
|
|
1062
1084
|
}
|
|
1063
1085
|
async function onClickDropOrDragElement(element, type) {
|
|
1064
1086
|
const container = document.getElementById(LidoContainer);
|
|
1065
|
-
if (container.getAttribute('canplay') === 'false')
|
|
1087
|
+
if (container.getAttribute('canplay') === 'false' || container.getAttribute("game-completed") === "true")
|
|
1066
1088
|
return;
|
|
1067
1089
|
// Remove the highlight class from elements matching the selector
|
|
1068
1090
|
const highlightedElements = document.querySelectorAll(`[type='${type}']`);
|
|
@@ -1267,8 +1289,8 @@ function highlightSpeakingElement(element) {
|
|
|
1267
1289
|
// Add a custom class for highlighting
|
|
1268
1290
|
element.classList.add('speaking-highlight');
|
|
1269
1291
|
// Inject keyframe animation and class styles into the document's head if it doesn't already exist
|
|
1270
|
-
const styleId = '
|
|
1271
|
-
if (!document.
|
|
1292
|
+
const styleId = 'speaking-highlight-style';
|
|
1293
|
+
if (!document.getElementById(styleId)) {
|
|
1272
1294
|
const style = document.createElement('style');
|
|
1273
1295
|
style.id = styleId;
|
|
1274
1296
|
style.innerHTML = `
|
|
@@ -1364,21 +1386,37 @@ function highlightElement() {
|
|
|
1364
1386
|
|
|
1365
1387
|
class AudioPlayer {
|
|
1366
1388
|
constructor() {
|
|
1389
|
+
this.currentTargetElement = null;
|
|
1390
|
+
this.pendingReplayElement = null;
|
|
1367
1391
|
this.highlightOverlay = null;
|
|
1368
1392
|
this.wordRects = [];
|
|
1369
1393
|
this.activeWordIndex = -1;
|
|
1370
1394
|
this.highlightRAF = null;
|
|
1371
1395
|
this.endPromiseResolve = null;
|
|
1372
|
-
this.
|
|
1396
|
+
this.visibilityWaitResolvers = [];
|
|
1397
|
+
this.isVisibilityChangeRegistered = false;
|
|
1398
|
+
this.handleUserClick = (event) => {
|
|
1373
1399
|
const container = document.getElementById(LidoContainer);
|
|
1400
|
+
if (container && (event === null || event === void 0 ? void 0 : event.target) === container)
|
|
1401
|
+
return;
|
|
1374
1402
|
if ((container === null || container === void 0 ? void 0 : container.getAttribute('game-completed')) === 'true')
|
|
1375
1403
|
return;
|
|
1376
1404
|
this.stop();
|
|
1377
1405
|
};
|
|
1406
|
+
this.handleVisibilityChange = async () => {
|
|
1407
|
+
if (this.isWindowVisible()) {
|
|
1408
|
+
this.resolveVisibilityWaiters();
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
if (!this.currentTargetElement) {
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
this.pendingReplayElement = this.currentTargetElement;
|
|
1415
|
+
await this.stop(true);
|
|
1416
|
+
};
|
|
1378
1417
|
this.audioElement = document.createElement('audio');
|
|
1379
|
-
this.audioElement.id = 'audio';
|
|
1380
|
-
document.body.appendChild(this.audioElement);
|
|
1381
1418
|
this.registerGlobalStopEvents();
|
|
1419
|
+
this.registerVisibilityEvents();
|
|
1382
1420
|
}
|
|
1383
1421
|
static getI() {
|
|
1384
1422
|
if (!AudioPlayer.instance) {
|
|
@@ -1386,7 +1424,12 @@ class AudioPlayer {
|
|
|
1386
1424
|
}
|
|
1387
1425
|
return AudioPlayer.instance;
|
|
1388
1426
|
}
|
|
1389
|
-
|
|
1427
|
+
static destroyI() {
|
|
1428
|
+
if (AudioPlayer.instance) {
|
|
1429
|
+
AudioPlayer.instance.destroy();
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
stop(preserveReplay = false) {
|
|
1390
1433
|
const container = document.getElementById(LidoContainer);
|
|
1391
1434
|
if (container && container.getAttribute('highlight-word-by-word') === 'true') {
|
|
1392
1435
|
// stop any highlight loop
|
|
@@ -1402,6 +1445,10 @@ class AudioPlayer {
|
|
|
1402
1445
|
this.endPromiseResolve = null;
|
|
1403
1446
|
resolve();
|
|
1404
1447
|
}
|
|
1448
|
+
if (!preserveReplay) {
|
|
1449
|
+
this.pendingReplayElement = null;
|
|
1450
|
+
}
|
|
1451
|
+
this.currentTargetElement = null;
|
|
1405
1452
|
this.audioElement.pause();
|
|
1406
1453
|
this.audioElement.currentTime = 0;
|
|
1407
1454
|
this.audioElement.src = '';
|
|
@@ -1416,12 +1463,38 @@ class AudioPlayer {
|
|
|
1416
1463
|
pauseElement.style.visibility = 'hidden';
|
|
1417
1464
|
}
|
|
1418
1465
|
}
|
|
1466
|
+
isWindowVisible() {
|
|
1467
|
+
return document.visibilityState === 'visible' && !document.hidden;
|
|
1468
|
+
}
|
|
1469
|
+
waitUntilWindowIsVisible() {
|
|
1470
|
+
if (this.isWindowVisible()) {
|
|
1471
|
+
return Promise.resolve();
|
|
1472
|
+
}
|
|
1473
|
+
this.registerVisibilityEvents();
|
|
1474
|
+
return new Promise(resolve => {
|
|
1475
|
+
this.visibilityWaitResolvers.push(resolve);
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
resolveVisibilityWaiters() {
|
|
1479
|
+
const resolvers = this.visibilityWaitResolvers.splice(0);
|
|
1480
|
+
resolvers.forEach(resolve => resolve());
|
|
1481
|
+
}
|
|
1419
1482
|
getLidoTextElement(el) {
|
|
1420
1483
|
if (el.tagName.toLowerCase() === 'lido-text')
|
|
1421
1484
|
return el;
|
|
1422
1485
|
return el.closest('lido-text');
|
|
1423
1486
|
}
|
|
1424
1487
|
async play(targetElement) {
|
|
1488
|
+
this.registerVisibilityEvents();
|
|
1489
|
+
if (!this.isWindowVisible()) {
|
|
1490
|
+
this.pendingReplayElement = targetElement;
|
|
1491
|
+
await this.stop(true);
|
|
1492
|
+
await this.waitUntilWindowIsVisible();
|
|
1493
|
+
if (this.pendingReplayElement !== targetElement) {
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1496
|
+
this.pendingReplayElement = null;
|
|
1497
|
+
}
|
|
1425
1498
|
// Stop any currently playing audio first if target element has audio given
|
|
1426
1499
|
try {
|
|
1427
1500
|
await AudioPlayer.getI().stop();
|
|
@@ -1449,6 +1522,7 @@ class AudioPlayer {
|
|
|
1449
1522
|
this.stopOverlayHighlightLoop(); // stop any highlight loop;
|
|
1450
1523
|
targetElement = textElement;
|
|
1451
1524
|
}
|
|
1525
|
+
this.currentTargetElement = targetElement;
|
|
1452
1526
|
// then play the target element audio.
|
|
1453
1527
|
let audioUrl = targetElement.getAttribute('audio') || '';
|
|
1454
1528
|
// If no direct audio attribute, check childrens for audio
|
|
@@ -1465,7 +1539,7 @@ class AudioPlayer {
|
|
|
1465
1539
|
if (audioUrl) {
|
|
1466
1540
|
audioUrl = convertUrlToRelative(audioUrl);
|
|
1467
1541
|
this.audioElement.src = audioUrl;
|
|
1468
|
-
console.log('🚀 Playing audio:', this.audioElement.src);
|
|
1542
|
+
// console.log('🚀 Playing audio:', this.audioElement.src);
|
|
1469
1543
|
try {
|
|
1470
1544
|
// setDraggingDisabled(true);
|
|
1471
1545
|
const language = container.getAttribute('Lang') || 'en';
|
|
@@ -1529,10 +1603,10 @@ class AudioPlayer {
|
|
|
1529
1603
|
else if (targetElement.textContent) {
|
|
1530
1604
|
try {
|
|
1531
1605
|
highlightSpeakingElement(targetElement);
|
|
1532
|
-
window.addEventListener('click', this.handleUserClick, true);
|
|
1606
|
+
// window.addEventListener('click', this.handleUserClick, true);
|
|
1533
1607
|
await speakText(targetElement.textContent, targetElement);
|
|
1534
|
-
|
|
1535
|
-
highlightedElements.forEach(element => stopHighlightForSpeakingElement(element));
|
|
1608
|
+
document.querySelectorAll('.speaking-highlight');
|
|
1609
|
+
// highlightedElements.forEach(element => stopHighlightForSpeakingElement(element as HTMLElement));
|
|
1536
1610
|
}
|
|
1537
1611
|
catch (error) {
|
|
1538
1612
|
console.log('🎧 TTS Error:', error);
|
|
@@ -1541,6 +1615,17 @@ class AudioPlayer {
|
|
|
1541
1615
|
setDraggingDisabled(false);
|
|
1542
1616
|
}
|
|
1543
1617
|
}
|
|
1618
|
+
const shouldReplayFromStart = this.pendingReplayElement === targetElement;
|
|
1619
|
+
if (shouldReplayFromStart) {
|
|
1620
|
+
await this.waitUntilWindowIsVisible();
|
|
1621
|
+
if (this.pendingReplayElement === targetElement) {
|
|
1622
|
+
this.pendingReplayElement = null;
|
|
1623
|
+
return this.play(targetElement);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
if (this.currentTargetElement === targetElement) {
|
|
1627
|
+
this.currentTargetElement = null;
|
|
1628
|
+
}
|
|
1544
1629
|
}
|
|
1545
1630
|
// GLOBAL STOP EVENTS (container change, activity change…)
|
|
1546
1631
|
registerGlobalStopEvents() {
|
|
@@ -1552,10 +1637,26 @@ class AudioPlayer {
|
|
|
1552
1637
|
window.addEventListener(key, () => this.stop());
|
|
1553
1638
|
});
|
|
1554
1639
|
}
|
|
1640
|
+
registerVisibilityEvents() {
|
|
1641
|
+
if (this.isVisibilityChangeRegistered) {
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1645
|
+
this.isVisibilityChangeRegistered = true;
|
|
1646
|
+
}
|
|
1647
|
+
unregisterVisibilityEvents() {
|
|
1648
|
+
if (!this.isVisibilityChangeRegistered) {
|
|
1649
|
+
return;
|
|
1650
|
+
}
|
|
1651
|
+
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1652
|
+
this.isVisibilityChangeRegistered = false;
|
|
1653
|
+
this.resolveVisibilityWaiters();
|
|
1654
|
+
}
|
|
1555
1655
|
// DESTROY (for hot-reload)
|
|
1556
1656
|
destroy() {
|
|
1557
1657
|
console.log("AudioPlayer destroyed (hot-reload safe)");
|
|
1558
1658
|
this.stop();
|
|
1659
|
+
this.unregisterVisibilityEvents();
|
|
1559
1660
|
// Remove DOM element
|
|
1560
1661
|
if (this.audioElement.parentNode) {
|
|
1561
1662
|
this.audioElement.parentNode.removeChild(this.audioElement);
|
|
@@ -3660,6 +3761,8 @@ function addClickListenerForClickType(element) {
|
|
|
3660
3761
|
}
|
|
3661
3762
|
const onClick = async () => {
|
|
3662
3763
|
var _a;
|
|
3764
|
+
if (element === container)
|
|
3765
|
+
return;
|
|
3663
3766
|
if (container.getAttribute("game-completed") === "true")
|
|
3664
3767
|
return;
|
|
3665
3768
|
const lido_buttons = element.getAttribute('id');
|
|
@@ -3751,7 +3854,9 @@ function addClickListenerForClickType(element) {
|
|
|
3751
3854
|
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues));
|
|
3752
3855
|
const isCorrect = objective.includes(element['value']);
|
|
3753
3856
|
dispatchClickEvent(element, isCorrect);
|
|
3754
|
-
|
|
3857
|
+
if (hasValidAudio) {
|
|
3858
|
+
AudioPlayer.getI().stop();
|
|
3859
|
+
}
|
|
3755
3860
|
if (isCorrect) {
|
|
3756
3861
|
const onCorrect = element.getAttribute('onCorrect');
|
|
3757
3862
|
await executeActions(onCorrect, element);
|
|
@@ -4532,6 +4637,8 @@ _extends(config$1, DEFAULT_CONFIG, {
|
|
|
4532
4637
|
NUMBER_OPTIONS
|
|
4533
4638
|
});
|
|
4534
4639
|
|
|
4640
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4641
|
+
|
|
4535
4642
|
function getDefaultExportFromCjs (x) {
|
|
4536
4643
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
4537
4644
|
}
|
|
@@ -72843,6 +72950,24 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
72843
72950
|
});
|
|
72844
72951
|
handleShowCheck();
|
|
72845
72952
|
}
|
|
72953
|
+
const getLessonTrackingParams = () => {
|
|
72954
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
72955
|
+
const getParam = (key) => { var _a, _b; return (_b = (_a = urlParams.get(key.toLowerCase())) !== null && _a !== void 0 ? _a : urlParams.get(key)) !== null && _b !== void 0 ? _b : ''; };
|
|
72956
|
+
return {
|
|
72957
|
+
studentId: getParam('studentId'),
|
|
72958
|
+
studentName: getParam('studentName'),
|
|
72959
|
+
classId: getParam('classId'),
|
|
72960
|
+
schoolId: getParam('schoolId'),
|
|
72961
|
+
courseId: getParam('courseId'),
|
|
72962
|
+
courseName: getParam('courseName'),
|
|
72963
|
+
chapterId: getParam('chapterId'),
|
|
72964
|
+
chapterName: getParam('chapterName'),
|
|
72965
|
+
lessonId: getParam('lessonId'),
|
|
72966
|
+
lessonName: getParam('lessonName'),
|
|
72967
|
+
lang: getParam('lang'),
|
|
72968
|
+
end: getParam('end'),
|
|
72969
|
+
};
|
|
72970
|
+
};
|
|
72846
72971
|
const storeActivityScore = (score) => {
|
|
72847
72972
|
var _a, _b, _c;
|
|
72848
72973
|
const appHome = document.querySelector('lido-home');
|
|
@@ -72857,7 +72982,9 @@ const storeActivityScore = (score) => {
|
|
|
72857
72982
|
// window.dispatchEvent(new CustomEvent(ActivityEndKey, { detail: { index: index, totalIndex: totalIndex, score: score } }));
|
|
72858
72983
|
const timeSpendForActivity = Math.floor(Timer.getI().getElapsed() / 1000);
|
|
72859
72984
|
ACTIVYTY_TIME_SPEND_ARRAY.push(timeSpendForActivity);
|
|
72860
|
-
|
|
72985
|
+
const lessonTrackingParams = getLessonTrackingParams();
|
|
72986
|
+
console.log("lessontracking params : ", lessonTrackingParams);
|
|
72987
|
+
dispatchActivityEndEvent(totalIndex, index, score, gameScore.rightMoves, gameScore.wrongMoves, timeSpendForActivity, lessonTrackingParams, true);
|
|
72861
72988
|
localStorage.setItem(ActivityScoreKey, JSON.stringify(activityScore));
|
|
72862
72989
|
if (totalIndex - 1 == index) {
|
|
72863
72990
|
const scoresArray = Object.values(activityScore);
|
|
@@ -72866,7 +72993,7 @@ const storeActivityScore = (score) => {
|
|
|
72866
72993
|
console.log('Total Score : ', gameScore.finalScore);
|
|
72867
72994
|
// window.dispatchEvent(new CustomEvent(LessonEndKey, { detail: { score: finalScore } }));
|
|
72868
72995
|
const timeSpendForLesson = ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0);
|
|
72869
|
-
dispatchLessonEndEvent(totalIndex, gameScore.rightMoves, gameScore.wrongMoves, finalScore, timeSpendForLesson);
|
|
72996
|
+
dispatchLessonEndEvent(totalIndex, gameScore.rightMoves, gameScore.wrongMoves, finalScore, timeSpendForLesson, lessonTrackingParams);
|
|
72870
72997
|
localStorage.removeItem(ActivityScoreKey);
|
|
72871
72998
|
}
|
|
72872
72999
|
};
|
|
@@ -73056,6 +73183,11 @@ const triggerNextContainer = () => {
|
|
|
73056
73183
|
// const event = new CustomEvent('nextContainer');
|
|
73057
73184
|
console.log('🚀 ~ triggerNextContainer ~ event:', event);
|
|
73058
73185
|
// window.dispatchEvent(event);
|
|
73186
|
+
const lidoHome = document.querySelector('.lido-home');
|
|
73187
|
+
if (lidoHome && (getLessonTrackingParams().end === "blank" || getLessonTrackingParams().end === "complete" || getLessonTrackingParams().end === "completed") && Number(lidoHome.getAttribute('index')) >= Number(lidoHome.getAttribute('totalIndex')) - 1) {
|
|
73188
|
+
console.log('🚀 ~ triggerNextContainer ~ lidoHome:', lidoHome);
|
|
73189
|
+
return;
|
|
73190
|
+
}
|
|
73059
73191
|
dispatchNextContainerEvent();
|
|
73060
73192
|
};
|
|
73061
73193
|
const triggerPrevcontainer = () => {
|
|
@@ -73063,16 +73195,35 @@ const triggerPrevcontainer = () => {
|
|
|
73063
73195
|
console.log('⬅️ ~ triggerPrevContainer triggered');
|
|
73064
73196
|
dispatchPrevContainerEvent();
|
|
73065
73197
|
};
|
|
73198
|
+
let activeZipAssets;
|
|
73199
|
+
function setActiveZipAssets(zipAssets) {
|
|
73200
|
+
activeZipAssets = zipAssets;
|
|
73201
|
+
}
|
|
73202
|
+
function clearActiveZipAssets() {
|
|
73203
|
+
activeZipAssets = undefined;
|
|
73204
|
+
}
|
|
73066
73205
|
function convertUrlToRelative(url) {
|
|
73067
73206
|
const container = document.getElementById(LidoContainer);
|
|
73068
|
-
const baseUrl = container.getAttribute('baseUrl');
|
|
73207
|
+
const baseUrl = container === null || container === void 0 ? void 0 : container.getAttribute('baseUrl');
|
|
73208
|
+
const zipAssets = activeZipAssets;
|
|
73069
73209
|
if ((url === null || url === void 0 ? void 0 : url.startsWith('http')) || (url === null || url === void 0 ? void 0 : url.startsWith('blob')) || (url === null || url === void 0 ? void 0 : url.startsWith('data'))) {
|
|
73070
73210
|
return url;
|
|
73071
73211
|
}
|
|
73072
73212
|
if (url.startsWith('/Lido-CommonAudios/')) {
|
|
73073
73213
|
return url;
|
|
73074
73214
|
}
|
|
73075
|
-
if (
|
|
73215
|
+
if (zipAssets) {
|
|
73216
|
+
const normalizedUrl = url.replace(/^\.\/?/, '');
|
|
73217
|
+
const directMatch = zipAssets[url] || zipAssets[normalizedUrl];
|
|
73218
|
+
if (directMatch) {
|
|
73219
|
+
return directMatch;
|
|
73220
|
+
}
|
|
73221
|
+
const suffixMatch = Object.keys(zipAssets).find(assetKey => assetKey === normalizedUrl || assetKey.endsWith(`/${normalizedUrl}`));
|
|
73222
|
+
if (suffixMatch) {
|
|
73223
|
+
return zipAssets[suffixMatch];
|
|
73224
|
+
}
|
|
73225
|
+
}
|
|
73226
|
+
if (!zipAssets && baseUrl) {
|
|
73076
73227
|
const newUrl = url.startsWith('/') ? url.slice(1) : url;
|
|
73077
73228
|
if (newUrl.startsWith(baseUrl.replace(/^\/+|\/+$/g, '')))
|
|
73078
73229
|
return newUrl;
|
|
@@ -73751,6 +73902,8 @@ exports.Timer = Timer;
|
|
|
73751
73902
|
exports.attachSpeakIcon = attachSpeakIcon;
|
|
73752
73903
|
exports.calculateScale = calculateScale;
|
|
73753
73904
|
exports.calculateScore = calculateScore;
|
|
73905
|
+
exports.clearActiveZipAssets = clearActiveZipAssets;
|
|
73906
|
+
exports.commonjsGlobal = commonjsGlobal;
|
|
73754
73907
|
exports.convertUrlToRelative = convertUrlToRelative;
|
|
73755
73908
|
exports.dispatchActivityChangeEvent = dispatchActivityChangeEvent;
|
|
73756
73909
|
exports.dispatchGameCompletedEvent = dispatchGameCompletedEvent;
|
|
@@ -73774,6 +73927,7 @@ exports.nextUrl = nextUrl;
|
|
|
73774
73927
|
exports.parseProp = parseProp;
|
|
73775
73928
|
exports.prevUrl = prevUrl;
|
|
73776
73929
|
exports.resetFloatState = resetFloatState;
|
|
73930
|
+
exports.setActiveZipAssets = setActiveZipAssets;
|
|
73777
73931
|
exports.setCancelBtnPopup = setCancelBtnPopup;
|
|
73778
73932
|
exports.setVisibilityWithDelay = setVisibilityWithDelay;
|
|
73779
73933
|
exports.speakIcon = speakIcon;
|