@zeniai/client-epic-state 5.1.82 → 5.1.83-betaRD2
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/entity/jeSchedules/jeScheduleHelper.d.ts +2 -0
- package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +34 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +68 -0
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +26 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +10 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +28 -3
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +41 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +12 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +40 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +1 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
- package/lib/epic.d.ts +5 -1
- package/lib/epic.js +5 -1
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +68 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +26 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +26 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +34 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -1
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/esm/epic.js +5 -1
- package/lib/esm/index.js +11 -5
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +34 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +73 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +163 -28
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +70 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +260 -22
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- 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 +5 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +32 -5
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +23 -3
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +20 -3
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +60 -17
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +29 -10
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +28 -5
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +22 -14
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +46 -7
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +26 -8
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +41 -9
- package/lib/index.d.ts +18 -13
- package/lib/index.js +72 -50
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +32 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +77 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +8 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +45 -10
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +164 -28
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +25 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +34 -8
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +10 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +75 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +10 -1
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +266 -21
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +59 -8
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +22 -8
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- 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 +3 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +31 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +22 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +19 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +2 -1
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +59 -16
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +13 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +11 -31
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +15 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -1
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +28 -9
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +27 -4
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +24 -7
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +23 -16
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +45 -6
- 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/invoicing/settingsView/settingsViewSelector.d.ts +4 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +2 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +40 -8
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.startInvoicingQboBackfillEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
6
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
8
|
const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
|
|
8
9
|
const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.startInvoicingQboBackfill.match), (0, operators_1.switchMap)((action) => {
|
|
@@ -13,10 +14,32 @@ const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
13
14
|
})
|
|
14
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
16
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
16
|
-
return (0, rxjs_1.
|
|
17
|
+
return (0, rxjs_1.from)([
|
|
18
|
+
(0, invoicingQboViewReducer_1.startInvoicingQboBackfillSuccess)(),
|
|
19
|
+
(0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)(),
|
|
20
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
21
|
+
messageSection: 'invoicing_qbo_backfill',
|
|
22
|
+
messageText: 'success',
|
|
23
|
+
type: 'success',
|
|
24
|
+
}),
|
|
25
|
+
]);
|
|
17
26
|
}
|
|
18
|
-
return (0, rxjs_1.
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
return (0, rxjs_1.from)([
|
|
28
|
+
(0, invoicingQboViewReducer_1.startInvoicingQboBackfillFailure)(response.status),
|
|
29
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
30
|
+
messageSection: 'invoicing_qbo_backfill',
|
|
31
|
+
messageText: 'failed',
|
|
32
|
+
type: 'error',
|
|
33
|
+
}),
|
|
34
|
+
]);
|
|
35
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
36
|
+
(0, invoicingQboViewReducer_1.startInvoicingQboBackfillFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
|
|
37
|
+
JSON.stringify(error))),
|
|
38
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
39
|
+
messageSection: 'invoicing_qbo_backfill',
|
|
40
|
+
messageText: 'failed',
|
|
41
|
+
type: 'error',
|
|
42
|
+
}),
|
|
43
|
+
])));
|
|
21
44
|
}));
|
|
22
45
|
exports.startInvoicingQboBackfillEpic = startInvoicingQboBackfillEpic;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateInvoicingCreditNotes } from '../../../entity/invoicing/creditNote/creditNoteReducer';
|
|
4
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
7
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
7
8
|
import { issueCreditNoteFailure, issueCreditNoteSuccess, submitIssueCreditNote } from './issueCreditNoteReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof submitIssueCreditNote> | ReturnType<typeof issueCreditNoteSuccess> | ReturnType<typeof issueCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes> | ReturnType<typeof fetchInvoiceDetail>;
|
|
9
|
+
export type ActionType = ReturnType<typeof submitIssueCreditNote> | ReturnType<typeof issueCreditNoteSuccess> | ReturnType<typeof issueCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes> | ReturnType<typeof fetchInvoiceDetail> | ReturnType<typeof openSnackbar>;
|
|
9
10
|
export declare const issueCreditNoteEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,6 +4,7 @@ exports.issueCreditNoteEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const creditNoteReducer_1 = require("../../../entity/invoicing/creditNote/creditNoteReducer");
|
|
7
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
const invoiceDetailReducer_1 = require("../invoiceDetail/invoiceDetailReducer");
|
|
9
10
|
const issueCreditNotePayload_1 = require("./issueCreditNotePayload");
|
|
@@ -21,10 +22,29 @@ const issueCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
21
22
|
(0, creditNoteReducer_1.updateInvoicingCreditNotes)([response.data], 'merge'),
|
|
22
23
|
(0, invoiceDetailReducer_1.fetchInvoiceDetail)({ invoiceId }),
|
|
23
24
|
(0, issueCreditNoteReducer_1.issueCreditNoteSuccess)({ creditNoteId: response.data.id }),
|
|
25
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
26
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
27
|
+
messageText: 'success',
|
|
28
|
+
type: 'success',
|
|
29
|
+
}),
|
|
24
30
|
];
|
|
25
31
|
}
|
|
26
|
-
return (0, rxjs_1.
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
return (0, rxjs_1.from)([
|
|
33
|
+
(0, issueCreditNoteReducer_1.issueCreditNoteFailure)(response.status),
|
|
34
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
35
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
36
|
+
messageText: 'failed',
|
|
37
|
+
type: 'error',
|
|
38
|
+
}),
|
|
39
|
+
]);
|
|
40
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
41
|
+
(0, issueCreditNoteReducer_1.issueCreditNoteFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Issue credit note REST API call errored out ' +
|
|
42
|
+
JSON.stringify(error))),
|
|
43
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
44
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
45
|
+
messageText: 'failed',
|
|
46
|
+
type: 'error',
|
|
47
|
+
}),
|
|
48
|
+
])));
|
|
29
49
|
}));
|
|
30
50
|
exports.issueCreditNoteEpic = issueCreditNoteEpic;
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import { ID } from '../../../commonStateTypes/common';
|
|
1
|
+
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
+
import { InvoicingInvoice } from '../../../entity/invoicing/invoice/invoiceState';
|
|
3
4
|
import { RootState } from '../../../reducer';
|
|
4
5
|
import { IssueCreditNoteFormLocalData } from './issueCreditNoteState';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Everything the issue-credit-note screen renders, in one view: the invoice being
|
|
8
|
+
* credited, the form draft and the submit run-state. `fetchState`/`error` track
|
|
9
|
+
* the invoice load (what gates the page); the submit action is exposed separately
|
|
10
|
+
* as `submitState` so a save failure can't be mistaken for a load failure.
|
|
11
|
+
*/
|
|
12
|
+
export interface IssueCreditNoteView extends SelectorView {
|
|
13
|
+
/**
|
|
14
|
+
* True once the invoice has loaded and the draft for *this* invoice has line
|
|
15
|
+
* items to credit.
|
|
16
|
+
*/
|
|
17
|
+
isPageReady: boolean;
|
|
10
18
|
localData: IssueCreditNoteFormLocalData;
|
|
11
19
|
reasonCodeValues: string[];
|
|
20
|
+
submitState: FetchStateAndError;
|
|
21
|
+
invoice?: InvoicingInvoice;
|
|
22
|
+
issuedCreditNoteId?: ID;
|
|
12
23
|
}
|
|
13
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The draft is a single global slice, so a draft seeded for a previously opened
|
|
26
|
+
* invoice can still be in state when another invoice's screen mounts. Anything
|
|
27
|
+
* that would render that stale draft next to this invoice is dropped until the
|
|
28
|
+
* screen re-seeds it for `invoiceId`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getIssueCreditNoteView: (state: RootState, invoiceId: ID) => IssueCreditNoteView;
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getIssueCreditNoteView = void 0;
|
|
4
|
+
const invoiceDetailSelector_1 = require("../invoiceDetail/invoiceDetailSelector");
|
|
4
5
|
const issueCreditNoteFormConfig_1 = require("./issueCreditNoteFormConfig");
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The draft is a single global slice, so a draft seeded for a previously opened
|
|
8
|
+
* invoice can still be in state when another invoice's screen mounts. Anything
|
|
9
|
+
* that would render that stale draft next to this invoice is dropped until the
|
|
10
|
+
* screen re-seeds it for `invoiceId`.
|
|
11
|
+
*/
|
|
12
|
+
const getIssueCreditNoteView = (state, invoiceId) => {
|
|
13
|
+
const invoiceView = (0, invoiceDetailSelector_1.getInvoiceDetail)(state, invoiceId);
|
|
14
|
+
const { draft, error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
15
|
+
const isDraftForInvoice = draft.invoiceId === invoiceId;
|
|
7
16
|
return {
|
|
8
|
-
|
|
9
|
-
fetchState
|
|
17
|
+
invoice: invoiceView.invoice,
|
|
18
|
+
isPageReady: invoiceView.fetchState === 'Completed' &&
|
|
19
|
+
isDraftForInvoice &&
|
|
20
|
+
draft.lineItems.length > 0,
|
|
10
21
|
issuedCreditNoteId,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.getIssueCreditNoteView = getIssueCreditNoteView;
|
|
15
|
-
const getIssueCreditNoteFormView = (state) => {
|
|
16
|
-
const { draft, error, fetchState } = state.invoicingIssueCreditNoteState;
|
|
17
|
-
return {
|
|
18
|
-
localData: draft,
|
|
22
|
+
localData: isDraftForInvoice
|
|
23
|
+
? draft
|
|
24
|
+
: (0, issueCreditNoteFormConfig_1.initialIssueCreditNoteFormLocalData)(invoiceId),
|
|
19
25
|
reasonCodeValues: [...issueCreditNoteFormConfig_1.INVOICING_CREDIT_NOTE_REASON_CODES],
|
|
20
|
-
error,
|
|
21
|
-
|
|
26
|
+
submitState: { error, fetchState },
|
|
27
|
+
error: invoiceView.error,
|
|
28
|
+
fetchState: invoiceView.fetchState,
|
|
22
29
|
version: 1.0,
|
|
23
30
|
};
|
|
24
31
|
};
|
|
25
|
-
exports.
|
|
32
|
+
exports.getIssueCreditNoteView = getIssueCreditNoteView;
|
|
@@ -2,10 +2,11 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
4
4
|
import { updateInvoicingTransactions } from '../../../entity/invoicing/invoicingTransaction/invoicingTransactionReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
8
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
8
9
|
import { addInvoicingTransactionToList } from '../invoicingTransactionListView/invoicingTransactionListViewReducer';
|
|
9
10
|
import { recordPaymentFailure, recordPaymentSuccess, submitRecordPayment } from './recordPaymentReducer';
|
|
10
|
-
export type ActionType = ReturnType<typeof submitRecordPayment> | ReturnType<typeof recordPaymentSuccess> | ReturnType<typeof recordPaymentFailure> | ReturnType<typeof updateInvoicingTransactions> | ReturnType<typeof addInvoicingTransactionToList> | ReturnType<typeof updateInvoices> | ReturnType<typeof fetchInvoiceDetail>;
|
|
11
|
+
export type ActionType = ReturnType<typeof submitRecordPayment> | ReturnType<typeof recordPaymentSuccess> | ReturnType<typeof recordPaymentFailure> | ReturnType<typeof updateInvoicingTransactions> | ReturnType<typeof addInvoicingTransactionToList> | ReturnType<typeof updateInvoices> | ReturnType<typeof fetchInvoiceDetail> | ReturnType<typeof openSnackbar>;
|
|
11
12
|
export declare const recordPaymentEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const invoiceReducer_1 = require("../../../entity/invoicing/invoice/invoiceReducer");
|
|
7
7
|
const invoicingTransactionReducer_1 = require("../../../entity/invoicing/invoicingTransaction/invoicingTransactionReducer");
|
|
8
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
9
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
10
|
const invoiceDetailReducer_1 = require("../invoiceDetail/invoiceDetailReducer");
|
|
10
11
|
const invoicingTransactionListViewReducer_1 = require("../invoicingTransactionListView/invoicingTransactionListViewReducer");
|
|
@@ -29,11 +30,30 @@ const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, opera
|
|
|
29
30
|
(0, invoiceReducer_1.updateInvoices)([response.data], 'merge'),
|
|
30
31
|
(0, invoiceDetailReducer_1.fetchInvoiceDetail)({ invoiceId }),
|
|
31
32
|
(0, recordPaymentReducer_1.recordPaymentSuccess)({ invoiceId }),
|
|
33
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
34
|
+
messageSection: 'invoicing_payment_recorded',
|
|
35
|
+
messageText: 'success',
|
|
36
|
+
type: 'success',
|
|
37
|
+
}),
|
|
32
38
|
];
|
|
33
39
|
}
|
|
34
|
-
return (0, rxjs_1.
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
return (0, rxjs_1.from)([
|
|
41
|
+
(0, recordPaymentReducer_1.recordPaymentFailure)(response.status),
|
|
42
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
43
|
+
messageSection: 'invoicing_payment_recorded',
|
|
44
|
+
messageText: 'failed',
|
|
45
|
+
type: 'error',
|
|
46
|
+
}),
|
|
47
|
+
]);
|
|
48
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
49
|
+
(0, recordPaymentReducer_1.recordPaymentFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
50
|
+
JSON.stringify(error))),
|
|
51
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
52
|
+
messageSection: 'invoicing_payment_recorded',
|
|
53
|
+
messageText: 'failed',
|
|
54
|
+
type: 'error',
|
|
55
|
+
}),
|
|
56
|
+
])));
|
|
37
57
|
}
|
|
38
58
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/payments`;
|
|
39
59
|
const data = (0, recordPaymentPayload_1.localDataToRecordPaymentPayload)(draft);
|
|
@@ -52,10 +72,29 @@ const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, opera
|
|
|
52
72
|
if (linkedInvoiceId != null) {
|
|
53
73
|
successActions.push((0, invoiceDetailReducer_1.fetchInvoiceDetail)({ invoiceId: linkedInvoiceId }));
|
|
54
74
|
}
|
|
75
|
+
successActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
76
|
+
messageSection: 'invoicing_payment_recorded',
|
|
77
|
+
messageText: 'success',
|
|
78
|
+
type: 'success',
|
|
79
|
+
}));
|
|
55
80
|
return successActions;
|
|
56
81
|
}
|
|
57
|
-
return (0, rxjs_1.
|
|
58
|
-
|
|
59
|
-
|
|
82
|
+
return (0, rxjs_1.from)([
|
|
83
|
+
(0, recordPaymentReducer_1.recordPaymentFailure)(response.status),
|
|
84
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
85
|
+
messageSection: 'invoicing_payment_recorded',
|
|
86
|
+
messageText: 'failed',
|
|
87
|
+
type: 'error',
|
|
88
|
+
}),
|
|
89
|
+
]);
|
|
90
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
91
|
+
(0, recordPaymentReducer_1.recordPaymentFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
92
|
+
JSON.stringify(error))),
|
|
93
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
94
|
+
messageSection: 'invoicing_payment_recorded',
|
|
95
|
+
messageText: 'failed',
|
|
96
|
+
type: 'error',
|
|
97
|
+
}),
|
|
98
|
+
])));
|
|
60
99
|
}));
|
|
61
100
|
exports.recordPaymentEpic = recordPaymentEpic;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
7
|
import { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, updateInvoicingSettings, updateInvoicingSettingsFailure, updateInvoicingStripeConnection } from './settingsViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchInvoicingSettings> | ReturnType<typeof updateInvoicingSettings> | ReturnType<typeof updateInvoicingSettingsFailure> | ReturnType<typeof saveInvoicingSettings> | ReturnType<typeof saveInvoicingSettingsSuccess> | ReturnType<typeof saveInvoicingSettingsFailure> | ReturnType<typeof connectInvoicingStripe> | ReturnType<typeof disconnectInvoicingStripe> | ReturnType<typeof updateInvoicingStripeConnection> | ReturnType<typeof invoicingStripeConnectionFailure> | ReturnType<typeof updateAddresses>;
|
|
8
|
+
export type ActionType = ReturnType<typeof fetchInvoicingSettings> | ReturnType<typeof updateInvoicingSettings> | ReturnType<typeof updateInvoicingSettingsFailure> | ReturnType<typeof saveInvoicingSettings> | ReturnType<typeof saveInvoicingSettingsSuccess> | ReturnType<typeof saveInvoicingSettingsFailure> | ReturnType<typeof connectInvoicingStripe> | ReturnType<typeof disconnectInvoicingStripe> | ReturnType<typeof updateInvoicingStripeConnection> | ReturnType<typeof invoicingStripeConnectionFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof openSnackbar>;
|
|
8
9
|
export declare const fetchInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
9
10
|
export declare const connectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
10
11
|
export declare const disconnectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,6 +4,7 @@ exports.saveInvoicingSettingsEpic = exports.disconnectInvoicingStripeEpic = expo
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
const settingsViewReducer_1 = require("./settingsViewReducer");
|
|
9
10
|
const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchInvoicingSettings.match), (0, operators_1.switchMap)(() => {
|
|
@@ -63,16 +64,33 @@ const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
63
64
|
exports.disconnectInvoicingStripeEpic = disconnectInvoicingStripeEpic;
|
|
64
65
|
const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveInvoicingSettings.match), (0, operators_1.mergeMap)((action) => {
|
|
65
66
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
|
|
67
|
+
const { settings, snackbarSection } = action.payload;
|
|
68
|
+
const snackbar = (messageText) => snackbarSection == null
|
|
69
|
+
? []
|
|
70
|
+
: [
|
|
71
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
72
|
+
messageSection: snackbarSection,
|
|
73
|
+
messageText,
|
|
74
|
+
type: messageText === 'success' ? 'success' : 'error',
|
|
75
|
+
}),
|
|
76
|
+
];
|
|
66
77
|
return zeniAPI
|
|
67
|
-
.putAndGetJSON(apiUrl, {
|
|
68
|
-
...action.payload,
|
|
69
|
-
})
|
|
78
|
+
.putAndGetJSON(apiUrl, { ...settings })
|
|
70
79
|
.pipe((0, operators_1.switchMap)((response) => {
|
|
71
80
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
72
|
-
return (0, rxjs_1.
|
|
81
|
+
return (0, rxjs_1.from)([
|
|
82
|
+
(0, settingsViewReducer_1.saveInvoicingSettingsSuccess)(response.data),
|
|
83
|
+
...snackbar('success'),
|
|
84
|
+
]);
|
|
73
85
|
}
|
|
74
|
-
return (0, rxjs_1.
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
return (0, rxjs_1.from)([
|
|
87
|
+
(0, settingsViewReducer_1.saveInvoicingSettingsFailure)(response.status),
|
|
88
|
+
...snackbar('failed'),
|
|
89
|
+
]);
|
|
90
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
91
|
+
(0, settingsViewReducer_1.saveInvoicingSettingsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save settings REST API call errored out ' +
|
|
92
|
+
JSON.stringify(error))),
|
|
93
|
+
...snackbar('failed'),
|
|
94
|
+
])));
|
|
77
95
|
}));
|
|
78
96
|
exports.saveInvoicingSettingsEpic = saveInvoicingSettingsEpic;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
+
import { SnackbarMessageSections } from '../../../entity/snackbar/snackbarTypes';
|
|
2
3
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
4
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
4
5
|
import { StripeConnectCredentials } from './settingsViewPayload';
|
|
@@ -7,8 +8,16 @@ export interface InvoicingStripeConnectionUpdate {
|
|
|
7
8
|
stripe_connected: boolean;
|
|
8
9
|
publishable_key?: string;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* `settings` is the request body; `snackbarSection` only picks which snackbar the
|
|
13
|
+
* epic raises, so it is deliberately kept out of the payload sent to the API.
|
|
14
|
+
*/
|
|
15
|
+
export interface SaveInvoicingSettingsPayload {
|
|
16
|
+
settings: Partial<InvoicingSettingsPayload>;
|
|
17
|
+
snackbarSection?: SnackbarMessageSections;
|
|
18
|
+
}
|
|
10
19
|
export declare const initialState: InvoicingSettingsViewState;
|
|
11
|
-
export declare const fetchInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/fetchInvoicingSettings">, updateInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/updateInvoicingSettings">, updateInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/updateInvoicingSettingsFailure">, saveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<
|
|
20
|
+
export declare const fetchInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/fetchInvoicingSettings">, updateInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/updateInvoicingSettings">, updateInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/updateInvoicingSettingsFailure">, saveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveInvoicingSettingsPayload, "invoicingSettingsView/saveInvoicingSettings">, saveInvoicingSettingsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/saveInvoicingSettingsSuccess">, saveInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/saveInvoicingSettingsFailure">, resetSaveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetSaveInvoicingSettings">, updateInvoicingBrandingFormDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
12
21
|
localData: InvoicingBrandingFormLocalData;
|
|
13
22
|
}, "invoicingSettingsView/updateInvoicingBrandingFormDraft">, submitInvoicingBrandingForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/submitInvoicingBrandingForm">, resetInvoicingBrandingFormDraft: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetInvoicingBrandingFormDraft">, connectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[credentials: StripeConnectCredentials], StripeConnectCredentials, "invoicingSettingsView/connectInvoicingStripe", never, never>, disconnectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/disconnectInvoicingStripe">, updateInvoicingStripeConnection: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingStripeConnectionUpdate, "invoicingSettingsView/updateInvoicingStripeConnection">, invoicingStripeConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/invoicingStripeConnectionFailure">, clearInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/clearInvoicingSettings">;
|
|
14
23
|
declare const _default: import("redux").Reducer<InvoicingSettingsViewState>;
|
|
@@ -33,7 +33,7 @@ const settingsView = (0, toolkit_1.createSlice)({
|
|
|
33
33
|
saveInvoicingSettings(draft, action) {
|
|
34
34
|
draft.saveFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
35
35
|
if (draft.settings != null) {
|
|
36
|
-
draft.settings = { ...draft.settings, ...action.payload };
|
|
36
|
+
draft.settings = { ...draft.settings, ...action.payload.settings };
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
saveInvoicingSettingsSuccess(draft, action) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
-
import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
+
import { InvoicingNamedOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
3
|
import { RootState } from '../../../reducer';
|
|
4
4
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
5
5
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
@@ -28,6 +28,7 @@ export interface InvoicingSettingsView {
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const getInvoicingSettingsView: (state: RootState) => InvoicingSettingsView;
|
|
30
30
|
export interface InvoicingBrandingFormView {
|
|
31
|
+
dateFormatOptions: InvoicingNamedOption[];
|
|
31
32
|
localData: InvoicingBrandingFormLocalData;
|
|
32
33
|
saveState: FetchStateAndError;
|
|
33
34
|
addressLabel?: string;
|
|
@@ -37,6 +38,7 @@ export interface InvoicingBrandingFormView {
|
|
|
37
38
|
* Bundled view for the branding settings form: the draft `localData` (seeded
|
|
38
39
|
* from the existing settings until the user edits), the business-address label
|
|
39
40
|
* (from the shared Address screen, seeded on load from `address_id`), the raw
|
|
40
|
-
* settings (for the logo/preview)
|
|
41
|
+
* settings (for the logo/preview), the backend date-format choices and the
|
|
42
|
+
* save fetch state.
|
|
41
43
|
*/
|
|
42
44
|
export declare const getInvoicingBrandingFormView: (state: RootState) => InvoicingBrandingFormView;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInvoicingBrandingFormView = exports.getInvoicingSettingsView = exports.getInvoicingSettingsFetchState = exports.getInvoicingSettings = void 0;
|
|
4
4
|
const addressViewSelector_1 = require("../../addressView/addressViewSelector");
|
|
5
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
5
6
|
const invoicingBrandingFormConfig_1 = require("./invoicingBrandingFormConfig");
|
|
6
7
|
/**
|
|
7
8
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
@@ -39,7 +40,8 @@ exports.getInvoicingSettingsView = getInvoicingSettingsView;
|
|
|
39
40
|
* Bundled view for the branding settings form: the draft `localData` (seeded
|
|
40
41
|
* from the existing settings until the user edits), the business-address label
|
|
41
42
|
* (from the shared Address screen, seeded on load from `address_id`), the raw
|
|
42
|
-
* settings (for the logo/preview)
|
|
43
|
+
* settings (for the logo/preview), the backend date-format choices and the
|
|
44
|
+
* save fetch state.
|
|
43
45
|
*/
|
|
44
46
|
const getInvoicingBrandingFormView = (state) => {
|
|
45
47
|
const { brandingDraft, saveFetchState, settings } = state.invoicingSettingsViewState;
|
|
@@ -49,6 +51,7 @@ const getInvoicingBrandingFormView = (state) => {
|
|
|
49
51
|
: undefined;
|
|
50
52
|
return {
|
|
51
53
|
addressLabel,
|
|
54
|
+
dateFormatOptions: (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state).dateFormatOptions,
|
|
52
55
|
localData: brandingDraft ?? (0, invoicingBrandingFormConfig_1.entityToInvoicingBrandingFormLocalData)(settings),
|
|
53
56
|
saveState: saveFetchState,
|
|
54
57
|
settings,
|
|
@@ -2,8 +2,9 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
8
|
import { runInvoicingSubscriptionAction, runInvoicingSubscriptionActionFailure, runInvoicingSubscriptionActionSuccess } from './subscriptionActionReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof runInvoicingSubscriptionAction> | ReturnType<typeof runInvoicingSubscriptionActionSuccess> | ReturnType<typeof runInvoicingSubscriptionActionFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions>;
|
|
9
|
+
export type ActionType = ReturnType<typeof runInvoicingSubscriptionAction> | ReturnType<typeof runInvoicingSubscriptionActionSuccess> | ReturnType<typeof runInvoicingSubscriptionActionFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions> | ReturnType<typeof openSnackbar>;
|
|
9
10
|
export declare const runInvoicingSubscriptionActionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -6,11 +6,36 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
7
|
const invoicingSubscriptionPayload_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload");
|
|
8
8
|
const invoicingSubscriptionReducer_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer");
|
|
9
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
11
|
const subscriptionActionReducer_1 = require("./subscriptionActionReducer");
|
|
12
|
+
/**
|
|
13
|
+
* Each lifecycle action reports with its own copy. Keyed loosely because the
|
|
14
|
+
* action payload carries a plain `string`; an unmapped kind stays silent.
|
|
15
|
+
*/
|
|
16
|
+
const SNACKBAR_SECTION_BY_ACTION = {
|
|
17
|
+
activate: 'invoicing_subscription_activated',
|
|
18
|
+
cancel: 'invoicing_subscription_cancelled',
|
|
19
|
+
change_term_end: 'invoicing_subscription_term_end_changed',
|
|
20
|
+
pause: 'invoicing_subscription_paused',
|
|
21
|
+
reactivate: 'invoicing_subscription_reactivated',
|
|
22
|
+
remove_scheduled_cancellation: 'invoicing_subscription_cancellation_removed',
|
|
23
|
+
resume: 'invoicing_subscription_resumed',
|
|
24
|
+
set_non_renewing: 'invoicing_subscription_non_renewing',
|
|
25
|
+
};
|
|
11
26
|
const runInvoicingSubscriptionActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(subscriptionActionReducer_1.runInvoicingSubscriptionAction.match), (0, operators_1.mergeMap)((action) => {
|
|
12
27
|
const { action: kind, body, id } = action.payload;
|
|
13
28
|
const requestBody = { action: kind, ...(body ?? {}) };
|
|
29
|
+
const snackbarSection = SNACKBAR_SECTION_BY_ACTION[kind];
|
|
30
|
+
const snackbar = (messageText) => snackbarSection == null
|
|
31
|
+
? []
|
|
32
|
+
: [
|
|
33
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
34
|
+
messageSection: snackbarSection,
|
|
35
|
+
messageText,
|
|
36
|
+
type: messageText === 'success' ? 'success' : 'error',
|
|
37
|
+
}),
|
|
38
|
+
];
|
|
14
39
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/subscriptions/${encodeURIComponent(id)}/actions`;
|
|
15
40
|
return zeniAPI
|
|
16
41
|
.postAndGetJSON(apiUrl, requestBody)
|
|
@@ -20,16 +45,23 @@ const runInvoicingSubscriptionActionEpic = (actions$, _state$, zeniAPI) => actio
|
|
|
20
45
|
(0, invoicingSubscriptionReducer_1.updateInvoicingSubscriptions)([response.data], 'merge'),
|
|
21
46
|
(0, addressReducer_1.updateAddresses)((0, invoicingSubscriptionPayload_1.extractInvoicingSubscriptionAddresses)([response.data])),
|
|
22
47
|
(0, subscriptionActionReducer_1.runInvoicingSubscriptionActionSuccess)({ id }),
|
|
48
|
+
...snackbar('success'),
|
|
23
49
|
];
|
|
24
50
|
}
|
|
25
|
-
return (0, rxjs_1.
|
|
26
|
-
|
|
51
|
+
return (0, rxjs_1.from)([
|
|
52
|
+
(0, subscriptionActionReducer_1.runInvoicingSubscriptionActionFailure)({
|
|
53
|
+
error: response.status,
|
|
54
|
+
id,
|
|
55
|
+
}),
|
|
56
|
+
...snackbar('failed'),
|
|
57
|
+
]);
|
|
58
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
59
|
+
(0, subscriptionActionReducer_1.runInvoicingSubscriptionActionFailure)({
|
|
60
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Subscription action REST API call errored out ' +
|
|
61
|
+
JSON.stringify(error)),
|
|
27
62
|
id,
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
JSON.stringify(error)),
|
|
32
|
-
id,
|
|
33
|
-
}))));
|
|
63
|
+
}),
|
|
64
|
+
...snackbar('failed'),
|
|
65
|
+
])));
|
|
34
66
|
}));
|
|
35
67
|
exports.runInvoicingSubscriptionActionEpic = runInvoicingSubscriptionActionEpic;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.83-betaRD2",
|
|
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
|
"module": "lib/esm/index.js",
|