@zeniai/client-epic-state 5.0.96 → 5.0.97
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.
- package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
- package/lib/commonStateTypes/amount.d.ts +1 -0
- package/lib/commonStateTypes/amount.js +9 -1
- package/lib/commonStateTypes/workingDayHelper.d.ts +9 -0
- package/lib/commonStateTypes/workingDayHelper.js +28 -1
- package/lib/entity/aiCfo/aiCfoPayload.d.ts +63 -5
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +23 -2
- package/lib/entity/aiCfo/aiCfoReducer.js +249 -9
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +4 -1
- package/lib/entity/aiCfo/aiCfoSelector.js +19 -1
- package/lib/entity/aiCfo/aiCfoState.d.ts +97 -4
- package/lib/entity/aiCfo/aiCfoState.js +18 -1
- package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +277 -0
- package/lib/entity/cardPolicy/cardPolicyPayload.js +143 -0
- package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +19 -0
- package/lib/entity/cardPolicy/cardPolicyReducer.js +175 -0
- package/lib/entity/cardPolicy/cardPolicySelector.d.ts +32 -0
- package/lib/entity/cardPolicy/cardPolicySelector.js +99 -0
- package/lib/entity/cardPolicy/cardPolicyState.d.ts +205 -0
- package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +68 -0
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +25 -0
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +39 -0
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +24 -0
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +105 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/task/taskPayload.d.ts +3 -1
- package/lib/entity/task/taskPayload.js +2 -0
- package/lib/entity/task/taskState.d.ts +2 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +8 -2
- package/lib/entity/tenant/clearAllEpic.js +12 -0
- package/lib/epic.d.ts +24 -3
- package/lib/epic.js +24 -3
- package/lib/esm/commonStateTypes/amount.js +7 -0
- package/lib/esm/commonStateTypes/workingDayHelper.js +26 -0
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +249 -9
- package/lib/esm/entity/aiCfo/aiCfoSelector.js +17 -1
- package/lib/esm/entity/aiCfo/aiCfoState.js +15 -0
- package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +130 -0
- package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +171 -0
- package/lib/esm/entity/cardPolicy/cardPolicySelector.js +75 -0
- package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
- package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +64 -0
- package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
- package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +35 -0
- package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +101 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +7 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/esm/entity/task/taskPayload.js +2 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +12 -0
- package/lib/esm/epic.js +24 -3
- package/lib/esm/index.js +47 -12
- package/lib/esm/reducer.js +18 -0
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +6 -3
- package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
- package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +2 -1
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +39 -11
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +14 -4
- package/lib/esm/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +38 -0
- package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
- package/lib/esm/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +16 -0
- package/lib/esm/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
- package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +22 -2
- package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +29 -0
- package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +78 -0
- package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +47 -0
- package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +47 -0
- package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +34 -0
- package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +32 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +54 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +92 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +225 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +10 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +23 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +36 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +27 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +28 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +52 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +36 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +39 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +34 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +58 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +38 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +289 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +109 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +44 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +111 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +25 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +363 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +36 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +19 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +6 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +119 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +154 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +22 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +39 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +140 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +20 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +100 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +96 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +59 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +24 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +25 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +34 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +57 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +35 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +42 -4
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +35 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +62 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +44 -0
- package/lib/index.d.ts +59 -15
- package/lib/index.js +213 -22
- package/lib/reducer.d.ts +18 -0
- package/lib/reducer.js +18 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +11 -2
- package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -3
- package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
- package/lib/view/aiCfoView/epics/createSessionEpic.js +2 -1
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -1
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
- package/lib/view/companyTaskManagerView/companyTaskManagerViewPayload.d.ts +19 -11
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +10 -4
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +40 -12
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +2 -0
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +13 -3
- package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +11 -3
- package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.d.ts +10 -0
- package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +42 -0
- package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.d.ts +1 -3
- package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
- package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.d.ts +6 -0
- package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +20 -0
- package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +2 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +8 -1
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +21 -1
- package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +22 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.d.ts +47 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +34 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.d.ts +23 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +82 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.d.ts +40 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +51 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.d.ts +37 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +53 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.d.ts +14 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +38 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.d.ts +7 -0
- package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +36 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.d.ts +56 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +60 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.d.ts +22 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +96 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.d.ts +59 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +230 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.d.ts +122 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +13 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.d.ts +7 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +27 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.d.ts +9 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +40 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.d.ts +7 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +31 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.d.ts +15 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +32 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +56 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +40 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +43 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +38 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +62 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +42 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyAiCardPolicyFormDraftUpdate.js +294 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToAiCardPolicyDraft.js +113 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.d.ts +9 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToDraftEpic.js +48 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyExtractedPolicyToManualCardPolicyDraft.js +115 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.d.ts +13 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/applyUploadPlanToAiCardPolicyDraft.js +29 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildAiCardPolicyFormDraftSeed.js +369 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.d.ts +6 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/buildManualCardPolicyFormDraftSeed.js +40 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyChipIds.js +26 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.d.ts +116 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyFormDraftTypes.js +10 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.d.ts +33 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/cardPolicyRequestParts.js +126 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +52 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +158 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +31 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +12 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +43 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.d.ts +10 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/deriveAiPolicyReviewRowsFromInputs.js +144 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +24 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/seedAiCardPolicyFormDraftEpic.js +104 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.d.ts +22 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toBulkCardPolicyTemplateRequestsFromDraft.js +100 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toCardPolicyTemplateRequestFromDraft.js +63 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.d.ts +3 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/toManualCardPolicyTemplateRequestFromDraft.js +28 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +27 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.d.ts +34 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +2 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/applyAiCardCreationFormDraftUpdate.js +38 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.d.ts +12 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +61 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.d.ts +9 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +39 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +12 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +43 -5
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +7 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +42 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +5 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/seedAiCardCreationFormDraftEpic.js +66 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.d.ts +3 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +48 -0
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
- package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +1 -1
- package/lib/zeniAPI.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export function getCardPolicyMccCategories(state) {
|
|
2
|
+
return state.mccCategories;
|
|
3
|
+
}
|
|
4
|
+
export function getCardPolicyMccCategoriesFetchState(state) {
|
|
5
|
+
return state.mccCategoriesFetchState;
|
|
6
|
+
}
|
|
7
|
+
export function getCardPolicyMccCategoriesError(state) {
|
|
8
|
+
return state.mccCategoriesError;
|
|
9
|
+
}
|
|
10
|
+
export function getCardPolicyTemplateById(state, templateId) {
|
|
11
|
+
return state.cardPolicyTemplateById[templateId];
|
|
12
|
+
}
|
|
13
|
+
export function getAllCardPolicyTemplates(state) {
|
|
14
|
+
return Object.values(state.cardPolicyTemplateById);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve an ordered list of `templateId`s against the entity store and
|
|
18
|
+
* return the corresponding `CardPolicyTemplate[]` in the same order.
|
|
19
|
+
* Missing IDs (e.g. stale local state during a refetch) are silently
|
|
20
|
+
* dropped. Pair with `getCardPolicyTemplateIds` from the view slice to
|
|
21
|
+
* render the Policy List page in server order.
|
|
22
|
+
*/
|
|
23
|
+
export function getCardPolicyTemplatesByIds(state, templateIds) {
|
|
24
|
+
return templateIds
|
|
25
|
+
.map((id) => state.cardPolicyTemplateById[id])
|
|
26
|
+
.filter((template) => template != null);
|
|
27
|
+
}
|
|
28
|
+
export function getCardPolicyStats(state) {
|
|
29
|
+
return state.cardPolicyStats;
|
|
30
|
+
}
|
|
31
|
+
export function getPolicyDocumentExtractionFetchState(state) {
|
|
32
|
+
return state.policyDocumentExtraction.fetchState;
|
|
33
|
+
}
|
|
34
|
+
export function getPolicyDocumentExtractionError(state) {
|
|
35
|
+
return state.policyDocumentExtraction.error;
|
|
36
|
+
}
|
|
37
|
+
export function getExtractedCardPolicyRules(state) {
|
|
38
|
+
return state.policyDocumentExtraction.extractedRules;
|
|
39
|
+
}
|
|
40
|
+
export function getUploadedPolicyDocumentFileName(state) {
|
|
41
|
+
return state.policyDocumentExtraction.uploadedFileName;
|
|
42
|
+
}
|
|
43
|
+
export function getPolicyRecommendationFromUploadFetchState(state) {
|
|
44
|
+
return state.policyRecommendationFromUpload.fetchState;
|
|
45
|
+
}
|
|
46
|
+
export function getPolicyRecommendationFromUploadError(state) {
|
|
47
|
+
return state.policyRecommendationFromUpload.error;
|
|
48
|
+
}
|
|
49
|
+
export function getPolicyRecommendationFromUploadAnswerId(state) {
|
|
50
|
+
return state.policyRecommendationFromUpload.answerId;
|
|
51
|
+
}
|
|
52
|
+
export function getPolicyRecommendationFromUploadChatSessionId(state) {
|
|
53
|
+
return state.policyRecommendationFromUpload.chatSessionId;
|
|
54
|
+
}
|
|
55
|
+
export function getCardPolicySuggestedAllowMerchants(state) {
|
|
56
|
+
return state.suggestedAllowMerchants;
|
|
57
|
+
}
|
|
58
|
+
export function getCardPolicySuggestedBlockMerchants(state) {
|
|
59
|
+
return state.suggestedBlockMerchants;
|
|
60
|
+
}
|
|
61
|
+
export function getCardPolicySuggestedAllowCategories(state) {
|
|
62
|
+
return state.suggestedAllowCategories;
|
|
63
|
+
}
|
|
64
|
+
export function getCardPolicySuggestedBlockCategories(state) {
|
|
65
|
+
return state.suggestedBlockCategories;
|
|
66
|
+
}
|
|
67
|
+
export function getCardPolicyVendorSearchOptions(state) {
|
|
68
|
+
return state.vendorSearch.vendors;
|
|
69
|
+
}
|
|
70
|
+
export function getCardPolicyVendorSearchFetchState(state) {
|
|
71
|
+
return state.vendorSearch.fetchState;
|
|
72
|
+
}
|
|
73
|
+
export function getCardPolicyVendorSearchString(state) {
|
|
74
|
+
return state.vendorSearch.searchString;
|
|
75
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { stringToUnion } from '../../commonStateTypes/stringToUnion';
|
|
2
|
+
export const ALL_CARD_POLICY_TEMPLATE_MODES = ['strict', 'flexible'];
|
|
3
|
+
export const toCardPolicyTemplateMode = (v) => stringToUnion(v, ALL_CARD_POLICY_TEMPLATE_MODES);
|
|
4
|
+
export const ALL_CARD_POLICY_TEMPLATE_STATUSES = [
|
|
5
|
+
'active',
|
|
6
|
+
'inactive',
|
|
7
|
+
'archived',
|
|
8
|
+
];
|
|
9
|
+
export const toCardPolicyTemplateStatus = (v) => stringToUnion(v, ALL_CARD_POLICY_TEMPLATE_STATUSES);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap, takeUntil } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessStatus } from '../../responsePayload';
|
|
4
|
+
import { clearPolicyDocumentExtraction, extractPolicyDocument, updatePolicyDocumentExtractionFailure, updatePolicyDocumentExtractionSuccess, } from './cardPolicyReducer';
|
|
5
|
+
/**
|
|
6
|
+
* Build a multipart `FormData` body for `POST /cards/1.0/policy-documents/extract`.
|
|
7
|
+
*
|
|
8
|
+
* Uses the same `attachment_file_<i>` / `attachment_json_<i>` field-naming
|
|
9
|
+
* convention as the charge-card receipt upload (`uploadReceipts.ts` in
|
|
10
|
+
* `web-components`) so backends that already support that wire shape
|
|
11
|
+
* accept this endpoint without bespoke parsing.
|
|
12
|
+
*/
|
|
13
|
+
const buildPolicyDocumentFormData = (files) => {
|
|
14
|
+
const data = new FormData();
|
|
15
|
+
files.forEach((file, index) => {
|
|
16
|
+
data.append(`attachment_file_${index}`, file);
|
|
17
|
+
const attachmentJson = JSON.stringify({
|
|
18
|
+
file_name: file.name,
|
|
19
|
+
content_type: file.type,
|
|
20
|
+
size: file.size,
|
|
21
|
+
});
|
|
22
|
+
data.append(`attachment_json_${index}`, attachmentJson);
|
|
23
|
+
});
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Listens for `extractPolicyDocument`, POSTs the file(s) as multipart
|
|
28
|
+
* form-data to the cards micro-service's policy-document extract endpoint,
|
|
29
|
+
* and dispatches success / failure into the entity slice.
|
|
30
|
+
*
|
|
31
|
+
* Consumed by:
|
|
32
|
+
* - Manual `CardPolicyCreatePage` (read result via
|
|
33
|
+
* `getExtractedCardPolicyRules` then pre-fill the RHF form via
|
|
34
|
+
* `applyExtractedPolicyRulesToFormValues` from `@zeniai/web-components`).
|
|
35
|
+
* - (Future) AI CFO upload surface — same action + selector contract.
|
|
36
|
+
*/
|
|
37
|
+
export const extractPolicyDocumentEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(extractPolicyDocument.match),
|
|
38
|
+
// `switchMap` (vs `mergeMap`) cancels any in-flight extract whenever a
|
|
39
|
+
// new upload is dispatched. With `mergeMap` an older, slower response
|
|
40
|
+
// could win the race: `updatePolicyDocumentExtractionSuccess` would
|
|
41
|
+
// fire with stale `extractedRules` and the chained bridge epic would
|
|
42
|
+
// pair them with whatever `aiCfoAnswerId` / `aiCfoChatSessionId` are
|
|
43
|
+
// currently in state — recommending the old file's rules against the
|
|
44
|
+
// wrong AI CFO answer.
|
|
45
|
+
switchMap((action) => {
|
|
46
|
+
const formData = buildPolicyDocumentFormData(action.payload.files);
|
|
47
|
+
return zeniAPI
|
|
48
|
+
.postFormData(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-documents/extract`, formData)
|
|
49
|
+
.pipe(mergeMap((response) => {
|
|
50
|
+
if (isSuccessStatus(response) &&
|
|
51
|
+
response.data != null &&
|
|
52
|
+
response.data.extracted_rules != null) {
|
|
53
|
+
return of(updatePolicyDocumentExtractionSuccess(response.data.extracted_rules));
|
|
54
|
+
}
|
|
55
|
+
return of(updatePolicyDocumentExtractionFailure(response.status));
|
|
56
|
+
}), catchError((error) => of(updatePolicyDocumentExtractionFailure(createZeniAPIStatus('Unexpected Error', 'Extract card-policy document REST API call errored out' +
|
|
57
|
+
JSON.stringify(error))))),
|
|
58
|
+
// `clearPolicyDocumentExtraction` (e.g. user clicks the "× Policy.pdf"
|
|
59
|
+
// pill) tears down the in-flight extract subscription, so a late
|
|
60
|
+
// response can't re-flip `policyDocumentExtraction.fetchState` back
|
|
61
|
+
// to `Completed` or repopulate `extractedRules` after the user
|
|
62
|
+
// already dismissed the upload.
|
|
63
|
+
takeUntil(actions$.pipe(filter(clearPolicyDocumentExtraction.match))));
|
|
64
|
+
}));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessStatus } from '../../responsePayload';
|
|
4
|
+
import { fetchCardPolicyVendorOptions, updateCardPolicyVendorOptions, updateCardPolicyVendorOptionsFailure, } from './cardPolicyReducer';
|
|
5
|
+
const buildQuery = (searchString) => ({
|
|
6
|
+
view: 'vendor_list',
|
|
7
|
+
page_token: null,
|
|
8
|
+
sort_by: 'year_to_date_spend',
|
|
9
|
+
sort_order: 'desc',
|
|
10
|
+
search_text: searchString,
|
|
11
|
+
vendor_name: searchString,
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Card-policy vendor search.
|
|
15
|
+
*
|
|
16
|
+
* Listens for `fetchCardPolicyVendorOptions` and hits the same
|
|
17
|
+
* `/accounting/1.0/vendors` endpoint the Vendors-tab uses, but writes
|
|
18
|
+
* results onto the dedicated `cardPolicyState.vendorSearch` slice — no
|
|
19
|
+
* fan-out to the global `vendor` / `account` / `class` / `vendorList`
|
|
20
|
+
* entities. That isolation is important: the user may be configuring a
|
|
21
|
+
* card policy in parallel with browsing the Vendors tab, and we don't
|
|
22
|
+
* want either flow to clobber the other's list state.
|
|
23
|
+
*
|
|
24
|
+
* Uses `switchMap` so the latest typed search wins — earlier in-flight
|
|
25
|
+
* requests are abandoned, which is the right semantics for a
|
|
26
|
+
* search-as-you-type UX.
|
|
27
|
+
*
|
|
28
|
+
* Consumers:
|
|
29
|
+
* - Manual `CardPolicyCreate / EditScreen`
|
|
30
|
+
* - AI CFO `CardPolicyInteractiveForm` (vendor step)
|
|
31
|
+
*/
|
|
32
|
+
export const fetchCardPolicyVendorOptionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyVendorOptions.match), switchMap((action) => {
|
|
33
|
+
const query = buildQuery(action.payload.searchString);
|
|
34
|
+
const apiUrl = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors` +
|
|
35
|
+
`?query=${encodeURIComponent(JSON.stringify(query))}`;
|
|
36
|
+
return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
|
|
37
|
+
if (isSuccessStatus(response) && response.data != null) {
|
|
38
|
+
return of(updateCardPolicyVendorOptions(response.data));
|
|
39
|
+
}
|
|
40
|
+
return of(updateCardPolicyVendorOptionsFailure(response.status));
|
|
41
|
+
}), catchError((error) => of(updateCardPolicyVendorOptionsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch card policy vendor options REST API call errored out' +
|
|
42
|
+
JSON.stringify(error))))));
|
|
43
|
+
}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EMPTY, of } from 'rxjs';
|
|
2
|
+
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { fetchCardPolicyRecommendationFromUpload, updatePolicyDocumentExtractionSuccess, } from './cardPolicyReducer';
|
|
4
|
+
/**
|
|
5
|
+
* Bridge epic — chains the AI CFO `upload`-mode flow's two API hops.
|
|
6
|
+
*
|
|
7
|
+
* The first hop (`extractPolicyDocument` → multipart POST to
|
|
8
|
+
* `policy-documents/extract`) lives on the cardPolicy slice and is
|
|
9
|
+
* shared with the manual `CardPolicyCreatePage`. The second hop
|
|
10
|
+
* (`fetchCardPolicyRecommendationFromUpload` → JSON POST to
|
|
11
|
+
* `ai-cfo/policy-recommendation-from-upload`) is AI-CFO only.
|
|
12
|
+
*
|
|
13
|
+
* The chain is gated on `policyDocumentExtraction.aiCfoAnswerId` being
|
|
14
|
+
* populated — manual callers leave it undefined, so the bridge is a
|
|
15
|
+
* silent no-op there.
|
|
16
|
+
*
|
|
17
|
+
* Splitting this off from `policyRecommendationFromUploadEpic` keeps
|
|
18
|
+
* the wizard component a pure renderer: it dispatches
|
|
19
|
+
* `extractPolicyDocument(files, answerId, chatSessionId)` once, then
|
|
20
|
+
* subscribes to `cardPolicyState` lifecycle flags to drive its
|
|
21
|
+
* "Extracting…" / "Recommending…" pill.
|
|
22
|
+
*/
|
|
23
|
+
export const policyDocumentExtractionToRecommendationBridgeEpic = (actions$, state$) => actions$.pipe(filter(updatePolicyDocumentExtractionSuccess.match), mergeMap((action) => {
|
|
24
|
+
const extraction = state$.value.cardPolicyState.policyDocumentExtraction;
|
|
25
|
+
const aiCfoAnswerId = extraction.aiCfoAnswerId;
|
|
26
|
+
const aiCfoChatSessionId = extraction.aiCfoChatSessionId;
|
|
27
|
+
const extractedRules = extraction.extractedRules;
|
|
28
|
+
if (aiCfoAnswerId == null ||
|
|
29
|
+
aiCfoChatSessionId == null ||
|
|
30
|
+
extractedRules == null) {
|
|
31
|
+
return EMPTY;
|
|
32
|
+
}
|
|
33
|
+
void action;
|
|
34
|
+
return of(fetchCardPolicyRecommendationFromUpload(aiCfoAnswerId, aiCfoChatSessionId, extractedRules));
|
|
35
|
+
}));
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap, takeUntil, } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessStatus } from '../../responsePayload';
|
|
4
|
+
import { updateAiCardPolicyFormDraftFromUploadPlan } from '../../view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer';
|
|
5
|
+
import { updateAiCfoAnswerCardPolicyWizardPlan } from '../aiCfo/aiCfoReducer';
|
|
6
|
+
import { clearPolicyDocumentExtraction, fetchCardPolicyRecommendationFromUpload, updatePolicyRecommendationFromUploadFailure, updatePolicyRecommendationFromUploadSuccess, } from './cardPolicyReducer';
|
|
7
|
+
/**
|
|
8
|
+
* Listens for `fetchCardPolicyRecommendationFromUpload` and POSTs the
|
|
9
|
+
* just-extracted policy rules to the AI-CFO recommendation endpoint.
|
|
10
|
+
*
|
|
11
|
+
* On success — dispatches BOTH:
|
|
12
|
+
* - `updatePolicyRecommendationFromUploadSuccess` (flips the
|
|
13
|
+
* cardPolicy slice's recommendation lifecycle to `Completed`), and
|
|
14
|
+
* - `updateAiCfoAnswerCardPolicyWizardPlan` (patches the in-flight AI
|
|
15
|
+
* CFO answer's `CardPolicyInitialData` so the wizard can advance from
|
|
16
|
+
* Step 1 → Step 2 in the upload variant).
|
|
17
|
+
*
|
|
18
|
+
* The reducer payload originally captured at kickoff (`answerId` +
|
|
19
|
+
* `chatSessionId`) re-enters via the action so the patch can find the
|
|
20
|
+
* right answer to merge into.
|
|
21
|
+
*/
|
|
22
|
+
export const policyRecommendationFromUploadEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCardPolicyRecommendationFromUpload.match),
|
|
23
|
+
// `switchMap` (vs `mergeMap`) cancels any in-flight recommendation
|
|
24
|
+
// whenever a new upload kicks off another one. Without this an older,
|
|
25
|
+
// slower recommendation response could still resolve after a fresh
|
|
26
|
+
// extract has started — that late response would dispatch
|
|
27
|
+
// `updateAiCfoAnswerCardPolicyWizardPlan` against the *current*
|
|
28
|
+
// `answerId`/`chatSessionId` (the ones captured at its kickoff) and
|
|
29
|
+
// overwrite the wizard plan with stale draft policies from the prior
|
|
30
|
+
// document. Pairs with the matching `switchMap` in
|
|
31
|
+
// `extractPolicyDocumentEpic`.
|
|
32
|
+
switchMap((action) => {
|
|
33
|
+
const { answerId, chatSessionId, extractedRules } = action.payload;
|
|
34
|
+
const body = {
|
|
35
|
+
extracted_rules: {
|
|
36
|
+
allowed_entity: {
|
|
37
|
+
category_codes: extractedRules.allowedEntity.categoryCodes,
|
|
38
|
+
merchant_names: extractedRules.allowedEntity.merchantNames,
|
|
39
|
+
},
|
|
40
|
+
blocked_entity: {
|
|
41
|
+
category_codes: extractedRules.blockedEntity.categoryCodes,
|
|
42
|
+
merchant_names: extractedRules.blockedEntity.merchantNames,
|
|
43
|
+
},
|
|
44
|
+
confidence_score: extractedRules.confidenceScore,
|
|
45
|
+
policy_name: extractedRules.policyName,
|
|
46
|
+
required_receipt_threshold: extractedRules.requiredReceiptThreshold,
|
|
47
|
+
transaction_limit: extractedRules.transactionLimit,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
return zeniAPI
|
|
51
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/ai-cfo/policy-recommendation-from-upload`, body)
|
|
52
|
+
.pipe(mergeMap((response) => {
|
|
53
|
+
if (!isSuccessStatus(response) ||
|
|
54
|
+
response.data?.wizard_plan?.step_5_review == null) {
|
|
55
|
+
return of(updatePolicyRecommendationFromUploadFailure(response.status));
|
|
56
|
+
}
|
|
57
|
+
const data = response.data;
|
|
58
|
+
const review = data.wizard_plan.step_5_review;
|
|
59
|
+
const wizardPlan = {
|
|
60
|
+
step5Review: {
|
|
61
|
+
draftPolicies: (review.draft_policies ?? []).map((draft, index) => ({
|
|
62
|
+
id: `draft-${index}`,
|
|
63
|
+
name: draft.name,
|
|
64
|
+
description: draft.description ?? '',
|
|
65
|
+
mode: draft.mode,
|
|
66
|
+
allowedEntity: {
|
|
67
|
+
categoryCodes: draft.allowed_entity?.category_codes ?? [],
|
|
68
|
+
merchantNames: draft.allowed_entity?.merchant_names ?? [],
|
|
69
|
+
},
|
|
70
|
+
blockedEntity: {
|
|
71
|
+
categoryCodes: draft.blocked_entity?.category_codes ?? [],
|
|
72
|
+
merchantNames: draft.blocked_entity?.merchant_names ?? [],
|
|
73
|
+
},
|
|
74
|
+
applyToCards: draft.apply_to_cards ?? [],
|
|
75
|
+
requiredReceiptThreshold: draft.required_receipt_threshold ?? 0,
|
|
76
|
+
spendLimits: {
|
|
77
|
+
transaction: draft.spend_limits?.transaction ?? 0,
|
|
78
|
+
},
|
|
79
|
+
})),
|
|
80
|
+
groupingSource: review.grouping_source ?? 'none',
|
|
81
|
+
prompt: review.prompt ?? '',
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
const source = data.source != null
|
|
85
|
+
? {
|
|
86
|
+
confidenceScore: data.source.confidence_score,
|
|
87
|
+
fileName: data.source.file_name,
|
|
88
|
+
lowConfidenceFields: data.source.low_confidence_fields ?? [],
|
|
89
|
+
}
|
|
90
|
+
: undefined;
|
|
91
|
+
return of(updatePolicyRecommendationFromUploadSuccess(), updateAiCfoAnswerCardPolicyWizardPlan({
|
|
92
|
+
answerId,
|
|
93
|
+
chatSessionId,
|
|
94
|
+
wizardPlan,
|
|
95
|
+
source,
|
|
96
|
+
}), updateAiCardPolicyFormDraftFromUploadPlan(wizardPlan, source));
|
|
97
|
+
}), catchError((error) => of(updatePolicyRecommendationFromUploadFailure(createZeniAPIStatus('Unexpected Error', 'Policy recommendation from upload REST API call errored out' +
|
|
98
|
+
JSON.stringify(error))))),
|
|
99
|
+
// Guards the user-dismissed case that switchMap doesn't cover: a late response would patch a wizard plan the user already cleared.
|
|
100
|
+
takeUntil(actions$.pipe(filter(clearPolicyDocumentExtraction.match))));
|
|
101
|
+
}));
|
|
@@ -145,42 +145,49 @@ function toJEScheduleAISummaries(payload) {
|
|
|
145
145
|
result.debitAccount = {
|
|
146
146
|
confidence: payload.debit_account.confidence,
|
|
147
147
|
reasoning: payload.debit_account.reasoning,
|
|
148
|
+
cot: Array.isArray(payload.debit_account.cot) ? payload.debit_account.cot : undefined,
|
|
148
149
|
};
|
|
149
150
|
}
|
|
150
151
|
if (payload.credit_account != null) {
|
|
151
152
|
result.creditAccount = {
|
|
152
153
|
confidence: payload.credit_account.confidence,
|
|
153
154
|
reasoning: payload.credit_account.reasoning,
|
|
155
|
+
cot: Array.isArray(payload.credit_account.cot) ? payload.credit_account.cot : undefined,
|
|
154
156
|
};
|
|
155
157
|
}
|
|
156
158
|
if (payload.debit_accounting_class != null) {
|
|
157
159
|
result.debitClass = {
|
|
158
160
|
confidence: payload.debit_accounting_class.confidence,
|
|
159
161
|
reasoning: payload.debit_accounting_class.reasoning,
|
|
162
|
+
cot: Array.isArray(payload.debit_accounting_class.cot) ? payload.debit_accounting_class.cot : undefined,
|
|
160
163
|
};
|
|
161
164
|
}
|
|
162
165
|
if (payload.credit_accounting_class != null) {
|
|
163
166
|
result.creditClass = {
|
|
164
167
|
confidence: payload.credit_accounting_class.confidence,
|
|
165
168
|
reasoning: payload.credit_accounting_class.reasoning,
|
|
169
|
+
cot: Array.isArray(payload.credit_accounting_class.cot) ? payload.credit_accounting_class.cot : undefined,
|
|
166
170
|
};
|
|
167
171
|
}
|
|
168
172
|
if (payload.period != null) {
|
|
169
173
|
result.period = {
|
|
170
174
|
confidence: payload.period.confidence,
|
|
171
175
|
reasoning: payload.period.reasoning,
|
|
176
|
+
cot: Array.isArray(payload.period.cot) ? payload.period.cot : undefined,
|
|
172
177
|
};
|
|
173
178
|
}
|
|
174
179
|
if (payload.posting_date != null) {
|
|
175
180
|
result.postingDate = {
|
|
176
181
|
confidence: payload.posting_date.confidence,
|
|
177
182
|
reasoning: payload.posting_date.reasoning,
|
|
183
|
+
cot: Array.isArray(payload.posting_date.cot) ? payload.posting_date.cot : undefined,
|
|
178
184
|
};
|
|
179
185
|
}
|
|
180
186
|
if (payload.schedule_type != null) {
|
|
181
187
|
result.scheduleType = {
|
|
182
188
|
confidence: payload.schedule_type.confidence,
|
|
183
189
|
reasoning: payload.schedule_type.reasoning,
|
|
190
|
+
cot: Array.isArray(payload.schedule_type.cot) ? payload.schedule_type.cot : undefined,
|
|
184
191
|
};
|
|
185
192
|
}
|
|
186
193
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
@@ -95,6 +95,9 @@ const ALL_SNACKBAR_MESSAGE_SECTIONS = [
|
|
|
95
95
|
'charge_card_receipt_upload',
|
|
96
96
|
'charge_card_resend_invite',
|
|
97
97
|
'charge_card_revoke_invite',
|
|
98
|
+
'card_policy_created',
|
|
99
|
+
'card_policy_updated',
|
|
100
|
+
'card_policy_deleted',
|
|
98
101
|
'charge_card_update_limit',
|
|
99
102
|
'charge_cards_update_limit',
|
|
100
103
|
'close_charge_card',
|
|
@@ -41,6 +41,8 @@ export const mapTaskPayloadToTask = (payload) => ({
|
|
|
41
41
|
dueDate: payload.due_date != null ? date(payload.due_date) : undefined,
|
|
42
42
|
updateTime: payload.update_time != null ? date(payload.update_time) : undefined,
|
|
43
43
|
companyId: payload.company_id,
|
|
44
|
+
companyName: payload.company_name,
|
|
45
|
+
parentTaskId: payload.parent_task_id ?? undefined,
|
|
44
46
|
recurringSourceTaskId: payload.recurring_source_task_id != null
|
|
45
47
|
? payload.recurring_source_task_id
|
|
46
48
|
: undefined,
|
|
@@ -85,6 +85,8 @@ import { clearScheduleDetailView } from '../../view/scheduleView/scheduleDetailV
|
|
|
85
85
|
import { clearScheduleList } from '../../view/scheduleView/scheduleListView/scheduleListReducer';
|
|
86
86
|
import { clearSettingsView } from '../../view/settingsView/settingsViewReducer';
|
|
87
87
|
import { clearAutoTransferRules } from '../../view/spendManagement/autotransferRules/autoTransferRulesReducer';
|
|
88
|
+
import { clearAutoSweepFlow } from '../../view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer';
|
|
89
|
+
import { clearCashManagementOverview } from '../../view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer';
|
|
88
90
|
import { clearBillDetailView } from '../../view/spendManagement/billPay/billDetailView/billDetailViewReducer';
|
|
89
91
|
import { clearBillList } from '../../view/spendManagement/billPay/billList/billListReducer';
|
|
90
92
|
import { clearBillPayConfig } from '../../view/spendManagement/billPay/billPayConfig/billPayConfigReducer';
|
|
@@ -97,6 +99,9 @@ import { clearInternationalWire } from '../../view/spendManagement/billPay/inter
|
|
|
97
99
|
import { clearInternationalVerificationView } from '../../view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer';
|
|
98
100
|
import { clearPreviousBills } from '../../view/spendManagement/billPay/previousBills/previousBillsReducer';
|
|
99
101
|
import { clearWiseRedirectStatus } from '../../view/spendManagement/billPay/wiseRedirectView/wiseRedirectReducer';
|
|
102
|
+
import { clearCardPolicyDetail } from '../../view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer';
|
|
103
|
+
import { clearCardPolicyList } from '../../view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer';
|
|
104
|
+
import { clearCreateCardPolicy } from '../../view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer';
|
|
100
105
|
import { clearCardUserOnboarding } from '../../view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingReducer';
|
|
101
106
|
import { clearCashbackDetail } from '../../view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer';
|
|
102
107
|
import { clearChargeCardConfig } from '../../view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer';
|
|
@@ -168,6 +173,7 @@ import { clearAllBillTransactions } from '../billPay/billTransaction/billTransac
|
|
|
168
173
|
import { clearContacts } from '../billPay/contact/contactReducer';
|
|
169
174
|
import { clearAllRecurringBills } from '../billPay/recurringBills/recurringBillsReducer';
|
|
170
175
|
import { clearAllCardPayments } from '../cardPayment/cardPaymentReducer';
|
|
176
|
+
import { clearCardPolicy } from '../cardPolicy/cardPolicyReducer';
|
|
171
177
|
import { clearAllChargeCards } from '../chargeCard/chargeCardReducer';
|
|
172
178
|
import { clearAllChargeCardRepayments } from '../chargeCardRepayment/chargeCardRepaymentReducer';
|
|
173
179
|
import { clearAllChargeCardTransactions } from '../chargeCardTransaction/chargeCardTransactionReducer';
|
|
@@ -231,6 +237,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
|
|
|
231
237
|
clearArAging(),
|
|
232
238
|
clearArAgingDetail(),
|
|
233
239
|
clearAuthenticationView(),
|
|
240
|
+
clearAutoSweepFlow(),
|
|
234
241
|
clearAutoTransferRules(),
|
|
235
242
|
clearBalanceSheet(),
|
|
236
243
|
clearBankAccountView(),
|
|
@@ -244,11 +251,14 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
|
|
|
244
251
|
clearBillPaySetupView(),
|
|
245
252
|
clearCardBalance(),
|
|
246
253
|
clearCardPaymentView(),
|
|
254
|
+
clearCardPolicyDetail(),
|
|
255
|
+
clearCardPolicyList(),
|
|
247
256
|
clearCardUserOnboarding(),
|
|
248
257
|
clearCashbackDetail(),
|
|
249
258
|
clearCashBalance(),
|
|
250
259
|
clearCashFlow(),
|
|
251
260
|
clearCashInCashOut(),
|
|
261
|
+
clearCashManagementOverview(),
|
|
252
262
|
clearCashPosition(),
|
|
253
263
|
clearChargeCardConfig(),
|
|
254
264
|
clearChargeCardDetail(),
|
|
@@ -263,6 +273,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
|
|
|
263
273
|
clearCompanyMonthEndReportView(),
|
|
264
274
|
clearCompanyTaskManagerView(),
|
|
265
275
|
clearCompanyView(),
|
|
276
|
+
clearCreateCardPolicy(),
|
|
266
277
|
clearCreateTransferEntry(),
|
|
267
278
|
clearAllCreditAgent(),
|
|
268
279
|
clearCreditAgentView(),
|
|
@@ -424,6 +435,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
|
|
|
424
435
|
clearAllVendorExpenseTrends(),
|
|
425
436
|
clearAllVendors(),
|
|
426
437
|
clearCannedResponses(),
|
|
438
|
+
clearCardPolicy(),
|
|
427
439
|
clearClassList(),
|
|
428
440
|
clearContacts(),
|
|
429
441
|
clearCountryList(),
|