Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/react/src/kits/ai/F0AiChat/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ export type AiChatCreditWarning = {
onDismiss?: () => void
/** Called when the user clicks the "Get Credits" button. */
onGetCredits?: () => void
/**
* Icon rendered to the left of the "Get Credits" label. Only used when
* `onGetCredits` is provided. Hosts typically pass the `Upsell` icon.
*/
getCreditsIcon?: IconType
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Marketplace,
Pencil,
Search,
Upsell,
} from "@/icons/app"
import { mockTranscribe } from "@/lib/storybook-utils/ai-mocks"

Expand Down Expand Up @@ -99,6 +100,7 @@ const FILE_UPLOAD_CONFIG: AiChatFileAttachmentConfig = {
const CREDIT_WARNING: AiChatCreditWarning = {
level: "soft",
onGetCredits: () => console.log("get credits clicked"),
getCreditsIcon: Upsell,
onDismiss: () => console.log("dismiss clicked"),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { type AiChatCreditWarning } from "../../F0AiChat/types"
const creditWarningConfig = {
soft: {
text: "" as string,
bg: "bg-f1-background-info",
fontColor: "text-f1-foreground-info",
formBorder: "[&_form]:border-f1-border-info",
bg: "bg-f1-background-secondary",
fontColor: "text-f1-foreground-secondary",
formBorder: "[&_form]:border-f1-border",
},
}

Expand Down Expand Up @@ -50,6 +50,7 @@ export const CreditWarningWrapper = ({
label={translation.ai.creditWarning.getCredits ?? ""}
size="sm"
variant="outline"
icon={creditWarning.getCreditsIcon}
tooltip={translation.ai.creditWarning.getCredits ?? ""}
onClick={creditWarning.onGetCredits}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
Pencil,
Settings,
SolidPlay,
Upsell,
} from "@/icons/app"
import { F0Alert } from "@/components/F0Alert"
import { F0Button } from "@/components/F0Button"
Expand Down Expand Up @@ -3104,6 +3105,7 @@ function CreationWithAIFlow({
title: "Redirecting you to billing to top up credits…",
variant: "default",
}),
getCreditsIcon: Upsell,
onDismiss: () => setCreditWarningDismissed(true),
}
: undefined,
Expand Down
Loading