@zeniai/client-epic-state 5.0.83 → 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 (199) 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 -140
  5. package/lib/entity/aiCfo/aiCfoReducer.d.ts +2 -23
  6. package/lib/entity/aiCfo/aiCfoReducer.js +4 -332
  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 -225
  10. package/lib/entity/aiCfo/aiCfoState.js +1 -30
  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 +6 -11
  33. package/lib/epic.js +7 -11
  34. package/lib/esm/commonStateTypes/animations.js +1 -0
  35. package/lib/esm/entity/aiCfo/aiCfoReducer.js +4 -332
  36. package/lib/esm/entity/aiCfo/aiCfoSelector.js +1 -26
  37. package/lib/esm/entity/aiCfo/aiCfoState.js +0 -27
  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 +7 -11
  45. package/lib/esm/index.js +16 -28
  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 -16
  63. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +0 -38
  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 +19 -28
  72. package/lib/index.js +36 -136
  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 +1 -5
  110. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +5 -17
  111. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +0 -27
  112. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +1 -43
  113. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +0 -2
  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 -265
  135. package/lib/entity/cardPolicy/cardPolicySelector.d.ts +0 -32
  136. package/lib/entity/cardPolicy/cardPolicySelector.js +0 -103
  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 -23
  146. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +0 -111
  147. package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +0 -130
  148. package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +0 -261
  149. package/lib/esm/entity/cardPolicy/cardPolicySelector.js +0 -79
  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 -107
  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/createCardPolicyReducer.js +0 -62
  166. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -39
  167. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -1
  168. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -53
  169. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -25
  170. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +0 -14
  171. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -74
  172. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +0 -21
  173. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -28
  174. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +0 -25
  175. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -2
  176. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +0 -19
  177. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -60
  178. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +0 -18
  179. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -53
  180. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +0 -16
  181. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -46
  182. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +0 -15
  183. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -76
  184. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +0 -21
  185. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -27
  186. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +0 -19
  187. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -2
  188. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +0 -19
  189. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -60
  190. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +0 -13
  191. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -66
  192. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +0 -32
  193. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -46
  194. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +0 -45
  195. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -2
  196. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +0 -25
  197. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -57
  198. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +0 -15
  199. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -29
@@ -7,7 +7,7 @@ import { updateAllUsers } from '../../../../entity/user/userReducer';
7
7
  import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
8
8
  import { createZeniAPIStatus, isSuccessStatus, } from '../../../../responsePayload';
9
9
  import { updateChargeCardList } from '../chargeCardList/chargeCardListReducer';
10
- import { issueChargeCardSuccessOrFailure, issueChargeCards, updateChargeCardCount, updateDebitCardCount, updateLastIssuedCardIds, updateLastSelfIssuedDebitCardId, } from './issueChargeCardReducer';
10
+ import { issueChargeCardSuccessOrFailure, issueChargeCards, updateChargeCardCount, updateDebitCardCount, updateLastSelfIssuedDebitCardId, } from './issueChargeCardReducer';
11
11
  export const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(issueChargeCards.match), switchMap(() => {
12
12
  const state = state$.value;
13
13
  const loggedInUserId = state$.value.tenantState.loggedInUser?.userId;
@@ -87,7 +87,7 @@ export const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe(
87
87
  actions.push(updateChargeCards(issuedCards), updateAllUsers({ users: response.data.users }), updateUserRoles(response.data.user_roles), updateChargeCardList({
88
88
  chargeCardListPayload: response.data,
89
89
  keepExistingListItems: true,
90
- }), updateAddresses(response.data.addresses), updateChargeCardCount(response.data?.cards_count_by_user_id ?? []), updateDebitCardCount(response.data?.debit_cards_count_by_deposit_account_id ?? {}), updateLastIssuedCardIds(issuedCards.map((card) => card.card_id)), issueChargeCardSuccessOrFailure({ fetchState: 'Completed' }));
90
+ }), updateAddresses(response.data.addresses), updateChargeCardCount(response.data?.cards_count_by_user_id ?? []), updateDebitCardCount(response.data?.debit_cards_count_by_deposit_account_id ?? {}), issueChargeCardSuccessOrFailure({ fetchState: 'Completed' }));
91
91
  if (issuedCards.length === 1 &&
92
92
  (issuedCards[0].card_type.code ===
93
93
  'business_virtual_debit_card' ||
@@ -14,7 +14,6 @@ export const initialState = {
14
14
  },
15
15
  activeChargeCardCount: {},
16
16
  activeDebitCardCountByDepositAccountId: {},
17
- lastIssuedCardIds: [],
18
17
  };
19
18
  const issueChargeCard = createSlice({
20
19
  name: 'issueChargeCard',
@@ -35,23 +34,14 @@ const issueChargeCard = createSlice({
35
34
  },
36
35
  },
37
36
  issueChargeCards: {
38
- // `sourceChatSessionId`, when provided, records which AI CFO chat
39
- // session triggered this bulk create so the cards list and AI CFO
40
- // drawer can correlate an in-flight create back to its conversation.
41
- // The field is not sent to the backend.
42
- prepare(payload) {
43
- return { payload: payload ?? {} };
37
+ prepare() {
38
+ return { payload: {} };
44
39
  },
45
- reducer(draft, action) {
40
+ reducer(draft) {
46
41
  draft.saveStatus.fetchState = 'In-Progress';
47
42
  draft.saveStatus.error = undefined;
48
- draft.lastIssueSourceChatSessionId = action.payload.sourceChatSessionId;
49
- draft.lastIssuedCardIds = [];
50
43
  },
51
44
  },
52
- updateLastIssuedCardIds(draft, action) {
53
- draft.lastIssuedCardIds = action.payload;
54
- },
55
45
  updateChargeCardsLocalStore(draft, action) {
56
46
  draft.localData = action.payload;
57
47
  },
@@ -59,8 +49,6 @@ const issueChargeCard = createSlice({
59
49
  draft.localData = [...initialState.localData];
60
50
  draft.saveStatus = initialState.saveStatus;
61
51
  draft.lastSelfIssuedDebitCardId = undefined;
62
- draft.lastIssueSourceChatSessionId = undefined;
63
- draft.lastIssuedCardIds = [];
64
52
  },
65
53
  updateLastSelfIssuedDebitCardId(draft, action) {
66
54
  draft.lastSelfIssuedDebitCardId = action.payload;
@@ -141,5 +129,5 @@ const issueChargeCard = createSlice({
141
129
  },
142
130
  },
143
131
  });
144
- export const { issueChargeCards, updateChargeCardsLocalStore, updateLastSelfIssuedDebitCardId, updateLastIssuedCardIds, issueChargeCardSuccessOrFailure, resetIssueChargeCardForm, updateCustomAddressId, updateChargeCardCount, updateDebitCardCount, fetchIssueCardPage, updateDepositAccountsInCards, fetchDepositAccountListForCards, updateDepositAccountListForCardsFetchStatus, clearIssueChargeCard, } = issueChargeCard.actions;
132
+ export const { issueChargeCards, updateChargeCardsLocalStore, updateLastSelfIssuedDebitCardId, issueChargeCardSuccessOrFailure, resetIssueChargeCardForm, updateCustomAddressId, updateChargeCardCount, updateDebitCardCount, fetchIssueCardPage, updateDepositAccountsInCards, fetchDepositAccountListForCards, updateDepositAccountListForCardsFetchStatus, clearIssueChargeCard, } = issueChargeCard.actions;
145
133
  export default issueChargeCard.reducer;
@@ -93,41 +93,3 @@ export const getIssueChargeCardView = (state, isCreditCardEnabled, isDebitCardEn
93
93
  lastSelfIssuedDebitCardId: issueChargeCardState.lastSelfIssuedDebitCardId,
94
94
  };
95
95
  };
96
- /**
97
- * Returns the AI CFO chat session id that triggered the most recent
98
- * `issueChargeCards` dispatch (if any). Used by the cards list screen to
99
- * decide whether the in-flight bulk-create originated from an AI CFO
100
- * interactive form submission and should therefore render a pending
101
- * placeholder + synthetic AI CFO drawer bubble.
102
- */
103
- export const getLastIssueChargeCardsSourceChatSessionId = (state) => {
104
- return state.issueChargeCardState.lastIssueSourceChatSessionId;
105
- };
106
- /**
107
- * Returns the ids of the cards created by the most recent successful
108
- * `issueChargeCards` call. Used by the AI CFO drawer's "Created" success
109
- * bubble to map back to the actual created entities.
110
- */
111
- export const getLastIssuedChargeCardIds = (state) => {
112
- return state.issueChargeCardState.lastIssuedCardIds;
113
- };
114
- /**
115
- * Returns the save-status fetch state for the most recent `issueChargeCards`
116
- * dispatch. Useful for gating pending placeholder rows on `In-Progress` /
117
- * swapping them out on `Completed`.
118
- */
119
- export const getIssueChargeCardsSaveStatus = (state) => {
120
- return state.issueChargeCardState.saveStatus;
121
- };
122
- /**
123
- * Returns the number of card rows currently being bulk-issued via the most
124
- * recent `issueChargeCards` dispatch. Mirrors `localData.length` while the
125
- * call is in flight so the cards list screen can render N skeleton rows at
126
- * the top of the table.
127
- */
128
- export const getInFlightIssueChargeCardsCount = (state) => {
129
- if (state.issueChargeCardState.saveStatus.fetchState !== 'In-Progress') {
130
- return 0;
131
- }
132
- return state.issueChargeCardState.localData.length;
133
- };
@@ -0,0 +1,49 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { isSuccessResponse } from '../../../../../responsePayload';
4
+ import { applyKybDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
5
+ import { parseUploadedKybDocument } from '../../kycKybAutofillActions';
6
+ import { mapCoiToCompanyDetails, mapTaxEinToCompanyDetails, } from '../../kycKybParseMapper';
7
+ import { applyKybDocumentAutofillForSetup } from '../../setupViewReducer';
8
+ const PROCESS_DOCUMENT_SYNC_PATH = '/1.0/documents/process/sync';
9
+ export const parseUploadedKybDocumentEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(parseUploadedKybDocument.match), mergeMap((action) => {
10
+ const { target, companyId, fileId, documentType } = action.payload;
11
+ const url = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}${PROCESS_DOCUMENT_SYNC_PATH}`;
12
+ const requestPayload = {
13
+ provided_document_type: documentType,
14
+ files: [{ file_id: fileId }],
15
+ processing_priority: 10,
16
+ metadata: { source: 'kyc_kyb_autofill' },
17
+ };
18
+ return zeniAPI
19
+ .postAndGetJSON(url, requestPayload)
20
+ .pipe(mergeMap((response) => {
21
+ if (!isSuccessResponse(response) || response.data == null) {
22
+ return of();
23
+ }
24
+ let result;
25
+ switch (documentType) {
26
+ case 'certificate_of_incorporation':
27
+ result = mapCoiToCompanyDetails(response.data);
28
+ break;
29
+ case 'tax_ein':
30
+ result = mapTaxEinToCompanyDetails(response.data);
31
+ break;
32
+ }
33
+ if (result.autoFilledFieldNames.length === 0) {
34
+ return of();
35
+ }
36
+ const applyAction = target === 'setup'
37
+ ? applyKybDocumentAutofillForSetup({
38
+ companyId,
39
+ values: result.values,
40
+ autoFilledFieldNames: result.autoFilledFieldNames,
41
+ })
42
+ : applyKybDocumentAutofillForOnboarding({
43
+ companyId,
44
+ values: result.values,
45
+ autoFilledFieldNames: result.autoFilledFieldNames,
46
+ });
47
+ return of(applyAction);
48
+ }), catchError(() => of()));
49
+ }));
@@ -0,0 +1,58 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { getCountryList } from '../../../../../entity/countryList/countryListSelector';
4
+ import { isSuccessResponse } from '../../../../../responsePayload';
5
+ import { applyKycDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
6
+ import { parseUploadedKycDocument } from '../../kycKybAutofillActions';
7
+ import { mapDrivingLicenseToOfficer, mapPassportToOfficer, mapSsnCardToOfficer, } from '../../kycKybParseMapper';
8
+ import { applyKycDocumentAutofillForSetup } from '../../setupViewReducer';
9
+ const PROCESS_DOCUMENT_SYNC_PATH = '/1.0/documents/process/sync';
10
+ export const parseUploadedKycDocumentEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(parseUploadedKycDocument.match), mergeMap((action) => {
11
+ const { target, companyId, officerType, fileId, documentType } = action.payload;
12
+ const url = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}${PROCESS_DOCUMENT_SYNC_PATH}`;
13
+ const requestPayload = {
14
+ provided_document_type: documentType,
15
+ files: [{ file_id: fileId }],
16
+ processing_priority: 10,
17
+ metadata: { source: 'kyc_kyb_autofill' },
18
+ };
19
+ return zeniAPI
20
+ .postAndGetJSON(url, requestPayload)
21
+ .pipe(mergeMap((response) => {
22
+ if (!isSuccessResponse(response) || response.data == null) {
23
+ return of();
24
+ }
25
+ const allCountries = getCountryList(state$.value.countryListState, 'nationalityCountryList').countries;
26
+ let result;
27
+ switch (documentType) {
28
+ case 'passport':
29
+ result = mapPassportToOfficer(response.data, allCountries);
30
+ break;
31
+ case 'driving_license':
32
+ result = mapDrivingLicenseToOfficer(response.data);
33
+ break;
34
+ case 'social_security_card':
35
+ result = mapSsnCardToOfficer(response.data);
36
+ break;
37
+ }
38
+ if (result.autoFilledFieldNames.length === 0) {
39
+ return of();
40
+ }
41
+ const applyAction = target === 'setup'
42
+ ? applyKycDocumentAutofillForSetup({
43
+ companyId,
44
+ officerType,
45
+ values: result.values,
46
+ autoFilledFieldNames: result.autoFilledFieldNames,
47
+ })
48
+ : applyKycDocumentAutofillForOnboarding({
49
+ companyId,
50
+ officerType,
51
+ values: result.values,
52
+ autoFilledFieldNames: result.autoFilledFieldNames,
53
+ });
54
+ return of(applyAction);
55
+ }), catchError(() =>
56
+ // Autofill is best-effort; swallow errors silently so the user can keep typing.
57
+ of()));
58
+ }));
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Trigger actions for the KYC / KYB autofill epics.
3
+ *
4
+ * These actions don't mutate state — the epic listens for them, calls
5
+ * document-communication-agent's sync endpoint, and dispatches the appropriate
6
+ * `applyKyc/KybDocumentAutofillFor{Setup,Onboarding}` against the matching
7
+ * slice. Co-located with the rest of the commonSetup module because the entire
8
+ * autofill flow is auxiliary to the setup view; there is no separate state.
9
+ */
10
+ import { createAction } from '@reduxjs/toolkit';
11
+ export const parseUploadedKycDocument = createAction('commonSetup/parseUploadedKycDocument');
12
+ export const parseUploadedKybDocument = createAction('commonSetup/parseUploadedKybDocument');
@@ -0,0 +1,205 @@
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 { date } from '../../../zeniDayJS';
9
+ import { toZeniUrl } from '../../../zeniUrl';
10
+ import { KYC_KYB_AUTOFILL_MIN_CONFIDENCE, } from './types/kycKybAutofill';
11
+ const emptyResult = () => ({
12
+ values: {},
13
+ autoFilledFieldNames: [],
14
+ });
15
+ const isConfident = (field) => {
16
+ if (field == null) {
17
+ return false;
18
+ }
19
+ if (field.value == null) {
20
+ return false;
21
+ }
22
+ return field.confidence >= KYC_KYB_AUTOFILL_MIN_CONFIDENCE;
23
+ };
24
+ const assignAutofilledValue = (result, key, value) => {
25
+ if (value == null) {
26
+ return;
27
+ }
28
+ if (typeof value === 'string' && value.trim() === '') {
29
+ return;
30
+ }
31
+ result.values[key] = value;
32
+ result.autoFilledFieldNames.push(key);
33
+ };
34
+ const tryParseDate = (rawDate) => {
35
+ const parsedDate = date(rawDate);
36
+ if (parsedDate.isValid()) {
37
+ return parsedDate;
38
+ }
39
+ return undefined;
40
+ };
41
+ const normalizeNationality = (rawNationality, countries) => {
42
+ const needle = rawNationality.trim().toLowerCase();
43
+ if (needle === '') {
44
+ return undefined;
45
+ }
46
+ // Exact ISO-2 / ISO-3 match.
47
+ const isoMatch = countries.find((country) => country.countryCode.toLowerCase() === needle);
48
+ if (isoMatch != null) {
49
+ return isoMatch.countryCode;
50
+ }
51
+ // Common nationality adjectives map to country names (e.g. "American" → "United States").
52
+ const adjectiveToCountry = {
53
+ american: 'united states',
54
+ british: 'united kingdom',
55
+ indian: 'india',
56
+ canadian: 'canada',
57
+ australian: 'australia',
58
+ german: 'germany',
59
+ french: 'france',
60
+ chinese: 'china',
61
+ japanese: 'japan',
62
+ mexican: 'mexico',
63
+ brazilian: 'brazil',
64
+ };
65
+ const resolvedName = adjectiveToCountry[needle] ?? needle;
66
+ const nameMatch = countries.find((country) => country.countryName.toLowerCase() === resolvedName);
67
+ return nameMatch?.countryCode;
68
+ };
69
+ const splitFullName = (fullName) => {
70
+ const parts = fullName.trim().split(/\s+/);
71
+ if (parts.length === 1) {
72
+ return { firstName: parts[0], lastName: '' };
73
+ }
74
+ const lastName = parts[parts.length - 1];
75
+ const firstName = parts.slice(0, -1).join(' ');
76
+ return { firstName, lastName };
77
+ };
78
+ /** Passport → Company Officer. */
79
+ export const mapPassportToOfficer = (parsed, allNationalityCountries) => {
80
+ const result = emptyResult();
81
+ if (isConfident(parsed.first_name)) {
82
+ assignAutofilledValue(result, 'firstName', parsed.first_name.value);
83
+ }
84
+ if (isConfident(parsed.last_name)) {
85
+ assignAutofilledValue(result, 'lastName', parsed.last_name.value);
86
+ }
87
+ if (isConfident(parsed.date_of_birth)) {
88
+ const parsedDate = tryParseDate(parsed.date_of_birth.value);
89
+ if (parsedDate != null) {
90
+ assignAutofilledValue(result, 'birthday', parsedDate);
91
+ }
92
+ }
93
+ if (isConfident(parsed.nationality)) {
94
+ const isoCode = normalizeNationality(parsed.nationality.value, allNationalityCountries);
95
+ if (isoCode != null) {
96
+ assignAutofilledValue(result, 'nationalityCountryCode', isoCode);
97
+ }
98
+ }
99
+ return result;
100
+ };
101
+ /** Driving License → Company Officer. */
102
+ export const mapDrivingLicenseToOfficer = (parsed) => {
103
+ const result = emptyResult();
104
+ if (isConfident(parsed.first_name)) {
105
+ assignAutofilledValue(result, 'firstName', parsed.first_name.value);
106
+ }
107
+ if (isConfident(parsed.last_name)) {
108
+ assignAutofilledValue(result, 'lastName', parsed.last_name.value);
109
+ }
110
+ if (isConfident(parsed.date_of_birth)) {
111
+ const parsedDate = tryParseDate(parsed.date_of_birth.value);
112
+ if (parsedDate != null) {
113
+ assignAutofilledValue(result, 'birthday', parsedDate);
114
+ }
115
+ }
116
+ // address_* fields are mapped at a higher layer (addressView reducer) — kept here as values
117
+ // only, the consuming epic dispatches the address payload separately.
118
+ return result;
119
+ };
120
+ /** SSN Card → Company Officer (name only — SSN value not yet returned by parser). */
121
+ export const mapSsnCardToOfficer = (parsed) => {
122
+ const result = emptyResult();
123
+ if (isConfident(parsed.full_name)) {
124
+ const { firstName, lastName } = splitFullName(parsed.full_name.value);
125
+ if (firstName !== '') {
126
+ assignAutofilledValue(result, 'firstName', firstName);
127
+ }
128
+ if (lastName !== '') {
129
+ assignAutofilledValue(result, 'lastName', lastName);
130
+ }
131
+ }
132
+ return result;
133
+ };
134
+ /** Certificate of Incorporation → Company Details. */
135
+ export const mapCoiToCompanyDetails = (parsed) => {
136
+ const result = emptyResult();
137
+ if (isConfident(parsed.company_legal_name)) {
138
+ assignAutofilledValue(result, 'companyLegalName', parsed.company_legal_name.value);
139
+ }
140
+ if (isConfident(parsed.ein)) {
141
+ assignAutofilledValue(result, 'taxIdOrEIN', parsed.ein.value);
142
+ }
143
+ if (isConfident(parsed.phone_number)) {
144
+ assignAutofilledValue(result, 'phone', parsed.phone_number.value);
145
+ }
146
+ if (isConfident(parsed.product_description)) {
147
+ assignAutofilledValue(result, 'companyDescription', parsed.product_description.value);
148
+ }
149
+ if (isConfident(parsed.website)) {
150
+ try {
151
+ assignAutofilledValue(result, 'website', toZeniUrl(parsed.website.value));
152
+ }
153
+ catch {
154
+ // ignore — malformed URL string from OCR
155
+ }
156
+ }
157
+ if (isConfident(parsed.industry)) {
158
+ assignAutofilledValue(result, 'companyIndustryType', parsed.industry.value);
159
+ }
160
+ if (isConfident(parsed.sub_industry)) {
161
+ assignAutofilledValue(result, 'companySubIndustry', parsed.sub_industry.value);
162
+ }
163
+ if (isConfident(parsed.type_of_incorporation)) {
164
+ assignAutofilledValue(result, 'typeOfIncorporation', parsed.type_of_incorporation.value);
165
+ }
166
+ if (isConfident(parsed.date_of_incorporation)) {
167
+ const parsedDate = tryParseDate(parsed.date_of_incorporation.value);
168
+ if (parsedDate != null) {
169
+ assignAutofilledValue(result, 'incDate', parsedDate);
170
+ }
171
+ }
172
+ if (isConfident(parsed.state_of_incorporation)) {
173
+ assignAutofilledValue(result, 'stateOfIncorporation', parsed.state_of_incorporation.value);
174
+ }
175
+ if (isConfident(parsed.countries_of_operations)) {
176
+ assignAutofilledValue(result, 'countriesOfOperations', parsed.countries_of_operations.value);
177
+ }
178
+ if (isConfident(parsed.source_of_funds)) {
179
+ assignAutofilledValue(result, 'sourceOfFunds', parsed.source_of_funds.value);
180
+ }
181
+ if (isConfident(parsed.transaction_volume_expectations)) {
182
+ assignAutofilledValue(result, 'transactionVolume', parsed.transaction_volume_expectations.value);
183
+ }
184
+ if (isConfident(parsed.purpose_of_account)) {
185
+ assignAutofilledValue(result, 'purposeOfAccount', parsed.purpose_of_account.value);
186
+ }
187
+ if (isConfident(parsed.regulated_status)) {
188
+ assignAutofilledValue(result, 'regulatedStatus', parsed.regulated_status.value);
189
+ }
190
+ if (isConfident(parsed.us_nexus)) {
191
+ assignAutofilledValue(result, 'usNexus', parsed.us_nexus.value);
192
+ }
193
+ return result;
194
+ };
195
+ /** Tax EIN letter → Company Details. */
196
+ export const mapTaxEinToCompanyDetails = (parsed) => {
197
+ const result = emptyResult();
198
+ if (isConfident(parsed.legal_business_name)) {
199
+ assignAutofilledValue(result, 'companyLegalName', parsed.legal_business_name.value);
200
+ }
201
+ if (isConfident(parsed.ein)) {
202
+ assignAutofilledValue(result, 'taxIdOrEIN', parsed.ein.value);
203
+ }
204
+ return result;
205
+ };
@@ -3,60 +3,26 @@ const initialFetchStatus = {
3
3
  fetchState: 'Not-Started',
4
4
  error: undefined,
5
5
  };
6
+ const emptyOfficerSlot = {
7
+ autoFilledFields: [],
8
+ localData: undefined,
9
+ sendOtpStatus: initialFetchStatus,
10
+ otpverificationStatus: initialFetchStatus,
11
+ };
6
12
  export const initialState = {
7
13
  updateStatus: { fetchState: 'Not-Started', error: undefined },
8
- companyDetails: {},
14
+ companyDetails: { autoFilledFields: [] },
9
15
  companyOfficerUpdateStatus: {
10
- Officer_1: {
11
- localData: undefined,
12
- sendOtpStatus: initialFetchStatus,
13
- otpverificationStatus: initialFetchStatus,
14
- },
15
- Officer_2: {
16
- localData: undefined,
17
- sendOtpStatus: initialFetchStatus,
18
- otpverificationStatus: initialFetchStatus,
19
- },
20
- Officer_3: {
21
- localData: undefined,
22
- sendOtpStatus: initialFetchStatus,
23
- otpverificationStatus: initialFetchStatus,
24
- },
25
- Officer_4: {
26
- localData: undefined,
27
- sendOtpStatus: initialFetchStatus,
28
- otpverificationStatus: initialFetchStatus,
29
- },
30
- Officer_5: {
31
- localData: undefined,
32
- sendOtpStatus: initialFetchStatus,
33
- otpverificationStatus: initialFetchStatus,
34
- },
35
- Officer_6: {
36
- localData: undefined,
37
- sendOtpStatus: initialFetchStatus,
38
- otpverificationStatus: initialFetchStatus,
39
- },
40
- Officer_7: {
41
- localData: undefined,
42
- sendOtpStatus: initialFetchStatus,
43
- otpverificationStatus: initialFetchStatus,
44
- },
45
- Officer_8: {
46
- localData: undefined,
47
- sendOtpStatus: initialFetchStatus,
48
- otpverificationStatus: initialFetchStatus,
49
- },
50
- Officer_9: {
51
- localData: undefined,
52
- sendOtpStatus: initialFetchStatus,
53
- otpverificationStatus: initialFetchStatus,
54
- },
55
- Officer_10: {
56
- localData: undefined,
57
- sendOtpStatus: initialFetchStatus,
58
- otpverificationStatus: initialFetchStatus,
59
- },
16
+ Officer_1: { ...emptyOfficerSlot },
17
+ Officer_2: { ...emptyOfficerSlot },
18
+ Officer_3: { ...emptyOfficerSlot },
19
+ Officer_4: { ...emptyOfficerSlot },
20
+ Officer_5: { ...emptyOfficerSlot },
21
+ Officer_6: { ...emptyOfficerSlot },
22
+ Officer_7: { ...emptyOfficerSlot },
23
+ Officer_8: { ...emptyOfficerSlot },
24
+ Officer_9: { ...emptyOfficerSlot },
25
+ Officer_10: { ...emptyOfficerSlot },
60
26
  },
61
27
  primaryContactDetails: {},
62
28
  };
@@ -297,7 +263,60 @@ const setupView = createSlice({
297
263
  clearSetupView(draft) {
298
264
  Object.assign(draft, initialState);
299
265
  },
266
+ /**
267
+ * Merge AI-parsed officer fields into the selected officer's localData and
268
+ * track which field names were autofilled so the form can show the ✦ badge.
269
+ */
270
+ applyKycDocumentAutofillForSetup: {
271
+ reducer(draft, action) {
272
+ const { officerType, values, autoFilledFieldNames } = action.payload;
273
+ const slot = draft.companyOfficerUpdateStatus[officerType];
274
+ slot.localData = Object.assign({}, slot.localData, values);
275
+ slot.autoFilledFields = Array.from(new Set([...slot.autoFilledFields, ...autoFilledFieldNames]));
276
+ },
277
+ prepare(payload) {
278
+ return { payload };
279
+ },
280
+ },
281
+ /**
282
+ * Merge AI-parsed company fields into companyDetails.localData and track
283
+ * which field names were autofilled.
284
+ */
285
+ applyKybDocumentAutofillForSetup: {
286
+ reducer(draft, action) {
287
+ const { values, autoFilledFieldNames } = action.payload;
288
+ draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
289
+ draft.companyDetails.autoFilledFields = Array.from(new Set([
290
+ ...draft.companyDetails.autoFilledFields,
291
+ ...autoFilledFieldNames,
292
+ ]));
293
+ },
294
+ prepare(payload) {
295
+ return { payload };
296
+ },
297
+ },
298
+ /**
299
+ * Wipe AI-autofill badges. If `officerType` is provided, clears only that
300
+ * officer; otherwise clears company details too.
301
+ */
302
+ clearKycKybAutofillForSetup: {
303
+ reducer(draft, action) {
304
+ const { officerType } = action.payload;
305
+ if (officerType != null) {
306
+ draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
307
+ }
308
+ else {
309
+ draft.companyDetails.autoFilledFields = [];
310
+ Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
311
+ draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
312
+ });
313
+ }
314
+ },
315
+ prepare(payload = {}) {
316
+ return { payload };
317
+ },
318
+ },
300
319
  },
301
320
  });
302
- export const { enableSetup, enableSetupSuccess, enableSetupFailure, updateBusinessVerificationDetails, updateBusinessVerificationDetailsSuccess, updateBusinessVerificationDetailsFailure, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, sendOtp: sendOtpSpendManagementSetUp, resendOtp: resendOtpSpendManagementSetUp, sendOtpSuccess: sendOtpSuccessSpendManagementSetUp, sendOtpFailure: sendOtpFailureSpendManagementSetUp, verifyOtp: verifyOtpSpendManagementSetUp, verifyOtpSuccess: verifyOtpSuccessSpendManagementSetUp, verifyOtpFailure: verifyOtpFailureSpendManagementSetUp, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearSetupView, } = setupView.actions;
321
+ export const { enableSetup, enableSetupSuccess, enableSetupFailure, updateBusinessVerificationDetails, updateBusinessVerificationDetailsSuccess, updateBusinessVerificationDetailsFailure, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, sendOtp: sendOtpSpendManagementSetUp, resendOtp: resendOtpSpendManagementSetUp, sendOtpSuccess: sendOtpSuccessSpendManagementSetUp, sendOtpFailure: sendOtpFailureSpendManagementSetUp, verifyOtp: verifyOtpSpendManagementSetUp, verifyOtpSuccess: verifyOtpSuccessSpendManagementSetUp, verifyOtpFailure: verifyOtpFailureSpendManagementSetUp, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearSetupView, applyKycDocumentAutofillForSetup, applyKybDocumentAutofillForSetup, clearKycKybAutofillForSetup, } = setupView.actions;
303
322
  export default setupView.reducer;
@@ -119,6 +119,7 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
119
119
  const companyAddress = addressViewState.newAddressState?.company_address;
120
120
  const registeredCompanyAddress = addressViewState.newAddressState?.company_registered_address;
121
121
  companyDetailsLocalData = {
122
+ autoFilledFields: companyDetails.autoFilledFields,
122
123
  companyId,
123
124
  companyDescription,
124
125
  companyLegalName,
@@ -191,6 +192,7 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
191
192
  const companyOfficerAddress = addressViewState.newAddressState?.[addressType];
192
193
  companyOfficerLocalData[officerType] = {
193
194
  ...companyOfficer.localData,
195
+ autoFilledFields: companyOfficer.autoFilledFields,
194
196
  userFiles: getFilesByFileIds(fileState, fileIds),
195
197
  additionalFiles: getFilesByFileIds(fileState, additionalSubmittedDocumentsForVerificationFileIds),
196
198
  deleteFileStatusById,
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Shared types for the KYC / KYB document autofill flow that lives inside the
3
+ * commonSetup feature (Setup pages + Onboarding both consume it via the same
4
+ * selector view; there is no separate state slice).
5
+ *
6
+ * Backed by document-communication-agent `POST /1.0/documents/process/sync`,
7
+ * which proxies document-service ExtendAI parsers and returns one of the
8
+ * parser payloads below — each value shaped as `{value, confidence}` per field.
9
+ */
10
+ /** Confidence floor below which we drop an autofill candidate. */
11
+ export const KYC_KYB_AUTOFILL_MIN_CONFIDENCE = 0.5;
12
+ /**
13
+ * Maps the form-side {@link KycSelectDocumentType} (camelCase) to the
14
+ * parser-side {@link KycProvidedDocumentType} (snake_case). Returns `null` for
15
+ * `stateId`, which has no parser today.
16
+ */
17
+ export const toKycProvidedDocumentType = (selectType) => {
18
+ switch (selectType) {
19
+ case 'driverLicense':
20
+ return 'driving_license';
21
+ case 'passport':
22
+ return 'passport';
23
+ case 'ssnCard':
24
+ return 'social_security_card';
25
+ case 'stateId':
26
+ return null;
27
+ }
28
+ };