import type { BillingCheckoutStatus } from "@opengeni/sdk"; import type { OpenGeniBrowserClient } from "@opengeni/sdk/browser"; import type { PageHost } from "./navigation.js"; export type CreditCheckoutClient = Pick; /** Stripe replaces this placeholder in a success URL with the session id. */ export declare const CHECKOUT_SESSION_PLACEHOLDER = "{CHECKOUT_SESSION_ID}"; /** Organization billing, where a same-tab checkout returns and celebrates. */ export declare function billingCheckoutReturnUrl(origin: string, workspaceId: string, outcome: "success" | "cancelled"): string; /** The small static page a checkout tab lands on; it asks the person to go back. */ export declare function checkoutTabReturnUrl(origin: string, outcome: "success" | "cancelled"): string; /** * Open the checkout tab inside the click handler, before any await, so the * browser allows it. It shows a short message until checkout loads. Null when * the browser blocks new tabs. */ export declare function openCheckoutTab(page: Pick): Window | null; export type StartedCreditCheckout = { checkoutSessionId: string; url: string; /** False when checkout took over this page (the browser blocked the tab). */ inNewTab: boolean; }; /** * Start a checkout for credits: a fixed amount, a promotion code, or both. A * fixed-amount USD code sets the amount by itself. `tab` comes from * `openCheckoutTab()` in the same click; without one, this page navigates. */ export declare function startCreditCheckout(client: CreditCheckoutClient, input: { accountId: string; workspaceId: string; amountUsd?: number | undefined; promotionCode?: string | undefined; tab: Window | null; signal?: AbortSignal | undefined; /** The console origin the checkout returns to. */ origin: string; /** Leaves for checkout when no tab was opened. */ navigate: (url: string) => void; /** `navigate` opens checkout beside this page (an embed) instead of leaving it. */ navigateOpensBeside?: boolean | undefined; }): Promise; /** * Poll one checkout until its credits are granted or it expires. Resolves with * the final status; rejects only when aborted. Transient read failures keep * polling. */ export declare function waitForCheckoutCredits(client: Pick, input: { accountId: string; checkoutSessionId: string; signal: AbortSignal; intervalMs?: number | undefined; onStatus?: ((status: BillingCheckoutStatus) => void) | undefined; }): Promise;