taxtank-core 0.32.27 → 0.32.28

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.
@@ -4,7 +4,7 @@ import * as i1$1 from '@angular/common';
4
4
  import { formatDate, CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
5
5
  import * as i1 from '@angular/common/http';
6
6
  import { HttpParams, HttpClient, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
7
- import { map, mergeMap, filter, first as first$1, catchError, take, switchMap, finalize, debounceTime, distinctUntilChanged, startWith, delay } from 'rxjs/operators';
7
+ import { map, mergeMap, filter, first as first$1, catchError, take, switchMap, finalize, debounceTime, distinctUntilChanged, startWith } from 'rxjs/operators';
8
8
  import { ReplaySubject, Subject, BehaviorSubject, Observable, throwError, combineLatest, forkJoin, of, 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';
@@ -10668,6 +10668,12 @@ let RestService$1 = class RestService extends DataService {
10668
10668
  this.cache = undefined;
10669
10669
  this.get();
10670
10670
  }
10671
+ /**
10672
+ * perform a shallow copy of the emitted data to make it immutable
10673
+ */
10674
+ getCacheSubjectObservable() {
10675
+ return this.cacheSubject.asObservable().pipe(map((cache) => clone(cache)));
10676
+ }
10671
10677
  /**
10672
10678
  * Get data from backend and fill the cache
10673
10679
  */
@@ -10675,7 +10681,7 @@ let RestService$1 = class RestService extends DataService {
10675
10681
  this.handleAccessError('get');
10676
10682
  if (!this.hasRoles()) {
10677
10683
  this.setCache([], true);
10678
- return this.cacheSubject.asObservable();
10684
+ return this.getCacheSubjectObservable();
10679
10685
  }
10680
10686
  // Set cache as empty collection to avoid multiple requests before cache filled
10681
10687
  this.setCache([]);
@@ -10689,7 +10695,7 @@ let RestService$1 = class RestService extends DataService {
10689
10695
  if (!this.cache) {
10690
10696
  this.fetch(path).pipe(first$1()).subscribe();
10691
10697
  }
10692
- return this.cacheSubject.asObservable();
10698
+ return this.getCacheSubjectObservable();
10693
10699
  }
10694
10700
  getFirst() {
10695
10701
  this.handleAccessError('get');
@@ -11901,12 +11907,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11901
11907
  * https://developers.google.com/identity/gsi/web/guides/overview
11902
11908
  */
11903
11909
  class GoogleService {
11904
- constructor(http, toastService, jwtService, router, mpService, environment) {
11910
+ constructor(http, toastService, jwtService, router, environment) {
11905
11911
  this.http = http;
11906
11912
  this.toastService = toastService;
11907
11913
  this.jwtService = jwtService;
11908
11914
  this.router = router;
11909
- this.mpService = mpService;
11910
11915
  this.environment = environment;
11911
11916
  this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
11912
11917
  this.isGoogleEnabled = !!this.environment['googleClientId'];
@@ -11953,7 +11958,7 @@ class GoogleService {
11953
11958
  logout() {
11954
11959
  google.accounts.id.disableAutoSelect();
11955
11960
  }
11956
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GoogleService, deps: [{ token: i1.HttpClient }, { token: ToastService }, { token: JwtService }, { token: i4.Router }, { token: MixpanelService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11961
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GoogleService, deps: [{ token: i1.HttpClient }, { token: ToastService }, { token: JwtService }, { token: i4.Router }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11957
11962
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GoogleService, providedIn: 'root' }); }
11958
11963
  }
11959
11964
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GoogleService, decorators: [{
@@ -11961,7 +11966,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11961
11966
  args: [{
11962
11967
  providedIn: 'root'
11963
11968
  }]
11964
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ToastService }, { type: JwtService }, { type: i4.Router }, { type: MixpanelService }, { type: undefined, decorators: [{
11969
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ToastService }, { type: JwtService }, { type: i4.Router }, { type: undefined, decorators: [{
11965
11970
  type: Inject,
11966
11971
  args: ['environment']
11967
11972
  }] }]; } });
@@ -12198,6 +12203,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12198
12203
  args: ['environment']
12199
12204
  }] }]; } });
12200
12205
 
12206
+ var EmployeeMessagesEnum;
12207
+ (function (EmployeeMessagesEnum) {
12208
+ EmployeeMessagesEnum["ROLE_GRANTED"] = "Manager role granted to ";
12209
+ EmployeeMessagesEnum["ROLE_REMOVED"] = "Manager role took away from ";
12210
+ EmployeeMessagesEnum["CONFIRM_GRANT"] = "Are you sure you want to make this user manager?";
12211
+ EmployeeMessagesEnum["CONFIRM_REMOVE"] = "Are you sure you want to remove manager right from this user?";
12212
+ EmployeeMessagesEnum["CONFIRM_DEACTIVATE"] = "Are you sure you want to deactivate the employee account?";
12213
+ EmployeeMessagesEnum["CONFIRM_ACTIVATE"] = "Are you sure you want to activate the employee account?";
12214
+ EmployeeMessagesEnum["ACTIVATED"] = "Employee account activated";
12215
+ EmployeeMessagesEnum["DEACTIVATED"] = "Employee account deactivated";
12216
+ EmployeeMessagesEnum["DEACTIVATE_ERROR"] = "All clients must be transferred prior to removing an accountant";
12217
+ })(EmployeeMessagesEnum || (EmployeeMessagesEnum = {}));
12218
+
12219
+ class EmployeeService extends RestService$1 {
12220
+ constructor() {
12221
+ super(...arguments);
12222
+ this.endpointUri = 'employees';
12223
+ this.modelClass = User;
12224
+ this.collectionClass = (Collection);
12225
+ this.disabledMethods = ['postBatch', 'putBatch'];
12226
+ this.messages = EmployeeMessagesEnum;
12227
+ }
12228
+ activateEmployee(employee) {
12229
+ return super.put(employee, `${this.environment.apiV2}/${this.endpointUri}/${employee.id}/activate`);
12230
+ }
12231
+ deactivateEmployee(employee) {
12232
+ return super.put(employee, `${this.environment.apiV2}/${this.endpointUri}/${employee.id}/deactivate`)
12233
+ .pipe(catchError((error) => {
12234
+ // Show error when user provided another login (not login he used before)
12235
+ if (error.status === 400) {
12236
+ this.toastService.error(this.messages.DEACTIVATE_ERROR);
12237
+ }
12238
+ return throwError(error);
12239
+ }));
12240
+ }
12241
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
12242
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeService, providedIn: 'root' }); }
12243
+ }
12244
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeService, decorators: [{
12245
+ type: Injectable,
12246
+ args: [{
12247
+ providedIn: 'root'
12248
+ }]
12249
+ }] });
12250
+
12251
+ class EmployeeInvite extends EmployeeInvite$1 {
12252
+ }
12253
+ __decorate([
12254
+ Type(() => RegistrationInvite)
12255
+ ], EmployeeInvite.prototype, "registrationInvite", void 0);
12256
+ __decorate([
12257
+ Type(() => User)
12258
+ ], EmployeeInvite.prototype, "employee", void 0);
12259
+
12201
12260
  /**
12202
12261
  * Abstract base service that implements common services functionality
12203
12262
  * and describe abstract methods/properties that have to be implemented in child services
@@ -12241,7 +12300,7 @@ class RestService {
12241
12300
  if (!this.cache) {
12242
12301
  this.fetch(path).pipe(first$1()).subscribe();
12243
12302
  }
12244
- return this.cacheSubject.asObservable();
12303
+ return this.getCacheSubjectObservable();
12245
12304
  }
12246
12305
  /**
12247
12306
  * get instance by id from cache
@@ -12402,6 +12461,12 @@ class RestService {
12402
12461
  updateCache() {
12403
12462
  this.cacheSubject.next(this.cache.slice());
12404
12463
  }
12464
+ /**
12465
+ * perform a shallow copy of the emitted data to make it immutable
12466
+ */
12467
+ getCacheSubjectObservable() {
12468
+ return this.cacheSubject.asObservable().pipe(map((cache) => cache.slice()));
12469
+ }
12405
12470
  /**
12406
12471
  * @TODO use excludeExtraneousValues when all models refactored (exposed all needed properties)
12407
12472
  * Create new instance of class
@@ -12423,88 +12488,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12423
12488
  args: ['environment']
12424
12489
  }] }]; } });
12425
12490
 
12426
- var EmployeeMessagesEnum;
12427
- (function (EmployeeMessagesEnum) {
12428
- EmployeeMessagesEnum["ROLE_GRANTED"] = "Manager role granted to ";
12429
- EmployeeMessagesEnum["ROLE_REMOVED"] = "Manager role took away from ";
12430
- EmployeeMessagesEnum["CONFIRM_GRANT"] = "Are you sure you want to make this user manager?";
12431
- EmployeeMessagesEnum["CONFIRM_REMOVE"] = "Are you sure you want to remove manager right from this user?";
12432
- EmployeeMessagesEnum["CONFIRM_DEACTIVATE"] = "Are you sure you want to deactivate the employee account?";
12433
- EmployeeMessagesEnum["CONFIRM_ACTIVATE"] = "Are you sure you want to activate the employee account?";
12434
- EmployeeMessagesEnum["ACTIVATED"] = "Employee account activated";
12435
- EmployeeMessagesEnum["DEACTIVATED"] = "Employee account deactivated";
12436
- EmployeeMessagesEnum["DEACTIVATE_ERROR"] = "All clients must be transferred prior to removing an accountant";
12437
- })(EmployeeMessagesEnum || (EmployeeMessagesEnum = {}));
12438
-
12439
- class EmployeeService extends RestService {
12440
- constructor() {
12441
- super(...arguments);
12442
- this.url = 'employees';
12443
- this.modelClass = User;
12444
- this.messages = EmployeeMessagesEnum;
12445
- }
12446
- /**
12447
- * Grant/Remove Manager role to employee
12448
- * @param employee
12449
- */
12450
- toggleManagerRole(employee) {
12451
- return this.http.put(`${this.environment.apiV2}/${this.url}/${employee.id}`, {})
12452
- .pipe(map((updatedEmployeeBase) => {
12453
- const tempCache = this.cache;
12454
- const updatedEmployee = plainToClass(User, updatedEmployeeBase);
12455
- replace(tempCache, updatedEmployee);
12456
- this.cache = _.cloneDeep(tempCache);
12457
- this.updateCache();
12458
- return updatedEmployee;
12459
- }));
12460
- }
12461
- activateEmployee(employee, path = `${this.environment.apiV2}/${this.url}/${employee.id}/activate`) {
12462
- return this.http.put(path, {})
12463
- .pipe(map((updatedEmployeeBase) => {
12464
- const tempCache = this.cache;
12465
- const updatedEmployee = plainToClass(User, updatedEmployeeBase);
12466
- replace(tempCache, updatedEmployee);
12467
- this.cache = _.cloneDeep(tempCache);
12468
- this.updateCache();
12469
- return updatedEmployee;
12470
- }));
12471
- }
12472
- deactivateEmployee(employee, path = `${this.environment.apiV2}/${this.url}/${employee.id}/deactivate`) {
12473
- return this.http.put(path, {})
12474
- .pipe(map((updatedEmployeeBase) => {
12475
- const tempCache = this.cache;
12476
- const updatedEmployee = plainToClass(User, updatedEmployeeBase);
12477
- replace(tempCache, updatedEmployee);
12478
- this.cache = _.cloneDeep(tempCache);
12479
- this.updateCache();
12480
- return updatedEmployee;
12481
- }), catchError((error) => {
12482
- // Show error when user provided another login (not login he used before)
12483
- if (error.status === 400) {
12484
- this.toastService.error(this.messages.DEACTIVATE_ERROR);
12485
- }
12486
- return throwError(error);
12487
- }));
12488
- }
12489
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
12490
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeService, providedIn: 'root' }); }
12491
- }
12492
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeService, decorators: [{
12493
- type: Injectable,
12494
- args: [{
12495
- providedIn: 'root'
12496
- }]
12497
- }] });
12498
-
12499
- class EmployeeInvite extends EmployeeInvite$1 {
12500
- }
12501
- __decorate([
12502
- Type(() => RegistrationInvite)
12503
- ], EmployeeInvite.prototype, "registrationInvite", void 0);
12504
- __decorate([
12505
- Type(() => User)
12506
- ], EmployeeInvite.prototype, "employee", void 0);
12507
-
12508
12491
  class EmployeeInviteService extends RestService {
12509
12492
  constructor() {
12510
12493
  super(...arguments);
@@ -17929,7 +17912,7 @@ class AccountSetupService {
17929
17912
  batch.push(
17930
17913
  // Invite team item is completed when firm has employees except firm owner or firm has invited employees.
17931
17914
  this.setItemStatus(this.items.findBy('isInviteTeam', true), combineLatest([
17932
- this.employeeService.get(),
17915
+ this.employeeService.getArray(),
17933
17916
  this.employeeInviteService.get()
17934
17917
  ]).pipe(map(([employees, invites]) => {
17935
17918
  // we always have at least 1 employee (firm owner), so we should check other employees except firm owner
@@ -20702,7 +20685,7 @@ class UniqueEmailValidator {
20702
20685
  this.userService = userService;
20703
20686
  }
20704
20687
  validate(control) {
20705
- return this.userService.search(control.value).pipe(delay(500), map((user) => user ? { emailIsUsed: true } : null), catchError(() => of(null)));
20688
+ return control.valueChanges.pipe(debounceTime(500), distinctUntilChanged(), switchMap((value) => this.userService.search(value)), map((user) => (user ? { emailIsUsed: true } : null)), catchError(() => of(null)));
20706
20689
  }
20707
20690
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UniqueEmailValidator, deps: [{ token: UserService }], target: i0.ɵɵFactoryTarget.Injectable }); }
20708
20691
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UniqueEmailValidator, providedIn: 'root' }); }