@zeniai/client-epic-state 5.0.65-betaRR7 → 5.0.66-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/cacheOverrideFetchReducer.d.ts +17 -0
- package/lib/commonStateTypes/cacheOverrideFetchReducer.js +20 -0
- package/lib/commonStateTypes/pusherActions.d.ts +11 -0
- package/lib/commonStateTypes/pusherActions.js +6 -0
- package/lib/entity/aiCfo/aiCfoPayload.d.ts +1 -171
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +1 -7
- package/lib/entity/aiCfo/aiCfoReducer.js +4 -219
- package/lib/entity/aiCfo/aiCfoState.d.ts +4 -163
- package/lib/entity/aiCfo/aiCfoState.js +1 -10
- package/lib/entity/chargeCard/chargeCardReducer.d.ts +19 -2
- package/lib/entity/chargeCard/chargeCardReducer.js +35 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +14 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +36 -2
- 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 +0 -2
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -6
- package/lib/entity/tenant/clearAllEpic.js +0 -8
- package/lib/epic.d.ts +1 -11
- package/lib/epic.js +1 -11
- package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +16 -0
- package/lib/esm/commonStateTypes/pusherActions.js +3 -0
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +4 -219
- package/lib/esm/entity/aiCfo/aiCfoState.js +0 -7
- package/lib/esm/entity/chargeCard/chargeCardReducer.js +34 -1
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +35 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -8
- package/lib/esm/epic.js +1 -11
- package/lib/esm/index.js +8 -20
- 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/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +28 -9
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -25
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/index.d.ts +9 -19
- package/lib/index.js +22 -112
- 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/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.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/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +18 -3
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +29 -10
- 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/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
- package/package.json +8 -3
- 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 -256
- 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 -54
- 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 -92
- package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +0 -130
- package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +0 -252
- 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 -50
- 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 -88
- 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 -59
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -31
- 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 -63
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +0 -26
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -37
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +0 -36
- 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';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PayloadAction, Draft } from '@reduxjs/toolkit';
|
|
2
|
+
/**
|
|
3
|
+
* Factory for `fetchXxx` reducers that support Pusher-driven silent refresh.
|
|
4
|
+
* When `cacheOverride=true`, fetchState and error are left untouched so the
|
|
5
|
+
* UI doesn't flash a skeleton. When `false`, `applyTo` runs the normal
|
|
6
|
+
* 'In-Progress' transition.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createCacheOverrideFetchReducer: <TState>(applyTo: (draft: Draft<TState>) => void) => {
|
|
9
|
+
prepare: (cacheOverride?: boolean) => {
|
|
10
|
+
payload: {
|
|
11
|
+
cacheOverride: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
reducer: (draft: Draft<TState>, action: PayloadAction<{
|
|
15
|
+
cacheOverride: boolean;
|
|
16
|
+
}>) => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCacheOverrideFetchReducer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Factory for `fetchXxx` reducers that support Pusher-driven silent refresh.
|
|
6
|
+
* When `cacheOverride=true`, fetchState and error are left untouched so the
|
|
7
|
+
* UI doesn't flash a skeleton. When `false`, `applyTo` runs the normal
|
|
8
|
+
* 'In-Progress' transition.
|
|
9
|
+
*/
|
|
10
|
+
const createCacheOverrideFetchReducer = (applyTo) => ({
|
|
11
|
+
reducer(draft, action) {
|
|
12
|
+
if (action.payload.cacheOverride !== true) {
|
|
13
|
+
applyTo(draft);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
prepare(cacheOverride = false) {
|
|
17
|
+
return { payload: { cacheOverride } };
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
exports.createCacheOverrideFetchReducer = createCacheOverrideFetchReducer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ID } from './common';
|
|
2
|
+
import { ChargeCardTransactionPayload } from '../entity/chargeCardTransaction/chargeCardTransactionPayload';
|
|
3
|
+
export declare const addChargeCardTransactionFromPusher: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
4
|
+
cardId: ID;
|
|
5
|
+
transaction: ChargeCardTransactionPayload;
|
|
6
|
+
}, string>;
|
|
7
|
+
export declare const addDeclinedChargeCardTransactionFromPusher: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
8
|
+
cardId: ID;
|
|
9
|
+
transaction: ChargeCardTransactionPayload;
|
|
10
|
+
declineReason?: string;
|
|
11
|
+
}, string>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDeclinedChargeCardTransactionFromPusher = exports.addChargeCardTransactionFromPusher = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
exports.addChargeCardTransactionFromPusher = (0, toolkit_1.createAction)('chargeCardDetail/addChargeCardTransactionFromPusher');
|
|
6
|
+
exports.addDeclinedChargeCardTransactionFromPusher = (0, toolkit_1.createAction)('chargeCardDetail/addDeclinedChargeCardTransactionFromPusher');
|
|
@@ -20,178 +20,8 @@ export interface ChartVisualizationPayload {
|
|
|
20
20
|
lines?: string[] | null;
|
|
21
21
|
y_format?: YFormatPayload;
|
|
22
22
|
}
|
|
23
|
-
export interface CardsCardOptionPayload {
|
|
24
|
-
id: string;
|
|
25
|
-
label: string;
|
|
26
|
-
description?: string | null;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Single AI-suggested card on the wire. The controller ships an array of
|
|
30
|
-
* these mixing vendor and department entries; entries with
|
|
31
|
-
* `is_suggested: true` seed step 1 of the form pre-checked, while entries
|
|
32
|
-
* with `is_suggested: false` are available in the step-2 Card dropdown and
|
|
33
|
-
* step-1 search but don't appear as initial rows.
|
|
34
|
-
*/
|
|
35
|
-
export interface SuggestedCardPayload {
|
|
36
|
-
avg_spend: number;
|
|
37
|
-
card_name: string;
|
|
38
|
-
card_name_id: string;
|
|
39
|
-
card_type: 'vendor' | 'department';
|
|
40
|
-
credit_limit: number;
|
|
41
|
-
is_suggested: boolean;
|
|
42
|
-
owner_id: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Discriminated payload for the AI Card Creation interactive form. The wire
|
|
46
|
-
* format mirrors the FE-side `CardsCreationInitialData` field-for-field
|
|
47
|
-
* (with snake_case field names converted to camelCase by the reducer).
|
|
48
|
-
*
|
|
49
|
-
* - `team-then-cards` (default): the AI suggests rows (vendors + departments);
|
|
50
|
-
* user reviews them in step 1, then configures cards in step 2. The wire
|
|
51
|
-
* format ships a flat `suggested_cards` array. Both suggested and
|
|
52
|
-
* not-suggested entries are included; the reducer splits them into seed
|
|
53
|
-
* rows vs. dropdown options. The legacy `team_rows` /
|
|
54
|
-
* `suggested_owner_user_id_by_team_id` shape is also accepted for
|
|
55
|
-
* backward compatibility with mocks and tests.
|
|
56
|
-
* - `cards-only` (1-step): the AI has already chosen cards; user lands
|
|
57
|
-
* directly on the editable card table for confirmation.
|
|
58
|
-
*/
|
|
59
|
-
export type CardsCreationInitialDataPayload = {
|
|
60
|
-
card_options: CardsCardOptionPayload[];
|
|
61
|
-
mode: 'team-then-cards';
|
|
62
|
-
/**
|
|
63
|
-
* Preferred wire format: flat list of vendor/department cards with an
|
|
64
|
-
* `is_suggested` discriminator. The reducer derives `team_rows`,
|
|
65
|
-
* `suggested_owner_user_id_by_team_id`, and the full `cardNameOptions`
|
|
66
|
-
* universe from this single array.
|
|
67
|
-
*/
|
|
68
|
-
suggested_cards?: SuggestedCardPayload[];
|
|
69
|
-
/**
|
|
70
|
-
* Legacy/test shape — pre-shaped seed rows. Mutually exclusive with
|
|
71
|
-
* `suggested_cards`; when both are present, `suggested_cards` wins.
|
|
72
|
-
*/
|
|
73
|
-
suggested_owner_user_id_by_team_id?: Record<string, string | null>;
|
|
74
|
-
team_rows?: Array<{
|
|
75
|
-
avg_monthly_spend: string;
|
|
76
|
-
id: string;
|
|
77
|
-
label: string;
|
|
78
|
-
recommended_limit: string;
|
|
79
|
-
card_kind?: 'vendor' | 'class' | null;
|
|
80
|
-
recommended_limit_cadence?: string | null;
|
|
81
|
-
}>;
|
|
82
|
-
} | {
|
|
83
|
-
card_options: CardsCardOptionPayload[];
|
|
84
|
-
card_rows: Array<{
|
|
85
|
-
card_option_id: string;
|
|
86
|
-
id: string;
|
|
87
|
-
/**
|
|
88
|
-
* Optional team-derived display label rendered in the card cell
|
|
89
|
-
* trigger (e.g. "Engineering"). Drives the row's first-letter avatar
|
|
90
|
-
* in step 2.
|
|
91
|
-
*/
|
|
92
|
-
label?: string | null;
|
|
93
|
-
recommended_limit?: number | null;
|
|
94
|
-
suggested_owner_user_id?: string | null;
|
|
95
|
-
}>;
|
|
96
|
-
mode: 'cards-only';
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Per-policy allow / block bucket on the wire. The two arrays are
|
|
100
|
-
* independent (a draft policy may populate both, only one, or neither).
|
|
101
|
-
*/
|
|
102
|
-
export interface DraftPolicyEntityPayload {
|
|
103
|
-
category_codes: string[];
|
|
104
|
-
merchant_names: string[];
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Spend-limit bucket per policy. `transaction` is the only cadence the
|
|
108
|
-
* BE ships today; left open-ended for future cadences (e.g.
|
|
109
|
-
* `monthly`, `quarterly`).
|
|
110
|
-
*/
|
|
111
|
-
export interface DraftPolicySpendLimitsPayload {
|
|
112
|
-
transaction: number;
|
|
113
|
-
[cadence: string]: number | undefined;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Single draft policy on the wire. The controller emits one of these
|
|
117
|
-
* per recommended policy in `step_5_review.draft_policies`. Identity is
|
|
118
|
-
* positional (no stable `id` from the BE); the FE synthesizes one on
|
|
119
|
-
* decode.
|
|
120
|
-
*/
|
|
121
|
-
export interface DraftPolicyPayload {
|
|
122
|
-
allowed_entity: DraftPolicyEntityPayload;
|
|
123
|
-
apply_to_cards: string[];
|
|
124
|
-
blocked_entity: DraftPolicyEntityPayload;
|
|
125
|
-
description: string;
|
|
126
|
-
/** Enforcement mode for the policy (e.g. `"strict"`). Carried into
|
|
127
|
-
* state for guided submit; ignored for `auto` / `upload`. */
|
|
128
|
-
mode: string;
|
|
129
|
-
name: string;
|
|
130
|
-
required_receipt_threshold: number;
|
|
131
|
-
spend_limits: DraftPolicySpendLimitsPayload;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* `step_5_review` block — the only step in `wizard_plan` the FE reads.
|
|
135
|
-
* Steps 1–4 are intentionally not modeled.
|
|
136
|
-
*/
|
|
137
|
-
export interface CardPolicyStep5ReviewPayload {
|
|
138
|
-
draft_policies: DraftPolicyPayload[];
|
|
139
|
-
/** Header text shown above the review list / wizard. */
|
|
140
|
-
prompt: string;
|
|
141
|
-
/** How the BE grouped the suggested policies. `"none"` today; may
|
|
142
|
-
* surface as a header banner in a future iteration. */
|
|
143
|
-
grouping_source?: string;
|
|
144
|
-
}
|
|
145
|
-
export interface CardPolicyWizardPlanPayload {
|
|
146
|
-
step_5_review: CardPolicyStep5ReviewPayload;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Upload-mode metadata that the `policy-recommendation-from-upload` API
|
|
150
|
-
* returns alongside the wizard plan. Absent on the initial controller
|
|
151
|
-
* response; populated after the file upload + recommendation chain.
|
|
152
|
-
*/
|
|
153
|
-
export interface CardPolicyUploadSourcePayload {
|
|
154
|
-
confidence_score: number;
|
|
155
|
-
file_name: string;
|
|
156
|
-
low_confidence_fields: string[];
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Discriminated payload for the AI Card Policy interactive form.
|
|
160
|
-
* All three modes share the same `wizard_plan.step_5_review.draft_policies`
|
|
161
|
-
* envelope; the FE renders different forms based on `mode`.
|
|
162
|
-
*
|
|
163
|
-
* - `auto` (1-step review): user reviews suggested policies and submits.
|
|
164
|
-
* - `guided` (5-step wizard): Steps 1–4 seeded from `draft_policies[0]`,
|
|
165
|
-
* Step 5 lists every draft policy.
|
|
166
|
-
* - `upload` (3-step): upload doc → pick cards → review. Controller
|
|
167
|
-
* responses for `mode === "upload"` arrive *before* the user uploads,
|
|
168
|
-
* so `wizard_plan` is optional; populated after the upload-recommendation
|
|
169
|
-
* API returns.
|
|
170
|
-
*/
|
|
171
|
-
export type CardPolicyInitialDataPayload = {
|
|
172
|
-
mode: 'auto';
|
|
173
|
-
wizard_plan: CardPolicyWizardPlanPayload;
|
|
174
|
-
} | {
|
|
175
|
-
mode: 'guided';
|
|
176
|
-
wizard_plan: CardPolicyWizardPlanPayload;
|
|
177
|
-
} | {
|
|
178
|
-
mode: 'upload';
|
|
179
|
-
source?: CardPolicyUploadSourcePayload;
|
|
180
|
-
wizard_plan?: CardPolicyWizardPlanPayload;
|
|
181
|
-
};
|
|
182
|
-
/**
|
|
183
|
-
* Discriminated visualization payload. The FE narrows on `form_type` and
|
|
184
|
-
* casts `payload` to the matching shape.
|
|
185
|
-
*/
|
|
186
|
-
export type InteractiveFormVisualizationPayload = {
|
|
187
|
-
form_type: 'cards_creation';
|
|
188
|
-
payload: CardsCreationInitialDataPayload;
|
|
189
|
-
} | {
|
|
190
|
-
form_type: 'card_policy';
|
|
191
|
-
payload: CardPolicyInitialDataPayload;
|
|
192
|
-
};
|
|
193
23
|
export interface AiCfoVisualizationPayload {
|
|
194
|
-
data: TableVisualizationPayload | ChartVisualizationPayload |
|
|
24
|
+
data: TableVisualizationPayload | ChartVisualizationPayload | null;
|
|
195
25
|
type: string | null;
|
|
196
26
|
}
|
|
197
27
|
export interface AiCfoAnswerPayload {
|
|
@@ -2,7 +2,6 @@ import { ID } from '../../commonStateTypes/common';
|
|
|
2
2
|
import { ZeniDate } from '../../zeniDayJS';
|
|
3
3
|
import { AiCfoAnswerPayload, AiCfoVisualizationPayload, ChatSessionPayload, MessagePayload } from './aiCfoPayload';
|
|
4
4
|
import { AiCfoState, AiCfoVisualization, FileAttachmentMetadata } from './aiCfoState';
|
|
5
|
-
import type { CardPolicyUploadSource, CardPolicyWizardPlan } 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,11 +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">;
|
|
44
|
+
}, "aiCfo/deleteQuestion">;
|
|
51
45
|
declare const _default: import("redux").Reducer<AiCfoState>;
|
|
52
46
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
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");
|
|
@@ -139,184 +139,12 @@ const toAiCfoVisualization = (visualization) => {
|
|
|
139
139
|
if (visualization.type == null || visualization.data == null) {
|
|
140
140
|
return undefined;
|
|
141
141
|
}
|
|
142
|
-
const normalizedType = (0, aiCfoState_1.toAiCfoVisualizationTypeStrict)(visualization.type) ?? 'table';
|
|
143
142
|
return {
|
|
144
|
-
type:
|
|
145
|
-
data:
|
|
146
|
-
? toInteractiveFormVisualization(visualization.data)
|
|
147
|
-
: toAiCfoVisualizationData(visualization.data),
|
|
143
|
+
type: (0, aiCfoState_1.toAiCfoVisualizationTypeStrict)(visualization.type) ?? 'table',
|
|
144
|
+
data: toAiCfoVisualizationData(visualization.data),
|
|
148
145
|
};
|
|
149
146
|
};
|
|
150
147
|
exports.toAiCfoVisualization = toAiCfoVisualization;
|
|
151
|
-
const toInteractiveFormVisualization = (data) => {
|
|
152
|
-
const formType = (0, aiCfoState_1.toInteractiveFormTypeStrict)(data.form_type) ?? 'cards_creation';
|
|
153
|
-
if (formType === 'card_policy') {
|
|
154
|
-
return {
|
|
155
|
-
formType: 'card_policy',
|
|
156
|
-
payload: toCardPolicyInitialData(data.payload),
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
formType: 'cards_creation',
|
|
161
|
-
payload: toCardsCreationInitialData(data.payload),
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
const toCardsCreationInitialData = (payload) => {
|
|
165
|
-
const cardOptions = (payload.card_options ?? []).map((option) => ({
|
|
166
|
-
id: option.id,
|
|
167
|
-
label: option.label,
|
|
168
|
-
description: option.description ?? undefined,
|
|
169
|
-
}));
|
|
170
|
-
if (payload.mode === 'cards-only') {
|
|
171
|
-
return {
|
|
172
|
-
mode: 'cards-only',
|
|
173
|
-
cardOptions,
|
|
174
|
-
cardRows: (payload.card_rows ?? []).map((row) => ({
|
|
175
|
-
cardOptionId: row.card_option_id,
|
|
176
|
-
id: row.id,
|
|
177
|
-
label: row.label ?? undefined,
|
|
178
|
-
recommendedLimit: row.recommended_limit ?? undefined,
|
|
179
|
-
suggestedOwnerUserId: row.suggested_owner_user_id ?? undefined,
|
|
180
|
-
})),
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
// Preferred wire format: a flat `suggested_cards` array with an
|
|
184
|
-
// `is_suggested` discriminator. The adapter splits it into seed rows,
|
|
185
|
-
// owner map, and the full dropdown universe.
|
|
186
|
-
if (payload.suggested_cards != null) {
|
|
187
|
-
return fromSuggestedCards(payload.suggested_cards, cardOptions);
|
|
188
|
-
}
|
|
189
|
-
// Legacy / test shape: backend already pre-shapes seeds. Synthesize an
|
|
190
|
-
// empty `cardNameOptions` (step 2 dropdown still works via row-self ids).
|
|
191
|
-
const teamRows = (payload.team_rows ?? []).map((row) => ({
|
|
192
|
-
avgMonthlySpend: row.avg_monthly_spend,
|
|
193
|
-
cardKind: (row.card_kind ?? 'vendor'),
|
|
194
|
-
id: row.id,
|
|
195
|
-
label: row.label,
|
|
196
|
-
recommendedLimit: row.recommended_limit,
|
|
197
|
-
recommendedLimitCadence: row.recommended_limit_cadence ?? undefined,
|
|
198
|
-
}));
|
|
199
|
-
return {
|
|
200
|
-
mode: 'team-then-cards',
|
|
201
|
-
cardOptions,
|
|
202
|
-
cardNameOptions: teamRows.map((row) => ({
|
|
203
|
-
id: row.id,
|
|
204
|
-
kind: row.cardKind,
|
|
205
|
-
label: row.label,
|
|
206
|
-
})),
|
|
207
|
-
suggestedOwnerUserIdByTeamId: Object.fromEntries(Object.entries(payload.suggested_owner_user_id_by_team_id ?? {}).map(([teamId, userId]) => [teamId, userId ?? undefined])),
|
|
208
|
-
teamRows,
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
const CURRENCY_FORMATTER = new Intl.NumberFormat('en-US', {
|
|
212
|
-
style: 'currency',
|
|
213
|
-
currency: 'USD',
|
|
214
|
-
maximumFractionDigits: 0,
|
|
215
|
-
});
|
|
216
|
-
const fromSuggestedCards = (suggestedCards, cardOptions) => {
|
|
217
|
-
const ordered = [...suggestedCards].sort((a, b) => {
|
|
218
|
-
if (a.card_type === b.card_type) {
|
|
219
|
-
return 0;
|
|
220
|
-
}
|
|
221
|
-
return a.card_type === 'vendor' ? -1 : 1;
|
|
222
|
-
});
|
|
223
|
-
const withUniqueIds = withSynthesizedIds(ordered);
|
|
224
|
-
const teamRows = withUniqueIds
|
|
225
|
-
.filter(({ card }) => card.is_suggested)
|
|
226
|
-
.map(({ card, uniqueId }) => ({
|
|
227
|
-
avgMonthlySpend: CURRENCY_FORMATTER.format(card.avg_spend),
|
|
228
|
-
cardKind: card.card_type === 'department' ? 'class' : 'vendor',
|
|
229
|
-
id: uniqueId,
|
|
230
|
-
label: card.card_name,
|
|
231
|
-
recommendedLimit: CURRENCY_FORMATTER.format(card.credit_limit),
|
|
232
|
-
recommendedLimitCadence: 'Monthly',
|
|
233
|
-
}));
|
|
234
|
-
const suggestedOwnerUserIdByTeamId = Object.fromEntries(withUniqueIds
|
|
235
|
-
.filter(({ card }) => card.is_suggested)
|
|
236
|
-
.map(({ card, uniqueId }) => [uniqueId, card.owner_id]));
|
|
237
|
-
const cardNameOptions = withUniqueIds.map(({ card, uniqueId }) => ({
|
|
238
|
-
id: uniqueId,
|
|
239
|
-
kind: card.card_type === 'department' ? 'class' : 'vendor',
|
|
240
|
-
label: card.card_name,
|
|
241
|
-
}));
|
|
242
|
-
return {
|
|
243
|
-
mode: 'team-then-cards',
|
|
244
|
-
cardOptions,
|
|
245
|
-
cardNameOptions,
|
|
246
|
-
suggestedOwnerUserIdByTeamId,
|
|
247
|
-
teamRows,
|
|
248
|
-
};
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* Stamp each suggested card with a stable unique id derived from its
|
|
252
|
-
* `card_name_id`. If two cards in the same payload share the same
|
|
253
|
-
* `card_name_id` (which happens in the current sample payload where
|
|
254
|
-
* `card_name_id` is the literal `"vendor_uuid"`), fall back to a
|
|
255
|
-
* synthesized id `${kind}__${card_name_id}__${index}` so RHF row keying
|
|
256
|
-
* stays unique.
|
|
257
|
-
*/
|
|
258
|
-
const withSynthesizedIds = (cards) => {
|
|
259
|
-
const seen = new Set();
|
|
260
|
-
return cards.map((card, index) => {
|
|
261
|
-
const preferred = card.card_name_id;
|
|
262
|
-
if (preferred != null && preferred !== '' && !seen.has(preferred)) {
|
|
263
|
-
seen.add(preferred);
|
|
264
|
-
return { card, uniqueId: preferred };
|
|
265
|
-
}
|
|
266
|
-
const synthesized = `${card.card_type}__${preferred ?? 'unknown'}__${index}`;
|
|
267
|
-
seen.add(synthesized);
|
|
268
|
-
return { card, uniqueId: synthesized };
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
const toCardPolicyDraftPolicy = (payload, index) => ({
|
|
272
|
-
id: `draft-${index}`,
|
|
273
|
-
name: payload.name,
|
|
274
|
-
description: payload.description ?? '',
|
|
275
|
-
mode: payload.mode,
|
|
276
|
-
allowedEntity: {
|
|
277
|
-
categoryCodes: payload.allowed_entity?.category_codes ?? [],
|
|
278
|
-
merchantNames: payload.allowed_entity?.merchant_names ?? [],
|
|
279
|
-
},
|
|
280
|
-
blockedEntity: {
|
|
281
|
-
categoryCodes: payload.blocked_entity?.category_codes ?? [],
|
|
282
|
-
merchantNames: payload.blocked_entity?.merchant_names ?? [],
|
|
283
|
-
},
|
|
284
|
-
applyToCards: payload.apply_to_cards ?? [],
|
|
285
|
-
requiredReceiptThreshold: payload.required_receipt_threshold ?? 0,
|
|
286
|
-
spendLimits: {
|
|
287
|
-
transaction: payload.spend_limits?.transaction ?? 0,
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
const toCardPolicyStep5Review = (payload) => ({
|
|
291
|
-
draftPolicies: (payload.draft_policies ?? []).map(toCardPolicyDraftPolicy),
|
|
292
|
-
groupingSource: payload.grouping_source ?? 'none',
|
|
293
|
-
prompt: payload.prompt ?? '',
|
|
294
|
-
});
|
|
295
|
-
const toCardPolicyWizardPlan = (payload) => ({
|
|
296
|
-
step5Review: toCardPolicyStep5Review(payload.step_5_review),
|
|
297
|
-
});
|
|
298
|
-
const toCardPolicyUploadSource = (payload) => ({
|
|
299
|
-
confidenceScore: payload.confidence_score,
|
|
300
|
-
fileName: payload.file_name,
|
|
301
|
-
lowConfidenceFields: payload.low_confidence_fields ?? [],
|
|
302
|
-
});
|
|
303
|
-
const toCardPolicyInitialData = (payload) => {
|
|
304
|
-
if (payload.mode === 'upload') {
|
|
305
|
-
return {
|
|
306
|
-
policyKind: 'upload',
|
|
307
|
-
wizardPlan: payload.wizard_plan != null
|
|
308
|
-
? toCardPolicyWizardPlan(payload.wizard_plan)
|
|
309
|
-
: undefined,
|
|
310
|
-
source: payload.source != null
|
|
311
|
-
? toCardPolicyUploadSource(payload.source)
|
|
312
|
-
: undefined,
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
return {
|
|
316
|
-
policyKind: payload.mode,
|
|
317
|
-
wizardPlan: toCardPolicyWizardPlan(payload.wizard_plan),
|
|
318
|
-
};
|
|
319
|
-
};
|
|
320
148
|
const toAiCfoVisualizationData = (data) => {
|
|
321
149
|
if ('x' in data && 'y' in data) {
|
|
322
150
|
// Normalize y to always be an array
|
|
@@ -630,49 +458,6 @@ const aiCfo = (0, toolkit_1.createSlice)({
|
|
|
630
458
|
session.questionAnswers.push(qa);
|
|
631
459
|
}
|
|
632
460
|
},
|
|
633
|
-
/**
|
|
634
|
-
* Patch the `card_policy` interactive-form payload for a specific
|
|
635
|
-
* answer in a chat session to merge in the wizard plan + upload
|
|
636
|
-
* source metadata returned by
|
|
637
|
-
* `POST /cards/1.0/ai-cfo/policy-recommendation-from-upload`.
|
|
638
|
-
*
|
|
639
|
-
* Dispatched by the recommendation epic after a successful response;
|
|
640
|
-
* the wizard re-renders Steps 2 + 3 of the upload variant once the
|
|
641
|
-
* payload becomes a populated `CardPolicyInitialData` with
|
|
642
|
-
* `policyKind: "upload"` + `wizardPlan` + `source`.
|
|
643
|
-
*
|
|
644
|
-
* No-op when the target answer / chat session / form payload is
|
|
645
|
-
* missing or isn't an upload-mode card-policy interactive form —
|
|
646
|
-
* the bridge epic is best-effort and silently drops in edge cases
|
|
647
|
-
* (e.g. the user closed the chat before recommendation returned).
|
|
648
|
-
*/
|
|
649
|
-
updateAiCfoAnswerCardPolicyWizardPlan(draft, action) {
|
|
650
|
-
const { answerId, chatSessionId, source, wizardPlan } = action.payload;
|
|
651
|
-
const session = draft.aiCfoByChatSessionId[chatSessionId];
|
|
652
|
-
if (session == null) {
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
const qa = session.questionAnswers.find((entry) => entry.questionAnswerId === answerId);
|
|
656
|
-
if (qa == null) {
|
|
657
|
-
return;
|
|
658
|
-
}
|
|
659
|
-
for (const response of Object.values(qa.responses)) {
|
|
660
|
-
const visualization = response?.content.visualization;
|
|
661
|
-
if (visualization == null || visualization.type !== 'interactive_form') {
|
|
662
|
-
continue;
|
|
663
|
-
}
|
|
664
|
-
const data = visualization.data;
|
|
665
|
-
if (data.formType !== 'card_policy' ||
|
|
666
|
-
data.payload.policyKind !== 'upload') {
|
|
667
|
-
continue;
|
|
668
|
-
}
|
|
669
|
-
data.payload = {
|
|
670
|
-
...data.payload,
|
|
671
|
-
wizardPlan,
|
|
672
|
-
source: source ?? data.payload.source,
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
},
|
|
676
461
|
clearSession(draft, action) {
|
|
677
462
|
const sessionId = action.payload;
|
|
678
463
|
delete draft.aiCfoByChatSessionId[sessionId];
|
|
@@ -708,5 +493,5 @@ const toChatSession = (chatSessionPayload) => {
|
|
|
708
493
|
createdAt: (0, zeniDayJS_1.date)(created_at),
|
|
709
494
|
};
|
|
710
495
|
};
|
|
711
|
-
_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;
|
|
712
497
|
exports.default = aiCfo.reducer;
|