@zeniai/client-epic-state 5.2.41-beta5MM → 5.2.41-beta7MM

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 (196) hide show
  1. package/lib/entity/billPay/billTransaction/billTransactionReducer.d.ts +5 -1
  2. package/lib/entity/billPay/billTransaction/billTransactionReducer.js +17 -2
  3. package/lib/entity/invoicing/coupon/couponPayload.d.ts +8 -0
  4. package/lib/entity/invoicing/coupon/couponPayload.js +8 -0
  5. package/lib/entity/invoicing/coupon/couponState.d.ts +6 -0
  6. package/lib/entity/invoicing/dunningCase/dunningCaseTypes.d.ts +1 -1
  7. package/lib/entity/invoicing/plan/planSelector.d.ts +20 -0
  8. package/lib/entity/invoicing/plan/planSelector.js +42 -0
  9. package/lib/entity/invoicing/product/productPayload.d.ts +8 -1
  10. package/lib/entity/invoicing/product/productPayload.js +4 -1
  11. package/lib/entity/invoicing/product/productState.d.ts +16 -0
  12. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -1
  13. package/lib/entity/jeSchedules/jeSchedulesReducer.js +79 -5
  14. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  15. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  16. package/lib/entity/task/taskState.d.ts +1 -1
  17. package/lib/epic.d.ts +4 -1
  18. package/lib/epic.js +10 -4
  19. package/lib/esm/entity/billPay/billTransaction/billTransactionReducer.js +16 -1
  20. package/lib/esm/entity/invoicing/coupon/couponPayload.js +8 -0
  21. package/lib/esm/entity/invoicing/plan/planSelector.js +39 -0
  22. package/lib/esm/entity/invoicing/product/productPayload.js +4 -1
  23. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +78 -4
  24. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  25. package/lib/esm/epic.js +10 -4
  26. package/lib/esm/index.js +8 -7
  27. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +3 -2
  28. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.js +39 -0
  29. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +14 -1
  30. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +10 -13
  31. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.js +38 -17
  32. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.js +17 -1
  33. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +15 -4
  34. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +6 -0
  35. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +74 -1
  36. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +80 -53
  37. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -0
  38. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +11 -2
  39. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +49 -14
  40. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +28 -11
  41. package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +28 -1
  42. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +67 -35
  43. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +22 -11
  44. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +23 -4
  45. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.js +1 -7
  46. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +19 -5
  47. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +30 -7
  48. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +16 -1
  49. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +22 -11
  50. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +69 -6
  51. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +22 -0
  52. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/fetchInvoicingCouponDetailPageEpic.js +22 -4
  53. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +18 -4
  54. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.js +29 -6
  55. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +28 -12
  56. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +37 -2
  57. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.js +43 -17
  58. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +1 -1
  59. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.js +29 -6
  60. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.js +30 -14
  61. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +143 -8
  62. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionFormPageEpic.js +4 -1
  63. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.js +44 -18
  64. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +1 -1
  65. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/seedInvoicingSubscriptionFormDraftEpic.js +29 -8
  66. package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +12 -0
  67. package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +6 -6
  68. package/lib/esm/view/invoicing/invoicingFormDraft.js +78 -0
  69. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +57 -9
  70. package/lib/esm/view/recommendation/recommendationPayload.js +3 -1
  71. package/lib/esm/view/recommendation/recommendationReducer.js +27 -7
  72. package/lib/esm/view/recommendation/recommendationSelector.js +1 -0
  73. package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +20 -8
  74. package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewReducer.js +87 -1
  75. package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +1 -0
  76. package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewState.js +4 -0
  77. package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.js +97 -0
  78. package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.js +85 -0
  79. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewReducer.js +18 -1
  80. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +3 -0
  81. package/lib/esm/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.js +95 -0
  82. package/lib/index.d.ts +9 -8
  83. package/lib/index.js +54 -48
  84. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +3 -2
  85. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.d.ts +20 -0
  86. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.js +43 -0
  87. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -2
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -0
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +8 -11
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.js +38 -17
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.d.ts +2 -2
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.js +17 -1
  93. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +15 -4
  94. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  95. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +18 -0
  96. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +18 -7
  97. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +6 -0
  98. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +10 -3
  99. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +76 -3
  100. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +80 -53
  101. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -0
  102. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +3 -0
  103. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +3 -0
  104. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +8 -4
  105. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +1 -0
  106. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +12 -2
  107. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +49 -14
  108. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +27 -10
  109. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +16 -0
  110. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +8 -5
  111. package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +7 -2
  112. package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +28 -1
  113. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +46 -5
  114. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +69 -36
  115. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.d.ts +3 -1
  116. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +22 -11
  117. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +17 -0
  118. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +22 -3
  119. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +2 -1
  120. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts +2 -2
  121. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.js +1 -7
  122. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +17 -3
  123. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.d.ts +10 -6
  124. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +29 -6
  125. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.d.ts +5 -1
  126. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +16 -1
  127. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.d.ts +3 -1
  128. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewReducer.js +22 -11
  129. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +46 -0
  130. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +68 -5
  131. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.d.ts +21 -1
  132. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +24 -1
  133. package/lib/view/invoicing/editInvoicingCouponDetailView/fetchInvoicingCouponDetailPageEpic.d.ts +9 -5
  134. package/lib/view/invoicing/editInvoicingCouponDetailView/fetchInvoicingCouponDetailPageEpic.js +22 -4
  135. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +18 -4
  136. package/lib/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.d.ts +10 -6
  137. package/lib/view/invoicing/editInvoicingCouponDetailView/seedInvoicingCouponFormDraftEpic.js +28 -5
  138. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +5 -1
  139. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +29 -13
  140. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +16 -7
  141. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +37 -2
  142. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewState.d.ts +8 -1
  143. package/lib/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.d.ts +15 -10
  144. package/lib/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.js +42 -16
  145. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +1 -1
  146. package/lib/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.d.ts +10 -6
  147. package/lib/view/invoicing/editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraftEpic.js +28 -5
  148. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.d.ts +5 -1
  149. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewReducer.js +31 -15
  150. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +79 -12
  151. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +145 -9
  152. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +8 -1
  153. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionFormPageEpic.js +4 -1
  154. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.d.ts +15 -11
  155. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.js +42 -16
  156. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +1 -1
  157. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/seedInvoicingSubscriptionFormDraftEpic.d.ts +10 -6
  158. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/seedInvoicingSubscriptionFormDraftEpic.js +28 -7
  159. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +10 -0
  160. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +12 -0
  161. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
  162. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +2 -2
  163. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +6 -6
  164. package/lib/view/invoicing/invoicingFormDraft.d.ts +63 -0
  165. package/lib/view/invoicing/invoicingFormDraft.js +86 -0
  166. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +49 -0
  167. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +59 -10
  168. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
  169. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +1 -1
  170. package/lib/view/recommendation/recommendationPayload.d.ts +1 -0
  171. package/lib/view/recommendation/recommendationPayload.js +5 -0
  172. package/lib/view/recommendation/recommendationReducer.d.ts +7 -1
  173. package/lib/view/recommendation/recommendationReducer.js +28 -8
  174. package/lib/view/recommendation/recommendationSelector.d.ts +2 -0
  175. package/lib/view/recommendation/recommendationSelector.js +3 -1
  176. package/lib/view/recommendation/recommendationState.d.ts +2 -1
  177. package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +2 -2
  178. package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +18 -6
  179. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +19 -0
  180. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.d.ts +10 -1
  181. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.js +88 -2
  182. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +1 -0
  183. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +1 -0
  184. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.d.ts +7 -0
  185. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.js +4 -0
  186. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.d.ts +37 -0
  187. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.js +104 -0
  188. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.d.ts +24 -0
  189. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.js +92 -0
  190. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +4 -1
  191. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +19 -2
  192. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -0
  193. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +3 -0
  194. package/lib/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.d.ts +18 -0
  195. package/lib/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.js +102 -0
  196. package/package.json +2 -2
@@ -7,34 +7,60 @@ const addressSelector_1 = require("../../../entity/address/addressSelector");
7
7
  const invoicingSubscriptionSelector_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionSelector");
8
8
  const addressViewReducer_1 = require("../../addressView/addressViewReducer");
9
9
  const editInvoicingSubscriptionDetailViewReducer_1 = require("./editInvoicingSubscriptionDetailViewReducer");
10
- const editInvoicingSubscriptionDetailViewReducer_2 = require("./editInvoicingSubscriptionDetailViewReducer");
11
10
  const invoicingSubscriptionFormConfig_1 = require("./invoicingSubscriptionFormConfig");
12
11
  /**
13
- * Seed the shared Address screen with an existing subscription's saved shipping
14
- * address (looked up in the shared address store by `shippingAddressId`, same as
15
- * the customer billing-address flow).
16
- * Runs both when the subscription detail loads and on an explicit initialize
17
- * trigger. Skips when an in-progress draft already exists, so an address the
18
- * user just entered survives navigating between the form and the Address screen.
19
- * Mirrors `initializeInvoicingCustomerAddressEpic`.
12
+ * Seed the shared Address screen with the subscription's saved shipping address, and
13
+ * record that the slot is this subscription's. Runs when a detail request is issued
14
+ * (every path that loads a record issues one — the detail page when not cached,
15
+ * the create/edit form always), when the page opens, when the detail load
16
+ * lands, and on an explicit initialize trigger.
17
+ *
18
+ * The address store slot is keyed by address type alone, so it can still hold
19
+ * another subscription's draft. Only a draft this subscription owns is left alone —
20
+ * that is what lets an address the user just entered survive a trip to the
21
+ * Address screen. Anything else is replaced by this subscription's saved address,
22
+ * or cleared when it has none. Opening the page counts as a trigger because a
23
+ * record already loaded this session issues no detail request at all.
20
24
  */
21
- const initializeInvoicingSubscriptionAddressEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)((action) => editInvoicingSubscriptionDetailViewReducer_2.initializeInvoicingSubscriptionAddress.match(action) ||
22
- editInvoicingSubscriptionDetailViewReducer_1.updateInvoicingSubscriptionDetail.match(action)), (0, operators_1.mergeMap)((action) => {
25
+ const initializeInvoicingSubscriptionAddressEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)((action) => editInvoicingSubscriptionDetailViewReducer_1.initializeInvoicingSubscriptionAddress.match(action) ||
26
+ editInvoicingSubscriptionDetailViewReducer_1.updateInvoicingSubscriptionDetail.match(action) ||
27
+ editInvoicingSubscriptionDetailViewReducer_1.fetchInvoicingSubscriptionDetailPage.match(action) ||
28
+ editInvoicingSubscriptionDetailViewReducer_1.fetchInvoicingSubscriptionDetail.match(action)), (0, operators_1.mergeMap)((action) => {
23
29
  const { id } = action.payload;
30
+ if (id == null) {
31
+ return rxjs_1.EMPTY;
32
+ }
24
33
  const rootState = state$.value;
25
- const existingDraft = rootState.addressViewState.newAddressState?.[invoicingSubscriptionFormConfig_1.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE]?.addressToCreate;
26
- if (existingDraft != null || id == null) {
34
+ const pending = rootState.addressViewState.newAddressState?.[invoicingSubscriptionFormConfig_1.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE]?.addressToCreate;
35
+ const ownerId = rootState.editInvoicingSubscriptionDetailViewState
36
+ .shippingAddressOwnerId;
37
+ // A detail response speaks for the record it loaded, which may no longer
38
+ // be the one on screen: its request keeps running when the user moves on
39
+ // to a cached record, which issues no request of its own to cancel it.
40
+ // Only the page-open and explicit triggers define the current record.
41
+ if (editInvoicingSubscriptionDetailViewReducer_1.updateInvoicingSubscriptionDetail.match(action) &&
42
+ ownerId != null &&
43
+ ownerId !== id) {
44
+ return rxjs_1.EMPTY;
45
+ }
46
+ if (pending != null && ownerId === id) {
27
47
  return rxjs_1.EMPTY;
28
48
  }
29
49
  const subscription = (0, invoicingSubscriptionSelector_1.getInvoicingSubscriptionById)(rootState.invoicingSubscriptionState, id);
30
50
  const address = subscription?.shippingAddressId != null
31
51
  ? (0, addressSelector_1.getAddressByAddressId)(rootState.addressState, subscription.shippingAddressId)
32
52
  : undefined;
33
- return address != null
34
- ? (0, rxjs_1.of)((0, addressViewReducer_1.newAddressInLocalStore)({
53
+ const actions = [];
54
+ if (address != null) {
55
+ actions.push((0, addressViewReducer_1.newAddressInLocalStore)({
35
56
  addressType: invoicingSubscriptionFormConfig_1.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE,
36
57
  addressToCreate: address,
37
- }))
38
- : rxjs_1.EMPTY;
58
+ }));
59
+ }
60
+ else if (pending != null) {
61
+ actions.push((0, addressViewReducer_1.removeNewAddressDataInLocalStore)(invoicingSubscriptionFormConfig_1.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE));
62
+ }
63
+ actions.push((0, editInvoicingSubscriptionDetailViewReducer_1.claimInvoicingSubscriptionShippingAddress)({ id }));
64
+ return (0, rxjs_1.from)(actions);
39
65
  }));
40
66
  exports.initializeInvoicingSubscriptionAddressEpic = initializeInvoicingSubscriptionAddressEpic;
@@ -20,7 +20,7 @@ const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => actions$.pi
20
20
  const rootState = state$.value;
21
21
  const viewState = rootState.editInvoicingSubscriptionDetailViewState;
22
22
  const localData = (id != null
23
- ? viewState.editDraftById[id]
23
+ ? viewState.editDraftById[id]?.localData
24
24
  : viewState.newSubscriptionDraft) ?? viewState.newSubscriptionDraft;
25
25
  // Shipping address captured via the shared Address screen is sent as an
26
26
  // object in the payload (same pattern as the customer save flow).
@@ -1,12 +1,16 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
3
  import { RootState } from '../../../rootStateTypes';
4
- import { seedInvoicingSubscriptionFormDraft, updateInvoicingSubscriptionDetail } from './editInvoicingSubscriptionDetailViewReducer';
5
- export type ActionType = ReturnType<typeof updateInvoicingSubscriptionDetail> | ReturnType<typeof seedInvoicingSubscriptionFormDraft>;
4
+ import { fetchInvoicingSubscriptionFormPage, seedInvoicingSubscriptionFormDraft, updateInvoicingSubscriptionDetail } from './editInvoicingSubscriptionDetailViewReducer';
5
+ export type ActionType = ReturnType<typeof fetchInvoicingSubscriptionFormPage> | ReturnType<typeof updateInvoicingSubscriptionDetail> | ReturnType<typeof seedInvoicingSubscriptionFormDraft>;
6
6
  /**
7
- * Seeds the edit draft from the record the moment the detail fetch lands, so
8
- * the form has its values before it mounts. The reducer ignores the seed when a
9
- * draft already exists, which is what stops a background refetch from
10
- * overwriting edits in progress.
7
+ * Seeds the edit draft from the record, so the form has its values before it
8
+ * mounts. The reducer ignores a seed once the draft holds the record, which is
9
+ * what stops a background refetch from overwriting edits in progress.
10
+ *
11
+ * Opening the page counts as a trigger, not just the detail response: the page
12
+ * fetch is cache-guarded, so re-opening a form for a record already loaded this
13
+ * session issues no request at all — and a draft cleared in between (by a save
14
+ * or a cancel) would have nothing left to seed it.
11
15
  */
12
16
  export declare const seedInvoicingSubscriptionFormDraftEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -7,14 +7,35 @@ const editInvoicingSubscriptionDetailViewReducer_1 = require("./editInvoicingSub
7
7
  const invoicingSubscriptionDetailHelper_1 = require("./invoicingSubscriptionDetailHelper");
8
8
  const invoicingSubscriptionFormConfig_1 = require("./invoicingSubscriptionFormConfig");
9
9
  /**
10
- * Seeds the edit draft from the record the moment the detail fetch lands, so
11
- * the form has its values before it mounts. The reducer ignores the seed when a
12
- * draft already exists, which is what stops a background refetch from
13
- * overwriting edits in progress.
10
+ * Seeds the edit draft from the record, so the form has its values before it
11
+ * mounts. The reducer ignores a seed once the draft holds the record, which is
12
+ * what stops a background refetch from overwriting edits in progress.
13
+ *
14
+ * Opening the page counts as a trigger, not just the detail response: the page
15
+ * fetch is cache-guarded, so re-opening a form for a record already loaded this
16
+ * session issues no request at all — and a draft cleared in between (by a save
17
+ * or a cancel) would have nothing left to seed it.
14
18
  */
15
- const seedInvoicingSubscriptionFormDraftEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editInvoicingSubscriptionDetailViewReducer_1.updateInvoicingSubscriptionDetail.match), (0, operators_1.withLatestFrom)(state$), (0, operators_1.mergeMap)(([action, state]) => {
16
- const { id } = action.payload;
17
- const subscription = (0, invoicingSubscriptionDetailHelper_1.getInvoicingSubscriptionById)(state, id);
19
+ const seedInvoicingSubscriptionFormDraftEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)((action) => editInvoicingSubscriptionDetailViewReducer_1.updateInvoicingSubscriptionDetail.match(action) ||
20
+ editInvoicingSubscriptionDetailViewReducer_1.fetchInvoicingSubscriptionFormPage.match(action)), (0, operators_1.withLatestFrom)(state$), (0, operators_1.mergeMap)(([action, state]) => {
21
+ const id = editInvoicingSubscriptionDetailViewReducer_1.updateInvoicingSubscriptionDetail.match(action)
22
+ ? action.payload.id
23
+ : action.payload.subscriptionId;
24
+ if (id == null) {
25
+ return rxjs_1.EMPTY;
26
+ }
27
+ // The entity alone does not say the whole record is loaded — the list
28
+ // endpoints merge their own list-shaped rows into the same store. Only a
29
+ // completed detail load does, which is also exactly when the page's
30
+ // cache-guarded fetch issues no request and this is the sole seed.
31
+ if (editInvoicingSubscriptionDetailViewReducer_1.fetchInvoicingSubscriptionFormPage.match(action) &&
32
+ state.editInvoicingSubscriptionDetailViewState.recordStateById[id]
33
+ ?.fetchState !== 'Completed') {
34
+ return rxjs_1.EMPTY;
35
+ }
36
+ // Nothing to seed from on a cold open; the detail response triggers this
37
+ // again once it lands.
38
+ const subscription = id != null ? (0, invoicingSubscriptionDetailHelper_1.getInvoicingSubscriptionById)(state, id) : undefined;
18
39
  if (subscription == null) {
19
40
  return rxjs_1.EMPTY;
20
41
  }
@@ -27,6 +27,16 @@ export interface InvoicingCatalogListView extends SelectorView {
27
27
  */
28
28
  runningActionId?: ID;
29
29
  }
30
+ /**
31
+ * Flatten catalog items into the price rows the pickers render.
32
+ *
33
+ * The parent item's `applicableItems` / `itemApplicability` are carried onto
34
+ * every row it produces: applicability is a property of the catalog item, not
35
+ * of its price points, and a row that has lost it cannot be matched against the
36
+ * selected plan's allow-list (see `getInvoicingItemsAllowedForPlan`). Both are
37
+ * written after the spread so the item's own rule wins over any stale copy a
38
+ * price point payload may carry.
39
+ */
30
40
  export declare const getInvoicingCatalogPrices: (items: InvoicingPlan[]) => InvoicingProduct[];
31
41
  /**
32
42
  * Bundled read view for the single catalog page (plans + products tabs).
@@ -5,8 +5,20 @@ const toolkit_1 = require("@reduxjs/toolkit");
5
5
  const planSelector_1 = require("../../../entity/invoicing/plan/planSelector");
6
6
  const runningInvoicingActionId_1 = require("../runningInvoicingActionId");
7
7
  const invoicingCatalogListViewState_1 = require("./invoicingCatalogListViewState");
8
+ /**
9
+ * Flatten catalog items into the price rows the pickers render.
10
+ *
11
+ * The parent item's `applicableItems` / `itemApplicability` are carried onto
12
+ * every row it produces: applicability is a property of the catalog item, not
13
+ * of its price points, and a row that has lost it cannot be matched against the
14
+ * selected plan's allow-list (see `getInvoicingItemsAllowedForPlan`). Both are
15
+ * written after the spread so the item's own rule wins over any stale copy a
16
+ * price point payload may carry.
17
+ */
8
18
  const getInvoicingCatalogPrices = (items) => items.flatMap((item) => (item.subFamilies ?? []).map((subFamily) => ({
9
19
  ...subFamily,
20
+ applicableItems: item.applicableItems,
21
+ itemApplicability: item.itemApplicability,
10
22
  itemID: item.id,
11
23
  itemType: item.type ?? item.itemType,
12
24
  name: subFamily.name,
@@ -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" | "Paused" | "all", "invoicingDunningCaseListView/setInvoicingDunningCaseActiveTab">;
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<"cancelled" | "scheduled" | "retrying" | "manual_review" | "resolved" | "paused" | "all", "invoicingDunningCaseListView/setInvoicingDunningCaseActiveTab">;
30
30
  declare const _default: import("redux").Reducer<InvoicingDunningCaseListViewState>;
31
31
  export default _default;
@@ -19,8 +19,8 @@ export interface InvoicingDunningCaseColumnConfig {
19
19
  sortable: boolean;
20
20
  }
21
21
  export declare const INVOICING_DUNNING_CASE_COLUMNS: InvoicingDunningCaseColumnConfig[];
22
- export declare const ALL_INVOICING_DUNNING_CASE_TAB_IDS: readonly ["all", "Retrying", "Scheduled", "Manual Review", "Paused", "Resolved", "Cancelled"];
23
- export declare const toInvoicingDunningCaseTabId: (v: string) => "Retrying" | "Scheduled" | "Manual Review" | "Resolved" | "Cancelled" | "Paused" | "all";
22
+ export declare const ALL_INVOICING_DUNNING_CASE_TAB_IDS: readonly ["all", "retrying", "scheduled", "manual_review", "paused", "resolved", "cancelled"];
23
+ export declare const toInvoicingDunningCaseTabId: (v: string) => "cancelled" | "scheduled" | "retrying" | "manual_review" | "resolved" | "paused" | "all";
24
24
  export type InvoicingDunningCaseTabId = ReturnType<typeof toInvoicingDunningCaseTabId>;
25
25
  export interface InvoicingDunningCaseListViewState extends FetchedState {
26
26
  /** Selected status tab (CES-owned so it persists across page revisits). */
@@ -26,12 +26,12 @@ exports.INVOICING_DUNNING_CASE_COLUMNS = [
26
26
  ];
27
27
  exports.ALL_INVOICING_DUNNING_CASE_TAB_IDS = [
28
28
  'all',
29
- 'Retrying',
30
- 'Scheduled',
31
- 'Manual Review',
32
- 'Paused',
33
- 'Resolved',
34
- 'Cancelled',
29
+ 'retrying',
30
+ 'scheduled',
31
+ 'manual_review',
32
+ 'paused',
33
+ 'resolved',
34
+ 'cancelled',
35
35
  ];
36
36
  const toInvoicingDunningCaseTabId = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INVOICING_DUNNING_CASE_TAB_IDS);
37
37
  exports.toInvoicingDunningCaseTabId = toInvoicingDunningCaseTabId;
@@ -0,0 +1,63 @@
1
+ import { FetchState, ID } from '../../commonStateTypes/common';
2
+ /**
3
+ * A create/edit form's draft, plus where its values came from.
4
+ *
5
+ * The status is what lets an edit form tell "these are the record's values"
6
+ * from "these are whatever the form had at first render". It cannot be read off
7
+ * the presence of a draft, because the form writes drafts too: it pushes its
8
+ * whole state back on every change, so a change made before the record landed
9
+ * leaves a draft that looks seeded but holds nothing.
10
+ *
11
+ * `Not-Started` — not (or no longer) the loaded record's values: written by the
12
+ * form before the record landed, or just saved and awaiting the
13
+ * refetch that follows. A successful load replaces it.
14
+ * `Completed` — filled from the loaded record; the form may have edited it since.
15
+ * `Error` — the record's fetch failed, so the form starts blank and a
16
+ * later successful fetch is still allowed to seed it.
17
+ */
18
+ export interface InvoicingFormDraft<TLocalData> {
19
+ fetchState: FetchState;
20
+ localData: TLocalData;
21
+ }
22
+ export type InvoicingFormDraftById<TLocalData> = Record<ID, InvoicingFormDraft<TLocalData>>;
23
+ /**
24
+ * The form's own write. Keeps the status: an edit on top of a seeded draft is
25
+ * still the record's draft, and an edit made before the record arrived must not
26
+ * pass for one.
27
+ */
28
+ export declare function applyInvoicingFormDraftEdit<TLocalData>(draftById: InvoicingFormDraftById<TLocalData>, id: ID, localData: TLocalData): void;
29
+ /**
30
+ * Fill the draft from the loaded record, once. A second seed is ignored so a
31
+ * late refetch cannot overwrite edits in progress — but a draft the form wrote
32
+ * before the record landed is replaced, since it was never the record's.
33
+ */
34
+ export declare function applyInvoicingFormDraftSeed<TLocalData>(draftById: InvoicingFormDraftById<TLocalData>, id: ID, localData: TLocalData): void;
35
+ /**
36
+ * Record that the fetch failed, so the form renders instead of waiting behind a
37
+ * skeleton that will never resolve.
38
+ *
39
+ * Mirrors the seed: a draft holding the record is left alone, since a
40
+ * background refetch failing is no reason to discard it, and anything else is
41
+ * marked failed. A draft the form wrote before the record landed keeps its
42
+ * values — there is no reason to throw away what the user typed — but stops
43
+ * counting as still loading, and a later successful fetch can still seed it.
44
+ */
45
+ export declare function applyInvoicingFormDraftFailure<TLocalData>(draftById: InvoicingFormDraftById<TLocalData>, id: ID, blankLocalData: TLocalData): void;
46
+ /**
47
+ * The record behind this draft was just saved and is about to be refetched.
48
+ * Keep the values on screen — dropping them would blank the form for the round
49
+ * trip, and the form remounts on the response anyway — but stop counting them
50
+ * as the loaded record's, so that response is allowed to replace them.
51
+ */
52
+ export declare function applyInvoicingFormDraftSaved<TLocalData>(draftById: InvoicingFormDraftById<TLocalData>, id: ID): void;
53
+ /** The draft's values, or the blank form when nothing is drafted yet. */
54
+ export declare function getInvoicingFormDraftLocalData<TLocalData>(draftById: InvoicingFormDraftById<TLocalData>, id: ID | undefined, blankLocalData: TLocalData): TLocalData;
55
+ /**
56
+ * Whether the form should still be showing its skeleton — the record has
57
+ * neither reached the draft nor failed trying.
58
+ *
59
+ * Settles once and stays settled, which is what keeps a later refetch from
60
+ * swapping a form the user is typing into back for a skeleton. Create mode
61
+ * (no id) has no record to wait for.
62
+ */
63
+ export declare function isInvoicingFormDraftPending<TLocalData>(draftById: InvoicingFormDraftById<TLocalData>, id: ID | undefined): boolean;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyInvoicingFormDraftEdit = applyInvoicingFormDraftEdit;
4
+ exports.applyInvoicingFormDraftSeed = applyInvoicingFormDraftSeed;
5
+ exports.applyInvoicingFormDraftFailure = applyInvoicingFormDraftFailure;
6
+ exports.applyInvoicingFormDraftSaved = applyInvoicingFormDraftSaved;
7
+ exports.getInvoicingFormDraftLocalData = getInvoicingFormDraftLocalData;
8
+ exports.isInvoicingFormDraftPending = isInvoicingFormDraftPending;
9
+ /**
10
+ * The form's own write. Keeps the status: an edit on top of a seeded draft is
11
+ * still the record's draft, and an edit made before the record arrived must not
12
+ * pass for one.
13
+ */
14
+ function applyInvoicingFormDraftEdit(draftById, id, localData) {
15
+ draftById[id] = {
16
+ fetchState: draftById[id]?.fetchState ?? 'Not-Started',
17
+ localData,
18
+ };
19
+ }
20
+ /**
21
+ * Fill the draft from the loaded record, once. A second seed is ignored so a
22
+ * late refetch cannot overwrite edits in progress — but a draft the form wrote
23
+ * before the record landed is replaced, since it was never the record's.
24
+ */
25
+ function applyInvoicingFormDraftSeed(draftById, id, localData) {
26
+ if (draftById[id]?.fetchState === 'Completed') {
27
+ return;
28
+ }
29
+ draftById[id] = { fetchState: 'Completed', localData };
30
+ }
31
+ /**
32
+ * Record that the fetch failed, so the form renders instead of waiting behind a
33
+ * skeleton that will never resolve.
34
+ *
35
+ * Mirrors the seed: a draft holding the record is left alone, since a
36
+ * background refetch failing is no reason to discard it, and anything else is
37
+ * marked failed. A draft the form wrote before the record landed keeps its
38
+ * values — there is no reason to throw away what the user typed — but stops
39
+ * counting as still loading, and a later successful fetch can still seed it.
40
+ */
41
+ function applyInvoicingFormDraftFailure(draftById, id, blankLocalData) {
42
+ const existing = draftById[id];
43
+ if (existing == null) {
44
+ draftById[id] = { fetchState: 'Error', localData: blankLocalData };
45
+ return;
46
+ }
47
+ if (existing.fetchState === 'Completed') {
48
+ return;
49
+ }
50
+ existing.fetchState = 'Error';
51
+ }
52
+ /**
53
+ * The record behind this draft was just saved and is about to be refetched.
54
+ * Keep the values on screen — dropping them would blank the form for the round
55
+ * trip, and the form remounts on the response anyway — but stop counting them
56
+ * as the loaded record's, so that response is allowed to replace them.
57
+ */
58
+ function applyInvoicingFormDraftSaved(draftById, id) {
59
+ const existing = draftById[id];
60
+ if (existing == null) {
61
+ return;
62
+ }
63
+ existing.fetchState = 'Not-Started';
64
+ }
65
+ /** The draft's values, or the blank form when nothing is drafted yet. */
66
+ function getInvoicingFormDraftLocalData(draftById, id, blankLocalData) {
67
+ if (id == null) {
68
+ return blankLocalData;
69
+ }
70
+ return draftById[id]?.localData ?? blankLocalData;
71
+ }
72
+ /**
73
+ * Whether the form should still be showing its skeleton — the record has
74
+ * neither reached the draft nor failed trying.
75
+ *
76
+ * Settles once and stays settled, which is what keeps a later refetch from
77
+ * swapping a form the user is typing into back for a skeleton. Create mode
78
+ * (no id) has no record to wait for.
79
+ */
80
+ function isInvoicingFormDraftPending(draftById, id) {
81
+ if (id == null) {
82
+ return false;
83
+ }
84
+ const fetchState = draftById[id]?.fetchState;
85
+ return fetchState !== 'Completed' && fetchState !== 'Error';
86
+ }
@@ -3,6 +3,7 @@ import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classes
3
3
  import { FetchStateAndError } from '../../../commonStateTypes/common';
4
4
  import { AccountBase } from '../../../entity/account/accountState';
5
5
  import { ClassBase } from '../../../entity/class/classState';
6
+ import { InvoicingQboAccountMappingKindOption } from '../../../entity/invoicing/invoicingCommonPayload';
6
7
  import { RootState } from '../../../rootStateTypes';
7
8
  import { InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
8
9
  export declare const INVOICING_ACCOUNT_LIST_KEY: "accountList";
@@ -60,6 +61,17 @@ export interface InvoicingQboView {
60
61
  connection?: InvoicingQboConnection;
61
62
  syncHealth?: InvoicingQboSyncHealth;
62
63
  }
64
+ /**
65
+ * Accounts as the invoicing pickers need them, from the shared
66
+ * accounting-service list, so whatever another screen already loaded is reused.
67
+ * `qboId` is the submitted value because that is what the invoicing API stores;
68
+ * an account without one cannot be posted, so it is dropped rather than offered.
69
+ *
70
+ * Memoized on the two slices it reads: the pickers and the lists derived from
71
+ * them are handed straight to forms, and a fresh array on every store change
72
+ * re-seeds a form the user is editing.
73
+ */
74
+ export declare const getInvoicingQboAccountOptions: (state: RootState) => InvoicingAccountingOption[];
63
75
  /**
64
76
  * The accounts valid for one QBO mapping kind, whose `accountTypes` is a
65
77
  * comma-separated list of QuickBooks type names. An unrecognised list yields no
@@ -67,6 +79,43 @@ export interface InvoicingQboView {
67
79
  * required would post a mapping QuickBooks rejects.
68
80
  */
69
81
  export declare const invoicingAccountsForQboAccountTypes: (accounts: InvoicingAccountingOption[], accountTypes: string) => InvoicingAccountingOption[];
82
+ /**
83
+ * The account-mapping slot a catalog price point's income account shares with
84
+ * the settings page, and the one a discount's account shares with it.
85
+ */
86
+ export declare const INVOICING_INCOME_ACCOUNT_MAPPING_SLOT = "default_income_account";
87
+ export declare const INVOICING_DISCOUNTS_ACCOUNT_MAPPING_SLOT = "discounts_account";
88
+ /**
89
+ * The account types a slot falls back to when the config carries no kind for
90
+ * it. QuickBooks posts a product, a price and a discount line to an income
91
+ * account; offering every account instead would let a save be rejected.
92
+ */
93
+ export declare const INVOICING_DEFAULT_INCOME_ACCOUNT_TYPES = "Income";
94
+ /**
95
+ * The QuickBooks ids a mapping slot's picker may offer, from the account types
96
+ * the config gives that slot — so every picker filling the same slot offers the
97
+ * same accounts, and widening one stays a config change.
98
+ *
99
+ * Ids rather than a filtered tree: the pickers flatten the tree into options by
100
+ * walking each node's children, so dropping a parent that is not itself of the
101
+ * wanted type would drop its matching descendants with it.
102
+ *
103
+ * Matched on the slot rather than the code as written, since a config naming
104
+ * the kind `discounts_account_id` means the same slot. A slot the config does
105
+ * not carry falls back to `defaultAccountTypes` rather than to every account.
106
+ */
107
+ export declare const invoicingQboAccountIdsForMappingSlot: (accounts: InvoicingAccountingOption[], accountMappingKindOptions: InvoicingQboAccountMappingKindOption[], mappingSlot: string, defaultAccountTypes: string) => string[];
108
+ /**
109
+ * Stable empties for a tenant with no QBO connection.
110
+ *
111
+ * `?? []` builds a fresh array per call, and the invoicing forms re-seed their
112
+ * fields whenever their option lists change identity — so a form open against a
113
+ * disconnected tenant would reset itself on every unrelated store change, until
114
+ * the first edit disarms the re-seed.
115
+ */
116
+ export declare const NO_INVOICING_ACCOUNT_HIERARCHY: NestedAccountHierarchyForReport[];
117
+ export declare const NO_INVOICING_CLASS_HIERARCHY: NestedClassHierarchyForReport[];
118
+ export declare const NO_INVOICING_ACCOUNT_IDS: string[];
70
119
  /**
71
120
  * Single bundled view for the QBO integration settings screen — the
72
121
  * connection, the account and class options, sync health, and the fetch/action
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInvoicingQboView = exports.invoicingAccountsForQboAccountTypes = exports.getInvoicingCatalogAccountingLookup = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
3
+ exports.getInvoicingQboView = exports.NO_INVOICING_ACCOUNT_IDS = exports.NO_INVOICING_CLASS_HIERARCHY = exports.NO_INVOICING_ACCOUNT_HIERARCHY = exports.invoicingQboAccountIdsForMappingSlot = exports.INVOICING_DEFAULT_INCOME_ACCOUNT_TYPES = exports.INVOICING_DISCOUNTS_ACCOUNT_MAPPING_SLOT = exports.INVOICING_INCOME_ACCOUNT_MAPPING_SLOT = exports.invoicingAccountsForQboAccountTypes = exports.getInvoicingQboAccountOptions = exports.getInvoicingCatalogAccountingLookup = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
5
+ const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
4
6
  const accountListSelector_1 = require("../../accountList/accountListSelector");
5
7
  const classListSelector_1 = require("../../classList/classListSelector");
6
8
  // The shared bucket, fetched with the same arguments as the other consumers so
@@ -91,14 +93,20 @@ const getInvoicingCatalogAccountingLookup = (state) => ({
91
93
  });
92
94
  exports.getInvoicingCatalogAccountingLookup = getInvoicingCatalogAccountingLookup;
93
95
  /**
94
- * Accounts and classes as the invoicing pickers need them. Both come from the
95
- * shared accounting-service lists, so whatever another screen already loaded
96
- * is reused. `qboId` is the submitted value because that is what the invoicing
97
- * API stores; an account without one cannot be posted, so it is dropped rather
98
- * than offered.
96
+ * Accounts as the invoicing pickers need them, from the shared
97
+ * accounting-service list, so whatever another screen already loaded is reused.
98
+ * `qboId` is the submitted value because that is what the invoicing API stores;
99
+ * an account without one cannot be posted, so it is dropped rather than offered.
100
+ *
101
+ * Memoized on the two slices it reads: the pickers and the lists derived from
102
+ * them are handed straight to forms, and a fresh array on every store change
103
+ * re-seeds a form the user is editing.
99
104
  */
100
- const invoicingAccountingOptions = (state) => {
101
- const { accounts } = (0, accountListSelector_1.getAccountList)(state.accountState, state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY);
105
+ exports.getInvoicingQboAccountOptions = (0, toolkit_1.createSelector)([
106
+ (state) => state.accountState,
107
+ (state) => state.accountListState,
108
+ ], (accountState, accountListState) => {
109
+ const { accounts } = (0, accountListSelector_1.getAccountList)(accountState, accountListState, exports.INVOICING_ACCOUNT_LIST_KEY);
102
110
  return accounts.flatMap((account) => {
103
111
  if (account.qboId == null || account.isDeleted === true) {
104
112
  return [];
@@ -111,7 +119,7 @@ const invoicingAccountingOptions = (state) => {
111
119
  },
112
120
  ];
113
121
  });
114
- };
122
+ });
115
123
  /**
116
124
  * Normalises an account-type name for comparison. The config's mapping kinds
117
125
  * name QuickBooks types the way QuickBooks displays them ("Other Current
@@ -148,6 +156,47 @@ const invoicingAccountsForQboAccountTypes = (accounts, accountTypes) => {
148
156
  wanted.has(normalizeAccountTypeName(account.accountType)));
149
157
  };
150
158
  exports.invoicingAccountsForQboAccountTypes = invoicingAccountsForQboAccountTypes;
159
+ /**
160
+ * The account-mapping slot a catalog price point's income account shares with
161
+ * the settings page, and the one a discount's account shares with it.
162
+ */
163
+ exports.INVOICING_INCOME_ACCOUNT_MAPPING_SLOT = 'default_income_account';
164
+ exports.INVOICING_DISCOUNTS_ACCOUNT_MAPPING_SLOT = 'discounts_account';
165
+ /**
166
+ * The account types a slot falls back to when the config carries no kind for
167
+ * it. QuickBooks posts a product, a price and a discount line to an income
168
+ * account; offering every account instead would let a save be rejected.
169
+ */
170
+ exports.INVOICING_DEFAULT_INCOME_ACCOUNT_TYPES = 'Income';
171
+ /**
172
+ * The QuickBooks ids a mapping slot's picker may offer, from the account types
173
+ * the config gives that slot — so every picker filling the same slot offers the
174
+ * same accounts, and widening one stays a config change.
175
+ *
176
+ * Ids rather than a filtered tree: the pickers flatten the tree into options by
177
+ * walking each node's children, so dropping a parent that is not itself of the
178
+ * wanted type would drop its matching descendants with it.
179
+ *
180
+ * Matched on the slot rather than the code as written, since a config naming
181
+ * the kind `discounts_account_id` means the same slot. A slot the config does
182
+ * not carry falls back to `defaultAccountTypes` rather than to every account.
183
+ */
184
+ const invoicingQboAccountIdsForMappingSlot = (accounts, accountMappingKindOptions, mappingSlot, defaultAccountTypes) => {
185
+ const accountTypes = accountMappingKindOptions.find((kindOption) => (0, invoicingCommonPayload_1.toInvoicingQboAccountMappingSlot)(kindOption.code) === mappingSlot)?.accountTypes ?? defaultAccountTypes;
186
+ return (0, exports.invoicingAccountsForQboAccountTypes)(accounts, accountTypes).map((account) => account.id);
187
+ };
188
+ exports.invoicingQboAccountIdsForMappingSlot = invoicingQboAccountIdsForMappingSlot;
189
+ /**
190
+ * Stable empties for a tenant with no QBO connection.
191
+ *
192
+ * `?? []` builds a fresh array per call, and the invoicing forms re-seed their
193
+ * fields whenever their option lists change identity — so a form open against a
194
+ * disconnected tenant would reset itself on every unrelated store change, until
195
+ * the first edit disarms the re-seed.
196
+ */
197
+ exports.NO_INVOICING_ACCOUNT_HIERARCHY = [];
198
+ exports.NO_INVOICING_CLASS_HIERARCHY = [];
199
+ exports.NO_INVOICING_ACCOUNT_IDS = [];
151
200
  /** Classes as the invoicing pickers need them, from the shared class list. */
152
201
  const invoicingAccountingClassOptions = (state) => {
153
202
  const { classes } = (0, classListSelector_1.getClassList)(state.classState, state.classListState);
@@ -169,7 +218,7 @@ const getInvoicingQboView = (state) => {
169
218
  const qboState = state.invoicingQboViewState;
170
219
  const accountList = state.accountListState.byReportId[exports.INVOICING_ACCOUNT_LIST_KEY];
171
220
  return {
172
- accounts: invoicingAccountingOptions(state),
221
+ accounts: (0, exports.getInvoicingQboAccountOptions)(state),
173
222
  accountsFetchState: {
174
223
  fetchState: accountList.fetchState,
175
224
  error: accountList.error,
@@ -27,7 +27,7 @@ export declare const fetchInvoicingSubscriptionList: import("@reduxjs/toolkit").
27
27
  ids: ID[];
28
28
  keepExistingListItems: boolean;
29
29
  nextCursor: string | null;
30
- }, "invoicingSubscriptionListView/updateInvoicingSubscriptionList">, updateInvoicingSubscriptionListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSubscriptionListView/updateInvoicingSubscriptionListFailure">, fetchInvoicingSubscriptionCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSubscriptionListView/fetchInvoicingSubscriptionCounts">, updateInvoicingSubscriptionCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingSubscriptionListView/updateInvoicingSubscriptionCounts">, updateInvoicingSubscriptionCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSubscriptionListView/updateInvoicingSubscriptionCountsFailure">, updateInvoicingSubscriptionFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSubscriptionFilters, "invoicingSubscriptionListView/updateInvoicingSubscriptionFilters">, setInvoicingSubscriptionActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"active" | "cancelled" | "future" | "in_trial" | "non_renewing" | "paused" | "all", "invoicingSubscriptionListView/setInvoicingSubscriptionActiveTab">, addInvoicingSubscriptionToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
30
+ }, "invoicingSubscriptionListView/updateInvoicingSubscriptionList">, updateInvoicingSubscriptionListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSubscriptionListView/updateInvoicingSubscriptionListFailure">, fetchInvoicingSubscriptionCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSubscriptionListView/fetchInvoicingSubscriptionCounts">, updateInvoicingSubscriptionCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingSubscriptionListView/updateInvoicingSubscriptionCounts">, updateInvoicingSubscriptionCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSubscriptionListView/updateInvoicingSubscriptionCountsFailure">, updateInvoicingSubscriptionFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSubscriptionFilters, "invoicingSubscriptionListView/updateInvoicingSubscriptionFilters">, setInvoicingSubscriptionActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"active" | "cancelled" | "future" | "paused" | "in_trial" | "non_renewing" | "all", "invoicingSubscriptionListView/setInvoicingSubscriptionActiveTab">, addInvoicingSubscriptionToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
31
31
  id: ID;
32
32
  status?: InvoicingSubscriptionStatus;
33
33
  }, "invoicingSubscriptionListView/addInvoicingSubscriptionToList">;
@@ -23,7 +23,7 @@ export interface InvoicingSubscriptionColumnConfig {
23
23
  }
24
24
  export declare const INVOICING_SUBSCRIPTION_COLUMNS: InvoicingSubscriptionColumnConfig[];
25
25
  export declare const ALL_INVOICING_SUBSCRIPTION_TAB_IDS: readonly ["all", "active", "in_trial", "future", "non_renewing", "paused", "cancelled"];
26
- export declare const toInvoicingSubscriptionTabId: (v: string) => "active" | "cancelled" | "future" | "in_trial" | "non_renewing" | "paused" | "all";
26
+ export declare const toInvoicingSubscriptionTabId: (v: string) => "active" | "cancelled" | "future" | "paused" | "in_trial" | "non_renewing" | "all";
27
27
  export type InvoicingSubscriptionTabId = ReturnType<typeof toInvoicingSubscriptionTabId>;
28
28
  export interface InvoicingSubscriptionListViewState extends FetchedState {
29
29
  /** Selected status tab (CES-owned so it persists across page revisits). */
@@ -15,6 +15,7 @@ export type FetchRecommendationResponseWithCOT = ZeniAPIResponse<FetchRecommenda
15
15
  export type RecommendationFeedbackDimension = 'vendor' | 'category' | 'class';
16
16
  export type RecommendationFeedbackSource = 'primary' | 'alternate' | 'shadow' | 'qbo';
17
17
  export type RecommendationFeedbackOutcome = 'accepted' | 'override_ranked' | 'override_outside' | 'retracted';
18
+ export declare const isPromptedRecommendationFeedback: (outcome: RecommendationFeedbackOutcome) => boolean;
18
19
  export interface RecommendationFeedbackValue {
19
20
  name: string;
20
21
  id?: string | null;
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPromptedRecommendationFeedback = void 0;
4
+ // Only an override opens the feedback popup. Silent accepts and retractions post
5
+ // in the background, so they must not drive the popup's loader or its toast.
6
+ const isPromptedRecommendationFeedback = (outcome) => outcome === 'override_outside' || outcome === 'override_ranked';
7
+ exports.isPromptedRecommendationFeedback = isPromptedRecommendationFeedback;