@zeniai/client-epic-state 4.9.59 → 4.9.60
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/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 +7 -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 +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/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 +18 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.d.ts +10 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js +121 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +4 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +3 -3
- 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
|
+
}
|
|
@@ -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, billId?: string | undefined], {
|
|
69
|
+
vendorId: string;
|
|
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");
|
|
@@ -306,12 +306,28 @@ const editBillView = (0, toolkit_1.createSlice)({
|
|
|
306
306
|
return { payload: { internationalTransferFeeBearerPaymentMethod, billId } };
|
|
307
307
|
},
|
|
308
308
|
},
|
|
309
|
+
fetchVendorAndUpdateBillLocalData: {
|
|
310
|
+
reducer() {
|
|
311
|
+
// do nothing
|
|
312
|
+
},
|
|
313
|
+
prepare(vendorId, billId) {
|
|
314
|
+
return { payload: { vendorId, billId } };
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
waitForVendorByIdThenSaveBillUpdatetoLocalStore: {
|
|
318
|
+
reducer() {
|
|
319
|
+
// do nothing
|
|
320
|
+
},
|
|
321
|
+
prepare(vendorId, billId) {
|
|
322
|
+
return { payload: { vendorId, billId } };
|
|
323
|
+
},
|
|
324
|
+
},
|
|
309
325
|
clearEditBillViewDetail(draft) {
|
|
310
326
|
Object.assign(draft, exports.initialState);
|
|
311
327
|
},
|
|
312
328
|
},
|
|
313
329
|
});
|
|
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;
|
|
330
|
+
_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
331
|
exports.default = editBillView.reducer;
|
|
316
332
|
function doUpdateRecurringBillLocalData(billDetail, currentConfig, prevConfig) {
|
|
317
333
|
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,121 @@
|
|
|
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
|
+
const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
|
|
22
|
+
let billInLocalStore = state.editBillDetailViewState.newBillState;
|
|
23
|
+
if (action.payload.billId != null) {
|
|
24
|
+
const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
|
|
25
|
+
billInLocalStore =
|
|
26
|
+
state.editBillDetailViewState.editBillStateById[billDetailKey];
|
|
27
|
+
}
|
|
28
|
+
if (vendor != null) {
|
|
29
|
+
fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
30
|
+
billDetailLocalData: prepareBillLocalData(state, billInLocalStore, vendor),
|
|
31
|
+
billId: action.payload.billId,
|
|
32
|
+
}));
|
|
33
|
+
fetchActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendor.qboId, false));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
fetchActions.push((0, vendorViewReducer_1.fetchVendor)(vendorId), (0, editBillViewReducer_1.waitForVendorByIdThenSaveBillUpdatetoLocalStore)(vendorId, action.payload.billId));
|
|
37
|
+
}
|
|
38
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
39
|
+
}));
|
|
40
|
+
exports.fetchVendorAndUpdateBillLocalDataEpic = fetchVendorAndUpdateBillLocalDataEpic;
|
|
41
|
+
const waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.waitForVendorByIdThenSaveBillUpdatetoLocalStore.match), (0, operators_1.switchMap)((action) => {
|
|
42
|
+
const { vendorId } = action.payload;
|
|
43
|
+
return actions$.pipe((0, operators_1.filter)((value) => vendorViewReducer_1.indicateReadyToInitializeBillLocalStore.match(value)), (0, operators_1.take)(1), // don't listen forever! IMPORTANT!
|
|
44
|
+
(0, operators_1.mergeMap)(() => {
|
|
45
|
+
const state = state$.value;
|
|
46
|
+
const fetchActions = [];
|
|
47
|
+
const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
|
|
48
|
+
let billInLocalStore = state.editBillDetailViewState.newBillState;
|
|
49
|
+
if (action.payload.billId != null) {
|
|
50
|
+
const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
|
|
51
|
+
billInLocalStore =
|
|
52
|
+
state.editBillDetailViewState.editBillStateById[billDetailKey];
|
|
53
|
+
}
|
|
54
|
+
if (vendor != null) {
|
|
55
|
+
fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
56
|
+
billDetailLocalData: prepareBillLocalData(state, billInLocalStore, vendor),
|
|
57
|
+
billId: action.payload.billId,
|
|
58
|
+
}));
|
|
59
|
+
fetchActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendor.qboId, false));
|
|
60
|
+
}
|
|
61
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
62
|
+
}));
|
|
63
|
+
}));
|
|
64
|
+
exports.waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic = waitForVendorByIdThenSaveBillUpdatetoLocalStoreEpic;
|
|
65
|
+
function prepareBillLocalData(state, billInLocalStore, vendor) {
|
|
66
|
+
var _a, _b, _c, _d;
|
|
67
|
+
const isCancelled = billInLocalStore.billDetailLocalData.isCancelled;
|
|
68
|
+
const lines = billInLocalStore.billDetailLocalData.updatesByLineId;
|
|
69
|
+
const updatedLines = Object.assign({}, lines);
|
|
70
|
+
const vendorCategory = vendor.accountId != null
|
|
71
|
+
? (0, accountSelector_1.getAccountBase)(state.accountState, vendor.accountId, 'account_list')
|
|
72
|
+
: undefined;
|
|
73
|
+
const vendorClass = vendor.classId != null
|
|
74
|
+
? (0, classSelector_1.getClassById)(state.classState, {
|
|
75
|
+
classId: vendor.classId,
|
|
76
|
+
reportId: 'class_list',
|
|
77
|
+
})
|
|
78
|
+
: undefined;
|
|
79
|
+
const vendorCurrencyCode = vendor.vendorCurrencyCode;
|
|
80
|
+
const vendorCurrencySymbol = vendor.vendorCurrencySymbol;
|
|
81
|
+
const { tenantState, companyState } = state;
|
|
82
|
+
const { currentTenantId } = tenantState;
|
|
83
|
+
const companyId = currentTenantId != null
|
|
84
|
+
? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.companyId
|
|
85
|
+
: undefined;
|
|
86
|
+
const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
|
|
87
|
+
const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
|
|
88
|
+
const isPayNowEnabled = payNowCutOffTime != null
|
|
89
|
+
? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
|
|
90
|
+
: false;
|
|
91
|
+
Object.keys(updatedLines).forEach((lineId) => {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
const line = lines[lineId];
|
|
94
|
+
updatedLines[lineId] = Object.assign(Object.assign({}, line), { account: Boolean((_a = line.account) === null || _a === void 0 ? void 0 : _a.accountId) === false && vendorCategory != null
|
|
95
|
+
? vendorCategory
|
|
96
|
+
: line.account, class: Boolean((_b = line.class) === null || _b === void 0 ? void 0 : _b.classId) === false && vendorClass != null
|
|
97
|
+
? vendorClass
|
|
98
|
+
: line.class });
|
|
99
|
+
});
|
|
100
|
+
//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
|
|
101
|
+
if (Object.keys(updatedLines).length === 0) {
|
|
102
|
+
updatedLines['1'] = Object.assign({ account: vendorCategory, class: vendorClass, amount: {
|
|
103
|
+
amount: 0,
|
|
104
|
+
currencyCode: vendorCurrencyCode,
|
|
105
|
+
currencySymbol: vendorCurrencySymbol,
|
|
106
|
+
}, 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);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
showVendorGptRecommendationText: false,
|
|
110
|
+
vendor: vendor,
|
|
111
|
+
isCancelled: isCancelled,
|
|
112
|
+
updatesByLineId: updatedLines,
|
|
113
|
+
whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode }),
|
|
114
|
+
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 :
|
|
115
|
+
//in case paymentDate is not present in the billDetailLocalData, then today/next working date will be considered.
|
|
116
|
+
//this is done beacuse we are doing similar calcualtion in getDefaultValues of editBillDetailPage.
|
|
117
|
+
(0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()) }),
|
|
118
|
+
isCollectToAccountInfoFromVendorContact: false,
|
|
119
|
+
isRecurring: false,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -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;
|
|
@@ -187,7 +188,9 @@ const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPaylo
|
|
|
187
188
|
const isPayNowEnabled = payNowCutOffTime != null
|
|
188
189
|
? (0, zeniDayJS_1.dateNow)().isSameOrBefore(payNowCutOffTime)
|
|
189
190
|
: false;
|
|
190
|
-
const fromAccountType = (
|
|
191
|
+
const fromAccountType = ((_l = billPayload.bill_pay_info) === null || _l === void 0 ? void 0 : _l.from_account.account_type) != null
|
|
192
|
+
? (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)((0, billPayConfigState_1.toAccType)((_m = billPayload.bill_pay_info) === null || _m === void 0 ? void 0 : _m.from_account.account_type))
|
|
193
|
+
: undefined;
|
|
191
194
|
const bookCloseDate = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyInfo.bookCloseDate;
|
|
192
195
|
const invoiceDate = Boolean(billPayload.transaction_date) === true
|
|
193
196
|
? (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
48
|
return card.cardName;
|
|
49
49
|
case 'department':
|
|
50
|
-
return (
|
|
50
|
+
return (_e = (_d = card.department) === null || _d === void 0 ? void 0 : _d.className) !== 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>;
|