@sumaris-net/ngx-components 1.22.11-rc1 → 1.22.11-rc12

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.
Files changed (44) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +834 -95
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/esm2015/public_api.js +10 -1
  6. package/esm2015/src/app/admin/users/list/users.js +2 -3
  7. package/esm2015/src/app/core/form/entity-editor-modal.class.js +3 -2
  8. package/esm2015/src/app/core/form/entity-editor.class.js +5 -4
  9. package/esm2015/src/app/core/menu/menu.component.js +1 -1
  10. package/esm2015/src/app/shared/events.js +8 -3
  11. package/esm2015/src/app/shared/services/entity-service.class.js +1 -1
  12. package/esm2015/src/app/social/job/testing/job-progression.testing.js +48 -0
  13. package/esm2015/src/app/social/job/testing/job-progression.testing.service.js +30 -0
  14. package/esm2015/src/app/social/job/testing/job.testing.module.js +25 -0
  15. package/esm2015/src/app/social/social.module.js +1 -1
  16. package/esm2015/src/app/social/social.testing.module.js +39 -0
  17. package/esm2015/src/app/social/user-event/notification/user-event-notification.icon.js +6 -6
  18. package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +118 -19
  19. package/esm2015/src/app/social/user-event/testing/user-event.testing.js +179 -0
  20. package/esm2015/src/app/social/user-event/testing/user-event.testing.module.js +25 -0
  21. package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +39 -11
  22. package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
  23. package/esm2015/src/app/social/user-event/user-event.module.js +4 -2
  24. package/esm2015/src/app/social/user-event/user-event.service.js +107 -41
  25. package/fesm2015/sumaris-net.ngx-components.js +648 -72
  26. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  27. package/package.json +1 -1
  28. package/public_api.d.ts +7 -0
  29. package/src/app/admin/users/list/users.d.ts +0 -2
  30. package/src/app/core/form/entity-editor.class.d.ts +1 -1
  31. package/src/app/shared/events.d.ts +1 -1
  32. package/src/app/shared/services/entity-service.class.d.ts +7 -0
  33. package/src/app/social/job/testing/job-progression.testing.d.ts +11 -0
  34. package/src/app/social/job/testing/job-progression.testing.service.d.ts +10 -0
  35. package/src/app/social/job/testing/job.testing.module.d.ts +2 -0
  36. package/src/app/social/social.testing.module.d.ts +4 -0
  37. package/src/app/social/user-event/notification/user-event-notification.list.d.ts +37 -12
  38. package/src/app/social/user-event/testing/user-event.testing.d.ts +23 -0
  39. package/src/app/social/user-event/testing/user-event.testing.module.d.ts +2 -0
  40. package/src/app/social/user-event/testing/user-event.testing.service.d.ts +5 -4
  41. package/src/app/social/user-event/user-event.model.d.ts +2 -0
  42. package/src/app/social/user-event/user-event.service.d.ts +17 -13
  43. package/src/theme/_ngx-components.scss +12 -0
  44. package/sumaris-net.ngx-components.metadata.json +1 -1
@@ -1151,7 +1151,7 @@
1151
1151
  * @param element
1152
1152
  * @param threshold default to '15%'
1153
1153
  */
1154
- function fromScrollEndEvent(element, threshold) {
1154
+ function fromScrollEndEvent(element, threshold, dueTime) {
1155
1155
  threshold = threshold || '15%';
1156
1156
  var isEnd;
1157
1157
  // Listen using percentage
@@ -1173,6 +1173,11 @@
1173
1173
  else {
1174
1174
  throw new Error('Invalid argument \'threshold\'. Expected value unit: \'px\' or \'%\' ');
1175
1175
  }
1176
+ // Check bottom reach, even if NO scroll event (e.g. when already reach the bottom)
1177
+ if (dueTime > 0) {
1178
+ return rxjs.merge(rxjs.fromEvent(element, 'scroll'), rxjs.timer(dueTime))
1179
+ .pipe(operators.filter(function () { return isEnd(); }));
1180
+ }
1176
1181
  return rxjs.fromEvent(element, 'scroll')
1177
1182
  .pipe(operators.filter(function () { return isEnd(); }));
1178
1183
  }
@@ -24832,7 +24837,7 @@
24832
24837
  template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" [contentId]=\"contentId\">\n <ion-header>\n\n <ion-toolbar @fadeInAnimation *ngIf=\"isLogin; else notLogin\" class=\"ion-toolbar-top\">\n <ion-grid>\n <ion-row>\n <ion-col size=\"4\">\n <button type=\"button\" mat-flat-button\n class=\"user-avatar\" [class.primary]=\"!accountAvatar\"\n [style.background-image]=\"'url('+(accountAvatar||'./assets/img/person.png')+')'\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\"\n [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\n </button>\n </ion-col>\n <ion-col size=\"8\" class=\"user-logo\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"108px\"/>\n <span *ngIf=\"!logo\" style=\"width: 108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n <ion-col>\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\"\n [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\n <ion-label color=\"primary\" class=\"ion-text-wrap ion-text-start\">\n <h3 class=\"no-margin username\">\n <b>{{accountName}}</b>\n </h3>\n <h4>{{accountEmail}}</h4>\n </ion-label>\n </button>\n </ion-col>\n\n <!-- Insertion headerBottomRight -->\n <ion-col size=\"auto\">\n <ng-container *ngTemplateOutlet=\"headerBottomRight\"></ng-container>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-toolbar>\n\n <!-- User not logged -->\n <ng-template #notLogin>\n <mat-toolbar class=\"ion-padding\" @fadeInAnimation\n style=\"height: unset; display: block; margin: auto; text-align: center;\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"150px;\">\n <span *ngIf=\"!logo\" style=\"width: 150px\">{{appName}}</span>\n </mat-toolbar>\n </ng-template>\n </ion-header>\n\n <ion-content [class.has-user-header]=\"isLogin\">\n\n <ion-list lines=\"none\">\n <ion-menu-toggle auto-hide=\"false\"\n [class.flex-spacer]=\"item.cssClass == 'flex-spacer'\"\n *ngFor=\"let item of $items | async\">\n\n <!-- link -->\n <ion-item *ngIf=\"!loading && item.path\"\n @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}} text-1x\"\n tappable\n [routerLink]=\"item.path\"\n routerDirection=\"root\"\n routerLinkActive=\"selected\"\n [routerLinkActiveOptions]=\"{exact: (item.path === '/')}\">\n <ion-icon slot=\"start\" *ngIf=\"item.icon\" [name]=\"item.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"item.matIcon\">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n <!-- action -->\n <ion-item *ngIf=\"!loading && item.action\"\n @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}} text-1x\"\n tappable\n (click)=\"doAction(item.action, $event)\">\n <ion-icon slot=\"start\" *ngIf=\"item.icon\" [name]=\"item.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"item.matIcon\">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n <!-- divider -->\n <ion-item-divider @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}}\"\n *ngIf=\"!loading && !item.path && !item.action\">\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item-divider>\n\n </ion-menu-toggle>\n </ion-list>\n </ion-content>\n\n <ion-footer class=\"hidden-xs hidden-sm\">\n <ion-toolbar>\n\n <ion-buttons slot=\"start\">\n <ion-button mat-icon-button color=\"accent\" (click)=\"openAboutModal($event)\">\n <mat-icon slot=\"icon-only\">help_outline</mat-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title (click)=\"openAboutModal($event)\" color=\"medium\">\n {{'MENU.FOOTER_VERSION_ABOUT'| translate: {version: appVersion} }}\n </ion-title>\n\n <ion-buttons slot=\"end\">\n <button mat-icon-button color=\"accent\" (click)=\"toggleSplitPaneShow($event)\"\n class=\"hidden-xs hidden-sm hidden-md\"\n [title]=\"(splitPane.when ? 'COMMON.BTN_HIDE_MENU' : 'COMMON.BTN_SHOW_MENU') |translate\">\n <mat-icon><span>{{splitPane.when ? '&#xab;' : '&#xbb;'}}</span></mat-icon>\n </button>\n </ion-buttons>\n </ion-toolbar>\n </ion-footer>\n\n </ion-menu>\n\n <ng-content></ng-content>\n\n</ion-split-pane>\n\n<ng-template #headerBottomRight>\n <ng-content select=\"[headerBottomRight]\"></ng-content>\n</ng-template>\n",
24833
24838
  animations: [fadeInAnimation],
24834
24839
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
24835
- styles: ["ion-menu{--ion-item-background:transparent;--ion-item-divider-background:transparent;--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint);--ion-item-background-selected:var(--ion-color-secondary100);--ion-item-text-color-selected:var(--ion-color-primary);--ion-item-icon-color-selected:var(--ion-color-primary);--ion-item-text-color-disable:var(--ion-color-medium);--ion-item-icon-color-disable:var(--ion-color-medium)}ion-menu ion-header ion-text{color:var(--ion-color-primary)}ion-menu ion-header .user-avatar{background-size:cover;background-repeat:no-repeat;background-position:50%;background-color:var(--ion-color-secondary);border:1px solid var(--ion-color-primary);overflow:hidden!important;font-size:var(--avatar-size,60px)!important;line-height:var(--avatar-size,60px);height:var(--avatar-size,60px)!important;width:var(--avatar-size,60px)!important;border-radius:50%;display:inline-block}ion-menu ion-header .user-avatar:hover{background-color:var(--ion-color-secondary-shade);border:2px solid var(--ion-color-primary-shade)}ion-menu ion-header .user-logo{text-align:right}ion-menu ion-header .user-logo img{max-width:120px;max-height:var(--avatar-size,60px);width:auto}ion-menu ion-header .username{padding-top:0;margin-top:0;margin-bottom:0;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}ion-menu ion-header button[mat-button]{padding:0;text-align:start!important;width:100%}ion-menu .scroll-content{margin-top:79px!important}ion-menu .has-user-header .scroll-content{margin-top:188px!important}ion-menu ion-content.has-profile-header{--offset-top:188px}ion-menu ion-content.no-profile-header{--offset-top:79px}ion-menu ion-content ion-list{min-height:100%;display:flex;flex-direction:column;justify-content:flex-start}ion-menu ion-content ion-list ion-menu-toggle.flex-spacer{flex:1 1 auto;display:flex;flex-direction:column;justify-content:flex-end}ion-menu ion-content ion-list ion-item.primary{--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint)}ion-menu ion-content ion-list ion-item.secondary{--ion-item-icon-color:var(--ion-color-secondary-tint);--ion-item-text-color:var(--ion-color-secondary-tint)}ion-menu ion-content ion-list ion-item.tertiary{--ion-item-icon-color:var(--ion-color-tertiary-tint);--ion-item-text-color:var(--ion-color-tertiary-tint)}ion-menu ion-content ion-list ion-item.danger{--ion-item-icon-color:var(--ion-color-danger-tint);--ion-item-text-color:var(--ion-color-danger-tint)}ion-menu ion-content ion-list ion-item.medium{--ion-item-icon-color:var(--ion-color-medium-shade);--ion-item-text-color:var(--ion-color-medium-shade)}ion-menu ion-content ion-list ion-item.dark{--ion-item-icon-color:var(--ion-color-dark-tint);--ion-item-text-color:var(--ion-color-dark-tint)}ion-menu ion-content ion-list ion-item ion-icon,ion-menu ion-content ion-list ion-item mat-icon{color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item ion-label,ion-menu ion-content ion-list ion-item ion-text{color:var(--ion-item-text-color)!important}ion-menu ion-content ion-list ion-item.selected{background-color:var(--ion-item-background-selected)!important;--color-hover:var(--ion-item-background-selected)!important}ion-menu ion-content ion-list ion-item.selected ion-icon,ion-menu ion-content ion-list ion-item.selected mat-icon{color:var(--ion-item-icon-color-selected)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item.selected ion-label,ion-menu ion-content ion-list ion-item.selected ion-text{color:var(--ion-item-text-color-selected)!important}ion-menu ion-content ion-list ion-item.selected:hover{--color-hover:var(--ion-item-background-selected)!important;--ion-item-icon-color-selected:var(--ion-item-icon-color)!important;--ion-item-text-color-selected:var(--ion-item-text-color)!important}ion-menu ion-footer{display:block!important}ion-menu ion-footer ion-toolbar ion-title{cursor:pointer;font-size:12pt;font-weight:400;text-align:center;padding:0 8px}ion-menu ion-footer ion-toolbar ion-button{--width:40px}@media screen and (max-width:767px){ion-menu ion-footer{display:none!important;visibility:hidden!important}}@media screen and (min-width:768px){ion-menu ion-scroll{overflow-y:auto!important}ion-menu .user-avatar{font-size:var(--avatar-size,80px)!important;line-height:var(--avatar-size,80px);height:var(--avatar-size,80px)!important;width:var(--avatar-size,80px)!important}ion-menu .user-logo img{max-height:var(--avatar-size,80px)}}"]
24840
+ styles: ["ion-menu{--ion-item-background:transparent;--ion-item-divider-background:transparent;--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint);--ion-item-background-selected:var(--ion-color-secondary100);--ion-item-text-color-selected:var(--ion-color-primary);--ion-item-icon-color-selected:var(--ion-color-primary);--ion-item-text-color-disable:var(--ion-color-medium);--ion-item-icon-color-disable:var(--ion-color-medium)}ion-menu ion-header ion-text{color:var(--ion-color-primary)}ion-menu ion-header .user-avatar{background-size:cover;background-repeat:no-repeat;background-position:50%;background-color:var(--ion-color-secondary);border:1px solid rgba(var(--ion-color-secondary-rgb),.5);overflow:hidden!important;font-size:var(--avatar-size,60px)!important;line-height:var(--avatar-size,60px);height:var(--avatar-size,60px)!important;width:var(--avatar-size,60px)!important;border-radius:50%;display:inline-block}ion-menu ion-header .user-avatar:hover{background-color:var(--ion-color-secondary-shade);border:2px solid var(--ion-color-secondary-shade)}ion-menu ion-header .user-logo{text-align:right}ion-menu ion-header .user-logo img{max-width:120px;max-height:var(--avatar-size,60px);width:auto}ion-menu ion-header .username{padding-top:0;margin-top:0;margin-bottom:0;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}ion-menu ion-header button[mat-button]{padding:0;text-align:start!important;width:100%}ion-menu .scroll-content{margin-top:79px!important}ion-menu .has-user-header .scroll-content{margin-top:188px!important}ion-menu ion-content.has-profile-header{--offset-top:188px}ion-menu ion-content.no-profile-header{--offset-top:79px}ion-menu ion-content ion-list{min-height:100%;display:flex;flex-direction:column;justify-content:flex-start}ion-menu ion-content ion-list ion-menu-toggle.flex-spacer{flex:1 1 auto;display:flex;flex-direction:column;justify-content:flex-end}ion-menu ion-content ion-list ion-item.primary{--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint)}ion-menu ion-content ion-list ion-item.secondary{--ion-item-icon-color:var(--ion-color-secondary-tint);--ion-item-text-color:var(--ion-color-secondary-tint)}ion-menu ion-content ion-list ion-item.tertiary{--ion-item-icon-color:var(--ion-color-tertiary-tint);--ion-item-text-color:var(--ion-color-tertiary-tint)}ion-menu ion-content ion-list ion-item.danger{--ion-item-icon-color:var(--ion-color-danger-tint);--ion-item-text-color:var(--ion-color-danger-tint)}ion-menu ion-content ion-list ion-item.medium{--ion-item-icon-color:var(--ion-color-medium-shade);--ion-item-text-color:var(--ion-color-medium-shade)}ion-menu ion-content ion-list ion-item.dark{--ion-item-icon-color:var(--ion-color-dark-tint);--ion-item-text-color:var(--ion-color-dark-tint)}ion-menu ion-content ion-list ion-item ion-icon,ion-menu ion-content ion-list ion-item mat-icon{color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item ion-label,ion-menu ion-content ion-list ion-item ion-text{color:var(--ion-item-text-color)!important}ion-menu ion-content ion-list ion-item.selected{background-color:var(--ion-item-background-selected)!important;--color-hover:var(--ion-item-background-selected)!important}ion-menu ion-content ion-list ion-item.selected ion-icon,ion-menu ion-content ion-list ion-item.selected mat-icon{color:var(--ion-item-icon-color-selected)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item.selected ion-label,ion-menu ion-content ion-list ion-item.selected ion-text{color:var(--ion-item-text-color-selected)!important}ion-menu ion-content ion-list ion-item.selected:hover{--color-hover:var(--ion-item-background-selected)!important;--ion-item-icon-color-selected:var(--ion-item-icon-color)!important;--ion-item-text-color-selected:var(--ion-item-text-color)!important}ion-menu ion-footer{display:block!important}ion-menu ion-footer ion-toolbar ion-title{cursor:pointer;font-size:12pt;font-weight:400;text-align:center;padding:0 8px}ion-menu ion-footer ion-toolbar ion-button{--width:40px}@media screen and (max-width:767px){ion-menu ion-footer{display:none!important;visibility:hidden!important}}@media screen and (min-width:768px){ion-menu ion-scroll{overflow-y:auto!important}ion-menu .user-avatar{font-size:var(--avatar-size,80px)!important;line-height:var(--avatar-size,80px);height:var(--avatar-size,80px)!important;width:var(--avatar-size,80px)!important}ion-menu .user-logo img{max-height:var(--avatar-size,80px)}}"]
24836
24841
  },] }
24837
24842
  ];
24838
24843
  MenuComponent.ctorParameters = function () { return [
@@ -28791,10 +28796,10 @@
28791
28796
  _this.savingSubject = new rxjs.BehaviorSubject(false);
28792
28797
  _this.$title = new rxjs.Subject();
28793
28798
  _this.onUpdateView = new i0.EventEmitter();
28794
- _this.environement = injector.get(ENVIRONMENT);
28799
+ _this.environment = injector.get(ENVIRONMENT);
28795
28800
  options = Object.assign({
28796
28801
  // Default options
28797
- enableListenChanges: ((_a = _this.environement.entityEditor) === null || _a === void 0 ? void 0 : _a.enableListenChanges) || false, listenIntervalInSeconds: toNumber((_b = _this.environement.entityEditor) === null || _b === void 0 ? void 0 : _b.listenIntervalInSeconds, 0), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: ''
28802
+ enableListenChanges: ((_a = _this.environment.entityEditor) === null || _a === void 0 ? void 0 : _a.enableListenChanges) || false, listenIntervalInSeconds: toNumber((_b = _this.environment.entityEditor) === null || _b === void 0 ? void 0 : _b.listenIntervalInSeconds, 0), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: ''
28798
28803
  }, options);
28799
28804
  _this.settings = injector.get(LocalSettingsService);
28800
28805
  _this.errorTranslator = injector.get(FormErrorTranslator);
@@ -29093,13 +29098,14 @@
29093
29098
  * Enable or disable state
29094
29099
  */
29095
29100
  AppEntityEditor.prototype.updateViewState = function (data, opts) {
29101
+ var _a;
29096
29102
  if (this.isNewData || this.canUserWrite(data)) {
29097
29103
  this.enable(opts);
29098
29104
  }
29099
29105
  else {
29100
29106
  this.disable(opts);
29101
29107
  // Allow to sort table
29102
- this.tables.forEach(function (t) { return t.enableSort(); });
29108
+ (_a = this.tables) === null || _a === void 0 ? void 0 : _a.forEach(function (t) { return t.enableSort(); });
29103
29109
  }
29104
29110
  };
29105
29111
  /**
@@ -29833,13 +29839,14 @@
29833
29839
  * Enable or disable state
29834
29840
  */
29835
29841
  AppEntityEditorModal.prototype.updateViewState = function (data, opts) {
29842
+ var _a;
29836
29843
  if (this.isNewData || this.enabled) {
29837
29844
  this.enable(opts);
29838
29845
  }
29839
29846
  else {
29840
29847
  this.disable(opts);
29841
29848
  // Allow to sort table
29842
- this.tables.forEach(function (t) { return t.enableSort(); });
29849
+ (_a = this.tables) === null || _a === void 0 ? void 0 : _a.forEach(function (t) { return t.enableSort(); });
29843
29850
  }
29844
29851
  };
29845
29852
  AppEntityEditorModal.prototype.saveAndClose = function (event) {
@@ -30289,7 +30296,7 @@
30289
30296
  AbstractUserEventService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
30290
30297
  return this.watchPage({ offset: offset, size: size, sortBy: sortBy, sortDirection: sortDirection }, filter, options);
30291
30298
  };
30292
- AbstractUserEventService.prototype.watchPage = function (page, filter, options) {
30299
+ AbstractUserEventService.prototype.watchPage = function (page, filter, opts) {
30293
30300
  var _this = this;
30294
30301
  var _a;
30295
30302
  var now = this._debug && Date.now();
@@ -30306,7 +30313,7 @@
30306
30313
  filter.recipients = [recipient];
30307
30314
  }
30308
30315
  }
30309
- var withContent = (options === null || options === void 0 ? void 0 : options.withContent) === true;
30316
+ var withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
30310
30317
  return this.mutableWatchQuery({
30311
30318
  queryName: withContent ? 'LoadAllWithContent' : 'LoadAll',
30312
30319
  query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
@@ -30319,33 +30326,121 @@
30319
30326
  },
30320
30327
  arrayFieldName: 'data',
30321
30328
  error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
30322
- fetchPolicy: (options === null || options === void 0 ? void 0 : options.fetchPolicy) || 'cache-first'
30329
+ fetchPolicy: (opts === null || opts === void 0 ? void 0 : opts.fetchPolicy) || 'cache-first',
30330
+ insertFilterFn: filter && filter.asFilterFn()
30323
30331
  })
30324
- .pipe(operators.map(function (res) {
30325
- var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
30326
- if (now) {
30327
- console.debug("" + _this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
30328
- now = null;
30329
- }
30330
- // Must re-order because of listenChanges result will add new event at the end
30331
- data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
30332
- return {
30333
- data: data,
30334
- total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
30335
- };
30336
- }));
30332
+ .pipe(operators.mergeMap(function (res) { return __awaiter(_this, void 0, void 0, function () {
30333
+ var data, result, nextOffset_1;
30334
+ var _this = this;
30335
+ return __generator(this, function (_b) {
30336
+ switch (_b.label) {
30337
+ case 0: return [4 /*yield*/, Promise.all(((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
30338
+ case 1:
30339
+ data = _b.sent();
30340
+ if (now) {
30341
+ console.debug("" + this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
30342
+ now = null;
30343
+ }
30344
+ // Must re-order because of listenAllChanges result will add new event at the end
30345
+ data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
30346
+ result = {
30347
+ data: data,
30348
+ total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
30349
+ };
30350
+ // Add fetch more capability, if total was fetched
30351
+ if (isNotNil(res.total)) {
30352
+ nextOffset_1 = (page.offset || 0) + data.length;
30353
+ if (nextOffset_1 < result.total) {
30354
+ result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_1 }), filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
30355
+ }
30356
+ }
30357
+ return [2 /*return*/, result];
30358
+ }
30359
+ });
30360
+ }); }));
30361
+ };
30362
+ AbstractUserEventService.prototype.loadPage = function (page, filter, opts) {
30363
+ var _a;
30364
+ return __awaiter(this, void 0, void 0, function () {
30365
+ var now, recipient, withContent, res, data, result, nextOffset_2;
30366
+ var _this = this;
30367
+ return __generator(this, function (_b) {
30368
+ switch (_b.label) {
30369
+ case 0:
30370
+ now = this._debug && Date.now();
30371
+ if (!filter)
30372
+ filter = this.defaultFilter();
30373
+ console.debug(this._logPrefix + "Loading user events...", filter);
30374
+ filter = this.asFilter(filter);
30375
+ // Force recipient to current issuer, if not admin and not specified
30376
+ if (isEmptyArray(filter === null || filter === void 0 ? void 0 : filter.recipients) || !this.accountService.isAdmin()) {
30377
+ recipient = this.defaultRecipient();
30378
+ if (!((_a = filter === null || filter === void 0 ? void 0 : filter.recipients) === null || _a === void 0 ? void 0 : _a.includes(recipient))) {
30379
+ console.warn('[user-events-service] Force user event filter.recipient=' + recipient);
30380
+ filter.recipients = [recipient];
30381
+ }
30382
+ }
30383
+ withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
30384
+ return [4 /*yield*/, this.graphql.query({
30385
+ query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30386
+ variables: {
30387
+ page: Object.assign(Object.assign({ sortBy: 'creationDate' }, page), {
30388
+ // @ts-ignore
30389
+ sortDirection: (page.sortDirection || 'desc').toUpperCase()
30390
+ }),
30391
+ filter: filter && filter.asPodObject()
30392
+ },
30393
+ error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
30394
+ fetchPolicy: opts === null || opts === void 0 ? void 0 : opts.fetchPolicy
30395
+ })];
30396
+ case 1:
30397
+ res = _b.sent();
30398
+ return [4 /*yield*/, Promise.all(((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
30399
+ case 2:
30400
+ data = _b.sent();
30401
+ if (now)
30402
+ console.debug("" + this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
30403
+ // Must re-order because of listenAllChanges result will add new event at the end
30404
+ data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
30405
+ result = {
30406
+ data: data,
30407
+ total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
30408
+ };
30409
+ // Add fetch more capability, if total was fetched
30410
+ if (isNotNil(res.total)) {
30411
+ nextOffset_2 = (page.offset || 0) + data.length;
30412
+ if (nextOffset_2 < result.total) {
30413
+ result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_2 }), filter, opts); };
30414
+ }
30415
+ }
30416
+ return [2 /*return*/, result];
30417
+ }
30418
+ });
30419
+ });
30337
30420
  };
30338
30421
  AbstractUserEventService.prototype.add = function (entity) {
30339
- // TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
30340
- entity = this.processUserEvent(entity);
30341
- var withContent = !!entity.content;
30342
- // Add user event locally
30343
- this.insertIntoMutableCachedQueries(this.graphql.cache, {
30344
- query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30345
- data: entity
30422
+ return __awaiter(this, void 0, void 0, function () {
30423
+ var withContent;
30424
+ return __generator(this, function (_b) {
30425
+ switch (_b.label) {
30426
+ case 0: return [4 /*yield*/, this.processUserEvent(entity)];
30427
+ case 1:
30428
+ // TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
30429
+ entity = _b.sent();
30430
+ if (!entity)
30431
+ return [2 /*return*/]; // Rejected
30432
+ withContent = !!entity.content;
30433
+ // Add user event locally
30434
+ this.insertIntoMutableCachedQueries(this.graphql.cache, {
30435
+ query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30436
+ data: entity
30437
+ });
30438
+ // Update count
30439
+ this._countSubject.next(this._countSubject.value + 1);
30440
+ return [2 /*return*/];
30441
+ }
30442
+ });
30346
30443
  });
30347
- // Update count
30348
- this._countSubject.next(this._countSubject.value + 1);
30349
30444
  };
30350
30445
  AbstractUserEventService.prototype.count = function (filter, options) {
30351
30446
  var _a;
@@ -30391,6 +30486,7 @@
30391
30486
  filter = this.defaultFilter();
30392
30487
  // Apply last reset date as start date
30393
30488
  filter.startDate = this.resetCountDate;
30489
+ filter.excludeRead = true;
30394
30490
  filter = this.asFilter(filter);
30395
30491
  if (this._debug)
30396
30492
  console.debug(this._logPrefix + "[WS] Listening count changes for user events with filter:", filter);
@@ -30411,11 +30507,11 @@
30411
30507
  return total;
30412
30508
  }));
30413
30509
  };
30414
- AbstractUserEventService.prototype.listenChanges = function (filter, options) {
30510
+ AbstractUserEventService.prototype.listenAllChanges = function (filter, options) {
30415
30511
  var _this = this;
30416
30512
  var _a;
30417
- if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.listenChanges)) {
30418
- console.warn(this._logPrefix + "Subscription query 'listenChanges' not provided, skip.");
30513
+ if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.listenAllChanges)) {
30514
+ console.warn(this._logPrefix + "Subscription query 'listenAllChanges' not provided, skip.");
30419
30515
  return rxjs.of();
30420
30516
  }
30421
30517
  if (!filter)
@@ -30425,24 +30521,35 @@
30425
30521
  if (this._debug)
30426
30522
  console.debug(this._logPrefix + "[WS] Listening changes for user events with filter:", filter);
30427
30523
  return this.graphql.subscribe({
30428
- query: this.subscriptions.listenChanges,
30524
+ query: this.subscriptions.listenAllChanges,
30429
30525
  fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
30430
30526
  variables: { filter: filter.asPodObject(), interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
30431
30527
  error: {
30432
30528
  code: SocialErrorCodes.SUBSCRIBE_USER_EVENTS_ERROR,
30433
30529
  message: 'SOCIAL.ERROR.SUBSCRIBE_USER_EVENTS_ERROR'
30434
30530
  }
30435
- }).pipe(operators.map(function (_b) {
30531
+ }).pipe(operators.mergeMap(function (_b) {
30436
30532
  var data = _b.data;
30437
- if (data && _this._debug)
30438
- console.debug(_this._logPrefix + "Received new user events:", data);
30439
- var updatedData = data === null || data === void 0 ? void 0 : data.map(function (value) { return _this.processUserEvent(value, _this); });
30440
- // Update cache
30441
- _this.insertIntoMutableCachedQueries(_this.graphql.cache, {
30442
- query: withContent ? _this.queries.loadAllWithContent : _this.queries.loadAll,
30443
- data: updatedData
30444
- });
30445
- return updatedData;
30533
+ return __awaiter(_this, void 0, void 0, function () {
30534
+ var updatedData;
30535
+ var _this = this;
30536
+ return __generator(this, function (_b) {
30537
+ switch (_b.label) {
30538
+ case 0:
30539
+ if (data && this._debug)
30540
+ console.debug(this._logPrefix + "Received new user events:", data);
30541
+ return [4 /*yield*/, Promise.all((data || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
30542
+ case 1:
30543
+ updatedData = _b.sent();
30544
+ // Update cache
30545
+ this.insertIntoMutableCachedQueries(this.graphql.cache, {
30546
+ query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30547
+ data: updatedData
30548
+ });
30549
+ return [2 /*return*/, updatedData];
30550
+ }
30551
+ });
30552
+ });
30446
30553
  }));
30447
30554
  };
30448
30555
  AbstractUserEventService.prototype.delete = function (entity) {
@@ -30559,7 +30666,7 @@
30559
30666
  });
30560
30667
  });
30561
30668
  };
30562
- AbstractUserEventService.prototype.markAsRead = function (entities) {
30669
+ AbstractUserEventService.prototype.markAllAsRead = function (entities) {
30563
30670
  return __awaiter(this, void 0, void 0, function () {
30564
30671
  var userEventWithoutReadListeners, _loop_1, this_1, _b, _c, entity, e_1_1;
30565
30672
  var e_1, _d;
@@ -30692,33 +30799,60 @@
30692
30799
  this._listenSubscription = undefined;
30693
30800
  };
30694
30801
  AbstractUserEventService.prototype.processUserEvent = function (source, that) {
30695
- var e_3, _b;
30696
- that = that || this;
30697
- // Convert json source to IUserEvent
30698
- var target = that.fromObject(source);
30699
- // Get listeners
30700
- var listeners = (that.listeners || []).filter(function (listener) { return listener.onReceived; }).filter(function (listener) { return listener.accept(target); });
30701
- try {
30702
- for (var listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next(); !listeners_1_1.done; listeners_1_1 = listeners_1.next()) {
30703
- var listener = listeners_1_1.value;
30704
- if (target) {
30705
- target = listener.onReceived(target);
30706
- }
30707
- else {
30708
- if (that._debug)
30709
- console.debug(that._logPrefix + "Event has been rejected by a listener", source);
30710
- break;
30802
+ return __awaiter(this, void 0, void 0, function () {
30803
+ var target, listeners, listeners_1, listeners_1_1, listener, res, _b, e_3_1;
30804
+ var e_3, _c;
30805
+ return __generator(this, function (_d) {
30806
+ switch (_d.label) {
30807
+ case 0:
30808
+ that = that || this;
30809
+ target = that.fromObject(source);
30810
+ listeners = (that.listeners || [])
30811
+ .filter(function (listener) { return !!listener.onReceived; })
30812
+ .filter(function (listener) { return listener.accept(target); });
30813
+ _d.label = 1;
30814
+ case 1:
30815
+ _d.trys.push([1, 9, 10, 11]);
30816
+ listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next();
30817
+ _d.label = 2;
30818
+ case 2:
30819
+ if (!!listeners_1_1.done) return [3 /*break*/, 8];
30820
+ listener = listeners_1_1.value;
30821
+ if (!target) return [3 /*break*/, 6];
30822
+ res = listener.onReceived(target);
30823
+ if (!(res instanceof Promise)) return [3 /*break*/, 4];
30824
+ return [4 /*yield*/, res];
30825
+ case 3:
30826
+ _b = _d.sent();
30827
+ return [3 /*break*/, 5];
30828
+ case 4:
30829
+ _b = res;
30830
+ _d.label = 5;
30831
+ case 5:
30832
+ target = _b;
30833
+ return [3 /*break*/, 7];
30834
+ case 6:
30835
+ if (that._debug)
30836
+ console.debug(that._logPrefix + "Event has been rejected by a listener", source);
30837
+ return [3 /*break*/, 8];
30838
+ case 7:
30839
+ listeners_1_1 = listeners_1.next();
30840
+ return [3 /*break*/, 2];
30841
+ case 8: return [3 /*break*/, 11];
30842
+ case 9:
30843
+ e_3_1 = _d.sent();
30844
+ e_3 = { error: e_3_1 };
30845
+ return [3 /*break*/, 11];
30846
+ case 10:
30847
+ try {
30848
+ if (listeners_1_1 && !listeners_1_1.done && (_c = listeners_1.return)) _c.call(listeners_1);
30849
+ }
30850
+ finally { if (e_3) throw e_3.error; }
30851
+ return [7 /*endfinally*/];
30852
+ case 11: return [2 /*return*/, target];
30711
30853
  }
30712
- }
30713
- }
30714
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
30715
- finally {
30716
- try {
30717
- if (listeners_1_1 && !listeners_1_1.done && (_b = listeners_1.return)) _b.call(listeners_1);
30718
- }
30719
- finally { if (e_3) throw e_3.error; }
30720
- }
30721
- return target;
30854
+ });
30855
+ });
30722
30856
  };
30723
30857
  AbstractUserEventService.prototype.defaultMarkAsRead = function (userEvents) {
30724
30858
  var _a;
@@ -30805,28 +30939,47 @@
30805
30939
  ]; };
30806
30940
 
30807
30941
  var UserEventNotificationList = /** @class */ (function () {
30808
- function UserEventNotificationList(cd, popoverController, userEventService) {
30942
+ function UserEventNotificationList(cd, popoverController, settings, userEventService) {
30943
+ var _a;
30809
30944
  this.cd = cd;
30810
30945
  this.popoverController = popoverController;
30946
+ this.settings = settings;
30811
30947
  this.userEventService = userEventService;
30812
- this.debug = false;
30813
- this.userEvents = new rxjs.BehaviorSubject(undefined);
30814
30948
  this.subscriptions = new rxjs.Subscription();
30949
+ this._fetchingMore = false;
30950
+ this.debug = false;
30951
+ this.pageSize = 10;
30952
+ this.sortBy = 'creationDate';
30953
+ this.sortDirection = 'desc';
30954
+ this.enableInfiniteScroll = true;
30955
+ this.$items = new rxjs.BehaviorSubject(undefined);
30956
+ this.$itemCount = new rxjs.BehaviorSubject(undefined);
30957
+ this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
30815
30958
  }
30959
+ Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
30960
+ get: function () {
30961
+ return this.enableInfiniteScroll && !!this._fetchMoreFn;
30962
+ },
30963
+ enumerable: false,
30964
+ configurable: true
30965
+ });
30816
30966
  UserEventNotificationList.prototype.ngOnInit = function () {
30817
30967
  var _this = this;
30818
30968
  // Watch all user events
30819
30969
  if (this.userEventService) {
30820
30970
  this.subscriptions.add(this.userEventService
30821
- .watchAll(0, 10, 'creationDate', 'desc', undefined)
30971
+ .watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
30822
30972
  .subscribe(function (result) {
30973
+ var _a;
30823
30974
  if (_this.debug)
30824
30975
  console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
30825
- _this.userEvents.next(result.data);
30976
+ _this.$items.next(result.data);
30977
+ _this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
30978
+ _this._fetchMoreFn = result.fetchMore;
30826
30979
  _this.markForCheck();
30827
30980
  }));
30828
30981
  // Listen changes
30829
- this.subscriptions.add(this.userEventService.listenChanges(undefined)
30982
+ this.subscriptions.add(this.userEventService.listenAllChanges(undefined)
30830
30983
  .subscribe(function (data) {
30831
30984
  if (_this.debug)
30832
30985
  console.debug("[user-event-notification-list] receiving " + data.length + " new user events", data);
@@ -30836,27 +30989,130 @@
30836
30989
  UserEventNotificationList.prototype.ngOnDestroy = function () {
30837
30990
  this.subscriptions.unsubscribe();
30838
30991
  };
30839
- UserEventNotificationList.prototype.read = function (event, userEvent) {
30992
+ UserEventNotificationList.prototype.click = function (event, userEvent) {
30993
+ if (!userEvent)
30994
+ return; // Skip
30995
+ // MarkAsRead
30996
+ this.markAsRead(event, userEvent);
30997
+ // Get the default action (if any)
30998
+ var defaultAction = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.default; });
30999
+ if (defaultAction) {
31000
+ this.executeAction(event, defaultAction, userEvent);
31001
+ }
31002
+ };
31003
+ UserEventNotificationList.prototype.isDefaultAction = function (action) {
31004
+ return action && action.default || false;
31005
+ };
31006
+ UserEventNotificationList.prototype.markAsRead = function (event, userEvent) {
30840
31007
  var _a;
30841
31008
  if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
30842
31009
  return;
30843
31010
  (_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
30844
31011
  };
30845
- UserEventNotificationList.prototype.readAll = function (event) {
31012
+ UserEventNotificationList.prototype.markAllAsRead = function (event) {
30846
31013
  var _a;
30847
- var unreadUserEvents = (this.userEvents.value || []).filter(function (value) { return !value.readDate; });
31014
+ var unreadUserEvents = (this.$items.value || []).filter(function (value) { return !value.readDate; });
30848
31015
  if (!unreadUserEvents.length)
30849
31016
  return;
30850
31017
  (_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
30851
31018
  };
30852
- UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
30853
- // Execute then close popover
30854
- action.executeAction(userEvent);
30855
- this.dismiss();
31019
+ UserEventNotificationList.prototype.executeAction = function (event, action, userEvent) {
31020
+ return __awaiter(this, void 0, void 0, function () {
31021
+ var res, err_1;
31022
+ return __generator(this, function (_b) {
31023
+ switch (_b.label) {
31024
+ case 0:
31025
+ if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
31026
+ return [2 /*return*/]; // Skip if prevented
31027
+ // Disable default action (.e.g avoid to call click() function)
31028
+ if (event)
31029
+ event.preventDefault();
31030
+ _b.label = 1;
31031
+ case 1:
31032
+ _b.trys.push([1, 4, , 5]);
31033
+ res = action.executeAction(userEvent);
31034
+ this.dismiss();
31035
+ if (!(res instanceof Promise)) return [3 /*break*/, 3];
31036
+ return [4 /*yield*/, res];
31037
+ case 2:
31038
+ _b.sent();
31039
+ _b.label = 3;
31040
+ case 3: return [3 /*break*/, 5];
31041
+ case 4:
31042
+ err_1 = _b.sent();
31043
+ console.error(err_1);
31044
+ return [3 /*break*/, 5];
31045
+ case 5: return [2 /*return*/];
31046
+ }
31047
+ });
31048
+ });
30856
31049
  };
30857
31050
  UserEventNotificationList.prototype.dismiss = function () {
30858
31051
  this.popoverController.dismiss();
30859
31052
  };
31053
+ UserEventNotificationList.prototype.fetchMore = function (event) {
31054
+ var _a;
31055
+ return __awaiter(this, void 0, void 0, function () {
31056
+ var result, data, err_2;
31057
+ return __generator(this, function (_b) {
31058
+ switch (_b.label) {
31059
+ case 0:
31060
+ if (!this._fetchMoreFn || this._fetchingMore)
31061
+ return [2 /*return*/];
31062
+ console.debug('[user-event-notification-list] Fetching more notifications...', event);
31063
+ this._fetchingMore = true;
31064
+ _b.label = 1;
31065
+ case 1:
31066
+ _b.trys.push([1, 3, 4, 5]);
31067
+ return [4 /*yield*/, this._fetchMoreFn()];
31068
+ case 2:
31069
+ result = _b.sent();
31070
+ data = __spread((this.$items.value || []), result.data);
31071
+ // Remove duplication (e.g. when new user event was added by subscription)
31072
+ data = removeDuplicatesFromArray(data, 'id');
31073
+ this.$items.next(data);
31074
+ this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
31075
+ this._fetchMoreFn = result.fetchMore;
31076
+ return [3 /*break*/, 5];
31077
+ case 3:
31078
+ err_2 = _b.sent();
31079
+ console.error(err_2);
31080
+ this._fetchMoreFn = undefined;
31081
+ return [3 /*break*/, 5];
31082
+ case 4:
31083
+ this.markForCheck();
31084
+ this._fetchingMore = false;
31085
+ return [7 /*endfinally*/];
31086
+ case 5: return [2 /*return*/];
31087
+ }
31088
+ });
31089
+ });
31090
+ };
31091
+ UserEventNotificationList.prototype._initInfiniteScroll = function (threshold) {
31092
+ return __awaiter(this, void 0, void 0, function () {
31093
+ var panel;
31094
+ var _this = this;
31095
+ return __generator(this, function (_b) {
31096
+ switch (_b.label) {
31097
+ case 0:
31098
+ if (this._fetchMoreSubscription)
31099
+ this._fetchMoreSubscription.unsubscribe();
31100
+ threshold = threshold || (this.mobile ? '15%' : '2%');
31101
+ return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
31102
+ case 1:
31103
+ _b.sent();
31104
+ return [4 /*yield*/, this.ionContent.getScrollElement()];
31105
+ case 2:
31106
+ panel = _b.sent();
31107
+ // Trigger fetch more, end end scroll reached
31108
+ this._fetchMoreSubscription = fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/)
31109
+ .subscribe(function () { return _this.fetchMore(); });
31110
+ this.subscriptions.add(this._fetchMoreSubscription);
31111
+ return [2 /*return*/];
31112
+ }
31113
+ });
31114
+ });
31115
+ };
30860
31116
  UserEventNotificationList.prototype.markForCheck = function () {
30861
31117
  this.cd.markForCheck();
30862
31118
  };
@@ -30865,21 +31121,30 @@
30865
31121
  UserEventNotificationList.decorators = [
30866
31122
  { type: i0.Component, args: [{
30867
31123
  selector: 'app-user-event-notification-list',
30868
- template: "\n<ion-list class=\"ion-list-popover\">\n\n <ion-row class=\"ion-list-header column\">\n <ion-col>\n <ion-label>{{titleI18n | translate}}</ion-label>\n </ion-col>\n <ion-col class=\"top-action\" *ngIf=\"userEvents|async|isNotEmptyArray\">\n <ion-text color=\"primary\">\n <a (click)=\"readAll($event)\">{{'SOCIAL.USER_EVENT.NOTIFICATION.READ_ALL' | translate}}</a>\n </ion-text>\n </ion-col>\n </ion-row>\n\n <ion-item *ngIf=\"userEvents|async|isEmptyArray\" lines=\"none\">\n <ion-text color=\"dark\" class=\"text-italic\">{{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}</ion-text>\n </ion-item>\n <ion-item\n *ngFor=\"let userEvent of userEvents | async\"\n (click)=\"read($event, userEvent)\"\n >\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"userEvent.avatar; else avatarIcon\" src=\"{{ userEvent.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"userEvent.avatarIcon\"\n [ref]=\"userEvent.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n </ion-avatar>\n\n <ion-grid class=\"ion-no-margin ion-no-padding message\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\" [innerHTML]=\"userEvent.message\"></p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <span *ngFor=\"let action of userEvent.actions\" class=\"action\">\n <a (click)=\"executeAction(action, userEvent)\">\n <app-icon *ngIf=\"action.iconRef\" slot=\"start\" height=\"20\" width=\"20\" [ref]=\"action.iconRef\"></app-icon>\n {{ action.name }}\n </a>\n </span>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <app-icon\n *ngIf=\"userEvent.icon\"\n [ref]=\"userEvent.icon\"\n height=\"16\"\n width=\"16\"\n style=\"vertical-align: sub; margin-right: 3px\"\n ></app-icon>\n <small>\n <span>{{userEvent.creationDate|dateFromNow}}</span>\n <span style=\"color: gray\">{{ ' | ' + (userEvent.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-item>\n\n <ion-row class=\"ion-list-footer column\">\n </ion-row>\n\n</ion-list>\n",
31124
+ template: "<ion-content>\n <ion-list class=\"ion-list-popover\">\n\n <ion-row class=\"ion-list-header column\">\n <ion-col>\n <ion-label>{{titleI18n | translate}}</ion-label>\n </ion-col>\n <ion-col class=\"top-action\" *ngIf=\"$items|async|isNotEmptyArray\">\n <ion-text color=\"primary\">\n <a (click)=\"markAllAsRead($event)\">{{'SOCIAL.USER_EVENT.NOTIFICATION.READ_ALL' | translate}}</a>\n </ion-text>\n </ion-col>\n </ion-row>\n\n <ion-item\n *ngFor=\"let item of $items | async; last as last\"\n [lines]=\"last ? 'none' : undefined\"\n [class.unread]=\"!item.readDate\"\n [class.tappable]=\"item.actions|arrayFilter:isDefaultAction|isNotEmptyArray\"\n (click)=\"click($event, item)\">\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"item.avatar; else avatarIcon\" src=\"{{ item.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"item.avatarIcon; else generateIcon\"\n [ref]=\"item.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n <ng-template #generateIcon>\n <div class=\"avatar\" *ngIf=\"item.avatarJdenticon\">\n <svg width=\"40\" width=\"40\" [data-jdenticon-value]=\"item.avatarJdenticon\"></svg>\n </div>\n </ng-template>\n\n </ion-avatar>\n\n <ion-grid class=\"ion-no-margin ion-no-padding message\">\n <ion-row>\n <ion-col size=\"12\">\n <p [class.unread]=\"!item.readDate\" [innerHTML]=\"item.message\"></p>\n </ion-col>\n </ion-row>\n\n <!-- date -->\n <ion-row>\n <ion-col size=\"12\">\n <app-icon\n *ngIf=\"item.icon\"\n [ref]=\"item.icon\"\n height=\"16\"\n width=\"16\"\n style=\"vertical-align: sub; margin-right: 3px\"\n ></app-icon>\n <small>\n <span>{{item.creationDate|dateFromNow}}</span>\n <span style=\"color: gray\">{{ ' | ' + (item.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n\n <!-- actions -->\n <ion-row *ngIf=\"item.actions|isNotEmptyArray\">\n <ion-col></ion-col>\n <ion-col size=\"auto\">\n <ng-container *ngFor=\"let action of item.actions\">\n <a *ngIf=\"!action.default\" class=\"action\" (click)=\"executeAction($event, action, item)\" [title]=\"(action.title || action.name) |translate\">\n <app-icon *ngIf=\"action.iconRef\" slot=\"start\" height=\"20\" width=\"20\" [ref]=\"action.iconRef\"></app-icon>\n <span>{{ action.name | translate }}</span>\n </a>\n </ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n <mat-icon slot=\"end\" *ngIf=\"item.actions|arrayFilter: isDefaultAction|isNotEmptyArray\">chevron_right</mat-icon>\n </ion-item>\n\n <!-- loading -->\n <ion-item *ngIf=\"!($items|async); else noResult\" lines=\"none\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </ion-item>\n\n <!-- no result -->\n <ng-template #noResult>\n <ion-item *ngIf=\"$items|async|isEmptyArray\" lines=\"none\">\n <ion-text color=\"dark\" class=\"text-italic\">{{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}</ion-text>\n </ion-item>\n </ng-template>\n\n <!-- Loading more spinner -->\n <ion-item *ngIf=\"canFetchMore\" (ngInit)=\"_initInfiniteScroll()\" lines=\"none\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </ion-item>\n\n <!-- footer -->\n <ion-row *ngIf=\"$itemCount|async; let count\"\n class=\"ion-list-footer column\">\n <ion-col>\n <ion-text class=\"ion-float-end ion-padding-end\"><i>{{'COMMON.RESULT_COUNT'|translate: {count: count} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n </ion-list>\n</ion-content>\n",
30869
31125
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
30870
- styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.unread{font-weight:700}.message{font-size:.9em}.message p{margin-top:5px;margin-bottom:5px}.top-action{text-align:end;margin-right:8px}.top-action a{cursor:pointer;color:var(--ion-color-contrast)}.top-action a:hover{text-decoration:underline}.action a{margin-right:10px;cursor:pointer}.action app-icon{vertical-align:middle}"]
31126
+ styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-height:calc(90vh - 20px)}ion-list ion-item.tappable{cursor:pointer}ion-list ion-item.tappable:hover{--ion-item-background:var(--ion-item-background-color-hover)}.message{font-size:.9em}.message p{margin-top:5px;margin-bottom:5px}.message p.unread{font-weight:700}.top-action{text-align:end;margin-right:8px}.top-action a{cursor:pointer;color:var(--ion-color-contrast)}.top-action a:hover{text-decoration:underline}a.action{font-size:.9em;margin-right:10px;cursor:pointer}a.action:hover span{text-decoration:underline}a.action app-icon{vertical-align:middle}ion-avatar .avatar svg,ion-avatar img{border:1px solid rgba(var(--ion-color-secondary-rgb,.5));border-radius:50%}"]
30871
31127
  },] }
30872
31128
  ];
30873
31129
  UserEventNotificationList.ctorParameters = function () { return [
30874
31130
  { type: i0.ChangeDetectorRef },
30875
31131
  { type: i1$5.PopoverController },
31132
+ { type: LocalSettingsService, decorators: [{ type: i0.Optional }] },
30876
31133
  { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] }
30877
31134
  ]; };
30878
31135
  UserEventNotificationList.propDecorators = {
30879
31136
  debug: [{ type: i0.Input }],
31137
+ mobile: [{ type: i0.Input }],
30880
31138
  titleI18n: [{ type: i0.Input }],
31139
+ pageSize: [{ type: i0.Input }],
31140
+ sortBy: [{ type: i0.Input }],
31141
+ sortDirection: [{ type: i0.Input }],
31142
+ filter: [{ type: i0.Input }],
31143
+ enableInfiniteScroll: [{ type: i0.Input }],
30881
31144
  readEvent: [{ type: i0.Output }],
30882
- readEvents: [{ type: i0.Output }]
31145
+ readEvents: [{ type: i0.Output }],
31146
+ ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
31147
+ ionItems: [{ type: i0.ViewChildren, args: [i1$5.IonItem,] }]
30883
31148
  };
30884
31149
 
30885
31150
  var AppUserEventNotificationIcon = /** @class */ (function () {
@@ -30923,12 +31188,12 @@
30923
31188
  // Wait service
30924
31189
  _a.sent();
30925
31190
  // Subscribe to read event
30926
- this._readEvent.subscribe(function (value) {
31191
+ this._readEvent.subscribe(function (item) {
30927
31192
  // default: mark event as read
30928
- _this.userEventService.markAsRead([value]);
31193
+ _this.userEventService.markAllAsRead([item]);
30929
31194
  });
30930
- this._readEvents.subscribe(function (value) {
30931
- _this.userEventService.markAsRead(value);
31195
+ this._readEvents.subscribe(function (items) {
31196
+ _this.userEventService.markAllAsRead(items);
30932
31197
  });
30933
31198
  return [2 /*return*/];
30934
31199
  }
@@ -30955,7 +31220,7 @@
30955
31220
  keyboardClose: true,
30956
31221
  event: event,
30957
31222
  translucent: true,
30958
- cssClass: 'popover-large'
31223
+ cssClass: 'popover-large popover-notifications'
30959
31224
  })];
30960
31225
  case 1:
30961
31226
  popover = _a.sent();
@@ -31003,7 +31268,8 @@
31003
31268
  imports: [
31004
31269
  i1$4.CommonModule,
31005
31270
  SharedModule,
31006
- AppIconModule
31271
+ AppIconModule,
31272
+ ngxJdenticon.NgxJdenticonModule
31007
31273
  ],
31008
31274
  declarations: [
31009
31275
  AppUserEventNotificationIcon,
@@ -32077,7 +32343,6 @@
32077
32343
  _this.statusById = StatusById;
32078
32344
  _this.filterCriteriaCount = 0;
32079
32345
  _this.useSticky = false;
32080
- _this.referentialToString = referentialToString;
32081
32346
  _this.canEdit = accountService.isAdmin();
32082
32347
  _this.canSendMessage = _this.canEdit;
32083
32348
  _this.inlineEdition = _this.canEdit;
@@ -33853,6 +34118,472 @@
33853
34118
  },] }
33854
34119
  ];
33855
34120
 
34121
+ var JobProgressionTestService = /** @class */ (function () {
34122
+ function JobProgressionTestService() {
34123
+ }
34124
+ JobProgressionTestService.prototype.listenChanges = function (id, options) {
34125
+ return rxjs.interval(100).pipe(operators.take(111), operators.map(function (value) {
34126
+ if (value <= 10) {
34127
+ return {
34128
+ id: id,
34129
+ name: "Job #" + id,
34130
+ current: 0,
34131
+ total: 0,
34132
+ message: "Progression pending"
34133
+ };
34134
+ }
34135
+ value = value - 10;
34136
+ return {
34137
+ id: id,
34138
+ name: "Job #" + id,
34139
+ current: value,
34140
+ total: 100,
34141
+ message: "Progression " + value + "/100"
34142
+ };
34143
+ }));
34144
+ };
34145
+ return JobProgressionTestService;
34146
+ }());
34147
+ JobProgressionTestService.decorators = [
34148
+ { type: i0.Injectable }
34149
+ ];
34150
+
34151
+ var JobProgressionTestingPage = /** @class */ (function () {
34152
+ function JobProgressionTestingPage() {
34153
+ this.nJob = 0;
34154
+ this.options = {
34155
+ autoHide: true
34156
+ };
34157
+ this.job = new exports.JobProgression();
34158
+ this.job.id = 0;
34159
+ this.job.name = 'test';
34160
+ this.job.current = 0;
34161
+ this.job.total = 100;
34162
+ }
34163
+ JobProgressionTestingPage.prototype.incrementJob = function (value) {
34164
+ this.job.current = Math.max(0, this.job.current + value);
34165
+ this.job.message = "Fake progression (very long message very long message very long message very long message) " + this.job.current + "/100";
34166
+ if (this.job.current > this.job.total) {
34167
+ this.jobProgression.removeJob(0);
34168
+ this.job.current = 0;
34169
+ }
34170
+ else if (!this.jobProgression.getProgression(0)) {
34171
+ this.jobProgression.jobProgressions.push(this.job);
34172
+ }
34173
+ this.jobProgression.updateValue();
34174
+ };
34175
+ JobProgressionTestingPage.prototype.addJob = function () {
34176
+ // Add fake job
34177
+ this.nJob++;
34178
+ this.jobProgression.addJob(this.nJob);
34179
+ };
34180
+ return JobProgressionTestingPage;
34181
+ }());
34182
+ JobProgressionTestingPage.decorators = [
34183
+ { type: i0.Component, args: [{
34184
+ selector: 'job-progression-testing',
34185
+ template: "<ion-toolbar color=\"primary\">\n <ion-title>Job progression</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-job-progression #jobProgression [debug]=\"true\" [options]=\"options\" ></app-job-progression>\n\n <p>\n <ion-button (click)=\"incrementJob(10)\">\n +10\n </ion-button>\n <ion-button (click)=\"incrementJob(-10)\">\n -10\n </ion-button>\n </p>\n <p>\n <ion-button (click)=\"addJob()\">Add Job</ion-button>\n </p>\n</ion-content>\n",
34186
+ providers: [
34187
+ { provide: JobProgressionServiceToken, useClass: JobProgressionTestService }
34188
+ ]
34189
+ },] }
34190
+ ];
34191
+ JobProgressionTestingPage.ctorParameters = function () { return []; };
34192
+ JobProgressionTestingPage.propDecorators = {
34193
+ jobProgression: [{ type: i0.ViewChild, args: ['jobProgression',] }]
34194
+ };
34195
+
34196
+ var JobTestingModule = /** @class */ (function () {
34197
+ function JobTestingModule() {
34198
+ }
34199
+ return JobTestingModule;
34200
+ }());
34201
+ JobTestingModule.decorators = [
34202
+ { type: i0.NgModule, args: [{
34203
+ imports: [
34204
+ i1$4.CommonModule,
34205
+ i1$2.TranslateModule.forChild(),
34206
+ SharedModule,
34207
+ JobModule
34208
+ ],
34209
+ declarations: [
34210
+ JobProgressionTestingPage
34211
+ ],
34212
+ exports: [
34213
+ JobProgressionTestingPage
34214
+ ]
34215
+ },] }
34216
+ ];
34217
+
34218
+ var UserEventTestService = /** @class */ (function (_super) {
34219
+ __extends(UserEventTestService, _super);
34220
+ function UserEventTestService(graphql, accountService, network, translate, environment) {
34221
+ var _this = _super.call(this, graphql, accountService, network, translate, {
34222
+ queries: {
34223
+ loadAll: null,
34224
+ loadAllWithContent: null
34225
+ },
34226
+ production: environment === null || environment === void 0 ? void 0 : environment.production
34227
+ }) || this;
34228
+ _this.graphql = graphql;
34229
+ _this.accountService = accountService;
34230
+ _this.network = network;
34231
+ _this.translate = translate;
34232
+ _this.environment = environment;
34233
+ _this.userEvents = [];
34234
+ return _this;
34235
+ }
34236
+ UserEventTestService.prototype.fromObject = function (source) {
34237
+ return exports.UserEvent.fromObject(source);
34238
+ };
34239
+ UserEventTestService.prototype.add = function (entity) {
34240
+ return __awaiter(this, void 0, void 0, function () {
34241
+ return __generator(this, function (_b) {
34242
+ switch (_b.label) {
34243
+ case 0: return [4 /*yield*/, this.processUserEvent(entity)];
34244
+ case 1:
34245
+ entity = _b.sent();
34246
+ entity.id = this.userEvents.length + 1;
34247
+ this.userEvents = __spread([
34248
+ entity
34249
+ ], this.userEvents);
34250
+ this._countSubject.next((this._countSubject.value || 0) + 1);
34251
+ return [2 /*return*/];
34252
+ }
34253
+ });
34254
+ });
34255
+ };
34256
+ UserEventTestService.prototype.asFilter = function (filter) {
34257
+ return filter;
34258
+ };
34259
+ UserEventTestService.prototype.count = function (filter, options) {
34260
+ return Promise.resolve(this.userEvents.length);
34261
+ };
34262
+ UserEventTestService.prototype.delete = function (entity) {
34263
+ return Promise.resolve(undefined);
34264
+ };
34265
+ UserEventTestService.prototype.deleteAll = function (data, opts) {
34266
+ return Promise.resolve(undefined);
34267
+ };
34268
+ UserEventTestService.prototype.listenAllChanges = function (filter, options) {
34269
+ return rxjs.of();
34270
+ };
34271
+ UserEventTestService.prototype.save = function (entity, options) {
34272
+ var _a;
34273
+ var toSave = (_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id == (entity === null || entity === void 0 ? void 0 : entity.id); });
34274
+ Object.assign(toSave, entity);
34275
+ return entity;
34276
+ };
34277
+ UserEventTestService.prototype.saveAll = function (data, opts) {
34278
+ return __awaiter(this, void 0, void 0, function () {
34279
+ var _b, _c, entity, e_1_1;
34280
+ var e_1, _d;
34281
+ return __generator(this, function (_e) {
34282
+ switch (_e.label) {
34283
+ case 0:
34284
+ _e.trys.push([0, 5, 6, 7]);
34285
+ _b = __values((data || [])), _c = _b.next();
34286
+ _e.label = 1;
34287
+ case 1:
34288
+ if (!!_c.done) return [3 /*break*/, 4];
34289
+ entity = _c.value;
34290
+ return [4 /*yield*/, this.save(entity)];
34291
+ case 2:
34292
+ _e.sent();
34293
+ _e.label = 3;
34294
+ case 3:
34295
+ _c = _b.next();
34296
+ return [3 /*break*/, 1];
34297
+ case 4: return [3 /*break*/, 7];
34298
+ case 5:
34299
+ e_1_1 = _e.sent();
34300
+ e_1 = { error: e_1_1 };
34301
+ return [3 /*break*/, 7];
34302
+ case 6:
34303
+ try {
34304
+ if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
34305
+ }
34306
+ finally { if (e_1) throw e_1.error; }
34307
+ return [7 /*endfinally*/];
34308
+ case 7: return [2 /*return*/, Promise.resolve(this.userEvents)];
34309
+ }
34310
+ });
34311
+ });
34312
+ };
34313
+ UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34314
+ var _this = this;
34315
+ var _a;
34316
+ var data = (this.userEvents || []).slice(offset || 0, offset + size);
34317
+ var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
34318
+ var res = { data: data, total: total };
34319
+ // Must re-order because of listenChanges result will add new event at the end
34320
+ data = EntityUtils.sort(data, sortBy, sortDirection);
34321
+ // Add fetch more
34322
+ var nextOffset = offset + data.length;
34323
+ if (nextOffset < res.total) {
34324
+ res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
34325
+ }
34326
+ return rxjs.of(res);
34327
+ };
34328
+ UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34329
+ var _this = this;
34330
+ var _a;
34331
+ var data = (this.userEvents || []).slice(offset || 0, offset + size);
34332
+ var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
34333
+ var res = { data: data, total: total };
34334
+ // Must re-order because of listenChanges result will add new event at the end
34335
+ data = EntityUtils.sort(data, sortBy, sortDirection);
34336
+ // Add fetch more
34337
+ var nextOffset = offset + data.length;
34338
+ if (nextOffset < res.total) {
34339
+ res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
34340
+ }
34341
+ return Promise.resolve(res);
34342
+ };
34343
+ return UserEventTestService;
34344
+ }(AbstractUserEventService));
34345
+ UserEventTestService.decorators = [
34346
+ { type: i0.Injectable }
34347
+ ];
34348
+ UserEventTestService.ctorParameters = function () { return [
34349
+ { type: GraphqlService },
34350
+ { type: AccountService },
34351
+ { type: NetworkService },
34352
+ { type: i1$2.TranslateService },
34353
+ { type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
34354
+ ]; };
34355
+
34356
+ var moment$a = momentImported__namespace;
34357
+ var UserEventTestingPage = /** @class */ (function () {
34358
+ function UserEventTestingPage(userEventService, router, alertController, translateService) {
34359
+ var _this = this;
34360
+ this.userEventService = userEventService;
34361
+ this.router = router;
34362
+ this.alertController = alertController;
34363
+ this.translateService = translateService;
34364
+ userEventService.registerListener({
34365
+ accept: function (userEvent) { return true; },
34366
+ onReceived: function (userEvent) {
34367
+ _this.customize(userEvent);
34368
+ return userEvent;
34369
+ }
34370
+ });
34371
+ userEventService.registerListener({
34372
+ accept: function (userEvent) { return userEvent.level == "DEBUG"; },
34373
+ onRead: function (userEvent) { _this.showMessage("debug message read "); }
34374
+ });
34375
+ }
34376
+ UserEventTestingPage.prototype.customize = function (userEvent) {
34377
+ // Choose avatarIcon
34378
+ switch (userEvent.level) {
34379
+ case 'ERROR':
34380
+ userEvent.avatarIcon = { icon: 'close-outline', color: 'danger' };
34381
+ break;
34382
+ case 'WARNING':
34383
+ userEvent.avatarIcon = { icon: 'warning-outline', color: 'warning' };
34384
+ break;
34385
+ case 'INFO':
34386
+ userEvent.avatarIcon = { icon: 'information-circle-outline' };
34387
+ break;
34388
+ case 'DEBUG':
34389
+ userEvent.avatarIcon = { icon: 'cog', color: "medium" };
34390
+ break;
34391
+ }
34392
+ // Choose icon
34393
+ switch (userEvent.type) {
34394
+ case 'message':
34395
+ userEvent.icon = { matIcon: 'inbox', color: 'accent' };
34396
+ break;
34397
+ case 'upload':
34398
+ userEvent.icon = { matIcon: 'file_upload' };
34399
+ break;
34400
+ case 'download':
34401
+ userEvent.icon = { matIcon: 'file_download' };
34402
+ break;
34403
+ }
34404
+ };
34405
+ UserEventTestingPage.prototype.addNotification = function () {
34406
+ this.userEventService.add(exports.UserEvent.fromObject({
34407
+ issuer: 'system',
34408
+ recipient: 'me',
34409
+ type: 'message',
34410
+ level: 'INFO',
34411
+ message: 'message test message test message test message test message test message test message test message test',
34412
+ creationDate: moment$a(),
34413
+ }));
34414
+ };
34415
+ UserEventTestingPage.prototype.addError = function () {
34416
+ this.userEventService.add(exports.UserEvent.fromObject({
34417
+ issuer: 'system',
34418
+ recipient: 'me',
34419
+ type: 'upload',
34420
+ level: 'ERROR',
34421
+ message: 'message error',
34422
+ creationDate: moment$a(),
34423
+ }));
34424
+ };
34425
+ UserEventTestingPage.prototype.addWarning = function () {
34426
+ this.userEventService.add(exports.UserEvent.fromObject({
34427
+ issuer: 'system',
34428
+ recipient: 'me',
34429
+ type: 'download',
34430
+ level: 'WARNING',
34431
+ message: 'message warning',
34432
+ creationDate: moment$a(),
34433
+ }));
34434
+ };
34435
+ UserEventTestingPage.prototype.addDebug = function () {
34436
+ this.userEventService.add(exports.UserEvent.fromObject({
34437
+ issuer: 'system',
34438
+ recipient: 'me',
34439
+ type: 'debug',
34440
+ level: 'DEBUG',
34441
+ message: 'message DEBUG',
34442
+ creationDate: moment$a(),
34443
+ }));
34444
+ };
34445
+ UserEventTestingPage.prototype.addNotificationWithLink = function () {
34446
+ var _this = this;
34447
+ this.userEventService.add(exports.UserEvent.fromObject({
34448
+ issuer: 'system',
34449
+ recipient: 'me',
34450
+ type: 'message',
34451
+ level: 'INFO',
34452
+ message: 'message with link',
34453
+ creationDate: moment$a(),
34454
+ actions: [{
34455
+ name: 'click here',
34456
+ iconRef: {
34457
+ icon: 'arrow-forward-outline'
34458
+ },
34459
+ executeAction: function (event) { _this.router.navigateByUrl('/'); }
34460
+ }]
34461
+ }));
34462
+ };
34463
+ UserEventTestingPage.prototype.addNotificationWithAction = function () {
34464
+ var _this = this;
34465
+ this.userEventService.add(exports.UserEvent.fromObject({
34466
+ issuer: 'system',
34467
+ recipient: 'me',
34468
+ type: 'message',
34469
+ level: 'INFO',
34470
+ message: 'message with action',
34471
+ creationDate: moment$a(),
34472
+ actions: [
34473
+ {
34474
+ name: 'click here',
34475
+ iconRef: {
34476
+ icon: 'arrow-forward-outline',
34477
+ color: 'warning'
34478
+ },
34479
+ executeAction: function (event) { _this.showMessage('action 1'); }
34480
+ },
34481
+ {
34482
+ name: 'click here 2',
34483
+ iconRef: {
34484
+ matIcon: 'settings_applications',
34485
+ color: 'secondary'
34486
+ },
34487
+ executeAction: function (event) { _this.showMessage('action 2'); }
34488
+ }
34489
+ ]
34490
+ }));
34491
+ };
34492
+ UserEventTestingPage.prototype.addNotificationWithDefaultAction = function () {
34493
+ var _this = this;
34494
+ this.userEventService.add(exports.UserEvent.fromObject({
34495
+ issuer: 'system',
34496
+ recipient: 'me',
34497
+ type: 'message',
34498
+ level: 'INFO',
34499
+ message: 'message with action',
34500
+ creationDate: moment$a(),
34501
+ actions: [
34502
+ {
34503
+ default: true,
34504
+ name: 'default',
34505
+ executeAction: function (event) { _this.showMessage('default action'); }
34506
+ }
34507
+ ]
34508
+ }));
34509
+ };
34510
+ UserEventTestingPage.prototype.showMessage = function (text) {
34511
+ return Alerts.showError(text, this.alertController, this.translateService);
34512
+ };
34513
+ return UserEventTestingPage;
34514
+ }());
34515
+ UserEventTestingPage.decorators = [
34516
+ { type: i0.Component, args: [{
34517
+ selector: 'job-progression-testing',
34518
+ template: "<ion-toolbar color=\"primary\">\n <ion-title>User events</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-user-event-notification-icon #notification [debug]=\"true\"></app-user-event-notification-icon>\n\n <p>\n <ion-button (click)=\"addNotification()\">Add notification</ion-button>\n <ion-button (click)=\"addError()\">Add error</ion-button>\n <ion-button (click)=\"addWarning()\">Add warning</ion-button>\n <ion-button (click)=\"addDebug()\">Add debug</ion-button>\n </p>\n <p>\n <ion-button (click)=\"addNotificationWithLink()\">Add notification with link</ion-button>\n <ion-button (click)=\"addNotificationWithAction()\">Add notification with action</ion-button>\n <ion-button (click)=\"addNotificationWithDefaultAction()\">Add notification with default action</ion-button>\n </p>\n</ion-content>\n"
34519
+ },] }
34520
+ ];
34521
+ UserEventTestingPage.ctorParameters = function () { return [
34522
+ { type: UserEventTestService, decorators: [{ type: i0.Inject, args: [USER_EVENT_SERVICE,] }] },
34523
+ { type: i3.Router },
34524
+ { type: i1$5.AlertController },
34525
+ { type: i1$2.TranslateService }
34526
+ ]; };
34527
+ UserEventTestingPage.propDecorators = {
34528
+ notification: [{ type: i0.ViewChild, args: ['notification',] }]
34529
+ };
34530
+
34531
+ var UserEventTestingModule = /** @class */ (function () {
34532
+ function UserEventTestingModule() {
34533
+ }
34534
+ return UserEventTestingModule;
34535
+ }());
34536
+ UserEventTestingModule.decorators = [
34537
+ { type: i0.NgModule, args: [{
34538
+ imports: [
34539
+ i1$4.CommonModule,
34540
+ i1$2.TranslateModule.forChild(),
34541
+ SharedModule,
34542
+ UserEventModule
34543
+ ],
34544
+ declarations: [
34545
+ UserEventTestingPage
34546
+ ],
34547
+ exports: [
34548
+ UserEventTestingPage
34549
+ ]
34550
+ },] }
34551
+ ];
34552
+
34553
+ var SOCIAL_TESTING_PAGES = [
34554
+ { label: 'Social components', divider: true },
34555
+ { label: 'User event', page: '/testing/social/user-event' },
34556
+ { label: 'Job progression', page: '/testing/social/job-progression' }
34557
+ ];
34558
+ var routes$6 = [
34559
+ {
34560
+ path: 'job-progression',
34561
+ pathMatch: 'full',
34562
+ component: JobProgressionTestingPage
34563
+ },
34564
+ {
34565
+ path: 'user-event',
34566
+ pathMatch: 'full',
34567
+ component: UserEventTestingPage
34568
+ },
34569
+ ];
34570
+ var SocialTestingModule = /** @class */ (function () {
34571
+ function SocialTestingModule() {
34572
+ }
34573
+ return SocialTestingModule;
34574
+ }());
34575
+ SocialTestingModule.decorators = [
34576
+ { type: i0.NgModule, args: [{
34577
+ imports: [
34578
+ i1$4.CommonModule,
34579
+ i1$2.TranslateModule.forChild(),
34580
+ i3.RouterModule.forChild(routes$6),
34581
+ JobTestingModule,
34582
+ UserEventTestingModule
34583
+ ],
34584
+ },] }
34585
+ ];
34586
+
33856
34587
  // Environment
33857
34588
 
33858
34589
  /**
@@ -34008,6 +34739,9 @@
34008
34739
  exports.JobProgressionComponent = JobProgressionComponent;
34009
34740
  exports.JobProgressionService = JobProgressionService;
34010
34741
  exports.JobProgressionServiceToken = JobProgressionServiceToken;
34742
+ exports.JobProgressionTestService = JobProgressionTestService;
34743
+ exports.JobProgressionTestingPage = JobProgressionTestingPage;
34744
+ exports.JobTestingModule = JobTestingModule;
34011
34745
  exports.JobUtils = JobUtils;
34012
34746
  exports.KEYBOARD_HIDE_DELAY_MS = KEYBOARD_HIDE_DELAY_MS;
34013
34747
  exports.LAT_LONG_DEFAULT_MAX_DECIMALS = LAT_LONG_DEFAULT_MAX_DECIMALS;
@@ -34087,6 +34821,7 @@
34087
34821
  exports.SETTINGS_TRANSIENT_PROPERTIES = SETTINGS_TRANSIENT_PROPERTIES;
34088
34822
  exports.SHARED_MATERIAL_TESTING_PAGES = SHARED_MATERIAL_TESTING_PAGES;
34089
34823
  exports.SHARED_TESTING_PAGES = SHARED_TESTING_PAGES;
34824
+ exports.SOCIAL_TESTING_PAGES = SOCIAL_TESTING_PAGES;
34090
34825
  exports.SPACE_PLACEHOLDER_CHAR = SPACE_PLACEHOLDER_CHAR;
34091
34826
  exports.SelectPeerModal = SelectPeerModal;
34092
34827
  exports.ServerErrorCodes = ServerErrorCodes;
@@ -34115,6 +34850,7 @@
34115
34850
  exports.SocialErrorCodes = SocialErrorCodes;
34116
34851
  exports.SocialModule = SocialModule;
34117
34852
  exports.SocialModuleOptionsToken = SocialModuleOptionsToken;
34853
+ exports.SocialTestingModule = SocialTestingModule;
34118
34854
  exports.StartableService = StartableService;
34119
34855
  exports.StatusById = StatusById;
34120
34856
  exports.StatusIds = StatusIds;
@@ -34145,6 +34881,9 @@
34145
34881
  exports.UriUtils = UriUtils;
34146
34882
  exports.UserEventFragments = UserEventFragments;
34147
34883
  exports.UserEventModule = UserEventModule;
34884
+ exports.UserEventTestService = UserEventTestService;
34885
+ exports.UserEventTestingModule = UserEventTestingModule;
34886
+ exports.UserEventTestingPage = UserEventTestingPage;
34148
34887
  exports.UserEventTypes = UserEventTypes;
34149
34888
  exports.UsersPage = UsersPage;
34150
34889
  exports.accountToString = accountToString;