@zeniai/client-epic-state 5.1.3 → 5.1.4-beta1ND
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 +4 -0
- package/lib/entity/company/companyPayload.js +6 -0
- package/lib/entity/company/companyStateTypes.d.ts +7 -0
- package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountSelector.js +9 -0
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
- 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 +1 -0
- package/lib/entity/tenant/tenantReducer.d.ts +38 -25
- package/lib/entity/tenant/tenantReducer.js +65 -5
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/epic.d.ts +6 -1
- package/lib/epic.js +7 -1
- package/lib/esm/entity/company/companyPayload.js +6 -0
- package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +8 -0
- package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
- package/lib/esm/entity/tenant/tenantReducer.js +63 -3
- package/lib/esm/epic.js +7 -1
- package/lib/esm/index.js +9 -6
- 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/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +40 -0
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +29 -0
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +218 -50
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +12 -2
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +12 -0
- package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +2 -2
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +58 -0
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +77 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +14 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +207 -0
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +106 -52
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
- package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +41 -0
- package/lib/index.d.ts +13 -9
- package/lib/index.js +55 -35
- 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/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +44 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +8 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +33 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +41 -4
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +220 -51
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +5 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +15 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +40 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -1
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.d.ts +1 -1
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +2 -2
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +28 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +62 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +9 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +81 -0
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +24 -0
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +17 -0
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +29 -0
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +215 -0
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +28 -2
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +107 -53
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +7 -2
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +19 -0
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +154 -0
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +46 -0
- package/package.json +1 -1
|
@@ -1,66 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearSetupView = exports.clearSetupViewDataInLocalStore = exports.saveIndustryAndIncDateInLocalStore = exports.verifyOtpFailureSpendManagementSetUp = exports.verifyOtpSuccessSpendManagementSetUp = exports.verifyOtpSpendManagementSetUp = exports.sendOtpFailureSpendManagementSetUp = exports.sendOtpSuccessSpendManagementSetUp = exports.resendOtpSpendManagementSetUp = exports.sendOtpSpendManagementSetUp = exports.saveTreasuryAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerPhoneInLocalStore = exports.saveSetupViewDataInLocalStore = exports.updateSetupViewLocalStoreData = exports.updateSelectedCompanyOfficer = exports.updateBusinessVerificationDetailsFailure = exports.updateBusinessVerificationDetailsSuccess = exports.updateBusinessVerificationDetails = exports.enableSetupFailure = exports.enableSetupSuccess = exports.enableSetup = exports.initialState = void 0;
|
|
4
|
+
exports.clearKycKybAutofillForSetup = exports.applyKybDocumentAutofillForSetup = exports.applyKycDocumentAutofillForSetup = exports.clearSetupView = exports.clearSetupViewDataInLocalStore = exports.saveIndustryAndIncDateInLocalStore = exports.verifyOtpFailureSpendManagementSetUp = exports.verifyOtpSuccessSpendManagementSetUp = exports.verifyOtpSpendManagementSetUp = exports.sendOtpFailureSpendManagementSetUp = exports.sendOtpSuccessSpendManagementSetUp = exports.resendOtpSpendManagementSetUp = exports.sendOtpSpendManagementSetUp = exports.saveTreasuryAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerPhoneInLocalStore = exports.saveSetupViewDataInLocalStore = exports.updateSetupViewLocalStoreData = exports.updateSelectedCompanyOfficer = exports.updateBusinessVerificationDetailsFailure = exports.updateBusinessVerificationDetailsSuccess = exports.updateBusinessVerificationDetails = exports.enableSetupFailure = exports.enableSetupSuccess = exports.enableSetup = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const kycKybAutofillActions_1 = require("./kycKybAutofillActions");
|
|
6
7
|
const initialFetchStatus = {
|
|
7
8
|
fetchState: 'Not-Started',
|
|
8
9
|
error: undefined,
|
|
9
10
|
};
|
|
11
|
+
const emptyOfficerSlot = {
|
|
12
|
+
autoFilledFields: [],
|
|
13
|
+
localData: undefined,
|
|
14
|
+
sendOtpStatus: initialFetchStatus,
|
|
15
|
+
otpverificationStatus: initialFetchStatus,
|
|
16
|
+
};
|
|
10
17
|
exports.initialState = {
|
|
11
18
|
updateStatus: { fetchState: 'Not-Started', error: undefined },
|
|
12
|
-
|
|
19
|
+
parsingDocumentFileIds: [],
|
|
20
|
+
companyDetails: { autoFilledFields: [] },
|
|
13
21
|
companyOfficerUpdateStatus: {
|
|
14
|
-
Officer_1: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
Officer_3: {
|
|
25
|
-
localData: undefined,
|
|
26
|
-
sendOtpStatus: initialFetchStatus,
|
|
27
|
-
otpverificationStatus: initialFetchStatus,
|
|
28
|
-
},
|
|
29
|
-
Officer_4: {
|
|
30
|
-
localData: undefined,
|
|
31
|
-
sendOtpStatus: initialFetchStatus,
|
|
32
|
-
otpverificationStatus: initialFetchStatus,
|
|
33
|
-
},
|
|
34
|
-
Officer_5: {
|
|
35
|
-
localData: undefined,
|
|
36
|
-
sendOtpStatus: initialFetchStatus,
|
|
37
|
-
otpverificationStatus: initialFetchStatus,
|
|
38
|
-
},
|
|
39
|
-
Officer_6: {
|
|
40
|
-
localData: undefined,
|
|
41
|
-
sendOtpStatus: initialFetchStatus,
|
|
42
|
-
otpverificationStatus: initialFetchStatus,
|
|
43
|
-
},
|
|
44
|
-
Officer_7: {
|
|
45
|
-
localData: undefined,
|
|
46
|
-
sendOtpStatus: initialFetchStatus,
|
|
47
|
-
otpverificationStatus: initialFetchStatus,
|
|
48
|
-
},
|
|
49
|
-
Officer_8: {
|
|
50
|
-
localData: undefined,
|
|
51
|
-
sendOtpStatus: initialFetchStatus,
|
|
52
|
-
otpverificationStatus: initialFetchStatus,
|
|
53
|
-
},
|
|
54
|
-
Officer_9: {
|
|
55
|
-
localData: undefined,
|
|
56
|
-
sendOtpStatus: initialFetchStatus,
|
|
57
|
-
otpverificationStatus: initialFetchStatus,
|
|
58
|
-
},
|
|
59
|
-
Officer_10: {
|
|
60
|
-
localData: undefined,
|
|
61
|
-
sendOtpStatus: initialFetchStatus,
|
|
62
|
-
otpverificationStatus: initialFetchStatus,
|
|
63
|
-
},
|
|
22
|
+
Officer_1: { ...emptyOfficerSlot },
|
|
23
|
+
Officer_2: { ...emptyOfficerSlot },
|
|
24
|
+
Officer_3: { ...emptyOfficerSlot },
|
|
25
|
+
Officer_4: { ...emptyOfficerSlot },
|
|
26
|
+
Officer_5: { ...emptyOfficerSlot },
|
|
27
|
+
Officer_6: { ...emptyOfficerSlot },
|
|
28
|
+
Officer_7: { ...emptyOfficerSlot },
|
|
29
|
+
Officer_8: { ...emptyOfficerSlot },
|
|
30
|
+
Officer_9: { ...emptyOfficerSlot },
|
|
31
|
+
Officer_10: { ...emptyOfficerSlot },
|
|
64
32
|
},
|
|
65
33
|
primaryContactDetails: {},
|
|
66
34
|
};
|
|
@@ -301,7 +269,93 @@ const setupView = (0, toolkit_1.createSlice)({
|
|
|
301
269
|
clearSetupView(draft) {
|
|
302
270
|
Object.assign(draft, exports.initialState);
|
|
303
271
|
},
|
|
272
|
+
/**
|
|
273
|
+
* Merge AI-parsed officer fields into the selected officer's localData and
|
|
274
|
+
* track which field names were autofilled so the form can show the ✦ badge.
|
|
275
|
+
*/
|
|
276
|
+
applyKycDocumentAutofillForSetup: {
|
|
277
|
+
reducer(draft, action) {
|
|
278
|
+
const { officerType, values, autoFilledFieldNames, fileId } = action.payload;
|
|
279
|
+
const slot = draft.companyOfficerUpdateStatus[officerType];
|
|
280
|
+
slot.localData = Object.assign({}, slot.localData, values);
|
|
281
|
+
slot.autoFilledFields = Array.from(new Set([...(slot.autoFilledFields ?? []), ...autoFilledFieldNames]));
|
|
282
|
+
draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
|
|
283
|
+
},
|
|
284
|
+
prepare(payload) {
|
|
285
|
+
return { payload };
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
/**
|
|
289
|
+
* Merge AI-parsed company fields into companyDetails.localData and track
|
|
290
|
+
* which field names were autofilled.
|
|
291
|
+
*/
|
|
292
|
+
applyKybDocumentAutofillForSetup: {
|
|
293
|
+
reducer(draft, action) {
|
|
294
|
+
const { values, autoFilledFieldNames, fileId } = action.payload;
|
|
295
|
+
draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
|
|
296
|
+
draft.companyDetails.autoFilledFields = Array.from(new Set([
|
|
297
|
+
...(draft.companyDetails.autoFilledFields ?? []),
|
|
298
|
+
...autoFilledFieldNames,
|
|
299
|
+
]));
|
|
300
|
+
draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
|
|
301
|
+
},
|
|
302
|
+
prepare(payload) {
|
|
303
|
+
return { payload };
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
/**
|
|
307
|
+
* Wipe AI-autofill badges. If `officerType` is provided, clears only that
|
|
308
|
+
* officer; otherwise clears company details too.
|
|
309
|
+
*/
|
|
310
|
+
clearKycKybAutofillForSetup: {
|
|
311
|
+
reducer(draft, action) {
|
|
312
|
+
const { officerType } = action.payload;
|
|
313
|
+
if (officerType != null) {
|
|
314
|
+
draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
draft.companyDetails.autoFilledFields = [];
|
|
318
|
+
Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
|
|
319
|
+
draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
prepare(payload = {}) {
|
|
324
|
+
return { payload };
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
extraReducers: (builder) => {
|
|
329
|
+
const addParsingFileId = (draft, fileId) => {
|
|
330
|
+
draft.parsingDocumentFileIds = draft.parsingDocumentFileIds ?? [];
|
|
331
|
+
if (!draft.parsingDocumentFileIds.includes(fileId)) {
|
|
332
|
+
draft.parsingDocumentFileIds.push(fileId);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
const removeParsingFileId = (draft, fileId) => {
|
|
336
|
+
draft.parsingDocumentFileIds = (draft.parsingDocumentFileIds ?? []).filter((id) => id !== fileId);
|
|
337
|
+
};
|
|
338
|
+
builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocument, (draft, action) => {
|
|
339
|
+
if (action.payload.target === 'setup') {
|
|
340
|
+
addParsingFileId(draft, action.payload.fileId);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocument, (draft, action) => {
|
|
344
|
+
if (action.payload.target === 'setup') {
|
|
345
|
+
addParsingFileId(draft, action.payload.fileId);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
builder.addCase(kycKybAutofillActions_1.parseUploadedKycDocumentFailure, (draft, action) => {
|
|
349
|
+
if (action.payload.target === 'setup') {
|
|
350
|
+
removeParsingFileId(draft, action.payload.fileId);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
builder.addCase(kycKybAutofillActions_1.parseUploadedKybDocumentFailure, (draft, action) => {
|
|
354
|
+
if (action.payload.target === 'setup') {
|
|
355
|
+
removeParsingFileId(draft, action.payload.fileId);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
304
358
|
},
|
|
305
359
|
});
|
|
306
|
-
_a = setupView.actions, exports.enableSetup = _a.enableSetup, exports.enableSetupSuccess = _a.enableSetupSuccess, exports.enableSetupFailure = _a.enableSetupFailure, exports.updateBusinessVerificationDetails = _a.updateBusinessVerificationDetails, exports.updateBusinessVerificationDetailsSuccess = _a.updateBusinessVerificationDetailsSuccess, exports.updateBusinessVerificationDetailsFailure = _a.updateBusinessVerificationDetailsFailure, exports.updateSelectedCompanyOfficer = _a.updateSelectedCompanyOfficer, exports.updateSetupViewLocalStoreData = _a.updateSetupViewLocalStoreData, exports.saveSetupViewDataInLocalStore = _a.saveSetupViewDataInLocalStore, exports.saveCompnayOfficerPhoneInLocalStore = _a.saveCompnayOfficerPhoneInLocalStore, exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = _a.saveCompnayOfficerAdditionalDocumentsInLocalStore, exports.saveTreasuryAdditionalDocumentsInLocalStore = _a.saveTreasuryAdditionalDocumentsInLocalStore, exports.sendOtpSpendManagementSetUp = _a.sendOtp, exports.resendOtpSpendManagementSetUp = _a.resendOtp, exports.sendOtpSuccessSpendManagementSetUp = _a.sendOtpSuccess, exports.sendOtpFailureSpendManagementSetUp = _a.sendOtpFailure, exports.verifyOtpSpendManagementSetUp = _a.verifyOtp, exports.verifyOtpSuccessSpendManagementSetUp = _a.verifyOtpSuccess, exports.verifyOtpFailureSpendManagementSetUp = _a.verifyOtpFailure, exports.saveIndustryAndIncDateInLocalStore = _a.saveIndustryAndIncDateInLocalStore, exports.clearSetupViewDataInLocalStore = _a.clearSetupViewDataInLocalStore, exports.clearSetupView = _a.clearSetupView;
|
|
360
|
+
_a = setupView.actions, exports.enableSetup = _a.enableSetup, exports.enableSetupSuccess = _a.enableSetupSuccess, exports.enableSetupFailure = _a.enableSetupFailure, exports.updateBusinessVerificationDetails = _a.updateBusinessVerificationDetails, exports.updateBusinessVerificationDetailsSuccess = _a.updateBusinessVerificationDetailsSuccess, exports.updateBusinessVerificationDetailsFailure = _a.updateBusinessVerificationDetailsFailure, exports.updateSelectedCompanyOfficer = _a.updateSelectedCompanyOfficer, exports.updateSetupViewLocalStoreData = _a.updateSetupViewLocalStoreData, exports.saveSetupViewDataInLocalStore = _a.saveSetupViewDataInLocalStore, exports.saveCompnayOfficerPhoneInLocalStore = _a.saveCompnayOfficerPhoneInLocalStore, exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = _a.saveCompnayOfficerAdditionalDocumentsInLocalStore, exports.saveTreasuryAdditionalDocumentsInLocalStore = _a.saveTreasuryAdditionalDocumentsInLocalStore, exports.sendOtpSpendManagementSetUp = _a.sendOtp, exports.resendOtpSpendManagementSetUp = _a.resendOtp, exports.sendOtpSuccessSpendManagementSetUp = _a.sendOtpSuccess, exports.sendOtpFailureSpendManagementSetUp = _a.sendOtpFailure, exports.verifyOtpSpendManagementSetUp = _a.verifyOtp, exports.verifyOtpSuccessSpendManagementSetUp = _a.verifyOtpSuccess, exports.verifyOtpFailureSpendManagementSetUp = _a.verifyOtpFailure, exports.saveIndustryAndIncDateInLocalStore = _a.saveIndustryAndIncDateInLocalStore, exports.clearSetupViewDataInLocalStore = _a.clearSetupViewDataInLocalStore, exports.clearSetupView = _a.clearSetupView, exports.applyKycDocumentAutofillForSetup = _a.applyKycDocumentAutofillForSetup, exports.applyKybDocumentAutofillForSetup = _a.applyKybDocumentAutofillForSetup, exports.clearKycKybAutofillForSetup = _a.clearKycKybAutofillForSetup;
|
|
307
361
|
exports.default = setupView.reducer;
|
|
@@ -16,7 +16,7 @@ import { CompanyOfficerType } from '../../companyView/types/companyPassport/comp
|
|
|
16
16
|
import { CompanyView } from '../../companyView/types/companyView';
|
|
17
17
|
import { AccountTypeSubConfigCodeKeyType } from '../billPay/billPayConfig/billPayConfigState';
|
|
18
18
|
import { PlaidAccountKeyType, PlaidConnectionDetails } from '../plaidAccount/plaidAccountViewState';
|
|
19
|
-
import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewType } from './setupViewState';
|
|
19
|
+
import { CompanyAndIdentityDetails, CompanyOfficerLocalData, PrimaryContactLocalData, SetupViewState, SetupViewType } from './setupViewState';
|
|
20
20
|
export interface SetupView {
|
|
21
21
|
accountFetchStatus: FetchStateAndError;
|
|
22
22
|
accountUpdateStatus: FetchStateAndError;
|
|
@@ -54,6 +54,8 @@ export interface FundingAccount {
|
|
|
54
54
|
}
|
|
55
55
|
export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
|
|
56
56
|
additionalFiles: File[];
|
|
57
|
+
/** Field names in this officer's localData populated by AI doc autofill. */
|
|
58
|
+
autoFilledFields: string[];
|
|
57
59
|
deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
|
|
58
60
|
otpverificationStatus: FetchStateAndError;
|
|
59
61
|
sendOtpStatus: FetchStateAndError;
|
|
@@ -62,6 +64,8 @@ export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
|
|
|
62
64
|
addressStatus?: NewAddressData;
|
|
63
65
|
}
|
|
64
66
|
export interface CompanyDetails {
|
|
67
|
+
/** Field names in companyDetails localData populated by AI doc autofill. */
|
|
68
|
+
autoFilledFields: string[];
|
|
65
69
|
companyFiles: File[];
|
|
66
70
|
companyId: ID;
|
|
67
71
|
deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
|
|
@@ -96,6 +100,7 @@ export interface CompanyDetails {
|
|
|
96
100
|
}
|
|
97
101
|
interface CompanyAndOfficerLocalData {
|
|
98
102
|
companyOfficerLocalData: Record<CompanyOfficerType, CompanyOfficersDetails | undefined>;
|
|
103
|
+
parsingDocumentFileIds: ID[];
|
|
99
104
|
companyDetailsLocalData?: CompanyDetails;
|
|
100
105
|
}
|
|
101
106
|
export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData {
|
|
@@ -105,7 +110,7 @@ export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData
|
|
|
105
110
|
}
|
|
106
111
|
export declare function getCommonSetupViewDetails(state: RootState, companyId: ID, setupViewType: SetupViewType, plaidAccountKeyType: PlaidAccountKeyType): SetupView;
|
|
107
112
|
export declare function getBusinessVerificationDetails(state: RootState, companyId: ID): BusinessVerificationDetails;
|
|
108
|
-
export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails) => CompanyAndOfficerLocalData;
|
|
113
|
+
export declare const getCompanyAndIdentityDetails: (state: RootState, companyId: ID, companyAndIdentityDetails: CompanyAndIdentityDetails & Pick<SetupViewState, "parsingDocumentFileIds">) => CompanyAndOfficerLocalData;
|
|
109
114
|
export declare const getAllFundingAccounts: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[], paymentAccountBalanceFetchStatus: Record<ID, FetchStateAndError>, includeOnlyVerifiedAccounts?: boolean) => FundingAccount[];
|
|
110
115
|
export declare const mapDepositAccToFundingAccount: (depositAcc: DepositAccount) => FundingAccount;
|
|
111
116
|
export declare const mapDepositAccountWithLimitToFundingAccount: (depositAcc: DepositAccountWithLimit) => FundingAccount;
|
|
@@ -92,15 +92,17 @@ function getBusinessVerificationDetails(state, companyId) {
|
|
|
92
92
|
const { setupViewState, countryListState } = state;
|
|
93
93
|
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, updateStatus, } = setupViewState;
|
|
94
94
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
95
|
-
const { companyDetailsLocalData, companyOfficerLocalData } = (0, exports.getCompanyAndIdentityDetails)(state, companyId, {
|
|
95
|
+
const { companyDetailsLocalData, companyOfficerLocalData, parsingDocumentFileIds, } = (0, exports.getCompanyAndIdentityDetails)(state, companyId, {
|
|
96
96
|
companyDetails,
|
|
97
97
|
companyOfficerUpdateStatus,
|
|
98
98
|
primaryContactDetails,
|
|
99
|
+
parsingDocumentFileIds: setupViewState.parsingDocumentFileIds,
|
|
99
100
|
});
|
|
100
101
|
const allNationalityCountries = countryListState.byCountryListCode.nationalityCountryList.countries;
|
|
101
102
|
return {
|
|
102
103
|
companyDetailsLocalData,
|
|
103
104
|
companyOfficerLocalData,
|
|
105
|
+
parsingDocumentFileIds,
|
|
104
106
|
companyView,
|
|
105
107
|
updateStatus,
|
|
106
108
|
allNationalityCountries,
|
|
@@ -124,6 +126,7 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
124
126
|
const companyAddress = addressViewState.newAddressState?.company_address;
|
|
125
127
|
const registeredCompanyAddress = addressViewState.newAddressState?.company_registered_address;
|
|
126
128
|
companyDetailsLocalData = {
|
|
129
|
+
autoFilledFields: companyDetails.autoFilledFields,
|
|
127
130
|
companyId,
|
|
128
131
|
companyDescription,
|
|
129
132
|
companyLegalName,
|
|
@@ -196,6 +199,7 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
196
199
|
const companyOfficerAddress = addressViewState.newAddressState?.[addressType];
|
|
197
200
|
companyOfficerLocalData[officerType] = {
|
|
198
201
|
...companyOfficer.localData,
|
|
202
|
+
autoFilledFields: companyOfficer.autoFilledFields,
|
|
199
203
|
userFiles: (0, fileSelector_1.getFilesByFileIds)(fileState, fileIds),
|
|
200
204
|
additionalFiles: (0, fileSelector_1.getFilesByFileIds)(fileState, additionalSubmittedDocumentsForVerificationFileIds),
|
|
201
205
|
deleteFileStatusById,
|
|
@@ -209,6 +213,7 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
209
213
|
return {
|
|
210
214
|
companyDetailsLocalData,
|
|
211
215
|
companyOfficerLocalData,
|
|
216
|
+
parsingDocumentFileIds: companyAndIdentityDetails.parsingDocumentFileIds,
|
|
212
217
|
};
|
|
213
218
|
};
|
|
214
219
|
exports.getCompanyAndIdentityDetails = getCompanyAndIdentityDetails;
|
|
@@ -81,9 +81,21 @@ export interface SetupViewLocalData {
|
|
|
81
81
|
*/
|
|
82
82
|
export interface CompanyAndIdentityDetails {
|
|
83
83
|
companyDetails: {
|
|
84
|
+
/**
|
|
85
|
+
* Field names from {@link CompanyDetailsLocalData} that were populated by AI
|
|
86
|
+
* autofill from an uploaded KYB document. Drives the ✦ sparkle in the form.
|
|
87
|
+
* Always present (empty when no autofill has run yet).
|
|
88
|
+
*/
|
|
89
|
+
autoFilledFields: string[];
|
|
84
90
|
localData?: CompanyDetailsLocalData;
|
|
85
91
|
};
|
|
86
92
|
companyOfficerUpdateStatus: Record<CompanyOfficerType, {
|
|
93
|
+
/**
|
|
94
|
+
* Field names from {@link CompanyOfficerLocalData} populated by AI autofill
|
|
95
|
+
* from an uploaded KYC identity document. Drives the ✦ sparkle in the form.
|
|
96
|
+
* Always present (empty when no autofill has run yet).
|
|
97
|
+
*/
|
|
98
|
+
autoFilledFields: string[];
|
|
87
99
|
otpverificationStatus: FetchStateAndError;
|
|
88
100
|
sendOtpStatus: FetchStateAndError;
|
|
89
101
|
localData?: CompanyOfficerLocalData;
|
|
@@ -93,6 +105,13 @@ export interface CompanyAndIdentityDetails {
|
|
|
93
105
|
};
|
|
94
106
|
}
|
|
95
107
|
export interface SetupViewState extends CompanyAndIdentityDetails {
|
|
108
|
+
/**
|
|
109
|
+
* File IDs currently being parsed by the AI autofill epic. Populated when
|
|
110
|
+
* `parseUploadedKyc/KybDocument` dispatches and cleared when the
|
|
111
|
+
* corresponding apply / failure action fires. Drives the "AI is reading
|
|
112
|
+
* your document" overlay on the document upload field.
|
|
113
|
+
*/
|
|
114
|
+
parsingDocumentFileIds: ID[];
|
|
96
115
|
updateStatus: FetchStateAndError;
|
|
97
116
|
}
|
|
98
117
|
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the KYC / KYB document autofill flow that lives inside the
|
|
3
|
+
* commonSetup feature (Setup pages + Onboarding both consume it via the same
|
|
4
|
+
* selector view; there is no separate state slice).
|
|
5
|
+
*
|
|
6
|
+
* Backed by document-communication-agent `POST /1.0/documents/process/sync`,
|
|
7
|
+
* which proxies document-service ExtendAI parsers and returns one of the
|
|
8
|
+
* parser payloads below — each value shaped as `{value, confidence}` per field.
|
|
9
|
+
*/
|
|
10
|
+
import { ID } from '../../../../commonStateTypes/common';
|
|
11
|
+
import { AllowedDocumentType } from '../../../../entity/file/fileState';
|
|
12
|
+
/**
|
|
13
|
+
* Form-side identity document types as picked in `SelectDocumentField`.
|
|
14
|
+
* These are camelCase per the web-components convention.
|
|
15
|
+
*/
|
|
16
|
+
export type KycSelectDocumentType = 'driverLicense' | 'passport' | 'ssnCard' | 'stateId';
|
|
17
|
+
/**
|
|
18
|
+
* KYC document types accepted by the document-service parsers (snake_case).
|
|
19
|
+
* Subset of {@link KycKybProvidedDocumentType}. `stateId` from the form maps
|
|
20
|
+
* to no parser today and is skipped at dispatch time.
|
|
21
|
+
*/
|
|
22
|
+
export type KycProvidedDocumentType = 'passport' | 'driving_license' | 'social_security_card';
|
|
23
|
+
/** KYB document types accepted by the document-service parsers. */
|
|
24
|
+
export type KybProvidedDocumentType = 'certificate_of_incorporation' | 'tax_ein';
|
|
25
|
+
/** All KYC / KYB document types accepted by document-communication-agent. */
|
|
26
|
+
export type KycKybProvidedDocumentType = KycProvidedDocumentType | KybProvidedDocumentType;
|
|
27
|
+
/** Field value with model confidence (0..1) as returned by ExtendAI parsers. */
|
|
28
|
+
export interface FieldWithConfidence<T = string | null> {
|
|
29
|
+
confidence: number;
|
|
30
|
+
value: T | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parser payloads — keep in sync with document-service
|
|
34
|
+
* `processors/parsers/extend_*_parser.py`.
|
|
35
|
+
*/
|
|
36
|
+
export interface ExtendPassportParsed {
|
|
37
|
+
date_of_birth?: FieldWithConfidence;
|
|
38
|
+
date_of_expiry?: FieldWithConfidence;
|
|
39
|
+
date_of_issue?: FieldWithConfidence;
|
|
40
|
+
first_name?: FieldWithConfidence;
|
|
41
|
+
gender?: FieldWithConfidence;
|
|
42
|
+
issuing_authority?: FieldWithConfidence;
|
|
43
|
+
last_name?: FieldWithConfidence;
|
|
44
|
+
mrz_line_1?: FieldWithConfidence;
|
|
45
|
+
mrz_line_2?: FieldWithConfidence;
|
|
46
|
+
nationality?: FieldWithConfidence;
|
|
47
|
+
passport_number?: FieldWithConfidence;
|
|
48
|
+
place_of_birth?: FieldWithConfidence;
|
|
49
|
+
}
|
|
50
|
+
export interface ExtendDrivingLicenseParsed {
|
|
51
|
+
address_city?: FieldWithConfidence;
|
|
52
|
+
address_state?: FieldWithConfidence;
|
|
53
|
+
address_street?: FieldWithConfidence;
|
|
54
|
+
address_zip?: FieldWithConfidence;
|
|
55
|
+
date_of_birth?: FieldWithConfidence;
|
|
56
|
+
date_of_expiry?: FieldWithConfidence;
|
|
57
|
+
date_of_issue?: FieldWithConfidence;
|
|
58
|
+
first_name?: FieldWithConfidence;
|
|
59
|
+
issuing_state?: FieldWithConfidence;
|
|
60
|
+
last_name?: FieldWithConfidence;
|
|
61
|
+
license_number?: FieldWithConfidence;
|
|
62
|
+
middle_name?: FieldWithConfidence;
|
|
63
|
+
}
|
|
64
|
+
export interface ExtendSsnCardParsed {
|
|
65
|
+
full_name?: FieldWithConfidence;
|
|
66
|
+
}
|
|
67
|
+
export interface ExtendCertificateOfIncorporationParsed {
|
|
68
|
+
company_address?: FieldWithConfidence;
|
|
69
|
+
company_legal_name?: FieldWithConfidence;
|
|
70
|
+
countries_of_operations?: FieldWithConfidence<string[]>;
|
|
71
|
+
date_of_incorporation?: FieldWithConfidence;
|
|
72
|
+
ein?: FieldWithConfidence;
|
|
73
|
+
industry?: FieldWithConfidence;
|
|
74
|
+
phone_number?: FieldWithConfidence;
|
|
75
|
+
product_description?: FieldWithConfidence;
|
|
76
|
+
purpose_of_account?: FieldWithConfidence;
|
|
77
|
+
registered_address?: FieldWithConfidence;
|
|
78
|
+
regulated_status?: FieldWithConfidence;
|
|
79
|
+
source_of_funds?: FieldWithConfidence;
|
|
80
|
+
state_of_incorporation?: FieldWithConfidence;
|
|
81
|
+
sub_industry?: FieldWithConfidence;
|
|
82
|
+
sub_us_nexus?: FieldWithConfidence;
|
|
83
|
+
transaction_volume_expectations?: FieldWithConfidence;
|
|
84
|
+
type_of_incorporation?: FieldWithConfidence;
|
|
85
|
+
us_nexus?: FieldWithConfidence;
|
|
86
|
+
website?: FieldWithConfidence;
|
|
87
|
+
}
|
|
88
|
+
export interface ExtendTaxEinParsed {
|
|
89
|
+
ein?: FieldWithConfidence;
|
|
90
|
+
irs_address?: FieldWithConfidence;
|
|
91
|
+
legal_business_name?: FieldWithConfidence;
|
|
92
|
+
trade_name?: FieldWithConfidence;
|
|
93
|
+
}
|
|
94
|
+
/** POST /1.0/documents/process/sync request body. */
|
|
95
|
+
export interface SyncDocumentsProcessRequest {
|
|
96
|
+
files: Array<{
|
|
97
|
+
file_id: ID;
|
|
98
|
+
}>;
|
|
99
|
+
provided_document_type: KycKybProvidedDocumentType;
|
|
100
|
+
metadata?: {
|
|
101
|
+
source?: string;
|
|
102
|
+
} & Record<string, unknown>;
|
|
103
|
+
processing_priority?: number;
|
|
104
|
+
}
|
|
105
|
+
/** Parser payload union — `data.files[0].extracted_data` for any document type. */
|
|
106
|
+
export type ExtendExtractedData = ExtendPassportParsed | ExtendDrivingLicenseParsed | ExtendSsnCardParsed | ExtendCertificateOfIncorporationParsed | ExtendTaxEinParsed;
|
|
107
|
+
/** Per-file row inside the batch response. */
|
|
108
|
+
export interface SyncDocumentsProcessFileResult {
|
|
109
|
+
extracted_data: ExtendExtractedData | null;
|
|
110
|
+
file_id: ID;
|
|
111
|
+
status: string;
|
|
112
|
+
filename?: string | null;
|
|
113
|
+
processing_metadata?: Record<string, unknown>;
|
|
114
|
+
}
|
|
115
|
+
/** POST /1.0/documents/process/sync response body. */
|
|
116
|
+
export interface SyncDocumentsProcessResponse {
|
|
117
|
+
data: {
|
|
118
|
+
files: SyncDocumentsProcessFileResult[];
|
|
119
|
+
provided_document_type: KycKybProvidedDocumentType;
|
|
120
|
+
request_id: string;
|
|
121
|
+
status: string;
|
|
122
|
+
tenant_id: string;
|
|
123
|
+
metadata?: Record<string, unknown>;
|
|
124
|
+
} | null;
|
|
125
|
+
status: {
|
|
126
|
+
code: number;
|
|
127
|
+
message: string;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Discriminator for which Redux slice to apply the autofill to — setup pages
|
|
132
|
+
* (`spendManagement/commonSetup`) and onboarding (`onboardingView/customerView`)
|
|
133
|
+
* share the same field shapes but live in separate slices.
|
|
134
|
+
*/
|
|
135
|
+
export type KycKybAutofillTarget = 'setup' | 'onboarding';
|
|
136
|
+
/** Confidence floor below which we drop an autofill candidate. */
|
|
137
|
+
export declare const KYC_KYB_AUTOFILL_MIN_CONFIDENCE = 0.5;
|
|
138
|
+
/**
|
|
139
|
+
* Maps the form-side {@link KycSelectDocumentType} (camelCase) to the
|
|
140
|
+
* parser-side {@link KycProvidedDocumentType} (snake_case). Returns `null` for
|
|
141
|
+
* `stateId`, which has no parser today.
|
|
142
|
+
*/
|
|
143
|
+
export declare const toKycProvidedDocumentType: (selectType: KycSelectDocumentType) => KycProvidedDocumentType | null;
|
|
144
|
+
/**
|
|
145
|
+
* Maps a persisted {@link AllowedDocumentType} (snake_case — the value stored on
|
|
146
|
+
* an officer's `documentTypeSelectedForVerification`) to the parser-side
|
|
147
|
+
* {@link KycProvidedDocumentType}. Returns `null` for document types with no KYC
|
|
148
|
+
* parser today (e.g. `id_document` / state ID, and any non-identity doc).
|
|
149
|
+
*
|
|
150
|
+
* The officer's stored selection is an `AllowedDocumentType`, not a
|
|
151
|
+
* {@link KycSelectDocumentType}; use this — not {@link toKycProvidedDocumentType}
|
|
152
|
+
* — when triggering autofill off that field.
|
|
153
|
+
*/
|
|
154
|
+
export declare const toKycProvidedDocumentTypeFromAllowed: (allowedType: AllowedDocumentType) => KycProvidedDocumentType | null;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toKycProvidedDocumentTypeFromAllowed = exports.toKycProvidedDocumentType = exports.KYC_KYB_AUTOFILL_MIN_CONFIDENCE = void 0;
|
|
4
|
+
/** Confidence floor below which we drop an autofill candidate. */
|
|
5
|
+
exports.KYC_KYB_AUTOFILL_MIN_CONFIDENCE = 0.5;
|
|
6
|
+
/**
|
|
7
|
+
* Maps the form-side {@link KycSelectDocumentType} (camelCase) to the
|
|
8
|
+
* parser-side {@link KycProvidedDocumentType} (snake_case). Returns `null` for
|
|
9
|
+
* `stateId`, which has no parser today.
|
|
10
|
+
*/
|
|
11
|
+
const toKycProvidedDocumentType = (selectType) => {
|
|
12
|
+
switch (selectType) {
|
|
13
|
+
case 'driverLicense':
|
|
14
|
+
return 'driving_license';
|
|
15
|
+
case 'passport':
|
|
16
|
+
return 'passport';
|
|
17
|
+
case 'ssnCard':
|
|
18
|
+
return 'social_security_card';
|
|
19
|
+
case 'stateId':
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.toKycProvidedDocumentType = toKycProvidedDocumentType;
|
|
24
|
+
/**
|
|
25
|
+
* Maps a persisted {@link AllowedDocumentType} (snake_case — the value stored on
|
|
26
|
+
* an officer's `documentTypeSelectedForVerification`) to the parser-side
|
|
27
|
+
* {@link KycProvidedDocumentType}. Returns `null` for document types with no KYC
|
|
28
|
+
* parser today (e.g. `id_document` / state ID, and any non-identity doc).
|
|
29
|
+
*
|
|
30
|
+
* The officer's stored selection is an `AllowedDocumentType`, not a
|
|
31
|
+
* {@link KycSelectDocumentType}; use this — not {@link toKycProvidedDocumentType}
|
|
32
|
+
* — when triggering autofill off that field.
|
|
33
|
+
*/
|
|
34
|
+
const toKycProvidedDocumentTypeFromAllowed = (allowedType) => {
|
|
35
|
+
switch (allowedType) {
|
|
36
|
+
case 'passport':
|
|
37
|
+
return 'passport';
|
|
38
|
+
case 'driving_license':
|
|
39
|
+
return 'driving_license';
|
|
40
|
+
case 'social_security_card':
|
|
41
|
+
return 'social_security_card';
|
|
42
|
+
default:
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.toKycProvidedDocumentTypeFromAllowed = toKycProvidedDocumentTypeFromAllowed;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4-beta1ND",
|
|
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",
|