@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';
|
|
@@ -2920,11 +2921,32 @@ class WidgetUserService {
|
|
|
2920
2921
|
* @return {?}
|
|
2921
2922
|
*/
|
|
2922
2923
|
(data) => {
|
|
2923
|
-
|
|
2924
|
+
/** @type {?} */
|
|
2925
|
+
const coursesData = [];
|
|
2926
|
+
if (data && data.result && data.result.courses) {
|
|
2927
|
+
data.result.courses.forEach((/**
|
|
2928
|
+
* @param {?} content
|
|
2929
|
+
* @return {?}
|
|
2930
|
+
*/
|
|
2931
|
+
(content) => {
|
|
2932
|
+
if (content.contentStatus) {
|
|
2933
|
+
delete content.contentStatus;
|
|
2934
|
+
}
|
|
2935
|
+
coursesData.push(content);
|
|
2936
|
+
}));
|
|
2937
|
+
this.storeUserEnrollmentInfo(data.result.userCourseEnrolmentInfo, data.result.courses.length);
|
|
2938
|
+
data.result.courses = coursesData;
|
|
2939
|
+
if (data.result.courses.length < 200) {
|
|
2940
|
+
localStorage.removeItem('enrollmentData');
|
|
2941
|
+
this.setTime('enrollmentService');
|
|
2942
|
+
localStorage.setItem('enrollmentData', JSON.stringify(data.result));
|
|
2943
|
+
this.mapEnrollmentData(data.result);
|
|
2944
|
+
return data.result;
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2924
2947
|
this.mapEnrollmentData(data.result);
|
|
2925
2948
|
return data.result;
|
|
2926
2949
|
})));
|
|
2927
|
-
this.setTime('enrollmentService');
|
|
2928
2950
|
return result;
|
|
2929
2951
|
}
|
|
2930
2952
|
return this.getData('enrollmentData');
|
|
@@ -3004,7 +3026,7 @@ class WidgetUserService {
|
|
|
3004
3026
|
* @return {?}
|
|
3005
3027
|
*/
|
|
3006
3028
|
getData(key) {
|
|
3007
|
-
return of(JSON.parse(localStorage.getItem(key) || '{}'));
|
|
3029
|
+
return Observable.of(JSON.parse(localStorage.getItem(key) || '{}'));
|
|
3008
3030
|
}
|
|
3009
3031
|
/**
|
|
3010
3032
|
* @param {?} key
|
|
@@ -3108,11 +3130,11 @@ class WidgetUserService {
|
|
|
3108
3130
|
const endDate = dayjs(c.endDate).format('YYYY-MM-DD');
|
|
3109
3131
|
/** @type {?} */
|
|
3110
3132
|
const daysCount = dayjs(endDate).diff(todayDate, 'day');
|
|
3111
|
-
childData
|
|
3133
|
+
childData['planDuration'] = daysCount < 0 ? NsCardContent.ACBPConst.OVERDUE : daysCount > 29
|
|
3112
3134
|
? NsCardContent.ACBPConst.SUCCESS : NsCardContent.ACBPConst.UPCOMING;
|
|
3113
|
-
childData
|
|
3114
|
-
childData
|
|
3115
|
-
childData
|
|
3135
|
+
childData['endDate'] = c.endDate;
|
|
3136
|
+
childData['parentId'] = c.id;
|
|
3137
|
+
childData['planType'] = 'cbPlan';
|
|
3116
3138
|
if (childData.status !== NsCardContent.IGOTConst.RETIRED) {
|
|
3117
3139
|
contentNew.push(childData);
|
|
3118
3140
|
}
|
|
@@ -3135,9 +3157,9 @@ class WidgetUserService {
|
|
|
3135
3157
|
const competencyThemeId = [];
|
|
3136
3158
|
/** @type {?} */
|
|
3137
3159
|
const competencySubThemeId = [];
|
|
3138
|
-
childData
|
|
3160
|
+
childData['contentStatus'] = 0;
|
|
3139
3161
|
if (childEnrollData) {
|
|
3140
|
-
childData
|
|
3162
|
+
childData['contentStatus'] = childEnrollData.status;
|
|
3141
3163
|
}
|
|
3142
3164
|
if (childData.competencies_v5) {
|
|
3143
3165
|
childData.competencies_v5.forEach((/**
|
|
@@ -3162,13 +3184,13 @@ class WidgetUserService {
|
|
|
3162
3184
|
}
|
|
3163
3185
|
}));
|
|
3164
3186
|
}
|
|
3165
|
-
childData
|
|
3166
|
-
childData
|
|
3167
|
-
childData
|
|
3168
|
-
childData
|
|
3169
|
-
childData
|
|
3170
|
-
childData
|
|
3171
|
-
childData
|
|
3187
|
+
childData['competencyArea'] = competencyArea;
|
|
3188
|
+
childData['competencyTheme'] = competencyTheme;
|
|
3189
|
+
childData['competencyThemeType'] = competencyThemeType;
|
|
3190
|
+
childData['competencySubTheme'] = competencySubTheme;
|
|
3191
|
+
childData['competencyAreaId'] = competencyAreaId;
|
|
3192
|
+
childData['competencyThemeId'] = competencyThemeId;
|
|
3193
|
+
childData['competencySubThemeId'] = competencySubThemeId;
|
|
3172
3194
|
}));
|
|
3173
3195
|
}));
|
|
3174
3196
|
if (contentNew.length > 1) {
|
|
@@ -3217,8 +3239,23 @@ class WidgetUserService {
|
|
|
3217
3239
|
enrollData[data.collectionId] = data;
|
|
3218
3240
|
}));
|
|
3219
3241
|
}
|
|
3242
|
+
localStorage.removeItem('enrollmentMapData');
|
|
3220
3243
|
localStorage.setItem('enrollmentMapData', JSON.stringify(enrollData));
|
|
3221
3244
|
}
|
|
3245
|
+
/**
|
|
3246
|
+
* @param {?} enrollmentData
|
|
3247
|
+
* @param {?} enrolledCourseCount
|
|
3248
|
+
* @return {?}
|
|
3249
|
+
*/
|
|
3250
|
+
storeUserEnrollmentInfo(enrollmentData, enrolledCourseCount) {
|
|
3251
|
+
/** @type {?} */
|
|
3252
|
+
const userData = {
|
|
3253
|
+
enrolledCourseCount,
|
|
3254
|
+
userCourseEnrolmentInfo: enrollmentData,
|
|
3255
|
+
};
|
|
3256
|
+
localStorage.removeItem('userEnrollmentCount');
|
|
3257
|
+
localStorage.setItem('userEnrollmentCount', JSON.stringify(userData));
|
|
3258
|
+
}
|
|
3222
3259
|
}
|
|
3223
3260
|
WidgetUserService.decorators = [
|
|
3224
3261
|
{ type: Injectable, args: [{
|