SponsorkitOptions
Options for the native client.
On this page
Options for the native client.
import type { SponsorkitOptions } from "@sponsorkit/sdk/node";
interface SponsorkitOptions extends SponsorkitCoreOptions { … }Interface, exported from @sponsorkit/sdk/node.
Extends SponsorkitCoreOptions.
Properties#
appName#
appName?: stringShown on the consent page as "says it is" (max 64 characters).
storageDir#
storageDir?: stringDirectory for the storage files. Default: the per-user config directory (see defaultStorageDir()). Ignored when storage is given.
signInMethod#
signInMethod?: SignInMethodauto (default) tries loopback and falls back to paste-back when headless, over SSH, when the browser can't be opened, or when the loopback receiver can't bind.
Type: SignInMethod
openBrowser#
openBrowser?: (url: string) => void | Promise<void>Opens a URL in a browser. Default: the system browser (open / xdg-open / rundll32), without a shell.
promptForCode#
promptForCode?: (url: string) => string | Promise<string>Asks the user for the paste-back code; receives the URL to open. Default: prints to stderr and reads a line from stdin.
output#
output?: { write(text: string): unknown }Where to print messages for the user. Default: process.stderr.
github#
github?: stringGitHub user or organization login that receives sponsorships.
Inherited from SponsorkitCoreOptions.github.
openCollective#
openCollective?: stringOpen Collective collective slug that receives contributions.
Inherited from SponsorkitCoreOptions.openCollective.
cacheTtl#
cacheTtl?: numberSeconds a cached result is served without calling the API. Default 3600, minimum 60.
Inherited from SponsorkitCoreOptions.cacheTtl.
mock#
mock?: MockOptionMock mode: a preset name or { contributions }. Overrides SPONSORKIT_MOCK.
Inherited from SponsorkitCoreOptions.mock.
Type: MockOption
storage#
storage?: SponsorkitStorage | WebStorageLikeWhere 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?: stringAPI 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?: stringSite 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?: EnvEnvironment 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?: booleanForces 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?: numberSeconds to wait for a sign-in (popup, loopback or paste-back) before rejecting with timeout. Default 300.
Inherited from SponsorkitCoreOptions.signInTimeout.
checkoutPollInterval#
checkoutPollInterval?: numberSeconds between checkout polls. Default 60.
Inherited from SponsorkitCoreOptions.checkoutPollInterval.
clock#
clock?: () => numberClock in epoch milliseconds, used for cache TTL, Retry-After and nag timing. Default Date.now.
Inherited from SponsorkitCoreOptions.clock.
fetch#
fetch?: FetchLikeCustom fetch implementation. Default: the global fetch.
Inherited from SponsorkitCoreOptions.fetch.
Type: FetchLike
requestTimeout#
requestTimeout?: numberSeconds 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?: booleanWhether the app runs interactively, for nag().due(). Overrides platform detection (TTY on native).
Inherited from SponsorkitCoreOptions.interactive.