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

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 (27) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +266 -186
  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 +1 -2
  6. package/esm2015/src/app/core/services/model/person.model.js +4 -2
  7. package/esm2015/src/app/shared/file/file.utils.js +1 -1
  8. package/esm2015/src/app/social/user-event/notification/user-event-notification.icon.js +3 -2
  9. package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +47 -23
  10. package/esm2015/src/app/social/user-event/testing/user-event.testing.js +61 -10
  11. package/esm2015/src/app/social/user-event/testing/user-event.testing.model.js +103 -0
  12. package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +34 -27
  13. package/esm2015/src/app/social/user-event/user-event.model.js +2 -106
  14. package/esm2015/src/app/social/user-event/user-event.service.js +20 -13
  15. package/fesm2015/sumaris-net.ngx-components.js +251 -192
  16. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  17. package/package.json +1 -1
  18. package/public_api.d.ts +0 -1
  19. package/src/app/social/user-event/notification/user-event-notification.list.d.ts +18 -14
  20. package/src/app/social/user-event/testing/user-event.testing.d.ts +11 -3
  21. package/src/app/social/user-event/testing/user-event.testing.model.d.ts +41 -0
  22. package/src/app/social/user-event/testing/user-event.testing.service.d.ts +6 -5
  23. package/src/app/social/user-event/user-event.model.d.ts +9 -44
  24. package/src/app/social/user-event/user-event.service.d.ts +2 -1
  25. package/sumaris-net.ngx-components.metadata.json +1 -1
  26. package/esm2015/src/app/social/user-event/user-event.fragments.js +0 -27
  27. package/src/app/social/user-event/user-event.fragments.d.ts +0 -4
@@ -15009,7 +15009,9 @@
15009
15009
  return expectedProfileIndex !== -1 && PersonUtils.getMainProfileIndex(actualProfiles) <= expectedProfileIndex;
15010
15010
  };
15011
15011
  PersonUtils.personToString = function (obj) {
15012
- return obj && obj.id && (obj.lastName + ' ' + obj.firstName) || undefined;
15012
+ if (!obj || !obj.id)
15013
+ return undefined;
15014
+ return obj.lastName + ' ' + obj.firstName;
15013
15015
  };
15014
15016
  PersonUtils.personsToString = function (data, separator) {
15015
15017
  return (data || []).map(PersonUtils.personToString).join(separator || ', ');
@@ -30507,7 +30509,7 @@
30507
30509
  return total;
30508
30510
  }));
30509
30511
  };
30510
- AbstractUserEventService.prototype.listenAllChanges = function (filter, options) {
30512
+ AbstractUserEventService.prototype.listenAllChanges = function (filter, opts) {
30511
30513
  var _this = this;
30512
30514
  var _a;
30513
30515
  if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.listenAllChanges)) {
@@ -30517,13 +30519,13 @@
30517
30519
  if (!filter)
30518
30520
  filter = this.defaultFilter();
30519
30521
  filter = this.asFilter(filter);
30520
- var withContent = (options === null || options === void 0 ? void 0 : options.withContent) === true;
30522
+ var withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
30521
30523
  if (this._debug)
30522
30524
  console.debug(this._logPrefix + "[WS] Listening changes for user events with filter:", filter);
30523
30525
  return this.graphql.subscribe({
30524
30526
  query: this.subscriptions.listenAllChanges,
30525
- fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
30526
- variables: { filter: filter.asPodObject(), interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
30527
+ fetchPolicy: opts === null || opts === void 0 ? void 0 : opts.fetchPolicy,
30528
+ variables: { filter: filter.asPodObject(), interval: toNumber(opts === null || opts === void 0 ? void 0 : opts.interval, 10) },
30527
30529
  error: {
30528
30530
  code: SocialErrorCodes.SUBSCRIBE_USER_EVENTS_ERROR,
30529
30531
  message: 'SOCIAL.ERROR.SUBSCRIBE_USER_EVENTS_ERROR'
@@ -30531,22 +30533,23 @@
30531
30533
  }).pipe(operators.mergeMap(function (_b) {
30532
30534
  var data = _b.data;
30533
30535
  return __awaiter(_this, void 0, void 0, function () {
30534
- var updatedData;
30535
30536
  var _this = this;
30536
30537
  return __generator(this, function (_b) {
30537
30538
  switch (_b.label) {
30538
30539
  case 0:
30539
30540
  if (data && this._debug)
30540
30541
  console.debug(this._logPrefix + "Received new user events:", data);
30542
+ // Update cache (will update watchAll queries)
30543
+ if (isNotEmptyArray(data)) {
30544
+ this.insertIntoMutableCachedQueries(this.graphql.cache, {
30545
+ query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30546
+ data: data
30547
+ });
30548
+ }
30549
+ if (!(!opts || opts.toEntity !== false)) return [3 /*break*/, 2];
30541
30550
  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];
30551
+ case 1: return [2 /*return*/, _b.sent()];
30552
+ case 2: return [2 /*return*/, data];
30550
30553
  }
30551
30554
  });
30552
30555
  });
@@ -30945,17 +30948,28 @@
30945
30948
  this.popoverController = popoverController;
30946
30949
  this.settings = settings;
30947
30950
  this.userEventService = userEventService;
30948
- this.subscriptions = new rxjs.Subscription();
30949
- this._fetchingMore = false;
30951
+ this._subscriptions = new rxjs.Subscription();
30952
+ this._$pageSize = new rxjs.BehaviorSubject(20);
30953
+ this.fetchingMore = false;
30954
+ this.$items = new rxjs.BehaviorSubject(undefined);
30955
+ this.$itemCount = new rxjs.BehaviorSubject(undefined);
30950
30956
  this.debug = false;
30951
- this.pageSize = 10;
30952
30957
  this.sortBy = 'creationDate';
30953
30958
  this.sortDirection = 'desc';
30954
30959
  this.enableInfiniteScroll = true;
30955
- this.$items = new rxjs.BehaviorSubject(undefined);
30956
- this.$itemCount = new rxjs.BehaviorSubject(undefined);
30957
30960
  this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
30958
30961
  }
30962
+ Object.defineProperty(UserEventNotificationList.prototype, "pageSize", {
30963
+ get: function () {
30964
+ return this._$pageSize.value;
30965
+ },
30966
+ set: function (value) {
30967
+ if (value > 0 && value !== this._$pageSize.value)
30968
+ this._$pageSize.next(value);
30969
+ },
30970
+ enumerable: false,
30971
+ configurable: true
30972
+ });
30959
30973
  Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
30960
30974
  get: function () {
30961
30975
  return this.enableInfiniteScroll && !!this._fetchMoreFn;
@@ -30967,27 +30981,31 @@
30967
30981
  var _this = this;
30968
30982
  // Watch all user events
30969
30983
  if (this.userEventService) {
30970
- this.subscriptions.add(this.userEventService
30971
- .watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
30984
+ this._subscriptions.add(this._$pageSize.pipe(operators.distinctUntilChanged(), operators.switchMap(function (pageSize) { return _this.userEventService.watchAll(0, pageSize, _this.sortBy, _this.sortDirection, _this.filter); }))
30972
30985
  .subscribe(function (result) {
30973
30986
  var _a;
30974
30987
  if (_this.debug)
30975
- console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
30988
+ console.debug("[user-event-notification-list] Receiving " + result.total + " user events", result.data);
30976
30989
  _this.$items.next(result.data);
30977
30990
  _this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
30978
30991
  _this._fetchMoreFn = result.fetchMore;
30992
+ _this.fetchingMore = false; // Allow to refetch more
30979
30993
  _this.markForCheck();
30980
30994
  }));
30981
30995
  // Listen changes
30982
- this.subscriptions.add(this.userEventService.listenAllChanges(undefined)
30996
+ this._subscriptions.add(this.userEventService.listenAllChanges(this.filter)
30983
30997
  .subscribe(function (data) {
30984
30998
  if (_this.debug)
30985
- console.debug("[user-event-notification-list] receiving " + data.length + " new user events", data);
30999
+ console.debug("[user-event-notification-list] Receiving " + data.length + " new user events (by WS)", data);
30986
31000
  }));
31001
+ if (this.enableInfiniteScroll)
31002
+ this.initInfiniteScroll();
30987
31003
  }
30988
31004
  };
30989
31005
  UserEventNotificationList.prototype.ngOnDestroy = function () {
30990
- this.subscriptions.unsubscribe();
31006
+ this._subscriptions.unsubscribe();
31007
+ this.$items.complete();
31008
+ this.$itemCount.complete();
30991
31009
  };
30992
31010
  UserEventNotificationList.prototype.click = function (event, userEvent) {
30993
31011
  if (!userEvent)
@@ -31049,65 +31067,77 @@
31049
31067
  };
31050
31068
  UserEventNotificationList.prototype.dismiss = function () {
31051
31069
  this.popoverController.dismiss();
31070
+ // Reset counter (need if event has been received while popover if open)
31071
+ this.userEventService.resetCount();
31052
31072
  };
31053
31073
  UserEventNotificationList.prototype.fetchMore = function (event) {
31054
31074
  var _a;
31055
31075
  return __awaiter(this, void 0, void 0, function () {
31056
- var result, data, err_2;
31076
+ var fetchMoreFn, result, data, err_2;
31057
31077
  return __generator(this, function (_b) {
31058
31078
  switch (_b.label) {
31059
31079
  case 0:
31060
- if (!this._fetchMoreFn || this._fetchingMore)
31080
+ if (!this._fetchMoreFn || this.fetchingMore)
31061
31081
  return [2 /*return*/];
31062
31082
  console.debug('[user-event-notification-list] Fetching more notifications...', event);
31063
- this._fetchingMore = true;
31083
+ this.fetchingMore = true;
31084
+ fetchMoreFn = this._fetchMoreFn;
31064
31085
  _b.label = 1;
31065
31086
  case 1:
31066
31087
  _b.trys.push([1, 3, 4, 5]);
31067
- return [4 /*yield*/, this._fetchMoreFn()];
31088
+ return [4 /*yield*/, fetchMoreFn()];
31068
31089
  case 2:
31069
31090
  result = _b.sent();
31070
31091
  data = __spread((this.$items.value || []), result.data);
31071
31092
  // Remove duplication (e.g. when new user event was added by subscription)
31072
31093
  data = removeDuplicatesFromArray(data, 'id');
31094
+ // fetch more changes (e.g. if watchAll observable as been refreshed)
31095
+ if (fetchMoreFn !== this._fetchMoreFn)
31096
+ return [2 /*return*/]; // Skip
31073
31097
  this.$items.next(data);
31074
31098
  this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
31075
31099
  this._fetchMoreFn = result.fetchMore;
31100
+ // Update the page size, to keep same scroll height, after the next refresh
31101
+ this.pageSize = Math.max(this.pageSize, data.length);
31076
31102
  return [3 /*break*/, 5];
31077
31103
  case 3:
31078
31104
  err_2 = _b.sent();
31079
31105
  console.error(err_2);
31080
- this._fetchMoreFn = undefined;
31106
+ this._fetchMoreFn = undefined; // Forget the function
31081
31107
  return [3 /*break*/, 5];
31082
31108
  case 4:
31083
31109
  this.markForCheck();
31084
- this._fetchingMore = false;
31110
+ this.fetchingMore = false;
31085
31111
  return [7 /*endfinally*/];
31086
31112
  case 5: return [2 /*return*/];
31087
31113
  }
31088
31114
  });
31089
31115
  });
31090
31116
  };
31091
- UserEventNotificationList.prototype._initInfiniteScroll = function (threshold) {
31117
+ UserEventNotificationList.prototype.trackByFn = function (index, item) {
31118
+ return item.id;
31119
+ };
31120
+ UserEventNotificationList.prototype.initInfiniteScroll = function (threshold) {
31092
31121
  return __awaiter(this, void 0, void 0, function () {
31093
31122
  var panel;
31094
31123
  var _this = this;
31095
31124
  return __generator(this, function (_b) {
31096
31125
  switch (_b.label) {
31097
31126
  case 0:
31127
+ console.debug('[user-event-notification-list] Init infinite loop');
31098
31128
  if (this._fetchMoreSubscription)
31099
31129
  this._fetchMoreSubscription.unsubscribe();
31100
31130
  threshold = threshold || (this.mobile ? '15%' : '2%');
31101
- return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
31131
+ return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; }, { dueTime: 250, timeout: 1000 })];
31102
31132
  case 1:
31103
31133
  _b.sent();
31104
31134
  return [4 /*yield*/, this.ionContent.getScrollElement()];
31105
31135
  case 2:
31106
31136
  panel = _b.sent();
31107
31137
  // 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*/)
31138
+ this._fetchMoreSubscription = this.$items.pipe(operators.debounceTime(250), operators.filter(function () { return _this.canFetchMore; }), operators.switchMap(function () { return fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/); }))
31109
31139
  .subscribe(function () { return _this.fetchMore(); });
31110
- this.subscriptions.add(this._fetchMoreSubscription);
31140
+ this._subscriptions.add(this._fetchMoreSubscription);
31111
31141
  return [2 /*return*/];
31112
31142
  }
31113
31143
  });
@@ -31121,7 +31151,7 @@
31121
31151
  UserEventNotificationList.decorators = [
31122
31152
  { type: i0.Component, args: [{
31123
31153
  selector: 'app-user-event-notification-list',
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",
31154
+ 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; trackBy: trackByFn; 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 <ng-container *ngIf=\"!($items|async); else notLoading\">\n <ng-container *ngTemplateOutlet=\"loadingItem\"></ng-container>\n </ng-container>\n\n <ng-template #notLoading>\n <!-- no result -->\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\n <!-- Fetching more -->\n <ng-container *ngIf=\"fetchingMore; else infiniteLoop\" lines=\"none\" disabled>\n <ng-container *ngTemplateOutlet=\"loadingItem\"></ng-container>\n </ng-container>\n\n <!-- Infinite loop -->\n <ng-template #infiniteLoop>\n <ng-container *ngIf=\"canFetchMore\" lines=\"none\" disabled\n [ngTemplateOutlet]=\"loadingItem\">\n </ng-container>\n </ng-template>\n </ng-template>\n\n <!-- footer -->\n <ion-row class=\"ion-list-footer column\">\n <ion-col>\n <ion-text *ngIf=\"$itemCount|async; let count\"\n 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\n<!-- loading -->\n<ng-template #loadingItem>\n <ion-item lines=\"none\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </ion-item>\n</ng-template>\n",
31125
31155
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
31126
31156
  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%}"]
31127
31157
  },] }
@@ -31136,11 +31166,11 @@
31136
31166
  debug: [{ type: i0.Input }],
31137
31167
  mobile: [{ type: i0.Input }],
31138
31168
  titleI18n: [{ type: i0.Input }],
31139
- pageSize: [{ type: i0.Input }],
31140
31169
  sortBy: [{ type: i0.Input }],
31141
31170
  sortDirection: [{ type: i0.Input }],
31142
31171
  filter: [{ type: i0.Input }],
31143
31172
  enableInfiniteScroll: [{ type: i0.Input }],
31173
+ pageSize: [{ type: i0.Input }],
31144
31174
  readEvent: [{ type: i0.Output }],
31145
31175
  readEvents: [{ type: i0.Output }],
31146
31176
  ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
@@ -31214,7 +31244,8 @@
31214
31244
  debug: this.debug,
31215
31245
  titleI18n: this.titleI18n,
31216
31246
  readEvent: this._readEvent,
31217
- readEvents: this._readEvents
31247
+ readEvents: this._readEvents,
31248
+ filter: this.filter
31218
31249
  },
31219
31250
  backdropDismiss: true,
31220
31251
  keyboardClose: true,
@@ -31883,118 +31914,8 @@
31883
31914
  },] }
31884
31915
  ];
31885
31916
 
31886
- var UserEvent_1;
31887
- var UserEventTypes = {
31888
- DEBUG_DATA: 'DEBUG_DATA',
31889
- INBOX_MESSAGE: 'INBOX_MESSAGE'
31890
- };
31891
- // @dynamic
31892
- exports.UserEvent = UserEvent_1 = /** @class */ (function (_super) {
31893
- __extends(UserEvent, _super);
31894
- function UserEvent() {
31895
- return _super.call(this, UserEvent_1.TYPENAME) || this;
31896
- }
31897
- UserEvent.prototype.asObject = function (opts) {
31898
- var target = _super.prototype.asObject.call(this, opts);
31899
- target.creationDate = toDateISOString(this.creationDate);
31900
- target.readDate = toDateISOString(this.readDate);
31901
- // Serialize content
31902
- if (typeof target.content === 'object') {
31903
- target.content = JSON.stringify(target.content);
31904
- }
31905
- delete target.avatar;
31906
- delete target.avatarIcon;
31907
- delete target.icon;
31908
- delete target.actions;
31909
- return target;
31910
- };
31911
- UserEvent.prototype.fromObject = function (source) {
31912
- Object.assign(this, source); // Copy all properties
31913
- _super.prototype.fromObject.call(this, source);
31914
- this.creationDate = fromDateISOString(source.creationDate);
31915
- this.readDate = fromDateISOString(source.readDate);
31916
- try {
31917
- // Deserialize content
31918
- if (typeof source.content === 'string' && source.content.startsWith('{')) {
31919
- this.content = JSON.parse(source.content);
31920
- }
31921
- // Deserialize content.context
31922
- if (this.content && typeof this.content.context === 'string' && this.content.context.startsWith('{')) {
31923
- this.content.context = JSON.parse(this.content.context);
31924
- }
31925
- }
31926
- catch (err) {
31927
- console.error('Error during UserEvent deserialization', err);
31928
- }
31929
- };
31930
- return UserEvent;
31931
- }(Entity));
31932
- exports.UserEvent = UserEvent_1 = __decorate([
31933
- EntityClass({ typename: 'UserEventVO' })
31934
- ], exports.UserEvent);
31935
- // @dynamic
31936
- exports.UserEventFilter = /** @class */ (function (_super) {
31937
- __extends(UserEventFilter, _super);
31938
- function UserEventFilter() {
31939
- var _this = _super.apply(this, __spread(arguments)) || this;
31940
- _this.types = [];
31941
- _this.levels = [];
31942
- _this.issuers = [];
31943
- _this.recipients = [];
31944
- _this.startDate = null;
31945
- _this.excludeRead = false;
31946
- return _this;
31947
- }
31948
- UserEventFilter.prototype.fromObject = function (source, opts) {
31949
- _super.prototype.fromObject.call(this, source, opts);
31950
- this.types = source.types || [];
31951
- this.levels = source.levels || [];
31952
- this.issuers = source.issuers || [];
31953
- this.recipients = source.recipients || [];
31954
- this.startDate = fromDateISOString(source.startDate);
31955
- this.excludeRead = source.excludeRead || false;
31956
- };
31957
- UserEventFilter.prototype.buildFilter = function () {
31958
- var _this = this;
31959
- var filterFns = _super.prototype.buildFilter.call(this);
31960
- if (isNotEmptyArray(this.types)) {
31961
- filterFns.push(function (t) { return _this.types.includes(t.type); });
31962
- }
31963
- if (isNotEmptyArray(this.levels)) {
31964
- filterFns.push(function (t) { return _this.levels.includes(t.level); });
31965
- }
31966
- if (isNotEmptyArray(this.issuers)) {
31967
- filterFns.push(function (t) { return _this.issuers.includes(t.issuer); });
31968
- }
31969
- if (isNotEmptyArray(this.recipients)) {
31970
- filterFns.push(function (t) { return _this.recipients.includes(t.recipient); });
31971
- }
31972
- if (isNotNil(this.startDate)) {
31973
- filterFns.push(function (t) { return _this.startDate.isSameOrBefore(t.creationDate); });
31974
- }
31975
- if (this.excludeRead === true) {
31976
- filterFns.push(function (t) { return isNil(t.readSignature); }); // todo or t.signature ?
31977
- }
31978
- return filterFns;
31979
- };
31980
- UserEventFilter.prototype.asObject = function (opts) {
31981
- var target = _super.prototype.asObject.call(this, opts);
31982
- return target;
31983
- };
31984
- return UserEventFilter;
31985
- }(EntityFilter));
31986
- exports.UserEventFilter = __decorate([
31987
- EntityClass({ typename: 'UserEventFilterVO' })
31988
- ], exports.UserEventFilter);
31989
-
31990
- var UserEventFragments = {
31991
- userEvent: core.gql(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["fragment UserEventFragment on UserEventVO {\n id\n issuer\n updateDate\n creationDate\n eventType\n recipient\n content\n hash\n signature\n readSignature\n __typename\n }"], ["fragment UserEventFragment on UserEventVO {\n id\n issuer\n updateDate\n creationDate\n eventType\n recipient\n content\n hash\n signature\n readSignature\n __typename\n }"]))),
31992
- lightUserEvent: core.gql(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["fragment LightUserEventFragment on UserEventVO {\n id\n issuer\n recipient\n updateDate\n creationDate\n eventType\n readSignature\n __typename\n }"], ["fragment LightUserEventFragment on UserEventVO {\n id\n issuer\n recipient\n updateDate\n creationDate\n eventType\n readSignature\n __typename\n }"])))
31993
- };
31994
- var templateObject_1$3, templateObject_2$2;
31995
-
31996
31917
  var Mutations = {
31997
- send: core.gql(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"], ["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"])))
31918
+ send: core.gql(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"], ["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"])))
31998
31919
  };
31999
31920
  var MessageService = /** @class */ (function (_super) {
32000
31921
  __extends(MessageService, _super);
@@ -32078,7 +31999,7 @@
32078
31999
  { type: i1$5.ToastController },
32079
32000
  { type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
32080
32001
  ]; };
32081
- var templateObject_1$4;
32002
+ var templateObject_1$3;
32082
32003
 
32083
32004
  var PersonFilter_1;
32084
32005
  // @dynamic
@@ -32137,11 +32058,11 @@
32137
32058
  ], exports.PersonFilter);
32138
32059
 
32139
32060
  var PersonFragments = {
32140
- person: core.gql(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["fragment PersonFragment on PersonVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n username\n usernameExtranet\n department {\n id\n label\n name\n logo\n __typename\n }\n __typename\n }"], ["fragment PersonFragment on PersonVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n username\n usernameExtranet\n department {\n id\n label\n name\n logo\n __typename\n }\n __typename\n }"])))
32061
+ person: core.gql(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["fragment PersonFragment on PersonVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n username\n usernameExtranet\n department {\n id\n label\n name\n logo\n __typename\n }\n __typename\n }"], ["fragment PersonFragment on PersonVO {\n id\n firstName\n lastName\n email\n pubkey\n avatar\n statusId\n updateDate\n creationDate\n profiles\n username\n usernameExtranet\n department {\n id\n label\n name\n logo\n __typename\n }\n __typename\n }"])))
32141
32062
  };
32142
32063
  // Load persons query
32143
32064
  var PersonQueries = {
32144
- loadAll: core.gql(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query Persons($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n }\n ", ""], ["\n query Persons($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n }\n ", ""])), PersonFragments.person),
32065
+ loadAll: core.gql(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["\n query Persons($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n }\n ", ""], ["\n query Persons($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n }\n ", ""])), PersonFragments.person),
32145
32066
  loadAllWithTotal: core.gql(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n query PersonsWithTotal($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n total: personsCount(filter: $filter)\n }\n ", ""], ["\n query PersonsWithTotal($offset: Int, $size: Int, $sortBy: String, $sortDirection: String, $filter: PersonFilterVOInput){\n data: persons(filter: $filter, offset: $offset, size: $size, sortBy: $sortBy, sortDirection: $sortDirection){\n ...PersonFragment\n }\n total: personsCount(filter: $filter)\n }\n ", ""])), PersonFragments.person)
32146
32067
  };
32147
32068
  var PersonMutations = {
@@ -32277,7 +32198,7 @@
32277
32198
  { type: NetworkService },
32278
32199
  { type: EntitiesStorage }
32279
32200
  ]; };
32280
- var templateObject_1$5, templateObject_2$3, templateObject_3$2, templateObject_4$2, templateObject_5$2;
32201
+ var templateObject_1$4, templateObject_2$2, templateObject_3$2, templateObject_4$2, templateObject_5$2;
32281
32202
 
32282
32203
  var PersonValidatorService = /** @class */ (function () {
32283
32204
  function PersonValidatorService(formBuilder, accountValidatorService) {
@@ -34215,6 +34136,106 @@
34215
34136
  },] }
34216
34137
  ];
34217
34138
 
34139
+ var UserEventTest_1;
34140
+ // @dynamic
34141
+ var UserEventTest = UserEventTest_1 = /** @class */ (function (_super) {
34142
+ __extends(UserEventTest, _super);
34143
+ function UserEventTest() {
34144
+ return _super.call(this, UserEventTest_1.TYPENAME) || this;
34145
+ }
34146
+ UserEventTest.prototype.asObject = function (opts) {
34147
+ var target = _super.prototype.asObject.call(this, opts);
34148
+ target.creationDate = toDateISOString(this.creationDate);
34149
+ target.readDate = toDateISOString(this.readDate);
34150
+ // Serialize content
34151
+ if (typeof target.content === 'object') {
34152
+ target.content = JSON.stringify(target.content);
34153
+ }
34154
+ delete target.avatar;
34155
+ delete target.avatarIcon;
34156
+ delete target.icon;
34157
+ delete target.actions;
34158
+ return target;
34159
+ };
34160
+ UserEventTest.prototype.fromObject = function (source) {
34161
+ Object.assign(this, source); // Copy all properties
34162
+ _super.prototype.fromObject.call(this, source);
34163
+ this.creationDate = fromDateISOString(source.creationDate);
34164
+ this.readDate = fromDateISOString(source.readDate);
34165
+ try {
34166
+ // Deserialize content
34167
+ if (typeof source.content === 'string' && source.content.startsWith('{')) {
34168
+ this.content = JSON.parse(source.content);
34169
+ }
34170
+ // Deserialize content.context
34171
+ if (this.content && typeof this.content.context === 'string' && this.content.context.startsWith('{')) {
34172
+ this.content.context = JSON.parse(this.content.context);
34173
+ }
34174
+ }
34175
+ catch (err) {
34176
+ console.error('Error during UserEvent deserialization', err);
34177
+ }
34178
+ };
34179
+ return UserEventTest;
34180
+ }(Entity));
34181
+ UserEventTest = UserEventTest_1 = __decorate([
34182
+ EntityClass({ typename: 'UserEventTestVO' })
34183
+ ], UserEventTest);
34184
+ // @dynamic
34185
+ var UserEventTestFilter = /** @class */ (function (_super) {
34186
+ __extends(UserEventTestFilter, _super);
34187
+ function UserEventTestFilter() {
34188
+ var _this = _super.apply(this, __spread(arguments)) || this;
34189
+ _this.types = [];
34190
+ _this.levels = [];
34191
+ _this.issuers = [];
34192
+ _this.recipients = [];
34193
+ _this.startDate = null;
34194
+ _this.excludeRead = false;
34195
+ return _this;
34196
+ }
34197
+ UserEventTestFilter.prototype.fromObject = function (source, opts) {
34198
+ _super.prototype.fromObject.call(this, source, opts);
34199
+ this.types = source.types || [];
34200
+ this.levels = source.levels || [];
34201
+ this.issuers = source.issuers || [];
34202
+ this.recipients = source.recipients || [];
34203
+ this.startDate = fromDateISOString(source.startDate);
34204
+ this.excludeRead = source.excludeRead || false;
34205
+ };
34206
+ UserEventTestFilter.prototype.buildFilter = function () {
34207
+ var _this = this;
34208
+ var filterFns = _super.prototype.buildFilter.call(this);
34209
+ if (isNotEmptyArray(this.types)) {
34210
+ filterFns.push(function (t) { return _this.types.includes(t.type); });
34211
+ }
34212
+ if (isNotEmptyArray(this.levels)) {
34213
+ filterFns.push(function (t) { return _this.levels.includes(t.level); });
34214
+ }
34215
+ if (isNotEmptyArray(this.issuers)) {
34216
+ filterFns.push(function (t) { return _this.issuers.includes(t.issuer); });
34217
+ }
34218
+ if (isNotEmptyArray(this.recipients)) {
34219
+ filterFns.push(function (t) { return _this.recipients.includes(t.recipient); });
34220
+ }
34221
+ if (isNotNil(this.startDate)) {
34222
+ filterFns.push(function (t) { return _this.startDate.isSameOrBefore(t.creationDate); });
34223
+ }
34224
+ if (this.excludeRead === true) {
34225
+ filterFns.push(function (t) { return isNil(t.readSignature); }); // todo or t.signature ?
34226
+ }
34227
+ return filterFns;
34228
+ };
34229
+ UserEventTestFilter.prototype.asObject = function (opts) {
34230
+ var target = _super.prototype.asObject.call(this, opts);
34231
+ return target;
34232
+ };
34233
+ return UserEventTestFilter;
34234
+ }(EntityFilter));
34235
+ UserEventTestFilter = __decorate([
34236
+ EntityClass({ typename: 'UserEventTestFilterVO' })
34237
+ ], UserEventTestFilter);
34238
+
34218
34239
  var UserEventTestService = /** @class */ (function (_super) {
34219
34240
  __extends(UserEventTestService, _super);
34220
34241
  function UserEventTestService(graphql, accountService, network, translate, environment) {
@@ -34230,24 +34251,27 @@
34230
34251
  _this.network = network;
34231
34252
  _this.translate = translate;
34232
34253
  _this.environment = environment;
34233
- _this.userEvents = [];
34254
+ _this.$userEvents = new rxjs.BehaviorSubject([]);
34255
+ _this.$newUserEvents = new rxjs.Subject();
34234
34256
  return _this;
34235
34257
  }
34236
34258
  UserEventTestService.prototype.fromObject = function (source) {
34237
- return exports.UserEvent.fromObject(source);
34259
+ return UserEventTest.fromObject(source);
34238
34260
  };
34239
34261
  UserEventTestService.prototype.add = function (entity) {
34262
+ var _a;
34240
34263
  return __awaiter(this, void 0, void 0, function () {
34241
34264
  return __generator(this, function (_b) {
34242
34265
  switch (_b.label) {
34243
34266
  case 0: return [4 /*yield*/, this.processUserEvent(entity)];
34244
34267
  case 1:
34245
34268
  entity = _b.sent();
34246
- entity.id = this.userEvents.length + 1;
34247
- this.userEvents = __spread([
34269
+ entity.id = (((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0) + 1;
34270
+ this.$userEvents.next(__spread([
34248
34271
  entity
34249
- ], this.userEvents);
34272
+ ], this.$userEvents.value));
34250
34273
  this._countSubject.next((this._countSubject.value || 0) + 1);
34274
+ this.$newUserEvents.next([entity]);
34251
34275
  return [2 /*return*/];
34252
34276
  }
34253
34277
  });
@@ -34257,7 +34281,8 @@
34257
34281
  return filter;
34258
34282
  };
34259
34283
  UserEventTestService.prototype.count = function (filter, options) {
34260
- return Promise.resolve(this.userEvents.length);
34284
+ var _a;
34285
+ return Promise.resolve(((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0);
34261
34286
  };
34262
34287
  UserEventTestService.prototype.delete = function (entity) {
34263
34288
  return Promise.resolve(undefined);
@@ -34266,11 +34291,11 @@
34266
34291
  return Promise.resolve(undefined);
34267
34292
  };
34268
34293
  UserEventTestService.prototype.listenAllChanges = function (filter, options) {
34269
- return rxjs.of();
34294
+ return this.$newUserEvents.asObservable();
34270
34295
  };
34271
34296
  UserEventTestService.prototype.save = function (entity, options) {
34272
34297
  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); });
34298
+ var toSave = (_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id == (entity === null || entity === void 0 ? void 0 : entity.id); });
34274
34299
  Object.assign(toSave, entity);
34275
34300
  return entity;
34276
34301
  };
@@ -34305,31 +34330,33 @@
34305
34330
  }
34306
34331
  finally { if (e_1) throw e_1.error; }
34307
34332
  return [7 /*endfinally*/];
34308
- case 7: return [2 /*return*/, Promise.resolve(this.userEvents)];
34333
+ case 7: return [2 /*return*/, this.$userEvents.toPromise()];
34309
34334
  }
34310
34335
  });
34311
34336
  });
34312
34337
  };
34313
34338
  UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34314
34339
  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);
34340
+ return this.$userEvents.pipe(operators.map(function (userEvents) {
34341
+ var _a;
34342
+ var data = (userEvents || []).slice(offset || 0, offset + size);
34343
+ var total = ((_a = _this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0;
34344
+ var res = { data: data, total: total };
34345
+ // Must re-order because of listenChanges result will add new event at the end
34346
+ data = EntityUtils.sort(data, sortBy, sortDirection);
34347
+ // Add fetch more
34348
+ var nextOffset = offset + data.length;
34349
+ if (nextOffset < res.total) {
34350
+ res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
34351
+ }
34352
+ return res;
34353
+ }));
34327
34354
  };
34328
34355
  UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34329
34356
  var _this = this;
34330
34357
  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;
34358
+ var data = (this.$userEvents.value || []).slice(offset || 0, offset + size);
34359
+ var total = ((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0;
34333
34360
  var res = { data: data, total: total };
34334
34361
  // Must re-order because of listenChanges result will add new event at the end
34335
34362
  data = EntityUtils.sort(data, sortBy, sortDirection);
@@ -34373,6 +34400,16 @@
34373
34400
  onRead: function (userEvent) { _this.showMessage("debug message read "); }
34374
34401
  });
34375
34402
  }
34403
+ Object.defineProperty(UserEventTestingPage.prototype, "timerStarted", {
34404
+ get: function () {
34405
+ return !!this._timerSubscription;
34406
+ },
34407
+ enumerable: false,
34408
+ configurable: true
34409
+ });
34410
+ UserEventTestingPage.prototype.ngOnDestroy = function () {
34411
+ this.stopTimer();
34412
+ };
34376
34413
  UserEventTestingPage.prototype.customize = function (userEvent) {
34377
34414
  // Choose avatarIcon
34378
34415
  switch (userEvent.level) {
@@ -34403,7 +34440,7 @@
34403
34440
  }
34404
34441
  };
34405
34442
  UserEventTestingPage.prototype.addNotification = function () {
34406
- this.userEventService.add(exports.UserEvent.fromObject({
34443
+ this.userEventService.add(UserEventTest.fromObject({
34407
34444
  issuer: 'system',
34408
34445
  recipient: 'me',
34409
34446
  type: 'message',
@@ -34413,7 +34450,7 @@
34413
34450
  }));
34414
34451
  };
34415
34452
  UserEventTestingPage.prototype.addError = function () {
34416
- this.userEventService.add(exports.UserEvent.fromObject({
34453
+ this.userEventService.add(UserEventTest.fromObject({
34417
34454
  issuer: 'system',
34418
34455
  recipient: 'me',
34419
34456
  type: 'upload',
@@ -34423,7 +34460,7 @@
34423
34460
  }));
34424
34461
  };
34425
34462
  UserEventTestingPage.prototype.addWarning = function () {
34426
- this.userEventService.add(exports.UserEvent.fromObject({
34463
+ this.userEventService.add(UserEventTest.fromObject({
34427
34464
  issuer: 'system',
34428
34465
  recipient: 'me',
34429
34466
  type: 'download',
@@ -34433,7 +34470,7 @@
34433
34470
  }));
34434
34471
  };
34435
34472
  UserEventTestingPage.prototype.addDebug = function () {
34436
- this.userEventService.add(exports.UserEvent.fromObject({
34473
+ this.userEventService.add(UserEventTest.fromObject({
34437
34474
  issuer: 'system',
34438
34475
  recipient: 'me',
34439
34476
  type: 'debug',
@@ -34444,7 +34481,7 @@
34444
34481
  };
34445
34482
  UserEventTestingPage.prototype.addNotificationWithLink = function () {
34446
34483
  var _this = this;
34447
- this.userEventService.add(exports.UserEvent.fromObject({
34484
+ this.userEventService.add(UserEventTest.fromObject({
34448
34485
  issuer: 'system',
34449
34486
  recipient: 'me',
34450
34487
  type: 'message',
@@ -34462,7 +34499,7 @@
34462
34499
  };
34463
34500
  UserEventTestingPage.prototype.addNotificationWithAction = function () {
34464
34501
  var _this = this;
34465
- this.userEventService.add(exports.UserEvent.fromObject({
34502
+ this.userEventService.add(UserEventTest.fromObject({
34466
34503
  issuer: 'system',
34467
34504
  recipient: 'me',
34468
34505
  type: 'message',
@@ -34489,9 +34526,54 @@
34489
34526
  ]
34490
34527
  }));
34491
34528
  };
34529
+ UserEventTestingPage.prototype.addMany = function (count) {
34530
+ count = count || 20;
34531
+ for (var i = 0; i < count; i++) {
34532
+ this.addRandom(i);
34533
+ }
34534
+ };
34535
+ UserEventTestingPage.prototype.startTimer = function (period) {
34536
+ var _this = this;
34537
+ var _a;
34538
+ (_a = this._timerSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
34539
+ period = period || 1000;
34540
+ var counter = 0;
34541
+ this._timerSubscription = rxjs.timer(period, period)
34542
+ .subscribe(function () {
34543
+ _this.addRandom(counter);
34544
+ counter++;
34545
+ });
34546
+ };
34547
+ UserEventTestingPage.prototype.stopTimer = function () {
34548
+ var _a;
34549
+ (_a = this._timerSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
34550
+ this._timerSubscription = null;
34551
+ };
34552
+ UserEventTestingPage.prototype.addRandom = function (value) {
34553
+ switch (value % 6) {
34554
+ case 0:
34555
+ this.addNotification();
34556
+ break;
34557
+ case 1:
34558
+ this.addError();
34559
+ break;
34560
+ case 2:
34561
+ this.addDebug();
34562
+ break;
34563
+ case 3:
34564
+ this.addNotificationWithLink();
34565
+ break;
34566
+ case 4:
34567
+ this.addNotificationWithAction();
34568
+ break;
34569
+ case 5:
34570
+ this.addNotificationWithDefaultAction();
34571
+ break;
34572
+ }
34573
+ };
34492
34574
  UserEventTestingPage.prototype.addNotificationWithDefaultAction = function () {
34493
34575
  var _this = this;
34494
- this.userEventService.add(exports.UserEvent.fromObject({
34576
+ this.userEventService.add(UserEventTest.fromObject({
34495
34577
  issuer: 'system',
34496
34578
  recipient: 'me',
34497
34579
  type: 'message',
@@ -34515,7 +34597,7 @@
34515
34597
  UserEventTestingPage.decorators = [
34516
34598
  { type: i0.Component, args: [{
34517
34599
  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"
34600
+ 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 <p>\n <ion-button (click)=\"addMany()\">Add notifications (x20)</ion-button>\n </p>\n <p>\n <ion-button (click)=\"startTimer()\" *ngIf=\"!timerStarted\">Start timer</ion-button>\n <ion-button (click)=\"stopTimer()\" *ngIf=\"timerStarted\">Stop timer</ion-button>\n </p>\n</ion-content>\n"
34519
34601
  },] }
34520
34602
  ];
34521
34603
  UserEventTestingPage.ctorParameters = function () { return [
@@ -34879,12 +34961,10 @@
34879
34961
  exports.UploadFileTestingModule = UploadFileTestingModule;
34880
34962
  exports.UploadFileTestingPage = UploadFileTestingPage;
34881
34963
  exports.UriUtils = UriUtils;
34882
- exports.UserEventFragments = UserEventFragments;
34883
34964
  exports.UserEventModule = UserEventModule;
34884
34965
  exports.UserEventTestService = UserEventTestService;
34885
34966
  exports.UserEventTestingModule = UserEventTestingModule;
34886
34967
  exports.UserEventTestingPage = UserEventTestingPage;
34887
- exports.UserEventTypes = UserEventTypes;
34888
34968
  exports.UsersPage = UsersPage;
34889
34969
  exports.accountToString = accountToString;
34890
34970
  exports.adaptValueToControl = adaptValueToControl;