taxtank-core 0.33.1 → 0.33.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,7 @@ export declare class JwtService extends JwtHelperService {
|
|
11
11
|
saveTokens(tokens: AuthTokenInterface): void;
|
12
12
|
destroyTokens(): void;
|
13
13
|
decode(token?: string): JwtDecodedInterface;
|
14
|
+
isClient(): boolean;
|
14
15
|
isMe(userId: number): boolean;
|
15
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<JwtService, never>;
|
16
17
|
static ɵprov: i0.ɵɵInjectableDeclaration<JwtService>;
|
@@ -2,6 +2,7 @@ import { Injectable, inject } from '@angular/core';
|
|
2
2
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
3
3
|
import { MixpanelService } from '../mixpanel.service';
|
4
4
|
import { BehaviorSubject } from 'rxjs';
|
5
|
+
import { UserRolesEnum } from '../../db';
|
5
6
|
import * as i0 from "@angular/core";
|
6
7
|
const NAME_TOKEN = 'token';
|
7
8
|
const NAME_REFRESH_TOKEN = 'refreshToken';
|
@@ -33,6 +34,9 @@ export class JwtService extends JwtHelperService {
|
|
33
34
|
decode(token) {
|
34
35
|
return super.decodeToken(token);
|
35
36
|
}
|
37
|
+
isClient() {
|
38
|
+
return this.decode().roles.includes(UserRolesEnum.CLIENT);
|
39
|
+
}
|
36
40
|
isMe(userId) {
|
37
41
|
return this.decode().id === userId;
|
38
42
|
}
|
@@ -45,4 +49,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImpor
|
|
45
49
|
providedIn: 'root'
|
46
50
|
}]
|
47
51
|
}] });
|
48
|
-
//# sourceMappingURL=data:application/json;base64,
|
52
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiand0LnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy90dC1jb3JlL2NvbW1vbi9zcmMvc2VydmljZX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ngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImpor
|
|
59
59
|
args: ['environment']
|
60
60
|
}] }] });
|
61
61
|
|
62
|
+
var UserRolesEnum;
|
63
|
+
(function (UserRolesEnum) {
|
64
|
+
UserRolesEnum["FIRM_OWNER"] = "ROLE_FIRM_OWNER";
|
65
|
+
UserRolesEnum["FIRM_MANAGER"] = "ROLE_FIRM_MANAGER";
|
66
|
+
UserRolesEnum["CLIENT"] = "ROLE_CLIENT";
|
67
|
+
UserRolesEnum["EMPLOYEE"] = "ROLE_EMPLOYEE";
|
68
|
+
UserRolesEnum["ACCOUNTANT"] = "ROLE_ACCOUNTANT";
|
69
|
+
UserRolesEnum["ADVISOR"] = "ROLE_ADVISOR";
|
70
|
+
UserRolesEnum["USER"] = "ROLE_USER";
|
71
|
+
UserRolesEnum["SUBSCRIPTION"] = "ROLE_USER_SUBSCRIPTION";
|
72
|
+
UserRolesEnum["WORK_TANK"] = "ROLE_USER_WORK";
|
73
|
+
UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
|
74
|
+
UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
|
75
|
+
UserRolesEnum["HOLDING_TANK"] = "ROLE_USER_HOLDING";
|
76
|
+
UserRolesEnum["SWITCH_USER"] = "IS_IMPERSONATOR";
|
77
|
+
})(UserRolesEnum || (UserRolesEnum = {}));
|
78
|
+
|
62
79
|
const NAME_TOKEN = 'token';
|
63
80
|
const NAME_REFRESH_TOKEN = 'refreshToken';
|
64
81
|
class JwtService extends JwtHelperService {
|
@@ -89,6 +106,9 @@ class JwtService extends JwtHelperService {
|
|
89
106
|
decode(token) {
|
90
107
|
return super.decodeToken(token);
|
91
108
|
}
|
109
|
+
isClient() {
|
110
|
+
return this.decode().roles.includes(UserRolesEnum.CLIENT);
|
111
|
+
}
|
92
112
|
isMe(userId) {
|
93
113
|
return this.decode().id === userId;
|
94
114
|
}
|
@@ -344,23 +364,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImpor
|
|
344
364
|
}]
|
345
365
|
}] });
|
346
366
|
|
347
|
-
var UserRolesEnum;
|
348
|
-
(function (UserRolesEnum) {
|
349
|
-
UserRolesEnum["FIRM_OWNER"] = "ROLE_FIRM_OWNER";
|
350
|
-
UserRolesEnum["FIRM_MANAGER"] = "ROLE_FIRM_MANAGER";
|
351
|
-
UserRolesEnum["CLIENT"] = "ROLE_CLIENT";
|
352
|
-
UserRolesEnum["EMPLOYEE"] = "ROLE_EMPLOYEE";
|
353
|
-
UserRolesEnum["ACCOUNTANT"] = "ROLE_ACCOUNTANT";
|
354
|
-
UserRolesEnum["ADVISOR"] = "ROLE_ADVISOR";
|
355
|
-
UserRolesEnum["USER"] = "ROLE_USER";
|
356
|
-
UserRolesEnum["SUBSCRIPTION"] = "ROLE_USER_SUBSCRIPTION";
|
357
|
-
UserRolesEnum["WORK_TANK"] = "ROLE_USER_WORK";
|
358
|
-
UserRolesEnum["PROPERTY_TANK"] = "ROLE_USER_PROPERTY";
|
359
|
-
UserRolesEnum["SOLE_TANK"] = "ROLE_USER_SOLE";
|
360
|
-
UserRolesEnum["HOLDING_TANK"] = "ROLE_USER_HOLDING";
|
361
|
-
UserRolesEnum["SWITCH_USER"] = "IS_IMPERSONATOR";
|
362
|
-
})(UserRolesEnum || (UserRolesEnum = {}));
|
363
|
-
|
364
367
|
/**
|
365
368
|
* Generated bundle index. Do not edit.
|
366
369
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"taxtank-core-common.mjs","sources":["../../../projects/tt-core/common/src/services/mixpanel.service.ts","../../../projects/tt-core/common/src/services/auth/jwt.service.ts","../../../projects/tt-core/common/src/services/auth/auth.service.ts","../../../projects/tt-core/common/src/services/auth/auth-messages.enum.ts","../../../projects/tt-core/common/src/interceptors/jwt-interceptor.ts","../../../projects/tt-core/common/src/interceptors/interceptors.module.ts","../../../projects/tt-core/common/src/common.module.ts","../../../projects/tt-core/common/src/db/enums/user/user-roles.enum.ts","../../../projects/tt-core/common/taxtank-core-common.ts"],"sourcesContent":["import { Inject, Injectable } from '@angular/core';\nimport * as mixpanel from 'mixpanel-browser';\n\n/**\n * Service to work with mixpanel https://docs.mixpanel.com/docs/tracking/reference/javascript\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class MixpanelService {\n constructor(@Inject('environment') private environment: any) {}\n\n init(): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel.init(this.environment.mixpanelToken);\n }\n\n identify(id: string): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel.identify(id);\n mixpanel.people.set({ 'last seen': new Date(Date.now()).toLocaleString() })\n }\n\n reset(): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel.reset();\n }\n\n track(event: string, properties: { [key: string]: any } = {}): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel.track(event, properties);\n }\n\n trackPageView(): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel['track_pageview']();\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { JwtHelperService } from '@auth0/angular-jwt';\nimport { MixpanelService } from '../mixpanel.service';\nimport { JwtDecodedInterface } from './jwt-decoded.interface';\nimport { BehaviorSubject } from 'rxjs';\nimport { AuthTokenInterface } from './auth-tokens.interface';\n\nconst NAME_TOKEN = 'token';\nconst NAME_REFRESH_TOKEN = 'refreshToken';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class JwtService extends JwtHelperService {\n private mpService: MixpanelService = inject(MixpanelService);\n isLoggedInSubject = new BehaviorSubject(!this.isTokenExpired());\n\n getToken(): string {\n return localStorage[NAME_TOKEN];\n }\n\n getRefreshToken(): string {\n return localStorage[NAME_REFRESH_TOKEN];\n }\n\n saveTokens(tokens: AuthTokenInterface): void {\n localStorage[NAME_TOKEN] = tokens.token;\n localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;\n\n this.mpService.identify(this.decode(tokens.token).id.toString());\n this.isLoggedInSubject.next(true);\n }\n\n destroyTokens(): void {\n localStorage.removeItem(NAME_TOKEN);\n localStorage.removeItem(NAME_REFRESH_TOKEN);\n\n this.mpService.track('logout');\n this.mpService.reset();\n this.isLoggedInSubject.next(false);\n\n }\n\n decode(token?: string): JwtDecodedInterface {\n return super.decodeToken(token) as JwtDecodedInterface;\n }\n\n isMe(userId: number): boolean {\n return this.decode().id === userId;\n }\n}\n","import { Inject, Injectable } from '@angular/core';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { JwtService } from './jwt.service';\nimport { map } from 'rxjs/operators';\nimport { AuthTokenInterface } from './auth-tokens.interface';\nimport { MixpanelService } from '../mixpanel.service';\nimport { UserRolesEnum } from '../../db';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthService {\n constructor(\n private http: HttpClient,\n private jwtService: JwtService,\n private mpService: MixpanelService,\n @Inject('environment') private environment: any\n ) {\n\n }\n\n setAuth(response: AuthTokenInterface) {\n this.jwtService.saveTokens(response);\n }\n\n login(username: string, password: string, role: UserRolesEnum = null) {\n return this.http.post(`${this.environment.apiV2}/login`, { username, password }).pipe(\n map((response: any) => {\n if (!role || this.jwtService.decodeToken(response.token).roles.includes(role)) {\n this.setAuth(response);\n } else {\n throw new HttpErrorResponse({\n error: { code: 401, message: 'Your TaxTank subscription is expired. Please reactivate your account to link the widget.' },\n status: 401,\n statusText: 'Unauthorized',\n })\n }\n\n return response;\n })\n );\n }\n\n refresh(refreshToken: string) {\n return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(\n map((response: any) => {\n this.setAuth(response);\n\n return response;\n })\n );\n }\n\n logoutFront(url = '/login'): void {\n this.jwtService.destroyTokens();\n localStorage.clear();\n location.replace(url);\n }\n}\n","export enum AuthMessagesEnum {\n ERROR_401 = 'Email or password is incorrect'\n}\n","import { BehaviorSubject, Observable, throwError as observableThrowError } from 'rxjs';\nimport { catchError, filter, finalize, switchMap, take } from 'rxjs/operators';\nimport { Inject, Injectable } from '@angular/core';\nimport { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\nimport { AuthService, JwtService } from '../services';\n\nconst MESSAGE_DEFAULT_500_ERROR = 'Unexpected error! Please try again later. You can send us via chat your questions.';\n\n/**\n * JWT Interceptor add jwt token to each request related with TaxTank API\n */\n@Injectable()\nexport class JwtInterceptor implements HttpInterceptor {\n isRefreshingToken = false;\n tokenSubject: BehaviorSubject<string> = new BehaviorSubject<string>(null);\n\n constructor(\n public jwtService: JwtService,\n private authService: AuthService,\n @Inject('environment') private environment: any\n ) {}\n\n addToken(req: HttpRequest<any>): HttpRequest<any> {\n return req.clone({\n setHeaders: { Authorization: 'Bearer ' + this.jwtService.getToken() },\n withCredentials: true\n });\n }\n\n intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n // skip third party requests\n if (!request.url.includes(this.environment.apiV2)) {\n return next.handle(request);\n }\n\n // add token to every api request\n return next.handle(this.addToken(request)).pipe(\n // handle errors\n catchError((err: HttpErrorResponse) => {\n if (err instanceof HttpErrorResponse) {\n switch ((err as HttpErrorResponse).status) {\n // unexpected errors\n case 405:\n case 500:\n this.handle500Error();\n break;\n // expected errors\n case 401:\n return this.handle401Error(request, next, err);\n case 400:\n case 403:\n // @TODO in most cases 404 is not an error, handle in components\n // case 404:\n this.showErrorMessages(err);\n break;\n }\n }\n\n return observableThrowError(err);\n })\n );\n }\n\n /**\n * @TODO log\n * @TODO waiting for backend to handle errors in a better way\n */\n handle400Error(err: HttpErrorResponse): void {\n // this.snackBar.open(err.error['hydra:description'], '', {\n // panelClass: 'error'\n // });\n }\n\n /**\n * @TODO log\n * @TODO waiting for backend to handle errors in a better way\n */\n handle403Error(err: HttpErrorResponse): void {\n // this.snackBar.open(err.error['hydra:description'], '', {\n // panelClass: 'error'\n // });\n }\n\n /**\n * @TODO log\n */\n handle500Error(): void {\n // this.snackBar.open(MESSAGE_DEFAULT_500_ERROR, '', {\n // panelClass: 'error'\n // });\n }\n\n handle401Error(req: HttpRequest<any>, next: HttpHandler, err: HttpErrorResponse) {\n // skip 401 errors not from JWT (basiq login case or other)\n if (!err.error.message?.includes('JWT Token')) {\n return observableThrowError(err);\n }\n\n if (req.url.includes('token/refresh') || req.url.includes('login')) {\n if (req.url.includes('token/refresh')) {\n this.authService.logoutFront();\n }\n\n return observableThrowError(err);\n }\n\n // refreshing token, wait until it's done and retry the request\n if (this.isRefreshingToken) {\n return this.tokenSubject.pipe(\n filter(token => token != null),\n take(1),\n switchMap(token => next.handle(this.addToken(req)))\n );\n // refresh token\n }\n // subsequent requests should wait until refresh token is ready\n this.isRefreshingToken = true;\n this.tokenSubject.next(null);\n\n return this.authService.refresh(this.jwtService.getRefreshToken()).pipe(\n switchMap((tokens: { token: string, refreshToken: string }) => {\n this.tokenSubject.next(tokens.token);\n return next.handle(this.addToken(req));\n }),\n catchError(() => {\n this.authService.logoutFront();\n return observableThrowError(err);\n }),\n finalize(() => {\n this.isRefreshingToken = false;\n })\n );\n\n }\n\n /**\n * Handle error messages\n * @param errorResponse from which messages should be taken\n *\n * @TODO move to separated interceptor\n */\n private showErrorMessages(errorResponse: HttpErrorResponse): void {\n if (!errorResponse.error.violations) {\n // this.snackBar.open('Something went wrong', '', {\n // panelClass: 'error'\n // });\n\n return;\n }\n errorResponse.error.violations.forEach((violation: object): void => {\n // this.snackBar.open(violation['message'], '', {\n // panelClass: 'error'\n // });\n });\n }\n}\n","import { NgModule } from '@angular/core';\r\nimport { HTTP_INTERCEPTORS } from '@angular/common/http';\r\nimport { JwtInterceptor } from './jwt-interceptor';\r\n\r\n@NgModule({\r\n providers: [\r\n {\r\n provide: HTTP_INTERCEPTORS,\r\n useClass: JwtInterceptor,\r\n multi: true\r\n }\r\n ]\r\n})\r\nexport class InterceptorsModule {\r\n}\r\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { CommonModule as AngularCommonModule } from '@angular/common';\nimport { InterceptorsModule } from './interceptors/interceptors.module';\n\n/**\n * https://angular.io/guide/creating-libraries\n */\n@NgModule({\n declarations: [],\n imports: [\n AngularCommonModule,\n InterceptorsModule\n ]\n})\nexport class CommonModule {\n public static forRoot(environment: object): ModuleWithProviders<CommonModule> {\n return {\n ngModule: CommonModule,\n providers: [\n {\n provide: 'environment',\n useValue: environment\n }\n ]\n };\n }\n}\n","export enum UserRolesEnum {\n FIRM_OWNER = 'ROLE_FIRM_OWNER',\n FIRM_MANAGER = 'ROLE_FIRM_MANAGER',\n CLIENT = 'ROLE_CLIENT',\n EMPLOYEE = 'ROLE_EMPLOYEE',\n ACCOUNTANT = 'ROLE_ACCOUNTANT',\n ADVISOR = 'ROLE_ADVISOR',\n USER = 'ROLE_USER',\n SUBSCRIPTION = 'ROLE_USER_SUBSCRIPTION',\n WORK_TANK = 'ROLE_USER_WORK',\n PROPERTY_TANK = 'ROLE_USER_PROPERTY',\n SOLE_TANK = 'ROLE_USER_SOLE',\n HOLDING_TANK = 'ROLE_USER_HOLDING',\n SWITCH_USER = 'IS_IMPERSONATOR',\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["observableThrowError","AngularCommonModule"],"mappings":";;;;;;;;;;AAGA;;AAEG;MAIU,eAAe,CAAA;AAC1B,IAAA,WAAA,CAA2C,WAAgB,EAAA;QAAhB,IAAW,CAAA,WAAA,GAAX,WAAW,CAAK;KAAI;IAE/D,IAAI,GAAA;AACF,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE;YACpC,OAAO;AACR,SAAA;QAED,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;KAC/C;AAED,IAAA,QAAQ,CAAC,EAAU,EAAA;AACjB,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE;YACpC,OAAO;AACR,SAAA;AAED,QAAA,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAA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AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACPA,cAAmB;wBACnB,kBAAkB;AACnB,qBAAA;AACF,iBAAA,CAAA;;;ICbW,cAcX;AAdD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,YAAA,CAAA,GAAA,iBAA8B,CAAA;AAC9B,IAAA,aAAA,CAAA,cAAA,CAAA,GAAA,mBAAkC,CAAA;AAClC,IAAA,aAAA,CAAA,QAAA,CAAA,GAAA,aAAsB,CAAA;AACtB,IAAA,aAAA,CAAA,UAAA,CAAA,GAAA,eAA0B,CAAA;AAC1B,IAAA,aAAA,CAAA,YAAA,CAAA,GAAA,iBAA8B,CAAA;AAC9B,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,cAAwB,CAAA;AACxB,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,WAAkB,CAAA;AAClB,IAAA,aAAA,CAAA,cAAA,CAAA,GAAA,wBAAuC,CAAA;AACvC,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,gBAA4B,CAAA;AAC5B,IAAA,aAAA,CAAA,eAAA,CAAA,GAAA,oBAAoC,CAAA;AACpC,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,gBAA4B,CAAA;AAC5B,IAAA,aAAA,CAAA,cAAA,CAAA,GAAA,mBAAkC,CAAA;AAClC,IAAA,aAAA,CAAA,aAAA,CAAA,GAAA,iBAA+B,CAAA;AACjC,CAAC,EAdW,aAAa,KAAb,aAAa,GAcxB,EAAA,CAAA,CAAA;;ACdD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"taxtank-core-common.mjs","sources":["../../../projects/tt-core/common/src/services/mixpanel.service.ts","../../../projects/tt-core/common/src/db/enums/user/user-roles.enum.ts","../../../projects/tt-core/common/src/services/auth/jwt.service.ts","../../../projects/tt-core/common/src/services/auth/auth.service.ts","../../../projects/tt-core/common/src/services/auth/auth-messages.enum.ts","../../../projects/tt-core/common/src/interceptors/jwt-interceptor.ts","../../../projects/tt-core/common/src/interceptors/interceptors.module.ts","../../../projects/tt-core/common/src/common.module.ts","../../../projects/tt-core/common/taxtank-core-common.ts"],"sourcesContent":["import { Inject, Injectable } from '@angular/core';\nimport * as mixpanel from 'mixpanel-browser';\n\n/**\n * Service to work with mixpanel https://docs.mixpanel.com/docs/tracking/reference/javascript\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class MixpanelService {\n constructor(@Inject('environment') private environment: any) {}\n\n init(): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel.init(this.environment.mixpanelToken);\n }\n\n identify(id: string): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel.identify(id);\n mixpanel.people.set({ 'last seen': new Date(Date.now()).toLocaleString() })\n }\n\n reset(): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel.reset();\n }\n\n track(event: string, properties: { [key: string]: any } = {}): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel.track(event, properties);\n }\n\n trackPageView(): void {\n if (!this.environment.enableMixpanel) {\n return;\n }\n\n mixpanel['track_pageview']();\n }\n}\n","export enum UserRolesEnum {\n FIRM_OWNER = 'ROLE_FIRM_OWNER',\n FIRM_MANAGER = 'ROLE_FIRM_MANAGER',\n CLIENT = 'ROLE_CLIENT',\n EMPLOYEE = 'ROLE_EMPLOYEE',\n ACCOUNTANT = 'ROLE_ACCOUNTANT',\n ADVISOR = 'ROLE_ADVISOR',\n USER = 'ROLE_USER',\n SUBSCRIPTION = 'ROLE_USER_SUBSCRIPTION',\n WORK_TANK = 'ROLE_USER_WORK',\n PROPERTY_TANK = 'ROLE_USER_PROPERTY',\n SOLE_TANK = 'ROLE_USER_SOLE',\n HOLDING_TANK = 'ROLE_USER_HOLDING',\n SWITCH_USER = 'IS_IMPERSONATOR',\n}\n","import { Injectable, inject } from '@angular/core';\nimport { JwtHelperService } from '@auth0/angular-jwt';\nimport { MixpanelService } from '../mixpanel.service';\nimport { JwtDecodedInterface } from './jwt-decoded.interface';\nimport { BehaviorSubject } from 'rxjs';\nimport { AuthTokenInterface } from './auth-tokens.interface';\nimport { UserRolesEnum } from '../../db';\n\nconst NAME_TOKEN = 'token';\nconst NAME_REFRESH_TOKEN = 'refreshToken';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class JwtService extends JwtHelperService {\n private mpService: MixpanelService = inject(MixpanelService);\n isLoggedInSubject = new BehaviorSubject(!this.isTokenExpired());\n\n getToken(): string {\n return localStorage[NAME_TOKEN];\n }\n\n getRefreshToken(): string {\n return localStorage[NAME_REFRESH_TOKEN];\n }\n\n saveTokens(tokens: AuthTokenInterface): void {\n localStorage[NAME_TOKEN] = tokens.token;\n localStorage[NAME_REFRESH_TOKEN] = tokens.refreshToken;\n\n this.mpService.identify(this.decode(tokens.token).id.toString());\n this.isLoggedInSubject.next(true);\n }\n\n destroyTokens(): void {\n localStorage.removeItem(NAME_TOKEN);\n localStorage.removeItem(NAME_REFRESH_TOKEN);\n\n this.mpService.track('logout');\n this.mpService.reset();\n this.isLoggedInSubject.next(false);\n\n }\n\n decode(token?: string): JwtDecodedInterface {\n return super.decodeToken(token) as JwtDecodedInterface;\n }\n\n isClient(): boolean {\n return this.decode().roles.includes(UserRolesEnum.CLIENT);\n }\n\n isMe(userId: number): boolean {\n return this.decode().id === userId;\n }\n}\n","import { Inject, Injectable } from '@angular/core';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { JwtService } from './jwt.service';\nimport { map } from 'rxjs/operators';\nimport { AuthTokenInterface } from './auth-tokens.interface';\nimport { MixpanelService } from '../mixpanel.service';\nimport { UserRolesEnum } from '../../db';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthService {\n constructor(\n private http: HttpClient,\n private jwtService: JwtService,\n private mpService: MixpanelService,\n @Inject('environment') private environment: any\n ) {\n\n }\n\n setAuth(response: AuthTokenInterface) {\n this.jwtService.saveTokens(response);\n }\n\n login(username: string, password: string, role: UserRolesEnum = null) {\n return this.http.post(`${this.environment.apiV2}/login`, { username, password }).pipe(\n map((response: any) => {\n if (!role || this.jwtService.decodeToken(response.token).roles.includes(role)) {\n this.setAuth(response);\n } else {\n throw new HttpErrorResponse({\n error: { code: 401, message: 'Your TaxTank subscription is expired. Please reactivate your account to link the widget.' },\n status: 401,\n statusText: 'Unauthorized',\n })\n }\n\n return response;\n })\n );\n }\n\n refresh(refreshToken: string) {\n return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(\n map((response: any) => {\n this.setAuth(response);\n\n return response;\n })\n );\n }\n\n logoutFront(url = '/login'): void {\n this.jwtService.destroyTokens();\n localStorage.clear();\n location.replace(url);\n }\n}\n","export enum AuthMessagesEnum {\n ERROR_401 = 'Email or password is incorrect'\n}\n","import { BehaviorSubject, Observable, throwError as observableThrowError } from 'rxjs';\nimport { catchError, filter, finalize, switchMap, take } from 'rxjs/operators';\nimport { Inject, Injectable } from '@angular/core';\nimport { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\nimport { AuthService, JwtService } from '../services';\n\nconst MESSAGE_DEFAULT_500_ERROR = 'Unexpected error! Please try again later. You can send us via chat your questions.';\n\n/**\n * JWT Interceptor add jwt token to each request related with TaxTank API\n */\n@Injectable()\nexport class JwtInterceptor implements HttpInterceptor {\n isRefreshingToken = false;\n tokenSubject: BehaviorSubject<string> = new BehaviorSubject<string>(null);\n\n constructor(\n public jwtService: JwtService,\n private authService: AuthService,\n @Inject('environment') private environment: any\n ) {}\n\n addToken(req: HttpRequest<any>): HttpRequest<any> {\n return req.clone({\n setHeaders: { Authorization: 'Bearer ' + this.jwtService.getToken() },\n withCredentials: true\n });\n }\n\n intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {\n // skip third party requests\n if (!request.url.includes(this.environment.apiV2)) {\n return next.handle(request);\n }\n\n // add token to every api request\n return next.handle(this.addToken(request)).pipe(\n // handle errors\n catchError((err: HttpErrorResponse) => {\n if (err instanceof HttpErrorResponse) {\n switch ((err as HttpErrorResponse).status) {\n // unexpected errors\n case 405:\n case 500:\n this.handle500Error();\n break;\n // expected errors\n case 401:\n return this.handle401Error(request, next, err);\n case 400:\n case 403:\n // @TODO in most cases 404 is not an error, handle in components\n // case 404:\n this.showErrorMessages(err);\n break;\n }\n }\n\n return observableThrowError(err);\n })\n );\n }\n\n /**\n * @TODO log\n * @TODO waiting for backend to handle errors in a better way\n */\n handle400Error(err: HttpErrorResponse): void {\n // this.snackBar.open(err.error['hydra:description'], '', {\n // panelClass: 'error'\n // });\n }\n\n /**\n * @TODO log\n * @TODO waiting for backend to handle errors in a better way\n */\n handle403Error(err: HttpErrorResponse): void {\n // this.snackBar.open(err.error['hydra:description'], '', {\n // panelClass: 'error'\n // });\n }\n\n /**\n * @TODO log\n */\n handle500Error(): void {\n // this.snackBar.open(MESSAGE_DEFAULT_500_ERROR, '', {\n // panelClass: 'error'\n // });\n }\n\n handle401Error(req: HttpRequest<any>, next: HttpHandler, err: HttpErrorResponse) {\n // skip 401 errors not from JWT (basiq login case or other)\n if (!err.error.message?.includes('JWT Token')) {\n return observableThrowError(err);\n }\n\n if (req.url.includes('token/refresh') || req.url.includes('login')) {\n if (req.url.includes('token/refresh')) {\n this.authService.logoutFront();\n }\n\n return observableThrowError(err);\n }\n\n // refreshing token, wait until it's done and retry the request\n if (this.isRefreshingToken) {\n return this.tokenSubject.pipe(\n filter(token => token != null),\n take(1),\n switchMap(token => next.handle(this.addToken(req)))\n );\n // refresh token\n }\n // subsequent requests should wait until refresh token is ready\n this.isRefreshingToken = true;\n this.tokenSubject.next(null);\n\n return this.authService.refresh(this.jwtService.getRefreshToken()).pipe(\n switchMap((tokens: { token: string, refreshToken: string }) => {\n this.tokenSubject.next(tokens.token);\n return next.handle(this.addToken(req));\n }),\n catchError(() => {\n this.authService.logoutFront();\n return observableThrowError(err);\n }),\n finalize(() => {\n this.isRefreshingToken = false;\n })\n );\n\n }\n\n /**\n * Handle error messages\n * @param errorResponse from which messages should be taken\n *\n * @TODO move to separated interceptor\n */\n private showErrorMessages(errorResponse: HttpErrorResponse): void {\n if (!errorResponse.error.violations) {\n // this.snackBar.open('Something went wrong', '', {\n // panelClass: 'error'\n // });\n\n return;\n }\n errorResponse.error.violations.forEach((violation: object): void => {\n // this.snackBar.open(violation['message'], '', {\n // panelClass: 'error'\n // });\n });\n }\n}\n","import { NgModule } from '@angular/core';\r\nimport { HTTP_INTERCEPTORS } from '@angular/common/http';\r\nimport { JwtInterceptor } from './jwt-interceptor';\r\n\r\n@NgModule({\r\n providers: [\r\n {\r\n provide: HTTP_INTERCEPTORS,\r\n useClass: JwtInterceptor,\r\n multi: true\r\n }\r\n ]\r\n})\r\nexport class InterceptorsModule {\r\n}\r\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { CommonModule as AngularCommonModule } from '@angular/common';\nimport { InterceptorsModule } from './interceptors/interceptors.module';\n\n/**\n * https://angular.io/guide/creating-libraries\n */\n@NgModule({\n declarations: [],\n imports: [\n AngularCommonModule,\n InterceptorsModule\n ]\n})\nexport class CommonModule {\n public static forRoot(environment: object): ModuleWithProviders<CommonModule> {\n return {\n ngModule: CommonModule,\n providers: [\n {\n provide: 'environment',\n useValue: environment\n }\n ]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["observableThrowError","AngularCommonModule"],"mappings":";;;;;;;;;;AAGA;;AAEG;MAIU,eAAe,CAAA;AAC1B,IAAA,WAAA,CAA2C,WAAgB,EAAA;QAAhB,IAAW,CAAA,WAAA,GAAX,WAAW,CAAK;KAAI;IAE/D,IAAI,GAAA;AACF,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE;YACpC,OAAO;AACR,SAAA;QAED,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;KAC/C;AAED,IAAA,QAAQ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