@zeniai/client-epic-state 5.1.0-betaSS2 → 5.1.0

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 (450) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
  2. package/lib/commonStateTypes/amount.d.ts +1 -0
  3. package/lib/commonStateTypes/amount.js +9 -1
  4. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  5. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  6. package/lib/commonStateTypes/workingDayHelper.d.ts +9 -0
  7. package/lib/commonStateTypes/workingDayHelper.js +28 -1
  8. package/lib/entity/account/accountSelector.d.ts +9 -0
  9. package/lib/entity/account/accountSelector.js +14 -1
  10. package/lib/entity/account/accountState.d.ts +1 -1
  11. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  12. package/lib/entity/aiCfo/aiCfoPayload.d.ts +64 -5
  13. package/lib/entity/aiCfo/aiCfoReducer.d.ts +23 -2
  14. package/lib/entity/aiCfo/aiCfoReducer.js +252 -10
  15. package/lib/entity/aiCfo/aiCfoSelector.d.ts +4 -1
  16. package/lib/entity/aiCfo/aiCfoSelector.js +19 -1
  17. package/lib/entity/aiCfo/aiCfoState.d.ts +98 -4
  18. package/lib/entity/aiCfo/aiCfoState.js +20 -1
  19. package/lib/entity/approvalRule/approvalRuleConflict.d.ts +56 -0
  20. package/lib/entity/approvalRule/approvalRuleConflict.js +77 -0
  21. package/lib/entity/approvalRule/approvalRulePayload.d.ts +34 -5
  22. package/lib/entity/approvalRule/approvalRulePayload.js +145 -10
  23. package/lib/entity/approvalRule/approvalRuleSelector.d.ts +25 -1
  24. package/lib/entity/approvalRule/approvalRuleSelector.js +40 -0
  25. package/lib/entity/approvalRule/approvalRuleState.d.ts +59 -7
  26. package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +277 -0
  27. package/lib/entity/cardPolicy/cardPolicyPayload.js +143 -0
  28. package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +19 -0
  29. package/lib/entity/cardPolicy/cardPolicyReducer.js +175 -0
  30. package/lib/entity/cardPolicy/cardPolicySelector.d.ts +32 -0
  31. package/lib/entity/cardPolicy/cardPolicySelector.js +99 -0
  32. package/lib/entity/cardPolicy/cardPolicyState.d.ts +205 -0
  33. package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
  34. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
  35. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +68 -0
  36. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
  37. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
  38. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +25 -0
  39. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +39 -0
  40. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +24 -0
  41. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +105 -0
  42. package/lib/entity/class/classReducer.d.ts +4 -4
  43. package/lib/entity/class/classState.d.ts +1 -1
  44. package/lib/entity/forecast/forecastState.d.ts +1 -1
  45. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
  46. package/lib/entity/jeSchedules/jeSchedulesPayload.js +7 -0
  47. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
  48. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  49. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
  50. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  51. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  52. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  53. package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
  54. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
  55. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  56. package/lib/entity/snackbar/snackbarTypes.js +7 -0
  57. package/lib/entity/task/taskPayload.d.ts +3 -1
  58. package/lib/entity/task/taskPayload.js +2 -0
  59. package/lib/entity/task/taskState.d.ts +2 -0
  60. package/lib/entity/tenant/clearAllEpic.d.ts +9 -2
  61. package/lib/entity/tenant/clearAllEpic.js +14 -0
  62. package/lib/entity/tenant/tenantPayload.d.ts +21 -0
  63. package/lib/entity/tenant/tenantReducer.d.ts +14 -5
  64. package/lib/entity/tenant/tenantReducer.js +132 -8
  65. package/lib/entity/tenant/tenantState.d.ts +24 -1
  66. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +4 -0
  67. package/lib/entity/transaction/payloadTypes/transactionPayload.js +18 -10
  68. package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
  69. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +2 -1
  70. package/lib/entity/transaction/stateTypes/transactionLine.js +2 -1
  71. package/lib/epic.d.ts +31 -2
  72. package/lib/epic.js +31 -2
  73. package/lib/esm/commonStateTypes/amount.js +7 -0
  74. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  75. package/lib/esm/commonStateTypes/workingDayHelper.js +26 -0
  76. package/lib/esm/entity/account/accountSelector.js +11 -0
  77. package/lib/esm/entity/aiCfo/aiCfoReducer.js +252 -10
  78. package/lib/esm/entity/aiCfo/aiCfoSelector.js +17 -1
  79. package/lib/esm/entity/aiCfo/aiCfoState.js +17 -0
  80. package/lib/esm/entity/approvalRule/approvalRuleConflict.js +74 -0
  81. package/lib/esm/entity/approvalRule/approvalRulePayload.js +145 -10
  82. package/lib/esm/entity/approvalRule/approvalRuleSelector.js +35 -0
  83. package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +130 -0
  84. package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +171 -0
  85. package/lib/esm/entity/cardPolicy/cardPolicySelector.js +75 -0
  86. package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
  87. package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +64 -0
  88. package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
  89. package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +35 -0
  90. package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +101 -0
  91. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +7 -0
  92. package/lib/esm/entity/snackbar/snackbarTypes.js +7 -0
  93. package/lib/esm/entity/task/taskPayload.js +2 -0
  94. package/lib/esm/entity/tenant/clearAllEpic.js +14 -0
  95. package/lib/esm/entity/tenant/tenantReducer.js +130 -7
  96. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +18 -10
  97. package/lib/esm/entity/transaction/stateTypes/transactionLine.js +1 -0
  98. package/lib/esm/epic.js +31 -2
  99. package/lib/esm/index.js +68 -28
  100. package/lib/esm/reducer.js +21 -0
  101. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +6 -3
  102. package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  103. package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +2 -1
  104. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  105. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +39 -11
  106. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +14 -4
  107. package/lib/esm/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +38 -0
  108. package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  109. package/lib/esm/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +16 -0
  110. package/lib/esm/view/companyView/companyViewReducer.js +46 -1
  111. package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +25 -0
  112. package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +98 -0
  113. package/lib/esm/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  114. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  115. package/lib/esm/view/createTransferEntry/createTransferEntryReducer.js +82 -0
  116. package/lib/esm/view/createTransferEntry/createTransferEntrySelector.js +64 -0
  117. package/lib/esm/view/createTransferEntry/createTransferEntryState.js +17 -0
  118. package/lib/esm/view/createTransferEntry/epics/createTransferEntryEpic.js +136 -0
  119. package/lib/esm/view/createTransferEntry/epics/fetchTransferAccountsEpic.js +36 -0
  120. package/lib/esm/view/dashboard/dashboardReducer.js +11 -1
  121. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
  122. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +3 -4
  123. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +13 -9
  124. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +3 -16
  125. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +9 -16
  126. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +2 -2
  127. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +2 -13
  128. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +2 -6
  129. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
  130. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +2 -6
  131. package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +3 -20
  132. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +20 -44
  133. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -6
  134. package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +106 -18
  135. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +22 -2
  136. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +14 -0
  137. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +109 -12
  138. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +10 -2
  139. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +8 -4
  140. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +11 -7
  141. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +54 -0
  142. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +13 -4
  143. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +140 -16
  144. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +60 -4
  145. package/lib/esm/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +8 -2
  146. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +29 -0
  147. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +78 -0
  148. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +47 -0
  149. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +47 -0
  150. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +34 -0
  151. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +32 -0
  152. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +54 -0
  153. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +92 -0
  154. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +225 -0
  155. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +10 -0
  156. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +23 -0
  157. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +36 -0
  158. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +27 -0
  159. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +28 -0
  160. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +52 -0
  161. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
  162. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
  163. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +36 -0
  164. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +39 -0
  165. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +34 -0
  166. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +71 -0
  167. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
  168. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
  169. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +38 -0
  170. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +289 -0
  171. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +109 -0
  172. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +44 -0
  173. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +111 -0
  174. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +25 -0
  175. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +363 -0
  176. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +36 -0
  177. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +19 -0
  178. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +6 -0
  179. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +119 -0
  180. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +154 -0
  181. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +22 -0
  182. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
  183. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +49 -0
  184. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +140 -0
  185. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +20 -0
  186. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +100 -0
  187. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +96 -0
  188. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +59 -0
  189. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +24 -0
  190. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +25 -0
  191. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +1 -0
  192. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +34 -0
  193. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +57 -0
  194. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +35 -0
  195. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
  196. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +42 -4
  197. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +35 -0
  198. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +62 -0
  199. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +44 -0
  200. package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +5 -1
  201. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +10 -2
  202. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +8 -2
  203. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +11 -7
  204. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +61 -0
  205. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +13 -4
  206. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +80 -11
  207. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +18 -0
  208. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +18 -0
  209. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +1 -1
  210. package/lib/esm/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +45 -1
  211. package/lib/esm/view/transactionDetail/journalEntryLinesViewModel.js +149 -0
  212. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +6 -1
  213. package/lib/index.d.ts +84 -34
  214. package/lib/index.js +261 -37
  215. package/lib/reducer.d.ts +21 -0
  216. package/lib/reducer.js +21 -0
  217. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +11 -2
  218. package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -3
  219. package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  220. package/lib/view/aiCfoView/epics/createSessionEpic.js +2 -1
  221. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -1
  222. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  223. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  224. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  225. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  226. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  227. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  228. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  229. package/lib/view/companyTaskManagerView/companyTaskManagerViewPayload.d.ts +19 -11
  230. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +11 -5
  231. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +40 -12
  232. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +2 -0
  233. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +13 -3
  234. package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +11 -3
  235. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.d.ts +10 -0
  236. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +42 -0
  237. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.d.ts +1 -3
  238. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  239. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.d.ts +6 -0
  240. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +20 -0
  241. package/lib/view/companyView/companyViewReducer.d.ts +12 -1
  242. package/lib/view/companyView/companyViewReducer.js +48 -3
  243. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.d.ts +9 -0
  244. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +29 -0
  245. package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.d.ts +10 -0
  246. package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +102 -0
  247. package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  248. package/lib/view/companyView/types/cockpitTypes.d.ts +3 -2
  249. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
  250. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  251. package/lib/view/createTransferEntry/createTransferEntryReducer.d.ts +32 -0
  252. package/lib/view/createTransferEntry/createTransferEntryReducer.js +86 -0
  253. package/lib/view/createTransferEntry/createTransferEntrySelector.d.ts +39 -0
  254. package/lib/view/createTransferEntry/createTransferEntrySelector.js +69 -0
  255. package/lib/view/createTransferEntry/createTransferEntryState.d.ts +30 -0
  256. package/lib/view/createTransferEntry/createTransferEntryState.js +20 -0
  257. package/lib/view/createTransferEntry/epics/createTransferEntryEpic.d.ts +11 -0
  258. package/lib/view/createTransferEntry/epics/createTransferEntryEpic.js +140 -0
  259. package/lib/view/createTransferEntry/epics/fetchTransferAccountsEpic.d.ts +14 -0
  260. package/lib/view/createTransferEntry/epics/fetchTransferAccountsEpic.js +40 -0
  261. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  262. package/lib/view/dashboard/dashboardReducer.js +11 -1
  263. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
  264. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +3 -4
  265. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +6 -0
  266. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +14 -10
  267. package/lib/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +3 -16
  268. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +9 -16
  269. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +2 -2
  270. package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +2 -13
  271. package/lib/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +2 -6
  272. package/lib/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
  273. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +2 -6
  274. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -6
  275. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +3 -20
  276. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  277. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +20 -9
  278. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +12 -19
  279. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +21 -45
  280. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +8 -6
  281. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -0
  282. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +15 -7
  283. package/lib/view/expenseAutomationView/transactionFilterHelpers.js +106 -18
  284. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  285. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -2
  286. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  287. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  288. package/lib/view/people/peopleTypes.d.ts +1 -1
  289. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  290. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  291. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  292. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +8 -1
  293. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +21 -1
  294. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +22 -0
  295. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +7 -0
  296. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +14 -0
  297. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +14 -3
  298. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +110 -13
  299. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +16 -0
  300. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +10 -2
  301. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +8 -4
  302. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +10 -6
  303. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.d.ts +23 -0
  304. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +58 -0
  305. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +12 -3
  306. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +59 -1
  307. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +142 -17
  308. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +31 -5
  309. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +8 -1
  310. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +60 -4
  311. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +8 -2
  312. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.d.ts +47 -0
  313. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +34 -0
  314. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.d.ts +23 -0
  315. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +82 -0
  316. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.d.ts +40 -0
  317. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +51 -0
  318. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.d.ts +37 -0
  319. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +53 -0
  320. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.d.ts +14 -0
  321. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +38 -0
  322. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.d.ts +7 -0
  323. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +36 -0
  324. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.d.ts +56 -0
  325. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +60 -0
  326. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.d.ts +22 -0
  327. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +96 -0
  328. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.d.ts +59 -0
  329. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +230 -0
  330. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.d.ts +122 -0
  331. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +13 -0
  332. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.d.ts +7 -0
  333. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +27 -0
  334. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.d.ts +9 -0
  335. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +40 -0
  336. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.d.ts +7 -0
  337. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +31 -0
  338. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.d.ts +15 -0
  339. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +32 -0
  340. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
  341. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +56 -0
  342. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +15 -0
  343. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
  344. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +8 -0
  345. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
  346. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +8 -0
  347. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +40 -0
  348. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +8 -0
  349. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +43 -0
  350. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +8 -0
  351. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +38 -0
  352. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
  353. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +75 -0
  354. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +15 -0
  355. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
  356. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +7 -0
  357. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
  358. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +8 -0
  359. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +42 -0
  360. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.d.ts +8 -0
  361. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +294 -0
  362. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.d.ts +8 -0
  363. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +113 -0
  364. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.d.ts +9 -0
  365. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +48 -0
  366. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.d.ts +8 -0
  367. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +115 -0
  368. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.d.ts +13 -0
  369. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +29 -0
  370. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.d.ts +14 -0
  371. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +369 -0
  372. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.d.ts +6 -0
  373. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +40 -0
  374. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.d.ts +7 -0
  375. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +26 -0
  376. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.d.ts +116 -0
  377. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +10 -0
  378. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.d.ts +33 -0
  379. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +126 -0
  380. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +52 -0
  381. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +158 -0
  382. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +11 -0
  383. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +31 -0
  384. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +12 -0
  385. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
  386. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +9 -0
  387. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +53 -0
  388. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.d.ts +10 -0
  389. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +144 -0
  390. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +7 -0
  391. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +24 -0
  392. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.d.ts +11 -0
  393. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +104 -0
  394. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.d.ts +22 -0
  395. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +100 -0
  396. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.d.ts +8 -0
  397. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +63 -0
  398. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.d.ts +3 -0
  399. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +28 -0
  400. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  401. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +14 -0
  402. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +27 -1
  403. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.d.ts +34 -0
  404. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +2 -0
  405. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.d.ts +7 -0
  406. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +38 -0
  407. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.d.ts +12 -0
  408. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +61 -0
  409. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.d.ts +9 -0
  410. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +39 -0
  411. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
  412. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
  413. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +12 -2
  414. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +43 -5
  415. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +7 -0
  416. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +42 -1
  417. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +5 -0
  418. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.d.ts +11 -0
  419. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +66 -0
  420. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.d.ts +3 -0
  421. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +48 -0
  422. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +5 -1
  423. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +10 -2
  424. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +8 -2
  425. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +10 -6
  426. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.d.ts +14 -0
  427. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +65 -0
  428. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +12 -3
  429. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +14 -3
  430. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +81 -12
  431. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +12 -0
  432. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +8 -0
  433. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +22 -0
  434. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +8 -0
  435. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +22 -0
  436. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +1 -1
  437. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.d.ts +1 -1
  438. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +46 -2
  439. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewState.d.ts +2 -0
  440. package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
  441. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
  442. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  443. package/lib/view/topEx/topExSelector.d.ts +1 -1
  444. package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +102 -0
  445. package/lib/view/transactionDetail/journalEntryLinesViewModel.js +160 -0
  446. package/lib/view/transactionDetail/transactionDetailPayload.d.ts +1 -1
  447. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +6 -1
  448. package/lib/view/transactionDetail/transactionDetailSelector.js +6 -1
  449. package/lib/zeniAPI.d.ts +1 -0
  450. package/package.json +1 -1
@@ -0,0 +1,154 @@
1
+ import { createSlice } from '@reduxjs/toolkit';
2
+ import { applyAiCardPolicyFormDraftUpdate } from './applyAiCardPolicyFormDraftUpdate';
3
+ import { applyExtractedPolicyToAiCardPolicyDraft as applyExtractedToAiDraftHelper } from './applyExtractedPolicyToAiCardPolicyDraft';
4
+ import { applyExtractedPolicyToManualCardPolicyDraft as applyExtractedToManualDraftHelper } from './applyExtractedPolicyToManualCardPolicyDraft';
5
+ import { applyUploadPlanToAiCardPolicyDraft as applyUploadPlanToAiDraftHelper } from './applyUploadPlanToAiCardPolicyDraft';
6
+ import { buildAiCardPolicyFormDraftSeed } from './buildAiCardPolicyFormDraftSeed';
7
+ import { buildManualCardPolicyFormDraftSeed, } from './buildManualCardPolicyFormDraftSeed';
8
+ import { toMccCategoryLike, } from './cardPolicyFormDraftTypes';
9
+ export const initialState = {
10
+ createCardPolicyTemplateRequestState: {
11
+ fetchState: 'Not-Started',
12
+ error: undefined,
13
+ },
14
+ lastCreatedCardPolicyTemplateIds: [],
15
+ lastCreateCardPolicyTemplateErrors: [],
16
+ };
17
+ const createCardPolicy = createSlice({
18
+ name: 'createCardPolicy',
19
+ initialState,
20
+ reducers: {
21
+ createCardPolicyTemplates: {
22
+ reducer(draft, action) {
23
+ draft.createCardPolicyTemplateRequestState.fetchState = 'In-Progress';
24
+ draft.createCardPolicyTemplateRequestState.error = undefined;
25
+ draft.lastCreatedCardPolicyTemplateIds = [];
26
+ draft.lastCreateCardPolicyTemplateErrors = [];
27
+ // Lets list/drawer attribute the in-flight create to its AI CFO session.
28
+ draft.lastCreateCardPolicySourceChatSessionId =
29
+ action.payload.sourceChatSessionId;
30
+ },
31
+ prepare(request) {
32
+ return { payload: request };
33
+ },
34
+ },
35
+ updateCreateCardPolicyTemplateRequestState(draft, action) {
36
+ draft.createCardPolicyTemplateRequestState.fetchState =
37
+ action.payload.fetchState;
38
+ draft.createCardPolicyTemplateRequestState.error = action.payload.error;
39
+ if (action.payload.templateIds != null) {
40
+ draft.lastCreatedCardPolicyTemplateIds = action.payload.templateIds;
41
+ }
42
+ if (action.payload.perItemErrors != null) {
43
+ draft.lastCreateCardPolicyTemplateErrors = action.payload.perItemErrors;
44
+ }
45
+ },
46
+ // Dispatched by `seedAiCardPolicyFormDraftEpic` when the AI answer lands.
47
+ seedAiCardPolicyFormDraft: {
48
+ reducer(draft, action) {
49
+ const { draft: nextDraft, context } = buildAiCardPolicyFormDraftSeed({
50
+ initialData: action.payload.initialData,
51
+ cardsMasterList: action.payload.cardsMasterList,
52
+ categorySearchOptions: action.payload.mccCategories.map(toMccCategoryLike),
53
+ suggestedAllowMerchants: action.payload.suggestedAllowMerchants,
54
+ suggestedBlockMerchants: action.payload.suggestedBlockMerchants,
55
+ suggestedAllowCategories: (action.payload.suggestedAllowCategories ?? []).map(toMccCategoryLike),
56
+ suggestedBlockCategories: (action.payload.suggestedBlockCategories ?? []).map(toMccCategoryLike),
57
+ });
58
+ draft.aiCardPolicyFormDraft = nextDraft;
59
+ draft.aiCardPolicyFormDraftContext = context;
60
+ },
61
+ prepare(payload) {
62
+ return { payload };
63
+ },
64
+ },
65
+ // Per-mode behavior lives in `applyAiCardPolicyFormDraftUpdate`.
66
+ updateAiCardPolicyFormDraft(draft, action) {
67
+ draft.aiCardPolicyFormDraft = applyAiCardPolicyFormDraftUpdate({
68
+ prev: draft.aiCardPolicyFormDraft,
69
+ next: action.payload,
70
+ context: draft.aiCardPolicyFormDraftContext,
71
+ });
72
+ },
73
+ // No-op when the draft isn't in `upload` mode.
74
+ updateAiCardPolicyFormDraftFromUploadPlan: {
75
+ reducer(draft, action) {
76
+ if (draft.aiCardPolicyFormDraft == null ||
77
+ draft.aiCardPolicyFormDraftContext == null) {
78
+ return;
79
+ }
80
+ const { draft: nextDraft, context } = applyUploadPlanToAiDraftHelper({
81
+ current: draft.aiCardPolicyFormDraft,
82
+ context: draft.aiCardPolicyFormDraftContext,
83
+ wizardPlan: action.payload.wizardPlan,
84
+ source: action.payload.source,
85
+ });
86
+ draft.aiCardPolicyFormDraft = nextDraft;
87
+ draft.aiCardPolicyFormDraftContext = context;
88
+ },
89
+ prepare(wizardPlan, source) {
90
+ return { payload: { wizardPlan, source } };
91
+ },
92
+ },
93
+ // Dispatched by the extract-success bridge when the upload originated from
94
+ // inside an AI CFO card-policy form.
95
+ applyExtractedPolicyToAiCardPolicyDraft: {
96
+ reducer(draft, action) {
97
+ if (draft.aiCardPolicyFormDraft == null) {
98
+ return;
99
+ }
100
+ draft.aiCardPolicyFormDraft = applyExtractedToAiDraftHelper({
101
+ current: draft.aiCardPolicyFormDraft,
102
+ extracted: action.payload.extracted,
103
+ vendorSearchOptions: action.payload.vendorSearchOptions,
104
+ categorySearchOptions: action.payload.categorySearchOptions,
105
+ });
106
+ },
107
+ prepare(payload) {
108
+ return { payload };
109
+ },
110
+ },
111
+ clearAiCardPolicyFormDraft(draft) {
112
+ draft.aiCardPolicyFormDraft = undefined;
113
+ draft.aiCardPolicyFormDraftContext = undefined;
114
+ },
115
+ // Dispatched on the manual create-page mount.
116
+ seedManualCardPolicyFormDraft: {
117
+ reducer(draft, action) {
118
+ draft.manualCardPolicyFormDraft = buildManualCardPolicyFormDraftSeed(action.payload);
119
+ },
120
+ prepare(payload) {
121
+ return { payload };
122
+ },
123
+ },
124
+ updateManualCardPolicyFormDraft(draft, action) {
125
+ draft.manualCardPolicyFormDraft = action.payload;
126
+ },
127
+ // Dispatched by the extract-success bridge when the upload originated from
128
+ // the manual `CardPolicyCreatePage`.
129
+ applyExtractedPolicyToManualCardPolicyDraft: {
130
+ reducer(draft, action) {
131
+ if (draft.manualCardPolicyFormDraft == null) {
132
+ return;
133
+ }
134
+ draft.manualCardPolicyFormDraft = applyExtractedToManualDraftHelper({
135
+ current: draft.manualCardPolicyFormDraft,
136
+ extracted: action.payload.extracted,
137
+ vendorSearchOptions: action.payload.vendorSearchOptions,
138
+ categorySearchOptions: action.payload.categorySearchOptions,
139
+ });
140
+ },
141
+ prepare(payload) {
142
+ return { payload };
143
+ },
144
+ },
145
+ clearManualCardPolicyFormDraft(draft) {
146
+ draft.manualCardPolicyFormDraft = undefined;
147
+ },
148
+ clearCreateCardPolicy(draft) {
149
+ Object.assign(draft, initialState);
150
+ },
151
+ },
152
+ });
153
+ export const { createCardPolicyTemplates, updateCreateCardPolicyTemplateRequestState, seedAiCardPolicyFormDraft, updateAiCardPolicyFormDraft, updateAiCardPolicyFormDraftFromUploadPlan, applyExtractedPolicyToAiCardPolicyDraft, clearAiCardPolicyFormDraft, seedManualCardPolicyFormDraft, updateManualCardPolicyFormDraft, applyExtractedPolicyToManualCardPolicyDraft, clearManualCardPolicyFormDraft, clearCreateCardPolicy, } = createCardPolicy.actions;
154
+ export default createCardPolicy.reducer;
@@ -0,0 +1,22 @@
1
+ export function getCreateCardPolicyTemplateRequestState(state) {
2
+ return state.createCardPolicyTemplateRequestState;
3
+ }
4
+ export function getLastCreatedCardPolicyTemplateIds(state) {
5
+ return state.lastCreatedCardPolicyTemplateIds;
6
+ }
7
+ // First id; single-create pages use this for navigate-to-detail.
8
+ export function getLastCreatedCardPolicyTemplateId(state) {
9
+ return state.lastCreatedCardPolicyTemplateIds[0];
10
+ }
11
+ export function getLastCreateCardPolicyTemplateErrors(state) {
12
+ return state.lastCreateCardPolicyTemplateErrors;
13
+ }
14
+ export function getLastCreateCardPolicySourceChatSessionId(state) {
15
+ return state.lastCreateCardPolicySourceChatSessionId;
16
+ }
17
+ export function getAiCardPolicyFormDraft(state) {
18
+ return state.aiCardPolicyFormDraft;
19
+ }
20
+ export function getManualCardPolicyFormDraft(state) {
21
+ return state.manualCardPolicyFormDraft;
22
+ }
@@ -0,0 +1,49 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { toBulkCreateCardPolicyTemplateError, toCreateCardPolicyTemplatesRequestBody, } from '../../../../../entity/cardPolicy/cardPolicyPayload';
4
+ import { updateCreatedCardPolicyTemplate } from '../../../../../entity/cardPolicy/cardPolicyReducer';
5
+ import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
6
+ import { prependCardPolicyTemplateIds } from '../cardPolicyList/cardPolicyListReducer';
7
+ import { createCardPolicyTemplates, updateCreateCardPolicyTemplateRequestState, } from './createCardPolicyReducer';
8
+ // `POST /cards/1.0/policy-templates` (bulk). On success fans entity hydrations
9
+ // + a single state update with ids + per-item errors. Partial success is
10
+ // `Completed`; the UI inspects the slice's per-item errors for partial-success UX.
11
+ export const createCardPolicyTemplatesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(createCardPolicyTemplates.match), mergeMap((action) => {
12
+ const body = toCreateCardPolicyTemplatesRequestBody(action.payload);
13
+ return zeniAPI
14
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates`, body)
15
+ .pipe(mergeMap((response) => {
16
+ if (isSuccessStatus(response) && response.data != null) {
17
+ const { templates_created, errors } = response.data;
18
+ const createdTemplates = templates_created.map((row) => row.template);
19
+ const createdTemplateIds = createdTemplates.map((template) => template.template_id);
20
+ // Prepend new ids onto the list slice in-place so new rows
21
+ // render at the top on back-nav without a wipe-and-refetch
22
+ // (which would flash the page skeleton). Skipped when all
23
+ // items errored.
24
+ const prependActions = createdTemplateIds.length > 0
25
+ ? [prependCardPolicyTemplateIds(createdTemplateIds)]
26
+ : [];
27
+ const actions = [
28
+ ...createdTemplates.map((template) => updateCreatedCardPolicyTemplate(template)),
29
+ ...prependActions,
30
+ updateCreateCardPolicyTemplateRequestState({
31
+ fetchState: 'Completed',
32
+ perItemErrors: (errors ?? []).map(toBulkCreateCardPolicyTemplateError),
33
+ templateIds: createdTemplateIds,
34
+ }),
35
+ ];
36
+ return from(actions);
37
+ }
38
+ else {
39
+ return of(updateCreateCardPolicyTemplateRequestState({
40
+ fetchState: 'Error',
41
+ error: response.status,
42
+ }));
43
+ }
44
+ }), catchError((error) => of(updateCreateCardPolicyTemplateRequestState({
45
+ fetchState: 'Error',
46
+ error: createZeniAPIStatus('Unexpected Error', 'Create card-policy templates REST API call errored out' +
47
+ JSON.stringify(error)),
48
+ }))));
49
+ }));
@@ -0,0 +1,140 @@
1
+ // Composes Step 5 review rows from live Step 1–4 form state. Per-row `isChecked`
2
+ // and per-chip `isSelected` are merged from `prevPoliciesReview` so user-removed
3
+ // chips don't snap back when an upstream slice changes.
4
+ export const deriveAiPolicyReviewRowsFromInputs = ({ vendorPolicy, categoryPolicy, cardSelections, limits, suggestedPoliciesSeed, prevPoliciesReview, }) => {
5
+ const prevById = new Map(prevPoliciesReview.map((row) => [row.id, row]));
6
+ const groups = deriveSharedChipGroups({
7
+ vendorPolicy,
8
+ categoryPolicy,
9
+ cardSelections,
10
+ limits,
11
+ });
12
+ return suggestedPoliciesSeed.map((seed) => {
13
+ const previous = prevById.get(seed.id);
14
+ return {
15
+ id: seed.id,
16
+ name: seed.name,
17
+ isChecked: previous?.isChecked ?? seed.isChecked,
18
+ chipGroups: previous != null
19
+ ? mergeChipSelections(groups, previous.chipGroups)
20
+ : groups,
21
+ };
22
+ });
23
+ };
24
+ const mergeChipSelections = (next, prev) => {
25
+ const prevByGroupId = new Map(prev.map((group) => [group.id, group]));
26
+ return next.map((group) => {
27
+ const prevGroup = prevByGroupId.get(group.id);
28
+ if (prevGroup == null) {
29
+ return group;
30
+ }
31
+ const prevSelectedById = new Map(prevGroup.chips.map((chip) => [chip.id, chip.isSelected]));
32
+ return {
33
+ ...group,
34
+ chips: group.chips.map((chip) => {
35
+ const prevSelected = prevSelectedById.get(chip.id);
36
+ return prevSelected === undefined
37
+ ? chip
38
+ : { ...chip, isSelected: prevSelected };
39
+ }),
40
+ };
41
+ });
42
+ };
43
+ const deriveSharedChipGroups = ({ vendorPolicy, categoryPolicy, cardSelections, limits, }) => {
44
+ const groups = [];
45
+ const vendorChips = chipsFromAllowBlock(vendorPolicy);
46
+ if (vendorChips.length > 0) {
47
+ groups.push({
48
+ id: 'vendors',
49
+ label: vendorPolicy.mode === 'allow' ? 'Allowed vendors' : 'Blocked vendors',
50
+ chips: vendorChips,
51
+ });
52
+ }
53
+ const categoryChips = chipsFromAllowBlock(categoryPolicy);
54
+ if (categoryChips.length > 0) {
55
+ groups.push({
56
+ id: 'categories',
57
+ label: categoryPolicy.mode === 'allow'
58
+ ? 'Allowed categories'
59
+ : 'Blocked categories',
60
+ chips: categoryChips,
61
+ });
62
+ }
63
+ const cardChips = cardSelections
64
+ .filter((row) => row.isChecked)
65
+ .map((row) => ({
66
+ id: row.id,
67
+ label: row.owner.displayName,
68
+ chipKind: 'avatar',
69
+ }));
70
+ if (cardChips.length > 0) {
71
+ groups.push({ id: 'cardholders', label: 'Cardholders', chips: cardChips });
72
+ }
73
+ const limitChips = limits.map((row) => ({
74
+ id: limitChipIdForRowId(row.id),
75
+ label: limitDisplayLabelForRowId(row.id),
76
+ helperText: limitHelperTextForRowId(row.id),
77
+ placeholder: '$0',
78
+ chipKind: 'positive',
79
+ isSelected: row.isEnabled,
80
+ optionalCode: row.isEnabled && row.amount != null ? String(row.amount) : undefined,
81
+ }));
82
+ if (limitChips.length > 0) {
83
+ groups.push({
84
+ id: 'limits',
85
+ label: 'Limits',
86
+ kind: 'limits',
87
+ chips: limitChips,
88
+ });
89
+ }
90
+ return groups;
91
+ };
92
+ const chipsFromAllowBlock = (field) => {
93
+ const items = field.mode === 'allow' ? field.allowItems : field.blockItems;
94
+ return items
95
+ .filter((item) => item.isSelected)
96
+ .map((item) => ({
97
+ id: item.id,
98
+ label: item.optionalCode != null
99
+ ? `${item.label} (${item.optionalCode})`
100
+ : item.label,
101
+ chipKind: field.mode === 'allow' ? 'positive' : 'negative',
102
+ }));
103
+ };
104
+ const limitChipIdForRowId = (rowId) => {
105
+ if (rowId === 'transactionLimit') {
106
+ return 'limit-transaction';
107
+ }
108
+ if (rowId === 'requireReceipt') {
109
+ return 'limit-receipt';
110
+ }
111
+ return rowId;
112
+ };
113
+ const limitDisplayLabelForRowId = (rowId) => {
114
+ if (rowId === 'transactionLimit') {
115
+ return 'Transaction Limit';
116
+ }
117
+ if (rowId === 'requireReceipt') {
118
+ return 'Require Receipt';
119
+ }
120
+ return humanizeLimitId(rowId);
121
+ };
122
+ const limitHelperTextForRowId = (rowId) => {
123
+ if (rowId === 'transactionLimit') {
124
+ return 'Maximum amount per single transaction';
125
+ }
126
+ if (rowId === 'requireReceipt') {
127
+ return 'Require a receipt above this amount';
128
+ }
129
+ return undefined;
130
+ };
131
+ const humanizeLimitId = (id) => {
132
+ const spaced = id
133
+ .replace(/([A-Z])/g, ' $1')
134
+ .replace(/[_-]+/g, ' ')
135
+ .trim();
136
+ if (spaced.length === 0) {
137
+ return id;
138
+ }
139
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1).toLowerCase();
140
+ };
@@ -0,0 +1,20 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, exhaustMap, filter, mergeMap } from 'rxjs/operators';
3
+ import { fetchCardPolicyMccCategories, updateCardPolicyMccCategories, updateCardPolicyMccCategoriesFailure, } from '../../../../../entity/cardPolicy/cardPolicyReducer';
4
+ import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
+ export const fetchCardPolicyMccCategoriesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyMccCategories.match),
6
+ // `exhaustMap` dedupes the React 18 StrictMode double-mount fetch on
7
+ // both Create and Edit screens, which would otherwise yield two HTTP calls.
8
+ exhaustMap(() => {
9
+ return zeniAPI
10
+ .getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/mcc-codes`)
11
+ .pipe(mergeMap((response) => {
12
+ if (isSuccessStatus(response) && response.data != null) {
13
+ return from([updateCardPolicyMccCategories(response.data)]);
14
+ }
15
+ else {
16
+ return of(updateCardPolicyMccCategoriesFailure(response.status));
17
+ }
18
+ }), catchError((error) => of(updateCardPolicyMccCategoriesFailure(createZeniAPIStatus('Unexpected Error', 'Fetch card policy MCC categories REST API call errored out' +
19
+ JSON.stringify(error))))));
20
+ }));
@@ -0,0 +1,100 @@
1
+ import { EMPTY, concat, of } from 'rxjs';
2
+ import { distinctUntilChanged, filter, map, mergeMap, take, } from 'rxjs/operators';
3
+ import { upsertAnswerPayload, upsertOrAddQuestionAnswerPayload, } from '../../../../../entity/aiCfo/aiCfoReducer';
4
+ import { getQuestionAnswerByIdForChatSession } from '../../../../../entity/aiCfo/aiCfoSelector';
5
+ import { fetchCardPolicyMccCategories } from '../../../../../entity/cardPolicy/cardPolicyReducer';
6
+ import { getAllChargeCardsWithUser } from '../../chargeCardList/chargeCardListSelector';
7
+ import { clearAiCardPolicyFormDraft, seedAiCardPolicyFormDraft, updateCreateCardPolicyTemplateRequestState, } from './createCardPolicyReducer';
8
+ const isClosedChargeCardStatusCode = (code) => code === 'closed' || code === 'closed_by_customer';
9
+ const toCardPolicyCardSelectionRow = (card) => {
10
+ const user = card.cardHolderUser;
11
+ const displayName = `${user.firstName ?? ''} ${user.lastName ?? ''}`.trim() ||
12
+ user.email ||
13
+ user.userId;
14
+ return {
15
+ id: card.id,
16
+ isChecked: false,
17
+ cardName: card.cardName,
18
+ last4: card.accountLast4,
19
+ limitAmount: card.limit?.amount ?? 0,
20
+ limitCadence: card.creditLimitFrequency?.code,
21
+ owner: {
22
+ userId: user.userId,
23
+ displayName,
24
+ roleLabel: card.cardHolderRoles?.titleAtCompany,
25
+ },
26
+ utilizationAmount: (card.limit?.amount ?? 0) - (card.available?.amount ?? 0),
27
+ };
28
+ };
29
+ const readCardsMasterList = (state) => {
30
+ const view = getAllChargeCardsWithUser(state);
31
+ return view.cards
32
+ .filter((card) => !isClosedChargeCardStatusCode(card.status?.code))
33
+ .map(toCardPolicyCardSelectionRow);
34
+ };
35
+ const readMccCategoriesAvailable = (state) => state.cardPolicyState.mccCategoriesFetchState === 'Completed';
36
+ const readCardPolicyPayload = (state, chatSessionId, questionAnswerId) => {
37
+ const qa = getQuestionAnswerByIdForChatSession(state.aiCfoState, chatSessionId, questionAnswerId);
38
+ const visualization = qa?.responses.answer?.content.visualization;
39
+ if (visualization?.type !== 'interactive_form') {
40
+ return undefined;
41
+ }
42
+ const data = visualization.data;
43
+ if (!('formType' in data) || data.formType !== 'card_policy') {
44
+ return undefined;
45
+ }
46
+ return data.payload;
47
+ };
48
+ const resolveQuestionAnswerId = (state, action) => {
49
+ if (action.payload.questionAnswerId != null) {
50
+ return action.payload.questionAnswerId;
51
+ }
52
+ const session = state.aiCfoState.aiCfoByChatSessionId[action.payload.chatSessionId];
53
+ return session?.questionAnswers.slice(-1)[0]?.questionAnswerId;
54
+ };
55
+ const isSeedTrigger = (action) => upsertAnswerPayload.match(action) ||
56
+ upsertOrAddQuestionAnswerPayload.match(action);
57
+ const isCreateSuccess = (action) => updateCreateCardPolicyTemplateRequestState.match(action) &&
58
+ action.payload.fetchState === 'Completed';
59
+ const buildSeedAction = (state, payload) => {
60
+ const cardsMasterList = readCardsMasterList(state);
61
+ const mccCategories = state.cardPolicyState.mccCategories;
62
+ return seedAiCardPolicyFormDraft({
63
+ initialData: payload,
64
+ cardsMasterList,
65
+ mccCategories,
66
+ suggestedAllowMerchants: state.cardPolicyState.suggestedAllowMerchants,
67
+ suggestedBlockMerchants: state.cardPolicyState.suggestedBlockMerchants,
68
+ suggestedAllowCategories: state.cardPolicyState.suggestedAllowCategories,
69
+ suggestedBlockCategories: state.cardPolicyState.suggestedBlockCategories,
70
+ });
71
+ };
72
+ // Seeds the AI card-policy draft from `interactive_form` answers with
73
+ // `formType === "card_policy"`, clearing on bulk-create success. Defers seeding
74
+ // until MCC categories load so category chips can resolve to human labels.
75
+ export const seedAiCardPolicyFormDraftEpic = (actions$, state$) => actions$.pipe(mergeMap((action) => {
76
+ if (isCreateSuccess(action)) {
77
+ return of(clearAiCardPolicyFormDraft());
78
+ }
79
+ if (!isSeedTrigger(action)) {
80
+ return EMPTY;
81
+ }
82
+ const state = state$.value;
83
+ const questionAnswerId = resolveQuestionAnswerId(state, action);
84
+ if (questionAnswerId == null) {
85
+ return EMPTY;
86
+ }
87
+ const payload = readCardPolicyPayload(state, action.payload.chatSessionId, questionAnswerId);
88
+ if (payload == null) {
89
+ return EMPTY;
90
+ }
91
+ if (readMccCategoriesAvailable(state)) {
92
+ return of(buildSeedAction(state, payload));
93
+ }
94
+ const seedWhenMccLoaded$ = state$.pipe(map((rs) => readMccCategoriesAvailable(rs)), distinctUntilChanged(), filter((available) => available), take(1), map(() => buildSeedAction(state$.value, payload)));
95
+ const mccFetchState = state.cardPolicyState.mccCategoriesFetchState;
96
+ if (mccFetchState === 'In-Progress') {
97
+ return seedWhenMccLoaded$;
98
+ }
99
+ return concat(of(fetchCardPolicyMccCategories()), seedWhenMccLoaded$);
100
+ }));
@@ -0,0 +1,96 @@
1
+ import { CARD_POLICY_LIMIT_ROW_ID_REQUIRE_RECEIPT, CARD_POLICY_LIMIT_ROW_ID_TRANSACTION, } from './cardPolicyFormDraftTypes';
2
+ import { REVIEW_GROUP_IDS, REVIEW_LIMIT_CHIP_IDS, amountFromLimitRow, collectCategoryCodes, collectMerchantNames, } from './cardPolicyRequestParts';
3
+ const isSelectedChip = (chip) => chip.isSelected !== false;
4
+ const chipsInGroup = (row, groupId) => {
5
+ const group = row.chipGroups.find((g) => g.id === groupId);
6
+ if (group == null) {
7
+ return [];
8
+ }
9
+ return group.chips.filter(isSelectedChip);
10
+ };
11
+ const collectVendorLabelsFromReviewRow = (row, groupId) => chipsInGroup(row, groupId).map((chip) => chip.label);
12
+ const collectCategoryCodesFromReviewRow = (row, groupId) => chipsInGroup(row, groupId).map((chip) => chip.optionalCode ?? chip.id);
13
+ const collectCardIdsFromReviewRow = (row) => chipsInGroup(row, REVIEW_GROUP_IDS.appliedToCards).flatMap((chip) => chip.cardIds ?? []);
14
+ const limitValueFromReviewRow = (row, chipId) => {
15
+ const group = row.chipGroups.find((g) => g.id === REVIEW_GROUP_IDS.limits);
16
+ if (group == null) {
17
+ return null;
18
+ }
19
+ const chip = group.chips.find((c) => c.id === chipId && isSelectedChip(c));
20
+ if (chip == null) {
21
+ return null;
22
+ }
23
+ if (chip.optionalCode != null) {
24
+ const parsed = Number(chip.optionalCode);
25
+ return Number.isFinite(parsed) ? parsed : null;
26
+ }
27
+ const labelDigits = chip.label.match(/\d+(?:\.\d+)?/);
28
+ if (labelDigits == null) {
29
+ return null;
30
+ }
31
+ const parsed = Number(labelDigits[0]);
32
+ return Number.isFinite(parsed) ? parsed : null;
33
+ };
34
+ const buildGuidedEntry = (row, draft, guidedMode, description) => ({
35
+ allowedEntity: {
36
+ categoryCodes: collectCategoryCodes(draft.categoryPolicy, 'allow'),
37
+ merchantNames: collectMerchantNames(draft.vendorPolicy, 'allow'),
38
+ },
39
+ applyToCards: draft.cardSelections
40
+ .filter((card) => card.isChecked)
41
+ .map((card) => card.id),
42
+ blockedEntity: {
43
+ categoryCodes: collectCategoryCodes(draft.categoryPolicy, 'block'),
44
+ merchantNames: collectMerchantNames(draft.vendorPolicy, 'block'),
45
+ },
46
+ description: description.trim(),
47
+ mode: guidedMode,
48
+ name: row.name.trim(),
49
+ requiredReceiptThreshold: amountFromLimitRow(draft.limits, CARD_POLICY_LIMIT_ROW_ID_REQUIRE_RECEIPT),
50
+ spendLimits: {
51
+ transaction: amountFromLimitRow(draft.limits, CARD_POLICY_LIMIT_ROW_ID_TRANSACTION),
52
+ },
53
+ });
54
+ const buildAutoEntry = (row, description) => ({
55
+ allowedEntity: {
56
+ categoryCodes: collectCategoryCodesFromReviewRow(row, REVIEW_GROUP_IDS.allowedCategories),
57
+ merchantNames: collectVendorLabelsFromReviewRow(row, REVIEW_GROUP_IDS.allowedVendors),
58
+ },
59
+ applyToCards: collectCardIdsFromReviewRow(row),
60
+ blockedEntity: {
61
+ categoryCodes: collectCategoryCodesFromReviewRow(row, REVIEW_GROUP_IDS.restrictedCategories),
62
+ merchantNames: collectVendorLabelsFromReviewRow(row, REVIEW_GROUP_IDS.blockedVendors),
63
+ },
64
+ description: description.trim(),
65
+ name: row.name.trim(),
66
+ });
67
+ const buildUploadEntry = (row, draft, description) => ({
68
+ allowedEntity: {
69
+ categoryCodes: collectCategoryCodesFromReviewRow(row, REVIEW_GROUP_IDS.allowedCategories),
70
+ merchantNames: collectVendorLabelsFromReviewRow(row, REVIEW_GROUP_IDS.allowedVendors),
71
+ },
72
+ applyToCards: draft.cardSelections
73
+ .filter((card) => card.isChecked)
74
+ .map((card) => card.id),
75
+ blockedEntity: {
76
+ categoryCodes: collectCategoryCodesFromReviewRow(row, REVIEW_GROUP_IDS.restrictedCategories),
77
+ merchantNames: collectVendorLabelsFromReviewRow(row, REVIEW_GROUP_IDS.blockedVendors),
78
+ },
79
+ description: description.trim(),
80
+ name: row.name.trim(),
81
+ requiredReceiptThreshold: limitValueFromReviewRow(row, REVIEW_LIMIT_CHIP_IDS.receipt),
82
+ spendLimits: {
83
+ transaction: limitValueFromReviewRow(row, REVIEW_LIMIT_CHIP_IDS.transaction),
84
+ },
85
+ });
86
+ // One entry per checked review row; per-mode key contract enforced internally.
87
+ export const toBulkCardPolicyTemplateRequestsFromDraft = ({ draft, description = '', guidedMode = 'strict', }) => {
88
+ const checkedRows = draft.policiesReview.filter((row) => row.isChecked);
89
+ if (draft.policyKind === 'guided') {
90
+ return checkedRows.map((row) => buildGuidedEntry(row, draft, guidedMode, description));
91
+ }
92
+ if (draft.policyKind === 'upload') {
93
+ return checkedRows.map((row) => buildUploadEntry(row, draft, description));
94
+ }
95
+ return checkedRows.map((row) => buildAutoEntry(row, description));
96
+ };
@@ -0,0 +1,59 @@
1
+ import { CARD_POLICY_LIMIT_ROW_ID_REQUIRE_RECEIPT, CARD_POLICY_LIMIT_ROW_ID_TRANSACTION, } from './cardPolicyFormDraftTypes';
2
+ import { amountFromLimitRow, collectCategoryCodes, collectMerchantNames, projectAutoReviewRowToCardPolicyRequestParts, } from './cardPolicyRequestParts';
3
+ // auto/upload project from the active review row's chip groups; guided reads source slices.
4
+ // Active row = first checked, else first; name follows the same rule.
5
+ export const toCardPolicyTemplateRequestFromDraft = ({ draft, description = '', mode = 'strict', }) => {
6
+ const name = pickPolicyName(draft);
7
+ const base = {
8
+ description: description.trim(),
9
+ mode,
10
+ name: name.trim(),
11
+ };
12
+ if (draft.policyKind === 'auto' || draft.policyKind === 'upload') {
13
+ const activeRow = draft.policiesReview.find((row) => row.isChecked) ??
14
+ draft.policiesReview[0];
15
+ if (activeRow == null) {
16
+ return {
17
+ ...base,
18
+ allowedEntity: { categoryCodes: [], merchantNames: [] },
19
+ applyToCards: [],
20
+ blockedEntity: { categoryCodes: [], merchantNames: [] },
21
+ requiredReceiptThreshold: null,
22
+ spendLimits: { transaction: null },
23
+ };
24
+ }
25
+ return {
26
+ ...base,
27
+ ...projectAutoReviewRowToCardPolicyRequestParts(activeRow),
28
+ };
29
+ }
30
+ // Guided
31
+ return {
32
+ ...base,
33
+ allowedEntity: {
34
+ categoryCodes: collectCategoryCodes(draft.categoryPolicy, 'allow'),
35
+ merchantNames: collectMerchantNames(draft.vendorPolicy, 'allow'),
36
+ },
37
+ applyToCards: draft.cardSelections
38
+ .filter((row) => row.isChecked)
39
+ .map((row) => row.id),
40
+ blockedEntity: {
41
+ categoryCodes: collectCategoryCodes(draft.categoryPolicy, 'block'),
42
+ merchantNames: collectMerchantNames(draft.vendorPolicy, 'block'),
43
+ },
44
+ requiredReceiptThreshold: amountFromLimitRow(draft.limits, CARD_POLICY_LIMIT_ROW_ID_REQUIRE_RECEIPT),
45
+ spendLimits: {
46
+ transaction: amountFromLimitRow(draft.limits, CARD_POLICY_LIMIT_ROW_ID_TRANSACTION),
47
+ },
48
+ };
49
+ };
50
+ const pickPolicyName = (draft) => {
51
+ const checked = draft.policiesReview.find((row) => row.isChecked);
52
+ if (checked != null) {
53
+ return checked.name;
54
+ }
55
+ if (draft.policiesReview.length > 0) {
56
+ return draft.policiesReview[0].name;
57
+ }
58
+ return '';
59
+ };
@@ -0,0 +1,24 @@
1
+ import { CARD_POLICY_LIMIT_ROW_ID_REQUIRE_RECEIPT, CARD_POLICY_LIMIT_ROW_ID_TRANSACTION, } from './cardPolicyFormDraftTypes';
2
+ import { amountFromLimitRow, collectCategoryCodes, collectMerchantNames, } from './cardPolicyRequestParts';
3
+ // Mirrors the AI guided builder without the `policiesReview` projection;
4
+ // disabled limit toggles emit `null` (BE: "not configured").
5
+ export const toManualCardPolicyTemplateRequestFromDraft = (draft) => ({
6
+ allowedEntity: {
7
+ categoryCodes: collectCategoryCodes(draft.categoryPolicy, 'allow'),
8
+ merchantNames: collectMerchantNames(draft.vendorPolicy, 'allow'),
9
+ },
10
+ applyToCards: draft.cardSelections
11
+ .filter((row) => row.isChecked)
12
+ .map((row) => row.id),
13
+ blockedEntity: {
14
+ categoryCodes: collectCategoryCodes(draft.categoryPolicy, 'block'),
15
+ merchantNames: collectMerchantNames(draft.vendorPolicy, 'block'),
16
+ },
17
+ description: draft.description.trim(),
18
+ mode: draft.mode,
19
+ name: draft.name.trim(),
20
+ requiredReceiptThreshold: amountFromLimitRow(draft.limits, CARD_POLICY_LIMIT_ROW_ID_REQUIRE_RECEIPT),
21
+ spendLimits: {
22
+ transaction: amountFromLimitRow(draft.limits, CARD_POLICY_LIMIT_ROW_ID_TRANSACTION),
23
+ },
24
+ });