@zeniai/client-epic-state 5.0.36-betaRR05 → 5.0.37
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/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +0 -1
- package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +1 -2
- package/lib/entity/file/fileState.d.ts +4 -4
- package/lib/entity/file/fileState.js +0 -4
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -4
- package/lib/entity/task/taskPayload.d.ts +0 -4
- package/lib/entity/task/taskPayload.js +0 -10
- package/lib/entity/task/taskState.d.ts +0 -8
- package/lib/entity/task/taskState.js +1 -6
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -5
- package/lib/entity/tenant/clearAllEpic.js +0 -6
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.d.ts +1 -59
- package/lib/entity/tenant/tenantReducer.js +4 -139
- package/lib/entity/tenant/tenantState.d.ts +0 -7
- package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -2
- package/lib/epic.d.ts +1 -9
- package/lib/epic.js +1 -12
- package/lib/esm/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +0 -1
- package/lib/esm/entity/file/fileState.js +0 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -4
- package/lib/esm/entity/task/taskPayload.js +1 -11
- package/lib/esm/entity/task/taskState.js +0 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -6
- package/lib/esm/entity/tenant/tenantReducer.js +2 -135
- package/lib/esm/epic.js +1 -12
- package/lib/esm/index.js +9 -18
- package/lib/esm/init.js +16 -71
- package/lib/esm/reducer.js +0 -9
- package/lib/esm/view/common/recurringViewHelper.js +0 -17
- package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
- package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -3
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -6
- package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +0 -5
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +7 -60
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +0 -17
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +21 -56
- package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
- package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +4 -13
- package/lib/esm/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
- package/lib/esm/view/taskManager/taskListView/taskList.js +0 -7
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +12 -106
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +39 -48
- package/lib/index.d.ts +9 -21
- package/lib/index.js +30 -70
- package/lib/init.d.ts +3 -5
- package/lib/init.js +16 -71
- package/lib/reducer.d.ts +0 -9
- package/lib/reducer.js +0 -9
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/common/recurringViewHelper.d.ts +2 -3
- package/lib/view/common/recurringViewHelper.js +1 -18
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -3
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -6
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +1 -5
- package/lib/view/taskManager/taskDetailView/taskDetail.js +0 -5
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -10
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +8 -61
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -6
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +0 -17
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +7 -6
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +22 -56
- package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
- package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +4 -13
- package/lib/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -14
- package/lib/view/taskManager/taskListView/taskList.js +1 -8
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -3
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +6 -9
- package/lib/view/taskManager/taskListView/taskListReducer.js +13 -107
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -9
- package/lib/view/taskManager/taskListView/taskListSelector.js +39 -48
- package/package.json +1 -1
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/deleteConnectionEpic.js +0 -29
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -31
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -33
- package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +0 -25
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -27
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -29
- package/lib/esm/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +0 -23
- package/lib/esm/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +0 -25
- package/lib/esm/view/featureNotificationView/featureNotificationViewPayload.js +0 -11
- package/lib/esm/view/featureNotificationView/featureNotificationViewReducer.js +0 -106
- package/lib/esm/view/featureNotificationView/featureNotificationViewSelector.js +0 -4
- package/lib/esm/view/featureNotificationView/featureNotificationViewState.js +0 -1
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponses.js +0 -1
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +0 -12
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +0 -64
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +0 -3
- package/lib/esm/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +0 -17
- package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +0 -21
- package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +0 -29
- package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -66
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -57
- package/lib/esm/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +0 -65
- package/lib/esm/view/zeniOAuthView/zeniOAuthParamsParser.js +0 -41
- package/lib/esm/view/zeniOAuthView/zeniOAuthReducer.js +0 -49
- package/lib/esm/view/zeniOAuthView/zeniOAuthSelector.js +0 -3
- package/lib/esm/view/zeniOAuthView/zeniOAuthState.js +0 -1
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.d.ts +0 -16
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +0 -27
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.d.ts +0 -14
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +0 -29
- package/lib/view/featureNotificationView/featureNotificationViewPayload.d.ts +0 -23
- package/lib/view/featureNotificationView/featureNotificationViewPayload.js +0 -15
- package/lib/view/featureNotificationView/featureNotificationViewReducer.d.ts +0 -19
- package/lib/view/featureNotificationView/featureNotificationViewReducer.js +0 -110
- package/lib/view/featureNotificationView/featureNotificationViewSelector.d.ts +0 -6
- package/lib/view/featureNotificationView/featureNotificationViewSelector.js +0 -11
- package/lib/view/featureNotificationView/featureNotificationViewState.d.ts +0 -26
- package/lib/view/featureNotificationView/featureNotificationViewState.js +0 -2
- package/lib/view/taskManager/cannedResponsesView/cannedResponses.d.ts +0 -19
- package/lib/view/taskManager/cannedResponsesView/cannedResponses.js +0 -2
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.d.ts +0 -21
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +0 -15
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.d.ts +0 -30
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +0 -68
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.d.ts +0 -3
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +0 -6
- package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +0 -21
- package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +0 -25
- package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +0 -33
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -70
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -61
- package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.d.ts +0 -27
- package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +0 -69
- package/lib/view/zeniOAuthView/zeniOAuthParamsParser.d.ts +0 -16
- package/lib/view/zeniOAuthView/zeniOAuthParamsParser.js +0 -44
- package/lib/view/zeniOAuthView/zeniOAuthReducer.d.ts +0 -29
- package/lib/view/zeniOAuthView/zeniOAuthReducer.js +0 -53
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +0 -5
- package/lib/view/zeniOAuthView/zeniOAuthSelector.js +0 -9
- package/lib/view/zeniOAuthView/zeniOAuthState.d.ts +0 -4
- package/lib/view/zeniOAuthView/zeniOAuthState.js +0 -2
package/lib/esm/init.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Pusher from 'pusher-js';
|
|
1
2
|
import configureNewStore from './configureStore';
|
|
2
3
|
import { ZeniAPIClient } from './zeniAPI';
|
|
3
4
|
export let zeniAPI;
|
|
@@ -23,23 +24,10 @@ export default function initialize(restEndPoints, userId, sessionId, tenantId, i
|
|
|
23
24
|
return store;
|
|
24
25
|
}
|
|
25
26
|
let isPusherInitialized = false;
|
|
26
|
-
// Caches an in-flight initializePusher() promise so that concurrent callers
|
|
27
|
-
// share a single Pusher instance instead of each constructing their own and
|
|
28
|
-
// leaking WebSocket connections (see Bugbot review on PR #2983). Cleared in
|
|
29
|
-
// the IIFE's `finally` once construction settles.
|
|
30
|
-
let pusherInitPromise;
|
|
31
27
|
/**
|
|
32
28
|
* Call initializePusher before using pusher in web-app
|
|
33
29
|
*/
|
|
34
|
-
export
|
|
35
|
-
// Pusher subscribes/decrypts only make sense in the browser. `pusher-js/
|
|
36
|
-
// with-encryption` resolves to a browser-only bundle that references
|
|
37
|
-
// `window` at module init, so even *importing* it on the server crashes.
|
|
38
|
-
// Bail out early on SSR/Node so the dynamic import below never executes.
|
|
39
|
-
if (typeof window === 'undefined') {
|
|
40
|
-
console.warn(`initializePusher called on server-side; pusher-js/with-encryption is browser-only — skipping.`);
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
30
|
+
export function initializePusher(pusherClientSecret, options, headers, reInitialize = false) {
|
|
43
31
|
if (Boolean(zeniAPI.userId) === false ||
|
|
44
32
|
Boolean(zeniAPI.tenantId) === false ||
|
|
45
33
|
!initialized) {
|
|
@@ -50,59 +38,19 @@ export async function initializePusher(pusherClientSecret, options, headers, reI
|
|
|
50
38
|
console.warn(`Already initialized pusher`);
|
|
51
39
|
return pusher;
|
|
52
40
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// inside the try is `await import(...)`, which always yields control —
|
|
67
|
-
// so the finally runs in a future microtask, after `currentInit` has
|
|
68
|
-
// already been assigned below. We declare it as `let … | undefined` so
|
|
69
|
-
// TS's definite-assignment analysis (which doesn't model the await) accepts
|
|
70
|
-
// the closure read; at runtime it's always the IIFE promise by then.
|
|
71
|
-
let currentInit = undefined;
|
|
72
|
-
currentInit = (async () => {
|
|
73
|
-
try {
|
|
74
|
-
// Dynamic import so the browser-only bundle is loaded only when this
|
|
75
|
-
// function actually runs (browser path). Works in both build outputs:
|
|
76
|
-
// • ESM (lib/esm): preserved as native `import()` → Vite/Rollup code-split
|
|
77
|
-
// • CJS (lib): TypeScript lowers to `Promise.resolve().then(() => require(...))`
|
|
78
|
-
// The pusher-js UMD wrapper does `module.exports = factory()` for CJS,
|
|
79
|
-
// so the module result is the Pusher class directly. Some bundlers wrap
|
|
80
|
-
// CJS in `{ default: ... }` for ESM interop — fall back to the module
|
|
81
|
-
// itself when `.default` is absent.
|
|
82
|
-
const pusherModule = (await import('pusher-js/with-encryption'));
|
|
83
|
-
const PusherConstructor = 'default' in pusherModule ? pusherModule.default : pusherModule;
|
|
84
|
-
const endpoint = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/notifications/push_notification/auth`;
|
|
85
|
-
pusher = new PusherConstructor(pusherClientSecret, {
|
|
86
|
-
...options,
|
|
87
|
-
channelAuthorization: {
|
|
88
|
-
endpoint,
|
|
89
|
-
transport: 'ajax',
|
|
90
|
-
customHandler: (params, callback) => customHandler(params, headers, callback),
|
|
91
|
-
},
|
|
92
|
-
}).bind('error', function (err) {
|
|
93
|
-
console.warn('Pusher error', err);
|
|
94
|
-
});
|
|
95
|
-
console.info(`initializing with ${JSON.stringify(options)}`);
|
|
96
|
-
return pusher;
|
|
97
|
-
}
|
|
98
|
-
finally {
|
|
99
|
-
if (pusherInitPromise === currentInit) {
|
|
100
|
-
pusherInitPromise = undefined;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
})();
|
|
104
|
-
pusherInitPromise = currentInit;
|
|
105
|
-
return currentInit;
|
|
41
|
+
const endpoint = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/notifications/push_notification/auth`;
|
|
42
|
+
pusher = new Pusher(pusherClientSecret, {
|
|
43
|
+
...options,
|
|
44
|
+
channelAuthorization: {
|
|
45
|
+
endpoint,
|
|
46
|
+
transport: 'ajax',
|
|
47
|
+
customHandler: (params, callback) => customHandler(params, headers, callback),
|
|
48
|
+
},
|
|
49
|
+
}).bind('error', function (err) {
|
|
50
|
+
console.warn('Pusher error', err);
|
|
51
|
+
});
|
|
52
|
+
console.info(`initializing with ${JSON.stringify(options)}`);
|
|
53
|
+
return pusher;
|
|
106
54
|
}
|
|
107
55
|
const customHandler = async (params, headers, callback) => {
|
|
108
56
|
const { socketId, channelName } = params;
|
|
@@ -116,10 +64,7 @@ const customHandler = async (params, headers, callback) => {
|
|
|
116
64
|
.toPromise()
|
|
117
65
|
.then((response) => {
|
|
118
66
|
if (response.data != null) {
|
|
119
|
-
callback(null, {
|
|
120
|
-
auth: response.data.auth,
|
|
121
|
-
shared_secret: response.data.shared_secret,
|
|
122
|
-
});
|
|
67
|
+
callback(null, { auth: response.data.auth });
|
|
123
68
|
isPusherInitialized = true;
|
|
124
69
|
}
|
|
125
70
|
})
|
package/lib/esm/reducer.js
CHANGED
|
@@ -107,7 +107,6 @@ import expenseAutomationReconciliationView, { initialState as initialExpenseAuto
|
|
|
107
107
|
import expenseAutomationTransactionsView, { initialState as initialExpenseAutomationTransactionsViewState, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
|
|
108
108
|
import fileView from './view/fileView/fileViewReducer';
|
|
109
109
|
import { initialFileViewState, } from './view/fileView/fileViewState';
|
|
110
|
-
import featureNotificationView, { initialState as initialFeatureNotificationViewState, } from './view/featureNotificationView/featureNotificationViewReducer';
|
|
111
110
|
import financeStatement, { initialFinanceStatementState, } from './view/financeStatement/financeStatementReducer';
|
|
112
111
|
import forecastList, { initialState as initialForecastListState, } from './view/forecastList/forecastListReducer';
|
|
113
112
|
import globalMerchantAutoComplete, { initialState as initialGlobalMerchantAutoCompleteState, } from './view/globalMerchantView/globalMerchantAutoCompleteView/globalMerchantAutoCompleteViewReducer';
|
|
@@ -193,7 +192,6 @@ import zeniAccountSetupView, { initialState as initialZeniAccountSetupViewState,
|
|
|
193
192
|
import zeniAccountsConfig, { initialState as initialZeniAccountsConfigState, } from './view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer';
|
|
194
193
|
import subscriptionView, { initialState as initialSubscriptionViewState, } from './view/subscriptionView/subscriptionViewReducer';
|
|
195
194
|
import tagView, { initialState as initialTagListState, } from './view/tagView/tagViewReducer';
|
|
196
|
-
import cannedResponsesView, { initialState as initialCannedResponsesState, } from './view/taskManager/cannedResponsesView/cannedResponsesReducer';
|
|
197
195
|
import taskDetailView, { initialState as initialTaskDetailState, } from './view/taskManager/taskDetailView/taskDetailReducer';
|
|
198
196
|
import taskGroupTemplateView, { initialState as initialTaskGroupTemplateViewState, } from './view/taskManager/taskGroupTemplateView/taskGroupTemplateViewReducer';
|
|
199
197
|
import taskGroupView, { initialState as initialTaskGroupViewState, } from './view/taskManager/taskGroupView/taskGroupViewReducer';
|
|
@@ -220,7 +218,6 @@ import vendorTabView, { initialState as initialVendorTabViewState, } from './vie
|
|
|
220
218
|
import vendorTypeList, { initialState as initialVendorTypeListState, } from './view/vendorTypeList/vendorTypeListReducer';
|
|
221
219
|
import zeniAccStatementList, { initialState as initialZeniAccStatementListState, } from './view/zeniAccStatementList/zeniAccStatementListReducer';
|
|
222
220
|
import zeniAccountsPromoCard, { initialState as initialZeniAccountsPromoCardState, } from './view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer';
|
|
223
|
-
import zeniOAuthView, { initialState as initialZeniOAuthViewState, } from './view/zeniOAuthView/zeniOAuthReducer';
|
|
224
221
|
// Note: Please maintain strict alphabetical order
|
|
225
222
|
const initialEntitiesState = {
|
|
226
223
|
accountGroupState: initialAccountGroupState,
|
|
@@ -356,7 +353,6 @@ const initialViewsState = {
|
|
|
356
353
|
expenseAutomationTransactionsViewState: initialExpenseAutomationTransactionsViewState,
|
|
357
354
|
expenseAutomationViewState: initialExpenseAutomationViewState,
|
|
358
355
|
expressPayState: initialExpressPayState,
|
|
359
|
-
featureNotificationViewState: initialFeatureNotificationViewState,
|
|
360
356
|
fileViewState: initialFileViewState,
|
|
361
357
|
financeStatementState: initialFinanceStatementState,
|
|
362
358
|
forecastListState: initialForecastListState,
|
|
@@ -407,7 +403,6 @@ const initialViewsState = {
|
|
|
407
403
|
setupViewState: initialSetupViewState,
|
|
408
404
|
subscriptionViewState: initialSubscriptionViewState,
|
|
409
405
|
tagViewState: initialTagListState,
|
|
410
|
-
cannedResponsesState: initialCannedResponsesState,
|
|
411
406
|
taskDetailState: initialTaskDetailState,
|
|
412
407
|
taskGroupTemplateViewState: initialTaskGroupTemplateViewState,
|
|
413
408
|
taskGroupViewState: initialTaskGroupViewState,
|
|
@@ -447,7 +442,6 @@ const initialViewsState = {
|
|
|
447
442
|
zeniAccountSetupViewState: initialZeniAccountSetupViewState,
|
|
448
443
|
zeniAccStatementListState: initialZeniAccStatementListState,
|
|
449
444
|
zeniAccountsPromoCardState: initialZeniAccountsPromoCardState,
|
|
450
|
-
zeniOAuthViewState: initialZeniOAuthViewState,
|
|
451
445
|
};
|
|
452
446
|
export const initialRootState = {
|
|
453
447
|
...initialEntitiesState,
|
|
@@ -588,7 +582,6 @@ const viewReducers = {
|
|
|
588
582
|
expenseAutomationTransactionsViewState: expenseAutomationTransactionsView,
|
|
589
583
|
expenseAutomationViewState: expenseAutomationView,
|
|
590
584
|
expressPayState: expressPay,
|
|
591
|
-
featureNotificationViewState: featureNotificationView,
|
|
592
585
|
fileViewState: fileView,
|
|
593
586
|
financeStatementState: financeStatement,
|
|
594
587
|
forecastListState: forecastList,
|
|
@@ -639,7 +632,6 @@ const viewReducers = {
|
|
|
639
632
|
settingsViewState: settings,
|
|
640
633
|
setupViewState: setupView,
|
|
641
634
|
subscriptionViewState: subscriptionView,
|
|
642
|
-
cannedResponsesState: cannedResponsesView,
|
|
643
635
|
taskDetailState: taskDetailView,
|
|
644
636
|
taskGroupTemplateViewState: taskGroupTemplateView,
|
|
645
637
|
taskGroupViewState: taskGroupView,
|
|
@@ -680,7 +672,6 @@ const viewReducers = {
|
|
|
680
672
|
zeniAccountSetupViewState: zeniAccountSetupView,
|
|
681
673
|
zeniAccStatementListState: zeniAccStatementList,
|
|
682
674
|
zeniAccountsPromoCardState: zeniAccountsPromoCard,
|
|
683
|
-
zeniOAuthViewState: zeniOAuthView,
|
|
684
675
|
};
|
|
685
676
|
const reducers = combineReducers({
|
|
686
677
|
...entityReducers,
|
|
@@ -3,13 +3,11 @@ const ALL_RECURRING_FREQUENCY = [
|
|
|
3
3
|
'daily',
|
|
4
4
|
'weekly',
|
|
5
5
|
'biweekly',
|
|
6
|
-
'semi_weekly',
|
|
7
6
|
'monthly',
|
|
8
7
|
'quarterly',
|
|
9
8
|
];
|
|
10
9
|
export const toRecurringFrequency = (v) => stringToUnion(v, ALL_RECURRING_FREQUENCY);
|
|
11
10
|
export const toRecurringFrequencyStrict = (v) => stringToUnionStrict(v ?? '', ALL_RECURRING_FREQUENCY);
|
|
12
|
-
export const SEMI_WEEKLY_REQUIRED_DAYS_COUNT = 2;
|
|
13
11
|
const ALL_RECURRING_DATE_PICKER_OPTIONS = ['date', 'recurringCount'];
|
|
14
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
13
|
const toRecurringDatePickerOptions = (v) => stringToUnion(v, ALL_RECURRING_DATE_PICKER_OPTIONS);
|
|
@@ -17,8 +15,6 @@ export const getRecurringFrequencyInDays = (frequency) => {
|
|
|
17
15
|
switch (frequency) {
|
|
18
16
|
case 'daily':
|
|
19
17
|
return 1;
|
|
20
|
-
case 'semi_weekly':
|
|
21
|
-
return 3;
|
|
22
18
|
case 'weekly':
|
|
23
19
|
return 7;
|
|
24
20
|
case 'biweekly':
|
|
@@ -39,17 +35,6 @@ export const getRecurringEndDateFromCount = (startDate, frequency, recurringCoun
|
|
|
39
35
|
case 'biweekly':
|
|
40
36
|
endDate = startDate.add(getRecurringFrequencyInDays(frequency) * (recurringCount - 1), 'day');
|
|
41
37
|
break;
|
|
42
|
-
case 'semi_weekly': {
|
|
43
|
-
// Two semi-weekly occurrences span exactly 7 days regardless of which
|
|
44
|
-
// two weekdays are picked (since gap1 + gap2 = 7). So odd counts are
|
|
45
|
-
// exact; even counts use the conservative half-week step (4 days).
|
|
46
|
-
const stepsRemaining = recurringCount - 1;
|
|
47
|
-
const fullWeekPairs = Math.floor(stepsRemaining / 2);
|
|
48
|
-
const hasOddTailStep = stepsRemaining % 2 === 1;
|
|
49
|
-
const days = fullWeekPairs * 7 + (hasOddTailStep ? 4 : 0);
|
|
50
|
-
endDate = startDate.add(days, 'day');
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
38
|
case 'monthly':
|
|
54
39
|
endDate = startDate.add(recurringCount - 1, 'month');
|
|
55
40
|
break;
|
|
@@ -66,8 +51,6 @@ export const getMinAllowedEndDate = (frequency, startDate) => {
|
|
|
66
51
|
switch (frequency) {
|
|
67
52
|
case 'daily':
|
|
68
53
|
return startDate.add(1, 'day');
|
|
69
|
-
case 'semi_weekly':
|
|
70
|
-
return startDate.add(3, 'day');
|
|
71
54
|
case 'weekly':
|
|
72
55
|
return startDate.add(7, 'day');
|
|
73
56
|
case 'biweekly':
|
|
@@ -4,7 +4,6 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
|
4
4
|
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
5
5
|
import { getTaskById } from '../../../../entity/task/taskSelector';
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
|
-
import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
|
|
8
7
|
import { archiveTask, archiveTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
9
8
|
// Epic function to handle archiving of tasks
|
|
10
9
|
export const archiveTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(archiveTask.match), mergeMap((action) => handleArchiveTask(action.payload.taskId, state$, zeniAPI)));
|
|
@@ -26,8 +25,6 @@ const handleApiResponse = (response, taskId) => {
|
|
|
26
25
|
response.data.tasks.length > 0) {
|
|
27
26
|
const fetchActions = [
|
|
28
27
|
updateTasks(response.data.tasks),
|
|
29
|
-
removeTaskFromList(taskId),
|
|
30
|
-
fetchTaskList(),
|
|
31
28
|
archiveTaskSuccessOrFailure({
|
|
32
29
|
fetchState: 'Completed',
|
|
33
30
|
taskId,
|
|
@@ -2,7 +2,6 @@ import { from, of } from 'rxjs';
|
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessStatus, } from '../../../../responsePayload';
|
|
5
|
-
import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
|
|
6
5
|
import { deleteTask, deleteTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
7
6
|
export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteTask.match), mergeMap((action) => {
|
|
8
7
|
const { taskId } = action.payload;
|
|
@@ -11,10 +10,6 @@ export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filt
|
|
|
11
10
|
.pipe(mergeMap((response) => {
|
|
12
11
|
if (isSuccessStatus(response)) {
|
|
13
12
|
const actions = [];
|
|
14
|
-
if (taskId != null) {
|
|
15
|
-
actions.push(removeTaskFromList(taskId));
|
|
16
|
-
}
|
|
17
|
-
actions.push(fetchTaskList());
|
|
18
13
|
actions.push(deleteTaskSuccessOrFailure({ fetchState: 'Completed', taskId }));
|
|
19
14
|
return from(actions);
|
|
20
15
|
}
|
|
@@ -12,14 +12,12 @@ export const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pip
|
|
|
12
12
|
description: task.description,
|
|
13
13
|
status: task.status.code,
|
|
14
14
|
assignee: task.assignees,
|
|
15
|
-
groupAssignees: task.groupAssignees,
|
|
16
15
|
dueDate: task.dueDate,
|
|
17
16
|
priority: task.priority.code,
|
|
18
17
|
tagIds: task.tagIds,
|
|
19
18
|
fileIds: task.fileIds,
|
|
20
19
|
type: task.type,
|
|
21
20
|
recurringFrequency: task.recurringFrequency,
|
|
22
|
-
recurringDaysOfWeek: task.recurringDaysOfWeek,
|
|
23
21
|
recurringEndDateLocalData: {
|
|
24
22
|
recurringDatePickerOptionsType: 'date', // by default, date would be selected
|
|
25
23
|
recurringEndDate: task.recurringEndDate,
|
|
@@ -27,7 +25,6 @@ export const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pip
|
|
|
27
25
|
savedRecurringEndDate: task.recurringEndDate,
|
|
28
26
|
recurringStartDate: task.recurringStartDate,
|
|
29
27
|
timeSpent: task.timeSpent,
|
|
30
|
-
isPrivate: task.isPrivate,
|
|
31
28
|
};
|
|
32
29
|
const actions = [
|
|
33
30
|
saveTaskUpdatesToLocalStore({ taskDetailLocalData, taskId }),
|
|
@@ -91,14 +91,8 @@ const prepareTaskPayload = (state, taskId, taskGroupId) => {
|
|
|
91
91
|
recurring_start_date: localData.type.code === 'recurring'
|
|
92
92
|
? (localData.recurringStartDate?.format(DEFAULT_DATE_FORMAT) ?? null)
|
|
93
93
|
: null,
|
|
94
|
-
recurring_days_of_week: localData.type.code === 'recurring' &&
|
|
95
|
-
localData.recurringFrequency === 'semi_weekly'
|
|
96
|
-
? (localData.recurringDaysOfWeek ?? [])
|
|
97
|
-
: [],
|
|
98
94
|
sync_token: syncToken,
|
|
99
95
|
task_group_ids: taskGroupId != null ? [taskGroupId] : [],
|
|
100
96
|
time_spent: convertHHMMStrToMinutes(localData.timeSpent),
|
|
101
|
-
group_assignees: localData.groupAssignees,
|
|
102
|
-
...(taskId == null ? { is_private: localData.isPrivate ?? false } : {}),
|
|
103
97
|
};
|
|
104
98
|
};
|
|
@@ -3,7 +3,6 @@ export const initialTaskDetailLocalData = {
|
|
|
3
3
|
description: '',
|
|
4
4
|
status: 'todo',
|
|
5
5
|
assignee: [],
|
|
6
|
-
groupAssignees: [],
|
|
7
6
|
dueDate: undefined,
|
|
8
7
|
priority: 'medium',
|
|
9
8
|
tagIds: [],
|
|
@@ -32,9 +31,5 @@ export const initialTaskDetail = {
|
|
|
32
31
|
fetchState: 'Not-Started',
|
|
33
32
|
error: undefined,
|
|
34
33
|
},
|
|
35
|
-
snoozeStatus: {
|
|
36
|
-
fetchState: 'Not-Started',
|
|
37
|
-
error: undefined,
|
|
38
|
-
},
|
|
39
34
|
taskDetailLocalData: initialTaskDetailLocalData,
|
|
40
35
|
};
|
|
@@ -149,11 +149,11 @@ const taskDetailView = createSlice({
|
|
|
149
149
|
},
|
|
150
150
|
saveTaskSuccessOrFailure(draft, action) {
|
|
151
151
|
const { taskId, fetchState, error, newTaskId } = action.payload;
|
|
152
|
-
if (taskId != null
|
|
152
|
+
if (taskId != null) {
|
|
153
153
|
draft.editTaskStateById[taskId].saveStatus.fetchState = fetchState;
|
|
154
154
|
draft.editTaskStateById[taskId].saveStatus.error = error;
|
|
155
155
|
}
|
|
156
|
-
else
|
|
156
|
+
else {
|
|
157
157
|
if (newTaskId != null) {
|
|
158
158
|
draft.newTaskState.taskId = newTaskId;
|
|
159
159
|
}
|
|
@@ -182,10 +182,8 @@ const taskDetailView = createSlice({
|
|
|
182
182
|
},
|
|
183
183
|
archiveTaskSuccessOrFailure(draft, action) {
|
|
184
184
|
const { taskId, fetchState, error } = action.payload;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
draft.editTaskStateById[taskId].archiveStatus.error = error;
|
|
188
|
-
}
|
|
185
|
+
draft.editTaskStateById[taskId].archiveStatus.fetchState = fetchState;
|
|
186
|
+
draft.editTaskStateById[taskId].archiveStatus.error = error;
|
|
189
187
|
},
|
|
190
188
|
deleteTask: {
|
|
191
189
|
reducer(draft, action) {
|
|
@@ -218,70 +216,19 @@ const taskDetailView = createSlice({
|
|
|
218
216
|
},
|
|
219
217
|
},
|
|
220
218
|
deleteTaskSuccessOrFailure(draft, action) {
|
|
221
|
-
if (action.payload.taskId != null
|
|
222
|
-
draft.editTaskStateById[action.payload.taskId] != null) {
|
|
219
|
+
if (action.payload.taskId != null) {
|
|
223
220
|
const { taskId } = action.payload;
|
|
224
221
|
draft.editTaskStateById[taskId].deleteTaskStatus.fetchState =
|
|
225
222
|
action.payload.fetchState;
|
|
226
223
|
draft.editTaskStateById[taskId].deleteTaskStatus.error =
|
|
227
224
|
action.payload.error;
|
|
228
225
|
}
|
|
229
|
-
else
|
|
226
|
+
else {
|
|
230
227
|
draft.newTaskState.deleteTaskStatus.fetchState =
|
|
231
228
|
action.payload.fetchState;
|
|
232
229
|
draft.newTaskState.deleteTaskStatus.error = action.payload.error;
|
|
233
230
|
}
|
|
234
231
|
},
|
|
235
|
-
snoozeTask: {
|
|
236
|
-
reducer(draft, action) {
|
|
237
|
-
const { taskId } = action.payload;
|
|
238
|
-
draft.editTaskStateById[taskId] = {
|
|
239
|
-
...(draft.editTaskStateById[taskId] != null
|
|
240
|
-
? draft.editTaskStateById[taskId]
|
|
241
|
-
: initialTaskDetail),
|
|
242
|
-
snoozeStatus: {
|
|
243
|
-
fetchState: 'In-Progress',
|
|
244
|
-
error: undefined,
|
|
245
|
-
},
|
|
246
|
-
};
|
|
247
|
-
},
|
|
248
|
-
prepare(taskId, snoozedUntil) {
|
|
249
|
-
return {
|
|
250
|
-
payload: {
|
|
251
|
-
taskId,
|
|
252
|
-
snoozedUntil,
|
|
253
|
-
},
|
|
254
|
-
};
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
snoozeTaskSuccessOrFailure(draft, action) {
|
|
258
|
-
const { taskId, fetchState, error } = action.payload;
|
|
259
|
-
if (draft.editTaskStateById[taskId] != null) {
|
|
260
|
-
draft.editTaskStateById[taskId].snoozeStatus.fetchState = fetchState;
|
|
261
|
-
draft.editTaskStateById[taskId].snoozeStatus.error = error;
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
unsnoozeTask: {
|
|
265
|
-
reducer(draft, action) {
|
|
266
|
-
const { taskId } = action.payload;
|
|
267
|
-
draft.editTaskStateById[taskId] = {
|
|
268
|
-
...(draft.editTaskStateById[taskId] != null
|
|
269
|
-
? draft.editTaskStateById[taskId]
|
|
270
|
-
: initialTaskDetail),
|
|
271
|
-
snoozeStatus: {
|
|
272
|
-
fetchState: 'In-Progress',
|
|
273
|
-
error: undefined,
|
|
274
|
-
},
|
|
275
|
-
};
|
|
276
|
-
},
|
|
277
|
-
prepare(taskId) {
|
|
278
|
-
return {
|
|
279
|
-
payload: {
|
|
280
|
-
taskId,
|
|
281
|
-
},
|
|
282
|
-
};
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
232
|
fetchTaskHistory: {
|
|
286
233
|
reducer(draft, action) {
|
|
287
234
|
const { taskId, cacheOverride } = action.payload;
|
|
@@ -323,5 +270,5 @@ const taskDetailView = createSlice({
|
|
|
323
270
|
},
|
|
324
271
|
},
|
|
325
272
|
});
|
|
326
|
-
export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure,
|
|
273
|
+
export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure, fetchTaskHistory, updateTaskHistory, updateTaskHistoryFetchStatus, clearTaskDetail, updateCreatedTagToLocalStore, updateDeletedTagToLocalStore, } = taskDetailView.actions;
|
|
327
274
|
export default taskDetailView.reducer;
|
|
@@ -22,21 +22,11 @@ export const getTaskDetail = (state, taskId) => {
|
|
|
22
22
|
};
|
|
23
23
|
let taskHistory = [];
|
|
24
24
|
let createdByUser = undefined;
|
|
25
|
-
let isArchived = undefined;
|
|
26
|
-
let isDeleted = undefined;
|
|
27
|
-
let recurringSourceTaskId = undefined;
|
|
28
|
-
let snoozedUntil = undefined;
|
|
29
|
-
let taskGroupId = undefined;
|
|
30
25
|
if (taskId != null && sourceTaskDetail != null) {
|
|
31
26
|
const taskEntity = getTaskById(taskState, taskId);
|
|
32
27
|
const fileIdsInEntity = taskEntity?.fileIds ?? [];
|
|
33
28
|
if (taskEntity != null) {
|
|
34
29
|
createdByUser = getUserAndUserRole(userState, userRoleState, addressState, taskEntity.createdBy);
|
|
35
|
-
isArchived = taskEntity.isArchived;
|
|
36
|
-
isDeleted = taskEntity.isDeleted;
|
|
37
|
-
recurringSourceTaskId = taskEntity.recurringSourceTaskId;
|
|
38
|
-
snoozedUntil = taskEntity.snoozedUntil;
|
|
39
|
-
taskGroupId = taskEntity.taskGroupIds[0];
|
|
40
30
|
}
|
|
41
31
|
if (fileIdsInEntity.length > 0) {
|
|
42
32
|
fetchStatus = reduceFetchState([
|
|
@@ -84,12 +74,7 @@ export const getTaskDetail = (state, taskId) => {
|
|
|
84
74
|
error: fetchStatus.error,
|
|
85
75
|
version: 0,
|
|
86
76
|
createdByUser,
|
|
87
|
-
isArchived,
|
|
88
|
-
isDeleted,
|
|
89
|
-
recurringSourceTaskId,
|
|
90
77
|
showTaskDetailFormFooter,
|
|
91
|
-
snoozedUntil,
|
|
92
|
-
taskGroupId,
|
|
93
78
|
};
|
|
94
79
|
};
|
|
95
80
|
export const allTaskStatus = [
|
|
@@ -143,13 +128,11 @@ const showFormFooter = (taskDetailLocalData, taskDetailInStore) => {
|
|
|
143
128
|
taskDetailLocalData.status !== taskDetailInStore.status.code ||
|
|
144
129
|
!isEqual(taskDetailInStore.tagIds, taskDetailLocalData.tagIds) ||
|
|
145
130
|
!isEqual(taskDetailLocalData.assignee, taskDetailInStore?.assignees ?? []) ||
|
|
146
|
-
!isEqual(taskDetailLocalData.groupAssignees, taskDetailInStore?.groupAssignees ?? []) ||
|
|
147
131
|
!isEqual(taskDetailLocalData.fileIds, taskDetailInStore.fileIds ?? []) ||
|
|
148
132
|
!isEqual(taskDetailLocalData.dueDate, taskDetailInStore.dueDate) ||
|
|
149
133
|
!isEqual(taskDetailLocalData.type, taskDetailInStore.type) ||
|
|
150
134
|
!isEqual(taskDetailLocalData.savedRecurringEndDate, taskDetailInStore.recurringEndDate) ||
|
|
151
135
|
!isEqual(taskDetailLocalData.recurringFrequency, taskDetailInStore.recurringFrequency) ||
|
|
152
|
-
!isEqual(taskDetailLocalData.recurringDaysOfWeek, taskDetailInStore.recurringDaysOfWeek) ||
|
|
153
136
|
!isEqual(taskDetailLocalData.recurringStartDate, taskDetailInStore.recurringStartDate) ||
|
|
154
137
|
!isEqual(taskDetailLocalData.timeSpent, taskDetailInStore.timeSpent)) {
|
|
155
138
|
return true;
|
|
@@ -5,26 +5,21 @@ import { convertHHMMStrToMinutes } from '../../../../commonStateTypes/fiscalYear
|
|
|
5
5
|
import { DEFAULT_DATE_FORMAT } from '../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
6
6
|
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
7
7
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
8
|
-
import { bulkUpdateTaskList,
|
|
9
|
-
export const bulkUpdateTaskListEpic = (actions$,
|
|
8
|
+
import { bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksFailure, updateTasksListOnBulkUpdateTasksSuccess, } from '../taskListReducer';
|
|
9
|
+
export const bulkUpdateTaskListEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(bulkUpdateTaskList.match), switchMap((action) => {
|
|
10
|
+
const state = state$.value;
|
|
10
11
|
const { taskIds, updates, groupId } = action.payload;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
const payload = { task_ids: taskIds, updates: bulkUpdates };
|
|
12
|
+
const payload = {
|
|
13
|
+
tasks: getTasksListPayload(state, taskIds, updates),
|
|
14
|
+
};
|
|
16
15
|
return zeniAPI
|
|
17
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks
|
|
16
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
|
|
18
17
|
.pipe(mergeMap((response) => {
|
|
19
18
|
if (isSuccessResponse(response) && response.data != null) {
|
|
20
|
-
const removeFromList = updates.isArchived === true ||
|
|
21
|
-
updates.isDeleted === true ||
|
|
22
|
-
('snoozedUntil' in updates && updates.snoozedUntil == null);
|
|
23
19
|
return of(updateTasks(response.data.tasks), updateTasksListOnBulkUpdateTasksSuccess({
|
|
24
20
|
taskIds,
|
|
25
21
|
groupId,
|
|
26
|
-
|
|
27
|
-
}), fetchTaskList());
|
|
22
|
+
}));
|
|
28
23
|
}
|
|
29
24
|
else {
|
|
30
25
|
return of(updateTasksListOnBulkUpdateTasksFailure({
|
|
@@ -38,46 +33,19 @@ export const bulkUpdateTaskListEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
38
33
|
}));
|
|
39
34
|
}));
|
|
40
35
|
}));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
if (updates.groupAssignees != null) {
|
|
56
|
-
payload.group_assignees = updates.groupAssignees;
|
|
57
|
-
}
|
|
58
|
-
if (updates.dueDate != null) {
|
|
59
|
-
payload.due_date = updates.dueDate.format(DEFAULT_DATE_FORMAT);
|
|
60
|
-
}
|
|
61
|
-
if (updates.tagIds != null) {
|
|
62
|
-
payload.tags = updates.tagIds;
|
|
63
|
-
}
|
|
64
|
-
if (updates.timeSpent != null) {
|
|
65
|
-
payload.time_spent = convertHHMMStrToMinutes(updates.timeSpent.replace(/\D/g, ''));
|
|
66
|
-
}
|
|
67
|
-
if (updates.isArchived != null) {
|
|
68
|
-
payload.is_archived = updates.isArchived;
|
|
69
|
-
}
|
|
70
|
-
if (updates.isDeleted != null) {
|
|
71
|
-
payload.is_deleted = updates.isDeleted;
|
|
72
|
-
}
|
|
73
|
-
// Bulk snooze is not supported — only bulk unsnooze (clear all snooze fields)
|
|
74
|
-
if ('snoozedUntil' in updates) {
|
|
75
|
-
payload.snoozed_until = null;
|
|
76
|
-
payload.snoozed_by = null;
|
|
77
|
-
payload.snoozed_at = null;
|
|
78
|
-
payload.is_snooze_notification_sent = false;
|
|
79
|
-
}
|
|
80
|
-
return payload;
|
|
36
|
+
export const getTasksListPayload = (state, taskIds, updates) => {
|
|
37
|
+
const { taskState } = state;
|
|
38
|
+
const tasksList = taskIds
|
|
39
|
+
.map((taskId) => {
|
|
40
|
+
const task = get(taskState.taskByID, taskId);
|
|
41
|
+
return {
|
|
42
|
+
...task,
|
|
43
|
+
...updates,
|
|
44
|
+
};
|
|
45
|
+
})
|
|
46
|
+
.filter((task) => task != null);
|
|
47
|
+
const tasksPayload = tasksList.map((task) => toTaskPayload(state, task));
|
|
48
|
+
return tasksPayload;
|
|
81
49
|
};
|
|
82
50
|
export const getTaskPayload = (state, taskId, updates) => {
|
|
83
51
|
const { taskState } = state;
|
|
@@ -103,9 +71,6 @@ const toTaskPayload = (state, task) => {
|
|
|
103
71
|
assignees: task.assignees,
|
|
104
72
|
description: task.description,
|
|
105
73
|
group_assignees: task.groupAssignees,
|
|
106
|
-
is_archived: task.isArchived,
|
|
107
|
-
is_deleted: task.isDeleted,
|
|
108
|
-
snoozed_until: task.snoozedUntil != null ? task.snoozedUntil.toISOString() : null,
|
|
109
74
|
due_date: task.dueDate != null ? task.dueDate.format(DEFAULT_DATE_FORMAT) : null,
|
|
110
75
|
priority: task.priority.code,
|
|
111
76
|
status: task.status.code,
|
|
@@ -9,19 +9,10 @@ export const fetchTaskListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(f
|
|
|
9
9
|
.getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(`{"task_type": "all"}`)}`)
|
|
10
10
|
.pipe(mergeMap((response) => {
|
|
11
11
|
if (isSuccessResponse(response) && response.data != null) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
...(archived ?? []),
|
|
17
|
-
...(snoozed ?? []),
|
|
18
|
-
];
|
|
19
|
-
return of(updateTasks(allTasks), updateTaskList({
|
|
20
|
-
data: tasks,
|
|
21
|
-
deleted: deleted ?? [],
|
|
22
|
-
archived: archived ?? [],
|
|
23
|
-
snoozed: snoozed ?? [],
|
|
24
|
-
}), updateTags(allTasks.map((task) => task.tags).flat()));
|
|
12
|
+
return of(updateTasks(response.data.tasks), updateTaskList({
|
|
13
|
+
data: response.data.tasks,
|
|
14
|
+
updateType: 'replace',
|
|
15
|
+
}), updateTags(response.data.tasks.map((task) => task.tags).flat()));
|
|
25
16
|
}
|
|
26
17
|
else {
|
|
27
18
|
return of(updateTaskListFetchStatus({
|
|
@@ -8,10 +8,9 @@ export const updateTaskFromListViewEpic = (actions$, state$, zeniAPI) => actions
|
|
|
8
8
|
const state = state$.value;
|
|
9
9
|
const { task, updates } = action.payload;
|
|
10
10
|
const taskId = task.id;
|
|
11
|
-
|
|
12
|
-
const { snoozed_until: _snoozedUntil, ...taskData } = getTaskPayload(state, taskId, updates);
|
|
11
|
+
const taskData = getTaskPayload(state, taskId, updates);
|
|
13
12
|
return zeniAPI
|
|
14
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, taskData)
|
|
13
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, { ...taskData })
|
|
15
14
|
.pipe(mergeMap((response) => {
|
|
16
15
|
if (isSuccessResponse(response) && response.data != null) {
|
|
17
16
|
return from([
|