@zeniai/client-epic-state 4.9.74 → 4.9.76
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/billPay/recurringBills/recurringBillsState.d.ts +2 -2
- package/lib/entity/chargeCard/chargeCard.d.ts +2 -2
- package/lib/entity/companyHealthMetric/companyHealthMetricPayload.d.ts +1 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricPayload.js +2 -1
- package/lib/entity/companyHealthMetric/companyHealthMetricState.d.ts +1 -0
- package/lib/epic.d.ts +5 -1
- package/lib/epic.js +5 -1
- package/lib/index.d.ts +12 -11
- package/lib/index.js +28 -16
- package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.d.ts +2 -2
- package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.js +1 -0
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +1 -8
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +1 -1
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +5 -2
- package/lib/view/companyHealthMetricView/companyHealthMetricView.d.ts +1 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +21 -3
- package/lib/view/companyHealthMetricView/epic/initializeCompanyHealthMetricViewLocalData.js +3 -2
- package/lib/view/companyHealthMetricView/epic/saveCompanyHealthMetricByIdEpic.js +2 -1
- package/lib/view/companyView/companyViewPayload.d.ts +8 -0
- package/lib/view/companyView/companyViewReducer.d.ts +2 -1
- package/lib/view/companyView/companyViewReducer.js +24 -2
- package/lib/view/companyView/companyViewState.d.ts +2 -0
- package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +5 -0
- package/lib/view/companyView/epic/fetchCompanyMetaDataEpic.d.ts +7 -0
- package/lib/view/companyView/epic/fetchCompanyMetaDataEpic.js +24 -0
- package/lib/view/companyView/selector/companyManagementViewSelector.d.ts +1 -0
- package/lib/view/companyView/selector/companyManagementViewSelector.js +3 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +3 -3
- package/lib/view/companyView/types/cockpitTypes.js +1 -0
- package/lib/view/companyView/types/companyMetaDataViewState.d.ts +12 -0
- package/lib/view/companyView/types/companyMetaDataViewState.js +14 -0
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +7 -4
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +2 -1
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +8 -2
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.d.ts +6 -0
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.js +16 -0
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +42 -28
- package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -2
- package/lib/view/settingsView/settingsViewHelpers.js +18 -7
- package/lib/view/settingsView/settingsViewPayload.d.ts +10 -0
- package/lib/view/settingsView/settingsViewReducer.d.ts +6 -3
- package/lib/view/settingsView/settingsViewReducer.js +87 -49
- package/lib/view/settingsView/settingsViewSelector.d.ts +3 -8
- package/lib/view/settingsView/settingsViewSelector.js +18 -2
- package/lib/view/settingsView/settingsViewState.d.ts +31 -8
- package/lib/view/settingsView/settingsViewState.js +9 -9
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +12 -0
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +4 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +7 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +21 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.d.ts +10 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js +141 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +4 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +4 -4
- package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.d.ts +7 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.js +40 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailPayload.d.ts +15 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailPayload.js +11 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.d.ts +2 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.js +33 -2
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.d.ts +2 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +2 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailState.d.ts +13 -0
- package/package.json +1 -1
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { RootState } from '../../reducer';
|
|
2
2
|
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
3
|
-
import {
|
|
4
|
-
import { Company } from '../../entity/company/companyStateTypes';
|
|
5
|
-
import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView } from './types/settingsViewSelectorTypes';
|
|
3
|
+
import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView, NotificationSettingsSelectorView, IntegrationsView } from './types/settingsViewSelectorTypes';
|
|
6
4
|
import { NotificationSettings } from './settingsViewState';
|
|
7
5
|
export declare function getApprovalRuleViewDetails(state: RootState): FetchStateAndError;
|
|
8
6
|
export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID): BankConnectionsSetupView;
|
|
9
7
|
export declare function getMyBankConnectionsDetails(state: RootState, userId: ID): MyBankConnectionsView;
|
|
10
|
-
export interface IntegrationsView {
|
|
11
|
-
externalConnections: TenantExternalConnections | undefined;
|
|
12
|
-
companyView: Company | undefined;
|
|
13
|
-
}
|
|
14
8
|
export declare function getIntegrationsView(state: RootState, companyId: ID): IntegrationsView;
|
|
15
9
|
export declare const getMyProfileView: (state: RootState) => MyProfileSelectorView;
|
|
16
|
-
export declare const
|
|
10
|
+
export declare const getNotificationSettings: (state: RootState) => NotificationSettings;
|
|
11
|
+
export declare const getNotificationSettingsView: (state: RootState) => NotificationSettingsSelectorView;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNotificationSettingsView = exports.getMyProfileView = exports.getIntegrationsView = exports.getMyBankConnectionsDetails = exports.getBankConnectionsSetupViewDetails = exports.getApprovalRuleViewDetails = void 0;
|
|
6
|
+
exports.getNotificationSettingsView = exports.getNotificationSettings = exports.getMyProfileView = exports.getIntegrationsView = exports.getMyBankConnectionsDetails = exports.getBankConnectionsSetupViewDetails = exports.getApprovalRuleViewDetails = void 0;
|
|
4
7
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
8
|
+
const values_1 = __importDefault(require("lodash/values"));
|
|
5
9
|
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
6
10
|
const companySelector_1 = require("../../entity/company/companySelector");
|
|
7
11
|
const userRoleSelector_1 = require("../../entity/userRole/userRoleSelector");
|
|
@@ -117,6 +121,18 @@ exports.getMyProfileView = (0, toolkit_1.createSelector)((state) => state.tenant
|
|
|
117
121
|
}
|
|
118
122
|
return myProfilePeopleView;
|
|
119
123
|
});
|
|
120
|
-
exports.
|
|
124
|
+
exports.getNotificationSettings = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (settingsViewState) => {
|
|
121
125
|
return settingsViewState.notification;
|
|
122
126
|
});
|
|
127
|
+
exports.getNotificationSettingsView = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => (0, userListViewSelector_1.getUserList)(state, 'manager'), (settingsViewState, userState, classState, classListState, managersListView) => {
|
|
128
|
+
const classList = (0, classSelectorV2_1.getClassesByIds)(classState, {
|
|
129
|
+
classIds: classListState.classIds,
|
|
130
|
+
reportId: 'class_list',
|
|
131
|
+
});
|
|
132
|
+
const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
133
|
+
settingsViewState.notification,
|
|
134
|
+
classListState,
|
|
135
|
+
managersListView,
|
|
136
|
+
]);
|
|
137
|
+
return Object.assign(Object.assign({}, settingsViewState.notification), { allUsers: (0, values_1.default)(userState.userByUserId), classList, managersList: managersListView.users, fetchState: fetchState.fetchState, error: fetchState.error });
|
|
138
|
+
});
|
|
@@ -5,20 +5,43 @@ interface MyProfile extends FetchStateAndError {
|
|
|
5
5
|
interface BankConnection extends FetchStateAndError {
|
|
6
6
|
bankAccountIds: ID[];
|
|
7
7
|
}
|
|
8
|
+
export declare const REMINDER_NOTIFICATION_TYPES: readonly ["missingReceiptNotification", "uncategorizedTransactionNotification", "pendingBillApprovalNotification", "pendingReimbursementApprovalNotification"];
|
|
8
9
|
declare const toReminderTypeKey: (v: string) => "missingReceiptNotification" | "uncategorizedTransactionNotification" | "pendingBillApprovalNotification" | "pendingReimbursementApprovalNotification";
|
|
9
|
-
declare type ReminderTypeKey = ReturnType<typeof toReminderTypeKey>;
|
|
10
|
-
declare const
|
|
11
|
-
declare type
|
|
12
|
-
export declare
|
|
10
|
+
export declare type ReminderTypeKey = ReturnType<typeof toReminderTypeKey>;
|
|
11
|
+
export declare const toRemindersFrequencyType: (v: string) => "daily" | "weekly" | "bi-weekly" | "monthly";
|
|
12
|
+
export declare type FrequencyTypeKey = ReturnType<typeof toRemindersFrequencyType>;
|
|
13
|
+
export declare const NOTIFICATION_MODES: readonly ["email", "dashboard"];
|
|
14
|
+
export declare const toNotificationMode: (v: string) => "dashboard" | "email";
|
|
15
|
+
export declare type NotificationModeKey = ReturnType<typeof toNotificationMode>;
|
|
16
|
+
export interface MonthEndInsightsNotificationSettingsData {
|
|
17
|
+
enabled: boolean | null;
|
|
18
|
+
recipientEmailIds: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface MonthEndInsightsNotificationSettingsLocalData {
|
|
21
|
+
notify: boolean;
|
|
22
|
+
recipientEmailIds: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface ReminderNotificationSettingDetails {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
frequency: FrequencyTypeKey;
|
|
27
|
+
preferredMode: NotificationModeKey[];
|
|
28
|
+
}
|
|
29
|
+
export declare type RemindersLocalData = {
|
|
30
|
+
frequency: FrequencyTypeKey;
|
|
31
|
+
preferredMode: NotificationModeKey[];
|
|
32
|
+
};
|
|
33
|
+
export declare type ReminderNotificationSettingsData = Record<ReminderTypeKey, ReminderNotificationSettingDetails | null>;
|
|
34
|
+
export declare type ReminderNotificationSettingsLocalData = Record<ReminderTypeKey, RemindersLocalData>;
|
|
13
35
|
export interface NotificationSettingsLocalData {
|
|
14
36
|
reminders: ReminderNotificationSettingsLocalData;
|
|
37
|
+
monthEndInsights: MonthEndInsightsNotificationSettingsLocalData;
|
|
15
38
|
}
|
|
16
|
-
interface
|
|
17
|
-
|
|
39
|
+
export interface NotificationSettingsData {
|
|
40
|
+
reminderNotificationSettings: ReminderNotificationSettingsData;
|
|
41
|
+
monthEndInsightsNotificationSettings: MonthEndInsightsNotificationSettingsData;
|
|
18
42
|
}
|
|
19
|
-
export declare type ReminderNotificationSettingsData = Record<ReminderTypeKey, ReminderNotificationSettingDetails | null>;
|
|
20
43
|
export interface NotificationSettings extends FetchStateAndError {
|
|
21
|
-
notificationSettings:
|
|
44
|
+
notificationSettings: NotificationSettingsData;
|
|
22
45
|
notificationSettingsLocalData: NotificationSettingsLocalData;
|
|
23
46
|
updateStatus: FetchStateAndError;
|
|
24
47
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toNotificationMode = exports.NOTIFICATION_MODES = exports.toRemindersFrequencyType = exports.REMINDER_NOTIFICATION_TYPES = void 0;
|
|
3
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
4
|
-
|
|
5
|
+
exports.REMINDER_NOTIFICATION_TYPES = [
|
|
5
6
|
'missingReceiptNotification',
|
|
6
7
|
'uncategorizedTransactionNotification',
|
|
7
8
|
'pendingBillApprovalNotification',
|
|
8
9
|
'pendingReimbursementApprovalNotification',
|
|
9
10
|
];
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const toReminderFlagTypeKey = (v) => (0, stringToUnion_1.stringToUnion)(v, REMINDER_NOTIFICATION_FLAG_TYPES);
|
|
11
|
+
const toReminderTypeKey = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.REMINDER_NOTIFICATION_TYPES);
|
|
12
|
+
const FREQUENCY_TYPES = ['daily', 'weekly', 'bi-weekly', 'monthly'];
|
|
13
|
+
const toRemindersFrequencyType = (v) => (0, stringToUnion_1.stringToUnion)(v, FREQUENCY_TYPES);
|
|
14
|
+
exports.toRemindersFrequencyType = toRemindersFrequencyType;
|
|
15
|
+
exports.NOTIFICATION_MODES = ['email', 'dashboard'];
|
|
16
|
+
const toNotificationMode = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.NOTIFICATION_MODES);
|
|
17
|
+
exports.toNotificationMode = toNotificationMode;
|
|
@@ -7,6 +7,9 @@ import { UserRole } from '../../../entity/userRole/userRoleState';
|
|
|
7
7
|
import { Person } from '../../people/peopleSelectorTypes';
|
|
8
8
|
import { SetupView } from '../../spendManagement/commonSetup/setupViewSelector';
|
|
9
9
|
import { UserFinancialAccountSelectorView } from '../../userFinancialAccount/userFinancialAccountSelector';
|
|
10
|
+
import { NotificationSettings } from '../settingsViewState';
|
|
11
|
+
import { TenantExternalConnections } from '../../../entity/tenant/tenantState';
|
|
12
|
+
import { Company } from '../../../entity/company/companyStateTypes';
|
|
10
13
|
export interface MyProfileSelectorView extends SelectorView {
|
|
11
14
|
isZeniUser: boolean;
|
|
12
15
|
person: MyProfile;
|
|
@@ -27,3 +30,12 @@ export interface MyBankConnectionsView extends UserFinancialAccountSelectorView
|
|
|
27
30
|
export interface BankConnectionsSetupView extends FetchStateAndError {
|
|
28
31
|
setupView: SetupView;
|
|
29
32
|
}
|
|
33
|
+
export interface NotificationSettingsSelectorView extends NotificationSettings {
|
|
34
|
+
allUsers: User[];
|
|
35
|
+
classList: Class[];
|
|
36
|
+
managersList: Person[];
|
|
37
|
+
}
|
|
38
|
+
export interface IntegrationsView {
|
|
39
|
+
externalConnections: TenantExternalConnections | undefined;
|
|
40
|
+
companyView: Company | undefined;
|
|
41
|
+
}
|
|
@@ -4,7 +4,7 @@ import { AccountBase } from '../../../../entity/account/accountState';
|
|
|
4
4
|
import { ClassBase } from '../../../../entity/class/classState';
|
|
5
5
|
export declare const getBillPayConfigKey: (method: string, subMethod: string) => string;
|
|
6
6
|
export declare type BillPayConfigKey = ReturnType<typeof getBillPayConfigKey>;
|
|
7
|
-
export declare const getBillPayConfigMethodKey: (method: BillPaymentConfigCodeType, subMethod: BillPaymentSubConfigCodeKeyType, accType
|
|
7
|
+
export declare const getBillPayConfigMethodKey: (method: BillPaymentConfigCodeType, subMethod: BillPaymentSubConfigCodeKeyType, accType?: "depositAccount" | "paymentAccount" | undefined, internationalMethod?: "usdToLocalCurrency" | "usdToUsd" | undefined, internationalSubMethod?: "swiftOur" | "swiftSha" | undefined) => string;
|
|
8
8
|
export declare type VendorCurrencyConfig = Record<BillPayConfigKey, Currency[]>;
|
|
9
9
|
export declare const DYNAMIC_FEE_TYPE: readonly ["percent", "fixed"];
|
|
10
10
|
export declare const toDynamicFeeType: (v: string) => "fixed" | "percent";
|
|
@@ -9,7 +9,10 @@ const getBillPayConfigKey = (method, subMethod) => {
|
|
|
9
9
|
};
|
|
10
10
|
exports.getBillPayConfigKey = getBillPayConfigKey;
|
|
11
11
|
const getBillPayConfigMethodKey = (method, subMethod, accType, internationalMethod, internationalSubMethod) => {
|
|
12
|
-
const keys = ['billPay', method, subMethod
|
|
12
|
+
const keys = ['billPay', method, subMethod];
|
|
13
|
+
if (accType != null) {
|
|
14
|
+
keys.push(accType);
|
|
15
|
+
}
|
|
13
16
|
if (internationalMethod != null) {
|
|
14
17
|
keys.push(internationalMethod);
|
|
15
18
|
}
|
|
@@ -65,6 +65,12 @@ export declare const fetchEditBillDetailPage: import("@reduxjs/toolkit").ActionC
|
|
|
65
65
|
amountPayload: AmountPayload;
|
|
66
66
|
conversionRate: number;
|
|
67
67
|
billId?: string | undefined;
|
|
68
|
-
}, string
|
|
68
|
+
}, string>, fetchVendorAndUpdateBillLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId?: string | undefined, billId?: string | undefined], {
|
|
69
|
+
vendorId: string | undefined;
|
|
70
|
+
billId: string | undefined;
|
|
71
|
+
}, string, never, never>, waitForVendorByIdThenSaveBillUpdatetoLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, billId?: string | undefined], {
|
|
72
|
+
vendorId: string;
|
|
73
|
+
billId: string | undefined;
|
|
74
|
+
}, string, never, never>;
|
|
69
75
|
declare const _default: import("@reduxjs/toolkit").Reducer<EditBillDetailViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
70
76
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateHomeCurrencyConversion = exports.currencyConversionValueSuccessOrFailure = exports.convertAmountToHomeCurrency = exports.updateVendorContactSuccessOrFailure = exports.updateVendorContact = exports.updateSuggestedVendorIdFromParsedInvoice = exports.updateRecommendedVendorId = exports.updateBillUploadFetchState = exports.updateAddBillAutoFields = exports.updateShowAutofill = exports.updateInternationalTransferFeeBearerPaymentMethodInLocalData = exports.waitForVendorByNameThenParsetoLocalStore = exports.waitForBillDetailThenInitializeLocalStore = exports.clearEditBillViewDetail = exports.parseInvoiceToBill = exports.updateEditBillFetchStateCompleted = exports.saveBillSuccessOrFailure = exports.saveBillDetail = exports.discardBillUpdatesInLocalStore = exports.saveBillUpdatesToLocalStore = exports.initializeBillToLocalStore = exports.fetchVendorByNameAndParseInvoice = exports.fetchBillAndInitializeLocalStore = exports.fetchEditBillDetailPage = exports.initialState = void 0;
|
|
4
|
+
exports.waitForVendorByIdThenSaveBillUpdatetoLocalStore = exports.fetchVendorAndUpdateBillLocalData = exports.updateHomeCurrencyConversion = exports.currencyConversionValueSuccessOrFailure = exports.convertAmountToHomeCurrency = exports.updateVendorContactSuccessOrFailure = exports.updateVendorContact = exports.updateSuggestedVendorIdFromParsedInvoice = exports.updateRecommendedVendorId = exports.updateBillUploadFetchState = exports.updateAddBillAutoFields = exports.updateShowAutofill = exports.updateInternationalTransferFeeBearerPaymentMethodInLocalData = exports.waitForVendorByNameThenParsetoLocalStore = exports.waitForBillDetailThenInitializeLocalStore = exports.clearEditBillViewDetail = exports.parseInvoiceToBill = exports.updateEditBillFetchStateCompleted = exports.saveBillSuccessOrFailure = exports.saveBillDetail = exports.discardBillUpdatesInLocalStore = exports.saveBillUpdatesToLocalStore = exports.initializeBillToLocalStore = exports.fetchVendorByNameAndParseInvoice = exports.fetchBillAndInitializeLocalStore = exports.fetchEditBillDetailPage = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const editBillViewState_1 = require("./editBillViewState");
|
|
7
7
|
const billDetailViewState_1 = require("../billDetailView/billDetailViewState");
|
|
@@ -36,6 +36,9 @@ const editBillView = (0, toolkit_1.createSlice)({
|
|
|
36
36
|
draft.editBillStateById[key] = Object.assign(Object.assign({}, oldData), { fetchStatus: {
|
|
37
37
|
fetchState: 'In-Progress',
|
|
38
38
|
error: undefined,
|
|
39
|
+
}, saveStatus: {
|
|
40
|
+
fetchState: 'Not-Started',
|
|
41
|
+
error: undefined,
|
|
39
42
|
}, showSkipAutofill: false });
|
|
40
43
|
},
|
|
41
44
|
prepare(billId, cacheOverride, isShowDeletedBillsEnabled) {
|
|
@@ -306,12 +309,28 @@ const editBillView = (0, toolkit_1.createSlice)({
|
|
|
306
309
|
return { payload: { internationalTransferFeeBearerPaymentMethod, billId } };
|
|
307
310
|
},
|
|
308
311
|
},
|
|
312
|
+
fetchVendorAndUpdateBillLocalData: {
|
|
313
|
+
reducer() {
|
|
314
|
+
// do nothing
|
|
315
|
+
},
|
|
316
|
+
prepare(vendorId, billId) {
|
|
317
|
+
return { payload: { vendorId, billId } };
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
waitForVendorByIdThenSaveBillUpdatetoLocalStore: {
|
|
321
|
+
reducer() {
|
|
322
|
+
// do nothing
|
|
323
|
+
},
|
|
324
|
+
prepare(vendorId, billId) {
|
|
325
|
+
return { payload: { vendorId, billId } };
|
|
326
|
+
},
|
|
327
|
+
},
|
|
309
328
|
clearEditBillViewDetail(draft) {
|
|
310
329
|
Object.assign(draft, exports.initialState);
|
|
311
330
|
},
|
|
312
331
|
},
|
|
313
332
|
});
|
|
314
|
-
_a = editBillView.actions, exports.fetchEditBillDetailPage = _a.fetchEditBillDetailPage, exports.fetchBillAndInitializeLocalStore = _a.fetchBillAndInitializeLocalStore, exports.fetchVendorByNameAndParseInvoice = _a.fetchVendorByNameAndParseInvoice, exports.initializeBillToLocalStore = _a.initializeBillToLocalStore, exports.saveBillUpdatesToLocalStore = _a.saveBillUpdatesToLocalStore, exports.discardBillUpdatesInLocalStore = _a.discardBillUpdatesInLocalStore, exports.saveBillDetail = _a.saveBillDetail, exports.saveBillSuccessOrFailure = _a.saveBillSuccessOrFailure, exports.updateEditBillFetchStateCompleted = _a.updateEditBillFetchStateCompleted, exports.parseInvoiceToBill = _a.parseInvoiceToBill, exports.clearEditBillViewDetail = _a.clearEditBillViewDetail, exports.waitForBillDetailThenInitializeLocalStore = _a.waitForBillDetailThenInitializeLocalStore, exports.waitForVendorByNameThenParsetoLocalStore = _a.waitForVendorByNameThenParsetoLocalStore, exports.updateInternationalTransferFeeBearerPaymentMethodInLocalData = _a.updateInternationalTransferFeeBearerPaymentMethodInLocalData, exports.updateShowAutofill = _a.updateShowAutofill, exports.updateAddBillAutoFields = _a.updateAddBillAutoFields, exports.updateBillUploadFetchState = _a.updateBillUploadFetchState, exports.updateRecommendedVendorId = _a.updateRecommendedVendorId, exports.updateSuggestedVendorIdFromParsedInvoice = _a.updateSuggestedVendorIdFromParsedInvoice, exports.updateVendorContact = _a.updateVendorContact, exports.updateVendorContactSuccessOrFailure = _a.updateVendorContactSuccessOrFailure, exports.convertAmountToHomeCurrency = _a.convertAmountToHomeCurrency, exports.currencyConversionValueSuccessOrFailure = _a.currencyConversionValueSuccessOrFailure, exports.updateHomeCurrencyConversion = _a.updateHomeCurrencyConversion;
|
|
333
|
+
_a = editBillView.actions, exports.fetchEditBillDetailPage = _a.fetchEditBillDetailPage, exports.fetchBillAndInitializeLocalStore = _a.fetchBillAndInitializeLocalStore, exports.fetchVendorByNameAndParseInvoice = _a.fetchVendorByNameAndParseInvoice, exports.initializeBillToLocalStore = _a.initializeBillToLocalStore, exports.saveBillUpdatesToLocalStore = _a.saveBillUpdatesToLocalStore, exports.discardBillUpdatesInLocalStore = _a.discardBillUpdatesInLocalStore, exports.saveBillDetail = _a.saveBillDetail, exports.saveBillSuccessOrFailure = _a.saveBillSuccessOrFailure, exports.updateEditBillFetchStateCompleted = _a.updateEditBillFetchStateCompleted, exports.parseInvoiceToBill = _a.parseInvoiceToBill, exports.clearEditBillViewDetail = _a.clearEditBillViewDetail, exports.waitForBillDetailThenInitializeLocalStore = _a.waitForBillDetailThenInitializeLocalStore, exports.waitForVendorByNameThenParsetoLocalStore = _a.waitForVendorByNameThenParsetoLocalStore, exports.updateInternationalTransferFeeBearerPaymentMethodInLocalData = _a.updateInternationalTransferFeeBearerPaymentMethodInLocalData, exports.updateShowAutofill = _a.updateShowAutofill, exports.updateAddBillAutoFields = _a.updateAddBillAutoFields, exports.updateBillUploadFetchState = _a.updateBillUploadFetchState, exports.updateRecommendedVendorId = _a.updateRecommendedVendorId, exports.updateSuggestedVendorIdFromParsedInvoice = _a.updateSuggestedVendorIdFromParsedInvoice, exports.updateVendorContact = _a.updateVendorContact, exports.updateVendorContactSuccessOrFailure = _a.updateVendorContactSuccessOrFailure, exports.convertAmountToHomeCurrency = _a.convertAmountToHomeCurrency, exports.currencyConversionValueSuccessOrFailure = _a.currencyConversionValueSuccessOrFailure, exports.updateHomeCurrencyConversion = _a.updateHomeCurrencyConversion, exports.fetchVendorAndUpdateBillLocalData = _a.fetchVendorAndUpdateBillLocalData, exports.waitForVendorByIdThenSaveBillUpdatetoLocalStore = _a.waitForVendorByIdThenSaveBillUpdatetoLocalStore;
|
|
315
334
|
exports.default = editBillView.reducer;
|
|
316
335
|
function doUpdateRecurringBillLocalData(billDetail, currentConfig, prevConfig) {
|
|
317
336
|
var _a, _b, _c, _d;
|
|
@@ -0,0 +1,10 @@
|
|
|
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>;
|
package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
}
|
|
@@ -84,6 +84,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
|
|
|
84
84
|
if (vendorCurrency === currencyInInvoice) {
|
|
85
85
|
finalVendor = suggestedVendor;
|
|
86
86
|
showVendorGptRecommendationText = true;
|
|
87
|
+
recommendedVendorId = suggestedVendor === null || suggestedVendor === void 0 ? void 0 : suggestedVendor.id;
|
|
87
88
|
}
|
|
88
89
|
else {
|
|
89
90
|
isVendorWithNewCurrency = true;
|
|
@@ -205,7 +206,9 @@ const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPaylo
|
|
|
205
206
|
const isPayNowEnabled = payNowCutOffTime != null
|
|
206
207
|
? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
|
|
207
208
|
: false;
|
|
208
|
-
const fromAccountType = (
|
|
209
|
+
const fromAccountType = ((_l = billPayload.bill_pay_info) === null || _l === void 0 ? void 0 : _l.from_account.account_type) != null
|
|
210
|
+
? (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)((0, billPayConfigState_1.toAccType)((_m = billPayload.bill_pay_info) === null || _m === void 0 ? void 0 : _m.from_account.account_type))
|
|
211
|
+
: undefined;
|
|
209
212
|
const bookCloseDate = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyInfo.bookCloseDate;
|
|
210
213
|
const invoiceDate = Boolean(billPayload.transaction_date) === true
|
|
211
214
|
? (0, editBillViewSelector_1.getInvoiceDate)('draft', (0, zeniDayJS_1.date)(billPayload.transaction_date), bookCloseDate)
|
|
@@ -40,14 +40,14 @@ const getChargeCardListView = (state, includeCreditAccount) => {
|
|
|
40
40
|
const sortKey = chargeCardListState.uiState.sortKey;
|
|
41
41
|
const sortOrder = (0, sortOrderPayload_1.getSortOrder)(chargeCardListState.uiState.sortOrder);
|
|
42
42
|
const cardsInOrder = (0, orderBy_1.default)(cards, (card) => {
|
|
43
|
-
var _a, _b, _c, _d;
|
|
43
|
+
var _a, _b, _c, _d, _e;
|
|
44
44
|
switch (sortKey) {
|
|
45
45
|
case 'owner':
|
|
46
|
-
return (
|
|
46
|
+
return ((_c = `${(_a = card.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName.toLowerCase()} ${(_b = card.cardHolderUser) === null || _b === void 0 ? void 0 : _b.lastName.toLowerCase()}`) !== null && _c !== void 0 ? _c : '');
|
|
47
47
|
case 'cardName':
|
|
48
|
-
return card.cardName;
|
|
48
|
+
return card.cardName.toLowerCase();
|
|
49
49
|
case 'department':
|
|
50
|
-
return (
|
|
50
|
+
return (_e = (_d = card.department) === null || _d === void 0 ? void 0 : _d.className.toLowerCase()) !== null && _e !== void 0 ? _e : '';
|
|
51
51
|
case 'utilisation':
|
|
52
52
|
return card.limit.amount - card.available.amount;
|
|
53
53
|
case 'limit':
|
package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
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>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { AmountPayload } from '../../../../entity/reimbursement/reimbursementPayload';
|
|
1
2
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
3
|
+
import { ReviewTransferMoney } from './transferDetailState';
|
|
2
4
|
export interface TransferMoneyPayload {
|
|
3
5
|
transaction_id: string;
|
|
4
6
|
amount: number;
|
|
@@ -6,4 +8,17 @@ export interface TransferMoneyPayload {
|
|
|
6
8
|
currency_symbol: string;
|
|
7
9
|
transaction_creation_time: string;
|
|
8
10
|
}
|
|
11
|
+
export interface TransferSchedulePayload {
|
|
12
|
+
amount: number;
|
|
13
|
+
currency_code: string;
|
|
14
|
+
currency_symbol: string;
|
|
15
|
+
schedule_time: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ReviewTransferMoneyPayload {
|
|
18
|
+
is_show_daily_ach_limit_warning: boolean;
|
|
19
|
+
daily_ach_debit_limit: AmountPayload | null;
|
|
20
|
+
transfer_schedules: TransferSchedulePayload[];
|
|
21
|
+
}
|
|
22
|
+
export declare const mapReviewTransferMoneyPayloadToReviewTransferMoney: (payload: ReviewTransferMoneyPayload) => ReviewTransferMoney;
|
|
23
|
+
export declare type ReviewTransferMoneyResponse = ZeniAPIResponse<ReviewTransferMoneyPayload>;
|
|
9
24
|
export declare type TransferMoneyResponse = ZeniAPIResponse<TransferMoneyPayload>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapReviewTransferMoneyPayloadToReviewTransferMoney = void 0;
|
|
4
|
+
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
5
|
+
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
6
|
+
const mapReviewTransferMoneyPayloadToReviewTransferMoney = (payload) => ({
|
|
7
|
+
isShowDailyAchLimitWarning: payload.is_show_daily_ach_limit_warning,
|
|
8
|
+
dailyAchDebitLimit: payload.daily_ach_debit_limit != null
|
|
9
|
+
? (0, amount_1.toAmount)(payload.daily_ach_debit_limit.amount, payload.daily_ach_debit_limit.currency_code, payload.daily_ach_debit_limit.currency_symbol)
|
|
10
|
+
: (0, amount_1.toAmount)(0, 'USD', '$'),
|
|
11
|
+
transferSchedules: payload.transfer_schedules.map((transfer_schedule) => (Object.assign(Object.assign({}, (0, amount_1.toAmount)(transfer_schedule.amount, transfer_schedule.currency_code, transfer_schedule.currency_symbol)), { scheduleTime: (0, zeniDayJS_1.dateInLocal)(transfer_schedule.schedule_time) }))),
|
|
12
|
+
});
|
|
13
|
+
exports.mapReviewTransferMoneyPayloadToReviewTransferMoney = mapReviewTransferMoneyPayloadToReviewTransferMoney;
|
|
@@ -2,12 +2,13 @@ import { FetchState } from '../../../../commonStateTypes/common';
|
|
|
2
2
|
import { DepositAccount } from '../../../../entity/depositAccount/depositAccount';
|
|
3
3
|
import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
4
4
|
import { TransferDetailLocalData, TransferDetailState } from './transferDetailState';
|
|
5
|
+
import { ReviewTransferMoneyPayload } from './transferDetailPayload';
|
|
5
6
|
export declare const initialState: TransferDetailState;
|
|
6
7
|
export declare const transferMoney: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[depositAccountId?: string | undefined], {
|
|
7
8
|
depositAccountId: string | undefined;
|
|
8
9
|
}, string, never, never>, transferMoneySuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
10
|
fetchState: FetchState;
|
|
10
11
|
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
11
|
-
}, string>, updateLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<TransferDetailLocalData, string>, updateTransferToLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<DepositAccount, string>, clearTransferDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
12
|
+
}, string>, updateLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<TransferDetailLocalData, string>, updateTransferToLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<DepositAccount, string>, fetchReviewTransferDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateReviewTransferDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<ReviewTransferMoneyPayload, string>, updateReviewTransferDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, clearReviewTransferDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearTransferDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
12
13
|
declare const _default: import("@reduxjs/toolkit").Reducer<TransferDetailState, import("@reduxjs/toolkit").AnyAction>;
|
|
13
14
|
export default _default;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearTransferDetail = exports.updateTransferToLocalData = exports.updateLocalStore = exports.transferMoneySuccessOrFailure = exports.transferMoney = exports.initialState = void 0;
|
|
4
|
+
exports.clearTransferDetail = exports.clearReviewTransferDetail = exports.updateReviewTransferDetailFailure = exports.updateReviewTransferDetail = exports.fetchReviewTransferDetail = exports.updateTransferToLocalData = exports.updateLocalStore = exports.transferMoneySuccessOrFailure = exports.transferMoney = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const transferDetailPayload_1 = require("./transferDetailPayload");
|
|
6
7
|
exports.initialState = {
|
|
7
8
|
localData: {
|
|
8
9
|
amount: {
|
|
@@ -13,6 +14,19 @@ exports.initialState = {
|
|
|
13
14
|
transferFrom: undefined,
|
|
14
15
|
transferTo: undefined,
|
|
15
16
|
},
|
|
17
|
+
reviewTransferDetail: {
|
|
18
|
+
reviewTransferMoney: {
|
|
19
|
+
isShowDailyAchLimitWarning: false,
|
|
20
|
+
dailyAchDebitLimit: {
|
|
21
|
+
amount: 0,
|
|
22
|
+
currencyCode: 'USD',
|
|
23
|
+
currencySymbol: '$',
|
|
24
|
+
},
|
|
25
|
+
transferSchedules: [],
|
|
26
|
+
},
|
|
27
|
+
fetchState: 'Not-Started',
|
|
28
|
+
error: undefined,
|
|
29
|
+
},
|
|
16
30
|
fetchState: 'Not-Started',
|
|
17
31
|
error: undefined,
|
|
18
32
|
};
|
|
@@ -60,10 +74,27 @@ const transferDetail = (0, toolkit_1.createSlice)({
|
|
|
60
74
|
draft.fetchState = action.payload.fetchState;
|
|
61
75
|
draft.error = action.payload.error;
|
|
62
76
|
},
|
|
77
|
+
fetchReviewTransferDetail(draft) {
|
|
78
|
+
draft.reviewTransferDetail.fetchState = 'In-Progress';
|
|
79
|
+
draft.reviewTransferDetail.error = undefined;
|
|
80
|
+
},
|
|
81
|
+
updateReviewTransferDetail(draft, action) {
|
|
82
|
+
draft.reviewTransferDetail.fetchState = 'Completed';
|
|
83
|
+
draft.reviewTransferDetail.error = undefined;
|
|
84
|
+
draft.reviewTransferDetail.reviewTransferMoney =
|
|
85
|
+
(0, transferDetailPayload_1.mapReviewTransferMoneyPayloadToReviewTransferMoney)(action.payload);
|
|
86
|
+
},
|
|
87
|
+
updateReviewTransferDetailFailure(draft, action) {
|
|
88
|
+
draft.reviewTransferDetail.fetchState = 'Error';
|
|
89
|
+
draft.reviewTransferDetail.error = action.payload;
|
|
90
|
+
},
|
|
91
|
+
clearReviewTransferDetail(draft) {
|
|
92
|
+
draft.reviewTransferDetail = exports.initialState.reviewTransferDetail;
|
|
93
|
+
},
|
|
63
94
|
clearTransferDetail(draft) {
|
|
64
95
|
Object.assign(draft, exports.initialState);
|
|
65
96
|
},
|
|
66
97
|
},
|
|
67
98
|
});
|
|
68
|
-
_a = transferDetail.actions, exports.transferMoney = _a.transferMoney, exports.transferMoneySuccessOrFailure = _a.transferMoneySuccessOrFailure, exports.updateLocalStore = _a.updateLocalStore, exports.updateTransferToLocalData = _a.updateTransferToLocalData, exports.clearTransferDetail = _a.clearTransferDetail;
|
|
99
|
+
_a = transferDetail.actions, exports.transferMoney = _a.transferMoney, exports.transferMoneySuccessOrFailure = _a.transferMoneySuccessOrFailure, exports.updateLocalStore = _a.updateLocalStore, exports.updateTransferToLocalData = _a.updateTransferToLocalData, exports.fetchReviewTransferDetail = _a.fetchReviewTransferDetail, exports.updateReviewTransferDetail = _a.updateReviewTransferDetail, exports.updateReviewTransferDetailFailure = _a.updateReviewTransferDetailFailure, exports.clearReviewTransferDetail = _a.clearReviewTransferDetail, exports.clearTransferDetail = _a.clearTransferDetail;
|
|
69
100
|
exports.default = transferDetail.reducer;
|