@zeniai/client-epic-state 5.1.82 → 5.1.83
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/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/esm/index.js +1 -1
- 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 +4 -3
- package/lib/index.js +7 -8
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- 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
|
@@ -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",
|
|
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",
|