@zeniai/client-epic-state 5.1.3-betaAS1 → 5.1.3-betaVR1
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 +4 -25
- package/lib/esm/index.js +4 -8
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +200 -0
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +96 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +3 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +34 -33
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +7 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +8 -55
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +6 -5
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
- package/lib/index.d.ts +6 -11
- package/lib/index.js +41 -54
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +36 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +205 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +28 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +96 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +39 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +2 -6
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +33 -32
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +7 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +1 -24
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +9 -59
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +5 -4
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +1 -20
- package/package.json +2 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -146
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -40
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -86
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -154
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +0 -4
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -150
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +0 -38
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -43
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +0 -27
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -96
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +0 -32
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -159
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { InternationalWireVerificationBooleanWithSubfieldsFieldNames, InternationalWireVerificationFormFieldNames, InternationalWireVerificationSubfieldNames, } from './internationalWireVerificationFieldConstants';
|
|
2
|
-
export const IntlWireVerificationLocalDataSuffix = {
|
|
3
|
-
documentOption: '_option',
|
|
4
|
-
documentBack: '_back',
|
|
5
|
-
nameFirst: '_first_name',
|
|
6
|
-
nameLast: '_last_name',
|
|
7
|
-
};
|
|
8
|
-
const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
|
|
9
|
-
InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
10
|
-
InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
11
|
-
InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
12
|
-
]);
|
|
13
|
-
const BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES = new Set([
|
|
14
|
-
InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder,
|
|
15
|
-
InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson,
|
|
16
|
-
]);
|
|
17
|
-
const FILE_SUBFIELD_NAMES = new Set([
|
|
18
|
-
InternationalWireVerificationSubfieldNames.proofOfIdentity,
|
|
19
|
-
InternationalWireVerificationSubfieldNames.proofOfAddress,
|
|
20
|
-
]);
|
|
21
|
-
const isInternalLocalDataKey = (key) => key.endsWith(IntlWireVerificationLocalDataSuffix.documentOption) ||
|
|
22
|
-
key.endsWith(IntlWireVerificationLocalDataSuffix.documentBack) ||
|
|
23
|
-
key.endsWith(IntlWireVerificationLocalDataSuffix.nameFirst) ||
|
|
24
|
-
key.endsWith(IntlWireVerificationLocalDataSuffix.nameLast);
|
|
25
|
-
const isPersonSubfieldKey = (key) => key.startsWith(`${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`) ||
|
|
26
|
-
key.startsWith(`${InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson}_`);
|
|
27
|
-
const toFileOptionPayloads = (localData, baseKey) => {
|
|
28
|
-
const option = localData[`${baseKey}${IntlWireVerificationLocalDataSuffix.documentOption}`];
|
|
29
|
-
if (typeof option !== 'string' || option.length === 0) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
const payloads = [];
|
|
33
|
-
const frontFileId = localData[baseKey];
|
|
34
|
-
if (typeof frontFileId === 'string' && frontFileId.length > 0) {
|
|
35
|
-
payloads.push({ file_id: frontFileId, option });
|
|
36
|
-
}
|
|
37
|
-
const backFileId = localData[`${baseKey}${IntlWireVerificationLocalDataSuffix.documentBack}`];
|
|
38
|
-
if (typeof backFileId === 'string' && backFileId.length > 0) {
|
|
39
|
-
payloads.push({ file_id: backFileId, option });
|
|
40
|
-
}
|
|
41
|
-
return payloads.length > 0 ? payloads : undefined;
|
|
42
|
-
};
|
|
43
|
-
const buildPersonPayload = (localData, keyPrefix) => {
|
|
44
|
-
const person = {};
|
|
45
|
-
const nameBaseKey = `${keyPrefix}_${InternationalWireVerificationSubfieldNames.name}`;
|
|
46
|
-
const firstName = localData[`${nameBaseKey}${IntlWireVerificationLocalDataSuffix.nameFirst}`];
|
|
47
|
-
const lastName = localData[`${nameBaseKey}${IntlWireVerificationLocalDataSuffix.nameLast}`];
|
|
48
|
-
if (typeof firstName === 'string' || typeof lastName === 'string') {
|
|
49
|
-
person.name = {
|
|
50
|
-
first_name: typeof firstName === 'string' ? firstName : '',
|
|
51
|
-
last_name: typeof lastName === 'string' ? lastName : '',
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const assignStringField = (subfieldName, assign) => {
|
|
55
|
-
const value = localData[`${keyPrefix}_${subfieldName}`];
|
|
56
|
-
if (typeof value === 'string' && value.length > 0) {
|
|
57
|
-
assign(value);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
assignStringField(InternationalWireVerificationSubfieldNames.nationality, (value) => {
|
|
61
|
-
person.nationality = value;
|
|
62
|
-
});
|
|
63
|
-
assignStringField(InternationalWireVerificationSubfieldNames.email, (value) => {
|
|
64
|
-
person.email = value;
|
|
65
|
-
});
|
|
66
|
-
assignStringField(InternationalWireVerificationSubfieldNames.companyRole, (value) => {
|
|
67
|
-
person.company_role = value;
|
|
68
|
-
});
|
|
69
|
-
assignStringField(InternationalWireVerificationSubfieldNames.ssn, (value) => {
|
|
70
|
-
person.ssn = value;
|
|
71
|
-
});
|
|
72
|
-
assignStringField(InternationalWireVerificationSubfieldNames.dateOfBirth, (value) => {
|
|
73
|
-
person.date_of_birth = value;
|
|
74
|
-
});
|
|
75
|
-
const ownershipValue = localData[`${keyPrefix}_${InternationalWireVerificationSubfieldNames.ownershipPercentage}`];
|
|
76
|
-
if (ownershipValue != null && ownershipValue !== '') {
|
|
77
|
-
person.ownership_percentage = Number(ownershipValue);
|
|
78
|
-
}
|
|
79
|
-
FILE_SUBFIELD_NAMES.forEach((subfieldName) => {
|
|
80
|
-
const filePayloads = toFileOptionPayloads(localData, `${keyPrefix}_${subfieldName}`);
|
|
81
|
-
if (filePayloads != null) {
|
|
82
|
-
if (subfieldName ===
|
|
83
|
-
InternationalWireVerificationSubfieldNames.proofOfIdentity) {
|
|
84
|
-
person.proof_of_identity = filePayloads;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
person.proof_of_address = filePayloads;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
return person;
|
|
92
|
-
};
|
|
93
|
-
const getStakeHolderOwnerIndices = (localData) => {
|
|
94
|
-
const stakeHolderPrefix = `${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`;
|
|
95
|
-
const indices = new Set();
|
|
96
|
-
Object.keys(localData).forEach((key) => {
|
|
97
|
-
const match = key.match(/^stake_holder_(\d+)_/);
|
|
98
|
-
if (match != null) {
|
|
99
|
-
indices.add(Number.parseInt(match[1], 10));
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
if (indices.size === 0) {
|
|
103
|
-
const hasUnindexedStakeHolderData = Object.keys(localData).some((key) => key.startsWith(stakeHolderPrefix) &&
|
|
104
|
-
!/^stake_holder_(true|false)$/.test(key));
|
|
105
|
-
if (hasUnindexedStakeHolderData) {
|
|
106
|
-
indices.add(0);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return Array.from(indices).sort((a, b) => a - b);
|
|
110
|
-
};
|
|
111
|
-
const hasPersonPayloadData = (person) => Object.keys(person).length > 0;
|
|
112
|
-
export const toIntlWireVerificationFormDetails = (localData) => {
|
|
113
|
-
const formDetails = {};
|
|
114
|
-
Object.entries(localData).forEach(([key, value]) => {
|
|
115
|
-
if (BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES.has(key) ||
|
|
116
|
-
isInternalLocalDataKey(key) ||
|
|
117
|
-
isPersonSubfieldKey(key)) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (MULTI_OPTION_FILE_FIELD_NAMES.has(key)) {
|
|
121
|
-
const filePayloads = toFileOptionPayloads(localData, key);
|
|
122
|
-
if (filePayloads != null) {
|
|
123
|
-
formDetails[key] = filePayloads;
|
|
124
|
-
}
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (value == null || value === '') {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
formDetails[key] = value;
|
|
131
|
-
});
|
|
132
|
-
const stakeHolderSelection = localData[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder];
|
|
133
|
-
if (stakeHolderSelection === 'true') {
|
|
134
|
-
formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = getStakeHolderOwnerIndices(localData)
|
|
135
|
-
.map((ownerIndex) => buildPersonPayload(localData, `${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_${ownerIndex}`))
|
|
136
|
-
.filter(hasPersonPayloadData);
|
|
137
|
-
}
|
|
138
|
-
else if (stakeHolderSelection === 'false') {
|
|
139
|
-
formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = [];
|
|
140
|
-
}
|
|
141
|
-
const controllingPersonSelection = localData[InternationalWireVerificationBooleanWithSubfieldsFieldNames
|
|
142
|
-
.controllingPerson];
|
|
143
|
-
if (controllingPersonSelection === 'false') {
|
|
144
|
-
const controllingPerson = buildPersonPayload(localData, InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson);
|
|
145
|
-
if (hasPersonPayloadData(controllingPerson)) {
|
|
146
|
-
formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson] = controllingPerson;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return formDetails;
|
|
150
|
-
};
|
|
151
|
-
export const toIntlWireVerificationSubmitPayload = (localData) => ({
|
|
152
|
-
is_applicant_declaration: true,
|
|
153
|
-
form_details: toIntlWireVerificationFormDetails(localData),
|
|
154
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
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;
|
|
@@ -1,150 +0,0 @@
|
|
|
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 === 'enum') {
|
|
34
|
-
localData[fieldKey] =
|
|
35
|
-
fieldPayload.is_multiple_values_allowed === true ? [] : '';
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (fieldPayload.type === 'boolean_with_subfields') {
|
|
39
|
-
if (fieldKey ===
|
|
40
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
|
|
41
|
-
localData[fieldKey] = 'false';
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (fieldKey ===
|
|
45
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
46
|
-
localData[fieldKey] = fieldPayload.default === true ? 'true' : 'false';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const parseEnumValues = (localData, fieldKey, fieldPayload, values) => {
|
|
51
|
-
if (fieldPayload.is_multiple_values_allowed === true) {
|
|
52
|
-
localData[fieldKey] = values
|
|
53
|
-
.map(getCodeFromValue)
|
|
54
|
-
.filter((code) => code.length > 0);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
58
|
-
};
|
|
59
|
-
const parseFileValues = (localData, fieldKey, fieldPayload, values) => {
|
|
60
|
-
if (values.length > 0 &&
|
|
61
|
-
((0, internationalWireVerificationLocalDataHelpers_1.isIntlWireFileOptionLike)(values[0]) ||
|
|
62
|
-
MULTI_OPTION_FILE_FIELD_NAMES.has(fieldKey))) {
|
|
63
|
-
const fileOptions = (0, internationalWireVerificationLocalDataHelpers_1.toIntlWireFileOptionArray)(values);
|
|
64
|
-
if (fileOptions.length > 0) {
|
|
65
|
-
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWireFileOptionsToLocalData)(localData, fieldKey, fileOptions);
|
|
66
|
-
}
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const fileIds = values.filter((value) => typeof value === 'string' && value.length > 0);
|
|
70
|
-
if (fieldPayload.is_multiple_values_allowed === true) {
|
|
71
|
-
localData[fieldKey] = fileIds;
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
localData[fieldKey] = fileIds[0] ?? '';
|
|
75
|
-
};
|
|
76
|
-
const parseBooleanWithSubfieldsValues = (localData, fieldKey, fieldPayload, rawValues) => {
|
|
77
|
-
if (fieldKey ===
|
|
78
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
79
|
-
if ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(rawValues)) {
|
|
80
|
-
localData[fieldKey] = 'false';
|
|
81
|
-
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, fieldKey, rawValues);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const values = toValuesArray(rawValues);
|
|
85
|
-
if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(values[0])) {
|
|
86
|
-
localData[fieldKey] = 'false';
|
|
87
|
-
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, fieldKey, values[0]);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const selection = getCodeFromValue(values[0]);
|
|
91
|
-
localData[fieldKey] =
|
|
92
|
-
selection.length > 0
|
|
93
|
-
? selection
|
|
94
|
-
: fieldPayload.default === true
|
|
95
|
-
? 'true'
|
|
96
|
-
: 'false';
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (fieldKey ===
|
|
100
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
|
|
101
|
-
const values = toValuesArray(rawValues);
|
|
102
|
-
if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(values[0])) {
|
|
103
|
-
localData[fieldKey] = 'true';
|
|
104
|
-
values.forEach((person, ownerIndex) => {
|
|
105
|
-
if ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(person)) {
|
|
106
|
-
(0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, `${fieldKey}_${ownerIndex}`, person);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const selection = getCodeFromValue(values[0]);
|
|
112
|
-
localData[fieldKey] = selection.length > 0 ? selection : 'false';
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
const toVerificationFormLocalDataFromOnboardingDetails = (onboardingDetails, internationalWireFormPayload) => {
|
|
116
|
-
const localData = {};
|
|
117
|
-
Object.keys(internationalWireFormPayload).forEach((fieldKey) => {
|
|
118
|
-
const fieldPayload = internationalWireFormPayload[fieldKey];
|
|
119
|
-
const rawValues = onboardingDetails?.[fieldKey]?.values;
|
|
120
|
-
if (rawValues == null) {
|
|
121
|
-
setEmptyFieldDefault(localData, fieldKey, fieldPayload);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (fieldPayload.type === 'boolean_with_subfields') {
|
|
125
|
-
parseBooleanWithSubfieldsValues(localData, fieldKey, fieldPayload, rawValues);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const values = toValuesArray(rawValues);
|
|
129
|
-
if (values.length === 0) {
|
|
130
|
-
setEmptyFieldDefault(localData, fieldKey, fieldPayload);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
switch (fieldPayload.type) {
|
|
134
|
-
case 'enum':
|
|
135
|
-
parseEnumValues(localData, fieldKey, fieldPayload, values);
|
|
136
|
-
break;
|
|
137
|
-
case 'file':
|
|
138
|
-
parseFileValues(localData, fieldKey, fieldPayload, values);
|
|
139
|
-
break;
|
|
140
|
-
case 'date':
|
|
141
|
-
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
142
|
-
break;
|
|
143
|
-
default:
|
|
144
|
-
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
return localData;
|
|
149
|
-
};
|
|
150
|
-
exports.toVerificationFormLocalDataFromOnboardingDetails = toVerificationFormLocalDataFromOnboardingDetails;
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
export declare const InternationalWireVerificationReadonlyVisibilityGateFieldName: "business_ownership";
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
exports.InternationalWireVerificationReadonlyVisibilityGateFieldName = exports.InternationalWireVerificationFormFieldNames.businessOwnership;
|
|
@@ -1,27 +0,0 @@
|
|
|
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[]) => void;
|
|
25
|
-
export declare const appendIntlWirePersonToLocalData: (localData: VerificationFormLocalData, keyPrefix: string, person: IntlWirePersonLike) => void;
|
|
26
|
-
export declare const getStakeHolderOwnerIndicesFromLocalData: (localData: VerificationFormLocalData) => number[];
|
|
27
|
-
export declare const hasBusinessOwnershipValueInLocalData: (localData: VerificationFormLocalData) => boolean;
|
|
@@ -1,96 +0,0 @@
|
|
|
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) => {
|
|
30
|
-
const [front, back] = fileOptions;
|
|
31
|
-
if (front?.file_id != null && front.file_id !== '') {
|
|
32
|
-
localData[baseKey] = front.file_id;
|
|
33
|
-
if (front.option != null && front.option !== '') {
|
|
34
|
-
localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentOption}`] = front.option;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (back?.file_id != null && back.file_id !== '') {
|
|
38
|
-
localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentBack}`] =
|
|
39
|
-
back.file_id;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
exports.appendIntlWireFileOptionsToLocalData = appendIntlWireFileOptionsToLocalData;
|
|
43
|
-
const appendIntlWirePersonToLocalData = (localData, keyPrefix, person) => {
|
|
44
|
-
const nameBaseKey = `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.name}`;
|
|
45
|
-
if (person.name?.first_name != null) {
|
|
46
|
-
localData[`${nameBaseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.nameFirst}`] = person.name.first_name;
|
|
47
|
-
}
|
|
48
|
-
if (person.name?.last_name != null) {
|
|
49
|
-
localData[`${nameBaseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.nameLast}`] = person.name.last_name;
|
|
50
|
-
}
|
|
51
|
-
const assignStringField = (subfieldName, fieldValue) => {
|
|
52
|
-
if (fieldValue != null && fieldValue !== '') {
|
|
53
|
-
localData[`${keyPrefix}_${subfieldName}`] = fieldValue;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.nationality, person.nationality);
|
|
57
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.email, person.email);
|
|
58
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.companyRole, person.company_role);
|
|
59
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ssn, person.ssn);
|
|
60
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.dateOfBirth, person.date_of_birth);
|
|
61
|
-
if (person.ownership_percentage != null) {
|
|
62
|
-
localData[`${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ownershipPercentage}`] = person.ownership_percentage;
|
|
63
|
-
}
|
|
64
|
-
if (person.proof_of_identity != null) {
|
|
65
|
-
(0, exports.appendIntlWireFileOptionsToLocalData)(localData, `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity}`, (0, exports.toIntlWireFileOptionArray)(person.proof_of_identity));
|
|
66
|
-
}
|
|
67
|
-
if (person.proof_of_address != null) {
|
|
68
|
-
(0, exports.appendIntlWireFileOptionsToLocalData)(localData, `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfAddress}`, (0, exports.toIntlWireFileOptionArray)(person.proof_of_address));
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
exports.appendIntlWirePersonToLocalData = appendIntlWirePersonToLocalData;
|
|
72
|
-
const getStakeHolderOwnerIndicesFromLocalData = (localData) => {
|
|
73
|
-
const indices = new Set();
|
|
74
|
-
Object.keys(localData).forEach((key) => {
|
|
75
|
-
const match = key.match(/^stake_holder_(\d+)_/);
|
|
76
|
-
if (match != null) {
|
|
77
|
-
indices.add(Number.parseInt(match[1], 10));
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
return Array.from(indices).sort((a, b) => a - b);
|
|
81
|
-
};
|
|
82
|
-
exports.getStakeHolderOwnerIndicesFromLocalData = getStakeHolderOwnerIndicesFromLocalData;
|
|
83
|
-
const hasBusinessOwnershipValueInLocalData = (localData) => {
|
|
84
|
-
const baseKey = internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership;
|
|
85
|
-
const frontFileId = localData[baseKey];
|
|
86
|
-
if (typeof frontFileId === 'string' && frontFileId !== '') {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
const backFileId = localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentBack}`];
|
|
90
|
-
if (typeof backFileId === 'string' && backFileId !== '') {
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
const documentOption = localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentOption}`];
|
|
94
|
-
return typeof documentOption === 'string' && documentOption !== '';
|
|
95
|
-
};
|
|
96
|
-
exports.hasBusinessOwnershipValueInLocalData = hasBusinessOwnershipValueInLocalData;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { VerificationFormLocalData } from './internationalWireVerificationState';
|
|
2
|
-
export interface IntlWireFileOptionPayload {
|
|
3
|
-
file_id: string;
|
|
4
|
-
option: string;
|
|
5
|
-
}
|
|
6
|
-
export interface IntlWirePersonNamePayload {
|
|
7
|
-
first_name: string;
|
|
8
|
-
last_name: string;
|
|
9
|
-
}
|
|
10
|
-
export interface IntlWirePersonPayload {
|
|
11
|
-
company_role?: string;
|
|
12
|
-
date_of_birth?: string;
|
|
13
|
-
email?: string;
|
|
14
|
-
name?: IntlWirePersonNamePayload;
|
|
15
|
-
nationality?: string;
|
|
16
|
-
ownership_percentage?: number;
|
|
17
|
-
proof_of_address?: IntlWireFileOptionPayload[];
|
|
18
|
-
proof_of_identity?: IntlWireFileOptionPayload[];
|
|
19
|
-
ssn?: string;
|
|
20
|
-
}
|
|
21
|
-
export type IntlWireFormDetailsPayload = Record<string, string | string[] | number | IntlWireFileOptionPayload[] | IntlWirePersonPayload | IntlWirePersonPayload[]>;
|
|
22
|
-
export declare const IntlWireVerificationLocalDataSuffix: {
|
|
23
|
-
readonly documentOption: "_option";
|
|
24
|
-
readonly documentBack: "_back";
|
|
25
|
-
readonly nameFirst: "_first_name";
|
|
26
|
-
readonly nameLast: "_last_name";
|
|
27
|
-
};
|
|
28
|
-
export declare const toIntlWireVerificationFormDetails: (localData: VerificationFormLocalData) => IntlWireFormDetailsPayload;
|
|
29
|
-
export declare const toIntlWireVerificationSubmitPayload: (localData: VerificationFormLocalData) => {
|
|
30
|
-
is_applicant_declaration: boolean;
|
|
31
|
-
form_details: IntlWireFormDetailsPayload;
|
|
32
|
-
};
|