From 6c1f57f94538f15c2be0357afcf4981ef21cdab2 Mon Sep 17 00:00:00 2001 From: Rajnish Dargan Date: Fri, 15 Dec 2023 15:08:01 +0530 Subject: [PATCH 1/3] Issue #IQ-567 fix: Error Event is generated on Telemetry while preview the Question set --- projects/quml-library/package-lock.json | 8 ++++---- projects/quml-library/package.json | 4 ++-- projects/quml-library/src/lib/player-constants.ts | 4 ++++ projects/quml-library/src/lib/quml-library.module.ts | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/projects/quml-library/package-lock.json b/projects/quml-library/package-lock.json index c4c3f97b..79882778 100644 --- a/projects/quml-library/package-lock.json +++ b/projects/quml-library/package-lock.json @@ -1,13 +1,13 @@ { "name": "@project-sunbird/sunbird-quml-player", - "version": "6.0.0-beta.1", + "version": "7.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { "@project-sunbird/sunbird-player-sdk-v9": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@project-sunbird/sunbird-player-sdk-v9/-/sunbird-player-sdk-v9-5.1.0.tgz", - "integrity": "sha512-Vg3MXOkBC7c1px9pTX58T0wqkseLAw0kWLflA8CpttIUQYFJBxxu5wEB8z8Y5zb6zDFrykxWRbPEcbdYdfOKRw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@project-sunbird/sunbird-player-sdk-v9/-/sunbird-player-sdk-v9-6.0.0.tgz", + "integrity": "sha512-E8ybY5ulxZ7NyBq3Suljz1LsyXHeFsmdJ2NbNZLHKY5WpBF6qtOQDtpjINPTMAPOqlOpR7xAcVMoPxCuP82RGw==", "requires": { "ally.js": "1.4.1" } diff --git a/projects/quml-library/package.json b/projects/quml-library/package.json index 56f7ab14..2787ce72 100644 --- a/projects/quml-library/package.json +++ b/projects/quml-library/package.json @@ -1,6 +1,6 @@ { "name": "@project-sunbird/sunbird-quml-player", - "version": "7.0.0", + "version": "7.0.1", "schematics": "./schematics/collection.json", "ng-add": { "save": "dependencies" @@ -18,7 +18,7 @@ "@project-sunbird/client-services": "4.9.1" }, "dependencies": { - "@project-sunbird/sunbird-player-sdk-v9": "5.1.0" + "@project-sunbird/sunbird-player-sdk-v9": "6.0.0" }, "devDependencies": { "copyfiles": "2.4.1", diff --git a/projects/quml-library/src/lib/player-constants.ts b/projects/quml-library/src/lib/player-constants.ts index 33757afc..5d0e666b 100644 --- a/projects/quml-library/src/lib/player-constants.ts +++ b/projects/quml-library/src/lib/player-constants.ts @@ -3,4 +3,8 @@ export const DEFAULT_SCORE: number = 1; export const WARNING_TIME_CONFIG = { DEFAULT_TIME : 75, SHOW_TIMER: true +} + +export const PLAYER_COMPATABILITY_CONFIG = { + contentCompatibilityLevel: 6 } \ No newline at end of file diff --git a/projects/quml-library/src/lib/quml-library.module.ts b/projects/quml-library/src/lib/quml-library.module.ts index e08a1209..347e3c0e 100644 --- a/projects/quml-library/src/lib/quml-library.module.ts +++ b/projects/quml-library/src/lib/quml-library.module.ts @@ -38,7 +38,7 @@ import { SafeHtmlPipe } from './pipes/safe-html/safe-html.pipe'; import { MainPlayerComponent } from './main-player/main-player.component'; import { SectionPlayerComponent } from './section-player/section-player.component'; import { ProgressIndicatorsComponent } from './progress-indicators/progress-indicators.component' - +import { PLAYER_COMPATABILITY_CONFIG } from './player-constants'; @NgModule({ declarations: [ QumlLibraryComponent, @@ -80,7 +80,7 @@ import { ProgressIndicatorsComponent } from './progress-indicators/progress-indi imports: [ CommonModule, CarouselModule, - SunbirdPlayerSdkModule + SunbirdPlayerSdkModule.forRoot(PLAYER_COMPATABILITY_CONFIG) ], providers: [ QumlLibraryService From 0c14e41bee20cb5be26b8db1a5c41558bb051905 Mon Sep 17 00:00:00 2001 From: Rajnish Dargan Date: Fri, 15 Dec 2023 15:37:21 +0530 Subject: [PATCH 2/3] Issue #IQ-567 fix: test case fix --- .../src/lib/main-player/main-player.component.spec.ts | 3 ++- .../lib/section-player/section-player.component.spec.ts | 8 +++++--- projects/quml-player-wc/src/app/app.module.ts | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/projects/quml-library/src/lib/main-player/main-player.component.spec.ts b/projects/quml-library/src/lib/main-player/main-player.component.spec.ts index 759e562a..eb0ae510 100644 --- a/projects/quml-library/src/lib/main-player/main-player.component.spec.ts +++ b/projects/quml-library/src/lib/main-player/main-player.component.spec.ts @@ -11,6 +11,7 @@ import { TransformationService } from '../services/transformation-service/transf import { fakeMainProgressBar, fakeSections, playerConfig, singleContent } from './main-player.component.spec.data'; import { UtilService } from '../util-service'; import { of } from 'rxjs'; +import { PLAYER_COMPATABILITY_CONFIG } from '../player-constants'; describe('MainPlayerComponent', () => { let component: MainPlayerComponent; @@ -24,7 +25,7 @@ describe('MainPlayerComponent', () => { TestBed.configureTestingModule({ declarations: [MainPlayerComponent], imports: [ - SunbirdPlayerSdkModule, + SunbirdPlayerSdkModule.forRoot(PLAYER_COMPATABILITY_CONFIG), CommonModule ], providers: [QumlLibraryService, QuestionCursor], diff --git a/projects/quml-library/src/lib/section-player/section-player.component.spec.ts b/projects/quml-library/src/lib/section-player/section-player.component.spec.ts index d3a336e0..bd1e4865 100644 --- a/projects/quml-library/src/lib/section-player/section-player.component.spec.ts +++ b/projects/quml-library/src/lib/section-player/section-player.component.spec.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { ElementRef, EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core'; import { waitForAsync, ComponentFixture, fakeAsync, flush, TestBed, tick } from '@angular/core/testing'; -import { ErrorService } from '@project-sunbird/sunbird-player-sdk-v9'; +import { ErrorService, SunbirdPlayerSdkModule } from '@project-sunbird/sunbird-player-sdk-v9'; import { CarouselComponent } from 'ngx-bootstrap/carousel'; import { of, Subject } from 'rxjs'; import { fakeMainProgressBar } from '../main-player/main-player.component.spec.data'; @@ -11,6 +11,7 @@ import { UtilService } from '../util-service'; import { QuestionCursor } from './../quml-question-cursor.service'; import { SectionPlayerComponent } from './section-player.component'; import { mockSectionPlayerConfig } from './section-player.component.spec.data'; +import { PLAYER_COMPATABILITY_CONFIG } from '../player-constants'; describe('SectionPlayerComponent', () => { @@ -51,13 +52,14 @@ describe('SectionPlayerComponent', () => { TestBed.configureTestingModule({ declarations: [SectionPlayerComponent, CarouselComponent], imports: [ - CommonModule + CommonModule, + SunbirdPlayerSdkModule.forRoot(PLAYER_COMPATABILITY_CONFIG) ], providers: [ QumlLibraryService, QuestionCursor, { provide: ViewerService, useClass: ViewerServiceMock }, - { provide: ElementRef, useClass: ElementRefMock }, + { provide: ElementRef, useClass: ElementRefMock } ], schemas: [NO_ERRORS_SCHEMA] }) diff --git a/projects/quml-player-wc/src/app/app.module.ts b/projects/quml-player-wc/src/app/app.module.ts index bbe8ab26..410a964b 100644 --- a/projects/quml-player-wc/src/app/app.module.ts +++ b/projects/quml-player-wc/src/app/app.module.ts @@ -42,6 +42,7 @@ import { QuestionCursor } from '../../../quml-library/src/lib/quml-question-curs import { QuestionCursorImplementationService } from './question-cursor-implementation.service'; import { HttpClientModule } from '@angular/common/http'; import { ProgressIndicatorsComponent } from '../../../quml-library/src/lib/progress-indicators/progress-indicators.component'; +import { PLAYER_COMPATABILITY_CONFIG } from 'quml-library/lib/player-constants'; @NgModule({ declarations: [ @@ -85,7 +86,7 @@ import { ProgressIndicatorsComponent } from '../../../quml-library/src/lib/progr BrowserModule, CommonModule, CarouselModule.forRoot(), - SunbirdPlayerSdkModule, + SunbirdPlayerSdkModule.forRoot(PLAYER_COMPATABILITY_CONFIG), HttpClientModule ], providers: [{ provide: QuestionCursor, useClass: QuestionCursorImplementationService }] From 468393696c0096ed89445f6b4294b5cfde4094a6 Mon Sep 17 00:00:00 2001 From: Rajnish Dargan Date: Fri, 15 Dec 2023 15:59:48 +0530 Subject: [PATCH 3/3] Issue #IQ-567 fix: test case fix --- projects/quml-player-wc/src/app/app.module.ts | 3 +- web-component/package.json | 2 +- web-component/sunbird-quml-player.js | 216 +++++++++++------- 3 files changed, 132 insertions(+), 89 deletions(-) diff --git a/projects/quml-player-wc/src/app/app.module.ts b/projects/quml-player-wc/src/app/app.module.ts index 410a964b..8679f9c2 100644 --- a/projects/quml-player-wc/src/app/app.module.ts +++ b/projects/quml-player-wc/src/app/app.module.ts @@ -42,7 +42,6 @@ import { QuestionCursor } from '../../../quml-library/src/lib/quml-question-curs import { QuestionCursorImplementationService } from './question-cursor-implementation.service'; import { HttpClientModule } from '@angular/common/http'; import { ProgressIndicatorsComponent } from '../../../quml-library/src/lib/progress-indicators/progress-indicators.component'; -import { PLAYER_COMPATABILITY_CONFIG } from 'quml-library/lib/player-constants'; @NgModule({ declarations: [ @@ -86,7 +85,7 @@ import { PLAYER_COMPATABILITY_CONFIG } from 'quml-library/lib/player-constants'; BrowserModule, CommonModule, CarouselModule.forRoot(), - SunbirdPlayerSdkModule.forRoot(PLAYER_COMPATABILITY_CONFIG), + SunbirdPlayerSdkModule.forRoot({ contentCompatibilityLevel: 6 }), HttpClientModule ], providers: [{ provide: QuestionCursor, useClass: QuestionCursorImplementationService }] diff --git a/web-component/package.json b/web-component/package.json index c1224214..c572b91f 100644 --- a/web-component/package.json +++ b/web-component/package.json @@ -1,6 +1,6 @@ { "name": "@project-sunbird/sunbird-quml-player-web-component", - "version": "3.0.0", + "version": "3.0.1", "description": "The web component package for the sunbird QuML player", "main": "sunbird-quml-player.js", "scripts": { diff --git a/web-component/sunbird-quml-player.js b/web-component/sunbird-quml-player.js index c908af65..dec37651 100644 --- a/web-component/sunbird-quml-player.js +++ b/web-component/sunbird-quml-player.js @@ -13318,6 +13318,7 @@ module.exports = v4; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ErrorService": () => (/* binding */ ErrorService), +/* harmony export */ "PLAYER_CONFIG": () => (/* binding */ PLAYER_CONFIG), /* harmony export */ "SunbirdPlayerSdkModule": () => (/* binding */ SunbirdPlayerSdkModule), /* harmony export */ "errorCode": () => (/* binding */ errorCode), /* harmony export */ "errorMessage": () => (/* binding */ errorMessage), @@ -13675,90 +13676,6 @@ const errorMessage = { contentPlayFailTitle: "Refresh and try again later" }; -/** - * @fileoverview added by tsickle - * Generated from: lib/player-utils/service/error/error.service.ts - * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -class ErrorService { - constructor() { - this.playerContentCompatibiltyLevel = 5; - this.getInternetConnectivityError = new _angular_core__WEBPACK_IMPORTED_MODULE_1__.EventEmitter(); - this.setInternetConnectivityError = - /** - * @return {?} - */ - () => { - /** @type {?} */ - const internetConnectivityError = new Error(); - internetConnectivityError.message = errorMessage.internetConnectivity; - internetConnectivityError.name = errorCode.internetConnectivity; - this.getInternetConnectivityError.emit({ - error: internetConnectivityError - }); - }; - this.initInternetConnectivityError(); - } - /** - * @param {?} currentCompatibilityLevel - * @return {?} - */ - checkContentCompatibility(currentCompatibilityLevel) { - if (currentCompatibilityLevel > this.playerContentCompatibiltyLevel) { - /** @type {?} */ - const compatibilityError = new Error(); - compatibilityError.message = `Player supports ${this.playerContentCompatibiltyLevel} - but content compatibility is ${currentCompatibilityLevel}`; - compatibilityError.name = 'contentCompatibily'; - return { - error: compatibilityError, - isCompitable: false - }; - } else { - return { - error: null, - isCompitable: true - }; - } - } - /** - * @return {?} - */ - initInternetConnectivityError() { - window.addEventListener('offline', this.setInternetConnectivityError); - } - /** - * @return {?} - */ - ngOnDestroy() { - window.removeEventListener('offline', this.setInternetConnectivityError); - } -} -ErrorService.ɵfac = function ErrorService_Factory(t) { - return new (t || ErrorService)(); -}; -/** @nocollapse */ -ErrorService.ctorParameters = () => []; -/** @nocollapse */ -ErrorService.ɵprov = (0,_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵdefineInjectable"])({ - factory: function ErrorService_Factory() { - return new ErrorService(); - }, - token: ErrorService, - providedIn: "root" -}); -(function () { - (typeof ngDevMode === "undefined" || ngDevMode) && _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵsetClassMetadata"](ErrorService, [{ - type: _angular_core__WEBPACK_IMPORTED_MODULE_1__.Injectable, - args: [{ - providedIn: 'root' - }] - }], function () { - return []; - }, null); -})(); -if (false) {} - /** * @fileoverview added by tsickle * Generated from: lib/core/components/download-popup/download-popup.component.ts @@ -15050,7 +14967,23 @@ PlayerUtilsModule.ɵinj = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_1_ * Generated from: lib/sunbird-player-sdk.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ -class SunbirdPlayerSdkModule {} +/** @type {?} */ +const PLAYER_CONFIG = new _angular_core__WEBPACK_IMPORTED_MODULE_1__.InjectionToken('playerConfig'); +class SunbirdPlayerSdkModule { + /** + * @param {?=} config + * @return {?} + */ + static forRoot(config) { + return { + ngModule: SunbirdPlayerSdkModule, + providers: [{ + provide: PLAYER_CONFIG, + useValue: config + }] + }; + } +} SunbirdPlayerSdkModule.ɵfac = function SunbirdPlayerSdkModule_Factory(t) { return new (t || SunbirdPlayerSdkModule)(); }; @@ -15077,6 +15010,110 @@ SunbirdPlayerSdkModule.ɵinj = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODU }); })(); +/** + * @fileoverview added by tsickle + * Generated from: lib/player-utils/service/error/error.service.ts + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +class ErrorService { + /** + * @param {?=} config + */ + constructor(config) { + var _a, _b; + this.config = config; + this.playerContentCompatibiltyLevel = 5; + this.getInternetConnectivityError = new _angular_core__WEBPACK_IMPORTED_MODULE_1__.EventEmitter(); + this.setInternetConnectivityError = + /** + * @return {?} + */ + () => { + /** @type {?} */ + const internetConnectivityError = new Error(); + internetConnectivityError.message = errorMessage.internetConnectivity; + internetConnectivityError.name = errorCode.internetConnectivity; + this.getInternetConnectivityError.emit({ + error: internetConnectivityError + }); + }; + this.initInternetConnectivityError(); + if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.contentCompatibilityLevel) { + this.playerContentCompatibiltyLevel = (_b = this.config) === null || _b === void 0 ? void 0 : _b.contentCompatibilityLevel; + } + } + /** + * @param {?} currentCompatibilityLevel + * @return {?} + */ + checkContentCompatibility(currentCompatibilityLevel) { + if (currentCompatibilityLevel > this.playerContentCompatibiltyLevel) { + /** @type {?} */ + const compatibilityError = new Error(); + compatibilityError.message = `Player supports ${this.playerContentCompatibiltyLevel} + but content compatibility is ${currentCompatibilityLevel}`; + compatibilityError.name = 'contentCompatibily'; + return { + error: compatibilityError, + isCompitable: false + }; + } else { + return { + error: null, + isCompitable: true + }; + } + } + /** + * @return {?} + */ + initInternetConnectivityError() { + window.addEventListener('offline', this.setInternetConnectivityError); + } + /** + * @return {?} + */ + ngOnDestroy() { + window.removeEventListener('offline', this.setInternetConnectivityError); + } +} +ErrorService.ɵfac = function ErrorService_Factory(t) { + return new (t || ErrorService)(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵinject"](PLAYER_CONFIG)); +}; +/** @nocollapse */ +ErrorService.ctorParameters = () => [{ + type: undefined, + decorators: [{ + type: _angular_core__WEBPACK_IMPORTED_MODULE_1__.Inject, + args: [PLAYER_CONFIG] + }] +}]; +/** @nocollapse */ +ErrorService.ɵprov = (0,_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵdefineInjectable"])({ + factory: function ErrorService_Factory() { + return new ErrorService((0,_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵinject"])(PLAYER_CONFIG)); + }, + token: ErrorService, + providedIn: "root" +}); +(function () { + (typeof ngDevMode === "undefined" || ngDevMode) && _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵsetClassMetadata"](ErrorService, [{ + type: _angular_core__WEBPACK_IMPORTED_MODULE_1__.Injectable, + args: [{ + providedIn: 'root' + }] + }], function () { + return [{ + type: undefined, + decorators: [{ + type: _angular_core__WEBPACK_IMPORTED_MODULE_1__.Inject, + args: [PLAYER_CONFIG] + }] + }]; + }, null); +})(); +if (false) {} + /** * @fileoverview added by tsickle * Generated from: sunbird-player-sdk.interface.ts @@ -85234,6 +85271,7 @@ class SafeHtmlPipe { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "DEFAULT_SCORE": () => (/* binding */ DEFAULT_SCORE), +/* harmony export */ "PLAYER_COMPATABILITY_CONFIG": () => (/* binding */ PLAYER_COMPATABILITY_CONFIG), /* harmony export */ "WARNING_TIME_CONFIG": () => (/* binding */ WARNING_TIME_CONFIG) /* harmony export */ }); const DEFAULT_SCORE = 1; @@ -85241,6 +85279,9 @@ const WARNING_TIME_CONFIG = { DEFAULT_TIME: 75, SHOW_TIMER: true }; +const PLAYER_COMPATABILITY_CONFIG = { + contentCompatibilityLevel: 6 +}; /***/ }), @@ -88694,6 +88735,7 @@ __webpack_require__.r(__webpack_exports__); + class AppModule { @@ -88717,7 +88759,9 @@ class AppModule { provide: _quml_library_src_lib_quml_question_cursor_service__WEBPACK_IMPORTED_MODULE_34__.QuestionCursor, useClass: _question_cursor_implementation_service__WEBPACK_IMPORTED_MODULE_35__.QuestionCursorImplementationService }], - imports: [_angular_platform_browser__WEBPACK_IMPORTED_MODULE_39__.BrowserModule, _angular_common__WEBPACK_IMPORTED_MODULE_40__.CommonModule, ngx_bootstrap_carousel__WEBPACK_IMPORTED_MODULE_41__.CarouselModule.forRoot(), _project_sunbird_sunbird_player_sdk_v9__WEBPACK_IMPORTED_MODULE_42__.SunbirdPlayerSdkModule, _angular_common_http__WEBPACK_IMPORTED_MODULE_43__.HttpClientModule] + imports: [_angular_platform_browser__WEBPACK_IMPORTED_MODULE_39__.BrowserModule, _angular_common__WEBPACK_IMPORTED_MODULE_40__.CommonModule, ngx_bootstrap_carousel__WEBPACK_IMPORTED_MODULE_41__.CarouselModule.forRoot(), _project_sunbird_sunbird_player_sdk_v9__WEBPACK_IMPORTED_MODULE_42__.SunbirdPlayerSdkModule.forRoot({ + contentCompatibilityLevel: 6 + }), _angular_common_http__WEBPACK_IMPORTED_MODULE_43__.HttpClientModule] }); } (function () {