@zeniai/client-epic-state 5.0.84 → 5.0.85-beta1ND

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 (85) 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/createTransferEntry/epics/createTransferEntryEpic.js +7 -1
  35. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +45 -0
  36. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
  37. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +202 -50
  38. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +17 -1
  39. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -0
  40. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +52 -0
  41. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +59 -0
  42. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +14 -0
  43. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
  44. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +105 -52
  45. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  46. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
  47. package/lib/index.d.ts +15 -11
  48. package/lib/index.js +56 -34
  49. package/lib/view/companyView/companyViewReducer.d.ts +11 -1
  50. package/lib/view/companyView/companyViewReducer.js +47 -3
  51. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.d.ts +9 -0
  52. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +29 -0
  53. package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.d.ts +10 -0
  54. package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.js +83 -0
  55. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
  56. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  57. package/lib/view/createTransferEntry/epics/createTransferEntryEpic.js +7 -1
  58. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  59. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
  60. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +49 -0
  61. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
  62. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
  63. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
  64. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +45 -4
  65. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +204 -51
  66. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +8 -1
  67. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +24 -2
  68. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +42 -0
  69. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +14 -1
  70. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +28 -0
  71. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +56 -0
  72. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +30 -0
  73. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +63 -0
  74. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +33 -0
  75. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +17 -0
  76. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
  77. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
  78. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +28 -2
  79. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +106 -53
  80. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +7 -2
  81. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  82. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +19 -0
  83. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
  84. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
  85. package/package.json +1 -1
@@ -1,9 +1,12 @@
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 kycKybAutofillActions_1 = require("../../spendManagement/commonSetup/kycKybAutofillActions");
9
+ const onboardingCustomerViewState_1 = require("./onboardingCustomerViewState");
7
10
  const initialStatus = {
8
11
  fetchState: 'Not-Started',
9
12
  error: undefined,
@@ -13,61 +16,31 @@ exports.initialState = {
13
16
  saveStatus: initialStatus,
14
17
  dashboardLoadedStatus: initialStatus,
15
18
  currentStep: 'link_payment_account',
19
+ parsingDocumentFileIds: [],
16
20
  companyDetails: {
21
+ autoFilledFields: [],
17
22
  localData: undefined,
18
23
  },
19
- companyOfficerUpdateStatus: {
20
- Officer_1: {
24
+ companyOfficerUpdateStatus: (() => {
25
+ const emptyOfficerSlot = {
26
+ autoFilledFields: [],
21
27
  localData: undefined,
22
28
  sendOtpStatus: initialStatus,
23
29
  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
- },
30
+ };
31
+ return {
32
+ Officer_1: { ...emptyOfficerSlot },
33
+ Officer_2: { ...emptyOfficerSlot },
34
+ Officer_3: { ...emptyOfficerSlot },
35
+ Officer_4: { ...emptyOfficerSlot },
36
+ Officer_5: { ...emptyOfficerSlot },
37
+ Officer_6: { ...emptyOfficerSlot },
38
+ Officer_7: { ...emptyOfficerSlot },
39
+ Officer_8: { ...emptyOfficerSlot },
40
+ Officer_9: { ...emptyOfficerSlot },
41
+ Officer_10: { ...emptyOfficerSlot },
42
+ };
43
+ })(),
71
44
  primaryContactDetails: {},
72
45
  paymentAccountDetails: {
73
46
  fetchStatus: initialStatus,
@@ -95,6 +68,7 @@ exports.initialState = {
95
68
  },
96
69
  fetchState: 'Not-Started',
97
70
  error: undefined,
71
+ aiAgentsActivation: { ...onboardingCustomerViewState_1.emptyAiAgentsActivationSubview },
98
72
  uiState: {
99
73
  isQBOPopupOpen: false,
100
74
  isCardPaymentPopupOpen: false,
@@ -184,6 +158,111 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
184
158
  };
185
159
  },
186
160
  },
161
+ acknowledgeOnboardingAiFinanceTeam: {
162
+ reducer(draft) {
163
+ draft.aiFinanceTeamAcknowledgementStatus = {
164
+ fetchState: 'In-Progress',
165
+ error: undefined,
166
+ };
167
+ },
168
+ prepare(companyId) {
169
+ return {
170
+ payload: { companyId },
171
+ };
172
+ },
173
+ },
174
+ acknowledgeOnboardingAiFinanceTeamSuccess(draft) {
175
+ draft.aiFinanceTeamAcknowledgementStatus = {
176
+ fetchState: 'Completed',
177
+ error: undefined,
178
+ };
179
+ },
180
+ acknowledgeOnboardingAiFinanceTeamFailure: {
181
+ reducer(draft, action) {
182
+ draft.aiFinanceTeamAcknowledgementStatus = {
183
+ fetchState: 'Error',
184
+ error: action.payload,
185
+ };
186
+ },
187
+ prepare(error) {
188
+ return {
189
+ payload: error,
190
+ };
191
+ },
192
+ },
193
+ fetchAiAgentsActivationStatus(draft) {
194
+ draft.aiAgentsActivation.fetchStatus = {
195
+ fetchState: 'In-Progress',
196
+ error: undefined,
197
+ };
198
+ },
199
+ fetchAiAgentsActivationStatusSuccess: {
200
+ reducer(draft, action) {
201
+ draft.aiAgentsActivation.fetchStatus = {
202
+ fetchState: 'Completed',
203
+ error: undefined,
204
+ };
205
+ draft.aiAgentsActivation.ledgerPhases = action.payload.ledgerPhases;
206
+ draft.aiAgentsActivation.backgroundPhases =
207
+ action.payload.backgroundPhases;
208
+ draft.aiAgentsActivation.counts = action.payload.counts;
209
+ },
210
+ prepare(payload) {
211
+ return { payload };
212
+ },
213
+ },
214
+ fetchAiAgentsActivationStatusFailure: {
215
+ reducer(draft, action) {
216
+ draft.aiAgentsActivation.fetchStatus = {
217
+ fetchState: 'Error',
218
+ error: action.payload,
219
+ };
220
+ },
221
+ prepare(error) {
222
+ return { payload: error };
223
+ },
224
+ },
225
+ aiAgentsActivationCountsUpdated: {
226
+ reducer(draft, action) {
227
+ draft.aiAgentsActivation.counts = {
228
+ ...draft.aiAgentsActivation.counts,
229
+ ...action.payload,
230
+ };
231
+ },
232
+ prepare(payload) {
233
+ return { payload };
234
+ },
235
+ },
236
+ aiAgentsActivationPhaseChanged: {
237
+ reducer(draft, action) {
238
+ const target = action.payload.section === 'ledger'
239
+ ? draft.aiAgentsActivation.ledgerPhases
240
+ : draft.aiAgentsActivation.backgroundPhases;
241
+ const index = target.findIndex((phase) => phase.key === action.payload.key);
242
+ if (index === -1) {
243
+ target.push(action.payload);
244
+ }
245
+ else {
246
+ target[index] = { ...target[index], ...action.payload };
247
+ }
248
+ },
249
+ prepare(payload) {
250
+ return { payload };
251
+ },
252
+ },
253
+ aiAgentsActivationSectionReady: {
254
+ reducer(draft, action) {
255
+ const target = action.payload.section === 'ledger'
256
+ ? draft.aiAgentsActivation.ledgerPhases
257
+ : draft.aiAgentsActivation.backgroundPhases;
258
+ target.forEach((phase) => {
259
+ phase.status = 'ready';
260
+ });
261
+ },
262
+ prepare(payload) {
263
+ return { payload };
264
+ },
265
+ },
187
266
  updateOnboardingCustomerViewDashboardLoaded: {
188
267
  reducer(draft) {
189
268
  draft.dashboardLoadedStatus = {
@@ -596,7 +675,81 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
596
675
  clearOnboardingCustomerView(draft) {
597
676
  Object.assign(draft, exports.initialState);
598
677
  },
678
+ /** Merge AI-parsed officer fields into the officer's onboarding localData. */
679
+ applyKycDocumentAutofillForOnboarding: {
680
+ reducer(draft, action) {
681
+ const { officerType, values, autoFilledFieldNames, fileId } = action.payload;
682
+ const slot = draft.companyOfficerUpdateStatus[officerType];
683
+ slot.localData = Object.assign({}, slot.localData, values);
684
+ slot.autoFilledFields = Array.from(new Set([...slot.autoFilledFields, ...autoFilledFieldNames]));
685
+ draft.parsingDocumentFileIds = draft.parsingDocumentFileIds.filter((id) => id !== fileId);
686
+ },
687
+ prepare(payload) {
688
+ return { payload };
689
+ },
690
+ },
691
+ /** Merge AI-parsed company fields into companyDetails onboarding localData. */
692
+ applyKybDocumentAutofillForOnboarding: {
693
+ reducer(draft, action) {
694
+ const { values, autoFilledFieldNames, fileId } = action.payload;
695
+ draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
696
+ const prev = draft.companyDetails.autoFilledFields ?? [];
697
+ draft.companyDetails.autoFilledFields = Array.from(new Set([...prev, ...autoFilledFieldNames]));
698
+ draft.parsingDocumentFileIds = draft.parsingDocumentFileIds.filter((id) => id !== fileId);
699
+ },
700
+ prepare(payload) {
701
+ return { payload };
702
+ },
703
+ },
704
+ /** Wipe AI-autofill badges during onboarding. */
705
+ clearKycKybAutofillForOnboarding: {
706
+ reducer(draft, action) {
707
+ const { officerType } = action.payload;
708
+ if (officerType != null) {
709
+ draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
710
+ }
711
+ else {
712
+ draft.companyDetails.autoFilledFields = [];
713
+ Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
714
+ draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
715
+ });
716
+ }
717
+ },
718
+ prepare(payload = {}) {
719
+ return { payload };
720
+ },
721
+ },
722
+ },
723
+ extraReducers: (builder) => {
724
+ const addParsingFileId = (draft, fileId) => {
725
+ if (!draft.parsingDocumentFileIds.includes(fileId)) {
726
+ draft.parsingDocumentFileIds.push(fileId);
727
+ }
728
+ };
729
+ const removeParsingFileId = (draft, fileId) => {
730
+ draft.parsingDocumentFileIds = draft.parsingDocumentFileIds.filter((id) => id !== fileId);
731
+ };
732
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocument, (draft, action) => {
733
+ if (action.payload.target === 'onboarding') {
734
+ addParsingFileId(draft, action.payload.fileId);
735
+ }
736
+ });
737
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocument, (draft, action) => {
738
+ if (action.payload.target === 'onboarding') {
739
+ addParsingFileId(draft, action.payload.fileId);
740
+ }
741
+ });
742
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocumentFailure, (draft, action) => {
743
+ if (action.payload.target === 'onboarding') {
744
+ removeParsingFileId(draft, action.payload.fileId);
745
+ }
746
+ });
747
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocumentFailure, (draft, action) => {
748
+ if (action.payload.target === 'onboarding') {
749
+ removeParsingFileId(draft, action.payload.fileId);
750
+ }
751
+ });
599
752
  },
600
753
  });
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;
754
+ _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
755
  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;
@@ -28,6 +28,7 @@ export interface OnboardingCustomerView {
28
28
  fetchStatus: FetchStateAndError;
29
29
  halfCompletedSteps: OnboardingStep[];
30
30
  isInterimEmailSent: boolean;
31
+ parsingDocumentFileIds: ID[];
31
32
  paymentAccountFetchStatus: FetchStateAndError;
32
33
  paymentAccountUpdateStatus: FetchStateAndError;
33
34
  pendingSaveDetails: {
@@ -55,3 +56,9 @@ export declare const onboardingStepsData: (isValidConnection: boolean, productSe
55
56
  };
56
57
  export declare function isCompanyDetailsSavePending(fileState: FileState, company?: CompanyView, primaryContact?: User, companyDetailsLocalData?: CompanyDetails): boolean;
57
58
  export declare const getProductSettingsString: (productSettings: TenantProductSettings | undefined) => string;
59
+ export declare const getAiAgentsActivationSubview: (state: RootState) => AiAgentsActivationSubview;
60
+ export declare const getAiAgentsActivationLedgerPhases: (state: RootState) => AiAgentsActivationPhase[];
61
+ export declare const getAiAgentsActivationBackgroundPhases: (state: RootState) => AiAgentsActivationPhase[];
62
+ export declare const getAiAgentsActivationCounts: (state: RootState) => AiAgentsActivationCounts;
63
+ export declare const getAiAgentsActivationLedgerRowStatuses: (state: RootState) => ReadonlyArray<"idle" | "starting" | "building">;
64
+ 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;
@@ -17,7 +17,7 @@ const setupViewSelector_1 = require("../../spendManagement/commonSetup/setupView
17
17
  const onboardingCustomerViewState_1 = require("./onboardingCustomerViewState");
18
18
  function getOnboardingCustomerView(state, companyId) {
19
19
  const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, subscriptionPaymentAccountState, companyConfigState, cardPaymentViewState, countryListState, addressViewState, } = state;
20
- const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
20
+ const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, parsingDocumentFileIds, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
21
21
  const { paymentAccountIds } = paymentAccountDetails;
22
22
  let subscriptionPaymentAccount;
23
23
  let paymentAccount;
@@ -60,6 +60,7 @@ function getOnboardingCustomerView(state, companyId) {
60
60
  companyDetails,
61
61
  companyOfficerUpdateStatus,
62
62
  primaryContactDetails,
63
+ parsingDocumentFileIds,
63
64
  });
64
65
  const companyAddress = addressViewState.newAddressState?.company_address;
65
66
  if (companyAddress == null &&
@@ -125,6 +126,7 @@ function getOnboardingCustomerView(state, companyId) {
125
126
  return {
126
127
  companyDetailsLocalData,
127
128
  companyOfficerLocalData,
129
+ parsingDocumentFileIds,
128
130
  subscriptionBillingAddress: subscriptionBillingAddress?.addressToCreate,
129
131
  companyView,
130
132
  allNationalityCountries,
@@ -331,3 +333,23 @@ const getProductSettingsString = (productSettings) => {
331
333
  .join(',');
332
334
  };
333
335
  exports.getProductSettingsString = getProductSettingsString;
336
+ const fromActivationView = (state) => state.onboardingCustomerViewState.aiAgentsActivation;
337
+ const getAiAgentsActivationSubview = (state) => fromActivationView(state);
338
+ exports.getAiAgentsActivationSubview = getAiAgentsActivationSubview;
339
+ const getAiAgentsActivationLedgerPhases = (state) => fromActivationView(state).ledgerPhases;
340
+ exports.getAiAgentsActivationLedgerPhases = getAiAgentsActivationLedgerPhases;
341
+ const getAiAgentsActivationBackgroundPhases = (state) => fromActivationView(state).backgroundPhases;
342
+ exports.getAiAgentsActivationBackgroundPhases = getAiAgentsActivationBackgroundPhases;
343
+ const getAiAgentsActivationCounts = (state) => fromActivationView(state).counts;
344
+ exports.getAiAgentsActivationCounts = getAiAgentsActivationCounts;
345
+ const SECTION_ROW_STATUS_FALLBACK = 'idle';
346
+ const phaseStatusToRowStatus = (status) => {
347
+ if (status === 'ready') {
348
+ return 'building';
349
+ }
350
+ return status;
351
+ };
352
+ const getAiAgentsActivationLedgerRowStatuses = (state) => fromActivationView(state).ledgerPhases.map((phase) => phaseStatusToRowStatus(phase.status ?? SECTION_ROW_STATUS_FALLBACK));
353
+ exports.getAiAgentsActivationLedgerRowStatuses = getAiAgentsActivationLedgerRowStatuses;
354
+ const getAiAgentsActivationBackgroundRowStatuses = (state) => fromActivationView(state).backgroundPhases.map((phase) => phaseStatusToRowStatus(phase.status ?? SECTION_ROW_STATUS_FALLBACK));
355
+ exports.getAiAgentsActivationBackgroundRowStatuses = getAiAgentsActivationBackgroundRowStatuses;
@@ -21,16 +21,32 @@ 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;
31
42
  }>;
32
43
  currentStep: OnboardingStep;
33
44
  dashboardLoadedStatus: FetchStateAndError;
45
+ /**
46
+ * File IDs currently being parsed by the AI autofill epic for onboarding.
47
+ * Drives the "AI is reading your document" overlay on the upload field.
48
+ */
49
+ parsingDocumentFileIds: ID[];
34
50
  paymentAccountDetails: {
35
51
  fetchStatus: FetchStateAndError;
36
52
  paymentAccountIds: ID[];
@@ -44,5 +60,31 @@ export interface OnboardingCustomerViewState extends FetchedState {
44
60
  subscriptionPaymentAccountIds: ID[];
45
61
  uiState: OnboardingCustomerViewUIState;
46
62
  updateStatus: FetchStateAndError;
63
+ aiFinanceTeamAcknowledgementStatus?: FetchStateAndError;
47
64
  subscriptionBillingAddress?: Address;
48
65
  }
66
+ export type AiAgentsActivationPhaseStatus = 'idle' | 'starting' | 'building' | 'ready';
67
+ export type AiAgentsActivationSection = 'ledger' | 'background';
68
+ export interface AiAgentsActivationPhase {
69
+ key: string;
70
+ section: AiAgentsActivationSection;
71
+ status: AiAgentsActivationPhaseStatus;
72
+ completedAt?: string;
73
+ startedAt?: string;
74
+ }
75
+ export interface AiAgentsActivationCounts {
76
+ customerCount: number;
77
+ glAccountCount: number;
78
+ targetTransactionCount: number;
79
+ transactionCount: number;
80
+ vendorCount: number;
81
+ asOf?: string;
82
+ }
83
+ export interface AiAgentsActivationSubview {
84
+ backgroundPhases: AiAgentsActivationPhase[];
85
+ counts: AiAgentsActivationCounts;
86
+ fetchStatus: FetchStateAndError;
87
+ ledgerPhases: AiAgentsActivationPhase[];
88
+ }
89
+ export declare const emptyAiAgentsActivationCounts: AiAgentsActivationCounts;
90
+ 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,28 @@
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, parseUploadedKybDocumentFailure } from '../../kycKybAutofillActions';
6
+ import { applyKybDocumentAutofillForSetup } from '../../setupViewReducer';
7
+ import { CompanyDetailsLocalData } from '../../setupViewState';
8
+ export type ActionType = ReturnType<typeof parseUploadedKybDocument | typeof parseUploadedKybDocumentFailure | typeof applyKybDocumentAutofillForSetup | typeof applyKybDocumentAutofillForOnboarding>;
9
+ export declare const parseUploadedKybDocumentEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
+ payload: import("../../kycKybAutofillActions").ParseUploadedDocumentFailurePayload;
11
+ type: string;
12
+ } | {
13
+ payload: {
14
+ autoFilledFieldNames: string[];
15
+ companyId: import("../../../../..").ID;
16
+ fileId: import("../../../../..").ID;
17
+ values: Partial<CompanyDetailsLocalData>;
18
+ };
19
+ type: "onboardingCustomerView/applyKybDocumentAutofillForOnboarding";
20
+ } | {
21
+ payload: {
22
+ autoFilledFieldNames: string[];
23
+ companyId: import("../../../../..").ID;
24
+ fileId: import("../../../../..").ID;
25
+ values: Partial<CompanyDetailsLocalData>;
26
+ };
27
+ type: "setupView/applyKybDocumentAutofillForSetup";
28
+ }>;
@@ -0,0 +1,56 @@
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
+ const failureAction = (0, kycKybAutofillActions_1.parseUploadedKybDocumentFailure)({ target, fileId });
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)(failureAction);
27
+ }
28
+ let result;
29
+ switch (documentType) {
30
+ case 'certificate_of_incorporation':
31
+ result = (0, kycKybParseMapper_1.mapCoiToCompanyDetails)(response.data);
32
+ break;
33
+ case 'tax_ein':
34
+ result = (0, kycKybParseMapper_1.mapTaxEinToCompanyDetails)(response.data);
35
+ break;
36
+ }
37
+ if (result.autoFilledFieldNames.length === 0) {
38
+ return (0, rxjs_1.of)(failureAction);
39
+ }
40
+ const applyAction = target === 'setup'
41
+ ? (0, setupViewReducer_1.applyKybDocumentAutofillForSetup)({
42
+ companyId,
43
+ fileId,
44
+ values: result.values,
45
+ autoFilledFieldNames: result.autoFilledFieldNames,
46
+ })
47
+ : (0, onboardingCustomerViewReducer_1.applyKybDocumentAutofillForOnboarding)({
48
+ companyId,
49
+ fileId,
50
+ values: result.values,
51
+ autoFilledFieldNames: result.autoFilledFieldNames,
52
+ });
53
+ return (0, rxjs_1.of)(applyAction);
54
+ }), (0, operators_1.catchError)(() => (0, rxjs_1.of)(failureAction)));
55
+ }));
56
+ exports.parseUploadedKybDocumentEpic = parseUploadedKybDocumentEpic;
@@ -0,0 +1,30 @@
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, parseUploadedKycDocumentFailure } from '../../kycKybAutofillActions';
6
+ import { applyKycDocumentAutofillForSetup } from '../../setupViewReducer';
7
+ import { CompanyOfficerLocalData } from '../../setupViewState';
8
+ export type ActionType = ReturnType<typeof parseUploadedKycDocument | typeof parseUploadedKycDocumentFailure | typeof applyKycDocumentAutofillForSetup | typeof applyKycDocumentAutofillForOnboarding>;
9
+ export declare const parseUploadedKycDocumentEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
+ payload: import("../../kycKybAutofillActions").ParseUploadedDocumentFailurePayload;
11
+ type: string;
12
+ } | {
13
+ payload: {
14
+ autoFilledFieldNames: string[];
15
+ companyId: import("../../../../..").ID;
16
+ fileId: import("../../../../..").ID;
17
+ officerType: import("../../../../..").CompanyOfficerType;
18
+ values: Partial<CompanyOfficerLocalData>;
19
+ };
20
+ type: "onboardingCustomerView/applyKycDocumentAutofillForOnboarding";
21
+ } | {
22
+ payload: {
23
+ autoFilledFieldNames: string[];
24
+ companyId: import("../../../../..").ID;
25
+ fileId: import("../../../../..").ID;
26
+ officerType: import("../../../../..").CompanyOfficerType;
27
+ values: Partial<CompanyOfficerLocalData>;
28
+ };
29
+ type: "setupView/applyKycDocumentAutofillForSetup";
30
+ }>;