taxtank-core 0.16.1 → 0.16.4
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 +140 -44
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/interfaces/table-exportable.interface.js +2 -0
- package/esm2015/lib/models/export/export-data-table.js +4 -1
- package/esm2015/lib/models/export/export-row-data-type.enum.js +10 -0
- package/esm2015/lib/models/export/export-row.js +6 -0
- package/esm2015/lib/models/loan/loan-payment.js +24 -2
- package/esm2015/lib/services/data-table/data-table.service.js +47 -0
- 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 +3 -1
- package/fesm2015/taxtank-core.js +129 -38
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/interfaces/table-exportable.interface.d.ts +7 -0
- package/lib/models/export/export-row-data-type.enum.d.ts +8 -0
- package/lib/models/export/export-row.d.ts +8 -0
- package/lib/models/loan/loan-payment.d.ts +6 -1
- package/lib/services/data-table/data-table.service.d.ts +19 -0
- 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 +2 -0
|
@@ -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, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, flatten, hasIn, first, last, compact, uniqBy, concat, moment, momentRange, cloneDeep$1, forms, fromPairs, _, eventsource_min_js, i1$2, 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 i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
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$2 = /*#__PURE__*/_interopNamespace(i1$2);
|
|
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: [i1$1.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
|
+
i1$1.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
|
+
i1$1.CommonModule,
|
|
1120
1120
|
InterceptorsModule
|
|
1121
1121
|
]
|
|
1122
1122
|
}]
|
|
@@ -4569,6 +4569,34 @@
|
|
|
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
|
+
];
|
|
4572
4600
|
// @Todo no base model from backend list
|
|
4573
4601
|
/**
|
|
4574
4602
|
* Loan payment class
|
|
@@ -4576,6 +4604,17 @@
|
|
|
4576
4604
|
var LoanPayment = /** @class */ (function () {
|
|
4577
4605
|
function LoanPayment() {
|
|
4578
4606
|
}
|
|
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
|
+
};
|
|
4579
4618
|
return LoanPayment;
|
|
4580
4619
|
}());
|
|
4581
4620
|
__decorate([
|
|
@@ -7579,6 +7618,7 @@
|
|
|
7579
7618
|
*/
|
|
7580
7619
|
var ExportDataTable = /** @class */ (function () {
|
|
7581
7620
|
function ExportDataTable() {
|
|
7621
|
+
this.footer = [];
|
|
7582
7622
|
}
|
|
7583
7623
|
return ExportDataTable;
|
|
7584
7624
|
}());
|
|
@@ -9226,7 +9266,6 @@
|
|
|
9226
9266
|
}
|
|
9227
9267
|
PropertyService.prototype.listenEvents = function () {
|
|
9228
9268
|
this.listenShareInviteAccepted();
|
|
9229
|
-
this.listenServiceSubscriptionUpdated();
|
|
9230
9269
|
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
9231
9270
|
this.listenMovementsChanged();
|
|
9232
9271
|
};
|
|
@@ -9237,13 +9276,6 @@
|
|
|
9237
9276
|
var _this = this;
|
|
9238
9277
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
9239
9278
|
};
|
|
9240
|
-
/**
|
|
9241
|
-
* Update cache when user's service subscription is updated
|
|
9242
|
-
*/
|
|
9243
|
-
PropertyService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
9244
|
-
var _this = this;
|
|
9245
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
9246
|
-
};
|
|
9247
9279
|
/**
|
|
9248
9280
|
* Update cache when property category changed
|
|
9249
9281
|
*/
|
|
@@ -10454,8 +10486,7 @@
|
|
|
10454
10486
|
*/
|
|
10455
10487
|
BasiqService.prototype.confirmConsents = function () {
|
|
10456
10488
|
var _this = this;
|
|
10457
|
-
return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (
|
|
10458
|
-
var isConfirmed = !!Object.values(response).length;
|
|
10489
|
+
return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (isConfirmed) {
|
|
10459
10490
|
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED, isConfirmed));
|
|
10460
10491
|
return isConfirmed;
|
|
10461
10492
|
}));
|
|
@@ -11643,6 +11674,49 @@
|
|
|
11643
11674
|
}] }];
|
|
11644
11675
|
} });
|
|
11645
11676
|
|
|
11677
|
+
/**
|
|
11678
|
+
* Service to handle array-like data table logic
|
|
11679
|
+
*/
|
|
11680
|
+
var DataTableService = /** @class */ (function () {
|
|
11681
|
+
function DataTableService(currencyPipe, datePipe) {
|
|
11682
|
+
this.currencyPipe = currencyPipe;
|
|
11683
|
+
this.datePipe = datePipe;
|
|
11684
|
+
}
|
|
11685
|
+
DataTableService.prototype.initDataTable = function (exportableModels, headerColumns) {
|
|
11686
|
+
return classTransformer.plainToClass(ExportDataTable, {
|
|
11687
|
+
header: headerColumns,
|
|
11688
|
+
rows: this.getDataTableRows(exportableModels),
|
|
11689
|
+
});
|
|
11690
|
+
};
|
|
11691
|
+
/**
|
|
11692
|
+
* Get data for the exporting table rows
|
|
11693
|
+
*/
|
|
11694
|
+
DataTableService.prototype.getDataTableRows = function (exportableModels) {
|
|
11695
|
+
var _this = this;
|
|
11696
|
+
return exportableModels.map(function (model) {
|
|
11697
|
+
return model.toDataTableRows().map(function (row) {
|
|
11698
|
+
switch (row.type) {
|
|
11699
|
+
case ExportRowDataTypeEnum.DATE:
|
|
11700
|
+
return _this.datePipe.transform(row.data, 'dd/MM/YYYY').toString();
|
|
11701
|
+
case ExportRowDataTypeEnum.CURRENCY:
|
|
11702
|
+
return _this.currencyPipe.transform(row.data).toString();
|
|
11703
|
+
default:
|
|
11704
|
+
return row.data.toString();
|
|
11705
|
+
}
|
|
11706
|
+
});
|
|
11707
|
+
});
|
|
11708
|
+
};
|
|
11709
|
+
return DataTableService;
|
|
11710
|
+
}());
|
|
11711
|
+
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 });
|
|
11712
|
+
DataTableService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, providedIn: 'root' });
|
|
11713
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, decorators: [{
|
|
11714
|
+
type: i0.Injectable,
|
|
11715
|
+
args: [{
|
|
11716
|
+
providedIn: 'root'
|
|
11717
|
+
}]
|
|
11718
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
|
|
11719
|
+
|
|
11646
11720
|
var HeaderTitleService = /** @class */ (function () {
|
|
11647
11721
|
function HeaderTitleService(router, activatedRoute) {
|
|
11648
11722
|
this.router = router;
|
|
@@ -11650,7 +11724,7 @@
|
|
|
11650
11724
|
}
|
|
11651
11725
|
HeaderTitleService.prototype.handleTitle = function () {
|
|
11652
11726
|
var _this = this;
|
|
11653
|
-
return this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$
|
|
11727
|
+
return this.router.events.pipe(operators.filter(function (event) { return event instanceof i1$2.NavigationEnd; }), operators.map(function () { return _this.activatedRoute; }), operators.map(function (route) {
|
|
11654
11728
|
while (route.firstChild) {
|
|
11655
11729
|
route = route.firstChild;
|
|
11656
11730
|
}
|
|
@@ -11659,14 +11733,14 @@
|
|
|
11659
11733
|
};
|
|
11660
11734
|
return HeaderTitleService;
|
|
11661
11735
|
}());
|
|
11662
|
-
HeaderTitleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, deps: [{ token: i1__namespace$
|
|
11736
|
+
HeaderTitleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, deps: [{ token: i1__namespace$2.Router }, { token: i1__namespace$2.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11663
11737
|
HeaderTitleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, providedIn: 'root' });
|
|
11664
11738
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: HeaderTitleService, decorators: [{
|
|
11665
11739
|
type: i0.Injectable,
|
|
11666
11740
|
args: [{
|
|
11667
11741
|
providedIn: 'root'
|
|
11668
11742
|
}]
|
|
11669
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
11743
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$2.Router }, { type: i1__namespace$2.ActivatedRoute }]; } });
|
|
11670
11744
|
|
|
11671
11745
|
/**
|
|
11672
11746
|
* Service to work with Other Income Forecasts
|
|
@@ -11957,14 +12031,14 @@
|
|
|
11957
12031
|
};
|
|
11958
12032
|
return KompassifyService;
|
|
11959
12033
|
}());
|
|
11960
|
-
KompassifyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, deps: [{ token: i1__namespace$
|
|
12034
|
+
KompassifyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, deps: [{ token: i1__namespace$2.Router }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11961
12035
|
KompassifyService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, providedIn: 'root' });
|
|
11962
12036
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: KompassifyService, decorators: [{
|
|
11963
12037
|
type: i0.Injectable,
|
|
11964
12038
|
args: [{
|
|
11965
12039
|
providedIn: 'root'
|
|
11966
12040
|
}]
|
|
11967
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$
|
|
12041
|
+
}], ctorParameters: function () { return [{ type: i1__namespace$2.Router }]; } });
|
|
11968
12042
|
|
|
11969
12043
|
/**
|
|
11970
12044
|
* Service that handling loans logic
|
|
@@ -12227,7 +12301,7 @@
|
|
|
12227
12301
|
this.setDocumentTitle(pdf, title);
|
|
12228
12302
|
this.setDocumentLogo(pdf);
|
|
12229
12303
|
dataTables.forEach(function (dataTable) {
|
|
12230
|
-
autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer] }, _this.setTableOptions(pdf, dataTable.caption)));
|
|
12304
|
+
autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer || []] }, _this.setTableOptions(pdf, dataTable.caption)));
|
|
12231
12305
|
});
|
|
12232
12306
|
return pdf;
|
|
12233
12307
|
};
|
|
@@ -12521,14 +12595,14 @@
|
|
|
12521
12595
|
};
|
|
12522
12596
|
return PropertyHoldingCostsService;
|
|
12523
12597
|
}());
|
|
12524
|
-
PropertyHoldingCostsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token:
|
|
12598
|
+
PropertyHoldingCostsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token: i1__namespace$1.CurrencyPipe }, { token: i1__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
12525
12599
|
PropertyHoldingCostsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, providedIn: 'root' });
|
|
12526
12600
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, decorators: [{
|
|
12527
12601
|
type: i0.Injectable,
|
|
12528
12602
|
args: [{
|
|
12529
12603
|
providedIn: 'root'
|
|
12530
12604
|
}]
|
|
12531
|
-
}], ctorParameters: function () { return [{ type: PdfService }, { type:
|
|
12605
|
+
}], ctorParameters: function () { return [{ type: PdfService }, { type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
|
|
12532
12606
|
|
|
12533
12607
|
/**
|
|
12534
12608
|
* Service for work with Property Categories
|
|
@@ -13247,34 +13321,41 @@
|
|
|
13247
13321
|
* Service to work with user
|
|
13248
13322
|
*/
|
|
13249
13323
|
var UserService = /** @class */ (function () {
|
|
13250
|
-
function UserService(http, jwtService, eventDispatcherService, environment) {
|
|
13324
|
+
function UserService(http, jwtService, eventDispatcherService, sseService, environment) {
|
|
13251
13325
|
this.http = http;
|
|
13252
13326
|
this.jwtService = jwtService;
|
|
13253
13327
|
this.eventDispatcherService = eventDispatcherService;
|
|
13328
|
+
this.sseService = sseService;
|
|
13254
13329
|
this.environment = environment;
|
|
13255
13330
|
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
13256
13331
|
this.listenEvents();
|
|
13257
13332
|
}
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13333
|
+
UserService.prototype.listenEvents = function () {
|
|
13334
|
+
this.listenServiceSubscriptionUpdated();
|
|
13335
|
+
this.listenBasiqConcentUpdated();
|
|
13336
|
+
};
|
|
13261
13337
|
UserService.prototype.get = function () {
|
|
13262
|
-
var _this = this;
|
|
13263
13338
|
if (!this.cache) {
|
|
13264
|
-
this.
|
|
13265
|
-
.pipe(operators.map(function (userBase) {
|
|
13266
|
-
return classTransformer.plainToClass(User, userBase);
|
|
13267
|
-
}))
|
|
13268
|
-
.subscribe(function (user) {
|
|
13269
|
-
localStorage.setItem('userId', user.id.toString());
|
|
13270
|
-
// @TODO remove
|
|
13271
|
-
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
13272
|
-
_this.cache = user;
|
|
13273
|
-
_this.cacheSubject.next(_this.cache);
|
|
13274
|
-
});
|
|
13339
|
+
this.fetch().subscribe();
|
|
13275
13340
|
}
|
|
13276
13341
|
return this.cacheSubject.asObservable();
|
|
13277
13342
|
};
|
|
13343
|
+
/**
|
|
13344
|
+
* Get current user
|
|
13345
|
+
*/
|
|
13346
|
+
UserService.prototype.fetch = function () {
|
|
13347
|
+
var _this = this;
|
|
13348
|
+
return this.http.get(this.environment.apiV2 + "/users/current")
|
|
13349
|
+
.pipe(operators.map(function (userBase) {
|
|
13350
|
+
var user = classTransformer.plainToClass(User, userBase);
|
|
13351
|
+
localStorage.setItem('userId', user.id.toString());
|
|
13352
|
+
// @TODO remove
|
|
13353
|
+
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
13354
|
+
_this.cache = user;
|
|
13355
|
+
_this.cacheSubject.next(_this.cache);
|
|
13356
|
+
return user;
|
|
13357
|
+
}));
|
|
13358
|
+
};
|
|
13278
13359
|
/**
|
|
13279
13360
|
* Register new user
|
|
13280
13361
|
*/
|
|
@@ -13348,7 +13429,20 @@
|
|
|
13348
13429
|
UserService.prototype.switchFinancialYear = function () {
|
|
13349
13430
|
return this.http.get(this.environment.apiV2 + "/financial-year/switch");
|
|
13350
13431
|
};
|
|
13351
|
-
|
|
13432
|
+
/**
|
|
13433
|
+
* clear service cache
|
|
13434
|
+
*/
|
|
13435
|
+
UserService.prototype.resetCache = function () {
|
|
13436
|
+
this.fetch().subscribe();
|
|
13437
|
+
};
|
|
13438
|
+
/**
|
|
13439
|
+
* Update cache when user's service subscription is updated
|
|
13440
|
+
*/
|
|
13441
|
+
UserService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
13442
|
+
var _this = this;
|
|
13443
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
13444
|
+
};
|
|
13445
|
+
UserService.prototype.listenBasiqConcentUpdated = function () {
|
|
13352
13446
|
var _this = this;
|
|
13353
13447
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe(function (isConfirmed) {
|
|
13354
13448
|
if (!isConfirmed) {
|
|
@@ -13356,13 +13450,13 @@
|
|
|
13356
13450
|
}
|
|
13357
13451
|
var user = clone__default["default"](_this.cache);
|
|
13358
13452
|
user.clientDetails.basiqConsentExist = true;
|
|
13359
|
-
_this.cache =
|
|
13453
|
+
_this.cache = user;
|
|
13360
13454
|
_this.cacheSubject.next(_this.cache);
|
|
13361
13455
|
});
|
|
13362
13456
|
};
|
|
13363
13457
|
return UserService;
|
|
13364
13458
|
}());
|
|
13365
|
-
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 });
|
|
13459
|
+
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 });
|
|
13366
13460
|
UserService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, providedIn: 'root' });
|
|
13367
13461
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, decorators: [{
|
|
13368
13462
|
type: i0.Injectable,
|
|
@@ -13370,7 +13464,7 @@
|
|
|
13370
13464
|
providedIn: 'root'
|
|
13371
13465
|
}]
|
|
13372
13466
|
}], ctorParameters: function () {
|
|
13373
|
-
return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: undefined, decorators: [{
|
|
13467
|
+
return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
|
|
13374
13468
|
type: i0.Inject,
|
|
13375
13469
|
args: ['environment']
|
|
13376
13470
|
}] }];
|
|
@@ -14070,6 +14164,7 @@
|
|
|
14070
14164
|
exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
|
|
14071
14165
|
exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
|
|
14072
14166
|
exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
|
|
14167
|
+
exports.DataTableService = DataTableService;
|
|
14073
14168
|
exports.Depreciation = Depreciation;
|
|
14074
14169
|
exports.DepreciationCapitalProject = DepreciationCapitalProject;
|
|
14075
14170
|
exports.DepreciationCapitalProjectService = DepreciationCapitalProjectService;
|
|
@@ -14088,6 +14183,7 @@
|
|
|
14088
14183
|
exports.DocumentFolder = DocumentFolder;
|
|
14089
14184
|
exports.DocumentFolderService = DocumentFolderService;
|
|
14090
14185
|
exports.ENDPOINTS = ENDPOINTS;
|
|
14186
|
+
exports.EXPORT_DATA_TABLE_COLUMNS = EXPORT_DATA_TABLE_COLUMNS;
|
|
14091
14187
|
exports.EmployeeCollection = EmployeeCollection;
|
|
14092
14188
|
exports.EmployeeDetails = EmployeeDetails;
|
|
14093
14189
|
exports.EmployeeInvite = EmployeeInvite;
|