@zeniai/client-epic-state 5.0.83-betaRR5 → 5.0.84-beta0ND

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 (262) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.d.ts +1 -1
  3. package/lib/commonStateTypes/animations.js +1 -0
  4. package/lib/entity/aiCfo/aiCfoPayload.d.ts +1 -137
  5. package/lib/entity/aiCfo/aiCfoReducer.d.ts +2 -23
  6. package/lib/entity/aiCfo/aiCfoReducer.js +5 -320
  7. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -13
  8. package/lib/entity/aiCfo/aiCfoSelector.js +1 -28
  9. package/lib/entity/aiCfo/aiCfoState.d.ts +4 -206
  10. package/lib/entity/aiCfo/aiCfoState.js +1 -23
  11. package/lib/entity/company/companyPayload.d.ts +2 -0
  12. package/lib/entity/company/companyPayload.js +2 -0
  13. package/lib/entity/company/companyStateTypes.d.ts +2 -0
  14. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  15. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
  16. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  17. package/lib/entity/paymentAccount/paymentAccountSelector.js +4 -0
  18. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  19. package/lib/entity/snackbar/snackbarTypes.js +1 -3
  20. package/lib/entity/tenant/clearAllEpic.d.ts +2 -6
  21. package/lib/entity/tenant/clearAllEpic.js +0 -8
  22. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  23. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  24. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
  25. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  26. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  27. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  28. package/lib/entity/tenant/tenantPayload.d.ts +19 -0
  29. package/lib/entity/tenant/tenantReducer.d.ts +49 -28
  30. package/lib/entity/tenant/tenantReducer.js +111 -5
  31. package/lib/entity/tenant/tenantState.d.ts +21 -0
  32. package/lib/epic.d.ts +7 -15
  33. package/lib/epic.js +8 -15
  34. package/lib/esm/commonStateTypes/animations.js +1 -0
  35. package/lib/esm/entity/aiCfo/aiCfoReducer.js +5 -320
  36. package/lib/esm/entity/aiCfo/aiCfoSelector.js +1 -26
  37. package/lib/esm/entity/aiCfo/aiCfoState.js +0 -20
  38. package/lib/esm/entity/company/companyPayload.js +2 -0
  39. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +3 -0
  40. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -3
  41. package/lib/esm/entity/tenant/clearAllEpic.js +0 -8
  42. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
  43. package/lib/esm/entity/tenant/tenantReducer.js +108 -3
  44. package/lib/esm/epic.js +8 -15
  45. package/lib/esm/index.js +17 -44
  46. package/lib/esm/reducer.js +0 -12
  47. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +3 -6
  48. package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -5
  49. package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +1 -2
  50. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +2 -12
  51. package/lib/esm/view/companyView/companyViewReducer.js +45 -1
  52. package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +25 -0
  53. package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.js +79 -0
  54. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  55. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +45 -0
  56. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
  57. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +168 -50
  58. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +14 -0
  59. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -0
  60. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -25
  61. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
  62. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +4 -49
  63. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +0 -61
  64. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +49 -0
  65. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +58 -0
  66. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +12 -0
  67. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
  68. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +71 -52
  69. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  70. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
  71. package/lib/index.d.ts +20 -50
  72. package/lib/index.js +39 -193
  73. package/lib/reducer.d.ts +0 -12
  74. package/lib/reducer.js +0 -12
  75. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +2 -11
  76. package/lib/view/aiCfoView/aiCfoViewReducer.js +3 -6
  77. package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -5
  78. package/lib/view/aiCfoView/epics/createSessionEpic.js +1 -2
  79. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +1 -8
  80. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +2 -12
  81. package/lib/view/companyView/companyViewReducer.d.ts +11 -1
  82. package/lib/view/companyView/companyViewReducer.js +47 -3
  83. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.d.ts +9 -0
  84. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +29 -0
  85. package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.d.ts +10 -0
  86. package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.js +83 -0
  87. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
  88. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  89. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  90. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  91. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
  92. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +49 -0
  93. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
  94. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
  95. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
  96. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +41 -4
  97. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +170 -51
  98. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +7 -1
  99. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +21 -1
  100. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +37 -0
  101. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +14 -1
  102. package/lib/view/people/peopleTypes.d.ts +1 -1
  103. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  104. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  105. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +0 -14
  106. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +1 -27
  107. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
  108. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
  109. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +2 -12
  110. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +5 -50
  111. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +0 -42
  112. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +1 -68
  113. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +0 -18
  114. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +8 -0
  115. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +53 -0
  116. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +8 -0
  117. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +62 -0
  118. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +27 -0
  119. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +15 -0
  120. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
  121. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
  122. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +24 -2
  123. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -53
  124. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
  125. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  126. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +12 -0
  127. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
  128. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
  129. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
  130. package/package.json +1 -1
  131. package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +0 -277
  132. package/lib/entity/cardPolicy/cardPolicyPayload.js +0 -143
  133. package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +0 -19
  134. package/lib/entity/cardPolicy/cardPolicyReducer.js +0 -175
  135. package/lib/entity/cardPolicy/cardPolicySelector.d.ts +0 -32
  136. package/lib/entity/cardPolicy/cardPolicySelector.js +0 -99
  137. package/lib/entity/cardPolicy/cardPolicyState.d.ts +0 -205
  138. package/lib/entity/cardPolicy/cardPolicyState.js +0 -14
  139. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +0 -18
  140. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +0 -68
  141. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +0 -26
  142. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +0 -47
  143. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +0 -25
  144. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +0 -39
  145. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +0 -24
  146. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +0 -105
  147. package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +0 -130
  148. package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +0 -171
  149. package/lib/esm/entity/cardPolicy/cardPolicySelector.js +0 -75
  150. package/lib/esm/entity/cardPolicy/cardPolicyState.js +0 -9
  151. package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +0 -64
  152. package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +0 -43
  153. package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +0 -35
  154. package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +0 -101
  155. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -70
  156. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -22
  157. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -1
  158. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -56
  159. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -49
  160. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -42
  161. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -72
  162. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -21
  163. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -1
  164. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -56
  165. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +0 -328
  166. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +0 -120
  167. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +0 -60
  168. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +0 -118
  169. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +0 -33
  170. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +0 -385
  171. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +0 -34
  172. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +0 -33
  173. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +0 -17
  174. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +0 -144
  175. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -181
  176. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -57
  177. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -1
  178. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -53
  179. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +0 -148
  180. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -25
  181. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +0 -112
  182. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +0 -101
  183. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +0 -71
  184. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +0 -34
  185. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +0 -1
  186. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +0 -42
  187. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +0 -69
  188. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +0 -45
  189. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +0 -65
  190. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +0 -64
  191. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +0 -14
  192. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -74
  193. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +0 -21
  194. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -28
  195. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +0 -25
  196. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -2
  197. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +0 -19
  198. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -60
  199. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +0 -18
  200. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -53
  201. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +0 -16
  202. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -46
  203. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +0 -15
  204. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -76
  205. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +0 -21
  206. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -27
  207. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +0 -19
  208. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -2
  209. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +0 -19
  210. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -60
  211. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.d.ts +0 -38
  212. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +0 -333
  213. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.d.ts +0 -25
  214. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +0 -124
  215. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.d.ts +0 -28
  216. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +0 -64
  217. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.d.ts +0 -17
  218. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +0 -122
  219. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.d.ts +0 -23
  220. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +0 -37
  221. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.d.ts +0 -38
  222. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +0 -391
  223. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.d.ts +0 -11
  224. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +0 -38
  225. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.d.ts +0 -24
  226. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +0 -40
  227. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.d.ts +0 -253
  228. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +0 -21
  229. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.d.ts +0 -66
  230. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +0 -151
  231. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +0 -52
  232. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -185
  233. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +0 -47
  234. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -66
  235. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +0 -73
  236. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -2
  237. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +0 -25
  238. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -57
  239. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.d.ts +0 -30
  240. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +0 -152
  241. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +0 -15
  242. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -29
  243. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.d.ts +0 -26
  244. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +0 -116
  245. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.d.ts +0 -35
  246. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +0 -105
  247. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.d.ts +0 -23
  248. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +0 -75
  249. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.d.ts +0 -15
  250. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +0 -38
  251. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.d.ts +0 -76
  252. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +0 -2
  253. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.d.ts +0 -7
  254. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +0 -46
  255. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.d.ts +0 -28
  256. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +0 -73
  257. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.d.ts +0 -23
  258. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +0 -49
  259. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.d.ts +0 -11
  260. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +0 -69
  261. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.d.ts +0 -11
  262. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +0 -68
@@ -16,4 +16,4 @@
16
16
  *
17
17
  * @see README.md in this directory for maintenance expectations.
18
18
  */
19
- export type AiCfoSuggestedQuestionsPageContext = 'balance_sheet' | 'profit_loss' | 'vendors' | 'transactions' | 'cash_flow' | 'accounts_receivable' | 'accounts_payable' | 'transaction_details' | 'dashboard' | 'cash_balance' | 'card_balance' | 'cash_in_cash_out' | 'net_burn_or_income' | 'cash_position' | 'top_expenses' | 'revenue' | 'operating_expenses' | 'command_centre' | 'je_schedules' | 'reconciliation' | 'flux_analysis' | 'receipts' | 'mei' | 'task_checklist' | 'performance' | 'bills_list' | 'bills_details' | 'reimbursement_list' | 'reimbursement_details' | 'vendors_summary' | 'opex_by_vendor' | 'prepaid_expenses' | 'fixed_assets' | 'form_1099' | 'accrued_expenses' | 'forecast' | 'checking' | 'checking_details' | 'treasury' | 'cards' | 'cards_creation' | 'cards_detail' | 'card_policy' | 'card_policy_detail' | 'people' | 'rewards' | 'notifications';
19
+ export type AiCfoSuggestedQuestionsPageContext = 'balance_sheet' | 'profit_loss' | 'vendors' | 'transactions' | 'cash_flow' | 'accounts_receivable' | 'accounts_payable' | 'transaction_details' | 'dashboard' | 'cash_balance' | 'card_balance' | 'cash_in_cash_out' | 'net_burn_or_income' | 'cash_position' | 'top_expenses' | 'revenue' | 'operating_expenses' | 'command_centre' | 'je_schedules' | 'reconciliation' | 'flux_analysis' | 'receipts' | 'mei' | 'task_checklist' | 'performance' | 'bills_list' | 'bills_details' | 'reimbursement_list' | 'reimbursement_details' | 'vendors_summary' | 'opex_by_vendor' | 'prepaid_expenses' | 'fixed_assets' | 'form_1099' | 'accrued_expenses' | 'forecast' | 'checking' | 'checking_details' | 'treasury' | 'cards' | 'cards_detail' | 'people' | 'rewards' | 'notifications';
@@ -1,2 +1,2 @@
1
- export declare const toAnimationsFileName: (v: string) => "Success" | "AiAgent" | "AiIconEntry" | "AiIconExit" | "AiIconLoop" | "AiStar" | "AiStarIcon" | "AiStarPlain" | "AIPoweredInvoiceDark" | "AIPoweredInvoiceLight" | "Angry" | "AutoTransfer" | "CloseCard" | "Confetti" | "ConfettiSuccess" | "DashboardChristmasSnow" | "DashboardNewYearShow" | "DashboardSidebarBottomChristmas" | "DashboardSidebarBottomHalloween" | "DashboardSidebarBottomNewYear" | "DashboardSidebarBottomThanksgiving" | "DashboardSidebarTopChristmas" | "DashboardSidebarTopHalloween" | "DashboardSidebarTopNewYear" | "DashboardSidebarTopThanksgiving" | "Distribution" | "DistributionDark" | "EarnYield" | "FastestWayDark" | "FastestWayLight" | "FinanceTeamDark" | "FinanceTeamLight" | "Happy" | "Liquidity" | "LockCard" | "MoneyTransferSuccess" | "MultiLevelApprovalDark" | "MultiLevelApprovalLight" | "NotHappy" | "Protection" | "ReceiptDark" | "ReceiptLight" | "Recurring" | "RecurringDark" | "ReimburseDark" | "ReimburseLight" | "RewardsDark" | "RewardsDarkHover" | "RewardsLight" | "RewardsLightHover" | "Ripple" | "Secure" | "Target" | "TargetDark" | "UnlockCard" | "VeryHappy" | "ZeniAssist";
1
+ export declare const toAnimationsFileName: (v: string) => "Success" | "AiAgent" | "AiIconEntry" | "AiIconExit" | "AiIconLoop" | "AiStar" | "AiStarIcon" | "AiStarPlain" | "AIPoweredInvoiceDark" | "AIPoweredInvoiceLight" | "Angry" | "AutoTransfer" | "CloseCard" | "Confetti" | "ConfettiSuccess" | "DashboardChristmasSnow" | "DashboardNewYearShow" | "DashboardSidebarBottomChristmas" | "DashboardSidebarBottomHalloween" | "DashboardSidebarBottomNewYear" | "DashboardSidebarBottomThanksgiving" | "DashboardSidebarTopChristmas" | "DashboardSidebarTopHalloween" | "DashboardSidebarTopNewYear" | "DashboardSidebarTopThanksgiving" | "Distribution" | "DistributionDark" | "EarnYield" | "FastestWayDark" | "FastestWayLight" | "FinanceTeamDark" | "FinanceTeamLight" | "Happy" | "Liquidity" | "LockCard" | "MoneyTransferSuccess" | "MultiLevelApprovalDark" | "MultiLevelApprovalLight" | "NotHappy" | "Protection" | "ReceiptDark" | "ReceiptLight" | "Recurring" | "RecurringDark" | "ReimburseDark" | "ReimburseLight" | "RewardsDark" | "RewardsDarkHover" | "RewardsLight" | "RewardsLightHover" | "Ripple" | "Secure" | "Target" | "TargetDark" | "UnlockCard" | "VeryHappy" | "Welcome" | "ZeniAssist";
2
2
  export type AnimationFileName = ReturnType<typeof toAnimationsFileName>;
@@ -59,6 +59,7 @@ const ALL_ANIMATIONS_FILE_NAMES = [
59
59
  'TargetDark',
60
60
  'UnlockCard',
61
61
  'VeryHappy',
62
+ 'Welcome',
62
63
  'ZeniAssist',
63
64
  ];
64
65
  const toAnimationsFileName = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_ANIMATIONS_FILE_NAMES);
@@ -20,144 +20,8 @@ export interface ChartVisualizationPayload {
20
20
  lines?: string[] | null;
21
21
  y_format?: YFormatPayload;
22
22
  }
23
- /**
24
- * Single AI-suggested card on the wire. The controller ships an array of
25
- * these mixing vendor, department, and category entries. Entries with
26
- * `is_suggested: true` seed step 1 (`review`) or the step-2 editable table
27
- * (`create`); entries with `is_suggested: false` aren't pre-rendered as
28
- * rows but are available in the step-2 Card dropdown (and, in `review`,
29
- * the step-1 "Add something else" search).
30
- *
31
- * `owner_id` may be `null` (or empty string, defensively normalized by the
32
- * reducer) when the AI hasn't picked an owner.
33
- */
34
- export interface SuggestedCardPayload {
35
- avg_spend: number;
36
- card_name: string;
37
- card_name_id: string;
38
- card_type: 'vendor' | 'department' | 'category';
39
- credit_limit: number;
40
- is_suggested: boolean;
41
- owner_id: string | null;
42
- }
43
- /**
44
- * Wire payload for the AI Card Creation interactive form. Both `review`
45
- * and `create` modes share an identical envelope — a flat
46
- * `suggested_cards[]` (mix of suggested + not-suggested rows). The only
47
- * thing that varies is `mode`, which the FE uses to pick the step UX:
48
- *
49
- * - `review` (2-step): user reviews / toggles the `is_suggested: true`
50
- * rows in step 1, then configures one card per surviving row in step 2.
51
- * - `create` (1-step): the FE seeds the step-2 editable table directly
52
- * from the `is_suggested: true` rows; step 1 is skipped.
53
- *
54
- * In both modes the full `suggested_cards[]` universe (including
55
- * `is_suggested: false`) feeds the step-2 Card-cell dropdown so the user
56
- * can swap a row to any vendor / department / category of the same kind.
57
- *
58
- * The AI Card Creation flow currently issues virtual credit cards only.
59
- */
60
- export interface CardsCreationInitialDataPayload {
61
- mode: 'review' | 'create';
62
- suggested_cards: SuggestedCardPayload[];
63
- }
64
- /**
65
- * Per-policy allow / block bucket on the wire. The two arrays are
66
- * independent (a draft policy may populate both, only one, or neither).
67
- */
68
- export interface DraftPolicyEntityPayload {
69
- category_codes: string[];
70
- merchant_names: string[];
71
- }
72
- /**
73
- * Spend-limit bucket per policy. `transaction` is the only cadence the
74
- * BE ships today; left open-ended for future cadences (e.g.
75
- * `monthly`, `quarterly`).
76
- */
77
- export interface DraftPolicySpendLimitsPayload {
78
- transaction: number;
79
- [cadence: string]: number | undefined;
80
- }
81
- /**
82
- * Single draft policy on the wire. The controller emits one of these
83
- * per recommended policy in `step_5_review.draft_policies`. Identity is
84
- * positional (no stable `id` from the BE); the FE synthesizes one on
85
- * decode.
86
- */
87
- export interface DraftPolicyPayload {
88
- allowed_entity: DraftPolicyEntityPayload;
89
- apply_to_cards: string[];
90
- blocked_entity: DraftPolicyEntityPayload;
91
- description: string;
92
- /** Enforcement mode for the policy (e.g. `"strict"`). Carried into
93
- * state for guided submit; ignored for `auto` / `upload`. */
94
- mode: string;
95
- name: string;
96
- required_receipt_threshold: number;
97
- spend_limits: DraftPolicySpendLimitsPayload;
98
- }
99
- /**
100
- * `step_5_review` block — the only step in `wizard_plan` the FE reads.
101
- * Steps 1–4 are intentionally not modeled.
102
- */
103
- export interface CardPolicyStep5ReviewPayload {
104
- draft_policies: DraftPolicyPayload[];
105
- /** Header text shown above the review list / wizard. */
106
- prompt: string;
107
- /** How the BE grouped the suggested policies. `"none"` today; may
108
- * surface as a header banner in a future iteration. */
109
- grouping_source?: string;
110
- }
111
- export interface CardPolicyWizardPlanPayload {
112
- step_5_review: CardPolicyStep5ReviewPayload;
113
- }
114
- /**
115
- * Upload-mode metadata that the `policy-recommendation-from-upload` API
116
- * returns alongside the wizard plan. Absent on the initial controller
117
- * response; populated after the file upload + recommendation chain.
118
- */
119
- export interface CardPolicyUploadSourcePayload {
120
- confidence_score: number;
121
- file_name: string;
122
- low_confidence_fields: string[];
123
- }
124
- /**
125
- * Discriminated payload for the AI Card Policy interactive form.
126
- * All three modes share the same `wizard_plan.step_5_review.draft_policies`
127
- * envelope; the FE renders different forms based on `mode`.
128
- *
129
- * - `auto` (1-step review): user reviews suggested policies and submits.
130
- * - `guided` (5-step wizard): Steps 1–4 seeded from `draft_policies[0]`,
131
- * Step 5 lists every draft policy.
132
- * - `upload` (3-step): upload doc → pick cards → review. Controller
133
- * responses for `mode === "upload"` arrive *before* the user uploads,
134
- * so `wizard_plan` is optional; populated after the upload-recommendation
135
- * API returns.
136
- */
137
- export type CardPolicyInitialDataPayload = {
138
- mode: 'auto';
139
- wizard_plan: CardPolicyWizardPlanPayload;
140
- } | {
141
- mode: 'guided';
142
- wizard_plan: CardPolicyWizardPlanPayload;
143
- } | {
144
- mode: 'upload';
145
- source?: CardPolicyUploadSourcePayload;
146
- wizard_plan?: CardPolicyWizardPlanPayload;
147
- };
148
- /**
149
- * Discriminated visualization payload. The FE narrows on `form_type` and
150
- * casts `payload` to the matching shape.
151
- */
152
- export type InteractiveFormVisualizationPayload = {
153
- form_type: 'cards_creation';
154
- payload: CardsCreationInitialDataPayload;
155
- } | {
156
- form_type: 'card_policy';
157
- payload: CardPolicyInitialDataPayload;
158
- };
159
23
  export interface AiCfoVisualizationPayload {
160
- data: TableVisualizationPayload | ChartVisualizationPayload | InteractiveFormVisualizationPayload | null;
24
+ data: TableVisualizationPayload | ChartVisualizationPayload | null;
161
25
  type: string | null;
162
26
  }
163
27
  export interface AiCfoAnswerPayload {
@@ -1,8 +1,7 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
2
  import { ZeniDate } from '../../zeniDayJS';
3
3
  import { AiCfoAnswerPayload, AiCfoVisualizationPayload, ChatSessionPayload, MessagePayload } from './aiCfoPayload';
4
- import { AiCfoState, AiCfoVisualization, FileAttachmentMetadata, SyntheticAiCfoAnswerKind } from './aiCfoState';
5
- import type { CardPolicyUploadSource, CardPolicyWizardPlan } from './aiCfoState';
4
+ import { AiCfoState, AiCfoVisualization, FileAttachmentMetadata } from './aiCfoState';
6
5
  export declare const initialAiCfoState: AiCfoState;
7
6
  export declare const toAiCfoVisualization: (visualization: AiCfoVisualizationPayload) => AiCfoVisualization | undefined;
8
7
  export declare const setNewSession: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -42,26 +41,6 @@ export declare const setNewSession: import("@reduxjs/toolkit").ActionCreatorWith
42
41
  }, "aiCfo/addQuestionPayload">, clearAiCfo: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfo/clearAiCfo">, deleteQuestion: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
43
42
  chatSessionId: ID;
44
43
  questionAnswerId: ID;
45
- }, "aiCfo/deleteQuestion">, updateAiCfoAnswerCardPolicyWizardPlan: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
46
- answerId: ID;
47
- chatSessionId: ID;
48
- wizardPlan: CardPolicyWizardPlan;
49
- source?: CardPolicyUploadSource;
50
- }, "aiCfo/updateAiCfoAnswerCardPolicyWizardPlan">, appendSyntheticAiCfoAnswer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
51
- chatSessionId: ID;
52
- createdAt: ZeniDate;
53
- id: ID;
54
- kind: SyntheticAiCfoAnswerKind;
55
- sourceQuestionAnswerId: ID;
56
- entityIds?: ID[];
57
- }, "aiCfo/appendSyntheticAiCfoAnswer">, updateSyntheticAiCfoAnswer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
58
- chatSessionId: ID;
59
- id: ID;
60
- kind: SyntheticAiCfoAnswerKind;
61
- entityIds?: ID[];
62
- }, "aiCfo/updateSyntheticAiCfoAnswer">, removeSyntheticAiCfoAnswer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
63
- chatSessionId: ID;
64
- id: ID;
65
- }, "aiCfo/removeSyntheticAiCfoAnswer">, clearSyntheticAiCfoAnswers: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "aiCfo/clearSyntheticAiCfoAnswers">;
44
+ }, "aiCfo/deleteQuestion">;
66
45
  declare const _default: import("redux").Reducer<AiCfoState>;
67
46
  export default _default;
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearSyntheticAiCfoAnswers = exports.removeSyntheticAiCfoAnswer = exports.updateSyntheticAiCfoAnswer = exports.appendSyntheticAiCfoAnswer = exports.updateAiCfoAnswerCardPolicyWizardPlan = exports.deleteQuestion = exports.clearAiCfo = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setChatHistory = exports.setSessions = exports.clearSession = exports.setNewSession = exports.toAiCfoVisualization = exports.initialAiCfoState = void 0;
4
+ exports.deleteQuestion = exports.clearAiCfo = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setChatHistory = exports.setSessions = exports.clearSession = exports.setNewSession = exports.toAiCfoVisualization = exports.initialAiCfoState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const zeniDayJS_1 = require("../../zeniDayJS");
7
7
  const aiCfoState_1 = require("./aiCfoState");
8
8
  exports.initialAiCfoState = {
9
9
  aiCfoByChatSessionId: {},
10
10
  partialQuestionAnswers: {},
11
- syntheticAnswersByChatSessionId: {},
12
11
  };
13
12
  // Utility: Merge two arrays of Q&A pairs, combining responses for the same question
14
13
  function mergeQuestionAnswerPairs(existing, newQAs) {
@@ -140,211 +139,12 @@ const toAiCfoVisualization = (visualization) => {
140
139
  if (visualization.type == null || visualization.data == null) {
141
140
  return undefined;
142
141
  }
143
- // Reject unknown viz types instead of silently defaulting to `table`.
144
- // The previous `?? 'table'` fallback funneled any non-strict-union
145
- // payload into `toAiCfoVisualizationData`, which is the table/chart
146
- // decoder and dereferences `data.values.map(...)`. Interactive-form
147
- // payloads (e.g. when the BE ships `type: <new_form_kind>` we don't
148
- // know about yet) carry no `values`, so that path threw during answer
149
- // upsert and broke rendering for the whole Q/A. Returning `undefined`
150
- // matches the existing "missing type / data" guard above — callers
151
- // already handle a no-visualization answer.
152
- const normalizedType = (0, aiCfoState_1.toAiCfoVisualizationTypeStrict)(visualization.type);
153
- if (normalizedType == null) {
154
- return undefined;
155
- }
156
142
  return {
157
- type: normalizedType,
158
- data: normalizedType === 'interactive_form'
159
- ? toInteractiveFormVisualization(visualization.data)
160
- : toAiCfoVisualizationData(visualization.data),
143
+ type: (0, aiCfoState_1.toAiCfoVisualizationTypeStrict)(visualization.type) ?? 'table',
144
+ data: toAiCfoVisualizationData(visualization.data),
161
145
  };
162
146
  };
163
147
  exports.toAiCfoVisualization = toAiCfoVisualization;
164
- const toInteractiveFormVisualization = (data) => {
165
- // When `form_type` is missing / mistyped, fall back to a payload-shape
166
- // heuristic instead of blindly defaulting to `cards_creation`. A
167
- // `card_policy` payload always carries `mode: 'auto' | 'guided' |
168
- // 'upload'` (see `CardPolicyInitialDataPayload`); a `cards_creation`
169
- // payload carries `suggested_cards` and never that exact `mode` set.
170
- // Without this, a card-policy answer with a malformed `form_type`
171
- // would be decoded as cards_creation, surfacing the wrong interactive
172
- // form (and wrong submit path) in the UI.
173
- const formType = (0, aiCfoState_1.toInteractiveFormTypeStrict)(data.form_type) ??
174
- inferInteractiveFormTypeFromPayload(data.payload);
175
- if (formType === 'card_policy') {
176
- return {
177
- formType: 'card_policy',
178
- payload: toCardPolicyInitialData(data.payload),
179
- };
180
- }
181
- return {
182
- formType: 'cards_creation',
183
- payload: toCardsCreationInitialData(data.payload),
184
- };
185
- };
186
- const inferInteractiveFormTypeFromPayload = (payload) => {
187
- if (payload != null && typeof payload === 'object' && 'mode' in payload) {
188
- const mode = payload.mode;
189
- if (mode === 'auto' || mode === 'guided' || mode === 'upload') {
190
- return 'card_policy';
191
- }
192
- }
193
- return 'cards_creation';
194
- };
195
- /**
196
- * Decode the unified `cards_creation` interactive-form payload into the FE
197
- * state shape. Both `review` and `create` modes ship the same envelope
198
- * (`{mode, suggested_cards[]}`); the only thing that varies is how the
199
- * common derivations are exposed:
200
- *
201
- * - `review` (2-step): `is_suggested: true` rows -> `teamRows`; the full
202
- * universe -> `cardNameOptions` (step-2 swap + step-1 "Add something
203
- * else" search).
204
- * - `create` (1-step): `is_suggested: true` rows -> `cardRows` pre-seeded
205
- * for the step-2 editable table; the full universe -> `cardNameOptions`
206
- * (step-2 swap).
207
- */
208
- const toCardsCreationInitialData = (payload) => {
209
- const suggestedCards = payload.suggested_cards ?? [];
210
- const ordered = [...suggestedCards].sort((a, b) => KIND_RANK[a.card_type] - KIND_RANK[b.card_type]);
211
- const withUniqueIds = withSynthesizedIds(ordered);
212
- const suggestedOnly = withUniqueIds.filter(({ card }) => card.is_suggested);
213
- const cardNameOptions = withUniqueIds.map(({ card, uniqueId }) => ({
214
- id: uniqueId,
215
- kind: toCardKind(card.card_type),
216
- label: card.card_name,
217
- }));
218
- const suggestedOwnerUserIdByTeamId = Object.fromEntries(suggestedOnly.map(({ card, uniqueId }) => [
219
- uniqueId,
220
- normalizeOwnerId(card.owner_id),
221
- ]));
222
- const common = {
223
- cardNameOptions,
224
- suggestedOwnerUserIdByTeamId,
225
- };
226
- if (payload.mode === 'create') {
227
- return {
228
- ...common,
229
- mode: 'create',
230
- cardRows: suggestedOnly.map(({ card, uniqueId }) => ({
231
- cardKind: toCardKind(card.card_type),
232
- id: uniqueId,
233
- label: card.card_name,
234
- recommendedLimit: card.credit_limit > 0 ? card.credit_limit : undefined,
235
- suggestedOwnerUserId: normalizeOwnerId(card.owner_id),
236
- })),
237
- };
238
- }
239
- return {
240
- ...common,
241
- mode: 'review',
242
- teamRows: suggestedOnly.map(({ card, uniqueId }) => ({
243
- avgMonthlySpend: CURRENCY_FORMATTER.format(card.avg_spend),
244
- cardKind: toCardKind(card.card_type),
245
- id: uniqueId,
246
- label: card.card_name,
247
- recommendedLimit: CURRENCY_FORMATTER.format(card.credit_limit),
248
- recommendedLimitCadence: 'Monthly',
249
- })),
250
- };
251
- };
252
- const CURRENCY_FORMATTER = new Intl.NumberFormat('en-US', {
253
- style: 'currency',
254
- currency: 'USD',
255
- maximumFractionDigits: 0,
256
- });
257
- /**
258
- * Normalize the controller's `owner_id` into `string | undefined`. The
259
- * BE may emit either `null` or `""` to signal "no owner picked"; both
260
- * collapse to `undefined` so downstream resolvers don't try to look up
261
- * a user with an empty id.
262
- */
263
- const normalizeOwnerId = (ownerId) => (ownerId != null && ownerId !== '' ? ownerId : undefined);
264
- const KIND_RANK = {
265
- vendor: 0,
266
- category: 1,
267
- department: 2,
268
- };
269
- const toCardKind = (cardType) => {
270
- if (cardType === 'department') {
271
- return 'class';
272
- }
273
- if (cardType === 'category') {
274
- return 'category';
275
- }
276
- return 'vendor';
277
- };
278
- /**
279
- * Stamp each suggested card with a stable unique id derived from its
280
- * `card_name_id`. If two cards in the same payload share the same
281
- * `card_name_id` (which happens in the current sample payload where
282
- * `card_name_id` is the literal `"vendor_uuid"`), fall back to a
283
- * synthesized id `${kind}__${card_name_id}__${index}` so RHF row keying
284
- * stays unique.
285
- */
286
- const withSynthesizedIds = (cards) => {
287
- const seen = new Set();
288
- return cards.map((card, index) => {
289
- const preferred = card.card_name_id;
290
- if (preferred != null && preferred !== '' && !seen.has(preferred)) {
291
- seen.add(preferred);
292
- return { card, uniqueId: preferred };
293
- }
294
- const synthesized = `${card.card_type}__${preferred ?? 'unknown'}__${index}`;
295
- seen.add(synthesized);
296
- return { card, uniqueId: synthesized };
297
- });
298
- };
299
- const toCardPolicyDraftPolicy = (payload, index) => ({
300
- id: `draft-${index}`,
301
- name: payload.name,
302
- description: payload.description ?? '',
303
- mode: payload.mode,
304
- allowedEntity: {
305
- categoryCodes: payload.allowed_entity?.category_codes ?? [],
306
- merchantNames: payload.allowed_entity?.merchant_names ?? [],
307
- },
308
- blockedEntity: {
309
- categoryCodes: payload.blocked_entity?.category_codes ?? [],
310
- merchantNames: payload.blocked_entity?.merchant_names ?? [],
311
- },
312
- applyToCards: payload.apply_to_cards ?? [],
313
- requiredReceiptThreshold: payload.required_receipt_threshold ?? 0,
314
- spendLimits: {
315
- transaction: payload.spend_limits?.transaction ?? 0,
316
- },
317
- });
318
- const toCardPolicyStep5Review = (payload) => ({
319
- draftPolicies: (payload.draft_policies ?? []).map(toCardPolicyDraftPolicy),
320
- groupingSource: payload.grouping_source ?? 'none',
321
- prompt: payload.prompt ?? '',
322
- });
323
- const toCardPolicyWizardPlan = (payload) => ({
324
- step5Review: toCardPolicyStep5Review(payload.step_5_review),
325
- });
326
- const toCardPolicyUploadSource = (payload) => ({
327
- confidenceScore: payload.confidence_score,
328
- fileName: payload.file_name,
329
- lowConfidenceFields: payload.low_confidence_fields ?? [],
330
- });
331
- const toCardPolicyInitialData = (payload) => {
332
- if (payload.mode === 'upload') {
333
- return {
334
- policyKind: 'upload',
335
- wizardPlan: payload.wizard_plan != null
336
- ? toCardPolicyWizardPlan(payload.wizard_plan)
337
- : undefined,
338
- source: payload.source != null
339
- ? toCardPolicyUploadSource(payload.source)
340
- : undefined,
341
- };
342
- }
343
- return {
344
- policyKind: payload.mode,
345
- wizardPlan: toCardPolicyWizardPlan(payload.wizard_plan),
346
- };
347
- };
348
148
  const toAiCfoVisualizationData = (data) => {
349
149
  if ('x' in data && 'y' in data) {
350
150
  // Normalize y to always be an array
@@ -658,118 +458,10 @@ const aiCfo = (0, toolkit_1.createSlice)({
658
458
  session.questionAnswers.push(qa);
659
459
  }
660
460
  },
661
- /**
662
- * Patch the `card_policy` interactive-form payload for a specific
663
- * answer in a chat session to merge in the wizard plan + upload
664
- * source metadata returned by
665
- * `POST /cards/1.0/ai-cfo/policy-recommendation-from-upload`.
666
- *
667
- * Dispatched by the recommendation epic after a successful response;
668
- * the wizard re-renders Steps 2 + 3 of the upload variant once the
669
- * payload becomes a populated `CardPolicyInitialData` with
670
- * `policyKind: "upload"` + `wizardPlan` + `source`.
671
- *
672
- * No-op when the target answer / chat session / form payload is
673
- * missing or isn't an upload-mode card-policy interactive form —
674
- * the bridge epic is best-effort and silently drops in edge cases
675
- * (e.g. the user closed the chat before recommendation returned).
676
- */
677
- updateAiCfoAnswerCardPolicyWizardPlan(draft, action) {
678
- const { answerId, chatSessionId, source, wizardPlan } = action.payload;
679
- const session = draft.aiCfoByChatSessionId[chatSessionId];
680
- if (session == null) {
681
- return;
682
- }
683
- const qa = session.questionAnswers.find((entry) => entry.questionAnswerId === answerId);
684
- if (qa == null) {
685
- return;
686
- }
687
- for (const response of Object.values(qa.responses)) {
688
- const visualization = response?.content.visualization;
689
- if (visualization == null ||
690
- visualization.type !== 'interactive_form') {
691
- continue;
692
- }
693
- const data = visualization.data;
694
- if (data.formType !== 'card_policy' ||
695
- data.payload.policyKind !== 'upload') {
696
- continue;
697
- }
698
- data.payload = {
699
- ...data.payload,
700
- wizardPlan,
701
- source: source ?? data.payload.source,
702
- };
703
- }
704
- },
705
- /**
706
- * Append a client-synthesized answer bubble to a chat session. Used by
707
- * the AI CFO cards/policy create flow to render a "Creating…" placeholder
708
- * in the drawer while the underlying mutation runs.
709
- *
710
- * The caller is responsible for generating a stable `id` (so the same
711
- * bubble can later be updated in place via `updateSyntheticAiCfoAnswer`
712
- * once the mutation completes) and a `createdAt` timestamp so the
713
- * renderer can interleave synthetic bubbles with streamed Q&A pairs in
714
- * chronological order.
715
- */
716
- appendSyntheticAiCfoAnswer(draft, action) {
717
- const { chatSessionId, id, kind, createdAt, entityIds, sourceQuestionAnswerId, } = action.payload;
718
- if (draft.syntheticAnswersByChatSessionId[chatSessionId] == null) {
719
- draft.syntheticAnswersByChatSessionId[chatSessionId] = [];
720
- }
721
- draft.syntheticAnswersByChatSessionId[chatSessionId].push({
722
- id,
723
- kind,
724
- entityIds: entityIds ?? [],
725
- createdAt,
726
- sourceQuestionAnswerId,
727
- });
728
- },
729
- /**
730
- * Update an existing synthetic answer bubble in place. Typically called
731
- * when the create mutation completes: the screen transitions the bubble
732
- * from `creating_*` to `created_*` and populates `entityIds` with the
733
- * newly created cards / policy templates.
734
- *
735
- * No-op when the target bubble is missing (e.g. the session was cleared
736
- * before the mutation returned).
737
- */
738
- updateSyntheticAiCfoAnswer(draft, action) {
739
- const { chatSessionId, id, kind, entityIds } = action.payload;
740
- const list = draft.syntheticAnswersByChatSessionId[chatSessionId];
741
- if (list == null) {
742
- return;
743
- }
744
- const entry = list.find((item) => item.id === id);
745
- if (entry == null) {
746
- return;
747
- }
748
- entry.kind = kind;
749
- if (entityIds != null) {
750
- entry.entityIds = entityIds;
751
- }
752
- },
753
- /**
754
- * Remove a single synthetic answer bubble (e.g. when the user manually
755
- * dismisses it or the mutation errors out and we want to fall back to
756
- * an inline error snackbar).
757
- */
758
- removeSyntheticAiCfoAnswer(draft, action) {
759
- const { chatSessionId, id } = action.payload;
760
- const list = draft.syntheticAnswersByChatSessionId[chatSessionId];
761
- if (list == null) {
762
- return;
763
- }
764
- draft.syntheticAnswersByChatSessionId[chatSessionId] = list.filter((item) => item.id !== id);
765
- },
766
- clearSyntheticAiCfoAnswers(draft, action) {
767
- delete draft.syntheticAnswersByChatSessionId[action.payload];
768
- },
769
461
  clearSession(draft, action) {
770
462
  const sessionId = action.payload;
771
463
  delete draft.aiCfoByChatSessionId[sessionId];
772
- delete draft.syntheticAnswersByChatSessionId[sessionId];
464
+ // Clear partial Q&A if it belongs to the cleared session
773
465
  if (draft.partialQuestionAnswers?.[sessionId] != null) {
774
466
  draft.partialQuestionAnswers[sessionId] = undefined;
775
467
  }
@@ -777,7 +469,6 @@ const aiCfo = (0, toolkit_1.createSlice)({
777
469
  clearAiCfo(draft) {
778
470
  draft.aiCfoByChatSessionId = {};
779
471
  draft.partialQuestionAnswers = {};
780
- draft.syntheticAnswersByChatSessionId = {};
781
472
  },
782
473
  deleteQuestion(draft, action) {
783
474
  const { chatSessionId, questionAnswerId } = action.payload;
@@ -790,12 +481,6 @@ const aiCfo = (0, toolkit_1.createSlice)({
790
481
  if (idx !== -1) {
791
482
  session.questionAnswers.splice(idx, 1);
792
483
  }
793
- // Drop synthetic bubbles whose sourceQuestionAnswerId is the deleted Q/A; otherwise "Creating…" / "Created" tiles outlive their Q/A.
794
- const syntheticAnswers = draft.syntheticAnswersByChatSessionId[chatSessionId];
795
- if (syntheticAnswers != null) {
796
- draft.syntheticAnswersByChatSessionId[chatSessionId] =
797
- syntheticAnswers.filter((answer) => answer.sourceQuestionAnswerId !== questionAnswerId);
798
- }
799
484
  },
800
485
  },
801
486
  });
@@ -808,5 +493,5 @@ const toChatSession = (chatSessionPayload) => {
808
493
  createdAt: (0, zeniDayJS_1.date)(created_at),
809
494
  };
810
495
  };
811
- _a = aiCfo.actions, exports.setNewSession = _a.setNewSession, exports.clearSession = _a.clearSession, exports.setSessions = _a.setSessions, exports.setChatHistory = _a.setChatHistory, exports.upsertAnswerPayload = _a.upsertAnswerPayload, exports.upsertOrAddQuestionAnswerPayload = _a.upsertOrAddQuestionAnswerPayload, exports.addQuestionPayload = _a.addQuestionPayload, exports.clearAiCfo = _a.clearAiCfo, exports.deleteQuestion = _a.deleteQuestion, exports.updateAiCfoAnswerCardPolicyWizardPlan = _a.updateAiCfoAnswerCardPolicyWizardPlan, exports.appendSyntheticAiCfoAnswer = _a.appendSyntheticAiCfoAnswer, exports.updateSyntheticAiCfoAnswer = _a.updateSyntheticAiCfoAnswer, exports.removeSyntheticAiCfoAnswer = _a.removeSyntheticAiCfoAnswer, exports.clearSyntheticAiCfoAnswers = _a.clearSyntheticAiCfoAnswers;
496
+ _a = aiCfo.actions, exports.setNewSession = _a.setNewSession, exports.clearSession = _a.clearSession, exports.setSessions = _a.setSessions, exports.setChatHistory = _a.setChatHistory, exports.upsertAnswerPayload = _a.upsertAnswerPayload, exports.upsertOrAddQuestionAnswerPayload = _a.upsertOrAddQuestionAnswerPayload, exports.addQuestionPayload = _a.addQuestionPayload, exports.clearAiCfo = _a.clearAiCfo, exports.deleteQuestion = _a.deleteQuestion;
812
497
  exports.default = aiCfo.reducer;
@@ -1,25 +1,13 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
- import { AiCfoQuestionWithAnswer, AiCfoState, ChatSession, SyntheticAiCfoAnswer } from './aiCfoState';
2
+ import { AiCfoQuestionWithAnswer, AiCfoState, ChatSession } from './aiCfoState';
3
3
  export declare function getAllQuestionAnswersForChatSession(state: AiCfoState, chatSessionId: ID): AiCfoQuestionWithAnswer[];
4
4
  export declare function getQuestionAnswerByIdForChatSession(state: AiCfoState, chatSessionId: ID, questionAnswerId: ID): AiCfoQuestionWithAnswer | undefined;
5
5
  export declare function getAllQuestionsForChatSession(state: AiCfoState, chatSessionId: ID): string[];
6
6
  export interface AiCfoSelectorView {
7
7
  allSessionsWithOrderedQuestionAnswers: ChatSessionWithOrderedQuestionAnswers[];
8
- syntheticAnswersByChatSessionId: Record<ID, SyntheticAiCfoAnswer[]>;
9
8
  }
10
9
  export interface ChatSessionWithOrderedQuestionAnswers {
11
10
  chatSession: ChatSession;
12
11
  questionAnswers: AiCfoQuestionWithAnswer[];
13
12
  }
14
13
  export declare function getAiCfoSelectorView(state: AiCfoState): AiCfoSelectorView;
15
- export declare function getSyntheticAiCfoAnswersForChatSession(state: AiCfoState, chatSessionId: ID): SyntheticAiCfoAnswer[];
16
- /**
17
- * Look up the synthetic answer bubble (if any) whose source AI CFO Q/A
18
- * is `questionAnswerId`. Used by the in-place renderer to swap a Q/A's
19
- * answer bubble with the "Creating…" / "Created" tile.
20
- *
21
- * Returns `undefined` when no synthetic bubble has been dispatched for
22
- * the answer yet (i.e. the user hasn't submitted the interactive form),
23
- * or when the chat session has no synthetic entries at all.
24
- */
25
- export declare function getSyntheticAiCfoAnswerByQuestionAnswerId(state: AiCfoState, chatSessionId: ID, questionAnswerId: ID): SyntheticAiCfoAnswer | undefined;
@@ -4,8 +4,6 @@ exports.getAllQuestionAnswersForChatSession = getAllQuestionAnswersForChatSessio
4
4
  exports.getQuestionAnswerByIdForChatSession = getQuestionAnswerByIdForChatSession;
5
5
  exports.getAllQuestionsForChatSession = getAllQuestionsForChatSession;
6
6
  exports.getAiCfoSelectorView = getAiCfoSelectorView;
7
- exports.getSyntheticAiCfoAnswersForChatSession = getSyntheticAiCfoAnswersForChatSession;
8
- exports.getSyntheticAiCfoAnswerByQuestionAnswerId = getSyntheticAiCfoAnswerByQuestionAnswerId;
9
7
  function getAllQuestionAnswersForChatSession(state, chatSessionId) {
10
8
  const arr = state.aiCfoByChatSessionId[chatSessionId]?.questionAnswers ?? [];
11
9
  return arr
@@ -40,30 +38,5 @@ function getAiCfoSelectorView(state) {
40
38
  : [],
41
39
  }))
42
40
  .sort((a, b) => b.chatSession.createdAt.valueOf() - a.chatSession.createdAt.valueOf());
43
- return {
44
- allSessionsWithOrderedQuestionAnswers,
45
- syntheticAnswersByChatSessionId: state.syntheticAnswersByChatSessionId ?? {},
46
- };
47
- }
48
- function getSyntheticAiCfoAnswersForChatSession(state, chatSessionId) {
49
- const arr = state.syntheticAnswersByChatSessionId?.[chatSessionId] ?? [];
50
- return arr
51
- .slice()
52
- .sort((a, b) => a.createdAt.valueOf() - b.createdAt.valueOf());
53
- }
54
- /**
55
- * Look up the synthetic answer bubble (if any) whose source AI CFO Q/A
56
- * is `questionAnswerId`. Used by the in-place renderer to swap a Q/A's
57
- * answer bubble with the "Creating…" / "Created" tile.
58
- *
59
- * Returns `undefined` when no synthetic bubble has been dispatched for
60
- * the answer yet (i.e. the user hasn't submitted the interactive form),
61
- * or when the chat session has no synthetic entries at all.
62
- */
63
- function getSyntheticAiCfoAnswerByQuestionAnswerId(state, chatSessionId, questionAnswerId) {
64
- const arr = state.syntheticAnswersByChatSessionId?.[chatSessionId];
65
- if (arr == null) {
66
- return undefined;
67
- }
68
- return arr.find((answer) => answer.sourceQuestionAnswerId === questionAnswerId);
41
+ return { allSessionsWithOrderedQuestionAnswers };
69
42
  }