InstaFixConfig is a discriminated union over the two transport modes — endpointorstore, never both, never neither. TypeScript rejects the invalid combinations at compile time instead of leaving you to discover them at runtime:
initInstaFix({ endpoint: "/api/instafix", store, projectName: "x" }); // ✗ both modesinitInstaFix({ store, apiKey: "sk-…", projectName: "x" }); // ✗ HTTP-only option in store modeinitInstaFix({ projectName: "x" }); // ✗ no transport
Option
Type
Default
What it does
endpoint
string
—
HTTP mode. URL of your InstaFix API (e.g. /api/instafix)
store
InstaFixStore
—
Store mode. Write to a store in the browser instead of HTTP — excludes endpoint, apiKey and headers
projectName
string
—
Required in both modes. Scopes everything the widget reads and writes
apiKey
string
—
HTTP mode only. Sent as Authorization: Bearer <key> on every request
headers
object or function
—
HTTP mode only. Extra headers, static or computed per request (sync or async). Merged last, so an explicit Authorization here beats apiKey
The two halves are exported as InstaFixHttpConfig and InstaFixStoreConfig, which is what you want when a wrapper component takes the config as a prop and only supports one mode:
import type { InstaFixHttpConfig } from "@instafix/widget";function mountFeedback(config: InstaFixHttpConfig) { /* endpoint guaranteed */ }
apiKey ships in your client bundle — every visitor can read it. Use it for internal tools already behind a login; on public sites prefer headers with a function that returns a short-lived token.
Only show markers created on the current page. Filtered both server-side and client-side, so annotations can't leak across pages
getPageScope
() => { url, urlPattern }
pathname
Customize what "the current page" means — return a stable url (and optionally a template like /products/:id as urlPattern) so dynamic routes share their feedback
watchNavigation
boolean
true
Re-fetch feedbacks on SPA navigation (History API patch + popstate/hashchange). Data only — it never scrolls or refocuses. Set false and call refresh() yourself to opt out
The default page scope is window.location.pathname — by construction it contains no query string, so tokens or search params in the URL never reach the server. If you provide getPageScope, keep that property: return a path or a template, not location.href.