@zeniai/client-epic-state 4.12.55 → 4.12.57

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.
Files changed (88) hide show
  1. package/lib/entity/chargeCard/chargeCard.d.ts +5 -2
  2. package/lib/entity/chargeCard/chargeCard.js +2 -0
  3. package/lib/entity/chargeCard/chargeCardPayload.d.ts +4 -2
  4. package/lib/entity/chargeCard/chargeCardPayload.js +44 -27
  5. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  6. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  7. package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
  8. package/lib/entity/tenant/clearAllEpic.js +2 -0
  9. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
  10. package/lib/epic.d.ts +7 -1
  11. package/lib/epic.js +7 -1
  12. package/lib/index.d.ts +12 -8
  13. package/lib/index.js +40 -22
  14. package/lib/reducer.d.ts +4 -1
  15. package/lib/reducer.js +4 -1
  16. package/lib/view/addressView/addressViewReducer.d.ts +2 -0
  17. package/lib/view/addressView/addressViewReducer.js +13 -2
  18. package/lib/view/addressView/addressViewState.d.ts +1 -1
  19. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +1 -1
  20. package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +1 -1
  21. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +1 -1
  22. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +1 -1
  23. package/lib/view/companyView/epic/companyPassport/updateCompanyPassportLocalStoreDataEpic.d.ts +2 -2
  24. package/lib/view/companyView/epic/companyPassport/updateCompanyPassportLocalStoreDataEpic.js +8 -1
  25. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  26. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  27. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  28. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  29. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  30. package/lib/view/settingsView/epic/fetchMyProfileEpic.d.ts +12 -2
  31. package/lib/view/settingsView/epic/fetchMyProfileEpic.js +10 -2
  32. package/lib/view/settingsView/epic/initializeMyProfileLocalDataEpic.d.ts +7 -0
  33. package/lib/view/settingsView/epic/initializeMyProfileLocalDataEpic.js +50 -0
  34. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  35. package/lib/view/settingsView/epic/updateMyProfileEpic.d.ts +11 -0
  36. package/lib/view/settingsView/epic/updateMyProfileEpic.js +86 -0
  37. package/lib/view/settingsView/settingsViewPayload.d.ts +12 -0
  38. package/lib/view/settingsView/settingsViewReducer.d.ts +13 -2
  39. package/lib/view/settingsView/settingsViewReducer.js +82 -7
  40. package/lib/view/settingsView/settingsViewSelector.js +14 -2
  41. package/lib/view/settingsView/settingsViewState.d.ts +16 -4
  42. package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +11 -1
  43. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer.d.ts +13 -0
  44. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer.js +94 -0
  45. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.d.ts +18 -0
  46. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.js +34 -0
  47. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingState.d.ts +20 -0
  48. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingState.js +2 -0
  49. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/epics/initializeCardUserOnboardingLocalDataEpic.d.ts +7 -0
  50. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/epics/initializeCardUserOnboardingLocalDataEpic.js +50 -0
  51. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/epics/saveCardOnboardingUserDetailsEpic.d.ts +7 -0
  52. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/epics/saveCardOnboardingUserDetailsEpic.js +16 -0
  53. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +2 -0
  54. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +2 -2
  55. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +20 -6
  56. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.d.ts +2 -2
  57. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +1 -1
  58. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +7 -0
  59. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +8 -1
  60. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +3 -0
  61. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +8 -2
  62. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +43 -2
  63. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +9 -4
  64. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +59 -15
  65. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListEpic.d.ts +2 -1
  66. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListEpic.js +2 -1
  67. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -0
  68. package/lib/view/spendManagement/chargeCards/chargeCardList/issueChargeCardEpic.d.ts +2 -1
  69. package/lib/view/spendManagement/chargeCards/chargeCardList/issueChargeCardEpic.js +3 -2
  70. package/lib/view/spendManagement/chargeCards/chargeCardList/resendCardInviteEpic.d.ts +9 -0
  71. package/lib/view/spendManagement/chargeCards/chargeCardList/resendCardInviteEpic.js +31 -0
  72. package/lib/view/spendManagement/chargeCards/chargeCardList/revokeCardInviteEpic.d.ts +8 -0
  73. package/lib/view/spendManagement/chargeCards/chargeCardList/revokeCardInviteEpic.js +29 -0
  74. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  75. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  76. package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +3 -1
  77. package/lib/view/twoFactorAuthentication/resendOtpEpic.js +30 -0
  78. package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +3 -1
  79. package/lib/view/twoFactorAuthentication/sendOtpEpic.js +30 -0
  80. package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +1 -1
  81. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.d.ts +12 -0
  82. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.js +7 -0
  83. package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +3 -1
  84. package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +26 -0
  85. package/lib/view/userListView/fetchUserListByTypeEpic.js +3 -1
  86. package/lib/view/userListView/userListViewReducer.js +1 -0
  87. package/lib/view/userListView/userListViewState.d.ts +2 -1
  88. package/package.json +1 -1
@@ -6,6 +6,6 @@ import { fetchChargeCardDetail, updateChargeCardDetailFetchState } from './charg
6
6
  import { updateAllUsers } from '../../../../entity/user/userReducer';
7
7
  import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
8
8
  import { updateChargeCard } from '../../../../entity/chargeCard/chargeCardReducer';
9
- import { updateAddress } from '../../../../entity/address/addressReducer';
10
- export declare type ActionType = ReturnType<typeof fetchChargeCardDetail> | ReturnType<typeof updateChargeCardDetailFetchState> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateAddress> | ReturnType<typeof updateChargeCard>;
9
+ import { updateAddress, updateAddresses } from '../../../../entity/address/addressReducer';
10
+ export declare type ActionType = ReturnType<typeof fetchChargeCardDetail> | ReturnType<typeof updateChargeCardDetailFetchState> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateAddress> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateChargeCard>;
11
11
  export declare const fetchChargeCardDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -29,7 +29,7 @@ const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((
29
29
  .getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${chargeCardId}`)
30
30
  .pipe((0, operators_1.mergeMap)((response) => {
31
31
  if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
32
- return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCard)(response.data.card), (0, addressReducer_1.updateAddress)(response.data.card.address), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
32
+ return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCard)(response.data.card), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, chargeCardDetailReducer_1.updateChargeCardDetailFetchState)({
33
33
  chargeCardId,
34
34
  fetchState: 'Completed',
35
35
  }));
@@ -9,6 +9,12 @@ export interface ChargeCardListState extends FetchedState {
9
9
  issueChargeCard: IssueChargeCard;
10
10
  searchText: string;
11
11
  unAssignedCredits?: Amount;
12
+ resendCardInvite: ResendRevokeCardInvite;
13
+ revokeCardInvite: ResendRevokeCardInvite;
14
+ }
15
+ export interface ResendRevokeCardInvite {
16
+ cardId?: ID;
17
+ saveStatus: FetchStateAndError;
12
18
  }
13
19
  export interface ChargeCardListUIState extends SpendManagementUIState {
14
20
  sortKey: ChargeCardViewSortKey;
@@ -34,6 +40,7 @@ export interface CreditAccount extends FetchStateAndError {
34
40
  }
35
41
  export declare const initialCreditAcc: CreditAccount;
36
42
  export declare const initialIssueChargeCard: IssueChargeCard;
43
+ export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
37
44
  export declare const toChargeCardSortKeyType: (v: string) => "owner" | "department" | "cardName" | "utilisation" | "limit";
38
45
  export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
39
46
  export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCreditAccountStatusType = exports.toCashbackSortKeyType = exports.ALL_CASHBACK_SORT_KEYS = exports.toChargeCardSortKeyType = exports.initialIssueChargeCard = exports.initialCreditAcc = void 0;
3
+ exports.toCreditAccountStatusType = exports.toCashbackSortKeyType = exports.ALL_CASHBACK_SORT_KEYS = exports.toChargeCardSortKeyType = exports.initialResendRevokeCardInvite = exports.initialIssueChargeCard = exports.initialCreditAcc = void 0;
4
4
  const stringToUnion_1 = require("../../../../commonStateTypes/stringToUnion");
5
5
  exports.initialCreditAcc = {
6
6
  fetchState: 'Not-Started',
@@ -45,6 +45,13 @@ exports.initialIssueChargeCard = {
45
45
  error: undefined,
46
46
  },
47
47
  };
48
+ exports.initialResendRevokeCardInvite = {
49
+ cardId: undefined,
50
+ saveStatus: {
51
+ fetchState: 'Not-Started',
52
+ error: undefined,
53
+ },
54
+ };
48
55
  const ALL_CHARGE_CARD_SORT_KEYS = [
49
56
  'owner',
50
57
  'cardName',
@@ -2,12 +2,14 @@ import { ChargeCardPayload } from '../../../../entity/chargeCard/chargeCardPaylo
2
2
  import { AmountPayload } from '../../../../entity/reimbursement/reimbursementPayload';
3
3
  import { UserPayload } from '../../../../entity/user/userPayload';
4
4
  import { UserRolePayload } from '../../../../entity/userRole/userRolePayload';
5
+ import { AddressPayload } from '../../../../entity/address/addressPayload';
5
6
  import { ZeniAPIResponse } from '../../../../responsePayload';
6
7
  export interface ChargeCardListPayload {
7
8
  cards: ChargeCardPayload[];
8
9
  unassigned_credit?: AmountPayload;
9
10
  users: UserPayload[];
10
11
  user_roles: UserRolePayload[];
12
+ addresses: AddressPayload[];
11
13
  }
12
14
  export declare type FetchChargeCardListResponse = ZeniAPIResponse<ChargeCardListPayload>;
13
15
  export interface CreditAccountPayload {
@@ -31,4 +33,5 @@ interface CreditAccountListPayload {
31
33
  credit_accounts: CreditAccountPayload[];
32
34
  }
33
35
  export declare type FetchCreditAccountResponse = ZeniAPIResponse<CreditAccountListPayload>;
36
+ export declare type ResendInviteResponse = ZeniAPIResponse<ChargeCardPayload>;
34
37
  export {};
@@ -1,7 +1,7 @@
1
1
  import { ZeniAPIStatus } from '../../../../responsePayload';
2
2
  import { ChargeCardListPayload, CreditAccountPayload } from './chargeCardListPayload';
3
3
  import { ChargeCardListState, ChargeCardListUIState, ChargeCardLocalData } from './chargeCardList';
4
- import { FetchState } from '../../../../commonStateTypes/common';
4
+ import { FetchState, ID } from '../../../../commonStateTypes/common';
5
5
  export declare const initialState: ChargeCardListState;
6
6
  export declare const fetchChargeCardListPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[doFetchCreditAccountsAndCashback: boolean, cacheOverride?: any], {
7
7
  doFetchCreditAccountsAndCashback: boolean;
@@ -14,6 +14,12 @@ export declare const fetchChargeCardListPage: import("@reduxjs/toolkit").ActionC
14
14
  error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
15
15
  }, string>, resetIssueChargeCardForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateSearchText: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, updateChargeCardListUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
16
16
  uiState: Partial<ChargeCardListUIState>;
17
- }, string>, clearChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
17
+ }, string>, clearChargeCardList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resendCardInvite: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cardId: string], {
18
+ cardId: string;
19
+ }, string, never, never>, resendCardInviteSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
20
+ cardId: ID;
21
+ }, string>, resendCardInviteFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, revokeCardInvite: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cardId: string], {
22
+ cardId: string;
23
+ }, string, never, never>, revokeCardInviteSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, revokeCardInviteFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>;
18
24
  declare const _default: import("@reduxjs/toolkit").Reducer<ChargeCardListState, import("@reduxjs/toolkit").AnyAction>;
19
25
  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.clearChargeCardList = exports.updateChargeCardListUIState = exports.updateSearchText = exports.resetIssueChargeCardForm = exports.issueChargeCardSuccessOrFailure = exports.updateChargeCardLocalStore = exports.issueChargeCard = exports.updateChargeCardListFailure = exports.updateChargeCardList = exports.fetchChargeCardList = exports.updateCreditAccountFailure = exports.updateCreditAccount = exports.fetchCreditAccount = exports.fetchChargeCardListPage = exports.initialState = void 0;
4
+ exports.revokeCardInviteFailure = exports.revokeCardInviteSuccess = exports.revokeCardInvite = exports.resendCardInviteFailure = exports.resendCardInviteSuccess = exports.resendCardInvite = exports.clearChargeCardList = exports.updateChargeCardListUIState = exports.updateSearchText = exports.resetIssueChargeCardForm = exports.issueChargeCardSuccessOrFailure = exports.updateChargeCardLocalStore = exports.issueChargeCard = exports.updateChargeCardListFailure = exports.updateChargeCardList = exports.fetchChargeCardList = exports.updateCreditAccountFailure = exports.updateCreditAccount = exports.fetchCreditAccount = exports.fetchChargeCardListPage = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const chargeCardList_1 = require("./chargeCardList");
7
7
  const amount_1 = require("../../../../commonStateTypes/amount");
@@ -20,6 +20,8 @@ exports.initialState = {
20
20
  sortKey: 'owner',
21
21
  sortOrder: 'ascending',
22
22
  },
23
+ resendCardInvite: chargeCardList_1.initialResendRevokeCardInvite,
24
+ revokeCardInvite: chargeCardList_1.initialResendRevokeCardInvite,
23
25
  };
24
26
  const chargeCardList = (0, toolkit_1.createSlice)({
25
27
  name: 'chargeCardList',
@@ -100,9 +102,48 @@ const chargeCardList = (0, toolkit_1.createSlice)({
100
102
  clearChargeCardList(draft) {
101
103
  Object.assign(draft, exports.initialState);
102
104
  },
105
+ resendCardInvite: {
106
+ prepare(cardId) {
107
+ return { payload: { cardId } };
108
+ },
109
+ reducer(draft, action) {
110
+ draft.resendCardInvite.cardId = action.payload.cardId;
111
+ draft.revokeCardInvite.saveStatus.fetchState = 'In-Progress';
112
+ },
113
+ },
114
+ resendCardInviteSuccess(draft, action) {
115
+ if (draft.resendCardInvite.cardId === action.payload.cardId) {
116
+ draft.resendCardInvite.cardId = undefined;
117
+ }
118
+ draft.resendCardInvite.saveStatus.fetchState = 'Completed';
119
+ draft.resendCardInvite.saveStatus.error = undefined;
120
+ },
121
+ resendCardInviteFailure(draft, action) {
122
+ draft.resendCardInvite.cardId = undefined;
123
+ draft.resendCardInvite.saveStatus.fetchState = 'Error';
124
+ draft.resendCardInvite.saveStatus.error = action.payload;
125
+ },
126
+ revokeCardInvite: {
127
+ prepare(cardId) {
128
+ return { payload: { cardId } };
129
+ },
130
+ reducer(draft, action) {
131
+ draft.revokeCardInvite.cardId = action.payload.cardId;
132
+ draft.revokeCardInvite.saveStatus.fetchState = 'In-Progress';
133
+ },
134
+ },
135
+ revokeCardInviteSuccess(draft, action) {
136
+ draft.revokeCardInvite.saveStatus.fetchState = 'Completed';
137
+ draft.revokeCardInvite.saveStatus.error = undefined;
138
+ draft.cardIds = draft.cardIds.filter((card) => card !== action.payload);
139
+ },
140
+ revokeCardInviteFailure(draft, action) {
141
+ draft.revokeCardInvite.saveStatus.fetchState = 'Error';
142
+ draft.revokeCardInvite.saveStatus.error = action.payload;
143
+ },
103
144
  },
104
145
  });
105
- _a = chargeCardList.actions, exports.fetchChargeCardListPage = _a.fetchChargeCardListPage, exports.fetchCreditAccount = _a.fetchCreditAccount, exports.updateCreditAccount = _a.updateCreditAccount, exports.updateCreditAccountFailure = _a.updateCreditAccountFailure, exports.fetchChargeCardList = _a.fetchChargeCardList, exports.updateChargeCardList = _a.updateChargeCardList, exports.updateChargeCardListFailure = _a.updateChargeCardListFailure, exports.issueChargeCard = _a.issueChargeCard, exports.updateChargeCardLocalStore = _a.updateChargeCardLocalStore, exports.issueChargeCardSuccessOrFailure = _a.issueChargeCardSuccessOrFailure, exports.resetIssueChargeCardForm = _a.resetIssueChargeCardForm, exports.updateSearchText = _a.updateSearchText, exports.updateChargeCardListUIState = _a.updateChargeCardListUIState, exports.clearChargeCardList = _a.clearChargeCardList;
146
+ _a = chargeCardList.actions, exports.fetchChargeCardListPage = _a.fetchChargeCardListPage, exports.fetchCreditAccount = _a.fetchCreditAccount, exports.updateCreditAccount = _a.updateCreditAccount, exports.updateCreditAccountFailure = _a.updateCreditAccountFailure, exports.fetchChargeCardList = _a.fetchChargeCardList, exports.updateChargeCardList = _a.updateChargeCardList, exports.updateChargeCardListFailure = _a.updateChargeCardListFailure, exports.issueChargeCard = _a.issueChargeCard, exports.updateChargeCardLocalStore = _a.updateChargeCardLocalStore, exports.issueChargeCardSuccessOrFailure = _a.issueChargeCardSuccessOrFailure, exports.resetIssueChargeCardForm = _a.resetIssueChargeCardForm, exports.updateSearchText = _a.updateSearchText, exports.updateChargeCardListUIState = _a.updateChargeCardListUIState, exports.clearChargeCardList = _a.clearChargeCardList, exports.resendCardInvite = _a.resendCardInvite, exports.resendCardInviteSuccess = _a.resendCardInviteSuccess, exports.resendCardInviteFailure = _a.resendCardInviteFailure, exports.revokeCardInvite = _a.revokeCardInvite, exports.revokeCardInviteSuccess = _a.revokeCardInviteSuccess, exports.revokeCardInviteFailure = _a.revokeCardInviteFailure;
106
147
  exports.default = chargeCardList.reducer;
107
148
  // helper
108
149
  const toCreditAccount = (payload) => ({
@@ -7,14 +7,16 @@ import { Class, ClassBase } from '../../../../entity/class/classState';
7
7
  import { User } from '../../../../entity/user/userState';
8
8
  import { UserRole } from '../../../../entity/userRole/userRoleState';
9
9
  import { RootState } from '../../../../reducer';
10
- import { ChargeCardListUIState, CreditAccount, IssueChargeCard } from './chargeCardList';
10
+ import { ChargeCardListUIState, CreditAccount, IssueChargeCard, ResendRevokeCardInvite } from './chargeCardList';
11
11
  import { Person } from '../../../people/peopleSelectorTypes';
12
12
  import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
13
13
  export interface ChargeCardWithUser extends ChargeCard {
14
- cardHolderUser?: User;
15
- cardHolderRoles?: UserRole;
14
+ cardCreatedByUser: User;
15
+ cardHolderUser: User;
16
+ cardHolderRoles: UserRole;
17
+ billingAddress: Address;
16
18
  department?: ClassBase;
17
- address?: Address;
19
+ mailingAddress?: Address;
18
20
  }
19
21
  export interface ChargeCardListSelectorView extends SelectorView {
20
22
  totalCashback: Amount;
@@ -27,6 +29,9 @@ export interface ChargeCardListSelectorView extends SelectorView {
27
29
  issueCardPageFetchState: FetchStateAndError;
28
30
  uiState: ChargeCardListUIState;
29
31
  searchText: string;
32
+ resendCardInvite: ResendRevokeCardInvite;
33
+ revokeCardInvite: ResendRevokeCardInvite;
30
34
  unAssignedCredits?: Amount;
31
35
  }
32
36
  export declare const getChargeCardListView: (state: RootState, includeCreditAccountAndCashbackInfo: boolean) => ChargeCardListSelectorView;
37
+ export declare const anyCardOnHold: (cards: ChargeCardWithUser[]) => 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.getChargeCardListView = void 0;
6
+ exports.anyCardOnHold = exports.getChargeCardListView = void 0;
7
7
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
8
8
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
9
9
  const sortOrderPayload_1 = require("../../../../commonPayloadTypes/sortOrderPayload");
@@ -16,9 +16,11 @@ const userListViewSelector_1 = require("../../../userListView/userListViewSelect
16
16
  const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
17
17
  const { addressState, chargeCardListState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, classListState, cashbackDetailState, userListViewState, } = state;
18
18
  const searchText = chargeCardListState.searchText.toLowerCase();
19
- const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds)
20
- .map((chargeCard) => {
19
+ const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds);
20
+ const chargeCardsWithUser = [];
21
+ cards.forEach((chargeCard) => {
21
22
  const cardHolderUser = (0, userSelector_1.getUserByUserId)(userState, chargeCard.cardHolderUserId);
23
+ const cardCreatedByUser = (0, userSelector_1.getUserByUserId)(userState, chargeCard.cardCreaterUserId);
22
24
  const cardHolderUserRole = (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, chargeCard.cardHolderUserId);
23
25
  const department = cardHolderUserRole != null
24
26
  ? (0, classSelector_1.getClassById)(classState, {
@@ -26,20 +28,40 @@ const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
26
28
  reportId: 'class_list',
27
29
  })
28
30
  : undefined;
29
- return Object.assign(Object.assign({}, chargeCard), { cardHolderUser, cardHolderRoles: (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, chargeCard.cardHolderUserId), department, address: (0, addressSelector_1.getAddressByAddressId)(addressState, chargeCard.addressId) });
30
- })
31
- .filter((cardWithUser) => {
32
- var _a, _b, _c, _d, _e;
33
- const derivedCardHolderName = `${(_a = cardWithUser.cardHolderUser) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = cardWithUser.cardHolderUser) === null || _b === void 0 ? void 0 : _b.lastName}`;
34
- return (cardWithUser.cardName.toLowerCase().includes(searchText) === true ||
35
- ((_c = cardWithUser.cardHolderUser) === null || _c === void 0 ? void 0 : _c.firstName.toLowerCase().includes(searchText)) === true ||
36
- derivedCardHolderName.toLowerCase().includes(searchText) === true ||
37
- ((_d = cardWithUser.cardHolderUser) === null || _d === void 0 ? void 0 : _d.lastName.toLowerCase().includes(searchText)) === true ||
38
- ((_e = cardWithUser.department) === null || _e === void 0 ? void 0 : _e.className.toLowerCase().includes(searchText)) === true);
31
+ const mailingAddress = chargeCard.mailingAddressId != null
32
+ ? (0, addressSelector_1.getAddressByAddressId)(addressState, chargeCard.mailingAddressId)
33
+ : undefined;
34
+ const billingAddress = (0, addressSelector_1.getAddressByAddressId)(addressState, chargeCard.billingAddressId);
35
+ if (cardCreatedByUser == null ||
36
+ cardHolderUser == null ||
37
+ cardHolderUserRole == null ||
38
+ billingAddress == null) {
39
+ console.error(`Cannot find details for card ${chargeCard.id}`);
40
+ }
41
+ else {
42
+ chargeCardsWithUser.push(Object.assign(Object.assign({}, chargeCard), { cardHolderUser,
43
+ cardCreatedByUser, cardHolderRoles: cardHolderUserRole, billingAddress,
44
+ department,
45
+ mailingAddress }));
46
+ }
47
+ });
48
+ const chargeCardsWithUserFiltered = chargeCardsWithUser.filter((cardWithUser) => {
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
50
+ const loweredSearchText = searchText.toLowerCase();
51
+ const cardName = (_a = cardWithUser.cardName.toLowerCase()) !== null && _a !== void 0 ? _a : '';
52
+ const firstName = (_c = (_b = cardWithUser.cardHolderUser) === null || _b === void 0 ? void 0 : _b.firstName.toLowerCase()) !== null && _c !== void 0 ? _c : '';
53
+ const lastName = (_e = (_d = cardWithUser.cardHolderUser) === null || _d === void 0 ? void 0 : _d.lastName.toLowerCase()) !== null && _e !== void 0 ? _e : '';
54
+ const derivedCardHolderName = (_h = `${(_f = cardWithUser.cardHolderUser) === null || _f === void 0 ? void 0 : _f.firstName} ${(_g = cardWithUser.cardHolderUser) === null || _g === void 0 ? void 0 : _g.lastName}`.toLowerCase()) !== null && _h !== void 0 ? _h : '';
55
+ const department = (_k = (_j = cardWithUser.department) === null || _j === void 0 ? void 0 : _j.className.toLowerCase()) !== null && _k !== void 0 ? _k : '';
56
+ return (cardName.includes(loweredSearchText) ||
57
+ firstName.includes(loweredSearchText) ||
58
+ lastName.includes(loweredSearchText) ||
59
+ derivedCardHolderName.includes(loweredSearchText) ||
60
+ department.includes(loweredSearchText));
39
61
  });
40
62
  const sortKey = chargeCardListState.uiState.sortKey;
41
63
  const sortOrder = (0, sortOrderPayload_1.getSortOrder)(chargeCardListState.uiState.sortOrder);
42
- const cardsInOrder = (0, orderBy_1.default)(cards, (card) => {
64
+ const getCardsBySortKey = (card, sortKey) => {
43
65
  var _a, _b, _c, _d;
44
66
  switch (sortKey) {
45
67
  case 'owner': {
@@ -60,9 +82,23 @@ const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
60
82
  case 'utilisation':
61
83
  return card.limit.amount - card.available.amount;
62
84
  case 'limit':
85
+ default:
63
86
  return card.limit.amount;
64
87
  }
65
- }, sortOrder);
88
+ };
89
+ let inviteAcceptedCards = [];
90
+ let inviteNotAcceptedCards = [];
91
+ chargeCardsWithUserFiltered.forEach((card) => {
92
+ if (card.status.code !== 'request_on_hold') {
93
+ inviteAcceptedCards.push(card);
94
+ }
95
+ else {
96
+ inviteNotAcceptedCards.push(card);
97
+ }
98
+ });
99
+ inviteAcceptedCards = (0, orderBy_1.default)(inviteAcceptedCards, (person) => getCardsBySortKey(person, sortKey), sortOrder);
100
+ inviteNotAcceptedCards = (0, orderBy_1.default)(inviteNotAcceptedCards, (person) => getCardsBySortKey(person, sortKey), sortOrder);
101
+ const cardsInOrder = [...inviteAcceptedCards, ...inviteNotAcceptedCards];
66
102
  const userListSelectorView = (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'cardHolderCandidate');
67
103
  const userList = userListSelectorView.users;
68
104
  const fetchState = includeCreditAccountAndCashbackInfo === true
@@ -98,6 +134,14 @@ const getChargeCardListView = (state, includeCreditAccountAndCashbackInfo) => {
98
134
  uiState: chargeCardListState.uiState,
99
135
  searchText,
100
136
  version: '1.0',
137
+ resendCardInvite: chargeCardListState.resendCardInvite,
138
+ revokeCardInvite: chargeCardListState.revokeCardInvite,
101
139
  };
102
140
  };
103
141
  exports.getChargeCardListView = getChargeCardListView;
142
+ const anyCardOnHold = (cards) => {
143
+ return cards.reduce((prevValue, currentValue) => {
144
+ return (prevValue === true && currentValue.status.code === 'request_on_hold');
145
+ }, true);
146
+ };
147
+ exports.anyCardOnHold = anyCardOnHold;
@@ -6,5 +6,6 @@ import { fetchChargeCardList, updateChargeCardList, updateChargeCardListFailure,
6
6
  import { updateChargeCards } from '../../../../entity/chargeCard/chargeCardReducer';
7
7
  import { updateAllUsers } from '../../../../entity/user/userReducer';
8
8
  import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
9
- export declare type ActionType = ReturnType<typeof fetchChargeCardList> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof updateChargeCardListUIState> | ReturnType<typeof updateChargeCardListFailure>;
9
+ import { updateAddresses } from '../../../../entity/address/addressReducer';
10
+ export declare type ActionType = ReturnType<typeof fetchChargeCardList> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof updateChargeCardListUIState> | ReturnType<typeof updateChargeCardListFailure> | ReturnType<typeof updateAddresses>;
10
11
  export declare const fetchChargeCardListEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -8,6 +8,7 @@ const chargeCardListReducer_1 = require("./chargeCardListReducer");
8
8
  const chargeCardReducer_1 = require("../../../../entity/chargeCard/chargeCardReducer");
9
9
  const userReducer_1 = require("../../../../entity/user/userReducer");
10
10
  const userRoleReducer_1 = require("../../../../entity/userRole/userRoleReducer");
11
+ const addressReducer_1 = require("../../../../entity/address/addressReducer");
11
12
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
12
13
  const fetchChargeCardListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.fetchChargeCardList.match), (0, operators_1.switchMap)(() => {
13
14
  return zeniAPI
@@ -20,7 +21,7 @@ const fetchChargeCardListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
20
21
  if (isChargeCardUser) {
21
22
  actions.push((0, chargeCardListReducer_1.updateChargeCardListUIState)({ uiState: { sortKey: 'cardName' } }));
22
23
  }
23
- actions.push((0, chargeCardReducer_1.updateChargeCards)(response.data.cards), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, chargeCardListReducer_1.updateChargeCardList)({ chargeCardListPayload: response.data }));
24
+ actions.push((0, chargeCardReducer_1.updateChargeCards)(response.data.cards), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, chargeCardListReducer_1.updateChargeCardList)({ chargeCardListPayload: response.data }));
24
25
  return (0, rxjs_1.from)(actions);
25
26
  }
26
27
  else {
@@ -20,6 +20,7 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
20
20
  chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
21
21
  chargeCardListPageAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
22
22
  chargeCardListPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', true));
23
+ chargeCardListPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardAdmin', true));
23
24
  chargeCardListPageAction.push((0, classListReducer_1.fetchClassList)());
24
25
  }
25
26
  else {
@@ -48,6 +49,11 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
48
49
  userList.hasValidState() === false) {
49
50
  chargeCardListPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', false));
50
51
  }
52
+ const userAdminList = state.userListViewState.userListByType.cardAdmin;
53
+ if (userAdminList.fetchState !== 'In-Progress' &&
54
+ userAdminList.hasValidState() === false) {
55
+ chargeCardListPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardAdmin', false));
56
+ }
51
57
  if (state.classListState.hasValidState() === false &&
52
58
  state.classListState.fetchState !== 'In-Progress') {
53
59
  chargeCardListPageAction.push((0, classListReducer_1.fetchClassList)());
@@ -5,7 +5,8 @@ import { ZeniAPI } from '../../../../zeniAPI';
5
5
  import { updateChargeCards } from '../../../../entity/chargeCard/chargeCardReducer';
6
6
  import { updateAllUsers } from '../../../../entity/user/userReducer';
7
7
  import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
8
+ import { updateAddresses } from '../../../../entity/address/addressReducer';
8
9
  import { issueChargeCard, issueChargeCardSuccessOrFailure, updateChargeCardList } from './chargeCardListReducer';
9
10
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
10
- export declare type ActionType = ReturnType<typeof issueChargeCard> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof issueChargeCardSuccessOrFailure>;
11
+ export declare type ActionType = ReturnType<typeof issueChargeCard> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof issueChargeCardSuccessOrFailure> | ReturnType<typeof updateAddresses>;
11
12
  export declare const issueChargeCardEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -7,6 +7,7 @@ const responsePayload_1 = require("../../../../responsePayload");
7
7
  const chargeCardReducer_1 = require("../../../../entity/chargeCard/chargeCardReducer");
8
8
  const userReducer_1 = require("../../../../entity/user/userReducer");
9
9
  const userRoleReducer_1 = require("../../../../entity/userRole/userRoleReducer");
10
+ const addressReducer_1 = require("../../../../entity/address/addressReducer");
10
11
  const chargeCardListReducer_1 = require("./chargeCardListReducer");
11
12
  const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
12
13
  const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.issueChargeCard.match), (0, operators_1.switchMap)(() => {
@@ -20,7 +21,7 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
20
21
  credit_limit: (_b = (_a = localData.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
21
22
  currency_code: (_d = (_c = localData.amount) === null || _c === void 0 ? void 0 : _c.currencyCode) !== null && _d !== void 0 ? _d : 'USD',
22
23
  credit_limit_frequency: { code: localData.frequency },
23
- card_type: 'charge_card',
24
+ card_type: 'business_virtual_credit_card',
24
25
  },
25
26
  ];
26
27
  return zeniAPI
@@ -31,7 +32,7 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
31
32
  actions.push((0, chargeCardReducer_1.updateChargeCards)(response.data.cards), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, chargeCardListReducer_1.updateChargeCardList)({
32
33
  chargeCardListPayload: response.data,
33
34
  keepExistingListItems: true,
34
- }), (0, chargeCardListReducer_1.issueChargeCardSuccessOrFailure)({ fetchState: 'Completed' }));
35
+ }), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, chargeCardListReducer_1.issueChargeCardSuccessOrFailure)({ fetchState: 'Completed' }));
35
36
  const names = response.data.users
36
37
  .map((user) => { var _a, _b, _c; return (_b = (_a = user.first_name) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : (_c = user.last_name) === null || _c === void 0 ? void 0 : _c.trim(); })
37
38
  .join(', ');
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../reducer';
4
+ import { ZeniAPI } from '../../../../zeniAPI';
5
+ import { resendCardInvite, resendCardInviteSuccess, resendCardInviteFailure, fetchChargeCardList } from './chargeCardListReducer';
6
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
7
+ import { updateChargeCard } from '../../../../entity/chargeCard/chargeCardReducer';
8
+ export declare type ActionType = ReturnType<typeof resendCardInvite> | ReturnType<typeof openSnackbar> | ReturnType<typeof resendCardInviteSuccess> | ReturnType<typeof resendCardInviteFailure> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof updateChargeCard>;
9
+ export declare const resendCardInviteEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resendCardInviteEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../responsePayload");
7
+ const chargeCardListReducer_1 = require("./chargeCardListReducer");
8
+ const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
9
+ const chargeCardReducer_1 = require("../../../../entity/chargeCard/chargeCardReducer");
10
+ const resendCardInviteEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.resendCardInvite.match), (0, operators_1.switchMap)((action) => {
11
+ const { cardId } = action.payload;
12
+ return zeniAPI
13
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${cardId}/resend-reminder`, { card_issuance_request: true })
14
+ .pipe((0, operators_1.mergeMap)((response) => {
15
+ if ((0, responsePayload_1.isSuccessStatus)(response)) {
16
+ return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCard)(response.data), // eslint-disable-line @typescript-eslint/no-non-null-assertion
17
+ (0, chargeCardListReducer_1.resendCardInviteSuccess)({ cardId: action.payload.cardId }), (0, snackbarReducer_1.openSnackbar)({
18
+ messageSection: 'charge_card_resend_invite',
19
+ messageText: 'success',
20
+ type: 'success',
21
+ }));
22
+ }
23
+ else {
24
+ return (0, rxjs_1.of)((0, chargeCardListReducer_1.resendCardInviteFailure)(response.status));
25
+ }
26
+ }), (0, operators_1.catchError)((error) => {
27
+ return (0, rxjs_1.of)((0, chargeCardListReducer_1.resendCardInviteFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Resend Charge Card REST API call errored out' +
28
+ JSON.stringify(error))));
29
+ }));
30
+ }));
31
+ exports.resendCardInviteEpic = resendCardInviteEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../reducer';
4
+ import { ZeniAPI } from '../../../../zeniAPI';
5
+ import { revokeCardInvite, revokeCardInviteSuccess, revokeCardInviteFailure } from './chargeCardListReducer';
6
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
7
+ export declare type ActionType = ReturnType<typeof revokeCardInvite> | ReturnType<typeof openSnackbar> | ReturnType<typeof revokeCardInviteSuccess> | ReturnType<typeof revokeCardInviteFailure>;
8
+ export declare const revokeCardInviteEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.revokeCardInviteEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../responsePayload");
7
+ const chargeCardListReducer_1 = require("./chargeCardListReducer");
8
+ const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
9
+ const revokeCardInviteEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.revokeCardInvite.match), (0, operators_1.switchMap)((action) => {
10
+ const { cardId } = action.payload;
11
+ return zeniAPI
12
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${cardId}/cancel-issue-request`)
13
+ .pipe((0, operators_1.mergeMap)((response) => {
14
+ if ((0, responsePayload_1.isSuccessStatus)(response)) {
15
+ return (0, rxjs_1.of)((0, chargeCardListReducer_1.revokeCardInviteSuccess)(cardId), (0, snackbarReducer_1.openSnackbar)({
16
+ messageSection: 'charge_card_revoke_invite',
17
+ messageText: 'success',
18
+ type: 'success',
19
+ }));
20
+ }
21
+ else {
22
+ return (0, rxjs_1.of)((0, chargeCardListReducer_1.revokeCardInviteFailure)(response.status));
23
+ }
24
+ }), (0, operators_1.catchError)((error) => {
25
+ return (0, rxjs_1.of)((0, chargeCardListReducer_1.revokeCardInviteFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Revoke Charge Card REST API call errored out' +
26
+ JSON.stringify(error))));
27
+ }));
28
+ }));
29
+ exports.revokeCardInviteEpic = revokeCardInviteEpic;
@@ -8,7 +8,7 @@ import { updateCreatedTagToLocalStore } from '../../taskManager/taskDetailView/t
8
8
  export declare type ActionType = ReturnType<typeof createTag> | ReturnType<typeof updateTagCreateStatus> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateCreatedTagToLocalStore> | ReturnType<typeof updateTags>;
9
9
  export declare const createTagEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
10
  payload: {
11
- messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation";
11
+ messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation";
12
12
  messageText: "failed" | "success" | "notification";
13
13
  type: import("../../..").SnackbarMessageType;
14
14
  showStatusIcon?: boolean | undefined;
@@ -9,7 +9,7 @@ export declare const deleteTagEpic: (actions$: ActionsObservable<ActionType>, _s
9
9
  type: string;
10
10
  } | {
11
11
  payload: {
12
- messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation";
12
+ messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation";
13
13
  messageText: "failed" | "success" | "notification";
14
14
  type: import("../../..").SnackbarMessageType;
15
15
  showStatusIcon?: boolean | undefined;
@@ -6,5 +6,7 @@ import { resendOtp, sendOtpSuccess, sendOtpFailure } from './twoFactorAuthentica
6
6
  import { resendOtpSpendManagementSetUp, sendOtpFailureSpendManagementSetUp, sendOtpSuccessSpendManagementSetUp } from '../spendManagement/commonSetup/setupViewReducer';
7
7
  import { resendOtpVendorView, sendOtpVendorViewSuccess, sendOtpVendorViewFailure } from '../commonVendorView/vendorView/vendorViewReducer';
8
8
  import { resendOnboardingOfficerOtp, sendOnboardingOfficerOtpFailure, sendOnboardingOfficerOtpSuccess } from '../onboardingView/customerView/onboardingCustomerViewReducer';
9
- export declare type ActionType = ReturnType<typeof resendOtp> | ReturnType<typeof sendOtpSuccess> | ReturnType<typeof sendOtpFailure> | ReturnType<typeof resendOtpSpendManagementSetUp> | ReturnType<typeof sendOtpSuccessSpendManagementSetUp> | ReturnType<typeof sendOtpFailureSpendManagementSetUp> | ReturnType<typeof resendOtpVendorView> | ReturnType<typeof sendOtpVendorViewSuccess> | ReturnType<typeof sendOtpVendorViewFailure> | ReturnType<typeof resendOnboardingOfficerOtp> | ReturnType<typeof sendOnboardingOfficerOtpSuccess> | ReturnType<typeof sendOnboardingOfficerOtpFailure>;
9
+ import { sendOtpMyProfileFailure, sendOtpMyProfileSuccess, resendOtpMyProfile } from '../settingsView/settingsViewReducer';
10
+ import { resendOtpCardUserOnboarding, sendOtpCardUserOnboardingFailure, sendOtpCardUserOnboardingSuccess } from '../spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer';
11
+ export declare type ActionType = ReturnType<typeof resendOtp> | ReturnType<typeof sendOtpSuccess> | ReturnType<typeof sendOtpFailure> | ReturnType<typeof resendOtpSpendManagementSetUp> | ReturnType<typeof sendOtpSuccessSpendManagementSetUp> | ReturnType<typeof sendOtpFailureSpendManagementSetUp> | ReturnType<typeof resendOtpVendorView> | ReturnType<typeof sendOtpVendorViewSuccess> | ReturnType<typeof sendOtpVendorViewFailure> | ReturnType<typeof resendOnboardingOfficerOtp> | ReturnType<typeof sendOnboardingOfficerOtpSuccess> | ReturnType<typeof sendOnboardingOfficerOtpFailure> | ReturnType<typeof resendOtpCardUserOnboarding> | ReturnType<typeof sendOtpCardUserOnboardingSuccess> | ReturnType<typeof sendOtpCardUserOnboardingFailure> | ReturnType<typeof resendOtpMyProfile> | ReturnType<typeof sendOtpMyProfileFailure> | ReturnType<typeof sendOtpMyProfileSuccess>;
10
12
  export declare const resendOtpEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;