@zeniai/client-epic-state 5.0.90-betaAS1 → 5.0.90-betaAS10

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 (33) hide show
  1. package/lib/commonPayloadTypes/commonPayload.d.ts +25 -4
  2. package/lib/esm/index.js +5 -1
  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/epics/submitIntlVerificationEpic.js +2 -7
  6. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +146 -0
  7. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +40 -0
  8. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +86 -0
  9. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +21 -12
  10. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +3 -0
  11. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +20 -7
  12. package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +154 -0
  13. package/lib/index.d.ts +6 -1
  14. package/lib/index.js +22 -6
  15. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
  16. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +6 -2
  17. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +2 -1
  18. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +32 -40
  19. package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
  20. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +4 -0
  21. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +150 -0
  22. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +38 -0
  23. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +43 -0
  24. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +27 -0
  25. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +96 -0
  26. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +2 -1
  27. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +23 -13
  28. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +3 -0
  29. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +20 -7
  30. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +4 -1
  31. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +32 -0
  32. package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +159 -0
  33. package/package.json +1 -1
@@ -0,0 +1,154 @@
1
+ import { InternationalWireVerificationBooleanWithSubfieldsFieldNames, InternationalWireVerificationFormFieldNames, InternationalWireVerificationSubfieldNames, } from './internationalWireVerificationFieldConstants';
2
+ export const IntlWireVerificationLocalDataSuffix = {
3
+ documentOption: '_option',
4
+ documentBack: '_back',
5
+ nameFirst: '_first_name',
6
+ nameLast: '_last_name',
7
+ };
8
+ const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
9
+ InternationalWireVerificationFormFieldNames.businessOwnership,
10
+ InternationalWireVerificationFormFieldNames.companyProofOfAddress,
11
+ InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
12
+ ]);
13
+ const BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES = new Set([
14
+ InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder,
15
+ InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson,
16
+ ]);
17
+ const FILE_SUBFIELD_NAMES = new Set([
18
+ InternationalWireVerificationSubfieldNames.proofOfIdentity,
19
+ InternationalWireVerificationSubfieldNames.proofOfAddress,
20
+ ]);
21
+ const isInternalLocalDataKey = (key) => key.endsWith(IntlWireVerificationLocalDataSuffix.documentOption) ||
22
+ key.endsWith(IntlWireVerificationLocalDataSuffix.documentBack) ||
23
+ key.endsWith(IntlWireVerificationLocalDataSuffix.nameFirst) ||
24
+ key.endsWith(IntlWireVerificationLocalDataSuffix.nameLast);
25
+ const isPersonSubfieldKey = (key) => key.startsWith(`${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`) ||
26
+ key.startsWith(`${InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson}_`);
27
+ const toFileOptionPayloads = (localData, baseKey) => {
28
+ const option = localData[`${baseKey}${IntlWireVerificationLocalDataSuffix.documentOption}`];
29
+ if (typeof option !== 'string' || option.length === 0) {
30
+ return undefined;
31
+ }
32
+ const payloads = [];
33
+ const frontFileId = localData[baseKey];
34
+ if (typeof frontFileId === 'string' && frontFileId.length > 0) {
35
+ payloads.push({ file_id: frontFileId, option });
36
+ }
37
+ const backFileId = localData[`${baseKey}${IntlWireVerificationLocalDataSuffix.documentBack}`];
38
+ if (typeof backFileId === 'string' && backFileId.length > 0) {
39
+ payloads.push({ file_id: backFileId, option });
40
+ }
41
+ return payloads.length > 0 ? payloads : undefined;
42
+ };
43
+ const buildPersonPayload = (localData, keyPrefix) => {
44
+ const person = {};
45
+ const nameBaseKey = `${keyPrefix}_${InternationalWireVerificationSubfieldNames.name}`;
46
+ const firstName = localData[`${nameBaseKey}${IntlWireVerificationLocalDataSuffix.nameFirst}`];
47
+ const lastName = localData[`${nameBaseKey}${IntlWireVerificationLocalDataSuffix.nameLast}`];
48
+ if (typeof firstName === 'string' || typeof lastName === 'string') {
49
+ person.name = {
50
+ first_name: typeof firstName === 'string' ? firstName : '',
51
+ last_name: typeof lastName === 'string' ? lastName : '',
52
+ };
53
+ }
54
+ const assignStringField = (subfieldName, assign) => {
55
+ const value = localData[`${keyPrefix}_${subfieldName}`];
56
+ if (typeof value === 'string' && value.length > 0) {
57
+ assign(value);
58
+ }
59
+ };
60
+ assignStringField(InternationalWireVerificationSubfieldNames.nationality, (value) => {
61
+ person.nationality = value;
62
+ });
63
+ assignStringField(InternationalWireVerificationSubfieldNames.email, (value) => {
64
+ person.email = value;
65
+ });
66
+ assignStringField(InternationalWireVerificationSubfieldNames.companyRole, (value) => {
67
+ person.company_role = value;
68
+ });
69
+ assignStringField(InternationalWireVerificationSubfieldNames.ssn, (value) => {
70
+ person.ssn = value;
71
+ });
72
+ assignStringField(InternationalWireVerificationSubfieldNames.dateOfBirth, (value) => {
73
+ person.date_of_birth = value;
74
+ });
75
+ const ownershipValue = localData[`${keyPrefix}_${InternationalWireVerificationSubfieldNames.ownershipPercentage}`];
76
+ if (ownershipValue != null && ownershipValue !== '') {
77
+ person.ownership_percentage = Number(ownershipValue);
78
+ }
79
+ FILE_SUBFIELD_NAMES.forEach((subfieldName) => {
80
+ const filePayloads = toFileOptionPayloads(localData, `${keyPrefix}_${subfieldName}`);
81
+ if (filePayloads != null) {
82
+ if (subfieldName ===
83
+ InternationalWireVerificationSubfieldNames.proofOfIdentity) {
84
+ person.proof_of_identity = filePayloads;
85
+ }
86
+ else {
87
+ person.proof_of_address = filePayloads;
88
+ }
89
+ }
90
+ });
91
+ return person;
92
+ };
93
+ const getStakeHolderOwnerIndices = (localData) => {
94
+ const stakeHolderPrefix = `${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_`;
95
+ const indices = new Set();
96
+ Object.keys(localData).forEach((key) => {
97
+ const match = key.match(/^stake_holder_(\d+)_/);
98
+ if (match != null) {
99
+ indices.add(Number.parseInt(match[1], 10));
100
+ }
101
+ });
102
+ if (indices.size === 0) {
103
+ const hasUnindexedStakeHolderData = Object.keys(localData).some((key) => key.startsWith(stakeHolderPrefix) &&
104
+ !/^stake_holder_(true|false)$/.test(key));
105
+ if (hasUnindexedStakeHolderData) {
106
+ indices.add(0);
107
+ }
108
+ }
109
+ return Array.from(indices).sort((a, b) => a - b);
110
+ };
111
+ const hasPersonPayloadData = (person) => Object.keys(person).length > 0;
112
+ export const toIntlWireVerificationFormDetails = (localData) => {
113
+ const formDetails = {};
114
+ Object.entries(localData).forEach(([key, value]) => {
115
+ if (BOOLEAN_WITH_SUBFIELDS_FIELD_NAMES.has(key) ||
116
+ isInternalLocalDataKey(key) ||
117
+ isPersonSubfieldKey(key)) {
118
+ return;
119
+ }
120
+ if (MULTI_OPTION_FILE_FIELD_NAMES.has(key)) {
121
+ const filePayloads = toFileOptionPayloads(localData, key);
122
+ if (filePayloads != null) {
123
+ formDetails[key] = filePayloads;
124
+ }
125
+ return;
126
+ }
127
+ if (value == null || value === '') {
128
+ return;
129
+ }
130
+ formDetails[key] = value;
131
+ });
132
+ const stakeHolderSelection = localData[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder];
133
+ if (stakeHolderSelection === 'true') {
134
+ formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = getStakeHolderOwnerIndices(localData)
135
+ .map((ownerIndex) => buildPersonPayload(localData, `${InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder}_${ownerIndex}`))
136
+ .filter(hasPersonPayloadData);
137
+ }
138
+ else if (stakeHolderSelection === 'false') {
139
+ formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder] = [];
140
+ }
141
+ const controllingPersonSelection = localData[InternationalWireVerificationBooleanWithSubfieldsFieldNames
142
+ .controllingPerson];
143
+ if (controllingPersonSelection === 'false') {
144
+ const controllingPerson = buildPersonPayload(localData, InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson);
145
+ if (hasPersonPayloadData(controllingPerson)) {
146
+ formDetails[InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson] = controllingPerson;
147
+ }
148
+ }
149
+ return formDetails;
150
+ };
151
+ export const toIntlWireVerificationSubmitPayload = (localData) => ({
152
+ is_applicant_declaration: true,
153
+ form_details: toIntlWireVerificationFormDetails(localData),
154
+ });
package/lib/index.d.ts CHANGED
@@ -571,8 +571,8 @@ import { TopExAccount, TopExReport, TopExTimePeriodWithMetaData, TopExpenses } f
571
571
  */
572
572
  import { TOP_EX_TIME_PERIODS, TopExTimePeriod, TopExpense } from './view/topEx/topExState';
573
573
  import { AccountingProviderAttachmentSelector, getAccountingProviderAttachment } from './view/transactionDetail/getAccountingProviderAttachmentSelector';
574
- import { getChangedLineItemCountFromLocalData, isAccountUncategorized } from './view/transactionDetail/transactionDetailLocalDataHelper';
575
574
  import { JOURNAL_ENTRY_SORT_KEYS, JournalEntryRowSortConfig, JournalEntrySortAccessors, JournalEntrySortKey, filterJournalEntryLinesExcludingLinked, journalEntryDefaultSortConfig, journalEntryTotalsByPostingSide, sortJournalEntryLines, sumJournalEntryAmounts, toJournalEntrySortKey } from './view/transactionDetail/journalEntryLinesViewModel';
575
+ import { getChangedLineItemCountFromLocalData, isAccountUncategorized } from './view/transactionDetail/transactionDetailLocalDataHelper';
576
576
  import { clearTransactionDetailSaveStatus, deleteTransactionAttachment, downloadAccountingProviderAttachment, downloadAccountingProviderAttachmentFailure, downloadAccountingProviderAttachmentSuccess, fetchTransactionDetail, initializeTransactionDetailLocalData, markCategoryClassRecommendationsFailureForTransactionDetail, removeEntityRecommendationForLineIdForTransactionDetail, resetAllLineItemsToVendor, resetLineItemsCategoryClassInLocalData, resetSelectedCustomer, resetVendor, saveTransactionDetail, saveTransactionDetailLocalData, setAllLineItemsLocalDataIsUpdateAllChecked, setAllLineItemsToCategoryClassInLocalData, setIsVendorUpdateAllChecked, updateLatestSelectedEntity, updateLocalDataWithTransactionsUpdateWithVendorCheckbox, updateSelectedCustomer, updateSelectedVendor, updateTransactionDetail, updateVendorBulkRecommendationsFetchStatus, updateVendorToAllLineItems, uploadMissingAttachmentSuccess } from './view/transactionDetail/transactionDetailReducer';
577
577
  import { TransactionDetailReport, VendorDetailsView, getInitialUpdatablePeriodsForTransactionRecommendations, getTransactionDetail, getTransactionDetailForTransaction } from './view/transactionDetail/transactionDetailSelector';
578
578
  import { TransactionUpdates, getThirdPartyIdFromTransactionId } from './view/transactionDetail/transactionDetailState';
@@ -898,6 +898,11 @@ export { ALL_WEEK_DAYS, DayOfWeek, RecurringDatePickerOptions, RecurringFrequenc
898
898
  export { fetchCompanyTaskManagerView, fetchTaskManagerMetrics, CompanyTaskManagerSelectorView, CompanyTaskManagerViewUIState, TaskManagerMetrics, getCompanyTaskManagerView, TaskWithCompanyDetail, createTaskFromTaskGroupTemplate, TaskGroupTemplate, };
899
899
  export { Country };
900
900
  export { InternationalWireVerificationState, VerificationFormField, VerificationFormFieldOption, VerificationFormLocalData, VerificationFormSubField, FieldValueType, InternationalWireVerificationFormOrder, sortVerificationFormFields, fetchInternationalVerificationForm, submitInternationalVerificationForm, updateVerificationFormLocalData, getIntlWireVerificationView, InternationalWireVerificationView, };
901
+ export { InternationalWireVerificationBooleanWithSubfieldsFieldNameList, InternationalWireVerificationBooleanWithSubfieldsFieldNames, InternationalWireVerificationControllingPersonFieldName, InternationalWireVerificationFormFieldNames, InternationalWireVerificationStakeHolderFieldName, InternationalWireVerificationSubfieldNames, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants';
902
+ export { IntlWireVerificationLocalDataSuffix, toIntlWireVerificationFormDetails, toIntlWireVerificationSubmitPayload, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload';
903
+ export { getStakeHolderOwnerIndicesFromLocalData, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers';
904
+ export { toVerificationFormLocalDataFromOnboardingDetails, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData';
905
+ export type { InternationalWireVerificationBooleanWithSubfieldsFieldName, InternationalWireVerificationFormFieldName, InternationalWireVerificationSubfieldName, } from './view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants';
901
906
  export { fetchExpressPayInitialDetails, updateExpressPayFormLocalData, submitExpressPay, resetExpressPayLocalData, ExpressPayFormLocalData, ExpressPayView, getExpressPayView, };
902
907
  export { acceptTreasuryTerms, fetchTreasurySetupView, clearTreasurySetupView, fetchTreasuryFunds, updatePortfolioAllocation, fetchPortfolioAllocation, updateFundAllocationLocalData, updateTreasuryPromoIntroClosedByOutsideClick, updateTreasuryPromoRemindMeLaterClicked, updateTreasuryVideoViewed, FundAllocationOption, FundComposition, FundData, TreasurySetupView, getTreasurySetupViewDetails, getTreasuryFundsMaximumYield, };
903
908
  export { AiAccountantCustomer, AiAccountantCustomerState, AiAccountantEnrollment, AiAccountantEnrollmentStatus, AiAccountantJob, AiAccountantJobStatus, AiAccountantOperationType, getAllowedOperationsForStatus, toAiAccountantEnrollmentStatus, toAiAccountantJobStatus, toAiAccountantOperationType, } from './entity/aiAccountantCustomer/aiAccountantCustomerState';
package/lib/index.js CHANGED
@@ -69,9 +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.toAiAccountantCustomer = exports.toAiAccountantOperationType = exports.toAiAccountantJobStatus = exports.toAiAccountantEnrollmentStatus = exports.getAllowedOperationsForStatus = exports.getTreasuryFundsMaximumYield = exports.getTreasurySetupViewDetails = exports.updateTreasuryVideoViewed = exports.updateTreasuryPromoRemindMeLaterClicked = 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.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.toAiCfoVisualization = exports.clearAiCfo = exports.clearSession = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setSessions = exports.setNewSession = exports.getSuggestedQuestionsForPageContext = 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 = void 0;
74
- 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 = 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 = 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;
75
76
  const allowedValue_1 = require("./commonStateTypes/allowedValue");
76
77
  Object.defineProperty(exports, "isAllowedValueWithCode", { enumerable: true, get: function () { return allowedValue_1.isAllowedValueWithCode; } });
77
78
  Object.defineProperty(exports, "isAllowedValueWithID", { enumerable: true, get: function () { return allowedValue_1.isAllowedValueWithID; } });
@@ -1942,9 +1943,6 @@ const topExState_1 = require("./view/topEx/topExState");
1942
1943
  Object.defineProperty(exports, "TOP_EX_TIME_PERIODS", { enumerable: true, get: function () { return topExState_1.TOP_EX_TIME_PERIODS; } });
1943
1944
  const getAccountingProviderAttachmentSelector_1 = require("./view/transactionDetail/getAccountingProviderAttachmentSelector");
1944
1945
  Object.defineProperty(exports, "getAccountingProviderAttachment", { enumerable: true, get: function () { return getAccountingProviderAttachmentSelector_1.getAccountingProviderAttachment; } });
1945
- const transactionDetailLocalDataHelper_1 = require("./view/transactionDetail/transactionDetailLocalDataHelper");
1946
- Object.defineProperty(exports, "getChangedLineItemCountFromLocalData", { enumerable: true, get: function () { return transactionDetailLocalDataHelper_1.getChangedLineItemCountFromLocalData; } });
1947
- Object.defineProperty(exports, "isAccountUncategorized", { enumerable: true, get: function () { return transactionDetailLocalDataHelper_1.isAccountUncategorized; } });
1948
1946
  const journalEntryLinesViewModel_1 = require("./view/transactionDetail/journalEntryLinesViewModel");
1949
1947
  Object.defineProperty(exports, "JOURNAL_ENTRY_SORT_KEYS", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.JOURNAL_ENTRY_SORT_KEYS; } });
1950
1948
  Object.defineProperty(exports, "filterJournalEntryLinesExcludingLinked", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.filterJournalEntryLinesExcludingLinked; } });
@@ -1953,6 +1951,9 @@ Object.defineProperty(exports, "journalEntryTotalsByPostingSide", { enumerable:
1953
1951
  Object.defineProperty(exports, "sortJournalEntryLines", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.sortJournalEntryLines; } });
1954
1952
  Object.defineProperty(exports, "sumJournalEntryAmounts", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.sumJournalEntryAmounts; } });
1955
1953
  Object.defineProperty(exports, "toJournalEntrySortKey", { enumerable: true, get: function () { return journalEntryLinesViewModel_1.toJournalEntrySortKey; } });
1954
+ const transactionDetailLocalDataHelper_1 = require("./view/transactionDetail/transactionDetailLocalDataHelper");
1955
+ Object.defineProperty(exports, "getChangedLineItemCountFromLocalData", { enumerable: true, get: function () { return transactionDetailLocalDataHelper_1.getChangedLineItemCountFromLocalData; } });
1956
+ Object.defineProperty(exports, "isAccountUncategorized", { enumerable: true, get: function () { return transactionDetailLocalDataHelper_1.isAccountUncategorized; } });
1956
1957
  const transactionDetailReducer_1 = require("./view/transactionDetail/transactionDetailReducer");
1957
1958
  Object.defineProperty(exports, "clearTransactionDetailSaveStatus", { enumerable: true, get: function () { return transactionDetailReducer_1.clearTransactionDetailSaveStatus; } });
1958
1959
  Object.defineProperty(exports, "deleteTransactionAttachment", { enumerable: true, get: function () { return transactionDetailReducer_1.deleteTransactionAttachment; } });
@@ -2216,6 +2217,21 @@ Object.defineProperty(exports, "updateReportUIOptionIsCompareModeOn", { enumerab
2216
2217
  Object.defineProperty(exports, "toggleReportUIOptionForecastMode", { enumerable: true, get: function () { return reportUIOptionsReducer_1.toggleReportUIOptionForecastMode; } });
2217
2218
  Object.defineProperty(exports, "updateReportUIOptionThisPeriod", { enumerable: true, get: function () { return reportUIOptionsReducer_1.updateReportUIOptionThisPeriod; } });
2218
2219
  Object.defineProperty(exports, "updateReportUIOptionCOABalancesRange", { enumerable: true, get: function () { return reportUIOptionsReducer_1.updateReportUIOptionCOABalancesRange; } });
2220
+ var internationalWireVerificationFieldConstants_1 = require("./view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants");
2221
+ Object.defineProperty(exports, "InternationalWireVerificationBooleanWithSubfieldsFieldNameList", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNameList; } });
2222
+ Object.defineProperty(exports, "InternationalWireVerificationBooleanWithSubfieldsFieldNames", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames; } });
2223
+ Object.defineProperty(exports, "InternationalWireVerificationControllingPersonFieldName", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationControllingPersonFieldName; } });
2224
+ Object.defineProperty(exports, "InternationalWireVerificationFormFieldNames", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames; } });
2225
+ Object.defineProperty(exports, "InternationalWireVerificationStakeHolderFieldName", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationStakeHolderFieldName; } });
2226
+ Object.defineProperty(exports, "InternationalWireVerificationSubfieldNames", { enumerable: true, get: function () { return internationalWireVerificationFieldConstants_1.InternationalWireVerificationSubfieldNames; } });
2227
+ var internationalWireVerificationSubmitPayload_1 = require("./view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload");
2228
+ Object.defineProperty(exports, "IntlWireVerificationLocalDataSuffix", { enumerable: true, get: function () { return internationalWireVerificationSubmitPayload_1.IntlWireVerificationLocalDataSuffix; } });
2229
+ Object.defineProperty(exports, "toIntlWireVerificationFormDetails", { enumerable: true, get: function () { return internationalWireVerificationSubmitPayload_1.toIntlWireVerificationFormDetails; } });
2230
+ Object.defineProperty(exports, "toIntlWireVerificationSubmitPayload", { enumerable: true, get: function () { return internationalWireVerificationSubmitPayload_1.toIntlWireVerificationSubmitPayload; } });
2231
+ var internationalWireVerificationLocalDataHelpers_1 = require("./view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers");
2232
+ Object.defineProperty(exports, "getStakeHolderOwnerIndicesFromLocalData", { enumerable: true, get: function () { return internationalWireVerificationLocalDataHelpers_1.getStakeHolderOwnerIndicesFromLocalData; } });
2233
+ var internationalWireOnboardingDetailsToLocalData_1 = require("./view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData");
2234
+ Object.defineProperty(exports, "toVerificationFormLocalDataFromOnboardingDetails", { enumerable: true, get: function () { return internationalWireOnboardingDetailsToLocalData_1.toVerificationFormLocalDataFromOnboardingDetails; } });
2219
2235
  // ── AI Accountant Entity ──
2220
2236
  var aiAccountantCustomerState_1 = require("./entity/aiAccountantCustomer/aiAccountantCustomerState");
2221
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;
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
6
6
  const companyReducer_1 = require("../../../../../entity/company/companyReducer");
7
7
  const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
8
8
  const responsePayload_1 = require("../../../../../responsePayload");
9
+ const internationalWireVerificationSubmitPayload_1 = require("../internationalWireVerificationSubmitPayload");
9
10
  const internationalWireVerificationReducer_1 = require("../internationalWireVerificationReducer");
10
11
  const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(internationalWireVerificationReducer_1.submitInternationalVerificationForm.match), (0, operators_1.switchMap)((action) => {
11
12
  const { internationalWireVerificationState } = state$.value;
@@ -13,7 +14,7 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
13
14
  const localData = internationalWireVerificationState.verificationFormLocalData;
14
15
  if (localData != null) {
15
16
  return zeniAPI
16
- .postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, toIntlWireVerificationPayload(localData))
17
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/international-wire/onboarding`, (0, internationalWireVerificationSubmitPayload_1.toIntlWireVerificationSubmitPayload)(localData))
17
18
  .pipe((0, operators_1.mergeMap)((response) => {
18
19
  const actions = [];
19
20
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
@@ -58,9 +59,3 @@ const submitIntlVerificationEpic = (actions$, state$, zeniAPI) => actions$.pipe(
58
59
  }
59
60
  }));
60
61
  exports.submitIntlVerificationEpic = submitIntlVerificationEpic;
61
- const toIntlWireVerificationPayload = (localData) => {
62
- return {
63
- is_applicant_declaration: true,
64
- form_details: localData,
65
- };
66
- };
@@ -0,0 +1,4 @@
1
+ import { LabelValueCodesPayload } from '../../../../commonPayloadTypes/commonPayload';
2
+ import { FieldPayload } from './internationalWireVerificationPayload';
3
+ import { VerificationFormLocalData } from './internationalWireVerificationState';
4
+ export declare const toVerificationFormLocalDataFromOnboardingDetails: (onboardingDetails: Record<string, LabelValueCodesPayload> | undefined, internationalWireFormPayload: Record<string, FieldPayload>) => VerificationFormLocalData;
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toVerificationFormLocalDataFromOnboardingDetails = void 0;
4
+ const internationalWireVerificationFieldConstants_1 = require("./internationalWireVerificationFieldConstants");
5
+ const internationalWireVerificationLocalDataHelpers_1 = require("./internationalWireVerificationLocalDataHelpers");
6
+ const MULTI_OPTION_FILE_FIELD_NAMES = new Set([
7
+ internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.businessOwnership,
8
+ internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyProofOfAddress,
9
+ internationalWireVerificationFieldConstants_1.InternationalWireVerificationFormFieldNames.companyOfficerProofOfAddress,
10
+ ]);
11
+ const toValuesArray = (values) => {
12
+ if (values == null) {
13
+ return [];
14
+ }
15
+ if (Array.isArray(values)) {
16
+ return values;
17
+ }
18
+ return [values];
19
+ };
20
+ const getCodeFromValue = (value) => {
21
+ if (typeof value === 'string') {
22
+ return value;
23
+ }
24
+ if (typeof value === 'object' &&
25
+ value != null &&
26
+ 'code' in value &&
27
+ typeof value.code === 'string') {
28
+ return value.code;
29
+ }
30
+ return '';
31
+ };
32
+ const setEmptyFieldDefault = (localData, fieldKey, fieldPayload) => {
33
+ if (fieldPayload.type === 'enum') {
34
+ localData[fieldKey] =
35
+ fieldPayload.is_multiple_values_allowed === true ? [] : '';
36
+ return;
37
+ }
38
+ if (fieldPayload.type === 'boolean_with_subfields') {
39
+ if (fieldKey ===
40
+ internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
41
+ localData[fieldKey] = 'false';
42
+ return;
43
+ }
44
+ if (fieldKey ===
45
+ internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
46
+ localData[fieldKey] = fieldPayload.default === true ? 'true' : 'false';
47
+ }
48
+ }
49
+ };
50
+ const parseEnumValues = (localData, fieldKey, fieldPayload, values) => {
51
+ if (fieldPayload.is_multiple_values_allowed === true) {
52
+ localData[fieldKey] = values
53
+ .map(getCodeFromValue)
54
+ .filter((code) => code.length > 0);
55
+ return;
56
+ }
57
+ localData[fieldKey] = getCodeFromValue(values[0]);
58
+ };
59
+ const parseFileValues = (localData, fieldKey, fieldPayload, values) => {
60
+ if (values.length > 0 &&
61
+ ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWireFileOptionLike)(values[0]) ||
62
+ MULTI_OPTION_FILE_FIELD_NAMES.has(fieldKey))) {
63
+ const fileOptions = (0, internationalWireVerificationLocalDataHelpers_1.toIntlWireFileOptionArray)(values);
64
+ if (fileOptions.length > 0) {
65
+ (0, internationalWireVerificationLocalDataHelpers_1.appendIntlWireFileOptionsToLocalData)(localData, fieldKey, fileOptions);
66
+ }
67
+ return;
68
+ }
69
+ const fileIds = values.filter((value) => typeof value === 'string' && value.length > 0);
70
+ if (fieldPayload.is_multiple_values_allowed === true) {
71
+ localData[fieldKey] = fileIds;
72
+ return;
73
+ }
74
+ localData[fieldKey] = fileIds[0] ?? '';
75
+ };
76
+ const parseBooleanWithSubfieldsValues = (localData, fieldKey, fieldPayload, rawValues) => {
77
+ if (fieldKey ===
78
+ internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.controllingPerson) {
79
+ if ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(rawValues)) {
80
+ localData[fieldKey] = 'false';
81
+ (0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, fieldKey, rawValues);
82
+ return;
83
+ }
84
+ const values = toValuesArray(rawValues);
85
+ if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(values[0])) {
86
+ localData[fieldKey] = 'false';
87
+ (0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, fieldKey, values[0]);
88
+ return;
89
+ }
90
+ const selection = getCodeFromValue(values[0]);
91
+ localData[fieldKey] =
92
+ selection.length > 0
93
+ ? selection
94
+ : fieldPayload.default === true
95
+ ? 'true'
96
+ : 'false';
97
+ return;
98
+ }
99
+ if (fieldKey ===
100
+ internationalWireVerificationFieldConstants_1.InternationalWireVerificationBooleanWithSubfieldsFieldNames.stakeHolder) {
101
+ const values = toValuesArray(rawValues);
102
+ if (values.length > 0 && (0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(values[0])) {
103
+ localData[fieldKey] = 'true';
104
+ values.forEach((person, ownerIndex) => {
105
+ if ((0, internationalWireVerificationLocalDataHelpers_1.isIntlWirePersonLike)(person)) {
106
+ (0, internationalWireVerificationLocalDataHelpers_1.appendIntlWirePersonToLocalData)(localData, `${fieldKey}_${ownerIndex}`, person);
107
+ }
108
+ });
109
+ return;
110
+ }
111
+ const selection = getCodeFromValue(values[0]);
112
+ localData[fieldKey] = selection.length > 0 ? selection : 'false';
113
+ }
114
+ };
115
+ const toVerificationFormLocalDataFromOnboardingDetails = (onboardingDetails, internationalWireFormPayload) => {
116
+ const localData = {};
117
+ Object.keys(internationalWireFormPayload).forEach((fieldKey) => {
118
+ const fieldPayload = internationalWireFormPayload[fieldKey];
119
+ const rawValues = onboardingDetails?.[fieldKey]?.values;
120
+ if (rawValues == null) {
121
+ setEmptyFieldDefault(localData, fieldKey, fieldPayload);
122
+ return;
123
+ }
124
+ if (fieldPayload.type === 'boolean_with_subfields') {
125
+ parseBooleanWithSubfieldsValues(localData, fieldKey, fieldPayload, rawValues);
126
+ return;
127
+ }
128
+ const values = toValuesArray(rawValues);
129
+ if (values.length === 0) {
130
+ setEmptyFieldDefault(localData, fieldKey, fieldPayload);
131
+ return;
132
+ }
133
+ switch (fieldPayload.type) {
134
+ case 'enum':
135
+ parseEnumValues(localData, fieldKey, fieldPayload, values);
136
+ break;
137
+ case 'file':
138
+ parseFileValues(localData, fieldKey, fieldPayload, values);
139
+ break;
140
+ case 'date':
141
+ localData[fieldKey] = getCodeFromValue(values[0]);
142
+ break;
143
+ default:
144
+ localData[fieldKey] = getCodeFromValue(values[0]);
145
+ break;
146
+ }
147
+ });
148
+ return localData;
149
+ };
150
+ exports.toVerificationFormLocalDataFromOnboardingDetails = toVerificationFormLocalDataFromOnboardingDetails;