@zeniai/client-epic-state 5.0.83 → 5.0.84-beta0ND
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/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +1 -0
- package/lib/entity/aiCfo/aiCfoPayload.d.ts +1 -140
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +2 -23
- package/lib/entity/aiCfo/aiCfoReducer.js +4 -332
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -13
- package/lib/entity/aiCfo/aiCfoSelector.js +1 -28
- package/lib/entity/aiCfo/aiCfoState.d.ts +4 -225
- package/lib/entity/aiCfo/aiCfoState.js +1 -30
- package/lib/entity/company/companyPayload.d.ts +2 -0
- package/lib/entity/company/companyPayload.js +2 -0
- package/lib/entity/company/companyStateTypes.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/paymentAccount/paymentAccountSelector.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountSelector.js +4 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -3
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -6
- package/lib/entity/tenant/clearAllEpic.js +0 -8
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/tenantPayload.d.ts +19 -0
- package/lib/entity/tenant/tenantReducer.d.ts +49 -28
- package/lib/entity/tenant/tenantReducer.js +111 -5
- package/lib/entity/tenant/tenantState.d.ts +21 -0
- package/lib/epic.d.ts +6 -11
- package/lib/epic.js +7 -11
- package/lib/esm/commonStateTypes/animations.js +1 -0
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +4 -332
- package/lib/esm/entity/aiCfo/aiCfoSelector.js +1 -26
- package/lib/esm/entity/aiCfo/aiCfoState.js +0 -27
- package/lib/esm/entity/company/companyPayload.js +2 -0
- package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +3 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -8
- package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
- package/lib/esm/entity/tenant/tenantReducer.js +108 -3
- package/lib/esm/epic.js +7 -11
- package/lib/esm/index.js +16 -28
- package/lib/esm/reducer.js +0 -12
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +3 -6
- package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -5
- package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +1 -2
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +2 -12
- package/lib/esm/view/companyView/companyViewReducer.js +45 -1
- package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +25 -0
- package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.js +79 -0
- package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
- package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +45 -0
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +168 -50
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +14 -0
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -25
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +4 -16
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +0 -38
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +49 -0
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +58 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +12 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +71 -52
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
- package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
- package/lib/index.d.ts +19 -28
- package/lib/index.js +36 -136
- package/lib/reducer.d.ts +0 -12
- package/lib/reducer.js +0 -12
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +2 -11
- package/lib/view/aiCfoView/aiCfoViewReducer.js +3 -6
- package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -5
- package/lib/view/aiCfoView/epics/createSessionEpic.js +1 -2
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +1 -8
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +2 -12
- package/lib/view/companyView/companyViewReducer.d.ts +11 -1
- package/lib/view/companyView/companyViewReducer.js +47 -3
- package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.d.ts +9 -0
- package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +29 -0
- package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.d.ts +10 -0
- package/lib/view/companyView/epic/companyPassport/updateCapitalizationThresholdEpic.js +83 -0
- package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
- package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +49 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +41 -4
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +170 -51
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +7 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +21 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +37 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +14 -1
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +0 -14
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +1 -27
- 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 +1 -5
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +5 -17
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +0 -27
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +1 -43
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +0 -2
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +8 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +53 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +8 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +62 -0
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +27 -0
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +15 -0
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +24 -2
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -53
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +12 -0
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
- package/package.json +1 -1
- package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +0 -277
- package/lib/entity/cardPolicy/cardPolicyPayload.js +0 -143
- package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +0 -19
- package/lib/entity/cardPolicy/cardPolicyReducer.js +0 -265
- package/lib/entity/cardPolicy/cardPolicySelector.d.ts +0 -32
- package/lib/entity/cardPolicy/cardPolicySelector.js +0 -103
- package/lib/entity/cardPolicy/cardPolicyState.d.ts +0 -205
- package/lib/entity/cardPolicy/cardPolicyState.js +0 -14
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +0 -18
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +0 -68
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +0 -26
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +0 -47
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +0 -25
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +0 -39
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +0 -23
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +0 -111
- package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +0 -130
- package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +0 -261
- package/lib/esm/entity/cardPolicy/cardPolicySelector.js +0 -79
- package/lib/esm/entity/cardPolicy/cardPolicyState.js +0 -9
- package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +0 -64
- package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +0 -43
- package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +0 -35
- package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +0 -107
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -70
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -22
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -56
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -49
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -42
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -72
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -21
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -56
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -62
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -39
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -53
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -25
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +0 -14
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -74
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +0 -21
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -28
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +0 -25
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -2
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +0 -19
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -60
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +0 -18
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -53
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +0 -16
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -46
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +0 -15
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -76
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +0 -21
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -27
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +0 -19
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -2
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +0 -19
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -60
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +0 -13
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -66
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +0 -32
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -46
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +0 -45
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -2
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +0 -25
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -57
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +0 -15
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -29
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @see README.md in this directory for maintenance expectations.
|
|
18
18
|
*/
|
|
19
|
-
export type AiCfoSuggestedQuestionsPageContext = 'balance_sheet' | 'profit_loss' | 'vendors' | 'transactions' | 'cash_flow' | 'accounts_receivable' | 'accounts_payable' | 'transaction_details' | 'dashboard' | 'cash_balance' | 'card_balance' | 'cash_in_cash_out' | 'net_burn_or_income' | 'cash_position' | 'top_expenses' | 'revenue' | 'operating_expenses' | 'command_centre' | 'je_schedules' | 'reconciliation' | 'flux_analysis' | 'receipts' | 'mei' | 'task_checklist' | 'performance' | 'bills_list' | 'bills_details' | 'reimbursement_list' | 'reimbursement_details' | 'vendors_summary' | 'opex_by_vendor' | 'prepaid_expenses' | 'fixed_assets' | 'form_1099' | 'accrued_expenses' | 'forecast' | 'checking' | 'checking_details' | 'treasury' | 'cards' | '
|
|
19
|
+
export type AiCfoSuggestedQuestionsPageContext = 'balance_sheet' | 'profit_loss' | 'vendors' | 'transactions' | 'cash_flow' | 'accounts_receivable' | 'accounts_payable' | 'transaction_details' | 'dashboard' | 'cash_balance' | 'card_balance' | 'cash_in_cash_out' | 'net_burn_or_income' | 'cash_position' | 'top_expenses' | 'revenue' | 'operating_expenses' | 'command_centre' | 'je_schedules' | 'reconciliation' | 'flux_analysis' | 'receipts' | 'mei' | 'task_checklist' | 'performance' | 'bills_list' | 'bills_details' | 'reimbursement_list' | 'reimbursement_details' | 'vendors_summary' | 'opex_by_vendor' | 'prepaid_expenses' | 'fixed_assets' | 'form_1099' | 'accrued_expenses' | 'forecast' | 'checking' | 'checking_details' | 'treasury' | 'cards' | 'cards_detail' | 'people' | 'rewards' | 'notifications';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const toAnimationsFileName: (v: string) => "Success" | "AiAgent" | "AiIconEntry" | "AiIconExit" | "AiIconLoop" | "AiStar" | "AiStarIcon" | "AiStarPlain" | "AIPoweredInvoiceDark" | "AIPoweredInvoiceLight" | "Angry" | "AutoTransfer" | "CloseCard" | "Confetti" | "ConfettiSuccess" | "DashboardChristmasSnow" | "DashboardNewYearShow" | "DashboardSidebarBottomChristmas" | "DashboardSidebarBottomHalloween" | "DashboardSidebarBottomNewYear" | "DashboardSidebarBottomThanksgiving" | "DashboardSidebarTopChristmas" | "DashboardSidebarTopHalloween" | "DashboardSidebarTopNewYear" | "DashboardSidebarTopThanksgiving" | "Distribution" | "DistributionDark" | "EarnYield" | "FastestWayDark" | "FastestWayLight" | "FinanceTeamDark" | "FinanceTeamLight" | "Happy" | "Liquidity" | "LockCard" | "MoneyTransferSuccess" | "MultiLevelApprovalDark" | "MultiLevelApprovalLight" | "NotHappy" | "Protection" | "ReceiptDark" | "ReceiptLight" | "Recurring" | "RecurringDark" | "ReimburseDark" | "ReimburseLight" | "RewardsDark" | "RewardsDarkHover" | "RewardsLight" | "RewardsLightHover" | "Ripple" | "Secure" | "Target" | "TargetDark" | "UnlockCard" | "VeryHappy" | "ZeniAssist";
|
|
1
|
+
export declare const toAnimationsFileName: (v: string) => "Success" | "AiAgent" | "AiIconEntry" | "AiIconExit" | "AiIconLoop" | "AiStar" | "AiStarIcon" | "AiStarPlain" | "AIPoweredInvoiceDark" | "AIPoweredInvoiceLight" | "Angry" | "AutoTransfer" | "CloseCard" | "Confetti" | "ConfettiSuccess" | "DashboardChristmasSnow" | "DashboardNewYearShow" | "DashboardSidebarBottomChristmas" | "DashboardSidebarBottomHalloween" | "DashboardSidebarBottomNewYear" | "DashboardSidebarBottomThanksgiving" | "DashboardSidebarTopChristmas" | "DashboardSidebarTopHalloween" | "DashboardSidebarTopNewYear" | "DashboardSidebarTopThanksgiving" | "Distribution" | "DistributionDark" | "EarnYield" | "FastestWayDark" | "FastestWayLight" | "FinanceTeamDark" | "FinanceTeamLight" | "Happy" | "Liquidity" | "LockCard" | "MoneyTransferSuccess" | "MultiLevelApprovalDark" | "MultiLevelApprovalLight" | "NotHappy" | "Protection" | "ReceiptDark" | "ReceiptLight" | "Recurring" | "RecurringDark" | "ReimburseDark" | "ReimburseLight" | "RewardsDark" | "RewardsDarkHover" | "RewardsLight" | "RewardsLightHover" | "Ripple" | "Secure" | "Target" | "TargetDark" | "UnlockCard" | "VeryHappy" | "Welcome" | "ZeniAssist";
|
|
2
2
|
export type AnimationFileName = ReturnType<typeof toAnimationsFileName>;
|
|
@@ -20,147 +20,8 @@ export interface ChartVisualizationPayload {
|
|
|
20
20
|
lines?: string[] | null;
|
|
21
21
|
y_format?: YFormatPayload;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Single AI-suggested card on the wire. The controller ships an array of
|
|
25
|
-
* these mixing vendor, department, and category entries. Entries with
|
|
26
|
-
* `is_suggested: true` seed step 1 (`review`) or the step-2 editable table
|
|
27
|
-
* (`create`); entries with `is_suggested: false` aren't pre-rendered as
|
|
28
|
-
* rows but are available in the step-2 Card dropdown (and, in `review`,
|
|
29
|
-
* the step-1 "Add something else" search).
|
|
30
|
-
*
|
|
31
|
-
* `owner_id` may be `null` (or empty string, defensively normalized by the
|
|
32
|
-
* reducer) when the AI hasn't picked an owner.
|
|
33
|
-
*/
|
|
34
|
-
export interface SuggestedCardPayload {
|
|
35
|
-
avg_spend: number;
|
|
36
|
-
card_name: string;
|
|
37
|
-
card_name_id: string;
|
|
38
|
-
card_type: 'vendor' | 'department' | 'category';
|
|
39
|
-
credit_limit: number;
|
|
40
|
-
is_suggested: boolean;
|
|
41
|
-
owner_id: string | null;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Wire payload for the AI Card Creation interactive form. Both `review`
|
|
45
|
-
* and `create` modes share an identical envelope — a flat
|
|
46
|
-
* `suggested_cards[]` (mix of suggested + not-suggested rows). The only
|
|
47
|
-
* thing that varies is `mode`, which the FE uses to pick the step UX:
|
|
48
|
-
*
|
|
49
|
-
* - `review` (2-step): user reviews / toggles the `is_suggested: true`
|
|
50
|
-
* rows in step 1, then configures one card per surviving row in step 2.
|
|
51
|
-
* - `create` (1-step): the FE seeds the step-2 editable table directly
|
|
52
|
-
* from the `is_suggested: true` rows; step 1 is skipped.
|
|
53
|
-
*
|
|
54
|
-
* In both modes the full `suggested_cards[]` universe (including
|
|
55
|
-
* `is_suggested: false`) feeds the step-2 Card-cell dropdown so the user
|
|
56
|
-
* can swap a row to any vendor / department / category of the same kind.
|
|
57
|
-
*
|
|
58
|
-
* Note: `card_options` (physical / virtual / subscription) is NOT part of
|
|
59
|
-
* the wire. The FE injects a single `virtual` option via
|
|
60
|
-
* `AI_CARD_CREATION_VIRTUAL_ONLY_CARD_OPTIONS`; the reducer defaults each
|
|
61
|
-
* seeded row's `cardOptionId` to `'virtual'`.
|
|
62
|
-
*/
|
|
63
|
-
export interface CardsCreationInitialDataPayload {
|
|
64
|
-
mode: 'review' | 'create';
|
|
65
|
-
suggested_cards: SuggestedCardPayload[];
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Per-policy allow / block bucket on the wire. The two arrays are
|
|
69
|
-
* independent (a draft policy may populate both, only one, or neither).
|
|
70
|
-
*/
|
|
71
|
-
export interface DraftPolicyEntityPayload {
|
|
72
|
-
category_codes: string[];
|
|
73
|
-
merchant_names: string[];
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Spend-limit bucket per policy. `transaction` is the only cadence the
|
|
77
|
-
* BE ships today; left open-ended for future cadences (e.g.
|
|
78
|
-
* `monthly`, `quarterly`).
|
|
79
|
-
*/
|
|
80
|
-
export interface DraftPolicySpendLimitsPayload {
|
|
81
|
-
transaction: number;
|
|
82
|
-
[cadence: string]: number | undefined;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Single draft policy on the wire. The controller emits one of these
|
|
86
|
-
* per recommended policy in `step_5_review.draft_policies`. Identity is
|
|
87
|
-
* positional (no stable `id` from the BE); the FE synthesizes one on
|
|
88
|
-
* decode.
|
|
89
|
-
*/
|
|
90
|
-
export interface DraftPolicyPayload {
|
|
91
|
-
allowed_entity: DraftPolicyEntityPayload;
|
|
92
|
-
apply_to_cards: string[];
|
|
93
|
-
blocked_entity: DraftPolicyEntityPayload;
|
|
94
|
-
description: string;
|
|
95
|
-
/** Enforcement mode for the policy (e.g. `"strict"`). Carried into
|
|
96
|
-
* state for guided submit; ignored for `auto` / `upload`. */
|
|
97
|
-
mode: string;
|
|
98
|
-
name: string;
|
|
99
|
-
required_receipt_threshold: number;
|
|
100
|
-
spend_limits: DraftPolicySpendLimitsPayload;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* `step_5_review` block — the only step in `wizard_plan` the FE reads.
|
|
104
|
-
* Steps 1–4 are intentionally not modeled.
|
|
105
|
-
*/
|
|
106
|
-
export interface CardPolicyStep5ReviewPayload {
|
|
107
|
-
draft_policies: DraftPolicyPayload[];
|
|
108
|
-
/** Header text shown above the review list / wizard. */
|
|
109
|
-
prompt: string;
|
|
110
|
-
/** How the BE grouped the suggested policies. `"none"` today; may
|
|
111
|
-
* surface as a header banner in a future iteration. */
|
|
112
|
-
grouping_source?: string;
|
|
113
|
-
}
|
|
114
|
-
export interface CardPolicyWizardPlanPayload {
|
|
115
|
-
step_5_review: CardPolicyStep5ReviewPayload;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Upload-mode metadata that the `policy-recommendation-from-upload` API
|
|
119
|
-
* returns alongside the wizard plan. Absent on the initial controller
|
|
120
|
-
* response; populated after the file upload + recommendation chain.
|
|
121
|
-
*/
|
|
122
|
-
export interface CardPolicyUploadSourcePayload {
|
|
123
|
-
confidence_score: number;
|
|
124
|
-
file_name: string;
|
|
125
|
-
low_confidence_fields: string[];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Discriminated payload for the AI Card Policy interactive form.
|
|
129
|
-
* All three modes share the same `wizard_plan.step_5_review.draft_policies`
|
|
130
|
-
* envelope; the FE renders different forms based on `mode`.
|
|
131
|
-
*
|
|
132
|
-
* - `auto` (1-step review): user reviews suggested policies and submits.
|
|
133
|
-
* - `guided` (5-step wizard): Steps 1–4 seeded from `draft_policies[0]`,
|
|
134
|
-
* Step 5 lists every draft policy.
|
|
135
|
-
* - `upload` (3-step): upload doc → pick cards → review. Controller
|
|
136
|
-
* responses for `mode === "upload"` arrive *before* the user uploads,
|
|
137
|
-
* so `wizard_plan` is optional; populated after the upload-recommendation
|
|
138
|
-
* API returns.
|
|
139
|
-
*/
|
|
140
|
-
export type CardPolicyInitialDataPayload = {
|
|
141
|
-
mode: 'auto';
|
|
142
|
-
wizard_plan: CardPolicyWizardPlanPayload;
|
|
143
|
-
} | {
|
|
144
|
-
mode: 'guided';
|
|
145
|
-
wizard_plan: CardPolicyWizardPlanPayload;
|
|
146
|
-
} | {
|
|
147
|
-
mode: 'upload';
|
|
148
|
-
source?: CardPolicyUploadSourcePayload;
|
|
149
|
-
wizard_plan?: CardPolicyWizardPlanPayload;
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Discriminated visualization payload. The FE narrows on `form_type` and
|
|
153
|
-
* casts `payload` to the matching shape.
|
|
154
|
-
*/
|
|
155
|
-
export type InteractiveFormVisualizationPayload = {
|
|
156
|
-
form_type: 'cards_creation';
|
|
157
|
-
payload: CardsCreationInitialDataPayload;
|
|
158
|
-
} | {
|
|
159
|
-
form_type: 'card_policy';
|
|
160
|
-
payload: CardPolicyInitialDataPayload;
|
|
161
|
-
};
|
|
162
23
|
export interface AiCfoVisualizationPayload {
|
|
163
|
-
data: TableVisualizationPayload | ChartVisualizationPayload |
|
|
24
|
+
data: TableVisualizationPayload | ChartVisualizationPayload | null;
|
|
164
25
|
type: string | null;
|
|
165
26
|
}
|
|
166
27
|
export interface AiCfoAnswerPayload {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { ZeniDate } from '../../zeniDayJS';
|
|
3
3
|
import { AiCfoAnswerPayload, AiCfoVisualizationPayload, ChatSessionPayload, MessagePayload } from './aiCfoPayload';
|
|
4
|
-
import { AiCfoState, AiCfoVisualization, FileAttachmentMetadata
|
|
5
|
-
import type { CardPolicyUploadSource, CardPolicyWizardPlan } from './aiCfoState';
|
|
4
|
+
import { AiCfoState, AiCfoVisualization, FileAttachmentMetadata } from './aiCfoState';
|
|
6
5
|
export declare const initialAiCfoState: AiCfoState;
|
|
7
6
|
export declare const toAiCfoVisualization: (visualization: AiCfoVisualizationPayload) => AiCfoVisualization | undefined;
|
|
8
7
|
export declare const setNewSession: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -42,26 +41,6 @@ export declare const setNewSession: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
42
41
|
}, "aiCfo/addQuestionPayload">, clearAiCfo: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiCfo/clearAiCfo">, deleteQuestion: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
43
42
|
chatSessionId: ID;
|
|
44
43
|
questionAnswerId: ID;
|
|
45
|
-
}, "aiCfo/deleteQuestion"
|
|
46
|
-
answerId: ID;
|
|
47
|
-
chatSessionId: ID;
|
|
48
|
-
wizardPlan: CardPolicyWizardPlan;
|
|
49
|
-
source?: CardPolicyUploadSource;
|
|
50
|
-
}, "aiCfo/updateAiCfoAnswerCardPolicyWizardPlan">, appendSyntheticAiCfoAnswer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
51
|
-
chatSessionId: ID;
|
|
52
|
-
createdAt: ZeniDate;
|
|
53
|
-
id: ID;
|
|
54
|
-
kind: SyntheticAiCfoAnswerKind;
|
|
55
|
-
sourceQuestionAnswerId: ID;
|
|
56
|
-
entityIds?: ID[];
|
|
57
|
-
}, "aiCfo/appendSyntheticAiCfoAnswer">, updateSyntheticAiCfoAnswer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
58
|
-
chatSessionId: ID;
|
|
59
|
-
id: ID;
|
|
60
|
-
kind: SyntheticAiCfoAnswerKind;
|
|
61
|
-
entityIds?: ID[];
|
|
62
|
-
}, "aiCfo/updateSyntheticAiCfoAnswer">, removeSyntheticAiCfoAnswer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
63
|
-
chatSessionId: ID;
|
|
64
|
-
id: ID;
|
|
65
|
-
}, "aiCfo/removeSyntheticAiCfoAnswer">, clearSyntheticAiCfoAnswers: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "aiCfo/clearSyntheticAiCfoAnswers">;
|
|
44
|
+
}, "aiCfo/deleteQuestion">;
|
|
66
45
|
declare const _default: import("redux").Reducer<AiCfoState>;
|
|
67
46
|
export default _default;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.deleteQuestion = exports.clearAiCfo = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setChatHistory = exports.setSessions = exports.clearSession = exports.setNewSession = exports.toAiCfoVisualization = exports.initialAiCfoState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
7
7
|
const aiCfoState_1 = require("./aiCfoState");
|
|
8
8
|
exports.initialAiCfoState = {
|
|
9
9
|
aiCfoByChatSessionId: {},
|
|
10
10
|
partialQuestionAnswers: {},
|
|
11
|
-
syntheticAnswersByChatSessionId: {},
|
|
12
11
|
};
|
|
13
12
|
// Utility: Merge two arrays of Q&A pairs, combining responses for the same question
|
|
14
13
|
function mergeQuestionAnswerPairs(existing, newQAs) {
|
|
@@ -140,219 +139,12 @@ const toAiCfoVisualization = (visualization) => {
|
|
|
140
139
|
if (visualization.type == null || visualization.data == null) {
|
|
141
140
|
return undefined;
|
|
142
141
|
}
|
|
143
|
-
// Reject unknown viz types instead of silently defaulting to `table`.
|
|
144
|
-
// The previous `?? 'table'` fallback funneled any non-strict-union
|
|
145
|
-
// payload into `toAiCfoVisualizationData`, which is the table/chart
|
|
146
|
-
// decoder and dereferences `data.values.map(...)`. Interactive-form
|
|
147
|
-
// payloads (e.g. when the BE ships `type: <new_form_kind>` we don't
|
|
148
|
-
// know about yet) carry no `values`, so that path threw during answer
|
|
149
|
-
// upsert and broke rendering for the whole Q/A. Returning `undefined`
|
|
150
|
-
// matches the existing "missing type / data" guard above — callers
|
|
151
|
-
// already handle a no-visualization answer.
|
|
152
|
-
const normalizedType = (0, aiCfoState_1.toAiCfoVisualizationTypeStrict)(visualization.type);
|
|
153
|
-
if (normalizedType == null) {
|
|
154
|
-
return undefined;
|
|
155
|
-
}
|
|
156
142
|
return {
|
|
157
|
-
type:
|
|
158
|
-
data:
|
|
159
|
-
? toInteractiveFormVisualization(visualization.data)
|
|
160
|
-
: toAiCfoVisualizationData(visualization.data),
|
|
143
|
+
type: (0, aiCfoState_1.toAiCfoVisualizationTypeStrict)(visualization.type) ?? 'table',
|
|
144
|
+
data: toAiCfoVisualizationData(visualization.data),
|
|
161
145
|
};
|
|
162
146
|
};
|
|
163
147
|
exports.toAiCfoVisualization = toAiCfoVisualization;
|
|
164
|
-
const toInteractiveFormVisualization = (data) => {
|
|
165
|
-
// When `form_type` is missing / mistyped, fall back to a payload-shape
|
|
166
|
-
// heuristic instead of blindly defaulting to `cards_creation`. A
|
|
167
|
-
// `card_policy` payload always carries `mode: 'auto' | 'guided' |
|
|
168
|
-
// 'upload'` (see `CardPolicyInitialDataPayload`); a `cards_creation`
|
|
169
|
-
// payload carries `suggested_cards` and never that exact `mode` set.
|
|
170
|
-
// Without this, a card-policy answer with a malformed `form_type`
|
|
171
|
-
// would be decoded as cards_creation, surfacing the wrong interactive
|
|
172
|
-
// form (and wrong submit path) in the UI.
|
|
173
|
-
const formType = (0, aiCfoState_1.toInteractiveFormTypeStrict)(data.form_type) ??
|
|
174
|
-
inferInteractiveFormTypeFromPayload(data.payload);
|
|
175
|
-
if (formType === 'card_policy') {
|
|
176
|
-
return {
|
|
177
|
-
formType: 'card_policy',
|
|
178
|
-
payload: toCardPolicyInitialData(data.payload),
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
formType: 'cards_creation',
|
|
183
|
-
payload: toCardsCreationInitialData(data.payload),
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
const inferInteractiveFormTypeFromPayload = (payload) => {
|
|
187
|
-
if (payload != null && typeof payload === 'object' && 'mode' in payload) {
|
|
188
|
-
const mode = payload.mode;
|
|
189
|
-
if (mode === 'auto' || mode === 'guided' || mode === 'upload') {
|
|
190
|
-
return 'card_policy';
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return 'cards_creation';
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* Decode the unified `cards_creation` interactive-form payload into the FE
|
|
197
|
-
* state shape. Both `review` and `create` modes ship the same envelope
|
|
198
|
-
* (`{mode, suggested_cards[]}`); the only thing that varies is how the
|
|
199
|
-
* common derivations are exposed:
|
|
200
|
-
*
|
|
201
|
-
* - `review` (2-step): `is_suggested: true` rows -> `teamRows`; the full
|
|
202
|
-
* universe -> `cardNameOptions` (step-2 swap + step-1 "Add something
|
|
203
|
-
* else" search).
|
|
204
|
-
* - `create` (1-step): `is_suggested: true` rows -> `cardRows` pre-seeded
|
|
205
|
-
* for the step-2 editable table (with `cardOptionId` defaulted to
|
|
206
|
-
* `'virtual'`); the full universe -> `cardNameOptions` (step-2 swap).
|
|
207
|
-
*
|
|
208
|
-
* `cardOptions` (physical / virtual / subscription) is intentionally not
|
|
209
|
-
* derived here — the wire never carries it. The component prop is fed
|
|
210
|
-
* from `AI_CARD_CREATION_VIRTUAL_ONLY_CARD_OPTIONS` at render time. The
|
|
211
|
-
* state field is preserved as `[]` for backward compatibility with
|
|
212
|
-
* consumers that still narrow on it.
|
|
213
|
-
*/
|
|
214
|
-
const toCardsCreationInitialData = (payload) => {
|
|
215
|
-
const suggestedCards = payload.suggested_cards ?? [];
|
|
216
|
-
const ordered = [...suggestedCards].sort((a, b) => KIND_RANK[a.card_type] - KIND_RANK[b.card_type]);
|
|
217
|
-
const withUniqueIds = withSynthesizedIds(ordered);
|
|
218
|
-
const suggestedOnly = withUniqueIds.filter(({ card }) => card.is_suggested);
|
|
219
|
-
const cardNameOptions = withUniqueIds.map(({ card, uniqueId }) => ({
|
|
220
|
-
id: uniqueId,
|
|
221
|
-
kind: toCardKind(card.card_type),
|
|
222
|
-
label: card.card_name,
|
|
223
|
-
}));
|
|
224
|
-
const suggestedOwnerUserIdByTeamId = Object.fromEntries(suggestedOnly.map(({ card, uniqueId }) => [
|
|
225
|
-
uniqueId,
|
|
226
|
-
normalizeOwnerId(card.owner_id),
|
|
227
|
-
]));
|
|
228
|
-
const common = {
|
|
229
|
-
cardNameOptions,
|
|
230
|
-
cardOptions: [],
|
|
231
|
-
suggestedOwnerUserIdByTeamId,
|
|
232
|
-
};
|
|
233
|
-
if (payload.mode === 'create') {
|
|
234
|
-
return {
|
|
235
|
-
...common,
|
|
236
|
-
mode: 'create',
|
|
237
|
-
cardRows: suggestedOnly.map(({ card, uniqueId }) => ({
|
|
238
|
-
cardKind: toCardKind(card.card_type),
|
|
239
|
-
cardOptionId: aiCfoState_1.CARDS_CREATION_DEFAULT_CARD_OPTION_ID,
|
|
240
|
-
id: uniqueId,
|
|
241
|
-
label: card.card_name,
|
|
242
|
-
recommendedLimit: card.credit_limit > 0 ? card.credit_limit : undefined,
|
|
243
|
-
suggestedOwnerUserId: normalizeOwnerId(card.owner_id),
|
|
244
|
-
})),
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
return {
|
|
248
|
-
...common,
|
|
249
|
-
mode: 'review',
|
|
250
|
-
teamRows: suggestedOnly.map(({ card, uniqueId }) => ({
|
|
251
|
-
avgMonthlySpend: CURRENCY_FORMATTER.format(card.avg_spend),
|
|
252
|
-
cardKind: toCardKind(card.card_type),
|
|
253
|
-
id: uniqueId,
|
|
254
|
-
label: card.card_name,
|
|
255
|
-
recommendedLimit: CURRENCY_FORMATTER.format(card.credit_limit),
|
|
256
|
-
recommendedLimitCadence: 'Monthly',
|
|
257
|
-
})),
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
const CURRENCY_FORMATTER = new Intl.NumberFormat('en-US', {
|
|
261
|
-
style: 'currency',
|
|
262
|
-
currency: 'USD',
|
|
263
|
-
maximumFractionDigits: 0,
|
|
264
|
-
});
|
|
265
|
-
/**
|
|
266
|
-
* Normalize the controller's `owner_id` into `string | undefined`. The
|
|
267
|
-
* BE may emit either `null` or `""` to signal "no owner picked"; both
|
|
268
|
-
* collapse to `undefined` so downstream resolvers don't try to look up
|
|
269
|
-
* a user with an empty id.
|
|
270
|
-
*/
|
|
271
|
-
const normalizeOwnerId = (ownerId) => ownerId != null && ownerId !== '' ? ownerId : undefined;
|
|
272
|
-
const KIND_RANK = {
|
|
273
|
-
vendor: 0,
|
|
274
|
-
category: 1,
|
|
275
|
-
department: 2,
|
|
276
|
-
};
|
|
277
|
-
const toCardKind = (cardType) => {
|
|
278
|
-
if (cardType === 'department') {
|
|
279
|
-
return 'class';
|
|
280
|
-
}
|
|
281
|
-
if (cardType === 'category') {
|
|
282
|
-
return 'category';
|
|
283
|
-
}
|
|
284
|
-
return 'vendor';
|
|
285
|
-
};
|
|
286
|
-
/**
|
|
287
|
-
* Stamp each suggested card with a stable unique id derived from its
|
|
288
|
-
* `card_name_id`. If two cards in the same payload share the same
|
|
289
|
-
* `card_name_id` (which happens in the current sample payload where
|
|
290
|
-
* `card_name_id` is the literal `"vendor_uuid"`), fall back to a
|
|
291
|
-
* synthesized id `${kind}__${card_name_id}__${index}` so RHF row keying
|
|
292
|
-
* stays unique.
|
|
293
|
-
*/
|
|
294
|
-
const withSynthesizedIds = (cards) => {
|
|
295
|
-
const seen = new Set();
|
|
296
|
-
return cards.map((card, index) => {
|
|
297
|
-
const preferred = card.card_name_id;
|
|
298
|
-
if (preferred != null && preferred !== '' && !seen.has(preferred)) {
|
|
299
|
-
seen.add(preferred);
|
|
300
|
-
return { card, uniqueId: preferred };
|
|
301
|
-
}
|
|
302
|
-
const synthesized = `${card.card_type}__${preferred ?? 'unknown'}__${index}`;
|
|
303
|
-
seen.add(synthesized);
|
|
304
|
-
return { card, uniqueId: synthesized };
|
|
305
|
-
});
|
|
306
|
-
};
|
|
307
|
-
const toCardPolicyDraftPolicy = (payload, index) => ({
|
|
308
|
-
id: `draft-${index}`,
|
|
309
|
-
name: payload.name,
|
|
310
|
-
description: payload.description ?? '',
|
|
311
|
-
mode: payload.mode,
|
|
312
|
-
allowedEntity: {
|
|
313
|
-
categoryCodes: payload.allowed_entity?.category_codes ?? [],
|
|
314
|
-
merchantNames: payload.allowed_entity?.merchant_names ?? [],
|
|
315
|
-
},
|
|
316
|
-
blockedEntity: {
|
|
317
|
-
categoryCodes: payload.blocked_entity?.category_codes ?? [],
|
|
318
|
-
merchantNames: payload.blocked_entity?.merchant_names ?? [],
|
|
319
|
-
},
|
|
320
|
-
applyToCards: payload.apply_to_cards ?? [],
|
|
321
|
-
requiredReceiptThreshold: payload.required_receipt_threshold ?? 0,
|
|
322
|
-
spendLimits: {
|
|
323
|
-
transaction: payload.spend_limits?.transaction ?? 0,
|
|
324
|
-
},
|
|
325
|
-
});
|
|
326
|
-
const toCardPolicyStep5Review = (payload) => ({
|
|
327
|
-
draftPolicies: (payload.draft_policies ?? []).map(toCardPolicyDraftPolicy),
|
|
328
|
-
groupingSource: payload.grouping_source ?? 'none',
|
|
329
|
-
prompt: payload.prompt ?? '',
|
|
330
|
-
});
|
|
331
|
-
const toCardPolicyWizardPlan = (payload) => ({
|
|
332
|
-
step5Review: toCardPolicyStep5Review(payload.step_5_review),
|
|
333
|
-
});
|
|
334
|
-
const toCardPolicyUploadSource = (payload) => ({
|
|
335
|
-
confidenceScore: payload.confidence_score,
|
|
336
|
-
fileName: payload.file_name,
|
|
337
|
-
lowConfidenceFields: payload.low_confidence_fields ?? [],
|
|
338
|
-
});
|
|
339
|
-
const toCardPolicyInitialData = (payload) => {
|
|
340
|
-
if (payload.mode === 'upload') {
|
|
341
|
-
return {
|
|
342
|
-
policyKind: 'upload',
|
|
343
|
-
wizardPlan: payload.wizard_plan != null
|
|
344
|
-
? toCardPolicyWizardPlan(payload.wizard_plan)
|
|
345
|
-
: undefined,
|
|
346
|
-
source: payload.source != null
|
|
347
|
-
? toCardPolicyUploadSource(payload.source)
|
|
348
|
-
: undefined,
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
return {
|
|
352
|
-
policyKind: payload.mode,
|
|
353
|
-
wizardPlan: toCardPolicyWizardPlan(payload.wizard_plan),
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
148
|
const toAiCfoVisualizationData = (data) => {
|
|
357
149
|
if ('x' in data && 'y' in data) {
|
|
358
150
|
// Normalize y to always be an array
|
|
@@ -666,119 +458,9 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
666
458
|
session.questionAnswers.push(qa);
|
|
667
459
|
}
|
|
668
460
|
},
|
|
669
|
-
/**
|
|
670
|
-
* Patch the `card_policy` interactive-form payload for a specific
|
|
671
|
-
* answer in a chat session to merge in the wizard plan + upload
|
|
672
|
-
* source metadata returned by
|
|
673
|
-
* `POST /cards/1.0/ai-cfo/policy-recommendation-from-upload`.
|
|
674
|
-
*
|
|
675
|
-
* Dispatched by the recommendation epic after a successful response;
|
|
676
|
-
* the wizard re-renders Steps 2 + 3 of the upload variant once the
|
|
677
|
-
* payload becomes a populated `CardPolicyInitialData` with
|
|
678
|
-
* `policyKind: "upload"` + `wizardPlan` + `source`.
|
|
679
|
-
*
|
|
680
|
-
* No-op when the target answer / chat session / form payload is
|
|
681
|
-
* missing or isn't an upload-mode card-policy interactive form —
|
|
682
|
-
* the bridge epic is best-effort and silently drops in edge cases
|
|
683
|
-
* (e.g. the user closed the chat before recommendation returned).
|
|
684
|
-
*/
|
|
685
|
-
updateAiCfoAnswerCardPolicyWizardPlan(draft, action) {
|
|
686
|
-
const { answerId, chatSessionId, source, wizardPlan } = action.payload;
|
|
687
|
-
const session = draft.aiCfoByChatSessionId[chatSessionId];
|
|
688
|
-
if (session == null) {
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
const qa = session.questionAnswers.find((entry) => entry.questionAnswerId === answerId);
|
|
692
|
-
if (qa == null) {
|
|
693
|
-
return;
|
|
694
|
-
}
|
|
695
|
-
for (const response of Object.values(qa.responses)) {
|
|
696
|
-
const visualization = response?.content.visualization;
|
|
697
|
-
if (visualization == null ||
|
|
698
|
-
visualization.type !== 'interactive_form') {
|
|
699
|
-
continue;
|
|
700
|
-
}
|
|
701
|
-
const data = visualization.data;
|
|
702
|
-
if (data.formType !== 'card_policy' ||
|
|
703
|
-
data.payload.policyKind !== 'upload') {
|
|
704
|
-
continue;
|
|
705
|
-
}
|
|
706
|
-
data.payload = {
|
|
707
|
-
...data.payload,
|
|
708
|
-
wizardPlan,
|
|
709
|
-
source: source ?? data.payload.source,
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
},
|
|
713
|
-
/**
|
|
714
|
-
* Append a client-synthesized answer bubble to a chat session. Used by
|
|
715
|
-
* the AI CFO cards/policy create flow to render a "Creating…" placeholder
|
|
716
|
-
* in the drawer while the underlying mutation runs.
|
|
717
|
-
*
|
|
718
|
-
* The caller is responsible for generating a stable `id` (so the same
|
|
719
|
-
* bubble can later be updated in place via `updateSyntheticAiCfoAnswer`
|
|
720
|
-
* once the mutation completes) and a `createdAt` timestamp so the
|
|
721
|
-
* renderer can interleave synthetic bubbles with streamed Q&A pairs in
|
|
722
|
-
* chronological order.
|
|
723
|
-
*/
|
|
724
|
-
appendSyntheticAiCfoAnswer(draft, action) {
|
|
725
|
-
const { chatSessionId, id, kind, createdAt, entityIds, sourceQuestionAnswerId, } = action.payload;
|
|
726
|
-
if (draft.syntheticAnswersByChatSessionId[chatSessionId] == null) {
|
|
727
|
-
draft.syntheticAnswersByChatSessionId[chatSessionId] = [];
|
|
728
|
-
}
|
|
729
|
-
draft.syntheticAnswersByChatSessionId[chatSessionId].push({
|
|
730
|
-
id,
|
|
731
|
-
kind,
|
|
732
|
-
entityIds: entityIds ?? [],
|
|
733
|
-
createdAt,
|
|
734
|
-
sourceQuestionAnswerId,
|
|
735
|
-
});
|
|
736
|
-
},
|
|
737
|
-
/**
|
|
738
|
-
* Update an existing synthetic answer bubble in place. Typically called
|
|
739
|
-
* when the create mutation completes: the screen transitions the bubble
|
|
740
|
-
* from `creating_*` to `created_*` and populates `entityIds` with the
|
|
741
|
-
* newly created cards / policy templates.
|
|
742
|
-
*
|
|
743
|
-
* No-op when the target bubble is missing (e.g. the session was cleared
|
|
744
|
-
* before the mutation returned).
|
|
745
|
-
*/
|
|
746
|
-
updateSyntheticAiCfoAnswer(draft, action) {
|
|
747
|
-
const { chatSessionId, id, kind, entityIds } = action.payload;
|
|
748
|
-
const list = draft.syntheticAnswersByChatSessionId[chatSessionId];
|
|
749
|
-
if (list == null) {
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
const entry = list.find((item) => item.id === id);
|
|
753
|
-
if (entry == null) {
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
entry.kind = kind;
|
|
757
|
-
if (entityIds != null) {
|
|
758
|
-
entry.entityIds = entityIds;
|
|
759
|
-
}
|
|
760
|
-
},
|
|
761
|
-
/**
|
|
762
|
-
* Remove a single synthetic answer bubble (e.g. when the user manually
|
|
763
|
-
* dismisses it or the mutation errors out and we want to fall back to
|
|
764
|
-
* an inline error snackbar).
|
|
765
|
-
*/
|
|
766
|
-
removeSyntheticAiCfoAnswer(draft, action) {
|
|
767
|
-
const { chatSessionId, id } = action.payload;
|
|
768
|
-
const list = draft.syntheticAnswersByChatSessionId[chatSessionId];
|
|
769
|
-
if (list == null) {
|
|
770
|
-
return;
|
|
771
|
-
}
|
|
772
|
-
draft.syntheticAnswersByChatSessionId[chatSessionId] = list.filter((item) => item.id !== id);
|
|
773
|
-
},
|
|
774
|
-
/** Clear every synthetic bubble for a session. */
|
|
775
|
-
clearSyntheticAiCfoAnswers(draft, action) {
|
|
776
|
-
delete draft.syntheticAnswersByChatSessionId[action.payload];
|
|
777
|
-
},
|
|
778
461
|
clearSession(draft, action) {
|
|
779
462
|
const sessionId = action.payload;
|
|
780
463
|
delete draft.aiCfoByChatSessionId[sessionId];
|
|
781
|
-
delete draft.syntheticAnswersByChatSessionId[sessionId];
|
|
782
464
|
// Clear partial Q&A if it belongs to the cleared session
|
|
783
465
|
if (draft.partialQuestionAnswers?.[sessionId] != null) {
|
|
784
466
|
draft.partialQuestionAnswers[sessionId] = undefined;
|
|
@@ -787,7 +469,6 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
787
469
|
clearAiCfo(draft) {
|
|
788
470
|
draft.aiCfoByChatSessionId = {};
|
|
789
471
|
draft.partialQuestionAnswers = {};
|
|
790
|
-
draft.syntheticAnswersByChatSessionId = {};
|
|
791
472
|
},
|
|
792
473
|
deleteQuestion(draft, action) {
|
|
793
474
|
const { chatSessionId, questionAnswerId } = action.payload;
|
|
@@ -800,15 +481,6 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
800
481
|
if (idx !== -1) {
|
|
801
482
|
session.questionAnswers.splice(idx, 1);
|
|
802
483
|
}
|
|
803
|
-
// Also drop any synthetic bubbles whose `sourceQuestionAnswerId`
|
|
804
|
-
// referenced the just-deleted Q/A. Without this, the chat would
|
|
805
|
-
// keep rendering "Creating…" / "Created" tiles tied to a Q/A that
|
|
806
|
-
// no longer exists (via `getSyntheticAiCfoAnswerByQuestionAnswerId`).
|
|
807
|
-
const syntheticAnswers = draft.syntheticAnswersByChatSessionId[chatSessionId];
|
|
808
|
-
if (syntheticAnswers != null) {
|
|
809
|
-
draft.syntheticAnswersByChatSessionId[chatSessionId] =
|
|
810
|
-
syntheticAnswers.filter((answer) => answer.sourceQuestionAnswerId !== questionAnswerId);
|
|
811
|
-
}
|
|
812
484
|
},
|
|
813
485
|
},
|
|
814
486
|
});
|
|
@@ -821,5 +493,5 @@ const toChatSession = (chatSessionPayload) => {
|
|
|
821
493
|
createdAt: (0, zeniDayJS_1.date)(created_at),
|
|
822
494
|
};
|
|
823
495
|
};
|
|
824
|
-
_a = aiCfo.actions, exports.setNewSession = _a.setNewSession, exports.clearSession = _a.clearSession, exports.setSessions = _a.setSessions, exports.setChatHistory = _a.setChatHistory, exports.upsertAnswerPayload = _a.upsertAnswerPayload, exports.upsertOrAddQuestionAnswerPayload = _a.upsertOrAddQuestionAnswerPayload, exports.addQuestionPayload = _a.addQuestionPayload, exports.clearAiCfo = _a.clearAiCfo, exports.deleteQuestion = _a.deleteQuestion
|
|
496
|
+
_a = aiCfo.actions, exports.setNewSession = _a.setNewSession, exports.clearSession = _a.clearSession, exports.setSessions = _a.setSessions, exports.setChatHistory = _a.setChatHistory, exports.upsertAnswerPayload = _a.upsertAnswerPayload, exports.upsertOrAddQuestionAnswerPayload = _a.upsertOrAddQuestionAnswerPayload, exports.addQuestionPayload = _a.addQuestionPayload, exports.clearAiCfo = _a.clearAiCfo, exports.deleteQuestion = _a.deleteQuestion;
|
|
825
497
|
exports.default = aiCfo.reducer;
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { AiCfoQuestionWithAnswer, AiCfoState, ChatSession
|
|
2
|
+
import { AiCfoQuestionWithAnswer, AiCfoState, ChatSession } from './aiCfoState';
|
|
3
3
|
export declare function getAllQuestionAnswersForChatSession(state: AiCfoState, chatSessionId: ID): AiCfoQuestionWithAnswer[];
|
|
4
4
|
export declare function getQuestionAnswerByIdForChatSession(state: AiCfoState, chatSessionId: ID, questionAnswerId: ID): AiCfoQuestionWithAnswer | undefined;
|
|
5
5
|
export declare function getAllQuestionsForChatSession(state: AiCfoState, chatSessionId: ID): string[];
|
|
6
6
|
export interface AiCfoSelectorView {
|
|
7
7
|
allSessionsWithOrderedQuestionAnswers: ChatSessionWithOrderedQuestionAnswers[];
|
|
8
|
-
syntheticAnswersByChatSessionId: Record<ID, SyntheticAiCfoAnswer[]>;
|
|
9
8
|
}
|
|
10
9
|
export interface ChatSessionWithOrderedQuestionAnswers {
|
|
11
10
|
chatSession: ChatSession;
|
|
12
11
|
questionAnswers: AiCfoQuestionWithAnswer[];
|
|
13
12
|
}
|
|
14
13
|
export declare function getAiCfoSelectorView(state: AiCfoState): AiCfoSelectorView;
|
|
15
|
-
export declare function getSyntheticAiCfoAnswersForChatSession(state: AiCfoState, chatSessionId: ID): SyntheticAiCfoAnswer[];
|
|
16
|
-
/**
|
|
17
|
-
* Look up the synthetic answer bubble (if any) whose source AI CFO Q/A
|
|
18
|
-
* is `questionAnswerId`. Used by the in-place renderer to swap a Q/A's
|
|
19
|
-
* answer bubble with the "Creating…" / "Created" tile.
|
|
20
|
-
*
|
|
21
|
-
* Returns `undefined` when no synthetic bubble has been dispatched for
|
|
22
|
-
* the answer yet (i.e. the user hasn't submitted the interactive form),
|
|
23
|
-
* or when the chat session has no synthetic entries at all.
|
|
24
|
-
*/
|
|
25
|
-
export declare function getSyntheticAiCfoAnswerByQuestionAnswerId(state: AiCfoState, chatSessionId: ID, questionAnswerId: ID): SyntheticAiCfoAnswer | undefined;
|