taxtank-core 0.31.51 → 0.31.53
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/esm2020/lib/collections/holding/holding-sale.collection.mjs +2 -2
- package/esm2020/lib/collections/report/vehicle-expense/vehicle-expense.collection.mjs +6 -6
- package/esm2020/lib/db/Models/abstract-model.mjs +5 -1
- package/esm2020/lib/models/holding/holding-sale.mjs +7 -1
- package/esm2020/lib/models/holding/holding-type.mjs +4 -1
- package/esm2020/lib/models/holding/holding.mjs +4 -1
- package/esm2020/lib/services/auth/auth.service.mjs +1 -2
- package/esm2020/lib/services/auth/jwt.service.mjs +8 -2
- package/esm2020/lib/services/http/facebook/facebook.service.mjs +3 -4
- package/esm2020/lib/services/http/google/google.service.mjs +1 -2
- package/esm2020/lib/services/http/tax-review/tax-review.service.mjs +2 -3
- package/esm2020/lib/services/http/user/user.service.mjs +6 -3
- package/esm2020/lib/services/mixpanel/mixpanel.service.mjs +7 -1
- package/fesm2015/taxtank-core.mjs +88 -61
- package/fesm2015/taxtank-core.mjs.map +1 -1
- package/fesm2020/taxtank-core.mjs +85 -59
- package/fesm2020/taxtank-core.mjs.map +1 -1
- package/lib/collections/report/vehicle-expense/vehicle-expense.collection.d.ts +1 -2
- package/lib/db/Models/abstract-model.d.ts +1 -0
- package/lib/models/holding/holding-sale.d.ts +8 -1
- package/lib/models/holding/holding-type.d.ts +6 -1
- package/lib/models/holding/holding.d.ts +6 -1
- package/lib/services/auth/jwt.service.d.ts +1 -0
- package/lib/services/http/facebook/facebook.service.d.ts +2 -2
- package/lib/services/http/tax-review/tax-review.service.d.ts +1 -1
- package/lib/services/mixpanel/mixpanel.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, Inject, inject, EventEmitter, NgModule, Pipe } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/common';
|
|
4
|
-
import { CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
|
|
4
|
+
import { formatDate, CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
|
|
5
5
|
import * as i1 from '@angular/common/http';
|
|
6
6
|
import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
7
7
|
import { map, mergeMap, filter, first as first$1, catchError, skip, take, switchMap, finalize, debounceTime, distinctUntilChanged, delay } from 'rxjs/operators';
|
|
@@ -166,6 +166,9 @@ class AbstractModel {
|
|
|
166
166
|
hasValue(value, path = 'id') {
|
|
167
167
|
return get(path) === value;
|
|
168
168
|
}
|
|
169
|
+
formatDate(date, format = 'MMM d, y') {
|
|
170
|
+
return formatDate(date, format, 'en-AU');
|
|
171
|
+
}
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
let Country$1 = class Country extends AbstractModel {
|
|
@@ -8175,16 +8178,16 @@ class VehicleExpense extends AbstractModel {
|
|
|
8175
8178
|
}
|
|
8176
8179
|
|
|
8177
8180
|
class VehicleExpenseCollection extends Collection {
|
|
8178
|
-
constructor(transactions, depreciations
|
|
8181
|
+
constructor(transactions, depreciations) {
|
|
8179
8182
|
super();
|
|
8180
|
-
this.setItems(transactions, depreciations
|
|
8183
|
+
this.setItems(transactions, depreciations);
|
|
8181
8184
|
}
|
|
8182
|
-
setItems(transactions, depreciations
|
|
8185
|
+
setItems(transactions, depreciations) {
|
|
8183
8186
|
this.items = [];
|
|
8184
8187
|
const transactionsByChartAccounts = transactions.groupBy('chartAccounts.name');
|
|
8185
|
-
const transactionExpenses = transactionsByChartAccounts.keys.map((chartAccountsName) => new VehicleExpense(transactionsByChartAccounts.get(chartAccountsName).amount,
|
|
8188
|
+
const transactionExpenses = transactionsByChartAccounts.keys.map((chartAccountsName) => new VehicleExpense(transactionsByChartAccounts.get(chartAccountsName).amount, transactionsByChartAccounts.get(chartAccountsName).first.claimPercent, chartAccountsName));
|
|
8186
8189
|
// group all depreciations into one expense item
|
|
8187
|
-
const depreciationExpense = new VehicleExpense(-depreciations.getCurrentYearForecastAmount(),
|
|
8190
|
+
const depreciationExpense = new VehicleExpense(-depreciations.getCurrentYearForecastAmount(), depreciations.first?.claimPercent ?? 0, 'Depreciation');
|
|
8188
8191
|
this.items.push(...[depreciationExpense, ...transactionExpenses]);
|
|
8189
8192
|
}
|
|
8190
8193
|
}
|
|
@@ -9287,7 +9290,7 @@ class HoldingSaleCollection extends ExportableCollection {
|
|
|
9287
9290
|
plainToClass(ExportCell, { value: sale.totalCapitalGain, type: ExportCellTypeEnum.CURRENCY }),
|
|
9288
9291
|
plainToClass(ExportCell, { value: sale.grossCapitalGain, type: ExportCellTypeEnum.CURRENCY }),
|
|
9289
9292
|
plainToClass(ExportCell, {
|
|
9290
|
-
value: sale.
|
|
9293
|
+
value: sale.concession,
|
|
9291
9294
|
type: ExportCellTypeEnum.STRING
|
|
9292
9295
|
}),
|
|
9293
9296
|
]);
|
|
@@ -10147,6 +10150,9 @@ class HoldingType extends AbstractModel {
|
|
|
10147
10150
|
isCrypto() {
|
|
10148
10151
|
return this.category === HoldingTypeCategoryEnum.CRYPTO;
|
|
10149
10152
|
}
|
|
10153
|
+
getMpData() {
|
|
10154
|
+
return { category: HoldingTypeCategoryEnum[this.category], name: this.name };
|
|
10155
|
+
}
|
|
10150
10156
|
}
|
|
10151
10157
|
__decorate([
|
|
10152
10158
|
Type(() => AppFile)
|
|
@@ -10171,6 +10177,9 @@ class HoldingSale extends AssetSale {
|
|
|
10171
10177
|
isOneYearExemptionApplicable() {
|
|
10172
10178
|
return this.grossCapitalGain !== this.netCapitalGain;
|
|
10173
10179
|
}
|
|
10180
|
+
get concession() {
|
|
10181
|
+
return this.isOneYearExemptionApplicable() ? '50% (1 year rule)' : 'None';
|
|
10182
|
+
}
|
|
10174
10183
|
getCostBase(holding) {
|
|
10175
10184
|
return this.getPurchasePrice(holding) + holding.fee;
|
|
10176
10185
|
}
|
|
@@ -10186,6 +10195,9 @@ class HoldingSale extends AssetSale {
|
|
|
10186
10195
|
get cost() {
|
|
10187
10196
|
return this.price * this.quantity;
|
|
10188
10197
|
}
|
|
10198
|
+
getMpData(type) {
|
|
10199
|
+
return { holding: type.name, concession: this.concession };
|
|
10200
|
+
}
|
|
10189
10201
|
}
|
|
10190
10202
|
__decorate([
|
|
10191
10203
|
Transform(({ value }) => ({ id: value.id }), { toPlainOnly: true })
|
|
@@ -10230,6 +10242,9 @@ class Holding extends AbstractModel {
|
|
|
10230
10242
|
isSold() {
|
|
10231
10243
|
return this.currentQuantity === 0;
|
|
10232
10244
|
}
|
|
10245
|
+
getMpData() {
|
|
10246
|
+
return { type: this.type.name, date: this.formatDate(this.date) };
|
|
10247
|
+
}
|
|
10233
10248
|
}
|
|
10234
10249
|
__decorate([
|
|
10235
10250
|
Type(() => Date)
|
|
@@ -10481,6 +10496,12 @@ class MixpanelService {
|
|
|
10481
10496
|
}
|
|
10482
10497
|
mixpanel.track(event, properties);
|
|
10483
10498
|
}
|
|
10499
|
+
trackPageView() {
|
|
10500
|
+
if (!this.environment.enableMixpanel) {
|
|
10501
|
+
return;
|
|
10502
|
+
}
|
|
10503
|
+
mixpanel['track_pageview']();
|
|
10504
|
+
}
|
|
10484
10505
|
}
|
|
10485
10506
|
MixpanelService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MixpanelService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10486
10507
|
MixpanelService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MixpanelService, providedIn: 'root' });
|
|
@@ -10534,6 +10555,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
|
|
|
10534
10555
|
const NAME_TOKEN = 'token';
|
|
10535
10556
|
const NAME_REFRESH_TOKEN = 'refreshToken';
|
|
10536
10557
|
class JwtService extends JwtHelperService {
|
|
10558
|
+
constructor() {
|
|
10559
|
+
super(...arguments);
|
|
10560
|
+
this.mpService = inject(MixpanelService);
|
|
10561
|
+
}
|
|
10537
10562
|
getToken() {
|
|
10538
10563
|
return localStorage[NAME_TOKEN];
|
|
10539
10564
|
}
|
|
@@ -10543,6 +10568,7 @@ class JwtService extends JwtHelperService {
|
|
|
10543
10568
|
saveTokens(tokens) {
|
|
10544
10569
|
localStorage[NAME_TOKEN] = tokens.token;
|
|
10545
10570
|
localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;
|
|
10571
|
+
this.mpService.identify(this.getUser().id);
|
|
10546
10572
|
}
|
|
10547
10573
|
destroyTokens() {
|
|
10548
10574
|
localStorage.removeItem(NAME_TOKEN);
|
|
@@ -11892,6 +11918,53 @@ var DocumentMessagesEnum;
|
|
|
11892
11918
|
DocumentMessagesEnum["DELETED"] = "Document deleted!";
|
|
11893
11919
|
})(DocumentMessagesEnum || (DocumentMessagesEnum = {}));
|
|
11894
11920
|
|
|
11921
|
+
class AuthService {
|
|
11922
|
+
constructor(http, jwtService, mpService, environment) {
|
|
11923
|
+
this.http = http;
|
|
11924
|
+
this.jwtService = jwtService;
|
|
11925
|
+
this.mpService = mpService;
|
|
11926
|
+
this.environment = environment;
|
|
11927
|
+
this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
|
|
11928
|
+
}
|
|
11929
|
+
setAuth(response) {
|
|
11930
|
+
this.jwtService.saveTokens(response);
|
|
11931
|
+
this.isLoggedInSubject.next(true);
|
|
11932
|
+
}
|
|
11933
|
+
login(username, password) {
|
|
11934
|
+
return this.http.post(`${this.environment.apiV2}/login`, { username, password }).pipe(map((response) => {
|
|
11935
|
+
this.setAuth(response);
|
|
11936
|
+
this.mpService.track('login');
|
|
11937
|
+
return response;
|
|
11938
|
+
}), catchError((error) => {
|
|
11939
|
+
this.mpService.track('loginError', { username });
|
|
11940
|
+
return throwError(error);
|
|
11941
|
+
}));
|
|
11942
|
+
}
|
|
11943
|
+
refresh(refreshToken) {
|
|
11944
|
+
return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(map((response) => {
|
|
11945
|
+
this.setAuth(response);
|
|
11946
|
+
return response;
|
|
11947
|
+
}));
|
|
11948
|
+
}
|
|
11949
|
+
logoutFront(url = '/login') {
|
|
11950
|
+
localStorage.clear();
|
|
11951
|
+
this.mpService.track('logout');
|
|
11952
|
+
this.mpService.reset();
|
|
11953
|
+
location.replace(url);
|
|
11954
|
+
}
|
|
11955
|
+
}
|
|
11956
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: JwtService }, { token: MixpanelService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
11957
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
11958
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthService, decorators: [{
|
|
11959
|
+
type: Injectable,
|
|
11960
|
+
args: [{
|
|
11961
|
+
providedIn: 'root'
|
|
11962
|
+
}]
|
|
11963
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: MixpanelService }, { type: undefined, decorators: [{
|
|
11964
|
+
type: Inject,
|
|
11965
|
+
args: ['environment']
|
|
11966
|
+
}] }]; } });
|
|
11967
|
+
|
|
11895
11968
|
const ERROR_EMAIL_PERMISSION = 'Access to email denied. Please provide access to email in facebook.';
|
|
11896
11969
|
class FacebookService {
|
|
11897
11970
|
/**
|
|
@@ -11925,7 +11998,6 @@ class FacebookService {
|
|
|
11925
11998
|
setAuth(response) {
|
|
11926
11999
|
this.jwtService.saveTokens(response);
|
|
11927
12000
|
this.isLoggedInSubject.next(true);
|
|
11928
|
-
this.mpService.identify(this.jwtService.getUser().id);
|
|
11929
12001
|
this.mpService.track('loginFB');
|
|
11930
12002
|
}
|
|
11931
12003
|
/**
|
|
@@ -11975,54 +12047,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
|
|
|
11975
12047
|
args: ['environment']
|
|
11976
12048
|
}] }]; } });
|
|
11977
12049
|
|
|
11978
|
-
class AuthService {
|
|
11979
|
-
constructor(http, jwtService, mpService, environment) {
|
|
11980
|
-
this.http = http;
|
|
11981
|
-
this.jwtService = jwtService;
|
|
11982
|
-
this.mpService = mpService;
|
|
11983
|
-
this.environment = environment;
|
|
11984
|
-
this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
|
|
11985
|
-
}
|
|
11986
|
-
setAuth(response) {
|
|
11987
|
-
this.jwtService.saveTokens(response);
|
|
11988
|
-
this.isLoggedInSubject.next(true);
|
|
11989
|
-
}
|
|
11990
|
-
login(username, password) {
|
|
11991
|
-
return this.http.post(`${this.environment.apiV2}/login`, { username, password }).pipe(map((response) => {
|
|
11992
|
-
this.setAuth(response);
|
|
11993
|
-
this.mpService.identify(this.jwtService.getUser().id);
|
|
11994
|
-
this.mpService.track('login');
|
|
11995
|
-
return response;
|
|
11996
|
-
}), catchError((error) => {
|
|
11997
|
-
this.mpService.track('loginError', { username });
|
|
11998
|
-
return throwError(error);
|
|
11999
|
-
}));
|
|
12000
|
-
}
|
|
12001
|
-
refresh(refreshToken) {
|
|
12002
|
-
return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(map((response) => {
|
|
12003
|
-
this.setAuth(response);
|
|
12004
|
-
return response;
|
|
12005
|
-
}));
|
|
12006
|
-
}
|
|
12007
|
-
logoutFront(url = '/login') {
|
|
12008
|
-
localStorage.clear();
|
|
12009
|
-
this.mpService.track('logout');
|
|
12010
|
-
this.mpService.reset();
|
|
12011
|
-
location.replace(url);
|
|
12012
|
-
}
|
|
12013
|
-
}
|
|
12014
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: JwtService }, { token: MixpanelService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
12015
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
12016
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthService, decorators: [{
|
|
12017
|
-
type: Injectable,
|
|
12018
|
-
args: [{
|
|
12019
|
-
providedIn: 'root'
|
|
12020
|
-
}]
|
|
12021
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: MixpanelService }, { type: undefined, decorators: [{
|
|
12022
|
-
type: Inject,
|
|
12023
|
-
args: ['environment']
|
|
12024
|
-
}] }]; } });
|
|
12025
|
-
|
|
12026
12050
|
/**
|
|
12027
12051
|
* Google instance
|
|
12028
12052
|
* https://developers.google.com/identity/oauth2/web/guides/overview
|
|
@@ -12067,7 +12091,6 @@ class GoogleService {
|
|
|
12067
12091
|
.subscribe((response) => {
|
|
12068
12092
|
this.jwtService.saveTokens(response);
|
|
12069
12093
|
this.isLoggedInSubject.next(true);
|
|
12070
|
-
this.mpService.identify(this.jwtService.getUser().id);
|
|
12071
12094
|
this.mpService.track('loginGoogle');
|
|
12072
12095
|
this.router.navigate([redirectUrl]);
|
|
12073
12096
|
}, (error) => {
|
|
@@ -15543,12 +15566,15 @@ class UserService extends RestService$1 {
|
|
|
15543
15566
|
localStorage.setItem('userId', this.getCacheFirst().id.toString());
|
|
15544
15567
|
localStorage.setItem('financialYear', this.getCacheFirst().financialYear.toString());
|
|
15545
15568
|
localStorage.setItem('roles', JSON.stringify(this.getCacheFirst().roles));
|
|
15546
|
-
this.mpService.identify(this.getCacheFirst().id);
|
|
15547
15569
|
return users;
|
|
15548
15570
|
}));
|
|
15549
15571
|
}
|
|
15550
15572
|
register(data) {
|
|
15551
|
-
return this.http.post(`${this.apiUrl}/registration`, data)
|
|
15573
|
+
return this.http.post(`${this.apiUrl}/registration`, data)
|
|
15574
|
+
.pipe(map((user) => {
|
|
15575
|
+
this.mpService.identify(user['id']);
|
|
15576
|
+
return user;
|
|
15577
|
+
}));
|
|
15552
15578
|
}
|
|
15553
15579
|
changePassword(currentPassword, newPassword) {
|
|
15554
15580
|
return this.http.put(`${this.apiUrl}/password/change`, { currentPassword, newPassword })
|