@zeniai/client-epic-state 4.7.79 → 4.7.80
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/account/accountPayload.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCard.d.ts +1 -0
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +4 -14
- package/lib/entity/chargeCard/chargeCardPayload.js +1 -0
- package/lib/entity/depositAccount/depositAccountPayload.d.ts +2 -5
- package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.js +2 -1
- package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +2 -0
- package/lib/entity/paymentAccount/paymentAccountSelector.js +14 -1
- package/lib/entity/paymentAccount/paymentAccountState.d.ts +1 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
- package/lib/entity/tenant/clearAllEpic.js +4 -0
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +2 -2
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +2 -2
- package/lib/epic.d.ts +9 -10
- package/lib/epic.js +9 -10
- package/lib/index.d.ts +21 -11
- package/lib/index.js +31 -22
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/accountList/fetchAccountListEpic.js +16 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/verifyUserEpic.d.ts +2 -2
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/verifyUserEpic.js +2 -2
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +4 -9
- package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +41 -70
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -9
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +70 -102
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/settingsView/epic/fetchBankAccountsListEpic.d.ts +22 -0
- package/lib/view/settingsView/epic/fetchBankAccountsListEpic.js +30 -0
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.d.ts +6 -0
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.js +14 -0
- package/lib/view/settingsView/epic/fetchMyProfileEpic.d.ts +43 -0
- package/lib/view/settingsView/epic/fetchMyProfileEpic.js +50 -0
- package/lib/view/settingsView/epic/fetchMyProfileViewEpic.d.ts +7 -0
- package/lib/view/settingsView/epic/fetchMyProfileViewEpic.js +17 -0
- package/lib/view/settingsView/settingsViewPayload.d.ts +8 -0
- package/lib/view/settingsView/settingsViewReducer.d.ts +13 -0
- package/lib/view/settingsView/settingsViewReducer.js +71 -0
- package/lib/view/settingsView/settingsViewSelector.d.ts +14 -0
- package/lib/view/settingsView/settingsViewSelector.js +119 -0
- package/lib/view/settingsView/settingsViewState.d.ts +12 -0
- package/lib/view/settingsView/settingsViewState.js +2 -0
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +29 -0
- package/lib/view/settingsView/types/settingsViewSelectorTypes.js +2 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +3 -1
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +24 -4
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +2 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +4 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +4 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +25 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +3 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +6 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardDetailEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardDetailEpic.js +60 -0
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -9
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -104
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +90 -0
- package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/sendOtpEpic.js +93 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +16 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +2 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +19 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +11 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +21 -0
- package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +101 -0
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +10 -0
- package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +90 -0
- package/package.json +1 -1
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.js +0 -24
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewSendOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewSendOtpEpic.js +0 -26
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.d.ts +0 -7
- package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.js +0 -28
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/resendOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/resendOnboardingOfficerOtpEpic.js +0 -24
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/sendOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/sendOnboardingOfficerOtpEpic.js +0 -27
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/verifyOnboardingOfficerOtpEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/verifyOnboardingOfficerOtpEpic.js +0 -30
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/resendOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/resendOtpEpic.js +0 -23
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/sendOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/sendOtpEpic.js +0 -26
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/verifyOtpEpic.d.ts +0 -7
- package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/verifyOtpEpic.js +0 -27
- package/lib/view/spendManagement/commonSetup/types/twoFactorAuthentication.d.ts +0 -10
- /package/lib/view/{spendManagement/commonSetup/types/twoFactorAuthentication.js → settingsView/settingsViewPayload.js} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getManagerUserIdFromUserRolesPayloadByUserId = exports.getUserPayloadByUserId = exports.fetchMyProfileEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
+
const userRoleReducer_1 = require("../../../entity/userRole/userRoleReducer");
|
|
9
|
+
const userReducer_1 = require("../../../entity/user/userReducer");
|
|
10
|
+
const userListViewReducer_1 = require("../../userListView/userListViewReducer");
|
|
11
|
+
const fetchMyProfileEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchMyProfile.match), (0, operators_1.switchMap)(() => {
|
|
12
|
+
const URL = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/settings/user-profile`;
|
|
13
|
+
const loggedInUser = state$.value.tenantState.loggedInUser;
|
|
14
|
+
return zeniAPI.getJSON(URL).pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
16
|
+
response.data != null &&
|
|
17
|
+
(loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.userId) != null) {
|
|
18
|
+
const loggedInUserPayload = getUserPayloadByUserId(loggedInUser.userId, response.data.users);
|
|
19
|
+
const managerUserPayload = getUserPayloadByUserId(getManagerUserIdFromUserRolesPayloadByUserId(loggedInUser.userId, response.data.user_roles), response.data.users);
|
|
20
|
+
const updateActions = [];
|
|
21
|
+
updateActions.push((0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, settingsViewReducer_1.updateMyProfileOnSuccess)(loggedInUser.userId));
|
|
22
|
+
if (managerUserPayload && loggedInUserPayload != null) {
|
|
23
|
+
updateActions.push((0, userListViewReducer_1.updateUserIds)({
|
|
24
|
+
userType: 'manager',
|
|
25
|
+
usersPayload: managerUserPayload,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
return (0, rxjs_1.of)(...updateActions);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return (0, rxjs_1.of)((0, settingsViewReducer_1.updateMyProfileOnFailure)(response.status));
|
|
32
|
+
}
|
|
33
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateMyProfileOnFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Fetch My Profile REST API call errored out' +
|
|
34
|
+
JSON.stringify(error))))));
|
|
35
|
+
}));
|
|
36
|
+
exports.fetchMyProfileEpic = fetchMyProfileEpic;
|
|
37
|
+
/**
|
|
38
|
+
* Helpers
|
|
39
|
+
*/
|
|
40
|
+
function getUserPayloadByUserId(userId, usersPayload) {
|
|
41
|
+
const user = usersPayload.find((user) => user.user_id === userId);
|
|
42
|
+
return user ? [user] : undefined;
|
|
43
|
+
}
|
|
44
|
+
exports.getUserPayloadByUserId = getUserPayloadByUserId;
|
|
45
|
+
function getManagerUserIdFromUserRolesPayloadByUserId(userId, userRolesPayload) {
|
|
46
|
+
const userRoles = userRolesPayload.find((user) => user.user_id === userId);
|
|
47
|
+
const manager_user_id = userRoles === null || userRoles === void 0 ? void 0 : userRoles.manager_user_id;
|
|
48
|
+
return manager_user_id !== null && manager_user_id !== void 0 ? manager_user_id : undefined;
|
|
49
|
+
}
|
|
50
|
+
exports.getManagerUserIdFromUserRolesPayloadByUserId = getManagerUserIdFromUserRolesPayloadByUserId;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { fetchMyProfile } from '../settingsViewReducer';
|
|
4
|
+
import { fetchCompanyPassportView } from '../../companyView/companyViewReducer';
|
|
5
|
+
import { fetchClassList } from '../../classList/classListReducer';
|
|
6
|
+
export declare type ActionType = ReturnType<typeof fetchCompanyPassportView> | ReturnType<typeof fetchMyProfile> | ReturnType<typeof fetchClassList>;
|
|
7
|
+
export declare const fetchMyProfileViewEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchMyProfileViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
7
|
+
const companyViewReducer_1 = require("../../companyView/companyViewReducer");
|
|
8
|
+
const classListReducer_1 = require("../../classList/classListReducer");
|
|
9
|
+
const fetchMyProfileViewEpic = (actions$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchMyProfileView.match), (0, operators_1.switchMap)((action) => {
|
|
10
|
+
const { companyId } = action.payload;
|
|
11
|
+
return (0, rxjs_1.from)([
|
|
12
|
+
(0, companyViewReducer_1.fetchCompanyPassportView)(companyId),
|
|
13
|
+
(0, classListReducer_1.fetchClassList)(),
|
|
14
|
+
(0, settingsViewReducer_1.fetchMyProfile)(),
|
|
15
|
+
]);
|
|
16
|
+
}));
|
|
17
|
+
exports.fetchMyProfileViewEpic = fetchMyProfileViewEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UserPayload } from '../../entity/user/userPayload';
|
|
2
|
+
import { UserRolePayload } from '../../entity/userRole/userRolePayload';
|
|
3
|
+
import { ZeniAPIResponse } from '../../responsePayload';
|
|
4
|
+
export interface MyProfilePeoplePayload {
|
|
5
|
+
user_roles: UserRolePayload[];
|
|
6
|
+
users: UserPayload[];
|
|
7
|
+
}
|
|
8
|
+
export declare type MyProfilePeopleResponse = ZeniAPIResponse<MyProfilePeoplePayload>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
2
|
+
import { SettingsViewState } from './settingsViewState';
|
|
3
|
+
import { ID } from '../../commonStateTypes/common';
|
|
4
|
+
export declare const initialState: SettingsViewState;
|
|
5
|
+
export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
|
|
6
|
+
companyId: string;
|
|
7
|
+
}, string, never, never>, fetchMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateMyProfileOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string], {
|
|
8
|
+
userId: string;
|
|
9
|
+
}, string, never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankConnectionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateBankConnectionOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
10
|
+
bankAccountIds: ID[];
|
|
11
|
+
}, string>, updateBankConnectionOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankAccountsList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearSettingsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
12
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<SettingsViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearSettingsView = exports.fetchBankAccountsList = exports.updateBankConnectionOnFailure = exports.updateBankConnectionOnSuccess = exports.fetchBankConnectionsView = exports.updateMyProfileOnFailure = exports.updateMyProfileOnSuccess = exports.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialState = {
|
|
7
|
+
profile: {
|
|
8
|
+
fetchState: 'Not-Started',
|
|
9
|
+
error: undefined,
|
|
10
|
+
userId: null,
|
|
11
|
+
},
|
|
12
|
+
bankConnection: {
|
|
13
|
+
fetchState: 'Not-Started',
|
|
14
|
+
error: undefined,
|
|
15
|
+
bankAccountIds: [],
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const settings = (0, toolkit_1.createSlice)({
|
|
19
|
+
name: 'settings',
|
|
20
|
+
initialState: exports.initialState,
|
|
21
|
+
reducers: {
|
|
22
|
+
fetchMyProfileView: {
|
|
23
|
+
reducer() {
|
|
24
|
+
// Do nothing.
|
|
25
|
+
},
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
27
|
+
prepare(companyId) {
|
|
28
|
+
return { payload: { companyId } };
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
fetchMyProfile(draft) {
|
|
32
|
+
draft.profile.fetchState = 'In-Progress';
|
|
33
|
+
draft.profile.error = undefined;
|
|
34
|
+
},
|
|
35
|
+
updateMyProfileOnSuccess: {
|
|
36
|
+
prepare(userId) {
|
|
37
|
+
return { payload: { userId } };
|
|
38
|
+
},
|
|
39
|
+
reducer(draft, action) {
|
|
40
|
+
draft.profile.fetchState = 'Completed';
|
|
41
|
+
draft.profile.error = undefined;
|
|
42
|
+
draft.profile.userId = action.payload.userId;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
updateMyProfileOnFailure(draft, action) {
|
|
46
|
+
draft.profile.fetchState = 'Error';
|
|
47
|
+
draft.profile.error = action.payload;
|
|
48
|
+
},
|
|
49
|
+
fetchBankConnectionsView() {
|
|
50
|
+
// Do nothing.
|
|
51
|
+
},
|
|
52
|
+
fetchBankAccountsList(draft) {
|
|
53
|
+
draft.bankConnection.fetchState = 'In-Progress';
|
|
54
|
+
draft.bankConnection.error = undefined;
|
|
55
|
+
},
|
|
56
|
+
updateBankConnectionOnSuccess(draft, action) {
|
|
57
|
+
draft.bankConnection.fetchState = 'Completed';
|
|
58
|
+
draft.bankConnection.error = undefined;
|
|
59
|
+
draft.bankConnection.bankAccountIds = action.payload.bankAccountIds;
|
|
60
|
+
},
|
|
61
|
+
updateBankConnectionOnFailure(draft, action) {
|
|
62
|
+
draft.bankConnection.fetchState = 'Error';
|
|
63
|
+
draft.bankConnection.error = action.payload;
|
|
64
|
+
},
|
|
65
|
+
clearSettingsView(draft) {
|
|
66
|
+
Object.assign(draft, exports.initialState);
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
_a = settings.actions, exports.fetchMyProfileView = _a.fetchMyProfileView, exports.fetchMyProfile = _a.fetchMyProfile, exports.updateMyProfileOnSuccess = _a.updateMyProfileOnSuccess, exports.updateMyProfileOnFailure = _a.updateMyProfileOnFailure, exports.fetchBankConnectionsView = _a.fetchBankConnectionsView, exports.updateBankConnectionOnSuccess = _a.updateBankConnectionOnSuccess, exports.updateBankConnectionOnFailure = _a.updateBankConnectionOnFailure, exports.fetchBankAccountsList = _a.fetchBankAccountsList, exports.clearSettingsView = _a.clearSettingsView;
|
|
71
|
+
exports.default = settings.reducer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RootState } from '../../reducer';
|
|
2
|
+
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
3
|
+
import { TenantExternalConnections } from '../../entity/tenant/tenantState';
|
|
4
|
+
import { Company } from '../../entity/company/companyStateTypes';
|
|
5
|
+
import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView } from './types/settingsViewSelectorTypes';
|
|
6
|
+
export declare function getApprovalRuleViewDetails(state: RootState): FetchStateAndError;
|
|
7
|
+
export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID): BankConnectionsSetupView;
|
|
8
|
+
export declare function getMyBankConnectionsDetails(state: RootState, userId: ID): MyBankConnectionsView;
|
|
9
|
+
export interface IntegrationsView {
|
|
10
|
+
externalConnections: TenantExternalConnections | undefined;
|
|
11
|
+
companyView: Company | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare function getIntegrationsView(state: RootState, companyId: ID): IntegrationsView;
|
|
14
|
+
export declare const getMyProfileView: (state: RootState) => MyProfileSelectorView;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMyProfileView = exports.getIntegrationsView = exports.getMyBankConnectionsDetails = exports.getBankConnectionsSetupViewDetails = exports.getApprovalRuleViewDetails = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
6
|
+
const companySelector_1 = require("../../entity/company/companySelector");
|
|
7
|
+
const userRoleSelector_1 = require("../../entity/userRole/userRoleSelector");
|
|
8
|
+
const userSelector_1 = require("../../entity/user/userSelector");
|
|
9
|
+
const accountSelector_1 = require("../../entity/account/accountSelector");
|
|
10
|
+
const paymentAccountSelector_1 = require("../../entity/paymentAccount/paymentAccountSelector");
|
|
11
|
+
const classSelector_1 = require("../../entity/class/classSelector");
|
|
12
|
+
const classSelectorV2_1 = require("../../entity/class/classSelectorV2");
|
|
13
|
+
const userListViewSelector_1 = require("../userListView/userListViewSelector");
|
|
14
|
+
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
15
|
+
const companyPassportViewSelector_1 = require("../companyView/selector/companyPassportViewSelector");
|
|
16
|
+
const userFinancialAccountSelector_1 = require("../userFinancialAccount/userFinancialAccountSelector");
|
|
17
|
+
const setupViewSelector_1 = require("../../view/spendManagement/commonSetup/setupViewSelector");
|
|
18
|
+
function getApprovalRuleViewDetails(state) {
|
|
19
|
+
const { billPaySetupApproverViewState, remiSetupApproverViewState } = state;
|
|
20
|
+
const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
21
|
+
billPaySetupApproverViewState,
|
|
22
|
+
remiSetupApproverViewState,
|
|
23
|
+
]);
|
|
24
|
+
return {
|
|
25
|
+
fetchState: fetchState.fetchState,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.getApprovalRuleViewDetails = getApprovalRuleViewDetails;
|
|
29
|
+
function getBankConnectionsSetupViewDetails(state, companyId) {
|
|
30
|
+
const { accountState, setupViewState, settingsViewState } = state;
|
|
31
|
+
const { bankConnection } = settingsViewState;
|
|
32
|
+
const allBankAccounts = bankConnection.bankAccountIds
|
|
33
|
+
.map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, 'bill_pay'))
|
|
34
|
+
.filter((account) => account != null);
|
|
35
|
+
const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
36
|
+
settingsViewState.bankConnection,
|
|
37
|
+
setupViewState.accountDetails.fetchStatus,
|
|
38
|
+
]);
|
|
39
|
+
return {
|
|
40
|
+
setupView: Object.assign(Object.assign({}, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay')), { allBankAccounts }),
|
|
41
|
+
fetchState: fetchState.fetchState,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
exports.getBankConnectionsSetupViewDetails = getBankConnectionsSetupViewDetails;
|
|
45
|
+
function getMyBankConnectionsDetails(state, userId) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
const userFinancialAccount = (0, userFinancialAccountSelector_1.getUserFinancialAccount)(state, userId);
|
|
48
|
+
const paymentAccounts = (0, paymentAccountSelector_1.getPaymentAccountsByBankAccountIds)(state.paymentAccountState, (_b = (_a = state.userFinancialAccountState.financialAccountByUserId[userId]) === null || _a === void 0 ? void 0 : _a.bankAccountIds) !== null && _b !== void 0 ? _b : []);
|
|
49
|
+
return Object.assign(Object.assign({}, userFinancialAccount), { paymentAccounts });
|
|
50
|
+
}
|
|
51
|
+
exports.getMyBankConnectionsDetails = getMyBankConnectionsDetails;
|
|
52
|
+
function getIntegrationsView(state, companyId) {
|
|
53
|
+
var _a;
|
|
54
|
+
const externalConnections = (0, tenantSelector_1.getCurrentTenantExternalConnections)(state.tenantState, state.companyState);
|
|
55
|
+
const companyView = (_a = (0, companySelector_1.getCompanyByCompanyId)(state.companyState, companyId)) === null || _a === void 0 ? void 0 : _a.company;
|
|
56
|
+
return {
|
|
57
|
+
externalConnections,
|
|
58
|
+
companyView,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.getIntegrationsView = getIntegrationsView;
|
|
62
|
+
exports.getMyProfileView = (0, toolkit_1.createSelector)((state) => state.tenantState, (state) => state.userState, (state) => state.userRoleState, (state) => state.settingsViewState, (state) => state.classState, (state) => state.classListState, (state) => (0, companyPassportViewSelector_1.getCompanyPassportView)(state), (state) => (0, userListViewSelector_1.getUserList)(state, 'manager'), (tenantState, userState, userRoleState, settingsViewState, classState, classListState, companyPassportView, managersListView) => {
|
|
63
|
+
var _a, _b, _c, _d;
|
|
64
|
+
const userId = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId;
|
|
65
|
+
if (userId == null) {
|
|
66
|
+
throw new Error(`User not logged in`);
|
|
67
|
+
}
|
|
68
|
+
const user = (0, userSelector_1.getUserByUserId)(userState, userId);
|
|
69
|
+
const userRole = (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, userId);
|
|
70
|
+
const person = {
|
|
71
|
+
userId,
|
|
72
|
+
user,
|
|
73
|
+
userRole,
|
|
74
|
+
};
|
|
75
|
+
const isZeniUser = (_b = userRole === null || userRole === void 0 ? void 0 : userRole.isZeni) !== null && _b !== void 0 ? _b : true;
|
|
76
|
+
const departmentIds = (_c = userRole === null || userRole === void 0 ? void 0 : userRole.accountingClassIDs) !== null && _c !== void 0 ? _c : [];
|
|
77
|
+
const classList = (0, classSelectorV2_1.getClassesByIds)(classState, {
|
|
78
|
+
classIds: classListState.classIds,
|
|
79
|
+
reportId: 'class_list',
|
|
80
|
+
});
|
|
81
|
+
const department = departmentIds.length > 0
|
|
82
|
+
? (0, classSelector_1.getClassById)(classState, {
|
|
83
|
+
classId: departmentIds[0],
|
|
84
|
+
reportId: 'class_list',
|
|
85
|
+
})
|
|
86
|
+
: undefined;
|
|
87
|
+
const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
88
|
+
settingsViewState.profile,
|
|
89
|
+
companyPassportView,
|
|
90
|
+
classListState,
|
|
91
|
+
]);
|
|
92
|
+
const controllersList = ((_d = companyPassportView.companyView) === null || _d === void 0 ? void 0 : _d.controllers) != null
|
|
93
|
+
? companyPassportView.companyView.controllers.map((controller) => controller.user)
|
|
94
|
+
: [];
|
|
95
|
+
const myProfilePeopleView = {
|
|
96
|
+
fetchState: fetchState.fetchState,
|
|
97
|
+
error: fetchState.error,
|
|
98
|
+
isZeniUser,
|
|
99
|
+
person,
|
|
100
|
+
department,
|
|
101
|
+
classList,
|
|
102
|
+
controllersList,
|
|
103
|
+
managersList: managersListView.users,
|
|
104
|
+
};
|
|
105
|
+
const managerId = userRole === null || userRole === void 0 ? void 0 : userRole.managerUserId;
|
|
106
|
+
if (managerId != null) {
|
|
107
|
+
const managerUser = (0, userSelector_1.getUserByUserId)(userState, managerId);
|
|
108
|
+
const managerUserRole = (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, managerId);
|
|
109
|
+
if (managerUser != null) {
|
|
110
|
+
const manager = {
|
|
111
|
+
userId: managerId,
|
|
112
|
+
user: managerUser,
|
|
113
|
+
userRole: managerUserRole,
|
|
114
|
+
};
|
|
115
|
+
return Object.assign(Object.assign({}, myProfilePeopleView), { manager });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return myProfilePeopleView;
|
|
119
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ID, FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
|
+
interface MyProfile extends FetchStateAndError {
|
|
3
|
+
userId: ID | null;
|
|
4
|
+
}
|
|
5
|
+
interface BankConnection extends FetchStateAndError {
|
|
6
|
+
bankAccountIds: ID[];
|
|
7
|
+
}
|
|
8
|
+
export interface SettingsViewState {
|
|
9
|
+
profile: MyProfile;
|
|
10
|
+
bankConnection: BankConnection;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ID, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
+
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
+
import { Class } from '../../../entity/class/classState';
|
|
4
|
+
import { PaymentAccount } from '../../../entity/paymentAccount/paymentAccountState';
|
|
5
|
+
import { User } from '../../../entity/user/userState';
|
|
6
|
+
import { UserRole } from '../../../entity/userRole/userRoleState';
|
|
7
|
+
import { Person } from '../../people/peopleSelectorTypes';
|
|
8
|
+
import { SetupView } from '../../spendManagement/commonSetup/setupViewSelector';
|
|
9
|
+
import { UserFinancialAccountSelectorView } from '../../userFinancialAccount/userFinancialAccountSelector';
|
|
10
|
+
export interface MyProfileSelectorView extends SelectorView {
|
|
11
|
+
isZeniUser: boolean;
|
|
12
|
+
person: MyProfile;
|
|
13
|
+
classList: Class[];
|
|
14
|
+
managersList: Person[];
|
|
15
|
+
controllersList: User[];
|
|
16
|
+
manager?: MyProfile;
|
|
17
|
+
department?: Class;
|
|
18
|
+
}
|
|
19
|
+
export interface MyProfile {
|
|
20
|
+
userId: ID;
|
|
21
|
+
user: User | undefined;
|
|
22
|
+
userRole: UserRole | undefined;
|
|
23
|
+
}
|
|
24
|
+
export interface MyBankConnectionsView extends UserFinancialAccountSelectorView {
|
|
25
|
+
paymentAccounts: PaymentAccount[];
|
|
26
|
+
}
|
|
27
|
+
export interface BankConnectionsSetupView extends FetchStateAndError {
|
|
28
|
+
setupView: SetupView;
|
|
29
|
+
}
|
|
@@ -3,7 +3,8 @@ import { ZeniAPI } from '../../../../../zeniAPI';
|
|
|
3
3
|
import { RootState } from '../../../../../reducer';
|
|
4
4
|
import { saveBillDetail, saveBillSuccessOrFailure } from '../editBillViewReducer';
|
|
5
5
|
import { updateBillTransaction } from '../../../../../entity/billPay/billTransaction/billTransactionReducer';
|
|
6
|
-
import { RecurringBillInstance } from '../editBillViewState';
|
|
6
|
+
import { EditBillDetail, RecurringBillInstance } from '../editBillViewState';
|
|
7
|
+
import { BillTransaction } from '../../../../../entity/billPay/billTransaction/billTransactionState';
|
|
7
8
|
import { updateRecurringBillConfigs, updateRecurringBills } from '../../../../../entity/billPay/recurringBills/recurringBillsReducer';
|
|
8
9
|
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
9
10
|
export declare type ActionType = ReturnType<typeof saveBillDetail> | ReturnType<typeof updateBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveBillSuccessOrFailure> | ReturnType<typeof updateRecurringBillConfigs> | ReturnType<typeof updateRecurringBills>;
|
|
@@ -15,3 +16,4 @@ export interface RecurringBillInstancePayload {
|
|
|
15
16
|
vendor_receive_date_notes: string;
|
|
16
17
|
}
|
|
17
18
|
export declare const toRecurringBillInstancePayload: (recurringBillInstance: RecurringBillInstance, maxPaymentProcessingDays: number) => RecurringBillInstancePayload;
|
|
19
|
+
export declare const checkIfUpdateCurrentBill: (editBillDetail: EditBillDetail, originalBillDetail?: BillTransaction | undefined) => boolean;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.toRecurringBillInstancePayload = exports.saveBillDetailEpic = void 0;
|
|
6
|
+
exports.checkIfUpdateCurrentBill = exports.toRecurringBillInstancePayload = exports.saveBillDetailEpic = void 0;
|
|
7
7
|
const rxjs_1 = require("rxjs");
|
|
8
8
|
const operators_1 = require("rxjs/operators");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
@@ -83,7 +83,7 @@ const getSaveBillApiURL = (saveBillBaseURL, isRecurring, billId) => {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
function prepareSaveBillPayload(accountState, billTransactionState, paymentAccountState, setupViewState, vendorState, recurringBillState, billDetail, billStageCode, isVendorRecommendationEnabled, isLocalCurrencyEnabled) {
|
|
86
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18
|
|
86
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
|
|
87
87
|
const billId = billDetail.billId;
|
|
88
88
|
let detail;
|
|
89
89
|
const withdrawFromList = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, setupViewState.accountDetails.paymentAccountIds);
|
|
@@ -187,8 +187,7 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
|
|
|
187
187
|
recurringConfig.updateRecurringBills === 'all';
|
|
188
188
|
payload.is_update_current_bill =
|
|
189
189
|
recurringConfig.updateRecurringBills === 'all' ||
|
|
190
|
-
(
|
|
191
|
-
((_21 = detail === null || detail === void 0 ? void 0 : detail.billPayInfo.paymentDate) === null || _21 === void 0 ? void 0 : _21.toString())
|
|
190
|
+
(0, exports.checkIfUpdateCurrentBill)(billDetail, detail)
|
|
192
191
|
? true
|
|
193
192
|
: recurringConfig.updateRecurringBills === 'current';
|
|
194
193
|
if ((isConfigChangedForExistingBill ||
|
|
@@ -246,3 +245,24 @@ const toRecurringBillInstancePayload = (recurringBillInstance, maxPaymentProcess
|
|
|
246
245
|
};
|
|
247
246
|
};
|
|
248
247
|
exports.toRecurringBillInstancePayload = toRecurringBillInstancePayload;
|
|
248
|
+
const checkIfUpdateCurrentBill = (editBillDetail, originalBillDetail) => {
|
|
249
|
+
var _a, _b, _c, _d, _e;
|
|
250
|
+
const { paymentDetailsSection, whatForSection } = editBillDetail.billDetailLocalData;
|
|
251
|
+
if (((_a = paymentDetailsSection === null || paymentDetailsSection === void 0 ? void 0 : paymentDetailsSection.paymentDate) === null || _a === void 0 ? void 0 : _a.toString()) !==
|
|
252
|
+
((_b = originalBillDetail === null || originalBillDetail === void 0 ? void 0 : originalBillDetail.billPayInfo.paymentDate) === null || _b === void 0 ? void 0 : _b.toString())) {
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
if ((whatForSection === null || whatForSection === void 0 ? void 0 : whatForSection.invoiceNumber) !== (originalBillDetail === null || originalBillDetail === void 0 ? void 0 : originalBillDetail.documentId)) {
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
if (((_c = whatForSection === null || whatForSection === void 0 ? void 0 : whatForSection.billDueDate) === null || _c === void 0 ? void 0 : _c.toString()) !==
|
|
259
|
+
((_d = originalBillDetail === null || originalBillDetail === void 0 ? void 0 : originalBillDetail.dueDate) === null || _d === void 0 ? void 0 : _d.toString())) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
if (((_e = whatForSection === null || whatForSection === void 0 ? void 0 : whatForSection.invoiceDate) === null || _e === void 0 ? void 0 : _e.toString()) !==
|
|
263
|
+
(originalBillDetail === null || originalBillDetail === void 0 ? void 0 : originalBillDetail.date.toString())) {
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
return false;
|
|
267
|
+
};
|
|
268
|
+
exports.checkIfUpdateCurrentBill = checkIfUpdateCurrentBill;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { AllowedValueWithCode } from '../../../../commonStateTypes/allowedValue';
|
|
1
2
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
2
3
|
import { CreditTerm, RePaymentInfo } from './chargeCardConfigState';
|
|
3
4
|
export interface ChargeCardConfigPayload {
|
|
4
|
-
allowed_credit_limit_span_options:
|
|
5
|
+
allowed_credit_limit_span_options: AllowedValueWithCode[];
|
|
5
6
|
credit_terms: CreditTermsPayload;
|
|
6
7
|
repayment_info: RePaymentInfoPayload;
|
|
7
8
|
}
|
|
@@ -30,7 +30,10 @@ const chargeCardConfig = (0, toolkit_1.createSlice)({
|
|
|
30
30
|
updateChargeCardConfig(draft, action) {
|
|
31
31
|
const { payload } = action;
|
|
32
32
|
draft.creditLimitFrequency =
|
|
33
|
-
payload.allowed_credit_limit_span_options.map((
|
|
33
|
+
payload.allowed_credit_limit_span_options.map((fequency) => ({
|
|
34
|
+
code: (0, chargeCard_1.toCreditLimitFrequencyCodeType)(fequency.code),
|
|
35
|
+
name: fequency.name,
|
|
36
|
+
}));
|
|
34
37
|
draft.creditTerm = (0, chargeCardConfigPayload_1.toCreditTerm)(payload.credit_terms);
|
|
35
38
|
draft.rePaymentInfo = (0, chargeCardConfigPayload_1.toRePaymentInfo)(payload.repayment_info);
|
|
36
39
|
draft.fetchState = 'Completed';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FetchedState, ID } from '../../../../commonStateTypes/common';
|
|
2
2
|
import { TimeframeTick } from '../../../../commonStateTypes/timeframeTick';
|
|
3
|
-
import {
|
|
3
|
+
import { CreditLimitFrequency } from '../../../../entity/chargeCard/chargeCard';
|
|
4
4
|
import { ZeniDate } from '../../../../zeniDayJS';
|
|
5
5
|
export interface ChargeCardConfigState extends FetchedState {
|
|
6
|
-
creditLimitFrequency:
|
|
6
|
+
creditLimitFrequency: CreditLimitFrequency[];
|
|
7
7
|
creditTerm: CreditTerm;
|
|
8
8
|
rePaymentInfo?: RePaymentInfo;
|
|
9
9
|
}
|
|
@@ -7,6 +7,7 @@ export interface ChargeCardDetailState {
|
|
|
7
7
|
export interface ChargeCardDetail extends FetchedState {
|
|
8
8
|
id: ID;
|
|
9
9
|
transactionList: ChargeCardDetailTransactionList;
|
|
10
|
+
updateStatus: FetchStateAndError;
|
|
10
11
|
}
|
|
11
12
|
export interface ChargeCardDetailTransactionList extends FetchStateAndError {
|
|
12
13
|
transactionIds: ID[];
|
|
@@ -23,6 +23,13 @@ export declare const fetchChargeCardDetailPage: import("@reduxjs/toolkit").Actio
|
|
|
23
23
|
}, string>, updateChargeCardTransactionListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
24
24
|
chargeCardId: ID;
|
|
25
25
|
error: ZeniAPIStatus;
|
|
26
|
+
}, string>, updateChargeCardDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chargeCardId: string, colorCode: string], {
|
|
27
|
+
chargeCardId: string;
|
|
28
|
+
colorCode: string;
|
|
29
|
+
}, string, never, never>, updateChargeCardDetailUpdateStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
|
+
chargeCardId: ID;
|
|
31
|
+
fetchState: FetchState;
|
|
32
|
+
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
26
33
|
}, string>, clearChargeCardDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
27
34
|
declare const _default: import("@reduxjs/toolkit").Reducer<ChargeCardDetailState, import("@reduxjs/toolkit").AnyAction>;
|
|
28
35
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearChargeCardDetail = exports.updateChargeCardTransactionListFailure = exports.updateChargeCardTransactionList = exports.fetchChargeCardTransactionList = exports.updateChargeCardDetailFetchState = exports.fetchChargeCardDetail = exports.fetchChargeCardDetailPage = exports.initialState = void 0;
|
|
4
|
+
exports.clearChargeCardDetail = exports.updateChargeCardDetailUpdateStatus = exports.updateChargeCardDetail = exports.updateChargeCardTransactionListFailure = exports.updateChargeCardTransactionList = exports.fetchChargeCardTransactionList = exports.updateChargeCardDetailFetchState = exports.fetchChargeCardDetail = exports.fetchChargeCardDetailPage = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
7
7
|
const sortOrderPayload_1 = require("../../../../commonPayloadTypes/sortOrderPayload");
|
|
@@ -76,10 +76,33 @@ const chargeCardDetail = (0, toolkit_1.createSlice)({
|
|
|
76
76
|
const existingCardDetail = draft.detailById[chargeCardId];
|
|
77
77
|
draft.detailById[chargeCardId] = Object.assign(Object.assign({}, existingCardDetail), { transactionList: Object.assign(Object.assign({}, existingCardDetail.transactionList), { fetchState: 'Error', error }) });
|
|
78
78
|
},
|
|
79
|
+
updateChargeCardDetail: {
|
|
80
|
+
reducer(draft, action) {
|
|
81
|
+
const { chargeCardId } = action.payload;
|
|
82
|
+
const existingCardDetail = draft.detailById[chargeCardId];
|
|
83
|
+
draft.detailById[chargeCardId] = Object.assign(Object.assign({}, existingCardDetail), { updateStatus: {
|
|
84
|
+
fetchState: 'In-Progress',
|
|
85
|
+
error: undefined,
|
|
86
|
+
} });
|
|
87
|
+
},
|
|
88
|
+
prepare(chargeCardId, colorCode) {
|
|
89
|
+
return {
|
|
90
|
+
payload: { chargeCardId, colorCode },
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
updateChargeCardDetailUpdateStatus(draft, action) {
|
|
95
|
+
const { chargeCardId, fetchState, error } = action.payload;
|
|
96
|
+
const existingCardDetail = draft.detailById[chargeCardId];
|
|
97
|
+
draft.detailById[chargeCardId] = Object.assign(Object.assign({}, existingCardDetail), { updateStatus: {
|
|
98
|
+
fetchState,
|
|
99
|
+
error,
|
|
100
|
+
} });
|
|
101
|
+
},
|
|
79
102
|
clearChargeCardDetail(draft) {
|
|
80
103
|
Object.assign(draft, exports.initialState);
|
|
81
104
|
},
|
|
82
105
|
},
|
|
83
106
|
});
|
|
84
|
-
_a = chargeCardDetail.actions, exports.fetchChargeCardDetailPage = _a.fetchChargeCardDetailPage, exports.fetchChargeCardDetail = _a.fetchChargeCardDetail, exports.updateChargeCardDetailFetchState = _a.updateChargeCardDetailFetchState, exports.fetchChargeCardTransactionList = _a.fetchChargeCardTransactionList, exports.updateChargeCardTransactionList = _a.updateChargeCardTransactionList, exports.updateChargeCardTransactionListFailure = _a.updateChargeCardTransactionListFailure, exports.clearChargeCardDetail = _a.clearChargeCardDetail;
|
|
107
|
+
_a = chargeCardDetail.actions, exports.fetchChargeCardDetailPage = _a.fetchChargeCardDetailPage, exports.fetchChargeCardDetail = _a.fetchChargeCardDetail, exports.updateChargeCardDetailFetchState = _a.updateChargeCardDetailFetchState, exports.fetchChargeCardTransactionList = _a.fetchChargeCardTransactionList, exports.updateChargeCardTransactionList = _a.updateChargeCardTransactionList, exports.updateChargeCardTransactionListFailure = _a.updateChargeCardTransactionListFailure, exports.updateChargeCardDetail = _a.updateChargeCardDetail, exports.updateChargeCardDetailUpdateStatus = _a.updateChargeCardDetailUpdateStatus, exports.clearChargeCardDetail = _a.clearChargeCardDetail;
|
|
85
108
|
exports.default = chargeCardDetail.reducer;
|
|
@@ -5,11 +5,14 @@ import { RootState } from '../../../../reducer';
|
|
|
5
5
|
import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
|
|
6
6
|
import { ChargeCardWithUser } from '../chargeCardList/chargeCardListSelector';
|
|
7
7
|
import { ChargeCardDetailUiState } from './chargeCardDetail';
|
|
8
|
+
import { TwoFactorAuthenticationState } from '../../../twoFactorAuthentication/twoFactorAuthentication';
|
|
8
9
|
export interface ChargeCardDetailSelectorView extends SelectorView {
|
|
9
10
|
chargeCardConfig: ChargeCardConfigState;
|
|
10
11
|
transactions: ChargeCardTransaction[];
|
|
11
12
|
uiState: ChargeCardDetailUiState;
|
|
12
13
|
transactionListFetchState: FetchStateAndError;
|
|
14
|
+
twoFAView: TwoFactorAuthenticationState;
|
|
15
|
+
loggedInUserPhone: string;
|
|
13
16
|
chargeCard?: ChargeCardWithUser;
|
|
14
17
|
}
|
|
15
18
|
export declare const getChargeCardDetailView: (state: RootState, chargeCardId: ID) => ChargeCardDetailSelectorView;
|
|
@@ -14,7 +14,10 @@ const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
|
14
14
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
15
15
|
const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
16
16
|
const getChargeCardDetailView = (state, chargeCardId) => {
|
|
17
|
-
|
|
17
|
+
var _a, _b, _c, _d, _e;
|
|
18
|
+
const { tenantState, addressState, chargeCardDetailState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, chargeCardTransactionState, twoFactorAuthenticationState, } = state;
|
|
19
|
+
const loggedInUserId = (_b = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId) !== null && _b !== void 0 ? _b : '';
|
|
20
|
+
const loggedInUserPhone = (_e = (_c = twoFactorAuthenticationState.phone) !== null && _c !== void 0 ? _c : (_d = (0, userSelector_1.getUserByUserId)(userState, loggedInUserId)) === null || _d === void 0 ? void 0 : _d.phone) !== null && _e !== void 0 ? _e : '';
|
|
18
21
|
let chargeCardWithUser = undefined;
|
|
19
22
|
const chargeCardDetail = (0, get_1.default)(chargeCardDetailState.detailById, chargeCardId, undefined);
|
|
20
23
|
const chargeCard = (0, chargeCardSelector_1.getChargeCardById)(chargeCardState, chargeCardId);
|
|
@@ -62,6 +65,8 @@ const getChargeCardDetailView = (state, chargeCardId) => {
|
|
|
62
65
|
transactions,
|
|
63
66
|
uiState,
|
|
64
67
|
transactionListFetchState,
|
|
68
|
+
twoFAView: twoFactorAuthenticationState,
|
|
69
|
+
loggedInUserPhone,
|
|
65
70
|
version: '1.0',
|
|
66
71
|
};
|
|
67
72
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { updateChargeCardDetail, updateChargeCardDetailUpdateStatus } from './chargeCardDetailReducer';
|
|
6
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
7
|
+
import { updateAllUsers } from '../../../../entity/user/userReducer';
|
|
8
|
+
import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
|
|
9
|
+
import { updateChargeCard } from '../../../../entity/chargeCard/chargeCardReducer';
|
|
10
|
+
export declare type ActionType = ReturnType<typeof updateChargeCardDetail> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardDetailUpdateStatus> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateChargeCard>;
|
|
11
|
+
export declare const updateChargeCardDetailEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|