@zeniai/client-epic-state 5.0.96 → 5.0.97

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 (272) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
  2. package/lib/commonStateTypes/amount.d.ts +1 -0
  3. package/lib/commonStateTypes/amount.js +9 -1
  4. package/lib/commonStateTypes/workingDayHelper.d.ts +9 -0
  5. package/lib/commonStateTypes/workingDayHelper.js +28 -1
  6. package/lib/entity/aiCfo/aiCfoPayload.d.ts +63 -5
  7. package/lib/entity/aiCfo/aiCfoReducer.d.ts +23 -2
  8. package/lib/entity/aiCfo/aiCfoReducer.js +249 -9
  9. package/lib/entity/aiCfo/aiCfoSelector.d.ts +4 -1
  10. package/lib/entity/aiCfo/aiCfoSelector.js +19 -1
  11. package/lib/entity/aiCfo/aiCfoState.d.ts +97 -4
  12. package/lib/entity/aiCfo/aiCfoState.js +18 -1
  13. package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +277 -0
  14. package/lib/entity/cardPolicy/cardPolicyPayload.js +143 -0
  15. package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +19 -0
  16. package/lib/entity/cardPolicy/cardPolicyReducer.js +175 -0
  17. package/lib/entity/cardPolicy/cardPolicySelector.d.ts +32 -0
  18. package/lib/entity/cardPolicy/cardPolicySelector.js +99 -0
  19. package/lib/entity/cardPolicy/cardPolicyState.d.ts +205 -0
  20. package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
  21. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
  22. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +68 -0
  23. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
  24. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
  25. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +25 -0
  26. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +39 -0
  27. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +24 -0
  28. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +105 -0
  29. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
  30. package/lib/entity/jeSchedules/jeSchedulesPayload.js +7 -0
  31. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
  32. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  33. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
  34. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  35. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  36. package/lib/entity/task/taskPayload.d.ts +3 -1
  37. package/lib/entity/task/taskPayload.js +2 -0
  38. package/lib/entity/task/taskState.d.ts +2 -0
  39. package/lib/entity/tenant/clearAllEpic.d.ts +8 -2
  40. package/lib/entity/tenant/clearAllEpic.js +12 -0
  41. package/lib/epic.d.ts +24 -3
  42. package/lib/epic.js +24 -3
  43. package/lib/esm/commonStateTypes/amount.js +7 -0
  44. package/lib/esm/commonStateTypes/workingDayHelper.js +26 -0
  45. package/lib/esm/entity/aiCfo/aiCfoReducer.js +249 -9
  46. package/lib/esm/entity/aiCfo/aiCfoSelector.js +17 -1
  47. package/lib/esm/entity/aiCfo/aiCfoState.js +15 -0
  48. package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +130 -0
  49. package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +171 -0
  50. package/lib/esm/entity/cardPolicy/cardPolicySelector.js +75 -0
  51. package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
  52. package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +64 -0
  53. package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
  54. package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +35 -0
  55. package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +101 -0
  56. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +7 -0
  57. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  58. package/lib/esm/entity/task/taskPayload.js +2 -0
  59. package/lib/esm/entity/tenant/clearAllEpic.js +12 -0
  60. package/lib/esm/epic.js +24 -3
  61. package/lib/esm/index.js +47 -12
  62. package/lib/esm/reducer.js +18 -0
  63. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +6 -3
  64. package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  65. package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +2 -1
  66. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  67. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +39 -11
  68. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +14 -4
  69. package/lib/esm/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +38 -0
  70. package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  71. package/lib/esm/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +16 -0
  72. package/lib/esm/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  73. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +22 -2
  74. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +29 -0
  75. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +78 -0
  76. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +47 -0
  77. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +47 -0
  78. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +34 -0
  79. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +32 -0
  80. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +54 -0
  81. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +92 -0
  82. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +225 -0
  83. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +10 -0
  84. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +23 -0
  85. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +36 -0
  86. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +27 -0
  87. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +28 -0
  88. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +52 -0
  89. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
  90. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
  91. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +36 -0
  92. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +39 -0
  93. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +34 -0
  94. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +58 -0
  95. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
  96. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
  97. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +38 -0
  98. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +289 -0
  99. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +109 -0
  100. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +44 -0
  101. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +111 -0
  102. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +25 -0
  103. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +363 -0
  104. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +36 -0
  105. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +19 -0
  106. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +6 -0
  107. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +119 -0
  108. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +154 -0
  109. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +22 -0
  110. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
  111. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +39 -0
  112. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +140 -0
  113. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +20 -0
  114. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +100 -0
  115. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +96 -0
  116. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +59 -0
  117. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +24 -0
  118. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +25 -0
  119. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +1 -0
  120. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +34 -0
  121. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +57 -0
  122. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +35 -0
  123. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
  124. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +42 -4
  125. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +35 -0
  126. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +62 -0
  127. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +44 -0
  128. package/lib/index.d.ts +59 -15
  129. package/lib/index.js +213 -22
  130. package/lib/reducer.d.ts +18 -0
  131. package/lib/reducer.js +18 -0
  132. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +11 -2
  133. package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -3
  134. package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  135. package/lib/view/aiCfoView/epics/createSessionEpic.js +2 -1
  136. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -1
  137. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  138. package/lib/view/companyTaskManagerView/companyTaskManagerViewPayload.d.ts +19 -11
  139. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +10 -4
  140. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +40 -12
  141. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +2 -0
  142. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +13 -3
  143. package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +11 -3
  144. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.d.ts +10 -0
  145. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +42 -0
  146. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.d.ts +1 -3
  147. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  148. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.d.ts +6 -0
  149. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +20 -0
  150. package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  151. package/lib/view/companyView/types/cockpitTypes.d.ts +2 -1
  152. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  153. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  154. package/lib/view/people/peopleTypes.d.ts +1 -1
  155. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  156. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +8 -1
  157. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +21 -1
  158. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +22 -0
  159. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.d.ts +47 -0
  160. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +34 -0
  161. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.d.ts +23 -0
  162. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +82 -0
  163. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.d.ts +40 -0
  164. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +51 -0
  165. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.d.ts +37 -0
  166. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +53 -0
  167. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.d.ts +14 -0
  168. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +38 -0
  169. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.d.ts +7 -0
  170. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +36 -0
  171. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.d.ts +56 -0
  172. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +60 -0
  173. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.d.ts +22 -0
  174. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +96 -0
  175. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.d.ts +59 -0
  176. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +230 -0
  177. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.d.ts +122 -0
  178. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +13 -0
  179. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.d.ts +7 -0
  180. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +27 -0
  181. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.d.ts +9 -0
  182. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +40 -0
  183. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.d.ts +7 -0
  184. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +31 -0
  185. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.d.ts +15 -0
  186. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +32 -0
  187. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
  188. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +56 -0
  189. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +15 -0
  190. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
  191. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +8 -0
  192. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
  193. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +8 -0
  194. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +40 -0
  195. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +8 -0
  196. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +43 -0
  197. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +8 -0
  198. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +38 -0
  199. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
  200. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +62 -0
  201. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +15 -0
  202. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
  203. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +7 -0
  204. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
  205. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +8 -0
  206. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +42 -0
  207. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.d.ts +8 -0
  208. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +294 -0
  209. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.d.ts +8 -0
  210. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +113 -0
  211. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.d.ts +9 -0
  212. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +48 -0
  213. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.d.ts +8 -0
  214. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +115 -0
  215. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.d.ts +13 -0
  216. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +29 -0
  217. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.d.ts +14 -0
  218. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +369 -0
  219. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.d.ts +6 -0
  220. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +40 -0
  221. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.d.ts +7 -0
  222. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +26 -0
  223. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.d.ts +116 -0
  224. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +10 -0
  225. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.d.ts +33 -0
  226. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +126 -0
  227. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +52 -0
  228. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +158 -0
  229. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +11 -0
  230. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +31 -0
  231. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +12 -0
  232. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
  233. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +8 -0
  234. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +43 -0
  235. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.d.ts +10 -0
  236. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +144 -0
  237. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +7 -0
  238. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +24 -0
  239. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.d.ts +11 -0
  240. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +104 -0
  241. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.d.ts +22 -0
  242. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +100 -0
  243. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.d.ts +8 -0
  244. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +63 -0
  245. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.d.ts +3 -0
  246. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +28 -0
  247. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  248. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +14 -0
  249. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +27 -1
  250. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.d.ts +34 -0
  251. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +2 -0
  252. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.d.ts +7 -0
  253. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +38 -0
  254. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.d.ts +12 -0
  255. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +61 -0
  256. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.d.ts +9 -0
  257. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +39 -0
  258. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
  259. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
  260. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +12 -2
  261. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +43 -5
  262. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +7 -0
  263. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +42 -1
  264. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +5 -0
  265. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.d.ts +11 -0
  266. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +66 -0
  267. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.d.ts +3 -0
  268. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +48 -0
  269. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
  270. package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +1 -1
  271. package/lib/zeniAPI.d.ts +1 -0
  272. package/package.json +1 -1
@@ -0,0 +1,75 @@
1
+ export function getCardPolicyMccCategories(state) {
2
+ return state.mccCategories;
3
+ }
4
+ export function getCardPolicyMccCategoriesFetchState(state) {
5
+ return state.mccCategoriesFetchState;
6
+ }
7
+ export function getCardPolicyMccCategoriesError(state) {
8
+ return state.mccCategoriesError;
9
+ }
10
+ export function getCardPolicyTemplateById(state, templateId) {
11
+ return state.cardPolicyTemplateById[templateId];
12
+ }
13
+ export function getAllCardPolicyTemplates(state) {
14
+ return Object.values(state.cardPolicyTemplateById);
15
+ }
16
+ /**
17
+ * Resolve an ordered list of `templateId`s against the entity store and
18
+ * return the corresponding `CardPolicyTemplate[]` in the same order.
19
+ * Missing IDs (e.g. stale local state during a refetch) are silently
20
+ * dropped. Pair with `getCardPolicyTemplateIds` from the view slice to
21
+ * render the Policy List page in server order.
22
+ */
23
+ export function getCardPolicyTemplatesByIds(state, templateIds) {
24
+ return templateIds
25
+ .map((id) => state.cardPolicyTemplateById[id])
26
+ .filter((template) => template != null);
27
+ }
28
+ export function getCardPolicyStats(state) {
29
+ return state.cardPolicyStats;
30
+ }
31
+ export function getPolicyDocumentExtractionFetchState(state) {
32
+ return state.policyDocumentExtraction.fetchState;
33
+ }
34
+ export function getPolicyDocumentExtractionError(state) {
35
+ return state.policyDocumentExtraction.error;
36
+ }
37
+ export function getExtractedCardPolicyRules(state) {
38
+ return state.policyDocumentExtraction.extractedRules;
39
+ }
40
+ export function getUploadedPolicyDocumentFileName(state) {
41
+ return state.policyDocumentExtraction.uploadedFileName;
42
+ }
43
+ export function getPolicyRecommendationFromUploadFetchState(state) {
44
+ return state.policyRecommendationFromUpload.fetchState;
45
+ }
46
+ export function getPolicyRecommendationFromUploadError(state) {
47
+ return state.policyRecommendationFromUpload.error;
48
+ }
49
+ export function getPolicyRecommendationFromUploadAnswerId(state) {
50
+ return state.policyRecommendationFromUpload.answerId;
51
+ }
52
+ export function getPolicyRecommendationFromUploadChatSessionId(state) {
53
+ return state.policyRecommendationFromUpload.chatSessionId;
54
+ }
55
+ export function getCardPolicySuggestedAllowMerchants(state) {
56
+ return state.suggestedAllowMerchants;
57
+ }
58
+ export function getCardPolicySuggestedBlockMerchants(state) {
59
+ return state.suggestedBlockMerchants;
60
+ }
61
+ export function getCardPolicySuggestedAllowCategories(state) {
62
+ return state.suggestedAllowCategories;
63
+ }
64
+ export function getCardPolicySuggestedBlockCategories(state) {
65
+ return state.suggestedBlockCategories;
66
+ }
67
+ export function getCardPolicyVendorSearchOptions(state) {
68
+ return state.vendorSearch.vendors;
69
+ }
70
+ export function getCardPolicyVendorSearchFetchState(state) {
71
+ return state.vendorSearch.fetchState;
72
+ }
73
+ export function getCardPolicyVendorSearchString(state) {
74
+ return state.vendorSearch.searchString;
75
+ }
@@ -0,0 +1,9 @@
1
+ import { stringToUnion } from '../../commonStateTypes/stringToUnion';
2
+ export const ALL_CARD_POLICY_TEMPLATE_MODES = ['strict', 'flexible'];
3
+ export const toCardPolicyTemplateMode = (v) => stringToUnion(v, ALL_CARD_POLICY_TEMPLATE_MODES);
4
+ export const ALL_CARD_POLICY_TEMPLATE_STATUSES = [
5
+ 'active',
6
+ 'inactive',
7
+ 'archived',
8
+ ];
9
+ export const toCardPolicyTemplateStatus = (v) => stringToUnion(v, ALL_CARD_POLICY_TEMPLATE_STATUSES);
@@ -0,0 +1,64 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap, takeUntil } from 'rxjs/operators';
3
+ import { createZeniAPIStatus, isSuccessStatus } from '../../responsePayload';
4
+ import { clearPolicyDocumentExtraction, extractPolicyDocument, updatePolicyDocumentExtractionFailure, updatePolicyDocumentExtractionSuccess, } from './cardPolicyReducer';
5
+ /**
6
+ * Build a multipart `FormData` body for `POST /cards/1.0/policy-documents/extract`.
7
+ *
8
+ * Uses the same `attachment_file_<i>` / `attachment_json_<i>` field-naming
9
+ * convention as the charge-card receipt upload (`uploadReceipts.ts` in
10
+ * `web-components`) so backends that already support that wire shape
11
+ * accept this endpoint without bespoke parsing.
12
+ */
13
+ const buildPolicyDocumentFormData = (files) => {
14
+ const data = new FormData();
15
+ files.forEach((file, index) => {
16
+ data.append(`attachment_file_${index}`, file);
17
+ const attachmentJson = JSON.stringify({
18
+ file_name: file.name,
19
+ content_type: file.type,
20
+ size: file.size,
21
+ });
22
+ data.append(`attachment_json_${index}`, attachmentJson);
23
+ });
24
+ return data;
25
+ };
26
+ /**
27
+ * Listens for `extractPolicyDocument`, POSTs the file(s) as multipart
28
+ * form-data to the cards micro-service's policy-document extract endpoint,
29
+ * and dispatches success / failure into the entity slice.
30
+ *
31
+ * Consumed by:
32
+ * - Manual `CardPolicyCreatePage` (read result via
33
+ * `getExtractedCardPolicyRules` then pre-fill the RHF form via
34
+ * `applyExtractedPolicyRulesToFormValues` from `@zeniai/web-components`).
35
+ * - (Future) AI CFO upload surface — same action + selector contract.
36
+ */
37
+ export const extractPolicyDocumentEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(extractPolicyDocument.match),
38
+ // `switchMap` (vs `mergeMap`) cancels any in-flight extract whenever a
39
+ // new upload is dispatched. With `mergeMap` an older, slower response
40
+ // could win the race: `updatePolicyDocumentExtractionSuccess` would
41
+ // fire with stale `extractedRules` and the chained bridge epic would
42
+ // pair them with whatever `aiCfoAnswerId` / `aiCfoChatSessionId` are
43
+ // currently in state — recommending the old file's rules against the
44
+ // wrong AI CFO answer.
45
+ switchMap((action) => {
46
+ const formData = buildPolicyDocumentFormData(action.payload.files);
47
+ return zeniAPI
48
+ .postFormData(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-documents/extract`, formData)
49
+ .pipe(mergeMap((response) => {
50
+ if (isSuccessStatus(response) &&
51
+ response.data != null &&
52
+ response.data.extracted_rules != null) {
53
+ return of(updatePolicyDocumentExtractionSuccess(response.data.extracted_rules));
54
+ }
55
+ return of(updatePolicyDocumentExtractionFailure(response.status));
56
+ }), catchError((error) => of(updatePolicyDocumentExtractionFailure(createZeniAPIStatus('Unexpected Error', 'Extract card-policy document REST API call errored out' +
57
+ JSON.stringify(error))))),
58
+ // `clearPolicyDocumentExtraction` (e.g. user clicks the "× Policy.pdf"
59
+ // pill) tears down the in-flight extract subscription, so a late
60
+ // response can't re-flip `policyDocumentExtraction.fetchState` back
61
+ // to `Completed` or repopulate `extractedRules` after the user
62
+ // already dismissed the upload.
63
+ takeUntil(actions$.pipe(filter(clearPolicyDocumentExtraction.match))));
64
+ }));
@@ -0,0 +1,43 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, switchMap } from 'rxjs/operators';
3
+ import { createZeniAPIStatus, isSuccessStatus } from '../../responsePayload';
4
+ import { fetchCardPolicyVendorOptions, updateCardPolicyVendorOptions, updateCardPolicyVendorOptionsFailure, } from './cardPolicyReducer';
5
+ const buildQuery = (searchString) => ({
6
+ view: 'vendor_list',
7
+ page_token: null,
8
+ sort_by: 'year_to_date_spend',
9
+ sort_order: 'desc',
10
+ search_text: searchString,
11
+ vendor_name: searchString,
12
+ });
13
+ /**
14
+ * Card-policy vendor search.
15
+ *
16
+ * Listens for `fetchCardPolicyVendorOptions` and hits the same
17
+ * `/accounting/1.0/vendors` endpoint the Vendors-tab uses, but writes
18
+ * results onto the dedicated `cardPolicyState.vendorSearch` slice — no
19
+ * fan-out to the global `vendor` / `account` / `class` / `vendorList`
20
+ * entities. That isolation is important: the user may be configuring a
21
+ * card policy in parallel with browsing the Vendors tab, and we don't
22
+ * want either flow to clobber the other's list state.
23
+ *
24
+ * Uses `switchMap` so the latest typed search wins — earlier in-flight
25
+ * requests are abandoned, which is the right semantics for a
26
+ * search-as-you-type UX.
27
+ *
28
+ * Consumers:
29
+ * - Manual `CardPolicyCreate / EditScreen`
30
+ * - AI CFO `CardPolicyInteractiveForm` (vendor step)
31
+ */
32
+ export const fetchCardPolicyVendorOptionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyVendorOptions.match), switchMap((action) => {
33
+ const query = buildQuery(action.payload.searchString);
34
+ const apiUrl = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors` +
35
+ `?query=${encodeURIComponent(JSON.stringify(query))}`;
36
+ return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
37
+ if (isSuccessStatus(response) && response.data != null) {
38
+ return of(updateCardPolicyVendorOptions(response.data));
39
+ }
40
+ return of(updateCardPolicyVendorOptionsFailure(response.status));
41
+ }), catchError((error) => of(updateCardPolicyVendorOptionsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch card policy vendor options REST API call errored out' +
42
+ JSON.stringify(error))))));
43
+ }));
@@ -0,0 +1,35 @@
1
+ import { EMPTY, of } from 'rxjs';
2
+ import { filter, mergeMap } from 'rxjs/operators';
3
+ import { fetchCardPolicyRecommendationFromUpload, updatePolicyDocumentExtractionSuccess, } from './cardPolicyReducer';
4
+ /**
5
+ * Bridge epic — chains the AI CFO `upload`-mode flow's two API hops.
6
+ *
7
+ * The first hop (`extractPolicyDocument` → multipart POST to
8
+ * `policy-documents/extract`) lives on the cardPolicy slice and is
9
+ * shared with the manual `CardPolicyCreatePage`. The second hop
10
+ * (`fetchCardPolicyRecommendationFromUpload` → JSON POST to
11
+ * `ai-cfo/policy-recommendation-from-upload`) is AI-CFO only.
12
+ *
13
+ * The chain is gated on `policyDocumentExtraction.aiCfoAnswerId` being
14
+ * populated — manual callers leave it undefined, so the bridge is a
15
+ * silent no-op there.
16
+ *
17
+ * Splitting this off from `policyRecommendationFromUploadEpic` keeps
18
+ * the wizard component a pure renderer: it dispatches
19
+ * `extractPolicyDocument(files, answerId, chatSessionId)` once, then
20
+ * subscribes to `cardPolicyState` lifecycle flags to drive its
21
+ * "Extracting…" / "Recommending…" pill.
22
+ */
23
+ export const policyDocumentExtractionToRecommendationBridgeEpic = (actions$, state$) => actions$.pipe(filter(updatePolicyDocumentExtractionSuccess.match), mergeMap((action) => {
24
+ const extraction = state$.value.cardPolicyState.policyDocumentExtraction;
25
+ const aiCfoAnswerId = extraction.aiCfoAnswerId;
26
+ const aiCfoChatSessionId = extraction.aiCfoChatSessionId;
27
+ const extractedRules = extraction.extractedRules;
28
+ if (aiCfoAnswerId == null ||
29
+ aiCfoChatSessionId == null ||
30
+ extractedRules == null) {
31
+ return EMPTY;
32
+ }
33
+ void action;
34
+ return of(fetchCardPolicyRecommendationFromUpload(aiCfoAnswerId, aiCfoChatSessionId, extractedRules));
35
+ }));
@@ -0,0 +1,101 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap, takeUntil, } from 'rxjs/operators';
3
+ import { createZeniAPIStatus, isSuccessStatus } from '../../responsePayload';
4
+ import { updateAiCardPolicyFormDraftFromUploadPlan } from '../../view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer';
5
+ import { updateAiCfoAnswerCardPolicyWizardPlan } from '../aiCfo/aiCfoReducer';
6
+ import { clearPolicyDocumentExtraction, fetchCardPolicyRecommendationFromUpload, updatePolicyRecommendationFromUploadFailure, updatePolicyRecommendationFromUploadSuccess, } from './cardPolicyReducer';
7
+ /**
8
+ * Listens for `fetchCardPolicyRecommendationFromUpload` and POSTs the
9
+ * just-extracted policy rules to the AI-CFO recommendation endpoint.
10
+ *
11
+ * On success — dispatches BOTH:
12
+ * - `updatePolicyRecommendationFromUploadSuccess` (flips the
13
+ * cardPolicy slice's recommendation lifecycle to `Completed`), and
14
+ * - `updateAiCfoAnswerCardPolicyWizardPlan` (patches the in-flight AI
15
+ * CFO answer's `CardPolicyInitialData` so the wizard can advance from
16
+ * Step 1 → Step 2 in the upload variant).
17
+ *
18
+ * The reducer payload originally captured at kickoff (`answerId` +
19
+ * `chatSessionId`) re-enters via the action so the patch can find the
20
+ * right answer to merge into.
21
+ */
22
+ export const policyRecommendationFromUploadEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyRecommendationFromUpload.match),
23
+ // `switchMap` (vs `mergeMap`) cancels any in-flight recommendation
24
+ // whenever a new upload kicks off another one. Without this an older,
25
+ // slower recommendation response could still resolve after a fresh
26
+ // extract has started — that late response would dispatch
27
+ // `updateAiCfoAnswerCardPolicyWizardPlan` against the *current*
28
+ // `answerId`/`chatSessionId` (the ones captured at its kickoff) and
29
+ // overwrite the wizard plan with stale draft policies from the prior
30
+ // document. Pairs with the matching `switchMap` in
31
+ // `extractPolicyDocumentEpic`.
32
+ switchMap((action) => {
33
+ const { answerId, chatSessionId, extractedRules } = action.payload;
34
+ const body = {
35
+ extracted_rules: {
36
+ allowed_entity: {
37
+ category_codes: extractedRules.allowedEntity.categoryCodes,
38
+ merchant_names: extractedRules.allowedEntity.merchantNames,
39
+ },
40
+ blocked_entity: {
41
+ category_codes: extractedRules.blockedEntity.categoryCodes,
42
+ merchant_names: extractedRules.blockedEntity.merchantNames,
43
+ },
44
+ confidence_score: extractedRules.confidenceScore,
45
+ policy_name: extractedRules.policyName,
46
+ required_receipt_threshold: extractedRules.requiredReceiptThreshold,
47
+ transaction_limit: extractedRules.transactionLimit,
48
+ },
49
+ };
50
+ return zeniAPI
51
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/ai-cfo/policy-recommendation-from-upload`, body)
52
+ .pipe(mergeMap((response) => {
53
+ if (!isSuccessStatus(response) ||
54
+ response.data?.wizard_plan?.step_5_review == null) {
55
+ return of(updatePolicyRecommendationFromUploadFailure(response.status));
56
+ }
57
+ const data = response.data;
58
+ const review = data.wizard_plan.step_5_review;
59
+ const wizardPlan = {
60
+ step5Review: {
61
+ draftPolicies: (review.draft_policies ?? []).map((draft, index) => ({
62
+ id: `draft-${index}`,
63
+ name: draft.name,
64
+ description: draft.description ?? '',
65
+ mode: draft.mode,
66
+ allowedEntity: {
67
+ categoryCodes: draft.allowed_entity?.category_codes ?? [],
68
+ merchantNames: draft.allowed_entity?.merchant_names ?? [],
69
+ },
70
+ blockedEntity: {
71
+ categoryCodes: draft.blocked_entity?.category_codes ?? [],
72
+ merchantNames: draft.blocked_entity?.merchant_names ?? [],
73
+ },
74
+ applyToCards: draft.apply_to_cards ?? [],
75
+ requiredReceiptThreshold: draft.required_receipt_threshold ?? 0,
76
+ spendLimits: {
77
+ transaction: draft.spend_limits?.transaction ?? 0,
78
+ },
79
+ })),
80
+ groupingSource: review.grouping_source ?? 'none',
81
+ prompt: review.prompt ?? '',
82
+ },
83
+ };
84
+ const source = data.source != null
85
+ ? {
86
+ confidenceScore: data.source.confidence_score,
87
+ fileName: data.source.file_name,
88
+ lowConfidenceFields: data.source.low_confidence_fields ?? [],
89
+ }
90
+ : undefined;
91
+ return of(updatePolicyRecommendationFromUploadSuccess(), updateAiCfoAnswerCardPolicyWizardPlan({
92
+ answerId,
93
+ chatSessionId,
94
+ wizardPlan,
95
+ source,
96
+ }), updateAiCardPolicyFormDraftFromUploadPlan(wizardPlan, source));
97
+ }), catchError((error) => of(updatePolicyRecommendationFromUploadFailure(createZeniAPIStatus('Unexpected Error', 'Policy recommendation from upload REST API call errored out' +
98
+ JSON.stringify(error))))),
99
+ // Guards the user-dismissed case that switchMap doesn't cover: a late response would patch a wizard plan the user already cleared.
100
+ takeUntil(actions$.pipe(filter(clearPolicyDocumentExtraction.match))));
101
+ }));
@@ -145,42 +145,49 @@ function toJEScheduleAISummaries(payload) {
145
145
  result.debitAccount = {
146
146
  confidence: payload.debit_account.confidence,
147
147
  reasoning: payload.debit_account.reasoning,
148
+ cot: Array.isArray(payload.debit_account.cot) ? payload.debit_account.cot : undefined,
148
149
  };
149
150
  }
150
151
  if (payload.credit_account != null) {
151
152
  result.creditAccount = {
152
153
  confidence: payload.credit_account.confidence,
153
154
  reasoning: payload.credit_account.reasoning,
155
+ cot: Array.isArray(payload.credit_account.cot) ? payload.credit_account.cot : undefined,
154
156
  };
155
157
  }
156
158
  if (payload.debit_accounting_class != null) {
157
159
  result.debitClass = {
158
160
  confidence: payload.debit_accounting_class.confidence,
159
161
  reasoning: payload.debit_accounting_class.reasoning,
162
+ cot: Array.isArray(payload.debit_accounting_class.cot) ? payload.debit_accounting_class.cot : undefined,
160
163
  };
161
164
  }
162
165
  if (payload.credit_accounting_class != null) {
163
166
  result.creditClass = {
164
167
  confidence: payload.credit_accounting_class.confidence,
165
168
  reasoning: payload.credit_accounting_class.reasoning,
169
+ cot: Array.isArray(payload.credit_accounting_class.cot) ? payload.credit_accounting_class.cot : undefined,
166
170
  };
167
171
  }
168
172
  if (payload.period != null) {
169
173
  result.period = {
170
174
  confidence: payload.period.confidence,
171
175
  reasoning: payload.period.reasoning,
176
+ cot: Array.isArray(payload.period.cot) ? payload.period.cot : undefined,
172
177
  };
173
178
  }
174
179
  if (payload.posting_date != null) {
175
180
  result.postingDate = {
176
181
  confidence: payload.posting_date.confidence,
177
182
  reasoning: payload.posting_date.reasoning,
183
+ cot: Array.isArray(payload.posting_date.cot) ? payload.posting_date.cot : undefined,
178
184
  };
179
185
  }
180
186
  if (payload.schedule_type != null) {
181
187
  result.scheduleType = {
182
188
  confidence: payload.schedule_type.confidence,
183
189
  reasoning: payload.schedule_type.reasoning,
190
+ cot: Array.isArray(payload.schedule_type.cot) ? payload.schedule_type.cot : undefined,
184
191
  };
185
192
  }
186
193
  return Object.keys(result).length > 0 ? result : undefined;
@@ -95,6 +95,9 @@ const ALL_SNACKBAR_MESSAGE_SECTIONS = [
95
95
  'charge_card_receipt_upload',
96
96
  'charge_card_resend_invite',
97
97
  'charge_card_revoke_invite',
98
+ 'card_policy_created',
99
+ 'card_policy_updated',
100
+ 'card_policy_deleted',
98
101
  'charge_card_update_limit',
99
102
  'charge_cards_update_limit',
100
103
  'close_charge_card',
@@ -41,6 +41,8 @@ export const mapTaskPayloadToTask = (payload) => ({
41
41
  dueDate: payload.due_date != null ? date(payload.due_date) : undefined,
42
42
  updateTime: payload.update_time != null ? date(payload.update_time) : undefined,
43
43
  companyId: payload.company_id,
44
+ companyName: payload.company_name,
45
+ parentTaskId: payload.parent_task_id ?? undefined,
44
46
  recurringSourceTaskId: payload.recurring_source_task_id != null
45
47
  ? payload.recurring_source_task_id
46
48
  : undefined,
@@ -85,6 +85,8 @@ import { clearScheduleDetailView } from '../../view/scheduleView/scheduleDetailV
85
85
  import { clearScheduleList } from '../../view/scheduleView/scheduleListView/scheduleListReducer';
86
86
  import { clearSettingsView } from '../../view/settingsView/settingsViewReducer';
87
87
  import { clearAutoTransferRules } from '../../view/spendManagement/autotransferRules/autoTransferRulesReducer';
88
+ import { clearAutoSweepFlow } from '../../view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer';
89
+ import { clearCashManagementOverview } from '../../view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer';
88
90
  import { clearBillDetailView } from '../../view/spendManagement/billPay/billDetailView/billDetailViewReducer';
89
91
  import { clearBillList } from '../../view/spendManagement/billPay/billList/billListReducer';
90
92
  import { clearBillPayConfig } from '../../view/spendManagement/billPay/billPayConfig/billPayConfigReducer';
@@ -97,6 +99,9 @@ import { clearInternationalWire } from '../../view/spendManagement/billPay/inter
97
99
  import { clearInternationalVerificationView } from '../../view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer';
98
100
  import { clearPreviousBills } from '../../view/spendManagement/billPay/previousBills/previousBillsReducer';
99
101
  import { clearWiseRedirectStatus } from '../../view/spendManagement/billPay/wiseRedirectView/wiseRedirectReducer';
102
+ import { clearCardPolicyDetail } from '../../view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer';
103
+ import { clearCardPolicyList } from '../../view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer';
104
+ import { clearCreateCardPolicy } from '../../view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer';
100
105
  import { clearCardUserOnboarding } from '../../view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer';
101
106
  import { clearCashbackDetail } from '../../view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer';
102
107
  import { clearChargeCardConfig } from '../../view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer';
@@ -168,6 +173,7 @@ import { clearAllBillTransactions } from '../billPay/billTransaction/billTransac
168
173
  import { clearContacts } from '../billPay/contact/contactReducer';
169
174
  import { clearAllRecurringBills } from '../billPay/recurringBills/recurringBillsReducer';
170
175
  import { clearAllCardPayments } from '../cardPayment/cardPaymentReducer';
176
+ import { clearCardPolicy } from '../cardPolicy/cardPolicyReducer';
171
177
  import { clearAllChargeCards } from '../chargeCard/chargeCardReducer';
172
178
  import { clearAllChargeCardRepayments } from '../chargeCardRepayment/chargeCardRepaymentReducer';
173
179
  import { clearAllChargeCardTransactions } from '../chargeCardTransaction/chargeCardTransactionReducer';
@@ -231,6 +237,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
231
237
  clearArAging(),
232
238
  clearArAgingDetail(),
233
239
  clearAuthenticationView(),
240
+ clearAutoSweepFlow(),
234
241
  clearAutoTransferRules(),
235
242
  clearBalanceSheet(),
236
243
  clearBankAccountView(),
@@ -244,11 +251,14 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
244
251
  clearBillPaySetupView(),
245
252
  clearCardBalance(),
246
253
  clearCardPaymentView(),
254
+ clearCardPolicyDetail(),
255
+ clearCardPolicyList(),
247
256
  clearCardUserOnboarding(),
248
257
  clearCashbackDetail(),
249
258
  clearCashBalance(),
250
259
  clearCashFlow(),
251
260
  clearCashInCashOut(),
261
+ clearCashManagementOverview(),
252
262
  clearCashPosition(),
253
263
  clearChargeCardConfig(),
254
264
  clearChargeCardDetail(),
@@ -263,6 +273,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
263
273
  clearCompanyMonthEndReportView(),
264
274
  clearCompanyTaskManagerView(),
265
275
  clearCompanyView(),
276
+ clearCreateCardPolicy(),
266
277
  clearCreateTransferEntry(),
267
278
  clearAllCreditAgent(),
268
279
  clearCreditAgentView(),
@@ -424,6 +435,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
424
435
  clearAllVendorExpenseTrends(),
425
436
  clearAllVendors(),
426
437
  clearCannedResponses(),
438
+ clearCardPolicy(),
427
439
  clearClassList(),
428
440
  clearContacts(),
429
441
  clearCountryList(),