lido-player 0.0.2-beta-03 → 0.0.2-beta-04
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-CjtxAc2C.js → decode-BIc1HvkD.js} +1 -1
- package/dist/cjs/{index-Bt9s5WYs.js → index-DuRRRFVg.js} +27 -5
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +5 -5
- package/dist/collection/components/home/lido-home.js +2 -2
- package/dist/collection/utils/constants.js +8 -2
- package/dist/collection/utils/customEvents.js +14 -2
- package/dist/collection/utils/i18n.js +2 -2
- package/dist/collection/utils/utils.js +7 -2
- package/dist/components/index.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-container.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-root.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/{p-B_jNkxEx.js → p-9181ML6I.js} +1 -1
- package/dist/components/{p-D23sDjqf.js → p-BD1sZ63-.js} +1 -1
- package/dist/components/{p-BfMfgi8h.js → p-CADVkDjz.js} +1 -1
- package/dist/components/{p-BPsom7z0.js → p-DOERS2Qe.js} +1 -1
- package/dist/components/{p-C9eb2B-B.js → p-I53930CY.js} +1 -1
- package/dist/components/p-igIX0BGC.js +12 -0
- package/dist/esm/{decode-DN6duCrB.js → decode-MJThiDx2.js} +1 -1
- package/dist/esm/{index-Bfvjs1z9.js → index-K2hcd53I.js} +28 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +5 -5
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-4385c137.entry.js +12 -0
- package/dist/lido-player/p-BJqlkwHq.js +1 -0
- package/dist/lido-player/{p-DngrRzrw.js → p-OfmKwIbR.js} +1 -1
- package/dist/types/utils/constants.d.ts +8 -2
- package/package.json +1 -1
- package/dist/components/p-BHtfrGiU.js +0 -12
- package/dist/lido-player/p-94ee3a4f.entry.js +0 -12
- package/dist/lido-player/p-DXsy15Ek.js +0 -1
|
@@ -22,6 +22,10 @@ const LIDO_COMMON_AUDIO_PATH = '__LIDO_COMMON_AUDIO_PATH__';
|
|
|
22
22
|
const LIDO_COMMON_AUDIO_READY_EVENT = 'lidoCommonAudioPathReady';
|
|
23
23
|
const TemplateID = 'template-id';
|
|
24
24
|
const CalculatorOk = 'calculator-ok';
|
|
25
|
+
const MicroProblemEndKey = 'problemEnd';
|
|
26
|
+
const MicroLessonEndKey = 'lessonEnd';
|
|
27
|
+
const MicroGameEndKey = 'gameEnd';
|
|
28
|
+
const MicroGameExitKey = 'gameExit';
|
|
25
29
|
exports.TraceMode = void 0;
|
|
26
30
|
(function (TraceMode) {
|
|
27
31
|
TraceMode["NoFlow"] = "noFlow";
|
|
@@ -32,6 +36,8 @@ exports.TraceMode = void 0;
|
|
|
32
36
|
})(exports.TraceMode || (exports.TraceMode = {}));
|
|
33
37
|
class GameScore {
|
|
34
38
|
constructor() {
|
|
39
|
+
this.totalRightMovesCount = 0;
|
|
40
|
+
this.totalWrongMovesCount = 0;
|
|
35
41
|
this.rightMoves = 0;
|
|
36
42
|
this.wrongMoves = 0;
|
|
37
43
|
this.finalScore = 0;
|
|
@@ -69,7 +75,7 @@ const FAST_WORDS_BY_LANG = {
|
|
|
69
75
|
'तो', 'को',
|
|
70
76
|
'है', 'था', 'थे',
|
|
71
77
|
]),
|
|
72
|
-
'
|
|
78
|
+
'kn': new Set([
|
|
73
79
|
'ಅದು', 'ಇದು',
|
|
74
80
|
'ನಲ್ಲಿ', 'ಮೇಲೆ',
|
|
75
81
|
'ಮತ್ತು', 'ಇದೆ',
|
|
@@ -97,7 +103,7 @@ const LANGUAGE_PROFILES = {
|
|
|
97
103
|
fastWordMultiplier: 0.9, // much weaker compression
|
|
98
104
|
fastClusterMultiplier: 0.9,
|
|
99
105
|
},
|
|
100
|
-
'
|
|
106
|
+
'kn': {
|
|
101
107
|
expectedWPM: 85,
|
|
102
108
|
minWordMs: 35,
|
|
103
109
|
syllableWeight: 1.75,
|
|
@@ -114,7 +120,7 @@ function dispatchCustomEvent(eventName, detail) {
|
|
|
114
120
|
console.log("👍Event Name : ", eventName, "Detail : ", detail.toString());
|
|
115
121
|
const event = new CustomEvent(eventName, { detail });
|
|
116
122
|
window.dispatchEvent(event);
|
|
117
|
-
if (eventName === ActivityEndKey || eventName === LessonEndKey || eventName === GameCompletedKey || eventName === GameExitKey) {
|
|
123
|
+
if (eventName === ActivityEndKey || eventName === LessonEndKey || eventName === GameCompletedKey || eventName === GameExitKey || eventName === MicroGameEndKey || eventName === MicroGameExitKey || eventName === MicroLessonEndKey || eventName === MicroProblemEndKey) {
|
|
118
124
|
(_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
119
125
|
eventName,
|
|
120
126
|
detail: toSerializableDetail(detail),
|
|
@@ -133,8 +139,10 @@ function toSerializableDetail(detail) {
|
|
|
133
139
|
}
|
|
134
140
|
function dispatchActivityEndEvent(totalIndex, currentIndex, score, rightMoves, wrongMoves, timeSpentForActivity, lessonTrackingParams, gameCompleted) {
|
|
135
141
|
dispatchCustomEvent(ActivityEndKey, Object.assign(Object.assign({ currentIndex, totalIndex, score, rightMoves, wrongMoves, timeSpentForActivity }, lessonTrackingParams), { gameCompleted }));
|
|
142
|
+
dispatchCustomEvent(MicroProblemEndKey, Object.assign(Object.assign({ currentIndex, totalIndex, score, rightMoves, wrongMoves, timeSpentForActivity }, lessonTrackingParams), { gameCompleted }));
|
|
136
143
|
}
|
|
137
144
|
function dispatchLessonEndEvent(totalIndex, rightMoves, wrongMoves, finalScore, timeSpendForLesson, lessonTrackingParams) {
|
|
145
|
+
dispatchCustomEvent(MicroLessonEndKey, Object.assign({ totalIndex, rightMoves, wrongMoves, finalScore, score: finalScore, timeSpendForLesson }, lessonTrackingParams));
|
|
138
146
|
if (getLessonTrackingParams().end === "blank" || getLessonTrackingParams().end === "complete" || getLessonTrackingParams().end === "completed") {
|
|
139
147
|
console.log("Lesson end event skipped. Reason: Lesson end type is set to 'blank' in lesson tracking parameters.");
|
|
140
148
|
return;
|
|
@@ -148,9 +156,19 @@ function dispatchPrevContainerEvent() {
|
|
|
148
156
|
dispatchCustomEvent(PrevContainerKey, {});
|
|
149
157
|
}
|
|
150
158
|
function dispatchGameCompletedEvent() {
|
|
159
|
+
dispatchCustomEvent(MicroGameEndKey, {});
|
|
160
|
+
if (getLessonTrackingParams().end === "blank" || getLessonTrackingParams().end === "complete" || getLessonTrackingParams().end === "completed") {
|
|
161
|
+
console.log("Game end event skipped. Reason: Lesson end type is set to 'blank' in lesson tracking parameters.");
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
151
164
|
dispatchCustomEvent(GameCompletedKey, {});
|
|
152
165
|
}
|
|
153
166
|
function dispatchGameExitEvent() {
|
|
167
|
+
dispatchCustomEvent(MicroGameExitKey, {});
|
|
168
|
+
if (getLessonTrackingParams().end === "blank" || getLessonTrackingParams().end === "complete" || getLessonTrackingParams().end === "completed") {
|
|
169
|
+
console.log("Game exit event skipped. Reason: Lesson end type is set to 'blank' in lesson tracking parameters.");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
154
172
|
dispatchCustomEvent(GameExitKey, {});
|
|
155
173
|
}
|
|
156
174
|
function dispatchActivityChangeEvent(index) {
|
|
@@ -72883,6 +72901,8 @@ const calculateScore = () => {
|
|
|
72883
72901
|
}
|
|
72884
72902
|
const rightMoves = gameScore.rightMoves;
|
|
72885
72903
|
const wrongMoves = gameScore.wrongMoves;
|
|
72904
|
+
gameScore.totalRightMovesCount += rightMoves;
|
|
72905
|
+
gameScore.totalWrongMovesCount += wrongMoves;
|
|
72886
72906
|
let finalScore = Math.floor((rightMoves / (rightMoves + wrongMoves)) * 100);
|
|
72887
72907
|
storeActivityScore(finalScore);
|
|
72888
72908
|
gameScore.rightMoves = 0;
|
|
@@ -72993,7 +73013,10 @@ const storeActivityScore = (score) => {
|
|
|
72993
73013
|
console.log('Total Score : ', gameScore.finalScore);
|
|
72994
73014
|
// window.dispatchEvent(new CustomEvent(LessonEndKey, { detail: { score: finalScore } }));
|
|
72995
73015
|
const timeSpendForLesson = ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0);
|
|
72996
|
-
dispatchLessonEndEvent(totalIndex, gameScore.
|
|
73016
|
+
dispatchLessonEndEvent(totalIndex, gameScore.totalRightMovesCount, gameScore.totalWrongMovesCount, finalScore, timeSpendForLesson, lessonTrackingParams);
|
|
73017
|
+
gameScore.totalRightMovesCount = 0;
|
|
73018
|
+
gameScore.totalWrongMovesCount = 0;
|
|
73019
|
+
dispatchGameCompletedEvent();
|
|
72997
73020
|
localStorage.removeItem(ActivityScoreKey);
|
|
72998
73021
|
}
|
|
72999
73022
|
};
|
|
@@ -73906,7 +73929,6 @@ exports.clearActiveZipAssets = clearActiveZipAssets;
|
|
|
73906
73929
|
exports.commonjsGlobal = commonjsGlobal;
|
|
73907
73930
|
exports.convertUrlToRelative = convertUrlToRelative;
|
|
73908
73931
|
exports.dispatchActivityChangeEvent = dispatchActivityChangeEvent;
|
|
73909
|
-
exports.dispatchGameCompletedEvent = dispatchGameCompletedEvent;
|
|
73910
73932
|
exports.dispatchGameExitEvent = dispatchGameExitEvent;
|
|
73911
73933
|
exports.equationCheck = equationCheck;
|
|
73912
73934
|
exports.executeActions = executeActions;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-Bsk4M2Qz.js');
|
|
4
|
-
var index$1 = require('./index-
|
|
4
|
+
var index$1 = require('./index-DuRRRFVg.js');
|
|
5
5
|
|
|
6
6
|
var rive$1 = {exports: {}};
|
|
7
7
|
|
|
@@ -11837,7 +11837,7 @@ const instruction$1 = {
|
|
|
11837
11837
|
palegrawordmatch: "palegrawordmatchKaAudio",
|
|
11838
11838
|
palegramcqimages: "palegramcqimagesKaAudio"
|
|
11839
11839
|
};
|
|
11840
|
-
var
|
|
11840
|
+
var kn = {
|
|
11841
11841
|
"Do you want to exit?": "ನೀವು ನಿರ್ಗಮಿಸಲು ಬಯಸುವಿರಾ?",
|
|
11842
11842
|
Exit: Exit$2,
|
|
11843
11843
|
"Continue playing": "ಆಟವನ್ನು ಮುಂದುವರಿಸಿ",
|
|
@@ -11881,7 +11881,7 @@ instance
|
|
|
11881
11881
|
en: { translation: en },
|
|
11882
11882
|
fr: { translation: fr },
|
|
11883
11883
|
hi: { translation: hi },
|
|
11884
|
-
|
|
11884
|
+
kn: { translation: kn },
|
|
11885
11885
|
te: { translation: te },
|
|
11886
11886
|
port: { translation: port },
|
|
11887
11887
|
ma: { translation: ma },
|
|
@@ -12726,7 +12726,7 @@ const LidoHome = class {
|
|
|
12726
12726
|
// const event = new CustomEvent('gameCompleted');
|
|
12727
12727
|
// window.dispatchEvent(event);
|
|
12728
12728
|
localStorage.removeItem(index$1.ActivityScoreKey);
|
|
12729
|
-
|
|
12729
|
+
// dispatchGameCompletedEvent();
|
|
12730
12730
|
this.currentContainerIndex = null;
|
|
12731
12731
|
}
|
|
12732
12732
|
// Reset the containers array to trigger a re-render
|
|
@@ -12928,7 +12928,7 @@ const LidoHome = class {
|
|
|
12928
12928
|
}
|
|
12929
12929
|
// Pure-JS fallback (no wasm asset required)
|
|
12930
12930
|
try {
|
|
12931
|
-
const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-
|
|
12931
|
+
const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-BIc1HvkD.js'); }).then(function (n) { return n.decode; });
|
|
12932
12932
|
const brotliDecompressBuffer = brotliDecodeModule.BrotliDecompressBuffer || ((_a = brotliDecodeModule.default) === null || _a === void 0 ? void 0 : _a.BrotliDecompressBuffer);
|
|
12933
12933
|
if (typeof brotliDecompressBuffer !== 'function') {
|
|
12934
12934
|
throw new Error('BrotliDecompressBuffer function not found in brotli/dec/decode');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, Host, getAssetPath } from "@stencil/core";
|
|
2
2
|
import JSZip from "jszip";
|
|
3
3
|
import { SelectedValuesKey, NextContainerKey, PrevContainerKey, LidoContainer, exitUrl, prevUrl, nextUrl, speakUrl, ActivityScoreKey, LIDO_COMMON_AUDIO_PATH, TemplateID, } from "../../utils/constants";
|
|
4
|
-
import { dispatchActivityChangeEvent,
|
|
4
|
+
import { dispatchActivityChangeEvent, dispatchGameExitEvent } from "../../utils/customEvents";
|
|
5
5
|
import { calculateScale, getCancelBtnPopup, setCancelBtnPopup, executeActions, triggerPrevcontainer, convertUrlToRelative, triggerNextContainer, matchStringPattern, setActiveZipAssets, clearActiveZipAssets, } from "../../utils/utils";
|
|
6
6
|
import { AudioPlayer } from "../../utils/audioPlayer";
|
|
7
7
|
import { generateUUIDFallback } from "../../utils/utils";
|
|
@@ -106,7 +106,7 @@ export class LidoHome {
|
|
|
106
106
|
// const event = new CustomEvent('gameCompleted');
|
|
107
107
|
// window.dispatchEvent(event);
|
|
108
108
|
localStorage.removeItem(ActivityScoreKey);
|
|
109
|
-
dispatchGameCompletedEvent();
|
|
109
|
+
// dispatchGameCompletedEvent();
|
|
110
110
|
this.currentContainerIndex = null;
|
|
111
111
|
}
|
|
112
112
|
// Reset the containers array to trigger a re-render
|
|
@@ -21,6 +21,10 @@ export const LIDO_COMMON_AUDIO_PATH = '__LIDO_COMMON_AUDIO_PATH__';
|
|
|
21
21
|
export const LIDO_COMMON_AUDIO_READY_EVENT = 'lidoCommonAudioPathReady';
|
|
22
22
|
export const TemplateID = 'template-id';
|
|
23
23
|
export const CalculatorOk = 'calculator-ok';
|
|
24
|
+
export const MicroProblemEndKey = 'problemEnd';
|
|
25
|
+
export const MicroLessonEndKey = 'lessonEnd';
|
|
26
|
+
export const MicroGameEndKey = 'gameEnd';
|
|
27
|
+
export const MicroGameExitKey = 'gameExit';
|
|
24
28
|
export var TraceMode;
|
|
25
29
|
(function (TraceMode) {
|
|
26
30
|
TraceMode["NoFlow"] = "noFlow";
|
|
@@ -31,6 +35,8 @@ export var TraceMode;
|
|
|
31
35
|
})(TraceMode || (TraceMode = {}));
|
|
32
36
|
export default class GameScore {
|
|
33
37
|
constructor() {
|
|
38
|
+
this.totalRightMovesCount = 0;
|
|
39
|
+
this.totalWrongMovesCount = 0;
|
|
34
40
|
this.rightMoves = 0;
|
|
35
41
|
this.wrongMoves = 0;
|
|
36
42
|
this.finalScore = 0;
|
|
@@ -68,7 +74,7 @@ export const FAST_WORDS_BY_LANG = {
|
|
|
68
74
|
'तो', 'को',
|
|
69
75
|
'है', 'था', 'थे',
|
|
70
76
|
]),
|
|
71
|
-
'
|
|
77
|
+
'kn': new Set([
|
|
72
78
|
'ಅದು', 'ಇದು',
|
|
73
79
|
'ನಲ್ಲಿ', 'ಮೇಲೆ',
|
|
74
80
|
'ಮತ್ತು', 'ಇದೆ',
|
|
@@ -96,7 +102,7 @@ export const LANGUAGE_PROFILES = {
|
|
|
96
102
|
fastWordMultiplier: 0.9, // much weaker compression
|
|
97
103
|
fastClusterMultiplier: 0.9,
|
|
98
104
|
},
|
|
99
|
-
'
|
|
105
|
+
'kn': {
|
|
100
106
|
expectedWPM: 85,
|
|
101
107
|
minWordMs: 35,
|
|
102
108
|
syllableWeight: 1.75,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ActivityChangeKey, ActivityEndKey, ElementClickKey, ElementDropKey, GameCompletedKey, GameExitKey, LessonEndKey, NextContainerKey, PrevContainerKey } from "./constants";
|
|
1
|
+
import { ActivityChangeKey, ActivityEndKey, ElementClickKey, ElementDropKey, GameCompletedKey, GameExitKey, LessonEndKey, MicroGameEndKey, MicroGameExitKey, MicroLessonEndKey, MicroProblemEndKey, NextContainerKey, PrevContainerKey } from "./constants";
|
|
2
2
|
import { getLessonTrackingParams } from "./utils";
|
|
3
3
|
function dispatchCustomEvent(eventName, detail) {
|
|
4
4
|
var _a;
|
|
5
5
|
console.log("👍Event Name : ", eventName, "Detail : ", detail.toString());
|
|
6
6
|
const event = new CustomEvent(eventName, { detail });
|
|
7
7
|
window.dispatchEvent(event);
|
|
8
|
-
if (eventName === ActivityEndKey || eventName === LessonEndKey || eventName === GameCompletedKey || eventName === GameExitKey) {
|
|
8
|
+
if (eventName === ActivityEndKey || eventName === LessonEndKey || eventName === GameCompletedKey || eventName === GameExitKey || eventName === MicroGameEndKey || eventName === MicroGameExitKey || eventName === MicroLessonEndKey || eventName === MicroProblemEndKey) {
|
|
9
9
|
(_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
10
10
|
eventName,
|
|
11
11
|
detail: toSerializableDetail(detail),
|
|
@@ -24,8 +24,10 @@ function toSerializableDetail(detail) {
|
|
|
24
24
|
}
|
|
25
25
|
export function dispatchActivityEndEvent(totalIndex, currentIndex, score, rightMoves, wrongMoves, timeSpentForActivity, lessonTrackingParams, gameCompleted) {
|
|
26
26
|
dispatchCustomEvent(ActivityEndKey, Object.assign(Object.assign({ currentIndex, totalIndex, score, rightMoves, wrongMoves, timeSpentForActivity }, lessonTrackingParams), { gameCompleted }));
|
|
27
|
+
dispatchCustomEvent(MicroProblemEndKey, Object.assign(Object.assign({ currentIndex, totalIndex, score, rightMoves, wrongMoves, timeSpentForActivity }, lessonTrackingParams), { gameCompleted }));
|
|
27
28
|
}
|
|
28
29
|
export function dispatchLessonEndEvent(totalIndex, rightMoves, wrongMoves, finalScore, timeSpendForLesson, lessonTrackingParams) {
|
|
30
|
+
dispatchCustomEvent(MicroLessonEndKey, Object.assign({ totalIndex, rightMoves, wrongMoves, finalScore, score: finalScore, timeSpendForLesson }, lessonTrackingParams));
|
|
29
31
|
if (getLessonTrackingParams().end === "blank" || getLessonTrackingParams().end === "complete" || getLessonTrackingParams().end === "completed") {
|
|
30
32
|
console.log("Lesson end event skipped. Reason: Lesson end type is set to 'blank' in lesson tracking parameters.");
|
|
31
33
|
return;
|
|
@@ -39,9 +41,19 @@ export function dispatchPrevContainerEvent() {
|
|
|
39
41
|
dispatchCustomEvent(PrevContainerKey, {});
|
|
40
42
|
}
|
|
41
43
|
export function dispatchGameCompletedEvent() {
|
|
44
|
+
dispatchCustomEvent(MicroGameEndKey, {});
|
|
45
|
+
if (getLessonTrackingParams().end === "blank" || getLessonTrackingParams().end === "complete" || getLessonTrackingParams().end === "completed") {
|
|
46
|
+
console.log("Game end event skipped. Reason: Lesson end type is set to 'blank' in lesson tracking parameters.");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
42
49
|
dispatchCustomEvent(GameCompletedKey, {});
|
|
43
50
|
}
|
|
44
51
|
export function dispatchGameExitEvent() {
|
|
52
|
+
dispatchCustomEvent(MicroGameExitKey, {});
|
|
53
|
+
if (getLessonTrackingParams().end === "blank" || getLessonTrackingParams().end === "complete" || getLessonTrackingParams().end === "completed") {
|
|
54
|
+
console.log("Game exit event skipped. Reason: Lesson end type is set to 'blank' in lesson tracking parameters.");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
45
57
|
dispatchCustomEvent(GameExitKey, {});
|
|
46
58
|
}
|
|
47
59
|
export function dispatchActivityChangeEvent(index) {
|
|
@@ -4,7 +4,7 @@ import LanguageDetector from "i18next-browser-languagedetector";
|
|
|
4
4
|
import en from "../i18n/en.json";
|
|
5
5
|
import fr from "../i18n/fr.json";
|
|
6
6
|
import hi from "../i18n/hi.json";
|
|
7
|
-
import
|
|
7
|
+
import kn from "../i18n/kn.json";
|
|
8
8
|
import te from "../i18n/te.json";
|
|
9
9
|
import port from "../i18n/port.json";
|
|
10
10
|
import ma from "../i18n/ma.json";
|
|
@@ -15,7 +15,7 @@ i18next
|
|
|
15
15
|
en: { translation: en },
|
|
16
16
|
fr: { translation: fr },
|
|
17
17
|
hi: { translation: hi },
|
|
18
|
-
|
|
18
|
+
kn: { translation: kn },
|
|
19
19
|
te: { translation: te },
|
|
20
20
|
port: { translation: port },
|
|
21
21
|
ma: { translation: ma },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActivityScoreKey, DragMapKey, SelectedValuesKey, DropMode, DropToAttr, DropTimeAttr, LidoContainer, DropAction, CalculatorOk } from "./constants";
|
|
2
|
-
import { dispatchActivityEndEvent, dispatchLessonEndEvent, dispatchNextContainerEvent, dispatchPrevContainerEvent } from "./customEvents";
|
|
2
|
+
import { dispatchActivityEndEvent, dispatchGameCompletedEvent, dispatchLessonEndEvent, dispatchNextContainerEvent, dispatchPrevContainerEvent } from "./customEvents";
|
|
3
3
|
import GameScore from "./constants";
|
|
4
4
|
import { RiveService } from "./rive-service";
|
|
5
5
|
import { getAssetPath } from "@stencil/core";
|
|
@@ -601,6 +601,8 @@ export const calculateScore = () => {
|
|
|
601
601
|
}
|
|
602
602
|
const rightMoves = gameScore.rightMoves;
|
|
603
603
|
const wrongMoves = gameScore.wrongMoves;
|
|
604
|
+
gameScore.totalRightMovesCount += rightMoves;
|
|
605
|
+
gameScore.totalWrongMovesCount += wrongMoves;
|
|
604
606
|
let finalScore = Math.floor((rightMoves / (rightMoves + wrongMoves)) * 100);
|
|
605
607
|
storeActivityScore(finalScore);
|
|
606
608
|
gameScore.rightMoves = 0;
|
|
@@ -711,7 +713,10 @@ const storeActivityScore = (score) => {
|
|
|
711
713
|
console.log('Total Score : ', gameScore.finalScore);
|
|
712
714
|
// window.dispatchEvent(new CustomEvent(LessonEndKey, { detail: { score: finalScore } }));
|
|
713
715
|
const timeSpendForLesson = ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0);
|
|
714
|
-
dispatchLessonEndEvent(totalIndex, gameScore.
|
|
716
|
+
dispatchLessonEndEvent(totalIndex, gameScore.totalRightMovesCount, gameScore.totalWrongMovesCount, finalScore, timeSpendForLesson, lessonTrackingParams);
|
|
717
|
+
gameScore.totalRightMovesCount = 0;
|
|
718
|
+
gameScore.totalWrongMovesCount = 0;
|
|
719
|
+
dispatchGameCompletedEvent();
|
|
715
720
|
localStorage.removeItem(ActivityScoreKey);
|
|
716
721
|
}
|
|
717
722
|
};
|