taxtank-core 0.16.2 → 0.16.3
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/taxtank-core.umd.js +55 -129
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/models/export/export-data-table.js +1 -4
- package/esm2015/lib/models/loan/loan-payment.js +2 -24
- package/esm2015/lib/services/http/bank/basiq/basiq.service.js +2 -3
- package/esm2015/lib/services/http/property/property.service.js +1 -8
- package/esm2015/lib/services/http/user/user.service.js +40 -20
- package/esm2015/lib/services/pdf/pdf.service.js +2 -2
- package/esm2015/public-api.js +1 -3
- package/fesm2015/taxtank-core.js +49 -118
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/models/loan/loan-payment.d.ts +1 -6
- package/lib/services/http/property/property.service.d.ts +0 -4
- package/lib/services/http/user/user.service.d.ts +15 -3
- package/package.json +1 -1
- package/public-api.d.ts +0 -2
- package/esm2015/lib/interfaces/table-exportable.interface.js +0 -2
- package/esm2015/lib/models/export/export-row-data-type.enum.js +0 -10
- package/esm2015/lib/models/export/export-row.js +0 -6
- package/esm2015/lib/services/data-table/data-table.service.js +0 -47
- package/lib/interfaces/table-exportable.interface.d.ts +0 -7
- package/lib/models/export/export-row-data-type.enum.d.ts +0 -8
- package/lib/models/export/export-row.d.ts +0 -8
- package/lib/services/data-table/data-table.service.d.ts +0 -19
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('class-transformer'), require('@auth0/angular-jwt'), require('lodash/get'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('lodash/last'), require('lodash/compact'), require('lodash/uniqBy'), require('lodash/concat'), require('moment'), require('moment-range'), require('lodash/cloneDeep'), require('@angular/forms'), require('lodash/fromPairs'), require('lodash'), require('event-source-polyfill/src/eventsource.min.js'), require('@angular/router'), require('lodash/clone'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('taxtank-core', ['exports', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs', 'rxjs/operators', 'class-transformer', '@auth0/angular-jwt', 'lodash/get', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'lodash/last', 'lodash/compact', 'lodash/uniqBy', 'lodash/concat', 'moment', 'moment-range', 'lodash/cloneDeep', '@angular/forms', 'lodash/fromPairs', 'lodash', 'event-source-polyfill/src/eventsource.min.js', '@angular/router', 'lodash/clone', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["taxtank-core"] = {}, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs, global.rxjs.operators, global.classTransformer, global.angularJwt, global.get, global.flatten, global.hasIn, global.first, global.last, global.compact, global.uniqBy, global.concat, global.moment, global.momentRange, global.cloneDeep$1, global.ng.forms, global.fromPairs, global._, global.eventsource_min_js, global.ng.router, global.clone, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
-
})(this, (function (exports, i0,
|
|
5
|
+
})(this, (function (exports, i0, i2, i1, rxjs, operators, classTransformer, angularJwt, get, flatten, hasIn, first, last, compact, uniqBy, concat, moment, momentRange, cloneDeep$1, forms, fromPairs, _, eventsource_min_js, i1$1, clone, jsPDF, autoTable, stripeJs, xlsx, FileSaver) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
-
var
|
|
28
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
29
29
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
30
30
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
31
31
|
var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep$1);
|
|
40
40
|
var fromPairs__default = /*#__PURE__*/_interopDefaultLegacy(fromPairs);
|
|
41
41
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
42
|
-
var i1__namespace$
|
|
42
|
+
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
43
43
|
var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
|
|
44
44
|
var jsPDF__default = /*#__PURE__*/_interopDefaultLegacy(jsPDF);
|
|
45
45
|
var autoTable__default = /*#__PURE__*/_interopDefaultLegacy(autoTable);
|
|
@@ -1105,10 +1105,10 @@
|
|
|
1105
1105
|
return TtCoreModule;
|
|
1106
1106
|
}());
|
|
1107
1107
|
TtCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1108
|
-
TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [
|
|
1108
|
+
TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [i2.CommonModule,
|
|
1109
1109
|
InterceptorsModule] });
|
|
1110
1110
|
TtCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [[
|
|
1111
|
-
|
|
1111
|
+
i2.CommonModule,
|
|
1112
1112
|
InterceptorsModule
|
|
1113
1113
|
]] });
|
|
1114
1114
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, decorators: [{
|
|
@@ -1116,7 +1116,7 @@
|
|
|
1116
1116
|
args: [{
|
|
1117
1117
|
declarations: [],
|
|
1118
1118
|
imports: [
|
|
1119
|
-
|
|
1119
|
+
i2.CommonModule,
|
|
1120
1120
|
InterceptorsModule
|
|
1121
1121
|
]
|
|
1122
1122
|
}]
|
|
@@ -4569,34 +4569,6 @@
|
|
|
4569
4569
|
LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
|
|
4570
4570
|
})(exports.LoanVehicleTypeEnum || (exports.LoanVehicleTypeEnum = {}));
|
|
4571
4571
|
|
|
4572
|
-
/**
|
|
4573
|
-
* Class with structure of the data-table rows
|
|
4574
|
-
*/
|
|
4575
|
-
var ExportRow = /** @class */ (function () {
|
|
4576
|
-
function ExportRow() {
|
|
4577
|
-
}
|
|
4578
|
-
return ExportRow;
|
|
4579
|
-
}());
|
|
4580
|
-
|
|
4581
|
-
/**
|
|
4582
|
-
* Enum which shows what type (in terms of business logic) of the data-table row item
|
|
4583
|
-
*/
|
|
4584
|
-
var ExportRowDataTypeEnum;
|
|
4585
|
-
(function (ExportRowDataTypeEnum) {
|
|
4586
|
-
ExportRowDataTypeEnum[ExportRowDataTypeEnum["STRING"] = 0] = "STRING";
|
|
4587
|
-
ExportRowDataTypeEnum[ExportRowDataTypeEnum["CURRENCY"] = 1] = "CURRENCY";
|
|
4588
|
-
ExportRowDataTypeEnum[ExportRowDataTypeEnum["DATE"] = 2] = "DATE";
|
|
4589
|
-
})(ExportRowDataTypeEnum || (ExportRowDataTypeEnum = {}));
|
|
4590
|
-
|
|
4591
|
-
var EXPORT_DATA_TABLE_COLUMNS = [
|
|
4592
|
-
'Pmt No.',
|
|
4593
|
-
'Date',
|
|
4594
|
-
'Payment Due',
|
|
4595
|
-
'Interest Accrued',
|
|
4596
|
-
'Principal Paid',
|
|
4597
|
-
'Principal Balance',
|
|
4598
|
-
'Payout'
|
|
4599
|
-
];
|
|
4600
4572
|
// @Todo no base model from backend list
|
|
4601
4573
|
/**
|
|
4602
4574
|
* Loan payment class
|
|
@@ -4604,17 +4576,6 @@
|
|
|
4604
4576
|
var LoanPayment = /** @class */ (function () {
|
|
4605
4577
|
function LoanPayment() {
|
|
4606
4578
|
}
|
|
4607
|
-
LoanPayment.prototype.toDataTableRows = function () {
|
|
4608
|
-
return [
|
|
4609
|
-
classTransformer.plainToClass(ExportRow, { data: this.number, type: ExportRowDataTypeEnum.STRING }),
|
|
4610
|
-
classTransformer.plainToClass(ExportRow, { data: this.date, type: ExportRowDataTypeEnum.DATE }),
|
|
4611
|
-
classTransformer.plainToClass(ExportRow, { data: this.paymentDue, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
4612
|
-
classTransformer.plainToClass(ExportRow, { data: this.interestAccrued, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
4613
|
-
classTransformer.plainToClass(ExportRow, { data: this.principalPaid, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
4614
|
-
classTransformer.plainToClass(ExportRow, { data: this.principalBalance, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
4615
|
-
classTransformer.plainToClass(ExportRow, { data: this.payout, type: ExportRowDataTypeEnum.CURRENCY }),
|
|
4616
|
-
];
|
|
4617
|
-
};
|
|
4618
4579
|
return LoanPayment;
|
|
4619
4580
|
}());
|
|
4620
4581
|
__decorate([
|
|
@@ -7618,7 +7579,6 @@
|
|
|
7618
7579
|
*/
|
|
7619
7580
|
var ExportDataTable = /** @class */ (function () {
|
|
7620
7581
|
function ExportDataTable() {
|
|
7621
|
-
this.footer = [];
|
|
7622
7582
|
}
|
|
7623
7583
|
return ExportDataTable;
|
|
7624
7584
|
}());
|
|
@@ -9266,7 +9226,6 @@
|
|
|
9266
9226
|
}
|
|
9267
9227
|
PropertyService.prototype.listenEvents = function () {
|
|
9268
9228
|
this.listenShareInviteAccepted();
|
|
9269
|
-
this.listenServiceSubscriptionUpdated();
|
|
9270
9229
|
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
9271
9230
|
this.listenMovementsChanged();
|
|
9272
9231
|
};
|
|
@@ -9277,13 +9236,6 @@
|
|
|
9277
9236
|
var _this = this;
|
|
9278
9237
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
9279
9238
|
};
|
|
9280
|
-
/**
|
|
9281
|
-
* Update cache when user's service subscription is updated
|
|
9282
|
-
*/
|
|
9283
|
-
PropertyService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
9284
|
-
var _this = this;
|
|
9285
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
9286
|
-
};
|
|
9287
9239
|
/**
|
|
9288
9240
|
* Update cache when property category changed
|
|
9289
9241
|
*/
|
|
@@ -10494,8 +10446,7 @@
|
|
|
10494
10446
|
*/
|
|
10495
10447
|
BasiqService.prototype.confirmConsents = function () {
|
|
10496
10448
|
var _this = this;
|
|
10497
|
-
return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (
|
|
10498
|
-
var isConfirmed = !!Object.values(response).length;
|
|
10449
|
+
return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (isConfirmed) {
|
|
10499
10450
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED, isConfirmed));
|
|
10500
10451
|
return isConfirmed;
|
|
10501
10452
|
}));
|
|
@@ -11683,49 +11634,6 @@
|
|
|
11683
11634
|
}] }];
|
|
11684
11635
|
} });
|
|
11685
11636
|
|
|
11686
|
-
/**
|
|
11687
|
-
* Service to handle array-like data table logic
|
|
11688
|
-
*/
|
|
11689
|
-
var DataTableService = /** @class */ (function () {
|
|
11690
|
-
function DataTableService(currencyPipe, datePipe) {
|
|
11691
|
-
this.currencyPipe = currencyPipe;
|
|
11692
|
-
this.datePipe = datePipe;
|
|
11693
|
-
}
|
|
11694
|
-
DataTableService.prototype.initDataTable = function (exportableModels, headerColumns) {
|
|
11695
|
-
return classTransformer.plainToClass(ExportDataTable, {
|
|
11696
|
-
header: headerColumns,
|
|
11697
|
-
rows: this.getDataTableRows(exportableModels),
|
|
11698
|
-
});
|
|
11699
|
-
};
|
|
11700
|
-
/**
|
|
11701
|
-
* Get data for the exporting table rows
|
|
11702
|
-
*/
|
|
11703
|
-
DataTableService.prototype.getDataTableRows = function (exportableModels) {
|
|
11704
|
-
var _this = this;
|
|
11705
|
-
return exportableModels.map(function (model) {
|
|
11706
|
-
return model.toDataTableRows().map(function (row) {
|
|
11707
|
-
switch (row.type) {
|
|
11708
|
-
case ExportRowDataTypeEnum.DATE:
|
|
11709
|
-
return _this.datePipe.transform(row.data, 'dd/MM/YYYY').toString();
|
|
11710
|
-
case ExportRowDataTypeEnum.CURRENCY:
|
|
11711
|
-
return _this.currencyPipe.transform(row.data).toString();
|
|
11712
|
-
default:
|
|
11713
|
-
return row.data.toString();
|
|
11714
|
-
}
|
|
11715
|
-
});
|
|
11716
|
-
});
|
|
11717
|
-
};
|
|
11718
|
-
return DataTableService;
|
|
11719
|
-
}());
|
|
11720
|
-
DataTableService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, deps: [{ token: i1__namespace$1.CurrencyPipe }, { token: i1__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11721
|
-
DataTableService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, providedIn: 'root' });
|
|
11722
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, decorators: [{
|
|
11723
|
-
type: i0.Injectable,
|
|
11724
|
-
args: [{
|
|
11725
|
-
providedIn: 'root'
|
|
11726
|
-
}]
|
|
11727
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
|
|
11728
|
-
|
|
11729
11637
|
var HeaderTitleService = /** @class */ (function () {
|
|
11730
11638
|
function HeaderTitleService(router, activatedRoute) {
|
|
11731
11639
|
this.router = router;
|
|
@@ -11733,7 +11641,7 @@
|
|
|
11733
11641
|
}
|
|
11734
11642
|
HeaderTitleService.prototype.handleTitle = function () {
|
|
11735
11643
|
var _this = this;
|
|
11736
|
-
return this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$
|
|
11644
|
+
return this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$1.NavigationEnd; }), operators.map(function () { return _this.activatedRoute; }), operators.map(function (route) {
|
|
11737
11645
|
while (route.firstChild) {
|
|
11738
11646
|
route = route.firstChild;
|
|
11739
11647
|
}
|
|
@@ -11742,14 +11650,14 @@
|
|
|
11742
11650
|
};
|
|
11743
11651
|
return HeaderTitleService;
|
|
11744
11652
|
}());
|
|
11745
|
-
HeaderTitleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, deps: [{ token: i1__namespace$
|
|
11653
|
+
HeaderTitleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, deps: [{ token: i1__namespace$1.Router }, { token: i1__namespace$1.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11746
11654
|
HeaderTitleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, providedIn: 'root' });
|
|
11747
11655
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, decorators: [{
|
|
11748
11656
|
type: i0.Injectable,
|
|
11749
11657
|
args: [{
|
|
11750
11658
|
providedIn: 'root'
|
|
11751
11659
|
}]
|
|
11752
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
11660
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.Router }, { type: i1__namespace$1.ActivatedRoute }]; } });
|
|
11753
11661
|
|
|
11754
11662
|
/**
|
|
11755
11663
|
* Service to work with Other Income Forecasts
|
|
@@ -12040,14 +11948,14 @@
|
|
|
12040
11948
|
};
|
|
12041
11949
|
return KompassifyService;
|
|
12042
11950
|
}());
|
|
12043
|
-
KompassifyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, deps: [{ token: i1__namespace$
|
|
11951
|
+
KompassifyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, deps: [{ token: i1__namespace$1.Router }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12044
11952
|
KompassifyService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, providedIn: 'root' });
|
|
12045
11953
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, decorators: [{
|
|
12046
11954
|
type: i0.Injectable,
|
|
12047
11955
|
args: [{
|
|
12048
11956
|
providedIn: 'root'
|
|
12049
11957
|
}]
|
|
12050
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
11958
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.Router }]; } });
|
|
12051
11959
|
|
|
12052
11960
|
/**
|
|
12053
11961
|
* Service that handling loans logic
|
|
@@ -12310,7 +12218,7 @@
|
|
|
12310
12218
|
this.setDocumentTitle(pdf, title);
|
|
12311
12219
|
this.setDocumentLogo(pdf);
|
|
12312
12220
|
dataTables.forEach(function (dataTable) {
|
|
12313
|
-
autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer
|
|
12221
|
+
autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer] }, _this.setTableOptions(pdf, dataTable.caption)));
|
|
12314
12222
|
});
|
|
12315
12223
|
return pdf;
|
|
12316
12224
|
};
|
|
@@ -12604,14 +12512,14 @@
|
|
|
12604
12512
|
};
|
|
12605
12513
|
return PropertyHoldingCostsService;
|
|
12606
12514
|
}());
|
|
12607
|
-
PropertyHoldingCostsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token:
|
|
12515
|
+
PropertyHoldingCostsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token: i2__namespace.CurrencyPipe }, { token: i2__namespace.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12608
12516
|
PropertyHoldingCostsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, providedIn: 'root' });
|
|
12609
12517
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, decorators: [{
|
|
12610
12518
|
type: i0.Injectable,
|
|
12611
12519
|
args: [{
|
|
12612
12520
|
providedIn: 'root'
|
|
12613
12521
|
}]
|
|
12614
|
-
}], ctorParameters: function () { return [{ type: PdfService }, { type:
|
|
12522
|
+
}], ctorParameters: function () { return [{ type: PdfService }, { type: i2__namespace.CurrencyPipe }, { type: i2__namespace.DatePipe }]; } });
|
|
12615
12523
|
|
|
12616
12524
|
/**
|
|
12617
12525
|
* Service for work with Property Categories
|
|
@@ -13330,34 +13238,41 @@
|
|
|
13330
13238
|
* Service to work with user
|
|
13331
13239
|
*/
|
|
13332
13240
|
var UserService = /** @class */ (function () {
|
|
13333
|
-
function UserService(http, jwtService, eventDispatcherService, environment) {
|
|
13241
|
+
function UserService(http, jwtService, eventDispatcherService, sseService, environment) {
|
|
13334
13242
|
this.http = http;
|
|
13335
13243
|
this.jwtService = jwtService;
|
|
13336
13244
|
this.eventDispatcherService = eventDispatcherService;
|
|
13245
|
+
this.sseService = sseService;
|
|
13337
13246
|
this.environment = environment;
|
|
13338
13247
|
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
13339
13248
|
this.listenEvents();
|
|
13340
13249
|
}
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13250
|
+
UserService.prototype.listenEvents = function () {
|
|
13251
|
+
this.listenServiceSubscriptionUpdated();
|
|
13252
|
+
this.listenBasiqConcentUpdated();
|
|
13253
|
+
};
|
|
13344
13254
|
UserService.prototype.get = function () {
|
|
13345
|
-
var _this = this;
|
|
13346
13255
|
if (!this.cache) {
|
|
13347
|
-
this.
|
|
13348
|
-
.pipe(operators.map(function (userBase) {
|
|
13349
|
-
return classTransformer.plainToClass(User, userBase);
|
|
13350
|
-
}))
|
|
13351
|
-
.subscribe(function (user) {
|
|
13352
|
-
localStorage.setItem('userId', user.id.toString());
|
|
13353
|
-
// @TODO remove
|
|
13354
|
-
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
13355
|
-
_this.cache = user;
|
|
13356
|
-
_this.cacheSubject.next(_this.cache);
|
|
13357
|
-
});
|
|
13256
|
+
this.fetch().subscribe();
|
|
13358
13257
|
}
|
|
13359
13258
|
return this.cacheSubject.asObservable();
|
|
13360
13259
|
};
|
|
13260
|
+
/**
|
|
13261
|
+
* Get current user
|
|
13262
|
+
*/
|
|
13263
|
+
UserService.prototype.fetch = function () {
|
|
13264
|
+
var _this = this;
|
|
13265
|
+
return this.http.get(this.environment.apiV2 + "/users/current")
|
|
13266
|
+
.pipe(operators.map(function (userBase) {
|
|
13267
|
+
var user = classTransformer.plainToClass(User, userBase);
|
|
13268
|
+
localStorage.setItem('userId', user.id.toString());
|
|
13269
|
+
// @TODO remove
|
|
13270
|
+
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
13271
|
+
_this.cache = user;
|
|
13272
|
+
_this.cacheSubject.next(_this.cache);
|
|
13273
|
+
return user;
|
|
13274
|
+
}));
|
|
13275
|
+
};
|
|
13361
13276
|
/**
|
|
13362
13277
|
* Register new user
|
|
13363
13278
|
*/
|
|
@@ -13431,7 +13346,20 @@
|
|
|
13431
13346
|
UserService.prototype.switchFinancialYear = function () {
|
|
13432
13347
|
return this.http.get(this.environment.apiV2 + "/financial-year/switch");
|
|
13433
13348
|
};
|
|
13434
|
-
|
|
13349
|
+
/**
|
|
13350
|
+
* clear service cache
|
|
13351
|
+
*/
|
|
13352
|
+
UserService.prototype.resetCache = function () {
|
|
13353
|
+
this.fetch().subscribe();
|
|
13354
|
+
};
|
|
13355
|
+
/**
|
|
13356
|
+
* Update cache when user's service subscription is updated
|
|
13357
|
+
*/
|
|
13358
|
+
UserService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
13359
|
+
var _this = this;
|
|
13360
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
13361
|
+
};
|
|
13362
|
+
UserService.prototype.listenBasiqConcentUpdated = function () {
|
|
13435
13363
|
var _this = this;
|
|
13436
13364
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe(function (isConfirmed) {
|
|
13437
13365
|
if (!isConfirmed) {
|
|
@@ -13439,13 +13367,13 @@
|
|
|
13439
13367
|
}
|
|
13440
13368
|
var user = clone__default["default"](_this.cache);
|
|
13441
13369
|
user.clientDetails.basiqConsentExist = true;
|
|
13442
|
-
_this.cache =
|
|
13370
|
+
_this.cache = user;
|
|
13443
13371
|
_this.cacheSubject.next(_this.cache);
|
|
13444
13372
|
});
|
|
13445
13373
|
};
|
|
13446
13374
|
return UserService;
|
|
13447
13375
|
}());
|
|
13448
|
-
UserService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, deps: [{ token: i1__namespace.HttpClient }, { token: JwtService }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
13376
|
+
UserService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, deps: [{ token: i1__namespace.HttpClient }, { token: JwtService }, { token: EventDispatcherService }, { token: SseService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
13449
13377
|
UserService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, providedIn: 'root' });
|
|
13450
13378
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, decorators: [{
|
|
13451
13379
|
type: i0.Injectable,
|
|
@@ -13453,7 +13381,7 @@
|
|
|
13453
13381
|
providedIn: 'root'
|
|
13454
13382
|
}]
|
|
13455
13383
|
}], ctorParameters: function () {
|
|
13456
|
-
return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
13384
|
+
return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
|
|
13457
13385
|
type: i0.Inject,
|
|
13458
13386
|
args: ['environment']
|
|
13459
13387
|
}] }];
|
|
@@ -14153,7 +14081,6 @@
|
|
|
14153
14081
|
exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
|
|
14154
14082
|
exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
|
|
14155
14083
|
exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
|
|
14156
|
-
exports.DataTableService = DataTableService;
|
|
14157
14084
|
exports.Depreciation = Depreciation;
|
|
14158
14085
|
exports.DepreciationCapitalProject = DepreciationCapitalProject;
|
|
14159
14086
|
exports.DepreciationCapitalProjectService = DepreciationCapitalProjectService;
|
|
@@ -14172,7 +14099,6 @@
|
|
|
14172
14099
|
exports.DocumentFolder = DocumentFolder;
|
|
14173
14100
|
exports.DocumentFolderService = DocumentFolderService;
|
|
14174
14101
|
exports.ENDPOINTS = ENDPOINTS;
|
|
14175
|
-
exports.EXPORT_DATA_TABLE_COLUMNS = EXPORT_DATA_TABLE_COLUMNS;
|
|
14176
14102
|
exports.EmployeeCollection = EmployeeCollection;
|
|
14177
14103
|
exports.EmployeeDetails = EmployeeDetails;
|
|
14178
14104
|
exports.EmployeeInvite = EmployeeInvite;
|