@zeniai/client-epic-state 5.2.34-beta0ND → 5.2.35-beta0MM
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/actualMatching/actualMatchingPayload.d.ts +25 -0
- package/lib/entity/actualMatching/actualMatchingPayload.js +43 -0
- package/lib/entity/actualMatching/actualMatchingReducer.d.ts +8 -0
- package/lib/entity/actualMatching/actualMatchingReducer.js +33 -0
- package/lib/entity/actualMatching/actualMatchingSelector.d.ts +3 -0
- package/lib/entity/actualMatching/actualMatchingSelector.js +6 -0
- package/lib/entity/actualMatching/actualMatchingState.d.ts +22 -0
- package/lib/entity/actualMatching/actualMatchingState.js +2 -0
- package/lib/entity/actualMatching/actualMatchingTypes.d.ts +1 -0
- package/lib/entity/actualMatching/actualMatchingTypes.js +2 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +29 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +49 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +31 -0
- package/lib/entity/notificationRegistry/notificationRegistryReducer.d.ts +1 -2
- package/lib/entity/notificationRegistry/notificationRegistryReducer.js +9 -20
- package/lib/entity/notificationRegistry/notificationRegistrySelector.d.ts +1 -2
- package/lib/entity/notificationRegistry/notificationRegistrySelector.js +1 -7
- package/lib/entity/notificationRegistry/notificationRegistryState.d.ts +0 -5
- package/lib/entity/notificationRegistry/notificationRegistryState.js +1 -7
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +1 -3
- package/lib/epic.d.ts +8 -1
- package/lib/epic.js +18 -4
- package/lib/esm/entity/actualMatching/actualMatchingPayload.js +40 -0
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +30 -0
- package/lib/esm/entity/actualMatching/actualMatchingSelector.js +3 -0
- package/lib/esm/entity/actualMatching/actualMatchingState.js +1 -0
- package/lib/esm/entity/actualMatching/actualMatchingTypes.js +1 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +49 -0
- package/lib/esm/entity/notificationRegistry/notificationRegistryReducer.js +9 -20
- package/lib/esm/entity/notificationRegistry/notificationRegistrySelector.js +0 -5
- package/lib/esm/entity/notificationRegistry/notificationRegistryState.js +0 -5
- package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +1 -3
- package/lib/esm/epic.js +18 -4
- package/lib/esm/index.js +10 -6
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +2 -4
- package/lib/esm/view/aiCfoView/epics/fetchRoutineRunsEpic.js +1 -3
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +35 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +52 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +73 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +52 -0
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
- package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +3 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +68 -0
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +364 -0
- package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +281 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +32 -0
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -1
- package/lib/esm/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +7 -20
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewReducer.js +17 -43
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewSelector.js +4 -24
- package/lib/esm/view/settingsView/epic/fetchNotificationSettingsEpic.js +2 -12
- package/lib/index.d.ts +16 -8
- package/lib/index.js +78 -55
- package/lib/reducer.d.ts +2 -0
- package/lib/reducer.js +6 -0
- package/lib/rootStateTypes.d.ts +4 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.js +2 -4
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -1
- package/lib/view/aiCfoView/epics/fetchRoutineRunsEpic.js +1 -3
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.d.ts +12 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +39 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +56 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +77 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +56 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +3 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +85 -0
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +74 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +74 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +368 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +4 -4
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +83 -0
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +29 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +296 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +99 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +38 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -1
- package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +6 -19
- package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.d.ts +5 -8
- package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.js +17 -43
- package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.d.ts +0 -4
- package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.js +5 -30
- package/lib/view/notificationPreferencesView/notificationPreferencesViewState.d.ts +3 -4
- package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +2 -12
- package/lib/view/settingsView/settingsViewPayload.d.ts +0 -2
- package/package.json +1 -1
|
@@ -3,27 +3,16 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.toggleEventChannel = exports.setGroupFrequency = exports.setGroupChannelMaster = 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
|
-
const notificationRegistryState_1 = require("../../entity/notificationRegistry/notificationRegistryState");
|
|
7
6
|
const rootActions_1 = require("../../rootActions");
|
|
8
7
|
const notificationPreferencesViewPayload_1 = require("./notificationPreferencesViewPayload");
|
|
9
8
|
const notificationPreferencesViewState_1 = require("./notificationPreferencesViewState");
|
|
10
9
|
exports.initialState = {
|
|
11
10
|
cancelEpoch: 0,
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
localOverrides: (0, notificationPreferencesViewState_1.emptyNotificationPreferences)(),
|
|
12
|
+
preferences: (0, notificationPreferencesViewState_1.emptyNotificationPreferences)(),
|
|
14
13
|
saveEpoch: 0,
|
|
15
14
|
savePreferencesState: { fetchState: 'Not-Started' },
|
|
16
15
|
};
|
|
17
|
-
// Lazy: a gate-off tenant never receives that domain's key at all.
|
|
18
|
-
const overridesFor = (byDomain, domain) => {
|
|
19
|
-
const existing = byDomain[domain];
|
|
20
|
-
if (existing != null) {
|
|
21
|
-
return existing;
|
|
22
|
-
}
|
|
23
|
-
const created = (0, notificationPreferencesViewState_1.emptyNotificationPreferences)();
|
|
24
|
-
byDomain[domain] = created;
|
|
25
|
-
return created;
|
|
26
|
-
};
|
|
27
16
|
const mergePreferences = (base, patch) => {
|
|
28
17
|
const eventEnabledByChannel = {
|
|
29
18
|
...base.eventEnabledByChannel,
|
|
@@ -161,8 +150,7 @@ const notificationPreferencesView = (0, toolkit_1.createSlice)({
|
|
|
161
150
|
// Success/Failure never dispatches, subsequent legitimate saves
|
|
162
151
|
// still work because their captured epoch matches the current one.
|
|
163
152
|
draft.cancelEpoch += 1;
|
|
164
|
-
|
|
165
|
-
draft.localOverridesByDomain = {};
|
|
153
|
+
draft.localOverrides = (0, notificationPreferencesViewState_1.emptyNotificationPreferences)();
|
|
166
154
|
// Also drop `savePreferencesState` back to Not-Started so any
|
|
167
155
|
// "Saving…" affordance bound to `getNotificationPreferencesSaveState`
|
|
168
156
|
// clears on Cancel. Without this, a Cancel-during-save whose stale
|
|
@@ -179,6 +167,9 @@ const notificationPreferencesView = (0, toolkit_1.createSlice)({
|
|
|
179
167
|
// them; the save-success path is the only clearer.
|
|
180
168
|
// A `null`/`undefined` payload isn't a snapshot at all (e.g. the
|
|
181
169
|
// envelope key was omitted); no-op instead of wiping preferences.
|
|
170
|
+
if (action.payload.preferences == null) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
182
173
|
// Stale-GET guard (Cursor Bugbot 3632510237): if the fetch epic
|
|
183
174
|
// captured a `saveEpoch` lower than the current one, a save has
|
|
184
175
|
// succeeded since this GET dispatched — the response is carrying
|
|
@@ -188,13 +179,7 @@ const notificationPreferencesView = (0, toolkit_1.createSlice)({
|
|
|
188
179
|
if (action.payload.saveEpochAtDispatch < draft.saveEpoch) {
|
|
189
180
|
return;
|
|
190
181
|
}
|
|
191
|
-
|
|
192
|
-
if (payload == null) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
draft.preferencesByDomain[domain] =
|
|
196
|
-
(0, notificationPreferencesViewPayload_1.mapPayloadToPreferences)(payload);
|
|
197
|
-
});
|
|
182
|
+
draft.preferences = (0, notificationPreferencesViewPayload_1.mapPayloadToPreferences)(action.payload.preferences);
|
|
198
183
|
},
|
|
199
184
|
saveNotificationPreferences(draft) {
|
|
200
185
|
draft.savePreferencesState = { fetchState: 'In-Progress' };
|
|
@@ -253,44 +238,33 @@ const notificationPreferencesView = (0, toolkit_1.createSlice)({
|
|
|
253
238
|
// skip the `preferences` replace. Cursor Bugbot 3632510237.
|
|
254
239
|
draft.saveEpoch += 1;
|
|
255
240
|
draft.savePreferencesState = { fetchState: 'Completed' };
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const serverEcho = action.payload.serverEchoByDomain[domain];
|
|
262
|
-
const patch = serverEcho == null
|
|
263
|
-
? savedOverrides
|
|
264
|
-
: (0, notificationPreferencesViewPayload_1.mapPayloadToPreferences)(serverEcho);
|
|
265
|
-
draft.preferencesByDomain[domain] = mergePreferences(draft.preferencesByDomain[domain] ?? (0, notificationPreferencesViewState_1.emptyNotificationPreferences)(), patch);
|
|
266
|
-
draft.localOverridesByDomain[domain] = subtractSavedOverrides(draft.localOverridesByDomain[domain] ??
|
|
267
|
-
(0, notificationPreferencesViewState_1.emptyNotificationPreferences)(), savedOverrides);
|
|
268
|
-
});
|
|
241
|
+
const patch = action.payload.serverEcho == null
|
|
242
|
+
? action.payload.savedOverrides
|
|
243
|
+
: (0, notificationPreferencesViewPayload_1.mapPayloadToPreferences)(action.payload.serverEcho);
|
|
244
|
+
draft.preferences = mergePreferences(draft.preferences, patch);
|
|
245
|
+
draft.localOverrides = subtractSavedOverrides(draft.localOverrides, action.payload.savedOverrides);
|
|
269
246
|
},
|
|
270
247
|
setGroupChannelMaster(draft, action) {
|
|
271
248
|
// Mirror of `toggleEventChannel` but scoped to the group-channel master
|
|
272
249
|
// held under `groupChannelEnabledByGroupId[groupId][channel]`.
|
|
273
250
|
const { channel, enabled, groupId } = action.payload;
|
|
274
|
-
const overrides = overridesFor(draft.localOverridesByDomain, action.payload.domain ?? notificationRegistryState_1.DEFAULT_NOTIFICATION_DOMAIN);
|
|
275
251
|
const groupMap = {
|
|
276
|
-
...(
|
|
252
|
+
...(draft.localOverrides.groupChannelEnabledByGroupId[groupId] ?? {}),
|
|
277
253
|
};
|
|
278
254
|
groupMap[channel] = enabled;
|
|
279
|
-
|
|
255
|
+
draft.localOverrides.groupChannelEnabledByGroupId[groupId] = groupMap;
|
|
280
256
|
},
|
|
281
257
|
setGroupFrequency(draft, action) {
|
|
282
|
-
|
|
283
|
-
overrides.groupFrequencyByGroupId[action.payload.groupId] =
|
|
258
|
+
draft.localOverrides.groupFrequencyByGroupId[action.payload.groupId] =
|
|
284
259
|
action.payload.frequency;
|
|
285
260
|
},
|
|
286
261
|
toggleEventChannel(draft, action) {
|
|
287
262
|
const { channel, enabled, eventId } = action.payload;
|
|
288
|
-
const overrides = overridesFor(draft.localOverridesByDomain, action.payload.domain ?? notificationRegistryState_1.DEFAULT_NOTIFICATION_DOMAIN);
|
|
289
263
|
const eventMap = {
|
|
290
|
-
...(
|
|
264
|
+
...(draft.localOverrides.eventEnabledByChannel[eventId] ?? {}),
|
|
291
265
|
};
|
|
292
266
|
eventMap[channel] = enabled;
|
|
293
|
-
|
|
267
|
+
draft.localOverrides.eventEnabledByChannel[eventId] = eventMap;
|
|
294
268
|
},
|
|
295
269
|
},
|
|
296
270
|
extraReducers: (builder) => {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
|
-
import { NotificationDomain } from '../../entity/notificationRegistry/notificationRegistryState';
|
|
3
2
|
import { RootState } from '../../rootStateTypes';
|
|
4
3
|
import { NotificationPreferences } from './notificationPreferencesViewState';
|
|
5
4
|
export declare const getNotificationPreferencesSaveState: (state: RootState) => FetchStateAndError;
|
|
6
|
-
export declare const getEffectiveNotificationPreferencesForDomain: (state: RootState, domain: NotificationDomain) => NotificationPreferences;
|
|
7
5
|
export declare const getEffectiveNotificationPreferences: (state: RootState) => NotificationPreferences;
|
|
8
|
-
export declare const getNotificationLocalOverridesForDomain: (state: RootState, domain: NotificationDomain) => NotificationPreferences;
|
|
9
6
|
export declare const getNotificationLocalOverrides: (state: RootState) => NotificationPreferences;
|
|
10
|
-
export declare const hasUnsavedNotificationPreferencesForDomain: (state: RootState, domain: NotificationDomain) => boolean;
|
|
11
7
|
export declare const hasUnsavedNotificationPreferences: (state: RootState) => boolean;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasUnsavedNotificationPreferences = exports.
|
|
3
|
+
exports.hasUnsavedNotificationPreferences = exports.getNotificationLocalOverrides = exports.getEffectiveNotificationPreferences = exports.getNotificationPreferencesSaveState = void 0;
|
|
4
4
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
-
const notificationRegistryState_1 = require("../../entity/notificationRegistry/notificationRegistryState");
|
|
6
|
-
const notificationPreferencesViewState_1 = require("./notificationPreferencesViewState");
|
|
7
5
|
const getView = (state) => state.notificationPreferencesViewState;
|
|
8
6
|
const getNotificationPreferencesSaveState = (state) => getView(state).savePreferencesState;
|
|
9
7
|
exports.getNotificationPreferencesSaveState = getNotificationPreferencesSaveState;
|
|
@@ -11,12 +9,7 @@ exports.getNotificationPreferencesSaveState = getNotificationPreferencesSaveStat
|
|
|
11
9
|
// stable reference while neither input changes — a plain function would
|
|
12
10
|
// allocate a fresh object on every call and re-render every `useSelector`
|
|
13
11
|
// consumer on any unrelated dispatch.
|
|
14
|
-
|
|
15
|
-
// One per domain: a shared createSelector has a cache of one and would thrash across two.
|
|
16
|
-
const effectivePreferencesSelectorByDomain = new Map();
|
|
17
|
-
const createEffectivePreferencesSelector = (domain) => (0, toolkit_1.createSelector)((state) => getView(state).preferencesByDomain[domain], (state) => getView(state).localOverridesByDomain[domain], (storedPreferences, storedOverrides) => {
|
|
18
|
-
const preferences = storedPreferences ?? EMPTY_PREFERENCES;
|
|
19
|
-
const localOverrides = storedOverrides ?? EMPTY_PREFERENCES;
|
|
12
|
+
exports.getEffectiveNotificationPreferences = (0, toolkit_1.createSelector)((state) => getView(state).preferences, (state) => getView(state).localOverrides, (preferences, localOverrides) => {
|
|
20
13
|
const mergedEventEnabledByChannel = { ...preferences.eventEnabledByChannel };
|
|
21
14
|
Object.entries(localOverrides.eventEnabledByChannel).forEach(([eventId, channels]) => {
|
|
22
15
|
mergedEventEnabledByChannel[eventId] = {
|
|
@@ -40,26 +33,8 @@ const createEffectivePreferencesSelector = (domain) => (0, toolkit_1.createSelec
|
|
|
40
33
|
},
|
|
41
34
|
};
|
|
42
35
|
});
|
|
43
|
-
const
|
|
44
|
-
let selector = effectivePreferencesSelectorByDomain.get(domain);
|
|
45
|
-
if (selector == null) {
|
|
46
|
-
selector = createEffectivePreferencesSelector(domain);
|
|
47
|
-
effectivePreferencesSelectorByDomain.set(domain, selector);
|
|
48
|
-
}
|
|
49
|
-
return selector(state);
|
|
50
|
-
};
|
|
51
|
-
exports.getEffectiveNotificationPreferencesForDomain = getEffectiveNotificationPreferencesForDomain;
|
|
52
|
-
const getEffectiveNotificationPreferences = (state) => (0, exports.getEffectiveNotificationPreferencesForDomain)(state, notificationRegistryState_1.DEFAULT_NOTIFICATION_DOMAIN);
|
|
53
|
-
exports.getEffectiveNotificationPreferences = getEffectiveNotificationPreferences;
|
|
54
|
-
const getNotificationLocalOverridesForDomain = (state, domain) => getView(state).localOverridesByDomain[domain] ?? EMPTY_PREFERENCES;
|
|
55
|
-
exports.getNotificationLocalOverridesForDomain = getNotificationLocalOverridesForDomain;
|
|
56
|
-
const getNotificationLocalOverrides = (state) => (0, exports.getNotificationLocalOverridesForDomain)(state, notificationRegistryState_1.DEFAULT_NOTIFICATION_DOMAIN);
|
|
36
|
+
const getNotificationLocalOverrides = (state) => getView(state).localOverrides;
|
|
57
37
|
exports.getNotificationLocalOverrides = getNotificationLocalOverrides;
|
|
58
|
-
|
|
38
|
+
exports.hasUnsavedNotificationPreferences = (0, toolkit_1.createSelector)((state) => getView(state).localOverrides, (localOverrides) => Object.keys(localOverrides.eventEnabledByChannel).length > 0 ||
|
|
59
39
|
Object.keys(localOverrides.groupChannelEnabledByGroupId).length > 0 ||
|
|
60
|
-
Object.keys(localOverrides.groupFrequencyByGroupId).length > 0;
|
|
61
|
-
const hasUnsavedNotificationPreferencesForDomain = (state, domain) => isDirty((0, exports.getNotificationLocalOverridesForDomain)(state, domain));
|
|
62
|
-
exports.hasUnsavedNotificationPreferencesForDomain = hasUnsavedNotificationPreferencesForDomain;
|
|
63
|
-
// Drives the shared page-level Save/Cancel footer.
|
|
64
|
-
const hasUnsavedNotificationPreferences = (state) => Object.values(getView(state).localOverridesByDomain).some((localOverrides) => localOverrides != null && isDirty(localOverrides));
|
|
65
|
-
exports.hasUnsavedNotificationPreferences = hasUnsavedNotificationPreferences;
|
|
40
|
+
Object.keys(localOverrides.groupFrequencyByGroupId).length > 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
|
-
import { NotificationChannel,
|
|
2
|
+
import { NotificationChannel, NotificationFrequency } from '../../entity/notificationRegistry/notificationRegistryState';
|
|
3
3
|
export interface NotificationPreferences {
|
|
4
4
|
eventEnabledByChannel: Record<string, Partial<Record<NotificationChannel, boolean>>>;
|
|
5
5
|
groupChannelEnabledByGroupId: Record<string, Partial<Record<NotificationChannel, boolean>>>;
|
|
@@ -7,10 +7,9 @@ export interface NotificationPreferences {
|
|
|
7
7
|
}
|
|
8
8
|
export interface NotificationPreferencesViewState {
|
|
9
9
|
cancelEpoch: number;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
localOverrides: NotificationPreferences;
|
|
11
|
+
preferences: NotificationPreferences;
|
|
12
12
|
saveEpoch: number;
|
|
13
13
|
savePreferencesState: FetchStateAndError;
|
|
14
14
|
}
|
|
15
|
-
export type NotificationPreferencesByDomain = Partial<Record<NotificationDomain, NotificationPreferences>>;
|
|
16
15
|
export declare const emptyNotificationPreferences: () => NotificationPreferences;
|
|
@@ -41,21 +41,11 @@ const fetchNotificationSettingsEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
41
41
|
// 67d6918e.
|
|
42
42
|
updateActions.push((0, notificationRegistryReducer_1.updateNotificationRegistry)({
|
|
43
43
|
registry: response.data.task_checklist_registry ?? undefined,
|
|
44
|
-
// An absent `<domain>_registry` means that domain's gate is off.
|
|
45
|
-
registriesByDomain: {
|
|
46
|
-
task_checklist: response.data.task_checklist_registry ?? undefined,
|
|
47
|
-
commenting: response.data.commenting_registry ?? undefined,
|
|
48
|
-
},
|
|
49
44
|
registryEpochAtDispatch,
|
|
50
45
|
}));
|
|
51
|
-
|
|
52
|
-
const preferencesByDomain = {
|
|
53
|
-
task_checklist: response.data.task_checklist_preferences ?? undefined,
|
|
54
|
-
commenting: response.data.commenting_preferences ?? undefined,
|
|
55
|
-
};
|
|
56
|
-
if (Object.values(preferencesByDomain).some((preferences) => preferences != null)) {
|
|
46
|
+
if (response.data.task_checklist_preferences != null) {
|
|
57
47
|
updateActions.push((0, notificationPreferencesViewReducer_1.fetchNotificationPreferencesSuccess)({
|
|
58
|
-
|
|
48
|
+
preferences: response.data.task_checklist_preferences,
|
|
59
49
|
saveEpochAtDispatch,
|
|
60
50
|
}));
|
|
61
51
|
}
|
|
@@ -37,8 +37,6 @@ export interface NotificationSettingsPayload {
|
|
|
37
37
|
pending_bill_approval_notification: RemindersPayload | null;
|
|
38
38
|
pending_reimbursement_approval_notification: RemindersPayload | null;
|
|
39
39
|
uncategorized_transaction_notification: RemindersPayload | null;
|
|
40
|
-
commenting_preferences?: NotificationPreferencesPayload;
|
|
41
|
-
commenting_registry?: NotificationRegistryPayload;
|
|
42
40
|
month_end_email_recipient_email_ids?: string[];
|
|
43
41
|
task_checklist_preferences?: NotificationPreferencesPayload;
|
|
44
42
|
task_checklist_registry?: NotificationRegistryPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.35-beta0MM",
|
|
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",
|