@sumaris-net/ngx-components 1.22.6 → 1.22.7
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 +1 -109
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/social/user-event/user-event.service.js +4 -95
- package/fesm2015/sumaris-net.ngx-components.js +1 -90
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/social/user-event/user-event.service.d.ts +1 -13
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -30929,7 +30929,7 @@
|
|
|
30929
30929
|
};
|
|
30930
30930
|
var UserEventService = /** @class */ (function (_super) {
|
|
30931
30931
|
__extends(UserEventService, _super);
|
|
30932
|
-
function UserEventService(graphql, accountService, network, translate,
|
|
30932
|
+
function UserEventService(graphql, accountService, network, translate, environment) {
|
|
30933
30933
|
var _this = _super.call(this, graphql, accountService, network, translate, {
|
|
30934
30934
|
queries: userEventQueries,
|
|
30935
30935
|
mutations: userEventMutations,
|
|
@@ -30939,89 +30939,9 @@
|
|
|
30939
30939
|
_this.accountService = accountService;
|
|
30940
30940
|
_this.network = network;
|
|
30941
30941
|
_this.translate = translate;
|
|
30942
|
-
_this.toastController = toastController;
|
|
30943
30942
|
_this.environment = environment;
|
|
30944
30943
|
return _this;
|
|
30945
30944
|
}
|
|
30946
|
-
UserEventService.prototype.showToastErrorWithContext = function (opts) {
|
|
30947
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
30948
|
-
var message, res, context, userEvent, err_1;
|
|
30949
|
-
return __generator(this, function (_b) {
|
|
30950
|
-
switch (_b.label) {
|
|
30951
|
-
case 0:
|
|
30952
|
-
message = opts.message || (opts.error && opts.error.message || opts.error);
|
|
30953
|
-
// Make sure message a string
|
|
30954
|
-
if (!message || typeof message !== 'string') {
|
|
30955
|
-
message = 'ERROR.UNKNOWN_TECHNICAL_ERROR';
|
|
30956
|
-
}
|
|
30957
|
-
// If offline, display a simple alert
|
|
30958
|
-
if (this.network.offline) {
|
|
30959
|
-
this.showToast({ message: message, type: 'error' });
|
|
30960
|
-
return [2 /*return*/];
|
|
30961
|
-
}
|
|
30962
|
-
// Translate the message (to be able to extract details content)
|
|
30963
|
-
message = this.translate.instant(message);
|
|
30964
|
-
// Clean details parts
|
|
30965
|
-
if (message && message.indexOf('<small>') !== -1) {
|
|
30966
|
-
message = message.substr(0, message.indexOf('<small>') - 1);
|
|
30967
|
-
}
|
|
30968
|
-
return [4 /*yield*/, this.showToast({
|
|
30969
|
-
type: 'error',
|
|
30970
|
-
duration: 15000,
|
|
30971
|
-
message: message + '<br/><br/><b>' + this.translate.instant('CONFIRM.SEND_DEBUG_DATA') + '</b>',
|
|
30972
|
-
buttons: [{
|
|
30973
|
-
icon: 'bug',
|
|
30974
|
-
text: this.translate.instant('COMMON.BTN_SEND'),
|
|
30975
|
-
role: 'send'
|
|
30976
|
-
}]
|
|
30977
|
-
})];
|
|
30978
|
-
case 1:
|
|
30979
|
-
res = _b.sent();
|
|
30980
|
-
if (!res || res.role !== 'send')
|
|
30981
|
-
return [2 /*return*/];
|
|
30982
|
-
_b.label = 2;
|
|
30983
|
-
case 2:
|
|
30984
|
-
_b.trys.push([2, 6, , 7]);
|
|
30985
|
-
if (this._debug)
|
|
30986
|
-
console.debug('Sending debug data...');
|
|
30987
|
-
context = opts && opts.context;
|
|
30988
|
-
if (typeof context === 'function') {
|
|
30989
|
-
context = context();
|
|
30990
|
-
}
|
|
30991
|
-
if (!(context instanceof Promise)) return [3 /*break*/, 4];
|
|
30992
|
-
return [4 /*yield*/, context];
|
|
30993
|
-
case 3:
|
|
30994
|
-
context = _b.sent();
|
|
30995
|
-
_b.label = 4;
|
|
30996
|
-
case 4: return [4 /*yield*/, this.sendDataForDebug({
|
|
30997
|
-
message: message,
|
|
30998
|
-
error: opts.error || undefined,
|
|
30999
|
-
context: this.convertObjectToString(context)
|
|
31000
|
-
})];
|
|
31001
|
-
case 5:
|
|
31002
|
-
userEvent = _b.sent();
|
|
31003
|
-
console.info('Debug data successfully sent to admin', userEvent);
|
|
31004
|
-
this.showToast({
|
|
31005
|
-
type: 'info',
|
|
31006
|
-
message: 'INFO.DEBUG_DATA_SEND',
|
|
31007
|
-
showCloseButton: true
|
|
31008
|
-
});
|
|
31009
|
-
return [3 /*break*/, 7];
|
|
31010
|
-
case 6:
|
|
31011
|
-
err_1 = _b.sent();
|
|
31012
|
-
console.error('Error while sending debug data:', err_1);
|
|
31013
|
-
return [3 /*break*/, 7];
|
|
31014
|
-
case 7: return [2 /*return*/];
|
|
31015
|
-
}
|
|
31016
|
-
});
|
|
31017
|
-
});
|
|
31018
|
-
};
|
|
31019
|
-
UserEventService.prototype.sendDataForDebug = function (data) {
|
|
31020
|
-
var userEvent = new exports.UserEvent();
|
|
31021
|
-
userEvent.type = UserEventTypes.DEBUG_DATA;
|
|
31022
|
-
userEvent.content = this.convertObjectToString(data);
|
|
31023
|
-
return this.save(userEvent);
|
|
31024
|
-
};
|
|
31025
30945
|
UserEventService.prototype.asFilter = function (filter) {
|
|
31026
30946
|
return exports.UserEventFilter.fromObject(filter);
|
|
31027
30947
|
};
|
|
@@ -31029,33 +30949,6 @@
|
|
|
31029
30949
|
return exports.UserEvent.fromObject(source);
|
|
31030
30950
|
};
|
|
31031
30951
|
/* -- protected methods -- */
|
|
31032
|
-
UserEventService.prototype.convertObjectToString = function (data) {
|
|
31033
|
-
if (typeof data === 'string') {
|
|
31034
|
-
return data;
|
|
31035
|
-
}
|
|
31036
|
-
// Serialize content into string
|
|
31037
|
-
else if (typeof data === 'object') {
|
|
31038
|
-
if (data instanceof Entity) {
|
|
31039
|
-
return JSON.stringify(data.asObject({ keepTypename: true, keepLocalId: true, minify: false }));
|
|
31040
|
-
}
|
|
31041
|
-
else {
|
|
31042
|
-
return JSON.stringify(data);
|
|
31043
|
-
}
|
|
31044
|
-
}
|
|
31045
|
-
};
|
|
31046
|
-
UserEventService.prototype.showToast = function (opts) {
|
|
31047
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
31048
|
-
return __generator(this, function (_b) {
|
|
31049
|
-
switch (_b.label) {
|
|
31050
|
-
case 0:
|
|
31051
|
-
if (!this.toastController)
|
|
31052
|
-
throw new Error('Missing toastController in component\'s constructor');
|
|
31053
|
-
return [4 /*yield*/, Toasts.show(this.toastController, this.translate, opts)];
|
|
31054
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
31055
|
-
}
|
|
31056
|
-
});
|
|
31057
|
-
});
|
|
31058
|
-
};
|
|
31059
30952
|
UserEventService.prototype.fillDefaultProperties = function (entity) {
|
|
31060
30953
|
entity.issuer = this.accountService.account.pubkey;
|
|
31061
30954
|
// TODO: compute hash (using cryptoService)
|
|
@@ -31072,7 +30965,6 @@
|
|
|
31072
30965
|
{ type: AccountService },
|
|
31073
30966
|
{ type: NetworkService },
|
|
31074
30967
|
{ type: i1$2.TranslateService },
|
|
31075
|
-
{ type: i1$5.ToastController },
|
|
31076
30968
|
{ type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
31077
30969
|
]; };
|
|
31078
30970
|
var templateObject_1$3, templateObject_2$3, templateObject_3$2, templateObject_4$2;
|