@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
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unlockChargeCardsEpic = 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 unlockChargeCardsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.unlockChargeCards.match), (0, operators_1.switchMap)((action) => {
11
+ const { cardIds } = action.payload;
12
+ const payload = {
13
+ card_ids: cardIds,
14
+ };
15
+ return zeniAPI
16
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/bulk/unlock`, payload)
17
+ .pipe((0, operators_1.mergeMap)((response) => {
18
+ if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
19
+ return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCards)(response.data), (0, chargeCardListReducer_1.unlockChargeCardsSuccessOrFailure)({
20
+ fetchState: 'Completed',
21
+ }), (0, snackbarReducer_1.openSnackbar)({
22
+ messageSection: 'unlock_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: 'unlock_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.unlockChargeCardsSuccessOrFailure)({
47
+ fetchState: 'Error',
48
+ error: response.status,
49
+ }));
50
+ }
51
+ }), (0, operators_1.catchError)((error) => {
52
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
53
+ messageSection: 'unlock_charge_cards',
54
+ messageText: 'failed',
55
+ type: 'error',
56
+ variables: [
57
+ {
58
+ variableName: '_api-error_',
59
+ variableValue: JSON.stringify(error),
60
+ },
61
+ ],
62
+ }), (0, chargeCardListReducer_1.unlockChargeCardsSuccessOrFailure)({
63
+ fetchState: 'Error',
64
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Unlock cards API call errored out' + JSON.stringify(error)),
65
+ }));
66
+ }));
67
+ }));
68
+ exports.unlockChargeCardsEpic = unlockChargeCardsEpic;
@@ -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 { updateChargeCardsSpendLimit, updateChargeCardsSpendLimitSuccessOrFailure } from './chargeCardListReducer';
8
+ export type ActionType = ReturnType<typeof updateChargeCardsSpendLimit> | ReturnType<typeof updateChargeCardsSpendLimitSuccessOrFailure> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCards>;
9
+ export declare const updateChargeCardsLimitEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateChargeCardsLimitEpic = 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 updateChargeCardsLimitEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.updateChargeCardsSpendLimit.match), (0, operators_1.switchMap)((action) => {
11
+ const { chargeCardIds, updatedSpendLimit, frequency } = action.payload;
12
+ const payload = {
13
+ card_ids: chargeCardIds,
14
+ limit_details: {
15
+ purchase_limit: updatedSpendLimit.amount,
16
+ currency_code: updatedSpendLimit.currencyCode,
17
+ purchase_limit_frequency: {
18
+ code: frequency,
19
+ },
20
+ },
21
+ };
22
+ return zeniAPI
23
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/bulk/modify_limit`, payload)
24
+ .pipe((0, operators_1.mergeMap)((response) => {
25
+ if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
26
+ return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCards)(response.data), (0, chargeCardListReducer_1.updateChargeCardsSpendLimitSuccessOrFailure)({
27
+ fetchState: 'Completed',
28
+ }), (0, snackbarReducer_1.openSnackbar)({
29
+ messageSection: 'charge_cards_update_limit',
30
+ messageText: 'success',
31
+ type: 'success',
32
+ variables: [
33
+ {
34
+ variableName: '_number_of_cards_',
35
+ variableValue: chargeCardIds.length === 1
36
+ ? '1 card'
37
+ : `${chargeCardIds.length} cards`,
38
+ },
39
+ ],
40
+ }));
41
+ }
42
+ else {
43
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
44
+ messageSection: 'charge_cards_update_limit',
45
+ messageText: 'failed',
46
+ type: 'error',
47
+ variables: [
48
+ {
49
+ variableName: '_api-error_',
50
+ variableValue: response.status.message,
51
+ },
52
+ ],
53
+ }), (0, chargeCardListReducer_1.updateChargeCardsSpendLimitSuccessOrFailure)({
54
+ fetchState: 'Error',
55
+ error: response.status,
56
+ }));
57
+ }
58
+ }), (0, operators_1.catchError)((error) => {
59
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
60
+ messageSection: 'charge_cards_update_limit',
61
+ messageText: 'failed',
62
+ type: 'error',
63
+ variables: [
64
+ {
65
+ variableName: '_api-error_',
66
+ variableValue: JSON.stringify(error),
67
+ },
68
+ ],
69
+ }), (0, chargeCardListReducer_1.updateChargeCardsSpendLimitSuccessOrFailure)({
70
+ fetchState: 'Error',
71
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update cards limit API call errored out' +
72
+ JSON.stringify(error)),
73
+ }));
74
+ }));
75
+ }));
76
+ exports.updateChargeCardsLimitEpic = updateChargeCardsLimitEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateTreasuryVideoViewedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { updateTreasuryVideoViewed, updateTreasuryVideoViewedFailure, updateTreasuryVideoViewedSuccess } from '../treasurySetupViewReducer';
7
+ export type ActionType = ReturnType<typeof updateTreasuryVideoViewed> | ReturnType<typeof updateTreasuryVideoViewedForLoggedInUser> | ReturnType<typeof updateTreasuryVideoViewedSuccess> | ReturnType<typeof updateTreasuryVideoViewedFailure>;
8
+ export declare const updateTreasuryVideoViewedEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateTreasuryVideoViewedEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const tenantReducer_1 = require("../../../../../entity/tenant/tenantReducer");
7
+ const responsePayload_1 = require("../../../../../responsePayload");
8
+ const treasurySetupViewReducer_1 = require("../treasurySetupViewReducer");
9
+ const updateTreasuryVideoViewedEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(treasurySetupViewReducer_1.updateTreasuryVideoViewed.match), (0, operators_1.switchMap)(() => {
10
+ return zeniAPI
11
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_played: true })
12
+ .pipe((0, operators_1.mergeMap)((response) => {
13
+ if ((0, responsePayload_1.isSuccessStatus)(response)) {
14
+ return (0, rxjs_1.of)((0, tenantReducer_1.updateTreasuryVideoViewedForLoggedInUser)(), (0, treasurySetupViewReducer_1.updateTreasuryVideoViewedSuccess)());
15
+ }
16
+ else {
17
+ return (0, rxjs_1.of)((0, treasurySetupViewReducer_1.updateTreasuryVideoViewedFailure)(response.status));
18
+ }
19
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, treasurySetupViewReducer_1.updateTreasuryVideoViewedFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update treasury video viewed REST API call errored out' +
20
+ JSON.stringify(error))))));
21
+ }));
22
+ exports.updateTreasuryVideoViewedEpic = updateTreasuryVideoViewedEpic;
@@ -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">, updateTreasuryVideoViewed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/updateTreasuryVideoViewed">, updateTreasuryVideoViewedSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/updateTreasuryVideoViewedSuccess">, updateTreasuryVideoViewedFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/updateTreasuryVideoViewedFailure">;
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.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;
7
+ exports.updateTreasuryVideoViewedFailure = exports.updateTreasuryVideoViewedSuccess = exports.updateTreasuryVideoViewed = 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,6 +40,10 @@ exports.initialState = {
40
40
  fetchState: 'Not-Started',
41
41
  error: undefined,
42
42
  },
43
+ updateTreasuryVideoViewedStatus: {
44
+ fetchState: 'Not-Started',
45
+ error: undefined,
46
+ },
43
47
  hasValidState() {
44
48
  return this.fetchState === 'Completed';
45
49
  },
@@ -258,12 +262,30 @@ const treasurySetupView = (0, toolkit_1.createSlice)({
258
262
  updateFundAllocationLocalData(draft, action) {
259
263
  draft.fundAllocationLocalData = action.payload;
260
264
  },
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
+ },
261
283
  clearTreasurySetupView(draft) {
262
284
  Object.assign(draft, exports.initialState);
263
285
  },
264
286
  },
265
287
  });
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;
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, exports.updateTreasuryVideoViewed = _a.updateTreasuryVideoViewed, exports.updateTreasuryVideoViewedSuccess = _a.updateTreasuryVideoViewedSuccess, exports.updateTreasuryVideoViewedFailure = _a.updateTreasuryVideoViewedFailure;
267
289
  exports.default = treasurySetupView.reducer;
268
290
  function mapTreasuryFundsPayloadToFundData(fundsPayload) {
269
291
  return fundsPayload.funds.map((fund) => ({
@@ -16,6 +16,7 @@ export interface TreasurySetupViewState extends FetchedState {
16
16
  fundAllocationOptions: FundAllocationOption[];
17
17
  fundsDetails: FundData[];
18
18
  };
19
+ updateTreasuryVideoViewedStatus: FetchStateAndError;
19
20
  treasuryTermsDetails?: {
20
21
  fetchStatus: FetchStateAndError;
21
22
  };
@@ -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" | "treasury_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" | "treasury_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,8 +41,19 @@ export declare class ZeniAPIClient implements ZeniAPI {
41
41
  userId?: string | undefined;
42
42
  sessionId?: string | undefined;
43
43
  tenantId?: string | undefined;
44
- constructor(apiEndPoints: RESTAPIEndpoints, userId?: string | undefined, sessionId?: string | undefined, tenantId?: string | undefined);
44
+ private readonly onSessionInvalidated?;
45
+ private sessionInvalidationTriggered;
46
+ constructor(apiEndPoints: RESTAPIEndpoints, userId?: string | undefined, sessionId?: string | undefined, tenantId?: string | undefined, onSessionInvalidated?: (() => void) | undefined);
45
47
  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;
46
57
  getJSON<T>(restEndPoint: string, headers?: Record<string, unknown>, signal?: AbortSignal): Observable<T>;
47
58
  postJSON(restEndPoint: string, body?: Record<string, unknown>, headers?: Record<string, unknown>, signal?: AbortSignal): Observable<FetchResponse>;
48
59
  postAndGetJSON<T>(restEndPoint: string, body?: Record<string, unknown>, headers?: Record<string, unknown>, signal?: AbortSignal): Observable<T>;
package/lib/zeniAPI.js CHANGED
@@ -3,12 +3,15 @@ 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");
6
7
  class ZeniAPIClient {
7
- constructor(apiEndPoints, userId, sessionId, tenantId) {
8
+ constructor(apiEndPoints, userId, sessionId, tenantId, onSessionInvalidated) {
8
9
  this.apiEndPoints = apiEndPoints;
9
10
  this.userId = userId;
10
11
  this.sessionId = sessionId;
11
12
  this.tenantId = tenantId;
13
+ this.onSessionInvalidated = onSessionInvalidated;
14
+ this.sessionInvalidationTriggered = false;
12
15
  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);
13
16
  }
14
17
  update(userId, sessionId, tenantId) {
@@ -16,12 +19,36 @@ class ZeniAPIClient {
16
19
  this.sessionId = sessionId;
17
20
  this.tenantId = tenantId;
18
21
  }
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
+ }
19
46
  getJSON(restEndPoint, headers, signal) {
20
47
  const promise = (0, cross_fetch_1.fetch)(restEndPoint, {
21
48
  method: 'GET',
22
49
  headers: this.apiHeaders(headers),
23
50
  signal,
24
- }).then((response) => response.json());
51
+ }).then((response) => this.processJsonResponse(response));
25
52
  return (0, rxjs_1.from)(promise);
26
53
  }
27
54
  postJSON(restEndPoint, body, headers, signal) {
@@ -39,7 +66,7 @@ class ZeniAPIClient {
39
66
  body: body != null ? JSON.stringify(body) : undefined,
40
67
  headers: Object.assign({ 'Content-Type': 'application/json' }, this.apiHeaders(headers)),
41
68
  signal,
42
- }).then((response) => response.json());
69
+ }).then((response) => this.processJsonResponse(response));
43
70
  return (0, rxjs_1.from)(promise);
44
71
  }
45
72
  deleteAndGetJSON(restEndPoint, body, headers, signal) {
@@ -52,7 +79,7 @@ class ZeniAPIClient {
52
79
  body: body != null ? JSON.stringify(body) : undefined,
53
80
  headers: apiHeaders,
54
81
  signal,
55
- }).then((response) => response.json());
82
+ }).then((response) => this.processJsonResponse(response));
56
83
  return (0, rxjs_1.from)(promise);
57
84
  }
58
85
  putAndGetJSON(restEndPoint, body, headers, signal) {
@@ -61,7 +88,7 @@ class ZeniAPIClient {
61
88
  body: body != null ? JSON.stringify(body) : undefined,
62
89
  headers: Object.assign({ 'Content-Type': 'application/json' }, this.apiHeaders(headers)),
63
90
  signal,
64
- }).then((response) => response.json());
91
+ }).then((response) => this.processJsonResponse(response));
65
92
  return (0, rxjs_1.from)(promise);
66
93
  }
67
94
  patchAndGetJSON(restEndPoint, body, headers, signal) {
@@ -70,7 +97,7 @@ class ZeniAPIClient {
70
97
  body: body != null ? JSON.stringify(body) : undefined,
71
98
  headers: Object.assign({ 'Content-Type': 'application/json' }, this.apiHeaders(headers)),
72
99
  signal,
73
- }).then((response) => response.json());
100
+ }).then((response) => this.processJsonResponse(response));
74
101
  return (0, rxjs_1.from)(promise);
75
102
  }
76
103
  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.91",
3
+ "version": "4.18.92",
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",