@sumaris-net/ngx-components 1.22.11-rc6 → 1.22.11

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 (43) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +565 -359
  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 +2 -2
  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/core/services/account.service.js +2 -2
  11. package/esm2015/src/app/core/services/model/person.model.js +4 -2
  12. package/esm2015/src/app/shared/file/file.service.js +18 -18
  13. package/esm2015/src/app/shared/file/file.utils.js +1 -1
  14. package/esm2015/src/app/shared/file/images.utils.js +166 -0
  15. package/esm2015/src/app/social/job/progression/job-progression.list.js +1 -1
  16. package/esm2015/src/app/social/user-event/notification/user-event-notification.icon.js +8 -7
  17. package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +56 -28
  18. package/esm2015/src/app/social/user-event/testing/user-event.testing.js +77 -9
  19. package/esm2015/src/app/social/user-event/testing/user-event.testing.model.js +103 -0
  20. package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +40 -31
  21. package/esm2015/src/app/social/user-event/user-event.model.js +2 -106
  22. package/esm2015/src/app/social/user-event/user-event.module.js +4 -2
  23. package/esm2015/src/app/social/user-event/user-event.service.js +66 -49
  24. package/fesm2015/sumaris-net.ngx-components.js +433 -317
  25. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  26. package/package.json +1 -1
  27. package/public_api.d.ts +1 -1
  28. package/src/app/admin/users/list/users.d.ts +0 -2
  29. package/src/app/core/form/entity-editor.class.d.ts +1 -1
  30. package/src/app/shared/file/file.service.d.ts +5 -5
  31. package/src/app/shared/file/images.utils.d.ts +19 -0
  32. package/src/app/social/user-event/notification/user-event-notification.list.d.ts +18 -13
  33. package/src/app/social/user-event/testing/user-event.testing.d.ts +12 -3
  34. package/src/app/social/user-event/testing/user-event.testing.model.d.ts +41 -0
  35. package/src/app/social/user-event/testing/user-event.testing.service.d.ts +7 -6
  36. package/src/app/social/user-event/user-event.model.d.ts +11 -44
  37. package/src/app/social/user-event/user-event.service.d.ts +9 -8
  38. package/src/theme/_ngx-components.scss +12 -0
  39. package/sumaris-net.ngx-components.metadata.json +1 -1
  40. package/esm2015/src/app/shared/file/base64-image-reader.js +0 -141
  41. package/esm2015/src/app/social/user-event/user-event.fragments.js +0 -27
  42. package/src/app/shared/file/base64-image-reader.d.ts +0 -18
  43. package/src/app/social/user-event/user-event.fragments.d.ts +0 -4
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/table'), require('@angular/cdk/a11y'), require('@angular/cdk/overlay'), require('@angular/cdk/scrolling'), require('@angular/material/core'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/checkbox'), require('@angular/material/expansion'), require('@angular/material/toolbar'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/menu'), require('@angular/material/select'), require('@angular/material/card'), require('@angular/material/tabs'), require('@angular/material/stepper'), require('@angular/material/list'), require('@angular/material/button-toggle'), require('@angular/material/progress-spinner'), require('@angular/material/progress-bar'), require('@angular/material/radio'), require('@angular/material/badge'), require('@angular/material/slide-toggle'), require('@angular/material/dialog'), require('@angular/material/autocomplete'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/animations'), require('@ngx-translate/core'), require('@ionic/angular'), require('moment'), require('@angular/material-moment-adapter'), require('@ionic-native/keyboard/ngx'), require('angular2-text-mask'), require('ngx-material-timepicker'), require('@angular/material/datepicker'), require('@angular/material/divider'), require('@angular/material/tooltip'), require('@angular/material/chips'), require('@angular/router'), require('@angular/platform-browser'), require('@angular/common/http'), require('ngx-color-picker'), require('@ionic-native/native-audio/ngx'), require('@ionic-native/vibration/ngx'), require('@ionic-native/audio-management/ngx'), require('@ionic-native/native-audio/ngx/index'), require('@ionic-native/vibration/ngx/index'), require('@ionic-native/audio-management/ngx/index'), require('uuid/v4'), require('@angular/cdk/drag-drop'), require('ngx-markdown'), require('tweetnacl'), require('@ionic/storage'), require('zone.js/dist/zone-error'), require('@ionic-native/splash-screen/ngx'), require('@ionic-native/network/ngx'), require('ionic-cache'), require('ionic-cache/dist/cache.service'), require('@ionic-native/network/ngx/index'), require('@ionic-native/splash-screen/ngx/index'), require('@ionic-native/status-bar/ngx'), require('@angular/cdk/platform'), require('@ionic-native/in-app-browser/ngx'), require('@apollo/client/core'), require('apollo-angular'), require('@apollo/client/link/ws'), require('@apollo/client/utilities'), require('@apollo/client/link/retry'), require('apollo-link-queue'), require('apollo-link-serialize'), require('apollo-link-logger'), require('apollo-angular/http'), require('apollo3-cache-persist'), require('@ionic-native/downloader/ngx'), require('@ionic-native/status-bar/ngx/index'), require('@ionic-native/keyboard/ngx/index'), require('@ionic-native/in-app-browser/ngx/index'), require('@ionic-native/downloader/ngx/index'), require('@angular/cdk/text-field'), require('@e-is/ngx-material-table'), require('@angular/cdk/collections'), require('ngx-jdenticon'), require('tweetnacl-util'), require('scrypt-async'), require('hammerjs'), require('moment-timezone')) :
3
- typeof define === 'function' && define.amd ? define('@sumaris-net/ngx-components', ['exports', '@angular/core', '@angular/common', '@angular/cdk/table', '@angular/cdk/a11y', '@angular/cdk/overlay', '@angular/cdk/scrolling', '@angular/material/core', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/material/form-field', '@angular/material/input', '@angular/material/checkbox', '@angular/material/expansion', '@angular/material/toolbar', '@angular/material/icon', '@angular/material/button', '@angular/material/menu', '@angular/material/select', '@angular/material/card', '@angular/material/tabs', '@angular/material/stepper', '@angular/material/list', '@angular/material/button-toggle', '@angular/material/progress-spinner', '@angular/material/progress-bar', '@angular/material/radio', '@angular/material/badge', '@angular/material/slide-toggle', '@angular/material/dialog', '@angular/material/autocomplete', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/animations', '@ngx-translate/core', '@ionic/angular', 'moment', '@angular/material-moment-adapter', '@ionic-native/keyboard/ngx', 'angular2-text-mask', 'ngx-material-timepicker', '@angular/material/datepicker', '@angular/material/divider', '@angular/material/tooltip', '@angular/material/chips', '@angular/router', '@angular/platform-browser', '@angular/common/http', 'ngx-color-picker', '@ionic-native/native-audio/ngx', '@ionic-native/vibration/ngx', '@ionic-native/audio-management/ngx', '@ionic-native/native-audio/ngx/index', '@ionic-native/vibration/ngx/index', '@ionic-native/audio-management/ngx/index', 'uuid/v4', '@angular/cdk/drag-drop', 'ngx-markdown', 'tweetnacl', '@ionic/storage', 'zone.js/dist/zone-error', '@ionic-native/splash-screen/ngx', '@ionic-native/network/ngx', 'ionic-cache', 'ionic-cache/dist/cache.service', '@ionic-native/network/ngx/index', '@ionic-native/splash-screen/ngx/index', '@ionic-native/status-bar/ngx', '@angular/cdk/platform', '@ionic-native/in-app-browser/ngx', '@apollo/client/core', 'apollo-angular', '@apollo/client/link/ws', '@apollo/client/utilities', '@apollo/client/link/retry', 'apollo-link-queue', 'apollo-link-serialize', 'apollo-link-logger', 'apollo-angular/http', 'apollo3-cache-persist', '@ionic-native/downloader/ngx', '@ionic-native/status-bar/ngx/index', '@ionic-native/keyboard/ngx/index', '@ionic-native/in-app-browser/ngx/index', '@ionic-native/downloader/ngx/index', '@angular/cdk/text-field', '@e-is/ngx-material-table', '@angular/cdk/collections', 'ngx-jdenticon', 'tweetnacl-util', 'scrypt-async', 'hammerjs', 'moment-timezone'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sumaris-net'] = global['sumaris-net'] || {}, global['sumaris-net']['ngx-components'] = {}), global.ng.core, global.ng.common, global.ng.cdk.table, global.ng.cdk.a11y, global.ng.cdk.overlay, global.ng.cdk.scrolling, global.ng.material.core, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.material.formField, global.ng.material.input, global.ng.material.checkbox, global.ng.material.expansion, global.ng.material.toolbar, global.ng.material.icon, global.ng.material.button, global.ng.material.menu, global.ng.material.select, global.ng.material.card, global.ng.material.tabs, global.ng.material.stepper, global.ng.material.list, global.ng.material.buttonToggle, global.ng.material.progressSpinner, global.ng.material.progressBar, global.ng.material.radio, global.ng.material.badge, global.ng.material.slideToggle, global.ng.material.dialog, global.ng.material.autocomplete, global.ng.forms, global.rxjs, global.rxjs.operators, global.ng.animations, global['ngx-translate'].core, global.ionic.angular, global.moment, global.ng.materialMomentAdapter, global['ionic-native'].keyboard.ngx, global['angular2-text-mask'], global['ngx-material-timepicker'], global.ng.material.datepicker, global.ng.material.divider, global.ng.material.tooltip, global.ng.material.chips, global.ng.router, global.ng.platformBrowser, global.ng.common.http, global['ngx-color-picker'], global['ionic-native']['native-audio'].ngx, global['ionic-native'].vibration.ngx, global['ionic-native']['audio-management'].ngx, global['ionic-native']['native-audio'].ngx.index, global['ionic-native'].vibration.ngx.index, global['ionic-native']['audio-management'].ngx.index, global.uuid.v4, global.ng.cdk.dragDrop, global['ngx-markdown'], global.tweetnacl, global.ionic.storage, null, global['ionic-native']['splash-screen'].ngx, global['ionic-native'].network.ngx, global['ionic-cache'], global['ionic-cache/dist/cache'].service, global['ionic-native'].network.ngx.index, global['ionic-native']['splash-screen'].ngx.index, global['ionic-native']['status-bar'].ngx, global.ng.cdk.platform, global['ionic-native']['in-app-browser'].ngx, global.apollo.client.core, global['apollo-angular'], global.apollo.client.link.ws, global.apollo.client.utilities, global.apollo.client.link.retry, global['apollo-link-queue'], global['apollo-link-serialize'], global['apollo-link-logger'], global['apollo-angular'].http, global['apollo3-cache-persist'], global['ionic-native'].downloader.ngx, global['ionic-native']['status-bar'].ngx.index, global['ionic-native'].keyboard.ngx.index, global['ionic-native']['in-app-browser'].ngx.index, global['ionic-native'].downloader.ngx.index, global.ng.cdk.textField, global['e-is']['ngx-material-table'], global.ng.cdk.collections, global['ngx-jdenticon'], null, null, null, global['moment-timezone']));
5
- }(this, (function (exports, i0, i1$4, table$1, a11y, overlay, scrolling, i1$3, table, sort$1, paginator, formField, input, checkbox, expansion, toolbar, icon, button, menu, select, card, tabs, stepper, list, buttonToggle, progressSpinner, progressBar, radio, badge, slideToggle, i2, autocomplete, i1, rxjs, operators, animations, i1$2, i1$5, momentImported, i1$1, ngx, angular2TextMask, ngxMaterialTimepicker, datepicker, divider, tooltip, chips, i3, i1$6, i2$1, ngxColorPicker, ngx$2, ngx$3, ngx$1, i2$2, i3$1, i4, uuidv4Imported, dragDrop, ngxMarkdown, tweetnacl, i3$2, zoneError, ngx$5, ngx$4, ionicCache, i6, i9, i10, ngx$7, i2$4, ngx$8, core, i2$3, ws, utilities, retry, QueueLink, SerializingLink, loggerLink, i3$3, apollo3CachePersist, ngx$6, i14, i15, i17, i18, textField, ngxMaterialTable, collections, ngxJdenticon, tweetnaclUtil, scryptAsync, hammerjs, momentTZImported) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/table'), require('@angular/cdk/a11y'), require('@angular/cdk/overlay'), require('@angular/cdk/scrolling'), require('@angular/material/core'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/checkbox'), require('@angular/material/expansion'), require('@angular/material/toolbar'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/menu'), require('@angular/material/select'), require('@angular/material/card'), require('@angular/material/tabs'), require('@angular/material/stepper'), require('@angular/material/list'), require('@angular/material/button-toggle'), require('@angular/material/progress-spinner'), require('@angular/material/progress-bar'), require('@angular/material/radio'), require('@angular/material/badge'), require('@angular/material/slide-toggle'), require('@angular/material/dialog'), require('@angular/material/autocomplete'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/animations'), require('@ngx-translate/core'), require('@ionic/angular'), require('moment'), require('@angular/material-moment-adapter'), require('@ionic-native/keyboard/ngx'), require('angular2-text-mask'), require('ngx-material-timepicker'), require('@angular/material/datepicker'), require('@angular/material/divider'), require('@angular/material/tooltip'), require('@angular/material/chips'), require('@angular/router'), require('@angular/platform-browser'), require('@angular/common/http'), require('ngx-color-picker'), require('@ionic-native/native-audio/ngx'), require('@ionic-native/vibration/ngx'), require('@ionic-native/audio-management/ngx'), require('@ionic-native/native-audio/ngx/index'), require('@ionic-native/vibration/ngx/index'), require('@ionic-native/audio-management/ngx/index'), require('uuid/v4'), require('rxjs/internal/operators'), require('@angular/cdk/drag-drop'), require('ngx-markdown'), require('tweetnacl'), require('@ionic/storage'), require('zone.js/dist/zone-error'), require('@ionic-native/splash-screen/ngx'), require('@ionic-native/network/ngx'), require('ionic-cache'), require('ionic-cache/dist/cache.service'), require('@ionic-native/network/ngx/index'), require('@ionic-native/splash-screen/ngx/index'), require('@ionic-native/status-bar/ngx'), require('@angular/cdk/platform'), require('@ionic-native/in-app-browser/ngx'), require('@apollo/client/core'), require('apollo-angular'), require('@apollo/client/link/ws'), require('@apollo/client/utilities'), require('@apollo/client/link/retry'), require('apollo-link-queue'), require('apollo-link-serialize'), require('apollo-link-logger'), require('apollo-angular/http'), require('apollo3-cache-persist'), require('@ionic-native/downloader/ngx'), require('@ionic-native/status-bar/ngx/index'), require('@ionic-native/keyboard/ngx/index'), require('@ionic-native/in-app-browser/ngx/index'), require('@ionic-native/downloader/ngx/index'), require('@angular/cdk/text-field'), require('@e-is/ngx-material-table'), require('@angular/cdk/collections'), require('ngx-jdenticon'), require('tweetnacl-util'), require('scrypt-async'), require('hammerjs'), require('moment-timezone')) :
3
+ typeof define === 'function' && define.amd ? define('@sumaris-net/ngx-components', ['exports', '@angular/core', '@angular/common', '@angular/cdk/table', '@angular/cdk/a11y', '@angular/cdk/overlay', '@angular/cdk/scrolling', '@angular/material/core', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/material/form-field', '@angular/material/input', '@angular/material/checkbox', '@angular/material/expansion', '@angular/material/toolbar', '@angular/material/icon', '@angular/material/button', '@angular/material/menu', '@angular/material/select', '@angular/material/card', '@angular/material/tabs', '@angular/material/stepper', '@angular/material/list', '@angular/material/button-toggle', '@angular/material/progress-spinner', '@angular/material/progress-bar', '@angular/material/radio', '@angular/material/badge', '@angular/material/slide-toggle', '@angular/material/dialog', '@angular/material/autocomplete', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/animations', '@ngx-translate/core', '@ionic/angular', 'moment', '@angular/material-moment-adapter', '@ionic-native/keyboard/ngx', 'angular2-text-mask', 'ngx-material-timepicker', '@angular/material/datepicker', '@angular/material/divider', '@angular/material/tooltip', '@angular/material/chips', '@angular/router', '@angular/platform-browser', '@angular/common/http', 'ngx-color-picker', '@ionic-native/native-audio/ngx', '@ionic-native/vibration/ngx', '@ionic-native/audio-management/ngx', '@ionic-native/native-audio/ngx/index', '@ionic-native/vibration/ngx/index', '@ionic-native/audio-management/ngx/index', 'uuid/v4', 'rxjs/internal/operators', '@angular/cdk/drag-drop', 'ngx-markdown', 'tweetnacl', '@ionic/storage', 'zone.js/dist/zone-error', '@ionic-native/splash-screen/ngx', '@ionic-native/network/ngx', 'ionic-cache', 'ionic-cache/dist/cache.service', '@ionic-native/network/ngx/index', '@ionic-native/splash-screen/ngx/index', '@ionic-native/status-bar/ngx', '@angular/cdk/platform', '@ionic-native/in-app-browser/ngx', '@apollo/client/core', 'apollo-angular', '@apollo/client/link/ws', '@apollo/client/utilities', '@apollo/client/link/retry', 'apollo-link-queue', 'apollo-link-serialize', 'apollo-link-logger', 'apollo-angular/http', 'apollo3-cache-persist', '@ionic-native/downloader/ngx', '@ionic-native/status-bar/ngx/index', '@ionic-native/keyboard/ngx/index', '@ionic-native/in-app-browser/ngx/index', '@ionic-native/downloader/ngx/index', '@angular/cdk/text-field', '@e-is/ngx-material-table', '@angular/cdk/collections', 'ngx-jdenticon', 'tweetnacl-util', 'scrypt-async', 'hammerjs', 'moment-timezone'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sumaris-net'] = global['sumaris-net'] || {}, global['sumaris-net']['ngx-components'] = {}), global.ng.core, global.ng.common, global.ng.cdk.table, global.ng.cdk.a11y, global.ng.cdk.overlay, global.ng.cdk.scrolling, global.ng.material.core, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.material.formField, global.ng.material.input, global.ng.material.checkbox, global.ng.material.expansion, global.ng.material.toolbar, global.ng.material.icon, global.ng.material.button, global.ng.material.menu, global.ng.material.select, global.ng.material.card, global.ng.material.tabs, global.ng.material.stepper, global.ng.material.list, global.ng.material.buttonToggle, global.ng.material.progressSpinner, global.ng.material.progressBar, global.ng.material.radio, global.ng.material.badge, global.ng.material.slideToggle, global.ng.material.dialog, global.ng.material.autocomplete, global.ng.forms, global.rxjs, global.rxjs.operators, global.ng.animations, global['ngx-translate'].core, global.ionic.angular, global.moment, global.ng.materialMomentAdapter, global['ionic-native'].keyboard.ngx, global['angular2-text-mask'], global['ngx-material-timepicker'], global.ng.material.datepicker, global.ng.material.divider, global.ng.material.tooltip, global.ng.material.chips, global.ng.router, global.ng.platformBrowser, global.ng.common.http, global['ngx-color-picker'], global['ionic-native']['native-audio'].ngx, global['ionic-native'].vibration.ngx, global['ionic-native']['audio-management'].ngx, global['ionic-native']['native-audio'].ngx.index, global['ionic-native'].vibration.ngx.index, global['ionic-native']['audio-management'].ngx.index, global.uuid.v4, global.rxjs['internal/operators'], global.ng.cdk.dragDrop, global['ngx-markdown'], global.tweetnacl, global.ionic.storage, null, global['ionic-native']['splash-screen'].ngx, global['ionic-native'].network.ngx, global['ionic-cache'], global['ionic-cache/dist/cache'].service, global['ionic-native'].network.ngx.index, global['ionic-native']['splash-screen'].ngx.index, global['ionic-native']['status-bar'].ngx, global.ng.cdk.platform, global['ionic-native']['in-app-browser'].ngx, global.apollo.client.core, global['apollo-angular'], global.apollo.client.link.ws, global.apollo.client.utilities, global.apollo.client.link.retry, global['apollo-link-queue'], global['apollo-link-serialize'], global['apollo-link-logger'], global['apollo-angular'].http, global['apollo3-cache-persist'], global['ionic-native'].downloader.ngx, global['ionic-native']['status-bar'].ngx.index, global['ionic-native'].keyboard.ngx.index, global['ionic-native']['in-app-browser'].ngx.index, global['ionic-native'].downloader.ngx.index, global.ng.cdk.textField, global['e-is']['ngx-material-table'], global.ng.cdk.collections, global['ngx-jdenticon'], null, null, null, global['moment-timezone']));
5
+ }(this, (function (exports, i0, i1$4, table$1, a11y, overlay, scrolling, i1$3, table, sort$1, paginator, formField, input, checkbox, expansion, toolbar, icon, button, menu, select, card, tabs, stepper, list, buttonToggle, progressSpinner, progressBar, radio, badge, slideToggle, i2, autocomplete, i1, rxjs, operators, animations, i1$2, i1$5, momentImported, i1$1, ngx, angular2TextMask, ngxMaterialTimepicker, datepicker, divider, tooltip, chips, i3, i1$6, i2$1, ngxColorPicker, ngx$2, ngx$3, ngx$1, i2$2, i3$1, i4, uuidv4Imported, operators$1, dragDrop, ngxMarkdown, tweetnacl, i3$2, zoneError, ngx$5, ngx$4, ionicCache, i6, i9, i10, ngx$7, i2$4, ngx$8, core, i2$3, ws, utilities, retry, QueueLink, SerializingLink, loggerLink, i3$3, apollo3CachePersist, ngx$6, i14, i15, i17, i18, textField, ngxMaterialTable, collections, ngxJdenticon, tweetnaclUtil, scryptAsync, hammerjs, momentTZImported) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -46,7 +46,7 @@
46
46
  var SPACE_PLACEHOLDER_CHAR = '\u2000';
47
47
  var KEYBOARD_HIDE_DELAY_MS = 250; // 1s
48
48
 
49
- /*! *****************************************************************************
49
+ /******************************************************************************
50
50
  Copyright (c) Microsoft Corporation.
51
51
 
52
52
  Permission to use, copy, modify, and/or distribute this software for any
@@ -208,7 +208,11 @@
208
208
  var __createBinding = Object.create ? (function (o, m, k, k2) {
209
209
  if (k2 === undefined)
210
210
  k2 = k;
211
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
211
+ var desc = Object.getOwnPropertyDescriptor(m, k);
212
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
213
+ desc = { enumerable: true, get: function () { return m[k]; } };
214
+ }
215
+ Object.defineProperty(o, k2, desc);
212
216
  }) : (function (o, m, k, k2) {
213
217
  if (k2 === undefined)
214
218
  k2 = k;
@@ -363,6 +367,11 @@
363
367
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
364
368
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
365
369
  }
370
+ function __classPrivateFieldIn(state, receiver) {
371
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
372
+ throw new TypeError("Cannot use 'in' operator on non-object");
373
+ return typeof state === "function" ? receiver === state : state.has(receiver);
374
+ }
366
375
 
367
376
  function isNil(obj) {
368
377
  return obj === undefined || obj === null;
@@ -10553,44 +10562,97 @@
10553
10562
  },] }
10554
10563
  ];
10555
10564
 
10565
+ var UploadFile = /** @class */ (function (_super) {
10566
+ __extends(UploadFile, _super);
10567
+ function UploadFile() {
10568
+ return _super !== null && _super.apply(this, arguments) || this;
10569
+ }
10570
+ return UploadFile;
10571
+ }(File));
10572
+ var FileResponse = /** @class */ (function () {
10573
+ function FileResponse(init) {
10574
+ this.type = i2$1.HttpEventType.Response;
10575
+ this.body = isNotNil(init === null || init === void 0 ? void 0 : init.body) ? init.body : null;
10576
+ this.status = (init === null || init === void 0 ? void 0 : init.status) || 0;
10577
+ this.statusText = (init === null || init === void 0 ? void 0 : init.statusText) || 'OK';
10578
+ }
10579
+ return FileResponse;
10580
+ }());
10581
+ function isProgressEvent(event) {
10582
+ return event && (event.type === i2$1.HttpEventType.UploadProgress
10583
+ || event.type === i2$1.HttpEventType.DownloadProgress);
10584
+ }
10585
+ function isResponseEvent(event) {
10586
+ return event && event.type === i2$1.HttpEventType.Response;
10587
+ }
10588
+
10556
10589
  var IMAGE_DEFAULTS = {
10557
10590
  MAX_HEIGHT: 480,
10558
10591
  MAX_WIDTH: 640,
10559
10592
  THUMB_MAX_HEIGHT: 200,
10560
10593
  THUMB_MAX_WIDTH: 200
10561
10594
  };
10562
- var Base64ImageReader = /** @class */ (function () {
10563
- function Base64ImageReader() {
10595
+ // @dynamic
10596
+ var ImagesUtils = /** @class */ (function () {
10597
+ function ImagesUtils() {
10564
10598
  }
10565
- Base64ImageReader.prototype.readFromBlob = function (file) {
10566
- return __awaiter(this, void 0, void 0, function () {
10567
- var dataUrl;
10568
- return __generator(this, function (_a) {
10569
- switch (_a.label) {
10570
- case 0:
10571
- if (!file)
10572
- throw new Error('Illegal argument: missing file');
10573
- return [4 /*yield*/, new Promise(function (resolve, reject) {
10574
- var reader = new FileReader();
10575
- reader.addEventListener('load', function (event) { return resolve(reader.result); }, false);
10576
- reader.readAsDataURL(file);
10577
- })];
10578
- case 1:
10579
- dataUrl = _a.sent();
10580
- return [2 /*return*/, dataUrl];
10581
- }
10582
- });
10583
- });
10599
+ ImagesUtils.readAsDataURL = function (file, opts) {
10600
+ var _this = this;
10601
+ var $progress = new rxjs.Subject();
10602
+ var reader = new FileReader();
10603
+ // Listen progress
10604
+ reader.onprogress = function (e) {
10605
+ var total = e.total || 1;
10606
+ var loaded = e.total || 0;
10607
+ if (loaded < total)
10608
+ $progress.next({ type: i2$1.HttpEventType.UploadProgress, loaded: loaded, total: total });
10609
+ };
10610
+ // Listen end
10611
+ reader.onloadend = function (e) {
10612
+ var body = reader.result;
10613
+ if (typeof body === 'string') {
10614
+ $progress.next(new FileResponse({ body: body }));
10615
+ $progress.complete();
10616
+ }
10617
+ else {
10618
+ console.error("[image-utils] Cannot read file '" + file.name + "' as text");
10619
+ $progress.error("Cannot read file as text");
10620
+ }
10621
+ };
10622
+ // Listen error
10623
+ reader.onerror = function (event) {
10624
+ console.error('[image-utils] Error while reading file:', event);
10625
+ $progress.error(event);
10626
+ };
10627
+ // Start reading the file
10628
+ reader.readAsDataURL(file);
10629
+ // Resize image, if need
10630
+ if (opts) {
10631
+ return $progress.pipe(operators$1.mergeMap(function (event) { return __awaiter(_this, void 0, void 0, function () {
10632
+ var body;
10633
+ return __generator(this, function (_a) {
10634
+ switch (_a.label) {
10635
+ case 0:
10636
+ if (!(event instanceof FileResponse)) return [3 /*break*/, 2];
10637
+ return [4 /*yield*/, ImagesUtils.resizeBase64(event.body, opts)];
10638
+ case 1:
10639
+ body = _a.sent();
10640
+ return [2 /*return*/, new FileResponse({ body: body })];
10641
+ case 2: return [2 /*return*/, event];
10642
+ }
10643
+ });
10644
+ }); }));
10645
+ }
10646
+ return $progress.asObservable();
10584
10647
  };
10585
- Base64ImageReader.prototype.readAndResizeFromUrl = function (path, opts) {
10648
+ ImagesUtils.readAndResizeFromUrl = function (fileUrl, opts) {
10586
10649
  return __awaiter(this, void 0, void 0, function () {
10587
10650
  var img, err_1;
10588
- var _this = this;
10589
10651
  return __generator(this, function (_a) {
10590
10652
  switch (_a.label) {
10591
10653
  case 0:
10592
- if (isNilOrBlank(path))
10593
- throw new Error('Illegal argument: missing path');
10654
+ if (isNilOrBlank(fileUrl))
10655
+ throw new Error('Illegal argument: missing fileUrl');
10594
10656
  img = document.createElement('img');
10595
10657
  // Need to avoid CORS error
10596
10658
  // (see https://stackoverflow.com/questions/22710627/tainted-canvases-may-not-be-exported)
@@ -10599,14 +10661,14 @@
10599
10661
  case 1:
10600
10662
  _a.trys.push([1, 3, 4, 5]);
10601
10663
  return [4 /*yield*/, new Promise(function (resolve, reject) {
10602
- img.addEventListener('load', _this.createImageOnLoadResizeFn(resolve, reject, opts), false);
10664
+ img.addEventListener('load', ImagesUtils.createImageOnLoadResizeFn(resolve, reject, opts), false);
10603
10665
  img.addEventListener('error', reject);
10604
- img.src = path;
10666
+ img.src = fileUrl;
10605
10667
  })];
10606
10668
  case 2: return [2 /*return*/, _a.sent()];
10607
10669
  case 3:
10608
10670
  err_1 = _a.sent();
10609
- throw new Error("Failed to load and resize image {" + path + "}");
10671
+ throw new Error("Failed to load and resize image {" + fileUrl + "}");
10610
10672
  case 4:
10611
10673
  img.remove();
10612
10674
  return [7 /*endfinally*/];
@@ -10615,15 +10677,12 @@
10615
10677
  });
10616
10678
  });
10617
10679
  };
10618
- Base64ImageReader.prototype.readAndResizeFromBlob = function (file, opts) {
10680
+ ImagesUtils.resizeBase64 = function (dataUrl, opts) {
10619
10681
  return __awaiter(this, void 0, void 0, function () {
10620
10682
  var img;
10621
- var _this = this;
10622
10683
  return __generator(this, function (_a) {
10623
10684
  switch (_a.label) {
10624
10685
  case 0:
10625
- if (!file)
10626
- throw new Error('Illegal argument: missing file');
10627
10686
  img = document.createElement('img');
10628
10687
  // Need to avoid CORS error
10629
10688
  // (see https://stackoverflow.com/questions/22710627/tainted-canvases-may-not-be-exported)
@@ -10632,13 +10691,9 @@
10632
10691
  case 1:
10633
10692
  _a.trys.push([1, , 3, 4]);
10634
10693
  return [4 /*yield*/, new Promise(function (resolve, reject) {
10635
- var reader = new FileReader();
10636
- reader.addEventListener('load', function (event) {
10637
- // Resize image
10638
- img.onload = _this.createImageOnLoadResizeFn(resolve, reject, opts);
10639
- img.src = reader.result;
10640
- }, false);
10641
- reader.readAsDataURL(file);
10694
+ img.addEventListener('load', ImagesUtils.createImageOnLoadResizeFn(resolve, reject, opts), false);
10695
+ img.addEventListener('error', reject);
10696
+ img.src = dataUrl;
10642
10697
  })];
10643
10698
  case 2: return [2 /*return*/, _a.sent()];
10644
10699
  case 3:
@@ -10649,8 +10704,7 @@
10649
10704
  });
10650
10705
  });
10651
10706
  };
10652
- /* -- protected methods -- */
10653
- Base64ImageReader.prototype.createImageOnLoadResizeFn = function (resolve, reject, opts) {
10707
+ ImagesUtils.createImageOnLoadResizeFn = function (resolve, reject, opts) {
10654
10708
  return function (event) {
10655
10709
  var maxWidth = (opts && opts.thumbnail ? IMAGE_DEFAULTS.THUMB_MAX_WIDTH : (opts && opts.maxWidth || IMAGE_DEFAULTS.MAX_WIDTH));
10656
10710
  var maxHeight = (opts && opts.thumbnail ? IMAGE_DEFAULTS.THUMB_MAX_HEIGHT : (opts && opts.maxHeight || IMAGE_DEFAULTS.MAX_HEIGHT));
@@ -10716,7 +10770,7 @@
10716
10770
  }
10717
10771
  };
10718
10772
  };
10719
- return Base64ImageReader;
10773
+ return ImagesUtils;
10720
10774
  }());
10721
10775
 
10722
10776
  var uuidv4 = uuidv4Imported__namespace;
@@ -10751,28 +10805,28 @@
10751
10805
  var jobsFactories = (sources || []).map(function (source) { return function () { return _this.getImage(source, Object.assign({}, opts)); }; });
10752
10806
  return chainPromises(jobsFactories);
10753
10807
  };
10754
- FileService.prototype.getImage = function (source, opts) {
10808
+ FileService.prototype.getImage = function (fileUrl, opts) {
10755
10809
  return __awaiter(this, void 0, void 0, function () {
10756
- var responseType, debug, now, lastSlashIndex, fileName, targetFilePath, blob, err_1, dataUrl;
10810
+ var outputType, debug, now, lastSlashIndex, fileName, targetFilePath, blob, err_1, dataUrl;
10757
10811
  return __generator(this, function (_a) {
10758
10812
  switch (_a.label) {
10759
10813
  case 0:
10760
- responseType = opts && opts.responseType || (this.canUseFileSystem ? 'file' : 'dataUrl');
10814
+ outputType = opts && opts.outputType || (this.canUseFileSystem ? 'fileUrl' : 'dataUrl');
10761
10815
  debug = this._debug /*&& (!opts || !opts.fileTransfer)*/;
10762
10816
  now = debug && Date.now();
10763
10817
  if (debug)
10764
- console.debug("[file] Fetching image {" + source + "} into " + responseType + "...");
10765
- lastSlashIndex = source.lastIndexOf('/');
10818
+ console.debug("[file] Fetching image {" + fileUrl + "} into " + outputType + "...");
10819
+ lastSlashIndex = fileUrl.lastIndexOf('/');
10766
10820
  if (lastSlashIndex === -1)
10767
- throw new Error('Invalid URL: ' + source);
10768
- fileName = lastSlashIndex < (source.length - 1) && source.substring(lastSlashIndex + 1) || uuidv4();
10769
- if (!(responseType === 'file' && this.canUseFileSystem)) return [3 /*break*/, 4];
10770
- console.warn("WARN: [file] Fetching image {" + source + "} in local file...");
10821
+ throw new Error('Invalid URL: ' + fileUrl);
10822
+ fileName = lastSlashIndex < (fileUrl.length - 1) && fileUrl.substring(lastSlashIndex + 1) || uuidv4();
10823
+ if (!(outputType === 'fileUrl' && this.canUseFileSystem)) return [3 /*break*/, 4];
10824
+ console.warn("WARN: [file] Downloading image {" + fileUrl + "} in local filesystem...");
10771
10825
  targetFilePath = this._imageDirectory + fileName;
10772
10826
  _a.label = 1;
10773
10827
  case 1:
10774
10828
  _a.trys.push([1, 3, , 4]);
10775
- return [4 /*yield*/, firstNotNilPromise(this.http.get(source, {
10829
+ return [4 /*yield*/, firstNotNilPromise(this.http.get(fileUrl, {
10776
10830
  observe: 'body',
10777
10831
  responseType: 'blob',
10778
10832
  reportProgress: false
@@ -10784,25 +10838,25 @@
10784
10838
  //const fileTransfer = (opts && opts.fileTransfer) || this.transfer.create();
10785
10839
  //await fileTransfer.download(source, targetFilePath);
10786
10840
  if (debug)
10787
- console.debug("[file] Fetching image {" + source + "} into " + responseType + " [OK] in " + (Date.now() - now) + "ms");
10841
+ console.debug("[file] Fetching image {" + fileUrl + "} into " + outputType + " [OK] in " + (Date.now() - now) + "ms");
10788
10842
  return [2 /*return*/, targetFilePath];
10789
10843
  case 3:
10790
10844
  err_1 = _a.sent();
10791
- console.error("[file] Error while download " + source + ": " + (err_1 && err_1.message || err_1));
10845
+ console.error("[file] Error while download " + fileUrl + ": " + (err_1 && err_1.message || err_1));
10792
10846
  // Continue (fallback to data Url)
10793
- responseType = 'dataUrl';
10847
+ outputType = 'dataUrl';
10794
10848
  return [3 /*break*/, 4];
10795
10849
  case 4:
10796
- if (!(responseType === 'dataUrl')) return [3 /*break*/, 6];
10797
- return [4 /*yield*/, new Base64ImageReader().readAndResizeFromUrl(source, opts)];
10850
+ if (!(outputType === 'dataUrl')) return [3 /*break*/, 6];
10851
+ return [4 /*yield*/, ImagesUtils.readAndResizeFromUrl(fileUrl, opts)];
10798
10852
  case 5:
10799
10853
  dataUrl = _a.sent();
10800
10854
  if (debug)
10801
- console.debug("[file] Fetching image {" + source + "} into " + responseType + " [OK] in " + (Date.now() - now) + "ms");
10855
+ console.debug("[file] Fetching image {" + fileUrl + "} into " + outputType + " [OK] in " + (Date.now() - now) + "ms");
10802
10856
  return [2 /*return*/, dataUrl];
10803
10857
  case 6:
10804
10858
  // Keep original URL
10805
- return [2 /*return*/, source];
10859
+ return [2 /*return*/, fileUrl];
10806
10860
  }
10807
10861
  });
10808
10862
  });
@@ -15009,7 +15063,9 @@
15009
15063
  return expectedProfileIndex !== -1 && PersonUtils.getMainProfileIndex(actualProfiles) <= expectedProfileIndex;
15010
15064
  };
15011
15065
  PersonUtils.personToString = function (obj) {
15012
- return obj && obj.id && (obj.lastName + ' ' + obj.firstName) || undefined;
15066
+ if (!obj || !obj.id)
15067
+ return undefined;
15068
+ return obj.lastName + ' ' + obj.firstName;
15013
15069
  };
15014
15070
  PersonUtils.personsToString = function (data, separator) {
15015
15071
  return (data || []).map(PersonUtils.personToString).join(separator || ', ');
@@ -17182,7 +17238,7 @@
17182
17238
  if (!(hasAvatarUrl && this.network.online)) return [3 /*break*/, 2];
17183
17239
  return [4 /*yield*/, this.file.getImage(json.avatar, {
17184
17240
  thumbnail: true,
17185
- responseType: 'dataUrl'
17241
+ outputType: 'dataUrl'
17186
17242
  })
17187
17243
  .then(function (dataUrl) {
17188
17244
  if (dataUrl && _this._debug)
@@ -18157,30 +18213,6 @@
18157
18213
  ]; };
18158
18214
  var templateObject_1$1, templateObject_2$1, templateObject_3$1, templateObject_4$1, templateObject_5$1;
18159
18215
 
18160
- var UploadFile = /** @class */ (function (_super) {
18161
- __extends(UploadFile, _super);
18162
- function UploadFile() {
18163
- return _super !== null && _super.apply(this, arguments) || this;
18164
- }
18165
- return UploadFile;
18166
- }(File));
18167
- var FileResponse = /** @class */ (function () {
18168
- function FileResponse(init) {
18169
- this.type = i2$1.HttpEventType.Response;
18170
- this.body = isNotNil(init === null || init === void 0 ? void 0 : init.body) ? init.body : null;
18171
- this.status = (init === null || init === void 0 ? void 0 : init.status) || 0;
18172
- this.statusText = (init === null || init === void 0 ? void 0 : init.statusText) || 'OK';
18173
- }
18174
- return FileResponse;
18175
- }());
18176
- function isProgressEvent(event) {
18177
- return event && (event.type === i2$1.HttpEventType.UploadProgress
18178
- || event.type === i2$1.HttpEventType.DownloadProgress);
18179
- }
18180
- function isResponseEvent(event) {
18181
- return event && event.type === i2$1.HttpEventType.Response;
18182
- }
18183
-
18184
18216
  var UploadFilePopover = /** @class */ (function () {
18185
18217
  function UploadFilePopover(popoverController, translate, cd) {
18186
18218
  this.popoverController = popoverController;
@@ -24837,7 +24869,7 @@
24837
24869
  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",
24838
24870
  animations: [fadeInAnimation],
24839
24871
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
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 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)}}"]
24872
+ 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)}}"]
24841
24873
  },] }
24842
24874
  ];
24843
24875
  MenuComponent.ctorParameters = function () { return [
@@ -28796,10 +28828,10 @@
28796
28828
  _this.savingSubject = new rxjs.BehaviorSubject(false);
28797
28829
  _this.$title = new rxjs.Subject();
28798
28830
  _this.onUpdateView = new i0.EventEmitter();
28799
- _this.environement = injector.get(ENVIRONMENT);
28831
+ _this.environment = injector.get(ENVIRONMENT);
28800
28832
  options = Object.assign({
28801
28833
  // Default options
28802
- 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: ''
28834
+ 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: ''
28803
28835
  }, options);
28804
28836
  _this.settings = injector.get(LocalSettingsService);
28805
28837
  _this.errorTranslator = injector.get(FormErrorTranslator);
@@ -29098,13 +29130,14 @@
29098
29130
  * Enable or disable state
29099
29131
  */
29100
29132
  AppEntityEditor.prototype.updateViewState = function (data, opts) {
29133
+ var _a;
29101
29134
  if (this.isNewData || this.canUserWrite(data)) {
29102
29135
  this.enable(opts);
29103
29136
  }
29104
29137
  else {
29105
29138
  this.disable(opts);
29106
29139
  // Allow to sort table
29107
- this.tables.forEach(function (t) { return t.enableSort(); });
29140
+ (_a = this.tables) === null || _a === void 0 ? void 0 : _a.forEach(function (t) { return t.enableSort(); });
29108
29141
  }
29109
29142
  };
29110
29143
  /**
@@ -29838,13 +29871,14 @@
29838
29871
  * Enable or disable state
29839
29872
  */
29840
29873
  AppEntityEditorModal.prototype.updateViewState = function (data, opts) {
29874
+ var _a;
29841
29875
  if (this.isNewData || this.enabled) {
29842
29876
  this.enable(opts);
29843
29877
  }
29844
29878
  else {
29845
29879
  this.disable(opts);
29846
29880
  // Allow to sort table
29847
- this.tables.forEach(function (t) { return t.enableSort(); });
29881
+ (_a = this.tables) === null || _a === void 0 ? void 0 : _a.forEach(function (t) { return t.enableSort(); });
29848
29882
  }
29849
29883
  };
29850
29884
  AppEntityEditorModal.prototype.saveAndClose = function (event) {
@@ -30327,27 +30361,35 @@
30327
30361
  fetchPolicy: (opts === null || opts === void 0 ? void 0 : opts.fetchPolicy) || 'cache-first',
30328
30362
  insertFilterFn: filter && filter.asFilterFn()
30329
30363
  })
30330
- .pipe(operators.map(function (res) {
30331
- var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
30332
- if (now) {
30333
- console.debug("" + _this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
30334
- now = null;
30335
- }
30336
- // Must re-order because of listenChanges result will add new event at the end
30337
- data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
30338
- var result = {
30339
- data: data,
30340
- total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
30341
- };
30342
- // Add fetch more capability, if total was fetched
30343
- if (isNotNil(res.total)) {
30344
- var nextOffset_1 = (page.offset || 0) + data.length;
30345
- if (nextOffset_1 < result.total) {
30346
- result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_1 }), filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
30364
+ .pipe(operators.mergeMap(function (res) { return __awaiter(_this, void 0, void 0, function () {
30365
+ var data, result, nextOffset_1;
30366
+ var _this = this;
30367
+ return __generator(this, function (_b) {
30368
+ switch (_b.label) {
30369
+ case 0: return [4 /*yield*/, Promise.all(((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
30370
+ case 1:
30371
+ data = _b.sent();
30372
+ if (now) {
30373
+ console.debug("" + this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
30374
+ now = null;
30375
+ }
30376
+ // Must re-order because of listenAllChanges result will add new event at the end
30377
+ data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
30378
+ result = {
30379
+ data: data,
30380
+ total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
30381
+ };
30382
+ // Add fetch more capability, if total was fetched
30383
+ if (isNotNil(res.total)) {
30384
+ nextOffset_1 = (page.offset || 0) + data.length;
30385
+ if (nextOffset_1 < result.total) {
30386
+ result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_1 }), filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
30387
+ }
30388
+ }
30389
+ return [2 /*return*/, result];
30347
30390
  }
30348
- }
30349
- return result;
30350
- }));
30391
+ });
30392
+ }); }));
30351
30393
  };
30352
30394
  AbstractUserEventService.prototype.loadPage = function (page, filter, opts) {
30353
30395
  var _a;
@@ -30385,10 +30427,12 @@
30385
30427
  })];
30386
30428
  case 1:
30387
30429
  res = _b.sent();
30388
- data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
30430
+ return [4 /*yield*/, Promise.all(((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
30431
+ case 2:
30432
+ data = _b.sent();
30389
30433
  if (now)
30390
30434
  console.debug("" + this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
30391
- // Must re-order because of listenChanges result will add new event at the end
30435
+ // Must re-order because of listenAllChanges result will add new event at the end
30392
30436
  data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
30393
30437
  result = {
30394
30438
  data: data,
@@ -30407,16 +30451,28 @@
30407
30451
  });
30408
30452
  };
30409
30453
  AbstractUserEventService.prototype.add = function (entity) {
30410
- // TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
30411
- entity = this.processUserEvent(entity);
30412
- var withContent = !!entity.content;
30413
- // Add user event locally
30414
- this.insertIntoMutableCachedQueries(this.graphql.cache, {
30415
- query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30416
- data: entity
30454
+ return __awaiter(this, void 0, void 0, function () {
30455
+ var withContent;
30456
+ return __generator(this, function (_b) {
30457
+ switch (_b.label) {
30458
+ case 0: return [4 /*yield*/, this.processUserEvent(entity)];
30459
+ case 1:
30460
+ // TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
30461
+ entity = _b.sent();
30462
+ if (!entity)
30463
+ return [2 /*return*/]; // Rejected
30464
+ withContent = !!entity.content;
30465
+ // Add user event locally
30466
+ this.insertIntoMutableCachedQueries(this.graphql.cache, {
30467
+ query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30468
+ data: entity
30469
+ });
30470
+ // Update count
30471
+ this._countSubject.next(this._countSubject.value + 1);
30472
+ return [2 /*return*/];
30473
+ }
30474
+ });
30417
30475
  });
30418
- // Update count
30419
- this._countSubject.next(this._countSubject.value + 1);
30420
30476
  };
30421
30477
  AbstractUserEventService.prototype.count = function (filter, options) {
30422
30478
  var _a;
@@ -30462,6 +30518,7 @@
30462
30518
  filter = this.defaultFilter();
30463
30519
  // Apply last reset date as start date
30464
30520
  filter.startDate = this.resetCountDate;
30521
+ filter.excludeRead = true;
30465
30522
  filter = this.asFilter(filter);
30466
30523
  if (this._debug)
30467
30524
  console.debug(this._logPrefix + "[WS] Listening count changes for user events with filter:", filter);
@@ -30482,38 +30539,50 @@
30482
30539
  return total;
30483
30540
  }));
30484
30541
  };
30485
- AbstractUserEventService.prototype.listenChanges = function (filter, options) {
30542
+ AbstractUserEventService.prototype.listenAllChanges = function (filter, opts) {
30486
30543
  var _this = this;
30487
30544
  var _a;
30488
- if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.listenChanges)) {
30489
- console.warn(this._logPrefix + "Subscription query 'listenChanges' not provided, skip.");
30545
+ if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.listenAllChanges)) {
30546
+ console.warn(this._logPrefix + "Subscription query 'listenAllChanges' not provided, skip.");
30490
30547
  return rxjs.of();
30491
30548
  }
30492
30549
  if (!filter)
30493
30550
  filter = this.defaultFilter();
30494
30551
  filter = this.asFilter(filter);
30495
- var withContent = (options === null || options === void 0 ? void 0 : options.withContent) === true;
30552
+ var withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
30496
30553
  if (this._debug)
30497
30554
  console.debug(this._logPrefix + "[WS] Listening changes for user events with filter:", filter);
30498
30555
  return this.graphql.subscribe({
30499
- query: this.subscriptions.listenChanges,
30500
- fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
30501
- variables: { filter: filter.asPodObject(), interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
30556
+ query: this.subscriptions.listenAllChanges,
30557
+ fetchPolicy: opts === null || opts === void 0 ? void 0 : opts.fetchPolicy,
30558
+ variables: { filter: filter.asPodObject(), interval: toNumber(opts === null || opts === void 0 ? void 0 : opts.interval, 10) },
30502
30559
  error: {
30503
30560
  code: SocialErrorCodes.SUBSCRIBE_USER_EVENTS_ERROR,
30504
30561
  message: 'SOCIAL.ERROR.SUBSCRIBE_USER_EVENTS_ERROR'
30505
30562
  }
30506
- }).pipe(operators.map(function (_b) {
30563
+ }).pipe(operators.mergeMap(function (_b) {
30507
30564
  var data = _b.data;
30508
- if (data && _this._debug)
30509
- console.debug(_this._logPrefix + "Received new user events:", data);
30510
- var updatedData = data === null || data === void 0 ? void 0 : data.map(function (value) { return _this.processUserEvent(value, _this); });
30511
- // Update cache
30512
- _this.insertIntoMutableCachedQueries(_this.graphql.cache, {
30513
- query: withContent ? _this.queries.loadAllWithContent : _this.queries.loadAll,
30514
- data: updatedData
30515
- });
30516
- return updatedData;
30565
+ return __awaiter(_this, void 0, void 0, function () {
30566
+ var _this = this;
30567
+ return __generator(this, function (_b) {
30568
+ switch (_b.label) {
30569
+ case 0:
30570
+ if (data && this._debug)
30571
+ console.debug(this._logPrefix + "Received new user events:", data);
30572
+ // Update cache (will update watchAll queries)
30573
+ if (isNotEmptyArray(data)) {
30574
+ this.insertIntoMutableCachedQueries(this.graphql.cache, {
30575
+ query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30576
+ data: data
30577
+ });
30578
+ }
30579
+ if (!(!opts || opts.toEntity !== false)) return [3 /*break*/, 2];
30580
+ return [4 /*yield*/, Promise.all((data || []).map(function (value) { return _this.processUserEvent(value, _this); }))];
30581
+ case 1: return [2 /*return*/, _b.sent()];
30582
+ case 2: return [2 /*return*/, data];
30583
+ }
30584
+ });
30585
+ });
30517
30586
  }));
30518
30587
  };
30519
30588
  AbstractUserEventService.prototype.delete = function (entity) {
@@ -30630,7 +30699,7 @@
30630
30699
  });
30631
30700
  });
30632
30701
  };
30633
- AbstractUserEventService.prototype.markAsRead = function (entities) {
30702
+ AbstractUserEventService.prototype.markAllAsRead = function (entities) {
30634
30703
  return __awaiter(this, void 0, void 0, function () {
30635
30704
  var userEventWithoutReadListeners, _loop_1, this_1, _b, _c, entity, e_1_1;
30636
30705
  var e_1, _d;
@@ -30763,33 +30832,60 @@
30763
30832
  this._listenSubscription = undefined;
30764
30833
  };
30765
30834
  AbstractUserEventService.prototype.processUserEvent = function (source, that) {
30766
- var e_3, _b;
30767
- that = that || this;
30768
- // Convert json source to IUserEvent
30769
- var target = that.fromObject(source);
30770
- // Get listeners
30771
- var listeners = (that.listeners || []).filter(function (listener) { return listener.onReceived; }).filter(function (listener) { return listener.accept(target); });
30772
- try {
30773
- for (var listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next(); !listeners_1_1.done; listeners_1_1 = listeners_1.next()) {
30774
- var listener = listeners_1_1.value;
30775
- if (target) {
30776
- target = listener.onReceived(target);
30777
- }
30778
- else {
30779
- if (that._debug)
30780
- console.debug(that._logPrefix + "Event has been rejected by a listener", source);
30781
- break;
30835
+ return __awaiter(this, void 0, void 0, function () {
30836
+ var target, listeners, listeners_1, listeners_1_1, listener, res, _b, e_3_1;
30837
+ var e_3, _c;
30838
+ return __generator(this, function (_d) {
30839
+ switch (_d.label) {
30840
+ case 0:
30841
+ that = that || this;
30842
+ target = that.fromObject(source);
30843
+ listeners = (that.listeners || [])
30844
+ .filter(function (listener) { return !!listener.onReceived; })
30845
+ .filter(function (listener) { return listener.accept(target); });
30846
+ _d.label = 1;
30847
+ case 1:
30848
+ _d.trys.push([1, 9, 10, 11]);
30849
+ listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next();
30850
+ _d.label = 2;
30851
+ case 2:
30852
+ if (!!listeners_1_1.done) return [3 /*break*/, 8];
30853
+ listener = listeners_1_1.value;
30854
+ if (!target) return [3 /*break*/, 6];
30855
+ res = listener.onReceived(target);
30856
+ if (!(res instanceof Promise)) return [3 /*break*/, 4];
30857
+ return [4 /*yield*/, res];
30858
+ case 3:
30859
+ _b = _d.sent();
30860
+ return [3 /*break*/, 5];
30861
+ case 4:
30862
+ _b = res;
30863
+ _d.label = 5;
30864
+ case 5:
30865
+ target = _b;
30866
+ return [3 /*break*/, 7];
30867
+ case 6:
30868
+ if (that._debug)
30869
+ console.debug(that._logPrefix + "Event has been rejected by a listener", source);
30870
+ return [3 /*break*/, 8];
30871
+ case 7:
30872
+ listeners_1_1 = listeners_1.next();
30873
+ return [3 /*break*/, 2];
30874
+ case 8: return [3 /*break*/, 11];
30875
+ case 9:
30876
+ e_3_1 = _d.sent();
30877
+ e_3 = { error: e_3_1 };
30878
+ return [3 /*break*/, 11];
30879
+ case 10:
30880
+ try {
30881
+ if (listeners_1_1 && !listeners_1_1.done && (_c = listeners_1.return)) _c.call(listeners_1);
30882
+ }
30883
+ finally { if (e_3) throw e_3.error; }
30884
+ return [7 /*endfinally*/];
30885
+ case 11: return [2 /*return*/, target];
30782
30886
  }
30783
- }
30784
- }
30785
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
30786
- finally {
30787
- try {
30788
- if (listeners_1_1 && !listeners_1_1.done && (_b = listeners_1.return)) _b.call(listeners_1);
30789
- }
30790
- finally { if (e_3) throw e_3.error; }
30791
- }
30792
- return target;
30887
+ });
30888
+ });
30793
30889
  };
30794
30890
  AbstractUserEventService.prototype.defaultMarkAsRead = function (userEvents) {
30795
30891
  var _a;
@@ -30882,20 +30978,31 @@
30882
30978
  this.popoverController = popoverController;
30883
30979
  this.settings = settings;
30884
30980
  this.userEventService = userEventService;
30885
- this.subscriptions = new rxjs.Subscription();
30886
- this._fetchingMore = false;
30981
+ this._subscriptions = new rxjs.Subscription();
30982
+ this._$pageSize = new rxjs.BehaviorSubject(20);
30983
+ this.fetchingMore = false;
30984
+ this.$items = new rxjs.BehaviorSubject(undefined);
30985
+ this.$itemCount = new rxjs.BehaviorSubject(undefined);
30887
30986
  this.debug = false;
30888
- this.pageSize = 10;
30889
30987
  this.sortBy = 'creationDate';
30890
30988
  this.sortDirection = 'desc';
30891
30989
  this.enableInfiniteScroll = true;
30892
- this.$items = new rxjs.BehaviorSubject(undefined);
30893
- this.$itemCount = new rxjs.BehaviorSubject(undefined);
30894
30990
  this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
30895
30991
  }
30992
+ Object.defineProperty(UserEventNotificationList.prototype, "pageSize", {
30993
+ get: function () {
30994
+ return this._$pageSize.value;
30995
+ },
30996
+ set: function (value) {
30997
+ if (value > 0 && value !== this._$pageSize.value)
30998
+ this._$pageSize.next(value);
30999
+ },
31000
+ enumerable: false,
31001
+ configurable: true
31002
+ });
30896
31003
  Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
30897
31004
  get: function () {
30898
- return !!this._fetchMoreFn;
31005
+ return this.enableInfiniteScroll && !!this._fetchMoreFn;
30899
31006
  },
30900
31007
  enumerable: false,
30901
31008
  configurable: true
@@ -30904,38 +31011,46 @@
30904
31011
  var _this = this;
30905
31012
  // Watch all user events
30906
31013
  if (this.userEventService) {
30907
- this.subscriptions.add(this.userEventService
30908
- .watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
31014
+ this._subscriptions.add(this._$pageSize.pipe(operators.distinctUntilChanged(), operators.switchMap(function (pageSize) { return _this.userEventService.watchAll(0, pageSize, _this.sortBy, _this.sortDirection, _this.filter); }))
30909
31015
  .subscribe(function (result) {
30910
31016
  var _a;
30911
31017
  if (_this.debug)
30912
- console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
31018
+ console.debug("[user-event-notification-list] Receiving " + result.total + " user events", result.data);
30913
31019
  _this.$items.next(result.data);
30914
31020
  _this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
30915
31021
  _this._fetchMoreFn = result.fetchMore;
31022
+ _this.fetchingMore = false; // Allow to refetch more
30916
31023
  _this.markForCheck();
30917
31024
  }));
30918
31025
  // Listen changes
30919
- this.subscriptions.add(this.userEventService.listenChanges(undefined)
31026
+ this._subscriptions.add(this.userEventService.listenAllChanges(this.filter)
30920
31027
  .subscribe(function (data) {
30921
31028
  if (_this.debug)
30922
- console.debug("[user-event-notification-list] receiving " + data.length + " new user events", data);
31029
+ console.debug("[user-event-notification-list] Receiving " + data.length + " new user events (by WS)", data);
30923
31030
  }));
31031
+ if (this.enableInfiniteScroll)
31032
+ this.initInfiniteScroll();
30924
31033
  }
30925
31034
  };
30926
31035
  UserEventNotificationList.prototype.ngOnDestroy = function () {
30927
- this.subscriptions.unsubscribe();
31036
+ this._subscriptions.unsubscribe();
31037
+ this.$items.complete();
31038
+ this.$itemCount.complete();
30928
31039
  };
30929
31040
  UserEventNotificationList.prototype.click = function (event, userEvent) {
30930
31041
  if (!userEvent)
30931
31042
  return; // Skip
30932
31043
  // MarkAsRead
30933
31044
  this.markAsRead(event, userEvent);
30934
- var action = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.name === 'click' || a.name === 'default'; });
30935
- if (action) {
30936
- this.executeAction(event, action, userEvent);
31045
+ // Get the default action (if any)
31046
+ var defaultAction = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.default; });
31047
+ if (defaultAction) {
31048
+ this.executeAction(event, defaultAction, userEvent);
30937
31049
  }
30938
31050
  };
31051
+ UserEventNotificationList.prototype.isDefaultAction = function (action) {
31052
+ return action && action.default || false;
31053
+ };
30939
31054
  UserEventNotificationList.prototype.markAsRead = function (event, userEvent) {
30940
31055
  var _a;
30941
31056
  if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
@@ -30982,65 +31097,77 @@
30982
31097
  };
30983
31098
  UserEventNotificationList.prototype.dismiss = function () {
30984
31099
  this.popoverController.dismiss();
31100
+ // Reset counter (need if event has been received while popover if open)
31101
+ this.userEventService.resetCount();
30985
31102
  };
30986
31103
  UserEventNotificationList.prototype.fetchMore = function (event) {
30987
31104
  var _a;
30988
31105
  return __awaiter(this, void 0, void 0, function () {
30989
- var result, data, err_2;
31106
+ var fetchMoreFn, result, data, err_2;
30990
31107
  return __generator(this, function (_b) {
30991
31108
  switch (_b.label) {
30992
31109
  case 0:
30993
- if (!this._fetchMoreFn || this._fetchingMore)
31110
+ if (!this._fetchMoreFn || this.fetchingMore)
30994
31111
  return [2 /*return*/];
30995
31112
  console.debug('[user-event-notification-list] Fetching more notifications...', event);
30996
- this._fetchingMore = true;
31113
+ this.fetchingMore = true;
31114
+ fetchMoreFn = this._fetchMoreFn;
30997
31115
  _b.label = 1;
30998
31116
  case 1:
30999
31117
  _b.trys.push([1, 3, 4, 5]);
31000
- return [4 /*yield*/, this._fetchMoreFn()];
31118
+ return [4 /*yield*/, fetchMoreFn()];
31001
31119
  case 2:
31002
31120
  result = _b.sent();
31003
31121
  data = __spread((this.$items.value || []), result.data);
31004
31122
  // Remove duplication (e.g. when new user event was added by subscription)
31005
31123
  data = removeDuplicatesFromArray(data, 'id');
31124
+ // fetch more changes (e.g. if watchAll observable as been refreshed)
31125
+ if (fetchMoreFn !== this._fetchMoreFn)
31126
+ return [2 /*return*/]; // Skip
31006
31127
  this.$items.next(data);
31007
31128
  this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
31008
31129
  this._fetchMoreFn = result.fetchMore;
31130
+ // Update the page size, to keep same scroll height, after the next refresh
31131
+ this.pageSize = Math.max(this.pageSize, data.length);
31009
31132
  return [3 /*break*/, 5];
31010
31133
  case 3:
31011
31134
  err_2 = _b.sent();
31012
31135
  console.error(err_2);
31013
- this._fetchMoreFn = undefined;
31136
+ this._fetchMoreFn = undefined; // Forget the function
31014
31137
  return [3 /*break*/, 5];
31015
31138
  case 4:
31016
31139
  this.markForCheck();
31017
- this._fetchingMore = false;
31140
+ this.fetchingMore = false;
31018
31141
  return [7 /*endfinally*/];
31019
31142
  case 5: return [2 /*return*/];
31020
31143
  }
31021
31144
  });
31022
31145
  });
31023
31146
  };
31024
- UserEventNotificationList.prototype._initInfiniteScroll = function (threshold) {
31147
+ UserEventNotificationList.prototype.trackByFn = function (index, item) {
31148
+ return item.id;
31149
+ };
31150
+ UserEventNotificationList.prototype.initInfiniteScroll = function (threshold) {
31025
31151
  return __awaiter(this, void 0, void 0, function () {
31026
31152
  var panel;
31027
31153
  var _this = this;
31028
31154
  return __generator(this, function (_b) {
31029
31155
  switch (_b.label) {
31030
31156
  case 0:
31157
+ console.debug('[user-event-notification-list] Init infinite loop');
31031
31158
  if (this._fetchMoreSubscription)
31032
31159
  this._fetchMoreSubscription.unsubscribe();
31033
31160
  threshold = threshold || (this.mobile ? '15%' : '2%');
31034
- return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
31161
+ return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; }, { dueTime: 250, timeout: 1000 })];
31035
31162
  case 1:
31036
31163
  _b.sent();
31037
31164
  return [4 /*yield*/, this.ionContent.getScrollElement()];
31038
31165
  case 2:
31039
31166
  panel = _b.sent();
31040
31167
  // Trigger fetch more, end end scroll reached
31041
- this._fetchMoreSubscription = fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/)
31168
+ 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*/); }))
31042
31169
  .subscribe(function () { return _this.fetchMore(); });
31043
- this.subscriptions.add(this._fetchMoreSubscription);
31170
+ this._subscriptions.add(this._fetchMoreSubscription);
31044
31171
  return [2 /*return*/];
31045
31172
  }
31046
31173
  });
@@ -31054,9 +31181,9 @@
31054
31181
  UserEventNotificationList.decorators = [
31055
31182
  { type: i0.Component, args: [{
31056
31183
  selector: 'app-user-event-notification-list',
31057
- 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 userEvent of $items | async; last as last\"\n [lines]=\"last ? 'none' : undefined\"\n (click)=\"click($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($event, action, userEvent)\" [title]=\"action.title|translate\">\n <app-icon *ngIf=\"action.iconRef\" slot=\"start\" height=\"20\" width=\"20\" [ref]=\"action.iconRef\"></app-icon>\n {{ action.name | translate }}\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 <!-- 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",
31184
+ 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",
31058
31185
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
31059
- 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)}.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}"]
31186
+ styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-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%}"]
31060
31187
  },] }
31061
31188
  ];
31062
31189
  UserEventNotificationList.ctorParameters = function () { return [
@@ -31069,11 +31196,11 @@
31069
31196
  debug: [{ type: i0.Input }],
31070
31197
  mobile: [{ type: i0.Input }],
31071
31198
  titleI18n: [{ type: i0.Input }],
31072
- pageSize: [{ type: i0.Input }],
31073
31199
  sortBy: [{ type: i0.Input }],
31074
31200
  sortDirection: [{ type: i0.Input }],
31075
31201
  filter: [{ type: i0.Input }],
31076
31202
  enableInfiniteScroll: [{ type: i0.Input }],
31203
+ pageSize: [{ type: i0.Input }],
31077
31204
  readEvent: [{ type: i0.Output }],
31078
31205
  readEvents: [{ type: i0.Output }],
31079
31206
  ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
@@ -31121,12 +31248,12 @@
31121
31248
  // Wait service
31122
31249
  _a.sent();
31123
31250
  // Subscribe to read event
31124
- this._readEvent.subscribe(function (value) {
31251
+ this._readEvent.subscribe(function (item) {
31125
31252
  // default: mark event as read
31126
- _this.userEventService.markAsRead([value]);
31253
+ _this.userEventService.markAllAsRead([item]);
31127
31254
  });
31128
- this._readEvents.subscribe(function (value) {
31129
- _this.userEventService.markAsRead(value);
31255
+ this._readEvents.subscribe(function (items) {
31256
+ _this.userEventService.markAllAsRead(items);
31130
31257
  });
31131
31258
  return [2 /*return*/];
31132
31259
  }
@@ -31147,13 +31274,14 @@
31147
31274
  debug: this.debug,
31148
31275
  titleI18n: this.titleI18n,
31149
31276
  readEvent: this._readEvent,
31150
- readEvents: this._readEvents
31277
+ readEvents: this._readEvents,
31278
+ filter: this.filter
31151
31279
  },
31152
31280
  backdropDismiss: true,
31153
31281
  keyboardClose: true,
31154
31282
  event: event,
31155
31283
  translucent: true,
31156
- cssClass: 'popover-large'
31284
+ cssClass: 'popover-large popover-notifications'
31157
31285
  })];
31158
31286
  case 1:
31159
31287
  popover = _a.sent();
@@ -31201,7 +31329,8 @@
31201
31329
  imports: [
31202
31330
  i1$4.CommonModule,
31203
31331
  SharedModule,
31204
- AppIconModule
31332
+ AppIconModule,
31333
+ ngxJdenticon.NgxJdenticonModule
31205
31334
  ],
31206
31335
  declarations: [
31207
31336
  AppUserEventNotificationIcon,
@@ -31550,7 +31679,7 @@
31550
31679
  { type: i0.Component, args: [{
31551
31680
  selector: 'app-job-progression-list',
31552
31681
  template: "<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-row>\n\n <ion-item *ngIf=\"!jobProgressions?.length\">\n {{'SOCIAL.JOB.PROGRESSION.EMPTY' | translate}}\n </ion-item>\n <ion-item *ngFor=\"let jobProgression of jobProgressions\" class=\"ion-item-job-progression\">\n <ion-grid class=\"ion-no-margin\">\n <ion-row class=\"name\">\n <ion-col>\n {{jobProgression.name}}\n </ion-col>\n </ion-row>\n <ion-row class=\"message\">\n <ion-col>\n {{jobProgression.message}}\n </ion-col>\n </ion-row>\n <ion-row class=\"progress-bar\">\n <ion-col>\n <ion-progress-bar\n [value]=\"jobProgression.total > 0 ? jobProgression.current / jobProgression.total : undefined\"\n [type]=\"jobProgression.total > 0 ? 'determinate' : 'indeterminate'\">\n </ion-progress-bar>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-item>\n\n</ion-list>\n",
31553
- styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ion-item-job-progression{font-size:.9em}.ion-item-job-progression .message{font-style:italic}.ion-item-job-progression .progress-bar{margin-top:5px;margin-bottom:5px}"]
31682
+ styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ion-item-job-progression{font-size:.9em}.ion-item-job-progression .message{font-style:italic}.ion-item-job-progression .progress-bar{margin-top:5px;margin-bottom:5px}"]
31554
31683
  },] }
31555
31684
  ];
31556
31685
  JobProgressionList.ctorParameters = function () { return []; };
@@ -31815,118 +31944,8 @@
31815
31944
  },] }
31816
31945
  ];
31817
31946
 
31818
- var UserEvent_1;
31819
- var UserEventTypes = {
31820
- DEBUG_DATA: 'DEBUG_DATA',
31821
- INBOX_MESSAGE: 'INBOX_MESSAGE'
31822
- };
31823
- // @dynamic
31824
- exports.UserEvent = UserEvent_1 = /** @class */ (function (_super) {
31825
- __extends(UserEvent, _super);
31826
- function UserEvent() {
31827
- return _super.call(this, UserEvent_1.TYPENAME) || this;
31828
- }
31829
- UserEvent.prototype.asObject = function (opts) {
31830
- var target = _super.prototype.asObject.call(this, opts);
31831
- target.creationDate = toDateISOString(this.creationDate);
31832
- target.readDate = toDateISOString(this.readDate);
31833
- // Serialize content
31834
- if (typeof target.content === 'object') {
31835
- target.content = JSON.stringify(target.content);
31836
- }
31837
- delete target.avatar;
31838
- delete target.avatarIcon;
31839
- delete target.icon;
31840
- delete target.actions;
31841
- return target;
31842
- };
31843
- UserEvent.prototype.fromObject = function (source) {
31844
- Object.assign(this, source); // Copy all properties
31845
- _super.prototype.fromObject.call(this, source);
31846
- this.creationDate = fromDateISOString(source.creationDate);
31847
- this.readDate = fromDateISOString(source.readDate);
31848
- try {
31849
- // Deserialize content
31850
- if (typeof source.content === 'string' && source.content.startsWith('{')) {
31851
- this.content = JSON.parse(source.content);
31852
- }
31853
- // Deserialize content.context
31854
- if (this.content && typeof this.content.context === 'string' && this.content.context.startsWith('{')) {
31855
- this.content.context = JSON.parse(this.content.context);
31856
- }
31857
- }
31858
- catch (err) {
31859
- console.error('Error during UserEvent deserialization', err);
31860
- }
31861
- };
31862
- return UserEvent;
31863
- }(Entity));
31864
- exports.UserEvent = UserEvent_1 = __decorate([
31865
- EntityClass({ typename: 'UserEventVO' })
31866
- ], exports.UserEvent);
31867
- // @dynamic
31868
- exports.UserEventFilter = /** @class */ (function (_super) {
31869
- __extends(UserEventFilter, _super);
31870
- function UserEventFilter() {
31871
- var _this = _super.apply(this, __spread(arguments)) || this;
31872
- _this.types = [];
31873
- _this.levels = [];
31874
- _this.issuers = [];
31875
- _this.recipients = [];
31876
- _this.startDate = null;
31877
- _this.excludeRead = false;
31878
- return _this;
31879
- }
31880
- UserEventFilter.prototype.fromObject = function (source, opts) {
31881
- _super.prototype.fromObject.call(this, source, opts);
31882
- this.types = source.types || [];
31883
- this.levels = source.levels || [];
31884
- this.issuers = source.issuers || [];
31885
- this.recipients = source.recipients || [];
31886
- this.startDate = fromDateISOString(source.startDate);
31887
- this.excludeRead = source.excludeRead || false;
31888
- };
31889
- UserEventFilter.prototype.buildFilter = function () {
31890
- var _this = this;
31891
- var filterFns = _super.prototype.buildFilter.call(this);
31892
- if (isNotEmptyArray(this.types)) {
31893
- filterFns.push(function (t) { return _this.types.includes(t.type); });
31894
- }
31895
- if (isNotEmptyArray(this.levels)) {
31896
- filterFns.push(function (t) { return _this.levels.includes(t.level); });
31897
- }
31898
- if (isNotEmptyArray(this.issuers)) {
31899
- filterFns.push(function (t) { return _this.issuers.includes(t.issuer); });
31900
- }
31901
- if (isNotEmptyArray(this.recipients)) {
31902
- filterFns.push(function (t) { return _this.recipients.includes(t.recipient); });
31903
- }
31904
- if (isNotNil(this.startDate)) {
31905
- filterFns.push(function (t) { return _this.startDate.isSameOrBefore(t.creationDate); });
31906
- }
31907
- if (this.excludeRead === true) {
31908
- filterFns.push(function (t) { return isNil(t.readSignature); }); // todo or t.signature ?
31909
- }
31910
- return filterFns;
31911
- };
31912
- UserEventFilter.prototype.asObject = function (opts) {
31913
- var target = _super.prototype.asObject.call(this, opts);
31914
- return target;
31915
- };
31916
- return UserEventFilter;
31917
- }(EntityFilter));
31918
- exports.UserEventFilter = __decorate([
31919
- EntityClass({ typename: 'UserEventFilterVO' })
31920
- ], exports.UserEventFilter);
31921
-
31922
- var UserEventFragments = {
31923
- 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 }"]))),
31924
- 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 }"])))
31925
- };
31926
- var templateObject_1$3, templateObject_2$2;
31927
-
31928
31947
  var Mutations = {
31929
- 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 }"])))
31948
+ 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 }"])))
31930
31949
  };
31931
31950
  var MessageService = /** @class */ (function (_super) {
31932
31951
  __extends(MessageService, _super);
@@ -32010,7 +32029,7 @@
32010
32029
  { type: i1$5.ToastController },
32011
32030
  { type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
32012
32031
  ]; };
32013
- var templateObject_1$4;
32032
+ var templateObject_1$3;
32014
32033
 
32015
32034
  var PersonFilter_1;
32016
32035
  // @dynamic
@@ -32069,11 +32088,11 @@
32069
32088
  ], exports.PersonFilter);
32070
32089
 
32071
32090
  var PersonFragments = {
32072
- 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 }"])))
32091
+ 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 }"])))
32073
32092
  };
32074
32093
  // Load persons query
32075
32094
  var PersonQueries = {
32076
- 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),
32095
+ 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),
32077
32096
  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)
32078
32097
  };
32079
32098
  var PersonMutations = {
@@ -32209,7 +32228,7 @@
32209
32228
  { type: NetworkService },
32210
32229
  { type: EntitiesStorage }
32211
32230
  ]; };
32212
- var templateObject_1$5, templateObject_2$3, templateObject_3$2, templateObject_4$2, templateObject_5$2;
32231
+ var templateObject_1$4, templateObject_2$2, templateObject_3$2, templateObject_4$2, templateObject_5$2;
32213
32232
 
32214
32233
  var PersonValidatorService = /** @class */ (function () {
32215
32234
  function PersonValidatorService(formBuilder, accountValidatorService) {
@@ -32275,7 +32294,6 @@
32275
32294
  _this.statusById = StatusById;
32276
32295
  _this.filterCriteriaCount = 0;
32277
32296
  _this.useSticky = false;
32278
- _this.referentialToString = referentialToString;
32279
32297
  _this.canEdit = accountService.isAdmin();
32280
32298
  _this.canSendMessage = _this.canEdit;
32281
32299
  _this.inlineEdition = _this.canEdit;
@@ -34148,6 +34166,106 @@
34148
34166
  },] }
34149
34167
  ];
34150
34168
 
34169
+ var UserEventTest_1;
34170
+ // @dynamic
34171
+ var UserEventTest = UserEventTest_1 = /** @class */ (function (_super) {
34172
+ __extends(UserEventTest, _super);
34173
+ function UserEventTest() {
34174
+ return _super.call(this, UserEventTest_1.TYPENAME) || this;
34175
+ }
34176
+ UserEventTest.prototype.asObject = function (opts) {
34177
+ var target = _super.prototype.asObject.call(this, opts);
34178
+ target.creationDate = toDateISOString(this.creationDate);
34179
+ target.readDate = toDateISOString(this.readDate);
34180
+ // Serialize content
34181
+ if (typeof target.content === 'object') {
34182
+ target.content = JSON.stringify(target.content);
34183
+ }
34184
+ delete target.avatar;
34185
+ delete target.avatarIcon;
34186
+ delete target.icon;
34187
+ delete target.actions;
34188
+ return target;
34189
+ };
34190
+ UserEventTest.prototype.fromObject = function (source) {
34191
+ Object.assign(this, source); // Copy all properties
34192
+ _super.prototype.fromObject.call(this, source);
34193
+ this.creationDate = fromDateISOString(source.creationDate);
34194
+ this.readDate = fromDateISOString(source.readDate);
34195
+ try {
34196
+ // Deserialize content
34197
+ if (typeof source.content === 'string' && source.content.startsWith('{')) {
34198
+ this.content = JSON.parse(source.content);
34199
+ }
34200
+ // Deserialize content.context
34201
+ if (this.content && typeof this.content.context === 'string' && this.content.context.startsWith('{')) {
34202
+ this.content.context = JSON.parse(this.content.context);
34203
+ }
34204
+ }
34205
+ catch (err) {
34206
+ console.error('Error during UserEvent deserialization', err);
34207
+ }
34208
+ };
34209
+ return UserEventTest;
34210
+ }(Entity));
34211
+ UserEventTest = UserEventTest_1 = __decorate([
34212
+ EntityClass({ typename: 'UserEventTestVO' })
34213
+ ], UserEventTest);
34214
+ // @dynamic
34215
+ var UserEventTestFilter = /** @class */ (function (_super) {
34216
+ __extends(UserEventTestFilter, _super);
34217
+ function UserEventTestFilter() {
34218
+ var _this = _super.apply(this, __spread(arguments)) || this;
34219
+ _this.types = [];
34220
+ _this.levels = [];
34221
+ _this.issuers = [];
34222
+ _this.recipients = [];
34223
+ _this.startDate = null;
34224
+ _this.excludeRead = false;
34225
+ return _this;
34226
+ }
34227
+ UserEventTestFilter.prototype.fromObject = function (source, opts) {
34228
+ _super.prototype.fromObject.call(this, source, opts);
34229
+ this.types = source.types || [];
34230
+ this.levels = source.levels || [];
34231
+ this.issuers = source.issuers || [];
34232
+ this.recipients = source.recipients || [];
34233
+ this.startDate = fromDateISOString(source.startDate);
34234
+ this.excludeRead = source.excludeRead || false;
34235
+ };
34236
+ UserEventTestFilter.prototype.buildFilter = function () {
34237
+ var _this = this;
34238
+ var filterFns = _super.prototype.buildFilter.call(this);
34239
+ if (isNotEmptyArray(this.types)) {
34240
+ filterFns.push(function (t) { return _this.types.includes(t.type); });
34241
+ }
34242
+ if (isNotEmptyArray(this.levels)) {
34243
+ filterFns.push(function (t) { return _this.levels.includes(t.level); });
34244
+ }
34245
+ if (isNotEmptyArray(this.issuers)) {
34246
+ filterFns.push(function (t) { return _this.issuers.includes(t.issuer); });
34247
+ }
34248
+ if (isNotEmptyArray(this.recipients)) {
34249
+ filterFns.push(function (t) { return _this.recipients.includes(t.recipient); });
34250
+ }
34251
+ if (isNotNil(this.startDate)) {
34252
+ filterFns.push(function (t) { return _this.startDate.isSameOrBefore(t.creationDate); });
34253
+ }
34254
+ if (this.excludeRead === true) {
34255
+ filterFns.push(function (t) { return isNil(t.readSignature); }); // todo or t.signature ?
34256
+ }
34257
+ return filterFns;
34258
+ };
34259
+ UserEventTestFilter.prototype.asObject = function (opts) {
34260
+ var target = _super.prototype.asObject.call(this, opts);
34261
+ return target;
34262
+ };
34263
+ return UserEventTestFilter;
34264
+ }(EntityFilter));
34265
+ UserEventTestFilter = __decorate([
34266
+ EntityClass({ typename: 'UserEventTestFilterVO' })
34267
+ ], UserEventTestFilter);
34268
+
34151
34269
  var UserEventTestService = /** @class */ (function (_super) {
34152
34270
  __extends(UserEventTestService, _super);
34153
34271
  function UserEventTestService(graphql, accountService, network, translate, environment) {
@@ -34163,25 +34281,38 @@
34163
34281
  _this.network = network;
34164
34282
  _this.translate = translate;
34165
34283
  _this.environment = environment;
34166
- _this.userEvents = [];
34284
+ _this.$userEvents = new rxjs.BehaviorSubject([]);
34285
+ _this.$newUserEvents = new rxjs.Subject();
34167
34286
  return _this;
34168
34287
  }
34169
34288
  UserEventTestService.prototype.fromObject = function (source) {
34170
- return exports.UserEvent.fromObject(source);
34289
+ return UserEventTest.fromObject(source);
34171
34290
  };
34172
34291
  UserEventTestService.prototype.add = function (entity) {
34173
- entity = this.processUserEvent(entity);
34174
- entity.id = this.userEvents.length + 1;
34175
- this.userEvents = __spread([
34176
- entity
34177
- ], this.userEvents);
34178
- this._countSubject.next((this._countSubject.value || 0) + 1);
34292
+ var _a;
34293
+ return __awaiter(this, void 0, void 0, function () {
34294
+ return __generator(this, function (_b) {
34295
+ switch (_b.label) {
34296
+ case 0: return [4 /*yield*/, this.processUserEvent(entity)];
34297
+ case 1:
34298
+ entity = _b.sent();
34299
+ entity.id = (((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0) + 1;
34300
+ this.$userEvents.next(__spread([
34301
+ entity
34302
+ ], this.$userEvents.value));
34303
+ this._countSubject.next((this._countSubject.value || 0) + 1);
34304
+ this.$newUserEvents.next([entity]);
34305
+ return [2 /*return*/];
34306
+ }
34307
+ });
34308
+ });
34179
34309
  };
34180
34310
  UserEventTestService.prototype.asFilter = function (filter) {
34181
34311
  return filter;
34182
34312
  };
34183
34313
  UserEventTestService.prototype.count = function (filter, options) {
34184
- return Promise.resolve(this.userEvents.length);
34314
+ var _a;
34315
+ return Promise.resolve(((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0);
34185
34316
  };
34186
34317
  UserEventTestService.prototype.delete = function (entity) {
34187
34318
  return Promise.resolve(undefined);
@@ -34189,12 +34320,12 @@
34189
34320
  UserEventTestService.prototype.deleteAll = function (data, opts) {
34190
34321
  return Promise.resolve(undefined);
34191
34322
  };
34192
- UserEventTestService.prototype.listenChanges = function (filter, options) {
34193
- return rxjs.of();
34323
+ UserEventTestService.prototype.listenAllChanges = function (filter, options) {
34324
+ return this.$newUserEvents.asObservable();
34194
34325
  };
34195
34326
  UserEventTestService.prototype.save = function (entity, options) {
34196
34327
  var _a;
34197
- 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); });
34328
+ 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); });
34198
34329
  Object.assign(toSave, entity);
34199
34330
  return entity;
34200
34331
  };
@@ -34229,31 +34360,33 @@
34229
34360
  }
34230
34361
  finally { if (e_1) throw e_1.error; }
34231
34362
  return [7 /*endfinally*/];
34232
- case 7: return [2 /*return*/, Promise.resolve(this.userEvents)];
34363
+ case 7: return [2 /*return*/, this.$userEvents.toPromise()];
34233
34364
  }
34234
34365
  });
34235
34366
  });
34236
34367
  };
34237
34368
  UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34238
34369
  var _this = this;
34239
- var _a;
34240
- var data = (this.userEvents || []).slice(offset || 0, offset + size);
34241
- var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
34242
- var res = { data: data, total: total };
34243
- // Must re-order because of listenChanges result will add new event at the end
34244
- data = EntityUtils.sort(data, sortBy, sortDirection);
34245
- // Add fetch more
34246
- var nextOffset = offset + data.length;
34247
- if (nextOffset < res.total) {
34248
- res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
34249
- }
34250
- return rxjs.of(res);
34370
+ return this.$userEvents.pipe(operators.map(function (userEvents) {
34371
+ var _a;
34372
+ var data = (userEvents || []).slice(offset || 0, offset + size);
34373
+ var total = ((_a = _this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0;
34374
+ var res = { data: data, total: total };
34375
+ // Must re-order because of listenChanges result will add new event at the end
34376
+ data = EntityUtils.sort(data, sortBy, sortDirection);
34377
+ // Add fetch more
34378
+ var nextOffset = offset + data.length;
34379
+ if (nextOffset < res.total) {
34380
+ res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
34381
+ }
34382
+ return res;
34383
+ }));
34251
34384
  };
34252
34385
  UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34253
34386
  var _this = this;
34254
34387
  var _a;
34255
- var data = (this.userEvents || []).slice(offset || 0, offset + size);
34256
- var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
34388
+ var data = (this.$userEvents.value || []).slice(offset || 0, offset + size);
34389
+ var total = ((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0;
34257
34390
  var res = { data: data, total: total };
34258
34391
  // Must re-order because of listenChanges result will add new event at the end
34259
34392
  data = EntityUtils.sort(data, sortBy, sortDirection);
@@ -34297,6 +34430,16 @@
34297
34430
  onRead: function (userEvent) { _this.showMessage("debug message read "); }
34298
34431
  });
34299
34432
  }
34433
+ Object.defineProperty(UserEventTestingPage.prototype, "timerStarted", {
34434
+ get: function () {
34435
+ return !!this._timerSubscription;
34436
+ },
34437
+ enumerable: false,
34438
+ configurable: true
34439
+ });
34440
+ UserEventTestingPage.prototype.ngOnDestroy = function () {
34441
+ this.stopTimer();
34442
+ };
34300
34443
  UserEventTestingPage.prototype.customize = function (userEvent) {
34301
34444
  // Choose avatarIcon
34302
34445
  switch (userEvent.level) {
@@ -34327,7 +34470,7 @@
34327
34470
  }
34328
34471
  };
34329
34472
  UserEventTestingPage.prototype.addNotification = function () {
34330
- this.userEventService.add(exports.UserEvent.fromObject({
34473
+ this.userEventService.add(UserEventTest.fromObject({
34331
34474
  issuer: 'system',
34332
34475
  recipient: 'me',
34333
34476
  type: 'message',
@@ -34337,7 +34480,7 @@
34337
34480
  }));
34338
34481
  };
34339
34482
  UserEventTestingPage.prototype.addError = function () {
34340
- this.userEventService.add(exports.UserEvent.fromObject({
34483
+ this.userEventService.add(UserEventTest.fromObject({
34341
34484
  issuer: 'system',
34342
34485
  recipient: 'me',
34343
34486
  type: 'upload',
@@ -34347,7 +34490,7 @@
34347
34490
  }));
34348
34491
  };
34349
34492
  UserEventTestingPage.prototype.addWarning = function () {
34350
- this.userEventService.add(exports.UserEvent.fromObject({
34493
+ this.userEventService.add(UserEventTest.fromObject({
34351
34494
  issuer: 'system',
34352
34495
  recipient: 'me',
34353
34496
  type: 'download',
@@ -34357,7 +34500,7 @@
34357
34500
  }));
34358
34501
  };
34359
34502
  UserEventTestingPage.prototype.addDebug = function () {
34360
- this.userEventService.add(exports.UserEvent.fromObject({
34503
+ this.userEventService.add(UserEventTest.fromObject({
34361
34504
  issuer: 'system',
34362
34505
  recipient: 'me',
34363
34506
  type: 'debug',
@@ -34368,7 +34511,7 @@
34368
34511
  };
34369
34512
  UserEventTestingPage.prototype.addNotificationWithLink = function () {
34370
34513
  var _this = this;
34371
- this.userEventService.add(exports.UserEvent.fromObject({
34514
+ this.userEventService.add(UserEventTest.fromObject({
34372
34515
  issuer: 'system',
34373
34516
  recipient: 'me',
34374
34517
  type: 'message',
@@ -34386,7 +34529,7 @@
34386
34529
  };
34387
34530
  UserEventTestingPage.prototype.addNotificationWithAction = function () {
34388
34531
  var _this = this;
34389
- this.userEventService.add(exports.UserEvent.fromObject({
34532
+ this.userEventService.add(UserEventTest.fromObject({
34390
34533
  issuer: 'system',
34391
34534
  recipient: 'me',
34392
34535
  type: 'message',
@@ -34413,6 +34556,69 @@
34413
34556
  ]
34414
34557
  }));
34415
34558
  };
34559
+ UserEventTestingPage.prototype.addMany = function (count) {
34560
+ count = count || 20;
34561
+ for (var i = 0; i < count; i++) {
34562
+ this.addRandom(i);
34563
+ }
34564
+ };
34565
+ UserEventTestingPage.prototype.startTimer = function (period) {
34566
+ var _this = this;
34567
+ var _a;
34568
+ (_a = this._timerSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
34569
+ period = period || 1000;
34570
+ var counter = 0;
34571
+ this._timerSubscription = rxjs.timer(period, period)
34572
+ .subscribe(function () {
34573
+ _this.addRandom(counter);
34574
+ counter++;
34575
+ });
34576
+ };
34577
+ UserEventTestingPage.prototype.stopTimer = function () {
34578
+ var _a;
34579
+ (_a = this._timerSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
34580
+ this._timerSubscription = null;
34581
+ };
34582
+ UserEventTestingPage.prototype.addRandom = function (value) {
34583
+ switch (value % 6) {
34584
+ case 0:
34585
+ this.addNotification();
34586
+ break;
34587
+ case 1:
34588
+ this.addError();
34589
+ break;
34590
+ case 2:
34591
+ this.addDebug();
34592
+ break;
34593
+ case 3:
34594
+ this.addNotificationWithLink();
34595
+ break;
34596
+ case 4:
34597
+ this.addNotificationWithAction();
34598
+ break;
34599
+ case 5:
34600
+ this.addNotificationWithDefaultAction();
34601
+ break;
34602
+ }
34603
+ };
34604
+ UserEventTestingPage.prototype.addNotificationWithDefaultAction = function () {
34605
+ var _this = this;
34606
+ this.userEventService.add(UserEventTest.fromObject({
34607
+ issuer: 'system',
34608
+ recipient: 'me',
34609
+ type: 'message',
34610
+ level: 'INFO',
34611
+ message: 'message with action',
34612
+ creationDate: moment$a(),
34613
+ actions: [
34614
+ {
34615
+ default: true,
34616
+ name: 'default',
34617
+ executeAction: function (event) { _this.showMessage('default action'); }
34618
+ }
34619
+ ]
34620
+ }));
34621
+ };
34416
34622
  UserEventTestingPage.prototype.showMessage = function (text) {
34417
34623
  return Alerts.showError(text, this.alertController, this.translateService);
34418
34624
  };
@@ -34421,7 +34627,7 @@
34421
34627
  UserEventTestingPage.decorators = [
34422
34628
  { type: i0.Component, args: [{
34423
34629
  selector: 'job-progression-testing',
34424
- 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 </p>\n</ion-content>\n"
34630
+ 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"
34425
34631
  },] }
34426
34632
  ];
34427
34633
  UserEventTestingPage.ctorParameters = function () { return [
@@ -34634,6 +34840,8 @@
34634
34840
  exports.HomePage = HomePage;
34635
34841
  exports.Hotkeys = Hotkeys;
34636
34842
  exports.HotkeysDialogComponent = HotkeysDialogComponent;
34843
+ exports.IMAGE_DEFAULTS = IMAGE_DEFAULTS;
34844
+ exports.ImagesUtils = ImagesUtils;
34637
34845
  exports.InMemoryEntitiesService = InMemoryEntitiesService;
34638
34846
  exports.IsLoginAccountPipe = IsLoginAccountPipe;
34639
34847
  exports.IsNilOrBlankPipe = IsNilOrBlankPipe;
@@ -34785,12 +34993,10 @@
34785
34993
  exports.UploadFileTestingModule = UploadFileTestingModule;
34786
34994
  exports.UploadFileTestingPage = UploadFileTestingPage;
34787
34995
  exports.UriUtils = UriUtils;
34788
- exports.UserEventFragments = UserEventFragments;
34789
34996
  exports.UserEventModule = UserEventModule;
34790
34997
  exports.UserEventTestService = UserEventTestService;
34791
34998
  exports.UserEventTestingModule = UserEventTestingModule;
34792
34999
  exports.UserEventTestingPage = UserEventTestingPage;
34793
- exports.UserEventTypes = UserEventTypes;
34794
35000
  exports.UsersPage = UsersPage;
34795
35001
  exports.accountToString = accountToString;
34796
35002
  exports.adaptValueToControl = adaptValueToControl;