@zeniai/client-epic-state 5.1.4-beta5ND → 5.1.4-betaML1

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 (82) hide show
  1. package/lib/entity/company/companyPayload.d.ts +0 -4
  2. package/lib/entity/company/companyPayload.js +0 -6
  3. package/lib/entity/company/companyStateTypes.d.ts +0 -7
  4. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -1
  5. package/lib/entity/paymentAccount/paymentAccountSelector.js +0 -9
  6. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  7. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  8. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  9. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  10. package/lib/entity/tenant/tenantPayload.d.ts +0 -1
  11. package/lib/entity/tenant/tenantReducer.d.ts +25 -38
  12. package/lib/entity/tenant/tenantReducer.js +5 -65
  13. package/lib/entity/tenant/tenantState.d.ts +0 -1
  14. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +2 -0
  15. package/lib/entity/transaction/payloadTypes/transactionPayload.js +1 -0
  16. package/lib/entity/transaction/stateTypes/transaction.d.ts +2 -0
  17. package/lib/epic.d.ts +1 -6
  18. package/lib/epic.js +1 -7
  19. package/lib/esm/entity/company/companyPayload.js +0 -6
  20. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +0 -8
  21. package/lib/esm/entity/tenant/tenantReducer.js +3 -63
  22. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +1 -0
  23. package/lib/esm/epic.js +1 -7
  24. package/lib/esm/index.js +7 -11
  25. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +1 -0
  26. package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
  27. package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
  28. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +18 -24
  29. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +15 -16
  30. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +51 -223
  31. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +12 -24
  32. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +6 -37
  33. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +52 -106
  34. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
  35. package/lib/index.d.ts +10 -14
  36. package/lib/index.js +35 -64
  37. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +1 -0
  38. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -0
  39. package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
  40. package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
  41. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +18 -24
  42. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +14 -15
  43. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +0 -3
  44. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +5 -44
  45. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +52 -225
  46. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -6
  47. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +12 -27
  48. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +8 -52
  49. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +7 -39
  50. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -28
  51. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +53 -107
  52. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +2 -7
  53. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
  54. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -19
  55. package/package.json +1 -1
  56. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +0 -21
  57. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -59
  58. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -55
  59. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -40
  60. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +0 -29
  61. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -40
  62. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -58
  63. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -77
  64. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -14
  65. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -207
  66. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -41
  67. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +0 -7
  68. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -44
  69. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +0 -8
  70. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +0 -33
  71. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +0 -9
  72. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -44
  73. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +0 -28
  74. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -62
  75. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +0 -9
  76. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -81
  77. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +0 -24
  78. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -17
  79. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +0 -29
  80. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -215
  81. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +0 -154
  82. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -46
@@ -1,7 +1,5 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import { date } from '../../../zeniDayJS';
3
- import { parseUploadedKybDocument, parseUploadedKybDocumentFailure, parseUploadedKycDocument, parseUploadedKycDocumentFailure, } from '../../spendManagement/commonSetup/kycKybAutofillActions';
4
- import { emptyAiAgentsActivationSubview, } from './onboardingCustomerViewState';
5
3
  const initialStatus = {
6
4
  fetchState: 'Not-Started',
7
5
  error: undefined,
@@ -10,33 +8,62 @@ export const initialState = {
10
8
  updateStatus: initialStatus,
11
9
  saveStatus: initialStatus,
12
10
  dashboardLoadedStatus: initialStatus,
13
- currentStep: 'setup_billing',
14
- currentSubStep: 'default',
15
- parsingDocumentFileIds: [],
11
+ currentStep: 'link_payment_account',
16
12
  companyDetails: {
17
- autoFilledFields: [],
18
13
  localData: undefined,
19
14
  },
20
- companyOfficerUpdateStatus: (() => {
21
- const emptyOfficerSlot = {
22
- autoFilledFields: [],
15
+ companyOfficerUpdateStatus: {
16
+ Officer_1: {
23
17
  localData: undefined,
24
18
  sendOtpStatus: initialStatus,
25
19
  otpverificationStatus: initialStatus,
26
- };
27
- return {
28
- Officer_1: { ...emptyOfficerSlot },
29
- Officer_2: { ...emptyOfficerSlot },
30
- Officer_3: { ...emptyOfficerSlot },
31
- Officer_4: { ...emptyOfficerSlot },
32
- Officer_5: { ...emptyOfficerSlot },
33
- Officer_6: { ...emptyOfficerSlot },
34
- Officer_7: { ...emptyOfficerSlot },
35
- Officer_8: { ...emptyOfficerSlot },
36
- Officer_9: { ...emptyOfficerSlot },
37
- Officer_10: { ...emptyOfficerSlot },
38
- };
39
- })(),
20
+ },
21
+ Officer_2: {
22
+ localData: undefined,
23
+ sendOtpStatus: initialStatus,
24
+ otpverificationStatus: initialStatus,
25
+ },
26
+ Officer_3: {
27
+ localData: undefined,
28
+ sendOtpStatus: initialStatus,
29
+ otpverificationStatus: initialStatus,
30
+ },
31
+ Officer_4: {
32
+ localData: undefined,
33
+ sendOtpStatus: initialStatus,
34
+ otpverificationStatus: initialStatus,
35
+ },
36
+ Officer_5: {
37
+ localData: undefined,
38
+ sendOtpStatus: initialStatus,
39
+ otpverificationStatus: initialStatus,
40
+ },
41
+ Officer_6: {
42
+ localData: undefined,
43
+ sendOtpStatus: initialStatus,
44
+ otpverificationStatus: initialStatus,
45
+ },
46
+ Officer_7: {
47
+ localData: undefined,
48
+ sendOtpStatus: initialStatus,
49
+ otpverificationStatus: initialStatus,
50
+ },
51
+ Officer_8: {
52
+ localData: undefined,
53
+ sendOtpStatus: initialStatus,
54
+ otpverificationStatus: initialStatus,
55
+ },
56
+ Officer_9: {
57
+ localData: undefined,
58
+ sendOtpStatus: initialStatus,
59
+ otpverificationStatus: initialStatus,
60
+ },
61
+ Officer_10: {
62
+ localData: undefined,
63
+ sendOtpStatus: initialStatus,
64
+ otpverificationStatus: initialStatus,
65
+ },
66
+ },
40
67
  primaryContactDetails: {},
41
68
  paymentAccountDetails: {
42
69
  fetchStatus: initialStatus,
@@ -64,7 +91,6 @@ export const initialState = {
64
91
  },
65
92
  fetchState: 'Not-Started',
66
93
  error: undefined,
67
- aiAgentsActivation: { ...emptyAiAgentsActivationSubview },
68
94
  uiState: {
69
95
  isQBOPopupOpen: false,
70
96
  isCardPaymentPopupOpen: false,
@@ -117,9 +143,6 @@ const onboardingCustomerView = createSlice({
117
143
  updateCurrentStep(draft, action) {
118
144
  draft.currentStep = action.payload.step;
119
145
  },
120
- updateCurrentSubStep(draft, action) {
121
- draft.currentSubStep = action.payload.subStep;
122
- },
123
146
  updateOnboardingCustomerViewAccountDetails: {
124
147
  prepare(paymentAccountIds, subscriptionPaymentAccountIds) {
125
148
  return { payload: { paymentAccountIds, subscriptionPaymentAccountIds } };
@@ -157,126 +180,6 @@ const onboardingCustomerView = createSlice({
157
180
  };
158
181
  },
159
182
  },
160
- acknowledgeOnboardingAiFinanceTeam: {
161
- reducer(draft) {
162
- draft.aiFinanceTeamAcknowledgementStatus = {
163
- fetchState: 'In-Progress',
164
- error: undefined,
165
- };
166
- },
167
- prepare(companyId) {
168
- return {
169
- payload: { companyId },
170
- };
171
- },
172
- },
173
- acknowledgeOnboardingAiFinanceTeamSuccess(draft) {
174
- draft.aiFinanceTeamAcknowledgementStatus = {
175
- fetchState: 'Completed',
176
- error: undefined,
177
- };
178
- },
179
- acknowledgeOnboardingAiFinanceTeamFailure: {
180
- reducer(draft, action) {
181
- draft.aiFinanceTeamAcknowledgementStatus = {
182
- fetchState: 'Error',
183
- error: action.payload,
184
- };
185
- },
186
- prepare(error) {
187
- return {
188
- payload: error,
189
- };
190
- },
191
- },
192
- acknowledgeOnboardingAiActivationViewed: {
193
- reducer(draft) {
194
- draft.aiActivationViewedAcknowledgementStatus = {
195
- fetchState: 'In-Progress',
196
- error: undefined,
197
- };
198
- },
199
- prepare(companyId) {
200
- return {
201
- payload: { companyId },
202
- };
203
- },
204
- },
205
- acknowledgeOnboardingAiActivationViewedSuccess(draft) {
206
- draft.aiActivationViewedAcknowledgementStatus = {
207
- fetchState: 'Completed',
208
- error: undefined,
209
- };
210
- },
211
- acknowledgeOnboardingAiActivationViewedFailure: {
212
- reducer(draft, action) {
213
- draft.aiActivationViewedAcknowledgementStatus = {
214
- fetchState: 'Error',
215
- error: action.payload,
216
- };
217
- },
218
- prepare(error) {
219
- return {
220
- payload: error,
221
- };
222
- },
223
- },
224
- fetchAiAgentsActivationStatus(draft) {
225
- draft.aiAgentsActivation.fetchStatus = {
226
- fetchState: 'In-Progress',
227
- error: undefined,
228
- };
229
- },
230
- fetchAiAgentsActivationStatusSuccess: {
231
- reducer(draft, action) {
232
- draft.aiAgentsActivation.fetchStatus = {
233
- fetchState: 'Completed',
234
- error: undefined,
235
- };
236
- draft.aiAgentsActivation.phases = action.payload.phases;
237
- draft.aiAgentsActivation.counts = action.payload.counts;
238
- },
239
- prepare(payload) {
240
- return { payload };
241
- },
242
- },
243
- fetchAiAgentsActivationStatusFailure: {
244
- reducer(draft, action) {
245
- draft.aiAgentsActivation.fetchStatus = {
246
- fetchState: 'Error',
247
- error: action.payload,
248
- };
249
- },
250
- prepare(error) {
251
- return { payload: error };
252
- },
253
- },
254
- aiAgentsActivationCountsUpdated: {
255
- reducer(draft, action) {
256
- draft.aiAgentsActivation.counts = {
257
- ...draft.aiAgentsActivation.counts,
258
- ...action.payload,
259
- };
260
- },
261
- prepare(payload) {
262
- return { payload };
263
- },
264
- },
265
- aiAgentsActivationPhaseChanged: {
266
- reducer(draft, action) {
267
- const target = draft.aiAgentsActivation.phases;
268
- const index = target.findIndex((phase) => phase.key === action.payload.key);
269
- if (index === -1) {
270
- target.push(action.payload);
271
- }
272
- else {
273
- target[index] = { ...target[index], ...action.payload };
274
- }
275
- },
276
- prepare(payload) {
277
- return { payload };
278
- },
279
- },
280
183
  updateOnboardingCustomerViewDashboardLoaded: {
281
184
  reducer(draft) {
282
185
  draft.dashboardLoadedStatus = {
@@ -689,82 +592,7 @@ const onboardingCustomerView = createSlice({
689
592
  clearOnboardingCustomerView(draft) {
690
593
  Object.assign(draft, initialState);
691
594
  },
692
- /** Merge AI-parsed officer fields into the officer's onboarding localData. */
693
- applyKycDocumentAutofillForOnboarding: {
694
- reducer(draft, action) {
695
- const { officerType, values, autoFilledFieldNames, fileId } = action.payload;
696
- const slot = draft.companyOfficerUpdateStatus[officerType];
697
- slot.localData = Object.assign({}, slot.localData, values);
698
- slot.autoFilledFields = Array.from(new Set([...(slot.autoFilledFields ?? []), ...autoFilledFieldNames]));
699
- draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
700
- },
701
- prepare(payload) {
702
- return { payload };
703
- },
704
- },
705
- /** Merge AI-parsed company fields into companyDetails onboarding localData. */
706
- applyKybDocumentAutofillForOnboarding: {
707
- reducer(draft, action) {
708
- const { values, autoFilledFieldNames, fileId } = action.payload;
709
- draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
710
- const prev = draft.companyDetails.autoFilledFields ?? [];
711
- draft.companyDetails.autoFilledFields = Array.from(new Set([...prev, ...autoFilledFieldNames]));
712
- draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
713
- },
714
- prepare(payload) {
715
- return { payload };
716
- },
717
- },
718
- /** Wipe AI-autofill badges during onboarding. */
719
- clearKycKybAutofillForOnboarding: {
720
- reducer(draft, action) {
721
- const { officerType } = action.payload;
722
- if (officerType != null) {
723
- draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
724
- }
725
- else {
726
- draft.companyDetails.autoFilledFields = [];
727
- Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
728
- draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
729
- });
730
- }
731
- },
732
- prepare(payload = {}) {
733
- return { payload };
734
- },
735
- },
736
- },
737
- extraReducers: (builder) => {
738
- const addParsingFileId = (draft, fileId) => {
739
- draft.parsingDocumentFileIds = draft.parsingDocumentFileIds ?? [];
740
- if (!draft.parsingDocumentFileIds.includes(fileId)) {
741
- draft.parsingDocumentFileIds.push(fileId);
742
- }
743
- };
744
- const removeParsingFileId = (draft, fileId) => {
745
- draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
746
- };
747
- builder.addCase(parseUploadedKycDocument, (draft, action) => {
748
- if (action.payload.target === 'onboarding') {
749
- addParsingFileId(draft, action.payload.fileId);
750
- }
751
- });
752
- builder.addCase(parseUploadedKybDocument, (draft, action) => {
753
- if (action.payload.target === 'onboarding') {
754
- addParsingFileId(draft, action.payload.fileId);
755
- }
756
- });
757
- builder.addCase(parseUploadedKycDocumentFailure, (draft, action) => {
758
- if (action.payload.target === 'onboarding') {
759
- removeParsingFileId(draft, action.payload.fileId);
760
- }
761
- });
762
- builder.addCase(parseUploadedKybDocumentFailure, (draft, action) => {
763
- if (action.payload.target === 'onboarding') {
764
- removeParsingFileId(draft, action.payload.fileId);
765
- }
766
- });
767
595
  },
768
596
  });
769
- export const { fetchOnboardingCustomerView, fetchOnboardingCustomerSetupView, fetchOnboardingCustomerSetupViewSuccess, fetchOnboardingCustomerSetupViewFailure, updateOnboardingCustomerViewCompleteStatus, updateOnboardingCustomerViewCompleteStatusSuccess, updateOnboardingCustomerViewCompleteStatusFailure, acknowledgeOnboardingAiFinanceTeam, acknowledgeOnboardingAiFinanceTeamSuccess, acknowledgeOnboardingAiFinanceTeamFailure, acknowledgeOnboardingAiActivationViewed, acknowledgeOnboardingAiActivationViewedSuccess, acknowledgeOnboardingAiActivationViewedFailure, fetchAiAgentsActivationStatus, fetchAiAgentsActivationStatusSuccess, fetchAiAgentsActivationStatusFailure, aiAgentsActivationCountsUpdated, aiAgentsActivationPhaseChanged, updateOnboardingCustomerViewDashboardLoaded, updateOnboardingCustomerViewDashboardLoadedSuccess, updateOnboardingCustomerViewDashboardLoadedFailure, updateOnboardingCustomerView, updateOnboardingCustomerViewSuccess, updateOnboardingCustomerViewFailure, updateOnboardingPaymentAccountStatus, updateOnboardingPaymentAccountStatusSuccess, updateOnboardingPaymentAccountStatusFailure, updateOnboardingPaymentAccountLoginStatus, updateOnboardingPaymentAccountLoginStatusSuccess, updateOnboardingPaymentAccountLoginStatusFailure, establishOnboardingPlaidConnection, establishOnboardingPlaidConnectionSuccess, establishOnboardingPlaidConnectionFailure, getOnboardingPlaidLinkToken, getOnboardingPlaidLinkTokenSuccess, getOnboardingPlaidLinkTokenFailure, updateCurrentStep, updateCurrentSubStep, updateOnboardingCustomerViewAccountDetails, updateOnboardingCustomerViewLocalStoreData, saveOnboardingCustomerViewDataInLocalStore, saveOnboardingCompnayOfficerPhoneInLocalStore, updateOnboardingCustomerViewUIState, sendOnboardingOfficerOtp, sendOnboardingOfficerOtpSuccess, sendOnboardingOfficerOtpFailure, resendOnboardingOfficerOtp, verifyOnboardingOfficerOtp, verifyOnboardingOfficerOtpSuccess, verifyOnboardingOfficerOtpFailure, clearOnboardingCustomerViewDataInLocalStore, clearOnboardingCustomerView, applyKycDocumentAutofillForOnboarding, applyKybDocumentAutofillForOnboarding, clearKycKybAutofillForOnboarding, } = onboardingCustomerView.actions;
597
+ export const { fetchOnboardingCustomerView, fetchOnboardingCustomerSetupView, fetchOnboardingCustomerSetupViewSuccess, fetchOnboardingCustomerSetupViewFailure, updateOnboardingCustomerViewCompleteStatus, updateOnboardingCustomerViewCompleteStatusSuccess, updateOnboardingCustomerViewCompleteStatusFailure, updateOnboardingCustomerViewDashboardLoaded, updateOnboardingCustomerViewDashboardLoadedSuccess, updateOnboardingCustomerViewDashboardLoadedFailure, updateOnboardingCustomerView, updateOnboardingCustomerViewSuccess, updateOnboardingCustomerViewFailure, updateOnboardingPaymentAccountStatus, updateOnboardingPaymentAccountStatusSuccess, updateOnboardingPaymentAccountStatusFailure, updateOnboardingPaymentAccountLoginStatus, updateOnboardingPaymentAccountLoginStatusSuccess, updateOnboardingPaymentAccountLoginStatusFailure, establishOnboardingPlaidConnection, establishOnboardingPlaidConnectionSuccess, establishOnboardingPlaidConnectionFailure, getOnboardingPlaidLinkToken, getOnboardingPlaidLinkTokenSuccess, getOnboardingPlaidLinkTokenFailure, updateCurrentStep, updateOnboardingCustomerViewAccountDetails, updateOnboardingCustomerViewLocalStoreData, saveOnboardingCustomerViewDataInLocalStore, saveOnboardingCompnayOfficerPhoneInLocalStore, updateOnboardingCustomerViewUIState, sendOnboardingOfficerOtp, sendOnboardingOfficerOtpSuccess, sendOnboardingOfficerOtpFailure, resendOnboardingOfficerOtp, verifyOnboardingOfficerOtp, verifyOnboardingOfficerOtpSuccess, verifyOnboardingOfficerOtpFailure, clearOnboardingCustomerViewDataInLocalStore, clearOnboardingCustomerView, } = onboardingCustomerView.actions;
770
598
  export default onboardingCustomerView.reducer;
@@ -8,10 +8,10 @@ import { getUserRoleByUserIds } from '../../../entity/userRole/userRoleSelector'
8
8
  import { getCompanyConfig } from '../../companyConfigView/companyConfigSelector';
9
9
  import { getCompanyView } from '../../companyView/selectorHelpers/getCompanyView';
10
10
  import { getCompanyAndIdentityDetails, } from '../../spendManagement/commonSetup/setupViewSelector';
11
- import { ALL_ONBOARDING_STEPS, ALL_ZENI_USER_ONBOARDING_STEPS, REQUIRED_ONBOARDING_STEPS, ZENI_USER_REQUIRED_ONBOARDING_STEPS, emptyAiAgentsActivationSubview, toOnboardingStepType, } from './onboardingCustomerViewState';
11
+ import { ALL_ONBOARDING_STEPS, ALL_ZENI_USER_ONBOARDING_STEPS, REQUIRED_ONBOARDING_STEPS, ZENI_USER_REQUIRED_ONBOARDING_STEPS, toOnboardingStepType, } from './onboardingCustomerViewState';
12
12
  export function getOnboardingCustomerView(state, companyId) {
13
13
  const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, subscriptionPaymentAccountState, companyConfigState, cardPaymentViewState, countryListState, addressViewState, } = state;
14
- const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, parsingDocumentFileIds, updateStatus, saveStatus, currentStep, currentSubStep, uiState, fetchState, error, } = onboardingCustomerViewState;
14
+ const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, updateStatus, saveStatus, currentStep, uiState, fetchState, error, } = onboardingCustomerViewState;
15
15
  const { paymentAccountIds } = paymentAccountDetails;
16
16
  let subscriptionPaymentAccount;
17
17
  let paymentAccount;
@@ -54,7 +54,6 @@ export function getOnboardingCustomerView(state, companyId) {
54
54
  companyDetails,
55
55
  companyOfficerUpdateStatus,
56
56
  primaryContactDetails,
57
- parsingDocumentFileIds,
58
57
  });
59
58
  const companyAddress = addressViewState.newAddressState?.company_address;
60
59
  if (companyAddress == null &&
@@ -74,7 +73,7 @@ export function getOnboardingCustomerView(state, companyId) {
74
73
  cardPaymentViewState.cardPaymentsIds.length > 0) &&
75
74
  companyView?.company.company.companyOnboardingInfo
76
75
  .subscriptionBillingAddressId != null) {
77
- completedSteps.push('setup_billing');
76
+ completedSteps.push('link_payment_account');
78
77
  }
79
78
  const isPaymentVerified = (paymentAccount?.providerVerificationStatus?.code?.includes('verified') ===
80
79
  true &&
@@ -85,25 +84,24 @@ export function getOnboardingCustomerView(state, companyId) {
85
84
  .subscriptionBillingAddressId != null;
86
85
  if ((isPaymentVerified || hasSubscriptionBillingAddress) &&
87
86
  !(isPaymentVerified && hasSubscriptionBillingAddress)) {
88
- halfCompletedSteps.push('setup_billing');
87
+ halfCompletedSteps.push('link_payment_account');
89
88
  }
90
89
  const isValidConnection = externalConnections?.accounting[0]?.isValid ?? false;
91
90
  if (isValidConnection) {
92
- completedSteps.push('connect_ledger');
91
+ completedSteps.push('qbo_connection');
93
92
  }
94
- const isCompanyDetailsDone = companyDetails.localData != null &&
93
+ if (companyDetails.localData != null &&
95
94
  primaryContactDetails.localData != null &&
96
- isCompanyDetailsCompleted(fileState, companyView, primaryContact);
95
+ isCompanyDetailsCompleted(fileState, companyView, primaryContact)) {
96
+ completedSteps.push('company_details');
97
+ }
97
98
  const officerIndex = companyOfficers.length > 0
98
99
  ? Object.values(companyOfficerLocalData).findIndex((officer) => officer?.isSelectedForVerification === true)
99
100
  : 0;
100
101
  const selectedOfficerType = `Officer_${officerIndex < 0 ? 1 : officerIndex + 1}`;
101
- const isOfficerDone = companyOfficerLocalData[selectedOfficerType] != null &&
102
- isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState);
103
- // The verification step (single sidebar step) is only "complete" once both
104
- // the company-officer and company-details sub-steps are fully filled in.
105
- if (isCompanyDetailsDone && isOfficerDone) {
106
- completedSteps.push('verification');
102
+ if (companyOfficerLocalData[selectedOfficerType] != null &&
103
+ isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState)) {
104
+ completedSteps.push('company_officer');
107
105
  }
108
106
  const { allStepsData, requiredStepsData } = onboardingStepsData(isValidConnection, currentTenant?.productSettings ?? [], accountingConnectionCreationMode);
109
107
  const allRequiredStepsCompleted = requiredStepsData.every((step) => {
@@ -121,7 +119,6 @@ export function getOnboardingCustomerView(state, companyId) {
121
119
  return {
122
120
  companyDetailsLocalData,
123
121
  companyOfficerLocalData,
124
- parsingDocumentFileIds,
125
122
  subscriptionBillingAddress: subscriptionBillingAddress?.addressToCreate,
126
123
  companyView,
127
124
  allNationalityCountries,
@@ -130,7 +127,6 @@ export function getOnboardingCustomerView(state, companyId) {
130
127
  officer: isOfficerDetailsSavePending(companyOfficers, companyOfficerRoles, fileState, companyOfficerLocalData[selectedOfficerType]),
131
128
  },
132
129
  currentStep,
133
- currentSubStep,
134
130
  completedSteps,
135
131
  halfCompletedSteps,
136
132
  allRequiredStepsCompleted,
@@ -327,11 +323,3 @@ export const getProductSettingsString = (productSettings) => {
327
323
  .map((key) => productKeyMap[key])
328
324
  .join(',');
329
325
  };
330
- const fromActivationView = (state) =>
331
- // Fall back to the empty subview so state hydrated from an older persisted
332
- // version (before aiAgentsActivation existed) doesn't crash on .phases/.counts.
333
- state.onboardingCustomerViewState.aiAgentsActivation ??
334
- emptyAiAgentsActivationSubview;
335
- export const getAiAgentsActivationSubview = (state) => fromActivationView(state);
336
- export const getAiAgentsActivationPhases = (state) => fromActivationView(state).phases;
337
- export const getAiAgentsActivationCounts = (state) => fromActivationView(state).counts;
@@ -1,18 +1,17 @@
1
1
  import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
2
- // Onboarding steps are the 4 top-level surfaces. Officer + details verification
3
- // live as sub-steps under `verification` (state machine in CustomerOnboardingPage).
4
- // The optional data-source step is its own surface; the legacy connect-data-source
5
- // sub-step under the old `qbo_connection` no longer exists.
6
- export const ZENI_USER_REQUIRED_ONBOARDING_STEPS = ['setup_billing'];
2
+ export const ZENI_USER_REQUIRED_ONBOARDING_STEPS = [
3
+ 'link_payment_account',
4
+ ];
7
5
  export const CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO = [
8
- 'connect_ledger',
6
+ 'qbo_connection',
9
7
  ];
10
8
  export const REQUIRED_ONBOARDING_STEPS = [
11
9
  ...ZENI_USER_REQUIRED_ONBOARDING_STEPS,
12
10
  ...CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO,
13
11
  ];
14
12
  export const ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT = [
15
- 'verification',
13
+ 'company_officer',
14
+ 'company_details',
16
15
  ];
17
16
  export const ALL_ZENI_USER_ONBOARDING_STEPS = [
18
17
  ...ZENI_USER_REQUIRED_ONBOARDING_STEPS,
@@ -20,40 +19,10 @@ export const ALL_ZENI_USER_ONBOARDING_STEPS = [
20
19
  ];
21
20
  export const ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = [
22
21
  ...CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO,
23
- 'connect_data_source',
24
22
  ...ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
25
23
  ];
26
24
  export const ALL_ONBOARDING_STEPS = [
27
25
  ...REQUIRED_ONBOARDING_STEPS,
28
- 'connect_data_source',
29
26
  ...ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
30
27
  ];
31
28
  export const toOnboardingStepType = (v) => stringToUnion(v, ALL_ONBOARDING_STEPS);
32
- // Per-step sub-state. Lives in Redux so the save epic can tell, for example,
33
- // an officer-form save from a company-details save while both share
34
- // currentStep = 'verification'.
35
- // - 'default' generic landing sub-state.
36
- // - 'ai-activating' connect_ledger interstitial during AI activation.
37
- // - 'unlock-stack' verification landing — VerifyUnlockFinancialStackPage.
38
- // - 'company_officer' verification → officer form.
39
- // - 'company_details' verification → company details form.
40
- export const ALL_ONBOARDING_SUB_STEPS = [
41
- 'default',
42
- 'ai-activating',
43
- 'unlock-stack',
44
- 'company_officer',
45
- 'company_details',
46
- ];
47
- export const toOnboardingSubStepType = (v) => stringToUnion(v, ALL_ONBOARDING_SUB_STEPS);
48
- export const emptyAiAgentsActivationCounts = {
49
- customerCount: 0,
50
- glAccountCount: 0,
51
- targetTransactionCount: 0,
52
- transactionCount: 0,
53
- vendorCount: 0,
54
- };
55
- export const emptyAiAgentsActivationSubview = {
56
- counts: emptyAiAgentsActivationCounts,
57
- fetchStatus: { fetchState: 'Not-Started', error: undefined },
58
- phases: [],
59
- };
@@ -1,30 +1,62 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
- import { parseUploadedKybDocument, parseUploadedKybDocumentFailure, parseUploadedKycDocument, parseUploadedKycDocumentFailure, } from './kycKybAutofillActions';
3
2
  const initialFetchStatus = {
4
3
  fetchState: 'Not-Started',
5
4
  error: undefined,
6
5
  };
7
- const emptyOfficerSlot = {
8
- autoFilledFields: [],
9
- localData: undefined,
10
- sendOtpStatus: initialFetchStatus,
11
- otpverificationStatus: initialFetchStatus,
12
- };
13
6
  export const initialState = {
14
7
  updateStatus: { fetchState: 'Not-Started', error: undefined },
15
- parsingDocumentFileIds: [],
16
- companyDetails: { autoFilledFields: [] },
8
+ companyDetails: {},
17
9
  companyOfficerUpdateStatus: {
18
- Officer_1: { ...emptyOfficerSlot },
19
- Officer_2: { ...emptyOfficerSlot },
20
- Officer_3: { ...emptyOfficerSlot },
21
- Officer_4: { ...emptyOfficerSlot },
22
- Officer_5: { ...emptyOfficerSlot },
23
- Officer_6: { ...emptyOfficerSlot },
24
- Officer_7: { ...emptyOfficerSlot },
25
- Officer_8: { ...emptyOfficerSlot },
26
- Officer_9: { ...emptyOfficerSlot },
27
- Officer_10: { ...emptyOfficerSlot },
10
+ Officer_1: {
11
+ localData: undefined,
12
+ sendOtpStatus: initialFetchStatus,
13
+ otpverificationStatus: initialFetchStatus,
14
+ },
15
+ Officer_2: {
16
+ localData: undefined,
17
+ sendOtpStatus: initialFetchStatus,
18
+ otpverificationStatus: initialFetchStatus,
19
+ },
20
+ Officer_3: {
21
+ localData: undefined,
22
+ sendOtpStatus: initialFetchStatus,
23
+ otpverificationStatus: initialFetchStatus,
24
+ },
25
+ Officer_4: {
26
+ localData: undefined,
27
+ sendOtpStatus: initialFetchStatus,
28
+ otpverificationStatus: initialFetchStatus,
29
+ },
30
+ Officer_5: {
31
+ localData: undefined,
32
+ sendOtpStatus: initialFetchStatus,
33
+ otpverificationStatus: initialFetchStatus,
34
+ },
35
+ Officer_6: {
36
+ localData: undefined,
37
+ sendOtpStatus: initialFetchStatus,
38
+ otpverificationStatus: initialFetchStatus,
39
+ },
40
+ Officer_7: {
41
+ localData: undefined,
42
+ sendOtpStatus: initialFetchStatus,
43
+ otpverificationStatus: initialFetchStatus,
44
+ },
45
+ Officer_8: {
46
+ localData: undefined,
47
+ sendOtpStatus: initialFetchStatus,
48
+ otpverificationStatus: initialFetchStatus,
49
+ },
50
+ Officer_9: {
51
+ localData: undefined,
52
+ sendOtpStatus: initialFetchStatus,
53
+ otpverificationStatus: initialFetchStatus,
54
+ },
55
+ Officer_10: {
56
+ localData: undefined,
57
+ sendOtpStatus: initialFetchStatus,
58
+ otpverificationStatus: initialFetchStatus,
59
+ },
28
60
  },
29
61
  primaryContactDetails: {},
30
62
  };
@@ -265,93 +297,7 @@ const setupView = createSlice({
265
297
  clearSetupView(draft) {
266
298
  Object.assign(draft, initialState);
267
299
  },
268
- /**
269
- * Merge AI-parsed officer fields into the selected officer's localData and
270
- * track which field names were autofilled so the form can show the ✦ badge.
271
- */
272
- applyKycDocumentAutofillForSetup: {
273
- reducer(draft, action) {
274
- const { officerType, values, autoFilledFieldNames, fileId } = action.payload;
275
- const slot = draft.companyOfficerUpdateStatus[officerType];
276
- slot.localData = Object.assign({}, slot.localData, values);
277
- slot.autoFilledFields = Array.from(new Set([...(slot.autoFilledFields ?? []), ...autoFilledFieldNames]));
278
- draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
279
- },
280
- prepare(payload) {
281
- return { payload };
282
- },
283
- },
284
- /**
285
- * Merge AI-parsed company fields into companyDetails.localData and track
286
- * which field names were autofilled.
287
- */
288
- applyKybDocumentAutofillForSetup: {
289
- reducer(draft, action) {
290
- const { values, autoFilledFieldNames, fileId } = action.payload;
291
- draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
292
- draft.companyDetails.autoFilledFields = Array.from(new Set([
293
- ...(draft.companyDetails.autoFilledFields ?? []),
294
- ...autoFilledFieldNames,
295
- ]));
296
- draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
297
- },
298
- prepare(payload) {
299
- return { payload };
300
- },
301
- },
302
- /**
303
- * Wipe AI-autofill badges. If `officerType` is provided, clears only that
304
- * officer; otherwise clears company details too.
305
- */
306
- clearKycKybAutofillForSetup: {
307
- reducer(draft, action) {
308
- const { officerType } = action.payload;
309
- if (officerType != null) {
310
- draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
311
- }
312
- else {
313
- draft.companyDetails.autoFilledFields = [];
314
- Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
315
- draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
316
- });
317
- }
318
- },
319
- prepare(payload = {}) {
320
- return { payload };
321
- },
322
- },
323
- },
324
- extraReducers: (builder) => {
325
- const addParsingFileId = (draft, fileId) => {
326
- draft.parsingDocumentFileIds = draft.parsingDocumentFileIds ?? [];
327
- if (!draft.parsingDocumentFileIds.includes(fileId)) {
328
- draft.parsingDocumentFileIds.push(fileId);
329
- }
330
- };
331
- const removeParsingFileId = (draft, fileId) => {
332
- draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
333
- };
334
- builder.addCase(parseUploadedKycDocument, (draft, action) => {
335
- if (action.payload.target === 'setup') {
336
- addParsingFileId(draft, action.payload.fileId);
337
- }
338
- });
339
- builder.addCase(parseUploadedKybDocument, (draft, action) => {
340
- if (action.payload.target === 'setup') {
341
- addParsingFileId(draft, action.payload.fileId);
342
- }
343
- });
344
- builder.addCase(parseUploadedKycDocumentFailure, (draft, action) => {
345
- if (action.payload.target === 'setup') {
346
- removeParsingFileId(draft, action.payload.fileId);
347
- }
348
- });
349
- builder.addCase(parseUploadedKybDocumentFailure, (draft, action) => {
350
- if (action.payload.target === 'setup') {
351
- removeParsingFileId(draft, action.payload.fileId);
352
- }
353
- });
354
300
  },
355
301
  });
356
- export const { enableSetup, enableSetupSuccess, enableSetupFailure, updateBusinessVerificationDetails, updateBusinessVerificationDetailsSuccess, updateBusinessVerificationDetailsFailure, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, sendOtp: sendOtpSpendManagementSetUp, resendOtp: resendOtpSpendManagementSetUp, sendOtpSuccess: sendOtpSuccessSpendManagementSetUp, sendOtpFailure: sendOtpFailureSpendManagementSetUp, verifyOtp: verifyOtpSpendManagementSetUp, verifyOtpSuccess: verifyOtpSuccessSpendManagementSetUp, verifyOtpFailure: verifyOtpFailureSpendManagementSetUp, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearSetupView, applyKycDocumentAutofillForSetup, applyKybDocumentAutofillForSetup, clearKycKybAutofillForSetup, } = setupView.actions;
302
+ export const { enableSetup, enableSetupSuccess, enableSetupFailure, updateBusinessVerificationDetails, updateBusinessVerificationDetailsSuccess, updateBusinessVerificationDetailsFailure, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, saveSetupViewDataInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, sendOtp: sendOtpSpendManagementSetUp, resendOtp: resendOtpSpendManagementSetUp, sendOtpSuccess: sendOtpSuccessSpendManagementSetUp, sendOtpFailure: sendOtpFailureSpendManagementSetUp, verifyOtp: verifyOtpSpendManagementSetUp, verifyOtpSuccess: verifyOtpSuccessSpendManagementSetUp, verifyOtpFailure: verifyOtpFailureSpendManagementSetUp, saveIndustryAndIncDateInLocalStore, clearSetupViewDataInLocalStore, clearSetupView, } = setupView.actions;
357
303
  export default setupView.reducer;