taxtank-core 0.32.58 → 0.32.59

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.
@@ -10845,7 +10845,7 @@ let RestService$1 = class RestService extends DataService {
10845
10845
  return this.get().pipe(map((collection) => collection.first));
10846
10846
  }
10847
10847
  hasInCache(id) {
10848
- return !!this.getCache().findBy('id', id);
10848
+ return !!this.getCache()?.findBy('id', id);
10849
10849
  }
10850
10850
  getArray() {
10851
10851
  return this.get().pipe(map((collection) => collection.toArray()));
@@ -11013,7 +11013,7 @@ let RestService$1 = class RestService extends DataService {
11013
11013
  * Listen for Server-Sent Events (SSE) on the specified Mercure topic
11014
11014
  */
11015
11015
  listenSSE() {
11016
- if (!this.mercureTopic || !this.cache) {
11016
+ if (!this.mercureTopic) {
11017
11017
  return;
11018
11018
  }
11019
11019
  this.sseService.on(this.mercureTopic).pipe(map((response) => {
@@ -12222,9 +12222,11 @@ class ClientInviteService extends RestService$1 {
12222
12222
  resend(invite) {
12223
12223
  // cant use parent method because of custom specific handler
12224
12224
  return this.http.post(`${this.apiUrl}/${invite.id}/resend`, null)
12225
- .pipe(map((inviteBase) => plainToClass(ClientInvite, inviteBase)), map((resentInvite) =>
12226
- // this.handleResponse([resentInvite], 'put');
12227
- resentInvite));
12225
+ .pipe(map((inviteBase) => {
12226
+ const resentInvite = plainToClass(ClientInvite, inviteBase);
12227
+ this.handleResponse([resentInvite], 'put');
12228
+ return resentInvite;
12229
+ }));
12228
12230
  }
12229
12231
  /**
12230
12232
  * Send invitation from client to firm
@@ -12365,8 +12367,8 @@ class EmployeeService extends RestService$1 {
12365
12367
  this.endpointUri = 'employees';
12366
12368
  this.modelClass = User;
12367
12369
  this.collectionClass = (Collection);
12368
- this.disabledMethods = ['postBatch', 'putBatch'];
12369
12370
  this.messages = EmployeeMessagesEnum;
12371
+ this.roles = [UserRolesEnum.FIRM_MANAGER];
12370
12372
  }
12371
12373
  activateEmployee(employee) {
12372
12374
  return super.put(employee, `${this.environment.apiV2}/${this.endpointUri}/${employee.id}/activate`);
@@ -12400,6 +12402,139 @@ __decorate([
12400
12402
  Type(() => User)
12401
12403
  ], EmployeeInvite.prototype, "employee", void 0);
12402
12404
 
12405
+ class EmployeeInviteService extends RestService$1 {
12406
+ constructor() {
12407
+ super(...arguments);
12408
+ this.endpointUri = 'employees/invites';
12409
+ this.collectionClass = (Collection);
12410
+ this.disabledMethods = ['postBatch', 'putBatch'];
12411
+ this.modelClass = EmployeeInvite;
12412
+ this.roles = [UserRolesEnum.FIRM_MANAGER];
12413
+ }
12414
+ /**
12415
+ * Import employees for firm from CSV file
12416
+ * @param file
12417
+ */
12418
+ import(file) {
12419
+ const formData = new FormData();
12420
+ formData.append('file', file);
12421
+ return this.http.post(`${this.environment.apiV2}/${this.endpointUri}/import`, formData)
12422
+ .pipe(map((employeeInvite) => employeeInvite));
12423
+ }
12424
+ /**
12425
+ * Resend invitation from firm to client
12426
+ * @param invite
12427
+ */
12428
+ resend(invite) {
12429
+ return this.http.post(`${this.environment.apiV2}/${this.endpointUri}/${invite.id}/resend`, null)
12430
+ .pipe(map((resentInviteBase) => {
12431
+ const updatedInvite = plainToClass(EmployeeInvite, resentInviteBase);
12432
+ this.handleResponse([updatedInvite], 'put');
12433
+ return updatedInvite;
12434
+ }));
12435
+ }
12436
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeInviteService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
12437
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeInviteService, providedIn: 'root' }); }
12438
+ }
12439
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeInviteService, decorators: [{
12440
+ type: Injectable,
12441
+ args: [{
12442
+ providedIn: 'root'
12443
+ }]
12444
+ }] });
12445
+
12446
+ // @Todo refactor with BaseRest service
12447
+ /**
12448
+ * Service to work with employee clients tax summary data
12449
+ */
12450
+ class ClientPortfolioReportService {
12451
+ constructor(http, environment) {
12452
+ this.http = http;
12453
+ this.environment = environment;
12454
+ this.url = 'portfolio-reports';
12455
+ }
12456
+ get() {
12457
+ return this.http.get(`${this.environment.apiV2}/${this.url}`)
12458
+ .pipe(map((response) => {
12459
+ const clientReports = response.map((item) => plainToClass(ClientPortfolioReport, item));
12460
+ return new ClientPortfolioReportCollection(clientReports);
12461
+ }));
12462
+ }
12463
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientPortfolioReportService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12464
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientPortfolioReportService, providedIn: 'root' }); }
12465
+ }
12466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientPortfolioReportService, decorators: [{
12467
+ type: Injectable,
12468
+ args: [{
12469
+ providedIn: 'root'
12470
+ }]
12471
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
12472
+ type: Inject,
12473
+ args: ['environment']
12474
+ }] }]; } });
12475
+
12476
+ var FirmMessagesEnum;
12477
+ (function (FirmMessagesEnum) {
12478
+ FirmMessagesEnum["LOGO_UPDATED"] = "Firm logo updated";
12479
+ FirmMessagesEnum["DATA_UPDATED"] = "Firm data updated";
12480
+ })(FirmMessagesEnum || (FirmMessagesEnum = {}));
12481
+
12482
+ // @TODO Alex: think about extend base rest service
12483
+ class FirmService {
12484
+ constructor(http, environment) {
12485
+ this.http = http;
12486
+ this.environment = environment;
12487
+ this.firmSubject = new ReplaySubject(1);
12488
+ }
12489
+ /**
12490
+ * Register new firm
12491
+ * @param data: firm and firm owner data to register
12492
+ */
12493
+ register(data) {
12494
+ return this.http.post(`${this.environment.apiV2}/firms/registration`, data)
12495
+ .pipe(map((firm) => plainToClass(Firm, firm)));
12496
+ }
12497
+ get() {
12498
+ if (!this.firm) {
12499
+ this.http.get(`${this.environment.apiV2}/firms/current`)
12500
+ .pipe(map((firm) => plainToClass(Firm, firm)))
12501
+ .subscribe((firm) => {
12502
+ this.firm = firm;
12503
+ this.firmSubject.next(this.firm);
12504
+ });
12505
+ }
12506
+ return this.firmSubject.asObservable();
12507
+ }
12508
+ update(firm) {
12509
+ return this.http.put(`${this.environment.apiV2}/firms/current`, firm)
12510
+ .pipe(map((updatedItem) => {
12511
+ const updatedInstance = plainToClass(Firm, updatedItem);
12512
+ this.firmSubject.next(updatedInstance);
12513
+ }));
12514
+ }
12515
+ /**
12516
+ * get list of all registered firms
12517
+ */
12518
+ getAll() {
12519
+ return this.http.get(`${this.environment.apiV2}/firms`)
12520
+ .pipe(map((response) => response.map((firmBase) => plainToClass(Firm, firmBase))));
12521
+ }
12522
+ getByType(type) {
12523
+ return this.getAll().pipe(map((firms) => firms.filter((firm) => firm.type === type)));
12524
+ }
12525
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FirmService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12526
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FirmService, providedIn: 'root' }); }
12527
+ }
12528
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FirmService, decorators: [{
12529
+ type: Injectable,
12530
+ args: [{
12531
+ providedIn: 'root'
12532
+ }]
12533
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
12534
+ type: Inject,
12535
+ args: ['environment']
12536
+ }] }]; } });
12537
+
12403
12538
  /**
12404
12539
  * Abstract base service that implements common services functionality
12405
12540
  * and describe abstract methods/properties that have to be implemented in child services
@@ -12631,141 +12766,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12631
12766
  args: ['environment']
12632
12767
  }] }]; } });
12633
12768
 
12634
- class EmployeeInviteService extends RestService {
12635
- constructor() {
12636
- super(...arguments);
12637
- this.url = 'employees/invites';
12638
- this.modelClass = EmployeeInvite;
12639
- }
12640
- /**
12641
- * Import employees for firm from CSV file
12642
- * @param file
12643
- */
12644
- import(file) {
12645
- const formData = new FormData();
12646
- formData.append('file', file);
12647
- return this.http.post(`${this.environment.apiV2}/${this.url}/import`, formData)
12648
- .pipe(map((employeeInvite) => employeeInvite));
12649
- }
12650
- /**
12651
- * Resend invitation from firm to client
12652
- * @param invite
12653
- */
12654
- resend(invite) {
12655
- return this.http.post(`${this.environment.apiV2}/${this.url}/${invite.id}/resend`, null)
12656
- .pipe(map((resentInviteBase) => {
12657
- const updatedInvite = plainToClass(EmployeeInvite, resentInviteBase);
12658
- // avoid cache changes
12659
- // @TODO make cache readonly
12660
- const tempCache = _.cloneDeep(this.cache);
12661
- replace(tempCache, plainToClass(EmployeeInvite, updatedInvite));
12662
- this.cache = tempCache;
12663
- this.updateCache();
12664
- return updatedInvite;
12665
- }));
12666
- }
12667
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeInviteService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
12668
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeInviteService, providedIn: 'root' }); }
12669
- }
12670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EmployeeInviteService, decorators: [{
12671
- type: Injectable,
12672
- args: [{
12673
- providedIn: 'root'
12674
- }]
12675
- }] });
12676
-
12677
- // @Todo refactor with BaseRest service
12678
- /**
12679
- * Service to work with employee clients tax summary data
12680
- */
12681
- class ClientPortfolioReportService {
12682
- constructor(http, environment) {
12683
- this.http = http;
12684
- this.environment = environment;
12685
- this.url = 'portfolio-reports';
12686
- }
12687
- get() {
12688
- return this.http.get(`${this.environment.apiV2}/${this.url}`)
12689
- .pipe(map((response) => {
12690
- const clientReports = response.map((item) => plainToClass(ClientPortfolioReport, item));
12691
- return new ClientPortfolioReportCollection(clientReports);
12692
- }));
12693
- }
12694
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientPortfolioReportService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12695
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientPortfolioReportService, providedIn: 'root' }); }
12696
- }
12697
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientPortfolioReportService, decorators: [{
12698
- type: Injectable,
12699
- args: [{
12700
- providedIn: 'root'
12701
- }]
12702
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
12703
- type: Inject,
12704
- args: ['environment']
12705
- }] }]; } });
12706
-
12707
- var FirmMessagesEnum;
12708
- (function (FirmMessagesEnum) {
12709
- FirmMessagesEnum["LOGO_UPDATED"] = "Firm logo updated";
12710
- FirmMessagesEnum["DATA_UPDATED"] = "Firm data updated";
12711
- })(FirmMessagesEnum || (FirmMessagesEnum = {}));
12712
-
12713
- // @TODO Alex: think about extend base rest service
12714
- class FirmService {
12715
- constructor(http, environment) {
12716
- this.http = http;
12717
- this.environment = environment;
12718
- this.firmSubject = new ReplaySubject(1);
12719
- }
12720
- /**
12721
- * Register new firm
12722
- * @param data: firm and firm owner data to register
12723
- */
12724
- register(data) {
12725
- return this.http.post(`${this.environment.apiV2}/firms/registration`, data)
12726
- .pipe(map((firm) => plainToClass(Firm, firm)));
12727
- }
12728
- get() {
12729
- if (!this.firm) {
12730
- this.http.get(`${this.environment.apiV2}/firms/current`)
12731
- .pipe(map((firm) => plainToClass(Firm, firm)))
12732
- .subscribe((firm) => {
12733
- this.firm = firm;
12734
- this.firmSubject.next(this.firm);
12735
- });
12736
- }
12737
- return this.firmSubject.asObservable();
12738
- }
12739
- update(firm) {
12740
- return this.http.put(`${this.environment.apiV2}/firms/current`, firm)
12741
- .pipe(map((updatedItem) => {
12742
- const updatedInstance = plainToClass(Firm, updatedItem);
12743
- this.firmSubject.next(updatedInstance);
12744
- }));
12745
- }
12746
- /**
12747
- * get list of all registered firms
12748
- */
12749
- getAll() {
12750
- return this.http.get(`${this.environment.apiV2}/firms`)
12751
- .pipe(map((response) => response.map((firmBase) => plainToClass(Firm, firmBase))));
12752
- }
12753
- getByType(type) {
12754
- return this.getAll().pipe(map((firms) => firms.filter((firm) => firm.type === type)));
12755
- }
12756
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FirmService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12757
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FirmService, providedIn: 'root' }); }
12758
- }
12759
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FirmService, decorators: [{
12760
- type: Injectable,
12761
- args: [{
12762
- providedIn: 'root'
12763
- }]
12764
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
12765
- type: Inject,
12766
- args: ['environment']
12767
- }] }]; } });
12768
-
12769
12769
  /**
12770
12770
  * Service to work with Other Income Forecasts
12771
12771
  */
@@ -15073,8 +15073,10 @@ class YoutubeService {
15073
15073
  this.http = http;
15074
15074
  this.environment = environment;
15075
15075
  }
15076
- getTutorials() {
15077
- return this.http.get(`${YoutubeService.googleUrl}&playlistId=${this.environment.tutorialPlaylistId}&key=${this.environment.googleAPIKey}&maxResults=${YoutubeService.maxResults}`)
15076
+ getTutorials(user) {
15077
+ const playlistId = user.isClient() ? this.environment.playlistId
15078
+ : user.isAdvisor() ? this.environment.advisorPlaylistId : this.environment.accountantPlaylistId;
15079
+ return this.http.get(`${YoutubeService.googleUrl}&playlistId=${playlistId}&key=${this.environment.googleAPIKey}&maxResults=${YoutubeService.maxResults}`)
15078
15080
  .pipe(map((response) => response.items.map((item) => ({
15079
15081
  id: item.snippet.resourceId.videoId,
15080
15082
  title: item.snippet.title
@@ -18060,7 +18062,7 @@ class AccountSetupService {
18060
18062
  // Invite team item is completed when firm has employees except firm owner or firm has invited employees.
18061
18063
  this.setItemStatus(this.items.findBy('isInviteTeam', true), combineLatest([
18062
18064
  this.employeeService.getArray(),
18063
- this.employeeInviteService.get()
18065
+ this.employeeInviteService.getArray()
18064
18066
  ]).pipe(map(([employees, invites]) => {
18065
18067
  // we always have at least 1 employee (firm owner), so we should check other employees except firm owner
18066
18068
  if (employees.length) {