@zeniai/client-epic-state 5.1.68-beta0RR → 5.1.68-betaDI1
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 +3 -8
- package/lib/esm/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +4 -2
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewPayload.js +7 -2
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewReducer.js +47 -2
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewSelector.js +9 -0
- package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewState.js +1 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +3 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +34 -56
- 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 +7 -23
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
- package/lib/index.d.ts +4 -10
- package/lib/index.js +15 -32
- package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.d.ts +5 -2
- package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +3 -1
- package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.d.ts +1 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.js +7 -2
- package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.d.ts +6 -1
- package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.js +48 -3
- package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.js +9 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewState.d.ts +1 -0
- package/lib/view/notificationPreferencesView/notificationPreferencesViewState.js +1 -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 -55
- 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 +6 -22
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +1 -20
- package/package.json +1 -1
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -164
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -45
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -105
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -189
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +0 -4
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -168
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +0 -43
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -48
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +0 -29
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -115
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +0 -32
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -194
|
@@ -1,115 +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, 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,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
|
-
};
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toIntlWireVerificationSubmitPayload = exports.toIntlWireVerificationFormDetails = exports.IntlWireVerificationLocalDataSuffix = void 0;
|
|
4
|
-
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
-
exports.IntlWireVerificationLocalDataSuffix = {
|
|
6
|
-
documentOption: '_option',
|
|
7
|
-
documentBack: '_back',
|
|
8
|
-
nameFirst: '_first_name',
|
|
9
|
-
nameLast: '_last_name',
|
|
10
|
-
};
|
|
11
|
-
const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
|
|
12
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
13
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
14
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
15
|
-
]);
|
|
16
|
-
const BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES = new Set([
|
|
17
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder,
|
|
18
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson,
|
|
19
|
-
]);
|
|
20
|
-
const FILE_SUBFIELD_NAMES = new Set([
|
|
21
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity,
|
|
22
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfAddress,
|
|
23
|
-
]);
|
|
24
|
-
const isInternalLocalDataKey = (key) => key.endsWith(exports.IntlWireVerificationLocalDataSuffix.documentOption) ||
|
|
25
|
-
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.documentBack) ||
|
|
26
|
-
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.nameFirst) ||
|
|
27
|
-
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.nameLast);
|
|
28
|
-
const isPersonSubfieldKey = (key) => key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`) ||
|
|
29
|
-
key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson}_`);
|
|
30
|
-
const toFileOptionPayloads = (localData, baseKey, options) => {
|
|
31
|
-
const includeBack = options?.includeBack ?? true;
|
|
32
|
-
const option = localData[`${baseKey}${exports.IntlWireVerificationLocalDataSuffix.documentOption}`];
|
|
33
|
-
if (typeof option !== 'string' || option.length === 0) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
const payloads = [];
|
|
37
|
-
const frontFileId = localData[baseKey];
|
|
38
|
-
if (typeof frontFileId === 'string' && frontFileId.length > 0) {
|
|
39
|
-
payloads.push({ file_id: frontFileId, option });
|
|
40
|
-
}
|
|
41
|
-
if (includeBack) {
|
|
42
|
-
const backFileId = localData[`${baseKey}${exports.IntlWireVerificationLocalDataSuffix.documentBack}`];
|
|
43
|
-
if (typeof backFileId === 'string' && backFileId.length > 0) {
|
|
44
|
-
payloads.push({ file_id: backFileId, option });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return payloads.length > 0 ? payloads : undefined;
|
|
48
|
-
};
|
|
49
|
-
const buildPersonPayload = (localData, keyPrefix) => {
|
|
50
|
-
const person = {};
|
|
51
|
-
const nameBaseKey = `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.name}`;
|
|
52
|
-
const firstName = localData[`${nameBaseKey}${exports.IntlWireVerificationLocalDataSuffix.nameFirst}`];
|
|
53
|
-
const lastName = localData[`${nameBaseKey}${exports.IntlWireVerificationLocalDataSuffix.nameLast}`];
|
|
54
|
-
if (typeof firstName === 'string' || typeof lastName === 'string') {
|
|
55
|
-
person.name = {
|
|
56
|
-
first_name: typeof firstName === 'string' ? firstName : '',
|
|
57
|
-
last_name: typeof lastName === 'string' ? lastName : '',
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
const assignStringField = (subfieldName, assign) => {
|
|
61
|
-
const value = localData[`${keyPrefix}_${subfieldName}`];
|
|
62
|
-
if (typeof value === 'string' && value.length > 0) {
|
|
63
|
-
assign(value);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.nationality, (value) => {
|
|
67
|
-
person.nationality = value;
|
|
68
|
-
});
|
|
69
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.email, (value) => {
|
|
70
|
-
person.email = value;
|
|
71
|
-
});
|
|
72
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.companyRole, (value) => {
|
|
73
|
-
person.company_role = value;
|
|
74
|
-
});
|
|
75
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ssn, (value) => {
|
|
76
|
-
person.ssn = value;
|
|
77
|
-
});
|
|
78
|
-
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.dateOfBirth, (value) => {
|
|
79
|
-
person.date_of_birth = value;
|
|
80
|
-
});
|
|
81
|
-
const ownershipValue = localData[`${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ownershipPercentage}`];
|
|
82
|
-
if (ownershipValue != null && ownershipValue !== '') {
|
|
83
|
-
const parsedOwnership = Number(ownershipValue);
|
|
84
|
-
if (!Number.isNaN(parsedOwnership)) {
|
|
85
|
-
person.ownership_percentage = parsedOwnership;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
FILE_SUBFIELD_NAMES.forEach((subfieldName) => {
|
|
89
|
-
const filePayloads = toFileOptionPayloads(localData, `${keyPrefix}_${subfieldName}`);
|
|
90
|
-
if (filePayloads != null) {
|
|
91
|
-
if (subfieldName ===
|
|
92
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity) {
|
|
93
|
-
person.proof_of_identity = filePayloads;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
person.proof_of_address = filePayloads;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
return person;
|
|
101
|
-
};
|
|
102
|
-
const getStakeHolderOwnerKeyPrefix = (localData, ownerIndex) => {
|
|
103
|
-
const indexedKeyPrefix = `${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_${ownerIndex}`;
|
|
104
|
-
if (ownerIndex !== 0) {
|
|
105
|
-
return indexedKeyPrefix;
|
|
106
|
-
}
|
|
107
|
-
const hasIndexedOwnerZeroData = Object.keys(localData).some((key) => key.startsWith(`${indexedKeyPrefix}_`));
|
|
108
|
-
if (hasIndexedOwnerZeroData) {
|
|
109
|
-
return indexedKeyPrefix;
|
|
110
|
-
}
|
|
111
|
-
return internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder;
|
|
112
|
-
};
|
|
113
|
-
const getStakeHolderOwnerIndices = (localData) => {
|
|
114
|
-
const stakeHolderPrefix = `${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`;
|
|
115
|
-
const stakeHolderIndexedPattern = new RegExp(`^${stakeHolderPrefix}(\\d+)_`);
|
|
116
|
-
const stakeHolderBooleanSelectionPattern = new RegExp(`^${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_(true|false)$`);
|
|
117
|
-
const indices = new Set();
|
|
118
|
-
Object.keys(localData).forEach((key) => {
|
|
119
|
-
const match = key.match(stakeHolderIndexedPattern);
|
|
120
|
-
if (match != null) {
|
|
121
|
-
indices.add(Number.parseInt(match[1], 10));
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
if (indices.size === 0) {
|
|
125
|
-
const hasUnindexedStakeHolderData = Object.keys(localData).some((key) => key.startsWith(stakeHolderPrefix) &&
|
|
126
|
-
!stakeHolderBooleanSelectionPattern.test(key));
|
|
127
|
-
if (hasUnindexedStakeHolderData) {
|
|
128
|
-
indices.add(0);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return Array.from(indices).sort((a, b) => a - b);
|
|
132
|
-
};
|
|
133
|
-
const hasPersonPayloadData = (person) => Object.keys(person).length > 0;
|
|
134
|
-
const toIntlWireVerificationFormDetails = (localData) => {
|
|
135
|
-
const formDetails = {};
|
|
136
|
-
Object.entries(localData).forEach(([key, value]) => {
|
|
137
|
-
if (BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES.has(key) ||
|
|
138
|
-
isInternalLocalDataKey(key) ||
|
|
139
|
-
isPersonSubfieldKey(key)) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
if (MULTI_OPTION_FILE_FIELD_NAMES.has(key)) {
|
|
143
|
-
const filePayloads = toFileOptionPayloads(localData, key, {
|
|
144
|
-
includeBack: false,
|
|
145
|
-
});
|
|
146
|
-
if (filePayloads != null) {
|
|
147
|
-
formDetails[key] = filePayloads;
|
|
148
|
-
}
|
|
149
|
-
else if (Array.isArray(value)) {
|
|
150
|
-
const fileIds = value.filter((fileId) => typeof fileId === 'string' && fileId.length > 0);
|
|
151
|
-
if (fileIds.length > 0) {
|
|
152
|
-
formDetails[key] = fileIds;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
else if (typeof value === 'string' && value.length > 0) {
|
|
156
|
-
// Backward compatibility: older onboarding records can store plain file ids
|
|
157
|
-
// without a paired `_option` key.
|
|
158
|
-
formDetails[key] = value;
|
|
159
|
-
}
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
if (value == null || value === '') {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
formDetails[key] = value;
|
|
166
|
-
});
|
|
167
|
-
const stakeHolderSelection = localData[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder];
|
|
168
|
-
if (stakeHolderSelection === 'true') {
|
|
169
|
-
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = getStakeHolderOwnerIndices(localData)
|
|
170
|
-
.map((ownerIndex) => buildPersonPayload(localData, getStakeHolderOwnerKeyPrefix(localData, ownerIndex)))
|
|
171
|
-
.filter(hasPersonPayloadData);
|
|
172
|
-
}
|
|
173
|
-
else if (stakeHolderSelection === 'false') {
|
|
174
|
-
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = [];
|
|
175
|
-
}
|
|
176
|
-
const controllingPersonSelection = localData[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames
|
|
177
|
-
.controllingPerson];
|
|
178
|
-
if (controllingPersonSelection === 'false') {
|
|
179
|
-
const controllingPerson = buildPersonPayload(localData, internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson);
|
|
180
|
-
if (hasPersonPayloadData(controllingPerson)) {
|
|
181
|
-
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson] = controllingPerson;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
else if (controllingPersonSelection === 'true') {
|
|
185
|
-
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson] = 'true';
|
|
186
|
-
}
|
|
187
|
-
return formDetails;
|
|
188
|
-
};
|
|
189
|
-
exports.toIntlWireVerificationFormDetails = toIntlWireVerificationFormDetails;
|
|
190
|
-
const toIntlWireVerificationSubmitPayload = (localData) => ({
|
|
191
|
-
is_applicant_declaration: true,
|
|
192
|
-
form_details: (0, exports.toIntlWireVerificationFormDetails)(localData),
|
|
193
|
-
});
|
|
194
|
-
exports.toIntlWireVerificationSubmitPayload = toIntlWireVerificationSubmitPayload;
|