@zeniai/client-epic-state 5.1.98 → 5.2.0

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.
Files changed (150) hide show
  1. package/lib/commonStateTypes/accountView/nestedAccountID.d.ts +0 -3
  2. package/lib/commonStateTypes/accountView/nestedAccountID.js +1 -4
  3. package/lib/commonStateTypes/coaBalance/coaBalance.d.ts +0 -5
  4. package/lib/commonStateTypes/timePeriod.d.ts +0 -2
  5. package/lib/commonStateTypes/timePeriod.js +1 -6
  6. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +12 -0
  7. package/lib/entity/invoicing/invoicingCommonPayload.js +18 -0
  8. package/lib/entity/invoicing/invoicingTransaction/invoicingTransactionPayload.d.ts +1 -1
  9. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +0 -1
  10. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.js +0 -1
  11. package/lib/entity/transaction/toSupportedTransaction.d.ts +1 -1
  12. package/lib/entity/transaction/toSupportedTransaction.js +0 -1
  13. package/lib/esm/commonStateTypes/accountView/nestedAccountID.js +0 -3
  14. package/lib/esm/commonStateTypes/timePeriod.js +0 -4
  15. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +16 -0
  16. package/lib/esm/entity/toastNotification/epic/pushToastNotificationEpic.js +0 -1
  17. package/lib/esm/entity/transaction/toSupportedTransaction.js +1 -1
  18. package/lib/esm/index.js +12 -11
  19. package/lib/esm/view/invoicing/auditView/auditViewSelector.js +4 -0
  20. package/lib/esm/view/invoicing/couponView/couponViewSelector.js +18 -8
  21. package/lib/esm/view/invoicing/couponView/couponViewState.js +0 -9
  22. package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -0
  23. package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +4 -1
  24. package/lib/esm/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
  25. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +7 -6
  26. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +3 -19
  27. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +10 -5
  28. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +6 -4
  29. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +0 -17
  30. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +5 -0
  31. package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
  32. package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +18 -17
  33. package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +12 -4
  34. package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +13 -9
  35. package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +5 -1
  36. package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +2 -1
  37. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +26 -0
  38. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +9 -0
  39. package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +9 -3
  40. package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +0 -9
  41. package/lib/esm/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +2 -2
  42. package/lib/esm/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
  43. package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +9 -3
  44. package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +0 -9
  45. package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +8 -3
  46. package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +1 -9
  47. package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +11 -3
  48. package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +0 -9
  49. package/lib/esm/view/invoicing/invoicingTabHelper.js +27 -0
  50. package/lib/esm/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
  51. package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +5 -5
  52. package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +12 -4
  53. package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +11 -9
  54. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +1 -8
  55. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +5 -1
  56. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +5 -2
  57. package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +0 -26
  58. package/lib/esm/view/invoicing/recordPayment/recordPaymentSelector.js +26 -6
  59. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -1
  60. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +2 -1
  61. package/lib/index.d.ts +13 -12
  62. package/lib/index.js +9 -24
  63. package/lib/view/invoicing/auditView/auditViewSelector.d.ts +4 -0
  64. package/lib/view/invoicing/auditView/auditViewSelector.js +4 -0
  65. package/lib/view/invoicing/couponView/couponViewSelector.d.ts +5 -1
  66. package/lib/view/invoicing/couponView/couponViewSelector.js +17 -7
  67. package/lib/view/invoicing/couponView/couponViewState.d.ts +0 -7
  68. package/lib/view/invoicing/couponView/couponViewState.js +1 -10
  69. package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -0
  70. package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +4 -1
  71. package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.d.ts +3 -1
  72. package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
  73. package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +6 -0
  74. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -5
  75. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +6 -5
  76. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.d.ts +3 -6
  77. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +4 -20
  78. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +9 -7
  79. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +10 -5
  80. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +4 -3
  81. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +5 -3
  82. package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.d.ts +0 -8
  83. package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +1 -18
  84. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +5 -0
  85. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +5 -0
  86. package/lib/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
  87. package/lib/view/invoicing/invoiceList/invoiceListReducer.js +17 -16
  88. package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +3 -1
  89. package/lib/view/invoicing/invoiceList/invoiceListSelector.js +11 -3
  90. package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +13 -9
  91. package/lib/view/invoicing/invoiceList/invoiceListState.js +15 -10
  92. package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts +9 -1
  93. package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +5 -1
  94. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +3 -1
  95. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +2 -1
  96. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +13 -0
  97. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
  98. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +26 -0
  99. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +19 -1
  100. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +11 -1
  101. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +13 -0
  102. package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts +8 -1
  103. package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +8 -2
  104. package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +0 -7
  105. package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +1 -10
  106. package/lib/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +2 -2
  107. package/lib/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
  108. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.d.ts +3 -1
  109. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +8 -2
  110. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +0 -7
  111. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +1 -10
  112. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
  113. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.d.ts +3 -1
  114. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +7 -2
  115. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +2 -9
  116. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +2 -10
  117. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts +7 -1
  118. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +10 -2
  119. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +0 -7
  120. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +1 -10
  121. package/lib/view/invoicing/invoicingTabHelper.d.ts +27 -0
  122. package/lib/view/invoicing/invoicingTabHelper.js +30 -0
  123. package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
  124. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts +1 -1
  125. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +4 -4
  126. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts +8 -0
  127. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +11 -3
  128. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts +10 -10
  129. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +13 -10
  130. package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.d.ts +0 -2
  131. package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +2 -9
  132. package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.d.ts +2 -2
  133. package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.js +5 -1
  134. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +3 -1
  135. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +4 -1
  136. package/lib/view/invoicing/issueCreditNote/issueCreditNoteState.d.ts +6 -0
  137. package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.d.ts +0 -6
  138. package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +1 -27
  139. package/lib/view/invoicing/recordPayment/recordPaymentSelector.d.ts +3 -2
  140. package/lib/view/invoicing/recordPayment/recordPaymentSelector.js +26 -6
  141. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -1
  142. package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -1
  143. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +2 -1
  144. package/package.json +4 -10
  145. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  146. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  147. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  148. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  149. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  150. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInvoiceListView = void 0;
4
4
  const toolkit_1 = require("@reduxjs/toolkit");
5
+ const invoicingTabHelper_1 = require("../invoicingTabHelper");
5
6
  const invoiceListState_1 = require("./invoiceListState");
6
7
  /**
7
8
  * Bundled read view for the invoices list page: the denormalized invoice rows
@@ -9,8 +10,11 @@ const invoiceListState_1 = require("./invoiceListState");
9
10
  * array (and the wrapping view object) keep referential identity until the
10
11
  * invoice entity slice or the list-view slice actually change.
11
12
  */
12
- exports.getInvoiceListView = (0, toolkit_1.createSelector)((state) => state.invoicingInvoiceState, (state) => state.invoicingInvoiceListState, (invoiceState, listViewState) => {
13
- const activeTabState = listViewState.invoiceByTab[listViewState.activeTab];
13
+ exports.getInvoiceListView = (0, toolkit_1.createSelector)((state) => state.invoicingInvoiceState, (state) => state.invoicingInvoiceListState, (state) => state.invoicingConfigViewState.invoiceStatusOptions, (invoiceState, listViewState, statusOptions) => {
14
+ // Config-driven tabs: a status this build's union does not know has no
15
+ // cache entry until it is fetched, so default rather than crash.
16
+ const activeTabState = listViewState.invoiceByTab[listViewState.activeTab] ??
17
+ (0, invoiceListState_1.makeInvoiceTabState)();
14
18
  return {
15
19
  activeTab: listViewState.activeTab,
16
20
  invoices: activeTabState.invoiceIds
@@ -22,7 +26,11 @@ exports.getInvoiceListView = (0, toolkit_1.createSelector)((state) => state.invo
22
26
  kpis: listViewState.kpis,
23
27
  kpisFetchState: listViewState.kpisFetchState,
24
28
  nextCursor: activeTabState.nextCursor,
25
- tabIds: invoiceListState_1.INVOICING_INVOICE_TABS,
29
+ statusOptions,
30
+ tabIds: (0, invoicingTabHelper_1.invoicingTabIdsFromConfig)({
31
+ allTabIds: invoiceListState_1.ALL_INVOICING_INVOICE_TAB_IDS,
32
+ statusOptions,
33
+ }),
26
34
  fetchState: activeTabState.fetchState,
27
35
  error: activeTabState.error,
28
36
  version: 1.0,
@@ -5,13 +5,6 @@ import { InvoicingListSort } from '../invoicingApiHelper';
5
5
  export declare const ALL_INVOICING_INVOICE_TAB_IDS: readonly ["all", "paid", "partially_paid", "payment_due", "not_paid", "voided"];
6
6
  export declare const toInvoicingInvoiceTabId: (v: string) => "paid" | "voided" | "partially_paid" | "payment_due" | "not_paid" | "all";
7
7
  export type InvoicingInvoiceTabId = ReturnType<typeof toInvoicingInvoiceTabId>;
8
- /**
9
- * Ordered filter-tab id set owned by CES so the invoice-list tabs live next to
10
- * the model rather than being hardcoded in web-components. Tab labels and the
11
- * per-tab count lookup stay in the view layer; this only carries the id set and
12
- * display order.
13
- */
14
- export declare const INVOICING_INVOICE_TABS: InvoicingInvoiceTabId[];
15
8
  /** Filters that drive the invoice list query (mirrors the Invoices hooks). */
16
9
  export interface InvoiceListFilters {
17
10
  customerId?: ID;
@@ -38,7 +31,13 @@ export interface InvoiceListState {
38
31
  /** Base query shared across tabs (search / customer / subscription / dates). */
39
32
  filters: InvoiceListFilters;
40
33
  /** Per-tab cached invoice ids + cursor + fetch state. */
41
- invoiceByTab: Record<InvoicingInvoiceTabId, InvoiceTabState>;
34
+ /**
35
+ * Per-tab cache. `Partial` because the tab set comes from `/1.0/config`: a
36
+ * status the backend added that this build's tab-id union does not know still
37
+ * renders a tab, and its cache entry is created on first use rather than
38
+ * pre-seeded. Readers must default a missing entry.
39
+ */
40
+ invoiceByTab: Partial<Record<InvoicingInvoiceTabId, InvoiceTabState>>;
42
41
  kpisFetchState: FetchStateAndError;
43
42
  /** Tab-independent money KPIs. */
44
43
  kpis?: InvoicingInvoiceKPIs;
@@ -46,4 +45,9 @@ export interface InvoiceListState {
46
45
  sort?: InvoicingListSort;
47
46
  }
48
47
  export declare const makeInvoiceTabState: () => InvoiceTabState;
49
- export declare const makeInvoiceByTab: () => Record<InvoicingInvoiceTabId, InvoiceTabState>;
48
+ /**
49
+ * The cache entry for a tab, created on first use. The tab set is config-driven,
50
+ * so a status this build's union does not know still needs somewhere to cache.
51
+ */
52
+ export declare const invoiceTabStateFor: (invoiceByTab: Partial<Record<InvoicingInvoiceTabId, InvoiceTabState>>, tabId: InvoicingInvoiceTabId) => InvoiceTabState;
53
+ export declare const makeInvoiceByTab: () => Partial<Record<InvoicingInvoiceTabId, InvoiceTabState>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeInvoiceByTab = exports.makeInvoiceTabState = exports.INVOICING_INVOICE_TABS = exports.toInvoicingInvoiceTabId = exports.ALL_INVOICING_INVOICE_TAB_IDS = void 0;
3
+ exports.makeInvoiceByTab = exports.invoiceTabStateFor = exports.makeInvoiceTabState = exports.toInvoicingInvoiceTabId = exports.ALL_INVOICING_INVOICE_TAB_IDS = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
5
  exports.ALL_INVOICING_INVOICE_TAB_IDS = [
6
6
  'all',
@@ -12,15 +12,6 @@ exports.ALL_INVOICING_INVOICE_TAB_IDS = [
12
12
  ];
13
13
  const toInvoicingInvoiceTabId = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INVOICING_INVOICE_TAB_IDS);
14
14
  exports.toInvoicingInvoiceTabId = toInvoicingInvoiceTabId;
15
- /**
16
- * Ordered filter-tab id set owned by CES so the invoice-list tabs live next to
17
- * the model rather than being hardcoded in web-components. Tab labels and the
18
- * per-tab count lookup stay in the view layer; this only carries the id set and
19
- * display order.
20
- */
21
- exports.INVOICING_INVOICE_TABS = [
22
- ...exports.ALL_INVOICING_INVOICE_TAB_IDS,
23
- ];
24
15
  const makeInvoiceTabState = () => ({
25
16
  invoiceIds: [],
26
17
  nextCursor: null,
@@ -28,6 +19,20 @@ const makeInvoiceTabState = () => ({
28
19
  error: undefined,
29
20
  });
30
21
  exports.makeInvoiceTabState = makeInvoiceTabState;
22
+ /**
23
+ * The cache entry for a tab, created on first use. The tab set is config-driven,
24
+ * so a status this build's union does not know still needs somewhere to cache.
25
+ */
26
+ const invoiceTabStateFor = (invoiceByTab, tabId) => {
27
+ const existing = invoiceByTab[tabId];
28
+ if (existing != null) {
29
+ return existing;
30
+ }
31
+ const created = (0, exports.makeInvoiceTabState)();
32
+ invoiceByTab[tabId] = created;
33
+ return created;
34
+ };
35
+ exports.invoiceTabStateFor = invoiceTabStateFor;
31
36
  const makeInvoiceByTab = () => exports.ALL_INVOICING_INVOICE_TAB_IDS.reduce((acc, tabId) => {
32
37
  acc[tabId] = (0, exports.makeInvoiceTabState)();
33
38
  return acc;
@@ -1,6 +1,6 @@
1
1
  import { FetchState, ID } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
- import { InvoicingCatalogItemLifecycleAction, InvoicingCatalogLifecycleActionOption, InvoicingCatalogProductLifecycleAction, InvoicingNamedOptionsByKey } from '../../../entity/invoicing/invoicingCommonPayload';
3
+ import { InvoicingCatalogItemLifecycleAction, InvoicingCatalogLifecycleActionOption, InvoicingCatalogProductLifecycleAction, InvoicingNamedOption, InvoicingNamedOptionsByKey } from '../../../entity/invoicing/invoicingCommonPayload';
4
4
  import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
5
5
  import { RootState } from '../../../reducer';
6
6
  import { InvoicingCatalogItemKind } from './invoicingCatalogItemDetailViewState';
@@ -20,6 +20,14 @@ export interface InvoicingCatalogItemDetailView extends SelectorView {
20
20
  catalogItemLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogItemLifecycleAction>[];
21
21
  catalogProductLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogProductLifecycleAction>[];
22
22
  configFetchState: FetchState;
23
+ /**
24
+ * Config option lists the detail page's inline pricing editor renders, so the
25
+ * screen reads them off this view instead of `getInvoicingConfigView`.
26
+ */
27
+ periodUnitOptions: InvoicingNamedOption[];
28
+ trialEndActionOptions: InvoicingNamedOption[];
29
+ trialUnitOptions: InvoicingNamedOption[];
30
+ typeOptions: InvoicingNamedOption[];
23
31
  catalogTierTypeOptionsByPricingModel?: InvoicingNamedOptionsByKey;
24
32
  plan?: InvoicingPlan;
25
33
  }
@@ -5,13 +5,17 @@ const planSelector_1 = require("../../../entity/invoicing/plan/planSelector");
5
5
  const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
6
6
  const getInvoicingCatalogItemDetail = (state, _kind, id) => {
7
7
  const { error, fetchState } = state.invoicingCatalogItemDetailViewState;
8
- const { catalogItemLifecycleActionOptions, catalogProductLifecycleActionOptions, catalogTierTypeOptionsByPricingModel, fetchState: configFetchState, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
8
+ const { billingPeriodUnitOptions, catalogItemLifecycleActionOptions, catalogItemTypeOptions, catalogProductLifecycleActionOptions, catalogTierTypeOptionsByPricingModel, catalogTrialEndActionOptions, catalogTrialUnitOptions, fetchState: configFetchState, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
9
9
  return {
10
10
  catalogItemLifecycleActionOptions,
11
11
  catalogProductLifecycleActionOptions,
12
12
  catalogTierTypeOptionsByPricingModel,
13
13
  configFetchState,
14
+ periodUnitOptions: billingPeriodUnitOptions,
14
15
  plan: (0, planSelector_1.getInvoicingPlanById)(state.invoicingPlanState, id),
16
+ trialEndActionOptions: catalogTrialEndActionOptions,
17
+ trialUnitOptions: catalogTrialUnitOptions,
18
+ typeOptions: catalogItemTypeOptions,
15
19
  fetchState,
16
20
  error,
17
21
  version: 1.0,
@@ -1,12 +1,14 @@
1
1
  import { FetchStateAndError } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
- import { InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPayload';
3
+ import { InvoicingCatalogItemLifecycleAction, InvoicingCatalogLifecycleActionOption, InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPayload';
4
4
  import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
5
5
  import { InvoicingProduct } from '../../../entity/invoicing/product/productState';
6
6
  import { RootState } from '../../../reducer';
7
7
  import { InvoicingListSort } from '../invoicingApiHelper';
8
8
  import { InvoicingCatalogPlanFilters, InvoicingCatalogProductFilters, InvoicingProductColumnConfig } from './invoicingCatalogListViewState';
9
9
  export interface InvoicingCatalogListView extends SelectorView {
10
+ /** Config-owned; folded in so the screen reads one selector. */
11
+ catalogItemLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogItemLifecycleAction>[];
10
12
  count: InvoicingListCounts;
11
13
  countsFetchState: FetchStateAndError;
12
14
  planFilters: InvoicingCatalogPlanFilters;
@@ -19,7 +19,8 @@ exports.getInvoicingCatalogPrices = getInvoicingCatalogPrices;
19
19
  * denormalized arrays keep referential identity. The base `fetchState`/`error`
20
20
  * track the plan list; the product list has its own `productFetchState`.
21
21
  */
22
- exports.getInvoicingCatalogListView = (0, toolkit_1.createSelector)((state) => state.invoicingPlanState, (state) => state.invoicingCatalogListViewState, (planState, listViewState) => ({
22
+ exports.getInvoicingCatalogListView = (0, toolkit_1.createSelector)((state) => state.invoicingPlanState, (state) => state.invoicingCatalogListViewState, (state) => state.invoicingConfigViewState.catalogItemLifecycleActionOptions, (planState, listViewState, catalogItemLifecycleActionOptions) => ({
23
+ catalogItemLifecycleActionOptions,
23
24
  plans: (0, planSelector_1.getInvoicingPlansByIds)(planState, listViewState.planIds),
24
25
  productColumns: invoicingCatalogListViewState_1.INVOICING_PRODUCT_COLUMNS,
25
26
  products: (0, planSelector_1.getInvoicingPlansByIds)(planState, listViewState.productIds),
@@ -23,15 +23,25 @@ export interface InvoicingConfigPayload {
23
23
  subscription_metadata_edit_allowed_from_statuses: string[];
24
24
  auto_collection_options?: InvoicingNamedOptionWire[];
25
25
  billing_period_unit_options?: InvoicingNamedOptionWire[];
26
+ card_status_options?: InvoicingNamedOptionWire[];
27
+ catalog_item_status_options?: InvoicingNamedOptionWire[];
28
+ catalog_item_type_options?: InvoicingNamedOptionWire[];
26
29
  catalog_tier_type_options_by_pricing_model?: InvoicingNamedOptionsByKeyWire;
27
30
  catalog_trial_end_action_options?: InvoicingNamedOptionWire[];
28
31
  catalog_trial_unit_options?: InvoicingNamedOptionWire[];
29
32
  created_at?: string | null;
33
+ credit_note_reason_code_options?: InvoicingNamedOptionWire[];
34
+ credit_note_status_options?: InvoicingNamedOptionWire[];
35
+ credit_note_type_options?: InvoicingNamedOptionWire[];
36
+ customer_status_options?: InvoicingNamedOptionWire[];
30
37
  customer_type_options?: InvoicingNamedOptionWire[];
31
38
  date_format_options?: InvoicingNamedOptionWire[];
32
39
  discount_apply_on_options?: InvoicingNamedOptionWire[];
33
40
  discount_duration_type_options?: InvoicingNamedOptionWire[];
41
+ discount_status_options?: InvoicingNamedOptionWire[];
34
42
  discount_type_options?: InvoicingNamedOptionWire[];
43
+ dunning_case_status_options?: InvoicingNamedOptionWire[];
44
+ invoice_status_options?: InvoicingNamedOptionWire[];
35
45
  invoicing_tos_acceptance_ip?: string | null;
36
46
  invoicing_tos_acceptance_time?: string | null;
37
47
  invoicing_tos_acceptance_user_agent?: string | null;
@@ -43,7 +53,10 @@ export interface InvoicingConfigPayload {
43
53
  qbo_account_mapping_kind_options?: InvoicingQboAccountMappingKindOptionWire[];
44
54
  qbo_customer_matching_options?: InvoicingNamedOptionWire[];
45
55
  qbo_sync_status_options?: InvoicingNamedOptionWire[];
56
+ subscription_status_options?: InvoicingNamedOptionWire[];
46
57
  taxability_options?: InvoicingNamedOptionWire[];
58
+ transaction_status_options?: InvoicingNamedOptionWire[];
59
+ transaction_type_options?: InvoicingNamedOptionWire[];
47
60
  updated_at?: string | null;
48
61
  }
49
62
  export type InvoicingConfigResponse = ZeniAPIResponse<InvoicingConfigPayload>;
@@ -2,7 +2,7 @@ import { ZeniAPIStatus } from '../../../responsePayload';
2
2
  import { InvoicingConfigPayload } from './invoicingConfigViewPayload';
3
3
  import { InvoicingConfigViewState } from './invoicingConfigViewState';
4
4
  export declare const initialState: InvoicingConfigViewState;
5
- export declare function mapInvoicingConfigPayloadToState(payload: InvoicingConfigPayload): Pick<InvoicingConfigViewState, 'auditLogEntityRouteOptions' | 'auditLogListSortFieldOptions' | 'auditLogSourceLabels' | 'autoCollectionOptions' | 'billingPeriodUnitOptions' | 'catalogTierTypeOptionsByPricingModel' | 'catalogTrialEndActionOptions' | 'catalogTrialUnitOptions' | 'customerTypeOptions' | 'dateFormatOptions' | 'discountApplyOnOptions' | 'discountDurationTypeOptions' | 'discountTypeOptions' | 'manualPaymentMethodOptions' | 'netTermDayOptions' | 'paymentGatewayOptions' | 'taxabilityOptions' | 'createdAt' | 'updatedAt' | 'dunningScheduleActionOptions' | 'subscriptionLifecycleActionOptions' | 'subscriptionCommercialEditAllowedFromStatuses' | 'subscriptionMetadataEditAllowedFromStatuses' | 'subscriptionEditFieldOptions' | 'subscriptionCancelTimingOptions' | 'subscriptionChangeOptionOptions' | 'catalogItemLifecycleActionOptions' | 'catalogProductLifecycleActionOptions' | 'discountLifecycleActionOptions' | 'qboAccountMappingKindOptions' | 'qboCustomerMatchingOptions' | 'qboSyncStatusOptions' | 'isInvoicingEnabled' | 'isInvoicingTosAccepted' | 'invoicingTosAcceptanceIp' | 'invoicingTosAcceptanceTime' | 'invoicingTosAcceptanceUserAgent' | 'invoicingTosAcceptanceUserId' | 'isInvoicingSettingsSeeded'>;
5
+ export declare function mapInvoicingConfigPayloadToState(payload: InvoicingConfigPayload): Pick<InvoicingConfigViewState, 'auditLogEntityRouteOptions' | 'auditLogListSortFieldOptions' | 'auditLogSourceLabels' | 'autoCollectionOptions' | 'billingPeriodUnitOptions' | 'catalogTierTypeOptionsByPricingModel' | 'catalogTrialEndActionOptions' | 'catalogTrialUnitOptions' | 'customerTypeOptions' | 'dateFormatOptions' | 'discountApplyOnOptions' | 'discountDurationTypeOptions' | 'discountTypeOptions' | 'manualPaymentMethodOptions' | 'netTermDayOptions' | 'paymentGatewayOptions' | 'taxabilityOptions' | 'cardStatusOptions' | 'catalogItemStatusOptions' | 'catalogItemTypeOptions' | 'creditNoteReasonCodeOptions' | 'creditNoteStatusOptions' | 'creditNoteTypeOptions' | 'customerStatusOptions' | 'discountStatusOptions' | 'dunningCaseStatusOptions' | 'invoiceStatusOptions' | 'subscriptionStatusOptions' | 'transactionStatusOptions' | 'transactionTypeOptions' | 'createdAt' | 'updatedAt' | 'dunningScheduleActionOptions' | 'subscriptionLifecycleActionOptions' | 'subscriptionCommercialEditAllowedFromStatuses' | 'subscriptionMetadataEditAllowedFromStatuses' | 'subscriptionEditFieldOptions' | 'subscriptionCancelTimingOptions' | 'subscriptionChangeOptionOptions' | 'catalogItemLifecycleActionOptions' | 'catalogProductLifecycleActionOptions' | 'discountLifecycleActionOptions' | 'qboAccountMappingKindOptions' | 'qboCustomerMatchingOptions' | 'qboSyncStatusOptions' | 'isInvoicingEnabled' | 'isInvoicingTosAccepted' | 'invoicingTosAcceptanceIp' | 'invoicingTosAcceptanceTime' | 'invoicingTosAcceptanceUserAgent' | 'invoicingTosAcceptanceUserId' | 'isInvoicingSettingsSeeded'>;
6
6
  export declare const fetchInvoicingConfig: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload?: {
7
7
  cacheOverride?: boolean;
8
8
  } | undefined], {
@@ -28,6 +28,19 @@ exports.initialState = {
28
28
  netTermDayOptions: [],
29
29
  paymentGatewayOptions: [],
30
30
  taxabilityOptions: [],
31
+ cardStatusOptions: [],
32
+ catalogItemStatusOptions: [],
33
+ catalogItemTypeOptions: [],
34
+ creditNoteReasonCodeOptions: [],
35
+ creditNoteStatusOptions: [],
36
+ creditNoteTypeOptions: [],
37
+ customerStatusOptions: [],
38
+ discountStatusOptions: [],
39
+ dunningCaseStatusOptions: [],
40
+ invoiceStatusOptions: [],
41
+ subscriptionStatusOptions: [],
42
+ transactionStatusOptions: [],
43
+ transactionTypeOptions: [],
31
44
  enableFetchState: { fetchState: 'Not-Started', error: undefined },
32
45
  subscriptionLifecycleActionOptions: [],
33
46
  subscriptionCommercialEditAllowedFromStatuses: [],
@@ -81,6 +94,19 @@ function mapInvoicingConfigPayloadToState(payload) {
81
94
  netTermDayOptions: (payload.net_term_day_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
82
95
  paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
83
96
  taxabilityOptions: (payload.taxability_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
97
+ cardStatusOptions: (payload.card_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
98
+ catalogItemStatusOptions: (payload.catalog_item_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
99
+ catalogItemTypeOptions: (payload.catalog_item_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
100
+ creditNoteReasonCodeOptions: (payload.credit_note_reason_code_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
101
+ creditNoteStatusOptions: (payload.credit_note_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
102
+ creditNoteTypeOptions: (payload.credit_note_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
103
+ customerStatusOptions: (payload.customer_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
104
+ discountStatusOptions: (payload.discount_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
105
+ dunningCaseStatusOptions: (payload.dunning_case_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
106
+ invoiceStatusOptions: (payload.invoice_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
107
+ subscriptionStatusOptions: (payload.subscription_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
108
+ transactionStatusOptions: (payload.transaction_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
109
+ transactionTypeOptions: (payload.transaction_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
84
110
  createdAt: payload.created_at ?? undefined,
85
111
  updatedAt: payload.updated_at ?? undefined,
86
112
  dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
@@ -1,4 +1,4 @@
1
- import { FetchStateAndError } from '../../../commonStateTypes/common';
1
+ import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
2
2
  import { RootState } from '../../../reducer';
3
3
  import { InvoicingOnboardingStatus } from './invoicingConfigViewPayload';
4
4
  import { InvoicingConfigViewState } from './invoicingConfigViewState';
@@ -16,3 +16,21 @@ export interface InvoicingConfigView extends Omit<InvoicingConfigViewState, 'acc
16
16
  status?: InvoicingOnboardingStatus;
17
17
  }
18
18
  export declare const getInvoicingConfigView: (state: RootState) => InvoicingConfigView;
19
+ /**
20
+ * The onboarding/route gate's slice of the config: whether invoicing is routed to
21
+ * the promo, the settings step or the live module, plus the two action fetch
22
+ * states those surfaces render against.
23
+ *
24
+ * Exists so the drawers, the invoicing route gate and the promo screen have a
25
+ * concern-scoped view to read instead of reaching into
26
+ * {@link getInvoicingConfigView} — they are nav and routing, not pages, so there
27
+ * is no page-level view for them to use. The whole config shape stays out of
28
+ * their props either way.
29
+ */
30
+ export interface InvoicingOnboardingGateView {
31
+ acceptTermsState: FetchStateAndError;
32
+ enableState: FetchStateAndError;
33
+ fetchState: FetchState;
34
+ status?: InvoicingOnboardingStatus;
35
+ }
36
+ export declare const getInvoicingOnboardingGateView: (state: RootState) => InvoicingOnboardingGateView;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInvoicingConfigView = void 0;
3
+ exports.getInvoicingOnboardingGateView = exports.getInvoicingConfigView = void 0;
4
4
  const invoicingConfigViewPayload_1 = require("./invoicingConfigViewPayload");
5
5
  const getInvoicingConfigView = (state) => {
6
6
  const { acceptTermsFetchState, enableFetchState, ...configState } = state.invoicingConfigViewState;
@@ -12,3 +12,13 @@ const getInvoicingConfigView = (state) => {
12
12
  };
13
13
  };
14
14
  exports.getInvoicingConfigView = getInvoicingConfigView;
15
+ const getInvoicingOnboardingGateView = (state) => {
16
+ const { acceptTermsFetchState, enableFetchState, fetchState } = state.invoicingConfigViewState;
17
+ return {
18
+ acceptTermsState: acceptTermsFetchState,
19
+ enableState: enableFetchState,
20
+ fetchState,
21
+ status: (0, invoicingConfigViewPayload_1.deriveInvoicingOnboardingStatus)(state.invoicingConfigViewState.isInvoicingTosAccepted, state.invoicingConfigViewState.isInvoicingEnabled),
22
+ };
23
+ };
24
+ exports.getInvoicingOnboardingGateView = getInvoicingOnboardingGateView;
@@ -8,18 +8,28 @@ export interface InvoicingConfigViewState extends FetchedState {
8
8
  auditLogSourceLabels: AuditLogSourceLabelOption[];
9
9
  autoCollectionOptions: InvoicingNamedOption[];
10
10
  billingPeriodUnitOptions: InvoicingNamedOption[];
11
+ cardStatusOptions: InvoicingNamedOption[];
11
12
  catalogItemLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogItemLifecycleAction>[];
13
+ catalogItemStatusOptions: InvoicingNamedOption[];
14
+ catalogItemTypeOptions: InvoicingNamedOption[];
12
15
  catalogProductLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogProductLifecycleAction>[];
13
16
  catalogTrialEndActionOptions: InvoicingNamedOption[];
14
17
  catalogTrialUnitOptions: InvoicingNamedOption[];
18
+ creditNoteReasonCodeOptions: InvoicingNamedOption[];
19
+ creditNoteStatusOptions: InvoicingNamedOption[];
20
+ creditNoteTypeOptions: InvoicingNamedOption[];
21
+ customerStatusOptions: InvoicingNamedOption[];
15
22
  customerTypeOptions: InvoicingNamedOption[];
16
23
  dateFormatOptions: InvoicingNamedOption[];
17
24
  discountApplyOnOptions: InvoicingNamedOption[];
18
25
  discountDurationTypeOptions: InvoicingNamedOption[];
19
26
  discountLifecycleActionOptions: InvoicingDiscountLifecycleActionOption[];
27
+ discountStatusOptions: InvoicingNamedOption[];
20
28
  discountTypeOptions: InvoicingNamedOption[];
29
+ dunningCaseStatusOptions: InvoicingNamedOption[];
21
30
  dunningScheduleActionOptions: InvoicingDunningActionOption[];
22
31
  enableFetchState: FetchStateAndError;
32
+ invoiceStatusOptions: InvoicingNamedOption[];
23
33
  manualPaymentMethodOptions: InvoicingNamedOption[];
24
34
  netTermDayOptions: InvoicingNamedOption[];
25
35
  paymentGatewayOptions: InvoicingNamedOption[];
@@ -32,7 +42,10 @@ export interface InvoicingConfigViewState extends FetchedState {
32
42
  subscriptionEditFieldOptions: InvoicingSubscriptionEditFieldOption[];
33
43
  subscriptionLifecycleActionOptions: InvoicingSubscriptionLifecycleActionOption[];
34
44
  subscriptionMetadataEditAllowedFromStatuses: string[];
45
+ subscriptionStatusOptions: InvoicingNamedOption[];
35
46
  taxabilityOptions: InvoicingNamedOption[];
47
+ transactionStatusOptions: InvoicingNamedOption[];
48
+ transactionTypeOptions: InvoicingNamedOption[];
36
49
  /**
37
50
  * Allowed tier `Type` options per pricing model. `undefined` means the config
38
51
  * has not been loaded yet — consumers disable the tier editor rather than
@@ -1,7 +1,7 @@
1
1
  import { FetchStateAndError } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { InvoicingCreditNote } from '../../../entity/invoicing/creditNote/creditNoteState';
4
- import { InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPayload';
4
+ import { InvoicingListCounts, InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
5
5
  import { RootState } from '../../../reducer';
6
6
  import { InvoicingListSort } from '../invoicingApiHelper';
7
7
  import { InvoicingCreditNoteColumnConfig, InvoicingCreditNoteFilters, InvoicingCreditNoteTabId } from './invoicingCreditNoteListViewState';
@@ -12,7 +12,14 @@ export interface InvoicingCreditNoteListView extends SelectorView {
12
12
  countsFetchState: FetchStateAndError;
13
13
  creditNotes: InvoicingCreditNote[];
14
14
  filters: InvoicingCreditNoteFilters;
15
+ /**
16
+ * Config lists this page labels from. Tabs and the status badge use
17
+ * `statusOptions`; the list also has a `type` column, so `typeOptions` is
18
+ * exposed too rather than leaving type badges with no names to resolve.
19
+ */
20
+ statusOptions: InvoicingNamedOption[];
15
21
  tabIds: InvoicingCreditNoteTabId[];
22
+ typeOptions: InvoicingNamedOption[];
16
23
  sort?: InvoicingListSort;
17
24
  }
18
25
  /**
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInvoicingCreditNoteListView = void 0;
4
4
  const toolkit_1 = require("@reduxjs/toolkit");
5
5
  const creditNoteSelector_1 = require("../../../entity/invoicing/creditNote/creditNoteSelector");
6
+ const invoicingTabHelper_1 = require("../invoicingTabHelper");
6
7
  const invoicingCreditNoteListViewState_1 = require("./invoicingCreditNoteListViewState");
7
8
  /**
8
9
  * Memoized so the denormalized `creditNotes` array (and the wrapping view
9
10
  * object) keep referential identity until the credit-note entity slice or the
10
11
  * list-view slice actually change.
11
12
  */
12
- exports.getInvoicingCreditNoteListView = (0, toolkit_1.createSelector)((state) => state.invoicingCreditNoteState, (state) => state.invoicingCreditNoteListViewState, (creditNoteState, listViewState) => {
13
+ exports.getInvoicingCreditNoteListView = (0, toolkit_1.createSelector)((state) => state.invoicingCreditNoteState, (state) => state.invoicingCreditNoteListViewState, (state) => state.invoicingConfigViewState.creditNoteStatusOptions, (state) => state.invoicingConfigViewState.creditNoteTypeOptions, (creditNoteState, listViewState, statusOptions, typeOptions) => {
13
14
  const { activeTab } = listViewState;
14
15
  const allCreditNotes = (0, creditNoteSelector_1.getInvoicingCreditNotesByIds)(creditNoteState, listViewState.ids);
15
16
  // The list API ignores `status`, so it returns every status; filter to the
@@ -25,7 +26,12 @@ exports.getInvoicingCreditNoteListView = (0, toolkit_1.createSelector)((state) =
25
26
  countsFetchState: listViewState.countsFetchState,
26
27
  filters: listViewState.filters,
27
28
  nextCursor: listViewState.nextCursor,
28
- tabIds: invoicingCreditNoteListViewState_1.INVOICING_CREDIT_NOTE_TABS,
29
+ statusOptions,
30
+ typeOptions,
31
+ tabIds: (0, invoicingTabHelper_1.invoicingTabIdsFromConfig)({
32
+ allTabIds: invoicingCreditNoteListViewState_1.ALL_INVOICING_CREDIT_NOTE_TAB_IDS,
33
+ statusOptions,
34
+ }),
29
35
  fetchState: listViewState.fetchState,
30
36
  error: listViewState.error,
31
37
  sort: listViewState.sort,
@@ -23,13 +23,6 @@ export declare const INVOICING_CREDIT_NOTE_COLUMNS: InvoicingCreditNoteColumnCon
23
23
  export declare const ALL_INVOICING_CREDIT_NOTE_TAB_IDS: readonly ["all", "refund_due", "adjusted", "refunded", "voided"];
24
24
  export declare const toInvoicingCreditNoteTabId: (v: string) => "adjusted" | "refunded" | "refund_due" | "voided" | "all";
25
25
  export type InvoicingCreditNoteTabId = ReturnType<typeof toInvoicingCreditNoteTabId>;
26
- /**
27
- * Ordered filter-tab id set owned by CES so the credit-notes-list tabs live next
28
- * to 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 declare const INVOICING_CREDIT_NOTE_TABS: InvoicingCreditNoteTabId[];
33
26
  export interface InvoicingCreditNoteListViewState extends FetchedState {
34
27
  /** Selected status tab (CES-owned so it persists across page revisits). */
35
28
  activeTab: InvoicingCreditNoteTabId;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INVOICING_CREDIT_NOTE_TABS = exports.toInvoicingCreditNoteTabId = exports.ALL_INVOICING_CREDIT_NOTE_TAB_IDS = exports.INVOICING_CREDIT_NOTE_COLUMNS = exports.toInvoicingCreditNoteSortKey = exports.ALL_INVOICING_CREDIT_NOTE_SORT_KEYS = void 0;
3
+ exports.toInvoicingCreditNoteTabId = exports.ALL_INVOICING_CREDIT_NOTE_TAB_IDS = exports.INVOICING_CREDIT_NOTE_COLUMNS = exports.toInvoicingCreditNoteSortKey = exports.ALL_INVOICING_CREDIT_NOTE_SORT_KEYS = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
5
  exports.ALL_INVOICING_CREDIT_NOTE_SORT_KEYS = [
6
6
  'credit_note',
@@ -33,12 +33,3 @@ exports.ALL_INVOICING_CREDIT_NOTE_TAB_IDS = [
33
33
  ];
34
34
  const toInvoicingCreditNoteTabId = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INVOICING_CREDIT_NOTE_TAB_IDS);
35
35
  exports.toInvoicingCreditNoteTabId = toInvoicingCreditNoteTabId;
36
- /**
37
- * Ordered filter-tab id set owned by CES so the credit-notes-list tabs live next
38
- * to the model rather than being hardcoded in web-components. Tab labels and the
39
- * per-tab count lookup stay in the view layer; this only carries the id set and
40
- * display order.
41
- */
42
- exports.INVOICING_CREDIT_NOTE_TABS = [
43
- ...exports.ALL_INVOICING_CREDIT_NOTE_TAB_IDS,
44
- ];
@@ -37,8 +37,8 @@ const fetchInvoicingCustomerDetailPageEpic = (actions$, state$) => actions$.pipe
37
37
  const invoiceListIsForCustomer = invoiceListState.filters.customerId === id;
38
38
  if (!invoiceListIsForCustomer ||
39
39
  shouldFetch({
40
- fetchState: invoiceListTabState.fetchState,
41
- error: invoiceListTabState.error,
40
+ fetchState: invoiceListTabState?.fetchState ?? 'Not-Started',
41
+ error: invoiceListTabState?.error,
42
42
  }, cacheOverride)) {
43
43
  pageActions.push((0, invoiceListReducer_1.fetchInvoiceList)({ filters: { customerId: id } }));
44
44
  }
@@ -16,7 +16,7 @@ const getInvoicingCustomerDetail = (state, invoicingCustomerID) => {
16
16
  const settings = (0, settingsViewSelector_1.getInvoicingSettings)(state);
17
17
  return {
18
18
  invoicingCustomer: (0, invoicingCustomerSelector_1.getInvoicingCustomerById)(invoicingCustomerState, invoicingCustomerID),
19
- invoices: (0, invoiceSelector_1.getInvoicesByIds)(state.invoicingInvoiceState, state.invoicingInvoiceListState.invoiceByTab[state.invoicingInvoiceListState.activeTab].invoiceIds),
19
+ invoices: (0, invoiceSelector_1.getInvoicesByIds)(state.invoicingInvoiceState, state.invoicingInvoiceListState.invoiceByTab[state.invoicingInvoiceListState.activeTab]?.invoiceIds ?? []),
20
20
  setupIntent: (0, customerPaymentMethodSelector_1.getInvoicingSetupIntent)(state),
21
21
  setupIntentFetchState: (0, customerPaymentMethodSelector_1.getInvoicingSetupIntentFetchState)(state),
22
22
  plaidLinkToken: (0, customerPaymentMethodSelector_1.getInvoicingPlaidLinkToken)(state),
@@ -1,6 +1,6 @@
1
1
  import { FetchStateAndError } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
- import { InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPayload';
3
+ import { InvoicingListCounts, InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
4
4
  import { InvoicingCustomer } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerState';
5
5
  import { RootState } from '../../../reducer';
6
6
  import { InvoicingListSort } from '../invoicingApiHelper';
@@ -13,6 +13,8 @@ export interface InvoicingCustomerListView extends SelectorView {
13
13
  customers: InvoicingCustomer[];
14
14
  filters: InvoicingCustomerFilters;
15
15
  nextCursor: string | null;
16
+ /** Config status/type list; the page labels tabs and badges from it. */
17
+ statusOptions: InvoicingNamedOption[];
16
18
  tabIds: InvoicingCustomerTabId[];
17
19
  sort?: InvoicingListSort;
18
20
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInvoicingCustomerListView = void 0;
4
4
  const toolkit_1 = require("@reduxjs/toolkit");
5
5
  const invoicingCustomerSelector_1 = require("../../../entity/invoicing/invoicingCustomer/invoicingCustomerSelector");
6
+ const invoicingTabHelper_1 = require("../invoicingTabHelper");
6
7
  const invoicingCustomerListViewState_1 = require("./invoicingCustomerListViewState");
7
8
  /**
8
9
  * Memoized so the denormalized `customers` array (and the wrapping view object)
@@ -10,7 +11,7 @@ const invoicingCustomerListViewState_1 = require("./invoicingCustomerListViewSta
10
11
  * slice actually change. Without this, the connected list page re-rendered on
11
12
  * every unrelated redux action because a fresh array was built each call.
12
13
  */
13
- exports.getInvoicingCustomerListView = (0, toolkit_1.createSelector)((state) => state.invoicingCustomerState, (state) => state.invoicingCustomerListViewState, (customerState, listViewState) => {
14
+ exports.getInvoicingCustomerListView = (0, toolkit_1.createSelector)((state) => state.invoicingCustomerState, (state) => state.invoicingCustomerListViewState, (state) => state.invoicingConfigViewState.customerStatusOptions, (customerState, listViewState, statusOptions) => {
14
15
  const { activeTab } = listViewState;
15
16
  const allCustomers = (0, invoicingCustomerSelector_1.getInvoicingCustomersByIds)(customerState, listViewState.ids);
16
17
  // The list API ignores `status`, so it returns every status; filter to the
@@ -31,7 +32,12 @@ exports.getInvoicingCustomerListView = (0, toolkit_1.createSelector)((state) =>
31
32
  filters: listViewState.filters,
32
33
  count: listViewState.counts,
33
34
  countsFetchState: listViewState.countsFetchState,
34
- tabIds: invoicingCustomerListViewState_1.INVOICING_CUSTOMER_TABS,
35
+ statusOptions,
36
+ tabIds: (0, invoicingTabHelper_1.invoicingTabIdsFromConfig)({
37
+ allTabIds: invoicingCustomerListViewState_1.ALL_INVOICING_CUSTOMER_TAB_IDS,
38
+ localTabIds: ['trial', 'at_risk'],
39
+ statusOptions,
40
+ }),
35
41
  sort: listViewState.sort,
36
42
  };
37
43
  });
@@ -22,13 +22,6 @@ export declare const INVOICING_CUSTOMER_COLUMNS: InvoicingCustomerColumnConfig[]
22
22
  export declare const ALL_INVOICING_CUSTOMER_TAB_IDS: readonly ["all", "active", "trial", "at_risk"];
23
23
  export declare const toInvoicingCustomerTabId: (v: string) => "active" | "at_risk" | "trial" | "all";
24
24
  export type InvoicingCustomerTabId = ReturnType<typeof toInvoicingCustomerTabId>;
25
- /**
26
- * Ordered filter-tab id set owned by CES so the customer-list tabs live next to
27
- * the model rather than being hardcoded in web-components. Tab labels and the
28
- * per-tab count lookup stay in the view layer; this only carries the id set and
29
- * display order.
30
- */
31
- export declare const INVOICING_CUSTOMER_TABS: InvoicingCustomerTabId[];
32
25
  export interface InvoicingCustomerListViewState extends FetchedState {
33
26
  /** Selected status tab (CES-owned so it persists across page revisits). */
34
27
  activeTab: InvoicingCustomerTabId;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INVOICING_CUSTOMER_TABS = exports.toInvoicingCustomerTabId = exports.ALL_INVOICING_CUSTOMER_TAB_IDS = exports.INVOICING_CUSTOMER_COLUMNS = exports.toInvoicingCustomerSortKey = exports.ALL_INVOICING_CUSTOMER_SORT_KEYS = void 0;
3
+ exports.toInvoicingCustomerTabId = exports.ALL_INVOICING_CUSTOMER_TAB_IDS = exports.INVOICING_CUSTOMER_COLUMNS = exports.toInvoicingCustomerSortKey = exports.ALL_INVOICING_CUSTOMER_SORT_KEYS = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
5
  exports.ALL_INVOICING_CUSTOMER_SORT_KEYS = [
6
6
  'name',
@@ -28,12 +28,3 @@ exports.ALL_INVOICING_CUSTOMER_TAB_IDS = [
28
28
  ];
29
29
  const toInvoicingCustomerTabId = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INVOICING_CUSTOMER_TAB_IDS);
30
30
  exports.toInvoicingCustomerTabId = toInvoicingCustomerTabId;
31
- /**
32
- * Ordered filter-tab id set owned by CES so the customer-list tabs live next to
33
- * 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
- exports.INVOICING_CUSTOMER_TABS = [
38
- ...exports.ALL_INVOICING_CUSTOMER_TAB_IDS,
39
- ];
@@ -26,6 +26,6 @@ export declare const fetchInvoicingDunningCaseList: import("@reduxjs/toolkit").A
26
26
  ids: ID[];
27
27
  keepExistingListItems: boolean;
28
28
  nextCursor: string | null;
29
- }, "invoicingDunningCaseListView/updateInvoicingDunningCaseList">, updateInvoicingDunningCaseListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingDunningCaseListView/updateInvoicingDunningCaseListFailure">, fetchInvoicingDunningCaseCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDunningCaseListView/fetchInvoicingDunningCaseCounts">, updateInvoicingDunningCaseCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingDunningCaseListView/updateInvoicingDunningCaseCounts">, updateInvoicingDunningCaseCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingDunningCaseListView/updateInvoicingDunningCaseCountsFailure">, updateInvoicingDunningCaseFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingDunningCaseFilters, "invoicingDunningCaseListView/updateInvoicingDunningCaseFilters">, setInvoicingDunningCaseActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"Retrying" | "Scheduled" | "Manual Review" | "Resolved" | "Cancelled" | "all", "invoicingDunningCaseListView/setInvoicingDunningCaseActiveTab">, clearInvoicingDunningCaseListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDunningCaseListView/clearInvoicingDunningCaseListView">;
29
+ }, "invoicingDunningCaseListView/updateInvoicingDunningCaseList">, updateInvoicingDunningCaseListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingDunningCaseListView/updateInvoicingDunningCaseListFailure">, fetchInvoicingDunningCaseCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDunningCaseListView/fetchInvoicingDunningCaseCounts">, updateInvoicingDunningCaseCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingDunningCaseListView/updateInvoicingDunningCaseCounts">, updateInvoicingDunningCaseCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingDunningCaseListView/updateInvoicingDunningCaseCountsFailure">, updateInvoicingDunningCaseFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingDunningCaseFilters, "invoicingDunningCaseListView/updateInvoicingDunningCaseFilters">, setInvoicingDunningCaseActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"Retrying" | "Scheduled" | "Manual Review" | "Resolved" | "Cancelled" | "Paused" | "all", "invoicingDunningCaseListView/setInvoicingDunningCaseActiveTab">, clearInvoicingDunningCaseListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDunningCaseListView/clearInvoicingDunningCaseListView">;
30
30
  declare const _default: import("redux").Reducer<InvoicingDunningCaseListViewState>;
31
31
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import { FetchStateAndError } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { InvoicingDunningCase } from '../../../entity/invoicing/dunningCase/dunningCaseState';
4
- import { InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPayload';
4
+ import { InvoicingListCounts, InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
5
5
  import { RootState } from '../../../reducer';
6
6
  import { InvoicingListSort } from '../invoicingApiHelper';
7
7
  import { InvoicingDunningCaseColumnConfig, InvoicingDunningCaseFilters, InvoicingDunningCaseTabId } from './invoicingDunningCaseListViewState';
@@ -12,6 +12,8 @@ export interface InvoicingDunningCaseListView extends SelectorView {
12
12
  countsFetchState: FetchStateAndError;
13
13
  dunningCases: InvoicingDunningCase[];
14
14
  filters: InvoicingDunningCaseFilters;
15
+ /** Config status/type list; the page labels tabs and badges from it. */
16
+ statusOptions: InvoicingNamedOption[];
15
17
  tabIds: InvoicingDunningCaseTabId[];
16
18
  sort?: InvoicingListSort;
17
19
  }