@zeniai/client-epic-state 5.0.82-betaAS1 → 5.0.83-betaRR0
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/entity/aiCfo/aiCfoPayload.d.ts +140 -1
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +23 -2
- package/lib/entity/aiCfo/aiCfoReducer.js +328 -5
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +13 -1
- package/lib/entity/aiCfo/aiCfoSelector.js +28 -1
- package/lib/entity/aiCfo/aiCfoState.d.ts +225 -4
- package/lib/entity/aiCfo/aiCfoState.js +30 -1
- package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +277 -0
- package/lib/entity/cardPolicy/cardPolicyPayload.js +143 -0
- package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +19 -0
- package/lib/entity/cardPolicy/cardPolicyReducer.js +175 -0
- package/lib/entity/cardPolicy/cardPolicySelector.d.ts +32 -0
- package/lib/entity/cardPolicy/cardPolicySelector.js +99 -0
- package/lib/entity/cardPolicy/cardPolicyState.d.ts +205 -0
- package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +68 -0
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +25 -0
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +39 -0
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +23 -0
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +104 -0
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +6 -2
- package/lib/entity/tenant/clearAllEpic.js +8 -0
- package/lib/entity/tenant/tenantPayload.d.ts +0 -3
- package/lib/entity/tenant/tenantReducer.d.ts +1 -1
- package/lib/entity/tenant/tenantReducer.js +3 -23
- package/lib/entity/tenant/tenantState.d.ts +0 -3
- package/lib/epic.d.ts +11 -3
- package/lib/epic.js +11 -3
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +328 -5
- package/lib/esm/entity/aiCfo/aiCfoSelector.js +26 -1
- package/lib/esm/entity/aiCfo/aiCfoState.js +27 -0
- package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +130 -0
- package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +171 -0
- package/lib/esm/entity/cardPolicy/cardPolicySelector.js +75 -0
- package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
- package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +64 -0
- package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
- package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +35 -0
- package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +100 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +8 -0
- package/lib/esm/entity/tenant/tenantReducer.js +2 -22
- package/lib/esm/epic.js +11 -3
- package/lib/esm/index.js +29 -11
- package/lib/esm/reducer.js +12 -0
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +6 -3
- package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
- package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +2 -1
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
- package/lib/esm/view/dashboard/dashboardReducer.js +5 -1
- package/lib/esm/view/dashboard/dashboardSelector.js +2 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +70 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +56 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +49 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +42 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +72 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +56 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +45 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +39 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +53 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +25 -0
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +25 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +62 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +47 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +62 -4
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +61 -0
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +69 -0
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +1 -45
- package/lib/index.d.ts +28 -11
- package/lib/index.js +154 -29
- package/lib/reducer.d.ts +12 -0
- package/lib/reducer.js +12 -0
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +11 -2
- package/lib/view/aiCfoView/aiCfoViewReducer.js +6 -3
- package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +5 -2
- package/lib/view/aiCfoView/epics/createSessionEpic.js +2 -1
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -1
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +12 -2
- package/lib/view/dashboard/dashboardReducer.d.ts +1 -1
- package/lib/view/dashboard/dashboardReducer.js +6 -2
- package/lib/view/dashboard/dashboardSelector.d.ts +1 -0
- package/lib/view/dashboard/dashboardSelector.js +2 -1
- package/lib/view/dashboard/dashboardState.d.ts +1 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +74 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +21 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +25 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +60 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +18 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +53 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +16 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +46 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +76 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +21 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +60 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +13 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +49 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +32 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +46 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +45 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +25 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +57 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +29 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +27 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.d.ts +79 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/aiCardCreationFormDraftTypes.js +2 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.d.ts +25 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/buildAiCardCreationFormDraftSeed.js +66 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.d.ts +26 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/deriveAiCardRowsFromTeams.js +51 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +12 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +63 -5
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +42 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +68 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +18 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.d.ts +11 -0
- package/lib/view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft.js +73 -0
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +2 -46
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewState.d.ts +0 -2
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
- package/package.json +1 -1
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
|
@@ -9,9 +9,13 @@ export interface AiCfoAnswerParagraph {
|
|
|
9
9
|
}>;
|
|
10
10
|
}
|
|
11
11
|
export declare const ALL_AI_CFO_CHARTS_TYPES: readonly ["bar_chart", "pie_chart", "line_chart"];
|
|
12
|
-
export declare const ALL_AI_CFO_VISUALIZATION_TYPES: readonly ["bar_chart", "pie_chart", "line_chart", "table"];
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
12
|
+
export declare const ALL_AI_CFO_VISUALIZATION_TYPES: readonly ["bar_chart", "pie_chart", "line_chart", "table", "interactive_form"];
|
|
13
|
+
export declare const ALL_INTERACTIVE_FORM_TYPES: readonly ["cards_creation", "card_policy"];
|
|
14
|
+
export declare const toInteractiveFormType: (v: string) => "cards_creation" | "card_policy";
|
|
15
|
+
export declare const toInteractiveFormTypeStrict: (v: string) => "cards_creation" | "card_policy" | undefined;
|
|
16
|
+
export type InteractiveFormType = ReturnType<typeof toInteractiveFormType>;
|
|
17
|
+
export declare const toAiCfoVisualizationType: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | "interactive_form";
|
|
18
|
+
export declare const toAiCfoVisualizationTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | "table" | "interactive_form" | undefined;
|
|
15
19
|
export type AiCfoVisualizationType = ReturnType<typeof toAiCfoVisualizationType>;
|
|
16
20
|
export declare const toAiCfoChartType: (v: string) => "bar_chart" | "pie_chart" | "line_chart";
|
|
17
21
|
export declare const toAiCfoChartTypeStrict: (v: string) => "bar_chart" | "pie_chart" | "line_chart" | undefined;
|
|
@@ -53,8 +57,196 @@ export interface ChartVisualization {
|
|
|
53
57
|
lines?: string[];
|
|
54
58
|
yFormat?: YFormat;
|
|
55
59
|
}
|
|
60
|
+
export interface CardsCardOption {
|
|
61
|
+
id: string;
|
|
62
|
+
label: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Card kind for AI Card Creation rows.
|
|
67
|
+
* - `vendor` = vendor-bound card.
|
|
68
|
+
* - `class` = department-scoped card. The wire format ships `department`;
|
|
69
|
+
* the reducer maps it to `class` (the FE-side term for accounting class /
|
|
70
|
+
* department) so it lines up with the rest of the codebase.
|
|
71
|
+
* - `category` = MCC category-scoped card. The wire format ships `category`
|
|
72
|
+
* verbatim; there is no FE-side alias, so we keep the wire term.
|
|
73
|
+
*
|
|
74
|
+
* The Step 2 Card-cell dropdown filters by this kind so a row of one kind
|
|
75
|
+
* only sees swap targets of the same kind.
|
|
76
|
+
*/
|
|
77
|
+
export type CardsCardKind = 'vendor' | 'class' | 'category';
|
|
78
|
+
/**
|
|
79
|
+
* Single entry in the unified vendor + department dropdown universe shipped
|
|
80
|
+
* by the AI controller for the `review` flow. Powers both the
|
|
81
|
+
* step-2 Card cell dropdown (filtered to entries with matching `kind`) and
|
|
82
|
+
* the step-1 "Add something else" search (no kind filter — user can add
|
|
83
|
+
* either).
|
|
84
|
+
*/
|
|
85
|
+
export interface CardNameOption {
|
|
86
|
+
id: string;
|
|
87
|
+
kind: CardsCardKind;
|
|
88
|
+
label: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Default `cardOptionId` (physical / virtual / subscription) assigned to
|
|
92
|
+
* every seeded card row. The AI Card Creation flow currently issues virtual
|
|
93
|
+
* credit cards only — this constant is kept in sync with
|
|
94
|
+
* `AI_CARD_CREATION_VIRTUAL_ONLY_CARD_OPTIONS` in `zeni-web-app-ui`.
|
|
95
|
+
*/
|
|
96
|
+
export declare const CARDS_CREATION_DEFAULT_CARD_OPTION_ID = "virtual";
|
|
97
|
+
/**
|
|
98
|
+
* Shared base shape across both `review` and `create` AI Card Creation
|
|
99
|
+
* states. Holds the data derived from the controller's `suggested_cards[]`
|
|
100
|
+
* that's identical regardless of which step UX the user sees.
|
|
101
|
+
*/
|
|
102
|
+
export interface CardsCreationCommonData {
|
|
103
|
+
/**
|
|
104
|
+
* Full vendor + department + category universe (suggested +
|
|
105
|
+
* not-suggested), used to power the step-2 Card-cell dropdown (filtered
|
|
106
|
+
* by row kind) and, in `review` mode, the step-1 "Add something else"
|
|
107
|
+
* search.
|
|
108
|
+
*/
|
|
109
|
+
cardNameOptions: CardNameOption[];
|
|
110
|
+
/**
|
|
111
|
+
* Physical / virtual / subscription dropdown options. Not shipped on the
|
|
112
|
+
* wire; populated at render time from the FE-owned
|
|
113
|
+
* `AI_CARD_CREATION_VIRTUAL_ONLY_CARD_OPTIONS` constant.
|
|
114
|
+
*/
|
|
115
|
+
cardOptions: CardsCardOption[];
|
|
116
|
+
/**
|
|
117
|
+
* Map of `teamRow.id` / `cardRow.id` -> suggested owner `userId`.
|
|
118
|
+
* Resolved against `allUsers` (sourced from the tenant) at render time.
|
|
119
|
+
*/
|
|
120
|
+
suggestedOwnerUserIdByTeamId: Record<string, ID | undefined>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Initial data for the AI Card Creation interactive form. Discriminated on
|
|
124
|
+
* `mode`:
|
|
125
|
+
*
|
|
126
|
+
* - `review` (default, 2-step): AI suggests rows (mix of vendors +
|
|
127
|
+
* departments + categories); user reviews them in step 1, then configures
|
|
128
|
+
* one card per surviving row in step 2.
|
|
129
|
+
* - `create` (1-step): the FE seeds the step-2 editable table directly
|
|
130
|
+
* from the `is_suggested: true` rows; step 1 is skipped.
|
|
131
|
+
*
|
|
132
|
+
* Both modes carry the same `cardNameOptions` universe so the step-2 Card
|
|
133
|
+
* dropdown behaves identically across modes.
|
|
134
|
+
*/
|
|
135
|
+
export type CardsCreationInitialData = (CardsCreationCommonData & {
|
|
136
|
+
mode: 'review';
|
|
137
|
+
teamRows: Array<{
|
|
138
|
+
avgMonthlySpend: string;
|
|
139
|
+
cardKind: CardsCardKind;
|
|
140
|
+
id: string;
|
|
141
|
+
label: string;
|
|
142
|
+
recommendedLimit: string;
|
|
143
|
+
recommendedLimitCadence?: string;
|
|
144
|
+
}>;
|
|
145
|
+
}) | (CardsCreationCommonData & {
|
|
146
|
+
cardRows: Array<{
|
|
147
|
+
cardKind: CardsCardKind;
|
|
148
|
+
cardOptionId: string;
|
|
149
|
+
id: string;
|
|
150
|
+
/**
|
|
151
|
+
* Team-derived display label rendered in the card cell trigger
|
|
152
|
+
* (e.g. "Engineering"). Drives the row's first-letter avatar in
|
|
153
|
+
* step 2. Always populated for AI-seeded rows.
|
|
154
|
+
*/
|
|
155
|
+
label: string;
|
|
156
|
+
recommendedLimit?: number;
|
|
157
|
+
suggestedOwnerUserId?: ID;
|
|
158
|
+
}>;
|
|
159
|
+
mode: 'create';
|
|
160
|
+
});
|
|
161
|
+
/**
|
|
162
|
+
* Per-policy allow / block bucket. CamelCase mirror of
|
|
163
|
+
* `DraftPolicyEntityPayload`.
|
|
164
|
+
*/
|
|
165
|
+
export interface CardPolicyDraftPolicyEntity {
|
|
166
|
+
categoryCodes: string[];
|
|
167
|
+
merchantNames: string[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Spend-limit bucket per policy. `transaction` is the only cadence the
|
|
171
|
+
* BE ships today.
|
|
172
|
+
*/
|
|
173
|
+
export interface CardPolicySpendLimits {
|
|
174
|
+
transaction: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Single draft policy in FE state. Identity is positional — the reducer
|
|
178
|
+
* synthesizes a stable `id` (`draft-0`, `draft-1`, ...) at decode time
|
|
179
|
+
* since the BE doesn't ship one today.
|
|
180
|
+
*/
|
|
181
|
+
export interface CardPolicyDraftPolicy {
|
|
182
|
+
allowedEntity: CardPolicyDraftPolicyEntity;
|
|
183
|
+
applyToCards: string[];
|
|
184
|
+
blockedEntity: CardPolicyDraftPolicyEntity;
|
|
185
|
+
description: string;
|
|
186
|
+
id: string;
|
|
187
|
+
/** Enforcement mode (e.g. `"strict"`). Carried for guided submit;
|
|
188
|
+
* ignored by auto / upload submit. */
|
|
189
|
+
mode: string;
|
|
190
|
+
name: string;
|
|
191
|
+
requiredReceiptThreshold: number;
|
|
192
|
+
spendLimits: CardPolicySpendLimits;
|
|
193
|
+
}
|
|
194
|
+
export interface CardPolicyStep5Review {
|
|
195
|
+
draftPolicies: CardPolicyDraftPolicy[];
|
|
196
|
+
groupingSource: string;
|
|
197
|
+
prompt: string;
|
|
198
|
+
}
|
|
199
|
+
export interface CardPolicyWizardPlan {
|
|
200
|
+
step5Review: CardPolicyStep5Review;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Upload-mode metadata returned by the
|
|
204
|
+
* `policy-recommendation-from-upload` API alongside the wizard plan.
|
|
205
|
+
*/
|
|
206
|
+
export interface CardPolicyUploadSource {
|
|
207
|
+
confidenceScore: number;
|
|
208
|
+
fileName: string;
|
|
209
|
+
lowConfidenceFields: string[];
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Initial data for the AI Card Policy interactive form. Discriminated on
|
|
213
|
+
* `policyKind`. All three modes consume the same `wizardPlan.step5Review`
|
|
214
|
+
* envelope; the wizard renders different surfaces per mode.
|
|
215
|
+
*
|
|
216
|
+
* - `auto` (1-step review): chip groups built directly from each draft
|
|
217
|
+
* policy. Submit omits `mode` + `spend_limits` + `required_receipt_threshold`.
|
|
218
|
+
* - `guided` (5-step wizard): Steps 1–4 seeded from `draftPolicies[0]`,
|
|
219
|
+
* Step 5 lists every draft. Submit includes all keys.
|
|
220
|
+
* - `upload` (3-step): upload → cards → review. `wizardPlan` is
|
|
221
|
+
* `undefined` until the upload-recommendation API succeeds, then
|
|
222
|
+
* populated alongside `source` metadata. Submit includes
|
|
223
|
+
* `spend_limits` + `required_receipt_threshold`; omits `mode`.
|
|
224
|
+
*/
|
|
225
|
+
export type CardPolicyInitialData = {
|
|
226
|
+
policyKind: 'auto';
|
|
227
|
+
wizardPlan: CardPolicyWizardPlan;
|
|
228
|
+
} | {
|
|
229
|
+
policyKind: 'guided';
|
|
230
|
+
wizardPlan: CardPolicyWizardPlan;
|
|
231
|
+
} | {
|
|
232
|
+
policyKind: 'upload';
|
|
233
|
+
source?: CardPolicyUploadSource;
|
|
234
|
+
wizardPlan?: CardPolicyWizardPlan;
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Visualization variant rendered as an interactive RHF form (in lieu of a
|
|
238
|
+
* chart or table). Discriminated on `formType`; each branch carries its own
|
|
239
|
+
* payload shape.
|
|
240
|
+
*/
|
|
241
|
+
export type InteractiveFormVisualization = {
|
|
242
|
+
formType: 'cards_creation';
|
|
243
|
+
payload: CardsCreationInitialData;
|
|
244
|
+
} | {
|
|
245
|
+
formType: 'card_policy';
|
|
246
|
+
payload: CardPolicyInitialData;
|
|
247
|
+
};
|
|
56
248
|
export interface AiCfoVisualization {
|
|
57
|
-
data: TableVisualization | ChartVisualization;
|
|
249
|
+
data: TableVisualization | ChartVisualization | InteractiveFormVisualization;
|
|
58
250
|
type: AiCfoVisualizationType;
|
|
59
251
|
}
|
|
60
252
|
export declare const toMessageSender: (v: string) => "user" | "agent";
|
|
@@ -112,7 +304,36 @@ export interface ChatSessionWithMessages {
|
|
|
112
304
|
chatSession: ChatSession;
|
|
113
305
|
questionAnswers: AiCfoQuestionWithAnswer[];
|
|
114
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Discriminator for client-synthesized AI CFO answer bubbles. These are not
|
|
309
|
+
* Q/A pairs streamed from the backend — they are pushed locally by the AI
|
|
310
|
+
* CFO flow when it kicks off a cards or policy create from an interactive
|
|
311
|
+
* form, so the drawer can render a "Creating…" placeholder and later a
|
|
312
|
+
* "Created" success bubble while the corresponding mutation epic runs.
|
|
313
|
+
*/
|
|
314
|
+
export declare const ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS: readonly ["creating_cards", "creating_policy", "created_cards", "created_policy"];
|
|
315
|
+
export type SyntheticAiCfoAnswerKind = (typeof ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS)[number];
|
|
316
|
+
/**
|
|
317
|
+
* A locally-synthesized answer bubble (e.g. "Creating cards…", or "2 policies
|
|
318
|
+
* are created and saved" with preview tiles). Lives parallel to the streamed
|
|
319
|
+
* `questionAnswers` so the AI CFO renderer can swap the source answer's
|
|
320
|
+
* interactive form in-place with the bubble (and then with the success tile
|
|
321
|
+
* once the mutation completes).
|
|
322
|
+
*
|
|
323
|
+
* `sourceQuestionAnswerId` is the `questionAnswerId` of the streamed Q/A
|
|
324
|
+
* whose answer hosted the interactive form the user just submitted. Every
|
|
325
|
+
* synthetic is dispatched from a form-submit handler and every form lives
|
|
326
|
+
* inside an AI CFO answer, so this id is always known at dispatch time.
|
|
327
|
+
*/
|
|
328
|
+
export interface SyntheticAiCfoAnswer {
|
|
329
|
+
createdAt: ZeniDate;
|
|
330
|
+
entityIds: ID[];
|
|
331
|
+
id: ID;
|
|
332
|
+
kind: SyntheticAiCfoAnswerKind;
|
|
333
|
+
sourceQuestionAnswerId: ID;
|
|
334
|
+
}
|
|
115
335
|
export interface AiCfoState {
|
|
116
336
|
aiCfoByChatSessionId: Record<ID, ChatSessionWithMessages>;
|
|
117
337
|
partialQuestionAnswers: Record<ID, AiCfoQuestionWithAnswer | undefined>;
|
|
338
|
+
syntheticAnswersByChatSessionId: Record<ID, SyntheticAiCfoAnswer[]>;
|
|
118
339
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toMessageTypeStrict = exports.toMessageSenderStrict = exports.toMessageType = exports.toMessageSender = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateType = exports.toYFormatScaleStrict = exports.toYFormatUnitStrict = exports.toYFormatTypeStrict = exports.toYFormatScale = exports.toYFormatUnit = exports.toYFormatType = exports.ALL_Y_FORMAT_SCALES = exports.ALL_Y_FORMAT_NON_CURRENCY_UNITS = exports.ALL_Y_FORMAT_TYPES = exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CFO_ANSWER_STATE_TYPES = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = exports.toAiCfoVisualizationType = exports.ALL_AI_CFO_VISUALIZATION_TYPES = exports.ALL_AI_CFO_CHARTS_TYPES = void 0;
|
|
3
|
+
exports.ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS = exports.toMessageTypeStrict = exports.toMessageSenderStrict = exports.toMessageType = exports.toMessageSender = exports.CARDS_CREATION_DEFAULT_CARD_OPTION_ID = exports.toAiCfoAnswerResponseTypeStrict = exports.toAiCfoAnswerStateTypeStrict = exports.toAiCfoAnswerResponseType = exports.toAiCfoAnswerStateType = exports.toYFormatScaleStrict = exports.toYFormatUnitStrict = exports.toYFormatTypeStrict = exports.toYFormatScale = exports.toYFormatUnit = exports.toYFormatType = exports.ALL_Y_FORMAT_SCALES = exports.ALL_Y_FORMAT_NON_CURRENCY_UNITS = exports.ALL_Y_FORMAT_TYPES = exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES = exports.ALL_AI_CFO_ANSWER_STATE_TYPES = exports.toAiCfoChartTypeStrict = exports.toAiCfoChartType = exports.toAiCfoVisualizationTypeStrict = exports.toAiCfoVisualizationType = exports.toInteractiveFormTypeStrict = exports.toInteractiveFormType = exports.ALL_INTERACTIVE_FORM_TYPES = exports.ALL_AI_CFO_VISUALIZATION_TYPES = exports.ALL_AI_CFO_CHARTS_TYPES = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
5
|
exports.ALL_AI_CFO_CHARTS_TYPES = [
|
|
6
6
|
'bar_chart',
|
|
@@ -10,7 +10,16 @@ exports.ALL_AI_CFO_CHARTS_TYPES = [
|
|
|
10
10
|
exports.ALL_AI_CFO_VISUALIZATION_TYPES = [
|
|
11
11
|
...exports.ALL_AI_CFO_CHARTS_TYPES,
|
|
12
12
|
'table',
|
|
13
|
+
'interactive_form',
|
|
13
14
|
];
|
|
15
|
+
exports.ALL_INTERACTIVE_FORM_TYPES = [
|
|
16
|
+
'cards_creation',
|
|
17
|
+
'card_policy',
|
|
18
|
+
];
|
|
19
|
+
const toInteractiveFormType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INTERACTIVE_FORM_TYPES);
|
|
20
|
+
exports.toInteractiveFormType = toInteractiveFormType;
|
|
21
|
+
const toInteractiveFormTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_INTERACTIVE_FORM_TYPES);
|
|
22
|
+
exports.toInteractiveFormTypeStrict = toInteractiveFormTypeStrict;
|
|
14
23
|
const toAiCfoVisualizationType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_AI_CFO_VISUALIZATION_TYPES);
|
|
15
24
|
exports.toAiCfoVisualizationType = toAiCfoVisualizationType;
|
|
16
25
|
const toAiCfoVisualizationTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_AI_CFO_VISUALIZATION_TYPES);
|
|
@@ -69,6 +78,13 @@ const toAiCfoAnswerStateTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStr
|
|
|
69
78
|
exports.toAiCfoAnswerStateTypeStrict = toAiCfoAnswerStateTypeStrict;
|
|
70
79
|
const toAiCfoAnswerResponseTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_AI_CFO_ANSWER_RESPONSE_TYPES);
|
|
71
80
|
exports.toAiCfoAnswerResponseTypeStrict = toAiCfoAnswerResponseTypeStrict;
|
|
81
|
+
/**
|
|
82
|
+
* Default `cardOptionId` (physical / virtual / subscription) assigned to
|
|
83
|
+
* every seeded card row. The AI Card Creation flow currently issues virtual
|
|
84
|
+
* credit cards only — this constant is kept in sync with
|
|
85
|
+
* `AI_CARD_CREATION_VIRTUAL_ONLY_CARD_OPTIONS` in `zeni-web-app-ui`.
|
|
86
|
+
*/
|
|
87
|
+
exports.CARDS_CREATION_DEFAULT_CARD_OPTION_ID = 'virtual';
|
|
72
88
|
const ALL_MESSAGE_SENDERS = ['user', 'agent'];
|
|
73
89
|
const ALL_MESSAGE_TYPES = ['plain_text', 'json'];
|
|
74
90
|
const toMessageSender = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_MESSAGE_SENDERS);
|
|
@@ -79,3 +95,16 @@ const toMessageSenderStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v,
|
|
|
79
95
|
exports.toMessageSenderStrict = toMessageSenderStrict;
|
|
80
96
|
const toMessageTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, ALL_MESSAGE_TYPES);
|
|
81
97
|
exports.toMessageTypeStrict = toMessageTypeStrict;
|
|
98
|
+
/**
|
|
99
|
+
* Discriminator for client-synthesized AI CFO answer bubbles. These are not
|
|
100
|
+
* Q/A pairs streamed from the backend — they are pushed locally by the AI
|
|
101
|
+
* CFO flow when it kicks off a cards or policy create from an interactive
|
|
102
|
+
* form, so the drawer can render a "Creating…" placeholder and later a
|
|
103
|
+
* "Created" success bubble while the corresponding mutation epic runs.
|
|
104
|
+
*/
|
|
105
|
+
exports.ALL_SYNTHETIC_AI_CFO_ANSWER_KINDS = [
|
|
106
|
+
'creating_cards',
|
|
107
|
+
'creating_policy',
|
|
108
|
+
'created_cards',
|
|
109
|
+
'created_policy',
|
|
110
|
+
];
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniAPIResponse } from '../../responsePayload';
|
|
3
|
+
import { CardPolicyStats, CardPolicyTemplate, CardPolicyTemplateEntityList, CardPolicyTemplateMode, CardPolicyTemplateSpendLimits, ExtractedCardPolicyRules, MccCategory } from './cardPolicyState';
|
|
4
|
+
export interface MccCategoryPayload {
|
|
5
|
+
count: number;
|
|
6
|
+
mcc_codes: string[];
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wire shape for `GET /cards/1.0/cards/mcc-codes`. Beyond the universe of
|
|
11
|
+
* MCC categories used to populate the category search dropdown, the
|
|
12
|
+
* endpoint also ships **suggested** allow / block merchants and categories
|
|
13
|
+
* that the chip-pickers seed into their cloud body before the user starts
|
|
14
|
+
* editing.
|
|
15
|
+
*
|
|
16
|
+
* Field spellings (`*_catagories`) preserve the BE wire format verbatim;
|
|
17
|
+
* the camelCase mapper below corrects to `Categories`.
|
|
18
|
+
*/
|
|
19
|
+
export interface CardPolicyMccCategoriesPayload {
|
|
20
|
+
categories: MccCategoryPayload[];
|
|
21
|
+
suggested_allow_catagories?: MccCategoryPayload[];
|
|
22
|
+
suggested_allow_merchants?: string[];
|
|
23
|
+
suggested_block_catagories?: MccCategoryPayload[];
|
|
24
|
+
suggested_block_merchants?: string[];
|
|
25
|
+
}
|
|
26
|
+
export type CardPolicyMccCategoriesResponse = ZeniAPIResponse<CardPolicyMccCategoriesPayload>;
|
|
27
|
+
export declare const toMccCategory: (payload: MccCategoryPayload) => MccCategory;
|
|
28
|
+
/**
|
|
29
|
+
* Vendor row returned by `/accounting/1.0/vendors`. The card-policy
|
|
30
|
+
* vendor search dropdown only needs `vendor_id` + `vendor_name`; we
|
|
31
|
+
* deliberately ignore the rest of the payload to keep this slice
|
|
32
|
+
* independent of the heavy `vendor` entity store.
|
|
33
|
+
*/
|
|
34
|
+
export interface CardPolicyVendorSearchVendorPayload {
|
|
35
|
+
vendor_id: string;
|
|
36
|
+
vendor_name: string;
|
|
37
|
+
}
|
|
38
|
+
export interface CardPolicyVendorSearchData {
|
|
39
|
+
vendors: CardPolicyVendorSearchVendorPayload[];
|
|
40
|
+
}
|
|
41
|
+
export type CardPolicyVendorSearchResponse = ZeniAPIResponse<CardPolicyVendorSearchData>;
|
|
42
|
+
export interface CardPolicyVendorSearchOption {
|
|
43
|
+
name: string;
|
|
44
|
+
vendorId: string;
|
|
45
|
+
}
|
|
46
|
+
export declare const toCardPolicyVendorSearchOption: (payload: CardPolicyVendorSearchVendorPayload) => CardPolicyVendorSearchOption;
|
|
47
|
+
interface CardPolicyTemplateEntityListPayload {
|
|
48
|
+
category_codes: string[];
|
|
49
|
+
merchant_names: string[];
|
|
50
|
+
}
|
|
51
|
+
interface CardPolicyTemplateSpendLimitsPayload {
|
|
52
|
+
transaction: number | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Per-template request shape. `POST /cards/1.0/policy-templates` now
|
|
56
|
+
* accepts a bulk wrapper (`CreateCardPolicyTemplatesRequest`); this
|
|
57
|
+
* interface describes a single entry inside the `templates` array.
|
|
58
|
+
*
|
|
59
|
+
* `PUT /cards/1.0/policy-templates/{id}` (update) still consumes this
|
|
60
|
+
* shape directly — see `UpdateCardPolicyTemplateRequest` below.
|
|
61
|
+
*/
|
|
62
|
+
export interface CreateCardPolicyTemplateRequest {
|
|
63
|
+
allowedEntity: CardPolicyTemplateEntityList;
|
|
64
|
+
applyToCards: ID[];
|
|
65
|
+
blockedEntity: CardPolicyTemplateEntityList;
|
|
66
|
+
description: string;
|
|
67
|
+
mode: CardPolicyTemplateMode;
|
|
68
|
+
name: string;
|
|
69
|
+
/**
|
|
70
|
+
* `null` indicates the require-receipt toggle is off (no threshold
|
|
71
|
+
* configured). The BE accepts `null` and treats it as "no requirement";
|
|
72
|
+
* `0` means the user explicitly entered zero with the toggle on.
|
|
73
|
+
*/
|
|
74
|
+
requiredReceiptThreshold: number | null;
|
|
75
|
+
spendLimits: CardPolicyTemplateSpendLimits;
|
|
76
|
+
}
|
|
77
|
+
export interface CreateCardPolicyTemplateRequestBody {
|
|
78
|
+
allowed_entity: CardPolicyTemplateEntityListPayload;
|
|
79
|
+
apply_to_cards: ID[];
|
|
80
|
+
blocked_entity: CardPolicyTemplateEntityListPayload;
|
|
81
|
+
description: string;
|
|
82
|
+
mode: string;
|
|
83
|
+
name: string;
|
|
84
|
+
required_receipt_threshold: number | null;
|
|
85
|
+
spend_limits: CardPolicyTemplateSpendLimitsPayload;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Bulk request for `POST /cards/1.0/policy-templates`. The single-policy
|
|
89
|
+
* create flow wraps its one request in a length-1 `templates` array;
|
|
90
|
+
* future multi-policy submit (AI CFO review step) sends N entries in a
|
|
91
|
+
* single round-trip.
|
|
92
|
+
*
|
|
93
|
+
* `sourceChatSessionId` ties the submit back to an AI CFO chat session so
|
|
94
|
+
* the BE can attribute the created templates to it. Manual create-page
|
|
95
|
+
* callers omit it.
|
|
96
|
+
*/
|
|
97
|
+
export interface CreateCardPolicyTemplatesRequest {
|
|
98
|
+
templates: CreateCardPolicyTemplateRequest[];
|
|
99
|
+
sourceChatSessionId?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface CreateCardPolicyTemplatesRequestBody {
|
|
102
|
+
templates: CreateCardPolicyTemplateRequestBody[];
|
|
103
|
+
source_chat_session_id?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface CardPolicyTemplatePayload {
|
|
106
|
+
allowed_entity: CardPolicyTemplateEntityListPayload;
|
|
107
|
+
applied_cards: ID[];
|
|
108
|
+
blocked_entity: CardPolicyTemplateEntityListPayload;
|
|
109
|
+
cards_count: number;
|
|
110
|
+
category_restrictions: unknown[];
|
|
111
|
+
created_at: string;
|
|
112
|
+
created_by: ID;
|
|
113
|
+
description: string;
|
|
114
|
+
mode: string;
|
|
115
|
+
name: string;
|
|
116
|
+
required_receipt_threshold: number | null;
|
|
117
|
+
spend_limits: CardPolicyTemplateSpendLimitsPayload;
|
|
118
|
+
status: string;
|
|
119
|
+
template_id: ID;
|
|
120
|
+
tenant_id: ID;
|
|
121
|
+
updated_at: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Per-template response envelope. Still returned by `PUT /policy-templates/{id}`,
|
|
125
|
+
* `GET /policy-templates/{id}`, and (as the row payload) the list endpoint.
|
|
126
|
+
* Also nested inside `CreateCardPolicyTemplatesResponseData.templates_created`.
|
|
127
|
+
*/
|
|
128
|
+
export interface CreateCardPolicyTemplateResponseData {
|
|
129
|
+
cards_applied: number;
|
|
130
|
+
template: CardPolicyTemplatePayload;
|
|
131
|
+
}
|
|
132
|
+
export type CreateCardPolicyTemplateResponse = ZeniAPIResponse<CreateCardPolicyTemplateResponseData>;
|
|
133
|
+
/**
|
|
134
|
+
* Per-item error returned by the bulk POST when one or more templates in
|
|
135
|
+
* the request fail validation / persistence. The exact field shape is
|
|
136
|
+
* **TBD** with the BE — `message` is the only guaranteed field today; the
|
|
137
|
+
* rest are best-effort placeholders that callers should not assume to be
|
|
138
|
+
* present.
|
|
139
|
+
*
|
|
140
|
+
* TODO: lock down the shape (`index`, `name`, `code`) once the BE
|
|
141
|
+
* documents it. See plan §"Open question to resolve with BE".
|
|
142
|
+
*/
|
|
143
|
+
export interface BulkCreateCardPolicyTemplateErrorPayload {
|
|
144
|
+
message: string;
|
|
145
|
+
code?: string;
|
|
146
|
+
index?: number;
|
|
147
|
+
name?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Wire shape returned by the bulk `POST /cards/1.0/policy-templates`.
|
|
151
|
+
* Partial success is allowed — `templates_created` holds the successfully
|
|
152
|
+
* created rows (each in the same envelope as the single endpoint), and
|
|
153
|
+
* `errors` holds per-item failures for the rest. `status.message` follows
|
|
154
|
+
* the "N of M templates created" convention.
|
|
155
|
+
*/
|
|
156
|
+
export interface CreateCardPolicyTemplatesResponseData {
|
|
157
|
+
errors: BulkCreateCardPolicyTemplateErrorPayload[];
|
|
158
|
+
templates_created: CreateCardPolicyTemplateResponseData[];
|
|
159
|
+
}
|
|
160
|
+
export type CreateCardPolicyTemplatesResponse = ZeniAPIResponse<CreateCardPolicyTemplatesResponseData>;
|
|
161
|
+
/**
|
|
162
|
+
* Camel-cased mirror of `BulkCreateCardPolicyTemplateErrorPayload` stored
|
|
163
|
+
* on the create-card-policy view slice so the UI can render a partial-success
|
|
164
|
+
* banner without re-touching the wire types.
|
|
165
|
+
*/
|
|
166
|
+
export interface BulkCreateCardPolicyTemplateError {
|
|
167
|
+
message: string;
|
|
168
|
+
code?: string;
|
|
169
|
+
index?: number;
|
|
170
|
+
name?: string;
|
|
171
|
+
}
|
|
172
|
+
export type UpdateCardPolicyTemplateRequest = CreateCardPolicyTemplateRequest;
|
|
173
|
+
export type UpdateCardPolicyTemplateRequestBody = CreateCardPolicyTemplateRequestBody;
|
|
174
|
+
export type UpdateCardPolicyTemplateResponseData = CreateCardPolicyTemplateResponseData;
|
|
175
|
+
export type UpdateCardPolicyTemplateResponse = CreateCardPolicyTemplateResponse;
|
|
176
|
+
export type CardPolicyDetailResponseData = CreateCardPolicyTemplateResponseData;
|
|
177
|
+
export type CardPolicyDetailResponse = CreateCardPolicyTemplateResponse;
|
|
178
|
+
/**
|
|
179
|
+
* Aggregate counters returned alongside the templates list. Stored on
|
|
180
|
+
* the entity slice (alongside `cardPolicyTemplateById`) so any list
|
|
181
|
+
* surface can read it without re-fetching.
|
|
182
|
+
*/
|
|
183
|
+
export interface CardPolicyStatsPayload {
|
|
184
|
+
active_policies: number;
|
|
185
|
+
total_cards: number;
|
|
186
|
+
total_templates: number;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Each list row is wrapped in the same `{cards_applied, template}`
|
|
190
|
+
* envelope the create endpoint returns. Only the `template` portion is
|
|
191
|
+
* stored on the entity slice; `cards_applied` is a one-shot summary
|
|
192
|
+
* carried over from create and not surfaced in the list state today.
|
|
193
|
+
*/
|
|
194
|
+
export interface CardPolicyListRowPayload {
|
|
195
|
+
data: CreateCardPolicyTemplateResponseData;
|
|
196
|
+
}
|
|
197
|
+
export interface ListCardPolicyTemplatesResponseData {
|
|
198
|
+
stats: CardPolicyStatsPayload;
|
|
199
|
+
templates: CardPolicyListRowPayload[];
|
|
200
|
+
}
|
|
201
|
+
export type ListCardPolicyTemplatesResponse = ZeniAPIResponse<ListCardPolicyTemplatesResponseData>;
|
|
202
|
+
export declare const toCardPolicyStats: (payload: CardPolicyStatsPayload) => CardPolicyStats;
|
|
203
|
+
export declare const toCardPolicyTemplateList: (data: ListCardPolicyTemplatesResponseData) => CardPolicyTemplate[];
|
|
204
|
+
export declare const toCardPolicyTemplate: (payload: CardPolicyTemplatePayload) => CardPolicyTemplate;
|
|
205
|
+
/**
|
|
206
|
+
* Re-shape a single camelCase create request into the snake_case wire
|
|
207
|
+
* body. Used by the bulk-create mapper to build each entry of the
|
|
208
|
+
* `templates` array, and directly by the update epic (PUT) since the
|
|
209
|
+
* update endpoint still consumes a single object.
|
|
210
|
+
*/
|
|
211
|
+
export declare const toCreateCardPolicyTemplateRequestBody: (request: CreateCardPolicyTemplateRequest) => CreateCardPolicyTemplateRequestBody;
|
|
212
|
+
/**
|
|
213
|
+
* Re-shape a bulk create request into the snake_case wire body for
|
|
214
|
+
* `POST /cards/1.0/policy-templates`. Maps each entry through
|
|
215
|
+
* `toCreateCardPolicyTemplateRequestBody` and only emits
|
|
216
|
+
* `source_chat_session_id` when the camelCase counterpart is defined,
|
|
217
|
+
* so manual-create callers don't ship a stray `undefined` over the wire.
|
|
218
|
+
*/
|
|
219
|
+
export declare const toCreateCardPolicyTemplatesRequestBody: (request: CreateCardPolicyTemplatesRequest) => CreateCardPolicyTemplatesRequestBody;
|
|
220
|
+
/**
|
|
221
|
+
* Map a single bulk-response error payload to its camelCased view shape.
|
|
222
|
+
* Defensive against missing optional fields (see `BulkCreateCardPolicyTemplateErrorPayload`
|
|
223
|
+
* docstring — the BE contract isn't fully locked yet).
|
|
224
|
+
*/
|
|
225
|
+
export declare const toBulkCreateCardPolicyTemplateError: (payload: BulkCreateCardPolicyTemplateErrorPayload) => BulkCreateCardPolicyTemplateError;
|
|
226
|
+
export declare const toUpdateCardPolicyTemplateRequestBody: (request: CreateCardPolicyTemplateRequest) => CreateCardPolicyTemplateRequestBody;
|
|
227
|
+
/**
|
|
228
|
+
* Seed an edit-form draft (`CreateCardPolicyTemplateRequest`) from an
|
|
229
|
+
* existing camelCased `CardPolicyTemplate`. Used by the detail-fetch
|
|
230
|
+
* epic so the edit page can render with the saved values pre-populated.
|
|
231
|
+
*/
|
|
232
|
+
export declare const toCardPolicyEditFormDraft: (template: CardPolicyTemplate) => CreateCardPolicyTemplateRequest;
|
|
233
|
+
/**
|
|
234
|
+
* Wire shape returned by `POST /cards/1.0/policy-documents/extract`.
|
|
235
|
+
* The backend OCRs / parses an uploaded policy document (PDF, image, etc.)
|
|
236
|
+
* and returns a best-effort set of policy rules + a confidence score.
|
|
237
|
+
*
|
|
238
|
+
* Consumers (manual `CardPolicyCreatePage` + AI CFO `CardPolicyInteractiveForm`)
|
|
239
|
+
* use `toExtractedCardPolicyRules` to map this onto the camelCase FE shape
|
|
240
|
+
* and then feed the result through `applyExtractedPolicyRulesToFormValues`
|
|
241
|
+
* (`@zeniai/web-components`) to seed the RHF form.
|
|
242
|
+
*/
|
|
243
|
+
export interface ExtractedCardPolicyRulesPayload {
|
|
244
|
+
allowed_entity: CardPolicyTemplateEntityListPayload;
|
|
245
|
+
blocked_entity: CardPolicyTemplateEntityListPayload;
|
|
246
|
+
confidence_score: number;
|
|
247
|
+
policy_name: string;
|
|
248
|
+
required_receipt_threshold: number;
|
|
249
|
+
transaction_limit: number;
|
|
250
|
+
}
|
|
251
|
+
export interface PolicyDocumentExtractResponseData {
|
|
252
|
+
extracted_rules: ExtractedCardPolicyRulesPayload;
|
|
253
|
+
message: string;
|
|
254
|
+
}
|
|
255
|
+
export type PolicyDocumentExtractResponse = ZeniAPIResponse<PolicyDocumentExtractResponseData>;
|
|
256
|
+
export declare const toExtractedCardPolicyRules: (payload: ExtractedCardPolicyRulesPayload) => ExtractedCardPolicyRules;
|
|
257
|
+
/**
|
|
258
|
+
* Wire shape returned by `POST /cards/1.0/ai-cfo/policy-recommendation-from-upload`.
|
|
259
|
+
* Chained after `extractPolicyDocument` succeeds in the AI CFO `upload`
|
|
260
|
+
* flow: the FE forwards the just-returned `extracted_rules` and the BE
|
|
261
|
+
* synthesizes a wizard plan + upload source metadata.
|
|
262
|
+
*
|
|
263
|
+
* The response mirrors the same `mode`-discriminated envelope the
|
|
264
|
+
* controller API ships for `auto` / `guided`, but always with `mode:
|
|
265
|
+
* "upload"` and a populated `wizard_plan.step_5_review`. The FE merges
|
|
266
|
+
* the returned `wizard_plan` + `source` into the in-flight AI CFO
|
|
267
|
+
* answer's `CardPolicyInitialData` via
|
|
268
|
+
* `updateAiCfoAnswerCardPolicyWizardPlan`.
|
|
269
|
+
*/
|
|
270
|
+
export interface CardPolicyRecommendationFromUploadResponseData {
|
|
271
|
+
mode: 'upload';
|
|
272
|
+
source: import('../aiCfo/aiCfoPayload').CardPolicyUploadSourcePayload;
|
|
273
|
+
tenant_id: string;
|
|
274
|
+
wizard_plan: import('../aiCfo/aiCfoPayload').CardPolicyWizardPlanPayload;
|
|
275
|
+
}
|
|
276
|
+
export type CardPolicyRecommendationFromUploadResponse = ZeniAPIResponse<CardPolicyRecommendationFromUploadResponseData>;
|
|
277
|
+
export {};
|