@zeniai/client-epic-state 5.1.80 → 5.1.81-betaAK1
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/viewAndReport/reportIDHelper.d.ts +1 -0
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +13 -1
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +3 -0
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +42 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +66 -1
- 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/sectionProjectView/sectionProjectView.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +21 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +5 -1
- package/lib/entity/tenant/clearAllEpic.js +8 -0
- package/lib/epic.d.ts +9 -1
- package/lib/epic.js +14 -1
- package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +11 -0
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +3 -0
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +61 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +21 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +8 -0
- package/lib/esm/epic.js +14 -1
- package/lib/esm/index.js +19 -4
- package/lib/esm/reducer.js +12 -0
- package/lib/esm/view/dashboard/dashboardSelector.js +14 -10
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +4 -18
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +6 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +1 -8
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +33 -9
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +35 -9
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +4 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +10 -11
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +8 -10
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +43 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +2 -5
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +1 -2
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +3 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +25 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +15 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.js +15 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.js +15 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.js +1 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +26 -0
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +18 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewPayload.js +47 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewReducer.js +128 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +20 -0
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewState.js +1 -0
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +4 -11
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +9 -12
- package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +0 -1
- package/lib/esm/view/invoicing/recordPayment/recordPaymentPayload.js +5 -14
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +26 -8
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/netBurnOrIncomeProjectView/netBurnOrIncomeForTimeframeProjectViewEpic.js +45 -0
- package/lib/esm/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewEpic.js +30 -0
- package/lib/esm/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewPayload.js +1 -0
- package/lib/esm/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewReducer.js +111 -0
- package/lib/esm/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewSelector.js +65 -0
- package/lib/esm/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewSelectorTypes.js +1 -0
- package/lib/esm/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewState.js +1 -0
- package/lib/esm/view/opExProjectView/opExForTimeframeProjectViewEpic.js +43 -0
- package/lib/esm/view/opExProjectView/opExProjectViewEpic.js +30 -0
- package/lib/esm/view/opExProjectView/opExProjectViewPayload.js +1 -0
- package/lib/esm/view/opExProjectView/opExProjectViewReducer.js +111 -0
- package/lib/esm/view/opExProjectView/opExProjectViewSelector.js +52 -0
- package/lib/esm/view/opExProjectView/opExProjectViewSelectorTypes.js +1 -0
- package/lib/esm/view/opExProjectView/opExProjectViewState.js +1 -0
- package/lib/esm/view/reportsResync/reportsClassViewRefetchingEpic.js +0 -4
- package/lib/esm/view/reportsResync/reportsProjectViewRefetchingEpic.js +30 -0
- package/lib/esm/view/reportsResync/reportsResyncEpic.js +11 -3
- package/lib/esm/view/reportsResync/reportsResyncReducer.js +9 -1
- package/lib/esm/view/revenueProjectView/revenueForTimeframeProjectViewEpic.js +35 -0
- package/lib/esm/view/revenueProjectView/revenueProjectViewEpic.js +30 -0
- package/lib/esm/view/revenueProjectView/revenueProjectViewPayload.js +1 -0
- package/lib/esm/view/revenueProjectView/revenueProjectViewReducer.js +111 -0
- package/lib/esm/view/revenueProjectView/revenueProjectViewSelector.js +58 -0
- package/lib/esm/view/revenueProjectView/revenueProjectViewSelectorTypes.js +1 -0
- package/lib/esm/view/revenueProjectView/revenueProjectViewState.js +1 -0
- package/lib/index.d.ts +29 -5
- package/lib/index.js +106 -51
- package/lib/reducer.d.ts +12 -0
- package/lib/reducer.js +12 -0
- 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/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/dashboard/dashboardSelector.d.ts +2 -3
- package/lib/view/dashboard/dashboardSelector.js +13 -9
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +3 -17
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +6 -1
- package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +1 -8
- package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +3 -1
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +2 -1
- package/lib/view/invoicing/discountAction/discountActionEpic.js +32 -8
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +2 -1
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +34 -8
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +4 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +10 -11
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +10 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +8 -10
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +2 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +3 -3
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +2 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.d.ts +9 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +45 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +2 -5
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +1 -2
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +4 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +6 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +4 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +3 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +4 -1
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +29 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +19 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboConnectionEpic.js +19 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboSyncHealthEpic.js +19 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.js +2 -0
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +30 -0
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.d.ts +6 -0
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +22 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewPayload.d.ts +79 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewPayload.js +52 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewReducer.d.ts +25 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewReducer.js +132 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +21 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +24 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewState.d.ts +14 -0
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewState.js +2 -0
- package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.js +4 -11
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +15 -7
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +11 -15
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteState.d.ts +3 -2
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +0 -1
- package/lib/view/invoicing/recordPayment/recordPaymentPayload.js +5 -14
- package/lib/view/invoicing/recordPayment/recordPaymentState.d.ts +4 -2
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +2 -1
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +25 -7
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +10 -1
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeForTimeframeProjectViewEpic.d.ts +9 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeForTimeframeProjectViewEpic.js +49 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewEpic.d.ts +6 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewEpic.js +34 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewPayload.d.ts +11 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewPayload.js +2 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewReducer.d.ts +33 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewReducer.js +115 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewSelector.d.ts +13 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewSelector.js +69 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewSelectorTypes.d.ts +21 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewSelectorTypes.js +2 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewState.d.ts +20 -0
- package/lib/view/netBurnOrIncomeProjectView/netBurnOrIncomeProjectViewState.js +2 -0
- package/lib/view/opExProjectView/opExForTimeframeProjectViewEpic.d.ts +9 -0
- package/lib/view/opExProjectView/opExForTimeframeProjectViewEpic.js +47 -0
- package/lib/view/opExProjectView/opExProjectViewEpic.d.ts +6 -0
- package/lib/view/opExProjectView/opExProjectViewEpic.js +34 -0
- package/lib/view/opExProjectView/opExProjectViewPayload.d.ts +6 -0
- package/lib/view/opExProjectView/opExProjectViewPayload.js +2 -0
- package/lib/view/opExProjectView/opExProjectViewReducer.d.ts +33 -0
- package/lib/view/opExProjectView/opExProjectViewReducer.js +115 -0
- package/lib/view/opExProjectView/opExProjectViewSelector.d.ts +12 -0
- package/lib/view/opExProjectView/opExProjectViewSelector.js +56 -0
- package/lib/view/opExProjectView/opExProjectViewSelectorTypes.d.ts +19 -0
- package/lib/view/opExProjectView/opExProjectViewSelectorTypes.js +2 -0
- package/lib/view/opExProjectView/opExProjectViewState.d.ts +20 -0
- package/lib/view/opExProjectView/opExProjectViewState.js +2 -0
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsClassViewRefetchingEpic.d.ts +1 -2
- package/lib/view/reportsResync/reportsClassViewRefetchingEpic.js +0 -4
- package/lib/view/reportsResync/reportsProjectViewRefetchingEpic.d.ts +10 -0
- package/lib/view/reportsResync/reportsProjectViewRefetchingEpic.js +34 -0
- package/lib/view/reportsResync/reportsResyncEpic.d.ts +2 -2
- package/lib/view/reportsResync/reportsResyncEpic.js +10 -2
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +5 -3
- package/lib/view/reportsResync/reportsResyncReducer.js +10 -2
- package/lib/view/revenueProjectView/revenueForTimeframeProjectViewEpic.d.ts +9 -0
- package/lib/view/revenueProjectView/revenueForTimeframeProjectViewEpic.js +39 -0
- package/lib/view/revenueProjectView/revenueProjectViewEpic.d.ts +6 -0
- package/lib/view/revenueProjectView/revenueProjectViewEpic.js +34 -0
- package/lib/view/revenueProjectView/revenueProjectViewPayload.d.ts +9 -0
- package/lib/view/revenueProjectView/revenueProjectViewPayload.js +2 -0
- package/lib/view/revenueProjectView/revenueProjectViewReducer.d.ts +33 -0
- package/lib/view/revenueProjectView/revenueProjectViewReducer.js +115 -0
- package/lib/view/revenueProjectView/revenueProjectViewSelector.d.ts +12 -0
- package/lib/view/revenueProjectView/revenueProjectViewSelector.js +62 -0
- package/lib/view/revenueProjectView/revenueProjectViewSelectorTypes.d.ts +19 -0
- package/lib/view/revenueProjectView/revenueProjectViewSelectorTypes.js +2 -0
- package/lib/view/revenueProjectView/revenueProjectViewState.d.ts +20 -0
- package/lib/view/revenueProjectView/revenueProjectViewState.js +2 -0
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/package.json +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.js +0 -44
- package/lib/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.d.ts +0 -5
- package/lib/view/invoicing/editInvoicingCouponDetailView/invoicingCouponFormConfig.js +0 -48
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingCoupons } from '../../../entity/invoicing/coupon/couponReducer';
|
|
4
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
6
|
import { runInvoicingDiscountAction, runInvoicingDiscountActionFailure, runInvoicingDiscountActionSuccess, } from './discountActionReducer';
|
|
7
|
+
/** Snackbar copy per action kind; unlisted kinds run without one. */
|
|
8
|
+
const SNACKBAR_SECTION_BY_KIND = {
|
|
9
|
+
archive: 'invoicing_discount_archive',
|
|
10
|
+
delete: 'invoicing_discount_delete',
|
|
11
|
+
unarchive: 'invoicing_discount_unarchive',
|
|
12
|
+
};
|
|
6
13
|
export const runInvoicingDiscountActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingDiscountAction.match), mergeMap((action) => {
|
|
7
14
|
const { action: kind, id } = action.payload;
|
|
8
15
|
const requestBody = { action: kind };
|
|
16
|
+
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
17
|
+
const snackbar = (messageText) => snackbarSection == null
|
|
18
|
+
? []
|
|
19
|
+
: [
|
|
20
|
+
openSnackbar({
|
|
21
|
+
messageSection: snackbarSection,
|
|
22
|
+
messageText,
|
|
23
|
+
type: messageText === 'success' ? 'success' : 'error',
|
|
24
|
+
}),
|
|
25
|
+
];
|
|
9
26
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/discounts/${encodeURIComponent(id)}/actions`;
|
|
10
27
|
return zeniAPI
|
|
11
28
|
.postAndGetJSON(apiUrl, requestBody)
|
|
@@ -14,15 +31,22 @@ export const runInvoicingDiscountActionEpic = (actions$, _state$, zeniAPI) => ac
|
|
|
14
31
|
return [
|
|
15
32
|
updateInvoicingCoupons([response.data], 'merge'),
|
|
16
33
|
runInvoicingDiscountActionSuccess({ id }),
|
|
34
|
+
...snackbar('success'),
|
|
17
35
|
];
|
|
18
36
|
}
|
|
19
|
-
return
|
|
20
|
-
|
|
37
|
+
return from([
|
|
38
|
+
runInvoicingDiscountActionFailure({
|
|
39
|
+
error: response.status,
|
|
40
|
+
id,
|
|
41
|
+
}),
|
|
42
|
+
...snackbar('failed'),
|
|
43
|
+
]);
|
|
44
|
+
}), catchError((error) => from([
|
|
45
|
+
runInvoicingDiscountActionFailure({
|
|
46
|
+
error: createZeniAPIStatus('Unexpected Error', 'Discount action REST API call errored out ' +
|
|
47
|
+
JSON.stringify(error)),
|
|
21
48
|
id,
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
JSON.stringify(error)),
|
|
26
|
-
id,
|
|
27
|
-
}))));
|
|
49
|
+
}),
|
|
50
|
+
...snackbar('failed'),
|
|
51
|
+
])));
|
|
28
52
|
}));
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingDunningCases } from '../../../entity/invoicing/dunningCase/dunningCaseReducer';
|
|
4
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
6
|
import { runInvoicingDunningAction, runInvoicingDunningActionFailure, runInvoicingDunningActionSuccess, } from './dunningActionReducer';
|
|
7
|
+
/**
|
|
8
|
+
* Snackbar copy is per action kind; anything not listed here runs without one.
|
|
9
|
+
*/
|
|
10
|
+
const SNACKBAR_SECTION_BY_KIND = {
|
|
11
|
+
cancel: 'invoicing_dunning_cancel',
|
|
12
|
+
resolve: 'invoicing_dunning_case_resolved',
|
|
13
|
+
retry: 'invoicing_dunning_retry',
|
|
14
|
+
};
|
|
6
15
|
export const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingDunningAction.match), mergeMap((action) => {
|
|
7
16
|
const { action: kind, body, id } = action.payload;
|
|
17
|
+
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
18
|
+
const snackbar = (messageText) => snackbarSection == null
|
|
19
|
+
? []
|
|
20
|
+
: [
|
|
21
|
+
openSnackbar({
|
|
22
|
+
messageSection: snackbarSection,
|
|
23
|
+
messageText,
|
|
24
|
+
type: messageText === 'success' ? 'success' : 'error',
|
|
25
|
+
}),
|
|
26
|
+
];
|
|
8
27
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/dunning/${encodeURIComponent(id)}/${kind}`;
|
|
9
28
|
return zeniAPI
|
|
10
29
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -13,15 +32,22 @@ export const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => act
|
|
|
13
32
|
return [
|
|
14
33
|
updateInvoicingDunningCases([response.data], 'merge'),
|
|
15
34
|
runInvoicingDunningActionSuccess({ id }),
|
|
35
|
+
...snackbar('success'),
|
|
16
36
|
];
|
|
17
37
|
}
|
|
18
|
-
return
|
|
19
|
-
|
|
38
|
+
return from([
|
|
39
|
+
runInvoicingDunningActionFailure({
|
|
40
|
+
error: response.status,
|
|
41
|
+
id,
|
|
42
|
+
}),
|
|
43
|
+
...snackbar('failed'),
|
|
44
|
+
]);
|
|
45
|
+
}), catchError((error) => from([
|
|
46
|
+
runInvoicingDunningActionFailure({
|
|
47
|
+
error: createZeniAPIStatus('Unexpected Error', 'Dunning action REST API call errored out ' +
|
|
48
|
+
JSON.stringify(error)),
|
|
20
49
|
id,
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
JSON.stringify(error)),
|
|
25
|
-
id,
|
|
26
|
-
}))));
|
|
50
|
+
}),
|
|
51
|
+
...snackbar('failed'),
|
|
52
|
+
])));
|
|
27
53
|
}));
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js
CHANGED
|
@@ -31,7 +31,7 @@ const tierToPayload = (tier) => ({
|
|
|
31
31
|
package_size: hasValue(tier.packageSize)
|
|
32
32
|
? Number(tier.packageSize)
|
|
33
33
|
: undefined,
|
|
34
|
-
price:
|
|
34
|
+
price: tier.price?.amount ?? 0,
|
|
35
35
|
pricing_type: tier.pricingType,
|
|
36
36
|
starting_unit: Number(tier.startingUnit) || 1,
|
|
37
37
|
});
|
|
@@ -45,7 +45,7 @@ const subFamilyToProductUpdate = (subFamily, itemType) => {
|
|
|
45
45
|
is_taxable: subFamily.isTaxable,
|
|
46
46
|
period: hasValue(subFamily.period) ? Number(subFamily.period) : null,
|
|
47
47
|
period_unit: hasValue(subFamily.period) ? subFamily.periodUnit : null,
|
|
48
|
-
price: tiered ? 0 :
|
|
48
|
+
price: tiered ? 0 : (subFamily.priceDollars?.amount ?? 0),
|
|
49
49
|
pricing_model: subFamily.pricingModel,
|
|
50
50
|
show_description_in_quotes: subFamily.showDescriptionInQuotes,
|
|
51
51
|
tiers: tiered ? subFamily.tiers.map(tierToPayload) : [],
|
|
@@ -112,7 +112,6 @@ export const catalogDetailEditValuesToSavePayload = (values, itemType = 'plan',
|
|
|
112
112
|
productUpdates,
|
|
113
113
|
};
|
|
114
114
|
};
|
|
115
|
-
const toAmountValue = (value) => Number(value) || 0;
|
|
116
115
|
/** Build POST /catalog/products body for Create sub-family. */
|
|
117
116
|
export const createSubFamilyFormToPayload = (itemId, itemType, values) => {
|
|
118
117
|
const name = values.name.trim();
|
|
@@ -123,7 +122,7 @@ export const createSubFamilyFormToPayload = (itemId, itemType, values) => {
|
|
|
123
122
|
is_taxable: true,
|
|
124
123
|
item_id: itemId,
|
|
125
124
|
name,
|
|
126
|
-
price:
|
|
125
|
+
price: values.priceDollars?.amount ?? 0,
|
|
127
126
|
price_code: priceCode,
|
|
128
127
|
pricing_model: values.pricingModel || 'flat_fee',
|
|
129
128
|
show_description_in_invoices: true,
|
|
@@ -162,7 +161,7 @@ export const productToCreateSubFamilyFormValues = (product) => ({
|
|
|
162
161
|
period: product?.period != null ? String(product.period) : '1',
|
|
163
162
|
periodUnit: product?.periodUnit ?? 'month',
|
|
164
163
|
priceCode: '',
|
|
165
|
-
priceDollars: product?.price
|
|
164
|
+
priceDollars: product?.price,
|
|
166
165
|
pricingModel: product?.pricingModel ?? 'flat_fee',
|
|
167
166
|
prorationType: product?.prorationType ?? 'site_default',
|
|
168
167
|
trialEndAction: product?.trialEndAction ?? 'site_default',
|
|
@@ -7,17 +7,16 @@ const toProductCode = (value) => value
|
|
|
7
7
|
.toLowerCase()
|
|
8
8
|
.replace(/[^a-z0-9]+/g, '-')
|
|
9
9
|
.replace(/^-|-$/g, '');
|
|
10
|
-
const
|
|
11
|
-
const buildAccountingDetail = (localData) => {
|
|
10
|
+
const buildAccountingDetail = (subFamily) => {
|
|
12
11
|
const detail = {};
|
|
13
|
-
if (
|
|
14
|
-
detail.sku =
|
|
12
|
+
if (subFamily.sku.trim() !== '') {
|
|
13
|
+
detail.sku = subFamily.sku.trim();
|
|
15
14
|
}
|
|
16
|
-
if (
|
|
17
|
-
detail.accounting_code =
|
|
15
|
+
if (subFamily.accountingCode.trim() !== '') {
|
|
16
|
+
detail.accounting_code = subFamily.accountingCode.trim();
|
|
18
17
|
}
|
|
19
|
-
if (
|
|
20
|
-
detail.accounting_category_1 =
|
|
18
|
+
if (subFamily.accountingCategory.trim() !== '') {
|
|
19
|
+
detail.accounting_category_1 = subFamily.accountingCategory.trim();
|
|
21
20
|
}
|
|
22
21
|
return Object.keys(detail).length > 0 ? detail : undefined;
|
|
23
22
|
};
|
|
@@ -31,7 +30,7 @@ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
|
|
|
31
30
|
free_quantity: Number(subFamily.freeQuantity) || 0,
|
|
32
31
|
is_taxable: subFamily.isTaxable,
|
|
33
32
|
name,
|
|
34
|
-
price: tiered ? 0 :
|
|
33
|
+
price: tiered ? 0 : (subFamily.priceDollars?.amount ?? 0),
|
|
35
34
|
price_code: priceCode,
|
|
36
35
|
pricing_model: subFamily.pricingModel,
|
|
37
36
|
show_description_in_invoices: subFamily.showDescriptionInInvoices,
|
|
@@ -70,12 +69,12 @@ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
|
|
|
70
69
|
payload.tiers = subFamily.tiers.map((tier) => ({
|
|
71
70
|
ending_unit: tier.endingUnit.trim() !== '' ? Number(tier.endingUnit) : undefined,
|
|
72
71
|
package_size: tier.packageSize.trim() !== '' ? Number(tier.packageSize) : undefined,
|
|
73
|
-
price:
|
|
72
|
+
price: tier.price?.amount ?? 0,
|
|
74
73
|
pricing_type: tier.pricingType,
|
|
75
74
|
starting_unit: Number(tier.startingUnit) || 1,
|
|
76
75
|
}));
|
|
77
76
|
}
|
|
78
|
-
const accountingDetail = buildAccountingDetail(
|
|
77
|
+
const accountingDetail = buildAccountingDetail(subFamily);
|
|
79
78
|
if (accountingDetail != null) {
|
|
80
79
|
payload.accounting_detail = accountingDetail;
|
|
81
80
|
}
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js
CHANGED
|
@@ -44,11 +44,12 @@ export const isTieredCatalogPricingModel = (model) => ['tiered', 'volume', 'stai
|
|
|
44
44
|
export const blankInvoicingCatalogTier = (startingUnit = '1') => ({
|
|
45
45
|
endingUnit: '',
|
|
46
46
|
packageSize: '',
|
|
47
|
-
price: '',
|
|
48
47
|
pricingType: 'per_unit',
|
|
49
48
|
startingUnit,
|
|
50
49
|
});
|
|
51
50
|
export const blankInvoicingCatalogSubFamily = () => ({
|
|
51
|
+
accountingCategory: '',
|
|
52
|
+
accountingCode: '',
|
|
52
53
|
billingCycles: '',
|
|
53
54
|
description: '',
|
|
54
55
|
freeQuantity: '0',
|
|
@@ -58,12 +59,12 @@ export const blankInvoicingCatalogSubFamily = () => ({
|
|
|
58
59
|
name: '',
|
|
59
60
|
period: '1',
|
|
60
61
|
periodUnit: 'month',
|
|
61
|
-
priceDollars: '',
|
|
62
62
|
priceCode: '',
|
|
63
63
|
pricingModel: 'flat_fee',
|
|
64
64
|
prorationType: 'site_default',
|
|
65
65
|
showDescriptionInInvoices: true,
|
|
66
66
|
showDescriptionInQuotes: true,
|
|
67
|
+
sku: '',
|
|
67
68
|
tiers: [blankInvoicingCatalogTier('1')],
|
|
68
69
|
trialEndAction: 'site_default',
|
|
69
70
|
trialPeriod: '',
|
|
@@ -76,7 +77,10 @@ export const invoicingProductToCatalogItemFormSubFamily = (product) => {
|
|
|
76
77
|
}
|
|
77
78
|
return {
|
|
78
79
|
...base,
|
|
80
|
+
accountingCategory: product.accountingDetail?.accountingCategory1 ?? '',
|
|
81
|
+
accountingCode: product.accountingDetail?.accountingCode ?? '',
|
|
79
82
|
billingCycles: product.billingCycles != null ? String(product.billingCycles) : '',
|
|
83
|
+
sku: product.accountingDetail?.sku ?? '',
|
|
80
84
|
description: product.description ?? '',
|
|
81
85
|
freeQuantity: product.freeQuantity != null ? String(product.freeQuantity) : '0',
|
|
82
86
|
id: product.id,
|
|
@@ -85,7 +89,7 @@ export const invoicingProductToCatalogItemFormSubFamily = (product) => {
|
|
|
85
89
|
name: product.name ?? '',
|
|
86
90
|
period: product.period != null ? String(product.period) : '1',
|
|
87
91
|
periodUnit: product.periodUnit ?? 'month',
|
|
88
|
-
priceDollars: product.price
|
|
92
|
+
priceDollars: product.price,
|
|
89
93
|
priceCode: product.priceCode ?? '',
|
|
90
94
|
pricingModel: product.pricingModel ?? 'flat_fee',
|
|
91
95
|
prorationType: product.prorationType ?? 'site_default',
|
|
@@ -95,7 +99,7 @@ export const invoicingProductToCatalogItemFormSubFamily = (product) => {
|
|
|
95
99
|
? product.tiers.map((tier) => ({
|
|
96
100
|
endingUnit: tier.endingUnit != null ? String(tier.endingUnit) : '',
|
|
97
101
|
packageSize: tier.packageSize != null ? String(tier.packageSize) : '',
|
|
98
|
-
price:
|
|
102
|
+
price: tier.price,
|
|
99
103
|
pricingType: tier.pricingType ?? 'per_unit',
|
|
100
104
|
startingUnit: String(tier.startingUnit ?? 1),
|
|
101
105
|
}))
|
|
@@ -106,8 +110,6 @@ export const invoicingProductToCatalogItemFormSubFamily = (product) => {
|
|
|
106
110
|
};
|
|
107
111
|
};
|
|
108
112
|
export const initialInvoicingCatalogItemFormLocalData = {
|
|
109
|
-
accountingCategory: '',
|
|
110
|
-
accountingCode: '',
|
|
111
113
|
applicableItems: [],
|
|
112
114
|
catalogType: 'plan',
|
|
113
115
|
description: '',
|
|
@@ -115,7 +117,6 @@ export const initialInvoicingCatalogItemFormLocalData = {
|
|
|
115
117
|
itemApplicability: 'all',
|
|
116
118
|
name: '',
|
|
117
119
|
productCode: '',
|
|
118
|
-
sku: '',
|
|
119
120
|
subFamilies: [blankInvoicingCatalogSubFamily()],
|
|
120
121
|
unit: '',
|
|
121
122
|
};
|
|
@@ -136,8 +137,6 @@ export const entityToInvoicingCatalogItemFormLocalData = (item) => {
|
|
|
136
137
|
? 'addon'
|
|
137
138
|
: 'plan';
|
|
138
139
|
return {
|
|
139
|
-
accountingCategory: plan.subFamilies?.[0]?.accountingDetail?.accountingCategory1 ?? '',
|
|
140
|
-
accountingCode: plan.subFamilies?.[0]?.accountingDetail?.accountingCode ?? '',
|
|
141
140
|
applicableItems: item.applicableItems ?? [],
|
|
142
141
|
catalogType,
|
|
143
142
|
description: item.description ?? '',
|
|
@@ -145,7 +144,6 @@ export const entityToInvoicingCatalogItemFormLocalData = (item) => {
|
|
|
145
144
|
itemApplicability: item.itemApplicability ?? 'all',
|
|
146
145
|
name: item.name ?? '',
|
|
147
146
|
productCode: item.productCode ?? '',
|
|
148
|
-
sku: plan.subFamilies?.[0]?.accountingDetail?.sku ?? '',
|
|
149
147
|
subFamilies: plan?.subFamilies != null && plan.subFamilies.length > 0
|
|
150
148
|
? plan.subFamilies.map(invoicingProductToCatalogItemFormSubFamily)
|
|
151
149
|
: [invoicingProductToCatalogItemFormSubFamily()],
|
package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js
CHANGED
|
@@ -22,8 +22,8 @@ export const localDataToSaveInvoicingCouponPayload = (localData, isCreate) => {
|
|
|
22
22
|
data.discount_percentage = Number(localData.discountPercentage);
|
|
23
23
|
}
|
|
24
24
|
if (localData.discountType === 'fixed_amount') {
|
|
25
|
-
if (localData.discountAmount
|
|
26
|
-
data.discount_amount =
|
|
25
|
+
if (localData.discountAmount != null) {
|
|
26
|
+
data.discount_amount = localData.discountAmount.amount;
|
|
27
27
|
}
|
|
28
28
|
data.currency_code = 'USD';
|
|
29
29
|
}
|
package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { initialInvoicingCouponFormLocalData } from './
|
|
2
|
+
import { initialInvoicingCouponFormLocalData, } from './editInvoicingCouponDetailViewState';
|
|
3
3
|
export const initialState = {
|
|
4
4
|
fetchState: 'Not-Started',
|
|
5
5
|
error: undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { INVOICING_COUPON_APPLY_ON_OPTIONS, INVOICING_COUPON_DURATION_TYPE_OPTIONS, INVOICING_COUPON_PERIOD_UNIT_OPTIONS, INVOICING_DISCOUNT_TYPE_OPTIONS, } from '../../../entity/invoicing/coupon/couponConstants';
|
|
2
2
|
import { getInvoicingCouponById } from '../../../entity/invoicing/coupon/couponSelector';
|
|
3
|
-
import { entityToInvoicingCouponFormLocalData } from './
|
|
3
|
+
import { entityToInvoicingCouponFormLocalData, } from './editInvoicingCouponDetailViewState';
|
|
4
4
|
/**
|
|
5
5
|
* Bundled view for the discount create/edit form: the save fetch state/error,
|
|
6
6
|
* the id of the coupon last saved, and — when a `couponId` is passed (edit
|
package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js
CHANGED
|
@@ -1 +1,43 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export const initialInvoicingCouponFormLocalData = {
|
|
2
|
+
applyOn: 'invoice_amount',
|
|
3
|
+
couponCode: '',
|
|
4
|
+
couponId: '',
|
|
5
|
+
discountPercentage: '',
|
|
6
|
+
discountQuantity: '',
|
|
7
|
+
discountType: 'percentage',
|
|
8
|
+
durationType: 'one_time',
|
|
9
|
+
invoiceName: '',
|
|
10
|
+
invoiceNotes: '',
|
|
11
|
+
maxRedemptions: '',
|
|
12
|
+
name: '',
|
|
13
|
+
period: '',
|
|
14
|
+
periodUnit: 'month',
|
|
15
|
+
validFrom: '',
|
|
16
|
+
validTill: '',
|
|
17
|
+
};
|
|
18
|
+
/** Seed the form draft from an existing coupon entity (edit mode). */
|
|
19
|
+
export const entityToInvoicingCouponFormLocalData = (coupon) => {
|
|
20
|
+
if (coupon == null) {
|
|
21
|
+
return { ...initialInvoicingCouponFormLocalData };
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
applyOn: coupon.applyOn ?? 'invoice_amount',
|
|
25
|
+
couponCode: coupon.couponCode ?? '',
|
|
26
|
+
couponId: coupon.id ?? '',
|
|
27
|
+
discountAmount: coupon.discountAmount,
|
|
28
|
+
discountPercentage: coupon.discountPercentage != null
|
|
29
|
+
? String(coupon.discountPercentage)
|
|
30
|
+
: '',
|
|
31
|
+
discountQuantity: coupon.discountQuantity != null ? String(coupon.discountQuantity) : '',
|
|
32
|
+
discountType: coupon.discountType ?? 'percentage',
|
|
33
|
+
durationType: coupon.durationType ?? 'one_time',
|
|
34
|
+
invoiceName: coupon.invoiceName ?? '',
|
|
35
|
+
invoiceNotes: coupon.invoiceNotes ?? '',
|
|
36
|
+
maxRedemptions: coupon.maxRedemptions != null ? String(coupon.maxRedemptions) : '',
|
|
37
|
+
name: coupon.name ?? '',
|
|
38
|
+
period: coupon.period != null ? String(coupon.period) : '',
|
|
39
|
+
periodUnit: coupon.periodUnit ?? 'month',
|
|
40
|
+
validFrom: coupon.validFrom != null ? coupon.validFrom.format('YYYY-MM-DD') : '',
|
|
41
|
+
validTill: coupon.validTill != null ? coupon.validTill.format('YYYY-MM-DD') : '',
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -24,8 +24,7 @@ export const localDataToSaveInvoicingSubscriptionPayload = (localData, shippingA
|
|
|
24
24
|
quantity: 1,
|
|
25
25
|
})),
|
|
26
26
|
];
|
|
27
|
-
const setupFee = localData.setupFee
|
|
28
|
-
const parsedSetupFee = Number.parseFloat(setupFee);
|
|
27
|
+
const setupFee = localData.setupFee?.amount;
|
|
29
28
|
const poNumber = localData.poNumber.trim();
|
|
30
29
|
const trialEnd = localData.trialEnd.trim();
|
|
31
30
|
return {
|
|
@@ -35,9 +34,7 @@ export const localDataToSaveInvoicingSubscriptionPayload = (localData, shippingA
|
|
|
35
34
|
currency_code: localData.preferredCurrencyCode,
|
|
36
35
|
customer_id: localData.customerId,
|
|
37
36
|
subscription_items: items,
|
|
38
|
-
...(setupFee
|
|
39
|
-
? { setup_fee: parsedSetupFee }
|
|
40
|
-
: {}),
|
|
37
|
+
...(setupFee != null ? { setup_fee: setupFee } : {}),
|
|
41
38
|
...(poNumber !== '' ? { po_number: poNumber } : {}),
|
|
42
39
|
...(trialEnd !== '' ? { trial_end: trialEnd } : {}),
|
|
43
40
|
...(localData.couponId !== '' ? { coupon_ids: [localData.couponId] } : {}),
|
|
@@ -44,7 +44,6 @@ export const initialInvoicingSubscriptionFormLocalData = {
|
|
|
44
44
|
planQuantity: 1,
|
|
45
45
|
poNumber: '',
|
|
46
46
|
preferredCurrencyCode: 'USD',
|
|
47
|
-
setupFee: '',
|
|
48
47
|
trialEnd: '',
|
|
49
48
|
};
|
|
50
49
|
/** Seed the form draft from an existing subscription entity (edit mode). */
|
|
@@ -66,7 +65,7 @@ export const entityToInvoicingSubscriptionFormLocalData = (subscription) => {
|
|
|
66
65
|
planQuantity: planItem?.quantity ?? 1,
|
|
67
66
|
poNumber: subscription.poNumber ?? '',
|
|
68
67
|
preferredCurrencyCode: subscription.currencyCode ?? 'USD',
|
|
69
|
-
setupFee:
|
|
68
|
+
setupFee: subscription.setupFee,
|
|
70
69
|
trialEnd: subscription.trialEnd != null
|
|
71
70
|
? subscription.trialEnd.format('YYYY-MM-DD')
|
|
72
71
|
: '',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toAuditLogEntityRouteOption, toInvoicingCatalogItemLifecycleActionOption, toInvoicingCatalogProductLifecycleActionOption, toInvoicingDiscountLifecycleActionOption, toInvoicingDunningAction, toInvoicingNamedOption, toInvoicingSubscriptionEditFieldOption, toInvoicingSubscriptionLifecycleActionOption, } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
+
import { toAuditLogEntityRouteOption, toInvoicingCatalogItemLifecycleActionOption, toInvoicingCatalogProductLifecycleActionOption, toInvoicingDiscountLifecycleActionOption, toInvoicingDunningAction, toInvoicingNamedOption, toInvoicingQboAccountMappingKindOption, toInvoicingSubscriptionEditFieldOption, toInvoicingSubscriptionLifecycleActionOption, } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
3
|
export const initialState = {
|
|
4
4
|
fetchState: 'Not-Started',
|
|
5
5
|
error: undefined,
|
|
@@ -18,6 +18,9 @@ export const initialState = {
|
|
|
18
18
|
catalogItemLifecycleActionOptions: [],
|
|
19
19
|
catalogProductLifecycleActionOptions: [],
|
|
20
20
|
discountLifecycleActionOptions: [],
|
|
21
|
+
qboAccountMappingKindOptions: [],
|
|
22
|
+
qboCustomerMatchingOptions: [],
|
|
23
|
+
qboSyncStatusOptions: [],
|
|
21
24
|
isInvoicingEnabled: undefined,
|
|
22
25
|
isInvoicingTosAccepted: undefined,
|
|
23
26
|
invoicingTosAcceptanceIp: undefined,
|
|
@@ -53,6 +56,9 @@ export function mapInvoicingConfigPayloadToState(payload) {
|
|
|
53
56
|
catalogItemLifecycleActionOptions: (payload.catalog_item_lifecycle_action_options ?? []).map((option) => toInvoicingCatalogItemLifecycleActionOption(option)),
|
|
54
57
|
catalogProductLifecycleActionOptions: (payload.catalog_product_lifecycle_action_options ?? []).map((option) => toInvoicingCatalogProductLifecycleActionOption(option)),
|
|
55
58
|
discountLifecycleActionOptions: (payload.discount_lifecycle_action_options ?? []).map((option) => toInvoicingDiscountLifecycleActionOption(option)),
|
|
59
|
+
qboAccountMappingKindOptions: (payload.qbo_account_mapping_kind_options ?? []).map(toInvoicingQboAccountMappingKindOption),
|
|
60
|
+
qboCustomerMatchingOptions: (payload.qbo_customer_matching_options ?? []).map(toInvoicingNamedOption),
|
|
61
|
+
qboSyncStatusOptions: (payload.qbo_sync_status_options ?? []).map(toInvoicingNamedOption),
|
|
56
62
|
isInvoicingEnabled: payload.is_invoicing_enabled,
|
|
57
63
|
isInvoicingTosAccepted: payload.is_invoicing_tos_accepted,
|
|
58
64
|
invoicingTosAcceptanceIp: payload.invoicing_tos_acceptance_ip ?? undefined,
|
|
@@ -23,6 +23,9 @@ export const getInvoicingConfigView = (state) => {
|
|
|
23
23
|
catalogItemLifecycleActionOptions: configState.catalogItemLifecycleActionOptions,
|
|
24
24
|
catalogProductLifecycleActionOptions: configState.catalogProductLifecycleActionOptions,
|
|
25
25
|
discountLifecycleActionOptions: configState.discountLifecycleActionOptions,
|
|
26
|
+
qboAccountMappingKindOptions: configState.qboAccountMappingKindOptions,
|
|
27
|
+
qboCustomerMatchingOptions: configState.qboCustomerMatchingOptions,
|
|
28
|
+
qboSyncStatusOptions: configState.qboSyncStatusOptions,
|
|
26
29
|
error: configState.error,
|
|
27
30
|
fetchState: configState.fetchState,
|
|
28
31
|
isInvoicingEnabled: configState.isInvoicingEnabled,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
+
import { mapInvoicingQboAccountOptions, } from '../invoicingQboViewPayload';
|
|
5
|
+
import { fetchInvoicingQboAccounts, updateInvoicingQboAccounts, updateInvoicingQboAccountsFailure, } from '../invoicingQboViewReducer';
|
|
6
|
+
export const fetchInvoicingQboAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboAccounts.match), mergeMap((action) => {
|
|
7
|
+
const { accountTypes } = action.payload;
|
|
8
|
+
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/accounts?account_types=${encodeURIComponent(accountTypes)}`;
|
|
9
|
+
return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
|
|
10
|
+
if (isSuccessResponse(response)) {
|
|
11
|
+
return updateInvoicingQboAccounts({
|
|
12
|
+
accountTypes,
|
|
13
|
+
accounts: mapInvoicingQboAccountOptions(response.data?.accounts ?? []),
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return updateInvoicingQboAccountsFailure({
|
|
17
|
+
accountTypes,
|
|
18
|
+
status: response.status,
|
|
19
|
+
});
|
|
20
|
+
}), catchError((error) => of(updateInvoicingQboAccountsFailure({
|
|
21
|
+
accountTypes,
|
|
22
|
+
status: createZeniAPIStatus('Unexpected Error', 'Fetch QBO accounts REST API call errored out ' +
|
|
23
|
+
JSON.stringify(error)),
|
|
24
|
+
}))));
|
|
25
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, map, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
+
import { mapInvoicingQboAccountOptions, } from '../invoicingQboViewPayload';
|
|
5
|
+
import { fetchInvoicingQboClasses, updateInvoicingQboClasses, updateInvoicingQboClassesFailure, } from '../invoicingQboViewReducer';
|
|
6
|
+
export const fetchInvoicingQboClassesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboClasses.match), switchMap(() => {
|
|
7
|
+
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/classes`;
|
|
8
|
+
return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
|
|
9
|
+
if (isSuccessResponse(response)) {
|
|
10
|
+
return updateInvoicingQboClasses(mapInvoicingQboAccountOptions(response.data?.accounts ?? []));
|
|
11
|
+
}
|
|
12
|
+
return updateInvoicingQboClassesFailure(response.status);
|
|
13
|
+
}), catchError((error) => of(updateInvoicingQboClassesFailure(createZeniAPIStatus('Unexpected Error', 'Fetch QBO classes REST API call errored out ' +
|
|
14
|
+
JSON.stringify(error))))));
|
|
15
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, map, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
+
import { mapInvoicingQboConnection, } from '../invoicingQboViewPayload';
|
|
5
|
+
import { fetchInvoicingQboConnection, updateInvoicingQboConnection, updateInvoicingQboConnectionFailure, } from '../invoicingQboViewReducer';
|
|
6
|
+
export const fetchInvoicingQboConnectionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboConnection.match), switchMap(() => {
|
|
7
|
+
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/connection`;
|
|
8
|
+
return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
|
|
9
|
+
if (isSuccessResponse(response)) {
|
|
10
|
+
return updateInvoicingQboConnection(mapInvoicingQboConnection(response.data ?? { connected: false }));
|
|
11
|
+
}
|
|
12
|
+
return updateInvoicingQboConnectionFailure(response.status);
|
|
13
|
+
}), catchError((error) => of(updateInvoicingQboConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Fetch QBO connection REST API call errored out ' +
|
|
14
|
+
JSON.stringify(error))))));
|
|
15
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, map, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
+
import { mapInvoicingQboSyncHealth, } from '../invoicingQboViewPayload';
|
|
5
|
+
import { fetchInvoicingQboSyncHealth, updateInvoicingQboSyncHealth, updateInvoicingQboSyncHealthFailure, } from '../invoicingQboViewReducer';
|
|
6
|
+
export const fetchInvoicingQboSyncHealthEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingQboSyncHealth.match), switchMap(() => {
|
|
7
|
+
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/sync-health`;
|
|
8
|
+
return zeniAPI.getJSON(apiUrl).pipe(map((response) => {
|
|
9
|
+
if (isSuccessResponse(response)) {
|
|
10
|
+
return updateInvoicingQboSyncHealth(mapInvoicingQboSyncHealth(response.data ?? {}));
|
|
11
|
+
}
|
|
12
|
+
return updateInvoicingQboSyncHealthFailure(response.status);
|
|
13
|
+
}), catchError((error) => of(updateInvoicingQboSyncHealthFailure(createZeniAPIStatus('Unexpected Error', 'Fetch QBO sync health REST API call errored out ' +
|
|
14
|
+
JSON.stringify(error))))));
|
|
15
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
+
import { fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, } from '../invoicingQboViewReducer';
|
|
5
|
+
export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(retryInvoicingQboSyncTask.match), mergeMap((action) => {
|
|
6
|
+
const { taskId } = action.payload;
|
|
7
|
+
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/sync-tasks/${encodeURIComponent(taskId)}/retry`;
|
|
8
|
+
return zeniAPI
|
|
9
|
+
.postAndGetJSON(apiUrl, {})
|
|
10
|
+
.pipe(mergeMap((response) => {
|
|
11
|
+
if (isSuccessResponse(response)) {
|
|
12
|
+
return of(retryInvoicingQboSyncTaskSuccess({
|
|
13
|
+
status: response.data?.status ?? '',
|
|
14
|
+
taskId: response.data?.task_id ?? taskId,
|
|
15
|
+
}), fetchInvoicingQboSyncHealth());
|
|
16
|
+
}
|
|
17
|
+
return of(retryInvoicingQboSyncTaskFailure({
|
|
18
|
+
status: response.status,
|
|
19
|
+
taskId,
|
|
20
|
+
}));
|
|
21
|
+
}), catchError((error) => of(retryInvoicingQboSyncTaskFailure({
|
|
22
|
+
status: createZeniAPIStatus('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
|
|
23
|
+
JSON.stringify(error)),
|
|
24
|
+
taskId,
|
|
25
|
+
}))));
|
|
26
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
+
import { fetchInvoicingQboSyncHealth, startInvoicingQboBackfill, startInvoicingQboBackfillFailure, startInvoicingQboBackfillSuccess, } from '../invoicingQboViewReducer';
|
|
5
|
+
export const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(startInvoicingQboBackfill.match), switchMap((action) => {
|
|
6
|
+
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/qbo/backfill`;
|
|
7
|
+
return zeniAPI
|
|
8
|
+
.postAndGetJSON(apiUrl, {
|
|
9
|
+
start_date: action.payload.startDate,
|
|
10
|
+
})
|
|
11
|
+
.pipe(mergeMap((response) => {
|
|
12
|
+
if (isSuccessResponse(response)) {
|
|
13
|
+
return of(startInvoicingQboBackfillSuccess(), fetchInvoicingQboSyncHealth());
|
|
14
|
+
}
|
|
15
|
+
return of(startInvoicingQboBackfillFailure(response.status));
|
|
16
|
+
}), catchError((error) => of(startInvoicingQboBackfillFailure(createZeniAPIStatus('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
|
|
17
|
+
JSON.stringify(error))))));
|
|
18
|
+
}));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export function mapInvoicingQboConnection(payload) {
|
|
2
|
+
return {
|
|
3
|
+
connected: payload.connected,
|
|
4
|
+
companyName: payload.company_name ?? undefined,
|
|
5
|
+
connectionId: payload.connection_id ?? undefined,
|
|
6
|
+
realmId: payload.realm_id ?? undefined,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function mapInvoicingQboAccountOptions(rows) {
|
|
10
|
+
return rows.flatMap((row) => {
|
|
11
|
+
// Only qbo_id is a valid QBO AccountRef/ClassRef value — platform-internal
|
|
12
|
+
// ids (account_id / id) are display metadata and must never be submitted.
|
|
13
|
+
const accountId = row.qbo_id ?? row.id ?? row.account_id ?? '';
|
|
14
|
+
if (accountId === '') {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const accountName = row.name ??
|
|
18
|
+
row.account_name ??
|
|
19
|
+
row.accounting_class_name ??
|
|
20
|
+
row.qbo_accounting_class_name ??
|
|
21
|
+
row.fully_qualified_name ??
|
|
22
|
+
accountId;
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
id: accountId,
|
|
26
|
+
name: accountName,
|
|
27
|
+
accountType: row.account_type ?? undefined,
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function mapInvoicingQboSyncHealth(payload) {
|
|
33
|
+
return {
|
|
34
|
+
connection: payload.connection != null
|
|
35
|
+
? mapInvoicingQboConnection(payload.connection)
|
|
36
|
+
: undefined,
|
|
37
|
+
countsByStatus: payload.counts_by_status ?? {},
|
|
38
|
+
failedTasks: (payload.failed_tasks ?? []).map((task) => ({
|
|
39
|
+
attempts: task.attempts,
|
|
40
|
+
entityId: task.entity_id,
|
|
41
|
+
entityType: task.entity_type,
|
|
42
|
+
taskId: task.task_id,
|
|
43
|
+
lastError: task.last_error ?? undefined,
|
|
44
|
+
updatedAt: task.updated_at ?? undefined,
|
|
45
|
+
})),
|
|
46
|
+
};
|
|
47
|
+
}
|