@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
@@ -1,10 +1,9 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import { date as zeniDate } from '../../zeniDayJS';
3
- import { ALL_AI_CFO_ANSWER_RESPONSE_TYPES, toAiCfoAnswerResponseType, toAiCfoAnswerResponseTypeStrict, toAiCfoAnswerStateType, toAiCfoVisualizationTypeStrict, toInteractiveFormTypeStrict, toMessageSender, toMessageType, toYFormatScaleStrict, toYFormatTypeStrict, toYFormatUnitStrict, } from './aiCfoState';
3
+ import { ALL_AI_CFO_ANSWER_RESPONSE_TYPES, toAiCfoAnswerResponseType, toAiCfoAnswerResponseTypeStrict, toAiCfoAnswerStateType, toAiCfoVisualizationTypeStrict, toMessageSender, toMessageType, toYFormatScaleStrict, toYFormatTypeStrict, toYFormatUnitStrict, } from './aiCfoState';
4
4
  export const initialAiCfoState = {
5
5
  aiCfoByChatSessionId: {},
6
6
  partialQuestionAnswers: {},
7
- syntheticAnswersByChatSessionId: {},
8
7
  };
9
8
  // Utility: Merge two arrays of Q&A pairs, combining responses for the same question
10
9
  function mergeQuestionAnswerPairs(existing, newQAs) {
@@ -136,208 +135,9 @@ export const toAiCfoVisualization = (visualization) => {
136
135
  if (visualization.type == null || visualization.data == null) {
137
136
  return undefined;
138
137
  }
139
- // Reject unknown viz types instead of silently defaulting to `table`.
140
- // The previous `?? 'table'` fallback funneled any non-strict-union
141
- // payload into `toAiCfoVisualizationData`, which is the table/chart
142
- // decoder and dereferences `data.values.map(...)`. Interactive-form
143
- // payloads (e.g. when the BE ships `type: <new_form_kind>` we don't
144
- // know about yet) carry no `values`, so that path threw during answer
145
- // upsert and broke rendering for the whole Q/A. Returning `undefined`
146
- // matches the existing "missing type / data" guard above — callers
147
- // already handle a no-visualization answer.
148
- const normalizedType = toAiCfoVisualizationTypeStrict(visualization.type);
149
- if (normalizedType == null) {
150
- return undefined;
151
- }
152
- return {
153
- type: normalizedType,
154
- data: normalizedType === 'interactive_form'
155
- ? toInteractiveFormVisualization(visualization.data)
156
- : toAiCfoVisualizationData(visualization.data),
157
- };
158
- };
159
- const toInteractiveFormVisualization = (data) => {
160
- // When `form_type` is missing / mistyped, fall back to a payload-shape
161
- // heuristic instead of blindly defaulting to `cards_creation`. A
162
- // `card_policy` payload always carries `mode: 'auto' | 'guided' |
163
- // 'upload'` (see `CardPolicyInitialDataPayload`); a `cards_creation`
164
- // payload carries `suggested_cards` and never that exact `mode` set.
165
- // Without this, a card-policy answer with a malformed `form_type`
166
- // would be decoded as cards_creation, surfacing the wrong interactive
167
- // form (and wrong submit path) in the UI.
168
- const formType = toInteractiveFormTypeStrict(data.form_type) ??
169
- inferInteractiveFormTypeFromPayload(data.payload);
170
- if (formType === 'card_policy') {
171
- return {
172
- formType: 'card_policy',
173
- payload: toCardPolicyInitialData(data.payload),
174
- };
175
- }
176
- return {
177
- formType: 'cards_creation',
178
- payload: toCardsCreationInitialData(data.payload),
179
- };
180
- };
181
- const inferInteractiveFormTypeFromPayload = (payload) => {
182
- if (payload != null && typeof payload === 'object' && 'mode' in payload) {
183
- const mode = payload.mode;
184
- if (mode === 'auto' || mode === 'guided' || mode === 'upload') {
185
- return 'card_policy';
186
- }
187
- }
188
- return 'cards_creation';
189
- };
190
- /**
191
- * Decode the unified `cards_creation` interactive-form payload into the FE
192
- * state shape. Both `review` and `create` modes ship the same envelope
193
- * (`{mode, suggested_cards[]}`); the only thing that varies is how the
194
- * common derivations are exposed:
195
- *
196
- * - `review` (2-step): `is_suggested: true` rows -> `teamRows`; the full
197
- * universe -> `cardNameOptions` (step-2 swap + step-1 "Add something
198
- * else" search).
199
- * - `create` (1-step): `is_suggested: true` rows -> `cardRows` pre-seeded
200
- * for the step-2 editable table; the full universe -> `cardNameOptions`
201
- * (step-2 swap).
202
- */
203
- const toCardsCreationInitialData = (payload) => {
204
- const suggestedCards = payload.suggested_cards ?? [];
205
- const ordered = [...suggestedCards].sort((a, b) => KIND_RANK[a.card_type] - KIND_RANK[b.card_type]);
206
- const withUniqueIds = withSynthesizedIds(ordered);
207
- const suggestedOnly = withUniqueIds.filter(({ card }) => card.is_suggested);
208
- const cardNameOptions = withUniqueIds.map(({ card, uniqueId }) => ({
209
- id: uniqueId,
210
- kind: toCardKind(card.card_type),
211
- label: card.card_name,
212
- }));
213
- const suggestedOwnerUserIdByTeamId = Object.fromEntries(suggestedOnly.map(({ card, uniqueId }) => [
214
- uniqueId,
215
- normalizeOwnerId(card.owner_id),
216
- ]));
217
- const common = {
218
- cardNameOptions,
219
- suggestedOwnerUserIdByTeamId,
220
- };
221
- if (payload.mode === 'create') {
222
- return {
223
- ...common,
224
- mode: 'create',
225
- cardRows: suggestedOnly.map(({ card, uniqueId }) => ({
226
- cardKind: toCardKind(card.card_type),
227
- id: uniqueId,
228
- label: card.card_name,
229
- recommendedLimit: card.credit_limit > 0 ? card.credit_limit : undefined,
230
- suggestedOwnerUserId: normalizeOwnerId(card.owner_id),
231
- })),
232
- };
233
- }
234
138
  return {
235
- ...common,
236
- mode: 'review',
237
- teamRows: suggestedOnly.map(({ card, uniqueId }) => ({
238
- avgMonthlySpend: CURRENCY_FORMATTER.format(card.avg_spend),
239
- cardKind: toCardKind(card.card_type),
240
- id: uniqueId,
241
- label: card.card_name,
242
- recommendedLimit: CURRENCY_FORMATTER.format(card.credit_limit),
243
- recommendedLimitCadence: 'Monthly',
244
- })),
245
- };
246
- };
247
- const CURRENCY_FORMATTER = new Intl.NumberFormat('en-US', {
248
- style: 'currency',
249
- currency: 'USD',
250
- maximumFractionDigits: 0,
251
- });
252
- /**
253
- * Normalize the controller's `owner_id` into `string | undefined`. The
254
- * BE may emit either `null` or `""` to signal "no owner picked"; both
255
- * collapse to `undefined` so downstream resolvers don't try to look up
256
- * a user with an empty id.
257
- */
258
- const normalizeOwnerId = (ownerId) => (ownerId != null && ownerId !== '' ? ownerId : undefined);
259
- const KIND_RANK = {
260
- vendor: 0,
261
- category: 1,
262
- department: 2,
263
- };
264
- const toCardKind = (cardType) => {
265
- if (cardType === 'department') {
266
- return 'class';
267
- }
268
- if (cardType === 'category') {
269
- return 'category';
270
- }
271
- return 'vendor';
272
- };
273
- /**
274
- * Stamp each suggested card with a stable unique id derived from its
275
- * `card_name_id`. If two cards in the same payload share the same
276
- * `card_name_id` (which happens in the current sample payload where
277
- * `card_name_id` is the literal `"vendor_uuid"`), fall back to a
278
- * synthesized id `${kind}__${card_name_id}__${index}` so RHF row keying
279
- * stays unique.
280
- */
281
- const withSynthesizedIds = (cards) => {
282
- const seen = new Set();
283
- return cards.map((card, index) => {
284
- const preferred = card.card_name_id;
285
- if (preferred != null && preferred !== '' && !seen.has(preferred)) {
286
- seen.add(preferred);
287
- return { card, uniqueId: preferred };
288
- }
289
- const synthesized = `${card.card_type}__${preferred ?? 'unknown'}__${index}`;
290
- seen.add(synthesized);
291
- return { card, uniqueId: synthesized };
292
- });
293
- };
294
- const toCardPolicyDraftPolicy = (payload, index) => ({
295
- id: `draft-${index}`,
296
- name: payload.name,
297
- description: payload.description ?? '',
298
- mode: payload.mode,
299
- allowedEntity: {
300
- categoryCodes: payload.allowed_entity?.category_codes ?? [],
301
- merchantNames: payload.allowed_entity?.merchant_names ?? [],
302
- },
303
- blockedEntity: {
304
- categoryCodes: payload.blocked_entity?.category_codes ?? [],
305
- merchantNames: payload.blocked_entity?.merchant_names ?? [],
306
- },
307
- applyToCards: payload.apply_to_cards ?? [],
308
- requiredReceiptThreshold: payload.required_receipt_threshold ?? 0,
309
- spendLimits: {
310
- transaction: payload.spend_limits?.transaction ?? 0,
311
- },
312
- });
313
- const toCardPolicyStep5Review = (payload) => ({
314
- draftPolicies: (payload.draft_policies ?? []).map(toCardPolicyDraftPolicy),
315
- groupingSource: payload.grouping_source ?? 'none',
316
- prompt: payload.prompt ?? '',
317
- });
318
- const toCardPolicyWizardPlan = (payload) => ({
319
- step5Review: toCardPolicyStep5Review(payload.step_5_review),
320
- });
321
- const toCardPolicyUploadSource = (payload) => ({
322
- confidenceScore: payload.confidence_score,
323
- fileName: payload.file_name,
324
- lowConfidenceFields: payload.low_confidence_fields ?? [],
325
- });
326
- const toCardPolicyInitialData = (payload) => {
327
- if (payload.mode === 'upload') {
328
- return {
329
- policyKind: 'upload',
330
- wizardPlan: payload.wizard_plan != null
331
- ? toCardPolicyWizardPlan(payload.wizard_plan)
332
- : undefined,
333
- source: payload.source != null
334
- ? toCardPolicyUploadSource(payload.source)
335
- : undefined,
336
- };
337
- }
338
- return {
339
- policyKind: payload.mode,
340
- wizardPlan: toCardPolicyWizardPlan(payload.wizard_plan),
139
+ type: toAiCfoVisualizationTypeStrict(visualization.type) ?? 'table',
140
+ data: toAiCfoVisualizationData(visualization.data),
341
141
  };
342
142
  };
343
143
  const toAiCfoVisualizationData = (data) => {
@@ -653,118 +453,10 @@ const aiCfo = createSlice({
653
453
  session.questionAnswers.push(qa);
654
454
  }
655
455
  },
656
- /**
657
- * Patch the `card_policy` interactive-form payload for a specific
658
- * answer in a chat session to merge in the wizard plan + upload
659
- * source metadata returned by
660
- * `POST /cards/1.0/ai-cfo/policy-recommendation-from-upload`.
661
- *
662
- * Dispatched by the recommendation epic after a successful response;
663
- * the wizard re-renders Steps 2 + 3 of the upload variant once the
664
- * payload becomes a populated `CardPolicyInitialData` with
665
- * `policyKind: "upload"` + `wizardPlan` + `source`.
666
- *
667
- * No-op when the target answer / chat session / form payload is
668
- * missing or isn't an upload-mode card-policy interactive form —
669
- * the bridge epic is best-effort and silently drops in edge cases
670
- * (e.g. the user closed the chat before recommendation returned).
671
- */
672
- updateAiCfoAnswerCardPolicyWizardPlan(draft, action) {
673
- const { answerId, chatSessionId, source, wizardPlan } = action.payload;
674
- const session = draft.aiCfoByChatSessionId[chatSessionId];
675
- if (session == null) {
676
- return;
677
- }
678
- const qa = session.questionAnswers.find((entry) => entry.questionAnswerId === answerId);
679
- if (qa == null) {
680
- return;
681
- }
682
- for (const response of Object.values(qa.responses)) {
683
- const visualization = response?.content.visualization;
684
- if (visualization == null ||
685
- visualization.type !== 'interactive_form') {
686
- continue;
687
- }
688
- const data = visualization.data;
689
- if (data.formType !== 'card_policy' ||
690
- data.payload.policyKind !== 'upload') {
691
- continue;
692
- }
693
- data.payload = {
694
- ...data.payload,
695
- wizardPlan,
696
- source: source ?? data.payload.source,
697
- };
698
- }
699
- },
700
- /**
701
- * Append a client-synthesized answer bubble to a chat session. Used by
702
- * the AI CFO cards/policy create flow to render a "Creating…" placeholder
703
- * in the drawer while the underlying mutation runs.
704
- *
705
- * The caller is responsible for generating a stable `id` (so the same
706
- * bubble can later be updated in place via `updateSyntheticAiCfoAnswer`
707
- * once the mutation completes) and a `createdAt` timestamp so the
708
- * renderer can interleave synthetic bubbles with streamed Q&A pairs in
709
- * chronological order.
710
- */
711
- appendSyntheticAiCfoAnswer(draft, action) {
712
- const { chatSessionId, id, kind, createdAt, entityIds, sourceQuestionAnswerId, } = action.payload;
713
- if (draft.syntheticAnswersByChatSessionId[chatSessionId] == null) {
714
- draft.syntheticAnswersByChatSessionId[chatSessionId] = [];
715
- }
716
- draft.syntheticAnswersByChatSessionId[chatSessionId].push({
717
- id,
718
- kind,
719
- entityIds: entityIds ?? [],
720
- createdAt,
721
- sourceQuestionAnswerId,
722
- });
723
- },
724
- /**
725
- * Update an existing synthetic answer bubble in place. Typically called
726
- * when the create mutation completes: the screen transitions the bubble
727
- * from `creating_*` to `created_*` and populates `entityIds` with the
728
- * newly created cards / policy templates.
729
- *
730
- * No-op when the target bubble is missing (e.g. the session was cleared
731
- * before the mutation returned).
732
- */
733
- updateSyntheticAiCfoAnswer(draft, action) {
734
- const { chatSessionId, id, kind, entityIds } = action.payload;
735
- const list = draft.syntheticAnswersByChatSessionId[chatSessionId];
736
- if (list == null) {
737
- return;
738
- }
739
- const entry = list.find((item) => item.id === id);
740
- if (entry == null) {
741
- return;
742
- }
743
- entry.kind = kind;
744
- if (entityIds != null) {
745
- entry.entityIds = entityIds;
746
- }
747
- },
748
- /**
749
- * Remove a single synthetic answer bubble (e.g. when the user manually
750
- * dismisses it or the mutation errors out and we want to fall back to
751
- * an inline error snackbar).
752
- */
753
- removeSyntheticAiCfoAnswer(draft, action) {
754
- const { chatSessionId, id } = action.payload;
755
- const list = draft.syntheticAnswersByChatSessionId[chatSessionId];
756
- if (list == null) {
757
- return;
758
- }
759
- draft.syntheticAnswersByChatSessionId[chatSessionId] = list.filter((item) => item.id !== id);
760
- },
761
- clearSyntheticAiCfoAnswers(draft, action) {
762
- delete draft.syntheticAnswersByChatSessionId[action.payload];
763
- },
764
456
  clearSession(draft, action) {
765
457
  const sessionId = action.payload;
766
458
  delete draft.aiCfoByChatSessionId[sessionId];
767
- delete draft.syntheticAnswersByChatSessionId[sessionId];
459
+ // Clear partial Q&A if it belongs to the cleared session
768
460
  if (draft.partialQuestionAnswers?.[sessionId] != null) {
769
461
  draft.partialQuestionAnswers[sessionId] = undefined;
770
462
  }
@@ -772,7 +464,6 @@ const aiCfo = createSlice({
772
464
  clearAiCfo(draft) {
773
465
  draft.aiCfoByChatSessionId = {};
774
466
  draft.partialQuestionAnswers = {};
775
- draft.syntheticAnswersByChatSessionId = {};
776
467
  },
777
468
  deleteQuestion(draft, action) {
778
469
  const { chatSessionId, questionAnswerId } = action.payload;
@@ -785,12 +476,6 @@ const aiCfo = createSlice({
785
476
  if (idx !== -1) {
786
477
  session.questionAnswers.splice(idx, 1);
787
478
  }
788
- // Drop synthetic bubbles whose sourceQuestionAnswerId is the deleted Q/A; otherwise "Creating…" / "Created" tiles outlive their Q/A.
789
- const syntheticAnswers = draft.syntheticAnswersByChatSessionId[chatSessionId];
790
- if (syntheticAnswers != null) {
791
- draft.syntheticAnswersByChatSessionId[chatSessionId] =
792
- syntheticAnswers.filter((answer) => answer.sourceQuestionAnswerId !== questionAnswerId);
793
- }
794
479
  },
795
480
  },
796
481
  });
@@ -803,5 +488,5 @@ const toChatSession = (chatSessionPayload) => {
803
488
  createdAt: zeniDate(created_at),
804
489
  };
805
490
  };
806
- export const { setNewSession, clearSession, setSessions, setChatHistory, upsertAnswerPayload, upsertOrAddQuestionAnswerPayload, addQuestionPayload, clearAiCfo, deleteQuestion, updateAiCfoAnswerCardPolicyWizardPlan, appendSyntheticAiCfoAnswer, updateSyntheticAiCfoAnswer, removeSyntheticAiCfoAnswer, clearSyntheticAiCfoAnswers, } = aiCfo.actions;
491
+ export const { setNewSession, clearSession, setSessions, setChatHistory, upsertAnswerPayload, upsertOrAddQuestionAnswerPayload, addQuestionPayload, clearAiCfo, deleteQuestion, } = aiCfo.actions;
807
492
  export default aiCfo.reducer;
@@ -32,30 +32,5 @@ export function getAiCfoSelectorView(state) {
32
32
  : [],
33
33
  }))
34
34
  .sort((a, b) => b.chatSession.createdAt.valueOf() - a.chatSession.createdAt.valueOf());
35
- return {
36
- allSessionsWithOrderedQuestionAnswers,
37
- syntheticAnswersByChatSessionId: state.syntheticAnswersByChatSessionId ?? {},
38
- };
39
- }
40
- export function getSyntheticAiCfoAnswersForChatSession(state, chatSessionId) {
41
- const arr = state.syntheticAnswersByChatSessionId?.[chatSessionId] ?? [];
42
- return arr
43
- .slice()
44
- .sort((a, b) => a.createdAt.valueOf() - b.createdAt.valueOf());
45
- }
46
- /**
47
- * Look up the synthetic answer bubble (if any) whose source AI CFO Q/A
48
- * is `questionAnswerId`. Used by the in-place renderer to swap a Q/A's
49
- * answer bubble with the "Creating…" / "Created" tile.
50
- *
51
- * Returns `undefined` when no synthetic bubble has been dispatched for
52
- * the answer yet (i.e. the user hasn't submitted the interactive form),
53
- * or when the chat session has no synthetic entries at all.
54
- */
55
- export function getSyntheticAiCfoAnswerByQuestionAnswerId(state, chatSessionId, questionAnswerId) {
56
- const arr = state.syntheticAnswersByChatSessionId?.[chatSessionId];
57
- if (arr == null) {
58
- return undefined;
59
- }
60
- return arr.find((answer) => answer.sourceQuestionAnswerId === questionAnswerId);
35
+ return { allSessionsWithOrderedQuestionAnswers };
61
36
  }
@@ -7,14 +7,7 @@ export const ALL_AI_CFO_CHARTS_TYPES = [
7
7
  export const ALL_AI_CFO_VISUALIZATION_TYPES = [
8
8
  ...ALL_AI_CFO_CHARTS_TYPES,
9
9
  'table',
10
- 'interactive_form',
11
10
  ];
12
- export const ALL_INTERACTIVE_FORM_TYPES = [
13
- 'cards_creation',
14
- 'card_policy',
15
- ];
16
- export const toInteractiveFormType = (v) => stringToUnion(v, ALL_INTERACTIVE_FORM_TYPES);
17
- export const toInteractiveFormTypeStrict = (v) => stringToUnionStrict(v, ALL_INTERACTIVE_FORM_TYPES);
18
11
  export const toAiCfoVisualizationType = (v) => stringToUnion(v, ALL_AI_CFO_VISUALIZATION_TYPES);
19
12
  export const toAiCfoVisualizationTypeStrict = (v) => stringToUnionStrict(v, ALL_AI_CFO_VISUALIZATION_TYPES);
20
13
  export const toAiCfoChartType = (v) => stringToUnion(v, ALL_AI_CFO_CHARTS_TYPES);
@@ -65,16 +58,3 @@ export const toMessageSender = (v) => stringToUnion(v, ALL_MESSAGE_SENDERS);
65
58
  export const toMessageType = (v) => stringToUnion(v, ALL_MESSAGE_TYPES);
66
59
  export const toMessageSenderStrict = (v) => stringToUnionStrict(v, ALL_MESSAGE_SENDERS);
67
60
  export const toMessageTypeStrict = (v) => stringToUnionStrict(v, ALL_MESSAGE_TYPES);
68
- /**
69
- * Discriminator for client-synthesized AI CFO answer bubbles. These are not
70
- * Q/A pairs streamed from the backend — they are pushed locally by the AI
71
- * CFO flow when it kicks off a cards or policy create from an interactive
72
- * form, so the drawer can render a "Creating…" placeholder and later a
73
- * "Created" success bubble while the corresponding mutation epic runs.
74
- */
75
- export const ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS = [
76
- 'creating_cards',
77
- 'creating_policy',
78
- 'created_cards',
79
- 'created_policy',
80
- ];
@@ -328,7 +328,9 @@ const toCompanyOnboardingInfo = (payload) => ({
328
328
  onboardingUserIds: payload.onboarding_user_ids,
329
329
  isSubsidiary: payload.is_subsidiary,
330
330
  parentCompanyId: payload.parent_company_id != null ? payload.parent_company_id : undefined,
331
+ isOnboardingAiFinanceTeamAcknowledged: payload.is_onboarding_ai_finance_team_acknowledged ?? false,
331
332
  isOnboardingCompanyDetailsCompleted: payload.is_onboarding_company_details_step_completed,
333
+ onboardingAiFinanceTeamAcknowledgedBy: payload.onboarding_ai_finance_team_acknowledged_by ?? [],
332
334
  onboardingInfo: toOnboardingInfo(payload.onboarding_info),
333
335
  isOnboardingCompleted: payload.is_onboarding_completed,
334
336
  subscriptionBillingAddressId: payload.subscription_billing_address_id,
@@ -19,3 +19,6 @@ export function getPaymentAccountsByBankAccountIds(paymentAccountState, bankAcco
19
19
  .filter((value) => value != null);
20
20
  return paymentAccounts;
21
21
  }
22
+ export function getPlaidPaymentAccounts(paymentAccountState) {
23
+ return values(paymentAccountState.paymentAccountByID).filter((account) => account.provider === 'plaid');
24
+ }
@@ -95,9 +95,6 @@ const ALL_SNACKBAR_MESSAGE_SECTIONS = [
95
95
  'charge_card_receipt_upload',
96
96
  'charge_card_resend_invite',
97
97
  'charge_card_revoke_invite',
98
- 'card_policy_created',
99
- 'card_policy_updated',
100
- 'card_policy_deleted',
101
98
  'charge_card_update_limit',
102
99
  'charge_cards_update_limit',
103
100
  'close_charge_card',
@@ -208,6 +205,7 @@ const ALL_SNACKBAR_MESSAGE_SECTIONS = [
208
205
  'transactionCategorized_transactionUpdated_transactionsFailed',
209
206
  'transactionCategorized_transactionUpdated_transactionFailed',
210
207
  'accounting_classes_enabled_update',
208
+ 'capitalization_threshold_update',
211
209
  'account_excluded_from_reconciliation',
212
210
  'account_included_in_reconciliation',
213
211
  'ai_accountant_trigger_job',
@@ -97,9 +97,6 @@ import { clearInternationalWire } from '../../view/spendManagement/billPay/inter
97
97
  import { clearInternationalVerificationView } from '../../view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer';
98
98
  import { clearPreviousBills } from '../../view/spendManagement/billPay/previousBills/previousBillsReducer';
99
99
  import { clearWiseRedirectStatus } from '../../view/spendManagement/billPay/wiseRedirectView/wiseRedirectReducer';
100
- import { clearCardPolicyDetail } from '../../view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer';
101
- import { clearCardPolicyList } from '../../view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer';
102
- import { clearCreateCardPolicy } from '../../view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer';
103
100
  import { clearCardUserOnboarding } from '../../view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer';
104
101
  import { clearCashbackDetail } from '../../view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer';
105
102
  import { clearChargeCardConfig } from '../../view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer';
@@ -171,7 +168,6 @@ import { clearAllBillTransactions } from '../billPay/billTransaction/billTransac
171
168
  import { clearContacts } from '../billPay/contact/contactReducer';
172
169
  import { clearAllRecurringBills } from '../billPay/recurringBills/recurringBillsReducer';
173
170
  import { clearAllCardPayments } from '../cardPayment/cardPaymentReducer';
174
- import { clearCardPolicy } from '../cardPolicy/cardPolicyReducer';
175
171
  import { clearAllChargeCards } from '../chargeCard/chargeCardReducer';
176
172
  import { clearAllChargeCardRepayments } from '../chargeCardRepayment/chargeCardRepaymentReducer';
177
173
  import { clearAllChargeCardTransactions } from '../chargeCardTransaction/chargeCardTransactionReducer';
@@ -248,8 +244,6 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
248
244
  clearBillPaySetupView(),
249
245
  clearCardBalance(),
250
246
  clearCardPaymentView(),
251
- clearCardPolicyDetail(),
252
- clearCardPolicyList(),
253
247
  clearCardUserOnboarding(),
254
248
  clearCashbackDetail(),
255
249
  clearCashBalance(),
@@ -269,7 +263,6 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
269
263
  clearCompanyMonthEndReportView(),
270
264
  clearCompanyTaskManagerView(),
271
265
  clearCompanyView(),
272
- clearCreateCardPolicy(),
273
266
  clearCreateTransferEntry(),
274
267
  clearAllCreditAgent(),
275
268
  clearCreditAgentView(),
@@ -431,7 +424,6 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
431
424
  clearAllVendorExpenseTrends(),
432
425
  clearAllVendors(),
433
426
  clearCannedResponses(),
434
- clearCardPolicy(),
435
427
  clearClassList(),
436
428
  clearContacts(),
437
429
  clearCountryList(),
@@ -0,0 +1,50 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
4
+ import { initEmailConnectOAuth, initEmailConnectOAuthFailure, initEmailConnectOAuthSuccess, } from '../tenantReducer';
5
+ const defaultNavigate = (url) => {
6
+ // Production path: full-page redirect. The user's session continues on the
7
+ // provider's consent screen and lands back on this app via auth's HTML
8
+ // callback page (which itself redirects to redirect_after_url with the
9
+ // result encoded as a query param).
10
+ if (typeof window !== 'undefined') {
11
+ window.location.href = url;
12
+ }
13
+ };
14
+ // Backs the new POST /1.0/connectors/email/<provider>/init endpoint on the
15
+ // auth service. The endpoint creates a CSRF state token in the auth NDB
16
+ // store and returns the provider's authorization_url; this epic then drives
17
+ // a full-page redirect so the user lands on Google's / Microsoft's consent
18
+ // screen. After consent the user lands on auth's callback, which writes the
19
+ // resulting tokens through to tenant and redirects the browser back to
20
+ // ``redirectAfterUrl`` with ``?email_connect_result=<json>`` for the
21
+ // integrations page to consume on mount.
22
+ export const initEmailConnectOAuthEpic = (actions$, _state$, zeniAPI,
23
+ // Test seam: callers can override to assert intended URL without actually
24
+ // navigating. Default is full-page redirect via window.location.
25
+ navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match), switchMap((action) => zeniAPI
26
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
27
+ .pipe(mergeMap((response) => {
28
+ if (isSuccessResponse(response) && response.data != null) {
29
+ // Fire-and-forget side effect — once the browser navigates,
30
+ // any further state we'd dispatch here is irrelevant. We still
31
+ // emit the success action so subscribers (tests, analytics)
32
+ // can observe the URL the epic decided to navigate to.
33
+ navigate(response.data.authorization_url);
34
+ return from([
35
+ initEmailConnectOAuthSuccess(action.payload.tenantId, action.payload.provider, response.data.authorization_url),
36
+ ]);
37
+ }
38
+ const status = response.status ??
39
+ createZeniAPIStatus(`Failed to start ${action.payload.provider} connection. Please try again.`);
40
+ return from([
41
+ initEmailConnectOAuthFailure(action.payload.tenantId, action.payload.provider, status),
42
+ ]);
43
+ }), catchError((error) => {
44
+ const message = error instanceof Error
45
+ ? error.message
46
+ : `Unexpected error starting ${action.payload.provider} connection.`;
47
+ return from([
48
+ initEmailConnectOAuthFailure(action.payload.tenantId, action.payload.provider, createZeniAPIStatus(message)),
49
+ ]);
50
+ }))));