@zeniai/client-epic-state 4.9.66 → 4.9.67
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/billTransaction/billTransactionPayload.d.ts +10 -7
- package/lib/entity/billPay/billTransaction/billTransactionPayload.js +1 -1
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -1
- package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +2 -2
- package/lib/entity/chargeCard/chargeCard.d.ts +2 -2
- package/lib/epic.d.ts +4 -1
- package/lib/epic.js +4 -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/vendorViewReducer.d.ts +1 -1
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +5 -2
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.d.ts +6 -0
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.js +13 -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 +1 -1
- package/lib/view/settingsView/settingsViewReducer.js +79 -44
- 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/billList/billListSelector.js +2 -2
- 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 +130 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.d.ts +2 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +27 -6
- 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,20 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearSettingsView = exports.updateNotificationSettingsOnSaveFailure = exports.updateNotificationSettingsOnSaveSuccess = exports.saveNotificationSettings = exports.resetNotificationSettingsLocalData = exports.updateNotificationSettingsLocalData = exports.updateNotificationSettingsOnFailure = exports.updateNotificationSettingsOnSuccess = exports.fetchNotificationSettings = exports.fetchBankAccountsList = exports.updateBankConnectionOnFailure = exports.updateBankConnectionOnSuccess = exports.fetchBankConnectionsView = exports.updateMyProfileOnFailure = exports.updateMyProfileOnSuccess = exports.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
|
|
4
|
+
exports.clearSettingsView = exports.updateNotificationSettingsOnSaveFailure = exports.updateNotificationSettingsOnSaveSuccess = exports.saveNotificationSettings = exports.resetNotificationSettingsLocalData = exports.updateNotificationSettingsLocalData = exports.updateNotificationSettingsOnFailure = exports.updateNotificationSettingsOnSuccess = exports.fetchNotificationSettings = exports.fetchBankAccountsList = exports.updateBankConnectionOnFailure = exports.updateBankConnectionOnSuccess = exports.fetchBankConnectionsView = exports.updateMyProfileOnFailure = exports.updateMyProfileOnSuccess = exports.fetchNotificationSettingsView = exports.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const settingsViewState_1 = require("./settingsViewState");
|
|
6
7
|
const initialNotificationSettingsData = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
reminderNotificationSettings: {
|
|
9
|
+
missingReceiptNotification: null,
|
|
10
|
+
uncategorizedTransactionNotification: null,
|
|
11
|
+
pendingBillApprovalNotification: null,
|
|
12
|
+
pendingReimbursementApprovalNotification: null,
|
|
13
|
+
},
|
|
14
|
+
monthEndInsightsNotificationSettings: {
|
|
15
|
+
enabled: false,
|
|
16
|
+
recipientEmailIds: [],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const initialRemindersLocalData = {
|
|
20
|
+
preferredMode: [],
|
|
21
|
+
frequency: 'bi-weekly',
|
|
11
22
|
};
|
|
12
23
|
const initialNotificationSettingsLocalData = {
|
|
24
|
+
monthEndInsights: {
|
|
25
|
+
recipientEmailIds: [],
|
|
26
|
+
notify: false,
|
|
27
|
+
},
|
|
13
28
|
reminders: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
missingReceiptNotification: initialRemindersLocalData,
|
|
30
|
+
pendingBillApprovalNotification: initialRemindersLocalData,
|
|
31
|
+
pendingReimbursementApprovalNotification: initialRemindersLocalData,
|
|
32
|
+
uncategorizedTransactionNotification: initialRemindersLocalData,
|
|
18
33
|
},
|
|
19
34
|
};
|
|
20
35
|
exports.initialState = {
|
|
@@ -86,6 +101,9 @@ const settings = (0, toolkit_1.createSlice)({
|
|
|
86
101
|
draft.bankConnection.fetchState = 'Error';
|
|
87
102
|
draft.bankConnection.error = action.payload;
|
|
88
103
|
},
|
|
104
|
+
fetchNotificationSettingsView() {
|
|
105
|
+
// Do nothing.
|
|
106
|
+
},
|
|
89
107
|
fetchNotificationSettings(draft) {
|
|
90
108
|
draft.notification.fetchState = 'In-Progress';
|
|
91
109
|
draft.notification.error = undefined;
|
|
@@ -138,47 +156,64 @@ const settings = (0, toolkit_1.createSlice)({
|
|
|
138
156
|
},
|
|
139
157
|
},
|
|
140
158
|
});
|
|
141
|
-
_a = settings.actions, exports.fetchMyProfileView = _a.fetchMyProfileView, exports.fetchMyProfile = _a.fetchMyProfile, exports.updateMyProfileOnSuccess = _a.updateMyProfileOnSuccess, exports.updateMyProfileOnFailure = _a.updateMyProfileOnFailure, exports.fetchBankConnectionsView = _a.fetchBankConnectionsView, exports.updateBankConnectionOnSuccess = _a.updateBankConnectionOnSuccess, exports.updateBankConnectionOnFailure = _a.updateBankConnectionOnFailure, exports.fetchBankAccountsList = _a.fetchBankAccountsList, exports.fetchNotificationSettings = _a.fetchNotificationSettings, exports.updateNotificationSettingsOnSuccess = _a.updateNotificationSettingsOnSuccess, exports.updateNotificationSettingsOnFailure = _a.updateNotificationSettingsOnFailure, exports.updateNotificationSettingsLocalData = _a.updateNotificationSettingsLocalData, exports.resetNotificationSettingsLocalData = _a.resetNotificationSettingsLocalData, exports.saveNotificationSettings = _a.saveNotificationSettings, exports.updateNotificationSettingsOnSaveSuccess = _a.updateNotificationSettingsOnSaveSuccess, exports.updateNotificationSettingsOnSaveFailure = _a.updateNotificationSettingsOnSaveFailure, exports.clearSettingsView = _a.clearSettingsView;
|
|
159
|
+
_a = settings.actions, exports.fetchMyProfileView = _a.fetchMyProfileView, exports.fetchMyProfile = _a.fetchMyProfile, exports.fetchNotificationSettingsView = _a.fetchNotificationSettingsView, exports.updateMyProfileOnSuccess = _a.updateMyProfileOnSuccess, exports.updateMyProfileOnFailure = _a.updateMyProfileOnFailure, exports.fetchBankConnectionsView = _a.fetchBankConnectionsView, exports.updateBankConnectionOnSuccess = _a.updateBankConnectionOnSuccess, exports.updateBankConnectionOnFailure = _a.updateBankConnectionOnFailure, exports.fetchBankAccountsList = _a.fetchBankAccountsList, exports.fetchNotificationSettings = _a.fetchNotificationSettings, exports.updateNotificationSettingsOnSuccess = _a.updateNotificationSettingsOnSuccess, exports.updateNotificationSettingsOnFailure = _a.updateNotificationSettingsOnFailure, exports.updateNotificationSettingsLocalData = _a.updateNotificationSettingsLocalData, exports.resetNotificationSettingsLocalData = _a.resetNotificationSettingsLocalData, exports.saveNotificationSettings = _a.saveNotificationSettings, exports.updateNotificationSettingsOnSaveSuccess = _a.updateNotificationSettingsOnSaveSuccess, exports.updateNotificationSettingsOnSaveFailure = _a.updateNotificationSettingsOnSaveFailure, exports.clearSettingsView = _a.clearSettingsView;
|
|
142
160
|
exports.default = settings.reducer;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
if (data.is_pending_reimbursement_approval_notification_active != null) {
|
|
156
|
-
notificationSettingsData.pendingReimbursementApprovalNotification = {
|
|
157
|
-
active: data.is_pending_reimbursement_approval_notification_active,
|
|
161
|
+
/**
|
|
162
|
+
* Helpers
|
|
163
|
+
*/
|
|
164
|
+
function toRemindersLocalData(reminderNotificationSettingDetails) {
|
|
165
|
+
if (reminderNotificationSettingDetails != null) {
|
|
166
|
+
return {
|
|
167
|
+
preferredMode: reminderNotificationSettingDetails.enabled
|
|
168
|
+
? reminderNotificationSettingDetails.preferredMode
|
|
169
|
+
: [],
|
|
170
|
+
frequency: reminderNotificationSettingDetails.frequency,
|
|
158
171
|
};
|
|
159
172
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
active: data.is_uncategorized_transaction_notification_active,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
return notificationSettingsData;
|
|
166
|
-
};
|
|
173
|
+
return Object.assign({}, initialRemindersLocalData);
|
|
174
|
+
}
|
|
167
175
|
const toNotificationSettingsLocalData = (data) => {
|
|
176
|
+
var _a;
|
|
177
|
+
const { monthEndInsightsNotificationSettings, reminderNotificationSettings } = data;
|
|
178
|
+
const { missingReceiptNotification, pendingBillApprovalNotification, pendingReimbursementApprovalNotification, uncategorizedTransactionNotification, } = reminderNotificationSettings;
|
|
168
179
|
return {
|
|
180
|
+
monthEndInsights: {
|
|
181
|
+
notify: (_a = monthEndInsightsNotificationSettings.enabled) !== null && _a !== void 0 ? _a : false,
|
|
182
|
+
recipientEmailIds: monthEndInsightsNotificationSettings.recipientEmailIds,
|
|
183
|
+
},
|
|
169
184
|
reminders: {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
missingReceiptNotification: toRemindersLocalData(missingReceiptNotification),
|
|
186
|
+
pendingBillApprovalNotification: toRemindersLocalData(pendingBillApprovalNotification),
|
|
187
|
+
pendingReimbursementApprovalNotification: toRemindersLocalData(pendingReimbursementApprovalNotification),
|
|
188
|
+
uncategorizedTransactionNotification: toRemindersLocalData(uncategorizedTransactionNotification),
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
function toReminderNotificationSettingsDetails(isNotificationActive, remindersPayload) {
|
|
193
|
+
if (isNotificationActive != null && remindersPayload != null) {
|
|
194
|
+
const { frequency_type, preferred_mode } = remindersPayload;
|
|
195
|
+
return {
|
|
196
|
+
enabled: isNotificationActive,
|
|
197
|
+
frequency: frequency_type != null
|
|
198
|
+
? (0, settingsViewState_1.toRemindersFrequencyType)(frequency_type)
|
|
199
|
+
: 'bi-weekly',
|
|
200
|
+
preferredMode: preferred_mode.map((mode) => (0, settingsViewState_1.toNotificationMode)(mode)),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
const toNotificationSettings = (data) => {
|
|
206
|
+
var _a;
|
|
207
|
+
return {
|
|
208
|
+
reminderNotificationSettings: {
|
|
209
|
+
missingReceiptNotification: toReminderNotificationSettingsDetails(data.is_missing_receipt_notification_active, data.missing_receipt_notification),
|
|
210
|
+
pendingBillApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_bill_approval_notification_active, data.pending_bill_approval_notification),
|
|
211
|
+
pendingReimbursementApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_reimbursement_approval_notification_active, data.pending_reimbursement_approval_notification),
|
|
212
|
+
uncategorizedTransactionNotification: toReminderNotificationSettingsDetails(data.is_uncategorized_transaction_notification_active, data.uncategorized_transaction_notification),
|
|
213
|
+
},
|
|
214
|
+
monthEndInsightsNotificationSettings: {
|
|
215
|
+
enabled: data.is_month_end_insights_active,
|
|
216
|
+
recipientEmailIds: (_a = data.month_end_email_recipient_email_ids) !== null && _a !== void 0 ? _a : [],
|
|
182
217
|
},
|
|
183
218
|
};
|
|
184
219
|
};
|
|
@@ -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'), (state) => state.peopleState, (settingsViewState, userState, classState, classListState, managersListView, peopleState) => {
|
|
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
|
+
peopleState,
|
|
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
|
+
}
|
|
@@ -375,7 +375,7 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
|
|
|
375
375
|
}
|
|
376
376
|
break;
|
|
377
377
|
case 'amount':
|
|
378
|
-
if (Boolean(transaction.
|
|
378
|
+
if (Boolean(transaction.totalAmountInUSD) === true) {
|
|
379
379
|
transactionsWithSortKeyValue.push(transaction);
|
|
380
380
|
}
|
|
381
381
|
else
|
|
@@ -413,7 +413,7 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
|
|
|
413
413
|
case 'status':
|
|
414
414
|
return getStatusPerTab(transaction);
|
|
415
415
|
case 'amount':
|
|
416
|
-
return (_b = transaction.
|
|
416
|
+
return (_b = transaction.totalAmountInUSD.amount) !== null && _b !== void 0 ? _b : 0;
|
|
417
417
|
case 'paymentMethod':
|
|
418
418
|
return transaction.billPayInfo.billPaymentMethodType.name;
|
|
419
419
|
}
|
|
@@ -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 { 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>;
|
|
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,130 @@
|
|
|
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 fetchVendorAndUpdateBillLocalDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.fetchVendorAndUpdateBillLocalData.match), (0, operators_1.mergeMap)((action) => {
|
|
18
|
+
const fetchActions = [];
|
|
19
|
+
const { vendorId } = action.payload;
|
|
20
|
+
const state = state$.value;
|
|
21
|
+
let billInLocalStore = state.editBillDetailViewState.newBillState;
|
|
22
|
+
if (action.payload.billId != null) {
|
|
23
|
+
const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
|
|
24
|
+
billInLocalStore =
|
|
25
|
+
state.editBillDetailViewState.editBillStateById[billDetailKey];
|
|
26
|
+
}
|
|
27
|
+
if (vendorId != null) {
|
|
28
|
+
const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
|
|
29
|
+
if (vendor != null) {
|
|
30
|
+
fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
31
|
+
billDetailLocalData: prepareBillLocalData(state, billInLocalStore, vendor),
|
|
32
|
+
billId: action.payload.billId,
|
|
33
|
+
}));
|
|
34
|
+
fetchActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendor.qboId, false));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
fetchActions.push((0, vendorViewReducer_1.fetchVendor)(vendorId), (0, editBillViewReducer_1.waitForVendorByIdThenSaveBillUpdatetoLocalStore)(vendorId, action.payload.billId));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// when tentative vendor is selected from the vendor dropdown, then vendor_id is undefined
|
|
42
|
+
fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
43
|
+
billDetailLocalData: prepareBillLocalData(state, billInLocalStore),
|
|
44
|
+
billId: action.payload.billId,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
48
|
+
}));
|
|
49
|
+
exports.fetchVendorAndUpdateBillLocalDataEpic = fetchVendorAndUpdateBillLocalDataEpic;
|
|
50
|
+
const waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.waitForVendorByIdThenSaveBillUpdatetoLocalStore.match), (0, operators_1.switchMap)((action) => {
|
|
51
|
+
const { vendorId } = action.payload;
|
|
52
|
+
return actions$.pipe((0, operators_1.filter)((value) => vendorViewReducer_1.indicateReadyToInitializeBillLocalStore.match(value)), (0, operators_1.take)(1), // don't listen forever! IMPORTANT!
|
|
53
|
+
(0, operators_1.mergeMap)(() => {
|
|
54
|
+
const state = state$.value;
|
|
55
|
+
const fetchActions = [];
|
|
56
|
+
const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
|
|
57
|
+
let billInLocalStore = state.editBillDetailViewState.newBillState;
|
|
58
|
+
if (action.payload.billId != null) {
|
|
59
|
+
const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
|
|
60
|
+
billInLocalStore =
|
|
61
|
+
state.editBillDetailViewState.editBillStateById[billDetailKey];
|
|
62
|
+
}
|
|
63
|
+
if (vendor != null) {
|
|
64
|
+
fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
65
|
+
billDetailLocalData: prepareBillLocalData(state, billInLocalStore, vendor),
|
|
66
|
+
billId: action.payload.billId,
|
|
67
|
+
}));
|
|
68
|
+
fetchActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendor.qboId, false));
|
|
69
|
+
}
|
|
70
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
71
|
+
}));
|
|
72
|
+
}));
|
|
73
|
+
exports.waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic = waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic;
|
|
74
|
+
function prepareBillLocalData(state, billInLocalStore, vendor) {
|
|
75
|
+
var _a, _b, _c, _d;
|
|
76
|
+
const isCancelled = billInLocalStore.billDetailLocalData.isCancelled;
|
|
77
|
+
const lines = billInLocalStore.billDetailLocalData.updatesByLineId;
|
|
78
|
+
const updatedLines = Object.assign({}, lines);
|
|
79
|
+
const vendorCategory = (vendor === null || vendor === void 0 ? void 0 : vendor.accountId) != null
|
|
80
|
+
? (0, accountSelector_1.getAccountBase)(state.accountState, vendor.accountId, 'account_list')
|
|
81
|
+
: undefined;
|
|
82
|
+
const vendorClass = (vendor === null || vendor === void 0 ? void 0 : vendor.classId) != null
|
|
83
|
+
? (0, classSelector_1.getClassById)(state.classState, {
|
|
84
|
+
classId: vendor.classId,
|
|
85
|
+
reportId: 'class_list',
|
|
86
|
+
})
|
|
87
|
+
: undefined;
|
|
88
|
+
const vendorCurrencyCode = vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode;
|
|
89
|
+
const vendorCurrencySymbol = vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencySymbol;
|
|
90
|
+
const { tenantState, companyState } = state;
|
|
91
|
+
const { currentTenantId } = tenantState;
|
|
92
|
+
const companyId = currentTenantId != null
|
|
93
|
+
? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.companyId
|
|
94
|
+
: undefined;
|
|
95
|
+
const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
|
|
96
|
+
const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
|
|
97
|
+
const isPayNowEnabled = payNowCutOffTime != null
|
|
98
|
+
? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
|
|
99
|
+
: false;
|
|
100
|
+
Object.keys(updatedLines).forEach((lineId) => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
const line = lines[lineId];
|
|
103
|
+
updatedLines[lineId] = Object.assign(Object.assign({}, line), { account: Boolean((_a = line.account) === null || _a === void 0 ? void 0 : _a.accountId) === false && vendorCategory != null
|
|
104
|
+
? vendorCategory
|
|
105
|
+
: line.account, class: Boolean((_b = line.class) === null || _b === void 0 ? void 0 : _b.classId) === false && vendorClass != null
|
|
106
|
+
? vendorClass
|
|
107
|
+
: line.class });
|
|
108
|
+
});
|
|
109
|
+
//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
|
|
110
|
+
if (Object.keys(updatedLines).length === 0) {
|
|
111
|
+
updatedLines['1'] = Object.assign({ account: vendorCategory, class: vendorClass, amount: {
|
|
112
|
+
amount: 0,
|
|
113
|
+
currencyCode: vendorCurrencyCode !== null && vendorCurrencyCode !== void 0 ? vendorCurrencyCode : 'USD',
|
|
114
|
+
currencySymbol: vendorCurrencySymbol !== null && vendorCurrencySymbol !== void 0 ? vendorCurrencySymbol : '$',
|
|
115
|
+
}, 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);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
showVendorGptRecommendationText: false,
|
|
119
|
+
vendor: vendor,
|
|
120
|
+
isCancelled: isCancelled,
|
|
121
|
+
updatesByLineId: updatedLines,
|
|
122
|
+
whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode }),
|
|
123
|
+
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 :
|
|
124
|
+
//in case paymentDate is not present in the billDetailLocalData, then today/next working date will be considered.
|
|
125
|
+
//this is done beacuse we are doing similar calcualtion in getDefaultValues of editBillDetailPage.
|
|
126
|
+
(0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()) }),
|
|
127
|
+
isCollectToAccountInfoFromVendorContact: false,
|
|
128
|
+
isRecurring: false,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { parseInvoiceToBill, saveBillUpdatesToLocalStore, updateAddBillAutoFields, updateBillUploadFetchState, updateShowAutofill } from '../editBillViewReducer';
|
|
3
|
+
import { convertAmountToHomeCurrency, parseInvoiceToBill, saveBillUpdatesToLocalStore, updateAddBillAutoFields, updateBillUploadFetchState, updateShowAutofill } from '../editBillViewReducer';
|
|
4
4
|
import { RootState } from '../../../../../reducer';
|
|
5
5
|
import { fetchClassList } from '../../../../classList/classListReducer';
|
|
6
6
|
import { BillTransactionPayload } from '../../../../../entity/billPay/billTransaction/billTransactionPayload';
|
|
@@ -8,7 +8,7 @@ import { AddBillAutoFields, BillDetailLocalData } from '../editBillViewState';
|
|
|
8
8
|
import { Vendor } from '../../../../../entity/vendor/vendorState';
|
|
9
9
|
import { fetchPreviousBills } from '../../previousBills/previousBillsReducer';
|
|
10
10
|
import { fetchDuplicateBill } from '../../billPayReview/billPayReviewReducer';
|
|
11
|
-
export declare type ActionType = ReturnType<typeof parseInvoiceToBill> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof fetchDuplicateBill> | ReturnType<typeof updateShowAutofill> | ReturnType<typeof updateAddBillAutoFields> | ReturnType<typeof updateBillUploadFetchState>;
|
|
11
|
+
export declare type ActionType = ReturnType<typeof parseInvoiceToBill> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof fetchDuplicateBill> | ReturnType<typeof updateShowAutofill> | ReturnType<typeof updateAddBillAutoFields> | ReturnType<typeof updateBillUploadFetchState> | ReturnType<typeof convertAmountToHomeCurrency>;
|
|
12
12
|
export declare const parseInvoiceToBillEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
13
13
|
export declare const toBillDetailLocalData: (state: RootState, showVendorGptRecommendationText: boolean, billPayload: Partial<BillTransactionPayload>, vendor: Vendor | undefined, recommendedVendorId?: string | undefined) => BillDetailLocalData;
|
|
14
14
|
export declare const getAutoFieldsData: (finalBill: BillDetailLocalData, isVendorWithNewCurrency: boolean, tentativeVendorName?: string | undefined, currencyInInvoice?: string | undefined, vendorCurrency?: string | undefined) => AddBillAutoFields;
|