Skip to main content

Core SDK

import initFanfare from "@fanfare-io/fanfare-sdk-core";

const sdk = await initFanfare({
  organizationId: "org_123",
  publishableKey: "pk_live_123",
});
OptionTypePurpose
organizationIdstringYour Fanfare organization ID.
publishableKeystringYour browser-safe publishable key.
credentialsRequestCredentialsControls browser credential behavior for SDK requests.
auth.persistSessionbooleanControls local session persistence.
auth.sessionDurationnumberSession duration in seconds when applicable.
syncboolean or configuration objectEnables or configures browser tab synchronization.
featuresobjectAdvanced feature flags. Use only with guidance from Fanfare.
The SDK default environment and API URL are the supported public integration path. Do not override them unless your Fanfare contact explicitly asks you to.

Guided troubleshooting options

OptionPurpose
apiUrlTemporary API URL override when directed by Fanfare.
debugTemporary SDK debug logging for development or guided troubleshooting.
Only use guided troubleshooting options while investigating a specific issue.

React provider

FanfareProvider accepts the core SDK configuration plus React-specific props.
PropPurpose
childrenReact subtree that can use Fanfare hooks and components.
autoRestoreRestores local session on mount. Defaults to true.
autoResumeResumes known journeys after restore. Defaults to true.
loadingComponentReact node shown while the SDK initializes.
localeLocale for SDK component text.
translationsPartial translation overrides.

ExperienceWidget

PropPurpose
experienceIdRequired experience ID.
autoStartStarts the journey on mount.
accessCodeProvides an access code when starting or rerouting.
autoEnterWaitlistEnters waitlist automatically when available.
themePer-widget brand theme.
variantdefault, retro, rounded, or clean.
slotsTargeted stage and phase overrides.
childrenFull render prop override for the widget instance.
checkoutUrlDefault checkout destination for granted state.
onJourneyChangeCalled when the raw journey snapshot changes.
onGrantedCalled when a grant is available.
onErrorCalled when the widget reports an error.
classNameAdditional class for the React widget container.

Web component registration

OptionPurpose
organizationIdDefault organization ID for registered elements.
publishableKeyDefault publishable key for registered elements.
autoRestoreRestores local session on mount.
autoResumeResumes known journeys after restore.
localeDefault locale.
translationsDefault translation overrides.
themeConfigDefault brand theme.
variantDefault widget variant.
containerClassDefault container class.