taxtank-core 0.31.51 → 0.31.52
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/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 +65 -54
- package/fesm2015/taxtank-core.mjs.map +1 -1
- package/fesm2020/taxtank-core.mjs +63 -52
- package/fesm2020/taxtank-core.mjs.map +1 -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
|
@@ -10481,6 +10481,12 @@ class MixpanelService {
|
|
|
10481
10481
|
}
|
|
10482
10482
|
mixpanel.track(event, properties);
|
|
10483
10483
|
}
|
|
10484
|
+
trackPageView() {
|
|
10485
|
+
if (!this.environment.enableMixpanel) {
|
|
10486
|
+
return;
|
|
10487
|
+
}
|
|
10488
|
+
mixpanel['track_pageview']();
|
|
10489
|
+
}
|
|
10484
10490
|
}
|
|
10485
10491
|
MixpanelService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MixpanelService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10486
10492
|
MixpanelService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MixpanelService, providedIn: 'root' });
|
|
@@ -10534,6 +10540,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
|
|
|
10534
10540
|
const NAME_TOKEN = 'token';
|
|
10535
10541
|
const NAME_REFRESH_TOKEN = 'refreshToken';
|
|
10536
10542
|
class JwtService extends JwtHelperService {
|
|
10543
|
+
constructor() {
|
|
10544
|
+
super(...arguments);
|
|
10545
|
+
this.mpService = inject(MixpanelService);
|
|
10546
|
+
}
|
|
10537
10547
|
getToken() {
|
|
10538
10548
|
return localStorage[NAME_TOKEN];
|
|
10539
10549
|
}
|
|
@@ -10543,6 +10553,7 @@ class JwtService extends JwtHelperService {
|
|
|
10543
10553
|
saveTokens(tokens) {
|
|
10544
10554
|
localStorage[NAME_TOKEN] = tokens.token;
|
|
10545
10555
|
localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;
|
|
10556
|
+
this.mpService.identify(this.getUser().id);
|
|
10546
10557
|
}
|
|
10547
10558
|
destroyTokens() {
|
|
10548
10559
|
localStorage.removeItem(NAME_TOKEN);
|
|
@@ -11892,6 +11903,53 @@ var DocumentMessagesEnum;
|
|
|
11892
11903
|
DocumentMessagesEnum["DELETED"] = "Document deleted!";
|
|
11893
11904
|
})(DocumentMessagesEnum || (DocumentMessagesEnum = {}));
|
|
11894
11905
|
|
|
11906
|
+
class AuthService {
|
|
11907
|
+
constructor(http, jwtService, mpService, environment) {
|
|
11908
|
+
this.http = http;
|
|
11909
|
+
this.jwtService = jwtService;
|
|
11910
|
+
this.mpService = mpService;
|
|
11911
|
+
this.environment = environment;
|
|
11912
|
+
this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
|
|
11913
|
+
}
|
|
11914
|
+
setAuth(response) {
|
|
11915
|
+
this.jwtService.saveTokens(response);
|
|
11916
|
+
this.isLoggedInSubject.next(true);
|
|
11917
|
+
}
|
|
11918
|
+
login(username, password) {
|
|
11919
|
+
return this.http.post(`${this.environment.apiV2}/login`, { username, password }).pipe(map((response) => {
|
|
11920
|
+
this.setAuth(response);
|
|
11921
|
+
this.mpService.track('login');
|
|
11922
|
+
return response;
|
|
11923
|
+
}), catchError((error) => {
|
|
11924
|
+
this.mpService.track('loginError', { username });
|
|
11925
|
+
return throwError(error);
|
|
11926
|
+
}));
|
|
11927
|
+
}
|
|
11928
|
+
refresh(refreshToken) {
|
|
11929
|
+
return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(map((response) => {
|
|
11930
|
+
this.setAuth(response);
|
|
11931
|
+
return response;
|
|
11932
|
+
}));
|
|
11933
|
+
}
|
|
11934
|
+
logoutFront(url = '/login') {
|
|
11935
|
+
localStorage.clear();
|
|
11936
|
+
this.mpService.track('logout');
|
|
11937
|
+
this.mpService.reset();
|
|
11938
|
+
location.replace(url);
|
|
11939
|
+
}
|
|
11940
|
+
}
|
|
11941
|
+
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 });
|
|
11942
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
11943
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthService, decorators: [{
|
|
11944
|
+
type: Injectable,
|
|
11945
|
+
args: [{
|
|
11946
|
+
providedIn: 'root'
|
|
11947
|
+
}]
|
|
11948
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: MixpanelService }, { type: undefined, decorators: [{
|
|
11949
|
+
type: Inject,
|
|
11950
|
+
args: ['environment']
|
|
11951
|
+
}] }]; } });
|
|
11952
|
+
|
|
11895
11953
|
const ERROR_EMAIL_PERMISSION = 'Access to email denied. Please provide access to email in facebook.';
|
|
11896
11954
|
class FacebookService {
|
|
11897
11955
|
/**
|
|
@@ -11925,7 +11983,6 @@ class FacebookService {
|
|
|
11925
11983
|
setAuth(response) {
|
|
11926
11984
|
this.jwtService.saveTokens(response);
|
|
11927
11985
|
this.isLoggedInSubject.next(true);
|
|
11928
|
-
this.mpService.identify(this.jwtService.getUser().id);
|
|
11929
11986
|
this.mpService.track('loginFB');
|
|
11930
11987
|
}
|
|
11931
11988
|
/**
|
|
@@ -11975,54 +12032,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
|
|
|
11975
12032
|
args: ['environment']
|
|
11976
12033
|
}] }]; } });
|
|
11977
12034
|
|
|
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
12035
|
/**
|
|
12027
12036
|
* Google instance
|
|
12028
12037
|
* https://developers.google.com/identity/oauth2/web/guides/overview
|
|
@@ -12067,7 +12076,6 @@ class GoogleService {
|
|
|
12067
12076
|
.subscribe((response) => {
|
|
12068
12077
|
this.jwtService.saveTokens(response);
|
|
12069
12078
|
this.isLoggedInSubject.next(true);
|
|
12070
|
-
this.mpService.identify(this.jwtService.getUser().id);
|
|
12071
12079
|
this.mpService.track('loginGoogle');
|
|
12072
12080
|
this.router.navigate([redirectUrl]);
|
|
12073
12081
|
}, (error) => {
|
|
@@ -15543,12 +15551,15 @@ class UserService extends RestService$1 {
|
|
|
15543
15551
|
localStorage.setItem('userId', this.getCacheFirst().id.toString());
|
|
15544
15552
|
localStorage.setItem('financialYear', this.getCacheFirst().financialYear.toString());
|
|
15545
15553
|
localStorage.setItem('roles', JSON.stringify(this.getCacheFirst().roles));
|
|
15546
|
-
this.mpService.identify(this.getCacheFirst().id);
|
|
15547
15554
|
return users;
|
|
15548
15555
|
}));
|
|
15549
15556
|
}
|
|
15550
15557
|
register(data) {
|
|
15551
|
-
return this.http.post(`${this.apiUrl}/registration`, data)
|
|
15558
|
+
return this.http.post(`${this.apiUrl}/registration`, data)
|
|
15559
|
+
.pipe(map((user) => {
|
|
15560
|
+
this.mpService.identify(user['id']);
|
|
15561
|
+
return user;
|
|
15562
|
+
}));
|
|
15552
15563
|
}
|
|
15553
15564
|
changePassword(currentPassword, newPassword) {
|
|
15554
15565
|
return this.http.put(`${this.apiUrl}/password/change`, { currentPassword, newPassword })
|