@zeniai/client-epic-state 5.1.3-betaAS1 → 5.1.3-betaVR1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonPayloadTypes/commonPayload.d.ts +4 -25
- package/lib/esm/index.js +4 -8
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +200 -0
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +96 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +3 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +34 -33
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +7 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +8 -55
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +6 -5
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
- package/lib/index.d.ts +6 -11
- package/lib/index.js +41 -54
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +36 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +205 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +28 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +96 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +39 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +2 -6
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +33 -32
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +7 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +1 -24
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +9 -59
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +5 -4
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +15 -39
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +1 -20
- package/package.json +2 -2
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -146
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -40
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -86
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -154
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +0 -4
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +0 -150
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +0 -38
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +0 -43
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +0 -27
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +0 -96
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +0 -32
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +0 -159
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toIntlWireVerificationSubmitPayload = exports.toIntlWireVerificationFormDetails = exports.IntlWireVerificationLocalDataSuffix = void 0;
|
|
4
|
-
const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
|
|
5
|
-
exports.IntlWireVerificationLocalDataSuffix = {
|
|
6
|
-
documentOption: '_option',
|
|
7
|
-
documentBack: '_back',
|
|
8
|
-
nameFirst: '_first_name',
|
|
9
|
-
nameLast: '_last_name',
|
|
10
|
-
};
|
|
11
|
-
const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
|
|
12
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership,
|
|
13
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
|
|
14
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
|
|
15
|
-
]);
|
|
16
|
-
const BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES = new Set([
|
|
17
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder,
|
|
18
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson,
|
|
19
|
-
]);
|
|
20
|
-
const FILE_SUBFIELD_NAMES = new Set([
|
|
21
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfIdentity,
|
|
22
|
-
internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames.proofOfAddress,
|
|
23
|
-
]);
|
|
24
|
-
const isInternalLocalDataKey = (key) => key.endsWith(exports.IntlWireVerificationLocalDataSuffix.documentOption) ||
|
|
25
|
-
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.documentBack) ||
|
|
26
|
-
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.nameFirst) ||
|
|
27
|
-
key.endsWith(exports.IntlWireVerificationLocalDataSuffix.nameLast);
|
|
28
|
-
const isPersonSubfieldKey = (key) => key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`) ||
|
|
29
|
-
key.startsWith(`${internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson}_`);
|
|
30
|
-
const toFileOptionPayloads = (localData, baseKey) => {
|
|
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;
|