@zeniai/client-epic-state 5.0.92 → 5.0.93-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 (260) 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 +63 -5
  5. package/lib/entity/aiCfo/aiCfoReducer.d.ts +23 -2
  6. package/lib/entity/aiCfo/aiCfoReducer.js +249 -9
  7. package/lib/entity/aiCfo/aiCfoSelector.d.ts +4 -1
  8. package/lib/entity/aiCfo/aiCfoSelector.js +19 -1
  9. package/lib/entity/aiCfo/aiCfoState.d.ts +97 -4
  10. package/lib/entity/aiCfo/aiCfoState.js +18 -1
  11. package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +277 -0
  12. package/lib/entity/cardPolicy/cardPolicyPayload.js +143 -0
  13. package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +19 -0
  14. package/lib/entity/cardPolicy/cardPolicyReducer.js +175 -0
  15. package/lib/entity/cardPolicy/cardPolicySelector.d.ts +32 -0
  16. package/lib/entity/cardPolicy/cardPolicySelector.js +99 -0
  17. package/lib/entity/cardPolicy/cardPolicyState.d.ts +205 -0
  18. package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
  19. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
  20. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +68 -0
  21. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
  22. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
  23. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +25 -0
  24. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +39 -0
  25. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +24 -0
  26. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +105 -0
  27. package/lib/entity/company/companyPayload.d.ts +4 -0
  28. package/lib/entity/company/companyPayload.js +4 -0
  29. package/lib/entity/company/companyStateTypes.d.ts +4 -0
  30. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  31. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
  32. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  33. package/lib/entity/paymentAccount/paymentAccountSelector.js +4 -0
  34. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  35. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  36. package/lib/entity/tenant/clearAllEpic.d.ts +6 -2
  37. package/lib/entity/tenant/clearAllEpic.js +8 -0
  38. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  39. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  40. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
  41. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  42. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  43. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  44. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  45. package/lib/entity/tenant/tenantReducer.d.ts +38 -25
  46. package/lib/entity/tenant/tenantReducer.js +65 -5
  47. package/lib/entity/tenant/tenantState.d.ts +1 -0
  48. package/lib/epic.d.ts +19 -1
  49. package/lib/epic.js +20 -1
  50. package/lib/esm/commonStateTypes/animations.js +1 -0
  51. package/lib/esm/entity/aiCfo/aiCfoReducer.js +249 -9
  52. package/lib/esm/entity/aiCfo/aiCfoSelector.js +17 -1
  53. package/lib/esm/entity/aiCfo/aiCfoState.js +15 -0
  54. package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +130 -0
  55. package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +171 -0
  56. package/lib/esm/entity/cardPolicy/cardPolicySelector.js +75 -0
  57. package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
  58. package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +64 -0
  59. package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
  60. package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +35 -0
  61. package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +101 -0
  62. package/lib/esm/entity/company/companyPayload.js +4 -0
  63. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +3 -0
  64. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  65. package/lib/esm/entity/tenant/clearAllEpic.js +8 -0
  66. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
  67. package/lib/esm/entity/tenant/tenantReducer.js +63 -3
  68. package/lib/esm/epic.js +20 -1
  69. package/lib/esm/index.js +46 -13
  70. package/lib/esm/reducer.js +12 -0
  71. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +6 -3
  72. package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  73. package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +2 -1
  74. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  75. package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
  76. package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
  77. package/lib/esm/view/fileView/epic/updateFileNameEpic.js +2 -2
  78. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +42 -0
  79. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +29 -0
  80. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
  81. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +217 -50
  82. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +7 -1
  83. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +12 -0
  84. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +52 -0
  85. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
  86. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
  87. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +36 -0
  88. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +39 -0
  89. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +34 -0
  90. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +58 -0
  91. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
  92. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
  93. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +38 -0
  94. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +289 -0
  95. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +109 -0
  96. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +44 -0
  97. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +111 -0
  98. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +25 -0
  99. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +363 -0
  100. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +36 -0
  101. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +19 -0
  102. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +6 -0
  103. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +119 -0
  104. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +154 -0
  105. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +22 -0
  106. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
  107. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +39 -0
  108. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +140 -0
  109. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +20 -0
  110. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +100 -0
  111. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +96 -0
  112. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +59 -0
  113. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +24 -0
  114. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +25 -0
  115. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +1 -0
  116. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +34 -0
  117. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +57 -0
  118. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +35 -0
  119. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
  120. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +42 -4
  121. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +35 -0
  122. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +62 -0
  123. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +44 -0
  124. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +58 -0
  125. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +67 -0
  126. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +14 -0
  127. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
  128. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +105 -52
  129. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  130. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
  131. package/lib/index.d.ts +52 -14
  132. package/lib/index.js +219 -31
  133. package/lib/reducer.d.ts +12 -0
  134. package/lib/reducer.js +12 -0
  135. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +11 -2
  136. package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -3
  137. package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  138. package/lib/view/aiCfoView/epics/createSessionEpic.js +2 -1
  139. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -1
  140. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  141. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  142. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  143. package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
  144. package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
  145. package/lib/view/fileView/epic/updateFileNameEpic.js +1 -1
  146. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
  147. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +46 -0
  148. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +8 -0
  149. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +33 -0
  150. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
  151. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
  152. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
  153. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +41 -4
  154. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +219 -51
  155. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +5 -1
  156. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +11 -2
  157. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +40 -0
  158. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -1
  159. package/lib/view/people/peopleTypes.d.ts +1 -1
  160. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  161. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
  162. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +56 -0
  163. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +15 -0
  164. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
  165. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +8 -0
  166. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
  167. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +8 -0
  168. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +40 -0
  169. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +8 -0
  170. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +43 -0
  171. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +8 -0
  172. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +38 -0
  173. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
  174. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +62 -0
  175. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +15 -0
  176. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
  177. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +7 -0
  178. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
  179. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +8 -0
  180. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +42 -0
  181. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.d.ts +8 -0
  182. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +294 -0
  183. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.d.ts +8 -0
  184. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +113 -0
  185. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.d.ts +9 -0
  186. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +48 -0
  187. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.d.ts +8 -0
  188. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +115 -0
  189. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.d.ts +13 -0
  190. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +29 -0
  191. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.d.ts +14 -0
  192. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +369 -0
  193. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.d.ts +6 -0
  194. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +40 -0
  195. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.d.ts +7 -0
  196. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +26 -0
  197. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.d.ts +116 -0
  198. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +10 -0
  199. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.d.ts +33 -0
  200. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +126 -0
  201. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +52 -0
  202. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +158 -0
  203. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +11 -0
  204. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +31 -0
  205. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +12 -0
  206. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
  207. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +8 -0
  208. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +43 -0
  209. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.d.ts +10 -0
  210. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +144 -0
  211. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +7 -0
  212. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +24 -0
  213. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.d.ts +11 -0
  214. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +104 -0
  215. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.d.ts +22 -0
  216. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +100 -0
  217. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.d.ts +8 -0
  218. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +63 -0
  219. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.d.ts +3 -0
  220. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +28 -0
  221. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  222. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +14 -0
  223. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +27 -1
  224. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.d.ts +34 -0
  225. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +2 -0
  226. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.d.ts +7 -0
  227. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +38 -0
  228. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.d.ts +12 -0
  229. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +61 -0
  230. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.d.ts +9 -0
  231. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +39 -0
  232. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
  233. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
  234. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +12 -2
  235. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +43 -5
  236. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +7 -0
  237. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +42 -1
  238. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +5 -0
  239. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.d.ts +11 -0
  240. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +66 -0
  241. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.d.ts +3 -0
  242. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +48 -0
  243. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +28 -0
  244. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +62 -0
  245. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +30 -0
  246. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +71 -0
  247. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +33 -0
  248. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +17 -0
  249. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
  250. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
  251. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +28 -2
  252. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +106 -53
  253. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +7 -2
  254. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  255. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +19 -0
  256. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +142 -0
  257. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
  258. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
  259. package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +1 -1
  260. package/package.json +1 -1
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Pure mappers from ExtendAI parser payloads to our form-side local-data shapes.
3
+ *
4
+ * Each mapper filters out fields below KYC_KYB_AUTOFILL_MIN_CONFIDENCE and returns
5
+ * both the merged values and the list of field names that were autofilled so the
6
+ * UI can show the ✦ AI badge next to each.
7
+ */
8
+ import { Country } from '../../../entity/countryList/countryListState';
9
+ import { CompanyDetailsLocalData, CompanyOfficerLocalData } from './setupViewState';
10
+ import { ExtendCertificateOfIncorporationParsed, ExtendDrivingLicenseParsed, ExtendPassportParsed, ExtendSsnCardParsed, ExtendTaxEinParsed } from './types/kycKybAutofill';
11
+ export interface AutofillResult<TLocalData> {
12
+ autoFilledFieldNames: (keyof TLocalData & string)[];
13
+ values: Partial<TLocalData>;
14
+ }
15
+ /** Passport → Company Officer. */
16
+ export declare const mapPassportToOfficer: (parsed: ExtendPassportParsed, allNationalityCountries: Country[]) => AutofillResult<CompanyOfficerLocalData>;
17
+ /** Driving License → Company Officer. */
18
+ export declare const mapDrivingLicenseToOfficer: (parsed: ExtendDrivingLicenseParsed) => AutofillResult<CompanyOfficerLocalData>;
19
+ /** SSN Card → Company Officer (name only — SSN value not yet returned by parser). */
20
+ export declare const mapSsnCardToOfficer: (parsed: ExtendSsnCardParsed) => AutofillResult<CompanyOfficerLocalData>;
21
+ /** Certificate of Incorporation → Company Details. */
22
+ export declare const mapCoiToCompanyDetails: (parsed: ExtendCertificateOfIncorporationParsed) => AutofillResult<CompanyDetailsLocalData>;
23
+ /** Tax EIN letter → Company Details. */
24
+ export declare const mapTaxEinToCompanyDetails: (parsed: ExtendTaxEinParsed) => AutofillResult<CompanyDetailsLocalData>;
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ /**
3
+ * Pure mappers from ExtendAI parser payloads to our form-side local-data shapes.
4
+ *
5
+ * Each mapper filters out fields below KYC_KYB_AUTOFILL_MIN_CONFIDENCE and returns
6
+ * both the merged values and the list of field names that were autofilled so the
7
+ * UI can show the ✦ AI badge next to each.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.mapTaxEinToCompanyDetails = exports.mapCoiToCompanyDetails = exports.mapSsnCardToOfficer = exports.mapDrivingLicenseToOfficer = exports.mapPassportToOfficer = void 0;
11
+ const zeniDayJS_1 = require("../../../zeniDayJS");
12
+ const zeniUrl_1 = require("../../../zeniUrl");
13
+ const kycKybAutofill_1 = require("./types/kycKybAutofill");
14
+ const emptyResult = () => ({
15
+ values: {},
16
+ autoFilledFieldNames: [],
17
+ });
18
+ const isConfident = (field) => {
19
+ if (field == null) {
20
+ return false;
21
+ }
22
+ if (field.value == null) {
23
+ return false;
24
+ }
25
+ return field.confidence >= kycKybAutofill_1.KYC_KYB_AUTOFILL_MIN_CONFIDENCE;
26
+ };
27
+ const assignAutofilledValue = (result, key, value) => {
28
+ if (value == null) {
29
+ return;
30
+ }
31
+ if (typeof value === 'string' && value.trim() === '') {
32
+ return;
33
+ }
34
+ result.values[key] = value;
35
+ result.autoFilledFieldNames.push(key);
36
+ };
37
+ const tryParseDate = (rawDate) => {
38
+ const parsedDate = (0, zeniDayJS_1.date)(rawDate);
39
+ if (parsedDate.isValid()) {
40
+ return parsedDate;
41
+ }
42
+ return undefined;
43
+ };
44
+ const normalizeNationality = (rawNationality, countries) => {
45
+ const needle = rawNationality.trim().toLowerCase();
46
+ if (needle === '') {
47
+ return undefined;
48
+ }
49
+ // Exact ISO-2 / ISO-3 match.
50
+ const isoMatch = countries.find((country) => country.countryCode.toLowerCase() === needle);
51
+ if (isoMatch != null) {
52
+ return isoMatch.countryCode;
53
+ }
54
+ // Common nationality adjectives map to country names (e.g. "American" → "United States").
55
+ const adjectiveToCountry = {
56
+ american: 'united states',
57
+ british: 'united kingdom',
58
+ indian: 'india',
59
+ canadian: 'canada',
60
+ australian: 'australia',
61
+ german: 'germany',
62
+ french: 'france',
63
+ chinese: 'china',
64
+ japanese: 'japan',
65
+ mexican: 'mexico',
66
+ brazilian: 'brazil',
67
+ };
68
+ const resolvedName = adjectiveToCountry[needle] ?? needle;
69
+ const nameMatch = countries.find((country) => country.countryName.toLowerCase() === resolvedName);
70
+ return nameMatch?.countryCode;
71
+ };
72
+ const splitFullName = (fullName) => {
73
+ const parts = fullName.trim().split(/\s+/);
74
+ if (parts.length === 1) {
75
+ return { firstName: parts[0], lastName: '' };
76
+ }
77
+ const lastName = parts[parts.length - 1];
78
+ const firstName = parts.slice(0, -1).join(' ');
79
+ return { firstName, lastName };
80
+ };
81
+ /** Passport → Company Officer. */
82
+ const mapPassportToOfficer = (parsed, allNationalityCountries) => {
83
+ const result = emptyResult();
84
+ if (isConfident(parsed.first_name)) {
85
+ assignAutofilledValue(result, 'firstName', parsed.first_name.value);
86
+ }
87
+ if (isConfident(parsed.last_name)) {
88
+ assignAutofilledValue(result, 'lastName', parsed.last_name.value);
89
+ }
90
+ if (isConfident(parsed.date_of_birth)) {
91
+ const parsedDate = tryParseDate(parsed.date_of_birth.value);
92
+ if (parsedDate != null) {
93
+ assignAutofilledValue(result, 'birthday', parsedDate);
94
+ }
95
+ }
96
+ if (isConfident(parsed.nationality)) {
97
+ const isoCode = normalizeNationality(parsed.nationality.value, allNationalityCountries);
98
+ if (isoCode != null) {
99
+ assignAutofilledValue(result, 'nationalityCountryCode', isoCode);
100
+ }
101
+ }
102
+ return result;
103
+ };
104
+ exports.mapPassportToOfficer = mapPassportToOfficer;
105
+ /** Driving License → Company Officer. */
106
+ const mapDrivingLicenseToOfficer = (parsed) => {
107
+ const result = emptyResult();
108
+ if (isConfident(parsed.first_name)) {
109
+ assignAutofilledValue(result, 'firstName', parsed.first_name.value);
110
+ }
111
+ if (isConfident(parsed.last_name)) {
112
+ assignAutofilledValue(result, 'lastName', parsed.last_name.value);
113
+ }
114
+ if (isConfident(parsed.date_of_birth)) {
115
+ const parsedDate = tryParseDate(parsed.date_of_birth.value);
116
+ if (parsedDate != null) {
117
+ assignAutofilledValue(result, 'birthday', parsedDate);
118
+ }
119
+ }
120
+ // address_* fields are mapped at a higher layer (addressView reducer) — kept here as values
121
+ // only, the consuming epic dispatches the address payload separately.
122
+ return result;
123
+ };
124
+ exports.mapDrivingLicenseToOfficer = mapDrivingLicenseToOfficer;
125
+ /** SSN Card → Company Officer (name only — SSN value not yet returned by parser). */
126
+ const mapSsnCardToOfficer = (parsed) => {
127
+ const result = emptyResult();
128
+ if (isConfident(parsed.full_name)) {
129
+ const { firstName, lastName } = splitFullName(parsed.full_name.value);
130
+ if (firstName !== '') {
131
+ assignAutofilledValue(result, 'firstName', firstName);
132
+ }
133
+ if (lastName !== '') {
134
+ assignAutofilledValue(result, 'lastName', lastName);
135
+ }
136
+ }
137
+ return result;
138
+ };
139
+ exports.mapSsnCardToOfficer = mapSsnCardToOfficer;
140
+ /** Certificate of Incorporation → Company Details. */
141
+ const mapCoiToCompanyDetails = (parsed) => {
142
+ const result = emptyResult();
143
+ if (isConfident(parsed.company_legal_name)) {
144
+ assignAutofilledValue(result, 'companyLegalName', parsed.company_legal_name.value);
145
+ }
146
+ if (isConfident(parsed.ein)) {
147
+ assignAutofilledValue(result, 'taxIdOrEIN', parsed.ein.value);
148
+ }
149
+ if (isConfident(parsed.phone_number)) {
150
+ assignAutofilledValue(result, 'phone', parsed.phone_number.value);
151
+ }
152
+ if (isConfident(parsed.product_description)) {
153
+ assignAutofilledValue(result, 'companyDescription', parsed.product_description.value);
154
+ }
155
+ if (isConfident(parsed.website)) {
156
+ try {
157
+ assignAutofilledValue(result, 'website', (0, zeniUrl_1.toZeniUrl)(parsed.website.value));
158
+ }
159
+ catch {
160
+ // ignore — malformed URL string from OCR
161
+ }
162
+ }
163
+ if (isConfident(parsed.industry)) {
164
+ assignAutofilledValue(result, 'companyIndustryType', parsed.industry.value);
165
+ }
166
+ if (isConfident(parsed.sub_industry)) {
167
+ assignAutofilledValue(result, 'companySubIndustry', parsed.sub_industry.value);
168
+ }
169
+ if (isConfident(parsed.type_of_incorporation)) {
170
+ assignAutofilledValue(result, 'typeOfIncorporation', parsed.type_of_incorporation.value);
171
+ }
172
+ if (isConfident(parsed.date_of_incorporation)) {
173
+ const parsedDate = tryParseDate(parsed.date_of_incorporation.value);
174
+ if (parsedDate != null) {
175
+ assignAutofilledValue(result, 'incDate', parsedDate);
176
+ }
177
+ }
178
+ if (isConfident(parsed.state_of_incorporation)) {
179
+ assignAutofilledValue(result, 'stateOfIncorporation', parsed.state_of_incorporation.value);
180
+ }
181
+ if (isConfident(parsed.countries_of_operations)) {
182
+ assignAutofilledValue(result, 'countriesOfOperations', parsed.countries_of_operations.value);
183
+ }
184
+ if (isConfident(parsed.source_of_funds)) {
185
+ assignAutofilledValue(result, 'sourceOfFunds', parsed.source_of_funds.value);
186
+ }
187
+ if (isConfident(parsed.transaction_volume_expectations)) {
188
+ assignAutofilledValue(result, 'transactionVolume', parsed.transaction_volume_expectations.value);
189
+ }
190
+ if (isConfident(parsed.purpose_of_account)) {
191
+ assignAutofilledValue(result, 'purposeOfAccount', parsed.purpose_of_account.value);
192
+ }
193
+ if (isConfident(parsed.regulated_status)) {
194
+ assignAutofilledValue(result, 'regulatedStatus', parsed.regulated_status.value);
195
+ }
196
+ if (isConfident(parsed.us_nexus)) {
197
+ assignAutofilledValue(result, 'usNexus', parsed.us_nexus.value);
198
+ }
199
+ return result;
200
+ };
201
+ exports.mapCoiToCompanyDetails = mapCoiToCompanyDetails;
202
+ /** Tax EIN letter → Company Details. */
203
+ const mapTaxEinToCompanyDetails = (parsed) => {
204
+ const result = emptyResult();
205
+ if (isConfident(parsed.legal_business_name)) {
206
+ assignAutofilledValue(result, 'companyLegalName', parsed.legal_business_name.value);
207
+ }
208
+ if (isConfident(parsed.ein)) {
209
+ assignAutofilledValue(result, 'taxIdOrEIN', parsed.ein.value);
210
+ }
211
+ return result;
212
+ };
213
+ exports.mapTaxEinToCompanyDetails = mapTaxEinToCompanyDetails;
@@ -2,7 +2,7 @@ import { ID } from '../../../commonStateTypes/common';
2
2
  import { ZeniAPIStatus } from '../../../responsePayload';
3
3
  import { ZeniDate } from '../../../zeniDayJS';
4
4
  import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
5
- import { CompanyDetailsLocalData, SetupViewLocalData, SetupViewState } from './setupViewState';
5
+ import { CompanyDetailsLocalData, CompanyOfficerLocalData, SetupViewLocalData, SetupViewState } from './setupViewState';
6
6
  export declare const initialState: SetupViewState;
7
7
  export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "zeni_treasury" | "charge_cards" | "other_connection" | "billing" | "debit_cards" | "charge_cards__debit_cards"], {
8
8
  companyId: string;
@@ -29,6 +29,32 @@ export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPr
29
29
  }, "setupView/sendOtpSuccess">, sendOtpFailureSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "setupView/sendOtpFailure">, verifyOtpSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/verifyOtp">, verifyOtpSuccessSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/verifyOtpSuccess">, verifyOtpFailureSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "setupView/verifyOtpFailure">, saveIndustryAndIncDateInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
30
30
  incDate: ZeniDate;
31
31
  industry: string;
32
- }, "setupView/saveIndustryAndIncDateInLocalStore">, clearSetupViewDataInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupViewDataInLocalStore">, clearSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupView">;
32
+ }, "setupView/saveIndustryAndIncDateInLocalStore">, clearSetupViewDataInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupViewDataInLocalStore">, clearSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupView">, applyKycDocumentAutofillForSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
33
+ autoFilledFieldNames: string[];
34
+ companyId: ID;
35
+ fileId: ID;
36
+ officerType: CompanyOfficerType;
37
+ values: Partial<CompanyOfficerLocalData>;
38
+ }], {
39
+ autoFilledFieldNames: string[];
40
+ companyId: ID;
41
+ fileId: ID;
42
+ officerType: CompanyOfficerType;
43
+ values: Partial<CompanyOfficerLocalData>;
44
+ }, "setupView/applyKycDocumentAutofillForSetup", never, never>, applyKybDocumentAutofillForSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
45
+ autoFilledFieldNames: string[];
46
+ companyId: ID;
47
+ fileId: ID;
48
+ values: Partial<CompanyDetailsLocalData>;
49
+ }], {
50
+ autoFilledFieldNames: string[];
51
+ companyId: ID;
52
+ fileId: ID;
53
+ values: Partial<CompanyDetailsLocalData>;
54
+ }, "setupView/applyKybDocumentAutofillForSetup", never, never>, clearKycKybAutofillForSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload?: {
55
+ officerType?: CompanyOfficerType;
56
+ } | undefined], {
57
+ officerType?: CompanyOfficerType;
58
+ }, "setupView/clearKycKybAutofillForSetup", never, never>;
33
59
  declare const _default: import("redux").Reducer<SetupViewState>;
34
60
  export default _default;
@@ -1,66 +1,34 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearSetupView = exports.clearSetupViewDataInLocalStore = exports.saveIndustryAndIncDateInLocalStore = exports.verifyOtpFailureSpendManagementSetUp = exports.verifyOtpSuccessSpendManagementSetUp = exports.verifyOtpSpendManagementSetUp = exports.sendOtpFailureSpendManagementSetUp = exports.sendOtpSuccessSpendManagementSetUp = exports.resendOtpSpendManagementSetUp = exports.sendOtpSpendManagementSetUp = exports.saveTreasuryAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerPhoneInLocalStore = exports.saveSetupViewDataInLocalStore = exports.updateSetupViewLocalStoreData = exports.updateSelectedCompanyOfficer = exports.updateBusinessVerificationDetailsFailure = exports.updateBusinessVerificationDetailsSuccess = exports.updateBusinessVerificationDetails = exports.enableSetupFailure = exports.enableSetupSuccess = exports.enableSetup = exports.initialState = void 0;
4
+ exports.clearKycKybAutofillForSetup = exports.applyKybDocumentAutofillForSetup = exports.applyKycDocumentAutofillForSetup = exports.clearSetupView = exports.clearSetupViewDataInLocalStore = exports.saveIndustryAndIncDateInLocalStore = exports.verifyOtpFailureSpendManagementSetUp = exports.verifyOtpSuccessSpendManagementSetUp = exports.verifyOtpSpendManagementSetUp = exports.sendOtpFailureSpendManagementSetUp = exports.sendOtpSuccessSpendManagementSetUp = exports.resendOtpSpendManagementSetUp = exports.sendOtpSpendManagementSetUp = exports.saveTreasuryAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerPhoneInLocalStore = exports.saveSetupViewDataInLocalStore = exports.updateSetupViewLocalStoreData = exports.updateSelectedCompanyOfficer = exports.updateBusinessVerificationDetailsFailure = exports.updateBusinessVerificationDetailsSuccess = exports.updateBusinessVerificationDetails = exports.enableSetupFailure = exports.enableSetupSuccess = exports.enableSetup = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
+ const kycKybAutofillActions_1 = require("./kycKybAutofillActions");
6
7
  const initialFetchStatus = {
7
8
  fetchState: 'Not-Started',
8
9
  error: undefined,
9
10
  };
11
+ const emptyOfficerSlot = {
12
+ autoFilledFields: [],
13
+ localData: undefined,
14
+ sendOtpStatus: initialFetchStatus,
15
+ otpverificationStatus: initialFetchStatus,
16
+ };
10
17
  exports.initialState = {
11
18
  updateStatus: { fetchState: 'Not-Started', error: undefined },
12
- companyDetails: {},
19
+ parsingDocumentFileIds: [],
20
+ companyDetails: { autoFilledFields: [] },
13
21
  companyOfficerUpdateStatus: {
14
- Officer_1: {
15
- localData: undefined,
16
- sendOtpStatus: initialFetchStatus,
17
- otpverificationStatus: initialFetchStatus,
18
- },
19
- Officer_2: {
20
- localData: undefined,
21
- sendOtpStatus: initialFetchStatus,
22
- otpverificationStatus: initialFetchStatus,
23
- },
24
- Officer_3: {
25
- localData: undefined,
26
- sendOtpStatus: initialFetchStatus,
27
- otpverificationStatus: initialFetchStatus,
28
- },
29
- Officer_4: {
30
- localData: undefined,
31
- sendOtpStatus: initialFetchStatus,
32
- otpverificationStatus: initialFetchStatus,
33
- },
34
- Officer_5: {
35
- localData: undefined,
36
- sendOtpStatus: initialFetchStatus,
37
- otpverificationStatus: initialFetchStatus,
38
- },
39
- Officer_6: {
40
- localData: undefined,
41
- sendOtpStatus: initialFetchStatus,
42
- otpverificationStatus: initialFetchStatus,
43
- },
44
- Officer_7: {
45
- localData: undefined,
46
- sendOtpStatus: initialFetchStatus,
47
- otpverificationStatus: initialFetchStatus,
48
- },
49
- Officer_8: {
50
- localData: undefined,
51
- sendOtpStatus: initialFetchStatus,
52
- otpverificationStatus: initialFetchStatus,
53
- },
54
- Officer_9: {
55
- localData: undefined,
56
- sendOtpStatus: initialFetchStatus,
57
- otpverificationStatus: initialFetchStatus,
58
- },
59
- Officer_10: {
60
- localData: undefined,
61
- sendOtpStatus: initialFetchStatus,
62
- otpverificationStatus: initialFetchStatus,
63
- },
22
+ Officer_1: { ...emptyOfficerSlot },
23
+ Officer_2: { ...emptyOfficerSlot },
24
+ Officer_3: { ...emptyOfficerSlot },
25
+ Officer_4: { ...emptyOfficerSlot },
26
+ Officer_5: { ...emptyOfficerSlot },
27
+ Officer_6: { ...emptyOfficerSlot },
28
+ Officer_7: { ...emptyOfficerSlot },
29
+ Officer_8: { ...emptyOfficerSlot },
30
+ Officer_9: { ...emptyOfficerSlot },
31
+ Officer_10: { ...emptyOfficerSlot },
64
32
  },
65
33
  primaryContactDetails: {},
66
34
  };
@@ -301,7 +269,92 @@ const setupView = (0, toolkit_1.createSlice)({
301
269
  clearSetupView(draft) {
302
270
  Object.assign(draft, exports.initialState);
303
271
  },
272
+ /**
273
+ * Merge AI-parsed officer fields into the selected officer's localData and
274
+ * track which field names were autofilled so the form can show the ✦ badge.
275
+ */
276
+ applyKycDocumentAutofillForSetup: {
277
+ reducer(draft, action) {
278
+ const { officerType, values, autoFilledFieldNames, fileId } = action.payload;
279
+ const slot = draft.companyOfficerUpdateStatus[officerType];
280
+ slot.localData = Object.assign({}, slot.localData, values);
281
+ slot.autoFilledFields = Array.from(new Set([...slot.autoFilledFields, ...autoFilledFieldNames]));
282
+ draft.parsingDocumentFileIds = draft.parsingDocumentFileIds.filter((id) => id !== fileId);
283
+ },
284
+ prepare(payload) {
285
+ return { payload };
286
+ },
287
+ },
288
+ /**
289
+ * Merge AI-parsed company fields into companyDetails.localData and track
290
+ * which field names were autofilled.
291
+ */
292
+ applyKybDocumentAutofillForSetup: {
293
+ reducer(draft, action) {
294
+ const { values, autoFilledFieldNames, fileId } = action.payload;
295
+ draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
296
+ draft.companyDetails.autoFilledFields = Array.from(new Set([
297
+ ...draft.companyDetails.autoFilledFields,
298
+ ...autoFilledFieldNames,
299
+ ]));
300
+ draft.parsingDocumentFileIds = draft.parsingDocumentFileIds.filter((id) => id !== fileId);
301
+ },
302
+ prepare(payload) {
303
+ return { payload };
304
+ },
305
+ },
306
+ /**
307
+ * Wipe AI-autofill badges. If `officerType` is provided, clears only that
308
+ * officer; otherwise clears company details too.
309
+ */
310
+ clearKycKybAutofillForSetup: {
311
+ reducer(draft, action) {
312
+ const { officerType } = action.payload;
313
+ if (officerType != null) {
314
+ draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
315
+ }
316
+ else {
317
+ draft.companyDetails.autoFilledFields = [];
318
+ Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
319
+ draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
320
+ });
321
+ }
322
+ },
323
+ prepare(payload = {}) {
324
+ return { payload };
325
+ },
326
+ },
327
+ },
328
+ extraReducers: (builder) => {
329
+ const addParsingFileId = (draft, fileId) => {
330
+ if (!draft.parsingDocumentFileIds.includes(fileId)) {
331
+ draft.parsingDocumentFileIds.push(fileId);
332
+ }
333
+ };
334
+ const removeParsingFileId = (draft, fileId) => {
335
+ draft.parsingDocumentFileIds = draft.parsingDocumentFileIds.filter((id) => id !== fileId);
336
+ };
337
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocument, (draft, action) => {
338
+ if (action.payload.target === 'setup') {
339
+ addParsingFileId(draft, action.payload.fileId);
340
+ }
341
+ });
342
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocument, (draft, action) => {
343
+ if (action.payload.target === 'setup') {
344
+ addParsingFileId(draft, action.payload.fileId);
345
+ }
346
+ });
347
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocumentFailure, (draft, action) => {
348
+ if (action.payload.target === 'setup') {
349
+ removeParsingFileId(draft, action.payload.fileId);
350
+ }
351
+ });
352
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocumentFailure, (draft, action) => {
353
+ if (action.payload.target === 'setup') {
354
+ removeParsingFileId(draft, action.payload.fileId);
355
+ }
356
+ });
304
357
  },
305
358
  });
306
- _a = setupView.actions, exports.enableSetup = _a.enableSetup, exports.enableSetupSuccess = _a.enableSetupSuccess, exports.enableSetupFailure = _a.enableSetupFailure, exports.updateBusinessVerificationDetails = _a.updateBusinessVerificationDetails, exports.updateBusinessVerificationDetailsSuccess = _a.updateBusinessVerificationDetailsSuccess, exports.updateBusinessVerificationDetailsFailure = _a.updateBusinessVerificationDetailsFailure, exports.updateSelectedCompanyOfficer = _a.updateSelectedCompanyOfficer, exports.updateSetupViewLocalStoreData = _a.updateSetupViewLocalStoreData, exports.saveSetupViewDataInLocalStore = _a.saveSetupViewDataInLocalStore, exports.saveCompnayOfficerPhoneInLocalStore = _a.saveCompnayOfficerPhoneInLocalStore, exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = _a.saveCompnayOfficerAdditionalDocumentsInLocalStore, exports.saveTreasuryAdditionalDocumentsInLocalStore = _a.saveTreasuryAdditionalDocumentsInLocalStore, exports.sendOtpSpendManagementSetUp = _a.sendOtp, exports.resendOtpSpendManagementSetUp = _a.resendOtp, exports.sendOtpSuccessSpendManagementSetUp = _a.sendOtpSuccess, exports.sendOtpFailureSpendManagementSetUp = _a.sendOtpFailure, exports.verifyOtpSpendManagementSetUp = _a.verifyOtp, exports.verifyOtpSuccessSpendManagementSetUp = _a.verifyOtpSuccess, exports.verifyOtpFailureSpendManagementSetUp = _a.verifyOtpFailure, exports.saveIndustryAndIncDateInLocalStore = _a.saveIndustryAndIncDateInLocalStore, exports.clearSetupViewDataInLocalStore = _a.clearSetupViewDataInLocalStore, exports.clearSetupView = _a.clearSetupView;
359
+ _a = setupView.actions, exports.enableSetup = _a.enableSetup, exports.enableSetupSuccess = _a.enableSetupSuccess, exports.enableSetupFailure = _a.enableSetupFailure, exports.updateBusinessVerificationDetails = _a.updateBusinessVerificationDetails, exports.updateBusinessVerificationDetailsSuccess = _a.updateBusinessVerificationDetailsSuccess, exports.updateBusinessVerificationDetailsFailure = _a.updateBusinessVerificationDetailsFailure, exports.updateSelectedCompanyOfficer = _a.updateSelectedCompanyOfficer, exports.updateSetupViewLocalStoreData = _a.updateSetupViewLocalStoreData, exports.saveSetupViewDataInLocalStore = _a.saveSetupViewDataInLocalStore, exports.saveCompnayOfficerPhoneInLocalStore = _a.saveCompnayOfficerPhoneInLocalStore, exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = _a.saveCompnayOfficerAdditionalDocumentsInLocalStore, exports.saveTreasuryAdditionalDocumentsInLocalStore = _a.saveTreasuryAdditionalDocumentsInLocalStore, exports.sendOtpSpendManagementSetUp = _a.sendOtp, exports.resendOtpSpendManagementSetUp = _a.resendOtp, exports.sendOtpSuccessSpendManagementSetUp = _a.sendOtpSuccess, exports.sendOtpFailureSpendManagementSetUp = _a.sendOtpFailure, exports.verifyOtpSpendManagementSetUp = _a.verifyOtp, exports.verifyOtpSuccessSpendManagementSetUp = _a.verifyOtpSuccess, exports.verifyOtpFailureSpendManagementSetUp = _a.verifyOtpFailure, exports.saveIndustryAndIncDateInLocalStore = _a.saveIndustryAndIncDateInLocalStore, exports.clearSetupViewDataInLocalStore = _a.clearSetupViewDataInLocalStore, exports.clearSetupView = _a.clearSetupView, exports.applyKycDocumentAutofillForSetup = _a.applyKycDocumentAutofillForSetup, exports.applyKybDocumentAutofillForSetup = _a.applyKybDocumentAutofillForSetup, exports.clearKycKybAutofillForSetup = _a.clearKycKybAutofillForSetup;
307
360
  exports.default = setupView.reducer;
@@ -16,7 +16,7 @@ import { CompanyOfficerType } from '../../companyView/types/companyPassport/comp
16
16
  import { CompanyView } from '../../companyView/types/companyView';
17
17
  import { AccountTypeSubConfigCodeKeyType } from '../billPay/billPayConfig/billPayConfigState';
18
18
  import { PlaidAccountKeyType, PlaidConnectionDetails } from '../plaidAccount/plaidAccountViewState';
19
- import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewType } from './setupViewState';
19
+ import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewState, SetupViewType } from './setupViewState';
20
20
  export interface SetupView {
21
21
  accountFetchStatus: FetchStateAndError;
22
22
  accountUpdateStatus: FetchStateAndError;
@@ -54,6 +54,8 @@ export interface FundingAccount {
54
54
  }
55
55
  export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
56
56
  additionalFiles: File[];
57
+ /** Field names in this officer's localData populated by AI doc autofill. */
58
+ autoFilledFields: string[];
57
59
  deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
58
60
  otpverificationStatus: FetchStateAndError;
59
61
  sendOtpStatus: FetchStateAndError;
@@ -62,6 +64,8 @@ export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
62
64
  addressStatus?: NewAddressData;
63
65
  }
64
66
  export interface CompanyDetails {
67
+ /** Field names in companyDetails localData populated by AI doc autofill. */
68
+ autoFilledFields: string[];
65
69
  companyFiles: File[];
66
70
  companyId: ID;
67
71
  deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
@@ -96,6 +100,7 @@ export interface CompanyDetails {
96
100
  }
97
101
  interface CompanyAndOfficerLocalData {
98
102
  companyOfficerLocalData: Record<CompanyOfficerType, CompanyOfficersDetails | undefined>;
103
+ parsingDocumentFileIds: ID[];
99
104
  companyDetailsLocalData?: CompanyDetails;
100
105
  }
101
106
  export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData {
@@ -105,7 +110,7 @@ export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData
105
110
  }
106
111
  export declare function getCommonSetupViewDetails(state: RootState, companyId: ID, setupViewType: SetupViewType, plaidAccountKeyType: PlaidAccountKeyType): SetupView;
107
112
  export declare function getBusinessVerificationDetails(state: RootState, companyId: ID): BusinessVerificationDetails;
108
- export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails) => CompanyAndOfficerLocalData;
113
+ export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails & Pick<SetupViewState, "parsingDocumentFileIds">) => CompanyAndOfficerLocalData;
109
114
  export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[], paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>, includeOnlyVerifiedAccounts?: boolean) => FundingAccount[];
110
115
  export declare const mapDepositAccToFundingAccount: (depositAcc: DepositAccount) => FundingAccount;
111
116
  export declare const mapDepositAccountWithLimitToFundingAccount: (depositAcc: DepositAccountWithLimit) => FundingAccount;
@@ -92,15 +92,17 @@ function getBusinessVerificationDetails(state, companyId) {
92
92
  const { setupViewState, countryListState } = state;
93
93
  const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, updateStatus, } = setupViewState;
94
94
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
95
- const { companyDetailsLocalData, companyOfficerLocalData } = (0, exports.getCompanyAndIdentityDetails)(state, companyId, {
95
+ const { companyDetailsLocalData, companyOfficerLocalData, parsingDocumentFileIds } = (0, exports.getCompanyAndIdentityDetails)(state, companyId, {
96
96
  companyDetails,
97
97
  companyOfficerUpdateStatus,
98
98
  primaryContactDetails,
99
+ parsingDocumentFileIds: setupViewState.parsingDocumentFileIds,
99
100
  });
100
101
  const allNationalityCountries = countryListState.byCountryListCode.nationalityCountryList.countries;
101
102
  return {
102
103
  companyDetailsLocalData,
103
104
  companyOfficerLocalData,
105
+ parsingDocumentFileIds,
104
106
  companyView,
105
107
  updateStatus,
106
108
  allNationalityCountries,
@@ -124,6 +126,7 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
124
126
  const companyAddress = addressViewState.newAddressState?.company_address;
125
127
  const registeredCompanyAddress = addressViewState.newAddressState?.company_registered_address;
126
128
  companyDetailsLocalData = {
129
+ autoFilledFields: companyDetails.autoFilledFields,
127
130
  companyId,
128
131
  companyDescription,
129
132
  companyLegalName,
@@ -196,6 +199,7 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
196
199
  const companyOfficerAddress = addressViewState.newAddressState?.[addressType];
197
200
  companyOfficerLocalData[officerType] = {
198
201
  ...companyOfficer.localData,
202
+ autoFilledFields: companyOfficer.autoFilledFields,
199
203
  userFiles: (0, fileSelector_1.getFilesByFileIds)(fileState, fileIds),
200
204
  additionalFiles: (0, fileSelector_1.getFilesByFileIds)(fileState, additionalSubmittedDocumentsForVerificationFileIds),
201
205
  deleteFileStatusById,
@@ -209,6 +213,7 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
209
213
  return {
210
214
  companyDetailsLocalData,
211
215
  companyOfficerLocalData,
216
+ parsingDocumentFileIds: companyAndIdentityDetails.parsingDocumentFileIds,
212
217
  };
213
218
  };
214
219
  exports.getCompanyAndIdentityDetails = getCompanyAndIdentityDetails;
@@ -81,9 +81,21 @@ export interface SetupViewLocalData {
81
81
  */
82
82
  export interface CompanyAndIdentityDetails {
83
83
  companyDetails: {
84
+ /**
85
+ * Field names from {@link CompanyDetailsLocalData} that were populated by AI
86
+ * autofill from an uploaded KYB document. Drives the ✦ sparkle in the form.
87
+ * Always present (empty when no autofill has run yet).
88
+ */
89
+ autoFilledFields: string[];
84
90
  localData?: CompanyDetailsLocalData;
85
91
  };
86
92
  companyOfficerUpdateStatus: Record<CompanyOfficerType, {
93
+ /**
94
+ * Field names from {@link CompanyOfficerLocalData} populated by AI autofill
95
+ * from an uploaded KYC identity document. Drives the ✦ sparkle in the form.
96
+ * Always present (empty when no autofill has run yet).
97
+ */
98
+ autoFilledFields: string[];
87
99
  otpverificationStatus: FetchStateAndError;
88
100
  sendOtpStatus: FetchStateAndError;
89
101
  localData?: CompanyOfficerLocalData;
@@ -93,6 +105,13 @@ export interface CompanyAndIdentityDetails {
93
105
  };
94
106
  }
95
107
  export interface SetupViewState extends CompanyAndIdentityDetails {
108
+ /**
109
+ * File IDs currently being parsed by the AI autofill epic. Populated when
110
+ * `parseUploadedKyc/KybDocument` dispatches and cleared when the
111
+ * corresponding apply / failure action fires. Drives the "AI is reading
112
+ * your document" overlay on the document upload field.
113
+ */
114
+ parsingDocumentFileIds: ID[];
96
115
  updateStatus: FetchStateAndError;
97
116
  }
98
117
  export {};