SponsorkitOptions

Options for the browser client.

On this page

Options for the browser client.

import type { SponsorkitOptions } from "@sponsorkit/sdk";

interface SponsorkitOptions extends SponsorkitCoreOptions { … }

Interface, exported from @sponsorkit/sdk.

Extends SponsorkitCoreOptions.

Properties#

returnTo#

returnTo?: string

Redirect fallback when the popup is blocked: an https (or localhost) URL of your app to return to with ?sponsorkit_code=…. Without it, a blocked popup rejects with popup_blocked.

openWindow#

openWindow?: (url: string) => Window | null

Opens the popup. Must open synchronously. Default: window.open(url, "sponsorkit", features).

popupFeatures#

popupFeatures?: string

window.open features. Default "popup,width=520,height=720".

github#

github?: string

GitHub user or organization login that receives sponsorships.

Inherited from SponsorkitCoreOptions.github.

openCollective#

openCollective?: string

Open Collective collective slug that receives contributions.

Inherited from SponsorkitCoreOptions.openCollective.

cacheTtl#

cacheTtl?: number

Seconds a cached result is served without calling the API. Default 3600, minimum 60.

Inherited from SponsorkitCoreOptions.cacheTtl.

mock#

mock?: MockOption

Mock mode: a preset name or { contributions }. Overrides SPONSORKIT_MOCK.

Inherited from SponsorkitCoreOptions.mock.

Type: MockOption

storage#

storage?: SponsorkitStorage | WebStorageLike

Where the session token, cache and nag state live. Accepts a SponsorkitStorage or a Web Storage object.

Inherited from SponsorkitCoreOptions.storage.

Type: SponsorkitStorage, WebStorageLike

apiBaseUrl#

apiBaseUrl?: string

API origin used for every API call (/api/v1/…), for self-hosting and tests. Default https://api.sponsorkit.io. An empty string counts as unset.

Inherited from SponsorkitCoreOptions.apiBaseUrl.

siteBaseUrl#

siteBaseUrl?: string

Site base URL (origin plus optional base path) used for every page: /connect/, /checkout/, checkoutUrl() and the loopback checkout redirect. Default https://ffmathy.github.io/sponsorkit, or apiBaseUrl when that is set and this isn't (single-origin self-hosting, tests). An empty string counts as unset; trailing slashes are trimmed.

Inherited from SponsorkitCoreOptions.siteBaseUrl.

env#

env?: Env

Environment used for SPONSORKIT_DISABLE, SPONSORKIT_MOCK, SPONSORKIT_NO_NAG, SPONSORKIT_DEV_CHECKS and CI. When given, it replaces the process environment for these variables (it is not merged). Default: the process environment.

Inherited from SponsorkitCoreOptions.env.

Type: Env

devChecks#

devChecks?: boolean

Forces the dev-time target existence check on or off. Default: on when SPONSORKIT_DEV_CHECKS is set (in env) or process.env.NODE_ENV is development (bundlers inline it), off otherwise.

Inherited from SponsorkitCoreOptions.devChecks.

signInTimeout#

signInTimeout?: number

Seconds to wait for a sign-in (popup, loopback or paste-back) before rejecting with timeout. Default 300.

Inherited from SponsorkitCoreOptions.signInTimeout.

checkoutPollInterval#

checkoutPollInterval?: number

Seconds between checkout polls. Default 60.

Inherited from SponsorkitCoreOptions.checkoutPollInterval.

clock#

clock?: () => number

Clock in epoch milliseconds, used for cache TTL, Retry-After and nag timing. Default Date.now.

Inherited from SponsorkitCoreOptions.clock.

fetch#

fetch?: FetchLike

Custom fetch implementation. Default: the global fetch.

Inherited from SponsorkitCoreOptions.fetch.

Type: FetchLike

requestTimeout#

requestTimeout?: number

Seconds before an API request is abandoned. getFinancialContribution() then serves the stale cache; the sign-in code exchange rejects with network_error. Default 30; 0 disables the limit.

Inherited from SponsorkitCoreOptions.requestTimeout.

interactive#

interactive?: boolean

Whether the app runs interactively, for nag().due(). Overrides platform detection (TTY on native).

Inherited from SponsorkitCoreOptions.interactive.