@sumaris-net/ngx-components 1.20.30 → 1.21.0-beta1
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.
- package/bundles/sumaris-net.ngx-components.umd.js +1044 -297
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +0 -3
- package/esm2015/public_api.js +5 -3
- package/esm2015/src/app/core/icon/icon.component.js +5 -2
- package/esm2015/src/app/shared/functions.js +60 -1
- package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +2 -3
- package/esm2015/src/app/shared/material/autocomplete/testing/autocomplete.test.js +2 -3
- package/esm2015/src/app/shared/material/chips/material.chips.js +2 -3
- package/esm2015/src/app/shared/material/chips/testing/chips.test.js +2 -3
- package/esm2015/src/app/shared/pipes/arrays.pipe.js +1 -1
- package/esm2015/src/app/shared/pipes/form.pipes.js +4 -2
- package/esm2015/src/app/shared/pipes/highlight.pipe.js +4 -4
- package/esm2015/src/app/shared/pipes/string.pipes.js +18 -7
- package/esm2015/src/app/shared/services/memory-entity-service.class.js +1 -13
- package/esm2015/src/app/shared/types.js +1 -1
- package/esm2015/src/app/social/job/job.model.js +24 -0
- package/esm2015/src/app/social/job/job.module.js +25 -0
- package/esm2015/src/app/social/job/job.service.js +54 -0
- package/esm2015/src/app/social/job/progression/job-progression.component.js +171 -0
- package/esm2015/src/app/social/job/progression/job-progression.list.js +20 -0
- package/esm2015/src/app/social/message/message.module.js +25 -0
- package/esm2015/src/app/social/social.errors.js +5 -2
- package/esm2015/src/app/social/social.module.js +8 -14
- package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +88 -0
- package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +39 -0
- package/esm2015/src/app/social/user-event/user-event.model.js +58 -2
- package/esm2015/src/app/social/user-event/user-event.module.js +28 -0
- package/esm2015/src/app/social/user-event/user-event.service.js +294 -166
- package/esm2015/src/app/social/user-event/user-events.table.js +17 -12
- package/esm2015/sumaris-net.ngx-components.js +11 -6
- package/fesm2015/sumaris-net.ngx-components.js +880 -264
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +4 -2
- package/src/app/core/icon/icon.component.d.ts +4 -4
- package/src/app/shared/functions.d.ts +9 -0
- package/src/app/shared/material/badge/badge-icon.test.d.ts +1 -1
- package/src/app/shared/pipes/form.pipes.d.ts +2 -1
- package/src/app/shared/services/memory-entity-service.class.d.ts +0 -6
- package/src/app/shared/types.d.ts +4 -0
- package/src/app/social/job/job.model.d.ts +32 -0
- package/src/app/social/job/job.module.d.ts +2 -0
- package/src/app/social/job/job.service.d.ts +23 -0
- package/src/app/social/job/progression/job-progression.component.d.ts +34 -0
- package/src/app/social/job/progression/job-progression.list.d.ts +12 -0
- package/src/app/social/message/message.module.d.ts +2 -0
- package/src/app/social/social.errors.d.ts +3 -0
- package/src/app/social/user-event/notification/user-event-notification.component.d.ts +26 -0
- package/src/app/social/user-event/notification/user-event-notification.list.d.ts +20 -0
- package/src/app/social/user-event/user-event.model.d.ts +51 -6
- package/src/app/social/user-event/user-event.module.d.ts +2 -0
- package/src/app/social/user-event/user-event.service.d.ts +80 -51
- package/src/app/social/user-event/user-events.table.d.ts +6 -6
- package/src/assets/i18n/en-US.json +9 -2
- package/src/assets/i18n/en.json +9 -2
- package/src/assets/i18n/fr.json +8 -1
- package/src/theme/_ngx-components.scss +7 -0
- package/sumaris-net.ngx-components.d.ts +10 -5
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/esm2015/src/app/shared/services.js +0 -61
- package/src/app/shared/services.d.ts +0 -9
|
@@ -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.
|
|
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;
|
|
@@ -500,6 +509,67 @@
|
|
|
500
509
|
function removeDiacritics(text) {
|
|
501
510
|
return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
502
511
|
}
|
|
512
|
+
function suggestFromArray(items, value, opts) {
|
|
513
|
+
var _this = this;
|
|
514
|
+
if (isNotNil(value) && typeof value === 'object')
|
|
515
|
+
return { data: [value] };
|
|
516
|
+
value = (typeof value === 'string' && value !== '*') && value.toUpperCase() || undefined;
|
|
517
|
+
var keys = opts && (opts.searchAttribute && [opts.searchAttribute] || opts.searchAttributes) || ['label'];
|
|
518
|
+
if (!items) {
|
|
519
|
+
return { data: [], total: 0 };
|
|
520
|
+
}
|
|
521
|
+
// Filter items
|
|
522
|
+
var filteredItems = items;
|
|
523
|
+
if (isNotNilOrBlank(value)) {
|
|
524
|
+
// If wildcard, search using regexp
|
|
525
|
+
if (value.indexOf('*') !== -1) {
|
|
526
|
+
value = value.replace(/[*]+/g, '.*');
|
|
527
|
+
filteredItems = filteredItems.filter(function (v) { return keys.findIndex(function (key) { return matchUpperCase(getPropertyByPathAsString(v, key), value); }) !== -1; });
|
|
528
|
+
}
|
|
529
|
+
// Else (no wildcard), search using startsWith
|
|
530
|
+
else {
|
|
531
|
+
filteredItems = filteredItems.filter(function (v) { return keys.findIndex(function (key) { return startsWithUpperCase(getPropertyByPathAsString(v, key), value); }) !== -1; });
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
// Exclude ids
|
|
535
|
+
if (isNotEmptyArray(opts === null || opts === void 0 ? void 0 : opts.excludedIds)) {
|
|
536
|
+
filteredItems = filteredItems.filter(function (v) { return !opts.excludedIds.includes(+v['id']); });
|
|
537
|
+
}
|
|
538
|
+
// Sort
|
|
539
|
+
if (!opts || opts.skipSort !== true) {
|
|
540
|
+
// Make to copy input items, before sorting (if not yet already done)
|
|
541
|
+
if (filteredItems === items)
|
|
542
|
+
filteredItems = filteredItems.slice();
|
|
543
|
+
// Sort by keys
|
|
544
|
+
filteredItems.sort(propertiesPathComparator(keys));
|
|
545
|
+
}
|
|
546
|
+
var total = filteredItems.length || 0;
|
|
547
|
+
// Pagination (truncate if need)
|
|
548
|
+
var pageData = filteredItems;
|
|
549
|
+
if (opts) {
|
|
550
|
+
if ((opts.offset || 0) > 0) {
|
|
551
|
+
pageData = pageData.slice(opts.offset);
|
|
552
|
+
}
|
|
553
|
+
if (isNotNil(opts.size) && pageData.length > opts.size) {
|
|
554
|
+
pageData = pageData.slice(0, opts.size);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
var result = {
|
|
558
|
+
data: pageData,
|
|
559
|
+
total: total
|
|
560
|
+
};
|
|
561
|
+
// Add fetch more capability, if total was fetched
|
|
562
|
+
var nextOffset = (opts && opts.offset || 0) + pageData.length;
|
|
563
|
+
if (nextOffset < total) {
|
|
564
|
+
result.fetchMore = function (_) { return __awaiter(_this, void 0, void 0, function () {
|
|
565
|
+
return __generator(this, function (_b) {
|
|
566
|
+
return [2 /*return*/, suggestFromArray(filteredItems, undefined /*OPTIMISATION: already applied*/, Object.assign(Object.assign({}, opts), { offset: nextOffset, skipSort: true, excludedIds: undefined // OPTIMISATION: already filtered
|
|
567
|
+
}))];
|
|
568
|
+
});
|
|
569
|
+
}); };
|
|
570
|
+
}
|
|
571
|
+
return result;
|
|
572
|
+
}
|
|
503
573
|
function suggestFromStringArray(values, value, options) {
|
|
504
574
|
value = (typeof value === 'string' && value !== '*') && value.toUpperCase() || undefined;
|
|
505
575
|
if (isNilOrBlank(value))
|
|
@@ -1316,68 +1386,6 @@
|
|
|
1316
1386
|
return _cache.mobile;
|
|
1317
1387
|
};
|
|
1318
1388
|
|
|
1319
|
-
function suggestFromArray(items, value, opts) {
|
|
1320
|
-
var _this = this;
|
|
1321
|
-
if (isNotNil(value) && typeof value === 'object')
|
|
1322
|
-
return { data: [value] };
|
|
1323
|
-
value = (typeof value === 'string' && value !== '*') && value.toUpperCase() || undefined;
|
|
1324
|
-
var keys = opts && (opts.searchAttribute && [opts.searchAttribute] || opts.searchAttributes) || ['label'];
|
|
1325
|
-
if (!items) {
|
|
1326
|
-
return { data: [], total: 0 };
|
|
1327
|
-
}
|
|
1328
|
-
// Filter items
|
|
1329
|
-
var filteredItems = items;
|
|
1330
|
-
if (isNotNilOrBlank(value)) {
|
|
1331
|
-
// If wildcard, search using regexp
|
|
1332
|
-
if (value.indexOf('*') !== -1) {
|
|
1333
|
-
value = value.replace(/[*]+/g, '.*');
|
|
1334
|
-
filteredItems = filteredItems.filter(function (v) { return keys.findIndex(function (key) { return matchUpperCase(getPropertyByPathAsString(v, key), value); }) !== -1; });
|
|
1335
|
-
}
|
|
1336
|
-
// Else (no wildcard), search using startsWith
|
|
1337
|
-
else {
|
|
1338
|
-
filteredItems = filteredItems.filter(function (v) { return keys.findIndex(function (key) { return startsWithUpperCase(getPropertyByPathAsString(v, key), value); }) !== -1; });
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
// Exclude ids
|
|
1342
|
-
if (isNotEmptyArray(opts === null || opts === void 0 ? void 0 : opts.excludedIds)) {
|
|
1343
|
-
filteredItems = filteredItems.filter(function (v) { return !opts.excludedIds.includes(+v['id']); });
|
|
1344
|
-
}
|
|
1345
|
-
// Sort
|
|
1346
|
-
if (!opts || opts.skipSort !== true) {
|
|
1347
|
-
// Make to copy input items, before sorting (if not yet already done)
|
|
1348
|
-
if (filteredItems === items)
|
|
1349
|
-
filteredItems = filteredItems.slice();
|
|
1350
|
-
// Sort by keys
|
|
1351
|
-
filteredItems.sort(propertiesPathComparator(keys));
|
|
1352
|
-
}
|
|
1353
|
-
var total = filteredItems.length || 0;
|
|
1354
|
-
// Pagination (truncate if need)
|
|
1355
|
-
var pageData = filteredItems;
|
|
1356
|
-
if (opts) {
|
|
1357
|
-
if ((opts.offset || 0) > 0) {
|
|
1358
|
-
pageData = pageData.slice(opts.offset);
|
|
1359
|
-
}
|
|
1360
|
-
if (isNotNil(opts.size) && pageData.length > opts.size) {
|
|
1361
|
-
pageData = pageData.slice(0, opts.size);
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
var result = {
|
|
1365
|
-
data: pageData,
|
|
1366
|
-
total: total
|
|
1367
|
-
};
|
|
1368
|
-
// Add fetch more capability, if total was fetched
|
|
1369
|
-
var nextOffset = (opts && opts.offset || 0) + pageData.length;
|
|
1370
|
-
if (nextOffset < total) {
|
|
1371
|
-
result.fetchMore = function (_) { return __awaiter(_this, void 0, void 0, function () {
|
|
1372
|
-
return __generator(this, function (_a) {
|
|
1373
|
-
return [2 /*return*/, suggestFromArray(filteredItems, undefined /*OPTIMISATION: already applied*/, Object.assign(Object.assign({}, opts), { offset: nextOffset, skipSort: true, excludedIds: undefined // OPTIMISATION: already filtered
|
|
1374
|
-
}))];
|
|
1375
|
-
});
|
|
1376
|
-
}); };
|
|
1377
|
-
}
|
|
1378
|
-
return result;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
1389
|
var MatAutocompleteConfigHolder = /** @class */ (function () {
|
|
1382
1390
|
function MatAutocompleteConfigHolder(options) {
|
|
1383
1391
|
this.options = options;
|
|
@@ -2701,9 +2709,9 @@
|
|
|
2701
2709
|
var cleanedSearchText = removeDiacritics(searchRegexp).toUpperCase();
|
|
2702
2710
|
var index = removeDiacritics(value.toUpperCase()).indexOf(cleanedSearchText);
|
|
2703
2711
|
if (index !== -1) {
|
|
2704
|
-
return value.
|
|
2705
|
-
'<b>' + value.
|
|
2706
|
-
value.
|
|
2712
|
+
return value.substr(0, index - 1) +
|
|
2713
|
+
'<b>' + value.substr(index, cleanedSearchText.length) + '</b>' +
|
|
2714
|
+
value.substr(index + cleanedSearchText.length);
|
|
2707
2715
|
}
|
|
2708
2716
|
return value;
|
|
2709
2717
|
}
|
|
@@ -3151,10 +3159,12 @@
|
|
|
3151
3159
|
};
|
|
3152
3160
|
return IsNotNilOrBlankPipe;
|
|
3153
3161
|
}());
|
|
3162
|
+
IsNotNilOrBlankPipe.ɵprov = i0.ɵɵdefineInjectable({ factory: function IsNotNilOrBlankPipe_Factory() { return new IsNotNilOrBlankPipe(); }, token: IsNotNilOrBlankPipe, providedIn: "root" });
|
|
3154
3163
|
IsNotNilOrBlankPipe.decorators = [
|
|
3155
3164
|
{ type: i0.Pipe, args: [{
|
|
3156
3165
|
name: 'isNotNilOrBlank'
|
|
3157
|
-
},] }
|
|
3166
|
+
},] },
|
|
3167
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
3158
3168
|
];
|
|
3159
3169
|
var IsNilOrBlankPipe = /** @class */ (function () {
|
|
3160
3170
|
function IsNilOrBlankPipe() {
|
|
@@ -3164,10 +3174,12 @@
|
|
|
3164
3174
|
};
|
|
3165
3175
|
return IsNilOrBlankPipe;
|
|
3166
3176
|
}());
|
|
3177
|
+
IsNilOrBlankPipe.ɵprov = i0.ɵɵdefineInjectable({ factory: function IsNilOrBlankPipe_Factory() { return new IsNilOrBlankPipe(); }, token: IsNilOrBlankPipe, providedIn: "root" });
|
|
3167
3178
|
IsNilOrBlankPipe.decorators = [
|
|
3168
3179
|
{ type: i0.Pipe, args: [{
|
|
3169
3180
|
name: 'isNilOrBlank'
|
|
3170
|
-
},] }
|
|
3181
|
+
},] },
|
|
3182
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
3171
3183
|
];
|
|
3172
3184
|
var ToStringPipe = /** @class */ (function () {
|
|
3173
3185
|
function ToStringPipe() {
|
|
@@ -3177,10 +3189,12 @@
|
|
|
3177
3189
|
};
|
|
3178
3190
|
return ToStringPipe;
|
|
3179
3191
|
}());
|
|
3192
|
+
ToStringPipe.ɵprov = i0.ɵɵdefineInjectable({ factory: function ToStringPipe_Factory() { return new ToStringPipe(); }, token: ToStringPipe, providedIn: "root" });
|
|
3180
3193
|
ToStringPipe.decorators = [
|
|
3181
3194
|
{ type: i0.Pipe, args: [{
|
|
3182
3195
|
name: 'toString'
|
|
3183
|
-
},] }
|
|
3196
|
+
},] },
|
|
3197
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
3184
3198
|
];
|
|
3185
3199
|
var StrLengthPipe = /** @class */ (function () {
|
|
3186
3200
|
function StrLengthPipe() {
|
|
@@ -3190,10 +3204,12 @@
|
|
|
3190
3204
|
};
|
|
3191
3205
|
return StrLengthPipe;
|
|
3192
3206
|
}());
|
|
3207
|
+
StrLengthPipe.ɵprov = i0.ɵɵdefineInjectable({ factory: function StrLengthPipe_Factory() { return new StrLengthPipe(); }, token: StrLengthPipe, providedIn: "root" });
|
|
3193
3208
|
StrLengthPipe.decorators = [
|
|
3194
3209
|
{ type: i0.Pipe, args: [{
|
|
3195
3210
|
name: 'strLength'
|
|
3196
|
-
},] }
|
|
3211
|
+
},] },
|
|
3212
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
3197
3213
|
];
|
|
3198
3214
|
var StrIncludesPipe = /** @class */ (function () {
|
|
3199
3215
|
function StrIncludesPipe() {
|
|
@@ -3203,10 +3219,12 @@
|
|
|
3203
3219
|
};
|
|
3204
3220
|
return StrIncludesPipe;
|
|
3205
3221
|
}());
|
|
3222
|
+
StrIncludesPipe.ɵprov = i0.ɵɵdefineInjectable({ factory: function StrIncludesPipe_Factory() { return new StrIncludesPipe(); }, token: StrIncludesPipe, providedIn: "root" });
|
|
3206
3223
|
StrIncludesPipe.decorators = [
|
|
3207
3224
|
{ type: i0.Pipe, args: [{
|
|
3208
3225
|
name: 'strIncludes'
|
|
3209
|
-
},] }
|
|
3226
|
+
},] },
|
|
3227
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
3210
3228
|
];
|
|
3211
3229
|
|
|
3212
3230
|
var TranslateContextService = /** @class */ (function () {
|
|
@@ -4787,7 +4805,8 @@
|
|
|
4787
4805
|
},] }
|
|
4788
4806
|
];
|
|
4789
4807
|
var FormGetValuePipe = /** @class */ (function () {
|
|
4790
|
-
function FormGetValuePipe(_ref) {
|
|
4808
|
+
function FormGetValuePipe(adapter, _ref) {
|
|
4809
|
+
this.adapter = adapter;
|
|
4791
4810
|
this._ref = _ref;
|
|
4792
4811
|
this.value = undefined;
|
|
4793
4812
|
this._lastControl = null;
|
|
@@ -4855,6 +4874,7 @@
|
|
|
4855
4874
|
},] }
|
|
4856
4875
|
];
|
|
4857
4876
|
FormGetValuePipe.ctorParameters = function () { return [
|
|
4877
|
+
{ type: FormErrorTranslator },
|
|
4858
4878
|
{ type: i0.ChangeDetectorRef }
|
|
4859
4879
|
]; };
|
|
4860
4880
|
|
|
@@ -20719,14 +20739,14 @@
|
|
|
20719
20739
|
}
|
|
20720
20740
|
return this._onChange
|
|
20721
20741
|
.pipe(operators.filter(isNotNil), operators.mergeMap(function (_) { return waitFor(function () { return !_this._saving; }); }), operators.mergeMap(function (_) { return __awaiter(_this, void 0, void 0, function () {
|
|
20722
|
-
var excludedDataByFilter, excludedDataByPagination, data, promiseOrData,
|
|
20723
|
-
return __generator(this, function (
|
|
20724
|
-
switch (
|
|
20742
|
+
var excludedDataByFilter, excludedDataByPagination, data, promiseOrData, _a, total;
|
|
20743
|
+
return __generator(this, function (_b) {
|
|
20744
|
+
switch (_b.label) {
|
|
20725
20745
|
case 0:
|
|
20726
20746
|
excludedDataByFilter = [];
|
|
20727
|
-
|
|
20747
|
+
_b.label = 1;
|
|
20728
20748
|
case 1:
|
|
20729
|
-
|
|
20749
|
+
_b.trys.push([1, , 6, 7]);
|
|
20730
20750
|
if (isEmptyArray(this.data)) {
|
|
20731
20751
|
return [2 /*return*/, { data: [], total: 0 }];
|
|
20732
20752
|
}
|
|
@@ -20736,14 +20756,14 @@
|
|
|
20736
20756
|
if (!((promiseOrData instanceof Promise))) return [3 /*break*/, 3];
|
|
20737
20757
|
return [4 /*yield*/, promiseOrData];
|
|
20738
20758
|
case 2:
|
|
20739
|
-
|
|
20759
|
+
_a = _b.sent();
|
|
20740
20760
|
return [3 /*break*/, 4];
|
|
20741
20761
|
case 3:
|
|
20742
|
-
|
|
20743
|
-
|
|
20762
|
+
_a = promiseOrData;
|
|
20763
|
+
_b.label = 4;
|
|
20744
20764
|
case 4:
|
|
20745
|
-
data =
|
|
20746
|
-
|
|
20765
|
+
data = _a;
|
|
20766
|
+
_b.label = 5;
|
|
20747
20767
|
case 5:
|
|
20748
20768
|
// Apply filter (will update hiddenData)
|
|
20749
20769
|
data = this.filter(data, filterData, excludedDataByFilter);
|
|
@@ -20799,16 +20819,16 @@
|
|
|
20799
20819
|
};
|
|
20800
20820
|
InMemoryEntitiesService.prototype.saveAll = function (data, options) {
|
|
20801
20821
|
return __awaiter(this, void 0, void 0, function () {
|
|
20802
|
-
var res,
|
|
20803
|
-
return __generator(this, function (
|
|
20804
|
-
switch (
|
|
20822
|
+
var res, _a;
|
|
20823
|
+
return __generator(this, function (_b) {
|
|
20824
|
+
switch (_b.label) {
|
|
20805
20825
|
case 0:
|
|
20806
20826
|
if (!this.data)
|
|
20807
20827
|
throw new Error('[memory-service] Could not save, because value not set');
|
|
20808
20828
|
this.markAsSaving();
|
|
20809
|
-
|
|
20829
|
+
_b.label = 1;
|
|
20810
20830
|
case 1:
|
|
20811
|
-
|
|
20831
|
+
_b.trys.push([1, , 6, 7]);
|
|
20812
20832
|
// Restore hidden data
|
|
20813
20833
|
if (isNotEmptyArray(this._hiddenData))
|
|
20814
20834
|
data = data.concat.apply(data, __spread(this._hiddenData));
|
|
@@ -20817,14 +20837,14 @@
|
|
|
20817
20837
|
if (!((res instanceof Promise))) return [3 /*break*/, 3];
|
|
20818
20838
|
return [4 /*yield*/, res];
|
|
20819
20839
|
case 2:
|
|
20820
|
-
|
|
20840
|
+
_a = _b.sent();
|
|
20821
20841
|
return [3 /*break*/, 4];
|
|
20822
20842
|
case 3:
|
|
20823
|
-
|
|
20824
|
-
|
|
20843
|
+
_a = res;
|
|
20844
|
+
_b.label = 4;
|
|
20825
20845
|
case 4:
|
|
20826
|
-
data =
|
|
20827
|
-
|
|
20846
|
+
data = _a;
|
|
20847
|
+
_b.label = 5;
|
|
20828
20848
|
case 5:
|
|
20829
20849
|
this.data = data;
|
|
20830
20850
|
this.dirty = true;
|
|
@@ -20841,7 +20861,7 @@
|
|
|
20841
20861
|
return __awaiter(this, void 0, void 0, function () {
|
|
20842
20862
|
var updatedData, deleteCount;
|
|
20843
20863
|
var _this = this;
|
|
20844
|
-
return __generator(this, function (
|
|
20864
|
+
return __generator(this, function (_a) {
|
|
20845
20865
|
if (!this.data)
|
|
20846
20866
|
throw new Error('[memory-service] Could not delete, because value not set');
|
|
20847
20867
|
updatedData = this.data.filter(function (entity) {
|
|
@@ -20875,26 +20895,6 @@
|
|
|
20875
20895
|
return this._equalsFn(d1, d2);
|
|
20876
20896
|
return d1 && d1.equals ? d1.equals(d2) : EntityUtils.equals(d1, d2, 'id');
|
|
20877
20897
|
};
|
|
20878
|
-
Object.defineProperty(InMemoryEntitiesService.prototype, "count", {
|
|
20879
|
-
/**
|
|
20880
|
-
* Count data stored by the service (without hidden data).
|
|
20881
|
-
* @param opts
|
|
20882
|
-
*/
|
|
20883
|
-
get: function () {
|
|
20884
|
-
var _a;
|
|
20885
|
-
return (((_a = this.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
20886
|
-
},
|
|
20887
|
-
enumerable: false,
|
|
20888
|
-
configurable: true
|
|
20889
|
-
});
|
|
20890
|
-
Object.defineProperty(InMemoryEntitiesService.prototype, "hiddenCount", {
|
|
20891
|
-
get: function () {
|
|
20892
|
-
var _a;
|
|
20893
|
-
return ((_a = this._hiddenData) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
20894
|
-
},
|
|
20895
|
-
enumerable: false,
|
|
20896
|
-
configurable: true
|
|
20897
|
-
});
|
|
20898
20898
|
/* -- protected methods -- */
|
|
20899
20899
|
InMemoryEntitiesService.prototype.filter = function (data, _filter, hiddenData) {
|
|
20900
20900
|
// if filter is DataFilter instance, use its test function
|
|
@@ -24817,6 +24817,7 @@
|
|
|
24817
24817
|
this.icon = value.icon;
|
|
24818
24818
|
this.matIcon = value.matIcon;
|
|
24819
24819
|
this.matSvgIcon = value.matSvgIcon;
|
|
24820
|
+
this.color = value.color;
|
|
24820
24821
|
},
|
|
24821
24822
|
enumerable: false,
|
|
24822
24823
|
configurable: true
|
|
@@ -24827,7 +24828,7 @@
|
|
|
24827
24828
|
AppIconComponent.decorators = [
|
|
24828
24829
|
{ type: i0.Component, args: [{
|
|
24829
24830
|
selector: 'app-icon',
|
|
24830
|
-
template: "<ion-icon *ngIf=\"icon; else matIconTemplate\" slot=\"icon-only\"\n [color]=\"color\"\n [name]=\"icon\"\n></ion-icon>\n<ng-template #matIconTemplate>\n <mat-icon [svgIcon]=\"matSvgIcon\"\n [style.color]=\"'var(--ion-color-'+color+')'\">{{matIcon}}</mat-icon>\n</ng-template>\n\n"
|
|
24831
|
+
template: "<ion-icon *ngIf=\"icon; else matIconTemplate\" slot=\"icon-only\"\n [color]=\"color\"\n [name]=\"icon\"\n [style.height.px]=\"height\"\n [style.width.px]=\"width\"\n></ion-icon>\n<ng-template #matIconTemplate>\n <mat-icon [svgIcon]=\"matSvgIcon\"\n [style.color]=\"'var(--ion-color-'+color+')'\"\n [style.height.px]=\"height\"\n [style.width.px]=\"width\"\n [style.font-size.px]=\"height || width\"\n >{{matIcon}}</mat-icon>\n</ng-template>\n\n"
|
|
24831
24832
|
},] }
|
|
24832
24833
|
];
|
|
24833
24834
|
AppIconComponent.propDecorators = {
|
|
@@ -24835,6 +24836,8 @@
|
|
|
24835
24836
|
matIcon: [{ type: i0.Input }],
|
|
24836
24837
|
matSvgIcon: [{ type: i0.Input }],
|
|
24837
24838
|
color: [{ type: i0.Input }],
|
|
24839
|
+
height: [{ type: i0.Input }],
|
|
24840
|
+
width: [{ type: i0.Input }],
|
|
24838
24841
|
ref: [{ type: i0.Input }]
|
|
24839
24842
|
};
|
|
24840
24843
|
|
|
@@ -30053,7 +30056,10 @@
|
|
|
30053
30056
|
var SocialErrorCodes = {
|
|
30054
30057
|
LOAD_USER_EVENTS_ERROR: 50000,
|
|
30055
30058
|
SAVE_USER_EVENT_ERROR: 50001,
|
|
30056
|
-
|
|
30059
|
+
COUNT_USER_EVENT_ERROR: 50002,
|
|
30060
|
+
SEND_MESSAGE_ERROR: 50003,
|
|
30061
|
+
SUBSCRIBE_USER_EVENTS_ERROR: 50005,
|
|
30062
|
+
SUBSCRIBE_JOB_PROGRESSION_ERROR: 50010
|
|
30057
30063
|
};
|
|
30058
30064
|
|
|
30059
30065
|
var UserEvent_1;
|
|
@@ -30069,16 +30075,23 @@
|
|
|
30069
30075
|
}
|
|
30070
30076
|
UserEvent.prototype.asObject = function (opts) {
|
|
30071
30077
|
var target = _super.prototype.asObject.call(this, opts);
|
|
30078
|
+
target.creationDate = toDateISOString(this.creationDate);
|
|
30079
|
+
target.readDate = toDateISOString(this.readDate);
|
|
30072
30080
|
// Serialize content
|
|
30073
30081
|
if (typeof target.content === 'object') {
|
|
30074
30082
|
target.content = JSON.stringify(target.content);
|
|
30075
30083
|
}
|
|
30084
|
+
delete target.avatar;
|
|
30085
|
+
delete target.avatarIcon;
|
|
30086
|
+
delete target.icon;
|
|
30087
|
+
delete target.actions;
|
|
30076
30088
|
return target;
|
|
30077
30089
|
};
|
|
30078
30090
|
UserEvent.prototype.fromObject = function (source) {
|
|
30079
30091
|
Object.assign(this, source); // Copy all properties
|
|
30080
30092
|
_super.prototype.fromObject.call(this, source);
|
|
30081
30093
|
this.creationDate = fromDateISOString(source.creationDate);
|
|
30094
|
+
this.readDate = fromDateISOString(source.readDate);
|
|
30082
30095
|
try {
|
|
30083
30096
|
// Deserialize content
|
|
30084
30097
|
if (typeof source.content === 'string' && source.content.startsWith('{')) {
|
|
@@ -30098,36 +30111,48 @@
|
|
|
30098
30111
|
exports.UserEvent = UserEvent_1 = __decorate([
|
|
30099
30112
|
EntityClass({ typename: 'UserEventVO' })
|
|
30100
30113
|
], exports.UserEvent);
|
|
30101
|
-
|
|
30102
|
-
var UserEventFragments = {
|
|
30103
|
-
userEvent: core.gql(templateObject_1$2 || (templateObject_1$2 = __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 }"]))),
|
|
30104
|
-
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 }"])))
|
|
30105
|
-
};
|
|
30106
|
-
var templateObject_1$2, templateObject_2$2;
|
|
30107
|
-
|
|
30108
30114
|
// @dynamic
|
|
30109
30115
|
exports.UserEventFilter = /** @class */ (function (_super) {
|
|
30110
30116
|
__extends(UserEventFilter, _super);
|
|
30111
30117
|
function UserEventFilter() {
|
|
30112
30118
|
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
30113
|
-
_this.
|
|
30114
|
-
_this.
|
|
30119
|
+
_this.types = [];
|
|
30120
|
+
_this.levels = [];
|
|
30121
|
+
_this.issuers = [];
|
|
30122
|
+
_this.recipients = [];
|
|
30123
|
+
_this.startDate = null;
|
|
30124
|
+
_this.excludeRead = false;
|
|
30115
30125
|
return _this;
|
|
30116
30126
|
}
|
|
30117
30127
|
UserEventFilter.prototype.fromObject = function (source, opts) {
|
|
30118
30128
|
_super.prototype.fromObject.call(this, source, opts);
|
|
30119
|
-
this.
|
|
30120
|
-
this.
|
|
30129
|
+
this.types = source.types || [];
|
|
30130
|
+
this.levels = source.levels || [];
|
|
30131
|
+
this.issuers = source.issuers || [];
|
|
30132
|
+
this.recipients = source.recipients || [];
|
|
30133
|
+
this.startDate = fromDateISOString(source.startDate);
|
|
30134
|
+
this.excludeRead = source.excludeRead || false;
|
|
30121
30135
|
};
|
|
30122
30136
|
UserEventFilter.prototype.buildFilter = function () {
|
|
30123
30137
|
var _this = this;
|
|
30124
30138
|
var filterFns = _super.prototype.buildFilter.call(this);
|
|
30125
|
-
|
|
30126
|
-
|
|
30127
|
-
filterFns.push(function (t) { return (t.issuer === _this.issuer); });
|
|
30139
|
+
if (isNotEmptyArray(this.types)) {
|
|
30140
|
+
filterFns.push(function (t) { return _this.types.includes(t.type); });
|
|
30128
30141
|
}
|
|
30129
|
-
if (this.
|
|
30130
|
-
filterFns.push(function (t) { return (t.
|
|
30142
|
+
if (isNotEmptyArray(this.levels)) {
|
|
30143
|
+
filterFns.push(function (t) { return _this.levels.includes(t.level); });
|
|
30144
|
+
}
|
|
30145
|
+
if (isNotEmptyArray(this.issuers)) {
|
|
30146
|
+
filterFns.push(function (t) { return _this.issuers.includes(t.issuer); });
|
|
30147
|
+
}
|
|
30148
|
+
if (isNotEmptyArray(this.recipients)) {
|
|
30149
|
+
filterFns.push(function (t) { return _this.recipients.includes(t.recipient); });
|
|
30150
|
+
}
|
|
30151
|
+
if (isNotNil(this.startDate)) {
|
|
30152
|
+
filterFns.push(function (t) { return _this.startDate.isSameOrBefore(t.creationDate); });
|
|
30153
|
+
}
|
|
30154
|
+
if (this.excludeRead === true) {
|
|
30155
|
+
filterFns.push(function (t) { return isNil(t.readSignature); }); // todo or t.signature ?
|
|
30131
30156
|
}
|
|
30132
30157
|
return filterFns;
|
|
30133
30158
|
};
|
|
@@ -30136,145 +30161,205 @@
|
|
|
30136
30161
|
exports.UserEventFilter = __decorate([
|
|
30137
30162
|
EntityClass({ typename: 'UserEventFilterVO' })
|
|
30138
30163
|
], exports.UserEventFilter);
|
|
30139
|
-
|
|
30140
|
-
var
|
|
30141
|
-
|
|
30142
|
-
|
|
30143
|
-
|
|
30144
|
-
|
|
30145
|
-
|
|
30164
|
+
|
|
30165
|
+
var UserEventFragments = {
|
|
30166
|
+
userEvent: core.gql(templateObject_1$2 || (templateObject_1$2 = __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 }"]))),
|
|
30167
|
+
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 }"])))
|
|
30168
|
+
};
|
|
30169
|
+
var templateObject_1$2, templateObject_2$2;
|
|
30170
|
+
|
|
30171
|
+
var moment$6 = momentImported__namespace;
|
|
30172
|
+
var UserEventServiceToken = new i0.InjectionToken('UserEventService');
|
|
30173
|
+
var AbstractUserEventService = /** @class */ (function (_super) {
|
|
30174
|
+
__extends(AbstractUserEventService, _super);
|
|
30175
|
+
function AbstractUserEventService(graphql, accountService, network, translate, toastController, queries, mutations, subscriptions, environment) {
|
|
30146
30176
|
var _this = _super.call(this, graphql, environment) || this;
|
|
30147
30177
|
_this.graphql = graphql;
|
|
30148
30178
|
_this.accountService = accountService;
|
|
30149
30179
|
_this.network = network;
|
|
30150
30180
|
_this.translate = translate;
|
|
30151
30181
|
_this.toastController = toastController;
|
|
30182
|
+
_this.queries = queries;
|
|
30183
|
+
_this.mutations = mutations;
|
|
30184
|
+
_this.subscriptions = subscriptions;
|
|
30152
30185
|
_this.environment = environment;
|
|
30153
|
-
_this.
|
|
30186
|
+
_this._count$ = new rxjs.BehaviorSubject(0);
|
|
30187
|
+
_this._subscriptions = new rxjs.Subscription();
|
|
30188
|
+
_this.listeners = [];
|
|
30189
|
+
_this._logPrefix = '[user-event-service] ';
|
|
30154
30190
|
// For DEV only
|
|
30155
|
-
_this._debug = environment
|
|
30191
|
+
_this._debug = !(environment === null || environment === void 0 ? void 0 : environment.production);
|
|
30192
|
+
// listen login/logout
|
|
30193
|
+
_this._subscriptions.add(accountService.onLogin.subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
30194
|
+
var count;
|
|
30195
|
+
return __generator(this, function (_b) {
|
|
30196
|
+
switch (_b.label) {
|
|
30197
|
+
case 0: return [4 /*yield*/, this.count(this.defaultFilter())];
|
|
30198
|
+
case 1:
|
|
30199
|
+
count = _b.sent();
|
|
30200
|
+
if (count && this._debug) {
|
|
30201
|
+
console.debug(this._logPrefix + "Received " + count + " unread notifications");
|
|
30202
|
+
}
|
|
30203
|
+
this._count$.next(count);
|
|
30204
|
+
return [2 /*return*/];
|
|
30205
|
+
}
|
|
30206
|
+
});
|
|
30207
|
+
}); }));
|
|
30156
30208
|
return _this;
|
|
30157
30209
|
}
|
|
30158
|
-
|
|
30159
|
-
|
|
30160
|
-
|
|
30161
|
-
|
|
30162
|
-
|
|
30163
|
-
|
|
30164
|
-
|
|
30165
|
-
|
|
30166
|
-
|
|
30167
|
-
|
|
30168
|
-
|
|
30210
|
+
Object.defineProperty(AbstractUserEventService.prototype, "userEventCount", {
|
|
30211
|
+
get: function () {
|
|
30212
|
+
return this._count$.asObservable();
|
|
30213
|
+
},
|
|
30214
|
+
enumerable: false,
|
|
30215
|
+
configurable: true
|
|
30216
|
+
});
|
|
30217
|
+
AbstractUserEventService.prototype.ngOnDestroy = function () {
|
|
30218
|
+
this._subscriptions.unsubscribe();
|
|
30219
|
+
};
|
|
30220
|
+
AbstractUserEventService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
|
|
30169
30221
|
return this.watchPage({ offset: offset, size: size, sortBy: sortBy, sortDirection: sortDirection }, filter, options);
|
|
30170
30222
|
};
|
|
30171
|
-
|
|
30223
|
+
AbstractUserEventService.prototype.watchPage = function (page, filter, options) {
|
|
30224
|
+
var _this = this;
|
|
30225
|
+
var _a;
|
|
30172
30226
|
var now = this._debug && Date.now();
|
|
30173
30227
|
//if (this._debug)
|
|
30174
|
-
console.debug(
|
|
30228
|
+
console.debug(this._logPrefix + "Loading user events...", filter);
|
|
30175
30229
|
filter = this.asFilter(filter);
|
|
30176
30230
|
// Force recipient to current issuer, if not admin and not specified
|
|
30177
|
-
if (
|
|
30178
|
-
var recipient = this.
|
|
30179
|
-
if (
|
|
30231
|
+
if (isEmptyArray(filter.recipients) || !this.accountService.isAdmin()) {
|
|
30232
|
+
var recipient = this.defaultRecipient();
|
|
30233
|
+
if (!((_a = filter.recipients) === null || _a === void 0 ? void 0 : _a.includes(recipient))) {
|
|
30180
30234
|
console.warn('[user-events-service] Force user event filter.recipient=' + recipient);
|
|
30181
|
-
filter.
|
|
30235
|
+
filter.recipients = [recipient];
|
|
30182
30236
|
}
|
|
30183
30237
|
}
|
|
30184
|
-
var withContent = options
|
|
30238
|
+
var withContent = (options === null || options === void 0 ? void 0 : options.withContent) === true;
|
|
30185
30239
|
return this.mutableWatchQuery({
|
|
30186
30240
|
queryName: withContent ? 'LoadAllWithContent' : 'LoadAll',
|
|
30187
|
-
query: withContent ?
|
|
30241
|
+
query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
|
|
30188
30242
|
variables: {
|
|
30189
|
-
page: Object.assign(
|
|
30243
|
+
page: Object.assign({ sortBy: 'updateDate', sortDirection: 'desc' }, page),
|
|
30190
30244
|
filter: filter && filter.asPodObject()
|
|
30191
30245
|
},
|
|
30192
30246
|
arrayFieldName: 'data',
|
|
30193
30247
|
error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
|
|
30194
|
-
fetchPolicy: options
|
|
30248
|
+
fetchPolicy: (options === null || options === void 0 ? void 0 : options.fetchPolicy) || "cache-first"
|
|
30195
30249
|
})
|
|
30196
30250
|
.pipe(operators.map(function (res) {
|
|
30197
|
-
var data = res
|
|
30251
|
+
var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(_this.processUserEvent);
|
|
30198
30252
|
if (now) {
|
|
30199
|
-
console.debug("
|
|
30253
|
+
console.debug("" + _this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
|
|
30200
30254
|
now = null;
|
|
30201
30255
|
}
|
|
30256
|
+
var unreadCount = _this.unreadEvents(data);
|
|
30202
30257
|
return {
|
|
30203
30258
|
data: data,
|
|
30204
|
-
total: res
|
|
30259
|
+
total: toNumber(res === null || res === void 0 ? void 0 : res.total, unreadCount)
|
|
30205
30260
|
};
|
|
30206
30261
|
}));
|
|
30207
30262
|
};
|
|
30208
|
-
|
|
30209
|
-
|
|
30210
|
-
|
|
30211
|
-
|
|
30263
|
+
AbstractUserEventService.prototype.add = function (entity) {
|
|
30264
|
+
// TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
|
|
30265
|
+
entity = this.processUserEvent(entity);
|
|
30266
|
+
var withContent = !!entity.content;
|
|
30267
|
+
// Add user event locally
|
|
30268
|
+
this.insertIntoMutableCachedQueries(this.graphql.cache, {
|
|
30269
|
+
query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
|
|
30270
|
+
data: entity
|
|
30271
|
+
});
|
|
30272
|
+
// Update count
|
|
30273
|
+
this._count$.next(this._count$.value + 1);
|
|
30212
30274
|
};
|
|
30213
|
-
|
|
30214
|
-
|
|
30215
|
-
*
|
|
30216
|
-
* @param entity
|
|
30217
|
-
*/
|
|
30218
|
-
UserEventService.prototype.save = function (entity, options) {
|
|
30275
|
+
AbstractUserEventService.prototype.count = function (filter, options) {
|
|
30276
|
+
var _a;
|
|
30219
30277
|
return __awaiter(this, void 0, void 0, function () {
|
|
30220
|
-
var
|
|
30221
|
-
|
|
30222
|
-
|
|
30223
|
-
switch (_a.label) {
|
|
30278
|
+
var res;
|
|
30279
|
+
return __generator(this, function (_b) {
|
|
30280
|
+
switch (_b.label) {
|
|
30224
30281
|
case 0:
|
|
30225
|
-
this.
|
|
30226
|
-
|
|
30227
|
-
|
|
30228
|
-
|
|
30282
|
+
if (!((_a = this.queries) === null || _a === void 0 ? void 0 : _a.count)) {
|
|
30283
|
+
console.warn(this._logPrefix + "Query 'count' not provided, skip.");
|
|
30284
|
+
return [2 /*return*/, undefined];
|
|
30285
|
+
}
|
|
30286
|
+
if (!filter)
|
|
30287
|
+
throw new Error("Missing argument 'filter'");
|
|
30288
|
+
filter = this.asFilter(filter);
|
|
30229
30289
|
if (this._debug)
|
|
30230
|
-
console.debug("
|
|
30231
|
-
return [4 /*yield*/, this.graphql.
|
|
30232
|
-
|
|
30290
|
+
console.debug(this._logPrefix + "Counting user events with filter:", filter);
|
|
30291
|
+
return [4 /*yield*/, this.graphql.query({
|
|
30292
|
+
query: this.queries.count,
|
|
30233
30293
|
variables: {
|
|
30234
|
-
|
|
30294
|
+
filter: filter.asPodObject()
|
|
30235
30295
|
},
|
|
30236
|
-
error: { code: SocialErrorCodes.
|
|
30237
|
-
|
|
30238
|
-
var data = _a.data;
|
|
30239
|
-
// Update entity
|
|
30240
|
-
var savedEntity = data && data.data;
|
|
30241
|
-
if (savedEntity) {
|
|
30242
|
-
if (_this._debug)
|
|
30243
|
-
console.debug("[user-event-service] User event saved in " + (Date.now() - now) + "ms", entity);
|
|
30244
|
-
_this.copyIdAndUpdateDate(savedEntity, entity);
|
|
30245
|
-
// Add to cache
|
|
30246
|
-
if (isNew) {
|
|
30247
|
-
_this.insertIntoMutableCachedQueries(proxy, {
|
|
30248
|
-
query: LoadAllQuery,
|
|
30249
|
-
data: Object.assign(Object.assign({}, savedEntity), { content: null })
|
|
30250
|
-
});
|
|
30251
|
-
_this.insertIntoMutableCachedQueries(proxy, {
|
|
30252
|
-
query: LoadAllWithContentQuery,
|
|
30253
|
-
data: savedEntity
|
|
30254
|
-
});
|
|
30255
|
-
}
|
|
30256
|
-
}
|
|
30257
|
-
}
|
|
30296
|
+
error: { code: SocialErrorCodes.COUNT_USER_EVENT_ERROR, message: 'SOCIAL.ERROR.COUNT_USER_EVENT_ERROR' },
|
|
30297
|
+
fetchPolicy: (options === null || options === void 0 ? void 0 : options.fetchPolicy) || 'network-only'
|
|
30258
30298
|
})];
|
|
30259
30299
|
case 1:
|
|
30260
|
-
|
|
30261
|
-
return [2 /*return*/,
|
|
30300
|
+
res = _b.sent();
|
|
30301
|
+
return [2 /*return*/, res.total];
|
|
30262
30302
|
}
|
|
30263
30303
|
});
|
|
30264
30304
|
});
|
|
30265
30305
|
};
|
|
30266
|
-
|
|
30267
|
-
|
|
30268
|
-
|
|
30269
|
-
|
|
30270
|
-
|
|
30271
|
-
|
|
30272
|
-
|
|
30306
|
+
AbstractUserEventService.prototype.listenChanges = function (filter, options) {
|
|
30307
|
+
var _this = this;
|
|
30308
|
+
var _a;
|
|
30309
|
+
if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.listenChanges)) {
|
|
30310
|
+
console.warn(this._logPrefix + "Subscription query 'listenChanges' not provided, skip.");
|
|
30311
|
+
return rxjs.of();
|
|
30312
|
+
}
|
|
30313
|
+
if (!filter)
|
|
30314
|
+
throw new Error("Missing argument 'filter'");
|
|
30315
|
+
filter = this.asFilter(filter);
|
|
30316
|
+
var withContent = (options === null || options === void 0 ? void 0 : options.withContent) === true;
|
|
30317
|
+
if (this._debug)
|
|
30318
|
+
console.debug(this._logPrefix + "[WS] Listening changes for user events with filter:", filter);
|
|
30319
|
+
return this.graphql.subscribe({
|
|
30320
|
+
query: this.subscriptions.listenChanges,
|
|
30321
|
+
fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
|
|
30322
|
+
variables: { filter: filter.asPodObject(), interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
|
|
30323
|
+
error: {
|
|
30324
|
+
code: SocialErrorCodes.SUBSCRIBE_USER_EVENTS_ERROR,
|
|
30325
|
+
message: 'SOCIAL.ERROR.SUBSCRIBE_USER_EVENTS_ERROR'
|
|
30326
|
+
}
|
|
30327
|
+
}).pipe(operators.map(function (_b) {
|
|
30328
|
+
var data = _b.data;
|
|
30329
|
+
if (data && _this._debug)
|
|
30330
|
+
console.debug(_this._logPrefix + "Received new user events:", data);
|
|
30331
|
+
var updatedData = data === null || data === void 0 ? void 0 : data.map(_this.processUserEvent);
|
|
30332
|
+
// Update cache
|
|
30333
|
+
_this.insertIntoMutableCachedQueries(_this.graphql.cache, {
|
|
30334
|
+
query: withContent ? _this.queries.loadAllWithContent : _this.queries.loadAll,
|
|
30335
|
+
data: updatedData
|
|
30336
|
+
});
|
|
30337
|
+
// update count
|
|
30338
|
+
_this._count$.next(_this.unreadEvents(updatedData));
|
|
30339
|
+
return updatedData;
|
|
30340
|
+
}));
|
|
30341
|
+
};
|
|
30342
|
+
AbstractUserEventService.prototype.delete = function (entity) {
|
|
30343
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30344
|
+
return __generator(this, function (_b) {
|
|
30345
|
+
switch (_b.label) {
|
|
30346
|
+
case 0:
|
|
30347
|
+
if (!entity)
|
|
30348
|
+
return [2 /*return*/]; // skip
|
|
30349
|
+
return [4 /*yield*/, this.deleteAll([entity])];
|
|
30350
|
+
case 1:
|
|
30351
|
+
_b.sent();
|
|
30352
|
+
return [2 /*return*/];
|
|
30353
|
+
}
|
|
30354
|
+
});
|
|
30355
|
+
});
|
|
30356
|
+
};
|
|
30357
|
+
AbstractUserEventService.prototype.deleteAll = function (entities, opts) {
|
|
30273
30358
|
return __awaiter(this, void 0, void 0, function () {
|
|
30274
30359
|
var ids, now;
|
|
30275
30360
|
var _this = this;
|
|
30276
|
-
return __generator(this, function (
|
|
30277
|
-
switch (
|
|
30361
|
+
return __generator(this, function (_b) {
|
|
30362
|
+
switch (_b.label) {
|
|
30278
30363
|
case 0:
|
|
30279
30364
|
ids = entities && entities
|
|
30280
30365
|
.map(function (t) { return t.id; });
|
|
@@ -30282,68 +30367,255 @@
|
|
|
30282
30367
|
return [2 /*return*/]; // stop, if nothing else to do
|
|
30283
30368
|
now = Date.now();
|
|
30284
30369
|
if (this._debug)
|
|
30285
|
-
console.debug(
|
|
30370
|
+
console.debug(this._logPrefix + "Deleting events... ids:", ids);
|
|
30286
30371
|
return [4 /*yield*/, this.graphql.mutate({
|
|
30287
|
-
mutation:
|
|
30372
|
+
mutation: this.mutations.deleteByIds,
|
|
30288
30373
|
variables: {
|
|
30289
30374
|
ids: ids
|
|
30290
30375
|
},
|
|
30291
30376
|
update: function (proxy) {
|
|
30292
30377
|
// Remove from caches
|
|
30293
30378
|
_this.removeFromMutableCachedQueriesByIds(proxy, {
|
|
30294
|
-
query:
|
|
30379
|
+
query: _this.queries.loadAll,
|
|
30295
30380
|
ids: ids
|
|
30296
30381
|
});
|
|
30297
30382
|
_this.removeFromMutableCachedQueriesByIds(proxy, {
|
|
30298
|
-
query:
|
|
30383
|
+
query: _this.queries.loadAllWithContent,
|
|
30299
30384
|
ids: ids
|
|
30300
30385
|
});
|
|
30301
30386
|
if (_this._debug)
|
|
30302
|
-
console.debug("
|
|
30387
|
+
console.debug(_this._logPrefix + "Events deleted in " + (Date.now() - now) + "ms");
|
|
30303
30388
|
}
|
|
30304
30389
|
})];
|
|
30305
30390
|
case 1:
|
|
30306
|
-
|
|
30391
|
+
_b.sent();
|
|
30307
30392
|
return [2 /*return*/];
|
|
30308
30393
|
}
|
|
30309
30394
|
});
|
|
30310
30395
|
});
|
|
30311
30396
|
};
|
|
30312
|
-
|
|
30313
|
-
* Delete userEvent entities
|
|
30314
|
-
*/
|
|
30315
|
-
UserEventService.prototype.delete = function (data) {
|
|
30397
|
+
AbstractUserEventService.prototype.save = function (entity, options) {
|
|
30316
30398
|
return __awaiter(this, void 0, void 0, function () {
|
|
30317
|
-
|
|
30318
|
-
|
|
30399
|
+
var isNew, json, now;
|
|
30400
|
+
var _this = this;
|
|
30401
|
+
return __generator(this, function (_b) {
|
|
30402
|
+
switch (_b.label) {
|
|
30319
30403
|
case 0:
|
|
30320
|
-
|
|
30321
|
-
|
|
30322
|
-
|
|
30404
|
+
this.fillDefaultProperties(entity);
|
|
30405
|
+
isNew = isNil(entity.id);
|
|
30406
|
+
json = entity.asObject();
|
|
30407
|
+
now = Date.now();
|
|
30408
|
+
if (this._debug)
|
|
30409
|
+
console.debug(this._logPrefix + "Saving user event...", json);
|
|
30410
|
+
return [4 /*yield*/, this.graphql.mutate({
|
|
30411
|
+
mutation: this.mutations.save,
|
|
30412
|
+
variables: {
|
|
30413
|
+
data: json
|
|
30414
|
+
},
|
|
30415
|
+
error: { code: SocialErrorCodes.SAVE_USER_EVENT_ERROR, message: 'SOCIAL.ERROR.SAVE_USER_EVENT_ERROR' },
|
|
30416
|
+
update: function (proxy, _b) {
|
|
30417
|
+
var data = _b.data;
|
|
30418
|
+
// Update entity
|
|
30419
|
+
var savedEntity = data && data.data;
|
|
30420
|
+
if (savedEntity) {
|
|
30421
|
+
if (_this._debug)
|
|
30422
|
+
console.debug(_this._logPrefix + "User event saved in " + (Date.now() - now) + "ms", entity);
|
|
30423
|
+
_this.copyIdAndUpdateDate(savedEntity, entity);
|
|
30424
|
+
// Add to cache
|
|
30425
|
+
if (isNew) {
|
|
30426
|
+
_this.insertIntoMutableCachedQueries(proxy, {
|
|
30427
|
+
query: _this.queries.loadAll,
|
|
30428
|
+
data: Object.assign(Object.assign({}, savedEntity), { content: null })
|
|
30429
|
+
});
|
|
30430
|
+
_this.insertIntoMutableCachedQueries(proxy, {
|
|
30431
|
+
query: _this.queries.loadAllWithContent,
|
|
30432
|
+
data: savedEntity
|
|
30433
|
+
});
|
|
30434
|
+
}
|
|
30435
|
+
}
|
|
30436
|
+
}
|
|
30437
|
+
})];
|
|
30323
30438
|
case 1:
|
|
30324
|
-
|
|
30325
|
-
return [2 /*return
|
|
30439
|
+
_b.sent();
|
|
30440
|
+
return [2 /*return*/, entity];
|
|
30441
|
+
}
|
|
30442
|
+
});
|
|
30443
|
+
});
|
|
30444
|
+
};
|
|
30445
|
+
AbstractUserEventService.prototype.saveAll = function (data, opts) {
|
|
30446
|
+
var _this = this;
|
|
30447
|
+
return Promise.all(data
|
|
30448
|
+
.map(function (entity) { return _this.save(entity, opts); }));
|
|
30449
|
+
};
|
|
30450
|
+
AbstractUserEventService.prototype.markAsRead = function (entity) {
|
|
30451
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30452
|
+
var onReadListeners, onReadListeners_1, onReadListeners_1_1, listener, e_1_1;
|
|
30453
|
+
var e_1, _b;
|
|
30454
|
+
return __generator(this, function (_c) {
|
|
30455
|
+
switch (_c.label) {
|
|
30456
|
+
case 0:
|
|
30457
|
+
onReadListeners = (this.listeners || []).filter(function (listener) { return !!listener.onRead; }).filter(function (listener) { return listener.accept(entity); });
|
|
30458
|
+
if (!onReadListeners.length) return [3 /*break*/, 9];
|
|
30459
|
+
_c.label = 1;
|
|
30460
|
+
case 1:
|
|
30461
|
+
_c.trys.push([1, 6, 7, 8]);
|
|
30462
|
+
onReadListeners_1 = __values(onReadListeners), onReadListeners_1_1 = onReadListeners_1.next();
|
|
30463
|
+
_c.label = 2;
|
|
30464
|
+
case 2:
|
|
30465
|
+
if (!!onReadListeners_1_1.done) return [3 /*break*/, 5];
|
|
30466
|
+
listener = onReadListeners_1_1.value;
|
|
30467
|
+
return [4 /*yield*/, listener.onRead(entity)];
|
|
30468
|
+
case 3:
|
|
30469
|
+
_c.sent();
|
|
30470
|
+
_c.label = 4;
|
|
30471
|
+
case 4:
|
|
30472
|
+
onReadListeners_1_1 = onReadListeners_1.next();
|
|
30473
|
+
return [3 /*break*/, 2];
|
|
30474
|
+
case 5: return [3 /*break*/, 8];
|
|
30475
|
+
case 6:
|
|
30476
|
+
e_1_1 = _c.sent();
|
|
30477
|
+
e_1 = { error: e_1_1 };
|
|
30478
|
+
return [3 /*break*/, 8];
|
|
30479
|
+
case 7:
|
|
30480
|
+
try {
|
|
30481
|
+
if (onReadListeners_1_1 && !onReadListeners_1_1.done && (_b = onReadListeners_1.return)) _b.call(onReadListeners_1);
|
|
30482
|
+
}
|
|
30483
|
+
finally { if (e_1) throw e_1.error; }
|
|
30484
|
+
return [7 /*endfinally*/];
|
|
30485
|
+
case 8: return [3 /*break*/, 11];
|
|
30486
|
+
case 9:
|
|
30487
|
+
// Use default
|
|
30488
|
+
return [4 /*yield*/, this.defaultMarkAsRead(entity)];
|
|
30489
|
+
case 10:
|
|
30490
|
+
// Use default
|
|
30491
|
+
_c.sent();
|
|
30492
|
+
_c.label = 11;
|
|
30493
|
+
case 11: return [2 /*return*/];
|
|
30494
|
+
}
|
|
30495
|
+
});
|
|
30496
|
+
});
|
|
30497
|
+
};
|
|
30498
|
+
AbstractUserEventService.prototype.registerListener = function (listener) {
|
|
30499
|
+
if (!this.listeners)
|
|
30500
|
+
this.listeners = [];
|
|
30501
|
+
this.listeners.push(listener);
|
|
30502
|
+
};
|
|
30503
|
+
/* -- protected methods -- */
|
|
30504
|
+
AbstractUserEventService.prototype.processUserEvent = function (source) {
|
|
30505
|
+
var e_2, _b;
|
|
30506
|
+
// Convert json source to IUserEvent
|
|
30507
|
+
var target = this.fromObject(source);
|
|
30508
|
+
// Get listeners
|
|
30509
|
+
var listeners = (this.listeners || []).filter(function (listener) { return listener.onReceived; }).filter(function (listener) { return listener.accept(target); });
|
|
30510
|
+
try {
|
|
30511
|
+
for (var listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next(); !listeners_1_1.done; listeners_1_1 = listeners_1.next()) {
|
|
30512
|
+
var listener = listeners_1_1.value;
|
|
30513
|
+
if (target) {
|
|
30514
|
+
target = listener.onReceived(target);
|
|
30515
|
+
}
|
|
30516
|
+
else {
|
|
30517
|
+
if (this._debug)
|
|
30518
|
+
console.debug(this._logPrefix + "Event has been rejected by a listener", source);
|
|
30519
|
+
break;
|
|
30520
|
+
}
|
|
30521
|
+
}
|
|
30522
|
+
}
|
|
30523
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
30524
|
+
finally {
|
|
30525
|
+
try {
|
|
30526
|
+
if (listeners_1_1 && !listeners_1_1.done && (_b = listeners_1.return)) _b.call(listeners_1);
|
|
30527
|
+
}
|
|
30528
|
+
finally { if (e_2) throw e_2.error; }
|
|
30529
|
+
}
|
|
30530
|
+
return target;
|
|
30531
|
+
};
|
|
30532
|
+
AbstractUserEventService.prototype.defaultMarkAsRead = function (userEvent) {
|
|
30533
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30534
|
+
return __generator(this, function (_b) {
|
|
30535
|
+
switch (_b.label) {
|
|
30536
|
+
case 0:
|
|
30537
|
+
if (!userEvent)
|
|
30538
|
+
throw new Error(this._logPrefix + "Invalid event to save");
|
|
30539
|
+
// set read date
|
|
30540
|
+
userEvent.readDate = moment$6();
|
|
30541
|
+
if (!(!userEvent.id || userEvent.id < 0)) return [3 /*break*/, 1];
|
|
30542
|
+
if (this._debug)
|
|
30543
|
+
console.debug(this._logPrefix + "Save local user event");
|
|
30544
|
+
return [3 /*break*/, 3];
|
|
30545
|
+
case 1: return [4 /*yield*/, this.save(userEvent)];
|
|
30546
|
+
case 2:
|
|
30547
|
+
_b.sent();
|
|
30548
|
+
_b.label = 3;
|
|
30549
|
+
case 3: return [2 /*return*/];
|
|
30326
30550
|
}
|
|
30327
30551
|
});
|
|
30328
30552
|
});
|
|
30329
30553
|
};
|
|
30330
|
-
|
|
30331
|
-
//
|
|
30332
|
-
|
|
30333
|
-
|
|
30554
|
+
AbstractUserEventService.prototype.defaultFilter = function () {
|
|
30555
|
+
// By default
|
|
30556
|
+
return {
|
|
30557
|
+
recipients: [this.defaultRecipient()]
|
|
30558
|
+
};
|
|
30334
30559
|
};
|
|
30335
|
-
|
|
30336
|
-
|
|
30337
|
-
this._userEventActions.push(definition);
|
|
30560
|
+
AbstractUserEventService.prototype.defaultRecipient = function () {
|
|
30561
|
+
return this.accountService.person.pubkey;
|
|
30338
30562
|
};
|
|
30339
|
-
|
|
30340
|
-
return this._userEventActions.filter(function (def) { return def.__typename === typename; });
|
|
30563
|
+
AbstractUserEventService.prototype.fillDefaultProperties = function (entity) {
|
|
30341
30564
|
};
|
|
30565
|
+
AbstractUserEventService.prototype.unreadEvents = function (events) {
|
|
30566
|
+
// default calculation on unread events from a list
|
|
30567
|
+
if (isEmptyArray(events))
|
|
30568
|
+
return undefined;
|
|
30569
|
+
var lastReadDate = events
|
|
30570
|
+
.filter(function (event) { return isNotNil(event.readDate); })
|
|
30571
|
+
.reduce(function (lastDate, event) { return DateUtils.max(lastDate, event.readDate); }, undefined);
|
|
30572
|
+
return events
|
|
30573
|
+
.filter(function (event) { return event.creationDate.isSameOrAfter(lastReadDate); }).length;
|
|
30574
|
+
};
|
|
30575
|
+
AbstractUserEventService.prototype.copyIdAndUpdateDate = function (source, target) {
|
|
30576
|
+
EntityUtils.copyIdAndUpdateDate(source, target);
|
|
30577
|
+
};
|
|
30578
|
+
return AbstractUserEventService;
|
|
30579
|
+
}(BaseGraphqlService));
|
|
30580
|
+
AbstractUserEventService.decorators = [
|
|
30581
|
+
{ type: i0.Directive }
|
|
30582
|
+
];
|
|
30583
|
+
AbstractUserEventService.ctorParameters = function () { return [
|
|
30584
|
+
{ type: GraphqlService },
|
|
30585
|
+
{ type: AccountService },
|
|
30586
|
+
{ type: NetworkService },
|
|
30587
|
+
{ type: i1$2.TranslateService },
|
|
30588
|
+
{ type: i1$5.ToastController },
|
|
30589
|
+
{ type: undefined },
|
|
30590
|
+
{ type: undefined },
|
|
30591
|
+
{ type: undefined },
|
|
30592
|
+
{ type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
30593
|
+
]; };
|
|
30594
|
+
var userEventQueries = {
|
|
30595
|
+
loadAll: core.gql(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n query UserEvents($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...LightUserEventFragment\n }\n }\n ", "\n "], ["\n query UserEvents($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...LightUserEventFragment\n }\n }\n ", "\n "])), UserEventFragments.lightUserEvent),
|
|
30596
|
+
loadAllWithContent: core.gql(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n query UserEventsWithContent($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...UserEventFragment\n }\n }\n ", "\n "], ["\n query UserEventsWithContent($filter: UserEventFilterVOInput, $page: PageInput){\n data: userEvents(filter: $filter, page: $page){\n ...UserEventFragment\n }\n }\n ", "\n "])), UserEventFragments.userEvent)
|
|
30597
|
+
};
|
|
30598
|
+
var userEventMutations = {
|
|
30599
|
+
deleteByIds: core.gql(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n "], ["\n mutation DeleteUserEvents($ids:[Int]){\n deleteUserEvents(ids: $ids)\n }\n "]))),
|
|
30600
|
+
save: core.gql(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n mutation SaveUserEvent($data: UserEventVOInput){\n data: saveUserEvent(userEvent: $data){\n ...UserEventFragment\n }\n }\n ", "\n "], ["\n mutation SaveUserEvent($data: UserEventVOInput){\n data: saveUserEvent(userEvent: $data){\n ...UserEventFragment\n }\n }\n ", "\n "])), UserEventFragments.userEvent)
|
|
30601
|
+
};
|
|
30602
|
+
var UserEventService = /** @class */ (function (_super) {
|
|
30603
|
+
__extends(UserEventService, _super);
|
|
30604
|
+
function UserEventService(graphql, accountService, network, translate, toastController, environment) {
|
|
30605
|
+
var _this = _super.call(this, graphql, accountService, network, translate, toastController, userEventQueries, userEventMutations, undefined, environment) || this;
|
|
30606
|
+
_this.graphql = graphql;
|
|
30607
|
+
_this.accountService = accountService;
|
|
30608
|
+
_this.network = network;
|
|
30609
|
+
_this.translate = translate;
|
|
30610
|
+
_this.toastController = toastController;
|
|
30611
|
+
_this.environment = environment;
|
|
30612
|
+
return _this;
|
|
30613
|
+
}
|
|
30342
30614
|
UserEventService.prototype.showToastErrorWithContext = function (opts) {
|
|
30343
30615
|
return __awaiter(this, void 0, void 0, function () {
|
|
30344
30616
|
var message, res, context, userEvent, err_1;
|
|
30345
|
-
return __generator(this, function (
|
|
30346
|
-
switch (
|
|
30617
|
+
return __generator(this, function (_b) {
|
|
30618
|
+
switch (_b.label) {
|
|
30347
30619
|
case 0:
|
|
30348
30620
|
message = opts.message || (opts.error && opts.error.message || opts.error);
|
|
30349
30621
|
// Make sure message a string
|
|
@@ -30372,12 +30644,12 @@
|
|
|
30372
30644
|
}]
|
|
30373
30645
|
})];
|
|
30374
30646
|
case 1:
|
|
30375
|
-
res =
|
|
30647
|
+
res = _b.sent();
|
|
30376
30648
|
if (!res || res.role !== 'send')
|
|
30377
30649
|
return [2 /*return*/];
|
|
30378
|
-
|
|
30650
|
+
_b.label = 2;
|
|
30379
30651
|
case 2:
|
|
30380
|
-
|
|
30652
|
+
_b.trys.push([2, 6, , 7]);
|
|
30381
30653
|
if (this._debug)
|
|
30382
30654
|
console.debug('Sending debug data...');
|
|
30383
30655
|
context = opts && opts.context;
|
|
@@ -30387,15 +30659,15 @@
|
|
|
30387
30659
|
if (!(context instanceof Promise)) return [3 /*break*/, 4];
|
|
30388
30660
|
return [4 /*yield*/, context];
|
|
30389
30661
|
case 3:
|
|
30390
|
-
context =
|
|
30391
|
-
|
|
30662
|
+
context = _b.sent();
|
|
30663
|
+
_b.label = 4;
|
|
30392
30664
|
case 4: return [4 /*yield*/, this.sendDataForDebug({
|
|
30393
30665
|
message: message,
|
|
30394
30666
|
error: opts.error || undefined,
|
|
30395
30667
|
context: this.convertObjectToString(context)
|
|
30396
30668
|
})];
|
|
30397
30669
|
case 5:
|
|
30398
|
-
userEvent =
|
|
30670
|
+
userEvent = _b.sent();
|
|
30399
30671
|
console.info('Debug data successfully sent to admin', userEvent);
|
|
30400
30672
|
this.showToast({
|
|
30401
30673
|
type: 'info',
|
|
@@ -30404,7 +30676,7 @@
|
|
|
30404
30676
|
});
|
|
30405
30677
|
return [3 /*break*/, 7];
|
|
30406
30678
|
case 6:
|
|
30407
|
-
err_1 =
|
|
30679
|
+
err_1 = _b.sent();
|
|
30408
30680
|
console.error('Error while sending debug data:', err_1);
|
|
30409
30681
|
return [3 /*break*/, 7];
|
|
30410
30682
|
case 7: return [2 /*return*/];
|
|
@@ -30414,13 +30686,16 @@
|
|
|
30414
30686
|
};
|
|
30415
30687
|
UserEventService.prototype.sendDataForDebug = function (data) {
|
|
30416
30688
|
var userEvent = new exports.UserEvent();
|
|
30417
|
-
userEvent.
|
|
30689
|
+
userEvent.type = UserEventTypes.DEBUG_DATA;
|
|
30418
30690
|
userEvent.content = this.convertObjectToString(data);
|
|
30419
30691
|
return this.save(userEvent);
|
|
30420
30692
|
};
|
|
30421
30693
|
UserEventService.prototype.asFilter = function (filter) {
|
|
30422
30694
|
return exports.UserEventFilter.fromObject(filter);
|
|
30423
30695
|
};
|
|
30696
|
+
UserEventService.prototype.fromObject = function (source) {
|
|
30697
|
+
return exports.UserEvent.fromObject(source);
|
|
30698
|
+
};
|
|
30424
30699
|
/* -- protected methods -- */
|
|
30425
30700
|
UserEventService.prototype.convertObjectToString = function (data) {
|
|
30426
30701
|
if (typeof data === 'string') {
|
|
@@ -30438,13 +30713,13 @@
|
|
|
30438
30713
|
};
|
|
30439
30714
|
UserEventService.prototype.showToast = function (opts) {
|
|
30440
30715
|
return __awaiter(this, void 0, void 0, function () {
|
|
30441
|
-
return __generator(this, function (
|
|
30442
|
-
switch (
|
|
30716
|
+
return __generator(this, function (_b) {
|
|
30717
|
+
switch (_b.label) {
|
|
30443
30718
|
case 0:
|
|
30444
30719
|
if (!this.toastController)
|
|
30445
30720
|
throw new Error('Missing toastController in component\'s constructor');
|
|
30446
30721
|
return [4 /*yield*/, Toasts.show(this.toastController, this.translate, opts)];
|
|
30447
|
-
case 1: return [2 /*return*/,
|
|
30722
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
30448
30723
|
}
|
|
30449
30724
|
});
|
|
30450
30725
|
});
|
|
@@ -30455,14 +30730,10 @@
|
|
|
30455
30730
|
// TODO: compute sign
|
|
30456
30731
|
console.warn('TODO: sign user event before sending');
|
|
30457
30732
|
};
|
|
30458
|
-
UserEventService.prototype.copyIdAndUpdateDate = function (source, target) {
|
|
30459
|
-
EntityUtils.copyIdAndUpdateDate(source, target);
|
|
30460
|
-
};
|
|
30461
30733
|
return UserEventService;
|
|
30462
|
-
}(
|
|
30463
|
-
UserEventService.ɵprov = i0.ɵɵdefineInjectable({ factory: function UserEventService_Factory() { return new UserEventService(i0.ɵɵinject(GraphqlService), i0.ɵɵinject(AccountService), i0.ɵɵinject(NetworkService), i0.ɵɵinject(i1$2.TranslateService), i0.ɵɵinject(i1$5.ToastController), i0.ɵɵinject(ENVIRONMENT, 8)); }, token: UserEventService, providedIn: "root" });
|
|
30734
|
+
}(AbstractUserEventService));
|
|
30464
30735
|
UserEventService.decorators = [
|
|
30465
|
-
{ type: i0.Injectable
|
|
30736
|
+
{ type: i0.Injectable }
|
|
30466
30737
|
];
|
|
30467
30738
|
UserEventService.ctorParameters = function () { return [
|
|
30468
30739
|
{ type: GraphqlService },
|
|
@@ -30476,7 +30747,7 @@
|
|
|
30476
30747
|
|
|
30477
30748
|
var ICONS_MAP = {
|
|
30478
30749
|
DEBUG_DATA: { matIcon: 'bug_report' },
|
|
30479
|
-
INBOX_MESSAGE: { matIcon: 'mail' }
|
|
30750
|
+
INBOX_MESSAGE: { matIcon: 'mail' }
|
|
30480
30751
|
};
|
|
30481
30752
|
// TODO: refactor with a registration done by data service:
|
|
30482
30753
|
// - userEventService.registerEventAction({__typename: 'TripVO', ...})
|
|
@@ -30544,7 +30815,7 @@
|
|
|
30544
30815
|
}
|
|
30545
30816
|
}));
|
|
30546
30817
|
var filter = this.filter || new exports.UserEventFilter();
|
|
30547
|
-
filter.
|
|
30818
|
+
filter.recipients = [this.recipient];
|
|
30548
30819
|
this.setFilter(filter, { emitEvent: true });
|
|
30549
30820
|
};
|
|
30550
30821
|
UserEventsTable.prototype.start = function () {
|
|
@@ -30566,17 +30837,17 @@
|
|
|
30566
30837
|
});
|
|
30567
30838
|
};
|
|
30568
30839
|
UserEventsTable.prototype.getIcon = function (source) {
|
|
30569
|
-
return ICONS_MAP[source.
|
|
30840
|
+
return ICONS_MAP[source.type];
|
|
30570
30841
|
};
|
|
30571
30842
|
UserEventsTable.prototype.getDetail = function (source) {
|
|
30572
30843
|
if (!source)
|
|
30573
30844
|
return undefined;
|
|
30574
|
-
if (source.content && source.
|
|
30845
|
+
if (source.content && source.type === UserEventTypes.DEBUG_DATA) {
|
|
30575
30846
|
var context = source.content.context;
|
|
30576
30847
|
if (context && context.__typename) {
|
|
30577
|
-
|
|
30848
|
+
// const actions = this.service.getActionsByTypename(context.__typename);
|
|
30578
30849
|
return {
|
|
30579
|
-
|
|
30850
|
+
// actions,
|
|
30580
30851
|
title: source.content.error && source.content.error.message || source.content.message,
|
|
30581
30852
|
description: source.content.error && source.content.error.details || undefined
|
|
30582
30853
|
};
|
|
@@ -30587,18 +30858,18 @@
|
|
|
30587
30858
|
};
|
|
30588
30859
|
UserEventsTable.prototype.doAction = function (action, row) {
|
|
30589
30860
|
return __awaiter(this, void 0, void 0, function () {
|
|
30590
|
-
var event,
|
|
30861
|
+
var event, res, _a, err_1;
|
|
30591
30862
|
return __generator(this, function (_b) {
|
|
30592
30863
|
switch (_b.label) {
|
|
30593
30864
|
case 0:
|
|
30594
30865
|
event = row.currentData;
|
|
30595
|
-
context = event.content && event.content.context;
|
|
30866
|
+
// const context = event.content && event.content.context;
|
|
30596
30867
|
this.markAsLoading();
|
|
30597
30868
|
if (!(action && typeof action.executeAction === 'function')) return [3 /*break*/, 7];
|
|
30598
30869
|
_b.label = 1;
|
|
30599
30870
|
case 1:
|
|
30600
30871
|
_b.trys.push([1, 5, 6, 7]);
|
|
30601
|
-
res = action.executeAction(event
|
|
30872
|
+
res = action.executeAction(event /*, context*/);
|
|
30602
30873
|
if (!(res instanceof Promise)) return [3 /*break*/, 3];
|
|
30603
30874
|
return [4 /*yield*/, res];
|
|
30604
30875
|
case 2:
|
|
@@ -30630,13 +30901,18 @@
|
|
|
30630
30901
|
selector: 'app-user-events-table',
|
|
30631
30902
|
template: "\n<!-- Type = options menu -->\n<mat-menu #optionsMenu=\"matMenu\" xPosition=\"after\">\n\n <!-- display columns -->\n <button mat-menu-item\n (click)=\"openSelectColumnsModal($event)\">\n <mat-icon>view_column</mat-icon>\n <ion-label translate>COMMON.DISPLAYED_COLUMNS_DOTS</ion-label>\n </button>\n\n</mat-menu>\n\n<!-- top header -->\n<mat-toolbar>\n\n <ng-container *ngIf=\"!selection.hasValue(); else hasSelection\">\n\n <button mat-icon-button [title]=\"'COMMON.BTN_REFRESH'|translate\" (click)=\"onRefresh.emit()\">\n <mat-icon>refresh</mat-icon>\n </button>\n\n </ng-container>\n\n <!-- if row selection -->\n <ng-template #hasSelection>\n\n <!-- delete -->\n <button mat-icon-button class=\"hidden-xs hidden-sm\" *ngIf=\"canDelete\"\n [title]=\"'COMMON.BTN_DELETE'|translate\" (click)=\"deleteSelection($event)\">\n <mat-icon>delete</mat-icon>\n </button>\n </ng-template>\n\n <!-- error -->\n <ion-item *ngIf=\"error\" hidden-xs hidden-sm hidden-mobile lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"error\" [innerHTML]=\"error|translate\"></ion-label>\n </ion-item>\n\n <div class=\"toolbar-spacer\"></div>\n\n <button mat-icon-button\n [title]=\"'COMMON.BTN_OPTIONS'|translate\"\n [matMenuTriggerFor]=\"optionsMenu\">\n <mat-icon>more_vert</mat-icon>\n </button>\n</mat-toolbar>\n\n\n<mat-table [dataSource]=\"dataSource\" matSort\n [matSortActive]=\"defaultSortBy\"\n [matSortDirection]=\"defaultSortDirection\"\n matSortDisableClear [trackBy]=\"trackByFn\">\n\n <!-- select -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]=\"!canEdit\">\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\">\n </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\" [class.cdk-visually-hidden]=\"!canEdit\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null\" [checked]=\"selection.isSelected(row)\">\n </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n <!-- id -->\n <ng-container matColumnDef=\"id\">\n <mat-header-cell *matHeaderCellDef mat-sort-header [class.cdk-visually-hidden]=\"!isAdmin\">\n <app-loading-spinner [loading]=\"loadingSubject|async\"><ion-label>#</ion-label></app-loading-spinner>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\" [class.cdk-visually-hidden]=\"!isAdmin\">{{ row.currentData.id | mathAbs }}</mat-cell>\n </ng-container>\n\n <!-- creationDate -->\n <ng-container matColumnDef=\"creationDate\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>SOCIAL.USER_EVENT.CREATION_DATE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <ion-text>\n {{row.currentData.creationDate | dateFromNow }}<br/>\n <ion-text color=\"medium\"><small>{{row.currentData.creationDate | dateFormat: {time: true} }}</small></ion-text>\n </ion-text>\n </mat-cell>\n </ng-container>\n\n <!-- icon -->\n <ng-container matColumnDef=\"icon\">\n <mat-header-cell *matHeaderCellDef>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row;\">\n <ng-container *ngIf=\"getIcon(row.currentData); let details\">\n <ion-icon slot=\"start\" *ngIf=\"details.icon\" [name]=\"details.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"details.matIcon\">{{details.matIcon}}</mat-icon>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n <!-- event type -->\n <ng-container matColumnDef=\"eventType\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>SOCIAL.USER_EVENT.EVENT_TYPE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row;\">\n <span>{{'SOCIAL.USER_EVENT.TYPE_ENUM.' + row.currentData.eventType | translate}}</span>\n </mat-cell>\n </ng-container>\n\n <!-- message -->\n <ng-container matColumnDef=\"message\">\n <mat-header-cell *matHeaderCellDef>\n <ion-label translate>SOCIAL.USER_EVENT.MESSAGE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row;\">\n <ng-container *ngIf=\"getDetail(row.currentData); let details\">\n <ion-text [innerHTML]=\"details.title|translate\">\n </ion-text>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n <!-- Actions buttons column -->\n <ng-container matColumnDef=\"actions\">\n <mat-header-cell *matHeaderCellDef>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <ng-container *ngIf=\"getDetail(row.currentData); let details\">\n <button mat-icon-button color=\"light\"\n *ngFor=\"let action of details.actions\"\n [title]=\"action.title |translate\"\n [color]=\"action.color\"\n (click)=\"doAction(action, row)\">\n <ion-icon slot=\"start\" *ngIf=\"action.icon\" [name]=\"action.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"action.matIcon\">{{action.matIcon}}</mat-icon>\n </button>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\"\n class=\"mat-row-disabled\"\n (click)=\"clickRow($event, row)\"></mat-row>\n\n</mat-table>\n\n<ion-row class=\"ion-no-padding\">\n <ion-col></ion-col>\n <ion-col class=\"ion-no-padding\" size=\"auto\">\n <mat-paginator [length]=\"totalRowCount\" [pageSize]=\"defaultPageSize\" [pageSizeOptions]=\"defaultPageSizeOptions\" showFirstLastButtons>\n </mat-paginator>\n </ion-col>\n</ion-row>\n",
|
|
30632
30903
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
30904
|
+
providers: [
|
|
30905
|
+
{
|
|
30906
|
+
provide: UserEventServiceToken, useClass: UserEventService
|
|
30907
|
+
}
|
|
30908
|
+
],
|
|
30633
30909
|
styles: [".mat-header-row .mat-column-icon,.mat-row .mat-column-icon{max-width:40px;padding-left:0}.mat-header-row .mat-column-icon ion-icon,.mat-header-row .mat-column-icon mat-icon,.mat-row .mat-column-icon ion-icon,.mat-row .mat-column-icon mat-icon{font-size:1.2em;height:1.2em;width:1.2em}.mat-header-row .mat-column-creationDate,.mat-row .mat-column-creationDate{min-width:100px;max-width:120px}"]
|
|
30634
30910
|
},] }
|
|
30635
30911
|
];
|
|
30636
30912
|
UserEventsTable.ctorParameters = function () { return [
|
|
30637
30913
|
{ type: i0.Injector },
|
|
30638
30914
|
{ type: AccountService },
|
|
30639
|
-
{ type:
|
|
30915
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [UserEventServiceToken,] }] },
|
|
30640
30916
|
{ type: EntitiesStorage },
|
|
30641
30917
|
{ type: i0.ChangeDetectorRef },
|
|
30642
30918
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
@@ -30648,6 +30924,164 @@
|
|
|
30648
30924
|
defaultSortDirection: [{ type: i0.Input }]
|
|
30649
30925
|
};
|
|
30650
30926
|
|
|
30927
|
+
var UserEventNotificationList = /** @class */ (function () {
|
|
30928
|
+
function UserEventNotificationList(popoverController) {
|
|
30929
|
+
this.popoverController = popoverController;
|
|
30930
|
+
}
|
|
30931
|
+
UserEventNotificationList.prototype.ngOnInit = function () {
|
|
30932
|
+
};
|
|
30933
|
+
UserEventNotificationList.prototype.read = function ($event, userEvent) {
|
|
30934
|
+
var _a;
|
|
30935
|
+
if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
|
|
30936
|
+
return;
|
|
30937
|
+
(_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
|
|
30938
|
+
};
|
|
30939
|
+
UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
|
|
30940
|
+
// Execute then close popover
|
|
30941
|
+
action.executeAction(userEvent);
|
|
30942
|
+
this.dismiss();
|
|
30943
|
+
};
|
|
30944
|
+
UserEventNotificationList.prototype.dismiss = function () {
|
|
30945
|
+
this.popoverController.dismiss();
|
|
30946
|
+
};
|
|
30947
|
+
return UserEventNotificationList;
|
|
30948
|
+
}());
|
|
30949
|
+
UserEventNotificationList.decorators = [
|
|
30950
|
+
{ type: i0.Component, args: [{
|
|
30951
|
+
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 {{ '➞ ' + 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
|
+
styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none}.unread{font-weight:700}"]
|
|
30954
|
+
},] }
|
|
30955
|
+
];
|
|
30956
|
+
UserEventNotificationList.ctorParameters = function () { return [
|
|
30957
|
+
{ type: i1$5.PopoverController }
|
|
30958
|
+
]; };
|
|
30959
|
+
UserEventNotificationList.propDecorators = {
|
|
30960
|
+
titleI18n: [{ type: i0.Input }],
|
|
30961
|
+
userEvents: [{ type: i0.Input }],
|
|
30962
|
+
readEvent: [{ type: i0.Output }]
|
|
30963
|
+
};
|
|
30964
|
+
|
|
30965
|
+
var UserEventNotificationComponent = /** @class */ (function () {
|
|
30966
|
+
function UserEventNotificationComponent(userEventService, accountService, popoverController, cd) {
|
|
30967
|
+
this.userEventService = userEventService;
|
|
30968
|
+
this.accountService = accountService;
|
|
30969
|
+
this.popoverController = popoverController;
|
|
30970
|
+
this.cd = cd;
|
|
30971
|
+
this.debug = false;
|
|
30972
|
+
this.titleI18n = 'SOCIAL.USER_EVENT.TITLE';
|
|
30973
|
+
this.disabled = false;
|
|
30974
|
+
this.userEventsSubject = new rxjs.BehaviorSubject(undefined);
|
|
30975
|
+
this._subscriptions = new rxjs.Subscription();
|
|
30976
|
+
this._logPrefix = '[user-event-notification] ';
|
|
30977
|
+
this._readEvent = new i0.EventEmitter();
|
|
30978
|
+
}
|
|
30979
|
+
Object.defineProperty(UserEventNotificationComponent.prototype, "count", {
|
|
30980
|
+
get: function () {
|
|
30981
|
+
return this.userEventService.userEventCount.pipe(operators.map(function (value) { return value === 0 ? undefined : value; }));
|
|
30982
|
+
},
|
|
30983
|
+
enumerable: false,
|
|
30984
|
+
configurable: true
|
|
30985
|
+
});
|
|
30986
|
+
UserEventNotificationComponent.prototype.ngOnInit = function () {
|
|
30987
|
+
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) {
|
|
30992
|
+
var data = value.data;
|
|
30993
|
+
if (_this.debug) {
|
|
30994
|
+
console.debug(_this._logPrefix + "Receiving user events", data);
|
|
30995
|
+
}
|
|
30996
|
+
_this.userEventsSubject.next(data);
|
|
30997
|
+
}));
|
|
30998
|
+
this._readEvent.subscribe(function (value) {
|
|
30999
|
+
_this.userEventService.markAsRead(value);
|
|
31000
|
+
});
|
|
31001
|
+
};
|
|
31002
|
+
UserEventNotificationComponent.prototype.showList = function (event) {
|
|
31003
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31004
|
+
var popover;
|
|
31005
|
+
return __generator(this, function (_b) {
|
|
31006
|
+
switch (_b.label) {
|
|
31007
|
+
case 0: return [4 /*yield*/, this.popoverController.create({
|
|
31008
|
+
component: UserEventNotificationList,
|
|
31009
|
+
componentProps: {
|
|
31010
|
+
titleI18n: this.titleI18n,
|
|
31011
|
+
userEvents: this.userEventsSubject,
|
|
31012
|
+
readEvent: this._readEvent
|
|
31013
|
+
},
|
|
31014
|
+
backdropDismiss: true,
|
|
31015
|
+
keyboardClose: true,
|
|
31016
|
+
event: event,
|
|
31017
|
+
translucent: true,
|
|
31018
|
+
cssClass: 'popover-large'
|
|
31019
|
+
})];
|
|
31020
|
+
case 1:
|
|
31021
|
+
popover = _b.sent();
|
|
31022
|
+
return [4 /*yield*/, popover.present()];
|
|
31023
|
+
case 2:
|
|
31024
|
+
_b.sent();
|
|
31025
|
+
return [2 /*return*/];
|
|
31026
|
+
}
|
|
31027
|
+
});
|
|
31028
|
+
});
|
|
31029
|
+
};
|
|
31030
|
+
UserEventNotificationComponent.prototype.markForCheck = function () {
|
|
31031
|
+
this.cd.markForCheck();
|
|
31032
|
+
};
|
|
31033
|
+
UserEventNotificationComponent.prototype.ngOnDestroy = function () {
|
|
31034
|
+
if (this.debug) {
|
|
31035
|
+
console.debug(this._logPrefix + "Destroying");
|
|
31036
|
+
}
|
|
31037
|
+
this._subscriptions.unsubscribe();
|
|
31038
|
+
};
|
|
31039
|
+
return UserEventNotificationComponent;
|
|
31040
|
+
}());
|
|
31041
|
+
UserEventNotificationComponent.decorators = [
|
|
31042
|
+
{ type: i0.Component, args: [{
|
|
31043
|
+
selector: 'app-user-event-notification-component',
|
|
31044
|
+
template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"count | async\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >notifications\n </mat-icon>\n</button>\n\n",
|
|
31045
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
31046
|
+
styles: [""]
|
|
31047
|
+
},] }
|
|
31048
|
+
];
|
|
31049
|
+
UserEventNotificationComponent.ctorParameters = function () { return [
|
|
31050
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [UserEventServiceToken,] }] },
|
|
31051
|
+
{ type: AccountService },
|
|
31052
|
+
{ type: i1$5.PopoverController },
|
|
31053
|
+
{ type: i0.ChangeDetectorRef }
|
|
31054
|
+
]; };
|
|
31055
|
+
UserEventNotificationComponent.propDecorators = {
|
|
31056
|
+
debug: [{ type: i0.Input }],
|
|
31057
|
+
titleI18n: [{ type: i0.Input }],
|
|
31058
|
+
disabled: [{ type: i0.Input }]
|
|
31059
|
+
};
|
|
31060
|
+
|
|
31061
|
+
var UserEventModule = /** @class */ (function () {
|
|
31062
|
+
function UserEventModule() {
|
|
31063
|
+
}
|
|
31064
|
+
return UserEventModule;
|
|
31065
|
+
}());
|
|
31066
|
+
UserEventModule.decorators = [
|
|
31067
|
+
{ type: i0.NgModule, args: [{
|
|
31068
|
+
imports: [
|
|
31069
|
+
i1$4.CommonModule,
|
|
31070
|
+
CoreModule,
|
|
31071
|
+
SharedModule
|
|
31072
|
+
],
|
|
31073
|
+
declarations: [
|
|
31074
|
+
UserEventsTable,
|
|
31075
|
+
UserEventNotificationComponent,
|
|
31076
|
+
UserEventNotificationList,
|
|
31077
|
+
],
|
|
31078
|
+
exports: [
|
|
31079
|
+
UserEventsTable,
|
|
31080
|
+
UserEventNotificationComponent
|
|
31081
|
+
]
|
|
31082
|
+
},] }
|
|
31083
|
+
];
|
|
31084
|
+
|
|
30651
31085
|
var MessageTypes = {
|
|
30652
31086
|
INBOX_MESSAGE: 'INBOX_MESSAGE',
|
|
30653
31087
|
EMAIL: 'EMAIL',
|
|
@@ -30881,12 +31315,12 @@
|
|
|
30881
31315
|
canSelectType: [{ type: i0.Input }]
|
|
30882
31316
|
};
|
|
30883
31317
|
|
|
30884
|
-
var
|
|
30885
|
-
function
|
|
31318
|
+
var MessageModule = /** @class */ (function () {
|
|
31319
|
+
function MessageModule() {
|
|
30886
31320
|
}
|
|
30887
|
-
return
|
|
31321
|
+
return MessageModule;
|
|
30888
31322
|
}());
|
|
30889
|
-
|
|
31323
|
+
MessageModule.decorators = [
|
|
30890
31324
|
{ type: i0.NgModule, args: [{
|
|
30891
31325
|
imports: [
|
|
30892
31326
|
i1$4.CommonModule,
|
|
@@ -30894,19 +31328,320 @@
|
|
|
30894
31328
|
SharedModule
|
|
30895
31329
|
],
|
|
30896
31330
|
declarations: [
|
|
30897
|
-
UserEventsTable,
|
|
30898
31331
|
MessageModal,
|
|
30899
31332
|
MessageForm
|
|
30900
31333
|
],
|
|
30901
31334
|
exports: [
|
|
30902
|
-
UserEventsTable,
|
|
30903
31335
|
MessageModal
|
|
30904
31336
|
]
|
|
30905
31337
|
},] }
|
|
30906
31338
|
];
|
|
30907
31339
|
|
|
31340
|
+
var JobProgression_1;
|
|
31341
|
+
// todo use entity
|
|
31342
|
+
var Job = /** @class */ (function () {
|
|
31343
|
+
function Job() {
|
|
31344
|
+
}
|
|
31345
|
+
return Job;
|
|
31346
|
+
}());
|
|
31347
|
+
// @dynamic
|
|
31348
|
+
exports.JobProgression = JobProgression_1 = /** @class */ (function (_super) {
|
|
31349
|
+
__extends(JobProgression, _super);
|
|
31350
|
+
function JobProgression() {
|
|
31351
|
+
return _super.call(this, JobProgression_1.TYPENAME) || this;
|
|
31352
|
+
}
|
|
31353
|
+
JobProgression.prototype.fromObject = function (source) {
|
|
31354
|
+
_super.prototype.fromObject.call(this, source);
|
|
31355
|
+
this.message = source.message;
|
|
31356
|
+
this.current = source.current;
|
|
31357
|
+
this.total = source.total;
|
|
31358
|
+
};
|
|
31359
|
+
return JobProgression;
|
|
31360
|
+
}(Entity));
|
|
31361
|
+
exports.JobProgression = JobProgression_1 = __decorate([
|
|
31362
|
+
EntityClass({ typename: 'JobProgressionVO' })
|
|
31363
|
+
], exports.JobProgression);
|
|
31364
|
+
|
|
31365
|
+
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}"])));
|
|
31367
|
+
var JobProgressionService = /** @class */ (function (_super) {
|
|
31368
|
+
__extends(JobProgressionService, _super);
|
|
31369
|
+
function JobProgressionService(graphql, environment) {
|
|
31370
|
+
var _this = _super.call(this, graphql, environment) || this;
|
|
31371
|
+
_this.graphql = graphql;
|
|
31372
|
+
_this.environment = environment;
|
|
31373
|
+
_this._logPrefix = '[job-progression-service] ';
|
|
31374
|
+
// For DEV only
|
|
31375
|
+
_this._debug = !(environment === null || environment === void 0 ? void 0 : environment.production);
|
|
31376
|
+
return _this;
|
|
31377
|
+
}
|
|
31378
|
+
JobProgressionService.prototype.listenChanges = function (id, options) {
|
|
31379
|
+
var _this = this;
|
|
31380
|
+
if (isNil(id))
|
|
31381
|
+
throw new Error(this._logPrefix + "Missing argument 'id'");
|
|
31382
|
+
if (this._debug)
|
|
31383
|
+
console.debug(this._logPrefix + "[WS] Listening changes for job progression {" + id + "}...");
|
|
31384
|
+
return this.graphql.subscribe({
|
|
31385
|
+
query: jobProgressionSubscription,
|
|
31386
|
+
fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
|
|
31387
|
+
variables: { id: id, interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
|
|
31388
|
+
error: { code: SocialErrorCodes.SUBSCRIBE_JOB_PROGRESSION_ERROR, message: 'SOCIAL.ERROR.SUBSCRIBE_JOB_PROGRESSION_ERROR' }
|
|
31389
|
+
}).pipe(operators.map(function (_a) {
|
|
31390
|
+
var data = _a.data;
|
|
31391
|
+
var progression = data && exports.JobProgression.fromObject(data);
|
|
31392
|
+
if (progression && _this._debug)
|
|
31393
|
+
console.debug(_this._logPrefix + "Job progression " + id + " updated on server", progression);
|
|
31394
|
+
return progression;
|
|
31395
|
+
}));
|
|
31396
|
+
};
|
|
31397
|
+
return JobProgressionService;
|
|
31398
|
+
}(BaseGraphqlService));
|
|
31399
|
+
JobProgressionService.decorators = [
|
|
31400
|
+
{ type: i0.Injectable }
|
|
31401
|
+
];
|
|
31402
|
+
JobProgressionService.ctorParameters = function () { return [
|
|
31403
|
+
{ type: GraphqlService },
|
|
31404
|
+
{ type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
31405
|
+
]; };
|
|
31406
|
+
var templateObject_1$4;
|
|
31407
|
+
|
|
31408
|
+
var JobProgressionList = /** @class */ (function () {
|
|
31409
|
+
function JobProgressionList() {
|
|
31410
|
+
}
|
|
31411
|
+
JobProgressionList.prototype.ngOnInit = function () {
|
|
31412
|
+
};
|
|
31413
|
+
return JobProgressionList;
|
|
31414
|
+
}());
|
|
31415
|
+
JobProgressionList.decorators = [
|
|
31416
|
+
{ type: i0.Component, args: [{
|
|
31417
|
+
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",
|
|
31419
|
+
styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none}"]
|
|
31420
|
+
},] }
|
|
31421
|
+
];
|
|
31422
|
+
JobProgressionList.ctorParameters = function () { return []; };
|
|
31423
|
+
JobProgressionList.propDecorators = {
|
|
31424
|
+
titleI18n: [{ type: i0.Input }],
|
|
31425
|
+
jobProgressions: [{ type: i0.Input }]
|
|
31426
|
+
};
|
|
31427
|
+
|
|
31428
|
+
var JobProgressionComponent = /** @class */ (function () {
|
|
31429
|
+
function JobProgressionComponent(jobProgressionService, popoverController, cd) {
|
|
31430
|
+
this.jobProgressionService = jobProgressionService;
|
|
31431
|
+
this.popoverController = popoverController;
|
|
31432
|
+
this.cd = cd;
|
|
31433
|
+
this.debug = false;
|
|
31434
|
+
this.titleI18n = 'SOCIAL.JOB_PROGRESSION.TITLE';
|
|
31435
|
+
this.autoRemove = true;
|
|
31436
|
+
this.autoHide = false;
|
|
31437
|
+
this.autoHideDelay = 1000; // millisecond
|
|
31438
|
+
this.jobFinished = new i0.EventEmitter();
|
|
31439
|
+
this.disabled = true;
|
|
31440
|
+
this.color = 'accent';
|
|
31441
|
+
this.mode = 'determinate';
|
|
31442
|
+
this.value = 0;
|
|
31443
|
+
this.jobProgressions = [];
|
|
31444
|
+
this._subscriptions = new rxjs.Subscription();
|
|
31445
|
+
this._subscriptionsById = {};
|
|
31446
|
+
this._logPrefix = '[job-progression] ';
|
|
31447
|
+
}
|
|
31448
|
+
JobProgressionComponent.prototype.ngOnInit = function () {
|
|
31449
|
+
};
|
|
31450
|
+
JobProgressionComponent.prototype.addJob = function (id) {
|
|
31451
|
+
var _this = this;
|
|
31452
|
+
if (this.debug) {
|
|
31453
|
+
console.debug(this._logPrefix + "Add job id=" + id);
|
|
31454
|
+
}
|
|
31455
|
+
if (!!this.getProgression(id)) {
|
|
31456
|
+
console.warn(this._logPrefix + "Job (id=" + id + ") already present");
|
|
31457
|
+
return;
|
|
31458
|
+
}
|
|
31459
|
+
this.disabled = false;
|
|
31460
|
+
var sub = this.jobProgressionService.listenChanges(id)
|
|
31461
|
+
.pipe(operators.filter(function (progression) {
|
|
31462
|
+
if (id !== progression.id) {
|
|
31463
|
+
console.error(_this._logPrefix + "Job progression (id=" + progression.id + ") doesn't match expected job (id=" + id + ")");
|
|
31464
|
+
return false;
|
|
31465
|
+
}
|
|
31466
|
+
return true;
|
|
31467
|
+
}), operators.map(function (progression) {
|
|
31468
|
+
// Get current progression object
|
|
31469
|
+
var currentProgression = _this.getProgression(id);
|
|
31470
|
+
if (!currentProgression) {
|
|
31471
|
+
// add it
|
|
31472
|
+
_this.jobProgressions.push(progression);
|
|
31473
|
+
if (_this.debug) {
|
|
31474
|
+
console.debug(_this._logPrefix + "Progression added id=" + id, progression);
|
|
31475
|
+
}
|
|
31476
|
+
}
|
|
31477
|
+
else {
|
|
31478
|
+
// update current
|
|
31479
|
+
Object.assign(currentProgression, progression);
|
|
31480
|
+
if (_this.debug) {
|
|
31481
|
+
console.debug(_this._logPrefix + "Progression updated id=" + id, progression);
|
|
31482
|
+
}
|
|
31483
|
+
}
|
|
31484
|
+
return progression;
|
|
31485
|
+
}))
|
|
31486
|
+
.subscribe(function (progression) {
|
|
31487
|
+
// update value
|
|
31488
|
+
_this.updateValue();
|
|
31489
|
+
// job finished
|
|
31490
|
+
if (progression.total > 0 && progression.current == progression.total) {
|
|
31491
|
+
if (_this.debug) {
|
|
31492
|
+
console.debug(_this._logPrefix + "Finished job id=" + progression.id);
|
|
31493
|
+
}
|
|
31494
|
+
// emit event
|
|
31495
|
+
_this.jobFinished.emit(progression.id);
|
|
31496
|
+
if (_this.autoRemove) {
|
|
31497
|
+
setTimeout(function () { return _this.removeJob(progression.id); }, 1000);
|
|
31498
|
+
}
|
|
31499
|
+
}
|
|
31500
|
+
});
|
|
31501
|
+
this._subscriptionsById[id] = sub;
|
|
31502
|
+
this._subscriptions.add(sub);
|
|
31503
|
+
};
|
|
31504
|
+
JobProgressionComponent.prototype.removeJob = function (id) {
|
|
31505
|
+
if (this.debug) {
|
|
31506
|
+
console.debug(this._logPrefix + "Remove job id=" + id);
|
|
31507
|
+
}
|
|
31508
|
+
var sub = this._subscriptionsById[id];
|
|
31509
|
+
if (sub) {
|
|
31510
|
+
this._subscriptions.remove(sub);
|
|
31511
|
+
sub.unsubscribe();
|
|
31512
|
+
}
|
|
31513
|
+
var progression = this.getProgression(id);
|
|
31514
|
+
if (progression) {
|
|
31515
|
+
this.jobProgressions.splice(this.jobProgressions.indexOf(progression), 1);
|
|
31516
|
+
}
|
|
31517
|
+
this.updateValue();
|
|
31518
|
+
};
|
|
31519
|
+
JobProgressionComponent.prototype.getProgression = function (id) {
|
|
31520
|
+
return this.jobProgressions.find(function (progression) { return progression.id === id; });
|
|
31521
|
+
};
|
|
31522
|
+
JobProgressionComponent.prototype.updateValue = function () {
|
|
31523
|
+
if (this.debug) {
|
|
31524
|
+
console.debug(this._logPrefix + "Updating value");
|
|
31525
|
+
}
|
|
31526
|
+
var value = 0;
|
|
31527
|
+
var nbProgression = arraySize(this.jobProgressions);
|
|
31528
|
+
var allIndeterminate = nbProgression > 0;
|
|
31529
|
+
this.jobProgressions.forEach(function (progression) {
|
|
31530
|
+
var indeterminate = progression.total === 0;
|
|
31531
|
+
allIndeterminate = allIndeterminate && indeterminate;
|
|
31532
|
+
if (!indeterminate) {
|
|
31533
|
+
value = value + progression.current * 100 / progression.total;
|
|
31534
|
+
}
|
|
31535
|
+
});
|
|
31536
|
+
this.value = nbProgression > 0 ? value / nbProgression : 0;
|
|
31537
|
+
this.mode = allIndeterminate ? 'indeterminate' : 'determinate';
|
|
31538
|
+
if (this.debug) {
|
|
31539
|
+
console.debug(this._logPrefix + "Setting value=" + this.value + ", mode=" + this.mode);
|
|
31540
|
+
}
|
|
31541
|
+
this.markForCheck();
|
|
31542
|
+
};
|
|
31543
|
+
JobProgressionComponent.prototype.showList = function (event) {
|
|
31544
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31545
|
+
var popover;
|
|
31546
|
+
return __generator(this, function (_a) {
|
|
31547
|
+
switch (_a.label) {
|
|
31548
|
+
case 0: return [4 /*yield*/, this.popoverController.create({
|
|
31549
|
+
component: JobProgressionList,
|
|
31550
|
+
componentProps: {
|
|
31551
|
+
titleI18n: this.titleI18n,
|
|
31552
|
+
jobProgressions: this.jobProgressions
|
|
31553
|
+
},
|
|
31554
|
+
backdropDismiss: true,
|
|
31555
|
+
keyboardClose: true,
|
|
31556
|
+
event: event,
|
|
31557
|
+
translucent: true,
|
|
31558
|
+
cssClass: 'popover-large'
|
|
31559
|
+
})];
|
|
31560
|
+
case 1:
|
|
31561
|
+
popover = _a.sent();
|
|
31562
|
+
return [4 /*yield*/, popover.present()];
|
|
31563
|
+
case 2:
|
|
31564
|
+
_a.sent();
|
|
31565
|
+
return [2 /*return*/];
|
|
31566
|
+
}
|
|
31567
|
+
});
|
|
31568
|
+
});
|
|
31569
|
+
};
|
|
31570
|
+
JobProgressionComponent.prototype.markForCheck = function () {
|
|
31571
|
+
this.cd.markForCheck();
|
|
31572
|
+
};
|
|
31573
|
+
JobProgressionComponent.prototype.ngOnDestroy = function () {
|
|
31574
|
+
if (this.debug) {
|
|
31575
|
+
console.debug(this._logPrefix + "Destroying");
|
|
31576
|
+
}
|
|
31577
|
+
this._subscriptions.unsubscribe();
|
|
31578
|
+
};
|
|
31579
|
+
return JobProgressionComponent;
|
|
31580
|
+
}());
|
|
31581
|
+
JobProgressionComponent.decorators = [
|
|
31582
|
+
{ type: i0.Component, args: [{
|
|
31583
|
+
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",
|
|
31585
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
31586
|
+
styles: [".floating-spinner{position:absolute;top:6px;left:5px}"]
|
|
31587
|
+
},] }
|
|
31588
|
+
];
|
|
31589
|
+
JobProgressionComponent.ctorParameters = function () { return [
|
|
31590
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [JobProgressionServiceToken,] }] },
|
|
31591
|
+
{ type: i1$5.PopoverController },
|
|
31592
|
+
{ type: i0.ChangeDetectorRef }
|
|
31593
|
+
]; };
|
|
31594
|
+
JobProgressionComponent.propDecorators = {
|
|
31595
|
+
debug: [{ type: i0.Input }],
|
|
31596
|
+
titleI18n: [{ type: i0.Input }],
|
|
31597
|
+
autoRemove: [{ type: i0.Input }],
|
|
31598
|
+
autoHide: [{ type: i0.Input }],
|
|
31599
|
+
autoHideDelay: [{ type: i0.Input }],
|
|
31600
|
+
jobFinished: [{ type: i0.Output }]
|
|
31601
|
+
};
|
|
31602
|
+
|
|
31603
|
+
var JobModule = /** @class */ (function () {
|
|
31604
|
+
function JobModule() {
|
|
31605
|
+
}
|
|
31606
|
+
return JobModule;
|
|
31607
|
+
}());
|
|
31608
|
+
JobModule.decorators = [
|
|
31609
|
+
{ type: i0.NgModule, args: [{
|
|
31610
|
+
imports: [
|
|
31611
|
+
i1$4.CommonModule,
|
|
31612
|
+
SharedModule,
|
|
31613
|
+
i1$2.TranslateModule.forChild(),
|
|
31614
|
+
],
|
|
31615
|
+
declarations: [
|
|
31616
|
+
JobProgressionComponent,
|
|
31617
|
+
JobProgressionList
|
|
31618
|
+
],
|
|
31619
|
+
exports: [
|
|
31620
|
+
JobProgressionComponent
|
|
31621
|
+
]
|
|
31622
|
+
},] }
|
|
31623
|
+
];
|
|
31624
|
+
|
|
31625
|
+
var SocialModule = /** @class */ (function () {
|
|
31626
|
+
function SocialModule() {
|
|
31627
|
+
}
|
|
31628
|
+
return SocialModule;
|
|
31629
|
+
}());
|
|
31630
|
+
SocialModule.decorators = [
|
|
31631
|
+
{ type: i0.NgModule, args: [{
|
|
31632
|
+
imports: [
|
|
31633
|
+
i1$4.CommonModule,
|
|
31634
|
+
CoreModule,
|
|
31635
|
+
SharedModule,
|
|
31636
|
+
UserEventModule,
|
|
31637
|
+
JobModule,
|
|
31638
|
+
MessageModule,
|
|
31639
|
+
],
|
|
31640
|
+
},] }
|
|
31641
|
+
];
|
|
31642
|
+
|
|
30908
31643
|
var Mutations = {
|
|
30909
|
-
send: core.gql(templateObject_1$
|
|
31644
|
+
send: core.gql(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"], ["mutation SendMessage($data: MessageVOInput){\n done: sendMessage(message: $data)\n }"])))
|
|
30910
31645
|
};
|
|
30911
31646
|
var MessageService = /** @class */ (function (_super) {
|
|
30912
31647
|
__extends(MessageService, _super);
|
|
@@ -30990,7 +31725,7 @@
|
|
|
30990
31725
|
{ type: i1$5.ToastController },
|
|
30991
31726
|
{ type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
30992
31727
|
]; };
|
|
30993
|
-
var templateObject_1$
|
|
31728
|
+
var templateObject_1$5;
|
|
30994
31729
|
|
|
30995
31730
|
var PersonFilter_1;
|
|
30996
31731
|
// @dynamic
|
|
@@ -31049,7 +31784,7 @@
|
|
|
31049
31784
|
], exports.PersonFilter);
|
|
31050
31785
|
|
|
31051
31786
|
var PersonFragments = {
|
|
31052
|
-
person: core.gql(templateObject_1$
|
|
31787
|
+
person: core.gql(templateObject_1$6 || (templateObject_1$6 = __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 }"])))
|
|
31053
31788
|
};
|
|
31054
31789
|
// Load persons query
|
|
31055
31790
|
var PersonQueries = {
|
|
@@ -31189,7 +31924,7 @@
|
|
|
31189
31924
|
{ type: NetworkService },
|
|
31190
31925
|
{ type: EntitiesStorage }
|
|
31191
31926
|
]; };
|
|
31192
|
-
var templateObject_1$
|
|
31927
|
+
var templateObject_1$6, templateObject_2$4, templateObject_3$3, templateObject_4$3, templateObject_5$2;
|
|
31193
31928
|
|
|
31194
31929
|
var PersonValidatorService = /** @class */ (function () {
|
|
31195
31930
|
function PersonValidatorService(formBuilder, accountValidatorService) {
|
|
@@ -31791,13 +32526,13 @@
|
|
|
31791
32526
|
{ type: i1.FormBuilder }
|
|
31792
32527
|
]; };
|
|
31793
32528
|
|
|
31794
|
-
var moment$
|
|
32529
|
+
var moment$7 = momentImported__namespace;
|
|
31795
32530
|
var SwipeTestPage = /** @class */ (function () {
|
|
31796
32531
|
function SwipeTestPage(formBuilder, dateFormatPipe) {
|
|
31797
32532
|
this.formBuilder = formBuilder;
|
|
31798
32533
|
this.dateFormatPipe = dateFormatPipe;
|
|
31799
32534
|
this.$dates = new rxjs.BehaviorSubject(undefined);
|
|
31800
|
-
this._today = moment$
|
|
32535
|
+
this._today = moment$7().startOf('day');
|
|
31801
32536
|
this.form = formBuilder.group({
|
|
31802
32537
|
empty: [null, i1.Validators.required],
|
|
31803
32538
|
date: [null, i1.Validators.compose([i1.Validators.required, SharedValidators.validDate])],
|
|
@@ -31811,7 +32546,7 @@
|
|
|
31811
32546
|
var _this = this;
|
|
31812
32547
|
var dates = [];
|
|
31813
32548
|
for (var d = 0; d < 7; d++) {
|
|
31814
|
-
dates[d] = moment$
|
|
32549
|
+
dates[d] = moment$7(this._today).add(d - 3, 'day');
|
|
31815
32550
|
}
|
|
31816
32551
|
this.$dates.next(dates);
|
|
31817
32552
|
this.loadData();
|
|
@@ -31858,7 +32593,7 @@
|
|
|
31858
32593
|
{ type: DateFormatPipe }
|
|
31859
32594
|
]; };
|
|
31860
32595
|
|
|
31861
|
-
var moment$
|
|
32596
|
+
var moment$8 = momentImported__namespace;
|
|
31862
32597
|
var DateTimeTestPage = /** @class */ (function () {
|
|
31863
32598
|
function DateTimeTestPage(platform, formBuilder, cd) {
|
|
31864
32599
|
this.platform = platform;
|
|
@@ -31894,7 +32629,7 @@
|
|
|
31894
32629
|
var now, data;
|
|
31895
32630
|
var _this = this;
|
|
31896
32631
|
return __generator(this, function (_a) {
|
|
31897
|
-
now = moment$
|
|
32632
|
+
now = moment$8();
|
|
31898
32633
|
data = {
|
|
31899
32634
|
empty: null,
|
|
31900
32635
|
emptyRequired: null,
|
|
@@ -32172,7 +32907,7 @@
|
|
|
32172
32907
|
{ type: i1.FormBuilder }
|
|
32173
32908
|
]; };
|
|
32174
32909
|
|
|
32175
|
-
var moment$
|
|
32910
|
+
var moment$9 = momentImported__namespace;
|
|
32176
32911
|
var DateTestPage = /** @class */ (function () {
|
|
32177
32912
|
function DateTestPage(formBuilder, cd) {
|
|
32178
32913
|
this.formBuilder = formBuilder;
|
|
@@ -32209,7 +32944,7 @@
|
|
|
32209
32944
|
var now, nowAtMahe, data;
|
|
32210
32945
|
var _this = this;
|
|
32211
32946
|
return __generator(this, function (_a) {
|
|
32212
|
-
now = moment$
|
|
32947
|
+
now = moment$9();
|
|
32213
32948
|
nowAtMahe = now.clone().tz(this.timezone).startOf('day');
|
|
32214
32949
|
data = {
|
|
32215
32950
|
empty: null,
|
|
@@ -33048,6 +33783,7 @@
|
|
|
33048
33783
|
exports.APP_MENU_ITEMS = APP_MENU_ITEMS;
|
|
33049
33784
|
exports.APP_TESTING_PAGES = APP_TESTING_PAGES;
|
|
33050
33785
|
exports.AboutModal = AboutModal;
|
|
33786
|
+
exports.AbstractUserEventService = AbstractUserEventService;
|
|
33051
33787
|
exports.AccountPage = AccountPage;
|
|
33052
33788
|
exports.AccountService = AccountService;
|
|
33053
33789
|
exports.AccountToStringPipe = AccountToStringPipe;
|
|
@@ -33174,6 +33910,10 @@
|
|
|
33174
33910
|
exports.IsNotNilOrBlankPipe = IsNotNilOrBlankPipe;
|
|
33175
33911
|
exports.IsNotOnFieldModePipe = IsNotOnFieldModePipe;
|
|
33176
33912
|
exports.IsOnFieldModePipe = IsOnFieldModePipe;
|
|
33913
|
+
exports.Job = Job;
|
|
33914
|
+
exports.JobProgressionComponent = JobProgressionComponent;
|
|
33915
|
+
exports.JobProgressionService = JobProgressionService;
|
|
33916
|
+
exports.JobProgressionServiceToken = JobProgressionServiceToken;
|
|
33177
33917
|
exports.JobUtils = JobUtils;
|
|
33178
33918
|
exports.KEYBOARD_HIDE_DELAY_MS = KEYBOARD_HIDE_DELAY_MS;
|
|
33179
33919
|
exports.LAT_LONG_DEFAULT_MAX_DECIMALS = LAT_LONG_DEFAULT_MAX_DECIMALS;
|
|
@@ -33306,7 +34046,9 @@
|
|
|
33306
34046
|
exports.UploadFileTestingPage = UploadFileTestingPage;
|
|
33307
34047
|
exports.UriUtils = UriUtils;
|
|
33308
34048
|
exports.UserEventFragments = UserEventFragments;
|
|
34049
|
+
exports.UserEventNotificationComponent = UserEventNotificationComponent;
|
|
33309
34050
|
exports.UserEventService = UserEventService;
|
|
34051
|
+
exports.UserEventServiceToken = UserEventServiceToken;
|
|
33310
34052
|
exports.UserEventTypes = UserEventTypes;
|
|
33311
34053
|
exports.UserEventsTable = UserEventsTable;
|
|
33312
34054
|
exports.UsersPage = UsersPage;
|
|
@@ -33471,11 +34213,16 @@
|
|
|
33471
34213
|
exports.ɵh = LocalSettingsValidatorService;
|
|
33472
34214
|
exports.ɵi = AppUpdateOfflineModeCard;
|
|
33473
34215
|
exports.ɵj = AppIconComponent;
|
|
33474
|
-
exports.ɵk =
|
|
33475
|
-
exports.ɵl =
|
|
33476
|
-
exports.ɵm =
|
|
33477
|
-
exports.ɵn =
|
|
33478
|
-
exports.ɵo =
|
|
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;
|
|
33479
34226
|
|
|
33480
34227
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
33481
34228
|
|