@zeniai/client-epic-state 5.1.97-betaAK4 → 5.1.98
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/invoicing/coupon/couponConstants.d.ts +11 -0
- package/lib/entity/invoicing/coupon/couponConstants.js +29 -0
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +0 -12
- package/lib/entity/invoicing/invoicingCommonPayload.js +0 -18
- package/lib/esm/entity/invoicing/coupon/couponConstants.js +26 -0
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +0 -16
- package/lib/esm/index.js +11 -12
- package/lib/esm/view/invoicing/auditView/auditViewSelector.js +0 -4
- package/lib/esm/view/invoicing/couponView/couponViewSelector.js +3 -10
- package/lib/esm/view/invoicing/couponView/couponViewState.js +9 -0
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +0 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +1 -2
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteSelector.js +2 -4
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +6 -7
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +19 -3
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +5 -10
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +4 -6
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +17 -0
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +0 -5
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +1 -2
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +6 -6
- package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +4 -12
- package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +9 -13
- package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +1 -5
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +1 -2
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -26
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +0 -9
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +3 -8
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +9 -0
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +3 -9
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +9 -0
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +3 -8
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +9 -1
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +3 -11
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +9 -0
- package/lib/esm/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +1 -2
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +5 -5
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +4 -9
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +9 -11
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +8 -1
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +1 -3
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +2 -5
- package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +26 -0
- package/lib/esm/view/invoicing/recordPayment/recordPaymentSelector.js +6 -27
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +1 -7
- package/lib/index.d.ts +12 -13
- package/lib/index.js +24 -9
- package/lib/view/invoicing/auditView/auditViewSelector.d.ts +0 -4
- package/lib/view/invoicing/auditView/auditViewSelector.js +0 -4
- package/lib/view/invoicing/couponView/couponViewSelector.d.ts +1 -5
- package/lib/view/invoicing/couponView/couponViewSelector.js +2 -9
- package/lib/view/invoicing/couponView/couponViewState.d.ts +7 -0
- package/lib/view/invoicing/couponView/couponViewState.js +10 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +0 -1
- package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +1 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.d.ts +1 -3
- package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.js +2 -4
- package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +0 -6
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -6
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.d.ts +6 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +20 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +7 -9
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +5 -10
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +3 -4
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +3 -5
- package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.d.ts +8 -0
- package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +18 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +0 -5
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +0 -5
- package/lib/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +1 -2
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +5 -5
- package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +1 -3
- package/lib/view/invoicing/invoiceList/invoiceListSelector.js +3 -11
- package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +9 -13
- package/lib/view/invoicing/invoiceList/invoiceListState.js +10 -15
- package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts +1 -9
- package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +1 -5
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +1 -3
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +1 -2
- 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 -26
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -19
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +1 -11
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +0 -13
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts +1 -3
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +2 -7
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +7 -0
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +10 -1
- package/lib/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +2 -2
- package/lib/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.d.ts +1 -3
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +2 -8
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +7 -0
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +10 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.d.ts +1 -3
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +2 -7
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +9 -2
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +10 -2
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts +1 -7
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +2 -10
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +7 -0
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +10 -1
- package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +1 -2
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +4 -4
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts +0 -3
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +3 -8
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts +10 -10
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +10 -13
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.d.ts +2 -0
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +9 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.d.ts +2 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.js +1 -3
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +1 -3
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +1 -4
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteState.d.ts +0 -6
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.d.ts +6 -0
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +27 -1
- package/lib/view/invoicing/recordPayment/recordPaymentSelector.d.ts +2 -3
- package/lib/view/invoicing/recordPayment/recordPaymentSelector.js +6 -27
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +1 -11
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -7
- package/package.json +1 -1
- package/lib/esm/view/invoicing/invoicingTabHelper.js +0 -25
- package/lib/view/invoicing/invoicingTabHelper.d.ts +0 -27
- package/lib/view/invoicing/invoicingTabHelper.js +0 -28
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
|
-
import {
|
|
3
|
-
import { ALL_INVOICING_INVOICE_TAB_IDS, makeInvoiceTabState, } from './invoiceListState';
|
|
2
|
+
import { INVOICING_INVOICE_TABS, } from './invoiceListState';
|
|
4
3
|
/**
|
|
5
4
|
* Bundled read view for the invoices list page: the denormalized invoice rows
|
|
6
5
|
* plus list counts, KPIs and their fetch states. Memoized so the `invoices`
|
|
7
6
|
* array (and the wrapping view object) keep referential identity until the
|
|
8
7
|
* invoice entity slice or the list-view slice actually change.
|
|
9
8
|
*/
|
|
10
|
-
export const getInvoiceListView = createSelector((state) => state.invoicingInvoiceState, (state) => state.invoicingInvoiceListState, (
|
|
11
|
-
|
|
12
|
-
// cache entry until it is fetched, so default rather than crash.
|
|
13
|
-
const activeTabState = listViewState.invoiceByTab[listViewState.activeTab] ??
|
|
14
|
-
makeInvoiceTabState();
|
|
9
|
+
export const getInvoiceListView = createSelector((state) => state.invoicingInvoiceState, (state) => state.invoicingInvoiceListState, (invoiceState, listViewState) => {
|
|
10
|
+
const activeTabState = listViewState.invoiceByTab[listViewState.activeTab];
|
|
15
11
|
return {
|
|
16
12
|
activeTab: listViewState.activeTab,
|
|
17
13
|
invoices: activeTabState.invoiceIds
|
|
@@ -23,11 +19,7 @@ export const getInvoiceListView = createSelector((state) => state.invoicingInvoi
|
|
|
23
19
|
kpis: listViewState.kpis,
|
|
24
20
|
kpisFetchState: listViewState.kpisFetchState,
|
|
25
21
|
nextCursor: activeTabState.nextCursor,
|
|
26
|
-
|
|
27
|
-
tabIds: invoicingTabIdsFromConfig({
|
|
28
|
-
allTabIds: ALL_INVOICING_INVOICE_TAB_IDS,
|
|
29
|
-
statusOptions,
|
|
30
|
-
}),
|
|
22
|
+
tabIds: INVOICING_INVOICE_TABS,
|
|
31
23
|
fetchState: activeTabState.fetchState,
|
|
32
24
|
error: activeTabState.error,
|
|
33
25
|
version: 1.0,
|
|
@@ -8,25 +8,21 @@ export const ALL_INVOICING_INVOICE_TAB_IDS = [
|
|
|
8
8
|
'voided',
|
|
9
9
|
];
|
|
10
10
|
export const toInvoicingInvoiceTabId = (v) => stringToUnion(v, ALL_INVOICING_INVOICE_TAB_IDS);
|
|
11
|
+
/**
|
|
12
|
+
* Ordered filter-tab id set owned by CES so the invoice-list tabs live next to
|
|
13
|
+
* the model rather than being hardcoded in web-components. Tab labels and the
|
|
14
|
+
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
15
|
+
* display order.
|
|
16
|
+
*/
|
|
17
|
+
export const INVOICING_INVOICE_TABS = [
|
|
18
|
+
...ALL_INVOICING_INVOICE_TAB_IDS,
|
|
19
|
+
];
|
|
11
20
|
export const makeInvoiceTabState = () => ({
|
|
12
21
|
invoiceIds: [],
|
|
13
22
|
nextCursor: null,
|
|
14
23
|
fetchState: 'Not-Started',
|
|
15
24
|
error: undefined,
|
|
16
25
|
});
|
|
17
|
-
/**
|
|
18
|
-
* The cache entry for a tab, created on first use. The tab set is config-driven,
|
|
19
|
-
* so a status this build's union does not know still needs somewhere to cache.
|
|
20
|
-
*/
|
|
21
|
-
export const invoiceTabStateFor = (invoiceByTab, tabId) => {
|
|
22
|
-
const existing = invoiceByTab[tabId];
|
|
23
|
-
if (existing != null) {
|
|
24
|
-
return existing;
|
|
25
|
-
}
|
|
26
|
-
const created = makeInvoiceTabState();
|
|
27
|
-
invoiceByTab[tabId] = created;
|
|
28
|
-
return created;
|
|
29
|
-
};
|
|
30
26
|
export const makeInvoiceByTab = () => ALL_INVOICING_INVOICE_TAB_IDS.reduce((acc, tabId) => {
|
|
31
27
|
acc[tabId] = makeInvoiceTabState();
|
|
32
28
|
return acc;
|
|
@@ -2,17 +2,13 @@ import { getInvoicingPlanById } from '../../../entity/invoicing/plan/planSelecto
|
|
|
2
2
|
import { getInvoicingConfigView } from '../invoicingConfigView/invoicingConfigViewSelector';
|
|
3
3
|
export const getInvoicingCatalogItemDetail = (state, _kind, id) => {
|
|
4
4
|
const { error, fetchState } = state.invoicingCatalogItemDetailViewState;
|
|
5
|
-
const {
|
|
5
|
+
const { catalogItemLifecycleActionOptions, catalogProductLifecycleActionOptions, catalogTierTypeOptionsByPricingModel, fetchState: configFetchState, } = getInvoicingConfigView(state);
|
|
6
6
|
return {
|
|
7
7
|
catalogItemLifecycleActionOptions,
|
|
8
8
|
catalogProductLifecycleActionOptions,
|
|
9
9
|
catalogTierTypeOptionsByPricingModel,
|
|
10
10
|
configFetchState,
|
|
11
|
-
periodUnitOptions: billingPeriodUnitOptions,
|
|
12
11
|
plan: getInvoicingPlanById(state.invoicingPlanState, id),
|
|
13
|
-
trialEndActionOptions: catalogTrialEndActionOptions,
|
|
14
|
-
trialUnitOptions: catalogTrialUnitOptions,
|
|
15
|
-
typeOptions: catalogItemTypeOptions,
|
|
16
12
|
fetchState,
|
|
17
13
|
error,
|
|
18
14
|
version: 1.0,
|
|
@@ -15,8 +15,7 @@ export const getInvoicingCatalogPrices = (items) => items.flatMap((item) => (ite
|
|
|
15
15
|
* denormalized arrays keep referential identity. The base `fetchState`/`error`
|
|
16
16
|
* track the plan list; the product list has its own `productFetchState`.
|
|
17
17
|
*/
|
|
18
|
-
export const getInvoicingCatalogListView = createSelector((state) => state.invoicingPlanState, (state) => state.invoicingCatalogListViewState, (
|
|
19
|
-
catalogItemLifecycleActionOptions,
|
|
18
|
+
export const getInvoicingCatalogListView = createSelector((state) => state.invoicingPlanState, (state) => state.invoicingCatalogListViewState, (planState, listViewState) => ({
|
|
20
19
|
plans: getInvoicingPlansByIds(planState, listViewState.planIds),
|
|
21
20
|
productColumns: INVOICING_PRODUCT_COLUMNS,
|
|
22
21
|
products: getInvoicingPlansByIds(planState, listViewState.productIds),
|
|
@@ -23,19 +23,6 @@ export const initialState = {
|
|
|
23
23
|
netTermDayOptions: [],
|
|
24
24
|
paymentGatewayOptions: [],
|
|
25
25
|
taxabilityOptions: [],
|
|
26
|
-
cardStatusOptions: [],
|
|
27
|
-
catalogItemStatusOptions: [],
|
|
28
|
-
catalogItemTypeOptions: [],
|
|
29
|
-
creditNoteReasonCodeOptions: [],
|
|
30
|
-
creditNoteStatusOptions: [],
|
|
31
|
-
creditNoteTypeOptions: [],
|
|
32
|
-
customerStatusOptions: [],
|
|
33
|
-
discountStatusOptions: [],
|
|
34
|
-
dunningCaseStatusOptions: [],
|
|
35
|
-
invoiceStatusOptions: [],
|
|
36
|
-
subscriptionStatusOptions: [],
|
|
37
|
-
transactionStatusOptions: [],
|
|
38
|
-
transactionTypeOptions: [],
|
|
39
26
|
enableFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
40
27
|
subscriptionLifecycleActionOptions: [],
|
|
41
28
|
subscriptionCommercialEditAllowedFromStatuses: [],
|
|
@@ -89,19 +76,6 @@ export function mapInvoicingConfigPayloadToState(payload) {
|
|
|
89
76
|
netTermDayOptions: (payload.net_term_day_options ?? []).map(toInvoicingNamedOption),
|
|
90
77
|
paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(toInvoicingNamedOption),
|
|
91
78
|
taxabilityOptions: (payload.taxability_options ?? []).map(toInvoicingNamedOption),
|
|
92
|
-
cardStatusOptions: (payload.card_status_options ?? []).map(toInvoicingNamedOption),
|
|
93
|
-
catalogItemStatusOptions: (payload.catalog_item_status_options ?? []).map(toInvoicingNamedOption),
|
|
94
|
-
catalogItemTypeOptions: (payload.catalog_item_type_options ?? []).map(toInvoicingNamedOption),
|
|
95
|
-
creditNoteReasonCodeOptions: (payload.credit_note_reason_code_options ?? []).map(toInvoicingNamedOption),
|
|
96
|
-
creditNoteStatusOptions: (payload.credit_note_status_options ?? []).map(toInvoicingNamedOption),
|
|
97
|
-
creditNoteTypeOptions: (payload.credit_note_type_options ?? []).map(toInvoicingNamedOption),
|
|
98
|
-
customerStatusOptions: (payload.customer_status_options ?? []).map(toInvoicingNamedOption),
|
|
99
|
-
discountStatusOptions: (payload.discount_status_options ?? []).map(toInvoicingNamedOption),
|
|
100
|
-
dunningCaseStatusOptions: (payload.dunning_case_status_options ?? []).map(toInvoicingNamedOption),
|
|
101
|
-
invoiceStatusOptions: (payload.invoice_status_options ?? []).map(toInvoicingNamedOption),
|
|
102
|
-
subscriptionStatusOptions: (payload.subscription_status_options ?? []).map(toInvoicingNamedOption),
|
|
103
|
-
transactionStatusOptions: (payload.transaction_status_options ?? []).map(toInvoicingNamedOption),
|
|
104
|
-
transactionTypeOptions: (payload.transaction_type_options ?? []).map(toInvoicingNamedOption),
|
|
105
79
|
createdAt: payload.created_at ?? undefined,
|
|
106
80
|
updatedAt: payload.updated_at ?? undefined,
|
|
107
81
|
dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
|
|
@@ -8,12 +8,3 @@ export const getInvoicingConfigView = (state) => {
|
|
|
8
8
|
status: deriveInvoicingOnboardingStatus(configState.isInvoicingTosAccepted, configState.isInvoicingEnabled),
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export const getInvoicingOnboardingGateView = (state) => {
|
|
12
|
-
const { acceptTermsFetchState, enableFetchState, fetchState } = state.invoicingConfigViewState;
|
|
13
|
-
return {
|
|
14
|
-
acceptTermsState: acceptTermsFetchState,
|
|
15
|
-
enableState: enableFetchState,
|
|
16
|
-
fetchState,
|
|
17
|
-
status: deriveInvoicingOnboardingStatus(state.invoicingConfigViewState.isInvoicingTosAccepted, state.invoicingConfigViewState.isInvoicingEnabled),
|
|
18
|
-
};
|
|
19
|
-
};
|
package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import { getInvoicingCreditNotesByIds } from '../../../entity/invoicing/creditNote/creditNoteSelector';
|
|
3
|
-
import {
|
|
4
|
-
import { INVOICING_CREDIT_NOTE_COLUMNS, ALL_INVOICING_CREDIT_NOTE_TAB_IDS, } from './invoicingCreditNoteListViewState';
|
|
3
|
+
import { INVOICING_CREDIT_NOTE_COLUMNS, INVOICING_CREDIT_NOTE_TABS, } from './invoicingCreditNoteListViewState';
|
|
5
4
|
/**
|
|
6
5
|
* Memoized so the denormalized `creditNotes` array (and the wrapping view
|
|
7
6
|
* object) keep referential identity until the credit-note entity slice or the
|
|
8
7
|
* list-view slice actually change.
|
|
9
8
|
*/
|
|
10
|
-
export const getInvoicingCreditNoteListView = createSelector((state) => state.invoicingCreditNoteState, (state) => state.invoicingCreditNoteListViewState, (
|
|
9
|
+
export const getInvoicingCreditNoteListView = createSelector((state) => state.invoicingCreditNoteState, (state) => state.invoicingCreditNoteListViewState, (creditNoteState, listViewState) => {
|
|
11
10
|
const { activeTab } = listViewState;
|
|
12
11
|
const allCreditNotes = getInvoicingCreditNotesByIds(creditNoteState, listViewState.ids);
|
|
13
12
|
// The list API ignores `status`, so it returns every status; filter to the
|
|
@@ -23,11 +22,7 @@ export const getInvoicingCreditNoteListView = createSelector((state) => state.in
|
|
|
23
22
|
countsFetchState: listViewState.countsFetchState,
|
|
24
23
|
filters: listViewState.filters,
|
|
25
24
|
nextCursor: listViewState.nextCursor,
|
|
26
|
-
|
|
27
|
-
tabIds: invoicingTabIdsFromConfig({
|
|
28
|
-
allTabIds: ALL_INVOICING_CREDIT_NOTE_TAB_IDS,
|
|
29
|
-
statusOptions,
|
|
30
|
-
}),
|
|
25
|
+
tabIds: INVOICING_CREDIT_NOTE_TABS,
|
|
31
26
|
fetchState: listViewState.fetchState,
|
|
32
27
|
error: listViewState.error,
|
|
33
28
|
sort: listViewState.sort,
|
package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js
CHANGED
|
@@ -28,3 +28,12 @@ export const ALL_INVOICING_CREDIT_NOTE_TAB_IDS = [
|
|
|
28
28
|
'voided',
|
|
29
29
|
];
|
|
30
30
|
export const toInvoicingCreditNoteTabId = (v) => stringToUnion(v, ALL_INVOICING_CREDIT_NOTE_TAB_IDS);
|
|
31
|
+
/**
|
|
32
|
+
* Ordered filter-tab id set owned by CES so the credit-notes-list tabs live next
|
|
33
|
+
* to the model rather than being hardcoded in web-components. Tab labels and the
|
|
34
|
+
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
35
|
+
* display order.
|
|
36
|
+
*/
|
|
37
|
+
export const INVOICING_CREDIT_NOTE_TABS = [
|
|
38
|
+
...ALL_INVOICING_CREDIT_NOTE_TAB_IDS,
|
|
39
|
+
];
|
package/lib/esm/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js
CHANGED
|
@@ -34,8 +34,8 @@ export const fetchInvoicingCustomerDetailPageEpic = (actions$, state$) => action
|
|
|
34
34
|
const invoiceListIsForCustomer = invoiceListState.filters.customerId === id;
|
|
35
35
|
if (!invoiceListIsForCustomer ||
|
|
36
36
|
shouldFetch({
|
|
37
|
-
fetchState: invoiceListTabState
|
|
38
|
-
error: invoiceListTabState
|
|
37
|
+
fetchState: invoiceListTabState.fetchState,
|
|
38
|
+
error: invoiceListTabState.error,
|
|
39
39
|
}, cacheOverride)) {
|
|
40
40
|
pageActions.push(fetchInvoiceList({ filters: { customerId: id } }));
|
|
41
41
|
}
|
package/lib/esm/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js
CHANGED
|
@@ -10,7 +10,7 @@ export const getInvoicingCustomerDetail = (state, invoicingCustomerID) => {
|
|
|
10
10
|
const settings = getInvoicingSettings(state);
|
|
11
11
|
return {
|
|
12
12
|
invoicingCustomer: getInvoicingCustomerById(invoicingCustomerState, invoicingCustomerID),
|
|
13
|
-
invoices: getInvoicesByIds(state.invoicingInvoiceState, state.invoicingInvoiceListState.invoiceByTab[state.invoicingInvoiceListState.activeTab]
|
|
13
|
+
invoices: getInvoicesByIds(state.invoicingInvoiceState, state.invoicingInvoiceListState.invoiceByTab[state.invoicingInvoiceListState.activeTab].invoiceIds),
|
|
14
14
|
setupIntent: getInvoicingSetupIntent(state),
|
|
15
15
|
setupIntentFetchState: getInvoicingSetupIntentFetchState(state),
|
|
16
16
|
plaidLinkToken: getInvoicingPlaidLinkToken(state),
|
package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import { getInvoicingCustomersByIds } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerSelector';
|
|
3
|
-
import {
|
|
4
|
-
import { INVOICING_CUSTOMER_COLUMNS, ALL_INVOICING_CUSTOMER_TAB_IDS, } from './invoicingCustomerListViewState';
|
|
3
|
+
import { INVOICING_CUSTOMER_COLUMNS, INVOICING_CUSTOMER_TABS, } from './invoicingCustomerListViewState';
|
|
5
4
|
/**
|
|
6
5
|
* Memoized so the denormalized `customers` array (and the wrapping view object)
|
|
7
6
|
* keep referential identity until the customer entity slice or the list-view
|
|
8
7
|
* slice actually change. Without this, the connected list page re-rendered on
|
|
9
8
|
* every unrelated redux action because a fresh array was built each call.
|
|
10
9
|
*/
|
|
11
|
-
export const getInvoicingCustomerListView = createSelector((state) => state.invoicingCustomerState, (state) => state.invoicingCustomerListViewState, (
|
|
10
|
+
export const getInvoicingCustomerListView = createSelector((state) => state.invoicingCustomerState, (state) => state.invoicingCustomerListViewState, (customerState, listViewState) => {
|
|
12
11
|
const { activeTab } = listViewState;
|
|
13
12
|
const allCustomers = getInvoicingCustomersByIds(customerState, listViewState.ids);
|
|
14
13
|
// The list API ignores `status`, so it returns every status; filter to the
|
|
@@ -29,12 +28,7 @@ export const getInvoicingCustomerListView = createSelector((state) => state.invo
|
|
|
29
28
|
filters: listViewState.filters,
|
|
30
29
|
count: listViewState.counts,
|
|
31
30
|
countsFetchState: listViewState.countsFetchState,
|
|
32
|
-
|
|
33
|
-
tabIds: invoicingTabIdsFromConfig({
|
|
34
|
-
allTabIds: ALL_INVOICING_CUSTOMER_TAB_IDS,
|
|
35
|
-
localTabIds: ['trial', 'at_risk'],
|
|
36
|
-
statusOptions,
|
|
37
|
-
}),
|
|
31
|
+
tabIds: INVOICING_CUSTOMER_TABS,
|
|
38
32
|
sort: listViewState.sort,
|
|
39
33
|
};
|
|
40
34
|
});
|
|
@@ -23,3 +23,12 @@ export const ALL_INVOICING_CUSTOMER_TAB_IDS = [
|
|
|
23
23
|
'at_risk',
|
|
24
24
|
];
|
|
25
25
|
export const toInvoicingCustomerTabId = (v) => stringToUnion(v, ALL_INVOICING_CUSTOMER_TAB_IDS);
|
|
26
|
+
/**
|
|
27
|
+
* Ordered filter-tab id set owned by CES so the customer-list tabs live next to
|
|
28
|
+
* the model rather than being hardcoded in web-components. Tab labels and the
|
|
29
|
+
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
30
|
+
* display order.
|
|
31
|
+
*/
|
|
32
|
+
export const INVOICING_CUSTOMER_TABS = [
|
|
33
|
+
...ALL_INVOICING_CUSTOMER_TAB_IDS,
|
|
34
|
+
];
|
package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import { getInvoicingDunningCasesByIds } from '../../../entity/invoicing/dunningCase/dunningCaseSelector';
|
|
3
|
-
import {
|
|
4
|
-
import { INVOICING_DUNNING_CASE_COLUMNS, ALL_INVOICING_DUNNING_CASE_TAB_IDS, } from './invoicingDunningCaseListViewState';
|
|
3
|
+
import { INVOICING_DUNNING_CASE_COLUMNS, INVOICING_DUNNING_CASE_TABS, } from './invoicingDunningCaseListViewState';
|
|
5
4
|
/**
|
|
6
5
|
* Memoized so the denormalized `dunningCases` array (and the wrapping view
|
|
7
6
|
* object) keep referential identity until the dunning-case entity slice or the
|
|
8
7
|
* list-view slice actually change.
|
|
9
8
|
*/
|
|
10
|
-
export const getInvoicingDunningCaseListView = createSelector((state) => state.invoicingDunningCaseState, (state) => state.invoicingDunningCaseListViewState, (
|
|
9
|
+
export const getInvoicingDunningCaseListView = createSelector((state) => state.invoicingDunningCaseState, (state) => state.invoicingDunningCaseListViewState, (dunningCaseState, listViewState) => {
|
|
11
10
|
const { activeTab } = listViewState;
|
|
12
11
|
const allDunningCases = getInvoicingDunningCasesByIds(dunningCaseState, listViewState.ids);
|
|
13
12
|
// The list API ignores `status`, so it returns every status; filter to the
|
|
@@ -25,11 +24,7 @@ export const getInvoicingDunningCaseListView = createSelector((state) => state.i
|
|
|
25
24
|
nextCursor: listViewState.nextCursor,
|
|
26
25
|
fetchState: listViewState.fetchState,
|
|
27
26
|
error: listViewState.error,
|
|
28
|
-
|
|
29
|
-
tabIds: invoicingTabIdsFromConfig({
|
|
30
|
-
allTabIds: ALL_INVOICING_DUNNING_CASE_TAB_IDS,
|
|
31
|
-
statusOptions,
|
|
32
|
-
}),
|
|
27
|
+
tabIds: INVOICING_DUNNING_CASE_TABS,
|
|
33
28
|
sort: listViewState.sort,
|
|
34
29
|
version: 1.0,
|
|
35
30
|
};
|
package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js
CHANGED
|
@@ -25,8 +25,16 @@ export const ALL_INVOICING_DUNNING_CASE_TAB_IDS = [
|
|
|
25
25
|
'Retrying',
|
|
26
26
|
'Scheduled',
|
|
27
27
|
'Manual Review',
|
|
28
|
-
'Paused',
|
|
29
28
|
'Resolved',
|
|
30
29
|
'Cancelled',
|
|
31
30
|
];
|
|
32
31
|
export const toInvoicingDunningCaseTabId = (v) => stringToUnion(v, ALL_INVOICING_DUNNING_CASE_TAB_IDS);
|
|
32
|
+
/**
|
|
33
|
+
* Ordered filter-tab id set owned by CES so the dunning-cases-list tabs live
|
|
34
|
+
* next to the model rather than being hardcoded in web-components. Tab labels
|
|
35
|
+
* and the per-tab count lookup stay in the view layer; this only carries the id
|
|
36
|
+
* set and display order.
|
|
37
|
+
*/
|
|
38
|
+
export const INVOICING_DUNNING_CASE_TABS = [
|
|
39
|
+
...ALL_INVOICING_DUNNING_CASE_TAB_IDS,
|
|
40
|
+
];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import { getInvoicingSubscriptionsByIds } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionSelector';
|
|
3
|
-
import {
|
|
4
|
-
import { INVOICING_SUBSCRIPTION_COLUMNS, ALL_INVOICING_SUBSCRIPTION_TAB_IDS, } from './invoicingSubscriptionListViewState';
|
|
3
|
+
import { INVOICING_SUBSCRIPTION_COLUMNS, INVOICING_SUBSCRIPTION_TABS, } from './invoicingSubscriptionListViewState';
|
|
5
4
|
/**
|
|
6
5
|
* Memoized so the denormalized `subscriptions` array (and the wrapping view
|
|
7
6
|
* object) keep referential identity until the subscription entity slice or the
|
|
@@ -9,7 +8,7 @@ import { INVOICING_SUBSCRIPTION_COLUMNS, ALL_INVOICING_SUBSCRIPTION_TAB_IDS, } f
|
|
|
9
8
|
* re-rendered on every unrelated redux action because a fresh array was built
|
|
10
9
|
* each call.
|
|
11
10
|
*/
|
|
12
|
-
export const getInvoicingSubscriptionListView = createSelector((state) => state.invoicingSubscriptionState, (state) => state.invoicingSubscriptionListViewState, (
|
|
11
|
+
export const getInvoicingSubscriptionListView = createSelector((state) => state.invoicingSubscriptionState, (state) => state.invoicingSubscriptionListViewState, (subscriptionState, listViewState) => {
|
|
13
12
|
const { activeTab } = listViewState;
|
|
14
13
|
const allSubscriptions = getInvoicingSubscriptionsByIds(subscriptionState, listViewState.ids);
|
|
15
14
|
// The list API ignores `status`, so it returns every status; filter to the
|
|
@@ -27,14 +26,7 @@ export const getInvoicingSubscriptionListView = createSelector((state) => state.
|
|
|
27
26
|
filters: listViewState.filters,
|
|
28
27
|
count: listViewState.counts,
|
|
29
28
|
countsFetchState: listViewState.countsFetchState,
|
|
30
|
-
|
|
31
|
-
subscriptionLifecycleActionOptions: configState.subscriptionLifecycleActionOptions,
|
|
32
|
-
subscriptionMetadataEditAllowedFromStatuses: configState.subscriptionMetadataEditAllowedFromStatuses,
|
|
33
|
-
statusOptions,
|
|
34
|
-
tabIds: invoicingTabIdsFromConfig({
|
|
35
|
-
allTabIds: ALL_INVOICING_SUBSCRIPTION_TAB_IDS,
|
|
36
|
-
statusOptions,
|
|
37
|
-
}),
|
|
29
|
+
tabIds: INVOICING_SUBSCRIPTION_TABS,
|
|
38
30
|
sort: listViewState.sort,
|
|
39
31
|
};
|
|
40
32
|
});
|
package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js
CHANGED
|
@@ -32,3 +32,12 @@ export const ALL_INVOICING_SUBSCRIPTION_TAB_IDS = [
|
|
|
32
32
|
'cancelled',
|
|
33
33
|
];
|
|
34
34
|
export const toInvoicingSubscriptionTabId = (v) => stringToUnion(v, ALL_INVOICING_SUBSCRIPTION_TAB_IDS);
|
|
35
|
+
/**
|
|
36
|
+
* Ordered filter-tab id set owned by CES so the subscription-list tabs live next
|
|
37
|
+
* to the model rather than being hardcoded in web-components. Tab labels and the
|
|
38
|
+
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
39
|
+
* display order.
|
|
40
|
+
*/
|
|
41
|
+
export const INVOICING_SUBSCRIPTION_TABS = [
|
|
42
|
+
...ALL_INVOICING_SUBSCRIPTION_TAB_IDS,
|
|
43
|
+
];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { concat, from } from 'rxjs';
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { makeInvoicingTransactionTabState } from '../invoicingTransactionListViewState';
|
|
4
3
|
import { fetchInvoicingTransactionList, fetchInvoicingTransactionListPage, } from '../invoicingTransactionListViewReducer';
|
|
5
4
|
/**
|
|
6
5
|
* Fetch unless the endpoint is already loaded or in flight — or always when the
|
|
@@ -17,7 +16,7 @@ const shouldFetch = (fetchStateAndError, cacheOverride) => cacheOverride ||
|
|
|
17
16
|
export const fetchInvoicingTransactionListPageEpic = (actions$, state$) => actions$.pipe(filter(fetchInvoicingTransactionListPage.match), mergeMap((action) => {
|
|
18
17
|
const { cacheOverride, filters, sort } = action.payload;
|
|
19
18
|
const state = state$.value.invoicingTransactionListViewState;
|
|
20
|
-
const activeTabState = state.byTab[state.activeTab]
|
|
19
|
+
const activeTabState = state.byTab[state.activeTab];
|
|
21
20
|
const pageActions = [];
|
|
22
21
|
if (shouldFetch({ fetchState: activeTabState.fetchState, error: activeTabState.error }, cacheOverride)) {
|
|
23
22
|
pageActions.push(fetchInvoicingTransactionList({ filters, sort }));
|
package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { clearAll } from '../../../rootActions';
|
|
3
|
-
import {
|
|
3
|
+
import { makeInvoicingTransactionIdsByTab, } from './invoicingTransactionListViewState';
|
|
4
4
|
/**
|
|
5
5
|
* Whether two transaction-list queries share the same base (tab-independent)
|
|
6
6
|
* query. When the base query changes (search / customer / status / sort) every
|
|
@@ -22,7 +22,7 @@ const invoicingTransactionListView = createSlice({
|
|
|
22
22
|
reducers: {
|
|
23
23
|
fetchInvoicingTransactionList: {
|
|
24
24
|
reducer(draft, action) {
|
|
25
|
-
const tab =
|
|
25
|
+
const tab = draft.byTab[draft.activeTab];
|
|
26
26
|
if (!action.payload.keepExistingListItems) {
|
|
27
27
|
tab.ids = [];
|
|
28
28
|
tab.nextCursor = null;
|
|
@@ -65,7 +65,7 @@ const invoicingTransactionListView = createSlice({
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
updateInvoicingTransactionList(draft, action) {
|
|
68
|
-
const tab =
|
|
68
|
+
const tab = draft.byTab[draft.activeTab];
|
|
69
69
|
tab.ids = action.payload.keepExistingListItems
|
|
70
70
|
? [...new Set([...tab.ids, ...action.payload.ids])]
|
|
71
71
|
: action.payload.ids;
|
|
@@ -74,7 +74,7 @@ const invoicingTransactionListView = createSlice({
|
|
|
74
74
|
tab.error = undefined;
|
|
75
75
|
},
|
|
76
76
|
updateInvoicingTransactionListFailure(draft, action) {
|
|
77
|
-
const tab =
|
|
77
|
+
const tab = draft.byTab[draft.activeTab];
|
|
78
78
|
tab.fetchState = 'Error';
|
|
79
79
|
tab.error = action.payload;
|
|
80
80
|
},
|
|
@@ -94,7 +94,7 @@ const invoicingTransactionListView = createSlice({
|
|
|
94
94
|
addInvoicingTransactionToList(draft, action) {
|
|
95
95
|
const id = action.payload;
|
|
96
96
|
const prependTo = (tabId) => {
|
|
97
|
-
const tab =
|
|
97
|
+
const tab = draft.byTab[tabId];
|
|
98
98
|
if (!tab.ids.includes(id)) {
|
|
99
99
|
tab.ids = [id, ...tab.ids];
|
|
100
100
|
}
|
package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import { getInvoicingTransactionsByIds } from '../../../entity/invoicing/invoicingTransaction/invoicingTransactionSelector';
|
|
3
|
-
import {
|
|
4
|
-
import { INVOICING_TRANSACTION_COLUMNS, ALL_INVOICING_TRANSACTION_TAB_IDS, makeInvoicingTransactionTabState, } from './invoicingTransactionListViewState';
|
|
3
|
+
import { INVOICING_TRANSACTION_COLUMNS, INVOICING_TRANSACTION_TABS, } from './invoicingTransactionListViewState';
|
|
5
4
|
/**
|
|
6
5
|
* Memoized so the denormalized `transactions` array (and the wrapping view
|
|
7
6
|
* object) keep referential identity until the transaction entity slice or the
|
|
8
7
|
* list-view slice actually change.
|
|
9
8
|
*/
|
|
10
|
-
export const getInvoicingTransactionListView = createSelector((state) => state.invoicingTransactionState, (state) => state.invoicingTransactionListViewState, (
|
|
11
|
-
const activeTabState = listViewState.byTab[listViewState.activeTab]
|
|
9
|
+
export const getInvoicingTransactionListView = createSelector((state) => state.invoicingTransactionState, (state) => state.invoicingTransactionListViewState, (transactionState, listViewState) => {
|
|
10
|
+
const activeTabState = listViewState.byTab[listViewState.activeTab];
|
|
12
11
|
return {
|
|
13
12
|
activeTab: listViewState.activeTab,
|
|
14
13
|
columns: INVOICING_TRANSACTION_COLUMNS,
|
|
@@ -17,11 +16,7 @@ export const getInvoicingTransactionListView = createSelector((state) => state.i
|
|
|
17
16
|
nextCursor: activeTabState.nextCursor,
|
|
18
17
|
fetchState: activeTabState.fetchState,
|
|
19
18
|
error: activeTabState.error,
|
|
20
|
-
|
|
21
|
-
tabIds: invoicingTabIdsFromConfig({
|
|
22
|
-
allTabIds: ALL_INVOICING_TRANSACTION_TAB_IDS,
|
|
23
|
-
statusOptions,
|
|
24
|
-
}),
|
|
19
|
+
tabIds: INVOICING_TRANSACTION_TABS,
|
|
25
20
|
sort: listViewState.sort,
|
|
26
21
|
version: 1.0,
|
|
27
22
|
};
|
package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js
CHANGED
|
@@ -26,25 +26,23 @@ export const ALL_INVOICING_TRANSACTION_TAB_IDS = [
|
|
|
26
26
|
'refund',
|
|
27
27
|
'authorization',
|
|
28
28
|
'payment_reversal',
|
|
29
|
-
'excess_transfer',
|
|
30
29
|
];
|
|
31
30
|
export const toInvoicingTransactionTabId = (v) => stringToUnion(v, ALL_INVOICING_TRANSACTION_TAB_IDS);
|
|
31
|
+
/**
|
|
32
|
+
* Ordered filter-tab id set owned by CES so the transaction-list tabs live next
|
|
33
|
+
* to the model rather than being hardcoded in web-components. Tab labels and the
|
|
34
|
+
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
35
|
+
* display order.
|
|
36
|
+
*/
|
|
37
|
+
export const INVOICING_TRANSACTION_TABS = [
|
|
38
|
+
...ALL_INVOICING_TRANSACTION_TAB_IDS,
|
|
39
|
+
];
|
|
32
40
|
export const makeInvoicingTransactionTabState = () => ({
|
|
33
41
|
ids: [],
|
|
34
42
|
nextCursor: null,
|
|
35
43
|
fetchState: 'Not-Started',
|
|
36
44
|
error: undefined,
|
|
37
45
|
});
|
|
38
|
-
/** The cache entry for a tab, created on first use. */
|
|
39
|
-
export const invoicingTransactionTabStateFor = (byTab, tabId) => {
|
|
40
|
-
const existing = byTab[tabId];
|
|
41
|
-
if (existing != null) {
|
|
42
|
-
return existing;
|
|
43
|
-
}
|
|
44
|
-
const created = makeInvoicingTransactionTabState();
|
|
45
|
-
byTab[tabId] = created;
|
|
46
|
-
return created;
|
|
47
|
-
};
|
|
48
46
|
export const makeInvoicingTransactionIdsByTab = () => ALL_INVOICING_TRANSACTION_TAB_IDS.reduce((acc, tabId) => {
|
|
49
47
|
acc[tabId] = makeInvoicingTransactionTabState();
|
|
50
48
|
return acc;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
export const INVOICING_CREDIT_NOTE_REASON_CODES = [
|
|
2
|
+
'service_credit',
|
|
3
|
+
'billing_error',
|
|
4
|
+
'duplicate_charge',
|
|
5
|
+
'pricing_correction',
|
|
6
|
+
'goodwill',
|
|
7
|
+
'other',
|
|
8
|
+
];
|
|
1
9
|
export const initialIssueCreditNoteFormLocalData = (invoiceId = '') => ({
|
|
2
10
|
invoiceId,
|
|
3
11
|
lineItems: [],
|
|
4
12
|
reasonCode: '',
|
|
5
|
-
type: '',
|
|
6
13
|
});
|
|
@@ -23,17 +23,15 @@ export const localDataToIssueCreditNotePayload = (localData) => {
|
|
|
23
23
|
};
|
|
24
24
|
});
|
|
25
25
|
const reasonCode = localData.reasonCode.trim();
|
|
26
|
-
const type = localData.type.trim();
|
|
27
26
|
return {
|
|
28
27
|
line_items: lineItems,
|
|
28
|
+
type: 'adjustment',
|
|
29
29
|
...(reasonCode !== '' ? { reason_code: reasonCode } : {}),
|
|
30
|
-
...(type !== '' ? { type } : {}),
|
|
31
30
|
};
|
|
32
31
|
};
|
|
33
32
|
export const initializeIssueCreditNoteDraftFromInvoice = (invoice) => ({
|
|
34
33
|
invoiceId: invoice.id,
|
|
35
34
|
reasonCode: '',
|
|
36
|
-
type: '',
|
|
37
35
|
lineItems: (invoice.lineItems ?? []).map((lineItem) => ({
|
|
38
36
|
description: lineItem.description,
|
|
39
37
|
id: lineItem.id,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getInvoiceDetail } from '../invoiceDetail/invoiceDetailSelector';
|
|
2
|
-
import {
|
|
3
|
-
import { initialIssueCreditNoteFormLocalData } from './issueCreditNoteFormConfig';
|
|
2
|
+
import { INVOICING_CREDIT_NOTE_REASON_CODES, initialIssueCreditNoteFormLocalData, } from './issueCreditNoteFormConfig';
|
|
4
3
|
/**
|
|
5
4
|
* The draft is a single global slice, so a draft seeded for a previously opened
|
|
6
5
|
* invoice can still be in state when another invoice's screen mounts. Anything
|
|
@@ -11,7 +10,6 @@ export const getIssueCreditNoteView = (state, invoiceId) => {
|
|
|
11
10
|
const invoiceView = getInvoiceDetail(state, invoiceId);
|
|
12
11
|
const { draft, error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
13
12
|
const isDraftForInvoice = draft.invoiceId === invoiceId;
|
|
14
|
-
const { creditNoteReasonCodeOptions, creditNoteTypeOptions } = getInvoicingConfigView(state);
|
|
15
13
|
return {
|
|
16
14
|
invoice: invoiceView.invoice,
|
|
17
15
|
isPageReady: invoiceView.fetchState === 'Completed' &&
|
|
@@ -21,9 +19,8 @@ export const getIssueCreditNoteView = (state, invoiceId) => {
|
|
|
21
19
|
localData: isDraftForInvoice
|
|
22
20
|
? draft
|
|
23
21
|
: initialIssueCreditNoteFormLocalData(invoiceId),
|
|
24
|
-
|
|
22
|
+
reasonCodeValues: [...INVOICING_CREDIT_NOTE_REASON_CODES],
|
|
25
23
|
submitState: { error, fetchState },
|
|
26
|
-
typeOptions: creditNoteTypeOptions,
|
|
27
24
|
error: invoiceView.error,
|
|
28
25
|
fetchState: invoiceView.fetchState,
|
|
29
26
|
version: 1.0,
|
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical value sets for the Record Payment form. CES owns the values;
|
|
3
|
+
* web-components maps each value to a localized label.
|
|
4
|
+
*/
|
|
5
|
+
export const INVOICING_PAYMENT_METHOD_VALUES = [
|
|
6
|
+
'card',
|
|
7
|
+
'cash',
|
|
8
|
+
'check',
|
|
9
|
+
'bank_transfer',
|
|
10
|
+
'direct_debit',
|
|
11
|
+
'paypal_express_checkout',
|
|
12
|
+
'apple_pay',
|
|
13
|
+
'google_pay',
|
|
14
|
+
'ach_credit',
|
|
15
|
+
'sepa_credit',
|
|
16
|
+
'other',
|
|
17
|
+
];
|
|
18
|
+
export const INVOICING_PAYMENT_GATEWAY_VALUES = [
|
|
19
|
+
'stripe',
|
|
20
|
+
'chargebee',
|
|
21
|
+
'braintree',
|
|
22
|
+
'paypal',
|
|
23
|
+
'adyen',
|
|
24
|
+
'razorpay',
|
|
25
|
+
'other',
|
|
26
|
+
];
|
|
1
27
|
export const initialRecordPaymentFormLocalData = {
|
|
2
28
|
comment: '',
|
|
3
29
|
customerId: '',
|