import * as react_jsx_runtime from 'react/jsx-runtime'; import * as React from 'react'; import { O as OneAuthClient } from './client-CPt1hn4_.js'; import { a2 as SendIntentOptions, j as SendIntentResult, C as CloseOnStatus, aA as SponsorshipUrlConfig, az as SponsorshipCallbackConfig } from './types-BN6cCuAd.js'; export { O as OneAuthError } from './errors-Cg605N0t.js'; import 'viem'; import '@rhinestone/sdk'; interface PayButtonProps { /** The OneAuthClient instance */ client: OneAuthClient; /** * Intent parameters (calls, targetChain, etc.). `accountAddress` is omitted * because PayButton resolves it internally (cached session or auth modal) and * overwrites it on the sendIntent call — callers pass only calls + target * chain, keeping the drop-in payment API intact. */ intent: Omit; /** Called when payment succeeds */ onSuccess?: (result: SendIntentResult) => void; /** Called when payment fails */ onError?: (error: Error) => void; /** When to close the dialog and return success. Defaults to "preconfirmed" */ closeOn?: CloseOnStatus; /** Button text - defaults to "Pay with 1auth" */ children?: React.ReactNode; /** Custom class name */ className?: string; /** Custom inline styles (merged with defaults) */ style?: React.CSSProperties; /** Disabled state */ disabled?: boolean; /** Hide the fingerprint icon */ hideIcon?: boolean; } /** * A pre-built payment button that integrates 1auth passkey authentication * and intent submission into a single interactive element. * * The button manages its own loading and success states. On first click it * recovers the last authenticated user from `localStorage`; if none is found * it opens the auth modal before submitting the intent. On subsequent clicks * the stored session is reused so the user only needs to re-authenticate when * their session has been invalidated server-side. * * @param props - See {@link PayButtonProps} for the full set of options. * * @example * ```tsx * import { PayButton } from "@rhinestone/1auth/react"; * import { client } from "./auth"; // your OneAuthClient instance * * console.log("tx:", result.transactionHash)} * onError={(err) => console.error(err)} * > * Pay $5 USDC * * ``` */ declare function PayButton({ client, intent, onSuccess, onError, closeOn, children, className, style, disabled, hideIcon, }: PayButtonProps): react_jsx_runtime.JSX.Element; /** * Check whether a cached JWT access token is still safely usable. * * Decodes the payload WITHOUT verifying the signature — the client only * needs the `exp` claim to know when to re-mint; verification happens * server-side. Returns `false` (unusable) when the token is expired or * within {@link ACCESS_TOKEN_EXPIRY_MARGIN_MS} of expiry. Tokens that * can't be decoded or carry no numeric `exp` are treated as unusable so * a malformed cache entry never gets served indefinitely. */ declare function isAccessTokenFresh(token: string): boolean; /** * Build a {@link SponsorshipCallbackConfig} from token endpoint URLs with an * expiry-aware access-token cache held in a closure. * * Exported as the non-React core of {@link useSponsorship} so the caching * behaviour is unit-testable (and usable outside React). The access token is * cached and re-used only while its `exp` claim is comfortably in the * future — a long-lived tab must re-mint rather than serve a token the * orchestrator will reject with a 401 (`"exp" claim timestamp check * failed`), which previously surfaced to users as "Failed to get quote from * orchestrator". The extension token is always fetched fresh per intent * because it binds to a specific `intentOp`. * * Both fetches use `credentials: "include"` so the app's own session cookies * authenticate the user — no separate auth channel needed. */ declare function createCachedSponsorship(config: SponsorshipUrlConfig): SponsorshipCallbackConfig; /** * React hook wrapper around {@link createCachedSponsorship}. The returned * config is stable across renders (memoized by URL), so passing it to * `new OneAuthClient({ sponsorship })` or `client.setSponsorship(...)` does * not thrash the client. Re-creating on URL change naturally resets the * cached token so we never serve a token minted against the previous * endpoint. */ declare function useSponsorship(config: SponsorshipUrlConfig): SponsorshipCallbackConfig; export { CloseOnStatus, PayButton, type PayButtonProps, SendIntentOptions, SendIntentResult, createCachedSponsorship, isAccessTokenFresh, useSponsorship };