@zeniai/client-epic-state 5.1.7 → 5.1.8-betaSS1

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 (443) 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/animations.d.ts +1 -1
  5. package/lib/commonStateTypes/animations.js +1 -0
  6. package/lib/commonStateTypes/workingDayHelper.d.ts +9 -0
  7. package/lib/commonStateTypes/workingDayHelper.js +28 -1
  8. package/lib/entity/aiCfo/aiCfoPayload.d.ts +63 -5
  9. package/lib/entity/aiCfo/aiCfoReducer.d.ts +23 -2
  10. package/lib/entity/aiCfo/aiCfoReducer.js +249 -9
  11. package/lib/entity/aiCfo/aiCfoSelector.d.ts +4 -1
  12. package/lib/entity/aiCfo/aiCfoSelector.js +19 -1
  13. package/lib/entity/aiCfo/aiCfoState.d.ts +97 -4
  14. package/lib/entity/aiCfo/aiCfoState.js +20 -1
  15. package/lib/entity/approvalRule/approvalRuleConflict.d.ts +56 -0
  16. package/lib/entity/approvalRule/approvalRuleConflict.js +77 -0
  17. package/lib/entity/approvalRule/approvalRulePayload.d.ts +34 -5
  18. package/lib/entity/approvalRule/approvalRulePayload.js +149 -10
  19. package/lib/entity/approvalRule/approvalRuleSelector.d.ts +25 -1
  20. package/lib/entity/approvalRule/approvalRuleSelector.js +40 -0
  21. package/lib/entity/approvalRule/approvalRuleState.d.ts +59 -7
  22. package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +277 -0
  23. package/lib/entity/cardPolicy/cardPolicyPayload.js +143 -0
  24. package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +19 -0
  25. package/lib/entity/cardPolicy/cardPolicyReducer.js +175 -0
  26. package/lib/entity/cardPolicy/cardPolicySelector.d.ts +32 -0
  27. package/lib/entity/cardPolicy/cardPolicySelector.js +99 -0
  28. package/lib/entity/cardPolicy/cardPolicyState.d.ts +205 -0
  29. package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
  30. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
  31. package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +68 -0
  32. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
  33. package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
  34. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +25 -0
  35. package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +39 -0
  36. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +24 -0
  37. package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +105 -0
  38. package/lib/entity/company/companyPayload.d.ts +4 -0
  39. package/lib/entity/company/companyPayload.js +6 -0
  40. package/lib/entity/company/companyStateTypes.d.ts +7 -0
  41. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
  42. package/lib/entity/jeSchedules/jeSchedulesPayload.js +19 -0
  43. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
  44. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  45. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
  46. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  47. package/lib/entity/paymentAccount/paymentAccountSelector.js +9 -0
  48. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  49. package/lib/entity/snackbar/snackbarTypes.js +5 -0
  50. package/lib/entity/task/taskPayload.d.ts +3 -1
  51. package/lib/entity/task/taskPayload.js +2 -0
  52. package/lib/entity/task/taskState.d.ts +2 -0
  53. package/lib/entity/tenant/clearAllEpic.d.ts +8 -2
  54. package/lib/entity/tenant/clearAllEpic.js +12 -0
  55. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  56. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  57. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +59 -0
  58. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  59. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  60. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  61. package/lib/entity/tenant/tenantPayload.d.ts +3 -2
  62. package/lib/entity/tenant/tenantReducer.d.ts +44 -30
  63. package/lib/entity/tenant/tenantReducer.js +130 -29
  64. package/lib/entity/tenant/tenantState.d.ts +3 -2
  65. package/lib/entity/transaction/payloadTypes/transactionPayload.js +4 -2
  66. package/lib/epic.d.ts +32 -4
  67. package/lib/epic.js +33 -4
  68. package/lib/esm/commonStateTypes/amount.js +7 -0
  69. package/lib/esm/commonStateTypes/animations.js +1 -0
  70. package/lib/esm/commonStateTypes/workingDayHelper.js +26 -0
  71. package/lib/esm/entity/aiCfo/aiCfoReducer.js +249 -9
  72. package/lib/esm/entity/aiCfo/aiCfoSelector.js +17 -1
  73. package/lib/esm/entity/aiCfo/aiCfoState.js +17 -0
  74. package/lib/esm/entity/approvalRule/approvalRuleConflict.js +74 -0
  75. package/lib/esm/entity/approvalRule/approvalRulePayload.js +149 -10
  76. package/lib/esm/entity/approvalRule/approvalRuleSelector.js +35 -0
  77. package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +130 -0
  78. package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +171 -0
  79. package/lib/esm/entity/cardPolicy/cardPolicySelector.js +75 -0
  80. package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
  81. package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +64 -0
  82. package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
  83. package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +35 -0
  84. package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +101 -0
  85. package/lib/esm/entity/company/companyPayload.js +6 -0
  86. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +19 -0
  87. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +8 -0
  88. package/lib/esm/entity/snackbar/snackbarTypes.js +5 -0
  89. package/lib/esm/entity/task/taskPayload.js +2 -0
  90. package/lib/esm/entity/tenant/clearAllEpic.js +12 -0
  91. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +55 -0
  92. package/lib/esm/entity/tenant/tenantReducer.js +128 -27
  93. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +4 -2
  94. package/lib/esm/epic.js +33 -4
  95. package/lib/esm/index.js +70 -29
  96. package/lib/esm/reducer.js +18 -0
  97. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +6 -3
  98. package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  99. package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +2 -1
  100. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  101. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +39 -11
  102. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +14 -4
  103. package/lib/esm/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +38 -0
  104. package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  105. package/lib/esm/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +16 -0
  106. package/lib/esm/view/companyView/companyViewReducer.js +11 -10
  107. package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +5 -5
  108. package/lib/esm/view/companyView/epic/companyPassport/{updateCapitalizationThresholdEpic.js → updateCapitalizationAccountThresholdEpic.js} +38 -19
  109. package/lib/esm/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  110. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
  111. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +4 -3
  112. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +12 -13
  113. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +19 -3
  114. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +19 -9
  115. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +2 -2
  116. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +13 -2
  117. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +6 -2
  118. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
  119. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +6 -2
  120. package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +20 -3
  121. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +48 -8
  122. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -5
  123. package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
  124. package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
  125. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +40 -0
  126. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +29 -0
  127. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
  128. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +24 -18
  129. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +29 -17
  130. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +223 -51
  131. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +36 -18
  132. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +45 -6
  133. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +22 -2
  134. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +14 -0
  135. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +109 -12
  136. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +10 -2
  137. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +8 -4
  138. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +11 -7
  139. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +54 -0
  140. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +13 -4
  141. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +144 -16
  142. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +60 -4
  143. package/lib/esm/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +8 -2
  144. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +29 -0
  145. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +78 -0
  146. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +49 -0
  147. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +47 -0
  148. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +32 -0
  149. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +32 -0
  150. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +54 -0
  151. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +92 -0
  152. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +212 -0
  153. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +10 -0
  154. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +23 -0
  155. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +36 -0
  156. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +27 -0
  157. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +28 -0
  158. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +52 -0
  159. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
  160. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
  161. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +36 -0
  162. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +39 -0
  163. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +34 -0
  164. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +71 -0
  165. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
  166. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
  167. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +38 -0
  168. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +289 -0
  169. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +109 -0
  170. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +44 -0
  171. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +111 -0
  172. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +25 -0
  173. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +363 -0
  174. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +36 -0
  175. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +19 -0
  176. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +6 -0
  177. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +119 -0
  178. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +154 -0
  179. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +22 -0
  180. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
  181. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +49 -0
  182. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +140 -0
  183. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +20 -0
  184. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +100 -0
  185. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +96 -0
  186. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +59 -0
  187. package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +24 -0
  188. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +25 -0
  189. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +1 -0
  190. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +34 -0
  191. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +57 -0
  192. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +35 -0
  193. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
  194. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +42 -4
  195. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +35 -0
  196. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +62 -0
  197. package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +44 -0
  198. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +58 -0
  199. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +77 -0
  200. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +14 -0
  201. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +221 -0
  202. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +106 -52
  203. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  204. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +41 -0
  205. package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +5 -1
  206. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +10 -2
  207. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +8 -2
  208. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +11 -7
  209. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +61 -0
  210. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +13 -4
  211. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +80 -11
  212. package/lib/index.d.ts +86 -36
  213. package/lib/index.js +268 -35
  214. package/lib/reducer.d.ts +18 -0
  215. package/lib/reducer.js +18 -0
  216. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +11 -2
  217. package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -3
  218. package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
  219. package/lib/view/aiCfoView/epics/createSessionEpic.js +2 -1
  220. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -1
  221. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
  222. package/lib/view/companyTaskManagerView/companyTaskManagerViewPayload.d.ts +19 -11
  223. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +11 -5
  224. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +40 -12
  225. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +2 -0
  226. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +13 -3
  227. package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +11 -3
  228. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.d.ts +10 -0
  229. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +42 -0
  230. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.d.ts +1 -3
  231. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  232. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.d.ts +6 -0
  233. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +20 -0
  234. package/lib/view/companyView/companyViewReducer.d.ts +8 -7
  235. package/lib/view/companyView/companyViewReducer.js +12 -11
  236. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +5 -5
  237. package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.d.ts +10 -0
  238. package/lib/view/companyView/epic/companyPassport/{updateCapitalizationThresholdEpic.js → updateCapitalizationAccountThresholdEpic.js} +38 -19
  239. package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  240. package/lib/view/companyView/types/cockpitTypes.d.ts +3 -2
  241. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
  242. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +4 -3
  243. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +0 -6
  244. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +13 -14
  245. package/lib/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +19 -3
  246. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +19 -9
  247. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +2 -2
  248. package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +13 -2
  249. package/lib/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +6 -2
  250. package/lib/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
  251. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +6 -2
  252. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +6 -2
  253. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +20 -3
  254. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  255. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +9 -20
  256. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +18 -9
  257. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +48 -8
  258. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +5 -4
  259. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -1
  260. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -5
  261. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  262. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +3 -2
  263. package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
  264. package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
  265. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
  266. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +44 -0
  267. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +8 -0
  268. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +33 -0
  269. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
  270. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
  271. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +24 -18
  272. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.d.ts +2 -2
  273. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewLocalStoreDataEpic.js +27 -15
  274. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
  275. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +44 -5
  276. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +225 -52
  277. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +6 -1
  278. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +39 -18
  279. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +53 -8
  280. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +47 -7
  281. package/lib/view/people/peopleTypes.d.ts +1 -1
  282. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  283. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +8 -1
  284. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +21 -1
  285. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +22 -0
  286. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +7 -0
  287. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +14 -0
  288. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +14 -3
  289. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +110 -13
  290. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +16 -0
  291. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +10 -2
  292. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +8 -4
  293. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +10 -6
  294. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.d.ts +23 -0
  295. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +58 -0
  296. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +12 -3
  297. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +59 -1
  298. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +146 -17
  299. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +31 -5
  300. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +8 -1
  301. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +60 -4
  302. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +8 -2
  303. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.d.ts +47 -0
  304. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +34 -0
  305. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.d.ts +23 -0
  306. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +82 -0
  307. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.d.ts +40 -0
  308. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +53 -0
  309. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.d.ts +37 -0
  310. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +53 -0
  311. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.d.ts +14 -0
  312. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +36 -0
  313. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.d.ts +7 -0
  314. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +36 -0
  315. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.d.ts +56 -0
  316. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +60 -0
  317. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.d.ts +22 -0
  318. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +96 -0
  319. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.d.ts +59 -0
  320. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +217 -0
  321. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.d.ts +122 -0
  322. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +13 -0
  323. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.d.ts +7 -0
  324. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +27 -0
  325. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.d.ts +9 -0
  326. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +40 -0
  327. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.d.ts +7 -0
  328. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +31 -0
  329. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.d.ts +15 -0
  330. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +32 -0
  331. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
  332. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +56 -0
  333. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +15 -0
  334. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
  335. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +8 -0
  336. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
  337. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +8 -0
  338. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +40 -0
  339. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +8 -0
  340. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +43 -0
  341. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +8 -0
  342. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +38 -0
  343. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
  344. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +75 -0
  345. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +15 -0
  346. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
  347. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +7 -0
  348. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
  349. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +8 -0
  350. package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +42 -0
  351. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.d.ts +8 -0
  352. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +294 -0
  353. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.d.ts +8 -0
  354. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +113 -0
  355. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.d.ts +9 -0
  356. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +48 -0
  357. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.d.ts +8 -0
  358. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +115 -0
  359. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.d.ts +13 -0
  360. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +29 -0
  361. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.d.ts +14 -0
  362. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +369 -0
  363. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.d.ts +6 -0
  364. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +40 -0
  365. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.d.ts +7 -0
  366. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +26 -0
  367. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.d.ts +116 -0
  368. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +10 -0
  369. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.d.ts +33 -0
  370. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +126 -0
  371. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +52 -0
  372. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +158 -0
  373. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +11 -0
  374. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +31 -0
  375. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +12 -0
  376. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
  377. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +9 -0
  378. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +53 -0
  379. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.d.ts +10 -0
  380. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +144 -0
  381. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +7 -0
  382. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +24 -0
  383. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.d.ts +11 -0
  384. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +104 -0
  385. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.d.ts +22 -0
  386. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +100 -0
  387. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.d.ts +8 -0
  388. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +63 -0
  389. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.d.ts +3 -0
  390. package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +28 -0
  391. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  392. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +14 -0
  393. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +27 -1
  394. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.d.ts +34 -0
  395. package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +2 -0
  396. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.d.ts +7 -0
  397. package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +38 -0
  398. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.d.ts +12 -0
  399. package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +61 -0
  400. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.d.ts +9 -0
  401. package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +39 -0
  402. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
  403. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
  404. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +12 -2
  405. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +43 -5
  406. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +7 -0
  407. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +42 -1
  408. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +5 -0
  409. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.d.ts +11 -0
  410. package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +66 -0
  411. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.d.ts +3 -0
  412. package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +48 -0
  413. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +28 -0
  414. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +62 -0
  415. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +9 -0
  416. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +81 -0
  417. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +24 -0
  418. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +17 -0
  419. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +29 -0
  420. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +229 -0
  421. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +28 -2
  422. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +107 -53
  423. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +7 -2
  424. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  425. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +19 -0
  426. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +154 -0
  427. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +46 -0
  428. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +5 -1
  429. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +10 -2
  430. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +8 -2
  431. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +10 -6
  432. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.d.ts +14 -0
  433. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +65 -0
  434. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +12 -3
  435. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +14 -3
  436. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +81 -12
  437. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +12 -0
  438. package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
  439. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
  440. package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +1 -1
  441. package/lib/zeniAPI.d.ts +1 -0
  442. package/package.json +6 -4
  443. package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.d.ts +0 -10
@@ -9,9 +9,13 @@ export interface AiCfoAnswerParagraph {
9
9
  }>;
10
10
  }
11
11
  export declare const ALL_AI_CFO_CHARTS_TYPES: readonly ["bar_chart", "pie_chart", "line_chart"];
12
- export declare const ALL_AI_CFO_VISUALIZATION_TYPES: readonly ["bar_chart", "pie_chart", "line_chart", "table"];
13
- export declare const toAiCfoVisualizationType: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table";
14
- export declare const toAiCfoVisualizationTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | undefined;
12
+ export declare const ALL_AI_CFO_VISUALIZATION_TYPES: readonly ["bar_chart", "pie_chart", "line_chart", "table", "interactive_form"];
13
+ export declare const ALL_INTERACTIVE_FORM_TYPES: readonly ["cards_creation", "card_policy"];
14
+ export declare const toInteractiveFormType: (v: string) => "cards_creation" | "card_policy";
15
+ export declare const toInteractiveFormTypeStrict: (v: string) => "cards_creation" | "card_policy" | undefined;
16
+ export type InteractiveFormType = ReturnType<typeof toInteractiveFormType>;
17
+ export declare const toAiCfoVisualizationType: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | "interactive_form";
18
+ export declare const toAiCfoVisualizationTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | "interactive_form" | undefined;
15
19
  export type AiCfoVisualizationType = ReturnType<typeof toAiCfoVisualizationType>;
16
20
  export declare const toAiCfoChartType: (v: string) => "bar_chart" | "pie_chart" | "line_chart";
17
21
  export declare const toAiCfoChartTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | undefined;
@@ -53,8 +57,87 @@ export interface ChartVisualization {
53
57
  lines?: string[];
54
58
  yFormat?: YFormat;
55
59
  }
60
+ export type CardsCardKind = 'vendor' | 'class' | 'category';
61
+ export interface CardNameOption {
62
+ id: string;
63
+ kind: CardsCardKind;
64
+ label: string;
65
+ }
66
+ export interface CardsCreationCommonData {
67
+ cardNameOptions: CardNameOption[];
68
+ suggestedOwnerUserIdByTeamId: Record<string, ID | undefined>;
69
+ }
70
+ export type CardsCreationInitialData = (CardsCreationCommonData & {
71
+ mode: 'review';
72
+ teamRows: Array<{
73
+ avgMonthlySpend: string;
74
+ cardKind: CardsCardKind;
75
+ id: string;
76
+ label: string;
77
+ recommendedLimit: string;
78
+ recommendedLimitCadence?: string;
79
+ }>;
80
+ }) | (CardsCreationCommonData & {
81
+ cardRows: Array<{
82
+ cardKind: CardsCardKind;
83
+ id: string;
84
+ label: string;
85
+ recommendedLimit?: number;
86
+ suggestedOwnerUserId?: ID;
87
+ }>;
88
+ mode: 'create';
89
+ });
90
+ export interface CardPolicyDraftPolicyEntity {
91
+ categoryCodes: string[];
92
+ merchantNames: string[];
93
+ }
94
+ export interface CardPolicySpendLimits {
95
+ transaction: number;
96
+ }
97
+ export interface CardPolicyDraftPolicy {
98
+ allowedEntity: CardPolicyDraftPolicyEntity;
99
+ applyToCards: string[];
100
+ blockedEntity: CardPolicyDraftPolicyEntity;
101
+ description: string;
102
+ id: string;
103
+ mode: string;
104
+ name: string;
105
+ requiredReceiptThreshold: number;
106
+ spendLimits: CardPolicySpendLimits;
107
+ }
108
+ export interface CardPolicyStep5Review {
109
+ draftPolicies: CardPolicyDraftPolicy[];
110
+ groupingSource: string;
111
+ prompt: string;
112
+ }
113
+ export interface CardPolicyWizardPlan {
114
+ step5Review: CardPolicyStep5Review;
115
+ }
116
+ export interface CardPolicyUploadSource {
117
+ confidenceScore: number;
118
+ fileName: string;
119
+ lowConfidenceFields: string[];
120
+ }
121
+ export type CardPolicyInitialData = {
122
+ policyKind: 'auto';
123
+ wizardPlan: CardPolicyWizardPlan;
124
+ } | {
125
+ policyKind: 'guided';
126
+ wizardPlan: CardPolicyWizardPlan;
127
+ } | {
128
+ policyKind: 'upload';
129
+ source?: CardPolicyUploadSource;
130
+ wizardPlan?: CardPolicyWizardPlan;
131
+ };
132
+ export type InteractiveFormVisualization = {
133
+ formType: 'cards_creation';
134
+ payload: CardsCreationInitialData;
135
+ } | {
136
+ formType: 'card_policy';
137
+ payload: CardPolicyInitialData;
138
+ };
56
139
  export interface AiCfoVisualization {
57
- data: TableVisualization | ChartVisualization;
140
+ data: TableVisualization | ChartVisualization | InteractiveFormVisualization;
58
141
  type: AiCfoVisualizationType;
59
142
  }
60
143
  export declare const toMessageSender: (v: string) => "user" | "agent";
@@ -113,7 +196,17 @@ export interface ChatSessionWithMessages {
113
196
  chatSession: ChatSession;
114
197
  questionAnswers: AiCfoQuestionWithAnswer[];
115
198
  }
199
+ export declare const ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS: readonly ["creating_cards", "creating_policy", "created_cards", "created_policy", "errored_cards", "errored_policy"];
200
+ export type SyntheticAiCfoAnswerKind = (typeof ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS)[number];
201
+ export interface SyntheticAiCfoAnswer {
202
+ createdAt: ZeniDate;
203
+ entityIds: ID[];
204
+ id: ID;
205
+ kind: SyntheticAiCfoAnswerKind;
206
+ sourceQuestionAnswerId: ID;
207
+ }
116
208
  export interface AiCfoState {
117
209
  aiCfoByChatSessionId: Record<ID, ChatSessionWithMessages>;
118
210
  partialQuestionAnswers: Record<ID, AiCfoQuestionWithAnswer | undefined>;
211
+ syntheticAnswersByChatSessionId: Record<ID, SyntheticAiCfoAnswer[]>;
119
212
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toMessageTypeStrict = exports.toMessageSenderStrict = exports.toMessageType = exports.toMessageSender = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateType = exports.toYFormatScaleStrict = exports.toYFormatUnitStrict = exports.toYFormatTypeStrict = exports.toYFormatScale = exports.toYFormatUnit = exports.toYFormatType = exports.ALL_Y_FORMAT_SCALES = exports.ALL_Y_FORMAT_NON_CURRENCY_UNITS = exports.ALL_Y_FORMAT_TYPES = exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CFO_ANSWER_STATE_TYPES = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = exports.toAiCfoVisualizationType = exports.ALL_AI_CFO_VISUALIZATION_TYPES = exports.ALL_AI_CFO_CHARTS_TYPES = void 0;
3
+ exports.ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS = exports.toMessageTypeStrict = exports.toMessageSenderStrict = exports.toMessageType = exports.toMessageSender = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateType = exports.toYFormatScaleStrict = exports.toYFormatUnitStrict = exports.toYFormatTypeStrict = exports.toYFormatScale = exports.toYFormatUnit = exports.toYFormatType = exports.ALL_Y_FORMAT_SCALES = exports.ALL_Y_FORMAT_NON_CURRENCY_UNITS = exports.ALL_Y_FORMAT_TYPES = exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CFO_ANSWER_STATE_TYPES = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = exports.toAiCfoVisualizationType = exports.toInteractiveFormTypeStrict = exports.toInteractiveFormType = exports.ALL_INTERACTIVE_FORM_TYPES = exports.ALL_AI_CFO_VISUALIZATION_TYPES = exports.ALL_AI_CFO_CHARTS_TYPES = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
5
  exports.ALL_AI_CFO_CHARTS_TYPES = [
6
6
  'bar_chart',
@@ -10,7 +10,16 @@ exports.ALL_AI_CFO_CHARTS_TYPES = [
10
10
  exports.ALL_AI_CFO_VISUALIZATION_TYPES = [
11
11
  ...exports.ALL_AI_CFO_CHARTS_TYPES,
12
12
  'table',
13
+ 'interactive_form',
13
14
  ];
15
+ exports.ALL_INTERACTIVE_FORM_TYPES = [
16
+ 'cards_creation',
17
+ 'card_policy',
18
+ ];
19
+ const toInteractiveFormType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INTERACTIVE_FORM_TYPES);
20
+ exports.toInteractiveFormType = toInteractiveFormType;
21
+ const toInteractiveFormTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_INTERACTIVE_FORM_TYPES);
22
+ exports.toInteractiveFormTypeStrict = toInteractiveFormTypeStrict;
14
23
  const toAiCfoVisualizationType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_AI_CFO_VISUALIZATION_TYPES);
15
24
  exports.toAiCfoVisualizationType = toAiCfoVisualizationType;
16
25
  const toAiCfoVisualizationTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_AI_CFO_VISUALIZATION_TYPES);
@@ -79,3 +88,13 @@ const toMessageSenderStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v,
79
88
  exports.toMessageSenderStrict = toMessageSenderStrict;
80
89
  const toMessageTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, ALL_MESSAGE_TYPES);
81
90
  exports.toMessageTypeStrict = toMessageTypeStrict;
91
+ // Client-synthesized AI CFO answer bubbles (Creating…/Created) pushed when the user
92
+ // submits an interactive form; not streamed from the backend.
93
+ exports.ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS = [
94
+ 'creating_cards',
95
+ 'creating_policy',
96
+ 'created_cards',
97
+ 'created_policy',
98
+ 'errored_cards',
99
+ 'errored_policy',
100
+ ];
@@ -0,0 +1,56 @@
1
+ import { ID } from '../../commonStateTypes/common';
2
+ import { ApprovalRule, Criteria } from './approvalRuleState';
3
+ /**
4
+ * Approval Rules 3.0 — frontend overlap detection.
5
+ *
6
+ * Per product spec, two rules overlap iff:
7
+ * 1. Their vendor criteria are exactly equal (same operator and
8
+ * the same set of vendor IDs, or both absent), AND
9
+ * 2. Their department criteria are exactly equal (same shape), AND
10
+ * 3. Their amount intervals intersect.
11
+ *
12
+ * The intuition: we only flag overlap when the non-amount criteria
13
+ * are identical, because the typical mistake is "I tried to create a
14
+ * second rule for the same vendor / department slice at a different
15
+ * amount threshold and forgot the existing one". Subset / superset
16
+ * overlaps (e.g. one rule has a department condition and the other
17
+ * does not) are intentionally not flagged in this iteration.
18
+ *
19
+ * Amount intervals are:
20
+ * - greater_than(N) → [N, +∞)
21
+ * - less_than(N) → (-∞, N]
22
+ * - range(min, max) → [min, max]
23
+ * - amount absent → (-∞, +∞)
24
+ *
25
+ * Two intervals overlap iff max(lo) <= min(hi).
26
+ *
27
+ * Exclusions from the comparison pool:
28
+ * - The rule being edited (caller passes `excludeRuleId`).
29
+ * - Fallback rules — they are a separate concept (match-all-others)
30
+ * and not subject to the per-criteria overlap check.
31
+ *
32
+ * Callers should filter `existingRules` to the relevant entityType
33
+ * (BillPay vs Reimbursement) before passing — the function does not
34
+ * cross-check entityType.
35
+ *
36
+ * Pure function: no side effects, deterministic. Returns the list of
37
+ * overlapping rules. Empty list means no overlap.
38
+ */
39
+ /**
40
+ * Structural shape of a rule the algorithm needs. The detector only
41
+ * reads `criteria`, `isFallback`, and `approvalRuleId`; it never
42
+ * touches `steps`, so callers may pass any 'ApprovalRule' subtype
43
+ * (e.g. `ApprovalRuleWithUser`) and we keep the richer type in the
44
+ * output.
45
+ */
46
+ export type RuleForOverlapCheck = Pick<ApprovalRule, 'approvalRuleId' | 'criteria' | 'isFallback'>;
47
+ export interface RuleOverlap<TRule extends RuleForOverlapCheck = ApprovalRule> {
48
+ conflictingRule: TRule;
49
+ }
50
+ export interface DetectRuleOverlapInput<TRule extends RuleForOverlapCheck = ApprovalRule> {
51
+ candidateCriteria: Criteria[];
52
+ existingRules: TRule[];
53
+ /** When editing an existing rule, exclude it from the comparison. */
54
+ excludeRuleId?: ID;
55
+ }
56
+ export declare function detectRuleOverlap<TRule extends RuleForOverlapCheck>({ candidateCriteria, existingRules, excludeRuleId, }: DetectRuleOverlapInput<TRule>): RuleOverlap<TRule>[];
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectRuleOverlap = detectRuleOverlap;
4
+ function detectRuleOverlap({ candidateCriteria, existingRules, excludeRuleId, }) {
5
+ const candidateAmount = pickAmount(candidateCriteria);
6
+ const candidateVendor = pickVendor(candidateCriteria);
7
+ const candidateDepartment = pickDepartment(candidateCriteria);
8
+ const overlaps = [];
9
+ for (const rule of existingRules) {
10
+ if (rule.approvalRuleId === excludeRuleId) {
11
+ continue;
12
+ }
13
+ if (rule.isFallback === true) {
14
+ continue;
15
+ }
16
+ const ruleVendor = pickVendor(rule.criteria);
17
+ const ruleDepartment = pickDepartment(rule.criteria);
18
+ if (!areVendorCriteriaEqual(candidateVendor, ruleVendor)) {
19
+ continue;
20
+ }
21
+ if (!areDepartmentCriteriaEqual(candidateDepartment, ruleDepartment)) {
22
+ continue;
23
+ }
24
+ const ruleAmount = pickAmount(rule.criteria);
25
+ if (amountsOverlap(candidateAmount, ruleAmount)) {
26
+ overlaps.push({ conflictingRule: rule });
27
+ }
28
+ }
29
+ return overlaps;
30
+ }
31
+ const pickAmount = (criteria) => criteria.find((c) => c.type === 'amount');
32
+ const pickVendor = (criteria) => criteria.find((c) => c.type === 'vendor');
33
+ const pickDepartment = (criteria) => criteria.find((c) => c.type === 'department');
34
+ const areVendorCriteriaEqual = (a, b) => {
35
+ if (a == null && b == null) {
36
+ return true;
37
+ }
38
+ if (a == null || b == null) {
39
+ return false;
40
+ }
41
+ if (a.operator !== b.operator) {
42
+ return false;
43
+ }
44
+ return idsEqual(a.vendorIds, b.vendorIds);
45
+ };
46
+ const areDepartmentCriteriaEqual = (a, b) => {
47
+ if (a == null && b == null) {
48
+ return true;
49
+ }
50
+ if (a == null || b == null) {
51
+ return false;
52
+ }
53
+ if (a.operator !== b.operator) {
54
+ return false;
55
+ }
56
+ return idsEqual(a.departmentIds, b.departmentIds);
57
+ };
58
+ const idsEqual = (a, b) => {
59
+ if (a.length !== b.length) {
60
+ return false;
61
+ }
62
+ const aSorted = [...a].sort();
63
+ const bSorted = [...b].sort();
64
+ return aSorted.every((id, i) => id === bSorted[i]);
65
+ };
66
+ const amountsOverlap = (a, b) => {
67
+ // Absent amount criteria covers the whole real line, so any
68
+ // pairing involving an absent one is a guaranteed overlap.
69
+ if (a == null || b == null) {
70
+ return true;
71
+ }
72
+ const aLow = a.min?.amount ?? Number.NEGATIVE_INFINITY;
73
+ const aHigh = a.max?.amount ?? Number.POSITIVE_INFINITY;
74
+ const bLow = b.min?.amount ?? Number.NEGATIVE_INFINITY;
75
+ const bHigh = b.max?.amount ?? Number.POSITIVE_INFINITY;
76
+ return Math.max(aLow, bLow) <= Math.min(aHigh, bHigh);
77
+ };
@@ -1,11 +1,27 @@
1
1
  import { ApprovalRule } from './approvalRuleState';
2
+ /**
3
+ * Condition Payload — one entry inside criteria.conditions[].
4
+ *
5
+ * field examples: 'amount' | 'vendor_id' | 'accounting_class_id'
6
+ * type examples: 'gte' | 'lte' | 'eq' | 'in' | 'not_in'
7
+ * value: number for amount comparisons; string[] for in / not_in lookups.
8
+ */
9
+ export interface ConditionPayload {
10
+ field: string;
11
+ type: string;
12
+ value: number | string[];
13
+ }
14
+ /**
15
+ * Criteria Payload — list of conditions joined by `criteria_operator`.
16
+ *
17
+ * `currency_code` / `currency_symbol` apply to amount conditions inside
18
+ * `conditions[]`. Kept here pending confirmation that they should remain.
19
+ */
2
20
  export interface CriteriaPayload {
21
+ conditions: ConditionPayload[];
22
+ criteria_operator: string;
3
23
  currency_code: string;
4
24
  currency_symbol: string;
5
- min: number;
6
- range_entity: string;
7
- type: string;
8
- max?: number | null;
9
25
  }
10
26
  export interface ActorPayload {
11
27
  type: string;
@@ -25,11 +41,24 @@ export interface StepPayload {
25
41
  export interface ApprovalRulePayload {
26
42
  approval_rule_id: string;
27
43
  create_time: string;
28
- criteria: CriteriaPayload[];
44
+ criteria: CriteriaPayload;
29
45
  entity_type: string;
30
46
  name: string | null;
31
47
  steps: StepPayload[];
32
48
  update_time: string;
49
+ are_approvals_serialized?: boolean;
50
+ description?: string | null;
51
+ is_fallback?: boolean;
52
+ /**
53
+ * Approval Rules 3.0 — when `true`, the rule enforces separation of
54
+ * duties (a user can't approve their own request even if they are
55
+ * also an approver). The list-page rule card surfaces this as a
56
+ * green "Separation of duties" capsule.
57
+ */
58
+ is_separation_of_duty_enabled?: boolean;
59
+ pending_approvals_count?: number;
60
+ pending_entity_approval_update_status?: string;
61
+ priority?: number;
33
62
  version?: number | string;
34
63
  }
35
64
  /**
@@ -17,19 +17,158 @@ const toApprovalRule = (payload) => ({
17
17
  version: payload.version,
18
18
  criteria: toApprovalCriteria(payload.criteria),
19
19
  steps: toApprovalSteps(payload.steps),
20
+ description: payload.description ?? undefined,
21
+ priority: payload.priority,
22
+ isFallback: payload.is_fallback ?? false,
23
+ separationOfDuties: payload.is_separation_of_duty_enabled ?? false,
24
+ areApprovalsSerialized: payload.are_approvals_serialized,
25
+ pendingApprovalsCount: payload.pending_approvals_count,
26
+ pendingEntityApprovalUpdateStatus: payload.pending_entity_approval_update_status,
20
27
  });
21
28
  exports.toApprovalRule = toApprovalRule;
29
+ /**
30
+ * Maps the wire-level criteria block into the state-side discriminated
31
+ * `Criteria[]` union.
32
+ *
33
+ * The wire keeps each condition as a flat row inside `conditions[]`.
34
+ * Amount comparisons can show up as a `gte` only, a `lte` only, or a
35
+ * `gte` + `lte` pair — those collapse into a single AmountCriteria whose
36
+ * `comparator` is `greater_than`, `less_than`, or `range` respectively.
37
+ *
38
+ * Vendor and department conditions map one-to-one: `in` becomes `is`,
39
+ * `not_in` becomes `is_not`.
40
+ *
41
+ * Resilient to two forms of upstream drift:
42
+ * - Missing / null criteria → returns [].
43
+ * - Legacy criteria shape (array of amount-range objects, the pre-3.0
44
+ * wire) → converted to an AmountCriteria so existing rules in production
45
+ * still render while the backend rolls out.
46
+ */
22
47
  const toApprovalCriteria = (payload) => {
23
- return payload.map((criteria) => ({
24
- rangeType: criteria.type,
25
- rangeEntity: criteria.range_entity,
26
- range: {
27
- min: (0, amount_1.toAmount)(criteria.min, criteria.currency_code, criteria.currency_symbol),
28
- max: criteria.max != null
29
- ? (0, amount_1.toAmount)(criteria.max, criteria.currency_code, criteria.currency_symbol)
30
- : undefined,
31
- },
32
- }));
48
+ if (payload == null) {
49
+ return [];
50
+ }
51
+ if (Array.isArray(payload)) {
52
+ // Legacy pre-3.0 wire: an array of amount-range entries.
53
+ return legacyAmountRangeToCriteria(payload);
54
+ }
55
+ if (!Array.isArray(payload.conditions)) {
56
+ return [];
57
+ }
58
+ const results = [];
59
+ const amountCriteria = toAmountCriteria(payload);
60
+ if (amountCriteria != null) {
61
+ results.push(amountCriteria);
62
+ }
63
+ payload.conditions
64
+ .filter((condition) => condition.field === 'vendor_id')
65
+ .forEach((condition) => {
66
+ const vendor = toVendorCriteria(condition);
67
+ if (vendor != null) {
68
+ results.push(vendor);
69
+ }
70
+ });
71
+ payload.conditions
72
+ // Backend wire name is 'accounting_class_id' — kept in sync with
73
+ // the write-side mapper in 'commonPayload.ts'. State-side and
74
+ // form-side keep 'department' / 'departmentIds' to match product
75
+ // copy.
76
+ .filter((condition) => condition.field === 'accounting_class_id')
77
+ .forEach((condition) => {
78
+ const department = toDepartmentCriteria(condition);
79
+ if (department != null) {
80
+ results.push(department);
81
+ }
82
+ });
83
+ return results;
84
+ };
85
+ const legacyAmountRangeToCriteria = (legacy) => {
86
+ if (legacy.length === 0) {
87
+ return [];
88
+ }
89
+ // The state-side 'Criteria[]' model allows at most one
90
+ // 'AmountCriteria' per rule (see 'approvalRuleState.ts'). The legacy
91
+ // wire was an array, so a multi-entry payload can't be represented
92
+ // here without losing data. Read the first entry and log a warning
93
+ // if production rules ever ship more — that would signal a backend
94
+ // regression we want to catch early rather than silently truncating.
95
+ if (legacy.length > 1) {
96
+ console.warn('[approvalRulePayload] legacyAmountRangeToCriteria: received ' +
97
+ legacy.length +
98
+ ' entries but the state model only supports one; using the ' +
99
+ 'first entry and dropping the rest.');
100
+ }
101
+ const first = legacy[0] ?? {};
102
+ const currency = first.currency_code ?? 'USD';
103
+ const symbol = first.currency_symbol ?? '$';
104
+ const min = typeof first.min === 'number'
105
+ ? (0, amount_1.toAmount)(first.min, currency, symbol)
106
+ : undefined;
107
+ const max = typeof first.max === 'number'
108
+ ? (0, amount_1.toAmount)(first.max, currency, symbol)
109
+ : undefined;
110
+ if (min == null && max == null) {
111
+ return [];
112
+ }
113
+ const comparator = min != null && max != null
114
+ ? 'range'
115
+ : min != null
116
+ ? 'greater_than'
117
+ : 'less_than';
118
+ return [{ type: 'amount', comparator, min, max }];
119
+ };
120
+ const toAmountCriteria = (payload) => {
121
+ if (!Array.isArray(payload.conditions)) {
122
+ return undefined;
123
+ }
124
+ const amountConditions = payload.conditions.filter((condition) => condition.field === 'amount');
125
+ // Approval Rules 3.0 — an 'eq' condition represents min === max. Fold
126
+ // it into both finders so it decodes as comparator: 'range' (closed
127
+ // single-point) rather than 'greater_than' (open upper).
128
+ const gteCondition = amountConditions.find((condition) => condition.type === 'gte' || condition.type === 'eq');
129
+ const lteCondition = amountConditions.find((condition) => condition.type === 'lte' || condition.type === 'eq');
130
+ if (gteCondition == null && lteCondition == null) {
131
+ return undefined;
132
+ }
133
+ const currencyCode = payload.currency_code ?? 'USD';
134
+ const currencySymbol = payload.currency_symbol ?? '$';
135
+ const min = typeof gteCondition?.value === 'number'
136
+ ? (0, amount_1.toAmount)(gteCondition.value, currencyCode, currencySymbol)
137
+ : undefined;
138
+ const max = typeof lteCondition?.value === 'number'
139
+ ? (0, amount_1.toAmount)(lteCondition.value, currencyCode, currencySymbol)
140
+ : undefined;
141
+ let comparator;
142
+ if (min != null && max != null) {
143
+ comparator = 'range';
144
+ }
145
+ else if (min != null) {
146
+ comparator = 'greater_than';
147
+ }
148
+ else {
149
+ comparator = 'less_than';
150
+ }
151
+ return { type: 'amount', comparator, min, max };
152
+ };
153
+ const toVendorCriteria = (condition) => {
154
+ if (!Array.isArray(condition.value)) {
155
+ return undefined;
156
+ }
157
+ return {
158
+ type: 'vendor',
159
+ operator: condition.type === 'not_in' ? 'is_not' : 'is',
160
+ vendorIds: condition.value,
161
+ };
162
+ };
163
+ const toDepartmentCriteria = (condition) => {
164
+ if (!Array.isArray(condition.value)) {
165
+ return undefined;
166
+ }
167
+ return {
168
+ type: 'department',
169
+ operator: condition.type === 'not_in' ? 'is_not' : 'is',
170
+ departmentIds: condition.value,
171
+ };
33
172
  };
34
173
  const toApprovalSteps = (payload) => {
35
174
  return payload.map((step) => ({
@@ -1,4 +1,28 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
- import { ApprovalRule, ApprovalRuleState } from './approvalRuleState';
2
+ import { EntityType } from '../entityApprovalStatus/entityApprovalStatusState';
3
+ import { AmountCriteria, ApprovalRule, ApprovalRuleState, Criteria, DepartmentCriteria, VendorCriteria } from './approvalRuleState';
3
4
  export declare function getApprovalRuleById(approvalRuleState: ApprovalRuleState, approvalRuleId: ID): ApprovalRule | undefined;
4
5
  export declare function getApprovalRulesByIds(approvalRuleState: ApprovalRuleState, approvalRuleIds: ID[]): ApprovalRule[];
6
+ /**
7
+ * Returns the amount-range portion of a rule's criteria, if any.
8
+ *
9
+ * Use this whenever a caller needs to read amount min/max from the new
10
+ * discriminated `Criteria` union without inlining a type guard.
11
+ */
12
+ export declare function getAmountCriteria(criteria: Criteria[]): AmountCriteria | undefined;
13
+ export declare function getVendorCriteria(criteria: Criteria[]): VendorCriteria | undefined;
14
+ export declare function getDepartmentCriteria(criteria: Criteria[]): DepartmentCriteria | undefined;
15
+ /**
16
+ * Returns all rules of the given entityType, sorted by `priority` ascending.
17
+ *
18
+ * Rules without a `priority` value sort to the end (treated as Infinity).
19
+ * Use this for the list page where rules render in evaluation order.
20
+ */
21
+ export declare function getApprovalRulesByEntityType(approvalRuleState: ApprovalRuleState, entityType: EntityType): ApprovalRule[];
22
+ /**
23
+ * Returns the tenant's fallback rule for the given entityType, if one exists.
24
+ *
25
+ * The fallback rule is shown by the "fallback engine active" banner on the
26
+ * list page and is used to handle bills/reimbursements that match no other rule.
27
+ */
28
+ export declare function getFallbackApprovalRule(approvalRuleState: ApprovalRuleState, entityType: EntityType): ApprovalRule | undefined;
@@ -2,6 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getApprovalRuleById = getApprovalRuleById;
4
4
  exports.getApprovalRulesByIds = getApprovalRulesByIds;
5
+ exports.getAmountCriteria = getAmountCriteria;
6
+ exports.getVendorCriteria = getVendorCriteria;
7
+ exports.getDepartmentCriteria = getDepartmentCriteria;
8
+ exports.getApprovalRulesByEntityType = getApprovalRulesByEntityType;
9
+ exports.getFallbackApprovalRule = getFallbackApprovalRule;
5
10
  function getApprovalRuleById(approvalRuleState, approvalRuleId) {
6
11
  return approvalRuleState.approvalRuleById[approvalRuleId] ?? undefined;
7
12
  }
@@ -11,3 +16,38 @@ function getApprovalRulesByIds(approvalRuleState, approvalRuleIds) {
11
16
  .filter((value) => value != null);
12
17
  return approvalRulesByIds;
13
18
  }
19
+ /**
20
+ * Returns the amount-range portion of a rule's criteria, if any.
21
+ *
22
+ * Use this whenever a caller needs to read amount min/max from the new
23
+ * discriminated `Criteria` union without inlining a type guard.
24
+ */
25
+ function getAmountCriteria(criteria) {
26
+ return criteria.find((c) => c.type === 'amount');
27
+ }
28
+ function getVendorCriteria(criteria) {
29
+ return criteria.find((c) => c.type === 'vendor');
30
+ }
31
+ function getDepartmentCriteria(criteria) {
32
+ return criteria.find((c) => c.type === 'department');
33
+ }
34
+ /**
35
+ * Returns all rules of the given entityType, sorted by `priority` ascending.
36
+ *
37
+ * Rules without a `priority` value sort to the end (treated as Infinity).
38
+ * Use this for the list page where rules render in evaluation order.
39
+ */
40
+ function getApprovalRulesByEntityType(approvalRuleState, entityType) {
41
+ return Object.values(approvalRuleState.approvalRuleById)
42
+ .filter((rule) => rule.entityType === entityType)
43
+ .sort((a, b) => (a.priority ?? Infinity) - (b.priority ?? Infinity));
44
+ }
45
+ /**
46
+ * Returns the tenant's fallback rule for the given entityType, if one exists.
47
+ *
48
+ * The fallback rule is shown by the "fallback engine active" banner on the
49
+ * list page and is used to handle bills/reimbursements that match no other rule.
50
+ */
51
+ function getFallbackApprovalRule(approvalRuleState, entityType) {
52
+ return Object.values(approvalRuleState.approvalRuleById).find((rule) => rule.entityType === entityType && rule.isFallback === true);
53
+ }