@zeniai/client-epic-state 5.3.8-beta0DI → 5.3.9
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/task/taskPayload.d.ts +0 -1
- package/lib/entity/task/taskPayload.js +0 -1
- package/lib/entity/task/taskReducer.d.ts +1 -4
- package/lib/entity/task/taskReducer.js +2 -19
- package/lib/entity/task/taskState.d.ts +0 -3
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.js +45 -38
- package/lib/epic.d.ts +1 -4
- package/lib/epic.js +0 -9
- package/lib/esm/entity/task/taskPayload.js +0 -1
- package/lib/esm/entity/task/taskReducer.js +1 -18
- package/lib/esm/entity/tenant/epic/fetchAllTenantsEpic.js +46 -39
- package/lib/esm/epic.js +0 -9
- package/lib/esm/index.js +3 -6
- package/lib/esm/init.js +14 -3
- package/lib/esm/reducer.js +0 -6
- package/lib/esm/sessionEndpointsLoader.js +7 -0
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +0 -3
- package/lib/esm/view/taskManager/taskListView/taskList.js +0 -5
- package/lib/esm/view/taskManager/taskListView/taskListFilterHelpers.js +0 -2
- package/lib/esm/view/taskManager/taskListView/taskListViewHelpers.js +0 -37
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionPayload.js +14 -2
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionSelector.js +21 -2
- package/lib/index.d.ts +4 -7
- package/lib/index.js +53 -66
- package/lib/init.d.ts +9 -0
- package/lib/init.js +17 -4
- package/lib/reducer.d.ts +0 -2
- package/lib/reducer.js +0 -6
- package/lib/rootStateTypes.d.ts +0 -4
- package/lib/sessionEndpointsLoader.d.ts +9 -0
- package/lib/sessionEndpointsLoader.js +11 -0
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -4
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +0 -3
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskList.js +0 -5
- package/lib/view/taskManager/taskListView/taskListFilterHelpers.js +0 -2
- package/lib/view/taskManager/taskListView/taskListViewHelpers.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListViewHelpers.js +0 -37
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.d.ts +10 -6
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.js +14 -2
- package/lib/view/transactionDetail/createTransaction/createTransactionSelector.d.ts +4 -1
- package/lib/view/transactionDetail/createTransaction/createTransactionSelector.js +21 -2
- package/lib/view/transactionDetail/createTransaction/createTransactionState.d.ts +1 -1
- package/lib/zeniAPI.d.ts +2 -2
- package/package.json +1 -1
- package/lib/entity/timeEntry/timeEntryPayload.d.ts +0 -26
- package/lib/entity/timeEntry/timeEntryPayload.js +0 -2
- package/lib/entity/timeEntry/timeEntryReducer.d.ts +0 -8
- package/lib/entity/timeEntry/timeEntryReducer.js +0 -76
- package/lib/entity/timeEntry/timeEntrySelector.d.ts +0 -10
- package/lib/entity/timeEntry/timeEntrySelector.js +0 -32
- package/lib/entity/timeEntry/timeEntryState.d.ts +0 -43
- package/lib/entity/timeEntry/timeEntryState.js +0 -13
- package/lib/esm/entity/timeEntry/timeEntryPayload.js +0 -1
- package/lib/esm/entity/timeEntry/timeEntryReducer.js +0 -70
- package/lib/esm/entity/timeEntry/timeEntrySelector.js +0 -23
- package/lib/esm/entity/timeEntry/timeEntryState.js +0 -8
- package/lib/esm/view/taskManager/timeEntryView/epic/fetchTaskCategoriesEpic.js +0 -24
- package/lib/esm/view/taskManager/timeEntryView/epic/fetchTimeEntriesEpic.js +0 -73
- package/lib/esm/view/taskManager/timeEntryView/epic/writeTimeEntryEpic.js +0 -77
- package/lib/esm/view/taskManager/timeEntryView/timeEntryViewPayload.js +0 -1
- package/lib/esm/view/taskManager/timeEntryView/timeEntryViewReducer.js +0 -160
- package/lib/esm/view/taskManager/timeEntryView/timeEntryViewSelector.js +0 -41
- package/lib/esm/view/taskManager/timeEntryView/timeEntryViewState.js +0 -1
- package/lib/view/taskManager/timeEntryView/epic/fetchTaskCategoriesEpic.d.ts +0 -18
- package/lib/view/taskManager/timeEntryView/epic/fetchTaskCategoriesEpic.js +0 -28
- package/lib/view/taskManager/timeEntryView/epic/fetchTimeEntriesEpic.d.ts +0 -23
- package/lib/view/taskManager/timeEntryView/epic/fetchTimeEntriesEpic.js +0 -78
- package/lib/view/taskManager/timeEntryView/epic/writeTimeEntryEpic.d.ts +0 -23
- package/lib/view/taskManager/timeEntryView/epic/writeTimeEntryEpic.js +0 -83
- package/lib/view/taskManager/timeEntryView/timeEntryViewPayload.d.ts +0 -27
- package/lib/view/taskManager/timeEntryView/timeEntryViewPayload.js +0 -2
- package/lib/view/taskManager/timeEntryView/timeEntryViewReducer.d.ts +0 -48
- package/lib/view/taskManager/timeEntryView/timeEntryViewReducer.js +0 -164
- package/lib/view/taskManager/timeEntryView/timeEntryViewSelector.d.ts +0 -24
- package/lib/view/taskManager/timeEntryView/timeEntryViewSelector.js +0 -46
- package/lib/view/taskManager/timeEntryView/timeEntryViewState.d.ts +0 -21
- package/lib/view/taskManager/timeEntryView/timeEntryViewState.js +0 -5
package/lib/init.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { RootState } from './rootStateTypes';
|
|
|
3
3
|
import { RESTAPIEndpoints } from './zeniAPI';
|
|
4
4
|
export type ZeniStore = Store<RootState>;
|
|
5
5
|
export { zeniAPI } from './zeniAPIClientState';
|
|
6
|
+
export { setSessionEndpointsLoader } from './sessionEndpointsLoader';
|
|
7
|
+
export type { SessionEndpointsLoader } from './sessionEndpointsLoader';
|
|
6
8
|
export { disconnectPusher, initializePusher, pusher } from './pusherClient';
|
|
7
9
|
export type { PusherAuthPayload } from './pusherClient';
|
|
8
10
|
export declare let store: ZeniStore;
|
|
@@ -23,6 +25,13 @@ export { injectFeatureModules, injectFeatureEpics } from './configureStore';
|
|
|
23
25
|
* @param tenantId
|
|
24
26
|
*/
|
|
25
27
|
export declare function updateZeniAPIClientConfig(userId?: string, sessionId?: string, tenantId?: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Replace the REST endpoints the API client calls. Epics read the endpoints
|
|
30
|
+
* at request time, so every request made after this uses the new ones.
|
|
31
|
+
* Note: This version SHOULD BE used only in the client side.
|
|
32
|
+
* @param restEndPoints
|
|
33
|
+
*/
|
|
34
|
+
export declare function updateZeniAPIEndpoints(restEndPoints: RESTAPIEndpoints): void;
|
|
26
35
|
/**
|
|
27
36
|
* Returns current Zeni REST API client config.
|
|
28
37
|
* @returns
|
package/lib/init.js
CHANGED
|
@@ -36,9 +36,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.injectFeatureEpics = exports.injectFeatureModules = exports.store = exports.pusher = exports.initializePusher = exports.disconnectPusher = exports.zeniAPI = void 0;
|
|
39
|
+
exports.injectFeatureEpics = exports.injectFeatureModules = exports.store = exports.pusher = exports.initializePusher = exports.disconnectPusher = exports.setSessionEndpointsLoader = exports.zeniAPI = void 0;
|
|
40
40
|
exports.default = initialize;
|
|
41
41
|
exports.updateZeniAPIClientConfig = updateZeniAPIClientConfig;
|
|
42
|
+
exports.updateZeniAPIEndpoints = updateZeniAPIEndpoints;
|
|
42
43
|
exports.zeniAPIClientConfig = zeniAPIClientConfig;
|
|
43
44
|
exports.initializeWithNewStore = initializeWithNewStore;
|
|
44
45
|
exports.initialize3rdPartyExtensions = initialize3rdPartyExtensions;
|
|
@@ -47,6 +48,8 @@ const zeniAPI_1 = require("./zeniAPI");
|
|
|
47
48
|
const zeniAPIClientState_1 = require("./zeniAPIClientState");
|
|
48
49
|
var zeniAPIClientState_2 = require("./zeniAPIClientState");
|
|
49
50
|
Object.defineProperty(exports, "zeniAPI", { enumerable: true, get: function () { return zeniAPIClientState_2.zeniAPI; } });
|
|
51
|
+
var sessionEndpointsLoader_1 = require("./sessionEndpointsLoader");
|
|
52
|
+
Object.defineProperty(exports, "setSessionEndpointsLoader", { enumerable: true, get: function () { return sessionEndpointsLoader_1.setSessionEndpointsLoader; } });
|
|
50
53
|
var pusherClient_1 = require("./pusherClient");
|
|
51
54
|
Object.defineProperty(exports, "disconnectPusher", { enumerable: true, get: function () { return pusherClient_1.disconnectPusher; } });
|
|
52
55
|
Object.defineProperty(exports, "initializePusher", { enumerable: true, get: function () { return pusherClient_1.initializePusher; } });
|
|
@@ -60,11 +63,10 @@ let initialized = false;
|
|
|
60
63
|
*/
|
|
61
64
|
function initialize(restEndPoints, userId, sessionId, tenantId, isSandboxEnv, onSessionInvalidated) {
|
|
62
65
|
if (initialized) {
|
|
63
|
-
console.warn(
|
|
66
|
+
console.warn('client-epic-state is already initialized');
|
|
64
67
|
return exports.store;
|
|
65
68
|
}
|
|
66
69
|
initialized = true;
|
|
67
|
-
console.info(`initializing with ${JSON.stringify(restEndPoints)}`);
|
|
68
70
|
initialize3rdPartyExtensions();
|
|
69
71
|
(0, zeniAPIClientState_1.setZeniAPIClient)(new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId, onSessionInvalidated));
|
|
70
72
|
exports.store = (0, configureStore_1.default)(zeniAPIClientState_1.zeniAPI, isSandboxEnv);
|
|
@@ -84,6 +86,18 @@ Object.defineProperty(exports, "injectFeatureEpics", { enumerable: true, get: fu
|
|
|
84
86
|
function updateZeniAPIClientConfig(userId, sessionId, tenantId) {
|
|
85
87
|
zeniAPIClientState_1.zeniAPI.update(userId, sessionId, tenantId);
|
|
86
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Replace the REST endpoints the API client calls. Epics read the endpoints
|
|
91
|
+
* at request time, so every request made after this uses the new ones.
|
|
92
|
+
* Note: This version SHOULD BE used only in the client side.
|
|
93
|
+
* @param restEndPoints
|
|
94
|
+
*/
|
|
95
|
+
function updateZeniAPIEndpoints(restEndPoints) {
|
|
96
|
+
if (zeniAPIClientState_1.zeniAPI == null) {
|
|
97
|
+
throw new Error('Call initialize() before updateZeniAPIEndpoints()');
|
|
98
|
+
}
|
|
99
|
+
zeniAPIClientState_1.zeniAPI.apiEndPoints = restEndPoints;
|
|
100
|
+
}
|
|
87
101
|
/**
|
|
88
102
|
* Returns current Zeni REST API client config.
|
|
89
103
|
* @returns
|
|
@@ -110,7 +124,6 @@ function zeniAPIClientConfig() {
|
|
|
110
124
|
* @param tenantId tenant id
|
|
111
125
|
*/
|
|
112
126
|
async function initializeWithNewStore(restEndPoints, userId, sessionId, tenantId) {
|
|
113
|
-
console.info(`initializeWithNewStore with ${JSON.stringify(restEndPoints)}`);
|
|
114
127
|
initialize3rdPartyExtensions();
|
|
115
128
|
const zeniHttpClient = new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId);
|
|
116
129
|
const store = (0, configureStore_1.default)(zeniHttpClient, false);
|
package/lib/reducer.d.ts
CHANGED
|
@@ -165,7 +165,6 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
165
165
|
taskGroupTemplateViewState: import("./view/taskManager/taskGroupTemplateView/taskGroupTemplateViewState").TaskGroupTemplateViewState;
|
|
166
166
|
taskGroupViewState: import("./view/taskManager/taskGroupView/taskGroupViewState").TaskGroupViewState;
|
|
167
167
|
taskListState: import("./view/taskManager/taskListView/taskList").TaskListState;
|
|
168
|
-
timeEntryViewState: import("./view/taskManager/timeEntryView/timeEntryViewState").TimeEntryViewState;
|
|
169
168
|
tagViewState: import(".").TagViewState;
|
|
170
169
|
tasksCardState: import("./view/tasksCard/tasksCardState").TasksCardState;
|
|
171
170
|
topExState: import("./view/topEx/topExState").TopExState;
|
|
@@ -266,7 +265,6 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
266
265
|
subscriptionState: import("./entity/subscription/subscription/subscriptionState").SubscriptionState;
|
|
267
266
|
subscriptionSummaryState: import("./entity/subscription/subscriptionSummary/subscriptionSummaryState").SubscriptionSummaryState;
|
|
268
267
|
tagState: import(".").TagState;
|
|
269
|
-
timeEntryState: import("./entity/timeEntry/timeEntryState").TimeEntryState;
|
|
270
268
|
taskGroupState: import(".").TaskGroupState;
|
|
271
269
|
taskGroupTemplateState: import("./entity/taskGroupTemplate/taskGroupTemplateState").TaskGroupTemplateState;
|
|
272
270
|
taskState: import("./entity/task/taskState").TaskState;
|
package/lib/reducer.js
CHANGED
|
@@ -109,7 +109,6 @@ const taskGroupReducer_1 = __importStar(require("./entity/taskGroup/taskGroupRed
|
|
|
109
109
|
const taskGroupTemplateReducer_1 = __importStar(require("./entity/taskGroupTemplate/taskGroupTemplateReducer"));
|
|
110
110
|
const taskSummaryReducer_1 = __importStar(require("./entity/taskSummary/taskSummaryReducer"));
|
|
111
111
|
const tenantReducer_1 = __importStar(require("./entity/tenant/tenantReducer"));
|
|
112
|
-
const timeEntryReducer_1 = __importStar(require("./entity/timeEntry/timeEntryReducer"));
|
|
113
112
|
const toastNotificationReducer_1 = __importStar(require("./entity/toastNotification/toastNotificationReducer"));
|
|
114
113
|
const transactionReducer_1 = __importStar(require("./entity/transaction/transactionReducer"));
|
|
115
114
|
const transactionActivityLogReducer_1 = __importStar(require("./entity/transactionActivityLog/transactionActivityLogReducer"));
|
|
@@ -295,7 +294,6 @@ const taskDetailReducer_1 = __importStar(require("./view/taskManager/taskDetailV
|
|
|
295
294
|
const taskGroupTemplateViewReducer_1 = __importStar(require("./view/taskManager/taskGroupTemplateView/taskGroupTemplateViewReducer"));
|
|
296
295
|
const taskGroupViewReducer_1 = __importStar(require("./view/taskManager/taskGroupView/taskGroupViewReducer"));
|
|
297
296
|
const taskListReducer_1 = __importStar(require("./view/taskManager/taskListView/taskListReducer"));
|
|
298
|
-
const timeEntryViewReducer_1 = __importStar(require("./view/taskManager/timeEntryView/timeEntryViewReducer"));
|
|
299
297
|
const tasksCardReducer_1 = __importStar(require("./view/tasksCard/tasksCardReducer"));
|
|
300
298
|
const topExReducer_1 = __importStar(require("./view/topEx/topExReducer"));
|
|
301
299
|
const transactionActivityLogViewReducer_1 = __importStar(require("./view/transactionActivityLogView/transactionActivityLogViewReducer"));
|
|
@@ -384,7 +382,6 @@ const initialEntitiesState = {
|
|
|
384
382
|
subscriptionState: subscriptionReducer_1.initialState,
|
|
385
383
|
subscriptionSummaryState: subscriptionSummaryReducer_1.initialState,
|
|
386
384
|
tagState: tagReducer_1.initialState,
|
|
387
|
-
timeEntryState: timeEntryReducer_1.initialState,
|
|
388
385
|
taskGroupState: taskGroupReducer_1.initialState,
|
|
389
386
|
taskGroupTemplateState: taskGroupTemplateReducer_1.initialState,
|
|
390
387
|
taskState: taskReducer_1.initialState,
|
|
@@ -566,7 +563,6 @@ const initialViewsState = {
|
|
|
566
563
|
taskGroupTemplateViewState: taskGroupTemplateViewReducer_1.initialState,
|
|
567
564
|
taskGroupViewState: taskGroupViewReducer_1.initialState,
|
|
568
565
|
taskListState: taskListReducer_1.initialState,
|
|
569
|
-
timeEntryViewState: timeEntryViewReducer_1.initialState,
|
|
570
566
|
tasksCardState: tasksCardReducer_1.initialState,
|
|
571
567
|
topExState: topExReducer_1.initialState,
|
|
572
568
|
transactionActivityLogViewState: transactionActivityLogViewReducer_1.initialState,
|
|
@@ -675,7 +671,6 @@ const entityReducers = {
|
|
|
675
671
|
subscriptionState: subscriptionReducer_1.default,
|
|
676
672
|
subscriptionSummaryState: subscriptionSummaryReducer_1.default,
|
|
677
673
|
tagState: tagReducer_1.default,
|
|
678
|
-
timeEntryState: timeEntryReducer_1.default,
|
|
679
674
|
taskGroupState: taskGroupReducer_1.default,
|
|
680
675
|
taskGroupTemplateState: taskGroupTemplateReducer_1.default,
|
|
681
676
|
taskState: taskReducer_1.default,
|
|
@@ -856,7 +851,6 @@ const viewReducers = {
|
|
|
856
851
|
taskGroupTemplateViewState: taskGroupTemplateViewReducer_1.default,
|
|
857
852
|
taskGroupViewState: taskGroupViewReducer_1.default,
|
|
858
853
|
taskListState: taskListReducer_1.default,
|
|
859
|
-
timeEntryViewState: timeEntryViewReducer_1.default,
|
|
860
854
|
tagViewState: tagViewReducer_1.default,
|
|
861
855
|
tasksCardState: tasksCardReducer_1.default,
|
|
862
856
|
topExState: topExReducer_1.default,
|
package/lib/rootStateTypes.d.ts
CHANGED
|
@@ -69,7 +69,6 @@ import { TaskGroupState } from './entity/taskGroup/taskGroupState';
|
|
|
69
69
|
import { TaskGroupTemplateState } from './entity/taskGroupTemplate/taskGroupTemplateState';
|
|
70
70
|
import { TaskSummaryState } from './entity/taskSummary/taskSummaryState';
|
|
71
71
|
import { TenantState } from './entity/tenant/tenantState';
|
|
72
|
-
import { TimeEntryState } from './entity/timeEntry/timeEntryState';
|
|
73
72
|
import { ToastNotificationState } from './entity/toastNotification/toastNotificationState';
|
|
74
73
|
import { TransactionState } from './entity/transaction/transactionState';
|
|
75
74
|
import { TransactionActivityLogState } from './entity/transactionActivityLog/transactionActivityLogState';
|
|
@@ -253,7 +252,6 @@ import { TaskDetailViewState } from './view/taskManager/taskDetailView/taskDetai
|
|
|
253
252
|
import { TaskGroupTemplateViewState } from './view/taskManager/taskGroupTemplateView/taskGroupTemplateViewState';
|
|
254
253
|
import { TaskGroupViewState } from './view/taskManager/taskGroupView/taskGroupViewState';
|
|
255
254
|
import { TaskListState } from './view/taskManager/taskListView/taskList';
|
|
256
|
-
import { TimeEntryViewState } from './view/taskManager/timeEntryView/timeEntryViewState';
|
|
257
255
|
import { TasksCardState } from './view/tasksCard/tasksCardState';
|
|
258
256
|
import { TopExState } from './view/topEx/topExState';
|
|
259
257
|
import { TransactionActivityLogViewState } from './view/transactionActivityLogView/transactionActivityLogViewState';
|
|
@@ -346,7 +344,6 @@ export type EntitiesState = {
|
|
|
346
344
|
taskState: TaskState;
|
|
347
345
|
taskSummaryState: TaskSummaryState;
|
|
348
346
|
tenantState: TenantState;
|
|
349
|
-
timeEntryState: TimeEntryState;
|
|
350
347
|
toastNotificationState: ToastNotificationState;
|
|
351
348
|
transactionActivityLogState: TransactionActivityLogState;
|
|
352
349
|
transactionState: TransactionState;
|
|
@@ -524,7 +521,6 @@ export type ViewsState = {
|
|
|
524
521
|
taskGroupViewState: TaskGroupViewState;
|
|
525
522
|
taskListState: TaskListState;
|
|
526
523
|
tasksCardState: TasksCardState;
|
|
527
|
-
timeEntryViewState: TimeEntryViewState;
|
|
528
524
|
topExState: TopExState;
|
|
529
525
|
transactionActivityLogViewState: TransactionActivityLogViewState;
|
|
530
526
|
transactionDetailState: TransactionDetailState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Called after sign-in, before the user's tenants are fetched. The app uses it
|
|
3
|
+
* to fetch the endpoints that are only served to a signed-in session and to
|
|
4
|
+
* hand them to `updateZeniAPIEndpoints`. Without a loader, tenants are fetched
|
|
5
|
+
* straight away with the endpoints given to `initialize`.
|
|
6
|
+
*/
|
|
7
|
+
export type SessionEndpointsLoader = (userId: string, sessionId?: string) => Promise<void>;
|
|
8
|
+
export declare function setSessionEndpointsLoader(loader: SessionEndpointsLoader | undefined): void;
|
|
9
|
+
export declare function getSessionEndpointsLoader(): SessionEndpointsLoader | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setSessionEndpointsLoader = setSessionEndpointsLoader;
|
|
4
|
+
exports.getSessionEndpointsLoader = getSessionEndpointsLoader;
|
|
5
|
+
let sessionEndpointsLoader;
|
|
6
|
+
function setSessionEndpointsLoader(loader) {
|
|
7
|
+
sessionEndpointsLoader = loader;
|
|
8
|
+
}
|
|
9
|
+
function getSessionEndpointsLoader() {
|
|
10
|
+
return sessionEndpointsLoader;
|
|
11
|
+
}
|
|
@@ -25,10 +25,6 @@ export interface TaskDetailSelectorView extends SelectorView {
|
|
|
25
25
|
isDeleted?: boolean;
|
|
26
26
|
recurringSourceTaskId?: ID;
|
|
27
27
|
snoozedUntil?: ZeniDate | null;
|
|
28
|
-
/** Drives the Category control in the For Internal Use block. Read from
|
|
29
|
-
* the task entity rather than mirrored into local form data: it is not
|
|
30
|
-
* editable inline, and a mirror would need its own discard path. */
|
|
31
|
-
taskCategoryId?: ID;
|
|
32
28
|
taskGroupId?: ID;
|
|
33
29
|
}
|
|
34
30
|
export declare const getTaskDetail: (state: RootState, taskId?: ID) => TaskDetailSelectorView;
|
|
@@ -32,7 +32,6 @@ const getTaskDetail = (state, taskId) => {
|
|
|
32
32
|
let isDeleted = undefined;
|
|
33
33
|
let depth = undefined;
|
|
34
34
|
let recurringSourceTaskId = undefined;
|
|
35
|
-
let taskCategoryId = undefined;
|
|
36
35
|
let snoozedUntil = undefined;
|
|
37
36
|
let taskGroupId = undefined;
|
|
38
37
|
let subtasks = [];
|
|
@@ -46,7 +45,6 @@ const getTaskDetail = (state, taskId) => {
|
|
|
46
45
|
if (taskEntity != null) {
|
|
47
46
|
createdByUser = (0, userAndRole_1.getUserAndUserRole)(userState, userRoleState, addressState, taskEntity.createdBy);
|
|
48
47
|
depth = taskEntity.depth;
|
|
49
|
-
taskCategoryId = taskEntity.taskCategoryId;
|
|
50
48
|
isArchived = taskEntity.isArchived;
|
|
51
49
|
isDeleted = taskEntity.isDeleted;
|
|
52
50
|
recurringSourceTaskId = taskEntity.recurringSourceTaskId;
|
|
@@ -111,7 +109,6 @@ const getTaskDetail = (state, taskId) => {
|
|
|
111
109
|
version: 0,
|
|
112
110
|
createdByUser,
|
|
113
111
|
depth,
|
|
114
|
-
taskCategoryId,
|
|
115
112
|
isArchived,
|
|
116
113
|
isDeleted,
|
|
117
114
|
recurringSourceTaskId,
|
|
@@ -48,7 +48,7 @@ export interface TaskFilterCategory {
|
|
|
48
48
|
values: (string | ZeniDate)[];
|
|
49
49
|
valuesCombinationOperator: 'ANY';
|
|
50
50
|
}
|
|
51
|
-
export type TaskListFilterCategoryField = 'status' | 'dueDate' | 'assignee' | '
|
|
51
|
+
export type TaskListFilterCategoryField = 'status' | 'dueDate' | 'assignee' | 'creationDate' | 'priority' | 'tag';
|
|
52
52
|
export declare const TASK_LIST_GROUP_BY_KEYS: readonly ["groupName", "status", "dueDate", "assignee", "priority", "tag"];
|
|
53
53
|
export declare const toTaskListGroupByKeyType: (v: string) => "status" | "dueDate" | "priority" | "assignee" | "tag" | "groupName";
|
|
54
54
|
export declare const toTaskListGroupByKeyTypeStrict: (v: string) => "status" | "dueDate" | "priority" | "assignee" | "tag" | "groupName" | undefined;
|
|
@@ -53,11 +53,6 @@ exports.TASK_LIST_FILTER_CATEGORIES = [
|
|
|
53
53
|
type: 'user',
|
|
54
54
|
multiple: true,
|
|
55
55
|
},
|
|
56
|
-
{
|
|
57
|
-
value: 'createdBy',
|
|
58
|
-
type: 'user',
|
|
59
|
-
multiple: true,
|
|
60
|
-
},
|
|
61
56
|
{ value: 'creationDate', type: 'dateRange', multiple: true },
|
|
62
57
|
];
|
|
63
58
|
exports.TASK_LIST_GROUP_BY_CATEGORIES = [
|
|
@@ -3,7 +3,7 @@ import { Task } from '../../../entity/task/taskState';
|
|
|
3
3
|
import { User } from '../../../entity/user/userState';
|
|
4
4
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
5
5
|
import { TaskGroupKey } from './taskList';
|
|
6
|
-
export type SubtaskSortKey = 'name' | 'status' | 'assignee' | 'tag'
|
|
6
|
+
export type SubtaskSortKey = 'name' | 'status' | 'assignee' | 'tag';
|
|
7
7
|
export type SubtaskSortOrder = 'asc' | 'desc';
|
|
8
8
|
export declare const getDueDateValueFromDueDateGroupId: (groupId: string) => ZeniDate;
|
|
9
9
|
export declare const getTaskUpdates: (groupByKey: TaskGroupKey, groupId: string) => Partial<Task>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sortSubtasks = exports.getTaskUpdates = exports.getDueDateValueFromDueDateGroupId = void 0;
|
|
4
|
-
const formatMinutesToFromHHMM_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatMinutesToFromHHMM");
|
|
5
4
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
6
5
|
const taskDetailSelector_1 = require("../taskDetailView/taskDetailSelector");
|
|
7
6
|
const taskList_1 = require("./taskList");
|
|
@@ -69,11 +68,6 @@ const sortSubtasks = (subtasks, sortKey, sortOrder, userList, tagList) => {
|
|
|
69
68
|
return acc;
|
|
70
69
|
}, {});
|
|
71
70
|
const unknownStatusRank = taskDetailSelector_1.allTaskStatus.length;
|
|
72
|
-
const priorityOrder = taskDetailSelector_1.allTaskPriority.reduce((acc, priority, index) => {
|
|
73
|
-
acc[priority.code] = index;
|
|
74
|
-
return acc;
|
|
75
|
-
}, {});
|
|
76
|
-
const unknownPriorityRank = taskDetailSelector_1.allTaskPriority.length;
|
|
77
71
|
const cmpStr = (a, b) => a.localeCompare(b, undefined, { sensitivity: 'base' });
|
|
78
72
|
const keyFn = (task) => {
|
|
79
73
|
if (sortKey === 'name') {
|
|
@@ -100,37 +94,6 @@ const sortSubtasks = (subtasks, sortKey, sortOrder, userList, tagList) => {
|
|
|
100
94
|
const tag = tagList.find((candidate) => candidate.tagId === firstTagId);
|
|
101
95
|
return tag?.name ?? '';
|
|
102
96
|
}
|
|
103
|
-
if (sortKey === 'priority') {
|
|
104
|
-
// Rank by the canonical order, not the code string: alphabetical would
|
|
105
|
-
// sort "high" before "urgent" and read as wrong to anyone scanning it.
|
|
106
|
-
return priorityOrder[task.priority?.code] ?? unknownPriorityRank;
|
|
107
|
-
}
|
|
108
|
-
if (sortKey === 'dueDate') {
|
|
109
|
-
// A task with no date is not "earliest", so undated rows belong at the
|
|
110
|
-
// bottom in BOTH directions. The comparator negates for 'desc', so one
|
|
111
|
-
// fixed sentinel would flip them to the top — the sentinel has to flip
|
|
112
|
-
// with the order to survive that negation.
|
|
113
|
-
// `dueDate` is already a ZeniDate (dayjs), so valueOf() is the epoch.
|
|
114
|
-
// An unparseable date yields NaN, and a NaN comparator leaves the array
|
|
115
|
-
// untouched -- the same silent failure the timeSpent branch guards.
|
|
116
|
-
// Treat it as undated rather than as a date.
|
|
117
|
-
const due = task.dueDate;
|
|
118
|
-
const epoch = due?.valueOf();
|
|
119
|
-
if (epoch == null || Number.isNaN(epoch)) {
|
|
120
|
-
return sortOrder === 'asc'
|
|
121
|
-
? Number.MAX_SAFE_INTEGER
|
|
122
|
-
: Number.MIN_SAFE_INTEGER;
|
|
123
|
-
}
|
|
124
|
-
return epoch;
|
|
125
|
-
}
|
|
126
|
-
if (sortKey === 'timeSpent') {
|
|
127
|
-
// `timeSpent` is an "HHMM" STRING (no colon). Comparing it as text puts
|
|
128
|
-
// "1000" before "0900" only by luck of padding, and any malformed value
|
|
129
|
-
// makes the converter return NaN -- which a comparator turns into "no
|
|
130
|
-
// sort at all", silently. Coerce that to 0.
|
|
131
|
-
const minutes = (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(task.timeSpent ?? '');
|
|
132
|
-
return Number.isFinite(minutes) ? minutes : 0;
|
|
133
|
-
}
|
|
134
97
|
return '';
|
|
135
98
|
};
|
|
136
99
|
const copy = [...subtasks];
|
|
@@ -12,8 +12,9 @@ import { CreateTransactionLocalData } from './createTransactionState';
|
|
|
12
12
|
* 1. `line_detail_type` is snake_case. The PascalCase strings in the backend are Python
|
|
13
13
|
* constant NAMES; ZENI_LINE_DETAIL_TYPE_TO_QBO_LINE_DETAIL_TYPE_MAP converts them for the
|
|
14
14
|
* body the backend sends on to QuickBooks, never for ours.
|
|
15
|
-
* 2.
|
|
16
|
-
* `document_number
|
|
15
|
+
* 2. The QBO Purchases (check, credit_card_credit) send their reference number as
|
|
16
|
+
* `document_number`; a journal entry sends its entry name as `document_id`. Both land on
|
|
17
|
+
* QBO's DocNumber, but QBOJournalEntry reads only `document_id`.
|
|
17
18
|
*/
|
|
18
19
|
export interface CreateTransactionAccountPayload {
|
|
19
20
|
qbo_id: ID;
|
|
@@ -25,14 +26,15 @@ export interface CreateTransactionLineDetailPayload {
|
|
|
25
26
|
qbo_id: ID;
|
|
26
27
|
};
|
|
27
28
|
/**
|
|
28
|
-
* journal_entry only,
|
|
29
|
-
*
|
|
29
|
+
* journal_entry only, inside line_detail. QBOJournalEntry reads only posting_type_name; a
|
|
30
|
+
* lowercase posting_type is dropped and QBO then rejects the line.
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
+
posting_type_name?: 'Credit' | 'Debit';
|
|
32
33
|
/** Same shape the transaction update sends on a vendor line. */
|
|
33
34
|
project?: ProjectBasePayload;
|
|
35
|
+
/** journal_entry only. The backend reads the QBO vendor id from `vendor_id`, not `qbo_id`. */
|
|
34
36
|
vendor?: {
|
|
35
|
-
|
|
37
|
+
vendor_id: ID;
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
export interface CreateTransactionLinePayload {
|
|
@@ -51,6 +53,8 @@ export interface CreateTransactionRemitToAddressPayload {
|
|
|
51
53
|
export interface CreateTransactionRequest extends Record<string, unknown> {
|
|
52
54
|
transaction_date: string;
|
|
53
55
|
transaction_type: string;
|
|
56
|
+
/** journal_entry entry name (QBO DocNumber). */
|
|
57
|
+
document_id?: string;
|
|
54
58
|
/** check / credit_card_credit reference number (QBO Purchase). */
|
|
55
59
|
document_number?: string;
|
|
56
60
|
from_account_id?: ID;
|
|
@@ -7,6 +7,10 @@ const classSelector_1 = require("../../../entity/class/classSelector");
|
|
|
7
7
|
const projectPayload_1 = require("../../../entity/project/projectPayload");
|
|
8
8
|
const projectSelector_1 = require("../../../entity/project/projectSelector");
|
|
9
9
|
const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
|
|
10
|
+
const POSTING_TYPE_NAME = {
|
|
11
|
+
credit: 'Credit',
|
|
12
|
+
debit: 'Debit',
|
|
13
|
+
};
|
|
10
14
|
const toRemitToAddressPayload = (address) => {
|
|
11
15
|
if (address == null) {
|
|
12
16
|
return undefined;
|
|
@@ -38,10 +42,12 @@ const toLinePayload = (state, line, transactionType) => {
|
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
44
|
if (transactionType === 'journal_entry') {
|
|
41
|
-
|
|
45
|
+
if (line.postingType != null) {
|
|
46
|
+
lineDetail.posting_type_name = POSTING_TYPE_NAME[line.postingType];
|
|
47
|
+
}
|
|
42
48
|
const vendorQboId = toQboLineVendorId(state, line.vendorQboId);
|
|
43
49
|
if (vendorQboId != null) {
|
|
44
|
-
lineDetail.vendor = {
|
|
50
|
+
lineDetail.vendor = { vendor_id: vendorQboId };
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
return {
|
|
@@ -132,6 +138,10 @@ const prepareCreateTransactionPayload = (state, localData) => {
|
|
|
132
138
|
if (transactionType === 'journal_entry') {
|
|
133
139
|
return {
|
|
134
140
|
...base,
|
|
141
|
+
...(localData.documentNumber != null &&
|
|
142
|
+
localData.documentNumber !== '' && {
|
|
143
|
+
document_id: localData.documentNumber,
|
|
144
|
+
}),
|
|
135
145
|
lines,
|
|
136
146
|
};
|
|
137
147
|
}
|
|
@@ -145,6 +155,8 @@ const prepareCreateTransactionPayload = (state, localData) => {
|
|
|
145
155
|
if (transactionType === 'check') {
|
|
146
156
|
return {
|
|
147
157
|
...purchaseBase,
|
|
158
|
+
// The form has no payment method field for a check; qbo_purchase.py still requires it.
|
|
159
|
+
payment_type: 'check',
|
|
148
160
|
document_number: localData.documentNumber,
|
|
149
161
|
print_status: localData.printStatus,
|
|
150
162
|
remit_to_address: toRemitToAddressPayload(localData.remitToAddress),
|
|
@@ -22,7 +22,10 @@ export interface CreateTransactionView extends SelectorView {
|
|
|
22
22
|
lineAccountListFetchState: FetchState;
|
|
23
23
|
localData: CreateTransactionLocalData;
|
|
24
24
|
paymentAccountListFetchState: FetchState;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Bank, credit card and other current asset accounts for the header payment account; bank
|
|
27
|
+
* accounts only for a check.
|
|
28
|
+
*/
|
|
26
29
|
paymentAccountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
27
30
|
transactionType: CreatableTransactionType;
|
|
28
31
|
/** Populated for transfer only; the COA would offer ineligible accounts. */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCreateTransactionView = exports.getCreateTransactionVendorRecommendations = exports.getCreateTransactionStatus = exports.getCreateTransactionLocalData = void 0;
|
|
4
4
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
5
6
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
6
7
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
7
8
|
const createTransferEntrySelector_1 = require("../../createTransferEntry/createTransferEntrySelector");
|
|
@@ -28,6 +29,23 @@ const getCreateTransactionVendorRecommendations = (state, vendorQboId) => {
|
|
|
28
29
|
};
|
|
29
30
|
};
|
|
30
31
|
exports.getCreateTransactionVendorRecommendations = getCreateTransactionVendorRecommendations;
|
|
32
|
+
/**
|
|
33
|
+
* QBO sub-accounts share their parent's type, so filtering the root nodes keeps whole subtrees.
|
|
34
|
+
*
|
|
35
|
+
* Memoized on its own: createTransactionsState changes on every keystroke, which re-runs the view
|
|
36
|
+
* projection, and the filter would otherwise hand the dropdown a new array each time.
|
|
37
|
+
*/
|
|
38
|
+
const getPaymentAccountListNestedAccountHierarchy = (0, toolkit_1.createSelector)([
|
|
39
|
+
(state) => (0, accountListSelector_1.getNestedAccountListHierarchy)(state.accountListState, 'createTransactionPaymentAccountList'),
|
|
40
|
+
(state) => state.accountState,
|
|
41
|
+
(_state, transactionType) => transactionType,
|
|
42
|
+
], (hierarchy, accountState, transactionType) => {
|
|
43
|
+
if (transactionType !== 'check') {
|
|
44
|
+
return hierarchy;
|
|
45
|
+
}
|
|
46
|
+
return hierarchy.filter((node) => (0, accountSelector_1.getAccountBase)(accountState, node.accountId[0], 'account_list')
|
|
47
|
+
?.accountType === 'bank');
|
|
48
|
+
});
|
|
31
49
|
/**
|
|
32
50
|
* Memoized: app-ui reads this straight from useSelector, and the vendor list and hierarchies are
|
|
33
51
|
* rebuilt on every call, so an unmemoized version re-renders the page on every store action.
|
|
@@ -36,10 +54,11 @@ exports.getCreateTransactionView = (0, toolkit_1.createSelector)([
|
|
|
36
54
|
(state) => state.transactionDetailState.createTransactionsState,
|
|
37
55
|
(state) => state.vendorState.vendorByID,
|
|
38
56
|
(state) => state.accountListState,
|
|
57
|
+
getPaymentAccountListNestedAccountHierarchy,
|
|
39
58
|
(state) => state.classListState,
|
|
40
59
|
(state) => (0, createTransferEntrySelector_1.getResolvedTransferAccounts)(state).transferAccountsList,
|
|
41
60
|
(_state, transactionType) => transactionType,
|
|
42
|
-
], (createTransactionsState, vendorByID, accountListState, classListState, transferAccountsList, transactionType) => ({
|
|
61
|
+
], (createTransactionsState, vendorByID, accountListState, paymentAccountListNestedAccountHierarchy, classListState, transferAccountsList, transactionType) => ({
|
|
43
62
|
transactionType,
|
|
44
63
|
localData: createTransactionsState.newTransactionState[transactionType],
|
|
45
64
|
createStatus: createTransactionsState.createStatus,
|
|
@@ -49,7 +68,7 @@ exports.getCreateTransactionView = (0, toolkit_1.createSelector)([
|
|
|
49
68
|
lineAccountListFetchState: (0, accountListSelector_1.getAccountListFetchState)(accountListState, 'createTransactionLineAccountList'),
|
|
50
69
|
paymentAccountListFetchState: (0, accountListSelector_1.getAccountListFetchState)(accountListState, 'createTransactionPaymentAccountList'),
|
|
51
70
|
accountListNestedAccountHierarchy: (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'createTransactionLineAccountList'),
|
|
52
|
-
paymentAccountListNestedAccountHierarchy
|
|
71
|
+
paymentAccountListNestedAccountHierarchy,
|
|
53
72
|
classListNestedAccountHierarchy: (0, classListSelector_1.getNestedClassListHierarchy)(classListState),
|
|
54
73
|
transferAccountsList: transactionType === 'transfer' ? transferAccountsList : [],
|
|
55
74
|
fetchState: createTransactionsState.createStatus.fetchState,
|
|
@@ -54,7 +54,7 @@ export interface CreateTransactionLocalData {
|
|
|
54
54
|
/** Empty for transfer, which has no lines at all. */
|
|
55
55
|
lines: CreateTransactionLineLocalData[];
|
|
56
56
|
transactionType: CreatableTransactionType;
|
|
57
|
-
/** check / credit_card_credit reference number. */
|
|
57
|
+
/** check / credit_card_credit reference number, or the journal_entry entry name. */
|
|
58
58
|
documentNumber?: string;
|
|
59
59
|
/** transfer */
|
|
60
60
|
fromAccountId?: ID;
|
package/lib/zeniAPI.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface RESTAPIEndpoints {
|
|
|
25
25
|
readonly tenantMicroServiceBaseUrl: string;
|
|
26
26
|
}
|
|
27
27
|
export interface ZeniAPI<ResponseType = FetchResponse> {
|
|
28
|
-
|
|
28
|
+
apiEndPoints: RESTAPIEndpoints;
|
|
29
29
|
readonly sessionId?: string;
|
|
30
30
|
readonly tenantId?: string;
|
|
31
31
|
readonly userId?: string;
|
|
@@ -40,7 +40,7 @@ export interface ZeniAPI<ResponseType = FetchResponse> {
|
|
|
40
40
|
update(userId?: string, sessionId?: string, tenantId?: string): void;
|
|
41
41
|
}
|
|
42
42
|
export declare class ZeniAPIClient implements ZeniAPI {
|
|
43
|
-
|
|
43
|
+
apiEndPoints: RESTAPIEndpoints;
|
|
44
44
|
userId?: string | undefined;
|
|
45
45
|
sessionId?: string | undefined;
|
|
46
46
|
tenantId?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.9",
|
|
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",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
/** Exactly what `task-manager` returns. snake_case, API-nullable. */
|
|
3
|
-
export interface TimeEntryPayload {
|
|
4
|
-
create_time: string;
|
|
5
|
-
entry_date: string;
|
|
6
|
-
minutes: number;
|
|
7
|
-
source: string;
|
|
8
|
-
task_id: ID;
|
|
9
|
-
time_entry_id: ID;
|
|
10
|
-
update_time: string;
|
|
11
|
-
user_id: ID;
|
|
12
|
-
/** Derived from the category server-side (D15/D22) and READ-ONLY. Null when
|
|
13
|
-
* the task has no category, or the category is not yet classified. */
|
|
14
|
-
billing_type?: string | null;
|
|
15
|
-
created_by?: ID | null;
|
|
16
|
-
department?: string | null;
|
|
17
|
-
task_category_id?: ID | null;
|
|
18
|
-
}
|
|
19
|
-
export interface TaskCategoryPayload {
|
|
20
|
-
is_active: boolean;
|
|
21
|
-
name: string;
|
|
22
|
-
task_category_id: ID;
|
|
23
|
-
billing_type?: string | null;
|
|
24
|
-
service?: string | null;
|
|
25
|
-
vertical?: string | null;
|
|
26
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TaskCategoryPayload, TimeEntryPayload } from './timeEntryPayload';
|
|
2
|
-
import { TaskCategory, TimeEntry, TimeEntryState } from './timeEntryState';
|
|
3
|
-
export declare const initialState: TimeEntryState;
|
|
4
|
-
export declare const updateTimeEntries: import("@reduxjs/toolkit").ActionCreatorWithPayload<TimeEntryPayload[], "timeEntry/updateTimeEntries">, removeTimeEntry: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "timeEntry/removeTimeEntry">, updateTaskCategories: import("@reduxjs/toolkit").ActionCreatorWithPayload<TaskCategoryPayload[], "timeEntry/updateTaskCategories">;
|
|
5
|
-
declare const _default: import("redux").Reducer<TimeEntryState>;
|
|
6
|
-
export default _default;
|
|
7
|
-
export declare function mapTimeEntryPayloadToTimeEntry(payload: TimeEntryPayload): TimeEntry;
|
|
8
|
-
export declare function mapTaskCategoryPayloadToTaskCategory(payload: TaskCategoryPayload): TaskCategory;
|