@zeniai/client-epic-state 5.0.90-betaAS3 → 5.0.90-betaAS4
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 +2 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +3 -37
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +146 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +59 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8 -4
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +3 -37
- 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/internationalWireVerificationLocalDataHelpers.d.ts +26 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +68 -0
- package/package.json +1 -1
|
@@ -10,10 +10,31 @@ export interface AllowedValueWithCodeOptionalPayload {
|
|
|
10
10
|
export declare function isAllowedValueWithCodePayload(allowedValueWithCodePayload: any): allowedValueWithCodePayload is AllowedValueWithCodePayload;
|
|
11
11
|
export declare function isAllowedValueWithCodeOptionalPayload(allowedValueWithCodePayload: any): allowedValueWithCodePayload is AllowedValueWithCodeOptionalPayload;
|
|
12
12
|
export declare function toAllowedValueWithCode(allowedValueWithCodePayload: AllowedValueWithCodePayload): AllowedValueWithCode;
|
|
13
|
+
export interface LabelValueCodeDescriptionPayload {
|
|
14
|
+
code: string;
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
export interface LabelValueFileOptionPayload {
|
|
18
|
+
file_id: string;
|
|
19
|
+
option?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface LabelValuePersonNamePayload {
|
|
22
|
+
first_name?: string;
|
|
23
|
+
last_name?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface LabelValuePersonPayload {
|
|
26
|
+
company_role?: string;
|
|
27
|
+
date_of_birth?: string;
|
|
28
|
+
email?: string;
|
|
29
|
+
name?: LabelValuePersonNamePayload;
|
|
30
|
+
nationality?: string;
|
|
31
|
+
ownership_percentage?: number;
|
|
32
|
+
proof_of_address?: LabelValueFileOptionPayload[];
|
|
33
|
+
proof_of_identity?: LabelValueFileOptionPayload[];
|
|
34
|
+
ssn?: string;
|
|
35
|
+
}
|
|
36
|
+
export type LabelValueCodesValuesPayload = string | string[] | LabelValueCodeDescriptionPayload | LabelValueCodeDescriptionPayload[] | LabelValueFileOptionPayload | LabelValueFileOptionPayload[] | LabelValuePersonPayload | LabelValuePersonPayload[];
|
|
13
37
|
export interface LabelValueCodesPayload {
|
|
14
38
|
label: string;
|
|
15
|
-
values:
|
|
16
|
-
code: string;
|
|
17
|
-
description: string;
|
|
18
|
-
}[] | string[];
|
|
39
|
+
values: LabelValueCodesValuesPayload;
|
|
19
40
|
}
|
package/lib/esm/index.js
CHANGED
|
@@ -639,6 +639,8 @@ export { fetchCompanyTaskManagerView, fetchTaskManagerMetrics, getCompanyTaskMan
|
|
|
639
639
|
export { InternationalWireVerificationFormOrder, sortVerificationFormFields, fetchInternationalVerificationForm, submitInternationalVerificationForm, updateVerificationFormLocalData, getIntlWireVerificationView, };
|
|
640
640
|
export { InternationalWireVerificationBooleanWithSubfieldsFieldNameList, InternationalWireVerificationBooleanWithSubfieldsFieldNames, InternationalWireVerificationControllingPersonFieldName, InternationalWireVerificationFormFieldNames, InternationalWireVerificationStakeHolderFieldName, InternationalWireVerificationSubfieldNames, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants';
|
|
641
641
|
export { IntlWireVerificationLocalDataSuffix, toIntlWireVerificationFormDetails, toIntlWireVerificationSubmitPayload, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload';
|
|
642
|
+
export { getStakeHolderOwnerIndicesFromLocalData, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers';
|
|
643
|
+
export { toVerificationFormLocalDataFromOnboardingDetails, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData';
|
|
642
644
|
export { fetchExpressPayInitialDetails, updateExpressPayFormLocalData, submitExpressPay, resetExpressPayLocalData, getExpressPayView, };
|
|
643
645
|
export { acceptTreasuryTerms, fetchTreasurySetupView, clearTreasurySetupView, fetchTreasuryFunds, updatePortfolioAllocation, fetchPortfolioAllocation, updateFundAllocationLocalData, updateTreasuryPromoIntroClosedByOutsideClick, updateTreasuryPromoRemindMeLaterClicked, updateTreasuryVideoViewed, getTreasurySetupViewDetails, getTreasuryFundsMaximumYield, };
|
|
644
646
|
// ── AI Accountant Entity ──
|
|
@@ -1,46 +1,12 @@
|
|
|
1
1
|
import { from } from 'rxjs';
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { toVerificationFormLocalDataFromOnboardingDetails } from '../internationalWireOnboardingDetailsToLocalData';
|
|
3
4
|
import { initializeIntlVerificationForm, updateVerificationFormLocalData, } from '../internationalWireVerificationReducer';
|
|
4
5
|
export const initializeIntlVerificationFormEpic = (actions$, state$) => actions$.pipe(filter(initializeIntlVerificationForm.match), mergeMap((action) => {
|
|
5
6
|
const { companyId, internationalWireFormPayload } = action.payload;
|
|
6
|
-
const actions = [];
|
|
7
7
|
const state = state$.value;
|
|
8
8
|
const onboardingDataFromCompanyInfo = state.companyState.companiesById[companyId].companyBillPayInfo
|
|
9
9
|
.internationalWireOnboardingDetails;
|
|
10
|
-
const localData =
|
|
11
|
-
|
|
12
|
-
const values = onboardingDataFromCompanyInfo != null
|
|
13
|
-
? onboardingDataFromCompanyInfo[formFieldKey]?.values
|
|
14
|
-
: undefined;
|
|
15
|
-
if (values != null) {
|
|
16
|
-
const fieldPayload = internationalWireFormPayload[formFieldKey];
|
|
17
|
-
if (fieldPayload.type === 'enum') {
|
|
18
|
-
localData[formFieldKey] =
|
|
19
|
-
fieldPayload.is_multiple_values_allowed === false
|
|
20
|
-
? typeof values[0] === 'object' && 'code' in values[0]
|
|
21
|
-
? values[0].code
|
|
22
|
-
: ''
|
|
23
|
-
: values.map((value) => typeof value === 'object' && 'code' in value
|
|
24
|
-
? value.code
|
|
25
|
-
: '');
|
|
26
|
-
}
|
|
27
|
-
else if (fieldPayload.type === 'file' &&
|
|
28
|
-
fieldPayload.is_multiple_values_allowed === true) {
|
|
29
|
-
localData[formFieldKey] = values.filter((value) => typeof value === 'string');
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
localData[formFieldKey] = values[0] ?? '';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
localData[formFieldKey] =
|
|
37
|
-
internationalWireFormPayload[formFieldKey].type === 'enum' &&
|
|
38
|
-
internationalWireFormPayload[formFieldKey]
|
|
39
|
-
.is_multiple_values_allowed === true
|
|
40
|
-
? []
|
|
41
|
-
: '';
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
actions.push(updateVerificationFormLocalData(localData));
|
|
45
|
-
return from(actions);
|
|
10
|
+
const localData = toVerificationFormLocalDataFromOnboardingDetails(onboardingDataFromCompanyInfo, internationalWireFormPayload);
|
|
11
|
+
return from([updateVerificationFormLocalData(localData)]);
|
|
46
12
|
}));
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { InternationalWireVerificationBooleanWithSubfieldsFieldNames, InternationalWireVerificationFormFieldNames, } from './internationalWireVerificationFieldConstants';
|
|
2
|
+
import { appendIntlWireFileOptionsToLocalData, appendIntlWirePersonToLocalData, isIntlWireFileOptionLike, isIntlWirePersonLike, toIntlWireFileOptionArray, } from './internationalWireVerificationLocalDataHelpers';
|
|
3
|
+
const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
|
|
4
|
+
InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
5
|
+
InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
6
|
+
InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
7
|
+
]);
|
|
8
|
+
const toValuesArray = (values) => {
|
|
9
|
+
if (values == null) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(values)) {
|
|
13
|
+
return values;
|
|
14
|
+
}
|
|
15
|
+
return [values];
|
|
16
|
+
};
|
|
17
|
+
const getCodeFromValue = (value) => {
|
|
18
|
+
if (typeof value === 'string') {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
if (typeof value === 'object' &&
|
|
22
|
+
value != null &&
|
|
23
|
+
'code' in value &&
|
|
24
|
+
typeof value.code === 'string') {
|
|
25
|
+
return value.code;
|
|
26
|
+
}
|
|
27
|
+
return '';
|
|
28
|
+
};
|
|
29
|
+
const setEmptyFieldDefault = (localData, fieldKey, fieldPayload) => {
|
|
30
|
+
if (fieldPayload.type === 'enum') {
|
|
31
|
+
localData[fieldKey] =
|
|
32
|
+
fieldPayload.is_multiple_values_allowed === true ? [] : '';
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (fieldPayload.type === 'boolean_with_subfields') {
|
|
36
|
+
if (fieldKey ===
|
|
37
|
+
InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
|
|
38
|
+
localData[fieldKey] = 'false';
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (fieldKey ===
|
|
42
|
+
InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
43
|
+
localData[fieldKey] = fieldPayload.default === true ? 'true' : 'false';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const parseEnumValues = (localData, fieldKey, fieldPayload, values) => {
|
|
48
|
+
if (fieldPayload.is_multiple_values_allowed === true) {
|
|
49
|
+
localData[fieldKey] = values
|
|
50
|
+
.map(getCodeFromValue)
|
|
51
|
+
.filter((code) => code.length > 0);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
55
|
+
};
|
|
56
|
+
const parseFileValues = (localData, fieldKey, fieldPayload, values) => {
|
|
57
|
+
if (values.length > 0 &&
|
|
58
|
+
(isIntlWireFileOptionLike(values[0]) ||
|
|
59
|
+
MULTI_OPTION_FILE_FIELD_NAMES.has(fieldKey))) {
|
|
60
|
+
const fileOptions = toIntlWireFileOptionArray(values);
|
|
61
|
+
if (fileOptions.length > 0) {
|
|
62
|
+
appendIntlWireFileOptionsToLocalData(localData, fieldKey, fileOptions);
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const fileIds = values.filter((value) => typeof value === 'string' && value.length > 0);
|
|
67
|
+
if (fieldPayload.is_multiple_values_allowed === true) {
|
|
68
|
+
localData[fieldKey] = fileIds;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
localData[fieldKey] = fileIds[0] ?? '';
|
|
72
|
+
};
|
|
73
|
+
const parseBooleanWithSubfieldsValues = (localData, fieldKey, fieldPayload, rawValues) => {
|
|
74
|
+
if (fieldKey ===
|
|
75
|
+
InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
|
|
76
|
+
if (isIntlWirePersonLike(rawValues)) {
|
|
77
|
+
localData[fieldKey] = 'false';
|
|
78
|
+
appendIntlWirePersonToLocalData(localData, fieldKey, rawValues);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const values = toValuesArray(rawValues);
|
|
82
|
+
if (values.length > 0 && isIntlWirePersonLike(values[0])) {
|
|
83
|
+
localData[fieldKey] = 'false';
|
|
84
|
+
appendIntlWirePersonToLocalData(localData, fieldKey, values[0]);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const selection = getCodeFromValue(values[0]);
|
|
88
|
+
localData[fieldKey] =
|
|
89
|
+
selection.length > 0
|
|
90
|
+
? selection
|
|
91
|
+
: fieldPayload.default === true
|
|
92
|
+
? 'true'
|
|
93
|
+
: 'false';
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (fieldKey ===
|
|
97
|
+
InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
|
|
98
|
+
const values = toValuesArray(rawValues);
|
|
99
|
+
if (values.length > 0 && isIntlWirePersonLike(values[0])) {
|
|
100
|
+
localData[fieldKey] = 'true';
|
|
101
|
+
values.forEach((person, ownerIndex) => {
|
|
102
|
+
if (isIntlWirePersonLike(person)) {
|
|
103
|
+
appendIntlWirePersonToLocalData(localData, `${fieldKey}_${ownerIndex}`, person);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const selection = getCodeFromValue(values[0]);
|
|
109
|
+
localData[fieldKey] = selection.length > 0 ? selection : 'false';
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
export const toVerificationFormLocalDataFromOnboardingDetails = (onboardingDetails, internationalWireFormPayload) => {
|
|
113
|
+
const localData = {};
|
|
114
|
+
Object.keys(internationalWireFormPayload).forEach((fieldKey) => {
|
|
115
|
+
const fieldPayload = internationalWireFormPayload[fieldKey];
|
|
116
|
+
const rawValues = onboardingDetails?.[fieldKey]?.values;
|
|
117
|
+
if (rawValues == null) {
|
|
118
|
+
setEmptyFieldDefault(localData, fieldKey, fieldPayload);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (fieldPayload.type === 'boolean_with_subfields') {
|
|
122
|
+
parseBooleanWithSubfieldsValues(localData, fieldKey, fieldPayload, rawValues);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const values = toValuesArray(rawValues);
|
|
126
|
+
if (values.length === 0) {
|
|
127
|
+
setEmptyFieldDefault(localData, fieldKey, fieldPayload);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
switch (fieldPayload.type) {
|
|
131
|
+
case 'enum':
|
|
132
|
+
parseEnumValues(localData, fieldKey, fieldPayload, values);
|
|
133
|
+
break;
|
|
134
|
+
case 'file':
|
|
135
|
+
parseFileValues(localData, fieldKey, fieldPayload, values);
|
|
136
|
+
break;
|
|
137
|
+
case 'date':
|
|
138
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
139
|
+
break;
|
|
140
|
+
default:
|
|
141
|
+
localData[fieldKey] = getCodeFromValue(values[0]);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
return localData;
|
|
146
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { InternationalWireVerificationSubfieldNames } from './internationalWireVerificationFieldConstants';
|
|
2
|
+
import { IntlWireVerificationLocalDataSuffix } from './internationalWireVerificationSubmitPayload';
|
|
3
|
+
export const isIntlWireFileOptionLike = (value) => typeof value === 'object' &&
|
|
4
|
+
value != null &&
|
|
5
|
+
'file_id' in value &&
|
|
6
|
+
typeof value.file_id === 'string';
|
|
7
|
+
export const isIntlWirePersonLike = (value) => typeof value === 'object' && value != null && !Array.isArray(value);
|
|
8
|
+
export const toIntlWireFileOptionArray = (items) => items.filter(isIntlWireFileOptionLike);
|
|
9
|
+
export const appendIntlWireFileOptionsToLocalData = (localData, baseKey, fileOptions) => {
|
|
10
|
+
const [front, back] = fileOptions;
|
|
11
|
+
if (front?.file_id != null && front.file_id !== '') {
|
|
12
|
+
localData[baseKey] = front.file_id;
|
|
13
|
+
if (front.option != null && front.option !== '') {
|
|
14
|
+
localData[`${baseKey}${IntlWireVerificationLocalDataSuffix.documentOption}`] = front.option;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (back?.file_id != null && back.file_id !== '') {
|
|
18
|
+
localData[`${baseKey}${IntlWireVerificationLocalDataSuffix.documentBack}`] =
|
|
19
|
+
back.file_id;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const appendIntlWirePersonToLocalData = (localData, keyPrefix, person) => {
|
|
23
|
+
const nameBaseKey = `${keyPrefix}_${InternationalWireVerificationSubfieldNames.name}`;
|
|
24
|
+
if (person.name?.first_name != null) {
|
|
25
|
+
localData[`${nameBaseKey}${IntlWireVerificationLocalDataSuffix.nameFirst}`] = person.name.first_name;
|
|
26
|
+
}
|
|
27
|
+
if (person.name?.last_name != null) {
|
|
28
|
+
localData[`${nameBaseKey}${IntlWireVerificationLocalDataSuffix.nameLast}`] = person.name.last_name;
|
|
29
|
+
}
|
|
30
|
+
const assignStringField = (subfieldName, fieldValue) => {
|
|
31
|
+
if (fieldValue != null && fieldValue !== '') {
|
|
32
|
+
localData[`${keyPrefix}_${subfieldName}`] = fieldValue;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
assignStringField(InternationalWireVerificationSubfieldNames.nationality, person.nationality);
|
|
36
|
+
assignStringField(InternationalWireVerificationSubfieldNames.email, person.email);
|
|
37
|
+
assignStringField(InternationalWireVerificationSubfieldNames.companyRole, person.company_role);
|
|
38
|
+
assignStringField(InternationalWireVerificationSubfieldNames.ssn, person.ssn);
|
|
39
|
+
assignStringField(InternationalWireVerificationSubfieldNames.dateOfBirth, person.date_of_birth);
|
|
40
|
+
if (person.ownership_percentage != null) {
|
|
41
|
+
localData[`${keyPrefix}_${InternationalWireVerificationSubfieldNames.ownershipPercentage}`] = person.ownership_percentage;
|
|
42
|
+
}
|
|
43
|
+
if (person.proof_of_identity != null) {
|
|
44
|
+
appendIntlWireFileOptionsToLocalData(localData, `${keyPrefix}_${InternationalWireVerificationSubfieldNames.proofOfIdentity}`, toIntlWireFileOptionArray(person.proof_of_identity));
|
|
45
|
+
}
|
|
46
|
+
if (person.proof_of_address != null) {
|
|
47
|
+
appendIntlWireFileOptionsToLocalData(localData, `${keyPrefix}_${InternationalWireVerificationSubfieldNames.proofOfAddress}`, toIntlWireFileOptionArray(person.proof_of_address));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export const getStakeHolderOwnerIndicesFromLocalData = (localData) => {
|
|
51
|
+
const indices = new Set();
|
|
52
|
+
Object.keys(localData).forEach((key) => {
|
|
53
|
+
const match = key.match(/^stake_holder_(\d+)_/);
|
|
54
|
+
if (match != null) {
|
|
55
|
+
indices.add(Number.parseInt(match[1], 10));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return Array.from(indices).sort((a, b) => a - b);
|
|
59
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -900,6 +900,8 @@ export { Country };
|
|
|
900
900
|
export { InternationalWireVerificationState, VerificationFormField, VerificationFormFieldOption, VerificationFormLocalData, VerificationFormSubField, FieldValueType, InternationalWireVerificationFormOrder, sortVerificationFormFields, fetchInternationalVerificationForm, submitInternationalVerificationForm, updateVerificationFormLocalData, getIntlWireVerificationView, InternationalWireVerificationView, };
|
|
901
901
|
export { InternationalWireVerificationBooleanWithSubfieldsFieldNameList, InternationalWireVerificationBooleanWithSubfieldsFieldNames, InternationalWireVerificationControllingPersonFieldName, InternationalWireVerificationFormFieldNames, InternationalWireVerificationStakeHolderFieldName, InternationalWireVerificationSubfieldNames, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants';
|
|
902
902
|
export { IntlWireVerificationLocalDataSuffix, toIntlWireVerificationFormDetails, toIntlWireVerificationSubmitPayload, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload';
|
|
903
|
+
export { getStakeHolderOwnerIndicesFromLocalData, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers';
|
|
904
|
+
export { toVerificationFormLocalDataFromOnboardingDetails, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData';
|
|
903
905
|
export type { InternationalWireVerificationBooleanWithSubfieldsFieldName, InternationalWireVerificationFormFieldName, InternationalWireVerificationSubfieldName, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants';
|
|
904
906
|
export { fetchExpressPayInitialDetails, updateExpressPayFormLocalData, submitExpressPay, resetExpressPayLocalData, ExpressPayFormLocalData, ExpressPayView, getExpressPayView, };
|
|
905
907
|
export { acceptTreasuryTerms, fetchTreasurySetupView, clearTreasurySetupView, fetchTreasuryFunds, updatePortfolioAllocation, fetchPortfolioAllocation, updateFundAllocationLocalData, updateTreasuryPromoIntroClosedByOutsideClick, updateTreasuryPromoRemindMeLaterClicked, updateTreasuryVideoViewed, FundAllocationOption, FundComposition, FundData, TreasurySetupView, getTreasurySetupViewDetails, getTreasuryFundsMaximumYield, };
|
package/lib/index.js
CHANGED
|
@@ -69,10 +69,10 @@ exports.getDefaultSelectedTimeframeForScheduleType = exports.getFetchStateForSch
|
|
|
69
69
|
exports.getTaskDetail = exports.fetchTaskListPage = exports.getAllTasks = exports.getTaskGroupById = exports.toRecurringBillFrequencyStrict = exports.toRecurringBillFrequency = exports.updateArAgingNodeCollapseState = exports.getArAgingDetailForCustomer = exports.getArAgingReport = exports.updateArAgingDetailUIState = exports.fetchArAgingDetail = exports.updateArAgingUIState = exports.fetchArAging = exports.updateVendorGlobalReviewViewLocalData = exports.toVendorGlobalReviewColumnSortKeyType = exports.getTenantMerchantByMerchantId = exports.getVendorGlobalReviewView = exports.updateVendorGlobalReviewViewUIState = exports.updateSelectedGlobalMerchant = exports.fetchVendorGlobalReviewView = exports.rejectVendorGlobalReview = exports.approveVendorGlobalReview = exports.getGlobalMerchantView = exports.clearGlobalMerchantView = exports.updateCreateGlobalMerchantLocalData = exports.createGlobalMerchant = exports.fetchGlobalMerchantRecommendation = exports.getVendorDetailSelectorView = exports.saveVendorDetailsView = exports.updateReviewVendorDetailLocalData = exports.clearGlobalMerchantAutoCompleteResults = exports.fetchGlobalMerchantAutoCompleteView = exports.updateVendorFirstReviewSortUiState = exports.updateVendorFirstReviewViewLocalData = exports.saveVendorFirstReviewView = exports.clearRecentlySavedErroredVendorData = exports.updateVendorFirstReviewViewPageToken = exports.resetVendorFirstReviewLocalData = exports.updateVendorFirstReviewViewScrollYOffset = exports.fetchVendorFirstReviewAttachments = exports.fetchVendorFirstReviewView = exports.getVendorFirstReviewAttachmentView = exports.getVendorFirstReviewView = exports.getGlobalMerchantAutoCompleteResults = exports.toVendorFirstReviewViewColumnKeyType = exports.getVendorTabView = exports.updateVendorTabViewTab = exports.fetchVendorTabView = exports.resetMarkAsCompleteStatus = exports.markAsCompleteScheduleDetail = void 0;
|
|
70
70
|
exports.fetchPaymentSources = exports.addCardPaymentSource = exports.confirmCardSetupIntent = exports.createCardSetupIntent = exports.getAllCardsAndBankPaymentMethods = exports.deleteTag = exports.createTag = exports.fetchTagList = exports.getAllTags = exports.ALL_TASK_LIST_TABS = exports.initialTaskDetailLocalData = exports.convertHHMMStrToMinutes = exports.unsnoozeTask = exports.snoozeTask = exports.removeTaskFromList = exports.updateTaskListTab = exports.updateTaskFromListView = exports.toDueDateGroupKeyType = exports.toTaskStatusCodeType = exports.toPriorityCodeType = exports.getDueDateValueFromDueDateGroupId = exports.initialTaskDetail = exports.fetchAllTaskGroups = exports.getTaskUpdates = exports.toTaskListGroupByKeyTypeStrict = exports.toTaskListGroupByKeyType = exports.updateTaskGroupName = exports.dragNDropTasks = exports.updateTaskListLocalData = exports.deleteTaskGroup = exports.initiateTaskListLocalData = exports.createNewTaskGroup = exports.bulkUpdateTaskList = exports.discardTaskUpdatesInLocalStore = exports.deleteTask = exports.TASK_LIST_GROUP_BY_CATEGORIES = exports.TASK_LIST_FILTER_CATEGORIES = exports.updateTaskFilters = exports.allTaskPriority = exports.allTaskStatus = exports.updateTaskListUIState = exports.updateTaskListSearchText = exports.getCannedResponsesView = exports.deleteCannedResponse = exports.saveCannedResponse = exports.fetchCannedResponses = exports.archiveTask = exports.saveTaskDetail = exports.saveTaskUpdatesToLocalStore = exports.fetchTaskDetailPage = void 0;
|
|
71
71
|
exports.getInviteFormView = exports.getReferralListView = exports.getNotifications = exports.getLastNotificationTime = exports.pushToastNotification = exports.isFeatureInterestRegistered = exports.getRegisteredInterestsByFeature = exports.getRegisteredInterests = exports.getFeatureNotificationView = exports.notifyMeForFeature = exports.fetchRegisteredInterests = exports.clearFeatureNotificationView = exports.getNotificationsForSelectedSubTab = exports.getExternalNotificationsForSelectedSubTab = exports.getNotificationView = exports.updateNotificationViewUIState = exports.updateNotificationViewSubTab = exports.updateNotificationViewCurrentTabAndSubTab = exports.updateNotificationViewTabState = exports.updateNotificationViewNotificationStatus = exports.updateNotificationViewAllNotificationsStatus = exports.fetchNotificationUnreadCountSuccess = exports.fetchNotificationUnreadCount = exports.fetchNotificationView = exports.toNotificationTabTypeStrict = exports.toNotificationSubTabTypeStrict = exports.updateCommentsNotificationsStatuses = exports.updateCommentsNotifications = exports.toNotificationModeStrict = exports.parseOAuthParams = exports.getZeniOAuthApproveRedirectUrl = exports.getZeniOAuthApproveFetchState = exports.getZeniOAuthApproveError = exports.clearZeniOAuthView = exports.approveOAuthConsentSuccess = exports.approveOAuthConsentFailure = exports.approveOAuthConsent = exports.fetchZeniAccountsPromoCard = exports.getZeniAccountsPromoCard = exports.getAuthenticationView = exports.fetchCollaborationAuthToken = exports.clearAuditReportGroupViewByCompanyId = exports.saveReasonForAuditRule = exports.fetchAuditReportGroupView = exports.fetchAuditRuleGroupView = exports.getUserFromAllUsers = exports.getAuditRuleGroupViewSelectorView = exports.getAuditReportGroupViewSelectorView = exports.clearCardPaymentView = exports.resetCardPaymentErrorStatuses = void 0;
|
|
72
|
-
exports.
|
|
73
|
-
exports.
|
|
74
|
-
exports.
|
|
75
|
-
exports.DEFAULT_SESSION_CONFIG = exports.SessionManager = exports.getTransactionActivityLogView = exports.fetchTransactionActivityLog = exports.BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = exports.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = void 0;
|
|
72
|
+
exports.fetchPortfolioAllocation = exports.updatePortfolioAllocation = exports.fetchTreasuryFunds = exports.clearTreasurySetupView = exports.fetchTreasurySetupView = exports.acceptTreasuryTerms = exports.getExpressPayView = exports.resetExpressPayLocalData = exports.submitExpressPay = exports.updateExpressPayFormLocalData = exports.fetchExpressPayInitialDetails = exports.toVerificationFormLocalDataFromOnboardingDetails = exports.getStakeHolderOwnerIndicesFromLocalData = exports.toIntlWireVerificationSubmitPayload = exports.toIntlWireVerificationFormDetails = exports.IntlWireVerificationLocalDataSuffix = exports.InternationalWireVerificationSubfieldNames = exports.InternationalWireVerificationStakeHolderFieldName = exports.InternationalWireVerificationFormFieldNames = exports.InternationalWireVerificationControllingPersonFieldName = exports.InternationalWireVerificationBooleanWithSubfieldsFieldNames = exports.InternationalWireVerificationBooleanWithSubfieldsFieldNameList = exports.getIntlWireVerificationView = exports.updateVerificationFormLocalData = exports.submitInternationalVerificationForm = exports.fetchInternationalVerificationForm = exports.sortVerificationFormFields = exports.InternationalWireVerificationFormOrder = exports.createTaskFromTaskGroupTemplate = exports.getCompanyTaskManagerView = exports.fetchTaskManagerMetrics = exports.fetchCompanyTaskManagerView = exports.toRecurringFrequency = exports.toDayOfWeek = exports.getRecurringEndDateFromCount = exports.getMinAllowedEndDate = exports.SEMI_WEEKLY_REQUIRED_DAYS_COUNT = exports.ALL_WEEK_DAYS = exports.updateReferViewed = exports.getRewardsPlanCard = exports.fetchRewardsPlan = exports.resendReferralInvite = exports.updateReferralListSortUiState = exports.saveReferralFormDataInLocalStore = exports.clearReferrals = exports.sendReferralInvite = exports.fetchReferrals = exports.AmountStatusTypes = exports.StatusTypes = exports.toReferralListViewSortKeyType = void 0;
|
|
73
|
+
exports.applyAiCfoSidePanelHostPageTransition = exports.fetchSuggestedQuestionsFailure = exports.fetchSuggestedQuestionsSuccess = exports.fetchSuggestedQuestions = exports.updateResponseState = exports.deleteChatSession = exports.acceptMasterTOS = exports.fetchChatHistory = exports.stopSubmitQuestion = exports.stopSubmit = exports.createSessionAndSubmit = exports.clearLastContextMessage = exports.clearDeleteChatSessionStatus = exports.clearCurrentSessionId = exports.clearAiCfoView = exports.setSession = exports.clearInput = exports.updateCotCollapsedState = exports.updateCurrentInput = exports.updateAiCfoViewScrollPosition = exports.submitQuestion = exports.createSession = exports.fetchChatSessionsForUser = exports.getAiAccountantCockpitView = exports.updateAiAccountantUIState = exports.triggerAiAccountantJob = exports.setSelectedTenantIdsForJobTrigger = exports.fetchAiAccountantJobs = exports.fetchAiAccountantCustomers = exports.clearAiAccountantView = exports.cancelAiAccountantOnboarding = exports.getAiAccountantJobsByTenantId = exports.getAiAccountantCustomers = exports.updateAiAccountantJobs = exports.updateAiAccountantCustomer = exports.updateAiAccountantCustomers = exports.clearAllAiAccountantCustomers = exports.toAiAccountantJob = exports.toAiAccountantEnrollment = exports.toAiAccountantCustomer = exports.toAiAccountantOperationType = exports.toAiAccountantJobStatus = exports.toAiAccountantEnrollmentStatus = exports.getAllowedOperationsForStatus = exports.getTreasuryFundsMaximumYield = exports.getTreasurySetupViewDetails = exports.updateTreasuryVideoViewed = exports.updateTreasuryPromoRemindMeLaterClicked = exports.updateTreasuryPromoIntroClosedByOutsideClick = exports.updateFundAllocationLocalData = void 0;
|
|
74
|
+
exports.getAutoTransferRules = exports.clearRuleUpdateLocalData = exports.updateRuleLocalData = exports.fetchAutoTransferReviewDetail = exports.fetchAutoTransferRuleHistory = exports.deleteAutoTransferRule = exports.updateAutoTransferRule = exports.createAutoTransferRule = exports.fetchAutoTransferRules = exports.getTreasuryTaxLetters = exports.fetchTreasuryTaxLetterList = exports.getTreasuryStatements = exports.fetchTreasuryStatementList = exports.getTreasuryTransferMoney = exports.clearTreasuryTransferMoney = exports.updateTreasuryTransferMoneyLocalData = exports.executeTreasuryTransferMoney = exports.getTreasuryDetail = exports.updateTreasuryTransactionListUIState = exports.fetchTreasuryTransactionList = exports.fetchTreasuryOverviewDetail = exports.toMessageType = exports.toMessageSender = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerStateType = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = exports.toAiCfoVisualizationType = exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CFO_ANSWER_STATE_TYPES = exports.ALL_AI_CFO_VISUALIZATION_TYPES = exports.ALL_AI_CFO_CHARTS_TYPES = exports.getAiCfoSelectorView = exports.getAllQuestionsForChatSession = exports.getQuestionAnswerByIdForChatSession = exports.getAllQuestionAnswersForChatSession = exports.toAiCfoVisualization = exports.clearAiCfo = exports.clearSession = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setSessions = exports.setNewSession = exports.getSuggestedQuestionsForPageContext = exports.getAiCfoView = exports.clearAiCfoSidePanelHostPageContext = void 0;
|
|
75
|
+
exports.DEFAULT_SESSION_CONFIG = exports.SessionManager = exports.getTransactionActivityLogView = exports.fetchTransactionActivityLog = exports.BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = exports.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = exports.getAutoTransferRuleHistory = exports.getAutoTransferRuleById = void 0;
|
|
76
76
|
const allowedValue_1 = require("./commonStateTypes/allowedValue");
|
|
77
77
|
Object.defineProperty(exports, "isAllowedValueWithCode", { enumerable: true, get: function () { return allowedValue_1.isAllowedValueWithCode; } });
|
|
78
78
|
Object.defineProperty(exports, "isAllowedValueWithID", { enumerable: true, get: function () { return allowedValue_1.isAllowedValueWithID; } });
|
|
@@ -2228,6 +2228,10 @@ var internationalWireVerificationSubmitPayload_1 = require("./view/spendManageme
|
|
|
2228
2228
|
Object.defineProperty(exports, "IntlWireVerificationLocalDataSuffix", { enumerable: true, get: function () { return internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix; } });
|
|
2229
2229
|
Object.defineProperty(exports, "toIntlWireVerificationFormDetails", { enumerable: true, get: function () { return internationalWireVerificationSubmitPayload_1.toIntlWireVerificationFormDetails; } });
|
|
2230
2230
|
Object.defineProperty(exports, "toIntlWireVerificationSubmitPayload", { enumerable: true, get: function () { return internationalWireVerificationSubmitPayload_1.toIntlWireVerificationSubmitPayload; } });
|
|
2231
|
+
var internationalWireVerificationLocalDataHelpers_1 = require("./view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers");
|
|
2232
|
+
Object.defineProperty(exports, "getStakeHolderOwnerIndicesFromLocalData", { enumerable: true, get: function () { return internationalWireVerificationLocalDataHelpers_1.getStakeHolderOwnerIndicesFromLocalData; } });
|
|
2233
|
+
var internationalWireOnboardingDetailsToLocalData_1 = require("./view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData");
|
|
2234
|
+
Object.defineProperty(exports, "toVerificationFormLocalDataFromOnboardingDetails", { enumerable: true, get: function () { return internationalWireOnboardingDetailsToLocalData_1.toVerificationFormLocalDataFromOnboardingDetails; } });
|
|
2231
2235
|
// ── AI Accountant Entity ──
|
|
2232
2236
|
var aiAccountantCustomerState_1 = require("./entity/aiAccountantCustomer/aiAccountantCustomerState");
|
|
2233
2237
|
Object.defineProperty(exports, "getAllowedOperationsForStatus", { enumerable: true, get: function () { return aiAccountantCustomerState_1.getAllowedOperationsForStatus; } });
|
|
@@ -3,48 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initializeIntlVerificationFormEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const internationalWireOnboardingDetailsToLocalData_1 = require("../internationalWireOnboardingDetailsToLocalData");
|
|
6
7
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
7
8
|
const initializeIntlVerificationFormEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.initializeIntlVerificationForm.match), (0, operators_1.mergeMap)((action) => {
|
|
8
9
|
const { companyId, internationalWireFormPayload } = action.payload;
|
|
9
|
-
const actions = [];
|
|
10
10
|
const state = state$.value;
|
|
11
11
|
const onboardingDataFromCompanyInfo = state.companyState.companiesById[companyId].companyBillPayInfo
|
|
12
12
|
.internationalWireOnboardingDetails;
|
|
13
|
-
const localData =
|
|
14
|
-
|
|
15
|
-
const values = onboardingDataFromCompanyInfo != null
|
|
16
|
-
? onboardingDataFromCompanyInfo[formFieldKey]?.values
|
|
17
|
-
: undefined;
|
|
18
|
-
if (values != null) {
|
|
19
|
-
const fieldPayload = internationalWireFormPayload[formFieldKey];
|
|
20
|
-
if (fieldPayload.type === 'enum') {
|
|
21
|
-
localData[formFieldKey] =
|
|
22
|
-
fieldPayload.is_multiple_values_allowed === false
|
|
23
|
-
? typeof values[0] === 'object' && 'code' in values[0]
|
|
24
|
-
? values[0].code
|
|
25
|
-
: ''
|
|
26
|
-
: values.map((value) => typeof value === 'object' && 'code' in value
|
|
27
|
-
? value.code
|
|
28
|
-
: '');
|
|
29
|
-
}
|
|
30
|
-
else if (fieldPayload.type === 'file' &&
|
|
31
|
-
fieldPayload.is_multiple_values_allowed === true) {
|
|
32
|
-
localData[formFieldKey] = values.filter((value) => typeof value === 'string');
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
localData[formFieldKey] = values[0] ?? '';
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
localData[formFieldKey] =
|
|
40
|
-
internationalWireFormPayload[formFieldKey].type === 'enum' &&
|
|
41
|
-
internationalWireFormPayload[formFieldKey]
|
|
42
|
-
.is_multiple_values_allowed === true
|
|
43
|
-
? []
|
|
44
|
-
: '';
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
actions.push((0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)(localData));
|
|
48
|
-
return (0, rxjs_1.from)(actions);
|
|
13
|
+
const localData = (0, internationalWireOnboardingDetailsToLocalData_1.toVerificationFormLocalDataFromOnboardingDetails)(onboardingDataFromCompanyInfo, internationalWireFormPayload);
|
|
14
|
+
return (0, rxjs_1.from)([(0, internationalWireVerificationReducer_1.updateVerificationFormLocalData)(localData)]);
|
|
49
15
|
}));
|
|
50
16
|
exports.initializeIntlVerificationFormEpic = initializeIntlVerificationFormEpic;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LabelValueCodesPayload } from '../../../../commonPayloadTypes/commonPayload';
|
|
2
|
+
import { FieldPayload } from './internationalWireVerificationPayload';
|
|
3
|
+
import { VerificationFormLocalData } from './internationalWireVerificationState';
|
|
4
|
+
export declare const toVerificationFormLocalDataFromOnboardingDetails: (onboardingDetails: Record<string, LabelValueCodesPayload> | undefined, internationalWireFormPayload: Record<string, FieldPayload>) => VerificationFormLocalData;
|
|
@@ -0,0 +1,150 @@
|
|
|
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;
|
|
@@ -0,0 +1,26 @@
|
|
|
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[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
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) => typeof value === 'object' && value != null && !Array.isArray(value);
|
|
12
|
+
exports.isIntlWirePersonLike = isIntlWirePersonLike;
|
|
13
|
+
const toIntlWireFileOptionArray = (items) => items.filter(exports.isIntlWireFileOptionLike);
|
|
14
|
+
exports.toIntlWireFileOptionArray = toIntlWireFileOptionArray;
|
|
15
|
+
const appendIntlWireFileOptionsToLocalData = (localData, baseKey, fileOptions) => {
|
|
16
|
+
const [front, back] = fileOptions;
|
|
17
|
+
if (front?.file_id != null && front.file_id !== '') {
|
|
18
|
+
localData[baseKey] = front.file_id;
|
|
19
|
+
if (front.option != null && front.option !== '') {
|
|
20
|
+
localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentOption}`] = front.option;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (back?.file_id != null && back.file_id !== '') {
|
|
24
|
+
localData[`${baseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.documentBack}`] =
|
|
25
|
+
back.file_id;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.appendIntlWireFileOptionsToLocalData = appendIntlWireFileOptionsToLocalData;
|
|
29
|
+
const appendIntlWirePersonToLocalData = (localData, keyPrefix, person) => {
|
|
30
|
+
const nameBaseKey = `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.name}`;
|
|
31
|
+
if (person.name?.first_name != null) {
|
|
32
|
+
localData[`${nameBaseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.nameFirst}`] = person.name.first_name;
|
|
33
|
+
}
|
|
34
|
+
if (person.name?.last_name != null) {
|
|
35
|
+
localData[`${nameBaseKey}${internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix.nameLast}`] = person.name.last_name;
|
|
36
|
+
}
|
|
37
|
+
const assignStringField = (subfieldName, fieldValue) => {
|
|
38
|
+
if (fieldValue != null && fieldValue !== '') {
|
|
39
|
+
localData[`${keyPrefix}_${subfieldName}`] = fieldValue;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.nationality, person.nationality);
|
|
43
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.email, person.email);
|
|
44
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.companyRole, person.company_role);
|
|
45
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ssn, person.ssn);
|
|
46
|
+
assignStringField(internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.dateOfBirth, person.date_of_birth);
|
|
47
|
+
if (person.ownership_percentage != null) {
|
|
48
|
+
localData[`${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.ownershipPercentage}`] = person.ownership_percentage;
|
|
49
|
+
}
|
|
50
|
+
if (person.proof_of_identity != null) {
|
|
51
|
+
(0, exports.appendIntlWireFileOptionsToLocalData)(localData, `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity}`, (0, exports.toIntlWireFileOptionArray)(person.proof_of_identity));
|
|
52
|
+
}
|
|
53
|
+
if (person.proof_of_address != null) {
|
|
54
|
+
(0, exports.appendIntlWireFileOptionsToLocalData)(localData, `${keyPrefix}_${internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfAddress}`, (0, exports.toIntlWireFileOptionArray)(person.proof_of_address));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.appendIntlWirePersonToLocalData = appendIntlWirePersonToLocalData;
|
|
58
|
+
const getStakeHolderOwnerIndicesFromLocalData = (localData) => {
|
|
59
|
+
const indices = new Set();
|
|
60
|
+
Object.keys(localData).forEach((key) => {
|
|
61
|
+
const match = key.match(/^stake_holder_(\d+)_/);
|
|
62
|
+
if (match != null) {
|
|
63
|
+
indices.add(Number.parseInt(match[1], 10));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return Array.from(indices).sort((a, b) => a - b);
|
|
67
|
+
};
|
|
68
|
+
exports.getStakeHolderOwnerIndicesFromLocalData = getStakeHolderOwnerIndicesFromLocalData;
|
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-betaAS4",
|
|
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",
|