@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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('@sunbird-cb/utils-v2'), require('@angular/material'), require('@sunbird-cb/resolver-v2'), require('@angular/common/http'), require('lodash'), require('moment'), require('@ngx-translate/core'), require('dayjs'), require('@ngx-translate/http-loader'), require('@angular/cdk/layout'), require('@angular/platform-browser'), require('hammerjs'), require('@angular/forms'), require('jspdf')) :
3
- typeof define === 'function' && define.amd ? define('@sunbird-cb/consumption', ['exports', '@angular/core', '@angular/common', '@angular/router', 'rxjs', 'rxjs/operators', '@sunbird-cb/utils-v2', '@angular/material', '@sunbird-cb/resolver-v2', '@angular/common/http', 'lodash', 'moment', '@ngx-translate/core', 'dayjs', '@ngx-translate/http-loader', '@angular/cdk/layout', '@angular/platform-browser', 'hammerjs', '@angular/forms', 'jspdf'], factory) :
4
- (global = global || self, factory((global['sunbird-cb'] = global['sunbird-cb'] || {}, global['sunbird-cb'].consumption = {}), global.ng.core, global.ng.common, global.ng.router, global.rxjs, global.rxjs.operators, global['@sunbird-cb/utils-v2'], global.ng.material, global['@sunbird-cb/resolver-v2'], global.ng.common.http, global.lodash, global.moment, global.core$1, global.dayjs_, global.httpLoader, global.ng.cdk.layout, global.ng.platformBrowser, global.hammerjs, global.ng.forms, global.jspdf));
5
- }(this, (function (exports, core, common, router, rxjs, operators, utilsV2, material, resolverV2, http, lodash, moment$2, core$1, dayjs_, httpLoader, layout, platformBrowser, Hammer, forms, jspdf) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('@sunbird-cb/utils-v2'), require('@angular/material'), require('@sunbird-cb/resolver-v2'), require('@angular/common/http'), require('lodash'), require('moment'), require('@ngx-translate/core'), require('rxjs/add/observable/of'), require('dayjs'), require('@ngx-translate/http-loader'), require('@angular/cdk/layout'), require('@angular/platform-browser'), require('hammerjs'), require('@angular/forms'), require('jspdf')) :
3
+ typeof define === 'function' && define.amd ? define('@sunbird-cb/consumption', ['exports', '@angular/core', '@angular/common', '@angular/router', 'rxjs', 'rxjs/operators', '@sunbird-cb/utils-v2', '@angular/material', '@sunbird-cb/resolver-v2', '@angular/common/http', 'lodash', 'moment', '@ngx-translate/core', 'rxjs/add/observable/of', 'dayjs', '@ngx-translate/http-loader', '@angular/cdk/layout', '@angular/platform-browser', 'hammerjs', '@angular/forms', 'jspdf'], factory) :
4
+ (global = global || self, factory((global['sunbird-cb'] = global['sunbird-cb'] || {}, global['sunbird-cb'].consumption = {}), global.ng.core, global.ng.common, global.ng.router, global.rxjs, global.rxjs.operators, global['@sunbird-cb/utils-v2'], global.ng.material, global['@sunbird-cb/resolver-v2'], global.ng.common.http, global.lodash, global.moment, global.core$1, global.rxjs['add/observable/of'], global.dayjs_, global.httpLoader, global.ng.cdk.layout, global.ng.platformBrowser, global.hammerjs, global.ng.forms, global.jspdf));
5
+ }(this, (function (exports, core, common, router, rxjs, operators, utilsV2, material, resolverV2, http, lodash, moment$2, core$1, of, dayjs_, httpLoader, layout, platformBrowser, Hammer, forms, jspdf) { 'use strict';
6
6
 
7
7
  Hammer = Hammer && Hammer.hasOwnProperty('default') ? Hammer['default'] : Hammer;
8
8
 
@@ -3474,11 +3474,32 @@
3474
3474
  * @return {?}
3475
3475
  */
3476
3476
  function (data) {
3477
- localStorage.setItem('enrollmentData', JSON.stringify(data.result));
3477
+ /** @type {?} */
3478
+ var coursesData = [];
3479
+ if (data && data.result && data.result.courses) {
3480
+ data.result.courses.forEach((/**
3481
+ * @param {?} content
3482
+ * @return {?}
3483
+ */
3484
+ function (content) {
3485
+ if (content.contentStatus) {
3486
+ delete content.contentStatus;
3487
+ }
3488
+ coursesData.push(content);
3489
+ }));
3490
+ _this.storeUserEnrollmentInfo(data.result.userCourseEnrolmentInfo, data.result.courses.length);
3491
+ data.result.courses = coursesData;
3492
+ if (data.result.courses.length < 200) {
3493
+ localStorage.removeItem('enrollmentData');
3494
+ _this.setTime('enrollmentService');
3495
+ localStorage.setItem('enrollmentData', JSON.stringify(data.result));
3496
+ _this.mapEnrollmentData(data.result);
3497
+ return data.result;
3498
+ }
3499
+ }
3478
3500
  _this.mapEnrollmentData(data.result);
3479
3501
  return data.result;
3480
3502
  })));
3481
- this.setTime('enrollmentService');
3482
3503
  return result;
3483
3504
  }
3484
3505
  return this.getData('enrollmentData');
@@ -3575,7 +3596,7 @@
3575
3596
  * @return {?}
3576
3597
  */
3577
3598
  function (key) {
3578
- return rxjs.of(JSON.parse(localStorage.getItem(key) || '{}'));
3599
+ return rxjs.Observable.of(JSON.parse(localStorage.getItem(key) || '{}'));
3579
3600
  };
3580
3601
  /**
3581
3602
  * @param {?} key
@@ -3703,11 +3724,11 @@
3703
3724
  var endDate = dayjs(c.endDate).format('YYYY-MM-DD');
3704
3725
  /** @type {?} */
3705
3726
  var daysCount = dayjs(endDate).diff(todayDate, 'day');
3706
- childData.planDuration = daysCount < 0 ? NsCardContent.ACBPConst.OVERDUE : daysCount > 29
3727
+ childData['planDuration'] = daysCount < 0 ? NsCardContent.ACBPConst.OVERDUE : daysCount > 29
3707
3728
  ? NsCardContent.ACBPConst.SUCCESS : NsCardContent.ACBPConst.UPCOMING;
3708
- childData.endDate = c.endDate;
3709
- childData.parentId = c.id;
3710
- childData.planType = 'cbPlan';
3729
+ childData['endDate'] = c.endDate;
3730
+ childData['parentId'] = c.id;
3731
+ childData['planType'] = 'cbPlan';
3711
3732
  if (childData.status !== NsCardContent.IGOTConst.RETIRED) {
3712
3733
  contentNew.push(childData);
3713
3734
  }
@@ -3730,9 +3751,9 @@
3730
3751
  var competencyThemeId = [];
3731
3752
  /** @type {?} */
3732
3753
  var competencySubThemeId = [];
3733
- childData.contentStatus = 0;
3754
+ childData['contentStatus'] = 0;
3734
3755
  if (childEnrollData) {
3735
- childData.contentStatus = childEnrollData.status;
3756
+ childData['contentStatus'] = childEnrollData.status;
3736
3757
  }
3737
3758
  if (childData.competencies_v5) {
3738
3759
  childData.competencies_v5.forEach((/**
@@ -3757,13 +3778,13 @@
3757
3778
  }
3758
3779
  }));
3759
3780
  }
3760
- childData.competencyArea = competencyArea;
3761
- childData.competencyTheme = competencyTheme;
3762
- childData.competencyThemeType = competencyThemeType;
3763
- childData.competencySubTheme = competencySubTheme;
3764
- childData.competencyAreaId = competencyAreaId;
3765
- childData.competencyThemeId = competencyThemeId;
3766
- childData.competencySubThemeId = competencySubThemeId;
3781
+ childData['competencyArea'] = competencyArea;
3782
+ childData['competencyTheme'] = competencyTheme;
3783
+ childData['competencyThemeType'] = competencyThemeType;
3784
+ childData['competencySubTheme'] = competencySubTheme;
3785
+ childData['competencyAreaId'] = competencyAreaId;
3786
+ childData['competencyThemeId'] = competencyThemeId;
3787
+ childData['competencySubThemeId'] = competencySubThemeId;
3767
3788
  }));
3768
3789
  }));
3769
3790
  if (contentNew.length > 1) {
@@ -3813,8 +3834,28 @@
3813
3834
  enrollData[data.collectionId] = data;
3814
3835
  }));
3815
3836
  }
3837
+ localStorage.removeItem('enrollmentMapData');
3816
3838
  localStorage.setItem('enrollmentMapData', JSON.stringify(enrollData));
3817
3839
  };
3840
+ /**
3841
+ * @param {?} enrollmentData
3842
+ * @param {?} enrolledCourseCount
3843
+ * @return {?}
3844
+ */
3845
+ WidgetUserService.prototype.storeUserEnrollmentInfo = /**
3846
+ * @param {?} enrollmentData
3847
+ * @param {?} enrolledCourseCount
3848
+ * @return {?}
3849
+ */
3850
+ function (enrollmentData, enrolledCourseCount) {
3851
+ /** @type {?} */
3852
+ var userData = {
3853
+ enrolledCourseCount: enrolledCourseCount,
3854
+ userCourseEnrolmentInfo: enrollmentData,
3855
+ };
3856
+ localStorage.removeItem('userEnrollmentCount');
3857
+ localStorage.setItem('userEnrollmentCount', JSON.stringify(userData));
3858
+ };
3818
3859
  WidgetUserService.decorators = [
3819
3860
  { type: core.Injectable, args: [{
3820
3861
  providedIn: 'root',