@zeniai/client-epic-state 5.1.4-beta0ND → 5.1.4
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/company/companyPayload.d.ts +0 -4
- package/lib/entity/company/companyPayload.js +0 -6
- package/lib/entity/company/companyStateTypes.d.ts +0 -7
- package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +0 -1
- package/lib/entity/paymentAccount/paymentAccountSelector.js +0 -9
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.d.ts +25 -38
- package/lib/entity/tenant/tenantReducer.js +5 -65
- package/lib/entity/tenant/tenantState.d.ts +0 -1
- package/lib/epic.d.ts +1 -6
- package/lib/epic.js +1 -7
- package/lib/esm/entity/company/companyPayload.js +0 -6
- package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +0 -8
- package/lib/esm/entity/tenant/tenantReducer.js +3 -63
- package/lib/esm/epic.js +1 -7
- package/lib/esm/index.js +6 -9
- package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
- package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
- package/lib/esm/view/fileView/epic/updateFileNameEpic.js +2 -2
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +50 -218
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +2 -12
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +0 -12
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +52 -106
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
- package/lib/index.d.ts +7 -11
- package/lib/index.js +35 -55
- package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
- package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
- package/lib/view/fileView/epic/updateFileNameEpic.js +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +0 -3
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +4 -41
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +51 -220
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -5
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +2 -15
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -40
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +1 -13
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -28
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +53 -107
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +2 -7
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -6
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -19
- package/package.json +1 -1
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +0 -21
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -54
- package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +0 -50
- package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -40
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +0 -29
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -40
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -58
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -77
- package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -14
- package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -207
- package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -41
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +0 -7
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +0 -44
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +0 -8
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +0 -33
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +0 -9
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +0 -44
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +0 -28
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -62
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +0 -9
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -81
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +0 -24
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -17
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +0 -29
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -215
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +0 -154
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -46
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { removeFiles } from '../../../entity/file/fileReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
5
|
import { deleteFileList, deleteFileListFailure, deleteFileListSuccess, } from '../fileViewReducer';
|
|
6
|
-
export const deleteFileListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteFileList.match),
|
|
6
|
+
export const deleteFileListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteFileList.match), switchMap((action) => {
|
|
7
7
|
const { fileIds } = action.payload;
|
|
8
8
|
return zeniAPI
|
|
9
9
|
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.fileMicroServiceBaseUrl}/1.0/files?query=${encodeURIComponent(JSON.stringify({ file_ids: fileIds }))}`)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
3
|
import { updateFiles } from '../../../entity/file/fileReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
5
|
import { updateFileName, updateFileNameFailure, updateFileNameSuccess, } from '../fileViewReducer';
|
|
6
|
-
export const updateFileNameEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateFileName.match),
|
|
6
|
+
export const updateFileNameEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateFileName.match), switchMap((action) => {
|
|
7
7
|
/**
|
|
8
8
|
* tenantId is required for updating onboarding file names.
|
|
9
9
|
*/
|
|
@@ -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,
|
|
@@ -11,31 +9,61 @@ export const initialState = {
|
|
|
11
9
|
saveStatus: initialStatus,
|
|
12
10
|
dashboardLoadedStatus: initialStatus,
|
|
13
11
|
currentStep: 'link_payment_account',
|
|
14
|
-
parsingDocumentFileIds: [],
|
|
15
12
|
companyDetails: {
|
|
16
|
-
autoFilledFields: [],
|
|
17
13
|
localData: undefined,
|
|
18
14
|
},
|
|
19
|
-
companyOfficerUpdateStatus:
|
|
20
|
-
|
|
21
|
-
autoFilledFields: [],
|
|
15
|
+
companyOfficerUpdateStatus: {
|
|
16
|
+
Officer_1: {
|
|
22
17
|
localData: undefined,
|
|
23
18
|
sendOtpStatus: initialStatus,
|
|
24
19
|
otpverificationStatus: initialStatus,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
+
},
|
|
39
67
|
primaryContactDetails: {},
|
|
40
68
|
paymentAccountDetails: {
|
|
41
69
|
fetchStatus: initialStatus,
|
|
@@ -63,7 +91,6 @@ export const initialState = {
|
|
|
63
91
|
},
|
|
64
92
|
fetchState: 'Not-Started',
|
|
65
93
|
error: undefined,
|
|
66
|
-
aiAgentsActivation: { ...emptyAiAgentsActivationSubview },
|
|
67
94
|
uiState: {
|
|
68
95
|
isQBOPopupOpen: false,
|
|
69
96
|
isCardPaymentPopupOpen: false,
|
|
@@ -153,126 +180,6 @@ const onboardingCustomerView = createSlice({
|
|
|
153
180
|
};
|
|
154
181
|
},
|
|
155
182
|
},
|
|
156
|
-
acknowledgeOnboardingAiFinanceTeam: {
|
|
157
|
-
reducer(draft) {
|
|
158
|
-
draft.aiFinanceTeamAcknowledgementStatus = {
|
|
159
|
-
fetchState: 'In-Progress',
|
|
160
|
-
error: undefined,
|
|
161
|
-
};
|
|
162
|
-
},
|
|
163
|
-
prepare(companyId) {
|
|
164
|
-
return {
|
|
165
|
-
payload: { companyId },
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
acknowledgeOnboardingAiFinanceTeamSuccess(draft) {
|
|
170
|
-
draft.aiFinanceTeamAcknowledgementStatus = {
|
|
171
|
-
fetchState: 'Completed',
|
|
172
|
-
error: undefined,
|
|
173
|
-
};
|
|
174
|
-
},
|
|
175
|
-
acknowledgeOnboardingAiFinanceTeamFailure: {
|
|
176
|
-
reducer(draft, action) {
|
|
177
|
-
draft.aiFinanceTeamAcknowledgementStatus = {
|
|
178
|
-
fetchState: 'Error',
|
|
179
|
-
error: action.payload,
|
|
180
|
-
};
|
|
181
|
-
},
|
|
182
|
-
prepare(error) {
|
|
183
|
-
return {
|
|
184
|
-
payload: error,
|
|
185
|
-
};
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
acknowledgeOnboardingAiActivationViewed: {
|
|
189
|
-
reducer(draft) {
|
|
190
|
-
draft.aiActivationViewedAcknowledgementStatus = {
|
|
191
|
-
fetchState: 'In-Progress',
|
|
192
|
-
error: undefined,
|
|
193
|
-
};
|
|
194
|
-
},
|
|
195
|
-
prepare(companyId) {
|
|
196
|
-
return {
|
|
197
|
-
payload: { companyId },
|
|
198
|
-
};
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
acknowledgeOnboardingAiActivationViewedSuccess(draft) {
|
|
202
|
-
draft.aiActivationViewedAcknowledgementStatus = {
|
|
203
|
-
fetchState: 'Completed',
|
|
204
|
-
error: undefined,
|
|
205
|
-
};
|
|
206
|
-
},
|
|
207
|
-
acknowledgeOnboardingAiActivationViewedFailure: {
|
|
208
|
-
reducer(draft, action) {
|
|
209
|
-
draft.aiActivationViewedAcknowledgementStatus = {
|
|
210
|
-
fetchState: 'Error',
|
|
211
|
-
error: action.payload,
|
|
212
|
-
};
|
|
213
|
-
},
|
|
214
|
-
prepare(error) {
|
|
215
|
-
return {
|
|
216
|
-
payload: error,
|
|
217
|
-
};
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
fetchAiAgentsActivationStatus(draft) {
|
|
221
|
-
draft.aiAgentsActivation.fetchStatus = {
|
|
222
|
-
fetchState: 'In-Progress',
|
|
223
|
-
error: undefined,
|
|
224
|
-
};
|
|
225
|
-
},
|
|
226
|
-
fetchAiAgentsActivationStatusSuccess: {
|
|
227
|
-
reducer(draft, action) {
|
|
228
|
-
draft.aiAgentsActivation.fetchStatus = {
|
|
229
|
-
fetchState: 'Completed',
|
|
230
|
-
error: undefined,
|
|
231
|
-
};
|
|
232
|
-
draft.aiAgentsActivation.phases = action.payload.phases;
|
|
233
|
-
draft.aiAgentsActivation.counts = action.payload.counts;
|
|
234
|
-
},
|
|
235
|
-
prepare(payload) {
|
|
236
|
-
return { payload };
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
fetchAiAgentsActivationStatusFailure: {
|
|
240
|
-
reducer(draft, action) {
|
|
241
|
-
draft.aiAgentsActivation.fetchStatus = {
|
|
242
|
-
fetchState: 'Error',
|
|
243
|
-
error: action.payload,
|
|
244
|
-
};
|
|
245
|
-
},
|
|
246
|
-
prepare(error) {
|
|
247
|
-
return { payload: error };
|
|
248
|
-
},
|
|
249
|
-
},
|
|
250
|
-
aiAgentsActivationCountsUpdated: {
|
|
251
|
-
reducer(draft, action) {
|
|
252
|
-
draft.aiAgentsActivation.counts = {
|
|
253
|
-
...draft.aiAgentsActivation.counts,
|
|
254
|
-
...action.payload,
|
|
255
|
-
};
|
|
256
|
-
},
|
|
257
|
-
prepare(payload) {
|
|
258
|
-
return { payload };
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
aiAgentsActivationPhaseChanged: {
|
|
262
|
-
reducer(draft, action) {
|
|
263
|
-
const target = draft.aiAgentsActivation.phases;
|
|
264
|
-
const index = target.findIndex((phase) => phase.key === action.payload.key);
|
|
265
|
-
if (index === -1) {
|
|
266
|
-
target.push(action.payload);
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
target[index] = { ...target[index], ...action.payload };
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
prepare(payload) {
|
|
273
|
-
return { payload };
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
183
|
updateOnboardingCustomerViewDashboardLoaded: {
|
|
277
184
|
reducer(draft) {
|
|
278
185
|
draft.dashboardLoadedStatus = {
|
|
@@ -685,82 +592,7 @@ const onboardingCustomerView = createSlice({
|
|
|
685
592
|
clearOnboardingCustomerView(draft) {
|
|
686
593
|
Object.assign(draft, initialState);
|
|
687
594
|
},
|
|
688
|
-
/** Merge AI-parsed officer fields into the officer's onboarding localData. */
|
|
689
|
-
applyKycDocumentAutofillForOnboarding: {
|
|
690
|
-
reducer(draft, action) {
|
|
691
|
-
const { officerType, values, autoFilledFieldNames, fileId } = action.payload;
|
|
692
|
-
const slot = draft.companyOfficerUpdateStatus[officerType];
|
|
693
|
-
slot.localData = Object.assign({}, slot.localData, values);
|
|
694
|
-
slot.autoFilledFields = Array.from(new Set([...(slot.autoFilledFields ?? []), ...autoFilledFieldNames]));
|
|
695
|
-
draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
|
|
696
|
-
},
|
|
697
|
-
prepare(payload) {
|
|
698
|
-
return { payload };
|
|
699
|
-
},
|
|
700
|
-
},
|
|
701
|
-
/** Merge AI-parsed company fields into companyDetails onboarding localData. */
|
|
702
|
-
applyKybDocumentAutofillForOnboarding: {
|
|
703
|
-
reducer(draft, action) {
|
|
704
|
-
const { values, autoFilledFieldNames, fileId } = action.payload;
|
|
705
|
-
draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
|
|
706
|
-
const prev = draft.companyDetails.autoFilledFields ?? [];
|
|
707
|
-
draft.companyDetails.autoFilledFields = Array.from(new Set([...prev, ...autoFilledFieldNames]));
|
|
708
|
-
draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
|
|
709
|
-
},
|
|
710
|
-
prepare(payload) {
|
|
711
|
-
return { payload };
|
|
712
|
-
},
|
|
713
|
-
},
|
|
714
|
-
/** Wipe AI-autofill badges during onboarding. */
|
|
715
|
-
clearKycKybAutofillForOnboarding: {
|
|
716
|
-
reducer(draft, action) {
|
|
717
|
-
const { officerType } = action.payload;
|
|
718
|
-
if (officerType != null) {
|
|
719
|
-
draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
|
|
720
|
-
}
|
|
721
|
-
else {
|
|
722
|
-
draft.companyDetails.autoFilledFields = [];
|
|
723
|
-
Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
|
|
724
|
-
draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
},
|
|
728
|
-
prepare(payload = {}) {
|
|
729
|
-
return { payload };
|
|
730
|
-
},
|
|
731
|
-
},
|
|
732
|
-
},
|
|
733
|
-
extraReducers: (builder) => {
|
|
734
|
-
const addParsingFileId = (draft, fileId) => {
|
|
735
|
-
draft.parsingDocumentFileIds = draft.parsingDocumentFileIds ?? [];
|
|
736
|
-
if (!draft.parsingDocumentFileIds.includes(fileId)) {
|
|
737
|
-
draft.parsingDocumentFileIds.push(fileId);
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
const removeParsingFileId = (draft, fileId) => {
|
|
741
|
-
draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
|
|
742
|
-
};
|
|
743
|
-
builder.addCase(parseUploadedKycDocument, (draft, action) => {
|
|
744
|
-
if (action.payload.target === 'onboarding') {
|
|
745
|
-
addParsingFileId(draft, action.payload.fileId);
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
builder.addCase(parseUploadedKybDocument, (draft, action) => {
|
|
749
|
-
if (action.payload.target === 'onboarding') {
|
|
750
|
-
addParsingFileId(draft, action.payload.fileId);
|
|
751
|
-
}
|
|
752
|
-
});
|
|
753
|
-
builder.addCase(parseUploadedKycDocumentFailure, (draft, action) => {
|
|
754
|
-
if (action.payload.target === 'onboarding') {
|
|
755
|
-
removeParsingFileId(draft, action.payload.fileId);
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
builder.addCase(parseUploadedKybDocumentFailure, (draft, action) => {
|
|
759
|
-
if (action.payload.target === 'onboarding') {
|
|
760
|
-
removeParsingFileId(draft, action.payload.fileId);
|
|
761
|
-
}
|
|
762
|
-
});
|
|
763
595
|
},
|
|
764
596
|
});
|
|
765
|
-
export const { fetchOnboardingCustomerView, fetchOnboardingCustomerSetupView, fetchOnboardingCustomerSetupViewSuccess, fetchOnboardingCustomerSetupViewFailure, updateOnboardingCustomerViewCompleteStatus, updateOnboardingCustomerViewCompleteStatusSuccess, updateOnboardingCustomerViewCompleteStatusFailure,
|
|
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;
|
|
766
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,
|
|
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,
|
|
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 &&
|
|
@@ -120,7 +119,6 @@ export function getOnboardingCustomerView(state, companyId) {
|
|
|
120
119
|
return {
|
|
121
120
|
companyDetailsLocalData,
|
|
122
121
|
companyOfficerLocalData,
|
|
123
|
-
parsingDocumentFileIds,
|
|
124
122
|
subscriptionBillingAddress: subscriptionBillingAddress?.addressToCreate,
|
|
125
123
|
companyView,
|
|
126
124
|
allNationalityCountries,
|
|
@@ -325,11 +323,3 @@ export const getProductSettingsString = (productSettings) => {
|
|
|
325
323
|
.map((key) => productKeyMap[key])
|
|
326
324
|
.join(',');
|
|
327
325
|
};
|
|
328
|
-
const fromActivationView = (state) =>
|
|
329
|
-
// Fall back to the empty subview so state hydrated from an older persisted
|
|
330
|
-
// version (before aiAgentsActivation existed) doesn't crash on .phases/.counts.
|
|
331
|
-
state.onboardingCustomerViewState.aiAgentsActivation ??
|
|
332
|
-
emptyAiAgentsActivationSubview;
|
|
333
|
-
export const getAiAgentsActivationSubview = (state) => fromActivationView(state);
|
|
334
|
-
export const getAiAgentsActivationPhases = (state) => fromActivationView(state).phases;
|
|
335
|
-
export const getAiAgentsActivationCounts = (state) => fromActivationView(state).counts;
|
|
@@ -26,15 +26,3 @@ export const ALL_ONBOARDING_STEPS = [
|
|
|
26
26
|
...ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
|
|
27
27
|
];
|
|
28
28
|
export const toOnboardingStepType = (v) => stringToUnion(v, ALL_ONBOARDING_STEPS);
|
|
29
|
-
export const emptyAiAgentsActivationCounts = {
|
|
30
|
-
customerCount: 0,
|
|
31
|
-
glAccountCount: 0,
|
|
32
|
-
targetTransactionCount: 0,
|
|
33
|
-
transactionCount: 0,
|
|
34
|
-
vendorCount: 0,
|
|
35
|
-
};
|
|
36
|
-
export const emptyAiAgentsActivationSubview = {
|
|
37
|
-
counts: emptyAiAgentsActivationCounts,
|
|
38
|
-
fetchStatus: { fetchState: 'Not-Started', error: undefined },
|
|
39
|
-
phases: [],
|
|
40
|
-
};
|
|
@@ -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
|
-
|
|
16
|
-
companyDetails: { autoFilledFields: [] },
|
|
8
|
+
companyDetails: {},
|
|
17
9
|
companyOfficerUpdateStatus: {
|
|
18
|
-
Officer_1: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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,
|
|
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;
|
|
@@ -87,17 +87,15 @@ export function getBusinessVerificationDetails(state, companyId) {
|
|
|
87
87
|
const { setupViewState, countryListState } = state;
|
|
88
88
|
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, updateStatus, } = setupViewState;
|
|
89
89
|
const companyView = getCompanyView(state, companyId, []);
|
|
90
|
-
const { companyDetailsLocalData, companyOfficerLocalData
|
|
90
|
+
const { companyDetailsLocalData, companyOfficerLocalData } = getCompanyAndIdentityDetails(state, companyId, {
|
|
91
91
|
companyDetails,
|
|
92
92
|
companyOfficerUpdateStatus,
|
|
93
93
|
primaryContactDetails,
|
|
94
|
-
parsingDocumentFileIds: setupViewState.parsingDocumentFileIds,
|
|
95
94
|
});
|
|
96
95
|
const allNationalityCountries = countryListState.byCountryListCode.nationalityCountryList.countries;
|
|
97
96
|
return {
|
|
98
97
|
companyDetailsLocalData,
|
|
99
98
|
companyOfficerLocalData,
|
|
100
|
-
parsingDocumentFileIds,
|
|
101
99
|
companyView,
|
|
102
100
|
updateStatus,
|
|
103
101
|
allNationalityCountries,
|
|
@@ -121,7 +119,6 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
|
|
|
121
119
|
const companyAddress = addressViewState.newAddressState?.company_address;
|
|
122
120
|
const registeredCompanyAddress = addressViewState.newAddressState?.company_registered_address;
|
|
123
121
|
companyDetailsLocalData = {
|
|
124
|
-
autoFilledFields: companyDetails.autoFilledFields,
|
|
125
122
|
companyId,
|
|
126
123
|
companyDescription,
|
|
127
124
|
companyLegalName,
|
|
@@ -194,7 +191,6 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
|
|
|
194
191
|
const companyOfficerAddress = addressViewState.newAddressState?.[addressType];
|
|
195
192
|
companyOfficerLocalData[officerType] = {
|
|
196
193
|
...companyOfficer.localData,
|
|
197
|
-
autoFilledFields: companyOfficer.autoFilledFields,
|
|
198
194
|
userFiles: getFilesByFileIds(fileState, fileIds),
|
|
199
195
|
additionalFiles: getFilesByFileIds(fileState, additionalSubmittedDocumentsForVerificationFileIds),
|
|
200
196
|
deleteFileStatusById,
|
|
@@ -208,7 +204,6 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
|
|
|
208
204
|
return {
|
|
209
205
|
companyDetailsLocalData,
|
|
210
206
|
companyOfficerLocalData,
|
|
211
|
-
parsingDocumentFileIds: companyAndIdentityDetails.parsingDocumentFileIds,
|
|
212
207
|
};
|
|
213
208
|
};
|
|
214
209
|
/* This helper function takes deposit accounts and payment accounts
|