Przejdź do głównej zawartości

Interface: StorefrontClientConfig

Properties

apiUrl

apiUrl: string

GraphQL API URL (e.g. 'https://api.doswiftly.pl')


debug?

optional debug?: boolean | "verbose" | DebugOptions

Enable debug logging (request/response in dev).

Tagged union (backward-compatible):

  • false / omitted — no logging.
  • true — minimal logs: operationName + variables on request, status + hasErrors + userErrors on response. The exact output is preserved from the v17.1.0 minimal mode.
  • 'verbose' — every dimension on: full query + variables + headers + response body + userErrors + timing.
  • DebugOptions — granular opt-in per dimension.

Falls back to process.env.DOSWIFTLY_SDK_DEBUG ('verbose' / 'true' / '1') when this prop is omitted. NODE_ENV=production requires an explicit debug setting — env-driven verbose mode is no-op in production to prevent accidental logging of customer PII.

Authorization: Bearer … and customerAccessToken=… cookie values are unconditionally redacted to ***<last4> whenever headers are logged, regardless of mode.


defaultHeaders?

optional defaultHeaders?: Record<string, string>

Default headers for all requests


fetch?

optional fetch?: {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Custom fetch implementation (polyfill, test mocks, edge)

Call Signature

(input, init?): Promise<Response>

MDN Reference

Parameters
input

RequestInfo | URL

init?

RequestInit

Returns

Promise<Response>

Call Signature

(input, init?): Promise<Response>

MDN Reference

Parameters
input

string | Request | URL

init?

RequestInit

Returns

Promise<Response>


graphqlPath?

optional graphqlPath?: string

GraphQL endpoint path appended to apiUrl. Defaults to /storefront/graphql (the public catalog surface — cacheable). Set to /storefront/customer/graphql to target the customer-account surface (orders, addresses, wishlist, loyalty), which is always served fresh (never shared-cached). Must start with /.


middleware?

optional middleware?: Middleware[]

Middleware pipeline


shopSlug

shopSlug: string

Shop slug for multi-tenant routing


telemetry?

optional telemetry?: boolean | { endpoint?: string; heartbeatIntervalMs?: number; includeNonProduction?: boolean; }

Cookieless visitor telemetry (page-load ping + heartbeat while the tab is visible). Collects the raw referrer, user agent and an ephemeral per-tab session id — no cookies, no PII.

Enabled by default on a live shop; pass false to opt out. Nothing is sent from a local address (localhost, a loopback IP, a .local / .localhost name) or from a build whose mode is not production, so your development sessions stay out of the shop's figures. Set includeNonProduction: true when you deliberately want to measure such an environment.


trustedDocuments?

optional trustedDocuments?: boolean

Whether the target GraphQL surface resolves persisted-document ids (trusted documents). The default public catalog endpoint does; the customer-account endpoint does not. When false, the client always sends the full query — it never uses the cacheable GET nor sends a documentId over POST. Defaults to true. createCustomerClient forces false; set it yourself only when pointing createStorefrontClient at a custom endpoint without persisted-document support.