@zeniai/client-epic-state 5.1.4-betaRR0 → 5.1.5

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 (79) hide show
  1. package/lib/entity/company/companyPayload.d.ts +4 -0
  2. package/lib/entity/company/companyPayload.js +6 -0
  3. package/lib/entity/company/companyStateTypes.d.ts +7 -0
  4. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  5. package/lib/entity/paymentAccount/paymentAccountSelector.js +9 -0
  6. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  7. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  8. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +59 -0
  9. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  10. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  11. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  12. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  13. package/lib/entity/tenant/tenantReducer.d.ts +38 -25
  14. package/lib/entity/tenant/tenantReducer.js +65 -5
  15. package/lib/entity/tenant/tenantState.d.ts +1 -0
  16. package/lib/epic.d.ts +6 -1
  17. package/lib/epic.js +7 -1
  18. package/lib/esm/entity/company/companyPayload.js +6 -0
  19. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +8 -0
  20. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +55 -0
  21. package/lib/esm/entity/tenant/tenantReducer.js +63 -3
  22. package/lib/esm/epic.js +7 -1
  23. package/lib/esm/index.js +13 -9
  24. package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
  25. package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
  26. package/lib/esm/view/fileView/fileUploadHelpers.js +0 -46
  27. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +40 -0
  28. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +29 -0
  29. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
  30. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +24 -18
  31. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +29 -17
  32. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +223 -51
  33. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +24 -12
  34. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +37 -6
  35. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +58 -0
  36. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +77 -0
  37. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +14 -0
  38. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +207 -0
  39. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +106 -52
  40. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  41. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +41 -0
  42. package/lib/index.d.ts +16 -12
  43. package/lib/index.js +62 -34
  44. package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
  45. package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
  46. package/lib/view/fileView/fileUploadHelpers.d.ts +0 -6
  47. package/lib/view/fileView/fileUploadHelpers.js +0 -47
  48. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
  49. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +44 -0
  50. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +8 -0
  51. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +33 -0
  52. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
  53. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
  54. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +24 -18
  55. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.d.ts +2 -2
  56. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +27 -15
  57. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
  58. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +44 -5
  59. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +225 -52
  60. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +6 -1
  61. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +27 -12
  62. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +52 -8
  63. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +39 -7
  64. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +28 -0
  65. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +62 -0
  66. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +9 -0
  67. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +81 -0
  68. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +24 -0
  69. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +17 -0
  70. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +29 -0
  71. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +215 -0
  72. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +28 -2
  73. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +107 -53
  74. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +7 -2
  75. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  76. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +19 -0
  77. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +154 -0
  78. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +46 -0
  79. 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.verifyOnboardingOfficerOtpSuccess = exports.verifyOnboardingOfficerOtp = exports.resendOnboardingOfficerOtp = exports.sendOnboardingOfficerOtpFailure = exports.sendOnboardingOfficerOtpSuccess = exports.sendOnboardingOfficerOtp = exports.updateOnboardingCustomerViewUIState = exports.saveOnboardingCompnayOfficerPhoneInLocalStore = exports.saveOnboardingCustomerViewDataInLocalStore = exports.updateOnboardingCustomerViewLocalStoreData = exports.updateOnboardingCustomerViewAccountDetails = exports.updateCurrentSubStep = 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.aiAgentsActivationPhaseChanged = exports.aiAgentsActivationCountsUpdated = exports.fetchAiAgentsActivationStatusFailure = exports.fetchAiAgentsActivationStatusSuccess = exports.fetchAiAgentsActivationStatus = exports.acknowledgeOnboardingAiActivationViewedFailure = exports.acknowledgeOnboardingAiActivationViewedSuccess = exports.acknowledgeOnboardingAiActivationViewed = 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 = exports.clearOnboardingCustomerView = exports.clearOnboardingCustomerViewDataInLocalStore = exports.verifyOnboardingOfficerOtpFailure = 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,
@@ -12,62 +15,33 @@ exports.initialState = {
12
15
  updateStatus: initialStatus,
13
16
  saveStatus: initialStatus,
14
17
  dashboardLoadedStatus: initialStatus,
15
- currentStep: 'link_payment_account',
18
+ currentStep: 'setup_billing',
19
+ currentSubStep: 'default',
20
+ parsingDocumentFileIds: [],
16
21
  companyDetails: {
22
+ autoFilledFields: [],
17
23
  localData: undefined,
18
24
  },
19
- companyOfficerUpdateStatus: {
20
- Officer_1: {
25
+ companyOfficerUpdateStatus: (() => {
26
+ const emptyOfficerSlot = {
27
+ autoFilledFields: [],
21
28
  localData: undefined,
22
29
  sendOtpStatus: initialStatus,
23
30
  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
- },
31
+ };
32
+ return {
33
+ Officer_1: { ...emptyOfficerSlot },
34
+ Officer_2: { ...emptyOfficerSlot },
35
+ Officer_3: { ...emptyOfficerSlot },
36
+ Officer_4: { ...emptyOfficerSlot },
37
+ Officer_5: { ...emptyOfficerSlot },
38
+ Officer_6: { ...emptyOfficerSlot },
39
+ Officer_7: { ...emptyOfficerSlot },
40
+ Officer_8: { ...emptyOfficerSlot },
41
+ Officer_9: { ...emptyOfficerSlot },
42
+ Officer_10: { ...emptyOfficerSlot },
43
+ };
44
+ })(),
71
45
  primaryContactDetails: {},
72
46
  paymentAccountDetails: {
73
47
  fetchStatus: initialStatus,
@@ -95,6 +69,7 @@ exports.initialState = {
95
69
  },
96
70
  fetchState: 'Not-Started',
97
71
  error: undefined,
72
+ aiAgentsActivation: { ...onboardingCustomerViewState_1.emptyAiAgentsActivationSubview },
98
73
  uiState: {
99
74
  isQBOPopupOpen: false,
100
75
  isCardPaymentPopupOpen: false,
@@ -147,6 +122,9 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
147
122
  updateCurrentStep(draft, action) {
148
123
  draft.currentStep = action.payload.step;
149
124
  },
125
+ updateCurrentSubStep(draft, action) {
126
+ draft.currentSubStep = action.payload.subStep;
127
+ },
150
128
  updateOnboardingCustomerViewAccountDetails: {
151
129
  prepare(paymentAccountIds, subscriptionPaymentAccountIds) {
152
130
  return { payload: { paymentAccountIds, subscriptionPaymentAccountIds } };
@@ -184,6 +162,126 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
184
162
  };
185
163
  },
186
164
  },
165
+ acknowledgeOnboardingAiFinanceTeam: {
166
+ reducer(draft) {
167
+ draft.aiFinanceTeamAcknowledgementStatus = {
168
+ fetchState: 'In-Progress',
169
+ error: undefined,
170
+ };
171
+ },
172
+ prepare(companyId) {
173
+ return {
174
+ payload: { companyId },
175
+ };
176
+ },
177
+ },
178
+ acknowledgeOnboardingAiFinanceTeamSuccess(draft) {
179
+ draft.aiFinanceTeamAcknowledgementStatus = {
180
+ fetchState: 'Completed',
181
+ error: undefined,
182
+ };
183
+ },
184
+ acknowledgeOnboardingAiFinanceTeamFailure: {
185
+ reducer(draft, action) {
186
+ draft.aiFinanceTeamAcknowledgementStatus = {
187
+ fetchState: 'Error',
188
+ error: action.payload,
189
+ };
190
+ },
191
+ prepare(error) {
192
+ return {
193
+ payload: error,
194
+ };
195
+ },
196
+ },
197
+ acknowledgeOnboardingAiActivationViewed: {
198
+ reducer(draft) {
199
+ draft.aiActivationViewedAcknowledgementStatus = {
200
+ fetchState: 'In-Progress',
201
+ error: undefined,
202
+ };
203
+ },
204
+ prepare(companyId) {
205
+ return {
206
+ payload: { companyId },
207
+ };
208
+ },
209
+ },
210
+ acknowledgeOnboardingAiActivationViewedSuccess(draft) {
211
+ draft.aiActivationViewedAcknowledgementStatus = {
212
+ fetchState: 'Completed',
213
+ error: undefined,
214
+ };
215
+ },
216
+ acknowledgeOnboardingAiActivationViewedFailure: {
217
+ reducer(draft, action) {
218
+ draft.aiActivationViewedAcknowledgementStatus = {
219
+ fetchState: 'Error',
220
+ error: action.payload,
221
+ };
222
+ },
223
+ prepare(error) {
224
+ return {
225
+ payload: error,
226
+ };
227
+ },
228
+ },
229
+ fetchAiAgentsActivationStatus(draft) {
230
+ draft.aiAgentsActivation.fetchStatus = {
231
+ fetchState: 'In-Progress',
232
+ error: undefined,
233
+ };
234
+ },
235
+ fetchAiAgentsActivationStatusSuccess: {
236
+ reducer(draft, action) {
237
+ draft.aiAgentsActivation.fetchStatus = {
238
+ fetchState: 'Completed',
239
+ error: undefined,
240
+ };
241
+ draft.aiAgentsActivation.phases = action.payload.phases;
242
+ draft.aiAgentsActivation.counts = action.payload.counts;
243
+ },
244
+ prepare(payload) {
245
+ return { payload };
246
+ },
247
+ },
248
+ fetchAiAgentsActivationStatusFailure: {
249
+ reducer(draft, action) {
250
+ draft.aiAgentsActivation.fetchStatus = {
251
+ fetchState: 'Error',
252
+ error: action.payload,
253
+ };
254
+ },
255
+ prepare(error) {
256
+ return { payload: error };
257
+ },
258
+ },
259
+ aiAgentsActivationCountsUpdated: {
260
+ reducer(draft, action) {
261
+ draft.aiAgentsActivation.counts = {
262
+ ...draft.aiAgentsActivation.counts,
263
+ ...action.payload,
264
+ };
265
+ },
266
+ prepare(payload) {
267
+ return { payload };
268
+ },
269
+ },
270
+ aiAgentsActivationPhaseChanged: {
271
+ reducer(draft, action) {
272
+ const target = draft.aiAgentsActivation.phases;
273
+ const index = target.findIndex((phase) => phase.key === action.payload.key);
274
+ if (index === -1) {
275
+ target.push(action.payload);
276
+ }
277
+ else {
278
+ target[index] = { ...target[index], ...action.payload };
279
+ }
280
+ },
281
+ prepare(payload) {
282
+ return { payload };
283
+ },
284
+ },
187
285
  updateOnboardingCustomerViewDashboardLoaded: {
188
286
  reducer(draft) {
189
287
  draft.dashboardLoadedStatus = {
@@ -596,7 +694,82 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
596
694
  clearOnboardingCustomerView(draft) {
597
695
  Object.assign(draft, exports.initialState);
598
696
  },
697
+ /** Merge AI-parsed officer fields into the officer's onboarding localData. */
698
+ applyKycDocumentAutofillForOnboarding: {
699
+ reducer(draft, action) {
700
+ const { officerType, values, autoFilledFieldNames, fileId } = action.payload;
701
+ const slot = draft.companyOfficerUpdateStatus[officerType];
702
+ slot.localData = Object.assign({}, slot.localData, values);
703
+ slot.autoFilledFields = Array.from(new Set([...(slot.autoFilledFields ?? []), ...autoFilledFieldNames]));
704
+ draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
705
+ },
706
+ prepare(payload) {
707
+ return { payload };
708
+ },
709
+ },
710
+ /** Merge AI-parsed company fields into companyDetails onboarding localData. */
711
+ applyKybDocumentAutofillForOnboarding: {
712
+ reducer(draft, action) {
713
+ const { values, autoFilledFieldNames, fileId } = action.payload;
714
+ draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
715
+ const prev = draft.companyDetails.autoFilledFields ?? [];
716
+ draft.companyDetails.autoFilledFields = Array.from(new Set([...prev, ...autoFilledFieldNames]));
717
+ draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
718
+ },
719
+ prepare(payload) {
720
+ return { payload };
721
+ },
722
+ },
723
+ /** Wipe AI-autofill badges during onboarding. */
724
+ clearKycKybAutofillForOnboarding: {
725
+ reducer(draft, action) {
726
+ const { officerType } = action.payload;
727
+ if (officerType != null) {
728
+ draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
729
+ }
730
+ else {
731
+ draft.companyDetails.autoFilledFields = [];
732
+ Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
733
+ draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
734
+ });
735
+ }
736
+ },
737
+ prepare(payload = {}) {
738
+ return { payload };
739
+ },
740
+ },
741
+ },
742
+ extraReducers: (builder) => {
743
+ const addParsingFileId = (draft, fileId) => {
744
+ draft.parsingDocumentFileIds = draft.parsingDocumentFileIds ?? [];
745
+ if (!draft.parsingDocumentFileIds.includes(fileId)) {
746
+ draft.parsingDocumentFileIds.push(fileId);
747
+ }
748
+ };
749
+ const removeParsingFileId = (draft, fileId) => {
750
+ draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
751
+ };
752
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocument, (draft, action) => {
753
+ if (action.payload.target === 'onboarding') {
754
+ addParsingFileId(draft, action.payload.fileId);
755
+ }
756
+ });
757
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocument, (draft, action) => {
758
+ if (action.payload.target === 'onboarding') {
759
+ addParsingFileId(draft, action.payload.fileId);
760
+ }
761
+ });
762
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocumentFailure, (draft, action) => {
763
+ if (action.payload.target === 'onboarding') {
764
+ removeParsingFileId(draft, action.payload.fileId);
765
+ }
766
+ });
767
+ builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocumentFailure, (draft, action) => {
768
+ if (action.payload.target === 'onboarding') {
769
+ removeParsingFileId(draft, action.payload.fileId);
770
+ }
771
+ });
599
772
  },
600
773
  });
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;
774
+ _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.acknowledgeOnboardingAiActivationViewed = _a.acknowledgeOnboardingAiActivationViewed, exports.acknowledgeOnboardingAiActivationViewedSuccess = _a.acknowledgeOnboardingAiActivationViewedSuccess, exports.acknowledgeOnboardingAiActivationViewedFailure = _a.acknowledgeOnboardingAiActivationViewedFailure, exports.fetchAiAgentsActivationStatus = _a.fetchAiAgentsActivationStatus, exports.fetchAiAgentsActivationStatusSuccess = _a.fetchAiAgentsActivationStatusSuccess, exports.fetchAiAgentsActivationStatusFailure = _a.fetchAiAgentsActivationStatusFailure, exports.aiAgentsActivationCountsUpdated = _a.aiAgentsActivationCountsUpdated, exports.aiAgentsActivationPhaseChanged = _a.aiAgentsActivationPhaseChanged, 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.updateCurrentSubStep = _a.updateCurrentSubStep, 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
775
  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, OnboardingSubStep } from './onboardingCustomerViewState';
19
19
  export interface OnboardingCustomerView {
20
20
  allNationalityCountries: Country[];
21
21
  allRequiredStepsCompleted: boolean;
@@ -25,9 +25,11 @@ export interface OnboardingCustomerView {
25
25
  companyOfficerLocalData: Record<CompanyOfficerType, CompanyOfficersDetails | undefined>;
26
26
  completedSteps: OnboardingStep[];
27
27
  currentStep: OnboardingStep;
28
+ currentSubStep: OnboardingSubStep;
28
29
  fetchStatus: FetchStateAndError;
29
30
  halfCompletedSteps: OnboardingStep[];
30
31
  isInterimEmailSent: boolean;
32
+ parsingDocumentFileIds: ID[];
31
33
  paymentAccountFetchStatus: FetchStateAndError;
32
34
  paymentAccountUpdateStatus: FetchStateAndError;
33
35
  pendingSaveDetails: {
@@ -55,3 +57,6 @@ export declare const onboardingStepsData: (isValidConnection: boolean, productSe
55
57
  };
56
58
  export declare function isCompanyDetailsSavePending(fileState: FileState, company?: CompanyView, primaryContact?: User, companyDetailsLocalData?: CompanyDetails): boolean;
57
59
  export declare const getProductSettingsString: (productSettings: TenantProductSettings | undefined) => string;
60
+ export declare const getAiAgentsActivationSubview: (state: RootState) => AiAgentsActivationSubview;
61
+ export declare const getAiAgentsActivationPhases: (state: RootState) => AiAgentsActivationPhase[];
62
+ export declare const getAiAgentsActivationCounts: (state: RootState) => AiAgentsActivationCounts;
@@ -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.getAiAgentsActivationCounts = exports.getAiAgentsActivationPhases = 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, currentSubStep, 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 &&
@@ -79,7 +80,7 @@ function getOnboardingCustomerView(state, companyId) {
79
80
  cardPaymentViewState.cardPaymentsIds.length > 0) &&
80
81
  companyView?.company.company.companyOnboardingInfo
81
82
  .subscriptionBillingAddressId != null) {
82
- completedSteps.push('link_payment_account');
83
+ completedSteps.push('setup_billing');
83
84
  }
84
85
  const isPaymentVerified = (paymentAccount?.providerVerificationStatus?.code?.includes('verified') ===
85
86
  true &&
@@ -90,24 +91,25 @@ function getOnboardingCustomerView(state, companyId) {
90
91
  .subscriptionBillingAddressId != null;
91
92
  if ((isPaymentVerified || hasSubscriptionBillingAddress) &&
92
93
  !(isPaymentVerified && hasSubscriptionBillingAddress)) {
93
- halfCompletedSteps.push('link_payment_account');
94
+ halfCompletedSteps.push('setup_billing');
94
95
  }
95
96
  const isValidConnection = externalConnections?.accounting[0]?.isValid ?? false;
96
97
  if (isValidConnection) {
97
- completedSteps.push('qbo_connection');
98
+ completedSteps.push('connect_ledger');
98
99
  }
99
- if (companyDetails.localData != null &&
100
+ const isCompanyDetailsDone = companyDetails.localData != null &&
100
101
  primaryContactDetails.localData != null &&
101
- isCompanyDetailsCompleted(fileState, companyView, primaryContact)) {
102
- completedSteps.push('company_details');
103
- }
102
+ isCompanyDetailsCompleted(fileState, companyView, primaryContact);
104
103
  const officerIndex = companyOfficers.length > 0
105
104
  ? Object.values(companyOfficerLocalData).findIndex((officer) => officer?.isSelectedForVerification === true)
106
105
  : 0;
107
106
  const selectedOfficerType = `Officer_${officerIndex < 0 ? 1 : officerIndex + 1}`;
108
- if (companyOfficerLocalData[selectedOfficerType] != null &&
109
- isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState)) {
110
- completedSteps.push('company_officer');
107
+ const isOfficerDone = companyOfficerLocalData[selectedOfficerType] != null &&
108
+ isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, companyOfficerLocalData[selectedOfficerType], fileState);
109
+ // The verification step (single sidebar step) is only "complete" once both
110
+ // the company-officer and company-details sub-steps are fully filled in.
111
+ if (isCompanyDetailsDone && isOfficerDone) {
112
+ completedSteps.push('verification');
111
113
  }
112
114
  const { allStepsData, requiredStepsData } = (0, exports.onboardingStepsData)(isValidConnection, currentTenant?.productSettings ?? [], accountingConnectionCreationMode);
113
115
  const allRequiredStepsCompleted = requiredStepsData.every((step) => {
@@ -125,6 +127,7 @@ function getOnboardingCustomerView(state, companyId) {
125
127
  return {
126
128
  companyDetailsLocalData,
127
129
  companyOfficerLocalData,
130
+ parsingDocumentFileIds,
128
131
  subscriptionBillingAddress: subscriptionBillingAddress?.addressToCreate,
129
132
  companyView,
130
133
  allNationalityCountries,
@@ -133,6 +136,7 @@ function getOnboardingCustomerView(state, companyId) {
133
136
  officer: isOfficerDetailsSavePending(companyOfficers, companyOfficerRoles, fileState, companyOfficerLocalData[selectedOfficerType]),
134
137
  },
135
138
  currentStep,
139
+ currentSubStep,
136
140
  completedSteps,
137
141
  halfCompletedSteps,
138
142
  allRequiredStepsCompleted,
@@ -331,3 +335,14 @@ const getProductSettingsString = (productSettings) => {
331
335
  .join(',');
332
336
  };
333
337
  exports.getProductSettingsString = getProductSettingsString;
338
+ const fromActivationView = (state) =>
339
+ // Fall back to the empty subview so state hydrated from an older persisted
340
+ // version (before aiAgentsActivation existed) doesn't crash on .phases/.counts.
341
+ state.onboardingCustomerViewState.aiAgentsActivation ??
342
+ onboardingCustomerViewState_1.emptyAiAgentsActivationSubview;
343
+ const getAiAgentsActivationSubview = (state) => fromActivationView(state);
344
+ exports.getAiAgentsActivationSubview = getAiAgentsActivationSubview;
345
+ const getAiAgentsActivationPhases = (state) => fromActivationView(state).phases;
346
+ exports.getAiAgentsActivationPhases = getAiAgentsActivationPhases;
347
+ const getAiAgentsActivationCounts = (state) => fromActivationView(state).counts;
348
+ exports.getAiAgentsActivationCounts = getAiAgentsActivationCounts;
@@ -3,15 +3,18 @@ import { Address } from '../../../entity/address/addressState';
3
3
  import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
4
4
  import { CompanyDetailsLocalData, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewLocalData } from '../../spendManagement/commonSetup/setupViewState';
5
5
  import { PlaidConnectionDetails } from '../../spendManagement/plaidAccount/plaidAccountViewState';
6
- export declare const ZENI_USER_REQUIRED_ONBOARDING_STEPS: readonly ["link_payment_account"];
7
- export declare const CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO: readonly ["qbo_connection"];
8
- export declare const REQUIRED_ONBOARDING_STEPS: readonly ["link_payment_account", "qbo_connection"];
9
- export declare const ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT: readonly ["company_officer", "company_details"];
10
- export declare const ALL_ZENI_USER_ONBOARDING_STEPS: readonly ["link_payment_account", "company_officer", "company_details"];
11
- export declare const ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO: readonly ["qbo_connection", "company_officer", "company_details"];
12
- export declare const ALL_ONBOARDING_STEPS: readonly ["link_payment_account", "qbo_connection", "company_officer", "company_details"];
13
- export declare const toOnboardingStepType: (v: string) => "company_details" | "company_officer" | "link_payment_account" | "qbo_connection";
6
+ export declare const ZENI_USER_REQUIRED_ONBOARDING_STEPS: readonly ["setup_billing"];
7
+ export declare const CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO: readonly ["connect_ledger"];
8
+ export declare const REQUIRED_ONBOARDING_STEPS: readonly ["setup_billing", "connect_ledger"];
9
+ export declare const ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT: readonly ["verification"];
10
+ export declare const ALL_ZENI_USER_ONBOARDING_STEPS: readonly ["setup_billing", "verification"];
11
+ export declare const ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO: readonly ["connect_ledger", "connect_data_source", "verification"];
12
+ export declare const ALL_ONBOARDING_STEPS: readonly ["setup_billing", "connect_ledger", "connect_data_source", "verification"];
13
+ export declare const toOnboardingStepType: (v: string) => "setup_billing" | "connect_ledger" | "verification" | "connect_data_source";
14
14
  export type OnboardingStep = ReturnType<typeof toOnboardingStepType>;
15
+ export declare const ALL_ONBOARDING_SUB_STEPS: readonly ["default", "ai-activating", "unlock-stack", "company_officer", "company_details"];
16
+ export declare const toOnboardingSubStepType: (v: string) => "default" | "company_details" | "company_officer" | "ai-activating" | "unlock-stack";
17
+ export type OnboardingSubStep = ReturnType<typeof toOnboardingSubStepType>;
15
18
  /**
16
19
  * Onboarding Custiner View Local Data - Intefaces
17
20
  */
@@ -21,16 +24,33 @@ export interface OnboardingCustomerViewUIState {
21
24
  isQBOPopupOpen: boolean;
22
25
  }
23
26
  export interface OnboardingCustomerViewState extends FetchedState {
27
+ aiAgentsActivation: AiAgentsActivationSubview;
24
28
  companyDetails: {
29
+ /**
30
+ * Field names from {@link CompanyDetailsLocalData} populated by AI autofill
31
+ * from an uploaded KYB document during onboarding. Drives the ✦ sparkle.
32
+ */
33
+ autoFilledFields: string[];
25
34
  localData?: CompanyDetailsLocalData;
26
35
  };
27
36
  companyOfficerUpdateStatus: Record<CompanyOfficerType, {
37
+ /**
38
+ * Field names from {@link CompanyOfficerLocalData} populated by AI autofill
39
+ * from an uploaded KYC identity document during onboarding.
40
+ */
41
+ autoFilledFields: string[];
28
42
  otpverificationStatus: FetchStateAndError;
29
43
  sendOtpStatus: FetchStateAndError;
30
44
  localData?: CompanyOfficerLocalData;
31
45
  }>;
32
46
  currentStep: OnboardingStep;
47
+ currentSubStep: OnboardingSubStep;
33
48
  dashboardLoadedStatus: FetchStateAndError;
49
+ /**
50
+ * File IDs currently being parsed by the AI autofill epic for onboarding.
51
+ * Drives the "AI is reading your document" overlay on the upload field.
52
+ */
53
+ parsingDocumentFileIds: ID[];
34
54
  paymentAccountDetails: {
35
55
  fetchStatus: FetchStateAndError;
36
56
  paymentAccountIds: ID[];
@@ -44,5 +64,29 @@ export interface OnboardingCustomerViewState extends FetchedState {
44
64
  subscriptionPaymentAccountIds: ID[];
45
65
  uiState: OnboardingCustomerViewUIState;
46
66
  updateStatus: FetchStateAndError;
67
+ aiActivationViewedAcknowledgementStatus?: FetchStateAndError;
68
+ aiFinanceTeamAcknowledgementStatus?: FetchStateAndError;
47
69
  subscriptionBillingAddress?: Address;
48
70
  }
71
+ export type AiAgentsActivationPhaseStatus = 'idle' | 'starting' | 'building' | 'ready';
72
+ export interface AiAgentsActivationPhase {
73
+ key: string;
74
+ status: AiAgentsActivationPhaseStatus;
75
+ completedAt?: string;
76
+ startedAt?: string;
77
+ }
78
+ export interface AiAgentsActivationCounts {
79
+ customerCount: number;
80
+ glAccountCount: number;
81
+ targetTransactionCount: number;
82
+ transactionCount: number;
83
+ vendorCount: number;
84
+ asOf?: string;
85
+ }
86
+ export interface AiAgentsActivationSubview {
87
+ counts: AiAgentsActivationCounts;
88
+ fetchStatus: FetchStateAndError;
89
+ phases: AiAgentsActivationPhase[];
90
+ }
91
+ export declare const emptyAiAgentsActivationCounts: AiAgentsActivationCounts;
92
+ export declare const emptyAiAgentsActivationSubview: AiAgentsActivationSubview;
@@ -1,20 +1,21 @@
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.toOnboardingSubStepType = exports.ALL_ONBOARDING_SUB_STEPS = 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
- exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = [
6
- 'link_payment_account',
7
- ];
5
+ // Onboarding steps are the 4 top-level surfaces. Officer + details verification
6
+ // live as sub-steps under `verification` (state machine in CustomerOnboardingPage).
7
+ // The optional data-source step is its own surface; the legacy connect-data-source
8
+ // sub-step under the old `qbo_connection` no longer exists.
9
+ exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = ['setup_billing'];
8
10
  exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO = [
9
- 'qbo_connection',
11
+ 'connect_ledger',
10
12
  ];
11
13
  exports.REQUIRED_ONBOARDING_STEPS = [
12
14
  ...exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS,
13
15
  ...exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO,
14
16
  ];
15
17
  exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT = [
16
- 'company_officer',
17
- 'company_details',
18
+ 'verification',
18
19
  ];
19
20
  exports.ALL_ZENI_USER_ONBOARDING_STEPS = [
20
21
  ...exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS,
@@ -22,11 +23,42 @@ exports.ALL_ZENI_USER_ONBOARDING_STEPS = [
22
23
  ];
23
24
  exports.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = [
24
25
  ...exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO,
26
+ 'connect_data_source',
25
27
  ...exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
26
28
  ];
27
29
  exports.ALL_ONBOARDING_STEPS = [
28
30
  ...exports.REQUIRED_ONBOARDING_STEPS,
31
+ 'connect_data_source',
29
32
  ...exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
30
33
  ];
31
34
  const toOnboardingStepType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_ONBOARDING_STEPS);
32
35
  exports.toOnboardingStepType = toOnboardingStepType;
36
+ // Per-step sub-state. Lives in Redux so the save epic can tell, for example,
37
+ // an officer-form save from a company-details save while both share
38
+ // currentStep = 'verification'.
39
+ // - 'default' generic landing sub-state.
40
+ // - 'ai-activating' connect_ledger interstitial during AI activation.
41
+ // - 'unlock-stack' verification landing — VerifyUnlockFinancialStackPage.
42
+ // - 'company_officer' verification → officer form.
43
+ // - 'company_details' verification → company details form.
44
+ exports.ALL_ONBOARDING_SUB_STEPS = [
45
+ 'default',
46
+ 'ai-activating',
47
+ 'unlock-stack',
48
+ 'company_officer',
49
+ 'company_details',
50
+ ];
51
+ const toOnboardingSubStepType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_ONBOARDING_SUB_STEPS);
52
+ exports.toOnboardingSubStepType = toOnboardingSubStepType;
53
+ exports.emptyAiAgentsActivationCounts = {
54
+ customerCount: 0,
55
+ glAccountCount: 0,
56
+ targetTransactionCount: 0,
57
+ transactionCount: 0,
58
+ vendorCount: 0,
59
+ };
60
+ exports.emptyAiAgentsActivationSubview = {
61
+ counts: exports.emptyAiAgentsActivationCounts,
62
+ fetchStatus: { fetchState: 'Not-Started', error: undefined },
63
+ phases: [],
64
+ };