import { BeamPlugin, BeamConfigOptions } from './beam.js'; import '../chunks/utils-BPcZ5h8J.esm.js'; import 'lodash-es/debounce'; import 'lodash-es/isEqual'; type beforeLogEventFn = (eventName: string, eventValue: any, metadata: Record) => Record; /** * StatSig Docs: https://docs.statsig.com/client/jsClientSDK */ type StatsigPluginOptions = { statsigApiKey: string; beforeLogEvent?: beforeLogEventFn; }; declare global { interface Window { statsig?: any; } } type SessionReturnOrigin = "cart_abandon" | "checkout_abandon"; type Experiments = { /** Whether Beam widgets should be shown to users */ shouldShowBeam: boolean; /** Whether events should be logged to Statsig */ isLoggingEnabled: boolean; /** The source through which the user returned to their session */ sessionReturnOrigin?: SessionReturnOrigin | null; }; /** * Sets up Statsig for A/B testing and shows/hides Beam based on default experiment rules. * @example * import { StatsigPlugin } from '@beamimpact/web-sdk/dist/integrations/statsig' * import { init } from '@beamimpact/web-sdk/dist/integrations/beam' * * const beam = await init({ * apiKey: '', * chainId: 1, * storeId: 1, * domain: 'my-store.com' // in case site uses subdomains for different pages * plugins: [ * new StatsigPlugin({ statsigApiKey: '' }) * ] * }) * * Once initialized, all Beam widgets have display: none unless user is assigned to A/B test group that shows Beam * To hide additional elements, add the CSS className "beam-sync-visibility" to them * To programmatically access the experiment state: getConfig().plugins.statsig.experiments.shouldShowBeam */ declare class StatsigPlugin implements BeamPlugin { #private; name: string; statsig: any; statsigApiKey: string; experiments: Experiments; stableId?: string; beforeLogEvent?: beforeLogEventFn; sessionReturnOrigin?: SessionReturnOrigin; constructor(options: StatsigPluginOptions); init(config: BeamConfigOptions): Promise; logEvent: (name: string, value: string | number | boolean, metadata?: Record) => void; } export { StatsigPlugin };