@zeniai/client-epic-state 4.8.41 → 4.8.42
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/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +3 -1
- package/lib/index.d.ts +5 -4
- package/lib/index.js +22 -15
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +31 -4
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +17 -0
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +23 -0
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +31 -0
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +70 -0
- package/lib/view/settingsView/settingsViewHelpers.d.ts +2 -0
- package/lib/view/settingsView/settingsViewHelpers.js +11 -0
- package/lib/view/settingsView/settingsViewPayload.d.ts +7 -0
- package/lib/view/settingsView/settingsViewReducer.d.ts +7 -2
- package/lib/view/settingsView/settingsViewReducer.js +115 -2
- package/lib/view/settingsView/settingsViewSelector.d.ts +2 -0
- package/lib/view/settingsView/settingsViewSelector.js +4 -1
- package/lib/view/settingsView/settingsViewState.d.ts +18 -0
- package/lib/view/settingsView/settingsViewState.js +15 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +24 -22
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +1 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +1 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +1 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +7 -2
- package/lib/view/spendManagement/helpers.js +11 -4
- package/lib/zeniAPI.d.ts +1 -0
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ export declare const resendInviteEpic: (actions$: ActionsObservable<ActionType>,
|
|
|
13
13
|
type: string;
|
|
14
14
|
} | {
|
|
15
15
|
payload: {
|
|
16
|
-
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_monthEndEmailSent" | "cockpit_monthEndEmailSave" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "save_task_detail" | "delete_task" | "archive_task" | "update_charge_card";
|
|
16
|
+
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_monthEndEmailSent" | "cockpit_monthEndEmailSave" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "save_task_detail" | "delete_task" | "archive_task" | "update_charge_card" | "notification_settings_saved";
|
|
17
17
|
messageText: "failed" | "success";
|
|
18
18
|
type: import("../..").SnackbarMessageType;
|
|
19
19
|
showStatusIcon?: boolean | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { fetchNotificationSettings, updateNotificationSettingsOnSuccess, updateNotificationSettingsOnFailure } from '../settingsViewReducer';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { RootState } from '../../../reducer';
|
|
5
|
+
export declare type ActionType = ReturnType<typeof fetchNotificationSettings> | ReturnType<typeof updateNotificationSettingsOnSuccess> | ReturnType<typeof updateNotificationSettingsOnFailure>;
|
|
6
|
+
export declare const fetchNotificationSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
+
payload: undefined;
|
|
8
|
+
type: string;
|
|
9
|
+
} | {
|
|
10
|
+
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
11
|
+
type: string;
|
|
12
|
+
} | {
|
|
13
|
+
payload: {
|
|
14
|
+
data: import("../settingsViewPayload").NotificationSettingsPayload;
|
|
15
|
+
};
|
|
16
|
+
type: string;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchNotificationSettingsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
+
const fetchNotificationSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchNotificationSettings.match), (0, operators_1.switchMap)(() => {
|
|
9
|
+
const URL = `${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/notification-preferences`;
|
|
10
|
+
return zeniAPI.getJSON(URL).pipe((0, operators_1.mergeMap)((response) => {
|
|
11
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
12
|
+
const updateActions = [
|
|
13
|
+
(0, settingsViewReducer_1.updateNotificationSettingsOnSuccess)(response.data),
|
|
14
|
+
];
|
|
15
|
+
return (0, rxjs_1.of)(...updateActions);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return (0, rxjs_1.of)((0, settingsViewReducer_1.updateNotificationSettingsOnFailure)(response.status));
|
|
19
|
+
}
|
|
20
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateNotificationSettingsOnFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Fetch Notification Settings REST API call errored out' +
|
|
21
|
+
JSON.stringify(error))))));
|
|
22
|
+
}));
|
|
23
|
+
exports.fetchNotificationSettingsEpic = fetchNotificationSettingsEpic;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { saveNotificationSettings, updateNotificationSettingsOnSaveFailure, updateNotificationSettingsOnSaveSuccess } from '../settingsViewReducer';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { RootState } from '../../../reducer';
|
|
5
|
+
import { NotificationSettingsPayload } from '../settingsViewPayload';
|
|
6
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof saveNotificationSettings> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateNotificationSettingsOnSaveSuccess> | ReturnType<typeof updateNotificationSettingsOnSaveFailure>;
|
|
8
|
+
export declare const saveNotificationSettingsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
9
|
+
payload: undefined;
|
|
10
|
+
type: string;
|
|
11
|
+
} | {
|
|
12
|
+
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
13
|
+
type: string;
|
|
14
|
+
} | {
|
|
15
|
+
payload: {
|
|
16
|
+
data: NotificationSettingsPayload;
|
|
17
|
+
};
|
|
18
|
+
type: string;
|
|
19
|
+
} | {
|
|
20
|
+
payload: {
|
|
21
|
+
messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_monthEndEmailSent" | "cockpit_monthEndEmailSave" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "save_task_detail" | "delete_task" | "archive_task" | "update_charge_card" | "notification_settings_saved";
|
|
22
|
+
messageText: "failed" | "success";
|
|
23
|
+
type: import("../../..").SnackbarMessageType;
|
|
24
|
+
showStatusIcon?: boolean | undefined;
|
|
25
|
+
variables?: {
|
|
26
|
+
variableName: string;
|
|
27
|
+
variableValue: string;
|
|
28
|
+
}[] | undefined;
|
|
29
|
+
};
|
|
30
|
+
type: string;
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveNotificationSettingsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
|
+
const saveNotificationSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveNotificationSettings.match), (0, operators_1.switchMap)(() => {
|
|
10
|
+
const URL = `${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/notification-preferences`;
|
|
11
|
+
const { notificationSettings, notificationSettingsLocalData } = state$.value.settingsViewState.notification;
|
|
12
|
+
const payload = toSaveNotificationSettingsPayload(notificationSettingsLocalData, notificationSettings);
|
|
13
|
+
return zeniAPI
|
|
14
|
+
.putAndGetJSON(URL, payload)
|
|
15
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
17
|
+
const updateActions = [
|
|
18
|
+
(0, settingsViewReducer_1.updateNotificationSettingsOnSaveSuccess)({ data: response.data }),
|
|
19
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
20
|
+
messageSection: 'notification_settings_saved',
|
|
21
|
+
messageText: 'success',
|
|
22
|
+
type: 'success',
|
|
23
|
+
}),
|
|
24
|
+
];
|
|
25
|
+
return (0, rxjs_1.of)(...updateActions);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return (0, rxjs_1.of)((0, settingsViewReducer_1.updateNotificationSettingsOnSaveFailure)(response.status));
|
|
29
|
+
}
|
|
30
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateNotificationSettingsOnSaveFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Save Notification Settings REST API call errored out' +
|
|
31
|
+
JSON.stringify(error))))));
|
|
32
|
+
}));
|
|
33
|
+
exports.saveNotificationSettingsEpic = saveNotificationSettingsEpic;
|
|
34
|
+
function toSaveNotificationSettingsPayload(localData, notificationSettingsData) {
|
|
35
|
+
const payload = {};
|
|
36
|
+
if (localData.reminders.isMissingReceiptNotificationActive != null &&
|
|
37
|
+
notificationSettingsData.missingReceiptNotification != null) {
|
|
38
|
+
payload.is_missing_receipt_notification_active =
|
|
39
|
+
localData.reminders.isMissingReceiptNotificationActive;
|
|
40
|
+
payload.missing_receipt_notification = {
|
|
41
|
+
preferred_mode: ['email'],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (localData.reminders.isPendingBillApprovalNotificationActive != null &&
|
|
45
|
+
notificationSettingsData.pendingBillApprovalNotification != null) {
|
|
46
|
+
payload.is_pending_bill_approval_notification_active =
|
|
47
|
+
localData.reminders.isPendingBillApprovalNotificationActive;
|
|
48
|
+
payload.pending_bill_approval_notification = {
|
|
49
|
+
preferred_mode: ['email'],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (localData.reminders.isUncategorizedTransactionNotificationActive != null &&
|
|
53
|
+
notificationSettingsData.uncategorizedTransactionNotification != null) {
|
|
54
|
+
payload.is_uncategorized_transaction_notification_active =
|
|
55
|
+
localData.reminders.isUncategorizedTransactionNotificationActive;
|
|
56
|
+
payload.uncategorized_transaction_notification = {
|
|
57
|
+
preferred_mode: ['email'],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (localData.reminders.isPendingReimbursementApprovalNotificationActive !=
|
|
61
|
+
null &&
|
|
62
|
+
notificationSettingsData.pendingReimbursementApprovalNotification != null) {
|
|
63
|
+
payload.is_pending_reimbursement_approval_notification_active =
|
|
64
|
+
localData.reminders.isPendingReimbursementApprovalNotificationActive;
|
|
65
|
+
payload.pending_reimbursement_approval_notification = {
|
|
66
|
+
preferred_mode: ['email'],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return payload;
|
|
70
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNotificationsTabVisible = void 0;
|
|
4
|
+
const isNotificationsTabVisible = (notificationSettingsView) => {
|
|
5
|
+
const { notificationSettings } = notificationSettingsView;
|
|
6
|
+
return (notificationSettings.missingReceiptNotification != null ||
|
|
7
|
+
notificationSettings.pendingBillApprovalNotification != null ||
|
|
8
|
+
notificationSettings.pendingReimbursementApprovalNotification != null ||
|
|
9
|
+
notificationSettings.uncategorizedTransactionNotification != null);
|
|
10
|
+
};
|
|
11
|
+
exports.isNotificationsTabVisible = isNotificationsTabVisible;
|
|
@@ -6,3 +6,10 @@ export interface MyProfilePeoplePayload {
|
|
|
6
6
|
users: UserPayload[];
|
|
7
7
|
}
|
|
8
8
|
export declare type MyProfilePeopleResponse = ZeniAPIResponse<MyProfilePeoplePayload>;
|
|
9
|
+
export interface NotificationSettingsPayload {
|
|
10
|
+
is_missing_receipt_notification_active: boolean | null;
|
|
11
|
+
is_pending_bill_approval_notification_active: boolean | null;
|
|
12
|
+
is_pending_reimbursement_approval_notification_active: boolean | null;
|
|
13
|
+
is_uncategorized_transaction_notification_active: boolean | null;
|
|
14
|
+
}
|
|
15
|
+
export declare type NotificationSettingsResponse = ZeniAPIResponse<NotificationSettingsPayload>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { SettingsViewState, NotificationSettingsLocalData } from './settingsViewState';
|
|
1
2
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
-
import {
|
|
3
|
+
import { NotificationSettingsPayload } from './settingsViewPayload';
|
|
3
4
|
import { ID } from '../../commonStateTypes/common';
|
|
4
5
|
export declare const initialState: SettingsViewState;
|
|
5
6
|
export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
|
|
@@ -8,6 +9,10 @@ export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreato
|
|
|
8
9
|
userId: string;
|
|
9
10
|
}, string, never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankConnectionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateBankConnectionOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
10
11
|
bankAccountIds: ID[];
|
|
11
|
-
}, string>, updateBankConnectionOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankAccountsList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>,
|
|
12
|
+
}, string>, updateBankConnectionOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankAccountsList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, fetchNotificationSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateNotificationSettingsOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[data: NotificationSettingsPayload], {
|
|
13
|
+
data: NotificationSettingsPayload;
|
|
14
|
+
}, string, never, never>, updateNotificationSettingsOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, updateNotificationSettingsLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<NotificationSettingsLocalData, string>, resetNotificationSettingsLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, saveNotificationSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateNotificationSettingsOnSaveSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
15
|
+
data: NotificationSettingsPayload;
|
|
16
|
+
}, string>, updateNotificationSettingsOnSaveFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, clearSettingsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
12
17
|
declare const _default: import("@reduxjs/toolkit").Reducer<SettingsViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
13
18
|
export default _default;
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearSettingsView = 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.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const initialNotificationSettingsData = {
|
|
7
|
+
missingReceiptNotification: null,
|
|
8
|
+
uncategorizedTransactionNotification: null,
|
|
9
|
+
pendingBillApprovalNotification: null,
|
|
10
|
+
pendingReimbursementApprovalNotification: null,
|
|
11
|
+
};
|
|
12
|
+
const initialNotificationSettingsLocalData = {
|
|
13
|
+
reminders: {
|
|
14
|
+
isMissingReceiptNotificationActive: null,
|
|
15
|
+
isUncategorizedTransactionNotificationActive: null,
|
|
16
|
+
isPendingReimbursementApprovalNotificationActive: null,
|
|
17
|
+
isPendingBillApprovalNotificationActive: null,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
6
20
|
exports.initialState = {
|
|
7
21
|
profile: {
|
|
8
22
|
fetchState: 'Not-Started',
|
|
@@ -14,6 +28,16 @@ exports.initialState = {
|
|
|
14
28
|
error: undefined,
|
|
15
29
|
bankAccountIds: [],
|
|
16
30
|
},
|
|
31
|
+
notification: {
|
|
32
|
+
fetchState: 'Not-Started',
|
|
33
|
+
error: undefined,
|
|
34
|
+
updateStatus: {
|
|
35
|
+
fetchState: 'Not-Started',
|
|
36
|
+
error: undefined,
|
|
37
|
+
},
|
|
38
|
+
notificationSettings: Object.assign({}, initialNotificationSettingsData),
|
|
39
|
+
notificationSettingsLocalData: Object.assign({}, initialNotificationSettingsLocalData),
|
|
40
|
+
},
|
|
17
41
|
};
|
|
18
42
|
const settings = (0, toolkit_1.createSlice)({
|
|
19
43
|
name: 'settings',
|
|
@@ -62,10 +86,99 @@ const settings = (0, toolkit_1.createSlice)({
|
|
|
62
86
|
draft.bankConnection.fetchState = 'Error';
|
|
63
87
|
draft.bankConnection.error = action.payload;
|
|
64
88
|
},
|
|
89
|
+
fetchNotificationSettings(draft) {
|
|
90
|
+
draft.notification.fetchState = 'In-Progress';
|
|
91
|
+
draft.notification.error = undefined;
|
|
92
|
+
},
|
|
93
|
+
updateNotificationSettingsOnSuccess: {
|
|
94
|
+
prepare(data) {
|
|
95
|
+
return {
|
|
96
|
+
payload: {
|
|
97
|
+
data,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
reducer(draft, action) {
|
|
102
|
+
const { data } = action.payload;
|
|
103
|
+
const notificationSettings = toNotificationSettings(data);
|
|
104
|
+
draft.notification.fetchState = 'Completed';
|
|
105
|
+
draft.notification.error = undefined;
|
|
106
|
+
draft.notification.notificationSettings = notificationSettings;
|
|
107
|
+
draft.notification.notificationSettingsLocalData =
|
|
108
|
+
toNotificationSettingsLocalData(notificationSettings);
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
updateNotificationSettingsOnFailure(draft, action) {
|
|
112
|
+
draft.notification.fetchState = 'Error';
|
|
113
|
+
draft.notification.error = action.payload;
|
|
114
|
+
},
|
|
115
|
+
updateNotificationSettingsLocalData(draft, action) {
|
|
116
|
+
draft.notification.notificationSettingsLocalData = action.payload;
|
|
117
|
+
},
|
|
118
|
+
resetNotificationSettingsLocalData(draft) {
|
|
119
|
+
draft.notification.notificationSettingsLocalData =
|
|
120
|
+
toNotificationSettingsLocalData(draft.notification.notificationSettings);
|
|
121
|
+
},
|
|
122
|
+
saveNotificationSettings(draft) {
|
|
123
|
+
draft.notification.updateStatus.fetchState = 'In-Progress';
|
|
124
|
+
draft.notification.error = undefined;
|
|
125
|
+
},
|
|
126
|
+
updateNotificationSettingsOnSaveSuccess(draft, action) {
|
|
127
|
+
const { data } = action.payload;
|
|
128
|
+
draft.notification.updateStatus.fetchState = 'Completed';
|
|
129
|
+
draft.notification.updateStatus.error = undefined;
|
|
130
|
+
draft.notification.notificationSettings = toNotificationSettings(data);
|
|
131
|
+
},
|
|
132
|
+
updateNotificationSettingsOnSaveFailure(draft, action) {
|
|
133
|
+
draft.notification.updateStatus.fetchState = 'Error';
|
|
134
|
+
draft.notification.updateStatus.error = action.payload;
|
|
135
|
+
},
|
|
65
136
|
clearSettingsView(draft) {
|
|
66
137
|
Object.assign(draft, exports.initialState);
|
|
67
138
|
},
|
|
68
139
|
},
|
|
69
140
|
});
|
|
70
|
-
_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.clearSettingsView = _a.clearSettingsView;
|
|
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;
|
|
71
142
|
exports.default = settings.reducer;
|
|
143
|
+
const toNotificationSettings = (data) => {
|
|
144
|
+
const notificationSettingsData = Object.assign({}, initialNotificationSettingsData);
|
|
145
|
+
if (data.is_missing_receipt_notification_active != null) {
|
|
146
|
+
notificationSettingsData.missingReceiptNotification = {
|
|
147
|
+
active: data.is_missing_receipt_notification_active,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if (data.is_pending_bill_approval_notification_active != null) {
|
|
151
|
+
notificationSettingsData.pendingBillApprovalNotification = {
|
|
152
|
+
active: data.is_pending_bill_approval_notification_active,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if (data.is_pending_reimbursement_approval_notification_active != null) {
|
|
156
|
+
notificationSettingsData.pendingReimbursementApprovalNotification = {
|
|
157
|
+
active: data.is_pending_reimbursement_approval_notification_active,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (data.is_uncategorized_transaction_notification_active != null) {
|
|
161
|
+
notificationSettingsData.uncategorizedTransactionNotification = {
|
|
162
|
+
active: data.is_uncategorized_transaction_notification_active,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return notificationSettingsData;
|
|
166
|
+
};
|
|
167
|
+
const toNotificationSettingsLocalData = (data) => {
|
|
168
|
+
return {
|
|
169
|
+
reminders: {
|
|
170
|
+
isMissingReceiptNotificationActive: data.missingReceiptNotification != null
|
|
171
|
+
? data.missingReceiptNotification.active
|
|
172
|
+
: null,
|
|
173
|
+
isPendingBillApprovalNotificationActive: data.pendingBillApprovalNotification != null
|
|
174
|
+
? data.pendingBillApprovalNotification.active
|
|
175
|
+
: null,
|
|
176
|
+
isPendingReimbursementApprovalNotificationActive: data.pendingReimbursementApprovalNotification != null
|
|
177
|
+
? data.pendingReimbursementApprovalNotification.active
|
|
178
|
+
: null,
|
|
179
|
+
isUncategorizedTransactionNotificationActive: data.uncategorizedTransactionNotification != null
|
|
180
|
+
? data.uncategorizedTransactionNotification.active
|
|
181
|
+
: null,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
};
|
|
@@ -3,6 +3,7 @@ import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
|
3
3
|
import { TenantExternalConnections } from '../../entity/tenant/tenantState';
|
|
4
4
|
import { Company } from '../../entity/company/companyStateTypes';
|
|
5
5
|
import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView } from './types/settingsViewSelectorTypes';
|
|
6
|
+
import { NotificationSettings } from './settingsViewState';
|
|
6
7
|
export declare function getApprovalRuleViewDetails(state: RootState): FetchStateAndError;
|
|
7
8
|
export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID): BankConnectionsSetupView;
|
|
8
9
|
export declare function getMyBankConnectionsDetails(state: RootState, userId: ID): MyBankConnectionsView;
|
|
@@ -12,3 +13,4 @@ export interface IntegrationsView {
|
|
|
12
13
|
}
|
|
13
14
|
export declare function getIntegrationsView(state: RootState, companyId: ID): IntegrationsView;
|
|
14
15
|
export declare const getMyProfileView: (state: RootState) => MyProfileSelectorView;
|
|
16
|
+
export declare const getNotificationSettingsView: (state: RootState) => NotificationSettings;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMyProfileView = exports.getIntegrationsView = exports.getMyBankConnectionsDetails = exports.getBankConnectionsSetupViewDetails = exports.getApprovalRuleViewDetails = void 0;
|
|
3
|
+
exports.getNotificationSettingsView = exports.getMyProfileView = exports.getIntegrationsView = exports.getMyBankConnectionsDetails = exports.getBankConnectionsSetupViewDetails = exports.getApprovalRuleViewDetails = void 0;
|
|
4
4
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
5
|
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
6
6
|
const companySelector_1 = require("../../entity/company/companySelector");
|
|
@@ -117,3 +117,6 @@ exports.getMyProfileView = (0, toolkit_1.createSelector)((state) => state.tenant
|
|
|
117
117
|
}
|
|
118
118
|
return myProfilePeopleView;
|
|
119
119
|
});
|
|
120
|
+
exports.getNotificationSettingsView = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (settingsViewState) => {
|
|
121
|
+
return settingsViewState.notification;
|
|
122
|
+
});
|
|
@@ -5,8 +5,26 @@ interface MyProfile extends FetchStateAndError {
|
|
|
5
5
|
interface BankConnection extends FetchStateAndError {
|
|
6
6
|
bankAccountIds: ID[];
|
|
7
7
|
}
|
|
8
|
+
declare const toReminderTypeKey: (v: string) => "missingReceiptNotification" | "uncategorizedTransactionNotification" | "pendingBillApprovalNotification" | "pendingReimbursementApprovalNotification";
|
|
9
|
+
declare type ReminderTypeKey = ReturnType<typeof toReminderTypeKey>;
|
|
10
|
+
declare const toReminderFlagTypeKey: (v: string) => "isMissingReceiptNotificationActive" | "isUncategorizedTransactionNotificationActive" | "isPendingBillApprovalNotificationActive" | "isPendingReimbursementApprovalNotificationActive";
|
|
11
|
+
declare type ReminderFlagTypeKey = ReturnType<typeof toReminderFlagTypeKey>;
|
|
12
|
+
export declare type ReminderNotificationSettingsLocalData = Record<ReminderFlagTypeKey, boolean | null>;
|
|
13
|
+
export interface NotificationSettingsLocalData {
|
|
14
|
+
reminders: ReminderNotificationSettingsLocalData;
|
|
15
|
+
}
|
|
16
|
+
interface ReminderNotificationSettingDetails {
|
|
17
|
+
active: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare type ReminderNotificationSettingsData = Record<ReminderTypeKey, ReminderNotificationSettingDetails | null>;
|
|
20
|
+
export interface NotificationSettings extends FetchStateAndError {
|
|
21
|
+
notificationSettings: ReminderNotificationSettingsData;
|
|
22
|
+
notificationSettingsLocalData: NotificationSettingsLocalData;
|
|
23
|
+
updateStatus: FetchStateAndError;
|
|
24
|
+
}
|
|
8
25
|
export interface SettingsViewState {
|
|
9
26
|
profile: MyProfile;
|
|
10
27
|
bankConnection: BankConnection;
|
|
28
|
+
notification: NotificationSettings;
|
|
11
29
|
}
|
|
12
30
|
export {};
|
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
4
|
+
const REMINDER_NOTIFICATION_TYPES = [
|
|
5
|
+
'missingReceiptNotification',
|
|
6
|
+
'uncategorizedTransactionNotification',
|
|
7
|
+
'pendingBillApprovalNotification',
|
|
8
|
+
'pendingReimbursementApprovalNotification',
|
|
9
|
+
];
|
|
10
|
+
const REMINDER_NOTIFICATION_FLAG_TYPES = [
|
|
11
|
+
'isMissingReceiptNotificationActive',
|
|
12
|
+
'isUncategorizedTransactionNotificationActive',
|
|
13
|
+
'isPendingBillApprovalNotificationActive',
|
|
14
|
+
'isPendingReimbursementApprovalNotificationActive',
|
|
15
|
+
];
|
|
16
|
+
const toReminderTypeKey = (v) => (0, stringToUnion_1.stringToUnion)(v, REMINDER_NOTIFICATION_TYPES);
|
|
17
|
+
const toReminderFlagTypeKey = (v) => (0, stringToUnion_1.stringToUnion)(v, REMINDER_NOTIFICATION_FLAG_TYPES);
|
|
@@ -74,6 +74,7 @@ export interface EditBillDetailSelectorView extends SelectorView {
|
|
|
74
74
|
billPayConfigList: BillPayConfig[];
|
|
75
75
|
file: Attachment | undefined;
|
|
76
76
|
previousBills: PreviousBillsSelectorView;
|
|
77
|
+
showVendorGptRecommendationText: boolean;
|
|
77
78
|
isCancelled: boolean;
|
|
78
79
|
isDeleted: boolean;
|
|
79
80
|
showAutofill: boolean;
|
|
@@ -30,7 +30,7 @@ const transferDetailSelector_1 = require("../../zeniAccounts/transferDetail/tran
|
|
|
30
30
|
const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
|
|
31
31
|
const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
|
|
32
32
|
const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAccountsEnabled, billId) => {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
34
34
|
const { accountListState, accountState, bankAccountState, billDetailViewState, setupViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, recurringBillState, depositAccountListState, depositAccountState, } = state;
|
|
35
35
|
const transaction = (0, get_1.default)(billTransactionState.transactionById, billId !== null && billId !== void 0 ? billId : '', undefined);
|
|
36
36
|
let recommendations = {};
|
|
@@ -41,6 +41,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
41
41
|
const sourceBillDetail = billId != null
|
|
42
42
|
? (_a = editBillDetailViewState.editBillStateById) === null || _a === void 0 ? void 0 : _a[key]
|
|
43
43
|
: editBillDetailViewState.newBillState;
|
|
44
|
+
const showVendorGptRecommendationText = (_b = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.showVendorGptRecommendationText) !== null && _b !== void 0 ? _b : false;
|
|
44
45
|
let vendorDetails;
|
|
45
46
|
let recommendedVendor;
|
|
46
47
|
let lastRecommendedVendorName;
|
|
@@ -91,10 +92,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
91
92
|
let qboId;
|
|
92
93
|
const { currentTenantId } = tenantState;
|
|
93
94
|
const bookCloseDate = currentTenantId != null
|
|
94
|
-
? (
|
|
95
|
+
? (_d = (_c = tenantState.tenantsById) === null || _c === void 0 ? void 0 : _c[currentTenantId]) === null || _d === void 0 ? void 0 : _d.bookCloseDate
|
|
95
96
|
: undefined;
|
|
96
97
|
const companyId = currentTenantId != null
|
|
97
|
-
? (
|
|
98
|
+
? (_f = (_e = tenantState.tenantsById) === null || _e === void 0 ? void 0 : _e[currentTenantId]) === null || _f === void 0 ? void 0 : _f.companyId
|
|
98
99
|
: undefined;
|
|
99
100
|
const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
|
|
100
101
|
const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
|
|
@@ -116,15 +117,15 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
116
117
|
let recurringConfig;
|
|
117
118
|
let recurringBillInstances;
|
|
118
119
|
if (billId != null) {
|
|
119
|
-
isDeleted = (
|
|
120
|
-
createdBy = (0, userSelector_1.getUserByUserId)(userState, (
|
|
120
|
+
isDeleted = (_g = transaction === null || transaction === void 0 ? void 0 : transaction.isDeleted) !== null && _g !== void 0 ? _g : false;
|
|
121
|
+
createdBy = (0, userSelector_1.getUserByUserId)(userState, (_h = transaction === null || transaction === void 0 ? void 0 : transaction.createdBy) !== null && _h !== void 0 ? _h : '');
|
|
121
122
|
createTime = transaction === null || transaction === void 0 ? void 0 : transaction.createTime;
|
|
122
|
-
qboId = (
|
|
123
|
+
qboId = (_j = transaction === null || transaction === void 0 ? void 0 : transaction.account) === null || _j === void 0 ? void 0 : _j.qboId;
|
|
123
124
|
billPayInfo = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo;
|
|
124
125
|
toAccountVendorEmail = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccountVendorEmail;
|
|
125
126
|
isCollectToAccountInfoFromVendorContact =
|
|
126
|
-
(
|
|
127
|
-
const initialVendor = (0, vendorSelector_1.getVendorByQboId)(vendorState, (
|
|
127
|
+
(_k = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.isCollectToAccountInfoFromVendorContact) !== null && _k !== void 0 ? _k : false;
|
|
128
|
+
const initialVendor = (0, vendorSelector_1.getVendorByQboId)(vendorState, (_m = (_l = transaction === null || transaction === void 0 ? void 0 : transaction.vendor) === null || _l === void 0 ? void 0 : _l.id) !== null && _m !== void 0 ? _m : '');
|
|
128
129
|
const initialWhatForSection = {
|
|
129
130
|
invoiceNumber: transaction === null || transaction === void 0 ? void 0 : transaction.documentId,
|
|
130
131
|
invoiceDate: transaction === null || transaction === void 0 ? void 0 : transaction.date,
|
|
@@ -133,7 +134,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
133
134
|
};
|
|
134
135
|
const updatesByLineId = {};
|
|
135
136
|
if (accountList.fetchState === 'Completed') {
|
|
136
|
-
(
|
|
137
|
+
(_o = transaction === null || transaction === void 0 ? void 0 : transaction.lines) === null || _o === void 0 ? void 0 : _o.forEach((line) => {
|
|
137
138
|
var _a;
|
|
138
139
|
updatesByLineId[line.id] = Object.assign(Object.assign({}, line), { account: (_a = accountList.accounts.find((account) => {
|
|
139
140
|
var _a;
|
|
@@ -143,10 +144,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
const initialPaymentDetailsSection = {
|
|
146
|
-
paymentType: (0, exports.getPaymentMethodType)(billPayConfigState, (
|
|
147
|
+
paymentType: (0, exports.getPaymentMethodType)(billPayConfigState, (_p = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _p !== void 0 ? _p : 'depositAccount', billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.billPaymentMethodType, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.internationalTransferFeeBearerPaymentMethod),
|
|
147
148
|
paymentDate: billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.paymentDate,
|
|
148
|
-
withdrawFrom: (0, exports.getWithdrawFrom)(paymentAccountState, depositAccountState, (
|
|
149
|
-
paymentTo: ((
|
|
149
|
+
withdrawFrom: (0, exports.getWithdrawFrom)(paymentAccountState, depositAccountState, (_q = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountId) !== null && _q !== void 0 ? _q : '', (_r = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _r !== void 0 ? _r : ''),
|
|
150
|
+
paymentTo: ((_s = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId) === null || _s === void 0 ? void 0 : _s.length) != null &&
|
|
150
151
|
(billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId.length) > 0
|
|
151
152
|
? billPayInfo.toAccount.billAccountId
|
|
152
153
|
: undefined,
|
|
@@ -163,7 +164,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
163
164
|
if (sourceBillDetail != null) {
|
|
164
165
|
const billViewState = billDetailViewState.billDetailById[key];
|
|
165
166
|
isCancelled = sourceBillDetail.billDetailLocalData.isCancelled;
|
|
166
|
-
billStage = (
|
|
167
|
+
billStage = (_t = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code) !== null && _t !== void 0 ? _t : 'draft';
|
|
167
168
|
if (billViewState != null) {
|
|
168
169
|
fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
169
170
|
sourceBillDetail.fetchStatus,
|
|
@@ -175,7 +176,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
//recurringBill Details
|
|
178
|
-
isRecurring = (
|
|
179
|
+
isRecurring = (_u = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _u !== void 0 ? _u : false;
|
|
179
180
|
if (isRecurring && transaction != null) {
|
|
180
181
|
const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, exports.getRecurringBillLocalData)(recurringBillState, transaction);
|
|
181
182
|
recurringConfig = recurringConfigLocalData;
|
|
@@ -205,9 +206,9 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
205
206
|
? (0, vendorSelector_1.getVendorByVendorId)(vendorState, updatedRecord.vendor.id)
|
|
206
207
|
: undefined;
|
|
207
208
|
file = updatedRecord.file;
|
|
208
|
-
const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (
|
|
209
|
-
const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (
|
|
210
|
-
const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (
|
|
209
|
+
const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_w = (_v = updatedRecord.paymentDetailsSection) === null || _v === void 0 ? void 0 : _v.paymentTo) !== null && _w !== void 0 ? _w : '');
|
|
210
|
+
const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_x = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _x !== void 0 ? _x : []);
|
|
211
|
+
const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_y = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _y !== void 0 ? _y : []);
|
|
211
212
|
const isBankAccInBillExistInVendor = bankAccInBill != null
|
|
212
213
|
? vendorBankAccounts
|
|
213
214
|
.map((bankAc) => bankAc.bankAccountId)
|
|
@@ -257,7 +258,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
257
258
|
(recommendedVendor === null || recommendedVendor === void 0 ? void 0 : recommendedVendor.vendorCurrencyCode) != null) {
|
|
258
259
|
whatForSection.currencyCode = recommendedVendor.vendorCurrencyCode;
|
|
259
260
|
}
|
|
260
|
-
isRecurring = (
|
|
261
|
+
isRecurring = (_z = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _z !== void 0 ? _z : false;
|
|
261
262
|
recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
|
|
262
263
|
recurringBillInstances =
|
|
263
264
|
sourceBillDetail.billDetailLocalData.recurringBillInstances;
|
|
@@ -277,7 +278,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
277
278
|
}
|
|
278
279
|
const vendorContactSaveStatus = editBillDetailViewState.updateVendorContactState;
|
|
279
280
|
const lineDetailSection = {};
|
|
280
|
-
const lineDetailSectionUpdatesByLineId = (
|
|
281
|
+
const lineDetailSectionUpdatesByLineId = (_1 = (_0 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _0 === void 0 ? void 0 : _0.updatesByLineId) !== null && _1 !== void 0 ? _1 : {};
|
|
281
282
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
282
283
|
if (accountList.fetchState === 'Completed') {
|
|
283
284
|
Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
|
|
@@ -299,13 +300,14 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
299
300
|
const classHeirarchyList = (0, classListSelector_1.getNestedClassListHeirarchy)(classListState);
|
|
300
301
|
const duplicateBills = (0, billPayReviewSelector_1.getDuplicateBills)(state, billId);
|
|
301
302
|
return {
|
|
303
|
+
showVendorGptRecommendationText,
|
|
302
304
|
recommendedVendor,
|
|
303
305
|
lastRecommendedVendorName,
|
|
304
306
|
duplicateBills,
|
|
305
307
|
fetchState: fetchState,
|
|
306
|
-
saveStatus: (
|
|
307
|
-
error: (
|
|
308
|
-
uploadStatus: (
|
|
308
|
+
saveStatus: (_2 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _2 !== void 0 ? _2 : undefined,
|
|
309
|
+
error: (_4 = (_3 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.fetchStatus) === null || _3 === void 0 ? void 0 : _3.error) !== null && _4 !== void 0 ? _4 : undefined,
|
|
310
|
+
uploadStatus: (_5 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _5 !== void 0 ? _5 : undefined,
|
|
309
311
|
version: 0,
|
|
310
312
|
createdBy,
|
|
311
313
|
createTime,
|
|
@@ -45,6 +45,7 @@ export interface RecurringBillInstance {
|
|
|
45
45
|
billPaymentStatus?: RecurringBillPaymentStatus;
|
|
46
46
|
}
|
|
47
47
|
export interface BillDetailLocalData {
|
|
48
|
+
showVendorGptRecommendationText: boolean;
|
|
48
49
|
vendor?: Vendor;
|
|
49
50
|
candidateVendorname?: string;
|
|
50
51
|
whatForSection?: WhatForSection;
|