taxtank-core 0.31.8 → 0.31.9
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/account-setup/account-setup.service.mjs +17 -39
- package/esm2020/lib/services/http/subscription/service-subscription/subscription.service.mjs +2 -2
- package/fesm2015/taxtank-core.mjs +14 -25
- package/fesm2015/taxtank-core.mjs.map +1 -1
- package/fesm2020/taxtank-core.mjs +14 -25
- package/fesm2020/taxtank-core.mjs.map +1 -1
- package/lib/services/account-setup/account-setup.service.d.ts +5 -18
- package/package.json +1 -1
|
@@ -34,7 +34,6 @@ import { NavigationEnd } from '@angular/router';
|
|
|
34
34
|
import _ from 'lodash';
|
|
35
35
|
import merge from 'lodash/merge';
|
|
36
36
|
import { loadStripe } from '@stripe/stripe-js';
|
|
37
|
-
import fromPairs from 'lodash/fromPairs';
|
|
38
37
|
import { jsPDF } from 'jspdf';
|
|
39
38
|
import { applyPlugin } from 'jspdf-autotable';
|
|
40
39
|
import html2pdf from 'html2pdf.js';
|
|
@@ -13872,7 +13871,7 @@ class SubscriptionService extends RestService$1 {
|
|
|
13872
13871
|
// @TODO vik test and remove
|
|
13873
13872
|
setTimeout(() => {
|
|
13874
13873
|
this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED, null));
|
|
13875
|
-
this.toastService.success('Subscription successfully updated');
|
|
13874
|
+
this.toastService.success('Subscription successfully updated!!!');
|
|
13876
13875
|
}, 2000);
|
|
13877
13876
|
});
|
|
13878
13877
|
}
|
|
@@ -17777,8 +17776,7 @@ const ACCOUNT_SETUP_ITEMS = {
|
|
|
17777
17776
|
* Checks required steps and their completion
|
|
17778
17777
|
*/
|
|
17779
17778
|
class AccountSetupService {
|
|
17780
|
-
constructor(
|
|
17781
|
-
this.clientIncomeTypesService = clientIncomeTypesService;
|
|
17779
|
+
constructor(propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService, transactionService, soleBusinessService, holdingService, userService) {
|
|
17782
17780
|
this.propertyService = propertyService;
|
|
17783
17781
|
this.incomeSourceService = incomeSourceService;
|
|
17784
17782
|
this.bankAccountsService = bankAccountsService;
|
|
@@ -17796,12 +17794,10 @@ class AccountSetupService {
|
|
|
17796
17794
|
get() {
|
|
17797
17795
|
if (!this.cache) {
|
|
17798
17796
|
this.cache = new AccountSetupItemCollection([]);
|
|
17799
|
-
this.
|
|
17800
|
-
.
|
|
17801
|
-
this.
|
|
17802
|
-
|
|
17803
|
-
}))
|
|
17804
|
-
.subscribe((items) => {
|
|
17797
|
+
this.userService.getFirst().pipe(mergeMap((user) => {
|
|
17798
|
+
this.user = user;
|
|
17799
|
+
return this.createBatch();
|
|
17800
|
+
})).subscribe((items) => {
|
|
17805
17801
|
switch (true) {
|
|
17806
17802
|
case !this.cache:
|
|
17807
17803
|
case this.cache.filterBy('isCompleted', true).length !== items.filterBy('isCompleted', true).length:
|
|
@@ -17813,12 +17809,6 @@ class AccountSetupService {
|
|
|
17813
17809
|
}
|
|
17814
17810
|
return this.cacheSubject.asObservable();
|
|
17815
17811
|
}
|
|
17816
|
-
/**
|
|
17817
|
-
* Prepare client income types to update to hide depended account setup items
|
|
17818
|
-
*/
|
|
17819
|
-
prepareIncomeTypes(item) {
|
|
17820
|
-
return plainToClass(ClientIncomeTypes, Object.assign({ id: this.clientIncomeTypesId }, fromPairs(item.clientIncomeTypes.map((type) => [type, false]))));
|
|
17821
|
-
}
|
|
17822
17812
|
/**
|
|
17823
17813
|
* Get a single AccountSetupItem and check it's completion
|
|
17824
17814
|
*/
|
|
@@ -17838,28 +17828,27 @@ class AccountSetupService {
|
|
|
17838
17828
|
* Get batch of requests to get list of required AccountSetupItem's.
|
|
17839
17829
|
* Some items are optional and depends of user's client income types
|
|
17840
17830
|
*/
|
|
17841
|
-
createBatch(
|
|
17831
|
+
createBatch() {
|
|
17842
17832
|
const batch = [];
|
|
17843
|
-
const user = this.userService.getCacheFirst();
|
|
17844
17833
|
// Salary item is completed when user added salary income source
|
|
17845
|
-
if (
|
|
17834
|
+
if (this.user.hasRoles(UserRolesEnum.WORK_TANK)) {
|
|
17846
17835
|
batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSources(true)),
|
|
17847
17836
|
// Other income is a part of work tank, completed when user added at least one other income source
|
|
17848
17837
|
this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSources()));
|
|
17849
17838
|
}
|
|
17850
17839
|
// Rental income item is completed when user added at least one property
|
|
17851
|
-
if (
|
|
17840
|
+
if (this.user.hasRoles(UserRolesEnum.PROPERTY_TANK)) {
|
|
17852
17841
|
batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.getArray()));
|
|
17853
17842
|
}
|
|
17854
17843
|
// Sole business item is completed when user added at least one business
|
|
17855
|
-
if (
|
|
17844
|
+
if (this.user.hasRoles(UserRolesEnum.SOLE_TANK)) {
|
|
17856
17845
|
batch.push(this.create(AccountSetupItemsEnum.SOLE_BUSINESS, this.soleBusinessService.get()));
|
|
17857
17846
|
}
|
|
17858
17847
|
// holdings item is completed when user added at least one holding
|
|
17859
|
-
if (
|
|
17848
|
+
if (this.user.hasRoles(UserRolesEnum.HOLDING_TANK)) {
|
|
17860
17849
|
batch.push(this.create(AccountSetupItemsEnum.HOLDINGS, this.holdingService.getArray()));
|
|
17861
17850
|
}
|
|
17862
|
-
if (
|
|
17851
|
+
if (this.user.hasRoles([UserRolesEnum.WORK_TANK, UserRolesEnum.PROPERTY_TANK, UserRolesEnum.SOLE_TANK, UserRolesEnum.HOLDING_TANK])) {
|
|
17863
17852
|
// Bank feeds item is completed when user added at least one bank account (basiq or manual)
|
|
17864
17853
|
batch.push(this.getBankFeedsItem());
|
|
17865
17854
|
// Logbook item is completed when user has at least one vehicle claim with any method (kms or logbook)
|
|
@@ -17908,14 +17897,14 @@ class AccountSetupService {
|
|
|
17908
17897
|
return this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.getArray());
|
|
17909
17898
|
}
|
|
17910
17899
|
}
|
|
17911
|
-
AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AccountSetupService, deps: [{ token:
|
|
17900
|
+
AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AccountSetupService, deps: [{ token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }, { token: TransactionService }, { token: SoleBusinessService }, { token: HoldingService }, { token: UserService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
17912
17901
|
AccountSetupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AccountSetupService, providedIn: 'root' });
|
|
17913
17902
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AccountSetupService, decorators: [{
|
|
17914
17903
|
type: Injectable,
|
|
17915
17904
|
args: [{
|
|
17916
17905
|
providedIn: 'root'
|
|
17917
17906
|
}]
|
|
17918
|
-
}], ctorParameters: function () { return [{ type:
|
|
17907
|
+
}], ctorParameters: function () { return [{ type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }, { type: TransactionService }, { type: SoleBusinessService }, { type: HoldingService }, { type: UserService }]; } });
|
|
17919
17908
|
|
|
17920
17909
|
/**
|
|
17921
17910
|
* Service to work with Rewardful (affiliate program) API
|