@zeniai/client-epic-state 4.9.74 → 4.9.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +2 -2
- package/lib/entity/chargeCard/chargeCard.d.ts +2 -2
- package/lib/entity/companyHealthMetric/companyHealthMetricPayload.d.ts +1 -0
- package/lib/entity/companyHealthMetric/companyHealthMetricPayload.js +2 -1
- package/lib/entity/companyHealthMetric/companyHealthMetricState.d.ts +1 -0
- package/lib/epic.d.ts +5 -1
- package/lib/epic.js +5 -1
- package/lib/index.d.ts +12 -11
- package/lib/index.js +28 -16
- package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.d.ts +2 -2
- package/lib/view/commonVendorView/vendorView/epics/fetchVendorEpic.js +1 -0
- package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +1 -8
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +1 -1
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +5 -2
- package/lib/view/companyHealthMetricView/companyHealthMetricView.d.ts +1 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +21 -3
- package/lib/view/companyHealthMetricView/epic/initializeCompanyHealthMetricViewLocalData.js +3 -2
- package/lib/view/companyHealthMetricView/epic/saveCompanyHealthMetricByIdEpic.js +2 -1
- package/lib/view/companyView/companyViewPayload.d.ts +8 -0
- package/lib/view/companyView/companyViewReducer.d.ts +2 -1
- package/lib/view/companyView/companyViewReducer.js +24 -2
- package/lib/view/companyView/companyViewState.d.ts +2 -0
- package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +5 -0
- package/lib/view/companyView/epic/fetchCompanyMetaDataEpic.d.ts +7 -0
- package/lib/view/companyView/epic/fetchCompanyMetaDataEpic.js +24 -0
- package/lib/view/companyView/selector/companyManagementViewSelector.d.ts +1 -0
- package/lib/view/companyView/selector/companyManagementViewSelector.js +3 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +3 -3
- package/lib/view/companyView/types/cockpitTypes.js +1 -0
- package/lib/view/companyView/types/companyMetaDataViewState.d.ts +12 -0
- package/lib/view/companyView/types/companyMetaDataViewState.js +14 -0
- package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +7 -4
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +2 -1
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +8 -2
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.d.ts +6 -0
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.js +16 -0
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +42 -28
- package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -2
- package/lib/view/settingsView/settingsViewHelpers.js +18 -7
- package/lib/view/settingsView/settingsViewPayload.d.ts +10 -0
- package/lib/view/settingsView/settingsViewReducer.d.ts +6 -3
- package/lib/view/settingsView/settingsViewReducer.js +87 -49
- package/lib/view/settingsView/settingsViewSelector.d.ts +3 -8
- package/lib/view/settingsView/settingsViewSelector.js +18 -2
- package/lib/view/settingsView/settingsViewState.d.ts +31 -8
- package/lib/view/settingsView/settingsViewState.js +9 -9
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +12 -0
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +4 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +7 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +21 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.d.ts +10 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js +141 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +4 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +4 -4
- package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.d.ts +7 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/fetchReviewTransferDetailEpic.js +40 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailPayload.d.ts +15 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailPayload.js +11 -0
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.d.ts +2 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailReducer.js +33 -2
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.d.ts +2 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +2 -1
- package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailState.d.ts +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCompanyMetaDataEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const companyViewReducer_1 = require("../companyViewReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
+
const fetchCompanyMetaDataEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.fetchCompanyMetaData.match), (0, operators_1.switchMap)(() => {
|
|
9
|
+
return zeniAPI
|
|
10
|
+
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels/company-view`)
|
|
11
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
13
|
+
return (0, rxjs_1.from)([(0, companyViewReducer_1.updateCompanyMetaDataOnSuccess)(response.data)]);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return (0, rxjs_1.from)([(0, companyViewReducer_1.updateCompanyMetaDataOnFailure)(response.status)]);
|
|
17
|
+
}
|
|
18
|
+
}), (0, operators_1.catchError)((error) => {
|
|
19
|
+
return (0, rxjs_1.from)([
|
|
20
|
+
(0, companyViewReducer_1.updateCompanyMetaDataOnFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Company Meta Data errored out' + JSON.stringify(error))),
|
|
21
|
+
]);
|
|
22
|
+
}));
|
|
23
|
+
}));
|
|
24
|
+
exports.fetchCompanyMetaDataEpic = fetchCompanyMetaDataEpic;
|
|
@@ -9,6 +9,7 @@ import { ManagementUIState } from '../types/companyManagementViewState';
|
|
|
9
9
|
import { SubscriptionPlan } from '../../../entity/subscription/subscriptionPlan/subscriptionPlanState';
|
|
10
10
|
export interface CompanyWithUpdateStatusView extends CompanyView {
|
|
11
11
|
updateStatus: FetchStateAndError;
|
|
12
|
+
hasMonthEndEmailHistory: boolean;
|
|
12
13
|
}
|
|
13
14
|
export interface CompanyManagementView extends SelectorView {
|
|
14
15
|
companies: CompanyWithUpdateStatusView[];
|
|
@@ -19,9 +19,10 @@ const getManagementViewFromCompanyIds = (rootState, companyIds, fetchState) => {
|
|
|
19
19
|
const { sortKey, sortOrder, filterText, filters } = uiState;
|
|
20
20
|
const { userState } = rootState;
|
|
21
21
|
const companyManagementViewState = rootState.companyViewState.managementView;
|
|
22
|
+
const companyMetaDataState = rootState.companyViewState.metaDataView;
|
|
22
23
|
let companies = companyIds
|
|
23
24
|
.map((companyId) => {
|
|
24
|
-
var _a, _b;
|
|
25
|
+
var _a, _b, _c, _d;
|
|
25
26
|
const updatesInProgress = (0, companyManagementViewState_1.getCompanyManagementUpdatesInProgress)(companyManagementViewState, companyId, true);
|
|
26
27
|
const pendingUpdates = (0, companyManagementViewState_1.getCompanyManagementPendingUpdates)(companyId, companyManagementViewState);
|
|
27
28
|
const pendingManagementUpdates = Object.assign({}, (_a = updatesInProgress === null || updatesInProgress === void 0 ? void 0 : updatesInProgress.data) !== null && _a !== void 0 ? _a : {}, pendingUpdates);
|
|
@@ -33,7 +34,7 @@ const getManagementViewFromCompanyIds = (rootState, companyIds, fetchState) => {
|
|
|
33
34
|
return Object.assign(Object.assign({}, company), { updateStatus: (_b = updatesInProgress === null || updatesInProgress === void 0 ? void 0 : updatesInProgress.status) !== null && _b !== void 0 ? _b : {
|
|
34
35
|
fetchState: 'Not-Started',
|
|
35
36
|
error: undefined,
|
|
36
|
-
} });
|
|
37
|
+
}, hasMonthEndEmailHistory: (_d = (_c = companyMetaDataState.metaDataByCompanyId[companyId]) === null || _c === void 0 ? void 0 : _c.hasMonthEndEmailHistory) !== null && _d !== void 0 ? _d : false });
|
|
37
38
|
}
|
|
38
39
|
else {
|
|
39
40
|
return undefined;
|
|
@@ -6,11 +6,11 @@ import { CockpitDownloadTabsID, CockpitTabsFileType } from './cockpitTabsID';
|
|
|
6
6
|
export declare const ALL_PORTFOLIO_SORT_KEYS: readonly ["companyName", "cashBalance", "runway", "expenses", "revenues", "netIncome"];
|
|
7
7
|
export declare const ALL_MANAGEMENT_SORT_KEYS: readonly ["companyName", "task", "status", "group", "plans", "controller", "customerSuccessManager", "reviewer", "preparer", "apAnalyst", "reportSent", "taxStatus", "taxLead", "monthlyRecurringRevenue", "annualRecurringRevenue", "notes", "satisfaction", "bookCloseDate"];
|
|
8
8
|
export declare const ALL_ONBOARDING_SORT_KEYS: readonly ["companyName", "bankAccountLinked", "qboLinked", "identityVerified", "businessVerified", "groupCreated", "customerCreated", "enroller", "notes", "invite"];
|
|
9
|
-
export declare const ALL_HEALTH_SORT_KEYS: readonly ["companyName", "issues", "productVerticals", "runway", "churnProbability", "netPromoterScore", "controller", "customerSuccessManager", "lastReportSent", "subscriptionDate", "renewalDate"];
|
|
9
|
+
export declare const ALL_HEALTH_SORT_KEYS: readonly ["companyName", "issues", "productVerticals", "runway", "churnProbability", "netPromoterScore", "customerSatisfactionScore", "controller", "customerSuccessManager", "lastReportSent", "subscriptionDate", "renewalDate"];
|
|
10
10
|
export declare const toPortfolioSortKeyType: (v: string) => "expenses" | "runway" | "cashBalance" | "netIncome" | "companyName" | "revenues";
|
|
11
11
|
export declare const toManagementSortKeyType: (v: string) => "status" | "group" | "bookCloseDate" | "controller" | "preparer" | "reviewer" | "companyName" | "monthlyRecurringRevenue" | "annualRecurringRevenue" | "taxStatus" | "plans" | "notes" | "task" | "customerSuccessManager" | "apAnalyst" | "reportSent" | "taxLead" | "satisfaction";
|
|
12
12
|
export declare const toOnboardingSortKeyType: (v: string) => "companyName" | "identityVerified" | "businessVerified" | "bankAccountLinked" | "qboLinked" | "groupCreated" | "customerCreated" | "notes" | "enroller" | "invite";
|
|
13
|
-
export declare const toHealthSortKeyType: (v: string) => "runway" | "controller" | "companyName" | "customerSuccessManager" | "netPromoterScore" | "lastReportSent" | "issues" | "productVerticals" | "churnProbability" | "subscriptionDate" | "renewalDate";
|
|
13
|
+
export declare const toHealthSortKeyType: (v: string) => "runway" | "controller" | "companyName" | "customerSuccessManager" | "netPromoterScore" | "customerSatisfactionScore" | "lastReportSent" | "issues" | "productVerticals" | "churnProbability" | "subscriptionDate" | "renewalDate";
|
|
14
14
|
export declare type PortfolioViewSortKey = ReturnType<typeof toPortfolioSortKeyType>;
|
|
15
15
|
export declare type ManagementViewSortKey = ReturnType<typeof toManagementSortKeyType>;
|
|
16
16
|
export declare type OnboardingViewSortKey = ReturnType<typeof toOnboardingSortKeyType>;
|
|
@@ -18,7 +18,7 @@ export declare type HealthViewSortKey = ReturnType<typeof toHealthSortKeyType>;
|
|
|
18
18
|
export declare type ManagementViewFilterCategoryField = 'controllerUserIds' | 'customerSuccessManagerUserIds' | 'preparerUserIds' | 'reviewerUserIds' | 'apAnalystUserIds' | 'taxLeadUserIds' | 'companyGroupId' | 'taxStatusCode' | 'statusCode' | 'plans' | 'annualRecurringRevenue' | 'monthlyRecurringRevenue' | 'customerSatisfaction' | 'zeniSatisfaction';
|
|
19
19
|
export declare type SubscriptionViewFilterCategoryField = 'controllerUserIds' | 'statusCode' | 'recommendedActionCode' | 'subscriptionPlans' | 'subscriptionAddOns' | 'avg2MonthExpenses' | 'slabLowerLimit' | 'slabUpperLimit' | 'monthlyRecurringRevenue';
|
|
20
20
|
export declare type PortfolioViewFilterCategoryField = 'netBurnOrIncome' | 'cashPosition' | 'income' | 'expenses' | 'runway';
|
|
21
|
-
export declare type HealthMonitorViewFilterCategoryField = 'verticalProductServices' | 'runway' | 'netPromoterScore' | 'churnProbabilityPercentage' | 'controller' | 'customerSuccessManager' | 'lastReportSent' | 'subscriptionStartDate' | 'subscriptionRenewalDate';
|
|
21
|
+
export declare type HealthMonitorViewFilterCategoryField = 'verticalProductServices' | 'runway' | 'netPromoterScore' | 'customerSatisfactionScore' | 'churnProbabilityPercentage' | 'controller' | 'customerSuccessManager' | 'lastReportSent' | 'subscriptionStartDate' | 'subscriptionRenewalDate';
|
|
22
22
|
export interface CockpitFilterCategory {
|
|
23
23
|
field?: ManagementViewFilterCategoryField | SubscriptionViewFilterCategoryField | PortfolioViewFilterCategoryField | HealthMonitorViewFilterCategoryField;
|
|
24
24
|
matchingOperator: 'equal' | 'not-equal';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { CompanyMetaDataViewPayload } from '../companyViewPayload';
|
|
3
|
+
export interface CompanyMetaData {
|
|
4
|
+
hasMonthEndEmailHistory: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface CompanyMetaDataViewState extends FetchedState {
|
|
7
|
+
metaDataByCompanyId: Record<ID, CompanyMetaData>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Helpers
|
|
11
|
+
*/
|
|
12
|
+
export declare const getMetaDataByCompanyIds: (data: CompanyMetaDataViewPayload) => Record<ID, CompanyMetaData>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMetaDataByCompanyIds = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Helpers
|
|
6
|
+
*/
|
|
7
|
+
const getMetaDataByCompanyIds = (data) => {
|
|
8
|
+
return data.cockpit_companies_view.reduce((prev, curr) => {
|
|
9
|
+
return Object.assign(Object.assign({}, prev), { [curr.company_id]: {
|
|
10
|
+
hasMonthEndEmailHistory: curr.has_month_end_email_history,
|
|
11
|
+
} });
|
|
12
|
+
}, {});
|
|
13
|
+
};
|
|
14
|
+
exports.getMetaDataByCompanyIds = getMetaDataByCompanyIds;
|
|
@@ -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
|
|
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
|
-
.
|
|
155
|
-
|
|
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>,
|
|
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$,
|
|
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
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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 (
|
|
53
|
-
notificationSettingsData.uncategorizedTransactionNotification != null) {
|
|
66
|
+
if (reminderNotificationSettings.uncategorizedTransactionNotification != null) {
|
|
54
67
|
payload.is_uncategorized_transaction_notification_active =
|
|
55
|
-
|
|
56
|
-
payload.uncategorized_transaction_notification =
|
|
57
|
-
|
|
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 (
|
|
61
|
-
null
|
|
62
|
-
notificationSettingsData.pendingReimbursementApprovalNotification != null) {
|
|
76
|
+
if (reminderNotificationSettings.pendingReimbursementApprovalNotification !=
|
|
77
|
+
null) {
|
|
63
78
|
payload.is_pending_reimbursement_approval_notification_active =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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 {
|
|
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
|
|
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
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
reminderNotificationSettings: {
|
|
9
|
+
missingReceiptNotification: null,
|
|
10
|
+
uncategorizedTransactionNotification: null,
|
|
11
|
+
pendingBillApprovalNotification: null,
|
|
12
|
+
pendingReimbursementApprovalNotification: null,
|
|
13
|
+
},
|
|
14
|
+
monthEndInsightsNotificationSettings: {
|
|
15
|
+
enabled: false,
|
|
16
|
+
recipientEmailIds: [],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const initialRemindersLocalData = {
|
|
20
|
+
preferredMode: [],
|
|
21
|
+
frequency: 'bi-weekly',
|
|
11
22
|
};
|
|
12
23
|
const initialNotificationSettingsLocalData = {
|
|
24
|
+
monthEndInsights: {
|
|
25
|
+
recipientEmailIds: [],
|
|
26
|
+
notify: false,
|
|
27
|
+
},
|
|
13
28
|
reminders: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
missingReceiptNotification: initialRemindersLocalData,
|
|
30
|
+
pendingBillApprovalNotification: initialRemindersLocalData,
|
|
31
|
+
pendingReimbursementApprovalNotification: initialRemindersLocalData,
|
|
32
|
+
uncategorizedTransactionNotification: initialRemindersLocalData,
|
|
18
33
|
},
|
|
19
34
|
};
|
|
20
35
|
exports.initialState = {
|
|
@@ -86,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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
if (data.is_pending_reimbursement_approval_notification_active != null) {
|
|
156
|
-
notificationSettingsData.pendingReimbursementApprovalNotification = {
|
|
157
|
-
active: data.is_pending_reimbursement_approval_notification_active,
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
|
166
|
-
}
|
|
167
|
-
const
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
const toNotificationSettings = (data) => {
|
|
209
|
+
var _a;
|
|
168
210
|
return {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
};
|