@zeniai/client-epic-state 4.18.92 → 4.18.93
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 +8 -34
- 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/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +1 -3
- package/lib/view/expenseAutomationView/helpers/helpers.d.ts +3 -3
- package/lib/view/expenseAutomationView/helpers/helpers.js +4 -4
- package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +6 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +64 -46
- 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
|
@@ -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.93",
|
|
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>;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.closeChargeCardEpic = 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 chargeCardDetailReducer_1 = require("./chargeCardDetailReducer");
|
|
10
|
-
const closeChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardDetailReducer_1.closeChargeCard.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
-
const { chargeCardId, reason } = action.payload;
|
|
12
|
-
const payload = {
|
|
13
|
-
reason: reason,
|
|
14
|
-
};
|
|
15
|
-
const cardDetail = state$.value.chargeCardState.chargeCardByID[chargeCardId];
|
|
16
|
-
const accountLast4 = cardDetail.accountLast4;
|
|
17
|
-
return zeniAPI
|
|
18
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${chargeCardId}/close`, payload)
|
|
19
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
-
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
21
|
-
return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCard)(response.data), (0, chargeCardDetailReducer_1.closeChargeCardSuccessOrFailure)({
|
|
22
|
-
chargeCardId,
|
|
23
|
-
fetchState: 'Completed',
|
|
24
|
-
}), (0, snackbarReducer_1.openSnackbar)({
|
|
25
|
-
messageSection: 'close_charge_card',
|
|
26
|
-
messageText: 'success',
|
|
27
|
-
type: 'success',
|
|
28
|
-
variables: [
|
|
29
|
-
{
|
|
30
|
-
variableName: '_masked_card_number_',
|
|
31
|
-
variableValue: `•••• ${accountLast4}`,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
38
|
-
messageSection: 'close_charge_card',
|
|
39
|
-
messageText: 'failed',
|
|
40
|
-
type: 'error',
|
|
41
|
-
variables: [
|
|
42
|
-
{
|
|
43
|
-
variableName: '_api-error_',
|
|
44
|
-
variableValue: response.status.message,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
}), (0, chargeCardDetailReducer_1.closeChargeCardSuccessOrFailure)({
|
|
48
|
-
chargeCardId,
|
|
49
|
-
fetchState: 'Error',
|
|
50
|
-
error: response.status,
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
}), (0, operators_1.catchError)((error) => {
|
|
54
|
-
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
55
|
-
messageSection: 'close_charge_card',
|
|
56
|
-
messageText: 'failed',
|
|
57
|
-
type: 'error',
|
|
58
|
-
variables: [
|
|
59
|
-
{
|
|
60
|
-
variableName: '_api-error_',
|
|
61
|
-
variableValue: JSON.stringify(error),
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
}), (0, chargeCardDetailReducer_1.closeChargeCardSuccessOrFailure)({
|
|
65
|
-
chargeCardId,
|
|
66
|
-
fetchState: 'Error',
|
|
67
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Close card API call errored out' + JSON.stringify(error)),
|
|
68
|
-
}));
|
|
69
|
-
}));
|
|
70
|
-
}));
|
|
71
|
-
exports.closeChargeCardEpic = closeChargeCardEpic;
|
|
@@ -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 { fetchChargeCardsRecurringExpenses, updateChargeCardsRecurringExpenses, updateChargeCardsRecurringExpensesFetchState } from './chargeCardDetailReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchChargeCardsRecurringExpenses> | ReturnType<typeof updateChargeCardsRecurringExpenses> | ReturnType<typeof updateChargeCardsRecurringExpensesFetchState>;
|
|
7
|
-
export declare const fetchChargeCardsRecurringExpensesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchChargeCardsRecurringExpensesEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
-
const chargeCardDetail_1 = require("./chargeCardDetail");
|
|
8
|
-
const chargeCardDetailReducer_1 = require("./chargeCardDetailReducer");
|
|
9
|
-
const fetchChargeCardsRecurringExpensesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardDetailReducer_1.fetchChargeCardsRecurringExpenses.match), (0, operators_1.switchMap)((action) => {
|
|
10
|
-
const { cardIds } = action.payload;
|
|
11
|
-
const query = {
|
|
12
|
-
card_ids: cardIds,
|
|
13
|
-
};
|
|
14
|
-
return zeniAPI
|
|
15
|
-
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/recurring-expenses?query=${encodeURIComponent(JSON.stringify(query))}`)
|
|
16
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
-
const recurringExpensesByChargeCardId = {};
|
|
19
|
-
response.data.forEach((cardRecurringExpense) => {
|
|
20
|
-
recurringExpensesByChargeCardId[cardRecurringExpense.card_id] =
|
|
21
|
-
cardRecurringExpense.expenses.map((expense) => (0, chargeCardDetail_1.mapRecurringExpensePayloadToRecurringExpense)(expense));
|
|
22
|
-
});
|
|
23
|
-
return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardsRecurringExpenses)({
|
|
24
|
-
recurringExpensesByChargeCardId,
|
|
25
|
-
}), (0, chargeCardDetailReducer_1.updateChargeCardsRecurringExpensesFetchState)({
|
|
26
|
-
fetchState: 'Completed',
|
|
27
|
-
error: undefined,
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardsRecurringExpensesFetchState)({
|
|
32
|
-
fetchState: 'Error',
|
|
33
|
-
error: response.status,
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
}), (0, operators_1.catchError)((error) => {
|
|
37
|
-
return (0, rxjs_1.of)((0, chargeCardDetailReducer_1.updateChargeCardsRecurringExpensesFetchState)({
|
|
38
|
-
fetchState: 'Error',
|
|
39
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Charge Cards Recurring Expenses REST API call errored out' +
|
|
40
|
-
JSON.stringify(error)),
|
|
41
|
-
}));
|
|
42
|
-
}));
|
|
43
|
-
}));
|
|
44
|
-
exports.fetchChargeCardsRecurringExpensesEpic = fetchChargeCardsRecurringExpensesEpic;
|
|
@@ -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 { lockChargeCard, lockChargeCardSuccessOrFailure } from './chargeCardDetailReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof lockChargeCard> | ReturnType<typeof lockChargeCardSuccessOrFailure> | ReturnType<typeof updateChargeCard>;
|
|
9
|
-
export declare const lockChargeCardEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lockChargeCardEpic = 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 chargeCardDetailReducer_1 = require("./chargeCardDetailReducer");
|
|
10
|
-
const lockChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardDetailReducer_1.lockChargeCard.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
-
var _a;
|
|
12
|
-
const { chargeCardId, reason, isChargeCardAdmin } = action.payload;
|
|
13
|
-
const payload = {
|
|
14
|
-
reason: reason,
|
|
15
|
-
};
|
|
16
|
-
const cardDetail = state$.value.chargeCardState.chargeCardByID[chargeCardId];
|
|
17
|
-
const accountLast4 = (_a = cardDetail === null || cardDetail === void 0 ? void 0 : cardDetail.accountLast4) !== null && _a !== void 0 ? _a : '';
|
|
18
|
-
return zeniAPI
|
|
19
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${chargeCardId}/lock`, payload)
|
|
20
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
21
|
-
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
22
|
-
return (0, rxjs_1.of)((0, chargeCardReducer_1.updateChargeCard)(response.data), (0, chargeCardDetailReducer_1.lockChargeCardSuccessOrFailure)({
|
|
23
|
-
chargeCardId,
|
|
24
|
-
fetchState: 'Completed',
|
|
25
|
-
}), (0, snackbarReducer_1.openSnackbar)({
|
|
26
|
-
messageSection: isChargeCardAdmin
|
|
27
|
-
? 'lock_charge_card'
|
|
28
|
-
: 'lock_charge_card_card_user',
|
|
29
|
-
messageText: 'success',
|
|
30
|
-
type: 'success',
|
|
31
|
-
variables: [
|
|
32
|
-
{
|
|
33
|
-
variableName: '_masked_card_number_',
|
|
34
|
-
variableValue: `•••• ${accountLast4}`,
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
41
|
-
messageSection: isChargeCardAdmin
|
|
42
|
-
? 'lock_charge_card'
|
|
43
|
-
: 'lock_charge_card_card_user',
|
|
44
|
-
messageText: 'failed',
|
|
45
|
-
type: 'error',
|
|
46
|
-
variables: [
|
|
47
|
-
{
|
|
48
|
-
variableName: '_api-error_',
|
|
49
|
-
variableValue: response.status.message,
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
}), (0, chargeCardDetailReducer_1.lockChargeCardSuccessOrFailure)({
|
|
53
|
-
chargeCardId,
|
|
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: isChargeCardAdmin
|
|
61
|
-
? 'lock_charge_card'
|
|
62
|
-
: 'lock_charge_card_card_user',
|
|
63
|
-
messageText: 'failed',
|
|
64
|
-
type: 'error',
|
|
65
|
-
variables: [
|
|
66
|
-
{
|
|
67
|
-
variableName: '_api-error_',
|
|
68
|
-
variableValue: JSON.stringify(error),
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
}), (0, chargeCardDetailReducer_1.lockChargeCardSuccessOrFailure)({
|
|
72
|
-
chargeCardId,
|
|
73
|
-
fetchState: 'Error',
|
|
74
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Lock card API call errored out' + JSON.stringify(error)),
|
|
75
|
-
}));
|
|
76
|
-
}));
|
|
77
|
-
}));
|
|
78
|
-
exports.lockChargeCardEpic = lockChargeCardEpic;
|
|
@@ -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 { unlockChargeCard, unlockChargeCardSuccessOrFailure } from './chargeCardDetailReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof unlockChargeCard> | ReturnType<typeof unlockChargeCardSuccessOrFailure> | ReturnType<typeof updateChargeCard>;
|
|
9
|
-
export declare const unlockChargeCardEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unlockChargeCardEpic = 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 chargeCardDetailReducer_1 = require("./chargeCardDetailReducer");
|
|
10
|
-
const unlockChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardDetailReducer_1.unlockChargeCard.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
-
var _a;
|
|
12
|
-
const { isChargeCardAdmin, chargeCardId } = action.payload;
|
|
13
|
-
const cardDetail = state$.value.chargeCardState.chargeCardByID[chargeCardId];
|
|
14
|
-
const accountLast4 = (_a = cardDetail === null || cardDetail === void 0 ? void 0 : cardDetail.accountLast4) !== null && _a !== void 0 ? _a : '';
|
|
15
|
-
return zeniAPI
|
|
16
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/${chargeCardId}/unlock`)
|
|
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.updateChargeCard)(response.data), (0, chargeCardDetailReducer_1.unlockChargeCardSuccessOrFailure)({
|
|
20
|
-
chargeCardId,
|
|
21
|
-
fetchState: 'Completed',
|
|
22
|
-
}), (0, snackbarReducer_1.openSnackbar)({
|
|
23
|
-
messageSection: isChargeCardAdmin
|
|
24
|
-
? 'unlock_charge_card'
|
|
25
|
-
: 'unlock_charge_card_card_user',
|
|
26
|
-
messageText: 'success',
|
|
27
|
-
type: 'success',
|
|
28
|
-
variables: [
|
|
29
|
-
{
|
|
30
|
-
variableName: '_masked_card_number_',
|
|
31
|
-
variableValue: `•••• ${accountLast4}`,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
38
|
-
messageSection: isChargeCardAdmin
|
|
39
|
-
? 'unlock_charge_card'
|
|
40
|
-
: 'unlock_charge_card_card_user',
|
|
41
|
-
messageText: 'failed',
|
|
42
|
-
type: 'error',
|
|
43
|
-
variables: [
|
|
44
|
-
{
|
|
45
|
-
variableName: '_api-error_',
|
|
46
|
-
variableValue: response.status.message,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
}), (0, chargeCardDetailReducer_1.unlockChargeCardSuccessOrFailure)({
|
|
50
|
-
chargeCardId,
|
|
51
|
-
fetchState: 'Error',
|
|
52
|
-
error: response.status,
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
}), (0, operators_1.catchError)((error) => {
|
|
56
|
-
return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
|
|
57
|
-
messageSection: isChargeCardAdmin
|
|
58
|
-
? 'unlock_charge_card'
|
|
59
|
-
: 'unlock_charge_card_card_user',
|
|
60
|
-
messageText: 'failed',
|
|
61
|
-
type: 'error',
|
|
62
|
-
variables: [
|
|
63
|
-
{
|
|
64
|
-
variableName: '_api-error_',
|
|
65
|
-
variableValue: JSON.stringify(error),
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
}), (0, chargeCardDetailReducer_1.unlockChargeCardSuccessOrFailure)({
|
|
69
|
-
chargeCardId,
|
|
70
|
-
fetchState: 'Error',
|
|
71
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Unlock card API call errored out' + JSON.stringify(error)),
|
|
72
|
-
}));
|
|
73
|
-
}));
|
|
74
|
-
}));
|
|
75
|
-
exports.unlockChargeCardEpic = unlockChargeCardEpic;
|
|
@@ -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 { updateChargeCardName, updateChargeCardNameSuccessOrFailure } from './chargeCardDetailReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardName> | ReturnType<typeof updateChargeCardNameSuccessOrFailure> | ReturnType<typeof updateChargeCard>;
|
|
9
|
-
export declare const updateChargeCardNameEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|