@zeniai/client-epic-state 5.0.84 → 5.0.85-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 (83) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.js +1 -0
  3. package/lib/entity/company/companyPayload.d.ts +2 -0
  4. package/lib/entity/company/companyPayload.js +2 -0
  5. package/lib/entity/company/companyStateTypes.d.ts +2 -0
  6. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  7. package/lib/entity/paymentAccount/paymentAccountSelector.js +4 -0
  8. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  9. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  10. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  11. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  12. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
  13. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  14. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  15. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  16. package/lib/entity/tenant/tenantPayload.d.ts +19 -0
  17. package/lib/entity/tenant/tenantReducer.d.ts +49 -28
  18. package/lib/entity/tenant/tenantReducer.js +111 -5
  19. package/lib/entity/tenant/tenantState.d.ts +21 -0
  20. package/lib/epic.d.ts +8 -2
  21. package/lib/epic.js +9 -2
  22. package/lib/esm/commonStateTypes/animations.js +1 -0
  23. package/lib/esm/entity/company/companyPayload.js +2 -0
  24. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +3 -0
  25. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  26. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
  27. package/lib/esm/entity/tenant/tenantReducer.js +108 -3
  28. package/lib/esm/epic.js +9 -2
  29. package/lib/esm/index.js +12 -9
  30. package/lib/esm/view/companyView/companyViewReducer.js +45 -1
  31. package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +25 -0
  32. package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.js +79 -0
  33. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  34. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +45 -0
  35. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
  36. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +168 -50
  37. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +14 -0
  38. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -0
  39. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +49 -0
  40. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +58 -0
  41. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +12 -0
  42. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
  43. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +71 -52
  44. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  45. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
  46. package/lib/index.d.ts +15 -11
  47. package/lib/index.js +56 -34
  48. package/lib/view/companyView/companyViewReducer.d.ts +11 -1
  49. package/lib/view/companyView/companyViewReducer.js +47 -3
  50. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.d.ts +9 -0
  51. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +29 -0
  52. package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.d.ts +10 -0
  53. package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.js +83 -0
  54. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
  55. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  56. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  57. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
  58. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +49 -0
  59. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
  60. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
  61. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
  62. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +41 -4
  63. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +170 -51
  64. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +7 -1
  65. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +21 -1
  66. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +37 -0
  67. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +14 -1
  68. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +8 -0
  69. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +53 -0
  70. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +8 -0
  71. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +62 -0
  72. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +27 -0
  73. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +15 -0
  74. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
  75. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
  76. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +24 -2
  77. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -53
  78. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
  79. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
  80. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +12 -0
  81. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
  82. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
  83. package/package.json +1 -1
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearOnboardingCustomerView = exports.clearOnboardingCustomerViewDataInLocalStore = exports.verifyOnboardingOfficerOtpFailure = exports.verifyOnboardingOfficerOtpSuccess = exports.verifyOnboardingOfficerOtp = exports.resendOnboardingOfficerOtp = exports.sendOnboardingOfficerOtpFailure = exports.sendOnboardingOfficerOtpSuccess = exports.sendOnboardingOfficerOtp = exports.updateOnboardingCustomerViewUIState = exports.saveOnboardingCompnayOfficerPhoneInLocalStore = exports.saveOnboardingCustomerViewDataInLocalStore = exports.updateOnboardingCustomerViewLocalStoreData = exports.updateOnboardingCustomerViewAccountDetails = exports.updateCurrentStep = exports.getOnboardingPlaidLinkTokenFailure = exports.getOnboardingPlaidLinkTokenSuccess = exports.getOnboardingPlaidLinkToken = exports.establishOnboardingPlaidConnectionFailure = exports.establishOnboardingPlaidConnectionSuccess = exports.establishOnboardingPlaidConnection = exports.updateOnboardingPaymentAccountLoginStatusFailure = exports.updateOnboardingPaymentAccountLoginStatusSuccess = exports.updateOnboardingPaymentAccountLoginStatus = exports.updateOnboardingPaymentAccountStatusFailure = exports.updateOnboardingPaymentAccountStatusSuccess = exports.updateOnboardingPaymentAccountStatus = exports.updateOnboardingCustomerViewFailure = exports.updateOnboardingCustomerViewSuccess = exports.updateOnboardingCustomerView = exports.updateOnboardingCustomerViewDashboardLoadedFailure = exports.updateOnboardingCustomerViewDashboardLoadedSuccess = exports.updateOnboardingCustomerViewDashboardLoaded = exports.updateOnboardingCustomerViewCompleteStatusFailure = exports.updateOnboardingCustomerViewCompleteStatusSuccess = exports.updateOnboardingCustomerViewCompleteStatus = exports.fetchOnboardingCustomerSetupViewFailure = exports.fetchOnboardingCustomerSetupViewSuccess = exports.fetchOnboardingCustomerSetupView = exports.fetchOnboardingCustomerView = exports.initialState = void 0;
4
+ exports.clearOnboardingCustomerView = exports.clearOnboardingCustomerViewDataInLocalStore = exports.verifyOnboardingOfficerOtpFailure = exports.verifyOnboardingOfficerOtpSuccess = exports.verifyOnboardingOfficerOtp = exports.resendOnboardingOfficerOtp = exports.sendOnboardingOfficerOtpFailure = exports.sendOnboardingOfficerOtpSuccess = exports.sendOnboardingOfficerOtp = exports.updateOnboardingCustomerViewUIState = exports.saveOnboardingCompnayOfficerPhoneInLocalStore = exports.saveOnboardingCustomerViewDataInLocalStore = exports.updateOnboardingCustomerViewLocalStoreData = exports.updateOnboardingCustomerViewAccountDetails = exports.updateCurrentStep = exports.getOnboardingPlaidLinkTokenFailure = exports.getOnboardingPlaidLinkTokenSuccess = exports.getOnboardingPlaidLinkToken = exports.establishOnboardingPlaidConnectionFailure = exports.establishOnboardingPlaidConnectionSuccess = exports.establishOnboardingPlaidConnection = exports.updateOnboardingPaymentAccountLoginStatusFailure = exports.updateOnboardingPaymentAccountLoginStatusSuccess = exports.updateOnboardingPaymentAccountLoginStatus = exports.updateOnboardingPaymentAccountStatusFailure = exports.updateOnboardingPaymentAccountStatusSuccess = exports.updateOnboardingPaymentAccountStatus = exports.updateOnboardingCustomerViewFailure = exports.updateOnboardingCustomerViewSuccess = exports.updateOnboardingCustomerView = exports.updateOnboardingCustomerViewDashboardLoadedFailure = exports.updateOnboardingCustomerViewDashboardLoadedSuccess = exports.updateOnboardingCustomerViewDashboardLoaded = exports.aiAgentsActivationSectionReady = exports.aiAgentsActivationPhaseChanged = exports.aiAgentsActivationCountsUpdated = exports.fetchAiAgentsActivationStatusFailure = exports.fetchAiAgentsActivationStatusSuccess = exports.fetchAiAgentsActivationStatus = exports.acknowledgeOnboardingAiFinanceTeamFailure = exports.acknowledgeOnboardingAiFinanceTeamSuccess = exports.acknowledgeOnboardingAiFinanceTeam = exports.updateOnboardingCustomerViewCompleteStatusFailure = exports.updateOnboardingCustomerViewCompleteStatusSuccess = exports.updateOnboardingCustomerViewCompleteStatus = exports.fetchOnboardingCustomerSetupViewFailure = exports.fetchOnboardingCustomerSetupViewSuccess = exports.fetchOnboardingCustomerSetupView = exports.fetchOnboardingCustomerView = exports.initialState = void 0;
5
+ exports.clearKycKybAutofillForOnboarding = exports.applyKybDocumentAutofillForOnboarding = exports.applyKycDocumentAutofillForOnboarding = void 0;
5
6
  const toolkit_1 = require("@reduxjs/toolkit");
6
7
  const zeniDayJS_1 = require("../../../zeniDayJS");
8
+ const onboardingCustomerViewState_1 = require("./onboardingCustomerViewState");
7
9
  const initialStatus = {
8
10
  fetchState: 'Not-Started',
9
11
  error: undefined,
@@ -14,60 +16,29 @@ exports.initialState = {
14
16
  dashboardLoadedStatus: initialStatus,
15
17
  currentStep: 'link_payment_account',
16
18
  companyDetails: {
19
+ autoFilledFields: [],
17
20
  localData: undefined,
18
21
  },
19
- companyOfficerUpdateStatus: {
20
- Officer_1: {
22
+ companyOfficerUpdateStatus: (() => {
23
+ const emptyOfficerSlot = {
24
+ autoFilledFields: [],
21
25
  localData: undefined,
22
26
  sendOtpStatus: initialStatus,
23
27
  otpverificationStatus: initialStatus,
24
- },
25
- Officer_2: {
26
- localData: undefined,
27
- sendOtpStatus: initialStatus,
28
- otpverificationStatus: initialStatus,
29
- },
30
- Officer_3: {
31
- localData: undefined,
32
- sendOtpStatus: initialStatus,
33
- otpverificationStatus: initialStatus,
34
- },
35
- Officer_4: {
36
- localData: undefined,
37
- sendOtpStatus: initialStatus,
38
- otpverificationStatus: initialStatus,
39
- },
40
- Officer_5: {
41
- localData: undefined,
42
- sendOtpStatus: initialStatus,
43
- otpverificationStatus: initialStatus,
44
- },
45
- Officer_6: {
46
- localData: undefined,
47
- sendOtpStatus: initialStatus,
48
- otpverificationStatus: initialStatus,
49
- },
50
- Officer_7: {
51
- localData: undefined,
52
- sendOtpStatus: initialStatus,
53
- otpverificationStatus: initialStatus,
54
- },
55
- Officer_8: {
56
- localData: undefined,
57
- sendOtpStatus: initialStatus,
58
- otpverificationStatus: initialStatus,
59
- },
60
- Officer_9: {
61
- localData: undefined,
62
- sendOtpStatus: initialStatus,
63
- otpverificationStatus: initialStatus,
64
- },
65
- Officer_10: {
66
- localData: undefined,
67
- sendOtpStatus: initialStatus,
68
- otpverificationStatus: initialStatus,
69
- },
70
- },
28
+ };
29
+ return {
30
+ Officer_1: { ...emptyOfficerSlot },
31
+ Officer_2: { ...emptyOfficerSlot },
32
+ Officer_3: { ...emptyOfficerSlot },
33
+ Officer_4: { ...emptyOfficerSlot },
34
+ Officer_5: { ...emptyOfficerSlot },
35
+ Officer_6: { ...emptyOfficerSlot },
36
+ Officer_7: { ...emptyOfficerSlot },
37
+ Officer_8: { ...emptyOfficerSlot },
38
+ Officer_9: { ...emptyOfficerSlot },
39
+ Officer_10: { ...emptyOfficerSlot },
40
+ };
41
+ })(),
71
42
  primaryContactDetails: {},
72
43
  paymentAccountDetails: {
73
44
  fetchStatus: initialStatus,
@@ -95,6 +66,7 @@ exports.initialState = {
95
66
  },
96
67
  fetchState: 'Not-Started',
97
68
  error: undefined,
69
+ aiAgentsActivation: { ...onboardingCustomerViewState_1.emptyAiAgentsActivationSubview },
98
70
  uiState: {
99
71
  isQBOPopupOpen: false,
100
72
  isCardPaymentPopupOpen: false,
@@ -184,6 +156,111 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
184
156
  };
185
157
  },
186
158
  },
159
+ acknowledgeOnboardingAiFinanceTeam: {
160
+ reducer(draft) {
161
+ draft.aiFinanceTeamAcknowledgementStatus = {
162
+ fetchState: 'In-Progress',
163
+ error: undefined,
164
+ };
165
+ },
166
+ prepare(companyId) {
167
+ return {
168
+ payload: { companyId },
169
+ };
170
+ },
171
+ },
172
+ acknowledgeOnboardingAiFinanceTeamSuccess(draft) {
173
+ draft.aiFinanceTeamAcknowledgementStatus = {
174
+ fetchState: 'Completed',
175
+ error: undefined,
176
+ };
177
+ },
178
+ acknowledgeOnboardingAiFinanceTeamFailure: {
179
+ reducer(draft, action) {
180
+ draft.aiFinanceTeamAcknowledgementStatus = {
181
+ fetchState: 'Error',
182
+ error: action.payload,
183
+ };
184
+ },
185
+ prepare(error) {
186
+ return {
187
+ payload: error,
188
+ };
189
+ },
190
+ },
191
+ fetchAiAgentsActivationStatus(draft) {
192
+ draft.aiAgentsActivation.fetchStatus = {
193
+ fetchState: 'In-Progress',
194
+ error: undefined,
195
+ };
196
+ },
197
+ fetchAiAgentsActivationStatusSuccess: {
198
+ reducer(draft, action) {
199
+ draft.aiAgentsActivation.fetchStatus = {
200
+ fetchState: 'Completed',
201
+ error: undefined,
202
+ };
203
+ draft.aiAgentsActivation.ledgerPhases = action.payload.ledgerPhases;
204
+ draft.aiAgentsActivation.backgroundPhases =
205
+ action.payload.backgroundPhases;
206
+ draft.aiAgentsActivation.counts = action.payload.counts;
207
+ },
208
+ prepare(payload) {
209
+ return { payload };
210
+ },
211
+ },
212
+ fetchAiAgentsActivationStatusFailure: {
213
+ reducer(draft, action) {
214
+ draft.aiAgentsActivation.fetchStatus = {
215
+ fetchState: 'Error',
216
+ error: action.payload,
217
+ };
218
+ },
219
+ prepare(error) {
220
+ return { payload: error };
221
+ },
222
+ },
223
+ aiAgentsActivationCountsUpdated: {
224
+ reducer(draft, action) {
225
+ draft.aiAgentsActivation.counts = {
226
+ ...draft.aiAgentsActivation.counts,
227
+ ...action.payload,
228
+ };
229
+ },
230
+ prepare(payload) {
231
+ return { payload };
232
+ },
233
+ },
234
+ aiAgentsActivationPhaseChanged: {
235
+ reducer(draft, action) {
236
+ const target = action.payload.section === 'ledger'
237
+ ? draft.aiAgentsActivation.ledgerPhases
238
+ : draft.aiAgentsActivation.backgroundPhases;
239
+ const index = target.findIndex((phase) => phase.key === action.payload.key);
240
+ if (index === -1) {
241
+ target.push(action.payload);
242
+ }
243
+ else {
244
+ target[index] = { ...target[index], ...action.payload };
245
+ }
246
+ },
247
+ prepare(payload) {
248
+ return { payload };
249
+ },
250
+ },
251
+ aiAgentsActivationSectionReady: {
252
+ reducer(draft, action) {
253
+ const target = action.payload.section === 'ledger'
254
+ ? draft.aiAgentsActivation.ledgerPhases
255
+ : draft.aiAgentsActivation.backgroundPhases;
256
+ target.forEach((phase) => {
257
+ phase.status = 'ready';
258
+ });
259
+ },
260
+ prepare(payload) {
261
+ return { payload };
262
+ },
263
+ },
187
264
  updateOnboardingCustomerViewDashboardLoaded: {
188
265
  reducer(draft) {
189
266
  draft.dashboardLoadedStatus = {
@@ -596,7 +673,49 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
596
673
  clearOnboardingCustomerView(draft) {
597
674
  Object.assign(draft, exports.initialState);
598
675
  },
676
+ /** Merge AI-parsed officer fields into the officer's onboarding localData. */
677
+ applyKycDocumentAutofillForOnboarding: {
678
+ reducer(draft, action) {
679
+ const { officerType, values, autoFilledFieldNames } = action.payload;
680
+ const slot = draft.companyOfficerUpdateStatus[officerType];
681
+ slot.localData = Object.assign({}, slot.localData, values);
682
+ slot.autoFilledFields = Array.from(new Set([...slot.autoFilledFields, ...autoFilledFieldNames]));
683
+ },
684
+ prepare(payload) {
685
+ return { payload };
686
+ },
687
+ },
688
+ /** Merge AI-parsed company fields into companyDetails onboarding localData. */
689
+ applyKybDocumentAutofillForOnboarding: {
690
+ reducer(draft, action) {
691
+ const { values, autoFilledFieldNames } = action.payload;
692
+ draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
693
+ const prev = draft.companyDetails.autoFilledFields ?? [];
694
+ draft.companyDetails.autoFilledFields = Array.from(new Set([...prev, ...autoFilledFieldNames]));
695
+ },
696
+ prepare(payload) {
697
+ return { payload };
698
+ },
699
+ },
700
+ /** Wipe AI-autofill badges during onboarding. */
701
+ clearKycKybAutofillForOnboarding: {
702
+ reducer(draft, action) {
703
+ const { officerType } = action.payload;
704
+ if (officerType != null) {
705
+ draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
706
+ }
707
+ else {
708
+ draft.companyDetails.autoFilledFields = [];
709
+ Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
710
+ draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
711
+ });
712
+ }
713
+ },
714
+ prepare(payload = {}) {
715
+ return { payload };
716
+ },
717
+ },
599
718
  },
600
719
  });
601
- _a = onboardingCustomerView.actions, exports.fetchOnboardingCustomerView = _a.fetchOnboardingCustomerView, exports.fetchOnboardingCustomerSetupView = _a.fetchOnboardingCustomerSetupView, exports.fetchOnboardingCustomerSetupViewSuccess = _a.fetchOnboardingCustomerSetupViewSuccess, exports.fetchOnboardingCustomerSetupViewFailure = _a.fetchOnboardingCustomerSetupViewFailure, exports.updateOnboardingCustomerViewCompleteStatus = _a.updateOnboardingCustomerViewCompleteStatus, exports.updateOnboardingCustomerViewCompleteStatusSuccess = _a.updateOnboardingCustomerViewCompleteStatusSuccess, exports.updateOnboardingCustomerViewCompleteStatusFailure = _a.updateOnboardingCustomerViewCompleteStatusFailure, exports.updateOnboardingCustomerViewDashboardLoaded = _a.updateOnboardingCustomerViewDashboardLoaded, exports.updateOnboardingCustomerViewDashboardLoadedSuccess = _a.updateOnboardingCustomerViewDashboardLoadedSuccess, exports.updateOnboardingCustomerViewDashboardLoadedFailure = _a.updateOnboardingCustomerViewDashboardLoadedFailure, exports.updateOnboardingCustomerView = _a.updateOnboardingCustomerView, exports.updateOnboardingCustomerViewSuccess = _a.updateOnboardingCustomerViewSuccess, exports.updateOnboardingCustomerViewFailure = _a.updateOnboardingCustomerViewFailure, exports.updateOnboardingPaymentAccountStatus = _a.updateOnboardingPaymentAccountStatus, exports.updateOnboardingPaymentAccountStatusSuccess = _a.updateOnboardingPaymentAccountStatusSuccess, exports.updateOnboardingPaymentAccountStatusFailure = _a.updateOnboardingPaymentAccountStatusFailure, exports.updateOnboardingPaymentAccountLoginStatus = _a.updateOnboardingPaymentAccountLoginStatus, exports.updateOnboardingPaymentAccountLoginStatusSuccess = _a.updateOnboardingPaymentAccountLoginStatusSuccess, exports.updateOnboardingPaymentAccountLoginStatusFailure = _a.updateOnboardingPaymentAccountLoginStatusFailure, exports.establishOnboardingPlaidConnection = _a.establishOnboardingPlaidConnection, exports.establishOnboardingPlaidConnectionSuccess = _a.establishOnboardingPlaidConnectionSuccess, exports.establishOnboardingPlaidConnectionFailure = _a.establishOnboardingPlaidConnectionFailure, exports.getOnboardingPlaidLinkToken = _a.getOnboardingPlaidLinkToken, exports.getOnboardingPlaidLinkTokenSuccess = _a.getOnboardingPlaidLinkTokenSuccess, exports.getOnboardingPlaidLinkTokenFailure = _a.getOnboardingPlaidLinkTokenFailure, exports.updateCurrentStep = _a.updateCurrentStep, exports.updateOnboardingCustomerViewAccountDetails = _a.updateOnboardingCustomerViewAccountDetails, exports.updateOnboardingCustomerViewLocalStoreData = _a.updateOnboardingCustomerViewLocalStoreData, exports.saveOnboardingCustomerViewDataInLocalStore = _a.saveOnboardingCustomerViewDataInLocalStore, exports.saveOnboardingCompnayOfficerPhoneInLocalStore = _a.saveOnboardingCompnayOfficerPhoneInLocalStore, exports.updateOnboardingCustomerViewUIState = _a.updateOnboardingCustomerViewUIState, exports.sendOnboardingOfficerOtp = _a.sendOnboardingOfficerOtp, exports.sendOnboardingOfficerOtpSuccess = _a.sendOnboardingOfficerOtpSuccess, exports.sendOnboardingOfficerOtpFailure = _a.sendOnboardingOfficerOtpFailure, exports.resendOnboardingOfficerOtp = _a.resendOnboardingOfficerOtp, exports.verifyOnboardingOfficerOtp = _a.verifyOnboardingOfficerOtp, exports.verifyOnboardingOfficerOtpSuccess = _a.verifyOnboardingOfficerOtpSuccess, exports.verifyOnboardingOfficerOtpFailure = _a.verifyOnboardingOfficerOtpFailure, exports.clearOnboardingCustomerViewDataInLocalStore = _a.clearOnboardingCustomerViewDataInLocalStore, exports.clearOnboardingCustomerView = _a.clearOnboardingCustomerView;
720
+ _a = onboardingCustomerView.actions, exports.fetchOnboardingCustomerView = _a.fetchOnboardingCustomerView, exports.fetchOnboardingCustomerSetupView = _a.fetchOnboardingCustomerSetupView, exports.fetchOnboardingCustomerSetupViewSuccess = _a.fetchOnboardingCustomerSetupViewSuccess, exports.fetchOnboardingCustomerSetupViewFailure = _a.fetchOnboardingCustomerSetupViewFailure, exports.updateOnboardingCustomerViewCompleteStatus = _a.updateOnboardingCustomerViewCompleteStatus, exports.updateOnboardingCustomerViewCompleteStatusSuccess = _a.updateOnboardingCustomerViewCompleteStatusSuccess, exports.updateOnboardingCustomerViewCompleteStatusFailure = _a.updateOnboardingCustomerViewCompleteStatusFailure, exports.acknowledgeOnboardingAiFinanceTeam = _a.acknowledgeOnboardingAiFinanceTeam, exports.acknowledgeOnboardingAiFinanceTeamSuccess = _a.acknowledgeOnboardingAiFinanceTeamSuccess, exports.acknowledgeOnboardingAiFinanceTeamFailure = _a.acknowledgeOnboardingAiFinanceTeamFailure, exports.fetchAiAgentsActivationStatus = _a.fetchAiAgentsActivationStatus, exports.fetchAiAgentsActivationStatusSuccess = _a.fetchAiAgentsActivationStatusSuccess, exports.fetchAiAgentsActivationStatusFailure = _a.fetchAiAgentsActivationStatusFailure, exports.aiAgentsActivationCountsUpdated = _a.aiAgentsActivationCountsUpdated, exports.aiAgentsActivationPhaseChanged = _a.aiAgentsActivationPhaseChanged, exports.aiAgentsActivationSectionReady = _a.aiAgentsActivationSectionReady, exports.updateOnboardingCustomerViewDashboardLoaded = _a.updateOnboardingCustomerViewDashboardLoaded, exports.updateOnboardingCustomerViewDashboardLoadedSuccess = _a.updateOnboardingCustomerViewDashboardLoadedSuccess, exports.updateOnboardingCustomerViewDashboardLoadedFailure = _a.updateOnboardingCustomerViewDashboardLoadedFailure, exports.updateOnboardingCustomerView = _a.updateOnboardingCustomerView, exports.updateOnboardingCustomerViewSuccess = _a.updateOnboardingCustomerViewSuccess, exports.updateOnboardingCustomerViewFailure = _a.updateOnboardingCustomerViewFailure, exports.updateOnboardingPaymentAccountStatus = _a.updateOnboardingPaymentAccountStatus, exports.updateOnboardingPaymentAccountStatusSuccess = _a.updateOnboardingPaymentAccountStatusSuccess, exports.updateOnboardingPaymentAccountStatusFailure = _a.updateOnboardingPaymentAccountStatusFailure, exports.updateOnboardingPaymentAccountLoginStatus = _a.updateOnboardingPaymentAccountLoginStatus, exports.updateOnboardingPaymentAccountLoginStatusSuccess = _a.updateOnboardingPaymentAccountLoginStatusSuccess, exports.updateOnboardingPaymentAccountLoginStatusFailure = _a.updateOnboardingPaymentAccountLoginStatusFailure, exports.establishOnboardingPlaidConnection = _a.establishOnboardingPlaidConnection, exports.establishOnboardingPlaidConnectionSuccess = _a.establishOnboardingPlaidConnectionSuccess, exports.establishOnboardingPlaidConnectionFailure = _a.establishOnboardingPlaidConnectionFailure, exports.getOnboardingPlaidLinkToken = _a.getOnboardingPlaidLinkToken, exports.getOnboardingPlaidLinkTokenSuccess = _a.getOnboardingPlaidLinkTokenSuccess, exports.getOnboardingPlaidLinkTokenFailure = _a.getOnboardingPlaidLinkTokenFailure, exports.updateCurrentStep = _a.updateCurrentStep, exports.updateOnboardingCustomerViewAccountDetails = _a.updateOnboardingCustomerViewAccountDetails, exports.updateOnboardingCustomerViewLocalStoreData = _a.updateOnboardingCustomerViewLocalStoreData, exports.saveOnboardingCustomerViewDataInLocalStore = _a.saveOnboardingCustomerViewDataInLocalStore, exports.saveOnboardingCompnayOfficerPhoneInLocalStore = _a.saveOnboardingCompnayOfficerPhoneInLocalStore, exports.updateOnboardingCustomerViewUIState = _a.updateOnboardingCustomerViewUIState, exports.sendOnboardingOfficerOtp = _a.sendOnboardingOfficerOtp, exports.sendOnboardingOfficerOtpSuccess = _a.sendOnboardingOfficerOtpSuccess, exports.sendOnboardingOfficerOtpFailure = _a.sendOnboardingOfficerOtpFailure, exports.resendOnboardingOfficerOtp = _a.resendOnboardingOfficerOtp, exports.verifyOnboardingOfficerOtp = _a.verifyOnboardingOfficerOtp, exports.verifyOnboardingOfficerOtpSuccess = _a.verifyOnboardingOfficerOtpSuccess, exports.verifyOnboardingOfficerOtpFailure = _a.verifyOnboardingOfficerOtpFailure, exports.clearOnboardingCustomerViewDataInLocalStore = _a.clearOnboardingCustomerViewDataInLocalStore, exports.clearOnboardingCustomerView = _a.clearOnboardingCustomerView, exports.applyKycDocumentAutofillForOnboarding = _a.applyKycDocumentAutofillForOnboarding, exports.applyKybDocumentAutofillForOnboarding = _a.applyKybDocumentAutofillForOnboarding, exports.clearKycKybAutofillForOnboarding = _a.clearKycKybAutofillForOnboarding;
602
721
  exports.default = onboardingCustomerView.reducer;
@@ -15,7 +15,7 @@ import { CompanyView } from '../../companyView/types/companyView';
15
15
  import { CompanyDetails, CompanyOfficersDetails } from '../../spendManagement/commonSetup/setupViewSelector';
16
16
  import { CompanyOfficerLocalData } from '../../spendManagement/commonSetup/setupViewState';
17
17
  import { PlaidConnectionDetails } from '../../spendManagement/plaidAccount/plaidAccountViewState';
18
- import { OnboardingCustomerViewUIState, OnboardingStep } from './onboardingCustomerViewState';
18
+ import { AiAgentsActivationCounts, AiAgentsActivationPhase, AiAgentsActivationSubview, OnboardingCustomerViewUIState, OnboardingStep } from './onboardingCustomerViewState';
19
19
  export interface OnboardingCustomerView {
20
20
  allNationalityCountries: Country[];
21
21
  allRequiredStepsCompleted: boolean;
@@ -55,3 +55,9 @@ export declare const onboardingStepsData: (isValidConnection: boolean, productSe
55
55
  };
56
56
  export declare function isCompanyDetailsSavePending(fileState: FileState, company?: CompanyView, primaryContact?: User, companyDetailsLocalData?: CompanyDetails): boolean;
57
57
  export declare const getProductSettingsString: (productSettings: TenantProductSettings | undefined) => string;
58
+ export declare const getAiAgentsActivationSubview: (state: RootState) => AiAgentsActivationSubview;
59
+ export declare const getAiAgentsActivationLedgerPhases: (state: RootState) => AiAgentsActivationPhase[];
60
+ export declare const getAiAgentsActivationBackgroundPhases: (state: RootState) => AiAgentsActivationPhase[];
61
+ export declare const getAiAgentsActivationCounts: (state: RootState) => AiAgentsActivationCounts;
62
+ export declare const getAiAgentsActivationLedgerRowStatuses: (state: RootState) => ReadonlyArray<"idle" | "starting" | "building">;
63
+ export declare const getAiAgentsActivationBackgroundRowStatuses: (state: RootState) => ReadonlyArray<"idle" | "starting" | "building">;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProductSettingsString = exports.onboardingStepsData = void 0;
3
+ exports.getAiAgentsActivationBackgroundRowStatuses = exports.getAiAgentsActivationLedgerRowStatuses = exports.getAiAgentsActivationCounts = exports.getAiAgentsActivationBackgroundPhases = exports.getAiAgentsActivationLedgerPhases = exports.getAiAgentsActivationSubview = exports.getProductSettingsString = exports.onboardingStepsData = void 0;
4
4
  exports.getOnboardingCustomerView = getOnboardingCustomerView;
5
5
  exports.isOfficerDetailsCompleted = isOfficerDetailsCompleted;
6
6
  exports.isCompanyDetailsSavePending = isCompanyDetailsSavePending;
@@ -331,3 +331,23 @@ const getProductSettingsString = (productSettings) => {
331
331
  .join(',');
332
332
  };
333
333
  exports.getProductSettingsString = getProductSettingsString;
334
+ const fromActivationView = (state) => state.onboardingCustomerViewState.aiAgentsActivation;
335
+ const getAiAgentsActivationSubview = (state) => fromActivationView(state);
336
+ exports.getAiAgentsActivationSubview = getAiAgentsActivationSubview;
337
+ const getAiAgentsActivationLedgerPhases = (state) => fromActivationView(state).ledgerPhases;
338
+ exports.getAiAgentsActivationLedgerPhases = getAiAgentsActivationLedgerPhases;
339
+ const getAiAgentsActivationBackgroundPhases = (state) => fromActivationView(state).backgroundPhases;
340
+ exports.getAiAgentsActivationBackgroundPhases = getAiAgentsActivationBackgroundPhases;
341
+ const getAiAgentsActivationCounts = (state) => fromActivationView(state).counts;
342
+ exports.getAiAgentsActivationCounts = getAiAgentsActivationCounts;
343
+ const SECTION_ROW_STATUS_FALLBACK = 'idle';
344
+ const phaseStatusToRowStatus = (status) => {
345
+ if (status === 'ready') {
346
+ return 'building';
347
+ }
348
+ return status;
349
+ };
350
+ const getAiAgentsActivationLedgerRowStatuses = (state) => fromActivationView(state).ledgerPhases.map((phase) => phaseStatusToRowStatus(phase.status ?? SECTION_ROW_STATUS_FALLBACK));
351
+ exports.getAiAgentsActivationLedgerRowStatuses = getAiAgentsActivationLedgerRowStatuses;
352
+ const getAiAgentsActivationBackgroundRowStatuses = (state) => fromActivationView(state).backgroundPhases.map((phase) => phaseStatusToRowStatus(phase.status ?? SECTION_ROW_STATUS_FALLBACK));
353
+ exports.getAiAgentsActivationBackgroundRowStatuses = getAiAgentsActivationBackgroundRowStatuses;
@@ -21,10 +21,21 @@ export interface OnboardingCustomerViewUIState {
21
21
  isQBOPopupOpen: boolean;
22
22
  }
23
23
  export interface OnboardingCustomerViewState extends FetchedState {
24
+ aiAgentsActivation: AiAgentsActivationSubview;
24
25
  companyDetails: {
26
+ /**
27
+ * Field names from {@link CompanyDetailsLocalData} populated by AI autofill
28
+ * from an uploaded KYB document during onboarding. Drives the ✦ sparkle.
29
+ */
30
+ autoFilledFields: string[];
25
31
  localData?: CompanyDetailsLocalData;
26
32
  };
27
33
  companyOfficerUpdateStatus: Record<CompanyOfficerType, {
34
+ /**
35
+ * Field names from {@link CompanyOfficerLocalData} populated by AI autofill
36
+ * from an uploaded KYC identity document during onboarding.
37
+ */
38
+ autoFilledFields: string[];
28
39
  otpverificationStatus: FetchStateAndError;
29
40
  sendOtpStatus: FetchStateAndError;
30
41
  localData?: CompanyOfficerLocalData;
@@ -44,5 +55,31 @@ export interface OnboardingCustomerViewState extends FetchedState {
44
55
  subscriptionPaymentAccountIds: ID[];
45
56
  uiState: OnboardingCustomerViewUIState;
46
57
  updateStatus: FetchStateAndError;
58
+ aiFinanceTeamAcknowledgementStatus?: FetchStateAndError;
47
59
  subscriptionBillingAddress?: Address;
48
60
  }
61
+ export type AiAgentsActivationPhaseStatus = 'idle' | 'starting' | 'building' | 'ready';
62
+ export type AiAgentsActivationSection = 'ledger' | 'background';
63
+ export interface AiAgentsActivationPhase {
64
+ key: string;
65
+ section: AiAgentsActivationSection;
66
+ status: AiAgentsActivationPhaseStatus;
67
+ completedAt?: string;
68
+ startedAt?: string;
69
+ }
70
+ export interface AiAgentsActivationCounts {
71
+ customerCount: number;
72
+ glAccountCount: number;
73
+ targetTransactionCount: number;
74
+ transactionCount: number;
75
+ vendorCount: number;
76
+ asOf?: string;
77
+ }
78
+ export interface AiAgentsActivationSubview {
79
+ backgroundPhases: AiAgentsActivationPhase[];
80
+ counts: AiAgentsActivationCounts;
81
+ fetchStatus: FetchStateAndError;
82
+ ledgerPhases: AiAgentsActivationPhase[];
83
+ }
84
+ export declare const emptyAiAgentsActivationCounts: AiAgentsActivationCounts;
85
+ export declare const emptyAiAgentsActivationSubview: AiAgentsActivationSubview;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toOnboardingStepType = exports.ALL_ONBOARDING_STEPS = exports.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = exports.ALL_ZENI_USER_ONBOARDING_STEPS = exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT = exports.REQUIRED_ONBOARDING_STEPS = exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO = exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = void 0;
3
+ exports.emptyAiAgentsActivationSubview = exports.emptyAiAgentsActivationCounts = exports.toOnboardingStepType = exports.ALL_ONBOARDING_STEPS = exports.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = exports.ALL_ZENI_USER_ONBOARDING_STEPS = exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT = exports.REQUIRED_ONBOARDING_STEPS = exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO = exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = void 0;
4
4
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
5
  exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = [
6
6
  'link_payment_account',
@@ -30,3 +30,16 @@ exports.ALL_ONBOARDING_STEPS = [
30
30
  ];
31
31
  const toOnboardingStepType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_ONBOARDING_STEPS);
32
32
  exports.toOnboardingStepType = toOnboardingStepType;
33
+ exports.emptyAiAgentsActivationCounts = {
34
+ customerCount: 0,
35
+ glAccountCount: 0,
36
+ targetTransactionCount: 0,
37
+ transactionCount: 0,
38
+ vendorCount: 0,
39
+ };
40
+ exports.emptyAiAgentsActivationSubview = {
41
+ backgroundPhases: [],
42
+ counts: exports.emptyAiAgentsActivationCounts,
43
+ fetchStatus: { fetchState: 'Not-Started', error: undefined },
44
+ ledgerPhases: [],
45
+ };
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../../../reducer';
3
+ import { ZeniAPI } from '../../../../../zeniAPI';
4
+ import { applyKybDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
5
+ import { parseUploadedKybDocument } from '../../kycKybAutofillActions';
6
+ import { applyKybDocumentAutofillForSetup } from '../../setupViewReducer';
7
+ export type ActionType = ReturnType<typeof parseUploadedKybDocument | typeof applyKybDocumentAutofillForSetup | typeof applyKybDocumentAutofillForOnboarding>;
8
+ export declare const parseUploadedKybDocumentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<unknown>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseUploadedKybDocumentEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../../responsePayload");
7
+ const onboardingCustomerViewReducer_1 = require("../../../../onboardingView/customerView/onboardingCustomerViewReducer");
8
+ const kycKybAutofillActions_1 = require("../../kycKybAutofillActions");
9
+ const kycKybParseMapper_1 = require("../../kycKybParseMapper");
10
+ const setupViewReducer_1 = require("../../setupViewReducer");
11
+ const PROCESS_DOCUMENT_SYNC_PATH = '/1.0/documents/process/sync';
12
+ const parseUploadedKybDocumentEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(kycKybAutofillActions_1.parseUploadedKybDocument.match), (0, operators_1.mergeMap)((action) => {
13
+ const { target, companyId, fileId, documentType } = action.payload;
14
+ const url = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}${PROCESS_DOCUMENT_SYNC_PATH}`;
15
+ const requestPayload = {
16
+ provided_document_type: documentType,
17
+ files: [{ file_id: fileId }],
18
+ processing_priority: 10,
19
+ metadata: { source: 'kyc_kyb_autofill' },
20
+ };
21
+ return zeniAPI
22
+ .postAndGetJSON(url, requestPayload)
23
+ .pipe((0, operators_1.mergeMap)((response) => {
24
+ if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
25
+ return (0, rxjs_1.of)();
26
+ }
27
+ let result;
28
+ switch (documentType) {
29
+ case 'certificate_of_incorporation':
30
+ result = (0, kycKybParseMapper_1.mapCoiToCompanyDetails)(response.data);
31
+ break;
32
+ case 'tax_ein':
33
+ result = (0, kycKybParseMapper_1.mapTaxEinToCompanyDetails)(response.data);
34
+ break;
35
+ }
36
+ if (result.autoFilledFieldNames.length === 0) {
37
+ return (0, rxjs_1.of)();
38
+ }
39
+ const applyAction = target === 'setup'
40
+ ? (0, setupViewReducer_1.applyKybDocumentAutofillForSetup)({
41
+ companyId,
42
+ values: result.values,
43
+ autoFilledFieldNames: result.autoFilledFieldNames,
44
+ })
45
+ : (0, onboardingCustomerViewReducer_1.applyKybDocumentAutofillForOnboarding)({
46
+ companyId,
47
+ values: result.values,
48
+ autoFilledFieldNames: result.autoFilledFieldNames,
49
+ });
50
+ return (0, rxjs_1.of)(applyAction);
51
+ }), (0, operators_1.catchError)(() => (0, rxjs_1.of)()));
52
+ }));
53
+ exports.parseUploadedKybDocumentEpic = parseUploadedKybDocumentEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../../../reducer';
3
+ import { ZeniAPI } from '../../../../../zeniAPI';
4
+ import { applyKycDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
5
+ import { parseUploadedKycDocument } from '../../kycKybAutofillActions';
6
+ import { applyKycDocumentAutofillForSetup } from '../../setupViewReducer';
7
+ export type ActionType = ReturnType<typeof parseUploadedKycDocument | typeof applyKycDocumentAutofillForSetup | typeof applyKycDocumentAutofillForOnboarding>;
8
+ export declare const parseUploadedKycDocumentEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<unknown>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseUploadedKycDocumentEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const countryListSelector_1 = require("../../../../../entity/countryList/countryListSelector");
7
+ const responsePayload_1 = require("../../../../../responsePayload");
8
+ const onboardingCustomerViewReducer_1 = require("../../../../onboardingView/customerView/onboardingCustomerViewReducer");
9
+ const kycKybAutofillActions_1 = require("../../kycKybAutofillActions");
10
+ const kycKybParseMapper_1 = require("../../kycKybParseMapper");
11
+ const setupViewReducer_1 = require("../../setupViewReducer");
12
+ const PROCESS_DOCUMENT_SYNC_PATH = '/1.0/documents/process/sync';
13
+ const parseUploadedKycDocumentEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(kycKybAutofillActions_1.parseUploadedKycDocument.match), (0, operators_1.mergeMap)((action) => {
14
+ const { target, companyId, officerType, fileId, documentType } = action.payload;
15
+ const url = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}${PROCESS_DOCUMENT_SYNC_PATH}`;
16
+ const requestPayload = {
17
+ provided_document_type: documentType,
18
+ files: [{ file_id: fileId }],
19
+ processing_priority: 10,
20
+ metadata: { source: 'kyc_kyb_autofill' },
21
+ };
22
+ return zeniAPI
23
+ .postAndGetJSON(url, requestPayload)
24
+ .pipe((0, operators_1.mergeMap)((response) => {
25
+ if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
26
+ return (0, rxjs_1.of)();
27
+ }
28
+ const allCountries = (0, countryListSelector_1.getCountryList)(state$.value.countryListState, 'nationalityCountryList').countries;
29
+ let result;
30
+ switch (documentType) {
31
+ case 'passport':
32
+ result = (0, kycKybParseMapper_1.mapPassportToOfficer)(response.data, allCountries);
33
+ break;
34
+ case 'driving_license':
35
+ result = (0, kycKybParseMapper_1.mapDrivingLicenseToOfficer)(response.data);
36
+ break;
37
+ case 'social_security_card':
38
+ result = (0, kycKybParseMapper_1.mapSsnCardToOfficer)(response.data);
39
+ break;
40
+ }
41
+ if (result.autoFilledFieldNames.length === 0) {
42
+ return (0, rxjs_1.of)();
43
+ }
44
+ const applyAction = target === 'setup'
45
+ ? (0, setupViewReducer_1.applyKycDocumentAutofillForSetup)({
46
+ companyId,
47
+ officerType,
48
+ values: result.values,
49
+ autoFilledFieldNames: result.autoFilledFieldNames,
50
+ })
51
+ : (0, onboardingCustomerViewReducer_1.applyKycDocumentAutofillForOnboarding)({
52
+ companyId,
53
+ officerType,
54
+ values: result.values,
55
+ autoFilledFieldNames: result.autoFilledFieldNames,
56
+ });
57
+ return (0, rxjs_1.of)(applyAction);
58
+ }), (0, operators_1.catchError)(() =>
59
+ // Autofill is best-effort; swallow errors silently so the user can keep typing.
60
+ (0, rxjs_1.of)()));
61
+ }));
62
+ exports.parseUploadedKycDocumentEpic = parseUploadedKycDocumentEpic;
@@ -0,0 +1,27 @@
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 { ID } from '../../../commonStateTypes/common';
11
+ import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
12
+ import { KybProvidedDocumentType, KycKybAutofillTarget, KycProvidedDocumentType } from './types/kycKybAutofill';
13
+ export interface ParseUploadedKycDocumentPayload {
14
+ companyId: ID;
15
+ documentType: KycProvidedDocumentType;
16
+ fileId: ID;
17
+ officerType: CompanyOfficerType;
18
+ target: KycKybAutofillTarget;
19
+ }
20
+ export interface ParseUploadedKybDocumentPayload {
21
+ companyId: ID;
22
+ documentType: KybProvidedDocumentType;
23
+ fileId: ID;
24
+ target: KycKybAutofillTarget;
25
+ }
26
+ export declare const parseUploadedKycDocument: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedKycDocumentPayload, string>;
27
+ export declare const parseUploadedKybDocument: import("@reduxjs/toolkit").ActionCreatorWithPayload<ParseUploadedKybDocumentPayload, string>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * Trigger actions for the KYC / KYB autofill epics.
4
+ *
5
+ * These actions don't mutate state — the epic listens for them, calls
6
+ * document-communication-agent's sync endpoint, and dispatches the appropriate
7
+ * `applyKyc/KybDocumentAutofillFor{Setup,Onboarding}` against the matching
8
+ * slice. Co-located with the rest of the commonSetup module because the entire
9
+ * autofill flow is auxiliary to the setup view; there is no separate state.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.parseUploadedKybDocument = exports.parseUploadedKycDocument = void 0;
13
+ const toolkit_1 = require("@reduxjs/toolkit");
14
+ exports.parseUploadedKycDocument = (0, toolkit_1.createAction)('commonSetup/parseUploadedKycDocument');
15
+ exports.parseUploadedKybDocument = (0, toolkit_1.createAction)('commonSetup/parseUploadedKybDocument');
@@ -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>;