@zeniai/client-epic-state 5.0.90-betaAS2 → 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 +4 -1
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +3 -37
- 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/internationalWireVerificationLocalDataHelpers.js +59 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +154 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +15 -7
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +3 -37
- 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/internationalWireVerificationLocalDataHelpers.d.ts +26 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +68 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +2 -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
|
@@ -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
|
@@ -385,8 +385,8 @@ import { getAllTopExpenses, getTop6Expenses, getTopExpenses, } from './view/topE
|
|
|
385
385
|
*/
|
|
386
386
|
import { TOP_EX_TIME_PERIODS, } from './view/topEx/topExState';
|
|
387
387
|
import { getAccountingProviderAttachment, } from './view/transactionDetail/getAccountingProviderAttachmentSelector';
|
|
388
|
-
import { getChangedLineItemCountFromLocalData, isAccountUncategorized, } from './view/transactionDetail/transactionDetailLocalDataHelper';
|
|
389
388
|
import { JOURNAL_ENTRY_SORT_KEYS, filterJournalEntryLinesExcludingLinked, journalEntryDefaultSortConfig, journalEntryTotalsByPostingSide, sortJournalEntryLines, sumJournalEntryAmounts, toJournalEntrySortKey, } from './view/transactionDetail/journalEntryLinesViewModel';
|
|
389
|
+
import { getChangedLineItemCountFromLocalData, isAccountUncategorized, } from './view/transactionDetail/transactionDetailLocalDataHelper';
|
|
390
390
|
import { clearTransactionDetailSaveStatus, deleteTransactionAttachment, downloadAccountingProviderAttachment, downloadAccountingProviderAttachmentFailure, downloadAccountingProviderAttachmentSuccess, fetchTransactionDetail, initializeTransactionDetailLocalData, markCategoryClassRecommendationsFailureForTransactionDetail, removeEntityRecommendationForLineIdForTransactionDetail, resetAllLineItemsToVendor, resetLineItemsCategoryClassInLocalData, resetSelectedCustomer, resetVendor, saveTransactionDetail, saveTransactionDetailLocalData, setAllLineItemsLocalDataIsUpdateAllChecked, setAllLineItemsToCategoryClassInLocalData, setIsVendorUpdateAllChecked, updateLatestSelectedEntity, updateLocalDataWithTransactionsUpdateWithVendorCheckbox, updateSelectedCustomer, updateSelectedVendor, updateTransactionDetail, updateVendorBulkRecommendationsFetchStatus, updateVendorToAllLineItems, uploadMissingAttachmentSuccess, } from './view/transactionDetail/transactionDetailReducer';
|
|
391
391
|
import { getInitialUpdatablePeriodsForTransactionRecommendations, getTransactionDetail, getTransactionDetailForTransaction, } from './view/transactionDetail/transactionDetailSelector';
|
|
392
392
|
import { getThirdPartyIdFromTransactionId, } from './view/transactionDetail/transactionDetailState';
|
|
@@ -638,6 +638,9 @@ export { ALL_WEEK_DAYS, SEMI_WEEKLY_REQUIRED_DAYS_COUNT, getMinAllowedEndDate, g
|
|
|
638
638
|
export { fetchCompanyTaskManagerView, fetchTaskManagerMetrics, getCompanyTaskManagerView, createTaskFromTaskGroupTemplate, };
|
|
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
|
+
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';
|
|
641
644
|
export { fetchExpressPayInitialDetails, updateExpressPayFormLocalData, submitExpressPay, resetExpressPayLocalData, getExpressPayView, };
|
|
642
645
|
export { acceptTreasuryTerms, fetchTreasurySetupView, clearTreasurySetupView, fetchTreasuryFunds, updatePortfolioAllocation, fetchPortfolioAllocation, updateFundAllocationLocalData, updateTreasuryPromoIntroClosedByOutsideClick, updateTreasuryPromoRemindMeLaterClicked, updateTreasuryVideoViewed, getTreasurySetupViewDetails, getTreasuryFundsMaximumYield, };
|
|
643
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
|
}));
|
|
@@ -3,6 +3,7 @@ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
|
3
3
|
import { updateInternationalWireOnboardingStatus } from '../../../../../entity/company/companyReducer';
|
|
4
4
|
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
6
|
+
import { toIntlWireVerificationSubmitPayload } from '../internationalWireVerificationSubmitPayload';
|
|
6
7
|
import { submitInternationalVerificationForm, updateVerificationFormSubmissionStatus, } from '../internationalWireVerificationReducer';
|
|
7
8
|
export const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(submitInternationalVerificationForm.match), switchMap((action) => {
|
|
8
9
|
const { internationalWireVerificationState } = state$.value;
|
|
@@ -10,7 +11,7 @@ export const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions
|
|
|
10
11
|
const localData = internationalWireVerificationState.verificationFormLocalData;
|
|
11
12
|
if (localData != null) {
|
|
12
13
|
return zeniAPI
|
|
13
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`,
|
|
14
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, toIntlWireVerificationSubmitPayload(localData))
|
|
14
15
|
.pipe(mergeMap((response) => {
|
|
15
16
|
const actions = [];
|
|
16
17
|
if (isSuccessResponse(response) && response.data != null) {
|
|
@@ -54,9 +55,3 @@ export const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions
|
|
|
54
55
|
return from([]);
|
|
55
56
|
}
|
|
56
57
|
}));
|
|
57
|
-
const toIntlWireVerificationPayload = (localData) => {
|
|
58
|
-
return {
|
|
59
|
-
is_applicant_declaration: true,
|
|
60
|
-
form_details: localData,
|
|
61
|
-
};
|
|
62
|
-
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { InternationalWireVerificationBooleanWithSubfieldsFieldNames, InternationalWireVerificationFormFieldNames, InternationalWireVerificationSubfieldNames, } from './internationalWireVerificationFieldConstants';
|
|
2
|
+
export const IntlWireVerificationLocalDataSuffix = {
|
|
3
|
+
documentOption: '_option',
|
|
4
|
+
documentBack: '_back',
|
|
5
|
+
nameFirst: '_first_name',
|
|
6
|
+
nameLast: '_last_name',
|
|
7
|
+
};
|
|
8
|
+
const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
|
|
9
|
+
InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
10
|
+
InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
11
|
+
InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
12
|
+
]);
|
|
13
|
+
const BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES = new Set([
|
|
14
|
+
InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder,
|
|
15
|
+
InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson,
|
|
16
|
+
]);
|
|
17
|
+
const FILE_SUBFIELD_NAMES = new Set([
|
|
18
|
+
InternationalWireVerificationSubfieldNames.proofOfIdentity,
|
|
19
|
+
InternationalWireVerificationSubfieldNames.proofOfAddress,
|
|
20
|
+
]);
|
|
21
|
+
const isInternalLocalDataKey = (key) => key.endsWith(IntlWireVerificationLocalDataSuffix.documentOption) ||
|
|
22
|
+
key.endsWith(IntlWireVerificationLocalDataSuffix.documentBack) ||
|
|
23
|
+
key.endsWith(IntlWireVerificationLocalDataSuffix.nameFirst) ||
|
|
24
|
+
key.endsWith(IntlWireVerificationLocalDataSuffix.nameLast);
|
|
25
|
+
const isPersonSubfieldKey = (key) => key.startsWith(`${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`) ||
|
|
26
|
+
key.startsWith(`${InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson}_`);
|
|
27
|
+
const toFileOptionPayloads = (localData, baseKey) => {
|
|
28
|
+
const option = localData[`${baseKey}${IntlWireVerificationLocalDataSuffix.documentOption}`];
|
|
29
|
+
if (typeof option !== 'string' || option.length === 0) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const payloads = [];
|
|
33
|
+
const frontFileId = localData[baseKey];
|
|
34
|
+
if (typeof frontFileId === 'string' && frontFileId.length > 0) {
|
|
35
|
+
payloads.push({ file_id: frontFileId, option });
|
|
36
|
+
}
|
|
37
|
+
const backFileId = localData[`${baseKey}${IntlWireVerificationLocalDataSuffix.documentBack}`];
|
|
38
|
+
if (typeof backFileId === 'string' && backFileId.length > 0) {
|
|
39
|
+
payloads.push({ file_id: backFileId, option });
|
|
40
|
+
}
|
|
41
|
+
return payloads.length > 0 ? payloads : undefined;
|
|
42
|
+
};
|
|
43
|
+
const buildPersonPayload = (localData, keyPrefix) => {
|
|
44
|
+
const person = {};
|
|
45
|
+
const nameBaseKey = `${keyPrefix}_${InternationalWireVerificationSubfieldNames.name}`;
|
|
46
|
+
const firstName = localData[`${nameBaseKey}${IntlWireVerificationLocalDataSuffix.nameFirst}`];
|
|
47
|
+
const lastName = localData[`${nameBaseKey}${IntlWireVerificationLocalDataSuffix.nameLast}`];
|
|
48
|
+
if (typeof firstName === 'string' || typeof lastName === 'string') {
|
|
49
|
+
person.name = {
|
|
50
|
+
first_name: typeof firstName === 'string' ? firstName : '',
|
|
51
|
+
last_name: typeof lastName === 'string' ? lastName : '',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const assignStringField = (subfieldName, assign) => {
|
|
55
|
+
const value = localData[`${keyPrefix}_${subfieldName}`];
|
|
56
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
57
|
+
assign(value);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
assignStringField(InternationalWireVerificationSubfieldNames.nationality, (value) => {
|
|
61
|
+
person.nationality = value;
|
|
62
|
+
});
|
|
63
|
+
assignStringField(InternationalWireVerificationSubfieldNames.email, (value) => {
|
|
64
|
+
person.email = value;
|
|
65
|
+
});
|
|
66
|
+
assignStringField(InternationalWireVerificationSubfieldNames.companyRole, (value) => {
|
|
67
|
+
person.company_role = value;
|
|
68
|
+
});
|
|
69
|
+
assignStringField(InternationalWireVerificationSubfieldNames.ssn, (value) => {
|
|
70
|
+
person.ssn = value;
|
|
71
|
+
});
|
|
72
|
+
assignStringField(InternationalWireVerificationSubfieldNames.dateOfBirth, (value) => {
|
|
73
|
+
person.date_of_birth = value;
|
|
74
|
+
});
|
|
75
|
+
const ownershipValue = localData[`${keyPrefix}_${InternationalWireVerificationSubfieldNames.ownershipPercentage}`];
|
|
76
|
+
if (ownershipValue != null && ownershipValue !== '') {
|
|
77
|
+
person.ownership_percentage = Number(ownershipValue);
|
|
78
|
+
}
|
|
79
|
+
FILE_SUBFIELD_NAMES.forEach((subfieldName) => {
|
|
80
|
+
const filePayloads = toFileOptionPayloads(localData, `${keyPrefix}_${subfieldName}`);
|
|
81
|
+
if (filePayloads != null) {
|
|
82
|
+
if (subfieldName ===
|
|
83
|
+
InternationalWireVerificationSubfieldNames.proofOfIdentity) {
|
|
84
|
+
person.proof_of_identity = filePayloads;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
person.proof_of_address = filePayloads;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return person;
|
|
92
|
+
};
|
|
93
|
+
const getStakeHolderOwnerIndices = (localData) => {
|
|
94
|
+
const stakeHolderPrefix = `${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`;
|
|
95
|
+
const indices = new Set();
|
|
96
|
+
Object.keys(localData).forEach((key) => {
|
|
97
|
+
const match = key.match(/^stake_holder_(\d+)_/);
|
|
98
|
+
if (match != null) {
|
|
99
|
+
indices.add(Number.parseInt(match[1], 10));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
if (indices.size === 0) {
|
|
103
|
+
const hasUnindexedStakeHolderData = Object.keys(localData).some((key) => key.startsWith(stakeHolderPrefix) &&
|
|
104
|
+
!/^stake_holder_(true|false)$/.test(key));
|
|
105
|
+
if (hasUnindexedStakeHolderData) {
|
|
106
|
+
indices.add(0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return Array.from(indices).sort((a, b) => a - b);
|
|
110
|
+
};
|
|
111
|
+
const hasPersonPayloadData = (person) => Object.keys(person).length > 0;
|
|
112
|
+
export const toIntlWireVerificationFormDetails = (localData) => {
|
|
113
|
+
const formDetails = {};
|
|
114
|
+
Object.entries(localData).forEach(([key, value]) => {
|
|
115
|
+
if (BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES.has(key) ||
|
|
116
|
+
isInternalLocalDataKey(key) ||
|
|
117
|
+
isPersonSubfieldKey(key)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (MULTI_OPTION_FILE_FIELD_NAMES.has(key)) {
|
|
121
|
+
const filePayloads = toFileOptionPayloads(localData, key);
|
|
122
|
+
if (filePayloads != null) {
|
|
123
|
+
formDetails[key] = filePayloads;
|
|
124
|
+
}
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (value == null || value === '') {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
formDetails[key] = value;
|
|
131
|
+
});
|
|
132
|
+
const stakeHolderSelection = localData[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder];
|
|
133
|
+
if (stakeHolderSelection === 'true') {
|
|
134
|
+
formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = getStakeHolderOwnerIndices(localData)
|
|
135
|
+
.map((ownerIndex) => buildPersonPayload(localData, `${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_${ownerIndex}`))
|
|
136
|
+
.filter(hasPersonPayloadData);
|
|
137
|
+
}
|
|
138
|
+
else if (stakeHolderSelection === 'false') {
|
|
139
|
+
formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = [];
|
|
140
|
+
}
|
|
141
|
+
const controllingPersonSelection = localData[InternationalWireVerificationBooleanWithSubfieldsFieldNames
|
|
142
|
+
.controllingPerson];
|
|
143
|
+
if (controllingPersonSelection === 'false') {
|
|
144
|
+
const controllingPerson = buildPersonPayload(localData, InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson);
|
|
145
|
+
if (hasPersonPayloadData(controllingPerson)) {
|
|
146
|
+
formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson] = controllingPerson;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return formDetails;
|
|
150
|
+
};
|
|
151
|
+
export const toIntlWireVerificationSubmitPayload = (localData) => ({
|
|
152
|
+
is_applicant_declaration: true,
|
|
153
|
+
form_details: toIntlWireVerificationFormDetails(localData),
|
|
154
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -571,8 +571,8 @@ import { TopExAccount, TopExReport, TopExTimePeriodWithMetaData, TopExpenses } f
|
|
|
571
571
|
*/
|
|
572
572
|
import { TOP_EX_TIME_PERIODS, TopExTimePeriod, TopExpense } from './view/topEx/topExState';
|
|
573
573
|
import { AccountingProviderAttachmentSelector, getAccountingProviderAttachment } from './view/transactionDetail/getAccountingProviderAttachmentSelector';
|
|
574
|
-
import { getChangedLineItemCountFromLocalData, isAccountUncategorized } from './view/transactionDetail/transactionDetailLocalDataHelper';
|
|
575
574
|
import { JOURNAL_ENTRY_SORT_KEYS, JournalEntryRowSortConfig, JournalEntrySortAccessors, JournalEntrySortKey, filterJournalEntryLinesExcludingLinked, journalEntryDefaultSortConfig, journalEntryTotalsByPostingSide, sortJournalEntryLines, sumJournalEntryAmounts, toJournalEntrySortKey } from './view/transactionDetail/journalEntryLinesViewModel';
|
|
575
|
+
import { getChangedLineItemCountFromLocalData, isAccountUncategorized } from './view/transactionDetail/transactionDetailLocalDataHelper';
|
|
576
576
|
import { clearTransactionDetailSaveStatus, deleteTransactionAttachment, downloadAccountingProviderAttachment, downloadAccountingProviderAttachmentFailure, downloadAccountingProviderAttachmentSuccess, fetchTransactionDetail, initializeTransactionDetailLocalData, markCategoryClassRecommendationsFailureForTransactionDetail, removeEntityRecommendationForLineIdForTransactionDetail, resetAllLineItemsToVendor, resetLineItemsCategoryClassInLocalData, resetSelectedCustomer, resetVendor, saveTransactionDetail, saveTransactionDetailLocalData, setAllLineItemsLocalDataIsUpdateAllChecked, setAllLineItemsToCategoryClassInLocalData, setIsVendorUpdateAllChecked, updateLatestSelectedEntity, updateLocalDataWithTransactionsUpdateWithVendorCheckbox, updateSelectedCustomer, updateSelectedVendor, updateTransactionDetail, updateVendorBulkRecommendationsFetchStatus, updateVendorToAllLineItems, uploadMissingAttachmentSuccess } from './view/transactionDetail/transactionDetailReducer';
|
|
577
577
|
import { TransactionDetailReport, VendorDetailsView, getInitialUpdatablePeriodsForTransactionRecommendations, getTransactionDetail, getTransactionDetailForTransaction } from './view/transactionDetail/transactionDetailSelector';
|
|
578
578
|
import { TransactionUpdates, getThirdPartyIdFromTransactionId } from './view/transactionDetail/transactionDetailState';
|
|
@@ -899,6 +899,9 @@ export { fetchCompanyTaskManagerView, fetchTaskManagerMetrics, CompanyTaskManage
|
|
|
899
899
|
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
|
+
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';
|
|
902
905
|
export type { InternationalWireVerificationBooleanWithSubfieldsFieldName, InternationalWireVerificationFormFieldName, InternationalWireVerificationSubfieldName, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants';
|
|
903
906
|
export { fetchExpressPayInitialDetails, updateExpressPayFormLocalData, submitExpressPay, resetExpressPayLocalData, ExpressPayFormLocalData, ExpressPayView, getExpressPayView, };
|
|
904
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 = 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; } });
|
|
@@ -1943,9 +1943,6 @@ const topExState_1 = require("./view/topEx/topExState");
|
|
|
1943
1943
|
Object.defineProperty(exports, "TOP_EX_TIME_PERIODS", { enumerable: true, get: function () { return topExState_1.TOP_EX_TIME_PERIODS; } });
|
|
1944
1944
|
const getAccountingProviderAttachmentSelector_1 = require("./view/transactionDetail/getAccountingProviderAttachmentSelector");
|
|
1945
1945
|
Object.defineProperty(exports, "getAccountingProviderAttachment", { enumerable: true, get: function () { return getAccountingProviderAttachmentSelector_1.getAccountingProviderAttachment; } });
|
|
1946
|
-
const transactionDetailLocalDataHelper_1 = require("./view/transactionDetail/transactionDetailLocalDataHelper");
|
|
1947
|
-
Object.defineProperty(exports, "getChangedLineItemCountFromLocalData", { enumerable: true, get: function () { return transactionDetailLocalDataHelper_1.getChangedLineItemCountFromLocalData; } });
|
|
1948
|
-
Object.defineProperty(exports, "isAccountUncategorized", { enumerable: true, get: function () { return transactionDetailLocalDataHelper_1.isAccountUncategorized; } });
|
|
1949
1946
|
const journalEntryLinesViewModel_1 = require("./view/transactionDetail/journalEntryLinesViewModel");
|
|
1950
1947
|
Object.defineProperty(exports, "JOURNAL_ENTRY_SORT_KEYS", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.JOURNAL_ENTRY_SORT_KEYS; } });
|
|
1951
1948
|
Object.defineProperty(exports, "filterJournalEntryLinesExcludingLinked", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.filterJournalEntryLinesExcludingLinked; } });
|
|
@@ -1954,6 +1951,9 @@ Object.defineProperty(exports, "journalEntryTotalsByPostingSide", { enumerable:
|
|
|
1954
1951
|
Object.defineProperty(exports, "sortJournalEntryLines", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.sortJournalEntryLines; } });
|
|
1955
1952
|
Object.defineProperty(exports, "sumJournalEntryAmounts", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.sumJournalEntryAmounts; } });
|
|
1956
1953
|
Object.defineProperty(exports, "toJournalEntrySortKey", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.toJournalEntrySortKey; } });
|
|
1954
|
+
const transactionDetailLocalDataHelper_1 = require("./view/transactionDetail/transactionDetailLocalDataHelper");
|
|
1955
|
+
Object.defineProperty(exports, "getChangedLineItemCountFromLocalData", { enumerable: true, get: function () { return transactionDetailLocalDataHelper_1.getChangedLineItemCountFromLocalData; } });
|
|
1956
|
+
Object.defineProperty(exports, "isAccountUncategorized", { enumerable: true, get: function () { return transactionDetailLocalDataHelper_1.isAccountUncategorized; } });
|
|
1957
1957
|
const transactionDetailReducer_1 = require("./view/transactionDetail/transactionDetailReducer");
|
|
1958
1958
|
Object.defineProperty(exports, "clearTransactionDetailSaveStatus", { enumerable: true, get: function () { return transactionDetailReducer_1.clearTransactionDetailSaveStatus; } });
|
|
1959
1959
|
Object.defineProperty(exports, "deleteTransactionAttachment", { enumerable: true, get: function () { return transactionDetailReducer_1.deleteTransactionAttachment; } });
|
|
@@ -2224,6 +2224,14 @@ Object.defineProperty(exports, "InternationalWireVerificationControllingPersonFi
|
|
|
2224
2224
|
Object.defineProperty(exports, "InternationalWireVerificationFormFieldNames", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames; } });
|
|
2225
2225
|
Object.defineProperty(exports, "InternationalWireVerificationStakeHolderFieldName", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationStakeHolderFieldName; } });
|
|
2226
2226
|
Object.defineProperty(exports, "InternationalWireVerificationSubfieldNames", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames; } });
|
|
2227
|
+
var internationalWireVerificationSubmitPayload_1 = require("./view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload");
|
|
2228
|
+
Object.defineProperty(exports, "IntlWireVerificationLocalDataSuffix", { enumerable: true, get: function () { return internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix; } });
|
|
2229
|
+
Object.defineProperty(exports, "toIntlWireVerificationFormDetails", { enumerable: true, get: function () { return internationalWireVerificationSubmitPayload_1.toIntlWireVerificationFormDetails; } });
|
|
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; } });
|
|
2227
2235
|
// ── AI Accountant Entity ──
|
|
2228
2236
|
var aiAccountantCustomerState_1 = require("./entity/aiAccountantCustomer/aiAccountantCustomerState");
|
|
2229
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;
|
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const companyReducer_1 = require("../../../../../entity/company/companyReducer");
|
|
7
7
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
8
8
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
+
const internationalWireVerificationSubmitPayload_1 = require("../internationalWireVerificationSubmitPayload");
|
|
9
10
|
const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
|
|
10
11
|
const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.submitInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
|
|
11
12
|
const { internationalWireVerificationState } = state$.value;
|
|
@@ -13,7 +14,7 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
13
14
|
const localData = internationalWireVerificationState.verificationFormLocalData;
|
|
14
15
|
if (localData != null) {
|
|
15
16
|
return zeniAPI
|
|
16
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`,
|
|
17
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, (0, internationalWireVerificationSubmitPayload_1.toIntlWireVerificationSubmitPayload)(localData))
|
|
17
18
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
19
|
const actions = [];
|
|
19
20
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
@@ -58,9 +59,3 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
58
59
|
}
|
|
59
60
|
}));
|
|
60
61
|
exports.submitIntlVerificationEpic = submitIntlVerificationEpic;
|
|
61
|
-
const toIntlWireVerificationPayload = (localData) => {
|
|
62
|
-
return {
|
|
63
|
-
is_applicant_declaration: true,
|
|
64
|
-
form_details: localData,
|
|
65
|
-
};
|
|
66
|
-
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LabelValueCodesPayload } from '../../../../commonPayloadTypes/commonPayload';
|
|
2
|
+
import { FieldPayload } from './internationalWireVerificationPayload';
|
|
3
|
+
import { VerificationFormLocalData } from './internationalWireVerificationState';
|
|
4
|
+
export declare const toVerificationFormLocalDataFromOnboardingDetails: (onboardingDetails: Record<string, LabelValueCodesPayload> | undefined, internationalWireFormPayload: Record<string, FieldPayload>) => VerificationFormLocalData;
|
|
@@ -0,0 +1,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;
|
|
@@ -5,7 +5,8 @@ export interface InternationalWireVerificationState {
|
|
|
5
5
|
verificationFormLocalData: VerificationFormLocalData;
|
|
6
6
|
verificationFormSubmitState: FetchStateAndError;
|
|
7
7
|
}
|
|
8
|
-
export type
|
|
8
|
+
export type VerificationFormLocalDataValue = string | string[] | number;
|
|
9
|
+
export type VerificationFormLocalData = Record<string, VerificationFormLocalDataValue>;
|
|
9
10
|
export interface FieldValueType {
|
|
10
11
|
code: string;
|
|
11
12
|
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-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",
|