@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
@@ -9,9 +9,13 @@ export interface AiCfoAnswerParagraph {
9
9
  }>;
10
10
  }
11
11
  export declare const ALL_AI_CFO_CHARTS_TYPES: readonly ["bar_chart", "pie_chart", "line_chart"];
12
- export declare const ALL_AI_CFO_VISUALIZATION_TYPES: readonly ["bar_chart", "pie_chart", "line_chart", "table"];
13
- export declare const toAiCfoVisualizationType: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table";
14
- export declare const toAiCfoVisualizationTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | undefined;
12
+ export declare const ALL_AI_CFO_VISUALIZATION_TYPES: readonly ["bar_chart", "pie_chart", "line_chart", "table", "interactive_form"];
13
+ export declare const ALL_INTERACTIVE_FORM_TYPES: readonly ["cards_creation", "card_policy"];
14
+ export declare const toInteractiveFormType: (v: string) => "cards_creation" | "card_policy";
15
+ export declare const toInteractiveFormTypeStrict: (v: string) => "cards_creation" | "card_policy" | undefined;
16
+ export type InteractiveFormType = ReturnType<typeof toInteractiveFormType>;
17
+ export declare const toAiCfoVisualizationType: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | "interactive_form";
18
+ export declare const toAiCfoVisualizationTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | "interactive_form" | undefined;
15
19
  export type AiCfoVisualizationType = ReturnType<typeof toAiCfoVisualizationType>;
16
20
  export declare const toAiCfoChartType: (v: string) => "bar_chart" | "pie_chart" | "line_chart";
17
21
  export declare const toAiCfoChartTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | undefined;
@@ -53,8 +57,87 @@ export interface ChartVisualization {
53
57
  lines?: string[];
54
58
  yFormat?: YFormat;
55
59
  }
60
+ export type CardsCardKind = 'vendor' | 'class' | 'category';
61
+ export interface CardNameOption {
62
+ id: string;
63
+ kind: CardsCardKind;
64
+ label: string;
65
+ }
66
+ export interface CardsCreationCommonData {
67
+ cardNameOptions: CardNameOption[];
68
+ suggestedOwnerUserIdByTeamId: Record<string, ID | undefined>;
69
+ }
70
+ export type CardsCreationInitialData = (CardsCreationCommonData & {
71
+ mode: 'review';
72
+ teamRows: Array<{
73
+ avgMonthlySpend: string;
74
+ cardKind: CardsCardKind;
75
+ id: string;
76
+ label: string;
77
+ recommendedLimit: string;
78
+ recommendedLimitCadence?: string;
79
+ }>;
80
+ }) | (CardsCreationCommonData & {
81
+ cardRows: Array<{
82
+ cardKind: CardsCardKind;
83
+ id: string;
84
+ label: string;
85
+ recommendedLimit?: number;
86
+ suggestedOwnerUserId?: ID;
87
+ }>;
88
+ mode: 'create';
89
+ });
90
+ export interface CardPolicyDraftPolicyEntity {
91
+ categoryCodes: string[];
92
+ merchantNames: string[];
93
+ }
94
+ export interface CardPolicySpendLimits {
95
+ transaction: number;
96
+ }
97
+ export interface CardPolicyDraftPolicy {
98
+ allowedEntity: CardPolicyDraftPolicyEntity;
99
+ applyToCards: string[];
100
+ blockedEntity: CardPolicyDraftPolicyEntity;
101
+ description: string;
102
+ id: string;
103
+ mode: string;
104
+ name: string;
105
+ requiredReceiptThreshold: number;
106
+ spendLimits: CardPolicySpendLimits;
107
+ }
108
+ export interface CardPolicyStep5Review {
109
+ draftPolicies: CardPolicyDraftPolicy[];
110
+ groupingSource: string;
111
+ prompt: string;
112
+ }
113
+ export interface CardPolicyWizardPlan {
114
+ step5Review: CardPolicyStep5Review;
115
+ }
116
+ export interface CardPolicyUploadSource {
117
+ confidenceScore: number;
118
+ fileName: string;
119
+ lowConfidenceFields: string[];
120
+ }
121
+ export type CardPolicyInitialData = {
122
+ policyKind: 'auto';
123
+ wizardPlan: CardPolicyWizardPlan;
124
+ } | {
125
+ policyKind: 'guided';
126
+ wizardPlan: CardPolicyWizardPlan;
127
+ } | {
128
+ policyKind: 'upload';
129
+ source?: CardPolicyUploadSource;
130
+ wizardPlan?: CardPolicyWizardPlan;
131
+ };
132
+ export type InteractiveFormVisualization = {
133
+ formType: 'cards_creation';
134
+ payload: CardsCreationInitialData;
135
+ } | {
136
+ formType: 'card_policy';
137
+ payload: CardPolicyInitialData;
138
+ };
56
139
  export interface AiCfoVisualization {
57
- data: TableVisualization | ChartVisualization;
140
+ data: TableVisualization | ChartVisualization | InteractiveFormVisualization;
58
141
  type: AiCfoVisualizationType;
59
142
  }
60
143
  export declare const toMessageSender: (v: string) => "user" | "agent";
@@ -113,7 +196,17 @@ export interface ChatSessionWithMessages {
113
196
  chatSession: ChatSession;
114
197
  questionAnswers: AiCfoQuestionWithAnswer[];
115
198
  }
199
+ export declare const ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS: readonly ["creating_cards", "creating_policy", "created_cards", "created_policy"];
200
+ export type SyntheticAiCfoAnswerKind = (typeof ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS)[number];
201
+ export interface SyntheticAiCfoAnswer {
202
+ createdAt: ZeniDate;
203
+ entityIds: ID[];
204
+ id: ID;
205
+ kind: SyntheticAiCfoAnswerKind;
206
+ sourceQuestionAnswerId: ID;
207
+ }
116
208
  export interface AiCfoState {
117
209
  aiCfoByChatSessionId: Record<ID, ChatSessionWithMessages>;
118
210
  partialQuestionAnswers: Record<ID, AiCfoQuestionWithAnswer | undefined>;
211
+ syntheticAnswersByChatSessionId: Record<ID, SyntheticAiCfoAnswer[]>;
119
212
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toMessageTypeStrict = exports.toMessageSenderStrict = exports.toMessageType = exports.toMessageSender = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateType = exports.toYFormatScaleStrict = exports.toYFormatUnitStrict = exports.toYFormatTypeStrict = exports.toYFormatScale = exports.toYFormatUnit = exports.toYFormatType = exports.ALL_Y_FORMAT_SCALES = exports.ALL_Y_FORMAT_NON_CURRENCY_UNITS = exports.ALL_Y_FORMAT_TYPES = exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CFO_ANSWER_STATE_TYPES = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = exports.toAiCfoVisualizationType = exports.ALL_AI_CFO_VISUALIZATION_TYPES = exports.ALL_AI_CFO_CHARTS_TYPES = void 0;
3
+ exports.ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS = exports.toMessageTypeStrict = exports.toMessageSenderStrict = exports.toMessageType = exports.toMessageSender = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateType = exports.toYFormatScaleStrict = exports.toYFormatUnitStrict = exports.toYFormatTypeStrict = exports.toYFormatScale = exports.toYFormatUnit = exports.toYFormatType = exports.ALL_Y_FORMAT_SCALES = exports.ALL_Y_FORMAT_NON_CURRENCY_UNITS = exports.ALL_Y_FORMAT_TYPES = exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CFO_ANSWER_STATE_TYPES = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = exports.toAiCfoVisualizationType = exports.toInteractiveFormTypeStrict = exports.toInteractiveFormType = exports.ALL_INTERACTIVE_FORM_TYPES = exports.ALL_AI_CFO_VISUALIZATION_TYPES = exports.ALL_AI_CFO_CHARTS_TYPES = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
5
  exports.ALL_AI_CFO_CHARTS_TYPES = [
6
6
  'bar_chart',
@@ -10,7 +10,16 @@ exports.ALL_AI_CFO_CHARTS_TYPES = [
10
10
  exports.ALL_AI_CFO_VISUALIZATION_TYPES = [
11
11
  ...exports.ALL_AI_CFO_CHARTS_TYPES,
12
12
  'table',
13
+ 'interactive_form',
13
14
  ];
15
+ exports.ALL_INTERACTIVE_FORM_TYPES = [
16
+ 'cards_creation',
17
+ 'card_policy',
18
+ ];
19
+ const toInteractiveFormType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INTERACTIVE_FORM_TYPES);
20
+ exports.toInteractiveFormType = toInteractiveFormType;
21
+ const toInteractiveFormTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_INTERACTIVE_FORM_TYPES);
22
+ exports.toInteractiveFormTypeStrict = toInteractiveFormTypeStrict;
14
23
  const toAiCfoVisualizationType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_AI_CFO_VISUALIZATION_TYPES);
15
24
  exports.toAiCfoVisualizationType = toAiCfoVisualizationType;
16
25
  const toAiCfoVisualizationTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_AI_CFO_VISUALIZATION_TYPES);
@@ -79,3 +88,11 @@ const toMessageSenderStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v,
79
88
  exports.toMessageSenderStrict = toMessageSenderStrict;
80
89
  const toMessageTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, ALL_MESSAGE_TYPES);
81
90
  exports.toMessageTypeStrict = toMessageTypeStrict;
91
+ // Client-synthesized AI CFO answer bubbles (Creating…/Created) pushed when the user
92
+ // submits an interactive form; not streamed from the backend.
93
+ exports.ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS = [
94
+ 'creating_cards',
95
+ 'creating_policy',
96
+ 'created_cards',
97
+ 'created_policy',
98
+ ];
@@ -0,0 +1,277 @@
1
+ import { ID } from '../../commonStateTypes/common';
2
+ import { ZeniAPIResponse } from '../../responsePayload';
3
+ import { CardPolicyStats, CardPolicyTemplate, CardPolicyTemplateEntityList, CardPolicyTemplateMode, CardPolicyTemplateSpendLimits, ExtractedCardPolicyRules, MccCategory } from './cardPolicyState';
4
+ export interface MccCategoryPayload {
5
+ count: number;
6
+ mcc_codes: string[];
7
+ name: string;
8
+ }
9
+ /**
10
+ * Wire shape for `GET /cards/1.0/cards/mcc-codes`. Beyond the universe of
11
+ * MCC categories used to populate the category search dropdown, the
12
+ * endpoint also ships **suggested** allow / block merchants and categories
13
+ * that the chip-pickers seed into their cloud body before the user starts
14
+ * editing.
15
+ *
16
+ * Field spellings (`*_catagories`) preserve the BE wire format verbatim;
17
+ * the camelCase mapper below corrects to `Categories`.
18
+ */
19
+ export interface CardPolicyMccCategoriesPayload {
20
+ categories: MccCategoryPayload[];
21
+ suggested_allow_catagories?: MccCategoryPayload[];
22
+ suggested_allow_merchants?: string[];
23
+ suggested_block_catagories?: MccCategoryPayload[];
24
+ suggested_block_merchants?: string[];
25
+ }
26
+ export type CardPolicyMccCategoriesResponse = ZeniAPIResponse<CardPolicyMccCategoriesPayload>;
27
+ export declare const toMccCategory: (payload: MccCategoryPayload) => MccCategory;
28
+ /**
29
+ * Vendor row returned by `/accounting/1.0/vendors`. The card-policy
30
+ * vendor search dropdown only needs `vendor_id` + `vendor_name`; we
31
+ * deliberately ignore the rest of the payload to keep this slice
32
+ * independent of the heavy `vendor` entity store.
33
+ */
34
+ export interface CardPolicyVendorSearchVendorPayload {
35
+ vendor_id: string;
36
+ vendor_name: string;
37
+ }
38
+ export interface CardPolicyVendorSearchData {
39
+ vendors: CardPolicyVendorSearchVendorPayload[];
40
+ }
41
+ export type CardPolicyVendorSearchResponse = ZeniAPIResponse<CardPolicyVendorSearchData>;
42
+ export interface CardPolicyVendorSearchOption {
43
+ name: string;
44
+ vendorId: string;
45
+ }
46
+ export declare const toCardPolicyVendorSearchOption: (payload: CardPolicyVendorSearchVendorPayload) => CardPolicyVendorSearchOption;
47
+ interface CardPolicyTemplateEntityListPayload {
48
+ category_codes: string[];
49
+ merchant_names: string[];
50
+ }
51
+ interface CardPolicyTemplateSpendLimitsPayload {
52
+ transaction: number | null;
53
+ }
54
+ /**
55
+ * Per-template request shape. `POST /cards/1.0/policy-templates` now
56
+ * accepts a bulk wrapper (`CreateCardPolicyTemplatesRequest`); this
57
+ * interface describes a single entry inside the `templates` array.
58
+ *
59
+ * `PUT /cards/1.0/policy-templates/{id}` (update) still consumes this
60
+ * shape directly — see `UpdateCardPolicyTemplateRequest` below.
61
+ */
62
+ export interface CreateCardPolicyTemplateRequest {
63
+ allowedEntity: CardPolicyTemplateEntityList;
64
+ applyToCards: ID[];
65
+ blockedEntity: CardPolicyTemplateEntityList;
66
+ description: string;
67
+ mode: CardPolicyTemplateMode;
68
+ name: string;
69
+ /**
70
+ * `null` indicates the require-receipt toggle is off (no threshold
71
+ * configured). The BE accepts `null` and treats it as "no requirement";
72
+ * `0` means the user explicitly entered zero with the toggle on.
73
+ */
74
+ requiredReceiptThreshold: number | null;
75
+ spendLimits: CardPolicyTemplateSpendLimits;
76
+ }
77
+ export interface CreateCardPolicyTemplateRequestBody {
78
+ allowed_entity: CardPolicyTemplateEntityListPayload;
79
+ apply_to_cards: ID[];
80
+ blocked_entity: CardPolicyTemplateEntityListPayload;
81
+ description: string;
82
+ mode: string;
83
+ name: string;
84
+ required_receipt_threshold: number | null;
85
+ spend_limits: CardPolicyTemplateSpendLimitsPayload;
86
+ }
87
+ /**
88
+ * Bulk request for `POST /cards/1.0/policy-templates`. The single-policy
89
+ * create flow wraps its one request in a length-1 `templates` array;
90
+ * future multi-policy submit (AI CFO review step) sends N entries in a
91
+ * single round-trip.
92
+ *
93
+ * `sourceChatSessionId` ties the submit back to an AI CFO chat session so
94
+ * the BE can attribute the created templates to it. Manual create-page
95
+ * callers omit it.
96
+ */
97
+ export interface CreateCardPolicyTemplatesRequest {
98
+ templates: CreateCardPolicyTemplateRequest[];
99
+ sourceChatSessionId?: string;
100
+ }
101
+ export interface CreateCardPolicyTemplatesRequestBody {
102
+ templates: CreateCardPolicyTemplateRequestBody[];
103
+ source_chat_session_id?: string;
104
+ }
105
+ export interface CardPolicyTemplatePayload {
106
+ allowed_entity: CardPolicyTemplateEntityListPayload;
107
+ applied_cards: ID[];
108
+ blocked_entity: CardPolicyTemplateEntityListPayload;
109
+ cards_count: number;
110
+ category_restrictions: unknown[];
111
+ created_at: string;
112
+ created_by: ID;
113
+ description: string;
114
+ mode: string;
115
+ name: string;
116
+ required_receipt_threshold: number | null;
117
+ spend_limits: CardPolicyTemplateSpendLimitsPayload;
118
+ status: string;
119
+ template_id: ID;
120
+ tenant_id: ID;
121
+ updated_at: string;
122
+ }
123
+ /**
124
+ * Per-template response envelope. Still returned by `PUT /policy-templates/{id}`,
125
+ * `GET /policy-templates/{id}`, and (as the row payload) the list endpoint.
126
+ * Also nested inside `CreateCardPolicyTemplatesResponseData.templates_created`.
127
+ */
128
+ export interface CreateCardPolicyTemplateResponseData {
129
+ cards_applied: number;
130
+ template: CardPolicyTemplatePayload;
131
+ }
132
+ export type CreateCardPolicyTemplateResponse = ZeniAPIResponse<CreateCardPolicyTemplateResponseData>;
133
+ /**
134
+ * Per-item error returned by the bulk POST when one or more templates in
135
+ * the request fail validation / persistence. The exact field shape is
136
+ * **TBD** with the BE — `message` is the only guaranteed field today; the
137
+ * rest are best-effort placeholders that callers should not assume to be
138
+ * present.
139
+ *
140
+ * TODO: lock down the shape (`index`, `name`, `code`) once the BE
141
+ * documents it. See plan §"Open question to resolve with BE".
142
+ */
143
+ export interface BulkCreateCardPolicyTemplateErrorPayload {
144
+ message: string;
145
+ code?: string;
146
+ index?: number;
147
+ name?: string;
148
+ }
149
+ /**
150
+ * Wire shape returned by the bulk `POST /cards/1.0/policy-templates`.
151
+ * Partial success is allowed — `templates_created` holds the successfully
152
+ * created rows (each in the same envelope as the single endpoint), and
153
+ * `errors` holds per-item failures for the rest. `status.message` follows
154
+ * the "N of M templates created" convention.
155
+ */
156
+ export interface CreateCardPolicyTemplatesResponseData {
157
+ errors: BulkCreateCardPolicyTemplateErrorPayload[];
158
+ templates_created: CreateCardPolicyTemplateResponseData[];
159
+ }
160
+ export type CreateCardPolicyTemplatesResponse = ZeniAPIResponse<CreateCardPolicyTemplatesResponseData>;
161
+ /**
162
+ * Camel-cased mirror of `BulkCreateCardPolicyTemplateErrorPayload` stored
163
+ * on the create-card-policy view slice so the UI can render a partial-success
164
+ * banner without re-touching the wire types.
165
+ */
166
+ export interface BulkCreateCardPolicyTemplateError {
167
+ message: string;
168
+ code?: string;
169
+ index?: number;
170
+ name?: string;
171
+ }
172
+ export type UpdateCardPolicyTemplateRequest = CreateCardPolicyTemplateRequest;
173
+ export type UpdateCardPolicyTemplateRequestBody = CreateCardPolicyTemplateRequestBody;
174
+ export type UpdateCardPolicyTemplateResponseData = CreateCardPolicyTemplateResponseData;
175
+ export type UpdateCardPolicyTemplateResponse = CreateCardPolicyTemplateResponse;
176
+ export type CardPolicyDetailResponseData = CreateCardPolicyTemplateResponseData;
177
+ export type CardPolicyDetailResponse = CreateCardPolicyTemplateResponse;
178
+ /**
179
+ * Aggregate counters returned alongside the templates list. Stored on
180
+ * the entity slice (alongside `cardPolicyTemplateById`) so any list
181
+ * surface can read it without re-fetching.
182
+ */
183
+ export interface CardPolicyStatsPayload {
184
+ active_policies: number;
185
+ total_cards: number;
186
+ total_templates: number;
187
+ }
188
+ /**
189
+ * Each list row is wrapped in the same `{cards_applied, template}`
190
+ * envelope the create endpoint returns. Only the `template` portion is
191
+ * stored on the entity slice; `cards_applied` is a one-shot summary
192
+ * carried over from create and not surfaced in the list state today.
193
+ */
194
+ export interface CardPolicyListRowPayload {
195
+ data: CreateCardPolicyTemplateResponseData;
196
+ }
197
+ export interface ListCardPolicyTemplatesResponseData {
198
+ stats: CardPolicyStatsPayload;
199
+ templates: CardPolicyListRowPayload[];
200
+ }
201
+ export type ListCardPolicyTemplatesResponse = ZeniAPIResponse<ListCardPolicyTemplatesResponseData>;
202
+ export declare const toCardPolicyStats: (payload: CardPolicyStatsPayload) => CardPolicyStats;
203
+ export declare const toCardPolicyTemplateList: (data: ListCardPolicyTemplatesResponseData) => CardPolicyTemplate[];
204
+ export declare const toCardPolicyTemplate: (payload: CardPolicyTemplatePayload) => CardPolicyTemplate;
205
+ /**
206
+ * Re-shape a single camelCase create request into the snake_case wire
207
+ * body. Used by the bulk-create mapper to build each entry of the
208
+ * `templates` array, and directly by the update epic (PUT) since the
209
+ * update endpoint still consumes a single object.
210
+ */
211
+ export declare const toCreateCardPolicyTemplateRequestBody: (request: CreateCardPolicyTemplateRequest) => CreateCardPolicyTemplateRequestBody;
212
+ /**
213
+ * Re-shape a bulk create request into the snake_case wire body for
214
+ * `POST /cards/1.0/policy-templates`. Maps each entry through
215
+ * `toCreateCardPolicyTemplateRequestBody` and only emits
216
+ * `source_chat_session_id` when the camelCase counterpart is defined,
217
+ * so manual-create callers don't ship a stray `undefined` over the wire.
218
+ */
219
+ export declare const toCreateCardPolicyTemplatesRequestBody: (request: CreateCardPolicyTemplatesRequest) => CreateCardPolicyTemplatesRequestBody;
220
+ /**
221
+ * Map a single bulk-response error payload to its camelCased view shape.
222
+ * Defensive against missing optional fields (see `BulkCreateCardPolicyTemplateErrorPayload`
223
+ * docstring — the BE contract isn't fully locked yet).
224
+ */
225
+ export declare const toBulkCreateCardPolicyTemplateError: (payload: BulkCreateCardPolicyTemplateErrorPayload) => BulkCreateCardPolicyTemplateError;
226
+ export declare const toUpdateCardPolicyTemplateRequestBody: (request: CreateCardPolicyTemplateRequest) => CreateCardPolicyTemplateRequestBody;
227
+ /**
228
+ * Seed an edit-form draft (`CreateCardPolicyTemplateRequest`) from an
229
+ * existing camelCased `CardPolicyTemplate`. Used by the detail-fetch
230
+ * epic so the edit page can render with the saved values pre-populated.
231
+ */
232
+ export declare const toCardPolicyEditFormDraft: (template: CardPolicyTemplate) => CreateCardPolicyTemplateRequest;
233
+ /**
234
+ * Wire shape returned by `POST /cards/1.0/policy-documents/extract`.
235
+ * The backend OCRs / parses an uploaded policy document (PDF, image, etc.)
236
+ * and returns a best-effort set of policy rules + a confidence score.
237
+ *
238
+ * Consumers (manual `CardPolicyCreatePage` + AI CFO `CardPolicyInteractiveForm`)
239
+ * use `toExtractedCardPolicyRules` to map this onto the camelCase FE shape
240
+ * and then feed the result through `applyExtractedPolicyRulesToFormValues`
241
+ * (`@zeniai/web-components`) to seed the RHF form.
242
+ */
243
+ export interface ExtractedCardPolicyRulesPayload {
244
+ allowed_entity: CardPolicyTemplateEntityListPayload;
245
+ blocked_entity: CardPolicyTemplateEntityListPayload;
246
+ confidence_score: number;
247
+ policy_name: string;
248
+ required_receipt_threshold: number;
249
+ transaction_limit: number;
250
+ }
251
+ export interface PolicyDocumentExtractResponseData {
252
+ extracted_rules: ExtractedCardPolicyRulesPayload;
253
+ message: string;
254
+ }
255
+ export type PolicyDocumentExtractResponse = ZeniAPIResponse<PolicyDocumentExtractResponseData>;
256
+ export declare const toExtractedCardPolicyRules: (payload: ExtractedCardPolicyRulesPayload) => ExtractedCardPolicyRules;
257
+ /**
258
+ * Wire shape returned by `POST /cards/1.0/ai-cfo/policy-recommendation-from-upload`.
259
+ * Chained after `extractPolicyDocument` succeeds in the AI CFO `upload`
260
+ * flow: the FE forwards the just-returned `extracted_rules` and the BE
261
+ * synthesizes a wizard plan + upload source metadata.
262
+ *
263
+ * The response mirrors the same `mode`-discriminated envelope the
264
+ * controller API ships for `auto` / `guided`, but always with `mode:
265
+ * "upload"` and a populated `wizard_plan.step_5_review`. The FE merges
266
+ * the returned `wizard_plan` + `source` into the in-flight AI CFO
267
+ * answer's `CardPolicyInitialData` via
268
+ * `updateAiCfoAnswerCardPolicyWizardPlan`.
269
+ */
270
+ export interface CardPolicyRecommendationFromUploadResponseData {
271
+ mode: 'upload';
272
+ source: import('../aiCfo/aiCfoPayload').CardPolicyUploadSourcePayload;
273
+ tenant_id: string;
274
+ wizard_plan: import('../aiCfo/aiCfoPayload').CardPolicyWizardPlanPayload;
275
+ }
276
+ export type CardPolicyRecommendationFromUploadResponse = ZeniAPIResponse<CardPolicyRecommendationFromUploadResponseData>;
277
+ export {};
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toExtractedCardPolicyRules = exports.toCardPolicyEditFormDraft = exports.toUpdateCardPolicyTemplateRequestBody = exports.toBulkCreateCardPolicyTemplateError = exports.toCreateCardPolicyTemplatesRequestBody = exports.toCreateCardPolicyTemplateRequestBody = exports.toCardPolicyTemplate = exports.toCardPolicyTemplateList = exports.toCardPolicyStats = exports.toCardPolicyVendorSearchOption = exports.toMccCategory = void 0;
4
+ const zeniDayJS_1 = require("../../zeniDayJS");
5
+ const cardPolicyState_1 = require("./cardPolicyState");
6
+ const toMccCategory = (payload) => ({
7
+ count: payload.count,
8
+ mccCodes: payload.mcc_codes ?? [],
9
+ name: payload.name,
10
+ });
11
+ exports.toMccCategory = toMccCategory;
12
+ const toCardPolicyVendorSearchOption = (payload) => ({
13
+ vendorId: payload.vendor_id,
14
+ name: payload.vendor_name,
15
+ });
16
+ exports.toCardPolicyVendorSearchOption = toCardPolicyVendorSearchOption;
17
+ const toCardPolicyStats = (payload) => ({
18
+ activePolicies: payload.active_policies,
19
+ totalCards: payload.total_cards,
20
+ totalTemplates: payload.total_templates,
21
+ });
22
+ exports.toCardPolicyStats = toCardPolicyStats;
23
+ const toCardPolicyTemplateList = (data) => (data.templates ?? []).map((row) => (0, exports.toCardPolicyTemplate)(row.data.template));
24
+ exports.toCardPolicyTemplateList = toCardPolicyTemplateList;
25
+ const toCardPolicyTemplateEntityList = (payload) => ({
26
+ categoryCodes: payload.category_codes ?? [],
27
+ merchantNames: payload.merchant_names ?? [],
28
+ });
29
+ const toCardPolicyTemplate = (payload) => ({
30
+ allowedEntity: toCardPolicyTemplateEntityList(payload.allowed_entity),
31
+ appliedCards: payload.applied_cards ?? [],
32
+ blockedEntity: toCardPolicyTemplateEntityList(payload.blocked_entity),
33
+ cardsCount: payload.cards_count,
34
+ categoryRestrictions: payload.category_restrictions ?? [],
35
+ createdAt: (0, zeniDayJS_1.date)(payload.created_at),
36
+ createdBy: payload.created_by,
37
+ description: payload.description,
38
+ mode: (0, cardPolicyState_1.toCardPolicyTemplateMode)(payload.mode),
39
+ name: payload.name,
40
+ requiredReceiptThreshold: payload.required_receipt_threshold,
41
+ spendLimits: {
42
+ transaction: payload.spend_limits.transaction,
43
+ },
44
+ status: (0, cardPolicyState_1.toCardPolicyTemplateStatus)(payload.status),
45
+ templateId: payload.template_id,
46
+ tenantId: payload.tenant_id,
47
+ updatedAt: (0, zeniDayJS_1.date)(payload.updated_at),
48
+ });
49
+ exports.toCardPolicyTemplate = toCardPolicyTemplate;
50
+ /**
51
+ * Re-shape a single camelCase create request into the snake_case wire
52
+ * body. Used by the bulk-create mapper to build each entry of the
53
+ * `templates` array, and directly by the update epic (PUT) since the
54
+ * update endpoint still consumes a single object.
55
+ */
56
+ const toCreateCardPolicyTemplateRequestBody = (request) => ({
57
+ allowed_entity: {
58
+ category_codes: request.allowedEntity.categoryCodes,
59
+ merchant_names: request.allowedEntity.merchantNames,
60
+ },
61
+ apply_to_cards: request.applyToCards,
62
+ blocked_entity: {
63
+ category_codes: request.blockedEntity.categoryCodes,
64
+ merchant_names: request.blockedEntity.merchantNames,
65
+ },
66
+ description: request.description,
67
+ mode: request.mode ?? 'strict',
68
+ name: request.name,
69
+ required_receipt_threshold: request.requiredReceiptThreshold,
70
+ spend_limits: {
71
+ transaction: request.spendLimits.transaction,
72
+ },
73
+ });
74
+ exports.toCreateCardPolicyTemplateRequestBody = toCreateCardPolicyTemplateRequestBody;
75
+ /**
76
+ * Re-shape a bulk create request into the snake_case wire body for
77
+ * `POST /cards/1.0/policy-templates`. Maps each entry through
78
+ * `toCreateCardPolicyTemplateRequestBody` and only emits
79
+ * `source_chat_session_id` when the camelCase counterpart is defined,
80
+ * so manual-create callers don't ship a stray `undefined` over the wire.
81
+ */
82
+ const toCreateCardPolicyTemplatesRequestBody = (request) => {
83
+ const body = {
84
+ templates: request.templates.map(exports.toCreateCardPolicyTemplateRequestBody),
85
+ };
86
+ if (request.sourceChatSessionId != null) {
87
+ body.source_chat_session_id = request.sourceChatSessionId;
88
+ }
89
+ return body;
90
+ };
91
+ exports.toCreateCardPolicyTemplatesRequestBody = toCreateCardPolicyTemplatesRequestBody;
92
+ /**
93
+ * Map a single bulk-response error payload to its camelCased view shape.
94
+ * Defensive against missing optional fields (see `BulkCreateCardPolicyTemplateErrorPayload`
95
+ * docstring — the BE contract isn't fully locked yet).
96
+ */
97
+ const toBulkCreateCardPolicyTemplateError = (payload) => ({
98
+ message: payload.message,
99
+ code: payload.code,
100
+ index: payload.index,
101
+ name: payload.name,
102
+ });
103
+ exports.toBulkCreateCardPolicyTemplateError = toBulkCreateCardPolicyTemplateError;
104
+ // Update body uses the exact same wire shape as create — the PUT
105
+ // endpoint is a full replace and was not affected by the bulk migration.
106
+ exports.toUpdateCardPolicyTemplateRequestBody = exports.toCreateCardPolicyTemplateRequestBody;
107
+ /**
108
+ * Seed an edit-form draft (`CreateCardPolicyTemplateRequest`) from an
109
+ * existing camelCased `CardPolicyTemplate`. Used by the detail-fetch
110
+ * epic so the edit page can render with the saved values pre-populated.
111
+ */
112
+ const toCardPolicyEditFormDraft = (template) => ({
113
+ allowedEntity: {
114
+ categoryCodes: [...template.allowedEntity.categoryCodes],
115
+ merchantNames: [...template.allowedEntity.merchantNames],
116
+ },
117
+ applyToCards: [...template.appliedCards],
118
+ blockedEntity: {
119
+ categoryCodes: [...template.blockedEntity.categoryCodes],
120
+ merchantNames: [...template.blockedEntity.merchantNames],
121
+ },
122
+ description: template.description,
123
+ mode: template.mode,
124
+ name: template.name,
125
+ requiredReceiptThreshold: template.requiredReceiptThreshold,
126
+ spendLimits: { transaction: template.spendLimits.transaction },
127
+ });
128
+ exports.toCardPolicyEditFormDraft = toCardPolicyEditFormDraft;
129
+ const toExtractedCardPolicyRules = (payload) => ({
130
+ allowedEntity: {
131
+ categoryCodes: payload.allowed_entity?.category_codes ?? [],
132
+ merchantNames: payload.allowed_entity?.merchant_names ?? [],
133
+ },
134
+ blockedEntity: {
135
+ categoryCodes: payload.blocked_entity?.category_codes ?? [],
136
+ merchantNames: payload.blocked_entity?.merchant_names ?? [],
137
+ },
138
+ confidenceScore: payload.confidence_score,
139
+ policyName: payload.policy_name,
140
+ requiredReceiptThreshold: payload.required_receipt_threshold,
141
+ transactionLimit: payload.transaction_limit,
142
+ });
143
+ exports.toExtractedCardPolicyRules = toExtractedCardPolicyRules;
@@ -0,0 +1,19 @@
1
+ import { ZeniAPIStatus } from '../../responsePayload';
2
+ import { CardPolicyMccCategoriesPayload, CardPolicyTemplatePayload, CardPolicyVendorSearchData, ExtractedCardPolicyRulesPayload } from './cardPolicyPayload';
3
+ import { CardPolicyState, CardPolicyStats, CardPolicyTemplate, ExtractedCardPolicyRules } from './cardPolicyState';
4
+ export declare const initialState: CardPolicyState;
5
+ export declare const fetchCardPolicyMccCategories: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardPolicy/fetchCardPolicyMccCategories">, fetchCardPolicyVendorOptions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[searchString?: string | undefined], {
6
+ searchString: string;
7
+ }, "cardPolicy/fetchCardPolicyVendorOptions", never, never>, updateCardPolicyMccCategories: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardPolicyMccCategoriesPayload, "cardPolicy/updateCardPolicyMccCategories">, updateCardPolicyMccCategoriesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cardPolicy/updateCardPolicyMccCategoriesFailure">, updateCardPolicyVendorOptions: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardPolicyVendorSearchData, "cardPolicy/updateCardPolicyVendorOptions">, updateCardPolicyVendorOptionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cardPolicy/updateCardPolicyVendorOptionsFailure">, updateCreatedCardPolicyTemplate: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardPolicyTemplatePayload, "cardPolicy/updateCreatedCardPolicyTemplate">, updateCardPolicyTemplates: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardPolicyTemplate[], "cardPolicy/updateCardPolicyTemplates">, removeCardPolicyTemplate: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "cardPolicy/removeCardPolicyTemplate">, updateCardPolicyStats: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardPolicyStats, "cardPolicy/updateCardPolicyStats">, extractPolicyDocument: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[files: File[], aiCfoAnswerId?: string | undefined, aiCfoChatSessionId?: string | undefined], {
8
+ files: File[];
9
+ aiCfoAnswerId: string | undefined;
10
+ aiCfoChatSessionId: string | undefined;
11
+ }, "cardPolicy/extractPolicyDocument", never, {
12
+ uploadedFileName: string;
13
+ }>, updatePolicyDocumentExtractionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<ExtractedCardPolicyRulesPayload, "cardPolicy/updatePolicyDocumentExtractionSuccess">, updatePolicyDocumentExtractionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cardPolicy/updatePolicyDocumentExtractionFailure">, clearPolicyDocumentExtraction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardPolicy/clearPolicyDocumentExtraction">, fetchCardPolicyRecommendationFromUpload: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[answerId: string, chatSessionId: string, extractedRules: ExtractedCardPolicyRules], {
14
+ answerId: string;
15
+ chatSessionId: string;
16
+ extractedRules: ExtractedCardPolicyRules;
17
+ }, "cardPolicy/fetchCardPolicyRecommendationFromUpload", never, never>, updatePolicyRecommendationFromUploadSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardPolicy/updatePolicyRecommendationFromUploadSuccess">, updatePolicyRecommendationFromUploadFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cardPolicy/updatePolicyRecommendationFromUploadFailure">, clearCardPolicy: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardPolicy/clearCardPolicy">;
18
+ declare const _default: import("redux").Reducer<CardPolicyState>;
19
+ export default _default;