taxtank-core 0.27.7 → 0.28.2
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 +412 -245
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/income-source.collection.js +4 -1
- package/esm2015/lib/collections/index.js +2 -1
- package/esm2015/lib/collections/sole/index.js +2 -0
- package/esm2015/lib/collections/sole/sole-invoice.collection.js +13 -0
- package/esm2015/lib/collections/vehicle/vehicle-logbook.collection.js +2 -2
- package/esm2015/lib/db/Models/sole/sole-business-loss.js +1 -1
- package/esm2015/lib/db/Models/sole/sole-business.js +1 -1
- package/esm2015/lib/forms/sole/sole-business.form.js +32 -2
- package/esm2015/lib/forms/sole/sole-details.form.js +3 -2
- package/esm2015/lib/interceptors/basiq-client-id.interceptor.js +31 -0
- package/esm2015/lib/interceptors/basiq-token.interceptor.js +35 -0
- package/esm2015/lib/interceptors/interceptors.module.js +15 -4
- package/esm2015/lib/models/endpoint/endpoints.const.js +2 -1
- package/esm2015/lib/models/event/app-event-type.enum.js +23 -20
- package/esm2015/lib/models/sole/sole-business.js +5 -1
- package/esm2015/lib/models/sole/sole-invoice.js +7 -1
- package/esm2015/lib/models/vehicle/vehicle-logbook.js +4 -4
- package/esm2015/lib/services/http/income-source/income-source.service.js +12 -1
- package/esm2015/lib/services/http/sole/sole-business/sole-business.service.js +10 -1
- package/esm2015/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.js +12 -1
- package/esm2015/lib/services/http/sole/sole-details/sole-details.service.js +10 -4
- package/esm2015/lib/services/http/user/user.service.js +12 -1
- package/esm2015/lib/validators/required-length.validator.js +12 -0
- package/fesm2015/taxtank-core.js +372 -226
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/income-source.collection.d.ts +1 -0
- package/lib/collections/index.d.ts +1 -0
- package/lib/collections/sole/index.d.ts +1 -0
- package/lib/collections/sole/sole-invoice.collection.d.ts +7 -0
- package/lib/db/Models/sole/sole-business-loss.d.ts +2 -3
- package/lib/db/Models/sole/sole-business.d.ts +2 -0
- package/lib/forms/sole/sole-business.form.d.ts +3 -0
- package/lib/interceptors/basiq-client-id.interceptor.d.ts +15 -0
- package/lib/interceptors/{basiq.interceptor.d.ts → basiq-token.interceptor.d.ts} +3 -3
- package/lib/models/event/app-event-type.enum.d.ts +22 -19
- package/lib/models/sole/sole-business.d.ts +2 -0
- package/lib/models/sole/sole-invoice.d.ts +2 -0
- package/lib/models/vehicle/vehicle-logbook.d.ts +2 -2
- package/lib/services/http/income-source/income-source.service.d.ts +7 -1
- package/lib/services/http/sole/sole-business/sole-business.service.d.ts +2 -0
- package/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.d.ts +4 -1
- package/lib/services/http/sole/sole-details/sole-details.service.d.ts +3 -1
- package/lib/services/http/user/user.service.d.ts +4 -0
- package/lib/validators/required-length.validator.d.ts +5 -0
- package/package.json +1 -1
- package/esm2015/lib/interceptors/basiq.interceptor.js +0 -35
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
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/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('lodash/compact'), require('@angular/forms'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('
|
|
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/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'lodash/compact', '@angular/forms', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '
|
|
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.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.compact, global.ng.forms, global.isEqual, global.fromPairs, global._, global.
|
|
5
|
-
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, compact, forms, isEqual, fromPairs, _,
|
|
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/last'), require('lodash/flatten'), require('lodash/hasIn'), require('lodash/first'), require('moment'), require('moment-range'), require('lodash/uniqBy'), require('lodash/concat'), require('rxjs/internal/observable/throwError'), require('lodash/cloneDeep'), require('event-source-polyfill/src/eventsource.min.js'), require('lodash/compact'), require('@angular/forms'), require('lodash/isEqual'), require('lodash/fromPairs'), require('lodash'), require('@angular/router'), require('lodash/clone'), require('html2pdf.js'), require('jspdf'), require('jspdf-autotable'), require('@stripe/stripe-js'), require('xlsx'), require('file-saver')) :
|
|
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/last', 'lodash/flatten', 'lodash/hasIn', 'lodash/first', 'moment', 'moment-range', 'lodash/uniqBy', 'lodash/concat', 'rxjs/internal/observable/throwError', 'lodash/cloneDeep', 'event-source-polyfill/src/eventsource.min.js', 'lodash/compact', '@angular/forms', 'lodash/isEqual', 'lodash/fromPairs', 'lodash', '@angular/router', 'lodash/clone', 'html2pdf.js', 'jspdf', 'jspdf-autotable', '@stripe/stripe-js', 'xlsx', 'file-saver'], factory) :
|
|
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.last, global.flatten, global.hasIn, global.first, global.moment$1, global.momentRange, global.uniqBy, global.concat, global.rxjs["internal/observable/throwError"], global.cloneDeep$1, global.eventsource_min_js, global.compact, global.ng.forms, global.isEqual, global.fromPairs, global._, global.ng.router, global.clone, global.html2pdf, global.jsPDF, global.autoTable, global.stripeJs, global.xlsx, global.FileSaver));
|
|
5
|
+
})(this, (function (exports, i0, i1$1, i1, rxjs, operators, classTransformer, angularJwt, get, last, flatten, hasIn, first, moment$1, momentRange, uniqBy, concat, throwError, cloneDeep$1, eventsource_min_js, compact, forms, isEqual, fromPairs, _, i1$2, clone, html2pdf, 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
|
|
|
@@ -588,25 +588,28 @@
|
|
|
588
588
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 38] = "PROPERTY_SUBSCRIPTION_DELETED";
|
|
589
589
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 39] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
|
|
590
590
|
AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 40] = "SERVICE_SUBSCRIPTION_UPDATED";
|
|
591
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
592
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
593
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
594
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
595
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
596
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
597
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
598
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
599
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
600
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
601
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
602
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
603
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
604
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
605
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
606
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
607
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
608
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
609
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
591
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 41] = "SOLE_BUSINESS_CREATED";
|
|
592
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 42] = "SOLE_DEPRECIATION_METHOD_UPDATED";
|
|
593
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 43] = "SOLE_DETAILS_CREATED";
|
|
594
|
+
AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 44] = "SOLE_DETAILS_UPDATED";
|
|
595
|
+
AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 45] = "TAX_REVIEW_UPDATED";
|
|
596
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 46] = "TRANSACTION_CREATED";
|
|
597
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 47] = "TRANSACTION_DELETED";
|
|
598
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 48] = "TRANSACTION_UPDATED";
|
|
599
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 49] = "TRANSACTION_UPDATED_WITH_RECEIPT";
|
|
600
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 50] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
|
|
601
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 51] = "TRANSACTION_RECEIPT_CREATED";
|
|
602
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 52] = "TRANSACTION_RECEIPT_DELETED";
|
|
603
|
+
AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 53] = "TRANSACTIONS_CREATED";
|
|
604
|
+
AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 54] = "USER_UPDATED";
|
|
605
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 55] = "VEHICLE_CLAIM_UPDATED";
|
|
606
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 56] = "VEHICLE_CLAIM_CREATED";
|
|
607
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 57] = "VEHICLE_CLAIM_DETAILS_UPDATED";
|
|
608
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 58] = "VEHICLE_CLAIM_DETAILS_CREATED";
|
|
609
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 59] = "VEHICLE_LOGBOOK_CREATED";
|
|
610
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 60] = "VEHICLE_LOGBOOK_UPDATED";
|
|
611
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 61] = "VEHICLE_LOGBOOK_DELETED";
|
|
612
|
+
AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 62] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
|
|
610
613
|
})(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
|
|
611
614
|
|
|
612
615
|
var EventDispatcherService = /** @class */ (function () {
|
|
@@ -1057,6 +1060,7 @@
|
|
|
1057
1060
|
SOLE_BUSINESSES_GET: new Endpoint('GET', '\\/sole-businesses'),
|
|
1058
1061
|
SOLE_BUSINESSES_POST: new Endpoint('POST', '\\/sole-businesses'),
|
|
1059
1062
|
SOLE_BUSINESSES_PUT: new Endpoint('PUT', '\\/sole-businesses\\/\\d+'),
|
|
1063
|
+
BUSINESS_ACTIVITIES_GET: new Endpoint('GET', '\\/sole-business-activities'),
|
|
1060
1064
|
SOLE_DEPRECIATION_METHODS_GET: new Endpoint('GET', '\\/sole-depreciation-methods'),
|
|
1061
1065
|
SOLE_DEPRECIATION_METHODS_PUT: new Endpoint('PUT', '\\/sole-depreciation-methods\\/\\d+'),
|
|
1062
1066
|
SOLE_INVOICES_GET: new Endpoint('GET', '\\/sole-invoices'),
|
|
@@ -3332,6 +3336,12 @@
|
|
|
3332
3336
|
SoleInvoice.prototype.isPaid = function () {
|
|
3333
3337
|
return this.status === exports.SoleInvoiceStatusesEnum.PAID;
|
|
3334
3338
|
};
|
|
3339
|
+
SoleInvoice.prototype.isOverdue = function () {
|
|
3340
|
+
return this.isPending() && this.dateTo < new Date();
|
|
3341
|
+
};
|
|
3342
|
+
SoleInvoice.prototype.isUnpaid = function () {
|
|
3343
|
+
return this.isPending() && this.dateTo >= new Date();
|
|
3344
|
+
};
|
|
3335
3345
|
return SoleInvoice;
|
|
3336
3346
|
}(SoleInvoice$1));
|
|
3337
3347
|
__decorate([
|
|
@@ -3426,15 +3436,15 @@
|
|
|
3426
3436
|
* Get logbook period date range from logbook date and weeksInPeriod duration
|
|
3427
3437
|
*/
|
|
3428
3438
|
VehicleLogbook.prototype.getPeriod = function () {
|
|
3429
|
-
return moment.rangeFromInterval('
|
|
3439
|
+
return moment.rangeFromInterval('milliseconds', VehicleLogbook.bestPeriodDuration, this.date);
|
|
3430
3440
|
};
|
|
3431
3441
|
return VehicleLogbook;
|
|
3432
3442
|
}(VehicleLogbook$1));
|
|
3433
3443
|
/**
|
|
3434
|
-
* Logbook period duration in
|
|
3444
|
+
* Logbook period duration in milliseconds.
|
|
3435
3445
|
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/211517441/Logbook+Vehicle
|
|
3436
3446
|
*/
|
|
3437
|
-
VehicleLogbook.
|
|
3447
|
+
VehicleLogbook.bestPeriodDuration = 12 * 7 * 24 * 3600 * 1000;
|
|
3438
3448
|
__decorate([
|
|
3439
3449
|
classTransformer.Type(function () { return Date; })
|
|
3440
3450
|
], VehicleLogbook.prototype, "date", void 0);
|
|
@@ -4673,6 +4683,9 @@
|
|
|
4673
4683
|
__decorate([
|
|
4674
4684
|
classTransformer.Type(function () { return SoleBusinessActivity$1; })
|
|
4675
4685
|
], SoleBusiness.prototype, "activity", void 0);
|
|
4686
|
+
__decorate([
|
|
4687
|
+
classTransformer.Type(function () { return IncomeSource; })
|
|
4688
|
+
], SoleBusiness.prototype, "incomeSource", void 0);
|
|
4676
4689
|
|
|
4677
4690
|
var SoleBusinessActivity = /** @class */ (function (_super) {
|
|
4678
4691
|
__extends(SoleBusinessActivity, _super);
|
|
@@ -6115,11 +6128,11 @@
|
|
|
6115
6128
|
/**
|
|
6116
6129
|
* Interceptor which adds user's basiq token to any http request to basiq api
|
|
6117
6130
|
*/
|
|
6118
|
-
var
|
|
6119
|
-
function
|
|
6131
|
+
var BasiqTokenInterceptor = /** @class */ (function () {
|
|
6132
|
+
function BasiqTokenInterceptor(basiqTokenService) {
|
|
6120
6133
|
this.basiqTokenService = basiqTokenService;
|
|
6121
6134
|
}
|
|
6122
|
-
|
|
6135
|
+
BasiqTokenInterceptor.prototype.intercept = function (request, next) {
|
|
6123
6136
|
var _this = this;
|
|
6124
6137
|
// skip non-basiq requests
|
|
6125
6138
|
if (!request.url.includes(BasiqService.basiqApiUrl)) {
|
|
@@ -6129,21 +6142,264 @@
|
|
|
6129
6142
|
return next.handle(_this.addToken(request, token));
|
|
6130
6143
|
}));
|
|
6131
6144
|
};
|
|
6132
|
-
|
|
6145
|
+
BasiqTokenInterceptor.prototype.addToken = function (request, token) {
|
|
6133
6146
|
return request.clone({
|
|
6134
6147
|
setHeaders: {
|
|
6135
6148
|
Authorization: 'Bearer ' + token.value
|
|
6136
6149
|
}
|
|
6137
6150
|
});
|
|
6138
6151
|
};
|
|
6139
|
-
return
|
|
6152
|
+
return BasiqTokenInterceptor;
|
|
6140
6153
|
}());
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
6154
|
+
BasiqTokenInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqTokenInterceptor, deps: [{ token: BasiqTokenService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
6155
|
+
BasiqTokenInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqTokenInterceptor });
|
|
6156
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqTokenInterceptor, decorators: [{
|
|
6144
6157
|
type: i0.Injectable
|
|
6145
6158
|
}], ctorParameters: function () { return [{ type: BasiqTokenService }]; } });
|
|
6146
6159
|
|
|
6160
|
+
/**
|
|
6161
|
+
* server sent events service
|
|
6162
|
+
* https://symfony.com/doc/current/mercure.html
|
|
6163
|
+
*/
|
|
6164
|
+
var SseService = /** @class */ (function () {
|
|
6165
|
+
function SseService(zone, jwtService, environment) {
|
|
6166
|
+
this.zone = zone;
|
|
6167
|
+
this.jwtService = jwtService;
|
|
6168
|
+
this.environment = environment;
|
|
6169
|
+
}
|
|
6170
|
+
/**
|
|
6171
|
+
* list to url for server events
|
|
6172
|
+
*/
|
|
6173
|
+
SseService.prototype.on = function (topic) {
|
|
6174
|
+
var _this = this;
|
|
6175
|
+
var url = new URL(this.environment.mercureUrl);
|
|
6176
|
+
url.searchParams.append('topic', this.environment.apiV2 + "/users/" + this.jwtService.decodeToken().username + "/" + topic);
|
|
6177
|
+
// tslint:disable-next-line:typedef
|
|
6178
|
+
return new rxjs.Observable(function (observer) {
|
|
6179
|
+
var es = new eventsource_min_js.EventSourcePolyfill(url, {
|
|
6180
|
+
headers: {
|
|
6181
|
+
Authorization: 'Bearer ' + _this.jwtService.getToken(),
|
|
6182
|
+
}
|
|
6183
|
+
});
|
|
6184
|
+
es.onmessage = function (event) {
|
|
6185
|
+
_this.zone.run(function () { return observer.next(event); });
|
|
6186
|
+
};
|
|
6187
|
+
})
|
|
6188
|
+
.pipe(operators.map(function (messageEvent) {
|
|
6189
|
+
return JSON.parse(messageEvent.data);
|
|
6190
|
+
}));
|
|
6191
|
+
};
|
|
6192
|
+
return SseService;
|
|
6193
|
+
}());
|
|
6194
|
+
SseService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SseService, deps: [{ token: i0__namespace.NgZone }, { token: JwtService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
6195
|
+
SseService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SseService, providedIn: 'root' });
|
|
6196
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SseService, decorators: [{
|
|
6197
|
+
type: i0.Injectable,
|
|
6198
|
+
args: [{
|
|
6199
|
+
providedIn: 'root'
|
|
6200
|
+
}]
|
|
6201
|
+
}], ctorParameters: function () {
|
|
6202
|
+
return [{ type: i0__namespace.NgZone }, { type: JwtService }, { type: undefined, decorators: [{
|
|
6203
|
+
type: i0.Inject,
|
|
6204
|
+
args: ['environment']
|
|
6205
|
+
}] }];
|
|
6206
|
+
} });
|
|
6207
|
+
|
|
6208
|
+
/**
|
|
6209
|
+
* Service to work with user
|
|
6210
|
+
*/
|
|
6211
|
+
var UserService = /** @class */ (function () {
|
|
6212
|
+
function UserService(http, jwtService, eventDispatcherService, sseService, environment) {
|
|
6213
|
+
this.http = http;
|
|
6214
|
+
this.jwtService = jwtService;
|
|
6215
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
6216
|
+
this.sseService = sseService;
|
|
6217
|
+
this.environment = environment;
|
|
6218
|
+
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
6219
|
+
this.listenEvents();
|
|
6220
|
+
}
|
|
6221
|
+
UserService.prototype.listenEvents = function () {
|
|
6222
|
+
this.listenServiceSubscriptionUpdated();
|
|
6223
|
+
};
|
|
6224
|
+
UserService.prototype.get = function () {
|
|
6225
|
+
var _this = this;
|
|
6226
|
+
if (!this.cache) {
|
|
6227
|
+
this.fetch().subscribe(function () { }, function (error) {
|
|
6228
|
+
// force logout user (clear localStorage) when get current user return error
|
|
6229
|
+
if (error.status === 500) {
|
|
6230
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.CURRENT_USER_GET_FAILED, null));
|
|
6231
|
+
}
|
|
6232
|
+
});
|
|
6233
|
+
}
|
|
6234
|
+
return this.cacheSubject.asObservable();
|
|
6235
|
+
};
|
|
6236
|
+
/**
|
|
6237
|
+
* Get current user
|
|
6238
|
+
*/
|
|
6239
|
+
UserService.prototype.fetch = function () {
|
|
6240
|
+
var _this = this;
|
|
6241
|
+
return this.http.get(this.environment.apiV2 + "/users/current")
|
|
6242
|
+
.pipe(operators.map(function (userBase) {
|
|
6243
|
+
var user = classTransformer.plainToClass(User, userBase);
|
|
6244
|
+
localStorage.setItem('userId', user.id.toString());
|
|
6245
|
+
// @TODO remove
|
|
6246
|
+
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
6247
|
+
_this.cache = user;
|
|
6248
|
+
_this.cacheSubject.next(_this.cache);
|
|
6249
|
+
return user;
|
|
6250
|
+
}));
|
|
6251
|
+
};
|
|
6252
|
+
/**
|
|
6253
|
+
* Register new user
|
|
6254
|
+
*/
|
|
6255
|
+
UserService.prototype.register = function (data) {
|
|
6256
|
+
return this.http.post(this.environment.apiV2 + "/users/registration", data);
|
|
6257
|
+
};
|
|
6258
|
+
/**
|
|
6259
|
+
* Update user
|
|
6260
|
+
*/
|
|
6261
|
+
UserService.prototype.update = function (user) {
|
|
6262
|
+
var _this = this;
|
|
6263
|
+
return this.http.put(this.environment.apiV2 + "/users/" + user.id, user)
|
|
6264
|
+
.pipe(operators.map(function (userBase) {
|
|
6265
|
+
_this.cache = classTransformer.plainToClass(User, userBase);
|
|
6266
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.USER_UPDATED, null));
|
|
6267
|
+
_this.cacheSubject.next(_this.cache);
|
|
6268
|
+
}));
|
|
6269
|
+
};
|
|
6270
|
+
/**
|
|
6271
|
+
* Change user password
|
|
6272
|
+
*/
|
|
6273
|
+
UserService.prototype.changePassword = function (currentPassword, newPassword) {
|
|
6274
|
+
return this.http.put(this.environment.apiV2 + "/users/password/change", { currentPassword: currentPassword, newPassword: newPassword });
|
|
6275
|
+
};
|
|
6276
|
+
/**
|
|
6277
|
+
* Recovery user password
|
|
6278
|
+
*/
|
|
6279
|
+
UserService.prototype.recoveryPassword = function (email) {
|
|
6280
|
+
return this.http.put(this.environment.apiV2 + "/users/password/recovery", { email: email });
|
|
6281
|
+
};
|
|
6282
|
+
/**
|
|
6283
|
+
* Reset user password
|
|
6284
|
+
*/
|
|
6285
|
+
UserService.prototype.resetPassword = function (newPassword, resetToken) {
|
|
6286
|
+
return this.http.put(this.environment.apiV2 + "/users/password/reset", { newPassword: newPassword, resetToken: resetToken });
|
|
6287
|
+
};
|
|
6288
|
+
UserService.prototype.resendConfirmationEmail = function (email) {
|
|
6289
|
+
return this.http.post(this.environment.apiV2 + "/users/confirmation/resend", { email: email });
|
|
6290
|
+
};
|
|
6291
|
+
/**
|
|
6292
|
+
* Confirm registered user
|
|
6293
|
+
*/
|
|
6294
|
+
UserService.prototype.confirm = function (verificationCode) {
|
|
6295
|
+
return this.http.post(this.environment.apiV2 + "/users/confirmation", { verificationCode: verificationCode });
|
|
6296
|
+
};
|
|
6297
|
+
/**
|
|
6298
|
+
* Search existing user
|
|
6299
|
+
*/
|
|
6300
|
+
UserService.prototype.search = function (email) {
|
|
6301
|
+
return this.http.get(this.environment.apiV2 + "/users/search?email=" + email)
|
|
6302
|
+
.pipe(operators.map(function (userBase) {
|
|
6303
|
+
return classTransformer.plainToClass(User, userBase);
|
|
6304
|
+
}));
|
|
6305
|
+
};
|
|
6306
|
+
/**
|
|
6307
|
+
* Finish onboarding process
|
|
6308
|
+
*/
|
|
6309
|
+
UserService.prototype.finishOnboarding = function (user) {
|
|
6310
|
+
var _this = this;
|
|
6311
|
+
return this.http.put(this.environment.apiV2 + "/users/status", user)
|
|
6312
|
+
.pipe(operators.map(function () {
|
|
6313
|
+
_this.cache = user;
|
|
6314
|
+
_this.cacheSubject.next(_this.cache);
|
|
6315
|
+
}));
|
|
6316
|
+
};
|
|
6317
|
+
/**
|
|
6318
|
+
* Update user photo
|
|
6319
|
+
*/
|
|
6320
|
+
UserService.prototype.updatePhoto = function (photo) {
|
|
6321
|
+
var _this = this;
|
|
6322
|
+
return this.http.post(this.environment.apiV2 + "/users/photo?_method=PUT", photo)
|
|
6323
|
+
.pipe(operators.map(function (photoUrl) {
|
|
6324
|
+
_this.cache = classTransformer.plainToClass(User, Object.assign(_this.cache, { photo: photoUrl }));
|
|
6325
|
+
_this.cacheSubject.next(_this.cache);
|
|
6326
|
+
}));
|
|
6327
|
+
};
|
|
6328
|
+
UserService.prototype.switchFinancialYear = function (year) {
|
|
6329
|
+
return this.http.get(this.environment.apiV2 + "/financial-year/switch", { params: new i1.HttpParams({ fromString: "financialYear=" + year }) }).pipe(operators.map(function () {
|
|
6330
|
+
localStorage.setItem('financialYear', year.toString());
|
|
6331
|
+
window.location.reload();
|
|
6332
|
+
}));
|
|
6333
|
+
};
|
|
6334
|
+
/**
|
|
6335
|
+
* clear service cache
|
|
6336
|
+
*/
|
|
6337
|
+
UserService.prototype.resetCache = function () {
|
|
6338
|
+
this.fetch().subscribe();
|
|
6339
|
+
};
|
|
6340
|
+
/**
|
|
6341
|
+
* Create basiq (if not exist yet) to provide access to basiq api
|
|
6342
|
+
*/
|
|
6343
|
+
UserService.prototype.createBasiq = function () {
|
|
6344
|
+
var _this = this;
|
|
6345
|
+
return this.http.post(this.environment.apiV2 + "/basiq/user", {})
|
|
6346
|
+
.pipe(operators.map(function (basiqId) {
|
|
6347
|
+
_this.cache = classTransformer.plainToClass(User, Object.assign(_this.cache, { basiqId: basiqId }));
|
|
6348
|
+
_this.cacheSubject.next(_this.cache);
|
|
6349
|
+
return basiqId;
|
|
6350
|
+
}));
|
|
6351
|
+
};
|
|
6352
|
+
/**
|
|
6353
|
+
* Update cache when user's service subscription is updated
|
|
6354
|
+
*/
|
|
6355
|
+
UserService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
6356
|
+
var _this = this;
|
|
6357
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
6358
|
+
};
|
|
6359
|
+
return UserService;
|
|
6360
|
+
}());
|
|
6361
|
+
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 });
|
|
6362
|
+
UserService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, providedIn: 'root' });
|
|
6363
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, decorators: [{
|
|
6364
|
+
type: i0.Injectable,
|
|
6365
|
+
args: [{
|
|
6366
|
+
providedIn: 'root'
|
|
6367
|
+
}]
|
|
6368
|
+
}], ctorParameters: function () {
|
|
6369
|
+
return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
|
|
6370
|
+
type: i0.Inject,
|
|
6371
|
+
args: ['environment']
|
|
6372
|
+
}] }];
|
|
6373
|
+
} });
|
|
6374
|
+
|
|
6375
|
+
/**
|
|
6376
|
+
* Interceptor which check if client's basiq id exist and request it if not
|
|
6377
|
+
*/
|
|
6378
|
+
var BasiqClientIdInterceptor = /** @class */ (function () {
|
|
6379
|
+
function BasiqClientIdInterceptor(userService) {
|
|
6380
|
+
this.userService = userService;
|
|
6381
|
+
}
|
|
6382
|
+
BasiqClientIdInterceptor.prototype.intercept = function (request, next) {
|
|
6383
|
+
var _this = this;
|
|
6384
|
+
// Check if 'client id' URL segment contains null instead of id
|
|
6385
|
+
if (!request.url.startsWith(BasiqService.basiqApiUrl + "/users/null")) {
|
|
6386
|
+
return next.handle(request);
|
|
6387
|
+
}
|
|
6388
|
+
return this.userService.createBasiq().pipe(operators.mergeMap(function (basiqClientId) { return next.handle(_this.addId(request, basiqClientId)); }));
|
|
6389
|
+
};
|
|
6390
|
+
BasiqClientIdInterceptor.prototype.addId = function (request, basiqClientId) {
|
|
6391
|
+
return request.clone({
|
|
6392
|
+
url: request.url.replace('null', basiqClientId)
|
|
6393
|
+
});
|
|
6394
|
+
};
|
|
6395
|
+
return BasiqClientIdInterceptor;
|
|
6396
|
+
}());
|
|
6397
|
+
BasiqClientIdInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqClientIdInterceptor, deps: [{ token: UserService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
6398
|
+
BasiqClientIdInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqClientIdInterceptor });
|
|
6399
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqClientIdInterceptor, decorators: [{
|
|
6400
|
+
type: i0.Injectable
|
|
6401
|
+
}], ctorParameters: function () { return [{ type: UserService }]; } });
|
|
6402
|
+
|
|
6147
6403
|
var InterceptorsModule = /** @class */ (function () {
|
|
6148
6404
|
function InterceptorsModule() {
|
|
6149
6405
|
}
|
|
@@ -6180,7 +6436,12 @@
|
|
|
6180
6436
|
},
|
|
6181
6437
|
{
|
|
6182
6438
|
provide: i1.HTTP_INTERCEPTORS,
|
|
6183
|
-
useClass:
|
|
6439
|
+
useClass: BasiqTokenInterceptor,
|
|
6440
|
+
multi: true
|
|
6441
|
+
},
|
|
6442
|
+
{
|
|
6443
|
+
provide: i1.HTTP_INTERCEPTORS,
|
|
6444
|
+
useClass: BasiqClientIdInterceptor,
|
|
6184
6445
|
multi: true
|
|
6185
6446
|
}
|
|
6186
6447
|
] });
|
|
@@ -6216,7 +6477,12 @@
|
|
|
6216
6477
|
},
|
|
6217
6478
|
{
|
|
6218
6479
|
provide: i1.HTTP_INTERCEPTORS,
|
|
6219
|
-
useClass:
|
|
6480
|
+
useClass: BasiqTokenInterceptor,
|
|
6481
|
+
multi: true
|
|
6482
|
+
},
|
|
6483
|
+
{
|
|
6484
|
+
provide: i1.HTTP_INTERCEPTORS,
|
|
6485
|
+
useClass: BasiqClientIdInterceptor,
|
|
6220
6486
|
multi: true
|
|
6221
6487
|
}
|
|
6222
6488
|
]
|
|
@@ -6299,7 +6565,7 @@
|
|
|
6299
6565
|
if (this.items.length < 2) {
|
|
6300
6566
|
return false;
|
|
6301
6567
|
}
|
|
6302
|
-
return VehicleLogbook.
|
|
6568
|
+
return VehicleLogbook.bestPeriodDuration < (this.last.date.getTime() - this.first.date.getTime());
|
|
6303
6569
|
};
|
|
6304
6570
|
/**
|
|
6305
6571
|
* Get collection of non-personal logbooks (work-related, sole-related).
|
|
@@ -6382,6 +6648,23 @@
|
|
|
6382
6648
|
return VehicleLogbookCollection;
|
|
6383
6649
|
}(Collection));
|
|
6384
6650
|
|
|
6651
|
+
var SoleInvoiceCollection = /** @class */ (function (_super) {
|
|
6652
|
+
__extends(SoleInvoiceCollection, _super);
|
|
6653
|
+
function SoleInvoiceCollection() {
|
|
6654
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6655
|
+
}
|
|
6656
|
+
SoleInvoiceCollection.prototype.getOverdue = function () {
|
|
6657
|
+
return this.filter(function (invoice) { return invoice.isOverdue(); });
|
|
6658
|
+
};
|
|
6659
|
+
SoleInvoiceCollection.prototype.getUnpaid = function () {
|
|
6660
|
+
return this.filter(function (invoice) { return invoice.isUnpaid(); });
|
|
6661
|
+
};
|
|
6662
|
+
SoleInvoiceCollection.prototype.getPaid = function () {
|
|
6663
|
+
return this.filter(function (invoice) { return invoice.isPaid(); });
|
|
6664
|
+
};
|
|
6665
|
+
return SoleInvoiceCollection;
|
|
6666
|
+
}(Collection));
|
|
6667
|
+
|
|
6385
6668
|
// @TODO Alex move here all collections
|
|
6386
6669
|
|
|
6387
6670
|
var AccountSetupItemCollection = /** @class */ (function (_super) {
|
|
@@ -7114,6 +7397,9 @@
|
|
|
7114
7397
|
IncomeSourceCollection.prototype.getSalary = function () {
|
|
7115
7398
|
return this.items.filter(function (incomeSource) { return incomeSource.isSalaryIncome(); });
|
|
7116
7399
|
};
|
|
7400
|
+
IncomeSourceCollection.prototype.getOther = function () {
|
|
7401
|
+
return this.items.filter(function (incomeSource) { return incomeSource.isOtherIncome(); });
|
|
7402
|
+
};
|
|
7117
7403
|
Object.defineProperty(IncomeSourceCollection.prototype, "forecasts", {
|
|
7118
7404
|
/**
|
|
7119
7405
|
* Get income sources list of forecasts
|
|
@@ -11111,6 +11397,13 @@
|
|
|
11111
11397
|
_this.isHydra = true;
|
|
11112
11398
|
return _this;
|
|
11113
11399
|
}
|
|
11400
|
+
SoleBusinessService.prototype.add = function (soleBusiness) {
|
|
11401
|
+
var _this = this;
|
|
11402
|
+
return _super.prototype.add.call(this, soleBusiness).pipe(operators.map(function (business) {
|
|
11403
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SOLE_BUSINESS_CREATED, business));
|
|
11404
|
+
return business;
|
|
11405
|
+
}));
|
|
11406
|
+
};
|
|
11114
11407
|
return SoleBusinessService;
|
|
11115
11408
|
}(RestService));
|
|
11116
11409
|
SoleBusinessService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -11173,7 +11466,11 @@
|
|
|
11173
11466
|
this.toastService = toastService;
|
|
11174
11467
|
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
11175
11468
|
this.url = 'sole-depreciation-methods';
|
|
11469
|
+
this.listenEvents();
|
|
11176
11470
|
}
|
|
11471
|
+
SoleDepreciationMethodService.prototype.listenEvents = function () {
|
|
11472
|
+
this.listenSoleDetailsChanges();
|
|
11473
|
+
};
|
|
11177
11474
|
SoleDepreciationMethodService.prototype.get = function () {
|
|
11178
11475
|
var _this = this;
|
|
11179
11476
|
if (!this.cache) {
|
|
@@ -11201,6 +11498,14 @@
|
|
|
11201
11498
|
return throwError.throwError(error);
|
|
11202
11499
|
}));
|
|
11203
11500
|
};
|
|
11501
|
+
SoleDepreciationMethodService.prototype.listenSoleDetailsChanges = function () {
|
|
11502
|
+
var _this = this;
|
|
11503
|
+
this.eventDispatcherService.on([exports.AppEventTypeEnum.SOLE_DETAILS_CREATED, exports.AppEventTypeEnum.SOLE_DETAILS_UPDATED])
|
|
11504
|
+
.subscribe(function () {
|
|
11505
|
+
_this.cache = null;
|
|
11506
|
+
_this.get().subscribe();
|
|
11507
|
+
});
|
|
11508
|
+
};
|
|
11204
11509
|
return SoleDepreciationMethodService;
|
|
11205
11510
|
}());
|
|
11206
11511
|
SoleDepreciationMethodService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleDepreciationMethodService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }, { token: EventDispatcherService }, { token: ToastService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -11221,9 +11526,10 @@
|
|
|
11221
11526
|
* @TODO TT-1777 Alex: extend from rest service when it refactored
|
|
11222
11527
|
*/
|
|
11223
11528
|
var SoleDetailsService = /** @class */ (function () {
|
|
11224
|
-
function SoleDetailsService(http, environment) {
|
|
11529
|
+
function SoleDetailsService(http, environment, eventDispatcherService) {
|
|
11225
11530
|
this.http = http;
|
|
11226
11531
|
this.environment = environment;
|
|
11532
|
+
this.eventDispatcherService = eventDispatcherService;
|
|
11227
11533
|
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
11228
11534
|
}
|
|
11229
11535
|
SoleDetailsService.prototype.get = function () {
|
|
@@ -11248,6 +11554,7 @@
|
|
|
11248
11554
|
return this.http.post(this.environment.apiV2 + "/sole-details", soleDetails).pipe(operators.map(function (soleDetailsBase) {
|
|
11249
11555
|
_this.cache = classTransformer.plainToClass(SoleDetails, soleDetailsBase);
|
|
11250
11556
|
_this.cacheSubject.next(_this.cache);
|
|
11557
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SOLE_DETAILS_CREATED, soleDetails));
|
|
11251
11558
|
return _this.cache;
|
|
11252
11559
|
}));
|
|
11253
11560
|
};
|
|
@@ -11256,12 +11563,13 @@
|
|
|
11256
11563
|
return this.http.put(this.environment.apiV2 + "/sole-details/" + soleDetails.id, soleDetails).pipe(operators.map(function (soleDetailsBase) {
|
|
11257
11564
|
_this.cache = classTransformer.plainToClass(SoleDetails, soleDetailsBase);
|
|
11258
11565
|
_this.cacheSubject.next(_this.cache);
|
|
11566
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.SOLE_DETAILS_UPDATED, soleDetails));
|
|
11259
11567
|
return _this.cache;
|
|
11260
11568
|
}));
|
|
11261
11569
|
};
|
|
11262
11570
|
return SoleDetailsService;
|
|
11263
11571
|
}());
|
|
11264
|
-
SoleDetailsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleDetailsService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11572
|
+
SoleDetailsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleDetailsService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }, { token: EventDispatcherService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11265
11573
|
SoleDetailsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleDetailsService, providedIn: 'root' });
|
|
11266
11574
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleDetailsService, decorators: [{
|
|
11267
11575
|
type: i0.Injectable,
|
|
@@ -11272,7 +11580,7 @@
|
|
|
11272
11580
|
return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
|
|
11273
11581
|
type: i0.Inject,
|
|
11274
11582
|
args: ['environment']
|
|
11275
|
-
}] }];
|
|
11583
|
+
}] }, { type: EventDispatcherService }];
|
|
11276
11584
|
} });
|
|
11277
11585
|
|
|
11278
11586
|
var SoleInvoiceService = /** @class */ (function (_super) {
|
|
@@ -12033,6 +12341,9 @@
|
|
|
12033
12341
|
_this.incomeSourceTypeSubject = new rxjs.ReplaySubject(1);
|
|
12034
12342
|
return _this;
|
|
12035
12343
|
}
|
|
12344
|
+
IncomeSourceService.prototype.listenEvents = function () {
|
|
12345
|
+
this.listenSoleBusinessCreated();
|
|
12346
|
+
};
|
|
12036
12347
|
/**
|
|
12037
12348
|
* Get income sources tax calculation
|
|
12038
12349
|
* @param salaryForecast for which tax should be calculated
|
|
@@ -12107,6 +12418,15 @@
|
|
|
12107
12418
|
}
|
|
12108
12419
|
return this.incomeSourceTypeSubject.asObservable();
|
|
12109
12420
|
};
|
|
12421
|
+
/**
|
|
12422
|
+
* Sole businesses create together with income source
|
|
12423
|
+
*/
|
|
12424
|
+
IncomeSourceService.prototype.listenSoleBusinessCreated = function () {
|
|
12425
|
+
var _this = this;
|
|
12426
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SOLE_BUSINESS_CREATED).subscribe(function () {
|
|
12427
|
+
_this.resetCache();
|
|
12428
|
+
});
|
|
12429
|
+
};
|
|
12110
12430
|
return IncomeSourceService;
|
|
12111
12431
|
}(RestService));
|
|
12112
12432
|
IncomeSourceService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IncomeSourceService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -13399,54 +13719,6 @@
|
|
|
13399
13719
|
}]
|
|
13400
13720
|
}] });
|
|
13401
13721
|
|
|
13402
|
-
/**
|
|
13403
|
-
* server sent events service
|
|
13404
|
-
* https://symfony.com/doc/current/mercure.html
|
|
13405
|
-
*/
|
|
13406
|
-
var SseService = /** @class */ (function () {
|
|
13407
|
-
function SseService(zone, jwtService, environment) {
|
|
13408
|
-
this.zone = zone;
|
|
13409
|
-
this.jwtService = jwtService;
|
|
13410
|
-
this.environment = environment;
|
|
13411
|
-
}
|
|
13412
|
-
/**
|
|
13413
|
-
* list to url for server events
|
|
13414
|
-
*/
|
|
13415
|
-
SseService.prototype.on = function (topic) {
|
|
13416
|
-
var _this = this;
|
|
13417
|
-
var url = new URL(this.environment.mercureUrl);
|
|
13418
|
-
url.searchParams.append('topic', this.environment.apiV2 + "/users/" + this.jwtService.decodeToken().username + "/" + topic);
|
|
13419
|
-
// tslint:disable-next-line:typedef
|
|
13420
|
-
return new rxjs.Observable(function (observer) {
|
|
13421
|
-
var es = new eventsource_min_js.EventSourcePolyfill(url, {
|
|
13422
|
-
headers: {
|
|
13423
|
-
Authorization: 'Bearer ' + _this.jwtService.getToken(),
|
|
13424
|
-
}
|
|
13425
|
-
});
|
|
13426
|
-
es.onmessage = function (event) {
|
|
13427
|
-
_this.zone.run(function () { return observer.next(event); });
|
|
13428
|
-
};
|
|
13429
|
-
})
|
|
13430
|
-
.pipe(operators.map(function (messageEvent) {
|
|
13431
|
-
return JSON.parse(messageEvent.data);
|
|
13432
|
-
}));
|
|
13433
|
-
};
|
|
13434
|
-
return SseService;
|
|
13435
|
-
}());
|
|
13436
|
-
SseService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SseService, deps: [{ token: i0__namespace.NgZone }, { token: JwtService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
13437
|
-
SseService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SseService, providedIn: 'root' });
|
|
13438
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SseService, decorators: [{
|
|
13439
|
-
type: i0.Injectable,
|
|
13440
|
-
args: [{
|
|
13441
|
-
providedIn: 'root'
|
|
13442
|
-
}]
|
|
13443
|
-
}], ctorParameters: function () {
|
|
13444
|
-
return [{ type: i0__namespace.NgZone }, { type: JwtService }, { type: undefined, decorators: [{
|
|
13445
|
-
type: i0.Inject,
|
|
13446
|
-
args: ['environment']
|
|
13447
|
-
}] }];
|
|
13448
|
-
} });
|
|
13449
|
-
|
|
13450
13722
|
/**
|
|
13451
13723
|
* Service for work with chats
|
|
13452
13724
|
*/
|
|
@@ -16158,161 +16430,6 @@
|
|
|
16158
16430
|
}]
|
|
16159
16431
|
}] });
|
|
16160
16432
|
|
|
16161
|
-
/**
|
|
16162
|
-
* Service to work with user
|
|
16163
|
-
*/
|
|
16164
|
-
var UserService = /** @class */ (function () {
|
|
16165
|
-
function UserService(http, jwtService, eventDispatcherService, sseService, environment) {
|
|
16166
|
-
this.http = http;
|
|
16167
|
-
this.jwtService = jwtService;
|
|
16168
|
-
this.eventDispatcherService = eventDispatcherService;
|
|
16169
|
-
this.sseService = sseService;
|
|
16170
|
-
this.environment = environment;
|
|
16171
|
-
this.cacheSubject = new rxjs.ReplaySubject(1);
|
|
16172
|
-
this.listenEvents();
|
|
16173
|
-
}
|
|
16174
|
-
UserService.prototype.listenEvents = function () {
|
|
16175
|
-
this.listenServiceSubscriptionUpdated();
|
|
16176
|
-
};
|
|
16177
|
-
UserService.prototype.get = function () {
|
|
16178
|
-
var _this = this;
|
|
16179
|
-
if (!this.cache) {
|
|
16180
|
-
this.fetch().subscribe(function () { }, function (error) {
|
|
16181
|
-
// force logout user (clear localStorage) when get current user return error
|
|
16182
|
-
if (error.status === 500) {
|
|
16183
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.CURRENT_USER_GET_FAILED, null));
|
|
16184
|
-
}
|
|
16185
|
-
});
|
|
16186
|
-
}
|
|
16187
|
-
return this.cacheSubject.asObservable();
|
|
16188
|
-
};
|
|
16189
|
-
/**
|
|
16190
|
-
* Get current user
|
|
16191
|
-
*/
|
|
16192
|
-
UserService.prototype.fetch = function () {
|
|
16193
|
-
var _this = this;
|
|
16194
|
-
return this.http.get(this.environment.apiV2 + "/users/current")
|
|
16195
|
-
.pipe(operators.map(function (userBase) {
|
|
16196
|
-
var user = classTransformer.plainToClass(User, userBase);
|
|
16197
|
-
localStorage.setItem('userId', user.id.toString());
|
|
16198
|
-
// @TODO remove
|
|
16199
|
-
localStorage.setItem('financialYear', user.financialYear.toString());
|
|
16200
|
-
_this.cache = user;
|
|
16201
|
-
_this.cacheSubject.next(_this.cache);
|
|
16202
|
-
return user;
|
|
16203
|
-
}));
|
|
16204
|
-
};
|
|
16205
|
-
/**
|
|
16206
|
-
* Register new user
|
|
16207
|
-
*/
|
|
16208
|
-
UserService.prototype.register = function (data) {
|
|
16209
|
-
return this.http.post(this.environment.apiV2 + "/users/registration", data);
|
|
16210
|
-
};
|
|
16211
|
-
/**
|
|
16212
|
-
* Update user
|
|
16213
|
-
*/
|
|
16214
|
-
UserService.prototype.update = function (user) {
|
|
16215
|
-
var _this = this;
|
|
16216
|
-
return this.http.put(this.environment.apiV2 + "/users/" + user.id, user)
|
|
16217
|
-
.pipe(operators.map(function (userBase) {
|
|
16218
|
-
_this.cache = classTransformer.plainToClass(User, userBase);
|
|
16219
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.USER_UPDATED, null));
|
|
16220
|
-
_this.cacheSubject.next(_this.cache);
|
|
16221
|
-
}));
|
|
16222
|
-
};
|
|
16223
|
-
/**
|
|
16224
|
-
* Change user password
|
|
16225
|
-
*/
|
|
16226
|
-
UserService.prototype.changePassword = function (currentPassword, newPassword) {
|
|
16227
|
-
return this.http.put(this.environment.apiV2 + "/users/password/change", { currentPassword: currentPassword, newPassword: newPassword });
|
|
16228
|
-
};
|
|
16229
|
-
/**
|
|
16230
|
-
* Recovery user password
|
|
16231
|
-
*/
|
|
16232
|
-
UserService.prototype.recoveryPassword = function (email) {
|
|
16233
|
-
return this.http.put(this.environment.apiV2 + "/users/password/recovery", { email: email });
|
|
16234
|
-
};
|
|
16235
|
-
/**
|
|
16236
|
-
* Reset user password
|
|
16237
|
-
*/
|
|
16238
|
-
UserService.prototype.resetPassword = function (newPassword, resetToken) {
|
|
16239
|
-
return this.http.put(this.environment.apiV2 + "/users/password/reset", { newPassword: newPassword, resetToken: resetToken });
|
|
16240
|
-
};
|
|
16241
|
-
UserService.prototype.resendConfirmationEmail = function (email) {
|
|
16242
|
-
return this.http.post(this.environment.apiV2 + "/users/confirmation/resend", { email: email });
|
|
16243
|
-
};
|
|
16244
|
-
/**
|
|
16245
|
-
* Confirm registered user
|
|
16246
|
-
*/
|
|
16247
|
-
UserService.prototype.confirm = function (verificationCode) {
|
|
16248
|
-
return this.http.post(this.environment.apiV2 + "/users/confirmation", { verificationCode: verificationCode });
|
|
16249
|
-
};
|
|
16250
|
-
/**
|
|
16251
|
-
* Search existing user
|
|
16252
|
-
*/
|
|
16253
|
-
UserService.prototype.search = function (email) {
|
|
16254
|
-
return this.http.get(this.environment.apiV2 + "/users/search?email=" + email)
|
|
16255
|
-
.pipe(operators.map(function (userBase) {
|
|
16256
|
-
return classTransformer.plainToClass(User, userBase);
|
|
16257
|
-
}));
|
|
16258
|
-
};
|
|
16259
|
-
/**
|
|
16260
|
-
* Finish onboarding process
|
|
16261
|
-
*/
|
|
16262
|
-
UserService.prototype.finishOnboarding = function (user) {
|
|
16263
|
-
var _this = this;
|
|
16264
|
-
return this.http.put(this.environment.apiV2 + "/users/status", user)
|
|
16265
|
-
.pipe(operators.map(function () {
|
|
16266
|
-
_this.cache = user;
|
|
16267
|
-
_this.cacheSubject.next(_this.cache);
|
|
16268
|
-
}));
|
|
16269
|
-
};
|
|
16270
|
-
/**
|
|
16271
|
-
* Update user photo
|
|
16272
|
-
*/
|
|
16273
|
-
UserService.prototype.updatePhoto = function (photo) {
|
|
16274
|
-
var _this = this;
|
|
16275
|
-
return this.http.post(this.environment.apiV2 + "/users/photo?_method=PUT", photo)
|
|
16276
|
-
.pipe(operators.map(function (photoUrl) {
|
|
16277
|
-
_this.cache = classTransformer.plainToClass(User, Object.assign(_this.cache, { photo: photoUrl }));
|
|
16278
|
-
_this.cacheSubject.next(_this.cache);
|
|
16279
|
-
}));
|
|
16280
|
-
};
|
|
16281
|
-
UserService.prototype.switchFinancialYear = function (year) {
|
|
16282
|
-
return this.http.get(this.environment.apiV2 + "/financial-year/switch", { params: new i1.HttpParams({ fromString: "financialYear=" + year }) }).pipe(operators.map(function () {
|
|
16283
|
-
localStorage.setItem('financialYear', year.toString());
|
|
16284
|
-
window.location.reload();
|
|
16285
|
-
}));
|
|
16286
|
-
};
|
|
16287
|
-
/**
|
|
16288
|
-
* clear service cache
|
|
16289
|
-
*/
|
|
16290
|
-
UserService.prototype.resetCache = function () {
|
|
16291
|
-
this.fetch().subscribe();
|
|
16292
|
-
};
|
|
16293
|
-
/**
|
|
16294
|
-
* Update cache when user's service subscription is updated
|
|
16295
|
-
*/
|
|
16296
|
-
UserService.prototype.listenServiceSubscriptionUpdated = function () {
|
|
16297
|
-
var _this = this;
|
|
16298
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
16299
|
-
};
|
|
16300
|
-
return UserService;
|
|
16301
|
-
}());
|
|
16302
|
-
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 });
|
|
16303
|
-
UserService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, providedIn: 'root' });
|
|
16304
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: UserService, decorators: [{
|
|
16305
|
-
type: i0.Injectable,
|
|
16306
|
-
args: [{
|
|
16307
|
-
providedIn: 'root'
|
|
16308
|
-
}]
|
|
16309
|
-
}], ctorParameters: function () {
|
|
16310
|
-
return [{ type: i1__namespace.HttpClient }, { type: JwtService }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
|
|
16311
|
-
type: i0.Inject,
|
|
16312
|
-
args: ['environment']
|
|
16313
|
-
}] }];
|
|
16314
|
-
} });
|
|
16315
|
-
|
|
16316
16433
|
/**
|
|
16317
16434
|
* Service to work with XLSX (generate, download, e.t.c.)
|
|
16318
16435
|
*/
|
|
@@ -16937,13 +17054,50 @@
|
|
|
16937
17054
|
__extends(SoleBusinessForm, _super);
|
|
16938
17055
|
function SoleBusinessForm(business) {
|
|
16939
17056
|
if (business === void 0) { business = classTransformer.plainToClass(SoleBusiness, {}); }
|
|
16940
|
-
|
|
17057
|
+
var _this = _super.call(this, {
|
|
16941
17058
|
name: new forms.FormControl(business.name, forms.Validators.required),
|
|
16942
17059
|
activity: new forms.FormControl(business.activity, forms.Validators.required),
|
|
16943
17060
|
description: new forms.FormControl(business.description),
|
|
16944
17061
|
website: new forms.FormControl(business.website)
|
|
16945
17062
|
}, business) || this;
|
|
17063
|
+
// User have to create income source with new business.
|
|
17064
|
+
// Income source is not able for edit business
|
|
17065
|
+
if (!business.id) {
|
|
17066
|
+
// @TODO Alex: move to separated form class
|
|
17067
|
+
_this.addControl('incomeSource', new forms.FormGroup({
|
|
17068
|
+
type: new forms.FormControl(exports.IncomeSourceTypeEnum.SOLE, forms.Validators.required),
|
|
17069
|
+
name: new forms.FormControl(null, forms.Validators.required),
|
|
17070
|
+
soleForecasts: new forms.FormArray([
|
|
17071
|
+
new forms.FormGroup({
|
|
17072
|
+
financialYear: new forms.FormControl(new FinancialYear().year, forms.Validators.required),
|
|
17073
|
+
amount: new forms.FormControl(null, forms.Validators.required),
|
|
17074
|
+
taxInstalments: new forms.FormControl(null, forms.Validators.required)
|
|
17075
|
+
})
|
|
17076
|
+
])
|
|
17077
|
+
}));
|
|
17078
|
+
_this.addControl('losses', new forms.FormArray([
|
|
17079
|
+
new forms.FormGroup({
|
|
17080
|
+
financialYear: new forms.FormControl(new FinancialYear().year),
|
|
17081
|
+
openBalance: new forms.FormControl(null, forms.Validators.required)
|
|
17082
|
+
})
|
|
17083
|
+
]));
|
|
17084
|
+
}
|
|
17085
|
+
return _this;
|
|
16946
17086
|
}
|
|
17087
|
+
Object.defineProperty(SoleBusinessForm.prototype, "forecastFormGroup", {
|
|
17088
|
+
get: function () {
|
|
17089
|
+
return this.get('incomeSource').get('soleForecasts').at(0);
|
|
17090
|
+
},
|
|
17091
|
+
enumerable: false,
|
|
17092
|
+
configurable: true
|
|
17093
|
+
});
|
|
17094
|
+
Object.defineProperty(SoleBusinessForm.prototype, "lossFormGroup", {
|
|
17095
|
+
get: function () {
|
|
17096
|
+
return this.get('losses').at(0);
|
|
17097
|
+
},
|
|
17098
|
+
enumerable: false,
|
|
17099
|
+
configurable: true
|
|
17100
|
+
});
|
|
16947
17101
|
return SoleBusinessForm;
|
|
16948
17102
|
}(AbstractForm));
|
|
16949
17103
|
|
|
@@ -17039,11 +17193,23 @@
|
|
|
17039
17193
|
return SoleDepreciationMethodForm;
|
|
17040
17194
|
}(AbstractForm));
|
|
17041
17195
|
|
|
17196
|
+
/**
|
|
17197
|
+
* Validator check if entered strong length is equal to passed length parameter
|
|
17198
|
+
*/
|
|
17199
|
+
function requiredLengthValidator(length) {
|
|
17200
|
+
return function (control) {
|
|
17201
|
+
if (control.value && control.value.length !== length) {
|
|
17202
|
+
return { requiredLength: length };
|
|
17203
|
+
}
|
|
17204
|
+
return null;
|
|
17205
|
+
};
|
|
17206
|
+
}
|
|
17207
|
+
|
|
17042
17208
|
var SoleDetailsForm = /** @class */ (function (_super) {
|
|
17043
17209
|
__extends(SoleDetailsForm, _super);
|
|
17044
17210
|
function SoleDetailsForm(soleDetails) {
|
|
17045
17211
|
return _super.call(this, {
|
|
17046
|
-
abn: new forms.FormControl(soleDetails.abn, [forms.Validators.required,
|
|
17212
|
+
abn: new forms.FormControl(soleDetails.abn, [forms.Validators.required, requiredLengthValidator(11)]),
|
|
17047
17213
|
isGST: new forms.FormControl(soleDetails.isGST || false)
|
|
17048
17214
|
}, soleDetails) || this;
|
|
17049
17215
|
}
|
|
@@ -18278,6 +18444,7 @@
|
|
|
18278
18444
|
exports.SoleForecast = SoleForecast;
|
|
18279
18445
|
exports.SoleForecastService = SoleForecastService;
|
|
18280
18446
|
exports.SoleInvoice = SoleInvoice;
|
|
18447
|
+
exports.SoleInvoiceCollection = SoleInvoiceCollection;
|
|
18281
18448
|
exports.SoleInvoiceForm = SoleInvoiceForm;
|
|
18282
18449
|
exports.SoleInvoiceItem = SoleInvoiceItem;
|
|
18283
18450
|
exports.SoleInvoiceItemForm = SoleInvoiceItemForm;
|