taxtank-core 2.0.111 → 2.0.112
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/fesm2022/taxtank-core.mjs +131 -128
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +19 -18
- package/package.json +1 -1
|
@@ -3,9 +3,9 @@ import { Inject, Injectable, inject, NgModule, EventEmitter, InjectionToken, Pip
|
|
|
3
3
|
import * as i1$1 from '@angular/common';
|
|
4
4
|
import { formatDate, DatePipe, CurrencyPipe, CommonModule as CommonModule$1 } from '@angular/common';
|
|
5
5
|
import * as i1 from '@angular/common/http';
|
|
6
|
-
import { HttpClient, HttpErrorResponse,
|
|
6
|
+
import { HttpClient, HttpErrorResponse, HTTP_INTERCEPTORS, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
7
7
|
import { map, filter, catchError, finalize, switchMap, first as first$1, take, mergeMap, startWith, debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
8
|
-
import { ReplaySubject, Subject, Observable, shareReplay, of, forkJoin, throwError,
|
|
8
|
+
import { ReplaySubject, Subject, Observable, shareReplay, of, forkJoin, throwError, BehaviorSubject, concatMap, combineLatest, from, merge as merge$1 } from 'rxjs';
|
|
9
9
|
import { plainToClass, Type, Transform, Exclude, Expose, classToPlain } from 'class-transformer';
|
|
10
10
|
import get from 'lodash/get';
|
|
11
11
|
import 'reflect-metadata';
|
|
@@ -7235,13 +7235,13 @@ class Depreciation extends Depreciation$1 {
|
|
|
7235
7235
|
*/
|
|
7236
7236
|
toTransaction(params = {}) {
|
|
7237
7237
|
const claimPercent = this.currentYearForecast?.claimPercent || 0;
|
|
7238
|
-
return plainToClass(Transaction, Object.assign(
|
|
7238
|
+
return plainToClass(Transaction, Object.assign({}, this, {
|
|
7239
7239
|
amount: -this.currentYearForecast?.amount || 0,
|
|
7240
7240
|
claimAmount: -this.currentYearForecast?.claimAmount || 0,
|
|
7241
7241
|
claimPercent: claimPercent,
|
|
7242
7242
|
date: this.currentYearForecast?.fromDate ?? this.date,
|
|
7243
7243
|
sharedClaimPercent: claimPercent,
|
|
7244
|
-
}));
|
|
7244
|
+
}, params));
|
|
7245
7245
|
}
|
|
7246
7246
|
/**
|
|
7247
7247
|
* @TODO Michael: remove and check everywhere in reports
|
|
@@ -12917,7 +12917,7 @@ class BankAccountService extends RestService$1 {
|
|
|
12917
12917
|
this.modelClass = BankAccount;
|
|
12918
12918
|
this.collectionClass = BankAccountCollection;
|
|
12919
12919
|
this.disabledMethods = ['post', 'putBatch', 'delete', 'deleteBatch'];
|
|
12920
|
-
this.roles = [UserRolesEnum$1.
|
|
12920
|
+
this.roles = [UserRolesEnum$1.SUBSCRIPTION];
|
|
12921
12921
|
this.listenEvents();
|
|
12922
12922
|
}
|
|
12923
12923
|
getActive() {
|
|
@@ -13278,128 +13278,6 @@ var BasiqMessagesEnum;
|
|
|
13278
13278
|
BasiqMessagesEnum["REVOKE_SUCCESS"] = "Consent to bank feeds has been revoked.";
|
|
13279
13279
|
})(BasiqMessagesEnum || (BasiqMessagesEnum = {}));
|
|
13280
13280
|
|
|
13281
|
-
class BasiqUserService extends RestService$1 {
|
|
13282
|
-
constructor() {
|
|
13283
|
-
super(...arguments);
|
|
13284
|
-
this.endpointUri = 'basiq-users';
|
|
13285
|
-
this.modelClass = BasiqUser;
|
|
13286
|
-
this.collectionClass = Collection;
|
|
13287
|
-
this.disabledMethods = ['postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
|
|
13288
|
-
this.basiqTokenService = inject(BasiqTokenService);
|
|
13289
|
-
}
|
|
13290
|
-
static { this.basiqApiUrl = 'https://au-api.basiq.io'; }
|
|
13291
|
-
static { this.basiqConsentUrl = 'https://consent.basiq.io/home'; }
|
|
13292
|
-
revokeConsent() {
|
|
13293
|
-
return this.http.put(`${this.environment.apiV2}/basiq-users/consents/revoke`, {});
|
|
13294
|
-
}
|
|
13295
|
-
post(basiqUser = new BasiqUser()) {
|
|
13296
|
-
return super.post(basiqUser);
|
|
13297
|
-
}
|
|
13298
|
-
retrieveJob(jobId, basiqUserId) {
|
|
13299
|
-
return this.basiqTokenService.getOne(basiqUserId).pipe(concatMap(token => {
|
|
13300
|
-
const headers = new HttpHeaders({ Authorization: 'Bearer ' + token.value });
|
|
13301
|
-
return this.http.get(`${BasiqUserService.basiqApiUrl}/jobs/${jobId}`, { headers })
|
|
13302
|
-
.pipe(map((response) => plainToClass(BasiqJobResponse, response)));
|
|
13303
|
-
}));
|
|
13304
|
-
}
|
|
13305
|
-
/**
|
|
13306
|
-
* Open basiq consent ui to allow user to log in to bank
|
|
13307
|
-
*/
|
|
13308
|
-
redirectToBasiqConsent(bankId, basiqUserId) {
|
|
13309
|
-
const user$ = basiqUserId ? this.findBy('id', basiqUserId) : this.post();
|
|
13310
|
-
return user$.pipe(filter(user => !!user), concatMap(user => this.basiqTokenService.getOne(user.id).pipe(map(token => ({ user, token: token })))), map(({ user, token }) => {
|
|
13311
|
-
const url = new URL(BasiqUserService.basiqConsentUrl);
|
|
13312
|
-
url.searchParams.set('token', token.value);
|
|
13313
|
-
url.searchParams.set('institutionId', bankId);
|
|
13314
|
-
// @TODO TT-4883 vik state not coming from basiq
|
|
13315
|
-
localStorage.setItem('basiqUserId', user.id);
|
|
13316
|
-
// url.searchParams.set('state', user.id);
|
|
13317
|
-
if (user.consentId) {
|
|
13318
|
-
url.searchParams.set('action', 'connect');
|
|
13319
|
-
}
|
|
13320
|
-
window.location.replace(url.toString());
|
|
13321
|
-
}));
|
|
13322
|
-
}
|
|
13323
|
-
/**
|
|
13324
|
-
* redirect to basiq extend consent date to prolong it
|
|
13325
|
-
*/
|
|
13326
|
-
extendConsent(basiqUserId) {
|
|
13327
|
-
return this.basiqTokenService.getOne(basiqUserId).pipe(map(token => {
|
|
13328
|
-
window.location.replace(`${BasiqUserService.basiqConsentUrl}?token=${token.value}&action=extend`);
|
|
13329
|
-
}));
|
|
13330
|
-
}
|
|
13331
|
-
/**
|
|
13332
|
-
* redirect to basiq extend connection date to prolong it
|
|
13333
|
-
*/
|
|
13334
|
-
reauthoriseConnection(connection) {
|
|
13335
|
-
return this.basiqTokenService.getOne(connection.basiqUser.id).pipe(map(token => {
|
|
13336
|
-
let url = `${BasiqUserService.basiqConsentUrl}?token=${token.value}&action=reauthorise`;
|
|
13337
|
-
if (connection.isExpiring()) {
|
|
13338
|
-
url += `&connectionId=${connection.externalId}`;
|
|
13339
|
-
}
|
|
13340
|
-
window.location.replace(url);
|
|
13341
|
-
}));
|
|
13342
|
-
}
|
|
13343
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BasiqUserService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13344
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BasiqUserService, providedIn: 'root' }); }
|
|
13345
|
-
}
|
|
13346
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BasiqUserService, decorators: [{
|
|
13347
|
-
type: Injectable,
|
|
13348
|
-
args: [{
|
|
13349
|
-
providedIn: 'root'
|
|
13350
|
-
}]
|
|
13351
|
-
}] });
|
|
13352
|
-
|
|
13353
|
-
/**
|
|
13354
|
-
* Service that handling banks logic
|
|
13355
|
-
*/
|
|
13356
|
-
class BankTransactionCommentService extends RestService$1 {
|
|
13357
|
-
constructor() {
|
|
13358
|
-
super(...arguments);
|
|
13359
|
-
this.modelClass = BankTransactionComment;
|
|
13360
|
-
this.collectionClass = Collection;
|
|
13361
|
-
this.endpointUri = 'bank-transaction-comments';
|
|
13362
|
-
this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
|
|
13363
|
-
}
|
|
13364
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankTransactionCommentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13365
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankTransactionCommentService, providedIn: 'root' }); }
|
|
13366
|
-
}
|
|
13367
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankTransactionCommentService, decorators: [{
|
|
13368
|
-
type: Injectable,
|
|
13369
|
-
args: [{
|
|
13370
|
-
providedIn: 'root'
|
|
13371
|
-
}]
|
|
13372
|
-
}] });
|
|
13373
|
-
|
|
13374
|
-
var BankTransactionCommentMessagesEnum;
|
|
13375
|
-
(function (BankTransactionCommentMessagesEnum) {
|
|
13376
|
-
BankTransactionCommentMessagesEnum["CREATED"] = "Note created";
|
|
13377
|
-
BankTransactionCommentMessagesEnum["UPDATED"] = "Note updated";
|
|
13378
|
-
BankTransactionCommentMessagesEnum["DELETED"] = "Note deleted";
|
|
13379
|
-
BankTransactionCommentMessagesEnum["CONFIRM_DELETE"] = "Are you sure you want to delete this note?";
|
|
13380
|
-
})(BankTransactionCommentMessagesEnum || (BankTransactionCommentMessagesEnum = {}));
|
|
13381
|
-
|
|
13382
|
-
/**
|
|
13383
|
-
* Service that handling banks logic
|
|
13384
|
-
*/
|
|
13385
|
-
class BankService extends RestService$1 {
|
|
13386
|
-
constructor() {
|
|
13387
|
-
super(...arguments);
|
|
13388
|
-
this.modelClass = Bank;
|
|
13389
|
-
this.collectionClass = Collection;
|
|
13390
|
-
this.endpointUri = 'banks';
|
|
13391
|
-
this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
|
|
13392
|
-
}
|
|
13393
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13394
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankService, providedIn: 'root' }); }
|
|
13395
|
-
}
|
|
13396
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankService, decorators: [{
|
|
13397
|
-
type: Injectable,
|
|
13398
|
-
args: [{
|
|
13399
|
-
providedIn: 'root'
|
|
13400
|
-
}]
|
|
13401
|
-
}] });
|
|
13402
|
-
|
|
13403
13281
|
/**
|
|
13404
13282
|
* Service to work with mixpanel https://docs.mixpanel.com/docs/tracking/reference/javascript
|
|
13405
13283
|
*/
|
|
@@ -13766,6 +13644,129 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
13766
13644
|
}]
|
|
13767
13645
|
}] });
|
|
13768
13646
|
|
|
13647
|
+
class BasiqUserService extends RestService$1 {
|
|
13648
|
+
constructor() {
|
|
13649
|
+
super(...arguments);
|
|
13650
|
+
this.endpointUri = 'basiq-users';
|
|
13651
|
+
this.modelClass = BasiqUser;
|
|
13652
|
+
this.collectionClass = Collection;
|
|
13653
|
+
this.disabledMethods = ['postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
|
|
13654
|
+
this.roles = [UserRolesEnum.SUBSCRIPTION];
|
|
13655
|
+
this.basiqTokenService = inject(BasiqTokenService);
|
|
13656
|
+
}
|
|
13657
|
+
static { this.basiqApiUrl = 'https://au-api.basiq.io'; }
|
|
13658
|
+
static { this.basiqConsentUrl = 'https://consent.basiq.io/home'; }
|
|
13659
|
+
revokeConsent() {
|
|
13660
|
+
return this.http.put(`${this.environment.apiV2}/basiq-users/consents/revoke`, {});
|
|
13661
|
+
}
|
|
13662
|
+
post(basiqUser = new BasiqUser()) {
|
|
13663
|
+
return super.post(basiqUser);
|
|
13664
|
+
}
|
|
13665
|
+
retrieveJob(jobId, basiqUserId) {
|
|
13666
|
+
return this.basiqTokenService.getOne(basiqUserId).pipe(concatMap(token => {
|
|
13667
|
+
const headers = new HttpHeaders({ Authorization: 'Bearer ' + token.value });
|
|
13668
|
+
return this.http.get(`${BasiqUserService.basiqApiUrl}/jobs/${jobId}`, { headers })
|
|
13669
|
+
.pipe(map((response) => plainToClass(BasiqJobResponse, response)));
|
|
13670
|
+
}));
|
|
13671
|
+
}
|
|
13672
|
+
/**
|
|
13673
|
+
* Open basiq consent ui to allow user to log in to bank
|
|
13674
|
+
*/
|
|
13675
|
+
redirectToBasiqConsent(bankId, basiqUserId) {
|
|
13676
|
+
const user$ = basiqUserId ? this.findBy('id', basiqUserId) : this.post();
|
|
13677
|
+
return user$.pipe(filter(user => !!user), concatMap(user => this.basiqTokenService.getOne(user.id).pipe(map(token => ({ user, token: token })))), map(({ user, token }) => {
|
|
13678
|
+
const url = new URL(BasiqUserService.basiqConsentUrl);
|
|
13679
|
+
url.searchParams.set('token', token.value);
|
|
13680
|
+
url.searchParams.set('institutionId', bankId);
|
|
13681
|
+
// @TODO TT-4883 vik state not coming from basiq
|
|
13682
|
+
localStorage.setItem('basiqUserId', user.id);
|
|
13683
|
+
// url.searchParams.set('state', user.id);
|
|
13684
|
+
if (user.consentId) {
|
|
13685
|
+
url.searchParams.set('action', 'connect');
|
|
13686
|
+
}
|
|
13687
|
+
window.location.replace(url.toString());
|
|
13688
|
+
}));
|
|
13689
|
+
}
|
|
13690
|
+
/**
|
|
13691
|
+
* redirect to basiq extend consent date to prolong it
|
|
13692
|
+
*/
|
|
13693
|
+
extendConsent(basiqUserId) {
|
|
13694
|
+
return this.basiqTokenService.getOne(basiqUserId).pipe(map(token => {
|
|
13695
|
+
window.location.replace(`${BasiqUserService.basiqConsentUrl}?token=${token.value}&action=extend`);
|
|
13696
|
+
}));
|
|
13697
|
+
}
|
|
13698
|
+
/**
|
|
13699
|
+
* redirect to basiq extend connection date to prolong it
|
|
13700
|
+
*/
|
|
13701
|
+
reauthoriseConnection(connection) {
|
|
13702
|
+
return this.basiqTokenService.getOne(connection.basiqUser.id).pipe(map(token => {
|
|
13703
|
+
let url = `${BasiqUserService.basiqConsentUrl}?token=${token.value}&action=reauthorise`;
|
|
13704
|
+
if (connection.isExpiring()) {
|
|
13705
|
+
url += `&connectionId=${connection.externalId}`;
|
|
13706
|
+
}
|
|
13707
|
+
window.location.replace(url);
|
|
13708
|
+
}));
|
|
13709
|
+
}
|
|
13710
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BasiqUserService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13711
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BasiqUserService, providedIn: 'root' }); }
|
|
13712
|
+
}
|
|
13713
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BasiqUserService, decorators: [{
|
|
13714
|
+
type: Injectable,
|
|
13715
|
+
args: [{
|
|
13716
|
+
providedIn: 'root'
|
|
13717
|
+
}]
|
|
13718
|
+
}] });
|
|
13719
|
+
|
|
13720
|
+
/**
|
|
13721
|
+
* Service that handling banks logic
|
|
13722
|
+
*/
|
|
13723
|
+
class BankTransactionCommentService extends RestService$1 {
|
|
13724
|
+
constructor() {
|
|
13725
|
+
super(...arguments);
|
|
13726
|
+
this.modelClass = BankTransactionComment;
|
|
13727
|
+
this.collectionClass = Collection;
|
|
13728
|
+
this.endpointUri = 'bank-transaction-comments';
|
|
13729
|
+
this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
|
|
13730
|
+
}
|
|
13731
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankTransactionCommentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13732
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankTransactionCommentService, providedIn: 'root' }); }
|
|
13733
|
+
}
|
|
13734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankTransactionCommentService, decorators: [{
|
|
13735
|
+
type: Injectable,
|
|
13736
|
+
args: [{
|
|
13737
|
+
providedIn: 'root'
|
|
13738
|
+
}]
|
|
13739
|
+
}] });
|
|
13740
|
+
|
|
13741
|
+
var BankTransactionCommentMessagesEnum;
|
|
13742
|
+
(function (BankTransactionCommentMessagesEnum) {
|
|
13743
|
+
BankTransactionCommentMessagesEnum["CREATED"] = "Note created";
|
|
13744
|
+
BankTransactionCommentMessagesEnum["UPDATED"] = "Note updated";
|
|
13745
|
+
BankTransactionCommentMessagesEnum["DELETED"] = "Note deleted";
|
|
13746
|
+
BankTransactionCommentMessagesEnum["CONFIRM_DELETE"] = "Are you sure you want to delete this note?";
|
|
13747
|
+
})(BankTransactionCommentMessagesEnum || (BankTransactionCommentMessagesEnum = {}));
|
|
13748
|
+
|
|
13749
|
+
/**
|
|
13750
|
+
* Service that handling banks logic
|
|
13751
|
+
*/
|
|
13752
|
+
class BankService extends RestService$1 {
|
|
13753
|
+
constructor() {
|
|
13754
|
+
super(...arguments);
|
|
13755
|
+
this.modelClass = Bank;
|
|
13756
|
+
this.collectionClass = Collection;
|
|
13757
|
+
this.endpointUri = 'banks';
|
|
13758
|
+
this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
|
|
13759
|
+
}
|
|
13760
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13761
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankService, providedIn: 'root' }); }
|
|
13762
|
+
}
|
|
13763
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: BankService, decorators: [{
|
|
13764
|
+
type: Injectable,
|
|
13765
|
+
args: [{
|
|
13766
|
+
providedIn: 'root'
|
|
13767
|
+
}]
|
|
13768
|
+
}] });
|
|
13769
|
+
|
|
13769
13770
|
class BudgetService extends RestService$1 {
|
|
13770
13771
|
constructor() {
|
|
13771
13772
|
super(...arguments);
|
|
@@ -24751,7 +24752,9 @@ class BasReportForm extends AbstractForm {
|
|
|
24751
24752
|
const filteredTransactions = transactions.filterByRange('date', dateFrom, dateTo);
|
|
24752
24753
|
const filteredDepreciations = depreciations.filterByRange('date', dateFrom, dateTo);
|
|
24753
24754
|
const incomeTransactions = filteredTransactions.getIncomeTransactions();
|
|
24754
|
-
const
|
|
24755
|
+
const depreciationTransactions = filteredDepreciations.map(depreciation => depreciation.toTransaction({ amount: -depreciation.amount }));
|
|
24756
|
+
const expenseTransactions = new TransactionCollection(filteredTransactions.getExpenseTransactions().toArray());
|
|
24757
|
+
expenseTransactions.push(...depreciationTransactions);
|
|
24755
24758
|
// all sole income claimed as 100%
|
|
24756
24759
|
// @TODO temp fix, waiting for TT-3503/TT-3495 breaking changes
|
|
24757
24760
|
this.patchField('income', incomeTransactions.sumBy('amountWithGst'));
|