@zeniai/client-epic-state 5.2.71 → 5.2.72
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/lib/entity/aiCfo/aiCfoState.d.ts +2 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/invoicing/{product/productPayload.d.ts → invoicingCatalog/invoicingCatalogPayload.d.ts} +44 -6
- package/lib/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +50 -6
- package/lib/entity/invoicing/invoicingCatalog/invoicingCatalogReducer.d.ts +12 -0
- package/lib/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +20 -21
- package/lib/entity/invoicing/{plan/planSelector.d.ts → invoicingCatalog/invoicingCatalogSelector.d.ts} +5 -6
- package/lib/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +12 -12
- package/lib/entity/invoicing/{product/productState.d.ts → invoicingCatalog/invoicingCatalogState.d.ts} +42 -6
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +4 -4
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +10 -2
- package/lib/epic.d.ts +3 -2
- package/lib/epic.js +3 -1
- package/lib/esm/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +46 -3
- package/lib/esm/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +19 -20
- package/lib/esm/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +8 -8
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +10 -2
- package/lib/esm/epic.js +3 -1
- package/lib/esm/index.js +6 -9
- package/lib/esm/reducer.js +4 -7
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -1
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +9 -1
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +5 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +5 -1
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +8 -1
- package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +55 -22
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.js +1 -20
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +31 -11
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +2 -1
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +37 -0
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +21 -1
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/index.d.ts +11 -15
- package/lib/index.js +39 -45
- package/lib/reducer.d.ts +1 -2
- package/lib/reducer.js +4 -7
- package/lib/rootStateTypes.d.ts +3 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +3 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +8 -0
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +2 -2
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +8 -9
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts +3 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.d.ts +2 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +6 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +5 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.d.ts +3 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +9 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogListPageEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewPayload.d.ts +3 -3
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +33 -15
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +57 -23
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.d.ts +0 -15
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.js +0 -22
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +1 -1
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +31 -11
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +3 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +2 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +4 -0
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +5 -5
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +2 -2
- package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.d.ts +8 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +41 -0
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +22 -2
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -0
- package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +2 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.d.ts +2 -2
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +5 -5
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +2 -2
- package/package.json +1 -1
- package/lib/entity/invoicing/plan/planPayload.d.ts +0 -40
- package/lib/entity/invoicing/plan/planPayload.js +0 -51
- package/lib/entity/invoicing/plan/planReducer.d.ts +0 -14
- package/lib/entity/invoicing/plan/planState.d.ts +0 -43
- package/lib/entity/invoicing/product/productReducer.d.ts +0 -9
- package/lib/entity/invoicing/product/productReducer.js +0 -50
- package/lib/entity/invoicing/product/productSelector.d.ts +0 -4
- package/lib/entity/invoicing/product/productSelector.js +0 -17
- package/lib/entity/invoicing/product/productState.js +0 -2
- package/lib/esm/entity/invoicing/plan/planPayload.js +0 -47
- package/lib/esm/entity/invoicing/product/productReducer.js +0 -43
- package/lib/esm/entity/invoicing/product/productSelector.js +0 -10
- package/lib/esm/entity/invoicing/product/productState.js +0 -1
- /package/lib/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
- /package/lib/esm/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import { reduceAllFetchState } from '../../../commonStateTypes/reduceFetchState';
|
|
3
|
-
import {
|
|
3
|
+
import { getInvoicingCatalogItemById, getInvoicingCatalogItemsByIds, } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
|
|
4
4
|
import { getInvoicingConfigView, invoicingFieldHelpForGroup, } from '../invoicingConfigView/invoicingConfigViewSelector';
|
|
5
5
|
import { getInvoicingFormDraftLocalData, isInvoicingFormDraftPending, } from '../invoicingFormDraft';
|
|
6
6
|
import { INVOICING_DEFAULT_INCOME_ACCOUNT_TYPES, INVOICING_INCOME_ACCOUNT_MAPPING_SLOT, NO_INVOICING_ACCOUNT_HIERARCHY, NO_INVOICING_ACCOUNT_IDS, NO_INVOICING_CLASS_HIERARCHY, getInvoicingQboAccountOptions, getInvoicingQboView, invoicingQboAccountIdsForMappingSlot, isInvoicingAccountingPickerDataLoading, isInvoicingQboConnected, } from '../invoicingQboView/invoicingQboViewSelector';
|
|
@@ -36,7 +36,7 @@ const buildApplicableCatalogItemOptions = (plans) => {
|
|
|
36
36
|
* Kept referentially stable across unrelated dispatches; the form view filters
|
|
37
37
|
* out the item being edited (see `getInvoicingCatalogItemFormView`).
|
|
38
38
|
*/
|
|
39
|
-
export const getInvoicingApplicableCatalogItemOptions = createSelector((state) => state.
|
|
39
|
+
export const getInvoicingApplicableCatalogItemOptions = createSelector((state) => state.invoicingCatalogState, (state) => state.invoicingCatalogListViewState, (catalogState, listViewState) => buildApplicableCatalogItemOptions(getInvoicingCatalogItemsByIds(catalogState, [
|
|
40
40
|
...listViewState.planIds,
|
|
41
41
|
...listViewState.productIds,
|
|
42
42
|
])));
|
|
@@ -61,7 +61,9 @@ const getInvoicingCatalogIncomeAccountIds = createSelector([
|
|
|
61
61
|
: NO_INVOICING_ACCOUNT_IDS);
|
|
62
62
|
export const getInvoicingCatalogItemFormView = (state, id) => {
|
|
63
63
|
const { editDraftById, error, fetchState, newItemDraft, savedItemId, savedKind, } = state.editInvoicingCatalogItemDetailViewState;
|
|
64
|
-
const plan = id != null
|
|
64
|
+
const plan = id != null
|
|
65
|
+
? getInvoicingCatalogItemById(state.invoicingCatalogState, id)
|
|
66
|
+
: undefined;
|
|
65
67
|
const kind = plan != null ? 'plan' : undefined;
|
|
66
68
|
// No entity fallback: the draft is the one source of form values, seeded from
|
|
67
69
|
// the record by `seedInvoicingCatalogItemFormDraftEpic` when the detail load
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
3
|
+
import { updateInvoicingCatalogItems } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
5
|
import { fetchInvoicingCatalogItemDetail, updateInvoicingCatalogItemDetail, updateInvoicingCatalogItemDetailFailure, } from './editInvoicingCatalogItemDetailViewReducer';
|
|
6
6
|
export const fetchInvoicingCatalogItemDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingCatalogItemDetail.match), switchMap((action) => {
|
|
@@ -9,7 +9,7 @@ export const fetchInvoicingCatalogItemDetailEpic = (actions$, _state$, zeniAPI)
|
|
|
9
9
|
return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
|
|
10
10
|
if (isSuccessResponse(response) && response.data != null) {
|
|
11
11
|
return [
|
|
12
|
-
|
|
12
|
+
updateInvoicingCatalogItems([response.data], 'merge'),
|
|
13
13
|
updateInvoicingCatalogItemDetail({ id: response.data.id, kind }),
|
|
14
14
|
];
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
3
|
+
import { updateInvoicingCatalogItems } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
5
|
import { runInvoicingCatalogPlanAction, runInvoicingCatalogPlanActionFailure, runInvoicingCatalogPlanActionSuccess, } from './editInvoicingCatalogItemDetailViewReducer';
|
|
6
6
|
export const runInvoicingCatalogPlanActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingCatalogPlanAction.match), mergeMap((action) => {
|
|
@@ -12,7 +12,7 @@ export const runInvoicingCatalogPlanActionEpic = (actions$, _state$, zeniAPI) =>
|
|
|
12
12
|
.pipe(mergeMap((response) => {
|
|
13
13
|
if (isSuccessResponse(response) && response.data != null) {
|
|
14
14
|
return [
|
|
15
|
-
|
|
15
|
+
updateInvoicingCatalogItems([response.data], 'merge'),
|
|
16
16
|
runInvoicingCatalogPlanActionSuccess({ id }),
|
|
17
17
|
];
|
|
18
18
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
4
|
-
import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
|
|
3
|
+
import { mergeInvoicingCatalogPricePoint } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { runInvoicingCatalogProductAction, runInvoicingCatalogProductActionFailure, runInvoicingCatalogProductActionSuccess, } from './editInvoicingCatalogItemDetailViewReducer';
|
|
7
6
|
export const runInvoicingCatalogProductActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingCatalogProductAction.match), mergeMap((action) => {
|
|
@@ -16,9 +15,10 @@ export const runInvoicingCatalogProductActionEpic = (actions$, _state$, zeniAPI)
|
|
|
16
15
|
.pipe(mergeMap((response) => {
|
|
17
16
|
if (isSuccessResponse(response) && response.data != null) {
|
|
18
17
|
return [
|
|
19
|
-
updateInvoicingProducts([response.data], 'merge'),
|
|
20
18
|
...(parentItemId != null
|
|
21
|
-
? [
|
|
19
|
+
? [
|
|
20
|
+
mergeInvoicingCatalogPricePoint(parentItemId, response.data),
|
|
21
|
+
]
|
|
22
22
|
: []),
|
|
23
23
|
runInvoicingCatalogProductActionSuccess({ id: stateKey }),
|
|
24
24
|
];
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { forkJoin, from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
4
|
-
import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
|
|
3
|
+
import { mergeInvoicingCatalogPricePoint, updateInvoicingCatalogItems, } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
|
|
5
4
|
import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiError';
|
|
6
5
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
@@ -51,11 +50,8 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
51
50
|
}
|
|
52
51
|
const savedProducts = productResponses.flatMap((productResponse) => productResponse.data != null ? [productResponse.data] : []);
|
|
53
52
|
const resultActions = [
|
|
54
|
-
|
|
55
|
-
...
|
|
56
|
-
? [updateInvoicingProducts(savedProducts, 'merge')]
|
|
57
|
-
: []),
|
|
58
|
-
...savedProducts.map((product) => mergeInvoicingPlanSubFamily(savedItem.id, product)),
|
|
53
|
+
updateInvoicingCatalogItems([savedItem], 'merge'),
|
|
54
|
+
...savedProducts.map((product) => mergeInvoicingCatalogPricePoint(savedItem.id, product)),
|
|
59
55
|
submitInvoicingCatalogItemFormSuccess({
|
|
60
56
|
itemId: savedItem.id,
|
|
61
57
|
kind: 'plan',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EMPTY, of } from 'rxjs';
|
|
2
2
|
import { filter, mergeMap, withLatestFrom } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
3
|
+
import { getInvoicingCatalogItemById } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
|
|
4
4
|
import { fetchInvoicingCatalogItemDetailPage, seedInvoicingCatalogItemFormDraft, updateInvoicingCatalogItemDetail, } from './editInvoicingCatalogItemDetailViewReducer';
|
|
5
5
|
import { entityToInvoicingCatalogItemFormLocalData } from './invoicingCatalogItemFormHelper';
|
|
6
6
|
/**
|
|
@@ -34,7 +34,7 @@ export const seedInvoicingCatalogItemFormDraftEpic = (actions$, state$) => actio
|
|
|
34
34
|
}
|
|
35
35
|
// Nothing to seed from on a cold open; the detail response triggers this
|
|
36
36
|
// again once it lands.
|
|
37
|
-
const plan =
|
|
37
|
+
const plan = getInvoicingCatalogItemById(state.invoicingCatalogState, id);
|
|
38
38
|
if (plan == null) {
|
|
39
39
|
return EMPTY;
|
|
40
40
|
}
|
|
@@ -95,6 +95,10 @@ const editInvoicingCustomerDetailView = createSlice({
|
|
|
95
95
|
error: undefined,
|
|
96
96
|
};
|
|
97
97
|
},
|
|
98
|
+
// Makes the page epic refetch a record that changed server-side (e.g. a new subscription).
|
|
99
|
+
invalidateInvoicingCustomerDetail(draft, action) {
|
|
100
|
+
delete draft.recordStateById[action.payload.id];
|
|
101
|
+
},
|
|
98
102
|
fetchInvoicingCustomerDetail(draft, action) {
|
|
99
103
|
draft.recordStateById[action.payload.id] = {
|
|
100
104
|
fetchState: 'In-Progress',
|
|
@@ -198,5 +202,5 @@ const editInvoicingCustomerDetailView = createSlice({
|
|
|
198
202
|
});
|
|
199
203
|
},
|
|
200
204
|
});
|
|
201
|
-
export const { fetchInvoicingPaymentLinkEmailPreview, fetchInvoicingPaymentLinkEmailPreviewPage, updateInvoicingPaymentLinkEmailPreview, updateInvoicingPaymentLinkEmailPreviewFailure, addPromotionalCreditsFailure, addPromotionalCreditsSuccess, fetchInvoicingCustomerDetail, fetchInvoicingCustomerDetailPage, seedInvoicingCustomerFormDraft, updateInvoicingCustomerDetail, resetPromotionalCreditAction, submitAddPromotionalCredits, updateInvoicingCustomerDetailFailure, updateInvoicingCustomerFormDraft, submitInvoicingCustomerForm, submitInvoicingCustomerFormSuccess, submitInvoicingCustomerFormFailure, resetEditInvoicingCustomerDetailView, initializeInvoicingCustomerAddress, claimInvoicingCustomerBillingAddress, } = editInvoicingCustomerDetailView.actions;
|
|
205
|
+
export const { fetchInvoicingPaymentLinkEmailPreview, fetchInvoicingPaymentLinkEmailPreviewPage, updateInvoicingPaymentLinkEmailPreview, updateInvoicingPaymentLinkEmailPreviewFailure, addPromotionalCreditsFailure, addPromotionalCreditsSuccess, fetchInvoicingCustomerDetail, fetchInvoicingCustomerDetailPage, invalidateInvoicingCustomerDetail, seedInvoicingCustomerFormDraft, updateInvoicingCustomerDetail, resetPromotionalCreditAction, submitAddPromotionalCredits, updateInvoicingCustomerDetailFailure, updateInvoicingCustomerFormDraft, submitInvoicingCustomerForm, submitInvoicingCustomerFormSuccess, submitInvoicingCustomerFormFailure, resetEditInvoicingCustomerDetailView, initializeInvoicingCustomerAddress, claimInvoicingCustomerBillingAddress, } = editInvoicingCustomerDetailView.actions;
|
|
202
206
|
export default editInvoicingCustomerDetailView.reducer;
|
package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -7,6 +7,8 @@ import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiE
|
|
|
7
7
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
8
8
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
9
9
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
10
|
+
import { invalidateInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
|
|
11
|
+
import { invalidateInvoiceListForCustomer } from '../invoiceList/invoiceListReducer';
|
|
10
12
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
11
13
|
import { localDataToSaveInvoicingSubscriptionPayload, } from './editInvoicingSubscriptionDetailViewPayload';
|
|
12
14
|
import { submitInvoicingSubscriptionForm, submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
@@ -86,7 +88,9 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
86
88
|
resultActions.push(addInvoicingSubscriptionToList({
|
|
87
89
|
id: saved.id,
|
|
88
90
|
status: saved.status,
|
|
89
|
-
})
|
|
91
|
+
}),
|
|
92
|
+
// The service may bill the first invoice on create.
|
|
93
|
+
invalidateInvoicingCustomerDetail({ id: saved.customer_id }), invalidateInvoiceListForCustomer({ customerId: saved.customer_id }));
|
|
90
94
|
}
|
|
91
95
|
resultActions.push(openSnackbar({
|
|
92
96
|
messageSection: 'invoicing_subscription_saved',
|
|
@@ -124,6 +124,13 @@ const invoiceList = createSlice({
|
|
|
124
124
|
draft.kpisFetchState.fetchState = 'Error';
|
|
125
125
|
draft.kpisFetchState.error = action.payload;
|
|
126
126
|
},
|
|
127
|
+
// Counts are fetched under the same customer filter, so they go stale with the tabs.
|
|
128
|
+
invalidateInvoiceListForCustomer(draft, action) {
|
|
129
|
+
if (draft.filters.customerId === action.payload.customerId) {
|
|
130
|
+
draft.invoiceByTab = makeInvoiceByTab();
|
|
131
|
+
draft.countsFetchState = { fetchState: 'Not-Started', error: undefined };
|
|
132
|
+
}
|
|
133
|
+
},
|
|
127
134
|
updateInvoiceListFilters(draft, action) {
|
|
128
135
|
draft.filters = action.payload;
|
|
129
136
|
},
|
|
@@ -166,5 +173,5 @@ const invoiceList = createSlice({
|
|
|
166
173
|
});
|
|
167
174
|
},
|
|
168
175
|
});
|
|
169
|
-
export const { fetchInvoiceList, fetchInvoiceListPage, updateInvoiceList, updateInvoiceListFailure, fetchInvoiceCounts, updateInvoiceCounts, updateInvoiceCountsFailure, fetchInvoiceKPIs, updateInvoiceKPIs, updateInvoiceKPIsFailure, updateInvoiceListFilters, setInvoiceActiveTab, addInvoiceToList, } = invoiceList.actions;
|
|
176
|
+
export const { fetchInvoiceList, fetchInvoiceListPage, updateInvoiceList, updateInvoiceListFailure, fetchInvoiceCounts, updateInvoiceCounts, updateInvoiceCountsFailure, fetchInvoiceKPIs, updateInvoiceKPIs, updateInvoiceKPIsFailure, updateInvoiceListFilters, setInvoiceActiveTab, addInvoiceToList, invalidateInvoiceListForCustomer, } = invoiceList.actions;
|
|
170
177
|
export default invoiceList.reducer;
|
package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
3
|
+
import { updateInvoicingCatalogItems } from '../../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
5
|
import { INVOICING_LIST_PAGE_SIZE, applyListSortParams, withQuery, } from '../../invoicingApiHelper';
|
|
6
6
|
import { fetchInvoicingCatalogPlanList, updateInvoicingCatalogPlanList, updateInvoicingCatalogPlanListFailure, } from '../invoicingCatalogListViewReducer';
|
|
@@ -29,7 +29,7 @@ export const fetchInvoicingCatalogPlanListEpic = (actions$, _state$, zeniAPI) =>
|
|
|
29
29
|
if (isSuccessResponse(response)) {
|
|
30
30
|
const items = response.data?.items ?? [];
|
|
31
31
|
return [
|
|
32
|
-
|
|
32
|
+
updateInvoicingCatalogItems(items, 'merge'),
|
|
33
33
|
updateInvoicingCatalogPlanList({
|
|
34
34
|
ids: items.map((item) => item.id),
|
|
35
35
|
nextCursor: response.data?.next_cursor ?? null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
3
|
+
import { updateInvoicingCatalogItems } from '../../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
5
|
import { INVOICING_LIST_PAGE_SIZE, applyListSortParams, withQuery, } from '../../invoicingApiHelper';
|
|
6
6
|
import { fetchInvoicingCatalogProductList, updateInvoicingCatalogProductList, updateInvoicingCatalogProductListFailure, } from '../invoicingCatalogListViewReducer';
|
|
@@ -29,7 +29,7 @@ export const fetchInvoicingCatalogProductListEpic = (actions$, _state$, zeniAPI)
|
|
|
29
29
|
if (isSuccessResponse(response)) {
|
|
30
30
|
const items = response.data?.items ?? [];
|
|
31
31
|
return [
|
|
32
|
-
|
|
32
|
+
updateInvoicingCatalogItems(items, 'merge'),
|
|
33
33
|
updateInvoicingCatalogProductList({
|
|
34
34
|
ids: items.map((item) => item.id),
|
|
35
35
|
nextCursor: response.data?.next_cursor ?? null,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
|
-
import {
|
|
3
|
-
import { runningInvoicingActionId } from '../runningInvoicingActionId';
|
|
4
|
-
import { INVOICING_PRODUCT_COLUMNS, } from './invoicingCatalogListViewState';
|
|
2
|
+
import { getInvoicingCatalogItemsByIds, invoicingPricePointDisplayAmount, } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
|
|
5
3
|
/**
|
|
6
4
|
* Flatten catalog items into the price rows the pickers render.
|
|
7
5
|
*
|
|
@@ -22,28 +20,63 @@ export const getInvoicingCatalogPrices = (items) => items.flatMap((item) => (ite
|
|
|
22
20
|
priceCode: subFamily.priceCode,
|
|
23
21
|
productCode: item.productCode,
|
|
24
22
|
})));
|
|
23
|
+
const lowestStartingTier = (tiers) => tiers.reduce((lowest, tier) => lowest == null || tier.startingUnit < lowest.startingUnit ? tier : lowest, undefined);
|
|
24
|
+
export const getInvoicingCatalogPlanRows = (items) => items.flatMap((item) => {
|
|
25
|
+
const pricePoints = item.subFamilies ?? [];
|
|
26
|
+
if (pricePoints.length === 0) {
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
id: item.id,
|
|
30
|
+
item,
|
|
31
|
+
period: item.period,
|
|
32
|
+
periodUnit: item.periodUnit,
|
|
33
|
+
price: item.price,
|
|
34
|
+
productFamily: item.name,
|
|
35
|
+
status: item.status,
|
|
36
|
+
tierCount: item.tiers?.length ?? 0,
|
|
37
|
+
firstTier: lowestStartingTier(item.tiers ?? []),
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
return pricePoints.map((pricePoint) => ({
|
|
42
|
+
id: pricePoint.id,
|
|
43
|
+
item,
|
|
44
|
+
period: pricePoint.period,
|
|
45
|
+
periodUnit: pricePoint.periodUnit,
|
|
46
|
+
planName: pricePoint.name,
|
|
47
|
+
price: invoicingPricePointDisplayAmount(pricePoint),
|
|
48
|
+
pricingModel: pricePoint.pricingModel,
|
|
49
|
+
productFamily: item.name,
|
|
50
|
+
status: pricePoint.status,
|
|
51
|
+
tierCount: pricePoint.tiers?.length ?? 0,
|
|
52
|
+
firstTier: lowestStartingTier(pricePoint.tiers ?? []),
|
|
53
|
+
}));
|
|
54
|
+
});
|
|
25
55
|
/**
|
|
26
56
|
* Bundled read view for the single catalog page (plans + products tabs).
|
|
27
57
|
* Memoized over the plan + product entity slices and the list-view slice so the
|
|
28
58
|
* denormalized arrays keep referential identity. The base `fetchState`/`error`
|
|
29
59
|
* track the plan list; the product list has its own `productFetchState`.
|
|
30
60
|
*/
|
|
31
|
-
export const getInvoicingCatalogListView = createSelector((state) => state.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
export const getInvoicingCatalogListView = createSelector((state) => state.invoicingCatalogState, (state) => state.invoicingCatalogListViewState, (catalogState, listViewState) => {
|
|
62
|
+
const plans = getInvoicingCatalogItemsByIds(catalogState, listViewState.planIds);
|
|
63
|
+
const products = getInvoicingCatalogItemsByIds(catalogState, listViewState.productIds);
|
|
64
|
+
return {
|
|
65
|
+
planRows: getInvoicingCatalogPlanRows(plans),
|
|
66
|
+
plans,
|
|
67
|
+
planSort: listViewState.planSort,
|
|
68
|
+
productRows: getInvoicingCatalogPlanRows(products),
|
|
69
|
+
products,
|
|
70
|
+
productSort: listViewState.productSort,
|
|
71
|
+
count: listViewState.counts,
|
|
72
|
+
countsFetchState: listViewState.countsFetchState,
|
|
73
|
+
planFilters: listViewState.planFilters,
|
|
74
|
+
planNextCursor: listViewState.planNextCursor,
|
|
75
|
+
productFilters: listViewState.productFilters,
|
|
76
|
+
productNextCursor: listViewState.productNextCursor,
|
|
77
|
+
productFetchState: listViewState.productFetchState,
|
|
78
|
+
fetchState: listViewState.fetchState,
|
|
79
|
+
error: listViewState.error,
|
|
80
|
+
version: 1.0,
|
|
81
|
+
};
|
|
82
|
+
});
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const ALL_INVOICING_PRODUCT_SORT_KEYS = [
|
|
3
|
-
'product_name',
|
|
4
|
-
'product_code',
|
|
5
|
-
'type',
|
|
6
|
-
'pricing',
|
|
7
|
-
'usage',
|
|
8
|
-
'updated',
|
|
9
|
-
'status',
|
|
10
|
-
];
|
|
11
|
-
export const toInvoicingProductSortKey = (v) => stringToUnion(v, ALL_INVOICING_PRODUCT_SORT_KEYS);
|
|
12
|
-
export const INVOICING_PRODUCT_COLUMNS = [
|
|
13
|
-
{ key: 'product_name', sortable: true },
|
|
14
|
-
{ key: 'product_code', sortable: true },
|
|
15
|
-
{ key: 'type', sortable: true },
|
|
16
|
-
{ key: 'pricing', sortable: false },
|
|
17
|
-
{ key: 'usage', sortable: true },
|
|
18
|
-
{ key: 'updated', sortable: true },
|
|
19
|
-
{ key: 'status', sortable: true },
|
|
20
|
-
];
|
|
1
|
+
export {};
|
|
@@ -16,7 +16,7 @@ import { toBusinessVerificationCompanyDataPayload, toBusinessVerificationOfficer
|
|
|
16
16
|
import { updateCurrentStep, updateOnboardingCustomerView, updateOnboardingCustomerViewFailure, updateOnboardingCustomerViewLocalStoreData, updateOnboardingCustomerViewSuccess, } from '../../onboardingCustomerViewReducer';
|
|
17
17
|
import { getOnboardingCustomerView } from '../../onboardingCustomerViewSelector';
|
|
18
18
|
export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateOnboardingCustomerView.match), mergeMap((action) => {
|
|
19
|
-
const { companyId, officerType, sendForVerification, reCalculateCurrentStep = false, isBillingAddressUpdate, } = action.payload;
|
|
19
|
+
const { companyId, officerType, sendForVerification, reCalculateCurrentStep = false, isBillingAddressUpdate, businessProfile, } = action.payload;
|
|
20
20
|
const { onboardingCustomerViewState } = state$.value;
|
|
21
21
|
const { companyDetails, primaryContactDetails, companyOfficerUpdateStatus, currentStep, currentSubStep, } = onboardingCustomerViewState;
|
|
22
22
|
const companyLocalData = companyDetails.localData;
|
|
@@ -28,12 +28,17 @@ export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => a
|
|
|
28
28
|
}
|
|
29
29
|
const { newAddressState } = state$.value.addressViewState;
|
|
30
30
|
let payload = {};
|
|
31
|
+
const isSetupBillingSave = isBillingAddressUpdate === true || businessProfile != null;
|
|
31
32
|
if (companyLocalData != null) {
|
|
32
|
-
if (isBillingAddressUpdate === true &&
|
|
33
|
-
newAddressState?.subscription_billing_address.addressToCreate != null) {
|
|
34
|
-
payload = prepareEditBillingAddressPayload(companyLocalData, newAddressState.subscription_billing_address.addressToCreate);
|
|
35
|
-
}
|
|
36
33
|
const companyView = getCompanyView(state$.value, companyId, []);
|
|
34
|
+
const billingAddressToCreate = isBillingAddressUpdate === true
|
|
35
|
+
? newAddressState?.subscription_billing_address.addressToCreate
|
|
36
|
+
: undefined;
|
|
37
|
+
if (billingAddressToCreate != null || businessProfile != null) {
|
|
38
|
+
payload = prepareEditBillingAddressPayload(companyLocalData, billingAddressToCreate, businessProfile != null
|
|
39
|
+
? toBusinessProfilePayload(businessProfile, companyView?.company.company.incInfo)
|
|
40
|
+
: {});
|
|
41
|
+
}
|
|
37
42
|
const companyAddressToCreate = newAddressState?.company_address?.addressToCreate;
|
|
38
43
|
const registeredAddressToCreate = newAddressState?.company_registered_address?.addressToCreate;
|
|
39
44
|
const addressType = officerType
|
|
@@ -56,7 +61,7 @@ export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => a
|
|
|
56
61
|
// different payloads — currentSubStep is the source of truth here.
|
|
57
62
|
const isOfficerSave = currentStep === 'verification' &&
|
|
58
63
|
currentSubStep === 'company_officer';
|
|
59
|
-
if (isBillingAddressUpdate === false) {
|
|
64
|
+
if (isBillingAddressUpdate === false && businessProfile == null) {
|
|
60
65
|
if (isOfficerSave) {
|
|
61
66
|
payload = {
|
|
62
67
|
company: toBusinessVerificationMinimalCompanyDataPayload(companyLocalData),
|
|
@@ -70,7 +75,7 @@ export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => a
|
|
|
70
75
|
};
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
|
-
const section =
|
|
78
|
+
const section = isSetupBillingSave
|
|
74
79
|
? 'setup_billing'
|
|
75
80
|
: isOfficerSave
|
|
76
81
|
? 'company_officer'
|
|
@@ -90,7 +95,7 @@ export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => a
|
|
|
90
95
|
},
|
|
91
96
|
};
|
|
92
97
|
let messageSection;
|
|
93
|
-
if (
|
|
98
|
+
if (isSetupBillingSave) {
|
|
94
99
|
messageSection = messageSectionMapper[section].save;
|
|
95
100
|
}
|
|
96
101
|
else if (sendForVerification === true) {
|
|
@@ -173,13 +178,28 @@ const toBusinessVerificationMinimalCompanyDataPayload = (companyLocalData) => {
|
|
|
173
178
|
}
|
|
174
179
|
return company;
|
|
175
180
|
};
|
|
176
|
-
const
|
|
181
|
+
const toBusinessProfilePayload = (businessProfile, persistedIncInfo) => {
|
|
182
|
+
const isIndustryTypeChanged = businessProfile.companyIndustryType !==
|
|
183
|
+
persistedIncInfo?.companyIndustryType;
|
|
184
|
+
return {
|
|
185
|
+
company_business_model: businessProfile.companyBusinessModel,
|
|
186
|
+
company_industry_type: businessProfile.companyIndustryType,
|
|
187
|
+
// A sub-industry kept from the old industry would fail the backend subtype check on the next KYB save.
|
|
188
|
+
...(isIndustryTypeChanged &&
|
|
189
|
+
persistedIncInfo?.companySubIndustry != null && {
|
|
190
|
+
company_industry_sub_type: null,
|
|
191
|
+
}),
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
const prepareEditBillingAddressPayload = (companyDetailsLocalData, address, businessProfilePayload) => {
|
|
177
195
|
const { syncToken } = companyDetailsLocalData;
|
|
178
|
-
const addressPayload = toAddressUpdatableInfoPayload(address);
|
|
179
196
|
return {
|
|
180
197
|
company: {
|
|
181
198
|
sync_token: syncToken,
|
|
182
|
-
|
|
199
|
+
...(address != null && {
|
|
200
|
+
subscription_billing_address: toAddressUpdatableInfoPayload(address),
|
|
201
|
+
}),
|
|
202
|
+
...businessProfilePayload,
|
|
183
203
|
},
|
|
184
204
|
};
|
|
185
205
|
};
|
|
@@ -523,7 +523,7 @@ const onboardingCustomerView = createSlice({
|
|
|
523
523
|
reducer(draft) {
|
|
524
524
|
draft.saveStatus = { fetchState: 'In-Progress', error: undefined };
|
|
525
525
|
},
|
|
526
|
-
prepare(companyId, sendForVerification, reCalculateCurrentStep, isBillingAddressUpdate, officerType) {
|
|
526
|
+
prepare(companyId, sendForVerification, reCalculateCurrentStep, isBillingAddressUpdate, officerType, businessProfile) {
|
|
527
527
|
return {
|
|
528
528
|
payload: {
|
|
529
529
|
companyId,
|
|
@@ -531,6 +531,7 @@ const onboardingCustomerView = createSlice({
|
|
|
531
531
|
reCalculateCurrentStep,
|
|
532
532
|
isBillingAddressUpdate,
|
|
533
533
|
officerType,
|
|
534
|
+
businessProfile,
|
|
534
535
|
},
|
|
535
536
|
};
|
|
536
537
|
},
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
5
|
+
import { resetKycKyb, resetKycKybFailure, resetKycKybSuccess, } from '../../setupViewReducer';
|
|
6
|
+
export const resetKycKybEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(resetKycKyb.match), mergeMap(() => zeniAPI
|
|
7
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/kyc-kyb-reset`, { is_reset_company_officers: false })
|
|
8
|
+
.pipe(mergeMap((response) => {
|
|
9
|
+
if (isSuccessResponse(response)) {
|
|
10
|
+
return from([
|
|
11
|
+
resetKycKybSuccess(),
|
|
12
|
+
openSnackbar({
|
|
13
|
+
messageSection: 'kyc_kyb_reset',
|
|
14
|
+
messageText: 'success',
|
|
15
|
+
type: 'success',
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
19
|
+
return from([
|
|
20
|
+
resetKycKybFailure(response.status),
|
|
21
|
+
openSnackbar({
|
|
22
|
+
messageSection: 'kyc_kyb_reset',
|
|
23
|
+
messageText: 'failed',
|
|
24
|
+
type: 'error',
|
|
25
|
+
}),
|
|
26
|
+
]);
|
|
27
|
+
}), catchError((error) => from([
|
|
28
|
+
resetKycKybFailure(createZeniAPIStatus('Unexpected error', 'Reset KYC/KYB errored out: ' +
|
|
29
|
+
(error instanceof Error
|
|
30
|
+
? error.message
|
|
31
|
+
: JSON.stringify(error)))),
|
|
32
|
+
openSnackbar({
|
|
33
|
+
messageSection: 'kyc_kyb_reset',
|
|
34
|
+
messageText: 'failed',
|
|
35
|
+
type: 'error',
|
|
36
|
+
}),
|
|
37
|
+
])))));
|
|
@@ -13,6 +13,7 @@ const emptyOfficerSlot = {
|
|
|
13
13
|
};
|
|
14
14
|
export const initialState = {
|
|
15
15
|
updateStatus: { fetchState: 'Not-Started', error: undefined },
|
|
16
|
+
kycKybResetStatus: { fetchState: 'Not-Started', error: undefined },
|
|
16
17
|
parsingDocumentFileIds: [],
|
|
17
18
|
companyDetails: { autoFilledFields: [] },
|
|
18
19
|
companyOfficerUpdateStatus: {
|
|
@@ -84,6 +85,25 @@ const setupView = createSlice({
|
|
|
84
85
|
};
|
|
85
86
|
},
|
|
86
87
|
},
|
|
88
|
+
resetKycKyb(draft) {
|
|
89
|
+
draft.kycKybResetStatus = { fetchState: 'In-Progress', error: undefined };
|
|
90
|
+
},
|
|
91
|
+
resetKycKybSuccess(draft) {
|
|
92
|
+
draft.kycKybResetStatus = { fetchState: 'Completed', error: undefined };
|
|
93
|
+
},
|
|
94
|
+
resetKycKybFailure: {
|
|
95
|
+
reducer(draft, action) {
|
|
96
|
+
draft.kycKybResetStatus = { fetchState: 'Error', error: action.payload };
|
|
97
|
+
},
|
|
98
|
+
prepare(error) {
|
|
99
|
+
return {
|
|
100
|
+
payload: error,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
clearKycKybResetStatus(draft) {
|
|
105
|
+
draft.kycKybResetStatus = { fetchState: 'Not-Started', error: undefined };
|
|
106
|
+
},
|
|
87
107
|
updateSelectedCompanyOfficer: {
|
|
88
108
|
reducer(draft, action) {
|
|
89
109
|
const { selectedOfficerType } = action.payload;
|
|
@@ -359,5 +379,5 @@ const setupView = createSlice({
|
|
|
359
379
|
});
|
|
360
380
|
},
|
|
361
381
|
});
|
|
362
|
-
export const { enableSetup, enableSetupSuccess, enableSetupFailure, updateBusinessVerificationDetails, updateBusinessVerificationDetailsSuccess, updateBusinessVerificationDetailsFailure, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, sendOtp: sendOtpSpendManagementSetUp, resendOtp: resendOtpSpendManagementSetUp, sendOtpSuccess: sendOtpSuccessSpendManagementSetUp, sendOtpFailure: sendOtpFailureSpendManagementSetUp, verifyOtp: verifyOtpSpendManagementSetUp, verifyOtpSuccess: verifyOtpSuccessSpendManagementSetUp, verifyOtpFailure: verifyOtpFailureSpendManagementSetUp, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, applyKycDocumentAutofillForSetup, applyKybDocumentAutofillForSetup, clearKycKybAutofillForSetup, } = setupView.actions;
|
|
382
|
+
export const { enableSetup, enableSetupSuccess, enableSetupFailure, updateBusinessVerificationDetails, updateBusinessVerificationDetailsSuccess, updateBusinessVerificationDetailsFailure, resetKycKyb, resetKycKybSuccess, resetKycKybFailure, clearKycKybResetStatus, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, sendOtp: sendOtpSpendManagementSetUp, resendOtp: resendOtpSpendManagementSetUp, sendOtpSuccess: sendOtpSuccessSpendManagementSetUp, sendOtpFailure: sendOtpFailureSpendManagementSetUp, verifyOtp: verifyOtpSpendManagementSetUp, verifyOtpSuccess: verifyOtpSuccessSpendManagementSetUp, verifyOtpFailure: verifyOtpFailureSpendManagementSetUp, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, applyKycDocumentAutofillForSetup, applyKybDocumentAutofillForSetup, clearKycKybAutofillForSetup, } = setupView.actions;
|
|
363
383
|
export default setupView.reducer;
|
|
@@ -85,7 +85,7 @@ function getPrimaryAccountForTheProduct(state, companyId, setupViewType) {
|
|
|
85
85
|
}
|
|
86
86
|
export function getBusinessVerificationDetails(state, companyId) {
|
|
87
87
|
const { setupViewState, countryListState } = state;
|
|
88
|
-
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, updateStatus, } = setupViewState;
|
|
88
|
+
const { companyDetails, companyOfficerUpdateStatus, kycKybResetStatus, primaryContactDetails, updateStatus, } = setupViewState;
|
|
89
89
|
const companyView = getCompanyView(state, companyId, []);
|
|
90
90
|
const { companyDetailsLocalData, companyOfficerLocalData, parsingDocumentFileIds, } = getCompanyAndIdentityDetails(state, companyId, {
|
|
91
91
|
companyDetails,
|
|
@@ -100,6 +100,7 @@ export function getBusinessVerificationDetails(state, companyId) {
|
|
|
100
100
|
parsingDocumentFileIds,
|
|
101
101
|
companyView,
|
|
102
102
|
updateStatus,
|
|
103
|
+
kycKybResetStatus,
|
|
103
104
|
allNationalityCountries,
|
|
104
105
|
};
|
|
105
106
|
}
|