@zeniai/client-epic-state 5.0.90-betaAS3 → 5.0.90-betaAS5

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