MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / UpsellDialog

Function UpsellDialog

packages/web/src/features/billing/upsellDialog.tsx:37–65  ·  view source on GitHub ↗
({ open, onOpenChange, source, returnPath }: UpsellDialogProps)

Source from the content-addressed store, hash-verified

35}
36
37export function UpsellDialog({ open, onOpenChange, source, returnPath }: UpsellDialogProps) {
38 const { data: offers, isPending, isError, refetch } = useOffers();
39 const captureEvent = useCaptureEvent();
40
41 useEffect(() => {
42 if (open) {
43 captureEvent('wa_upsell_dialog_viewed', { source });
44 }
45 }, [open, source, captureEvent]);
46
47 return (
48 <Dialog open={open} onOpenChange={onOpenChange}>
49 <DialogContent className="max-w-2xl gap-6 focus:outline-none">
50 {isError ? (
51 // Keep the dialog open with a recoverable error state rather than
52 // closing it out from under the user — the built-in close button
53 // is still the dismiss affordance.
54 <UpsellLoadError variant="dialog" onRetry={() => { void refetch(); }} />
55 ) : isPending ? (
56 <div className="flex items-center justify-center py-12">
57 <Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
58 </div>
59 ) : (
60 <UpsellPanelContent offers={offers} source={source} returnPath={returnPath} variant="dialog" licenseState="free" />
61 )}
62 </DialogContent>
63 </Dialog>
64 );
65}
66
67interface UpsellLoadErrorProps {
68 variant: "dialog" | "inline";

Callers

nothing calls this directly

Calls 3

useOffersFunction · 0.90
useCaptureEventFunction · 0.85
captureEventFunction · 0.50

Tested by

no test coverage detected