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

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.
@@ -12,7 +12,7 @@ import { newAddressInLocalStore, resetNewAddressesInLocalStore, } from '../../..
12
12
  import { toAddressViewLocalData } from '../../../../addressView/toAddressViewLocalData';
13
13
  import { getCompanyView } from '../../../../companyView/selectorHelpers/getCompanyView';
14
14
  import { toSetupViewLocalData } from '../../../../spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic';
15
- import { clearOnboardingCustomerViewDataInLocalStore, saveOnboardingCustomerViewDataInLocalStore, updateCurrentStep, updateOnboardingCustomerViewLocalStoreData, } from '../../onboardingCustomerViewReducer';
15
+ import { clearOnboardingCustomerViewDataInLocalStore, saveOnboardingCustomerViewDataInLocalStore, updateCurrentStep, updateCurrentSubStep, updateOnboardingCustomerViewLocalStoreData, } from '../../onboardingCustomerViewReducer';
16
16
  import { onboardingStepsData } from '../../onboardingCustomerViewSelector';
17
17
  export const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => actions$.pipe(filter(updateOnboardingCustomerViewLocalStoreData.match), mergeMap((action) => {
18
18
  const { companyId, currentStep, reCalculateCurrentStep } = action.payload;
@@ -78,13 +78,16 @@ export const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$)
78
78
  companyView?.company.company.companyOnboardingInfo
79
79
  .subscriptionBillingAddressId != null) {
80
80
  updatedCurrentStep = 'connect_ledger';
81
- // After the ledger is connected we move straight to verification —
82
- // company_officer / company_details are now sub-steps inside it,
83
- // so the page handles which sub-step to land on. The optional
84
- // connect_data_source step is opt-in from the sidebar, not from
85
- // the recalc.
86
- if (isValidConnection) {
87
- updatedCurrentStep = 'verification';
81
+ const isOnboardingAiActivationViewed = companyOnboardingInfo?.onboardingInfo
82
+ ?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed ??
83
+ false;
84
+ // Past the ledger step we always sit on connect_data_source
85
+ // it has many integrations, so we treat it as never auto-complete
86
+ // and only advance to verification on an explicit user dispatch.
87
+ // While the AI activation interstitial hasn't been viewed yet,
88
+ // stay on connect_ledger so the interstitial gets its chance.
89
+ if (isValidConnection && isOnboardingAiActivationViewed) {
90
+ updatedCurrentStep = 'connect_data_source';
88
91
  }
89
92
  }
90
93
  }
@@ -106,6 +109,14 @@ export const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$)
106
109
  }
107
110
  if (reCalculateCurrentStep === true) {
108
111
  fetchActions.push(updateCurrentStep({ step: updatedCurrentStep }));
112
+ // Whenever the recalc lands the user on a different step, reset
113
+ // the sub-step to the step's landing sub-state — otherwise a
114
+ // stale subStep (e.g. 'default' carried over from another step)
115
+ // leaves verification rendering an empty form.
116
+ if (updatedCurrentStep !== onboardingCustomerViewState.currentStep) {
117
+ const targetSubStep = updatedCurrentStep === 'verification' ? 'unlock-stack' : 'default';
118
+ fetchActions.push(updateCurrentSubStep({ subStep: targetSubStep }));
119
+ }
109
120
  }
110
121
  }
111
122
  if (companyView != null) {
@@ -1,6 +1,6 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { RootState } from '../../../../../reducer';
3
3
  import { newAddressInLocalStore, resetNewAddressDataInLocalStore, resetNewAddressesInLocalStore } from '../../../../addressView/addressViewReducer';
4
- import { clearOnboardingCustomerViewDataInLocalStore, saveOnboardingCustomerViewDataInLocalStore, updateCurrentStep, updateOnboardingCustomerViewLocalStoreData } from '../../onboardingCustomerViewReducer';
5
- export type ActionType = ReturnType<typeof updateOnboardingCustomerViewLocalStoreData> | ReturnType<typeof saveOnboardingCustomerViewDataInLocalStore> | ReturnType<typeof clearOnboardingCustomerViewDataInLocalStore> | ReturnType<typeof resetNewAddressesInLocalStore> | ReturnType<typeof newAddressInLocalStore> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateCurrentStep>;
4
+ import { clearOnboardingCustomerViewDataInLocalStore, saveOnboardingCustomerViewDataInLocalStore, updateCurrentStep, updateCurrentSubStep, updateOnboardingCustomerViewLocalStoreData } from '../../onboardingCustomerViewReducer';
5
+ export type ActionType = ReturnType<typeof updateOnboardingCustomerViewLocalStoreData> | ReturnType<typeof saveOnboardingCustomerViewDataInLocalStore> | ReturnType<typeof clearOnboardingCustomerViewDataInLocalStore> | ReturnType<typeof resetNewAddressesInLocalStore> | ReturnType<typeof newAddressInLocalStore> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateCurrentStep> | ReturnType<typeof updateCurrentSubStep>;
6
6
  export declare const updateOnboardingCustomerViewLocalStoreDataEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => import("rxjs").Observable<ActionType>;
@@ -84,13 +84,16 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
84
84
  companyView?.company.company.companyOnboardingInfo
85
85
  .subscriptionBillingAddressId != null) {
86
86
  updatedCurrentStep = 'connect_ledger';
87
- // After the ledger is connected we move straight to verification —
88
- // company_officer / company_details are now sub-steps inside it,
89
- // so the page handles which sub-step to land on. The optional
90
- // connect_data_source step is opt-in from the sidebar, not from
91
- // the recalc.
92
- if (isValidConnection) {
93
- updatedCurrentStep = 'verification';
87
+ const isOnboardingAiActivationViewed = companyOnboardingInfo?.onboardingInfo
88
+ ?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed ??
89
+ false;
90
+ // Past the ledger step we always sit on connect_data_source
91
+ // it has many integrations, so we treat it as never auto-complete
92
+ // and only advance to verification on an explicit user dispatch.
93
+ // While the AI activation interstitial hasn't been viewed yet,
94
+ // stay on connect_ledger so the interstitial gets its chance.
95
+ if (isValidConnection && isOnboardingAiActivationViewed) {
96
+ updatedCurrentStep = 'connect_data_source';
94
97
  }
95
98
  }
96
99
  }
@@ -112,6 +115,14 @@ const updateOnboardingCustomerViewLocalStoreDataEpic = (actions$, state$) => act
112
115
  }
113
116
  if (reCalculateCurrentStep === true) {
114
117
  fetchActions.push((0, onboardingCustomerViewReducer_1.updateCurrentStep)({ step: updatedCurrentStep }));
118
+ // Whenever the recalc lands the user on a different step, reset
119
+ // the sub-step to the step's landing sub-state — otherwise a
120
+ // stale subStep (e.g. 'default' carried over from another step)
121
+ // leaves verification rendering an empty form.
122
+ if (updatedCurrentStep !== onboardingCustomerViewState.currentStep) {
123
+ const targetSubStep = updatedCurrentStep === 'verification' ? 'unlock-stack' : 'default';
124
+ fetchActions.push((0, onboardingCustomerViewReducer_1.updateCurrentSubStep)({ subStep: targetSubStep }));
125
+ }
115
126
  }
116
127
  }
117
128
  if (companyView != null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.4-beta5ND",
3
+ "version": "5.1.4-beta7ND",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",