@zeniai/client-epic-state 4.19.68 → 4.19.69-betaJK11

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.

Potentially problematic release.


This version of @zeniai/client-epic-state might be problematic. Click here for more details.

Files changed (134) hide show
  1. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  2. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  3. package/lib/entity/account/accountState.d.ts +1 -1
  4. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  5. package/lib/entity/aiCfo/aiCfoPayload.d.ts +1 -0
  6. package/lib/entity/aiCfo/aiCfoReducer.js +5 -1
  7. package/lib/entity/aiCfo/aiCfoState.d.ts +1 -0
  8. package/lib/entity/class/classReducer.d.ts +4 -4
  9. package/lib/entity/class/classState.d.ts +1 -1
  10. package/lib/entity/company/companyPayload.d.ts +12 -0
  11. package/lib/entity/company/companyPayload.js +20 -0
  12. package/lib/entity/company/companyStateTypes.d.ts +12 -0
  13. package/lib/entity/forecast/forecastState.d.ts +1 -1
  14. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  15. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  16. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  17. package/lib/entity/transaction/payloadTypes/transactionPayload.js +1 -0
  18. package/lib/entity/transaction/stateTypes/transaction.d.ts +1 -0
  19. package/lib/entity/transactionActivityLog/transactionActivityLogPayload.d.ts +36 -0
  20. package/lib/entity/transactionActivityLog/transactionActivityLogPayload.js +56 -0
  21. package/lib/entity/transactionActivityLog/transactionActivityLogReducer.d.ts +6 -0
  22. package/lib/entity/transactionActivityLog/transactionActivityLogReducer.js +27 -0
  23. package/lib/entity/transactionActivityLog/transactionActivityLogSelector.d.ts +4 -0
  24. package/lib/entity/transactionActivityLog/transactionActivityLogSelector.js +17 -0
  25. package/lib/entity/transactionActivityLog/transactionActivityLogState.d.ts +40 -0
  26. package/lib/entity/transactionActivityLog/transactionActivityLogState.js +20 -0
  27. package/lib/epic.d.ts +2 -1
  28. package/lib/epic.js +2 -1
  29. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  30. package/lib/esm/entity/aiCfo/aiCfoReducer.js +5 -1
  31. package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionPayload.js +2 -2
  32. package/lib/esm/entity/company/companyPayload.js +20 -0
  33. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +1 -0
  34. package/lib/esm/entity/transactionActivityLog/transactionActivityLogPayload.js +50 -0
  35. package/lib/esm/entity/transactionActivityLog/transactionActivityLogReducer.js +23 -0
  36. package/lib/esm/entity/transactionActivityLog/transactionActivityLogSelector.js +10 -0
  37. package/lib/esm/entity/transactionActivityLog/transactionActivityLogState.js +16 -0
  38. package/lib/esm/epic.js +2 -1
  39. package/lib/esm/index.js +9 -5
  40. package/lib/esm/reducer.js +6 -0
  41. package/lib/esm/view/companyView/epic/companyPassport/updateCompanyDetailsEpic.js +3 -0
  42. package/lib/esm/view/companyView/types/companyPassport/companyPassportLocalData.js +12 -0
  43. package/lib/esm/view/companyView/types/companyPassportViewPayload.js +55 -12
  44. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -3
  45. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  46. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +22 -4
  47. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +13 -4
  48. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +4 -2
  49. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +3 -1
  50. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryDownloadSelector.js +2 -2
  51. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistorySelector.js +2 -2
  52. package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailSelector.js +4 -1
  53. package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/fetchChargeCardRepaymentDetailEpic.js +2 -1
  54. package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.js +1 -1
  55. package/lib/esm/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +66 -1
  56. package/lib/esm/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js +15 -2
  57. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +14 -1
  58. package/lib/esm/view/spendManagement/commonSetup/setupViewState.js +2 -2
  59. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +3 -1
  60. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +11 -3
  61. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +4 -2
  62. package/lib/esm/view/transactionActivityLogView/fetchTransactionActivityLogEpic.js +43 -0
  63. package/lib/esm/view/transactionActivityLogView/transactionActivityLogViewPayload.js +1 -0
  64. package/lib/esm/view/transactionActivityLogView/transactionActivityLogViewReducer.js +47 -0
  65. package/lib/esm/view/transactionActivityLogView/transactionActivityLogViewSelector.js +34 -0
  66. package/lib/esm/view/transactionActivityLogView/transactionActivityLogViewState.js +1 -0
  67. package/lib/index.d.ts +10 -6
  68. package/lib/index.js +42 -36
  69. package/lib/reducer.d.ts +6 -0
  70. package/lib/reducer.js +6 -0
  71. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  72. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  73. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  74. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  75. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  76. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  77. package/lib/view/companyView/epic/companyPassport/updateCompanyDetailsEpic.js +3 -0
  78. package/lib/view/companyView/types/companyPassport/companyDetailsLocalData.d.ts +12 -0
  79. package/lib/view/companyView/types/companyPassport/companyPassportLocalData.js +12 -0
  80. package/lib/view/companyView/types/companyPassportViewPayload.d.ts +1 -1
  81. package/lib/view/companyView/types/companyPassportViewPayload.js +55 -12
  82. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  83. package/lib/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -3
  84. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  85. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  86. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  87. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +1 -0
  88. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +22 -3
  89. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  90. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  91. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +3 -1
  92. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +13 -4
  93. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +4 -2
  94. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +3 -1
  95. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +2 -0
  96. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +3 -1
  97. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +2 -0
  98. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  99. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -1
  100. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryDownloadSelector.js +2 -2
  101. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistorySelector.js +2 -2
  102. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailSelector.js +4 -1
  103. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/fetchChargeCardRepaymentDetailEpic.js +2 -1
  104. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.d.ts +1 -1
  105. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/initiateChargeCardRepaymentEpic.js +1 -1
  106. package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +66 -1
  107. package/lib/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js +15 -2
  108. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +4 -4
  109. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +13 -0
  110. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +14 -1
  111. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +14 -1
  112. package/lib/view/spendManagement/commonSetup/setupViewState.js +1 -1
  113. package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +13 -0
  114. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -10
  115. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +3 -1
  116. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +3 -1
  117. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +11 -3
  118. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +4 -2
  119. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +3 -1
  120. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +2 -0
  121. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  122. package/lib/view/topEx/topExSelector.d.ts +1 -1
  123. package/lib/view/transactionActivityLogView/fetchTransactionActivityLogEpic.d.ts +9 -0
  124. package/lib/view/transactionActivityLogView/fetchTransactionActivityLogEpic.js +47 -0
  125. package/lib/view/transactionActivityLogView/transactionActivityLogViewPayload.d.ts +8 -0
  126. package/lib/view/transactionActivityLogView/transactionActivityLogViewPayload.js +2 -0
  127. package/lib/view/transactionActivityLogView/transactionActivityLogViewReducer.d.ts +17 -0
  128. package/lib/view/transactionActivityLogView/transactionActivityLogViewReducer.js +51 -0
  129. package/lib/view/transactionActivityLogView/transactionActivityLogViewSelector.d.ts +8 -0
  130. package/lib/view/transactionActivityLogView/transactionActivityLogViewSelector.js +37 -0
  131. package/lib/view/transactionActivityLogView/transactionActivityLogViewState.d.ts +5 -0
  132. package/lib/view/transactionActivityLogView/transactionActivityLogViewState.js +2 -0
  133. package/package.json +1 -1
  134. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
@@ -1,16 +1,59 @@
1
- export const toCompanyUpdatableInfoPayload = (info) => {
2
- const payload = {
3
- name: info.companyName,
4
- company_legal_name: info.legalName,
5
- phone: info.phone,
6
- company_industry: info.industry,
7
- company_business_model: info.businessModel,
8
- company_url: info.website != null ? info.website.toString() : null,
9
- meeting_url: info.meetingLink != null ? info.meetingLink.toString() : null,
10
- is_new_company_industry_verified: true,
11
- };
12
- return payload;
1
+ /** Maps US nexus display label to API key (for company_us_nexus_desc) */
2
+ const US_NEXUS_LABEL_TO_KEY = {
3
+ Employees: 'employees',
4
+ Customers: 'customers',
5
+ 'Physical office or facility': 'physical_office',
6
+ 'Banking relationships': 'banking_relationships',
13
7
  };
8
+ function toUsNexusTypeKey(value) {
9
+ const key = US_NEXUS_LABEL_TO_KEY[value];
10
+ return key ?? value;
11
+ }
12
+ export const toCompanyUpdatableInfoPayload = (info) => ({
13
+ name: info.companyName,
14
+ company_legal_name: info.legalName,
15
+ phone: info.phone,
16
+ company_industry: info.industry,
17
+ company_business_model: info.businessModel,
18
+ company_url: info.website != null ? info.website.toString() : null,
19
+ meeting_url: info.meetingLink != null ? info.meetingLink.toString() : null,
20
+ is_new_company_industry_verified: true,
21
+ ...(info.companySourceOfFunds != null && {
22
+ company_source_of_funds: info.companySourceOfFunds,
23
+ }),
24
+ ...(info.companySourceOfFundsDescription != null && {
25
+ company_source_of_funds_desc: info.companySourceOfFundsDescription,
26
+ }),
27
+ ...(info.countriesOfOperations != null &&
28
+ info.countriesOfOperations.length > 0 && {
29
+ company_countries_of_operations: info.countriesOfOperations,
30
+ }),
31
+ ...(info.transactionVolume != null && {
32
+ company_transaction_vol_expectations: info.transactionVolume,
33
+ }),
34
+ ...(info.transactionVolumeDescription != null && {
35
+ company_transaction_vol_expectations_desc: info.transactionVolumeDescription,
36
+ }),
37
+ ...(info.purposeOfAccount != null && {
38
+ company_purpose_of_account: info.purposeOfAccount,
39
+ }),
40
+ ...(info.purposeOfAccountDescription != null && {
41
+ company_purpose_of_account_desc: info.purposeOfAccountDescription,
42
+ }),
43
+ ...(info.regulatedStatus != null && {
44
+ company_regulated_states: info.regulatedStatus === 'yes',
45
+ }),
46
+ ...(info.regulatedStatusDescription != null && {
47
+ company_regulated_states_desc: info.regulatedStatusDescription,
48
+ }),
49
+ ...(info.usNexus != null && {
50
+ company_us_nexus: info.usNexus === 'yes',
51
+ }),
52
+ ...(info.usNexusTypes != null &&
53
+ info.usNexusTypes.length > 0 && {
54
+ company_us_nexus_desc: info.usNexusTypes.map(toUsNexusTypeKey),
55
+ }),
56
+ });
14
57
  export const toCompanyIncInfoUpdatableInfoPayload = (info) => {
15
58
  const payload = {
16
59
  company_inc_type: info.typeOfInc,
@@ -4,15 +4,14 @@ import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/ti
4
4
  import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
5
  import { backgroundRefetchReviewTab, syncTransactionCategorizationFromDetailSave, } from '../../reducers/transactionsViewReducer';
6
6
  export const triggerReviewTabRefetchEpic = (actions$, state$) => actions$.pipe(filter(syncTransactionCategorizationFromDetailSave.match), mergeMap((action) => {
7
- const { pendingReviewLineIds, transactionId, isUncategorizedExpenseCategoryEnabled } = action.payload;
7
+ const { pendingReviewLineIds, transactionId, isUncategorizedExpenseCategoryEnabled, } = action.payload;
8
8
  if (pendingReviewLineIds.length === 0) {
9
9
  return EMPTY;
10
10
  }
11
11
  const state = state$.value;
12
12
  // Only trigger when the transaction was auto-only (not in review tab after reducer ran)
13
13
  const reviewLocalData = state.expenseAutomationTransactionsViewState
14
- .transactionCategorizationView.review
15
- .transactionReviewLocalDataById[transactionId.id];
14
+ .transactionCategorizationView.review.transactionReviewLocalDataById[transactionId.id];
16
15
  if (reviewLocalData != null) {
17
16
  return EMPTY;
18
17
  }
@@ -41,8 +41,8 @@ export const filterAutoTabLineItems = (tabView, transactionId, updatedTransactio
41
41
  if (localData == null) {
42
42
  return;
43
43
  }
44
- const currentAutoLineIds = localData.transactionReviewLocalData.tabSpecificLineItems
45
- .autoCategorized ?? [];
44
+ const currentAutoLineIds = localData.transactionReviewLocalData.tabSpecificLineItems.autoCategorized ??
45
+ [];
46
46
  const linesById = new Map(updatedTransaction.lines?.map((l) => [l.id, l]));
47
47
  const retainedLineIds = currentAutoLineIds.filter((lineId) => {
48
48
  const line = linesById.get(lineId);
@@ -218,17 +218,17 @@ export const onboardingStepsData = (isValidConnection, productSettings, accounti
218
218
  requiredStepsData: requiredStepsData.map((step) => toOnboardingStepType(step)),
219
219
  };
220
220
  };
221
- function isCompanyDetailsSavePending(fileState, company, primaryContact, companyDetailsLocalData) {
221
+ export function isCompanyDetailsSavePending(fileState, company, primaryContact, companyDetailsLocalData) {
222
222
  if (company == null || companyDetailsLocalData == null) {
223
223
  return false;
224
224
  }
225
225
  const { companyInfo, incInfo, taxInfo, questionaire } = company.company.company;
226
- const { companyDescription, companyLegalName, companyUrl, phone } = companyInfo;
227
- const { fileIds, companyIncDate: incDate, companyIncType } = incInfo;
226
+ const { companyDescription, companyLegalName, companyUrl, phone, companySourceOfFunds, companySourceOfFundsDescription, countriesOfOperations, transactionVolume, transactionVolumeDescription, purposeOfAccount, purposeOfAccountDescription, regulatedStatus, regulatedStatusDescription, usNexus, usNexusTypes, } = companyInfo;
227
+ const { fileIds, companyIncDate: incDate, companyIncState, companyIncType, companySubIndustry, } = incInfo;
228
228
  const { companyIndustry } = questionaire;
229
229
  const { taxId } = taxInfo;
230
230
  const companyFileIds = getFilesByFileIds(fileState, fileIds).map((file) => file.fileId);
231
- const { companyDescription: companyDescriptionLocalData, companyIndustry: companyIndustryLocalData, companyLegalName: companyLegalNameLocalData, taxIdOrEIN: taxIdLocalData, incDate: incDateLocalData, phone: companyPhoneLocalData, website: companyUrlLocalData, companyFiles: companyFilesLocalData, typeOfIncorporation: companyIncTypeLocalData, primaryContactLocalData, } = companyDetailsLocalData;
231
+ const { companyDescription: companyDescriptionLocalData, companyIndustry: companyIndustryLocalData, companyLegalName: companyLegalNameLocalData, taxIdOrEIN: taxIdLocalData, incDate: incDateLocalData, phone: companyPhoneLocalData, website: companyUrlLocalData, companyFiles: companyFilesLocalData, stateOfIncorporation: stateOfIncorporationLocalData, typeOfIncorporation: companyIncTypeLocalData, companySourceOfFunds: companySourceOfFundsLocalData, companySourceOfFundsDescription: companySourceOfFundsDescriptionLocalData, countriesOfOperations: countriesOfOperationsLocalData, companySubIndustry: companySubIndustryLocalData, transactionVolume: transactionVolumeLocalData, transactionVolumeDescription: transactionVolumeDescriptionLocalData, purposeOfAccount: purposeOfAccountLocalData, purposeOfAccountDescription: purposeOfAccountDescriptionLocalData, regulatedStatus: regulatedStatusLocalData, regulatedStatusDescription: regulatedStatusDescriptionLocalData, usNexus: usNexusLocalData, usNexusTypes: usNexusTypesLocalData, primaryContactLocalData, } = companyDetailsLocalData;
232
232
  const fileIdsLocalData = companyFilesLocalData.map((file) => file.fileId);
233
233
  if (primaryContact != null) {
234
234
  const { firstName, lastName, email } = primaryContact;
@@ -238,6 +238,10 @@ function isCompanyDetailsSavePending(fileState, company, primaryContact, company
238
238
  return true;
239
239
  }
240
240
  }
241
+ const countriesOfOperationsMatch = JSON.stringify(countriesOfOperations ?? []) ===
242
+ JSON.stringify(countriesOfOperationsLocalData ?? []);
243
+ const usNexusTypesMatch = JSON.stringify(usNexusTypes ?? []) ===
244
+ JSON.stringify(usNexusTypesLocalData ?? []);
241
245
  return (companyDescription != companyDescriptionLocalData ||
242
246
  companyIndustry != companyIndustryLocalData ||
243
247
  companyLegalName != companyLegalNameLocalData ||
@@ -245,7 +249,21 @@ function isCompanyDetailsSavePending(fileState, company, primaryContact, company
245
249
  incDate?.toString() != incDateLocalData?.toString() ||
246
250
  phone != companyPhoneLocalData ||
247
251
  companyUrl?.toString() != companyUrlLocalData?.toString() ||
252
+ companyIncState != stateOfIncorporationLocalData ||
253
+ companySourceOfFunds != companySourceOfFundsLocalData ||
254
+ companySourceOfFundsDescription !=
255
+ companySourceOfFundsDescriptionLocalData ||
256
+ !countriesOfOperationsMatch ||
248
257
  companyIncType != companyIncTypeLocalData ||
258
+ transactionVolume != transactionVolumeLocalData ||
259
+ transactionVolumeDescription != transactionVolumeDescriptionLocalData ||
260
+ purposeOfAccount != purposeOfAccountLocalData ||
261
+ purposeOfAccountDescription != purposeOfAccountDescriptionLocalData ||
262
+ regulatedStatus != regulatedStatusLocalData ||
263
+ regulatedStatusDescription != regulatedStatusDescriptionLocalData ||
264
+ usNexus != usNexusLocalData ||
265
+ !usNexusTypesMatch ||
266
+ companySubIndustry != companySubIndustryLocalData ||
249
267
  !(fileIdsLocalData.length === companyFileIds.length &&
250
268
  companyFileIds.every((fileId) => fileIdsLocalData.includes(fileId))));
251
269
  }
@@ -8,7 +8,9 @@ export const initialState = {
8
8
  attributes: [],
9
9
  fetchStatus: { fetchState: 'Not-Started', error: undefined },
10
10
  },
11
+ affectedEntityIds: undefined,
11
12
  approvalRuleIds: [],
13
+ newApprovalRuleId: undefined,
12
14
  approvalRulesDeleteStatusById: {},
13
15
  billPaySetupApproverViewUpdateData: undefined,
14
16
  hasValidState() {
@@ -153,9 +155,10 @@ const billPaySetupApproverView = createSlice({
153
155
  },
154
156
  saveBillPaySetupApproverViewUpdatesSuccess: {
155
157
  reducer(draft, action) {
156
- const { approvalRuleIds } = action.payload;
158
+ const { approvalRuleIds, affectedEntityIds, newApprovalRuleId } = action.payload;
157
159
  if (draft.billPaySetupApproverViewUpdateData != null) {
158
- if (draft.billPaySetupApproverViewUpdateData.type === 'approval_update' &&
160
+ if (draft.billPaySetupApproverViewUpdateData.type ===
161
+ 'approval_update' &&
159
162
  draft.billPaySetupApproverViewUpdateData.data
160
163
  ?.isApplicableOnPendingApprovalEntity === true) {
161
164
  draft.listeningToPusherEvent = true;
@@ -166,10 +169,12 @@ const billPaySetupApproverView = createSlice({
166
169
  };
167
170
  }
168
171
  draft.approvalRuleIds = approvalRuleIds;
172
+ draft.affectedEntityIds = affectedEntityIds;
173
+ draft.newApprovalRuleId = newApprovalRuleId;
169
174
  },
170
- prepare(approvalRuleIds) {
175
+ prepare(approvalRuleIds, affectedEntityIds, newApprovalRuleId) {
171
176
  return {
172
- payload: { approvalRuleIds },
177
+ payload: { approvalRuleIds, affectedEntityIds, newApprovalRuleId },
173
178
  };
174
179
  },
175
180
  },
@@ -222,6 +227,10 @@ const billPaySetupApproverView = createSlice({
222
227
  },
223
228
  setListeningToPusherEvent(draft, action) {
224
229
  draft.listeningToPusherEvent = action.payload;
230
+ if (action.payload === false) {
231
+ draft.affectedEntityIds = undefined;
232
+ draft.newApprovalRuleId = undefined;
233
+ }
225
234
  },
226
235
  clearBillPaySetupApproverViewUpdateData(draft) {
227
236
  if (draft.billPaySetupApproverViewUpdateData != null) {
@@ -6,7 +6,7 @@ import { getClassesByIds } from '../../../../entity/class/classSelector';
6
6
  import { getUserByUserId } from '../../../../entity/user/userSelector';
7
7
  import { getUserRoleByUserId } from '../../../../entity/userRole/userRoleSelector';
8
8
  export const getBillPaySetupApproverView = createSelector((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (billPaySetupApproverViewState, approvalRuleState, userState) => {
9
- const { approvalRulesDeleteStatusById, approvalRuleIds, fetchState, error, listeningToPusherEvent, } = billPaySetupApproverViewState;
9
+ const { approvalRulesDeleteStatusById, approvalRuleIds, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = billPaySetupApproverViewState;
10
10
  const deleteStateList = Object.values(approvalRulesDeleteStatusById);
11
11
  const approvalRules = getApprovalRulesByIds(approvalRuleState, approvalRuleIds);
12
12
  const allApprovalRules = approvalRules.map((approvalRule) => {
@@ -41,10 +41,11 @@ export const getBillPaySetupApproverView = createSelector((state) => state.billP
41
41
  fetchState,
42
42
  error,
43
43
  listeningToPusherEvent,
44
+ newApprovalRuleId,
44
45
  };
45
46
  });
46
47
  export const getBillPaySetupApproverUpdateDataView = createSelector((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState) => {
47
- const { approvalRuleIds, approverListState, billPaySetupApproverViewUpdateData, fetchState, error, listeningToPusherEvent, } = billPaySetupApproverViewState;
48
+ const { affectedEntityIds, approvalRuleIds, approverListState, billPaySetupApproverViewUpdateData, fetchState, error, listeningToPusherEvent, } = billPaySetupApproverViewState;
48
49
  const { approverIds, attributes } = approverListState;
49
50
  const allApprovalRules = getApprovalRulesByIds(approvalRuleState, approvalRuleIds);
50
51
  const allApprovers = approverIds
@@ -84,6 +85,7 @@ export const getBillPaySetupApproverUpdateDataView = createSelector((state) => s
84
85
  reportId: 'class_list',
85
86
  });
86
87
  return {
88
+ affectedEntityIds,
87
89
  allApprovalRules,
88
90
  allApprovers,
89
91
  filteredApprovers,
@@ -17,6 +17,8 @@ export const saveBillPaySetupApproverViewUpdatesEpic = (actions$, state$, zeniAP
17
17
  .pipe(mergeMap((response) => {
18
18
  if (isSuccessResponse(response) && response.data != null) {
19
19
  const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
20
+ const affectedEntityIds = response.data.affected_entity_ids ?? [];
21
+ const newApprovalRuleId = response.data.new_approval_rule?.approval_rule_id;
20
22
  const actions = [
21
23
  updateAllUsers({ users: response.data.users }),
22
24
  updateApprovalRules(response.data.approval_rules),
@@ -25,7 +27,7 @@ export const saveBillPaySetupApproverViewUpdatesEpic = (actions$, state$, zeniAP
25
27
  messageText: 'success',
26
28
  type: 'success',
27
29
  }),
28
- saveBillPaySetupApproverViewUpdatesSuccess(approvalRuleIds),
30
+ saveBillPaySetupApproverViewUpdatesSuccess(approvalRuleIds, affectedEntityIds, newApprovalRuleId),
29
31
  ];
30
32
  return from(actions);
31
33
  }
@@ -2,8 +2,8 @@ import { getChargeCardRepaymentByIds } from '../../../../entity/chargeCardRepaym
2
2
  import { getUsersByUserIds } from '../../../../entity/user/userSelector';
3
3
  import { applyPaymentHistoryFiltersSearchAndSort } from './chargeCardPaymentHistoryHelpers';
4
4
  export const getChargeCardPaymentHistoryDownloadReport = (state) => {
5
- const { chargeCardPaymentHistoryState, chargeCardRepaymentState, userState, } = state;
6
- const { filters, repaymentHistoryIds, searchText, uiState, fetchState, error, } = chargeCardPaymentHistoryState;
5
+ const { chargeCardPaymentHistoryState, chargeCardRepaymentState, userState } = state;
6
+ const { filters, repaymentHistoryIds, searchText, uiState, fetchState, error } = chargeCardPaymentHistoryState;
7
7
  const repaymentHistory = getChargeCardRepaymentByIds(chargeCardRepaymentState, repaymentHistoryIds);
8
8
  const repaymentHistoryUserIds = Array.from(new Set(repaymentHistory.map((r) => r.paidById)));
9
9
  const repaymentHistoryUsers = getUsersByUserIds(userState, repaymentHistoryUserIds);
@@ -1,9 +1,9 @@
1
1
  import { reduceAllFetchState } from '../../../../commonStateTypes/reduceFetchState';
2
2
  import { getChargeCardRepaymentByIds } from '../../../../entity/chargeCardRepayment/chargeCardRepaymentSelector';
3
- import { getUsersByUserIds } from '../../../../entity/user/userSelector';
4
- import { getAllFundingAccounts, mapDepositAccToFundingAccount, mapPaymentAccToFundingAccount, } from '../../commonSetup/setupViewSelector';
5
3
  import { getDepositAccountByDepositAccountId } from '../../../../entity/depositAccount/depositAccountSelector';
6
4
  import { getPaymentAccountByPaymentAccountId } from '../../../../entity/paymentAccount/paymentAccountSelector';
5
+ import { getUsersByUserIds } from '../../../../entity/user/userSelector';
6
+ import { getAllFundingAccounts, mapDepositAccToFundingAccount, mapPaymentAccToFundingAccount, } from '../../commonSetup/setupViewSelector';
7
7
  import { getAllDepositAccounts } from '../../zeniAccounts/depositAccountList/depositAccountListSelector';
8
8
  import { getAllPaymentAccounts } from '../../zeniAccounts/paymentAccountList/paymentAccountListSelector';
9
9
  import { applyPaymentHistoryFiltersSearchAndSort } from './chargeCardPaymentHistoryHelpers';
@@ -15,7 +15,10 @@ export const getChargeCardRepaymentDetail = (state) => {
15
15
  else {
16
16
  const depositFundingFromLimit = Object.values(depositAccountState.depositAccountLimitForChargeCardByID ?? {}).map(mapDepositAccountWithLimitToFundingAccount);
17
17
  const paymentFundingAccounts = getAllFundingAccounts([], paymentAccountsView.paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus);
18
- transferFromAccounts = [...depositFundingFromLimit, ...paymentFundingAccounts];
18
+ transferFromAccounts = [
19
+ ...depositFundingFromLimit,
20
+ ...paymentFundingAccounts,
21
+ ];
19
22
  }
20
23
  }
21
24
  const reducedFetchState = reduceAnyCompletedFetchState([
@@ -7,7 +7,8 @@ export const fetchChargeCardRepaymentDetailEpic = (actions$, state$) => actions$
7
7
  const fetchChargeCardRepaymentDetailActions = [];
8
8
  const state = state$.value;
9
9
  const depositAccounts = state.depositAccountListState;
10
- const willFetchDeposit = depositAccounts.fetchState !== 'In-Progress' && depositAccounts.fetchState !== 'Completed';
10
+ const willFetchDeposit = depositAccounts.fetchState !== 'In-Progress' &&
11
+ depositAccounts.fetchState !== 'Completed';
11
12
  if (willFetchDeposit) {
12
13
  fetchChargeCardRepaymentDetailActions.push(fetchDepositAccountList());
13
14
  }
@@ -9,8 +9,8 @@ import { getAllFundingAccounts } from '../../commonSetup/setupViewSelector';
9
9
  import { accountTypeSubConfigCodeToAccType } from '../../helpers';
10
10
  import { getAllDepositAccounts } from '../../zeniAccounts/depositAccountList/depositAccountListSelector';
11
11
  import { getAllPaymentAccounts } from '../../zeniAccounts/paymentAccountList/paymentAccountListSelector';
12
- import { addRepaymentToChargeCardPaymentHistory } from '../chargeCardPaymentHistory/chargeCardPaymentHistoryReducer';
13
12
  import { updateCreditAccountRepaymentAmountAndDate } from '../chargeCardList/chargeCardListReducer';
13
+ import { addRepaymentToChargeCardPaymentHistory } from '../chargeCardPaymentHistory/chargeCardPaymentHistoryReducer';
14
14
  import { initiateChargeCardRepayment, updateChargeCardRepaymentStatus, } from './chargeCardRepaymentDetailReducer';
15
15
  export const initiateChargeCardRepaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(initiateChargeCardRepayment.match), switchMap((action) => {
16
16
  const state = state$.value;
@@ -115,8 +115,28 @@ export const updateBusinessVerificationDetailsEpic = (actions$, state$, zeniAPI)
115
115
  return from([]);
116
116
  }
117
117
  }));
118
+ /** US Nexus API keys. Form may submit these or display labels; we send keys to API. */
119
+ const US_NEXUS_KEYS = new Set([
120
+ 'employees',
121
+ 'customers',
122
+ 'physical_office',
123
+ 'banking_relationships',
124
+ ]);
125
+ /** Maps display label → API key for US nexus types (English labels from strings). */
126
+ const US_NEXUS_LABEL_TO_KEY = {
127
+ Employees: 'employees',
128
+ Customers: 'customers',
129
+ 'Physical office or facility': 'physical_office',
130
+ 'Banking relationships': 'banking_relationships',
131
+ };
132
+ function toUsNexusTypeKey(value) {
133
+ if (US_NEXUS_KEYS.has(value)) {
134
+ return value;
135
+ }
136
+ return US_NEXUS_LABEL_TO_KEY[value] ?? value;
137
+ }
118
138
  export const toBusinessVerificationCompanyDataPayload = (companyLocalData, sendForVerification, companyAddressData, registeredAddressData, setupViewType) => {
119
- const { companyDescription, companyLegalName, companyIndustry, website, incDate, taxIdOrEIN, phone, syncToken, fileIds, typeOfIncorporation, sourceOfFunds, } = companyLocalData;
139
+ const { companyDescription, companyLegalName, companyIndustry, companySubIndustry, countriesOfOperations, companySourceOfFunds, companySourceOfFundsDescription, transactionVolume, transactionVolumeDescription, purposeOfAccount, purposeOfAccountDescription, regulatedStatus, regulatedStatusDescription, usNexus, usNexusTypes, website, incDate, taxIdOrEIN, phone, syncToken, fileIds, typeOfIncorporation, stateOfIncorporation, sourceOfFunds, } = companyLocalData;
120
140
  const company = {
121
141
  is_ready_for_verification: sendForVerification,
122
142
  file_ids: fileIds,
@@ -167,9 +187,52 @@ export const toBusinessVerificationCompanyDataPayload = (companyLocalData, sendF
167
187
  if (typeOfIncorporation != null) {
168
188
  company['company_inc_type'] = typeOfIncorporation;
169
189
  }
190
+ if (stateOfIncorporation != null) {
191
+ company['company_inc_state'] = stateOfIncorporation;
192
+ }
170
193
  if (companyIndustry != null) {
171
194
  company['company_industry'] = companyIndustry;
172
195
  }
196
+ Object.assign(company, {
197
+ ...(companySubIndustry != null && {
198
+ company_industry_sub_type: companySubIndustry,
199
+ }),
200
+ ...(countriesOfOperations != null &&
201
+ countriesOfOperations.length > 0 && {
202
+ company_countries_of_operations: countriesOfOperations,
203
+ }),
204
+ ...(companySourceOfFunds != null && {
205
+ company_source_of_funds: companySourceOfFunds,
206
+ }),
207
+ ...(companySourceOfFundsDescription != null && {
208
+ company_source_of_funds_desc: companySourceOfFundsDescription,
209
+ }),
210
+ ...(transactionVolume != null && {
211
+ company_transaction_vol_expectations: transactionVolume,
212
+ }),
213
+ ...(transactionVolumeDescription != null && {
214
+ company_transaction_vol_expectations_desc: transactionVolumeDescription,
215
+ }),
216
+ ...(purposeOfAccount != null && {
217
+ company_purpose_of_account: purposeOfAccount,
218
+ }),
219
+ ...(purposeOfAccountDescription != null && {
220
+ company_purpose_of_account_desc: purposeOfAccountDescription,
221
+ }),
222
+ ...(regulatedStatus != null && {
223
+ company_regulated_states: regulatedStatus === 'yes',
224
+ }),
225
+ ...(regulatedStatusDescription != null && {
226
+ company_regulated_states_desc: regulatedStatusDescription,
227
+ }),
228
+ ...(usNexus != null && {
229
+ company_us_nexus: usNexus === 'yes',
230
+ }),
231
+ ...(usNexusTypes != null &&
232
+ usNexusTypes.length > 0 && {
233
+ company_us_nexus_desc: usNexusTypes.map(toUsNexusTypeKey),
234
+ }),
235
+ });
173
236
  if (setupViewType === 'zeni_treasury' && sourceOfFunds != null) {
174
237
  company['source_of_funds'] = sourceOfFunds;
175
238
  }
@@ -258,6 +321,8 @@ const getBusinessVerificationForFeature = (setupViewType) => {
258
321
  return 'bill_pay';
259
322
  case 'zeni_treasury':
260
323
  return 'treasury_accounts';
324
+ case 'other_connection':
325
+ return 'other_connection';
261
326
  //whenever a new setup view type is added, add the corresponding feature here
262
327
  case 'billing':
263
328
  console.warn(`Invalid type for setup view`);
@@ -43,9 +43,9 @@ export const updateSetupViewLocalStoreDataEpic = (actions$, state$) => actions$.
43
43
  */
44
44
  export function toSetupViewLocalData(company, users, userRoles, primaryContact) {
45
45
  const { companyInfo, incInfo, taxInfo, questionaire, companyBillPayInfo } = company;
46
- const { companyId, companyDescription, companyLegalName, companyUrl, phone, syncToken, sourceOfFunds, } = companyInfo;
46
+ const { companyId, companyDescription, companyLegalName, companyUrl, phone, syncToken, sourceOfFunds, companySourceOfFunds: incCompanySourceOfFunds, companySourceOfFundsDescription, countriesOfOperations, transactionVolume, transactionVolumeDescription, purposeOfAccount, purposeOfAccountDescription, regulatedStatus, regulatedStatusDescription, usNexus, usNexusTypes, } = companyInfo;
47
47
  const { usersSelectedForVerification: usersSelected } = companyBillPayInfo;
48
- const { fileIds, companyIncDate: incDate, companyIncType } = incInfo;
48
+ const { fileIds, companyIncDate: incDate, companyIncType, companyIncState, companySubIndustry, } = incInfo;
49
49
  const { companyIndustry } = questionaire;
50
50
  const { taxId } = taxInfo;
51
51
  const companyDetails = {
@@ -53,6 +53,10 @@ export function toSetupViewLocalData(company, users, userRoles, primaryContact)
53
53
  companyDescription,
54
54
  companyIndustry,
55
55
  companyLegalName,
56
+ companySubIndustry,
57
+ companySourceOfFunds: incCompanySourceOfFunds,
58
+ companySourceOfFundsDescription,
59
+ countriesOfOperations,
56
60
  taxIdOrEIN: taxId,
57
61
  incDate,
58
62
  phone,
@@ -61,6 +65,15 @@ export function toSetupViewLocalData(company, users, userRoles, primaryContact)
61
65
  syncToken,
62
66
  typeOfIncorporation: companyIncType,
63
67
  sourceOfFunds,
68
+ stateOfIncorporation: companyIncState,
69
+ transactionVolume,
70
+ transactionVolumeDescription,
71
+ purposeOfAccount,
72
+ purposeOfAccountDescription,
73
+ regulatedStatus,
74
+ regulatedStatusDescription,
75
+ usNexus,
76
+ usNexusTypes,
64
77
  };
65
78
  let primaryContactDetails = undefined;
66
79
  if (primaryContact != null) {
@@ -109,7 +109,7 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
109
109
  if (companyDetails.localData != null) {
110
110
  const deleteFileStatusById = {};
111
111
  const updateFileStatusById = {};
112
- const { syncToken, companyDescription, companyLegalName, website, companyIndustry, phone, taxIdOrEIN, incDate, fileIds, typeOfIncorporation, sourceOfFunds, } = companyDetails.localData;
112
+ const { syncToken, companyDescription, companyLegalName, website, companyIndustry, companySubIndustry, companySourceOfFunds, companySourceOfFundsDescription, countriesOfOperations, phone, taxIdOrEIN, incDate, fileIds, typeOfIncorporation, sourceOfFunds, transactionVolume, transactionVolumeDescription, purposeOfAccount, purposeOfAccountDescription, regulatedStatus, regulatedStatusDescription, stateOfIncorporation, usNexus, usNexusTypes, } = companyDetails.localData;
113
113
  fileIds.forEach((fileId) => {
114
114
  deleteFileStatusById[fileId] = getFileDeleteStatusById(state, fileId);
115
115
  });
@@ -123,6 +123,10 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
123
123
  companyDescription,
124
124
  companyLegalName,
125
125
  companyIndustry,
126
+ companySubIndustry,
127
+ companySourceOfFunds,
128
+ companySourceOfFundsDescription,
129
+ countriesOfOperations,
126
130
  website,
127
131
  phone,
128
132
  taxIdOrEIN,
@@ -136,6 +140,15 @@ export const getCompanyAndIdentityDetails = (state, companyId, companyAndIdentit
136
140
  primaryContactLocalData,
137
141
  typeOfIncorporation,
138
142
  sourceOfFunds,
143
+ transactionVolume,
144
+ transactionVolumeDescription,
145
+ purposeOfAccount,
146
+ purposeOfAccountDescription,
147
+ regulatedStatus,
148
+ regulatedStatusDescription,
149
+ stateOfIncorporation,
150
+ usNexus,
151
+ usNexusTypes,
139
152
  };
140
153
  }
141
154
  const companyOfficerLocalData = {
@@ -1,9 +1,9 @@
1
1
  import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
2
- import { ALL_ENTITY_TYPES } from '../../../entity/entityApprovalStatus/entityApprovalStatusState';
2
+ import { ALL_ENTITY_TYPES_WITH_OTHER_CONNECTION } from '../../../entity/entityApprovalStatus/entityApprovalStatusState';
3
3
  const SETUP_VIEW_TYPES = ['billing'];
4
4
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
5
5
  const toSetupViewType = (v) => stringToUnion(v, [
6
- ...ALL_ENTITY_TYPES,
6
+ ...ALL_ENTITY_TYPES_WITH_OTHER_CONNECTION,
7
7
  ...SETUP_VIEW_TYPES,
8
8
  ...CHARGE_CARD_SETUP_VIEW_TYPES,
9
9
  ]);
@@ -17,6 +17,8 @@ export const saveRemiSetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI)
17
17
  .pipe(mergeMap((response) => {
18
18
  if (isSuccessResponse(response) && response.data != null) {
19
19
  const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
20
+ const affectedEntityIds = response.data.affected_entity_ids ?? [];
21
+ const newApprovalRuleId = response.data.new_approval_rule?.approval_rule_id;
20
22
  const actions = [
21
23
  updateAllUsers({ users: response.data.users }),
22
24
  updateApprovalRules(response.data.approval_rules),
@@ -25,7 +27,7 @@ export const saveRemiSetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI)
25
27
  messageText: 'success',
26
28
  type: 'success',
27
29
  }),
28
- saveRemiSetupApproverViewUpdatesSuccess(approvalRuleIds),
30
+ saveRemiSetupApproverViewUpdatesSuccess(approvalRuleIds, affectedEntityIds, newApprovalRuleId),
29
31
  ];
30
32
  return from(actions);
31
33
  }
@@ -8,7 +8,9 @@ export const initialState = {
8
8
  attributes: [],
9
9
  fetchStatus: { fetchState: 'Not-Started', error: undefined },
10
10
  },
11
+ affectedEntityIds: undefined,
11
12
  approvalRuleIds: [],
13
+ newApprovalRuleId: undefined,
12
14
  approvalRulesDeleteStatusById: {},
13
15
  remiSetupApproverViewUpdateData: undefined,
14
16
  hasValidState() {
@@ -175,7 +177,7 @@ const remiSetupApproverView = createSlice({
175
177
  },
176
178
  saveRemiSetupApproverViewUpdatesSuccess: {
177
179
  reducer(draft, action) {
178
- const { approvalRuleIds } = action.payload;
180
+ const { approvalRuleIds, affectedEntityIds, newApprovalRuleId } = action.payload;
179
181
  if (draft.remiSetupApproverViewUpdateData != null) {
180
182
  if (draft.remiSetupApproverViewUpdateData.type === 'approval_update' &&
181
183
  draft.remiSetupApproverViewUpdateData.data
@@ -188,10 +190,12 @@ const remiSetupApproverView = createSlice({
188
190
  };
189
191
  }
190
192
  draft.approvalRuleIds = approvalRuleIds;
193
+ draft.affectedEntityIds = affectedEntityIds;
194
+ draft.newApprovalRuleId = newApprovalRuleId;
191
195
  },
192
- prepare(approvalRuleIds) {
196
+ prepare(approvalRuleIds, affectedEntityIds, newApprovalRuleId) {
193
197
  return {
194
- payload: { approvalRuleIds },
198
+ payload: { approvalRuleIds, affectedEntityIds, newApprovalRuleId },
195
199
  };
196
200
  },
197
201
  },
@@ -244,6 +248,10 @@ const remiSetupApproverView = createSlice({
244
248
  },
245
249
  setListeningToPusherEvent(draft, action) {
246
250
  draft.listeningToPusherEvent = action.payload;
251
+ if (action.payload === false) {
252
+ draft.affectedEntityIds = undefined;
253
+ draft.newApprovalRuleId = undefined;
254
+ }
247
255
  },
248
256
  clearRemiSetupApproverViewUpdateData(draft) {
249
257
  if (draft.remiSetupApproverViewUpdateData != null) {
@@ -7,7 +7,7 @@ import { getUserByUserId } from '../../../../entity/user/userSelector';
7
7
  import { getUserRoleByUserId } from '../../../../entity/userRole/userRoleSelector';
8
8
  export const getRemiSetupApproverView = (state, filterAdmins = true) => {
9
9
  const { remiSetupApproverViewState, approvalRuleState, userState } = state;
10
- const { approvalRulesDeleteStatusById, approvalRuleIds, fetchState, error, listeningToPusherEvent, } = remiSetupApproverViewState;
10
+ const { approvalRulesDeleteStatusById, approvalRuleIds, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = remiSetupApproverViewState;
11
11
  const deleteStateList = Object.values(approvalRulesDeleteStatusById);
12
12
  const approvalRules = getApprovalRulesByIds(approvalRuleState, approvalRuleIds);
13
13
  const allApprovalRules = approvalRules.map((approvalRule) => {
@@ -43,10 +43,11 @@ export const getRemiSetupApproverView = (state, filterAdmins = true) => {
43
43
  fetchState,
44
44
  error,
45
45
  listeningToPusherEvent,
46
+ newApprovalRuleId,
46
47
  };
47
48
  };
48
49
  export const getRemiSetupApproverUpdateDataView = createSelector((state) => state.remiSetupApproverViewState, (state) => state.approvalRuleState, (state) => state.classState, (state) => state.classListState, (state) => state.userState, (state) => state.userRoleState, (remiSetupApproverViewState, approvalRuleState, classState, classListState, userState, userRoleState) => {
49
- const { approvalRuleIds, approverListState, remiSetupApproverViewUpdateData, fetchState, error, listeningToPusherEvent, } = remiSetupApproverViewState;
50
+ const { affectedEntityIds, approvalRuleIds, approverListState, remiSetupApproverViewUpdateData, fetchState, error, listeningToPusherEvent, } = remiSetupApproverViewState;
50
51
  const { approverIds, attributes, fetchStatus } = approverListState;
51
52
  const { fetchState: classListFetchState, error: classListFetchStateError, classIds, } = classListState;
52
53
  const allApprovalRules = getApprovalRulesByIds(approvalRuleState, approvalRuleIds).map((approvalRule) => {
@@ -101,6 +102,7 @@ export const getRemiSetupApproverUpdateDataView = createSelector((state) => stat
101
102
  reportId: 'class_list',
102
103
  });
103
104
  return {
105
+ affectedEntityIds,
104
106
  allApprovalRules,
105
107
  allApprovers,
106
108
  allAttributes,
@@ -0,0 +1,43 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { updateTransactionActivityLogs } from '../../entity/transactionActivityLog/transactionActivityLogReducer';
4
+ import { updateAllUsers } from '../../entity/user/userReducer';
5
+ import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
6
+ import { fetchTransactionActivityLog, updateTransactionActivityLogViewFetchStatus, updateTransactionActivityLogViewOnSuccess, } from './transactionActivityLogViewReducer';
7
+ export const fetchTransactionActivityLogEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchTransactionActivityLog.match), switchMap((action) => {
8
+ const { qboId } = action.payload;
9
+ return zeniAPI
10
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${qboId}/activity`)
11
+ .pipe(mergeMap((response) => {
12
+ if (isSuccessResponse(response) &&
13
+ response.data != null &&
14
+ response.data.activity != null) {
15
+ const updateActions = [];
16
+ if (response.data.users != null &&
17
+ response.data.users.length > 0) {
18
+ updateActions.push(updateAllUsers({
19
+ users: response.data.users,
20
+ updateType: 'merge',
21
+ }));
22
+ }
23
+ updateActions.push(updateTransactionActivityLogs(response.data.activity));
24
+ updateActions.push(updateTransactionActivityLogViewOnSuccess({
25
+ data: response.data.activity,
26
+ qboId,
27
+ }));
28
+ return from(updateActions);
29
+ }
30
+ else {
31
+ return of(updateTransactionActivityLogViewFetchStatus({
32
+ fetchState: 'Error',
33
+ error: response.status,
34
+ qboId,
35
+ }));
36
+ }
37
+ }), catchError((error) => of(updateTransactionActivityLogViewFetchStatus({
38
+ qboId,
39
+ fetchState: 'Error',
40
+ error: createZeniAPIStatus('Unexpected Error', 'fetch transaction activity log REST API call errored out' +
41
+ JSON.stringify(error)),
42
+ }))));
43
+ }));