@zeniai/client-epic-state 5.1.68-betaDI2 → 5.1.69-betaAK0
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/esm/index.js +9 -9
- package/lib/esm/view/invoicing/couponView/couponViewEpics.js +0 -3
- package/lib/esm/view/invoicing/couponView/couponViewReducer.js +7 -1
- package/lib/esm/view/invoicing/couponView/couponViewSelector.js +27 -14
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListEpic.js +7 -5
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +62 -36
- package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +19 -15
- package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +10 -0
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListEpic.js +0 -3
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +23 -13
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +3 -2
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
- package/lib/esm/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListEpic.js +0 -3
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +25 -12
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListEpic.js +0 -3
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +23 -13
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListEpic.js +0 -3
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +22 -12
- package/lib/esm/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListEpic.js +7 -5
- package/lib/esm/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +56 -25
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +15 -11
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +10 -0
- package/lib/esm/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +12 -9
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewPayload.js +2 -7
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewReducer.js +2 -47
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewSelector.js +0 -9
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewState.js +0 -1
- package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +8 -2
- package/lib/esm/view/spendManagement/helpers.js +12 -0
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +0 -12
- package/lib/esm/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +4 -2
- package/lib/index.d.ts +9 -9
- package/lib/index.js +21 -16
- package/lib/view/invoicing/couponView/couponViewEpics.js +0 -3
- package/lib/view/invoicing/couponView/couponViewReducer.d.ts +1 -1
- package/lib/view/invoicing/couponView/couponViewReducer.js +8 -2
- package/lib/view/invoicing/couponView/couponViewSelector.d.ts +1 -0
- package/lib/view/invoicing/couponView/couponViewSelector.js +27 -14
- package/lib/view/invoicing/couponView/couponViewState.d.ts +2 -1
- package/lib/view/invoicing/invoiceList/fetchInvoiceListEpic.d.ts +1 -1
- package/lib/view/invoicing/invoiceList/fetchInvoiceListEpic.js +7 -5
- package/lib/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.d.ts +5 -4
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +63 -37
- package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +1 -0
- package/lib/view/invoicing/invoiceList/invoiceListSelector.js +19 -15
- package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +21 -7
- package/lib/view/invoicing/invoiceList/invoiceListState.js +13 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListEpic.js +0 -3
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.js +8 -2
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +23 -13
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +2 -1
- package/lib/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +3 -2
- package/lib/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
- package/lib/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListEpic.js +0 -3
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.js +8 -2
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +25 -12
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +2 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListEpic.js +0 -3
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.js +8 -2
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +23 -13
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +2 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListEpic.js +0 -3
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js +8 -2
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +22 -12
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +3 -1
- package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListEpic.d.ts +1 -1
- package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListEpic.js +7 -5
- package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +57 -26
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +15 -11
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts +18 -4
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +13 -1
- package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.d.ts +8 -2
- package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +9 -6
- package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.d.ts +0 -1
- package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.js +2 -7
- package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.d.ts +1 -6
- package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.js +3 -48
- package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.js +0 -9
- package/lib/view/notificationPreferencesView/notificationPreferencesViewState.d.ts +0 -1
- package/lib/view/notificationPreferencesView/notificationPreferencesViewState.js +0 -1
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +7 -1
- package/lib/view/spendManagement/helpers.d.ts +1 -0
- package/lib/view/spendManagement/helpers.js +14 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.d.ts +1 -2
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +0 -12
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +3 -1
- package/package.json +1 -1
|
@@ -9,7 +9,12 @@ const notificationPreferencesEndpoint_1 = require("../notificationPreferencesEnd
|
|
|
9
9
|
const notificationPreferencesViewPayload_1 = require("../notificationPreferencesViewPayload");
|
|
10
10
|
const notificationPreferencesViewReducer_1 = require("../notificationPreferencesViewReducer");
|
|
11
11
|
const notificationPreferencesViewSelector_1 = require("../notificationPreferencesViewSelector");
|
|
12
|
-
const
|
|
12
|
+
const DEBOUNCE_MS = 300;
|
|
13
|
+
const saveNotificationPreferencesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)((action) => notificationPreferencesViewReducer_1.toggleEventChannel.match(action) || notificationPreferencesViewReducer_1.setGroupFrequency.match(action)),
|
|
14
|
+
// Coalesce bursts of toggles into a single PUT. Trade-off: rapid clickers
|
|
15
|
+
// defer saves until they pause. Consider a max-wait wrapper if this
|
|
16
|
+
// becomes a UX problem.
|
|
17
|
+
(0, operators_1.debounceTime)(DEBOUNCE_MS), (0, operators_1.withLatestFrom)(state$),
|
|
13
18
|
// `switchMap` unsubscribes from any in-flight PUT observable when a new
|
|
14
19
|
// debounced batch fires. The prior HTTP request has already left the
|
|
15
20
|
// client — the network call is NOT cancelled — but its response is
|
|
@@ -108,10 +113,8 @@ const saveNotificationPreferencesEpic = (actions$, state$, zeniAPI) => actions$.
|
|
|
108
113
|
// under patch-semantic LWW. Cursor Bugbot 3637969823 + 3641372002.
|
|
109
114
|
(0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)((action) => notificationPreferencesViewReducer_1.clearNotificationPreferencesLocalOverrides.match(action) ||
|
|
110
115
|
notificationPreferencesViewReducer_1.clearAllNotificationPreferencesView.match(action)))));
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
// loop the epic on itself.
|
|
115
|
-
return request$;
|
|
116
|
+
// Flip savePreferencesState to In-Progress BEFORE the network call so
|
|
117
|
+
// any "saving…" UI can render.
|
|
118
|
+
return (0, rxjs_1.concat)((0, rxjs_1.of)((0, notificationPreferencesViewReducer_1.saveNotificationPreferences)()), request$);
|
|
116
119
|
}));
|
|
117
120
|
exports.saveNotificationPreferencesEpic = saveNotificationPreferencesEpic;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NotificationPreferences } from './notificationPreferencesViewState';
|
|
2
2
|
export interface NotificationPreferencesPayload {
|
|
3
3
|
event_enabled_by_channel?: Record<string, Record<string, boolean>>;
|
|
4
|
-
group_channel_enabled_by_group_id?: Record<string, Record<string, boolean>>;
|
|
5
4
|
group_frequency_by_group_id?: Record<string, string>;
|
|
6
5
|
}
|
|
7
6
|
export declare const mapPayloadToPreferences: (payload?: NotificationPreferencesPayload) => NotificationPreferences;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapPreferencesToPayload = exports.mapPayloadToPreferences = void 0;
|
|
4
4
|
const notificationRegistryState_1 = require("../../entity/notificationRegistry/notificationRegistryState");
|
|
5
|
-
const
|
|
5
|
+
const mapEventEnabledByChannel = (raw) => {
|
|
6
6
|
if (raw == null) {
|
|
7
7
|
return {};
|
|
8
8
|
}
|
|
@@ -23,8 +23,7 @@ const mapPayloadToPreferences = (payload) => {
|
|
|
23
23
|
(0, notificationRegistryState_1.toNotificationFrequency)(frequency),
|
|
24
24
|
]));
|
|
25
25
|
return {
|
|
26
|
-
eventEnabledByChannel:
|
|
27
|
-
groupChannelEnabledByGroupId: mapChannelEnabledMap(payload?.group_channel_enabled_by_group_id),
|
|
26
|
+
eventEnabledByChannel: mapEventEnabledByChannel(payload?.event_enabled_by_channel),
|
|
28
27
|
groupFrequencyByGroupId,
|
|
29
28
|
};
|
|
30
29
|
};
|
|
@@ -34,10 +33,6 @@ const mapPreferencesToPayload = (preferences) => {
|
|
|
34
33
|
if (Object.keys(preferences.eventEnabledByChannel).length > 0) {
|
|
35
34
|
payload.event_enabled_by_channel = preferences.eventEnabledByChannel;
|
|
36
35
|
}
|
|
37
|
-
if (Object.keys(preferences.groupChannelEnabledByGroupId).length > 0) {
|
|
38
|
-
payload.group_channel_enabled_by_group_id =
|
|
39
|
-
preferences.groupChannelEnabledByGroupId;
|
|
40
|
-
}
|
|
41
36
|
if (Object.keys(preferences.groupFrequencyByGroupId).length > 0) {
|
|
42
37
|
payload.group_frequency_by_group_id = preferences.groupFrequencyByGroupId;
|
|
43
38
|
}
|
|
@@ -12,11 +12,6 @@ export interface TogglePreferencePayload {
|
|
|
12
12
|
enabled: boolean;
|
|
13
13
|
eventId: string;
|
|
14
14
|
}
|
|
15
|
-
export interface SetGroupChannelMasterPayload {
|
|
16
|
-
channel: NotificationChannel;
|
|
17
|
-
enabled: boolean;
|
|
18
|
-
groupId: string;
|
|
19
|
-
}
|
|
20
15
|
export interface FetchNotificationPreferencesSuccessPayload {
|
|
21
16
|
preferences: NotificationPreferencesPayload | undefined;
|
|
22
17
|
saveEpochAtDispatch: number;
|
|
@@ -30,6 +25,6 @@ export interface SaveNotificationPreferencesFailurePayload {
|
|
|
30
25
|
cancelEpochAtDispatch: number;
|
|
31
26
|
error?: ZeniAPIStatus;
|
|
32
27
|
}
|
|
33
|
-
export declare const clearAllNotificationPreferencesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"notificationPreferencesView/clearAllNotificationPreferencesView">, clearNotificationPreferencesLocalOverrides: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"notificationPreferencesView/clearNotificationPreferencesLocalOverrides">, fetchNotificationPreferencesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<FetchNotificationPreferencesSuccessPayload, "notificationPreferencesView/fetchNotificationPreferencesSuccess">, saveNotificationPreferences: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"notificationPreferencesView/saveNotificationPreferences">, saveNotificationPreferencesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveNotificationPreferencesFailurePayload, "notificationPreferencesView/saveNotificationPreferencesFailure">, saveNotificationPreferencesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveNotificationPreferencesSuccessPayload, "notificationPreferencesView/saveNotificationPreferencesSuccess">,
|
|
28
|
+
export declare const clearAllNotificationPreferencesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"notificationPreferencesView/clearAllNotificationPreferencesView">, clearNotificationPreferencesLocalOverrides: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"notificationPreferencesView/clearNotificationPreferencesLocalOverrides">, fetchNotificationPreferencesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<FetchNotificationPreferencesSuccessPayload, "notificationPreferencesView/fetchNotificationPreferencesSuccess">, saveNotificationPreferences: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"notificationPreferencesView/saveNotificationPreferences">, saveNotificationPreferencesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveNotificationPreferencesFailurePayload, "notificationPreferencesView/saveNotificationPreferencesFailure">, saveNotificationPreferencesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveNotificationPreferencesSuccessPayload, "notificationPreferencesView/saveNotificationPreferencesSuccess">, setGroupFrequency: import("@reduxjs/toolkit").ActionCreatorWithPayload<SetFrequencyPayload, "notificationPreferencesView/setGroupFrequency">, toggleEventChannel: import("@reduxjs/toolkit").ActionCreatorWithPayload<TogglePreferencePayload, "notificationPreferencesView/toggleEventChannel">;
|
|
34
29
|
declare const _default: import("redux").Reducer<NotificationPreferencesViewState>;
|
|
35
30
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.toggleEventChannel = exports.setGroupFrequency = exports.
|
|
4
|
+
exports.toggleEventChannel = exports.setGroupFrequency = exports.saveNotificationPreferencesSuccess = exports.saveNotificationPreferencesFailure = exports.saveNotificationPreferences = exports.fetchNotificationPreferencesSuccess = exports.clearNotificationPreferencesLocalOverrides = exports.clearAllNotificationPreferencesView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const notificationPreferencesViewPayload_1 = require("./notificationPreferencesViewPayload");
|
|
7
7
|
const notificationPreferencesViewState_1 = require("./notificationPreferencesViewState");
|
|
@@ -22,18 +22,8 @@ const mergePreferences = (base, patch) => {
|
|
|
22
22
|
...channels,
|
|
23
23
|
};
|
|
24
24
|
});
|
|
25
|
-
const groupChannelEnabledByGroupId = {
|
|
26
|
-
...base.groupChannelEnabledByGroupId,
|
|
27
|
-
};
|
|
28
|
-
Object.entries(patch.groupChannelEnabledByGroupId).forEach(([groupId, channels]) => {
|
|
29
|
-
groupChannelEnabledByGroupId[groupId] = {
|
|
30
|
-
...(base.groupChannelEnabledByGroupId[groupId] ?? {}),
|
|
31
|
-
...channels,
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
25
|
return {
|
|
35
26
|
eventEnabledByChannel,
|
|
36
|
-
groupChannelEnabledByGroupId,
|
|
37
27
|
groupFrequencyByGroupId: {
|
|
38
28
|
...base.groupFrequencyByGroupId,
|
|
39
29
|
...patch.groupFrequencyByGroupId,
|
|
@@ -75,38 +65,13 @@ const subtractSavedOverrides = (current, saved) => {
|
|
|
75
65
|
eventEnabledByChannel[eventId] = remainingChannels;
|
|
76
66
|
}
|
|
77
67
|
});
|
|
78
|
-
// Same value-equality subtraction as eventEnabledByChannel above — a
|
|
79
|
-
// group-channel master the user re-flipped while a PUT was in flight must
|
|
80
|
-
// survive so the next debounce cycle re-sends it.
|
|
81
|
-
const groupChannelEnabledByGroupId = {};
|
|
82
|
-
Object.entries(current.groupChannelEnabledByGroupId).forEach(([groupId, channels]) => {
|
|
83
|
-
const savedChannels = saved.groupChannelEnabledByGroupId[groupId];
|
|
84
|
-
if (savedChannels == null) {
|
|
85
|
-
groupChannelEnabledByGroupId[groupId] = channels;
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
const remainingChannels = {};
|
|
89
|
-
Object.keys(channels).forEach((channel) => {
|
|
90
|
-
if (!(channel in savedChannels) ||
|
|
91
|
-
channels[channel] !== savedChannels[channel]) {
|
|
92
|
-
remainingChannels[channel] = channels[channel];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
if (Object.keys(remainingChannels).length > 0) {
|
|
96
|
-
groupChannelEnabledByGroupId[groupId] = remainingChannels;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
68
|
const groupFrequencyByGroupId = {};
|
|
100
69
|
Object.entries(current.groupFrequencyByGroupId).forEach(([groupId, frequency]) => {
|
|
101
70
|
if (saved.groupFrequencyByGroupId[groupId] !== frequency) {
|
|
102
71
|
groupFrequencyByGroupId[groupId] = frequency;
|
|
103
72
|
}
|
|
104
73
|
});
|
|
105
|
-
return {
|
|
106
|
-
eventEnabledByChannel,
|
|
107
|
-
groupChannelEnabledByGroupId,
|
|
108
|
-
groupFrequencyByGroupId,
|
|
109
|
-
};
|
|
74
|
+
return { eventEnabledByChannel, groupFrequencyByGroupId };
|
|
110
75
|
};
|
|
111
76
|
const notificationPreferencesView = (0, toolkit_1.createSlice)({
|
|
112
77
|
name: 'notificationPreferencesView',
|
|
@@ -243,16 +208,6 @@ const notificationPreferencesView = (0, toolkit_1.createSlice)({
|
|
|
243
208
|
draft.preferences = mergePreferences(draft.preferences, patch);
|
|
244
209
|
draft.localOverrides = subtractSavedOverrides(draft.localOverrides, action.payload.savedOverrides);
|
|
245
210
|
},
|
|
246
|
-
setGroupChannelMaster(draft, action) {
|
|
247
|
-
// Mirror of `toggleEventChannel` but scoped to the group-channel master
|
|
248
|
-
// held under `groupChannelEnabledByGroupId[groupId][channel]`.
|
|
249
|
-
const { channel, enabled, groupId } = action.payload;
|
|
250
|
-
const groupMap = {
|
|
251
|
-
...(draft.localOverrides.groupChannelEnabledByGroupId[groupId] ?? {}),
|
|
252
|
-
};
|
|
253
|
-
groupMap[channel] = enabled;
|
|
254
|
-
draft.localOverrides.groupChannelEnabledByGroupId[groupId] = groupMap;
|
|
255
|
-
},
|
|
256
211
|
setGroupFrequency(draft, action) {
|
|
257
212
|
draft.localOverrides.groupFrequencyByGroupId[action.payload.groupId] =
|
|
258
213
|
action.payload.frequency;
|
|
@@ -267,5 +222,5 @@ const notificationPreferencesView = (0, toolkit_1.createSlice)({
|
|
|
267
222
|
},
|
|
268
223
|
},
|
|
269
224
|
});
|
|
270
|
-
_a = notificationPreferencesView.actions, exports.clearAllNotificationPreferencesView = _a.clearAllNotificationPreferencesView, exports.clearNotificationPreferencesLocalOverrides = _a.clearNotificationPreferencesLocalOverrides, exports.fetchNotificationPreferencesSuccess = _a.fetchNotificationPreferencesSuccess, exports.saveNotificationPreferences = _a.saveNotificationPreferences, exports.saveNotificationPreferencesFailure = _a.saveNotificationPreferencesFailure, exports.saveNotificationPreferencesSuccess = _a.saveNotificationPreferencesSuccess, exports.
|
|
225
|
+
_a = notificationPreferencesView.actions, exports.clearAllNotificationPreferencesView = _a.clearAllNotificationPreferencesView, exports.clearNotificationPreferencesLocalOverrides = _a.clearNotificationPreferencesLocalOverrides, exports.fetchNotificationPreferencesSuccess = _a.fetchNotificationPreferencesSuccess, exports.saveNotificationPreferences = _a.saveNotificationPreferences, exports.saveNotificationPreferencesFailure = _a.saveNotificationPreferencesFailure, exports.saveNotificationPreferencesSuccess = _a.saveNotificationPreferencesSuccess, exports.setGroupFrequency = _a.setGroupFrequency, exports.toggleEventChannel = _a.toggleEventChannel;
|
|
271
226
|
exports.default = notificationPreferencesView.reducer;
|
|
@@ -13,16 +13,8 @@ const getEffectiveNotificationPreferences = (state) => {
|
|
|
13
13
|
...channels,
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
|
-
const mergedGroupChannelEnabledByGroupId = { ...view.preferences.groupChannelEnabledByGroupId };
|
|
17
|
-
Object.entries(view.localOverrides.groupChannelEnabledByGroupId).forEach(([groupId, channels]) => {
|
|
18
|
-
mergedGroupChannelEnabledByGroupId[groupId] = {
|
|
19
|
-
...(view.preferences.groupChannelEnabledByGroupId[groupId] ?? {}),
|
|
20
|
-
...channels,
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
16
|
return {
|
|
24
17
|
eventEnabledByChannel: mergedEventEnabledByChannel,
|
|
25
|
-
groupChannelEnabledByGroupId: mergedGroupChannelEnabledByGroupId,
|
|
26
18
|
groupFrequencyByGroupId: {
|
|
27
19
|
...view.preferences.groupFrequencyByGroupId,
|
|
28
20
|
...view.localOverrides.groupFrequencyByGroupId,
|
|
@@ -35,7 +27,6 @@ exports.getNotificationLocalOverrides = getNotificationLocalOverrides;
|
|
|
35
27
|
const hasUnsavedNotificationPreferences = (state) => {
|
|
36
28
|
const overrides = getView(state).localOverrides;
|
|
37
29
|
return (Object.keys(overrides.eventEnabledByChannel).length > 0 ||
|
|
38
|
-
Object.keys(overrides.groupChannelEnabledByGroupId).length > 0 ||
|
|
39
30
|
Object.keys(overrides.groupFrequencyByGroupId).length > 0);
|
|
40
31
|
};
|
|
41
32
|
exports.hasUnsavedNotificationPreferences = hasUnsavedNotificationPreferences;
|
|
@@ -2,7 +2,6 @@ import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
|
2
2
|
import { NotificationChannel, NotificationFrequency } from '../../entity/notificationRegistry/notificationRegistryState';
|
|
3
3
|
export interface NotificationPreferences {
|
|
4
4
|
eventEnabledByChannel: Record<string, Partial<Record<NotificationChannel, boolean>>>;
|
|
5
|
-
groupChannelEnabledByGroupId: Record<string, Partial<Record<NotificationChannel, boolean>>>;
|
|
6
5
|
groupFrequencyByGroupId: Record<string, NotificationFrequency>;
|
|
7
6
|
}
|
|
8
7
|
export interface NotificationPreferencesViewState {
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.emptyNotificationPreferences = void 0;
|
|
4
4
|
const emptyNotificationPreferences = () => ({
|
|
5
5
|
eventEnabledByChannel: {},
|
|
6
|
-
groupChannelEnabledByGroupId: {},
|
|
7
6
|
groupFrequencyByGroupId: {},
|
|
8
7
|
});
|
|
9
8
|
exports.emptyNotificationPreferences = emptyNotificationPreferences;
|
|
@@ -55,6 +55,7 @@ export interface StepWithStatus extends StepWithUser {
|
|
|
55
55
|
actorsActivity: ActorActivityWithUser[];
|
|
56
56
|
isOriginalApprovalStep: boolean;
|
|
57
57
|
displayPendingApproverAsAdmin?: boolean;
|
|
58
|
+
showSodAdminLabel?: boolean;
|
|
58
59
|
}
|
|
59
60
|
export interface ActorActivityWithUser {
|
|
60
61
|
activity: ActivityStatus;
|
|
@@ -28,7 +28,12 @@ const billPayConfigState_1 = require("../billPayConfig/billPayConfigState");
|
|
|
28
28
|
const previousBillsSelector_1 = require("../previousBills/previousBillsSelector");
|
|
29
29
|
const billDetailViewState_1 = require("./billDetailViewState");
|
|
30
30
|
const getBillActivities = (state, billId, billStageCode) => {
|
|
31
|
-
const { billDetailViewState, approvalRuleState, entityApprovalStatusState, userState, } = state;
|
|
31
|
+
const { billDetailViewState, approvalRuleState, entityApprovalStatusState, userState, billTransactionState, } = state;
|
|
32
|
+
// Note: createdBy is undefined until billTransactionState is populated.
|
|
33
|
+
// getBillActivities is called from getBillDetailView which runs after the
|
|
34
|
+
// bill entity epic completes — this assumption must hold for showSodAdminLabel
|
|
35
|
+
// to render on first paint.
|
|
36
|
+
const createdBy = billTransactionState.transactionById[billId]?.createdBy;
|
|
32
37
|
const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId);
|
|
33
38
|
const billDetail = (0, get_1.default)(billDetailViewState.billDetailById, key, undefined);
|
|
34
39
|
let billActivities = [];
|
|
@@ -91,6 +96,7 @@ const getBillActivities = (state, billId, billStageCode) => {
|
|
|
91
96
|
actorsActivity,
|
|
92
97
|
isOriginalApprovalStep: step.isOriginalApprovalStep,
|
|
93
98
|
displayPendingApproverAsAdmin: (0, helpers_1.isSodAdminFallbackEligibleForStep)(sodExcludedApproverUserId, isAdminFallbackApprover, actorsActivity),
|
|
99
|
+
showSodAdminLabel: (0, helpers_1.shouldShowSodAdminLabel)(sodExcludedApproverUserId, actorsActivity, createdBy),
|
|
94
100
|
};
|
|
95
101
|
}),
|
|
96
102
|
};
|
|
@@ -17,6 +17,7 @@ import { RemiActivity } from './reimbursement/remiDetailView/remiDetailViewSelec
|
|
|
17
17
|
export declare const isUserActorOnApprovalStep: (userId: ID, stepActorsActivity: ActorActivityWithUser[]) => boolean;
|
|
18
18
|
export declare const isSodExcludedViewerBlocked: (sodExcludedApproverUserId?: ID, signedInUserId?: ID, stepActorsActivity?: ActorActivityWithUser[]) => boolean;
|
|
19
19
|
export declare const isSodAdminFallbackEligibleForStep: (sodExcludedApproverUserId?: ID, isAdminFallbackApprover?: boolean, stepActorsActivity?: ActorActivityWithUser[]) => boolean;
|
|
20
|
+
export declare const shouldShowSodAdminLabel: (sodExcludedApproverUserId?: ID, stepActorsActivity?: ActorActivityWithUser[], entitySubjectUserId?: ID) => boolean;
|
|
20
21
|
export declare const getLatestApprovalDate: (allActivities: BillActivity[] | RemiActivity[]) => ZeniDate | undefined;
|
|
21
22
|
export declare function getSpendManagementEffectiveListPeriod(): import("../..").TimePeriod;
|
|
22
23
|
export declare const getSelectedCompanyOfficer: (verificationDetails: BusinessVerificationDetails) => CompanyOfficersDetails | undefined;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.toSameDayAchDisablementConfig = exports.checkIfLowBalance = exports.getReportIDPlusForecastIDFromSetupViewType = exports.isAwaitingMarkAsPaid = exports.isPaymentMethodOutsideZeni = exports.toAccountsPromoConfig = exports.getBulkOperationSuffix = exports.getRemiListUniqueType = exports.getBillListUniqueType = exports.isBulkProcessing = exports.getActualPaymentDate = exports.accountTypeSubConfigCodeToAccType = exports.isRecurringConfigChanged = exports.updateRecurringBillDetails = exports.getPaymentDateFromVendorReceiveDate = exports.getSelectedCompanyOfficer = exports.getLatestApprovalDate = exports.isSodAdminFallbackEligibleForStep = exports.isSodExcludedViewerBlocked = exports.isUserActorOnApprovalStep = void 0;
|
|
6
|
+
exports.toSameDayAchDisablementConfig = exports.checkIfLowBalance = exports.getReportIDPlusForecastIDFromSetupViewType = exports.isAwaitingMarkAsPaid = exports.isPaymentMethodOutsideZeni = exports.toAccountsPromoConfig = exports.getBulkOperationSuffix = exports.getRemiListUniqueType = exports.getBillListUniqueType = exports.isBulkProcessing = exports.getActualPaymentDate = exports.accountTypeSubConfigCodeToAccType = exports.isRecurringConfigChanged = exports.updateRecurringBillDetails = exports.getPaymentDateFromVendorReceiveDate = exports.getSelectedCompanyOfficer = exports.getLatestApprovalDate = exports.shouldShowSodAdminLabel = exports.isSodAdminFallbackEligibleForStep = exports.isSodExcludedViewerBlocked = exports.isUserActorOnApprovalStep = void 0;
|
|
7
7
|
exports.getSpendManagementEffectiveListPeriod = getSpendManagementEffectiveListPeriod;
|
|
8
8
|
exports.showReimbursementPromoPage = showReimbursementPromoPage;
|
|
9
9
|
exports.showBillPayPromoPage = showBillPayPromoPage;
|
|
@@ -33,6 +33,19 @@ const isSodAdminFallbackEligibleForStep = (sodExcludedApproverUserId, isAdminFal
|
|
|
33
33
|
pendingResolvedApprovers.every((activity) => getUserActorId(activity) === sodExcludedApproverUserId));
|
|
34
34
|
};
|
|
35
35
|
exports.isSodAdminFallbackEligibleForStep = isSodAdminFallbackEligibleForStep;
|
|
36
|
+
const isSodExcludedUserSolePendingApproverOnStep = (sodExcludedApproverUserId, stepActorsActivity = []) => {
|
|
37
|
+
if (sodExcludedApproverUserId == null) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const pendingResolvedApprovers = stepActorsActivity.filter((activity) => activity.activity === 'pending' && getUserActorId(activity) != null);
|
|
41
|
+
return (pendingResolvedApprovers.length > 0 &&
|
|
42
|
+
pendingResolvedApprovers.every((activity) => getUserActorId(activity) === sodExcludedApproverUserId));
|
|
43
|
+
};
|
|
44
|
+
const shouldShowSodAdminLabel = (sodExcludedApproverUserId, stepActorsActivity = [], entitySubjectUserId) => sodExcludedApproverUserId != null &&
|
|
45
|
+
entitySubjectUserId != null &&
|
|
46
|
+
sodExcludedApproverUserId === entitySubjectUserId &&
|
|
47
|
+
isSodExcludedUserSolePendingApproverOnStep(sodExcludedApproverUserId, stepActorsActivity);
|
|
48
|
+
exports.shouldShowSodAdminLabel = shouldShowSodAdminLabel;
|
|
36
49
|
const getLatestApprovalDate = (allActivities) => {
|
|
37
50
|
let allStepsWithStatus = [];
|
|
38
51
|
let allApprovedActions = [];
|
package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { fetchUserFinancialAccount } from '../../../../userFinancialAccount/user
|
|
|
7
7
|
import { fetchMerchantList } from '../../../merchantList/merchantListReducer';
|
|
8
8
|
import { fetchReimbursementConfig } from '../../reimbursementConfig/reimbursementConfigReducer';
|
|
9
9
|
import { fetchRemiDetail } from '../../remiDetailView/remiDetailViewReducer';
|
|
10
|
-
import { fetchRemiSetupApproverView } from '../../remiSetupApproverView/remiSetupApproverViewReducer';
|
|
11
10
|
import { fetchEditRemiDetailPage, fetchRemiAndInitializeLocalStore, updatesPaymentToInLocalStore } from '../editRemiViewReducer';
|
|
12
|
-
export type ActionType = ReturnType<typeof fetchEditRemiDetailPage> | ReturnType<typeof fetchRemiDetail> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchMerchantList> | ReturnType<typeof fetchUserFinancialAccount> | ReturnType<typeof updatesPaymentToInLocalStore> | ReturnType<typeof fetchReimbursementConfig> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchRemiAndInitializeLocalStore
|
|
11
|
+
export type ActionType = ReturnType<typeof fetchEditRemiDetailPage> | ReturnType<typeof fetchRemiDetail> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchMerchantList> | ReturnType<typeof fetchUserFinancialAccount> | ReturnType<typeof updatesPaymentToInLocalStore> | ReturnType<typeof fetchReimbursementConfig> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchRemiAndInitializeLocalStore>;
|
|
13
12
|
export declare const fetchEditRemiDetailPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js
CHANGED
|
@@ -9,7 +9,6 @@ const userFinancialAccountReducer_1 = require("../../../../userFinancialAccount/
|
|
|
9
9
|
const userFinancialAccountSelector_1 = require("../../../../userFinancialAccount/userFinancialAccountSelector");
|
|
10
10
|
const merchantListReducer_1 = require("../../../merchantList/merchantListReducer");
|
|
11
11
|
const reimbursementConfigReducer_1 = require("../../reimbursementConfig/reimbursementConfigReducer");
|
|
12
|
-
const remiSetupApproverViewReducer_1 = require("../../remiSetupApproverView/remiSetupApproverViewReducer");
|
|
13
12
|
const editRemiViewReducer_1 = require("../editRemiViewReducer");
|
|
14
13
|
const fetchEditRemiDetailPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editRemiViewReducer_1.fetchEditRemiDetailPage.match), (0, operators_1.mergeMap)((action) => {
|
|
15
14
|
const { cacheOverride, isLimitedCategoryEnabled, reimbursementId, isShowDeletedReimbursementEnabled, } = action.payload;
|
|
@@ -62,17 +61,6 @@ const fetchEditRemiDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
62
61
|
if (reimbursementId != null) {
|
|
63
62
|
remiDetailActions.push((0, editRemiViewReducer_1.fetchRemiAndInitializeLocalStore)(reimbursementId, false, isShowDeletedReimbursementEnabled));
|
|
64
63
|
}
|
|
65
|
-
else {
|
|
66
|
-
const approvalRules = state.remiSetupApproverViewState;
|
|
67
|
-
if (approvalRules.fetchState !== 'Completed' &&
|
|
68
|
-
approvalRules.fetchState !== 'In-Progress') {
|
|
69
|
-
// Side-fetch from the edit-reim page bootstrap. The
|
|
70
|
-
// triggering action doesn't carry the V3 flag, so we
|
|
71
|
-
// explicitly target v1; v3 tenants re-fetch via their
|
|
72
|
-
// own screen connector.
|
|
73
|
-
remiDetailActions.push((0, remiSetupApproverViewReducer_1.fetchRemiSetupApproverView)(true, false, false, false));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
64
|
}
|
|
77
65
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(remiDetailActions));
|
|
78
66
|
}));
|
|
@@ -44,6 +44,7 @@ export interface StepWithStatus extends StepWithUser {
|
|
|
44
44
|
actorsActivity: ActorActivityWithUser[];
|
|
45
45
|
isOriginalApprovalStep: boolean;
|
|
46
46
|
displayPendingApproverAsAdmin?: boolean;
|
|
47
|
+
showSodAdminLabel?: boolean;
|
|
47
48
|
}
|
|
48
49
|
export interface ActorActivityWithUser extends Actor {
|
|
49
50
|
activity: ActivityStatus;
|
|
@@ -117,7 +117,8 @@ const getRemiDetailView = (state, reimbursementId) => {
|
|
|
117
117
|
};
|
|
118
118
|
exports.getRemiDetailView = getRemiDetailView;
|
|
119
119
|
const getRemiActivities = (state, reimbursementId, billStageCode) => {
|
|
120
|
-
const { remiDetailViewState, approvalRuleState, entityApprovalStatusState, userState, } = state;
|
|
120
|
+
const { remiDetailViewState, approvalRuleState, entityApprovalStatusState, userState, reimbursementState, } = state;
|
|
121
|
+
const reimburseeUserId = reimbursementState.reimbursementById[reimbursementId]?.reimburseeUserId;
|
|
121
122
|
const remiTransactionDetails = (0, get_1.default)(remiDetailViewState.remiDetailById, reimbursementId, undefined);
|
|
122
123
|
let remiActivities = [];
|
|
123
124
|
if (remiTransactionDetails != null) {
|
|
@@ -179,6 +180,7 @@ const getRemiActivities = (state, reimbursementId, billStageCode) => {
|
|
|
179
180
|
actorsActivity,
|
|
180
181
|
isOriginalApprovalStep: step.isOriginalApprovalStep,
|
|
181
182
|
displayPendingApproverAsAdmin: (0, helpers_1.isSodAdminFallbackEligibleForStep)(sodExcludedApproverUserId, isAdminFallbackApprover, actorsActivity),
|
|
183
|
+
showSodAdminLabel: (0, helpers_1.shouldShowSodAdminLabel)(sodExcludedApproverUserId, actorsActivity, reimburseeUserId),
|
|
182
184
|
};
|
|
183
185
|
}),
|
|
184
186
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.69-betaAK0",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|