@zeniai/client-epic-state 4.9.99 → 4.10.1
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/commonPayloadTypes/commonPayload.d.ts +8 -0
- package/lib/commonPayloadTypes/commonPayload.js +18 -0
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/notification/notificationPayload.d.ts +46 -0
- package/lib/entity/notification/notificationPayload.js +124 -0
- package/lib/entity/notification/notificationReducer.d.ts +20 -0
- package/lib/entity/notification/notificationReducer.js +118 -0
- package/lib/entity/notification/notificationSelector.d.ts +9 -0
- package/lib/entity/notification/notificationSelector.js +36 -0
- package/lib/entity/notification/notificationState.d.ts +7 -0
- package/lib/entity/notification/notificationState.js +2 -0
- package/lib/entity/notification/types/notificationSelectorTypes.d.ts +8 -0
- package/lib/entity/notification/types/notificationSelectorTypes.js +2 -0
- package/lib/entity/notification/types/notificationStateTypes.d.ts +50 -0
- package/lib/entity/notification/types/notificationStateTypes.js +2 -0
- package/lib/entity/notification/types/notificationTypes.d.ts +24 -0
- package/lib/entity/notification/types/notificationTypes.js +58 -0
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
- package/lib/entity/tenant/clearAllEpic.js +5 -1
- package/lib/epic.d.ts +7 -3
- package/lib/epic.js +5 -1
- package/lib/index.d.ts +10 -2
- package/lib/index.js +29 -8
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/notificationView/epics/fetchNotificationUnreadCountEpic.d.ts +10 -0
- package/lib/view/notificationView/epics/fetchNotificationUnreadCountEpic.js +39 -0
- package/lib/view/notificationView/epics/fetchNotificationViewEpic.d.ts +9 -0
- package/lib/view/notificationView/epics/fetchNotificationViewEpic.js +56 -0
- package/lib/view/notificationView/epics/updateNotificationViewAllNotificationsStatusEpic.d.ts +9 -0
- package/lib/view/notificationView/epics/updateNotificationViewAllNotificationsStatusEpic.js +50 -0
- package/lib/view/notificationView/epics/updateNotificationViewNotificationStatusEpic.d.ts +9 -0
- package/lib/view/notificationView/epics/updateNotificationViewNotificationStatusEpic.js +86 -0
- package/lib/view/notificationView/notificationView.helpers.d.ts +2 -0
- package/lib/view/notificationView/notificationView.helpers.js +11 -0
- package/lib/view/notificationView/notificationViewPayload.d.ts +48 -0
- package/lib/view/notificationView/notificationViewPayload.js +2 -0
- package/lib/view/notificationView/notificationViewReducer.d.ts +64 -0
- package/lib/view/notificationView/notificationViewReducer.js +372 -0
- package/lib/view/notificationView/notificationViewSelector.d.ts +29 -0
- package/lib/view/notificationView/notificationViewSelector.js +89 -0
- package/lib/view/notificationView/notificationViewState.d.ts +31 -0
- package/lib/view/notificationView/notificationViewState.js +19 -0
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.d.ts +2 -1
- package/lib/view/settingsView/epic/fetchNotificationSettingsViewEpic.js +8 -6
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/settingsView/settingsViewReducer.d.ts +4 -1
- package/lib/view/settingsView/settingsViewReducer.js +11 -2
- package/lib/view/settingsView/settingsViewSelector.js +18 -7
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +1 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +37 -5
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +1 -1
- package/lib/zeniAPI.d.ts +2 -0
- package/lib/zeniAPI.js +8 -0
- package/package.json +2 -1
|
@@ -16,7 +16,7 @@ export declare const fetchFinanceStatement: import("@reduxjs/toolkit").ActionCre
|
|
|
16
16
|
thisPeriod: TimeframeTick;
|
|
17
17
|
coaBalances: COABalance[];
|
|
18
18
|
maxNumOfPeriodsToHighlight: number;
|
|
19
|
-
}, string>, updateCOABalancesRange: import("@reduxjs/toolkit").ActionCreatorWithPayload<COABalancesRange, string>, updateSelectedReportId: import("@reduxjs/toolkit").ActionCreatorWithPayload<"cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets", string>, updateFinanceStatementAdditionalBalancesSelection: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
|
+
}, string>, updateCOABalancesRange: import("@reduxjs/toolkit").ActionCreatorWithPayload<COABalancesRange, string>, updateSelectedReportId: import("@reduxjs/toolkit").ActionCreatorWithPayload<"cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification", string>, updateFinanceStatementAdditionalBalancesSelection: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
20
20
|
firstMonthOfFY: Month;
|
|
21
21
|
isCompareModeOn: boolean;
|
|
22
22
|
additionalBalances: COABalanceType[];
|
|
@@ -4,9 +4,9 @@ import { ID } from '../../commonStateTypes/common';
|
|
|
4
4
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
5
5
|
import { VendorReviewViewAllRecommendationsPayload } from '../vendorReviewView/common/payload/commonTypes';
|
|
6
6
|
export declare const initialState: GlobalMerchantViewState;
|
|
7
|
-
export declare const createGlobalMerchant: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[merchantId?: string | undefined, context?: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | undefined], {
|
|
7
|
+
export declare const createGlobalMerchant: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[merchantId?: string | undefined, context?: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | undefined], {
|
|
8
8
|
merchantId: string | undefined;
|
|
9
|
-
context: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | undefined;
|
|
9
|
+
context: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | undefined;
|
|
10
10
|
}, string, never, never>, createGlobalMerchantSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
11
11
|
merchantId: ID;
|
|
12
12
|
}, string>, createGlobalMerchantFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { fetchNotificationUnreadCount, fetchNotificationUnreadCountSuccess, fetchNotificationUnreadCountFailure } from '../notificationViewReducer';
|
|
6
|
+
import { updateAllUsers } from '../../../entity/user/userReducer';
|
|
7
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
8
|
+
import { updateAllNotifications } from '../../../entity/notification/notificationReducer';
|
|
9
|
+
export declare type ActionType = ReturnType<typeof updateAllNotifications> | ReturnType<typeof updateAllUsers> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchNotificationUnreadCount> | ReturnType<typeof fetchNotificationUnreadCountSuccess> | ReturnType<typeof fetchNotificationUnreadCountFailure>;
|
|
10
|
+
export declare const fetchNotificationUnreadCountEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchNotificationUnreadCountEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const notificationViewReducer_1 = require("../notificationViewReducer");
|
|
8
|
+
const fetchNotificationUnreadCountEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(notificationViewReducer_1.fetchNotificationUnreadCount.match), (0, operators_1.switchMap)((action) => {
|
|
9
|
+
const { notificationGroup, mode } = action.payload;
|
|
10
|
+
const queryParam = {
|
|
11
|
+
fetch_unread_notification_count: true,
|
|
12
|
+
notification_group: notificationGroup,
|
|
13
|
+
mode,
|
|
14
|
+
};
|
|
15
|
+
return zeniAPI
|
|
16
|
+
.getJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/user-notification?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
17
|
+
.pipe((0, operators_1.switchMap)((response) => {
|
|
18
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
+
const { count: { unread }, } = response.data;
|
|
20
|
+
const actions = [
|
|
21
|
+
(0, notificationViewReducer_1.fetchNotificationUnreadCountSuccess)(unread, notificationGroup),
|
|
22
|
+
];
|
|
23
|
+
return actions;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return (0, rxjs_1.of)((0, notificationViewReducer_1.fetchNotificationUnreadCountFailure)({
|
|
27
|
+
status: response.status,
|
|
28
|
+
notificationGroup,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
}), (0, operators_1.catchError)((error) => {
|
|
32
|
+
return (0, rxjs_1.of)((0, notificationViewReducer_1.fetchNotificationUnreadCountFailure)({
|
|
33
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Notification Unread Count API call errored out' +
|
|
34
|
+
JSON.stringify(error)),
|
|
35
|
+
notificationGroup,
|
|
36
|
+
}));
|
|
37
|
+
}));
|
|
38
|
+
}));
|
|
39
|
+
exports.fetchNotificationUnreadCountEpic = fetchNotificationUnreadCountEpic;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { fetchNotificationView, fetchNotificationViewSuccess, fetchNotificationViewFailure } from '../notificationViewReducer';
|
|
6
|
+
import { updateAllUsers } from '../../../entity/user/userReducer';
|
|
7
|
+
import { updateAllNotifications } from '../../../entity/notification/notificationReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof updateAllNotifications> | ReturnType<typeof updateAllUsers> | ReturnType<typeof fetchNotificationView> | ReturnType<typeof fetchNotificationViewSuccess> | ReturnType<typeof fetchNotificationViewFailure>;
|
|
9
|
+
export declare const fetchNotificationViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchNotificationViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const notificationViewReducer_1 = require("../notificationViewReducer");
|
|
8
|
+
const userReducer_1 = require("../../../entity/user/userReducer");
|
|
9
|
+
const notificationReducer_1 = require("../../../entity/notification/notificationReducer");
|
|
10
|
+
const fetchNotificationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(notificationViewReducer_1.fetchNotificationView.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const { notificationGroup, mode, status } = action.payload;
|
|
12
|
+
const { stateByTab } = state$.value.notificationViewState;
|
|
13
|
+
const notificationTab = (0, notificationViewReducer_1.toNotificationTab)(notificationGroup);
|
|
14
|
+
const notificationTabState = stateByTab[notificationTab];
|
|
15
|
+
const queryParam = {
|
|
16
|
+
status,
|
|
17
|
+
notification_group: notificationGroup,
|
|
18
|
+
is_paginated: true,
|
|
19
|
+
limit: 10,
|
|
20
|
+
mode,
|
|
21
|
+
page_token: notificationTabState.uiState.pageToken,
|
|
22
|
+
};
|
|
23
|
+
return zeniAPI
|
|
24
|
+
.getJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/user-notification?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
25
|
+
.pipe((0, operators_1.switchMap)((response) => {
|
|
26
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
27
|
+
const { notifications, total_count, next_page_token } = response.data;
|
|
28
|
+
const allUsers = [];
|
|
29
|
+
notifications.forEach((notification) => {
|
|
30
|
+
allUsers.push(...notification.data.authors);
|
|
31
|
+
});
|
|
32
|
+
const allUniqueUsers = [
|
|
33
|
+
...new Map(allUsers.map((user) => [user.user_id, user])).values(),
|
|
34
|
+
];
|
|
35
|
+
const actions = [
|
|
36
|
+
(0, userReducer_1.updateAllUsers)({ users: allUniqueUsers, updateType: 'merge' }),
|
|
37
|
+
(0, notificationReducer_1.updateAllNotifications)(notifications, 'replace'),
|
|
38
|
+
(0, notificationViewReducer_1.fetchNotificationViewSuccess)(notifications, total_count, notificationGroup, next_page_token),
|
|
39
|
+
];
|
|
40
|
+
return actions;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return (0, rxjs_1.of)((0, notificationViewReducer_1.fetchNotificationViewFailure)({
|
|
44
|
+
status: response.status,
|
|
45
|
+
notificationGroup,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}), (0, operators_1.catchError)((error) => {
|
|
49
|
+
return (0, rxjs_1.of)((0, notificationViewReducer_1.fetchNotificationViewFailure)({
|
|
50
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Notification View API call errored out' +
|
|
51
|
+
JSON.stringify(error)),
|
|
52
|
+
notificationGroup,
|
|
53
|
+
}));
|
|
54
|
+
}));
|
|
55
|
+
}));
|
|
56
|
+
exports.fetchNotificationViewEpic = fetchNotificationViewEpic;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { updateNotificationViewAllNotificationsStatus, updateNotificationViewAllNotificationsStatusSuccess, updateNotificationViewAllNotificationsStatusFailure } from '../notificationViewReducer';
|
|
6
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
|
+
import { updateNotificationsStatuses } from '../../../entity/notification/notificationReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof updateNotificationsStatuses> | ReturnType<typeof updateNotificationViewAllNotificationsStatus> | ReturnType<typeof updateNotificationViewAllNotificationsStatusSuccess> | ReturnType<typeof updateNotificationViewAllNotificationsStatusFailure>;
|
|
9
|
+
export declare const updateNotificationViewAllNotificationsStatusEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateNotificationViewAllNotificationsStatusEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const notificationViewReducer_1 = require("../notificationViewReducer");
|
|
8
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
|
+
const notificationReducer_1 = require("../../../entity/notification/notificationReducer");
|
|
10
|
+
const updateNotificationViewAllNotificationsStatusEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(notificationViewReducer_1.updateNotificationViewAllNotificationsStatus.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const { notificationGroup, status } = action.payload;
|
|
12
|
+
const { notificationViewState } = state$.value;
|
|
13
|
+
const { stateByTab } = notificationViewState;
|
|
14
|
+
const { allNotificationsIds } = stateByTab['tasks'];
|
|
15
|
+
const queryParam = {
|
|
16
|
+
mark_all_as_read: status === 'read',
|
|
17
|
+
};
|
|
18
|
+
return zeniAPI
|
|
19
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/user-notification-dashboard?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
20
|
+
.pipe((0, operators_1.switchMap)((response) => {
|
|
21
|
+
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
22
|
+
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
23
|
+
messageSection: 'notification_mark_as_read',
|
|
24
|
+
messageText: 'success',
|
|
25
|
+
type: 'success',
|
|
26
|
+
}), (0, notificationReducer_1.updateNotificationsStatuses)(allNotificationsIds, status), (0, notificationViewReducer_1.updateNotificationViewAllNotificationsStatusSuccess)(notificationGroup));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return (0, rxjs_1.of)((0, notificationViewReducer_1.updateNotificationViewAllNotificationsStatusFailure)({
|
|
30
|
+
status: response.status,
|
|
31
|
+
notificationGroup,
|
|
32
|
+
}), (0, snackbarReducer_1.openSnackbar)({
|
|
33
|
+
messageSection: 'notification_mark_as_read',
|
|
34
|
+
messageText: 'failed',
|
|
35
|
+
type: 'error',
|
|
36
|
+
variables: [
|
|
37
|
+
{
|
|
38
|
+
variableName: '_api-error_',
|
|
39
|
+
variableValue: response.status.message,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, notificationViewReducer_1.updateNotificationViewAllNotificationsStatusFailure)({
|
|
45
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update All Notifications Status API call errored out' +
|
|
46
|
+
JSON.stringify(error)),
|
|
47
|
+
notificationGroup,
|
|
48
|
+
}))));
|
|
49
|
+
}));
|
|
50
|
+
exports.updateNotificationViewAllNotificationsStatusEpic = updateNotificationViewAllNotificationsStatusEpic;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
+
import { updateNotificationViewNotificationStatus, updateNotificationViewNotificationStatusSuccess, updateNotificationViewNotificationStatusFailure } from '../notificationViewReducer';
|
|
6
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
|
+
import { updateNotificationsStatuses } from '../../../entity/notification/notificationReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof updateNotificationsStatuses> | ReturnType<typeof updateNotificationViewNotificationStatus> | ReturnType<typeof updateNotificationViewNotificationStatusSuccess> | ReturnType<typeof updateNotificationViewNotificationStatusFailure>;
|
|
9
|
+
export declare const updateNotificationViewNotificationStatusEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateNotificationViewNotificationStatusEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const notificationViewReducer_1 = require("../notificationViewReducer");
|
|
8
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
|
+
const notificationReducer_1 = require("../../../entity/notification/notificationReducer");
|
|
10
|
+
const updateNotificationViewNotificationStatusEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(notificationViewReducer_1.updateNotificationViewNotificationStatus.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const { notificationGroup, status, notificationIds, showSnackBarOnSuccess, } = action.payload;
|
|
12
|
+
const { notificationViewState, notificationState } = state$.value;
|
|
13
|
+
const { stateByTab } = notificationViewState;
|
|
14
|
+
const notificationTab = (0, notificationViewReducer_1.toNotificationTab)(notificationGroup);
|
|
15
|
+
const notificationTabState = stateByTab[notificationTab];
|
|
16
|
+
const { selectedNotificationIds } = notificationTabState;
|
|
17
|
+
const payload = {
|
|
18
|
+
notifications: [],
|
|
19
|
+
};
|
|
20
|
+
let reduceUnreadCountBy = 0;
|
|
21
|
+
if (notificationIds.length > 0) {
|
|
22
|
+
notificationIds.forEach((notificationId) => {
|
|
23
|
+
payload.notifications.push({
|
|
24
|
+
user_notification_id: notificationId,
|
|
25
|
+
status,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
reduceUnreadCountBy = notificationIds.length;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
selectedNotificationIds.forEach((notificationId) => {
|
|
32
|
+
payload.notifications.push({
|
|
33
|
+
user_notification_id: notificationId,
|
|
34
|
+
status,
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
if (notificationTab !== 'comments') {
|
|
38
|
+
selectedNotificationIds.forEach((selectedNotificationId) => {
|
|
39
|
+
if (notificationState.notificationById[selectedNotificationId] != null) {
|
|
40
|
+
if (notificationState.notificationById[selectedNotificationId]
|
|
41
|
+
.status !== status) {
|
|
42
|
+
reduceUnreadCountBy = reduceUnreadCountBy + 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return zeniAPI
|
|
49
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/user-notification`, { notifications: payload.notifications })
|
|
50
|
+
.pipe((0, operators_1.switchMap)((response) => {
|
|
51
|
+
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
52
|
+
const updateNotificationIds = payload.notifications.map((notification) => notification.user_notification_id);
|
|
53
|
+
const actions = [];
|
|
54
|
+
if (showSnackBarOnSuccess === true) {
|
|
55
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
56
|
+
messageSection: 'notification_mark_as_read',
|
|
57
|
+
messageText: 'success',
|
|
58
|
+
type: 'success',
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
actions.push((0, notificationReducer_1.updateNotificationsStatuses)(updateNotificationIds, status), (0, notificationViewReducer_1.updateNotificationViewNotificationStatusSuccess)(notificationGroup, reduceUnreadCountBy));
|
|
62
|
+
return (0, rxjs_1.from)(actions);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return (0, rxjs_1.of)((0, notificationViewReducer_1.updateNotificationViewNotificationStatusFailure)({
|
|
66
|
+
status: response.status,
|
|
67
|
+
notificationGroup,
|
|
68
|
+
}), (0, snackbarReducer_1.openSnackbar)({
|
|
69
|
+
messageSection: 'notification_mark_as_read',
|
|
70
|
+
messageText: 'failed',
|
|
71
|
+
type: 'error',
|
|
72
|
+
variables: [
|
|
73
|
+
{
|
|
74
|
+
variableName: '_api-error_',
|
|
75
|
+
variableValue: response.status.message,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, notificationViewReducer_1.updateNotificationViewNotificationStatusFailure)({
|
|
81
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update Notification Status API call errored out' +
|
|
82
|
+
JSON.stringify(error)),
|
|
83
|
+
notificationGroup,
|
|
84
|
+
}))));
|
|
85
|
+
}));
|
|
86
|
+
exports.updateNotificationViewNotificationStatusEpic = updateNotificationViewNotificationStatusEpic;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSubTabsForATab = void 0;
|
|
4
|
+
const getSubTabsForATab = (notificationTab) => {
|
|
5
|
+
const subTabs = ['all', 'read', 'unread'];
|
|
6
|
+
if (notificationTab === 'comments') {
|
|
7
|
+
return [...subTabs, 'mentions'];
|
|
8
|
+
}
|
|
9
|
+
return subTabs;
|
|
10
|
+
};
|
|
11
|
+
exports.getSubTabsForATab = getSubTabsForATab;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ZeniAPIResponse } from '../../responsePayload';
|
|
2
|
+
import { NotificationPayload } from '../../entity/notification/notificationPayload';
|
|
3
|
+
export interface NotificationViewQueryPayload {
|
|
4
|
+
notification_group: string;
|
|
5
|
+
mode: string;
|
|
6
|
+
is_paginated: boolean;
|
|
7
|
+
status: string[];
|
|
8
|
+
page_token: string | null;
|
|
9
|
+
limit: number;
|
|
10
|
+
}
|
|
11
|
+
export interface NotificationViewPayload {
|
|
12
|
+
notifications: NotificationPayload[];
|
|
13
|
+
query: NotificationViewQueryPayload;
|
|
14
|
+
total_count: number;
|
|
15
|
+
next_page_token: string | null;
|
|
16
|
+
}
|
|
17
|
+
export declare type NotificationViewResponse = ZeniAPIResponse<NotificationViewPayload>;
|
|
18
|
+
export interface UpdateNotificationStatusQueryPayload {
|
|
19
|
+
notification_group: string;
|
|
20
|
+
is_paginated: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface UpdateAllNotificationStatusQueryPayload {
|
|
23
|
+
mark_all_as_read: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface FetchNotificationCountQueryPayload {
|
|
26
|
+
fetch_unread_notification_count: boolean;
|
|
27
|
+
notification_group: string;
|
|
28
|
+
mode: string;
|
|
29
|
+
}
|
|
30
|
+
export interface FetchNotificationCountPayload {
|
|
31
|
+
notification_group: string;
|
|
32
|
+
mode: string;
|
|
33
|
+
query: FetchNotificationCountQueryPayload;
|
|
34
|
+
count: {
|
|
35
|
+
unread: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare type UpdateNotificationStatusResponse = ZeniAPIResponse;
|
|
39
|
+
export declare type UpdateAllNotificationsStatusResponse = ZeniAPIResponse;
|
|
40
|
+
export declare type FetchNotificationCountResponse = ZeniAPIResponse<FetchNotificationCountPayload>;
|
|
41
|
+
export interface PushNotificationPayload {
|
|
42
|
+
notification_group: string;
|
|
43
|
+
mode: string;
|
|
44
|
+
data: {
|
|
45
|
+
unread: number;
|
|
46
|
+
};
|
|
47
|
+
timestamp: string;
|
|
48
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
+
import { NotificationPayload } from '../../entity/notification/notificationPayload';
|
|
3
|
+
import { NotificationTabState, NotificationTabType, NotificationViewState, NotificationViewUIState } from './notificationViewState';
|
|
4
|
+
import { NotificationGroup } from '../../entity/notification/types/notificationTypes';
|
|
5
|
+
import { PageToken } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
6
|
+
export declare const initialState: NotificationViewState;
|
|
7
|
+
export declare const fetchNotificationView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", mode?: "dashboard" | "email" | undefined, status?: ("unread" | "read")[] | undefined], {
|
|
8
|
+
notificationGroup: "task_manager";
|
|
9
|
+
mode: "dashboard" | "email";
|
|
10
|
+
status: ("unread" | "read")[];
|
|
11
|
+
}, string, never, never>, fetchNotificationViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notifications: NotificationPayload[], totalCount: number, notificationGroup: "task_manager", pageToken: PageToken], {
|
|
12
|
+
notifications: NotificationPayload[];
|
|
13
|
+
totalCount: number;
|
|
14
|
+
notificationGroup: "task_manager";
|
|
15
|
+
pageToken: PageToken;
|
|
16
|
+
}, string, never, never>, fetchNotificationViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
17
|
+
status: ZeniAPIStatus;
|
|
18
|
+
notificationGroup: NotificationGroup;
|
|
19
|
+
}, string>, fetchNotificationUnreadCount: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", mode?: "dashboard" | "email" | undefined], {
|
|
20
|
+
notificationGroup: "task_manager";
|
|
21
|
+
mode: "dashboard" | "email";
|
|
22
|
+
}, string, never, never>, fetchNotificationUnreadCountSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[unreadCount: number, notificationGroup: "task_manager"], {
|
|
23
|
+
unreadCount: number;
|
|
24
|
+
notificationGroup: "task_manager";
|
|
25
|
+
}, string, never, never>, fetchNotificationUnreadCountFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
26
|
+
status: ZeniAPIStatus;
|
|
27
|
+
notificationGroup: NotificationGroup;
|
|
28
|
+
}, string>, updateNotificationViewNotificationStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", status: "unread" | "read", notificationIds?: string[] | undefined, showSnackBarOnSuccess?: any], {
|
|
29
|
+
notificationGroup: "task_manager";
|
|
30
|
+
status: "unread" | "read";
|
|
31
|
+
notificationIds: string[];
|
|
32
|
+
showSnackBarOnSuccess: any;
|
|
33
|
+
}, string, never, never>, updateNotificationViewNotificationStatusSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", reduceUnreadCountBy: number], {
|
|
34
|
+
notificationGroup: "task_manager";
|
|
35
|
+
reduceUnreadCountBy: number;
|
|
36
|
+
}, string, never, never>, updateNotificationViewNotificationStatusFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
37
|
+
status: ZeniAPIStatus;
|
|
38
|
+
notificationGroup: NotificationGroup;
|
|
39
|
+
}, string>, updateNotificationViewAllNotificationsStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager", status: "unread" | "read"], {
|
|
40
|
+
notificationGroup: "task_manager";
|
|
41
|
+
status: "unread" | "read";
|
|
42
|
+
}, string, never, never>, updateNotificationViewAllNotificationsStatusSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationGroup: "task_manager"], {
|
|
43
|
+
notificationGroup: "task_manager";
|
|
44
|
+
}, string, never, never>, updateNotificationViewAllNotificationsStatusFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
45
|
+
status: ZeniAPIStatus;
|
|
46
|
+
notificationGroup: NotificationGroup;
|
|
47
|
+
}, string>, updateNotificationViewTabState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[notificationTabState: Partial<NotificationTabState>, tab: "tasks" | "comments"], {
|
|
48
|
+
notificationTabState: Partial<NotificationTabState>;
|
|
49
|
+
tab: "tasks" | "comments";
|
|
50
|
+
}, string, never, never>, updateNotificationViewCurrentTabAndSubTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newTab: "tasks" | "comments", newSubTab?: "all" | "unread" | "read" | "mentions" | undefined], {
|
|
51
|
+
newTab: "tasks" | "comments";
|
|
52
|
+
newSubTab: "all" | "unread" | "read" | "mentions" | undefined;
|
|
53
|
+
}, string, never, never>, updateNotificationViewSubTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSubTab: "all" | "unread" | "read" | "mentions"], {
|
|
54
|
+
newSubTab: "all" | "unread" | "read" | "mentions";
|
|
55
|
+
}, string, never, never>, updateNotificationViewUIState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[uiState: Partial<NotificationViewUIState>, tab: "tasks" | "comments"], {
|
|
56
|
+
uiState: Partial<NotificationViewUIState>;
|
|
57
|
+
tab: "tasks" | "comments";
|
|
58
|
+
}, string, never, never>, clearNotificationView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
59
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<NotificationViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
60
|
+
export default _default;
|
|
61
|
+
/**
|
|
62
|
+
* Helpers
|
|
63
|
+
*/
|
|
64
|
+
export declare const toNotificationTab: (notificationGroup: NotificationGroup) => NotificationTabType;
|