@zeniai/client-epic-state 4.18.89 → 4.18.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonStateTypes/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +0 -4
- package/lib/commonStateTypes/classesView/getNestedClassIDHierarchyForReport.js +0 -2
- package/lib/commonStateTypes/classesView/nestedClassID.d.ts +0 -1
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCard.d.ts +1 -2
- package/lib/entity/chargeCard/chargeCard.js +0 -2
- package/lib/entity/chargeCard/chargeCardPayload.d.ts +1 -2
- package/lib/entity/chargeCard/chargeCardPayload.js +9 -10
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionPayload.d.ts +2 -1
- package/lib/entity/class/classPayload.d.ts +0 -1
- package/lib/entity/class/classPayload.js +9 -9
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -2
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +0 -8
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +0 -14
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +0 -8
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -12
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.d.ts +1 -1
- package/lib/entity/tenant/tenantReducer.js +2 -8
- package/lib/entity/tenant/tenantState.d.ts +0 -1
- package/lib/epic.d.ts +1 -13
- package/lib/epic.js +1 -13
- package/lib/index.d.ts +12 -14
- package/lib/index.js +30 -53
- package/lib/init.d.ts +1 -2
- package/lib/init.js +2 -3
- package/lib/responsePayload.d.ts +0 -3
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/classList/classListReducer.d.ts +1 -3
- package/lib/view/classList/classListReducer.js +3 -8
- package/lib/view/classList/fetchClassListEpic.js +2 -6
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +1 -2
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +2 -10
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportViewEpic.js +4 -2
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/dashboard/dashboardSelector.d.ts +1 -2
- package/lib/view/dashboard/dashboardSelector.js +6 -14
- package/lib/view/dashboardLayout/dashboardLayoutReducer.js +0 -1
- package/lib/view/dashboardLayout/fetchDashboardLayoutEpic.js +1 -14
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +1 -1
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/monthEndCloseChecksView/epics/fetchMonthEndCloseChecksEpic.js +1 -1
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewPayload.d.ts +0 -8
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewReducer.d.ts +1 -11
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewReducer.js +3 -47
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.d.ts +0 -3
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.js +13 -18
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewState.d.ts +1 -7
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +4 -3
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +2 -17
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +3 -38
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +1 -11
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -40
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +26 -189
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +1 -19
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +12 -87
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.js +4 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +0 -7
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +0 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +4 -34
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +3 -142
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +0 -46
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +4 -198
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +0 -18
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +2 -24
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewState.d.ts +0 -1
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/zeniAPI.d.ts +1 -12
- package/lib/zeniAPI.js +6 -33
- package/package.json +1 -1
- package/lib/view/monthEndCloseChecksView/epics/fetchMonthClosePerformanceTrendEpic.d.ts +0 -7
- package/lib/view/monthEndCloseChecksView/epics/fetchMonthClosePerformanceTrendEpic.js +0 -47
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/closeChargeCardEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/closeChargeCardEpic.js +0 -71
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardsRecurringExpensesEpic.d.ts +0 -7
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardsRecurringExpensesEpic.js +0 -44
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/lockChargeCardEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/lockChargeCardEpic.js +0 -78
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/unlockChargeCardEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/unlockChargeCardEpic.js +0 -75
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardNameEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardNameEpic.js +0 -83
- package/lib/view/spendManagement/chargeCards/chargeCardList/closeChargeCardsEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardList/closeChargeCardsEpic.js +0 -69
- package/lib/view/spendManagement/chargeCards/chargeCardList/lockChargeCardsEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardList/lockChargeCardsEpic.js +0 -69
- package/lib/view/spendManagement/chargeCards/chargeCardList/revokeChargeCardsInviteEpic.d.ts +0 -8
- package/lib/view/spendManagement/chargeCards/chargeCardList/revokeChargeCardsInviteEpic.js +0 -71
- package/lib/view/spendManagement/chargeCards/chargeCardList/unlockChargeCardsEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardList/unlockChargeCardsEpic.js +0 -68
- package/lib/view/spendManagement/chargeCards/chargeCardList/updateChargeCardsLimitEpic.d.ts +0 -9
- package/lib/view/spendManagement/chargeCards/chargeCardList/updateChargeCardsLimitEpic.js +0 -76
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
|
@@ -3,8 +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.
|
|
7
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.getDebitCardSummary = exports.getDebitCardList = exports.getDepositAccountListWithDebitCardIssued = exports.getCreditAccountDetails = exports.anyCardOnHold = exports.getMyRequestOnHoldChargeCardListWithShippingAddress = exports.getMyPendingActivationChargeCardListView = exports.getChargeCardListView = void 0;
|
|
8
7
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
9
8
|
const sortOrderPayload_1 = require("../../../../commonPayloadTypes/sortOrderPayload");
|
|
10
9
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
@@ -15,7 +14,6 @@ const depositAccountSelector_1 = require("../../../../entity/depositAccount/depo
|
|
|
15
14
|
const userSelector_1 = require("../../../../entity/user/userSelector");
|
|
16
15
|
const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
|
|
17
16
|
const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
|
|
18
|
-
const chargeCardDetailSelector_1 = require("../chargeCardDetail/chargeCardDetailSelector");
|
|
19
17
|
const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbackInfo, isDebitCardEnabled, isCreditCardEnabled) => {
|
|
20
18
|
const { chargeCardListState, chargeCardState, classState, userState, userRoleState, chargeCardConfigState, classListState, cashbackDetailState, userListViewState, } = state;
|
|
21
19
|
const searchText = chargeCardListState.searchText.toLowerCase();
|
|
@@ -78,16 +76,11 @@ const getChargeCardListView = (state, includeCreditAccountDebitSummaryAndCashbac
|
|
|
78
76
|
userList,
|
|
79
77
|
allAccountingClasses,
|
|
80
78
|
issueCardPageFetchState,
|
|
81
|
-
closeChargeCardsFetchState: chargeCardListState.closeChargeCardsFetchState,
|
|
82
|
-
lockChargeCardsFetchState: chargeCardListState.lockChargeCardsFetchState,
|
|
83
|
-
resendCardInvite: chargeCardListState.resendCardInvite,
|
|
84
|
-
revokeCardInvite: chargeCardListState.revokeCardInvite,
|
|
85
|
-
revokeChargeCardsInviteFetchState: chargeCardListState.revokeChargeCardsInviteFetchState,
|
|
86
|
-
searchText,
|
|
87
|
-
unlockChargeCardsFetchState: chargeCardListState.unlockChargeCardsFetchState,
|
|
88
|
-
updateChargeCardsSpendLimitFetchState: chargeCardListState.updateChargeCardsSpendLimitFetchState,
|
|
89
79
|
uiState: chargeCardListState.uiState,
|
|
80
|
+
searchText,
|
|
90
81
|
version: '1.0',
|
|
82
|
+
resendCardInvite: chargeCardListState.resendCardInvite,
|
|
83
|
+
revokeCardInvite: chargeCardListState.revokeCardInvite,
|
|
91
84
|
debitCardSummary: chargeCardListState.debitCardSummaries,
|
|
92
85
|
hasCreditCard,
|
|
93
86
|
hasDebitCard,
|
|
@@ -240,190 +233,3 @@ const getCardsBySortKey = (card, sortKey) => {
|
|
|
240
233
|
return card.limit.amount;
|
|
241
234
|
}
|
|
242
235
|
};
|
|
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
|
-
});
|
package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ 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';
|
|
10
8
|
import { fetchChargeCardList, fetchChargeCardListPage, fetchCreditAccount, fetchCreditAccountRepayment, fetchDebitCardSummary } from './chargeCardListReducer';
|
|
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
|
|
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>;
|
|
12
10
|
export declare const fetchChargeCardListPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -3,13 +3,10 @@ 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");
|
|
7
6
|
const classListReducer_1 = require("../../../classList/classListReducer");
|
|
8
7
|
const userListViewReducer_1 = require("../../../userListView/userListViewReducer");
|
|
9
8
|
const cashbackDetailReducer_1 = require("../cashbackDetail/cashbackDetailReducer");
|
|
10
9
|
const chargeCardConfigReducer_1 = require("../chargeCardConfig/chargeCardConfigReducer");
|
|
11
|
-
const chargeCardSetUpViewReducer_1 = require("../chargeCardSetUp/chargeCardSetUpViewReducer");
|
|
12
|
-
const issueChargeCardReducer_1 = require("../issueChargeCard/issueChargeCardReducer");
|
|
13
10
|
const chargeCardListReducer_1 = require("./chargeCardListReducer");
|
|
14
11
|
const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.fetchChargeCardListPage.match), (0, operators_1.mergeMap)((action) => {
|
|
15
12
|
const { doFetchCreditAccountsDebitSummaryAndCashback, isDebitCardEnabled, isCreditCardEnabled, cacheOverride, } = action.payload;
|
|
@@ -83,21 +80,6 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
83
80
|
'Completed') {
|
|
84
81
|
chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchDebitCardSummary)());
|
|
85
82
|
}
|
|
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
|
-
}
|
|
101
83
|
}
|
|
102
84
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(chargeCardListPageAction));
|
|
103
85
|
}));
|
|
@@ -15,6 +15,6 @@ export declare const fetchTreasuryFunds: import("@reduxjs/toolkit").ActionCreato
|
|
|
15
15
|
}, "treasurySetupView/updatePortfolioAllocation", never, never>, updatePortfolioAllocationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<UpdatePortfolioAllocationPayload, "treasurySetupView/updatePortfolioAllocationSuccess">, updatePortfolioAllocationFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/updatePortfolioAllocationFailure", never, never>, fetchPortfolioAllocation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/fetchPortfolioAllocation">, fetchPortfolioAllocationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
16
16
|
allocation_percentages: Record<string, number>;
|
|
17
17
|
custom_corporate_id: string | null;
|
|
18
|
-
}, "treasurySetupView/fetchPortfolioAllocationSuccess">, fetchPortfolioAllocationFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/fetchPortfolioAllocationFailure">, updateFundAllocationLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<FundAllocationOption, "treasurySetupView/updateFundAllocationLocalData"
|
|
18
|
+
}, "treasurySetupView/fetchPortfolioAllocationSuccess">, fetchPortfolioAllocationFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/fetchPortfolioAllocationFailure">, updateFundAllocationLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<FundAllocationOption, "treasurySetupView/updateFundAllocationLocalData">;
|
|
19
19
|
declare const _default: import("redux").Reducer<TreasurySetupViewState>;
|
|
20
20
|
export default _default;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.updateFundAllocationLocalData = exports.fetchPortfolioAllocationFailure = exports.fetchPortfolioAllocationSuccess = exports.fetchPortfolioAllocation = exports.updatePortfolioAllocationFailure = exports.updatePortfolioAllocationSuccess = exports.updatePortfolioAllocation = exports.updateTreasuryFundsFailure = exports.updateTreasuryFundsSuccess = exports.clearTreasurySetupView = exports.acceptTreasuryTermsFailure = exports.acceptTreasuryTermsSuccess = exports.acceptTreasuryTerms = exports.fetchTreasurySetupViewFailure = exports.fetchTreasurySetupViewSuccess = exports.fetchTreasurySetupView = exports.fetchTreasuryFunds = exports.initialState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
10
10
|
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
@@ -40,10 +40,6 @@ exports.initialState = {
|
|
|
40
40
|
fetchState: 'Not-Started',
|
|
41
41
|
error: undefined,
|
|
42
42
|
},
|
|
43
|
-
updateTreasuryVideoViewedStatus: {
|
|
44
|
-
fetchState: 'Not-Started',
|
|
45
|
-
error: undefined,
|
|
46
|
-
},
|
|
47
43
|
hasValidState() {
|
|
48
44
|
return this.fetchState === 'Completed';
|
|
49
45
|
},
|
|
@@ -262,30 +258,12 @@ const treasurySetupView = (0, toolkit_1.createSlice)({
|
|
|
262
258
|
updateFundAllocationLocalData(draft, action) {
|
|
263
259
|
draft.fundAllocationLocalData = action.payload;
|
|
264
260
|
},
|
|
265
|
-
updateTreasuryVideoViewed(draft) {
|
|
266
|
-
draft.updateTreasuryVideoViewedStatus = {
|
|
267
|
-
fetchState: 'In-Progress',
|
|
268
|
-
error: undefined,
|
|
269
|
-
};
|
|
270
|
-
},
|
|
271
|
-
updateTreasuryVideoViewedSuccess(draft) {
|
|
272
|
-
draft.updateTreasuryVideoViewedStatus = {
|
|
273
|
-
fetchState: 'Completed',
|
|
274
|
-
error: undefined,
|
|
275
|
-
};
|
|
276
|
-
},
|
|
277
|
-
updateTreasuryVideoViewedFailure(draft, action) {
|
|
278
|
-
draft.updateTreasuryVideoViewedStatus = {
|
|
279
|
-
fetchState: 'Error',
|
|
280
|
-
error: action.payload,
|
|
281
|
-
};
|
|
282
|
-
},
|
|
283
261
|
clearTreasurySetupView(draft) {
|
|
284
262
|
Object.assign(draft, exports.initialState);
|
|
285
263
|
},
|
|
286
264
|
},
|
|
287
265
|
});
|
|
288
|
-
_a = treasurySetupView.actions, exports.fetchTreasuryFunds = _a.fetchTreasuryFunds, exports.fetchTreasurySetupView = _a.fetchTreasurySetupView, exports.fetchTreasurySetupViewSuccess = _a.fetchTreasurySetupViewSuccess, exports.fetchTreasurySetupViewFailure = _a.fetchTreasurySetupViewFailure, exports.acceptTreasuryTerms = _a.acceptTreasuryTerms, exports.acceptTreasuryTermsSuccess = _a.acceptTreasuryTermsSuccess, exports.acceptTreasuryTermsFailure = _a.acceptTreasuryTermsFailure, exports.clearTreasurySetupView = _a.clearTreasurySetupView, exports.updateTreasuryFundsSuccess = _a.updateTreasuryFundsSuccess, exports.updateTreasuryFundsFailure = _a.updateTreasuryFundsFailure, exports.updatePortfolioAllocation = _a.updatePortfolioAllocation, exports.updatePortfolioAllocationSuccess = _a.updatePortfolioAllocationSuccess, exports.updatePortfolioAllocationFailure = _a.updatePortfolioAllocationFailure, exports.fetchPortfolioAllocation = _a.fetchPortfolioAllocation, exports.fetchPortfolioAllocationSuccess = _a.fetchPortfolioAllocationSuccess, exports.fetchPortfolioAllocationFailure = _a.fetchPortfolioAllocationFailure, exports.updateFundAllocationLocalData = _a.updateFundAllocationLocalData
|
|
266
|
+
_a = treasurySetupView.actions, exports.fetchTreasuryFunds = _a.fetchTreasuryFunds, exports.fetchTreasurySetupView = _a.fetchTreasurySetupView, exports.fetchTreasurySetupViewSuccess = _a.fetchTreasurySetupViewSuccess, exports.fetchTreasurySetupViewFailure = _a.fetchTreasurySetupViewFailure, exports.acceptTreasuryTerms = _a.acceptTreasuryTerms, exports.acceptTreasuryTermsSuccess = _a.acceptTreasuryTermsSuccess, exports.acceptTreasuryTermsFailure = _a.acceptTreasuryTermsFailure, exports.clearTreasurySetupView = _a.clearTreasurySetupView, exports.updateTreasuryFundsSuccess = _a.updateTreasuryFundsSuccess, exports.updateTreasuryFundsFailure = _a.updateTreasuryFundsFailure, exports.updatePortfolioAllocation = _a.updatePortfolioAllocation, exports.updatePortfolioAllocationSuccess = _a.updatePortfolioAllocationSuccess, exports.updatePortfolioAllocationFailure = _a.updatePortfolioAllocationFailure, exports.fetchPortfolioAllocation = _a.fetchPortfolioAllocation, exports.fetchPortfolioAllocationSuccess = _a.fetchPortfolioAllocationSuccess, exports.fetchPortfolioAllocationFailure = _a.fetchPortfolioAllocationFailure, exports.updateFundAllocationLocalData = _a.updateFundAllocationLocalData;
|
|
289
267
|
exports.default = treasurySetupView.reducer;
|
|
290
268
|
function mapTreasuryFundsPayloadToFundData(fundsPayload) {
|
|
291
269
|
return fundsPayload.funds.map((fund) => ({
|
|
@@ -16,7 +16,6 @@ export interface TreasurySetupViewState extends FetchedState {
|
|
|
16
16
|
fundAllocationOptions: FundAllocationOption[];
|
|
17
17
|
fundsDetails: FundData[];
|
|
18
18
|
};
|
|
19
|
-
updateTreasuryVideoViewedStatus: FetchStateAndError;
|
|
20
19
|
treasuryTermsDetails?: {
|
|
21
20
|
fetchStatus: FetchStateAndError;
|
|
22
21
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RootState } from '../../reducer';
|
|
2
2
|
export declare const getTasksCardReport: (state: RootState) => {
|
|
3
|
-
reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card"
|
|
3
|
+
reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card";
|
|
4
4
|
reportTitle: string;
|
|
5
5
|
version: string | number | undefined;
|
|
6
6
|
status: import("../..").Status | undefined;
|
|
@@ -4,7 +4,7 @@ import { RootState } from '../../reducer';
|
|
|
4
4
|
import { TopExReport, TopExTimePeriodWithMetaData } from './topExSelectorTypes';
|
|
5
5
|
import { TopExState } from './topExState';
|
|
6
6
|
export declare const getTopExpenses: (accountState: AccountState, topExState: TopExState, numberOfExpenses?: number) => {
|
|
7
|
-
reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card"
|
|
7
|
+
reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card";
|
|
8
8
|
reportTitle: string;
|
|
9
9
|
version: string | number | undefined;
|
|
10
10
|
status: import("../..").Status | undefined;
|
package/lib/zeniAPI.d.ts
CHANGED
|
@@ -41,19 +41,8 @@ export declare class ZeniAPIClient implements ZeniAPI {
|
|
|
41
41
|
userId?: string | undefined;
|
|
42
42
|
sessionId?: string | undefined;
|
|
43
43
|
tenantId?: string | undefined;
|
|
44
|
-
|
|
45
|
-
private sessionInvalidationTriggered;
|
|
46
|
-
constructor(apiEndPoints: RESTAPIEndpoints, userId?: string | undefined, sessionId?: string | undefined, tenantId?: string | undefined, onSessionInvalidated?: (() => void) | undefined);
|
|
44
|
+
constructor(apiEndPoints: RESTAPIEndpoints, userId?: string | undefined, sessionId?: string | undefined, tenantId?: string | undefined);
|
|
47
45
|
update(userId?: string, sessionId?: string, tenantId?: string): void;
|
|
48
|
-
/**
|
|
49
|
-
* Check if the API response indicates an invalid session (401).
|
|
50
|
-
* If so, trigger the session invalidation callback once.
|
|
51
|
-
*/
|
|
52
|
-
private checkSessionValidity;
|
|
53
|
-
/**
|
|
54
|
-
* Parse JSON response and check for session validity.
|
|
55
|
-
*/
|
|
56
|
-
private processJsonResponse;
|
|
57
46
|
getJSON<T>(restEndPoint: string, headers?: Record<string, unknown>, signal?: AbortSignal): Observable<T>;
|
|
58
47
|
postJSON(restEndPoint: string, body?: Record<string, unknown>, headers?: Record<string, unknown>, signal?: AbortSignal): Observable<FetchResponse>;
|
|
59
48
|
postAndGetJSON<T>(restEndPoint: string, body?: Record<string, unknown>, headers?: Record<string, unknown>, signal?: AbortSignal): Observable<T>;
|
package/lib/zeniAPI.js
CHANGED
|
@@ -3,15 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZeniAPIClient = void 0;
|
|
4
4
|
const cross_fetch_1 = require("cross-fetch");
|
|
5
5
|
const rxjs_1 = require("rxjs");
|
|
6
|
-
const responsePayload_1 = require("./responsePayload");
|
|
7
6
|
class ZeniAPIClient {
|
|
8
|
-
constructor(apiEndPoints, userId, sessionId, tenantId
|
|
7
|
+
constructor(apiEndPoints, userId, sessionId, tenantId) {
|
|
9
8
|
this.apiEndPoints = apiEndPoints;
|
|
10
9
|
this.userId = userId;
|
|
11
10
|
this.sessionId = sessionId;
|
|
12
11
|
this.tenantId = tenantId;
|
|
13
|
-
this.onSessionInvalidated = onSessionInvalidated;
|
|
14
|
-
this.sessionInvalidationTriggered = false;
|
|
15
12
|
this.apiHeaders = (headers) => Object.assign({ 'Content-Type': 'application/json' }, this.userId != null ? { 'zeni-user-id': this.userId } : {}, this.sessionId != null ? { 'zeni-session-id': this.sessionId } : {}, this.tenantId != null ? { 'zeni-tenant-id': this.tenantId } : {}, headers);
|
|
16
13
|
}
|
|
17
14
|
update(userId, sessionId, tenantId) {
|
|
@@ -19,36 +16,12 @@ class ZeniAPIClient {
|
|
|
19
16
|
this.sessionId = sessionId;
|
|
20
17
|
this.tenantId = tenantId;
|
|
21
18
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Check if the API response indicates an invalid session (401).
|
|
24
|
-
* If so, trigger the session invalidation callback once.
|
|
25
|
-
*/
|
|
26
|
-
checkSessionValidity(response) {
|
|
27
|
-
if (this.sessionInvalidationTriggered ||
|
|
28
|
-
this.onSessionInvalidated == null) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const resp = response;
|
|
32
|
-
if ((0, responsePayload_1.isInvalidSessionError)(resp === null || resp === void 0 ? void 0 : resp.status)) {
|
|
33
|
-
this.sessionInvalidationTriggered = true;
|
|
34
|
-
this.onSessionInvalidated();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Parse JSON response and check for session validity.
|
|
39
|
-
*/
|
|
40
|
-
processJsonResponse(response) {
|
|
41
|
-
return response.json().then((json) => {
|
|
42
|
-
this.checkSessionValidity(json);
|
|
43
|
-
return json;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
19
|
getJSON(restEndPoint, headers, signal) {
|
|
47
20
|
const promise = (0, cross_fetch_1.fetch)(restEndPoint, {
|
|
48
21
|
method: 'GET',
|
|
49
22
|
headers: this.apiHeaders(headers),
|
|
50
23
|
signal,
|
|
51
|
-
}).then((response) =>
|
|
24
|
+
}).then((response) => response.json());
|
|
52
25
|
return (0, rxjs_1.from)(promise);
|
|
53
26
|
}
|
|
54
27
|
postJSON(restEndPoint, body, headers, signal) {
|
|
@@ -66,7 +39,7 @@ class ZeniAPIClient {
|
|
|
66
39
|
body: body != null ? JSON.stringify(body) : undefined,
|
|
67
40
|
headers: Object.assign({ 'Content-Type': 'application/json' }, this.apiHeaders(headers)),
|
|
68
41
|
signal,
|
|
69
|
-
}).then((response) =>
|
|
42
|
+
}).then((response) => response.json());
|
|
70
43
|
return (0, rxjs_1.from)(promise);
|
|
71
44
|
}
|
|
72
45
|
deleteAndGetJSON(restEndPoint, body, headers, signal) {
|
|
@@ -79,7 +52,7 @@ class ZeniAPIClient {
|
|
|
79
52
|
body: body != null ? JSON.stringify(body) : undefined,
|
|
80
53
|
headers: apiHeaders,
|
|
81
54
|
signal,
|
|
82
|
-
}).then((response) =>
|
|
55
|
+
}).then((response) => response.json());
|
|
83
56
|
return (0, rxjs_1.from)(promise);
|
|
84
57
|
}
|
|
85
58
|
putAndGetJSON(restEndPoint, body, headers, signal) {
|
|
@@ -88,7 +61,7 @@ class ZeniAPIClient {
|
|
|
88
61
|
body: body != null ? JSON.stringify(body) : undefined,
|
|
89
62
|
headers: Object.assign({ 'Content-Type': 'application/json' }, this.apiHeaders(headers)),
|
|
90
63
|
signal,
|
|
91
|
-
}).then((response) =>
|
|
64
|
+
}).then((response) => response.json());
|
|
92
65
|
return (0, rxjs_1.from)(promise);
|
|
93
66
|
}
|
|
94
67
|
patchAndGetJSON(restEndPoint, body, headers, signal) {
|
|
@@ -97,7 +70,7 @@ class ZeniAPIClient {
|
|
|
97
70
|
body: body != null ? JSON.stringify(body) : undefined,
|
|
98
71
|
headers: Object.assign({ 'Content-Type': 'application/json' }, this.apiHeaders(headers)),
|
|
99
72
|
signal,
|
|
100
|
-
}).then((response) =>
|
|
73
|
+
}).then((response) => response.json());
|
|
101
74
|
return (0, rxjs_1.from)(promise);
|
|
102
75
|
}
|
|
103
76
|
getFile(restEndPoint, headers, signal) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.91",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../reducer';
|
|
4
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
-
import { fetchMonthClosePerformanceTrend, updateMonthClosePerformanceTrend, updateMonthClosePerformanceTrendFetchStatus } from '../monthEndCloseChecksViewReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchMonthClosePerformanceTrend> | ReturnType<typeof updateMonthClosePerformanceTrendFetchStatus> | ReturnType<typeof updateMonthClosePerformanceTrend>;
|
|
7
|
-
export declare const fetchMonthClosePerformanceTrendEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchMonthClosePerformanceTrendEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const monthEndCloseChecksViewReducer_1 = require("../monthEndCloseChecksViewReducer");
|
|
8
|
-
const fetchMonthClosePerformanceTrendEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(monthEndCloseChecksViewReducer_1.fetchMonthClosePerformanceTrend.match), (0, operators_1.switchMap)((action) => {
|
|
9
|
-
const { period } = action.payload;
|
|
10
|
-
const month = String(period.month).padStart(2, '0');
|
|
11
|
-
const queryParam = {
|
|
12
|
-
month_and_year: `${month}-${period.year}`,
|
|
13
|
-
};
|
|
14
|
-
return zeniAPI
|
|
15
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/month-close/performance-trend?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
16
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
-
if (response.data != null) {
|
|
18
|
-
const actions = [
|
|
19
|
-
(0, monthEndCloseChecksViewReducer_1.updateMonthClosePerformanceTrend)({
|
|
20
|
-
performanceTrend: response.data.performance_trend,
|
|
21
|
-
period,
|
|
22
|
-
}),
|
|
23
|
-
];
|
|
24
|
-
return (0, rxjs_1.from)(actions);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
const actions = [
|
|
28
|
-
(0, monthEndCloseChecksViewReducer_1.updateMonthClosePerformanceTrendFetchStatus)({
|
|
29
|
-
period,
|
|
30
|
-
fetchState: 'Error',
|
|
31
|
-
error: response.status,
|
|
32
|
-
}),
|
|
33
|
-
];
|
|
34
|
-
return (0, rxjs_1.from)(actions);
|
|
35
|
-
}
|
|
36
|
-
}), (0, operators_1.catchError)((error) => {
|
|
37
|
-
const actions = [
|
|
38
|
-
(0, monthEndCloseChecksViewReducer_1.updateMonthClosePerformanceTrendFetchStatus)({
|
|
39
|
-
period,
|
|
40
|
-
fetchState: 'Error',
|
|
41
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', `Fetch Month close performance trend REST API call errored out: ${JSON.stringify(error)}`),
|
|
42
|
-
}),
|
|
43
|
-
];
|
|
44
|
-
return (0, rxjs_1.from)(actions);
|
|
45
|
-
}));
|
|
46
|
-
}));
|
|
47
|
-
exports.fetchMonthClosePerformanceTrendEpic = fetchMonthClosePerformanceTrendEpic;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateChargeCard } from '../../../../entity/chargeCard/chargeCardReducer';
|
|
4
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { RootState } from '../../../../reducer';
|
|
6
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
-
import { closeChargeCard, closeChargeCardSuccessOrFailure } from './chargeCardDetailReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof closeChargeCard> | ReturnType<typeof closeChargeCardSuccessOrFailure> | ReturnType<typeof updateChargeCard>;
|
|
9
|
-
export declare const closeChargeCardEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|