@zeniai/client-epic-state 4.9.74 → 4.9.75

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 (56) hide show
  1. package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +2 -2
  2. package/lib/entity/chargeCard/chargeCard.d.ts +2 -2
  3. package/lib/epic.d.ts +5 -1
  4. package/lib/epic.js +5 -1
  5. package/lib/index.d.ts +12 -11
  6. package/lib/index.js +28 -16
  7. package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.d.ts +2 -2
  8. package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.js +1 -0
  9. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +1 -8
  10. package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +1 -1
  11. package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +5 -2
  12. package/lib/view/companyView/companyViewPayload.d.ts +8 -0
  13. package/lib/view/companyView/companyViewReducer.d.ts +2 -1
  14. package/lib/view/companyView/companyViewReducer.js +24 -2
  15. package/lib/view/companyView/companyViewState.d.ts +2 -0
  16. package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +5 -0
  17. package/lib/view/companyView/epic/fetchCompanyMetaDataEpic.d.ts +7 -0
  18. package/lib/view/companyView/epic/fetchCompanyMetaDataEpic.js +24 -0
  19. package/lib/view/companyView/selector/companyManagementViewSelector.d.ts +1 -0
  20. package/lib/view/companyView/selector/companyManagementViewSelector.js +3 -2
  21. package/lib/view/companyView/types/companyMetaDataViewState.d.ts +12 -0
  22. package/lib/view/companyView/types/companyMetaDataViewState.js +14 -0
  23. package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +7 -4
  24. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +2 -1
  25. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +8 -2
  26. package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.d.ts +6 -0
  27. package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.js +16 -0
  28. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +42 -28
  29. package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -2
  30. package/lib/view/settingsView/settingsViewHelpers.js +18 -7
  31. package/lib/view/settingsView/settingsViewPayload.d.ts +10 -0
  32. package/lib/view/settingsView/settingsViewReducer.d.ts +6 -3
  33. package/lib/view/settingsView/settingsViewReducer.js +87 -49
  34. package/lib/view/settingsView/settingsViewSelector.d.ts +3 -8
  35. package/lib/view/settingsView/settingsViewSelector.js +18 -2
  36. package/lib/view/settingsView/settingsViewState.d.ts +31 -8
  37. package/lib/view/settingsView/settingsViewState.js +9 -9
  38. package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +12 -0
  39. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -1
  40. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +4 -1
  41. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +7 -1
  42. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +21 -2
  43. package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.d.ts +10 -0
  44. package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js +141 -0
  45. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +4 -1
  46. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +4 -4
  47. package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.d.ts +7 -0
  48. package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.js +40 -0
  49. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailPayload.d.ts +15 -0
  50. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailPayload.js +11 -0
  51. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.d.ts +2 -1
  52. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.js +33 -2
  53. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.d.ts +2 -1
  54. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +2 -1
  55. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailState.d.ts +13 -0
  56. package/package.json +1 -1
@@ -19,7 +19,9 @@ const sortedJETransactionsView = (jeTransactions, sortKey, sortOrder) => {
19
19
  case 'transactionDate':
20
20
  return jeTransaction.baseTransaction.date.valueOf();
21
21
  case 'vendor':
22
- return jeTransaction.vendor.name.toLowerCase();
22
+ return jeTransaction.vendor.name != null
23
+ ? jeTransaction.vendor.name.toLowerCase()
24
+ : jeTransaction.vendor.name;
23
25
  case 'scheduleCategory':
24
26
  return jeTransaction.baseTransaction.account.accountName.toLowerCase();
25
27
  case 'expenseCategory':
@@ -150,9 +152,10 @@ const getScheduleListReport = (state, scheduleType) => {
150
152
  .trim()
151
153
  .toLowerCase();
152
154
  const sortedJETransactionView = sortedJETransactionsView(jeTransactionsView.filter((jeTransaction) => {
153
- return (jeTransaction.vendor.name
154
- .toLowerCase()
155
- .includes(loweredSearchText) === true ||
155
+ return ((jeTransaction.vendor.name != null &&
156
+ jeTransaction.vendor.name
157
+ .toLowerCase()
158
+ .includes(loweredSearchText) === true) ||
156
159
  jeTransaction.baseTransaction.memo
157
160
  .toLowerCase()
158
161
  .includes(loweredSearchText) === true);
@@ -3,7 +3,7 @@ import { fetchNotificationSettings, updateNotificationSettingsOnSuccess, updateN
3
3
  import { ZeniAPI } from '../../../zeniAPI';
4
4
  import { RootState } from '../../../reducer';
5
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<{
6
+ export declare const fetchNotificationSettingsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
7
  payload: undefined;
8
8
  type: string;
9
9
  } | {
@@ -12,6 +12,7 @@ export declare const fetchNotificationSettingsEpic: (actions$: ActionsObservable
12
12
  } | {
13
13
  payload: {
14
14
  data: import("../settingsViewPayload").NotificationSettingsPayload;
15
+ loggedInUserEmail: string;
15
16
  };
16
17
  type: string;
17
18
  }>;
@@ -5,12 +5,18 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const settingsViewReducer_1 = require("../settingsViewReducer");
7
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)(() => {
8
+ const fetchNotificationSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchNotificationSettings.match), (0, operators_1.switchMap)(() => {
9
+ var _a;
10
+ const state = state$.value;
9
11
  const URL = `${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/notification-preferences`;
12
+ const userEmail = (_a = state.tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userEmail;
13
+ if (userEmail == null) {
14
+ return (0, rxjs_1.from)([]);
15
+ }
10
16
  return zeniAPI.getJSON(URL).pipe((0, operators_1.mergeMap)((response) => {
11
17
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
12
18
  const updateActions = [
13
- (0, settingsViewReducer_1.updateNotificationSettingsOnSuccess)(response.data),
19
+ (0, settingsViewReducer_1.updateNotificationSettingsOnSuccess)(response.data, userEmail),
14
20
  ];
15
21
  return (0, rxjs_1.of)(...updateActions);
16
22
  }
@@ -0,0 +1,6 @@
1
+ import { ActionsObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { fetchClassList } from '../../classList/classListReducer';
4
+ import { fetchUserListByType } from '../../userListView/userListViewReducer';
5
+ export declare type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchClassList>;
6
+ export declare const fetchNotificationSettingsViewEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchNotificationSettingsViewEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const settingsViewReducer_1 = require("../settingsViewReducer");
7
+ const classListReducer_1 = require("../../classList/classListReducer");
8
+ const userListViewReducer_1 = require("../../userListView/userListViewReducer");
9
+ const fetchNotificationSettingsViewEpic = (actions$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchNotificationSettingsView.match), (0, operators_1.switchMap)(() => {
10
+ const actions = [
11
+ (0, userListViewReducer_1.fetchUserListByType)('manager', true),
12
+ (0, classListReducer_1.fetchClassList)(),
13
+ ];
14
+ return (0, rxjs_1.from)(actions);
15
+ }));
16
+ exports.fetchNotificationSettingsViewEpic = fetchNotificationSettingsViewEpic;
@@ -31,40 +31,54 @@ const saveNotificationSettingsEpic = (actions$, state$, zeniAPI) => actions$.pip
31
31
  JSON.stringify(error))))));
32
32
  }));
33
33
  exports.saveNotificationSettingsEpic = saveNotificationSettingsEpic;
34
+ /**
35
+ * Helpers
36
+ */
37
+ function toRemindersPayload(localData) {
38
+ const remindersPayload = {
39
+ frequency_type: localData.frequency,
40
+ preferred_mode: localData.preferredMode,
41
+ };
42
+ return remindersPayload;
43
+ }
34
44
  function toSaveNotificationSettingsPayload(localData, notificationSettingsData) {
35
- const payload = {};
36
- if (localData.reminders.isMissingReceiptNotificationActive != null &&
37
- notificationSettingsData.missingReceiptNotification != null) {
45
+ const { reminderNotificationSettings, monthEndInsightsNotificationSettings } = notificationSettingsData;
46
+ const { reminders, monthEndInsights } = localData;
47
+ const payload = {
48
+ is_missing_receipt_notification_active: null,
49
+ missing_receipt_notification: null,
50
+ is_uncategorized_transaction_notification_active: null,
51
+ uncategorized_transaction_notification: null,
52
+ is_pending_bill_approval_notification_active: null,
53
+ pending_bill_approval_notification: null,
54
+ pending_reimbursement_approval_notification: null,
55
+ is_pending_reimbursement_approval_notification_active: null,
56
+ is_month_end_insights_active: monthEndInsightsNotificationSettings.enabled != null
57
+ ? monthEndInsights.notify
58
+ : null,
59
+ month_end_email_recipient_email_ids: monthEndInsights.recipientEmailIds,
60
+ };
61
+ if (reminderNotificationSettings.missingReceiptNotification != null) {
38
62
  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
- };
63
+ reminders.missingReceiptNotification.preferredMode.length > 0;
64
+ payload.missing_receipt_notification = toRemindersPayload(reminders.missingReceiptNotification);
51
65
  }
52
- if (localData.reminders.isUncategorizedTransactionNotificationActive != null &&
53
- notificationSettingsData.uncategorizedTransactionNotification != null) {
66
+ if (reminderNotificationSettings.uncategorizedTransactionNotification != null) {
54
67
  payload.is_uncategorized_transaction_notification_active =
55
- localData.reminders.isUncategorizedTransactionNotificationActive;
56
- payload.uncategorized_transaction_notification = {
57
- preferred_mode: ['email'],
58
- };
68
+ reminders.uncategorizedTransactionNotification.preferredMode.length > 0;
69
+ payload.uncategorized_transaction_notification = toRemindersPayload(reminders.uncategorizedTransactionNotification);
70
+ }
71
+ if (reminderNotificationSettings.pendingBillApprovalNotification != null) {
72
+ payload.is_pending_bill_approval_notification_active =
73
+ reminders.pendingBillApprovalNotification.preferredMode.length > 0;
74
+ payload.pending_bill_approval_notification = toRemindersPayload(reminders.pendingBillApprovalNotification);
59
75
  }
60
- if (localData.reminders.isPendingReimbursementApprovalNotificationActive !=
61
- null &&
62
- notificationSettingsData.pendingReimbursementApprovalNotification != null) {
76
+ if (reminderNotificationSettings.pendingReimbursementApprovalNotification !=
77
+ null) {
63
78
  payload.is_pending_reimbursement_approval_notification_active =
64
- localData.reminders.isPendingReimbursementApprovalNotificationActive;
65
- payload.pending_reimbursement_approval_notification = {
66
- preferred_mode: ['email'],
67
- };
79
+ reminders.pendingReimbursementApprovalNotification.preferredMode.length >
80
+ 0;
81
+ payload.pending_reimbursement_approval_notification = toRemindersPayload(reminders.pendingReimbursementApprovalNotification);
68
82
  }
69
83
  return payload;
70
84
  }
@@ -1,6 +1,6 @@
1
1
  import { CurrentTenant } from '../../entity/tenant/tenantSelector';
2
2
  import { RoleMap, UserRoleType } from '../../entity/userRole/userRoleType';
3
- import { NotificationSettings } from './settingsViewState';
3
+ import { NotificationSettingsData, ReminderNotificationSettingsData, MonthEndInsightsNotificationSettingsData } from './settingsViewState';
4
4
  export declare const isAccountingTabVisible: (userRole: UserRoleType[], currentTenant: CurrentTenant | undefined) => boolean;
5
5
  export declare const isApprovalRulesTabVisible: (userRole: UserRoleType[], currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap | undefined) => boolean;
6
6
  export declare const isBankConnectionsTabVisible: (currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap | undefined) => boolean;
@@ -9,4 +9,6 @@ export declare const isCompanyDetailsTabVisible: (userRole: UserRoleType[], curr
9
9
  export declare const isIntegrationsTabVisible: (userRole: UserRoleType[], currentTenant: CurrentTenant | undefined) => boolean;
10
10
  export declare const isSettingsVisible: (currentTenant: CurrentTenant | undefined) => boolean;
11
11
  export declare const isMyBankConnectionsTabVisible: (currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap | undefined) => boolean;
12
- export declare const isNotificationsTabVisible: (notificationSettingsView: NotificationSettings) => boolean;
12
+ export declare const isRemindersSectionVisibleOnSettingsPage: (reminderNotificationSettings: ReminderNotificationSettingsData) => boolean;
13
+ export declare const isMonthEndNotificationsSectionVisibleOnSettingsPage: (monthEndInsightsNotificationSettings: MonthEndInsightsNotificationSettingsData, signedInUseEmail: string) => boolean;
14
+ export declare const isNotificationsTabVisible: (notificationSettings: NotificationSettingsData, signedInUseEmail: string) => boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNotificationsTabVisible = exports.isMyBankConnectionsTabVisible = exports.isSettingsVisible = exports.isIntegrationsTabVisible = exports.isCompanyDetailsTabVisible = exports.isBusinessVerificationTabVisible = exports.isBankConnectionsTabVisible = exports.isApprovalRulesTabVisible = exports.isAccountingTabVisible = void 0;
3
+ exports.isNotificationsTabVisible = exports.isMonthEndNotificationsSectionVisibleOnSettingsPage = exports.isRemindersSectionVisibleOnSettingsPage = exports.isMyBankConnectionsTabVisible = exports.isSettingsVisible = exports.isIntegrationsTabVisible = exports.isCompanyDetailsTabVisible = exports.isBusinessVerificationTabVisible = exports.isBankConnectionsTabVisible = exports.isApprovalRulesTabVisible = exports.isAccountingTabVisible = void 0;
4
4
  const userRoleType_1 = require("../../entity/userRole/userRoleType");
5
5
  const isAccountingTabVisible = (userRole, currentTenant) => {
6
6
  if ((0, exports.isSettingsVisible)(currentTenant)) {
@@ -106,11 +106,22 @@ const isMyBankConnectionsTabVisible = (currentTenant, userRoleMap) => {
106
106
  }
107
107
  };
108
108
  exports.isMyBankConnectionsTabVisible = isMyBankConnectionsTabVisible;
109
- const isNotificationsTabVisible = (notificationSettingsView) => {
110
- const { notificationSettings } = notificationSettingsView;
111
- return (notificationSettings.missingReceiptNotification != null ||
112
- notificationSettings.pendingBillApprovalNotification != null ||
113
- notificationSettings.pendingReimbursementApprovalNotification != null ||
114
- notificationSettings.uncategorizedTransactionNotification != null);
109
+ const isRemindersSectionVisibleOnSettingsPage = (reminderNotificationSettings) => {
110
+ return (reminderNotificationSettings.missingReceiptNotification != null ||
111
+ reminderNotificationSettings.pendingBillApprovalNotification != null ||
112
+ reminderNotificationSettings.pendingReimbursementApprovalNotification !=
113
+ null ||
114
+ reminderNotificationSettings.uncategorizedTransactionNotification != null);
115
+ };
116
+ exports.isRemindersSectionVisibleOnSettingsPage = isRemindersSectionVisibleOnSettingsPage;
117
+ const isMonthEndNotificationsSectionVisibleOnSettingsPage = (monthEndInsightsNotificationSettings, signedInUseEmail) => {
118
+ return (monthEndInsightsNotificationSettings.enabled != null ||
119
+ monthEndInsightsNotificationSettings.recipientEmailIds.includes(signedInUseEmail));
120
+ };
121
+ exports.isMonthEndNotificationsSectionVisibleOnSettingsPage = isMonthEndNotificationsSectionVisibleOnSettingsPage;
122
+ const isNotificationsTabVisible = (notificationSettings, signedInUseEmail) => {
123
+ const { reminderNotificationSettings, monthEndInsightsNotificationSettings } = notificationSettings;
124
+ return ((0, exports.isRemindersSectionVisibleOnSettingsPage)(reminderNotificationSettings) ||
125
+ (0, exports.isMonthEndNotificationsSectionVisibleOnSettingsPage)(monthEndInsightsNotificationSettings, signedInUseEmail));
115
126
  };
116
127
  exports.isNotificationsTabVisible = isNotificationsTabVisible;
@@ -6,10 +6,20 @@ export interface MyProfilePeoplePayload {
6
6
  users: UserPayload[];
7
7
  }
8
8
  export declare type MyProfilePeopleResponse = ZeniAPIResponse<MyProfilePeoplePayload>;
9
+ export interface RemindersPayload {
10
+ frequency_type: string | null;
11
+ preferred_mode: string[];
12
+ }
9
13
  export interface NotificationSettingsPayload {
10
14
  is_missing_receipt_notification_active: boolean | null;
11
15
  is_pending_bill_approval_notification_active: boolean | null;
12
16
  is_pending_reimbursement_approval_notification_active: boolean | null;
13
17
  is_uncategorized_transaction_notification_active: boolean | null;
18
+ is_month_end_insights_active: boolean | null;
19
+ missing_receipt_notification: RemindersPayload | null;
20
+ pending_bill_approval_notification: RemindersPayload | null;
21
+ pending_reimbursement_approval_notification: RemindersPayload | null;
22
+ uncategorized_transaction_notification: RemindersPayload | null;
23
+ month_end_email_recipient_email_ids?: string[];
14
24
  }
15
25
  export declare type NotificationSettingsResponse = ZeniAPIResponse<NotificationSettingsPayload>;
@@ -5,13 +5,16 @@ import { ID } from '../../commonStateTypes/common';
5
5
  export declare const initialState: SettingsViewState;
6
6
  export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
7
7
  companyId: string;
8
- }, string, never, never>, fetchMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateMyProfileOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string], {
8
+ }, string, never, never>, fetchMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, fetchNotificationSettingsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateMyProfileOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string], {
9
9
  userId: string;
10
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<{
11
11
  bankAccountIds: ID[];
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], {
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, loggedInUserEmail: string], {
13
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<{
14
+ loggedInUserEmail: string;
15
+ }, string, never, never>, updateNotificationSettingsOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, updateNotificationSettingsLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<NotificationSettingsLocalData, string>, resetNotificationSettingsLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
16
+ loggedInUserEmail: string;
17
+ }, string>, saveNotificationSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateNotificationSettingsOnSaveSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
18
  data: NotificationSettingsPayload;
16
19
  }, string>, updateNotificationSettingsOnSaveFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, clearSettingsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
17
20
  declare const _default: import("@reduxjs/toolkit").Reducer<SettingsViewState, import("@reduxjs/toolkit").AnyAction>;
@@ -1,20 +1,35 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearSettingsView = exports.updateNotificationSettingsOnSaveFailure = exports.updateNotificationSettingsOnSaveSuccess = exports.saveNotificationSettings = exports.resetNotificationSettingsLocalData = exports.updateNotificationSettingsLocalData = exports.updateNotificationSettingsOnFailure = exports.updateNotificationSettingsOnSuccess = exports.fetchNotificationSettings = exports.fetchBankAccountsList = exports.updateBankConnectionOnFailure = exports.updateBankConnectionOnSuccess = exports.fetchBankConnectionsView = exports.updateMyProfileOnFailure = exports.updateMyProfileOnSuccess = exports.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
4
+ exports.clearSettingsView = exports.updateNotificationSettingsOnSaveFailure = exports.updateNotificationSettingsOnSaveSuccess = exports.saveNotificationSettings = exports.resetNotificationSettingsLocalData = exports.updateNotificationSettingsLocalData = exports.updateNotificationSettingsOnFailure = exports.updateNotificationSettingsOnSuccess = exports.fetchNotificationSettings = exports.fetchBankAccountsList = exports.updateBankConnectionOnFailure = exports.updateBankConnectionOnSuccess = exports.fetchBankConnectionsView = exports.updateMyProfileOnFailure = exports.updateMyProfileOnSuccess = exports.fetchNotificationSettingsView = exports.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
+ const settingsViewState_1 = require("./settingsViewState");
6
7
  const initialNotificationSettingsData = {
7
- missingReceiptNotification: null,
8
- uncategorizedTransactionNotification: null,
9
- pendingBillApprovalNotification: null,
10
- pendingReimbursementApprovalNotification: null,
8
+ reminderNotificationSettings: {
9
+ missingReceiptNotification: null,
10
+ uncategorizedTransactionNotification: null,
11
+ pendingBillApprovalNotification: null,
12
+ pendingReimbursementApprovalNotification: null,
13
+ },
14
+ monthEndInsightsNotificationSettings: {
15
+ enabled: false,
16
+ recipientEmailIds: [],
17
+ },
18
+ };
19
+ const initialRemindersLocalData = {
20
+ preferredMode: [],
21
+ frequency: 'bi-weekly',
11
22
  };
12
23
  const initialNotificationSettingsLocalData = {
24
+ monthEndInsights: {
25
+ recipientEmailIds: [],
26
+ notify: false,
27
+ },
13
28
  reminders: {
14
- isMissingReceiptNotificationActive: null,
15
- isUncategorizedTransactionNotificationActive: null,
16
- isPendingReimbursementApprovalNotificationActive: null,
17
- isPendingBillApprovalNotificationActive: null,
29
+ missingReceiptNotification: initialRemindersLocalData,
30
+ pendingBillApprovalNotification: initialRemindersLocalData,
31
+ pendingReimbursementApprovalNotification: initialRemindersLocalData,
32
+ uncategorizedTransactionNotification: initialRemindersLocalData,
18
33
  },
19
34
  };
20
35
  exports.initialState = {
@@ -86,26 +101,30 @@ const settings = (0, toolkit_1.createSlice)({
86
101
  draft.bankConnection.fetchState = 'Error';
87
102
  draft.bankConnection.error = action.payload;
88
103
  },
104
+ fetchNotificationSettingsView() {
105
+ // Do nothing.
106
+ },
89
107
  fetchNotificationSettings(draft) {
90
108
  draft.notification.fetchState = 'In-Progress';
91
109
  draft.notification.error = undefined;
92
110
  },
93
111
  updateNotificationSettingsOnSuccess: {
94
- prepare(data) {
112
+ prepare(data, loggedInUserEmail) {
95
113
  return {
96
114
  payload: {
97
115
  data,
116
+ loggedInUserEmail,
98
117
  },
99
118
  };
100
119
  },
101
120
  reducer(draft, action) {
102
- const { data } = action.payload;
121
+ const { data, loggedInUserEmail } = action.payload;
103
122
  const notificationSettings = toNotificationSettings(data);
104
123
  draft.notification.fetchState = 'Completed';
105
124
  draft.notification.error = undefined;
106
125
  draft.notification.notificationSettings = notificationSettings;
107
126
  draft.notification.notificationSettingsLocalData =
108
- toNotificationSettingsLocalData(notificationSettings);
127
+ toNotificationSettingsLocalData(notificationSettings, loggedInUserEmail);
109
128
  },
110
129
  },
111
130
  updateNotificationSettingsOnFailure(draft, action) {
@@ -115,9 +134,10 @@ const settings = (0, toolkit_1.createSlice)({
115
134
  updateNotificationSettingsLocalData(draft, action) {
116
135
  draft.notification.notificationSettingsLocalData = action.payload;
117
136
  },
118
- resetNotificationSettingsLocalData(draft) {
137
+ resetNotificationSettingsLocalData(draft, action) {
138
+ const { loggedInUserEmail } = action.payload;
119
139
  draft.notification.notificationSettingsLocalData =
120
- toNotificationSettingsLocalData(draft.notification.notificationSettings);
140
+ toNotificationSettingsLocalData(draft.notification.notificationSettings, loggedInUserEmail);
121
141
  },
122
142
  saveNotificationSettings(draft) {
123
143
  draft.notification.updateStatus.fetchState = 'In-Progress';
@@ -138,47 +158,65 @@ const settings = (0, toolkit_1.createSlice)({
138
158
  },
139
159
  },
140
160
  });
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;
161
+ _a = settings.actions, exports.fetchMyProfileView = _a.fetchMyProfileView, exports.fetchMyProfile = _a.fetchMyProfile, exports.fetchNotificationSettingsView = _a.fetchNotificationSettingsView, exports.updateMyProfileOnSuccess = _a.updateMyProfileOnSuccess, exports.updateMyProfileOnFailure = _a.updateMyProfileOnFailure, exports.fetchBankConnectionsView = _a.fetchBankConnectionsView, exports.updateBankConnectionOnSuccess = _a.updateBankConnectionOnSuccess, exports.updateBankConnectionOnFailure = _a.updateBankConnectionOnFailure, exports.fetchBankAccountsList = _a.fetchBankAccountsList, exports.fetchNotificationSettings = _a.fetchNotificationSettings, exports.updateNotificationSettingsOnSuccess = _a.updateNotificationSettingsOnSuccess, exports.updateNotificationSettingsOnFailure = _a.updateNotificationSettingsOnFailure, exports.updateNotificationSettingsLocalData = _a.updateNotificationSettingsLocalData, exports.resetNotificationSettingsLocalData = _a.resetNotificationSettingsLocalData, exports.saveNotificationSettings = _a.saveNotificationSettings, exports.updateNotificationSettingsOnSaveSuccess = _a.updateNotificationSettingsOnSaveSuccess, exports.updateNotificationSettingsOnSaveFailure = _a.updateNotificationSettingsOnSaveFailure, exports.clearSettingsView = _a.clearSettingsView;
142
162
  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,
163
+ /**
164
+ * Helpers
165
+ */
166
+ function toRemindersLocalData(reminderNotificationSettingDetails) {
167
+ if (reminderNotificationSettingDetails != null) {
168
+ return {
169
+ preferredMode: reminderNotificationSettingDetails.enabled
170
+ ? reminderNotificationSettingDetails.preferredMode
171
+ : [],
172
+ frequency: reminderNotificationSettingDetails.frequency,
158
173
  };
159
174
  }
160
- if (data.is_uncategorized_transaction_notification_active != null) {
161
- notificationSettingsData.uncategorizedTransactionNotification = {
162
- active: data.is_uncategorized_transaction_notification_active,
175
+ return Object.assign({}, initialRemindersLocalData);
176
+ }
177
+ const toNotificationSettingsLocalData = (data, loggedInUserEmail) => {
178
+ var _a;
179
+ const { monthEndInsightsNotificationSettings, reminderNotificationSettings } = data;
180
+ const { missingReceiptNotification, pendingBillApprovalNotification, pendingReimbursementApprovalNotification, uncategorizedTransactionNotification, } = reminderNotificationSettings;
181
+ return {
182
+ monthEndInsights: {
183
+ notify: (_a = monthEndInsightsNotificationSettings.enabled) !== null && _a !== void 0 ? _a : monthEndInsightsNotificationSettings.recipientEmailIds.includes(loggedInUserEmail),
184
+ recipientEmailIds: monthEndInsightsNotificationSettings.recipientEmailIds,
185
+ },
186
+ reminders: {
187
+ missingReceiptNotification: toRemindersLocalData(missingReceiptNotification),
188
+ pendingBillApprovalNotification: toRemindersLocalData(pendingBillApprovalNotification),
189
+ pendingReimbursementApprovalNotification: toRemindersLocalData(pendingReimbursementApprovalNotification),
190
+ uncategorizedTransactionNotification: toRemindersLocalData(uncategorizedTransactionNotification),
191
+ },
192
+ };
193
+ };
194
+ function toReminderNotificationSettingsDetails(isNotificationActive, remindersPayload) {
195
+ if (isNotificationActive != null) {
196
+ return {
197
+ enabled: isNotificationActive,
198
+ frequency: (remindersPayload === null || remindersPayload === void 0 ? void 0 : remindersPayload.frequency_type) != null
199
+ ? (0, settingsViewState_1.toRemindersFrequencyType)(remindersPayload.frequency_type)
200
+ : 'bi-weekly',
201
+ preferredMode: (remindersPayload === null || remindersPayload === void 0 ? void 0 : remindersPayload.preferred_mode) != null
202
+ ? remindersPayload.preferred_mode.map((mode) => (0, settingsViewState_1.toNotificationMode)(mode))
203
+ : [],
163
204
  };
164
205
  }
165
- return notificationSettingsData;
166
- };
167
- const toNotificationSettingsLocalData = (data) => {
206
+ return null;
207
+ }
208
+ const toNotificationSettings = (data) => {
209
+ var _a;
168
210
  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,
211
+ reminderNotificationSettings: {
212
+ missingReceiptNotification: toReminderNotificationSettingsDetails(data.is_missing_receipt_notification_active, data.missing_receipt_notification),
213
+ pendingBillApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_bill_approval_notification_active, data.pending_bill_approval_notification),
214
+ pendingReimbursementApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_reimbursement_approval_notification_active, data.pending_reimbursement_approval_notification),
215
+ uncategorizedTransactionNotification: toReminderNotificationSettingsDetails(data.is_uncategorized_transaction_notification_active, data.uncategorized_transaction_notification),
216
+ },
217
+ monthEndInsightsNotificationSettings: {
218
+ enabled: data.is_month_end_insights_active,
219
+ recipientEmailIds: (_a = data.month_end_email_recipient_email_ids) !== null && _a !== void 0 ? _a : [],
182
220
  },
183
221
  };
184
222
  };
@@ -1,16 +1,11 @@
1
1
  import { RootState } from '../../reducer';
2
2
  import { FetchStateAndError, ID } from '../../commonStateTypes/common';
3
- import { TenantExternalConnections } from '../../entity/tenant/tenantState';
4
- import { Company } from '../../entity/company/companyStateTypes';
5
- import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView } from './types/settingsViewSelectorTypes';
3
+ import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView, NotificationSettingsSelectorView, IntegrationsView } from './types/settingsViewSelectorTypes';
6
4
  import { NotificationSettings } from './settingsViewState';
7
5
  export declare function getApprovalRuleViewDetails(state: RootState): FetchStateAndError;
8
6
  export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID): BankConnectionsSetupView;
9
7
  export declare function getMyBankConnectionsDetails(state: RootState, userId: ID): MyBankConnectionsView;
10
- export interface IntegrationsView {
11
- externalConnections: TenantExternalConnections | undefined;
12
- companyView: Company | undefined;
13
- }
14
8
  export declare function getIntegrationsView(state: RootState, companyId: ID): IntegrationsView;
15
9
  export declare const getMyProfileView: (state: RootState) => MyProfileSelectorView;
16
- export declare const getNotificationSettingsView: (state: RootState) => NotificationSettings;
10
+ export declare const getNotificationSettings: (state: RootState) => NotificationSettings;
11
+ export declare const getNotificationSettingsView: (state: RootState) => NotificationSettingsSelectorView;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNotificationSettingsView = exports.getMyProfileView = exports.getIntegrationsView = exports.getMyBankConnectionsDetails = exports.getBankConnectionsSetupViewDetails = exports.getApprovalRuleViewDetails = void 0;
6
+ exports.getNotificationSettingsView = exports.getNotificationSettings = exports.getMyProfileView = exports.getIntegrationsView = exports.getMyBankConnectionsDetails = exports.getBankConnectionsSetupViewDetails = exports.getApprovalRuleViewDetails = void 0;
4
7
  const toolkit_1 = require("@reduxjs/toolkit");
8
+ const values_1 = __importDefault(require("lodash/values"));
5
9
  const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
6
10
  const companySelector_1 = require("../../entity/company/companySelector");
7
11
  const userRoleSelector_1 = require("../../entity/userRole/userRoleSelector");
@@ -117,6 +121,18 @@ exports.getMyProfileView = (0, toolkit_1.createSelector)((state) => state.tenant
117
121
  }
118
122
  return myProfilePeopleView;
119
123
  });
120
- exports.getNotificationSettingsView = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (settingsViewState) => {
124
+ exports.getNotificationSettings = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (settingsViewState) => {
121
125
  return settingsViewState.notification;
122
126
  });
127
+ exports.getNotificationSettingsView = (0, toolkit_1.createSelector)((state) => state.settingsViewState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => (0, userListViewSelector_1.getUserList)(state, 'manager'), (settingsViewState, userState, classState, classListState, managersListView) => {
128
+ const classList = (0, classSelectorV2_1.getClassesByIds)(classState, {
129
+ classIds: classListState.classIds,
130
+ reportId: 'class_list',
131
+ });
132
+ const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
133
+ settingsViewState.notification,
134
+ classListState,
135
+ managersListView,
136
+ ]);
137
+ return Object.assign(Object.assign({}, settingsViewState.notification), { allUsers: (0, values_1.default)(userState.userByUserId), classList, managersList: managersListView.users, fetchState: fetchState.fetchState, error: fetchState.error });
138
+ });
@@ -5,20 +5,43 @@ interface MyProfile extends FetchStateAndError {
5
5
  interface BankConnection extends FetchStateAndError {
6
6
  bankAccountIds: ID[];
7
7
  }
8
+ export declare const REMINDER_NOTIFICATION_TYPES: readonly ["missingReceiptNotification", "uncategorizedTransactionNotification", "pendingBillApprovalNotification", "pendingReimbursementApprovalNotification"];
8
9
  declare const toReminderTypeKey: (v: string) => "missingReceiptNotification" | "uncategorizedTransactionNotification" | "pendingBillApprovalNotification" | "pendingReimbursementApprovalNotification";
9
- declare type ReminderTypeKey = ReturnType<typeof toReminderTypeKey>;
10
- declare const toReminderFlagTypeKey: (v: string) => "isMissingReceiptNotificationActive" | "isUncategorizedTransactionNotificationActive" | "isPendingBillApprovalNotificationActive" | "isPendingReimbursementApprovalNotificationActive";
11
- declare type ReminderFlagTypeKey = ReturnType<typeof toReminderFlagTypeKey>;
12
- export declare type ReminderNotificationSettingsLocalData = Record<ReminderFlagTypeKey, boolean | null>;
10
+ export declare type ReminderTypeKey = ReturnType<typeof toReminderTypeKey>;
11
+ export declare const toRemindersFrequencyType: (v: string) => "daily" | "weekly" | "bi-weekly" | "monthly";
12
+ export declare type FrequencyTypeKey = ReturnType<typeof toRemindersFrequencyType>;
13
+ export declare const NOTIFICATION_MODES: readonly ["email", "dashboard"];
14
+ export declare const toNotificationMode: (v: string) => "dashboard" | "email";
15
+ export declare type NotificationModeKey = ReturnType<typeof toNotificationMode>;
16
+ export interface MonthEndInsightsNotificationSettingsData {
17
+ enabled: boolean | null;
18
+ recipientEmailIds: string[];
19
+ }
20
+ export interface MonthEndInsightsNotificationSettingsLocalData {
21
+ notify: boolean;
22
+ recipientEmailIds: string[];
23
+ }
24
+ export interface ReminderNotificationSettingDetails {
25
+ enabled: boolean;
26
+ frequency: FrequencyTypeKey;
27
+ preferredMode: NotificationModeKey[];
28
+ }
29
+ export declare type RemindersLocalData = {
30
+ frequency: FrequencyTypeKey;
31
+ preferredMode: NotificationModeKey[];
32
+ };
33
+ export declare type ReminderNotificationSettingsData = Record<ReminderTypeKey, ReminderNotificationSettingDetails | null>;
34
+ export declare type ReminderNotificationSettingsLocalData = Record<ReminderTypeKey, RemindersLocalData>;
13
35
  export interface NotificationSettingsLocalData {
14
36
  reminders: ReminderNotificationSettingsLocalData;
37
+ monthEndInsights: MonthEndInsightsNotificationSettingsLocalData;
15
38
  }
16
- interface ReminderNotificationSettingDetails {
17
- active: boolean;
39
+ export interface NotificationSettingsData {
40
+ reminderNotificationSettings: ReminderNotificationSettingsData;
41
+ monthEndInsightsNotificationSettings: MonthEndInsightsNotificationSettingsData;
18
42
  }
19
- export declare type ReminderNotificationSettingsData = Record<ReminderTypeKey, ReminderNotificationSettingDetails | null>;
20
43
  export interface NotificationSettings extends FetchStateAndError {
21
- notificationSettings: ReminderNotificationSettingsData;
44
+ notificationSettings: NotificationSettingsData;
22
45
  notificationSettingsLocalData: NotificationSettingsLocalData;
23
46
  updateStatus: FetchStateAndError;
24
47
  }
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toNotificationMode = exports.NOTIFICATION_MODES = exports.toRemindersFrequencyType = exports.REMINDER_NOTIFICATION_TYPES = void 0;
3
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
4
- const REMINDER_NOTIFICATION_TYPES = [
5
+ exports.REMINDER_NOTIFICATION_TYPES = [
5
6
  'missingReceiptNotification',
6
7
  'uncategorizedTransactionNotification',
7
8
  'pendingBillApprovalNotification',
8
9
  'pendingReimbursementApprovalNotification',
9
10
  ];
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);
11
+ const toReminderTypeKey = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.REMINDER_NOTIFICATION_TYPES);
12
+ const FREQUENCY_TYPES = ['daily', 'weekly', 'bi-weekly', 'monthly'];
13
+ const toRemindersFrequencyType = (v) => (0, stringToUnion_1.stringToUnion)(v, FREQUENCY_TYPES);
14
+ exports.toRemindersFrequencyType = toRemindersFrequencyType;
15
+ exports.NOTIFICATION_MODES = ['email', 'dashboard'];
16
+ const toNotificationMode = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.NOTIFICATION_MODES);
17
+ exports.toNotificationMode = toNotificationMode;