@zeniai/client-epic-state 5.1.68-beta0RR → 5.1.68-betaDI0

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