@sumaris-net/ngx-components 1.21.0-beta1 → 1.21.0-beta10

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 (29) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +90 -53
  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 +5 -2
  6. package/esm2015/src/app/core/menu/menu.component.js +2 -2
  7. package/esm2015/src/app/social/job/job.service.js +1 -2
  8. package/esm2015/src/app/social/job/progression/job-progression.component.js +34 -13
  9. package/esm2015/src/app/social/job/progression/job-progression.list.js +2 -2
  10. package/esm2015/src/app/social/social.module.js +3 -2
  11. package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +20 -9
  12. package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +2 -2
  13. package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
  14. package/esm2015/src/app/social/user-event/user-event.service.js +22 -19
  15. package/esm2015/sumaris-net.ngx-components.js +8 -11
  16. package/fesm2015/sumaris-net.ngx-components.js +74 -40
  17. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  18. package/package.json +1 -1
  19. package/public_api.d.ts +4 -1
  20. package/src/app/social/job/progression/job-progression.component.d.ts +12 -3
  21. package/src/app/social/social.module.d.ts +8 -0
  22. package/src/app/social/user-event/notification/user-event-notification.component.d.ts +0 -1
  23. package/src/app/social/user-event/user-event.model.d.ts +1 -1
  24. package/src/app/social/user-event/user-event.service.d.ts +3 -4
  25. package/src/assets/i18n/en-US.json +9 -3
  26. package/src/assets/i18n/en.json +9 -3
  27. package/src/assets/i18n/fr.json +9 -3
  28. package/sumaris-net.ngx-components.d.ts +7 -10
  29. package/sumaris-net.ngx-components.metadata.json +1 -1
@@ -24749,7 +24749,7 @@
24749
24749
  MenuComponent.decorators = [
24750
24750
  { type: i0.Component, args: [{
24751
24751
  selector: 'app-menu',
24752
- template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" contentId=\"menu-content\">\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 </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\" width=\"108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\">\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\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",
24752
+ template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" contentId=\"menu-content\">\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 </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\" width=\"108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\">\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\n<!-- todo ajouter ici les 2 composants du module social -->\n\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",
24753
24753
  animations: [fadeInAnimation],
24754
24754
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
24755
24755
  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-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)}}"]
@@ -30172,13 +30172,12 @@
30172
30172
  var UserEventServiceToken = new i0.InjectionToken('UserEventService');
30173
30173
  var AbstractUserEventService = /** @class */ (function (_super) {
30174
30174
  __extends(AbstractUserEventService, _super);
30175
- function AbstractUserEventService(graphql, accountService, network, translate, toastController, queries, mutations, subscriptions, environment) {
30175
+ function AbstractUserEventService(graphql, accountService, network, translate, queries, mutations, subscriptions, environment) {
30176
30176
  var _this = _super.call(this, graphql, environment) || this;
30177
30177
  _this.graphql = graphql;
30178
30178
  _this.accountService = accountService;
30179
30179
  _this.network = network;
30180
30180
  _this.translate = translate;
30181
- _this.toastController = toastController;
30182
30181
  _this.queries = queries;
30183
30182
  _this.mutations = mutations;
30184
30183
  _this.subscriptions = subscriptions;
@@ -30194,7 +30193,7 @@
30194
30193
  var count;
30195
30194
  return __generator(this, function (_b) {
30196
30195
  switch (_b.label) {
30197
- case 0: return [4 /*yield*/, this.count(this.defaultFilter())];
30196
+ case 0: return [4 /*yield*/, this.count(undefined)];
30198
30197
  case 1:
30199
30198
  count = _b.sent();
30200
30199
  if (count && this._debug) {
@@ -30224,13 +30223,15 @@
30224
30223
  var _this = this;
30225
30224
  var _a;
30226
30225
  var now = this._debug && Date.now();
30227
- //if (this._debug)
30226
+ if (!filter) {
30227
+ filter = this.defaultFilter();
30228
+ }
30228
30229
  console.debug(this._logPrefix + "Loading user events...", filter);
30229
30230
  filter = this.asFilter(filter);
30230
30231
  // Force recipient to current issuer, if not admin and not specified
30231
- if (isEmptyArray(filter.recipients) || !this.accountService.isAdmin()) {
30232
+ if (isEmptyArray(filter === null || filter === void 0 ? void 0 : filter.recipients) || !this.accountService.isAdmin()) {
30232
30233
  var recipient = this.defaultRecipient();
30233
- if (!((_a = filter.recipients) === null || _a === void 0 ? void 0 : _a.includes(recipient))) {
30234
+ if (!((_a = filter === null || filter === void 0 ? void 0 : filter.recipients) === null || _a === void 0 ? void 0 : _a.includes(recipient))) {
30234
30235
  console.warn('[user-events-service] Force user event filter.recipient=' + recipient);
30235
30236
  filter.recipients = [recipient];
30236
30237
  }
@@ -30240,7 +30241,10 @@
30240
30241
  queryName: withContent ? 'LoadAllWithContent' : 'LoadAll',
30241
30242
  query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30242
30243
  variables: {
30243
- page: Object.assign({ sortBy: 'updateDate', sortDirection: 'desc' }, page),
30244
+ page: Object.assign(Object.assign({ sortBy: 'creationDate' }, page), {
30245
+ // @ts-ignore
30246
+ sortDirection: (page.sortDirection || 'desc').toUpperCase()
30247
+ }),
30244
30248
  filter: filter && filter.asPodObject()
30245
30249
  },
30246
30250
  arrayFieldName: 'data',
@@ -30248,7 +30252,7 @@
30248
30252
  fetchPolicy: (options === null || options === void 0 ? void 0 : options.fetchPolicy) || "cache-first"
30249
30253
  })
30250
30254
  .pipe(operators.map(function (res) {
30251
- var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(_this.processUserEvent);
30255
+ var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
30252
30256
  if (now) {
30253
30257
  console.debug("" + _this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
30254
30258
  now = null;
@@ -30284,7 +30288,7 @@
30284
30288
  return [2 /*return*/, undefined];
30285
30289
  }
30286
30290
  if (!filter)
30287
- throw new Error("Missing argument 'filter'");
30291
+ filter = this.defaultFilter();
30288
30292
  filter = this.asFilter(filter);
30289
30293
  if (this._debug)
30290
30294
  console.debug(this._logPrefix + "Counting user events with filter:", filter);
@@ -30311,7 +30315,7 @@
30311
30315
  return rxjs.of();
30312
30316
  }
30313
30317
  if (!filter)
30314
- throw new Error("Missing argument 'filter'");
30318
+ filter = this.defaultFilter();
30315
30319
  filter = this.asFilter(filter);
30316
30320
  var withContent = (options === null || options === void 0 ? void 0 : options.withContent) === true;
30317
30321
  if (this._debug)
@@ -30328,7 +30332,7 @@
30328
30332
  var data = _b.data;
30329
30333
  if (data && _this._debug)
30330
30334
  console.debug(_this._logPrefix + "Received new user events:", data);
30331
- var updatedData = data === null || data === void 0 ? void 0 : data.map(_this.processUserEvent);
30335
+ var updatedData = data === null || data === void 0 ? void 0 : data.map(function (value) { return _this.processUserEvent(value, _this); });
30332
30336
  // Update cache
30333
30337
  _this.insertIntoMutableCachedQueries(_this.graphql.cache, {
30334
30338
  query: withContent ? _this.queries.loadAllWithContent : _this.queries.loadAll,
@@ -30501,12 +30505,13 @@
30501
30505
  this.listeners.push(listener);
30502
30506
  };
30503
30507
  /* -- protected methods -- */
30504
- AbstractUserEventService.prototype.processUserEvent = function (source) {
30508
+ AbstractUserEventService.prototype.processUserEvent = function (source, that) {
30505
30509
  var e_2, _b;
30510
+ that = that || this;
30506
30511
  // Convert json source to IUserEvent
30507
- var target = this.fromObject(source);
30512
+ var target = that.fromObject(source);
30508
30513
  // Get listeners
30509
- var listeners = (this.listeners || []).filter(function (listener) { return listener.onReceived; }).filter(function (listener) { return listener.accept(target); });
30514
+ var listeners = (that.listeners || []).filter(function (listener) { return listener.onReceived; }).filter(function (listener) { return listener.accept(target); });
30510
30515
  try {
30511
30516
  for (var listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next(); !listeners_1_1.done; listeners_1_1 = listeners_1.next()) {
30512
30517
  var listener = listeners_1_1.value;
@@ -30514,8 +30519,8 @@
30514
30519
  target = listener.onReceived(target);
30515
30520
  }
30516
30521
  else {
30517
- if (this._debug)
30518
- console.debug(this._logPrefix + "Event has been rejected by a listener", source);
30522
+ if (that._debug)
30523
+ console.debug(that._logPrefix + "Event has been rejected by a listener", source);
30519
30524
  break;
30520
30525
  }
30521
30526
  }
@@ -30585,7 +30590,6 @@
30585
30590
  { type: AccountService },
30586
30591
  { type: NetworkService },
30587
30592
  { type: i1$2.TranslateService },
30588
- { type: i1$5.ToastController },
30589
30593
  { type: undefined },
30590
30594
  { type: undefined },
30591
30595
  { type: undefined },
@@ -30602,7 +30606,7 @@
30602
30606
  var UserEventService = /** @class */ (function (_super) {
30603
30607
  __extends(UserEventService, _super);
30604
30608
  function UserEventService(graphql, accountService, network, translate, toastController, environment) {
30605
- var _this = _super.call(this, graphql, accountService, network, translate, toastController, userEventQueries, userEventMutations, undefined, environment) || this;
30609
+ var _this = _super.call(this, graphql, accountService, network, translate, userEventQueries, userEventMutations, undefined, environment) || this;
30606
30610
  _this.graphql = graphql;
30607
30611
  _this.accountService = accountService;
30608
30612
  _this.network = network;
@@ -30949,7 +30953,7 @@
30949
30953
  UserEventNotificationList.decorators = [
30950
30954
  { type: i0.Component, args: [{
30951
30955
  selector: 'app-user-event-notification-list',
30952
- template: "\n<ion-list class=\"ion-list-popover\">\n\n <ion-row class=\"ion-list-header column\">\n <ion-col>\n <ion-label>{{titleI18n | translate}}</ion-label>\n </ion-col>\n </ion-row>\n\n <ion-item *ngIf=\"!(userEvents | async)?.length\">\n {{'COMMON.NO_RESULT' | translate}}\n </ion-item>\n <ion-item\n *ngFor=\"let userEvent of userEvents | async\"\n (click)=\"read($event, userEvent)\"\n >\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"userEvent.avatar; else avatarIcon\" src=\"{{ userEvent.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"userEvent.avatarIcon\"\n [ref]=\"userEvent.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n </ion-avatar>\n\n <ion-grid class=\"ion-no-margin ion-no-padding\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\">\n {{userEvent.message}}\n </p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <p>\n <span *ngFor=\"let action of userEvent.actions\">\n <a\n [style.margin-right.px]=\"8\"\n [style.cursor]=\"'pointer'\"\n (click)=\"executeAction(action, userEvent)\"\n >\n {{ '&#10142;&nbsp;' + action.name}}\n </a>\n </span>\n </p>\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'\"\n ></app-icon>\n <small>\n <span>{{userEvent.creationDate|dateFromNow}}</span>\n <span [style.color]=\"'gray'\">{{ ' | ' + (userEvent.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-item>\n\n</ion-list>\n",
30956
+ template: "\n<ion-list class=\"ion-list-popover\">\n\n <ion-row class=\"ion-list-header column\">\n <ion-col>\n <ion-label>{{titleI18n | translate}}</ion-label>\n </ion-col>\n </ion-row>\n\n <ion-item *ngIf=\"!(userEvents | async)?.length\">\n {{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}\n </ion-item>\n <ion-item\n *ngFor=\"let userEvent of userEvents | async\"\n (click)=\"read($event, userEvent)\"\n >\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"userEvent.avatar; else avatarIcon\" src=\"{{ userEvent.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"userEvent.avatarIcon\"\n [ref]=\"userEvent.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n </ion-avatar>\n\n <ion-grid class=\"ion-no-margin ion-no-padding\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\">\n {{userEvent.message}}\n </p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <p>\n <span *ngFor=\"let action of userEvent.actions\">\n <a\n [style.margin-right.px]=\"8\"\n [style.cursor]=\"'pointer'\"\n (click)=\"executeAction(action, userEvent)\"\n >\n {{ '&#10142;&nbsp;' + action.name}}\n </a>\n </span>\n </p>\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'\"\n ></app-icon>\n <small>\n <span>{{userEvent.creationDate|dateFromNow}}</span>\n <span [style.color]=\"'gray'\">{{ ' | ' + (userEvent.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-item>\n\n</ion-list>\n",
30953
30957
  styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none}.unread{font-weight:700}"]
30954
30958
  },] }
30955
30959
  ];
@@ -30969,7 +30973,7 @@
30969
30973
  this.popoverController = popoverController;
30970
30974
  this.cd = cd;
30971
30975
  this.debug = false;
30972
- this.titleI18n = 'SOCIAL.USER_EVENT.TITLE';
30976
+ this.titleI18n = 'SOCIAL.USER_EVENT.NOTIFICATION.TITLE';
30973
30977
  this.disabled = false;
30974
30978
  this.userEventsSubject = new rxjs.BehaviorSubject(undefined);
30975
30979
  this._subscriptions = new rxjs.Subscription();
@@ -30978,23 +30982,33 @@
30978
30982
  }
30979
30983
  Object.defineProperty(UserEventNotificationComponent.prototype, "count", {
30980
30984
  get: function () {
30981
- return this.userEventService.userEventCount.pipe(operators.map(function (value) { return value === 0 ? undefined : value; }));
30985
+ var _a;
30986
+ return (_a = this.userEventService) === null || _a === void 0 ? void 0 : _a.userEventCount.pipe(operators.map(function (value) { return value === 0 ? undefined : value; }));
30982
30987
  },
30983
30988
  enumerable: false,
30984
30989
  configurable: true
30985
30990
  });
30986
30991
  UserEventNotificationComponent.prototype.ngOnInit = function () {
30987
30992
  var _this = this;
30988
- var _a;
30989
- this._subscriptions.add(this.userEventService.watchAll(0, 10, 'creationDate', "desc", {
30990
- recipients: [(_a = this.accountService.person) === null || _a === void 0 ? void 0 : _a.pubkey]
30991
- }).subscribe(function (value) {
30993
+ if (isNil(this.userEventService)) {
30994
+ console.warn(this._logPrefix + "No service injected");
30995
+ this.disabled = true;
30996
+ return;
30997
+ }
30998
+ // Watch first
30999
+ this._subscriptions.add(this.userEventService.watchAll(0, 10, 'creationDate', 'desc').subscribe(function (value) {
30992
31000
  var data = value.data;
30993
31001
  if (_this.debug) {
30994
31002
  console.debug(_this._logPrefix + "Receiving user events", data);
30995
31003
  }
30996
31004
  _this.userEventsSubject.next(data);
30997
31005
  }));
31006
+ // Then listen changes
31007
+ this._subscriptions.add(this.userEventService.listenChanges(undefined).subscribe(function (data) {
31008
+ if (_this.debug) {
31009
+ console.debug(_this._logPrefix + "Receiving new user events", data);
31010
+ }
31011
+ }));
30998
31012
  this._readEvent.subscribe(function (value) {
30999
31013
  _this.userEventService.markAsRead(value);
31000
31014
  });
@@ -31047,7 +31061,7 @@
31047
31061
  },] }
31048
31062
  ];
31049
31063
  UserEventNotificationComponent.ctorParameters = function () { return [
31050
- { type: undefined, decorators: [{ type: i0.Inject, args: [UserEventServiceToken,] }] },
31064
+ { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [UserEventServiceToken,] }] },
31051
31065
  { type: AccountService },
31052
31066
  { type: i1$5.PopoverController },
31053
31067
  { type: i0.ChangeDetectorRef }
@@ -31363,7 +31377,7 @@
31363
31377
  ], exports.JobProgression);
31364
31378
 
31365
31379
  var JobProgressionServiceToken = new i0.InjectionToken('JobProgressionService');
31366
- var jobProgressionSubscription = core.gql(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["subscription UpdateJobProgression($id: Int!, $interval: Int){\n data: updateJobProgression(id: $id, interval: $interval) {\n id\n message\n current\n total\n updateDate\n }\n}"], ["subscription UpdateJobProgression($id: Int!, $interval: Int){\n data: updateJobProgression(id: $id, interval: $interval) {\n id\n message\n current\n total\n updateDate\n }\n}"])));
31380
+ var jobProgressionSubscription = core.gql(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["subscription UpdateJobProgression($id: Int!, $interval: Int){\n data: updateJobProgression(id: $id, interval: $interval) {\n id\n message\n current\n total\n }\n}"], ["subscription UpdateJobProgression($id: Int!, $interval: Int){\n data: updateJobProgression(id: $id, interval: $interval) {\n id\n message\n current\n total\n }\n}"])));
31367
31381
  var JobProgressionService = /** @class */ (function (_super) {
31368
31382
  __extends(JobProgressionService, _super);
31369
31383
  function JobProgressionService(graphql, environment) {
@@ -31415,7 +31429,7 @@
31415
31429
  JobProgressionList.decorators = [
31416
31430
  { type: i0.Component, args: [{
31417
31431
  selector: 'app-job-progression-list',
31418
- 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 {{'COMMON.NO_RESULT' | translate}}\n </ion-item>\n <ion-item *ngFor=\"let jobProgression of jobProgressions\">\n <ion-grid class=\"ion-no-margin\">\n <ion-row>\n <ion-col>\n {{jobProgression.message}}\n </ion-col>\n </ion-row>\n <ion-row>\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",
31432
+ 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\">\n <ion-grid class=\"ion-no-margin\">\n <ion-row>\n <ion-col>\n {{jobProgression.message}}\n </ion-col>\n </ion-row>\n <ion-row>\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",
31419
31433
  styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none}"]
31420
31434
  },] }
31421
31435
  ];
@@ -31431,10 +31445,7 @@
31431
31445
  this.popoverController = popoverController;
31432
31446
  this.cd = cd;
31433
31447
  this.debug = false;
31434
- this.titleI18n = 'SOCIAL.JOB_PROGRESSION.TITLE';
31435
- this.autoRemove = true;
31436
- this.autoHide = false;
31437
- this.autoHideDelay = 1000; // millisecond
31448
+ this.titleI18n = 'SOCIAL.JOB.PROGRESSION.TITLE';
31438
31449
  this.jobFinished = new i0.EventEmitter();
31439
31450
  this.disabled = true;
31440
31451
  this.color = 'accent';
@@ -31446,9 +31457,23 @@
31446
31457
  this._logPrefix = '[job-progression] ';
31447
31458
  }
31448
31459
  JobProgressionComponent.prototype.ngOnInit = function () {
31460
+ var _a, _b, _c, _d;
31461
+ if (isNil(this.jobProgressionService)) {
31462
+ console.warn(this._logPrefix + "No service injected");
31463
+ }
31464
+ // parse options
31465
+ this.autoHide = toBoolean((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoHide, false);
31466
+ this.visible = !this.autoHide;
31467
+ this.autoHideDelay = toNumber((_b = this.options) === null || _b === void 0 ? void 0 : _b.autoHideDelay, 1000);
31468
+ this.autoRemove = toBoolean((_c = this.options) === null || _c === void 0 ? void 0 : _c.autoRemove, true);
31469
+ this.autoRemoveDelay = toNumber((_d = this.options) === null || _d === void 0 ? void 0 : _d.autoRemoveDelay, 1000);
31449
31470
  };
31450
31471
  JobProgressionComponent.prototype.addJob = function (id) {
31451
31472
  var _this = this;
31473
+ if (isNil(this.jobProgressionService)) {
31474
+ console.warn(this._logPrefix + "No service injected. Can't add a job");
31475
+ return;
31476
+ }
31452
31477
  if (this.debug) {
31453
31478
  console.debug(this._logPrefix + "Add job id=" + id);
31454
31479
  }
@@ -31465,6 +31490,8 @@
31465
31490
  }
31466
31491
  return true;
31467
31492
  }), operators.map(function (progression) {
31493
+ // Ensure visible
31494
+ _this.visible = true;
31468
31495
  // Get current progression object
31469
31496
  var currentProgression = _this.getProgression(id);
31470
31497
  if (!currentProgression) {
@@ -31494,7 +31521,17 @@
31494
31521
  // emit event
31495
31522
  _this.jobFinished.emit(progression.id);
31496
31523
  if (_this.autoRemove) {
31497
- setTimeout(function () { return _this.removeJob(progression.id); }, 1000);
31524
+ setTimeout(function () {
31525
+ var _a;
31526
+ _this.removeJob(progression.id);
31527
+ // If last job
31528
+ if (_this.autoHide && !((_a = _this.jobProgressions) === null || _a === void 0 ? void 0 : _a.length)) {
31529
+ setTimeout(function () {
31530
+ _this.visible = false;
31531
+ _this.markForCheck();
31532
+ }, _this.autoHideDelay);
31533
+ }
31534
+ }, _this.autoRemoveDelay);
31498
31535
  }
31499
31536
  }
31500
31537
  });
@@ -31543,8 +31580,8 @@
31543
31580
  JobProgressionComponent.prototype.showList = function (event) {
31544
31581
  return __awaiter(this, void 0, void 0, function () {
31545
31582
  var popover;
31546
- return __generator(this, function (_a) {
31547
- switch (_a.label) {
31583
+ return __generator(this, function (_e) {
31584
+ switch (_e.label) {
31548
31585
  case 0: return [4 /*yield*/, this.popoverController.create({
31549
31586
  component: JobProgressionList,
31550
31587
  componentProps: {
@@ -31558,10 +31595,10 @@
31558
31595
  cssClass: 'popover-large'
31559
31596
  })];
31560
31597
  case 1:
31561
- popover = _a.sent();
31598
+ popover = _e.sent();
31562
31599
  return [4 /*yield*/, popover.present()];
31563
31600
  case 2:
31564
- _a.sent();
31601
+ _e.sent();
31565
31602
  return [2 /*return*/];
31566
31603
  }
31567
31604
  });
@@ -31581,22 +31618,20 @@
31581
31618
  JobProgressionComponent.decorators = [
31582
31619
  { type: i0.Component, args: [{
31583
31620
  selector: 'app-job-progression',
31584
- template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n *ngIf=\"!autoHide || jobProgressions?.length\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"jobProgressions?.length\"\n [matBadgeHidden]=\"!jobProgressions?.length\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >{{ disabled || jobProgressions?.length ? 'schedule' : 'task_alt' }}\n </mat-icon>\n <mat-spinner\n #spinner\n *ngIf=\"jobProgressions?.length\"\n class=\"floating-spinner\"\n [color]=\"color\"\n [mode]=\"mode\"\n [value]=\"value\"\n diameter=\"30\"\n strokeWidth=\"3\"\n ></mat-spinner>\n</button>\n\n",
31621
+ template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n *ngIf=\"visible\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"jobProgressions?.length\"\n [matBadgeHidden]=\"!jobProgressions?.length\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >{{ disabled || jobProgressions?.length ? 'schedule' : 'task_alt' }}\n </mat-icon>\n <mat-spinner\n #spinner\n *ngIf=\"jobProgressions?.length\"\n class=\"floating-spinner\"\n [color]=\"color\"\n [mode]=\"mode\"\n [value]=\"value\"\n diameter=\"30\"\n strokeWidth=\"3\"\n ></mat-spinner>\n</button>\n\n",
31585
31622
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
31586
31623
  styles: [".floating-spinner{position:absolute;top:6px;left:5px}"]
31587
31624
  },] }
31588
31625
  ];
31589
31626
  JobProgressionComponent.ctorParameters = function () { return [
31590
- { type: undefined, decorators: [{ type: i0.Inject, args: [JobProgressionServiceToken,] }] },
31627
+ { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [JobProgressionServiceToken,] }] },
31591
31628
  { type: i1$5.PopoverController },
31592
31629
  { type: i0.ChangeDetectorRef }
31593
31630
  ]; };
31594
31631
  JobProgressionComponent.propDecorators = {
31595
31632
  debug: [{ type: i0.Input }],
31596
31633
  titleI18n: [{ type: i0.Input }],
31597
- autoRemove: [{ type: i0.Input }],
31598
- autoHide: [{ type: i0.Input }],
31599
- autoHideDelay: [{ type: i0.Input }],
31634
+ options: [{ type: i0.Input }],
31600
31635
  jobFinished: [{ type: i0.Output }]
31601
31636
  };
31602
31637
 
@@ -31622,6 +31657,7 @@
31622
31657
  },] }
31623
31658
  ];
31624
31659
 
31660
+ var SocialModuleOptionsToken = new i0.InjectionToken("SocialModuleOptions");
31625
31661
  var SocialModule = /** @class */ (function () {
31626
31662
  function SocialModule() {
31627
31663
  }
@@ -33911,6 +33947,7 @@
33911
33947
  exports.IsNotOnFieldModePipe = IsNotOnFieldModePipe;
33912
33948
  exports.IsOnFieldModePipe = IsOnFieldModePipe;
33913
33949
  exports.Job = Job;
33950
+ exports.JobModule = JobModule;
33914
33951
  exports.JobProgressionComponent = JobProgressionComponent;
33915
33952
  exports.JobProgressionService = JobProgressionService;
33916
33953
  exports.JobProgressionServiceToken = JobProgressionServiceToken;
@@ -33951,6 +33988,7 @@
33951
33988
  exports.MenuService = MenuService;
33952
33989
  exports.MessageForm = MessageForm;
33953
33990
  exports.MessageModal = MessageModal;
33991
+ exports.MessageModule = MessageModule;
33954
33992
  exports.MessageService = MessageService;
33955
33993
  exports.MessageTypeList = MessageTypeList;
33956
33994
  exports.MessageTypes = MessageTypes;
@@ -34018,6 +34056,7 @@
34018
34056
  exports.SharedValidators = SharedValidators;
34019
34057
  exports.SocialErrorCodes = SocialErrorCodes;
34020
34058
  exports.SocialModule = SocialModule;
34059
+ exports.SocialModuleOptionsToken = SocialModuleOptionsToken;
34021
34060
  exports.StartableService = StartableService;
34022
34061
  exports.StatusById = StatusById;
34023
34062
  exports.StatusIds = StatusIds;
@@ -34046,6 +34085,7 @@
34046
34085
  exports.UploadFileTestingPage = UploadFileTestingPage;
34047
34086
  exports.UriUtils = UriUtils;
34048
34087
  exports.UserEventFragments = UserEventFragments;
34088
+ exports.UserEventModule = UserEventModule;
34049
34089
  exports.UserEventNotificationComponent = UserEventNotificationComponent;
34050
34090
  exports.UserEventService = UserEventService;
34051
34091
  exports.UserEventServiceToken = UserEventServiceToken;
@@ -34213,16 +34253,13 @@
34213
34253
  exports.ɵh = LocalSettingsValidatorService;
34214
34254
  exports.ɵi = AppUpdateOfflineModeCard;
34215
34255
  exports.ɵj = AppIconComponent;
34216
- exports.ɵk = UserEventModule;
34217
- exports.ɵl = UserEventNotificationList;
34218
- exports.ɵm = JobModule;
34219
- exports.ɵn = JobProgressionList;
34220
- exports.ɵo = MessageModule;
34221
- exports.ɵp = DateTestPage;
34222
- exports.ɵq = NumpadTestPage;
34223
- exports.ɵr = MatBadgeIconTestPage;
34224
- exports.ɵs = ToastTestingModule;
34225
- exports.ɵt = ToastTestingPage;
34256
+ exports.ɵk = UserEventNotificationList;
34257
+ exports.ɵl = JobProgressionList;
34258
+ exports.ɵm = DateTestPage;
34259
+ exports.ɵn = NumpadTestPage;
34260
+ exports.ɵo = MatBadgeIconTestPage;
34261
+ exports.ɵp = ToastTestingModule;
34262
+ exports.ɵq = ToastTestingPage;
34226
34263
 
34227
34264
  Object.defineProperty(exports, '__esModule', { value: true });
34228
34265