@zeniai/client-epic-state 5.1.4-beta4ND → 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.
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +7 -2
- package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +8 -3
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +19 -8
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.d.ts +2 -2
- package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +18 -7
- package/package.json +1 -1
|
@@ -25,7 +25,12 @@ const defaultNavigate = (url) => {
|
|
|
25
25
|
const initEmailConnectOAuthEpic = (actions$, _state$, zeniAPI,
|
|
26
26
|
// Test seam: callers can override to assert intended URL without actually
|
|
27
27
|
// navigating. Default is full-page redirect via window.location.
|
|
28
|
-
navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.initEmailConnectOAuth.match),
|
|
28
|
+
navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.initEmailConnectOAuth.match),
|
|
29
|
+
// Per-provider cancellation scope — switchMap at the outer level would
|
|
30
|
+
// cancel an in-flight gmail init when an outlook init fires, stranding
|
|
31
|
+
// the gmail provider's `saveConnectorCredentialsStateBySlug` in
|
|
32
|
+
// `In-Progress` forever. groupBy gives each provider its own stream.
|
|
33
|
+
(0, operators_1.groupBy)((action) => action.payload.provider), (0, operators_1.mergeMap)((perProvider$) => perProvider$.pipe((0, operators_1.switchMap)((action) => zeniAPI
|
|
29
34
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
30
35
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
31
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
@@ -50,5 +55,5 @@ navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReduc
|
|
|
50
55
|
return (0, rxjs_1.from)([
|
|
51
56
|
(0, tenantReducer_1.initEmailConnectOAuthFailure)(action.payload.tenantId, action.payload.provider, (0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
52
57
|
]);
|
|
53
|
-
}))));
|
|
58
|
+
}))))));
|
|
54
59
|
exports.initEmailConnectOAuthEpic = initEmailConnectOAuthEpic;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, filter, groupBy, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
4
4
|
import { initEmailConnectOAuth, initEmailConnectOAuthFailure, initEmailConnectOAuthSuccess, } from '../tenantReducer';
|
|
5
5
|
const defaultNavigate = (url) => {
|
|
@@ -22,7 +22,12 @@ const defaultNavigate = (url) => {
|
|
|
22
22
|
export const initEmailConnectOAuthEpic = (actions$, _state$, zeniAPI,
|
|
23
23
|
// Test seam: callers can override to assert intended URL without actually
|
|
24
24
|
// navigating. Default is full-page redirect via window.location.
|
|
25
|
-
navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match),
|
|
25
|
+
navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match),
|
|
26
|
+
// Per-provider cancellation scope — switchMap at the outer level would
|
|
27
|
+
// cancel an in-flight gmail init when an outlook init fires, stranding
|
|
28
|
+
// the gmail provider's `saveConnectorCredentialsStateBySlug` in
|
|
29
|
+
// `In-Progress` forever. groupBy gives each provider its own stream.
|
|
30
|
+
groupBy((action) => action.payload.provider), mergeMap((perProvider$) => perProvider$.pipe(switchMap((action) => zeniAPI
|
|
26
31
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
27
32
|
.pipe(mergeMap((response) => {
|
|
28
33
|
if (isSuccessResponse(response) && response.data != null) {
|
|
@@ -47,4 +52,4 @@ navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match)
|
|
|
47
52
|
return from([
|
|
48
53
|
initEmailConnectOAuthFailure(action.payload.tenantId, action.payload.provider, createZeniAPIStatus(message)),
|
|
49
54
|
]);
|
|
50
|
-
}))));
|
|
55
|
+
}))))));
|
|
@@ -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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
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-
|
|
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",
|