@zeniai/client-epic-state 5.1.68-beta0GS → 5.1.68-beta0RR
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/commonPayloadTypes/commonPayload.d.ts +25 -4
- package/lib/entity/tenant/clearAllEpic.d.ts +1 -2
- package/lib/entity/tenant/clearAllEpic.js +0 -2
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -2
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +8 -6
- package/lib/esm/reducer.js +0 -3
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +7 -3
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +56 -34
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +164 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +45 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +105 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +55 -8
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +23 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +39 -15
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +189 -0
- package/lib/index.d.ts +10 -9
- package/lib/index.js +63 -53
- package/lib/reducer.d.ts +0 -3
- package/lib/reducer.js +0 -3
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +6 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +55 -33
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +4 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +168 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +43 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +48 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +29 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +115 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +24 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +59 -9
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +22 -6
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +39 -15
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +20 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +32 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +194 -0
- package/package.json +1 -1
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js +0 -21
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRulesEpic.js +0 -20
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesPayload.js +0 -1
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesReducer.js +0 -76
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesSelector.js +0 -9
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesState.js +0 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.d.ts +0 -7
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js +0 -25
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRulesEpic.d.ts +0 -6
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRulesEpic.js +0 -24
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesPayload.d.ts +0 -29
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesPayload.js +0 -2
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesReducer.d.ts +0 -16
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesReducer.js +0 -80
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesSelector.d.ts +0 -12
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesSelector.js +0 -12
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesState.d.ts +0 -8
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesState.js +0 -2
|
@@ -2,6 +2,6 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../../reducer';
|
|
4
4
|
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
5
|
-
import { fetchInternationalVerificationForm,
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchInternationalVerificationForm> | ReturnType<typeof updateInternationalVerificationForm> | ReturnType<typeof updateVerificationFormFailure> | ReturnType<typeof
|
|
7
|
-
export declare const fetchIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>,
|
|
5
|
+
import { fetchInternationalVerificationForm, updateInternationalVerificationForm, updateVerificationFormFailure, updateVerificationFormLocalData } from '../internationalWireVerificationReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchInternationalVerificationForm> | ReturnType<typeof updateInternationalVerificationForm> | ReturnType<typeof updateVerificationFormFailure> | ReturnType<typeof updateVerificationFormLocalData>;
|
|
7
|
+
export declare const fetchIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,8 +4,9 @@ exports.fetchIntlVerificationFormEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
7
|
+
const internationalWireOnboardingDetailsToLocalData_1 = require("../internationalWireOnboardingDetailsToLocalData");
|
|
7
8
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
8
|
-
const fetchIntlVerificationFormEpic = (actions$,
|
|
9
|
+
const fetchIntlVerificationFormEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.fetchInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
|
|
9
10
|
const query = {
|
|
10
11
|
region: 'US',
|
|
11
12
|
legal_type: 'BUSINESS',
|
|
@@ -14,11 +15,14 @@ const fetchIntlVerificationFormEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
14
15
|
.getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding-fields?query=${encodeURIComponent(JSON.stringify(query))}`)
|
|
15
16
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
17
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
|
+
const onboardingDataFromCompanyInfo = state$.value.companyState.companiesById[action.payload.companyId]
|
|
19
|
+
?.companyBillPayInfo?.internationalWireOnboardingDetails;
|
|
20
|
+
const localData = (0, internationalWireOnboardingDetailsToLocalData_1.toVerificationFormLocalDataFromOnboardingDetails)(onboardingDataFromCompanyInfo, response.data.labels);
|
|
17
21
|
return (0, rxjs_1.from)([
|
|
18
22
|
(0, internationalWireVerificationReducer_1.updateInternationalVerificationForm)({
|
|
19
23
|
internationalWireFormPayload: response.data.labels,
|
|
20
24
|
}),
|
|
21
|
-
(0, internationalWireVerificationReducer_1.
|
|
25
|
+
(0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)(localData),
|
|
22
26
|
]);
|
|
23
27
|
}
|
|
24
28
|
else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../../../reducer';
|
|
4
|
+
import { fetchBillPaySetupViewSuccess } from '../../billPaySetupView/billPaySetupViewReducer';
|
|
4
5
|
import { initializeIntlVerificationForm, updateVerificationFormLocalData } from '../internationalWireVerificationReducer';
|
|
5
6
|
export type ActionType = ReturnType<typeof updateVerificationFormLocalData> | ReturnType<typeof initializeIntlVerificationForm>;
|
|
6
|
-
export declare const initializeIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType
|
|
7
|
+
export declare const initializeIntlVerificationFormEpic: (actions$: ActionsObservable<ActionType | ReturnType<typeof fetchBillPaySetupViewSuccess>>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -3,41 +3,63 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initializeIntlVerificationFormEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
|
|
7
|
+
const billPaySetupViewReducer_1 = require("../../billPaySetupView/billPaySetupViewReducer");
|
|
8
|
+
const internationalWireVerificationFieldConstants_1 = require("../internationalWireVerificationFieldConstants");
|
|
9
|
+
const internationalWireOnboardingDetailsToLocalData_1 = require("../internationalWireOnboardingDetailsToLocalData");
|
|
6
10
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
const hasSavedPersonSubfieldData = (localData) =>
|
|
12
|
+
// Person subfield keys follow `<field_name>_<index?>_<subfield>`
|
|
13
|
+
// e.g. `stake_holder_0_email`, `controlling_person_email`.
|
|
14
|
+
Object.keys(localData).some((key) => new RegExp(`^${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_\\d+_`).test(key) ||
|
|
15
|
+
key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson}_`));
|
|
16
|
+
const getPersonScopedLocalData = (localData) => Object.fromEntries(Object.entries(localData).filter(([key]) => {
|
|
17
|
+
if (key === internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder ||
|
|
18
|
+
key ===
|
|
19
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return (key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`) ||
|
|
23
|
+
key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson}_`));
|
|
24
|
+
}));
|
|
25
|
+
const initializeIntlVerificationFormEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)((action) => internationalWireVerificationReducer_1.initializeIntlVerificationForm.match(action) ||
|
|
26
|
+
billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess.match(action)), (0, operators_1.mergeMap)((action) => {
|
|
10
27
|
const state = state$.value;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
internationalWireFormPayload[formFieldKey].type === 'enum' &&
|
|
34
|
-
internationalWireFormPayload[formFieldKey]
|
|
35
|
-
.is_multiple_values_allowed === true
|
|
36
|
-
? []
|
|
37
|
-
: '';
|
|
28
|
+
const formFieldLabelsFromState = state.internationalWireVerificationState.verificationFormFieldLabels;
|
|
29
|
+
const formFieldLabels = internationalWireVerificationReducer_1.initializeIntlVerificationForm.match(action) &&
|
|
30
|
+
Object.keys(formFieldLabelsFromState).length === 0
|
|
31
|
+
? action.payload.internationalWireFormPayload
|
|
32
|
+
: formFieldLabelsFromState;
|
|
33
|
+
if (Object.keys(formFieldLabels).length === 0) {
|
|
34
|
+
return rxjs_1.EMPTY;
|
|
35
|
+
}
|
|
36
|
+
const companyId = internationalWireVerificationReducer_1.initializeIntlVerificationForm.match(action) ?
|
|
37
|
+
action.payload.companyId
|
|
38
|
+
: (0, tenantSelector_1.getCurrentTenant)(state)?.companyId;
|
|
39
|
+
if (companyId == null) {
|
|
40
|
+
return rxjs_1.EMPTY;
|
|
41
|
+
}
|
|
42
|
+
const onboardingDataFromCompanyInfo = state.companyState.companiesById[companyId]?.companyBillPayInfo
|
|
43
|
+
?.internationalWireOnboardingDetails;
|
|
44
|
+
const localDataFromCompany = (0, internationalWireOnboardingDetailsToLocalData_1.toVerificationFormLocalDataFromOnboardingDetails)(onboardingDataFromCompanyInfo, formFieldLabels);
|
|
45
|
+
const existingLocalData = state.internationalWireVerificationState.verificationFormLocalData;
|
|
46
|
+
if (billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess.match(action)) {
|
|
47
|
+
if (!hasSavedPersonSubfieldData(localDataFromCompany) ||
|
|
48
|
+
hasSavedPersonSubfieldData(existingLocalData)) {
|
|
49
|
+
return rxjs_1.EMPTY;
|
|
38
50
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
return (0, rxjs_1.from)([
|
|
52
|
+
(0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)({
|
|
53
|
+
...existingLocalData,
|
|
54
|
+
...getPersonScopedLocalData(localDataFromCompany),
|
|
55
|
+
}),
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
return (0, rxjs_1.from)([
|
|
59
|
+
(0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)({
|
|
60
|
+
...existingLocalData,
|
|
61
|
+
...localDataFromCompany,
|
|
62
|
+
}),
|
|
63
|
+
]);
|
|
42
64
|
}));
|
|
43
65
|
exports.initializeIntlVerificationFormEpic = initializeIntlVerificationFormEpic;
|
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const companyReducer_1 = require("../../../../../entity/company/companyReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
+
const internationalWireVerificationSubmitPayload_1 = require("../internationalWireVerificationSubmitPayload");
|
|
9
10
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
10
11
|
const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.submitInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
|
|
11
12
|
const { internationalWireVerificationState } = state$.value;
|
|
@@ -13,7 +14,7 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
13
14
|
const localData = internationalWireVerificationState.verificationFormLocalData;
|
|
14
15
|
if (localData != null) {
|
|
15
16
|
return zeniAPI
|
|
16
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`,
|
|
17
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, (0, internationalWireVerificationSubmitPayload_1.toIntlWireVerificationSubmitPayload)(localData))
|
|
17
18
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
19
|
const actions = [];
|
|
19
20
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
@@ -58,9 +59,3 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
58
59
|
}
|
|
59
60
|
}));
|
|
60
61
|
exports.submitIntlVerificationEpic = submitIntlVerificationEpic;
|
|
61
|
-
const toIntlWireVerificationPayload = (localData) => {
|
|
62
|
-
return {
|
|
63
|
-
is_applicant_declaration: true,
|
|
64
|
-
form_details: localData,
|
|
65
|
-
};
|
|
66
|
-
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LabelValueCodesPayload } from '../../../../commonPayloadTypes/commonPayload';
|
|
2
|
+
import { FieldPayload } from './internationalWireVerificationPayload';
|
|
3
|
+
import { VerificationFormLocalData } from './internationalWireVerificationState';
|
|
4
|
+
export declare const toVerificationFormLocalDataFromOnboardingDetails: (onboardingDetails: Record<string, LabelValueCodesPayload> | undefined, internationalWireFormPayload: Record<string, FieldPayload>) => VerificationFormLocalData;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toVerificationFormLocalDataFromOnboardingDetails = void 0;
|
|
4
|
+
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
+
const internationalWireVerificationLocalDataHelpers_1 = require("./internationalWireVerificationLocalDataHelpers");
|
|
6
|
+
const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
|
|
7
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
8
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
9
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
10
|
+
]);
|
|
11
|
+
const toValuesArray = (values) => {
|
|
12
|
+
if (values == null) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(values)) {
|
|
16
|
+
return values;
|
|
17
|
+
}
|
|
18
|
+
return [values];
|
|
19
|
+
};
|
|
20
|
+
const getCodeFromValue = (value) => {
|
|
21
|
+
if (typeof value === 'string') {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === 'object' &&
|
|
25
|
+
value != null &&
|
|
26
|
+
'code' in value &&
|
|
27
|
+
typeof value.code === 'string') {
|
|
28
|
+
return value.code;
|
|
29
|
+
}
|
|
30
|
+
return '';
|
|
31
|
+
};
|
|
32
|
+
const setEmptyFieldDefault = (localData, fieldKey, fieldPayload) => {
|
|
33
|
+
if (fieldPayload.type === 'file') {
|
|
34
|
+
localData[fieldKey] =
|
|
35
|
+
fieldPayload.is_multiple_values_allowed === true ? [] : '';
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (fieldPayload.type === 'date') {
|
|
39
|
+
localData[fieldKey] = '';
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (fieldPayload.type === 'enum') {
|
|
43
|
+
localData[fieldKey] =
|
|
44
|
+
fieldPayload.is_multiple_values_allowed === true ? [] : '';
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (fieldPayload.type === 'boolean_with_subfields') {
|
|
48
|
+
if (fieldKey ===
|
|
49
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
|
|
50
|
+
localData[fieldKey] = 'false';
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (fieldKey ===
|
|
54
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
55
|
+
localData[fieldKey] = fieldPayload.default === true ? 'true' : 'false';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const parseEnumValues = (localData, fieldKey, fieldPayload, values) => {
|
|
60
|
+
if (fieldPayload.is_multiple_values_allowed === true) {
|
|
61
|
+
localData[fieldKey] = values
|
|
62
|
+
.map(getCodeFromValue)
|
|
63
|
+
.filter((code) => code.length > 0);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
67
|
+
};
|
|
68
|
+
const parseFileValues = (localData, fieldKey, fieldPayload, values) => {
|
|
69
|
+
if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWireFileOptionLike)(values[0])) {
|
|
70
|
+
const fileOptions = (0, internationalWireVerificationLocalDataHelpers_1.toIntlWireFileOptionArray)(values);
|
|
71
|
+
if (fileOptions.length > 0) {
|
|
72
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWireFileOptionsToLocalData)(localData, fieldKey, fileOptions, {
|
|
73
|
+
includeBack: !MULTI_OPTION_FILE_FIELD_NAMES.has(fieldKey),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (values.length > 0 && MULTI_OPTION_FILE_FIELD_NAMES.has(fieldKey)) {
|
|
79
|
+
const fileOptions = (0, internationalWireVerificationLocalDataHelpers_1.toIntlWireFileOptionArray)(values);
|
|
80
|
+
if (fileOptions.length > 0) {
|
|
81
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWireFileOptionsToLocalData)(localData, fieldKey, fileOptions, {
|
|
82
|
+
includeBack: false,
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const fileIds = values.filter((value) => typeof value === 'string' && value.length > 0);
|
|
88
|
+
if (fieldPayload.is_multiple_values_allowed === true) {
|
|
89
|
+
localData[fieldKey] = fileIds;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
localData[fieldKey] = fileIds[0] ?? '';
|
|
93
|
+
};
|
|
94
|
+
const parseBooleanWithSubfieldsValues = (localData, fieldKey, fieldPayload, rawValues) => {
|
|
95
|
+
if (fieldKey ===
|
|
96
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
97
|
+
if ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(rawValues)) {
|
|
98
|
+
localData[fieldKey] = 'false';
|
|
99
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, fieldKey, rawValues);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const values = toValuesArray(rawValues);
|
|
103
|
+
if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(values[0])) {
|
|
104
|
+
localData[fieldKey] = 'false';
|
|
105
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, fieldKey, values[0]);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const selection = getCodeFromValue(values[0]);
|
|
109
|
+
localData[fieldKey] =
|
|
110
|
+
selection.length > 0
|
|
111
|
+
? selection
|
|
112
|
+
: fieldPayload.default === true
|
|
113
|
+
? 'true'
|
|
114
|
+
: 'false';
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (fieldKey ===
|
|
118
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
|
|
119
|
+
const values = toValuesArray(rawValues);
|
|
120
|
+
if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(values[0])) {
|
|
121
|
+
localData[fieldKey] = 'true';
|
|
122
|
+
values.forEach((person, ownerIndex) => {
|
|
123
|
+
if ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(person)) {
|
|
124
|
+
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, `${fieldKey}_${ownerIndex}`, person);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const selection = getCodeFromValue(values[0]);
|
|
130
|
+
localData[fieldKey] = selection.length > 0 ? selection : 'false';
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const toVerificationFormLocalDataFromOnboardingDetails = (onboardingDetails, internationalWireFormPayload) => {
|
|
134
|
+
const localData = {};
|
|
135
|
+
Object.keys(internationalWireFormPayload).forEach((fieldKey) => {
|
|
136
|
+
const fieldPayload = internationalWireFormPayload[fieldKey];
|
|
137
|
+
const rawValues = onboardingDetails?.[fieldKey]?.values;
|
|
138
|
+
if (rawValues == null) {
|
|
139
|
+
setEmptyFieldDefault(localData, fieldKey, fieldPayload);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (fieldPayload.type === 'boolean_with_subfields') {
|
|
143
|
+
parseBooleanWithSubfieldsValues(localData, fieldKey, fieldPayload, rawValues);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const values = toValuesArray(rawValues);
|
|
147
|
+
if (values.length === 0) {
|
|
148
|
+
setEmptyFieldDefault(localData, fieldKey, fieldPayload);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
switch (fieldPayload.type) {
|
|
152
|
+
case 'enum':
|
|
153
|
+
parseEnumValues(localData, fieldKey, fieldPayload, values);
|
|
154
|
+
break;
|
|
155
|
+
case 'file':
|
|
156
|
+
parseFileValues(localData, fieldKey, fieldPayload, values);
|
|
157
|
+
break;
|
|
158
|
+
case 'date':
|
|
159
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
160
|
+
break;
|
|
161
|
+
default:
|
|
162
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return localData;
|
|
167
|
+
};
|
|
168
|
+
exports.toVerificationFormLocalDataFromOnboardingDetails = toVerificationFormLocalDataFromOnboardingDetails;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const InternationalWireVerificationFormFieldNames: {
|
|
2
|
+
readonly certificateOfGoodStanding: "certificate_of_good_standing";
|
|
3
|
+
readonly businessOwnership: "business_ownership";
|
|
4
|
+
readonly companyProofOfAddress: "company_proof_of_address";
|
|
5
|
+
readonly companyOfficerProofOfAddress: "company_officer_proof_of_address";
|
|
6
|
+
readonly companyRegistrationDate: "company_registration_date";
|
|
7
|
+
readonly annualTurnover: "annual_turnover";
|
|
8
|
+
readonly expectedTransactionVolume: "expected_transaction_volume";
|
|
9
|
+
readonly employeeCount: "employee_count";
|
|
10
|
+
readonly intendedUseOfAccount: "intended_use_of_account";
|
|
11
|
+
readonly transactionCountries: "transaction_countries";
|
|
12
|
+
readonly stakeHolder: "stake_holder";
|
|
13
|
+
readonly controllingPerson: "controlling_person";
|
|
14
|
+
};
|
|
15
|
+
export type InternationalWireVerificationFormFieldName = (typeof InternationalWireVerificationFormFieldNames)[keyof typeof InternationalWireVerificationFormFieldNames];
|
|
16
|
+
export declare const InternationalWireVerificationStakeHolderFieldName: "stake_holder";
|
|
17
|
+
export declare const InternationalWireVerificationControllingPersonFieldName: "controlling_person";
|
|
18
|
+
export declare const InternationalWireVerificationBooleanWithSubfieldsFieldNames: {
|
|
19
|
+
readonly stakeHolder: "stake_holder";
|
|
20
|
+
readonly controllingPerson: "controlling_person";
|
|
21
|
+
};
|
|
22
|
+
export type InternationalWireVerificationBooleanWithSubfieldsFieldName = (typeof InternationalWireVerificationBooleanWithSubfieldsFieldNames)[keyof typeof InternationalWireVerificationBooleanWithSubfieldsFieldNames];
|
|
23
|
+
export declare const InternationalWireVerificationBooleanWithSubfieldsFieldNameList: InternationalWireVerificationBooleanWithSubfieldsFieldName[];
|
|
24
|
+
export declare const InternationalWireVerificationSubfieldNames: {
|
|
25
|
+
readonly companyRole: "company_role";
|
|
26
|
+
readonly dateOfBirth: "date_of_birth";
|
|
27
|
+
readonly name: "name";
|
|
28
|
+
readonly email: "email";
|
|
29
|
+
readonly nationality: "nationality";
|
|
30
|
+
readonly ownershipPercentage: "ownership_percentage";
|
|
31
|
+
readonly proofOfIdentity: "proof_of_identity";
|
|
32
|
+
readonly proofOfAddress: "proof_of_address";
|
|
33
|
+
readonly ssn: "ssn";
|
|
34
|
+
};
|
|
35
|
+
export type InternationalWireVerificationSubfieldName = (typeof InternationalWireVerificationSubfieldNames)[keyof typeof InternationalWireVerificationSubfieldNames];
|
|
36
|
+
export declare const InternationalWireVerificationReadonlyHideableFieldNames: readonly ["stake_holder", "controlling_person", "business_ownership", "company_proof_of_address", "company_officer_proof_of_address"];
|
|
37
|
+
export type InternationalWireVerificationReadonlyHideableFieldName = (typeof InternationalWireVerificationReadonlyHideableFieldNames)[number];
|
|
38
|
+
/**
|
|
39
|
+
* Readonly visibility gate:
|
|
40
|
+
* legacy onboarding submissions only have older fields saved.
|
|
41
|
+
* Newer fields are shown in readonly mode only when this field has data.
|
|
42
|
+
*/
|
|
43
|
+
export declare const InternationalWireVerificationReadonlyVisibilityGateFieldName: "business_ownership";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternationalWireVerificationReadonlyVisibilityGateFieldName = exports.InternationalWireVerificationReadonlyHideableFieldNames = exports.InternationalWireVerificationSubfieldNames = exports.InternationalWireVerificationBooleanWithSubfieldsFieldNameList = exports.InternationalWireVerificationBooleanWithSubfieldsFieldNames = exports.InternationalWireVerificationControllingPersonFieldName = exports.InternationalWireVerificationStakeHolderFieldName = exports.InternationalWireVerificationFormFieldNames = void 0;
|
|
4
|
+
exports.InternationalWireVerificationFormFieldNames = {
|
|
5
|
+
certificateOfGoodStanding: 'certificate_of_good_standing',
|
|
6
|
+
businessOwnership: 'business_ownership',
|
|
7
|
+
companyProofOfAddress: 'company_proof_of_address',
|
|
8
|
+
companyOfficerProofOfAddress: 'company_officer_proof_of_address',
|
|
9
|
+
companyRegistrationDate: 'company_registration_date',
|
|
10
|
+
annualTurnover: 'annual_turnover',
|
|
11
|
+
expectedTransactionVolume: 'expected_transaction_volume',
|
|
12
|
+
employeeCount: 'employee_count',
|
|
13
|
+
intendedUseOfAccount: 'intended_use_of_account',
|
|
14
|
+
transactionCountries: 'transaction_countries',
|
|
15
|
+
stakeHolder: 'stake_holder',
|
|
16
|
+
controllingPerson: 'controlling_person',
|
|
17
|
+
};
|
|
18
|
+
exports.InternationalWireVerificationStakeHolderFieldName = exports.InternationalWireVerificationFormFieldNames.stakeHolder;
|
|
19
|
+
exports.InternationalWireVerificationControllingPersonFieldName = exports.InternationalWireVerificationFormFieldNames.controllingPerson;
|
|
20
|
+
exports.InternationalWireVerificationBooleanWithSubfieldsFieldNames = {
|
|
21
|
+
stakeHolder: exports.InternationalWireVerificationStakeHolderFieldName,
|
|
22
|
+
controllingPerson: exports.InternationalWireVerificationControllingPersonFieldName,
|
|
23
|
+
};
|
|
24
|
+
exports.InternationalWireVerificationBooleanWithSubfieldsFieldNameList = Object.values(exports.InternationalWireVerificationBooleanWithSubfieldsFieldNames);
|
|
25
|
+
exports.InternationalWireVerificationSubfieldNames = {
|
|
26
|
+
companyRole: 'company_role',
|
|
27
|
+
dateOfBirth: 'date_of_birth',
|
|
28
|
+
name: 'name',
|
|
29
|
+
email: 'email',
|
|
30
|
+
nationality: 'nationality',
|
|
31
|
+
ownershipPercentage: 'ownership_percentage',
|
|
32
|
+
proofOfIdentity: 'proof_of_identity',
|
|
33
|
+
proofOfAddress: 'proof_of_address',
|
|
34
|
+
ssn: 'ssn',
|
|
35
|
+
};
|
|
36
|
+
exports.InternationalWireVerificationReadonlyHideableFieldNames = [
|
|
37
|
+
exports.InternationalWireVerificationFormFieldNames.stakeHolder,
|
|
38
|
+
exports.InternationalWireVerificationFormFieldNames.controllingPerson,
|
|
39
|
+
exports.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
40
|
+
exports.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
41
|
+
exports.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
42
|
+
];
|
|
43
|
+
/**
|
|
44
|
+
* Readonly visibility gate:
|
|
45
|
+
* legacy onboarding submissions only have older fields saved.
|
|
46
|
+
* Newer fields are shown in readonly mode only when this field has data.
|
|
47
|
+
*/
|
|
48
|
+
exports.InternationalWireVerificationReadonlyVisibilityGateFieldName = exports.InternationalWireVerificationFormFieldNames.businessOwnership;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { VerificationFormLocalData } from './internationalWireVerificationState';
|
|
2
|
+
export type IntlWireFileOptionLike = {
|
|
3
|
+
file_id: string;
|
|
4
|
+
option?: string;
|
|
5
|
+
};
|
|
6
|
+
export type IntlWirePersonNameLike = {
|
|
7
|
+
first_name?: string;
|
|
8
|
+
last_name?: string;
|
|
9
|
+
};
|
|
10
|
+
export type IntlWirePersonLike = {
|
|
11
|
+
company_role?: string;
|
|
12
|
+
date_of_birth?: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
name?: IntlWirePersonNameLike;
|
|
15
|
+
nationality?: string;
|
|
16
|
+
ownership_percentage?: number;
|
|
17
|
+
proof_of_address?: IntlWireFileOptionLike[];
|
|
18
|
+
proof_of_identity?: IntlWireFileOptionLike[];
|
|
19
|
+
ssn?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const isIntlWireFileOptionLike: (value: unknown) => value is IntlWireFileOptionLike;
|
|
22
|
+
export declare const isIntlWirePersonLike: (value: unknown) => value is IntlWirePersonLike;
|
|
23
|
+
export declare const toIntlWireFileOptionArray: (items: unknown[]) => IntlWireFileOptionLike[];
|
|
24
|
+
export declare const appendIntlWireFileOptionsToLocalData: (localData: VerificationFormLocalData, baseKey: string, fileOptions: IntlWireFileOptionLike[], options?: {
|
|
25
|
+
includeBack?: boolean;
|
|
26
|
+
}) => void;
|
|
27
|
+
export declare const appendIntlWirePersonToLocalData: (localData: VerificationFormLocalData, keyPrefix: string, person: IntlWirePersonLike) => void;
|
|
28
|
+
export declare const getStakeHolderOwnerIndicesFromLocalData: (localData: VerificationFormLocalData) => number[];
|
|
29
|
+
export declare const hasBusinessOwnershipValueInLocalData: (localData: VerificationFormLocalData, gateFieldName?: string) => boolean;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasBusinessOwnershipValueInLocalData = exports.getStakeHolderOwnerIndicesFromLocalData = exports.appendIntlWirePersonToLocalData = exports.appendIntlWireFileOptionsToLocalData = exports.toIntlWireFileOptionArray = exports.isIntlWirePersonLike = exports.isIntlWireFileOptionLike = void 0;
|
|
4
|
+
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
+
const internationalWireVerificationSubmitPayload_1 = require("./internationalWireVerificationSubmitPayload");
|
|
6
|
+
const isIntlWireFileOptionLike = (value) => typeof value === 'object' &&
|
|
7
|
+
value != null &&
|
|
8
|
+
'file_id' in value &&
|
|
9
|
+
typeof value.file_id === 'string';
|
|
10
|
+
exports.isIntlWireFileOptionLike = isIntlWireFileOptionLike;
|
|
11
|
+
const isIntlWirePersonLike = (value) => {
|
|
12
|
+
if (typeof value !== 'object' || value == null || Array.isArray(value)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const person = value;
|
|
16
|
+
return (person.name != null ||
|
|
17
|
+
person.email != null ||
|
|
18
|
+
person.nationality != null ||
|
|
19
|
+
person.company_role != null ||
|
|
20
|
+
person.ssn != null ||
|
|
21
|
+
person.date_of_birth != null ||
|
|
22
|
+
person.ownership_percentage != null ||
|
|
23
|
+
person.proof_of_identity != null ||
|
|
24
|
+
person.proof_of_address != null);
|
|
25
|
+
};
|
|
26
|
+
exports.isIntlWirePersonLike = isIntlWirePersonLike;
|
|
27
|
+
const toIntlWireFileOptionArray = (items) => items.filter(exports.isIntlWireFileOptionLike);
|
|
28
|
+
exports.toIntlWireFileOptionArray = toIntlWireFileOptionArray;
|
|
29
|
+
const appendIntlWireFileOptionsToLocalData = (localData, baseKey, fileOptions, options) => {
|
|
30
|
+
const includeBack = options?.includeBack ?? true;
|
|
31
|
+
const [front, back] = fileOptions;
|
|
32
|
+
if (front?.file_id != null && front.file_id !== '') {
|
|
33
|
+
localData[baseKey] = front.file_id;
|
|
34
|
+
if (front.option != null && front.option !== '') {
|
|
35
|
+
localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentOption}`] = front.option;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const backKey = `${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentBack}`;
|
|
39
|
+
if (includeBack && back?.file_id != null && back.file_id !== '') {
|
|
40
|
+
localData[backKey] = back.file_id;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Clear any stale back-file id so a shallow merge does not retain a proof
|
|
44
|
+
// document that is no longer present on the re-applied record.
|
|
45
|
+
delete localData[backKey];
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.appendIntlWireFileOptionsToLocalData = appendIntlWireFileOptionsToLocalData;
|
|
49
|
+
const appendIntlWirePersonToLocalData = (localData, keyPrefix, person) => {
|
|
50
|
+
const nameBaseKey = `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.name}`;
|
|
51
|
+
if (person.name?.first_name != null) {
|
|
52
|
+
localData[`${nameBaseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.nameFirst}`] = person.name.first_name;
|
|
53
|
+
}
|
|
54
|
+
if (person.name?.last_name != null) {
|
|
55
|
+
localData[`${nameBaseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.nameLast}`] = person.name.last_name;
|
|
56
|
+
}
|
|
57
|
+
const assignStringField = (subfieldName, fieldValue) => {
|
|
58
|
+
if (fieldValue != null && fieldValue !== '') {
|
|
59
|
+
localData[`${keyPrefix}_${subfieldName}`] = fieldValue;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.nationality, person.nationality);
|
|
63
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.email, person.email);
|
|
64
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.companyRole, person.company_role);
|
|
65
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ssn, person.ssn);
|
|
66
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.dateOfBirth, person.date_of_birth);
|
|
67
|
+
if (person.ownership_percentage != null) {
|
|
68
|
+
localData[`${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ownershipPercentage}`] = person.ownership_percentage;
|
|
69
|
+
}
|
|
70
|
+
if (person.proof_of_identity != null) {
|
|
71
|
+
(0, exports.appendIntlWireFileOptionsToLocalData)(localData, `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity}`, (0, exports.toIntlWireFileOptionArray)(person.proof_of_identity));
|
|
72
|
+
}
|
|
73
|
+
if (person.proof_of_address != null) {
|
|
74
|
+
(0, exports.appendIntlWireFileOptionsToLocalData)(localData, `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfAddress}`, (0, exports.toIntlWireFileOptionArray)(person.proof_of_address));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
exports.appendIntlWirePersonToLocalData = appendIntlWirePersonToLocalData;
|
|
78
|
+
const getStakeHolderOwnerIndicesFromLocalData = (localData) => {
|
|
79
|
+
const stakeHolderPrefix = `${internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.stakeHolder}_`;
|
|
80
|
+
const stakeHolderIndexedPattern = new RegExp(`^${stakeHolderPrefix}(\\d+)_`);
|
|
81
|
+
const stakeHolderBooleanSelectionPattern = new RegExp(`^${internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.stakeHolder}_(true|false)$`);
|
|
82
|
+
const indices = new Set();
|
|
83
|
+
Object.keys(localData).forEach((key) => {
|
|
84
|
+
const match = key.match(stakeHolderIndexedPattern);
|
|
85
|
+
if (match != null) {
|
|
86
|
+
indices.add(Number.parseInt(match[1], 10));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
if (indices.size === 0) {
|
|
90
|
+
const hasUnindexedStakeHolderData = Object.keys(localData).some((key) => key.startsWith(stakeHolderPrefix) &&
|
|
91
|
+
!stakeHolderBooleanSelectionPattern.test(key));
|
|
92
|
+
if (hasUnindexedStakeHolderData) {
|
|
93
|
+
indices.add(0);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return Array.from(indices).sort((a, b) => a - b);
|
|
97
|
+
};
|
|
98
|
+
exports.getStakeHolderOwnerIndicesFromLocalData = getStakeHolderOwnerIndicesFromLocalData;
|
|
99
|
+
const hasBusinessOwnershipValueInLocalData = (localData, gateFieldName = internationalWireVerificationFieldConstants_1.InternationalWireVerificationReadonlyVisibilityGateFieldName) => {
|
|
100
|
+
const baseKey = gateFieldName ?? internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership;
|
|
101
|
+
const frontFileId = localData[baseKey];
|
|
102
|
+
if (typeof frontFileId === 'string' && frontFileId !== '') {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (Array.isArray(frontFileId)) {
|
|
106
|
+
return frontFileId.some((fileId) => typeof fileId === 'string' && fileId !== '');
|
|
107
|
+
}
|
|
108
|
+
const backFileId = localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentBack}`];
|
|
109
|
+
if (typeof backFileId === 'string' && backFileId !== '') {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
const documentOption = localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentOption}`];
|
|
113
|
+
return typeof documentOption === 'string' && documentOption !== '';
|
|
114
|
+
};
|
|
115
|
+
exports.hasBusinessOwnershipValueInLocalData = hasBusinessOwnershipValueInLocalData;
|
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
import { AllowedValueWithCode } from '../../../../commonStateTypes/allowedValue';
|
|
2
2
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
3
|
-
import { VerificationFormField } from './internationalWireVerificationState';
|
|
3
|
+
import { VerificationFormField, VerificationFormLocalData } from './internationalWireVerificationState';
|
|
4
|
+
export declare const InternationalWireVerificationFormOrder: readonly ["certificate_of_good_standing", "business_ownership", "company_proof_of_address", "company_officer_proof_of_address", "company_registration_date", "annual_turnover", "expected_transaction_volume", "employee_count", "intended_use_of_account", "transaction_countries", "stake_holder", "controlling_person"];
|
|
5
|
+
export interface FieldOptionPayload {
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SubFieldPayload {
|
|
9
|
+
label: string;
|
|
10
|
+
type: string;
|
|
11
|
+
field_hint_text?: string;
|
|
12
|
+
field_values?: {
|
|
13
|
+
code: string;
|
|
14
|
+
description: string;
|
|
15
|
+
}[];
|
|
16
|
+
is_multiple_options_supported?: boolean;
|
|
17
|
+
options?: Record<string, FieldOptionPayload>;
|
|
18
|
+
}
|
|
4
19
|
export interface FieldPayload {
|
|
5
20
|
label: string;
|
|
6
21
|
type: string;
|
|
22
|
+
default?: boolean;
|
|
7
23
|
field_hint_text?: string;
|
|
8
24
|
field_values?: {
|
|
9
25
|
code: string;
|
|
10
26
|
description: string;
|
|
11
27
|
}[];
|
|
28
|
+
is_multiple_options_supported?: boolean;
|
|
12
29
|
is_multiple_values_allowed?: boolean;
|
|
30
|
+
options?: Record<string, FieldOptionPayload>;
|
|
31
|
+
requirements?: string[];
|
|
32
|
+
subfields?: Record<string, SubFieldPayload>;
|
|
13
33
|
}
|
|
14
34
|
export declare const toDynamicFormField: (key: string, payload: FieldPayload) => VerificationFormField;
|
|
35
|
+
export declare const filterVerificationFormFieldsForReadonlyView: (fields: VerificationFormField[], localData: VerificationFormLocalData, isReadonly: boolean) => VerificationFormField[];
|
|
36
|
+
export declare const sortVerificationFormFields: (fields: VerificationFormField[]) => VerificationFormField[];
|
|
37
|
+
export declare const toVerificationFormFields: (internationalWireFormPayload: Record<string, FieldPayload>) => VerificationFormField[];
|
|
15
38
|
export type IntlVerificationFormResponse = ZeniAPIResponse<IntlVerificationFormPayload>;
|
|
16
39
|
export interface IntlVerificationFormPayload {
|
|
17
40
|
create_time: string;
|