@zeniai/client-epic-state 5.0.36-betaRD13 → 5.0.36-betaRD2
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/recommendationBase.d.ts +1 -1
- package/lib/entity/project/projectPayload.d.ts +0 -7
- package/lib/entity/project/projectPayload.js +1 -15
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +2 -2
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/deleteConnectionEpic.js +29 -0
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +31 -0
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +33 -0
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.d.ts +59 -1
- package/lib/entity/tenant/tenantReducer.js +139 -4
- package/lib/entity/tenant/tenantState.d.ts +7 -0
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +0 -9
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +0 -2
- package/lib/epic.d.ts +3 -2
- package/lib/epic.js +6 -2
- package/lib/esm/entity/project/projectPayload.js +0 -12
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
- package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +25 -0
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +27 -0
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +29 -0
- package/lib/esm/entity/tenant/tenantReducer.js +135 -2
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +0 -9
- package/lib/esm/epic.js +6 -2
- package/lib/esm/index.js +6 -5
- package/lib/esm/reducer.js +3 -3
- package/lib/esm/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +23 -0
- package/lib/esm/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +25 -0
- package/lib/esm/view/featureNotificationView/featureNotificationViewPayload.js +11 -0
- package/lib/esm/view/featureNotificationView/featureNotificationViewReducer.js +106 -0
- package/lib/esm/view/featureNotificationView/featureNotificationViewSelector.js +4 -0
- package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +0 -1
- package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +0 -6
- package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +0 -3
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +2 -14
- package/lib/index.d.ts +7 -5
- package/lib/index.js +45 -35
- package/lib/reducer.d.ts +3 -3
- package/lib/reducer.js +3 -3
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.d.ts +16 -0
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +27 -0
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.d.ts +14 -0
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +29 -0
- package/lib/view/featureNotificationView/featureNotificationViewPayload.d.ts +23 -0
- package/lib/view/featureNotificationView/featureNotificationViewPayload.js +15 -0
- package/lib/view/featureNotificationView/featureNotificationViewReducer.d.ts +19 -0
- package/lib/view/featureNotificationView/featureNotificationViewReducer.js +110 -0
- package/lib/view/featureNotificationView/featureNotificationViewSelector.d.ts +6 -0
- package/lib/view/featureNotificationView/featureNotificationViewSelector.js +11 -0
- package/lib/view/featureNotificationView/featureNotificationViewState.d.ts +26 -0
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +0 -1
- package/lib/view/transactionDetail/epics/transactionDetailEpic.d.ts +1 -2
- package/lib/view/transactionDetail/epics/transactionDetailEpic.js +0 -6
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +0 -3
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +0 -3
- package/lib/view/transactionDetail/transactionDetailSelector.js +1 -13
- package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -2
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -2
- package/package.json +1 -1
- package/lib/esm/view/projectList/fetchProjectListEpic.js +0 -38
- package/lib/esm/view/projectList/projectListReducer.js +0 -39
- package/lib/esm/view/projectList/projectListSelector.js +0 -9
- package/lib/esm/view/projectList/projectListState.js +0 -1
- package/lib/view/projectList/fetchProjectListEpic.d.ts +0 -8
- package/lib/view/projectList/fetchProjectListEpic.js +0 -42
- package/lib/view/projectList/projectListPayload.d.ts +0 -7
- package/lib/view/projectList/projectListReducer.d.ts +0 -9
- package/lib/view/projectList/projectListReducer.js +0 -43
- package/lib/view/projectList/projectListSelector.d.ts +0 -8
- package/lib/view/projectList/projectListSelector.js +0 -13
- package/lib/view/projectList/projectListState.d.ts +0 -4
- package/lib/view/projectList/projectListState.js +0 -2
- /package/lib/esm/view/{projectList/projectListPayload.js → featureNotificationView/featureNotificationViewState.js} +0 -0
- /package/lib/view/{projectList/projectListPayload.js → featureNotificationView/featureNotificationViewState.js} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { fetchRegisteredInterests, fetchRegisteredInterestsFailure, fetchRegisteredInterestsSuccess } from '../featureNotificationViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof fetchRegisteredInterests> | ReturnType<typeof fetchRegisteredInterestsSuccess> | ReturnType<typeof fetchRegisteredInterestsFailure>;
|
|
6
|
+
export declare const fetchRegisteredInterestsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
+
payload: {
|
|
8
|
+
interests: import("../featureNotificationViewState").FeatureInterest[];
|
|
9
|
+
};
|
|
10
|
+
type: "featureNotificationView/fetchRegisteredInterestsSuccess";
|
|
11
|
+
} | {
|
|
12
|
+
payload: {
|
|
13
|
+
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
14
|
+
};
|
|
15
|
+
type: "featureNotificationView/fetchRegisteredInterestsFailure";
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchRegisteredInterestsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const featureNotificationViewPayload_1 = require("../featureNotificationViewPayload");
|
|
8
|
+
const featureNotificationViewReducer_1 = require("../featureNotificationViewReducer");
|
|
9
|
+
const fetchRegisteredInterestsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(featureNotificationViewReducer_1.fetchRegisteredInterests.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
10
|
+
.getJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/feature-interests?feature=${encodeURIComponent(action.payload.feature)}`)
|
|
11
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
13
|
+
const interests = response.data.feature_interests.map(featureNotificationViewPayload_1.toFeatureInterest);
|
|
14
|
+
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.fetchRegisteredInterestsSuccess)(interests)]);
|
|
15
|
+
}
|
|
16
|
+
const status = response.status ??
|
|
17
|
+
(0, responsePayload_1.createZeniAPIStatus)('Failed to fetch registered interests. Please try again.');
|
|
18
|
+
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.fetchRegisteredInterestsFailure)(status)]);
|
|
19
|
+
}), (0, operators_1.catchError)((error) => {
|
|
20
|
+
const message = error instanceof Error
|
|
21
|
+
? error.message
|
|
22
|
+
: 'Unexpected error fetching registered interests.';
|
|
23
|
+
return (0, rxjs_1.from)([
|
|
24
|
+
(0, featureNotificationViewReducer_1.fetchRegisteredInterestsFailure)((0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
25
|
+
]);
|
|
26
|
+
}))));
|
|
27
|
+
exports.fetchRegisteredInterestsEpic = fetchRegisteredInterestsEpic;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { notifyMeForFeature, notifyMeForFeatureFailure, notifyMeForFeatureSuccess } from '../featureNotificationViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof notifyMeForFeature> | ReturnType<typeof notifyMeForFeatureSuccess> | ReturnType<typeof notifyMeForFeatureFailure>;
|
|
6
|
+
export declare const notifyMeForFeatureEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
+
payload: import("../featureNotificationViewPayload").FeatureInterestDataPayload;
|
|
8
|
+
type: "featureNotificationView/notifyMeForFeatureSuccess";
|
|
9
|
+
} | {
|
|
10
|
+
payload: {
|
|
11
|
+
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
type: "featureNotificationView/notifyMeForFeatureFailure";
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notifyMeForFeatureEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
+
const featureNotificationViewReducer_1 = require("../featureNotificationViewReducer");
|
|
8
|
+
const notifyMeForFeatureEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(featureNotificationViewReducer_1.notifyMeForFeature.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
9
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/feature-interests`, {
|
|
10
|
+
additional_info: action.payload.additionalInfo,
|
|
11
|
+
email: action.payload.email,
|
|
12
|
+
feature: action.payload.feature,
|
|
13
|
+
})
|
|
14
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
|
+
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.notifyMeForFeatureSuccess)(response.data)]);
|
|
17
|
+
}
|
|
18
|
+
const status = response.status ??
|
|
19
|
+
(0, responsePayload_1.createZeniAPIStatus)('Failed to register interest. Please try again.');
|
|
20
|
+
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.notifyMeForFeatureFailure)(status)]);
|
|
21
|
+
}), (0, operators_1.catchError)((error) => {
|
|
22
|
+
const message = error instanceof Error
|
|
23
|
+
? error.message
|
|
24
|
+
: 'Unexpected error registering interest.';
|
|
25
|
+
return (0, rxjs_1.from)([
|
|
26
|
+
(0, featureNotificationViewReducer_1.notifyMeForFeatureFailure)((0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
27
|
+
]);
|
|
28
|
+
}))));
|
|
29
|
+
exports.notifyMeForFeatureEpic = notifyMeForFeatureEpic;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ZeniAPIResponse } from '../../responsePayload';
|
|
2
|
+
import { FeatureInterest } from './featureNotificationViewState';
|
|
3
|
+
/**
|
|
4
|
+
* Backend payload shapes for the FeatureInterest API exposed by
|
|
5
|
+
* `@repo:notifications`. snake_case is preserved here verbatim; the
|
|
6
|
+
* `toFeatureInterest` mapper converts to the camelCase state shape.
|
|
7
|
+
*/
|
|
8
|
+
export interface FeatureInterestDataPayload {
|
|
9
|
+
create_time: string;
|
|
10
|
+
feature: string;
|
|
11
|
+
interest_id: string;
|
|
12
|
+
notified: boolean;
|
|
13
|
+
update_time: string;
|
|
14
|
+
additional_info?: string | null;
|
|
15
|
+
email?: string | null;
|
|
16
|
+
notified_time?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface FeatureInterestListPayload {
|
|
19
|
+
feature_interests: FeatureInterestDataPayload[];
|
|
20
|
+
}
|
|
21
|
+
export type FeatureInterestResponse = ZeniAPIResponse<FeatureInterestDataPayload>;
|
|
22
|
+
export type FeatureInterestListResponse = ZeniAPIResponse<FeatureInterestListPayload>;
|
|
23
|
+
export declare const toFeatureInterest: (payload: FeatureInterestDataPayload) => FeatureInterest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toFeatureInterest = void 0;
|
|
4
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
+
const toFeatureInterest = (payload) => ({
|
|
6
|
+
interestId: payload.interest_id,
|
|
7
|
+
feature: payload.feature,
|
|
8
|
+
notified: payload.notified,
|
|
9
|
+
createTime: (0, zeniDayJS_1.date)(payload.create_time),
|
|
10
|
+
updateTime: (0, zeniDayJS_1.date)(payload.update_time),
|
|
11
|
+
additionalInfo: payload.additional_info ?? undefined,
|
|
12
|
+
email: payload.email ?? undefined,
|
|
13
|
+
notifiedTime: payload.notified_time != null ? (0, zeniDayJS_1.date)(payload.notified_time) : undefined,
|
|
14
|
+
});
|
|
15
|
+
exports.toFeatureInterest = toFeatureInterest;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
+
import { FeatureInterestDataPayload } from './featureNotificationViewPayload';
|
|
3
|
+
import { FeatureInterest, FeatureNotificationViewState } from './featureNotificationViewState';
|
|
4
|
+
export declare const initialState: FeatureNotificationViewState;
|
|
5
|
+
export declare const clearFeatureNotificationView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"featureNotificationView/clearFeatureNotificationView">, fetchRegisteredInterests: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[feature: string], {
|
|
6
|
+
feature: string;
|
|
7
|
+
}, "featureNotificationView/fetchRegisteredInterests", never, never>, fetchRegisteredInterestsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
8
|
+
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
9
|
+
}, "featureNotificationView/fetchRegisteredInterestsFailure", never, never>, fetchRegisteredInterestsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[interests: FeatureInterest[]], {
|
|
10
|
+
interests: FeatureInterest[];
|
|
11
|
+
}, "featureNotificationView/fetchRegisteredInterestsSuccess", never, never>, notifyMeForFeature: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[feature: string, additionalInfo: string, email: string], {
|
|
12
|
+
feature: string;
|
|
13
|
+
additionalInfo: string;
|
|
14
|
+
email: string;
|
|
15
|
+
}, "featureNotificationView/notifyMeForFeature", never, never>, notifyMeForFeatureFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
16
|
+
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
17
|
+
}, "featureNotificationView/notifyMeForFeatureFailure", never, never>, notifyMeForFeatureSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: FeatureInterestDataPayload], FeatureInterestDataPayload, "featureNotificationView/notifyMeForFeatureSuccess", never, never>;
|
|
18
|
+
declare const _default: import("redux").Reducer<FeatureNotificationViewState>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.notifyMeForFeatureSuccess = exports.notifyMeForFeatureFailure = exports.notifyMeForFeature = exports.fetchRegisteredInterestsSuccess = exports.fetchRegisteredInterestsFailure = exports.fetchRegisteredInterests = exports.clearFeatureNotificationView = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const featureNotificationViewPayload_1 = require("./featureNotificationViewPayload");
|
|
7
|
+
exports.initialState = {
|
|
8
|
+
fetchRegisteredInterestsState: {
|
|
9
|
+
fetchState: 'Not-Started',
|
|
10
|
+
error: undefined,
|
|
11
|
+
},
|
|
12
|
+
notifyMeForFeatureState: {
|
|
13
|
+
fetchState: 'Not-Started',
|
|
14
|
+
error: undefined,
|
|
15
|
+
},
|
|
16
|
+
registeredInterests: [],
|
|
17
|
+
};
|
|
18
|
+
const featureNotificationView = (0, toolkit_1.createSlice)({
|
|
19
|
+
name: 'featureNotificationView',
|
|
20
|
+
initialState: exports.initialState,
|
|
21
|
+
reducers: {
|
|
22
|
+
notifyMeForFeature: {
|
|
23
|
+
prepare(feature, additionalInfo, email) {
|
|
24
|
+
return { payload: { feature, additionalInfo, email } };
|
|
25
|
+
},
|
|
26
|
+
reducer(draft,
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
|
+
_action) {
|
|
29
|
+
draft.notifyMeForFeatureState = {
|
|
30
|
+
fetchState: 'In-Progress',
|
|
31
|
+
error: undefined,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
notifyMeForFeatureSuccess: {
|
|
36
|
+
prepare(payload) {
|
|
37
|
+
return { payload };
|
|
38
|
+
},
|
|
39
|
+
reducer(draft, action) {
|
|
40
|
+
draft.notifyMeForFeatureState = {
|
|
41
|
+
fetchState: 'Completed',
|
|
42
|
+
error: undefined,
|
|
43
|
+
};
|
|
44
|
+
const interest = (0, featureNotificationViewPayload_1.toFeatureInterest)(action.payload);
|
|
45
|
+
// Idempotent: if a row for this (feature, additional_info) already
|
|
46
|
+
// exists in the slice, replace it; otherwise append.
|
|
47
|
+
const existingIndex = draft.registeredInterests.findIndex((r) => r.feature === interest.feature &&
|
|
48
|
+
r.additionalInfo === interest.additionalInfo);
|
|
49
|
+
if (existingIndex >= 0) {
|
|
50
|
+
draft.registeredInterests[existingIndex] = interest;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
draft.registeredInterests.push(interest);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
notifyMeForFeatureFailure: {
|
|
58
|
+
prepare(status) {
|
|
59
|
+
return { payload: { status } };
|
|
60
|
+
},
|
|
61
|
+
reducer(draft, action) {
|
|
62
|
+
draft.notifyMeForFeatureState = {
|
|
63
|
+
fetchState: 'Error',
|
|
64
|
+
error: action.payload.status,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
fetchRegisteredInterests: {
|
|
69
|
+
prepare(feature) {
|
|
70
|
+
return { payload: { feature } };
|
|
71
|
+
},
|
|
72
|
+
reducer(draft,
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
|
+
_action) {
|
|
75
|
+
draft.fetchRegisteredInterestsState = {
|
|
76
|
+
fetchState: 'In-Progress',
|
|
77
|
+
error: undefined,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
fetchRegisteredInterestsSuccess: {
|
|
82
|
+
prepare(interests) {
|
|
83
|
+
return { payload: { interests } };
|
|
84
|
+
},
|
|
85
|
+
reducer(draft, action) {
|
|
86
|
+
draft.fetchRegisteredInterestsState = {
|
|
87
|
+
fetchState: 'Completed',
|
|
88
|
+
error: undefined,
|
|
89
|
+
};
|
|
90
|
+
draft.registeredInterests = action.payload.interests;
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
fetchRegisteredInterestsFailure: {
|
|
94
|
+
prepare(status) {
|
|
95
|
+
return { payload: { status } };
|
|
96
|
+
},
|
|
97
|
+
reducer(draft, action) {
|
|
98
|
+
draft.fetchRegisteredInterestsState = {
|
|
99
|
+
fetchState: 'Error',
|
|
100
|
+
error: action.payload.status,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
clearFeatureNotificationView(draft) {
|
|
105
|
+
Object.assign(draft, exports.initialState);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
_a = featureNotificationView.actions, exports.clearFeatureNotificationView = _a.clearFeatureNotificationView, exports.fetchRegisteredInterests = _a.fetchRegisteredInterests, exports.fetchRegisteredInterestsFailure = _a.fetchRegisteredInterestsFailure, exports.fetchRegisteredInterestsSuccess = _a.fetchRegisteredInterestsSuccess, exports.notifyMeForFeature = _a.notifyMeForFeature, exports.notifyMeForFeatureFailure = _a.notifyMeForFeatureFailure, exports.notifyMeForFeatureSuccess = _a.notifyMeForFeatureSuccess;
|
|
110
|
+
exports.default = featureNotificationView.reducer;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RootState } from '../../reducer';
|
|
2
|
+
import { FeatureInterest } from './featureNotificationViewState';
|
|
3
|
+
export declare const getFeatureNotificationView: (state: RootState) => import("./featureNotificationViewState").FeatureNotificationViewState;
|
|
4
|
+
export declare const getRegisteredInterests: (state: RootState) => FeatureInterest[];
|
|
5
|
+
export declare const getRegisteredInterestsByFeature: (state: RootState, feature: string) => FeatureInterest[];
|
|
6
|
+
export declare const isFeatureInterestRegistered: (state: RootState, feature: string, additionalInfo: string) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isFeatureInterestRegistered = exports.getRegisteredInterestsByFeature = exports.getRegisteredInterests = exports.getFeatureNotificationView = void 0;
|
|
4
|
+
const getFeatureNotificationView = (state) => state.featureNotificationViewState;
|
|
5
|
+
exports.getFeatureNotificationView = getFeatureNotificationView;
|
|
6
|
+
const getRegisteredInterests = (state) => state.featureNotificationViewState.registeredInterests;
|
|
7
|
+
exports.getRegisteredInterests = getRegisteredInterests;
|
|
8
|
+
const getRegisteredInterestsByFeature = (state, feature) => state.featureNotificationViewState.registeredInterests.filter((interest) => interest.feature === feature);
|
|
9
|
+
exports.getRegisteredInterestsByFeature = getRegisteredInterestsByFeature;
|
|
10
|
+
const isFeatureInterestRegistered = (state, feature, additionalInfo) => state.featureNotificationViewState.registeredInterests.some((interest) => interest.feature === feature && interest.additionalInfo === additionalInfo);
|
|
11
|
+
exports.isFeatureInterestRegistered = isFeatureInterestRegistered;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
+
/**
|
|
4
|
+
* A single user-feature interest record returned by
|
|
5
|
+
* `GET /1.0/feature-interests` and `POST /1.0/feature-interests`.
|
|
6
|
+
*
|
|
7
|
+
* Used by the Integrations page "Notify me" buttons to register that the
|
|
8
|
+
* user wants an email when a not-yet-shipped connector becomes available.
|
|
9
|
+
* Generic enough to drive any future "Notify me" UI by adding a slug to
|
|
10
|
+
* the backend allowlist (FEATURE_INTEREST_ALLOWED_VALUES).
|
|
11
|
+
*/
|
|
12
|
+
export interface FeatureInterest {
|
|
13
|
+
createTime: ZeniDate;
|
|
14
|
+
feature: string;
|
|
15
|
+
interestId: ID;
|
|
16
|
+
notified: boolean;
|
|
17
|
+
updateTime: ZeniDate;
|
|
18
|
+
additionalInfo?: string;
|
|
19
|
+
email?: string;
|
|
20
|
+
notifiedTime?: ZeniDate;
|
|
21
|
+
}
|
|
22
|
+
export interface FeatureNotificationViewState {
|
|
23
|
+
fetchRegisteredInterestsState: FetchStateAndError;
|
|
24
|
+
notifyMeForFeatureState: FetchStateAndError;
|
|
25
|
+
registeredInterests: FeatureInterest[];
|
|
26
|
+
}
|
|
@@ -54,7 +54,6 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
|
|
|
54
54
|
lineDescription: lineItem.lineDescription,
|
|
55
55
|
class: lineItem.class,
|
|
56
56
|
account: lineItem.account,
|
|
57
|
-
project: lineItem.project,
|
|
58
57
|
recommendation: (0, transactionHelper_1.convertCOTRecommendationsToRegular)(lineItem.recommendationsWithCOT),
|
|
59
58
|
};
|
|
60
59
|
if (line.type === 'journal_entry_transaction_line' ||
|
|
@@ -8,8 +8,7 @@ import { fetchAccountList } from '../../accountList/accountListReducer';
|
|
|
8
8
|
import { fetchClassList } from '../../classList/classListReducer';
|
|
9
9
|
import { updateTransactionVendorLocalData } from '../../commonVendorView/transactionVendorView/transactionVendorViewReducer';
|
|
10
10
|
import { fetchOwnerList } from '../../ownerList/ownerListReducer';
|
|
11
|
-
import { fetchProjectList } from '../../projectList/projectListReducer';
|
|
12
11
|
import { updateSortUiState } from '../../vendorList/vendorListReducer';
|
|
13
12
|
import { fetchTransactionDetail, initializeTransactionDetailLocalData, removeTransactionDetail, updateTransactionDetailFetchState } from '../transactionDetailReducer';
|
|
14
|
-
export type ActionType = ReturnType<typeof fetchTransactionDetail> | ReturnType<typeof updateTransaction> | ReturnType<typeof updateTransactionDetailFetchState> | ReturnType<typeof initializeTransactionDetailLocalData> | ReturnType<typeof removeTransaction> | ReturnType<typeof removeTransactionDetail> | ReturnType<typeof fetchClassList> | ReturnType<typeof
|
|
13
|
+
export type ActionType = ReturnType<typeof fetchTransactionDetail> | ReturnType<typeof updateTransaction> | ReturnType<typeof updateTransactionDetailFetchState> | ReturnType<typeof initializeTransactionDetailLocalData> | ReturnType<typeof removeTransaction> | ReturnType<typeof removeTransactionDetail> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchAccountList> | ReturnType<typeof updateSortUiState> | ReturnType<typeof updateVendors> | ReturnType<typeof updateTransactionVendorLocalData> | ReturnType<typeof fetchOwnerList>;
|
|
15
14
|
export declare const fetchTransactionDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -20,7 +20,6 @@ const classListReducer_1 = require("../../classList/classListReducer");
|
|
|
20
20
|
const transactionVendorLocalDataHelper_1 = require("../../commonVendorView/transactionVendorView/transactionVendorLocalDataHelper");
|
|
21
21
|
const transactionVendorViewReducer_1 = require("../../commonVendorView/transactionVendorView/transactionVendorViewReducer");
|
|
22
22
|
const ownerListReducer_1 = require("../../ownerList/ownerListReducer");
|
|
23
|
-
const projectListReducer_1 = require("../../projectList/projectListReducer");
|
|
24
23
|
const transactionDetailReducer_1 = require("../transactionDetailReducer");
|
|
25
24
|
const transactionDetailState_1 = require("../transactionDetailState");
|
|
26
25
|
const fetchTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionDetailReducer_1.fetchTransactionDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
@@ -46,11 +45,6 @@ const fetchTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
46
45
|
classList.fetchState !== 'In-Progress') {
|
|
47
46
|
transactionActions.push((0, classListReducer_1.fetchClassList)());
|
|
48
47
|
}
|
|
49
|
-
const projectList = state$.value.projectListState;
|
|
50
|
-
if (projectList.hasValidState() === false &&
|
|
51
|
-
projectList.fetchState !== 'In-Progress') {
|
|
52
|
-
transactionActions.push((0, projectListReducer_1.fetchProjectList)());
|
|
53
|
-
}
|
|
54
48
|
transactionActions.push((0, transactionDetailReducer_1.updateTransactionDetailFetchState)(transactionId, 'In-Progress'));
|
|
55
49
|
const query = { transaction_type: transactionId.type };
|
|
56
50
|
const getTransactionDetail$ = zeniAPI
|
|
@@ -188,9 +188,6 @@ const toTransactionUpdatePayload = (updates, detail, cotTransactionTracking, ven
|
|
|
188
188
|
if (lineUpdates.account != null) {
|
|
189
189
|
lineTobeUpdated.account = lineUpdates.account;
|
|
190
190
|
}
|
|
191
|
-
if (lineUpdates.project != null) {
|
|
192
|
-
lineTobeUpdated.project = lineUpdates.project;
|
|
193
|
-
}
|
|
194
191
|
if (lineUpdates.customer != null) {
|
|
195
192
|
lineTobeUpdated.customer = lineUpdates.customer;
|
|
196
193
|
}
|
|
@@ -9,7 +9,6 @@ import { RootState } from '../../reducer';
|
|
|
9
9
|
import { ZeniDate } from '../../zeniDayJS';
|
|
10
10
|
import { AccountListSelectorView } from '../accountList/accountListSelector';
|
|
11
11
|
import { ClassListSelectorView } from '../classList/classListSelector';
|
|
12
|
-
import { ProjectListSelectorView } from '../projectList/projectListSelector';
|
|
13
12
|
import { TransactionDetailLocalData } from './transactionDetailTypes';
|
|
14
13
|
export interface TransactionDetailReport extends SelectorView {
|
|
15
14
|
accountList: AccountListSelectorView;
|
|
@@ -19,9 +18,7 @@ export interface TransactionDetailReport extends SelectorView {
|
|
|
19
18
|
classList: ClassListSelectorView;
|
|
20
19
|
deleteStatusByAttachmentName: Record<string, FetchStateAndError>;
|
|
21
20
|
isAccountingClassesEnabled: boolean;
|
|
22
|
-
isAccountingProjectsEnabled: boolean;
|
|
23
21
|
linkedTransactions: SupportedTransactionWithCOT[];
|
|
24
|
-
projectList: ProjectListSelectorView;
|
|
25
22
|
transactionDetailLocalData: TransactionDetailLocalData;
|
|
26
23
|
transactionDetailUpdateStatus: FetchStateAndError;
|
|
27
24
|
isUpdateNotAllowed?: boolean;
|
|
@@ -15,10 +15,9 @@ const vendorSelector_1 = require("../../entity/vendor/vendorSelector");
|
|
|
15
15
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
16
16
|
const accountListSelector_1 = require("../accountList/accountListSelector");
|
|
17
17
|
const classListSelector_1 = require("../classList/classListSelector");
|
|
18
|
-
const projectListSelector_1 = require("../projectList/projectListSelector");
|
|
19
18
|
const transactionDetailState_1 = require("./transactionDetailState");
|
|
20
19
|
const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = true) => {
|
|
21
|
-
const { transactionDetailState, transactionState, vendorState, vendorListState, accountState, classState, classListState, accountListState,
|
|
20
|
+
const { transactionDetailState, transactionState, vendorState, vendorListState, accountState, classState, classListState, accountListState, } = state;
|
|
22
21
|
const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
23
22
|
const transactionDetail = (0, get_1.default)(transactionDetailState.transactionDetailById, detailKey);
|
|
24
23
|
let fetchState = {
|
|
@@ -64,15 +63,6 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
64
63
|
const classList = isAccountingClassesEnabled
|
|
65
64
|
? (0, classListSelector_1.getClassList)(classState, classListState)
|
|
66
65
|
: { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
|
|
67
|
-
const isAccountingProjectsEnabled = (0, tenantSelector_1.getIsAccountingProjectsEnabled)(state);
|
|
68
|
-
const projectList = isAccountingProjectsEnabled
|
|
69
|
-
? (0, projectListSelector_1.getProjectList)(projectState, projectListState)
|
|
70
|
-
: {
|
|
71
|
-
projects: [],
|
|
72
|
-
fetchState: 'Completed',
|
|
73
|
-
error: undefined,
|
|
74
|
-
version: 0,
|
|
75
|
-
};
|
|
76
66
|
const accountsHierarchyList = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'accountList');
|
|
77
67
|
const classHierarchyList = isAccountingClassesEnabled
|
|
78
68
|
? (0, classListSelector_1.getNestedClassListHierarchy)(classListState)
|
|
@@ -95,8 +85,6 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
95
85
|
accountsHierarchyList,
|
|
96
86
|
classList: classList,
|
|
97
87
|
isAccountingClassesEnabled,
|
|
98
|
-
isAccountingProjectsEnabled,
|
|
99
|
-
projectList,
|
|
100
88
|
isUpdateNotAllowed: transactionDetail?.isUpdateNotAllowed,
|
|
101
89
|
transactionDetailLocalData: transactionDetail?.transactionDetailLocalData ??
|
|
102
90
|
transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
|
|
@@ -4,7 +4,6 @@ import { AccountBase } from '../../entity/account/accountState';
|
|
|
4
4
|
import { ClassBase } from '../../entity/class/classState';
|
|
5
5
|
import { CustomerBase } from '../../entity/customer/customerState';
|
|
6
6
|
import { EntityType } from '../../entity/genericEntity/entity';
|
|
7
|
-
import { Project } from '../../entity/project/projectState';
|
|
8
7
|
import { Transaction, TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
9
8
|
import { VendorBase } from '../../entity/vendor/vendorState';
|
|
10
9
|
import { EntityRecommendationKey } from '../recommendation/recommendationState';
|
|
@@ -53,7 +52,6 @@ export interface TransactionLineUpdates {
|
|
|
53
52
|
class?: ClassBase;
|
|
54
53
|
customer?: CustomerBase;
|
|
55
54
|
lineDescription?: string;
|
|
56
|
-
project?: Project;
|
|
57
55
|
recommendation?: Recommendation[];
|
|
58
56
|
vendor?: VendorBase;
|
|
59
57
|
}
|
|
@@ -4,7 +4,6 @@ import { AccountBase, RecommendedAccountBase } from '../../entity/account/accoun
|
|
|
4
4
|
import { ClassBase, RecommendedClassBase } from '../../entity/class/classState';
|
|
5
5
|
import { CustomerBase } from '../../entity/customer/customerState';
|
|
6
6
|
import { Entity } from '../../entity/genericEntity/entity';
|
|
7
|
-
import { Project } from '../../entity/project/projectState';
|
|
8
7
|
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
9
8
|
import { BillableStatus, PlatformLineDetailType, ProductOrService, TransactionLineBase } from '../../entity/transaction/stateTypes/transactionLine';
|
|
10
9
|
import { TransactionCategory, TransactionType } from '../../entity/transaction/stateTypes/transactionType';
|
|
@@ -30,7 +29,6 @@ export interface TransactionDetailLineItemData extends TransactionLineBase {
|
|
|
30
29
|
linkedTransactions?: TransactionID[];
|
|
31
30
|
postingType?: TransactionCategory;
|
|
32
31
|
postingTypeName?: string;
|
|
33
|
-
project?: Project;
|
|
34
32
|
recommendationsWithCOT?: RecommendationWithCOT[];
|
|
35
33
|
recommendedAccount?: RecommendedAccountBase;
|
|
36
34
|
recommendedClass?: RecommendedClassBase;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.36-
|
|
3
|
+
"version": "5.0.36-betaRD2",
|
|
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,38 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap, withLatestFrom, } from 'rxjs/operators';
|
|
3
|
-
import { updateProjects } from '../../entity/project/projectReducer';
|
|
4
|
-
import { getIsAccountingProjectsEnabled } from '../../entity/tenant/tenantSelector';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
|
|
6
|
-
import { fetchProjectList, updateProjectList, updateProjectListFailure, } from './projectListReducer';
|
|
7
|
-
const buildProjectListQuery = (isIncludeDeleted) => {
|
|
8
|
-
const query = {
|
|
9
|
-
is_deleted: isIncludeDeleted,
|
|
10
|
-
sort_by: 'project_name',
|
|
11
|
-
sort_order: 'asc',
|
|
12
|
-
is_full: true,
|
|
13
|
-
};
|
|
14
|
-
return `?query=${encodeURIComponent(JSON.stringify(query))}`;
|
|
15
|
-
};
|
|
16
|
-
export const fetchProjectListEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchProjectList.match), withLatestFrom(state$), switchMap(([action, state]) => {
|
|
17
|
-
if (!getIsAccountingProjectsEnabled(state)) {
|
|
18
|
-
return of(updateProjectList({
|
|
19
|
-
status: createZeniAPIStatus('Success', ''),
|
|
20
|
-
data: { projects: [] },
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
const { isIncludeDeleted } = action.payload;
|
|
24
|
-
const queryParams = buildProjectListQuery(isIncludeDeleted);
|
|
25
|
-
return zeniAPI
|
|
26
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/projects${queryParams}`)
|
|
27
|
-
.pipe(mergeMap((response) => {
|
|
28
|
-
if (isSuccessResponse(response)) {
|
|
29
|
-
return of(updateProjects(response.data?.projects ?? []), updateProjectList(response));
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return of(updateProjectListFailure(response.status));
|
|
33
|
-
}
|
|
34
|
-
}), catchError((error) => {
|
|
35
|
-
return of(updateProjectListFailure(createZeniAPIStatus('Unexpected Error', 'Fetch Projects REST API call errored out' +
|
|
36
|
-
JSON.stringify(error))));
|
|
37
|
-
}));
|
|
38
|
-
}));
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
export const initialState = {
|
|
3
|
-
fetchState: 'Not-Started',
|
|
4
|
-
error: undefined,
|
|
5
|
-
projectIds: [],
|
|
6
|
-
hasValidState() {
|
|
7
|
-
return this.fetchState == 'Completed';
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
const projectList = createSlice({
|
|
11
|
-
name: 'projectList',
|
|
12
|
-
initialState,
|
|
13
|
-
reducers: {
|
|
14
|
-
fetchProjectList: {
|
|
15
|
-
reducer(draft) {
|
|
16
|
-
draft.fetchState = 'In-Progress';
|
|
17
|
-
draft.error = undefined;
|
|
18
|
-
},
|
|
19
|
-
prepare(isIncludeDeleted) {
|
|
20
|
-
return { payload: { isIncludeDeleted: isIncludeDeleted ?? false } };
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
updateProjectList(draft, action) {
|
|
24
|
-
draft.projectIds =
|
|
25
|
-
action.payload.data?.projects.map((project) => project.zeni_project_id) ?? [];
|
|
26
|
-
draft.fetchState = 'Completed';
|
|
27
|
-
draft.error = undefined;
|
|
28
|
-
},
|
|
29
|
-
updateProjectListFailure(draft, action) {
|
|
30
|
-
draft.fetchState = 'Error';
|
|
31
|
-
draft.error = action.payload;
|
|
32
|
-
},
|
|
33
|
-
clearProjectList(draft) {
|
|
34
|
-
Object.assign(draft, initialState);
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
export const { fetchProjectList, updateProjectList, updateProjectListFailure, clearProjectList, } = projectList.actions;
|
|
39
|
-
export default projectList.reducer;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getProjectsByIds } from '../../entity/project/projectSelector';
|
|
2
|
-
export const getProjectList = (projectState, projectListState) => {
|
|
3
|
-
return {
|
|
4
|
-
projects: getProjectsByIds(projectState, projectListState.projectIds),
|
|
5
|
-
fetchState: projectListState.fetchState,
|
|
6
|
-
error: projectListState.error,
|
|
7
|
-
version: 0,
|
|
8
|
-
};
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateProjects } from '../../entity/project/projectReducer';
|
|
4
|
-
import { RootState } from '../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../zeniAPI';
|
|
6
|
-
import { fetchProjectList, updateProjectList, updateProjectListFailure } from './projectListReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchProjectList> | ReturnType<typeof updateProjects> | ReturnType<typeof updateProjectList> | ReturnType<typeof updateProjectListFailure>;
|
|
8
|
-
export declare const fetchProjectListEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchProjectListEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const projectReducer_1 = require("../../entity/project/projectReducer");
|
|
7
|
-
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
8
|
-
const responsePayload_1 = require("../../responsePayload");
|
|
9
|
-
const projectListReducer_1 = require("./projectListReducer");
|
|
10
|
-
const buildProjectListQuery = (isIncludeDeleted) => {
|
|
11
|
-
const query = {
|
|
12
|
-
is_deleted: isIncludeDeleted,
|
|
13
|
-
sort_by: 'project_name',
|
|
14
|
-
sort_order: 'asc',
|
|
15
|
-
is_full: true,
|
|
16
|
-
};
|
|
17
|
-
return `?query=${encodeURIComponent(JSON.stringify(query))}`;
|
|
18
|
-
};
|
|
19
|
-
const fetchProjectListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(projectListReducer_1.fetchProjectList.match), (0, operators_1.withLatestFrom)(state$), (0, operators_1.switchMap)(([action, state]) => {
|
|
20
|
-
if (!(0, tenantSelector_1.getIsAccountingProjectsEnabled)(state)) {
|
|
21
|
-
return (0, rxjs_1.of)((0, projectListReducer_1.updateProjectList)({
|
|
22
|
-
status: (0, responsePayload_1.createZeniAPIStatus)('Success', ''),
|
|
23
|
-
data: { projects: [] },
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
const { isIncludeDeleted } = action.payload;
|
|
27
|
-
const queryParams = buildProjectListQuery(isIncludeDeleted);
|
|
28
|
-
return zeniAPI
|
|
29
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/projects${queryParams}`)
|
|
30
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
31
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
32
|
-
return (0, rxjs_1.of)((0, projectReducer_1.updateProjects)(response.data?.projects ?? []), (0, projectListReducer_1.updateProjectList)(response));
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return (0, rxjs_1.of)((0, projectListReducer_1.updateProjectListFailure)(response.status));
|
|
36
|
-
}
|
|
37
|
-
}), (0, operators_1.catchError)((error) => {
|
|
38
|
-
return (0, rxjs_1.of)((0, projectListReducer_1.updateProjectListFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Projects REST API call errored out' +
|
|
39
|
-
JSON.stringify(error))));
|
|
40
|
-
}));
|
|
41
|
-
}));
|
|
42
|
-
exports.fetchProjectListEpic = fetchProjectListEpic;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ProjectMetadataPayload } from '../../entity/project/projectPayload';
|
|
2
|
-
import { ZeniAPIResponse } from '../../responsePayload';
|
|
3
|
-
interface ProjectListPayloadData {
|
|
4
|
-
projects: ProjectMetadataPayload[];
|
|
5
|
-
}
|
|
6
|
-
export type ProjectListResponse = ZeniAPIResponse<ProjectListPayloadData>;
|
|
7
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
-
import { ProjectListResponse } from './projectListPayload';
|
|
3
|
-
import { ProjectListState } from './projectListState';
|
|
4
|
-
export declare const initialState: ProjectListState;
|
|
5
|
-
export declare const fetchProjectList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[isIncludeDeleted?: boolean | undefined], {
|
|
6
|
-
isIncludeDeleted: boolean;
|
|
7
|
-
}, "projectList/fetchProjectList", never, never>, updateProjectList: import("@reduxjs/toolkit").ActionCreatorWithPayload<ProjectListResponse, "projectList/updateProjectList">, updateProjectListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "projectList/updateProjectListFailure">, clearProjectList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"projectList/clearProjectList">;
|
|
8
|
-
declare const _default: import("redux").Reducer<ProjectListState>;
|
|
9
|
-
export default _default;
|