@sunbird-cb/consumption 0.0.60 → 0.0.61
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/bundles/sunbird-cb-consumption.umd.js +61 -20
- package/bundles/sunbird-cb-consumption.umd.js.map +1 -1
- package/bundles/sunbird-cb-consumption.umd.min.js +2 -2
- package/bundles/sunbird-cb-consumption.umd.min.js.map +1 -1
- package/esm2015/lib/_services/widget-user.service.js +55 -19
- package/esm5/lib/_services/widget-user.service.js +60 -19
- package/fesm2015/sunbird-cb-consumption.js +54 -17
- package/fesm2015/sunbird-cb-consumption.js.map +1 -1
- package/fesm5/sunbird-cb-consumption.js +59 -17
- package/fesm5/sunbird-cb-consumption.js.map +1 -1
- package/lib/_services/widget-user.service.d.ts +2 -0
- package/package.json +1 -1
- package/sunbird-cb-consumption.metadata.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable, ɵɵdefineInjectable, Component, EventEmitter, Input, Output, ViewChild, NgModule, ɵɵinject, Inject, HostBinding, Directive, HostListener, CUSTOM_ELEMENTS_SCHEMA, ElementRef, ViewChildren, Pipe } from '@angular/core';
|
|
2
2
|
import { CommonModule, DatePipe } from '@angular/common';
|
|
3
3
|
import { Router, RouterModule, ActivatedRoute } from '@angular/router';
|
|
4
|
-
import { fromEvent, timer, BehaviorSubject, Subject, of, EMPTY, ReplaySubject, throwError, interval } from 'rxjs';
|
|
4
|
+
import { fromEvent, timer, BehaviorSubject, Subject, of, EMPTY, ReplaySubject, throwError, Observable, interval } from 'rxjs';
|
|
5
5
|
import { debounceTime, throttleTime, shareReplay, retry, map, catchError, filter, distinctUntilChanged } from 'rxjs/operators';
|
|
6
6
|
import { ValueService, ConfigurationsService as ConfigurationsService$1, WsEvents, LoggerService, EventService, UtilityService, MultilingualTranslationsService as MultilingualTranslationsService$1, PipeSafeSanitizerModule } from '@sunbird-cb/utils-v2';
|
|
7
7
|
import { MatButtonModule, MatIconModule, MatProgressSpinnerModule, MatToolbarModule, MatTooltipModule, MatListModule, MatSidenavModule, MatCardModule, MatExpansionModule, MatRadioModule, MatChipsModule, MatInputModule, MatFormFieldModule, MatDialogModule, MatSnackBarModule, MatSelectModule, MatDatepickerModule, MatNativeDateModule, MatTableModule, MatCheckboxModule, MatButtonToggleModule, MatTabsModule, MatAutocompleteModule, MatSnackBar, MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatProgressBarModule, MatMenuModule, MatRippleModule } from '@angular/material';
|
|
@@ -12,6 +12,7 @@ import { get, uniqBy, orderBy, camelCase, kebabCase } from 'lodash';
|
|
|
12
12
|
import * as moment$2 from 'moment';
|
|
13
13
|
import { duration, utc } from 'moment';
|
|
14
14
|
import { TranslateService, TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
15
|
+
import 'rxjs/add/observable/of';
|
|
15
16
|
import * as dayjs_ from 'dayjs';
|
|
16
17
|
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
17
18
|
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
@@ -3269,11 +3270,32 @@ var WidgetUserService = /** @class */ (function () {
|
|
|
3269
3270
|
* @return {?}
|
|
3270
3271
|
*/
|
|
3271
3272
|
function (data) {
|
|
3272
|
-
|
|
3273
|
+
/** @type {?} */
|
|
3274
|
+
var coursesData = [];
|
|
3275
|
+
if (data && data.result && data.result.courses) {
|
|
3276
|
+
data.result.courses.forEach((/**
|
|
3277
|
+
* @param {?} content
|
|
3278
|
+
* @return {?}
|
|
3279
|
+
*/
|
|
3280
|
+
function (content) {
|
|
3281
|
+
if (content.contentStatus) {
|
|
3282
|
+
delete content.contentStatus;
|
|
3283
|
+
}
|
|
3284
|
+
coursesData.push(content);
|
|
3285
|
+
}));
|
|
3286
|
+
_this.storeUserEnrollmentInfo(data.result.userCourseEnrolmentInfo, data.result.courses.length);
|
|
3287
|
+
data.result.courses = coursesData;
|
|
3288
|
+
if (data.result.courses.length < 200) {
|
|
3289
|
+
localStorage.removeItem('enrollmentData');
|
|
3290
|
+
_this.setTime('enrollmentService');
|
|
3291
|
+
localStorage.setItem('enrollmentData', JSON.stringify(data.result));
|
|
3292
|
+
_this.mapEnrollmentData(data.result);
|
|
3293
|
+
return data.result;
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3273
3296
|
_this.mapEnrollmentData(data.result);
|
|
3274
3297
|
return data.result;
|
|
3275
3298
|
})));
|
|
3276
|
-
this.setTime('enrollmentService');
|
|
3277
3299
|
return result;
|
|
3278
3300
|
}
|
|
3279
3301
|
return this.getData('enrollmentData');
|
|
@@ -3370,7 +3392,7 @@ var WidgetUserService = /** @class */ (function () {
|
|
|
3370
3392
|
* @return {?}
|
|
3371
3393
|
*/
|
|
3372
3394
|
function (key) {
|
|
3373
|
-
return of(JSON.parse(localStorage.getItem(key) || '{}'));
|
|
3395
|
+
return Observable.of(JSON.parse(localStorage.getItem(key) || '{}'));
|
|
3374
3396
|
};
|
|
3375
3397
|
/**
|
|
3376
3398
|
* @param {?} key
|
|
@@ -3498,11 +3520,11 @@ var WidgetUserService = /** @class */ (function () {
|
|
|
3498
3520
|
var endDate = dayjs(c.endDate).format('YYYY-MM-DD');
|
|
3499
3521
|
/** @type {?} */
|
|
3500
3522
|
var daysCount = dayjs(endDate).diff(todayDate, 'day');
|
|
3501
|
-
childData
|
|
3523
|
+
childData['planDuration'] = daysCount < 0 ? NsCardContent.ACBPConst.OVERDUE : daysCount > 29
|
|
3502
3524
|
? NsCardContent.ACBPConst.SUCCESS : NsCardContent.ACBPConst.UPCOMING;
|
|
3503
|
-
childData
|
|
3504
|
-
childData
|
|
3505
|
-
childData
|
|
3525
|
+
childData['endDate'] = c.endDate;
|
|
3526
|
+
childData['parentId'] = c.id;
|
|
3527
|
+
childData['planType'] = 'cbPlan';
|
|
3506
3528
|
if (childData.status !== NsCardContent.IGOTConst.RETIRED) {
|
|
3507
3529
|
contentNew.push(childData);
|
|
3508
3530
|
}
|
|
@@ -3525,9 +3547,9 @@ var WidgetUserService = /** @class */ (function () {
|
|
|
3525
3547
|
var competencyThemeId = [];
|
|
3526
3548
|
/** @type {?} */
|
|
3527
3549
|
var competencySubThemeId = [];
|
|
3528
|
-
childData
|
|
3550
|
+
childData['contentStatus'] = 0;
|
|
3529
3551
|
if (childEnrollData) {
|
|
3530
|
-
childData
|
|
3552
|
+
childData['contentStatus'] = childEnrollData.status;
|
|
3531
3553
|
}
|
|
3532
3554
|
if (childData.competencies_v5) {
|
|
3533
3555
|
childData.competencies_v5.forEach((/**
|
|
@@ -3552,13 +3574,13 @@ var WidgetUserService = /** @class */ (function () {
|
|
|
3552
3574
|
}
|
|
3553
3575
|
}));
|
|
3554
3576
|
}
|
|
3555
|
-
childData
|
|
3556
|
-
childData
|
|
3557
|
-
childData
|
|
3558
|
-
childData
|
|
3559
|
-
childData
|
|
3560
|
-
childData
|
|
3561
|
-
childData
|
|
3577
|
+
childData['competencyArea'] = competencyArea;
|
|
3578
|
+
childData['competencyTheme'] = competencyTheme;
|
|
3579
|
+
childData['competencyThemeType'] = competencyThemeType;
|
|
3580
|
+
childData['competencySubTheme'] = competencySubTheme;
|
|
3581
|
+
childData['competencyAreaId'] = competencyAreaId;
|
|
3582
|
+
childData['competencyThemeId'] = competencyThemeId;
|
|
3583
|
+
childData['competencySubThemeId'] = competencySubThemeId;
|
|
3562
3584
|
}));
|
|
3563
3585
|
}));
|
|
3564
3586
|
if (contentNew.length > 1) {
|
|
@@ -3608,8 +3630,28 @@ var WidgetUserService = /** @class */ (function () {
|
|
|
3608
3630
|
enrollData[data.collectionId] = data;
|
|
3609
3631
|
}));
|
|
3610
3632
|
}
|
|
3633
|
+
localStorage.removeItem('enrollmentMapData');
|
|
3611
3634
|
localStorage.setItem('enrollmentMapData', JSON.stringify(enrollData));
|
|
3612
3635
|
};
|
|
3636
|
+
/**
|
|
3637
|
+
* @param {?} enrollmentData
|
|
3638
|
+
* @param {?} enrolledCourseCount
|
|
3639
|
+
* @return {?}
|
|
3640
|
+
*/
|
|
3641
|
+
WidgetUserService.prototype.storeUserEnrollmentInfo = /**
|
|
3642
|
+
* @param {?} enrollmentData
|
|
3643
|
+
* @param {?} enrolledCourseCount
|
|
3644
|
+
* @return {?}
|
|
3645
|
+
*/
|
|
3646
|
+
function (enrollmentData, enrolledCourseCount) {
|
|
3647
|
+
/** @type {?} */
|
|
3648
|
+
var userData = {
|
|
3649
|
+
enrolledCourseCount: enrolledCourseCount,
|
|
3650
|
+
userCourseEnrolmentInfo: enrollmentData,
|
|
3651
|
+
};
|
|
3652
|
+
localStorage.removeItem('userEnrollmentCount');
|
|
3653
|
+
localStorage.setItem('userEnrollmentCount', JSON.stringify(userData));
|
|
3654
|
+
};
|
|
3613
3655
|
WidgetUserService.decorators = [
|
|
3614
3656
|
{ type: Injectable, args: [{
|
|
3615
3657
|
providedIn: 'root',
|