@zeniai/client-epic-state 5.1.85-betaRD3 → 5.1.86
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/aiCfo/aiCfoState.d.ts +2 -2
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +2 -6
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -2
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -34
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -68
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -24
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -10
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -28
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -41
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -12
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -40
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
- package/lib/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +1 -4
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -68
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -24
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -26
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -34
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +1 -5
- package/lib/esm/index.js +5 -11
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +1 -4
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -34
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +28 -163
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -260
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +4 -24
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +4 -24
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +9 -33
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +9 -35
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +5 -32
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +3 -23
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +4 -24
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +4 -24
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +3 -20
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +17 -60
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +10 -29
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +5 -28
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +4 -24
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +14 -22
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +7 -46
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +8 -26
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +1 -4
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +9 -41
- package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +1 -4
- package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +1 -4
- package/lib/index.d.ts +13 -18
- package/lib/index.js +50 -76
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +2 -5
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +1 -32
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -8
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +10 -45
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +28 -164
- 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/jeSchedulesSelectorTypes.d.ts +8 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +1 -10
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -266
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -59
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +1 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +3 -23
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +1 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +3 -23
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +8 -22
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +1 -2
- package/lib/view/invoicing/discountAction/discountActionEpic.js +8 -32
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +1 -2
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +8 -34
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +1 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +4 -31
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +2 -22
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +3 -23
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +3 -23
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +2 -19
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +1 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +16 -59
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +0 -13
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +31 -11
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +0 -15
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +1 -2
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +9 -28
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +4 -27
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +1 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +3 -23
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +7 -24
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +16 -23
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +1 -2
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +6 -45
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -2
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +7 -25
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -10
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +2 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -4
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +1 -2
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +8 -40
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +2 -5
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
- package/lib/view/vendorTabView/vendorTabViewReducer.js +2 -5
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -21
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -73
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -70
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -77
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -25
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -10
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -75
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingInvoiceAddresses } from '../../../entity/invoicing/invoice/invoicePayload';
|
|
5
5
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { runInvoicingInvoiceAction, runInvoicingInvoiceActionFailure, runInvoicingInvoiceActionSuccess, updateInvoicingInvoice, } from './invoiceActionReducer';
|
|
9
|
-
/** Snackbar copy per action kind; unlisted kinds run without one. */
|
|
10
|
-
const SNACKBAR_SECTION_BY_KIND = {
|
|
11
|
-
regenerate: 'invoicing_invoice_regenerated',
|
|
12
|
-
'send-reminder': 'invoicing_invoice_reminder_sent',
|
|
13
|
-
void: 'invoicing_invoice_voided',
|
|
14
|
-
};
|
|
15
8
|
export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter((action) => runInvoicingInvoiceAction.match(action) &&
|
|
16
9
|
action.payload.action !== 'issue-credit-note'), mergeMap((action) => {
|
|
17
10
|
const { action: kind, body, invoiceId } = action.payload;
|
|
18
|
-
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
19
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
20
|
-
? []
|
|
21
|
-
: [
|
|
22
|
-
openSnackbar({
|
|
23
|
-
messageSection: snackbarSection,
|
|
24
|
-
messageText,
|
|
25
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
26
|
-
}),
|
|
27
|
-
];
|
|
28
11
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices/${encodeURIComponent(invoiceId)}/${kind}`;
|
|
29
12
|
return zeniAPI
|
|
30
13
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -34,24 +17,17 @@ export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => act
|
|
|
34
17
|
updateInvoices([response.data], 'merge'),
|
|
35
18
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
36
19
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
37
|
-
...snackbar('success'),
|
|
38
20
|
];
|
|
39
21
|
}
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
error: response.status,
|
|
43
|
-
invoiceId,
|
|
44
|
-
}),
|
|
45
|
-
...snackbar('failed'),
|
|
46
|
-
]);
|
|
47
|
-
}), catchError((error) => from([
|
|
48
|
-
runInvoicingInvoiceActionFailure({
|
|
49
|
-
error: createZeniAPIStatus('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
50
|
-
JSON.stringify(error)),
|
|
22
|
+
return of(runInvoicingInvoiceActionFailure({
|
|
23
|
+
error: response.status,
|
|
51
24
|
invoiceId,
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
}));
|
|
26
|
+
}), catchError((error) => of(runInvoicingInvoiceActionFailure({
|
|
27
|
+
error: createZeniAPIStatus('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
28
|
+
JSON.stringify(error)),
|
|
29
|
+
invoiceId,
|
|
30
|
+
}))));
|
|
55
31
|
}));
|
|
56
32
|
export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateInvoicingInvoice.match), mergeMap((action) => {
|
|
57
33
|
const { data, invoiceId } = action.payload;
|
|
@@ -64,34 +40,15 @@ export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => action
|
|
|
64
40
|
updateInvoices([response.data], 'merge'),
|
|
65
41
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
66
42
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
67
|
-
openSnackbar({
|
|
68
|
-
messageSection: 'invoicing_invoice_saved',
|
|
69
|
-
messageText: 'success',
|
|
70
|
-
type: 'success',
|
|
71
|
-
}),
|
|
72
43
|
];
|
|
73
44
|
}
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
error: response.status,
|
|
77
|
-
invoiceId,
|
|
78
|
-
}),
|
|
79
|
-
openSnackbar({
|
|
80
|
-
messageSection: 'invoicing_invoice_saved',
|
|
81
|
-
messageText: 'failed',
|
|
82
|
-
type: 'error',
|
|
83
|
-
}),
|
|
84
|
-
]);
|
|
85
|
-
}), catchError((error) => from([
|
|
86
|
-
runInvoicingInvoiceActionFailure({
|
|
87
|
-
error: createZeniAPIStatus('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
88
|
-
JSON.stringify(error)),
|
|
45
|
+
return of(runInvoicingInvoiceActionFailure({
|
|
46
|
+
error: response.status,
|
|
89
47
|
invoiceId,
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
])));
|
|
48
|
+
}));
|
|
49
|
+
}), catchError((error) => of(runInvoicingInvoiceActionFailure({
|
|
50
|
+
error: createZeniAPIStatus('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
51
|
+
JSON.stringify(error)),
|
|
52
|
+
invoiceId,
|
|
53
|
+
}))));
|
|
97
54
|
}));
|
|
@@ -8,20 +8,7 @@ export const initialState = {
|
|
|
8
8
|
auditLogEntityRouteOptions: [],
|
|
9
9
|
auditLogListSortFieldOptions: [],
|
|
10
10
|
auditLogSourceLabels: [],
|
|
11
|
-
autoCollectionOptions: [],
|
|
12
|
-
billingPeriodUnitOptions: [],
|
|
13
|
-
catalogTrialEndActionOptions: [],
|
|
14
|
-
catalogTrialUnitOptions: [],
|
|
15
|
-
customerTypeOptions: [],
|
|
16
|
-
dateFormatOptions: [],
|
|
17
|
-
discountApplyOnOptions: [],
|
|
18
|
-
discountDurationTypeOptions: [],
|
|
19
|
-
discountTypeOptions: [],
|
|
20
11
|
dunningScheduleActionOptions: [],
|
|
21
|
-
manualPaymentMethodOptions: [],
|
|
22
|
-
netTermDayOptions: [],
|
|
23
|
-
paymentGatewayOptions: [],
|
|
24
|
-
taxabilityOptions: [],
|
|
25
12
|
enableFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
26
13
|
subscriptionLifecycleActionOptions: [],
|
|
27
14
|
subscriptionCommercialEditAllowedFromStatuses: [],
|
|
@@ -42,8 +29,6 @@ export const initialState = {
|
|
|
42
29
|
invoicingTosAcceptanceUserAgent: undefined,
|
|
43
30
|
invoicingTosAcceptanceUserId: undefined,
|
|
44
31
|
isInvoicingSettingsSeeded: undefined,
|
|
45
|
-
createdAt: undefined,
|
|
46
|
-
updatedAt: undefined,
|
|
47
32
|
hasValidState() {
|
|
48
33
|
return (this.fetchState === 'Completed' && this.isInvoicingTosAccepted != null);
|
|
49
34
|
},
|
|
@@ -59,21 +44,6 @@ export function mapInvoicingConfigPayloadToState(payload) {
|
|
|
59
44
|
code: option.code,
|
|
60
45
|
name: option.name,
|
|
61
46
|
})),
|
|
62
|
-
autoCollectionOptions: (payload.auto_collection_options ?? []).map(toInvoicingNamedOption),
|
|
63
|
-
billingPeriodUnitOptions: (payload.billing_period_unit_options ?? []).map(toInvoicingNamedOption),
|
|
64
|
-
catalogTrialEndActionOptions: (payload.catalog_trial_end_action_options ?? []).map(toInvoicingNamedOption),
|
|
65
|
-
catalogTrialUnitOptions: (payload.catalog_trial_unit_options ?? []).map(toInvoicingNamedOption),
|
|
66
|
-
customerTypeOptions: (payload.customer_type_options ?? []).map(toInvoicingNamedOption),
|
|
67
|
-
dateFormatOptions: (payload.date_format_options ?? []).map(toInvoicingNamedOption),
|
|
68
|
-
discountApplyOnOptions: (payload.discount_apply_on_options ?? []).map(toInvoicingNamedOption),
|
|
69
|
-
discountDurationTypeOptions: (payload.discount_duration_type_options ?? []).map(toInvoicingNamedOption),
|
|
70
|
-
discountTypeOptions: (payload.discount_type_options ?? []).map(toInvoicingNamedOption),
|
|
71
|
-
manualPaymentMethodOptions: (payload.manual_payment_method_options ?? []).map(toInvoicingNamedOption),
|
|
72
|
-
netTermDayOptions: (payload.net_term_day_options ?? []).map(toInvoicingNamedOption),
|
|
73
|
-
paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(toInvoicingNamedOption),
|
|
74
|
-
taxabilityOptions: (payload.taxability_options ?? []).map(toInvoicingNamedOption),
|
|
75
|
-
createdAt: payload.created_at ?? undefined,
|
|
76
|
-
updatedAt: payload.updated_at ?? undefined,
|
|
77
47
|
dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
|
|
78
48
|
code: toInvoicingDunningAction(option.code),
|
|
79
49
|
name: option.name,
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import { deriveInvoicingOnboardingStatus, } from './invoicingConfigViewPayload';
|
|
2
|
+
/**
|
|
3
|
+
* Single bundled view for the invoicing config — consumers read only this.
|
|
4
|
+
* Carries the config flags, the derived onboarding `status` used for route
|
|
5
|
+
* gating, the config fetch (`fetchState`/`error`), and the accept-terms /
|
|
6
|
+
* enable action fetch states.
|
|
7
|
+
*/
|
|
2
8
|
export const getInvoicingConfigView = (state) => {
|
|
3
|
-
const
|
|
9
|
+
const configState = state.invoicingConfigViewState;
|
|
4
10
|
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
acceptTermsState: configState.acceptTermsFetchState,
|
|
12
|
+
auditLogEntityRouteOptions: configState.auditLogEntityRouteOptions,
|
|
13
|
+
auditLogListSortFieldOptions: configState.auditLogListSortFieldOptions,
|
|
14
|
+
auditLogSourceLabels: configState.auditLogSourceLabels,
|
|
15
|
+
dunningScheduleActionOptions: configState.dunningScheduleActionOptions,
|
|
16
|
+
enableState: configState.enableFetchState,
|
|
17
|
+
subscriptionLifecycleActionOptions: configState.subscriptionLifecycleActionOptions,
|
|
18
|
+
subscriptionCommercialEditAllowedFromStatuses: configState.subscriptionCommercialEditAllowedFromStatuses,
|
|
19
|
+
subscriptionMetadataEditAllowedFromStatuses: configState.subscriptionMetadataEditAllowedFromStatuses,
|
|
20
|
+
subscriptionEditFieldOptions: configState.subscriptionEditFieldOptions,
|
|
21
|
+
subscriptionCancelTimingOptions: configState.subscriptionCancelTimingOptions,
|
|
22
|
+
subscriptionChangeOptionOptions: configState.subscriptionChangeOptionOptions,
|
|
23
|
+
catalogItemLifecycleActionOptions: configState.catalogItemLifecycleActionOptions,
|
|
24
|
+
catalogProductLifecycleActionOptions: configState.catalogProductLifecycleActionOptions,
|
|
25
|
+
discountLifecycleActionOptions: configState.discountLifecycleActionOptions,
|
|
26
|
+
qboAccountMappingKindOptions: configState.qboAccountMappingKindOptions,
|
|
27
|
+
qboCustomerMatchingOptions: configState.qboCustomerMatchingOptions,
|
|
28
|
+
qboSyncStatusOptions: configState.qboSyncStatusOptions,
|
|
29
|
+
error: configState.error,
|
|
30
|
+
fetchState: configState.fetchState,
|
|
31
|
+
isInvoicingEnabled: configState.isInvoicingEnabled,
|
|
32
|
+
isInvoicingTosAccepted: configState.isInvoicingTosAccepted,
|
|
8
33
|
status: deriveInvoicingOnboardingStatus(configState.isInvoicingTosAccepted, configState.isInvoicingEnabled),
|
|
9
34
|
};
|
|
10
35
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
4
|
import { fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, } from '../invoicingQboViewReducer';
|
|
6
5
|
export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(retryInvoicingQboSyncTask.match), mergeMap((action) => {
|
|
@@ -13,33 +12,15 @@ export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => act
|
|
|
13
12
|
return of(retryInvoicingQboSyncTaskSuccess({
|
|
14
13
|
status: response.data?.status ?? '',
|
|
15
14
|
taskId: response.data?.task_id ?? taskId,
|
|
16
|
-
}), fetchInvoicingQboSyncHealth()
|
|
17
|
-
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
18
|
-
messageText: 'success',
|
|
19
|
-
type: 'success',
|
|
20
|
-
}));
|
|
15
|
+
}), fetchInvoicingQboSyncHealth());
|
|
21
16
|
}
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
status: response.status,
|
|
25
|
-
taskId,
|
|
26
|
-
}),
|
|
27
|
-
openSnackbar({
|
|
28
|
-
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
29
|
-
messageText: 'failed',
|
|
30
|
-
type: 'error',
|
|
31
|
-
}),
|
|
32
|
-
]);
|
|
33
|
-
}), catchError((error) => from([
|
|
34
|
-
retryInvoicingQboSyncTaskFailure({
|
|
35
|
-
status: createZeniAPIStatus('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
|
|
36
|
-
JSON.stringify(error)),
|
|
17
|
+
return of(retryInvoicingQboSyncTaskFailure({
|
|
18
|
+
status: response.status,
|
|
37
19
|
taskId,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
])));
|
|
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
|
+
}))));
|
|
45
26
|
}));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
4
|
import { fetchInvoicingQboSyncHealth, startInvoicingQboBackfill, startInvoicingQboBackfillFailure, startInvoicingQboBackfillSuccess, } from '../invoicingQboViewReducer';
|
|
6
5
|
export const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(startInvoicingQboBackfill.match), switchMap((action) => {
|
|
@@ -11,31 +10,9 @@ export const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => act
|
|
|
11
10
|
})
|
|
12
11
|
.pipe(mergeMap((response) => {
|
|
13
12
|
if (isSuccessResponse(response)) {
|
|
14
|
-
return
|
|
15
|
-
startInvoicingQboBackfillSuccess(),
|
|
16
|
-
fetchInvoicingQboSyncHealth(),
|
|
17
|
-
openSnackbar({
|
|
18
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
19
|
-
messageText: 'success',
|
|
20
|
-
type: 'success',
|
|
21
|
-
}),
|
|
22
|
-
]);
|
|
13
|
+
return of(startInvoicingQboBackfillSuccess(), fetchInvoicingQboSyncHealth());
|
|
23
14
|
}
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
28
|
-
messageText: 'failed',
|
|
29
|
-
type: 'error',
|
|
30
|
-
}),
|
|
31
|
-
]);
|
|
32
|
-
}), catchError((error) => from([
|
|
33
|
-
startInvoicingQboBackfillFailure(createZeniAPIStatus('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
|
|
34
|
-
JSON.stringify(error))),
|
|
35
|
-
openSnackbar({
|
|
36
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
37
|
-
messageText: 'failed',
|
|
38
|
-
type: 'error',
|
|
39
|
-
}),
|
|
40
|
-
])));
|
|
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))))));
|
|
41
18
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingCreditNotes } from '../../../entity/invoicing/creditNote/creditNoteReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
7
6
|
import { localDataToIssueCreditNotePayload, } from './issueCreditNotePayload';
|
|
@@ -19,28 +18,9 @@ export const issueCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
19
18
|
updateInvoicingCreditNotes([response.data], 'merge'),
|
|
20
19
|
fetchInvoiceDetail({ invoiceId }),
|
|
21
20
|
issueCreditNoteSuccess({ creditNoteId: response.data.id }),
|
|
22
|
-
openSnackbar({
|
|
23
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
24
|
-
messageText: 'success',
|
|
25
|
-
type: 'success',
|
|
26
|
-
}),
|
|
27
21
|
];
|
|
28
22
|
}
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
33
|
-
messageText: 'failed',
|
|
34
|
-
type: 'error',
|
|
35
|
-
}),
|
|
36
|
-
]);
|
|
37
|
-
}), catchError((error) => from([
|
|
38
|
-
issueCreditNoteFailure(createZeniAPIStatus('Unexpected Error', 'Issue credit note REST API call errored out ' +
|
|
39
|
-
JSON.stringify(error))),
|
|
40
|
-
openSnackbar({
|
|
41
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
42
|
-
messageText: 'failed',
|
|
43
|
-
type: 'error',
|
|
44
|
-
}),
|
|
45
|
-
])));
|
|
23
|
+
return of(issueCreditNoteFailure(response.status));
|
|
24
|
+
}), catchError((error) => of(issueCreditNoteFailure(createZeniAPIStatus('Unexpected Error', 'Issue credit note REST API call errored out ' +
|
|
25
|
+
JSON.stringify(error))))));
|
|
46
26
|
}));
|
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* The draft is a single global slice, so a draft seeded for a previously opened
|
|
5
|
-
* invoice can still be in state when another invoice's screen mounts. Anything
|
|
6
|
-
* that would render that stale draft next to this invoice is dropped until the
|
|
7
|
-
* screen re-seeds it for `invoiceId`.
|
|
8
|
-
*/
|
|
9
|
-
export const getIssueCreditNoteView = (state, invoiceId) => {
|
|
10
|
-
const invoiceView = getInvoiceDetail(state, invoiceId);
|
|
11
|
-
const { draft, error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
12
|
-
const isDraftForInvoice = draft.invoiceId === invoiceId;
|
|
1
|
+
import { INVOICING_CREDIT_NOTE_REASON_CODES } from './issueCreditNoteFormConfig';
|
|
2
|
+
export const getIssueCreditNoteView = (state) => {
|
|
3
|
+
const { error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
13
4
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
isDraftForInvoice &&
|
|
17
|
-
draft.lineItems.length > 0,
|
|
5
|
+
error,
|
|
6
|
+
fetchState,
|
|
18
7
|
issuedCreditNoteId,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
version: 1.0,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export const getIssueCreditNoteFormView = (state) => {
|
|
12
|
+
const { draft, error, fetchState } = state.invoicingIssueCreditNoteState;
|
|
13
|
+
return {
|
|
14
|
+
localData: draft,
|
|
22
15
|
reasonCodeValues: [...INVOICING_CREDIT_NOTE_REASON_CODES],
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
fetchState: invoiceView.fetchState,
|
|
16
|
+
error,
|
|
17
|
+
fetchState,
|
|
26
18
|
version: 1.0,
|
|
27
19
|
};
|
|
28
20
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
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';
|
|
6
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
6
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
8
7
|
import { addInvoicingTransactionToList } from '../invoicingTransactionListView/invoicingTransactionListViewReducer';
|
|
@@ -27,30 +26,11 @@ export const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
27
26
|
updateInvoices([response.data], 'merge'),
|
|
28
27
|
fetchInvoiceDetail({ invoiceId }),
|
|
29
28
|
recordPaymentSuccess({ invoiceId }),
|
|
30
|
-
openSnackbar({
|
|
31
|
-
messageSection: 'invoicing_payment_recorded',
|
|
32
|
-
messageText: 'success',
|
|
33
|
-
type: 'success',
|
|
34
|
-
}),
|
|
35
29
|
];
|
|
36
30
|
}
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
messageSection: 'invoicing_payment_recorded',
|
|
41
|
-
messageText: 'failed',
|
|
42
|
-
type: 'error',
|
|
43
|
-
}),
|
|
44
|
-
]);
|
|
45
|
-
}), catchError((error) => from([
|
|
46
|
-
recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
47
|
-
JSON.stringify(error))),
|
|
48
|
-
openSnackbar({
|
|
49
|
-
messageSection: 'invoicing_payment_recorded',
|
|
50
|
-
messageText: 'failed',
|
|
51
|
-
type: 'error',
|
|
52
|
-
}),
|
|
53
|
-
])));
|
|
31
|
+
return of(recordPaymentFailure(response.status));
|
|
32
|
+
}), catchError((error) => of(recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
33
|
+
JSON.stringify(error))))));
|
|
54
34
|
}
|
|
55
35
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/payments`;
|
|
56
36
|
const data = localDataToRecordPaymentPayload(draft);
|
|
@@ -69,28 +49,9 @@ export const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
69
49
|
if (linkedInvoiceId != null) {
|
|
70
50
|
successActions.push(fetchInvoiceDetail({ invoiceId: linkedInvoiceId }));
|
|
71
51
|
}
|
|
72
|
-
successActions.push(openSnackbar({
|
|
73
|
-
messageSection: 'invoicing_payment_recorded',
|
|
74
|
-
messageText: 'success',
|
|
75
|
-
type: 'success',
|
|
76
|
-
}));
|
|
77
52
|
return successActions;
|
|
78
53
|
}
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
messageSection: 'invoicing_payment_recorded',
|
|
83
|
-
messageText: 'failed',
|
|
84
|
-
type: 'error',
|
|
85
|
-
}),
|
|
86
|
-
]);
|
|
87
|
-
}), catchError((error) => from([
|
|
88
|
-
recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
89
|
-
JSON.stringify(error))),
|
|
90
|
-
openSnackbar({
|
|
91
|
-
messageSection: 'invoicing_payment_recorded',
|
|
92
|
-
messageText: 'failed',
|
|
93
|
-
type: 'error',
|
|
94
|
-
}),
|
|
95
|
-
])));
|
|
54
|
+
return of(recordPaymentFailure(response.status));
|
|
55
|
+
}), catchError((error) => of(recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
56
|
+
JSON.stringify(error))))));
|
|
96
57
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, updateInvoicingSettings, updateInvoicingSettingsFailure, updateInvoicingStripeConnection, } from './settingsViewReducer';
|
|
7
6
|
export const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingSettings.match), switchMap(() => {
|
|
@@ -58,32 +57,15 @@ export const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => act
|
|
|
58
57
|
}));
|
|
59
58
|
export const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveInvoicingSettings.match), mergeMap((action) => {
|
|
60
59
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
|
|
61
|
-
const { settings, snackbarSection } = action.payload;
|
|
62
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
63
|
-
? []
|
|
64
|
-
: [
|
|
65
|
-
openSnackbar({
|
|
66
|
-
messageSection: snackbarSection,
|
|
67
|
-
messageText,
|
|
68
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
69
|
-
}),
|
|
70
|
-
];
|
|
71
60
|
return zeniAPI
|
|
72
|
-
.putAndGetJSON(apiUrl, {
|
|
61
|
+
.putAndGetJSON(apiUrl, {
|
|
62
|
+
...action.payload,
|
|
63
|
+
})
|
|
73
64
|
.pipe(switchMap((response) => {
|
|
74
65
|
if (isSuccessResponse(response) && response.data != null) {
|
|
75
|
-
return
|
|
76
|
-
saveInvoicingSettingsSuccess(response.data),
|
|
77
|
-
...snackbar('success'),
|
|
78
|
-
]);
|
|
66
|
+
return of(saveInvoicingSettingsSuccess(response.data));
|
|
79
67
|
}
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
]);
|
|
84
|
-
}), catchError((error) => from([
|
|
85
|
-
saveInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Save settings REST API call errored out ' +
|
|
86
|
-
JSON.stringify(error))),
|
|
87
|
-
...snackbar('failed'),
|
|
88
|
-
])));
|
|
68
|
+
return of(saveInvoicingSettingsFailure(response.status));
|
|
69
|
+
}), catchError((error) => of(saveInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Save settings REST API call errored out ' +
|
|
70
|
+
JSON.stringify(error))))));
|
|
89
71
|
}));
|
|
@@ -30,7 +30,7 @@ const settingsView = createSlice({
|
|
|
30
30
|
saveInvoicingSettings(draft, action) {
|
|
31
31
|
draft.saveFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
32
32
|
if (draft.settings != null) {
|
|
33
|
-
draft.settings = { ...draft.settings, ...action.payload
|
|
33
|
+
draft.settings = { ...draft.settings, ...action.payload };
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
saveInvoicingSettingsSuccess(draft, action) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getFormattedAddress } from '../../addressView/addressViewSelector';
|
|
2
|
-
import { getInvoicingConfigView } from '../invoicingConfigView/invoicingConfigViewSelector';
|
|
3
2
|
import { INVOICING_BUSINESS_ADDRESS_TYPE, entityToInvoicingBrandingFormLocalData, } from './invoicingBrandingFormConfig';
|
|
4
3
|
/**
|
|
5
4
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
@@ -34,8 +33,7 @@ export const getInvoicingSettingsView = (state) => {
|
|
|
34
33
|
* Bundled view for the branding settings form: the draft `localData` (seeded
|
|
35
34
|
* from the existing settings until the user edits), the business-address label
|
|
36
35
|
* (from the shared Address screen, seeded on load from `address_id`), the raw
|
|
37
|
-
* settings (for the logo/preview)
|
|
38
|
-
* save fetch state.
|
|
36
|
+
* settings (for the logo/preview) and the save fetch state.
|
|
39
37
|
*/
|
|
40
38
|
export const getInvoicingBrandingFormView = (state) => {
|
|
41
39
|
const { brandingDraft, saveFetchState, settings } = state.invoicingSettingsViewState;
|
|
@@ -45,7 +43,6 @@ export const getInvoicingBrandingFormView = (state) => {
|
|
|
45
43
|
: undefined;
|
|
46
44
|
return {
|
|
47
45
|
addressLabel,
|
|
48
|
-
dateFormatOptions: getInvoicingConfigView(state).dateFormatOptions,
|
|
49
46
|
localData: brandingDraft ?? entityToInvoicingBrandingFormLocalData(settings),
|
|
50
47
|
saveState: saveFetchState,
|
|
51
48
|
settings,
|
|
@@ -1,38 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { runInvoicingSubscriptionAction, runInvoicingSubscriptionActionFailure, runInvoicingSubscriptionActionSuccess, } from './subscriptionActionReducer';
|
|
9
|
-
/**
|
|
10
|
-
* Each lifecycle action reports with its own copy. Keyed loosely because the
|
|
11
|
-
* action payload carries a plain `string`; an unmapped kind stays silent.
|
|
12
|
-
*/
|
|
13
|
-
const SNACKBAR_SECTION_BY_ACTION = {
|
|
14
|
-
activate: 'invoicing_subscription_activated',
|
|
15
|
-
cancel: 'invoicing_subscription_cancelled',
|
|
16
|
-
change_term_end: 'invoicing_subscription_term_end_changed',
|
|
17
|
-
pause: 'invoicing_subscription_paused',
|
|
18
|
-
reactivate: 'invoicing_subscription_reactivated',
|
|
19
|
-
remove_scheduled_cancellation: 'invoicing_subscription_cancellation_removed',
|
|
20
|
-
resume: 'invoicing_subscription_resumed',
|
|
21
|
-
set_non_renewing: 'invoicing_subscription_non_renewing',
|
|
22
|
-
};
|
|
23
8
|
export const runInvoicingSubscriptionActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingSubscriptionAction.match), mergeMap((action) => {
|
|
24
9
|
const { action: kind, body, id } = action.payload;
|
|
25
10
|
const requestBody = { action: kind, ...(body ?? {}) };
|
|
26
|
-
const snackbarSection = SNACKBAR_SECTION_BY_ACTION[kind];
|
|
27
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
28
|
-
? []
|
|
29
|
-
: [
|
|
30
|
-
openSnackbar({
|
|
31
|
-
messageSection: snackbarSection,
|
|
32
|
-
messageText,
|
|
33
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
34
|
-
}),
|
|
35
|
-
];
|
|
36
11
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/subscriptions/${encodeURIComponent(id)}/actions`;
|
|
37
12
|
return zeniAPI
|
|
38
13
|
.postAndGetJSON(apiUrl, requestBody)
|
|
@@ -42,22 +17,15 @@ export const runInvoicingSubscriptionActionEpic = (actions$, _state$, zeniAPI) =
|
|
|
42
17
|
updateInvoicingSubscriptions([response.data], 'merge'),
|
|
43
18
|
updateAddresses(extractInvoicingSubscriptionAddresses([response.data])),
|
|
44
19
|
runInvoicingSubscriptionActionSuccess({ id }),
|
|
45
|
-
...snackbar('success'),
|
|
46
20
|
];
|
|
47
21
|
}
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
error: response.status,
|
|
51
|
-
id,
|
|
52
|
-
}),
|
|
53
|
-
...snackbar('failed'),
|
|
54
|
-
]);
|
|
55
|
-
}), catchError((error) => from([
|
|
56
|
-
runInvoicingSubscriptionActionFailure({
|
|
57
|
-
error: createZeniAPIStatus('Unexpected Error', 'Subscription action REST API call errored out ' +
|
|
58
|
-
JSON.stringify(error)),
|
|
22
|
+
return of(runInvoicingSubscriptionActionFailure({
|
|
23
|
+
error: response.status,
|
|
59
24
|
id,
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
|
|
25
|
+
}));
|
|
26
|
+
}), catchError((error) => of(runInvoicingSubscriptionActionFailure({
|
|
27
|
+
error: createZeniAPIStatus('Unexpected Error', 'Subscription action REST API call errored out ' +
|
|
28
|
+
JSON.stringify(error)),
|
|
29
|
+
id,
|
|
30
|
+
}))));
|
|
63
31
|
}));
|
|
@@ -206,13 +206,10 @@ const vendorFiling1099UploadDetails = createSlice({
|
|
|
206
206
|
address: action.payload.ocrData.address != null,
|
|
207
207
|
};
|
|
208
208
|
},
|
|
209
|
-
clearVendorFiling1099UploadDetails() {
|
|
210
|
-
return initialState;
|
|
211
|
-
},
|
|
212
209
|
},
|
|
213
210
|
extraReducers: (builder) => {
|
|
214
211
|
builder.addCase(clearAll, () => initialState);
|
|
215
212
|
},
|
|
216
213
|
});
|
|
217
|
-
export const {
|
|
214
|
+
export const { updateW9FormUploadFile, updateW9FormUploadFetchState, vendorFiling1099UploadDetailsSave, vendorFiling1099UploadDetailsResetLocalData, vendorFiling1099UploadDetailsSuccessOrFailure, initializeVendorFiling1099UploadDetailsLocalState, updateVendor1099DetailsLocalData, updateW9FormOCRDataToLocalData, vendorFiling1099UploadDetailsResetFormStatus, } = vendorFiling1099UploadDetails.actions;
|
|
218
215
|
export default vendorFiling1099UploadDetails.reducer;
|
|
@@ -43,9 +43,6 @@ const vendorTabView = createSlice({
|
|
|
43
43
|
draft.currentTab = action.payload.tab;
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
|
-
clearVendorTabView(draft) {
|
|
47
|
-
Object.assign(draft, initialState);
|
|
48
|
-
},
|
|
49
46
|
},
|
|
50
47
|
extraReducers: (builder) => {
|
|
51
48
|
builder.addCase(clearAll, (draft) => {
|
|
@@ -53,5 +50,5 @@ const vendorTabView = createSlice({
|
|
|
53
50
|
});
|
|
54
51
|
},
|
|
55
52
|
});
|
|
56
|
-
export const {
|
|
53
|
+
export const { fetchVendorTabView, updateVendorTabViewTab } = vendorTabView.actions;
|
|
57
54
|
export default vendorTabView.reducer;
|