@zeniai/client-epic-state 4.9.72 → 4.9.74

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.
Files changed (46) hide show
  1. package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +1 -1
  2. package/lib/entity/billPay/billTransaction/billTransactionPayload.js +8 -5
  3. package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +2 -2
  4. package/lib/entity/chargeCard/chargeCard.d.ts +2 -2
  5. package/lib/epic.d.ts +1 -4
  6. package/lib/epic.js +1 -4
  7. package/lib/index.d.ts +11 -12
  8. package/lib/index.js +16 -28
  9. package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.d.ts +2 -2
  10. package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.js +0 -1
  11. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +8 -1
  12. package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +1 -1
  13. package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +2 -5
  14. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +1 -2
  15. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +2 -8
  16. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +28 -42
  17. package/lib/view/settingsView/settingsViewHelpers.d.ts +2 -4
  18. package/lib/view/settingsView/settingsViewHelpers.js +7 -18
  19. package/lib/view/settingsView/settingsViewPayload.d.ts +0 -10
  20. package/lib/view/settingsView/settingsViewReducer.d.ts +3 -6
  21. package/lib/view/settingsView/settingsViewReducer.js +49 -87
  22. package/lib/view/settingsView/settingsViewSelector.d.ts +8 -3
  23. package/lib/view/settingsView/settingsViewSelector.js +2 -18
  24. package/lib/view/settingsView/settingsViewState.d.ts +8 -31
  25. package/lib/view/settingsView/settingsViewState.js +9 -9
  26. package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +0 -12
  27. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -1
  28. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +1 -4
  29. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +1 -7
  30. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +2 -21
  31. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +1 -4
  32. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +4 -4
  33. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailPayload.d.ts +0 -15
  34. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailPayload.js +0 -11
  35. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.d.ts +1 -2
  36. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.js +2 -33
  37. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.d.ts +1 -2
  38. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +1 -2
  39. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailState.d.ts +0 -13
  40. package/package.json +1 -1
  41. package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.d.ts +0 -6
  42. package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.js +0 -16
  43. package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.d.ts +0 -10
  44. package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js +0 -141
  45. package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.d.ts +0 -7
  46. package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.js +0 -40
@@ -3,12 +3,11 @@ import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAnd
3
3
  import { DepositAccount } from '../../../../entity/depositAccount/depositAccount';
4
4
  import { PaymentAccount } from '../../../../entity/paymentAccount/paymentAccountState';
5
5
  import { RootState } from '../../../../reducer';
6
- import { ReviewTransferDetail, TransferDetailLocalData, TransferMoneyParty } from './transferDetailState';
6
+ import { TransferDetailLocalData, TransferMoneyParty } from './transferDetailState';
7
7
  export interface TransferDetailSelectorView extends SelectorView {
8
8
  transferDetailLocalData: TransferDetailLocalData;
9
9
  transferMoneyParties: TransferMoneyParty[];
10
10
  transferMoneyPartiesFetchState: FetchState;
11
- reviewTransferDetail: ReviewTransferDetail;
12
11
  primaryPaymentAccount?: PaymentAccount;
13
12
  }
14
13
  export declare const getTransferDetail: (state: RootState) => TransferDetailSelectorView;
@@ -7,7 +7,7 @@ const depositAccountListSelector_1 = require("../depositAccountList/depositAccou
7
7
  const paymentAccountListSelector_1 = require("../paymentAccountList/paymentAccountListSelector");
8
8
  const getTransferDetail = (state) => {
9
9
  const { transferDetailState, depositAccountState, paymentAccountState, depositAccountListState, paymentAccountListState, } = state;
10
- const { localData, fetchState, error, reviewTransferDetail } = transferDetailState;
10
+ const { localData, fetchState, error } = transferDetailState;
11
11
  const depositAccountsView = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState);
12
12
  const paymentAccountsView = (0, paymentAccountListSelector_1.getAllPaymentAccounts)(paymentAccountState, paymentAccountListState);
13
13
  let transferParties = [];
@@ -22,7 +22,6 @@ const getTransferDetail = (state) => {
22
22
  const primaryPaymentAccount = (0, paymentAccountListSelector_1.getPrimaryPaymentAccount)(paymentAccountState, paymentAccountListState);
23
23
  return {
24
24
  transferDetailLocalData: localData,
25
- reviewTransferDetail,
26
25
  fetchState,
27
26
  error,
28
27
  transferMoneyParties: transferParties,
@@ -2,14 +2,9 @@ import { Amount } from '../../../../commonStateTypes/amount';
2
2
  import { Balance } from '../../../../commonStateTypes/balance';
3
3
  import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
4
4
  import { Logo } from '../../../../entity/paymentAccount/paymentAccountState';
5
- import { ZeniDate } from '../../../../zeniDayJS';
6
5
  import { AccountTypeSubConfigCodeKeyType } from '../../billPay/billPayConfig/billPayConfigState';
7
6
  export interface TransferDetailState extends FetchStateAndError {
8
7
  localData: TransferDetailLocalData;
9
- reviewTransferDetail: ReviewTransferDetail;
10
- }
11
- export interface ReviewTransferDetail extends FetchStateAndError {
12
- reviewTransferMoney: ReviewTransferMoney;
13
8
  }
14
9
  export interface TransferDetailLocalData {
15
10
  amount: Amount;
@@ -24,11 +19,3 @@ export interface TransferMoneyParty {
24
19
  accountBalance?: Balance;
25
20
  logo?: Logo;
26
21
  }
27
- export interface ReviewTransferMoney {
28
- isShowDailyAchLimitWarning: boolean;
29
- dailyAchDebitLimit: Amount;
30
- transferSchedules: TransferSchedule[];
31
- }
32
- export interface TransferSchedule extends Amount {
33
- scheduleTime: ZeniDate;
34
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.9.72",
3
+ "version": "4.9.74",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,6 +0,0 @@
1
- import { ActionsObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { fetchClassList } from '../../classList/classListReducer';
4
- import { fetchUserListByType } from '../../userListView/userListViewReducer';
5
- export declare type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchClassList>;
6
- export declare const fetchNotificationSettingsViewEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchNotificationSettingsViewEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const settingsViewReducer_1 = require("../settingsViewReducer");
7
- const classListReducer_1 = require("../../classList/classListReducer");
8
- const userListViewReducer_1 = require("../../userListView/userListViewReducer");
9
- const fetchNotificationSettingsViewEpic = (actions$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchNotificationSettingsView.match), (0, operators_1.switchMap)(() => {
10
- const actions = [
11
- (0, userListViewReducer_1.fetchUserListByType)('manager', true),
12
- (0, classListReducer_1.fetchClassList)(),
13
- ];
14
- return (0, rxjs_1.from)(actions);
15
- }));
16
- exports.fetchNotificationSettingsViewEpic = fetchNotificationSettingsViewEpic;
@@ -1,10 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateBankAccounts } from '../../../../../entity/bankAccount/bankAccountReducer';
3
- import { RootState } from '../../../../../reducer';
4
- import { convertAmountToHomeCurrency, fetchVendorAndUpdateBillLocalData, saveBillUpdatesToLocalStore, waitForVendorByIdThenSaveBillUpdatetoLocalStore } from '../editBillViewReducer';
5
- import { updateVendorsList, updateVendorListFailure } from '../../../../vendorList/vendorListReducer';
6
- import { fetchVendor, indicateReadyToInitializeBillLocalStore } from '../../../../commonVendorView/vendorView/vendorViewReducer';
7
- import { fetchPreviousBills } from '../../previousBills/previousBillsReducer';
8
- export declare type ActionType = ReturnType<typeof waitForVendorByIdThenSaveBillUpdatetoLocalStore> | ReturnType<typeof fetchVendor> | ReturnType<typeof updateVendorListFailure> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchVendorAndUpdateBillLocalData> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updateVendorsList> | ReturnType<typeof indicateReadyToInitializeBillLocalStore> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof convertAmountToHomeCurrency>;
9
- export declare const fetchVendorAndUpdateBillLocalDataEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => import("rxjs").Observable<ActionType>;
10
- export declare const waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => import("rxjs").Observable<ActionType>;
@@ -1,141 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic = exports.fetchVendorAndUpdateBillLocalDataEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const editBillViewReducer_1 = require("../editBillViewReducer");
7
- const vendorSelector_1 = require("../../../../../entity/vendor/vendorSelector");
8
- const billDetailViewState_1 = require("../../billDetailView/billDetailViewState");
9
- const zeniDayJS_1 = require("../../../../../zeniDayJS");
10
- const workingDayHelper_1 = require("../../../../../commonStateTypes/workingDayHelper");
11
- const companySelector_1 = require("../../../../../entity/company/companySelector");
12
- const accountSelector_1 = require("../../../../../entity/account/accountSelector");
13
- const classSelector_1 = require("../../../../../entity/class/classSelector");
14
- const editBillViewState_1 = require("../../../../spendManagement/billPay/editBillView/editBillViewState");
15
- const vendorViewReducer_1 = require("../../../../commonVendorView/vendorView/vendorViewReducer");
16
- const previousBillsReducer_1 = require("../../previousBills/previousBillsReducer");
17
- const currencyHelper_1 = require("../../../../../commonStateTypes/currencyHelper");
18
- const fetchVendorAndUpdateBillLocalDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.fetchVendorAndUpdateBillLocalData.match), (0, operators_1.mergeMap)((action) => {
19
- var _a, _b, _c, _d;
20
- const fetchActions = [];
21
- const { vendorId } = action.payload;
22
- const state = state$.value;
23
- let billInLocalStore = state.editBillDetailViewState.newBillState;
24
- if (action.payload.billId != null) {
25
- const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
26
- billInLocalStore =
27
- state.editBillDetailViewState.editBillStateById[billDetailKey];
28
- }
29
- if (vendorId != null) {
30
- const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
31
- if (vendor != null) {
32
- if (vendor.vendorCurrencyCode != null &&
33
- !(0, currencyHelper_1.isUsdCurrency)(vendor.vendorCurrencyCode)) {
34
- fetchActions.push((0, editBillViewReducer_1.convertAmountToHomeCurrency)(true, {
35
- amount: (_b = (_a = billInLocalStore.billDetailLocalData.totalAmount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
36
- currencyCode: (_c = vendor.vendorCurrencyCode) !== null && _c !== void 0 ? _c : 'USD',
37
- currencySymbol: (_d = vendor.vendorCurrencySymbol) !== null && _d !== void 0 ? _d : '$',
38
- }, 'USD', action.payload.billId));
39
- }
40
- fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
41
- billDetailLocalData: prepareBillLocalData(state, billInLocalStore, vendor),
42
- billId: action.payload.billId,
43
- }));
44
- fetchActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendor.qboId, false));
45
- }
46
- else {
47
- fetchActions.push((0, vendorViewReducer_1.fetchVendor)(vendorId), (0, editBillViewReducer_1.waitForVendorByIdThenSaveBillUpdatetoLocalStore)(vendorId, action.payload.billId));
48
- }
49
- }
50
- else {
51
- // when tentative vendor is selected from the vendor dropdown, then vendor_id is undefined
52
- fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
53
- billDetailLocalData: prepareBillLocalData(state, billInLocalStore),
54
- billId: action.payload.billId,
55
- }));
56
- }
57
- return (0, rxjs_1.from)(fetchActions);
58
- }));
59
- exports.fetchVendorAndUpdateBillLocalDataEpic = fetchVendorAndUpdateBillLocalDataEpic;
60
- const waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.waitForVendorByIdThenSaveBillUpdatetoLocalStore.match), (0, operators_1.switchMap)((action) => {
61
- const { vendorId } = action.payload;
62
- return actions$.pipe((0, operators_1.filter)((value) => vendorViewReducer_1.indicateReadyToInitializeBillLocalStore.match(value)), (0, operators_1.take)(1), // don't listen forever! IMPORTANT!
63
- (0, operators_1.mergeMap)(() => {
64
- var _a, _b, _c, _d;
65
- const state = state$.value;
66
- const fetchActions = [];
67
- const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
68
- let billInLocalStore = state.editBillDetailViewState.newBillState;
69
- if (action.payload.billId != null) {
70
- const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
71
- billInLocalStore =
72
- state.editBillDetailViewState.editBillStateById[billDetailKey];
73
- }
74
- if (vendor != null) {
75
- (0, editBillViewReducer_1.convertAmountToHomeCurrency)(true, {
76
- amount: (_b = (_a = billInLocalStore.billDetailLocalData.totalAmount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
77
- currencyCode: (_c = vendor.vendorCurrencyCode) !== null && _c !== void 0 ? _c : 'USD',
78
- currencySymbol: (_d = vendor.vendorCurrencySymbol) !== null && _d !== void 0 ? _d : '$',
79
- }, 'USD', action.payload.billId);
80
- fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
81
- billDetailLocalData: prepareBillLocalData(state, billInLocalStore, vendor),
82
- billId: action.payload.billId,
83
- }));
84
- fetchActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendor.qboId, false));
85
- }
86
- return (0, rxjs_1.from)(fetchActions);
87
- }));
88
- }));
89
- exports.waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic = waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic;
90
- function prepareBillLocalData(state, billInLocalStore, vendor) {
91
- var _a, _b, _c, _d;
92
- const isCancelled = billInLocalStore.billDetailLocalData.isCancelled;
93
- const lines = billInLocalStore.billDetailLocalData.updatesByLineId;
94
- const updatedLines = Object.assign({}, lines);
95
- const vendorCategory = (vendor === null || vendor === void 0 ? void 0 : vendor.accountId) != null
96
- ? (0, accountSelector_1.getAccountBase)(state.accountState, vendor.accountId, 'account_list')
97
- : undefined;
98
- const vendorClass = (vendor === null || vendor === void 0 ? void 0 : vendor.classId) != null
99
- ? (0, classSelector_1.getClassById)(state.classState, {
100
- classId: vendor.classId,
101
- reportId: 'class_list',
102
- })
103
- : undefined;
104
- const vendorCurrencyCode = vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode;
105
- const vendorCurrencySymbol = vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencySymbol;
106
- const { tenantState, companyState } = state;
107
- const { currentTenantId } = tenantState;
108
- const companyId = currentTenantId != null
109
- ? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.companyId
110
- : undefined;
111
- const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
112
- const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
113
- const isPayNowEnabled = payNowCutOffTime != null
114
- ? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
115
- : false;
116
- Object.keys(updatedLines).forEach((lineId) => {
117
- const line = lines[lineId];
118
- updatedLines[lineId] = Object.assign(Object.assign(Object.assign({}, line), { account: vendorCategory, class: vendorClass }), editBillViewState_1.defaultRecommendationStateObj);
119
- });
120
- //when it's a new bill and it doesn't have any line item, we want to default the account and class to vendor's account and class
121
- if (Object.keys(updatedLines).length === 0) {
122
- updatedLines['1'] = Object.assign({ account: vendorCategory, class: vendorClass, amount: {
123
- amount: 0,
124
- currencyCode: vendorCurrencyCode !== null && vendorCurrencyCode !== void 0 ? vendorCurrencyCode : 'USD',
125
- currencySymbol: vendorCurrencySymbol !== null && vendorCurrencySymbol !== void 0 ? vendorCurrencySymbol : '$',
126
- }, id: '1', lineDescription: '', platformLineDetailType: 'account_based_expense_line_detail', type: 'transaction_with_account_and_class_line', billable: 'not_billable', isCategoryMiscategorized: false, isClassMiscategorized: false }, editBillViewState_1.defaultRecommendationStateObj);
127
- }
128
- return {
129
- showVendorGptRecommendationText: false,
130
- vendor: vendor,
131
- isCancelled: isCancelled,
132
- updatesByLineId: updatedLines,
133
- whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode }),
134
- paymentDetailsSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.paymentDetailsSection), { paymentTo: undefined, internationalTransferFeeBearerPaymentMethod: vendor === null || vendor === void 0 ? void 0 : vendor.preferredInternationalTransferFeeBearerPaymentMethod, paymentDate: (_d = (_c = billInLocalStore.billDetailLocalData.paymentDetailsSection) === null || _c === void 0 ? void 0 : _c.paymentDate) !== null && _d !== void 0 ? _d :
135
- //in case paymentDate is not present in the billDetailLocalData, then today/next working date will be considered.
136
- //this is done beacuse we are doing similar calcualtion in getDefaultValues of editBillDetailPage.
137
- (0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()) }),
138
- isCollectToAccountInfoFromVendorContact: false,
139
- isRecurring: false,
140
- };
141
- }
@@ -1,7 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { fetchReviewTransferDetail, updateReviewTransferDetail, updateReviewTransferDetailFailure } from './transferDetailReducer';
6
- export declare type ActionType = ReturnType<typeof fetchReviewTransferDetail> | ReturnType<typeof updateReviewTransferDetail> | ReturnType<typeof updateReviewTransferDetailFailure>;
7
- export declare const fetchReviewTransferDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchReviewTransferDetailEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const transferDetailReducer_1 = require("./transferDetailReducer");
8
- const helpers_1 = require("../../helpers");
9
- const fetchReviewTransferDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transferDetailReducer_1.fetchReviewTransferDetail.match), (0, operators_1.switchMap)(() => {
10
- var _a, _b, _c, _d, _e, _f;
11
- const state = state$.value;
12
- const localData = state.transferDetailState.localData;
13
- const payload = {
14
- from_account: {
15
- account_id: (_a = localData.transferFrom) === null || _a === void 0 ? void 0 : _a.id,
16
- account_type: (_c = (0, helpers_1.accountTypeSubConfigCodeToAccType)((_b = localData.transferFrom) === null || _b === void 0 ? void 0 : _b.accType)) !== null && _c !== void 0 ? _c : '',
17
- },
18
- to_account: {
19
- account_id: (_d = localData.transferTo) === null || _d === void 0 ? void 0 : _d.id,
20
- account_type: (_f = (0, helpers_1.accountTypeSubConfigCodeToAccType)((_e = localData.transferTo) === null || _e === void 0 ? void 0 : _e.accType)) !== null && _f !== void 0 ? _f : '',
21
- },
22
- amount: localData.amount.amount,
23
- currency_code: localData.amount.currencyCode,
24
- currency_symbol: localData.amount.currencySymbol,
25
- };
26
- return zeniAPI
27
- .postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/deposit-accounts/transfers/review`, payload)
28
- .pipe((0, operators_1.mergeMap)((response) => {
29
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
30
- return (0, rxjs_1.of)((0, transferDetailReducer_1.updateReviewTransferDetail)(response.data));
31
- }
32
- else {
33
- return (0, rxjs_1.of)((0, transferDetailReducer_1.updateReviewTransferDetailFailure)(response.status));
34
- }
35
- }), (0, operators_1.catchError)((error) => {
36
- return (0, rxjs_1.of)((0, transferDetailReducer_1.updateReviewTransferDetailFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Review Transfer Detail REST API call errored out' +
37
- JSON.stringify(error))));
38
- }));
39
- }));
40
- exports.fetchReviewTransferDetailEpic = fetchReviewTransferDetailEpic;