@zeniai/client-epic-state 4.8.63 → 4.8.64

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 (68) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  3. package/lib/entity/tenant/tenantPayload.d.ts +5 -0
  4. package/lib/entity/userRole/userRolePayload.d.ts +5 -0
  5. package/lib/entity/userRole/userRolePayload.js +15 -0
  6. package/lib/entity/userRole/userRoleType.d.ts +18 -3
  7. package/lib/entity/userRole/userRoleType.js +226 -6
  8. package/lib/epic.d.ts +3 -1
  9. package/lib/epic.js +3 -1
  10. package/lib/index.d.ts +14 -12
  11. package/lib/index.js +52 -18
  12. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +31 -4
  13. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +5 -1
  14. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.js +18 -2
  15. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +14 -0
  16. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +36 -4
  17. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewState.d.ts +7 -0
  18. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  19. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  20. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  21. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  22. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  23. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +17 -0
  24. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +23 -0
  25. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +31 -0
  26. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +70 -0
  27. package/lib/view/settingsView/settingsViewHelpers.d.ts +2 -0
  28. package/lib/view/settingsView/settingsViewHelpers.js +11 -0
  29. package/lib/view/settingsView/settingsViewPayload.d.ts +7 -0
  30. package/lib/view/settingsView/settingsViewReducer.d.ts +7 -2
  31. package/lib/view/settingsView/settingsViewReducer.js +115 -2
  32. package/lib/view/settingsView/settingsViewSelector.d.ts +2 -0
  33. package/lib/view/settingsView/settingsViewSelector.js +4 -1
  34. package/lib/view/settingsView/settingsViewState.d.ts +18 -0
  35. package/lib/view/settingsView/settingsViewState.js +15 -0
  36. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +1 -0
  37. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +2 -1
  38. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +3 -0
  39. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +49 -24
  40. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +2 -0
  41. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +2 -0
  42. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +16 -9
  43. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.d.ts +1 -1
  44. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +21 -9
  45. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -1
  46. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +2 -1
  47. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +6 -3
  48. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +1 -1
  49. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +9 -6
  50. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -3
  51. package/lib/view/spendManagement/helpers.js +11 -4
  52. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +5 -1
  53. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -0
  54. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +8 -6
  55. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +2 -0
  56. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +7 -1
  57. package/lib/view/taskManager/taskListView/taskListSelector.js +1 -1
  58. package/lib/view/transactionList/fetchTransactionListByEntityEpic.js +3 -0
  59. package/lib/view/transactionList/transactionListByEntitySelector.d.ts +4 -0
  60. package/lib/view/transactionList/transactionListByEntitySelector.js +62 -1
  61. package/lib/view/transactionList/transactionListReducer.d.ts +2 -1
  62. package/lib/view/transactionList/transactionListReducer.js +2 -2
  63. package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorFirstReviewViewEpic.js +13 -10
  64. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewPayload.d.ts +1 -0
  65. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.d.ts +4 -3
  66. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +8 -6
  67. package/lib/zeniAPI.d.ts +1 -0
  68. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVendorsTabDetailPageView = exports.getVendorsTabVendorView = void 0;
3
+ exports.getVendorAllTransactionsDefaultTimePeriod = exports.getVendorsTabDetailPageView = exports.getVendorsTabVendorView = exports.toVendorDetailTabsTypeStrict = exports.toVendorDetailTabsType = void 0;
4
4
  const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
5
5
  const accountListSelector_1 = require("../../accountList/accountListSelector");
6
6
  const classListSelector_1 = require("../../classList/classListSelector");
@@ -9,6 +9,19 @@ const classSelector_1 = require("../../../entity/class/classSelector");
9
9
  const trendWithTransactionsSelector_1 = require("../../trendWithTransactions/trendWithTransactionsSelector");
10
10
  const userSelector_1 = require("../../../entity/user/userSelector");
11
11
  const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
12
+ const transactionListByEntitySelector_1 = require("../../transactionList/transactionListByEntitySelector");
13
+ const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
14
+ const addSubtractPeriod_1 = require("../../../commonStateTypes/fiscalYearHelpers/addSubtractPeriod");
15
+ const getStartOfAndEndOfTimeframeFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/getStartOfAndEndOfTimeframeFY");
16
+ const zeniDayJS_1 = require("../../../zeniDayJS");
17
+ const ALL_VENDOR_DETAIL_TABS_TYPES = [
18
+ 'spend_transactions',
19
+ 'all_transactions',
20
+ ];
21
+ const toVendorDetailTabsType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_VENDOR_DETAIL_TABS_TYPES);
22
+ exports.toVendorDetailTabsType = toVendorDetailTabsType;
23
+ const toVendorDetailTabsTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v !== null && v !== void 0 ? v : '', ALL_VENDOR_DETAIL_TABS_TYPES);
24
+ exports.toVendorDetailTabsTypeStrict = toVendorDetailTabsTypeStrict;
12
25
  const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
13
26
  var _a, _b, _c, _d, _e;
14
27
  const { accountListState, accountState, classListState, classState, vendorState, userState, vendorsTabVendorViewState, } = state;
@@ -73,23 +86,42 @@ const getBasicVendorDetails = (accountState, classState, userState, selectedVend
73
86
  id: selectedVendor.id,
74
87
  });
75
88
  const getVendorsTabDetailPageView = (state, vendorId, entity) => {
76
- var _a, _b;
89
+ var _a, _b, _c;
77
90
  const trendWithTransactions = (0, trendWithTransactionsSelector_1.getTrendWithTransactions)(state, entity, 'EntityDetail');
91
+ const vendorViewDetails = (0, exports.getVendorsTabVendorView)(state, vendorId);
92
+ const allVendorTransactions = ((_a = state.vendorsTabVendorViewState.allTransactionsTabData) === null || _a === void 0 ? void 0 : _a.timePeriod) != null
93
+ ? (0, transactionListByEntitySelector_1.getTransactionListByEntityForSinglePeriod)(state, entity, state.vendorsTabVendorViewState.allTransactionsTabData
94
+ .numberOfQuartersFetched)
95
+ : undefined;
78
96
  const reducedFetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
79
97
  state.accountListState.byReportId.accountList,
80
98
  state.classListState,
81
99
  state.ownerListState,
82
- (_b = (_a = state.vendorsTabVendorViewState.vendorStateById[vendorId]) === null || _a === void 0 ? void 0 : _a.fetchStatus) !== null && _b !== void 0 ? _b : {
100
+ (_c = (_b = state.vendorsTabVendorViewState.vendorStateById[vendorId]) === null || _b === void 0 ? void 0 : _b.fetchStatus) !== null && _c !== void 0 ? _c : {
83
101
  fetchState: 'Not-Started',
84
102
  },
85
103
  trendWithTransactions,
86
104
  ]);
87
105
  return {
88
- vendorViewDetails: (0, exports.getVendorsTabVendorView)(state, vendorId),
106
+ vendorViewDetails,
89
107
  trendWithTransactions,
108
+ allVendorTransactionsView: allVendorTransactions,
109
+ allTransactionsTabData: state.vendorsTabVendorViewState.allTransactionsTabData,
110
+ selectedTabType: state.vendorsTabVendorViewState.selectedTabType,
90
111
  vendorSpend: state.vendorExpenseState.spend,
91
112
  fetchState: reducedFetchState.fetchState,
92
113
  error: reducedFetchState.error,
93
114
  };
94
115
  };
95
116
  exports.getVendorsTabDetailPageView = getVendorsTabDetailPageView;
117
+ const getVendorAllTransactionsDefaultTimePeriod = (firstMonthOfFY, numberOfQuartersToGoBack) => {
118
+ const currentEndDate = (0, zeniDayJS_1.dateNow)().startOf('M');
119
+ const periodToLoadStartDate = (0, addSubtractPeriod_1.subtractPeriod)(currentEndDate, firstMonthOfFY, numberOfQuartersToGoBack, 'quarter');
120
+ const { startOfTimeframeFY: startDate, endOfTimeframeFY: endDate } = (0, getStartOfAndEndOfTimeframeFY_1.getStartOfAndEndOfTimeframeForFY)(periodToLoadStartDate, firstMonthOfFY, 'quarter');
121
+ const periodToLoad = {
122
+ startDate,
123
+ endDate,
124
+ };
125
+ return periodToLoad;
126
+ };
127
+ exports.getVendorAllTransactionsDefaultTimePeriod = getVendorAllTransactionsDefaultTimePeriod;
@@ -1,9 +1,16 @@
1
1
  import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
2
  import { Recommendation } from '../../../commonStateTypes/recommendationBase';
3
+ import { TimePeriod } from '../../../commonStateTypes/timePeriod';
3
4
  import { RecommendedAccountBase } from '../../../entity/account/accountState';
4
5
  import { RecommendedClassBase } from '../../../entity/class/classState';
6
+ import { VendorDetailTabsType } from './vendorsTabVendorViewSelector';
5
7
  export interface VendorsTabVendorViewState {
6
8
  vendorStateById: Record<ID, VendorsTabVendorDetailState>;
9
+ selectedTabType: VendorDetailTabsType;
10
+ allTransactionsTabData?: {
11
+ timePeriod: TimePeriod;
12
+ numberOfQuartersFetched: number;
13
+ };
7
14
  }
8
15
  export interface VendorsTabVendorDetailLocalData {
9
16
  vendorName?: string;
@@ -26,7 +26,7 @@ export declare const changeZeniPersonRolesEpic: (actions$: ActionsObservable<Act
26
26
  type: string;
27
27
  } | {
28
28
  payload: {
29
- 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";
29
+ 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" | "save_vendor_marked_as_employee" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "save_task_detail" | "delete_task" | "archive_task" | "update_charge_card" | "notification_settings_saved";
30
30
  messageText: "failed" | "success";
31
31
  type: import("../..").SnackbarMessageType;
32
32
  showStatusIcon?: boolean | undefined;
@@ -18,7 +18,7 @@ export declare const deletePersonEpic: (actions$: ActionsObservable<ActionType>,
18
18
  type: string;
19
19
  } | {
20
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";
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" | "save_vendor_marked_as_employee" | "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
22
  messageText: "failed" | "success";
23
23
  type: import("../..").SnackbarMessageType;
24
24
  showStatusIcon?: boolean | undefined;
@@ -35,7 +35,7 @@ export declare const invitePeopleEpic: (actions$: ActionsObservable<ActionType>,
35
35
  type: string;
36
36
  } | {
37
37
  payload: {
38
- 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";
38
+ 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" | "save_vendor_marked_as_employee" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "save_task_detail" | "delete_task" | "archive_task" | "update_charge_card" | "notification_settings_saved";
39
39
  messageText: "failed" | "success";
40
40
  type: import("../..").SnackbarMessageType;
41
41
  showStatusIcon?: boolean | undefined;
@@ -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" | "save_vendor_marked_as_employee" | "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" | "save_vendor_marked_as_employee" | "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" | "save_vendor_marked_as_employee" | "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 {};