@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
@@ -58,6 +58,12 @@ export declare const fetchEntityRecommendationsByTransactionId: import("@reduxjs
58
58
  }, "recommendation/updateRecommendationForEntityFailure">, indicateReadyToInitializeRecommendation: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entityIdOrName: string, entityType: EntityType], {
59
59
  entityIdOrName: string;
60
60
  entityType: EntityType;
61
- }, "recommendation/indicateReadyToInitializeRecommendation", never, never>, submitRecommendationFeedback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[args: SubmitRecommendationFeedbackPayload], SubmitRecommendationFeedbackPayload, "recommendation/submitRecommendationFeedback", never, never>;
61
+ }, "recommendation/indicateReadyToInitializeRecommendation", never, never>, submitRecommendationFeedback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[args: SubmitRecommendationFeedbackPayload], SubmitRecommendationFeedbackPayload, "recommendation/submitRecommendationFeedback", never, never>, submitRecommendationFeedbackCompleted: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[args: {
62
+ succeeded: boolean;
63
+ error?: ZeniAPIStatus;
64
+ }], {
65
+ succeeded: boolean;
66
+ error?: ZeniAPIStatus;
67
+ }, "recommendation/submitRecommendationFeedbackCompleted", never, never>;
62
68
  declare const _default: import("redux").Reducer<EntityRecommendationState>;
63
69
  export default _default;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.submitRecommendationFeedback = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsForLineUpdate = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
4
+ exports.submitRecommendationFeedbackCompleted = exports.submitRecommendationFeedback = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsForLineUpdate = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const rootActions_1 = require("../../rootActions");
7
+ const recommendationPayload_1 = require("./recommendationPayload");
7
8
  const recommendationState_1 = require("./recommendationState");
8
9
  exports.initialState = {
10
+ feedbackSubmitState: { fetchState: 'Not-Started', error: undefined },
9
11
  recommendationByEntity: {},
10
12
  };
11
13
  const recommendation = (0, toolkit_1.createSlice)({
@@ -135,13 +137,31 @@ const recommendation = (0, toolkit_1.createSlice)({
135
137
  };
136
138
  },
137
139
  },
138
- // Fire-and-forget human feedback on a recommendation (accept, ranked
139
- // override or outside override). Handled by submitRecommendationFeedbackEpic
140
- // which POSTs to the accounting recommendation-feedback endpoint. No state
141
- // mutation: the categorization UX must not depend on the feedback round-trip.
140
+ // Human feedback on a recommendation (accept, ranked override or outside
141
+ // override). Handled by submitRecommendationFeedbackEpic, which POSTs to the
142
+ // accounting recommendation-feedback endpoint. The categorization itself
143
+ // never waits on this: only the feedback popup reads the submit state.
142
144
  submitRecommendationFeedback: {
143
- reducer() {
144
- // Fire-and-forget: no state mutation; the epic performs the POST.
145
+ reducer(draft, action) {
146
+ if (!(0, recommendationPayload_1.isPromptedRecommendationFeedback)(action.payload.outcome)) {
147
+ return;
148
+ }
149
+ draft.feedbackSubmitState = {
150
+ fetchState: 'In-Progress',
151
+ error: undefined,
152
+ };
153
+ },
154
+ prepare(args) {
155
+ return { payload: args };
156
+ },
157
+ },
158
+ submitRecommendationFeedbackCompleted: {
159
+ reducer(draft, action) {
160
+ const { succeeded, error } = action.payload;
161
+ draft.feedbackSubmitState = {
162
+ fetchState: succeeded ? 'Completed' : 'Error',
163
+ error,
164
+ };
145
165
  },
146
166
  prepare(args) {
147
167
  return { payload: args };
@@ -154,7 +174,7 @@ const recommendation = (0, toolkit_1.createSlice)({
154
174
  });
155
175
  },
156
176
  });
157
- _a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation, exports.submitRecommendationFeedback = _a.submitRecommendationFeedback;
177
+ _a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation, exports.submitRecommendationFeedback = _a.submitRecommendationFeedback, exports.submitRecommendationFeedbackCompleted = _a.submitRecommendationFeedbackCompleted;
158
178
  exports.default = recommendation.reducer;
159
179
  const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
160
180
  const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
@@ -1,3 +1,4 @@
1
+ import { FetchStateAndError } from '../../commonStateTypes/common';
1
2
  import { Recommendation } from '../../commonStateTypes/recommendationBase';
2
3
  import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
3
4
  import { EntityType } from '../../entity/genericEntity/entity';
@@ -8,3 +9,4 @@ export interface RecommendationByEntitySelectorView extends SelectorView {
8
9
  recommendations?: Recommendation[];
9
10
  }
10
11
  export declare const getRecommendationsForEntity: (state: RootState, entityId: string, entityType: EntityType) => RecommendationByEntitySelectorView;
12
+ export declare const getRecommendationFeedbackSubmitState: (state: RootState) => FetchStateAndError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRecommendationsForEntity = void 0;
3
+ exports.getRecommendationFeedbackSubmitState = exports.getRecommendationsForEntity = void 0;
4
4
  const recommendationState_1 = require("./recommendationState");
5
5
  const getRecommendationsForEntity = (state, entityId, entityType) => {
6
6
  const { entityRecommendationState } = state;
@@ -15,3 +15,5 @@ const getRecommendationsForEntity = (state, entityId, entityType) => {
15
15
  };
16
16
  };
17
17
  exports.getRecommendationsForEntity = getRecommendationsForEntity;
18
+ const getRecommendationFeedbackSubmitState = (state) => state.entityRecommendationState.feedbackSubmitState;
19
+ exports.getRecommendationFeedbackSubmitState = getRecommendationFeedbackSubmitState;
@@ -1,4 +1,4 @@
1
- import { FetchedState } from '../../commonStateTypes/common';
1
+ import { FetchStateAndError, FetchedState } from '../../commonStateTypes/common';
2
2
  import { Recommendation } from '../../commonStateTypes/recommendationBase';
3
3
  import { EntityType } from '../../entity/genericEntity/entity';
4
4
  export declare const getEntityRecommendationKey: (entityType: EntityType, entityIdOrName: string) => `vendor_${string}` | `customer_${string}` | `merchant_${string}`;
@@ -8,5 +8,6 @@ export interface EntityRecommendationsStatus extends FetchedState {
8
8
  }
9
9
  export declare const initialEntityRecommendationState: EntityRecommendationsStatus;
10
10
  export interface EntityRecommendationState {
11
+ feedbackSubmitState: FetchStateAndError;
11
12
  recommendationByEntity: Record<EntityRecommendationKey, EntityRecommendationsStatus>;
12
13
  }
@@ -2,6 +2,6 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
3
  import { RootState } from '../../reducer';
4
4
  import { ZeniAPI } from '../../zeniAPI';
5
- import { submitRecommendationFeedback } from './recommendationReducer';
6
- export type ActionType = ReturnType<typeof submitRecommendationFeedback>;
5
+ import { submitRecommendationFeedback, submitRecommendationFeedbackCompleted } from './recommendationReducer';
6
+ export type ActionType = ReturnType<typeof submitRecommendationFeedback> | ReturnType<typeof submitRecommendationFeedbackCompleted>;
7
7
  export declare const submitRecommendationFeedbackEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -4,6 +4,7 @@ exports.submitRecommendationFeedbackEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const responsePayload_1 = require("../../responsePayload");
7
+ const recommendationPayload_1 = require("./recommendationPayload");
7
8
  const recommendationReducer_1 = require("./recommendationReducer");
8
9
  const toRequestBody = (payload) => ({
9
10
  line_id: payload.lineId ?? null,
@@ -36,21 +37,32 @@ const toRequestBody = (payload) => ({
36
37
  retracts_feedback_id: payload.retractsFeedbackId ?? null,
37
38
  features: payload.features ?? null,
38
39
  });
39
- // Fire-and-forget: the epic never re-emits an action. Feedback delivery is a
40
- // side-effect that must not disrupt the categorization UX, so both the
41
- // success and error paths complete silently (errors are logged for debugging).
40
+ // Always reports completion so the feedback popup can show a loader and tell the
41
+ // user what happened. The categorization itself still never waits on this: a
42
+ // failure is surfaced in a toast rather than blocking or reverting the change.
42
43
  const submitRecommendationFeedbackEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.submitRecommendationFeedback.match), (0, operators_1.mergeMap)((action) => {
43
44
  const { transactionId } = action.payload;
45
+ // Only the override that opened the popup reports completion; accepts and
46
+ // retractions stay fire-and-forget so they cannot settle the popup.
47
+ const isPrompted = (0, recommendationPayload_1.isPromptedRecommendationFeedback)(action.payload.outcome);
44
48
  return zeniAPI
45
49
  .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${transactionId}/recommendation-feedback`, toRequestBody(action.payload))
46
50
  .pipe((0, operators_1.mergeMap)((response) => {
47
- if (!(0, responsePayload_1.isSuccessStatus)(response)) {
51
+ const succeeded = (0, responsePayload_1.isSuccessStatus)(response);
52
+ if (!succeeded) {
48
53
  console.error('submitRecommendationFeedbackEpic: recommendation feedback was not recorded', response.status);
49
54
  }
50
- return rxjs_1.EMPTY;
55
+ return isPrompted
56
+ ? (0, rxjs_1.of)((0, recommendationReducer_1.submitRecommendationFeedbackCompleted)({
57
+ succeeded,
58
+ error: succeeded ? undefined : response.status,
59
+ }))
60
+ : rxjs_1.EMPTY;
51
61
  }), (0, operators_1.catchError)((error) => {
52
62
  console.error('submitRecommendationFeedbackEpic: failed to submit recommendation feedback', error);
53
- return rxjs_1.EMPTY;
63
+ return isPrompted
64
+ ? (0, rxjs_1.of)((0, recommendationReducer_1.submitRecommendationFeedbackCompleted)({ succeeded: false }))
65
+ : rxjs_1.EMPTY;
54
66
  }));
55
67
  }));
56
68
  exports.submitRecommendationFeedbackEpic = submitRecommendationFeedbackEpic;
@@ -1,3 +1,5 @@
1
+ import { RecommendationPayload } from '../../../../commonPayloadTypes/recommendationPayload';
2
+ import { ID } from '../../../../commonStateTypes/common';
1
3
  import { AccountPayload } from '../../../../entity/account/accountPayload';
2
4
  import { ApprovalRulePayload } from '../../../../entity/approvalRule/approvalRulePayload';
3
5
  import { BankAccountPayload } from '../../../../entity/bankAccount/bankAccountPayload';
@@ -28,6 +30,22 @@ export interface BillDetailViewPayload extends ApproveOrRejectBillPayload {
28
30
  transaction: BillTransactionPayload;
29
31
  vendors: VendorPayload[];
30
32
  }
33
+ /**
34
+ * Wire shape of the dedicated recommendations endpoint
35
+ * `GET /1.0/bills/transactions/{transaction_id}/recommendations`.
36
+ *
37
+ * `recommendations` is flat here, not nested under `transaction` the way the
38
+ * bill detail response carries it, and is per line — positionally aligned with
39
+ * `transaction.lines` from the bill detail response. The element is the same
40
+ * shape the bill detail response nests under `transaction.recommendations`.
41
+ *
42
+ * Both fields are optional: a bill with nothing to recommend is a success, not
43
+ * an error.
44
+ */
45
+ export interface BillRecommendationsPayload {
46
+ recommendations?: RecommendationPayload[];
47
+ transaction_id?: ID;
48
+ }
31
49
  export interface EligibleActionsPayload {
32
50
  is_refund_eligible: boolean | null;
33
51
  is_retry_eligible: {
@@ -41,6 +59,7 @@ export interface BillDetailQuery {
41
59
  transaction_type: string;
42
60
  }
43
61
  export type BillDetailViewResponse = ZeniAPIResponse<BillDetailViewPayload>;
62
+ export type BillRecommendationsResponse = ZeniAPIResponse<BillRecommendationsPayload>;
44
63
  export type EligibleActionsResponse = ZeniAPIResponse<EligibleActionsPayload>;
45
64
  export type ApproveOrRejectBillResponse = ZeniAPIResponse<ApproveOrRejectBillPayload>;
46
65
  export interface PreviousBillsPayload {
@@ -8,7 +8,16 @@ export declare const fetchBillDetail: import("@reduxjs/toolkit").ActionCreatorWi
8
8
  isShowDeletedBillsEnabled: boolean;
9
9
  hasZeniAssistAccess: boolean;
10
10
  cacheOverride: any;
11
- }, "billDetailView/fetchBillDetail", never, never>, updateBillDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
11
+ }, "billDetailView/fetchBillDetail", never, never>, fetchBillRecommendations: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, cacheOverride?: any], {
12
+ billId: string;
13
+ cacheOverride: any;
14
+ }, "billDetailView/fetchBillRecommendations", never, never>, fetchBillRecommendationsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, didWriteRecommendations?: any], {
15
+ billId: string;
16
+ didWriteRecommendations: any;
17
+ }, "billDetailView/fetchBillRecommendationsSuccess", never, never>, fetchBillRecommendationsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
18
+ billId: string;
19
+ error: ZeniAPIStatus<Record<string, unknown>>;
20
+ }, "billDetailView/fetchBillRecommendationsFailure", never, never>, updateBillDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
12
21
  billDetail: BillDetailViewPayload;
13
22
  billId: ID;
14
23
  }, "billDetailView/updateBillDetail">, updateBillDetailFetchState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, vendorId?: string | undefined], {
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.retryOrRefundBillFailure = exports.retryOrRefundBillSuccess = exports.retryOrRefundBill = exports.updateFetchEligibleActionsFailureState = exports.updateEligibleActionsForBill = exports.fetchEligibleActionsForBill = exports.waitForVendorByNameThenUpdateBillDetail = exports.cancelAndDeleteBillSuccessOrFailure = exports.cancelAndDeleteBill = exports.updateApprovalStatusOnSuccess = exports.approveOrRejectBillFailure = exports.approveOrRejectBillSuccess = exports.approveOrRejectBill = exports.deleteBillSuccessOrFailure = exports.deleteBill = exports.removeBillDetail = exports.updateBillDetailFetchState = exports.updateBillDetail = exports.fetchBillDetail = exports.initialState = void 0;
7
+ exports.retryOrRefundBillFailure = exports.retryOrRefundBillSuccess = exports.retryOrRefundBill = exports.updateFetchEligibleActionsFailureState = exports.updateEligibleActionsForBill = exports.fetchEligibleActionsForBill = exports.waitForVendorByNameThenUpdateBillDetail = exports.cancelAndDeleteBillSuccessOrFailure = exports.cancelAndDeleteBill = exports.updateApprovalStatusOnSuccess = exports.approveOrRejectBillFailure = exports.approveOrRejectBillSuccess = exports.approveOrRejectBill = exports.deleteBillSuccessOrFailure = exports.deleteBill = exports.removeBillDetail = exports.updateBillDetailFetchState = exports.updateBillDetail = exports.fetchBillRecommendationsFailure = exports.fetchBillRecommendationsSuccess = exports.fetchBillRecommendations = exports.fetchBillDetail = exports.initialState = void 0;
8
8
  const toolkit_1 = require("@reduxjs/toolkit");
9
9
  const get_1 = __importDefault(require("lodash/get"));
10
10
  const rootActions_1 = require("../../../../rootActions");
@@ -25,6 +25,12 @@ const billDetailView = (0, toolkit_1.createSlice)({
25
25
  detail.fetchState !== 'In-Progress') {
26
26
  draft.billDetailById[key] = {
27
27
  ...billDetailViewState_1.initialBillDetailView,
28
+ // Deliberately independent of the detail fetch: recommendations
29
+ // are requested separately and must not be reset by a detail
30
+ // refresh, which on the edit route lands right after the
31
+ // recommendations request has already started.
32
+ recommendationsFetchStatus: detail?.recommendationsFetchStatus ??
33
+ billDetailViewState_1.initialBillDetailView.recommendationsFetchStatus,
28
34
  };
29
35
  }
30
36
  },
@@ -76,6 +82,86 @@ const billDetailView = (0, toolkit_1.createSlice)({
76
82
  };
77
83
  },
78
84
  },
85
+ fetchBillRecommendations: {
86
+ reducer(draft, action) {
87
+ const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
88
+ // The edit route can mount before the bill detail entry exists — its
89
+ // screen dispatches this before the parent requests the detail. Seed
90
+ // the entry rather than bailing, or the status would sit at
91
+ // `Not-Started` for the whole wait and round trip.
92
+ const detail = (0, get_1.default)(draft.billDetailById, key, undefined) ?? {
93
+ ...billDetailViewState_1.initialBillDetailView,
94
+ billId: action.payload.billId,
95
+ };
96
+ const { fetchState } = detail.recommendationsFetchStatus;
97
+ // Both screens dispatch once per bill — on mount, keyed by bill id,
98
+ // not on every render — so this guard is not what prevents a render
99
+ // loop; the epic's per-bill `exhaustMap` is what collapses the two
100
+ // sites' dispatches into one request.
101
+ //
102
+ // `Error` is deliberately allowed through: a bill whose fetch failed
103
+ // must be able to try again when the screen is next opened.
104
+ if (action.payload.cacheOverride === true ||
105
+ (fetchState !== 'In-Progress' && fetchState !== 'Completed')) {
106
+ draft.billDetailById[key] = {
107
+ ...detail,
108
+ recommendationsFetchStatus: {
109
+ fetchState: 'In-Progress',
110
+ error: undefined,
111
+ },
112
+ };
113
+ }
114
+ },
115
+ prepare(billId, cacheOverride = false) {
116
+ return {
117
+ payload: { billId, cacheOverride },
118
+ };
119
+ },
120
+ },
121
+ fetchBillRecommendationsSuccess: {
122
+ reducer(draft, action) {
123
+ const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
124
+ const detail = (0, get_1.default)(draft.billDetailById, key, undefined);
125
+ if (detail != null) {
126
+ draft.billDetailById[key] = {
127
+ ...detail,
128
+ recommendationsFetchStatus: {
129
+ fetchState: 'Completed',
130
+ error: undefined,
131
+ },
132
+ };
133
+ }
134
+ },
135
+ // `didWriteRecommendations` is false on the skip paths, which resolve
136
+ // the status without fetching anything. Consumers that react by
137
+ // recomputing local state must not run then — there is nothing new to
138
+ // apply, and recomputing would reset the line's "update to" selections.
139
+ prepare(billId, didWriteRecommendations = false) {
140
+ return {
141
+ payload: { billId, didWriteRecommendations },
142
+ };
143
+ },
144
+ },
145
+ fetchBillRecommendationsFailure: {
146
+ reducer(draft, action) {
147
+ const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
148
+ const detail = (0, get_1.default)(draft.billDetailById, key, undefined);
149
+ if (detail != null) {
150
+ draft.billDetailById[key] = {
151
+ ...detail,
152
+ recommendationsFetchStatus: {
153
+ fetchState: 'Error',
154
+ error: action.payload.error,
155
+ },
156
+ };
157
+ }
158
+ },
159
+ prepare(billId, error) {
160
+ return {
161
+ payload: { billId, error },
162
+ };
163
+ },
164
+ },
79
165
  deleteBill: {
80
166
  reducer(draft, action) {
81
167
  const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
@@ -469,5 +555,5 @@ const billDetailView = (0, toolkit_1.createSlice)({
469
555
  });
470
556
  },
471
557
  });
472
- _a = billDetailView.actions, exports.fetchBillDetail = _a.fetchBillDetail, exports.updateBillDetail = _a.updateBillDetail, exports.updateBillDetailFetchState = _a.updateBillDetailFetchState, exports.removeBillDetail = _a.removeBillDetail, exports.deleteBill = _a.deleteBill, exports.deleteBillSuccessOrFailure = _a.deleteBillSuccessOrFailure, exports.approveOrRejectBill = _a.approveOrRejectBill, exports.approveOrRejectBillSuccess = _a.approveOrRejectBillSuccess, exports.approveOrRejectBillFailure = _a.approveOrRejectBillFailure, exports.updateApprovalStatusOnSuccess = _a.updateApprovalStatusOnSuccess, exports.cancelAndDeleteBill = _a.cancelAndDeleteBill, exports.cancelAndDeleteBillSuccessOrFailure = _a.cancelAndDeleteBillSuccessOrFailure, exports.waitForVendorByNameThenUpdateBillDetail = _a.waitForVendorByNameThenUpdateBillDetail, exports.fetchEligibleActionsForBill = _a.fetchEligibleActionsForBill, exports.updateEligibleActionsForBill = _a.updateEligibleActionsForBill, exports.updateFetchEligibleActionsFailureState = _a.updateFetchEligibleActionsFailureState, exports.retryOrRefundBill = _a.retryOrRefundBill, exports.retryOrRefundBillSuccess = _a.retryOrRefundBillSuccess, exports.retryOrRefundBillFailure = _a.retryOrRefundBillFailure;
558
+ _a = billDetailView.actions, exports.fetchBillDetail = _a.fetchBillDetail, exports.fetchBillRecommendations = _a.fetchBillRecommendations, exports.fetchBillRecommendationsSuccess = _a.fetchBillRecommendationsSuccess, exports.fetchBillRecommendationsFailure = _a.fetchBillRecommendationsFailure, exports.updateBillDetail = _a.updateBillDetail, exports.updateBillDetailFetchState = _a.updateBillDetailFetchState, exports.removeBillDetail = _a.removeBillDetail, exports.deleteBill = _a.deleteBill, exports.deleteBillSuccessOrFailure = _a.deleteBillSuccessOrFailure, exports.approveOrRejectBill = _a.approveOrRejectBill, exports.approveOrRejectBillSuccess = _a.approveOrRejectBillSuccess, exports.approveOrRejectBillFailure = _a.approveOrRejectBillFailure, exports.updateApprovalStatusOnSuccess = _a.updateApprovalStatusOnSuccess, exports.cancelAndDeleteBill = _a.cancelAndDeleteBill, exports.cancelAndDeleteBillSuccessOrFailure = _a.cancelAndDeleteBillSuccessOrFailure, exports.waitForVendorByNameThenUpdateBillDetail = _a.waitForVendorByNameThenUpdateBillDetail, exports.fetchEligibleActionsForBill = _a.fetchEligibleActionsForBill, exports.updateEligibleActionsForBill = _a.updateEligibleActionsForBill, exports.updateFetchEligibleActionsFailureState = _a.updateFetchEligibleActionsFailureState, exports.retryOrRefundBill = _a.retryOrRefundBill, exports.retryOrRefundBillSuccess = _a.retryOrRefundBillSuccess, exports.retryOrRefundBillFailure = _a.retryOrRefundBillFailure;
473
559
  exports.default = billDetailView.reducer;
@@ -42,6 +42,7 @@ export interface BillDetailViewSelector extends SelectorView {
42
42
  outsideZeniPaymentInfo?: OutsideZeniPaymentLocalData;
43
43
  paymentInstrument?: PaymentInstrument;
44
44
  paymentMethodType?: BillPayConfig;
45
+ recommendationsFetchStatus?: FetchStateAndError;
45
46
  recurringBillConfigDetail?: RecurringBillConfig;
46
47
  recurringBillInstances?: RecurringBillData[];
47
48
  transactionDetails?: BillTransaction;
@@ -226,6 +226,7 @@ const getBillDetailView = (state, billId) => {
226
226
  fetchState: fetchState.fetchState,
227
227
  error: fetchState.error,
228
228
  version: 0,
229
+ recommendationsFetchStatus: billTransactionDetails?.recommendationsFetchStatus,
229
230
  transactionDetails: transaction,
230
231
  createdBy,
231
232
  bankAccount,
@@ -11,6 +11,13 @@ export interface BillDetailView extends FetchedState {
11
11
  deleteStatus: FetchStateAndError;
12
12
  entityApprovalIds: ID[];
13
13
  eventIds: ID[];
14
+ /**
15
+ * Status of the standalone recommendations fetch for this bill.
16
+ * Deliberately NOT folded into `fetchState` (or any `reduceFetchState` list)
17
+ * so a slow or failing recommendations call can never hold back — or error
18
+ * out — the bill detail / bill edit screens.
19
+ */
20
+ recommendationsFetchStatus: FetchStateAndError;
14
21
  zeniAssist: ZeniAssistForBills;
15
22
  billId?: ID;
16
23
  vendorId?: ID;
@@ -34,6 +34,10 @@ exports.initialBillDetailView = {
34
34
  fetchState: 'Not-Started',
35
35
  error: undefined,
36
36
  },
37
+ recommendationsFetchStatus: {
38
+ fetchState: 'Not-Started',
39
+ error: undefined,
40
+ },
37
41
  billId: undefined,
38
42
  eventIds: [],
39
43
  entityApprovalIds: [],
@@ -0,0 +1,37 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateBillTransactionRecommendations } from '../../../../../entity/billPay/billTransaction/billTransactionReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { fetchBillRecommendations, fetchBillRecommendationsFailure, fetchBillRecommendationsSuccess, updateBillDetail, updateBillDetailFetchState } from '../billDetailViewReducer';
7
+ export type ActionType = ReturnType<typeof fetchBillRecommendations> | ReturnType<typeof fetchBillRecommendationsSuccess> | ReturnType<typeof fetchBillRecommendationsFailure> | ReturnType<typeof updateBillDetail> | ReturnType<typeof updateBillDetailFetchState> | ReturnType<typeof updateBillTransactionRecommendations>;
8
+ /**
9
+ * Standalone recommendations fetch for a bill, so neither the bill detail nor
10
+ * the bill edit screen waits on recommendation composition.
11
+ *
12
+ * Which bills need it is decided from the bill's stage: an approval-stage bill
13
+ * gets them from the dedicated endpoint
14
+ * (`GET /1.0/bills/transactions/{transaction_id}/recommendations`), while a
15
+ * draft gets them on the bill detail response itself. The platform makes that
16
+ * split from the bill's status, so neither request carries a flag asking for
17
+ * one behaviour or the other.
18
+ *
19
+ * Only `recommendations` is read — per line, and what drives the "Update to X"
20
+ * checkbox and the Recommended group in the category/class dropdowns. The
21
+ * endpoint returns no entity-level recommendation and the edit form does not
22
+ * render one.
23
+ *
24
+ * Failure is confined to `recommendationsFetchStatus` — no bill-detail action
25
+ * is emitted, so a failed or slow recommendations fetch can neither block nor
26
+ * error out either screen.
27
+ *
28
+ * @precondition Every site dispatching `fetchBillRecommendations` must also
29
+ * cause the bill detail to be requested for that bill. This epic waits for the
30
+ * detail when it is not already in the store, and that wait settles only on a
31
+ * detail write or a detail error. A caller that dispatches without one would
32
+ * leave the wait open, and the per-bill `exhaustMap` would then drop later
33
+ * retries for that bill. Both current callers satisfy this: the bill detail
34
+ * route dispatches `fetchBillDetail` alongside, and the edit route reaches it
35
+ * through `fetchEditBillDetailPage`.
36
+ */
37
+ export declare const fetchBillRecommendationsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchBillRecommendationsEpic = void 0;
7
+ const get_1 = __importDefault(require("lodash/get"));
8
+ const rxjs_1 = require("rxjs");
9
+ const operators_1 = require("rxjs/operators");
10
+ const responsePayload_1 = require("../../../../../responsePayload");
11
+ const billDetailViewReducer_1 = require("../billDetailViewReducer");
12
+ const billDetailViewState_1 = require("../billDetailViewState");
13
+ const fetchRecommendationsForBill_1 = require("./fetchRecommendationsForBill");
14
+ /**
15
+ * Standalone recommendations fetch for a bill, so neither the bill detail nor
16
+ * the bill edit screen waits on recommendation composition.
17
+ *
18
+ * Which bills need it is decided from the bill's stage: an approval-stage bill
19
+ * gets them from the dedicated endpoint
20
+ * (`GET /1.0/bills/transactions/{transaction_id}/recommendations`), while a
21
+ * draft gets them on the bill detail response itself. The platform makes that
22
+ * split from the bill's status, so neither request carries a flag asking for
23
+ * one behaviour or the other.
24
+ *
25
+ * Only `recommendations` is read — per line, and what drives the "Update to X"
26
+ * checkbox and the Recommended group in the category/class dropdowns. The
27
+ * endpoint returns no entity-level recommendation and the edit form does not
28
+ * render one.
29
+ *
30
+ * Failure is confined to `recommendationsFetchStatus` — no bill-detail action
31
+ * is emitted, so a failed or slow recommendations fetch can neither block nor
32
+ * error out either screen.
33
+ *
34
+ * @precondition Every site dispatching `fetchBillRecommendations` must also
35
+ * cause the bill detail to be requested for that bill. This epic waits for the
36
+ * detail when it is not already in the store, and that wait settles only on a
37
+ * detail write or a detail error. A caller that dispatches without one would
38
+ * leave the wait open, and the per-bill `exhaustMap` would then drop later
39
+ * retries for that bill. Both current callers satisfy this: the bill detail
40
+ * route dispatches `fetchBillDetail` alongside, and the edit route reaches it
41
+ * through `fetchEditBillDetailPage`.
42
+ */
43
+ const fetchBillRecommendationsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billDetailViewReducer_1.fetchBillRecommendations.match),
44
+ // The bill detail route requests these and the edit screen asks again on
45
+ // every mount, so repeats are normal. Drop the ones whose bill is already
46
+ // done before they reach the request.
47
+ (0, operators_1.filter)((action) => action.payload.cacheOverride === true ||
48
+ areRecommendationsAlreadyFetched(state$.value, action.payload.billId) === false),
49
+ // Per bill, then `exhaustMap` rather than `switchMap`: a repeat that
50
+ // arrives while the request (or the wait for the bill detail) is still
51
+ // running is ignored, where `switchMap` would cancel the in-flight one and
52
+ // re-issue it. `groupBy` keeps that per bill, so navigating to another
53
+ // bill mid-flight still fetches for the new one.
54
+ (0, operators_1.groupBy)((action) => action.payload.billId), (0, operators_1.mergeMap)((actionsForBill$) => actionsForBill$.pipe((0, operators_1.exhaustMap)((action) => {
55
+ const { billId, cacheOverride } = action.payload;
56
+ if (isBillReadyForRecommendations(state$.value, billId)) {
57
+ return (0, fetchRecommendationsForBill_1.fetchRecommendationsForBill)(state$.value, billId, zeniAPI, cacheOverride);
58
+ }
59
+ // The edit route can mount before the bill detail response lands,
60
+ // and the request needs the vendor / line ids / amount from it. Wait
61
+ // for the detail write for this bill rather than dropping the fetch,
62
+ // and settle on a detail error too.
63
+ //
64
+ // A leftover `Error` on the bill detail is deliberately NOT treated
65
+ // as terminal here. On the edit route this action is dispatched
66
+ // before the parent screen re-requests the detail — React runs the
67
+ // child's effect first — so failing on the stale error would leave
68
+ // recommendations failed even though the detail is about to succeed.
69
+ //
70
+ // The invariant this relies on: every dispatch site also causes the
71
+ // bill detail to be requested. Both do today. A future site that
72
+ // does not would leave this waiting, and `exhaustMap` would drop
73
+ // later retries for that bill.
74
+ const billDetailSettled$ = actions$.pipe((0, operators_1.filter)((waited) => {
75
+ if (billDetailViewReducer_1.updateBillDetail.match(waited)) {
76
+ return waited.payload.billId === billId;
77
+ }
78
+ return (billDetailViewReducer_1.updateBillDetailFetchState.match(waited) &&
79
+ waited.payload.fetchState === 'Error' &&
80
+ waited.payload.billId === billId);
81
+ }), (0, operators_1.take)(1) // don't listen forever! IMPORTANT!
82
+ );
83
+ return billDetailSettled$.pipe((0, operators_1.mergeMap)((waited) => {
84
+ if (billDetailViewReducer_1.updateBillDetail.match(waited)) {
85
+ return (0, fetchRecommendationsForBill_1.fetchRecommendationsForBill)(state$.value, billId, zeniAPI, cacheOverride);
86
+ }
87
+ // Bill detail failed; there is nothing to recommend against.
88
+ return (0, rxjs_1.of)((0, billDetailViewReducer_1.fetchBillRecommendationsFailure)(billId, waited.payload.error ??
89
+ (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Bill detail fetch failed before recommendations could be requested')));
90
+ }));
91
+ }))));
92
+ exports.fetchBillRecommendationsEpic = fetchBillRecommendationsEpic;
93
+ /**
94
+ * Helper functions
95
+ */
96
+ function areRecommendationsAlreadyFetched(state, billId) {
97
+ const billDetail = (0, get_1.default)(state.billDetailViewState.billDetailById, (0, billDetailViewState_1.getBillTransactionDetailKey)(billId), undefined);
98
+ return billDetail?.recommendationsFetchStatus.fetchState === 'Completed';
99
+ }
100
+ function isBillReadyForRecommendations(state, billId) {
101
+ const billDetail = (0, get_1.default)(state.billDetailViewState.billDetailById, (0, billDetailViewState_1.getBillTransactionDetailKey)(billId), undefined);
102
+ return (billDetail?.fetchState === 'Completed' &&
103
+ (0, fetchRecommendationsForBill_1.getBillTransaction)(state, billId) != null);
104
+ }
@@ -0,0 +1,24 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ID } from '../../../../../commonStateTypes/common';
3
+ import { updateBillTransactionRecommendations } from '../../../../../entity/billPay/billTransaction/billTransactionReducer';
4
+ import { BillTransaction } from '../../../../../entity/billPay/billTransaction/billTransactionState';
5
+ import { RootState } from '../../../../../reducer';
6
+ import { ZeniAPI } from '../../../../../zeniAPI';
7
+ import { fetchBillRecommendationsFailure, fetchBillRecommendationsSuccess } from '../billDetailViewReducer';
8
+ /**
9
+ * What the request itself can emit. `fetchBillRecommendationsEpic` widens this
10
+ * with the actions it consumes; keeping the narrower union here is what lets
11
+ * this module stay free of any import from the epic.
12
+ */
13
+ export type FetchRecommendationsForBillActionType = ReturnType<typeof fetchBillRecommendationsSuccess> | ReturnType<typeof fetchBillRecommendationsFailure> | ReturnType<typeof updateBillTransactionRecommendations>;
14
+ /**
15
+ * Requests the recommendations for one bill and maps them onto the transaction
16
+ * entity, or resolves without a request for a bill that does not need them.
17
+ *
18
+ * Only `recommendations` is read from the response — per line, and what drives
19
+ * the "Update to X" checkbox and the Recommended group in the category/class
20
+ * dropdowns. The endpoint returns no entity-level recommendation and the edit
21
+ * form does not render one.
22
+ */
23
+ export declare function fetchRecommendationsForBill(state: RootState, billId: ID, zeniAPI: ZeniAPI, cacheOverride?: boolean): Observable<FetchRecommendationsForBillActionType>;
24
+ export declare function getBillTransaction(state: RootState, billId: ID): BillTransaction | undefined;