@zeniai/client-epic-state 5.0.64-beta3ND → 5.0.64-betaAR1
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/account/accountSelector.d.ts +20 -1
- package/lib/entity/account/accountSelector.js +35 -1
- package/lib/entity/account/accountState.d.ts +5 -0
- package/lib/entity/account/accountState.js +11 -4
- package/lib/entity/class/classSelector.d.ts +5 -0
- package/lib/entity/class/classSelector.js +8 -0
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/entity/account/accountSelector.js +33 -1
- package/lib/esm/entity/account/accountState.js +7 -1
- package/lib/esm/entity/class/classSelector.js +7 -0
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +14 -10
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +11 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +58 -8
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +186 -0
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +50 -61
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +52 -71
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +0 -2
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +2 -0
- package/lib/index.d.ts +11 -12
- package/lib/index.js +41 -44
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +5 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +12 -2
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +4 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +60 -8
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +65 -0
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +190 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -25
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +51 -62
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +0 -10
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -24
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +53 -72
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +0 -4
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +0 -2
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -12
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +2 -0
- package/package.json +3 -6
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -49
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -58
- package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -12
- package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -205
- package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -28
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +0 -8
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +0 -53
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +0 -8
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +0 -62
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +0 -27
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +0 -15
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +0 -24
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +0 -213
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +0 -125
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +0 -32
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.clearOnboardingCustomerView = exports.clearOnboardingCustomerViewDataInLocalStore = exports.verifyOnboardingOfficerOtpFailure = exports.verifyOnboardingOfficerOtpSuccess = exports.verifyOnboardingOfficerOtp = exports.resendOnboardingOfficerOtp = exports.sendOnboardingOfficerOtpFailure = exports.sendOnboardingOfficerOtpSuccess = exports.sendOnboardingOfficerOtp = exports.updateOnboardingCustomerViewUIState = exports.saveOnboardingCompnayOfficerPhoneInLocalStore = exports.saveOnboardingCustomerViewDataInLocalStore = exports.updateOnboardingCustomerViewLocalStoreData = exports.updateOnboardingCustomerViewAccountDetails = exports.updateCurrentStep = exports.getOnboardingPlaidLinkTokenFailure = exports.getOnboardingPlaidLinkTokenSuccess = exports.getOnboardingPlaidLinkToken = exports.establishOnboardingPlaidConnectionFailure = exports.establishOnboardingPlaidConnectionSuccess = exports.establishOnboardingPlaidConnection = exports.updateOnboardingPaymentAccountLoginStatusFailure = exports.updateOnboardingPaymentAccountLoginStatusSuccess = exports.updateOnboardingPaymentAccountLoginStatus = exports.updateOnboardingPaymentAccountStatusFailure = exports.updateOnboardingPaymentAccountStatusSuccess = exports.updateOnboardingPaymentAccountStatus = exports.updateOnboardingCustomerViewFailure = exports.updateOnboardingCustomerViewSuccess = exports.updateOnboardingCustomerView = exports.updateOnboardingCustomerViewDashboardLoadedFailure = exports.updateOnboardingCustomerViewDashboardLoadedSuccess = exports.updateOnboardingCustomerViewDashboardLoaded = exports.updateOnboardingCustomerViewCompleteStatusFailure = exports.updateOnboardingCustomerViewCompleteStatusSuccess = exports.updateOnboardingCustomerViewCompleteStatus = exports.fetchOnboardingCustomerSetupViewFailure = exports.fetchOnboardingCustomerSetupViewSuccess = exports.fetchOnboardingCustomerSetupView = exports.fetchOnboardingCustomerView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
7
7
|
const initialStatus = {
|
|
@@ -14,29 +14,60 @@ exports.initialState = {
|
|
|
14
14
|
dashboardLoadedStatus: initialStatus,
|
|
15
15
|
currentStep: 'link_payment_account',
|
|
16
16
|
companyDetails: {
|
|
17
|
-
autoFilledFields: [],
|
|
18
17
|
localData: undefined,
|
|
19
18
|
},
|
|
20
|
-
companyOfficerUpdateStatus:
|
|
21
|
-
|
|
22
|
-
autoFilledFields: [],
|
|
19
|
+
companyOfficerUpdateStatus: {
|
|
20
|
+
Officer_1: {
|
|
23
21
|
localData: undefined,
|
|
24
22
|
sendOtpStatus: initialStatus,
|
|
25
23
|
otpverificationStatus: initialStatus,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
},
|
|
25
|
+
Officer_2: {
|
|
26
|
+
localData: undefined,
|
|
27
|
+
sendOtpStatus: initialStatus,
|
|
28
|
+
otpverificationStatus: initialStatus,
|
|
29
|
+
},
|
|
30
|
+
Officer_3: {
|
|
31
|
+
localData: undefined,
|
|
32
|
+
sendOtpStatus: initialStatus,
|
|
33
|
+
otpverificationStatus: initialStatus,
|
|
34
|
+
},
|
|
35
|
+
Officer_4: {
|
|
36
|
+
localData: undefined,
|
|
37
|
+
sendOtpStatus: initialStatus,
|
|
38
|
+
otpverificationStatus: initialStatus,
|
|
39
|
+
},
|
|
40
|
+
Officer_5: {
|
|
41
|
+
localData: undefined,
|
|
42
|
+
sendOtpStatus: initialStatus,
|
|
43
|
+
otpverificationStatus: initialStatus,
|
|
44
|
+
},
|
|
45
|
+
Officer_6: {
|
|
46
|
+
localData: undefined,
|
|
47
|
+
sendOtpStatus: initialStatus,
|
|
48
|
+
otpverificationStatus: initialStatus,
|
|
49
|
+
},
|
|
50
|
+
Officer_7: {
|
|
51
|
+
localData: undefined,
|
|
52
|
+
sendOtpStatus: initialStatus,
|
|
53
|
+
otpverificationStatus: initialStatus,
|
|
54
|
+
},
|
|
55
|
+
Officer_8: {
|
|
56
|
+
localData: undefined,
|
|
57
|
+
sendOtpStatus: initialStatus,
|
|
58
|
+
otpverificationStatus: initialStatus,
|
|
59
|
+
},
|
|
60
|
+
Officer_9: {
|
|
61
|
+
localData: undefined,
|
|
62
|
+
sendOtpStatus: initialStatus,
|
|
63
|
+
otpverificationStatus: initialStatus,
|
|
64
|
+
},
|
|
65
|
+
Officer_10: {
|
|
66
|
+
localData: undefined,
|
|
67
|
+
sendOtpStatus: initialStatus,
|
|
68
|
+
otpverificationStatus: initialStatus,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
40
71
|
primaryContactDetails: {},
|
|
41
72
|
paymentAccountDetails: {
|
|
42
73
|
fetchStatus: initialStatus,
|
|
@@ -565,49 +596,7 @@ const onboardingCustomerView = (0, toolkit_1.createSlice)({
|
|
|
565
596
|
clearOnboardingCustomerView(draft) {
|
|
566
597
|
Object.assign(draft, exports.initialState);
|
|
567
598
|
},
|
|
568
|
-
/** Merge AI-parsed officer fields into the officer's onboarding localData. */
|
|
569
|
-
applyKycDocumentAutofillForOnboarding: {
|
|
570
|
-
reducer(draft, action) {
|
|
571
|
-
const { officerType, values, autoFilledFieldNames } = action.payload;
|
|
572
|
-
const slot = draft.companyOfficerUpdateStatus[officerType];
|
|
573
|
-
slot.localData = Object.assign({}, slot.localData, values);
|
|
574
|
-
slot.autoFilledFields = Array.from(new Set([...slot.autoFilledFields, ...autoFilledFieldNames]));
|
|
575
|
-
},
|
|
576
|
-
prepare(payload) {
|
|
577
|
-
return { payload };
|
|
578
|
-
},
|
|
579
|
-
},
|
|
580
|
-
/** Merge AI-parsed company fields into companyDetails onboarding localData. */
|
|
581
|
-
applyKybDocumentAutofillForOnboarding: {
|
|
582
|
-
reducer(draft, action) {
|
|
583
|
-
const { values, autoFilledFieldNames } = action.payload;
|
|
584
|
-
draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
|
|
585
|
-
const prev = draft.companyDetails.autoFilledFields ?? [];
|
|
586
|
-
draft.companyDetails.autoFilledFields = Array.from(new Set([...prev, ...autoFilledFieldNames]));
|
|
587
|
-
},
|
|
588
|
-
prepare(payload) {
|
|
589
|
-
return { payload };
|
|
590
|
-
},
|
|
591
|
-
},
|
|
592
|
-
/** Wipe AI-autofill badges during onboarding. */
|
|
593
|
-
clearKycKybAutofillForOnboarding: {
|
|
594
|
-
reducer(draft, action) {
|
|
595
|
-
const { officerType } = action.payload;
|
|
596
|
-
if (officerType != null) {
|
|
597
|
-
draft.companyOfficerUpdateStatus[officerType].autoFilledFields = [];
|
|
598
|
-
}
|
|
599
|
-
else {
|
|
600
|
-
draft.companyDetails.autoFilledFields = [];
|
|
601
|
-
Object.keys(draft.companyOfficerUpdateStatus).forEach((key) => {
|
|
602
|
-
draft.companyOfficerUpdateStatus[key].autoFilledFields = [];
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
},
|
|
606
|
-
prepare(payload = {}) {
|
|
607
|
-
return { payload };
|
|
608
|
-
},
|
|
609
|
-
},
|
|
610
599
|
},
|
|
611
600
|
});
|
|
612
|
-
_a = onboardingCustomerView.actions, exports.fetchOnboardingCustomerView = _a.fetchOnboardingCustomerView, exports.fetchOnboardingCustomerSetupView = _a.fetchOnboardingCustomerSetupView, exports.fetchOnboardingCustomerSetupViewSuccess = _a.fetchOnboardingCustomerSetupViewSuccess, exports.fetchOnboardingCustomerSetupViewFailure = _a.fetchOnboardingCustomerSetupViewFailure, exports.updateOnboardingCustomerViewCompleteStatus = _a.updateOnboardingCustomerViewCompleteStatus, exports.updateOnboardingCustomerViewCompleteStatusSuccess = _a.updateOnboardingCustomerViewCompleteStatusSuccess, exports.updateOnboardingCustomerViewCompleteStatusFailure = _a.updateOnboardingCustomerViewCompleteStatusFailure, exports.updateOnboardingCustomerViewDashboardLoaded = _a.updateOnboardingCustomerViewDashboardLoaded, exports.updateOnboardingCustomerViewDashboardLoadedSuccess = _a.updateOnboardingCustomerViewDashboardLoadedSuccess, exports.updateOnboardingCustomerViewDashboardLoadedFailure = _a.updateOnboardingCustomerViewDashboardLoadedFailure, exports.updateOnboardingCustomerView = _a.updateOnboardingCustomerView, exports.updateOnboardingCustomerViewSuccess = _a.updateOnboardingCustomerViewSuccess, exports.updateOnboardingCustomerViewFailure = _a.updateOnboardingCustomerViewFailure, exports.updateOnboardingPaymentAccountStatus = _a.updateOnboardingPaymentAccountStatus, exports.updateOnboardingPaymentAccountStatusSuccess = _a.updateOnboardingPaymentAccountStatusSuccess, exports.updateOnboardingPaymentAccountStatusFailure = _a.updateOnboardingPaymentAccountStatusFailure, exports.updateOnboardingPaymentAccountLoginStatus = _a.updateOnboardingPaymentAccountLoginStatus, exports.updateOnboardingPaymentAccountLoginStatusSuccess = _a.updateOnboardingPaymentAccountLoginStatusSuccess, exports.updateOnboardingPaymentAccountLoginStatusFailure = _a.updateOnboardingPaymentAccountLoginStatusFailure, exports.establishOnboardingPlaidConnection = _a.establishOnboardingPlaidConnection, exports.establishOnboardingPlaidConnectionSuccess = _a.establishOnboardingPlaidConnectionSuccess, exports.establishOnboardingPlaidConnectionFailure = _a.establishOnboardingPlaidConnectionFailure, exports.getOnboardingPlaidLinkToken = _a.getOnboardingPlaidLinkToken, exports.getOnboardingPlaidLinkTokenSuccess = _a.getOnboardingPlaidLinkTokenSuccess, exports.getOnboardingPlaidLinkTokenFailure = _a.getOnboardingPlaidLinkTokenFailure, exports.updateCurrentStep = _a.updateCurrentStep, exports.updateOnboardingCustomerViewAccountDetails = _a.updateOnboardingCustomerViewAccountDetails, exports.updateOnboardingCustomerViewLocalStoreData = _a.updateOnboardingCustomerViewLocalStoreData, exports.saveOnboardingCustomerViewDataInLocalStore = _a.saveOnboardingCustomerViewDataInLocalStore, exports.saveOnboardingCompnayOfficerPhoneInLocalStore = _a.saveOnboardingCompnayOfficerPhoneInLocalStore, exports.updateOnboardingCustomerViewUIState = _a.updateOnboardingCustomerViewUIState, exports.sendOnboardingOfficerOtp = _a.sendOnboardingOfficerOtp, exports.sendOnboardingOfficerOtpSuccess = _a.sendOnboardingOfficerOtpSuccess, exports.sendOnboardingOfficerOtpFailure = _a.sendOnboardingOfficerOtpFailure, exports.resendOnboardingOfficerOtp = _a.resendOnboardingOfficerOtp, exports.verifyOnboardingOfficerOtp = _a.verifyOnboardingOfficerOtp, exports.verifyOnboardingOfficerOtpSuccess = _a.verifyOnboardingOfficerOtpSuccess, exports.verifyOnboardingOfficerOtpFailure = _a.verifyOnboardingOfficerOtpFailure, exports.clearOnboardingCustomerViewDataInLocalStore = _a.clearOnboardingCustomerViewDataInLocalStore, exports.clearOnboardingCustomerView = _a.clearOnboardingCustomerView
|
|
601
|
+
_a = onboardingCustomerView.actions, exports.fetchOnboardingCustomerView = _a.fetchOnboardingCustomerView, exports.fetchOnboardingCustomerSetupView = _a.fetchOnboardingCustomerSetupView, exports.fetchOnboardingCustomerSetupViewSuccess = _a.fetchOnboardingCustomerSetupViewSuccess, exports.fetchOnboardingCustomerSetupViewFailure = _a.fetchOnboardingCustomerSetupViewFailure, exports.updateOnboardingCustomerViewCompleteStatus = _a.updateOnboardingCustomerViewCompleteStatus, exports.updateOnboardingCustomerViewCompleteStatusSuccess = _a.updateOnboardingCustomerViewCompleteStatusSuccess, exports.updateOnboardingCustomerViewCompleteStatusFailure = _a.updateOnboardingCustomerViewCompleteStatusFailure, exports.updateOnboardingCustomerViewDashboardLoaded = _a.updateOnboardingCustomerViewDashboardLoaded, exports.updateOnboardingCustomerViewDashboardLoadedSuccess = _a.updateOnboardingCustomerViewDashboardLoadedSuccess, exports.updateOnboardingCustomerViewDashboardLoadedFailure = _a.updateOnboardingCustomerViewDashboardLoadedFailure, exports.updateOnboardingCustomerView = _a.updateOnboardingCustomerView, exports.updateOnboardingCustomerViewSuccess = _a.updateOnboardingCustomerViewSuccess, exports.updateOnboardingCustomerViewFailure = _a.updateOnboardingCustomerViewFailure, exports.updateOnboardingPaymentAccountStatus = _a.updateOnboardingPaymentAccountStatus, exports.updateOnboardingPaymentAccountStatusSuccess = _a.updateOnboardingPaymentAccountStatusSuccess, exports.updateOnboardingPaymentAccountStatusFailure = _a.updateOnboardingPaymentAccountStatusFailure, exports.updateOnboardingPaymentAccountLoginStatus = _a.updateOnboardingPaymentAccountLoginStatus, exports.updateOnboardingPaymentAccountLoginStatusSuccess = _a.updateOnboardingPaymentAccountLoginStatusSuccess, exports.updateOnboardingPaymentAccountLoginStatusFailure = _a.updateOnboardingPaymentAccountLoginStatusFailure, exports.establishOnboardingPlaidConnection = _a.establishOnboardingPlaidConnection, exports.establishOnboardingPlaidConnectionSuccess = _a.establishOnboardingPlaidConnectionSuccess, exports.establishOnboardingPlaidConnectionFailure = _a.establishOnboardingPlaidConnectionFailure, exports.getOnboardingPlaidLinkToken = _a.getOnboardingPlaidLinkToken, exports.getOnboardingPlaidLinkTokenSuccess = _a.getOnboardingPlaidLinkTokenSuccess, exports.getOnboardingPlaidLinkTokenFailure = _a.getOnboardingPlaidLinkTokenFailure, exports.updateCurrentStep = _a.updateCurrentStep, exports.updateOnboardingCustomerViewAccountDetails = _a.updateOnboardingCustomerViewAccountDetails, exports.updateOnboardingCustomerViewLocalStoreData = _a.updateOnboardingCustomerViewLocalStoreData, exports.saveOnboardingCustomerViewDataInLocalStore = _a.saveOnboardingCustomerViewDataInLocalStore, exports.saveOnboardingCompnayOfficerPhoneInLocalStore = _a.saveOnboardingCompnayOfficerPhoneInLocalStore, exports.updateOnboardingCustomerViewUIState = _a.updateOnboardingCustomerViewUIState, exports.sendOnboardingOfficerOtp = _a.sendOnboardingOfficerOtp, exports.sendOnboardingOfficerOtpSuccess = _a.sendOnboardingOfficerOtpSuccess, exports.sendOnboardingOfficerOtpFailure = _a.sendOnboardingOfficerOtpFailure, exports.resendOnboardingOfficerOtp = _a.resendOnboardingOfficerOtp, exports.verifyOnboardingOfficerOtp = _a.verifyOnboardingOfficerOtp, exports.verifyOnboardingOfficerOtpSuccess = _a.verifyOnboardingOfficerOtpSuccess, exports.verifyOnboardingOfficerOtpFailure = _a.verifyOnboardingOfficerOtpFailure, exports.clearOnboardingCustomerViewDataInLocalStore = _a.clearOnboardingCustomerViewDataInLocalStore, exports.clearOnboardingCustomerView = _a.clearOnboardingCustomerView;
|
|
613
602
|
exports.default = onboardingCustomerView.reducer;
|
|
@@ -22,19 +22,9 @@ export interface OnboardingCustomerViewUIState {
|
|
|
22
22
|
}
|
|
23
23
|
export interface OnboardingCustomerViewState extends FetchedState {
|
|
24
24
|
companyDetails: {
|
|
25
|
-
/**
|
|
26
|
-
* Field names from {@link CompanyDetailsLocalData} populated by AI autofill
|
|
27
|
-
* from an uploaded KYB document during onboarding. Drives the ✦ sparkle.
|
|
28
|
-
*/
|
|
29
|
-
autoFilledFields: string[];
|
|
30
25
|
localData?: CompanyDetailsLocalData;
|
|
31
26
|
};
|
|
32
27
|
companyOfficerUpdateStatus: Record<CompanyOfficerType, {
|
|
33
|
-
/**
|
|
34
|
-
* Field names from {@link CompanyOfficerLocalData} populated by AI autofill
|
|
35
|
-
* from an uploaded KYC identity document during onboarding.
|
|
36
|
-
*/
|
|
37
|
-
autoFilledFields: string[];
|
|
38
28
|
otpverificationStatus: FetchStateAndError;
|
|
39
29
|
sendOtpStatus: FetchStateAndError;
|
|
40
30
|
localData?: CompanyOfficerLocalData;
|
|
@@ -2,7 +2,7 @@ import { ID } from '../../../commonStateTypes/common';
|
|
|
2
2
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
3
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
4
4
|
import { CompanyOfficerType } from '../../companyView/types/companyPassport/companyUsersLocalData';
|
|
5
|
-
import { CompanyDetailsLocalData,
|
|
5
|
+
import { CompanyDetailsLocalData, SetupViewLocalData, SetupViewState } from './setupViewState';
|
|
6
6
|
export declare const initialState: SetupViewState;
|
|
7
7
|
export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "zeni_treasury" | "charge_cards" | "other_connection" | "billing" | "debit_cards" | "charge_cards__debit_cards"], {
|
|
8
8
|
companyId: string;
|
|
@@ -29,28 +29,6 @@ export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPr
|
|
|
29
29
|
}, "setupView/sendOtpSuccess">, sendOtpFailureSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "setupView/sendOtpFailure">, verifyOtpSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/verifyOtp">, verifyOtpSuccessSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/verifyOtpSuccess">, verifyOtpFailureSpendManagementSetUp: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "setupView/verifyOtpFailure">, saveIndustryAndIncDateInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
30
|
incDate: ZeniDate;
|
|
31
31
|
industry: string;
|
|
32
|
-
}, "setupView/saveIndustryAndIncDateInLocalStore">, clearSetupViewDataInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupViewDataInLocalStore">, clearSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupView"
|
|
33
|
-
autoFilledFieldNames: string[];
|
|
34
|
-
companyId: ID;
|
|
35
|
-
officerType: CompanyOfficerType;
|
|
36
|
-
values: Partial<CompanyOfficerLocalData>;
|
|
37
|
-
}], {
|
|
38
|
-
autoFilledFieldNames: string[];
|
|
39
|
-
companyId: ID;
|
|
40
|
-
officerType: CompanyOfficerType;
|
|
41
|
-
values: Partial<CompanyOfficerLocalData>;
|
|
42
|
-
}, "setupView/applyKycDocumentAutofillForSetup", never, never>, applyKybDocumentAutofillForSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
|
|
43
|
-
autoFilledFieldNames: string[];
|
|
44
|
-
companyId: ID;
|
|
45
|
-
values: Partial<CompanyDetailsLocalData>;
|
|
46
|
-
}], {
|
|
47
|
-
autoFilledFieldNames: string[];
|
|
48
|
-
companyId: ID;
|
|
49
|
-
values: Partial<CompanyDetailsLocalData>;
|
|
50
|
-
}, "setupView/applyKybDocumentAutofillForSetup", never, never>, clearKycKybAutofillForSetup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload?: {
|
|
51
|
-
officerType?: CompanyOfficerType;
|
|
52
|
-
} | undefined], {
|
|
53
|
-
officerType?: CompanyOfficerType;
|
|
54
|
-
}, "setupView/clearKycKybAutofillForSetup", never, never>;
|
|
32
|
+
}, "setupView/saveIndustryAndIncDateInLocalStore">, clearSetupViewDataInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupViewDataInLocalStore">, clearSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/clearSetupView">;
|
|
55
33
|
declare const _default: import("redux").Reducer<SetupViewState>;
|
|
56
34
|
export default _default;
|
|
@@ -1,32 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
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;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const initialFetchStatus = {
|
|
7
7
|
fetchState: 'Not-Started',
|
|
8
8
|
error: undefined,
|
|
9
9
|
};
|
|
10
|
-
const emptyOfficerSlot = {
|
|
11
|
-
autoFilledFields: [],
|
|
12
|
-
localData: undefined,
|
|
13
|
-
sendOtpStatus: initialFetchStatus,
|
|
14
|
-
otpverificationStatus: initialFetchStatus,
|
|
15
|
-
};
|
|
16
10
|
exports.initialState = {
|
|
17
11
|
updateStatus: { fetchState: 'Not-Started', error: undefined },
|
|
18
|
-
companyDetails: {
|
|
12
|
+
companyDetails: {},
|
|
19
13
|
companyOfficerUpdateStatus: {
|
|
20
|
-
Officer_1: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
Officer_1: {
|
|
15
|
+
localData: undefined,
|
|
16
|
+
sendOtpStatus: initialFetchStatus,
|
|
17
|
+
otpverificationStatus: initialFetchStatus,
|
|
18
|
+
},
|
|
19
|
+
Officer_2: {
|
|
20
|
+
localData: undefined,
|
|
21
|
+
sendOtpStatus: initialFetchStatus,
|
|
22
|
+
otpverificationStatus: initialFetchStatus,
|
|
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
|
+
},
|
|
30
64
|
},
|
|
31
65
|
primaryContactDetails: {},
|
|
32
66
|
};
|
|
@@ -267,60 +301,7 @@ const setupView = (0, toolkit_1.createSlice)({
|
|
|
267
301
|
clearSetupView(draft) {
|
|
268
302
|
Object.assign(draft, exports.initialState);
|
|
269
303
|
},
|
|
270
|
-
/**
|
|
271
|
-
* Merge AI-parsed officer fields into the selected officer's localData and
|
|
272
|
-
* track which field names were autofilled so the form can show the ✦ badge.
|
|
273
|
-
*/
|
|
274
|
-
applyKycDocumentAutofillForSetup: {
|
|
275
|
-
reducer(draft, action) {
|
|
276
|
-
const { officerType, values, autoFilledFieldNames } = action.payload;
|
|
277
|
-
const slot = draft.companyOfficerUpdateStatus[officerType];
|
|
278
|
-
slot.localData = Object.assign({}, slot.localData, values);
|
|
279
|
-
slot.autoFilledFields = Array.from(new Set([...slot.autoFilledFields, ...autoFilledFieldNames]));
|
|
280
|
-
},
|
|
281
|
-
prepare(payload) {
|
|
282
|
-
return { payload };
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
/**
|
|
286
|
-
* Merge AI-parsed company fields into companyDetails.localData and track
|
|
287
|
-
* which field names were autofilled.
|
|
288
|
-
*/
|
|
289
|
-
applyKybDocumentAutofillForSetup: {
|
|
290
|
-
reducer(draft, action) {
|
|
291
|
-
const { values, autoFilledFieldNames } = action.payload;
|
|
292
|
-
draft.companyDetails.localData = Object.assign({}, draft.companyDetails.localData, values);
|
|
293
|
-
draft.companyDetails.autoFilledFields = Array.from(new Set([
|
|
294
|
-
...draft.companyDetails.autoFilledFields,
|
|
295
|
-
...autoFilledFieldNames,
|
|
296
|
-
]));
|
|
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
304
|
},
|
|
324
305
|
});
|
|
325
|
-
_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
|
|
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;
|
|
326
307
|
exports.default = setupView.reducer;
|
|
@@ -54,8 +54,6 @@ 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[];
|
|
59
57
|
deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
|
|
60
58
|
otpverificationStatus: FetchStateAndError;
|
|
61
59
|
sendOtpStatus: FetchStateAndError;
|
|
@@ -64,8 +62,6 @@ export interface CompanyOfficersDetails extends CompanyOfficerLocalData {
|
|
|
64
62
|
addressStatus?: NewAddressData;
|
|
65
63
|
}
|
|
66
64
|
export interface CompanyDetails {
|
|
67
|
-
/** Field names in companyDetails localData populated by AI doc autofill. */
|
|
68
|
-
autoFilledFields: string[];
|
|
69
65
|
companyFiles: File[];
|
|
70
66
|
companyId: ID;
|
|
71
67
|
deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
|
|
@@ -124,7 +124,6 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
124
124
|
const companyAddress = addressViewState.newAddressState?.company_address;
|
|
125
125
|
const registeredCompanyAddress = addressViewState.newAddressState?.company_registered_address;
|
|
126
126
|
companyDetailsLocalData = {
|
|
127
|
-
autoFilledFields: companyDetails.autoFilledFields,
|
|
128
127
|
companyId,
|
|
129
128
|
companyDescription,
|
|
130
129
|
companyLegalName,
|
|
@@ -197,7 +196,6 @@ const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentityDetail
|
|
|
197
196
|
const companyOfficerAddress = addressViewState.newAddressState?.[addressType];
|
|
198
197
|
companyOfficerLocalData[officerType] = {
|
|
199
198
|
...companyOfficer.localData,
|
|
200
|
-
autoFilledFields: companyOfficer.autoFilledFields,
|
|
201
199
|
userFiles: (0, fileSelector_1.getFilesByFileIds)(fileState, fileIds),
|
|
202
200
|
additionalFiles: (0, fileSelector_1.getFilesByFileIds)(fileState, additionalSubmittedDocumentsForVerificationFileIds),
|
|
203
201
|
deleteFileStatusById,
|
|
@@ -81,21 +81,9 @@ 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[];
|
|
90
84
|
localData?: CompanyDetailsLocalData;
|
|
91
85
|
};
|
|
92
86
|
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[];
|
|
99
87
|
otpverificationStatus: FetchStateAndError;
|
|
100
88
|
sendOtpStatus: FetchStateAndError;
|
|
101
89
|
localData?: CompanyOfficerLocalData;
|
|
@@ -14,6 +14,8 @@ const helpers_1 = require("./helpers");
|
|
|
14
14
|
const remiListSelector_1 = require("./reimbursement/remiListView/remiListSelector");
|
|
15
15
|
const remiListState_1 = require("./reimbursement/remiListView/remiListState");
|
|
16
16
|
//filters items against filter values representing a range. ex: date (from-to), amount(1k<-->5k)
|
|
17
|
+
// Spend Management uses only equal/not-equal — TC amount operators
|
|
18
|
+
// (inBetween, lessThan, greaterThan) live in the TC filter pipeline.
|
|
17
19
|
const filterItemOnRangeCategoryType = (valueForItem, currentFilter) => {
|
|
18
20
|
let doesItemFallInValueRange = false;
|
|
19
21
|
const filterField = currentFilter.field;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.64-
|
|
3
|
+
"version": "5.0.64-betaAR1",
|
|
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",
|
|
@@ -106,15 +106,12 @@
|
|
|
106
106
|
"scripts": {
|
|
107
107
|
"clean": "rimraf lib",
|
|
108
108
|
"test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
|
|
109
|
-
"test": "pnpm
|
|
109
|
+
"test": "pnpm test:typecheck && vitest run --typecheck",
|
|
110
110
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
|
111
|
-
"lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
|
|
112
|
-
"tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
|
|
113
|
-
"typecheck": "tsc --noEmit",
|
|
114
111
|
"find-dead-code": "ts-prune | grep -v '(used in module)'",
|
|
115
112
|
"find-unused-exports": "ts-unused-exports ./tsconfig.json",
|
|
116
113
|
"circular-dependency": "npx madge --circular --extensions ts ./src",
|
|
117
|
-
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint
|
|
114
|
+
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
118
115
|
"only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
119
116
|
"only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
120
117
|
"format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { isSuccessResponse } from '../../../../../responsePayload';
|
|
4
|
-
import { applyKybDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
|
|
5
|
-
import { parseUploadedKybDocument } from '../../kycKybAutofillActions';
|
|
6
|
-
import { mapCoiToCompanyDetails, mapTaxEinToCompanyDetails, } from '../../kycKybParseMapper';
|
|
7
|
-
import { applyKybDocumentAutofillForSetup } from '../../setupViewReducer';
|
|
8
|
-
const PROCESS_DOCUMENT_SYNC_PATH = '/1.0/documents/process/sync';
|
|
9
|
-
export const parseUploadedKybDocumentEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(parseUploadedKybDocument.match), mergeMap((action) => {
|
|
10
|
-
const { target, companyId, fileId, documentType } = action.payload;
|
|
11
|
-
const url = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}${PROCESS_DOCUMENT_SYNC_PATH}`;
|
|
12
|
-
const requestPayload = {
|
|
13
|
-
provided_document_type: documentType,
|
|
14
|
-
files: [{ file_id: fileId }],
|
|
15
|
-
processing_priority: 10,
|
|
16
|
-
metadata: { source: 'kyc_kyb_autofill' },
|
|
17
|
-
};
|
|
18
|
-
return zeniAPI
|
|
19
|
-
.postAndGetJSON(url, requestPayload)
|
|
20
|
-
.pipe(mergeMap((response) => {
|
|
21
|
-
if (!isSuccessResponse(response) || response.data == null) {
|
|
22
|
-
return of();
|
|
23
|
-
}
|
|
24
|
-
let result;
|
|
25
|
-
switch (documentType) {
|
|
26
|
-
case 'certificate_of_incorporation':
|
|
27
|
-
result = mapCoiToCompanyDetails(response.data);
|
|
28
|
-
break;
|
|
29
|
-
case 'tax_ein':
|
|
30
|
-
result = mapTaxEinToCompanyDetails(response.data);
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
if (result.autoFilledFieldNames.length === 0) {
|
|
34
|
-
return of();
|
|
35
|
-
}
|
|
36
|
-
const applyAction = target === 'setup'
|
|
37
|
-
? applyKybDocumentAutofillForSetup({
|
|
38
|
-
companyId,
|
|
39
|
-
values: result.values,
|
|
40
|
-
autoFilledFieldNames: result.autoFilledFieldNames,
|
|
41
|
-
})
|
|
42
|
-
: applyKybDocumentAutofillForOnboarding({
|
|
43
|
-
companyId,
|
|
44
|
-
values: result.values,
|
|
45
|
-
autoFilledFieldNames: result.autoFilledFieldNames,
|
|
46
|
-
});
|
|
47
|
-
return of(applyAction);
|
|
48
|
-
}), catchError(() => of()));
|
|
49
|
-
}));
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { getCountryList } from '../../../../../entity/countryList/countryListSelector';
|
|
4
|
-
import { isSuccessResponse } from '../../../../../responsePayload';
|
|
5
|
-
import { applyKycDocumentAutofillForOnboarding } from '../../../../onboardingView/customerView/onboardingCustomerViewReducer';
|
|
6
|
-
import { parseUploadedKycDocument } from '../../kycKybAutofillActions';
|
|
7
|
-
import { mapDrivingLicenseToOfficer, mapPassportToOfficer, mapSsnCardToOfficer, } from '../../kycKybParseMapper';
|
|
8
|
-
import { applyKycDocumentAutofillForSetup } from '../../setupViewReducer';
|
|
9
|
-
const PROCESS_DOCUMENT_SYNC_PATH = '/1.0/documents/process/sync';
|
|
10
|
-
export const parseUploadedKycDocumentEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(parseUploadedKycDocument.match), mergeMap((action) => {
|
|
11
|
-
const { target, companyId, officerType, fileId, documentType } = action.payload;
|
|
12
|
-
const url = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}${PROCESS_DOCUMENT_SYNC_PATH}`;
|
|
13
|
-
const requestPayload = {
|
|
14
|
-
provided_document_type: documentType,
|
|
15
|
-
files: [{ file_id: fileId }],
|
|
16
|
-
processing_priority: 10,
|
|
17
|
-
metadata: { source: 'kyc_kyb_autofill' },
|
|
18
|
-
};
|
|
19
|
-
return zeniAPI
|
|
20
|
-
.postAndGetJSON(url, requestPayload)
|
|
21
|
-
.pipe(mergeMap((response) => {
|
|
22
|
-
if (!isSuccessResponse(response) || response.data == null) {
|
|
23
|
-
return of();
|
|
24
|
-
}
|
|
25
|
-
const allCountries = getCountryList(state$.value.countryListState, 'nationalityCountryList').countries;
|
|
26
|
-
let result;
|
|
27
|
-
switch (documentType) {
|
|
28
|
-
case 'passport':
|
|
29
|
-
result = mapPassportToOfficer(response.data, allCountries);
|
|
30
|
-
break;
|
|
31
|
-
case 'driving_license':
|
|
32
|
-
result = mapDrivingLicenseToOfficer(response.data);
|
|
33
|
-
break;
|
|
34
|
-
case 'social_security_card':
|
|
35
|
-
result = mapSsnCardToOfficer(response.data);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
if (result.autoFilledFieldNames.length === 0) {
|
|
39
|
-
return of();
|
|
40
|
-
}
|
|
41
|
-
const applyAction = target === 'setup'
|
|
42
|
-
? applyKycDocumentAutofillForSetup({
|
|
43
|
-
companyId,
|
|
44
|
-
officerType,
|
|
45
|
-
values: result.values,
|
|
46
|
-
autoFilledFieldNames: result.autoFilledFieldNames,
|
|
47
|
-
})
|
|
48
|
-
: applyKycDocumentAutofillForOnboarding({
|
|
49
|
-
companyId,
|
|
50
|
-
officerType,
|
|
51
|
-
values: result.values,
|
|
52
|
-
autoFilledFieldNames: result.autoFilledFieldNames,
|
|
53
|
-
});
|
|
54
|
-
return of(applyAction);
|
|
55
|
-
}), catchError(() =>
|
|
56
|
-
// Autofill is best-effort; swallow errors silently so the user can keep typing.
|
|
57
|
-
of()));
|
|
58
|
-
}));
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Trigger actions for the KYC / KYB autofill epics.
|
|
3
|
-
*
|
|
4
|
-
* These actions don't mutate state — the epic listens for them, calls
|
|
5
|
-
* document-communication-agent's sync endpoint, and dispatches the appropriate
|
|
6
|
-
* `applyKyc/KybDocumentAutofillFor{Setup,Onboarding}` against the matching
|
|
7
|
-
* slice. Co-located with the rest of the commonSetup module because the entire
|
|
8
|
-
* autofill flow is auxiliary to the setup view; there is no separate state.
|
|
9
|
-
*/
|
|
10
|
-
import { createAction } from '@reduxjs/toolkit';
|
|
11
|
-
export const parseUploadedKycDocument = createAction('commonSetup/parseUploadedKycDocument');
|
|
12
|
-
export const parseUploadedKybDocument = createAction('commonSetup/parseUploadedKybDocument');
|