@zeniai/client-epic-state 4.8.44 → 4.8.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  3. package/lib/epic.d.ts +3 -1
  4. package/lib/epic.js +3 -1
  5. package/lib/index.d.ts +5 -4
  6. package/lib/index.js +22 -15
  7. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +31 -4
  8. package/lib/view/dashboard/dashboardEpic.js +2 -3
  9. package/lib/view/dashboard/dashboardSelector.js +1 -1
  10. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  11. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  12. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  13. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  14. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  15. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +17 -0
  16. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +23 -0
  17. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +31 -0
  18. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +70 -0
  19. package/lib/view/settingsView/settingsViewHelpers.d.ts +2 -0
  20. package/lib/view/settingsView/settingsViewHelpers.js +11 -0
  21. package/lib/view/settingsView/settingsViewPayload.d.ts +7 -0
  22. package/lib/view/settingsView/settingsViewReducer.d.ts +7 -2
  23. package/lib/view/settingsView/settingsViewReducer.js +115 -2
  24. package/lib/view/settingsView/settingsViewSelector.d.ts +2 -0
  25. package/lib/view/settingsView/settingsViewSelector.js +4 -1
  26. package/lib/view/settingsView/settingsViewState.d.ts +18 -0
  27. package/lib/view/settingsView/settingsViewState.js +15 -0
  28. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -0
  29. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +24 -22
  30. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +1 -0
  31. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +1 -0
  32. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +1 -0
  33. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.d.ts +1 -1
  34. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +7 -2
  35. package/lib/view/spendManagement/helpers.js +11 -4
  36. package/lib/zeniAPI.d.ts +1 -0
  37. package/package.json +1 -1
@@ -32,7 +32,7 @@ export declare const inviteZeniPeopleEpic: (actions$: ActionsObservable<ActionTy
32
32
  type: string;
33
33
  } | {
34
34
  payload: {
35
- 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";
35
+ 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";
36
36
  messageText: "failed" | "success";
37
37
  type: import("../..").SnackbarMessageType;
38
38
  showStatusIcon?: boolean | undefined;
@@ -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,2 @@
1
+ import { NotificationSettings } from './settingsViewState';
2
+ export declare const isNotificationsTabVisible: (notificationSettingsView: NotificationSettings) => boolean;
@@ -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 { SettingsViewState } from './settingsViewState';
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>, clearSettingsView: 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;