@zeniai/client-epic-state 5.0.90-betaAS1 → 5.0.90-betaAS10
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/esm/index.js +5 -1
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +7 -3
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +33 -41
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +146 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +40 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +86 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +21 -12
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +3 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +20 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +154 -0
- package/lib/index.d.ts +6 -1
- package/lib/index.js +22 -6
- 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 +32 -40
- 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 +150 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +38 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +43 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +27 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +96 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +2 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +23 -13
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +3 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +20 -7
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +4 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +32 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +159 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
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";
|
|
@@ -0,0 +1,43 @@
|
|
|
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;
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
|
@@ -0,0 +1,96 @@
|
|
|
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,6 +1,6 @@
|
|
|
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
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
5
|
export interface FieldOptionPayload {
|
|
6
6
|
label: string;
|
|
@@ -32,6 +32,7 @@ export interface FieldPayload {
|
|
|
32
32
|
subfields?: Record<string, SubFieldPayload>;
|
|
33
33
|
}
|
|
34
34
|
export declare const toDynamicFormField: (key: string, payload: FieldPayload) => VerificationFormField;
|
|
35
|
+
export declare const filterVerificationFormFieldsForReadonlyView: (fields: VerificationFormField[], localData: VerificationFormLocalData, isReadonly: boolean) => VerificationFormField[];
|
|
35
36
|
export declare const sortVerificationFormFields: (fields: VerificationFormField[]) => VerificationFormField[];
|
|
36
37
|
export declare const toVerificationFormFields: (internationalWireFormPayload: Record<string, FieldPayload>) => VerificationFormField[];
|
|
37
38
|
export type IntlVerificationFormResponse = ZeniAPIResponse<IntlVerificationFormPayload>;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toVerificationFormFields = exports.sortVerificationFormFields = exports.toDynamicFormField = exports.InternationalWireVerificationFormOrder = void 0;
|
|
3
|
+
exports.toVerificationFormFields = exports.sortVerificationFormFields = exports.filterVerificationFormFieldsForReadonlyView = exports.toDynamicFormField = exports.InternationalWireVerificationFormOrder = void 0;
|
|
4
|
+
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
+
const internationalWireVerificationLocalDataHelpers_1 = require("./internationalWireVerificationLocalDataHelpers");
|
|
4
6
|
exports.InternationalWireVerificationFormOrder = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.certificateOfGoodStanding,
|
|
8
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
9
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
10
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
11
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyRegistrationDate,
|
|
12
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.annualTurnover,
|
|
13
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.expectedTransactionVolume,
|
|
14
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.employeeCount,
|
|
15
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.intendedUseOfAccount,
|
|
16
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.transactionCountries,
|
|
17
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.stakeHolder,
|
|
18
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.controllingPerson,
|
|
17
19
|
];
|
|
18
20
|
const toFieldValues = (fieldValues) => fieldValues?.map(({ code, description }) => ({ code, description })) ?? [];
|
|
19
21
|
const toSubField = (subfield) => ({
|
|
@@ -43,6 +45,14 @@ const toDynamicFormField = (key, payload) => ({
|
|
|
43
45
|
: undefined,
|
|
44
46
|
});
|
|
45
47
|
exports.toDynamicFormField = toDynamicFormField;
|
|
48
|
+
const readonlyHideableVerificationFormFieldNames = new Set(internationalWireVerificationFieldConstants_1.InternationalWireVerificationReadonlyHideableFieldNames);
|
|
49
|
+
const filterVerificationFormFieldsForReadonlyView = (fields, localData, isReadonly) => {
|
|
50
|
+
if (!isReadonly || (0, internationalWireVerificationLocalDataHelpers_1.hasBusinessOwnershipValueInLocalData)(localData)) {
|
|
51
|
+
return fields;
|
|
52
|
+
}
|
|
53
|
+
return fields.filter((field) => !readonlyHideableVerificationFormFieldNames.has(field.name));
|
|
54
|
+
};
|
|
55
|
+
exports.filterVerificationFormFieldsForReadonlyView = filterVerificationFormFieldsForReadonlyView;
|
|
46
56
|
const sortVerificationFormFields = (fields) => {
|
|
47
57
|
const orderIndex = new Map(exports.InternationalWireVerificationFormOrder.map((name, index) => [name, index]));
|
|
48
58
|
return fields.slice().sort((a, b) => {
|
|
@@ -8,6 +8,7 @@ exports.initialState = {
|
|
|
8
8
|
verificationFormFetchState: {
|
|
9
9
|
fetchState: 'Not-Started',
|
|
10
10
|
},
|
|
11
|
+
verificationFormFieldLabels: {},
|
|
11
12
|
verificationFormFields: [],
|
|
12
13
|
verificationFormLocalData: {},
|
|
13
14
|
verificationFormSubmitState: {
|
|
@@ -35,6 +36,7 @@ const internationalWireVerification = (0, toolkit_1.createSlice)({
|
|
|
35
36
|
},
|
|
36
37
|
updateInternationalVerificationForm(draft, action) {
|
|
37
38
|
const { internationalWireFormPayload } = action.payload;
|
|
39
|
+
draft.verificationFormFieldLabels = internationalWireFormPayload;
|
|
38
40
|
draft.verificationFormFields = (0, internationalWireVerificationPayload_1.toVerificationFormFields)(internationalWireFormPayload);
|
|
39
41
|
draft.verificationFormFetchState.fetchState = 'Completed';
|
|
40
42
|
},
|
|
@@ -45,6 +47,7 @@ const internationalWireVerification = (0, toolkit_1.createSlice)({
|
|
|
45
47
|
},
|
|
46
48
|
updateVerificationFormLocalData(draft, action) {
|
|
47
49
|
draft.verificationFormLocalData = {
|
|
50
|
+
...draft.verificationFormLocalData,
|
|
48
51
|
...action.payload,
|
|
49
52
|
};
|
|
50
53
|
},
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getIntlWireVerificationView = void 0;
|
|
4
|
+
const companySelector_1 = require("../../../../entity/company/companySelector");
|
|
4
5
|
const fileSelector_1 = require("../../../../entity/file/fileSelector");
|
|
6
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
5
7
|
const fileViewSelector_1 = require("../../../fileView/fileViewSelector");
|
|
8
|
+
const internationalWireVerificationPayload_1 = require("./internationalWireVerificationPayload");
|
|
6
9
|
const collectFileIdsFromLocalData = (localData) => {
|
|
7
10
|
const fileIds = new Set();
|
|
8
11
|
Object.values(localData).forEach((value) => {
|
|
@@ -23,18 +26,28 @@ const collectFileIdsFromLocalData = (localData) => {
|
|
|
23
26
|
const getIntlWireVerificationView = (state) => {
|
|
24
27
|
const deleteFileStatusById = {};
|
|
25
28
|
const updateFileStatusById = {};
|
|
26
|
-
const
|
|
29
|
+
const { verificationFormFetchState, verificationFormFields, verificationFormLocalData, verificationFormSubmitState, } = state.internationalWireVerificationState;
|
|
30
|
+
const fileIds = collectFileIdsFromLocalData(verificationFormLocalData);
|
|
27
31
|
fileIds.forEach((fileId) => {
|
|
28
32
|
deleteFileStatusById[fileId] = (0, fileViewSelector_1.getFileDeleteStatusById)(state, fileId);
|
|
29
33
|
updateFileStatusById[fileId] = (0, fileViewSelector_1.getFileUpdateNameStatusById)(state, fileId);
|
|
30
34
|
});
|
|
31
|
-
const userFiles = fileIds.length > 0
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
.
|
|
35
|
+
const userFiles = fileIds.length > 0 ? (0, fileSelector_1.getFilesByFileIds)(state.fileState, fileIds) : [];
|
|
36
|
+
const fetchState = verificationFormFetchState.fetchState;
|
|
37
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
38
|
+
const company = currentTenant?.companyId != null
|
|
39
|
+
? (0, companySelector_1.getCompanyByCompanyId)(state.companyState, currentTenant.companyId)
|
|
40
|
+
?.company
|
|
41
|
+
: undefined;
|
|
42
|
+
const onboardingStatusCode = company?.companyBillPayInfo?.internationalWireOnboardingStatus?.code;
|
|
43
|
+
const isReadonly = onboardingStatusCode != null &&
|
|
44
|
+
onboardingStatusCode !== 'onboarding_status_not_started';
|
|
45
|
+
const visibleVerificationFormFields = (0, internationalWireVerificationPayload_1.filterVerificationFormFieldsForReadonlyView)(verificationFormFields, verificationFormLocalData, isReadonly);
|
|
36
46
|
return {
|
|
37
|
-
|
|
47
|
+
verificationFormFetchState,
|
|
48
|
+
verificationFormFields: visibleVerificationFormFields,
|
|
49
|
+
verificationFormLocalData,
|
|
50
|
+
verificationFormSubmitState,
|
|
38
51
|
deleteFileStatusById,
|
|
39
52
|
updateFileStatusById,
|
|
40
53
|
userFiles,
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { FetchStateAndError } from '../../../../commonStateTypes/common';
|
|
2
|
+
import { FieldPayload } from './internationalWireVerificationPayload';
|
|
2
3
|
export interface InternationalWireVerificationState {
|
|
3
4
|
verificationFormFetchState: FetchStateAndError;
|
|
5
|
+
verificationFormFieldLabels: Record<string, FieldPayload>;
|
|
4
6
|
verificationFormFields: VerificationFormField[];
|
|
5
7
|
verificationFormLocalData: VerificationFormLocalData;
|
|
6
8
|
verificationFormSubmitState: FetchStateAndError;
|
|
7
9
|
}
|
|
8
|
-
export type
|
|
10
|
+
export type VerificationFormLocalDataValue = string | string[] | number;
|
|
11
|
+
export type VerificationFormLocalData = Record<string, VerificationFormLocalDataValue>;
|
|
9
12
|
export interface FieldValueType {
|
|
10
13
|
code: string;
|
|
11
14
|
description: string;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
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) => {
|
|
31
|
+
const option = localData[`${baseKey}${exports.IntlWireVerificationLocalDataSuffix.documentOption}`];
|
|
32
|
+
if (typeof option !== 'string' || option.length === 0) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const payloads = [];
|
|
36
|
+
const frontFileId = localData[baseKey];
|
|
37
|
+
if (typeof frontFileId === 'string' && frontFileId.length > 0) {
|
|
38
|
+
payloads.push({ file_id: frontFileId, option });
|
|
39
|
+
}
|
|
40
|
+
const backFileId = localData[`${baseKey}${exports.IntlWireVerificationLocalDataSuffix.documentBack}`];
|
|
41
|
+
if (typeof backFileId === 'string' && backFileId.length > 0) {
|
|
42
|
+
payloads.push({ file_id: backFileId, option });
|
|
43
|
+
}
|
|
44
|
+
return payloads.length > 0 ? payloads : undefined;
|
|
45
|
+
};
|
|
46
|
+
const buildPersonPayload = (localData, keyPrefix) => {
|
|
47
|
+
const person = {};
|
|
48
|
+
const nameBaseKey = `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.name}`;
|
|
49
|
+
const firstName = localData[`${nameBaseKey}${exports.IntlWireVerificationLocalDataSuffix.nameFirst}`];
|
|
50
|
+
const lastName = localData[`${nameBaseKey}${exports.IntlWireVerificationLocalDataSuffix.nameLast}`];
|
|
51
|
+
if (typeof firstName === 'string' || typeof lastName === 'string') {
|
|
52
|
+
person.name = {
|
|
53
|
+
first_name: typeof firstName === 'string' ? firstName : '',
|
|
54
|
+
last_name: typeof lastName === 'string' ? lastName : '',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const assignStringField = (subfieldName, assign) => {
|
|
58
|
+
const value = localData[`${keyPrefix}_${subfieldName}`];
|
|
59
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
60
|
+
assign(value);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.nationality, (value) => {
|
|
64
|
+
person.nationality = value;
|
|
65
|
+
});
|
|
66
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.email, (value) => {
|
|
67
|
+
person.email = value;
|
|
68
|
+
});
|
|
69
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.companyRole, (value) => {
|
|
70
|
+
person.company_role = value;
|
|
71
|
+
});
|
|
72
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ssn, (value) => {
|
|
73
|
+
person.ssn = value;
|
|
74
|
+
});
|
|
75
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.dateOfBirth, (value) => {
|
|
76
|
+
person.date_of_birth = value;
|
|
77
|
+
});
|
|
78
|
+
const ownershipValue = localData[`${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ownershipPercentage}`];
|
|
79
|
+
if (ownershipValue != null && ownershipValue !== '') {
|
|
80
|
+
person.ownership_percentage = Number(ownershipValue);
|
|
81
|
+
}
|
|
82
|
+
FILE_SUBFIELD_NAMES.forEach((subfieldName) => {
|
|
83
|
+
const filePayloads = toFileOptionPayloads(localData, `${keyPrefix}_${subfieldName}`);
|
|
84
|
+
if (filePayloads != null) {
|
|
85
|
+
if (subfieldName ===
|
|
86
|
+
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity) {
|
|
87
|
+
person.proof_of_identity = filePayloads;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
person.proof_of_address = filePayloads;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return person;
|
|
95
|
+
};
|
|
96
|
+
const getStakeHolderOwnerIndices = (localData) => {
|
|
97
|
+
const stakeHolderPrefix = `${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`;
|
|
98
|
+
const indices = new Set();
|
|
99
|
+
Object.keys(localData).forEach((key) => {
|
|
100
|
+
const match = key.match(/^stake_holder_(\d+)_/);
|
|
101
|
+
if (match != null) {
|
|
102
|
+
indices.add(Number.parseInt(match[1], 10));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
if (indices.size === 0) {
|
|
106
|
+
const hasUnindexedStakeHolderData = Object.keys(localData).some((key) => key.startsWith(stakeHolderPrefix) &&
|
|
107
|
+
!/^stake_holder_(true|false)$/.test(key));
|
|
108
|
+
if (hasUnindexedStakeHolderData) {
|
|
109
|
+
indices.add(0);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return Array.from(indices).sort((a, b) => a - b);
|
|
113
|
+
};
|
|
114
|
+
const hasPersonPayloadData = (person) => Object.keys(person).length > 0;
|
|
115
|
+
const toIntlWireVerificationFormDetails = (localData) => {
|
|
116
|
+
const formDetails = {};
|
|
117
|
+
Object.entries(localData).forEach(([key, value]) => {
|
|
118
|
+
if (BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES.has(key) ||
|
|
119
|
+
isInternalLocalDataKey(key) ||
|
|
120
|
+
isPersonSubfieldKey(key)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (MULTI_OPTION_FILE_FIELD_NAMES.has(key)) {
|
|
124
|
+
const filePayloads = toFileOptionPayloads(localData, key);
|
|
125
|
+
if (filePayloads != null) {
|
|
126
|
+
formDetails[key] = filePayloads;
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (value == null || value === '') {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
formDetails[key] = value;
|
|
134
|
+
});
|
|
135
|
+
const stakeHolderSelection = localData[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder];
|
|
136
|
+
if (stakeHolderSelection === 'true') {
|
|
137
|
+
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = getStakeHolderOwnerIndices(localData)
|
|
138
|
+
.map((ownerIndex) => buildPersonPayload(localData, `${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_${ownerIndex}`))
|
|
139
|
+
.filter(hasPersonPayloadData);
|
|
140
|
+
}
|
|
141
|
+
else if (stakeHolderSelection === 'false') {
|
|
142
|
+
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = [];
|
|
143
|
+
}
|
|
144
|
+
const controllingPersonSelection = localData[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames
|
|
145
|
+
.controllingPerson];
|
|
146
|
+
if (controllingPersonSelection === 'false') {
|
|
147
|
+
const controllingPerson = buildPersonPayload(localData, internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson);
|
|
148
|
+
if (hasPersonPayloadData(controllingPerson)) {
|
|
149
|
+
formDetails[internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson] = controllingPerson;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return formDetails;
|
|
153
|
+
};
|
|
154
|
+
exports.toIntlWireVerificationFormDetails = toIntlWireVerificationFormDetails;
|
|
155
|
+
const toIntlWireVerificationSubmitPayload = (localData) => ({
|
|
156
|
+
is_applicant_declaration: true,
|
|
157
|
+
form_details: (0, exports.toIntlWireVerificationFormDetails)(localData),
|
|
158
|
+
});
|
|
159
|
+
exports.toIntlWireVerificationSubmitPayload = toIntlWireVerificationSubmitPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.90-
|
|
3
|
+
"version": "5.0.90-betaAS10",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|