@zeniai/client-epic-state 4.18.91 → 4.18.92

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 (121) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.js +4 -0
  3. package/lib/commonStateTypes/classesView/getNestedClassIDHierarchyForReport.js +2 -0
  4. package/lib/commonStateTypes/classesView/nestedClassID.d.ts +1 -0
  5. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  6. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  7. package/lib/entity/account/accountState.d.ts +1 -1
  8. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  9. package/lib/entity/chargeCard/chargeCard.d.ts +2 -1
  10. package/lib/entity/chargeCard/chargeCard.js +2 -0
  11. package/lib/entity/chargeCard/chargeCardPayload.d.ts +2 -1
  12. package/lib/entity/chargeCard/chargeCardPayload.js +10 -9
  13. package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
  14. package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.d.ts +1 -2
  15. package/lib/entity/class/classPayload.d.ts +1 -0
  16. package/lib/entity/class/classPayload.js +9 -9
  17. package/lib/entity/class/classReducer.d.ts +4 -4
  18. package/lib/entity/class/classState.d.ts +2 -1
  19. package/lib/entity/forecast/forecastState.d.ts +1 -1
  20. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +8 -0
  21. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +14 -0
  22. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +8 -0
  23. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  24. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  25. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  26. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  27. package/lib/entity/snackbar/snackbarTypes.js +34 -8
  28. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  29. package/lib/entity/tenant/tenantReducer.d.ts +1 -1
  30. package/lib/entity/tenant/tenantReducer.js +8 -2
  31. package/lib/entity/tenant/tenantState.d.ts +1 -0
  32. package/lib/epic.d.ts +13 -1
  33. package/lib/epic.js +13 -1
  34. package/lib/index.d.ts +14 -12
  35. package/lib/index.js +53 -30
  36. package/lib/init.d.ts +2 -1
  37. package/lib/init.js +3 -2
  38. package/lib/responsePayload.d.ts +3 -0
  39. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  40. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  41. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  42. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  43. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  44. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  45. package/lib/view/classList/classListReducer.d.ts +3 -1
  46. package/lib/view/classList/classListReducer.js +8 -3
  47. package/lib/view/classList/fetchClassListEpic.js +6 -2
  48. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +2 -1
  49. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +10 -2
  50. package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportViewEpic.js +2 -4
  51. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  52. package/lib/view/dashboard/dashboardSelector.d.ts +2 -1
  53. package/lib/view/dashboard/dashboardSelector.js +14 -6
  54. package/lib/view/dashboardLayout/dashboardLayoutReducer.js +1 -0
  55. package/lib/view/dashboardLayout/fetchDashboardLayoutEpic.js +14 -1
  56. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +1 -1
  57. package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +3 -1
  58. package/lib/view/expenseAutomationView/helpers/helpers.d.ts +3 -3
  59. package/lib/view/expenseAutomationView/helpers/helpers.js +4 -4
  60. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -2
  61. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +46 -64
  62. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  63. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  64. package/lib/view/monthEndCloseChecksView/epics/fetchMonthClosePerformanceTrendEpic.d.ts +7 -0
  65. package/lib/view/monthEndCloseChecksView/epics/fetchMonthClosePerformanceTrendEpic.js +47 -0
  66. package/lib/view/monthEndCloseChecksView/epics/fetchMonthEndCloseChecksEpic.js +1 -1
  67. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewPayload.d.ts +8 -0
  68. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewReducer.d.ts +11 -1
  69. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewReducer.js +47 -3
  70. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.d.ts +3 -0
  71. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.js +18 -13
  72. package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewState.d.ts +7 -1
  73. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  74. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  75. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +3 -4
  76. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +17 -2
  77. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +38 -3
  78. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +11 -1
  79. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +40 -4
  80. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +189 -26
  81. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +19 -1
  82. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +87 -12
  83. package/lib/view/spendManagement/chargeCards/chargeCardDetail/closeChargeCardEpic.d.ts +9 -0
  84. package/lib/view/spendManagement/chargeCards/chargeCardDetail/closeChargeCardEpic.js +71 -0
  85. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardsRecurringExpensesEpic.d.ts +7 -0
  86. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardsRecurringExpensesEpic.js +44 -0
  87. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.js +4 -4
  88. package/lib/view/spendManagement/chargeCards/chargeCardDetail/lockChargeCardEpic.d.ts +9 -0
  89. package/lib/view/spendManagement/chargeCards/chargeCardDetail/lockChargeCardEpic.js +78 -0
  90. package/lib/view/spendManagement/chargeCards/chargeCardDetail/unlockChargeCardEpic.d.ts +9 -0
  91. package/lib/view/spendManagement/chargeCards/chargeCardDetail/unlockChargeCardEpic.js +75 -0
  92. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardNameEpic.d.ts +9 -0
  93. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardNameEpic.js +83 -0
  94. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +7 -0
  95. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -0
  96. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +34 -4
  97. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +142 -3
  98. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +46 -0
  99. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +198 -4
  100. package/lib/view/spendManagement/chargeCards/chargeCardList/closeChargeCardsEpic.d.ts +9 -0
  101. package/lib/view/spendManagement/chargeCards/chargeCardList/closeChargeCardsEpic.js +69 -0
  102. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts +3 -1
  103. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +18 -0
  104. package/lib/view/spendManagement/chargeCards/chargeCardList/lockChargeCardsEpic.d.ts +9 -0
  105. package/lib/view/spendManagement/chargeCards/chargeCardList/lockChargeCardsEpic.js +69 -0
  106. package/lib/view/spendManagement/chargeCards/chargeCardList/revokeChargeCardsInviteEpic.d.ts +8 -0
  107. package/lib/view/spendManagement/chargeCards/chargeCardList/revokeChargeCardsInviteEpic.js +71 -0
  108. package/lib/view/spendManagement/chargeCards/chargeCardList/unlockChargeCardsEpic.d.ts +9 -0
  109. package/lib/view/spendManagement/chargeCards/chargeCardList/unlockChargeCardsEpic.js +68 -0
  110. package/lib/view/spendManagement/chargeCards/chargeCardList/updateChargeCardsLimitEpic.d.ts +9 -0
  111. package/lib/view/spendManagement/chargeCards/chargeCardList/updateChargeCardsLimitEpic.js +76 -0
  112. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +8 -0
  113. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +22 -0
  114. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.d.ts +1 -1
  115. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +24 -2
  116. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewState.d.ts +1 -0
  117. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  118. package/lib/view/topEx/topExSelector.d.ts +1 -1
  119. package/lib/zeniAPI.d.ts +12 -1
  120. package/lib/zeniAPI.js +33 -6
  121. package/package.json +1 -1
@@ -10,6 +10,8 @@ import { UserRole } from '../../../../entity/userRole/userRoleState';
10
10
  import { RootState } from '../../../../reducer';
11
11
  import { Person } from '../../../people/peopleSelectorTypes';
12
12
  import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
13
+ import { RecurringExpense } from '../chargeCardDetail/chargeCardDetail';
14
+ import { ChargeCardControlDetailView } from '../chargeCardDetail/chargeCardDetailSelector';
13
15
  import { ChargeCardListUIState, CreditAccount, CreditAccountRepayment, DebitCardSummaries, ResendRevokeCardInvite } from './chargeCardList';
14
16
  export interface ChargeCardWithUser extends ChargeCard {
15
17
  billingAddress: Address;
@@ -26,16 +28,21 @@ export interface ChargeCardListSelectorView extends SelectorView {
26
28
  allAccountingClasses: Class[];
27
29
  cards: ChargeCardWithUser[];
28
30
  chargeCardConfig: ChargeCardConfigState;
31
+ closeChargeCardsFetchState: FetchStateAndError;
29
32
  creditAccount: CreditAccount;
30
33
  creditAccountRepayment: CreditAccountRepayment;
31
34
  hasCreditCard: boolean;
32
35
  hasDebitCard: boolean;
33
36
  issueCardPageFetchState: FetchStateAndError;
37
+ lockChargeCardsFetchState: FetchStateAndError;
34
38
  resendCardInvite: ResendRevokeCardInvite;
35
39
  revokeCardInvite: ResendRevokeCardInvite;
40
+ revokeChargeCardsInviteFetchState: FetchStateAndError;
36
41
  searchText: string;
37
42
  totalCashback: Amount;
38
43
  uiState: ChargeCardListUIState;
44
+ unlockChargeCardsFetchState: FetchStateAndError;
45
+ updateChargeCardsSpendLimitFetchState: FetchStateAndError;
39
46
  userList: Person[];
40
47
  debitCardSummary?: DebitCardSummaries;
41
48
  unAssignedCredits?: Amount;
@@ -67,3 +74,42 @@ export interface DebitCardListSelectorView extends FetchStateAndError {
67
74
  }
68
75
  export declare const getDebitCardList: (state: RootState) => DebitCardListSelectorView;
69
76
  export declare const getDebitCardSummary: (state: RootState) => DebitCardSummaries;
77
+ export interface ChargeCardRecurringExpensesByCardIds extends FetchStateAndError {
78
+ recurringExpensesByChargeCardId: Record<ID, RecurringExpense[]>;
79
+ }
80
+ export declare const getChargeCardRecurringExpensesByCardIds: (state: RootState, chargeCardIds: ID[]) => ChargeCardRecurringExpensesByCardIds;
81
+ /**
82
+ * Memoized selector for row action card data
83
+ * Combines ChargeCardControlDetailView, depositAccountLimit, and recurringExpenses
84
+ * based on the rowActionCardId from chargeCardListState
85
+ */
86
+ export interface ChargeCardRowActionView extends ChargeCardControlDetailView {
87
+ depositAccountLimitFetchState: FetchStateAndError;
88
+ recurringExpenses: RecurringExpense[];
89
+ recurringExpensesFetchState: FetchStateAndError;
90
+ cardId?: ID;
91
+ chargeCard?: ChargeCardWithUser;
92
+ depositAccountLimit?: DepositAccountWithLimit;
93
+ }
94
+ /**
95
+ * Memoized selector that returns row action card data
96
+ * Only recomputes when relevant parts of state change
97
+ */
98
+ export declare const getChargeCardRowActionView: (state: RootState) => ChargeCardRowActionView;
99
+ /**
100
+ * Memoized selector for bulk action cards data
101
+ * Returns data for all cards selected in bulkActionCardIds
102
+ */
103
+ export interface ChargeCardBulkActionView {
104
+ bulkActionCardIds: ID[];
105
+ chargeCards: ChargeCardWithUser[];
106
+ hasCreditCards: boolean;
107
+ hasDebitCards: boolean;
108
+ recurringExpensesByCardId: Record<ID, RecurringExpense[]>;
109
+ recurringExpensesFetchState: FetchStateAndError;
110
+ }
111
+ /**
112
+ * Memoized selector that returns bulk action cards data
113
+ * Only recomputes when relevant parts of state change
114
+ */
115
+ export declare const getChargeCardBulkActionView: (state: RootState) => ChargeCardBulkActionView;
@@ -3,7 +3,8 @@ 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.getDebitCardSummary = exports.getDebitCardList = exports.getDepositAccountListWithDebitCardIssued = exports.getCreditAccountDetails = exports.anyCardOnHold = exports.getMyRequestOnHoldChargeCardListWithShippingAddress = exports.getMyPendingActivationChargeCardListView = exports.getChargeCardListView = void 0;
6
+ exports.getChargeCardBulkActionView = exports.getChargeCardRowActionView = exports.getChargeCardRecurringExpensesByCardIds = exports.getDebitCardSummary = exports.getDebitCardList = exports.getDepositAccountListWithDebitCardIssued = exports.getCreditAccountDetails = exports.anyCardOnHold = exports.getMyRequestOnHoldChargeCardListWithShippingAddress = exports.getMyPendingActivationChargeCardListView = exports.getChargeCardListView = void 0;
7
+ const toolkit_1 = require("@reduxjs/toolkit");
7
8
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
8
9
  const sortOrderPayload_1 = require("../../../../commonPayloadTypes/sortOrderPayload");
9
10
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
@@ -14,6 +15,7 @@ const depositAccountSelector_1 = require("../../../../entity/depositAccount/depo
14
15
  const userSelector_1 = require("../../../../entity/user/userSelector");
15
16
  const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
16
17
  const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
18
+ const chargeCardDetailSelector_1 = require("../chargeCardDetail/chargeCardDetailSelector");
17
19
  const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbackInfo, isDebitCardEnabled, isCreditCardEnabled) => {
18
20
  const { chargeCardListState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, classListState, cashbackDetailState, userListViewState, } = state;
19
21
  const searchText = chargeCardListState.searchText.toLowerCase();
@@ -76,11 +78,16 @@ const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbac
76
78
  userList,
77
79
  allAccountingClasses,
78
80
  issueCardPageFetchState,
79
- uiState: chargeCardListState.uiState,
80
- searchText,
81
- version: '1.0',
81
+ closeChargeCardsFetchState: chargeCardListState.closeChargeCardsFetchState,
82
+ lockChargeCardsFetchState: chargeCardListState.lockChargeCardsFetchState,
82
83
  resendCardInvite: chargeCardListState.resendCardInvite,
83
84
  revokeCardInvite: chargeCardListState.revokeCardInvite,
85
+ revokeChargeCardsInviteFetchState: chargeCardListState.revokeChargeCardsInviteFetchState,
86
+ searchText,
87
+ unlockChargeCardsFetchState: chargeCardListState.unlockChargeCardsFetchState,
88
+ updateChargeCardsSpendLimitFetchState: chargeCardListState.updateChargeCardsSpendLimitFetchState,
89
+ uiState: chargeCardListState.uiState,
90
+ version: '1.0',
84
91
  debitCardSummary: chargeCardListState.debitCardSummaries,
85
92
  hasCreditCard,
86
93
  hasDebitCard,
@@ -233,3 +240,190 @@ const getCardsBySortKey = (card, sortKey) => {
233
240
  return card.limit.amount;
234
241
  }
235
242
  };
243
+ const getChargeCardRecurringExpensesByCardIds = (state, chargeCardIds) => {
244
+ const { chargeCardDetailState } = state;
245
+ const recurringExpensesByChargeCardId = {};
246
+ chargeCardIds.forEach((cardId) => {
247
+ var _a;
248
+ recurringExpensesByChargeCardId[cardId] =
249
+ (_a = chargeCardDetailState.recurringExpensesByChargeCardId[cardId]) !== null && _a !== void 0 ? _a : [];
250
+ });
251
+ const recurringExpensesFetchState = chargeCardDetailState.recurringExpensesFetchState;
252
+ return {
253
+ fetchState: recurringExpensesFetchState.fetchState,
254
+ error: recurringExpensesFetchState.error,
255
+ recurringExpensesByChargeCardId,
256
+ };
257
+ };
258
+ exports.getChargeCardRecurringExpensesByCardIds = getChargeCardRecurringExpensesByCardIds;
259
+ // Selector to get rowActionCardId from state
260
+ const selectRowActionCardId = (state) => state.chargeCardListState.rowActionCardId;
261
+ // Selector to get chargeCardDetailState
262
+ const selectChargeCardDetailState = (state) => state.chargeCardDetailState;
263
+ // Selector to get depositAccountState
264
+ const selectDepositAccountState = (state) => state.depositAccountState;
265
+ // Selector to get chargeCardState
266
+ const selectChargeCardState = (state) => state.chargeCardState;
267
+ /**
268
+ * Memoized selector that returns row action card data
269
+ * Only recomputes when relevant parts of state change
270
+ */
271
+ exports.getChargeCardRowActionView = (0, toolkit_1.createSelector)([
272
+ selectRowActionCardId,
273
+ selectChargeCardDetailState,
274
+ selectDepositAccountState,
275
+ selectChargeCardState,
276
+ (state) => state.chargeCardListState,
277
+ (state) => state.userState,
278
+ (state) => state.userRoleState,
279
+ (state) => state.classState,
280
+ (state) => state.addressState,
281
+ ], (rowActionCardId, chargeCardDetailState, depositAccountState, chargeCardState, chargeCardListState, userState, userRoleState, classState, addressState) => {
282
+ var _a;
283
+ // If no rowActionCardId, return empty state
284
+ if (rowActionCardId == null) {
285
+ return {
286
+ closeChargeCardsFetchState: {
287
+ fetchState: 'Not-Started',
288
+ error: undefined,
289
+ },
290
+ lockChargeCardsFetchState: {
291
+ fetchState: 'Not-Started',
292
+ error: undefined,
293
+ },
294
+ unlockChargeCardsFetchState: {
295
+ fetchState: 'Not-Started',
296
+ error: undefined,
297
+ },
298
+ revokeChargeCardFetchState: {
299
+ fetchState: 'Not-Started',
300
+ error: undefined,
301
+ },
302
+ updateChargeCardLimitFetchState: {
303
+ fetchState: 'Not-Started',
304
+ error: undefined,
305
+ },
306
+ updateChargeCardNameFetchState: {
307
+ fetchState: 'Not-Started',
308
+ error: undefined,
309
+ },
310
+ depositAccountLimitFetchState: {
311
+ fetchState: 'Not-Started',
312
+ error: undefined,
313
+ },
314
+ recurringExpenses: [],
315
+ recurringExpensesFetchState: {
316
+ fetchState: 'Not-Started',
317
+ error: undefined,
318
+ },
319
+ cardId: undefined,
320
+ chargeCard: undefined,
321
+ depositAccountLimit: undefined,
322
+ };
323
+ }
324
+ // Reconstruct a minimal state object for helper functions
325
+ const stateSubset = {
326
+ userState,
327
+ userRoleState,
328
+ classState,
329
+ addressState,
330
+ chargeCardDetailState,
331
+ chargeCardListState,
332
+ };
333
+ // Get charge card (base entity)
334
+ const chargeCardBase = (0, chargeCardSelector_1.getChargeCardById)(chargeCardState, rowActionCardId);
335
+ // Get enriched ChargeCardWithUser
336
+ let chargeCard = undefined;
337
+ if (chargeCardBase != null) {
338
+ const enrichedCards = getChargeCardsWithUser([chargeCardBase], stateSubset);
339
+ chargeCard = enrichedCards[0];
340
+ }
341
+ // Get control detail view
342
+ const controlDetailView = (0, chargeCardDetailSelector_1.getChargeCardControlDetailView)(stateSubset, rowActionCardId);
343
+ // Get deposit account limit (for debit cards)
344
+ let depositAccountLimit = undefined;
345
+ let depositAccountLimitFetchState = {
346
+ fetchState: 'Not-Started',
347
+ error: undefined,
348
+ };
349
+ if ((chargeCardBase === null || chargeCardBase === void 0 ? void 0 : chargeCardBase.type.code.includes('debit')) === true) {
350
+ depositAccountLimit =
351
+ (0, depositAccountSelector_1.getDepositAccountLimitForChargeCardByDepositAccountId)(depositAccountState, chargeCardBase.connectedAccountId);
352
+ depositAccountLimitFetchState =
353
+ (0, chargeCardDetailSelector_1.getDepositAccountLimitFetchStateByDepositAccountId)(stateSubset, chargeCardBase.connectedAccountId);
354
+ }
355
+ // Get recurring expenses
356
+ const recurringExpenses = (_a = chargeCardDetailState.recurringExpensesByChargeCardId[rowActionCardId]) !== null && _a !== void 0 ? _a : [];
357
+ const recurringExpensesFetchState = chargeCardDetailState.recurringExpensesFetchState;
358
+ return Object.assign(Object.assign({}, controlDetailView), { depositAccountLimitFetchState,
359
+ recurringExpenses, recurringExpensesFetchState: {
360
+ fetchState: recurringExpensesFetchState.fetchState,
361
+ error: recurringExpensesFetchState.error,
362
+ }, cardId: rowActionCardId, chargeCard,
363
+ depositAccountLimit });
364
+ });
365
+ // Selector to get bulkActionCardIds from state
366
+ const selectBulkActionCardIds = (state) => state.chargeCardListState.bulkActionCardIds;
367
+ /**
368
+ * Memoized selector that returns bulk action cards data
369
+ * Only recomputes when relevant parts of state change
370
+ */
371
+ exports.getChargeCardBulkActionView = (0, toolkit_1.createSelector)([
372
+ selectBulkActionCardIds,
373
+ selectChargeCardState,
374
+ selectChargeCardDetailState,
375
+ (state) => state.userState,
376
+ (state) => state.userRoleState,
377
+ (state) => state.classState,
378
+ (state) => state.addressState,
379
+ ], (bulkActionCardIds, chargeCardState, chargeCardDetailState, userState, userRoleState, classState, addressState) => {
380
+ // If no cards selected, return empty state
381
+ if (bulkActionCardIds.length === 0) {
382
+ return {
383
+ bulkActionCardIds: [],
384
+ chargeCards: [],
385
+ hasCreditCards: false,
386
+ hasDebitCards: false,
387
+ recurringExpensesByCardId: {},
388
+ recurringExpensesFetchState: {
389
+ fetchState: 'Not-Started',
390
+ error: undefined,
391
+ },
392
+ };
393
+ }
394
+ // Reconstruct a minimal state object for helper functions
395
+ const stateSubset = {
396
+ userState,
397
+ userRoleState,
398
+ classState,
399
+ addressState,
400
+ };
401
+ // Get all selected charge cards (base entities)
402
+ const chargeCardsBase = bulkActionCardIds
403
+ .map((cardId) => (0, chargeCardSelector_1.getChargeCardById)(chargeCardState, cardId))
404
+ .filter((card) => card != null);
405
+ // Get enriched ChargeCardWithUser array
406
+ const chargeCards = getChargeCardsWithUser(chargeCardsBase, stateSubset);
407
+ // Get recurring expenses for all selected cards
408
+ const recurringExpensesByCardId = {};
409
+ bulkActionCardIds.forEach((cardId) => {
410
+ var _a;
411
+ recurringExpensesByCardId[cardId] =
412
+ (_a = chargeCardDetailState.recurringExpensesByChargeCardId[cardId]) !== null && _a !== void 0 ? _a : [];
413
+ });
414
+ // Determine if selection contains debit or credit cards
415
+ const hasDebitCards = chargeCards.some((card) => card.type.code.includes('debit'));
416
+ const hasCreditCards = chargeCards.some((card) => card.type.code.includes('credit'));
417
+ const recurringExpensesFetchState = chargeCardDetailState.recurringExpensesFetchState;
418
+ return {
419
+ bulkActionCardIds,
420
+ chargeCards,
421
+ hasCreditCards,
422
+ hasDebitCards,
423
+ recurringExpensesByCardId,
424
+ recurringExpensesFetchState: {
425
+ fetchState: recurringExpensesFetchState.fetchState,
426
+ error: recurringExpensesFetchState.error,
427
+ },
428
+ };
429
+ });
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateChargeCards } from '../../../../entity/chargeCard/chargeCardReducer';
4
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
+ import { RootState } from '../../../../reducer';
6
+ import { ZeniAPI } from '../../../../zeniAPI';
7
+ import { closeChargeCards, closeChargeCardsSuccessOrFailure } from './chargeCardListReducer';
8
+ export type ActionType = ReturnType<typeof closeChargeCards> | ReturnType<typeof closeChargeCardsSuccessOrFailure> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCards>;
9
+ export declare const closeChargeCardsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.closeChargeCardsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const chargeCardReducer_1 = require("../../../../entity/chargeCard/chargeCardReducer");
7
+ const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
+ const responsePayload_1 = require("../../../../responsePayload");
9
+ const chargeCardListReducer_1 = require("./chargeCardListReducer");
10
+ const closeChargeCardsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.closeChargeCards.match), (0, operators_1.switchMap)((action) => {
11
+ const { cardIds, reason } = action.payload;
12
+ const payload = {
13
+ card_ids: cardIds,
14
+ reason: reason,
15
+ };
16
+ return zeniAPI
17
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/bulk/close`, payload)
18
+ .pipe((0, operators_1.mergeMap)((response) => {
19
+ if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
20
+ return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCards)(response.data), (0, chargeCardListReducer_1.closeChargeCardsSuccessOrFailure)({
21
+ fetchState: 'Completed',
22
+ }), (0, snackbarReducer_1.openSnackbar)({
23
+ messageSection: 'close_charge_cards',
24
+ messageText: 'success',
25
+ type: 'success',
26
+ variables: [
27
+ {
28
+ variableName: '_number_of_cards_',
29
+ variableValue: cardIds.length === 1
30
+ ? '1 card'
31
+ : `${cardIds.length} cards`,
32
+ },
33
+ ],
34
+ }));
35
+ }
36
+ else {
37
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
38
+ messageSection: 'close_charge_cards',
39
+ messageText: 'failed',
40
+ type: 'error',
41
+ variables: [
42
+ {
43
+ variableName: '_api-error_',
44
+ variableValue: response.status.message,
45
+ },
46
+ ],
47
+ }), (0, chargeCardListReducer_1.closeChargeCardsSuccessOrFailure)({
48
+ fetchState: 'Error',
49
+ error: response.status,
50
+ }));
51
+ }
52
+ }), (0, operators_1.catchError)((error) => {
53
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
54
+ messageSection: 'close_charge_cards',
55
+ messageText: 'failed',
56
+ type: 'error',
57
+ variables: [
58
+ {
59
+ variableName: '_api-error_',
60
+ variableValue: JSON.stringify(error),
61
+ },
62
+ ],
63
+ }), (0, chargeCardListReducer_1.closeChargeCardsSuccessOrFailure)({
64
+ fetchState: 'Error',
65
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Close cards API call errored out' + JSON.stringify(error)),
66
+ }));
67
+ }));
68
+ }));
69
+ exports.closeChargeCardsEpic = closeChargeCardsEpic;
@@ -5,6 +5,8 @@ import { fetchClassList } from '../../../classList/classListReducer';
5
5
  import { fetchUserListByType } from '../../../userListView/userListViewReducer';
6
6
  import { fetchCashbackDetail } from '../cashbackDetail/cashbackDetailReducer';
7
7
  import { fetchChargeCardConfig } from '../chargeCardConfig/chargeCardConfigReducer';
8
+ import { fetchChargeCardSetupView } from '../chargeCardSetUp/chargeCardSetUpViewReducer';
9
+ import { fetchDepositAccountListForCards } from '../issueChargeCard/issueChargeCardReducer';
8
10
  import { fetchChargeCardList, fetchChargeCardListPage, fetchCreditAccount, fetchCreditAccountRepayment, fetchDebitCardSummary } from './chargeCardListReducer';
9
- export type ActionType = ReturnType<typeof fetchChargeCardListPage> | ReturnType<typeof fetchCreditAccount> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchCashbackDetail> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchDebitCardSummary> | ReturnType<typeof fetchCreditAccountRepayment>;
11
+ export type ActionType = ReturnType<typeof fetchChargeCardListPage> | ReturnType<typeof fetchCreditAccount> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchCashbackDetail> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchDebitCardSummary> | ReturnType<typeof fetchCreditAccountRepayment> | ReturnType<typeof fetchDepositAccountListForCards> | ReturnType<typeof fetchChargeCardSetupView>;
10
12
  export declare const fetchChargeCardListPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -3,10 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchChargeCardListPageEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
6
7
  const classListReducer_1 = require("../../../classList/classListReducer");
7
8
  const userListViewReducer_1 = require("../../../userListView/userListViewReducer");
8
9
  const cashbackDetailReducer_1 = require("../cashbackDetail/cashbackDetailReducer");
9
10
  const chargeCardConfigReducer_1 = require("../chargeCardConfig/chargeCardConfigReducer");
11
+ const chargeCardSetUpViewReducer_1 = require("../chargeCardSetUp/chargeCardSetUpViewReducer");
12
+ const issueChargeCardReducer_1 = require("../issueChargeCard/issueChargeCardReducer");
10
13
  const chargeCardListReducer_1 = require("./chargeCardListReducer");
11
14
  const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.fetchChargeCardListPage.match), (0, operators_1.mergeMap)((action) => {
12
15
  const { doFetchCreditAccountsDebitSummaryAndCashback, isDebitCardEnabled, isCreditCardEnabled, cacheOverride, } = action.payload;
@@ -80,6 +83,21 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
80
83
  'Completed') {
81
84
  chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchDebitCardSummary)());
82
85
  }
86
+ //Fetching deposit account list and charge card setup view for mix-panel events
87
+ if (doFetchCreditAccountsDebitSummaryAndCashback &&
88
+ isDebitCardEnabled &&
89
+ state.issueChargeCardState.depositAccountsFetchState.fetchState !==
90
+ 'In-Progress' &&
91
+ state.issueChargeCardState.depositAccountsFetchState.fetchState !==
92
+ 'Completed') {
93
+ chargeCardListPageAction.push((0, issueChargeCardReducer_1.fetchDepositAccountListForCards)());
94
+ }
95
+ if (doFetchCreditAccountsDebitSummaryAndCashback &&
96
+ state.chargeCardSetupViewState.fetchState !== 'In-Progress' &&
97
+ state.chargeCardSetupViewState.fetchState !== 'Completed') {
98
+ const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
99
+ chargeCardListPageAction.push((0, chargeCardSetUpViewReducer_1.fetchChargeCardSetupView)(currentTenant.companyId, true));
100
+ }
83
101
  }
84
102
  return (0, rxjs_1.concat)((0, rxjs_1.from)(chargeCardListPageAction));
85
103
  }));
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateChargeCards } from '../../../../entity/chargeCard/chargeCardReducer';
4
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
+ import { RootState } from '../../../../reducer';
6
+ import { ZeniAPI } from '../../../../zeniAPI';
7
+ import { lockChargeCards, lockChargeCardsSuccessOrFailure } from './chargeCardListReducer';
8
+ export type ActionType = ReturnType<typeof lockChargeCards> | ReturnType<typeof lockChargeCardsSuccessOrFailure> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCards>;
9
+ export declare const lockChargeCardsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lockChargeCardsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const chargeCardReducer_1 = require("../../../../entity/chargeCard/chargeCardReducer");
7
+ const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
+ const responsePayload_1 = require("../../../../responsePayload");
9
+ const chargeCardListReducer_1 = require("./chargeCardListReducer");
10
+ const lockChargeCardsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.lockChargeCards.match), (0, operators_1.switchMap)((action) => {
11
+ const { cardIds, reason } = action.payload;
12
+ const payload = {
13
+ card_ids: cardIds,
14
+ reason: reason,
15
+ };
16
+ return zeniAPI
17
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/bulk/lock`, payload)
18
+ .pipe((0, operators_1.mergeMap)((response) => {
19
+ if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
20
+ return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCards)(response.data), (0, chargeCardListReducer_1.lockChargeCardsSuccessOrFailure)({
21
+ fetchState: 'Completed',
22
+ }), (0, snackbarReducer_1.openSnackbar)({
23
+ messageSection: 'lock_charge_cards',
24
+ messageText: 'success',
25
+ type: 'success',
26
+ variables: [
27
+ {
28
+ variableName: '_number_of_cards_',
29
+ variableValue: cardIds.length === 1
30
+ ? '1 card'
31
+ : `${cardIds.length} cards`,
32
+ },
33
+ ],
34
+ }));
35
+ }
36
+ else {
37
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
38
+ messageSection: 'lock_charge_cards',
39
+ messageText: 'failed',
40
+ type: 'error',
41
+ variables: [
42
+ {
43
+ variableName: '_api-error_',
44
+ variableValue: response.status.message,
45
+ },
46
+ ],
47
+ }), (0, chargeCardListReducer_1.lockChargeCardsSuccessOrFailure)({
48
+ fetchState: 'Error',
49
+ error: response.status,
50
+ }));
51
+ }
52
+ }), (0, operators_1.catchError)((error) => {
53
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
54
+ messageSection: 'lock_charge_cards',
55
+ messageText: 'failed',
56
+ type: 'error',
57
+ variables: [
58
+ {
59
+ variableName: '_api-error_',
60
+ variableValue: JSON.stringify(error),
61
+ },
62
+ ],
63
+ }), (0, chargeCardListReducer_1.lockChargeCardsSuccessOrFailure)({
64
+ fetchState: 'Error',
65
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Lock cards API call errored out' + JSON.stringify(error)),
66
+ }));
67
+ }));
68
+ }));
69
+ exports.lockChargeCardsEpic = lockChargeCardsEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
+ import { RootState } from '../../../../reducer';
5
+ import { ZeniAPI } from '../../../../zeniAPI';
6
+ import { revokeChargeCardsInvite, revokeChargeCardsInviteSuccessOrFailure } from './chargeCardListReducer';
7
+ export type ActionType = ReturnType<typeof revokeChargeCardsInvite> | ReturnType<typeof revokeChargeCardsInviteSuccessOrFailure> | ReturnType<typeof openSnackbar>;
8
+ export declare const revokeChargeCardsInviteEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.revokeChargeCardsInviteEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
7
+ const responsePayload_1 = require("../../../../responsePayload");
8
+ const chargeCardListReducer_1 = require("./chargeCardListReducer");
9
+ const revokeChargeCardsInviteEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.revokeChargeCardsInvite.match), (0, operators_1.switchMap)((action) => {
10
+ const { cardIds } = action.payload;
11
+ const payload = {
12
+ card_ids: cardIds,
13
+ };
14
+ return zeniAPI
15
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/bulk/cancel-issue-request`, payload)
16
+ .pipe((0, operators_1.mergeMap)((response) => {
17
+ if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
18
+ return (0, rxjs_1.of)((0, chargeCardListReducer_1.revokeChargeCardsInviteSuccessOrFailure)({
19
+ fetchState: 'Completed',
20
+ revokedCardIds: cardIds,
21
+ }), (0, snackbarReducer_1.openSnackbar)({
22
+ messageSection: 'revoke_invite_charge_cards',
23
+ messageText: 'success',
24
+ type: 'success',
25
+ variables: [
26
+ {
27
+ variableName: '_number_of_cards_',
28
+ variableValue: cardIds.length === 1
29
+ ? '1 card'
30
+ : `${cardIds.length} cards`,
31
+ },
32
+ ],
33
+ }));
34
+ }
35
+ else {
36
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
37
+ messageSection: 'revoke_invite_charge_cards',
38
+ messageText: 'failed',
39
+ type: 'error',
40
+ variables: [
41
+ {
42
+ variableName: '_api-error_',
43
+ variableValue: response.status.message,
44
+ },
45
+ ],
46
+ }), (0, chargeCardListReducer_1.revokeChargeCardsInviteSuccessOrFailure)({
47
+ fetchState: 'Error',
48
+ error: response.status,
49
+ revokedCardIds: [],
50
+ }));
51
+ }
52
+ }), (0, operators_1.catchError)((error) => {
53
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
54
+ messageSection: 'revoke_invite_charge_cards',
55
+ messageText: 'failed',
56
+ type: 'error',
57
+ variables: [
58
+ {
59
+ variableName: '_api-error_',
60
+ variableValue: JSON.stringify(error),
61
+ },
62
+ ],
63
+ }), (0, chargeCardListReducer_1.revokeChargeCardsInviteSuccessOrFailure)({
64
+ fetchState: 'Error',
65
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Revoke invite charge cards API call errored out' +
66
+ JSON.stringify(error)),
67
+ revokedCardIds: [],
68
+ }));
69
+ }));
70
+ }));
71
+ exports.revokeChargeCardsInviteEpic = revokeChargeCardsInviteEpic;
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateChargeCards } from '../../../../entity/chargeCard/chargeCardReducer';
4
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
+ import { RootState } from '../../../../reducer';
6
+ import { ZeniAPI } from '../../../../zeniAPI';
7
+ import { unlockChargeCards, unlockChargeCardsSuccessOrFailure } from './chargeCardListReducer';
8
+ export type ActionType = ReturnType<typeof unlockChargeCards> | ReturnType<typeof unlockChargeCardsSuccessOrFailure> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCards>;
9
+ export declare const unlockChargeCardsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;